summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/cp
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2004-07-28 03:11:36 +0000
committerkan <kan@FreeBSD.org>2004-07-28 03:11:36 +0000
commite0020c9fe3d2c91658ad0f59cb6a55c44f909db3 (patch)
treeb406472295ae0b130894cc19f02f43b36157fec6 /contrib/gcc/cp
parentb754d213ab76dee1e7bcd5acb4becd5658c0ca99 (diff)
parent5e00ec74d8ce58f99801200d4d3d0412c7cc1b28 (diff)
downloadFreeBSD-src-e0020c9fe3d2c91658ad0f59cb6a55c44f909db3.zip
FreeBSD-src-e0020c9fe3d2c91658ad0f59cb6a55c44f909db3.tar.gz
This commit was generated by cvs2svn to compensate for changes in r132718,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/gcc/cp')
-rw-r--r--contrib/gcc/cp/ChangeLog17372
-rw-r--r--contrib/gcc/cp/ChangeLog.14
-rw-r--r--contrib/gcc/cp/ChangeLog.28
-rw-r--r--contrib/gcc/cp/ChangeLog.322648
-rw-r--r--contrib/gcc/cp/Make-lang.in241
-rw-r--r--contrib/gcc/cp/NEWS4
-rw-r--r--contrib/gcc/cp/call.c2688
-rw-r--r--contrib/gcc/cp/cfns.gperf5
-rw-r--r--contrib/gcc/cp/class.c2641
-rw-r--r--contrib/gcc/cp/config-lang.in14
-rw-r--r--contrib/gcc/cp/cp-lang.c132
-rw-r--r--contrib/gcc/cp/cp-tree.def85
-rw-r--r--contrib/gcc/cp/cp-tree.h2421
-rw-r--r--contrib/gcc/cp/cvt.c419
-rw-r--r--contrib/gcc/cp/cxx-pretty-print.c1737
-rw-r--r--contrib/gcc/cp/cxx-pretty-print.h52
-rw-r--r--contrib/gcc/cp/decl.h15
-rw-r--r--contrib/gcc/cp/decl2.c3146
-rw-r--r--contrib/gcc/cp/dump.c91
-rw-r--r--contrib/gcc/cp/error.c1404
-rw-r--r--contrib/gcc/cp/expr.c46
-rw-r--r--contrib/gcc/cp/friend.c222
-rw-r--r--contrib/gcc/cp/g++spec.c133
-rw-r--r--contrib/gcc/cp/init.c1505
-rw-r--r--contrib/gcc/cp/lang-specs.h34
-rw-r--r--contrib/gcc/cp/lex.c895
-rw-r--r--contrib/gcc/cp/lex.h53
-rw-r--r--contrib/gcc/cp/mangle.c717
-rw-r--r--contrib/gcc/cp/method.c679
-rw-r--r--contrib/gcc/cp/name-lookup.c4923
-rw-r--r--contrib/gcc/cp/name-lookup.h335
-rw-r--r--contrib/gcc/cp/operators.def22
-rw-r--r--contrib/gcc/cp/optimize.c84
-rw-r--r--contrib/gcc/cp/parser.c15323
-rw-r--r--contrib/gcc/cp/pt.c4362
-rw-r--r--contrib/gcc/cp/repo.c101
-rw-r--r--contrib/gcc/cp/rtti.c472
-rw-r--r--contrib/gcc/cp/search.c1552
-rw-r--r--contrib/gcc/cp/semantics.c2558
-rw-r--r--contrib/gcc/cp/tree.c1400
-rw-r--r--contrib/gcc/cp/typeck.c2444
-rw-r--r--contrib/gcc/cp/typeck2.c450
42 files changed, 60169 insertions, 33268 deletions
diff --git a/contrib/gcc/cp/ChangeLog b/contrib/gcc/cp/ChangeLog
index e05c075..7462819 100644
--- a/contrib/gcc/cp/ChangeLog
+++ b/contrib/gcc/cp/ChangeLog
@@ -1,16681 +1,1399 @@
-2003-10-23 Jason Merrill <jason@redhat.com>
+2004-07-21 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- PR c++/12726
- * tree.c (build_target_expr_with_type): Don't call force_rvalue
- for CONSTRUCTORs.
+ PR c++/16175
+ * error.c (dump_type) <BOUND_TEMPLATE_TEMPLATE_PARM case>: Output
+ cv qualifier.
-2003-10-16 Release Manager
+2004-07-20 Mark Mitchell <mark@codesourcery.com>
- * GCC 3.3.2 Released.
-
-2003-10-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/12369
- * decl.c (grokdeclarator): Handle TEMPLATE_ID_EXPR if friend
- is a member of other class.
- * friend.c (do_friend): Don't build TEMPLATE_DECL if friend
- is a specialization of function template.
-
-2003-10-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/7939
- * typeck.c (comptypes): Don't ICE when its first argument is
- error_mark_node.
- (compparms): Reverse the arguments of same_type_p.
-
-2003-10-14 Jason Merrill <jason@redhat.com>
-
- PR c++/11878
- * tree.c (build_target_expr_with_type): Call force_rvalue for
- classes with non-trivial copy ctors.
-
- PR c++/11063
- * typeck.c (build_modify_expr): Call convert rather than abort.
-
-2003-10-06 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10147
- * call.c (initialize_reference): Tweak error message.
-
- PR c++/12337
- * init.c (build_new_1): Make sure that the expression returned is
- not an lvalue.
-
- PR c++/12344, c++/12236, c++/8656
- * decl.c (start_function): Do not ignore attributes embedded in a
- function declarator.
-
-2003-10-04 Roger Sayle <roger@eyesopen.com>
-
- PR c++/11409
- * class.c (resolve_address_of_overloaded_function): When building
- list of matching non-template function decls, ignore anticipated
- declarations of undeclared or shadowed GCC builtins.
-
-2003-10-02 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/12486
- * typeck.c (finish_class_member_access_expr): Issue diagnostic
- on erroneous use of qualified name.
-
-2003-07-09 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (break_out_calls): Remove declaration.
- * tree.c (break_out_calls): Remove.
- * typeck.c (build_modify_expr): Avoid invalid sharing of trees.
-
-2003-09-18 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (resolve_address_of_overloaded_function): Replace
- complain parameter with flags parameter.
- (instantiate_type): Adjust accordingly.
-
-2003-09-17 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11991
- * typeck2.c (incomplete_type_diagnostic): Robustify.
-
- PR c++/12266
- * cp-tree.h (tsubst_flags_t): Add tf_conv.
- * class.c (standard_conversion): Pass tf_conv to
- instantiate_type.
- (resolve_address_of_overloaded_function): Do not call mark_used
- when just checking conversions.
-
-2003-09-14 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/3907
- * cp-tree.h (innermost_scope_is_class_p): New function.
- * class.c (maybe_note_name_used_in_class): Refine test for whether
- or not we are in a class scope.
- * decl.c (innermost_scope_is_class_p): Define.
-
-2003-09-14 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (layout_class_type): Make DECL_MODE match TYPE_MODE for
- an bit-field whose width exceeds that of its type.
-
-2003-09-09 Steven Bosscher <steven@gcc.gnu.org>
-
- PR c++/11595
- * decl.c (define_label): Remove unreachable timevar pop.
- Always return the decl, even if the definition is invalid.
-
-2003-09-08 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11786
- * decl2.c (add_function): Do not complain about seeing the same
- non-function twice.
-
-2003-09-08 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/5296
- * pt.c (try_one_overload): Add addr_p parameter.
- (resolve_overloaded_unification): Pass it.
-
-2003-09-07 Jason Merrill <jason@redhat.com>
-
- PR c++/12181
- * typeck.c (build_modify_expr): Don't always stabilize the lhs and
- rhs. Do stabilize the lhs of a MODIFY_EXPR used on the lhs.
-
-2003-09-06 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11867
- * call.c (standard_conversion): Improve comments.
- (perform_direct_initialization): Make sure we return an expression
- of the correct type.
- * typeck.c (build_static_cast): Check for ambiguity and
- accessibility when performing conversions.
-
-2003-09-05 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/12163
- * call.c (perform_direct_initialization): Correct logic for
- direct-initialization of a class type.
-
- PR c++/12146
- * pt.c (lookup_template_function): Robustify.
-
-2003-09-04 Mark Mitchell <mark@codesourcery.com>
-
- Revert this patch:
- * class.c (include_empty_classes): Correct logic for ABI version 1.
-
-2003-09-03 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/12053
- * class.c (include_empty_classes): Correct logic for ABI version 1.
-
-2003-09-01 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/12114
- * cp-tree.h (initialize_reference): Change prototype.
- * call.c (initialize_reference): Add cleanup parameter.
- * decl.c (grok_reference_init): Likewise.
- (check_initializer): Likewise.
- (cp_finish_decl): Insert a CLEANUP_STMT if necessary.
- (duplicate_decls): When replacing an anticipated builtin, do not
- honor TREE_NOTHROW.
- * typeck.c (convert_for_initialization): Correct call to
- initialize_reference.
-
-2003-08-29 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11928
- * search.c (add_conversions): Avoid adding two conversion
- operators for the same type.
-
-2003-08-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cp-tree.h (build_function_call_real): Remove unused parameter.
- * typeck.c (build_function_call_real): Likewise. Caller changed.
- * decl.c (binding_table_reverse_maybe_remap): Initialize variable.
-
-2003-08-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
- PR c++/5293
- * call.c (initialize_reference): Improve diagnostic.
-
-2003-08-04 Release Manager
-
- * GCC 3.3.1 Released.
-
-2003-08-04 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11713
- * search.c (setup_class_bindings): Handle conversion operators
- specially.
-
-2003-07-24 Alexandre Oliva <aoliva@redhat.com>
-
- PR c++/10796
- * decl.c (finish_enum): Make sure the underlying integer type has
- the same precision as some full integer type. Reverts part
- 2003-06-27's patch that didn't play any role in fixing the PR.
-
-2003-07-24 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (convert_to_base_statically): Declare.
- * call.c (build_special_member_call): Convert INSTANCE to the base
- type.
- * class.c (convert_to_base_statically): New method.
- * init.c (construct_virtual_base): Use it.
- * method.c (do_build_assign_ref): Fix typo in comment.
-
-2003-07-24 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/11513
- * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): Use current_scope.
-
-2003-07-23 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11645
- * cp-tree.h (accessible_base_p): Declare.
- * call.c (build_over_call): Use it.
- * search.c (accessible_base_p): New function, split out from ...
- (lookup_base): ... here.
-
-2003-07-23 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/11282
- * decl.c: (reshape_init): Always advance *INITP.
-
-2003-07-19 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11546
- * pt.c (lookup_template_class): Treat TYPE_DECLs as TEMPLATE_DECLs
- where appropriate.
-
-2003-07-14 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/7053
- * pt.c (unregister_specialization): Rename to ...
- (reregister_specialization): ... this.
- (tsubst_friend_function): Use it.
- (regenerate_decl_from_template): Likewise.
-
-2003-07-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/11154
- * pt.c (more_specialized_class): Add full_args parameter.
- (most_specialized_class): Adjust calls to more_specialized_class.
- * cp-tree.h (more_specialized_class): Adjust declaration.
-
-2003-07-13 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11503
- * cp-tree.h (DECL_SELF_REFERENCE_P): New macro.
- (SET_DECL_SELF_REFERENCE_P): Likewise.
- * class.c (build_self_reference): Use SET_DECL_SELF_REFERENCE_P.
- * pt.c (tsubst_decl): Copy it.
- * search.c (lookup_base): Use DECL_SELF_REFERENCE_P.
-
-2003-07-11 Danny Smith <dannysmith@users.sourceforge.net>
-
- Backport from mainline.
-
- 2003-05-21 Danny Smith <dannysmith@users.sourceforge.net>
-
- PR c++/9738
- * decl.c (duplicate_decls): Re-invoke make_decl_rtl
- if the old decl had instantiated DECL_RTL.
- (Based on Richard Henderson 2003-05-13 patch to c-decl.c).
-
-2003-07-11 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/8164
- * decl.c (duplicate_decls): Avoid mangling names unnecessarily.
-
-2003-07-10 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10558
- * parse.y (class_template_ok_as_expr): New variable.
- (template_arg_1): New non-terminal.
- (primary): Issue errors about uses of class templates as
- expressions.
-
-2003-07-09 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10032
- * decl.c (cxx_init_decl_processing): With -pedantic, pedwarns are
- still errors.
-
- PR c++/10527
- * error.c (decl_to_string): Do not print default argument
- expressions.
-
-2003-07-10 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/10849
- * decl2.c (handle_class_head_apparent_template): New function.
- * cp-tree.h (handle_class_head_apparent_template): Add declaration.
- * parse.y (class_head_defn): Use it.
- * search.c (type_access_control): Revert my 2003-05-25 change.
-
-2003-07-06 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11236
- * cvt.c (convert_to_void): Treat an overloaded function like
- "((void) 0)" after issuing a diagnostic.
-
- PR c++/11345
- * search.c (lookup_base_r): Remove is_non_public and
- within_current_scope parameters. Remove other dead code.
- (lookup_base): Adjust call to lookup_base_r.
- (adjust_result_of_qualified_name_lookup): Improve comment.
- * semantics.c (finish_call_expr): Use maybe_dummy_object.
-
-2003-07-05 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11431
- * typeck.c (build_static_cast): Check for reference conversions
- earlier.
-
-2003-07-01 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/6949
- * decl2.c (grokfield): Create TEMPLATE_DECLs for methods in local
- classes.
-
-2003-07-01 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (resolve_scoped_fn_name): Return error_mark_node for
- erroneous cases.
-
- PR c++/11137
- * decl2.c (generate_ctor_or_dtor_function): Tolerate a
- non-existant ssdf_decls array.
- (finish_file): Call generator_ctor_or_dtor_function when there are
- static constructors or destructors and no other static
- initializations.
-
- PR c++/11149
- * call.c (resolve_scoped_fn_name): Check that the qualifying scope
- is a class type.
-
-2003-07-01 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9559
- * decl2.c (grokfield): Do not build NOP_EXPRs around the
- error_mark_node.
-
-2003-06-30 Giovanni Bajo <giovannibajo@libero.it>
-
- * mangle.c (write_expression): Exit gracefully when trying to
- mangle a CALL_EXPR.
-
-2003-06-30 Giovanni Bajo <giovannibajo@libero.it>
-
- PR c++/11106
- * error.c (dump_decl): Call dump_decl to dump the DECL_NAME for a
- USING_DECL, instead of print_tree_identifier.
-
-2003-06-27 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10468
- * pt.c (tsubst): Handle qualified TYPEOF_TYPEs correctly.
-
- PR c++/10796
- * decl.c (finish_enum): Implement DR377.
-
- * decl.c (cp_finish_decl): Don't make variables with reference
- type readonly while they are being initialized.
-
-2003-06-26 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11332
- * typeck.c (build_static_cast): Avoid returning expressions with
- reference type.
-
-2003-06-25 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10990
- * search.c (lookup_base_r): Rely on accessible_p, rather than
- trying to emulate that logic here.
-
- PR c++/10931
- * call.c (convert_like): Pass issue_conversion_warnings.
- (convert_like_with_context): Likewise.
- (convert_like_real): Add issue_conversion_warnings parameter.
- (perform_direct_initialization_if_possible): New function.
- * cp-tree.h (perform_direct_initialization_if_possible): Declare it.
- * typeck.c (check_for_casting_away_constness): New function.
- (build_static_cast): Rewrite.
+ (cp_parser_simple_type_specifier): Fix typo.
-2003-06-23 Mark Mitchell <mark@codesourcery.com>
+ PR c++/16637
+ * parser.c (cp_parser_simple_type_specifier): Do not record usage
+ of globally-qualified names.
- PR c++/5754
- * parse.y (structsp): Improve error handling of invalid nested
- template classes.
+2004-07-12 Andrew Pinski <apinski@apple.com>
-2003-06-23 Jakub Jelinek <jakub@redhat.com>
+ PR c++/16475
+ Revert:
+ 2004-07-07 H.J. Lu <hongjiu.lu@intel.com>
+ PR c++/16276
+ * rtti.c (emit_tinfo_decl): Turn off DECL_ONE_ONLY if typeinfo
+ is not public.
- * mangle.c: Include ggc.h, gt-cp-mangle.h.
- (mangle_conv_op_name_for_type): Use htab_create_ggc instead of
- htab_create.
- * config-lang.in (gtfiles): Add cp/mangle.c.
- * Make-lang.in (gt-cp-mangle.h): Depend on s-gtype.
- (cp/mangle.o): Depend on gt-cp-mangle.h.
-2003-06-23 Jakub Jelinek <jakub@redhat.com>
+2004-07-07 H.J. Lu <hongjiu.lu@intel.com>
- * mangle.c (hash_type): val is the TREE_LIST itself, not a pointer
- to it.
+ PR c++/16276
+ * rtti.c (emit_tinfo_decl): Turn off DECL_ONE_ONLY if typeinfo
+ is not public.
-2003-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
+2004-07-01 Release Manager
- PR c++/10784
- * call.c (joust): Warn about choosing conversion sequence only if
- -Wconversion.
-
-2003-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ * GCC 3.4.1 released.
- PR c++/10864
- * call.c (op_error): Tidy.
- * error.c (dump_expr): Properly format 'T()' when T is an
- aggregate type.
+2004-06-28 Nathan Sidwell <nathan@codesourcery.com>
-2003-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ PR C++/16174
+ * call.c (build_temp): Declare.
+ (check_constructor_callable): New.
+ (reference_binding): Only set CHECK_COPY_CONSTRUCTOR if not for
+ CONSTRUCTOR_CALLABLE.
+ (convert_like_real, initialize_reference): Use
+ check_constructor_callable.
+ * cp-tree.h (LOOKUP_CONSTRUCTOR_CALLABLE): New.
+ (LOOKUP_*): Renumber.
- PR c++/10915
- * decl.c (grok_op_properties): Warn possible confusing conversion
- only if -Wconversion.
+2004-06-25 Jan Hubicka <jh@suse.cz>
-2003-06-20 Mark Mitchell <mark@codesourcery.com>
+ PR C++/14865
+ * decl2.c (maybe_emit_vtables): Always import_export_vtable for the
+ reachability analysis.
- PR c++/10845
- * pt.c (try_class_unification): Correct handling of member class
- templates.
+2004-06-22 Jan Hubicka <jh@suse.cz>
-2003-06-19 Mark Mitchell <mark@codesourcery.com>
+ PR C++/14950
+ * pt.c (instantiate_decl): Clean TI_PENDING_TEMPLATE_FLAG before
+ expanding the function.
- PR c++/10939
- * Make-lang.in (decl.o): Depend on input.h.
- * decl.c (input.h): Include it.
- (cp_finish_decl): Revert previous change:
- 2003-06-19 Mark Mitchell <mark@codesourcery.com>
- * decl.c (cp_finish_decl): Remove support for RESULT_DECLs.
- Don't check building_stmt_tree.
- * pt.c (tsubst_decl): Do not try to substitute into non-dependent
- functions.
+2004-06-21 Nathan Sidwell <nathan@codesourcery.com>
- PR c++/9649
- * cp-tree.h (pushdecl_class_level): Change prototype.
- (push_class_level_binding): Likewise.
- * decl.c (add_binding): Reject duplicate static data members.
- (pushdecl_class_level): Return a value indicating whether or not
- the binding was valid.
- (push_class_level_binding): Likewise.
- * semantics.c (finish_member_declaration): Don't keep invalid
- declarations.
-
-2003-06-19 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/11041
- * call.c (initialize_reference): Do not use cp_finish_decl to emit
- temporary variables.
- * cp-tree.h (static_aggregates): Declare.
- (pushdecl_top_level_and_finish): Likewise.
- * decl.c (pushdecl_top_level_1): New function.
- (pushdecl_top_level): Use it.
- (pushdecl_top_level_and_finish): New function.
- (initialize_local_var): Remove redundant code.
- (cp_finish_decl): Remove support for RESULT_DECLs. Don't check
- building_stmt_tree.
- * decl.h (static_aggregates): Remove.
- * decl2.c (get_guard): Use pushdecl_top_level_and_finish.
- * rtti.c (get_tinfo_decl): Use pushdecl_top_level_and_finish.
- (tinfo_base_init): Likewise.
-
-2003-06-19 Matt Austern <austern@apple.com>
-
- PR c++/11228
- * init.c (build_zero_init): Assert that number of array elements
- is an integer constant.
- (build_default_init) Don't use build_zero_init for arrays with
- variable number of elements.
+ PR c++/3518
+ * pt.c (check_cv_quals_for_unify): Ignore bogus CV quals at outer
+ level.
-2003-06-17 Mark Mitchell <mark@codesourcery.com>
-
- * mangle.c (mangle_conv_op_name_for_type): Correct sprintf format
- string again.
-
-2003-06-17 Mark Mitchell <mark@codesourcery.com>
-
- * mangle.c (mangle_conv_op_name_for_type): Correct sprintf format
- string.
-
-2003-06-17 Jason Merrill <jason@redhat.com>
-
- PR c++/10929
- * decl.c (grokfndecl): Don't mark a function inline for
- -finline-functions if it isn't defined.
-
-2003-06-17 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10712
- * class.c (handle_using_decl): Robustify.
-
- PR c++/11105
- * cp-tree.h (DECL_CONV_FN_TYPE): New method.
- * decl.c (lookup_name_real): Backport conversion operator code
- from mainline.
- * mangle.c (struct globals): Remove internal_mangling_p.
- (write_unqualified_name): Use DECL_CONV_FN_TYPE.
- (write_template_parm): Don't write out the level number.
- (conv_type_names): New variable.
- (hash_type): New function.
- (compare_type): Likewise.
- (mangle_conv_op_name_for_type): Don't try to mangle conversion
- operator names.
- * search.c (lookup_conversion_operator): New function.
- (lookup_fnfields_1): Use it.
-
-2003-06-12 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10635
- * typeck.c (build_c_cast): Check that the destination type is
- complete.
-
-2003-06-10 Jason Merrill <jason@redhat.com>
-
- PR c++/10968
- * pt.c (mark_decl_instantiated): Clear DECL_COMDAT.
-
-2003-06-09 Zack Weinberg <zack@codesourcery.com>
-
- PR 8861
- * mangle.c (write_real_cst): New function. Implement
- ABI-compliant mangling of floating-point literals when
- -fabi-version>=2; provide backward compatibility with 3.3 when
- -fabi-version=1 (with warning). Clarify commentary.
- (write_template_arg_literal): Use write_real_cst.
-
-2003-06-08 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/11039
- * decl2.c (handle_class_head): Remove implicitness in typename
- appeared as elaborated type specifier in declaration.
-
-2003-06-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/10940
- * pt.c (check_explicit_specialization): Check for 'static'
- earlier.
-
-2003-05-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/10956
- * pt.c (instantiate_decl): Don't use full template arguments if
- we are dealing with specializations.
-
-2003-05-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
- * decl.c (ENABLE_CHECKING_SCOPES): New macro.
- (binding_depth): Unconditionally define.
- (is_class_level): Likewise.
- (indent): Likewise. Take an indenting parameter.
- (push_binding_level): Remove conditional definittion.
- (pop_binding_level): Likewise.
- (suspend_binding_level): Likewise.
- (resume_binding_level): Likewise.
- (pushlevel): Likewise.
- (pushlevel_class): Likewise.
- (poplevel_class): Likewise.
- (pop_everything): Likewise.
-
-2003-05-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
- * decl.c (global_scope_p): New macro.
- (pop_binding_level): Use it.
- (suspend_binding_level): Likewise.
- (global_bindings_p): Likewise.
- (print_other_binding_stack): Likewise.
- (print_binding_stack): Likewise.
- (maybe_push_to_top_level): Likewise.
- (pushdecl_namespace_level): Likewise.
- (start_decl): Likewise.
- (cp_finish_decl): Likewise.
- (start_function): Likewise.
- (cxx_init_decl_processing): Don't refer to global_binding_level.
- (global_binding_level): Remove.
-
-2003-05-25 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/10849
- * search.c (type_access_control): Don't check access when
- processing_specialization.
-
-2003-05-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/10682
- * pt.c (instantiate_class_template): Use DECL_ARTIFICIAL to
- check for implicitly created typedef to an enum.
-
-2003-05-20 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
- * decl.c (free_binding_entry): Fix thinko.
-
-2003-05-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
- * cp-tree.h (struct binding_entry_s): New datatype.
- (binding_table): Declare.
- (binding_entry): Likewise.
- (bt_foreach_proc): Likewise.
- (binding_table_foreach): Likewise.
- (binding_table_find): Likewise.
- (cxx_remember_type_decls): Likewise.
- (CLASSTYPE_TAGS): Remove.
- (CLASSTYPE_NESTED_UDTS): New macro.
- (struct lang_type_class): Remove tags field. Add nested_types.
- * decl.c (ENTRY_INDEX): New macro.
- (free_binding_entry): New free list.
- (binding_entry_make): New function.
- (binding_entry_free): Likewise.
- (struct binding_table_s): New datatype.
- (SCOPE_DEFAULT_HT_SIZE): New macro.
- (CLASS_SCOPE_HT_SIZE): Likewise.
- (NAMESPACE_ORDINARY_HT_SIZE): Likewise.
- (NAMESPACE_STD_HT_SIZE): Likewise.
- (GLOBAL_SCOPE_HT_SIZE): Likewise.
- (binding_table_construct): New function.
- (binding_table_free): Likewise.
- (binding_table_new): Likewise.
- (binding_table_expand): Likewise.
- (binding_table_insert): Likewise.
- (binding_table_find): Likewise.
- (binding_table_find_anon_type): Likewise.
- (binding_table_reverse_maybe_remap): Likewise.
- (binding_table_remove_anonymous_types): Likewise.
- (binding_table_foreach): Likewise.
- (struct cp_binding_level): Remove tags field. Add type_decls.
- (pop_binding_level): Free binding_entries if possible.
- (kept_level_p): Tidy.
- (poplevel): Remove unused variable tags.
- (bt_print_entry): New function.
- (print_binding_level): Use it.
- (push_namespace): Construct binding table.
- (maybe_process_template_type_declaration): Tidy.
- (pushtag): Likewise.
- (clear_anon_tags): Likewise.
- (cxx_remember_type_decls): New function.
- (lookup_tag): Tidy.
- (lookup_tag_reverse): Likewise.
- (cxx_init_decl_processing): Construct binding_table for the global
- scope.
- (store_parm_decls): Remove pointless code.
- (gettags): Remove.
- (storetags): Likewise.
- * class.c (unreverse_member_declarations): Don't touch
- CLASSTYPE_TAGS.
- (pushclass): Remember CLASSTYPE_NESTED_UTDS.
- * pt.c (instantiate_class_template): Remove reference to
- CLASSTYPE_TAGS. Remeber CLASSTYPE_NESTED_UTDS.
- (bt_instantiate_type_proc): New function.
- (do_type_instantiation): Use it.
- * search.c (lookup_field_r): Use binding_table_find.
- * semantics.c (begin_class_definition): Remove reference to
- CLASSTYPE_TAGS. Nullify CLASSTYPE_NESTED_UTDS.
-
-2003-05-15 Jason Merrill <jason@redhat.com>
+ PR c++/14007
+ * pt.c (check_cv_quals_for_unify): Correct logic for disallowed
+ cv-qualifier unification.
+ * tree.c (cp_build_qualified_type_real): Renable DR295 logic.
- PR c++/5388
- * call.c (conditional_conversion): Don't consider implicit
- conversions if T2 is a base of T1.
- * cp-tree.h (DERIVED_FROM_P, UNIQUELY_DERIVED_FROM_P): Make boolean.
- (ACCESSIBLY_UNIQUELY_DERIVED_P, PUBLICLY_UNIQUELY_DERIVED_P): Likewise.
+2004-06-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- PR c++/10661
- * pt.c (instantiate_class_template): Also instantiate our
- enclosing class.
+ PR c++/15967
+ * search.c (build_new_1): Robustify.
-2003-05-13 Release Manager
+2004-06-14 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * GCC 3.3 Released.
+ PR c++/15947
+ * parser.c (cp_parser_template_name): Ctors/dtors never need a
+ template keyword to disambiguate.
-2003-05-02 Richard Henderson <rth@redhat.com>
+2004-06-14 Mark Mitchell <mark@codesourcery.com>
- PR c++/10570
- * cfns.gperf: Comment out POSIX thread cancellation points,
- plus abort and raise.
- * cfns.h: Regenerate.
+ PR c++/15096
+ * decl.c (grokdeclarator): Ignore pointer-to-members when
+ computing template depth.
-2003-05-01 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14930
+ * name-lookup.c (pushtag): Do not try to put class declarations in
+ explicit specialization scopes.
- * decl2.c (comdat_linkage): Don't externalize explicit
- instantiations.
+i2004-06-11 Mark Mitchell <mark@codesourcery.com>
-2003-04-29 Mark Mitchell <mark@codesourcery.com>
+ PR c++/15862
+ * name-lookup.c (unqualified_namespace_lookup): Do not ignore type
+ bindings for undeclared built-ins.
- PR c++/10551
- * pt.c (mark_decl_instantiated): Defer all explicit instantiations
- that have not yet been written out.
+2004-06-10 Jason Merrill <jason@redhat.com>
- PR c++/10549
- * class.c (layout_class_type): Mark overlong bitfields as having
- the maximum size permitted by their type, after layout.
+ PR c++/15875
+ Revert:
+ 2004-06-01 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+ * init.c (build_offset_ref): Build SCOPE_REF with non-null
+ TREE_TYPE for non-dependent names.
+ * pt.c (type_dependent_expression_p): Handle SCOPE_REF with
+ unknown_type_node as its TREE_TYPE.
+ * cxx-pretty_print.c (pp_cxx_unqualified_id): Handle BASELINK.
+ * error.c (dump_decl) <SCOPE_REF case>: Use pp_expression.
+ (dump_expr) <SCOPE_REF case>: Likewise.
-2003-04-29 Mark Mitchell <mark@codesourcery.com>
+2004-06-10 Mark Mitchell <mark@codesourcery.com>
- PR c++/10527
- * error.c (dump_expr): Correctly handling of NEW_EXPR.4
+ PR c++/15227
+ * parser.c (cp_parser_direct_declarator): Robustify.
-2003-04-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+ PR c++/15877
+ * pt.c (tsubst_copy): Use decl_constant_value on enumeration
+ constants in non-dependent contexts.
- * lang-options.h: Fix typo.
+ PR c++/14211
+ PR c++/15076
+ * typeck.c (build_static_cast): Wrap casts in NON_LVALUE_EXPR when
+ necessary.
-2003-04-29 Mark Mitchell <mark@codesourcery.com>
+2004-06-09 Mark Mitchell <mark@codesourcery.com>
- PR c++/10515
- * cp-tree.h (lookup_field_1): Declare it.
- * search.c (lookup_field_1): Make it public.
- * decl.c (reshape_init): Handle designated initializers.
+ Revert:
+ PR c++/15815
+ 2004-06-07 Mark Mitchell <mark@codesourcery.com>
+ * lex.c (handle_pragma_interface): Deprecate.
+ (handle_pragma_implementation): Likewise.
-2003-04-29 Mark Mitchell <mark@codesourcery.com>
+2004-06-07 Dan Kegel <dank@kegel.com>
- * decl.c (maybe_commonize_var): Further tweak support for systems
- without weak symbols.
+ PR c++/14808
+ * method.c (make_alias_for_thunk, use_thunk): Use TARGET_IS_PE_COFF
+ instead of __CYWGIN__ and __MINGW32__.
-2003-04-27 Mark Mitchell <mark@codesourcery.com>
+2004-06-07 Mark Mitchell <mark@codesourcery.com>
- * decl.c (maybe_commonize_var): Fix thinko in last patch.
+ PR c++/15815
+ * lex.c (handle_pragma_interface): Deprecate.
+ (handle_pragma_implementation): Likewise.
- PR c++/10506
- * method.c (use_thunk): Decrement immediate_size_expand.
-
- PR c++/10503
- * cp-tree.h (DECL_VAR_MARKED_P): New macro.
- (DECL_MAYBE_TEMPLATE): Remove.
- * class.c (fixed_type_or_null): Avoid infinite recursion.
-
-2003-04-27 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (maybe_commonize_var): Make the code match the comments.
- * pt.c (instantiate_decl): Move call to import_export_decl.
-
-2003-04-25 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (finish_file): Don't call import_export_decl for
- functions that are not defined.
- (handle_class_head): Robustify.
- * pt.c (instantiate_decl): Do not call cp_finish_decl for
- variables that are not defined.
-
-2003-04-23 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10471
- * call.c (build_cxx_call): Robustify.
-
-2003-04-23 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10451
- * decl.c (grokdeclarator): Correct logic for "mutable" errors.
-
-2003-04-22 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10446
- * search.c (lookup_fnfields_1): Handle empty slots in the method
- vector.
-
-2003-04-22 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10428
- * decl.c (check_elaborated_type_specifier): New function, split
- out from ...
- (xref_tag): ... here. Use the new function in more places.
-
-2003-04-21 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (build_over_call): Use build_cxx_call.
- (build_cxx_call): New method, split out of build_over_call.
- * cp-tree.h (language_function): Add can_throw.
- (build_cxx_call): Declare it.
- * decl.c (finish_function): If a function does not contain any
- calls to functions that can throw an exception, indicate that
- fact.
- * decl2.c (mark_used): Do not defer the instantiation of
- functions, if the current function does not throw.
- * optimize.c (maybe_clone_body): Copy TREE_NOTHROW to the clones.
- * pt.c (instantiate_decl): Make sure import_export_decl is called
- before emitting things.
- * rtti.c (throw_bad_cast): Use build_cxx_call.
- (build_dynamic_cast_1): Likewise.
- * typeck.c (build_function_call): Likewise.
-
-2003-04-21 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/9881
- * typeck.c (build_unary_op): Fold all COMPONENT_REF addr
- expressions. Reverts my 2002-08-08 patch.
-
-2003-04-20 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/10405
- * search.c (lookup_field_1): Final scan goes backwards for
- types, forwards for non-types.
-
-2003-04-15 Jason Merrill <jason@redhat.com>
-
- * decl2.c (mark_used): Don't instantiate anything if
- skip_evaluation.
-
-2003-04-15 Mark Mitchell <mark@codesourcery.com>
-
- * init.c (build_new_1): Use nullexp instead of null_node to avoid
- unwanted macro expansion.
-
-2003-04-14 Ziemowit Laski <zlaski@apple.com>
-
- * tree.c (build_cplus_array_type_1): Do not call
- uses_template_parms() on a NULL index_type.
-
-2003-04-14 Andreas Schwab <schwab@suse.de>
-
- * init.c (build_new_1): Test use_cookie instead of cookie_size to
- avoid code-gen bug on ia64.
-
-2003-04-13 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10300
- * init.c (build_new_1): Correct logic for checking whether the
- return value from the allocation function was zero.
-
-2003-03-31 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/10278
- * spew.c (yyerror): Avoid crashing at all costs.
-
-2003-03-31 Jason Merrill <jason@redhat.com>
-
- PR java/10145
- * class.c (check_field_decl): Don't set DECL_ALIGN.
-
-2003-03-30 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/7647
- * search.c (lookup_field_1): Add want_type parameter.
- (lookup_field_r): Adjust call to lookup_field_1.
-
-2003-03-28 Jason Merrill <jason@redhat.com>
-
- PR c++/10245
- * cvt.c (force_rvalue): New fn.
- * call.c (build_conditional_expr): Use it.
- * cp-tree.h: Declare it.
-
-2003-03-28 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/10047
- * decl2.c (finish_file): Don't warn about explicitly instantiated
- inline decls.
-
-2003-03-27 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/10158
- * spew.c (snarf_method):Set DECL_INITIALIZED_IN_CLASS for
- members.
- * pt.c (instantiate_decl): Only reduce the template args for
- friends that are not defined in class.
-
-2003-03-24 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/9898, PR c++/383, DR 322
- * pt.c (maybe_adjust_types_for_deduction) [DEDUCE_CONV]: Look
- through reference types on both PARM and ARG.
-
- PR c++/10199
- * call.c (build_method_call): Deal with LOOKUP_EXPR.
- * semantics.c (finish_object_call_expr): Use build_method_call
- when in a template decl.
-
-2003-03-23 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/7086
- * semantics.c (genrtl_named_return_value): Adjust calls to
- put_var_into_stack.
- * typeck.c (cxx_mark_addressable): Likewise.
-
-2003-03-20 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/6412
- * cp/decl2.c (arg_assoc_class): Correct check for namespace-scope
- friends.
- * cp/pt.c (instantiate_class_template): Fix formatting.
-
-2003-03-19 Jason Merrill <jason@redhat.com>
-
- PR c++/8316, c++/9315, c++/10136
- * call.c (joust): Improve wording.
-
-2003-03-18 Roger Sayle <roger@eyesopen.com>
-
- PR c++/10031
- * decl.c (duplicate_decls): Use the new type when prototyping
- anticipated decls, even when the types match. This defines the
- exception list for the built-in function.
-
-2003-03-17 Jason Merrill <jason@redhat.com>
-
- PR c++/10091
- * typeck.c (build_class_member_access_expr): Compare
- TYPE_MAIN_VARIANTs.
-
- * decl.c (finish_function): Don't skip a block.
-
- PR c++/9993
- * decl.c (finish_function): Only allow the NRVO to use variables
- declared at function scope.
-
-2003-03-17 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/9629
- * cp-tree.h (struct language_function): Add in_base_initializer.
- (in_base_initializer): define it.
- (expand_member_init): Remove INIT param.
- * init.c (expand_member_init): Remove INIT param, return the member.
- (emit_mem_initializers): Set in_base_initializer.
- * class.c (build_base_path): Check in_base_initializer.
- * parse.y (begin_member_init): New reduction.
- (member_init): Use it.
- * pt.c (tsubst_initializer_list): Set in_base_initializer.
-
-2003-03-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/6440
- * pt.c (maybe_process_partial_specialization): Handle
- member class template when enclosing class template is
- explicit specialized.
- (most_general_template): Stop looking when DECL is already
- specialized.
-
-2003-03-13 Jason Merrill <jason@redhat.com>
-
- PR c++/9420
- * search.c (lookup_conversions): Call complete_type here.
- * call.c (implicit_conversion): Not here.
-
-2003-03-13 Jason Merrill <jason@redhat.com>
-
- PR c++/9336
- * decl2.c (lookup_arg_dependent): Handle error_mark_node.
-
-2003-03-13 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (do_nonmember_using_decl): Correct handling of
- simultaneous type/non-type bindings.
-
-2003-03-13 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (initialize_reference): Remove bogus assertion.
- * decl.c (build_ptrmemfunc_type): Revert change of 2003-03-09.
-
-2003-03-12 Andrew Lewycky <andrew@mxc.ca>
-
- PR c++/7050
- * expr.c (cxx_expand_expr): Return const0_rtx for throw
- expressions.
-
-2003-03-11 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9474
- * decl2.c (do_nonmember_using_decl): Do not call duplicate decls
- to merge old and new declarations.
-
-2003-03-11 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9924
- * decl2.c (do_nonmember_using_decl): Ignore anticipated builtins.
-
-2003-03-11 Jason Merrill <jason@redhat.com>
-
- PR c++/9820
- * search.c (lookup_member): Fix handling of functions in a class
- being defined.
-
-2003-03-11 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/8700
- * call.c (print_z_candidates): Avoid printing duplicates.
-
-2003-03-11 Jason Merrill <jason@redhat.com>
-
- PR c++/8660
- * decl2.c (check_classfn): A member template only matches a
- member template.
-
-2003-03-10 Devang Patel <dpatel@apple.com>
-
- PR c++/9394
- * g++spec.c (lang_specific_driver): Use DEFAULT_WORD_SWITCH_TAKES_ARG.
-
-2003-03-10 Jason Merrill <jason@redhat.com>
-
- PR c++/9798
- * decl.c (push_using_directive): Push before recursing.
-
- PR c++/9868
- * call.c (resolve_scoped_fn_name): Handle the case of a function
- pointer member.
- * init.c (build_offset_ref): Handle getting a FIELD_DECL for NAME.
-
- * decl2.c (build_offset_ref_call_from_tree): Only mess with 'this'
- argument in the pointer-to-member case.
-
-2003-03-09 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9373
- * cp-lang.c (cxx_get_alias_set): Use alias set zero for
- pointers to member functions.
-
- PR c++/8534
- * decl.c (build_ptrmemfunc_type): Do not allow default arugments
- in pointer-to-member-function types.
-
-2003-03-09 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9912
- * cp-tree.h (is_ancestor): New function.
- * decl2.c (is_namespace_ancestor): Rename to ...
- (is_ancestor): ... this.
- (namespace_ancestor): Use it.
- (set_decl_namespace): Likewise.
- (handle_class_head): Check for invalid class definitions.
-
-2003-03-10 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
- Compile-time improvement: 2/n.
- * cp-tree.h (struct cxx_binding): New datatype;
- (struct lang_identifier): Use it.
- (LOCAL_BINDING_P): Adjust definition.
- (INHERITED_VALUE_BINDING_P): Likewise.
- (BINDING_SCOPE): Likewise.
- (BINDING_HAS_LEVEL_P): Likewise.
- (BINDING_VALUE): Likewise.
- (BINDING_TYPE): Likewise.
- (IDENTIFIER_VALUE): Likewise.
- (struct tree_binding): Remove.
- (TS_CP_BINDING): Likewise.
- ((union lang_tree_node): Remove field "binding".
- (cxx_binding_clear): New macro.
- (binding_for_name): Adjust return type.
- (qualified_lookup_using_namespace): Adjust prototype.
- (lookup_using_namespace): Adjust prototype.
- (cxx_scope_find_binding_for_name): Declare.
- * cp-tree.def: Remove CPLUS_BINDING definition.
- * parse.y (parse_scoped_id): Don't type-abuse of 'id'. Allocate
- temporary cxx_binding on stack. Simplify.
- * decl.c (push_binding): Adjust local variable type.
- (add_binding): Likewise.
- (push_class_binding): Likewise.
- (pop_binding): Likewise.
- (poplevel): Likewise.
- (poplevel_class): Likewise.
- (free_bindings): Adjust type.
- (find_binding): Adjust return type, add a third parameter. Remove
- non-useful assertion now that we use static typing.
- (cxx_scope_find_binding_for_name): New function.
- (binding_for_name): Use it. Adjust local variable type. Simplify.
- (namespace_binding): Simplify.
- (set_namespace_binding): Likewise.
- (set_identifier_type_value_with_scope): Adjust local variable type.
- (lookup_tag): Don't type-abuse of local variable 'old'.
- (lookup_namespace_name): Likewise. Allocate binding on stack.
- (select_decl): Adjust prototype.
- (unqualified_namespace_lookup): Allocate binding on stack.
- Don't type-abuse of local variable 'val'.
- (lookup_name_real): Likewise.
- (maybe_inject_for_scope_var): Adjust local variable type.
- (cp_tree_node_structure): Remove CPLUS_BINDING case label.
- (namespace_binding): Adjust logic, simplify.
- (BINDING_LEVEL): Adjust definition.
- (push_class_level_binding): Adjust local variable type.
- (struct cxx_saved_binding): Adjust field 'binding' type.
- * decl2.c (ambiguous_decl): Adjust prototype.
- (lookup_using_namespace): Adjust local variable type.
- (qualified_lookup_using_namespace): Catch type error and correct
- ensueing logic error.
- (do_nonmember_using_decl): Adjust local variable type. Allocate
- temporary cxx_binding on stack.
- (do_toplevel_using_decl): Adjust local variable type.
- * ptree.c (cxx_print_cxx_binding): New function.
- (cxx_print_identifier): Use it.
- (cxx_print_xnode): Delete CPLUS_BINDING case label.
-
-2003-03-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/9970
- * decl.c (duplicate_decls): Only copy DECL_THUNKS for virtual
- functions.
-
-2003-03-07 Matt Austern <austern@apple.com>
-
- * cp-tree.h (struct lang_type_class): add field for key method
- (cp_global_trees): rename dynamic_classes to keyed_classes
- (key_method): add definition
- * class.c (finish_struct_1): compute class's key method, and add
- the class to keyed_classes list if there is no key method.
- * decl.c (finish_function): add class to keyed_classes list if we
- see a definition of the class's key method.
- * pt.c (instantiate_class_template): add template specialization
- of a dynamic class to keyed_classes list.
- * decl2.c (key_method): remove
- (finish_file): iterate only through keyed_classes list when
- deciding whether to emit vtables, remove class from its list after
- we do the emission.
-
-2003-03-08 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9809
- * call.c (add_function_candidate): Skip builtin fuctions that have
- not yet been declared.
-
-2003-03-07 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (reference_binding): Remove REF_IS_VAR parameter.
- (implicit_conversion): Adjust call to reference_binding.
- (make_temporary_var_for_ref_to_type): Add TYPE parameter.
- (initialize_reference): Adjust handling for references bound to
- rvalues.
- * cp-tree.h (make_temporary_var_for_ref_to_temp): Change
- prototype.
- (real_non_cast_lvalue_p): New method.
- * cvt.c (build_up_reference): Adjust use of
- make_temporary_var_for_ref_to_temp.
- * tree.c (real_non_cast_lvalue_p): New method.
-
-2003-03-06 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (merge_conversion_sequences): New function.
- (build_conv): Set ICS_USER_FLAG for USER_CONVs.
- (convert_class_to_reference): Correct handling of second
- standard conversion sequence in a user-defined conversion
- sequence.
- (build_user_type_conversion_1): Use merge_conversion_sequences.
- * cp-tree.def: Add comments for CONV nodes.
-
-2003-03-06 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9965
- * call.c (reference_binding): Add ref_is_var parameter.
- (implicit_conversion): Adjust call to reference_binding.
- (initialize_reference): Likewise.
-
- PR c++/9400
- * decl.c (pushdecl): Don't check for shadowing of DECL_ARTIFICIAL
- PARM_DECLs.
-
-2003-03-06 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9791
- * class.c (get_basefndecls): Use lookup_fnfields_1.
-
-2003-03-02 Matt Austern <austern@apple.com>
-
- * decl.c (cp_binding_level): Add static_decls varray member.
- (add_decl_to_level): Add static/inline namespace scope
- declarations to static_decls array.
- (wrapup_global_for_namespace): Pass static_decls only, instead of
- all decls, to wrapup_global_declarations/check_global_declarations.
- (push_namespace): Initialize static_decls for ordinary namespaces.
- (cxx_init_decl_processing): Initialize static_decls for global
- namespace.
-
-2003-03-05 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (end_of_class): Correct thinko.
-
-2003-03-04 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
- * cp-tree.h (cxx_saved_binding): Declare.
- (struct saved_scope): Adjust type of field 'old_binding'.
- * decl.c (cxx_saved_binding_make): New macro.
- (struct cxx_saved_binding): Define.
- (store_bindings): Adjust prototype. Use cxx_saved_binding to save
- C++ bindings.
- (maybe_push_to_top_level): Adjust local variable type.
- (pop_from_top_level): Likewise.
-
-2003-03-03 Jason Merrill <jason@redhat.com>
-
- * decl.c (finish_enum): Do set the type in a template. Simplify.
- * pt.c (tsubst_enum, tsubst_copy): Revert last patch.
-
-2003-03-03 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9878
- * call.c (convert_class_to_reference): Correct conversion
- sequences.
- (reference_binding): Add ref_bound_directly_to_rvalue_p parameter.
- (implicit_conversion): Adjust call to reference_binding.
- (add_candidate): Change type of candidates parameter.
- (add_function_candidate): Likewise.
- (add_conv_candidate): Likewise.
- (build_builtin_candidate): Likewise.
- (add_builtin_candidate): Likewise.
- (add_builtin_candidates): Likewise.
- (add_template_candidate_real): Likewise.
- (add_template_candidate): Likewise.
- (add_template_conv_candidate): Likewise.
- (build_user_type_conversion_1): Adjust accordingly.
- (build_object_call): Likewise.
- (build_conditional_expr): Likewise.
- (add_candidates): Likewise.
- (build_new_op): Likewise.
- (convert_like_real): Use USER_CONV_CAND. Use build_nop.
- (build_new_method_call): Adjust calls to add_function_candidate.
- (make_temporary_var_for_ref_to_temp): New function.
- (initialize_reference): Add decl parameter.
- * class.c (build_rtti_vtbl_entries): Use build_address and
- build_nop.
- * cp-tree.h (initialize_reference): Change prototype.
- (make_temporary_var_for_ref_to_temp): New function.
- (build_type_conversion): Change prototype.
- (build_address): New function.
- (build_nop): Likewise.
- * cvt.c (cp_convert_to_pointer): Adjust call to
- build_type_conversion. Avoid indicating redundant NOP_EXPRs.
- Use build_nop.
- (convert_to_pointer_force): Use build_nop.
- (build_up_reference): Use make_temporary_var_for_ref_to_temp.
- (convert_to_reference): Adjust call to build_type_conversion.
- (ocp_convert): Likewise.
- (build_type_conversion): Remove for_sure parameter.
- * decl.c (grok_reference_init): Use initialize_reference.
- * typeck.c (build_address): New function.
- (build_nop): Likewise.
- (build_unary_op): Use them.
- (build_ptrmemfunc): Tidy slightly.
- (convert_for_initialization): Adjust call to
- initialize_reference.
- * typeck2.c (store_init_value): Remove #if 0'd code.
-
-2003-03-02 Ashif Harji <asharji@uwaterloo.ca>
-
- * lang-specs.h (default_compilers): Add -no-integrated-cpp flag to
- invoke an external cpp during compilation.
-
-2003-02-28 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9892
- * pt.c (instantiate_decl): Clear DECL_RTL for a VAR_DECL when
- instantiating it.
-
-2003-02-28 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9879
- * cp-tree.h (build_zero_init): Add parameter.
- * decl.c (cp_finish_decl): Adjust call.
- * init.c (build_zero_init): Add nelts parameter. Adjust recursive
- calls.
- (build_default_init): Add nelts parameter. Adjust calls to
- build_zero_init.
- (build_new_1): Adjust call to build_default_init.
- * typeck2.c (process_init_constructor): Adjust call to build_zero_init.
-
-2003-02-27 Devang Patel <dpatel@apple.com>
-
- * decl.c (finish_enum): Merge two 'for' loops. Copy value node if required.
- Postpone enum setting for template decls.
- (build_enumerator): Delay copying value node until finish_enum (). Remove
- #if 0'ed code.
- * pt.c (tsubst_enum): Set TREE_TYPE and copy value node.
- (tsubst_copy): Add check for enum type.
-
-
-2003-02-25 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9829
- * decl.c (grokdeclarator): Handle SCOPE_REFs whose second argument
- is a NAMESPACE_DECL.
-
-2003-02-24 Gabriel Dos Reis <gdr@integrable-solutions.net>
-
- * decl.c (add_binding): Time TV_NAME_LOOKUP.
- (push_class_binding): Likewise.
- (set_namespace_binding): Likewise.
-
-2003-02-24 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/9602
- * typeck2.c (abstract_virtuals_error): Don't check when we
- are processing a template.
-
-2003-02-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/7982
- * decl.c (warn_about_implicit_typename_lookup): Handle TYPEOF_TYPE.
-
-2003-02-21 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9749
- * decl.c (grokdeclarator): Do not allow parameters with variably
- modified types.
-
- PR c++/9727
- * decl2.c (push_scope): Don't pushclass for non-class types.
- (pop_scope): Don't popclass either.
-
- PR c++/8906
- * decl.c (lookup_name_real): Use IMPLICIT_TYPENAME_P.
- * decl2.c (handle_class_head): Check it.
-
- PR c++/8724
- * call.c (build_method_call): Make sure that the type destroyed in
- an explicit destructor call is complete.
-
-2003-02-20 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9729
- * mangle.c (mangle_conv_op_name_for_type): Issue an error message
- when the G++ 3.2 ABI prevents correct compilation.
-
-2003-02-18 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/9704
- * class.c (layout_class_type): In the 3.2 ABI, take into account
- trailing bit fields when computing CLASSTYPE_SIZE_UNIT.
-
-2003-02-18 Matt Austern <austern@apple.com>
-
- * cp/cp-lang.c: Change lang hooks so that final_write_globals does
- nothing for C++.
- * cp/decl.c (wrapup_globals_for_namespace): Remove special
- handling of global namespace.
+ PR c++/15766
+ * parser.c (cp_parser_iteration_statement): Fix typo in error
+ message.
-2003-02-18 Jason Merrill <jason@redhat.com>
+ PR c++/14777
+ * pt.c (tsubst_default_argument): Do not defer access checks
+ while substituting into the default argument.
- PR c++/9623
- * decl.c (reshape_init): Don't mess with initializer labels.
+ PR c++/15554
+ * pt.c (tsubst_copy): Do not try to substitute for an enumeration
+ constant in a non-dependent context.
+
+ PR c++/15057
+ * except.c (build_throw): Ensure that temp_expr has been
+ initialized.
-2003-02-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+2004-06-06 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- PR c++/9459
- * error.c (dump_type_prefix): Handle TYPEOF_TYPE.
- (dump_type_suffix): Likewise.
+ PR c++/15503
+ * parser.c (cp_parser_mem_initializer_id): Gracefully reject
+ 'typename', and accept 'template'.
-2003-02-17 Michael Elizabeth Chastain <mec@shout.net>
+2004-06-01 Jason Merrill <jason@redhat.com>
- PR debug/9717
- * class.c (build_base_field): Mark fields for base classes with
- DECL_IGNORED_P.
+ PR c++/15142
+ * call.c (call_builtin_trap): Remove type parm.
+ (convert_arg_to_ellipsis): Change a non-POD argument to integer type.
+ (build_x_va_arg): Dereference a null pointer for a non-POD argument.
-2003-02-13 Andrew Pinski <pinskia@physics.uc.edu>
+2004-06-01 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * decl.c: (define_label): Fix warning for return 0 instead of NULL.
+ PR c++/13092
+ * init.c (build_offset_ref): Build SCOPE_REF with non-null
+ TREE_TYPE for non-dependent names.
+ * pt.c (type_dependent_expression_p): Handle SCOPE_REF with
+ unknown_type_node as its TREE_TYPE.
+ * cxx-pretty_print.c (pp_cxx_unqualified_id): Handle BASELINK.
+ * error.c (dump_decl) <SCOPE_REF case>: Use pp_expression.
+ (dump_expr) <SCOPE_REF case>: Likewise.
-2003-02-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
+2004-06-01 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * Make-lang.in (cp/decl2.o): Add dependency on timevar.h
- * decl2.c: Include "timevar.h".
- (namespace_ancestor): Time name lookup.
- (add_using_namespace): Likewise.
- (lookup_using_namespace): Likewise.
- (qualified_lookup_using_namespace): Likewise.
- (decl_namespace): Likewise.
- (lookup_arg_dependent): Likewise.
- * lex.c (do_identifier): Likewise.
- (do_scoped_id): Likewise.
- * pt.c (lookup_template_class): Likewise.
+ PR c++/14932
+ * parser.c (cp_parser_postfix_expression): Allow subscript
+ operator in offsetof.
-2003-02-12 Gabriel Dos Reis <gdr@integrable-solutions.net>
+2004-05-31 Mark Mitchell <mark@codesourcery.com>
- * decl.c (define_label): Don't forget to pop TV_NAME_LOOKUP.
+ PR c++/15701
+ * friend.c (add_friend): Do not try to perform access checks for
+ functions from dependent classes.
-2003-02-11 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ PR c++/15742
+ * call.c (build_over_call): Set
+ current_function_returns_abnormally even in template functions.
- * decl.c: Include "timevar.h".
- (poplevel): Time name lookup.
- (find_binding): Likewise.
- (push_namespace): Likewise.
- (pop_nested_namespace): Likewise.
- (store_bindings): Likewise.
- (maybe_push_to_top_level): Likewise.
- (pop_from_top_level): Likewise.
- (push_local_name): Likewise.
- (pushtag): Likewise.
- (pushdecl): Likewise.
- (pushdecl_with_scope): Likewise.
- (pushdecl_namespace_level): Likewise.
- (pushdecl_top_level): Likewise.
- (pushdecl_class_level): Likewise.
- (push_class_level_binding): Likewise.
- (push_using_decl): Likewise.
- (push_using_directive): Likewise.
- (push_overloaded_decl): Likewise.
- (lookup_label): Likewise.
- (define_label): Likewise.
- (lookup_tag): Likewise.
- (lookup_tag_reverse): Likewise.
- (lookup_namespace_name): Likewise.
- (select_decl): Likewise.
- (unqualified_namespace_lookup): Likewise.
- (lookup_name_real): Likewise.
- (lookup_name_current_level): Likewise.
- (lookup_type_current_level): Likewise.
- (maybe_inject_for_scope_var): Likewise.
- (xref_tag): Likewise.
+ PR c++/15696
+ * cp-tree.h (invalid_nonstatic_memfn_p): New function.
+ * cvt.c (convert_to_void): Use it.
+ * typeck.c (invalid_nonstatic_memfn_p): New function.
+ (decay_conversion): Use it.
- * Make-lang.in (cp/decl.o): Add dependency on timevar.h
-
-2003-02-03 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/7129
- * operators.def: Add <?= and >?=.
+ PR c++/15625
+ * pt.c (tsubst_decl): Set DECL_FRIEND_CONTEXT for instantiated
+ templates.
-2003-01-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+ PR c++/15629
+ * name-lookup.c (arg_assoc_class): Do not find template
+ specializations.
- PR c++/8849
- * error.c (dump_expr): Handle BASELINK.
- * pt.c (resolve_overloaded_unification): Handle FUNCTION_DECL.
+ PR c++/15209
+ * tree.c (lvalue_p_1): Only consider the right-hand side of "."
+ expressions when determining whether or not an express is packed.
-2003-01-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+2004-05-28 Mark Mitchell <mark@codesourcery.com>
- PR c++/9453
- * friend.c (is_friend): Always accept when SUPPLICANT is still
- a TEMPLATE_DECL.
- * pt.c (push_access_scope_real): Call push_to_top_level for
- function in namespace scope.
- (push_access_scope): Remove ARGS argument, all caller adjusted.
- (pop_access_scope): Call pop_from_top_level for function in
- namespace scope.
- (regenerate_decl_from_template): Use push_access_scope_real.
+ PR c++/15083
+ * decl2.c (delete_sanity): Set TREE_SIDE_EFFECTS on a DELETE_EXPR,
+ even in a templat.e
+ * init.c (build_new): Likewise.
-2003-01-29 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/15640
+ * name-lookup.c (arg_assoc): Robustify.
- PR c++/9437
- * pt.c (unify): Don't unify '*T' with 'U C::*'.
+ PR c++/15471
+ * typeck.c (unary_complex_lvalue): Use context_for_name_lookup
+ when determining the scope to use for a pointer to member.
+ (lookup_anon_field): Give it external linkage.
+ * cp-tree.h (lookup_anon_field): Declare it.
+ * expr.c (cplus_expand_constant): Use it.
-2003-01-27 Jeffrey D. Oldham <oldham@codesourcery.com>
+ PR c++/14668
+ * parser.c (cp_parser_simple_type_specifier): Call
+ maybe_note_name_used_in_class.
- PR c++/47
- * cp-tree.h (lookup_nested_field): Add declaration.
- * decl.c (lookup_name_real): Call lookup_nested_field.
- * search.c (lookup_nested_field): Add function.
+2004-05-23 Mark Mitchell <mark@codesourcery.com>
-2003-01-26 Christian Cornelssen <ccorn@cs.tu-berlin.de>
+ PR c++/15044
+ * parser.c (cp_parser_class_head): Robustify.
- * Make-lang.in (c++.install-common, c++.install-man)
- (c++.uninstall): Prepend $(DESTDIR) to destination paths in
- all (un)installation commands.
- (c++.install-common): Rewrite $(LN) commands to support
- DESTDIR with "ln" as well as with "ln -s".
+ PR c++/15317
+ * parser.c (cp_parser_decl_specifier_seq): Correct error in
+ comment.
+ (cp_parser_constructor_declarator_p): Treat attributes
+ as decl-specifiers.
-2003-01-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ PR c++/15329
+ * typeck.c (build_unary_op): Do not attempt to resolve casts to
+ base classes in templates.
- * decl2.c (check_classfn): Fix uninitialized warning.
+ PR c++/15165
+ * pt.c (instantiate_template): Robustify.
-2003-01-22 Mark Mitchell <mark@codesourcery.com>
+ PR c++/15025
+ * decl.c (xref_tag): Issue errors about redeclaring template
+ classes as non-template classes.
- PR c++/9328
- * error.c (dump_decl): For an OVERLOAD, just print the name of the
- function; it doesn't make sense to try to print its type.
- * semantics.c (finish_typeof): Issue errors about invalid uses.
+ PR c++/14821
+ * name-lookup.c (supplement_binding): Allow redefinitions of
+ namespace aliases.
-2003-01-22 Josef Zlomek <zlomekj@suse.cz>
+ PR c++/14883
+ * parser.c (cp_parser_template_argument): Robustify.
- PR/9386, PR/8801
- 2002-12-27 Mark Mitchell <mark@codesourcery.com>
- * typeck.c (build_class_member_access_expr): Fix anonymous union
- handling.
+2004-05-22 Mark Mitchell <mark@codesourcery.com>
-2003-01-17 Jason Merrill <jason@redhat.com>
+ PR c++/15285
+ PR c++/15299
+ * pt.c (build_non_dependent_expr): Expand the set of tree nodes
+ recognized as overloaded functions.
- PR c++/9167, c++/9358
- * decl.c (require_complete_types_for_parms): Also update DECL_ARG_TYPE.
+ PR c++/15507
+ * class.c (layout_nonempty_base_or_field): Do not try to avoid
+ layout conflicts for unions.
-2003-01-17 Jason Merrill <jason@redhat.com>
+ PR c++/15542
+ * typeck.c (build_x_unary_op): Instantiate template class
+ specializations before looking for "operator &".
- PR c++/9342
- * call.c (build_conditional_expr): Always do lvalue-rvalue
- conversion.
+ PR c++/15427
+ * typeck.c (complete_type): Layout non-dependent array types, even
+ in templates.
-2003-01-16 Jason Merrill <jason@redhat.com>
+ PR c++/15287
+ * typeck.c (build_unary_op): Do not optimize "&x[y]" when in a
+ template.
- PR c++/8564
- * init.c (build_vec_init): Re-add maxindex parm.
- (perform_member_init, build_aggr_init): Pass it.
- (build_new_1): Pass it. Use an incomplete array type for full_type.
- * typeck.c (build_modify_expr): Pass it.
- * cp-tree.h: Adjust.
+2004-04-23 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2003-01-13 Jason Merrill <jason@redhat.com>
+ PR c++/15064
+ * parser.c (cp_parser_postfix_expression): typeid operator cannot be
+ used in integral constant expressions.
- PR c++/8748
- * class.c (build_base_path): Take the address before calling save_expr.
+2004-04-18 Release Manager
- * call.c (build_user_type_conversion_1): Do set ICS_BAD_FLAG if
- all the ambiguous conversions are bad.
+ * GCC 3.4.0 released.
- * class.c (maybe_warn_about_overly_private_class): Don't stop
- searching when we find a nonprivate method.
+2004-04-08 Danny Smith <dannysmith@users.sourceforge.net>
-2003-01-09 Jakub Jelinek <jakub@redhat.com>
+ PR c++/14808
+ * method.c (make_alias_for_thunk): Just return function decl
+ for one_only functions if __CYGWIN__ or __MINGW32__
+ (use_thunk): Don't put function and thunk in same one_only
+ section if __CYGWIN__ or __MINGW32__.
- * decl.c (start_decl): Only check DECL_THREAD_LOCAL for VAR_DECLs.
+2004-04-08 Jakub Jelinek <jakub@redhat.com>
-2003-01-09 Jakub Jelinek <jakub@redhat.com>
+ * decl2.c (mark_used): Don't segfault if cfun != NULL but
+ current_function_decl == NULL.
- * decl.c (start_decl): Don't set DECL_COMMON for __thread variables.
+2004-04-01 Mark Mitchell <mark@codesourcery.com>
-2003-01-07 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+ PR c++/14803
+ * typeck.c (get_delta_difference): Call fold before returning the
+ value.
- PR c++/9030
- * decl.c (make_typename_type): Check access only when tf_error.
- (make_unbound_class_template): Likewise.
- * pt.c (saved_access_scope): New variable.
- (push_access_scope_real): New function.
- (push_access_scope): Likewise.
- (pop_access_scope): Likewise.
- (tsubst_default_argument): Use them.
- (instantiate_template): Likewise.
- (regenerate_decl_from_template): Likewise.
- (instantiate_decl): Likewise.
- (get_mostly_instantiated_function_type): Likewise.
+2004-04-01 Richard Henderson <rth@redhat.com>
-2003-01-06 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14804
+ * decl.c (cp_finish_decl): Preserve TREE_READONLY more often.
+ * typeck2.c (split_nonconstant_init): Clear TREE_READONLY.
- PR c++/9165
- * decl2.c (build_cleanup): Mark the object as used.
+2004-04-01 Mark Mitchell <mark@codesourcery.com>
-2003-01-03 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/14810
+ * name-lookup.c (maybe_push_cleanup_level): Robustify.
- PR c++/45, c++/3784
- * tree.c (cp_tree_equal, TEMPLATE_PARM_INDEX): The types must be
- the same too.
+2004-03-30 Mark Mitchell <mark@codesourcery.com>
-2002-12-30 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/14724
+ * decl.c (start_decl_1): Do not decide whether or not to create a
+ new cleanup level until after the type has been completed.
- PR c++/9054
- * class.c (layout_class_type): Set DECL_CONTEXT of type for base.
- * dump.c (cp_dump_tree, RECORD_TYPE): Deal with type for base types.
+ PR c++/14763
+ * pt.c (tsubst_default_argument): Clear current_function_decl.
-2002-12-26 Nathan Sidwell <nathan@codesourcery.com>
+2004-03-28 Jan Hubicka <jh@suse.cz>
- PR c++/4803
- * decl2.c (mark_used): Defer inline functions.
- (finish_file): Merge deferred_fns loops. Check all used
- inline functions have a definition.
- * method.c (make_thunk): Thunks are not inline.
+ PR C++/14639
+ * method.c (use_think): Do not mark thunk as referenced.
- PR c++/5116, c++/764
- * call.c (build_new_op): Make sure template class operands are
- instantiated.
+2004-03-21 Mark Mitchell <mark@codesourcery.com>
-2002-12-24 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/14616
+ * decl.c (cp_finish_decl): Compute the size of arrays declared in
+ templates, if their type is non-dependent.
- PR C++/7964
- * cp-tree.h (resolve_scoped_fn_name): Prototype.
- * call.c (resolve_scoped_fn_name): New function. Deal with
- more template expansion. Broken out of ...
- * parse.y (parse_finish_call_expr): ... here. Call it.
- * decl2.c (build_expr_from_tree, CALL_EXPR): Use
- resolve_scoped_fn_name and build_call_from_tree.
+2004-03-19 Mark Mitchell <mark@codesourcery.com>
- PR c++/9053
- * decl.c (duplicate_decls): Templates may be disambiguated by
- return type.
+ * call.c (build_op_delete_call): Do not forget the placement
+ arguments when iterating through mutiple delete operators.
- PR c++/8702
- * decl2.c (check_classfn): Use lookup_fnfield_1. List all
- conversion operators on failure.
+ * cp-tree.h (svaed_scope): Remove last_parms.
+ (NEW_DELETE_OPNAME_P): New macro.
+ (last_function_parms): Remove.
+ (do_friend): Adjust prototype.
+ * decl.c (grokparms): Return the PARM_DECLs directly, rather than
+ using last_function_parms.
+ (grokfndecl): Take the PARM_DECLs as an argument, rather than
+ using last_function_parms.
+ (grokdeclarator): Adjust accordingly. Do not form METHOD_TYPEs
+ for class-specific operator new and operator delete.
+ (grok_op_properties): Do not look for allocation functions with
+ METHOD_TYPEs.
+ (start_function): Use DECL_ARGUMENTS instead of
+ last_function_parms.
+ * decl.h (last_function_parms): Do not declare.
+ * decl2.c (grokclassfn): Do not use last_function_parms.
+ * friend.c (do_friend): Remove parmdecls parameter.
+ * name-lookup.c (push_to_top_level): Do not save last_function_parms.
+ (pop_from_top_level): Do not restore it.
+ * pt.c (check_explicit_specialization): Do not adjust
+ last_function_parms.
-2002-12-22 Nathan Sidwell <nathan@codesourcery.com>
+ * name-lookup.c (do_local_using_decl): Create a local binding for
+ types brought in via using declarations.
- PR c++/8572
- * cp-tree.h (grokoptypename): Add SCOPE parameter.
- * decl2.c (grokoptypename): Add SCOPE parameter. tsubst the type
- if in a template scope.
- * parse.y (unoperator): Return the scope.
- (operator_name): Adjust grokoptypename call.
+ * name-lookup.c (lookup_arg_dependent): Handle block-scope
+ function declarations correctly.
-2002-12-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+ * semantics.c (finish_id_expression): Correct handling of
+ conversion operators to dependent types.
- * cp-tree.h (make_unbound_class_template): Use tsubst_flags_t.
- * decl.c (make_unbound_class_template): Adjust. Check for tf_error.
- * pt.c (tsubst) [OFFSET_TYPE]: Check for tf_error.
+ * typeck.c (lookup_destructor): Allow the use of destructors from
+ base classes.
+
+2004-03-19 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+ PR c++/14545
+ * parser.c (cp_parser_functional_cast): A cast to anything
+ but integral or enumaration type is not an integral constant
+ expression.
+ * pt.c (value_dependent_expression_p): Handle cast expressions
+ without operands (such as "int()").
- PR c++/8099
- * friend.c (make_friend_class): Allow partial specialization
- when declaration is not a template friend.
+2004-03-18 Mark Mitchell <mark@codesourcery.com>
-2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+ * semantics.c (finish_pseudo_destructor_expr): Allow differing
+ cv-qualification between the type named by the
+ pseudo-destructor-name and the object-type.
- PR c++/3663
- * pt.c (lookup_template_class): Copy TREE_PRIVATE and
- TREE_PROTECTED to created decl nodes.
+ * search.c (accessible_base_p): Handle non-proper bases.
-2002-12-18 Mark Mitchell <mark@codesourcery.com>
+ * name-lookup.c (do_nonmember_using_decl): If a using declaration
+ refers to a single overloaded function, set the type of the
+ function.
+ * tree.c (lvalue_type): Simplify.
+ * typeck.c (type_unknown_p): Do not assume all OVERLOADs have an
+ unknown type.
+ (build_unary_op): Handle OVERLOADs with known types.
+
+ * decl.c (duplicate_decls): Do not destroy DECL_ARGUMENTS for
+ function templates.
+
+ * parser.c (cp_parser_postfix_expression): Handle the use of
+ "typename" in non-dependent contexts. Convert appropriately when
+ when using a qualified name after "->" or ".".
+
+ * call.c (conditional_conversion): Honor the requirement that some
+ conversions refer to the original object.
+
+ * call.c (build_conditional_expr): Do not call force_rvalue for
+ operands of void_type when the conditional expression itself has
+ void type.
+ * name-lookup.c (pushdecl): Don't consider a declaration of a
+ function named "main" to be an overload of a type named "main".
+ * parser.c (cp_parser_template_name): Perform name lookup when the
+ template name is proceeded by "template" if the qualifying scope
+ is non-dependent.
+ * typeck.c (composite_pointer_type_r): Correctly handle
+ pointer-to-member types.
+ (build_const_cast): Likewise.
- * class.c (build_base_field): Do not set DECL_PACKED on the
- FIELD_DECL.
+2004-03-16 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/14586
+ * cp-tree.h (build_new_op): Change prototype.
+ (build_x_binary_op): Likewise.
+ * call.c (build_new_op): Add overloaded_p parameter.
+ * decl2.c (grok_array_decl): Adjust call to build_new_op.
+ * parser.c (cp_parser_binary_expression): Note that uses of
+ overloaded operators prevents an expression from being considered
+ an integral constant.
+ * pt.c (tsubst_copy_and_build): Adjust calls to build_new_op and/or
+ build_x_binary_op.
+ * semantics.c (finish_call_expr): Likewise.
+ * typeck.c (rationalize_conditional_expr): Likewise.
+ (build_x_indirect_ref): Likewise.
+ (build_x_binary_op): Likewise.
+ (build_x_unary_op): Likewise.
+ (build_x_compound_expr): Likewise.
+ (build_modify_expr): Likewise.
+ * typeck2.c (build_x_arrow): Likewise.
-2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+2004-03-13 Mark Mitchell <mark@codesourcery.com>
- * parse.y (bad_parm): Add missing argument to error function call.
+ PR c++/14550
+ * parser.c (cp_parser_non_integral_constant_expression): Encode
+ more of the idiom that surrounded calls to this function within
+ the function itself
+ (cp_parser_primary_expression): Adjust accordingly.
+ (cp_parser_postfix_expression): Likewise.
+ (cp_parser_unary_expression): Likewise.
+ (cp_parser_cast_expression): Likewise.
+ (cp_parser_assignment_expression): Likewise.
+ (cp_parser_expression): Likewise.
+ (cp_parser_new_expression): Note that new-expressions are not
+ allowed in integral constant expressions.
+ (cp_parser_delete_expression): Likewise.
-2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+2004-03-11 Mark Mitchell <mark@codesourcery.com>
- PR c++/8442
- * decl2.c (handle_class_head): Verify if the looked up name is a
- type or template.
- * pt.c (convert_template_argument): Fix type or template template
- parameter decision logic.
+ PR c++/14476
+ * decl.c (xref_tag): Do not create dummy ENUMERAL_TYPEs.
-2002-12-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
+2004-03-10 Mark Mitchell <mark@codesourcery.com>
- PR C++/8031
- * cvt.c (convert_to_pointer_force): Don't try comparing against
- erronous type.
+ PR c++/14510
+ * decl.c (xref_tag): Disregard non-type declarations when
+ looking up a tagged type.
-2002-12-13 Geoffrey Keating <geoffk@apple.com>
+2004-03-10 Jason Merrill <jason@redhat.com>
- * cp-tree.h: Have the multiple-include guards around
- the entire file.
+ PR c++/14452
+ * tree.c (stabilize_init): Return whether or not it worked.
+ * init.c (build_new_1): If not, use a sentry.
+ * cp-tree.h: Adjust prototype.
-2002-12-10 Mark Mitchell <mark@codesourcery.com>
+2004-03-09 Nathan Sidwell <nathan@garibaldi.home>
- PR c++/8372
- * pt.c (tsubst_copy): Handle destructor names more correctly.
+ PR c++/14397
+ * call.c (convert_like_real): Build a const qualified temporary,
+ when testing ctor access.
-2002-12-10 Matt Austern <austern@apple.com>
+2004-03-09 Mark Mitchell <mark@codesourcery.com>
- * cp-tree.h: get rid of needs_virtual_reinit bit.
+ * call.c (initialize_reference): Fix typo.
-2002-12-09 Mark Mitchell <mark@codesourcery.com>
+2004-03-09 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * NEWS: Document removal of in-class initialization extension for
- static data members of non-arithmetic, non-enumeration type.
- * decl.c (check_static_variable_definition): Do not allow that
- extension.
- * decl2.c (grokfield): Do not call digest_init when processing
- templates.
+ PR c++/14409
+ * pt.c (determine_specialization): For member templates, match also
+ constness.
-2002-12-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ PR c++/14448
+ * parser.c (cp_parser_initializer_clause): Fold initializer if it is
+ non-dependent.
+ * pt.c (tsubst_copy_and_build): Handle NOP_EXPRs.
- * error.c (dump_expr): Fix format specifier warning.
+2004-03-09 Mark Mitchell <mark@codesourcery.com>
-2002-12-04 Geoffrey Keating <geoffk@apple.com>
+ PR c++/14230
+ * call.c (initialize_reference): Handle initializers that are
+ class-member access expressions applies to rvalues.
- * class.c (finish_struct_1): Correct comment.
- * cp-tree.c (DECL_SORTED_FIELDS): Likewise.
+ PR c++/14432
+ * name-lookup.c (supplement_binding): Ignore functions that are
+ marked DECL_ANTICIPATED.
-2002-12-04 Gabriel Dos Reis <gdr@integrable-solutions.net>
+2004-03-08 Mark Mitchell <mark@codesourcery.com>
- PR C++/8799
- * error.c (dump_expr): Don't ever try to dump a non-existent
+ PR c++/14401
+ * class.c (check_field_decls): Complain about non-static data
+ members of reference type in unions. Propagate
+ CLASSTYPE_REF_FIELDS_NEED_INIT and
+ CLASSTYPE_READONLY_FIELDS_NEED_INIT from the types of non-static
+ data members.
+ * init.c (perform_member_init): Complain about mbmers with const
+ type that are not explicitly initialized.
+
+2004-03-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/13170
+ * decl.c (xref_tag): Remove attribute handling.
+ * cp-tree.h: Adjust prototype.
+ * decl.c, parser.c, rtti.c: Adjust callers.
+ * parser.c (cp_parser_class_head): Pass back attributes in the
+ class head.
+ (cp_parser_class_specifier): Adjust.
+
+2004-03-08 Matt Austern <austern@apple.com>
+
+ PR debug/14079
+ * name-lookup.c (add_decl_to_level): Add extern variables, as well
+ as static, to static_decls array.
+
+2004-03-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/13944
+ * except.c (do_free_exception): Remove #if 0 wrapper.
+ (build_throw): Use it if we elide a copy into the
+ exception object.
+
+ * tree.c (stabilize_call): Fix thinko.
+
+ * init.c (build_new_1): Preevaluate initializer. Simplify EH code.
+ (build_init): Call a constructor rather than call build_aggr_init
+ for classes.
+ * except.c (stabilize_throw_expr): Remove.
+ (build_throw): Use stabilize_init instead of stabilize_throw_expr.
+ * tree.c (stabilize_call, stabilize_init): New fns.
+ * call.c (build_over_call): A constructor no longer returns the
+ address of the object.
+
+2004-03-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/14324
+ * lex.c (retrofit_lang_decl): Treat entities with no linkage as
+ having C++ linkage for name-mangling purposes.
+
+ PR c++/14260
+ * parser.c (cp_parser_direct_declarator): Recognize constructor
+ declarators that use a template-id to name the class being
+ constructed.
+
+ PR c++/14337
+ * pt.c (tsubst_qualified_id): Handle dependent qualifying scopes.
+ (tsubst_expr): Do not call tsubst_copy, even when
+ processing_template_decl.
+
+2004-03-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/14369
+ * pt.c (build_non_dependent_expr): Do not create a
+ NON_DEPENDENT_EXPR for a THROW_EXPR.
+
+ PR c++/14360
+ * parser.c (cp_parser_postfix_expression): Do not perform Koenig
+ lookup if ordinary name-lookup finds a non-function.
+ * pt.c (tsubst_copy_and_build): Likewise.
+
+ PR c++/14361
+ * parser.c (cp_parser_late_parsing_default_args): Check that there
+ are no extra tokens after the end of the default-argument
expression.
-2002-12-03 Jason Merrill <jason@redhat.com>
-
- PR c++/8674
- * call.c (build_over_call): Check specifically for TARGET_EXPR
- when eliding.
-
- PR c++/8461, c++/8625
- * call.c (convert_for_arg_passing): Don't mess with error_mark_node.
- (cp_convert_parm_for_inlining): Remove.
- * cp-lang.c (LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING):
- Remove.
- * cp-tree.h (ADDR_IS_INVISIREF): Remove.
- * except.c (stabilize_throw_expr): Remove ADDR_IS_INVISIREF code.
-
- * call.c (build_user_type_conversion_1): Don't set ICS_BAD_FLAG on
- an ambiguous conversion.
-
-2002-12-03 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/8688
- * decl.c (reshape_init): Handle erroneous initializers.
-
-2002-12-02 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14359
+ Backport 2004-02-12 Mark Mitchell <mark@codesourcery.com>
+ * decl.c (redeclaration_error_message): Correct handling of
+ templates.
+ * pt.c (tsubst_friend_declaration): Adjust code to determine
+ whether or not a friend template is a definition.
+ (tsubst_decl): Clear DECL_INITIAL for new FUNCTION_DECLs.
- PR c++/8720
- * spew.c (remove_last_token): Make sure that last_chunk is set
- correctly.
+2004-03-01 Gabriel Dos Reis <gdr@integrable-solutions.net>
- PR c++/8615
- * error.c (dump_expr): Handle character constants with
- TREE_OVERFLOW set.
+ PR c++/14369
+ * error.c (dump_expr): Handle THROW_EXPR.
-2002-12-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+2004-02-29 Mark Mitchell <mark@codesourcery.com>
- DR 180
- * decl.c (grokdeclarator): Require class-key for all friend class.
- Output the correct type and context in the error message.
+ PR c++/14138
+ * name-lookup.h (push_scope): Change prototype.
+ * name-lookup.c (push_scope): Do not reenter the current class
+ scope.
+ * decl.c (grokfndecl): Check return code from push_scope before
+ calling pop_scope.
+ * decl2.c (check_classfn): Likewise.
+ * parser.c (cp_parser_conversion_function_id): Likewise.
+ (cp_parser_init_declarator): Likewise.
+ (cp_parser_direct_declarator): Likewise.
+ (cp_parser_class_specifier): Likewise.
+ (cp_parser_class_head): Likewise.
+ (cp_parser_lookup_name): Likewise.
+ (cp_parser_constructor_declarator_p): Likewise.
+ * pt.c (instantiate_class_template): Likewise.
+ (resolve_typename_type): Likewise.
-2002-12-01 Mark Mitchell <mark@codesourcery.com>
+2004-02-27 Mark Mitchell <mark@codesourcery.com>
- PR c++/5919
- * pt.c (unify): Use variably_modified_type_p to test validity of
- template argument types.
+ PR debug/12103
+ * class.c (update_vtable_entry_for_fn): Do not go through
+ covariance machinery if the type returned by an overrider is the
+ same as the original.
- PR c++/8727
- * cp-tree.h (lang_type_class): Add typeinfo_var.
- (CLASSTYPE_TYPEINFO_VAR): New macro.
- * rtti.c (get_tinfo_decl): Use it.
+2004-02-27 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- PR c++/8663
- * init.c (expand_member_init): Always get the main variant of a
- base class.
+ PR c++/14284
+ * pt.c (dependent_type_p_r): A template template parameter is a
+ dependent type.
-2002-12-01 Mark Mitchell <mark@codesourcery.com>
+2004-02-26 Mark Mitchell <mark@codesourcery.com>
- PR c++/8332
- PR c++/8493
- * decl.c (cxx_init_decl_processing): Use size_type_node, not
- c_size_type_node.
- * decl2.c (coerce_new_type): Likewise.
- * except.c (do_allocate_exception): Likewise.
+ PR c++/14278
+ * parser.c (cp_parser_parameter_declaration_list): Commit
+ to fewer tentative parses.
-2002-11-30 Mark Mitchell <mark@codesourcery.com>
+2004-02-26 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- PR c++/8227
- * decl.c (layout_var_decl): Deal gracefully with erroneous types.
- (check_initializer): Validate the type of the initialized
- variable, even if the initializer is absent.
- * typeck.c (cp_type_quals): Deal gracefully with erroneous types.
+ PR c++/14246
+ * mangle.c (write_template_arg_literal): Don't rely on identity for
+ boolean constants.
- PR c++/8214
- * typeck.c (convert_for_assignment): Do not use
- decl_constant_value on the operand.
+2004-02-23 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- PR c++/8511
- * pt.c (instantiate_decl): Handle template friends defined outside
- of the class correctly.
+ PR c++/14250
+ * cvt.c (build_expr_type_conversion): Type must be complete before
+ looking up for conversions.
-2002-11-29 Joe Buck <jbuck@synopsys.com>
+2004-02-20 Mark Mitchell <mark@codesourcery.com>
- * parse.y (class_head_defn): Set CLASSTYPE_DECLARED_CLASS for
- anonymous structs.
+ PR c++/14199
+ * pt.c (tsubst_copy): Call mark_used for a PARM_DECL.
-2002-11-29 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14173
+ * semantics.c (begin_class_definition): Set TYPE_PACKED correctly
+ for all type variants.
- * class.c (walk_subobject_offsets): Recur on binfos as well as on
- types.
- (layout_nonempty_base_or_field): Pass it a binfo when processing a
- base class.
- (layout_empty_base): Likewise.
- (build_base_field): Likewise.
+2004-02-19 Mark Mitchell <mark@codesourcery.com>
-2002-11-27 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14186
+ * name-lookup.c (push_class_level_binding): Do not complain about
+ adding a binding for a member whose name is the same as the
+ enclosing class if the member is located in a base class of the
+ current class.
- * class.c (build_base_field): Make sure we get the canonical base
- when descending through primary bases.
+2004-02-19 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2002-11-26 Geoffrey Keating <geoffk@apple.com>
+ PR c++/14181
+ * parser.c (cp_parser_new_expression): Parse an ill-formed
+ direct-new-declarator after a parenthesized type-id to emit good
+ diagnostic.
- * decl.c (check_initializer): Don't error on initialisation of
- a scalar with a brace-enclosed expression.
+2004-02-17 Mark Mitchell <mark@codesourcery.com>
-2002-11-26 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/11326
+ * cp-tree.h (abi_version_at_least): Remove.
+ * mangle.c: Include flags.h.
- * cp-tree.h (DECL_LANG_FLAG_4): Document more uses.
- (template_parms_equal): Remove prototype.
- * typeck.c (buuld_indirect_ref): Reformat.
+2004-02-15 Mark Mitchell <mark@codesourcery.com>
-2002-11-25 Mark Mitchell <mark@codesourcery.com>
+ PR c++/13971
+ * call.c (build_conditional_expr): Handle conversions between
+ class types which result in differently cv-qualified type
+ variants.
- * tree.c (cp_build_qualified_type_real): Correct handling of
- array types.
- * class.c (walk_subobject_offsets): Fix thinko.
- (build_base_field): Record offsets of empty bases in primary
- virtual bases.
- (layout_class_type): Record offsets of empty bases in fields.
+ PR c++/14086
+ * class.c (delete_duplicate_fields_1): Remove.
+ (delete_duplicate_fields): Likewise.
+ (finish_struct_anon): Remove check for members with the same name
+ as their enclosing class.
+ (check_field_decls): Do not call duplicate_fields.
+ * decl.c (grokdeclarator): Remove check for static data members
+ with the same name as their enclosing class.
+ * name-lookup.c (push_class_level_binding): Check for members with
+ the same name as their enclosing class.
- * search.c (is_subobject_of_p_1): Fix thinko.
- (lookup_field_queue_p): Likewise.
+2004-02-15 Gabriel Dos Reis <gdr@integrable-solutions.net>
-2002-11-24 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14085
+ * error.c (dump_decl): Handle TEMPLATE_TYPE_PARM.
- * class.c (layout_class_type): Reuse tail padding when laying out
- virtual bases.
+2004-02-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-2002-11-22 Mark Mitchell <mark@codesourcery.com>
+ PR c++/13635
+ * pt.c (push_template_decl_real): Make sure DECL_TI_ARGS of DECL
+ has full set of arguments.
- * rtti.c (qualifier_flags): Fix thinko.
+2004-02-13 Mark Mitchell <mark@codesourcery.com>
-2002-11-21 Glen Nakamura <glen@imodulo.com>
+ PR c++/14122
+ * cp-tree.h (delete_sanity): Change prototype.
+ * decl2.c (delete_sanity): Make doing_vec a bool, not an int.
+ Remove dead code. Adjust code to warn about deleting an array.
+ * typekc.c (decay_conversion): Use build_address and build_nop.
- PR c++/8342
- * typeck.c (get_member_function_from_ptrfunc): Make sure that a
- SAVE_EXPR for instance_ptr doesn't get evaluated first inside one
- of the branches of a COND_EXPR.
+ PR c++/14108
+ * search.c (accessible_p): Do not check access in thunks.
-2002-11-19 Mark Mitchell <mark@codesourcery.com>
+2004-02-13 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * pt.c (for_each_template_parm): Free allocated memory.
- * search.c (is_subobject_of_p_1): New function.
- (is_subobject_of_p): Avoid walking virtual bases multiple times.
+ PR c++/13927
+ * error.c (dump_decl) <ALIAS_DECL>: Dump as simple declarations.
-2002-11-19 Jason Thorpe <thorpej@wasabisystems.com>
+2004-02-13 Mark Mitchell <mark@codesourcery.com>
- * g++spec.c (lang_specific_spec_functions): New.
+ PR c++/14083
+ * call.c (build_conditional_expr): Call force_rvalue on the
+ non-void operand in the case that one result is a throw-expression
+ and the other is not.
-2002-11-15 Kazu Hirata <kazu@cs.umass.edu>
+2004-02-13 Ian Lance Taylor <ian@wasabisystems.com>
- * ChangeLog: Follow spelling conventions.
- * class.c: Likewise.
- * decl2.c: Likewise.
+ PR c++/9851
+ * parser.c (cp_parser_pseudo_destructor_name): Check for errors on
+ the type name and look ahead for ::~, and bail out early with a
+ better error message if the parse is going to fail.
-2002-11-14 Zack Weinberg <zack@codesourcery.com>
+2004-02-10 Mark Mitchell <mark@codesourcery.com>
- * search.c (dfs_push_decls): Do not try to reorder elements
- 3..n of method_vec if method_vec has only two elements.
- Reverse order of two tests to avoid accessing unallocated
- memory.
+ * typeck.c (lookup_destructor): Fix typo in error message.
-2002-11-14 Mark Mitchell <mark@codesourcery.com>
+2004-02-07 Zack Weinberg <zack@codesourcery.com>
- * class.c (dfs_find_final_overrider): Adjust so that the most
- derived object is a binfo, rather than a class type.
- (find_final_overrider): Likewise.
- (add_vcall_offset_vtbl_entries_1): Simplify accordingly.
- (add_vcall_offset): Likewise.
+ Bug 13856
+ * optimize.c (maybe_clone_body): Don't update DECL_ESTIMATED_INSNS.
+ * decl.c (duplicate_decls, start_function): Likewise.
-2002-11-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+2004-02-07 Zack Weinberg <zack@codesourcery.com>
- PR c++/8389
- * pt.c (instantiate_template): Push class scope for member
- functions.
- (get_mostly_instantiated_function_type): Likewise. Don't call
- tsubst on context. Remove CONTEXTP and TPARMSP parameters.
- * cp-tree.h (get_mostly_instantiated_function_type): Adjust.
- * mangle.c (write_encoding, write_unqualified_name): Adjust.
-
-2002-11-07 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (add_vcall_offset_vtbl_entries_1): Correct ordering of
- vcall offfsets. Split out ...
- (add_vcall_offset): ... new function.
-
- PR c++/8338
- * pt.c (for_each_template_parm): Add htab parameter.
- (process_partial_specialization): Adjust call.
- (push_template_decl_real): Likewise.
- (pair_fn_data): Add visited.
- (for_each_template_parm_r): Avoid walking duplicates more than
- once.
- (uses_template_parms): Adjust call to for_each_template_parm.
-
-2002-11-07 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (add_implicitly_declared_members): Put implicitly
- declared functions at the end of TYPE_METHODs when -fabi-version
- is at least 2.
-
-2002-11-05 Geoffrey Keating <geoffk@apple.com>
-
- * decl2.c (finish_file): Correct spelling.
-
-2002-11-03 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (build_special_member_call): Do not try to lookup VTTs by
- name.
- * class.c (vtbl_init_data): Add generate_vcall_entries.
- (get_vtable_decl): Do not look up virtual tables by name.
- (copy_virtuals): Do not use BV_USE_VCALL_INDEX_P.
- (set_primary_base): Do not set CLASSTYPE_RTTI.
- (determine_primary_base): Likewise.
- (get_matching_virtual): Remove.
- (get_vcall_index): New function.
- (update_vtable_entry_for_fn): Do not try to use virtual thunks
- when they are not required. Assign vcall indices at this point.
- (finish_struct_1): Do not set CLASSTYPE_NEEDS_VIRTUAL_REINIT.
- Do update dynamic_classes.
- (build_vtt): Do not add VTTs to the symbol table.
- (build_ctor_vtbl_group): Likewise.
- (build_vtbl_initializer): Simplify handling of vcall indices.
- (build_vcall_offset_vtbl_entries): Pretend to build vcall offsets
- for the most derived class.
- (add_vcall_offset_vtbl_entries_1): But do not actually add them to
- the vtable.
- * cp-tree.h (dynamic_classes): New macro.
- (lang_type_class): Remove rtti. Add vtables. Add vcall_indices.
- (CLASSTYPE_RTTI): Remove.
- (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Remove.
- (CLASSTYPE_VCALL_INDICES): New macro.
- (CLASSTYPE_VTABLES): Likewise.
- (BV_USE_VCALL_INDEX_P): Remove.
- (build_vtable_path): Remove.
- * decl2.c (finish_vtable_vardecl): Remove.
- (key_method): Remove #if 0'd code.
- (finish_vtable_vardecl): Rename to ...
- (maybe_emit_vtables): ... this.
- (finish_file): Use it.
- * search.c (look_for_overrides_here): Update comment.
-
-2002-11-01 Zack Weinberg <zack@codesourcery.com>
-
- PR c/7353 redux
- * decl2.c (grokfield): Reject TYPE_DECLs with initializers.
-
-2002-10-30 Jason Merrill <jason@redhat.com>
-
- PR c++/8186
- * cp-tree.h (ADDR_IS_INVISIREF): New macro.
- * call.c (convert_for_arg_passing): Set it.
- * except.c (stabilize_throw_expr): Recurse for such an arg.
-
-2002-10-31 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (lang_decl_flags): Remove init_priority.
- (lang_decl): Add delta.
- (GLOBAL_INIT_PRIORITY): Remove.
- (THUNK_DELTA): Revise definition.
- * decl2.c (start_objects): Don't set GLOBAL_INIT_PRIORITY.
- * dump.c (cp_dump_tree): Don't dump it.
-
-2002-10-30 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/8160
- * typeck2.c (process_init_constructor): Call complete_array_type.
-
- PR c++/8149
- * decl.c (make_typename_type): Issue errors about invalid results.
-
-2002-10-30 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- Core issue 287, PR c++/7639
- * cp-tree.h (lang_type_class): Add decl_list field.
- (CLASSTYPE_DECL_LIST): New macro.
- (maybe_add_class_template_decl_list): Add declaration.
- * class.c (duplicate_tag_error): Initialize CLASSTYPE_DECL_LIST.
- (unreverse_member_declarations): Reverse CLASSTYPE_DECL_LIST.
- (maybe_add_class_template_decl_list): New function.
- (add_implicitly_declared_members): Use it.
- * decl.c (maybe_process_template_type_declaration): Likewise.
- (pushtag): Likewise.
- * friend.c (add_friend): Likewise.
- (make_friend_class): Likewise.
- * semantics.c (finish_member_declaration): Likewise.
- (begin_class_definition): Initialize CLASSTYPE_DECL_LIST.
- * pt.c (instantiate_class_template): Use CLASSTYPE_DECL_LIST
- to process members and friends in the order of declaration.
-
-2002-10-29 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/8287
- * decl.c (finish_destructor_body): Create the label to jump to
- when returning from a destructor here.
- (finish_function_body): Rather than here.
-
-2002-10-25 Zack Weinberg <zack@codesourcery.com>
-
- PR c++/7266
- * decl.c (grokdeclarator): Check that TREE_OPERAND 0 of a
- SCOPE_REF is not null before dereferencing it.
-
-2002-10-25 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (build_over_call): Use DECL_CONTEXT, not
- DECL_VIRTUAL_CONTEXT.
- * class.c (modify_vtable_entry): Don't mess with
- DECL_VIRTUAL_CONTEXT.
- (set_vindex): Remove.
- (set_primary_base): Remove vfuns_p parameter.
- (determine_primary_base): Likewise.
- (modify_all_vtables): Likewise.
- (layout_class_type): Likewise. Adjust calls to other functions
- accordingly.
- (finish_struct_1): Adjust calls to modified functions. Set
- DECL_VINDEX here.
- * cp-tree.h (lang_type_class): Remove vsize.
- (CLASSTYPE_VSIZE): Remove.
- (lang_decl): Remove thunks.
- (DECL_THUNKS): Adjust.
- (DECL_VIRTUAL_CONTEXT): Remove.
- (duplicate_decls): Don't copy it.
- * pt.c (build_template_decl): Don't set it.
- (tsubst_decl): Likewise.
- * typeck.c (expand_ptrmemfunc_cst): Don't use it.
-
- * class.c (build_vtbl_initializer): Don't use build_vtable_entry.
- (build_vtable_entry): Remove.
- * cp-tree.h (BINFO_VIRTUALS): Expand documentation.
- (lang_decl): Add thunks.
- (DECL_THUNKS): New macro.
- * decl.c (duplicate_decls): Copy it.
- * method.c (make_thunk): Simplify, and add thunks to DECL_THUNKS.
- * semantics.c (emit_associated_thunks): Simplify.
-
-2002-10-24 David Edelsohn <edelsohn@gnu.org>
-
- PR c++/7228
- * cp-tree.h (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Check that
- lang_type structure exists before accessing field.
- (SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT): New macro.
- (CLASSTYPE_REF_FIELDS_NEED_INIT): Similar.
- (SET_CLASSTYPE_REF_FIELDS_NEED_INIT): New macro.
- * class.c (check_field_decls): Use new macros.
- * typeck2.c (process_init_constructor): Remove redundant check for
- existence of lang_type structure.
-
-2002-10-24 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (end_of_base): New method.
- (end_of_class): Use it. Check indirect virtual bases.
-
- * class.c (check_field_decls): Fix typo.
-
-2002-10-23 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/8067
- * decl.c (maybe_inject_for_scope_var): Ignore __FUNCTION__ and
- related variables.
-
- PR c++/7679
- * spew.c (next_token): Do not return an endless stream of
- END_OF_SAVED_INPUT tokens.
- (snarf_method): Add three END_OF_SAVED_INPUT tokens to the end of
- the cached token stream.
- (snarf_defarg): Likewise.
-
-2002-10-23 Zack Weinberg <zack@codesourcery.com>
-
- * cp-lang.c (cp_var_mod_type_p): New: C++ hook for
- variably_modified_type_p.
- * cp-tree.h: Remove prototype of variably_modified_type_p.
- * tree.c (variably_modified_type_p): Remove; now implemented
- in language-independent code.
-
-2002-10-22 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/6579
- * spew.c (snarf_parenthesized_expression): New function.
- (snarf_block): Use it.
-
-2002-10-22 Richard Henderson <rth@redhat.com>
+ * name-lookup.c (pushdecl): Issue shadow warnings directly.
+ * parser.c (free_parser_stacks): Delete.
- * method.c (use_thunk): Always compute vcall_value; assert that
- it is not zero. Use can_output_mi_thunk; use output_mi_thunk
- for vcall thunks as well.
+2004-02-07 Kazu Hirata <kazu@cs.umass.edu>
-2002-10-21 Mark Mitchell <mark@codesourcery.com>
+ * rtti.c, tree.c: Update copyright.
- * class.c (empty_base_at_nonzero_offset_p): New function.
- (layout_nonempty_base_or_field): Do not check for conflicts when
- laying out a virtual base using the GCC 3.2 ABI.
- (build_base_field): Correct checking for presence of empty classes
- at nonzero offsets when clearing CLASSTYPE_NEARLY_EMPTY_P.
+2003-02-06 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * class.c (include_empty_classes): Use normalize_rli.
- (layout_class_type): Likewise.
+ PR c++/14033
+ * decl.c (require_complete_types_for_parms): Do not insert
+ error_mark_node in the parameter list.
- * decl.c (reshape_init): Tweak handling of character arrays.
+2003-02-06 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- PR c++/8218
- * cp-tree.h (lang_type_class): Add contains_empty_class_p.
- (CLASSTYPE_CONTAINS_EMPTY_CLASS_P): New macro.
- * class.c (check_bases): Update CLASSTYPE_CONTAINS_EMPTY_CLASS_P.
- (check_field_decls): Likewise.
- (layout_class_type): Likewise.
- (finish_struct_1): Initialize it.
- (walk_subobject_offsets): Use it to prune searches.
+ PR c++/14028
+ * parser.c (cp_parser_enclosed_template_argument_list): Emit straight
+ error when terminator can not be found.
-2002-10-20 Mark Mitchell <mark@codesourcery.com>
+2004-02-05 Kelley Cook <kcook@gcc.gnu.org>
- * method.c (use_thunk): Compute the vcall index as a HOST_WIDE_INT.
- * optimize.c (optimize_function): Replace ASM_OUTPUT_MI_THUNK with
- TARGET_ASM_OUTPUT_MI_THUNK in comments.
+ Make-lang.in (po-generated): Delete.
-2002-10-18 Zack Weinberg <zack@codesourcery.com>
+2004-02-05 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
- * decl.c (start_decl): Point users of the old initialized-
- typedef extension at __typeof__.
+ PR middle-end/13750
+ Revert:
+ 2004-01-15 Geoffrey Keating <geoffk@apple.com>
+ PR pch/13361
+ * cp/lex.c (handle_pragma_interface): Duplicate string from tree.
+ (handle_pragma_implementation): Likewise.
-2002-10-18 Mark Mitchell <mark@codesourcery.com>
+2004-02-05 Mark Mitchell <mark@codesourcery.com>
- * Make-lang.in (method.o): Depend on TARGET_H.
- * method.c (target.h): Include it.
- (use_thunk): Use target hooks. Use vcall thunks, if available.
+ PR c++/13714
+ * typeck.c (lookup_destructor): Tweak error message.
-2002-10-18 Mark Mitchell <mark@codesourcery.com>
+2004-02-05 Paul Brook <paul@codesourcery.com>
- * class.c (base_derived_from): Make sure return value is a bool.
+ Backport from mainline.
-2002-10-18 Mark Mitchell <mark@codesourcery.com>
+ 2003-11-05 Mark Mitchell <mark@codesourcery.com>
- * class.c (find_final_overrider_data_s): Remove overriding_fn and
- overriding_base.
- (dfs_base_derived_from): New function.
- (base_derived_from): Likewise.
- (dfs_find_final_overrider): Use base_derived_from.
- (find_final_overrider): Adjust.
+ * decl.c (cxx_push_function_context): Do not set
+ current_function_is_thunk.
+ * method.c (use_thunk): Set CALL_FROM_THUNK on the call to the
+ actual function.
-2002-10-18 Jason Merrill <jason@redhat.com>
+2004-02-04 Mark Mitchell <mark@codesourcery.com>
- PR c++/8080
- * semantics.c (finish_for_cond, finish_while_cond): Don't mess
- with condition decls in a template.
+ PR c++/13932
+ * call.c (convert_like_real): Use "converting" rather than
+ "argument" as the descriptive keyword to
+ dubious_conversion_warnings.
+ * typeck.c (convert_for_assignment): Do not call
+ dubious_conversion_warnings.
-2002-10-17 Nathan Sidwell <nathan@codesourcery.com>
+2004-02-04 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * class.c (add_method): Compare template parms too.
+ PR c++/13086
+ * init.c (build_delete): Emit a more informative error message in
+ case of an incomplete type, and on the correct source line.
-2002-10-17 Mark Mitchell <mark@codesourcery.com>
+2004-02-04 Mark Mitchell <mark@codesourcery.com>
- PR c++/7584
- * class.c (handle_using_decl): Allow the declaration used to be
- from an ambiguous base.
+ PR c++/9941
+ * rtti.c (tinfo_base_init): Use import_export_tinfo to decide the
+ linkage for the typeinfo name string.
- * pt.c (convert_template_argument): Revert this change:
- 2002-10-16 Mark Mitchell <mark@codesourcery.com>
- * pt.c (convert_template_argument): Do not fold non-type
- template rguments when inside a template.
+ PR c++/13969
+ * cp-tree.h (fold_non_dependent_expr): New function.
+ * parser.c (cp_parser_fold_non_dependent_expr): Remove.
+ (cp_parser_template_argument): Use fold_non_dependent_expr.
+ (cp_parser_direct_declarator): Likewise.
+ * pt.c (fold_non_dependent_expr): New function.
+ (convert_nontype_argument): Use it.
+ (tsubst_qualified_id): Simplify.
+ (tsubst_copy_and_build): Likewise.
- * init.c (expand_default_init): Handle brace-enclosed initializers
- correctly.
+2003-02-04 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2002-10-16 Mark Mitchell <mark@codesourcery.com>
+ PR c++/13997
+ * pt.c (more_specialized_class): Increase processing_template_decl
+ while partial ordering.
- * mangle.c (write_expression): Correct handling of enumeration
- constants.
- (write_template_arg): Likewise.
- * pt.c (convert_template_argument): Do not fold non-type template
- arguments when inside a template.
+2004-02-03 Mark Mitchell <mark@codesourcery.com>
- PR c++/7478
- * cvt.c (convert_to_reference): Allow references as the incoming
- type.
+ PR c++/13950
+ * parser.c (cp_parser_class_name): Robustify.
-2002-10-16 Mark Mitchell <mark@codesourcery.com>
+ PR c++/13970
+ * parser.c (cp_parser_cache_group): Do not consume the EOF token.
- PR c++/7524
- * method.c (do_build_assign_ref): Use cp_build_qualified_type, not
- build_qualified_type.
+2004-02-03 Mark Mitchell <mark@codesourcery.com>
-2002-10-15 Richard Henderson <rth@redhat.com>
+ PR c++/13925
+ * decl.c (start_function): Do not call pushdecl for any
+ instantiation or specialization of a primary template.
- * error.c (dump_expr): Use real_to_decimal directly, and with
- the new arguments.
+ PR c++/14002
+ * semantics.c (finish_id_expression): Do not return an
+ IDENTIFIER_NODE when lookup finds a PARM_DECL.
-2002-10-15 Mark Mitchell <mark@codesourcery.com>
+ PR c++/13978
+ * pt.c (build_non_dependent_expr): Do not build
+ NON_DEPENDENT_EXPRs for FUNCTION_DECLs or TEMPLATE_DECLs.
- * decl.c (reshape_init): Fix typo.
+ PR c++/13968
+ * semantics.c (finish_id_expression): Do not return an
+ IDENTIFIER_NODE when lookup finds a VAR_DECL.
- * cp-tree.h (operator_name_info_t): Add arity.
- * lex.c (init_operators): Initialize it.
- * mangle.c (write_conversion_operator_name): New function.
- (write_unqualified_name): Use it.
- (write_template_args): Accept template arguments as a TREE_LIST.
- (write_expression): Adjust handling of qualified names to match
- specification.
+ PR c++/13975
+ * parser.c (cp_parser_simple_declaration): When skipping to the
+ end of the statement swallow the terminating semicolon.
-2002-10-15 Jason Merrill <jason@redhat.com>
+2004-02-02 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * call.c (call_builtin_trap): New fn.
- (convert_arg_to_ellipsis): Use it. Downgrade error to warning.
- (build_call): Don't set current_function_returns_abnormally outside
- a function.
+ DR206
+ PR c++/13813
+ * decl.c (grokdeclarator): Check immediatly type completeness for
+ non-dependent types.
-2002-10-14 Mark Mitchell <mark@codesourcery.com>
+2004-01-30 Mark Mitchell <mark@codesourcery.com>
- * class.c (check_field_decls): Remove empty_p parameter. Instead,
- clear CLASSTYPE_EMPTY_P.
- (build_base_field): Likewise.
- (build_base_fields): Likewise.
- (check_bases_and_members): Likewise.
- (create_vtbl_ptr): Likewise.
- (layout_class_type): Likewise. Ensure that empty classes have
- size zero when used as base classes in the 3.2 ABI.
- (finish_struct_1): Initialize CLASSTYPE_EMPTY_P and
- CLASSTYPE_NEARLY_EMPTY_P. Adjust calls to avoid passing empty_p
- parameter.
- (is_empty_class): Correct definition when using post-3.2 ABI.
- * cp-tree.h (lang_type_class): Add empty_p.
- (CLASSTYPE_EMPTY_P): New macro.
+ PR c++/13113
+ * init.c (build_offset_ref): Improve error recovery for invalid
+ uses of non-static member functions.
-2002-10-12 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/13854
+ * cp-tree.h (cp_build_type_attribute_variant): New function.
+ * class.c (build_clone): Use cp_build_type_attribute_variant.
+ * decl.c (duplicate_decls): Likewise.
+ * pt.c (copy_default_args_to_explicit_spec): Likewise.
+ (tsubst_function_type): Likewise.
+ * tree.c (build_exception_variant): Check attributes before
+ concluding that two types are the same.
+ (cp_build_type-attribute_variant): New method.
+ * typeck.c (merge_types): Use cp_build_type_attribute_variant.
- * init.c (build_delete): Do not apply save_expr for arrays.
- (build_vec_delete): Likewise.
+ PR c++/13907
+ * call.c (convert_class_to_reference): Keep better track of
+ pedantically invalid user-defined conversions.
-2002-10-14 Mark Mitchell <mark@codesourcery.com>
+2004-02-02 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * decl.c (layout_var_decl): Call layout_decl even for variables
- whose type is an array with unspecified bounds.
+ PR c++/13957
+ * pt.c (tsubst_qualified_id): Improved error message when a type
+ is expected but not found.
- PR c++/7176
- * lex.c (do_identifier): Add another option for the parsing
- parameter.
- * parse.y (do_id): Use it.
+2004-01-30 Michael Matz <matz@suse.de>
-2002-10-11 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ * parser.c (cp_parser_labeled_statement): Accept case ranges.
- PRs C++/6803, C++/7721 and C++/7803
- * decl.c (grokdeclarator): Gracefully handle template-name as
- decl-specifier.
+2004-01-28 Jan Hubicka <jh@suse.czi
-2002-10-11 Jason Molenda <jmolenda@apple.com>
+ * semantics.c (expand_body) Do emit_associated_thunks before
+ expansion.
- * init.c (build_field_list): Provide uses_unions_p with a default
- value.
+2004-01-30 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2002-10-11 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/5661
- * cp-tree.h (variably_modified_type_p): New function.
- (grokdeclarator) Tighten check for variably modified types as
- fields.
- * pt.c (convert_template_argument): Do not allow variably modified
- types as template arguments.
- * tree.c (variably_modified_type_p): New function.
-
- * NEWS: Document removal of "new X = ..." extension.
- * class.c (initialize_array): Set TREE_HAS_CONSTRUCTOR on
- brace-enclosed initializers.
- * cp-tree.h (CP_AGGREGATE_TYPE_P): New macro.
- (initialize_local_var): Remove declaration.
- (expand_static_init): Likewise.
- * decl.c (next_initializable_field): New function.
- (reshape_init): Likewise.
- (check_initializer): Use them. Build dynamic initializer for
- aggregates here too.
- (initialize_local_var): Simplify, and incorporate cleanup
- insertion code as well.
- (destroy_local_var): Remove.
- (cp_finish_decl): Tidy.
- (expand_static_init): Fold checks for whether or not a variable
- needs initialization into this function. Simplify.
- * decl2.c (do_static_initialization): Simplify.
- * init.c (build_init): Do not set TREE_SIDE_EFFECTS when it will
- be done for us automatically.
- (expand_default_init): Handle brace-enclosed initializers
- correctly.
- (expand_aggr_init_1): Remove RTL-generation code.
- (build_vec_init): Remove "new X = ..." support.
- * parse.y (new_initializer): Likewise.
- * rtti.c (get_pseudo_ti_init): Set TREE_HAS_CONSTRUCTOR on
- brace-enclosed initializer.
- (create_pseudo_type_info): Likewise.
- * typeck2.c (store_init_value): Don't try to handle digest_init
- being called more than once.
- (digest_init): Tidy handling of brace-enclosed initializers.
+ PR c++/13683
+ * call.c (convert_arg_to_ellipsis): Don't emit a warning if within
+ a sizeof expression.block
-2002-10-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2004-01-29 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * decl.c (typename_hash): Use htab_hash_pointer.
+ * parser.c (cp_parser_template_id): Parse tentatively `[:' after a
+ template name as it was `<::' (digraph typo).
+ (cp_parser_nth_token_starts_template_argument_list_p): New function.
+ (cp_parser_id_expression): Use it.
+ (cp_parser_nested_name_specifier_opt): Likewise.
+ (cp_parser_template_name): Likewise.
+ (cp_parser_class_name): Likewise.
+ (cp_lexer_get_preprocessor_token): Use c_lex_with_flags.
-2002-10-10 Jim Wilson <wilson@redhat.com>
+2004-01-29 Mark Mitchell <mark@codesourcery.com>
- * decl.c (duplicate_decls): Don't call decl_attributes.
+ PR c++/13883
+ * mangle.c (write_encoding): Correct encoding of member template
+ constructors.
-2002-10-09 Zack Weinberg <zack@codesourcery.com>
+2004-01-28 Mark Mitchell <mark@codesourcery.com>
- PR c/7353
- * decl.c (start_decl): Unconditionally issue error for
- 'typedef foo = bar'.
- (cp_finish_decl): Remove special case for TYPE_DECL with initializer.
- (grokdeclarator): Remove redundant error for 'typedef foo = bar'.
+ PR c++/13791
+ * typeck.c (merge_types): Do not merge attributes into
+ TYPENAME_TYPEs.
-2002-10-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2004-01-28 Mark Mitchell <mark@codesourcery.com>
- * decl2.c (prune_vtable_vardecl): Delete unused function.
+ PR c++/13736
+ * parser.c (cp_parser_direct_declarator): Do not prevent
+ backtracking inside a parenthesized declarator.
+ (cp_parser_parameter_declaration): Fix typo in comment.
-2002-10-03 Mark Mitchell <mark@codesourcery.com>
+2004-01-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- PR c++/7754
- * decl2.c (finish_anon_union): Do not expand anonymous unions when
- procesing template functions.
- * pt.c (tsubst_decl, case VAR_DECL): Try to complete the variable
- type. Call layout_decl.
- (tsubst_expr, case DECL_STMT): Handle anonymous unions.
+ * cp-tree.h (language_function, lang_type_header): Use
+ BOOL_BITFIELD.
+ * name-lookup.h (cp_binding_level): Likewise.
-2002-10-07 Richard Henderson <rth@redhat.com>
+2004-01-26 Mark Mitchell <mark@codesourcery.com>
- * decl2.c, pt.c: Revert c++/7754 fix.
+ PR c++/13663
+ * semantics.c (finish_for_expr): Check for unresolved overloaded
+ functions.
-2002-10-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+2004-01-26 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (add_method): Just check processing_template_decl to
+ determine whether or not we are within a template.
+ * decl2.c (maybe_retrofit_in_chrg): Likewise.
+ * init.c (decl_constant_value): Check the type of the declaration,
+ not TREE_READONLY.
+ * name-lookup.c (maybe_push_to_top_level): Rename to ...
+ (push_to_top_level): ... this.
+ * name-lookup.h (maybe_push_to_top_level): Do not declare it.
+ * pt.c (push_template_decl_real): Reorder condition for speed.
+ (convert_template_argument): Use dependency-checking functions in
+ place of uses_template_parms.
+ (lookup_template_class): Avoid calling uses_template_parms more
+ than once.
+ (uses_template_parms): Reimplement, using dependency-checking
+ functions.
+ (instantiate_class_template): Use push_to_top_level, not
+ maybe_push_to_top_level.
+ (type_unification_real): Simplify.
+ (type_dependent_expression_p): Handle OFFSET_REFs and
+ TEMPLATE_DECLs.
+ (any_dependent_template_arguments_p): Handle multiple levels of
+ template argument.
+ * semantics.c (expand_or_defer_fn): Do not check
+ uses_template_parms for template instantiations.
+ * typeck.c (comptypes): Avoid calling cp_type_quals.
+
+2004-01-25 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/13833
+ * call.c (build_over_call): Do not convert arguments when
+ processing a template.
+ * pt.c (build_non_dependent_expr): Do not build a
+ NON_DEPENDENT_EXPR for arithmetic constants.
- PR c++/7804
- * error.c (dump_expr) [REAL_CST]: Output in decimal format.
+2004-01-25 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2002-10-03 Mark Mitchell <mark@codesourcery.com>
+ PR c++/13810
+ * parser.c (cp_parser_type_parameter): When cp_parser_id_expression
+ returns a TYPE_DECL. no further lookup is required.
+ * semantics.c (check_template_template_default_arg): A TYPE_DECL
+ is invalid. Rework to give better diagnostics.
- PR c++/7931
- * pt.c (for_each_template_parm_r): Handle BASELINKs.
+2004-01-25 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- PR c++/7754
- * decl2.c (finish_anon_union): Do not expand anonymous unions when
- procesing template functions.
- * pt.c (tsubst_decl, case VAR_DECL): Try to complete the variable
- type. Call layout_decl.
- (tsubst_expr, case DECL_STMT): Handle anonymous unions.
+ PR c++/13797
+ * pt.c (instantiate_class_template): Add an error_mark_node
+ check.
+ (tsubst_decl) <TEMPLATE_DECL case>: Likewise.
-2002-10-03 Mark Mitchell <mark@codesourcery.com>
+2004-01-24 Kazu Hirata <kazu@cs.umass.edu>
- PR c++/8006
- * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Handle instances of template
- template parameters.
- (globals): Add entity and need_abi_warning.
- (decl_is_template_id): Use TYPE_TEMPLATE_INFO, not
- CLASSTYPE_TEMPLATE_INFO.
- (is_std_substitution): Use CLASSTYPE_TI_TEMPLATE, not
- TYPE_TI_TEMPLATE.
- (write_prefix): Handle typename types correctly.
- (write_template_prefix): Handle template template parameters
- correctly.
- (start_mangling): Add entity parameter.
- (finish_mangling): Warn about names whose mangling will change.
- (mangle_decl_string): Adjust.
- (mangle_type_string): Likewise.
- (mangle_special_for_type): Likewise.
- (mangle_ctor_vtbl_for_type): Likewise.
- (mangle_thunk): Likewise.
- (mangle_guard_variable): Likewise.
- (mangle_ref_init_variable): Likewise.
-
-2002-10-02 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/7188.
- * cp-tree.def (CTOR_INITIALIZER): Use one slot, not two.
- * cp-tree.h (emit_base_init): Rename to ....
- (emit_mem_initializers): ... this.
- (expand_member_init): Change prototype.
- * init.c (perform_member_init): Compute explicit, rather than
- requiring it as a parameter.
- (sort_member_init): Rename to ...
- (sort_mem_initializers): ... this. Process bases and data members
- together.
- (sort_base_init): Remove.
- (emit_base_init): Rename to ...
- (emit_mem_initializers): ... this.
- (expand_aggr_vbase_init_1): Remove.
- (construct_virtual_bases): Rename to ...
- (construct_virtual_base): ... this.
- (expand_member_init): Rework handling of base initializers.
- * method.c (do_build_copy_constructor): Use
- finish_mem_initializers.
- * parse.y (member_init): Adjust calls to expand_member_init.
- * pt.c (tsubst_expr): Simplify CTOR_INITIALIZER case.
- (tsubst_initializer_list): Use expand_member_init.
- * semantics.c (finish_mem_intiailizers): Simplify.
-
-2002-10-02 Matt Austern <austern@apple.com>
- * decl.c (walk_vtables_r): Fixed typo that caused result to
- never get a nonzero value.
-
-2002-10-02 Roger Sayle <roger@eyesopen.com>
-
- PR optimization/6627
- * cp-tree.h (enum ptrmemfunc_vbit_where_t): Delete definition
- from here, and move it to tree.h.
- * decl.c (cxx_init_decl_processing): If storing the vbit
- in function pointers, ensure that force_align_functions_log
- is atleast one.
-
-2002-10-02 Matt Austern <austern@apple.com>
-
- * class.c (check_field_decls): Changed warning about const member
- variables so that it doesn't get issued for a class aggregate.
-
-2002-10-01 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (cp_finish_decl): Make sure array types are laid out,
- even if the array bounds are unknown.
-
-2002-10-01 Steve Ellcey <sje@cup.hp.com>
-
- * class.c (build_vtbl_initializer): Change build_c_cast
- to build1.
-
-2002-10-01 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (cp_finish_decl): Make sure array types are laid out,
- even if the array bounds are unknown.
-
- * decl.c (cp_finish_decl): Correct check for dynamic
- initialization of thread-local storage.
-
-2002-09-30 Nathan Sidwell <nathan@codesourcery.com>
-
- * tree.c (really_overloaded_fn): TEMPLATE_ID_EXPRs are also
- overloaded.
-
-2002-09-30 Steve Ellcey <sje@cup.hp.com>
-
- * class.c (build_vtbl_initializer): Add cast.
- (add_vcall_offset_vtbl_entries_1):
- Use TARGET_VTABLE_DATA_ENTRY_DISTANCE for offset.
-
-2002-09-30 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (walk_subobject_offsets): Correct the calculation of
- offsets for virtual bases. Correct the counting of array
- elements.
- (layout_nonempty_base_or_field): Simplify. Correct the
- calculation of offsets to be propagated through the binfo
- hierarchy.
- (build_base_field): Avoid creating a FIELD_DECL for empty bases.
- Add the FIELD_DECL to TYPE_FIELDS.
- (build_base_fields): Adjust accordingly.
- (layout_virtual_bases): Use build_base_field.
- (end_of_class): Return a tree, not an integer.
- (warn_about_ambiguous_direct_bases): Rename to ...
- (warn_about_ambiguous_bases): ... this.
- (include_empty_classes): New function.
- (layout_class_type): Create an alternative version of the type to
- be used when as a base class type. Do not call
- finish_record_layout until we are done laying out the class.
- * cp-tree.h (lang_type_class): Remove size, size_unit. Add
- as_base.
- (CLASSTYPE_SIZE): Reimplement.
- (CLASSTYPE_SIZE_UNIT): Likewise.
- (CLASSTYPE_ALIGN): Likweise.
- (CLASSTYPE_USER_ALIGN): Likewise.
- (CLASSTYPE_AS_BASE): New macro.
- (DECL_INITIALIZED_P): Likewise.
- (extract_init): Remove prototype.
- (build_forced_zero_init): Rename to ...
- (build_zero_init): ... this.
- (force_store_init_value): Remove.
- * decl.c (obscure_complex_init): Remove.
- (duplicate_decls): Copy DECL_INITIALIZED_P.
- (check_initializer): Do not leave junk in DECL_INITIAL.
- (cp_finish_decl): Handle zero-initialization of entities with
- static storage duration.
- * expr.c (extract_init): Remove.
- * init.c (build_forced_zero_init): Remove.
- (build_zero_init): New function.
- (build_default_init): Use it.
- (build_field_list): Skip FIELD_DECLs for base subobjects.
- (push_base_cleanups): Likewise.
- * method.c (do_build_assign_ref): Likewise.
- (synthesize_exception_spec): Likewise.
- * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P.
- (regenerate_decl_from_template): To not set DECL_INITIAL for a
- static data member whose initialization took place in its class.
- (instantiate_decl): Do not pass an initializer to cp_finish_decl
- in that situation.
- * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects.
- (dfs_unuse_fields): Likewise.
- * tree.c (pod_type_p): Handle error_mark_node.
- (zero_init_p): Likewise.
- * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base
- subobjects.
- * typeck2.c (store_init_value): Remove #if 0'd code.
- (force_store_init_value): Remove.
- (process_init_constructor): Use build_zero_init.
-
-2002-09-29 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/7788
- * rtti.c (unemitted_tinfo_decl_p): Check it has a field.
-
-2002-09-29 Kazu Hirata <kazu@cs.umass.edu>
-
- * cp-tree.h: Fix comment typos.
- * decl.c: Likewise.
- * pt.c: Likewise.
-
-2002-09-25 Mark Mitchell <mark@codesourcery.com>
-
- * cp/class.c (contains_empty_class_p): New method.
- (walk_subobject_offsets): Correct computation of field offset.
- (layout_empty_base): Correct placement of emtpy base classes.
- (layout_class_type): Warn about ABI changes.
-
-2002-09-23 Mark Mitchell <mark@codesourcery.com>
-
- * cp/class.c (layout_virtual_bases): Do not round the size of the
- type to a multiple of the alignment before laying out virtual bases.
- (layout_class_type): Correct handling of bit-fields that are wider
- than their type inside unions. Round the size of the type to a
- even number of bytes when computing the size without virtual
- bases.
- * cp/cp-tree.h (abi_version_at_least): New macro.
-
-2002-09-21 Kazu Hirata <kazu@cs.umass.edu>
-
- * ChangeLog: Follow spelling conventions.
- * ChangeLog.2: Likewise.
- * call.c: Likewise.
+ * call.c: Update copyright.
* class.c: Likewise.
- * cp-tree.h: Likewise.
- * cvt.c: Likewise.
- * decl.c: Likewise.
* decl2.c: Likewise.
* except.c: Likewise.
- * friend.c: Likewise.
- * g++spec.c: Likewise.
- * init.c: Likewise.
- * lex.c: Likewise.
- * mangle.c: Likewise.
- * method.c: Likewise.
- * operators.def: Likewise.
- * optimize.c: Likewise.
- * pt.c: Likewise.
- * rtti.c: Likewise.
- * search.c: Likewise.
- * semantics.c: Likewise.
- * spew.c: Likewise.
- * tree.c: Likewise.
- * typeck.c: Likewise.
-
-2002-09-18 Devang Patel <dpatel@apple.com>
-
- * cp/cp-tree.h: New prototype for walk_vtabls().
- * cp/decl.c (walk_vtables_r): New function.
- (struct cp_binding_level): Add new members, namespaces,
- names_size and vtables.
- (add_decl_to_level): Add decl in namespaces or vtables
- chain, if conditions match.
- (walk_vtables): New function.
- (walk_namespaces_r): Travers separate namespace chain
- for namespace decls.
- (wrapup_globals_for_namespace): Use names_size instead
- of list_length().
- * cp/decl2.c (finish_file): Use walk_vtables() instead of
- walk_globals() to walk vtable decls.
-
-2002-09-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (grokdeclarator): Use assert, not internal_error. Don't
- ICE with invalid pointers & references.
-
-2002-09-17 Zack Weinberg <zack@codesourcery.com>
-
- * Make-lang.in: Remove all references to the demangler.
- * cxxfilt.c: Moved to binutils.
-
-2002-09-16 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/7718
- * pt.c (tsubst_decl): Remove assert.
-
- Remove DR 295 implementation.
- * pt.c (check_cv_quals_for_unify): Disable function & method cases.
- * tree.c (cp_build_qualified_type_real): Likewise. Don't warn
- about ignoring volatile qualifiers.
-
- * search.c (lookup_member): Correct documentation.
-
-2002-09-16 Geoffrey Keating <geoffk@apple.com>
-
- * cp-tree.h (union lang_tree_node): Add chain_next option.
-
-2002-09-16 Nathan Sidwell <nathan@codesourcery.com>
-
- * parse.y (parse_finish_call_expr): Check lookup_member result.
-
- PR c++/7015
- * semantic.c (finish_asm_stmt): Fix operand/output_operands
- thinko.
- * typeck.c (c_expand_asm_operands): Protect from error_mark_node.
-
-2002-09-15 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/7919
- * call.c (build_over_call): Convert this pointer for fns found by
- using decls.
-
-2002-09-15 Kazu Hirata <kazu@cs.umass.edu>
-
- * ChangeLog: Follow spelling conventions.
- * ChangeLog.1: Likewise.
-
-2002-09-14 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/7768
- * pt.c (build_template_decl): Copy DECL_DESTRUCTOR_P.
-
-2002-09-14 Kazu Hirata <kazu@cs.umass.edu>
-
- * error.c: Fix comment formatting.
- * except.c: Likewise.
* expr.c: Likewise.
- * friend.c: Likewise.
- * g++spec.c: Likewise.
* init.c: Likewise.
- * lex.c: Likewise.
* mangle.c: Likewise.
- * method.c: Likewise.
* optimize.c: Likewise.
- * pt.c: Likewise.
- * rtti.c: Likewise.
- * search.c: Likewise.
- * semantics.c: Likewise.
- * spew.c: Likewise.
- * tree.c: Likewise.
* typeck.c: Likewise.
* typeck2.c: Likewise.
-2002-09-13 Matt Austern <austern@apple.com>
-
- PR C++/7828
- * cp/cp-tree.h, cp/tree.c: New function non_cast_lvalue_p.
- * cp/call.c: Change call-by-const-reference mechanism to use
- non_cast_lvalue_p when deciding whether the create a temporary.
- We need a temporary when passing, e.g. (long) x by const ref.
-
-2002-09-13 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (unify, ARRAY_TYPE): Element type can be more qualified.
-
-2002-09-13 Kazu Hirata <kazu@cs.umass.edu>
-
- * decl.c: Fix comment formatting.
- * decl2.c: Likewise.
-
-2002-09-12 Kazu Hirata <kazu@cs.umass.edu>
+2004-01-23 Andrew Pinski <pinskia@physics.uc.edu>
- * call.c: Fix comment formatting.
- * class.c: Likewise.
- * cp-lang.c: Likewise.
- * cp-tree.h: Likewise.
- * cvt.c: Likewise.
-
-2002-09-11 Zack Weinberg <zack@codesourcery.com>
-
- * Make-lang.in: Build cp/cxxfilt.o from $(srcdir)/cp/cxxfilt.c,
- and c++filt from cxxfilt.o + version.o + $(LIBDEPS).
- * cxxfilt.c: New file: split from libiberty/cplus-dem.c, with
- minor adjustments (use version_string, eliminate yet another
- duplicate of xmalloc)
-
-2002-09-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ PR c++/13701
+ * decl.c (finish_function): Move the call to
+ finish_fname_decls below the call to
+ finish_eh_spec_block.
- * cp-tree.h (require_complete_eh_spec_types): Add prototype.
+2004-01-21 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
-2002-09-05 Jason Merrill <jason@redhat.com>
+ * parser.c (cp_parser_class_specifier): Prevent garbage collection.
- * typeck2.c (add_exception_specifier): Only pedwarn for an
- incomplete type.
- (require_complete_eh_spec_types): New fn.
- (cxx_incomplete_type_diagnostic): Also support pedwarning.
- * typeck.c (complete_type_or_diagnostic): Likewise.
- * call.c (build_call): Call require_complete_eh_spec_types.
- * rtti.c (get_pseudo_ti_desc): Give an error rather than aborting
- on an incomplete type.
+2004-01-20 Kelley Cook <kcook@gcc.gnu.org>
-2002-09-04 Jakub Jelinek <jakub@redhat.com>
+ * Make-lang.in: Replace $(docdir) with doc.
+ (c++.info, c++.srcinfo): Dummy entry.
+ (c++.man, c++.srcman): New rules.
+ (c++.install-man): Revamp rule.
- * decl.c (start_cleanup_fn): Clear interface_only before
- start_function, restore it afterwards.
+2004-01-19 Kelley Cook <kcook@gcc.gnu.org>
-2002-08-31 Jason Merrill <jason@redhat.com>
+ * Make-lang.in (CXX_INSTALL_NAME, GXX_INSTALL_NAME,
+ CXX_TARGET_INSTALL_NAME, GXX_TARGET_INSTALL_NAME): Define via a
+ immediate $(shell) instead of deferred backquote.
- * cp-lang.c (cp_expr_size): Allow initialization from a
- CONSTRUCTOR.
+2004-01-19 Mark Mitchell <mark@codesourcery.com>
-2002-08-30 Richard Henderson <rth@redhat.com>
+ PR c++/13651
+ * parser.c (cp_parser_postfix_expression): When encountering
+ incomplete type on left-hand side of "->" or ".", treat the entire
+ expression as erroneous.
- PR opt/7515
- * tree.c: Include target.h.
- (cp_cannot_inline_tree_fn): Don't auto-inline functions that
- don't bind locally.
- * Makefile.in (tree.o): Update.
+2004-01-19 Mark Mitchell <mark@codesourcery.com>
-2002-08-27 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (layout_virtual_bases): Warn about bugs in G++ that
- result in incorrect object layouts.
- (layout_class_type): Likewise.
+ PR c++/13592
+ * call.c (build_field_call): Remove.
+ (n_build_method_call): Likewise.
+ (build_method_call): Likewise.
+ (build_new_method_call): Do not call build_field_call.
+ * class.c (n_build_method_call): Remove.
+ (print_class_statistics): Do not print it.
+ * cp-tree.h (build_method_call): Remove declaration.
+ (finish_object_call_expr): Likewise.
+ (build_new_1): Do not use build_method_call.
+ * parser.c (cp_parser_postfix_expression): Use finish_call_expr
+ when the function appearing on the right-hand-side of "." or "->"
+ is not actually a function.
+ * pt.c (tsubst_copy_and_build): Likewise.
+ * semantics.c (finish_object_call_expr): Remove.
-2002-08-24 Matt Austern <austern@apple.com>
+2004-01-18 Mark Mitchell <mark@codesourcery.com>
- * tree.c (lvalue_p_1): Add argument for whether casts of lvalues
- are allowable.
- (real_lvalue_p): Update caller.
- (lvalue_p): Ditto.
- (non_cast_lvalue_or_else): New.
- * tree.h: Declare it.
- * typeck.c (build_unary_op): Use non_cast_lvalue_or_else.
+ PR c++/13710
+ * pt.c (tsubst): Use finish_typeof.
-2002-08-22 Mark Mitchell <mark@codesourcery.com>
+2004-01-18 Jason Merrill <jason@redhat.com>
- * typeck.c (build_class_member_access_expr): Handle COMPOUND_EXPR
- and COND_EXPR specially; fix error message output.
+ PR c++/11725
+ * except.c (build_throw): In a template, set
+ current_function_returns_abnormally.
-2002-08-22 Jason Merrill <jason@redhat.com>
+2004-01-17 Fred Fish <fnf@intrinsity.com>
- * pt.c (tsubst_expr): RETURN_EXPR is now RETURN_STMT_EXPR.
- * semantics.c (nullify_returns_r): Likewise.
+ PR c++/11895
+ * decl.c (reshape_init): Handle VECTOR_TYPE like ARRAY_TYPE,
+ except don't call array_type_nelts() with a VECTOR_TYPE.
-2002-08-17 Gabriel Dos Reis <gdr@integrable-solutions.net>
+2004-01-16 Jan Hubicka <jh@suse.cz>
- Fix PR/7621
- * typeck.c (finish_class_member_access_expr): Diagnose cases where
- name lookup finds nothing.
+ * mangle.c (write_mangled_name): Remove inline modifier.
-2002-08-15 Jason Merrill <jason@redhat.com>
+2004-01-16 Mark Mitchell <mark@codesourcery.com>
- * semantics.c (finish_then_clause): Remove redundant assignment.
- (finish_if_stmt, begin_switch_stmt, finish_switch_stmt): Move the
- extra binding level outside the if/switch statement.
- (finish_while_cond, finish_for_cond): Rewrite complex condition
- into the loop body.
-
-2002-08-15 Alexandre Oliva <aoliva@redhat.com>
-
- * parse.y (sizeof, alignof, typeof): New non-terminals to
- increment skip_evaluation. Replace terminals with them and
- decrement skip_evaluation at the end of rules using them.
- * decl2.c (mark_used): Don't assemble_external if
- skipping evaluation.
-
-2002-08-15 Gabriel Dos Reis <gdr@nerim.net>
+ PR c++/13574
+ * decl.c (compute_array_index_type): Fix grammar in comment.
+ * init.c (build_zero_init): Handle zero-sized arrays correctly.
- Fix PR/7504
- * parse.y (parse_finish_call_expr): Handle incomplete
- type used to name a scope.
+ PR c++/13178
+ * call.c (name_as_c_string): Print conversion operator names
+ correctly.
-2002-08-15 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/13478
+ * call.c (initialize_reference): Pass -1 for inner parameter to
+ convert_like_real.
- PR c++/7598
- * typeck.c (build_unary_op): Fold offsetof idiom. Fixes
- regression caused by my 2002-08-08 patch.
+2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2002-08-13 Mark Mitchell <mark@codesourcery.com>
+ PR c++/13407
+ * parser.c (cp_parser_base_specifier): Check for an invalid
+ keyword `typename' and emit an user-friendly error message.
- * decl.c (pushdecl_class_level): Honor requests to bind names to
- OVERLOADs.
+2004-01-15 Geoffrey Keating <geoffk@apple.com>
-2002-08-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ PR pch/13361
+ * cp/lex.c (handle_pragma_interface): Duplicate string from tree.
+ (handle_pragma_implementation): Likewise.
- * decl2.c (build_call_from_tree): Fix uninitialized variable.
- * parse.y (parse_finish_call_expr): Likewise.
- * repo.c (old_args, old_dir, old_main): Const-ify.
+2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2002-08-11 Gabriel Dos Reis <gdr@nerim.net>
-
- * decl.c (duplicate_decls): Replace DECL_SOURCE_FILE +
- DECL_SOURCE_LINE with DECL_SOURCE_LOCATION.
- * optimize.c (maybe_clone_body): Likewise.
- * pt.c (tsubst_enum): Likewise.
- (lookup_template_class): Likewise.
- * tree.c (cp_copy_res_decl_for_inlining): Likewise.
-
-2002-08-10 Neil Booth <neil@daikokuya.co.uk>
-
- * lang-specs.h: Remove -ansi.
-
-2002-08-10 Nathan Sidwell <nathan@codesourcery.com>
-
- * tree.c (maybe_dummy_object): Replace // with /* */
-
-2002-08-09 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (standard_conversion): Use build_ptrmem_type.
- * cp-tree.h (build_ptrmem_type): New function.
- (adjust_result_of_qualified_name_lookup): Likewise.
- * decl.c (grokvardecl): Do not look for OFFSET_TYPEs to indicate
- static data members.
- (build_ptrmem_type): New function.
- (grokdeclarator): Do not use build_offset_type when encountering a
- qualified name.
- * parse.y (parse_finish_call_expr): Use
- adjust_result_of_qualified_name_lookup.
- * search.c (adjust_result_of_qualified_name_lookup): New function.
- * typeck.c (qualify_type_recursive): Use TYPE_PTRMEM_* rather than
- accessing OFFSET_TYPEs directly.
-
-2002-08-08 Mike Stump <mrs@apple.com>
-
- * call.c (add_builtin_candidate): legal -> valid, illegal -> invalid.
- (type_decays_to): Likewise.
- * class.c (find_final_overrider): Likewise.
- (maybe_note_name_used_in_class): Likewise.
- * decl.c (current_tmpl_spec_kind): Likewise.
- (add_binding): Likewise.
- (push_class_binding): Likewise.
- (duplicate_decls): Likewise.
- (layout_var_decl): Likewise.
- (grokfndecl): Likewise.
- (grokdeclarator): Likewise.
- (check_default_argument): Likewise.
- * decl2.c (handle_class_head): Likewise.
- * error.c (dump_template_decl): Likewise.
- * init.c (build_offset_ref): Likewise.
- * pt.c (check_specialization_scope): Likewise.
- (determine_specialization): Likewise.
- (check_explicit_specialization): Likewise.
- (maybe_check_template_type): Likewise.
- (process_partial_specialization): Likewise.
- (check_default_tmpl_args): Likewise.
- (push_template_decl_real): Likewise.
- (convert_template_argument): Likewise.
- (try_class_unification): Likewise.
- (get_bindings_real): Likewise.
- (do_decl_instantiation): Likewise.
- * semantics.c (begin_function_definition): Likewise.
- (finish_member_declaration): Likewise.
- (check_multiple_declarators): Likewise.
- * typeck.c (comp_array_types): Likewise.
- (comptypes): Likewise.
- (expr_sizeof): Likewise.
- (build_binary_op): Likewise.
- (dubious_conversion_warnings): Likewise.
- (check_return_expr): Likewise.
-
-2002-08-08 Mark Mitchell <mark@codesourcery.com>
-
- * typeck.c (build_class_member_access_expr): Do not return
- error_mark_node when no error has occurred.
-
-2002-08-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck.c (build_component_addr): Remove.
- (build_unary_op): Just check it's not a bitfield, and then build
- an ADDR_EXPR.
-
-2002-08-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (convert_to_base): Correct check for error_mark_node.
- (create_vtable_ptr): Remove unused VFUNS_P parm.
-
-2002-08-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * cp/Make-lang.in (c++.mostlyclean): Remove coverage files.
-
-2002-08-07 Mark Mitchell <mark@codesourcery.com>
-
- Rework build_component_ref.
- * call.c (build_vfield_ref): Do not go through build_component_ref.
- (build_field_call): Use build_class_member_access_expr.
- (build_user_type_conversion_1): Use BASELINK_FUNCTIONS.
- (build_object_call): Likewise.
- * class.c (convert_to_base): New function.
- (type_requires_array_cookie): Use BASELINK_FUNCTIONS.
- (instantiate_type): Handle BASELINKs.
- * cp-tree.def (BASELINK): New tree code.
- * cp-tree.h (BASELINK_P): Reimplement.
- (SET_BASELINK_P): Remove.
- (BASELINK_BINFO): Reimplement.
- (BASELINK_FUNCTIONS): Likewise.
- (BASELINK_ACCESS_BINFO): Likewise.
- (BASELINK_OPTYPE): Likewise.
- (convert_to_base): New function.
- (name_p): Likewise.
- (build_object_ref): Remove.
- (build_component_ref_1): Likewise.
- (build_component_ref): Likewise.
- (build_x_component_ref): Likewise.
- (build_class_member_access_expr): New function.
- (finish_class_member_access_expr): Likewise.
- (build_ptrmemfunc_access_expr): Likewise.
- * decl.c (grokdeclarator): Handle BASELINKs.
- * decl2. (build_expr_from_tree): Handle COMPONENT_REFs by using
- finish_class_member_access_expr.
- (arg_assoc): Handle BASELINKs.
- (do_class_using_decl): Likewise.
- * error.c (dump_decl): Likewise.
- (dump_expr): Use build_ptrmemfunc_access_expr.
- * except.c (dtor_nothrow): Use CLASSTYPE_DESTRUCTORS to find
- destructors.
- (build_throw): Use BASELINK_FUNCTIONS.
- * init.c (perform_member_init): Use
- build_class_member_access_expr.
- (build_offset_ref): Handle BASELINKs. Use
- build_class_member_access_expr.
- * method.c (hack_identifier): Likewise.
- * parse.y (do_id): Use BASELINK, not TREE_LIST.
- (primary): Remove uses of build_object_ref.
- * pt.c (lookup_template_function): Handle BASELINKs.
- (resolve_overloaded_unification): Likewise.
- * search.c (build_baselink): Build a BASELINK, not a TREE_LIST.
- (lookup_field): Use BASELINK, not TREE_LIST.
- (lookup_fnfiels): Likewise.
- (setup_class_bindings): Likewise.
- * semantics.c (finish_object_call_expr): Do not use
- build_method_call when we already know what function is being
- called.
- * spew.c (identifier_type): Use BASELINK, not TREE_LIST.
- * tree.c (really_overloaded_fn): Use OVL_CHAIN for OVERLOADs, not
- TREE_CHAIN.
- (name_p): New function.
- * typeck.c (build_object_ref): Remove.
- (build_component_ref_1): Likewise.
- (build_x_component_ref): Likewise.
- (build_class_member_access_expr): New function.
+ PR c++/9259
+ * typeck.c (build_class_member_access_expr): Allow to access members
+ of the currently open class.
(finish_class_member_access_expr): Likewise.
- (build_ptrmemfunc_access_expr): Likewise.
- (get_member_function_from_ptrfunc): Use
- build_ptrmemfunc_access_expr.
- (build_binary_op): Likewise.
- (build_unary_op): Likewise.
- (build_ptrmemfunc): Likewise.
- (pfn_from_ptrmemfunc): Likewise.
- * typeck2.c (build_m_component_ref): Adjust comment.
-
-2002-08-07 Neil Booth <neil@daikokuya.co.uk>
-
- * Make-lang.in (CXX_C_OBJS): Update.
- * cp-lang.c (LANG_HOOKS_DECODE_OPTION): Use c_common_decode_option.
- * cp-tree.h (cxx_decode_option): Remove.
- * decl2.c (compare_options, lang_f_options, unsupported_options,
- cxx_decode_option): Remove.
-
-2002-08-06 Gabriel Dos Reis <gdr@nerim.net>
-
- * typeck.c (build_x_unary_op): Handle pointer-to-member.
-
-2002-08-05 Geoffrey Keating <geoffk@redhat.com>
-
- * class.c: Don't include obstack.h.
- (popclass):
- * decl2.c: Delete bogus comment.
- * error.c: Don't include obstack.h.
- * except.c: Likewise.
- (dump_type): Correct comment.
- * method.c: Don't include obstack.h.
- * tree.c: Likewise.
-
-2002-08-04 Gabriel Dos Reis <gdr@nerim.net>
-
- Fix PR/2213
- * cvt.c (cp_convert_to_pointer): Reject conversions from integral
- expressions to pointer-to-data-member of pointer-to-member-functions.
-
-2002-08-04 Geoffrey Keating <geoffk@redhat.com>
-
- * cvt.c (ocp_convert): Delete obsolete code.
- * parse.y (permanent_obstack): Delete declaration.
- * pt.c (permanent_obstack): Delete declaration.
- * repo.c (permanent_obstack): Delete declaration.
- (open_repo_file): Use xmalloc instead of permanent_obstack.
- (init_repo): Use xstrdup instead of permanent_obstack.
-
-2002-08-04 Nathan Sidwell <nathan@codesourcery.com>
-
- * cp-tree.h (VF_DERIVED_VALUE): Remove.
- * class.c (finish_struct_1): Use VF_BINFO_VALUE not VF_DERIVED_VALUE.
-
-2002-08-03 Nathan Sidwell <nathan@codesourcery.com>
-
- PR 7470.
- C++ ABI change - vfunc ordering.
- * class.c (add_virtual_function): Remove.
- (dfs_modify_all_vtables): Take list of all declared
- virtuals. Assign all that are not in primary base.
- (check_for_override): Adjust comments.
- (create_vtable_ptr): Take single list of virtuals. Build chain
- of declared virtuals here.
- (layout_class_type): Take single list of virtuals. Adjust.
- (finish_struct_1): Keep virtuals on single list. Adjust.
-
-2002-08-02 Mark Mitchell <mark@codesourcery.com>
-
- * init.c (build_member_call): Use build_new_method_call, not
- build_method_call.
-
-2002-08-02 Krister Walfridsson <cato@df.lth.se>
-
- * Make-lang.in (spew.o, lex.o, pt.o): Add path to parse.h dependencies.
-
-2002-08-02 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (build_method_call): Issue a more helpful error message
- about ambiguous method names.
-
-2002-08-02 Nathan Sidwell <nathan@codesourcery.com>
-
- * tree.c (build_shared_int_cst): Make cache file scope, and
- GTY it.
-
-2002-08-02 Jason Merrill <jason@redhat.com>
-
- * cp-lang.c (LANG_HOOKS_EXPR_SIZE): Define.
- (cp_expr_size): New fn.
- * call.c (build_over_call): Lose empty class hackery.
- (convert_arg_to_ellipsis): Promote non-POD warning to error.
- * typeck.c (build_modify_expr): Don't use save_expr on an lvalue.
-
- * semantics.c (expand_body): Do tree optimization in the function
- context, too.
-
-2002-08-01 Neil Booth <neil@daikokuya.co.uk>
-
- * cp-tree.h: Move all warning and flag declarations to c-common.h.
- * decl.c: Move all warning and flag variables to c-common.c.
- * decl2.c: Move all warning and flag variables to c-common.c.
- * lex.c (flag_digraphs): Remove.
- (warn_traditional): Now in c-common.c.
-
-2002-07-31 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (build_field_call): Do not look up the field by name.
- (build_method_call): Simplify.
- (struct z_candidate): Add access_path and conversion_path. Remove
- basetype_path.
- (convert_class_to_reference): Adjust use of
- add_function_candidate.
- (add_candidate): Add conversion_path argument.
- (add_function_candidate): Use it.
- (add_conv_dndidate): Likewise.
- (build_builtin_candidate): Likewise.
- (add_template_candidate_real): Add conversion_path argument.
- (add_template_conv_candidate): Likewise.
- (add_template_candidate): Likewise.
- (build_user_type_conversion_1): Use it.
- (build_new_function_call): Remove name lookup code. Adjust use of
- add_template_candidate and add_function_candidate.
- (build_new_op): Likewise.
- (convert_like_real): Use build_special_member_call.
- (build_over_call): Use cand->conversion_path.
- (build_special_member_call): New method.
- (build_new_method_call): Remove name lookup code.
- * cp-tree.def (OFFSET_REF): Update documentation.
- (TEMPLATE_ID_EXPR): Likewise.
- * cp-tree.h (BASELINK_ACCESS_BINFO): New macro.
- (BASELINK_OPTYPE): Likewise.
- (build_new_method_call): Adjust prototype.
- (build_special_member_call): New method.
- (build_baselink): New method.
- (build_offset_ref_call_from_tree): Likewise.
- (build_call_from_tree): Likewise.
- (finish_qualified_call_expr): Remove.
- (finish_call_expr): Adjust prototype.
- (build_x_function_call): Remove.
- * cvt.c (ocp_convert): Use build_special_member_call.
- * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr.
- (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and
- CALL_EXPR.
- (build_offset_ref_call_from_tree): New function.
- (build_call_from_tree): Likewise.
- * init.c (expand_cleanup): Use build_special_member_call.
- (expand_default_init): Likewise.
- (build_member_call): Use finish_call_expr.
- (build_new_1): Use build_special_member_call.
- (push_base_cleanups): Likewise.
- * method.c (do_build_assign_ref): Likewise.
- * parse.y (template_id): Do not pass a COMPONENT_REF to
- lookup_template_function.
- (primary): Use parse_finish_call_epxr, not finish_call_expr.
- (parse_finish_call_expr): New function.
- * pt.c (lookup_template_function): Add assertions.
- * search.c (lookup_base): Allow T to be a binfo.
- (build_baselink): New function.
- (lookup_member): Use it.
- * semantics.c (finish_call_expr): Do not do name lookup.
- (finish_object_call_expr): Remove #if 0'd code.
- (finish_qualified_call_expr): Remove.
- * typeck.c (build_x_function_call): Remove.
- (build_static_case): Use build_special_member_call.
- * typeck2.c (build_functional_cast): Likewise.
-
-2002-07-30 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
-
- * lang-specs.h: Remove __GXX_ABI_VERSION, moved to gcc.c.
-
-2002-07-30 Gabriel Dos Reis <gdr@nerim.net>
-
- * cp-tree.h (VF_DERIVED_VALUE): Restore from previous deletion.
-
-2002-07-30 Nathan Sidwell <nathan@codesourcery.com>
-
- * cp-tree.h (CLASSTYPE_VFIELDS, VF_*, BV_*): Add more
- documentation.
-
-2002-07-29 Alan Modra <amodra@bigpond.net.au>
-
- * cp-tree.h: Comment typo fix.
-
-2002-07-29 Richard Earnshaw <rearnsha@arm.com>
-
- * spew.c (space_for_token): Allocate zeroed memory for a new token
- chunk.
-
-2002-07-27 Roger Sayle <roger@eyesopen.com>
-
- * decl.c (builtin_function_1): No need to explicitly mark
- BUILT_IN_RETURN and BUILT_IN_EH_RETURN as noreturn.
-
-2002-07-27 Roger Sayle <roger@eyesopen.com>
-
- * decl2.c (cxx_decode_option): Support -fno-builtin-foo.
-
-2002-07-26 Jason Merrill <jason@redhat.com>
-
- * call.c (build_over_call): Likewise.
- (cp_convert_parm_for_inlining): New fn.
- (convert_for_arg_passing): New fn.
- (convert_default_arg, build_over_call): Use it.
- (type_passed_as): New fn.
- * pt.c (tsubst_decl): Use it.
- * decl2.c (cp_build_parm_decl): New fn.
- (build_artificial_parm): Use it.
- (start_static_storage_duration_function): Likewise.
- * decl.c (start_cleanup_fn, grokdeclarater): Likewise.
- (grokparms): Don't mess with DECL_ARG_TYPE.
- * typeck.c (convert_arguments): Use convert_for_arg_passing.
- * cp-lang.c (LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING):
- Define.
- * cp-tree.h: Declare new fns.
-
-2002-07-26 Neil Booth <neil@daikokuya.co.uk>
-
- * cp-tree.h (flag_operator_names): Remove.
- * decl2.c (flag_operator_names): Remove.
- (lang_f_options): Remove operator-names.
- * lex.c (D_OPNAME): Remove.
- (reswords): Remove operator names.
- (rid_to_yy): Remove operator names.
- (init_reswords): No need to handle D_OPNAME.
- * spew.c (read_process_identifier): There are no operator
- names.
-
-2002-07-26 Jason Merrill <jason@redhat.com>
-
- * dump.c (cp_dump_tree): Call c_dump_tree.
- * Make-lang.in (CXX_C_OBJS): Add c-dump.o.
-
-2002-07-25 Neil Booth <neil@daikokuya.co.uk>
-
- * error.c (print_whitespace): Remove.
- * g++spec.c (LIBUNWIND): Move.
- * mangle.c (mangled_position, write_signed_number): Remove.
-
-2002-07-25 Neil Booth <neil@daikokuya.co.uk>
-
- * decl2.c (cxx_decode_option): Similarly.
-
-2002-07-25 Gabriel Dos Reis <gdr@nerim.net>
-
- * cp-tree.h (cxx_sizeof_nowarn): Now a macro.
- (cxx_sizeof_or_alignof_type): Take a third argument.
- (cxx_sizeof): Adjust definition.
- (cxx_alignof): Likewise.
- * init.c (build_delete): Use cxx_sizeof_nowarn to reflect reality.
- * typeck.c (cxx_sizeof_or_alignof_type): Take a third argument for
- complaining.
- (c_sizeof_nowarn): Remove definition.
- (build_unary_op): Use cxx_sizeof_nowarn.
-
-2002-07-24 Geoffrey Keating <geoffk@redhat.com>
-
- * tree.c (cp_build_qualified_type_real): When copying
- pointer-to-method types, unshare the record that holds
- the cached pointer-to-member-function type.
-
-2002-07-23 Neil Booth <neil@daikokuya.co.uk>
-
- * cp-tree.h (FILE_FUNCTION_PREFIX_LEN): Remove.
-
-2002-07-23 Gabriel Dos Reis <gdr@nerim.net>
-
- Fix PR/7363:
- * typeck.c (cxx_sizeof_or_alignof_type): New function.
- (c_sizeof): Remove definition.
- (expr_sizeof): Use cxx_sizeof.
- * decl2.c (build_expr_from_tree): Use cxx_sizeof_or_alignof_type.
- * decl.c (finish_destructor_body): Use cxx_sizeof.
- * semantics.c (finish_alignof): Likewise.
- (finish_alignof): Use cxx_alignof.
- * cp-tree.h (cxx_sizeof, cxx_alignof): New macros.
- (cxx_sizeof_or_alignof_type): Declare.
- (my_friendly_assert): Move to ../c-common.h.
-
-2002-07-23 Neil Booth <neil@daikokuya.co.uk>
-
- * class.c, method.c, pt.c, search.c: Don't define obstack macros.
-
-2002-07-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/7347, c++/7348
- * cp-tree.h (tsubst_flags_t): Add tf_parsing.
- * decl.c (make_typename_type): Use it.
- (make_unbound_class_template): Likewise.
- (lookup_name_real): Don't call type_access_control if scope is
- template parameter dependent.
- * parse.y (template_arg): Call make_unbound_class_template with
- tf_parsing set.
- (nest_name_specifier): Call make_typename_type with tf_parsing set.
- (typename_sub0): Likewise.
- (typename_sub1): Likewise.
- (instantiate_decl): Push class scope.
- * pt.c (regenerate_decl_from_template): Call pushclass and popclass
- for both static variable and member function template.
- (instantiate_decl) Call pushclass and popclass when tsubst'ing type
- and arguments.
- * search.c (type_access_control): Do type access for TEMPLATE_DECL
- too.
-
-2002-07-20 Roger Sayle <roger@eyesopen.com>
-
- * decl2.c (cxx_decode_option): Simplify -fhandle-exceptions
- test by using positive_option. Make whitespace consistent.
-
-2002-07-20 Gabriel Dos Reis <gdr@nerim.net>
-
- * spew.c (struct unparsed_test): Replace 'filename' and 'lineno'
- members with 'locus'. Adjust use throughout.
- (struct feed): Likewise.
- (alloc_unparsed_test): Change prototype, take a 'const location_t *'.
- Adjust use.
- (snarf_defarg): Use error(), not error_with_file_and_line().
-
-2002-07-19 Chris Demetriou <cgd@broadcom.com>
-
- * lang-specs.h (@c++): Include "%2" (cc1plus_spec) wherever
- cpp_options is included.
-
-2002-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/2862, c++/2863
- * pt.c (determine_specialization): Compare the length of
- TYPE_ARG_TYPES. Tidy.
-
-2002-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/3797
- * decl.c (duplicate_decls): Don't propagate inlining parameters from
- olddecl to newdecl when newdecl is a specialization of the
- instantiation olddecl.
-
-2002-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/4802, c++/5387
- * decl.c (make_typename_type): Use enforce_access.
-
-2002-07-17 Scott Snyder <snyder@fnal.gov>
-
- PR c++/7320
- * rtti.c (get_tinfo_decl): Set DECL_COMDAT.
-
-2002-07-12 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (add_method): Correct handling of conversion operators.
-
-2002-07-11 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/7224
- * class.c (add_method): Simplify.
-
-2002-07-11 Jason Merrill <jason@redhat.com>
-
- PR c++/7279
- * tree.c (cp_copy_res_decl_for_inlining): Also copy
- TREE_ADDRESSABLE.
-
-2002-07-10 Graham Stott <graham.stott@btinternet.com>
-
- * pt.c (template_parm_this_level_p, push_template_decl_real):
- Pass depth as int pointer.
-
-2002-07-11 Tim Josling <tej@melbpc.org.au>
-
- Remove front end hard coding from gengtype.c.
-
- * config-lang.in (gtfiles): Add files needed for this front end.
-
-2002-07-10 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (unqualified_name_lookup_error): Declare it.
- (begin_function_definition): Adjust prototype.
- * lex.c (unqualified_name_lookup_error): New function, split out
- from ...
- (do_identifier): ... here.
- * parse.y (parse_begin_function_definition): New function.
- (fn.def1): Use it.
- * semantics.c (begin_function_definition): Accept decl-specifiers
- and attributes as separate parameters.
-
-2002-07-10 Jason Merrill <jason@redhat.com>
-
- PR c++/6255
- * decl.c (lookup_name_real): Build a new TYPENAME_TYPE rather than
- modifying the old one.
-
-2002-07-09 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (constructor_name_p): Declare it.
- (check_template_template_default_arg): Likewise.
- * class.c (handle_using_decl): Use constructor_name_p.
- * decl.c (grokdeclarator): Likewise.
- * decl2.c (constructor_name_p): Define it.
- * init.c (build_member_call): Use constructor_name_p.
- * parse.y (template_parm): Use check_template_template_default_arg.
- * pt.c (check_explicit_specialization): Use constructor_name_p.
- * semantics.c (check_template_template_default_arg): New function.
-
-2002-07-08 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (can_complete_type_without_circularity): Add static to
- function definition.
-
-2002-07-08 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (have_extern_spec): Declare it
- * decl.c (have_extern_spec): Define it.
- (start_decl): Eliminate use of used_extern_spec.
- (start_function): Likewise.
- * parse.y (have_extern_spec): Remove declaration.
- (used_extern_spec): Likewise.
- (frob_specs): Eliminate use of used_extern_spec.
- (.hush_warning): Likewise.
-
-2002-07-07 Mark Mitchell <mark@codesourcery.com>
-
- * Make-lang.in (cp/parse.o): Depend on decl.h.
- * cp-tree.h (do_decl_instantiation): Change prototype.
- * parse.y: Include decl.h.
- (parse_decl_instantiation): New function.
- (explicit_instantiation): Use it.
- * pt.c (do_decl_instantiation): Accept a DECL, not a DECLARATOR
- and DECLSPECS.
-
-2002-07-07 Roger Sayle <roger@eyesopen.com>
-
- * error.c (dump_function_name): Use DECL_TEMPLATE_RESULT for
- constructor and destructor tests when passed a TEMPLATE_DECL.
-
-2002-07-05 Jason Merrill <jason@redhat.com>
-
- * cvt.c (cp_convert_to_pointer): Call force_fit_type for null
- pointers.
-
- PR optimization/7145
- * tree.c (cp_copy_res_decl_for_inlining): Also copy DECL_INITIAL.
-
-2002-07-05 Nathan Sidwell <nathan@codesourcery.com>
-
- Repair damage on weak-impared targets caused by my previous patch.
- * cp-tree.h (import_export_tinfo): Add parameter.
- * decl2.c (import_export_tinfo): Add parameter, post adjust
- DECL_COMDAT.
- * rtti.c (emit_tinfo_decl): DECL_COMDAT is (nearly) always setup by
- import_export_tinfo.
-
-2002-07-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/6944
- * init.c (build_aggr_init): Remove qualifiers of init before calling
- build_vec_init.
- (build_vec_init): Flatten multi-dimensional array during cleanup.
- (build_vec_delete_1): Abort if the type of each element is array.
-
-2002-07-03 Graham Stott <graham.stott@btinternet.com>
-
- * pt.c (instantiate_class_template): Fix typo.
-
-2002-07-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * typeck2.c (cxx_incomplete_type_diagnostic): Fix typo caused
- by CVS conflict in my last patch.
-
-2002-07-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/6716
- * pt.c (can_complete_type_without_circularity): New function.
- (instantiate_class_template): Use it.
- * typeck2.c (cxx_incomplete_type_diagnostic): Improve error
- message due to incomplete fields.
-
-2002-07-01 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/7112
- * mangle.c (write_expression): Add mangling for sizeof when
- applied to a type.
- * operators.def: Remove stale comment.
-
-2002-06-30 Nathan Sidwell <nathan@codesourcery.com>
-
- * cp-tree.h (CPTI_TINFO_DECL_TYPE): Replace with ...
- (CPTI_TYPE_INFO_PTR_TYPE): ... this.
- (tinfo_decl_type): Replace with ...
- (type_info_ptr_type): ... this.
- (import_export_tinfo): Declare.
- (tinfo_decl_p): Rename to ...
- (unemitted_tinfo_decl_p): ... this.
- * decl2.c (import_export_decl): Break out tinfo handling into ...
- (import_export_tinfo): ... here. New function.
- (finish_file): Adjust.
- * rtti.c (TINFO_REAL_NAME): New macro.
- (init_rtti_processing): Create the tinfo types.
- (get_tinfo_decl_dynamic): Use type_info_ptr_type, get_tinfo_ptr.
- (get_tinfo_decl): Adjust.
- (get_tinfo_ptr): New function.
- (get_type_id): Use it.
- (tinfo_base_init): Create vtable decl here, if it doesn't exist.
- (ptr_initializer): Use get_tinfo_ptr.
- (ptm_initializer): Likewise.
- (synthesize_tinfo_var): Break into ...
- (get_pseudo_ti_init): ... this. Just create the initializer.
- (get_pseudo_ti_desc): .. and this.
- (create_real_tinfo_var): Remove.
- (create_pseudo_type_info): Don't create the vtable decl here.
- (get_vmi_pseudo_type_info): Remove.
- (create_tinfo_types): Adjust.
- (tinfo_decl_p): Rename to ...
- (unemitted_tinfo_decl_p): ... here. Adjust.
- (emit_tinfo_decl): Adjust. Create the initializer.
-
-2002-06-27 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/6695
- * pt.c (tsubst_friend_class): Substitute into the context of the
- friend before using it.
-
-2002-06-26 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (xref_tag): Change prototype.
- (handle_class_head): Likewise.
- (build_x_component_ref): Likewise.
- * decl.c (cxx_init_decl_processing): Adjust call to xref_tag.
- (xref_tag): Take attributes as a separate parameter.
- (xref_tag_from_type): Adjust call to xref_tag.
- * decl2.c (build_expr_from_tree): Adjust call to
- build_x_component_ref.
- (handle_class_head): Take attributes as a separate parameter.
- * parse.y (parse_xref_tag): New function.
- (parse_handle_class_head): Likewise.
- (primary): Use parse_xref_tag.
- (class_head_decl): Use parse_handle_class_head.
- (class_head_defn): Likewise.
- * rtti.c (init_rtti_processing): Adjust call to xref_tag.
- (build_dynamic_cast_1): Likewise.
- (create_pseudo_type_info): Likewise.
- (emit_support_tinfos): Likewise.
- * typeck.c (build_object_ref): Adjust call to
- build_x_component_ref.
- (build_x_component_ref): Remove protect parameter.
-
-2002-06-25 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (build_op_delete_call): Use BASELINK_FUNCTIONS.
- * class.c (handle_using_decl): Likewise.
- (instantiate_type): Likewise.
- * cp-tree.h (BASELINK_FUNCTIONS): New macro.
- (xref_basetypes): Change prototype.
- (begin_mem_initializers): New function.
- (get_overloaded_fn): Likewise.
- * decl.c (xref_basetypes): Simplify.
- * error.c (dump_expr): Use BASELINK_FUNCTIONS.
- * init.c (build_offset_ref): Likewise.
- * parse.y (base_init): Use begin_mem_initializers().
- (structsp): Adjust call to xref_basetypes.
- * pt.c (determine_specialization): Use BASELINK_FUNCTIONS.
- (instantiate_class_template): Adjust call to xref_basetypes.
- * semantics.c (begin_mem_initializers): New function.
- * tree.c (is_overloaded_fn): Use BASELINK_FUNCTIONS.
- (really_overlaoded_fn): Likewise.
- (get_overloaded_fn): New function.'
- (get_first_fn): USe BASELINK_FUNCTIONS.
-
-2002-06-24 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (SCALAR_TYPE_P): New macro.
- (check_for_out_of_scope_variable): New function.
- (at_class_scope_p): Likewise.
- (finish_fname): Likewise.
- * class.c (finish_struct): Use at_function_scope_p.
- * decl.c (check_for_out_of_scope_variable): New function, split
- out from do_identifier.
- (finish_enum): Use at_function_scope_p.
- * lex.c (do_identifier): Use check_for_out_of_scope_variable.
- * parse.y (VAR_FUNC_NAME): Give it <ttype>. Use finish_fname.
- (primary): Use at_function_scope_p.
- * search.c (at_class_scope_p): New function.
- * semantics.c (finish_fname): Likewise.
- (check_multiple_declarators): Use at_function_scope_p.
-
-2002-06-23 Mark Mitchell <mark@codesourcery.com>
-
- * parse.y (parse_scoped_id): New function.
- (primary): Use it.
- * cp-tree.h (do_scoped_id): Adjust declaration.
- * lex.c (do_scoped_id): Remove call to yylex.
- * decl2.c (build_expr_from_tree): Adjust use of do_scoped_id.
- * typeck2.c (add_exception_specifier): Use tree_cons, rather than
- expanding it inline.
-
-2002-06-23 Matt Thomas <matt@3am-software.com>
-
- * decl.c (finish_function): Change "#ifdef VMS_TARGET" to
- "#if VMS_TARGET".
-
-2002-06-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * mangle.c (integer_type_codes): Const-ify.
-
-2002-06-20 Richard Henderson <rth@redhat.com>
-
- PR c++/6747
- * typeck.c (mark_addressable): Don't test TREE_ADDRESSABLE early.
- Call put_var_into_stack.
-
-2002-06-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * spew.c (remove_last_token): Use ARRAY_SIZE in lieu of explicit
- array size calculation.
-
-2002-06-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/6892
- * pt.c (tsubst_expr): Handle FILE_STMT.
-
-2002-06-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/6723
- * pt.c (lookup_template_class): Don't build complete argument of
- BOUND_TEMPLATE_TEMPLATE_PARM if appeared as a default template
- argument.
-
-2002-06-19 Akim Demaille <akim@epita.fr>
-
- * parse.y (TYPENAME): Rename as tTYPENAME to avoid the clash with
- decl.h's TYPENAME.
- * spew.c, lex.c: Adjust.
- * parse.y (explicit_instantiation): Add empty action to override
- the default $$ = $1 where it introduces a type clash.
-
-2002-06-14 Jason Merrill <jason@redhat.com>
-
- * semantics.c (begin_for_stmt): Push the 'for' scope before
- adding the FOR_STMT.
-
- C++ ABI changes.
- * class.c (build_base_field): Set DECL_PACKED.
- (layout_class_type): Don't use tail padding of PODs.
- * mangle.c (write_unqualified_name): Fix template conversion op
- mangling.
-
-2002-06-16 Richard Henderson <rth@redhat.com>
-
- PR opt/6793
- * tree.c (cp_cannot_inline_tree_fn): Don't short-circuit test
- after template instantiation.
-
-2002-06-16 Richard Henderson <rth@redhat.com>
-
- * cp-tree.h, decl2.c (flag_ms_extensions): Move to c-common.
-
-2002-06-15 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * cp-tree.h (compiler_error): Remove declaration.
- * lex.c (compiler_error): Remove definition.
-
-2002-06-14 Steve Ellcey <sje@cup.hp.com>
-
- * g++spec.c (LIBUNWIND): New.
- (lang_specific_driver): Add it if USE_UNWIND_EXCEPTIONS is set.
-
-2002-06-13 Jessica Han <jessica@cup.hp.com>
-
- * class.c (build_vtable): Use TARGET_VTABLE_ENTRY_ALIGN.
- (build_vtbl_initializer): Honor TARGET_VTABLE_DATA_ENTRY_DISTANCE.
- (build_vbase_offset_vtbl_entries): Likewise.
- * rtti.c (build_headof): Likewise.
- (get_tinfo_decl_dynamic): Likewise.
- (create_pseudo_type_info): Likewise.
-
-2002-06-12 Stan Shebs <shebs@apple.com>
-
- * mpw-config.in: Remove file, no longer used.
- * mpw-make.sed: Ditto.
-
-2002-06-07 Zack Weinberg <zack@codesourcery.com>
-
- * decl2.c: Update call to cpp_handle_option.
-
-2002-06-07 H.J. Lu (hjl@gnu.org)
-
- * decl2.c (flag_use_cxa_atexit): Set to DEFAULT_USE_CXA_ATEXIT.
-
-2002-06-06 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * error.c (cp_error_at): Fix typo.
-
-2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * error.c (cp_diagnostic_starter): Adjust call.
- (maybe_print_instantiation_context): Change prototype to take a
- 'diagnostic_info *'.
- (print_instantiation_full_context): Likewise.
- (print_instantiation_partial_context): Likewise.
- (cp_diagnostic_starter): Likewise.
- (cp_diagnostic_finalizer): Likewise.
- (cp_print_error_function): Likewise.
- (cp_printer): Take a secondary parameter as a 'text_info *'.
- Remove output_state savings. Adjust calls.
-
-2002-06-03 Geoffrey Keating <geoffk@redhat.com>
-
- * pt.c (inline_parm_levels): Mark for GC.
-
- * mangle.c (start_mangling): Allocate G.substitutions here...
- (init_mangle): ... rather than here.
- (finish_mangling): Clear the varray pointer when done with it.
- * spew.c (yylexstring): Don't use VARRAY_FREE.
- * search.c (bfs_walk): Don't use VARRAY_FREE.
- * decl2.c (pending_statics): Use gengtype to mark.
- (deferred_fns): Likewise.
- (ssdf_decls): Likewise.
- (init_decl2): Delete.
- * decl.c (pop_from_top_level): Don't use VARRAY_FREE.
- (cxx_init_decl_processing): Don't call init_decl2.
- (cxx_pop_function_context): Don't use VARRAY_FREE.
- * cp-tree.h (struct saved_scope): No need for special marking
- of varrays.
- (struct language_function): Likewise.
- (local_classes): Use gengtype to mark.
- (init_decl2): Delete prototype.
- * class.c (init_class_processing): Don't use
- ggc_add_tree_varray_root.
- (build_vtbl_initializer): Don't use VARRAY_FREE.
-
- * decl.c (typename_compare): Don't use same_type_p.
-
- * decl.c: Include hashtab.h instead of hash.h.
- (typename_hash): Update to use htab_h.
- (typename_compare): Likewise.
- (typename_htab): Use gengtype to mark.
- (build_typename_type): Update to use htab_h.
- * Make-lang.in (cp/decl.o): Use HASHTAB_H instead of hash.h.
-
- * Make-lang.in (gt-cp-tree.h): New rule.
- (cp/tree.o): Depend on gt-cp-tree.h.
- * config-lang.in (gtfiles): Add cp/tree.c.
- * tree.c: Include gt-cp-tree.h.
- (list_hash_table): Use gengtype to mark.
- (init_tree): Use gengtype to mark trees.
-
- * Make-lang.in (cp/decl.o): Add debug.h dependency.
- * call.c (struct z_candidate): Use gengtype.
- (USER_CONV_CAND): Use WRAPPER_ZC.
- (convert_class_to_reference): Use build_zc_wrapper.
- (build_type_conversion_1): Likewise.
- (build_over_call): Use WRAPPER_ZC.
- (add_warning): Use build_zc_wrapper.
- * cp-lang.c (LANG_HOOKS_MARK_TREE): Delete.
- * cp-tree.h (struct lang_identifier): Use gengtype.
- (struct template_parm_index_s): Likewise.
- (struct ptrmem_cst): Likewise.
- (struct tree_binding): Likewise.
- (struct tree_overload): Likewise.
- (struct tree_srcloc): Likewise.
- (struct tree_wrapper): Likewise. Also modify to have a pointer
- to struct z_candidate rather than void.
- (enum cp_tree_node_structure_enum): New.
- (union lang_tree_node): New.
- (cxx_mark_tree): Delete prototype.
- (cp_tree_node_structure): New prototype.
- (build_ptr_wrapper): Delete prototype.
- (build_int_wrapper): Delete prototype.
- (build_zc_wrapper): New prototype.
- * decl.c: Include debug.h
- (cxx_mark_tree): Delete.
- (cp_tree_node_structure): New.
- * tree.c (build_ptr_wrapper): Delete.
- (build_int_wrapper): Delete.
- (build_zc_wrapper): New.
-
- * cp-tree.h [! ENABLE_TREE_CHECKING] (LANG_TYPE_PTRMEM_CHECK):
- Correct typo. Patch from k_fukui@highway.ne.jp.
-
- * semantics.c (current_stmt_tree): Update for change to
- struct language_function.
- (finish_mem_initializers): Likewise.
- * decl.c (cxx_init_decl_processing): Don't set mark_lang_status.
- * cp-tree.h (struct language_function): Rename from
- cp_language_function. Change all uses.
- (cp_function_chain): Don't need to cast.
-
- * class.c (duplicate_tag_error): Reset discriminator.
- (check_bases_and_members): Update for data structure changes.
- * cp-tree.h (struct lang_id2): Use gengtype.
- (flagged_type_tree): Likewise.
- (SET_LANG_ID): Use GGC on struct lang_id2.
- (struct cp_language_function): Use gengtype. Remove field
- 'x_vcalls_possible_p'.
- (current_vcalls_possible_p): Delete.
- (struct lang_type_header): New.
- (struct lang_type_class): Rename from struct lang_type. Include
- struct lang_type_header.
- (struct lang_type_ptrmem): New.
- (struct lang_type): New.
- (LANG_TYPE_CLASS_CHECK): New. Use it in all the appropriate macros.
- (LANG_TYPE_PTRMEM_CHECK): New. Use it in all the appropriate macros.
- (TYPE_SET_PTRMEMFUNC_TYPE): Set discriminator, update for changes.
- (struct lang_decl_flags): Use gengtype. Add discriminators.
- (struct lang_decl): Use gengtype. Add and use discriminators.
- Update the macros that reference moved fields.
- (LANG_DECL_U2_CHECK): New function. Use it when appropriate.
- (SET_DECL_THUNK_P): Set discriminator too.
- (clear_inline_text_obstack): Delete prototype.
- (finish_inline_definitions): Delete prototype.
- (mark_pending_inlines): Delete prototype.
- (lang_check_failed): New prototype.
- * decl.c (struct named_label_use_list): Use gengtype.
- (struct named_label_list): Likewise.
- (mark_binding_level): Delete.
- (mark_named_label_lists): Delete.
- (push_local_name): Set discriminator on DECL_LANG_SPECIFIC.
- (cxx_init_decl_processing): Use generated marker routine.
- (begin_destructor_body): Delete dead set to
- current_vcalls_possible_p.
- (mark_lang_function): Delete.
- (mark_cp_function_context): Delete.
- (lang_mark_tree): Use generated marker routines.
- * decl2.c (start_objects): Set discriminator when setting
- GLOBAL_INIT_PRIORITY.
- * lex.c (retrofit_lang_decl): Set discriminators.
- (copy_lang_type): Update for changes to lang_type structure.
- (cp_make_lang_type): Set discriminator.
- * parse.y: Use gengtype on YYLVAL. Don't use dots in identifiers.
- * search.c: Include ggc.h.
- * semantics.c (anon_aggr_type_p): Use the macro, don't hand-code it.
- (finish_inline_definitions): Delete.
- * spew.c (struct token): Use gengtype.
- (struct token_chunk): New.
- (struct unparsed_text): Use gengtype. Store tokens in chunks.
- (struct feed): Use gengtype.
- (feed_obstack): Delete.
- (feed): Mark as GC root.
- (pending_inlines): Mark as GC root.
- (pending_inlines_tail): Likewise.
- (processing_these_inlines): Likewise.
- (token_obstack): Make static.
- (first_token): Likewise.
- (init_spew): Don't initialize deleted things; use gengtype for roots.
- (clear_inline_text_obstack): Delete.
- (feed_input): Use GC for struct feed. Update for changes to
- struct unparsed_text.
- (mark_pending_inlines): Delete.
- (next_token): Rename from add_token. Change all callers. Update
- for changes to struct unparsed_text.
- (space_for_token): New.
- (remove_last_token): New.
- (alloc_unparsed_text): New.
- (snarf_block): Take an unparsed_text. Update for changes to struct
- unparsed_text.
- (snarf_method): Update for changes to struct unparsed_text.
- (snarf_defarg): Update for changes to struct unparsed_text.
- * tree.c (lang_check_failed): New.
-
- * Make-lang.in (gt-cp-call.h gt-cp-decl2.h gt-cp-parse.h
- gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h): New rules.
- (cp/spew.o): Add dependency on gt-<filename>.h.
- (cp/decl2.o): Add dependency on gt-<filename>.h.
- (cp/call.o): Add dependency on gt-<filename>.h.
- (cp/pt.o): Add dependency on gt-<filename>.h.
- (cp/repo.o): Add dependency on gt-<filename>.h.
- (cp/parse.o): Add dependency on gt-<filename>.h.
- * call.c: Use gengtype for roots.
- * config-lang.in (gtfiles): Add cp-tree.h decl.h lex.h call.c
- decl2.c parse.y pt.c repo.c spew.c.
- * cp-tree.h: Use gengtype for roots.
- (struct saved_scope): Use GGC, gengtype.
- (cp_parse_init): Delete prototype.
- (init_pt): Delete prototype.
- * decl.c: Use gengtype for roots.
- (mark_saved_scope): Delete.
- (cxx_init_decl_processing): Don't call deleted initilisation
- routines.
- (signed_size_zero_node): Delete, unused.
- * decl.h: Use gengtype for roots.
- * decl2.c: Use gengtype for roots.
- * lex.h: Use gengtype for roots.
- * parse.y: Use gengtype for roots.
- (cp_parse_init): Delete.
- * pt.c: Use gengtype for roots.
- (init_pt): Delete.
- * repo.c: Use gengtype for roots.
- * spew.c: Use gengtype for roots.
-
- * Make-lang.in: Allow for filename changes. Add gtype-cp.h.
- (cp/decl.o): Add dependency on gtype-cp.h.
- * decl.c: Remove use of add_deletable_root, use GTY marker instead.
- Include gtype-cp.h. Allow for filename changes.
-
- * Make-lang.in (cp/gt-decl.h): Generate using gengtype.
- (cp/decl.o): Add cp/gt-decl.h dependency.
- * config-lang.in (gtfiles): New.
- * tree.h: Rename struct binding_level to struct cp_binding_level.
- * decl.c: Rename struct binding_level to struct cp_binding_level.
- Include cp/gt-decl.h.
- (struct cp_binding_level): Use gengtype.
- (make_binding_level): Use GGC on struct cp_binding_level.
- (mark_binding_level): Use gt_ggc_m_cp_binding_level.
- (cxx_init_decl_processing): Mark free_binding_level as
- deletable.
-
- * decl.c (mark_cp_function_context): Update calling sequence.
-
- * decl.c (start_function): Don't free 'struct
- cp_language_function'.
- (pop_cp_function_context): Likewise.
- (save_function_data): Allocate it using GC.
- * semantics.c (genrtl_start_function): Don't free 'struct
- cp_language_function'.
-
-2002-05-31 Matthew Woodcraft <mattheww@chiark.greenend.org.uk>
-
- * lang-specs.h: Use cpp_debug_options.
-
-2002-05-28 Zack Weinberg <zack@codesourcery.com>
-
- * mangle.c, tree.c: Include real.h.
- * Make-lang.in: Update dependency lists.
-
-2002-05-25 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * lex.c: Don't include c-lex.h.
- * parse.y, spew.c: Don't include c-lex.h; include c-pragma.h.
-
-2002-05-23 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * spew.c (yyungetc, snarf_block): Remove indent_level handling.
-
-2002-05-22 Richard Henderson <rth@redhat.com>
-
- * decl.c (obscure_complex_init): Check for VAR_DECL
- before using DECL_THREAD_LOCAL.
-
-2002-05-22 Richard Henderson <rth@redhat.com>
-
- * decl.c (check_tag_decl): Handle RID_THREAD.
- (obscure_complex_init): Reject run-time init of tls.
- (grokvardecl, grokdeclarator): Handle RID_THREAD.
- * lex.c (reswords): Add __thread.
- (rid_to_yy): Map RID_THREAD to SCSPEC.
-
-2002-05-22 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_POST_OPTIONS): Use c_common_post_options.
- * cp-tree.h (cxx_post_options): Kill.
- * cp-lex.c (cxx_post_options): Kill.
-
-2002-05-21 Richard Henderson <rth@redhat.com>
-
- * lex.c (rid_to_yy): Add RID_THREAD.
-
-2002-05-21 Alexandre Oliva <aoliva@redhat.com>
-
- * init.c (build_vec_init): Test for trivial copy-assignment when
- copy-assigning arrays.
-
-2002-05-20 Andreas Jaeger <aj@suse.de>
-
- * init.c (build_default_init): Remove unused variable.
-
-2002-05-20 Alexandre Oliva <aoliva@redhat.com>
-
- * call.c (any_strictly_viable): New.
- (build_new_op): Use it for COMPOUND_EXPR and ADDR_EXPRs.
-
-2002-05-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * error.c (dump_type) [TYPEOF_TYPE]: Fix parenthesis printing.
-
-2002-05-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/186, DR 259
- * pt.c (do_decl_instantiation): Don't complain explicit
- instantiation after explicit specialization.
- (do_type_instantiation): Likewise.
-
-2002-05-19 Alexandre Oliva <aoliva@redhat.com>
-
- * cp-tree.h (complete_type_or_diagnostic): Changed prototype,
- renamed from...
- (complete_type_or_else): ... this. Redefined as macro.
- (cxx_incomplete_type_diagnostic): Declare.
- (cxx_incomplete_type_error): Define as macro.
- * init.c (build_delete): Warn about incomplete types other than
- void, and use the built-in operator delete for them.
- * typeck.c (complete_type_or_diagnostic): Renamed from
- complete_type_or_else. Added warn_only argument, passed to...
- * typeck2.c (cxx_incomplete_type_diagnostic): ... this. Print
- warnings or errors depending on new warn_only argument. Renamed
- from...
- (cxx_incomplete_type_error): ... this. New implementation in
- terms of cxx_incomplete_type_diagnostic.
-
-2002-05-18 Jason Merrill <jason@redhat.com>
-
- PR c++/6611
- * decl2.c (import_export_decl): If we clear
- DECL_NOT_REALLY_EXTERN, make sure DECL_EXTERNAL is set.
-
-2002-05-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- PR c++/6620
- * pt.c (verify_class_unification): Don't check if PARM is template
- parameter dependent. Simplify.
- (unify) [TEMPLATE_PARM_INDEX]: Handle when ARG is a template
- parameter dependent expression.
-
-2002-05-14 Jason Merrill <jason@redhat.com>
-
- * rtti.c (get_tinfo_decl): Don't call comdat_linkage.
- Do set DECL_COMDAT.
- (synthesize_tinfo_var): Take the public decl.
- (create_real_tinfo_var): Likewise. Check DECL_COMDAT.
- (emit_tinfo_decl): Adjust. Call import_export_decl.
- * decl2.c (import_export_decl): Simplify tinfo decl handling.
-
-2002-05-14 Alexandre Oliva <aoliva@redhat.com>
-
- * cp-tree.h (struct lang_type): Added non_zero_init.
- (CLASSTYPE_NON_ZERO_INIT_P): New macro.
- (zero_init_p, force_store_init_value, build_forced_zero_init): Declare.
- * class.c (check_field_decls): Test non_zero_init.
- * cvt.c (convert_to_pointer_force): Use cp_convert_to_pointer for
- zero-to-NULL conversions.
- * decl.c (obscure_complex_init): Don't reset DECL_INITIAL of a
- type that needs zero-initialization without zeros.
- (check_initializer_decl): Compute zero-initializer for types
- that require a non-trivial one.
- * init.c (build_forced_zero_init): New function.
- (build_default_init): Use it.
- * tree.c (zero_init_p): New function.
- * typeck2.c (force_store_init_value): New function.
- (process_init_constructor): Create non-trivial zero-initializers
- for array members and class fields.
-
-2002-05-14 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * lang-specs.h: Remove redundant -lang-c++.
-
-2002-05-13 Jason Merrill <jason@redhat.com>
-
- * class.c (build_vtbl_ref_1): Use fixed_type_or_null.
- (fixed_type_or_null): See through reference vars.
- (build_base_path): Vtable contents are constant.
- * typeck.c (get_member_function_from_ptrfunc): Likewise.
-
-2002-05-12 Jason Merrill <jason@redhat.com>
-
- * cp-lang.c (ok_to_generate_alias_set_for_type): Backend-created
- structs are safe.
-
-2002-05-09 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-tree.h (flag_ansi): Remove.
- * decl2.c (flag_ansi): Remove.
- (cxx_decode_option): Set flag_iso and flag_undef.
-
-2002-05-09 Jason Merrill <jason@redhat.com>
-
- * typeck.c (get_member_function_from_ptrfunc): Reorganize.
- Use subtraction rather than a bitmask to get the index.
- * cvt.c (cp_convert_to_pointer): Bail on an error_mark_node.
-
- * pt.c (tsubst_expr) [ASM_STMT]: Copy ASM_INPUT_P.
-
-2002-05-07 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * Make-lang.in (decl2.o): Update.
- * cp-tree.h (warn_multichar): Remove.
- * decl2.c: Include c-common.h.
- (warn_multichar): Remove.
-
-2002-05-03 Jason Merrill <jason@redhat.com>
-
- * tree.c (build_cplus_array_type): Only const and volatile get
- special handling.
-
- * decl.c (BOOL_TYPE_SIZE): Move default to defaults.h.
-
-2002-04-30 Mark Mitchell <mark@codesourcery.com>
-
- ABI change, returning simple classes from functions.
- * class.c (finish_struct_bits): Only mark TREE_ADDRESSABLE if
- TYPE_HAS_TRIVIAL_INIT_REF is false or
- TYPE_HAS_NONTRIVIAL_DESTRUCTOR is true.
-
-2002-04-30 Jason Merrill <jason@redhat.com>
-
- PR debug/6436
- * decl.c (grokdeclarator): Don't override TYPE_NAME of an
- anonymous class with a typedef if there are attributes.
-
-2002-04-29 Paul Eggert <eggert@twinsun.com>
-
- * parse.y (nomods_initdcl0): Replace $<ttype>3 with $<ttype>$.
-
-2002-04-29 Jakub Jelinek <jakub@redhat.com>
-
- PR c++/6477
- * decl.c (follow_tag_typedef): Check if TYPE_NAME (original) is
- non-NULL first.
-
-2002-04-29 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/6492
- * pt.c (tsubst_friend_class): If the friend has an explicit scope,
- enter that scope before name lookup.
-
- PR c++/6486
- * method.c (do_build_copy_constructor): Avoid building
- cv-qualified reference types.
-
-2002-04-29 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5719
- * decl.c (grok_op_properties): Assignment ops don't have to return
- by value. operator% should.
-
-2002-04-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
-
- PR c/6343
- * decl.c (duplicate_decls): Call merge_weak.
-
-2002-04-26 Richard Henderson <rth@redhat.com>
-
- * parse.y (malloced_yyss, malloced_yyvs): New.
- (yyoverflow): Re-add. Set them.
- (free_parser_stacks): New.
-
-2002-04-26 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/6497
- * method.c (do_build_assign_ref): Pass a derivation to
- build_method_call when calling base class assignment operators.
-
-2002-04-26 Richard Henderson <rth@redhat.com>
-
- * parse.y (yyoverflow): Revert.
-
-2002-04-26 Richard Henderson <rth@redhat.com>
-
- PR c/3581
- * parse.y (string): Remove. Update all uses to use STRING
- instead, and not call combine_strings.
- * rtti.c (tinfo_name): Use fix_string_type.
- * semantics.c (finish_asm_stmt): Don't call combine_strings.
- * spew.c (yylexstring): New.
- (read_token): Use it.
-
-2002-04-25 Richard Henderson <rth@redhat.com>
-
- PR c/2161
- * parse.y (yyoverflow): New.
-
-2002-04-25 Jason Merrill <jason@redhat.com>
-
- PR c++/5607
- * search.c (check_final_overrider): No longer static.
- * class.c (update_vtable_entry_for_fn): Call it.
- * cp-tree.h: Adjust.
-
-2002-04-25 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_SET_YYDEBUG): Remove.
- * cp-tree.h (cxx_set_yydebug): Die.
- * lex.c (YYDEBUG): Get from c-lex.h.
- (cxx_set_yydebug): Remove.
- * parse.y: Include c-lex.h.
- (YYDEBUG): Get from c-lex.h.
-
-2002-04-24 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/6438.
- * cvt.c (convert_to_void): Don't unconditionally make COND_EXPRs
- void.
-
-2002-04-24 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
- LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE):
- Redefine.
- * cp-tree.h (cp_attribute_table): Rename.
- * decl.c (lang_attribute_table): Remove declaration.
- (cxx_init_decl_processing): Don't set it.
- * tree.c (cp_attribute_table): Rename.
-
-2002-04-24 Jason Merrill <jason@redhat.com>
-
- PR c++/6331
- * method.c (do_build_copy_constructor): Use cp_build_qualified_type.
- * typeck.c (build_modify_expr): Allow arrays to differ in cv-quals.
- The pedwarn for array assignment is now unconditional.
- * tree.c (build_cplus_array_type_1): Still process simple array types
- normally in templates.
-
- PR c++/6395
- * decl.c (make_rtl_for_nonlocal_decl): Don't mess with #pragma i/i
- stuff for comdats.
-
-2002-04-23 Jakub Jelinek <jakub@redhat.com>
-
- * parse.y (check_class_key): Allow KEY to be union/enum/struct/class
- node with attributes.
-
-2002-2-23 David O'Brien <obrien@FreeBSD.org>
-
- * g++spec.c (MATH_LIBRARY_PROFILE, LIBSTDCXX_PROFILE): Add.
- Use MATH_LIBRARY_PROFILE and LIBSTDCXX_PROFILE if profile flag given.
-
-2002-04-23 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/6256:
- * pt.c (tsubst_friend_class): Handle templates with explicit
- nested names.
-
- PR c++/6331:
- * typeck.c (merge_types): Remember the cv-qualification of pointer
- types when merging them.
-
-2002-04-20 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_FUNCTION_INIT,
- LANG_HOOKS_FUNCTION_FREE, LANG_HOOKS_FUNCTION_MARK): Redefine.
- * cp-tree.h (cxx_push_function_context, cxx_pop_function_context,
- cxx_mark_function_context): New.
- * decl.c (push_cp_function_context, pop_cp_function_context,
- mark_cp_function_context): Rename for consistency.
- (cxx_init_decl_processing): Don't set old hooks.
-
-2002-04-19 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * call.c (convert_type_from_ellipsis): Rename, update.
- * cp-lang.c (LANG_HOOKS_TYPE_PROMOTES_TO): Redefine.
- * cp-tree.h (convert_type_from_ellipsis): Rename.
- * decl.c (cxx_init_decl_processing): Don't set hook.
-
-2002-04-18 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * call.c (build_new_method_call): Update.
- * cp-lang.c (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): Redefine.
- * cp-tree.h (cxx_incomplete_type_error): New.
- * decl.c (grokdeclarator, grokparms): Update.
- * decl2.c (check_classfn): Update.
- * pt.c (tsubst): Update.
- * typeck.c (complete_type_or_else, expr_sizeof,
- decay_conversion): Update.
- * typeck2.c (incomplete_type_error): Rename.
- (add_exception_specifier): Update.
-
-2002-04-18 Jason Merrill <jason@redhat.com>
-
- PR c++/5658
- * search.c (setup_class_bindings): A class template qualifies as a
- type binding.
-
-2002-04-17 Jakub Jelinek <jakub@redhat.com>
-
- PR c++/6316
- * decl2.c (finish_file): Clear DECL_EXTERNAL in a separate loop
- before expanding.
-
-2002-04-16 Mark Mitchell <mark@codesourcery.com>
-
- * init.c (begin_init_stmts): Remove commented out code.
- (finish_init_stmts): Set STMT_EXPR_NO_SCOPE.
- * semantics.c (begin_gobal_stmt_expr): Adjust call to
- expand_start_stmt_expr.
-
-2002-04-15 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (register_dtor_fn): Pass the address of dso_handle, not
- dso_handle itself, to __cxa_atexit.
-
-2002-04-15 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
-
- * error.c (cxx_print_error_function): Adjust call to macros.
-
-2002-04-14 Jakub Jelinek <jakub@redhat.com>
-
- * class.c (layout_virtual_bases): Do all dsize computation on trees.
-
-2002-04-14 Jason Merrill <jason@redhat.com>
-
- * typeck.c (get_member_function_from_ptrfunc): Don't do
- gratuitious division and multiplication on
- ptrmemfunc_vbit_in_delta targets.
-
-2002-04-12 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/5373.
- * semantics.c (finish_expr_stmt): Remember the type of the
- expression before any conversions are performed.
-
-2002-04-12 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/5189.
- * call.c (add_template_candidate_real): Do not treat member
- templates as copy constructors.
-
-2002-04-12 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (duplicate_decls): Do not copy the RTL for a variable
- declaration if the old variable had an incomplete type and the new
- variable does not.
- (complete_vars): Do not call layout_decl for completed variables.
-
-2002-04-12 Richard Sandiford <rsandifo@redhat.com>
-
- * decl.c (duplicate_decls): Don't try to unify an implicit typedef
- with an explicit one.
- (follow_tag_typedef): New.
- (lookup_tag): Use it to extract the tag of an explicit typedef.
- (xref_tag): Likewise.
-
-2002-04-11 Andrew Haley <aph@redhat.com>
-
- * typeck.c (type_after_usual_arithmetic_conversions):
- If two types have the same variant, return immediately.
- When two floating-point operands are the same precision:
- convert to float if one of the operands is float;
- if neither operand is one of the standard types, return the type
- of the first operand.
-
-2002-04-10 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5507
- * decl.c (make_typename_type): Remove implicit typenameness.
-
-2002-04-09 Jason Merrill <jason@redhat.com>
-
- PR optimization/6189
- * semantics.c (genrtl_start_function): Don't free
- DECL_SAVED_FUNCTION_DATA for inline functions.
-
- * init.c (build_member_call): For now, don't convert to
- intermediate base if it would cause an error.
-
-2002-04-08 Paolo Carlini <pcarlini@unitus.it>
-
- * parse.y (namespace_qualifier, maybe_identifier,
- begin_explicit_instantiation, end_explicit_instantiation,
- apparent_template_type, .finish_template_type,
- do_id, maybe_init, defarg_again, component_decl_1):
- Add ending ';', in accordance with POSIX.
-
-2002-04-06 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/5571
- * class.c (layout_class_type): Remember incomplete static
- variables.
- (finish_struct_1): Call complete_vars, not
- hack_incomplete_structures.
- * cp-tree.h (hack_incomplete_structures): Rename to ...
- (complete_vars): ... this.
- (struct saved_scope): Remove incomplete.
- (namespace_scope_incomplete): Remove.
- * decl.c (struct binding_level): Remove incomplete.
- (incomplete_vars): New variable.
- (mark_binding_level): Don't mark incomplete.
- (print_binding_level): Don't print it.
- (mark_saved_scope): Don't mark incomplete.
- (pushdecl): Use maybe_register_incopmlete_var.
- (cxx_init_decl_processing): Register incomplete_vars for GC.
- (start_decl_1): Clarify error message.
- (hack_incomplete_vars): Remove.
- (maybe_register_incomplete_var): New function.
- (complete_vars): Likewise.
-
-2002-04-06 Jason Merrill <jason@redhat.com>
-
- PR c++/4934
- * error.c (dump_expr) [CONVERT_EXPR]: Make sure TREE_TYPE (t) is
- set before checking it.
-
- PR c++/525
- * init.c (build_member_call): Use build_scoped_ref.
- (resolve_offset_ref): Likewise.
- * call.c (build_scoped_method_call): Likewise.
- * tree.c (maybe_dummy_object): Kludge around current_class_type being
- wrong.
- * typeck2.c (build_scoped_ref): Return the binfo via binfo_p parm.
- * cp-tree.h: Adjust.
-
- * init.c (push_base_cleanups): Just use build_scoped_method_call.
-
- PR c++/6179
- * method.c (implicitly_declare_fn): Pass unqualified type to
- synthesize_exception_spec.
-
-2002-04-04 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine.
- * cvt.c: Update comment.
- * init.c (expand_cleanup_for_base): Update.
- * semantics.c (finish_parenthesized_expr): Update.
- * typeck.c (cp_truthvalue_conversion): Update.
-
-2002-04-04 Jason Merrill <jason@redhat.com>
-
- * semantics.c (finish_eh_cleanup): New fn.
- * cp-tree.h: Add prototype.
- * init.c (perform_member_init, expand_cleanup_for_base): Use
- finish_eh_cleanup.
- * cp-tree.def (SUBOBJECT, CTOR_STMT): Remove.
- * cp-tree.h: Remove references.
- * decl.c (begin_constructor_body, end_constructor_body): Likewise.
- * dump.c (cp_dump_tree): Likewise.
- * pt.c (tsubst_expr): Likewise.
- * semantics.c (genrtl_ctor_stmt, genrtl_subobject): Remove.
- (cp_expand_stmt): Remove handling of CTOR_STMT and SUBOBJECT.
- * tree.c (cp_statement_code_p): Likewise.
-
- * init.c (build_new_1): Set CLEANUP_EH_ONLY on deleting cleanup.
-
- PR c++/5636
- * semantics.c (nullify_returns_r): Just set CLEANUP_EH_ONLY on
- cleanup for nrv.
-
- PR c++/5104
- * typeck.c (comptypes) [FUNCTION_TYPE]: Don't compare exception
- specifiers.
- [METHOD_TYPE]: Use same code as FUNCTION_TYPE.
-
-2002-04-03 Richard Henderson <rth@redhat.com>
-
- * cp-lang.c (cxx_warn_unused_global_decl): New.
- (LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL): New.
-
-2002-04-03 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): Redefine.
- * tree.c (init_tree): Don't set hook.
-
-2002-04-03 Roger Sayle <roger@eyesopen.com>
-
- PR c++/5998:
- * decl.c (duplicate_decls): Don't mess with assembler names when
- redeclaring builtin functions as static.
-
-2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * call.c (build_addr_func): Update.
- * class.c (resolve_address_of_overloaded_function): Update.
- * cp-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine.
- * cp-tree.h (cxx_mark_addressable): New.
- * decl.c (register_dtor_fn, cxx_maybe_build_cleanup): Update.
- * decl2.c (build_cleanup): Update.
- * except.c (build_throw): Update.
- * init.c (resolve_offset_ref): Update.
- * pt.c (convert_nontype_argument): Update.
- * semantics.c (finish_asm_stmt, simplify_affr_init_exprs_r): Update.
- * typeck.c (decay_conversion, build_array_ref, build_unary_op,
- unary_complex_lvalue): Update.
- (mark_addressable): Rename.
-
-2002-04-01 Roger Sayle <roger@eyesopen.com>
-
- PR c++/5998:
- * decl.c (duplicate_decls): Overwrite the RTL when (and only
- when) overwriting a built-in function. Don't use COPY_DECL_RTL,
- but follow the SET_DECL_RTL idiom used elsewhere in the function.
-
-2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
- LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
- * decl.c (grokdeclarator): Update.
- * mangle.c (write_integer_cst): Update.
- * typeck.c (build_binary_op): Update.
-
-2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
- * lex.c (cxx_init): Don't set hook.
-
-2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * Make-lang.in (error.o): Update.
- * cp-lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
- * cp-tree.h (struct diagnostic_context): Predeclare.
- (cxx_print_error_function): New.
- * error.c: Include langhooks-def.h.
- (lang_print_error_function): Rename. Update.
- (init_error): Don't set hook.
-
-2002-03-29 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):
- Redefine.
- * cvt.c (cp_convert_to_pointer, type_promotes_to): Use new hooks.
- * decl.c (finish_enum): Similarly.
- * error.c (dump_type): Similarly.
- * lex.c (cxx_init): Similarly.
- * mangle.c (write_builtin_type): Similarly.
- * typeck.c (comptypes): Similarly.
-
-2002-03-28 Roger Sayle <roger@eyesopen.com>
-
- PR c++/5998:
- * decl.c (cxx_init_decl_processing): Re-enable built-in functions
- in the g++ front-end.
- (duplicate_decl): Allow redefinition of anticipated built-ins.
- Fix inlining problem by over-writing the old DECL_RTL.
- (lookup_namespace_name): Fail to find an identifier in the
- specified namespace if its still anticipated.
- (builtin_function_1): New function split out from builtin_function
- to create a builtin in the current namespace with given context.
- (builtin_function): Call builtin_function_1 to define the
- appropriate builtins in both the std and global namespaces.
- (select_decl): Don't test for anticipated decls here.
- (unqualified_namespace_lookup): Instead ignore them whilst
- searching through scopes and namespaces.
- * decl2.c (do_nonmember_using_decl): If a using declaration
- specifies an anticipated built-in function, mark it as no longer
- anticipated in that scope.
- (ambiguous_decl): Avoid resolving to an anticipated decl.
- * lex.c (do_scoped_id): Fail to find an identifier in the global
- namespace if its still anticipated.
-
-2002-03-29 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_MAKE_TYPE): Redefine.
- * cp-tree.h (cp_make_lang_type): Rename.
- * lex.c (cp_make_lang_type): Rename.
- (make_aggr_type): Update.
- * tree.c (init_tree): Don't set make_lang_type_fn.
-
-2002-03-29 Jakub Jelinek <jakub@redhat.com>
-
- PR c++/6073
- * class.c (finish_struct_1): Update static field's DECL_MODE even
- if its type is a variant of t.
-
-2002-03-27 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES): Redefine.
- * cp-tree.h (cxx_insert_default_attributes): New.
- * decl.c (insert_default_attributes): Rename.
-
-2002-03-27 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/4884
- * call.c (build_op_delete_call): Allow for the fact the placement
- may be a COMPOUND_EXPR.
-
-2002-03-27 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_EXPAND_EXPR): Redefine.
- * cp-tree.h (init_cplus_expand): Remove.
- (cxx_expand_expr): New.
- * expr.c (cplus_expand_expr): Rename cxx_expand_expr,
- fix prototype.
- (init_cplus_expand): Remove.
- * lex.c (cxx_init): Don't call init_cplus_expand.
-
-2002-03-26 Mark Mitchell <mark@codesourcery.com>
-
- PR c++/4884.
- * init.c (build_new_1): Allow for the fact the result of
- build_function_call may be a COMPOUND_EXPR.
-
-2002-03-26 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5682
- * cp-tree.h (BINFO_PRIMARY_P): Explain meaning better.
- (dfs_skip_nonprimary_vbases_unmarkedp): Remove.
- (dfs_skip_nonprimary_vbases_markedp): Remove.
- * search.c (get_shared_vbase_if_not_primary): Remove.
- (dfs_skip_nonprimary_vbases_unmarkedp): Remove.
- (dfs_skip_nonprimary_vbases_markedp): Remove.
- (dfs_unmarked_real_bases_queue_p): Just get the canonical binfo.
- (dfs_marked_real_bases_queue_p): Likewise.
-
-2002-03-26 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_MARK_TREE): Redefine.
- * cp-tree.h (cxx_mark_tree): New.
- * decl.c (lang_mark_tree): Rename cxx_mark_tree.
-
-2002-03-25 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-tree.h (cxx_maybe_build_cleanup): New.
- * decl.c (destroy_local_var, hack_incomplete_structures): Update.
- (maybe_build_cleanup): Rename cxx_maybe_build_cleanup.
- * tree.c (build_target_expr): Update.
- * cp-lang.c (LANG_HOOKS_MAYBE_BUILD_CLEANUP): Redefine.
-
-2002-03-24 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * decl2.c (cxx_decode_option): Handle -E.
- * lang-specs.h (default_compilers): Preprocess with cc1plus.
- * lex.c (cxx_init): Exit quickly if c_common_init returns NULL.
-
-2002-03-23 Jakub Jelinek <jakub@redhat.com>
-
- PR c++/6037
- * decl.c (start_enum): Don't set TREE_ADDRESSABLE on TREE_LIST node.
-
-2002-03-23 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
-
- * error.c (dump_type): Be careful about implicit typenames.
-
-2002-03-21 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
-
- PR C++/3656
- * semantics.c (finish_base_specifier): Handle erronous base
- classes.
-
-2002-03-22 Zack Weinberg <zack@codesourcery.com>
-
- * error.c: Always use REAL_VALUE_TO_DECIMAL; don't test
- REAL_IS_NOT_DOUBLE.
-
-2002-03-22 Jeff Knaggs <jknaggs@redhat.com>
-
- * typeck.c (get_member_function_from_ptrfunc): Scale idx down to
- an index into the vtable_entry array regardless of
- TARGET_PTRMEMFUNC_VBIT_LOCATION.
-
-2002-03-21 Aldy Hernandez <aldyh@redhat.com>
-
- * tree.c (cp_cannot_inline_tree_fn): Same.
-
-2002-03-21 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
- insert_block, getdecls, global_bindings_p): New.
-
-2002-03-20 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/4361
- * mangle.c (struct globals) Add internal_mangling_p member.
- (write_template_param): Do internal mangling, if needed.
- (mangle_conv_op_name_for_type): Request internal mangling.
-
-2002-03-20 Jason Merrill <jason@redhat.com>
-
- PR c++/2136
- * init.c (build_delete): Check access for a member op delete here.
- * decl2.c (delete_sanity): Not here.
-
-2002-03-19 Jason Merrill <jason@redhat.com>
-
- PR c++/5118
- * class.c (get_vfield_name): Use the constructor_name.
-
-2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine.
- * cp-tree.h (lang_printable_name): Rename.
- * error.c (lang_decl_name): Use new hook.
- * lex.c (cxx_init): Remove old hook.
- * pt.c (tsubst_decl): Use new hook.
- * tree.c (lang_printable_name): Rename.
-
-2002-03-18 Eric Botcazou <ebotcazou@multimania.com>
-
- PR c++/3882
- * pt.c (tsubst_decl): Move __PRETTY_FUNCTION__ handling...
- (tsubst_expr) [DECL_STMT]: ...here. And substitute the initializer
- only after recording the declaration.
-
-2002-03-18 Jason Merrill <jason@redhat.com>
-
- PR c++/2039
- * init.c (resolve_offset_ref): Hand off to build_component_ref.
-
- PR c++/4222, c++/5995
- * call.c (build_over_call): Fix empty class logic.
-
- PR c++/3870
- * cp-tree.h (struct saved_scope): Add last_parms field.
- * decl.c (maybe_push_to_top_level): Save last_function_parms.
- (pop_from_top_level): Restore it.
-
- PR c++/4377
- * mangle.c (write_expression): Strip NOP_EXPRs sooner. Also strip
- NON_LVALUE_EXPRs.
-
- PR c++/4003
- * pt.c (tsubst_friend_function): Use decl_namespace_context.
-
- PR c++/3948 -- C++ ABI change, followup to 2001-12-18 patch.
- * class.c (finish_struct_bits): Also set TREE_ADDRESSABLE for a
- type with a nontrivial destructor.
-
-2002-03-17 Jason Merrill <jason@redhat.com>
-
- PR c++/4460
- * class.c (build_base_path): Virtual base layout is fixed in
- in-charge [cd]tors.
-
-2002-03-17 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_PARSE_FILE): Redefine.
- * parse.y (yyparse): Remove macro.
-
-2002-03-17 Jason Merrill <jason@redhat.com>
-
- PR c++/5757
- * init.c (build_new_1): Pass the right pointer to op delete.
-
-2002-03-16 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/4361
- * cp-tree.h (CLASSTYPE_METHOD_VEC): Document where templated
- conversion operators go.
- (struct lang_decl_flags): Add template_conv_p and unused
- bitfields.
- (DECL_TEMPLATE_CONV_FN_P): New macro.
- * call.c (build_user_type_conversion_1): Don't check second type
- conversion of overload set first.
- * class.c (add_method): Make sure templated conversion operators
- all end up on slot 2.
- * lex.c (do_identifier): A conversion operator token might be
- satisfied by a templated conversion operator.
- * pt.c (check_explicit_specialization): Use
- CLASSTYPE_FIRST_CONVERSION_SLOT.
- (template_parm_this_level_p): New function.
- (push_template_decl_real): Determine DECL_TEMPLATE_CONV_FN_P.
- * search.c (lookup_fnfields_1): Template conversions will be on
- the first slot.
- * typeck.c (build_component_ref): Preserve the type of an
- conversion operator name on the overload type.
- (build_x_function_call): Retrieve the conversion operator name.
-
-2002-03-15 Richard Henderson <rth@redhat.com>
-
- * init.c (build_new_1): Use size_binop instead of cp_build_binary_op.
-
-2002-03-15 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (CLEANUP_DECL): Remove.
- (CLEANUP_EXPR): Likewise.
- * decl.c (destroy_local_var): Simplify.
- (maybe_build_cleanup): Tidy.
- * dump.c (cp_dump_tree): Remove handling of CLEANUP_STMT.
- * semantics.c (cp_expand_stmt): Likewise.
- * cp/tree.c (cp_statement_code_p): Likewise.
-
-2002-03-15 Jason Merrill <jason@redhat.com>
-
- PR c++/5857
- * decl.c (duplicate_decls): Use merge_types instead of common_type.
- * typeck.c (common_type): Just hand off to
- type_after_usual_arithmetic_conversions and
- composite_pointer_type.
- (merge_types): New fn.
- (commonparms): Use it instead of common_type.
- (type_after_usual_arithmetic_conversions): Also handle COMPLEX_TYPE.
- (composite_pointer_type): Also handle attributes.
- * cp-tree.h: Declare merge_types.
-
- * decl.c (make_rtl_for_nonlocal_decl): Also defer COMDAT
- variables.
- * decl2.c (maybe_make_one_only): Also mark the decl as needed.
-
-2002-03-14 Richard Henderson <rth@redhat.com>
-
- * decl.c: Include c-pragma.h.
- (start_decl, start_function): Invoke maybe_apply_pragma_weak.
- * Make-lang.in: Update dependencies.
-
-2002-03-14 Jakub Jelinek <jakub@redhat.com>
-
- PR c++/5908
- * call.c (build_over_call): Set TREE_NO_UNUSED_WARNING too.
- * cvt.c (convert_to_void): Preserve TREE_NO_UNUSED_WARNING.
-
-2002-03-12 Richard Sandiford <rsandifo@redhat.com>
-
- * mangle.c (write_builtin_type): Handle 128-bit integers even if
- they are not a standard integer type.
-
-2002-03-12 Richard Sandiford <rsandifo@redhat.com>
-
- * cp-tree.h (init_init_processing): Remove declaration.
- * init.c (BI_header_type, init_init_processing): Remove old ABI stuff.
- * decl.c (cxx_init_decl_processing): Don't call init_init_processing.
-
-2002-03-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cp-lang.c (tree_code_type, tree_code_length, tree_code_name):
- Define.
- * decl.c (duplicate_decls): Use TREE_CODE_LENGTH, not
- tree_code_length.
- * lex.c (cplus_tree_code_type, cplus_tree_code_length,
- cplus_tree_code_name): Delete.
- (cxx_init): Don't call add_c_tree_codes, instead set
- lang_unsafe_for_reeval. Don't try to copy into the various
- tree_code arrays.
-
-2002-03-12 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5659
- * decl.c (xref_tag): Don't set CLASSTYPE_DECLARED_CLASS here.
- * decl2.c (handle_class_head): Set CLASSTYPE_DECLARED_CLASS for
- definitions.
-
-2002-03-11 Nathan Sidwell <nathan@codesourcery.com>
-
- Revert 2001-03-26 Nathan Sidwell <nathan@codesourcery.com>,
- DR209 is now not a defect.
- * cp-tree.h (skip_type_access_control): Remove.
- * decl.c (grokdeclarator): Do type access control for friend
- declarations.
- * semantics.c (decl_type_access_control): Don't reset
- current_type_lookups.
- (save_type_access_control): Always save the lookups.
- (skip_type_access_control): Remove.
- (finish_class_definition): Don't change type_lookups.
-
-2002-03-11 Nathan Sidwell <nathan@codesourcery.com>
-
- Revert 2000-12-01 Nathan Sidwell <nathan@codesourcery.com>,
- It is incorrect.
- * typeck.c (build_static_cast): Compare non-qualified types
- with pointer to member conversions.
-
-2002-03-11 Dan Nicolaescu <dann@ics.uci.edu>
- Daniel Berlin <dan@dberlin.org>
-
- * cp-lang.c (ok_to_generate_alias_set_for_type): New function.
- (cxx_get_alias_set): Use it.
-
-2002-03-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cp-tree.h (stabilize_expr): Prototype.
-
-2002-03-08 Craig Rodrigues <rodrigc@gcc.gnu.org>
-
- * cp-tree.h (CLEAR_BINFO_MARKED): Make both parts of
- conditional return void.
-
-2002-03-08 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-lang.c (LANG_HOOKS_UNSAVE): Redefine.
- * cp-tree.h (cxx_unsave): New.
- * tree.c (cp_unsave): Rename cxx_unsave, update prototype.
- (init_tree): Update.
-
-2002-03-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
- explicit sizeof/sizeof.
- * decl2.c (cxx_decode_option): Likewise.
- * lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.
-
-2002-03-02 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/775
- * decl.c (lookup_tag): Only reject enum/class mismatch, not
- class/union mismatch.
- * parse.y (check_class_key): New function.
- (structsp): Call it.
-
-2002-03-01 Michael Matz <matz@suse.de>
-
- * typeck.c (cp_pointer_int_sum): Complete inner type which is
- used later by size_in_bytes().
-
-2002-03-01 Phil Edwards <pme@gcc.gnu.org>
-
- * cp-tree.h: Require __GNUC__ to be #defined.
- (build_init): Add missing prototype.
-
-2002-03-01 Jason Merrill <jason@redhat.com>
-
- * except.c: Don't include decl.h or obstack.h. Do include
- tree-inline.h.
- (build_throw): Destroy temporaries from the thrown
- expression before calling __cxa_throw. Construct a thrown
- temporary directly into the exception object.
- (stabilize_throw_expr): New function.
- (wrap_cleanups_r): New function.
- * tree.c (stabilize_expr): New function.
- * init.c (build_init): New function.
- * Make-lang.in (cp/except.o): Adjust .h deps.
-
-2002-02-28 Jason Merrill <jason@redhat.com>
-
- * search.c (lookup_base_r): Don't clear is_non_public just because
- we found a friendly scope.
-
- * decl.c (finish_function): Only warn about missing return
- statement with -Wreturn-type.
-
-2002-02-28 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * class.c (build_clone): Update.
- * cp-lang.c (LANG_HOOKS_DUP_LANG_SPECIFIC_DECL): Redefine.
- * cp-tree.h (cxx_dup_lang_specific_decl): New.
- * lex.c (copy_lang_decl): Rename cxx_dup_lang_specific_decl.
- (copy_decl): Update.
- * method.c (make_thunk): Update.
-
-2002-02-27 Zack Weinberg <zack@codesourcery.com>
-
- * decl2.c: Delete traditional-mode-related code copied from
- the C front end but not used, or used only to permit the
- compiler to link.
-
-2002-02-24 Craig Rodrigues <rodrigc@gcc.gnu.org>
-
- PR c++/4093
- * cp-tree.h (SET_BINFO_MARKED): Cast false part of condition
- to void.
-
-2002-02-22 Jakub Jelinek <jakub@redhat.com>
-
- PR other/5746
- * semantics.c (finish_switch_cond): Don't call get_unwidened
- if error_mark_node.
-
-2002-02-22 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/2645, DR 295
- * cp-tree.h (tsubst_flags_t): Add tf_ignore_bad_quals,
- tf_keep_type_decl.
- (make_typename_type): Use tsubst_flags_t.
- * decl.c (make_typename_type): Adjust. Return non-artificial
- TYPE_DECLs, if required.
- (grokdeclarator): Simplify CVR qualification handling. Allow bad
- qualifiers on typedef types.
- * decl2.c (handle_class_head): Adjust make_typename_type call.
- * parse.y (nested_name_specifier): Likewise.
- (typename_sub0): Likewise.
- (typename_sub1): Likewise.
- * pt.c (convert_template_argument): Adjust make_typename_type
- return value.
- (tsubst): Adjust cp_build_qualified_type_real calls.
- (check_cv_quals_for_unify): Cope with allowing bad qualifications
- on template type parms.
- (instantiate_decl): Recheck substitutions to give warnings on bad
- qualifications.
- * tree.c (cp_build_qualified_type_real): Use tf_allow_bad_quals.
-
-2002-02-21 Aldy Hernandez <aldyh@redhat.com>
-
- * cp/decl.c (duplicate_decls): Merge always_inline attribute.
-
- * cp/tree.c (cp_cannot_inline_tree_fn): Do not inline at -O0
- unless DECL_ALWAYS_INLINE.
-
-2002-02-20 Jakub Jelinek <jakub@redhat.com>
-
- * typeck.c (cp_pointer_int_sum): Renamed from
- pointer_int_sum, call pointer_int_sum.
-
-2002-02-20 Jakub Jelinek <jakub@redhat.com>
-
- * decl.c (duplicate_decls): Return 0 if issued error about
- redeclaration.
-
-2002-02-19 Jason Merrill <jason@redhat.com>
-
- ABI change: Mangle `void (A::*)() const' as
- M1AKFvvE, not MK1AFvvE.
- * mangle.c (write_function_type): Write cv-quals for member
- function type here.
- (write_pointer_to_member_type): Not here.
-
-2002-02-18 Jason Merrill <jason@redhat.com>
-
- * pt.c (do_type_instantiation): Don't pedwarn if in_system_header.
- (do_decl_instantiation): Likewise.
-
-2002-02-17 Craig Rodrigues <rodrigc@gcc.gnu.org>
-
- PR c++/5685
- * decl.c (duplicate_decls): Make warning unconditional
- if duplicate default argument declarations are present.
-
-2002-02-17 Jakub Jelinek <jakub@redhat.com>
-
- * typeck.c (build_binary_op) [BIT_XOR_EXPR]: Remove explicit
- shortening.
-
-2002-02-15 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (grokdeclarator): Set typedef_decl for all TYPE_DECLs,
- remove incorrect comment. Move #if 0'd code to common path. Use
- IMPLICIT_TYPENAME_P. Simplify & reformat ARRAY_TYPE duplication.
-
-2002-02-13 Jason Merrill <jason@redhat.com>
-
- * decl.c (builtin_function): Set TREE_THIS_VOLATILE on return fns.
- (finish_function): Don't warn if current_function_returns_null.
-
- * typeck2.c (digest_init): Do handle values of vector type.
-
- * typeck2.c (digest_init, process_init_constructor): Treat vectors
- like arrays.
-
-2002-02-11 Jason Merrill <jason@redhat.com>
-
- * parse.y (reserved_declspecs): Don't handle attributes.
- (reserved_typespecquals): Handle them here.
- * Make-lang.in (parse.c): Adjust expected conflicts.
-
-2002-02-08 Jakub Jelinek <jakub@redhat.com>
-
- * parse.y (primary, primary_no_id): Use compstmt_or_stmtexpr
- instead of compstmt.
- (compstmt_or_stmtexpr): Renamed from compstmt.
- (compstmt): In addition to compstmt_or_stmtexpr clear last_expr_type.
-
-2002-02-07 Nathan Sidwell <nathan@codesourcery.com>
-
- Rename instantiate_type_flags to tsubst_flags_t & expand use.
- * cp-tree.h (instantiate_type_flags): Rename to ...
- (tsubst_flags_t): ... here. Rename itf_complain to tf_error,
- add tf_warning flag.
- (instantiate_type): Adjust prototype.
- (tsubst, tsubst_expr, tsubst_copy, lookup_template_class,
- do_type_instantiation, cp_build_qualified_type_real): Likewise.
- cp_build_qualified_type: Adjust.
- * class.c (instantiate_type): Adjust parameter. Rename itf_* to
- tf_*.
- * call.c (standard_conversion): Rename itf_* to tf_*.
- (reference_binding): Likewise.
- (convert_like_real): Likewise.
- * cvt.c (cp_convert_to_pointer): Likewise.
- (convert_to_reference): Likewise.
- * decl.c (lookup_namespace_name): Use tf_* flags.
- (make_typename_type): Likewise.
- (grokdeclarator): Likewise.
- * pt.c (convert_nontype_argument): Adjust COMPLAIN usage.
- (coerce_template_template_parms, convert_template_argument,
- coerce_template_parms, maybe_get_template_decl_from_type_decl,
- lookup_template_class, tsubst_friend_function, tsubst_friend_class,
- instantiate_class_template, tsubst_template_arg_vector,
- tsubst_template_parms, tsubst_aggr_type, tsubst_default_argument,
- tsubst_decl, tsubst_arg_types, tsubst_function_type,
- tsubst_call_declarator_parms, tsubst, tsubst_copy, tsubst_expr,
- instantiate_template, fn_type_unification,
- resolve_overloaded_unification, verify_class_unification,
- unify, get_bindings_real, do_type_instantiation,
- regenerate_decl_from_template, instantiate_decl,
- tsubst_initializer_list, tsubst_enum,
- get_mostly_instantiated_function_type,
- invalid_nontype_parm_type_p): Likewise.
- * tree.c (cp_build_qualified_type_real): Likewise.
- * typeck.c (build_binary_op): Rename itf_* to tf_*.
- (build_ptrmemfunc): Likewise.
- (convert_for_assignment): Likewise.
-
-2002-02-07 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/109
- * decl.c (grokdeclarator): Allow friend declarations from
- dependent types.
- * decl2.c (handle_class_head): Don't push into template parm contexts.
- * pt.c (push_template_decl_real): Template parm contexts are never
- being defined.
-
-2002-02-05 Alexandre Oliva <aoliva@redhat.com>
-
- * class.c: Include target.h.
- (check_bitfield_decl): Disregard EMPTY_FIELD_BOUNDARY,
- BITFIELDS_NBYTES_LIMITED and PCC_BITFIELD_TYPE_MATTERS for MS
- bit-field layout.
- * Make-lang.in: Adjust deps.
-
-2002-02-05 Jason Merrill <jason@redhat.com>
-
- * error.c (dump_type): Be more helpful about VECTOR_TYPE.
-
-2002-02-04 Jakub Jelinek <jakub@redhat.com>
-
- * semantics.c (begin_switch_stmt): Clear SWITCH_TYPE.
- (finish_switch_cond): Set SWITCH_TYPE.
-
-2002-02-04 Richard Henderson <rth@redhat.com>
-
- * method.c (use_thunk): Always initialize the block tree. Reindent.
- * semantics.c (expand_body): Emit thunks after function, not before.
-
-2002-02-04 Jason Merrill <jason@redhat.com>
-
- * decl.c (start_function): Call cplus_decl_attributes immediately
- after grokdeclarator.
-
- * decl.c (start_function): Combine DECL_RESULT handling code.
-
-2002-02-03 Jason Merrill <jason@redhat.com>
-
- * xref.c: Remove.
- * Make-lang.in (CXX_OBJS): Remove cp/xref.o
- (cp/xref.o): Remove dependencies.
- * class.c (finish_struct_1, check_methods): Don't call xref fns.
- (finish_struct_1): Likewise.
- * friend.c (make_friend_class): Likewise.
- * lex.c (cxx_init, cxx_finish, extract_interface_info): Likewise.
- * spew.c (read_process_identifier): Likewise.
-
-2002-02-01 Jason Merrill <jason@redhat.com>
-
- PR c++/4872
- * decl.c (finish_function): Warn about a non-void function with
- no return statement and no abnormal exit.
- * cp-tree.h (struct cp_language_function): Add returns_abnormally.
- (current_function_returns_abnormally): New macro.
- * call.c (build_call): Set it.
-
- * typeck.c (build_component_ref): Always complain about offsetof
- constructs on non-PODs. Only make it an error for members of
- virtual bases.
-
- * error.c (dump_scope): Don't add TFF_DECL_SPECIFIERS.
- (dump_function_decl): Always dump parms.
-
- * decl2.c (finish_static_data_member_decl): Complain about a local
- class with a static data member.
-
- PR c++/4286
- * search.c (lookup_field_1): Don't xref a static data member
- just because we looked it up.
-
-2002-01-31 Jason Merrill <jason@redhat.com>
-
- * Make-lang.in (parse.c): Handle .output file.
-
- PR c++/3395
- * decl.c (xref_tag): Remember early attributes in TYPE_ATTRIBUTES,
- not TREE_TYPE.
- * semantics.c (finish_class_definition): Adjust.
-
- 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.
-
-2002-01-29 Jakub Jelinek <jakub@redhat.com>
-
- * 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.
-
-2002-01-29 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2002-01-23 Zack Weinberg <zack@codesourcery.com>
-
- * typeck2.c (friendly_abort): Delete definition.
- * cp-tree.h (friendly_abort): Don't prototype.
- (my_friendly_assert): Use fancy_abort.
-
-2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
-
- * cp-tree.h (my_friendly_abort): Remove.
-
-2002-01-23 Jakub Jelinek <jakub@redhat.com>
-
- * 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.
-
-2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
-
- * 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().
-
-2002-01-23 Jason Merrill <jason@redhat.com>
-
- PR c++/5453
- * class.c (fixed_type_or_null): Fix thinko.
-
- PR c++/3331
- * init.c (resolve_offset_ref): Use build_indirect_ref.
-
- * decl2.c (grokclassfn): Don't set DECL_REGISTER on 'this'.
-
-2002-01-22 Jason Merrill <jason@redhat.com>
-
- * 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.
-
- * class.c (build_base_path): Tweak formatting.
-
-2002-01-19 Nathan Sidwell <nathan@codesourcery.com>
-
- Fix regression introduced with patch for c++/775
- * parse.y (class_head_defn): Check for template specializations
- with a different class-key.
-
-2002-01-17 Jason Merrill <jason@redhat.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.
-
- * error.c (dump_type_suffix): Print the exception specs before
- recursing.
- (dump_function_decl): Here, too.
-
- * 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.
-
-2002-01-05 Richard Henderson <rth@redhat.com>
-
- * semantics.c (expand_body): Revert last change.
-
-2002-01-04 Jason Merrill <jason@redhat.com>
-
- PR c++/4122
- * class.c (update_vtable_entry_for_fn): Set delta to zero for a
- lost primary.
-
- * class.c (build_vtbl_initializer): Check for a lost primary
- before calculating the vtable entry to throw away.
-
-2002-01-02 Jason Merrill <jason@redhat.com>
-
- * semantics.c (expand_body): Call outlining_inline_function when
- emitting an inline function out of line.
-
-2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5116, c++/764 reversion
- * call.c (build_new_op): Revert the instantiations. They are
- incorrect.
-
-2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5089
- * decl2.c (reparse_absdcl_as_casts): Don't warn about casts to void.
-
-2002-01-02 Nathan Sidwell <nathan@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.
-
-2002-01-02 Nathan Sidwell <nathan@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.
-
-2002-01-02 Nathan Sidwell <nathan@codesourcery.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.
-
-2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5213
- * pt.c (convert_template_argument): Be more careful determining
- when RECORD_TYPE templates are or are not templates.
-
-2002-01-02 Nathan Sidwell <nathan@codesourcery.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.
-
-2002-01-02 Nathan Sidwell <nathan@codesourcery.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.
-
-2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5132
- * decl2.c (reparse_absdcl_as_casts): Don't digest_init if we
- are processing a template decl.
-
-2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5116, c++/764
- * call.c (build_new_op): Make sure template class operands are
- instantiated. Simplify arglist construction.
-
-2001-12-29 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-12-29 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/5125
- * pt.c (push_template_decl_real): Make sure DECL has
- DECL_LANG_SPECIFIC.
-
-2001-12-29 Nathan Sidwell <nathan@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).
-
-2001-12-26 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/196
- * parse.y (bad_parm): Better diagnostic when given a SCOPE_REF.
-
-2001-12-24 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/160
- * typeck.c (build_modify_expr): Remove old unreachable code & tidy
- up. Don't stabilize_references when initializing a reference.
-
-2001-12-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl2.c (lang_f_options): Const-ify.
-
-2001-12-20 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * config-lang.in (diff_excludes): Remove.
-
-2001-12-19 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/90
- * typeck.c (build_function_call_real): Use original function
- expression for errors.
-
-2001-12-18 Jason Merrill <jason@redhat.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.
-
-2001-12-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-12-18 Jason Merrill <jason@redhat.com>
-
- 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.
-
-2001-12-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * call.c (build_new_method_call): Use '%#V'.
- * error.c (cv_to_string): Use V parameter to determine padding.
-
-2001-12-18 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * call.c, decl2.c, init.c: Use "built-in" and "bit-field"
- spellings in messages.
-
-2001-12-17 Zack Weinberg <zack@codesourcery.com>
-
- * 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.
-
-2001-12-16 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * decl2.c (finish_file): Remove back_end_hook.
-
-2001-12-16 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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.
-
-2001-12-15 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * lang-options.h: Use American spelling in messages.
-
-2001-12-13 Jason Merrill <jason@redhat.com>
-
- * Make-lang.in (parse.h): Separate rule, just depend on parse.c.
-
- 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.
-
- * optimize.c (maybe_clone_body): Fix parameter updating.
-
-2001-12-12 Jason Merrill <jason@redhat.com>
-
- * 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.
-
- * 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.
-
- * 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.
-
- * decl.c (finish_function): Check VMS_TARGET, not VMS.
-
- * decl.c (start_cleanup_fn): Remove redundant pushlevel.
- (end_cleanup_fn): And poplevel.
-
- * semantics.c (setup_vtbl_ptr): Always build a CTOR_INITIALIZER
- if we're in a template.
-
-2001-12-12 Jakub Jelinek <jakub@redhat.com>
-
- * 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.
-
-2001-12-12 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (grokdeclarator): Deprecated implicit typename use.
-
-2001-12-11 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-12-10 Nathan Sidwell <nathan@codesourcery.com>
-
- PR g++/72
- * decl.c (add_binding): Don't reject duplicate typedefs involving
- template parameters.
-
-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.
-
-2001-12-08 Aldy Hernandez <aldyh@redhat.com>
-
- * lex.c (rid_to_yy): Add RID_CHOOSE_EXPR and
- RID_TYPES_COMPATIBLE_P.
-
-2001-12-08 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * 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.
-
-2001-12-08 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * 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.
-
-2001-12-05 Jason Merrill <jason@redhat.com>
-
- * 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.
-
- * init.c (resolve_offset_ref): Don't check access for the base
- conversion to access a FIELD_DECL.
-
- * cp-tree.h (TYPE_REFFN_P): New macro.
- * decl.c (bad_specifiers): Check it, too.
-
- * rtti.c (create_pseudo_type_info): Set CLASSTYPE_INTERFACE_ONLY
- on the __*_type_info type if we haven't seen a definition.
-
-2001-12-05 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * decl.c: Include c-common.h.
- (shadow_warning): Move to c-common.c.
-
-Wed Dec 5 17:00:49 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * decl.c (duplicate_decls): Don't copy DECL_NO_CHECK_MEMORY_USAGE.
-
-2001-12-04 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (end_template_parm_list): Clear TREE_CHAIN of each parm.
-
-2001-12-04 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-12-03 Hans-Peter Nilsson <hp@bitrange.com>
-
- * decl.c (xref_basetypes): Don't use C99 construct in tag_code
- declaration and initialization.
-
-2001-12-03 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * typeck2.c: Remove leading capital from diagnostic messages, as
- per GNU coding standards.
-
-2001-12-03 Mumit Khan <khan@nanotech.wisc.edu>
-
- PR c++/3394
- * decl.c (xref_basetypes): Handle attributes between
- 'class' and name.
-
-2001-12-03 Nathan Sidwell <nathan@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.
-
-2001-12-03 Jason Merrill <jason@redhat.com>
-
- * class.c (finish_vtbls): Fill in BINFO_VPTR_FIELD in the
- immediate binfos for our virtual bases.
-
-2001-12-02 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * 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.
-
-2001-12-01 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * 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.
-
-2001-11-29 Mark Mitchell <mark@codesourcery.com>
-
- 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.
-
-2001-11-29 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * Make-lang.in (c++.generated-manpages): New dummy target.
-
-Tue Nov 27 09:03:47 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * 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.
-
-2001-11-26 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * 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.
-
-2001-11-26 Jason Merrill <jason@redhat.com>
-
- * call.c (joust): Remove COND_EXPR hack.
-
-2001-11-25 Aldy Hernandez <aldyh@redhat.com>
-
- * search.c (lookup_base_r): Declare bk in variable declaration
- space.
-
-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_r): 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.
-
-2001-11-20 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2001-11-19 John Wilkinson <johnw@research.att.com>
-
- * 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,
-
-2001-11-19 Mark Mitchell <mark@codesourcery.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.
-
-2001-11-18 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * lex.c (cxx_finish): Call c_common_finish.
- (finish_parse): Remove.
-
-2001-11-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * decl.c (create_array_type_for_decl): Check if NAME is NULL_TREE
- when displaying error message about missing array bounds.
-
-2001-11-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * mangle.c (write_expression): Handle CAST_EXPR, STATIC_CAST_EXPR,
- CONST_CAST_EXPR.
- * operators.def: Add CAST_EXPR, STATIC_CAST_EXPR, CONST_CAST_EXPR.
-
-2001-11-16 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-tree.h (print_class_statistics): Restore.
-
-2001-11-15 Jason Merrill <jason@redhat.com>
-
- * method.c (use_thunk): Don't emit debugging information for thunks.
-
- * 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.
-
- * 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.
-
- * cvt.c (convert_to_void): If we build a new COND_EXPR, always
- give it void type.
-
-2001-11-15 Nathan Sidwell <nathan@codesourcery.com>
-
- PR g++/3154
- * init.c (sort_base_init): Remove unreachable code.
- (expand_member_init): Adjust comment to reflect reality. Simplify
- and remove unreachable code.
-
-2001-11-15 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * 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.
-
-2001-11-14 Richard Sandiford <rsandifo@redhat.com>
-
- * 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.
-
-2001-11-14 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * Make-lang.in: Change all uses of $(manext) to $(man1ext).
-
-2001-11-13 Nathan Sidwell <nathan@codesourcery.com>
-
- PR g++/4206
- * parse.y (already_scoped_stmt): Remove.
- (simple_stmt, WHILE & FOR): Use implicitly_scoped_stmt.
-
-2001-11-12 H.J. Lu <hjl@gnu.org>
-
- * cvt.c (ocp_convert): Don't warn the address of a weak
- function is always `true'.
-
-2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * 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.
-
-2001-11-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (dump_array): Fix format specifier warning.
-
-2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * 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.
-
-2001-11-08 Andreas Franck <afranck@gmx.de>
-
- * 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.
-
-2001-11-06 Neil Booth <neil@cat.daikokuya.demon.co.uk>
-
- * Make-lang.in: Update.
- * cp-lang.c: Include langhooks-def.h.
-
-2001-11-04 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (tsubst_copy): Call tsubst for TYPEOF_EXPR.
-
-2001-11-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * lex.c (copy_lang_type): Add static prototype.
-
-2001-11-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (unify): Handle SCOPE_REF.
-
-2001-11-01 Jakub Jelinek <jakub@redhat.com>
-
- * tree.c (cp_copy_res_decl_for_inlining): Adjust
- DECL_ABSTRACT_ORIGIN for the return variable.
-
-2001-10-31 Zack Weinberg <zack@codesourcery.com>
-
- * Make-lang.in: Replace $(INTL_TARGETS) with po-generated.
-
-2001-10-28 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * ChangeLog.1, ChangeLog.2, ChangeLog, class.c, decl2.c, search.c,
- semantics.c, spew.c: Fix spelling errors.
-
-2001-10-27 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * decl2.c (validate_nonmember_using_decl): Handle NAMESPACE_DECL.
-
-2001-10-25 Zack Weinberg <zack@codesourcery.com>
-
- * cp-lang.c: Redefine LANG_HOOKS_CLEAR_BINDING_STACK to
- pop_everything.
-
-Tue Oct 23 14:00:20 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * cp-lang.c (cxx_get_alias_set): New function.
- Point LANG_HOOKS_GET_ALIAS_SET to it.
-
-2001-10-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * 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.
-
-2001-10-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * xref.c (GNU_xref_member): Use safe-ctype macros and/or fold
- extra calls into fewer ones.
-
-2001-10-18 Alexandre Oliva <aoliva@redhat.com>
-
- * 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.
-
-2001-10-16 H.J. Lu <hjl@gnu.org>
-
- * cp-tree.h (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Defined
- for tree checking disabled.
-
-2001-10-16 Hans-Peter Nilsson <hp@axis.com>
-
- * cp-tree.h (VFIELD_NAME_FORMAT) [NO_DOLLAR_IN_LABEL &&
- NO_DOT_IN_LABEL]: Adjust to match VFIELD_NAME.
-
-2001-10-15 Richard Sandiford <rsandifo@redhat.com>
-
- * 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.
-
-2001-10-15 Richard Sandiford <rsandifo@redhat.com>
-
- * decl.c (bad_specifiers): Don't allow exception specifications
- on any typedefs.
-
-2001-10-14 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp/lex.c (init_cp_pragma): Similarly.
-
-2001-10-13 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (lookup_template_class): Build complete template arguments
- for BOUND_TEMPLATE_TEMPLATE_PARM.
-
-2001-10-12 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * 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.
-
-2001-10-12 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (determine_specialization): Ignore functions without
- DECL_TEMPLATE_INFO.
-
-2001-10-12 Nathan Sidwell <nathan@codesourcery.com>
-
- PR g++/4476
- * typeck2.c (abstract_virtuals_error): Ignore incomplete classes.
-
-2001-10-11 Jason Merrill <jason_merrill@redhat.com>
-
- * typeck2.c (store_init_value): Don't re-digest a bracketed
- initializer.
-
- * class.c (finish_struct_anon): Use TYPE_ANONYMOUS_P instead of
- ANON_AGGR_TYPE_P.
-
-2001-10-11 Richard Henderson <rth@redhat.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.
-
-2001-10-10 Richard Henderson <rth@redhat.com>
-
- * parse.y (asm_operand): Allow named operands.
- * semantics.c (finish_asm_stmt): Tweek for changed location
- of the operand constrant.
-
-2001-10-09 Jason Merrill <jason_merrill@redhat.com>
-
- * 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.
-
-2001-10-08 Alexandre Oliva <aoliva@redhat.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.
-
-2001-10-08 Richard Henderson <rth@redhat.com>
-
- * cp-tree.h (struct lang_decl_flags): Remove declared_inline.
- (DECL_DECLARED_INLINE_P): Use the bit in struct c_lang_decl.
-
-2001-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * 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.
-
-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.
-
-2001-10-03 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * rtti.c (get_tinfo_decl): Call typeinfo_in_lib_p with the type used
- to build the declaration instead of the declaration itself.
-
-2001-10-02 Jason Merrill <jason_merrill@redhat.com>
-
- * decl2.c (cxx_decode_option): Add 'else'.
-
- * spew.c (end_input): No longer static.
- * cp-tree.h: Declare it.
- * parse.y (datadef): Add "error END_OF_SAVED_INPUT" expansion.
-
-2001-10-02 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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.
-
-2001-10-02 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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.
-
-2001-10-01 Jason Merrill <jason_merrill@redhat.com>
-
- * decl.c (grokdeclarator): Copy array typedef handling from C
- frontend.
-
- * decl.c (grokdeclarator): Copy too-large array handling from C
- frontend.
-
-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.
-
-Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com>
-
- * decl.c (grokdeclarator): Use C syntax for attr_flags declaration.
-
-2001-09-21 Joseph S. Myers <jsm28@cam.ac.uk>
-
- 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.
-
-2001-09-04 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/4203
- * call.c (build_over_call): Do not optimize any empty base
- construction.
-
-2001-08-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * error.c (dump_template_decl): Output template parameters
- together with their specifiers.
- Output `class' prefix for template template parameter.
- (dump_decl): Fix formatting.
-
-2001-08-30 Kurt Garloff <garloff@suse.de>
-
- * optimize.c (inlinable_function_p): Allow only smaller single
- functions. Halve inline limit after reaching recursive limit.
-
-2001-08-30 Joern Rennecke <amylaar@redhat.com>
- Jason Merrill <jason_merrill@redhat.com>
-
- * class.c (build_vtable_entry_ref): Subtract in char*, not
- ptrdiff_t.
-
-2001-08-23 Jason Merrill <jason_merrill@redhat.com>
-
- * 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.
-
- * 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.
-
-2001-08-22 Jason Merrill <jason_merrill@redhat.com>
-
- * 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.
-
-2001-08-19 Jakub Jelinek <jakub@redhat.com>
-
- * typeck2.c (add_exception_specifier): Only require complete type if
- not in processing template declaration.
-
-2001-08-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl.c: Cast argument to size_t, not HOST_WIDE_INT, in calls to
- GNU_xref_start_scope and GNU_xref_end_scope.
-
- * tree.c (TYPE_HASH): Moved to ../tree.h.
-
-2001-08-16 Mark Mitchell <mark@codesourcery.com>
-
- * cvt.c (convert_to_void): Preserve TREE_SIDE_EFFECTS
- on COMPOUND_EXPRs.
-
-2001-08-14 Richard Henderson <rth@redhat.com>
-
- * class.c, cp-tree.h (build_vfn_ref): Remove.
- * call.c, rtti.c: Replace all refernces with build_vtbl_ref.
-
-2001-08-13 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (build_over_call): Mark COMPOUND_EXPRs generated for
- empty class assignment as having side-effects to avoid
- spurious warnings.
-
-2001-08-13 Zack Weinberg <zackw@panix.com>
-
- * Make-lang.in (cp/except.o): Add libfuncs.h to dependencies.
- * except.c: Include libfuncs.h.
-
-2001-08-11 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
-
- * decl.c (grokdeclarator): Clarify diagnostic message.
-
-2001-08-13 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * decl2.c (do_nonmember_using_decl): Replace using directive
- with using declaration in the error message.
-
-2001-08-11 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (maybe_fold_nontype_arg): Use TREE_TYPE of ARG as the
- criterion to avoid rebuilding expression tree instead of
- processing_template_decl.
-
-2001-08-07 Jason Merrill <jason_merrill@redhat.com>
-
- 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.
-
-2001-08-09 Richard Henderson <rth@redhat.com>
-
- * decl2.c (finish_objects): Use target hooks instead of
- assemble_constructor and assemble_destructor.
-
-2001-08-08 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * g++spec.c (lang_specific_driver): Quote argument after `-Xlinker'.
-
-2001-08-07 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-08-07 Jason Merrill <jason_merrill@redhat.com>
-
- * tree.c (walk_tree): Walk siblings even if !walk_subtrees.
-
-2001-08-06 Richard Henderson <rth@redhat.com>
-
- * decl2.c (finish_objects): Pass a symbol_ref and priority to
- assemble_{constructor,destructor}. Remove priority handling.
-
-2001-08-05 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
-
- Don't allow template-id in using-declaration.
- * decl2.c (validate_nonmember_using_decl): Handle template-ids.
- (do_class_using_decl): Likewise.
-
-2001-08-04 Neil Booth <neil@cat.daikokuya.demon.co.uk>
-
- * cp/spew.c (read_token): No need to pop buffers.
-
-2001-08-02 Stan Shebs <shebs@apple.com>
-
- * cp-tree.h (FNADDR_FROM_VTABLE_ENTRY): Remove, no longer used.
- (fnaddr_from_vtable_entry): Remove decl.
- * method.c (use_thunk): Update comment.
-
-2001-08-01 Andrew Cagney <ac131313@redhat.com>
-
- * repo.c (get_base_filename): Change return value to const char
- pointer.
-
-2001-08-02 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-07-31 Alexandre Petit-Bianco <apbianco@redhat.com>
-
- * tree.c (cp_tree_equal): WITH_CLEANUP_EXPR node to use its second
- operand while calling cp_tree_equal.
-
-2001-07-31 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
- 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.
-
-2001-07-31 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/3631
- * class.c (update_vtable_entry_for_fn): The fixed adjustment
- of a virtual thunk should be from declaring base.
-
-2001-07-31 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (dfs_ctor_vtable_bases_queue_p): Always walk into
- the shared virtual base, so preserving inheritance graph order.
-
-2001-07-30 Andreas Jaeger <aj@suse.de>
-
- * decl2.c: Remove unused var global_temp_name_counter.
-
-2001-07-28 Richard Henderson <rth@redhat.com>
-
- * method.c (pending_inlines): Remove.
-
-2001-07-27 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-07-27 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (finish_struct_1): When copying the primary base's
- VFIELD, make sure we find it is at offset zero.
-
-2001-07-26 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (tsubst_template_parms): Call maybe_fold_nontype_arg and
- tsubst_expr for default template arguments.
-
-2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/3621
- * spew.c (yylex): Only copy the token's lineno, if it is
- nonzero.
-
-2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (last_function_parm_tags): Remove.
- (current_function_parm_tags): Remove.
- (init_decl_processing): Adjust.
- (start_function): Adjust.
- (store_parm_decls): Adjust.
-
- PR c++/3152
- * decl.c (grokdeclarator): Detect when a function typedef is
- declaring a function, and create last_function_parms correctly.
-
-2001-07-25 Jason Merrill <jason_merrill@redhat.com>
-
- * call.c (joust): Only prefer a non-builtin candidate to a builtin
- one if they have the same signature.
-
- * 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.
-
-2001-07-25 Nathan Sidwell <nathan@codesourcery.com>
-
- 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 uninitialized
- 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
- behavior. 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.
-
-2001-07-18 Xavier Delacour <xavier@fmaudio.net>,
- Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
-
- * NEWS (Changes in GCC 3.0): Fix typo.
-
-2001-07-13 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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.
-
-2001-07-12 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (make_rtl_for_nonlocal_decl): Set DECL_C_HARD_REGISTER
- for `register' variables with an asm-specification.
-
-2001-07-11 Mark Mitchell <mark@codesourcery.com>
-
- * semantics.c (finish_asm_stmt): Mark the output operands
- to an asm addressable, if necessary.
-
-2001-07-11 Ben Elliston <bje@redhat.com>
-
- * Revert this change -- there is a subtle bug.
-
- 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.
-
-2001-07-10 Mark Mitchell <mark@codesourcery.com>
-
- * pt.c (tsubst_decl): Set DECL_CONTEXT for namespace-scope
- variables.
-
-2001-07-10 Jason Merrill <jason_merrill@redhat.com>
-
- * semantics.c (cp_expand_stmt): Fix for null
- current_function_return_value.
-
-2001-07-10 Jan van Male <jan.vanmale@fenk.wau.nl>
-
- * 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.
-
-2001-07-09 Erik Rozendaal <dlr@acm.org>
-
- * 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.
-
-2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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.
-
-2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update
- calls to decl_attributes.
-
-2001-07-06 Ira Ruben <ira@apple.com>
-
- * cp-tree.def (TEMPLATE_DECL): Update comment. DECL_RESULT should
- be DECL_TEMPLATE_RESULT.
-
-2001-07-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * 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.
-
-2001-07-05 Jason Merrill <jason_merrill@redhat.com>
-
- * 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.
-
- * 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.
-
-2001-07-02 Nathan Sidwell <nathan@codesourcery.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.
-
-2001-06-29 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * typeck.c (COMP_TYPE_ATTRIBUTES): Don't define.
- (comptypes): Use target.comp_type_attributes.
-
-2001-06-29 Nathan Sidwell <nathan@codesourcery.com>
-
- * cp-tree.h (flag_dump_class_layout): Remove unneeded declaration.
-
-2001-06-28 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
-
- * error.c (lang_print_error_function): Add a `diagnostic_context *'
- parameter. Tweak.
-
-2001-06-27 Neil Booth <neil@cat.daikokuya.demon.co.uk>
-
- * decl2.c (import_export_class): Update.
-
-2001-06-26 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * error.c (init_error): Adjust settings.
-
-2001-06-26 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * error.c (init_error): Adjust settings.
-
-2001-06-19 Richard Sandiford <rsandifo@redhat.com>
-
- * except.c (initialize_handler_parm): Expect __cxa_begin_catch to
- return pointers to data members by reference rather than by value.
-
-2001-06-18 Jason Merrill <jason_merrill@redhat.com>
-
- 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.
-
-2001-06-15 Jason Merrill <jason_merrill@redhat.com>
-
- * 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.
-
-2001-06-14 Jason Merrill <jason_merrill@redhat.com>
-
- * class.c (dfs_find_final_overrider): Fix logic.
-
- * class.c (update_vtable_entry_for_fn): Uncomment optimization to use
- virtual thunk instead of non-virtual.
- (get_matching_virtual): Uncomment.
-
- * 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.
-
-2001-06-14 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-06-13 Mark Mitchell <mark@codesourcery.com>
-
- * NEWS: Update release number.
-
-2001-06-12 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-06-12 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-06-11 Mark Mitchell <mark@codesourcery.com>
-
- * lang-options.h: Emit documentation for -fno-honor-std, not
- -fhonor-std.
-
-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 (find_final_overrider): Return error_mark_node on error.
-
- * decl2.c (key_method): #if 0 accidental change.
-2001-06-06 John David Anglin <dave@hiauly1.hia.nrc.ca>
+2004-01-15 Alexandre Oliva <aoliva@redhat.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.
-
-2001-06-05 Mark Mitchell <mark@codesourcery.com>
-
- * semantics.c (begin_class_definition): Robustify.
-
- * 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.
-
-2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * call.c (build_user_type_conversion_1): Set ICS_USER_FLAG and
- ICS_BAD_FLAG on created conversion.
- (compare_ics): Break out rank.
-
-2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (xref_tag): Remove extraneous %s on dependent name
- lookup warning.
-
-2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (layout_vtable_decl): Fix off by one error on
- build_index_type.
- (build_vtt): Likewise.
- (build_ctor_vtbl_group): Likewise.
-
-2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-06-01 Nathan Sidwell <nathan@codesourcery.com>
-
- PR g++/2936
- Part missed from first commit
- * decl2.c (finish_anon_union): Copy context.
-
-2001-05-30 Nathan Sidwell <nathan@codesourcery.com>
-
- PR g++/2936
- * optimize.c (remap_decl): Remap anonymous aggregate members too.
-
-2001-05-26 Nathan Sidwell <nathan@codesourcery.com>
-
- PR g++/2823
- * semantics.c (expand_body): Don't optimize thunks.
-
-2001-05-25 Sam TH <sam@uchicago.edu>
-
- * cp-tree.h lex.h: Fix header include guards.
-
-2001-05-25 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (init_decl_processing): Tweak.
-
-2001-05-24 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (duplicate_decls): Tidy.
- (init_decl_processing): Always set flag_no_builtin.
-
-2001-05-24 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/2184
- * decl2.c (do_local_using_decl): Push the decls, even in a
- template.
-
-2001-05-22 Mark Mitchell <mark@codesourcery.com>
-
- * optimize.c (initialize_inlined_parameters): Don't set
- TREE_READONLY for a VAR_DECL taking the place of an inlined
- PARM_DECL.
-
-2001-05-22 Jason Merrill <jason_merrill@redhat.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.
-
-2001-05-22 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * parse.y: Refer to compound literals as such, not as
- constructor-expressions.
-
-2001-05-21 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2001-05-21 Jason Merrill <jason_merrill@redhat.com>
-
- * 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.
-
- * decl2.c (maybe_make_one_only): Check flag_weak, not
- supports_one_only().
-
- * 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.
+ PR c++/13659
+ * name-lookup.c (validate_nonmember_using_decl): Take scope and
+ name by value, instead of computing them.
+ (do_local_using_decl, do_toplevel_using_decl): Add scope and name
+ arguments. Pass them to validate_nonmember_using_decl.
+ * name-lookup.h (do_local_using_decl): Adjust.
+ (do_toplevel_using_decl): Likewise.
+ * parser.c (cp_parser_using_declaration): Likewise.
* 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.
-
-2001-05-18 Jason Merrill <jason_merrill@redhat.com>
-
- * class.c (build_vtable): Set DECL_ASSEMBLER_NAME for vtables here.
- (get_vtable_decl, build_vtt): Not here.
-
-2001-05-20 Nathan Sidwell <nathan@codesourcery.com>
-
- PR c++/2781
- * optimize.c (update_cloned_parm): Copy addressability and other
- flags.
-
-2001-05-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (determine_specialization): Ignore artificial functions.
-
-2001-05-20 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * 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.
-
-2001-05-18 Diego Novillo <dnovillo@redhat.com>
-
- * decl2.c (finish_objects): Use the original SYMBOL_REF from the
- function declaration to avoid stripping the symbol's attributes.
-
-2001-05-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (pushdecl): Adjust error string.
- (xref_tag): Adjust friend class injection warning. Remove the
- inherited name from the class shadowed scope.
-
-2001-05-17 Mark Mitchell <mark@codesourcery.com>
-
- * except.c (cp_protect_cleanup_actions): New function.
- (init_exception_processing): Don't set protect_cleanup_actions
- here. Do set lang_protect_cleanup_actions.
-
-2001-05-16 Nathan Sidwell <nathan@codesourcery.com>
-
- * spew.c (read_token): Call yyerror on all unexpected tokens.
-
-2001-05-16 Nathan Sidwell <nathan@codesourcery.com>
-
- * init.c (member_init_ok_or_else): Take a tree rather than
- string for name.
- (expand_member_init): Adjust.
-
-2001-05-14 Nick Clifton <nickc@cambridge.redhat.com>
-
- * decl.c (duplicate_decls): Suppress warning about duplicate
- decls if the first decl is a friend.
-
-2001-05-12 Zack Weinberg <zackw@stanford.edu>
-
- * 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.
-
-2001-05-12 Neil Booth <neil@cat.daikokuya.demon.co.uk>
-
- * method.c (build_mangled_C99_name): Remove unused prototype.
-
-2001-05-12 Alexandre Oliva <aoliva@redhat.com>
-
- * 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.
-
- Reverted Geoff Keating's 2001-05-03's patch.
-
-2001-05-11 Ira Ruben <ira@apple.com>
-
- * cp/cp-tree.h (C_EXP_ORIGINAL_CODE): Delete; declared in c-common.h.
-
-2001-05-11 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp-tree.h (finish_label_expr, lookup_label): Delete.
- * parse.y: Update for '&&'; don't issue warning here.
- * semantics.c (finish_label_expr): Delete.
-
-2001-05-07 Mark Mitchell <mark@codesourcery.com>
-
- * splay-tree.h (splay_tree_max): New function.
- (splay_tree_min): Likewise.
-
-2001-05-03 Geoffrey Keating <geoffk@redhat.com>
-
- * 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.
-
-2001-05-03 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2001-05-03 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
- * tree.c (walk_tree): Reformat an if block.
-
-2001-05-02 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (compute_array_index_type): Don't try to do anything with
- the indices when processing a template.
-
-2001-05-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * 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.
-
-2001-05-02 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (do_using_directive): Revert previous patch.
-
-2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
-
- * call.c (build_new_op): Convert args from reference here.
- (build_conditional_expr): Don't convert here.
-
-2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
-
- * spew.c (last_token_id): New static variable.
- (read_token): Set it here.
- (yyerror): Use it here.
-
-2001-04-30 Richard Henderson <rth@redhat.com>
-
- * cvt.c: Downcase C_PROMOTING_INTEGER_TYPE_P invocations.
- * decl.c: Likewise.
-
-2001-04-30 Mark Mitchell <mark@codesourcery.com>
-
- * gxxint.texi: Remove.
- * Make-lang.in: Remove all traces of gxxint.texi.
-
-Mon Apr 30 16:14:10 2001 Mark P Mitchell <mark@codesourcery.com>
-
- * decl2.c (start_static_initialization_or_destruction): Correct
- logic to handle the -fno-use-cxa-atexit case.
-
-2001-04-30 Mark Mitchell <mark@codesourcery.com>
-
- * optimize.c (update_cloned_parm): New function.
- (maybe_clone_body): Use it. Update the `this' parameter too.
-
-2001-04-29 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * decl2.c (unsupported_options): Add new-abi.
- * lang-options.h: Remove no longer supported options.
-
-2001-04-27 Nathan Sidwell <nathan@codesourcery.com>
-
- * except.c (can_convert_eh): Don't check template parms,
- typename types etc.
-
-2001-04-27 Nathan Sidwell <nathan@codesourcery.com>
-
- * optimize.c (maybe_clone_body): Copy parameter names and locations.
-
-2001-04-27 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-04-26 Mark Mitchell <mark@codesourcery.com>
-
- * method.c (use_thunk): Make sure that thunks really are emitted
- when requested.
-
-2001-04-26 Nathan Sidwell <nathan@codesourcery.com>
-
- * mangle.c (write_chars): New macro.
- (hwint_to_ascii): New function
- (write_number): Use it.
- (write_integer_cst): Deal with really big numbers.
-
-2001-04-25 Mark Mitchell <mark@codesourcery.com>
-
- * optimize.c (maybe_clone_body): Copy TREE_PUBLIC before emitting
- the clone.
-
-2001-04-25 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (grokdeclarator): Set context of namespace scope
- TYPE_DECLS.
-
-2001-04-24 Zack Weinberg <zackw@stanford.edu>
-
- * 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.
-
-2001-04-24 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-04-24 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (tsubst_decl): Use VOID_TYPE_P.
- * semantics.c: Fix some typos.
-
-2001-04-23 Phil Edwards <pme@sources.redhat.com>
-
- * cp/decl2.c (flag_honor_std): Always initialize to 1.
-
-2001-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * xref.c (GNU_xref_file): Use concat in lieu of xmalloc/sprintf.
-
-2001-04-23 Jason Merrill <jason_merrill@redhat.com>
-
- * except.c (build_throw): Wrap the initialization of the exception
- object in a MUST_NOT_THROW_EXPR.
- (do_free_exception): #if 0.
-
-2001-04-20 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (finish_enum): Change prototype.
- * decl.c (finish_enum): Reorganize.
- * parse.y (structsp): Adjust calls to finish_enum.
-
-2001-04-20 Nathan Sidwell <nathan@codesourcery.com>
-
- * tree.c (cp_tree_equal): Adjust final switch formatting. Add
- 't' case.
-
-2001-04-20 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-04-20 Jakub Jelinek <jakub@redhat.com>
-
- * call.c (maybe_handle_ref_bind): Copy ICS_USER_FLAG and
- ICS_BAD_FLAG.
-
-2001-04-20 Jakub Jelinek <jakub@redhat.com>
-
- * 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.
-
-2001-04-19 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
- (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.
-
- * decl.c (current_class_depth, global_namespace): Likewise.
-
- * decl2.c (current_class_depth, flag_gnu_xref): Likewise
-
- * repo.c (flag_use_repository): Likewise.
-
-2001-04-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * 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.
-
-2001-04-11 Jason Merrill <jason_merrill@redhat.com>
-
- * 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.
-
-2001-04-12 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (dfs_unshared_virtual_bases): New function.
- (mark_primary_bases): Call it.
- (check_bases): Ignore virtual bases when determining
- nearly-emptiness.
-
-2001-04-12 Nathan Sidwell <nathan@codesourcery.com>
-
- * method.c (make_thunk): Clear DECL_CLONED_FUNCTION.
-
-2001-04-11 Mark Mitchell <mark@codesourcery.com>
-
- * optimize.c (maybe_clone_body): Copy DECL_NUM_STMTS from the
- cloned function to the clone.
-
-2001-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (cp/semantics.o): Depend on $(EXPR_H).
-
- * semantics.c: Include expr.h.
-
-2001-04-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * method.c (implicitly_declare_fn): Commonize code for copy ctor
- and assignment op. Set TREE_USED for parameter.
-
-2001-04-10 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2001-04-10 Richard Henderson <rth@redhat.com>
-
- * typeck.c (build_array_ref): Push the array reference inside
- COMPOUND_EXPR and COND_EXPR.
-
-2001-04-05 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
- (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.
-
-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.
- (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.
-
-2001-03-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (add_method): Use memcpy/memmove, not bcopy.
-
- * decl.c (duplicate_decls): Likewise.
-
-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 nonzero.
- (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.
-
- * error.c (GLOBAL_THING): Always use '__'.
-
-2001-03-21 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (build_clone): Clear DECL_ASSEMBLER_NAME.
-
- * mangle.c (mangle_decl_string): Mangle the names of overloaded
- operators, even when they have `extern "C"' linkage.
-
-2001-03-19 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2001-03-15 Gabriel Dos Reis <gdr@codesourcery.com>
-
- Correct semantics restrictions checking in throw-expression.
- * except.c (is_admissible_throw_operand): New function.
- (build_throw): Use it.
-
-2001-03-14 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (cp_make_fnname_decl): Set DECL_IGNORED_P on __FUNCTION__
- and its ilk.
-
-2001-03-14 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2001-03-12 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-03-10 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp/lex.c: Delete duplicate pending_lang_change.
-
-2001-03-10 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * 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.
-
-2001-03-09 Zack Weinberg <zackw@stanford.edu>
-
- * Make-lang.in: Add dependencies on $(TM_P_H) as appropriate.
-
-2001-03-08 Stan Shebs <shebs@apple.com>
-
- * cp-tree.h (set_identifier_local_value): Remove unused decl.
-
-2001-03-06 Zack Weinberg <zackw@stanford.edu>
-
- * spew.c: Remove references to CPP_OSTRING.
-
-2001-03-06 Andrew Haley <aph@redhat.com>
-
- * typeck.c (convert_arguments): Check that we have an fndecl.
-
-2001-03-05 Andrew Haley <aph@redhat.com>
-
- * typeck.c (convert_arguments): Don't do ellipsis conversion for
- __built_in_constant_p.
-
-2001-03-02 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck.c (build_static_cast): Allow enum to enum conversions
- as per DR 128.
-
-2001-03-02 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (check_field_decls): Pointers to member do not a
- non-pod struct make, as per DR 148.
-
-2001-03-02 Nathan Sidwell <nathan@codesourcery.com>
-
- * call.c (joust): cp_pedwarn when using gnu extension concerning
- worst conversion sequences.
-
-2001-03-01 Zack Weinberg <zackw@stanford.edu>
-
- * decl.c: Replace all uses of 'boolean' with 'bool'.
-
-2001-03-01 Zack Weinberg <zackw@stanford.edu>
-
- * 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.
-
-2001-03-01 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-03-01 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl2.c (do_nonmember_using_decl): Don't complain if we find
- same function. Do complain about ambiguating extern "C"
- declarations.
-
-2001-02-28 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-02-27 Jeffrey Oldham <oldham@codesourcery.com>
-
- * except.c (call_eh_info): Revert "match_function"'s type.
-
-2001-02-27 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-02-26 Jeffrey Oldham <oldham@codesourcery.com>
-
- * call.c (joust): Ensure more_specialized()'s argument length
- parameter has correct value for constructors.
-
-2001-02-26 Nathan Sidwell <nathan@codesourcery.com>
-
- * except.c (call_eh_info): Cleanup generation of cp_eh_info struct.
-
- * decl.c (mark_inlined_fns): Prototype.
-
-2001-02-22 Mark Mitchell <mark@codesourcery.com>
-
- * spew.c (yylex): Correct handling of friends.
-
-2001-02-22 Mark Mitchell <mark@codesourcery.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.
-
-2001-02-22 Andreas Jaeger <aj@suse.de>
-
- * optimize.c: Include toplev.h for
- note_deferral_of_defined_inline_function prototype.
-
-2001-02-22 Jakub Jelinek <jakub@redhat.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.
-
-2001-02-21 Jason Merrill <jason@redhat.com>
-
- * cp-tree.h (struct lang_decl_flags): Remove uninlinable flag.
- (DECL_UNINLINABLE): Move to middle-end.
-
- * 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.
-
- * method.c (implicitly_declare_fn): Don't set DECL_ARTIFICIAL on
- second parm of op=.
-
-2001-02-19 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (set_decl_namespace): Allow explicit instantiations in
- any namespace.
-
-2001-02-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * optimize.c (expand_call_inline): Don't walk subtrees of type
- nodes.
-
-2001-02-18 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (add_vcall_offset_vtbl_entries_1): Only add one entry
- for a destructor.
-
-2001-02-18 Jason Merrill <jason@redhat.com>
-
- 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.
-
- * semantics.c (finish_typeof): Resolve OFFSET_REFs.
-
- * pt.c (check_explicit_specialization): Copy TREE_PRIVATE and
- TREE_PROTECTED from the template being specialized.
-
-2001-02-17 Jason Merrill <jason@redhat.com>
-
- * decl2.c (build_artificial_parm): Set TREE_READONLY.
-
- * 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.
-
-2001-02-17 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (check_dtor_name): Handle template names correctly.
-
-2001-02-16 Jason Merrill <jason@redhat.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.
-
-2001-02-16 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * decl.c (check_tag_decl): Make sure a typedef for an anonymous
- class-type introduces at least a type-name.
-
-2001-02-16 Jakub Jelinek <jakub@redhat.com>
-
- * call.c (convert_like_real): Create a temporary for non-lvalue.
-
-2001-02-16 Jeffrey Oldham <oldham@codesourcery.com>
-
- * cp-tree.h: Fix typos in comments.
-
-2001-02-16 Jason Merrill <jason@redhat.com>
-
- * optimize.c (remap_block): If we're compiling a clone, pass the
- new block to insert_block.
-
-2001-02-16 Mark Mitchell <mark@codesourcery.com>
-
- * semantics.c (finish_asm_stmt): Robustify.
-
-2001-02-15 Mark Mitchell <mark@codesourcery.com>
-
- * pt.c (push_template_decl_real): Don't remangle the name of a
- class template.
-
-2001-02-15 Jim Meyering <meyering@lucent.com>
-
- * Make-lang.in (c++.install-common): Depend on installdirs.
- (c++.install-info): Likewise.
- (c++.install-man): Likewise.
-
-2001-02-15 Mark Mitchell <mark@codesourcery.com>
-
- * typeck2.c (build_m_component_ref): Robustify.
-
-2001-02-15 Alexandre Oliva <aoliva@redhat.com>
-
- * 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.
-
-2001-02-14 Jakub Jelinek <jakub@redhat.com>
-
- * typeck.c (build_unary_op): Clarify error message.
-
-2001-02-08 Aldy Hernandez <aldyh@redhat.com>
-
- * parse.y (component_constructor_declarator): allow optional
- parentheses around constructor class name.
-
-2001-02-14 Nathan Sidwell <nathan@codesourcery.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.
-
-2001-02-14 Nathan Sidwell <nathan@codesourcery.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.
-
-2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (unify): Don't check cv quals of array types.
-
-2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
-
- * tree.c (cp_build_qualified_type_real): Use CP_TYPE_QUALS to
- check whether we already have the type.
-
-2001-02-13 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2001-02-13 Jason Merrill <jason@redhat.com>
-
- * lang-specs.h: Add more __EXCEPTIONS.
-
-2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck2.c (process_init_constructor): Check
- TREE_HAS_CONSTRUCTOR before issuing missing init warning.
-
-2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (maybe_adjust_types_for_deduction, DEDUCE_ORDER case):
- Remove spurious information in comment. Allow further
- adjustments of REFERENCE_TYPE args.
-
-2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
-
- * errfn.c (cp_deprecated): Tweak diagnostic text.
- * parse.y (new_initializer): Deprecate initializer lists
- extension.
-
-2001-02-12 Mark Mitchell <mark@codesourcery.com>
-
- Remove old ABI support.
-
-2001-02-11 Mark Mitchell <mark@codesourcery.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.
-
- * Makefile.in (g++spec.o): Fix typo.
-
-2001-02-09 Jason Merrill <jason@redhat.com>
-
- * lang-specs.h: Restore definition of __EXCEPTIONS.
-
-2001-02-08 Jason Merrill <jason@redhat.com>
-
- * search.c (shared_member_p): New function.
- (lookup_field_r): Use it.
- * cp-tree.h (SHARED_MEMBER_P): Remove.
-
- * 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.
-
- * decl.c (lookup_name_real): Tweak warning to refer to decls, not
- types.
-
- * typeck2.c (friendly_abort): Don't say anything if we have
- earlier errors or sorries.
-
- * decl.c (check_tag_decl): Notice attempts to redefine bool and
- wchar_t. Ignore if in_system_header.
-
- * 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.
-
-2001-02-07 Mark Mitchell <mark@codesourcery.com>
-
- * lang-specs.h: Use CPLUSPLUS_CPP_SPEC for the preprocessor
- spec.
-
-2001-02-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-02-05 Alexandre Oliva <aoliva@redhat.com>
-
- * method.c (build_mangled_name) [old abi]: Protect flush_repeats()
- from error_mark_node.
-
-2001-02-05 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-01-25 Jakub Jelinek <jakub@redhat.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.
-
-2001-01-24 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (tsubst_decl): Remove IN_DECL parameter.
- (tsubst_arg_types): Check parameter is not void.
- (tsubst): Adjust tsubst_decl call.
-
-2001-01-24 Nathan Sidwell <nathan@codesourcery.com>
-
- * call.c (add_builtin_candidate): Quote std properly, from
- previous change.
-
-2001-01-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (check_explicit_specialization): Clone constructors and
- destructors.
-
-2001-01-23 Nathan Sidwell <nathan@codesourcery.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.
-
-2001-01-23 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-01-22 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-01-19 Jason Merrill <jason@redhat.com>
-
- * decl2.c (flag_vtable_thunks): Also depend on ENABLE_NEW_GXX_ABI.
-
- * decl.c (init_decl_processing): Just force -fvtable-thunks on if
- -fnew-abi.
-
-2001-01-19 Ute Pelkmann <scope.muc@t-online.de>
-
- * decl2.c (arg_assoc_class): Fix double iteration logic.
-
-2001-01-19 Jason Merrill <jason@redhat.com>
-
- * init.c (build_delete): Always call convert_force to strip cv-quals.
-
- * 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.
-
-2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
-
- * search.c (get_vbase_1): Count only virtual bases.
-
-2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (duplicate_tag_error): Robustify flag clearing.
-
-2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (copy_default_args_to_explicit_spec): Preserve
- object's CV quals. Reorganize.
-
-2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck.c (build_modify_expr): Say `initialization' for
- INIT_EXPRs.
- * init.c (build_default_init): Convert to enumeral type, if
- needed.
-
-2001-01-18 Jakub Jelinek <jakub@redhat.com>
-
- * parse.y (nomods_initdcl0): Properly set things up for
- initdcl0_innards.
-
-2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (UNIFY_ALLOW_OUTER_LEVEL): New unify flag.
- (type_unification_real): Set it.
- (unify): Use it.
-
-2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (finish_destructor_body): Convert to vbase pointer here.
-
-2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * semantics.c (begin_class_definition): Check we're not inside a
- template parm list.
-
-2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * tree.c (walk_tree, TREE_LIST): Don't walk the TREE_PURPOSE of
- BASELINK_P.
-
-2001-01-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * typeck.c (build_function_call_real): Call fold on the CALL_EXPR.
- * call.c (build_over_call): Add comment.
-
-2001-01-16 Daniel Berlin <dberlin@redhat.com>
-
- * cvt.c (ocp_convert): Handle vector type conversion
- * typeck2.c (digest_init): Handle vector type initializations
-
-2001-01-16 Phil Edwards <pme@sources.redhat.com>
-
- * g++spec.c: Don't add libraries needlessly if -fsyntax-only
- was given.
-
-2001-01-15 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (check_nontype_parm): Rename to ...
- (invalid_nontype_parm_type_p): ... here.
- (process_template_parm): Adjust.
- (convert_template_argument): Adjust.
-
-2001-01-15 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-01-14 Jeffrey Oldham <oldham@codesourcery.com>
-
- * tree.c: Add defaults.h
- (cp_valid_lang_attribute): Incorporate SUPPORTS_INIT_PRIORITY.
- * Make-lang.in (cp/tree.o): Add defaults.h.
-
-2001-01-13 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * Make-lang.in (CXX_C_OBJS): Add c-format.o.
-
-2001-01-13 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * g++.1: Change to be ".so man1/gcc.1".
-
-2001-01-13 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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.
-
-2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck.c (build_c_cast): Do template processing earlier.
- Always pedwarn on array casts.
-
-2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
-
- * friend.c (make_friend_class): Make sure a templated class is
- actually a template.
-
-2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl2.c (get_guard): Set linkage from guarded decl.
-
-2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (unify): Check array has a domain, before checking
- whether it is variable sized.
-
-2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (grokparms): Unobfuscate and get correct diagnostic for
- parameters with pointers to arrays of unknown bound.
-
-2001-01-11 Nathan Sidwell <nathan@codesourcery.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.
-
-2001-01-10 Mark Mitchell <mark@codesourcery.com>
-
- * mangle.c (write_builtin_type): Fix thinko.
-
- * pt.c (copy_default_args_to_explicit_spec_1): New function.
- (copy_default_args_to_explicit_spec): Likewise.
- (check_explicit_specialization): Use it.
-
- * 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.
-
-2001-01-10 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (DECL_CLONED_FUNCTION_P): Avoid wild reads by not
- looking at DECL_CLONED_FUNCTION for non-functions.
-
-2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
-
- * error.c (dump_template_parameter): Use parm to determine how
- to print default value.
-
-2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
-
- * class.c (duplicate_tag_error): Clear more flags.
-
-2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
-
- * call.c (build_new_method_call): Use binfo_for_vbase.
-
-2001-01-10 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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.
-
-2001-01-09 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2001-01-09 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * decl2.c (lang_decode_option): Handle -Wformat=2.
-
-2001-01-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
- * class.c (finish_struct): Constify saved_filename.
-
-2001-01-08 Nathan Sidwell <nathan@codesourcery.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.
-
-2001-01-08 Nathan Sidwell <nathan@codesourcery.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.
-
-2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * 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.
-
-2001-01-07 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (grokfield): Don't accept `asm' specifiers for
- non-static data members.
-
-2001-01-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * expr.c (cplus_expand_expr): Don't reset `target'.
-
-2001-01-07 Neil Booth <neil@daikokuya.demon.co.uk>
-
- * cp/decl2.c (cxx_post_options): Call cpp_post_options.
-
-2001-01-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * parse.y (template_datadef): Check for error_mark_node.
-
-2001-01-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * cp-tree.def (DEFAULT_ARG): Make `x' class.
-
-2001-01-04 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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.
-
-2001-01-04 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (build_conv): Don't use build1 for USER_CONV.
- * pt.c (tsubst_copy): Or for PREINCREMENT_EXPR and similar nodes.
-
-2001-01-03 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * lex.c (lang_init): Call c_common_lang_init.
-
-2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
-
- * search.c (lookup_fnfields_here): Remove.
- (look_for_overrides_r): Use lookup_fnfields_1.
- Ignore functions from using declarations.
-
-2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2001-01-03 Jason Merrill <jason@redhat.com>
-
- * 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_template_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.
-
-2001-01-02 Richard Henderson <rth@redhat.com>
-
- * parse.y (asm): Set ASM_INPUT_P.
-
-2001-01-02 Jason Merrill <jason@redhat.com>
-
- * tree.c (cp_valid_lang_attribute): Don't set CLASSTYPE_COM_INTERFACE
- for v3 ABI.
-
- * typeck.c (cp_truthvalue_conversion): New fn.
- * cvt.c (ocp_convert): Use it.
-
- * cp-tree.h: Lose c-common.c decls.
-
- * typeck.c (build_unary_op): Restore old &a.f diagnostic code.
- * cvt.c (convert_to_void): Use type_unknown_p.
-
- * typeck.c (strip_all_pointer_quals): Also strip quals from
- pointer-to-member types.
-
- * Make-lang.in (cp/TAGS): Use --no-globals. Ignore parse.c, and treat
- parse.y as C.
-
- * call.c (build_new_method_call): Do evaluate the object parameter
- when accessing a static member.
- * typeck.c (build_component_ref): Likewise.
-
-2001-01-02 Andreas Jaeger <aj@suse.de>
-
- * decl.c (cp_missing_noreturn_ok_p): New.
- (init_decl_processing): Set lang_missing_noreturn_ok_p.
-
-2000-12-29 Jakub Jelinek <jakub@redhat.com>
-
- * decl.c (init_decl_processing): Fix sign of wchar_type_node.
-
-2000-12-29 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-12-28 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-12-29 Hans-Peter Nilsson <hp@bitrange.com>
-
- * search.c (binfo_for_vtable): Return least derived class, not
- most. Handle secondary vtables.
-
-2000-12-22 Jason Merrill <jason@redhat.com>
-
- * pt.c (more_specialized): Don't optimize len==0.
- (fn_type_unification): If we're adding the return type, increase len.
-
- * typeck.c (build_binary_op): Fix pmf comparison logic.
-
- * call.c (joust): Use DECL_NONSTATIC_MEMBER_FUNCTION_P, not
- DECL_STATIC_FUNCTION_P.
-
- * semantics.c (genrtl_finish_function): Don't try to jump to
- return_label unless it exists.
-
- 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.
-
-2000-12-21 Jason Merrill <jason@redhat.com>
-
- * pt.c (tsubst_decl): A FUNCTION_DECL has DECL_RESULT, not
- DECL_TEMPLATE_RESULT.
-
- * search.c (lookup_field_r): Call lookup_fnfields_1, not
- lookup_fnfields_here.
-
- * parse.y (typename_sub2): Return the TYPE_DECL, not the type.
-
- * 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.
-
- * error.c (dump_expr): Handle *_CAST_EXPR.
-
- * typeck2.c (build_scoped_ref): Always convert to the naming class.
-
- * 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.
-
-2000-12-20 Richard Henderson <rth@redhat.com>
-
- * 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.
-
-2000-12-18 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * cp-tree.h: Don't declare warn_long_long.
-
-2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * tree.c (no_linkage_helper): Use CLASS_TYPE_P instead of
- IS_AGGR_TYPE.
-
-2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (unify): Handle when both ARG and PARM are
- BOUND_TEMPLATE_TEMPLATE_PARM.
-
-2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (reduce_template_parm_level): Set DECL_ARTIFICIAL and
- DECL_TEMPLATE_PARM_P.
-
-2000-12-15 Jason Merrill <jason@redhat.com>
-
- * init.c (build_new_1): Reorganize. Now with 100% fewer SAVE_EXPRs!
-
- * init.c (build_new_1): Don't strip quals from type.
-
- * decl.c (pushdecl): Don't check for linkage on a non-decl.
-
- * call.c (build_op_delete_call): See through ARRAY_TYPEs.
-
- * call.c (build_new_function_call): Lose space before paren in
- error message.
- (build_new_method_call): Likewise.
-
- * typeck2.c (build_m_component_ref): Propagate quals from datum.
-
-2000-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * pt.c (check_explicit_specialization): Propagate default
- function arguments to explicit specializations.
-
-2000-12-13 DJ Delorie <dj@redhat.com>
-
- * typeck.c (build_binary_op): Do signed/unsigned warnings for >?
- and <? operators.
-
-2000-12-08 Jason Merrill <jason@redhat.com>
-
- * error.c (dump_function_name): Don't let the user see __comp_ctor.
-
- 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.
-
- * pt.c (tsubst_decl): Call clone_function_decl here if this is an
- instantiation of a member template.
- (do_decl_instantiation): Not here.
-
-2000-12-07 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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 (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.
-
-2000-12-07 Nathan Sidwell <nathan@codesourcery.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.
-
-2000-12-07 Jakub Jelinek <jakub@redhat.com>
-
- * optimize.c (copy_body_r): Set STMT_IS_FULL_EXPR_P on EXPR_STMT.
-
-2000-12-07 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * decl2.c (lang_decode_option): Handle -Wformat-security.
-
-2000-12-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-
- * 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.
-
-2000-12-06 Alexandre Oliva <aoliva@redhat.com>
-
- * 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.
-
-2000-12-05 Will Cohen <wcohen@redhat.com>
-
- * decl.c (finish_case_label): Cleared
- more_cleanups_ok in surrounding function scopes.
- (define_label): Likewise.
-
-2000-12-05 Nathan Sidwell <nathan@codesourcery.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.
-
-2000-12-05 Nathan Sidwell <nathan@codesourcery.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.
-
-2000-12-04 Richard Henderson <rth@redhat.com>
-
- * error.c (dump_tree): Use output_add_string not OB_PUTS.
-
-2000-12-04 Jason Merrill <jason@redhat.com>
-
- * 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.
-
- * Make-lang.in: Tweak top comment for emacs.
- (cp/TAGS): Restore.
- * except.c (expand_throw): Use push_throw_library_fn for _Jv_Throw.
+2004-01-15 Alexandre Oliva <aoliva@redhat.com>
- * class.c (clone_function_decl): Robustify.
+ PR c++/13594
+ PR c++/13658
+ * name-lookup.c (qualified_lookup_using_namespace): Search
+ strongly-associated namespaces first, and only then try other
+ namespaces.
-2000-12-04 Michael Matz <matzmich@cs.tu-berlin.de>
+2004-01-15 Kelley Cook <kcook@gcc.gnu.org>
- * decl.c (store_bindings): Only search in the non modified
- old_bindings for duplicates.
+ * Make-lang.in (c++.srcextra): Dummy entry.
-2000-12-04 Nathan Sidwell <nathan@codesourcery.com>
+2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
- * error.c (dump_function_decl): Use DECL_VIRTUAL_P, not
- TYPE_POLYMORPHIC_P.
+ PR c++/8856
+ * parser.c (cp_parser_template_name): Don't try to parse a
+ conversion-function-id, as it cannot be a template-name.
+ (cp_parser_simple_type_specifier): Check for invalid template-ids
+ even after a built-in type.
- * typeck.c (build_static_cast): Remove unused variable.
+2004-01-14 Jan Hubicka <jh@suse.cz>
-2000-12-01 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+ PR c++/12850
+ * pt.c (instantiate_decl): Do not increase function_depth.
- * pt.c: Fix typo in comment.
+2004-01-14 Danny Smith <dannysmith@users,sourceforge.net>
-2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
+ PR c++/9021
+ PR c++/11005
+ * parser.c (cp_parser_elaborated_type_specifier): Warn about
+ attributes and discard.
+ * decl.c (xref_tag): Don't overwite existing attributes with
+ NULL_TREE.
- * decl2.c (warn_format): Remove definition.
- (lang_decode_option): Handle -Wformat-nonliteral,
- -Wno-format-extra-args and -Wno-format-y2k. Use set_Wformat.
+2004-01-14 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
+ PR c++/12335
+ * parser.c (cp_parser_lookup_name): Return error_mark_node if there
+ is no destructor while looking up a BIT_NOT_EXPR.
- * 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.
+2004-01-13 Ian Lance Taylor <ian@wasabisystems.com>
-2000-12-01 Nathan Sidwell <nathan@codesourcery.com>
+ * cxxfilt.c: Remove unused file.
- * 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.
+2004-01-14 Jan Hubicka <jh@suse.cz>
-2000-11-30 Nathan Sidwell <nathan@codesourcery.com>
+ Partial fix to PR c++/12850
+ * decl2.c (mark_used): Do not proactively instantiate templates
+ when compiling in unit-at-a-time or not optimizing.
+ * optimize.c (maybe_clone_body): Do not increase function depth.
- * 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.
+2004-01-13 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2000-11-30 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/13474
+ * pt.c (tsubst) <INTEGER_TYPE>: Remove obsolete array index tweaking.
- * method.c (do_build_assign_ref): Construct appropriately
- CV-qualified base reference. Don't allow const casts in base
- conversion.
+2003-01-12 Steven Bosscher <stevenb@suse.de>
-2000-11-30 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/13558
+ * parser.c (cp_parser_member_declaration): Any non-type is also
+ not a class or a function.
- * call.c (build_over_call): Use VOID_TYPE_P. Don't die on
- incomplete return type.
+2004-01-12 Jason Merrill <jason@redhat.com>
-2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/12815
+ * class.c (build_base_path): Do not mark vtable references as
+ TREE_CONSTANT.
+ (build_vtbl_ref_1): Likewise.
- * parse.y (base_class.1): Produce a _TYPE not a _DECL.
- * semantics.c (finish_base_specifier): Accept a _TYPE not a
- _DECL.
+2004-01-12 Richard Henderson <rth@redhat.com>
-2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+ PR opt/10776
+ * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): New.
+ (store_init_value): Use it.
+ * decl.c (check_initializer): Expect full initialization code
+ from store_init_value.
+ * init.c (expand_aggr_init_1): Likewise.
+ * decl2.c (maybe_emit_vtables): Abort if runtime init needed.
- * spew.c (yyerror): Cope if yylval.ttype is NULL.
+2004-01-12 Mark Mitchell <mark@codesourcery.com>
-2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+ * class.c (layout_class_type): For non-POD class types, also copy
+ the DECL_SIZE and DECL_MODE of fields to the base class type.
- * decl.c (grokdeclarator): Diagnose undefined template contexts.
+2004-01-12 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/13289
+ * pt.c (instantiate_decl): Set DECL_TEMPLATE_INSTANTIATED before
+ calling regenerate_decl_from_template.
- * decl.c (grokdeclarator): Do type access control on friend
- class.
+2004-01-12 Scott Brumbaugh <scottb.lists@verizon.net>
-2000-11-27 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/4100
+ * parser.c (cp_parser_decl_specifier_seq): Add check for a friend
+ decl-specifier occurring along with a class definition.
- * 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.
+2004-01-12 Ian Lance Taylor <ian@wasabisystems.com>
-2000-11-27 Nathan Sidwell <nathan@codesourcery.com>
+ * parser.c (cp_parser_decl_specifier_seq): Add parenthetical
+ clauses to comments describing declares_class_or_enum.
+ (cp_parser_type_specifier): Set *declares_class_or_enum to 0, not
+ false.
- * 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.
+2004-01-12 Jan Hubicka <jh@suse.cz>
-2000-11-26 Mark Mitchell <mark@codesourcery.com>
+ * pt.c (for_each_template_parm): Do not check for duplicates.
+ (for_each_template_parm): Use walk_tree duplicate checking code.
- * 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.
+2004-01-11 Ian Lance Taylor <ian@wasabisystems.com>
-2000-11-25 Joseph S. Myers <jsm28@cam.ac.uk>
+ PR c++/3478
+ * parser.c (cp_parser_decl_specifier_seq): If the first decl_spec
+ is error_mark_node, don't add any more decl_specs.
+ (cp_parser_init_declarator): After committing to a declaration, if
+ the decl_specifiers start with error_mark_node, issue an error and
+ change the type to "int".
- * method.c (build_mangled_C9x_name): Rename to
- build_mangled_C99_name. Change C9X references in comments to
- refer to C99.
+2004-01-09 Nathanael Nerode <neroden@gcc.gnu.org>
-2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
+ PR bootstrap/7817
+ * Make-lang.in: Copy gcc.1 to g++.1 rather than using .so.
- * parse.y (unary_expr): Move VA_ARG from here ...
- (primary): ... to here.
+2004-01-10 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
+ DR 337
+ PR c++/9256
+ * pt.c (tsubst): Substitution must fail if we are attempting to
+ create an array with element type that is an abstract class type.
+ * decl.c (cp_finish_decl): Strip pointers and array types recursively
+ before calling abstract_virtuals_error.
- * semantics.c (finish_id_expr): If type is error_mark, return
- error_mark.
+2004-01-09 Alexandre Oliva <aoliva@redhat.com>
-2000-11-23 Nathan Sidwell <nathan@codesourcery.com>
+ * name-lookup.c (qualified_lookup_using_namespace): Consider
+ strong using directives even if we've already found a binding.
- * pt.c (lookup_template_class): Simplify loop exit constructs.
- Cope when there is no partial instantiation of a template
- template member.
+2004-01-09 Mark Mitchell <mark@codesourcery.com>
-Thu Nov 23 02:16:47 2000 J"orn Rennecke <amylaar@redhat.com>
+ * cp-tree.h (cxx_expand_expr): Change prototype.
+ * expr.c (cxx_expand_expr): Add alt_rtl parameter.
- * Make-lang.in (g++spec.o, cxxmain.o): Depend on $(CONFIG_H).
+2004-01-08 Giovanni Bajo <giovannibajo@gcc.gnu.org>
-2000-11-22 Mark Mitchell <mark@codesourcery.com>
+ PR c++/12573
+ * pt.c (value_dependent_expression_p): Handle COMPONENT_REFs by
+ looking into them recursively. They can be there because of the
+ new __offsetof__ extension.
- * mangle.c (mangle_conv_op_name_for_type): Don't use `__op'
- prefix.
+2004-01-07 Zack Weinberg <zack@codesourcery.com>
- * pt.c (do_decl_instantiate): Explicitly clone constructors and
- destructors that haven't already been cloned.
+ * parser.c (cp_parser_save_member_function_body): Mark the
+ definition static.
-2000-11-20 Richard Henderson <rth@redhat.com>
+2004-01-05 Mark Mitchell <mark@codesourcery.com>
- * parse.y (yyparse_1): Rename the parser entry point.
+ PR c++/13057
+ * class.c (build_clone): Copy type attributes from the original
+ function to the clone.
-2000-11-20 Alex Samuel <samuel@codesourcery.com>
+ PR c++/12815
+ * class.c (build_vtbl_ref_1): Do not unconditionally mark vtable
+ references as constant.
- * mangle.c (write_name): Use <unscoped-name> for names directly in
- function scope.
- (write_unscoped_name): Accept names directly in function scope.
+ PR c++/12132
+ * parser.c (cp_parser_explicit_instantiation): Improve error
+ recovery.
+ (cp_parser_require): Improve indication of the error location.
-2000-11-20 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/13451
+ * parser.c (cp_parser_class_head): Reorder logic to check for
+ invalid qualification.
- * lex.c (rid_to_yy, RID_EXPORT): Make unique keyword.
- * parse.y (extdef): Add EXPORT reduction.
- * spew.c (yylex): Don't skip export here.
+2004-01-04 Mark Mitchell <mark@codesourcery.com>
-2000-11-19 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-11-18 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
- * decl.c (grokparms): Don't create parameters of `void' type.
-
-2000-11-17 Zack Weinberg <zack@wolery.stanford.edu>
-
- * 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.
-
-2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (tsubst_expr, DECL_STMT): Instantiate decl's type.
-
-2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck2.c (incomplete_type_error): Reorganize to avoid
- excessive diagnostics.
-
-2000-11-16 Zack Weinberg <zack@wolery.stanford.edu>
-
- * lex.c (struct impl_files, internal_filename): Constify a char *.
-
-2000-11-16 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-11-16 Nathan Sidwell <nathan@codesourcery.com>
-
- * call.c (op_error): Make error messages clearer.
-
-2000-11-15 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (wrapup_globals_for_namespace): Don't mark things
- TREE_ASM_WRITTEN when they're not.
-
-2000-11-15 Jason Merrill <jason@redhat.com>
-
- * typeck2.c (friendly_abort): Uncount the error before handing
- off to fancy_abort.
-
-2000-11-15 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck.c (lookup_anon_field): Cope with qv qualifiers.
-
-2000-11-14 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (build_vtbl_initializer): Fix typo in comment.
- * typeck.c (expr_sizeof): Don't crash on errors.
-
-2000-11-14 Jim Wilson <wilson@redhat.com>
-
- * lang-specs.h: Add %2 after %(cc1_options).
-
-2000-11-14 Richard Henderson <rth@redhat.com>
-
- * typeck.c (c_sizeof): Be strict about casting result value
- back to c_size_type_node.
- (expr_sizeof, c_sizeof_nowarn, c_alignof): Likewise.
-
-2000-11-13 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * typeck.c (build_unary_op): Use boolean_increment from
- c-common.c, moving the relevant code there.
-
-2000-11-11 Jason Merrill <jason@redhat.com>
-
- * typeck.c (mark_addressable): Don't call put_var_into_stack.
-
- * decl.c (maybe_commonize_var): Set DECL_UNINLINABLE for statics
- in inlines.
-
-2000-11-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl.c (grokdeclarator, save_function_data): Use memcpy, not bcopy.
- * lex.c (copy_lang_decl): Likewise.
-
-2000-11-09 Mark Mitchell <mark@codesourcery.com>
-
- * dump.c (cp_dump_tree): Don't dump function bodies here.
-
- * 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.
-
-2000-11-07 Eric Christopher <echristo@redhat.com>
-
- * 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.
-
-2000-11-09 Nathan Sidwell <nathan@codesourcery.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.
-
-2000-11-08 Nathan Sidwell <nathan@codesourcery.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.
-
-2000-11-07 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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 ().
-
-2000-11-07 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (build_ptrmemfunc_type): Allow error_mark_node.
-
-2000-11-05 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * Make-lang.in (c++.distdir): Remove.
-
-2000-11-04 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (do_nonmember_using_decl): Allow `extern "C"'
- declarations from different namespaces to be combined.
-
-2000-11-03 Zack Weinberg <zack@wolery.stanford.edu>
-
- * decl.c: Include tm_p.h.
-
-2000-11-03 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * tree.c (cp_tree_equal): Use memcmp () instead of bcmp ().
-
-2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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 ().
-
-2000-11-01 Bernd Schmidt <bernds@redhat.co.uk>
-
- * call.c (build_over_call): Call fold on the CALL_EXPR.
-
-2000-11-01 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * error.c (dump_template_decl): Separate template hearders with
- space not comma.
-
-2000-10-31 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * 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.
-
- * 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.
-
- * class.c (dump_class_hierarchy_r): Use TFF_PLAIN_IDENTIFIER
- instead of TS_PLAIN.
-
- * pt.c (mangle_class_name_for_template): Use TFF_CHASE_TYPEDEF
- instead of TF_CHASE_TYPEDEFS. Use TFF_PLAIN_IDENTIFIER instead of
- plain `0'.
-
-2000-10-30 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-10-28 Mark Mitchell <mark@codesourcery.com>
-
- * pt.c (instantiate_decl): Always instantiate static data members
- initialized in-class.
-
-2000-10-27 Zack Weinberg <zack@wolery.stanford.edu>
-
- * 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.
-
- * Makefile.in: Delete.
- * config-lang.in: Delete outputs= line.
-
-2000-10-26 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * 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.
-
-2000-10-23 Jason Merrill <jason@redhat.com>
-
- * call.c (equal_functions): Also call decls_match for extern "C" fns.
-
-2000-10-22 Jason Merrill <jason@redhat.com>
-
- * call.c (build_conditional_expr): Use ocp_convert to force
- rvalue conversion.
-
-2000-10-22 Mark Mitchell <mark@codesourcery.com>
-
- * call.c (standard_conversion): Use RVALUE_CONVs for all
- expressions that satisfy lvalue_p, not just those that satisfy
- real_lvalue_p.
-
- * optimize.c (copy_body_r): Don't treat CALL_EXPRs specially.
-
- * 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.
-
-2000-10-21 Geoffrey Keating <geoffk@cygnus.com>
-
- * 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.
-
- * decl.c (init_decl_processing): Call MD_INIT_BUILTINS.
-
-2000-10-21 Jason Merrill <jason@redhat.com>
-
- * 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.
-
-2000-10-20 Jason Merrill <jason@redhat.com>
-
- * tree.c (walk_tree): Don't walk into default args.
-
- * error.c (dump_expr): Use host_integerp.
-
-2000-10-20 David Edelsohn <edelsohn@gnu.org>
-
- * typeck2.c (abstract_virtuals_error): Use "because" instead of
- "since" in error message.
-
-Fri Oct 20 13:54:59 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * typeck.c (dubious_conversion_warning): Suppress if TYPE_IS_SIZETYPE.
-
-2000-10-20 Jeffrey Oldham <oldham@codesourcery.com>
-
- * decl.c (revert_static_member_fn): Fixed typo.
-
-2000-10-19 Mark Mitchell <mark@codesourcery.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.
-
- * cp-tree.h (DECL_ANTICIPATED): Don't require a FUNCTION_DECL.
- * decl.c (select_decl): Don't return declarations that are
- DECL_ANTICIPATED.
-
-2000-10-18 Mark Mitchell <mark@codesourcery.com>
-
- * 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>
-
- * cp-tree.h (back_end_hook): Remove declaration.
- * decl2.c (back_end_hook): Remove definition.
-
- * dump.c (dequeue_and_dump): Dump TREE_USED.
-
-Tue Oct 17 20:19:06 2000 Brad Lucier <lucier@math.purdue.edu>
-
- * spew.c (snarf_defarg): Cast 2nd arg to obstack_blank to (int).
-
-2000-10-17 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * 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.
-
-2000-10-17 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * decl2.c (warn_missing_format_attribute): New variable.
- (lang_decode_option): Decode -Wmissing-format-attribute.
-
-2000-10-16 Mark Mitchell <mark@codesourcery.com>
-
- * typeck.c (qualify_type): Remove.
- (composite_pointer_type): Fix handling of conversions to `cv void*'.
-
-2000-10-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (parse.c, parse.h): Fix think-o in last patch.
-
-2000-10-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (parse.c, parse.h): Create atomically.
-
-2000-10-12 Mark Mitchell <mark@codesourcery.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.
-
-2000-10-09 Richard Henderson <rth@cygnus.com>
-
- * 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.
-
- * 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.
-
-2000-10-08 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * decl.c (INTMAX_TYPE, UINTMAX_TYPE): Define if not already
- defined.
- (init_decl_processing): Initialize intmax_type_node and
- uintmax_type_node.
-
-2000-10-06 Richard Henderson <rth@cygnus.com>
-
- * 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.
-
-2000-10-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (lookup_template_class): Set current access for enum.
- (tsubst_enum): Set file & line for enum decl.
-
- * spew.c (yylex): Remove unused variable.
-
-2000-10-05 Richard Henderson <rth@cygnus.com>
-
- * semantics.c (genrtl_finish_function): Don't init or check
- can_reach_end; remove noreturn and return value checks.
-
-2000-10-05 Tom Tromey <tromey@cygnus.com>
-
- * init.c (build_java_class_ref): Use `build_static_name' with a
- suffix, not a prefix, to build the class object's name.
-
-2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (tsubst_expr, DECL_STMT case): Don't process if
- tsubsting fails.
-
-2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2000-09-24 Mark Mitchell <mark@codesourcery.com>
-
- * ir.texi: Move to ../c-tree.texi.
-
-2000-09-20 Jason Merrill <jason@redhat.com>
-
- * decl2.c (get_guard): Check DECL_FUNCTION_SCOPE_P.
-
-2000-09-21 Andreas Jaeger <aj@suse.de>
-
- * errfn.c: Move declaration of cp_printer and cp_printers to ...
- * cp-tree.h: ... here.
-
- * error.c: Remove declaration of cp_printer.
-
-2000-09-20 Mark Mitchell <mark@codesourcery.com>
-
- * tree.c (mark_local_for_remap_r): Handle CASE_LABELs.
-
-2000-09-20 Hans-Peter Nilsson <hp@axis.com>
-
- * except.c: Delete #if 0:d EXCEPTION_SECTION_ASM_OP-default and
- users.
-
-2000-09-18 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (start_function): Robustify.
-
-2000-09-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * cp-tree.h (check_function_format): Accept a `status' parameter.
-
- * call.c, typeck.c: Updates calls to `check_function_format'.
-
-2000-09-17 Geoffrey Keating <geoffk@cygnus.com>
-
- * decl2.c (handle_class_head): Always push some scope even
- in the error case.
-
-2000-09-16 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-09-14 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * lex.c (reswords): Add _Complex.
-
-Thu Sep 14 12:10:45 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * Make-lang.in (cplib2.txt): Depend on cp/Makefile.
-
-2000-09-13 J. David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * init.c (begin_init_stmts): Don't use // comments.
-
-2000-09-12 Jason Merrill <jason@redhat.com>
-
- * decl.c (maybe_deduce_size_from_array_init): Set do_default for
- all non-extern arrays.
-
- * 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.
-
-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.
-
-2000-09-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * error.c (cp_tree_printer, case 'P'): Append break.
-
-2000-09-11 Nathan Sidwell <nathan@codesourcery.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.
-
-2000-09-10 Zack Weinberg <zack@wolery.cumb.org>
-
- * decl.c, rtti.c: Include defaults.h if not already included.
- Don't define the *_TYPE_SIZE macros.
-
-2000-09-09 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-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.
-
-2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (type_unification_real): Replace switch with if.
- (unify): Tsubst non-type parms before comparing.
-
-2000-09-06 Nathan Sidwell <nathan@codesourcery.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.
-
-2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * init.c (build_offset_ref): Deal with namespace scoped
- TEMPLATE_ID_EXPRs.
-
-2000-09-06 Nathan Sidwell <nathan@codesourcery.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.
-
-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.
- (grok_op_properties): Likewise.
- (xref_tag): Likewise.
- (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.
-
-2000-09-04 Mark Elbrecht <snowball3@bigfoot.com>
-
- * decl.c (finish_function): Move the code for handling functions
- marked with the constructor and destructor attributes inside the
- expand_p block.
-
-2000-09-04 Nathan Sidwell <nathan@codesourcery.com>
-
- * init.c (resolve_offset_ref): Deal with TEMPLATE_ID_EXPR.
-
-2000-09-04 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (lookup_template_class): Remove abort.
- * tree.c (get_type_decl): Allow error_mark_node.
-
-2000-09-04 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl2.c (arg_assoc): Deal with COMPONENT_REFs inside
- TEMPLATE_ID_EXPRs.
-
-2000-09-03 Mark Mitchell <mark@codesourcery.com>
-
- * operators.def (ALIGNOF_EXPR, MAX_EXPR, MIN_EXPR): Change
- new ABI mangling.
-
-2000-09-01 Nathan Sidwell <nathan@codesourcery.com>
-
- * parse.y (named_class_head): Check for TYPENAME_TYPE. Simplify
- union tag mismatch error reporting.
-
-2000-09-01 Nathan Sidwell <nathan@codesourcery.com>
-
- * call.c (build_scoped_method_call): Check it is not a namespace.
-
-2000-08-30 Jason Merrill <jason@redhat.com>
-
- * cp-tree.h (LOCAL_CLASS_P): Use decl_function_context.
-
- * 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.
-
- * decl.c (start_function): Always call make_function_rtl.
-
-2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
-
- * semantics.c (prune_unused_decls): New function.
- (finish_stmt_tree): Call it via walk_tree.
-
-2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
-
- * 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.
-
-2000-08-29 Mark Mitchell <mark@codesourcery.com>
-
- * typeck.c (mark_addressable): Remove code that pokes around in
- RTL.
-
-2000-08-28 Jason Merrill <jason@redhat.com>
-
- * lex.c (file_name_nondirectory): Move to toplev.c.
-
- * cp-tree.h (LOCAL_CLASS_P): New macro.
- * class.c (finish_struct_1): Use it.
-
-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.
-
-2000-08-26 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * ir.texi (Expressions): Fix typo.
-
-2000-08-25 Greg McGary <greg@mcgary.org>
-
- * tree.c (init_tree): Use ARRAY_SIZE.
-
-2000-08-25 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * error.c (cp_tree_printer): Rework.
-
-2000-08-25 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
- * decl.c (grokfndecl): Require that `main' return an `int'.
- * mangle.c (write_encoding): Don't mangle return types for
- conversion functions.
-
-2000-08-25 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * 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.
-
-2000-08-24 Jason Merrill <jason@redhat.com>
-
- * typeck.c (build_ptrmemfunc): Just reinterpret if there's no
- adjustment necessary.
-
-2000-08-24 Greg McGary <greg@mcgary.org>
-
- * cp-tree.h (MAIN_NAME_P): Remove macro.
-
-2000-08-24 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * error.c (print_instantiation_context): Don't forget to flush the
- buffer.
-
-2000-08-23 Jason Merrill <jason@redhat.com>
-
- * typeck.c (build_ptrmemfunc): Save the input pmf.
-
- * method.c (process_modifiers): Use same_type_p.
-
-2000-08-23 Mark Mitchell <mark@codesourcery.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.
-
-2000-08-23 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * error.c (cp_print_error_function): Don't use embedded '\n' in
- output_printf.
-
-2000-08-23 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * decl.c (init_decl_processing): Remove bogus initialization.
- * error.c (lang_print_error_function): Restore here.
- (init_error): Initialize print_error_function.
-
-2000-08-22 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
-
- * decl2.c (arg_assoc): Revert my 2000-08-11 change.
-
-2000-08-22 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * Makefile.in (error.o): Depends on diagnostic.h
-
- * cp-tree.h (problematic_instantiation_changed,
- record_last_problematic_instantiation, current_instantiation,
- print_instantiation_context): Declare.
- (maybe_print_template_context): Remove.
-
- * decl.c (init_decl_processing): Set print_error_function to NULL.
- (lang_print_error_function): Remove, since we're using a new
- machinery.
-
- * 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.
-
- * 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.
-
-2000-08-21 Nix <nix@esperi.demon.co.uk>
-
- * lang-specs.h: Do not process -o or run the assembler if
- -fsyntax-only.
-
-2000-08-21 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * decl.c (flag_hosted, flag_noniso_default_format_attributes): New
- variables.
- * decl2.c (lang_decode_option): Disable gettext attributes for
- -ansi.
-
-2000-08-21 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * lex.c (lang_init_options): Default diagnostic message maximum
- length to 80, when line-wrapping.
-
-2000-08-20 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-08-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2000-08-17 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
- * error.c (dump_type, case TYPENAME_TYPE): Don't emit the
- aggregate tag on the typename's context.
-
- * pt.c (tsubst_friend_class): Return error_mark_node, if
- parms becomes NULL.
- (instantiate_class_template): Ignore error_mark_node friend types.
-
-2000-08-14 Nathan Sidwell <nathan@codesourcery.com>
-
- * cvt.c (warn_ref_binding): New static function, broken out of ...
- (convert_to_reference): ... here. Use it.
-
-2000-08-11 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
-
- * parse.y (template_arg): Add rule for template qualified with
- global scope.
-
-2000-08-11 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
-
- * decl2.c (add_function): Reorganize.
- (arg_assoc): Do not consider function template decls.
-
-2000-08-11 Jason Merrill <jason@redhat.com>
-
- * decl.c (lookup_name_real): Don't forget the TYPENAME_TYPE we're
- looking inside.
-
-2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * cp-tree.h (resolve_scope_to_name): Remove unused prototype.
- (lookup_nested_tag): Likewise.
-
- * decl2.c (grokfield): Fix comment to reflect many types of _DECLs
- can be produced.
-
-2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * parse.y (named_complex_class_head_sans_basetype): Remove
- always true if.
-
-2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl2.c (build_expr_from_tree, case METHOD_CALL_EXPR): Build
- explicit TEMPLATE_ID_EXPR args.
- (build_expr_from_tree, case CALL_EXPR): Likewise.
-
-2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (check_tag_decl): Diagnose typename's which don't
- declare anything.
-
-2000-08-10 Nathan Sidwell <nathan@codesourcery.com>
-
- * init.c (build_aggr_init): Reject bogus array initializers
- early.
-
-2000-08-09 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2000-08-09 Nathan Sidwell <nathan@codesourcery.com>
-
- * cvt.c (convert_to_pointer_force): Fix error message when
- attempting to cast from ambiguous base.
-
-2000-08-08 Jason Merrill <jason@redhat.com>
-
- * pt.c (tsubst_aggr_type): Bail if creating the argvec fails.
- (tsubst_template_arg_vector): Likewise.
-
- * decl2.c (build_anon_union_vars): Choose the largest field; don't
- assume that one will be as large as the union.
-
-2000-08-07 Kazu Hirata <kazu@hxi.com>
-
- * cp-tree.h (CLASSTYPE_HAS_PRIMARY_BASE_P): Fix a comment typo.
- * decl.c (pop_labels): Likewise.
-
-2000-08-04 Jeffrey Oldham <oldham@codesourcery.com>
-
- * 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.
-
-2000-08-04 Joseph S. Myers <jsm28@cam.ac.uk>
-
- * decl.c (flag_isoc94): New variable.
-
-2000-08-02 Jason Merrill <jason@redhat.com>
-
- * pt.c (do_type_instantiation): Add complain parm; don't complain
- if called recursively.
- * cp-tree.h, parse.y: Adjust.
-
-2000-08-02 Zack Weinberg <zack@wolery.cumb.org>
-
- * decl2.c: Silently ignore -Wstrict-prototypes; warn about
- -Wno-strict-prototypes.
-
- * g++spec.c: Adjust type of second argument to
- lang_specific_driver, and update code as necessary.
-
- * cp-tree.h: Don't prototype min_precision here.
- (my_friendly_assert): Cast expression to void.
- * semantics.c (do_poplevel): Initialize scope_stmts.
-
-2000-08-02 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (DECL_NEEDED_P): Tweak.
-
-2000-07-28 Jason Merrill <jason@redhat.com>
-
- * lang-specs.h: Use %i in rule for .ii files.
-
-2000-07-31 Zack Weinberg <zack@wolery.cumb.org>
-
- * lang-specs.h: Rename cpp to cpp0 and/or tradcpp to tradcpp0.
-
-2000-07-30 Mark Mitchell <mark@codesourcery.com>
-
- 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.
- (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.
-
-2000-07-27 Jason Merrill <jason@redhat.com>
-
- * decl.c (duplicate_decls): If common_type produces a non-typedef
- type for a typedef, just use the old type.
-
-2000-07-27 Mark Mitchell <mark@codesourcery.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.
-
-2000-07-27 Jason Merrill <jason@redhat.com>
-
- * 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.
-
-2000-07-26 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-Wed Jul 26 15:05:51 CEST 2000 Marc Espie <espie@cvs.openbsd.org>
-
- * parse.y: Add missing ';'.
-
-2000-07-26 Mark Mitchell <mark@codesourcery.com>
-
- * parse.y (empty_parms): Use `()', not `(...)', when in the scope
- of `extern "C++"'.
-
-2000-07-25 Nathan Sidwell <nathan@codesourcery.com>
-
- 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.
-
-2000-07-25 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (poplevel): Deal with anonymous variables at for scope.
- (maybe_inject_for_scope_var): Likewise.
-
-2000-07-25 Zack Weinberg <zack@wolery.cumb.org>
-
- * decl.c: Remove all signal handling code, now done in toplev.c.
-
-2000-07-23 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (make_rtl_for_nonlocal_decl): Rework.
-
- * pt.c (lookup_template_class): Ensure that TYPE_CONTEXT is set
- correctly.
-
-2000-07-20 Zack Weinberg <zack@wolery.cumb.org>
-
- * 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.
-
-2000-07-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck.c (comp_target_parms): Remove obsolete parameter.
- (comp_target_types): Adjust.
-
-2000-07-17 Jason Merrill <jason@redhat.com>
-
- * 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.
-
- * typeck.c (build_binary_op): Fix grammar in warning.
-
- * exception.cc (__eh_free): Fix prototype.
-
- * decl2.c (finish_decl_parsing): Handle TEMPLATE_ID_EXPR.
-
- * decl.c (pushdecl): Handle seeing an OVERLOAD in
- IDENTIFIER_NAMESPACE_VALUE.
-
-2000-07-16 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (THUNK_VCALL_OFFSET): Update documentation.
- * method.c (use_thunk): Correct handling of vcall offsets.
-
-2000-07-14 Zack Weinberg <zack@wolery.cumb.org>
-
- * .cvsignore: parse.h and parse.c have no cp- prefix.
-
-2000-07-13 Mark Mitchell <mark@codesourcery.com>
-
- * .cvsignore: New file.
-
-2000-07-13 Zack Weinberg <zack@wolery.cumb.org>
-
- * lang-specs.h: Use the new named specs. Remove unnecessary braces.
-
-2000-07-12 Mark Mitchell <mark@codesourcery.com>
-
- * Makefile.in ($(PARSE_H)): Depend directly on parse.y.
- * parse.c: Remove.
- * parse.h: Likewise.
-
-2000-07-11 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (layout_class_type): Add pointers to virtual bases after
- base classes under the old ABI.
-
-2000-07-10 Benjamin Chelf <chelf@codesourcery.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.
-
-2000-07-10 Jakub Jelinek <jakub@redhat.com>
-
- * semantics.c (expand_body): Sync interface information
- at the end of function body expansion.
-
-2000-07-09 Jason Merrill <jason@redhat.com>
-
- * init.c (build_new_1): Bail early if the call to new fails.
-
- * decl.c (compute_array_index_type): Check specifically for
- an INTEGER_CST, not just TREE_CONSTANT.
-
- * 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.
-
- * error.c (dump_template_bindings): Don't crash if we had an
- invalid argument list.
-
- * typeck.c (c_expand_start_case): Do narrowing here.
- * semantics.c (finish_switch_cond): Not here.
-
-2000-07-09 Hidvegi Zoli <hzoli@austin.ibm.com>
-
- * parse.y (asm_clobbers): Do string concatenation.
-
-2000-07-09 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (pushtag): Don't put local classes in template functions
- on the local_classes list.
-
-2000-07-04 Scott Snyder <snyder@fnal.gov>
-
- * decl2.c (get_guard): Add missing return for old ABI local
- variable case.
-
-2000-07-09 Mark Mitchell <mark@codesourcery.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.
-
-2000-07-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (tsubst): Don't layout type, if it's error_mark.
-
-2000-07-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (instantiate_pending_templates): Reset template level.
-
-2000-07-05 Jason Merrill <jason@redhat.com>
-
- * call.c (joust): Don't complain about `operator char *()' beating
- `operator const char *() const'.
-
-2000-07-04 scott snyder <snyder@fnal.gov>
- Jason Merrill <jason@redhat.com>
-
- * repo.c (repo_get_id): Handle the case where a class with virtual
- bases has a null TYPE_BINFO_VTABLE.
-
-2000-07-04 Kevin Buhr <buhr@stat.wisc.edu>
- Jason Merrill <jason@redhat.com>
-
- * parse.y (member_init): Just pass in the type.
- * init.c (expand_member_init): Handle getting a type.
-
-2000-07-04 Martin v. Löwis <loewis@informatik.hu-berlin.de>
- Jason Merrill <jason@redhat.com>
-
- * 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.
-
-2000-07-03 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl2.c (push_decl_namespace): Push the original namespace.
-
-2000-07-03 Nathan Sidwell <nathan@codesourcery.com>
-
- * pt.c (instantiate_class_template): Set CLASSTYPE_VBASECLASSES.
- * semantics.c (begin_class_definition): Clear it.
-
-2000-07-02 Benjamin Chelf <chelf@codesourcery.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.
-
- * init.c (begin_init_stmts): Remove call to
- genrtl_begin_compound_stmt.
- (finish_init_stmts): Remove call to genrtl_finish_compound_stmt.
-
- * semantics.c (lang_expand_stmt): Changed call to
- genrtl_compound_stmt to ignore return value.
-
-2000-07-02 Mark Mitchell <mark@codesourcery.com>
-
- * mangle.c (canonicalize_for_substitution): Return the canonical
- variant of a type.
-
- * decl.c (duplicate_decls): Preserve DECL_ORIGINAL_TYPE for a
- TYPE_DECL.
- * typeck.c (commonparms): Remove obstack manipulations.
-
-2000-07-01 Benjamin Chelf <chelf@codesourcery.com>
-
- * Make-lang.in (cc1plus$(exeext)): Added c-semantics.o.
-
- * Makefile.in (OBJS): Added ../c-semantics.o.
- (OBJDEPS): Likewise.
-
- * 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.
-
- * 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.
-
- * 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.
-
-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-29 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (flag_const_strings): Remove.
- (warn_parentheses): Likewise.
- (warn_format): Likewise.
- (common_type): Likewise.
- (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.
-
-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.
-
-2000-06-25 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-06-25 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
-
- * search.c (lookup_member): Fix typo in comment.
-
-2000-06-24 Jason Merrill <jason@redhat.com>
-
- * decl.c (pushdecl): Don't set DECL_CONTEXT from current_namespace.
- (push_namespace): Set DECL_CONTEXT for a new NAMESPACE_DECL.
-
-2000-06-24 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- * parse.y (complex_direct_notype_declarator): Support global_scope.
- * Makefile.in: Adjust conflict count.
-
-2000-06-23 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
-
- * parse.y (template_arg): Convert TEMPLATE_DECL
- that is a template template parameter to
- TEMPLATE_TEMPLATE_PARM here.
-
- * 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.
-
-2000-06-22 Jason Merrill <jason@redhat.com>
-
- * pt.c (tsubst_decl, case FUNCTION_DECL): Clear DECL_SAVED_TREE.
- (tsubst_friend_function): Copy it here.
-
- * decl.c (grok_op_properties): Fix typo.
-
- * decl2.c (delete_sanity): Clarify warning, avoid failure on
- deleting void*.
-
- * pt.c (check_explicit_specialization): Clarify error.
-
- * 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.
-
-2000-06-22 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2000-06-20 Alexandre Petit-Bianco <apbianco@cygnus.com>
-
- * class.c (push_lang_context): TYPE_NAME gets you to the Java
- types DECLs.
- * decl.c (check_goto): Computed gotos assumed OK.
-
-2000-06-20 Jason Merrill <jason@redhat.com>
-
- * pt.c (tsubst_decl, case TYPE_DECL): Fix test for TYPE_DECLs
- for which we don't need to look for instantiations.
-
-2000-06-21 Nathan Sidwell <nathan@codesourcery.com>
-
- * parse.y (program): Always call finish_translation_unit.
- * parse.c, parse.h: Rebuilt.
-
-2000-06-20 Zack Weinberg <zack@wolery.cumb.org>
-
- * method.c: Don't include hard-reg-set.h.
-
-2000-06-20 Nathan Sidwell <nathan@codesourcery.com>
-
- * rtti.c (get_base_offset): Cope when vbase field is in a base.
-
-2000-06-20 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
- * decl.c (initialize_local_var): Changed call to finish_expr_stmt
- to call genrtl_expr_stmt when appropriate.
-
- * 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.
-
- * parse.y (simple_stmt): Removed first argument from call to
- finish_for_stmt. Removed first argument from call to
- finish_switch_stmt.
-
- * parse.c: Regenerated.
-
- * pt.c (tsubst_expr): Removed first argument from call to
- finish_for_stmt. Removed first argument from call to
- finish_switch_stmt.
-
-2000-06-16 Benjamin Chelf <chelf@codesourcery.com>
-
- * cp-tree.h (enum cplus_tree_code): Changed __DUMMY to
- CP_DUMMY_TREE_CODE. Remove #include "c-common.def".
-
- * 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.
-
-2000-06-16 Mark Mitchell <mark@codesourcery.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.
-
- * tree.c (count_trees_r): Prototype. Use DATA parameter to store
- the number of trees.
- (n_trees): Remove.
- (count_trees): Don't use it.
-
-2000-06-15 Jason Merrill <jason@redhat.com>
-
- * tree.c (count_trees): New debugging function.
-
- * typeck.c (build_x_function_call): Use DECL_FUNCTION_TEMPLATE_P.
- * init.c (build_member_call): Pull out the name of a DECL.
-
- * 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.
-
-2000-06-15 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
- * 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.
-
-Tue Jun 13 15:48:03 2000 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * 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++.
-
-2000-06-12 Mark Mitchell <mark@codesourcery.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.
-
-2000-06-09 Chip Salzenberg <chip@valinux.com>
- Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-06-09 Chip Salzenberg <chip@valinux.com>
-
- * mangle.c (find_substition): Don't mangle objects with typename
- substitutions (e.g. "cin" as "Si").
-
-2000-06-09 Zack Weinberg <zack@wolery.cumb.org>
-
- * call.c (add_candidate): Use ggc_alloc_cleared.
- * decl.c (lookup_label): Likewise.
- * lex.c (retrofit_lang_decl): Likewise.
-
-2000-06-09 Jason Merrill <jason@casey.soma.redhat.com>
-
- * semantics.c (expand_body): Push to TV_EXPAND.
- * optimize.c (optimize_function): Push to TV_INTEGRATION.
- * decl.c (start_function): Always call announce_function.
-
- * tinfo2.cc: Just declare abort.
-
-2000-06-09 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * lex.c (DEF_OPERATOR): Say `operator@' -not- `operator @'
- whenever @ is a symbolic name.
-
-2000-06-08 Jakub Jelinek <jakub@redhat.com>
-
- * method.c (make_thunk): Clear DECL_VTT_PARM in thunk.
-
-2000-06-07 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (pushdecl): Look up functions by DECL_NAME, not
- DECL_ASSEMBLER_NAME.
-
-2000-06-06 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (c_language): Define.
-
-2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * lex.c (lang_init_options): Tweak.
-
- * decl2.c: Remove #inclusion of diagnostic.h
- (lang_decode_option): Move diagnostic formatting options to
- toplevel.
-
- * lang-options.h: Remove documentation for diagnostic options.
-
- * Makefile.in (lex.o): Depends upon diagnostic.h
-
-2000-06-06 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-06-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * exception.cc: (__eh_alloc, __eh_free): Moved to libgcc2.c
-
-2000-06-05 Jason Merrill <jason@casey.soma.redhat.com>
-
- * search.c (maybe_suppress_debug_info): Don't check
- CLASSTYPE_INTERFACE_ONLY if CLASSTYPE_INTERFACE_KNOWN isn't set.
-
- * pt.c (mark_decl_instantiated): Do SET_DECL_EXPLICIT_INSTANTIATION
- here if extern_p.
-
- 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.
-
-2000-06-05 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (indirect_primary_base_p): New function.
- (determine_primary_base): Use it.
-
-2000-06-05 Nathan Sidwell <nathan@codesourcery.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.
-
-Mon Jun 5 06:48:55 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * decl.c (init_decl_processing): Don't call record_component_aliases.
- * tree.c (build_cplus_array_type_1): Likewise.
-
-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.
-
- * dump.c (dequeue_and_dump): Dump information about thunks.
-
-2000-06-01 Richard Henderson <rth@cygnus.com>
-
- * decl.c (init_decl_processing): Set lang_get_alias_set first thing.
-
-2000-06-01 Richard Henderson <rth@cygnus.com>
-
- * decl2.c (unsupported_options): Fix typo, make const.
- (lang_decode_option): Fix bsearch argument order.
-
-2000-06-01 Mark Mitchell <mark@codesourcery.com>
-
- * init.c (resolve_offset_ref): Remove check for TREE_ADDRESSABLE
- on FIELD_DECLs.
-
-Wed May 31 14:09:00 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * 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.
-
-2000-05-31 Mark Mitchell <mark@codesourcery.com>
-
- 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.
-
- * decl.c (build_cp_library_fn): Set DECL_CONTEXT.
-
- * method.c (mangle_expression): Adjust test for legal expression
- operators.
-
- * pt.c (instantiate_decl): Save and restore the local
- specializations list.
-
-2000-05-30 Jason Merrill <jason@decepticon.cygnus.com>
-
- * decl.c (grok_reference_init): Pass LOOKUP_ONLYCONVERTING.
-
-2000-05-30 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
- * ir.texi: Update thunk documentation.
-
- * call.c (joust): Fix handling of overloaded builtin operators.
-
-2000-05-30 Zack Weinberg <zack@wolery.cumb.org>
-
- * 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.
-
- * tinfo2.cc: Include stdlib.h.
-
-2000-05-29 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (CLASSTYPE_ALIGN_UNIT): New macro.
- * class.c (layout_empty_base): Use CLASSTYPE_ALIGN_UNIT, not
- CLASSTYPE_ALIGN.
-
-2000-05-28 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * decl2.c (lang_decode_option): Use skip_leading_substring instead
- of plain strncmp.
-
-2000-05-28 Alexandre Oliva <aoliva@cygnus.com>
-
- * operators.def (<?): Duplicated, should have been...
- (>?): this. Fixed.
-
-2000-05-27 Alex Samuel <samuel@codesourcery.com>
- Mark Mitchell <mark@codesourcery.com>
-
- * 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_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.
-
-2000-05-27 Zack Weinberg <zack@wolery.cumb.org>
-
- * Make-lang.in (cplib2.ready): Eradicate.
-
-Sat May 27 11:25:46 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * 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.
-
-2000-05-26 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (layout_nonempty_base_or_field): Replace
- `record_layout_info' with `record_layout_info_s'.
-
-2000-05-26 Jason Merrill <jason@casey.soma.redhat.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 (sort_member_init): Fix typo in error message generation
- code.
-
-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.
- * 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
+ PR c++/13157
+ * name-lookup.c (lookup_using_namespace): Remove spacesp
parameter.
+ (unqualified_namespace_lookup): Likewise.
+ (lookup_qualified_name): Adjust accordingly.
+ (lookup_name_real): Likewise.
+ (lookup_arg_dependent): Do not eliminate the namespace of the
+ functions found by unqualified name lookup unless that is the
+ current namespace.
-2000-05-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * tinfo.cc (__dynamic_cast): Use a reinterpret_cast. Fix
- offsetof expansion.
-
-2000-05-08 Branko Cibej <branko.cibej@hermes.si>
-
- * inc/cxxabi.h: Fix typos in comment.
- (__base_class_info::__offset): Use a static_cast.
-
-2000-05-07 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2000-05-06 Richard Henderson <rth@cygnus.com>
-
- * typeck.c (build_c_cast): Don't warn integer->pointer size
- mismatch for constants.
-
-2000-05-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * rtti.c (ptmd_initializer): Set non-public, if class is
- incomplete.
-
- * 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.
-
-2000-05-04 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (update_vtable_entry_for_fn): Prototype.
-
- * pt.c (tsubst_decl): Initialize variables `argvec', `gen_tmpl'
- and `tmpl'.
-
- * search.c (dfs_build_inheritance_graph_order): Prototype.
-
-2000-05-04 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-05-03 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
- (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.
-
-2000-05-01 Jason Merrill <jason@casey.cygnus.com>
-
- * tree.c (build_target_expr_with_type): If we already have a
- TARGET_EXPR, just return it.
-
- * 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.
-
-2000-05-01 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-04-30 Scott Snyder <snyder@fnal.gov>
-
- * decl.c (finish_destructor_body): Use the base destructor when
- destroying virtual bases.
-
-2000-04-30 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
- * decl2.c (finish_file): Fix typo in comment.
-
- * method.c (emit_thunk): Don't try to return a `void' value.
-
- * optimize.c (initialize_inlined_parameters): If the parameter is
- addressable, we need to make a new VAR_DECL, even if the
- initializer is constant.
-
-2000-04-28 Cosmin Truta <cosmint@cs.ubbcluj.ro>
-
- * decl.c (grok_op_properties): Add an extra check of argtypes.
-
-2000-04-27 Mark Mitchell <mark@codesourcery.com>
-
- * optimize.c (copy_body_r): Use STRIP_TYPE_NOPS when copying
- variables.
- (initialize_inlined_parameters): Try to avoid creating new
- VAR_DECLs.
-
-2000-04-27 Alex Samuel <samuel@codesourcery.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.
-
-2000-04-26 Mark Mitchell <mark@codesourcery.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.
-
-2000-04-26 Jason Merrill <jason@casey.cygnus.com>
-
- * decl.c (finish_function): Don't play games with DECL_INLINE.
-
-2000-04-25 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
-
- * ir.texi: Correct typo.
-
-2000-04-25 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- * decl.c (grokdeclarator): Reject VLAs as members.
-
-2000-04-24 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * call.c (standard_conversion): Accept conversion between
- COMPLEX_TYPEs.
-
- * cvt.c (ocp_convert): Handle conversion to COMPLEX_TYPE.
-
-2000-04-24 Zack Weinberg <zack@wolery.cumb.org>
-
- * decl2.c (finish_file): Remove double setup for accounting
- compile time.
-
-2000-04-24 Robert Lipe <robertlipe@usa.net>
-
- * cp-tree.h (lang_type): Member `language' now ENUM_BITFIELD.
-
-2000-04-23 Benjamin Kosnik <bkoz@cygnus.com>
-
- * new.cc (set_new_handler): Needs to be in std::.
-
-2000-04-23 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-04-23 Richard Henderson <rth@cygnus.com>
-
- * typeck.c (c_expand_asm_operands): Restore the original
- contents of the output list.
-
-2000-04-22 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * ir.texi: Document complex number representation.
-
-2000-04-20 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
- * tinfo2.cc: Remove new-abi builtins comment.
-
-2000-04-20 Jason Merrill <jason@casey.cygnus.com>
-
- * typeck.c (build_x_function_call): Resolve an OFFSET_REF.
-
- * call.c (joust): Exit early if we get the same function, too.
-
- * decl2.c (key_method): Return NULL_TREE for template classes.
- (import_export_class): Don't need to check for template classes.
-
-2000-04-18 Zack Weinberg <zack@wolery.cumb.org>
-
- * lex.c: Remove references to cccp.c.
-
-2000-04-18 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-04-17 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (grokfield): Issue error on illegal data member
- declaration.
-
-Mon Apr 17 17:11:16 2000 Mark P Mitchell <mark@codesourcery.com>
-
- * method.c (make_thunk): Set DECL_CONTEXT for a THUNK_DECL.
-
-2000-04-16 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (build_vtable_entry): Don't build thunks for type-info
- functions.
-
-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.
-
-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.
-
- * 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.
-
- * 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.
-
- * 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.
-
-2000-04-11 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- * tree.h (HAVE_TEMPLATES): Remove definition.
- * lang-options.h (-fthis-is-variable): Remove documentation.
-
-2000-04-10 Jason Merrill <jason@casey.cygnus.com>
-
- * class.c (instantiate_type): Handle object-relative template-id.
-
- * semantics.c (finish_expr_stmt): Call convert_to_void here.
- * decl.c (cplus_expand_expr_stmt): Not here.
-
- * rtti.c (build_dynamic_cast_1): Call non_lvalue.
- Initialize exprtype earlier.
-
- * parse.y (fn.def1): Check for defining types in return types.
-
- * decl.c (check_tag_decl): Notice extra fundamental types.
- Diagnose empty decls in classes, too.
-
- * decl.c (grokdeclarator): Don't override an anonymous name if no
- declarator was given.
-
- * cvt.c (convert_to_void): Call resolve_offset_ref.
-
- * typeck.c (build_x_function_call): Abort if we get an OFFSET_REF.
-
- * decl2.c (decl_namespace): Handle getting a type.
-
- * typeck.c (build_c_cast): Re-enable warning for cast between
- pointer and integer of different size.
-
-2000-04-10 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2000-04-10 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- * 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.
-
-2000-04-09 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
- 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.
-
-2000-04-06 Nathan Sidwell <nathan@codesourcery.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.
-
-2000-04-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * rtti.c (dfs_class_hint_mark): New static function.
- (dfs_class_hint_unmark): New static function.
- (class_hint_flags): Use them.
-
-2000-04-05 Benjamin Kosnik <bkoz@cygnus.com>
-
- * decl2.c: Make flag_honor_std dependent on ENABLE_STD_NAMESPACE.
-
-2000-04-05 Mark Mitchell <mark@codesourcery.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.
-
-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.
-
-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.
-
-2000-03-20 Jed Wing <jedwin@zloty.ugcs.caltech.edu>
- Jason Merrill <jason@casey.cygnus.com>
-
- * method.c (build_overload_int): Use host_integerp.
-
-2000-03-20 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
-
- * init.c (build_offset_ref): Handle the case of a templated member
- function.
-
-2000-03-19 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- * except.c (expand_exception_blocks): Clear catch_clauses_last.
-
-2000-03-18 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
- * class.c (check_bitfield_decl): Remove restriction on really long
- bitfields.
- (layout_class_type): Implement new ABI handling of bitfields
- longer than their types.
-
-2000-03-18 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- * parse.y (extdefs): Call ggc_collect.
- * parse.c: Regenerated.
-
-2000-03-18 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-Fri Mar 17 08:09:14 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * 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.
-
-2000-03-17 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck.c (require_complete_type): Don't assume size_zero_node.
- (complete_type_or_else): Likewise.
-
-2000-03-16 Steven Grady <grady@digitaldeck.com>
- Jason Merrill <jason@casey.cygnus.com>
-
- * rtti.c (build_dynamic_cast_1): Improve diagnostics.
-
-2000-03-16 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl2.c (grokfield): Bail out if type is error_mark_node.
-
-2000-03-15 Nathan Sidwell <nathan@codesourcery.com>
-
- * tinfo2.cc (__ptr_to_member_data): Rename to ...
- (__pointer_to_member_data): ... here. Adjust.
- * rtti.c (create_tinfo_types): Adjust.
-
-2000-03-15 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-2000-03-15 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (cp_finish_decl): Remove obsolete comment.
-
- * typeck.c (build_ptrmemfunc1): Kill uninitialized warning.
-
-2000-03-14 Mark Mitchell <mark@codesourcery.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.
-
-2000-03-14 Jeff Sturm <jsturm@sigma6.com>
-
- * except.c (expand_throw): Fix typo in _Jv_Sjlj_Throw.
-
-2000-03-13 Jason Merrill <jason@casey.cygnus.com>
-
- * decl.c (grokfndecl): Set TREE_NOTHROW if TYPE_NOTHROW_P.
-
- * 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.
-
-2000-03-11 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * lex.c (whitespace_cr): Compress consecutive calls to warning().
- (do_identifier): Ditto for error().
-
- * pt.c (convert_nontype_argument): Ditto for cp_error().
- (convert_template_argument): Ditto for cp_pedwarn().
-
-2000-03-11 Jason Merrill <jason@casey.cygnus.com>
-
- * exception.cc (__check_null_eh_spec): New fn.
- * except.c (expand_end_eh_spec): Call it if the spec is throw().
-
-2000-03-10 Jason Merrill <jason@casey.cygnus.com>
-
- * 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.
-
- * 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.
-
-2000-03-09 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (maybe_commonize_var): Skip all artificial decls.
- * pt.c (tsubst_decl): Don't copy TREE_ASM_WRITTEN.
-
-2000-03-10 Jason Merrill <jason@casey.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.
-
- 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 (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.
-
-2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * exception.cc (__cp_pop_exception): Cleanup the original object.
-
-2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * decl.c (grok_op_properties): Merge conversion to void warning
- with other silly op warnings.
-
-2000-03-08 Jason Merrill <jason@casey.cygnus.com>
-
- * typeck2.c (process_init_constructor): Set TREE_PURPOSE of
- array CONSTRUCTOR elements. Don't use expr_tree_cons.
-
-2000-03-08 Nathan Sidwell <nathan@codesourcery.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.
-
-2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck.c (convert_for_assignment): Don't look at array
- initializer.
- * call.c (convert_like_real): Likewise.
-
-2000-03-07 Jason Merrill <jason@casey.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.
-
- * search.c (note_debug_info_needed): Walk the bases even if we
- weren't deferring the type itself.
-
-2000-03-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * decl2.c (finish_objects): Constify a char*.
-
- * method.c (emit_thunk): Likewise.
-
-2000-03-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * typeck.c (dubious_conversion_warnings): Look through
- REFERENCE_TYPE.
-
-Mon Mar 6 08:46:47 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * 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.
-
- * lang-specs.h (as): Don't call if -syntax-only.
-
-2000-03-06 Mark Mitchell <mark@codesourcery.com>
-
- * expr.c (cplus_expand_expr, case STMT_EXPR): Don't set
- RTL_EXPR_HAS_NO_SCOPE after all.
-
-2000-03-05 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
- * pt.c (instantiate_decl): Clear TI_PENDING_TEMPLATE_FLAG a little
- later.
-
- * 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.
-
- * g++spec.c (lang_specific_driver): Add -fnew-abi at the start of
- the command-line, not the end.
-
-2000-03-01 Jason Merrill <jason@casey.cygnus.com>
-
- * pt.c (instantiate_decl): Clear TI_PENDING_TEMPLATE_FLAG.
-
-2000-03-02 Tom Tromey <tromey@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.
-
-Thu Mar 2 13:32:01 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * typeck.c (comptypes): Treat sizetype like its language equivalent.
-
-2000-03-01 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * typeck.c (maybe_warn_about_returning_address_of_local): Reorganize
- to merge reference/pointer code and fix incorrect warnings.
-
-2000-02-29 Jason Merrill <jason@casey.cygnus.com>
-
- * search.c (protected_accessible_p): Use context_for_name_lookup.
-
- * init.c (construct_virtual_bases): Fix thinko.
- * typeck.c (expand_ptrmemfunc_cst): Fix thinko.
-
-2000-03-01 Martin von Loewis <loewis@informatik.hu-berlin.de>
-
- * decl.c (current_function_decl): Move to toplev.c.
-
-2000-02-29 Nathan Sidwell <nathan@codesourcery.com>
-
- * 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.
-
-Mon Feb 28 08:15:23 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * 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 nonzero,
- 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.
-
-2000-02-26 Mark Mitchell <mark@codesourcery.com>
-
- * semantics.c (simplify_aggr_init_exprs_p): Don't walk into
- types.
-
-2000-02-25 Alfred Minarik <a8601248@unet.univie.ac.at>
-
- * rtti.c (get_vmi_pseudo_type_info): Move __vmi_class_type_info
- pseudo_type_info creation into the std namespace
-
-2000-02-26 Mark Mitchell <mark@codesourcery.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.
-
-Sat Feb 26 19:50:23 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * lang-options.h (-fmessage-length=): Add missing option.
-
- * Make-lang.in (CXX_SRCS): Add .h files and sort list.
-
-2000-02-26 Zack Weinberg <zack@wolery.cumb.org>
-
- * Make-lang.in: Delete refs to LIBGCC2_DEPS.
-
-Fri Feb 25 14:52:33 2000 Jim Wilson <wilson@cygnus.com>
-
- * optimize.c (expand_call_inline): Emit the return label before
- evaluating the return value.
-
-2000-02-24 Mark Mitchell <mark@codesourcery.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.
-
- * 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.
- * cp-tree.h: Adjust.
-
- * decl.c (redeclaration_error_message): Allow redeclaration of
- namespace-scope decls.
-
-2000-02-18 Martin von Loewis <loewis@informatik.hu-berlin.de>
-
- * typeck2.c (my_friendly_abort): Use GCCBUGURL.
-
-2000-02-17 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (add_method): Don't set DECL_VIRTUAL_CONTEXT.
- * decl2.c (grokclassfn): Likewise.
-
- * ir.texi: Document DECL_TEMPLATE_INSTANTIATIONS.
-
- * decl2.c (lang_decode_option): Don't set default message length
- here.
- * 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.
-
-2000-02-15 Jason Merrill <jason@casey.cygnus.com>
-
- * decl.c (xref_tag): Don't SET_IDENTIFIER_NAMESPACE_VALUE.
-
-2000-02-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (g++spec.o): Depend on $(GCC_H), not gcc.h.
-
-2000-02-15 Jonathan Larmour <jlarmour@redhat.co.uk>
-
- * lang-specs.h: Add new __GNUC_PATCHLEVEL__ define to default spec.
-
-2000-01-16 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * decl2.c (lang_decode_option): Enable automatic line wrapping.
-
-2000-02-13 Jason Merrill <jason@casey.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.
-
-2000-02-10 Mark Mitchell <mark@codesourcery.com>
-
- * ir.texi (ADDR_EXPR): Document the fact that an ADDR_EXPR can be
- used to create an implicit temporary.
-
- * class.c (dfs_modify_vtables): Tweak calculation of functions to
- override.
-
-2000-02-08 Nathan Sidwell <nathan@acm.org>
-
- * 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.
-
-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.
-
-Thu Jan 27 20:53:36 2000 Jim Wilson <wilson@cygnus.com>
-
- * optimize.c (remap_decl): Add walk_tree calls for DECL_SIZE (t)
- and TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t))).
-
-Thu Jan 27 13:54:12 2000 Mike Stump <mrs@wrs.com>
-
- * decl.c (pushdecl): Fix up shadow warnings with respect to implicit
- for scopes.
-
-2000-01-26 Jason Merrill <jason@casey.cygnus.com>
-
- * pt.c (unify): Use fold, not maybe_fold_nontype_arg.
-
-Wed Jan 26 22:19:14 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * optimize.c (calls_setjmp_r): Supply new argument
- to special_function_p.
-
-2000-01-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * call.c: PROTO -> PARAMS.
- * class.c: Likewise.
- * cp-tree.h: Likewise.
- * 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.
- * 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.
-
-2000-01-25 Richard Henderson <rth@cygnus.com>
-
- * typeck.c (build_binary_op_nodefault): Remove UNNE_EXPR.
-
-2000-01-25 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
-2000-01-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2004-01-04 Andrew Pinski <pinskia@physics.uc.edu>
- * decl.c (member_function_or_else): Change third arg from a format
- specifier to an `enum overload_flags'. Callers changed.
+ * semantics.c (push_deferring_access_checks): Fix format.
+ (resume_deferring_access_checks): Likewise.
+ (stop_deferring_access_checks): Likewise.
+ (pop_deferring_access_checks): Likewise.
+ (get_deferred_access_checks): Likewise.
+ (pop_to_parent_deferring_access_checks): Likewise.
+ (perform_deferred_access_checks): Likewise.
+ (perform_or_defer_access_check): Likewise.
-2000-01-25 Gabriel Dos Reis <gdr@codesourcery.com>
+2004-01-04 Richard Henderson <rth@redhat.com>
- * 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.
+ * call.c (build_over_call): Don't create a save_expr of an
+ aggregate, but rather its address.
-2000-01-24 Mark Mitchell <mark@codesourcery.com>
+2004-01-04 Mark Mitchell <mark@codesourcery.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.
+ PR c++/13529
+ * parser.c (cp_parser_postfix_expression): Allow "." to appear in
+ an offsetof expression.
-2000-01-24 Jason Merrill <jason@casey.cygnus.com>
+ * parser.c (cp_parser_parameter_declaration): Fix comment.
- * pt.c (maybe_fold_nontype_arg): Do nothing if we're not in a
- template.
-
- * decl2.c (mark_used): Do instantiate inlines that have been
- explicitly instantiated.
-
-2000-01-24 Richard Henderson <rth@cygnus.com>
-
- * 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.
-
- * tinfo.cc (__GXX_ABI_VERSION): Test value and existence.
- * tinfo.h (__GXX_ABI_VERSION): Test value and existence.
-
-2000-01-23 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (__eprintf): Remove declaration.
- * tree.c (__eprintf): Remove definition.
-
-2000-01-23 Zack Weinberg <zack@rabi.columbia.edu>
- Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (CLASSTYPE_MARKED_N, SET_CLASSTYPE_MARKED_N,
- CLEAR_CLASSTYPE_MARKED_N): Avoid signed vs. unsigned warnings.
-
-2000-01-23 Brad Lucier <lucier@math.purdue.edu>
-
- * class.c (dump_class_hierarchy): Print HOST_WIDE_INT properly.
-
-2000-01-23 Mark Mitchell <mark@codesourcery.com>
-
- * 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.
-
- * typeck.c (convert_arguments): Restore two-message error
- reporting.
-
-2000-01-20 Nathan Sidwell <sidwell@codesourcery.com>
-
- 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.
-
-2000-01-19 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * typeck.c (build_unary_op): Use cp_pedwarn, not pedwarn.
-
- * typeck2.c (incomplete_type_error): Restore previous
- cp_error and cp_error_at call sequence.
-
-2000-01-20 Brad Lucier <lucier@math.purdue.edu>
-
- * class.c (dump_class_hierarchy): Make format agree with argument;
- cast pointer to unsigned long and print with %lx.
-
-2000-01-19 Gabriel Dos Reis <gdr@codesourcery.com>
-
- * decl2.c (lang_decode_option): Set default line-wrap length to 72.
-
- * 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.
-
-2000-01-19 Mark Mitchell <mark@codesourcery.com>
-
- * tree.c (bot_manip): Set DECL_CONTEXT for newly created
- VAR_DECLs.
-
-2000-01-18 Nathan Sidwell <sidwell@codesourcery.com>
-
- * cp-tree.h (get_tinfo_fn_dynamic): Remove prototype.
- (build_x_typeid): Likewise.
- (get_tinfo_fn): Likewise.
- (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.
-
-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_destructor_body): Likewise.
- (maybe_build_cleanup_1): Likewise.
- * decl2.c (reparse_decl_as_expr): Likewise.
- * init.c (perform_member_init): Likewise.
- (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.
+ PR c++/12226
+ * call.c (CHECK_COPY_CONSTRUCTOR_P): New macro.
+ (reference_binding): Set it when appropriate.
+ (build_temp): New function, split out from ...
+ (convert_like_real): ... here. Honor CHECK_COPY_CONSTRUCTOR_P.
+ (initialize_reference): Likewise.
- * 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.
-
- * 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.
-
- * decl2.c (import_export_class): Undo 12/14 change.
-
- * error.c (dump_decl): operator new, not operatornew.
-
- * 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.
-
-2000-01-05 Nathan Sidwell <nathan@acm.org>
-
- * decl2.c (lookup_arg_dependent): Deal with FNS not being a
- FUNCTION_DECL.
-
-2000-01-05 Nathan Sidwell <nathan@acm.org>
-
- * typeck.c (build_static_cast): Don't strip target qualifiers
- when casting from a class.
-
-2000-01-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (warn_hidden): Initialize variable `fndecl'.
-
-2000-01-03 Ulrich Drepper <drepper@cygnus.com>
-
- * decl.c (flag_isoc9x): New variable to be able to use code in
- c-common.c. For now always zero.
-
-2000-01-03 Mark Mitchell <mark@codesourcery.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.
-
-2000-01-02 Mark Mitchell <mark@codesourcery.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.
-
- * 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.
-
-2000-01-01 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- * call.c (build_new_method_call): Also check destructors.
+ PR c++/13536
+ * parser.c (cp_parser): Add in_type_id_in_expr_p.
+ (cp_parser_new): Initialize it.
+ (cp_parser_postfix_expression): Set it.
+ (cp_parser_sizeof_operand): Likewise.
+ (cp_parser_parameteR_declaration): Do not commit early to tenative
+ parsers when in_type_id_in_expr_p is set.
+
+2004-01-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/13094
+ * parser.c (cp_parser_template_argument): Don't call
+ make_unbound_class_template directly.
+ (cp_parser_lookup_name): Don't extract TEMPLATE_DECL from
+ UNBOUND_CLASS_TEMPLATE tree node.
+
+2004-01-02 Richard Sandiford <rsandifo@redhat.com>
+
+ PR target/12729
+ * method.c (use_thunk): Pass the CALL_EXPR through force_target_expr.
+
+2004-01-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/13520
+ * cp-tree.h (DECL_UNBOUND_CLASS_TEMPLATE_P): New macro.
+ (DECL_FUNCTION_TEMPLATE_P): Use it.
+ (DECL_CLASS_TEMPLATE_P): Likewise.
+ * parser.c (cp_parser_lookup_name): Add is_template parameter.
+ (cp_parser_type_parameter): Adjust call to cp_parser_lookup_name.
+ (cp_parser_template_name): Likewise.
+ (cp_parser_elaborated_type_specifier): Likewise.
+ (cp_parser_namespace_name): Likewise.
+ (cp_parser_class_name): Likewise.
+ (cp_parser_lookup_name_simple): Likewise.
+
+See ChangeLog.3 for earlier changes.
diff --git a/contrib/gcc/cp/ChangeLog.1 b/contrib/gcc/cp/ChangeLog.1
index 4b4afd3..01ef399 100644
--- a/contrib/gcc/cp/ChangeLog.1
+++ b/contrib/gcc/cp/ChangeLog.1
@@ -1386,7 +1386,7 @@ Wed May 10 00:55:59 1995 Jason Merrill <jason@phydeaux.cygnus.com>
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
+ * parse.y (FOR): Conditionalize the pushing and popping of scope for
the for-init-statement upon the new flag_new_for_scope.
* parse.y (try_block): Simplify and use compstmt.
@@ -7211,7 +7211,7 @@ Thu Mar 31 19:50:35 1994 Jason Merrill <jason@deneb.cygnus.com>
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.
+ functions. They can be defined somewhere else.
Sat Jan 23 23:23:26 1994 Stephen R. van den Berg <berg@pool.informatik.rwth-aachen.de>
diff --git a/contrib/gcc/cp/ChangeLog.2 b/contrib/gcc/cp/ChangeLog.2
index 26dc387..c4d6880 100644
--- a/contrib/gcc/cp/ChangeLog.2
+++ b/contrib/gcc/cp/ChangeLog.2
@@ -13405,7 +13405,7 @@ Tue Jan 27 16:42:21 1998 Mark Mitchell <mmitchell@usa.net>
(classtype_mangled_name): Likewise.
(lookup_template_class): Likewise.
(tsubst): Likewise.
- (more_specialized): Take explict template arguments as a
+ (more_specialized): Take explicit template arguments as a
parameter.
(most_specialized): Likewise.
(get_bindings): Likewise. Check that return types match before
@@ -13627,7 +13627,7 @@ Mon Jan 19 22:40:03 1998 Mark Mitchell <mmitchell@usa.net>
(instantiate_template): Use retrieve_specialization.
(do_decl_instantiation): Likewise.
(instantiate_decl): Likewise.
- (type_unification): Improve handling of explict template
+ (type_unification): Improve handling of explicit template
arguments.
* tree.c (mapcar): Return error_mark_node, rather than aborting,
on VAR_DECLS, FUNCTION_DECLS, and CONST_DECLS.
@@ -20213,7 +20213,7 @@ Tue Jan 16 11:39:40 1996 Jason Merrill <jason@yorick.cygnus.com>
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
+ * decl.c (poplevel): When popping 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>
@@ -20673,3 +20673,5 @@ 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.
+
+See ChangeLog.1 for earlier changes.
diff --git a/contrib/gcc/cp/ChangeLog.3 b/contrib/gcc/cp/ChangeLog.3
new file mode 100644
index 0000000..995175c
--- /dev/null
+++ b/contrib/gcc/cp/ChangeLog.3
@@ -0,0 +1,22648 @@
+2003-12-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/13507
+ * decl.c (duplicate_decls): Use build_type_attribute_variant to
+ merge attributes.
+
+ PR c++/13494
+ * tree.c (build_cplus_array_type_1): Only build a minimal array
+ type for dependent types or domains.
+
+2003-12-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/12774
+ * typeck.c (comp_array_types): Fold non-dependent domains for
+ ABI-1.
+
+2003-12-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/13289
+ * semantics.c (finish_id_expression): Only check if the type of
+ a template argument is integral or enumeration when it is not
+ dependent.
+
+2003-12-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/12403
+ * parser.c (cp_parser_template_declaration_after_export): Set up
+ template specialization scope in case of explicit specialization.
+
+2003-12-28 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/13081
+ * decl.c (duplicate_decls): Preserve inline-ness when redeclaring
+ a function template.
+
+ PR c++/12613
+ * decl.c (reshape_init): Reject GNU colon-style designated
+ initializers in arrays.
+
+ PR c++/13009
+ * call.c (build_special_member_call): Do not assume that we have a
+ pointer to the complete object in an assignment operator.
+
+2003-12-28 Roger Sayle <roger@eyesopen.com>
+
+ PR c++/13070
+ * decl.c (duplicate_decls): When setting the type of an anticipated
+ declaration, merge the existing type attributes.
+
+2003-12-25 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR c++/13268, c++/13339
+ * class.c (add_method): Return early when method is error_mark_node.
+ * pt.c (tsubst_friend_function): Return early when new_friend is
+ error_mark_node.
+
+2003-12-23 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-lang.c (cp_expr_size): Return zero for empty classes.
+
+ * cp-tree.h (warn_if_uknown_interface): Remove unused function.
+ * decl2.c (warn_if_unknown_interface): Likewise.
+
+2003-12-23 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/13387
+ * cp-lang.c (cxx_get_alias_set): Correct logic for a base type.
+
+2003-12-22 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (start_function): Do not check
+ flag_alt_external_templates or flag_external_templates.
+ * decl2.c (warn_if_unknown_interface): Likewise.
+ * lex.c (extract_interface_info): Likewise.
+ * pt.c (lookup_template_class): Likewise.
+
+ PR c++/12862
+ * name-lookup.c (pushdecl): Look up all namespace-scope entities
+ in their corresponding namespace.
+
+ PR c++/12397
+ * typeck.c (finish_class_member_access_expr): Don't tree
+ IDENTIFIER_NODEs as non-dependent expressions.
+
+2003-12-22 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR c++/5050
+ * tree.c (cp_start_inlining): Remove.
+ (cp_end_inlining): Remove.
+ * cp-lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING): Do not define.
+ (LANG_HOOKS_TREE_INLINING_END_INLINING): Do not define.
+ * cp-tree.h (cp_start_inlining): Do not declare.
+ (cp_end_inlining): Do not declare.
+
+2003-12-22 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12479
+ * parser.c (cp_parser_declaration_seq_opt): Only issue "extra ;"
+ pedwarn when not in a system header.
+
+2003-12-21 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (cp_tree_index): Remove CPTI_RECORD_TYPE,
+ CPTI_UNION_TYPE, CPTI_ENUM_TYPE.
+ (record_type_node): Remove.
+ (union_type_node): Likewise.
+ (enum_type_node): Likewise.
+ * decl.c: Remove mention of above tree nodes in comment.
+ * lex.c (cxx_init): Do not assign to record_type_node,
+ union_type_node, or enum_type_node. Simplify handling of
+ class_type_node.
+
+ PR c++/11554
+ * init.c (sort_mem_initializers): Add warning.
+
+2003-12-21 Kazu Hirata <kazu@cs.umass.edu>
+
+ * call.c: Fix comment formatting.
+ * class.c: Likewise.
+ * cp-tree.h: Likewise.
+ * cvt.c: Likewise.
+ * cxx-pretty-print.c: Likewise.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * error.c: Likewise.
+ * except.c: Likewise.
+ * init.c: Likewise.
+ * name-lookup.c: Likewise.
+ * parser.c: Likewise.
+ * pt.c: Likewise.
+ * rtti.c: Likewise.
+ * semantics.c: Likewise.
+ * typeck.c: Likewise.
+ * typeck2.c: Likewise.
+
+2003-12-19 Kazu Hirata <kazu@cs.umass.edu>
+
+ * cvt.c: Remove uses of "register" specifier in
+ declarations of arguments and local variables.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * expr.c: Likewise.
+ * friend.c: Likewise.
+ * lex.c: Likewise.
+ * name-lookup.c: Likewise.
+ * repo.c: Likewise.
+ * search.c: Likewise.
+ * tree.c: Likewise.
+ * typeck.c: Likewise.
+ * typeck2.c: Likewise.
+
+2003-12-19 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12795
+ * name-lookup.c (pushdecl): Do not treated any functions as being
+ "nested" in C++.
+
+2003-12-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/13371
+ * typeck.c (build_modify_expr): Stabilize lhs if we're narrowing.
+ * cvt.c (convert_to_void): Don't warn about the RHS of a comma
+ being useless if TREE_NO_UNUSED_WARNING is set.
+
+2003-12-18 Richard Henderson <rth@redhat.com>
+
+ * cp-tree.h (struct lang_type_header): Remove __extension__.
+
+2003-12-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/12253
+ * init.c (build_vec_init): Initialization of an element from
+ an initializer list is also a full-expression.
+
+ * parser.c, pt.c, semantics.c: Rename constant_expression_p
+ to integral_constant_expression_p.
+
+2003-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/13262
+ * pt.c (instantiate_decl): Wrap push_nested_class and
+ pop_nested_class around cp_finish_decl call for static member
+ variable.
+
+2003-12-18 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/9154
+ * parser.c (cp_parser_template_argument): A type-id followed by '>>'
+ is just an user typo, and should be accepted as last resort if any
+ other parsing fails.
+ (cp_parser_enclosed_template_argument_list): If the argument list is
+ parsed correctly, but the next token is '>>', emit a diagnostic.
+ (cp_parser_next_token_ends_template_argument): Accept '>>' as
+ delimiter of template argument, it will be later detected as a typo.
+
+2003-12-17 Kelley Cook <kcook@gcc.gnu.org>
+
+ * Make-lang.in: Replace cp/g++.1 with $(docobjdir)/g++.1.
+
+2003-12-17 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10603
+ PR c++/12827
+ * parser.c (cp_parser_error): Help c_parse_error print good
+ messages if the next token is a keyword.
+ (cp_parser_parameter_declaration_list): When resynchronizing after
+ a bad parameter declaration, stop if a comma is found.
+ (cp_parser_parameter_declaration): Avoid backtracking.
+
+2003-12-16 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12696
+ * decl.c (reshape_init): Recover quickly from errors.
+
+2003-12-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9043
+ C++ ABI change: Mangling array indices in templates.
+ * decl.c (compute_array_index_type): Reorganize for earlier
+ template errors. Use value_dependent_expression_p for abi-2.
+ * mangle.c (write_array_type): Check broken mangling for
+ expression indices on abi-1
+
+2003-12-16 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12696
+ * decl.c (reshape_init): Recover quickly from errors.
+
+ PR c++/13275
+ * lex.c (reswords): Add "__offsetof" and "__offsetof__".
+ * parser.c (cp_parser): Add in_offsetof_p.
+ (cp_parser_new): Initialize it.
+ (cp_parser_primary_expression): Handle __offsetof__ (...).
+ (cp_parser_postfix_expression): Allow casts to pointer type and
+ uses of "->" in a constant expression if implementing offsetof.
+ (cp_parser_unary_expression): Allow the use of "&" in a constant
+ expression if implementing offsetof.
+
+2003-12-16 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/2294
+ * name-lookup.c (push_overloaded_decl): always construct an OVERLOAD
+ if the declaration comes from an using declaration.
+
+2003-12-16 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ * semantics.c (finish_id_expression): Refactor the code to handle
+ template parameters, and emit a more informative error message
+ when they are used within an integral constant expression.
+
+2003-12-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/13387
+ * class.c (finish_struct_1): Compute mode and alias set for
+ CLASSTYPE_AS_BASE.
+ * call.c (build_over_call): Use CLASSTYPE_AS_BASE for trivial
+ assignment of a class, as necessary.
+ * cp-lang.c (cxx_get_alias_set): The alias set as a base is the
+ same as for the complete type.
+
+ PR c++/13242
+ C++ ABI change. Mangling template parameters of reference type
+ * mangle.c (write_template_args): Remove unreachable code.
+ (write_template_arg): Look through an argument of reference type.
+
+2003-12-16 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/2294
+ * name-lookup.c (push_overloaded_decl): always construct an OVERLOAD
+ if the declaration comes from an using declaration.
+
+2003-12-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10926
+ * decl2.c (grokfield): Robustify.
+
+ PR c++/11116
+ * parser.c (cp_parser_throw_expression): Determine whether or not
+ an assignment-expression is present by doing one-token lookahead.
+
+ PR c++/13269
+ * parser.c (cp_parser_function_definition_after_declarator): Stop
+ scanning tokens when reaching EOF.
+
+ PR c++/12989
+ * typeck.c (cxx_sizeof_or_alignof_expr): Robustify.
+
+ PR c++/13310
+ * pt.c (dependent_template_p): Handle OVERLOADs.
+
+2003-12-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/13243
+ PR c++/12573
+ * parser.c (cp_parser_postfix_expression): Tighten handling of
+ integral constant expressions.
+ (cp_parser_unary_expression): Likewise.
+ * pt.c (value_dependent_expression_p): Remove handling for
+ COMPONENT_REFs.
+
+2003-12-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (add_method): Disallow destructor for java classes.
+ * decl.c (xref_basetypes): Check java class inheritance.
+ * decl2.c (check_java_method): Skip artificial params.
+
+ PR c++/13241
+ C++ ABI change. Mangling of symbols in expressions.
+ * mangle.c (write_mangled_name): Add top_level flag. Rework for
+ nested and unnested mangling. Deal with abi version 1 and version
+ 2 differences.
+ (write_expression): Adjust write_mangled_name call.
+ (mangle_decl_string): Use write_mangled_name for all non-type decls.
+
+2003-12-14 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10779
+ PR c++/12160
+ * parser.c (struct cp_parser): Add in_template_argument_list_p.
+ (cp_parser_error): Use c_parse_error.
+ (cp_parser_name_lookup_error): New function.
+ (cp_parser_new): Initialize it.
+ (cp_parser_declarator): Add parenthesized_p parameter.
+ (cp_parser_nested_name_specifier_opt): Use
+ cp_parser_name_lookup_error.
+ (cp_parser_parenthesized_expression_list): Improve comments.
+ (cp_parser_condition): Adjust call to cp_parser_declarator.
+ (cp_parser_template_parameter): Adjust call to
+ cp_parser_parameter_declaration.
+ (cp_parser_template_argument_list): Set
+ in_template_argument_list_p.
+ (cp_parser_explicit_instantiation): Adjust call to
+ cp_parser_declarator.
+ (cp_parser_simple_type_specifier): Remove unncessary code.
+ (cp_parser_using_declaration): Use cp_parser_name_lookup_error.
+ (cp_parser_init_declarator): Handle member function definitions.
+ (cp_parser_direct_declarator): Adjust call to
+ cp_parser_declarator.
+ (cp_parser_type_id): Adjust call to cp_parser_declarator.
+ (cp_parser_parameter_declaration_list): Avoid backtracking where
+ possible.
+ (cp_parser_parameter_declaration): Add parenthesized_p parameter.
+ (cp_parser_function_definition): Remove.
+ (cp_parser_member_declaration): Do not backtrack to look for
+ function definitions.
+ (cp_parser_exception_declaration): Adjust call to
+ cp_parser_declarator.
+ (cp_parser_single_declaration): Handle function definitions via
+ cp_parser_init_declarator.
+ (cp_parser_save_member_function_body): New function.
+
+2003-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/13106
+ * decl.c (finish_function): Check if return type is dependent before
+ issuing no return statement warning.
+
+2003-12-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/13118
+ * cp-tree.h (lang_decl_u): Add thunk_alias member.
+ (THUNK_VIRTUAL_OFFSET): Must be a FUNCTION_DECL.
+ (THUNK_ALIAS_P): Remove.
+ (THUNK_ALIAS): Adjust.
+ * class.c (update_vtable_entry_for_fn): Get the vbase within the
+ overriding function's return type.
+ (dump_thunk): Adjust THUNK_ALIAS printing.
+ (build_vtbl_initializer): Adjust THUNK_ALIAS use.
+ * method.c (make_thunk): Revert 12881 test change. Clear
+ THUNK_ALIAS.
+ (finish_thunk): Adjust THUNK_ALIAS setting.
+ (use_thunk): Adjust THUNK_ALIAS use.
+ * semantics.c (emit_associated_thunks): Likewise.
+
+ PR c++/13114, c++/13115
+ * class.c (layout_empty_base): Propagate the move of an empty base
+ to offset zero.
+
+ PR c++/12881
+ * method.c (make_thunk): Deal with thunk aliases when searching
+ for a thunk. Robustify assertion.
+
+2003-12-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * mangle.c (conv_type_names): Holds IDENTIFIER_NODEs only.
+ (hash_type): Use TYPE_UID of the identifier's type.
+ (compare_type): Adjust.
+ (mangle_conv_op_name_for_type): Store identifier nodes only, use
+ TYPE_UID has hash value.
+
+2003-12-10 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (DECL_CONV_FN_P): Check that DECL_NAME is non-NULL.
+
+2003-12-08 Matt Austern <austern@apple.com>
+
+ PR c/13134
+ * decl.c (duplicate_decls): Copy visibility flag when appropriate.
+
+2003-12-09 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ * init.c (build_new_1): Deal with an OVERLOAD set when
+ looking up for _Jv_AllocObject.
+ * except.c (build_throw): Likewise for _Jv_Throw.
+
+2003-12-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/11971
+ * tree.c (build_local_temp): Split out from build_cplus_new.
+ (force_target_expr): New fn.
+ * call.c (call_builtin_trap): Call it. Take a type parm.
+ (convert_arg_to_ellipsis): Pass it.
+ (build_x_va_arg): Use call_builtin_trap.
+
+ PR c++/11929
+ * call.c (magic_varargs_p): New fn.
+ (build_over_call): Do no ellipsis conversions for arguments to
+ functions with magic varargs.
+
+ * name-lookup.c, init.c, except.c: Revert Giovanni's patch from
+ yesterday.
+
+ Give the anonymous namespace a null DECL_NAME.
+ * cp-tree.h: Don't declare anonymous_namespace_name.
+ * decl.c: Don't define it.
+ * dump.c (cp_dump_tree): Don't check for it.
+ * cxx-pretty-print.c (pp_cxx_original_namespace_definition): Likewise.
+ * error.c (dump_decl): Likewise.
+ * name-lookup.c: Define it here.
+ (push_namespace): Put it in DECL_ASSEMBLER_NAME instead.
+ * mangle.c (write_unqualified_name): Adjust.
+
+2003-12-07 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/2294
+ * name-lookup.c (push_overloaded_decl): Always construct an
+ OVERLOAD unless the declaration is a built-in.
+ (set_namespace_binding): While binding OVERLOADs with only one
+ declaration, we still need to call supplement_binding.
+ * init.c (build_new_1): Deal with an OVERLOAD set when
+ looking up for _Jv_AllocObject.
+ * except.c (build_throw): Likewise for _Jv_Throw.
+
+2003-12-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/13323
+ * class.c (same_signature_p): Handle conversion operators
+ correctly.
+ (check_for_override): Likewise.
+
+2003-12-06 Kelley Cook <kcook@gcc.gnu.org>
+
+ * Make-lang.in (GXX_CROSS_NAME, CXX_CROSS_NAME): Delete.
+ (c++.install_common, cp/g++.1, c++.install-man): Adjust for above.
+ (c++.uninstall): Likewise.
+
+2003-12-05 Danny Smith <dannysmith@gcc.gnu.org>
+ Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/13305
+ * parser.c (cp_parser_elaborated_type_specifier): Accept
+ attributes.
+
+2003-12-05 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/13314
+ * parser.c (cp_parser_class_specifier): Match push_scope/pop_scope
+ calls.
+ (cp_parser_class_head): Likewise.
+
+2003-12-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/13166
+ * parser.c (cp_parser_late_parsing_default_args): Make sure the
+ context is a class before calling push_nested_class and
+ pop_nested_class.
+
+2003-12-03 James E Wilson <wilson@specifixinc.com>
+
+ * g++spec.c (lang_specific_driver): Delete USE_LIBUNWIND_EXCEPTIONS
+ support.
+
+2003-12-03 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9127
+ * cp-tree.h (at_namespace_scope_p): New function.
+ * parser.c (cp_parser_class_head): Handle invalid explicit
+ specializations.
+ * search.c (at_namespace_scope_p): New function.
+
+ PR c++/13179
+ * semantics.c (finish_handler_parms): Do not call eh_type_info for
+ types used in templates.
+
+ PR c++/10771
+ * parser.c (cp_parser_check_for_invalid_template_id): New
+ function.
+ (cp_parser_simple_type_specifier): Use it.
+ (cp_parser_elaborated_type_specifier): Likewise.
+ (cp_parser_class_head): Likewise.
+
+2003-12-02 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/10126
+ * pt.c (convert_nontype_argument): Handle default conversions
+ while converting a pointer to member function.
+
+2003-12-02 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/12573
+ * pt.c (value_dependent_expression_p): Handle COMPONENT_REFs by
+ looking into them recursively.
+
+2003-12-02 Richard Henderson <rth@redhat.com>
+
+ * name-lookup.h (struct cp_binding_level): Use ENUM_BITFIELD.
+ * parser.c (struct cp_token): Likewise.
+ (struct cp_parser_token_tree_map_node): Likewise.
+ * lex.c (struct resword): Move const after ENUM_BITFIELD.
+
+2003-11-30 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9849
+ * parser.c (cp_lexer_prev_token): New function.
+ (cp_parser_skip_to_closing_parenthesis): Add consume_paren
+ parameter.
+ (cp_parser_nested_name_specifier_opt): Add is_declaration
+ parameter.
+ (cp_parser_nested_name_specifier): Likewise.
+ (cp_parser_class_or_namespace_name): Likewise.
+ (cp_parser_class_name): Likewise.
+ (cp_parser_template_id): Likewise.
+ (cp_parser_template_name): Likewise.
+ (cp_parser_id_expression): Adjust calls to
+ cp_parser_nested_name_specifier_op, cp_parser_template_id,
+ cp_parser_class_name.
+ (cp_parser_unqualified_id): Likewise.
+ (cp_parser_postfix_expression): Likewise.
+ (cp_parser_pseudo_destructor_name): Likewise.
+ (cp_parser_cast_expression): Likewise.
+ (cp_parser_mem_initializer_id): Likewise.
+ (cp_parser_simple_type_specifier): Likewise.
+ (cp_parser_type_name): Likewise.
+ (cp_parser_elaborated_type_specifier): Likewise.
+ (cp_parser_qualified_namespace_specifier): Likewise.
+ (cp_parser_using_declaration): Likewise.
+ (cp_parser_using_directive): Likewise.
+ (cp_parser_ptr_operator): Likewise.
+ (cp_parser_declarator_id): Likewise.
+ (cp_parser_class_head): Likewise.
+ (cp_parser_base_specifier): Likewise.
+ (cp_parser_constructor_declarator_p): Likewise.
+ (cp_parser_direct_declarator): Fix typo in comment.
+ (cp_parser_parenthesized_expression_list): Adjust call to
+ cp_parser_skip_to_closing_parenthesis.
+ (cp_parser_selection_statement): Likewise.
+
+2003-11-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/12924
+ * typeck.c (finish_class_member_access_expr): Handle TEMPLATE_ID_EXPR
+ with OVERLOAD and DECL nodes as the first operand.
+
+2003-11-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (tsubst) <ARRAY_REF>: Remove erroneous argument to build_nt.
+
+2003-11-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/5369
+ * friend.c (is_friend): Handle member function of a class
+ template as template friend.
+ (do_friend): Likewise.
+ * decl2.c (check_classfn): Add template_header_p parameter.
+ * decl.c (start_decl): Adjust check_classfn call.
+ (grokfndecl): Likewise.
+ * pt.c (is_specialization_of_friend): New function.
+ (uses_template_parms_level): Likewise.
+ (push_template_decl_real): Use uses_template_parms_level.
+ (tsubst_friend_function): Adjust check_classfn call.
+ * cp-tree.h (check_classfn): Adjust declaration.
+ (uses_template_parms_level): Add declaration.
+ (is_specialization_of_friend): Likewise.
+
+2003-11-21 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12515
+ * pt.c (build_non_dependent_expr): Handle GNU extension to ?:
+ operator.
+
+2003-11-21 Jan Hubicka <jh@suse.cz>
+
+ * parser.c (cp_parser_postfix_expression): Initialize 's' to
+ NULL_TREE.
+
+2003-11-20 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * Make-lang.in (c++.extraclean): Delete.
+
+2003-11-20 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * Make-lang.in (check-g++, lang_checks): Add.
+
+2003-11-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/12932
+ * class.c (currently_open_derived_class): Check if
+ current_class_type is NULL_TREE.
+ * semantics.c (finish_call_expr): Check if
+ currently_open_derived_class returns NULL_TREE.
+ * cp-tree.h (DERIVED_FROM_P): Add parenthesis around PARENT
+ parameter.
+
+2003-11-17 Jason Merrill <jason@redhat.com>
+
+ * init.c (build_new_1): Preevaluate placement args.
+ * call.c (build_op_delete_call): Don't expose placement args to
+ overload resolution.
+
+2003-11-16 Jason Merrill <jason@redhat.com>
+
+ * Make-lang.in (c++.tags): Create TAGS.sub files in each directory
+ and TAGS files that include them for each front end.
+
+2003-11-15 Bernardo Innocenti <bernie@develer.com>
+
+ PR c++/2294
+ * name-lookup.c: Revert previous patch for PR c++/2294 to prevent
+ build failure on libjava.
+
+2003-11-14 Giovanni Bajo <giovannibajo@libero.it>
+
+ PR c++/2294
+ * name-lookup.c (push_overloaded_decl): Always construct an OVERLOAD
+ unless the declaration is a built-in.
+ (set_namespace_binding): While binding OVERLOADs with only one
+ declaration, we still need to call supplement_binding.
+
+2003-11-14 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12762
+ * parser.c (cp_parser_enclosed_template_argument_list): New
+ function.
+ (cp_parser_template_id): Use it.
+ (cp_parser_simple_type_specifier): Recognize invalid template
+ syntax.
+
+2003-11-14 Giovanni Bajo <giovannibajo@libero.it>
+
+ PR c++/2094
+ * pt.c (unify): Add support for PTRMEM_CST and
+ FIELD_DECL unification.
+
+2003-11-13 Richard Earnshaw <rearnsha@arm.com>
+
+ * decl.c (grokfndecl): Change OK to type tree.
+
+2003-11-12 Mark Mitchell <mark@codesourcery.com>
+
+ * tree.c (build_target_expr_with_type): Treate VA_ARG_EXPR like
+ CONSTRUCTOR.
+
+ * decl.c (cp_make_fname_decl): When creating a top-level
+ __FUNCTION__-like symbol, do register it with pushdecl.
+
+ * decl.c (finish_case_label): Do not check that we are within a
+ switch statement here.
+ * parser.c (struct cp_parser): Add in_iteration_statement_p and
+ in_switch_statement_p.
+ (cp_parser_new): Initialize them.
+ (cp_parser_labeled_statement): Check validity of case labels
+ here.
+ (cp_parser_selection_statement): Set in_switch_statement_p.
+ (cp_parser_iteration_statement): Set in_iteration_statement_p.
+ (cp_parser_jump_statement): Check validity of break/continue
+ statements here.
+
+ PR c++/12735
+ * cp-tree.h (duplicate_decls): Return a tree.
+ * decl.c (duplicate_decls): Clarify documentation. Return
+ error_mark_node to indicate a failed redeclaration.
+ * friend.c (do_friend): Handle that case.
+ * name-lookup.c (pushdecl): Likewise.
+
+2003-11-11 Jason Merrill <jason@redhat.com>
+
+ * cp-tree.h (DECL_NAMESPACE_ASSOCIATIONS): New macro.
+ * name-lookup.c (parse_using_directive): New fn.
+ (is_associated_namespace): New fn.
+ (arg_assoc_namespace): Also check associated namespaces.
+ * name-lookup.h: Declare new fns.
+ * pt.c (maybe_process_partial_specialization): Allow
+ specialization in associated namespace.
+ * parser.c (cp_parser_using_directive): Accept attributes. Use
+ parse_using_directive.
+
+2003-11-10 Richard Henderson <rth@redhat.com>
+
+ * cvt.c (convert_to_void): Use void_zero_node after overload failure.
+
+2003-11-10 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/12832
+ * name-lookup.c (supplement_binding): Gracefully handle names
+ used at non-class scope prior declaration.
+
+2003-11-06 Matt Austern <austern@apple.com>
+
+ * decl.c (duplicate_decls): copy DECL_VISIBILITY field.
+ * method.c (use_thunk): give thunk same visibility as function.
+ * optimize.c (maybe_clone_body): copy DECL_VISIBILITY field.
+
+2003-11-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/11616
+ * pt.c (instantiate_pending_templates): Save and restore
+ input_location.
+
+2003-11-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/2019
+ * friend.c (add_friend): Don't display previous declaration in
+ case of duplicate friend warning.
+
+2003-11-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9810
+ * call.c (build_over_call): Check access using primary template
+ if FN is a member function template.
+
+2003-11-01 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/12796
+ * class.c (handle_using_decl): Set input_location before calling
+ error_not_base_type.
+
+2003-10-26 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10371
+ * semantics.c (finish_non_static_data_member): Handle when
+ both processing_template_decl and qualifying_scope are true.
+
+2003-10-24 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/11076
+ * class.c (handle_using_decl): Swap arguments of error_not_base_type.
+ * parser.c (cp_parser_direct_declarator): Only resolve typename for
+ namespace scope declarations.
+
+2003-10-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/12698, c++/12699, c++/12700, c++/12566
+ * cp-tree.h (THUNK_ALIAS_P, THUNK_ALIAS): New.
+ (debug_class, debug_thunks): New.
+ * class.c (dump_class_hierarchy_1): New break out from ...
+ (dump_class_hierarchy): ... here.
+ (dump_thunk, debug_thunks, debug_class): New.
+ (update_vtable_entry_for_fn): Add ssizetype casts. Correct
+ continued search for primary binfo via virtual.
+ (build_vtbl_initializer): Follow covariant thunk alias.
+ * method.c (make_thunk): Clear DECL_THUNKS of the thunk.
+ (finish_thunk): Look for an alias of the covariant thunk and point
+ to it.
+ (use_thunk): We should never use an alias.
+ * semantics.c (emit_associated_thunks): Do not emit aliases.
+
+ PR c++/12566
+ * cp-tree.h (cp_fname_init): Add TYPE pointer param.
+ * decl.c (cp_fname_init): Add TYPE pointer param. Set it. Don't
+ create an ad-hoc ERROR_MARK.
+ (cp_make_fname_decl): Adjust.
+ * pt.c (tsubst_expr): Adjust.
+
+2003-10-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/12726
+ * tree.c (build_target_expr_with_type): Don't call force_rvalue
+ for CONSTRUCTORs.
+
+2003-10-22 Kazu Hirata <kazu@cs.umass.edu>
+
+ * call.c: Fix comment formatting.
+ * class.c: Likewise.
+ * cxx-pretty-print.c: Likewise.
+ * init.c: Likewise.
+ * parser.c: Likewise.
+ * pt.c: Likewise.
+ * semantics.c: Likewise.
+ * tree.c: Likewise.
+ * typeck.c: Likewise.
+ * typeck2.c: Likewise.
+
+2003-10-21 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11962
+ * typeck.c (build_x_conditional_expr): Handle missing middle
+ operands in templates.
+ * mangle.c (write_expression): Issue errors about attempts to
+ mangle a non-existant middle operator to the ?: operator.
+
+2003-10-21 Robert Bowdidge <bowdidge@apple.com>
+ * decl.c (cp_finish_decl): Remove clause intended for asm directives
+ in struct or class fields: this code is never executed.
+
+2003-10-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * decl.c (start_decl): Exit if push_template_decl returns
+ error_mark_node.
+
+2003-10-20 Kazu Hirata <kazu@cs.umass.edu>
+
+ * ChangeLog: Fix typos.
+ * call.c: Fix comment typos.
+ * class.c: Likewise.
+ * cp-tree.h: Likewise.
+ * cvt.c: Likewise.
+ * cxx-pretty-print.c: Likewise.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * init.c: Likewise.
+ * mangle.c: Likewise.
+ * name-lookup.c: Likewise.
+ * parser.c: Likewise.
+ * search.c: Likewise.
+ * semantics.c: Likewise.
+ * tree.c: Likewise.
+ * typeck.c: Likewise.
+
+2003-10-20 Jan Hubicka <jh@suse.cz>
+
+ * decl.c (start_cleanup_fn): Set DECL_DECLARED_INLINE_P to deffer
+ the expansion.
+
+2003-10-20 Mark Mitchell <mark@codesourcery.com>
+
+ * Make-lang.in (c++.install-info): Remove.
+
+2003-10-20 Jason Merrill <jason@redhat.com>
+
+ * class.c (layout_class_type): Set DECL_ARTIFICIAL on padding
+ field.
+
+2003-10-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9781, c++/10583, c++/11862
+ * decl.c (cp_finish_decl): Exit immediately if decl is an
+ error_mark_node.
+ * pt.c (push_template_decl_real): Return error_mark_node for
+ invalid template declaration of variable.
+
+2003-10-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/12495
+ * pt.c (lookup_template_class): Handle when current_class_type
+ is a local class.
+
+2003-10-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/2513
+ * decl.c (make_typename_type): Use dependent_type_p.
+ (make_unbound_class_template): Likewise.
+ * pt.c (instantiate_class_template): Increment
+ processing_template_decl during substitution of template friend
+ function. Preincrement processing_template_decl rather than
+ postincrement.
+ (get_mostly_instantiated_function_type): Increment
+ processing_template_decl during partial substitution of function
+ type.
+
+2003-10-15 Jan Hubicka <jh@suse.cz>
+
+ PR c++/12574
+ * decl2.c (cxx_callgraph_analyze_expr): Deal with baselink.
+
+2003-10-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/11878
+ * tree.c (build_target_expr_with_type): Call force_rvalue for
+ classes with non-trivial copy ctors.
+
+ PR c++/11063
+ * typeck.c (build_modify_expr): Call convert rather than abort.
+
+2003-10-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ Breack out decl.c (3/n)
+ * name-lookup.c: Include flags.h
+ (lookup_name_current_level): Make static.
+ (add_decl_to_level): Likewise.
+ (push_local_binding): Likewise.
+ (push_overloaded_decl): Likewise.
+ (lookup_using_namespace): Likewise.
+ (qualified_lookup_using_namespace): Likewise.
+ (lookup_type_current_level): Likewise.
+ (unqualified_namespace_lookup): Likewise.
+ (namespace_ancestor): Likewise.
+ (push_using_directive): Likewise.
+ * decl.c (pushdecl): Move to name-lookup.c.
+ (pushdecl_top_level_1): Likewise.
+ (pushdecl_top_level): Likewise.
+ (pushdecl_top_level_and_finish): Likewise.
+ (maybe_push_decl): Likewise.
+ (push_using_decl): Likewise.
+ (push_overloaded_decl): Likewise.
+ (make_anon_name): Likewise.
+ (anon_cnt): Likewise.
+ (clear_anon_tags): Likewise.
+ (maybe_inject_for_scope_var): Likewise.
+ (check_for_out_of_scope_variable): Likewise.
+ * Make-lang.in (cp/name-lookup.o): Depend on flags.h.
+ * decl.c (warn_extern_redeclared_static): Export.
+ * cp-tree.h (warn_extern_redeclared_static): Declare.
+
+2003-10-14 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * Make-lang.in: Replace uses of $(target_alias) with
+ $(target_noncanonical).
+
+2003-10-13 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ * ChangeLog: Add PR number to patch for PR c++/12370.
+
+2003-10-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * name-lookup.h (cxx_scope_find_binding_for_name): Don't export.
+ (binding_for_name): Likewise.
+ (cxx_binding_clear): Move to name-lookup.c.
+ * name-lookup.c (cxx_scope_find_binding_for_name): Now static.
+ (binding_for_name): Likewise.
+ * decl2.c (is_ancestor): Move to name-lookup.c
+ (namespace_ancestor): Likewise.
+ (add_using_namespace): Likewise.
+ (ambiguous_decl): Likewise.
+ (lookup_using_namespace): Likewise.
+ (qualified_lookup_using_namespace): Likewise.
+ (set_decl_namespace): Likewise.
+ (decl_namespace): Likewise.
+ (current_decl_namespace): Likewise.
+ (push_decl_namespace): Likewise.
+ (pop_decl_namespace): Likewise.
+ (push_scope): Likewise.
+ (pop_scope): Likewise.
+ (struct arg_lookup): Likewise.
+ (arg_assoc): Likewise.
+ (arg_assoc_args): Likewise.
+ (arg_assoc_type): Likewise.
+ (add_function): Likewise.
+ (arg_assoc_namespace): Likewise.
+ (arg_assoc_class): Likewise.
+ (arg_assoc_template_arg): Likewise.
+ (do_namespace_alias): Likewise.
+ (validate_nonmember_using_decl): Likewise.
+ (do_nonmember_using_decl): Likewise.
+ (do_toplevel_using_decl): Likewise.
+ (do_local_using_decl): Likewise.
+ (do_class_using_decl): Likewise.
+ (do_using_directive): Likewise.
+ (constructor_name_full): Likewise.
+ (constructor_name): Likewise.
+ (constructor_name_p): Likewise.
+
+2003-10-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ Break out decl.c (2/n)
+ * name-lookup.c: Include diagnostic.h
+ (cxx_binding_free): Make static.
+ (cxx_binding_make): Likewise.
+ (binding_table_new): Likewise
+ (binding_table_free): Likewise.
+ (binding_table_insert): Likewise.
+ (binding_table_find_anon_type): Likewise.
+ (binding_table_reverse_maybe_remap): Likewise.
+ (supplement_binding): Likewise.
+ * name-lookup.h (global_scope_name): Declare extern.
+ (global_type_node): Likewise.
+ (cxx_binding_free): Don't export.
+ (cxx_binding_make): Likewise.
+ (binding_table_new): Likewise.
+ (binding_table_free): Likewise.
+ (binding_table_insert): Likewise.
+ (binding_table_find_anon_type): Likewise.
+ (binding_table_reverse_maybe_remap): Likewise.
+ * Make-lang.in (cp/name-lookup.o): Depend on $(DIAGNOSTIC_H)
+ * decl.c (lookup_namespace_name): Move to name-lookup.c
+ (select_decl): Likewise.
+ (unqualified_namespace_lookup): Likewise.
+ (lookup_qualified_name): Likewise.
+ (lookup_name_real): Likewise.
+ (lookup_name_nonclass): Likewise.
+ (lookup_function_nonclass): Likewise.
+ (lookup_name): Likewise.
+ (lookup_name_current_level): Likewise.
+ (lookup_type_current_level): Likewise.
+ (lookup_flags): Likewise.
+ (qualify_lookup): Likewise.
+ (lookup_tag): Likewise.
+ (lookup_tag_reverse): Likewise.
+ (getdecls): Likewise.
+ (storedecls): Remove.
+ (cxx_remember_type_decls): Move to name-lookup.c.
+ (global_bindings_p): Likewise.
+ (innermost_nonclass_level): Likewise.
+ (toplevel_bindings_p): Likewise.
+ (namespace_bindings_p): Likewise.
+ (kept_level_p): Likewise.
+ (innermost_scope_kind): Likewise.
+ (template_parm_scope_p): Likewise.
+ (push_binding): Likewise.
+ (push_local_binding): Likewise.
+ (add_decl_to_level): Likewise. Make extern.
+ (push_class_binding): Move to name-lookup.c.
+ (resume_level): Likewise. Rename to resume_scope.
+ (begin_scope): Move to name-lookup.c.
+ (indent): Likewise.
+ (binding_depth): Likewise.
+ (is_class_level): Likewise.
+ (cxx_scope_descriptor): Likewise.
+ (cxx_scope_debug): Likewise.
+ (namespace_scope_ht_size): Likewise.
+ (leave_scope): Likewise.
+ (pushlevel_class): Likewise.
+ (poplevel_class): Likewise.
+ (clear_identifier_class_values): Likewise.
+ (pushdecl_with_scope): Likewise.
+ (pushdecl_namespace_level): Likewise.
+ (pushdecl_class_level): Likewise.
+ (push_class_level_binding): Likewise.
+ (push_using_directive): Likewise.
+ (identifier_global_value): Likewise.
+ (keep_next_level_flag): Likewise.
+ (keep_next_level): Likewise.
+ (free_binding_level): Likewise.
+ (set_class_shadows): Likewise.
+ (maybe_push_cleanup_level): Likewise.
+ (cp_namespace_decls): Likewise.
+ (bt_print_entry): Likewise.
+ (print_binding_level): Likewise.
+ (print_other_binding_stack): Likewise.
+ (print_binding_stack): Likewise.
+ (push_namespace): Likewise.
+ (pop_namespace): Likewise.
+ (push_nested_namespace): Likewise.
+ (pop_nested_namespace): Likewise.
+ (cxx_saved_binding_make): Likewise.
+ (struct cxx_saved_binding_make): Likewise.
+ (store_bindings): Likewise.
+ (maybe_push_to_top_level): Likewise.
+ (push_to_top_level): Likewise.
+ (pop_from_top_level): Likewise.
+ (identifier_type_value): Likewise.
+ (set_identifier_type_value): Likewise.
+ (set_identifier_type_value_with_scope): Likewise.
+ (pop_everything): Likewise.
+ (pushtag): Likewise.
+ (follow_tag_typedef): Likewise.
+ (maybe_process_template_type_declaration): Likewise.
+ (pop_binding): Likewise.
+ * cp-tree.h: Move corresponding declarations to name-lookup.h
+
+2003-10-12 Steven Bosscher <steven@gcc.gnu.org>
+
+ * cvt.c (ocp_convert): Move warning to C common code.
+
+2003-10-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/6392
+ * tree.c (build_cplus_array_type): Handle all quals the same.
+ (cp_build_qualified_type_real): Look through arrays first.
+
+ * tree.c (build_cplus_new): Use build_decl to create a VAR_DECL.
+ (build_target_expr_with_type): Likewise.
+
+ * pt.c (instantiate_class_template): Sanity check that our
+ enclosing class has been instantiated.
+
+2003-10-08 Giovanni Bajo <giovannibajo@libero.it>
+
+ * cp_tree.h: Added TFF_NO_FUNCTION_ARGUMENTS.
+ * error.c (dump_function_decl): Use it to skip the dump of the
+ arguments.
+ (dump_expr): When dumping a declaration found within an
+ expression, always set TFF_NO_FUNCTION_ARGUMENTS
+ in the flags.
+
+2003-10-08 Giovanni Bajo <giovannibajo@libero.it>
+
+ PR c++/11097
+ * pt.c (tsubst_decl): Substitute also the DECL_NAME node of
+ USING_DECL.
+
+2003-10-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10147
+ * call.c (initialize_reference): Tweak error message.
+ * cxx-pretty-print.h (cxx_pretty_printer_flags): Remove
+ pp_cxx_flag_qualified_id and pp_cxx_flag_global_scope.
+ * cxx-pretty-print.c (pp_cxx_id_expression): Always display
+ qualified entities using qualified names.
+
+ PR c++/12337
+ * init.c (build_new_1): Make sure that the expression returned is
+ not an lvalue.
+
+ PR c++/12344, c++/12236, c++/8656
+ * decl.c (start_function): Do not ignore attributes embedded in a
+ function declarator.
+
+2003-10-06 Mark Mitchell <mark@codesourcery.com>
+
+ * Make-lang.in (c++.info): Remove.
+ (c++.dvi): Remove.
+ (c++.generated-manpages): Replace with ...
+ (generated-manpages): ... this.
+
+2003-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c (struct cp_binding_level): Move to name-lookup.h
+ (current_binding_level): Likewise.
+ (class_binding_level): Likewise.
+ * cp-tree.h (enum scope_kind): Likewise.
+
+2003-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * name-lookup.c (binding_entry_free): Nullify name and type
+ fields.
+
+2003-10-02 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12486
+ * typeck.c (finish_class_member_access_expr): Issue diagnostic
+ on erroneous use of qualified name.
+
+2003-09-30 Richard Henderson <rth@redhat.com>
+
+ PR c++/12370
+ * decl.c (duplicate_decls): Copy DECL_SAVED_INSNS too.
+
+2003-09-30 Kelley Cook <kelleycoook@wideopenwest.com>
+
+ * g++spec.c: Convert to ISO C90 prototypes.
+ * parser.c: Likewise.
+
+2003-09-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c (pop_binding): Don't mess with nullifying binding->scope
+ here.
+ * name-lookup.c: Re-format.
+ (cxx_binding_free): Nullify binding->scope.
+
+2003-09-29 Jan Hubicka <jh@suse.cz>
+
+ PR C++/12047
+ * except.c (build_eh_type_type): Call mark_used on the type.
+
+2003-09-28 Richard Henderson <rth@redhat.com>
+
+ * typeck.c (c_expand_asm_operands): Take location_t, instead of
+ individual file and line.
+
+2003-09-28 Andreas Jaeger <aj@suse.de>
+
+ * decl.c (cxx_builtin_type_decls): Convert to ISO C90 function
+ definition.
+ * init.c (push_base_cleanups): Likewise.
+ * decl2.c (finish_file): Likewise.
+ * mangle.c (init_mangle): Likewise.
+ (dump_substitution_candidates): Likewise.
+ * search.c: Likewise.
+
+2003-09-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * name-lookup.h (get_global_value_if_present): New function.
+ (is_typename_at_global_scope): Likewise.
+ * except.c (do_begin_catch): Use get_global_value_if_present.
+ (do_end_catch): Likewise.
+ (do_allocate_exception): Likewise.
+ (do_free_exception): Likewise.
+ (build_throw): Likewise.
+ * parser.c (cp_parser_member_declaration): Likewise.
+ * rtti.c (throw_bad_cast): Likewise.
+ (throw_bad_typeid): Likewise.
+ * decl.c (check_tag_decl): Use is_typename_at_global_scope.
+ (grokdeclarator): Likewise.
+ * cp-tree.h (global_namespace): Move to name-lookup.h
+ * call.c (call_builtin_trap): Tidy.
+
+2003-09-27 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/11415
+ * parser.c (cp_parser_nested_name_specifier_opt): Issue correct
+ error message when parser->scope is global_namespace.
+
+2003-09-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-tree.h, name-lookup.h, decl.c, decl2.c: Remove reference to
+ macros BINDING_SCOPE, BINDING_VALUE and BINDING_TYPE.
+
+2003-09-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c (pop_binding_level, suspend_binding_level,
+ find_class_binding_level): Merge into leave_scope. Remove.
+ (leave_scope): New function.
+ (poplevel): Update.
+ (poplevel_class): Likewise.
+ (pop_namespace): Likewise.
+
+2003-09-25 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/5655
+ * parser.c (cp_parser_check_access_in_redeclaration): New function.
+ (cp_parser_member_declaration): Use it.
+ (cp_parser_template_declaration_after_export): Likewise.
+
+2003-09-22 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-tree.h (scope_kind): Add new enumerator.
+ (keep_next_level): Change parameter type to bool.
+ (begin_scope): Change prototype.
+ (pushlevel): Remove declaration.
+ * decl.c (push_binding_level): Fold in begin_scope. Remove.
+ (struct cp_binding_level): Remove tag_tranparent field. Make keep
+ of bitsize one.
+ (keep_next_level_flag): Make a bool.
+ (cxx_scope_descriptor): Update scope names table
+ (make_cxx_scope): Fold in begin_scope. Remove..
+ (namespace_scope_ht_size): New function.
+ (begin_scope): Change prototype. Return a scope. Tidy.
+ (kept_level_p): Update.
+ (pushlevel): Remove.
+ (maybe_push_cleanup_level): Simplify.
+ (poplevel): Update for sk_cleanup and keep change.
+ (print_binding_level): Likewise.
+ (initial_push_namespace_scope): Fold in begin_scope. Remove.
+ (push_namespace): Update.
+ (pushtag): Likewise.
+ (lookup_tag): Likewise.
+ (lookup_name_current_level): Likewise.
+ (lookup_type_current_level): Likewise.
+ (cxx_init_decl_processing): Likewise.
+ (start_function): Likewise.
+ (begin_function_body): Likewise.
+ (start_method): Likewise.
+ * pt.c (push_inline_template_parms_recursive): Likewise.
+ (begin_template_parm_list): Likewise.
+ (begin_specialization): Likewise.
+ * semantics.c (do_pushlevel): Likewise.
+ (begin_compound_stmt): Likewise.
+ (begin_stmt_expr): Likewise.
+
+2003-09-21 Richard Henderson <rth@redhat.com>
+
+ * class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c,
+ method.c, optimize.c, pt.c, semantics.c, tree.c: Revert.
+
+2003-09-21 Richard Henderson <rth@redhat.com>
+
+ * class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c,
+ method.c, optimize.c, pt.c, semantics.c, tree.c: Update for
+ DECL_SOURCE_LOCATION rename and change to const.
+
+2003-09-20 Richard Henderson <rth@redhat.com>
+
+ * decl.c, decl2.c, pt.c: Use %J in diagnostics.
+
+2003-09-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/157
+ * parser.c (cp_parser_direct_declarator): Clear
+ parser->num_template_parameter_lists when parsing function
+ parameters.
+ (cp_parser_constructor_declarator_p): Likewise.
+
+2003-09-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/495
+ * pt.c (tsubst_friend_class): Only use innermost template
+ arguments for the injected friend class template.
+
+2003-09-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/12332
+ * pt.c (instantiate_class_template): Increment
+ processing_template_decl around the tsubst of a template member
+ function.
+
+2003-09-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c (cxx_scope_descriptor): Fix thinko.
+ (struct cp_binding_level): Adjust type of binding_depth field.
+
+2003-09-18 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR c++/12320
+ * call.c (type_passed_as): Check for incomplete type.
+ (convert_for_arg_passing): Likewise.
+
+2003-09-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9848
+ * optimize.c (maybe_clone_body): Don't set MARK_USED on parameters
+ here.
+ * semantics.c (expand_body): Set it here on the remaining clones.
+
+2003-09-18 Roger Sayle <roger@eyesopen.com>
+
+ * lex.c (init_operators): Remove operator_name_info for FFS_EXPR.
+ * class.c (instantiate_type): Remove FFS_EXPR case.
+
+2003-09-18 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ * ChangeLog: Fix recent commit.
+
+2003-09-18 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ * ChangeLog: Add PR number to patch for PR c++/12316.
+
+2003-09-18 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * error.c (dump_type): Simplify. Use pp_type_specifier_seq for
+ "C" types.
+ * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Fix thinko.
+
+2003-09-17 Richard Henderson <rth@redhat.com>
+
+ * semantics.c (expand_body): Don't save/restore input_location.
+
+2003-09-17 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12266
+ * cp-tree.h (tsubst_flags_t): Add tf_conv.
+ * class.c (standard_conversion): Pass tf_conv to
+ instantiate_type.
+ (resolve_address_of_overloaded_function): Do not call mark_used
+ when just checking conversions.
+
+ PR debug/12066
+ * cp-lang.c (LANG_HOOKS_BUILTIN_TYPE_DECLS): Define.
+ * cp-tree.h (cxx_builtin_type_decls): Declare.
+ * decl.c (builtin_type_decls): New variables.
+ (cxx_builtin_type_decls): New function.
+ (record_builtin_type): Add to builtin_type_decls.
+
+2003-09-17 Richard Henderson <rth@redhat.com>
+
+ PR c++/12316
+ * semantics.c (expand_or_defer_fn): Inc/dec function_depth.
+
+2003-09-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/7939
+ * typeck.c (comptypes): Don't ICE when its first argument is
+ error_mark_node.
+ (compparms): Reverse the arguments of same_type_p.
+
+2003-09-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/12184
+ * typeck.c (convert_arguments): Return error_mark_node for an
+ incomplete parameter. Make error message more informative.
+
+2003-09-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/3907
+ * class.c (maybe_note_name_used_in_class): Refine test for whether
+ or not we are in a class scope.
+
+ * cp-tree.h (language_function): Remove x_expanding_p.
+ (expanding_p): Remove.
+ (doing_semantic_analysis_p): Remove.
+ (scope_kind): Add sk_function_parms, sk_class,
+ sk_namespace.
+ (innermost_scope_kind): New method.
+ * call.c (cxx_type_promotes_to): Use type_decays_to.
+ * cp-lang.c (LANG_HOOKS_PUSHLEVEL): Redefine.
+ (LANG_HOOKS_POPLEVEL): Likewise.
+ * decl.c (cp_binding_level): Remove parm_flag, template_parms_p,
+ template_spec_p, namespace_p, is_for_scope, is_try_scope, and
+ is_catch_scope. Add kind and explicit_spec_p.
+ (cxx_scope_descriptor): Use a lookup table.
+ (find_class_binding_level): Use "kind" field in binding_level, not
+ the various flags.
+ (pop_binding_level): Likewise.
+ (innermost_nonclass_level): Likewise.
+ (toplevel_bindings_p): Likewise.
+ (namespace_bindings_p): Likewise.
+ (template_parm_scope_p): Likewise.
+ (innermost_scope_kind): New method.
+ (current_tmpl_spec_kind): Use "kind" field in binding_level, not
+ the various flags.
+ (pushlevel): Remove check for doing_semantic_analysis_p.
+ (begin_scope): Simplify.
+ (add_decl_to_level): Use "kind" field in binding_level, not
+ the various flags.
+ (push_local_binding): Likewise.
+ (pop_label): Remove check for doing_semantic_analysis_p.
+ (poplevel): Use "kind" field in binding_level, not
+ the various flags.
+ (set_block): Remove check for doing_semantic_analysis_p.
+ (pushlevel_class): Use "kind" field in binding_level, not
+ the various flags.
+ (poplevel_class): Likewise.
+ (initial_push_namespace_scope): Likewise.
+ (maybe_push_to_top_level): Likewise.
+ (set_identifier_type_value_with_scope): Likewise.
+ (pop_everything): Likewise.
+ (maybe_process_template_type_declaration): Likewise.
+ (pushtag): Likewise.
+ (pushdecl): Likewise.
+ (pushdecl_with_scope): Likewise.
+ (check_previous_goto_1): Likewise.
+ (define_label): Likewise.
+ (finish_case_label): Likewise.
+ (lookup_tag): Likewise.
+ (unqualified_namespace_lookup): Likewise.
+ (lookup_name_real): Likewise.
+ (lookup_name_current_level): Likewise.
+ (lookup_type_current_level): Likewise.
+ (record_builtin_type): Likewise.
+ (cp_make_fname_decl): Likewise.
+ (maybe_inject_for_scope_var): Likewise.
+ (cp_finish_decl): Remove check for doing_semantic_analysis_p.
+ (start_function): Use begin_scope, not pushlevel.
+ (finish_function): Use "kind" field in binding_level, not
+ the various flags.
+ (start_method): Use begin_scope, not pushlevel.
+ (make_label_decl): Do not check expanding_p.
+ (save_function-data): Do not set expanding_p.
+ (cxx_push_function_context): Do not clear expanding_p.
+ * semantics.c (cxx_expand_function_start): Do not set expanding_p.
+
+2003-09-14 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_class_type): Make DECL_MODE match TYPE_MODE for
+ an bit-field whose width exceeds that of its type.
+
+2003-09-14 Geoffrey Keating <geoffk@apple.com>
+
+ * rtti.c (get_tinfo_decl): Set TREE_PUBLIC for typeinfo decls.
+
+2003-09-14 Kazu Hirata <kazu@cs.umass.edu>
+
+ * ChangeLog: Follow spelling conventions.
+ * parser.c: Likewise.
+
+2003-09-13 Richard Henderson <rth@redhat.com>
+
+ * decl2.c (finish_file): Check cgraph_assemble_pending_functions
+ during relaxation loop.
+
+2003-09-11 David Edelsohn <edelsohn@gnu.org>
+
+ * decl2.c (var_finalized_p): Swap arms of conditional.
+
+2003-09-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11788
+ * typeck.c (build_address): If it is a function, mark it used.
+ (build_unary_op): Do not lose object's side-effects when taking
+ address of static member function.
+ * class.c (resolve_address_of_overloaded_function): Use
+ tsubst_flags_t parameter. Only expect overload sets. Adjust.
+ (instantiate_type): Adjust flags passing. Do not lose object's
+ side-effects when taking address of static member function.
+
+2003-09-11 Richard Henderson <rth@redhat.com>
+
+ * semantics.c (expand_or_defer_fn): Update for new
+ cgraph_finalize_function argument.
+
+2003-09-10 Richard Henderson <rth@redhat.com>
+
+ * decl2.c (cxx_callgraph_analyze_expr): Mark argument unused.
+
+2003-09-10 Jan Hubicka <jh@suse.cz>
+
+ * decl2.c (var_finalized_p): New.
+ (maybe_emit_vtables, write_out_vars, finish_file): Use it.
+
+2003-09-10 Richard Henderson <rth@redhat.com>
+
+ * decl2.c (cxx_callgraph_analyze_expr): New, from corpse of
+ mark_member_pointers.
+ (lower_function): Remove.
+ * cp-tree.h: Update to match.
+ * cp-lang.c (LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): New.
+ (LANG_HOOKS_CALLGRAPH_LOWER_FUNCTION): Remove.
+
+2003-09-09 Richard Henderson <rth@redhat.com>
+
+ * semantics.c (expand_or_defer_fn): Update call to
+ cgraph_finalize_function.
+
+ * semantics.c (expand_or_defer_fn): Use cgraph_finalize_function
+ always.
+
+ * decl2.c (finish_file): Avoid out-of-bounds array reference
+ during memmove.
+
+2003-09-09 Richard Henderson <rth@redhat.com>
+
+ * decl2.c (mark_member_pointers): Rename from
+ mark_member_pointers_and_eh_handlers and don't check eh handlers.
+
+2003-09-09 Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
+
+ PR bootstrap/12168
+ * method.c (use_thunk): Clear DECL_RTL of copied nodes.
+
+2003-09-08 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-lang.c (LANG_HOOKS_REGISTER_BUILTIN_TYPE): Define to
+ c_register_builtin_type.
+
+ PR c++/11786
+ * decl2.c (add_function): Do not complain about seeing the same
+ non-function twice.
+ * semantics.c (perform_koenig_lookup): Improve documentation.
+
+ PR c++/5296
+ * pt.c (try_one_overload): Add addr_p parameter.
+ (resolve_overloaded_unification): Pass it.
+
+2003-09-08 Richard Henderson <rth@redhat.com>
+
+ * optimize.c (maybe_clone_body): Inc/dec function_depth.
+
+2003-09-08 Richard Henderson <rth@redhat.com>
+
+ * decl.c (finish_function): Clear current_function_decl.
+ * decl2.c (mark_used): Don't push/pop gc context.
+ * optimize.c (optimize_function): Likewise.
+ * tree.c (cp_cannot_inline_tree_fn): Likewise.
+ * pt.c (instantiate_decl): Inc/dec function_depth instead.
+ * semantics.c (expand_body): Update for tree_rest_of_compilation
+ nested argument.
+
+2003-09-07 Gabriel Dos Reis <gcc@integrable-solutions.net>
+
+ PR c++/11762
+ * error.c (dump_decl): Handle namespace-alias-definition.
+ * decl.c (warn_extern_redeclared_static): There is no point in
+ checking changes in storage class specifier for a namespace
+ declaration.
+ (duplicate_decls): Tidy diagnostic message.
+ * cxx-pretty-print.c (pp_cxx_left_brace): New macro.
+ (pp_cxx_right_brace): Likewise.
+ (pp_cxx_original_namespace_definition): New function.
+ (pp_cxx_namespace_alias_definition): Likewise.
+ (pp_cxx_declaration): Use them. Handle NAMESPACE_DECLs.
+
+2003-09-07 Jan Hubicka <jh@suse.cz>
+
+ * decl2.c (maybe_emit_vtables, write_out_vars, finish_file):
+ Avoid re-emitting variables in unit-at-a-time mode.
+
+2003-09-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11867
+ * call.c (standard_conversion): Improve comments.
+ (perform_direct_initialization): Make sure we return an expression
+ of the correct type.
+ * typeck.c (build_static_cast): Check for ambiguity and
+ accessibility when performing conversions.
+
+2003-09-06 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-tree.h (add_binding): Remove declaration.
+ * name-lookup.h (supplement_binding): Declare.
+ * decl.c (add_binding): Move to name-lookup.c.
+ (push_local_binding): Adjust.
+ (push_class_binding): Likewise.
+ (set_identifier_type_value_with_scope): Likewise.
+ * name-lookup.c (supplement_binding): Rename from add_binding.
+ Return a bool. Improve documentation.
+ (set_namespace_binding): Adjust.
+ * Make-lang.in (cp/name-lookup.o): Depend on toplev.h
+
+2003-09-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11794
+ * class.c (pushclass): Push dependent using decls for nested
+ classes of templates too.
+
+2003-09-06 Roger Sayle <roger@eyesopen.com>
+
+ PR c++/11409
+ * class.c (resolve_address_of_overloaded_function): When building
+ list of matching non-template function decls, ignore anticipated
+ declarations of undeclared or shadowed GCC builtins.
+
+2003-09-06 Steven Bosscher <steven@gcc.gnu.org>
+
+ PR c++/11595
+ * decl.c (define_label): Remove unreachable timevar pop.
+ Always return the decl, even if the definition is invalid.
+
+2003-09-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/12167
+ * parser.c (cp_parser_late_parsing_default_args): Push & pop the
+ unparsed functions queue.
+
+2003-09-05 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12163
+ * call.c (perform_direct_initialization): Correct logic for
+ direct-initialization of a class type.
+
+ PR c++/12146
+ * pt.c (lookup_template_function): Robustify.
+
+2003-09-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11922
+ * pt.c (tsubst_qualified_id): Make sure we get a non-type.
+ (tsubst_expr, tsubst_copy_and_build): Pass false, not zero, as
+ is_type_p to lookup_qualified_name.
+
+ * semantics.c (finish_call_expr): Refactor some code.
+
+ PR c++/12037
+ * cp-tree.h (COMPOUND_EXPR_OVERLOADED): New.
+ (build_min_non_dep): Declare.
+ * tree.c (build_min): Propagate TREE_SIDE_EFFECTS.
+ (build_min_non_dep): New.
+ * cvt.c (convert_to_void): Don't explicitly copy
+ TREE_SIDE_EFFECTS, TREE_NO_UNUSED_WARNING.
+ * call.c (build_new_method_call): Use build_min_non_dep.
+ * decl2.c (grok_array_decl): Likewise.
+ (build_offset_ref_call_from_tree): Likewise.
+ * typeck.c (finish_class_member_access_expr,
+ build_x_indirect_ref, build_x_binary_op, build_x_unary_op,
+ build_x_conditional_expr, build_x_compound_expr): Likewise.
+ (build_static_cast, build_reinterpret_cast,
+ build_const_cast): Propagate TREE_SIDE_EFFECTS inside a template.
+ * typeck2.c (build_x_arrow): Use build_min_non_dep.
+ (build_functional_cast): Propagate TREE_SIDE_EFFECTS inside a
+ template.
+ * rtti.c (build_dynamic_cast_1): Set DECL_IS_PURE.
+ (build_dynamic_cast): Set TREE_SIDE_EFFECTS.
+ * pt.c (build_non_dependent_expr): Check COMPOUND_EXPR_OVERLOADED.
+
+2003-09-04 Richard Henderson <rth@redhat.com>
+
+ * decl2.c (mark_member_pointers_and_eh_handlers): Update for
+ change in cgraph_mark_needed_node arguments.
+
+2003-09-02 Geoffrey Keating <geoffk@apple.com>
+
+ PR 12161
+ * decl2.c (mark_used): Use ggc_push_context/ggc_pop_context.
+ * tree.c (cp_cannot_inline_tree_fn): Likewise.
+
+2003-09-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (finish_sizeof, finish_alignof): Remove.
+ (expr_sizeof): Replace with ...
+ (cxx_sizeof_or_alignof_expr): ... here.
+ (cxx_sizeof_or_alignof_type): Make complain parameter a bool.
+ * parser.c (cp_parser_unary_expression): Commonize alignof and
+ sizeof handling.
+ * pt.c (tsubst_copy_and_build): Adjust alignof and sizeof
+ substitution.
+ * semantics.c (finish_sizeof, finish_alignof): Remove.
+ * typeck.c (cxx_sizeof_or_alignof_type): Complain parameter
+ becomes bool. Set TREE_READONLY.
+ (expr_sizeof): Replace with ...
+ (cxx_sizeof_or_alignof_expr): ... here. Clear TREE_SIDE_EFFECTS.
+
+2003-09-04 Mark Mitchell <mark@codesourcery.com>
+
+ Remove cast-as-lvalue extension.
+ * call.c (build_conditional_expr): Correct formatting.
+ (convert_like_real): Use lvalue_p, not non_cast_lvalue_p.
+ (initialize_real): Use real_lvalue_p, not real_non_cast_lvalue_p.
+ * cp-tree.h (non_cast_lvalue_p): Remove.
+ (real_non_cast_lvalue_p): Remove.
+ (non_cast_lvalue_or_else): Remove.
+ * tree.c (lvalue_p_1): Remove allow_cast_as_lvalue parameter.
+ (real_lvalue_p): Adjust call to lvalue_p_1.
+ (non_cast_lvalue_p): Remove.
+ (non_cast_lvalue_or_else): Remove.
+ (lvalue_p): Adjust call to lvalue_p_1.
+ (lvalue_or_else): Simplify.
+ * typeck.c (build_unary_op): Use lvalue_or_else, not
+ non_cast_lvalue_or_else.
+ (build_static_cast): Use real_lvalue_p, not real_non_cast_lvalue_p.
+
+2003-09-03 DJ Delorie <dj@redhat.com>
+
+ * decl.c (finish_function): Pass fndecl to aggregate_value_p.
+
+2003-09-03 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12053
+ * class.c (include_empty_classes): Correct logic for ABI version 1.
+
+2003-09-03 Richard Henderson <rth@redhat.com>
+
+ * optimize.c (optimize_function): Push/pop ggc context around
+ the call to optimize_inline_calls.
+
+2003-09-02 Scott Brumbaugh <scottb.lists@verizon.net>
+
+ PR c++/11553
+ * parser.c (cp_parser_decl_specifier_seq): Add check for a
+ duplicate friend decl-specifier.
+
+2003-09-02 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11847
+ * pt.c (convert_nontype_argument): Correct representation of
+ REFERENCE_TYPE expressions.
+
+ PR c++/11808
+ * cp-tree.h (KOENIG_LOOKUP_P): New macro.
+ (finish_call_expr): Change prototype.
+ * parser.c (cp_parser_postfix_expression): Adjust call to
+ finish_call_expr.
+ * pt.c (tsubst_copy_and_build): Use KOENIG_LOOKUP_P.
+ * semantics.c (finish_call_expr): Add koenig_p parameter.
+
+2003-09-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12114
+ * cp-tree.h (initialize_reference): Change prototype.
+ * call.c (initialize_reference): Add cleanup parameter.
+ * decl.c (grok_reference_init): Likewise.
+ (check_initializer): Likewise.
+ (cp_finish_decl): Insert a CLEANUP_STMT if necessary.
+ (duplicate_decls): When replacing an anticipated builtin, do not
+ honor TREE_NOTHROW.
+ * typeck.c (convert_for_initialization): Correct call to
+ initialize_reference.
+
+ PR c++/11972
+ * pt.c (dependent_type_p_r): Pass only the innermost template
+ arguments to any_dependent_template_arguments_p.
+
+2003-09-01 Josef Zlomek <zlomekj@suse.cz>
+
+ * error.c (dump_expr): Kill BIT_ANDTC_EXPR.
+ * lex.c (init_operators): Kill BIT_ANDTC_EXPR.
+ * pt.c (tsubst_copy): Kill BIT_ANDTC_EXPR.
+ * typeck.c (build_binary_op): Kill BIT_ANDTC_EXPR.
+ (tsubst_copy_and_build): Kill BIT_ANDTC_EXPR.
+
+2003-08-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12093
+ * pt.c (build_non_dependent_expr): Do not build a
+ NON_DEPENDENT_EXPR for a STRING_CST.
+
+ PR c++/11928
+ * search.c (add_conversions): Avoid adding two conversion
+ operators for the same type.
+
+2003-08-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/6196
+ * pt.c (tsubst_copy_and_build): Correct handling of
+ address-of-label extension.
+ * semantics.c (finish_goto_stmt): The address of a label must go
+ through the lvalue-to-rvalue conversion.
+
+2003-08-29 Richard Henderson <rth@redhat.com>
+ Jason Merrill <jason@redhat.com>
+
+ * cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New.
+ (LANG_HOOKS_RTL_EXPAND_STMT): New.
+ * cp-tree.h (cxx_expand_function_start): Declare.
+ * decl.c (start_function): Use allocate_struct_function.
+ Move stmts_are_full_exprs_p assertion from expand_body.
+ Do not free_after_parsing or free_after_compilation.
+ (cxx_push_function_context): Move code to set struct function
+ data from genrtl_start_function.
+ * optimize.c (optimize_function): Don't inc/dec function_depth.
+ * semantics.c (expand_body): Use tree_rest_of_compilation.
+ (cxx_expand_function_start): Rename from genrtl_start_function,
+ omit bits done by tree_rest_of_compilation.
+ (genrtl_finish_function): Remove.
+ (clear_decl_rtl): Move to ../tree-optimize.c.
+
+2003-08-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/11811
+ * cxx-pretty-print.c (pp_cxx_canonical_template_parameter): New
+ function.
+ * cxx-pretty-print.h: Declare.
+ * error.c (dump_template_parameter): Use it.
+ (dump_type): Likewise.
+
+2003-08-28 Mark Mitchell <mark@codesourcery.com>
+
+ * init.c (decl_constant_value): Deal with COND_EXPR specially.
+ * call.c (build_conditional_expr): Revert previous patch.
+
+ PR optimization/5079
+ * call.c (build_conditional_expr): Use decl_constant_value to
+ simplify the arguments.
+
+2003-08-26 Dan Nicolaescu <dann@ics.uci.edu>
+
+ * parser.c (struct cp_token): Use enum bitfields.
+ (CP_TOKEN_BLOCK_NUM_TOKENS): Make sure cp_token_block fits in a
+ 512B allocation unit.
+ (cp_parser_token_tree_map_node): Use enum bitfields.
+
+2003-08-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11871
+ * decl.c (push_class_level_binding): Correct old_decl value from
+ my 2003-07-29 reorganization.
+
+ * call.c (build_call): Don't set TREE_SIDE_EFFECTS here.
+ (build_new_method_call): Add goto finish.
+ * semantics.c (simplify_aggr_init_exprs_r): Don't set
+ TREE_SIDE_EFFECTS on a call.
+
+2003-08-25 Richard Henderson <rth@redhat.com>
+
+ * cxx-pretty-print.c (pp_cxx_class_name): Remove unused function.
+
+2003-08-25 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cxx-pretty-print.h (pp_cxx_flag_default_argument): New flag.
+ (cxx_pretty_printer): Adjust base type.
+ (pp_cxx_function_specifier): Declare.
+ * cxx-pretty-print.c (pp_cxx_whitespace): New macro.
+ (pp_cxx_left_paren): Likewise.
+ (pp_cxx_right_paren): Likewise.
+ (pp_cxx_dot): Likewise.
+ (pp_cxx_arrow): Likewise.
+ (pp_cxx_semicolon): Likewise.
+ (pp_cxx_identifier): Likewise.
+ (pp_cxx_cv_qualifier_seq): Likewise.
+ (pp_cxx_storage_class_specifier): Likewise.
+ (pp_cxx_expression_list): Likewise.
+ (pp_cxx_space_for_pointer_operator): Likewise.
+ (pp_cxx_init_declarator): Likewise.
+ (pp_cxx_call_argument_list): Likewise.
+ (pp_cxx_nonconsecutive_character): Tidy.
+ (pp_cxx_conversion_function_id): New function.
+ (pp_cxx_template_id): Likewise.
+ (pp_cxx_template_keyword_if_needed): Likewise.
+ (pp_cxx_nested_name_specifier): Likewise.
+ (pp_cxx_unqualified_id): Tidy
+ (pp_cxx_qualified_id): Handle more nodes.
+ (pp_cxx_primary_expression): Tidy.
+ (pp_cxx_postfix_expression): Likewise.
+ (pp_cxx_new_expression): Tidy.
+ (pp_cxx_delete_expression): Likewise.
+ (pp_cxx_cast_expression): New function.
+ (pp_cxx_pm_expression): Tidy.
+ (pp_cxx_conditional_expression): Likewise.
+ (pp_cxx_assignment_operator): New function.
+ (pp_cxx_assignment_expression): Tidy.
+ (pp_cxx_expression): New function.
+ (pp_cxx_function_specifier): Likewise.
+ (pp_cxx_decl_specifier_seq): Likewise.
+ (pp_cxx_simple_type_specifier): Tidy.
+ (pp_cxx_type_specifier_seq): Likewise.
+ (pp_cxx_ptr_operator): New function.
+ (pp_cxx_implicit_parameter_type): Likewise.
+ (pp_cxx_parameter_declaration): Tidy.
+ (pp_cxx_parameter_declaration_clause): New function.
+ (pp_cxx_exception_specification): Likewise.
+ (pp_cxx_direct_declarator): Tidy.
+ (pp_cxx_declarator): Likewise.
+ (pp_cxx_ctor_initializer): New function.
+ (pp_cxx_function_definition): Likewise.
+ (pp_cxx_abstract_declarator): Tidy.
+ (pp_cxx_direct_abstract_declarator): Likewise.
+ (pp_cxx_type_id): Likewise.
+ (pp_cxx_exception_declaration): New function.
+ (pp_cxx_statement): Likewise.
+ (pp_cxx_simple_declaration): Likewise.
+ (pp_cxx_template_parameter_list): Likewise.
+ (pp_cxx_template_parameter): Likewise.
+ (pp_cxx_template_declaration): Likewise.
+ (pp_cxx_explicit_specialization): Likewise.
+ (pp_cxx_explicit_instantiation): Likewise.
+ (pp_cxx_declaration): Tidy.
+ (pp_cxx_pretty_printer_init): Initialize more fields.
+
+2003-08-25 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8795
+ * cp-tree.h (build_cplus_method_type): Remove.
+ * call.c (standard_conversion): Use build_method_type_directly
+ instead of build_cplus_method_type.
+ * class.c (build_clone): Likewise.
+ (adjust_clone_args): Likewise.
+ * decl.c (build_ptrmem_type): Likewise.
+ (grokdeclarator): Likewise.
+ (check_function_type): Likewise.
+ * decl2.c (grok_method_quals): Likewise.
+ (maybe_retrofit_in_chrg): Likewise.
+ * pt.c (copy_default_args_to_explicit_spec): Likewise.
+ (tsubst_function_type): Likewise.
+ (tsubst): Likewise.
+ * tree.c (build_cplus_method_type): Remove.
+ * typeck.c (merge_types): Use build_method_type_directly.
+
+2003-08-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/3765
+ * search.c (dfs_access_in_type): Fix typo in comment.
+ (dfs_accessible_queue_p): Likewise.
+ (dfs_accessible_p): Only terminate when a friend is found.
+ (accessible_p): Return immediately if access_in_type allows
+ access.
+
+2003-08-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/641, c++/11876
+ * friend.c (add_friend): Add complain parameter.
+ (make_friend_class): Likewise.
+ (do_friend): Adjust add_friend call.
+ * decl.c (grokdeclarator): Adjust make_friend_class call.
+ * parser.c (cp_parser_member_declaration): Likewise.
+ (cp_parser_template_declaration_after_export): Likewise.
+ * pt.c (instantiate_class_template): Adjust make_friend_class
+ and add_friend call.
+ * cp-tree.h (make_friend_class): Adjust declaration.
+ (add_friend): Likewise.
+
+2003-08-21 Jason Merrill <jason@redhat.com>
+
+ PR c++/11283
+ * call.c (build_conditional_expr): Ignore cv-qual differences for
+ non-class types.
+
+2003-08-21 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11551
+ * parser.c (cp_parser_id_expression): Add declarator_p parameter.
+ (cp_parser_primary_expression): Adjust call to
+ cp_parser_id_expression.
+ (cp_parser_unqualified_id): Complain about the use of
+ typedef-names in a destructor declarator.
+ (cp_parser_postfix_expression): Adjust call to
+ cp_parser_id_expression.
+ (cp_parser_type_parameter): Likewise.
+ (cp_parser_template_argument): Likewise.
+ (cp_parser_declarator_id): Likewise.
+
+ PR c++/11919
+ * call.c (standard_conversion): Use same_type_p, not pointer
+ equality, to compare types.
+
+ PR c++/10762
+ * parser.c (cp_parser_using_declaration): Check for invalid uses
+ of template-ids here...
+ * decl2.c (do_class_using_decl): ... rather than here.
+
+2003-08-20 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11834
+ * pt.c (more_specialized): Bump processing_template_decl.
+
+2003-08-21 Jason Merrill <jason@redhat.com>
+
+ PR c++/11614
+ * decl.c (grokdeclarator): Recognize a flexible array based on the
+ type, not the form of the declarator.
+
+2003-08-20 Jason Merrill <jason@redhat.com>
+
+ * semantics.c (simplify_aggr_init_expr): Split out from
+ simplify_aggr_init_exprs_r. Convert slot address to match
+ the return type.
+ * cp-tree.h: Declare it.
+ * tree.c (cp_copy_res_decl_for_inlining): Don't clobber the
+ DECL_NAME of a user variable.
+
+2003-08-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11945
+ * pt.c (build_non_dependent_expr): Look inside COND_EXPR and
+ COMPOUND_EXPR.
+ * semantics.c (finish_expr_stmt): Always convert to void.
+ * typeck.c (build_x_compound_exp): Always convert to void.
+
+2003-08-19 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11684
+ * cp-tree.h (grok_op_properties): Change prototype.
+ * decl.c (grok_op_properties): Add complain parameter.
+ (grokfndecl): Pass it.
+ * pt.c (tsubst_decl): Adjust accordingly.
+
+ PR c++/10926
+ * decl.c (start_method): Return immediately if push_template_decl
+ does not like the declaration.
+ * pt.c (push_template_decl_real): Disallow member template
+ destructors.
+
+ PR c++/11036
+ * cp-tree.h (add_binding): Add prototype.
+ * class.c (add_method): Set TYPE_HAS_DESTRUCTOR if appropriate.
+ (maybe_warn_about_overly_private_class): Use
+ CLASSTYPE_DESTRUCTORS.
+ (pushclass): Adjust call to set_identifier_type_value.
+ * decl.c (add_binding): Give it external linkage.
+ (push_local_binding): Adjust call to add_binding.
+ (push_class_binding): Likewise.
+ (set_identifier_type_value_with_scope): Change prototype. Use
+ add_binding for global bindings.
+ (set_identifier_type_value): Adjust accordingly.
+ (pushtag): Likewise.
+ (pushdecl): Use set_identifier_type_value, not
+ set_identifier_type_value_with_scope.
+ (pushdecl_namespace_level): Adjust calls to
+ SET_IDENTIFIER_TYPE_VALUE to pass a DECL.
+ (pushdecl_class_level): Likewise.
+ (lookup_tag): Use select_decl.
+ (select_decl): Improve comment.
+ (record_builtin_type): Do not call pushdecl.
+ (cxx_init_decl_processing): Do not call xref_tag for bad_alloc.
+ (cp_finish_decl): Adjust call to set_identifier_type_value.
+ (check_elaborated_type_specifier): Improve checks for invalid uses
+ of typedefs.
+ (xref_tag): Adjust call to check_elaborated_type_specifier.
+ * decl2.c (grokclassfn): Do not set TYPE_HAS_DESTRUCTOR.
+ * name-lookup.c (set_namespace_binding): Use add_binding.
+ * parser.c (cp_parser_simple_type_specifier): Return a TYPE_DECL,
+ rather than an IDENTIFIER_NODE, to represent built-in types, if
+ requested by the caller.
+ (cp_parser_postfix_expression): Adjust call.
+ (cp_parser_type_specifier): Likewise.
+ (cp_parser_elaborated_type_specifier): Adjust call to
+ check_elaborated_type_specifier.
+ * typeck2.c (build_functional_cast): Do not perform name lookups.
+
+ PR c++/10717
+ * decl.c (expand_static_init): Remove unnecessary code.
+
+2003-08-19 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR c++/10538, PR c/5582
+ * cp/cp-lang.c (LANG_HOOKS_DECL_UNINIT): Define.
+
+2003-08-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/11174
+ * init.c (build_offset_ref): Perform access checking for
+ pointer to member correctly.
+
+2003-08-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-lang.c (LANG_HOOKS_INITIALIZE_DIAGNOSTICS): Fix spelling.
+
+2003-08-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11957
+ * cp-tree.h (finish_stmt_expr): Add bool parameter.
+ * init.c (finish_init_stmts): Pass true to finish_stmt_expr. Don't
+ adjust the stmt_expr here.
+ (build_vec_init): Use finish_stmt_expr_expr, convert result to
+ array type.
+ * parser.c (cp_parser_primar_expression): Adjust finish_stmt_expr
+ call.
+ * pt.c (tsubst_copy): Likewise.
+ * semantics.c (finish_stmt_expr): Add parameter.
+
+ * pt.c (instantiate_class_template): Push to class's scope before
+ tsubsting base.
+
+2003-08-17 Jan Hubicka <jh@suse.cz>
+
+ PR C++/11702
+ * semantics.c (finish_id_expression): Mark all functions as used.
+
+2003-08-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11512
+ * cvt.c (convert_to_void): Indicate which side of conditional has
+ no effects, and rhs of comma operator. Test for no sideeffect
+ expressions here and always build a convert expr.
+ * init.c (expand_default_init): Convert the init to void.
+ * typeck.c (build_x_compound_expr): Do not check for side effects
+ here.
+ (build_compound_expr): Do not convert lhs when building a
+ template.
+
+2003-08-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.def (NON_DEPENDENT_EXPR): Add operand.
+ * decl2.c (build_offset_ref_call_from_tree): Use
+ build_non_dependent_expr.
+ * error.c (dump_expr) <NON_DEPENDENT_EXPR case>: Dump the operand.
+ * pt.c (build_non_dependent_expr): Set operand.
+
+2003-08-14 Jan Hubicka <jh@suse.cz>
+
+ * decl2.c (mark_member_pointers): Rename to...
+ (mark_member_pointers_and_eh_tinfos): ... this one; deal with eh tinfos
+ (lower_function): Update call.
+ * except.c (eh_type_info): Break out from ...
+ (build_eh_type): ... here; tinfo is already used.
+ (finish_eh_spec_block): Mark tinfos as used.
+ * semantics.c (finish_handler_params): Mark tinfo as used.
+ * cp-tree.h (eh_type_info): Declare.
+
+2003-08-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (instantiate_class_template): Set location before
+ substuting bases.
+
+ * decl.c (make_typename_type): Use my_friendly_assert.
+ * pt.c (tsubst_aggr_type): Rearrange context substitution.
+
+2003-08-14 Jan Hubicka <jh@suse.cz>
+
+ * method.c (use_thunk): Expand body directly.
+
+2003-08-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11703
+ * call.c (type_passed_as): Use TYPE_SIZE, not TYPE_PRECISION to
+ determine whether or not to promote types.
+ (convert_for_arg_passing): Likewise.
+ * decl2.c (cp_build_parm_decl): Do not set DECL_ARG_TYPE in
+ templates.
+ * pt.c (tsubst_decl): Do not expect it to be set.
+
+ PR c++/9512
+ PR c++/10923
+ * cp-tree.h (check_elaborated_type_specifier): Declare.
+ (handle_class_head): Remove.
+ (note_got_semicolon): Likewise.
+ (note_list_got_semicolon): Likewise.
+ (finish_class_definition): Likewise.
+ * decl.c (check_elaborated_type_specifier): Make it public.
+ Robustify.
+ (handle_class_head): Remove.
+ * parser.c (cp_parser_elaborated_type_specifier): Use
+ check_elaborated_type_specifier.
+ (cp_parser_class_specifier): Do not call finish_class_definition.
+ (cp_parser_class_head): Or handle_class_head. Check for
+ over-qualified names.
+ * semantics.c (finish_class_definition): Remove.
+
+ * parser.c (cp_parser_check_for_definition_in_return_type): New
+ function.
+ (cp_parser_simple_declaration): Adjust call to
+ cp_parser_init_declarator.
+ (cp_parser_decl_specifier_seq): Change type of
+ declares_class_or_enum parameter.
+ (cp_parser_explicit_instantiation): Adjust accordingly.
+ (cp_parser_type_specifier): Change type of
+ declares_class_or_enum parameter.
+ (cp_parser_init_declarator): Add declares_class_or_enum
+ parameter.
+ (cp_parser_parameter_declaration): Adjust call to
+ cp_parser_decl_specifier_seq.
+ (cp_parser_function_definition): Likewise.
+ (cp_parser_member_declaration): Likewise.
+ (cp_parser_single_declaration): Likewise.
+
+ * cp-tree.h (lang_type_class): Remove has_call_overloaded,
+ has_array_ref_overloaded, has_arrow_overloaded, and got_semicolon.
+ (TYPE_OVERLOADS_CALL_EXPR): Remove.
+ (TYPE_OVERLOADS_ARRAY_REF): Likewise.
+ (TYPE_OVERLOADS_ARROW): Likewise.
+ (CLASSTYPE_GOT_SEMICOLON): Likewise.
+ * class.c (check_bases): Do not set them.
+ (finish_struct_1): Likewise.
+ * decl.c (cp_finish_decl): Do not set CLASSTYPE_GOT_SEMICOLON.
+ (build_ptrmemfunc_type): Likewise.
+ (grok_op_properties): Do not set TYPE_OVERLOADS_*.
+ (start_function): Do not check CLASSTYPE_GOT_SEMICOLON.
+ * decl2.c (grokfield): Do not set CLASSTYPE_GOT_SEMICOLON.
+ * lex.c (note_got_semicolon): Remove.
+ (note_list_got_semicolon): Likewise.
+ * parser.c (cp_parser_simple_declaration): Do not call
+ note_list_got_semicolon.
+ * pt.c (list_eq): Remove.
+ (lookup_template_class): Do not set CLASSTYPE_GOT_SEMICOLON.
+ (instantiate_class_template): Do not set TYPE_OVERLOADS*.
+ (instantiate_class_template): Do not set CLASSTYPE_GOT_SEMICOLON.
+ * ptree.c (cxx_print_type): Do not print them.
+ * semantics.c (finish_member_class_template): Do not call
+ note_list_got_semicolon.
+
+2003-08-11 Aldy Hernandez <aldyh@redhat.com>
+
+ * call.c (standard_conversion): Opaque pointers interconvert.
+
+ * testsuite/g++.dg/other/opaque-3.C: New.
+
+2003-08-11 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck.c (merge_types): Handle cv-qualified pointer-to-member
+ types correctly.
+
+2003-08-10 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11789
+ * cp-tree.h (get_vbase): Remove.
+ (get_vbase_types): Remove.
+ * init.c (expand_member_init): Correct logic for looking up base
+ classes.
+
+2003-08-10 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * error.c (dump_expr): Tidy.
+ * cxx-pretty-print.c (pp_cxx_nonconsecutive_character): New.
+ (pp_cxx_begin_template_argument_list): Likewise.
+ (pp_cxx_end_template_argument_list): Likewise.
+ (is_destructor_name): Likewise.
+ (pp_cxx_unqualified_id): Likewise.
+ (pp_cxx_qualified_id): Likewise.
+ (pp_cxx_id_expression): Likewise.
+ (pp_cxx_new_expression): Likewise.
+ (pp_cxx_delete_expression): Likewise.
+ (pp_cxx_pm_expression): Likewise.
+ (pp_cxx_type_specifier): Rework.
+ (pp_cxx_type_id): Likewise.
+ (pp_cxx_primary_expression): Likewise.
+ (pp_cxx_postfix_expression): Likewise.
+ (pp_cxx_unary_expression): Likewise.
+ (pp_cxx_multiplicative_expression): Likewise.
+ (pp_cxx_conditional_expression): Likewise.
+ (pp_cxx_assignment_expression): Likewise.
+ (pp_cxx_pretty_printer_init): Tidy.
+
+2003-08-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): non-NULL
+ NODE is always a TREE_VEC of nonzero size.
+ (NUM_TMPL_ARGS): NODE is always a TREE_VEC.
+ * decl2.c (arg_assoc): Template args will be a vec.
+ * error.c (dump_decl) <TEMPLATE_ID_EXPR case>: Call
+ dump_template_argument_list.
+ (dump_template_parms): Args will be a vec.
+ * parser.c (cp_parser_template_argument_list): Produce a
+ vector, not a list.
+ * pt.c (coerce_template_parms): Args are always vectors.
+ (mangle_class_name_for_template): Likewise.
+ (lookup_template_function): Likewise.
+ (lookup_template_class): Likewise.
+ (tsubst_template_args): Likewise.
+ (tsubst_baselink): Use tsubst_template_args.
+ (tsubst_qualified_id): Likewise.
+ (tsubst_copy) <TEMPLATE_ID_EXPR case>: Likewise.
+ (tsubst_copy_and_build) <TEMPLATE_ID_EXPR case>: Likewise.
+ (any_dependent_template_args_p): Args are always vectors.
+ * tree.c (cp_tree_equal): Add TEMPLATE_ID_EXPR case.
+
+ PR c++/11670
+ * call.c (convert_like_real): Add rvalue binding error message.
+ * error.c (dump_expr) <NOP_EXPR case>: Detect when the no expr is
+ really a cast.
+
+ PR c++/10530
+ * pt.c (dependent_type_p_r): A dependent template-id is a class
+ type with dependent template arguments, or a bound template
+ template parameter.
+ (type_dependent_expression_p): A template function decl cannot
+ have a dependent context.
+
+2003-08-07 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/5767
+ * parser.c (cp_parser_class_name): Return immediately when scope
+ is error_mark_node.
+
+2003-08-07 Aldy Hernandez <aldyh@redhat.com>
+
+ * cp/Make-lang.in (cp/call.o): Add dependency for target.h.
+
+ * cp/call.c (standard_conversion): Support opaque types.
+ Include target.h.
+ (strip_top_quals): Use cp_build_qualified_type instead of
+ TYPE_MAIN_VARIANT.
+
+ * cp/typeck.c (convert_for_assignment): Support opaque types.
+
+ * testsuite/g++.dg/other/opaque-1.C: New.
+
+ * testsuite/g++.dg/other/opaque-2.C: New.
+
+2003-08-06 Aldy Hernandez <aldyh@redhat.com>
+
+ * decl.c (grokparms): Use cp_build_qualified_type instead
+ TYPE_MAIN_VARIANT.
+
+2003-08-05 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cxx-pretty-print.h: New file.
+ * cxx-pretty-print.c: Likewise.
+ * error.c (scratch_pretty_printer): Change type.
+ (init_error): Tidy.
+ (dump_aggr_type): Likewise.
+ (dump_global_iord): Likewise.
+ (dump_expr): Likewise.
+ (dump_char): Remove.
+ * cp-lang.c (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): Define.
+ (cxx_initialize_diagnostics): New function.
+ * Make-lang.in (CXX_OBJS): Add cp/cxx-pretty-print.o
+ (CXX_PRETTY_PRINT_H): New variable.
+ (cp/cxx-pretty-print.o): New rule.
+ (cp/cp-lang.o): Update dependence.
+ (cp/error.o): Likewise.
+
+2003-08-05 Steven Bosscher <steven@gcc.gnu.org>
+
+ * cp-tree.h (struct lang_decl): Don't include c_lang_decl.
+ (DECL_DECLARED_INLINE_P): Remove.
+ * decl2.c (import_export_decl): Only look at DECL_DECLARED_INLINE_P
+ if decl is a FUNCTION_DECL. This never made sense, but now it is
+ required to avoid a tree check failure.
+ * decl.c (grokfndecl): Don't touch DID_INLINE_FUNC.
+ * optimize.c (maybe_clone_body): Likewise.
+
+2003-08-04 Roger Sayle <roger@eyesopen.com>
+
+ * decl.c (cxx_insert_default_attributes): Delete.
+ * cp-tree.h (cxx_insert_default_attributes): Don't prototype.
+ * cp-lang.c (LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES): Don't define.
+
+2003-08-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11704
+ * pt.c (type_dependent_expression_p): Cope with COMPONENT_REF with
+ unknown type.
+
+ PR c++/11766
+ * typeck.c (comp_ptr_ttypes_real): Don't loop on pointers to
+ member functions.
+
+2003-08-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9447
+ * cp-tree.def (USING_DECL): Document its type.
+ * class.c (pushclass): If we're entering a template, push any
+ dependent using decls it has.
+ * decl2.c (do_class_using_decl): Refactor. Type is NULL iff it is
+ a dependent scope.
+ * pt.c (tsubst_decl) <USING_DECL case>: Set type.
+ (tsubst): Remove USING_DECL checks.
+ (type_dependent_expression_p): Remove USING_DECL case.
+ * semantics.c (finish_member_declaration): A USING_DECL's type
+ indicates whether it is dependent.
+
+2003-08-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (pushclass): Remove unneeded parameter.
+ * class.c (pushclass): Remove unneeded MODIFY parm. Adjust.
+ (push_nested_class): Adjust pushclass call.
+ * pt.c (instantiate_class_template): Likewise.
+ * semantics.c (begin_class_definition): Likewise.
+
+2003-08-01 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * typeck2.c (add_exception_specifier): Use 'bool' where appropriate.
+
+2003-08-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11697
+ * decl.c (decls_match): Don't ignore the types of template
+ classes.
+
+ PR c++/11744
+ * pt.c (tsubst_copy_and_build): Refine Koenig lookup logic.
+
+2003-08-01 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/8442, c++/8806
+ * decl.c (qualify_lookup): Accept TEMPLATE_DECL if types are
+ preferred.
+ (check_elaborated_type_specifier): Add allow_template_p
+ parameter. Check tag mismatch and class template.
+ (xref_tag): Add template_header_p parameter. Add assertion
+ that name is an IDENTIFIER_NODE. Remove implicit typename
+ warning. Simplify lookup process if globalize is true.
+ (cxx_init_decl_processing): Adjust call to xref_tag.
+ (xref_tag_from_type): Likewise.
+ * decl2.c (handle_class_head): Likewise.
+ * parser.c (cp_parser_elaborated_type_specifier,
+ cp_parser_class_head): Likewise.
+ * rtti.c (init_rtti_processing, build_dynamic_cast1,
+ tinfo_base_init, emit_support_tinfos): Likewise.
+ * class.c (is_base_of_enclosing_class): Remove.
+ * pt.c (convert_template_argument): Don't accept RECORD_TYPE as
+ template template argument.
+ * cp-tree.h (xref_tag): Adjust declaration.
+ (is_base_of_enclosing_class): Remove.
+ * NEWS: Document template template argument change.
+
+2003-08-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parser.c (cp_parser_init_declarator,
+ cp_paser_member_declaration): Reformat.
+ * pt.c (lookup_template_class, type_unification_real, unify,
+ type_dependent_expression_p): Reformat.
+
+ PR c++/11295
+ * cp-tree.h (tubst_flags_t): Add tf_stmt_expr_cmpd,
+ tf_stmt_expr_body.
+ (finish_stmt_expr_expr): Declare.
+ * parser.c (cp_parser_primary_expression): Tell
+ cp_parser_compount_statement that it is a statement expression.
+ (cp_parser_statement, cp_parser_labeled_statement,
+ cp_parser_compound_statement, cp_parser_statement_seq_opt): Add
+ in_statement_expr_p parameter.
+ (cp_parser_expression_statement): Likewise. Call
+ finish_stmt_expr_expr for final expression of a statement
+ expression.
+ (cp_parser_for_init_statement,
+ cp_parser_implicitly_scoped_statement,
+ cp_parser_already_scoped_statement, cp_parser_function_definition,
+ cp_parser_try_block, cp_parser_handled): Adjust.
+ * pt.c (tsubst_copy) <STMT_EXPR case>: Pass tf_stmt_expr.
+ (tsubst_expr): Process tf_stmt_expr and tf_stmt_exprs flags.
+ (tsubst_expr) <EXPR_STMT case>: Check tf_stmt_exprs flag.
+ * semantics.c (finish_expr_stmt): Do not deal with statement
+ expressions.
+ (begin_stmt_expr): Clear last_expr_type.
+ (finish_stmt_expr_expr): New.
+ (finish_stmt_expr): Process the value expression.
+
+ * typeck.c (build_compound_expr): If RHS is a TARGET_EXPR, put the
+ compound expr inside the target's initializer.
+
+ PR c++/11525
+ * parser.c (cp_parser_primary_expression): Do not set
+ non-constant-p merely because it is a dependent scope.
+
+ PR c++/9447
+ * decl2.c (do_class_using_decl): Set type to NULL_TREE.
+ * semantics.c (finish_expr_stmt): Do not convert to void in a
+ template.
+
+2003-07-31 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (coerce_template_parms): Refactor.
+ (fn_type_unification): Increment processing_template_decl when
+ tsubsting an incomplete set of explicit args.
+
+ PR c++/11347
+ * pt.c (instantiate_class_template): Increment
+ processing_template_decl around the tsubst of a template member
+ class.
+ (tsubst_qualified_id): Assert we do not have a dependent scope.
+
+ * pt.c (coerce_template_template_parms, lookup_template_class,
+ can_complete_type_without_circularity, instantiate_class_template,
+ tsubst_decl, unify): Reformat.
+
+2003-07-31 Jan Hubicka <jh@suse.cz>
+
+ * decl2.c (maybe_make_one_only): Use mark_referenced.
+ * method.c (use_thunk): Likewsie.
+
+2003-07-30 Jan Hubicka <jh@suse.cz>
+
+ * class.c (build_vtable_entry_ref): Kill.
+ (build_vtbl_ref_1): Do not call build_vtable_entry_ref.
+ (build_vfn_ref): Do not call build_vtable_entry_ref.
+ * cp-lang.c (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): Kill.
+ * cp-tree.h (prepare_assemble_variable): Kill.
+ * cp-decl.c (prepare_assemble_variable): Kill.
+
+2003-07-29 Geoffrey Keating <geoffk@apple.com>
+
+ * parser.c (cp_lexer_new_main): Use c_common_no_more_pch instead
+ of setting valid_pch by hand.
+
+2003-07-29 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * decl.c (finish_enum): Initialize underlying_type.
+
+2003-07-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9447
+ * decl.c (add_binding): Add bval local variable.
+ (push_class_level_binding): Likewise. Allow a USING_DECL to be
+ pushed.
+ * decl2.c (do_class_using_decl): The type of a using decl is
+ unknown.
+ * parser.c (cp_parser_postfix_expression): Refactor unqualified-id
+ function call lookup code.
+ * pt.c (tsubst): A USING_DECL will have unknown type.
+ (tsubst_copy_and_build): Allow a using decl.
+ (type_dependent_expression_p): A USING_DECL will make it
+ dependent.
+ * semantics.c (finish_member_declaration): Push a dependent using
+ declaration.
+
+2003-07-28 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11530
+ * parser.c (cp_parser_postfix_expression): Do not call mark_used.
+ * semantics.c (finish_id_expression): Call mark_used for all
+ declarations.
+
+2003-07-28 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11667
+ * call.c (standard_conversion): Allow all integral->enumeral
+ conversions, after marking them as bad.
+ * decl.c (finish_enum): Make sure that all enumerators are
+ properly converted to the underlying type.
+ (build_enumerator): Set DECL_CONTEXT for namespace-scope
+ enumeration types.
+ * pt.c (tsubst_copy): Adjust handling of CONST_DECLs accordingly.
+ (tsubst_enum): Tidy.
+
+ * Make-lang.in (typeck.o): Depend on convert.h.
+ (class.o): Likewise.
+ (rtti.o): Likewise.
+ * call.c: Include convert.h.
+ (convert_arg_to_ellipsis): Use convert_to_real.
+ * class.c: Include convert.h.
+ (build_base_path): Use convert_to_integer.
+ * rtti.c: Include convert.h.
+ (build_headof): Use convert_to_integer.
+ * typeck.c: Include convert.h.
+ (decay_conversion): Use convert_to_integer.
+ (build_unary_op): Use build_nop.
+ (get_delta_difference): Use convert_to_integer.
+ (build_ptrmemfunc): Avoid unnecessary conversions.
+
+2003-07-28 Jan Hubicka <jh@suse.cz>
+
+ * decl2.c (mark_member_pointers): Verify that member pointer points to
+ the function.
+
+2003-07-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (begin_compound_stmt): No scope arg is a bool.
+ (finish_compound_stmt): Remove no scope arg.
+ * decl.c (register_dtor_fn): Adjust begin_compound_stmt and
+ end_compound_stmt calls.
+ (expand_static_init, begin_destructor_body, begin_function_body,
+ finish_function_body): Likewise.
+ * decl2.c (start_objects, finish_objects,
+ start_static_storage_duration_function,
+ finish_static_storage_duration_function): Likewise.
+ * init.c (begin_init_stmts, finish_init_stmts,
+ construct_virtual_base, build_vec_init): Likewise.
+ * method.c (do_build_assign_ref, synthesize_method): Likewise.
+ * parser.c (cp_parser_compound_statement,
+ cp_parser_implicitly_scoped_statement,
+ cp_parser_already_scoped_statement): Likewise.
+ * pt.c (tsubst_expr): Likewise.
+ * semantics.c (begin_compound_stmt): No scope arg is a bool.
+ (finish_compound_stmt): Remove no scope arg.
+
+ * error.c (dump_expr) <COMPOUND_EXPR case>: A compound expr is
+ always dyadic.
+
+2003-07-27 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (standard_conversion): Tweak handling of
+ pointer-to-member types.
+ * pt.c (tsubst): Correctly qualify pointers-to-data member types.
+ * typeck.c (comp_ptr_ttypes_real): Check qualifiers on
+ pointer-to-data member types.
+
+2003-07-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parser.c (cp_parser_type_parameter): Reformat.
+ (cp_parser_parameter_declaration): Deprecate default args where
+ not allowed.
+
+2003-07-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cfns.h: Rebuilt.
+
+ * cp-tree.h (begin_init_stmts, finish_init_stmts): Remove.
+ (begin_global_stmt_expr, finish_global_stmt_expr): Remove.
+ * init.c (begin_init_stmts): Make static. Return is_global
+ value. Always call begin_stmt_expr.
+ (finish_init_stmts): Make static. Add is_global parm. Always
+ building a stmt tree.
+ (build_aggr_init): Adjust begin_init_stmts, finish_init_stmts calls.
+ (build_vec_init): Likewise. Always building a stmt tree.
+ (expand_default_init): Always building a stmt tree.
+ (get_temp_regvar): Likewise.
+ * semantics.c (begin_global_stmt_expr,
+ finish_global_stmt_expr): Remove.
+
+2003-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (build_compound_expr): Take LHS & RHS args.
+ (build_x_compound_expr_from_list): Declare.
+ * typeck.c (build_x_compound_expr_from_list): New.
+ (build_x_compound_expr): Adjust.
+ (build_compound_expr): Remove unreachable code. Take two
+ parameters, adjust.
+ * decl.c (grok_reference_init): Use
+ build_x_compound_expr_from_list.
+ (expand_static_init): Adjust build_compound_expr call.
+ (cxx_maybe_build_cleanup): Likewise.
+ * init.c (perform_member_init): Use
+ build_x_compound_expr_from_list.
+ (build_new_1): Likewise.
+ (build_vec_delete): Adjust build_compound_expr calls.
+ (build_vbase_delete): Likewise.
+ * typeck2.c (store_init_value): Use
+ build_x_compound_expr_from_list.
+ (build_functional_cast): Likewise.
+
+2003-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (enum tsubst_flags_t): Add tf_user.
+ * decl.c (make_typename_type): Pass it.
+ * pt.c (lookup_template_class): Use it.
+ (resolve_typename_type): Pass it.
+ * semantics.c (finish_template_type): Pass it.
+
+2003-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11617
+ * cp-tree.h (qualified_name_lookup_error): Declare.
+ * pt.c (tsubst_qualified_id): Use qualified_name_lookup_error for
+ errors.
+ (tsubst_expr) <DECL_STMT case>: Likewise.
+ (tsubst_copy_and_build) <COMPONENT_REF case>: Likewise.
+ * semantics.c (qualified_name_lookup_error): New, broken out of ...
+ (finish_id_expression): ... here. Use it.
+
+2003-07-25 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
+
+ * cfns.gperf: Add '%%' delimiter to placate gperf 3.0.
+
+2003-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11596
+ * pt.c (maybe_fold_nontype_arg, maybe_fold_nontype_args): Remove.
+ (tsubst_template_arg): New.
+ (tsubst_template_arg_vector): Rename to ...
+ (tsubst_template_args): ... this. Accept a TREE_LIST form. Use
+ tsubst_template_arg.
+ (coerce_template_parms): Use tsubst_template_arg for default
+ value.
+ (tsubst_template_parms): Likewise.
+ (tsubst_aggr_type): Adjust.
+ (tsubst_decl): Likewise.
+ (tsubst): Use tsubst_template_arg for a DOMAIN. Adjust.
+ (tsubst_copy) <TEMPLATE_ID_EXPR case>: Use tsubst_template_args.
+
+2003-07-25 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H.
+ * error.c: Use the new pretty-printer framework.
+
+2003-07-24 Per Bothner <pbothner@apple.com>
+
+ * decl.c (pushdecl_class_level): Don't use push_srcloc/pop_srcloc
+ which causes errors messages to incorrectly mention included files.
+
+2003-07-24 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (convert_to_base_statically): Declare.
+ * call.c (build_special_member_call): Convert INSTANCE to the base
+ type.
+ * class.c (convert_to_base_statically): New method.
+ * init.c (construct_virtual_base): Use it.
+ * method.c (do_build_assign_ref): Fix typo in comment.
+
+2003-07-24 Jason Merrill <jason@redhat.com>
+
+ * decl.c: Just set truthvalue_* to boolean_*.
+
+2003-07-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (reshape_init): Remove unreachable code.
+
+2003-07-24 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/11513
+ * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): Use current_scope.
+
+2003-07-23 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11645
+ * cp-tree.h (accessible_base_p): Declare.
+ * call.c (build_over_call): Use it.
+ * search.c (accessible_base_p): New function, split out from ...
+ (lookup_base): ... here.
+
+ PR c++/11517
+ * call.c (build_conditional_expr): Use perform_implicit_conversion
+ and error_operand_p. Robustify.
+ * typeck.c (build_unary_op): Use perform_implicit_conversion.
+
+2003-07-23 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10953
+ * parser.c (cp_parser_nested_name_specifier): Reset scope on
+ failure.
+ (cp_parser_elaborated_type_specifier): Likewise.
+
+2003-07-22 Mark Mitchell <mark@codesourcery.com>
+
+ Eliminate use of POINTER_TYPE for pointers-to-members.
+ * call.c (standard_conversion): Rework pointer-to-member handling.
+ Add comments.
+ (add_builtin_candidate): Likewise.
+ (resolve_scoped_fn_name): Remove.
+ (build_conditional_expr): Rework pointer-to-member handling.
+ (compare_ics): Likewise.
+ * class.c (check_field_decls): Use TYPE_PTR_P.
+ * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member
+ handling.
+ * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P.
+ (TYPE_PTRMEM_P): Add comment.
+ (TYPE_PTR_P): Simplify.
+ (TYPE_PTROB_P): Correct definition.
+ (TYPE_PTR_TO_MEMBER_P): New macro.
+ (TYPE_PTRMEM_CLASS_TYPE): Adjust.
+ (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise.
+ (resolved_scoped_fn_name): Remove declaration.
+ (build_offset_ref): Change prototype.
+ (resolve_offset_ref): Remove.
+ (comp_target_types): Remove.
+ * cvt.c (cp_convert_to_pointer): Rework pointer-to-member
+ handling.
+ (convert_to_reference): Use can_convert.
+ (ocp_convert): Improve error handling. Rework pointer-to-member
+ handling.
+ (perform_qualification_conversions): Rework pointer-to-member
+ handling.
+ * decl.c (build_ptrmem_type): Handle functions too.
+ (create_array_type_for_decl): Remove OFFSET_TYPE error message.
+ (grokdeclarator): Use OFFSET_TYPE for pointers to data members.
+ (grokparms): Remove OFFSET_TYPE error message.
+ * dump.c (cp_dump_tree): Rework pointer-to-member handling.
+ * error.c (dump_type_prefix): Likewise.
+ * expr.c (cplus_expand_constant): Use build_nop.
+ * init.c (build_offset_ref): Add address_p parameter. Fold in
+ necessary bits from resolve_offset_ref.
+ (resolve_offset_ref): Remove.
+ * parser.c (cp_parser_postfix_expression): Remove special case
+ code for OFFSET_TYPE.
+ * pt.c (convert_nontype_argument): Rework pointer-to-member
+ handling.
+ (convert_template_argument): Likewise.
+ (unify): Likewise.
+ (invalid_nontype_parm_type_p): Likewise.
+ (dependent_type_p_r): Likewise.
+ * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case.
+ (target_incomplete_p_): Rework pointer-to-member
+ handling.
+ (get_pseudo_ti_init): Likewise.
+ (get_pseudo_ti_desc): Likewise.
+ * semantics.c (finish_qualified_id_expr): Adjust call to
+ build_offset_ref. Remove use of resolve_offset_ref.
+ * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P.
+ * typeck.c (target_type): Use TYPE_PTRMEM_P.
+ (type_unknown_p): Remove obsolete code about the time before
+ non-dependent expressions were handled correctly.
+ (qualify_type_recursive): Remove.
+ (composite_pointer_type_r): New function.
+ (composite_pointer_type): Use it.
+ (merge_types): Remove dead comments.
+ (comp_cv_target_types): Remove.
+ (comp_target_types): Likewise.
+ (comp_target_parms): Likewise.
+ (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error.
+ (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P.
+ (build_binary_op): Do not use of comp_target_types.
+ (pointer_diff): Remove OFFSET_TYPE case.
+ (build_unary_op): Adjust pointer-to-member handling.
+ (unary_complex_lvalue): Likewise.
+ (check_for_casting_away_constness): Add description parameter.
+ (build_static_cast): Pass it.
+ (build_reinterpret_cast): Use check_for_casting_away_constness.
+ (build_const_cast): Adjust pointer-to-member handling.
+ (build_c_cast): Likewise.
+ (convert_for_assignment): Remove OFFSET_TYPE error message.
+ (comp_ptr_ttypes_real): Adjust pointer-to-member handling.
+ (comp_ptr_ttypes_reinterpret): Remove.
+ (casts_away_constness_r): Adjust pointer-to-member handling.
+ (casts_away_constness): Liekwise.
+ (strip_all_pointer_quals): Remove.
+ * typeck2.c (digest_init): Adjust pointer-to-member handling.
+ (build_m_component_ref): Likewise.
+
+2003-07-22 Wolfgang Bangerth <bangerth@dealii.org>
+
+ * lex.c (unqualified_fn_lookup_error): Mention that the error
+ message needs to be kept in synch with the manual.
+
+2003-07-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11614
+ * decl.c (grokdeclarator): An array member is only a flexible
+ array member if the field itself is the array.
+
+2003-07-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10793
+ * decl.c (xref_basetypes): Handle error_mark_node.
+
+2003-07-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (enum cp_lvalue_kind): Add clk_packed.
+ * tree.c (lvalue_p_1): Set it.
+ * class.c (check_field): Don't allow non-packed non-POD fields to
+ be packed.
+ * call.c (reference_binding): Need a temporary for all bitfield
+ and packed fields.
+ (convert_like_real): Check it is ok to make a temporary here.
+
+2003-07-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (hack_identifier): Remove.
+ * method.c (hack_identifier): Remove.
+ * semantics.c (finish_id_expression): Expand hack_identifier
+ here. Simplify.
+
+2003-07-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * call.c class.c decl.c decl2.c g++spec.c lex.c parser.c pt.c rtti.c
+ semantics.c typeck.c: Remove unnecessary casts.
+
+2003-07-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (hack_identifier): Remove.
+ * method.c (hack_identifier): Remove.
+ * semantics.c (finish_id_expression): Expand hack_identifier
+ here. Simplify.
+
+2003-07-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (finish_non_static_data_member): Add object param.
+ * method.c (hack_identifier): Adjust.
+ * pt.c (tsubst_copy_and_build) <COMPONENT_REF case>: Don't search
+ again for a FIELD_DECL.
+ * semantics.c (finish_non_static_data_member): Add object
+ parameter. Always save the DECL in the COMPONENT_REF.
+ * call.c (resolve_scoped_fn_name): Adjust.
+
+2003-07-17 Zack Weinberg <zack@codesourcery.com>
+
+ * pt.c (get_bindings): Make definition consistent with
+ forward declaration.
+
+2003-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/7809
+ * friend.c (add_friend): Check access for member functions
+ and templates.
+
+2003-07-17 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/10668
+ * typeck.c (build_class_member_access_expr): Improve diagnostic.
+
+2003-07-16 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11547
+ * cp-tree.h (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P): New
+ macro.
+ (DECL_PRETTY_FUNCTION_P): Use VAR_DECL_CHECK.
+ * decl.c (duplicate_decls): Merge
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
+ * parser.c (cp_parser_postfix_expression): Adjust call to
+ cp_parser_initializer_list and
+ cp_parser_parenthesized_expression_list.
+ (cp_parser_parenthesized_expression_list): Add non_constant_p.
+ (cp_parser_new_placement): Adjust call to
+ cp_parser_parenthesized_expression_list.
+ (cp_parser_direct_new_declarator): Likewise.
+ (cp_parser_conditional_expression): Remove.
+ (cp_parser_constant_expression): Parse an assignment-expression,
+ not a conditional-expression.
+ (cp_parser_simple_declaration): Resolve expression/declaration
+ ambiguity more quickly.
+ (cp_parser_mem_initializer): Adjust call to
+ cp_parser_parenthesized_expression_list.
+ (cp_parser_init_declarator): Keep track of whether or not the
+ initializer is a constant-expression.
+ (cp_parser_initializer): Add non_constant_p parameter.
+ (cp_parser_initializer_clause): Likewise.
+ (cp_parser_initializer_list): Likewise.
+ (cp_parser_attribute_list): Adjust call to
+ cp_parser_parenthesized_expression_list.
+ (cp_parser_functional_cast): Likewise.
+ * pt.c (tsubst_decl): Copy
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
+ (tsubst_expr): Tweak use of DECL_PRETTY_FUNCTION_P.
+ * semantics.c (finish_id_expression): Use
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
+
+2003-07-16 Neil Booth <neil@daikokuya.co.uk>
+
+ * lang-options.h: Remove.
+
+2003-07-16 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR c/10962
+ * class.c (field_decl_cmp): Remove.
+ (resort_field_decl_cmp): Remove.
+ (resort_sorted_fields): Remove.
+ (add_fields_to_vec): Rename to ...
+ (add_fields_to_record_type): this.
+ (finish_struct_1): Change to be using
+ sorted_fields_type's fields.
+ * cp-tree.h (lang_decl): In lang_decl_u3
+ change sorted_fields to be a pointer to
+ sorted_fields_type.
+ (resort_sorted_fields): Remove prototype.
+ * search.c (lookup_field_1): Change to be using
+ sorted_fields_type's fields.
+
+2003-07-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/5421
+ * decl.c (grokdeclarator): Handle TEMPLATE_ID_EXPR if friend
+ is a member of other class.
+ * friend.c (do_friend): Don't build TEMPLATE_DECL if friend
+ is a specialization of function template.
+
+2003-07-16 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/10903
+ * pt.c (convert_nontype_argument): Fix thinko in diagnostic.
+ Improve.
+
+2003-07-15 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (LOOKUP_EXPR): Remove.
+ * cp-tree.h (cp_id_kind): Add CP_ID_KIND_UNQUALIFIED_DEPENDENT.
+ (LOOKUP_EXPR_GLOBAL): Remove.
+ (get_bindings): Remove.
+ (is_aggr_type_2): Remove.
+ * call.c (resolved_scoped_fn_name): Remove support for
+ LOOKUP_EXPR.
+ * decl.c (grokfndecl): Likewise.
+ (grokdeclarator): Likewise.
+ * error.c (dump_decl): Likewise.
+ (dump_expr): Likewise.
+ * friend.c (do_friend): Likewise.
+ * init.c (build_offset_ref): Likewise.
+ * lex.c (unqualified_fn_lookup_error): Use pedwarn. Do not create
+ LOOKUP_EXPRs
+ * mangle.c (write_expression): Remove support for LOOKUP_EXPR.
+ * parser.c (cp_parser_postfix_expression): Modify Koenig lookup
+ test.
+ * pt.c (get_bindings): Give it internal linkage.
+ (check_explicit_specialization): Remove support for LOOKUP_EXPR.
+ (lookup_template_function): Likewise.
+ (for_each_tempalte_parm_r): Likewise.
+ (tsubst_decl): Likewise.
+ (tsubst_qualified_id): Handle template template parameters.
+ (tsubst_copy): Remove support for LOOKUP_EXPR.
+ (tsubst_copy_and_build): Likewise.
+ (most_general_template): Likewise.
+ (value_dependent_expression_p): Likewise.
+ (type_dependent_expression_p): Note that IDENTIFIER_NODEs are
+ always dependent.
+ * semantics.c (perform_koenig_lookup): Do not create
+ IDENTIFIER_NODEs.
+ (finish_fname): Likewise.
+ (finish_id_expression): Likewise.
+ * tree.c (is_aggr_type_2): Remove.
+
+2003-07-16 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/11531
+ * typeck.c (check_return_expr): Fix thinko in diagnostic.
+
+2003-07-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10108
+ * pt.c (tsubst_decl) <TEMPLATE_DECL>: Add a check for
+ error_mark_node.
+
+2003-07-14 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11509
+ * pt.c (dependent_scope_ref_p): New function.
+ (value_dependent_expression_p): Use it.
+ (type_dependent_expression_p): Likewise.
+
+ * pt.c (tsubst_friend_function): Use reregister_specialization.
+
+ PR c++/7019
+ * cp-tree.h (lookup_qualified_name): Adjust prototype.
+ * decl.c (lookup_qualified_name): Add complain parameter. Adjust
+ call to is_aggr_type.
+ * parser.c (cp_parser_lookup_name): Adjust call to
+ lookup_qualified_name.
+ * pt.c (tsubst_qualified_id): Likewise.
+ (tsubst_copy_and_build): Likewise.
+ * semantics.c (finish_qualified_id_expr): Deal with erroneous
+ expressions.
+
+2003-07-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/11510
+ * call.c (op_error): Properly format REALPART_EXPR and
+ IMAGPART_EXPR.
+ * error.c (dump_expr): Likewise.
+
+2003-07-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * error.c (dump_expr): Handle EMPTY_CLASS_EXPR.
+
+2003-07-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/5293
+ * call.c (initialize_reference): Improve diagnostic.
+
+2003-07-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/11154
+ * pt.c (more_specialized_class): Add full_args parameter.
+ (most_specialized_class): Adjust calls to more_specialized_class.
+ * cp-tree.h (more_specialized_class): Adjust declaration.
+
+2003-07-14 Dan Nicolaescu <dann@ics.uci.edu>
+
+ * lex.c (enum tree_node_kind): Delete.
+
+2003-07-13 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11503
+ * cp-tree.h (DECL_SELF_REFERENCE_P): New macro.
+ (SET_DECL_SELF_REFERENCE_P): Likewise.
+ * class.c (build_self_reference): Use SET_DECL_SELF_REFERENCE_P.
+ * pt.c (tsubst_decl): Copy it.
+ * search.c (lookup_base): Use DECL_SELF_REFERENCE_P.
+
+ * pt.c (reregister_specialization): Fix thinko in previous change.
+
+ * cp-tree.h (cp_id_kind): New type.
+ (unqualified_name_lookup_error): Change prototype.
+ (unqualified_fn_lookup_error): New function.
+ (do_identifier): Remove.
+ (do_scoped_id): Likewise.
+ (tsubst_copy_and_build): Change prototype.
+ (reregister_specialization): New function.
+ (perform_koenig_lookup): Likewise.
+ (finish_id_expression): Likewise.
+ * call.c (build_method_call): Adjust call to
+ unqualified_name_lookup_error.
+ * decl.c (duplicate_decls): Use reregister_specialization.
+ * lex.c (is_global): Remove.
+ (unqualified_name_lookup_error): Return a value.
+ (do_identifier): Remove.
+ (do_scoped_id): Likewise.
+ (identifier_typedecl_value): Remove.
+ (unqualified_fn_lookup_error): New function.
+ * parser.c (cp_parser_id_kind): Remove.
+ (cp_parser_non_constant_id_expression): Remove.
+ (cp_parser_primary_expression): Use finish_id_expression.
+ (cp_parser_class_or_namespace_name): Use cp_id_kind, not
+ cp_parser_id_kind.
+ (cp_parser_postfix_expression): Use perform_koenig_lookup.
+ (cp_parser_template_argument): Use cp_id_kind.
+ (cp_parser_fold_non_dependent_expr): Adjust call to
+ tsubst_copy_and_build.
+ * pt.c (unregister_specialization): Rename to ...
+ (reregister_specialization): This.
+ (tsubst_friend_function): Use it.
+ (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build.
+ (tsubst_qualified_id): Likewise.
+ (tsubst_expr): Likewise.
+ (tsubst_copy_and_build): Add function_p parameter. Use
+ finish_id_expression. Introduce RECUR macro.
+ (tsubst_non_call_postfix_expression): New function.
+ (regenerate_decl_from_template): Use reregister_specialization.
+ * semantics.c (perform_koenig_lookup): New function.
+ (finish_id_expression): Likewise.
+
+2003-07-13 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (push_access_scope_real): Remove.
+ (push_access_scope): Move code from push_access_scope_real.
+ (pop_access_scope): Don't check for TEMPLATE_DECL.
+ (instantiate_template): Defer access checking during template
+ substitution.
+ (regenerate_decl_from_template): Tidy.
+
+2003-07-11 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ PR c++/11437
+ * operators.def: Add definitions for __imag__, __real__.
+
+2003-07-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/11050
+ * parser.c (cp_parser_expression_list): Rename to ...
+ (cp_parser_parenthesized_expression_list): ... here. Add attribute
+ parameter, parse the surounding parentheses.
+ (cp_parser_skip_to_closing_parenthesis): Add recover and or_comma
+ parameters. Return int.
+ (cp_parser_skip_to_closing_parenthesis or comma): Remove.
+ (cp_parser_postfix_expression): Adjust function call parsing.
+ (cp_parser_new_placement): Adjust.
+ (cp_parser_new_initializer): Likewise.
+ (cp_parser_cast_expression): Likewise.
+ (cp_parser_selection_statement): Likewise.
+ (cp_parser_mem_initializer): Likewise.
+ (cp_parser_asm_definition): Likewise.
+ (cp_parser_init_declarator): Likewise.
+ (cp_parser_declarator): Make
+ cdtor_or_conv_p an int ptr.
+ (cp_parser_direct_declarator): Likewise. Check for a parameter
+ list on cdtors & conv functions.
+ (cp_parser_initializer): Adjust.
+ (cp_parser_member_declaration): Adjust.
+ (cp_parser_attribute_list): Move code into
+ cp_parser_parens_expression_list.
+ (cp_parser_functional_cast): Adjust.
+ * pt.c (type_dependent_expression_p): Erroneous expressions are
+ non-dependent.
+
+2003-07-11 Geoffrey Keating <geoffk@apple.com>
+
+ * decl.c (cp_finish_decl): Handle 'used' attribute.
+
+ * cp-lang.c (c_reset_state): New dummy routine.
+ * cp-tree.h (finish_file): Move prototype to c-common.h.
+ * parser.c (c_parse_file): Rename from yyparse; don't call finish_file.
+
+2003-07-11 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8327
+ * pt.c (tsubst_qualified_id): Implement suggested resolution for
+ Core Issue 2.
+ (type_dependent_expression_p): Likewise.
+
+2003-07-10 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck.c (build_binary_op): Do not warn about signed
+ vs. unsigned comparisons in the bodies of templates.
+
+ PR c++/9411
+ * parser.c (cp_parser_postfix_expression): Check dependency of
+ functions.
+
+2003-07-09 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10032
+ * decl.c (cxx_init_decl_processing): With -pedantic, pedwarns are
+ still errors.
+
+ PR c++/10527
+ * error.c (decl_to_string): Do not print default argument
+ expressions.
+
+ * cp-tree.h (break_out_calls): Remove declaration.
+ * tree.c (break_out_calls): Remove.
+ * typeck.c (build_modify_expr): Avoid invalid sharing of trees.
+
+2003-07-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++ 9483
+ * class.c (check_field_decls): Pass DECL_NAME to constructor_name_p.
+ * decl2.c (constructor_name_p): Avoid repeated constructor_name
+ calls.
+ * decl.c (grokdeclarator): Refactor ctor/dtor detection.
+
+2003-07-09 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck.c (build_x_unary_op): Take note of the fact that
+ PREINCREMENT_EXPR and POSTINCREMENT_EXPR are binary operations on
+ trees.
+
+ * parser.c (cp_parser_primary_expression): Preserve the form of
+ qualified expressions in templates, even if they are not
+ dependent.
+ * pt.c (convert_nontype_argument): Handle non-dependent SCOPE_REFs.
+ (tsubst_qualified_id): Likewise.
+ * search.c (accessible_p): Treat everything in the body of a
+ template as accessible.
+
+2003-07-08 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (NON_DEPENDENT_EXPR): New node.
+ * cp-tree.h (build_call_from_tree): Remove.
+ (build_member_call): Likewise.
+ (dependent_template_arg_p): Remove.
+ (any_dependent_template_arguments_p): New function.
+ (dependent_template_id_p): Likewise.
+ (any_type_dependent_arguments_p): Likewise.
+ (build_non_dependent_expr): Likewise.
+ (build_non_dependent_args): Likewise.
+ (build_x_compound_expr): Adjust prototype.
+ * call.c (build_new_method_call): Handle non-dependent expressions
+ correctly.
+ * decl2.c (grok_array_decl): Likewise.
+ (build_offset_ref_call_from_tree): Likewise.
+ (build_call_from_tree): Remove.
+ * error.c (dump_decl): Handle NON_DEPENDENT_EXPR.
+ (dump_expr): Likewise.
+ * init.c (build_member_call): Remove.
+ * mangle.c (write_expression): Update handling for template-ids.
+ * parser.c (cp_parser_primary_expression): Use
+ any_dependent_template_arguments_p. Update constant-expression
+ handling.
+ (cp_parser_postfix_expression): Use
+ any_type_dependent_arguments_p. Simplify call processing.
+ (cp_parser_unary_expression): Simplify.
+ (cp_parser_expression): Adjust for changes to
+ build_x_compound_expr.
+ (cp_parser_template_argument): Implement standard-conforming
+ parsing of non-type template arguments.
+ (cp_parser_direct_declarator): Use
+ cp_parser_fold_non_dependent_expr.
+ (cp_parser_fold_non_dependent_expr): New function.
+ (cp_parser_next_token_ends_template_argument_p): Likewise.
+ * pt.c (convert_template_argument): Do not call
+ maybe_fold_nontype_arg.
+ (tsubst_baselink): Likewise.
+ (tsubst_copy_and_build): Share common code. Make sizeof/alignof
+ processing work correctly for non-dependent expressions. Adjust
+ handling of COMPOUND_EXPR. Simplify call processing.
+ (value_dependent_expression_p): Deal with functional casts and
+ sizeof/alignof correctly.
+ (type_dependent_expression_p): Handle overloaded functions.
+ (any_type_dependent_arguments_p): New function.
+ (any_dependent_template_arguments_p): Likewise.
+ (dependent_template_p): Treat SCOPE_REFs as dependent.
+ (dependent_template_id_p): Simplify.
+ (build_non_dependent_expr): New function.
+ (build_non_dependent_args): Likewise.
+ * semantics.c (finish_stmt_expr): Don't make dependent
+ statement-expresions have void type.
+ (finish_call_expr): Handle non-dependent expressions
+ correctly.
+ * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues.
+ * typeck.c (cxx_sizeof_or_alignof_type): Give the expression
+ type size_t, even in templates.
+ (expr_sizeof): Likewise.
+ (finish_class_member_access_expr): Handle non-dependent expressions
+ correctly.
+ (build_x_indirect_ref): Likewise.
+ (build_x_binary_op): Likewise.
+ (build_x_unary_op): Likewise.
+ (build_x_conditional_expr): Likewise.
+ (build_x_compound_expr): Likewise.
+ * typeck2.c (build_x_arrow): Likewise.
+
+2003-07-09 Jan Hubicka <jh@suse.cz>
+
+ * cp-lang.c (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): New.
+ * decl.c (duplicate_decls): Use DECL_ESTIMATED_INSNS.
+ (start_function): Use DECL_ESTIMATED_INSNS.
+ * optimize.c (maybe_clone_body): Use DECL_ESTIMATED_INSNS.
+
+ * decl2.c (maybe_emit_vtables): Fix marking vtables as needed in
+ unit-at-a-time
+
+2003-07-08 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/11030
+ * pt.c (instantiate_class_template): Don't call xref_tag to
+ inject name when the friend class is a specialization.
+
+2003-07-07 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (build_scoped_method_call): Remove.
+ (lookup_qualified_name): Remove parameter.
+ (tsubst_copy_and_build): Declare.
+ (finish_qualified_object_call_expr): Remove.
+ (check_accessibility_of_qualified_id): New function.
+ (finish_qualified_id_expr): Likewise.
+ (non_reference): Likewise.
+ (build_expr_from-tree): Remove.
+ * call.c (non_reference): Remove.
+ (build_scoped_method_call): Likewise.
+ (build_method_call): Use error_operand_p. Assert that we are not
+ processing a template.
+ (standard_conversion): Use non_reference.
+ * class.c (build_vtbl_entry_ref): Likewise.
+ (build_vtbl_ref_1): Likewise.
+ * cvt.c (build_expr_type_conversion): Use non_reference.
+ * decl.c (lookup_qualified_name): Remove flags parameter.
+ (grok_op_properties): Use non_reference.
+ * decl2.c (grok_array_decl): Likewise.
+ (build_expr_from_tree): Remove.
+ (build_offset_ref_call_from_tree): Update comment.
+ * error.c (parm_to_string): Call reinit_global_formatting_buffer.
+ * except.c (prepare_eh_types): Use non_reference.
+ (can_convert_eh): Likewise.
+ * init.c (build_dtor_call): Avoid using build_method_call.
+ * mangle.c (write_template_param): Remove misleading comment.
+ * method.c (locate_copy): Use non_reference.
+ * parser.c (cp_parser_scope_through_which_access_occurs): Remove.
+ (cp_parser_primary_expression): Do not create SCOPE_REFs is
+ non-dependent contexts.
+ (cp_parser_postfix_expression): Use finish_qualified_id_expr.
+ (cp_parser_direct_declarator): Use tsubst_copy_and_build, not
+ build_expr_from_tree.
+ (cp_parser_lookup_name): Adjust call to lookup_qualified_name.
+ Use check_accessibility_of_qualified_id.
+ * pt.c (maybe_fold_nontype_arg): Use tsubst_copy_and_build, not
+ build_expr_from_tree.
+ (tsubst_baselink): New function.
+ (tsubst_qualified_id): Likewise.
+ (tsubst_copy): Use them. Remove support for METHOD_CALL_EXPR.
+ (tsubst_expr): Adjust call to lookup_qualified_name.
+ (tsubst_copy_and_build): Handle SCOPE_REFs specially. Adjust
+ handling of CALL_EXPRs.
+ (value_dependent_expression_p): Use INTEGRAL_OR_ENUMERATION_TYPE_P.
+ * rtti.c (get_tinfo_decl_dynamic): Use non_reference.
+ * search.c (check_final_overrider): Likewise.
+ * semantics.c (check_accessibility_of_qualified_id): New function.
+ (finish_qualified_object_call_expr): Remove.
+ * typeck.c (target_type): Use non_reference.
+ (cxx_sizeof_or_alignof_type): Likewise.
+ (dubious_conversion_warnings): Likewise.
+ (convert_for_initialization): Likewise.
+ (non_reference): New function.
+
+2003-07-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c (print_binding_level, print_other_binding_stack,
+ print_binding_stack): Merge uses of HOST_PTR_PRINTF with adjacent
+ stdio calls.
+ * ptree.c (cxx_print_decl, cxx_print_binding): Likewise.
+
+2003-07-07 Andreas Jaeger <aj@suse.de>
+
+ * friend.c: Convert to ISO C90 prototypes.
+
+ * Make-lang.in ($(srcdir)/cp/cfns.h): Use ANSI-C as output
+ language.
+ * cfns.h: Regenerate.
+
+ * typeck.c: Convert remaining prototypes to ISO C90.
+ * search.c: Likewise.
+
+ * decl2.c (build_expr_from_tree): Convert prototype to ISO C90.
+ * semantics.c (expand_or_defer_fn): Likewise
+ * mangle.c (discriminator_for_string_literal): Likewise.
+ * g++spec.c (lang_specific_driver): Likewise.
+
+ * search.c (lookup_base_r): Remove unused variable.
+
+2003-07-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * semantics.c: (genrtl_try_block) Adjust emit_line_note
+ calls.
+
+2003-07-07 Andreas Jaeger <aj@suse.de>
+
+ * search.c (lookup_base_r): Remove unused variable.
+
+2003-07-06 Michael Chastain <mec@shout.net>
+
+ PR debug/10055
+ * lex.c (cxx_init): Call push_srcloc and pop_srcloc rather than
+ assigning to input_filename directly.
+
+2003-07-06 Kazu Hirata <kazu@cs.umass.edu>
+
+ * call.c: Fix comment formatting.
+ * class.c: Likewise.
+ * cp-tree.h: Likewise.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * error.c: Likewise.
+ * method.c: Likewise.
+ * name-lookup.c: Likewise.
+ * parser.c: Likewise.
+ * pt.c: Likewise.
+ * rtti.c: Likewise.
+ * search.c: Likewise.
+ * typeck.c: Likewise.
+
+2003-07-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11345
+ * search.c (lookup_base_r): Remove is_non_public and
+ within_current_scope parameters. Remove other dead code.
+ (lookup_base): Adjust call to lookup_base_r.
+ (adjust_result_of_qualified_name_lookup): Improve comment.
+ * semantics.c (finish_call_expr): Use maybe_dummy_object.
+
+2003-07-06 Neil Booth <neil@daikokuya.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_HANDLE_FILENAME,
+ LANG_HOOKS_MISSING_ARGUMENT): Override.
+
+2003-07-05 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11431
+ * typeck.c (build_static_cast): Check for reference conversions
+ earlier.
+
+2003-07-04 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (perform_integral_promotions): Declare.
+ * call.c (build_addr_func): Use decay_conversion.
+ (convert_arg_to_ellipsis): Likewise. Remove misleading comment.
+ (convert_for_arg_passing): Use perform_integral_promotions.
+ * cvt.c (build_expr_type_conversion): Use decay_conversion.
+ (type_promotes_to): Do not return a cv-qualified type.
+ * decl.c (grok_reference_init): Fix formatting.
+ (get_atexit_node): Use decay_conversion.
+ (build_enumerator): Use perform_integral_promotions.
+ * init.c (build_vec_init): Use decay_conversion.
+ * semantics.c (finish_expr_stmt): Likewise.
+ (finish_switch_cond): Use perform_integral_promotions.
+ * typeck.c (default_conversion): Likewise.
+ (perform_integral_promotions): New function.
+ (build_indirect_ref): Use decay_conversion.
+ (build_array_ref): Use perform_integral_promotions.
+ (convert_arguments): Use decay_conversion.
+ (build_unary_op): Use perform_integral_promotions.
+ (build_c_cast): Use decay_conversion.
+ (build_modify_expr): Likewise.
+ (convert_for_initialization): Likewise.
+ * typeck2.c (build_x_arrow): Likewise.
+
+2003-07-04 Kazu Hirata <kazu@cs.umass.edu>
+
+ * call.c: Fix comment typos.
+ * class.c: Likewise.
+ * cp-tree.h: Likewise.
+ * cvt.c: Likewise.
+ * decl2.c: Likewise.
+ * decl.c: Likewise.
+ * init.c: Likewise.
+ * mangle.c: Likewise.
+ * parser.c: Likewise.
+ * pt.c: Likewise.
+ * search.c: Likewise.
+ * semantics.c: Likewise.
+ * tree.c: Likewise.
+ * typeck.c: Likewise.
+
+2003-07-04 Zack Weinberg <zack@codesourcery.com>
+
+ * parser.c (cp_lexer_read_token): No need to handle string
+ constant concatenation.
+
+2003-07-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (GCC_DIAG_STYLE, ATTRIBUTE_GCC_CXXDIAG): Define.
+ (cp_error_at, cp_warning_at, cp_pedwarn_at): Mark with
+ ATTRIBUTE_GCC_CXXDIAG.
+
+2003-07-03 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_addr_func): Handle bound pointers-to-members.
+ (build_method_call): Do not call resolve_offset_ref.
+ (implicit_conversion): Likewise.
+ (resolve_scoped_fn_name): Use finish_non_static_data_member, not
+ resolve_offset_ref.
+ (resolve_args): Do not call resolve_offset_ref.
+ (build_conditional_expr): Likewise.
+ (build_new_method_call): Likewise.
+ * cp-tree.def (OFFSET_REF): Update documentation.
+ * cvt.c (cp_convert_to_pointer): Update handling of conversions from
+ pointers to members to pointers.
+ (ocp_convert): Do not call resolve_offset_ref.
+ (convert_to_void): Likewise.
+ (build_expr_type_conversion): Likewise.
+ * decl2.c (delete_sanity): Likewise.
+ * init.c (resolve_offset_ref): Simplify greatly.
+ (build_vec_delete): Do not call resolve_offset_ref.
+ * parser.c (cp_parser_postfix_expression): Call resolve_offset_ref
+ if appropriate.
+ (cp_parser_unary_expression): Use
+ cp_parser_simple_cast_expression.
+ (cp_parser_delete_expression): Likewise.
+ (cp_parser_cast_expression): Likewise.
+ (cp_parser_pm_expression): Use cp_parser_binary_op.
+ (cp_parser_simple_cast_expression): New function.
+ * rtti.c (build_dynamic_cast_1): Do not call resolve_offset_ref.
+ * semantics.c (finish_increment_expr): Likewise.
+ (finish_typeof): Likewise.
+ * tree.c (lvalue_p_1): Do not handle OFFSET_REF.
+ * typeck.c (require_complete_type): Do not handle OFFSET_REFs.
+ (decay_conversion): Do not call resolve_offset_ref.
+ (finish_class_member_access_expr): Likewise.
+ (convert_arguments): Likewise.
+ (build_x_binary_op): Handle DOTSTAR_EXPR.
+ (condition_conversion): Do not call resolve_offset_ref.
+ (unary_complex_lvalue): Likewise.
+ (build_static_cast): Likewise.
+ (build_reinterpret_cast): Likewise.
+ (build_const_cast): Likewise.
+ (build_c_cast): Likewise.
+ (build_modify_expr): Likewise.
+ (convert_for_assignment): Likewise.
+ (convert_for_initialization): Likewise.
+ * typeck2.c (build_x_arrow): Likewise.
+ (build_m_component_ref): Simplify.
+
+ * call.c (build_scoped_method_call): Use convert_to_void.
+ (build_method_call): Likewise.
+ * class.c (check_field_decls): Remove dead code.
+ * cvt.c (convert_from_reference): Remove OFFSET_TYPE handling.
+ * decl2.c (grok_array_decl): Remove dead code.
+ (arg_assoc_type): Avoid relying on POINTER_TYPE over OFFSET_TYPE
+ as pointer-to-member representation.
+ * init.c (build_offset_ref): Tidy.
+ (build_vec_delete_1): Use convert_to_void.
+ * mangle.c (write_type): Avoid relying on POINTER_TYPE over OFFSET_TYPE
+ as pointer-to-member representation.
+
+2003-07-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9162
+ * decl.c (grokdeclarator): Return friend decls, not
+ void_type_node.
+ * decl2.c (grokfield): Alter friend decl check.
+ * parser.c (struct cp_parser): Document default_arg chain on
+ unparsed_functions_queue.
+ (cp_parser_save_default_args): New.
+ (cp_parser_init_declarator, cp_parser_function_definition,
+ cp_parser_member_declaration): Call it.
+ (cp_parser_class_specifier): Remove unused variable. Alter
+ processing of unparsed_functions_queue.
+
+2003-07-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (add_method, check_field_decl): Fix format specifier.
+ * decl.c (duplicate_decls, pushdecl, check_goto,
+ fixup_anonymous_aggr, maybe_commonize_var, grokdeclarator,
+ start_enum): Likewise.
+ * decl2.c (ambiguous_decl): Likewise.
+ * pt.c (redeclare_class_template): Likewise.
+
+2003-07-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10219
+ * pt.c (type_unification_real): Don't unify exprs of error type.
+ * tree.c (error_type): Don't die on error_type.
+
+ PR c++/9779
+ * decl2.c (arg_assoc_class): Don't die on NULL type.
+ * typeck.c (type_unknown_p): Don't die on untyped expressions.
+
+2003-07-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/6949
+ * decl2.c (grokfield): Create TEMPLATE_DECLs for methods in local
+ classes.
+
+2003-07-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * error.c (locate_error): %P takes an `int', not a `tree'.
+
+2003-07-02 Jan Hubicka <jh@suse.cz>
+
+ * decl2.c (defer_fn): Set DECL_DEFER_OUTPUT.
+ (finish-file): Do not process function with DECL_DEFER_OUTPUT clear;
+ clear DECL_DEFER_OUTPUT once function is processed; avoid flags
+ massaging.
+
+ * cp-tree.h (DECL_NEEDED_P): Support unit-at-a-time
+ (expand_or_defer_fn): Declare.
+ (lower_function): Declare.
+ * decl.c (start_cleanup_fn): Use expand_or_defer_fn.
+ * decl2.c: Include cgraph.h and varpool.h
+ (maybe_emit_vtables): Make explicit instantations as needed.
+ (mark_member_pointers, lower_function): New functions.
+ (finish_file): Do unit-at-a-time.
+ * method.c (synthesize_method): Use expand_or_defer_fn.
+ * optimize.c (maybe_clone_body): Use expand_or_defer_fn.
+ * parser.c (cp_parser_function_definition_after_decl): Use
+ expand_or_defer_fn.
+ * pt.c (instantiate_decl): Likewise.
+ * semantics.c: Include cgraph.h
+ (expand_or_defer_fn): Break out from ...
+ (expand_body): ... here; deal with unit-at-a-time.
+ * cp-lang.c (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION,
+ LANG_HOOKS_CALLGRAPH_LOWER_FUNCTION): Define.
+
+2003-07-01 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (resolve_scoped_fn_name): Return error_mark_node for
+ erroneous cases.
+
+2003-07-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11149
+ * call.c (resolve_scoped_fn_name): Check that the qualifying scope
+ is a class type.
+
+2003-07-01 Giovanni Bajo <giovannibajo@libero.it>
+
+ PR c++/8046
+ * error.c (dump_decl): Handle BIT_NOT_EXPR as
+ pseudo destructor calls.
+
+2003-07-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (define_label): Replace filename and lineno
+ arguments with a location_t.
+ * decl.c (pop_label): Adjust define_label call.
+ (define_label): Replace filename and lineno arguments with a
+ location_t.
+ * semantics.c (finish_label): Adjust define_label call.
+
+2003-07-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9559
+ * decl2.c (grokfield): Do not build NOP_EXPRs around the
+ error_mark_node.
+
+2003-06-30 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in: Update.
+ * cp-lang.c (c_language): Define.
+ (LANG_HOOKS_INIT_OPTIONS): Use common hook.
+ * cp-tree.h (cxx_init_options): Remove.
+ * lex.c: Don't include diagnostic.h.
+ (cxx_init_options): Remove.
+
+2003-06-30 Giovanni Bajo <giovannibajo@libero.it>
+
+ PR c++/4933
+ * error.c (dump_expr): Support correctly the COMPOUND_EXPR
+ tree generated within a template. Use dump_expr to dump an
+ expression sizeof.
+
+2003-06-30 Giovanni Bajo <giovannibajo@libero.it>
+
+ * mangle.c (write_expression): Exit gracefully when trying to
+ mangle a CALL_EXPR.
+
+2003-06-30 Giovanni Bajo <giovannibajo@libero.it>
+
+ PR c++/10750
+ * parser.c (cp_parser_primary_expression): A VAR_DECL with a
+ (value- or type-) dependent expression as DECL_INITIAL is a
+ valid constant-expression (at parser time).
+
+2003-06-30 Giovanni Bajo <giovannibajo@libero.it>
+
+ PR c++/11106
+ * error.c (dump_decl): Call dump_decl to dump the DECL_NAME for a
+ USING_DECL, instead of print_tree_identifier.
+
+2003-06-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-tree.h (language_to_string): Adjust declaration.
+ * dump.c (cp_dump_tree): Adjust usage.
+ * error.c (dump_char): Use output_formatted_scalar. Tidy.
+ (parm_to_string): Lose unused parameter. Tidy.
+ (expr_to_string): Likewise.
+ (code_to_string): Likewise.
+ (language_to_string): Likewise.
+ (op_to_string): Likewise.
+ (assop_to_string): Likewise.
+ (digit_buffer): Remove.
+ (dump_type): Format builtin vector type as __vector__.
+
+2003-06-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * error.c (print_integer): Remove.
+ (dump_type_suffix): Adjust.
+ (dump_expr): Likewise.
+
+2003-06-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * error.c (print_instantiation_partial_context): Take a
+ location_t.
+ (print_instantiation_full_context): Adjust.
+ (print_instantiation_context): Adjust.
+
+ * cp-tree.h (cp_line_of, cp_file_of): Remove.
+ * error.c (cp_line_of, cp_file_of): Merge into ...
+ (location_of): ... here. Make static, return a location_t.
+ (cp_error_at, cp_warning_at, cp_pedwarn_at): Adjust.
+
+2003-06-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10784
+ * call.c (joust): Move warn_conversion check outwards.
+
+2003-06-27 Zack Weinberg <zack@codesourcery.com>
+
+ * decl.c (build_typename_type)
+ * mangle.c (write_template_template_arg)
+ * parser.c (cp_parser_scope_through_which_access_occurs)
+ * pt.c (push_access_scope_real, push_access_scope, pop_access_scope)
+ * repo.c (get_base_filename)
+ * semantics.c (maybe_convert_cond):
+ Mark the definition static, matching the forward declaration.
+
+2003-06-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10468
+ * pt.c (tsubst): Handle qualified TYPEOF_TYPEs correctly.
+
+2003-06-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10796
+ * decl.c (finish_enum): Implement DR377.
+
+ * decl.c (cp_finish_decl): Don't make variables with reference
+ type readonly while they are being initialized.
+
+2003-06-26 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11332
+ * typeck.c (build_static_cast): Avoid returning expressions with
+ reference type.
+
+2003-06-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (build_op_delete_call): Use strip_array_call. Correct
+ error message to say 'delete' or 'delete[]'.
+
+2003-06-26 Giovanni Bajo <giovannibajo@libero.it>
+
+ PR c++/8266
+ * pt.c (check_explicit_specialization): When looking up a
+ template function from an identifier outside class-scope, bind
+ it to CP_DECL_CONTEXT.
+
+2003-06-25 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10990
+ * search.c (lookup_base_r): Rely on accessible_p, rather than
+ trying to emulate that logic here.
+
+ PR c++/10931
+ * call.c (convert_like): Pass issue_conversion_warnings.
+ (convert_like_with_context): Likewise.
+ (convert_like_real): Add issue_conversion_warnings parameter.
+ (perform_direct_initialization_if_possible): New function.
+ * cp-tree.h (perform_direct_initialization_if_possible): Declare it.
+ * typeck.c (check_for_casting_away_constness): New function.
+ (build_static_cast): Rewrite.
+
+2003-06-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (enforce_access): Assert we get a binfo.
+ (build_op_delete_call): Pass a binfo to
+ perform_or_defer_access_check.
+ * class.c (alter_access): Likewise.
+ * decl.c (make_typename_type): Likewise.
+ (make_unbound_class_template): Likewise.
+ * lex.c (do_identifier): Likewise.
+ * method.c (hack_identifier): Likewise.
+ * parser.c (cp_parser_lookup_name): Likewise.
+ * search.c (lookup_member): Likewise. Move IDENTIFIER_CLASS_VALUE
+ test.
+ * semantics.c (finish_non_static_data_member): Likewise.
+ (perform_or_defer_access_check): Expect a binfo.
+ * typeck.c (comptypes): Expect types.
+
+ * mangle.c (find_substitution): Don't pass a non-type to same_type_p
+ * friend.c (make_friend_class): Likewise.
+ * pt.c (check_default_tmpl_args): Likewise.
+ (lookup_template_class): Likewise.
+
+2003-06-24 Jan Hubicka <jh@suse.cz>
+
+ * method.c (thunk_labelno): Move outside ifdef block to make garbage
+ collector happy.
+
+2003-06-24 Jan Hubicka <jh@suse.cz>
+
+ * class.c (build_vtable): Make vtables.
+ * cp-tree.h (DECL_VTABLE_OR_VTT_P): New macro.
+ * decl2.c (output_vtable_inherit): Rename to ...
+ (prepare_assemble_variable): ... this one; change interface.
+ (maybe_emit_vtables): Do not call output_vtable_inherit.
+ * cp-lang.c (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): Define.
+ * cp-tree.h (prepare_assemble_variable): New.
+
+2003-06-23 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * method.c: add prototype for make_alias_for_thunk.
+ (thunk_labelno, make_alias_for_thunk): only define
+ if ASM_OUTPUT_DEF is defined.
+
+2003-06-23 Jakub Jelinek <jakub@redhat.com>
+
+ * method.c (thunk_labelno): New variable.
+ (make_alias_for_thunk): New function.
+ (use_thunk): Use it if defined ASM_OUTPUT_DEF. Put the thunk
+ into the same section as the function it is calling.
+ Include gt-cp-method.h.
+ * Make-lang.in (gt-cp-method.h): Depend on s-gtype.
+ (cp/method.o): Depend on gt-cp-method.h.
+ * config-lang.in (gtfiles): Add $(srcdir)/cp/method.c.
+
+2003-06-23 Jan Hubicka <jh@suse.cz>
+
+ * decl.c (register_dtor_fn): Mark cleanup as used.
+ * decl2.c (mark_vtable_entries): Skip nops.
+ * rtti.c (get_tinfo_ptr): Mark tinfo as used.
+ (build_dynamic_cast_1): Likewise.
+ (tinfo_base_init): Likewise.
+ (emit_tinfo_decl): Likewise.
+
+2003-06-23 Jakub Jelinek <jakub@redhat.com>
+
+ * mangle.c (hash_type): Val is the TREE_LIST itself, not a pointer
+ to it.
+
+2003-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/10784
+ * call.c (joust): Warn about choosing conversion sequence only if
+ -Wconversion.
+
+2003-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/10864
+ * call.c (op_error): Tidy.
+ * error.c (dump_expr): Properly format 'T()' when T is an
+ aggregate type.
+
+2003-06-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/10915
+ * decl.c (grok_op_properties): Warn possible confusing conversion
+ only if -Wconversion.
+
+2003-06-20 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10749
+ * parser.c (cp_parser_class_head): See through dependent names
+ when parsing a class-head.
+
+ PR c++/10845
+ * pt.c (try_class_unification): Correct handling of member class
+ templates.
+
+2003-06-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ * semantics.c (genrtl_finish_function): Adjust
+ expand_function_end call.
+
+2003-06-19 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10939
+ * pt.c (tsubst_decl): Do not try to substitute into non-dependent
+ functions.
+ (value_dependent_expression_p): Correct logic for FUNCTION_DECLs.
+
+ PR c++/9649
+ * cp-tree.h (pushdecl_class_level): Change prototype.
+ (push_class_level_binding): Likewise.
+ * decl.c (add_binding): Reject duplicate static data members.
+ (pushdecl_class_level): Return a value indicating whether or not
+ the binding was valid.
+ (push_class_level_binding): Likewise.
+ * semantics.c (finish_member_declaration): Don't keep invalid
+ declarations.
+
+ PR c++/11041
+ * call.c (initialize_reference): Do not use cp_finish_decl to emit
+ temporary variables.
+ * cp-tree.h (static_aggregates): Declare.
+ (pushdecl_top_level_and_finish): Likewise.
+ * decl.c (pushdecl_top_level_1): New function.
+ (pushdecl_top_level): Use it.
+ (pushdecl_top_level_and_finish): New function.
+ (initialize_local_var): Remove redundant code.
+ (cp_finish_decl): Remove support for RESULT_DECLs. Don't check
+ building_stmt_tree.
+ * decl.h (static_aggregates): Remove.
+ * decl2.c (get_guard): Use pushdecl_top_level_and_finish.
+ * rtti.c (get_tinfo_decl): Use pushdecl_top_level_and_finish.
+ (tinfo_base_init): Likewise.
+
+2003-06-19 Matt Austern <austern@apple.com>
+
+ PR c++/11228
+ * init.c (build_zero_init): Assert that number of array elements
+ is an integer constant.
+ (build_default_init) Don't use build_zero_init for arrays with
+ variable number of elements.
+
+2003-06-19 Andreas Jaeger <aj@suse.de>
+
+ * cp-tree.h: Remove duplicated declarations.
+
+2003-06-18 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * pt.c: Convert to ISO C.
+ * semantics.c: Convert to ISO C.
+
+2003-06-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (comp_except_specs, compparms, cp_has_mutable_p,
+ at_least_as_qualified_p, more_qualified_p): Return bool.
+ * typeck.c: ANSIFY function definitions.
+ (comp_array_types): Take redeclaration bool parameter.
+ (comptypes): Rearrange STRICT handling.
+ (at_least_as_qualified_p, more_qualified_p,
+ comp_cv_qualification): Cache cv quals.
+ (compparms): Rearrange loop.
+
+2003-06-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (COMPARE_RELAXED): Rename to ...
+ (COMPARE_DERIVED): ... here. Adjust comment.
+ (resolve_typename_type_in_current_instantiation): Remove.
+ (cp_tree_equal, comptypes): Return a bool.
+ * cvt.c (convert_to_reference): Adjust comptypes call.
+ * pt.c (template_args_equal, unify,): Adjust cp_tree_equal call.
+ (resolve_typename_type_in_current_instantiation): Remove.
+ * tree.c (cp_tree_equal): Return bool. Cope with TEMPLATE_DECLs and
+ IDENTIFIER_NODEs. Abort if undeciderable. Adjust recursive
+ calls. Refactor code.
+ * typeck.c (comp_array_types): Return bool. Lose callback.
+ parameter. Adjust cp_tree_equal calls.
+ (comptypes): Return bool. Adjust strict handling. Remove relaxed
+ enumeration and java type handling. Deal with typename types here.
+ Adjust recursive and cp_tree_equals calls. Adjust base and derived
+ checking.
+ (comp_target_types): Remove unreachable code. Adjust
+ same_or_base_type_p calls.
+ (ptr_reasonably_similar): Adjust base and derived check.
+
+ * typeck.c (maybe_warn_about_returning_address_of_local): Remove
+ unused calculation.
+ (check_return_expr): Adjust error messages.
+ * cp-tree.def (SCOPE_REF): Correct comment.
+
+2003-06-17 Mark Mitchell <mark@codesourcery.com>
+
+ * mangle.c (mangle_conv_op_name_for_type): Correct sprintf format
+ string again.
+
+2003-06-17 Robert Abeles <rabeles@archaelogic.com>
+
+ * optimize.c (dump_function): Form complete flag name by
+ prefixing 'fdump-' to string returned by dump_flag_name().
+
+2003-06-17 Mark Mitchell <mark@codesourcery.com>
+
+ * mangle.c (mangle_conv_op_name_for_type): Correct sprintf format
+ string.
+
+2003-06-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/10929
+ * decl.c (grokfndecl): Don't mark a function inline for
+ -finline-functions if it isn't defined.
+
+2003-06-17 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10712
+ * class.c (handle_using_decl): Robustify.
+
+ PR c++/11105
+ * cp-tree.h (DECL_CONV_FN_TYPE): New method.
+ * mangle.c (struct globals): Remove internal_mangling_p.
+ (write_unqualified_name): Use DECL_CONV_FN_TYPE.
+ (write_template_parm): Don't write out the level number.
+ (conv_type_names): New variable.
+ (hash_type): New function.
+ (compare_type): Likewise.
+ (mangle_conv_op_name_for_type): Don't try to mangle conversion
+ operator names.
+ * search.c (lookup_conversion_operator): New function.
+ (lookup_fnfields_1): Use it.
+
+2003-06-17 Andreas Jaeger <aj@suse.de>
+
+ * except.c: Remove duplicate declaration of push_eh_cleanup.
+
+ * call.c: Remove extra declaration of inhibit_warnings.
+
+2003-06-16 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ 2003-06-16 Jens-Michael Hoffmann <jensmh@gmx.de>
+ * mangle.c: Convert to ISO C.
+
+2003-06-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp/decl.c, cp/pt.c, cp/search.c, cp/tree.c: Don't use the PTR
+ macro.
+
+2003-06-16 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * tree.c: Convert to ISO C.
+
+2003-06-16 Kazu Hirata <kazu@cs.umass.edu>
+
+ * cp-tree.h: Follow spelling conventions.
+ * mangle.c: Likewise.
+ * method.c: Likewise.
+ * parser.c: Likewise.
+
+2003-06-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (start_function): Adjust init_function_start call.
+ * method.c (use_thunk): Likewise.
+ * semantics.c (genrtl_start_function): Likewise.
+
+2003-06-14 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in: Remove c-options.o.
+
+2003-06-13 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * lex.c: Convert to ISO C.
+
+ 2003-05-19 Jens-Michael Hoffmann <jensmh@gmx.de>
+ * init.c: removes use of PARAMS macro. Use ISO style function
+ declarations. (Not copyright-significant change.)
+
+ * rtti.c: Remove PARAMS.
+
+ * typeck2.c: Convert to ISO C.
+
+2003-06-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10635
+ * typeck.c (build_c_cast): Check that the destination type is
+ complete.
+
+2003-06-11 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10432
+ * cp-tree.h (finish_declarator): Remove.
+ * decl.c (cp_finish_decl): Make sure to pop_nested_class even for
+ erroneous declarations.
+ * semantics.c (finish_declarator): Remove.
+
+2003-06-11 Roger Sayle <roger@eyesopen.com>
+
+ * decl2.c (generate_ctor_or_dtor_function): Avoid expanding a
+ global static constructor/destructor if it will be empty, i.e.
+ either doesn't call any ctors/dtors or only calls pure or const
+ ctors/dtors.
+
+2003-06-11 Mark Mitchell <mark@codesourcery.com>
+
+ * mangle.c (tm_p.h): Include it.
+ * Make-lang.in (cp/mangle.o): Depend on $(TM_P_H).
+
+ PR c++/11131
+ * tree.c (cp_cannot_inline_fn): Check for "inline" before
+ instantiation.
+
+2003-06-10 Jason Merrill <jason@redhat.com>
+
+ PR c++/10968
+ * pt.c (mark_decl_instantiated): Clear DECL_COMDAT.
+
+2003-06-10 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * decl.c (start_cleanup_fn): Move static 'counter' out, mark with GTY.
+ (start_cleanup_cnt): New.
+
+2003-06-10 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11131
+ * cp-tree.h (template_for_substitution): Declare.
+ * decl2.c (mark_used): Use it when figuring out whether or not a
+ function is inline.
+ * pt.c (template_for_substitution): Give it external linkage.
+ * tree.c (cp_cannot_inline_tree_fn): Instantiate as early as
+ possible.
+
+2003-06-09 Zack Weinberg <zack@codesourcery.com>
+
+ PR 8861
+ * mangle.c (write_real_cst): New function. Implement
+ ABI-compliant mangling of floating-point literals when
+ -fabi-version>=2; provide backward compatibility with 3.3 when
+ -fabi-version=1 (with warning). Clarify commentary.
+ (write_template_arg_literal): Use write_real_cst.
+
+2003-06-07 Andreas Jaeger <aj@suse.de>
+
+ * cp/decl.c (xref_tag): Remove undefined macro NONNESTED_CLASSES.
+
+2003-06-07 Neil Booth <neil@daikokuya.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_DECODE_OPTON): Drop.
+ (LANG_HOOKS_HANDLE_OPTION): Override.
+ * cp-tree.h (cxx_init_options): Update.
+ * lex.c (cxx_init_options): Update.
+
+2003-06-05 Jan Hubicka <jh@suse.cz>
+
+ * Make-lang.in: Add support for stageprofile and stagefeedback
+
+2003-06-04 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * decl.c (grokdeclarator): Error_mark_node in, error_mark_node out.
+
+2003-06-04 Andreas Jaeger <aj@suse.de>
+
+ * g++spec.c (lang_specific_driver): Remove ALT_LIBM usage.
+
+2003-06-03 Jason Merrill <jason@redhat.com>
+
+ * cp/cp-tree.h (CP_AGGREGATE_TYPE_P): Accept vectors.
+
+ * cp/decl.c (reshape_init): Handle vectors.
+
+ * testsuite/g++.dg/init/array10.C: New.
+
+2003-06-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10940
+ * pt.c (check_explicit_specialization): Check for 'static'
+ earlier.
+
+2003-05-31 Diego Novillo <dnovillo@redhat.com>
+
+ * class.c (dump_array): Call CONSTRUCTOR_ELTS to access
+ the operand of a CONSTRUCTOR node.
+
+2003-05-31 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c (cp_binding_level::this_entity): Rename from this_class.
+ (cxx_scope_descriptor): New function.
+ (cxx_scope_debug): Likewise.
+ (push_binding_level): Use it.
+ (pop_binding_level): Likewise.
+ (suspend_binding_level): Likewise.
+ (resume_binding_level): Likewise.
+ (pushlevel_class): Adjust use of this_class.
+ (pushtag): Likewise.
+ (lookup_name_real): Likewise.
+ (global_scope_name): New variable.
+ (initialize_predefined_identifiers): Initialize it.
+ (push_namespace): Use it.
+ (make_cxx_scope): New function.
+ (pushlevel): Use it.
+ (pushlevel_class): Likewise.
+ (push_binding_level): Simplify. Loose the last two arguments.
+ (make_binding_level): Remove.
+ (initial_push__namespace_scope): New function.
+ (push_namespace): Use it. Simplify.
+ (cxx_init_decl_processing): Likewise.
+ (declare_namespace_level): Remove.
+
+2003-05-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10956
+ * pt.c (instantiate_decl): Don't use full template arguments if
+ we are dealing with specializations.
+
+2003-05-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c (ENABLE_SCOPE_CHECKING): Rename from DEBUG_BINDING_LEVELS.
+ (binding_depth): Unconditionally define.
+ (is_class_level): Likewise.
+ (indent): Likewise. Take an indenting parameter.
+ (push_binding_level): Remove conditional definittion.
+ (pop_binding_level): Likewise.
+ (suspend_binding_level): Likewise.
+ (resume_binding_level): Likewise.
+ (pushlevel): Likewise.
+ (pushlevel_class): Likewise.
+ (poplevel_class): Likewise.
+ (pop_everything): Likewise.
+
+2003-05-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * name-lookup.h (global_scope_p): New macro.
+ * decl.c (pop_binding_level): Use it. Don't refer directly to
+ global_binding_level.
+ (suspend_binding_level): Likewise.
+ (global_bindings_p): Likewise.
+ (print_other_binding_stack): Likewise.
+ (print_binding_stack): Likewise.
+ (maybe_push_to_top_level): Likewise.
+ (pushdecl_namespace_level): Likewise.
+ (cxx_init_decl_processing): Likewise.
+ (start_decl): Likewise.
+ (cp_finish_decl): Likewise.
+ (start_function): Likewise.
+ (global_binding_level): Remove.
+
+2003-05-25 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * parser.c (cp_parser_explicit_instantiation): Restore old
+ access before template instantiation.
+
+2003-05-23 Geoffrey Keating <geoffk@apple.com>
+
+ * lang-specs.h: Use -o to specify preprocessor's output file.
+ Make -no-integrated-cpp work when building PCH files.
+
+2003-05-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10682
+ * pt.c (instantiate_class_template): Use DECL_ARTIFICIAL to
+ check for implicitly created typedef to an enum.
+
+2003-05-21 Jason Merrill <jason@redhat.com>
+
+ * init.c (build_vec_delete): Copy the address into a temporary
+ variable before calling build_vec_delete_1.
+ * decl2.c (delete_sanity): Don't call stabilize_reference.
+
+2003-05-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (register_specialization): Update the decl's location,
+ if necessary.
+ (check_explicit_specialization): Likewise.
+
+2003-05-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * error.c (dump_expr): Use HOST_WIDE_INT_PRINT_DOUBLE_HEX.
+
+2003-05-21 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR c++/9738
+ * decl.c (duplicate_decls): Re-invoke make_decl_rtl
+ if the old decl had instantiated DECL_RTL.
+ (Base on Richard Henderson 2003-05-13 patch to c-decl.c).
+
+2003-05-19 Matt Austern <austern@apple.com>
+
+ * lang-options.h: Document -Wno-invalid-offsetof
+ * typeck.c (build_class_member_access_expr): Don't complain about
+ (Foo *)p->x for non-POD Foo if warn_invalid_offset is zero.
+
+2003-05-18 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * name-lookup.c (free_binding_entry): fix where the GTY markers are.
+ (binding_entry_make): Make entry->chain NULL after getting an entry.
+ fix the spelling of chain in a comment.
+ (binding_table_free): speed up by having temporary variable.
+ (binding_table_new): set table->chain to be NULL after allocating
+ a table.
+ (cxx_binding_make): use gcc_alloc instead of ggc_alloc_cleared and set
+ binding->previous to NULL after getting an binding for speed.
+
+2003-05-18 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-tree.h (struct lang_type_class): Replace data member tags
+ with hash-table nested_udts.
+ (CLASSTYPE_NESTED_UTDS): Rename from CLASSTYPE_TAGS.
+ * class.c (unreverse_member_declarations): Don't touch
+ CLASSTYPE_TAGS.
+ (pushclass): Use cxx_remember_type_decls.
+ * decl.c (struct cp_binding_level): Replace data member tags with
+ hash-table type_decls.
+ (pop_binding_level): Handle level->type_decls.
+ (kept_level_p): Adjust.
+ (poplevel): Remove unused local variable.
+ (bt_print_entry): New function.
+ (print_binding_level): Use it.
+ (push_namespace): Build current_binding_level->type_decls.
+ (maybe_process_template_type_declaration): Adjust.
+ (pushtag): Likewise.
+ (clear_anon_tags): Use binding_table_remove_anonymous_types.
+ (gettags): Remove.
+ (cxx_remember_type_decls): Rename from storetags. Adjust.
+ (lookup_tag): Use binding_table_find_anon_type. Tidy.
+ (lookup_tag_reverse): Use binding_table_reverse_maybe_remap.
+ (cxx_init_decl_processing): Build global_binding_level->type_decls.
+ (store_parm_decls): Remove pointless code.
+ * name-lookup.c (free_binding_entry): New variable.
+ (ENTRY_INDEX): New macro.
+ (struct binding_table_s): New datatype.
+ (binding_entry_make): New function.
+ (binding_entry_free): Likewise.
+ (binding_table_construct): Likewise.
+ (binding_table_free): Likewise.
+ (binding_table_new): Likewise.
+ (binding_table_expand): Likewise.
+ (binding_table_insert): Likewise.
+ (binding_table_find): Likewise.
+ (binding_table_find_anon_type): Likewise.
+ (binding_table_reverse_maybe_remap): Likewise.
+ (binding_table_remove_anonymous_types): Likewise.
+ (binding_table_foreach): Likewise.
+ * name-lookup.h (binding_table): New type.
+ (binding_entry): Likewise.
+ (bt_foreach_proc): Likewise.
+ (struct binding_entry_s): New datatype.
+ (SCOPE_DEFAULT_HT_SIZE): New macro.
+ (CLASS_SCOPE_HT_SIZE): Likewise.
+ (NAMESPACE_ORDINARY_HT_SIZE): Likewise.
+ (NAMESPACE_STD_HT_SIZE): Likewise.
+ (GLOBAL_SCOPE_HT_SIZE): Likewise.
+ (binding_table_new): Declare.
+ (binding_table_free): Likewise.
+ (binding_table_insert): Likewise.
+ (binding_table_find_anon_type): Likewise.
+ (binding_table_reverse_maybe_remap): Likewise.
+ (binding_table_remove_anonymous_types): Likewise.
+ (binding_table_foreach): Likewise.
+ (binding_table_find): Likewise.
+ (cxx_remember_type_decls): Likewise.
+ * pt.c (bt_instantiate_type_proc): New function.
+ (do_type_instantiation): Use it.
+ * search.c (lookup_field_r): Use binding_table_find.
+
+2003-05-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * semantics.c (perform_deferred_access_checks): Don't discard
+ checked access.
+
+2003-05-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
+ libiberty VA_ macros, always use stdarg.
+ * rtti.c (create_pseudo_type_info): Likewise.
+ * tree.c (build_min_nt, build_min): Likewise.
+
+2003-05-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * ptree.c (cxx_print_type, cxx_print_xnode): Use string
+ concatentation on HOST_WIDE_INT_PRINT_* format specifier to
+ collapse multiple function calls into one.
+ * tree.c (debug_binfo): Likewise.
+
+2003-05-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/5388
+ * call.c (conditional_conversion): Don't consider implicit
+ conversions if T2 is a base of T1.
+ * cp-tree.h (DERIVED_FROM_P, UNIQUELY_DERIVED_FROM_P): Make boolean.
+ (ACCESSIBLY_UNIQUELY_DERIVED_P, PUBLICLY_UNIQUELY_DERIVED_P): Likewise.
+
+ * parser.c (cp_parser_primary_expression): Convert a static data
+ member from reference.
+
+2003-05-15 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_op_delete_call): Avoid creating unnecessary types.
+ * class.c (instantiate_type): Remove tests for tf_no_attributes.
+ * cp-tree.h (tsubst_flags_t): Remove tf_no_attributes.
+ (COMPARE_NO_ATTRIBUTES): Remove.
+ * typeck.c (comptypes): Do not check COMPARE_NO_ATTRIBUTES.
+
+ PR c++/8385
+ * semantics.c (finish_typeof): Refine type-dependency check.
+
+2003-05-13 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (build_modify_expr): Don't always stabilize the lhs and
+ rhs. Do stabilize the lhs of a MODIFY_EXPR used on the lhs.
+
+2003-05-11 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * method.c (synthesize_method): Call push/pop_deferring_access_checks.
+
+2003-05-11 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10230, c++/10481
+ * semantics.c (finish_non_static_data_member): Handle when the
+ non-static member is not from a base of the current class type.
+
+2003-05-11 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10552
+ * pt.c (tsubst_copy): Handle TEMPLATE_DECL that is a member class
+ template and has dependent context.
+
+2003-05-10 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (instantiate_decl): Call push/pop_deferring_access_checks.
+
+2003-05-10 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9252
+ * cp-tree.h (saved_scope): Remove check_access field.
+ (tsubst_flags_t): Remove tf_parsing.
+ * decl.c (maybe_push_to_top_level): Don't initialize
+ scope_chain->check_access.
+ (make_typename_type, make_unbound_class_template): Don't use
+ tf_parsing.
+ (register_dtor_fn): Use push/pop_deferring_access_checks
+ instead of scope_chain->check_access.
+ * method.c (use_thunk): Likewise.
+ * parser.c (cp_parser_explicit_instantiation
+ (cp_parser_constructor_declarator_p): Don't call
+ push/pop_deferring_access_checks here.
+ (cp_parser_template_argument, cp_parser_class_name): Don't use
+ tf_parsing.
+ (yyparse): Check flag_access_control.
+ * pt.c (instantiate_class_template): Call
+ push/pop_deferring_access_checks.
+ * semantics.c (push_deferring_access_checks): Propagate
+ dk_no_check.
+ (perform_or_defer_access_check): Make sure basetype_path is
+ a type before comparison.
+ * call.c (build_op_delete_call, build_over_call): Use
+ perform_or_defer_access_check.
+ * class.c (alter_access): Likewise.
+ * init.c (build_offset_ref): Likewise.
+ * lex.c (do_identifier): Likewise.
+ * method.c (hack_identifier): Likewise.
+ * search.c (lookup_member): Likewise.
+ * semantics.c (finish_non_static_data_member): Likewise.
+ (simplify_aggr_init_exprs_r): Use push/pop_deferring_access_checks
+ instead of flag_access_control.
+
+2003-05-10 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9554
+ * parser.c (cp_parser_class_name): Remove check_access parameter.
+ All caller adjusted. Update declaration.
+ (cp_parser_lookup_name): Likewise.
+ * semantics.c (push_deferring_access_checks): Change parameter type
+ to enum deferring_kind. All caller adjusted.
+ (resume_deferring_access_checks): Adjust to use new enum.
+ (stop_deferring_access_checks): Likewise.
+ (perform_or_defer_access_check): Likewise.
+ * cp-tree.h (deferring_kind): New enum.
+ (deferred_access): Adjust field type.
+ (push_deferring_access_checks): Update declaration.
+
+2003-05-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10555, c++/10576
+ * pt.c (lookup_template_class): Handle class template with
+ multiple levels of parameters when one of the levels contain
+ errors.
+
+2003-05-08 Jason Merrill <jason@redhat.com>
+
+ * init.c (build_new_1): Don't reuse a TARGET_EXPR in an
+ expression. Undo some of the recent reorg.
+
+2003-05-07 Richard Henderson <rth@redhat.com>
+
+ PR c++/10570
+ * cfns.gperf: Comment out POSIX thread cancellation points,
+ plus abort and raise.
+ * cfns.h: Regenerate.
+
+2003-05-07 Jason Merrill <jason@redhat.com>
+
+ * call.c (build_conditional_expr): Don't assume that the folded
+ expression has result_type.
+
+2003-05-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * typeck.c (build_unary_op): Deal with const qualifier in
+ invalid pointer-to-member earlier.
+
+2003-05-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/9537
+ * call.c (conditional_conversion): Build an RVALUE_CONV if
+ we're just changing the cv-quals.
+ (build_conditional_expr): Don't call convert to change
+ cv-quals.
+
+2003-05-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10496
+ * typeck.c (build_unary_op): Don't output const qualifier when
+ output invalid pointer-to-member diagnostics.
+
+2003-05-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * decl.c: Fix typos.
+
+2003-05-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/4494
+ * decl.c (start_function): Use same_type_p to check return type
+ of main.
+
+2003-05-03 Zack Weinberg <zack@codesourcery.com>
+
+ PR c/10604
+ * cp/typeck.c (build_x_compound_expr): No need to check
+ extra_warnings as well as warn_unused_value.
+
+2003-05-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9364, c++/10553, c++/10586
+ * decl.c (make_typename_type): Don't crash on illegal code.
+
+2003-05-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (finish_struct): Use location_t and input_location
+ directly.
+ * decl.c (make_label_decl): Likewise.
+ (use_label): Likewise.
+ * decl2.c (warn_if_unknown_interface): Likewise.
+ (start_static_initialization_or_destruction): Likewise.
+ (generate_ctor_or_dtor_function): Likewise.
+ (finish_file): Likewise.
+ * error.c (print_instantiation_full_context): Likewise.
+ * init.c (create_temporary_var): Likewise.
+ * method.c (synthesize_method): Likewise.
+ * parser.c (cp_token): Likewise.
+ (cp_lexer_set_source_position_from_token): Likewise.
+ (cp_lexer_get_preprocessor_token): Likewise.
+ (cp_parser_statement): Likewise.
+ * pt.c (tsubst_friend_function): Likewise.
+ (instantiate_class_template): Likewise.
+ (tsubst_decl): Likewise.
+ (tsubst): Likewise.
+ (instantiate_decl): Likewise.
+ * semantics.c (begin_class_definition): Likewise.
+ (expand_body): Likewise.
+
+2003-05-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (finish_struct): Rename lineno to input_line.
+ * decl.c (push_binding_level, pop_binding_level,
+ suspend_binding_level, resume_binding_level, make_label_decl,
+ use_label, start_function): Likewise.
+ * decl2.c (warn_if_unknown_interface,
+ start_static_initialization_or_destruction,
+ generate_ctor_or_dtor_function, finish_file): Likewise.
+ * error.c (cp_line_of, print_instantiation_full_context,
+ print_instantiation_context): Likewise.
+ * except.c (check_handlers_1, check_handlers): Likewise.
+ * init.c (create_temporary_var): Likewise.
+ * method.c (use_thunk, synthesize_method): Likewise.
+ * parser.c (cp_lexer_set_source_position_from_token,
+ cp_lexer_get_preprocessor_token): Likewise.
+ * pt.c (push_tinst_level, pop_tinst_level,
+ tsubst_friend_function, instantiate_class_template, tsubst_decl,
+ tsubst, tsubst_expr, instantiate_decl): Likewise.
+ * semantics.c (genrtl_try_block, finish_label_stmt,
+ begin_class_definition, expand_body,
+ genrtl_finish_function): Likewise.
+ * tree.c (build_min_nt, build_min): Likewise.
+
+2003-05-01 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (comdat_linkage): Don't externalize explicit
+ instantiations.
+
+2003-05-01 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10554
+ * decl2.c (do_class_using_decl): Check if operand 0 of SCOPE_REF
+ is not NULL.
+
+2003-05-01 Steven Bosscher <steven@gcc.gnu.org>
+
+ * cp-tree.h (struct lang_id2): Remove. Move fields from here...
+ (struct lang_identifier): ... to here.
+ (LANG_ID_FIELD): Remove.
+ (SET_LANG_ID): Remove.
+ (IDENTIFIER_LABEL_VALUE): Adjust for new lang_identifier.
+ (SET_IDENTIFIER_LABEL_VALUE): Likewise.
+ (IDENTIFIER_IMPLICIT_DECL): Likewise.
+ (SET_IDENTIFIERL_IMPLICIT_DECL): Likewise.
+ (IDENTIFIER_ERROR_LOCUS): Likewise.
+ (SET_IDENTIFIER_ERROR_LOCUS): Likewise.
+
+2003-05-01 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/8772
+ * pt.c (convert_template_argument): Correct diagnostic.
+
+2003-04-30 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9432, c++/9528
+ * decl2.c (validate_nonmember_using_decl): Handle SCOPE_REF.
+
+2003-04-30 Garbiel Dos Reis <gcc@integrable-solutions.net>
+
+ * decl.c (check_previous_goto_1): Adjust prototype.
+ (check_previous_goto): Adjust use.
+ (check_switch_goto): Likewise.
+ (use_label): Adjust.
+ (check_previous_goto_1): Don't use pedwarn_with_file_and_line.
+ (struct named_label_use_list): Use location_t datatype.
+
+2003-04-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10551
+ * pt.c (mark_decl_instantiated): Defer all explicit instantiations
+ that have not yet been written out.
+
+2003-04-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10549
+ * class.c (layout_class_type): Mark overlong bitfields as having
+ the maximum size permitted by their type, after layout.
+
+ PR c++/10527
+ * error.c (dump_expr): Correctly handling of NEW_EXPR.4
+
+2003-04-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * call.c (build_operator_new_call): Fix typo.
+ * lang-options.h: Likewise.
+
+2003-04-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10515
+ * cp-tree.h (lookup_field_1): Declare it.
+ * search.c (lookup_field_1): Make it public.
+ * decl.c (reshape_init): Handle designated initializers.
+
+ * decl.c (maybe_commonize_var): Further tweak support for systems
+ without weak symbols.
+
+2003-04-27 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (maybe_commonize_var): Fix thinko in last patch.
+
+2003-04-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10506
+ * method.c (use_thunk): Decrement immediate_size_expand.
+
+ PR c++/10503
+ * cp-tree.h (DECL_VAR_MARKED_P): New macro.
+ (DECL_MAYBE_TEMPLATE): Remove.
+ * class.c (fixed_type_or_null): Avoid infinite recursion.
+
+ * decl.c (maybe_commonize_var): Make the code match the comments.
+ * pt.c (instantiate_decl): Move call to import_export_decl.
+
+2003-04-26 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (finish_file): Fix merge botch.
+
+2003-04-25 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (finish_file): Don't call import_export_decl for
+ functions that are not defined.
+ (handle_class_head): Robustify.
+ * pt.c (instantiate_decl): Do not call cp_finish_decl for
+ variables that are not defined.
+
+2003-04-24 Sylvain Pion <Sylvain.Pion@mpi-sb.mpg.de>
+
+ * call.c (print_z_candidates): Fix off by one error.
+
+2003-04-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10337
+ * call.c (joust): Don't warn about conversion ops that are exact
+ or cv-conversions. Rearrange to avoid multiple type comparisons.
+
+2003-04-23 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10471
+ * call.c (build_cxx_call): Robustify.
+
+2003-04-23 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in (lex.o): Remove mbchar.h.
+ * lex.c (MULTIBYTE_CHARS): Lose.
+ * parser.c (cp_lexer_get_preprocessor_token): CPP_OTHER handled
+ in c-lex.c.
+
+2003-04-23 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9847
+ * cp-tree.h (duplicate_tag_error): Remove.
+ * class.c (duplicate_tag_error): Remove.
+ * semantics.c (begin_class_definition): Return immediately for a
+ duplicate class definition.
+
+ PR c++/10451
+ * decl.c (grokdeclarator): Correct logic for "mutable" errors.
+
+2003-04-22 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10446
+ * search.c (lookup_fnfields_1): Handle empty slots in the method
+ vector.
+
+ PR c++/10428
+ * decl.c (check_elaborated_type_specifier): New function, split
+ out from ...
+ (xref_tag): ... here. Use the new function in more places.
+
+ * rtti.c (throw_bad_typeid): Use build_cxx_call.
+
+2003-04-21 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_over_call): Use build_cxx_call.
+ (build_cxx_call): New method, split out of build_over_call.
+ * cp-tree.h (language_function): Add can_throw.
+ (build_cxx_call): Declare it.
+ * decl.c (finish_function): If a function does not contain any
+ calls to functions that can throw an exception, indicate that
+ fact.
+ * decl2.c (mark_used): Do not defer the instantiation of
+ functions, if the current function does not throw.
+ * optimize.c (maybe_clone_body): Copy TREE_NOTHROW to the clones.
+ * pt.c (instantiate_decl): Make sure import_export_decl is called
+ before emitting things.
+ * rtti.c (throw_bad_cast): Use build_cxx_call.
+ (build_dynamic_cast_1): Likewise.
+ * typeck.c (build_function_call): Likewise.
+
+2003-04-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9881
+ * typeck.c (build_unary_op): Fold all COMPONENT_REF addr
+ expressions. Reverts my 2002-08-08 patch.
+
+ * typeck.c (comp_ptr_ttypes_real): Swap final && operands for
+ cheaper early exit.
+
+2003-04-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp/decl2.c (start_static_storage_duration_function): Take count
+ arg, don't check if it wraps round.
+ (generate_ctor_or_dtor_function): Add locus arg, use it.
+ (generate_ctor_and_dtor_functions_for_priority): Data arg is a
+ locus.
+ (finish_file): Set line numbers to past EOF for synthesized
+ functions.
+
+2003-04-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10405
+ * search.c (lookup_field_1): Final scan goes backwards for
+ types, forwards for non-types.
+
+2003-04-17 Roger Sayle <roger@eyesopen.com>
+
+ PR c/10375
+ * decl.c (duplicate_decls): Preserve "const", "noreturn" and
+ "nothrow" function attributes.
+
+2003-04-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10347
+ * pt.c (type_dependent_expression_p): Handle array new.
+
+2003-04-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10381
+ * parser.c (cp_parser_primary_expression): Reorganize logic for
+ dealing with name lookup failures.
+
+2003-04-15 Jason Merrill <jason@redhat.com>
+
+ * decl2.c (mark_used): Don't instantiate anything if
+ skip_evaluation.
+
+2003-04-14 Ziemowit Laski <zlaski@apple.com>
+
+ * tree.c (build_cplus_array_type_1): Do not call
+ uses_template_parms() on a NULL index_type.
+
+2003-04-13 Roger Sayle <roger@eyesopen.com>
+
+ * decl.c (duplicate_decls): Preserve pure and malloc attributes.
+
+2003-04-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10300
+ * init.c (build_new_1): Reorganize.
+
+2003-04-12 Zack Weinberg <zack@codesourcery.com>
+
+ * class.c (initialize_array)
+ * decl.c (reshape_init)
+ * decl2.c (build_expr_from_tree)
+ * init.c (build_zero_init)
+ * pt.c (tsubst_copy, tsubst_copy_and_build)
+ * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer)
+ (ptm_initializer, class_initializer, get_pseudo_ti_init)
+ * semantics.c (finish_compound_literal)
+ * typeck.c (build_ptrmemfunc1)
+ * typeck2.c (store_init_value, process_init_constructor)
+ (build_functional_cast): Use build_constructor.
+
+2003-04-12 Zack Weinberg <zack@codesourcery.com>
+
+ * call.c (print_z_candidates): Use gcc_gettext_width, not
+ strlen, to determine how much padding to use.
+
+2003-04-10 Zack Weinberg <zack@codesourcery.com>
+
+ * decl.c: Update all calls to shadow_warning.
+
+2003-04-10 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_class_type): Correct handling for overlong
+ bit-fields whose width is the same as an integer type.
+
+2003-04-06 Zack Weinberg <zack@codesourcery.com>
+
+ * cp-tree.def: Make fourth element for all 'c' and 'x' nodes zero.
+ * cp-lang.c (cp_tree_size): New function.
+ (LANG_HOOKS_TREE_SIZE): Override.
+
+ * cp-tree.h (SOURCE_LOCUS, SRCLOC_FILE, SRCLOC_LINE, struct
+ tree_srcloc, TS_CP_COMMON, TS_CP_SRCLOC): Kill.
+ (union lang_tree_node): Remove common and srcloc members.
+ (build_srcloc_here): Don't prototype.
+ * decl.c (cp_tree_node_structure): Kill SRCLOC case.
+ * pt.c (pending_templates): Correct comment.
+ * tree.c (build_srcloc, build_srcloc_here): Kill.
+
+2003-04-06 Zack Weinberg <zack@codesourcery.com>
+
+ * call.c: Include intl.h.
+ (print_z_candidate): Always use inform; get rid of errfn
+ argument. Reorganize so that all the strings get picked up
+ by xgettext. Note obligation of caller to pass first argument
+ through gettext.
+ (print_z_candidates): Update to match. Indent second and
+ successive candidates by strlen() of translated message.
+ (joust): Restructure ambiguous-conversion pedwarn so that
+ translators see a complete sentence. Update calls to
+ print_z_candidate.
+
+ * Make-lang.in (cp/call.o): Update dependencies.
+
+2003-04-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c (set_current_binding_level): Delete, revert last change.
+ (current_binding_level): Modify to allow it as as lvalue.
+
+2003-04-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * name-lookup.c (find_binding): Pass appropriate pointer type to
+ POP_TIMEVAR_AND_RETURN.
+
+2003-04-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Make-lang.in (cp-warn): Add $(STRICT_WARN).
+ * cp-tree.h: Don't insist on having GNUC.
+
+2003-04-03 Jason Merrill <jason@redhat.com>
+
+ * cvt.c (ocp_convert): Only abort if we try to convert an object
+ of TREE_ADDRESSABLE type.
+
+ * class.c (build_vtable): Set DECL_ALIGN here.
+ (get_vtable_decl): Not here.
+ (layout_vtable_decl): Or here.
+ (create_vtable_ptr): Or here.
+ (layout_class_type): Or here.
+ (check_bitfield_decl): Don't mess with field alignment.
+
+2003-04-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * operators.def (DEF_SIMPLE_OPERATOR, DEF_ASSN_OPERATOR,
+ DEF_ASSN_OPERATOR): Delete spurious semi-colon.
+ * rtti.c (dfs_class_hint_mark): Likewise.
+
+ * decl.c (push_local_name, push_class_level_binding,
+ maybe_inject_for_scope_var): Don't use POP_TIMEVAR_AND_RETURN in
+ functions returning void.
+ * decl2.c (add_using_namespace): Likewise.
+
+ * decl.c (print_binding_level, print_other_binding_stack,
+ print_binding_stack): Cast argument of %p specifier to void*.
+ * ptree.c (cxx_print_decl): Likewise.
+
+ * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK,
+ VAR_FUNCTION_OR_PARM_DECL_CHECK,
+ VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK, RECORD_OR_UNION_TYPE_CHECK,
+ BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK, LANG_TYPE_CLASS_CHECK,
+ LANG_TYPE_PTRMEM_CHECK, LANG_DECL_U2_CHECK): Add __extension__.
+
+ * decl.c (set_current_binding_level): New macro. Use throughout
+ when setting the current binding level.
+
+ * cp-tree.h (cp_lvalue_kind, base_access): Delete trailing comma
+ in enum.
+ * method.c (mangling_flags): Likewise.
+
+ * cp-tree.h (lang_type_header): Add __extension__ and use
+ CHAR_BITFIELD for members.
+
+2003-04-02 Geoffrey Keating <geoffk@apple.com>
+
+ PR other/9274
+ * mangle.c: Include gt-cp-mangle.h.
+ (subst_identifiers): Mark with GTY.
+ * config-lang.in (gtfiles): Add cp/mangle.c.
+ * Make-lang.in: (gt-cp-mangle.h): New rule.
+ (cp/mangle.o): Depends on gt-cp-mangle.h.
+
+2003-04-01 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * config-lang.in (gtfiles): Add \$(srcdir)/cp/name-lookup.c
+ after \$(srcdir)/cp/name-lookup.h.
+ * name-lookup.c: (cxx_binding_make): Use ggc_alloc_clearedinstead
+ of ggc_alloc. Include gt-cp-name-lookup.h at the end of the file.
+ * Make-lang.in: (gt-cp-name-lookup.h): Is generated by gengtype.
+ (cp/name-lookup.o): Depends on gt-cp-name-lookup.h.
+
+2003-03-31 Jason Merrill <jason@redhat.com>
+
+ PR java/10145
+ * class.c (check_field_decl): Don't set DECL_ALIGN.
+
+2003-03-30 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7647
+ * decl.c (grokdeclarator): Tidy, slightly.
+ * search.c (lookup_field_1): Add want_type parameter.
+ (lookup_field_r): Adjust call to lookup_field_1.
+
+2003-03-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * Make-lang.in (cp/name-lookup.o): Add more dependencies.
+
+2003-03-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-tree.h (binding_for_name: Move to name-lookup.h Adjust
+ prototype.
+ (cxx_scope_find_binding_for_name): Likewise.
+ * decl.c (find_binding: Move to name-lookup.c.
+ (binding_for_name): Likewise.
+ (cxx_scope_find_binding_for_name): Likewise.
+ (BINDING_LEVEL): Remove.
+ (push_binding): Tidy.
+ (push_class_binding): Likewise.
+ (pop_binding): Likewise.
+ (poplevel): Likewise.
+ (poplevel_class): Likewise.
+ (set_identifier_type_value_with_scope): Likewise.
+ (push_overloaded_decl): Likewise.
+ (lookup_tag): Likewise.
+ (unqualified_namespace_lookup): Likewise.
+ (lookup_name_current_level): Likewise.
+ (maybe_inject_for_scope_var): Likewise.
+ (namespace_binding): Move to name-lookup.c.
+ (set_namespace_binding): Likewise.
+ * decl2.c (lookup_using_namespace): Tidy.
+ (qualified_lookup_using_namespace): Likewise.
+ (do_toplevel_using_decl): Likewise.
+ * name-lookup.c: Include "timevar.h"
+ * name-lookup.h (cxx_scope): Declare.
+ (struct cxx_binding): Lose member "has_level". Adjust "scope"
+ member declaration.
+ (BINDING_SCOPE): Adjust definition.
+ (BINDING_HAS_LEVEL_P): Remove.
+
+2003-03-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * name-lookup.c: New file.
+ * name-lookup.h: Likewise..
+ * decl.c (push_binding): Adjust use cxx_binding_make.
+ (free_bindings): Move to name-lookup.c
+ (pop_binding): Use cxx_binding_free.
+ (binding_for_name): Tidy.
+ * cp-tree.h: Include "name-lookup.h"
+ (cxx_binding_make): Move to name-lookup.h
+ (cxx_binding_clear): Likewise.
+ (struct cxx_binding): Likewise.
+ (LOCAL_BINDING_P): Likewise.
+ (INHERITED_VALUE_BINDING_P): Likewise.
+ (BINDING_SCOPE): Likewise.
+ (BINDING_HAS_LEVEL_P): Likewise.
+ (BINDING_VALUE): Likewise.
+ (BINDING_TYPE): Likewise.
+ * config-lang.in (gtfiles): Add cp/name-lookup.h
+ * Make-lang.in (cp/name-lookup.o): New rule.
+ (CXX_OBJS): Add cp/name-lookup.o
+ (CXX_TREE_H): Add cp/name-lookup.h
+
+2003-03-28 Jason Merrill <jason@redhat.com>
+
+ PR c++/10245
+ * cvt.c (force_rvalue): New fn.
+ * call.c (build_conditional_expr): Use it.
+ * cp-tree.h: Declare it.
+
+2003-03-28 Mike Stump <mrs@apple.com>
+
+ * error.c (dump_expr): Add 0x to printed hex numbers to make
+ output match source code better.
+
+2003-03-28 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10218
+ * decl.c (grokfndecl): Return NULL_TREE for bogus out-of-class
+ definitions.
+
+ * decl2.c (generate_ctor_or_dtor_function): Tolerate a
+ non-existant ssdf_decls array.
+ (finish_file): Call generator_ctor_or_dtor_function when there are
+ static constructors or destructors and no other static
+ initializations.
+
+2003-03-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10047
+ * decl2.c (finish_file): Don't warn about explicitly instantiated
+ inline decls.
+
+2003-03-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10224
+ * pt.c (lookup_template_class): Only check instantiated args if
+ they do not contain template parameters.
+
+2003-03-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10158
+ * parser.c (cp_parser_function_definition): Set
+ DECL_INITIALIZED_IN_CLASS for members.
+ * pt.c (instantiate_decl): Only reduce the template args for
+ friends that are not defined in class.
+
+2003-03-25 Jason Merrill <jason@redhat.com>
+
+ * call.c (print_z_candidate): Change name of first arg to msgid.
+ (joust): Add comment for translators.
+
+2003-03-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9898, PR c++/383, DR 322
+ * pt.c (maybe_adjust_types_for_deduction) <DEDUCE_CONV>: Look
+ through reference types on both PARM and ARG.
+
+2003-03-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10119
+ * error.c (dump_expr) <BASELINK>: Use dump_expr.
+ * pt.c (maybe_fold_nontype_args): New function.
+ (tsubst_copy) <SCOPE_REF>: Subst any template_id args.
+ <TEMPLATE_ID_EXPR>: Break out folding code, call it.
+ (tsubst_copy_and_build) <TEMPLATE_ID_EXPR>: Call
+ maybe_fold_nontype_args.
+
+2003-03-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/10026
+ * decl2.c (arg_assoc_type) <ERROR_MARK>: Don't die.
+
+2003-03-23 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7086
+ * typeck.c (cxx_mark_addressable): Adjust call to
+ gen_mem_addressof or put_var_into_stack.
+
+2003-03-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9978, c++/9708
+ * cp-tree.h (instantiate_template): Add tsubst_flags parameter.
+ * call.c (add_template_candidate_real): Adjust
+ instantiate_template call.
+ * class.c (resolve_address_of_overloaded_function): Likewise.
+ * decl.c (build_enumerator): Set TREE_CONSTANT.
+ * pt.c (check_instantiated_args): New.
+ (push_inline_template_parms_recursive): Set TREE_CONSTANT,
+ TREE_READONLY.
+ (build_template_parm_index): Copy TREE_CONSTANT, TREE_READONLY.
+ (reduce_template_parm_level): Likewise.
+ (process_template_parm): Likewise.
+ (check_explicit_specialization): Adjust instantiate_template call.
+ (convert_template_argument): Don't check non-type argument here.
+ (lookup_template_class): Check them here.
+ (tsubst_friend_function): Adjust instantiate_template call.
+ (instantiate_template): Add tsubst_flags parameter, use it. Check
+ instantiated args.
+
+2003-03-21 Zack Weinberg <zack@codesourcery.com>
+
+ * decl.c: Update calls to shadow_warning.
+
+2003-03-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9898
+ * error.c (dump_decl) [CONST_DECL]: Print '<enumerator>'.
+ (dump_expr) [CONSTRUCTOR]: Print default ctor as a function call.
+
+2003-03-20 Mark Mitchell <mark@codesourcery.com>
+
+ * cp/decl2.c (arg_assoc_class): Correct check for namespace-scope
+ friends.
+ * cp/pt.c (instantiate_class_template): Fix formatting.
+
+2003-03-14 Matt Austern <austern@apple.com>
+
+ * cp-tree.h (unemitted_tinfo_decls): Declaration of a new varray.
+ (unemitted_tinfo_decl_p): Remove.
+ (emit_tinfo_decl): Change declaration to remove unused parameter.
+ * decl2.c (finish_file): Change tinfo emission to loop through
+ unemitted_tinfo_decls array instead of looping through all decls.
+ * rtti.c (unemitted_tinfo_decl_p): Declare as static, remove
+ unused second parameter.
+ (init_rtti_processing): initialize unemitted_tinfo_decls varray.
+ (get_tinfo_decls): push new tinfo decl on unemitted_tinfo_decls.
+ (emit_tinfo_decl): remove unused second parameter, add assertion
+ that decl hasn't already been emitted.
+
+2003-03-19 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * dump.c (cp_dump_tree), cp-tree.h (cp_dump_tree): Change return
+ type from 'int' to 'bool'. Replace 0 and 1 with true and false in
+ return statements.
+
+2003-03-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/8316, c++/9315, c++/10136
+ * call.c (print_z_candidate): Split out from...
+ (print_z_candidiates): ...here.
+ (joust): Use it.
+
+2003-03-17 Roger Sayle <roger@eyesopen.com>
+
+ PR c++/10031
+ * decl.c (duplicate_decls): Use the new type when prototyping
+ anticipated decls, even when the types match. This defines the
+ exception list for the built-in function.
+
+2003-03-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/10091
+ * typeck.c (build_class_member_access_expr): Compare
+ TYPE_MAIN_VARIANTs.
+
+2003-03-17 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9639
+ * parser.c (cp_parser_declarator_id): Clear parser->scope.
+
+2003-03-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/9993
+ * decl.c (finish_function): Only allow the NRVO to use variables
+ declared at function scope.
+
+2003-03-17 Andreas Jaeger <aj@suse.de>
+
+ * Make-lang.in (cp/TAGS): Remove.
+
+2003-03-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9629
+ * cp-tree.h (struct language_function): Add in_base_initializer.
+ (in_base_initializer): define it.
+ (expand_member_init): Remove INIT param.
+ * init.c (expand_member_init): Remove INIT param, return the member.
+ (emit_mem_initializers): Set in_base_initializer.
+ * class.c (build_base_path): Check in_base_initializer.
+ * parser.c (cp_parser_mem_initializer): Set in_base_initializer.
+ * pt.c (tsubst_initializer_list): Likewise.
+
+2003-03-16 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c (binding_for_name): Fix initialization thinko.
+
+2003-03-15 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ Compile-time improvement: 2/n.
+ * cp-tree.h (struct cxx_binding): New datatype;
+ (struct lang_identifier): Use it.
+ (LOCAL_BINDING_P): Adjust definition.
+ (INHERITED_VALUE_BINDING_P): Likewise.
+ (BINDING_SCOPE): Likewise.
+ (BINDING_HAS_LEVEL_P): Likewise.
+ (BINDING_VALUE): Likewise.
+ (BINDING_TYPE): Likewise.
+ (IDENTIFIER_VALUE): Likewise.
+ (struct tree_binding): Remove.
+ (TS_CP_BINDING): Likewise.
+ ((union lang_tree_node): Remove field "binding".
+ (cxx_binding_clear): New macro.
+ (binding_for_name): Adjust return type.
+ (qualified_lookup_using_namespace): Adjust prototype.
+ (lookup_using_namespace): Adjust prototype.
+ (cxx_scope_find_binding_for_name): Declare.
+ * cp-tree.def: Remove CPLUS_BINDING definition.
+ * decl.c (push_binding): Adjust local variable type.
+ (add_binding): Likewise.
+ (push_class_binding): Likewise.
+ (pop_binding): Likewise.
+ (poplevel): Likewise.
+ (poplevel_class): Likewise.
+ (free_bindings): Adjust type.
+ (find_binding): Adjust return type, add a third parameter. Remove
+ non-useful assertion now that we use static typing.
+ (cxx_scope_find_binding_for_name): New function.
+ (binding_for_name): Use it. Adjust local variable type. Simplify.
+ (namespace_binding): Simplify.
+ (set_namespace_binding): Likewise.
+ (set_identifier_type_value_with_scope): Adjust local variable type.
+ (lookup_tag): Don't type-abuse of local variable 'old'.
+ (lookup_namespace_name): Likewise. Allocate binding on stack.
+ (select_decl): Adjust prototype.
+ (unqualified_namespace_lookup): Allocate binding on stack.
+ Don't type-abuse of local variable 'val'.
+ (lookup_name_real): Likewise.
+ (maybe_inject_for_scope_var): Adjust local variable type.
+ (cp_tree_node_structure): Remove CPLUS_BINDING case label.
+ (namespace_binding): Adjust logic, simplify.
+ (BINDING_LEVEL): Adjust definition.
+ (push_class_level_binding): Adjust local variable type.
+ (struct cxx_saved_binding): Adjust field 'binding' type.
+ * decl2.c (ambiguous_decl): Adjust prototype.
+ (lookup_using_namespace): Adjust local variable type.
+ (qualified_lookup_using_namespace): Catch type error and correct
+ ensueing logic error.
+ (do_nonmember_using_decl): Adjust local variable type. Allocate
+ temporary cxx_binding on stack.
+ (do_toplevel_using_decl): Adjust local variable type.
+ * ptree.c (cxx_print_cxx_binding): New function.
+ (cxx_print_identifier): Use it.
+ (cxx_print_xnode): Delete CPLUS_BINDING case label.
+
+2003-03-15 Roger Sayle <roger@eyesopen.com>
+
+ * tree.c (count_functions): Fix whitespace.
+
+2003-03-15 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in: Update.
+
+2003-03-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/6440
+ * pt.c (maybe_process_partial_specialization): Handle
+ member class template when enclosing class template is
+ explicit specialized.
+ (most_general_template): Stop looking when DECL is already
+ specialized.
+
+2003-03-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/9420
+ * search.c (lookup_conversions): Call complete_type here.
+ * call.c (implicit_conversion): Not here.
+
+2003-03-13 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (do_nonmember_using_decl): Correct handling of
+ simultaneous type/non-type bindings.
+
+ * call.c (initialize_reference): Remove bogus assertion.
+ * decl.c (build_ptrmemfunc_type): Revert change of 2003-03-09.
+
+2003-03-12 Andrew Lewycky <andrew@mxc.ca>
+
+ PR c++/7050
+ * expr.c (cxx_expand_expr): Return const0_rtx for throw
+ expressions.
+
+2003-03-11 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9474
+ * decl2.c (do_nonmember_using_decl): Do not call duplicate decls
+ to merge old and new declarations.
+
+2003-03-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * g++.1: Remove.
+ * Make-lang.in (c++.generated-manpages): Build cp/g++.1.
+ (cp/g++.1): Build it from scratch in the build tree.
+ (c++.install-man): Depend on it. Install it from the build tree.
+ (c++.mostlyclean): Clean it.
+
+2003-03-11 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9474
+ * decl2.c (do_nonmember_using_decl): Do not call duplicate decls
+ to merge old and new declarations.
+
+ PR c++/9924
+ * decl2.c (do_nonmember_using_decl): Ignore anticipated builtins.
+
+2003-03-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/9820
+ * search.c (lookup_member): Fix handling of functions in a class
+ being defined.
+
+2003-03-11 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8700
+ * call.c (convert_class_to_reference): Adjust usage of
+ splice_viable.
+ (any_viable): Remove.
+ (splice_viable): Combine with any_viable.
+ (print_z_candidates): Avoid printing duplicates.
+ (build_user_type_conversion_1): Adjust usage of splice_viable.
+ (build_new_function_call): Likewise.
+ (build_operator_new_call): Likewise.
+ (build_object_call): Likewise.
+ (build_conditional_expr): Likewise.
+ (build_new_op): Likewise.
+ (build_new_method_call): Likewise.
+ (joust): Remove spurious comment.
+ * cp-tree.h (DECL_FRIENDLIST): Correct documentation.
+ * decl2.c (arg_assoc_class): Simplify.
+ * friend.c (add_friend): Likewise.
+
+2003-03-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/8660
+ * decl2.c (check_classfn): A member template only matches a
+ member template.
+
+2003-03-11 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in (CXX_C_OBJS): Update.
+ * lang-specs.h: Don't define __GNUG__ here.
+
+2003-03-10 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (perform_overload_resolution): New function.
+ (build_new_function_call): Use it.
+ (build_operator_new_call): Likewise.
+ (add_candidates): Add explicit_targs and template_only parameters.
+ (build_new_op): Adjust accordingly.
+ * cp-tree.h (build_operator_new_call): New function.
+ (build_function_call_real): Remove.
+ (build_function_call_maybe): Likewise.
+ * init.c (build_new_1): Use build_operator_new_call.
+ * typeck.c (build_function_call_real): Rename to ...
+ (build_function_call): ... this.
+
+2003-03-10 Devang Patel <dpatel@apple.com>
+
+ PR c++/9394
+ * g++spec.c (lang_specific_driver): Use DEFAULT_WORD_SWTCH_TAKES_ARG.
+
+2003-03-10 Jason Merrill <jason@redhat.com>
+
+ PR c++/9798
+ * decl.c (push_using_directive): Push before recursing.
+
+ PR c++/9868, c++/9524
+ * call.c (resolve_scoped_fn_name): Handle the case of a function
+ pointer member.
+
+ * decl2.c (build_offset_ref_call_from_tree): Only mess with 'this'
+ argument in the pointer-to-member case.
+
+2003-03-09 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9373
+ * cp-lang.c (cxx_get_alias_set): Use alias set zero for
+ pointers to member functions.
+
+ PR c++/8534
+ * decl.c (build_ptrmemfunc_type): Do not allow default arguments
+ in pointer-to-member-function types.
+
+2003-03-10 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * expr.c (cplus_expand_constant): Use C90 prototype style.
+ (cxx_expand_expr): Likewise.
+
+2003-03-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9970
+ * decl.c (duplicate_decls): Only copy DECL_THUNKS for virtual
+ functions.
+
+2003-03-08 Geoffrey Keating <geoffk@apple.com>
+
+ * lang-specs.h (c++-header): Change .pch to .gch.
+
+2003-03-08 Neil Booth <neil@daikokuya.co.uk>
+
+ * cp-tree.h (cxx_init): Update prototype.
+ * lex.c (cxx_init): Similarly.
+
+2003-03-08 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9823
+ * cp-tree.h (begin_mem_initializers): Remove.
+ * parser.c (cp_parser_mem_initializer_list): Inline it here.
+ Do not call finish_mem_initializers if not in a constructor.
+ (cp_parser_class_head): Fix typo in error message.
+ * semantics.c (begin_mem_initializers): Remove.
+ * testsuite/g++.dg/parser/constructor1.C: New test.
+
+ PR c++/9809
+ * call.c (add_function_candidate): Skip builtin fuctions that have
+ not yet been declared.
+
+ PR c++/9982
+ * init.c (build_new_1): Correct logic for determining whether or
+ not to use an array cookie.
+
+ PR c++/9524
+ * parser.c (cp_parser_postfix_expression): Call
+ finish_non_static_data_member, even when processing_template_decl.
+
+ PR c++/9912
+ * cp-tree.h (is_ancestor): New function.
+ (handle_class_head): Change prototype.
+ * decl2.c (is_namespace_ancestor): Rename to ...
+ (namespace_anecestor): ... this.
+ (set_decl_namespace): Adjust accordingly.
+ (handle_class_head): Remove unnecessary parameters.
+ * parser.c (cp_parser_class_head): Check that
+ nested-name-specifiers are used appropriately.
+
+2003-03-07 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (reference_binding): Remove REF_IS_VAR parameter.
+ (implicit_conversion): Adjust call to reference_binding.
+ (make_temporary_var_for_ref_to_type): Add TYPE parameter.
+ (initialize_reference): Adjust handling for references bound to
+ rvalues.
+ * cp-tree.h (make_temporary_var_for_ref_to_temp): Change
+ prototype.
+ (real_non_cast_lvalue_p): New method.
+ * cvt.c (build_up_reference): Adjust use of
+ make_temporary_var_for_ref_to_temp.
+ * tree.c (real_non_cast_lvalue_p): New method.
+
+2003-03-07 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * except.c (init_exception_processing): Use C90 prototype style.
+ (cp_protect_cleanup_actions): Likewise.
+ (prepare_eh_type): Likewise.
+ (build_eh_type_type): Likewise.
+ (build_exc_ptr): Likewise.
+ (do_begin_catch): Likewise.
+ (dtor_nothrow): Likewise.
+ (do_end_catch): Likewise.
+ (push_eh_cleanup): Likewise.
+ (decl_is_java_type): Likewise.
+ (choose_personality_routine): Likewise.
+ (initialize_handler_parm): Likewise.
+ (expand_start_catch_block): Likewise.
+ (expand_end_catch_block): Likewise.
+ (begin_eh_spec_block): Likewise.
+ (finish_eh_spec_block): Likewise.
+ (do_allocate_exception): Likewise.
+ (do_free_exception): Likewise.
+ (wrap_cleanups_r): Likewise.
+ (stabilize_throw_expr): Likewise.
+ (build_throw): Likewise.
+ (complete_ptr_ref_or_void_ptr_p): Likewise.
+ (is_admissible_throw_operand): Likewise.
+ (nothrow_libfn_p): Likewise.
+ (can_convert_eh): Likewise.
+ (check_handlers_1): Likewise.
+ (check_handlers): Likewise.
+
+2003-03-06 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (merge_conversion_sequences): New function.
+ (build_conv): Set ICS_USER_FLAG for USER_CONVs.
+ (convert_class_to_reference): Correct handling of second
+ standard conversion sequence in a user-defined conversion
+ sequence.
+ (build_user_type_conversion_1): Use merge_conversion_sequences.
+ * cp-tree.def: Add comments for CONV nodes.
+ * rtti.c (get_tinfo_decl): Use build_address/build_nop.
+
+2003-03-07 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * error.c (init_error): Use C90 prototype style.
+ (dump_scope): Likewise.
+ (dump_qualifiers): Likewise.
+ (dump_template_argument): Likewise.
+ (dump_template_argument_list): Likewise.
+ (dump_template_parameter): Likewise.
+ (dump_template_bindings): Likewise.
+ (dump_type): Likewise.
+ (dump_typename): Likewise.
+ (class_key_or_enum): Likewise.
+ (dump_aggr_type): Likewise.
+ (dump_type_prefix): Likewise.
+ (dump_type_suffix): Likewise.
+ (dump_global_iord): Likewise.
+ (dump_simple_decl): Likewise.
+ (dump_decl): Likewise.
+ (dump_template_decl): Likewise.
+ (dump_function_decl): Likewise.
+ (dump_parameters): Likewise.
+ (dump_exception_spec): Likewise.
+ (dump_function_name): Likewise.
+ (dump_template_parms): Likewise.
+ (dump_char): Likewise.
+ (dump_expr_list): Likewise.
+ (dump_expr): Likewise.
+ (dump_binary_op): Likewise.
+ (dump_unary_op): Likewise.
+ (type_as_string): Likewise.
+ (expr_as_string): Likewise.
+ (decl_as_string): Likewise.
+ (context_as_string): Likewise.
+ (lang_decl_name): Likewise.
+ (cp_file_of): Likewise.
+ (cp_line_of): Likewise.
+ (decl_to_string): Likewise.
+ (expr_to_string): Likewise.
+ (fndecl_to_string): Likewise.
+ (code_to_string): Likewise.
+ (language_to_string): Likewise.
+ (parm_to_string): Likewise.
+ (op_to_string): Likewise.
+ (type_to_string): Likewise.
+ (assop_to_string): Likewise.
+ (args_to_string): Likewise.
+ (cv_to_string): Likewise.
+ (cxx_print_error_function): Likewise.
+ (cp_diagnostic_starter): Likewise.
+ (cp_diagnostic_finalizer): Likewise.
+ (cp_print_error_function): Likewise.
+ (function_category): Likewise.
+ (print_instantiation_full_context): Likewise.
+ (print_instantiation_partial_context): Likewise.
+ (maybe_print_instantiation_context): Likewise.
+ (print_instantiation_context): Likewise.
+ (cp_printer): Likewise.
+ (print_integer): Likewise.
+ (print_non_consecutive_character): Likewise.
+ (locate_error): Likewise.
+
+2003-03-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9965
+ * call.c (reference_binding): Add ref_is_var parameter.
+ (implicit_conversion): Adjust call to reference_binding.
+ (initialize_reference): Likewise.
+
+ PR c++/9400
+ * decl.c (pushdecl): Don't check for shadowing of DECL_ARTIFICIAL
+ PARM_DECLs.
+
+ PR c++/9791
+ * class.c (get_basefndecls): Use lookup_fnfields_1.
+
+2003-03-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9188
+ * parser.c (cp_parser_type_parameter): Remove redundant `expect'
+ in error message.
+ (cp_parser_single_declaration): Likewise.
+
+2003-03-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/9440
+ * call.c (build_conditional_expr): Use convert rather than an
+ explicit NOP_EXPR.
+
+2003-03-02 Matt Austern <austern@apple.com>
+
+ * decl.c (cp_binding_level): Add static_decls varray member.
+ (add_decl_to_level): Add static/inline namespace scope
+ declarations to static_decls array.
+ (wrapup_global_for_namespace): Pass static_decls only, instead of
+ all decls, to wrapup_global_declarations/check_global_declarations.
+ (push_namespace): Initialize static_decls for ordinary namespaces.
+ (cxx_init_decl_processing): Initialize static_decls for global
+ namespace.
+
+2003-03-05 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (end_of_class): Correct thinko.
+
+2003-03-04 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * config-lang.in: Replace ${libstdcxx_version} by its value.
+
+2003-03-04 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-tree.h (cxx_saved_binding): Declare.
+ (struct saved_scope): Adjust type of field 'old_binding'.
+ * decl.c (cxx_saved_binding_make): New macro.
+ (struct cxx_saved_binding): Define.
+ (store_bindings): Adjust prototype. Use cxx_saved_binding to save
+ C++ bindings.
+ (maybe_push_to_top_level): Adjust local variable type.
+ (pop_from_top_level): Likewise.
+
+2003-03-04 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (c++.tags): New target.
+
+2003-03-04 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in: Update.
+
+2003-03-03 Jason Merrill <jason@redhat.com>
+
+ * decl.c (finish_enum): Do set the type in a template. Simplify.
+ * pt.c (tsubst_enum, tsubst_copy): Revert last patch.
+
+2003-03-03 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9878
+ * call.c (convert_class_to_reference): Correct conversion
+ sequences.
+ (reference_binding): Add ref_bound_directly_to_rvalue_p parameter.
+ (implicit_conversion): Adjust call to reference_binding.
+ (add_candidate): Change type of candidates parameter.
+ (add_function_candidate): Likewise.
+ (add_conv_candidate): Likewise.
+ (build_builtin_candidate): Likewise.
+ (add_builtin_candidate): Likewise.
+ (add_builtin_candidates): Likewise.
+ (add_template_candidate_real): Likewise.
+ (add_template_candidate): Likewise.
+ (add_template_conv_candidate): Likewise.
+ (build_user_type_conversion_1): Adjust accordingly.
+ (build_object_call): Likewise.
+ (build_conditional_expr): Likewise.
+ (add_candidates): Likewise.
+ (build_new_op): Likewise.
+ (convert_like_real): Use USER_CONV_CAND. Use build_nop.
+ (build_new_method_call): Adjust calls to add_function_candidate.
+ (make_temporary_var_for_ref_to_temp): New function.
+ (initialize_reference): Add decl parameter.
+ * class.c (build_rtti_vtbl_entries): Use build_address and
+ build_nop.
+ * cp-tree.h (initialize_reference): Change prototype.
+ (make_temporary_var_for_ref_to_temp): New function.
+ (build_type_conversion): Change prototype.
+ (build_address): New function.
+ (build_nop): Likewise.
+ * cvt.c (cp_convert_to_pointer): Adjust call to
+ build_type_conversion. Avoid indicating redundant NOP_EXPRs.
+ Use build_nop.
+ (convert_to_pointer_force): Use build_nop.
+ (build_up_reference): Use make_temporary_var_for_ref_to_temp.
+ (convert_to_reference): Adjust call to build_type_conversion.
+ (ocp_convert): Likewise.
+ (build_type_conversion): Remove for_sure parameter.
+ * decl.c (grok_reference_init): Use initialize_reference.
+ * typeck.c (build_address): New function.
+ (build_nop): Likewise.
+ (build_unary_op): Use them.
+ (build_ptrmemfunc): Tidy slightly.
+ (convert_for_initialization): Adjust call to
+ initialize_reference.
+ * typeck2.c (store_init_value): Remove #if 0'd code.
+
+2003-03-03 Jason Merrill <jason@redhat.com>
+
+ * decl.c (start_function): Clear DECL_NUM_STMTS.
+
+ * class.c (get_vtable_decl): Use vtbl_type_node.
+ (build_primary_vtable): Check for it.
+
+2003-03-02 Aldy Hernandez <aldyh@redhat.com>
+
+ * decl.c (check_initializer): Check for vector_opaque_p.
+
+2003-03-02 Ashif Harji <asharji@uwaterloo.ca>
+
+ * lang-specs.h (default_compilers): Add -no-integrated-cpp flag to
+ invoke an external cpp during compilation.
+
+2003-03-01 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c (duplicate_decls): Convert use of warning_with_decl() to
+ that of warning().
+ (start_decl): Likewise.
+ (start_function): Likewise.
+
+2003-03-01 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in (CXX_C_OBJS): Update.
+
+2003-02-28 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9892
+ * pt.c (instantiate_decl): Clear DECL_RTL for a VAR_DECL when
+ instantiating it.
+
+2003-02-28 Aldy Hernandez <aldyh@redhat.com>
+
+ * parser.c (cp_parser_init_declarator): Revert opaque
+ vector_opaque_p change.
+ Do not include target.h.
+
+2003-02-28 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9879
+ * cp-tree.h (build_zero_init): Add parameter.
+ * decl.c (cp_finish_decl): Adjust call.
+ * init.c (build_zero_init): Add nelts parameter. Adjust recursive
+ calls.
+ (build_default_init): Add nelts parameter. Adjust calls to
+ build_zero_init.
+ (build_new_1): Adjust call to build_default_init.
+ * typeck2.c (process_init_constructor): Adjust call to build_zero_init.
+
+2003-02-26 Devang Patel <dpatel@apple.com>
+
+ * decl.c (finish_enum): Merge two 'for' loops. Copy value node if
+ required. Postpone enum setting for template decls.
+ (build_enumerator): Delay copying value node until finish_enum
+ (). Remove #if 0'ed code.
+ * pt.c (tsubst_enum): Set TREE_TYPE and copy value node.
+ (tsubst_copy): Add check for enum type.
+
+2003-02-25 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9683
+ * decl2.c (prune_vars_needing_no_initialization): Do not throw
+ away initializations for DECL_EXTERNAL VAR_DECLs.
+ (finish_file): Adjust accordingly.
+ * pt.c (instantiate_decl): Do not defer VAR_DECLs.
+
+2003-02-24 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c (add_binding): Time TV_NAME_LOOKUP.
+ (push_class_binding): Likewise.
+ (set_namespace_binding): Likewise.
+
+2003-02-24 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9836
+ * cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE): Do not skip from
+ specializations back to the main template.
+ * parser.c (cp_parser_diagnose_invalid_type_name):Adjust use.
+ * pt.c (resolve_typename_type): Likewise.
+
+2003-02-24 Jeffrey D. Oldham <oldham@codesourcery.com>
+
+ PR c++/9778
+ * pt.c (tsubst_copy_and_build): For a templated function inside a
+ scope, process template arguments.
+
+2003-02-24 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9602
+ * typeck2.c (abstract_virtuals_error): Don't check when
+ TYPE is still template parameter dependent.
+
+2003-02-23 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/5333
+ * cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE): New macro.
+ * parser.c (cp_parser_diagnose_invalid_type_name): Use it.
+ * pt.c (instantiate_class_template): Don't try to instantiate
+ dependent types.
+ (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE.
+
+2003-02-21 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9749
+ * decl.c (grokdeclarator): Do not allow parameters with variably
+ modified types.
+
+2003-02-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ * search.c (grow_bfs_bases): Remove. Fold into ...
+ (bfs_walk): ... here, fix fencepost error. Fix merge lossage
+ in previous patch.
+
+2003-02-20 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9729
+ * mangle.c (mangle_conv_op_name_for_type): Issue an error message
+ when the G++ 3.2 ABI prevents correct compilation.
+
+2003-02-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ Change base class access representation. Share virtual base
+ binfos.
+ * cp/call.c (build_special_member_call): Remove binfo_for_vbase
+ call.
+ * cp/class.c (build_base_path): Likewise.
+ (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
+ (build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
+ (make_new_vtable): Adjust.
+ (force_canonical_binfo_r): Delete.
+ (force_canonical_binfo): Delete.
+ (mark_primary_virtual_base): Delete.
+ (dfs_unshared_virtual_bases): Delete.
+ (mark_primary_bases): Adjust.
+ (maybe_warn_about_overly_private_class): Adjust.
+ (dfs_base_derived_from): Delete.
+ (base_derived_from): Follow the inheritance chain.
+ (struct find_final_overrider_data): Add vpath member.
+ (dfs_find_final_overrider): Adjust.
+ (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
+ (find_final_overrider): Adjust.
+ (update_vtable_entry_for_fn): Adjust.
+ (modify_all_vtables): Adjust.
+ (walk_subobject_offsets): Adjust.
+ (layout_nonempty_base_or_field): Adjust.
+ (layout_empty_base): Remove last parameter. Adjust.
+ (build_base_field): Adjust.
+ (build_base_fields): Adjust.
+ (propagate_binfo_offsets): Remove last parameter. Adjust.
+ (dfs_set_offset_for_unshared_vbases): Delete.
+ (layout_virtual_bases): Adjust.
+ (finish_struct_1): Adjust.
+ (init_class_processing): Don't init access nodes.
+ (dfs_get_primary_binfo): Delete.
+ (get_primary_binfo): Adjust.
+ (dump_class_hierarchy_r): Remove most derived arg, add IGO
+ parameter. Adjust.
+ (dump_class_hierarchy): Adjust.
+ (finish_vtbls): Adjust.
+ (get_original_base): Delete.
+ (build_vtt_inits): Adjust.
+ (dfs_build_secondary_vptr_vtt_inits): Adjust.
+ (dfs_ctor_vtable_bases_queue_p): Adjust.
+ (build_ctor_vtbl_group): Adjust.
+ (dfs_accumulate_vtbl_inits): Adjust.
+ (build_vtbl_initializer): Adjust.
+ (build_vbase_offset_vtbl_entries): Adjust.
+ (add_vcall_offset_vtbl_entries_1): Adjust.
+ * cp/cp-tree.h (CPTI_ACCESS_*): Remove.
+ (access_*_node): Remove.
+ (CANONICAL_BINFO): Delete.
+ (BINFO_UNSHARED_MARKED): Remove.
+ (BINFO_MARKED): Set LANG_FLAG_0 directly.
+ (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
+ (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
+ (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
+ Delete.
+ (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
+ (SET_BINFO_NEW_VTABLE_MARKED): Adjust.
+ (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
+ Delete.
+ (BINFO_DEPENDENT_BASE_P): New.
+ (dfs_walk, dfs_walk_real): Queue function takes derived binfo and
+ index.
+ (markedp, unmarkedp): Adjust.
+ (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
+ dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
+ find_vbase_instance, binfo_for_vbase): Delete.
+ (copied_binfo, original_binfo): Declare.
+ (finish_base_specifier): Add virtual_p arg.
+ (unshare_base_binfos): Delete.
+ (copy_base_binfos): Declare.
+ (reverse_path): Delete.
+ * cp/decl.c (xref_basetypes): Access and virtuality passed
+ differently. Don't copy direct base binfos here. Call
+ copy_base_binfos.
+ * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
+ (initialize_vtbl_ptrs): Adjust.
+ (expand_member_init): Adjust.
+ * cp/parser.c (cp_parser_base_specifier): Adjust.
+ * cp/pt.c (instantiate_class_template): Adjust.
+ (get_template_base_recursive): Adjust.
+ * cp/rtti.c (get_pseudo_ti_init): Adjust.
+ (get_pseudo_ti_desc): Adjust.
+ * cp/tree.c (unshare_base_binfos): Rename to ...
+ (copy_base_binfos): ... here, reimplement.
+ (make_binfo): Set BINFO_DEPENDENT_BASE_P.
+ (reverse_path): Remove.
+ * cp/typeck.c (get_delta_difference): Adjust error messages.
+ * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
+ * cp/search.c (lookup_base_r): Adjust.
+ (dynamic_cast_base_recurse): Adjust.
+ (canonical_binfo): Remove.
+ (dfs_canonical_queue): Remove.
+ (dfs_assert_unmarked_p): Remove.
+ (assert_canonical_unmarked): Remove.
+ (shared_marked_p, shared_unmarked_p): Remove.
+ (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
+ (dfs_access_in_type): Adjust.
+ (access_in_type): Adjust.
+ (dfs_accessible_queue_p): Adjust.
+ (dfs_accessible_p): Adjust.
+ (is_subobject_of_p_1, is_subobject_of_p): Remove.
+ (struct lookup_field_info): Remove from_dep_base_p field.
+ (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
+ (lookup_field_r): Remove dependent base code.
+ (lookup_member): Likewise.
+ (dfs_walk, dfs_walk_real): Add access arg to queue fn.
+ (dfs_unmarked_real_bases_queue_p): Remove.
+ (dfs_marked_real_bases_queue_p): Remove.
+ (dfs_skip_vbases): Remove.
+ (dfs_get_pure_virtuals): Adjust.
+ (markedp, unmarkedp): Adjust.
+ (marked_vtable_pathp, unmarked_vtable_pathp): Remove.
+ (marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
+ (dfs_unmark): Adjust.
+ (dfs_get_vbase_types):Remove.
+ (dfs_build_inheritance_graph_order): Remove.
+ (get_vbase_types): Remove
+ (dfs_find_vbase_instance): Remove.
+ (find_vbase_instance): Remove.
+ (dfs_debug_unmarkedp): Adjust.
+ (dependent_base_p): Remove.
+ (dfs_push_type_decls): Adjust.
+ (dfs_push_decls): Adjust.
+ (dfs_no_overlap_yet): Adjust.
+ (copied_binfo): New function.
+ (original_binfo): New function.
+ (binfo_for_vbase): Remove.
+
+2003-02-18 Zack Weinberg <zack@codesourcery.com>
+
+ * cp/search.c (grow_bfs_bases): New subroutine of bfs_walk.
+ (bfs_walk): Rewritten using circular queue of BINFO_BASETYPES
+ vectors, for speed.
+
+2003-02-18 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9704
+ * class.c (layout_class_type): In the 3.2 ABI, take into account
+ trailing bit fields when computing CLASSTYPE_SIZE_UNIT.
+
+2003-02-18 Matt Austern <austern@apple.com>
+
+ * cp/cp-lang.c: Change lang hooks so that final_write_globals does
+ nothing for C++.
+ * cp/decl.c (wrapup_globals_for_namespace): Remove special
+ handling of global namespace.
+
+2003-02-18 Geoffrey Keating <geoffk@apple.com>
+
+ * cp-tree.h (rid_to_yy): Delete.
+ (C_RID_YYCODE): Delete.
+ (finish_file): Delete redundant declaration.
+
+2003-02-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/9623
+ * decl.c (reshape_init): Don't mess with initializer labels.
+
+ PR c++/9485
+ * parser.c (cp_parser_postfix_expression): Set idk properly for
+ object->scope::member.
+
+2003-02-18 Ben Elliston <bje@redhat.com>
+
+ PR other/7350
+ * decl.c (duplicate_decls): Fix typo in comment.
+
+2003-02-17 Michael Elizabeth Chastain <mec@shout.net>
+
+ PR debug/9717
+ * class.c (build_base_field): Mark fields for base classes with
+ DECL_IGNORED_P.
+
+2003-02-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9457
+ * pt.c (tsubst_copy_and_build) [CONSTRUCTOR]: Substitute
+ CONSTRUCTOR_ELTS only once.
+
+2003-02-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9459
+ * error.c (dump_type_prefix): Handle TYPEOF_TYPE.
+ (dump_type_suffix): Likewise.
+
+2003-02-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ * search.c: ANSIfy function declarations and definitions.
+ * cp-tree.h (lookup_field, lookup_member): Last parameter is a bool.
+ * call.c (build_method_call, resolve_scoped_fn_name,
+ build_java_interface_fn_ref): Adjust lookup_field, lookup_member
+ calls.
+ * class.c (handle_using_decl): Likewise.
+ * decl.c (make_typename_type, make_unmound_class_template,
+ start_decl, compute_array_index_type): Likewise.
+ * decl2.c (build_expr_from_tree, build_call_from_tree): Likewise.
+ * init.c (expand_member_init, build_member_call): Likewise.
+ * pt.c (tsubst_copy, tsubst_copy_and_build, do_decl_instantiation,
+ resolve_typename_type): Likewise.
+ * typeck.c (lookup_destructor, finish_class_member_access_exprm
+ build_prememfunc_access_expr): Likewise.
+
+2003-02-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl2.c: Include "timevar.h".
+ (namespace_ancestor): Time name lookup.
+ (add_using_namespace): Likewise.
+ (lookup_using_namespace): Likewise.
+ (qualified_lookup_using_namespace): Likewise.
+ (decl_namespace): Likewise.
+ (lookup_arg_dependent): Likewise.
+ * lex.c (do_identifier): Likewise.
+ (do_scoped_id): Likewise.
+ * pt.c (lookup_template_class): Likewise.
+
+2003-02-14 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * decl.c: (define_label): Fix warning for return 0 instead of NULL.
+
+2003-02-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl.c: Include "timevar.h".
+ (poplevel): Time name lookup.
+ (find_binding): Likewise.
+ (push_namespace): Likewise.
+ (pop_nested_namespace): Likewise.
+ (store_bindings): Likewise.
+ (maybe_push_to_top_level): Likewise.
+ (pop_from_top_level): Likewise.
+ (push_local_name): Likewise.
+ (pushtag): Likewise.
+ (pushdecl): Likewise.
+ (pushdecl_with_scope): Likewise.
+ (pushdecl_namespace_level): Likewise.
+ (pushdecl_top_level): Likewise.
+ (pushdecl_class_level): Likewise.
+ (push_class_level_binding): Likewise.
+ (push_using_decl): Likewise.
+ (push_using_directive): Likewise.
+ (push_overloaded_decl): Likewise.
+ (lookup_label): Likewise.
+ (define_label): Likewise.
+ (lookup_tag): Likewise.
+ (lookup_tag_reverse): Likewise.
+ (lookup_namespace_name): Likewise.
+ (select_decl): Likewise.
+ (unqualified_namespace_lookup): Likewise.
+ (lookup_name_real): Likewise.
+ (lookup_name_current_level): Likewise.
+ (lookup_type_current_level): Likewise.
+ (maybe_inject_for_scope_var): Likewise.
+ (xref_tag): Likewise.
+
+ * Make-lang.in (cp/decl.o): Add dependency on timevar.h
+
+2003-02-12 Phil Edwards <pme@gcc.gnu.org>
+
+ * decl.c (build_enumerator): Remove unneeded test.
+
+2003-02-09 Dan Nicolaescu <dann@ics.uci.edu>
+
+ * cp-tree.h (struct lang_type_header): Make all fields unsigned
+ char.
+
+2003-02-03 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7129
+ * call.c (z_candidate): Add args.
+ (convert_class_to_reference): Set it.
+ (implicit_conversion): Tidy.
+ (add_candidate): Add args parameter.
+ (add_function_candidate): Adjust call to add_candidate.
+ (add_conv_candidate): Likewise.
+ (build_builtin_candidate): Likewise.
+ (build_user_type_conversion_1): Eliminate wasteful tree_cons
+ usage.
+ (build_new_function_call): Likewise.
+ (build_object_call): Likewise.
+ (add_candidates): New function.
+ (build_new_op): Use it.
+ (covert_like_real): Adjust call to build_over_call.
+ (build_over_call): Remove args parameter.
+ * operators.def: Add <?= and >?=.
+
+2003-02-01 Richard Sandiford <rsandifo@redhat.com>
+
+ * typeck.c (build_indirect_ref): Don't check flag_volatile.
+
+2003-01-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/8849
+ * pt.c (resolve_overloaded_unification): Handle FUNCTION_DECL.
+
+2003-01-31 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX,
+ BINFO_PRIMARY_BASE_OF): Use BINFO_ELTS.
+ (BINFO_LANG_ELTS): New #define.
+ * tree.c (make_binfo): Use BINFO_LANG_ELTS.
+
+2003-01-30 Geoffrey Keating <geoffk@apple.com>
+
+ * cp/Make-lang.in: Remove -Wno-error from cp/decl.o.
+
+2003-01-30 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (check_field_decls): Only check C_TYPE_FIELDS_READONLY
+ for class types.
+ * cp-tree.h (C_TYPE_FIELDS_READONLY): Use a lang-specific bit
+ rather than TYPE_LANG_FLAG_0.
+ (TYPE_BUILT_IN): Remove.
+ (TYPE_DEPENDENT_P): New macro.
+ (TYPE_DEPENDENT_P_VALID): Likewise.
+ (lang_type_class): Add fields_readonly.
+ * decl.c (record_builtin_type): Don't set TYPE_BUILT_IN.
+ * pt.c (dependent_type_p_r): New function, split out from ...
+ (dependent_type_p): ... here. Memoize results.
+ * search.c (dependent_base_p): Use dependent_type_p, not
+ uses_template_parms.
+ * typeck.c (build_modify_expr): Only check C_TYPE_FIELDS_READONLY
+ for class types.
+
+2003-01-29 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_field_call): Use build_new_op, not build_opfncall.
+ (prep_operand): New function.
+ (build_new_op): Use it. Remove dead code.
+ * class.c (pushclass): Change "modify" parameter type from int to
+ bool.
+ (currently_open_class): Use same_type_p, not pointer equality.
+ (push_nested_class): Adjust calls to pushclass, remove modify
+ parameter.
+ * cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro.
+ (pushclass): Change prototype.
+ (push_nested_class): Likewise.
+ (grokoptypename): Remove.
+ (build_opfncall): Remove.
+ (value_dependent_expression_p): Declare.
+ (resolve_typename_type): Likewise.
+ (resolve_typename_type_in_current_instantiation): Likewise.
+ (enter_scope_of): Remove.
+ (tsubst): Remove.
+ (tsubst_expr): Likewise.
+ (tsubst_copy): Likewise.
+ (tsubst_copy_and_build): Likewise.
+ * decl.c (warn_about_implicit_typename_lookup): Remove.
+ (finish_case_label): Return error_mark_node for erroneous labels.
+ (start_decl): Adjust calls to push_nested_class.
+ (grokfndecl): Call push_scope/pop_scope around call to
+ duplicate_decls.
+ (grokdeclarator): Do not call tsubst.
+ (start_function): Adjust calls to push_nested_class.
+ * decl2.c (grok_array_decl): Use build_new_op, not build_opfncall.
+ (check_classfn): Use push_scope/pop_scope around type comparisions.
+ (grokoptypename): Remove.
+ (push_sscope): Adjust call to push_nested_class.
+ * error.c (dump_type): Show cv-qualification of typename types.
+ * init.c (build_member_call): Use build_new_op, not
+ build_opfncall.
+ * method.c (build_opfncall): Remove.
+ * parser.c (cp_parser): Add allow_non_constant_expression_p and
+ non_constant_expression_p.
+ (cp_parser_constant_expression): Adjust prototype.
+ (cp_parser_resolve_typename_type): Remove.
+ (cp_parser_non_constant_expression): New function.
+ (cp_parser_non_constant_id_expression): Likewise.
+ (cp_parser_new): Set allow_non_constant_expression_p and
+ non_constant_expression_p.
+ (cp_parser_primary_expression): Reject `this' and `va_arg' in
+ constant-expressions. Note that dependent names aren't really
+ constant.
+ (cp_parser_postfix_expression): Reject conversions to non-integral
+ types in constant-expressions. Neither are increments or
+ decrements.
+ (cp_parser_unary_expression): Reject increments and decrements in
+ constant-expressions.
+ (cp_parser_direct_new_declarator): Adjust call to
+ cp_parser_constant_expression.
+ (cp_parser_cast_expression): Reject conversions to non-integral
+ types in constant-expressions.
+ (cp_parser_assignment_expression): Rejects assignments in
+ constant-expressions.
+ (cp_parser_expression): Reject commas in constant-expressions.
+ (cp_parser_labeled_statement): Adjust call to
+ cp_parser_constant_expression.
+ (cp_parser_direct_declarator): Simplify array bounds, even in
+ templates, when they are non-dependent. Use
+ resolve_typename_type, not cp_parser_resolve_typename_type.
+ (cp_parser_class_head): Use resolve_typename_type, not
+ cp_parser_resolve_typename_type.
+ (cp_parser_member_declaration): Adjust call to
+ cp_parser_constant_expression.
+ (cp_parser_constant_initializer): Likewise.
+ (cp_parser_constructor_declarator): Use resolve_typename_type, not
+ cp_parser_resolve_typename_type.
+ (cp_parser_late_parsing_default_args): Adjust call to
+ push_nested_class.
+ * pt.c (tsubst): Give it internal linkage.
+ (tsubst_expr): Likewise.
+ (tsubst_copy): Likewise.
+ (tsubst_copy_and_build): Likewise.
+ (push_access_scope_real): Likewise.
+ (tsubst_friend_class): Likewise.
+ (instantiate_class_template): Adjust call to pushclass.
+ (value_dependent_expression_p): Give it external linkage.
+ Robustify.
+ (resolve_typename_type): New function.
+ * semantics.c (finish_call_expr): Use build_new_op, not
+ build_opfncall.
+ (begin_constructor_declarator): Remove.
+ (begin_class_definition): Adjust call to pushclass.
+ (enter_scope_of): Remove.
+ * typeck.c (comptypes): Resolve typename types as appropriate.
+ (build_x_indirect_ref): Use build_new_op, not build_opfncall.
+ (build_x_compound_expr): Likewise.
+ (build_modify_expr): Likewise.
+ (build_x_modify_expr): Likewise.
+ * typeck2.c (build_x_arrow): Likewise.
+
+2003-01-29 Fariborz Jahanian <fjahanian@apple.com>
+
+ * pt.c (last_pending_template) Declare GTY().
+
+2003-01-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/8591
+ * parser.c (cp_parser_elaborated_type_specifier): Convert
+ TEMPLATE_DECL to TYPE_DECL only when processing template friends.
+ (cp_parser_maybe_treat_template_as_class): Remove redundant tests.
+
+2003-01-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9437
+ * pt.c (unify): Don't unify '*T' with 'U C::*'.
+
+ PR c++/3902
+ * parser.c (cp_parser_decl_specifier_seq): Cannot have constructor
+ inside a declarator.
+
+2003-01-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (update_vtable_entry_for_fn): Add index parameter.
+ Generate vcall thunk for covariant overriding from a virtual
+ primary base.
+ (dfs_modify_vtables): Adjust.
+
+2003-01-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9403
+ * parser.c (cp_parser_class_or_namespace_name): Reject duplicate
+ template keyword.
+ (cp_parser_base_specifier): Look for and consume a
+ TEMPLATE keyword. Replace switch with array index.
+
+ PR c++/795
+ * semantics.c (finish_non_static_data_member): Remember the
+ field's type even in a template.
+
+ PR c++/9415
+ * pt.c (tsubst_copy_and_build, CALL_EXPR): BASELINK exprs are
+ already scoped.
+
+ PR c++/8545
+ * parser.c (cp_parser_cast_expression): Be more tentative.
+
+2003-01-25 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * cp-tree.h (flagged_type_tree_s): Remove.
+ (check_for_new_type): Likewise.
+ * typeck2.c (check_for_new_type): Likewise.
+
+2003-01-23 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * dump.c: ANSIfy function declarations and definitions.
+
+ * cp-tree.h, decl.h: Get rid of PARAMS. Again.
+
+2003-01-22 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9354
+ * init.c (build_new): Set the type of the new-expression, even
+ when processing_templte_decl.
+
+ PR c++/9216
+ * parser.c (cp_parser_primary_expression): Improve error message
+ for templates used in an expression context.
+
+ PR c++/8696
+ * parser.c (cp_parser_decl_specifier_seq): Commit to tentative
+ parse when encountering "typedef".
+
+2003-01-22 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * class.c, parser.c: ANSIfy function definitions and declarations.
+
+2003-01-22 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9328
+ * error.c (dump_decl): For an OVERLOAD, just print the name of the
+ function; it doesn't make sense to try to print its type.
+ * semantics.c (finish_typeof): Issue errors about invalid uses.
+
+ PR c++/9298
+ * parser.c (cp_parser_consume_semicolon_at_end_of_statement): New
+ function.
+ (cp_parser_expression_statement): Use it.
+ (cp_parser_explicit_instantiation): Likewise.
+ * pt.c (do_decl_instantiation): Improve error handling logic.
+
+2003-01-22 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9384
+ * parser.c (cp_parser_using_declaration): Issue error messages
+ about name resolution failures here.
+
+ PR c++/9388
+ * class.c (currently_open_derived_class): Use dependent_type_p.
+ * cp-tree.h (dependent_type_p): New function.
+ (dependent_template_arg_p): Likewise.
+ (dependent_template_p): Likewise.
+ (type_dependent_expression_p): Likewise.
+ * parser.c (cp_parser_dependent_type_p): Remove.
+ (cp_parser_value_dependent_type_p): Likewise.
+ (cp_parser_type_dependent_expression_p): Likewise.
+ (cp_parser_dependent_template_arg_p): Likewise.
+ (cp_parser_dependent_template_id_p): Likewise.
+ (cp_parser_dependent_template_p): Likewise.
+ (cp_parser_diagnose_invalid_type_name): Replace
+ cp_parser_dependent_type_p with dependent_type_p, etc.
+ (cp_parser_primary_expresion): Likewise.
+ (cp_parser_nested_name_specifier_opt): Likewise.
+ (cp_parser_postfix_expression): Likewise.
+ (cp_parser_unary_expression): Likewise.
+ (cp_parser_template_name): Likewise.
+ (cp_parser_class_name): Likewise.
+ (cp_parser_lookup_name): Likewise.
+ * pt.c (dependent_type_p): New function.
+ (value_dependent_expression_p): Likewise.
+ (type_dependent_expression_p): Likewise.
+ (dependent_template_arg_p): Likewise.
+ (dependent_template_id_p): Likewise.
+ (dependent_template_p): Likewise.
+
+ PR c++/9285
+ PR c++/9294
+ * parser.c (cp_parser_simple_declaration): Return quickly when
+ encountering errors.
+
+2003-01-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ Make-lang.in (cp/decl.o-warn): Add -Wno-error.
+
+2003-01-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/9167, c++/9358
+ * decl.c (require_complete_types_for_parms): Also update DECL_ARG_TYPE.
+
+2003-01-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/9342
+ * call.c (build_conditional_expr): Always do lvalue-rvalue
+ conversion.
+
+2003-01-17 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9294
+ * cp-tree.def (BASELINK): Make it class 'x', not class 'e'.
+ * cp-tree.h (BASELINK_BINFO): Adjust.
+ (BASELINK_FUNCTIONS): Likewise.
+ (BASELINK_ACCESS_BINFO): Likewise.
+ (tree_baselink): New structure.
+ (cp_tree_node_structure_enum): Add TS_CP_BASELINK.
+ (lang_tree_node): Add baselink.
+ * decl.c (cp_tree_node_structure): Add BASELINK case.
+ * search.c (build_baselink): Adjust.
+ * tree.c (cp_walk_subtrees): Add BASELINK case. Remove BASELINK_P
+ test from TREE_LIST case.
+
+ PR c++/9272
+ * parser.c (cp_parser_constructor_declarator_p): Do not assume
+ that a constructor cannot be declared outside of its own class.
+
+ * parser.c (cp_parser_resolve_typename_type): If the scope cannot
+ be resolved, neither can the qualified name.
+
+ * rtti.c (get_pseudo_ti_desc): Fix thinko.
+
+2003-01-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/8564
+ * init.c (build_vec_init): Re-add maxindex parm.
+ (perform_member_init, build_aggr_init): Pass it.
+ (build_new_1): Pass it. Use an incomplete array type for full_type.
+ * typeck.c (build_modify_expr): Pass it.
+ * cp-tree.h: Adjust.
+
+2003-01-16 Jeffrey D. Oldham <oldham@codesourcery.com>
+
+ * cp-tree.h (tsubst_copy_and_build): New declaration.
+ * pt.c (tsubst_copy): Remove 'build_expr_from_tree' from comment.
+ (tsubst_expr): Use 'tsubst_copy_and_build'. Update initial comment.
+ (tsubst_copy_and_build): New function.
+
+2003-01-16 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_type_class): Remove is_partial_instantiation.
+ (PARTIAL_INSTANTIATION_P): Remove.
+ (IMPLICIT_TYPENAME_P): Likewise.
+ (IMPLICIT_TYPENAME_TYPE_DECL_P): Likewise.
+ (build_typename_type): Remove declaration.
+ (parmlist_is_exprlist): Likewise.
+ * decl.c (build_typename_type): Make it static, remove third
+ parameter.
+ (push_class_binding): Don't do implicit typename stuff.
+ (make_typename_type): Likewise.
+ (lookup_name_real): Likewise.
+ (grokdeclarator): Don't try to convert declarations into
+ initializations. Don't do implicit typename stuff.
+ (parmlist_is_exprlist): Remove.
+ (xref_basetypes): Simplify.
+ * decl2.c (grokfield): Don't try to convert declarations into
+ initializations.
+ (build_anon_union_vars): Do this while processing templates, too.
+ (finish_anon_union): Likewise.
+ * error.c (dump_type): Remove implicit typename handling.
+ * parser.c (cp_parser_diagnose_invalid_type_name): New method.
+ (cp_parser_primary_expression): Correct handling of names not
+ found by unqualified name lookup in templates.
+ (cp_parser_nested_name_specifier_opt): Avoid checking dependency
+ of types when possible.
+ (cp_parser_simple_declaration): Complain intelligently about some
+ invalid declarations.
+ (cp_parser_member_declaration): Likewise.
+ (cp_parser_constructor_declarator_p): Don't check when we're in a
+ function scope.
+ * pt.c (instantiate_class_template): Remove
+ PARTIAL_INSTANTIATION_P gunk.
+ * search.c (lookup_field_r): Don't build implicit typenames.
+ (marked_pushdecls_p): Don't enter dependent base types.
+ (unmarked_pushdecls_p): Likewise.
+ * semantics.c (begin_class_definition): Remove implicit typename
+ stuff.
+
+2003-01-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9212
+ * parser.c (cp_parser_direct_declarator): If accepting either
+ abstract or named, the name must be an unqualified-id.
+
+2003-01-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (layout_virtual_bases): Avoid signed/unsigned warning.
+
+2003-01-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl2.c (check_classfn): Fix uninitialized warning.
+ (build_anon_union_vars): Likewise.
+ * pt.c (tsubst_copy): Likewise.
+
+2003-01-14 Jeffrey D. Oldham <oldham@codesourcery.com>
+
+ Further conform g++'s __vmi_class_type_info to the C++ ABI
+ specification.
+ * rtti.c (dfs_class_hint_mark): Do not set hints not specified by
+ the specification.
+ (class_hint_flags): Likewise.
+
+2003-01-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * config-lang.in: Add semantics.c to gtfiles.
+ * cp-tree.h (flagged_type_tree_s): Remove lookups field.
+ (saved_scope): Likewise.
+ (type_lookups): Remove.
+ (deferred_access): New structure.
+ (type_access_control): Remove.
+ (save_type_access_control): Likewise.
+ (reset_type_access_control): Likewise.
+ (decl_type_access_control): Likewise.
+ (push_deferring_access_checks): Declare.
+ (resume_deferring_access_checks): Likewise.
+ (stop_deferring_access_checks): Likewise.
+ (pop_deferring_access_checks): Likewise.
+ (get_deferred_access_checks): Likewise.
+ (pop_to_parent_deferring_access_checks): Likewise.
+ (perform_deferred_access_checks): Likewise.
+ (perform_or_defer_access_check): Likewise.
+ * decl.c (make_typename_type): Use perform_or_defer_access_check.
+ (make_unbound_class_template): Likewise.
+ (grokdeclarator): Don't call decl_type_access_control.
+ * parser.c (cp_parser_context): Remove deferred_access_checks
+ and deferring_access_checks_p fields.
+ (cp_parser_context_new): Adjust.
+ (cp_parser): Remove access_checks_lists.
+ (cp_parser_defer_access_check): Remove.
+ (cp_parser_start_deferring_access_checks): Remove.
+ (cp_parser_stop_deferring_access_checks): Remove.
+ (cp_parser_perform_deferred_access_checks): Remove.
+ (cp_parser_nested_name_specifier_opt): Use new deferred access
+ functions.
+ (cp_parser_simple_declaration): Likewise.
+ (cp_parser_template_id): Likewise.
+ (cp_parser_function_definition): Likewise.
+ (cp_parser_class_specifier): Likewise.
+ (cp_parser_lookup_name): Likewise.
+ (cp_parser_single_declaration): Likewise.
+ (cp_parser_pre_parsed_nested_name_specifier): Likewise.
+ (cp_parser_parse_tentatively): Likewise.
+ (cp_parser_parse_definitely): Likewise.
+ (yyparse): Likewise.
+ (cp_parser_init_declarator): Remove access_checks parameter.
+ Use new deferred access functions.
+ (cp_parser_function_definition_from_specifiers_and_declarator):
+ Likewise.
+ (cp_parser_class_head): Remove deferring_access_checks_p and
+ saved_access_checks parameters. Use new deferred access functions.
+ (cp_parser_member_specification_opt): Don't call
+ reset_type_access_control.
+ * search.c (type_access_control): Remove.
+ * semantics.c: Include "gt-cp-semantics.h".
+ (deferred_type_access_control): Remove.
+ (deferred_access_stack): New variable.
+ (deferred_access_free_list): Likewise.
+ (push_deferring_access_checks): New function.
+ (resume_deferring_access_checks): Likewise.
+ (stop_deferring_access_checks): Likewise.
+ (pop_deferring_access_checks): Likewise.
+ (get_deferred_access_checks): Likewise.
+ (pop_to_parent_deferring_access_checks): Likewise.
+ (perform_deferred_access_checks): New function, adapted from
+ cp_parser_perform_deferred_access_checks.
+ (perform_or_defer_access_check): New function, adapted from
+ cp_parser_defer_access_check.
+ (current_type_lookups): Remove.
+ (deferred_type_access_control): Likewise.
+ (decl_type_access_control): Likewise.
+ (save_type_access_control): Likewise.
+ (reset_type_access_control): Likewise.
+ (begin_function_definition): Adjust.
+ (begin_class_definiton): Likewise.
+
+2003-01-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/8748
+ * class.c (build_base_path): Take the address before calling save_expr.
+
+ * call.c (build_user_type_conversion_1): Do set ICS_BAD_FLAG if
+ all the ambiguous conversions are bad.
+
+ * class.c (maybe_warn_about_overly_private_class): Don't stop
+ searching when we find a nonprivate method.
+
+ * typeck.c (build_class_member_access_expr): Use unary_complex_lvalue.
+
+2003-01-12 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (get_arglist_len_in_bytes): Remove.
+
+ PR c++/9264
+ * parser.c (cp_parser_elaborated_type_specifier): Handle erroneous
+ typeame types more robustly.
+
+2003-01-11 Phil Edwards <pme@gcc.gnu.org>
+
+ * parser.c: Fix comment typos.
+
+2003-01-10 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9099
+ * parser.c (cp_parser_scope_through_which_access_occurs): Handle
+ an object_type which is not a class type.
+
+2003-01-10 Geoffrey Keating <geoffk@apple.com>
+
+ * parser.c (cp_parser_late_parsing_for_member): Don't cast to void.
+ (cp_parser_late_parsing_default_args): Likewise.
+
+2003-01-10 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * cfns.gperf: ANSIfy function declarations.
+ * cfns.h: Regenerate.
+ * cp-tree.h: ANSIfy function declarations.
+
+2003-01-10 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (reparse_absdcl_as_expr): Remove.
+ (reparse_absdcl_as_casts): Likewise.
+ (reparse_decl_as_expr): Likewise.
+ (finish_decl_parsing): Likewise.
+ * decl2.c (reparse_absdcl_as_expr): Remove.
+ (reparse_absdcl_as_casts): Likewise.
+ (repase_decl_as_expr): Likewise.
+ (finish_decl_parsing): Likewise.
+
+ PR c++/9128
+ PR c++/9153
+ PR c++/9171
+ * parser.c (cp_parser_pre_parsed_nested_name_specifier): New
+ function.
+ (cp_parser_nested_name_specifier_opt): Correct the
+ check_dependency_p false.
+ (cp_parser_postfix_expression): Fix formatting.
+ (cp_parser_decl_specifier_seq): Avoid looking for constructor
+ declarators when possible.
+ (cp_parser_template_id): Avoid performing name-lookup when
+ possible.
+ (cp_parser_class_head): Do not count specializations when counting
+ levels of templates.
+ (cp_parser_constructor_declarator_p): Return immediately if
+ there's no chance that the tokens form a constructor declarator.
+ * rtti.c (throw_bad_typeid): Add comment. Do not return an
+ expression with reference type.
+ (get_tinfo_decl_dynamic): Do not return an expression with
+ reference type.
+ (build_typeid): Add comment. Do not return an expression with
+ reference type.
+ * typeck.c (build_class_member_access_expr): Improve handling of
+ conditionals and comma-expressions as objects.
+
+2003-01-09 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * cfns.gperf: ANSIfy function declarations.
+ * cfns.h: Regenerate.
+ * cp-tree.h: ANSIfy function declarations.
+ * parser.c: ANSIfy function declarations & definitions.
+
+ * decl.c (bad_specifiers): Fix parameter order error I introduced.
+
+2003-01-09 Geoffrey Keating <geoffk@apple.com>
+
+ Merge from pch-branch:
+
+ 2003-01-09 Geoffrey Keating <geoffk@apple.com>
+
+ Merge to tag pch-merge-20030102:
+
+ * semantics.c (finish_translation_unit): Don't call finish_file.
+ * parser.c: Don't include ggc.h.
+ (cp_lexer_new_main): Rename from cp_lexer_new, only create main lexer,
+ read first token here. Don't allow PCH files after the first
+ token is read.
+ (cp_lexer_new_from_tokens): Duplicate functionality from cp_lexer_new.
+ (cp_lexer_get_preprocessor_token): Allow LEXER to be NULL.
+ (cp_parser_new): Call cp_lexer_new_main before allocating GCed memory.
+ (cp_parser_late_parsing_for_member): Don't duplicate call to
+ cp_lexer_set_source_position_from_token.
+ (cp_parser_late_parsing_default_args): Likewise.
+ (yyparse): Call finish_file after clearing the_parser.
+
+ 2002-12-11 Geoffrey Keating <geoffk@apple.com>
+
+ * Make-lang.in: Remove $(GGC_H) from all dependencies.
+ (CXX_TREE_H): Add $(GGC_H).
+ * class.c: Don't include ggc.h.
+ (field_decl_cmp): Make parameters be 'const void *' to match qsort.
+ (method_name_cmp): Likewise.
+ (resort_data): New variable.
+ (resort_field_decl_cmp): New.
+ (resort_method_name_cmp): New.
+ (resort_sorted_fields): New.
+ (resort_type_method_vec): New.
+ (finish_struct_methods): Delete cast.
+ (finish_struct_1): Delete cast.
+ * cp-tree.h: Include ggc.h.
+ (struct lang_type_class): Add reorder attribute to field `methods'.
+ (union lang_decl_u3): Add reorder attribute to field `sorted_fields'.
+ (resort_sorted_fields): New prototype.
+ (resort_type_method_vec): New prototype.
+ * call.c: Don't include ggc.h.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * init.c: Likewise.
+ * lex.c: Likewise.
+ * method.c: Likewise.
+ * optimize.c: Likewise.
+ * parse.y: Likewise.
+ * pt.c: Likewise.
+ * repo.c: Likewise.
+ * search.c: Likewise.
+ * semantics.c: Likewise.
+ * spew.c: Likewise.
+ * tree.c: Likewise.
+
+ * lang-specs.h: Remove comment.
+
+ 2002-12-03 Geoffrey Keating <geoffk@apple.com>
+
+ * cp-tree.h (struct operator_name_info_t): Mark for GTY machinery.
+ (operator_name_info): Mark to be saved for PCH, specify size.
+ (assignment_operator_name_info): Likewise.
+
+ 2002-11-19 Geoffrey Keating <geoffk@apple.com>
+
+ * decl.c (anon_cnt): Mark to be saved for PCH.
+
+ 2002-10-25 Geoffrey Keating <geoffk@apple.com>
+
+ * lex.c (init_reswords): Delete now-untrue comment.
+ Allocate ridpointers using GGC.
+
+ 2002-10-04 Geoffrey Keating <geoffk@apple.com>
+
+ * cp-tree.h (union lang_decl_u2): Add tags to all fields.
+
+ * g++spec.c (lang_specific_driver): Don't include standard
+ libraries in `added'.
+
+ 2002-08-27 Geoffrey Keating <geoffk@redhat.com>
+
+ * decl2.c (finish_file): Call c_common_write_pch.
+ * Make-lang.in (CXX_C_OBJS): Add c-pch.o.
+
+ 2002-08-17 Geoffrey Keating <geoffk@redhat.com>
+
+ * g++spec.c (lang_specific_driver): Treat .h files as C++ header
+ files when using g++.
+ * lang-specs.h: Handle compiling C++ header files.
+
+2003-01-09 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (start_decl): Only check DECL_THREAD_LOCAL for VAR_DECLs.
+
+2003-01-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (push_access_scope_real): Call push_to_top_level for
+ function in namespace scope.
+ (pop_access_scope): Call pop_from_top_level for function in
+ namespace scope.
+
+2003-01-09 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (start_decl): Don't set DECL_COMMON for __thread variables.
+
+2003-01-09 Christian Cornelssen <ccorn@cs.tu-berlin.de>
+
+ * Make-lang.in (c++.install-common, c++.install-man,
+ c++.uninstall): Prepend $(DESTDIR) to destination paths in
+ all (un)installation commands.
+ (c++.install-common): Rewrite $(LN) commands to support
+ DESTDIR with "ln" as well as with "ln -s".
+
+2003-01-08 Jason Merrill <jason@redhat.com>
+
+ * parser.c (cp_parser_primary_expression): See through explicitly
+ scoped ALIAS_DECLs, too.
+
+2003-01-08 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * decl.c: Remove some #if 0 code.
+
+ * decl.c: ANSIfy function declarations.
+
+2003-01-07 Mark Mitchell <mark@codesourcery.com>
+
+ * parser.c (cp_parser_asm_definition): Correct handling of omitted
+ operands.
+
+2003-01-08 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/9030
+ * decl.c (make_typename_type): Check access only when tf_error.
+ (make_unbound_class_template): Likewise.
+ * pt.c (saved_access_scope): New variable.
+ (push_access_scope_real): New function.
+ (push_access_scope): Likewise.
+ (pop_access_scope): Likewise.
+ (tsubst_default_argument): Use them.
+ (instantiate_template): Likewise.
+ (regenerate_decl_from_template): Likewise.
+ (instantiate_decl): Likewise.
+ (get_mostly_instantiated_function_type): Likewise.
+
+2003-01-07 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * tree.c: Delete bogus #if 0 code.
+
+2003-01-07 Andreas Schwab <schwab@suse.de>
+
+ * class.c (layout_class_type): Don't use
+ PCC_BITFIELD_TYPE_MATTERS if not defined.
+
+2003-01-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9165
+ * decl2.c (build_cleanup): Mark the object as used.
+
+ * pt.c (retrieve_local_specialization): Revert 2003-01-05 change.
+ (hash_local_specialization): New function.
+ (register_local_specialization): Revert 2003-01-05 change.
+ (instantiate_decl): Use hash_local_specialization when creating
+ the local_specializations table.
+
+ * decl2.c (mark_used): Do not synthesize thunks.
+
+ * class.c (layout_class_type): Correct handling of unnamed
+ bitfields wider than their types.
+
+ PR c++/9189
+ * parser.c (cp_parser): Remove default_arg_types. Update
+ documentation for unparsed_functions_queues.
+ (cp_parser_late_parsing_default_args): Take a FUNCTION_DECL as the
+ parameter.
+ (cp_parser_new): Don't set parser->default_arg_types.
+ (cp_parser_function_definition): Adjust usage of
+ unparsed_funtions_queues.
+ (cp_parser_class_specifier): Don't mess with
+ parser->default_arg_types. Handle default argument processing in
+ a separate phase from function body processing.
+ (cp_parser_template_declaration_after_export): Adjust usage of
+ unparsed_functions_queues.
+ (cp_parser_late_parsing_for_member): Do not handle default
+ arguments.
+
+2003-01-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9109
+ * parser.c (cp_parser_declarator_kind): New enum.
+ (cp_parser_declarator): Adjust.
+ (cp_parser_direct_declarator): Adjust. Allow for either named or
+ abstract declarator. Prefer abstract, if possible. Allow
+ parenthesized function name.
+ (cp_parser_condition): Adjust cp_parser_declarator call.
+ (cp_parser_explicit_instantiation): Likewise.
+ (cp_parser_init_declarator): Likewise.
+ (cp_parser_type_id): Likewise.
+ (cp_parser_function_definition): Likewise.
+ (cp_parser_member_declaration): Likewise.
+ (cp_parser_parameter_declaration): Use cp_parser_declarator to do
+ the tentative parsing.
+ (cp_parser_exception_declaration): Likewise.
+
+2003-01-05 Mark Mitchell <mark@codesourcery.com>
+
+ * parser.c (cp_parser_template_parameter): Adjust call to
+ cp_parser_parameter_declaration.
+ (cp_parser_parameter_declaration_list): Likewise.
+ (cp_parser_parameter_declaration): Replace
+ greater_than_is_operator_p with template_parm_p parameter. Do not
+ cache tokens for template default arguments.
+
+ * pt.c (retrieve_local_specialization): Use htab_find, not
+ htab_find_with_hash.
+ (register_local_specialization): Use htab_find_slot, not
+ htab_find_slot_with_hash.
+ (instantiate_decl): Pass a hash function to htab_create.
+
+2003-01-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * parser.c (cp_parser_binary_expression,
+ cp_parser_multiplicative_expression,
+ cp_parser_additive_expression, cp_parser_shift_expression,
+ cp_parser_relational_expression, cp_parser_equality_expression,
+ cp_parser_and_expression, cp_parser_exclusive_or_expression,
+ cp_parser_inclusive_or_expression,
+ cp_parser_logical_and_expression, cp_parser_logical_or_expression,
+ cp_parser_binary_expression): Const-ify.
+
+2003-01-04 Mark Mitchell <mark@codesourcery.com>
+
+ * method.c (use_thunk): Disable access control while building the
+ body of the thunk.
+
+2003-01-03 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * cvt.c, decl.c, decl2.c: This is the C++ front end, not the C
+ front end.
+
+2003-01-03 Matt Austern <austern@apple.com>
+
+ * cp-tree.h (struct lang_type_class): add field for key method
+ (cp_global_trees): rename dynamic_classes to keyed_classes
+ (key_method): add definition
+ * class.c (finish_struct_1): compute class's key method, and add
+ the class to keyed_classes list if there is no key method.
+ * decl.c (finish_function): add class to keyed_classes list if we
+ see a definition of the class's key method.
+ * pt.c (instantiate_class_template): add template specialization
+ of a dynamic class to keyed_classes list.
+ * decl2.c (key_method): remove
+ (finish_file): iterate only through keyed_classes list when
+ deciding whether to emit vtables, remove class from its list after
+ we do the emission.
+
+2003-01-02 Jason Merrill <jason@redhat.com>
+
+ * call.c (build_conditional_expr): Stabilize lvalues properly.
+ * cvt.c (ocp_convert): Don't build NOP_EXPRs of class type.
+ * tree.c (lvalue_p_1): Don't allow sloppy NOP_EXPRs as lvalues.
+ Don't allow CALL_EXPR or VA_ARG_EXPR, either.
+
+ * call.c (convert_like_real): Call decl_constant_value for an
+ IDENTITY_CONV even if there are no more conversions.
+
+ * cvt.c (build_up_reference): Don't push unnamed temps.
+
+ * decl2.c (do_namespace_alias): Namespace aliases are DECL_EXTERNAL.
+
+ * dump.c (cp_dump_tree): Don't try to dump class-specific fields
+ for a backend struct.
+
+ * except.c (wrap_cleanups_r, build_throw): Make
+ MUST_NOT_THROW_EXPRs void.
+ * init.c (expand_default_init): Update to handle MUST_NOT_THROW_EXPR.
+
+ * init.c (build_vec_delete_1): Pre-evaluate the base address.
+
+ * init.c (get_temp_regvar): Simplify logic.
+
+ * tree.c (cp_copy_res_decl_for_inlining): Only do debug tweaks if
+ our replacement is a decl.
+
+ * decl.c (cp_make_fname_decl): Push the decls inside the
+ outermost scope.
+
+2003-01-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/45, c++/3784
+ * tree.c (cp_tree_equal, TEMPLATE_PARM_INDEX): The types must be
+ the same too.
+
+2003-01-03 Graham Stott <graham.stott@btinternet.com>
+
+ * parser.c (struct cp_parser): Add access_checks_lists field
+ (cp_parser_simple_declaration): Use.
+ (cp_parser_init_declarator): Likewise.
+
+2003-01-02 Mark Mitchell <mark@codesourcery.com>
+
+ * parser.c (cp_parser_declaration): Accept the __extension__
+ keyword before the declaration.
+
+ PR c++/2843
+ * parser.c (cp_parser_parameter_declaration): Allow attributes to
+ appear after the declarator.
+
+ * call.c (build_new_method_call): Fix typo in message format
+ string.
+
+2003-01-02 Mark Mitchell <mark@codesourcery.com>
+
+ * parser.c (cp_lexer_next_token_is): Declare it inline.
+ (cp_lexer_set_source_position_from_token): Likewise.
+ (cp_lexer_debugging_p): Likewise.
+ (cp_parser_parsing_tentatively): Likewise.
+ (cp_parser_nested_name_specifier_opt): Reduce the number of calls
+ to the cp_lexer_peek_token.
+
+ * parser.c (cp_parser_sizeof_operand): Do not evaluate the
+ expression.
+
+2003-01-02 Steven Bosscher <s.bosscher@student.tudelft.nl>
+
+ * cp/except.c, cp/expr.c, cp/friend.c, cp/g++spec.c,
+ cp/lang-options.h, cp/lang-specs.h, cp/lex.h, cp/ptree.c,
+ cp/repo.c: Fix copyright years.
+
+2003-01-01 Neil Booth <neil@daikokuya.co.uk>
+
+ * lex.c: Remove superfluous include of cpplib.h.
+ (CONSTRAINT): Define without conditions.
+ (init_cp_pragma): Use c_register_pragma.
+
+2002-12-31 Neil Booth <neil@daikokuya.co.uk>
+
+ * .cvsignore: Remove.
+
+2002-12-31 Steven Bosscher <s.bosscher@student.tudelft.nl>
+
+ * call.c, class.c, cp-lang.c, cp-tree.h, cvt.c, dump.c, error.c,
+ except.c, expr.c friend.c, g++spec.c, init.c, lang-options.h,
+ lang-specs.h, lex.c, mangle.c, method.c, optimize.c, parser.c,
+ pt.c, ptree.c, repo.c, rtti.c, search.c, semantics.c, tree.c,
+ typeck.c, typeck2.c: Replace "GNU CC" with "GCC" in the
+ copyright header.
+ * lex.h: parse.y is dead, so don't mention it. Also replace the
+ copyright header with the default GNU copyright header.
+
+2002-12-31 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (LOOKUP_TEMPLATES_EXPECTED): Remove.
+ (lookup_name_namespace_only): Likewise.
+ (begin_only_namespace_names): Likewise.
+ (end_only_namespace_names): Likewise.
+ * decl.c (only_namespace_names): Remove.
+ (qualify_lookup): Do not check LOOKUP_TEMPLATES_EXPECTED.
+ (lookup_name_real): Do not check only_namespace_names.
+ (lookup_name_namespace_only): Remove.
+ (begin_only_namespace_names): Likewise.
+ (end_only_namespace_names): Likewise.
+ * parser.c (cp_parser_nested_name_specifier_opt): Handle erroneous
+ nested-name-specifiers more gracefully.
+ (cp_parser_class_or_namespace_name): Avoid looking up namespace
+ names when they cannot possibly appear.
+ (cp_parser_template_name): Adjust call to cp_parser_lookup_name.
+ (cp_parser_elaborated_type_specifier): Likewise.
+ (cp_parser_namespace_name): Only look for namespace names.
+ (cp_parser_lookup_name): Add is_namespace parameter.
+ (cp_parser_lookup_name_simple): Adjust call to
+ cp_parser_lookup_name.
+
+ * parser.c (cp_parser_dependent_type_p): Fix thinko.
+
+2002-12-31 Neil Booth <neil@daikokuya.co.uk>
+
+ * .cvsignore: Update.
+
+2002-12-31 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (modify_vtable_entry): Remove unused variable.
+ (get_vcall_index): Always expect a non-thunk.
+ (update_vtable_entry_for_fn): Combine covariant adjustments, when
+ overriding a thunk. Pass get_vcall_index a non-thunk.
+
+ * decl2.c (finish_file): Mark undefined inlines as extern.
+
+2002-12-31 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (RETURN_INIT): Remove.
+ * cp-tree.h (DECL_IN_MEMORY_P): Remove.
+ (scope_kind): Add sk_block, sk_try, sk_catch, sk_for.
+ (note_level_for_for): Remove.
+ (note_level_for_try): Likewise.
+ (note_level_for_catch): Likewise.
+ (finish_named_return_value): Likewise.
+ (do_pushlevel): Change prototype.
+ (pending_lang_change): Remove.
+ * decl.c (begin_scope): Handle sk_block, sk_try, sk_catch,
+ sk_for.
+ (note_level_for_for): Remove.
+ (note_level_for_try): Likewise.
+ (note_level_for_catch): Likewise.
+ (maybe_inject_for_scope_var): Remove use of DECL_IN_MEMORY_P.
+ * parser.c (cp_parser_context_free_list): Make it "deletable".
+ (cp_parser_template_argument): Remove misleading comment.
+ * pt.c (tsubst_expr): Remove RETURN_INIT code.
+ * semantics.c (genrtl_named_return_value): Remove.
+ (do_pushlevel): Take a scope kind as an argument.
+ (begin_if_stmt): Adjust.
+ (begin_while_stmt): Likewise.
+ (begin_for_stmt): Likewise.
+ (finish_for_init_stmt): Likewise.
+ (begin_switch_stmt): Likewise.
+ (begin_handler): Likewise.
+ (begin_compound_stmt): Likewise.
+ (finish_named_return_value): Remove.
+ (cp_expand_stmt): Remove RETURN_INIT case.
+ * tree.c (cp_statement_code_p): Remove RETURN_INIT case.
+
+2002-12-31 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/9112
+ * parser.c (cp_parser_direct_declarator): Handle erroneous
+ parenthesized declarators correctly.
+
+2002-12-31 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-tree.h (pending_lang_change): Declare.
+
+2002-12-30 Mark Mitchell <mark@codesourcery.com>
+
+ * parser.c (cp_parser_context_free_list): New variable.
+ (cp_parser_context_new): Use it.
+ (cp_parser_error): Check return code from
+ cp_parser_simulate_error.
+ (cp_parser_simulate_error): Return a value.
+ (cp_parser_id_expression): Optimize common case.
+ (cp_parser_class_name): Likewise.
+ (cp_parser_class_specifier): Adjust call to
+ cp_parser_late_parsing_default_args.
+ (cp_parser_lookup_name): Optimize common case.
+ (cp_parser_late_parsing_for_member): Adjust call to
+ cp_parser_late_parsing_default_args.
+ (cp_parser_late_parsing_default_args): Add scope parameter.
+ (cp_parser_require): Avoid creating the error message unless it's
+ needed.
+ (cp_parser_parse_definitely): Place free'd contexts on the free
+ list.
+
+ * parser.c (cp_parser_declaration_seq_opt): Handle pending_lang_change.
+
+2002-12-30 David Edelsohn <edelsohn@gnu.org>
+
+ * parser.c (cp_parser_parameter_declaration_clause): Treat system
+ header as extern "C" if NO_IMPLICIT_EXTERN_C undefined.
+
+2002-12-30 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * config-lang.in, Make-lang.in, operators.def, cp-tree.def:
+ GCC, not GNU CC.
+
+2002-12-30 Mark Mitchell <mark@codesourcery.com>
+
+ * parse.y: Remove.
+ * spew.c: Likewise.
+ * Make-lang.in (gt-cp-spew.h): Remove.
+ * cp-tree.h (do_pending_lang_change): Remove.
+ (do_identifier): Change prototype.
+ (finish_id_expr): Remove.
+ * decl.c (lookup_name_real): Remove yylex variable.
+ * decl2.c (build_expr_from_tree): Adjust call to do_identifier.
+ * lex.c (init_cpp_parse): Remove.
+ (reduce_cmp): Likewise.
+ (token_cmp): Likewise.
+ (yychar): Likewise.
+ (lastiddecl): Likewise.
+ (token_count): Likewise.
+ (reduce_count): Likewise.
+ (yyhook): Likewise.
+ (print_parse_statistics): Likewise.
+ (do_pending_lang_change): Likewise.
+ (do_identifier): Remove parsing parameter.
+ * lex.h (lastiddecl): Remove.
+ (looking_for_typename): Remove.
+ (looking_for_template): Likewise.
+ (pending_lang_change): Likewise.
+ (yylex): Likewise.
+ * semantics.c (finish_id_expr): Remove.
+
+ * decl.c (grokdeclarator): Diagnost "extern thread" and "static
+ thread" correctly.
+
+2002-12-30 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * decl.c, decl2.c, decl.h: GCC, not GNU CC. This is the C++ front
+ end, not the C front end.
+
+2002-12-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (THUNK_TARGET): New macro.
+ (THUNK_VIRTUAL_OFFSET): For result thunks it is always a binfo.
+ (finish_thunk): Remove offset parms.
+ * class.c (find_final_overrider): Look through thunks.
+ (get_vcall_index): Use THUNK_TARGET.
+ (update_vtable_entry_for_fn): Look through thunks. Set covariant
+ fixed offset here. Adjust finish_thunk call.
+ (build_vtbl_initializer): Adjust finish_thunk calls.
+ * mangle.c (mangle_call_offset): Remove superfluous if.
+ (mangle_thunk): Adjust.
+ * method.c (make_thunk): Adjust.
+ (finish_thunk): Adjust.
+ (thunk_adjust): Remove assert.
+ (use_thunk): Use THUNK_TARGET
+ * dump1.c (cp_dump_tree): Adjust thunk dumping.
+
+ PR c++/9054
+ * class.c (layout_class_type): Set TYPE_CONTEXT of type for base.
+ * dump.c (cp_dump_tree, RECORD_TYPE): Deal with type for base types.
+
+2002-12-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ Remove traditional C constructs 4/n.
+ * decl2.c (grok_method_quals, warn_if_unknown_interface,
+ grok_x_components, cp_build_parm_decl, build_artificial_parm,
+ maybe_retrofit_in_chrg, grokclassfn, grok_array_decl,
+ delete_sanity, check_member_template, check_java_method,
+ check_classfn, finish_static_data_member_decl, grokfield,
+ grokbitfield, grokoptypename, grok_function_init,
+ cplus_decl_attributes, constructor_name, defer_fn,
+ build_anon_union_vars, finish_anon_union, coerce_new_type,
+ coerce_delete_type, comdat_linkage, maybe_make_one_only,
+ key_method, import_export_vtable, import_export_class,
+ output_vtable_inherit, import_export_decl, import_export_tinfo,
+ build_cleanup, get_guard, get_guard_bits, get_guard_cond,
+ set_guard, start_objects, finish_objects,
+ start_static_storage_duration_function,
+ finish_static_storage_duration_function, get_priority_info,
+ start_static_initialization_or_destruction,
+ finish_static_initialization_or_destruction,
+ do_static_initialization, do_static_destruction,
+ prune_vars_needing_no_initialization, write_out_vars,
+ reparse_decl_as_expr, finish_decl_parsing, namespace_ancestor,
+ add_using_namespace, merge_functions, ambiguous_decl,
+ lookup_using_namespace, lookup_using_namespace,
+ qualified_lookup_using_namespace, set_decl_namespace,
+ decl_namespace, current_decl_namespace, push_decl_namespace,
+ pop_decl_namespace, push_scope, pop_scope, add_function,
+ arg_assoc_namespace, arg_assoc_template_arg, arg_assoc,
+ lookup_arg_dependent, do_namespace_alias,
+ validate_nonmember_using_decl, do_nonmember_using_decl,
+ do_toplevel_using_decl, do_local_using_decl,
+ do_class_using_decl, do_using_directive, check_default_args,
+ mark_used, handle_class_head): Use C90 prototypings. Use booleans.
+ * parser.c (cp_parser_class_head): Use booleanss.
+ * decl.c (walk_globals, walk_vtables): Likewise.
+ * cp-tree.h (walk_globals_pred, walk_globals_fn, walk_vtables,
+ walk_globals): Change return type from 'int' to 'bool'.
+ * rtti.c (init_rtti_processing, build_headof, throw_bad_cast
+ throw_bad_typeid, get_tinfo_decl_dynamic, typeid_ok_p,
+ build_typeid, tinfo_name, get_tinfo_decl, get_tinfo_ptr,
+ get_typeid, ifnonnull, build_dynamic_cast_1, build_dynamic_cast,
+ qualifier_flags, tinfo_base_init, generic_initializer,
+ ptr_initializer, dfs_class_hint_mark, ptm_initializer,
+ dfs_class_hint_unmark, class_hint_flags, class_initializer,
+ typeinfo_in_lib_p, get_pseudo_ti_init, create_pseudo_type_info,
+ get_pseudo_ti_desc, create_tinfo_types, emit_support_tinfos,
+ unemitted_tinfo_decl_p, emit_tinfo_decl): Likewise.
+ * repo.c (repo_compile_flags, repo_template_declared,
+ repo_template_defined, repo_class_defined, repo_get_id,
+ repo_template_used, repo_vtable_used, repo_inline_used,
+ repo_tinfo_used, repo_template_instantiated, extract_string,
+ open_repo_file, afgets, init_repo, reopen_repo_file_for_write,
+ finish_repo): Likewise.
+ * ptree.c (cxx_print_decl, cxx_print_type, cxx_print_identifier,
+ cxx_print_xnode): Likewise..
+ * cp-lang.c (ok_to_generate_alias_set_for_type, cxx_get_alias_set,
+ cxx_warn_unused_global_decl, cp_expr_size): Likewise.
+ * cxxfilt.c (demangle_it, print_demangler_list, usage,
+ standard_symbol_characters, hp_symbol_characters, main, fatal):
+ Likewise.
+ (strip_underscore): Change type from 'int' to 'bool'.
+ (main): Use boolean constants.
+
+2002-12-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ Remove traditional C constructs 3/n.
+ * cvt.c (cp_convert_to_pointer, convert_to_pointer_force,
+ build_up_reference, warn_ref_binding, convert_to_reference,
+ convert_from_reference, convert_lvalue, cp_convert, ocp_convert,
+ convert_to_void, convert, convert_force, build_type_conversion,
+ build_expr_type_conversion, type_promotes_to,
+ perform_qualification_conversions): Use C90 prototyping style.
+ * decl2.c (grok_array_decl): Use boolean constant.
+ (delete_sanity): Likewise.
+ * typeck.c (build_unary_op): Likewise.
+ * semantics.c (finish_switch_cond): Likewise.
+ * parser.c (cp_parser_direct_new_declarator): Likewise.
+ * init.c (build_new): Likewise.
+
+2002-12-27 Mark Mitchell <mark@codesourcery.com>
+
+ * Make-lang.in (po-generated): Remove parse.c.
+ (CXX_OBJS): Remove parse.o and spew.o. Add parser.o.
+ ($(srcdir)/cp/parse.h): Remove target.
+ ($(srcdir)/cp/parse.c): Likewise.
+ (gt-cp-parse.h): Likewise.
+ (gt-cp-parser.h): New target.
+ (c++.distclean): Do not remove parse.output.
+ (c++.maintainer-clean): Do not remove parse.c or parse.h.
+ (cp/spew.o): Remove target.
+ (cp/lex.o): Adjust dependencies.
+ (cp/pt.o): Likewise.
+ (cp/parse.o): Likewise.
+ (cp/TAGS): Do not mention parse.c.
+ (cp/parser.o): New target.
+ * NEWS: Mention the new parser.
+ * call.c (build_scoped_method_call): Simplify.
+ (build_method_call): Likewise.
+ (build_new_function_call): Adjust calls to add_function_candidate
+ and add_template_candidate.
+ (build_new_op): Improve handling of erroroneous operands.
+ (convert_default_arg): Remove circular argument processing.
+ (name_as_c_string): New function.
+ (build_new_method_call): Use it.
+ (perform_implicit_conversion): Use error_operand_p.
+ * class.c (finish_struct_anon): Use constructor_name_p.
+ (check_field_decls): Likewise.
+ (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN.
+ (resolve_address_of_overloaded_function): Likewise.
+ (instantiate_type): Tweak pointer-to-member handling.
+ (get_primary_binfo): Remove incorrect assertion.
+ * config-lang.in (gtfiles): Add parser.c, remove parse.c.
+ * cp-tree.h (DEFARG_TOKENS): New macro.
+ (default_arg): New structure.
+ (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG.
+ (lang_tree_node): Add default_arg.
+ (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE.
+ (type_info_ref_type): New macro.
+ (saved_scope): Make processing_explicit_instantiation a boolean.
+ (check_access): New field.
+ (unparsed_text): Remove.
+ (language_function): Remove unparsed_inlines.
+ (error_operand_p): New macro.
+ (lang_decl): Adjust pending_inline_info.
+ (DEFARG_POINTER): Remove.
+ (tag_types): Add typenames.
+ (lookup_ualified_name): Declare.
+ (lookup_name_real): Likewise.
+ (shadow_tag): Adjust prototype.
+ (get_scope_of_declarator): Declare it.
+ (process_next_inline): Remove it.
+ (check_for_missing_semicolon): Likewise.
+ (maybe_get_template_decl_from_type_decl): Declare it.
+ (finish_label_stmt): Adjust prototype.
+ (finish_non_static_data_meber): Declare it.
+ (finish_pseudo_destructor_call_expr): Rename to ...
+ (finish_pseudo_destructor_expr): ... this.
+ (finish_compound_literal): Declare it.
+ (begin_inline_definitions): Remove it.
+ (init_spew): Remove.
+ (peekyylex): Likewise.
+ (arbitrate_lookup): Likewise.
+ (frob_opname): Likewise.
+ (maybe_snarf_defarg): Likewise.
+ (add_defarg_fn): Likewise.
+ (do_pending_defargs): Likewise.
+ (done_pending_defargs): Likewise.
+ (unprocessed_defarg_fn): Likewise.
+ (replace_defarg): Likewise.
+ (end_input): Likewise.
+ (get_overloaded_fn): Likewise.
+ * cvt.c (convert_to_reference): Improve error handling.
+ * decl.c (lookup_name_real): Do not declare it static.
+ (maybe_push_to_top_level): Set check_access.
+ (identifier_type_value): Adjust call to lookup_name_real.
+ (lookup_qualified_name): New method.
+ (lookup_name_real): Remove special-case parsing code.
+ (lookup_name-nonclass): Adjust call to lookup_name_real.
+ (lookup_name_namespace_only): Likewise.
+ (lookup_name): Likewise.
+ (check_tag_decl): Return the type declared.
+ (shadow_tag): Likewise.
+ (register_dtor_fn): Tweak check_access.
+ (grokfndecl): Use constructor_name_p.
+ (get_scope_of_declarator): New function.
+ (grokdeclarator): Obscure tweaks for slightly different declarator
+ representations.
+ (start_method): Return error_mark_node to indicate failure.
+ (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs.
+ * decl2.c (constructor_name_full): Simplify.
+ (constructor_name): Use it.
+ (build_expr_from_tree): Adjust for changes to do new parser.
+ (push_scope): Improve robustness.
+ (validate_nonmember_using_decl): Process declarations, not names.
+ (do_class_using_decl): Likewise.
+ (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS
+ here.
+ * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs.
+ * expr.c (cxx_expand_expr): Handle BASELINKs.
+ * init.c (member_init_ok_or_else): Issue more errors.
+ (build_offset_ref): Tweak handling of FUNCTION_DECLs.
+ * lex.c: Do not include parse.h.
+ (yypring): Do not declare.
+ (yylval): Likewise.
+ (make_reference_declarator): Remove error-generating code.
+ (rid_to_yy): Remove.
+ (cxx_init): Do not call init_spew.
+ (yypring): Remove.
+ (check_for_missing_semicolon): Remove.
+ * lex.h (got_scope): Remove.
+ (got_object): Remove.
+ * method.c (hack_identifier): Use finish_non_static_data_member.
+ (implicitly_declare_fn): Adjust use of constructor_name.
+ * parser.c: New file.
+ * pt.c (parse.h): Do not include it.
+ (maybe_get_template_decl_from_template): Do not declare it.
+ (finish_member_template_decl): Tweak.
+ (begin_explicit_instantiation): Adjust for
+ processing_explicit_instantiation being boolean.
+ (end_explicit_instantiation): Likewise.
+ (maybe_process_partial_specialization): Tighten specialization
+ test.
+ (retrieve_local_specialization): Adjust ue of hash table.
+ (eq_local_specializations): New function.
+ (register_local_specialization): Likewise.
+ (push_template_decl_real): Remove unnecessary test.
+ (maybe_get_template_decl_from_type_decl): Don't make it static.
+ (for_each_template_parm_r): Handle TYPEOF_TYPE.
+ (tsubst_copy): Use retrieive_local_specialization to handle
+ PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs.
+ Handle COMPONENT_REFs with pseudo-destructor-expressions.
+ Simplify handling of CALL_EXPR and METHOD_CALL_EXPR.
+ (tsubst_expr): Pass decls, not names, to do_local_using_decl.
+ (unify): Tweak handling of CONST_DECLs.
+ (regenerate_decl_from_template): Use push_nested_class.
+ (template_for_substitution): New funciton.
+ (instantiate_decl): Use it. Register parameters as local
+ specializations.
+ * rtti.c (init_rtti_processing): Set type_info_ref_type.
+ (build_typeid): Use it.
+ (get_typeid): Likeise.
+ * search.c (accessible_p): Use check_access, not
+ flag_access_control.
+ (adjust_result_of_qualified_name_lookup): Pay attention to the
+ context_class.
+ * semantics.c (finish_asm_stmt): Adjust error handling.
+ (finish_label_stmt): Return the statement.
+ (finish_non_static_data_member): New function.
+ (finish_class_expr): Handle BASELINKs.
+ (finish_call_expr): Handle PSEUDO_DTOR_EXPR.
+ (finish_object_call_expr): Simplify handling during templates.
+ (finish_pseudo_destructor_call_expr): Rename to ...
+ (finish_pseudo_dtor_expr): ... this.
+ (finish_compound_literal): New function.
+ (begin_inline_definitions): Remove.
+ (finish_sizeof): Remove special template handling.
+ * spew.c: Do not include parse.h.
+ * tree.c (get_overloaded_fn): Remove.
+ * typeck.c (build_class_member_access_expr): Handle
+ PSEUDO_DTOR_EXPR. Adjust handling of static member functions.
+ (lookup_destructor): New function.
+ (finish_class_member_access_expr): Use it.
+ (convert_arguments): Simplify.
+ (build_unary_op): Handle BASELINKs.
+
+2002-12-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/4803
+ * decl2.c (mark_used): Defer inline functions.
+ (finish_file): Merge deferred_fns loops. Check all used
+ inline functions have a definition.
+ * method.c (make_thunk): Thunks are not inline.
+
+ PR c++/5116, c++/764
+ * call.c (build_new_op): Make sure template class operands are
+ instantiated.
+
+2002-12-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR C++/7964
+ * cp-tree.h (resolve_scoped_fn_name): Prototype.
+ * call.c (resolve_scoped_fn_name): New function. Deal with
+ more template expansion. Broken out of ...
+ * parse.y (parse_finish_call_expr): ... here. Call it.
+ * decl2.c (build_expr_from_tree, CALL_EXPR): Use
+ resolve_scoped_fn_name and build_call_from_tree.
+
+ PR c++/9053
+ * decl.c (duplicate_decls): Templates may be disambiguated by
+ return type.
+
+ PR c++/8702
+ * decl2.c (check_classfn): Use lookup_fnfield_1. List all
+ conversion operators on failure.
+
+2002-12-23 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ Remove traditional C constructs 2/n.
+ * call.c (tourney, build_field_call, equal_functions, joust,
+ compare_ics, build_over_call, build_java_interface_fn_ref,
+ convert_like_real, op_error, build_object_call, resolve_args,
+ build_vfield_ref, check_dtor_name, build_scoped_method_call,
+ build_addr_func, build_call, build_method_call, null_ptr_cst_p,
+ sufficient_parms_p, build_conv, non_reference, strip_top_quals,
+ standard_conversion, reference_related_p,
+ reference_compatible_p, convert_class_to_reference,
+ direct_reference_binding, reference_binding,
+ ,implicit_conversion, is_complete, promoted_arithmetic_type_p,
+ add_template_conv_candidate, any_viable, any_strictly_viable,
+ build_this, splice_viable, print_z_candidates,
+ build_user_type_conversion, build_new_function_call,
+ conditional_conversion, build_conditional_expr, build_new_op,
+ build_op_delete_call, enforce_access, call_builtin_trap,
+ convert_arg_to_ellipsis, build_x_va_arg, cxx_type_promotes_to,
+ convert_default_arg, type_passed_as, convert_for_arg_passing,
+ in_charge_arg_for_name, is_properly_derived_from,
+ maybe_handle_implicit_object, maybe_handle_ref_bind,
+ source_type, add_warning, can_convert, can_convert_arg,
+ perform_implicit_conversion, can_convert_arg_bad,
+ initialize_reference, add_conv_candidate,
+ add_template_candidate_real, add_template_candidate): Ansify.
+
+2002-12-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/8572
+ * cp-tree.h (grokoptypename): Add SCOPE parameter.
+ * decl2.c (grokoptypename): Add SCOPE parameter. tsubst the type
+ if in a template scope.
+ * parse.y (unoperator): Return the scope.
+ (operator_name): Adjust grokoptypename call.
+
+2002-12-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * cp-tree.h (make_unbound_class_template): Use tsubst_flags_t.
+ * decl.c (make_unbound_class_template): Adjust. Check for tf_error.
+ * pt.c (tsubst) [OFFSET_TYPE]: Check for tf_error.
+
+2002-12-20 Kazu Hirata <kazu@cs.umass.edu>
+
+ * ChangeLog: Fix a typo.
+ * class.c: Fix comment typos.
+ * cp-tree.h: Likewise.
+
+2002-12-18 Jason Merrill <jason@redhat.com>
+
+ Handle anonymous unions at the tree level.
+ C++ ABI change: Mangle anonymous unions using the name of their
+ first named field (by depth-first search). Should not cause
+ binary compatibility problems, though, as the compiler previously
+ didn't emit anything for affected unions.
+ * cp-tree.def (ALIAS_DECL): New tree code.
+ * decl2.c (build_anon_union_vars): Build ALIAS_DECLs. Return the
+ first field, not the largest.
+ (finish_anon_union): Don't mess with RTL. Do set DECL_ASSEMBLER_NAME,
+ push the decl, and write it out at namespace scope.
+ * decl.c (lookup_name_real): See through an ALIAS_DECL.
+ (pushdecl): Add namespace bindings for ALIAS_DECLs.
+ * rtti.c (unemitted_tinfo_decl_p): Don't try to look at the name
+ of a decl which doesn't have one.
+ * typeck.c (build_class_member_access_expr): Don't recurse if
+ we already have the type we want.
+
+2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/8099
+ * friend.c (make_friend_class): Allow partial specialization
+ when declaration is not a template friend.
+
+2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/3663
+ * pt.c (lookup_template_class): Copy TREE_PRIVATE and
+ TREE_PROTECTED to created decl nodes.
+
+2002-12-18 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_base_field): Do not set DECL_PACKED on the
+ FIELD_DECL.
+
+2002-12-18 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cp-tree.h (struct tree_srcloc): Use location_t.
+ (SOURCE_LOCUS): New.
+ (SRCLOC_FILE, SRCLOC_LINE): Adjust.
+
+2002-12-17 Jason Merrill <jason@redhat.com>
+
+ * decl.c (finish_function): Also complain about no return in
+ templates.
+ * semantics.c (finish_return_stmt): Also call check_return_expr in
+ templates.
+ * typeck.c (check_return_expr): In a template, just remember that we
+ saw a return.
+
+2002-12-16 Jason Merrill <jason@redhat.com>
+
+ * semantics.c (simplify_aggr_init_exprs_r): Don't change the type
+ of the CALL_EXPR.
+
+ * semantics.c (do_pushlevel): Call pushlevel after adding the
+ SCOPE_STMT.
+ (do_poplevel): Call poplevel before adding the SCOPE_STMT.
+ * parse.y (function_body): Go back to using compstmt.
+ * decl.c (pushdecl): Skip another level to get to the parms level.
+
+ * call.c (build_new_method_call): Use is_dummy_object to determine
+ whether or not to evaluate the object parameter to a static member
+ function.
+
+2002-12-14 Jason Merrill <jason@redhat.com>
+
+ * semantics.c (simplify_aggr_init_exprs_r): Also prepend the
+ return slot for normal functions. Set CALL_EXPR_HAS_RETURN_SLOT_ADDR.
+ * tree.c (build_cplus_new): If the type isn't TREE_ADDRESSABLE,
+ don't bother with an AGGR_INIT_EXPR.
+ (cp_copy_res_decl_for_inlining): If the type isn't TREE_ADDRESSABLE,
+ just generate a new decl normally. Take return slot parm.
+ * cp-tree.h: Adjust prototype.
+
+2002-12-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR C++/8031
+ * cvt.c (convert_to_pointer_force): Don't try comparing against
+ erronous type.
+
+2002-12-13 Geoffrey Keating <geoffk@apple.com>
+
+ * cp-tree.h: Have the multiple-include guards around
+ the entire file.
+
+2002-12-10 David Edelsohn <edelsohn@gnu.org>
+
+ * cp/spew.c (feed_input): Change limit to last_pos and pos to cur_pos
+ for SPEW_DEBUG.
+ (snarf_method): Same.
+ (snarf_defarg): Same.
+
+2002-12-10 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8372
+ * pt.c (tsubst_copy): Handle destructor names more correctly.
+
+2002-12-10 Matt Austern <austern@apple.com>
+
+ * cp-tree.h: get rid of needs_virtual_reinit bit.
+
+2002-12-09 Mark Mitchell <mark@codesourcery.com>
+
+ * NEWS: Document removal of in-class initialization extension for
+ static data members of non-arithmetic, non-enumeration type.
+ * decl.c (check_static_variable_definition): Do not allow that
+ extension.
+ * decl2.c (grokfield): Do not call digest_init when processing
+ templates.
+
+2002-12-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * error.c (dump_expr): Fix format specifier warning.
+
+2002-12-04 Geoffrey Keating <geoffk@apple.com>
+
+ * class.c (finish_struct_1): Correct comment.
+ * cp-tree.c (DECL_SORTED_FIELDS): Likewise.
+
+2002-12-04 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR C++/8799
+ * error.c (dump_expr): Don't ever try to dump a non-existent
+ expression.
+
+2002-12-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ Implement covariant returns.
+ * cp-tree.h (IS_AGGR_TYPE_2): Remove.
+ (struct lang_decl_flags): Add this_thunk_p flag.
+ Rename vcall_offset to virtual_offset.
+ (struct lang_decl): Rename delta to fixed_offset.
+ (DECL_THIS_THUNK_P, DECL_RESULT_THUNK_P): New #defines.
+ (SET_DECL_THUNK_P): Add THIS_ADJUSTING arg.
+ (THUNK_DELTA, THUNK_VCALL_OFFSET): Rename to ...
+ (THUNK_FIXED_OFFSET, THUNK_VIRTUAL_OFFSET): ... here.
+ (make_thunk): Add this_adjusting arg.
+ (finish_thunk): Declare.
+ (mangle_thunk): Add this_adjusting arg.
+ * class.c (get_vcall_index): Use base function for lookup.
+ (update_vtable_entry_for_fn): Generate covariant thunk.
+ (finish_struct_1): Set DECL_VINDEX to NULL for thunks.
+ (build_vtbl_initializer): Use base function for lookup.
+ Finish covariant thunk here. Adjust thunk generation.
+ * dump.c (cp_dump_tree): Simplify DECL_GLOBAL_[CD]TOR_P handling.
+ Adjust thunk dumping.
+ * mangle.c (mangle_call_offset): New function.
+ (mangle_thunk): Adjust for covariant thunks.
+ * method.c (make_thunk): Adjust. Do not set name here.
+ (finish_thunk): New function. Set name here.
+ (use_thunk): Generate covariant thunks too.
+ (thunk_adjust): New function.
+ * search.c (covariant_return_p): Remove. Fold into ...
+ (check_final_overrider): ... here. Simplify.
+ * semantics.c (emit_associated_thunks): Walk covariant thunk lists.
+
+2002-12-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/8674
+ * call.c (build_over_call): Check specifically for TARGET_EXPR
+ when eliding.
+
+ PR c++/8461, c++/8625
+ * call.c (convert_for_arg_passing): Don't mess with error_mark_node.
+ (cp_convert_parm_for_inlining): Remove.
+ * cp-lang.c (LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING):
+ Remove.
+ * cp-tree.h (ADDR_IS_INVISIREF): Remove.
+ * except.c (stabilize_throw_expr): Remove ADDR_IS_INVISIREF code.
+
+ * call.c (build_user_type_conversion_1): Don't set ICS_BAD_FLAG on
+ an ambiguous conversion.
+
+2002-12-03 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8688
+ * decl.c (reshape_init): Handle erroneous initializers.
+
+2002-12-02 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8720
+ * spew.c (remove_last_token): Make sure that last_chunk is set
+ correctly.
+
+ PR c++/8615
+ * error.c (dump_expr): Handle character constants with
+ TREE_OVERFLOW set.
+
+2002-12-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ DR 180
+ * decl.c (grokdeclarator): Require class-key for all friend class.
+ Output the correct type and context in the error message.
+
+2002-12-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/5919
+ * pt.c (unify): Use variably_modified_type_p to test validity of
+ template argument types.
+
+ PR c++/8727
+ * cp-tree.h (lang_type_class): Add typeinfo_var.
+ (CLASSTYPE_TYPEINFO_VAR): New macro.
+ * rtti.c (get_tinfo_decl): Use it.
+
+ PR c++/8663
+ * init.c (expand_member_init): Always get the main variant of a
+ base class.
+
+2002-12-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8332
+ PR c++/8493
+ * decl.c (cxx_init_decl_processing): Use size_type_node, not
+ c_size_type_node.
+ * decl2.c (coerce_new_type): Likewise.
+ * except.c (do_allocate_exception): Likewise.
+
+2002-11-30 Zack Weinberg <zack@codesourcery.com>
+
+ * call.c, class.c, cp-lang.c, cvt.c, cxxfilt.c, decl.c, decl2.c,
+ dump.c, error.c, except.c, expr.c, friend.c, g++spec.c, init.c,
+ lex.c, mangle.c, method.c, optimize.c, parse.y, pt.c, ptree.c,
+ repo.c, rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
+ typeck2.c: Include coretypes.h and tm.h.
+ * Make-lang.in: Update dependencies.
+
+2002-11-30 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8227
+ * decl.c (layout_var_decl): Deal gracefully with erroneous types.
+ (check_initializer): Validate the type of the initialized
+ variable, even if the initializer is absent.
+ * typeck.c (cp_type_quals): Deal gracefully with erroneous types.
+
+ PR c++/8214
+ * typeck.c (convert_for_assignment): Do not use
+ decl_constant_value on the operand.
+
+ PR c++/8511
+ * pt.c (instantiate_decl): Handle template friends defined outside
+ of the class correctly.
+
+2002-11-29 Joe Buck <jbuck@synopsys.com>
+
+ * parse.y (class_head_defn): Set CLASSTYPE_DECLARED_CLASS for
+ anonymous structs.
+
+2002-11-29 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (walk_subobject_offsets): Recur on binfos as well as on
+ types.
+ (layout_nonempty_base_or_field): Pass it a binfo when processing a
+ base class.
+ (layout_empty_base): Likewise.
+ (build_base_field): Likewise.
+
+2002-11-27 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_base_field): Make sure we get the canonical base
+ when descending through primary bases.
+
+2002-11-26 Geoffrey Keating <geoffk@apple.com>
+
+ * decl.c (check_initializer): Don't error on initialisation of
+ a scalar with a brace-enclosed expression.
+
+2002-11-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (DECL_LANG_FLAG_4): Document more uses.
+ (template_parms_equal): Remove prototype.
+ * typeck.c (buuld_indirect_ref): Reformat.
+
+2002-11-25 Jason Merrill <jason@redhat.com>
+
+ * init.c (build_vec_init): Use a FOR_STMT instead of an IF_STMT
+ and a DO_STMT.
+
+2002-11-25 Mark Mitchell <mark@codesourcery.com>
+
+ * tree.c (cp_build_qualified_type_real): Correct handling of
+ array types.
+ * class.c (walk_subobject_offsets): Fix thinko.
+ (build_base_field): Record offsets of empty bases in primary
+ virtual bases.
+ (layout_class_type): Record offsets of empty bases in fields.
+
+ * search.c (is_subobject_of_p_1): Fix thinko.
+ (lookup_field_queue_p): Likewise.
+
+2002-11-24 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_class_type): Reuse tail padding when laying out
+ virtual bases.
+
+2002-11-22 Mark Mitchell <mark@codesourcery.com>
+
+ * rtti.c (qualifier_flags): Fix thinko.
+
+2002-11-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ Remove traditional C constructs 1/n.
+ * cp-tree.h (init_method, set_mangled_name_for_decl,
+ build_opfncall, hack_identifier, make_thunk, use_thunk,
+ synthesize_method, implicitly_declare_fn,
+ skip_artificial_parms_for, optimize_function, calls_setjmp_p,
+ maybe_clone_body): Remove use of PARAMS.
+
+ * method.c (do_build_assign_ref, do_build_copy_constructor,
+ synthesize_exception_spec, locate_dtor, locate_ctor, locate_copy):
+ Likewise.
+ (synthesize_method): Use 'bool' type and constants instead of
+ 'int'.
+ (locate_copy): Likewise.
+ (implicitly_declare_fn): Likewise.
+
+ * optimize.c (calls_setjmp_r, update_cloned_parm, dump_function):
+ Remove old-style declaration.
+ (maybe_clone_body): Use 'bool' type and constants.
+
+2002-11-21 Glen Nakamura <glen@imodulo.com>
+
+ PR c++/8342
+ * typeck.c (get_member_function_from_ptrfunc): Make sure that a
+ SAVE_EXPR for instance_ptr doesn't get evaluated first inside one
+ of the branches of a COND_EXPR.
+
+2002-11-19 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (for_each_template_parm): Free allocated memory.
+ * search.c (is_subobject_of_p_1): New function.
+ (is_subobject_of_p): Avoid walking virtual bases multiple times.
+
+2002-11-19 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * g++spec.c (lang_specific_spec_functions): New.
+
+2002-11-15 Kazu Hirata <kazu@cs.umass.edu>
+
+ * ChangeLog: Follow spelling conventions.
+ * class.c: Likewise.
+ * decl2.c: Likewise.
+
+2002-11-14 Zack Weinberg <zack@codesourcery.com>
+
+ * search.c (dfs_push_decls): Do not try to reorder elements
+ 3..n of method_vec if method_vec has only two elements.
+ Reverse order of two tests to avoid accessing unallocated
+ memory.
+
+2002-11-14 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (dfs_find_final_overrider): Adjust so that the most
+ derived object is a binfo, rather than a class type.
+ (find_final_overrider): Likewise.
+ (add_vcall_offset_vtbl_entries_1): Simplify accordingly.
+ (add_vcall_offset): Likewise.
+
+2002-11-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/8389
+ * pt.c (instantiate_template): Push class scope for member
+ functions.
+ (get_mostly_instantiated_function_type): Likewise. Don't call
+ tsubst on context. Remove CONTEXTP and TPARMSP parameters.
+ * cp-tree.h (get_mostly_instantiated_function_type): Adjust.
+ * mangle.c (write_encoding, write_unqualified_name): Adjust.
+
+2002-11-07 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (add_vcall_offset_vtbl_entries_1): Correct ordering of
+ vcall offfsets. Split out ...
+ (add_vcall_offset): ... new function.
+
+ PR c++/8338
+ * pt.c (for_each_template_parm): Add htab parameter.
+ (process_partial_specialization): Adjust call.
+ (push_template_decl_real): Likewise.
+ (pair_fn_data): Add visited.
+ (for_each_template_parm_r): Avoid walking duplicates more than
+ once.
+ (uses_template_parms): Adjust call to for_each_template_parm.
+
+2002-11-07 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (add_implicitly_declared_members): Put implicitly
+ declared functions at the end of TYPE_METHODs when -fabi-version
+ is at least 2.
+
+2002-11-05 Geoffrey Keating <geoffk@apple.com>
+
+ * decl2.c (finish_file): Correct spelling.
+
+2002-11-03 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_special_member_call): Do not try to lookup VTTs by
+ name.
+ * class.c (vtbl_init_data): Add generate_vcall_entries.
+ (get_vtable_decl): Do not look up virtual tables by name.
+ (copy_virtuals): Do not use BV_USE_VCALL_INDEX_P.
+ (set_primary_base): Do not set CLASSTYPE_RTTI.
+ (determine_primary_base): Likewise.
+ (get_matching_virtual): Remove.
+ (get_vcall_index): New function.
+ (update_vtable_entry_for_fn): Do not try to use virtual thunks
+ when they are not required. Assign vcall indices at this point.
+ (finish_struct_1): Do not set CLASSTYPE_NEEDS_VIRTUAL_REINIT.
+ Do update dynamic_classes.
+ (build_vtt): Do not add VTTs to the symbol table.
+ (build_ctor_vtbl_group): Likewise.
+ (build_vtbl_initializer): Simplify handling of vcall indices.
+ (build_vcall_offset_vtbl_entries): Pretend to build vcall offsets
+ for the most derived class.
+ (add_vcall_offset_vtbl_entries_1): But do not actually add them to
+ the vtable.
+ * cp-tree.h (dynamic_classes): New macro.
+ (lang_type_class): Remove rtti. Add vtables. Add vcall_indices.
+ (CLASSTYPE_RTTI): Remove.
+ (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Remove.
+ (CLASSTYPE_VCALL_INDICES): New macro.
+ (CLASSTYPE_VTABLES): Likewise.
+ (BV_USE_VCALL_INDEX_P): Remove.
+ (build_vtable_path): Remove.
+ * decl2.c (finish_vtable_vardecl): Remove.
+ (key_method): Remove #if 0'd code.
+ (finish_vtable_vardecl): Rename to ...
+ (maybe_emit_vtables): ... this.
+ (finish_file): Use it.
+ * search.c (look_for_overrides_here): Update comment.
+
+2002-11-01 Zack Weinberg <zack@codesourcery.com>
+
+ PR c/7353 redux
+ * decl2.c (grokfield): Reject TYPE_DECLs with initializers.
+
+2002-10-30 Jason Merrill <jason@redhat.com>
+
+ PR c++/8186
+ * cp-tree.h (ADDR_IS_INVISIREF): New macro.
+ * call.c (convert_for_arg_passing): Set it.
+ * except.c (stabilize_throw_expr): Recurse for such an arg.
+
+2002-10-31 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_decl_flags): Remove init_priority.
+ (lang_decl): Add delta.
+ (GLOBAL_INIT_PRIORITY): Remove.
+ (THUNK_DELTA): Revise definition.
+ * decl2.c (start_objects): Don't set GLOBAL_INIT_PRIORITY.
+ * dump.c (cp_dump_tree): Don't dump it.
+
+2002-10-30 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8160
+ * typeck2.c (process_init_constructor): Call complete_array_type.
+
+ PR c++/8149
+ * decl.c (make_typename_type): Issue errors about invalid results.
+
+2002-10-30 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ Core issue 287, PR c++/7639
+ * cp-tree.h (lang_type_class): Add decl_list field.
+ (CLASSTYPE_DECL_LIST): New macro.
+ (maybe_add_class_template_decl_list): Add declaration.
+ * class.c (duplicate_tag_error): Initialize CLASSTYPE_DECL_LIST.
+ (unreverse_member_declarations): Reverse CLASSTYPE_DECL_LIST.
+ (maybe_add_class_template_decl_list): New function.
+ (add_implicitly_declared_members): Use it.
+ * decl.c (maybe_process_template_type_declaration): Likewise.
+ (pushtag): Likewise.
+ * friend.c (add_friend): Likewise.
+ (make_friend_class): Likewise.
+ * semantics.c (finish_member_declaration): Likewise.
+ (begin_class_definition): Initialize CLASSTYPE_DECL_LIST.
+ * pt.c (instantiate_class_template): Use CLASSTYPE_DECL_LIST
+ to process members and friends in the order of declaration.
+
+2002-10-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8287
+ * decl.c (finish_destructor_body): Create the label to jump to
+ when returning from a destructor here.
+ (finish_function_body): Rather than here.
+
+2002-10-25 Zack Weinberg <zack@codesourcery.com>
+
+ PR c++/7266
+ * decl.c (grokdeclarator): Check that TREE_OPERAND 0 of a
+ SCOPE_REF is not null before dereferencing it.
+
+2002-10-25 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_over_call): Use DECL_CONTEXT, not
+ DECL_VIRTUAL_CONTEXT.
+ * class.c (modify_vtable_entry): Don't mess with
+ DECL_VIRTUAL_CONTEXT.
+ (set_vindex): Remove.
+ (set_primary_base): Remove vfuns_p parameter.
+ (determine_primary_base): Likewise.
+ (modify_all_vtables): Likewise.
+ (layout_class_type): Likewise. Adjust calls to other functions
+ accordingly.
+ (finish_struct_1): Adjust calls to modified functions. Set
+ DECL_VINDEX here.
+ * cp-tree.h (lang_type_class): Remove vsize.
+ (CLASSTYPE_VSIZE): Remove.
+ (lang_decl): Remove thunks.
+ (DECL_THUNKS): Adjust.
+ (DECL_VIRTUAL_CONTEXT): Remove.
+ (duplicate_decls): Don't copy it.
+ * pt.c (build_template_decl): Don't set it.
+ (tsubst_decl): Likewise.
+ * typeck.c (expand_ptrmemfunc_cst): Don't use it.
+
+ * class.c (build_vtbl_initializer): Don't use build_vtable_entry.
+ (build_vtable_entry): Remove.
+ * cp-tree.h (BINFO_VIRTUALS): Expand documentation.
+ (lang_decl): Add thunks.
+ (DECL_THUNKS): New macro.
+ * decl.c (duplicate_decls): Copy it.
+ * method.c (make_thunk): Simplify, and add thunks to DECL_THUNKS.
+ * semantics.c (emit_associated_thunks): Simplify.
+
+2002-10-24 David Edelsohn <edelsohn@gnu.org>
+
+ PR c++/7228
+ * cp-tree.h (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Check that
+ lang_type structure exists before accessing field.
+ (SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT): New macro.
+ (CLASSTYPE_REF_FIELDS_NEED_INIT): Similar.
+ (SET_CLASSTYPE_REF_FIELDS_NEED_INIT): New macro.
+ * class.c (check_field_decls): Use new macros.
+ * typeck2.c (process_init_constructor): Remove redundant check for
+ existence of lang_type structure.
+
+2002-10-24 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (end_of_base): New method.
+ (end_of_class): Use it. Check indirect virtual bases.
+
+ * class.c (check_field_decls): Fix typo.
+
+2002-10-23 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8067
+ * decl.c (maybe_inject_for_scope_var): Ignore __FUNCTION__ and
+ related variables.
+
+ PR c++/7679
+ * spew.c (next_token): Do not return an endless stream of
+ END_OF_SAVED_INPUT tokens.
+ (snarf_method): Add three END_OF_SAVED_INPUT tokens to the end of
+ the cached token stream.
+ (snarf_defarg): Likewise.
+
+2002-10-23 Zack Weinberg <zack@codesourcery.com>
+
+ * cp-lang.c (cp_var_mod_type_p): New: C++ hook for
+ variably_modified_type_p.
+ * cp-tree.h: Remove prototype of variably_modified_type_p.
+ * tree.c (variably_modified_type_p): Remove; now implemented
+ in language-independent code.
+
+2002-10-22 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/6579
+ * spew.c (snarf_parenthesized_expression): New function.
+ (snarf_block): Use it.
+
+2002-10-22 Richard Henderson <rth@redhat.com>
+
+ * method.c (use_thunk): Always compute vcall_value; assert that
+ it is not zero. Use can_output_mi_thunk; use output_mi_thunk
+ for vcall thunks as well.
+
+2002-10-21 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (empty_base_at_nonzero_offset_p): New function.
+ (layout_nonempty_base_or_field): Do not check for conflicts when
+ laying out a virtual base using the GCC 3.2 ABI.
+ (build_base_field): Correct checking for presence of empty classes
+ at nonzero offsets when clearing CLASSTYPE_NEARLY_EMPTY_P.
+
+ * class.c (include_empty_classes): Use normalize_rli.
+ (layout_class_type): Likewise.
+
+ * decl.c (reshape_init): Tweak handling of character arrays.
+
+ PR c++/8218
+ * cp-tree.h (lang_type_class): Add contains_empty_class_p.
+ (CLASSTYPE_CONTAINS_EMPTY_CLASS_P): New macro.
+ * class.c (check_bases): Update CLASSTYPE_CONTAINS_EMPTY_CLASS_P.
+ (check_field_decls): Likewise.
+ (layout_class_type): Likewise.
+ (finish_struct_1): Initialize it.
+ (walk_subobject_offsets): Use it to prune searches.
+
+2002-10-20 Mark Mitchell <mark@codesourcery.com>
+
+ * method.c (use_thunk): Compute the vcall index as a HOST_WIDE_INT.
+ * optimize.c (optimize_function): Replace ASM_OUTPUT_MI_THUNK with
+ TARGET_ASM_OUTPUT_MI_THUNK in comments.
+
+2002-10-18 Zack Weinberg <zack@codesourcery.com>
+
+ * decl.c (start_decl): Point users of the old initialized-
+ typedef extension at __typeof__.
+
+2002-10-18 Mark Mitchell <mark@codesourcery.com>
+
+ * Make-lang.in (method.o): Depend on TARGET_H.
+ * method.c (target.h): Include it.
+ (use_thunk): Use target hooks. Use vcall thunks, if available.
+
+2002-10-18 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (base_derived_from): Make sure return value is a bool.
+
+2002-10-18 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (find_final_overrider_data_s): Remove overriding_fn and
+ overriding_base.
+ (dfs_base_derived_from): New function.
+ (base_derived_from): Likewise.
+ (dfs_find_final_overrider): Use base_derived_from.
+ (find_final_overrider): Adjust.
+
+2002-10-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/8080
+ * semantics.c (finish_for_cond, finish_while_cond): Don't mess
+ with condition decls in a template.
+
+2002-10-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (add_method): Compare template parms too.
+
+2002-10-17 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7584
+ * class.c (handle_using_decl): Allow the declaration used to be
+ from an ambiguous base.
+
+ * pt.c (convert_template_argument): Revert this change:
+ 2002-10-16 Mark Mitchell <mark@codesourcery.com>
+ * pt.c (convert_template_argument): Do not fold non-type
+ template rguments when inside a template.
+
+ * init.c (expand_default_init): Handle brace-enclosed initializers
+ correctly.
+
+2002-10-16 Mark Mitchell <mark@codesourcery.com>
+
+ * mangle.c (write_expression): Correct handling of enumeration
+ constants.
+ (write_template_arg): Likewise.
+ * pt.c (convert_template_argument): Do not fold non-type template
+ arguments when inside a template.
+
+ PR c++/7478
+ * cvt.c (convert_to_reference): Allow references as the incoming
+ type.
+
+2002-10-16 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7524
+ * method.c (do_build_assign_ref): Use cp_build_qualified_type, not
+ build_qualified_type.
+
+2002-10-15 Richard Henderson <rth@redhat.com>
+
+ * error.c (dump_expr): Use real_to_decimal directly, and with
+ the new arguments.
+
+2002-10-15 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (reshape_init): Fix typo.
+
+ * cp-tree.h (operator_name_info_t): Add arity.
+ * lex.c (init_operators): Initialize it.
+ * mangle.c (write_conversion_operator_name): New function.
+ (write_unqualified_name): Use it.
+ (write_template_args): Accept template arguments as a TREE_LIST.
+ (write_expression): Adjust handling of qualified names to match
+ specification.
+
+2002-10-15 Jason Merrill <jason@redhat.com>
+
+ * call.c (call_builtin_trap): New fn.
+ (convert_arg_to_ellipsis): Use it. Downgrade error to warning.
+ (build_call): Don't set current_function_returns_abnormally outside
+ a function.
+
+2002-10-14 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (check_field_decls): Remove empty_p parameter. Instead,
+ clear CLASSTYPE_EMPTY_P.
+ (build_base_field): Likewise.
+ (build_base_fields): Likewise.
+ (check_bases_and_members): Likewise.
+ (create_vtbl_ptr): Likewise.
+ (layout_class_type): Likewise. Ensure that empty classes have
+ size zero when used as base classes in the 3.2 ABI.
+ (finish_struct_1): Initialize CLASSTYPE_EMPTY_P and
+ CLASSTYPE_NEARLY_EMPTY_P. Adjust calls to avoid passing empty_p
+ parameter.
+ (is_empty_class): Correct definition when using post-3.2 ABI.
+ * cp-tree.h (lang_type_class): Add empty_p.
+ (CLASSTYPE_EMPTY_P): New macro.
+
+2002-10-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * init.c (build_delete): Do not apply save_expr for arrays.
+ (build_vec_delete): Likewise.
+
+2002-10-14 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (layout_var_decl): Call layout_decl even for variables
+ whose type is an array with unspecified bounds.
+
+ PR c++/7176
+ * lex.c (do_identifier): Add another option for the parsing
+ parameter.
+ * parse.y (do_id): Use it.
+
+2002-10-11 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PRs C++/6803, C++/7721 and C++/7803
+ * decl.c (grokdeclarator): Gracefully handle template-name as
+ decl-specifier.
+
+2002-10-11 Jason Molenda <jmolenda@apple.com>
+
+ * init.c (build_field_list): Provide uses_unions_p with a default
+ value.
+
+2002-10-11 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/5661
+ * cp-tree.h (variably_modified_type_p): New function.
+ (grokdeclarator) Tighten check for variably modified types as
+ fields.
+ * pt.c (convert_template_argument): Do not allow variably modified
+ types as template arguments.
+ * tree.c (variably_modified_type_p): New function.
+
+ * NEWS: Document removal of "new X = ..." extension.
+ * class.c (initialize_array): Set TREE_HAS_CONSTRUCTOR on
+ brace-enclosed initializers.
+ * cp-tree.h (CP_AGGREGATE_TYPE_P): New macro.
+ (initialize_local_var): Remove declaration.
+ (expand_static_init): Likewise.
+ * decl.c (next_initializable_field): New function.
+ (reshape_init): Likewise.
+ (check_initializer): Use them. Build dynamic initializer for
+ aggregates here too.
+ (initialize_local_var): Simplify, and incorporate cleanup
+ insertion code as well.
+ (destroy_local_var): Remove.
+ (cp_finish_decl): Tidy.
+ (expand_static_init): Fold checks for whether or not a variable
+ needs initialization into this function. Simplify.
+ * decl2.c (do_static_initialization): Simplify.
+ * init.c (build_init): Do not set TREE_SIDE_EFFECTS when it will
+ be done for us automatically.
+ (expand_default_init): Handle brace-enclosed initializers
+ correctly.
+ (expand_aggr_init_1): Remove RTL-generation code.
+ (build_vec_init): Remove "new X = ..." support.
+ * parse.y (new_initializer): Likewise.
+ * rtti.c (get_pseudo_ti_init): Set TREE_HAS_CONSTRUCTOR on
+ brace-enclosed initializer.
+ (create_pseudo_type_info): Likewise.
+ * typeck2.c (store_init_value): Don't try to handle digest_init
+ being called more than once.
+ (digest_init): Tidy handling of brace-enclosed initializers.
+
+2002-10-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c (typename_hash): Use htab_hash_pointer.
+
+2002-10-10 Jim Wilson <wilson@redhat.com>
+
+ * decl.c (duplicate_decls): Don't call decl_attributes.
+
+2002-10-09 Zack Weinberg <zack@codesourcery.com>
+
+ PR c/7353
+ * decl.c (start_decl): Unconditionally issue error for
+ 'typedef foo = bar'.
+ (cp_finish_decl): Remove special case for TYPE_DECL with initializer.
+ (grokdeclarator): Remove redundant error for 'typedef foo = bar'.
+
+2002-10-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl2.c (prune_vtable_vardecl): Delete unused function.
+
+2002-10-03 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7754
+ * decl2.c (finish_anon_union): Do not expand anonymous unions when
+ procesing template functions.
+ * pt.c (tsubst_decl, case VAR_DECL): Try to complete the variable
+ type. Call layout_decl.
+ (tsubst_expr, case DECL_STMT): Handle anonymous unions.
+
+2002-10-07 Richard Henderson <rth@redhat.com>
+
+ * decl2.c, pt.c: Revert c++/7754 fix.
+
+2002-10-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/7804
+ * error.c (dump_expr) [REAL_CST]: Output in decimal format.
+
+2002-10-03 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7931
+ * pt.c (for_each_template_parm_r): Handle BASELINKs.
+
+ PR c++/7754
+ * decl2.c (finish_anon_union): Do not expand anonymous unions when
+ procesing template functions.
+ * pt.c (tsubst_decl, case VAR_DECL): Try to complete the variable
+ type. Call layout_decl.
+ (tsubst_expr, case DECL_STMT): Handle anonymous unions.
+
+2002-10-03 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/8006
+ * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Handle instances of template
+ template parameters.
+ (globals): Add entity and need_abi_warning.
+ (decl_is_template_id): Use TYPE_TEMPLATE_INFO, not
+ CLASSTYPE_TEMPLATE_INFO.
+ (is_std_substitution): Use CLASSTYPE_TI_TEMPLATE, not
+ TYPE_TI_TEMPLATE.
+ (write_prefix): Handle typename types correctly.
+ (write_template_prefix): Handle template template parameters
+ correctly.
+ (start_mangling): Add entity parameter.
+ (finish_mangling): Warn about names whose mangling will change.
+ (mangle_decl_string): Adjust.
+ (mangle_type_string): Likewise.
+ (mangle_special_for_type): Likewise.
+ (mangle_ctor_vtbl_for_type): Likewise.
+ (mangle_thunk): Likewise.
+ (mangle_guard_variable): Likewise.
+ (mangle_ref_init_variable): Likewise.
+
+2002-10-02 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7188.
+ * cp-tree.def (CTOR_INITIALIZER): Use one slot, not two.
+ * cp-tree.h (emit_base_init): Rename to ....
+ (emit_mem_initializers): ... this.
+ (expand_member_init): Change prototype.
+ * init.c (perform_member_init): Compute explicit, rather than
+ requiring it as a parameter.
+ (sort_member_init): Rename to ...
+ (sort_mem_initializers): ... this. Process bases and data members
+ together.
+ (sort_base_init): Remove.
+ (emit_base_init): Rename to ...
+ (emit_mem_initializers): ... this.
+ (expand_aggr_vbase_init_1): Remove.
+ (construct_virtual_bases): Rename to ...
+ (construct_virtual_base): ... this.
+ (expand_member_init): Rework handling of base initializers.
+ * method.c (do_build_copy_constructor): Use
+ finish_mem_initializers.
+ * parse.y (member_init): Adjust calls to expand_member_init.
+ * pt.c (tsubst_expr): Simplify CTOR_INITIALIZER case.
+ (tsubst_initializer_list): Use expand_member_init.
+ * semantics.c (finish_mem_intiailizers): Simplify.
+
+2002-10-02 Matt Austern <austern@apple.com>
+ * decl.c (walk_vtables_r): Fixed typo that caused result to
+ never get a nonzero value.
+
+2002-10-02 Roger Sayle <roger@eyesopen.com>
+
+ PR optimization/6627
+ * cp-tree.h (enum ptrmemfunc_vbit_where_t): Delete definition
+ from here, and move it to tree.h.
+ * decl.c (cxx_init_decl_processing): If storing the vbit
+ in function pointers, ensure that force_align_functions_log
+ is atleast one.
+
+2002-10-02 Matt Austern <austern@apple.com>
+
+ * class.c (check_field_decls): Changed warning about const member
+ variables so that it doesn't get issued for a class aggregate.
+
+2002-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (cp_finish_decl): Make sure array types are laid out,
+ even if the array bounds are unknown.
+
+2002-10-01 Steve Ellcey <sje@cup.hp.com>
+
+ * class.c (build_vtbl_initializer): Change build_c_cast
+ to build1.
+
+2002-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (cp_finish_decl): Make sure array types are laid out,
+ even if the array bounds are unknown.
+
+ * decl.c (cp_finish_decl): Correct check for dynamic
+ initialization of thread-local storage.
+
+2002-09-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tree.c (really_overloaded_fn): TEMPLATE_ID_EXPRs are also
+ overloaded.
+
+2002-09-30 Steve Ellcey <sje@cup.hp.com>
+
+ * class.c (build_vtbl_initializer): Add cast.
+ (add_vcall_offset_vtbl_entries_1):
+ Use TARGET_VTABLE_DATA_ENTRY_DISTANCE for offset.
+
+2002-09-30 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (walk_subobject_offsets): Correct the calculation of
+ offsets for virtual bases. Correct the counting of array
+ elements.
+ (layout_nonempty_base_or_field): Simplify. Correct the
+ calculation of offsets to be propagated through the binfo
+ hierarchy.
+ (build_base_field): Avoid creating a FIELD_DECL for empty bases.
+ Add the FIELD_DECL to TYPE_FIELDS.
+ (build_base_fields): Adjust accordingly.
+ (layout_virtual_bases): Use build_base_field.
+ (end_of_class): Return a tree, not an integer.
+ (warn_about_ambiguous_direct_bases): Rename to ...
+ (warn_about_ambiguous_bases): ... this.
+ (include_empty_classes): New function.
+ (layout_class_type): Create an alternative version of the type to
+ be used when as a base class type. Do not call
+ finish_record_layout until we are done laying out the class.
+ * cp-tree.h (lang_type_class): Remove size, size_unit. Add
+ as_base.
+ (CLASSTYPE_SIZE): Reimplement.
+ (CLASSTYPE_SIZE_UNIT): Likewise.
+ (CLASSTYPE_ALIGN): Likweise.
+ (CLASSTYPE_USER_ALIGN): Likewise.
+ (CLASSTYPE_AS_BASE): New macro.
+ (DECL_INITIALIZED_P): Likewise.
+ (extract_init): Remove prototype.
+ (build_forced_zero_init): Rename to ...
+ (build_zero_init): ... this.
+ (force_store_init_value): Remove.
+ * decl.c (obscure_complex_init): Remove.
+ (duplicate_decls): Copy DECL_INITIALIZED_P.
+ (check_initializer): Do not leave junk in DECL_INITIAL.
+ (cp_finish_decl): Handle zero-initialization of entities with
+ static storage duration.
+ * expr.c (extract_init): Remove.
+ * init.c (build_forced_zero_init): Remove.
+ (build_zero_init): New function.
+ (build_default_init): Use it.
+ (build_field_list): Skip FIELD_DECLs for base subobjects.
+ (push_base_cleanups): Likewise.
+ * method.c (do_build_assign_ref): Likewise.
+ (synthesize_exception_spec): Likewise.
+ * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P.
+ (regenerate_decl_from_template): To not set DECL_INITIAL for a
+ static data member whose initialization took place in its class.
+ (instantiate_decl): Do not pass an initializer to cp_finish_decl
+ in that situation.
+ * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects.
+ (dfs_unuse_fields): Likewise.
+ * tree.c (pod_type_p): Handle error_mark_node.
+ (zero_init_p): Likewise.
+ * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base
+ subobjects.
+ * typeck2.c (store_init_value): Remove #if 0'd code.
+ (force_store_init_value): Remove.
+ (process_init_constructor): Use build_zero_init.
+
+2002-09-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/7788
+ * rtti.c (unemitted_tinfo_decl_p): Check it has a field.
+
+2002-09-29 Kazu Hirata <kazu@cs.umass.edu>
+
+ * cp-tree.h: Fix comment typos.
+ * decl.c: Likewise.
+ * pt.c: Likewise.
+
+2002-09-25 Mark Mitchell <mark@codesourcery.com>
+
+ * cp/class.c (contains_empty_class_p): New method.
+ (walk_subobject_offsets): Correct computation of field offset.
+ (layout_empty_base): Correct placement of emtpy base classes.
+ (layout_class_type): Warn about ABI changes.
+
+2002-09-23 Mark Mitchell <mark@codesourcery.com>
+
+ * cp/class.c (layout_virtual_bases): Do not round the size of the
+ type to a multiple of the alignment before laying out virtual bases.
+ (layout_class_type): Correct handling of bit-fields that are wider
+ than their type inside unions. Round the size of the type to a
+ even number of bytes when computing the size without virtual
+ bases.
+ * cp/cp-tree.h (abi_version_at_least): New macro.
+
+2002-09-21 Kazu Hirata <kazu@cs.umass.edu>
+
+ * ChangeLog: Follow spelling conventions.
+ * ChangeLog.2: Likewise.
+ * call.c: Likewise.
+ * class.c: Likewise.
+ * cp-tree.h: Likewise.
+ * cvt.c: Likewise.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * except.c: Likewise.
+ * friend.c: Likewise.
+ * g++spec.c: Likewise.
+ * init.c: Likewise.
+ * lex.c: Likewise.
+ * mangle.c: Likewise.
+ * method.c: Likewise.
+ * operators.def: Likewise.
+ * optimize.c: Likewise.
+ * pt.c: Likewise.
+ * rtti.c: Likewise.
+ * search.c: Likewise.
+ * semantics.c: Likewise.
+ * spew.c: Likewise.
+ * tree.c: Likewise.
+ * typeck.c: Likewise.
+
+2002-09-18 Devang Patel <dpatel@apple.com>
+
+ * cp/cp-tree.h: New prototype for walk_vtabls().
+ * cp/decl.c (walk_vtables_r): New function.
+ (struct cp_binding_level): Add new members, namespaces,
+ names_size and vtables.
+ (add_decl_to_level): Add decl in namespaces or vtables
+ chain, if conditions match.
+ (walk_vtables): New function.
+ (walk_namespaces_r): Travers separate namespace chain
+ for namespace decls.
+ (wrapup_globals_for_namespace): Use names_size instead
+ of list_length().
+ * cp/decl2.c (finish_file): Use walk_vtables() instead of
+ walk_globals() to walk vtable decls.
+
+2002-09-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Use assert, not internal_error. Don't
+ ICE with invalid pointers & references.
+
+2002-09-17 Zack Weinberg <zack@codesourcery.com>
+
+ * Make-lang.in: Remove all references to the demangler.
+ * cxxfilt.c: Moved to binutils.
+
+2002-09-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/7718
+ * pt.c (tsubst_decl): Remove assert.
+
+ Remove DR 295 implementation.
+ * pt.c (check_cv_quals_for_unify): Disable function & method cases.
+ * tree.c (cp_build_qualified_type_real): Likewise. Don't warn
+ about ignoring volatile qualifiers.
+
+ * search.c (lookup_member): Correct documentation.
+
+2002-09-16 Geoffrey Keating <geoffk@apple.com>
+
+ * cp-tree.h (union lang_tree_node): Add chain_next option.
+
+2002-09-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (parse_finish_call_expr): Check lookup_member result.
+
+ PR c++/7015
+ * semantic.c (finish_asm_stmt): Fix operand/output_operands
+ thinko.
+ * typeck.c (c_expand_asm_operands): Protect from error_mark_node.
+
+2002-09-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/7919
+ * call.c (build_over_call): Convert this pointer for fns found by
+ using decls.
+
+2002-09-15 Kazu Hirata <kazu@cs.umass.edu>
+
+ * ChangeLog: Follow spelling conventions.
+ * ChangeLog.1: Likewise.
+
+2002-09-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/7768
+ * pt.c (build_template_decl): Copy DECL_DESTRUCTOR_P.
+
+2002-09-14 Kazu Hirata <kazu@cs.umass.edu>
+
+ * error.c: Fix comment formatting.
+ * except.c: Likewise.
+ * expr.c: Likewise.
+ * friend.c: Likewise.
+ * g++spec.c: Likewise.
+ * init.c: Likewise.
+ * lex.c: Likewise.
+ * mangle.c: Likewise.
+ * method.c: Likewise.
+ * optimize.c: Likewise.
+ * pt.c: Likewise.
+ * rtti.c: Likewise.
+ * search.c: Likewise.
+ * semantics.c: Likewise.
+ * spew.c: Likewise.
+ * tree.c: Likewise.
+ * typeck.c: Likewise.
+ * typeck2.c: Likewise.
+
+2002-09-13 Matt Austern <austern@apple.com>
+
+ PR C++/7828
+ * cp/cp-tree.h, cp/tree.c: New function non_cast_lvalue_p.
+ * cp/call.c: Change call-by-const-reference mechanism to use
+ non_cast_lvalue_p when deciding whether the create a temporary.
+ We need a temporary when passing, e.g. (long) x by const ref.
+
+2002-09-13 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (unify, ARRAY_TYPE): Element type can be more qualified.
+
+2002-09-13 Kazu Hirata <kazu@cs.umass.edu>
+
+ * decl.c: Fix comment formatting.
+ * decl2.c: Likewise.
+
+2002-09-12 Kazu Hirata <kazu@cs.umass.edu>
+
+ * call.c: Fix comment formatting.
+ * class.c: Likewise.
+ * cp-lang.c: Likewise.
+ * cp-tree.h: Likewise.
+ * cvt.c: Likewise.
+
+2002-09-11 Zack Weinberg <zack@codesourcery.com>
+
+ * Make-lang.in: Build cp/cxxfilt.o from $(srcdir)/cp/cxxfilt.c,
+ and c++filt from cxxfilt.o + version.o + $(LIBDEPS).
+ * cxxfilt.c: New file: split from libiberty/cplus-dem.c, with
+ minor adjustments (use version_string, eliminate yet another
+ duplicate of xmalloc)
+
+2002-09-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (require_complete_eh_spec_types): Add prototype.
+
+2002-09-05 Jason Merrill <jason@redhat.com>
+
+ * typeck2.c (add_exception_specifier): Only pedwarn for an
+ incomplete type.
+ (require_complete_eh_spec_types): New fn.
+ (cxx_incomplete_type_diagnostic): Also support pedwarning.
+ * typeck.c (complete_type_or_diagnostic): Likewise.
+ * call.c (build_call): Call require_complete_eh_spec_types.
+ * rtti.c (get_pseudo_ti_desc): Give an error rather than aborting
+ on an incomplete type.
+
+2002-09-04 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (start_cleanup_fn): Clear interface_only before
+ start_function, restore it afterwards.
+
+2002-09-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (finish_builtin_type): Remove.
+ * decl2.c (finish_builtin_type): Move to common code.
+ * decl.c (build_ptrmemfunc_type): Adjust.
+ * rtti.c (create_pseudo_type_info): Adjust.
+ (create_tinfo_types): Adjust.
+
+2002-08-31 Jason Merrill <jason@redhat.com>
+
+ * cp-lang.c (cp_expr_size): Allow initialization from a
+ CONSTRUCTOR.
+
+2002-08-30 Richard Henderson <rth@redhat.com>
+
+ PR opt/7515
+ * tree.c: Include target.h.
+ (cp_cannot_inline_tree_fn): Don't auto-inline functions that
+ don't bind locally.
+ * Makefile.in (tree.o): Update.
+
+2002-08-27 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_virtual_bases): Warn about bugs in G++ that
+ result in incorrect object layouts.
+ (layout_class_type): Likewise.
+
+2002-08-24 Matt Austern <austern@apple.com>
+
+ * tree.c (lvalue_p_1): Add argument for whether casts of lvalues
+ are allowable.
+ (real_lvalue_p): Update caller.
+ (lvalue_p): Ditto.
+ (non_cast_lvalue_or_else): New.
+ * tree.h: Declare it.
+ * typeck.c (build_unary_op): Use non_cast_lvalue_or_else.
+
+2002-08-22 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck.c (build_class_member_access_expr): Handle COMPOUND_EXPR
+ and COND_EXPR specially; fix error message output.
+
+2002-08-22 Jason Merrill <jason@redhat.com>
+
+ * pt.c (tsubst_expr): RETURN_EXPR is now RETURN_STMT_EXPR.
+ * semantics.c (nullify_returns_r): Likewise.
+
+2002-08-17 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ Fix PR/7621
+ * typeck.c (finish_class_member_access_expr): Diagnose cases where
+ name lookup finds nothing.
+
+2002-08-15 Jason Merrill <jason@redhat.com>
+
+ * semantics.c (finish_then_clause): Remove redundant assignment.
+ (finish_if_stmt, begin_switch_stmt, finish_switch_stmt): Move the
+ extra binding level outside the if/switch statement.
+ (finish_while_cond, finish_for_cond): Rewrite complex condition
+ into the loop body.
+
+2002-08-15 Alexandre Oliva <aoliva@redhat.com>
+
+ * parse.y (sizeof, alignof, typeof): New non-terminals to
+ increment skip_evaluation. Replace terminals with them and
+ decrement skip_evaluation at the end of rules using them.
+ * decl2.c (mark_used): Don't assemble_external if
+ skipping evaluation.
+
+2002-08-15 Gabriel Dos Reis <gdr@nerim.net>
+
+ Fix PR/7504
+ * parse.y (parse_finish_call_expr): Handle incomplete
+ type used to name a scope.
+
+2002-08-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/7598
+ * typeck.c (build_unary_op): Fold offsetof idiom. Fixes
+ regression caused by my 2002-08-08 patch.
+
+2002-08-13 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (pushdecl_class_level): Honor requests to bind names to
+ OVERLOADs.
+
+2002-08-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl2.c (build_call_from_tree): Fix uninitialized variable.
+ * parse.y (parse_finish_call_expr): Likewise.
+ * repo.c (old_args, old_dir, old_main): Const-ify.
+
+2002-08-11 Gabriel Dos Reis <gdr@nerim.net>
+
+ * decl.c (duplicate_decls): Replace DECL_SOURCE_FILE
+ DECL_SOURCE_LINE with DECL_SOURCE_LOCATION.
+ * optimize.c (maybe_clone_body): Likewise.
+ * pt.c (tsubst_enum): Likewise.
+ (lookup_template_class): Likewise.
+ * tree.c (cp_copy_res_decl_for_inlining): Likewise.
+
+2002-08-10 Neil Booth <neil@daikokuya.co.uk>
+
+ * lang-specs.h: Remove -ansi.
+
+2002-08-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tree.c (maybe_dummy_object): Replace // with /* */
+
+2002-08-09 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (standard_conversion): Use build_ptrmem_type.
+ * cp-tree.h (build_ptrmem_type): New function.
+ (adjust_result_of_qualified_name_lookup): Likewise.
+ * decl.c (grokvardecl): Do not look for OFFSET_TYPEs to indicate
+ static data members.
+ (build_ptrmem_type): New function.
+ (grokdeclarator): Do not use build_offset_type when encountering a
+ qualified name.
+ * parse.y (parse_finish_call_expr): Use
+ adjust_result_of_qualified_name_lookup.
+ * search.c (adjust_result_of_qualified_name_lookup): New function.
+ * typeck.c (qualify_type_recursive): Use TYPE_PTRMEM_* rather than
+ accessing OFFSET_TYPEs directly.
+
+2002-08-08 Mike Stump <mrs@apple.com>
+
+ * call.c (add_builtin_candidate): legal -> valid, illegal -> invalid.
+ (type_decays_to): Likewise.
+ * class.c (find_final_overrider): Likewise.
+ (maybe_note_name_used_in_class): Likewise.
+ * decl.c (current_tmpl_spec_kind): Likewise.
+ (add_binding): Likewise.
+ (push_class_binding): Likewise.
+ (duplicate_decls): Likewise.
+ (layout_var_decl): Likewise.
+ (grokfndecl): Likewise.
+ (grokdeclarator): Likewise.
+ (check_default_argument): Likewise.
+ * decl2.c (handle_class_head): Likewise.
+ * error.c (dump_template_decl): Likewise.
+ * init.c (build_offset_ref): Likewise.
+ * pt.c (check_specialization_scope): Likewise.
+ (determine_specialization): Likewise.
+ (check_explicit_specialization): Likewise.
+ (maybe_check_template_type): Likewise.
+ (process_partial_specialization): Likewise.
+ (check_default_tmpl_args): Likewise.
+ (push_template_decl_real): Likewise.
+ (convert_template_argument): Likewise.
+ (try_class_unification): Likewise.
+ (get_bindings_real): Likewise.
+ (do_decl_instantiation): Likewise.
+ * semantics.c (begin_function_definition): Likewise.
+ (finish_member_declaration): Likewise.
+ (check_multiple_declarators): Likewise.
+ * typeck.c (comp_array_types): Likewise.
+ (comptypes): Likewise.
+ (expr_sizeof): Likewise.
+ (build_binary_op): Likewise.
+ (dubious_conversion_warnings): Likewise.
+ (check_return_expr): Likewise.
+
+2002-08-08 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck.c (build_class_member_access_expr): Do not return
+ error_mark_node when no error has occurred.
+
+2002-08-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (build_component_addr): Remove.
+ (build_unary_op): Just check it's not a bitfield, and then build
+ an ADDR_EXPR.
+
+2002-08-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (convert_to_base): Correct check for error_mark_node.
+ (create_vtable_ptr): Remove unused VFUNS_P parm.
+
+2002-08-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp/Make-lang.in (c++.mostlyclean): Remove coverage files.
+
+2002-08-07 Mark Mitchell <mark@codesourcery.com>
+
+ Rework build_component_ref.
+ * call.c (build_vfield_ref): Do not go through build_component_ref.
+ (build_field_call): Use build_class_member_access_expr.
+ (build_user_type_conversion_1): Use BASELINK_FUNCTIONS.
+ (build_object_call): Likewise.
+ * class.c (convert_to_base): New function.
+ (type_requires_array_cookie): Use BASELINK_FUNCTIONS.
+ (instantiate_type): Handle BASELINKs.
+ * cp-tree.def (BASELINK): New tree code.
+ * cp-tree.h (BASELINK_P): Reimplement.
+ (SET_BASELINK_P): Remove.
+ (BASELINK_BINFO): Reimplement.
+ (BASELINK_FUNCTIONS): Likewise.
+ (BASELINK_ACCESS_BINFO): Likewise.
+ (BASELINK_OPTYPE): Likewise.
+ (convert_to_base): New function.
+ (name_p): Likewise.
+ (build_object_ref): Remove.
+ (build_component_ref_1): Likewise.
+ (build_component_ref): Likewise.
+ (build_x_component_ref): Likewise.
+ (build_class_member_access_expr): New function.
+ (finish_class_member_access_expr): Likewise.
+ (build_ptrmemfunc_access_expr): Likewise.
+ * decl.c (grokdeclarator): Handle BASELINKs.
+ * decl2. (build_expr_from_tree): Handle COMPONENT_REFs by using
+ finish_class_member_access_expr.
+ (arg_assoc): Handle BASELINKs.
+ (do_class_using_decl): Likewise.
+ * error.c (dump_decl): Likewise.
+ (dump_expr): Use build_ptrmemfunc_access_expr.
+ * except.c (dtor_nothrow): Use CLASSTYPE_DESTRUCTORS to find
+ destructors.
+ (build_throw): Use BASELINK_FUNCTIONS.
+ * init.c (perform_member_init): Use
+ build_class_member_access_expr.
+ (build_offset_ref): Handle BASELINKs. Use
+ build_class_member_access_expr.
+ * method.c (hack_identifier): Likewise.
+ * parse.y (do_id): Use BASELINK, not TREE_LIST.
+ (primary): Remove uses of build_object_ref.
+ * pt.c (lookup_template_function): Handle BASELINKs.
+ (resolve_overloaded_unification): Likewise.
+ * search.c (build_baselink): Build a BASELINK, not a TREE_LIST.
+ (lookup_field): Use BASELINK, not TREE_LIST.
+ (lookup_fnfiels): Likewise.
+ (setup_class_bindings): Likewise.
+ * semantics.c (finish_object_call_expr): Do not use
+ build_method_call when we already know what function is being
+ called.
+ * spew.c (identifier_type): Use BASELINK, not TREE_LIST.
+ * tree.c (really_overloaded_fn): Use OVL_CHAIN for OVERLOADs, not
+ TREE_CHAIN.
+ (name_p): New function.
+ * typeck.c (build_object_ref): Remove.
+ (build_component_ref_1): Likewise.
+ (build_x_component_ref): Likewise.
+ (build_class_member_access_expr): New function.
+ (finish_class_member_access_expr): Likewise.
+ (build_ptrmemfunc_access_expr): Likewise.
+ (get_member_function_from_ptrfunc): Use
+ build_ptrmemfunc_access_expr.
+ (build_binary_op): Likewise.
+ (build_unary_op): Likewise.
+ (build_ptrmemfunc): Likewise.
+ (pfn_from_ptrmemfunc): Likewise.
+ * typeck2.c (build_m_component_ref): Adjust comment.
+
+2002-08-07 Neil Booth <neil@daikokuya.co.uk>
+
+ * Make-lang.in (CXX_C_OBJS): Update.
+ * cp-lang.c (LANG_HOOKS_DECODE_OPTION): Use c_common_decode_option.
+ * cp-tree.h (cxx_decode_option): Remove.
+ * decl2.c (compare_options, lang_f_options, unsupported_options,
+ cxx_decode_option): Remove.
+
+2002-08-06 Gabriel Dos Reis <gdr@nerim.net>
+
+ * typeck.c (build_x_unary_op): Handle pointer-to-member.
+
+2002-08-05 Geoffrey Keating <geoffk@redhat.com>
+
+ * class.c: Don't include obstack.h.
+ (popclass):
+ * decl2.c: Delete bogus comment.
+ * error.c: Don't include obstack.h.
+ * except.c: Likewise.
+ (dump_type): Correct comment.
+ * method.c: Don't include obstack.h.
+ * tree.c: Likewise.
+
+2002-08-04 Gabriel Dos Reis <gdr@nerim.net>
+
+ Fix PR/2213
+ * cvt.c (cp_convert_to_pointer): Reject conversions from integral
+ expressions to pointer-to-data-member of pointer-to-member-functions.
+
+2002-08-04 Geoffrey Keating <geoffk@redhat.com>
+
+ * cvt.c (ocp_convert): Delete obsolete code.
+ * parse.y (permanent_obstack): Delete declaration.
+ * pt.c (permanent_obstack): Delete declaration.
+ * repo.c (permanent_obstack): Delete declaration.
+ (open_repo_file): Use xmalloc instead of permanent_obstack.
+ (init_repo): Use xstrdup instead of permanent_obstack.
+
+2002-08-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (VF_DERIVED_VALUE): Remove.
+ * class.c (finish_struct_1): Use VF_BINFO_VALUE not VF_DERIVED_VALUE.
+
+2002-08-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR 7470.
+ C++ ABI change - vfunc ordering.
+ * class.c (add_virtual_function): Remove.
+ (dfs_modify_all_vtables): Take list of all declared
+ virtuals. Assign all that are not in primary base.
+ (check_for_override): Adjust comments.
+ (create_vtable_ptr): Take single list of virtuals. Build chain
+ of declared virtuals here.
+ (layout_class_type): Take single list of virtuals. Adjust.
+ (finish_struct_1): Keep virtuals on single list. Adjust.
+
+2002-08-02 Mark Mitchell <mark@codesourcery.com>
+
+ * init.c (build_member_call): Use build_new_method_call, not
+ build_method_call.
+
+2002-08-02 Krister Walfridsson <cato@df.lth.se>
+
+ * Make-lang.in (spew.o, lex.o, pt.o): Add path to parse.h dependencies.
+
+2002-08-02 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_method_call): Issue a more helpful error message
+ about ambiguous method names.
+
+2002-08-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tree.c (build_shared_int_cst): Make cache file scope, and
+ GTY it.
+
+2002-08-02 Jason Merrill <jason@redhat.com>
+
+ * cp-lang.c (LANG_HOOKS_EXPR_SIZE): Define.
+ (cp_expr_size): New fn.
+ * call.c (build_over_call): Lose empty class hackery.
+ (convert_arg_to_ellipsis): Promote non-POD warning to error.
+ * typeck.c (build_modify_expr): Don't use save_expr on an lvalue.
+
+ * semantics.c (expand_body): Do tree optimization in the function
+ context, too.
+
+2002-08-01 Neil Booth <neil@daikokuya.co.uk>
+
+ * cp-tree.h: Move all warning and flag declarations to c-common.h.
+ * decl.c: Move all warning and flag variables to c-common.c.
+ * decl2.c: Move all warning and flag variables to c-common.c.
+ * lex.c (flag_digraphs): Remove.
+ (warn_traditional): Now in c-common.c.
+
+2002-07-31 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_field_call): Do not look up the field by name.
+ (build_method_call): Simplify.
+ (struct z_candidate): Add access_path and conversion_path. Remove
+ basetype_path.
+ (convert_class_to_reference): Adjust use of
+ add_function_candidate.
+ (add_candidate): Add conversion_path argument.
+ (add_function_candidate): Use it.
+ (add_conv_dndidate): Likewise.
+ (build_builtin_candidate): Likewise.
+ (add_template_candidate_real): Add conversion_path argument.
+ (add_template_conv_candidate): Likewise.
+ (add_template_candidate): Likewise.
+ (build_user_type_conversion_1): Use it.
+ (build_new_function_call): Remove name lookup code. Adjust use of
+ add_template_candidate and add_function_candidate.
+ (build_new_op): Likewise.
+ (convert_like_real): Use build_special_member_call.
+ (build_over_call): Use cand->conversion_path.
+ (build_special_member_call): New method.
+ (build_new_method_call): Remove name lookup code.
+ * cp-tree.def (OFFSET_REF): Update documentation.
+ (TEMPLATE_ID_EXPR): Likewise.
+ * cp-tree.h (BASELINK_ACCESS_BINFO): New macro.
+ (BASELINK_OPTYPE): Likewise.
+ (build_new_method_call): Adjust prototype.
+ (build_special_member_call): New method.
+ (build_baselink): New method.
+ (build_offset_ref_call_from_tree): Likewise.
+ (build_call_from_tree): Likewise.
+ (finish_qualified_call_expr): Remove.
+ (finish_call_expr): Adjust prototype.
+ (build_x_function_call): Remove.
+ * cvt.c (ocp_convert): Use build_special_member_call.
+ * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr.
+ (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and
+ CALL_EXPR.
+ (build_offset_ref_call_from_tree): New function.
+ (build_call_from_tree): Likewise.
+ * init.c (expand_cleanup): Use build_special_member_call.
+ (expand_default_init): Likewise.
+ (build_member_call): Use finish_call_expr.
+ (build_new_1): Use build_special_member_call.
+ (push_base_cleanups): Likewise.
+ * method.c (do_build_assign_ref): Likewise.
+ * parse.y (template_id): Do not pass a COMPONENT_REF to
+ lookup_template_function.
+ (primary): Use parse_finish_call_epxr, not finish_call_expr.
+ (parse_finish_call_expr): New function.
+ * pt.c (lookup_template_function): Add assertions.
+ * search.c (lookup_base): Allow T to be a binfo.
+ (build_baselink): New function.
+ (lookup_member): Use it.
+ * semantics.c (finish_call_expr): Do not do name lookup.
+ (finish_object_call_expr): Remove #if 0'd code.
+ (finish_qualified_call_expr): Remove.
+ * typeck.c (build_x_function_call): Remove.
+ (build_static_case): Use build_special_member_call.
+ * typeck2.c (build_functional_cast): Likewise.
+
+2002-07-30 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
+
+ * lang-specs.h: Remove __GXX_ABI_VERSION, moved to gcc.c.
+
+2002-07-30 Gabriel Dos Reis <gdr@nerim.net>
+
+ * cp-tree.h (VF_DERIVED_VALUE): Restore from previous deletion.
+
+2002-07-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (CLASSTYPE_VFIELDS, VF_*, BV_*): Add more
+ documentation.
+
+2002-07-29 Alan Modra <amodra@bigpond.net.au>
+
+ * cp-tree.h: Comment typo fix.
+
+2002-07-29 Richard Earnshaw <rearnsha@arm.com>
+
+ * spew.c (space_for_token): Allocate zeroed memory for a new token
+ chunk.
+
+2002-07-27 Roger Sayle <roger@eyesopen.com>
+
+ * decl.c (builtin_function_1): No need to explicitly mark
+ BUILT_IN_RETURN and BUILT_IN_EH_RETURN as noreturn.
+
+2002-07-27 Roger Sayle <roger@eyesopen.com>
+
+ * decl2.c (cxx_decode_option): Support -fno-builtin-foo.
+
+2002-07-26 Jason Merrill <jason@redhat.com>
+
+ * call.c (build_over_call): Likewise.
+ (cp_convert_parm_for_inlining): New fn.
+ (convert_for_arg_passing): New fn.
+ (convert_default_arg, build_over_call): Use it.
+ (type_passed_as): New fn.
+ * pt.c (tsubst_decl): Use it.
+ * decl2.c (cp_build_parm_decl): New fn.
+ (build_artificial_parm): Use it.
+ (start_static_storage_duration_function): Likewise.
+ * decl.c (start_cleanup_fn, grokdeclarater): Likewise.
+ (grokparms): Don't mess with DECL_ARG_TYPE.
+ * typeck.c (convert_arguments): Use convert_for_arg_passing.
+ * cp-lang.c (LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING):
+ Define.
+ * cp-tree.h: Declare new fns.
+
+2002-07-26 Neil Booth <neil@daikokuya.co.uk>
+
+ * cp-tree.h (flag_operator_names): Remove.
+ * decl2.c (flag_operator_names): Remove.
+ (lang_f_options): Remove operator-names.
+ * lex.c (D_OPNAME): Remove.
+ (reswords): Remove operator names.
+ (rid_to_yy): Remove operator names.
+ (init_reswords): No need to handle D_OPNAME.
+ * spew.c (read_process_identifier): There are no operator
+ names.
+
+2002-07-26 Jason Merrill <jason@redhat.com>
+
+ * dump.c (cp_dump_tree): Call c_dump_tree.
+ * Make-lang.in (CXX_C_OBJS): Add c-dump.o.
+
+2002-07-25 Neil Booth <neil@daikokuya.co.uk>
+
+ * error.c (print_whitespace): Remove.
+ * g++spec.c (LIBUNWIND): Move.
+ * mangle.c (mangled_position, write_signed_number): Remove.
+
+2002-07-25 Neil Booth <neil@daikokuya.co.uk>
+
+ * decl2.c (cxx_decode_option): Similarly.
+
+2002-07-25 Gabriel Dos Reis <gdr@nerim.net>
+
+ * cp-tree.h (cxx_sizeof_nowarn): Now a macro.
+ (cxx_sizeof_or_alignof_type): Take a third argument.
+ (cxx_sizeof): Adjust definition.
+ (cxx_alignof): Likewise.
+ * init.c (build_delete): Use cxx_sizeof_nowarn to reflect reality.
+ * typeck.c (cxx_sizeof_or_alignof_type): Take a third argument for
+ complaining.
+ (c_sizeof_nowarn): Remove definition.
+ (build_unary_op): Use cxx_sizeof_nowarn.
+
+2002-07-24 Geoffrey Keating <geoffk@redhat.com>
+
+ * tree.c (cp_build_qualified_type_real): When copying
+ pointer-to-method types, unshare the record that holds
+ the cached pointer-to-member-function type.
+
+2002-07-23 Neil Booth <neil@daikokuya.co.uk>
+
+ * cp-tree.h (FILE_FUNCTION_PREFIX_LEN): Remove.
+
+2002-07-23 Gabriel Dos Reis <gdr@nerim.net>
+
+ Fix PR/7363:
+ * typeck.c (cxx_sizeof_or_alignof_type): New function.
+ (c_sizeof): Remove definition.
+ (expr_sizeof): Use cxx_sizeof.
+ * decl2.c (build_expr_from_tree): Use cxx_sizeof_or_alignof_type.
+ * decl.c (finish_destructor_body): Use cxx_sizeof.
+ * semantics.c (finish_alignof): Likewise.
+ (finish_alignof): Use cxx_alignof.
+ * cp-tree.h (cxx_sizeof, cxx_alignof): New macros.
+ (cxx_sizeof_or_alignof_type): Declare.
+ (my_friendly_assert): Move to ../c-common.h.
+
+2002-07-23 Neil Booth <neil@daikokuya.co.uk>
+
+ * class.c, method.c, pt.c, search.c: Don't define obstack macros.
+
+2002-07-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/7347, c++/7348
+ * cp-tree.h (tsubst_flags_t): Add tf_parsing.
+ * decl.c (make_typename_type): Use it.
+ (make_unbound_class_template): Likewise.
+ (lookup_name_real): Don't call type_access_control if scope is
+ template parameter dependent.
+ * parse.y (template_arg): Call make_unbound_class_template with
+ tf_parsing set.
+ (nest_name_specifier): Call make_typename_type with tf_parsing set.
+ (typename_sub0): Likewise.
+ (typename_sub1): Likewise.
+ (instantiate_decl): Push class scope.
+ * pt.c (regenerate_decl_from_template): Call pushclass and popclass
+ for both static variable and member function template.
+ (instantiate_decl) Call pushclass and popclass when tsubst'ing type
+ and arguments.
+ * search.c (type_access_control): Do type access for TEMPLATE_DECL
+ too.
+
+2002-07-20 Roger Sayle <roger@eyesopen.com>
+
+ * decl2.c (cxx_decode_option): Simplify -fhandle-exceptions
+ test by using positive_option. Make whitespace consistent.
+
+2002-07-20 Gabriel Dos Reis <gdr@nerim.net>
+
+ * spew.c (struct unparsed_test): Replace 'filename' and 'lineno'
+ members with 'locus'. Adjust use throughout.
+ (struct feed): Likewise.
+ (alloc_unparsed_test): Change prototype, take a 'const location_t *'.
+ Adjust use.
+ (snarf_defarg): Use error(), not error_with_file_and_line().
+
+2002-07-19 Chris Demetriou <cgd@broadcom.com>
+
+ * lang-specs.h (@c++): Include "%2" (cc1plus_spec) wherever
+ cpp_options is included.
+
+2002-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/2862, c++/2863
+ * pt.c (determine_specialization): Compare the length of
+ TYPE_ARG_TYPES. Tidy.
+
+2002-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/3797
+ * decl.c (duplicate_decls): Don't propagate inlining parameters from
+ olddecl to newdecl when newdecl is a specialization of the
+ instantiation olddecl.
+
+2002-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/4802, c++/5387
+ * decl.c (make_typename_type): Use enforce_access.
+
+2002-07-17 Scott Snyder <snyder@fnal.gov>
+
+ PR c++/7320
+ * rtti.c (get_tinfo_decl): Set DECL_COMDAT.
+
+2002-07-12 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (add_method): Correct handling of conversion operators.
+
+2002-07-11 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7224
+ * class.c (add_method): Simplify.
+
+2002-07-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/7279
+ * tree.c (cp_copy_res_decl_for_inlining): Also copy
+ TREE_ADDRESSABLE.
+
+2002-07-10 Graham Stott <graham.stott@btinternet.com>
+
+ * pt.c (template_parm_this_level_p, push_template_decl_real):
+ Pass depth as int pointer.
+
+2002-07-11 Tim Josling <tej@melbpc.org.au>
+
+ Remove front end hard coding from gengtype.c.
+
+ * config-lang.in (gtfiles): Add files needed for this front end.
+
+2002-07-10 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (unqualified_name_lookup_error): Declare it.
+ (begin_function_definition): Adjust prototype.
+ * lex.c (unqualified_name_lookup_error): New function, split out
+ from ...
+ (do_identifier): ... here.
+ * parse.y (parse_begin_function_definition): New function.
+ (fn.def1): Use it.
+ * semantics.c (begin_function_definition): Accept decl-specifiers
+ and attributes as separate parameters.
+
+2002-07-10 Jason Merrill <jason@redhat.com>
+
+ PR c++/6255
+ * decl.c (lookup_name_real): Build a new TYPENAME_TYPE rather than
+ modifying the old one.
+
+2002-07-09 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (constructor_name_p): Declare it.
+ (check_template_template_default_arg): Likewise.
+ * class.c (handle_using_decl): Use constructor_name_p.
+ * decl.c (grokdeclarator): Likewise.
+ * decl2.c (constructor_name_p): Define it.
+ * init.c (build_member_call): Use constructor_name_p.
+ * parse.y (template_parm): Use check_template_template_default_arg.
+ * pt.c (check_explicit_specialization): Use constructor_name_p.
+ * semantics.c (check_template_template_default_arg): New function.
+
+2002-07-08 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (can_complete_type_without_circularity): Add static to
+ function definition.
+
+2002-07-08 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (have_extern_spec): Declare it
+ * decl.c (have_extern_spec): Define it.
+ (start_decl): Eliminate use of used_extern_spec.
+ (start_function): Likewise.
+ * parse.y (have_extern_spec): Remove declaration.
+ (used_extern_spec): Likewise.
+ (frob_specs): Eliminate use of used_extern_spec.
+ (.hush_warning): Likewise.
+
+2002-07-07 Mark Mitchell <mark@codesourcery.com>
+
+ * Make-lang.in (cp/parse.o): Depend on decl.h.
+ * cp-tree.h (do_decl_instantiation): Change prototype.
+ * parse.y: Include decl.h.
+ (parse_decl_instantiation): New function.
+ (explicit_instantiation): Use it.
+ * pt.c (do_decl_instantiation): Accept a DECL, not a DECLARATOR
+ and DECLSPECS.
+
+2002-07-07 Roger Sayle <roger@eyesopen.com>
+
+ * error.c (dump_function_name): Use DECL_TEMPLATE_RESULT for
+ constructor and destructor tests when passed a TEMPLATE_DECL.
+
+2002-07-05 Jason Merrill <jason@redhat.com>
+
+ * cvt.c (cp_convert_to_pointer): Call force_fit_type for null
+ pointers.
+
+ PR optimization/7145
+ * tree.c (cp_copy_res_decl_for_inlining): Also copy DECL_INITIAL.
+
+2002-07-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ Repair damage on weak-impared targets caused by my previous patch.
+ * cp-tree.h (import_export_tinfo): Add parameter.
+ * decl2.c (import_export_tinfo): Add parameter, post adjust
+ DECL_COMDAT.
+ * rtti.c (emit_tinfo_decl): DECL_COMDAT is (nearly) always setup by
+ import_export_tinfo.
+
+2002-07-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/6944
+ * init.c (build_aggr_init): Remove qualifiers of init before calling
+ build_vec_init.
+ (build_vec_init): Flatten multi-dimensional array during cleanup.
+ (build_vec_delete_1): Abort if the type of each element is array.
+
+2002-07-03 Graham Stott <graham.stott@btinternet.com>
+
+ * pt.c (instantiate_class_template): Fix typo.
+
+2002-07-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * typeck2.c (cxx_incomplete_type_diagnostic): Fix typo caused
+ by CVS conflict in my last patch.
+
+2002-07-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/6716
+ * pt.c (can_complete_type_without_circularity): New function.
+ (instantiate_class_template): Use it.
+ * typeck2.c (cxx_incomplete_type_diagnostic): Improve error
+ message due to incomplete fields.
+
+2002-07-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/7112
+ * mangle.c (write_expression): Add mangling for sizeof when
+ applied to a type.
+ * operators.def: Remove stale comment.
+
+2002-06-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (CPTI_TINFO_DECL_TYPE): Replace with ...
+ (CPTI_TYPE_INFO_PTR_TYPE): ... this.
+ (tinfo_decl_type): Replace with ...
+ (type_info_ptr_type): ... this.
+ (import_export_tinfo): Declare.
+ (tinfo_decl_p): Rename to ...
+ (unemitted_tinfo_decl_p): ... this.
+ * decl2.c (import_export_decl): Break out tinfo handling into ...
+ (import_export_tinfo): ... here. New function.
+ (finish_file): Adjust.
+ * rtti.c (TINFO_REAL_NAME): New macro.
+ (init_rtti_processing): Create the tinfo types.
+ (get_tinfo_decl_dynamic): Use type_info_ptr_type, get_tinfo_ptr.
+ (get_tinfo_decl): Adjust.
+ (get_tinfo_ptr): New function.
+ (get_type_id): Use it.
+ (tinfo_base_init): Create vtable decl here, if it doesn't exist.
+ (ptr_initializer): Use get_tinfo_ptr.
+ (ptm_initializer): Likewise.
+ (synthesize_tinfo_var): Break into ...
+ (get_pseudo_ti_init): ... this. Just create the initializer.
+ (get_pseudo_ti_desc): .. and this.
+ (create_real_tinfo_var): Remove.
+ (create_pseudo_type_info): Don't create the vtable decl here.
+ (get_vmi_pseudo_type_info): Remove.
+ (create_tinfo_types): Adjust.
+ (tinfo_decl_p): Rename to ...
+ (unemitted_tinfo_decl_p): ... here. Adjust.
+ (emit_tinfo_decl): Adjust. Create the initializer.
+
+2002-06-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/6695
+ * pt.c (tsubst_friend_class): Substitute into the context of the
+ friend before using it.
+
+2002-06-26 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (xref_tag): Change prototype.
+ (handle_class_head): Likewise.
+ (build_x_component_ref): Likewise.
+ * decl.c (cxx_init_decl_processing): Adjust call to xref_tag.
+ (xref_tag): Take attributes as a separate parameter.
+ (xref_tag_from_type): Adjust call to xref_tag.
+ * decl2.c (build_expr_from_tree): Adjust call to
+ build_x_component_ref.
+ (handle_class_head): Take attributes as a separate parameter.
+ * parse.y (parse_xref_tag): New function.
+ (parse_handle_class_head): Likewise.
+ (primary): Use parse_xref_tag.
+ (class_head_decl): Use parse_handle_class_head.
+ (class_head_defn): Likewise.
+ * rtti.c (init_rtti_processing): Adjust call to xref_tag.
+ (build_dynamic_cast_1): Likewise.
+ (create_pseudo_type_info): Likewise.
+ (emit_support_tinfos): Likewise.
+ * typeck.c (build_object_ref): Adjust call to
+ build_x_component_ref.
+ (build_x_component_ref): Remove protect parameter.
+
+2002-06-25 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_op_delete_call): Use BASELINK_FUNCTIONS.
+ * class.c (handle_using_decl): Likewise.
+ (instantiate_type): Likewise.
+ * cp-tree.h (BASELINK_FUNCTIONS): New macro.
+ (xref_basetypes): Change prototype.
+ (begin_mem_initializers): New function.
+ (get_overloaded_fn): Likewise.
+ * decl.c (xref_basetypes): Simplify.
+ * error.c (dump_expr): Use BASELINK_FUNCTIONS.
+ * init.c (build_offset_ref): Likewise.
+ * parse.y (base_init): Use begin_mem_initializers().
+ (structsp): Adjust call to xref_basetypes.
+ * pt.c (determine_specialization): Use BASELINK_FUNCTIONS.
+ (instantiate_class_template): Adjust call to xref_basetypes.
+ * semantics.c (begin_mem_initializers): New function.
+ * tree.c (is_overloaded_fn): Use BASELINK_FUNCTIONS.
+ (really_overloaded_fn): Likewise.
+ (get_overloaded_fn): New function.'
+ (get_first_fn): USe BASELINK_FUNCTIONS.
+
+2002-06-24 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (SCALAR_TYPE_P): New macro.
+ (check_for_out_of_scope_variable): New function.
+ (at_class_scope_p): Likewise.
+ (finish_fname): Likewise.
+ * class.c (finish_struct): Use at_function_scope_p.
+ * decl.c (check_for_out_of_scope_variable): New function, split
+ out from do_identifier.
+ (finish_enum): Use at_function_scope_p.
+ * lex.c (do_identifier): Use check_for_out_of_scope_variable.
+ * parse.y (VAR_FUNC_NAME): Give it <ttype>. Use finish_fname.
+ (primary): Use at_function_scope_p.
+ * search.c (at_class_scope_p): New function.
+ * semantics.c (finish_fname): Likewise.
+ (check_multiple_declarators): Use at_function_scope_p.
+
+2002-06-23 Mark Mitchell <mark@codesourcery.com>
+
+ * parse.y (parse_scoped_id): New function.
+ (primary): Use it.
+ * cp-tree.h (do_scoped_id): Adjust declaration.
+ * lex.c (do_scoped_id): Remove call to yylex.
+ * decl2.c (build_expr_from_tree): Adjust use of do_scoped_id.
+ * typeck2.c (add_exception_specifier): Use tree_cons, rather than
+ expanding it inline.
+
+2002-06-23 Matt Thomas <matt@3am-software.com>
+
+ * decl.c (finish_function): Change "#ifdef VMS_TARGET" to
+ "#if VMS_TARGET".
+
+2002-06-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * mangle.c (integer_type_codes): Const-ify.
+
+2002-06-20 Richard Henderson <rth@redhat.com>
+
+ PR c++/6747
+ * typeck.c (mark_addressable): Don't test TREE_ADDRESSABLE early.
+ Call put_var_into_stack.
+
+2002-06-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * spew.c (remove_last_token): Use ARRAY_SIZE in lieu of explicit
+ array size calculation.
+
+2002-06-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/6892
+ * pt.c (tsubst_expr): Handle FILE_STMT.
+
+2002-06-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/6723
+ * pt.c (lookup_template_class): Don't build complete argument of
+ BOUND_TEMPLATE_TEMPLATE_PARM if appeared as a default template
+ argument.
+
+2002-06-19 Akim Demaille <akim@epita.fr>
+
+ * parse.y (TYPENAME): Rename as tTYPENAME to avoid the clash with
+ decl.h's TYPENAME.
+ * spew.c, lex.c: Adjust.
+ * parse.y (explicit_instantiation): Add empty action to override
+ the default $$ = $1 where it introduces a type clash.
+
+2002-06-14 Jason Merrill <jason@redhat.com>
+
+ * semantics.c (begin_for_stmt): Push the 'for' scope before
+ adding the FOR_STMT.
+
+ C++ ABI changes.
+ * class.c (build_base_field): Set DECL_PACKED.
+ (layout_class_type): Don't use tail padding of PODs.
+ * mangle.c (write_unqualified_name): Fix template conversion op
+ mangling.
+
+2002-06-16 Richard Henderson <rth@redhat.com>
+
+ PR opt/6793
+ * tree.c (cp_cannot_inline_tree_fn): Don't short-circuit test
+ after template instantiation.
+
+2002-06-16 Richard Henderson <rth@redhat.com>
+
+ * cp-tree.h, decl2.c (flag_ms_extensions): Move to c-common.
+
+2002-06-15 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * cp-tree.h (compiler_error): Remove declaration.
+ * lex.c (compiler_error): Remove definition.
+
+2002-06-14 Steve Ellcey <sje@cup.hp.com>
+
+ * g++spec.c (LIBUNWIND): New.
+ (lang_specific_driver): Add it if USE_UNWIND_EXCEPTIONS is set.
+
+2002-06-13 Jessica Han <jessica@cup.hp.com>
+
+ * class.c (build_vtable): Use TARGET_VTABLE_ENTRY_ALIGN.
+ (build_vtbl_initializer): Honor TARGET_VTABLE_DATA_ENTRY_DISTANCE.
+ (build_vbase_offset_vtbl_entries): Likewise.
+ * rtti.c (build_headof): Likewise.
+ (get_tinfo_decl_dynamic): Likewise.
+ (create_pseudo_type_info): Likewise.
+
+2002-06-12 Stan Shebs <shebs@apple.com>
+
+ * mpw-config.in: Remove file, no longer used.
+ * mpw-make.sed: Ditto.
+
+2002-06-07 Zack Weinberg <zack@codesourcery.com>
+
+ * decl2.c: Update call to cpp_handle_option.
+
+2002-06-07 H.J. Lu (hjl@gnu.org)
+
+ * decl2.c (flag_use_cxa_atexit): Set to DEFAULT_USE_CXA_ATEXIT.
+
+2002-06-06 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c (cp_error_at): Fix typo.
+
+2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c (cp_diagnostic_starter): Adjust call.
+ (maybe_print_instantiation_context): Change prototype to take a
+ 'diagnostic_info *'.
+ (print_instantiation_full_context): Likewise.
+ (print_instantiation_partial_context): Likewise.
+ (cp_diagnostic_starter): Likewise.
+ (cp_diagnostic_finalizer): Likewise.
+ (cp_print_error_function): Likewise.
+ (cp_printer): Take a secondary parameter as a 'text_info *'.
+ Remove output_state savings. Adjust calls.
+
+2002-06-03 Geoffrey Keating <geoffk@redhat.com>
+
+ * pt.c (inline_parm_levels): Mark for GC.
+
+ * mangle.c (start_mangling): Allocate G.substitutions here...
+ (init_mangle): ... rather than here.
+ (finish_mangling): Clear the varray pointer when done with it.
+ * spew.c (yylexstring): Don't use VARRAY_FREE.
+ * search.c (bfs_walk): Don't use VARRAY_FREE.
+ * decl2.c (pending_statics): Use gengtype to mark.
+ (deferred_fns): Likewise.
+ (ssdf_decls): Likewise.
+ (init_decl2): Delete.
+ * decl.c (pop_from_top_level): Don't use VARRAY_FREE.
+ (cxx_init_decl_processing): Don't call init_decl2.
+ (cxx_pop_function_context): Don't use VARRAY_FREE.
+ * cp-tree.h (struct saved_scope): No need for special marking
+ of varrays.
+ (struct language_function): Likewise.
+ (local_classes): Use gengtype to mark.
+ (init_decl2): Delete prototype.
+ * class.c (init_class_processing): Don't use
+ ggc_add_tree_varray_root.
+ (build_vtbl_initializer): Don't use VARRAY_FREE.
+
+ * decl.c (typename_compare): Don't use same_type_p.
+
+ * decl.c: Include hashtab.h instead of hash.h.
+ (typename_hash): Update to use htab_h.
+ (typename_compare): Likewise.
+ (typename_htab): Use gengtype to mark.
+ (build_typename_type): Update to use htab_h.
+ * Make-lang.in (cp/decl.o): Use HASHTAB_H instead of hash.h.
+
+ * Make-lang.in (gt-cp-tree.h): New rule.
+ (cp/tree.o): Depend on gt-cp-tree.h.
+ * config-lang.in (gtfiles): Add cp/tree.c.
+ * tree.c: Include gt-cp-tree.h.
+ (list_hash_table): Use gengtype to mark.
+ (init_tree): Use gengtype to mark trees.
+
+ * Make-lang.in (cp/decl.o): Add debug.h dependency.
+ * call.c (struct z_candidate): Use gengtype.
+ (USER_CONV_CAND): Use WRAPPER_ZC.
+ (convert_class_to_reference): Use build_zc_wrapper.
+ (build_type_conversion_1): Likewise.
+ (build_over_call): Use WRAPPER_ZC.
+ (add_warning): Use build_zc_wrapper.
+ * cp-lang.c (LANG_HOOKS_MARK_TREE): Delete.
+ * cp-tree.h (struct lang_identifier): Use gengtype.
+ (struct template_parm_index_s): Likewise.
+ (struct ptrmem_cst): Likewise.
+ (struct tree_binding): Likewise.
+ (struct tree_overload): Likewise.
+ (struct tree_srcloc): Likewise.
+ (struct tree_wrapper): Likewise. Also modify to have a pointer
+ to struct z_candidate rather than void.
+ (enum cp_tree_node_structure_enum): New.
+ (union lang_tree_node): New.
+ (cxx_mark_tree): Delete prototype.
+ (cp_tree_node_structure): New prototype.
+ (build_ptr_wrapper): Delete prototype.
+ (build_int_wrapper): Delete prototype.
+ (build_zc_wrapper): New prototype.
+ * decl.c: Include debug.h
+ (cxx_mark_tree): Delete.
+ (cp_tree_node_structure): New.
+ * tree.c (build_ptr_wrapper): Delete.
+ (build_int_wrapper): Delete.
+ (build_zc_wrapper): New.
+
+ * cp-tree.h [! ENABLE_TREE_CHECKING] (LANG_TYPE_PTRMEM_CHECK):
+ Correct typo. Patch from k_fukui@highway.ne.jp.
+
+ * semantics.c (current_stmt_tree): Update for change to
+ struct language_function.
+ (finish_mem_initializers): Likewise.
+ * decl.c (cxx_init_decl_processing): Don't set mark_lang_status.
+ * cp-tree.h (struct language_function): Rename from
+ cp_language_function. Change all uses.
+ (cp_function_chain): Don't need to cast.
+
+ * class.c (duplicate_tag_error): Reset discriminator.
+ (check_bases_and_members): Update for data structure changes.
+ * cp-tree.h (struct lang_id2): Use gengtype.
+ (flagged_type_tree): Likewise.
+ (SET_LANG_ID): Use GGC on struct lang_id2.
+ (struct cp_language_function): Use gengtype. Remove field
+ 'x_vcalls_possible_p'.
+ (current_vcalls_possible_p): Delete.
+ (struct lang_type_header): New.
+ (struct lang_type_class): Rename from struct lang_type. Include
+ struct lang_type_header.
+ (struct lang_type_ptrmem): New.
+ (struct lang_type): New.
+ (LANG_TYPE_CLASS_CHECK): New. Use it in all the appropriate macros.
+ (LANG_TYPE_PTRMEM_CHECK): New. Use it in all the appropriate macros.
+ (TYPE_SET_PTRMEMFUNC_TYPE): Set discriminator, update for changes.
+ (struct lang_decl_flags): Use gengtype. Add discriminators.
+ (struct lang_decl): Use gengtype. Add and use discriminators.
+ Update the macros that reference moved fields.
+ (LANG_DECL_U2_CHECK): New function. Use it when appropriate.
+ (SET_DECL_THUNK_P): Set discriminator too.
+ (clear_inline_text_obstack): Delete prototype.
+ (finish_inline_definitions): Delete prototype.
+ (mark_pending_inlines): Delete prototype.
+ (lang_check_failed): New prototype.
+ * decl.c (struct named_label_use_list): Use gengtype.
+ (struct named_label_list): Likewise.
+ (mark_binding_level): Delete.
+ (mark_named_label_lists): Delete.
+ (push_local_name): Set discriminator on DECL_LANG_SPECIFIC.
+ (cxx_init_decl_processing): Use generated marker routine.
+ (begin_destructor_body): Delete dead set to
+ current_vcalls_possible_p.
+ (mark_lang_function): Delete.
+ (mark_cp_function_context): Delete.
+ (lang_mark_tree): Use generated marker routines.
+ * decl2.c (start_objects): Set discriminator when setting
+ GLOBAL_INIT_PRIORITY.
+ * lex.c (retrofit_lang_decl): Set discriminators.
+ (copy_lang_type): Update for changes to lang_type structure.
+ (cp_make_lang_type): Set discriminator.
+ * parse.y: Use gengtype on YYLVAL. Don't use dots in identifiers.
+ * search.c: Include ggc.h.
+ * semantics.c (anon_aggr_type_p): Use the macro, don't hand-code it.
+ (finish_inline_definitions): Delete.
+ * spew.c (struct token): Use gengtype.
+ (struct token_chunk): New.
+ (struct unparsed_text): Use gengtype. Store tokens in chunks.
+ (struct feed): Use gengtype.
+ (feed_obstack): Delete.
+ (feed): Mark as GC root.
+ (pending_inlines): Mark as GC root.
+ (pending_inlines_tail): Likewise.
+ (processing_these_inlines): Likewise.
+ (token_obstack): Make static.
+ (first_token): Likewise.
+ (init_spew): Don't initialize deleted things; use gengtype for roots.
+ (clear_inline_text_obstack): Delete.
+ (feed_input): Use GC for struct feed. Update for changes to
+ struct unparsed_text.
+ (mark_pending_inlines): Delete.
+ (next_token): Rename from add_token. Change all callers. Update
+ for changes to struct unparsed_text.
+ (space_for_token): New.
+ (remove_last_token): New.
+ (alloc_unparsed_text): New.
+ (snarf_block): Take an unparsed_text. Update for changes to struct
+ unparsed_text.
+ (snarf_method): Update for changes to struct unparsed_text.
+ (snarf_defarg): Update for changes to struct unparsed_text.
+ * tree.c (lang_check_failed): New.
+
+ * Make-lang.in (gt-cp-call.h gt-cp-decl2.h gt-cp-parse.h
+ gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h): New rules.
+ (cp/spew.o): Add dependency on gt-<filename>.h.
+ (cp/decl2.o): Add dependency on gt-<filename>.h.
+ (cp/call.o): Add dependency on gt-<filename>.h.
+ (cp/pt.o): Add dependency on gt-<filename>.h.
+ (cp/repo.o): Add dependency on gt-<filename>.h.
+ (cp/parse.o): Add dependency on gt-<filename>.h.
+ * call.c: Use gengtype for roots.
+ * config-lang.in (gtfiles): Add cp-tree.h decl.h lex.h call.c
+ decl2.c parse.y pt.c repo.c spew.c.
+ * cp-tree.h: Use gengtype for roots.
+ (struct saved_scope): Use GGC, gengtype.
+ (cp_parse_init): Delete prototype.
+ (init_pt): Delete prototype.
+ * decl.c: Use gengtype for roots.
+ (mark_saved_scope): Delete.
+ (cxx_init_decl_processing): Don't call deleted initilisation
+ routines.
+ (signed_size_zero_node): Delete, unused.
+ * decl.h: Use gengtype for roots.
+ * decl2.c: Use gengtype for roots.
+ * lex.h: Use gengtype for roots.
+ * parse.y: Use gengtype for roots.
+ (cp_parse_init): Delete.
+ * pt.c: Use gengtype for roots.
+ (init_pt): Delete.
+ * repo.c: Use gengtype for roots.
+ * spew.c: Use gengtype for roots.
+
+ * Make-lang.in: Allow for filename changes. Add gtype-cp.h.
+ (cp/decl.o): Add dependency on gtype-cp.h.
+ * decl.c: Remove use of add_deletable_root, use GTY marker instead.
+ Include gtype-cp.h. Allow for filename changes.
+
+ * Make-lang.in (cp/gt-decl.h): Generate using gengtype.
+ (cp/decl.o): Add cp/gt-decl.h dependency.
+ * config-lang.in (gtfiles): New.
+ * tree.h: Rename struct binding_level to struct cp_binding_level.
+ * decl.c: Rename struct binding_level to struct cp_binding_level.
+ Include cp/gt-decl.h.
+ (struct cp_binding_level): Use gengtype.
+ (make_binding_level): Use GGC on struct cp_binding_level.
+ (mark_binding_level): Use gt_ggc_m_cp_binding_level.
+ (cxx_init_decl_processing): Mark free_binding_level as
+ deletable.
+
+ * decl.c (mark_cp_function_context): Update calling sequence.
+
+ * decl.c (start_function): Don't free 'struct
+ cp_language_function'.
+ (pop_cp_function_context): Likewise.
+ (save_function_data): Allocate it using GC.
+ * semantics.c (genrtl_start_function): Don't free 'struct
+ cp_language_function'.
+
+2002-05-31 Matthew Woodcraft <mattheww@chiark.greenend.org.uk>
+
+ * lang-specs.h: Use cpp_debug_options.
+
+2002-05-28 Zack Weinberg <zack@codesourcery.com>
+
+ * mangle.c, tree.c: Include real.h.
+ * Make-lang.in: Update dependency lists.
+
+2002-05-25 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * lex.c: Don't include c-lex.h.
+ * parse.y, spew.c: Don't include c-lex.h; include c-pragma.h.
+
+2002-05-23 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * spew.c (yyungetc, snarf_block): Remove indent_level handling.
+
+2002-05-22 Richard Henderson <rth@redhat.com>
+
+ * decl.c (obscure_complex_init): Check for VAR_DECL
+ before using DECL_THREAD_LOCAL.
+
+2002-05-22 Richard Henderson <rth@redhat.com>
+
+ * decl.c (check_tag_decl): Handle RID_THREAD.
+ (obscure_complex_init): Reject run-time init of tls.
+ (grokvardecl, grokdeclarator): Handle RID_THREAD.
+ * lex.c (reswords): Add __thread.
+ (rid_to_yy): Map RID_THREAD to SCSPEC.
+
+2002-05-22 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_POST_OPTIONS): Use c_common_post_options.
+ * cp-tree.h (cxx_post_options): Kill.
+ * cp-lex.c (cxx_post_options): Kill.
+
+2002-05-21 Richard Henderson <rth@redhat.com>
+
+ * lex.c (rid_to_yy): Add RID_THREAD.
+
+2002-05-21 Alexandre Oliva <aoliva@redhat.com>
+
+ * init.c (build_vec_init): Test for trivial copy-assignment when
+ copy-assigning arrays.
+
+2002-05-20 Andreas Jaeger <aj@suse.de>
+
+ * init.c (build_default_init): Remove unused variable.
+
+2002-05-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * call.c (any_strictly_viable): New.
+ (build_new_op): Use it for COMPOUND_EXPR and ADDR_EXPRs.
+
+2002-05-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * error.c (dump_type) [TYPEOF_TYPE]: Fix parenthesis printing.
+
+2002-05-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/186, DR 259
+ * pt.c (do_decl_instantiation): Don't complain explicit
+ instantiation after explicit specialization.
+ (do_type_instantiation): Likewise.
+
+2002-05-19 Alexandre Oliva <aoliva@redhat.com>
+
+ * cp-tree.h (complete_type_or_diagnostic): Changed prototype,
+ renamed from...
+ (complete_type_or_else): ... this. Redefined as macro.
+ (cxx_incomplete_type_diagnostic): Declare.
+ (cxx_incomplete_type_error): Define as macro.
+ * init.c (build_delete): Warn about incomplete types other than
+ void, and use the built-in operator delete for them.
+ * typeck.c (complete_type_or_diagnostic): Renamed from
+ complete_type_or_else. Added warn_only argument, passed to...
+ * typeck2.c (cxx_incomplete_type_diagnostic): ... this. Print
+ warnings or errors depending on new warn_only argument. Renamed
+ from...
+ (cxx_incomplete_type_error): ... this. New implementation in
+ terms of cxx_incomplete_type_diagnostic.
+
+2002-05-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/6611
+ * decl2.c (import_export_decl): If we clear
+ DECL_NOT_REALLY_EXTERN, make sure DECL_EXTERNAL is set.
+
+2002-05-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/6620
+ * pt.c (verify_class_unification): Don't check if PARM is template
+ parameter dependent. Simplify.
+ (unify) [TEMPLATE_PARM_INDEX]: Handle when ARG is a template
+ parameter dependent expression.
+
+2002-05-14 Jason Merrill <jason@redhat.com>
+
+ * rtti.c (get_tinfo_decl): Don't call comdat_linkage.
+ Do set DECL_COMDAT.
+ (synthesize_tinfo_var): Take the public decl.
+ (create_real_tinfo_var): Likewise. Check DECL_COMDAT.
+ (emit_tinfo_decl): Adjust. Call import_export_decl.
+ * decl2.c (import_export_decl): Simplify tinfo decl handling.
+
+2002-05-14 Alexandre Oliva <aoliva@redhat.com>
+
+ * cp-tree.h (struct lang_type): Added non_zero_init.
+ (CLASSTYPE_NON_ZERO_INIT_P): New macro.
+ (zero_init_p, force_store_init_value, build_forced_zero_init): Declare.
+ * class.c (check_field_decls): Test non_zero_init.
+ * cvt.c (convert_to_pointer_force): Use cp_convert_to_pointer for
+ zero-to-NULL conversions.
+ * decl.c (obscure_complex_init): Don't reset DECL_INITIAL of a
+ type that needs zero-initialization without zeros.
+ (check_initializer_decl): Compute zero-initializer for types
+ that require a non-trivial one.
+ * init.c (build_forced_zero_init): New function.
+ (build_default_init): Use it.
+ * tree.c (zero_init_p): New function.
+ * typeck2.c (force_store_init_value): New function.
+ (process_init_constructor): Create non-trivial zero-initializers
+ for array members and class fields.
+
+2002-05-14 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * lang-specs.h: Remove redundant -lang-c++.
+
+2002-05-13 Jason Merrill <jason@redhat.com>
+
+ * class.c (build_vtbl_ref_1): Use fixed_type_or_null.
+ (fixed_type_or_null): See through reference vars.
+ (build_base_path): Vtable contents are constant.
+ * typeck.c (get_member_function_from_ptrfunc): Likewise.
+
+2002-05-12 Jason Merrill <jason@redhat.com>
+
+ * cp-lang.c (ok_to_generate_alias_set_for_type): Backend-created
+ structs are safe.
+
+2002-05-09 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-tree.h (flag_ansi): Remove.
+ * decl2.c (flag_ansi): Remove.
+ (cxx_decode_option): Set flag_iso and flag_undef.
+
+2002-05-09 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (get_member_function_from_ptrfunc): Reorganize.
+ Use subtraction rather than a bitmask to get the index.
+ * cvt.c (cp_convert_to_pointer): Bail on an error_mark_node.
+
+ * pt.c (tsubst_expr) [ASM_STMT]: Copy ASM_INPUT_P.
+
+2002-05-07 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * Make-lang.in (decl2.o): Update.
+ * cp-tree.h (warn_multichar): Remove.
+ * decl2.c: Include c-common.h.
+ (warn_multichar): Remove.
+
+2002-05-03 Jason Merrill <jason@redhat.com>
+
+ * tree.c (build_cplus_array_type): Only const and volatile get
+ special handling.
+
+ * decl.c (BOOL_TYPE_SIZE): Move default to defaults.h.
+
+2002-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ ABI change, returning simple classes from functions.
+ * class.c (finish_struct_bits): Only mark TREE_ADDRESSABLE if
+ TYPE_HAS_TRIVIAL_INIT_REF is false or
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR is true.
+
+2002-04-30 Jason Merrill <jason@redhat.com>
+
+ PR debug/6436
+ * decl.c (grokdeclarator): Don't override TYPE_NAME of an
+ anonymous class with a typedef if there are attributes.
+
+2002-04-29 Paul Eggert <eggert@twinsun.com>
+
+ * parse.y (nomods_initdcl0): Replace $<ttype>3 with $<ttype>$.
+
+2002-04-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/6477
+ * decl.c (follow_tag_typedef): Check if TYPE_NAME (original) is
+ non-NULL first.
+
+2002-04-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/6492
+ * pt.c (tsubst_friend_class): If the friend has an explicit scope,
+ enter that scope before name lookup.
+
+ PR c++/6486
+ * method.c (do_build_copy_constructor): Avoid building
+ cv-qualified reference types.
+
+2002-04-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5719
+ * decl.c (grok_op_properties): Assignment ops don't have to return
+ by value. operator% should.
+
+2002-04-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
+
+ PR c/6343
+ * decl.c (duplicate_decls): Call merge_weak.
+
+2002-04-26 Richard Henderson <rth@redhat.com>
+
+ * parse.y (malloced_yyss, malloced_yyvs): New.
+ (yyoverflow): Re-add. Set them.
+ (free_parser_stacks): New.
+
+2002-04-26 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/6497
+ * method.c (do_build_assign_ref): Pass a derivation to
+ build_method_call when calling base class assignment operators.
+
+2002-04-26 Richard Henderson <rth@redhat.com>
+
+ * parse.y (yyoverflow): Revert.
+
+2002-04-26 Richard Henderson <rth@redhat.com>
+
+ PR c/3581
+ * parse.y (string): Remove. Update all uses to use STRING
+ instead, and not call combine_strings.
+ * rtti.c (tinfo_name): Use fix_string_type.
+ * semantics.c (finish_asm_stmt): Don't call combine_strings.
+ * spew.c (yylexstring): New.
+ (read_token): Use it.
+
+2002-04-25 Richard Henderson <rth@redhat.com>
+
+ PR c/2161
+ * parse.y (yyoverflow): New.
+
+2002-04-25 Jason Merrill <jason@redhat.com>
+
+ PR c++/5607
+ * search.c (check_final_overrider): No longer static.
+ * class.c (update_vtable_entry_for_fn): Call it.
+ * cp-tree.h: Adjust.
+
+2002-04-25 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_SET_YYDEBUG): Remove.
+ * cp-tree.h (cxx_set_yydebug): Die.
+ * lex.c (YYDEBUG): Get from c-lex.h.
+ (cxx_set_yydebug): Remove.
+ * parse.y: Include c-lex.h.
+ (YYDEBUG): Get from c-lex.h.
+
+2002-04-24 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/6438.
+ * cvt.c (convert_to_void): Don't unconditionally make COND_EXPRs
+ void.
+
+2002-04-24 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
+ LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE):
+ Redefine.
+ * cp-tree.h (cp_attribute_table): Rename.
+ * decl.c (lang_attribute_table): Remove declaration.
+ (cxx_init_decl_processing): Don't set it.
+ * tree.c (cp_attribute_table): Rename.
+
+2002-04-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/6331
+ * method.c (do_build_copy_constructor): Use cp_build_qualified_type.
+ * typeck.c (build_modify_expr): Allow arrays to differ in cv-quals.
+ The pedwarn for array assignment is now unconditional.
+ * tree.c (build_cplus_array_type_1): Still process simple array types
+ normally in templates.
+
+ PR c++/6395
+ * decl.c (make_rtl_for_nonlocal_decl): Don't mess with #pragma i/i
+ stuff for comdats.
+
+2002-04-23 Jakub Jelinek <jakub@redhat.com>
+
+ * parse.y (check_class_key): Allow KEY to be union/enum/struct/class
+ node with attributes.
+
+2002-2-23 David O'Brien <obrien@FreeBSD.org>
+
+ * g++spec.c (MATH_LIBRARY_PROFILE, LIBSTDCXX_PROFILE): Add.
+ Use MATH_LIBRARY_PROFILE and LIBSTDCXX_PROFILE if profile flag given.
+
+2002-04-23 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/6256:
+ * pt.c (tsubst_friend_class): Handle templates with explicit
+ nested names.
+
+ PR c++/6331:
+ * typeck.c (merge_types): Remember the cv-qualification of pointer
+ types when merging them.
+
+2002-04-20 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_FUNCTION_INIT,
+ LANG_HOOKS_FUNCTION_FREE, LANG_HOOKS_FUNCTION_MARK): Redefine.
+ * cp-tree.h (cxx_push_function_context, cxx_pop_function_context,
+ cxx_mark_function_context): New.
+ * decl.c (push_cp_function_context, pop_cp_function_context,
+ mark_cp_function_context): Rename for consistency.
+ (cxx_init_decl_processing): Don't set old hooks.
+
+2002-04-19 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * call.c (convert_type_from_ellipsis): Rename, update.
+ * cp-lang.c (LANG_HOOKS_TYPE_PROMOTES_TO): Redefine.
+ * cp-tree.h (convert_type_from_ellipsis): Rename.
+ * decl.c (cxx_init_decl_processing): Don't set hook.
+
+2002-04-18 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * call.c (build_new_method_call): Update.
+ * cp-lang.c (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): Redefine.
+ * cp-tree.h (cxx_incomplete_type_error): New.
+ * decl.c (grokdeclarator, grokparms): Update.
+ * decl2.c (check_classfn): Update.
+ * pt.c (tsubst): Update.
+ * typeck.c (complete_type_or_else, expr_sizeof,
+ decay_conversion): Update.
+ * typeck2.c (incomplete_type_error): Rename.
+ (add_exception_specifier): Update.
+
+2002-04-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/5658
+ * search.c (setup_class_bindings): A class template qualifies as a
+ type binding.
+
+2002-04-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/6316
+ * decl2.c (finish_file): Clear DECL_EXTERNAL in a separate loop
+ before expanding.
+
+2002-04-16 Mark Mitchell <mark@codesourcery.com>
+
+ * init.c (begin_init_stmts): Remove commented out code.
+ (finish_init_stmts): Set STMT_EXPR_NO_SCOPE.
+ * semantics.c (begin_gobal_stmt_expr): Adjust call to
+ expand_start_stmt_expr.
+
+2002-04-15 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (register_dtor_fn): Pass the address of dso_handle, not
+ dso_handle itself, to __cxa_atexit.
+
+2002-04-15 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ * error.c (cxx_print_error_function): Adjust call to macros.
+
+2002-04-14 Jakub Jelinek <jakub@redhat.com>
+
+ * class.c (layout_virtual_bases): Do all dsize computation on trees.
+
+2002-04-14 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (get_member_function_from_ptrfunc): Don't do
+ gratuitious division and multiplication on
+ ptrmemfunc_vbit_in_delta targets.
+
+2002-04-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/5373.
+ * semantics.c (finish_expr_stmt): Remember the type of the
+ expression before any conversions are performed.
+
+2002-04-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/5189.
+ * call.c (add_template_candidate_real): Do not treat member
+ templates as copy constructors.
+
+2002-04-12 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (duplicate_decls): Do not copy the RTL for a variable
+ declaration if the old variable had an incomplete type and the new
+ variable does not.
+ (complete_vars): Do not call layout_decl for completed variables.
+
+2002-04-12 Richard Sandiford <rsandifo@redhat.com>
+
+ * decl.c (duplicate_decls): Don't try to unify an implicit typedef
+ with an explicit one.
+ (follow_tag_typedef): New.
+ (lookup_tag): Use it to extract the tag of an explicit typedef.
+ (xref_tag): Likewise.
+
+2002-04-11 Andrew Haley <aph@redhat.com>
+
+ * typeck.c (type_after_usual_arithmetic_conversions):
+ If two types have the same variant, return immediately.
+ When two floating-point operands are the same precision:
+ convert to float if one of the operands is float;
+ if neither operand is one of the standard types, return the type
+ of the first operand.
+
+2002-04-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5507
+ * decl.c (make_typename_type): Remove implicit typenameness.
+
+2002-04-09 Jason Merrill <jason@redhat.com>
+
+ PR optimization/6189
+ * semantics.c (genrtl_start_function): Don't free
+ DECL_SAVED_FUNCTION_DATA for inline functions.
+
+ * init.c (build_member_call): For now, don't convert to
+ intermediate base if it would cause an error.
+
+2002-04-08 Paolo Carlini <pcarlini@unitus.it>
+
+ * parse.y (namespace_qualifier, maybe_identifier,
+ begin_explicit_instantiation, end_explicit_instantiation,
+ apparent_template_type, .finish_template_type,
+ do_id, maybe_init, defarg_again, component_decl_1):
+ Add ending ';', in accordance with POSIX.
+
+2002-04-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/5571
+ * class.c (layout_class_type): Remember incomplete static
+ variables.
+ (finish_struct_1): Call complete_vars, not
+ hack_incomplete_structures.
+ * cp-tree.h (hack_incomplete_structures): Rename to ...
+ (complete_vars): ... this.
+ (struct saved_scope): Remove incomplete.
+ (namespace_scope_incomplete): Remove.
+ * decl.c (struct binding_level): Remove incomplete.
+ (incomplete_vars): New variable.
+ (mark_binding_level): Don't mark incomplete.
+ (print_binding_level): Don't print it.
+ (mark_saved_scope): Don't mark incomplete.
+ (pushdecl): Use maybe_register_incopmlete_var.
+ (cxx_init_decl_processing): Register incomplete_vars for GC.
+ (start_decl_1): Clarify error message.
+ (hack_incomplete_vars): Remove.
+ (maybe_register_incomplete_var): New function.
+ (complete_vars): Likewise.
+
+2002-04-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/4934
+ * error.c (dump_expr) [CONVERT_EXPR]: Make sure TREE_TYPE (t) is
+ set before checking it.
+
+ PR c++/525
+ * init.c (build_member_call): Use build_scoped_ref.
+ (resolve_offset_ref): Likewise.
+ * call.c (build_scoped_method_call): Likewise.
+ * tree.c (maybe_dummy_object): Kludge around current_class_type being
+ wrong.
+ * typeck2.c (build_scoped_ref): Return the binfo via binfo_p parm.
+ * cp-tree.h: Adjust.
+
+ * init.c (push_base_cleanups): Just use build_scoped_method_call.
+
+ PR c++/6179
+ * method.c (implicitly_declare_fn): Pass unqualified type to
+ synthesize_exception_spec.
+
+2002-04-04 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Redefine.
+ * cvt.c: Update comment.
+ * init.c (expand_cleanup_for_base): Update.
+ * semantics.c (finish_parenthesized_expr): Update.
+ * typeck.c (cp_truthvalue_conversion): Update.
+
+2002-04-04 Jason Merrill <jason@redhat.com>
+
+ * semantics.c (finish_eh_cleanup): New fn.
+ * cp-tree.h: Add prototype.
+ * init.c (perform_member_init, expand_cleanup_for_base): Use
+ finish_eh_cleanup.
+ * cp-tree.def (SUBOBJECT, CTOR_STMT): Remove.
+ * cp-tree.h: Remove references.
+ * decl.c (begin_constructor_body, end_constructor_body): Likewise.
+ * dump.c (cp_dump_tree): Likewise.
+ * pt.c (tsubst_expr): Likewise.
+ * semantics.c (genrtl_ctor_stmt, genrtl_subobject): Remove.
+ (cp_expand_stmt): Remove handling of CTOR_STMT and SUBOBJECT.
+ * tree.c (cp_statement_code_p): Likewise.
+
+ * init.c (build_new_1): Set CLEANUP_EH_ONLY on deleting cleanup.
+
+ PR c++/5636
+ * semantics.c (nullify_returns_r): Just set CLEANUP_EH_ONLY on
+ cleanup for nrv.
+
+ PR c++/5104
+ * typeck.c (comptypes) [FUNCTION_TYPE]: Don't compare exception
+ specifiers.
+ [METHOD_TYPE]: Use same code as FUNCTION_TYPE.
+
+2002-04-03 Richard Henderson <rth@redhat.com>
+
+ * cp-lang.c (cxx_warn_unused_global_decl): New.
+ (LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL): New.
+
+2002-04-03 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): Redefine.
+ * tree.c (init_tree): Don't set hook.
+
+2002-04-03 Roger Sayle <roger@eyesopen.com>
+
+ PR c++/5998:
+ * decl.c (duplicate_decls): Don't mess with assembler names when
+ redeclaring builtin functions as static.
+
+2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * call.c (build_addr_func): Update.
+ * class.c (resolve_address_of_overloaded_function): Update.
+ * cp-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine.
+ * cp-tree.h (cxx_mark_addressable): New.
+ * decl.c (register_dtor_fn, cxx_maybe_build_cleanup): Update.
+ * decl2.c (build_cleanup): Update.
+ * except.c (build_throw): Update.
+ * init.c (resolve_offset_ref): Update.
+ * pt.c (convert_nontype_argument): Update.
+ * semantics.c (finish_asm_stmt, simplify_affr_init_exprs_r): Update.
+ * typeck.c (decay_conversion, build_array_ref, build_unary_op,
+ unary_complex_lvalue): Update.
+ (mark_addressable): Rename.
+
+2002-04-01 Roger Sayle <roger@eyesopen.com>
+
+ PR c++/5998:
+ * decl.c (duplicate_decls): Overwrite the RTL when (and only
+ when) overwriting a built-in function. Don't use COPY_DECL_RTL,
+ but follow the SET_DECL_RTL idiom used elsewhere in the function.
+
+2002-04-01 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
+ LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
+ * decl.c (grokdeclarator): Update.
+ * mangle.c (write_integer_cst): Update.
+ * typeck.c (build_binary_op): Update.
+
+2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
+ * lex.c (cxx_init): Don't set hook.
+
+2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * Make-lang.in (error.o): Update.
+ * cp-lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
+ * cp-tree.h (struct diagnostic_context): Predeclare.
+ (cxx_print_error_function): New.
+ * error.c: Include langhooks-def.h.
+ (lang_print_error_function): Rename. Update.
+ (init_error): Don't set hook.
+
+2002-03-29 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):
+ Redefine.
+ * cvt.c (cp_convert_to_pointer, type_promotes_to): Use new hooks.
+ * decl.c (finish_enum): Similarly.
+ * error.c (dump_type): Similarly.
+ * lex.c (cxx_init): Similarly.
+ * mangle.c (write_builtin_type): Similarly.
+ * typeck.c (comptypes): Similarly.
+
+2002-03-28 Roger Sayle <roger@eyesopen.com>
+
+ PR c++/5998:
+ * decl.c (cxx_init_decl_processing): Re-enable built-in functions
+ in the g++ front-end.
+ (duplicate_decl): Allow redefinition of anticipated built-ins.
+ Fix inlining problem by over-writing the old DECL_RTL.
+ (lookup_namespace_name): Fail to find an identifier in the
+ specified namespace if its still anticipated.
+ (builtin_function_1): New function split out from builtin_function
+ to create a builtin in the current namespace with given context.
+ (builtin_function): Call builtin_function_1 to define the
+ appropriate builtins in both the std and global namespaces.
+ (select_decl): Don't test for anticipated decls here.
+ (unqualified_namespace_lookup): Instead ignore them whilst
+ searching through scopes and namespaces.
+ * decl2.c (do_nonmember_using_decl): If a using declaration
+ specifies an anticipated built-in function, mark it as no longer
+ anticipated in that scope.
+ (ambiguous_decl): Avoid resolving to an anticipated decl.
+ * lex.c (do_scoped_id): Fail to find an identifier in the global
+ namespace if its still anticipated.
+
+2002-03-29 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_MAKE_TYPE): Redefine.
+ * cp-tree.h (cp_make_lang_type): Rename.
+ * lex.c (cp_make_lang_type): Rename.
+ (make_aggr_type): Update.
+ * tree.c (init_tree): Don't set make_lang_type_fn.
+
+2002-03-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/6073
+ * class.c (finish_struct_1): Update static field's DECL_MODE even
+ if its type is a variant of t.
+
+2002-03-27 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES): Redefine.
+ * cp-tree.h (cxx_insert_default_attributes): New.
+ * decl.c (insert_default_attributes): Rename.
+
+2002-03-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/4884
+ * call.c (build_op_delete_call): Allow for the fact the placement
+ may be a COMPOUND_EXPR.
+
+2002-03-27 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_EXPAND_EXPR): Redefine.
+ * cp-tree.h (init_cplus_expand): Remove.
+ (cxx_expand_expr): New.
+ * expr.c (cplus_expand_expr): Rename cxx_expand_expr,
+ fix prototype.
+ (init_cplus_expand): Remove.
+ * lex.c (cxx_init): Don't call init_cplus_expand.
+
+2002-03-26 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/4884.
+ * init.c (build_new_1): Allow for the fact the result of
+ build_function_call may be a COMPOUND_EXPR.
+
+2002-03-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5682
+ * cp-tree.h (BINFO_PRIMARY_P): Explain meaning better.
+ (dfs_skip_nonprimary_vbases_unmarkedp): Remove.
+ (dfs_skip_nonprimary_vbases_markedp): Remove.
+ * search.c (get_shared_vbase_if_not_primary): Remove.
+ (dfs_skip_nonprimary_vbases_unmarkedp): Remove.
+ (dfs_skip_nonprimary_vbases_markedp): Remove.
+ (dfs_unmarked_real_bases_queue_p): Just get the canonical binfo.
+ (dfs_marked_real_bases_queue_p): Likewise.
+
+2002-03-26 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_MARK_TREE): Redefine.
+ * cp-tree.h (cxx_mark_tree): New.
+ * decl.c (lang_mark_tree): Rename cxx_mark_tree.
+
+2002-03-25 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-tree.h (cxx_maybe_build_cleanup): New.
+ * decl.c (destroy_local_var, hack_incomplete_structures): Update.
+ (maybe_build_cleanup): Rename cxx_maybe_build_cleanup.
+ * tree.c (build_target_expr): Update.
+ * cp-lang.c (LANG_HOOKS_MAYBE_BUILD_CLEANUP): Redefine.
+
+2002-03-24 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * decl2.c (cxx_decode_option): Handle -E.
+ * lang-specs.h (default_compilers): Preprocess with cc1plus.
+ * lex.c (cxx_init): Exit quickly if c_common_init returns NULL.
+
+2002-03-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/6037
+ * decl.c (start_enum): Don't set TREE_ADDRESSABLE on TREE_LIST node.
+
+2002-03-23 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ * error.c (dump_type): Be careful about implicit typenames.
+
+2002-03-21 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ PR C++/3656
+ * semantics.c (finish_base_specifier): Handle erronous base
+ classes.
+
+2002-03-22 Zack Weinberg <zack@codesourcery.com>
+
+ * error.c: Always use REAL_VALUE_TO_DECIMAL; don't test
+ REAL_IS_NOT_DOUBLE.
+
+2002-03-22 Jeff Knaggs <jknaggs@redhat.com>
+
+ * typeck.c (get_member_function_from_ptrfunc): Scale idx down to
+ an index into the vtable_entry array regardless of
+ TARGET_PTRMEMFUNC_VBIT_LOCATION.
+
+2002-03-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * tree.c (cp_cannot_inline_tree_fn): Same.
+
+2002-03-21 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
+ insert_block, getdecls, global_bindings_p): New.
+
+2002-03-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/4361
+ * mangle.c (struct globals) Add internal_mangling_p member.
+ (write_template_param): Do internal mangling, if needed.
+ (mangle_conv_op_name_for_type): Request internal mangling.
+
+2002-03-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/2136
+ * init.c (build_delete): Check access for a member op delete here.
+ * decl2.c (delete_sanity): Not here.
+
+2002-03-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/5118
+ * class.c (get_vfield_name): Use the constructor_name.
+
+2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine.
+ * cp-tree.h (lang_printable_name): Rename.
+ * error.c (lang_decl_name): Use new hook.
+ * lex.c (cxx_init): Remove old hook.
+ * pt.c (tsubst_decl): Use new hook.
+ * tree.c (lang_printable_name): Rename.
+
+2002-03-18 Eric Botcazou <ebotcazou@multimania.com>
+
+ PR c++/3882
+ * pt.c (tsubst_decl): Move __PRETTY_FUNCTION__ handling...
+ (tsubst_expr) [DECL_STMT]: ...here. And substitute the initializer
+ only after recording the declaration.
+
+2002-03-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/2039
+ * init.c (resolve_offset_ref): Hand off to build_component_ref.
+
+ PR c++/4222, c++/5995
+ * call.c (build_over_call): Fix empty class logic.
+
+ PR c++/3870
+ * cp-tree.h (struct saved_scope): Add last_parms field.
+ * decl.c (maybe_push_to_top_level): Save last_function_parms.
+ (pop_from_top_level): Restore it.
+
+ PR c++/4377
+ * mangle.c (write_expression): Strip NOP_EXPRs sooner. Also strip
+ NON_LVALUE_EXPRs.
+
+ PR c++/4003
+ * pt.c (tsubst_friend_function): Use decl_namespace_context.
+
+ PR c++/3948 -- C++ ABI change, followup to 2001-12-18 patch.
+ * class.c (finish_struct_bits): Also set TREE_ADDRESSABLE for a
+ type with a nontrivial destructor.
+
+2002-03-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/4460
+ * class.c (build_base_path): Virtual base layout is fixed in
+ in-charge [cd]tors.
+
+2002-03-17 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_PARSE_FILE): Redefine.
+ * parse.y (yyparse): Remove macro.
+
+2002-03-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/5757
+ * init.c (build_new_1): Pass the right pointer to op delete.
+
+2002-03-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/4361
+ * cp-tree.h (CLASSTYPE_METHOD_VEC): Document where templated
+ conversion operators go.
+ (struct lang_decl_flags): Add template_conv_p and unused
+ bitfields.
+ (DECL_TEMPLATE_CONV_FN_P): New macro.
+ * call.c (build_user_type_conversion_1): Don't check second type
+ conversion of overload set first.
+ * class.c (add_method): Make sure templated conversion operators
+ all end up on slot 2.
+ * lex.c (do_identifier): A conversion operator token might be
+ satisfied by a templated conversion operator.
+ * pt.c (check_explicit_specialization): Use
+ CLASSTYPE_FIRST_CONVERSION_SLOT.
+ (template_parm_this_level_p): New function.
+ (push_template_decl_real): Determine DECL_TEMPLATE_CONV_FN_P.
+ * search.c (lookup_fnfields_1): Template conversions will be on
+ the first slot.
+ * typeck.c (build_component_ref): Preserve the type of an
+ conversion operator name on the overload type.
+ (build_x_function_call): Retrieve the conversion operator name.
+
+2002-03-15 Richard Henderson <rth@redhat.com>
+
+ * init.c (build_new_1): Use size_binop instead of cp_build_binary_op.
+
+2002-03-15 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CLEANUP_DECL): Remove.
+ (CLEANUP_EXPR): Likewise.
+ * decl.c (destroy_local_var): Simplify.
+ (maybe_build_cleanup): Tidy.
+ * dump.c (cp_dump_tree): Remove handling of CLEANUP_STMT.
+ * semantics.c (cp_expand_stmt): Likewise.
+ * cp/tree.c (cp_statement_code_p): Likewise.
+
+2002-03-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/5857
+ * decl.c (duplicate_decls): Use merge_types instead of common_type.
+ * typeck.c (common_type): Just hand off to
+ type_after_usual_arithmetic_conversions and
+ composite_pointer_type.
+ (merge_types): New fn.
+ (commonparms): Use it instead of common_type.
+ (type_after_usual_arithmetic_conversions): Also handle COMPLEX_TYPE.
+ (composite_pointer_type): Also handle attributes.
+ * cp-tree.h: Declare merge_types.
+
+ * decl.c (make_rtl_for_nonlocal_decl): Also defer COMDAT
+ variables.
+ * decl2.c (maybe_make_one_only): Also mark the decl as needed.
+
+2002-03-14 Richard Henderson <rth@redhat.com>
+
+ * decl.c: Include c-pragma.h.
+ (start_decl, start_function): Invoke maybe_apply_pragma_weak.
+ * Make-lang.in: Update dependencies.
+
+2002-03-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/5908
+ * call.c (build_over_call): Set TREE_NO_UNUSED_WARNING too.
+ * cvt.c (convert_to_void): Preserve TREE_NO_UNUSED_WARNING.
+
+2002-03-12 Richard Sandiford <rsandifo@redhat.com>
+
+ * mangle.c (write_builtin_type): Handle 128-bit integers even if
+ they are not a standard integer type.
+
+2002-03-12 Richard Sandiford <rsandifo@redhat.com>
+
+ * cp-tree.h (init_init_processing): Remove declaration.
+ * init.c (BI_header_type, init_init_processing): Remove old ABI stuff.
+ * decl.c (cxx_init_decl_processing): Don't call init_init_processing.
+
+2002-03-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-lang.c (tree_code_type, tree_code_length, tree_code_name):
+ Define.
+ * decl.c (duplicate_decls): Use TREE_CODE_LENGTH, not
+ tree_code_length.
+ * lex.c (cplus_tree_code_type, cplus_tree_code_length,
+ cplus_tree_code_name): Delete.
+ (cxx_init): Don't call add_c_tree_codes, instead set
+ lang_unsafe_for_reeval. Don't try to copy into the various
+ tree_code arrays.
+
+2002-03-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5659
+ * decl.c (xref_tag): Don't set CLASSTYPE_DECLARED_CLASS here.
+ * decl2.c (handle_class_head): Set CLASSTYPE_DECLARED_CLASS for
+ definitions.
+
+2002-03-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ Revert 2001-03-26 Nathan Sidwell <nathan@codesourcery.com>,
+ DR209 is now not a defect.
+ * cp-tree.h (skip_type_access_control): Remove.
+ * decl.c (grokdeclarator): Do type access control for friend
+ declarations.
+ * semantics.c (decl_type_access_control): Don't reset
+ current_type_lookups.
+ (save_type_access_control): Always save the lookups.
+ (skip_type_access_control): Remove.
+ (finish_class_definition): Don't change type_lookups.
+
+2002-03-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ Revert 2000-12-01 Nathan Sidwell <nathan@codesourcery.com>,
+ It is incorrect.
+ * typeck.c (build_static_cast): Compare non-qualified types
+ with pointer to member conversions.
+
+2002-03-11 Dan Nicolaescu <dann@ics.uci.edu>
+ Daniel Berlin <dan@dberlin.org>
+
+ * cp-lang.c (ok_to_generate_alias_set_for_type): New function.
+ (cxx_get_alias_set): Use it.
+
+2002-03-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (stabilize_expr): Prototype.
+
+2002-03-08 Craig Rodrigues <rodrigc@gcc.gnu.org>
+
+ * cp-tree.h (CLEAR_BINFO_MARKED): Make both parts of
+ conditional return void.
+
+2002-03-08 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_UNSAVE): Redefine.
+ * cp-tree.h (cxx_unsave): New.
+ * tree.c (cp_unsave): Rename cxx_unsave, update prototype.
+ (init_tree): Update.
+
+2002-03-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
+ explicit sizeof/sizeof.
+ * decl2.c (cxx_decode_option): Likewise.
+ * lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.
+
+2002-03-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/775
+ * decl.c (lookup_tag): Only reject enum/class mismatch, not
+ class/union mismatch.
+ * parse.y (check_class_key): New function.
+ (structsp): Call it.
+
+2002-03-01 Michael Matz <matz@suse.de>
+
+ * typeck.c (cp_pointer_int_sum): Complete inner type which is
+ used later by size_in_bytes().
+
+2002-03-01 Phil Edwards <pme@gcc.gnu.org>
+
+ * cp-tree.h: Require __GNUC__ to be #defined.
+ (build_init): Add missing prototype.
+
+2002-03-01 Jason Merrill <jason@redhat.com>
+
+ * except.c: Don't include decl.h or obstack.h. Do include
+ tree-inline.h.
+ (build_throw): Destroy temporaries from the thrown
+ expression before calling __cxa_throw. Construct a thrown
+ temporary directly into the exception object.
+ (stabilize_throw_expr): New function.
+ (wrap_cleanups_r): New function.
+ * tree.c (stabilize_expr): New function.
+ * init.c (build_init): New function.
+ * Make-lang.in (cp/except.o): Adjust .h deps.
+
+2002-02-28 Jason Merrill <jason@redhat.com>
+
+ * search.c (lookup_base_r): Don't clear is_non_public just because
+ we found a friendly scope.
+
+ * decl.c (finish_function): Only warn about missing return
+ statement with -Wreturn-type.
+
+2002-02-28 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * class.c (build_clone): Update.
+ * cp-lang.c (LANG_HOOKS_DUP_LANG_SPECIFIC_DECL): Redefine.
+ * cp-tree.h (cxx_dup_lang_specific_decl): New.
+ * lex.c (copy_lang_decl): Rename cxx_dup_lang_specific_decl.
+ (copy_decl): Update.
+ * method.c (make_thunk): Update.
+
+2002-02-27 Zack Weinberg <zack@codesourcery.com>
+
+ * decl2.c: Delete traditional-mode-related code copied from
+ the C front end but not used, or used only to permit the
+ compiler to link.
+
+2002-02-24 Craig Rodrigues <rodrigc@gcc.gnu.org>
+
+ PR c++/4093
+ * cp-tree.h (SET_BINFO_MARKED): Cast false part of condition
+ to void.
+
+2002-02-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR other/5746
+ * semantics.c (finish_switch_cond): Don't call get_unwidened
+ if error_mark_node.
+
+2002-02-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/2645, DR 295
+ * cp-tree.h (tsubst_flags_t): Add tf_ignore_bad_quals,
+ tf_keep_type_decl.
+ (make_typename_type): Use tsubst_flags_t.
+ * decl.c (make_typename_type): Adjust. Return non-artificial
+ TYPE_DECLs, if required.
+ (grokdeclarator): Simplify CVR qualification handling. Allow bad
+ qualifiers on typedef types.
+ * decl2.c (handle_class_head): Adjust make_typename_type call.
+ * parse.y (nested_name_specifier): Likewise.
+ (typename_sub0): Likewise.
+ (typename_sub1): Likewise.
+ * pt.c (convert_template_argument): Adjust make_typename_type
+ return value.
+ (tsubst): Adjust cp_build_qualified_type_real calls.
+ (check_cv_quals_for_unify): Cope with allowing bad qualifications
+ on template type parms.
+ (instantiate_decl): Recheck substitutions to give warnings on bad
+ qualifications.
+ * tree.c (cp_build_qualified_type_real): Use tf_allow_bad_quals.
+
+2002-02-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * cp/decl.c (duplicate_decls): Merge always_inline attribute.
+
+ * cp/tree.c (cp_cannot_inline_tree_fn): Do not inline at -O0
+ unless DECL_ALWAYS_INLINE.
+
+2002-02-20 Jakub Jelinek <jakub@redhat.com>
+
+ * typeck.c (cp_pointer_int_sum): Renamed from
+ pointer_int_sum, call pointer_int_sum.
+
+2002-02-20 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (duplicate_decls): Return 0 if issued error about
+ redeclaration.
+
+2002-02-19 Jason Merrill <jason@redhat.com>
+
+ ABI change: Mangle `void (A::*)() const' as
+ M1AKFvvE, not MK1AFvvE.
+ * mangle.c (write_function_type): Write cv-quals for member
+ function type here.
+ (write_pointer_to_member_type): Not here.
+
+2002-02-18 Jason Merrill <jason@redhat.com>
+
+ * pt.c (do_type_instantiation): Don't pedwarn if in_system_header.
+ (do_decl_instantiation): Likewise.
+
+2002-02-17 Craig Rodrigues <rodrigc@gcc.gnu.org>
+
+ PR c++/5685
+ * decl.c (duplicate_decls): Make warning unconditional
+ if duplicate default argument declarations are present.
+
+2002-02-17 Jakub Jelinek <jakub@redhat.com>
+
+ * typeck.c (build_binary_op) [BIT_XOR_EXPR]: Remove explicit
+ shortening.
+
+2002-02-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Set typedef_decl for all TYPE_DECLs,
+ remove incorrect comment. Move #if 0'd code to common path. Use
+ IMPLICIT_TYPENAME_P. Simplify & reformat ARRAY_TYPE duplication.
+
+2002-02-13 Jason Merrill <jason@redhat.com>
+
+ * decl.c (builtin_function): Set TREE_THIS_VOLATILE on return fns.
+ (finish_function): Don't warn if current_function_returns_null.
+
+ * typeck2.c (digest_init): Do handle values of vector type.
+
+ * typeck2.c (digest_init, process_init_constructor): Treat vectors
+ like arrays.
+
+2002-02-11 Jason Merrill <jason@redhat.com>
+
+ * parse.y (reserved_declspecs): Don't handle attributes.
+ (reserved_typespecquals): Handle them here.
+ * Make-lang.in (parse.c): Adjust expected conflicts.
+
+2002-02-08 Jakub Jelinek <jakub@redhat.com>
+
+ * parse.y (primary, primary_no_id): Use compstmt_or_stmtexpr
+ instead of compstmt.
+ (compstmt_or_stmtexpr): Renamed from compstmt.
+ (compstmt): In addition to compstmt_or_stmtexpr clear last_expr_type.
+
+2002-02-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ Rename instantiate_type_flags to tsubst_flags_t & expand use.
+ * cp-tree.h (instantiate_type_flags): Rename to ...
+ (tsubst_flags_t): ... here. Rename itf_complain to tf_error,
+ add tf_warning flag.
+ (instantiate_type): Adjust prototype.
+ (tsubst, tsubst_expr, tsubst_copy, lookup_template_class,
+ do_type_instantiation, cp_build_qualified_type_real): Likewise.
+ cp_build_qualified_type: Adjust.
+ * class.c (instantiate_type): Adjust parameter. Rename itf_* to
+ tf_*.
+ * call.c (standard_conversion): Rename itf_* to tf_*.
+ (reference_binding): Likewise.
+ (convert_like_real): Likewise.
+ * cvt.c (cp_convert_to_pointer): Likewise.
+ (convert_to_reference): Likewise.
+ * decl.c (lookup_namespace_name): Use tf_* flags.
+ (make_typename_type): Likewise.
+ (grokdeclarator): Likewise.
+ * pt.c (convert_nontype_argument): Adjust COMPLAIN usage.
+ (coerce_template_template_parms, convert_template_argument,
+ coerce_template_parms, maybe_get_template_decl_from_type_decl,
+ lookup_template_class, tsubst_friend_function, tsubst_friend_class,
+ instantiate_class_template, tsubst_template_arg_vector,
+ tsubst_template_parms, tsubst_aggr_type, tsubst_default_argument,
+ tsubst_decl, tsubst_arg_types, tsubst_function_type,
+ tsubst_call_declarator_parms, tsubst, tsubst_copy, tsubst_expr,
+ instantiate_template, fn_type_unification,
+ resolve_overloaded_unification, verify_class_unification,
+ unify, get_bindings_real, do_type_instantiation,
+ regenerate_decl_from_template, instantiate_decl,
+ tsubst_initializer_list, tsubst_enum,
+ get_mostly_instantiated_function_type,
+ invalid_nontype_parm_type_p): Likewise.
+ * tree.c (cp_build_qualified_type_real): Likewise.
+ * typeck.c (build_binary_op): Rename itf_* to tf_*.
+ (build_ptrmemfunc): Likewise.
+ (convert_for_assignment): Likewise.
+
+2002-02-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/109
+ * decl.c (grokdeclarator): Allow friend declarations from
+ dependent types.
+ * decl2.c (handle_class_head): Don't push into template parm contexts.
+ * pt.c (push_template_decl_real): Template parm contexts are never
+ being defined.
+
+2002-02-05 Alexandre Oliva <aoliva@redhat.com>
+
+ * class.c: Include target.h.
+ (check_bitfield_decl): Disregard EMPTY_FIELD_BOUNDARY,
+ BITFIELDS_NBYTES_LIMITED and PCC_BITFIELD_TYPE_MATTERS for MS
+ bit-field layout.
+ * Make-lang.in: Adjust deps.
+
+2002-02-05 Jason Merrill <jason@redhat.com>
+
+ * error.c (dump_type): Be more helpful about VECTOR_TYPE.
+
+2002-02-04 Jakub Jelinek <jakub@redhat.com>
+
+ * semantics.c (begin_switch_stmt): Clear SWITCH_TYPE.
+ (finish_switch_cond): Set SWITCH_TYPE.
+
+2002-02-04 Richard Henderson <rth@redhat.com>
+
+ * method.c (use_thunk): Always initialize the block tree. Reindent.
+ * semantics.c (expand_body): Emit thunks after function, not before.
+
+2002-02-04 Jason Merrill <jason@redhat.com>
+
+ * decl.c (start_function): Call cplus_decl_attributes immediately
+ after grokdeclarator.
+
+ * decl.c (start_function): Combine DECL_RESULT handling code.
+
+2002-02-03 Jason Merrill <jason@redhat.com>
+
+ * xref.c: Remove.
+ * Make-lang.in (CXX_OBJS): Remove cp/xref.o
+ (cp/xref.o): Remove dependencies.
+ * class.c (finish_struct_1, check_methods): Don't call xref fns.
+ (finish_struct_1): Likewise.
+ * friend.c (make_friend_class): Likewise.
+ * lex.c (cxx_init, cxx_finish, extract_interface_info): Likewise.
+ * spew.c (read_process_identifier): Likewise.
+
+2002-02-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/4872
+ * decl.c (finish_function): Warn about a non-void function with
+ no return statement and no abnormal exit.
+ * cp-tree.h (struct cp_language_function): Add returns_abnormally.
+ (current_function_returns_abnormally): New macro.
+ * call.c (build_call): Set it.
+
+ * typeck.c (build_component_ref): Always complain about offsetof
+ constructs on non-PODs. Only make it an error for members of
+ virtual bases.
+
+ * error.c (dump_scope): Don't add TFF_DECL_SPECIFIERS.
+ (dump_function_decl): Always dump parms.
+
+ * decl2.c (finish_static_data_member_decl): Complain about a local
+ class with a static data member.
+
+ PR c++/4286
+ * search.c (lookup_field_1): Don't xref a static data member
+ just because we looked it up.
+
+2002-01-31 Jason Merrill <jason@redhat.com>
+
+ * Make-lang.in (parse.c): Handle .output file.
+
+ PR c++/3395
+ * decl.c (xref_tag): Remember early attributes in TYPE_ATTRIBUTES,
+ not TREE_TYPE.
+ * semantics.c (finish_class_definition): Adjust.
+
+ 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.
+
+2002-01-29 Jakub Jelinek <jakub@redhat.com>
+
+ * 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.
+
+2002-01-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2002-01-23 Zack Weinberg <zack@codesourcery.com>
+
+ * typeck2.c (friendly_abort): Delete definition.
+ * cp-tree.h (friendly_abort): Don't prototype.
+ (my_friendly_assert): Use fancy_abort.
+
+2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
+
+ * cp-tree.h (my_friendly_abort): Remove.
+
+2002-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ * 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.
+
+2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
+
+ * 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().
+
+2002-01-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/5453
+ * class.c (fixed_type_or_null): Fix thinko.
+
+ PR c++/3331
+ * init.c (resolve_offset_ref): Use build_indirect_ref.
+
+ * decl2.c (grokclassfn): Don't set DECL_REGISTER on 'this'.
+
+2002-01-22 Jason Merrill <jason@redhat.com>
+
+ * 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.
+
+ * class.c (build_base_path): Tweak formatting.
+
+2002-01-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ Fix regression introduced with patch for c++/775
+ * parse.y (class_head_defn): Check for template specializations
+ with a different class-key.
+
+2002-01-17 Jason Merrill <jason@redhat.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.
+
+ * error.c (dump_type_suffix): Print the exception specs before
+ recursing.
+ (dump_function_decl): Here, too.
+
+ * 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.
+
+2002-01-05 Richard Henderson <rth@redhat.com>
+
+ * semantics.c (expand_body): Revert last change.
+
+2002-01-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/4122
+ * class.c (update_vtable_entry_for_fn): Set delta to zero for a
+ lost primary.
+
+ * class.c (build_vtbl_initializer): Check for a lost primary
+ before calculating the vtable entry to throw away.
+
+2002-01-02 Jason Merrill <jason@redhat.com>
+
+ * semantics.c (expand_body): Call outlining_inline_function when
+ emitting an inline function out of line.
+
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5116, c++/764 reversion
+ * call.c (build_new_op): Revert the instantiations. They are
+ incorrect.
+
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5089
+ * decl2.c (reparse_absdcl_as_casts): Don't warn about casts to void.
+
+2002-01-02 Nathan Sidwell <nathan@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.
+
+2002-01-02 Nathan Sidwell <nathan@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.
+
+2002-01-02 Nathan Sidwell <nathan@codesourcery.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.
+
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5213
+ * pt.c (convert_template_argument): Be more careful determining
+ when RECORD_TYPE templates are or are not templates.
+
+2002-01-02 Nathan Sidwell <nathan@codesourcery.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.
+
+2002-01-02 Nathan Sidwell <nathan@codesourcery.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.
+
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5132
+ * decl2.c (reparse_absdcl_as_casts): Don't digest_init if we
+ are processing a template decl.
+
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5116, c++/764
+ * call.c (build_new_op): Make sure template class operands are
+ instantiated. Simplify arglist construction.
+
+2001-12-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-12-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5125
+ * pt.c (push_template_decl_real): Make sure DECL has
+ DECL_LANG_SPECIFIC.
+
+2001-12-29 Nathan Sidwell <nathan@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).
+
+2001-12-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/196
+ * parse.y (bad_parm): Better diagnostic when given a SCOPE_REF.
+
+2001-12-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/160
+ * typeck.c (build_modify_expr): Remove old unreachable code & tidy
+ up. Don't stabilize_references when initializing a reference.
+
+2001-12-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl2.c (lang_f_options): Const-ify.
+
+2001-12-20 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * config-lang.in (diff_excludes): Remove.
+
+2001-12-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/90
+ * typeck.c (build_function_call_real): Use original function
+ expression for errors.
+
+2001-12-18 Jason Merrill <jason@redhat.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.
+
+2001-12-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-12-18 Jason Merrill <jason@redhat.com>
+
+ 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.
+
+2001-12-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (build_new_method_call): Use '%#V'.
+ * error.c (cv_to_string): Use V parameter to determine padding.
+
+2001-12-18 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * call.c, decl2.c, init.c: Use "built-in" and "bit-field"
+ spellings in messages.
+
+2001-12-17 Zack Weinberg <zack@codesourcery.com>
+
+ * 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.
+
+2001-12-16 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * decl2.c (finish_file): Remove back_end_hook.
+
+2001-12-16 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2001-12-15 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * lang-options.h: Use American spelling in messages.
+
+2001-12-13 Jason Merrill <jason@redhat.com>
+
+ * Make-lang.in (parse.h): Separate rule, just depend on parse.c.
+
+ 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.
+
+ * optimize.c (maybe_clone_body): Fix parameter updating.
+
+2001-12-12 Jason Merrill <jason@redhat.com>
+
+ * 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.
+
+ * 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.
+
+ * 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.
+
+ * decl.c (finish_function): Check VMS_TARGET, not VMS.
+
+ * decl.c (start_cleanup_fn): Remove redundant pushlevel.
+ (end_cleanup_fn): And poplevel.
+
+ * semantics.c (setup_vtbl_ptr): Always build a CTOR_INITIALIZER
+ if we're in a template.
+
+2001-12-12 Jakub Jelinek <jakub@redhat.com>
+
+ * 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.
+
+2001-12-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Deprecated implicit typename use.
+
+2001-12-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-12-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/72
+ * decl.c (add_binding): Don't reject duplicate typedefs involving
+ template parameters.
+
+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.
+
+2001-12-08 Aldy Hernandez <aldyh@redhat.com>
+
+ * lex.c (rid_to_yy): Add RID_CHOOSE_EXPR and
+ RID_TYPES_COMPATIBLE_P.
+
+2001-12-08 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * 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.
+
+2001-12-08 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
+2001-12-05 Jason Merrill <jason@redhat.com>
+
+ * 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.
+
+ * init.c (resolve_offset_ref): Don't check access for the base
+ conversion to access a FIELD_DECL.
+
+ * cp-tree.h (TYPE_REFFN_P): New macro.
+ * decl.c (bad_specifiers): Check it, too.
+
+ * rtti.c (create_pseudo_type_info): Set CLASSTYPE_INTERFACE_ONLY
+ on the __*_type_info type if we haven't seen a definition.
+
+2001-12-05 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * decl.c: Include c-common.h.
+ (shadow_warning): Move to c-common.c.
+
+2001-12-05 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * decl.c (duplicate_decls): Don't copy DECL_NO_CHECK_MEMORY_USAGE.
+
+2001-12-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (end_template_parm_list): Clear TREE_CHAIN of each parm.
+
+2001-12-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-12-03 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * decl.c (xref_basetypes): Don't use C99 construct in tag_code
+ declaration and initialization.
+
+2001-12-03 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * typeck2.c: Remove leading capital from diagnostic messages, as
+ per GNU coding standards.
+
+2001-12-03 Mumit Khan <khan@nanotech.wisc.edu>
+
+ PR c++/3394
+ * decl.c (xref_basetypes): Handle attributes between
+ 'class' and name.
+
+2001-12-03 Nathan Sidwell <nathan@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.
+
+2001-12-03 Jason Merrill <jason@redhat.com>
+
+ * class.c (finish_vtbls): Fill in BINFO_VPTR_FIELD in the
+ immediate binfos for our virtual bases.
+
+2001-12-02 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
+2001-12-01 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
+2001-11-29 Mark Mitchell <mark@codesourcery.com>
+
+ 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.
+
+2001-11-29 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * Make-lang.in (c++.generated-manpages): New dummy target.
+
+2001-11-27 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * 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.
+
+2001-11-26 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
+2001-11-26 Jason Merrill <jason@redhat.com>
+
+ * call.c (joust): Remove COND_EXPR hack.
+
+2001-11-25 Aldy Hernandez <aldyh@redhat.com>
+
+ * search.c (lookup_base_r): Declare bk in variable declaration
+ space.
+
+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_r): 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.
+
+2001-11-20 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2001-11-19 John Wilkinson <johnw@research.att.com>
+
+ * 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,
+
+2001-11-19 Mark Mitchell <mark@codesourcery.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.
+
+2001-11-18 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * lex.c (cxx_finish): Call c_common_finish.
+ (finish_parse): Remove.
+
+2001-11-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * decl.c (create_array_type_for_decl): Check if NAME is NULL_TREE
+ when displaying error message about missing array bounds.
+
+2001-11-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * mangle.c (write_expression): Handle CAST_EXPR, STATIC_CAST_EXPR,
+ CONST_CAST_EXPR.
+ * operators.def: Add CAST_EXPR, STATIC_CAST_EXPR, CONST_CAST_EXPR.
+
+2001-11-16 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-tree.h (print_class_statistics): Restore.
+
+2001-11-15 Jason Merrill <jason@redhat.com>
+
+ * method.c (use_thunk): Don't emit debugging information for thunks.
+
+ * 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.
+
+ * 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.
+
+ * cvt.c (convert_to_void): If we build a new COND_EXPR, always
+ give it void type.
+
+2001-11-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/3154
+ * init.c (sort_base_init): Remove unreachable code.
+ (expand_member_init): Adjust comment to reflect reality. Simplify
+ and remove unreachable code.
+
+2001-11-15 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
+2001-11-14 Richard Sandiford <rsandifo@redhat.com>
+
+ * 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.
+
+2001-11-14 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * Make-lang.in: Change all uses of $(manext) to $(man1ext).
+
+2001-11-13 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/4206
+ * parse.y (already_scoped_stmt): Remove.
+ (simple_stmt, WHILE & FOR): Use implicitly_scoped_stmt.
+
+2001-11-12 H.J. Lu <hjl@gnu.org>
+
+ * cvt.c (ocp_convert): Don't warn the address of a weak
+ function is always `true'.
+
+2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
+2001-11-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (dump_array): Fix format specifier warning.
+
+2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
+2001-11-08 Andreas Franck <afranck@gmx.de>
+
+ * 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.
+
+2001-11-06 Neil Booth <neil@cat.daikokuya.demon.co.uk>
+
+ * Make-lang.in: Update.
+ * cp-lang.c: Include langhooks-def.h.
+
+2001-11-04 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (tsubst_copy): Call tsubst for TYPEOF_EXPR.
+
+2001-11-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * lex.c (copy_lang_type): Add static prototype.
+
+2001-11-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (unify): Handle SCOPE_REF.
+
+2001-11-01 Jakub Jelinek <jakub@redhat.com>
+
+ * tree.c (cp_copy_res_decl_for_inlining): Adjust
+ DECL_ABSTRACT_ORIGIN for the return variable.
+
+2001-10-31 Zack Weinberg <zack@codesourcery.com>
+
+ * Make-lang.in: Replace $(INTL_TARGETS) with po-generated.
+
+2001-10-28 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * ChangeLog.1, ChangeLog.2, ChangeLog, class.c, decl2.c, search.c,
+ semantics.c, spew.c: Fix spelling errors.
+
+2001-10-27 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * decl2.c (validate_nonmember_using_decl): Handle NAMESPACE_DECL.
+
+2001-10-25 Zack Weinberg <zack@codesourcery.com>
+
+ * cp-lang.c: Redefine LANG_HOOKS_CLEAR_BINDING_STACK to
+ pop_everything.
+
+2001-10-23 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * cp-lang.c (cxx_get_alias_set): New function.
+ Point LANG_HOOKS_GET_ALIAS_SET to it.
+
+2001-10-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * 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.
+
+2001-10-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * xref.c (GNU_xref_member): Use safe-ctype macros and/or fold
+ extra calls into fewer ones.
+
+2001-10-18 Alexandre Oliva <aoliva@redhat.com>
+
+ * 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.
+
+2001-10-16 H.J. Lu <hjl@gnu.org>
+
+ * cp-tree.h (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Defined
+ for tree checking disabled.
+
+2001-10-16 Hans-Peter Nilsson <hp@axis.com>
+
+ * cp-tree.h (VFIELD_NAME_FORMAT) [NO_DOLLAR_IN_LABEL &&
+ NO_DOT_IN_LABEL]: Adjust to match VFIELD_NAME.
+
+2001-10-15 Richard Sandiford <rsandifo@redhat.com>
+
+ * 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.
+
+2001-10-15 Richard Sandiford <rsandifo@redhat.com>
+
+ * decl.c (bad_specifiers): Don't allow exception specifications
+ on any typedefs.
+
+2001-10-14 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp/lex.c (init_cp_pragma): Similarly.
+
+2001-10-13 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (lookup_template_class): Build complete template arguments
+ for BOUND_TEMPLATE_TEMPLATE_PARM.
+
+2001-10-12 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * 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.
+
+2001-10-12 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (determine_specialization): Ignore functions without
+ DECL_TEMPLATE_INFO.
+
+2001-10-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/4476
+ * typeck2.c (abstract_virtuals_error): Ignore incomplete classes.
+
+2001-10-11 Jason Merrill <jason_merrill@redhat.com>
+
+ * typeck2.c (store_init_value): Don't re-digest a bracketed
+ initializer.
+
+ * class.c (finish_struct_anon): Use TYPE_ANONYMOUS_P instead of
+ ANON_AGGR_TYPE_P.
+
+2001-10-11 Richard Henderson <rth@redhat.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.
+
+2001-10-10 Richard Henderson <rth@redhat.com>
+
+ * parse.y (asm_operand): Allow named operands.
+ * semantics.c (finish_asm_stmt): Tweek for changed location
+ of the operand constraint.
+
+2001-10-09 Jason Merrill <jason_merrill@redhat.com>
+
+ * 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.
+
+2001-10-08 Alexandre Oliva <aoliva@redhat.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.
+
+2001-10-08 Richard Henderson <rth@redhat.com>
+
+ * cp-tree.h (struct lang_decl_flags): Remove declared_inline.
+ (DECL_DECLARED_INLINE_P): Use the bit in struct c_lang_decl.
+
+2001-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * 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.
+
+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.
+
+2001-10-03 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * rtti.c (get_tinfo_decl): Call typeinfo_in_lib_p with the type used
+ to build the declaration instead of the declaration itself.
+
+2001-10-02 Jason Merrill <jason_merrill@redhat.com>
+
+ * decl2.c (cxx_decode_option): Add 'else'.
+
+ * spew.c (end_input): No longer static.
+ * cp-tree.h: Declare it.
+ * parse.y (datadef): Add "error END_OF_SAVED_INPUT" expansion.
+
+2001-10-02 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2001-10-02 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2001-10-01 Jason Merrill <jason_merrill@redhat.com>
+
+ * decl.c (grokdeclarator): Copy array typedef handling from C
+ frontend.
+
+ * decl.c (grokdeclarator): Copy too-large array handling from C
+ frontend.
+
+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.
+
+2001-09-22 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.
+
+2001-09-21 J"orn Rennecke <amylaar@redhat.com>
+
+ * decl.c (grokdeclarator): Use C syntax for attr_flags declaration.
+
+2001-09-21 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ 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.
+
+2001-09-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/4203
+ * call.c (build_over_call): Do not optimize any empty base
+ construction.
+
+2001-08-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * error.c (dump_template_decl): Output template parameters
+ together with their specifiers.
+ Output `class' prefix for template template parameter.
+ (dump_decl): Fix formatting.
+
+2001-08-30 Kurt Garloff <garloff@suse.de>
+
+ * optimize.c (inlinable_function_p): Allow only smaller single
+ functions. Halve inline limit after reaching recursive limit.
+
+2001-08-30 Joern Rennecke <amylaar@redhat.com>
+ Jason Merrill <jason_merrill@redhat.com>
+
+ * class.c (build_vtable_entry_ref): Subtract in char*, not
+ ptrdiff_t.
+
+2001-08-23 Jason Merrill <jason_merrill@redhat.com>
+
+ * 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.
+
+ * 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.
+
+2001-08-22 Jason Merrill <jason_merrill@redhat.com>
+
+ * 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.
+
+2001-08-19 Jakub Jelinek <jakub@redhat.com>
+
+ * typeck2.c (add_exception_specifier): Only require complete type if
+ not in processing template declaration.
+
+2001-08-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c: Cast argument to size_t, not HOST_WIDE_INT, in calls to
+ GNU_xref_start_scope and GNU_xref_end_scope.
+
+ * tree.c (TYPE_HASH): Moved to ../tree.h.
+
+2001-08-16 Mark Mitchell <mark@codesourcery.com>
+
+ * cvt.c (convert_to_void): Preserve TREE_SIDE_EFFECTS
+ on COMPOUND_EXPRs.
+
+2001-08-14 Richard Henderson <rth@redhat.com>
+
+ * class.c, cp-tree.h (build_vfn_ref): Remove.
+ * call.c, rtti.c: Replace all refernces with build_vtbl_ref.
+
+2001-08-13 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_over_call): Mark COMPOUND_EXPRs generated for
+ empty class assignment as having side-effects to avoid
+ spurious warnings.
+
+2001-08-13 Zack Weinberg <zackw@panix.com>
+
+ * Make-lang.in (cp/except.o): Add libfuncs.h to dependencies.
+ * except.c: Include libfuncs.h.
+
+2001-08-11 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ * decl.c (grokdeclarator): Clarify diagnostic message.
+
+2001-08-13 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * decl2.c (do_nonmember_using_decl): Replace using directive
+ with using declaration in the error message.
+
+2001-08-11 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (maybe_fold_nontype_arg): Use TREE_TYPE of ARG as the
+ criterion to avoid rebuilding expression tree instead of
+ processing_template_decl.
+
+2001-08-07 Jason Merrill <jason_merrill@redhat.com>
+
+ 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.
+
+2001-08-09 Richard Henderson <rth@redhat.com>
+
+ * decl2.c (finish_objects): Use target hooks instead of
+ assemble_constructor and assemble_destructor.
+
+2001-08-08 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * g++spec.c (lang_specific_driver): Quote argument after `-Xlinker'.
+
+2001-08-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-08-07 Jason Merrill <jason_merrill@redhat.com>
+
+ * tree.c (walk_tree): Walk siblings even if !walk_subtrees.
+
+2001-08-06 Richard Henderson <rth@redhat.com>
+
+ * decl2.c (finish_objects): Pass a symbol_ref and priority to
+ assemble_{constructor,destructor}. Remove priority handling.
+
+2001-08-05 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ Don't allow template-id in using-declaration.
+ * decl2.c (validate_nonmember_using_decl): Handle template-ids.
+ (do_class_using_decl): Likewise.
+
+2001-08-04 Neil Booth <neil@cat.daikokuya.demon.co.uk>
+
+ * cp/spew.c (read_token): No need to pop buffers.
+
+2001-08-02 Stan Shebs <shebs@apple.com>
+
+ * cp-tree.h (FNADDR_FROM_VTABLE_ENTRY): Remove, no longer used.
+ (fnaddr_from_vtable_entry): Remove decl.
+ * method.c (use_thunk): Update comment.
+
+2001-08-01 Andrew Cagney <ac131313@redhat.com>
+
+ * repo.c (get_base_filename): Change return value to const char
+ pointer.
+
+2001-08-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-07-31 Alexandre Petit-Bianco <apbianco@redhat.com>
+
+ * tree.c (cp_tree_equal): WITH_CLEANUP_EXPR node to use its second
+ operand while calling cp_tree_equal.
+
+2001-07-31 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+ 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.
+
+2001-07-31 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/3631
+ * class.c (update_vtable_entry_for_fn): The fixed adjustment
+ of a virtual thunk should be from declaring base.
+
+2001-07-31 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (dfs_ctor_vtable_bases_queue_p): Always walk into
+ the shared virtual base, so preserving inheritance graph order.
+
+2001-07-30 Andreas Jaeger <aj@suse.de>
+
+ * decl2.c: Remove unused var global_temp_name_counter.
+
+2001-07-28 Richard Henderson <rth@redhat.com>
+
+ * method.c (pending_inlines): Remove.
+
+2001-07-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-07-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (finish_struct_1): When copying the primary base's
+ VFIELD, make sure we find it is at offset zero.
+
+2001-07-26 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (tsubst_template_parms): Call maybe_fold_nontype_arg and
+ tsubst_expr for default template arguments.
+
+2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/3621
+ * spew.c (yylex): Only copy the token's lineno, if it is
+ nonzero.
+
+2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (last_function_parm_tags): Remove.
+ (current_function_parm_tags): Remove.
+ (init_decl_processing): Adjust.
+ (start_function): Adjust.
+ (store_parm_decls): Adjust.
+
+ PR c++/3152
+ * decl.c (grokdeclarator): Detect when a function typedef is
+ declaring a function, and create last_function_parms correctly.
+
+2001-07-25 Jason Merrill <jason_merrill@redhat.com>
+
+ * call.c (joust): Only prefer a non-builtin candidate to a builtin
+ one if they have the same signature.
+
+ * 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.
+
+2001-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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 uninitialized
+ 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
+ behavior. 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.
+
+2001-07-18 Xavier Delacour <xavier@fmaudio.net>,
+ Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
+
+ * NEWS (Changes in GCC 3.0): Fix typo.
+
+2001-07-13 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2001-07-12 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (make_rtl_for_nonlocal_decl): Set DECL_C_HARD_REGISTER
+ for `register' variables with an asm-specification.
+
+2001-07-11 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (finish_asm_stmt): Mark the output operands
+ to an asm addressable, if necessary.
+
+2001-07-11 Ben Elliston <bje@redhat.com>
+
+ * Revert this change -- there is a subtle bug.
+
+ 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.
+
+2001-07-10 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst_decl): Set DECL_CONTEXT for namespace-scope
+ variables.
+
+2001-07-10 Jason Merrill <jason_merrill@redhat.com>
+
+ * semantics.c (cp_expand_stmt): Fix for null
+ current_function_return_value.
+
+2001-07-10 Jan van Male <jan.vanmale@fenk.wau.nl>
+
+ * 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.
+
+2001-07-09 Erik Rozendaal <dlr@acm.org>
+
+ * 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.
+
+2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update
+ calls to decl_attributes.
+
+2001-07-06 Ira Ruben <ira@apple.com>
+
+ * cp-tree.def (TEMPLATE_DECL): Update comment. DECL_RESULT should
+ be DECL_TEMPLATE_RESULT.
+
+2001-07-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * 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.
+
+2001-07-05 Jason Merrill <jason_merrill@redhat.com>
+
+ * 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.
+
+ * 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.
+
+2001-07-02 Nathan Sidwell <nathan@codesourcery.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.
+
+2001-06-29 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * typeck.c (COMP_TYPE_ATTRIBUTES): Don't define.
+ (comptypes): Use target.comp_type_attributes.
+
+2001-06-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (flag_dump_class_layout): Remove unneeded declaration.
+
+2001-06-28 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ * error.c (lang_print_error_function): Add a `diagnostic_context *'
+ parameter. Tweak.
+
+2001-06-27 Neil Booth <neil@cat.daikokuya.demon.co.uk>
+
+ * decl2.c (import_export_class): Update.
+
+2001-06-26 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c (init_error): Adjust settings.
+
+2001-06-26 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c (init_error): Adjust settings.
+
+2001-06-19 Richard Sandiford <rsandifo@redhat.com>
+
+ * except.c (initialize_handler_parm): Expect __cxa_begin_catch to
+ return pointers to data members by reference rather than by value.
+
+2001-06-18 Jason Merrill <jason_merrill@redhat.com>
+
+ 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.
+
+2001-06-15 Jason Merrill <jason_merrill@redhat.com>
+
+ * 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.
+
+2001-06-14 Jason Merrill <jason_merrill@redhat.com>
+
+ * class.c (dfs_find_final_overrider): Fix logic.
+
+ * class.c (update_vtable_entry_for_fn): Uncomment optimization to use
+ virtual thunk instead of non-virtual.
+ (get_matching_virtual): Uncomment.
+
+ * 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.
+
+2001-06-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-06-13 Mark Mitchell <mark@codesourcery.com>
+
+ * NEWS: Update release number.
+
+2001-06-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-06-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-06-11 Mark Mitchell <mark@codesourcery.com>
+
+ * lang-options.h: Emit documentation for -fno-honor-std, not
+ -fhonor-std.
+
+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 (find_final_overrider): Return error_mark_node on error.
+
+ * decl2.c (key_method): #if 0 accidental change.
+
+2001-06-06 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * 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.
+
+2001-06-05 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (begin_class_definition): Robustify.
+
+ * 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.
+
+2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (build_user_type_conversion_1): Set ICS_USER_FLAG and
+ ICS_BAD_FLAG on created conversion.
+ (compare_ics): Break out rank.
+
+2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (xref_tag): Remove extraneous %s on dependent name
+ lookup warning.
+
+2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (layout_vtable_decl): Fix off by one error on
+ build_index_type.
+ (build_vtt): Likewise.
+ (build_ctor_vtbl_group): Likewise.
+
+2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-06-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/2936
+ Part missed from first commit
+ * decl2.c (finish_anon_union): Copy context.
+
+2001-05-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/2936
+ * optimize.c (remap_decl): Remap anonymous aggregate members too.
+
+2001-05-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/2823
+ * semantics.c (expand_body): Don't optimize thunks.
+
+2001-05-25 Sam TH <sam@uchicago.edu>
+
+ * cp-tree.h lex.h: Fix header include guards.
+
+2001-05-25 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (init_decl_processing): Tweak.
+
+2001-05-24 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (duplicate_decls): Tidy.
+ (init_decl_processing): Always set flag_no_builtin.
+
+2001-05-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/2184
+ * decl2.c (do_local_using_decl): Push the decls, even in a
+ template.
+
+2001-05-22 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (initialize_inlined_parameters): Don't set
+ TREE_READONLY for a VAR_DECL taking the place of an inlined
+ PARM_DECL.
+
+2001-05-22 Jason Merrill <jason_merrill@redhat.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.
+
+2001-05-22 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * parse.y: Refer to compound literals as such, not as
+ constructor-expressions.
+
+2001-05-21 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2001-05-21 Jason Merrill <jason_merrill@redhat.com>
+
+ * 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.
+
+ * decl2.c (maybe_make_one_only): Check flag_weak, not
+ supports_one_only().
+
+ * 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.
+
+2001-05-18 Jason Merrill <jason_merrill@redhat.com>
+
+ * class.c (build_vtable): Set DECL_ASSEMBLER_NAME for vtables here.
+ (get_vtable_decl, build_vtt): Not here.
+
+2001-05-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/2781
+ * optimize.c (update_cloned_parm): Copy addressability and other
+ flags.
+
+2001-05-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (determine_specialization): Ignore artificial functions.
+
+2001-05-20 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
+2001-05-18 Diego Novillo <dnovillo@redhat.com>
+
+ * decl2.c (finish_objects): Use the original SYMBOL_REF from the
+ function declaration to avoid stripping the symbol's attributes.
+
+2001-05-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (pushdecl): Adjust error string.
+ (xref_tag): Adjust friend class injection warning. Remove the
+ inherited name from the class shadowed scope.
+
+2001-05-17 Mark Mitchell <mark@codesourcery.com>
+
+ * except.c (cp_protect_cleanup_actions): New function.
+ (init_exception_processing): Don't set protect_cleanup_actions
+ here. Do set lang_protect_cleanup_actions.
+
+2001-05-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * spew.c (read_token): Call yyerror on all unexpected tokens.
+
+2001-05-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * init.c (member_init_ok_or_else): Take a tree rather than
+ string for name.
+ (expand_member_init): Adjust.
+
+2001-05-14 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * decl.c (duplicate_decls): Suppress warning about duplicate
+ decls if the first decl is a friend.
+
+2001-05-12 Zack Weinberg <zackw@stanford.edu>
+
+ * 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.
+
+2001-05-12 Neil Booth <neil@cat.daikokuya.demon.co.uk>
+
+ * method.c (build_mangled_C99_name): Remove unused prototype.
+
+2001-05-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * 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.
+
+ Reverted Geoff Keating's 2001-05-03's patch.
+
+2001-05-11 Ira Ruben <ira@apple.com>
+
+ * cp/cp-tree.h (C_EXP_ORIGINAL_CODE): Delete; declared in c-common.h.
+
+2001-05-11 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-tree.h (finish_label_expr, lookup_label): Delete.
+ * parse.y: Update for '&&'; don't issue warning here.
+ * semantics.c (finish_label_expr): Delete.
+
+2001-05-07 Mark Mitchell <mark@codesourcery.com>
+
+ * splay-tree.h (splay_tree_max): New function.
+ (splay_tree_min): Likewise.
+
+2001-05-03 Geoffrey Keating <geoffk@redhat.com>
+
+ * 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.
+
+2001-05-03 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2001-05-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+ * tree.c (walk_tree): Reformat an if block.
+
+2001-05-02 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (compute_array_index_type): Don't try to do anything with
+ the indices when processing a template.
+
+2001-05-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * 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.
+
+2001-05-02 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (do_using_directive): Revert previous patch.
+
+2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (build_new_op): Convert args from reference here.
+ (build_conditional_expr): Don't convert here.
+
+2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ * spew.c (last_token_id): New static variable.
+ (read_token): Set it here.
+ (yyerror): Use it here.
+
+2001-04-30 Richard Henderson <rth@redhat.com>
+
+ * cvt.c: Downcase C_PROMOTING_INTEGER_TYPE_P invocations.
+ * decl.c: Likewise.
+
+2001-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * gxxint.texi: Remove.
+ * Make-lang.in: Remove all traces of gxxint.texi.
+
+2001-04-30 Mark P Mitchell <mark@codesourcery.com>
+
+ * decl2.c (start_static_initialization_or_destruction): Correct
+ logic to handle the -fno-use-cxa-atexit case.
+
+2001-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (update_cloned_parm): New function.
+ (maybe_clone_body): Use it. Update the `this' parameter too.
+
+2001-04-29 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl2.c (unsupported_options): Add new-abi.
+ * lang-options.h: Remove no longer supported options.
+
+2001-04-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * except.c (can_convert_eh): Don't check template parms,
+ typename types etc.
+
+2001-04-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * optimize.c (maybe_clone_body): Copy parameter names and locations.
+
+2001-04-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-04-26 Mark Mitchell <mark@codesourcery.com>
+
+ * method.c (use_thunk): Make sure that thunks really are emitted
+ when requested.
+
+2001-04-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ * mangle.c (write_chars): New macro.
+ (hwint_to_ascii): New function
+ (write_number): Use it.
+ (write_integer_cst): Deal with really big numbers.
+
+2001-04-25 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (maybe_clone_body): Copy TREE_PUBLIC before emitting
+ the clone.
+
+2001-04-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Set context of namespace scope
+ TYPE_DECLS.
+
+2001-04-24 Zack Weinberg <zackw@stanford.edu>
+
+ * 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.
+
+2001-04-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-04-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (tsubst_decl): Use VOID_TYPE_P.
+ * semantics.c: Fix some typos.
+
+2001-04-23 Phil Edwards <pme@sources.redhat.com>
+
+ * cp/decl2.c (flag_honor_std): Always initialize to 1.
+
+2001-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * xref.c (GNU_xref_file): Use concat in lieu of xmalloc/sprintf.
+
+2001-04-23 Jason Merrill <jason_merrill@redhat.com>
+
+ * except.c (build_throw): Wrap the initialization of the exception
+ object in a MUST_NOT_THROW_EXPR.
+ (do_free_exception): #if 0.
+
+2001-04-20 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (finish_enum): Change prototype.
+ * decl.c (finish_enum): Reorganize.
+ * parse.y (structsp): Adjust calls to finish_enum.
+
+2001-04-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tree.c (cp_tree_equal): Adjust final switch formatting. Add
+ 't' case.
+
+2001-04-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-04-20 Jakub Jelinek <jakub@redhat.com>
+
+ * call.c (maybe_handle_ref_bind): Copy ICS_USER_FLAG and
+ ICS_BAD_FLAG.
+
+2001-04-20 Jakub Jelinek <jakub@redhat.com>
+
+ * 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.
+
+2001-04-19 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+ (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.
+
+ * decl.c (current_class_depth, global_namespace): Likewise.
+
+ * decl2.c (current_class_depth, flag_gnu_xref): Likewise
+
+ * repo.c (flag_use_repository): Likewise.
+
+2001-04-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * 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.
+
+2001-04-11 Jason Merrill <jason_merrill@redhat.com>
+
+ * 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.
+
+2001-04-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (dfs_unshared_virtual_bases): New function.
+ (mark_primary_bases): Call it.
+ (check_bases): Ignore virtual bases when determining
+ nearly-emptiness.
+
+2001-04-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * method.c (make_thunk): Clear DECL_CLONED_FUNCTION.
+
+2001-04-11 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (maybe_clone_body): Copy DECL_NUM_STMTS from the
+ cloned function to the clone.
+
+2001-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Make-lang.in (cp/semantics.o): Depend on $(EXPR_H).
+
+ * semantics.c: Include expr.h.
+
+2001-04-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * method.c (implicitly_declare_fn): Commonize code for copy ctor
+ and assignment op. Set TREE_USED for parameter.
+
+2001-04-10 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2001-04-10 Richard Henderson <rth@redhat.com>
+
+ * typeck.c (build_array_ref): Push the array reference inside
+ COMPOUND_EXPR and COND_EXPR.
+
+2001-04-05 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+ (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.
+
+2001-04-05 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.
+
+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.
+ (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.
+
+2001-03-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (add_method): Use memcpy/memmove, not bcopy.
+
+ * decl.c (duplicate_decls): Likewise.
+
+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 nonzero.
+ (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.
+
+ * error.c (GLOBAL_THING): Always use '__'.
+
+2001-03-21 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_clone): Clear DECL_ASSEMBLER_NAME.
+
+ * mangle.c (mangle_decl_string): Mangle the names of overloaded
+ operators, even when they have `extern "C"' linkage.
+
+2001-03-19 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2001-03-15 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ Correct semantics restrictions checking in throw-expression.
+ * except.c (is_admissible_throw_operand): New function.
+ (build_throw): Use it.
+
+2001-03-14 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (cp_make_fnname_decl): Set DECL_IGNORED_P on __FUNCTION__
+ and its ilk.
+
+2001-03-14 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2001-03-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-03-10 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp/lex.c: Delete duplicate pending_lang_change.
+
+2001-03-10 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
+2001-03-09 Zack Weinberg <zackw@stanford.edu>
+
+ * Make-lang.in: Add dependencies on $(TM_P_H) as appropriate.
+
+2001-03-08 Stan Shebs <shebs@apple.com>
+
+ * cp-tree.h (set_identifier_local_value): Remove unused decl.
+
+2001-03-06 Zack Weinberg <zackw@stanford.edu>
+
+ * spew.c: Remove references to CPP_OSTRING.
+
+2001-03-06 Andrew Haley <aph@redhat.com>
+
+ * typeck.c (convert_arguments): Check that we have an fndecl.
+
+2001-03-05 Andrew Haley <aph@redhat.com>
+
+ * typeck.c (convert_arguments): Don't do ellipsis conversion for
+ __built_in_constant_p.
+
+2001-03-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (build_static_cast): Allow enum to enum conversions
+ as per DR 128.
+
+2001-03-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (check_field_decls): Pointers to member do not a
+ non-pod struct make, as per DR 148.
+
+2001-03-02 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (joust): cp_pedwarn when using gnu extension concerning
+ worst conversion sequences.
+
+2001-03-01 Zack Weinberg <zackw@stanford.edu>
+
+ * decl.c: Replace all uses of 'boolean' with 'bool'.
+
+2001-03-01 Zack Weinberg <zackw@stanford.edu>
+
+ * 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.
+
+2001-03-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-03-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl2.c (do_nonmember_using_decl): Don't complain if we find
+ same function. Do complain about ambiguating extern "C"
+ declarations.
+
+2001-02-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-02-27 Jeffrey Oldham <oldham@codesourcery.com>
+
+ * except.c (call_eh_info): Revert "match_function"'s type.
+
+2001-02-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-02-26 Jeffrey Oldham <oldham@codesourcery.com>
+
+ * call.c (joust): Ensure more_specialized()'s argument length
+ parameter has correct value for constructors.
+
+2001-02-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ * except.c (call_eh_info): Cleanup generation of cp_eh_info struct.
+
+ * decl.c (mark_inlined_fns): Prototype.
+
+2001-02-22 Mark Mitchell <mark@codesourcery.com>
+
+ * spew.c (yylex): Correct handling of friends.
+
+2001-02-22 Mark Mitchell <mark@codesourcery.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.
+
+2001-02-22 Andreas Jaeger <aj@suse.de>
+
+ * optimize.c: Include toplev.h for
+ note_deferral_of_defined_inline_function prototype.
+
+2001-02-22 Jakub Jelinek <jakub@redhat.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.
+
+2001-02-21 Jason Merrill <jason@redhat.com>
+
+ * cp-tree.h (struct lang_decl_flags): Remove uninlinable flag.
+ (DECL_UNINLINABLE): Move to middle-end.
+
+ * 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.
+
+ * method.c (implicitly_declare_fn): Don't set DECL_ARTIFICIAL on
+ second parm of op=.
+
+2001-02-19 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (set_decl_namespace): Allow explicit instantiations in
+ any namespace.
+
+2001-02-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * optimize.c (expand_call_inline): Don't walk subtrees of type
+ nodes.
+
+2001-02-18 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (add_vcall_offset_vtbl_entries_1): Only add one entry
+ for a destructor.
+
+2001-02-18 Jason Merrill <jason@redhat.com>
+
+ 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.
+
+ * semantics.c (finish_typeof): Resolve OFFSET_REFs.
+
+ * pt.c (check_explicit_specialization): Copy TREE_PRIVATE and
+ TREE_PROTECTED from the template being specialized.
+
+2001-02-17 Jason Merrill <jason@redhat.com>
+
+ * decl2.c (build_artificial_parm): Set TREE_READONLY.
+
+ * 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.
+
+2001-02-17 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (check_dtor_name): Handle template names correctly.
+
+2001-02-16 Jason Merrill <jason@redhat.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.
+
+2001-02-16 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * decl.c (check_tag_decl): Make sure a typedef for an anonymous
+ class-type introduces at least a type-name.
+
+2001-02-16 Jakub Jelinek <jakub@redhat.com>
+
+ * call.c (convert_like_real): Create a temporary for non-lvalue.
+
+2001-02-16 Jeffrey Oldham <oldham@codesourcery.com>
+
+ * cp-tree.h: Fix typos in comments.
+
+2001-02-16 Jason Merrill <jason@redhat.com>
+
+ * optimize.c (remap_block): If we're compiling a clone, pass the
+ new block to insert_block.
+
+2001-02-16 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (finish_asm_stmt): Robustify.
+
+2001-02-15 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (push_template_decl_real): Don't remangle the name of a
+ class template.
+
+2001-02-15 Jim Meyering <meyering@lucent.com>
+
+ * Make-lang.in (c++.install-common): Depend on installdirs.
+ (c++.install-info): Likewise.
+ (c++.install-man): Likewise.
+
+2001-02-15 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck2.c (build_m_component_ref): Robustify.
+
+2001-02-15 Alexandre Oliva <aoliva@redhat.com>
+
+ * 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.
+
+2001-02-14 Jakub Jelinek <jakub@redhat.com>
+
+ * typeck.c (build_unary_op): Clarify error message.
+
+2001-02-08 Aldy Hernandez <aldyh@redhat.com>
+
+ * parse.y (component_constructor_declarator): allow optional
+ parentheses around constructor class name.
+
+2001-02-14 Nathan Sidwell <nathan@codesourcery.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.
+
+2001-02-14 Nathan Sidwell <nathan@codesourcery.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.
+
+2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (unify): Don't check cv quals of array types.
+
+2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tree.c (cp_build_qualified_type_real): Use CP_TYPE_QUALS to
+ check whether we already have the type.
+
+2001-02-13 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2001-02-13 Jason Merrill <jason@redhat.com>
+
+ * lang-specs.h: Add more __EXCEPTIONS.
+
+2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck2.c (process_init_constructor): Check
+ TREE_HAS_CONSTRUCTOR before issuing missing init warning.
+
+2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (maybe_adjust_types_for_deduction, DEDUCE_ORDER case):
+ Remove spurious information in comment. Allow further
+ adjustments of REFERENCE_TYPE args.
+
+2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * errfn.c (cp_deprecated): Tweak diagnostic text.
+ * parse.y (new_initializer): Deprecate initializer lists
+ extension.
+
+2001-02-12 Mark Mitchell <mark@codesourcery.com>
+
+ Remove old ABI support.
+
+2001-02-11 Mark Mitchell <mark@codesourcery.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.
+
+ * Makefile.in (g++spec.o): Fix typo.
+
+2001-02-09 Jason Merrill <jason@redhat.com>
+
+ * lang-specs.h: Restore definition of __EXCEPTIONS.
+
+2001-02-08 Jason Merrill <jason@redhat.com>
+
+ * search.c (shared_member_p): New function.
+ (lookup_field_r): Use it.
+ * cp-tree.h (SHARED_MEMBER_P): Remove.
+
+ * 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.
+
+ * decl.c (lookup_name_real): Tweak warning to refer to decls, not
+ types.
+
+ * typeck2.c (friendly_abort): Don't say anything if we have
+ earlier errors or sorries.
+
+ * decl.c (check_tag_decl): Notice attempts to redefine bool and
+ wchar_t. Ignore if in_system_header.
+
+ * 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.
+
+2001-02-07 Mark Mitchell <mark@codesourcery.com>
+
+ * lang-specs.h: Use CPLUSPLUS_CPP_SPEC for the preprocessor
+ spec.
+
+2001-02-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-02-05 Alexandre Oliva <aoliva@redhat.com>
+
+ * method.c (build_mangled_name) [old abi]: Protect flush_repeats()
+ from error_mark_node.
+
+2001-02-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-02-04 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.
+
+2001-01-25 Jakub Jelinek <jakub@redhat.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.
+
+2001-01-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (tsubst_decl): Remove IN_DECL parameter.
+ (tsubst_arg_types): Check parameter is not void.
+ (tsubst): Adjust tsubst_decl call.
+
+2001-01-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (add_builtin_candidate): Quote std properly, from
+ previous change.
+
+2001-01-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (check_explicit_specialization): Clone constructors and
+ destructors.
+
+2001-01-23 Nathan Sidwell <nathan@codesourcery.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.
+
+2001-01-23 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-01-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-01-19 Jason Merrill <jason@redhat.com>
+
+ * decl2.c (flag_vtable_thunks): Also depend on ENABLE_NEW_GXX_ABI.
+
+ * decl.c (init_decl_processing): Just force -fvtable-thunks on if
+ -fnew-abi.
+
+2001-01-19 Ute Pelkmann <scope.muc@t-online.de>
+
+ * decl2.c (arg_assoc_class): Fix double iteration logic.
+
+2001-01-19 Jason Merrill <jason@redhat.com>
+
+ * init.c (build_delete): Always call convert_force to strip cv-quals.
+
+ * 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.
+
+2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * search.c (get_vbase_1): Count only virtual bases.
+
+2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (duplicate_tag_error): Robustify flag clearing.
+
+2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (copy_default_args_to_explicit_spec): Preserve
+ object's CV quals. Reorganize.
+
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (build_modify_expr): Say `initialization' for
+ INIT_EXPRs.
+ * init.c (build_default_init): Convert to enumeral type, if
+ needed.
+
+2001-01-18 Jakub Jelinek <jakub@redhat.com>
+
+ * parse.y (nomods_initdcl0): Properly set things up for
+ initdcl0_innards.
+
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (UNIFY_ALLOW_OUTER_LEVEL): New unify flag.
+ (type_unification_real): Set it.
+ (unify): Use it.
+
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (finish_destructor_body): Convert to vbase pointer here.
+
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * semantics.c (begin_class_definition): Check we're not inside a
+ template parm list.
+
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tree.c (walk_tree, TREE_LIST): Don't walk the TREE_PURPOSE of
+ BASELINK_P.
+
+2001-01-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * typeck.c (build_function_call_real): Call fold on the CALL_EXPR.
+ * call.c (build_over_call): Add comment.
+
+2001-01-16 Daniel Berlin <dberlin@redhat.com>
+
+ * cvt.c (ocp_convert): Handle vector type conversion
+ * typeck2.c (digest_init): Handle vector type initializations
+
+2001-01-16 Phil Edwards <pme@sources.redhat.com>
+
+ * g++spec.c: Don't add libraries needlessly if -fsyntax-only
+ was given.
+
+2001-01-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (check_nontype_parm): Rename to ...
+ (invalid_nontype_parm_type_p): ... here.
+ (process_template_parm): Adjust.
+ (convert_template_argument): Adjust.
+
+2001-01-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-01-14 Jeffrey Oldham <oldham@codesourcery.com>
+
+ * tree.c: Add defaults.h
+ (cp_valid_lang_attribute): Incorporate SUPPORTS_INIT_PRIORITY.
+ * Make-lang.in (cp/tree.o): Add defaults.h.
+
+2001-01-13 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * Make-lang.in (CXX_C_OBJS): Add c-format.o.
+
+2001-01-13 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * g++.1: Change to be ".so man1/gcc.1".
+
+2001-01-13 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (build_c_cast): Do template processing earlier.
+ Always pedwarn on array casts.
+
+2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * friend.c (make_friend_class): Make sure a templated class is
+ actually a template.
+
+2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl2.c (get_guard): Set linkage from guarded decl.
+
+2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (unify): Check array has a domain, before checking
+ whether it is variable sized.
+
+2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokparms): Unobfuscate and get correct diagnostic for
+ parameters with pointers to arrays of unknown bound.
+
+2001-01-11 Nathan Sidwell <nathan@codesourcery.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.
+
+2001-01-10 Mark Mitchell <mark@codesourcery.com>
+
+ * mangle.c (write_builtin_type): Fix thinko.
+
+ * pt.c (copy_default_args_to_explicit_spec_1): New function.
+ (copy_default_args_to_explicit_spec): Likewise.
+ (check_explicit_specialization): Use it.
+
+ * 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.
+
+2001-01-10 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (DECL_CLONED_FUNCTION_P): Avoid wild reads by not
+ looking at DECL_CLONED_FUNCTION for non-functions.
+
+2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * error.c (dump_template_parameter): Use parm to determine how
+ to print default value.
+
+2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (duplicate_tag_error): Clear more flags.
+
+2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (build_new_method_call): Use binfo_for_vbase.
+
+2001-01-10 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2001-01-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2001-01-09 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl2.c (lang_decode_option): Handle -Wformat=2.
+
+2001-01-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+ * class.c (finish_struct): Constify saved_filename.
+
+2001-01-08 Nathan Sidwell <nathan@codesourcery.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.
+
+2001-01-08 Nathan Sidwell <nathan@codesourcery.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.
+
+2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
+
+ * 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.
+
+2001-01-07 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (grokfield): Don't accept `asm' specifiers for
+ non-static data members.
+
+2001-01-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * expr.c (cplus_expand_expr): Don't reset `target'.
+
+2001-01-07 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp/decl2.c (cxx_post_options): Call cpp_post_options.
+
+2001-01-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (template_datadef): Check for error_mark_node.
+
+2001-01-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.def (DEFAULT_ARG): Make `x' class.
+
+2001-01-04 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2001-01-04 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_conv): Don't use build1 for USER_CONV.
+ * pt.c (tsubst_copy): Or for PREINCREMENT_EXPR and similar nodes.
+
+2001-01-03 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * lex.c (lang_init): Call c_common_lang_init.
+
+2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * search.c (lookup_fnfields_here): Remove.
+ (look_for_overrides_r): Use lookup_fnfields_1.
+ Ignore functions from using declarations.
+
+2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2001-01-03 Jason Merrill <jason@redhat.com>
+
+ * 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_template_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.
+
+2001-01-02 Richard Henderson <rth@redhat.com>
+
+ * parse.y (asm): Set ASM_INPUT_P.
+
+2001-01-02 Jason Merrill <jason@redhat.com>
+
+ * tree.c (cp_valid_lang_attribute): Don't set CLASSTYPE_COM_INTERFACE
+ for v3 ABI.
+
+ * typeck.c (cp_truthvalue_conversion): New fn.
+ * cvt.c (ocp_convert): Use it.
+
+ * cp-tree.h: Lose c-common.c decls.
+
+ * typeck.c (build_unary_op): Restore old &a.f diagnostic code.
+ * cvt.c (convert_to_void): Use type_unknown_p.
+
+ * typeck.c (strip_all_pointer_quals): Also strip quals from
+ pointer-to-member types.
+
+ * Make-lang.in (cp/TAGS): Use --no-globals. Ignore parse.c, and treat
+ parse.y as C.
+
+ * call.c (build_new_method_call): Do evaluate the object parameter
+ when accessing a static member.
+ * typeck.c (build_component_ref): Likewise.
+
+2001-01-02 Andreas Jaeger <aj@suse.de>
+
+ * decl.c (cp_missing_noreturn_ok_p): New.
+ (init_decl_processing): Set lang_missing_noreturn_ok_p.
+
+2000-12-29 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (init_decl_processing): Fix sign of wchar_type_node.
+
+2000-12-29 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-12-28 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-12-29 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * search.c (binfo_for_vtable): Return least derived class, not
+ most. Handle secondary vtables.
+
+2000-12-22 Jason Merrill <jason@redhat.com>
+
+ * pt.c (more_specialized): Don't optimize len==0.
+ (fn_type_unification): If we're adding the return type, increase len.
+
+ * typeck.c (build_binary_op): Fix pmf comparison logic.
+
+ * call.c (joust): Use DECL_NONSTATIC_MEMBER_FUNCTION_P, not
+ DECL_STATIC_FUNCTION_P.
+
+ * semantics.c (genrtl_finish_function): Don't try to jump to
+ return_label unless it exists.
+
+ 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.
+
+2000-12-21 Jason Merrill <jason@redhat.com>
+
+ * pt.c (tsubst_decl): A FUNCTION_DECL has DECL_RESULT, not
+ DECL_TEMPLATE_RESULT.
+
+ * search.c (lookup_field_r): Call lookup_fnfields_1, not
+ lookup_fnfields_here.
+
+ * parse.y (typename_sub2): Return the TYPE_DECL, not the type.
+
+ * 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.
+
+ * error.c (dump_expr): Handle *_CAST_EXPR.
+
+ * typeck2.c (build_scoped_ref): Always convert to the naming class.
+
+ * 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.
+
+2000-12-20 Richard Henderson <rth@redhat.com>
+
+ * 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.
+
+2000-12-18 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * cp-tree.h: Don't declare warn_long_long.
+
+2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * tree.c (no_linkage_helper): Use CLASS_TYPE_P instead of
+ IS_AGGR_TYPE.
+
+2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (unify): Handle when both ARG and PARM are
+ BOUND_TEMPLATE_TEMPLATE_PARM.
+
+2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (reduce_template_parm_level): Set DECL_ARTIFICIAL and
+ DECL_TEMPLATE_PARM_P.
+
+2000-12-15 Jason Merrill <jason@redhat.com>
+
+ * init.c (build_new_1): Reorganize. Now with 100% fewer SAVE_EXPRs!
+
+ * init.c (build_new_1): Don't strip quals from type.
+
+ * decl.c (pushdecl): Don't check for linkage on a non-decl.
+
+ * call.c (build_op_delete_call): See through ARRAY_TYPEs.
+
+ * call.c (build_new_function_call): Lose space before paren in
+ error message.
+ (build_new_method_call): Likewise.
+
+ * typeck2.c (build_m_component_ref): Propagate quals from datum.
+
+2000-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (check_explicit_specialization): Propagate default
+ function arguments to explicit specializations.
+
+2000-12-13 DJ Delorie <dj@redhat.com>
+
+ * typeck.c (build_binary_op): Do signed/unsigned warnings for >?
+ and <? operators.
+
+2000-12-08 Jason Merrill <jason@redhat.com>
+
+ * error.c (dump_function_name): Don't let the user see __comp_ctor.
+
+ 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.
+
+ * pt.c (tsubst_decl): Call clone_function_decl here if this is an
+ instantiation of a member template.
+ (do_decl_instantiation): Not here.
+
+2000-12-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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 (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.
+
+2000-12-07 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-12-07 Jakub Jelinek <jakub@redhat.com>
+
+ * optimize.c (copy_body_r): Set STMT_IS_FULL_EXPR_P on EXPR_STMT.
+
+2000-12-07 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl2.c (lang_decode_option): Handle -Wformat-security.
+
+2000-12-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * 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.
+
+2000-12-06 Alexandre Oliva <aoliva@redhat.com>
+
+ * 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.
+
+2000-12-05 Will Cohen <wcohen@redhat.com>
+
+ * decl.c (finish_case_label): Cleared
+ more_cleanups_ok in surrounding function scopes.
+ (define_label): Likewise.
+
+2000-12-05 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-12-05 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-12-04 Richard Henderson <rth@redhat.com>
+
+ * error.c (dump_tree): Use output_add_string not OB_PUTS.
+
+2000-12-04 Jason Merrill <jason@redhat.com>
+
+ * 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.
+
+ * Make-lang.in: Tweak top comment for emacs.
+ (cp/TAGS): Restore.
+
+ * except.c (expand_throw): Use push_throw_library_fn for _Jv_Throw.
+
+ * class.c (clone_function_decl): Robustify.
+
+2000-12-04 Michael Matz <matzmich@cs.tu-berlin.de>
+
+ * decl.c (store_bindings): Only search in the non modified
+ old_bindings for duplicates.
+
+2000-12-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ * error.c (dump_function_decl): Use DECL_VIRTUAL_P, not
+ TYPE_POLYMORPHIC_P.
+
+ * typeck.c (build_static_cast): Remove unused variable.
+
+2000-12-01 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c: Fix typo in comment.
+
+2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl2.c (warn_format): Remove definition.
+ (lang_decode_option): Handle -Wformat-nonliteral,
+ -Wno-format-extra-args and -Wno-format-y2k. Use set_Wformat.
+
+2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2000-12-01 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-11-30 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-11-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ * method.c (do_build_assign_ref): Construct appropriately
+ CV-qualified base reference. Don't allow const casts in base
+ conversion.
+
+2000-11-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (build_over_call): Use VOID_TYPE_P. Don't die on
+ incomplete return type.
+
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (base_class.1): Produce a _TYPE not a _DECL.
+ * semantics.c (finish_base_specifier): Accept a _TYPE not a
+ _DECL.
+
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * spew.c (yyerror): Cope if yylval.ttype is NULL.
+
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Diagnose undefined template contexts.
+
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Do type access control on friend
+ class.
+
+2000-11-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-11-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-11-26 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-11-25 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * method.c (build_mangled_C9x_name): Rename to
+ build_mangled_C99_name. Change C9X references in comments to
+ refer to C99.
+
+2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (unary_expr): Move VA_ARG from here ...
+ (primary): ... to here.
+
+2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * semantics.c (finish_id_expr): If type is error_mark, return
+ error_mark.
+
+2000-11-23 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (lookup_template_class): Simplify loop exit constructs.
+ Cope when there is no partial instantiation of a template
+ template member.
+
+2000-11-23 J"orn Rennecke <amylaar@redhat.com>
+
+ * Make-lang.in (g++spec.o, cxxmain.o): Depend on $(CONFIG_H).
+
+2000-11-22 Mark Mitchell <mark@codesourcery.com>
+
+ * mangle.c (mangle_conv_op_name_for_type): Don't use `__op'
+ prefix.
+
+ * pt.c (do_decl_instantiate): Explicitly clone constructors and
+ destructors that haven't already been cloned.
+
+2000-11-20 Richard Henderson <rth@redhat.com>
+
+ * parse.y (yyparse_1): Rename the parser entry point.
+
+2000-11-20 Alex Samuel <samuel@codesourcery.com>
+
+ * mangle.c (write_name): Use <unscoped-name> for names directly in
+ function scope.
+ (write_unscoped_name): Accept names directly in function scope.
+
+2000-11-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ * lex.c (rid_to_yy, RID_EXPORT): Make unique keyword.
+ * parse.y (extdef): Add EXPORT reduction.
+ * spew.c (yylex): Don't skip export here.
+
+2000-11-19 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-11-18 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+ * decl.c (grokparms): Don't create parameters of `void' type.
+
+2000-11-17 Zack Weinberg <zack@wolery.stanford.edu>
+
+ * 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.
+
+2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (tsubst_expr, DECL_STMT): Instantiate decl's type.
+
+2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck2.c (incomplete_type_error): Reorganize to avoid
+ excessive diagnostics.
+
+2000-11-16 Zack Weinberg <zack@wolery.stanford.edu>
+
+ * lex.c (struct impl_files, internal_filename): Constify a char *.
+
+2000-11-16 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-11-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (op_error): Make error messages clearer.
+
+2000-11-15 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (wrapup_globals_for_namespace): Don't mark things
+ TREE_ASM_WRITTEN when they're not.
+
+2000-11-15 Jason Merrill <jason@redhat.com>
+
+ * typeck2.c (friendly_abort): Uncount the error before handing
+ off to fancy_abort.
+
+2000-11-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (lookup_anon_field): Cope with qv qualifiers.
+
+2000-11-14 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_vtbl_initializer): Fix typo in comment.
+ * typeck.c (expr_sizeof): Don't crash on errors.
+
+2000-11-14 Jim Wilson <wilson@redhat.com>
+
+ * lang-specs.h: Add %2 after %(cc1_options).
+
+2000-11-14 Richard Henderson <rth@redhat.com>
+
+ * typeck.c (c_sizeof): Be strict about casting result value
+ back to c_size_type_node.
+ (expr_sizeof, c_sizeof_nowarn, c_alignof): Likewise.
+
+2000-11-13 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * typeck.c (build_unary_op): Use boolean_increment from
+ c-common.c, moving the relevant code there.
+
+2000-11-11 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (mark_addressable): Don't call put_var_into_stack.
+
+ * decl.c (maybe_commonize_var): Set DECL_UNINLINABLE for statics
+ in inlines.
+
+2000-11-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c (grokdeclarator, save_function_data): Use memcpy, not bcopy.
+ * lex.c (copy_lang_decl): Likewise.
+
+2000-11-09 Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (cp_dump_tree): Don't dump function bodies here.
+
+ * 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.
+
+2000-11-07 Eric Christopher <echristo@redhat.com>
+
+ * 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.
+
+2000-11-09 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-11-08 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-11-07 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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 ().
+
+2000-11-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (build_ptrmemfunc_type): Allow error_mark_node.
+
+2000-11-05 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * Make-lang.in (c++.distdir): Remove.
+
+2000-11-04 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (do_nonmember_using_decl): Allow `extern "C"'
+ declarations from different namespaces to be combined.
+
+2000-11-03 Zack Weinberg <zack@wolery.stanford.edu>
+
+ * decl.c: Include tm_p.h.
+
+2000-11-03 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * tree.c (cp_tree_equal): Use memcmp () instead of bcmp ().
+
+2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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 ().
+
+2000-11-01 Bernd Schmidt <bernds@redhat.co.uk>
+
+ * call.c (build_over_call): Call fold on the CALL_EXPR.
+
+2000-11-01 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c (dump_template_decl): Separate template hearders with
+ space not comma.
+
+2000-10-31 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * 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.
+
+ * 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.
+
+ * class.c (dump_class_hierarchy_r): Use TFF_PLAIN_IDENTIFIER
+ instead of TS_PLAIN.
+
+ * pt.c (mangle_class_name_for_template): Use TFF_CHASE_TYPEDEF
+ instead of TF_CHASE_TYPEDEFS. Use TFF_PLAIN_IDENTIFIER instead of
+ plain `0'.
+
+2000-10-30 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-10-28 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (instantiate_decl): Always instantiate static data members
+ initialized in-class.
+
+2000-10-27 Zack Weinberg <zack@wolery.stanford.edu>
+
+ * 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.
+
+ * Makefile.in: Delete.
+ * config-lang.in: Delete outputs= line.
+
+2000-10-26 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * 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.
+
+2000-10-23 Jason Merrill <jason@redhat.com>
+
+ * call.c (equal_functions): Also call decls_match for extern "C" fns.
+
+2000-10-22 Jason Merrill <jason@redhat.com>
+
+ * call.c (build_conditional_expr): Use ocp_convert to force
+ rvalue conversion.
+
+2000-10-22 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (standard_conversion): Use RVALUE_CONVs for all
+ expressions that satisfy lvalue_p, not just those that satisfy
+ real_lvalue_p.
+
+ * optimize.c (copy_body_r): Don't treat CALL_EXPRs specially.
+
+ * 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.
+
+2000-10-21 Geoffrey Keating <geoffk@cygnus.com>
+
+ * 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.
+
+ * decl.c (init_decl_processing): Call MD_INIT_BUILTINS.
+
+2000-10-21 Jason Merrill <jason@redhat.com>
+
+ * 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.
+
+2000-10-20 Jason Merrill <jason@redhat.com>
+
+ * tree.c (walk_tree): Don't walk into default args.
+
+ * error.c (dump_expr): Use host_integerp.
+
+2000-10-20 David Edelsohn <edelsohn@gnu.org>
+
+ * typeck2.c (abstract_virtuals_error): Use "because" instead of
+ "since" in error message.
+
+2000-10-20 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * typeck.c (dubious_conversion_warning): Suppress if TYPE_IS_SIZETYPE.
+
+2000-10-20 Jeffrey Oldham <oldham@codesourcery.com>
+
+ * decl.c (revert_static_member_fn): Fixed typo.
+
+2000-10-19 Mark Mitchell <mark@codesourcery.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.
+
+ * cp-tree.h (DECL_ANTICIPATED): Don't require a FUNCTION_DECL.
+ * decl.c (select_decl): Don't return declarations that are
+ DECL_ANTICIPATED.
+
+2000-10-18 Mark Mitchell <mark@codesourcery.com>
+
+ * 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>
+
+ * cp-tree.h (back_end_hook): Remove declaration.
+ * decl2.c (back_end_hook): Remove definition.
+
+ * dump.c (dequeue_and_dump): Dump TREE_USED.
+
+2000-10-17 Brad Lucier <lucier@math.purdue.edu>
+
+ * spew.c (snarf_defarg): Cast 2nd arg to obstack_blank to (int).
+
+2000-10-17 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * 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.
+
+2000-10-17 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl2.c (warn_missing_format_attribute): New variable.
+ (lang_decode_option): Decode -Wmissing-format-attribute.
+
+2000-10-16 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck.c (qualify_type): Remove.
+ (composite_pointer_type): Fix handling of conversions to `cv void*'.
+
+2000-10-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (parse.c, parse.h): Fix think-o in last patch.
+
+2000-10-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (parse.c, parse.h): Create atomically.
+
+2000-10-12 Mark Mitchell <mark@codesourcery.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.
+
+2000-10-09 Richard Henderson <rth@cygnus.com>
+
+ * 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.
+
+ * 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.
+
+2000-10-08 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl.c (INTMAX_TYPE, UINTMAX_TYPE): Define if not already
+ defined.
+ (init_decl_processing): Initialize intmax_type_node and
+ uintmax_type_node.
+
+2000-10-06 Richard Henderson <rth@cygnus.com>
+
+ * 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.
+
+2000-10-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (lookup_template_class): Set current access for enum.
+ (tsubst_enum): Set file & line for enum decl.
+
+ * spew.c (yylex): Remove unused variable.
+
+2000-10-05 Richard Henderson <rth@cygnus.com>
+
+ * semantics.c (genrtl_finish_function): Don't init or check
+ can_reach_end; remove noreturn and return value checks.
+
+2000-10-05 Tom Tromey <tromey@cygnus.com>
+
+ * init.c (build_java_class_ref): Use `build_static_name' with a
+ suffix, not a prefix, to build the class object's name.
+
+2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (tsubst_expr, DECL_STMT case): Don't process if
+ tsubsting fails.
+
+2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-09-24 Mark Mitchell <mark@codesourcery.com>
+
+ * ir.texi: Move to ../c-tree.texi.
+
+2000-09-20 Jason Merrill <jason@redhat.com>
+
+ * decl2.c (get_guard): Check DECL_FUNCTION_SCOPE_P.
+
+2000-09-21 Andreas Jaeger <aj@suse.de>
+
+ * errfn.c: Move declaration of cp_printer and cp_printers to ...
+ * cp-tree.h: ... here.
+
+ * error.c: Remove declaration of cp_printer.
+
+2000-09-20 Mark Mitchell <mark@codesourcery.com>
+
+ * tree.c (mark_local_for_remap_r): Handle CASE_LABELs.
+
+2000-09-20 Hans-Peter Nilsson <hp@axis.com>
+
+ * except.c: Delete #if 0:d EXCEPTION_SECTION_ASM_OP-default and
+ users.
+
+2000-09-18 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (start_function): Robustify.
+
+2000-09-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (check_function_format): Accept a `status' parameter.
+
+ * call.c, typeck.c: Updates calls to `check_function_format'.
+
+2000-09-17 Geoffrey Keating <geoffk@cygnus.com>
+
+ * decl2.c (handle_class_head): Always push some scope even
+ in the error case.
+
+2000-09-16 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-09-14 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * lex.c (reswords): Add _Complex.
+
+2000-09-14 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * Make-lang.in (cplib2.txt): Depend on cp/Makefile.
+
+2000-09-13 J. David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * init.c (begin_init_stmts): Don't use // comments.
+
+2000-09-12 Jason Merrill <jason@redhat.com>
+
+ * decl.c (maybe_deduce_size_from_array_init): Set do_default for
+ all non-extern arrays.
+
+ * 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.
+
+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.
+
+2000-09-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * error.c (cp_tree_printer, case 'P'): Append break.
+
+2000-09-11 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-09-10 Zack Weinberg <zack@wolery.cumb.org>
+
+ * decl.c, rtti.c: Include defaults.h if not already included.
+ Don't define the *_TYPE_SIZE macros.
+
+2000-09-09 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+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.
+
+2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (type_unification_real): Replace switch with if.
+ (unify): Tsubst non-type parms before comparing.
+
+2000-09-06 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * init.c (build_offset_ref): Deal with namespace scoped
+ TEMPLATE_ID_EXPRs.
+
+2000-09-06 Nathan Sidwell <nathan@codesourcery.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.
+
+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.
+ (grok_op_properties): Likewise.
+ (xref_tag): Likewise.
+ (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.
+
+2000-09-04 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * decl.c (finish_function): Move the code for handling functions
+ marked with the constructor and destructor attributes inside the
+ expand_p block.
+
+2000-09-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ * init.c (resolve_offset_ref): Deal with TEMPLATE_ID_EXPR.
+
+2000-09-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (lookup_template_class): Remove abort.
+ * tree.c (get_type_decl): Allow error_mark_node.
+
+2000-09-04 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl2.c (arg_assoc): Deal with COMPONENT_REFs inside
+ TEMPLATE_ID_EXPRs.
+
+2000-09-03 Mark Mitchell <mark@codesourcery.com>
+
+ * operators.def (ALIGNOF_EXPR, MAX_EXPR, MIN_EXPR): Change
+ new ABI mangling.
+
+2000-09-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (named_class_head): Check for TYPENAME_TYPE. Simplify
+ union tag mismatch error reporting.
+
+2000-09-01 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (build_scoped_method_call): Check it is not a namespace.
+
+2000-08-30 Jason Merrill <jason@redhat.com>
+
+ * cp-tree.h (LOCAL_CLASS_P): Use decl_function_context.
+
+ * 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.
+
+ * decl.c (start_function): Always call make_function_rtl.
+
+2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
+
+ * semantics.c (prune_unused_decls): New function.
+ (finish_stmt_tree): Call it via walk_tree.
+
+2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
+
+ * 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.
+
+2000-08-29 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck.c (mark_addressable): Remove code that pokes around in
+ RTL.
+
+2000-08-28 Jason Merrill <jason@redhat.com>
+
+ * lex.c (file_name_nondirectory): Move to toplev.c.
+
+ * cp-tree.h (LOCAL_CLASS_P): New macro.
+ * class.c (finish_struct_1): Use it.
+
+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.
+
+2000-08-26 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * ir.texi (Expressions): Fix typo.
+
+2000-08-25 Greg McGary <greg@mcgary.org>
+
+ * tree.c (init_tree): Use ARRAY_SIZE.
+
+2000-08-25 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c (cp_tree_printer): Rework.
+
+2000-08-25 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+ * decl.c (grokfndecl): Require that `main' return an `int'.
+ * mangle.c (write_encoding): Don't mangle return types for
+ conversion functions.
+
+2000-08-25 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * 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.
+
+2000-08-24 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (build_ptrmemfunc): Just reinterpret if there's no
+ adjustment necessary.
+
+2000-08-24 Greg McGary <greg@mcgary.org>
+
+ * cp-tree.h (MAIN_NAME_P): Remove macro.
+
+2000-08-24 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c (print_instantiation_context): Don't forget to flush the
+ buffer.
+
+2000-08-23 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (build_ptrmemfunc): Save the input pmf.
+
+ * method.c (process_modifiers): Use same_type_p.
+
+2000-08-23 Mark Mitchell <mark@codesourcery.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.
+
+2000-08-23 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c (cp_print_error_function): Don't use embedded '\n' in
+ output_printf.
+
+2000-08-23 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * decl.c (init_decl_processing): Remove bogus initialization.
+ * error.c (lang_print_error_function): Restore here.
+ (init_error): Initialize print_error_function.
+
+2000-08-22 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+ * decl2.c (arg_assoc): Revert my 2000-08-11 change.
+
+2000-08-22 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * Makefile.in (error.o): Depends on diagnostic.h
+
+ * cp-tree.h (problematic_instantiation_changed,
+ record_last_problematic_instantiation, current_instantiation,
+ print_instantiation_context): Declare.
+ (maybe_print_template_context): Remove.
+
+ * decl.c (init_decl_processing): Set print_error_function to NULL.
+ (lang_print_error_function): Remove, since we're using a new
+ machinery.
+
+ * 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.
+
+ * 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.
+
+2000-08-21 Nix <nix@esperi.demon.co.uk>
+
+ * lang-specs.h: Do not process -o or run the assembler if
+ -fsyntax-only.
+
+2000-08-21 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl.c (flag_hosted, flag_noniso_default_format_attributes): New
+ variables.
+ * decl2.c (lang_decode_option): Disable gettext attributes for
+ -ansi.
+
+2000-08-21 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * lex.c (lang_init_options): Default diagnostic message maximum
+ length to 80, when line-wrapping.
+
+2000-08-20 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-08-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-08-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+ * error.c (dump_type, case TYPENAME_TYPE): Don't emit the
+ aggregate tag on the typename's context.
+
+ * pt.c (tsubst_friend_class): Return error_mark_node, if
+ parms becomes NULL.
+ (instantiate_class_template): Ignore error_mark_node friend types.
+
+2000-08-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cvt.c (warn_ref_binding): New static function, broken out of ...
+ (convert_to_reference): ... here. Use it.
+
+2000-08-11 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+
+ * parse.y (template_arg): Add rule for template qualified with
+ global scope.
+
+2000-08-11 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+ * decl2.c (add_function): Reorganize.
+ (arg_assoc): Do not consider function template decls.
+
+2000-08-11 Jason Merrill <jason@redhat.com>
+
+ * decl.c (lookup_name_real): Don't forget the TYPENAME_TYPE we're
+ looking inside.
+
+2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (resolve_scope_to_name): Remove unused prototype.
+ (lookup_nested_tag): Likewise.
+
+ * decl2.c (grokfield): Fix comment to reflect many types of _DECLs
+ can be produced.
+
+2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (named_complex_class_head_sans_basetype): Remove
+ always true if.
+
+2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl2.c (build_expr_from_tree, case METHOD_CALL_EXPR): Build
+ explicit TEMPLATE_ID_EXPR args.
+ (build_expr_from_tree, case CALL_EXPR): Likewise.
+
+2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (check_tag_decl): Diagnose typename's which don't
+ declare anything.
+
+2000-08-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * init.c (build_aggr_init): Reject bogus array initializers
+ early.
+
+2000-08-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-08-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cvt.c (convert_to_pointer_force): Fix error message when
+ attempting to cast from ambiguous base.
+
+2000-08-08 Jason Merrill <jason@redhat.com>
+
+ * pt.c (tsubst_aggr_type): Bail if creating the argvec fails.
+ (tsubst_template_arg_vector): Likewise.
+
+ * decl2.c (build_anon_union_vars): Choose the largest field; don't
+ assume that one will be as large as the union.
+
+2000-08-07 Kazu Hirata <kazu@hxi.com>
+
+ * cp-tree.h (CLASSTYPE_HAS_PRIMARY_BASE_P): Fix a comment typo.
+ * decl.c (pop_labels): Likewise.
+
+2000-08-04 Jeffrey Oldham <oldham@codesourcery.com>
+
+ * 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.
+
+2000-08-04 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl.c (flag_isoc94): New variable.
+
+2000-08-02 Jason Merrill <jason@redhat.com>
+
+ * pt.c (do_type_instantiation): Add complain parm; don't complain
+ if called recursively.
+ * cp-tree.h, parse.y: Adjust.
+
+2000-08-02 Zack Weinberg <zack@wolery.cumb.org>
+
+ * decl2.c: Silently ignore -Wstrict-prototypes; warn about
+ -Wno-strict-prototypes.
+
+ * g++spec.c: Adjust type of second argument to
+ lang_specific_driver, and update code as necessary.
+
+ * cp-tree.h: Don't prototype min_precision here.
+ (my_friendly_assert): Cast expression to void.
+ * semantics.c (do_poplevel): Initialize scope_stmts.
+
+2000-08-02 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (DECL_NEEDED_P): Tweak.
+
+2000-07-28 Jason Merrill <jason@redhat.com>
+
+ * lang-specs.h: Use %i in rule for .ii files.
+
+2000-07-31 Zack Weinberg <zack@wolery.cumb.org>
+
+ * lang-specs.h: Rename cpp to cpp0 and/or tradcpp to tradcpp0.
+
+2000-07-30 Mark Mitchell <mark@codesourcery.com>
+
+ 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.
+ (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.
+
+2000-07-27 Jason Merrill <jason@redhat.com>
+
+ * decl.c (duplicate_decls): If common_type produces a non-typedef
+ type for a typedef, just use the old type.
+
+2000-07-27 Mark Mitchell <mark@codesourcery.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.
+
+2000-07-27 Jason Merrill <jason@redhat.com>
+
+ * 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.
+
+2000-07-26 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-07-26 Marc Espie <espie@cvs.openbsd.org>
+
+ * parse.y: Add missing ';'.
+
+2000-07-26 Mark Mitchell <mark@codesourcery.com>
+
+ * parse.y (empty_parms): Use `()', not `(...)', when in the scope
+ of `extern "C++"'.
+
+2000-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ 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.
+
+2000-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (poplevel): Deal with anonymous variables at for scope.
+ (maybe_inject_for_scope_var): Likewise.
+
+2000-07-25 Zack Weinberg <zack@wolery.cumb.org>
+
+ * decl.c: Remove all signal handling code, now done in toplev.c.
+
+2000-07-23 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (make_rtl_for_nonlocal_decl): Rework.
+
+ * pt.c (lookup_template_class): Ensure that TYPE_CONTEXT is set
+ correctly.
+
+2000-07-20 Zack Weinberg <zack@wolery.cumb.org>
+
+ * 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.
+
+2000-07-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (comp_target_parms): Remove obsolete parameter.
+ (comp_target_types): Adjust.
+
+2000-07-17 Jason Merrill <jason@redhat.com>
+
+ * 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.
+
+ * typeck.c (build_binary_op): Fix grammar in warning.
+
+ * exception.cc (__eh_free): Fix prototype.
+
+ * decl2.c (finish_decl_parsing): Handle TEMPLATE_ID_EXPR.
+
+ * decl.c (pushdecl): Handle seeing an OVERLOAD in
+ IDENTIFIER_NAMESPACE_VALUE.
+
+2000-07-16 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (THUNK_VCALL_OFFSET): Update documentation.
+ * method.c (use_thunk): Correct handling of vcall offsets.
+
+2000-07-14 Zack Weinberg <zack@wolery.cumb.org>
+
+ * .cvsignore: parse.h and parse.c have no cp- prefix.
+
+2000-07-13 Mark Mitchell <mark@codesourcery.com>
+
+ * .cvsignore: New file.
+
+2000-07-13 Zack Weinberg <zack@wolery.cumb.org>
+
+ * lang-specs.h: Use the new named specs. Remove unnecessary braces.
+
+2000-07-12 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in ($(PARSE_H)): Depend directly on parse.y.
+ * parse.c: Remove.
+ * parse.h: Likewise.
+
+2000-07-11 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_class_type): Add pointers to virtual bases after
+ base classes under the old ABI.
+
+2000-07-10 Benjamin Chelf <chelf@codesourcery.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.
+
+2000-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ * semantics.c (expand_body): Sync interface information
+ at the end of function body expansion.
+
+2000-07-09 Jason Merrill <jason@redhat.com>
+
+ * init.c (build_new_1): Bail early if the call to new fails.
+
+ * decl.c (compute_array_index_type): Check specifically for
+ an INTEGER_CST, not just TREE_CONSTANT.
+
+ * 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.
+
+ * error.c (dump_template_bindings): Don't crash if we had an
+ invalid argument list.
+
+ * typeck.c (c_expand_start_case): Do narrowing here.
+ * semantics.c (finish_switch_cond): Not here.
+
+2000-07-09 Hidvegi Zoli <hzoli@austin.ibm.com>
+
+ * parse.y (asm_clobbers): Do string concatenation.
+
+2000-07-09 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (pushtag): Don't put local classes in template functions
+ on the local_classes list.
+
+2000-07-04 Scott Snyder <snyder@fnal.gov>
+
+ * decl2.c (get_guard): Add missing return for old ABI local
+ variable case.
+
+2000-07-09 Mark Mitchell <mark@codesourcery.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.
+
+2000-07-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (tsubst): Don't layout type, if it's error_mark.
+
+2000-07-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (instantiate_pending_templates): Reset template level.
+
+2000-07-05 Jason Merrill <jason@redhat.com>
+
+ * call.c (joust): Don't complain about `operator char *()' beating
+ `operator const char *() const'.
+
+2000-07-04 scott snyder <snyder@fnal.gov>
+ Jason Merrill <jason@redhat.com>
+
+ * repo.c (repo_get_id): Handle the case where a class with virtual
+ bases has a null TYPE_BINFO_VTABLE.
+
+2000-07-04 Kevin Buhr <buhr@stat.wisc.edu>
+ Jason Merrill <jason@redhat.com>
+
+ * parse.y (member_init): Just pass in the type.
+ * init.c (expand_member_init): Handle getting a type.
+
+2000-07-04 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+ Jason Merrill <jason@redhat.com>
+
+ * 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.
+
+2000-07-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl2.c (push_decl_namespace): Push the original namespace.
+
+2000-07-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * pt.c (instantiate_class_template): Set CLASSTYPE_VBASECLASSES.
+ * semantics.c (begin_class_definition): Clear it.
+
+2000-07-02 Benjamin Chelf <chelf@codesourcery.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.
+
+ * init.c (begin_init_stmts): Remove call to
+ genrtl_begin_compound_stmt.
+ (finish_init_stmts): Remove call to genrtl_finish_compound_stmt.
+
+ * semantics.c (lang_expand_stmt): Changed call to
+ genrtl_compound_stmt to ignore return value.
+
+2000-07-02 Mark Mitchell <mark@codesourcery.com>
+
+ * mangle.c (canonicalize_for_substitution): Return the canonical
+ variant of a type.
+
+ * decl.c (duplicate_decls): Preserve DECL_ORIGINAL_TYPE for a
+ TYPE_DECL.
+ * typeck.c (commonparms): Remove obstack manipulations.
+
+2000-07-01 Benjamin Chelf <chelf@codesourcery.com>
+
+ * Make-lang.in (cc1plus$(exeext)): Added c-semantics.o.
+
+ * Makefile.in (OBJS): Added ../c-semantics.o.
+ (OBJDEPS): Likewise.
+
+ * 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.
+
+ * 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.
+
+ * 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.
+
+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-29 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (flag_const_strings): Remove.
+ (warn_parentheses): Likewise.
+ (warn_format): Likewise.
+ (common_type): Likewise.
+ (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.
+
+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.
+
+2000-06-25 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-06-25 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+ * search.c (lookup_member): Fix typo in comment.
+
+2000-06-24 Jason Merrill <jason@redhat.com>
+
+ * decl.c (pushdecl): Don't set DECL_CONTEXT from current_namespace.
+ (push_namespace): Set DECL_CONTEXT for a new NAMESPACE_DECL.
+
+2000-06-24 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * parse.y (complex_direct_notype_declarator): Support global_scope.
+ * Makefile.in: Adjust conflict count.
+
+2000-06-23 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * parse.y (template_arg): Convert TEMPLATE_DECL
+ that is a template template parameter to
+ TEMPLATE_TEMPLATE_PARM here.
+
+ * 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 descriptions of thunks.
+
+2000-06-22 Jason Merrill <jason@redhat.com>
+
+ * pt.c (tsubst_decl, case FUNCTION_DECL): Clear DECL_SAVED_TREE.
+ (tsubst_friend_function): Copy it here.
+
+ * decl.c (grok_op_properties): Fix typo.
+
+ * decl2.c (delete_sanity): Clarify warning, avoid failure on
+ deleting void*.
+
+ * pt.c (check_explicit_specialization): Clarify error.
+
+ * 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.
+
+2000-06-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-06-20 Alexandre Petit-Bianco <apbianco@cygnus.com>
+
+ * class.c (push_lang_context): TYPE_NAME gets you to the Java
+ types DECLs.
+ * decl.c (check_goto): Computed gotos assumed OK.
+
+2000-06-20 Jason Merrill <jason@redhat.com>
+
+ * pt.c (tsubst_decl, case TYPE_DECL): Fix test for TYPE_DECLs
+ for which we don't need to look for instantiations.
+
+2000-06-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (program): Always call finish_translation_unit.
+ * parse.c, parse.h: Rebuilt.
+
+2000-06-20 Zack Weinberg <zack@wolery.cumb.org>
+
+ * method.c: Don't include hard-reg-set.h.
+
+2000-06-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ * rtti.c (get_base_offset): Cope when vbase field is in a base.
+
+2000-06-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+ * decl.c (initialize_local_var): Changed call to finish_expr_stmt
+ to call genrtl_expr_stmt when appropriate.
+
+ * 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.
+
+ * parse.y (simple_stmt): Removed first argument from call to
+ finish_for_stmt. Removed first argument from call to
+ finish_switch_stmt.
+
+ * parse.c: Regenerated.
+
+ * pt.c (tsubst_expr): Removed first argument from call to
+ finish_for_stmt. Removed first argument from call to
+ finish_switch_stmt.
+
+2000-06-16 Benjamin Chelf <chelf@codesourcery.com>
+
+ * cp-tree.h (enum cplus_tree_code): Changed __DUMMY to
+ CP_DUMMY_TREE_CODE. Remove #include "c-common.def".
+
+ * 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.
+
+2000-06-16 Mark Mitchell <mark@codesourcery.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.
+
+ * tree.c (count_trees_r): Prototype. Use DATA parameter to store
+ the number of trees.
+ (n_trees): Remove.
+ (count_trees): Don't use it.
+
+2000-06-15 Jason Merrill <jason@redhat.com>
+
+ * tree.c (count_trees): New debugging function.
+
+ * typeck.c (build_x_function_call): Use DECL_FUNCTION_TEMPLATE_P.
+ * init.c (build_member_call): Pull out the name of a DECL.
+
+ * 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.
+
+2000-06-15 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+ * 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.
+
+2000-06-13 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * 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++.
+
+2000-06-12 Mark Mitchell <mark@codesourcery.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.
+
+2000-06-09 Chip Salzenberg <chip@valinux.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-06-09 Chip Salzenberg <chip@valinux.com>
+
+ * mangle.c (find_substition): Don't mangle objects with typename
+ substitutions (e.g. "cin" as "Si").
+
+2000-06-09 Zack Weinberg <zack@wolery.cumb.org>
+
+ * call.c (add_candidate): Use ggc_alloc_cleared.
+ * decl.c (lookup_label): Likewise.
+ * lex.c (retrofit_lang_decl): Likewise.
+
+2000-06-09 Jason Merrill <jason@casey.soma.redhat.com>
+
+ * semantics.c (expand_body): Push to TV_EXPAND.
+ * optimize.c (optimize_function): Push to TV_INTEGRATION.
+ * decl.c (start_function): Always call announce_function.
+
+ * tinfo2.cc: Just declare abort.
+
+2000-06-09 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * lex.c (DEF_OPERATOR): Say `operator@' -not- `operator @'
+ whenever @ is a symbolic name.
+
+2000-06-08 Jakub Jelinek <jakub@redhat.com>
+
+ * method.c (make_thunk): Clear DECL_VTT_PARM in thunk.
+
+2000-06-07 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (pushdecl): Look up functions by DECL_NAME, not
+ DECL_ASSEMBLER_NAME.
+
+2000-06-06 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (c_language): Define.
+
+2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * lex.c (lang_init_options): Tweak.
+
+ * decl2.c: Remove #inclusion of diagnostic.h
+ (lang_decode_option): Move diagnostic formatting options to
+ toplevel.
+
+ * lang-options.h: Remove documentation for diagnostic options.
+
+ * Makefile.in (lex.o): Depends upon diagnostic.h
+
+2000-06-06 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-06-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * exception.cc: (__eh_alloc, __eh_free): Moved to libgcc2.c
+
+2000-06-05 Jason Merrill <jason@casey.soma.redhat.com>
+
+ * search.c (maybe_suppress_debug_info): Don't check
+ CLASSTYPE_INTERFACE_ONLY if CLASSTYPE_INTERFACE_KNOWN isn't set.
+
+ * pt.c (mark_decl_instantiated): Do SET_DECL_EXPLICIT_INSTANTIATION
+ here if extern_p.
+
+ 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.
+
+2000-06-05 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (indirect_primary_base_p): New function.
+ (determine_primary_base): Use it.
+
+2000-06-05 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-06-05 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * decl.c (init_decl_processing): Don't call record_component_aliases.
+ * tree.c (build_cplus_array_type_1): Likewise.
+
+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.
+
+ * dump.c (dequeue_and_dump): Dump information about thunks.
+
+2000-06-01 Richard Henderson <rth@cygnus.com>
+
+ * decl.c (init_decl_processing): Set lang_get_alias_set first thing.
+
+2000-06-01 Richard Henderson <rth@cygnus.com>
+
+ * decl2.c (unsupported_options): Fix typo, make const.
+ (lang_decode_option): Fix bsearch argument order.
+
+2000-06-01 Mark Mitchell <mark@codesourcery.com>
+
+ * init.c (resolve_offset_ref): Remove check for TREE_ADDRESSABLE
+ on FIELD_DECLs.
+
+2000-05-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * 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.
+
+2000-05-31 Mark Mitchell <mark@codesourcery.com>
+
+ 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.
+
+ * decl.c (build_cp_library_fn): Set DECL_CONTEXT.
+
+ * method.c (mangle_expression): Adjust test for legal expression
+ operators.
+
+ * pt.c (instantiate_decl): Save and restore the local
+ specializations list.
+
+2000-05-30 Jason Merrill <jason@decepticon.cygnus.com>
+
+ * decl.c (grok_reference_init): Pass LOOKUP_ONLYCONVERTING.
+
+2000-05-30 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+ * ir.texi: Update thunk documentation.
+
+ * call.c (joust): Fix handling of overloaded builtin operators.
+
+2000-05-30 Zack Weinberg <zack@wolery.cumb.org>
+
+ * 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.
+
+ * tinfo2.cc: Include stdlib.h.
+
+2000-05-29 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CLASSTYPE_ALIGN_UNIT): New macro.
+ * class.c (layout_empty_base): Use CLASSTYPE_ALIGN_UNIT, not
+ CLASSTYPE_ALIGN.
+
+2000-05-28 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * decl2.c (lang_decode_option): Use skip_leading_substring instead
+ of plain strncmp.
+
+2000-05-28 Alexandre Oliva <aoliva@cygnus.com>
+
+ * operators.def (<?): Duplicated, should have been...
+ (>?): this. Fixed.
+
+2000-05-27 Alex Samuel <samuel@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * 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_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.
+
+2000-05-27 Zack Weinberg <zack@wolery.cumb.org>
+
+ * Make-lang.in (cplib2.ready): Eradicate.
+
+2000-05-27 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * 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.
+
+2000-05-26 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_nonempty_base_or_field): Replace
+ `record_layout_info' with `record_layout_info_s'.
+
+2000-05-26 Jason Merrill <jason@casey.soma.redhat.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 (sort_member_init): Fix typo in error message generation
+ code.
+
+2000-05-15 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.
+ * 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.
+
+2000-05-17 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.
+
+2000-05-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tinfo.cc (__dynamic_cast): Use a reinterpret_cast. Fix
+ offsetof expansion.
+
+2000-05-08 Branko Cibej <branko.cibej@hermes.si>
+
+ * inc/cxxabi.h: Fix typos in comment.
+ (__base_class_info::__offset): Use a static_cast.
+
+2000-05-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-05-06 Richard Henderson <rth@cygnus.com>
+
+ * typeck.c (build_c_cast): Don't warn integer->pointer size
+ mismatch for constants.
+
+2000-05-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * rtti.c (ptmd_initializer): Set non-public, if class is
+ incomplete.
+
+ * 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.
+
+2000-05-04 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (update_vtable_entry_for_fn): Prototype.
+
+ * pt.c (tsubst_decl): Initialize variables `argvec', `gen_tmpl'
+ and `tmpl'.
+
+ * search.c (dfs_build_inheritance_graph_order): Prototype.
+
+2000-05-04 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-05-03 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+ (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.
+
+2000-05-01 Jason Merrill <jason@casey.cygnus.com>
+
+ * tree.c (build_target_expr_with_type): If we already have a
+ TARGET_EXPR, just return it.
+
+ * 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.
+
+2000-05-01 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-04-30 Scott Snyder <snyder@fnal.gov>
+
+ * decl.c (finish_destructor_body): Use the base destructor when
+ destroying virtual bases.
+
+2000-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+ * decl2.c (finish_file): Fix typo in comment.
+
+ * method.c (emit_thunk): Don't try to return a `void' value.
+
+ * optimize.c (initialize_inlined_parameters): If the parameter is
+ addressable, we need to make a new VAR_DECL, even if the
+ initializer is constant.
+
+2000-04-28 Cosmin Truta <cosmint@cs.ubbcluj.ro>
+
+ * decl.c (grok_op_properties): Add an extra check of argtypes.
+
+2000-04-27 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (copy_body_r): Use STRIP_TYPE_NOPS when copying
+ variables.
+ (initialize_inlined_parameters): Try to avoid creating new
+ VAR_DECLs.
+
+2000-04-27 Alex Samuel <samuel@codesourcery.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.
+
+2000-04-26 Mark Mitchell <mark@codesourcery.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.
+
+2000-04-26 Jason Merrill <jason@casey.cygnus.com>
+
+ * decl.c (finish_function): Don't play games with DECL_INLINE.
+
+2000-04-25 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+ * ir.texi: Correct typo.
+
+2000-04-25 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (grokdeclarator): Reject VLAs as members.
+
+2000-04-24 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * call.c (standard_conversion): Accept conversion between
+ COMPLEX_TYPEs.
+
+ * cvt.c (ocp_convert): Handle conversion to COMPLEX_TYPE.
+
+2000-04-24 Zack Weinberg <zack@wolery.cumb.org>
+
+ * decl2.c (finish_file): Remove double setup for accounting
+ compile time.
+
+2000-04-24 Robert Lipe <robertlipe@usa.net>
+
+ * cp-tree.h (lang_type): Member `language' now ENUM_BITFIELD.
+
+2000-04-23 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * new.cc (set_new_handler): Needs to be in std::.
+
+2000-04-23 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-04-23 Richard Henderson <rth@cygnus.com>
+
+ * typeck.c (c_expand_asm_operands): Restore the original
+ contents of the output list.
+
+2000-04-22 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * ir.texi: Document complex number representation.
+
+2000-04-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+ * tinfo2.cc: Remove new-abi builtins comment.
+
+2000-04-20 Jason Merrill <jason@casey.cygnus.com>
+
+ * typeck.c (build_x_function_call): Resolve an OFFSET_REF.
+
+ * call.c (joust): Exit early if we get the same function, too.
+
+ * decl2.c (key_method): Return NULL_TREE for template classes.
+ (import_export_class): Don't need to check for template classes.
+
+2000-04-18 Zack Weinberg <zack@wolery.cumb.org>
+
+ * lex.c: Remove references to cccp.c.
+
+2000-04-18 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-04-17 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (grokfield): Issue error on illegal data member
+ declaration.
+
+2000-04-17 Mark P Mitchell <mark@codesourcery.com>
+
+ * method.c (make_thunk): Set DECL_CONTEXT for a THUNK_DECL.
+
+2000-04-16 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_vtable_entry): Don't build thunks for type-info
+ functions.
+
+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.
+
+2000-04-15 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.
+
+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.
+
+ * 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.
+
+ * 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.
+
+ * 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.
+
+2000-04-11 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * tree.h (HAVE_TEMPLATES): Remove definition.
+ * lang-options.h (-fthis-is-variable): Remove documentation.
+
+2000-04-10 Jason Merrill <jason@casey.cygnus.com>
+
+ * class.c (instantiate_type): Handle object-relative template-id.
+
+ * semantics.c (finish_expr_stmt): Call convert_to_void here.
+ * decl.c (cplus_expand_expr_stmt): Not here.
+
+ * rtti.c (build_dynamic_cast_1): Call non_lvalue.
+ Initialize exprtype earlier.
+
+ * parse.y (fn.def1): Check for defining types in return types.
+
+ * decl.c (check_tag_decl): Notice extra fundamental types.
+ Diagnose empty decls in classes, too.
+
+ * decl.c (grokdeclarator): Don't override an anonymous name if no
+ declarator was given.
+
+ * cvt.c (convert_to_void): Call resolve_offset_ref.
+
+ * typeck.c (build_x_function_call): Abort if we get an OFFSET_REF.
+
+ * decl2.c (decl_namespace): Handle getting a type.
+
+ * typeck.c (build_c_cast): Re-enable warning for cast between
+ pointer and integer of different size.
+
+2000-04-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-04-10 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * 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.
+
+2000-04-09 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+ 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.
+
+2000-04-06 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-04-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * rtti.c (dfs_class_hint_mark): New static function.
+ (dfs_class_hint_unmark): New static function.
+ (class_hint_flags): Use them.
+
+2000-04-05 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * decl2.c: Make flag_honor_std dependent on ENABLE_STD_NAMESPACE.
+
+2000-04-05 Mark Mitchell <mark@codesourcery.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.
+
+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.
+
+2000-03-26 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.
+
+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.
+
+2000-03-25 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.
+
+2000-03-20 Jed Wing <jedwin@zloty.ugcs.caltech.edu>
+ Jason Merrill <jason@casey.cygnus.com>
+
+ * method.c (build_overload_int): Use host_integerp.
+
+2000-03-20 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+ * init.c (build_offset_ref): Handle the case of a templated member
+ function.
+
+2000-03-19 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * except.c (expand_exception_blocks): Clear catch_clauses_last.
+
+2000-03-18 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+ * class.c (check_bitfield_decl): Remove restriction on really long
+ bitfields.
+ (layout_class_type): Implement new ABI handling of bitfields
+ longer than their types.
+
+2000-03-18 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * parse.y (extdefs): Call ggc_collect.
+ * parse.c: Regenerated.
+
+2000-03-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-03-17 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * 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.
+
+2000-03-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (require_complete_type): Don't assume size_zero_node.
+ (complete_type_or_else): Likewise.
+
+2000-03-16 Steven Grady <grady@digitaldeck.com>
+ Jason Merrill <jason@casey.cygnus.com>
+
+ * rtti.c (build_dynamic_cast_1): Improve diagnostics.
+
+2000-03-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl2.c (grokfield): Bail out if type is error_mark_node.
+
+2000-03-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tinfo2.cc (__ptr_to_member_data): Rename to ...
+ (__pointer_to_member_data): ... here. Adjust.
+ * rtti.c (create_tinfo_types): Adjust.
+
+2000-03-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-03-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (cp_finish_decl): Remove obsolete comment.
+
+ * typeck.c (build_ptrmemfunc1): Kill uninitialized warning.
+
+2000-03-14 Mark Mitchell <mark@codesourcery.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.
+
+2000-03-14 Jeff Sturm <jsturm@sigma6.com>
+
+ * except.c (expand_throw): Fix typo in _Jv_Sjlj_Throw.
+
+2000-03-13 Jason Merrill <jason@casey.cygnus.com>
+
+ * decl.c (grokfndecl): Set TREE_NOTHROW if TYPE_NOTHROW_P.
+
+ * 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.
+
+2000-03-11 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * lex.c (whitespace_cr): Compress consecutive calls to warning().
+ (do_identifier): Ditto for error().
+
+ * pt.c (convert_nontype_argument): Ditto for cp_error().
+ (convert_template_argument): Ditto for cp_pedwarn().
+
+2000-03-11 Jason Merrill <jason@casey.cygnus.com>
+
+ * exception.cc (__check_null_eh_spec): New fn.
+ * except.c (expand_end_eh_spec): Call it if the spec is throw().
+
+2000-03-10 Jason Merrill <jason@casey.cygnus.com>
+
+ * 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.
+
+ * 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.
+
+2000-03-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (maybe_commonize_var): Skip all artificial decls.
+ * pt.c (tsubst_decl): Don't copy TREE_ASM_WRITTEN.
+
+2000-03-10 Jason Merrill <jason@casey.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.
+
+ 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 (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.
+
+2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * exception.cc (__cp_pop_exception): Cleanup the original object.
+
+2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grok_op_properties): Merge conversion to void warning
+ with other silly op warnings.
+
+2000-03-08 Jason Merrill <jason@casey.cygnus.com>
+
+ * typeck2.c (process_init_constructor): Set TREE_PURPOSE of
+ array CONSTRUCTOR elements. Don't use expr_tree_cons.
+
+2000-03-08 Nathan Sidwell <nathan@codesourcery.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.
+
+2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (convert_for_assignment): Don't look at array
+ initializer.
+ * call.c (convert_like_real): Likewise.
+
+2000-03-07 Jason Merrill <jason@casey.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.
+
+ * search.c (note_debug_info_needed): Walk the bases even if we
+ weren't deferring the type itself.
+
+2000-03-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl2.c (finish_objects): Constify a char*.
+
+ * method.c (emit_thunk): Likewise.
+
+2000-03-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (dubious_conversion_warnings): Look through
+ REFERENCE_TYPE.
+
+2000-03-06 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * 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.
+
+ * lang-specs.h (as): Don't call if -syntax-only.
+
+2000-03-06 Mark Mitchell <mark@codesourcery.com>
+
+ * expr.c (cplus_expand_expr, case STMT_EXPR): Don't set
+ RTL_EXPR_HAS_NO_SCOPE after all.
+
+2000-03-05 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+ * pt.c (instantiate_decl): Clear TI_PENDING_TEMPLATE_FLAG a little
+ later.
+
+ * 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.
+
+ * g++spec.c (lang_specific_driver): Add -fnew-abi at the start of
+ the command-line, not the end.
+
+2000-03-01 Jason Merrill <jason@casey.cygnus.com>
+
+ * pt.c (instantiate_decl): Clear TI_PENDING_TEMPLATE_FLAG.
+
+2000-03-02 Tom Tromey <tromey@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.
+
+2000-03-02 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * typeck.c (comptypes): Treat sizetype like its language equivalent.
+
+2000-03-01 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * typeck.c (maybe_warn_about_returning_address_of_local): Reorganize
+ to merge reference/pointer code and fix incorrect warnings.
+
+2000-02-29 Jason Merrill <jason@casey.cygnus.com>
+
+ * search.c (protected_accessible_p): Use context_for_name_lookup.
+
+ * init.c (construct_virtual_bases): Fix thinko.
+ * typeck.c (expand_ptrmemfunc_cst): Fix thinko.
+
+2000-03-01 Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (current_function_decl): Move to toplev.c.
+
+2000-02-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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.
+
+2000-02-28 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * 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.
+
+2000-02-27 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 nonzero,
+ 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.
+
+2000-02-26 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (simplify_aggr_init_exprs_p): Don't walk into
+ types.
+
+2000-02-25 Alfred Minarik <a8601248@unet.univie.ac.at>
+
+ * rtti.c (get_vmi_pseudo_type_info): Move __vmi_class_type_info
+ pseudo_type_info creation into the std namespace
+
+2000-02-26 Mark Mitchell <mark@codesourcery.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.
+
+2000-02-26 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * lang-options.h (-fmessage-length=): Add missing option.
+
+ * Make-lang.in (CXX_SRCS): Add .h files and sort list.
+
+2000-02-26 Zack Weinberg <zack@wolery.cumb.org>
+
+ * Make-lang.in: Delete refs to LIBGCC2_DEPS.
+
+2000-02-25 Jim Wilson <wilson@cygnus.com>
+
+ * optimize.c (expand_call_inline): Emit the return label before
+ evaluating the return value.
+
+2000-02-24 Mark Mitchell <mark@codesourcery.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.
+
+ * 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.
+
+2000-02-19 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.
+ * cp-tree.h: Adjust.
+
+ * decl.c (redeclaration_error_message): Allow redeclaration of
+ namespace-scope decls.
+
+2000-02-18 Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+ * typeck2.c (my_friendly_abort): Use GCCBUGURL.
+
+2000-02-17 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (add_method): Don't set DECL_VIRTUAL_CONTEXT.
+ * decl2.c (grokclassfn): Likewise.
+
+ * ir.texi: Document DECL_TEMPLATE_INSTANTIATIONS.
+
+ * decl2.c (lang_decode_option): Don't set default message length
+ here.
+ * 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.
+
+2000-02-15 Jason Merrill <jason@casey.cygnus.com>
+
+ * decl.c (xref_tag): Don't SET_IDENTIFIER_NAMESPACE_VALUE.
+
+2000-02-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Make-lang.in (g++spec.o): Depend on $(GCC_H), not gcc.h.
+
+2000-02-15 Jonathan Larmour <jlarmour@redhat.co.uk>
+
+ * lang-specs.h: Add new __GNUC_PATCHLEVEL__ define to default spec.
+
+2000-01-16 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * decl2.c (lang_decode_option): Enable automatic line wrapping.
+
+2000-02-13 Jason Merrill <jason@casey.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.
+
+2000-02-10 Mark Mitchell <mark@codesourcery.com>
+
+ * ir.texi (ADDR_EXPR): Document the fact that an ADDR_EXPR can be
+ used to create an implicit temporary.
+
+ * class.c (dfs_modify_vtables): Tweak calculation of functions to
+ override.
+
+2000-02-08 Nathan Sidwell <nathan@acm.org>
+
+ * 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.
+
+2000-01-31 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.
+
+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.
+
+2000-01-27 Jim Wilson <wilson@cygnus.com>
+
+ * optimize.c (remap_decl): Add walk_tree calls for DECL_SIZE (t)
+ and TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t))).
+
+2000-01-27 Mike Stump <mrs@wrs.com>
+
+ * decl.c (pushdecl): Fix up shadow warnings with respect to implicit
+ for scopes.
+
+2000-01-26 Jason Merrill <jason@casey.cygnus.com>
+
+ * pt.c (unify): Use fold, not maybe_fold_nontype_arg.
+
+2000-01-26 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * optimize.c (calls_setjmp_r): Supply new argument
+ to special_function_p.
+
+2000-01-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * call.c: PROTO -> PARAMS.
+ * class.c: Likewise.
+ * cp-tree.h: Likewise.
+ * 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.
+ * 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.
+
+2000-01-25 Richard Henderson <rth@cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Remove UNNE_EXPR.
+
+2000-01-25 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+2000-01-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c (member_function_or_else): Change third arg from a format
+ specifier to an `enum overload_flags'. Callers changed.
+
+2000-01-25 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * 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.
+
+2000-01-24 Mark Mitchell <mark@codesourcery.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.
+
+2000-01-24 Jason Merrill <jason@casey.cygnus.com>
+
+ * pt.c (maybe_fold_nontype_arg): Do nothing if we're not in a
+ template.
+
+ * decl2.c (mark_used): Do instantiate inlines that have been
+ explicitly instantiated.
+
+2000-01-24 Richard Henderson <rth@cygnus.com>
+
+ * 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.
+
+ * tinfo.cc (__GXX_ABI_VERSION): Test value and existence.
+ * tinfo.h (__GXX_ABI_VERSION): Test value and existence.
+
+2000-01-23 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (__eprintf): Remove declaration.
+ * tree.c (__eprintf): Remove definition.
+
+2000-01-23 Zack Weinberg <zack@rabi.columbia.edu>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CLASSTYPE_MARKED_N, SET_CLASSTYPE_MARKED_N,
+ CLEAR_CLASSTYPE_MARKED_N): Avoid signed vs. unsigned warnings.
+
+2000-01-23 Brad Lucier <lucier@math.purdue.edu>
+
+ * class.c (dump_class_hierarchy): Print HOST_WIDE_INT properly.
+
+2000-01-23 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
+ * typeck.c (convert_arguments): Restore two-message error
+ reporting.
+
+2000-01-20 Nathan Sidwell <sidwell@codesourcery.com>
+
+ 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.
+
+2000-01-19 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * typeck.c (build_unary_op): Use cp_pedwarn, not pedwarn.
+
+ * typeck2.c (incomplete_type_error): Restore previous
+ cp_error and cp_error_at call sequence.
+
+2000-01-20 Brad Lucier <lucier@math.purdue.edu>
+
+ * class.c (dump_class_hierarchy): Make format agree with argument;
+ cast pointer to unsigned long and print with %lx.
+
+2000-01-19 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * decl2.c (lang_decode_option): Set default line-wrap length to 72.
+
+ * 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.
+
+2000-01-19 Mark Mitchell <mark@codesourcery.com>
+
+ * tree.c (bot_manip): Set DECL_CONTEXT for newly created
+ VAR_DECLs.
+
+2000-01-18 Nathan Sidwell <sidwell@codesourcery.com>
+
+ * cp-tree.h (get_tinfo_fn_dynamic): Remove prototype.
+ (build_x_typeid): Likewise.
+ (get_tinfo_fn): Likewise.
+ (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.
+
+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_destructor_body): Likewise.
+ (maybe_build_cleanup_1): Likewise.
+ * decl2.c (reparse_decl_as_expr): Likewise.
+ * init.c (perform_member_init): Likewise.
+ (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.
+
+ * 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.
+
+ * 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.
+
+ * decl2.c (import_export_class): Undo 12/14 change.
+
+ * error.c (dump_decl): operator new, not operatornew.
+
+ * 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.
+
+2000-01-05 Nathan Sidwell <nathan@acm.org>
+
+ * decl2.c (lookup_arg_dependent): Deal with FNS not being a
+ FUNCTION_DECL.
+
+2000-01-05 Nathan Sidwell <nathan@acm.org>
+
+ * typeck.c (build_static_cast): Don't strip target qualifiers
+ when casting from a class.
+
+2000-01-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (warn_hidden): Initialize variable `fndecl'.
+
+2000-01-03 Ulrich Drepper <drepper@cygnus.com>
+
+ * decl.c (flag_isoc9x): New variable to be able to use code in
+ c-common.c. For now always zero.
+
+2000-01-03 Mark Mitchell <mark@codesourcery.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.
+
+2000-01-02 Mark Mitchell <mark@codesourcery.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.
+
+ * 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.
+
+2000-01-01 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * call.c (build_new_method_call): Also check destructors.
+
+See ChangeLog.2 for earlier changes.
diff --git a/contrib/gcc/cp/Make-lang.in b/contrib/gcc/cp/Make-lang.in
index afeb7ab..9f7ebfb 100644
--- a/contrib/gcc/cp/Make-lang.in
+++ b/contrib/gcc/cp/Make-lang.in
@@ -1,21 +1,21 @@
# Top level -*- makefile -*- fragment for GNU C++.
-# Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001
+# Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
-#This file is part of GNU CC.
+#This file is part of GCC.
-#GNU CC is free software; you can redistribute it and/or modify
+#GCC 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,
+#GCC 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
+#along with GCC; see the file COPYING. If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.
@@ -23,10 +23,9 @@
# Each language makefile fragment must provide the following targets:
#
# 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.install-normal, foo.install-common, foo.install-man,
# foo.uninstall,
-# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
+# foo.mostlyclean, foo.clean, foo.distclean,
# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
#
# where `foo' is the name of the language.
@@ -38,14 +37,10 @@
# - define the names for selecting the language in LANGUAGES.
# Actual names to use when installing a native compiler.
-CXX_INSTALL_NAME = `echo c++|sed '$(program_transform_name)'`
-GXX_INSTALL_NAME = `echo g++|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 = `echo c++|sed '$(program_transform_cross_name)'`
-GXX_CROSS_NAME = `echo g++|sed '$(program_transform_cross_name)'`
+CXX_INSTALL_NAME := $(shell echo c++|sed '$(program_transform_name)')
+GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
+CXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo c++|sed '$(program_transform_name)')
+GXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo g++|sed '$(program_transform_name)')
#
# Define the names for selecting c++ in LANGUAGES.
@@ -57,14 +52,12 @@ C++ c++: cc1plus$(exeext)
# Tell GNU make to ignore these if they exist.
.PHONY: C++ c++
-g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) $(GCC_H) $(CONFIG_H)
+g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_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)
-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
g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
@@ -79,17 +72,18 @@ g++-cross$(exeext): g++$(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 \
- c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o
+ c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \
+ c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o
# 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/repo.o cp/dump.o \
- cp/optimize.o cp/mangle.o cp/cp-lang.o
+ cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.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/repo.o cp/dump.o cp/optimize.o \
+ cp/mangle.o cp/cp-lang.o cp/name-lookup.o cp/cxx-pretty-print.o
-# Use loose warnings for this front end.
-cp-warn =
+# Use strict warnings for this front end.
+cp-warn = $(STRICT_WARN) $(WERROR)
cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \
libcpp.a $(LIBDEPS)
@@ -98,25 +92,12 @@ cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \
# Special build rules.
$(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \
+ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
$(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 33 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
-
gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true
-gt-cp-parse.h gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h : s-gtype; @true
-gt-cp-tree.h gt-cp-mangle.h : s-gtype; @true
+gt-cp-pt.h gt-cp-repo.h gt-cp-parser.h gt-cp-method.h : s-gtype; @true
+gt-cp-tree.h gt-cp-mangle.h gt-cp-name-lookup.h: s-gtype; @true
#
# Build hooks:
@@ -125,10 +106,22 @@ c++.all.build: g++$(exeext)
c++.all.cross: g++-cross$(exeext)
c++.start.encap: g++$(exeext)
c++.rest.encap:
+c++.info:
+c++.srcinfo:
+c++.srcextra:
-c++.info:
-c++.dvi:
-c++.generated-manpages:
+c++.tags: force
+ cd $(srcdir)/cp; etags -o TAGS.sub *.c *.h --language=none \
+ --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' cp-tree.def; \
+ etags --include TAGS.sub --include ../TAGS.sub
+
+c++.man: doc/g++.1
+
+c++.srcman: doc/g++.1
+ -cp -p $^ $(srcdir)/doc
+
+check-c++ : check-g++
+lang_checks += check-g++
#
# Install hooks:
@@ -140,14 +133,14 @@ c++.install-normal:
# Install the driver program as $(target)-g++
# and also as either g++ (if native) or $(tooldir)/bin/g++.
c++.install-common: installdirs
+ -rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
+ -$(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
+ -chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
+ -rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
+ -( cd $(DESTDIR)$(bindir) && \
+ $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) )
-if [ -f cc1plus$(exeext) ] ; then \
if [ -f g++-cross$(exeext) ] ; then \
- rm -f $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \
- $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \
- chmod a+x $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \
- rm -f $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $(GXX_CROSS_NAME)$(exeext) $(CXX_CROSS_NAME)$(exeext) ); \
if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
$(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
@@ -156,12 +149,6 @@ c++.install-common: installdirs
$(LN) g++$(exeext) c++$(exeext) ); \
else true; fi; \
else \
- rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
- $(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
- chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
- rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) ); \
rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
@@ -171,43 +158,35 @@ c++.install-common: installdirs
fi ; \
fi
-c++.install-info:
+# We can't use links because not everyone supports them, and we can't use
+# .so because Irix 6.5 doesn't support them. So just copy the manpage.
+doc/g++.1: doc/gcc.1
+ cp doc/gcc.1 doc/g++.1
-c++.install-man: installdirs $(srcdir)/cp/g++.1
- -if [ -f cc1plus$(exeext) ] ; then \
- if [ -f g++-cross$(exeext) ] ; then \
- rm -f $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
- $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
- chmod a-x $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
- else \
- rm -f $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
- $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
- chmod a-x $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
- fi; \
- else true; fi
+c++.install-man: installdirs $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
+
+$(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext): doc/g++.1
+ -rm -f $@
+ -$(INSTALL_DATA) $< $@
+ -chmod a-x $@
c++.uninstall:
-rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
- -rm -rf $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext)
-rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
- -rm -rf $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext)
-rm -rf $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
- -rm -rf $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext)
#
# Clean hooks:
# A lot of the ancillary files are deleted by the main makefile.
# We just have to delete files specific to us.
c++.mostlyclean:
+ -rm -f doc/g++.1
-rm -f cp/*$(objext)
-rm -f cp/*$(coverageexts)
c++.clean:
c++.distclean:
-rm -f cp/config.status cp/Makefile
- -rm -f $(srcdir)/cp/parse.output
-c++.extraclean:
c++.maintainer-clean:
- -rm -f $(srcdir)/cp/parse.c $(srcdir)/cp/parse.h
#
# Stage hooks:
# The main makefile has already created stage?/cp.
@@ -220,74 +199,72 @@ c++.stage3: stage3-start
-mv cp/*$(objext) stage3/cp
c++.stage4: stage4-start
-mv cp/*$(objext) stage4/cp
+c++.stageprofile: stageprofile-start
+ -mv cp/*$(objext) stageprofile/cp
+c++.stagefeedback: stagefeedback-start
+ -mv cp/*$(objext) stagefeedback/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) \
+CXX_TREE_H = $(TREE_H) cp/name-lookup.h cp/cp-tree.h c-common.h \
+ cp/cp-tree.def c-common.def \
+ function.h varray.h $(SYSTEM_H) coretypes.h $(CONFIG_H) $(TARGET_H) \
+ $(GGC_H) \
$(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
-cp/spew.o: cp/spew.c $(CXX_TREE_H) $(srcdir)/cp/parse.h flags.h cp/lex.h \
- toplev.h gt-cp-spew.h
-cp/lex.o: cp/lex.c $(CXX_TREE_H) $(srcdir)/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 $(HASHTAB_H) $(GGC_H) $(RTL_H) \
+CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H)
+
+cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h \
+ c-pragma.h toplev.h output.h input.h cp/operators.def $(TM_P_H)
+cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \
+ $(LANGHOOKS_DEF_H) c-common.h $(CXX_PRETTY_PRINT_H) $(DIAGNOSTIC_H)
+cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \
+ output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \
cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \
- debug.h gt-cp-decl.h gtype-cp.h timevar.h input.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) c-common.h gt-cp-decl2.h \
- timevar.h
-cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \
+ debug.h gt-cp-decl.h gtype-cp.h timevar.h
+cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
+ output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h cgraph.h
+cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) $(TM_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) $(TARGET_H)
-cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \
- $(GGC_H) diagnostic.h gt-cp-call.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) $(TARGET_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) \
+cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
+ diagnostic.h convert.h
+cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(TARGET_H) convert.h
+cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \
+ diagnostic.h intl.h gt-cp-call.h convert.h target.h
+cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
+cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
+ except.h
+cp/method.o: cp/method.c $(CXX_TREE_H) $(TM_H) toplev.h $(RTL_H) $(EXPR_H) \
+ $(TM_P_H) $(TARGET_H) gt-cp-method.h
+cp/cvt.o: cp/cvt.c $(CXX_TREE_H) $(TM_H) cp/decl.h flags.h toplev.h convert.h
+cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) stack.h flags.h toplev.h $(RTL_H)
+cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) \
insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h $(TARGET_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/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H)
+cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h convert.h
+cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) except.h toplev.h \
cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h
-cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
+cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
except.h $(TM_P_H)
-cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h $(srcdir)/cp/parse.h cp/lex.h \
- toplev.h $(GGC_H) $(RTL_H) except.h tree-inline.h gt-cp-pt.h
-cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h \
- $(LANGHOOKS_DEF_H)
-cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h \
+cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/lex.h \
+ toplev.h $(RTL_H) except.h tree-inline.h gt-cp-pt.h
+cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \
+ flags.h real.h $(LANGHOOKS_DEF_H) $(CXX_PRETTY_PRINT_H)
+cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h \
gt-cp-repo.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 \
+cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h \
+ flags.h debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \
+ tree-inline.h cgraph.h
+cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) tree-dump.h
+cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_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 real.h gt-cp-mangle.h $(TM_P_H)
+cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h real.h gt-cp-mangle.h $(TM_P_H)
-cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \
- cp/decl.h $(SYSTEM_H) toplev.h $(GGC_H) gt-cp-parse.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
- $(srcdir)/cp/parse.c $(OUTPUT_OPTION)
-#
-# These exist for maintenance purposes.
+cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h output.h
-# 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;
+cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TM_H) $(CXX_TREE_H) timevar.h gt-cp-name-lookup.h toplev.h \
+ $(DIAGNOSTIC_H) flags.h
-.PHONY: cp/TAGS
+cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \
+ $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H)
diff --git a/contrib/gcc/cp/NEWS b/contrib/gcc/cp/NEWS
index 36720c6..75a5823 100644
--- a/contrib/gcc/cp/NEWS
+++ b/contrib/gcc/cp/NEWS
@@ -1,3 +1,7 @@
+*** Changes in GCC 3.4:
+
+* Changes in GCC 3.4 are described in 'gcc-3.4/changes.html'
+
*** Changes in GCC 3.3:
* The "new X = 3" extension has been removed; you must now use "new X(3)".
diff --git a/contrib/gcc/cp/call.c b/contrib/gcc/cp/call.c
index 1a1a493..b1353f5 100644
--- a/contrib/gcc/cp/call.c
+++ b/contrib/gcc/cp/call.c
@@ -1,23 +1,23 @@
/* Functions related to invoking methods and overloaded functions.
- Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003,
- 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) and
modified by Brendan Kehoe (brendan@cygnus.com).
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -26,6 +26,8 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "output.h"
@@ -33,18 +35,17 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#include "toplev.h"
#include "expr.h"
-#include "ggc.h"
#include "diagnostic.h"
-
-extern int inhibit_warnings;
-
-static tree build_field_call PARAMS ((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));
+#include "intl.h"
+#include "target.h"
+#include "convert.h"
+
+static struct z_candidate * tourney (struct z_candidate *);
+static int equal_functions (tree, tree);
+static int joust (struct z_candidate *, struct z_candidate *, bool);
+static int compare_ics (tree, tree);
+static tree build_over_call (struct z_candidate *, int);
+static tree build_java_interface_fn_ref (tree, tree);
#define convert_like(CONV, EXPR) \
convert_like_real ((CONV), (EXPR), NULL_TREE, 0, 0, \
/*issue_conversion_warnings=*/true)
@@ -52,63 +53,67 @@ static tree build_java_interface_fn_ref PARAMS ((tree, tree));
convert_like_real ((CONV), (EXPR), (FN), (ARGNO), 0, \
/*issue_conversion_warnings=*/true)
static tree convert_like_real (tree, tree, tree, int, int, bool);
-static void op_error PARAMS ((enum tree_code, enum tree_code, tree, tree,
- tree, const char *));
-static tree build_object_call PARAMS ((tree, tree));
-static tree resolve_args PARAMS ((tree));
-static struct z_candidate * build_user_type_conversion_1
- 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 int any_strictly_viable PARAMS ((struct z_candidate *));
-static struct z_candidate * add_template_candidate
- PARAMS ((struct z_candidate **, tree, tree, tree, tree, tree,
- tree, tree, int, unification_kind_t));
-static struct z_candidate * add_template_candidate_real
- PARAMS ((struct z_candidate **, tree, tree, tree, tree, tree,
- tree, tree, int, tree, unification_kind_t));
-static struct z_candidate * add_template_conv_candidate
- PARAMS ((struct z_candidate **, tree, tree, tree, tree, tree, tree));
+static void op_error (enum tree_code, enum tree_code, tree, tree,
+ tree, const char *);
+static tree build_object_call (tree, tree);
+static tree resolve_args (tree);
+static struct z_candidate *build_user_type_conversion_1 (tree, tree, int);
+static void print_z_candidate (const char *, struct z_candidate *);
+static void print_z_candidates (struct z_candidate *);
+static tree build_this (tree);
+static struct z_candidate *splice_viable (struct z_candidate *, bool, bool *);
+static bool any_strictly_viable (struct z_candidate *);
+static struct z_candidate *add_template_candidate
+ (struct z_candidate **, tree, tree, tree, tree, tree,
+ tree, tree, int, unification_kind_t);
+static struct z_candidate *add_template_candidate_real
+ (struct z_candidate **, tree, tree, tree, tree, tree,
+ tree, tree, int, tree, unification_kind_t);
+static struct z_candidate *add_template_conv_candidate
+ (struct z_candidate **, tree, tree, tree, tree, tree, tree);
static void add_builtin_candidates
- PARAMS ((struct z_candidate **, enum tree_code, enum tree_code,
- tree, tree *, int));
+ (struct z_candidate **, enum tree_code, enum tree_code,
+ tree, tree *, int);
static void add_builtin_candidate
- PARAMS ((struct z_candidate **, enum tree_code, enum tree_code,
- tree, tree, tree, tree *, tree *, int));
-static int is_complete PARAMS ((tree));
+ (struct z_candidate **, enum tree_code, enum tree_code,
+ tree, tree, tree, tree *, tree *, int);
+static bool is_complete (tree);
static void build_builtin_candidate
- PARAMS ((struct z_candidate **, tree, tree, tree, tree *, tree *,
- int));
-static struct z_candidate * add_conv_candidate
- PARAMS ((struct z_candidate **, tree, tree, tree, tree, tree));
-static struct z_candidate * add_function_candidate
+ (struct z_candidate **, tree, tree, tree, tree *, tree *,
+ int);
+static struct z_candidate *add_conv_candidate
+ (struct z_candidate **, tree, tree, tree, tree, tree);
+static struct z_candidate *add_function_candidate
(struct z_candidate **, tree, tree, tree, tree, tree, int);
-static tree implicit_conversion PARAMS ((tree, tree, tree, int));
-static tree standard_conversion PARAMS ((tree, tree, tree));
+static tree implicit_conversion (tree, tree, tree, int);
+static tree standard_conversion (tree, tree, tree);
static tree reference_binding (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 tree build_conv (enum tree_code, tree, tree);
+static bool is_subseq (tree, tree);
+static tree maybe_handle_ref_bind (tree *);
+static void maybe_handle_implicit_object (tree *);
static struct z_candidate *add_candidate
- (struct z_candidate **, tree, tree, 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));
-static tree call_builtin_trap PARAMS ((void));
+ (struct z_candidate **, tree, tree, tree, tree, tree, int);
+static tree source_type (tree);
+static void add_warning (struct z_candidate *, struct z_candidate *);
+static bool reference_related_p (tree, tree);
+static bool reference_compatible_p (tree, tree);
+static tree convert_class_to_reference (tree, tree, tree);
+static tree direct_reference_binding (tree, tree);
+static bool promoted_arithmetic_type_p (tree);
+static tree conditional_conversion (tree, tree);
+static char *name_as_c_string (tree, tree, bool *);
+static tree call_builtin_trap (void);
+static tree prep_operand (tree);
+static void add_candidates (tree, tree, tree, bool, tree, tree,
+ int, struct z_candidate **);
static tree merge_conversion_sequences (tree, tree);
+static bool magic_varargs_p (tree);
+static tree build_temp (tree, tree, int, void (**)(const char *, ...));
+static void check_constructor_callable (tree, tree);
tree
-build_vfield_ref (datum, type)
- tree datum, type;
+build_vfield_ref (tree datum, tree type)
{
if (datum == error_mark_node)
return error_mark_node;
@@ -124,55 +129,18 @@ build_vfield_ref (datum, type)
datum, TYPE_VFIELD (type));
}
-/* Build a call to a member of an object. I.e., one that overloads
- operator ()(), or is a pointer-to-function or pointer-to-method. */
-
-static tree
-build_field_call (tree instance_ptr, tree decl, tree parms)
-{
- tree instance;
-
- if (decl == error_mark_node || decl == NULL_TREE)
- return decl;
-
- if (TREE_CODE (decl) == FIELD_DECL || TREE_CODE (decl) == VAR_DECL)
- {
- /* 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);
- instance = build_class_member_access_expr (instance, decl,
- /*access_path=*/NULL_TREE,
- /*preserve_reference=*/false);
-
- if (instance == error_mark_node)
- return error_mark_node;
-
- 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)) == FUNCTION_TYPE
- || (TREE_CODE (TREE_TYPE (instance)) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (TREE_TYPE (instance)))
- == FUNCTION_TYPE)))
- return build_function_call (instance, parms);
- }
-
- return NULL_TREE;
-}
-
/* Returns nonzero iff the destructor name specified in NAME
(a BIT_NOT_EXPR) matches BASETYPE. The operand of NAME can take many
forms... */
-int
-check_dtor_name (basetype, name)
- tree basetype, name;
+bool
+check_dtor_name (tree basetype, tree name)
{
name = TREE_OPERAND (name, 0);
/* Just accept something we've already complained about. */
if (name == error_mark_node)
- return 1;
+ return true;
if (TREE_CODE (name) == TYPE_DECL)
name = TREE_TYPE (name);
@@ -195,129 +163,20 @@ check_dtor_name (basetype, name)
NAME will be a class template. */
else if (DECL_CLASS_TEMPLATE_P (name))
- return 0;
+ return false;
else
abort ();
if (name && TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (name))
- return 1;
- return 0;
-}
-
-/* Build a method call of the form `EXP->SCOPES::NAME (PARMS)'.
- This is how virtual function calls are avoided. */
-
-tree
-build_scoped_method_call (exp, basetype, name, parms)
- tree exp, basetype, name, parms;
-{
- /* Because this syntactic form does not allow
- a pointer to a base class to be `stolen',
- we need not protect the derived->base conversion
- that happens here.
-
- @@ But we do have to check access privileges later. */
- tree binfo, decl;
- tree type = TREE_TYPE (exp);
-
- if (type == error_mark_node
- || basetype == error_mark_node)
- return error_mark_node;
-
- if (processing_template_decl)
- {
- if (TREE_CODE (name) == BIT_NOT_EXPR
- && TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE)
- {
- tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0);
- if (type)
- name = build_min_nt (BIT_NOT_EXPR, type);
- }
- name = build_min_nt (SCOPE_REF, basetype, name);
- return build_min_nt (METHOD_CALL_EXPR, name, exp, parms, NULL_TREE);
- }
-
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- if (TREE_CODE (basetype) == TREE_VEC)
- {
- binfo = basetype;
- basetype = BINFO_TYPE (binfo);
- }
- else
- binfo = NULL_TREE;
-
- /* Check the destructor call syntax. */
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- /* We can get here if someone writes their destructor call like
- `obj.NS::~T()'; this isn't really a scoped method call, so hand
- it off. */
- if (TREE_CODE (basetype) == NAMESPACE_DECL)
- return build_method_call (exp, name, parms, NULL_TREE, LOOKUP_NORMAL);
-
- if (! check_dtor_name (basetype, name))
- 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
- that explicit ~int is caught in the parser; this deals with typedefs
- and template parms. */
- if (! IS_AGGR_TYPE (basetype))
- {
- if (TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (basetype))
- 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))
- {
- error ("base object `%E' of scoped method call is of non-aggregate type `%T'",
- exp, type);
- return error_mark_node;
- }
-
- decl = build_scoped_ref (exp, basetype, &binfo);
-
- if (binfo)
- {
- /* Call to a destructor. */
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- if (! TYPE_HAS_DESTRUCTOR (TREE_TYPE (decl)))
- return cp_convert (void_type_node, exp);
-
- return build_delete (TREE_TYPE (decl), decl,
- sfk_complete_destructor,
- LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR,
- 0);
- }
-
- /* Call to a method. */
- return build_method_call (decl, name, parms, binfo,
- LOOKUP_NORMAL|LOOKUP_NONVIRTUAL);
- }
- return error_mark_node;
+ return true;
+ return false;
}
/* We want the address of a function or method. We avoid creating a
pointer-to-member function. */
tree
-build_addr_func (function)
- tree function;
+build_addr_func (tree function)
{
tree type = TREE_TYPE (function);
@@ -325,24 +184,16 @@ build_addr_func (function)
functions. */
if (TREE_CODE (type) == METHOD_TYPE)
{
- tree addr;
-
- type = build_pointer_type (type);
-
- if (!cxx_mark_addressable (function))
- return error_mark_node;
-
- addr = build1 (ADDR_EXPR, type, function);
-
- /* Address of a static or external variable or function counts
- as a constant */
- if (staticp (function))
- TREE_CONSTANT (addr) = 1;
-
- function = addr;
+ if (TREE_CODE (function) == OFFSET_REF)
+ {
+ tree object = build_address (TREE_OPERAND (function, 0));
+ return get_member_function_from_ptrfunc (&object,
+ TREE_OPERAND (function, 1));
+ }
+ function = build_address (function);
}
else
- function = default_conversion (function);
+ function = decay_conversion (function);
return function;
}
@@ -352,8 +203,7 @@ build_addr_func (function)
(TYPE_PTRMEMFUNC_P) must be handled by our callers. */
tree
-build_call (function, parms)
- tree function, parms;
+build_call (tree function, tree parms)
{
int is_constructor = 0;
int nothrow;
@@ -419,10 +269,8 @@ build_call (function, parms)
TREE_VALUE (tmp), t);
}
- function = build_nt (CALL_EXPR, function, parms, NULL_TREE);
+ function = build (CALL_EXPR, result_type, function, parms);
TREE_HAS_CONSTRUCTOR (function) = is_constructor;
- TREE_TYPE (function) = result_type;
- TREE_SIDE_EFFECTS (function) = 1;
TREE_NOTHROW (function) = nothrow;
return function;
@@ -443,8 +291,7 @@ build_call (function, parms)
BASETYPE_PATH, if non-NULL, contains a chain from the type of INSTANCE
down to the real instance type to use for access checking. We need this
- information to get protected accesses correct. This parameter is used
- by build_member_call.
+ information to get protected accesses correct.
FLAGS is the logical disjunction of zero or more LOOKUP_
flags. See cp-tree.h for more info.
@@ -460,141 +307,20 @@ build_call (function, 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;
- int flags;
-{
- tree fn;
- tree object_type;
- tree template_args = NULL_TREE;
- bool has_template_args = false;
-
-#ifdef GATHER_STATISTICS
- n_build_method_call++;
-#endif
-
- if (instance == error_mark_node
- || name == error_mark_node
- || parms == error_mark_node
- || (instance && TREE_TYPE (instance) == error_mark_node))
- return error_mark_node;
-
- if (processing_template_decl)
- {
- /* We need to process template parm names here so that tsubst catches
- them properly. Other type names can wait. */
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- tree type = NULL_TREE;
-
- if (TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE)
- type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0);
- else if (TREE_CODE (TREE_OPERAND (name, 0)) == TYPE_DECL)
- type = TREE_TYPE (TREE_OPERAND (name, 0));
-
- if (type && TREE_CODE (type) == TEMPLATE_TYPE_PARM)
- name = build_min_nt (BIT_NOT_EXPR, type);
- }
-
- return build_min_nt (METHOD_CALL_EXPR, name, instance, parms, NULL_TREE);
- }
-
- if (TREE_CODE (instance) == OFFSET_REF)
- instance = resolve_offset_ref (instance);
- if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
- instance = convert_from_reference (instance);
- object_type = TREE_TYPE (instance);
-
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- tree instance_ptr;
-
- if (parms)
- error ("destructors take no parameters");
-
- if (! check_dtor_name (object_type, name))
- error
- ("destructor name `~%T' does not match type `%T' of expression",
- TREE_OPERAND (name, 0), object_type);
-
- /* The destructor type must be complete. */
- object_type = complete_type_or_else (object_type, NULL_TREE);
- if (!object_type || object_type == error_mark_node)
- return error_mark_node;
-
- if (! TYPE_HAS_DESTRUCTOR (object_type))
- return cp_convert (void_type_node, instance);
- instance = default_conversion (instance);
- instance_ptr = build_unary_op (ADDR_EXPR, instance, 0);
- return build_delete (build_pointer_type (object_type),
- instance_ptr, sfk_complete_destructor,
- LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0);
- }
-
- if (!CLASS_TYPE_P (object_type))
- {
- if ((flags & LOOKUP_COMPLAIN)
- && TREE_TYPE (instance) != error_mark_node)
- error ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
- name, instance, object_type);
- return error_mark_node;
- }
-
- if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
- {
- template_args = TREE_OPERAND (name, 1);
- has_template_args = true;
- name = TREE_OPERAND (name, 0);
- }
- if (TREE_CODE (name) == OVERLOAD)
- name = DECL_NAME (get_first_fn (name));
- else if (TREE_CODE (name) == LOOKUP_EXPR)
- name = TREE_OPERAND (name, 0);
- else if (DECL_P (name))
- name = DECL_NAME (name);
- if (has_template_args)
- fn = lookup_fnfields (object_type, name, /*protect=*/2);
- else
- fn = lookup_member (object_type, name, /*protect=*/2, /*want_type=*/0);
-
- if (fn && TREE_CODE (fn) == TREE_LIST && !BASELINK_P (fn))
- {
- error ("request for member `%D' is ambiguous", name);
- print_candidates (fn);
- return error_mark_node;
- }
-
- /* If the name could not be found, issue an error. */
- if (!fn)
- {
- unqualified_name_lookup_error (name);
- return error_mark_node;
- }
-
- if (BASELINK_P (fn) && has_template_args)
- BASELINK_FUNCTIONS (fn)
- = build_nt (TEMPLATE_ID_EXPR,
- BASELINK_FUNCTIONS (fn),
- template_args);
- if (BASELINK_P (fn) && basetype_path)
- BASELINK_ACCESS_BINFO (fn) = basetype_path;
-
- return build_new_method_call (instance, fn, parms,
- /*conversion_path=*/NULL_TREE, flags);
-}
-
/* New overloading code. */
struct z_candidate GTY(()) {
/* The FUNCTION_DECL that will be called if this candidate is
selected by overload resolution. */
tree fn;
+ /* The arguments to use when calling this function. */
+ tree args;
+ /* The implicit conversion sequences for each of the arguments to
+ FN. */
tree convs;
+ /* If FN is a user-defined conversion, the standard conversion
+ sequence from the type returned by FN to the desired destination
+ type. */
tree second_conv;
int viable;
/* If FN is a member function, the binfo indicating the path used to
@@ -640,12 +366,15 @@ struct z_candidate GTY(()) {
should be created to hold the result of the conversion. */
#define NEED_TEMPORARY_P(NODE) TREE_LANG_FLAG_4 (NODE)
+/* TRUE in an IDENTITY_CONV or BASE_CONV if the copy constructor must
+ be accessible, even though it is not being used. */
+#define CHECK_COPY_CONSTRUCTOR_P(NODE) TREE_LANG_FLAG_5 (NODE)
+
#define USER_CONV_CAND(NODE) WRAPPER_ZC (TREE_OPERAND (NODE, 1))
#define USER_CONV_FN(NODE) (USER_CONV_CAND (NODE)->fn)
-int
-null_ptr_cst_p (t)
- tree t;
+bool
+null_ptr_cst_p (tree t)
{
/* [conv.ptr]
@@ -653,29 +382,26 @@ null_ptr_cst_p (t)
(_expr.const_) rvalue of integer type that evaluates to zero. */
if (t == null_node
|| (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)) && integer_zerop (t)))
- return 1;
- return 0;
+ return true;
+ return false;
}
/* Returns nonzero if PARMLIST consists of only default parms and/or
ellipsis. */
-int
-sufficient_parms_p (parmlist)
- tree parmlist;
+bool
+sufficient_parms_p (tree parmlist)
{
for (; parmlist && parmlist != void_list_node;
parmlist = TREE_CHAIN (parmlist))
if (!TREE_PURPOSE (parmlist))
- return 0;
- return 1;
+ return false;
+ return true;
}
static tree
-build_conv (code, type, from)
- enum tree_code code;
- tree type, from;
+build_conv (enum tree_code code, tree type, tree from)
{
tree t;
int rank = ICS_STD_RANK (from);
@@ -710,25 +436,12 @@ 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;
-{
- if (TREE_CODE (t) == REFERENCE_TYPE)
- t = TREE_TYPE (t);
- return t;
-}
-
tree
-strip_top_quals (t)
- tree t;
+strip_top_quals (tree t)
{
if (TREE_CODE (t) == ARRAY_TYPE)
return t;
- return TYPE_MAIN_VARIANT (t);
+ return cp_build_qualified_type (t, 0);
}
/* Returns the standard conversion path (see [conv]) from type FROM to type
@@ -736,18 +449,16 @@ strip_top_quals (t)
also pass the expression EXPR to convert from. */
static tree
-standard_conversion (to, from, expr)
- tree to, from, expr;
+standard_conversion (tree to, tree from, tree expr)
{
enum tree_code fcode, tcode;
tree conv;
- int fromref = 0;
+ bool fromref = false;
- if (TREE_CODE (to) == REFERENCE_TYPE)
- to = TREE_TYPE (to);
+ to = non_reference (to);
if (TREE_CODE (from) == REFERENCE_TYPE)
{
- fromref = 1;
+ fromref = true;
from = TREE_TYPE (from);
}
to = strip_top_quals (to);
@@ -782,7 +493,7 @@ standard_conversion (to, from, expr)
else if (fromref || (expr && lvalue_p (expr)))
conv = build_conv (RVALUE_CONV, from, conv);
- /* Allow conversion between `__complex__' data types */
+ /* Allow conversion between `__complex__' data types. */
if (tcode == COMPLEX_TYPE && fcode == COMPLEX_TYPE)
{
/* The standard conversion sequence to convert FROM to TO is
@@ -805,11 +516,15 @@ standard_conversion (to, from, expr)
if (same_type_p (from, to))
return conv;
- if ((tcode == POINTER_TYPE || TYPE_PTRMEMFUNC_P (to))
+ if ((tcode == POINTER_TYPE || TYPE_PTR_TO_MEMBER_P (to))
&& expr && null_ptr_cst_p (expr))
- {
- conv = build_conv (STD_CONV, to, conv);
- }
+ conv = build_conv (STD_CONV, to, conv);
+ else if (tcode == POINTER_TYPE && fcode == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (to)) == VECTOR_TYPE
+ && TREE_CODE (TREE_TYPE (from)) == VECTOR_TYPE
+ && ((*targetm.vector_opaque_p) (TREE_TYPE (to))
+ || (*targetm.vector_opaque_p) (TREE_TYPE (from))))
+ conv = build_conv (STD_CONV, to, conv);
else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE)
|| (tcode == POINTER_TYPE && fcode == INTEGER_TYPE))
{
@@ -818,41 +533,44 @@ standard_conversion (to, from, expr)
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))
+ else if (tcode == ENUMERAL_TYPE && fcode == INTEGER_TYPE)
{
/* 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)
+ else if ((tcode == POINTER_TYPE && fcode == POINTER_TYPE)
+ || (TYPE_PTRMEM_P (to) && TYPE_PTRMEM_P (from)))
{
- enum tree_code ufcode = TREE_CODE (TREE_TYPE (from));
- enum tree_code utcode = TREE_CODE (TREE_TYPE (to));
+ tree to_pointee;
+ tree from_pointee;
- if (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (from),
- TREE_TYPE (to)))
+ if (tcode == POINTER_TYPE
+ && same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (from),
+ TREE_TYPE (to)))
;
- else if (utcode == VOID_TYPE && ufcode != OFFSET_TYPE
- && ufcode != FUNCTION_TYPE)
+ else if (VOID_TYPE_P (TREE_TYPE (to))
+ && !TYPE_PTRMEM_P (from)
+ && TREE_CODE (TREE_TYPE (from)) != FUNCTION_TYPE)
{
from = build_pointer_type
(cp_build_qualified_type (void_type_node,
cp_type_quals (TREE_TYPE (from))));
conv = build_conv (PTR_CONV, from, conv);
}
- else if (ufcode == OFFSET_TYPE && utcode == OFFSET_TYPE)
+ else if (TYPE_PTRMEM_P (from))
{
- tree fbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (from));
- tree tbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (to));
+ tree fbase = TYPE_PTRMEM_CLASS_TYPE (from);
+ tree tbase = TYPE_PTRMEM_CLASS_TYPE (to);
if (DERIVED_FROM_P (fbase, tbase)
&& (same_type_ignoring_top_level_qualifiers_p
- (TREE_TYPE (TREE_TYPE (from)),
- TREE_TYPE (TREE_TYPE (to)))))
+ (TYPE_PTRMEM_POINTED_TO_TYPE (from),
+ TYPE_PTRMEM_POINTED_TO_TYPE (to))))
{
- from = build_ptrmem_type (tbase, TREE_TYPE (TREE_TYPE (from)));
+ from = build_ptrmem_type (tbase,
+ TYPE_PTRMEM_POINTED_TO_TYPE (from));
conv = build_conv (PMEM_CONV, from, conv);
}
}
@@ -878,14 +596,25 @@ standard_conversion (to, from, expr)
conv = build_conv (PTR_CONV, from, conv);
}
+ if (tcode == POINTER_TYPE)
+ {
+ to_pointee = TREE_TYPE (to);
+ from_pointee = TREE_TYPE (from);
+ }
+ else
+ {
+ to_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (to);
+ from_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (from);
+ }
+
if (same_type_p (from, to))
/* OK */;
- else if (comp_ptr_ttypes (TREE_TYPE (to), TREE_TYPE (from)))
+ else if (comp_ptr_ttypes (to_pointee, from_pointee))
conv = build_conv (QUAL_CONV, to, conv);
else if (expr && string_conv_p (to, expr, 0))
/* converting from string constant to char *. */
conv = build_conv (QUAL_CONV, to, conv);
- else if (ptr_reasonably_similar (TREE_TYPE (to), TREE_TYPE (from)))
+ else if (ptr_reasonably_similar (to_pointee, from_pointee))
{
conv = build_conv (PTR_CONV, to, conv);
ICS_BAD_FLAG (conv) = 1;
@@ -910,21 +639,33 @@ standard_conversion (to, from, expr)
return 0;
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_method_type_directly (from,
+ TREE_TYPE (fromfn),
+ TREE_CHAIN (TYPE_ARG_TYPES (fromfn)));
from = build_ptrmemfunc_type (build_pointer_type (from));
conv = build_conv (PMEM_CONV, from, conv);
}
else if (tcode == BOOLEAN_TYPE)
{
- if (! (INTEGRAL_CODE_P (fcode) || fcode == REAL_TYPE
- || fcode == POINTER_TYPE || TYPE_PTRMEMFUNC_P (from)))
- return 0;
+ /* [conv.bool]
- conv = build_conv (STD_CONV, to, conv);
- if (fcode == POINTER_TYPE
- || (TYPE_PTRMEMFUNC_P (from) && ICS_STD_RANK (conv) < PBOOL_RANK))
- ICS_STD_RANK (conv) = PBOOL_RANK;
+ An rvalue of arithmetic, enumeration, pointer, or pointer to
+ member type can be converted to an rvalue of type bool. */
+ if (ARITHMETIC_TYPE_P (from)
+ || fcode == ENUMERAL_TYPE
+ || fcode == POINTER_TYPE
+ || TYPE_PTR_TO_MEMBER_P (from))
+ {
+ conv = build_conv (STD_CONV, to, conv);
+ if (fcode == POINTER_TYPE
+ || TYPE_PTRMEM_P (from)
+ || (TYPE_PTRMEMFUNC_P (from)
+ && ICS_STD_RANK (conv) < PBOOL_RANK))
+ ICS_STD_RANK (conv) = PBOOL_RANK;
+ return conv;
+ }
+
+ return NULL_TREE;
}
/* We don't check for ENUMERAL_TYPE here because there are no standard
conversions to enum type. */
@@ -936,10 +677,14 @@ standard_conversion (to, from, expr)
conv = build_conv (STD_CONV, to, conv);
/* Give this a better rank if it's a promotion. */
- if (to == type_promotes_to (from)
+ if (same_type_p (to, type_promotes_to (from))
&& ICS_STD_RANK (TREE_OPERAND (conv, 0)) <= PROMO_RANK)
ICS_STD_RANK (conv) = PROMO_RANK;
}
+ else if (fcode == VECTOR_TYPE && tcode == VECTOR_TYPE
+ && ((*targetm.vector_opaque_p) (from)
+ || (*targetm.vector_opaque_p) (to)))
+ return build_conv (STD_CONV, to, conv);
else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
&& is_properly_derived_from (from, to))
{
@@ -960,10 +705,8 @@ standard_conversion (to, from, expr)
/* Returns nonzero if T1 is reference-related to T2. */
-static int
-reference_related_p (t1, t2)
- tree t1;
- tree t2;
+static bool
+reference_related_p (tree t1, tree t2)
{
t1 = TYPE_MAIN_VARIANT (t1);
t2 = TYPE_MAIN_VARIANT (t2);
@@ -980,10 +723,8 @@ reference_related_p (t1, t2)
/* Returns nonzero if T1 is reference-compatible with T2. */
-static int
-reference_compatible_p (t1, t2)
- tree t1;
- tree t2;
+static bool
+reference_compatible_p (tree t1, tree t2)
{
/* [dcl.init.ref]
@@ -998,10 +739,7 @@ reference_compatible_p (t1, t2)
converted to T as in [over.match.ref]. */
static tree
-convert_class_to_reference (t, s, expr)
- tree t;
- tree s;
- tree expr;
+convert_class_to_reference (tree t, tree s, tree expr)
{
tree conversions;
tree arglist;
@@ -1009,6 +747,7 @@ convert_class_to_reference (t, s, expr)
tree reference_type;
struct z_candidate *candidates;
struct z_candidate *cand;
+ bool any_viable_p;
conversions = lookup_conversions (s);
if (!conversions)
@@ -1091,29 +830,39 @@ convert_class_to_reference (t, s, expr)
LOOKUP_NORMAL);
if (cand)
- /* Build a standard conversion sequence indicating the
- binding from the reference type returned by the
- function to the desired REFERENCE_TYPE. */
- cand->second_conv
- = (direct_reference_binding
- (reference_type,
- build1 (IDENTITY_CONV,
- TREE_TYPE (TREE_TYPE (TREE_TYPE (cand->fn))),
- NULL_TREE)));
+ {
+ /* Build a standard conversion sequence indicating the
+ binding from the reference type returned by the
+ function to the desired REFERENCE_TYPE. */
+ cand->second_conv
+ = (direct_reference_binding
+ (reference_type,
+ build1 (IDENTITY_CONV,
+ TREE_TYPE (TREE_TYPE (TREE_TYPE (cand->fn))),
+ NULL_TREE)));
+ ICS_BAD_FLAG (cand->second_conv)
+ |= ICS_BAD_FLAG (TREE_VEC_ELT (cand->convs, 0));
+ }
}
conversions = TREE_CHAIN (conversions);
}
+ candidates = splice_viable (candidates, pedantic, &any_viable_p);
/* If none of the conversion functions worked out, let our caller
know. */
- if (!any_viable (candidates))
+ if (!any_viable_p)
return NULL_TREE;
-
- candidates = splice_viable (candidates);
+
cand = tourney (candidates);
if (!cand)
return NULL_TREE;
+ /* Now that we know that this is the function we're going to use fix
+ the dummy first argument. */
+ cand->args = tree_cons (NULL_TREE,
+ build_this (expr),
+ TREE_CHAIN (cand->args));
+
/* Build a user-defined conversion sequence representing the
conversion. */
conv = build_conv (USER_CONV,
@@ -1127,7 +876,7 @@ convert_class_to_reference (t, s, expr)
if (cand->viable == -1)
ICS_BAD_FLAG (conv) = 1;
-
+
return cand->second_conv;
}
@@ -1136,16 +885,14 @@ convert_class_to_reference (t, s, expr)
Return a conversion sequence for this binding. */
static tree
-direct_reference_binding (type, conv)
- tree type;
- tree conv;
+direct_reference_binding (tree type, tree conv)
{
tree t;
my_friendly_assert (TREE_CODE (type) == REFERENCE_TYPE, 20030306);
my_friendly_assert (TREE_CODE (TREE_TYPE (conv)) != REFERENCE_TYPE,
20030306);
-
+
t = TREE_TYPE (type);
/* [over.ics.rank]
@@ -1188,8 +935,8 @@ reference_binding (tree rto, tree rfrom, tree expr, int flags)
tree conv = NULL_TREE;
tree to = TREE_TYPE (rto);
tree from = rfrom;
- int related_p;
- int compatible_p;
+ bool related_p;
+ bool compatible_p;
cp_lvalue_kind lvalue_p = clk_none;
if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr))
@@ -1224,14 +971,14 @@ reference_binding (tree rto, tree rfrom, tree expr, int flags)
-- 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
+ the reference is bound directly to the initializer expression
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))
+ if ((lvalue_p & clk_bitfield) != 0
+ || ((lvalue_p & clk_packed) != 0 && !TYPE_PACKED (to)))
/* For the purposes of overload resolution, we ignore the fact
- this expression is a bitfield. (In particular,
+ this expression is a bitfield or packed field. (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.)
@@ -1242,13 +989,14 @@ reference_binding (tree rto, tree rfrom, tree expr, int flags)
a temporary, so we just issue an error when the conversion
actually occurs. */
NEED_TEMPORARY_P (conv) = 1;
+
return conv;
}
else if (CLASS_TYPE_P (from) && !(flags & LOOKUP_NO_CONVERSION))
{
/* [dcl.init.ref]
- If the initializer exprsesion
+ If the initializer expression
-- has a class type (i.e., T2 is a class type) can be
implicitly converted to an lvalue of type "cv3 T3," where
@@ -1296,7 +1044,7 @@ reference_binding (tree rto, tree rfrom, tree expr, int flags)
or to a sub-object within that object.
-- ...
-
+
We use the first alternative. The implicit conversion sequence
is supposed to be same as we would obtain by generating a
temporary. Fortunately, if the types are reference compatible,
@@ -1305,7 +1053,10 @@ reference_binding (tree rto, tree rfrom, tree expr, int flags)
if (CLASS_TYPE_P (from) && compatible_p)
{
conv = build1 (IDENTITY_CONV, from, expr);
- return direct_reference_binding (rto, conv);
+ conv = direct_reference_binding (rto, conv);
+ if (!(flags & LOOKUP_CONSTRUCTOR_CALLABLE))
+ CHECK_COPY_CONSTRUCTOR_P (TREE_OPERAND (conv, 0)) = 1;
+ return conv;
}
/* [dcl.init.ref]
@@ -1336,20 +1087,10 @@ reference_binding (tree rto, tree rfrom, tree expr, int flags)
significant. */
static tree
-implicit_conversion (to, from, expr, flags)
- tree to, from, expr;
- int flags;
+implicit_conversion (tree to, tree from, tree expr, int flags)
{
tree conv;
- /* 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;
@@ -1360,11 +1101,12 @@ implicit_conversion (to, from, expr, flags)
conv = standard_conversion (to, from, expr);
if (conv)
- ;
- else if (expr != NULL_TREE
- && (IS_AGGR_TYPE (from)
- || IS_AGGR_TYPE (to))
- && (flags & LOOKUP_NO_CONVERSION) == 0)
+ return conv;
+
+ if (expr != NULL_TREE
+ && (IS_AGGR_TYPE (from)
+ || IS_AGGR_TYPE (to))
+ && (flags & LOOKUP_NO_CONVERSION) == 0)
{
struct z_candidate *cand;
@@ -1376,9 +1118,10 @@ implicit_conversion (to, from, expr, flags)
/* 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;
}
- return conv;
+ return NULL_TREE;
}
/* Add a new entry to the list of candidates. Used by the add_*_candidate
@@ -1386,13 +1129,13 @@ implicit_conversion (to, from, expr, flags)
static struct z_candidate *
add_candidate (struct z_candidate **candidates,
- tree fn, tree convs, tree access_path, tree
- conversion_path, int viable)
+ tree fn, tree args, tree convs, tree access_path,
+ tree conversion_path, int viable)
{
- struct z_candidate *cand
- = (struct z_candidate *) ggc_alloc_cleared (sizeof (struct z_candidate));
+ struct z_candidate *cand = ggc_alloc_cleared (sizeof (struct z_candidate));
cand->fn = fn;
+ cand->args = args;
cand->convs = convs;
cand->access_path = access_path;
cand->conversion_path = conversion_path;
@@ -1420,6 +1163,7 @@ add_function_candidate (struct z_candidate **candidates,
int i, len;
tree convs;
tree parmnode, argnode;
+ tree orig_arglist;
int viable = 1;
/* Built-in functions that haven't been declared don't really
@@ -1432,8 +1176,11 @@ add_function_candidate (struct z_candidate **candidates,
if (DECL_CONSTRUCTOR_P (fn))
{
parmlist = skip_artificial_parms_for (fn, parmlist);
+ orig_arglist = arglist;
arglist = skip_artificial_parms_for (fn, arglist);
}
+ else
+ orig_arglist = arglist;
len = list_length (arglist);
convs = make_tree_vec (len);
@@ -1531,7 +1278,7 @@ add_function_candidate (struct z_candidate **candidates,
}
out:
- return add_candidate (candidates, fn, convs, access_path,
+ return add_candidate (candidates, fn, orig_arglist, convs, access_path,
conversion_path, viable);
}
@@ -1547,12 +1294,8 @@ add_function_candidate (struct z_candidate **candidates,
instead of the function. */
static struct z_candidate *
-add_conv_candidate (candidates, fn, obj, arglist, access_path,
- conversion_path)
- struct z_candidate **candidates;
- tree fn, obj, arglist;
- tree access_path;
- tree conversion_path;
+add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
+ tree arglist, tree access_path, tree conversion_path)
{
tree totype = TREE_TYPE (TREE_TYPE (fn));
int i, len, viable, flags;
@@ -1612,17 +1355,14 @@ add_conv_candidate (candidates, fn, obj, arglist, access_path,
if (!sufficient_parms_p (parmnode))
viable = 0;
- return add_candidate (candidates, totype, convs, access_path,
+ return add_candidate (candidates, totype, arglist, convs, access_path,
conversion_path, viable);
}
static void
-build_builtin_candidate (candidates, fnname, type1, type2,
- args, argtypes, flags)
- struct z_candidate **candidates;
- tree fnname, type1, type2, *args, *argtypes;
- int flags;
-
+build_builtin_candidate (struct z_candidate **candidates, tree fnname,
+ tree type1, tree type2, tree *args, tree *argtypes,
+ int flags)
{
tree t, convs;
int viable = 1, i;
@@ -1662,24 +1402,22 @@ build_builtin_candidate (candidates, fnname, type1, type2,
viable = 0;
}
- add_candidate (candidates, fnname, convs,
+ add_candidate (candidates, fnname, /*args=*/NULL_TREE, convs,
/*access_path=*/NULL_TREE,
/*conversion_path=*/NULL_TREE,
viable);
}
-static int
-is_complete (t)
- tree t;
+static bool
+is_complete (tree t)
{
return COMPLETE_TYPE_P (complete_type (t));
}
/* Returns nonzero if TYPE is a promoted arithmetic type. */
-static int
-promoted_arithmetic_type_p (type)
- tree type;
+static bool
+promoted_arithmetic_type_p (tree type)
{
/* [over.built]
@@ -1704,12 +1442,9 @@ promoted_arithmetic_type_p (type)
CODE (TYPE1, TYPE1) and CODE (TYPE2, TYPE2). */
static void
-add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
- args, argtypes, flags)
- struct z_candidate **candidates;
- enum tree_code code, code2;
- tree fnname, type1, type2, *args, *argtypes;
- int flags;
+add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
+ enum tree_code code2, tree fnname, tree type1,
+ tree type2, tree *args, tree *argtypes, int flags)
{
switch (code)
{
@@ -1781,8 +1516,7 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
T operator-(T); */
case CONVERT_EXPR: /* unary + */
- if (TREE_CODE (type1) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type1)) != OFFSET_TYPE)
+ if (TREE_CODE (type1) == POINTER_TYPE)
break;
case NEGATE_EXPR:
if (ARITHMETIC_TYPE_P (type1))
@@ -1807,12 +1541,10 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
case MEMBER_REF:
if (TREE_CODE (type1) == POINTER_TYPE
- && (TYPE_PTRMEMFUNC_P (type2) || TYPE_PTRMEM_P (type2)))
+ && TYPE_PTR_TO_MEMBER_P (type2))
{
tree c1 = TREE_TYPE (type1);
- tree c2 = (TYPE_PTRMEMFUNC_P (type2)
- ? TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type2)))
- : TYPE_OFFSET_BASETYPE (TREE_TYPE (type2)));
+ tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2);
if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1)
&& (TYPE_PTRMEMFUNC_P (type2)
@@ -1882,19 +1614,17 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
if ((TYPE_PTRMEMFUNC_P (type1) && TYPE_PTRMEMFUNC_P (type2))
|| (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2)))
break;
- if ((TYPE_PTRMEMFUNC_P (type1) || TYPE_PTRMEM_P (type1))
- && null_ptr_cst_p (args[1]))
+ if (TYPE_PTR_TO_MEMBER_P (type1) && null_ptr_cst_p (args[1]))
{
type2 = type1;
break;
}
- if ((TYPE_PTRMEMFUNC_P (type2) || TYPE_PTRMEM_P (type2))
- && null_ptr_cst_p (args[0]))
+ if (TYPE_PTR_TO_MEMBER_P (type2) && null_ptr_cst_p (args[0]))
{
type1 = type2;
break;
}
- /* FALLTHROUGH */
+ /* Fall through. */
case LT_EXPR:
case GT_EXPR:
case LE_EXPR:
@@ -2060,12 +1790,8 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
break;
/* 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)))
+ if (!(TYPE_PTR_P (type1) || TYPE_PTR_TO_MEMBER_P (type1))
+ || !(TYPE_PTR_P (type2) || TYPE_PTR_TO_MEMBER_P (type2)))
return;
/* We don't check that the two types are the same; the logic
@@ -2083,8 +1809,8 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
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_PTR_P (type1) && TYPE_PTR_P (type2))
+ || (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))
|| TYPE_PTRMEMFUNC_P (type1)
|| IS_AGGR_TYPE (type1)
|| TREE_CODE (type1) == ENUMERAL_TYPE))
@@ -2101,8 +1827,7 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
}
tree
-type_decays_to (type)
- tree type;
+type_decays_to (tree type)
{
if (TREE_CODE (type) == ARRAY_TYPE)
return build_pointer_type (TREE_TYPE (type));
@@ -2125,11 +1850,9 @@ type_decays_to (type)
filter out the invalid set. */
static void
-add_builtin_candidates (candidates, code, code2, fnname, args, flags)
- struct z_candidate **candidates;
- enum tree_code code, code2;
- tree fnname, *args;
- int flags;
+add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
+ enum tree_code code2, tree fnname, tree *args,
+ int flags)
{
int ref1, i;
int enum_p = 0;
@@ -2194,7 +1917,7 @@ add_builtin_candidates (candidates, code, code2, fnname, args, flags)
case GT_EXPR:
case GE_EXPR:
enum_p = 1;
- /* FALLTHROUGH */
+ /* Fall through. */
default:
ref1 = 0;
@@ -2302,16 +2025,11 @@ add_builtin_candidates (candidates, code, code2, fnname, args, flags)
add_conv_candidate. */
static struct z_candidate*
-add_template_candidate_real (candidates, tmpl, ctype, explicit_targs,
- arglist, return_type, access_path,
- conversion_path, flags, obj, strict)
- struct z_candidate **candidates;
- tree tmpl, ctype, explicit_targs, arglist, return_type;
- tree access_path;
- tree conversion_path;
- int flags;
- tree obj;
- unification_kind_t strict;
+add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
+ tree ctype, tree explicit_targs, tree arglist,
+ tree return_type, tree access_path,
+ tree conversion_path, int flags, tree obj,
+ unification_kind_t strict)
{
int ntparms = DECL_NTPARMS (tmpl);
tree targs = make_tree_vec (ntparms);
@@ -2337,7 +2055,7 @@ add_template_candidate_real (candidates, tmpl, ctype, explicit_targs,
if (i != 0)
return NULL;
- fn = instantiate_template (tmpl, targs);
+ fn = instantiate_template (tmpl, targs, tf_none);
if (fn == error_mark_node)
return NULL;
@@ -2406,15 +2124,10 @@ add_template_candidate_real (candidates, tmpl, ctype, explicit_targs,
static struct z_candidate *
-add_template_candidate (candidates, tmpl, ctype, explicit_targs,
- arglist, return_type, access_path,
- conversion_path, flags, strict)
- struct z_candidate **candidates;
- tree tmpl, ctype, explicit_targs, arglist, return_type;
- tree access_path;
- tree conversion_path;
- int flags;
- unification_kind_t strict;
+add_template_candidate (struct z_candidate **candidates, tree tmpl, tree ctype,
+ tree explicit_targs, tree arglist, tree return_type,
+ tree access_path, tree conversion_path, int flags,
+ unification_kind_t strict)
{
return
add_template_candidate_real (candidates, tmpl, ctype,
@@ -2425,12 +2138,9 @@ add_template_candidate (candidates, tmpl, ctype, explicit_targs,
static struct z_candidate *
-add_template_conv_candidate (candidates, tmpl, obj, arglist, return_type,
- access_path, conversion_path)
- struct z_candidate **candidates;
- tree tmpl, obj, arglist, return_type;
- tree access_path;
- tree conversion_path;
+add_template_conv_candidate (struct z_candidate **candidates, tree tmpl,
+ tree obj, tree arglist, tree return_type,
+ tree access_path, tree conversion_path)
{
return
add_template_candidate_real (candidates, tmpl, NULL_TREE, NULL_TREE,
@@ -2438,47 +2148,55 @@ add_template_conv_candidate (candidates, tmpl, obj, arglist, return_type,
conversion_path, 0, obj, DEDUCE_CONV);
}
+/* The CANDS are the set of candidates that were considered for
+ overload resolution. Return the set of viable candidates. If none
+ of the candidates were viable, set *ANY_VIABLE_P to true. STRICT_P
+ is true if a candidate should be considered viable only if it is
+ strictly viable. */
-static int
-any_viable (cands)
- struct z_candidate *cands;
-{
- for (; cands; cands = cands->next)
- if (pedantic ? cands->viable == 1 : cands->viable)
- return 1;
- return 0;
-}
-
-static int
-any_strictly_viable (cands)
- struct z_candidate *cands;
+static struct z_candidate*
+splice_viable (struct z_candidate *cands,
+ bool strict_p,
+ bool *any_viable_p)
{
- for (; cands; cands = cands->next)
- if (cands->viable == 1)
- return 1;
- return 0;
-}
+ struct z_candidate *viable;
+ struct z_candidate **last_viable;
+ struct z_candidate **cand;
-static struct z_candidate *
-splice_viable (cands)
- struct z_candidate *cands;
-{
- struct z_candidate **p = &cands;
+ viable = NULL;
+ last_viable = &viable;
+ *any_viable_p = false;
- for (; *p; )
+ cand = &cands;
+ while (*cand)
{
- if (pedantic ? (*p)->viable == 1 : (*p)->viable)
- p = &((*p)->next);
+ struct z_candidate *c = *cand;
+ if (strict_p ? c->viable == 1 : c->viable)
+ {
+ *last_viable = c;
+ *cand = c->next;
+ c->next = NULL;
+ last_viable = &c->next;
+ *any_viable_p = true;
+ }
else
- *p = (*p)->next;
+ cand = &c->next;
}
- return cands;
+ return viable ? viable : cands;
+}
+
+static bool
+any_strictly_viable (struct z_candidate *cands)
+{
+ for (; cands; cands = cands->next)
+ if (cands->viable == 1)
+ return true;
+ return false;
}
static tree
-build_this (obj)
- tree obj;
+build_this (tree obj)
{
/* Fix this to work on non-lvalues. */
return build_unary_op (ADDR_EXPR, obj, 0);
@@ -2489,9 +2207,7 @@ build_this (obj)
both are extern "C". */
static inline int
-equal_functions (fn1, fn2)
- tree fn1;
- tree fn2;
+equal_functions (tree fn1, tree fn2)
{
if (DECL_LOCAL_FUNCTION_P (fn1) || DECL_LOCAL_FUNCTION_P (fn2)
|| DECL_EXTERN_C_FUNCTION_P (fn1))
@@ -2499,6 +2215,39 @@ equal_functions (fn1, fn2)
return fn1 == fn2;
}
+/* Print information about one overload candidate CANDIDATE. MSGSTR
+ is the text to print before the candidate itself.
+
+ NOTE: Unlike most diagnostic functions in GCC, MSGSTR is expected
+ to have been run through gettext by the caller. This wart makes
+ life simpler in print_z_candidates and for the translators. */
+
+static void
+print_z_candidate (const char *msgstr, struct z_candidate *candidate)
+{
+ if (TREE_CODE (candidate->fn) == IDENTIFIER_NODE)
+ {
+ if (TREE_VEC_LENGTH (candidate->convs) == 3)
+ inform ("%s %D(%T, %T, %T) <built-in>", msgstr, candidate->fn,
+ TREE_TYPE (TREE_VEC_ELT (candidate->convs, 0)),
+ TREE_TYPE (TREE_VEC_ELT (candidate->convs, 1)),
+ TREE_TYPE (TREE_VEC_ELT (candidate->convs, 2)));
+ else if (TREE_VEC_LENGTH (candidate->convs) == 2)
+ inform ("%s %D(%T, %T) <built-in>", msgstr, candidate->fn,
+ TREE_TYPE (TREE_VEC_ELT (candidate->convs, 0)),
+ TREE_TYPE (TREE_VEC_ELT (candidate->convs, 1)));
+ else
+ inform ("%s %D(%T) <built-in>", msgstr, candidate->fn,
+ TREE_TYPE (TREE_VEC_ELT (candidate->convs, 0)));
+ }
+ else if (TYPE_P (candidate->fn))
+ inform ("%s %T <conversion>", msgstr, candidate->fn);
+ else if (candidate->viable == -1)
+ inform ("%J%s %+#D <near match>", candidate->fn, msgstr, candidate->fn);
+ else
+ inform ("%J%s %+#D", candidate->fn, msgstr, candidate->fn);
+}
+
static void
print_z_candidates (struct z_candidate *candidates)
{
@@ -2528,30 +2277,27 @@ print_z_candidates (struct z_candidate *candidates)
}
}
- str = "candidates are:";
- for (; candidates; candidates = candidates->next)
+ if (!candidates)
+ return;
+
+ str = _("candidates are:");
+ print_z_candidate (str, candidates);
+ if (candidates->next)
{
- if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE)
+ /* Indent successive candidates by the width of the translation
+ of the above string. */
+ size_t len = gcc_gettext_width (str) + 1;
+ char *spaces = alloca (len);
+ memset (spaces, ' ', len-1);
+ spaces[len - 1] = '\0';
+
+ candidates = candidates->next;
+ do
{
- 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)
- 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
- error ("%s %D(%T) <built-in>", str, candidates->fn,
- TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)));
+ print_z_candidate (spaces, candidates);
+ candidates = candidates->next;
}
- else if (TYPE_P (candidates->fn))
- error ("%s %T <conversion>", str, candidates->fn);
- else
- cp_error_at ("%s %+#D%s", str, candidates->fn,
- candidates->viable == -1 ? " <near match>" : "");
- str = " ";
+ while (candidates);
}
}
@@ -2591,14 +2337,13 @@ merge_conversion_sequences (tree user_seq, tree std_seq)
per [dcl.init.ref], so we ignore temporary bindings. */
static struct z_candidate *
-build_user_type_conversion_1 (totype, expr, flags)
- tree totype, expr;
- int flags;
+build_user_type_conversion_1 (tree totype, tree expr, int flags)
{
struct z_candidate *candidates, *cand;
tree fromtype = TREE_TYPE (expr);
tree ctors = NULL_TREE, convs = NULL_TREE;
tree args = NULL_TREE;
+ bool any_viable_p;
/* We represent conversion within a hierarchy using RVALUE_CONV and
BASE_CONV, as specified by [over.best.ics]; these become plain
@@ -2684,7 +2429,8 @@ build_user_type_conversion_1 (totype, expr, flags)
So we pass fromtype as CTYPE to add_*_candidate. */
if (TREE_CODE (fn) == TEMPLATE_DECL)
- cand = add_template_candidate (&candidates, fn, fromtype, NULL_TREE,
+ cand = add_template_candidate (&candidates, fn, fromtype,
+ NULL_TREE,
args, totype,
TYPE_BINFO (fromtype),
conversion_path,
@@ -2699,26 +2445,25 @@ build_user_type_conversion_1 (totype, expr, flags)
if (cand)
{
- tree ics = implicit_conversion
- (totype, TREE_TYPE (TREE_TYPE (cand->fn)),
- 0, convflags);
+ tree ics = implicit_conversion (totype,
+ TREE_TYPE (TREE_TYPE (cand->fn)),
+ 0, convflags);
cand->second_conv = ics;
if (ics == NULL_TREE)
cand->viable = 0;
- else if (cand->viable == 1 && ICS_BAD_FLAG (ics))
+ else if (candidates->viable == 1 && ICS_BAD_FLAG (ics))
cand->viable = -1;
}
}
}
- if (! any_viable (candidates))
+ candidates = splice_viable (candidates, pedantic, &any_viable_p);
+ if (!any_viable_p)
return 0;
- candidates = splice_viable (candidates);
cand = tourney (candidates);
-
if (cand == 0)
{
if (flags & LOOKUP_COMPLAIN)
@@ -2759,9 +2504,7 @@ build_user_type_conversion_1 (totype, expr, flags)
}
tree
-build_user_type_conversion (totype, expr, flags)
- tree totype, expr;
- int flags;
+build_user_type_conversion (tree totype, tree expr, int flags)
{
struct z_candidate *cand
= build_user_type_conversion_1 (totype, expr, flags);
@@ -2775,83 +2518,10 @@ build_user_type_conversion (totype, expr, flags)
return NULL_TREE;
}
-/* Find the possibly overloaded set of functions corresponding to a
- call of the form SCOPE::NAME (...). NAME might be a
- TEMPLATE_ID_EXPR, OVERLOAD, _DECL, IDENTIFIER_NODE or LOOKUP_EXPR. */
-
-tree
-resolve_scoped_fn_name (tree scope, tree name)
-{
- tree fn;
- tree template_args = NULL_TREE;
- bool is_template_id = TREE_CODE (name) == TEMPLATE_ID_EXPR;
-
- if (is_template_id)
- {
- template_args = TREE_OPERAND (name, 1);
- name = TREE_OPERAND (name, 0);
- }
- if (TREE_CODE (name) == OVERLOAD)
- name = DECL_NAME (get_first_fn (name));
- else if (TREE_CODE (name) == LOOKUP_EXPR)
- name = TREE_OPERAND (name, 0);
-
- if (TREE_CODE (scope) == NAMESPACE_DECL)
- fn = lookup_namespace_name (scope, name);
- else if (!CLASS_TYPE_P (scope))
- {
- error ("`%T' is not a class type", scope);
- return error_mark_node;
- }
- else
- {
- if (!TYPE_BEING_DEFINED (scope)
- && !COMPLETE_TYPE_P (complete_type (scope)))
- {
- error ("incomplete type '%T' cannot be used to name a scope",
- scope);
- return error_mark_node;
- }
-
- if (BASELINK_P (name))
- fn = name;
- else
- fn = lookup_member (scope, name, /*protect=*/1, /*prefer_type=*/0);
- if (fn && current_class_type)
- fn = (adjust_result_of_qualified_name_lookup
- (fn, scope, current_class_type));
-
- /* It might be the name of a function pointer member. */
- if (fn && TREE_CODE (fn) == FIELD_DECL)
- fn = resolve_offset_ref (build_offset_ref (scope, fn));
- }
-
- if (!fn)
- {
- error ("'%D' has no member named '%E'", scope, name);
- return error_mark_node;
- }
- if (is_template_id)
- {
- tree fns = fn;
-
- if (BASELINK_P (fn))
- fns = BASELINK_FUNCTIONS (fns);
- fns = build_nt (TEMPLATE_ID_EXPR, fns, template_args);
- if (BASELINK_P (fn))
- BASELINK_FUNCTIONS (fn) = fns;
- else
- fn = fns;
- }
-
- return fn;
-}
-
/* Do any initial processing on the arguments to a function call. */
static tree
-resolve_args (args)
- tree args;
+resolve_args (tree args)
{
tree t;
for (t = args; t; t = TREE_CHAIN (t))
@@ -2865,25 +2535,37 @@ resolve_args (args)
error ("invalid use of void expression");
return error_mark_node;
}
- else if (TREE_CODE (arg) == OFFSET_REF)
- arg = resolve_offset_ref (arg);
arg = convert_from_reference (arg);
TREE_VALUE (t) = arg;
}
return args;
}
-/* Return an expression for a call to FN (a namespace-scope function)
- with the ARGS. */
-
-tree
-build_new_function_call (fn, args)
- tree fn, args;
+/* Perform overload resolution on FN, which is called with the ARGS.
+
+ Return the candidate function selected by overload resolution, or
+ NULL if the event that overload resolution failed. In the case
+ that overload resolution fails, *CANDIDATES will be the set of
+ candidates considered, and ANY_VIABLE_P will be set to true or
+ false to indicate whether or not any of the candidates were
+ viable.
+
+ The ARGS should already have gone through RESOLVE_ARGS before this
+ function is called. */
+
+static struct z_candidate *
+perform_overload_resolution (tree fn,
+ tree args,
+ struct z_candidate **candidates,
+ bool *any_viable_p)
{
- struct z_candidate *candidates = 0, *cand;
+ struct z_candidate *cand;
tree explicit_targs = NULL_TREE;
int template_only = 0;
+ *candidates = NULL;
+ *any_viable_p = true;
+
/* Check FN and ARGS. */
my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL
|| TREE_CODE (fn) == TEMPLATE_DECL
@@ -2900,69 +2582,151 @@ build_new_function_call (fn, args)
template_only = 1;
}
- if (really_overloaded_fn (fn)
- || TREE_CODE (fn) == TEMPLATE_DECL)
- {
- tree t1;
+ /* Add the various candidate functions. */
+ add_candidates (fn, args, explicit_targs, template_only,
+ /*conversion_path=*/NULL_TREE,
+ /*access_path=*/NULL_TREE,
+ LOOKUP_NORMAL,
+ candidates);
- args = resolve_args (args);
+ *candidates = splice_viable (*candidates, pedantic, any_viable_p);
+ if (!*any_viable_p)
+ return NULL;
- if (args == error_mark_node)
- return error_mark_node;
+ cand = tourney (*candidates);
+ return cand;
+}
- for (t1 = fn; t1; t1 = OVL_NEXT (t1))
- {
- tree t = OVL_CURRENT (t1);
-
- if (TREE_CODE (t) == TEMPLATE_DECL)
- add_template_candidate
- (&candidates, t, NULL_TREE, explicit_targs, args,
- NULL_TREE,
- /*access_path=*/NULL_TREE, /*conversion_path=*/NULL_TREE,
- LOOKUP_NORMAL, DEDUCE_CALL);
- else if (! template_only)
- add_function_candidate
- (&candidates, t, NULL_TREE, args, /*access_path=*/NULL_TREE,
- /*conversion_path=*/NULL_TREE, LOOKUP_NORMAL);
- }
+/* Return an expression for a call to FN (a namespace-scope function,
+ or a static member function) with the ARGS. */
+
+tree
+build_new_function_call (tree fn, tree args)
+{
+ struct z_candidate *candidates, *cand;
+ bool any_viable_p;
- if (! any_viable (candidates))
- {
- if (candidates && ! candidates->next)
- return build_function_call (candidates->fn, args);
- error ("no matching function for call to `%D(%A)'",
- DECL_NAME (OVL_CURRENT (fn)), args);
- if (candidates)
- print_z_candidates (candidates);
- return error_mark_node;
- }
- candidates = splice_viable (candidates);
- cand = tourney (candidates);
+ args = resolve_args (args);
+ if (args == error_mark_node)
+ return error_mark_node;
- if (cand == 0)
- {
- error ("call of overloaded `%D(%A)' is ambiguous",
- DECL_NAME (OVL_FUNCTION (fn)), args);
- print_z_candidates (candidates);
- return error_mark_node;
- }
+ cand = perform_overload_resolution (fn, args, &candidates, &any_viable_p);
- return build_over_call (cand, args, LOOKUP_NORMAL);
+ if (!cand)
+ {
+ if (!any_viable_p && candidates && ! candidates->next)
+ return build_function_call (candidates->fn, args);
+ if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
+ fn = TREE_OPERAND (fn, 0);
+ if (!any_viable_p)
+ error ("no matching function for call to `%D(%A)'",
+ DECL_NAME (OVL_CURRENT (fn)), args);
+ else
+ error ("call of overloaded `%D(%A)' is ambiguous",
+ DECL_NAME (OVL_CURRENT (fn)), args);
+ if (candidates)
+ print_z_candidates (candidates);
+ return error_mark_node;
}
- /* This is not really overloaded. */
- fn = OVL_CURRENT (fn);
+ return build_over_call (cand, LOOKUP_NORMAL);
+}
+
+/* Build a call to a global operator new. FNNAME is the name of the
+ operator (either "operator new" or "operator new[]") and ARGS are
+ the arguments provided. *SIZE points to the total number of bytes
+ required by the allocation, and is updated if that is changed here.
+ *COOKIE_SIZE is non-NULL if a cookie should be used. If this
+ function determines that no cookie should be used, after all,
+ *COOKIE_SIZE is set to NULL_TREE. */
+
+tree
+build_operator_new_call (tree fnname, tree args, tree *size, tree *cookie_size)
+{
+ tree fns;
+ struct z_candidate *candidates;
+ struct z_candidate *cand;
+ bool any_viable_p;
+
+ args = tree_cons (NULL_TREE, *size, args);
+ args = resolve_args (args);
+ if (args == error_mark_node)
+ return args;
+
+ fns = lookup_function_nonclass (fnname, args);
+
+ /* Figure out what function is being called. */
+ cand = perform_overload_resolution (fns, args, &candidates, &any_viable_p);
+
+ /* If no suitable function could be found, issue an error message
+ and give up. */
+ if (!cand)
+ {
+ if (!any_viable_p)
+ error ("no matching function for call to `%D(%A)'",
+ DECL_NAME (OVL_CURRENT (fns)), args);
+ else
+ error ("call of overloaded `%D(%A)' is ambiguous",
+ DECL_NAME (OVL_CURRENT (fns)), args);
+ if (candidates)
+ print_z_candidates (candidates);
+ return error_mark_node;
+ }
- return build_function_call (fn, args);
+ /* If a cookie is required, add some extra space. Whether
+ or not a cookie is required cannot be determined until
+ after we know which function was called. */
+ if (*cookie_size)
+ {
+ bool use_cookie = true;
+ if (!abi_version_at_least (2))
+ {
+ tree placement = TREE_CHAIN (args);
+ /* In G++ 3.2, the check was implemented incorrectly; it
+ looked at the placement expression, rather than the
+ type of the function. */
+ if (placement && !TREE_CHAIN (placement)
+ && same_type_p (TREE_TYPE (TREE_VALUE (placement)),
+ ptr_type_node))
+ use_cookie = false;
+ }
+ else
+ {
+ tree arg_types;
+
+ arg_types = TYPE_ARG_TYPES (TREE_TYPE (cand->fn));
+ /* Skip the size_t parameter. */
+ arg_types = TREE_CHAIN (arg_types);
+ /* Check the remaining parameters (if any). */
+ if (arg_types
+ && TREE_CHAIN (arg_types) == void_list_node
+ && same_type_p (TREE_VALUE (arg_types),
+ ptr_type_node))
+ use_cookie = false;
+ }
+ /* If we need a cookie, adjust the number of bytes allocated. */
+ if (use_cookie)
+ {
+ /* Update the total size. */
+ *size = size_binop (PLUS_EXPR, *size, *cookie_size);
+ /* Update the argument list to reflect the adjusted size. */
+ TREE_VALUE (args) = *size;
+ }
+ else
+ *cookie_size = NULL_TREE;
+ }
+
+ /* Build the CALL_EXPR. */
+ return build_over_call (cand, LOOKUP_NORMAL);
}
static tree
-build_object_call (obj, args)
- tree obj, args;
+build_object_call (tree obj, tree args)
{
struct z_candidate *candidates = 0, *cand;
tree fns, convs, mem_args = NULL_TREE;
tree type = TREE_TYPE (obj);
+ bool any_viable_p;
if (TYPE_PTRMEMFUNC_P (type))
{
@@ -3031,16 +2795,15 @@ build_object_call (obj, args)
}
}
- if (! any_viable (candidates))
+ candidates = splice_viable (candidates, pedantic, &any_viable_p);
+ if (!any_viable_p)
{
error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args);
print_z_candidates (candidates);
return error_mark_node;
}
- candidates = splice_viable (candidates);
cand = tourney (candidates);
-
if (cand == 0)
{
error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args);
@@ -3053,7 +2816,7 @@ build_object_call (obj, args)
DECL_NAME here. */
if (TREE_CODE (cand->fn) == FUNCTION_DECL
&& DECL_OVERLOADED_OPERATOR_P (cand->fn) == CALL_EXPR)
- return build_over_call (cand, mem_args, LOOKUP_NORMAL);
+ return build_over_call (cand, LOOKUP_NORMAL);
obj = convert_like_with_context
(TREE_VEC_ELT (cand->convs, 0), obj, cand->fn, -1);
@@ -3063,10 +2826,8 @@ build_object_call (obj, args)
}
static void
-op_error (code, code2, arg1, arg2, arg3, problem)
- enum tree_code code, code2;
- tree arg1, arg2, arg3;
- const char *problem;
+op_error (enum tree_code code, enum tree_code code2,
+ tree arg1, tree arg2, tree arg3, const char *problem)
{
const char *opname;
@@ -3090,6 +2851,11 @@ op_error (code, code2, arg1, arg2, arg3, problem)
case ARRAY_REF:
error ("%s for 'operator[]' in '%E[%E]'", problem, arg1, arg2);
break;
+
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ error ("%s for '%s' in '%s %E'", problem, opname, opname, arg1);
+ break;
default:
if (arg2)
@@ -3106,9 +2872,7 @@ op_error (code, code2, arg1, arg2, arg3, problem)
convert E1 to E2 in [expr.cond]. */
static tree
-conditional_conversion (e1, e2)
- tree e1;
- tree e2;
+conditional_conversion (tree e1, tree e2)
{
tree t1 = non_reference (TREE_TYPE (e1));
tree t2 = non_reference (TREE_TYPE (e2));
@@ -3150,6 +2914,8 @@ conditional_conversion (e1, e2)
if (!same_type_p (TYPE_MAIN_VARIANT (t1),
TYPE_MAIN_VARIANT (t2)))
conv = build_conv (BASE_CONV, t2, conv);
+ else
+ conv = build_conv (RVALUE_CONV, t2, conv);
return conv;
}
else
@@ -3168,16 +2934,13 @@ conditional_conversion (e1, e2)
arguments to the conditional expression. */
tree
-build_conditional_expr (arg1, arg2, arg3)
- tree arg1;
- tree arg2;
- tree arg3;
+build_conditional_expr (tree arg1, tree arg2, tree arg3)
{
tree arg2_type;
tree arg3_type;
tree result;
tree result_type = NULL_TREE;
- int lvalue_p = 1;
+ bool lvalue_p = true;
struct z_candidate *candidates = 0;
struct z_candidate *cand;
@@ -3189,23 +2952,25 @@ build_conditional_expr (arg1, arg2, arg3)
{
if (pedantic)
pedwarn ("ISO C++ forbids omitting the middle term of a ?: expression");
- arg1 = arg2 = save_expr (arg1);
+
+ /* Make sure that lvalues remain lvalues. See g++.oliva/ext1.C. */
+ if (real_lvalue_p (arg1))
+ arg2 = arg1 = stabilize_reference (arg1);
+ else
+ arg2 = arg1 = save_expr (arg1);
}
/* [expr.cond]
The first expr ession is implicitly converted to bool (clause
_conv_). */
- arg1 = cp_convert (boolean_type_node, arg1);
+ arg1 = perform_implicit_conversion (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)
+ if (error_operand_p (arg1)
+ || error_operand_p (arg2)
+ || error_operand_p (arg3))
return error_mark_node;
/* [expr.cond]
@@ -3238,11 +3003,27 @@ build_conditional_expr (arg1, arg2, arg3)
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);
+ result is of type void and is an rvalue.
+
+ We must avoid calling force_rvalue for expressions of type
+ "void" because it will complain that their value is being
+ used. */
+ if (TREE_CODE (arg2) == THROW_EXPR
+ && TREE_CODE (arg3) != THROW_EXPR)
+ {
+ if (!VOID_TYPE_P (arg3_type))
+ arg3 = force_rvalue (arg3);
+ arg3_type = TREE_TYPE (arg3);
+ result_type = arg3_type;
+ }
+ else if (TREE_CODE (arg2) != THROW_EXPR
+ && TREE_CODE (arg3) == THROW_EXPR)
+ {
+ if (!VOID_TYPE_P (arg2_type))
+ arg2 = force_rvalue (arg2);
+ arg2_type = TREE_TYPE (arg2);
+ result_type = arg2_type;
+ }
else if (VOID_TYPE_P (arg2_type) && VOID_TYPE_P (arg3_type))
result_type = void_type_node;
else
@@ -3252,7 +3033,7 @@ build_conditional_expr (arg1, arg2, arg3)
return error_mark_node;
}
- lvalue_p = 0;
+ lvalue_p = false;
goto valid_operands;
}
/* [expr.cond]
@@ -3287,33 +3068,46 @@ build_conditional_expr (arg1, arg2, arg3)
{
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);
}
+
+ /* If, after the conversion, both operands have class type,
+ treat the cv-qualification of both operands as if it were the
+ union of the cv-qualification of the operands.
+
+ The standard is not clear about what to do in this
+ circumstance. For example, if the first operand has type
+ "const X" and the second operand has a user-defined
+ conversion to "volatile X", what is the type of the second
+ operand after this step? Making it be "const X" (matching
+ the first operand) seems wrong, as that discards the
+ qualification without actuall performing a copy. Leaving it
+ as "volatile X" seems wrong as that will result in the
+ conditional expression failing altogether, even though,
+ according to this step, the one operand could be converted to
+ the type of the other. */
+ if ((conv2 || conv3)
+ && CLASS_TYPE_P (arg2_type)
+ && TYPE_QUALS (arg2_type) != TYPE_QUALS (arg3_type))
+ arg2_type = arg3_type =
+ cp_build_qualified_type (arg2_type,
+ TYPE_QUALS (arg2_type)
+ | TYPE_QUALS (arg3_type));
}
/* [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))
+ if (real_lvalue_p (arg2)
+ && real_lvalue_p (arg3)
+ && same_type_p (arg2_type, arg3_type))
{
result_type = arg2_type;
goto valid_operands;
@@ -3326,12 +3120,13 @@ build_conditional_expr (arg1, arg2, arg3)
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;
+ lvalue_p = false;
if (!same_type_p (arg2_type, arg3_type)
&& (CLASS_TYPE_P (arg2_type) || CLASS_TYPE_P (arg3_type)))
{
tree args[3];
tree conv;
+ bool any_viable_p;
/* Rearrange the arguments so that add_builtin_candidate only has
to know about two args. In build_builtin_candidates, the
@@ -3350,13 +3145,13 @@ build_conditional_expr (arg1, arg2, arg3)
If the overload resolution fails, the program is
ill-formed. */
- if (!any_viable (candidates))
+ candidates = splice_viable (candidates, pedantic, &any_viable_p);
+ if (!any_viable_p)
{
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)
{
@@ -3387,16 +3182,15 @@ build_conditional_expr (arg1, arg2, arg3)
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. */
+ regions. */
arg2 = force_rvalue (arg2);
- arg2_type = TREE_TYPE (arg2);
+ if (!CLASS_TYPE_P (arg2_type))
+ arg2_type = TREE_TYPE (arg2);
arg3 = force_rvalue (arg3);
- arg3_type = TREE_TYPE (arg3);
+ if (!CLASS_TYPE_P (arg2_type))
+ arg3_type = TREE_TYPE (arg3);
if (arg2 == error_mark_node || arg3 == error_mark_node)
return error_mark_node;
@@ -3454,18 +3248,17 @@ build_conditional_expr (arg1, arg2, arg3)
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)))
+ && (TYPE_PTR_P (arg3_type) || TYPE_PTR_TO_MEMBER_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_TO_MEMBER_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)))
+ || (TYPE_PTRMEMFUNC_P (arg2_type) && TYPE_PTRMEMFUNC_P (arg3_type)))
{
result_type = composite_pointer_type (arg2_type, arg3_type, arg2,
arg3, "conditional expression");
+ if (result_type == error_mark_node)
+ return error_mark_node;
arg2 = perform_implicit_conversion (result_type, arg2);
arg3 = perform_implicit_conversion (result_type, arg3);
}
@@ -3478,45 +3271,125 @@ build_conditional_expr (arg1, arg2, arg3)
valid_operands:
result = fold (build (COND_EXPR, result_type, arg1, arg2, arg3));
+ /* We can't use result_type below, as fold might have returned a
+ throw_expr. */
+
/* 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 (!lvalue_p && CLASS_TYPE_P (TREE_TYPE (result)))
+ result = get_target_expr (result);
/* 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);
+ result = build1 (NON_LVALUE_EXPR, TREE_TYPE (result), result);
return result;
}
+/* OPERAND is an operand to an expression. Perform necessary steps
+ required before using it. If OPERAND is NULL_TREE, NULL_TREE is
+ returned. */
+
+static tree
+prep_operand (tree operand)
+{
+ if (operand)
+ {
+ operand = convert_from_reference (operand);
+ if (CLASS_TYPE_P (TREE_TYPE (operand))
+ && CLASSTYPE_TEMPLATE_INSTANTIATION (TREE_TYPE (operand)))
+ /* Make sure the template type is instantiated now. */
+ instantiate_class_template (TYPE_MAIN_VARIANT (TREE_TYPE (operand)));
+ }
+
+ return operand;
+}
+
+/* Add each of the viable functions in FNS (a FUNCTION_DECL or
+ OVERLOAD) to the CANDIDATES, returning an updated list of
+ CANDIDATES. The ARGS are the arguments provided to the call,
+ without any implicit object parameter. The EXPLICIT_TARGS are
+ explicit template arguments provided. TEMPLATE_ONLY is true if
+ only template functions should be considered. CONVERSION_PATH,
+ ACCESS_PATH, and FLAGS are as for add_function_candidate. */
+
+static void
+add_candidates (tree fns, tree args,
+ tree explicit_targs, bool template_only,
+ tree conversion_path, tree access_path,
+ int flags,
+ struct z_candidate **candidates)
+{
+ tree ctype;
+ tree non_static_args;
+
+ ctype = conversion_path ? BINFO_TYPE (conversion_path) : NULL_TREE;
+ /* Delay creating the implicit this parameter until it is needed. */
+ non_static_args = NULL_TREE;
+
+ while (fns)
+ {
+ tree fn;
+ tree fn_args;
+
+ fn = OVL_CURRENT (fns);
+ /* Figure out which set of arguments to use. */
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+ {
+ /* If this function is a non-static member, prepend the implicit
+ object parameter. */
+ if (!non_static_args)
+ non_static_args = tree_cons (NULL_TREE,
+ build_this (TREE_VALUE (args)),
+ TREE_CHAIN (args));
+ fn_args = non_static_args;
+ }
+ else
+ /* Otherwise, just use the list of arguments provided. */
+ fn_args = args;
+
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ add_template_candidate (candidates,
+ fn,
+ ctype,
+ explicit_targs,
+ fn_args,
+ NULL_TREE,
+ access_path,
+ conversion_path,
+ flags,
+ DEDUCE_CALL);
+ else if (!template_only)
+ add_function_candidate (candidates,
+ fn,
+ ctype,
+ fn_args,
+ access_path,
+ conversion_path,
+ flags);
+ fns = OVL_NEXT (fns);
+ }
+}
+
tree
-build_new_op (code, flags, arg1, arg2, arg3)
- enum tree_code code;
- int flags;
- tree arg1, arg2, arg3;
+build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
+ bool *overloaded_p)
{
struct z_candidate *candidates = 0, *cand;
- tree fns, mem_arglist = NULL_TREE, arglist, fnname;
+ tree arglist, fnname;
+ tree args[3];
enum tree_code code2 = NOP_EXPR;
tree conv;
- bool viable_candidates;
+ bool strict_p;
+ bool any_viable_p;
- if (arg1 == error_mark_node
- || arg2 == error_mark_node
- || arg3 == error_mark_node)
+ if (error_operand_p (arg1)
+ || error_operand_p (arg2)
+ || error_operand_p (arg3))
return error_mark_node;
- /* This can happen if a template takes all non-type parameters, e.g.
- undeclared_template<1, 5, 72>a; */
- if (code == LT_EXPR && TREE_CODE (arg1) == TEMPLATE_DECL)
- {
- error ("`%D' must be declared before use", arg1);
- return error_mark_node;
- }
-
if (code == MODIFY_EXPR)
{
code2 = TREE_CODE (arg3);
@@ -3526,13 +3399,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
else
fnname = ansi_opname (code);
- if (TREE_CODE (arg1) == OFFSET_REF)
- arg1 = resolve_offset_ref (arg1);
- arg1 = convert_from_reference (arg1);
- if (CLASS_TYPE_P (TREE_TYPE (arg1))
- && CLASSTYPE_TEMPLATE_INSTANTIATION (TREE_TYPE (arg1)))
- /* Make sure the template type is instantiated now. */
- instantiate_class_template (TYPE_MAIN_VARIANT (TREE_TYPE (arg1)));
+ arg1 = prep_operand (arg1);
switch (code)
{
@@ -3550,24 +3417,8 @@ build_new_op (code, flags, arg1, arg2, arg3)
break;
}
- if (arg2)
- {
- if (TREE_CODE (arg2) == OFFSET_REF)
- arg2 = resolve_offset_ref (arg2);
- arg2 = convert_from_reference (arg2);
- if (CLASS_TYPE_P (TREE_TYPE (arg2))
- && CLASSTYPE_TEMPLATE_INSTANTIATION (TREE_TYPE (arg2)))
- instantiate_class_template (TYPE_MAIN_VARIANT (TREE_TYPE (arg2)));
- }
- if (arg3)
- {
- if (TREE_CODE (arg3) == OFFSET_REF)
- arg3 = resolve_offset_ref (arg3);
- arg3 = convert_from_reference (arg3);
- if (CLASS_TYPE_P (TREE_TYPE (arg3))
- && CLASSTYPE_TEMPLATE_INSTANTIATION (TREE_TYPE (arg3)))
- instantiate_class_template (TYPE_MAIN_VARIANT (TREE_TYPE (arg3)));
- }
+ arg2 = prep_operand (arg2);
+ arg3 = prep_operand (arg3);
if (code == COND_EXPR)
{
@@ -3592,89 +3443,45 @@ build_new_op (code, flags, arg1, arg2, arg3)
arglist = tree_cons (NULL_TREE, arg2, arglist);
arglist = tree_cons (NULL_TREE, arg1, arglist);
- fns = lookup_function_nonclass (fnname, arglist);
-
- if (fns && TREE_CODE (fns) == TREE_LIST)
- fns = TREE_VALUE (fns);
- for (; fns; fns = OVL_NEXT (fns))
+ /* Add namespace-scope operators to the list of functions to
+ consider. */
+ add_candidates (lookup_function_nonclass (fnname, arglist),
+ arglist, NULL_TREE, false, NULL_TREE, NULL_TREE,
+ flags, &candidates);
+ /* Add class-member operators to the candidate set. */
+ if (CLASS_TYPE_P (TREE_TYPE (arg1)))
{
- tree fn = OVL_CURRENT (fns);
- if (TREE_CODE (fn) == TEMPLATE_DECL)
- add_template_candidate (&candidates, fn, NULL_TREE, NULL_TREE,
- arglist, TREE_TYPE (fnname),
- /*access_path=*/NULL_TREE,
- /*conversion_path=*/NULL_TREE,
- flags, DEDUCE_CALL);
- else
- add_function_candidate (&candidates, fn, NULL_TREE,
- arglist,
- /*access_path=*/NULL_TREE,
- /*conversion_path=*/NULL_TREE,
- flags);
- }
+ tree fns;
- if (IS_AGGR_TYPE (TREE_TYPE (arg1)))
- {
fns = lookup_fnfields (TYPE_BINFO (TREE_TYPE (arg1)), fnname, 1);
if (fns == error_mark_node)
return fns;
+ if (fns)
+ add_candidates (BASELINK_FUNCTIONS (fns), arglist,
+ NULL_TREE, false,
+ BASELINK_BINFO (fns),
+ TYPE_BINFO (TREE_TYPE (arg1)),
+ flags, &candidates);
+ }
+
+ /* Rearrange the arguments for ?: so that add_builtin_candidate only has
+ to know about two args; a builtin candidate will always have a first
+ parameter of type bool. We'll handle that in
+ build_builtin_candidate. */
+ if (code == COND_EXPR)
+ {
+ args[0] = arg2;
+ args[1] = arg3;
+ args[2] = arg1;
}
else
- fns = NULL_TREE;
-
- if (fns)
{
- tree conversion_path = BASELINK_BINFO (fns);
-
- mem_arglist = tree_cons (NULL_TREE, build_this (arg1), TREE_CHAIN (arglist));
- for (fns = BASELINK_FUNCTIONS (fns); fns; fns = OVL_NEXT (fns))
- {
- tree fn = OVL_CURRENT (fns);
- tree this_arglist;
- tree access_path = TYPE_BINFO (TREE_TYPE (arg1));
-
- if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
- this_arglist = mem_arglist;
- else
- this_arglist = arglist;
-
- if (TREE_CODE (fn) == TEMPLATE_DECL)
- /* A member template. */
- add_template_candidate (&candidates, fn,
- BINFO_TYPE (conversion_path),
- NULL_TREE,
- this_arglist, TREE_TYPE (fnname),
- access_path, conversion_path,
- flags, DEDUCE_CALL);
- else
- add_function_candidate
- (&candidates, fn, BINFO_TYPE (conversion_path), this_arglist,
- access_path, conversion_path, flags);
- }
+ args[0] = arg1;
+ args[1] = arg2;
+ args[2] = NULL_TREE;
}
- {
- tree args[3];
-
- /* Rearrange the arguments for ?: so that add_builtin_candidate only has
- to know about two args; a builtin candidate will always have a first
- parameter of type bool. We'll handle that in
- build_builtin_candidate. */
- if (code == COND_EXPR)
- {
- args[0] = arg2;
- args[1] = arg3;
- args[2] = arg1;
- }
- else
- {
- args[0] = arg1;
- args[1] = arg2;
- args[2] = NULL_TREE;
- }
-
- add_builtin_candidates (&candidates, code, code2, fnname, args, flags);
- }
+ add_builtin_candidates (&candidates, code, code2, fnname, args, flags);
switch (code)
{
@@ -3686,15 +3493,16 @@ build_new_op (code, flags, arg1, arg2, arg3)
operators. The built-in candidate set for COMPONENT_REF
would be empty too, but since there are no such built-in
operators, we accept non-strict matches for them. */
- viable_candidates = any_strictly_viable (candidates);
+ strict_p = true;
break;
default:
- viable_candidates = any_viable (candidates);
+ strict_p = pedantic;
break;
}
- if (! viable_candidates)
+ candidates = splice_viable (candidates, strict_p, &any_viable_p);
+ if (!any_viable_p)
{
switch (code)
{
@@ -3710,7 +3518,8 @@ build_new_op (code, flags, arg1, arg2, arg3)
code = PREINCREMENT_EXPR;
else
code = PREDECREMENT_EXPR;
- return build_new_op (code, flags, arg1, NULL_TREE, NULL_TREE);
+ return build_new_op (code, flags, arg1, NULL_TREE, NULL_TREE,
+ overloaded_p);
/* The caller will deal with these. */
case ADDR_EXPR:
@@ -3728,9 +3537,8 @@ build_new_op (code, flags, arg1, arg2, arg3)
}
return error_mark_node;
}
- candidates = splice_viable (candidates);
- cand = tourney (candidates);
+ cand = tourney (candidates);
if (cand == 0)
{
if (flags & LOOKUP_COMPLAIN)
@@ -3743,7 +3551,9 @@ build_new_op (code, flags, arg1, arg2, arg3)
if (TREE_CODE (cand->fn) == FUNCTION_DECL)
{
- extern int warn_synth;
+ if (overloaded_p)
+ *overloaded_p = true;
+
if (warn_synth
&& fnname == ansi_assopname (NOP_EXPR)
&& DECL_ARTIFICIAL (cand->fn)
@@ -3758,11 +3568,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
: candidates->fn);
}
- return build_over_call
- (cand,
- TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
- ? mem_arglist : arglist,
- LOOKUP_NORMAL);
+ return build_over_call (cand, LOOKUP_NORMAL);
}
/* Check for comparison of different enum types. */
@@ -3887,21 +3693,17 @@ builtin:
PLACEMENT is the corresponding placement new call, or NULL_TREE. */
tree
-build_op_delete_call (code, addr, size, flags, placement)
- enum tree_code code;
- tree addr, size, placement;
- int flags;
+build_op_delete_call (enum tree_code code, tree addr, tree size,
+ int flags, tree placement)
{
tree fn = NULL_TREE;
- tree fns, fnname, fntype, argtypes, args, type;
+ tree fns, fnname, argtypes, args, type;
int pass;
if (addr == error_mark_node)
return error_mark_node;
- type = TREE_TYPE (TREE_TYPE (addr));
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
+ type = strip_array_types (TREE_TYPE (TREE_TYPE (addr)));
fnname = ansi_opname (code);
@@ -3912,7 +3714,7 @@ build_op_delete_call (code, addr, size, flags, placement)
the lookup selects a placement deallocation function, the
program is ill-formed.
- Therefore, we ask lookup_fnfields to complain ambout ambiguity. */
+ Therefore, we ask lookup_fnfields to complain about ambiguity. */
{
fns = lookup_fnfields (TYPE_BINFO (type), fnname, 1);
if (fns == error_mark_node)
@@ -3931,10 +3733,6 @@ build_op_delete_call (code, addr, size, flags, placement)
/* Find the allocation function that is being called. */
call_expr = placement;
- /* Sometimes we have a COMPOUND_EXPR, rather than a simple
- CALL_EXPR. */
- while (TREE_CODE (call_expr) == COMPOUND_EXPR)
- call_expr = TREE_OPERAND (call_expr, 1);
/* Extract the function. */
alloc_fn = get_callee_fndecl (call_expr);
my_friendly_assert (alloc_fn != NULL_TREE, 20020327);
@@ -3954,21 +3752,11 @@ build_op_delete_call (code, addr, size, flags, placement)
addr = cp_convert (ptr_type_node, addr);
/* We make two tries at finding a matching `operator delete'. On
- the first pass, we look for an one-operator (or placement)
+ the first pass, we look for a 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 (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) ? BASELINK_FUNCTIONS (fns) : fns;
@@ -3977,13 +3765,30 @@ build_op_delete_call (code, addr, size, flags, placement)
{
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))
+ /* The first argument must be "void *". */
+ t = TYPE_ARG_TYPES (TREE_TYPE (OVL_CURRENT (fn)));
+ if (!same_type_p (TREE_VALUE (t), ptr_type_node))
+ continue;
+ t = TREE_CHAIN (t);
+ /* On the first pass, check the rest of the arguments. */
+ if (pass == 0)
+ {
+ tree a = argtypes;
+ while (a && t)
+ {
+ if (!same_type_p (TREE_VALUE (a), TREE_VALUE (t)))
+ break;
+ a = TREE_CHAIN (a);
+ t = TREE_CHAIN (t);
+ }
+ if (!a && !t)
+ break;
+ }
+ /* On the second pass, the second argument must be
+ "size_t". */
+ else if (pass == 1
+ && same_type_p (TREE_VALUE (t), sizetype)
+ && TREE_CHAIN (t) == void_list_node)
break;
}
@@ -4002,7 +3807,7 @@ build_op_delete_call (code, addr, size, flags, placement)
/* If the FN is a member function, make sure that it is
accessible. */
if (DECL_CLASS_SCOPE_P (fn))
- enforce_access (type, fn);
+ perform_or_defer_access_check (TYPE_BINFO (type), fn);
if (pass == 0)
args = tree_cons (NULL_TREE, addr, args);
@@ -4010,7 +3815,15 @@ build_op_delete_call (code, addr, size, flags, placement)
args = tree_cons (NULL_TREE, addr,
build_tree_list (NULL_TREE, size));
- return build_function_call (fn, args);
+ if (placement)
+ {
+ /* The placement args might not be suitable for overload
+ resolution at this point, so build the call directly. */
+ mark_used (fn);
+ return build_cxx_call (fn, args, args);
+ }
+ else
+ return build_function_call (fn, args);
}
/* If we are doing placement delete we do nothing if we don't find a
@@ -4018,7 +3831,8 @@ build_op_delete_call (code, addr, size, flags, placement)
if (placement)
return NULL_TREE;
- error ("no suitable `operator delete' for `%T'", type);
+ error ("no suitable `operator %s' for `%T'",
+ operator_name_info[(int)code].name, type);
return error_mark_node;
}
@@ -4026,15 +3840,12 @@ build_op_delete_call (code, addr, size, flags, placement)
BASETYPE_PATH, give an error. The most derived class in
BASETYPE_PATH is the one used to qualify DECL. */
-int
-enforce_access (basetype_path, decl)
- tree basetype_path;
- tree decl;
+bool
+enforce_access (tree basetype_path, tree decl)
{
- int accessible;
-
- accessible = accessible_p (basetype_path, decl);
- if (!accessible)
+ my_friendly_assert (TREE_CODE (basetype_path) == TREE_VEC, 20030624);
+
+ if (!accessible_p (basetype_path, decl))
{
if (TREE_PRIVATE (decl))
cp_error_at ("`%+#D' is private", decl);
@@ -4043,11 +3854,53 @@ enforce_access (basetype_path, decl)
else
cp_error_at ("`%+#D' is inaccessible", decl);
error ("within this context");
- return 0;
+ return false;
}
- return 1;
+ return true;
+}
+
+/* Check that a callable constructor to initialize a temporary of
+ TYPE from an EXPR exists. */
+
+static void
+check_constructor_callable (tree type, tree expr)
+{
+ build_special_member_call (NULL_TREE,
+ complete_ctor_identifier,
+ build_tree_list (NULL_TREE, expr),
+ TYPE_BINFO (type),
+ LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING
+ | LOOKUP_CONSTRUCTOR_CALLABLE);
+}
+
+/* Initialize a temporary of type TYPE with EXPR. The FLAGS are a
+ bitwise or of LOOKUP_* values. If any errors are warnings are
+ generated, set *DIAGNOSTIC_FN to "error" or "warning",
+ respectively. If no diagnostics are generated, set *DIAGNOSTIC_FN
+ to NULL. */
+
+static tree
+build_temp (tree expr, tree type, int flags,
+ void (**diagnostic_fn)(const char *, ...))
+{
+ int savew, savee;
+
+ savew = warningcount, savee = errorcount;
+ expr = build_special_member_call (NULL_TREE,
+ complete_ctor_identifier,
+ build_tree_list (NULL_TREE, expr),
+ TYPE_BINFO (type),
+ flags);
+ if (warningcount > savew)
+ *diagnostic_fn = warning;
+ else if (errorcount > savee)
+ *diagnostic_fn = error;
+ else
+ *diagnostic_fn = NULL;
+ return expr;
}
+
/* Perform the conversions in CONVS on the expression EXPR. FN and
ARGNUM are used for diagnostics. ARGNUM is zero based, -1
@@ -4061,9 +3914,8 @@ static tree
convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
bool issue_conversion_warnings)
{
- int savew, savee;
-
tree totype = TREE_TYPE (convs);
+ void (*diagnostic_fn)(const char *, ...);
if (ICS_BAD_FLAG (convs)
&& TREE_CODE (convs) != USER_CONV
@@ -4093,7 +3945,7 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
if (issue_conversion_warnings)
expr = dubious_conversion_warnings
- (totype, expr, "argument", fn, argnum);
+ (totype, expr, "converting", fn, argnum);
switch (TREE_CODE (convs))
{
case USER_CONV:
@@ -4117,7 +3969,7 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
}
else
args = build_this (expr);
- expr = build_over_call (cand, args, LOOKUP_NORMAL);
+ expr = build_over_call (cand, LOOKUP_NORMAL);
/* If this is a constructor or a function returning an aggr type,
we need to build up a TARGET_EXPR. */
@@ -4135,35 +3987,24 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
if (IS_AGGR_TYPE (totype)
&& (inner >= 0 || !lvalue_p (expr)))
{
- savew = warningcount, savee = errorcount;
- expr = build_special_member_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)
+ expr = (build_temp
+ (expr, 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,
+ &diagnostic_fn));
+
+ if (diagnostic_fn)
{
- if (warningcount > savew)
- warning
+ if (fn)
+ diagnostic_fn
(" 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);
+ else
+ diagnostic_fn
+ (" initializing temporary from result of `%D'", convfn);
}
expr = build_cplus_new (totype, expr);
}
@@ -4172,6 +4013,15 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
case IDENTITY_CONV:
if (type_unknown_p (expr))
expr = instantiate_type (totype, expr, tf_error | tf_warning);
+ /* 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 (inner >= 0
+ && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
+ expr = decl_constant_value (expr);
+ if (CHECK_COPY_CONSTRUCTOR_P (convs))
+ check_constructor_callable (totype, expr);
+
return expr;
case AMBIG_CONV:
/* Call build_user_type_conversion again for the error. */
@@ -4188,29 +4038,23 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
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 (totype))
return expr;
- /* else fall through */
+ /* 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);
-
+ if (CHECK_COPY_CONSTRUCTOR_P (convs))
+ check_constructor_callable (TREE_TYPE (expr), expr);
/* Build an expression for `*((base*) &expr)'. */
expr = build_unary_op (ADDR_EXPR, expr, 0);
- expr = perform_implicit_conversion (base_ptr, expr);
+ expr = perform_implicit_conversion (build_pointer_type (totype),
+ expr);
expr = build_indirect_ref (expr, "implicit conversion");
return expr;
}
@@ -4218,18 +4062,10 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
/* 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_special_member_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);
- }
+ expr = build_temp (expr, totype, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
+ &diagnostic_fn);
+ if (diagnostic_fn && fn)
+ diagnostic_fn (" initializing argument %P of `%D'", argnum, fn);
return build_cplus_new (totype, expr);
case REF_BIND:
@@ -4237,9 +4073,26 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
tree ref_type = totype;
/* If necessary, create a temporary. */
- if (NEED_TEMPORARY_P (convs) || !non_cast_lvalue_p (expr))
+ if (NEED_TEMPORARY_P (convs) || !lvalue_p (expr))
{
tree type = TREE_TYPE (TREE_OPERAND (convs, 0));
+
+ if (!CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (ref_type)))
+ {
+ /* If the reference is volatile or non-const, we
+ cannot create a temporary. */
+ cp_lvalue_kind lvalue = real_lvalue_p (expr);
+
+ if (lvalue & clk_bitfield)
+ error ("cannot bind bitfield `%E' to `%T'",
+ expr, ref_type);
+ else if (lvalue & clk_packed)
+ error ("cannot bind packed field `%E' to `%T'",
+ expr, ref_type);
+ else
+ error ("cannot bind rvalue `%E' to `%T'", expr, ref_type);
+ return error_mark_node;
+ }
expr = build_target_expr_with_type (expr, type);
}
@@ -4273,50 +4126,60 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
LOOKUP_NORMAL|LOOKUP_NO_CONVERSION);
}
-/* Build a call to __builtin_trap which can be used in an expression. */
+/* Build a call to __builtin_trap. */
static tree
-call_builtin_trap ()
+call_builtin_trap (void)
{
- tree fn = get_identifier ("__builtin_trap");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- abort ();
+ tree fn = IDENTIFIER_GLOBAL_VALUE (get_identifier ("__builtin_trap"));
+ my_friendly_assert (fn != NULL, 20030927);
fn = build_call (fn, NULL_TREE);
- fn = build (COMPOUND_EXPR, integer_type_node, fn, integer_zero_node);
return fn;
}
/* ARG is being passed to a varargs function. Perform any conversions
- required. Array/function to pointer decay must have already happened.
- Return the converted value. */
+ required. Return the converted value. */
tree
-convert_arg_to_ellipsis (arg)
- tree arg;
+convert_arg_to_ellipsis (tree arg)
{
+ /* [expr.call]
+
+ The lvalue-to-rvalue, array-to-pointer, and function-to-pointer
+ standard conversions are performed. */
+ arg = decay_conversion (arg);
+ /* [expr.call]
+
+ If the argument has integral or enumeration type that is subject
+ to the integral promotions (_conv.prom_), or a floating point
+ type that is subject to the floating point promotion
+ (_conv.fpprom_), the value of the argument is converted to the
+ promoted type before the call. */
if (TREE_CODE (TREE_TYPE (arg)) == REAL_TYPE
&& (TYPE_PRECISION (TREE_TYPE (arg))
< TYPE_PRECISION (double_type_node)))
- /* Convert `float' to `double'. */
- arg = cp_convert (double_type_node, arg);
- else
- /* Convert `short' and `char' to full-size `int'. */
- arg = default_conversion (arg);
+ arg = convert_to_real (double_type_node, arg);
+ else if (INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (arg)))
+ arg = perform_integral_promotions (arg);
arg = require_complete_type (arg);
- if (arg != error_mark_node && ! pod_type_p (TREE_TYPE (arg)))
+ if (arg != error_mark_node
+ && !pod_type_p (TREE_TYPE (arg)))
{
/* Undefined behavior [expr.call] 5.2.2/7. We used to just warn
here and do a bitwise copy, but now cp_expr_size will abort if we
- try to do that. */
- warning ("cannot pass objects of non-POD type `%#T' through `...'; \
-call will abort at runtime",
- TREE_TYPE (arg));
+ try to do that.
+ If the call appears in the context of a sizeof expression,
+ there is no need to emit a warning, since the expression won't be
+ evaluated. We keep the builtin_trap just as a safety check. */
+ if (!skip_evaluation)
+ warning ("cannot pass objects of non-POD type `%#T' through `...'; "
+ "call will abort at runtime", TREE_TYPE (arg));
arg = call_builtin_trap ();
+ arg = build (COMPOUND_EXPR, integer_type_node, arg,
+ integer_zero_node);
}
return arg;
@@ -4325,9 +4188,7 @@ call will abort at runtime",
/* va_arg (EXPR, TYPE) is a builtin. Make sure it is not abused. */
tree
-build_x_va_arg (expr, type)
- tree expr;
- tree type;
+build_x_va_arg (tree expr, tree type)
{
if (processing_template_decl)
return build_min (VA_ARG_EXPR, type, expr);
@@ -4340,8 +4201,14 @@ build_x_va_arg (expr, type)
if (! pod_type_p (type))
{
/* Undefined behavior [expr.call] 5.2.2/7. */
- warning ("cannot receive objects of non-POD type `%#T' through `...'",
- type);
+ warning ("cannot receive objects of non-POD type `%#T' through `...'; \
+call will abort at runtime",
+ type);
+ expr = convert (build_pointer_type (type), null_node);
+ expr = build (COMPOUND_EXPR, TREE_TYPE (expr),
+ call_builtin_trap (), expr);
+ expr = build_indirect_ref (expr, NULL);
+ return expr;
}
return build_va_arg (expr, type);
@@ -4352,16 +4219,13 @@ build_x_va_arg (expr, type)
type, or the passed type if there is no change. */
tree
-cxx_type_promotes_to (type)
- tree type;
+cxx_type_promotes_to (tree type)
{
tree promote;
- if (TREE_CODE (type) == ARRAY_TYPE)
- return build_pointer_type (TREE_TYPE (type));
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- return build_pointer_type (type);
+ /* Perform the array-to-pointer and function-to-pointer
+ conversions. */
+ type = type_decays_to (type);
promote = type_promotes_to (type);
if (same_type_p (type, promote))
@@ -4375,30 +4239,16 @@ cxx_type_promotes_to (type)
conversions. Return the converted value. */
tree
-convert_default_arg (type, arg, fn, parmnum)
- tree type;
- tree arg;
- tree fn;
- int parmnum;
+convert_default_arg (tree type, tree arg, tree fn, int parmnum)
{
+ /* If the ARG is an unparsed default argument expression, the
+ conversion cannot be performed. */
if (TREE_CODE (arg) == DEFAULT_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);
+ error ("the default argument for parameter %d of `%D' has "
+ "not yet been parsed",
+ parmnum, fn);
+ return error_mark_node;
}
if (fn && DECL_TEMPLATE_INFO (fn))
@@ -4430,15 +4280,16 @@ convert_default_arg (type, arg, fn, parmnum)
type TYPE. */
tree
-type_passed_as (type)
- tree type;
+type_passed_as (tree type)
{
/* Pass classes with copy ctors by invisible reference. */
if (TREE_ADDRESSABLE (type))
type = build_reference_type (type);
else if (PROMOTE_PROTOTYPES
&& INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
+ && COMPLETE_TYPE_P (type)
+ && INT_CST_LT_UNSIGNED (TYPE_SIZE (type),
+ TYPE_SIZE (integer_type_node)))
type = integer_type_node;
return type;
@@ -4447,8 +4298,7 @@ type_passed_as (type)
/* Actually perform the appropriate conversion. */
tree
-convert_for_arg_passing (type, val)
- tree type, val;
+convert_for_arg_passing (tree type, tree val)
{
if (val == error_mark_node)
;
@@ -4457,23 +4307,46 @@ convert_for_arg_passing (type, val)
val = build1 (ADDR_EXPR, build_reference_type (type), val);
else if (PROMOTE_PROTOTYPES
&& INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
- val = default_conversion (val);
+ && COMPLETE_TYPE_P (type)
+ && INT_CST_LT_UNSIGNED (TYPE_SIZE (type),
+ TYPE_SIZE (integer_type_node)))
+ val = perform_integral_promotions (val);
return val;
}
+/* Returns true iff FN is a function with magic varargs, i.e. ones for
+ which no conversions at all should be done. This is true for some
+ builtins which don't act like normal functions. */
+
+static bool
+magic_varargs_p (tree fn)
+{
+ if (DECL_BUILT_IN (fn))
+ switch (DECL_FUNCTION_CODE (fn))
+ {
+ case BUILT_IN_CLASSIFY_TYPE:
+ case BUILT_IN_CONSTANT_P:
+ case BUILT_IN_NEXT_ARG:
+ case BUILT_IN_STDARG_START:
+ case BUILT_IN_VA_START:
+ return true;
+
+ default:;
+ }
+
+ return false;
+}
+
/* 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;
- tree args;
- int flags;
+build_over_call (struct z_candidate *cand, int flags)
{
tree fn = cand->fn;
+ tree args = cand->args;
tree convs = cand->convs;
tree converted_args = NULL_TREE;
tree parm = TYPE_ARG_TYPES (TREE_TYPE (fn));
@@ -4481,13 +4354,62 @@ build_over_call (cand, args, flags)
int i = 0;
int is_method = 0;
+ /* In a template, there is no need to perform all of the work that
+ is normally done. We are only interested in the type of the call
+ expression, i.e., the return type of the function. Any semantic
+ errors will be deferred until the template is instantiated. */
+ if (processing_template_decl)
+ {
+ tree expr;
+ tree return_type;
+ return_type = TREE_TYPE (TREE_TYPE (fn));
+ expr = build (CALL_EXPR, return_type, fn, args);
+ if (TREE_THIS_VOLATILE (fn) && cfun)
+ current_function_returns_abnormally = 1;
+ if (!VOID_TYPE_P (return_type))
+ require_complete_type (return_type);
+ return convert_from_reference (expr);
+ }
+
/* Give any warnings we noticed during overload resolution. */
if (cand->warnings)
for (val = cand->warnings; val; val = TREE_CHAIN (val))
joust (cand, WRAPPER_ZC (TREE_VALUE (val)), 1);
if (DECL_FUNCTION_MEMBER_P (fn))
- enforce_access (cand->access_path, fn);
+ {
+ /* If FN is a template function, two cases must be considered.
+ For example:
+
+ struct A {
+ protected:
+ template <class T> void f();
+ };
+ template <class T> struct B {
+ protected:
+ void g();
+ };
+ struct C : A, B<int> {
+ using A::f; // #1
+ using B<int>::g; // #2
+ };
+
+ In case #1 where `A::f' is a member template, DECL_ACCESS is
+ recorded in the primary template but not in its specialization.
+ We check access of FN using its primary template.
+
+ In case #2, where `B<int>::g' has a DECL_TEMPLATE_INFO simply
+ because it is a member of class template B, DECL_ACCESS is
+ recorded in the specialization `B<int>::g'. We cannot use its
+ primary template because `B<T>::g' and `B<int>::g' may have
+ different access. */
+ if (DECL_TEMPLATE_INFO (fn)
+ && is_member_template (DECL_TI_TEMPLATE (fn)))
+ perform_or_defer_access_check (cand->access_path,
+ DECL_TI_TEMPLATE (fn));
+ else
+ perform_or_defer_access_check (cand->access_path, fn);
+ }
if (args && TREE_CODE (args) != TREE_LIST)
args = build_tree_list (NULL_TREE, args);
@@ -4581,10 +4503,14 @@ build_over_call (cand, args, flags)
/* Ellipsis */
for (; arg; arg = TREE_CHAIN (arg))
- converted_args
- = tree_cons (NULL_TREE,
- convert_arg_to_ellipsis (TREE_VALUE (arg)),
- converted_args);
+ {
+ tree a = TREE_VALUE (arg);
+ if (magic_varargs_p (fn))
+ /* Do no conversions for magic varargs. */;
+ else
+ a = convert_arg_to_ellipsis (a);
+ converted_args = tree_cons (NULL_TREE, a, converted_args);
+ }
converted_args = nreverse (converted_args);
@@ -4645,16 +4571,11 @@ build_over_call (cand, args, flags)
else if (TREE_CODE (arg) == TARGET_EXPR
|| TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
{
- tree address;
tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (args), 0));
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. */
- TREE_USED (address) = 1;
- return address;
+ return val;
}
}
else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR
@@ -4663,9 +4584,36 @@ build_over_call (cand, args, flags)
{
tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (converted_args), 0));
+ tree type = TREE_TYPE (to);
+ tree as_base = CLASSTYPE_AS_BASE (type);
arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
- val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
+ if (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (as_base)))
+ val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
+ else
+ {
+ /* We must only copy the non-tail padding parts. Use
+ CLASSTYPE_AS_BASE for the bitwise copy. */
+ tree to_ptr, arg_ptr, to_as_base, arg_as_base, base_ptr_type;
+ tree save_to;
+
+ to_ptr = save_expr (build_unary_op (ADDR_EXPR, to, 0));
+ arg_ptr = build_unary_op (ADDR_EXPR, arg, 0);
+
+ base_ptr_type = build_pointer_type (as_base);
+ to_as_base = build_nop (base_ptr_type, to_ptr);
+ to_as_base = build_indirect_ref (to_as_base, 0);
+ arg_as_base = build_nop (base_ptr_type, arg_ptr);
+ arg_as_base = build_indirect_ref (arg_as_base, 0);
+
+ save_to = build_indirect_ref (to_ptr, 0);
+
+ val = build (MODIFY_EXPR, as_base, to_as_base, arg_as_base);
+ val = convert_to_void (val, NULL);
+ val = build (COMPOUND_EXPR, type, val, save_to);
+ TREE_NO_UNUSED_WARNING (val) = 1;
+ }
+
return val;
}
@@ -4752,8 +4700,7 @@ static GTY(()) tree java_iface_lookup_fn;
_Jv_LookupInterfaceMethodIdx(). */
static tree
-build_java_interface_fn_ref (fn, instance)
- tree fn, instance;
+build_java_interface_fn_ref (tree fn, tree instance)
{
tree lookup_args, lookup_fn, method, idx;
tree klass_ref, iface, iface_ref;
@@ -4779,7 +4726,7 @@ build_java_interface_fn_ref (fn, instance)
/* 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);
+ iface_ref = lookup_field (iface, get_identifier ("class$"), 0, false);
if (!iface_ref || TREE_CODE (iface_ref) != VAR_DECL
|| DECL_CONTEXT (iface_ref) != iface)
{
@@ -4814,8 +4761,7 @@ build_java_interface_fn_ref (fn, instance)
call to a function with the indicated NAME. */
tree
-in_charge_arg_for_name (name)
- tree name;
+in_charge_arg_for_name (tree name)
{
if (name == base_ctor_identifier
|| name == base_dtor_identifier)
@@ -4878,14 +4824,23 @@ build_special_member_call (tree instance, tree name, tree args,
|| name == deleting_dtor_identifier)
my_friendly_assert (args == NULL_TREE, 20020712);
- /* We must perform the conversion here so that we do not
- subsequently check to see whether BINFO is an accessible
- base. (It is OK for a constructor to call a constructor in
- an inaccessible base as long as the constructor being called
- is accessible.) */
+ /* Convert to the base class, if necessary. */
if (!same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (instance), BINFO_TYPE (binfo)))
- instance = convert_to_base_statically (instance, binfo);
+ {
+ if (name != ansi_assopname (NOP_EXPR))
+ /* For constructors and destructors, either the base is
+ non-virtual, or it is virtual but we are doing the
+ conversion from a constructor or destructor for the
+ complete object. In either case, we can convert
+ statically. */
+ instance = convert_to_base_statically (instance, binfo);
+ else
+ /* However, for assignment operators, we must convert
+ dynamically if the base is virtual. */
+ instance = build_base_path (PLUS_EXPR, instance,
+ binfo, /*nonnull=*/1);
+ }
}
my_friendly_assert (instance != NULL_TREE, 20020712);
@@ -4916,8 +4871,6 @@ build_special_member_call (tree instance, tree name, tree args,
current_in_charge_parm, integer_zero_node),
current_vtt_parm,
vtt);
- if (TREE_VIA_VIRTUAL (binfo))
- binfo = binfo_for_vbase (class_type, current_class_type);
my_friendly_assert (BINFO_SUBVTT_INDEX (binfo), 20010110);
sub_vtt = build (PLUS_EXPR, TREE_TYPE (vtt), vtt,
BINFO_SUBVTT_INDEX (binfo));
@@ -4930,6 +4883,51 @@ build_special_member_call (tree instance, tree name, tree args,
flags);
}
+/* Return the NAME, as a C string. The NAME indicates a function that
+ is a member of TYPE. *FREE_P is set to true if the caller must
+ free the memory returned.
+
+ Rather than go through all of this, we should simply set the names
+ of constructors and destructors appropriately, and dispense with
+ ctor_identifier, dtor_identifier, etc. */
+
+static char *
+name_as_c_string (tree name, tree type, bool *free_p)
+{
+ char *pretty_name;
+
+ /* Assume that we will not allocate memory. */
+ *free_p = false;
+ /* Constructors and destructors are special. */
+ if (IDENTIFIER_CTOR_OR_DTOR_P (name))
+ {
+ pretty_name
+ = (char *) IDENTIFIER_POINTER (constructor_name (type));
+ /* For a destructor, add the '~'. */
+ if (name == complete_dtor_identifier
+ || name == base_dtor_identifier
+ || name == deleting_dtor_identifier)
+ {
+ pretty_name = concat ("~", pretty_name, NULL);
+ /* Remember that we need to free the memory allocated. */
+ *free_p = true;
+ }
+ }
+ else if (IDENTIFIER_TYPENAME_P (name))
+ {
+ pretty_name = concat ("operator ",
+ type_as_string (TREE_TYPE (name),
+ TFF_PLAIN_IDENTIFIER),
+ NULL);
+ /* Remember that we need to free the memory allocated. */
+ *free_p = true;
+ }
+ else
+ pretty_name = (char *) IDENTIFIER_POINTER (name);
+
+ return pretty_name;
+}
+
/* Build a call to "INSTANCE.FN (ARGS)". */
tree
@@ -4942,25 +4940,44 @@ build_new_method_call (tree instance, tree fns, tree args,
tree access_binfo;
tree optype;
tree mem_args = NULL_TREE, instance_ptr;
- tree name, pretty_name;
+ tree name;
tree user_args;
tree call;
+ tree fn;
+ tree class_type;
int template_only = 0;
+ bool any_viable_p;
+ tree orig_instance;
+ tree orig_fns;
+ tree orig_args;
my_friendly_assert (instance != NULL_TREE, 20020729);
- if (instance == error_mark_node || fns == error_mark_node
+ if (error_operand_p (instance)
+ || error_operand_p (fns)
|| args == error_mark_node)
return error_mark_node;
+ orig_instance = instance;
+ orig_fns = fns;
+ orig_args = args;
+
+ if (processing_template_decl)
+ {
+ instance = build_non_dependent_expr (instance);
+ if (!BASELINK_P (fns)
+ && TREE_CODE (fns) != PSEUDO_DTOR_EXPR
+ && TREE_TYPE (fns) != unknown_type_node)
+ fns = build_non_dependent_expr (fns);
+ args = build_non_dependent_args (orig_args);
+ }
+
/* Process the argument list. */
user_args = args;
args = resolve_args (args);
if (args == error_mark_node)
return error_mark_node;
- if (TREE_CODE (instance) == OFFSET_REF)
- instance = resolve_offset_ref (instance);
if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
instance = convert_from_reference (instance);
basetype = TYPE_MAIN_VARIANT (TREE_TYPE (instance));
@@ -4968,9 +4985,6 @@ build_new_method_call (tree instance, tree fns, tree args,
if (!BASELINK_P (fns))
{
- call = build_field_call (instance_ptr, fns, args);
- if (call)
- return call;
error ("call to non-function `%D'", fns);
return error_mark_node;
}
@@ -5003,7 +5017,8 @@ build_new_method_call (tree instance, tree fns, tree args,
return error_mark_node;
}
- name = DECL_NAME (get_first_fn (fns));
+ fn = get_first_fn (fns);
+ name = DECL_NAME (fn);
if (IDENTIFIER_CTOR_OR_DTOR_P (name))
{
@@ -5012,60 +5027,56 @@ build_new_method_call (tree instance, tree fns, tree args,
my_friendly_assert (name != ctor_identifier, 20000408);
/* Similarly for destructors. */
my_friendly_assert (name != dtor_identifier, 20000408);
-
- if (name == complete_ctor_identifier
- || name == base_ctor_identifier)
- pretty_name = constructor_name (basetype);
- else
- pretty_name = dtor_identifier;
}
- else
- pretty_name = name;
- if (fns)
+ /* It's OK to call destructors on cv-qualified objects. Therefore,
+ convert the INSTANCE_PTR to the unqualified type, if necessary. */
+ if (DECL_DESTRUCTOR_P (fn))
{
- tree fn;
- tree class_type = (conversion_path
- ? BINFO_TYPE (conversion_path)
- : NULL_TREE);
+ tree type = build_pointer_type (basetype);
+ if (!same_type_p (type, TREE_TYPE (instance_ptr)))
+ instance_ptr = build_nop (type, instance_ptr);
+ }
- mem_args = tree_cons (NULL_TREE, instance_ptr, args);
- for (fn = fns; fn; fn = OVL_NEXT (fn))
- {
- tree t = OVL_CURRENT (fn);
- tree this_arglist;
+ class_type = (conversion_path ? BINFO_TYPE (conversion_path) : NULL_TREE);
+ mem_args = tree_cons (NULL_TREE, instance_ptr, args);
- /* We can end up here for copy-init of same or base class. */
- if ((flags & LOOKUP_ONLYCONVERTING)
- && DECL_NONCONVERTING_P (t))
- continue;
+ for (fn = fns; fn; fn = OVL_NEXT (fn))
+ {
+ tree t = OVL_CURRENT (fn);
+ tree this_arglist;
- if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
- this_arglist = mem_args;
- else
- this_arglist = args;
-
- if (TREE_CODE (t) == TEMPLATE_DECL)
- /* A member template. */
- add_template_candidate (&candidates, t,
- class_type,
- explicit_targs,
- this_arglist, optype,
- access_binfo,
- conversion_path,
- flags,
- DEDUCE_CALL);
- else if (! template_only)
- add_function_candidate (&candidates, t,
- class_type,
- this_arglist,
- access_binfo,
- conversion_path,
- flags);
- }
+ /* We can end up here for copy-init of same or base class. */
+ if ((flags & LOOKUP_ONLYCONVERTING)
+ && DECL_NONCONVERTING_P (t))
+ continue;
+
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
+ this_arglist = mem_args;
+ else
+ this_arglist = args;
+
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ /* A member template. */
+ add_template_candidate (&candidates, t,
+ class_type,
+ explicit_targs,
+ this_arglist, optype,
+ access_binfo,
+ conversion_path,
+ flags,
+ DEDUCE_CALL);
+ else if (! template_only)
+ add_function_candidate (&candidates, t,
+ class_type,
+ this_arglist,
+ access_binfo,
+ conversion_path,
+ flags);
}
- if (! any_viable (candidates))
+ candidates = splice_viable (candidates, pedantic, &any_viable_p);
+ if (!any_viable_p)
{
/* XXX will LOOKUP_SPECULATIVELY be needed when this is done? */
if (flags & LOOKUP_SPECULATIVELY)
@@ -5073,20 +5084,33 @@ build_new_method_call (tree instance, tree fns, tree args,
if (!COMPLETE_TYPE_P (basetype))
cxx_incomplete_type_error (instance_ptr, basetype);
else
- error ("no matching function for call to `%T::%D(%A)%#V'",
- basetype, pretty_name, user_args,
- TREE_TYPE (TREE_TYPE (instance_ptr)));
+ {
+ char *pretty_name;
+ bool free_p;
+
+ pretty_name = name_as_c_string (name, basetype, &free_p);
+ error ("no matching function for call to `%T::%s(%A)%#V'",
+ basetype, pretty_name, user_args,
+ TREE_TYPE (TREE_TYPE (instance_ptr)));
+ if (free_p)
+ free (pretty_name);
+ }
print_z_candidates (candidates);
return error_mark_node;
}
- candidates = splice_viable (candidates);
- cand = tourney (candidates);
+ cand = tourney (candidates);
if (cand == 0)
{
- error ("call of overloaded `%D(%A)' is ambiguous", pretty_name,
- user_args);
+ char *pretty_name;
+ bool free_p;
+
+ pretty_name = name_as_c_string (name, basetype, &free_p);
+ error ("call of overloaded `%s(%A)' is ambiguous", pretty_name,
+ user_args);
print_z_candidates (candidates);
+ if (free_p)
+ free (pretty_name);
return error_mark_node;
}
@@ -5112,25 +5136,29 @@ build_new_method_call (tree instance, tree fns, tree args,
flags |= LOOKUP_NONVIRTUAL;
if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE)
- call = build_over_call (cand, mem_args, flags);
+ call = build_over_call (cand, flags);
else
{
- call = build_over_call (cand, args, flags);
+ call = build_over_call (cand, flags);
/* In an expression of the form `a->f()' where `f' turns out to
be a static member function, `a' is none-the-less evaluated. */
- if (instance && TREE_SIDE_EFFECTS (instance))
+ if (!is_dummy_object (instance_ptr) && TREE_SIDE_EFFECTS (instance))
call = build (COMPOUND_EXPR, TREE_TYPE (call), instance, call);
}
-
+
+ if (processing_template_decl && call != error_mark_node)
+ return build_min_non_dep
+ (CALL_EXPR, call,
+ build_min_nt (COMPONENT_REF, orig_instance, orig_fns),
+ orig_args);
return call;
}
-/* Returns nonzero iff standard conversion sequence ICS1 is a proper
+/* Returns true iff standard conversion sequence ICS1 is a proper
subsequence of ICS2. */
-static int
-is_subseq (ics1, ics2)
- tree ics1, ics2;
+static bool
+is_subseq (tree ics1, tree ics2)
{
/* We can assume that a conversion of the same code
between the same types indicates a subsequence since we only get
@@ -5153,7 +5181,7 @@ is_subseq (ics1, ics2)
ICS2. We can get a USER_CONV when we are comparing the
second standard conversion sequence of two user conversion
sequences. */
- return 0;
+ return false;
ics2 = TREE_OPERAND (ics2, 0);
@@ -5161,21 +5189,19 @@ is_subseq (ics1, ics2)
&& same_type_p (TREE_TYPE (ics2), TREE_TYPE (ics1))
&& same_type_p (TREE_TYPE (TREE_OPERAND (ics2, 0)),
TREE_TYPE (TREE_OPERAND (ics1, 0))))
- return 1;
+ return true;
}
}
/* Returns nonzero iff DERIVED is derived from BASE. The inputs may
be any _TYPE nodes. */
-int
-is_properly_derived_from (derived, base)
- tree derived;
- tree base;
+bool
+is_properly_derived_from (tree derived, tree base)
{
if (!IS_AGGR_TYPE_CODE (TREE_CODE (derived))
|| !IS_AGGR_TYPE_CODE (TREE_CODE (base)))
- return 0;
+ return false;
/* We only allow proper derivation here. The DERIVED_FROM_P macro
considers every class derived from itself. */
@@ -5190,8 +5216,7 @@ is_properly_derived_from (derived, base)
modify it accordingly. */
static void
-maybe_handle_implicit_object (ics)
- tree* ics;
+maybe_handle_implicit_object (tree *ics)
{
if (ICS_THIS_FLAG (*ics))
{
@@ -5206,7 +5231,7 @@ maybe_handle_implicit_object (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
+ implicit conversion talk about a reference to that same class
type. */
reference_type = TREE_TYPE (TREE_TYPE (*ics));
reference_type = build_reference_type (reference_type);
@@ -5226,8 +5251,7 @@ maybe_handle_implicit_object (ics)
leave *ICS unchanged and return NULL_TREE. */
static tree
-maybe_handle_ref_bind (ics)
- tree* ics;
+maybe_handle_ref_bind (tree *ics)
{
if (TREE_CODE (*ics) == REF_BIND)
{
@@ -5250,8 +5274,7 @@ maybe_handle_ref_bind (ics)
0: ics1 and ics2 are indistinguishable */
static int
-compare_ics (ics1, ics2)
- tree ics1, ics2;
+compare_ics (tree ics1, tree ics2)
{
tree from_type1;
tree from_type2;
@@ -5301,7 +5324,7 @@ compare_ics (ics1, ics2)
{
/* 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. */
+ would have happened if they'd been good. */
if (ICS_USER_FLAG (ics1) > ICS_USER_FLAG (ics2)
|| ICS_STD_RANK (ics1) > ICS_STD_RANK (ics2))
return -1;
@@ -5421,25 +5444,17 @@ compare_ics (ics1, ics2)
for pointers A*, except opposite: if B is derived from A then
A::* converts to B::*, not vice versa. For that reason, we
switch the from_ and to_ variables here. */
- else if (TYPE_PTRMEM_P (from_type1)
- && TYPE_PTRMEM_P (from_type2)
- && TYPE_PTRMEM_P (to_type1)
- && TYPE_PTRMEM_P (to_type2))
+ else if ((TYPE_PTRMEM_P (from_type1) && TYPE_PTRMEM_P (from_type2)
+ && TYPE_PTRMEM_P (to_type1) && TYPE_PTRMEM_P (to_type2))
+ || (TYPE_PTRMEMFUNC_P (from_type1)
+ && TYPE_PTRMEMFUNC_P (from_type2)
+ && TYPE_PTRMEMFUNC_P (to_type1)
+ && TYPE_PTRMEMFUNC_P (to_type2)))
{
- deref_to_type1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (from_type1));
- deref_to_type2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (from_type2));
- deref_from_type1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (to_type1));
- deref_from_type2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (to_type2));
- }
- else if (TYPE_PTRMEMFUNC_P (from_type1)
- && TYPE_PTRMEMFUNC_P (from_type2)
- && TYPE_PTRMEMFUNC_P (to_type1)
- && TYPE_PTRMEMFUNC_P (to_type2))
- {
- deref_to_type1 = TYPE_PTRMEMFUNC_OBJECT_TYPE (from_type1);
- deref_to_type2 = TYPE_PTRMEMFUNC_OBJECT_TYPE (from_type2);
- deref_from_type1 = TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type1);
- deref_from_type2 = TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type2);
+ deref_to_type1 = TYPE_PTRMEM_CLASS_TYPE (from_type1);
+ deref_to_type2 = TYPE_PTRMEM_CLASS_TYPE (from_type2);
+ deref_from_type1 = TYPE_PTRMEM_CLASS_TYPE (to_type1);
+ deref_from_type2 = TYPE_PTRMEM_CLASS_TYPE (to_type2);
}
if (deref_from_type1 != NULL_TREE
@@ -5587,8 +5602,7 @@ compare_ics (ics1, ics2)
/* The source type for this standard conversion sequence. */
static tree
-source_type (t)
- tree t;
+source_type (tree t)
{
for (;; t = TREE_OPERAND (t, 0))
{
@@ -5605,8 +5619,7 @@ source_type (t)
is actually used. */
static void
-add_warning (winner, loser)
- struct z_candidate *winner, *loser;
+add_warning (struct z_candidate *winner, struct z_candidate *loser)
{
winner->warnings = tree_cons (NULL_TREE,
build_zc_wrapper (loser),
@@ -5621,9 +5634,7 @@ add_warning (winner, loser)
0: cand1 and cand2 are indistinguishable */
static int
-joust (cand1, cand2, warn)
- struct z_candidate *cand1, *cand2;
- int warn;
+joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
{
int winner = 0;
int i, off1 = 0, off2 = 0, len;
@@ -5721,45 +5732,52 @@ joust (cand1, cand2, warn)
/* warn about confusing overload resolution for user-defined conversions,
either between a constructor and a conversion op, or between two
conversion ops. */
- if (winner && cand1->second_conv
- && ((DECL_CONSTRUCTOR_P (cand1->fn)
- != DECL_CONSTRUCTOR_P (cand2->fn))
- /* Don't warn if the two conv ops convert to the same type... */
- || (! DECL_CONSTRUCTOR_P (cand1->fn)
- && ! same_type_p (TREE_TYPE (TREE_TYPE (cand1->fn)),
- TREE_TYPE (TREE_TYPE (cand2->fn))))))
- {
- int comp = compare_ics (cand1->second_conv, cand2->second_conv);
- if (comp != winner)
+ if (winner && warn_conversion && cand1->second_conv
+ && (!DECL_CONSTRUCTOR_P (cand1->fn) || !DECL_CONSTRUCTOR_P (cand2->fn))
+ && winner != compare_ics (cand1->second_conv, cand2->second_conv))
+ {
+ struct z_candidate *w, *l;
+ bool give_warning = false;
+
+ if (winner == 1)
+ w = cand1, l = cand2;
+ else
+ w = cand2, l = cand1;
+
+ /* We don't want to complain about `X::operator T1 ()'
+ beating `X::operator T2 () const', when T2 is a no less
+ cv-qualified version of T1. */
+ if (DECL_CONTEXT (w->fn) == DECL_CONTEXT (l->fn)
+ && !DECL_CONSTRUCTOR_P (w->fn) && !DECL_CONSTRUCTOR_P (l->fn))
{
- struct z_candidate *w, *l;
- tree convn;
- if (winner == 1)
- w = cand1, l = cand2;
- else
- w = cand2, l = cand1;
- 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 && warn_conversion)
+ tree t = TREE_TYPE (TREE_TYPE (l->fn));
+ tree f = TREE_TYPE (TREE_TYPE (w->fn));
+
+ if (TREE_CODE (t) == TREE_CODE (f) && POINTER_TYPE_P (t))
{
- tree source = source_type (TREE_VEC_ELT (w->convs, 0));
- if (! DECL_CONSTRUCTOR_P (w->fn))
- source = TREE_TYPE (source);
- warning ("choosing `%D' over `%D'", w->fn, l->fn);
- warning (" for conversion from `%T' to `%T'",
- source, TREE_TYPE (w->second_conv));
- warning (" because conversion sequence for the argument is better");
+ t = TREE_TYPE (t);
+ f = TREE_TYPE (f);
}
- else
- add_warning (w, l);
+ if (!comp_ptr_ttypes (t, f))
+ give_warning = true;
}
+ else
+ give_warning = true;
+
+ if (!give_warning)
+ /*NOP*/;
+ else if (warn)
+ {
+ tree source = source_type (TREE_VEC_ELT (w->convs, 0));
+ if (! DECL_CONSTRUCTOR_P (w->fn))
+ source = TREE_TYPE (source);
+ warning ("choosing `%D' over `%D'", w->fn, l->fn);
+ warning (" for conversion from `%T' to `%T'",
+ source, TREE_TYPE (w->second_conv));
+ warning (" because conversion sequence for the argument is better");
+ }
+ else
+ add_warning (w, l);
}
if (winner)
@@ -5795,7 +5813,6 @@ joust (cand1, cand2, warn)
TREE_VEC_LENGTH (cand1->convs)
- (DECL_NONSTATIC_MEMBER_FUNCTION_P (cand1->fn)
- DECL_CONSTRUCTOR_P (cand1->fn)));
- /* HERE */
if (winner)
return winner;
}
@@ -5852,7 +5869,7 @@ joust (cand1, cand2, warn)
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
@@ -5876,9 +5893,14 @@ tweak:
if (winner)
{
if (warn)
- pedwarn ("ISO C++ says that `%D' and `%D' are ambiguous \
-even though the worst conversion for the former is better than the worst \
-conversion for the latter", w->fn, l->fn);
+ {
+ pedwarn ("\
+ISO C++ says that these are ambiguous, even \
+though the worst conversion for the first is better than \
+the worst conversion for the second:");
+ print_z_candidate (_("candidate 1:"), w);
+ print_z_candidate (_("candidate 2:"), l);
+ }
else
add_warning (w, l);
return winner;
@@ -5895,8 +5917,7 @@ conversion for the latter", w->fn, l->fn);
algorithm. */
static struct z_candidate *
-tourney (candidates)
- struct z_candidate *candidates;
+tourney (struct z_candidate *candidates)
{
struct z_candidate *champ = candidates, *challenger;
int fate;
@@ -5947,18 +5968,16 @@ tourney (candidates)
/* Returns nonzero if things of type FROM can be converted to TO. */
-int
-can_convert (to, from)
- tree to, from;
+bool
+can_convert (tree to, tree from)
{
return can_convert_arg (to, from, NULL_TREE);
}
/* Returns nonzero if ARG (of type FROM) can be converted to TO. */
-int
-can_convert_arg (to, from, arg)
- tree to, from, arg;
+bool
+can_convert_arg (tree to, tree from, tree arg)
{
tree t = implicit_conversion (to, from, arg, LOOKUP_NORMAL);
return (t && ! ICS_BAD_FLAG (t));
@@ -5966,12 +5985,10 @@ can_convert_arg (to, from, arg)
/* Like can_convert_arg, but allows dubious conversions as well. */
-int
-can_convert_arg_bad (to, from, arg)
- tree to, from, arg;
+bool
+can_convert_arg_bad (tree to, tree from, tree arg)
{
- tree t = implicit_conversion (to, from, arg, LOOKUP_NORMAL);
- return !!t;
+ return implicit_conversion (to, from, arg, LOOKUP_NORMAL) != 0;
}
/* Convert EXPR to TYPE. Return the converted expression.
@@ -5981,13 +5998,11 @@ can_convert_arg_bad (to, from, arg)
doing a bad conversion, convert_like will complain. */
tree
-perform_implicit_conversion (type, expr)
- tree type;
- tree expr;
+perform_implicit_conversion (tree type, tree expr)
{
tree conv;
- if (expr == error_mark_node)
+ if (error_operand_p (expr))
return error_mark_node;
conv = implicit_conversion (type, TREE_TYPE (expr), expr,
LOOKUP_NORMAL);
@@ -6074,23 +6089,19 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type)
return var;
}
- /* Convert EXPR to the indicated reference TYPE, in a way suitable
- for initializing a variable of that TYPE. If DECL is non-NULL,
- it is the VAR_DECL being initialized with the EXPR. (In that
- case, the type of DECL will be TYPE.) If DECL is non-NULL, then
- CLEANUP must also be non-NULL, and with *CLEANUP initialized to
- NULL. Upon return, if *CLEANUP is no longer NULL, it will be a
- CLEANUP_STMT that should be inserted after the returned
- expression is used to initialize DECL.
+/* Convert EXPR to the indicated reference TYPE, in a way suitable for
+ initializing a variable of that TYPE. If DECL is non-NULL, it is
+ the VAR_DECL being initialized with the EXPR. (In that case, the
+ type of DECL will be TYPE.) If DECL is non-NULL, then CLEANUP must
+ also be non-NULL, and with *CLEANUP initialized to NULL. Upon
+ return, if *CLEANUP is no longer NULL, it will be a CLEANUP_STMT
+ that should be inserted after the returned expression is used to
+ initialize DECL.
- Return the converted expression. */
+ Return the converted expression. */
tree
-initialize_reference (type, expr, decl, cleanup)
- tree type;
- tree expr;
- tree decl;
- tree *cleanup;
+initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
{
tree conv;
@@ -6158,14 +6169,19 @@ initialize_reference (type, expr, decl, cleanup)
remember that the conversion was required. */
if (TREE_CODE (conv) == BASE_CONV && !NEED_TEMPORARY_P (conv))
{
+ if (CHECK_COPY_CONSTRUCTOR_P (conv))
+ check_constructor_callable (TREE_TYPE (expr), expr);
base_conv_type = TREE_TYPE (conv);
conv = TREE_OPERAND (conv, 0);
}
else
base_conv_type = NULL_TREE;
/* Perform the remainder of the conversion. */
- expr = convert_like (conv, expr);
- if (!real_non_cast_lvalue_p (expr))
+ expr = convert_like_real (conv, expr,
+ /*fn=*/NULL_TREE, /*argnum=*/0,
+ /*inner=*/-1,
+ /*issue_conversion_warnings=*/true);
+ if (!real_lvalue_p (expr))
{
tree init;
tree type;
@@ -6174,6 +6190,16 @@ initialize_reference (type, expr, decl, cleanup)
type = TREE_TYPE (expr);
var = make_temporary_var_for_ref_to_temp (decl, type);
layout_decl (var, 0);
+ /* If the rvalue is the result of a function call it will be
+ a TARGET_EXPR. If it is some other construct (such as a
+ member access expression where the underlying object is
+ itself the result of a function call), turn it into a
+ TARGET_EXPR here. It is important that EXPR be a
+ TARGET_EXPR below since otherwise the INIT_EXPR will
+ attempt to make a bitwise copy of EXPR to intialize
+ VAR. */
+ if (TREE_CODE (expr) != TARGET_EXPR)
+ expr = get_target_expr (expr);
/* Create the INIT_EXPR that will initialize the temporary
variable. */
init = build (INIT_EXPR, type, var, expr);
diff --git a/contrib/gcc/cp/cfns.gperf b/contrib/gcc/cp/cfns.gperf
index e0e9f23..c713eb0 100644
--- a/contrib/gcc/cp/cfns.gperf
+++ b/contrib/gcc/cp/cfns.gperf
@@ -2,12 +2,13 @@
#ifdef __GNUC__
__inline
#endif
-static unsigned int hash PARAMS ((const char *, unsigned int));
+static unsigned int hash (const char *, unsigned int);
#ifdef __GNUC__
__inline
#endif
-const char * libc_name_p PARAMS ((const char *, unsigned int));
+const char * libc_name_p (const char *, unsigned int);
%}
+%%
# The standard C library functions, for feeding to gperf; the result is used
# by nothrow_libfn_p.
#
diff --git a/contrib/gcc/cp/class.c b/contrib/gcc/cp/class.c
index f6e0396..9fa7f26 100644
--- a/contrib/gcc/cp/class.c
+++ b/contrib/gcc/cp/class.c
@@ -1,22 +1,22 @@
/* Functions related to building classes and their related objects.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -25,15 +25,17 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "flags.h"
#include "rtl.h"
#include "output.h"
#include "toplev.h"
-#include "ggc.h"
#include "lex.h"
#include "target.h"
+#include "convert.h"
/* The number of nested classes being processed. If we are not in the
scope of any class, this is zero. */
@@ -93,9 +95,9 @@ typedef struct vtbl_init_data_s
} vtbl_init_data;
/* The type of a function passed to walk_subobject_offsets. */
-typedef int (*subobject_offset_fn) PARAMS ((tree, tree, splay_tree));
+typedef int (*subobject_offset_fn) (tree, tree, splay_tree);
-/* The stack itself. This is an dynamically resized array. The
+/* The stack itself. This is a 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;
@@ -104,113 +106,105 @@ static class_stack_node_t current_class_stack;
declaration order. */
varray_type local_classes;
-static tree get_vfield_name PARAMS ((tree));
-static void finish_struct_anon PARAMS ((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 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 void check_for_override PARAMS ((tree, tree));
-static tree dfs_modify_vtables PARAMS ((tree, void *));
-static tree modify_all_vtables PARAMS ((tree, tree));
-static void determine_primary_base PARAMS ((tree));
-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 void 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,
- tsubst_flags_t,
- 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 tree get_vfield_name (tree);
+static void finish_struct_anon (tree);
+static tree get_vtable_name (tree);
+static tree get_basefndecls (tree, tree);
+static int build_primary_vtable (tree, tree);
+static int build_secondary_vtable (tree);
+static void finish_vtbls (tree);
+static void modify_vtable_entry (tree, tree, tree, tree, tree *);
+static void finish_struct_bits (tree);
+static int alter_access (tree, tree, tree);
+static void handle_using_decl (tree, tree);
+static void check_for_override (tree, tree);
+static tree dfs_modify_vtables (tree, void *);
+static tree modify_all_vtables (tree, tree);
+static void determine_primary_base (tree);
+static void finish_struct_methods (tree);
+static void maybe_warn_about_overly_private_class (tree);
+static int method_name_cmp (const void *, const void *);
+static int resort_method_name_cmp (const void *, const void *);
+static void add_implicitly_declared_members (tree, int, int, int);
+static tree fixed_type_or_null (tree, int *, int *);
+static tree resolve_address_of_overloaded_function (tree, tree, tsubst_flags_t,
+ bool, tree);
+static tree build_vtbl_ref_1 (tree, tree);
+static tree build_vtbl_initializer (tree, tree, tree, tree, int *);
+static int count_fields (tree);
+static int add_fields_to_record_type (tree, struct sorted_fields_type*, int);
+static void check_bitfield_decl (tree);
static void check_field_decl (tree, tree, int *, int *, int *, int *);
static void check_field_decls (tree, tree *, int *, int *, int *);
static tree *build_base_field (record_layout_info, tree, splay_tree, tree *);
static void build_base_fields (record_layout_info, 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_methods (tree);
+static void remove_zero_width_bit_fields (tree);
+static void check_bases (tree, int *, int *, int *);
static void check_bases_and_members (tree);
static tree create_vtable_ptr (tree, tree *);
static void include_empty_classes (record_layout_info);
static void layout_class_type (tree, tree *);
-static void fixup_pending_inline PARAMS ((tree));
-static void fixup_inline_methods PARAMS ((tree));
-static void set_primary_base PARAMS ((tree, tree));
-static void propagate_binfo_offsets PARAMS ((tree, tree, tree));
+static void fixup_pending_inline (tree);
+static void fixup_inline_methods (tree);
+static void set_primary_base (tree, tree);
+static void propagate_binfo_offsets (tree, tree);
static void layout_virtual_bases (record_layout_info, 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 build_vbase_offset_vtbl_entries (tree, vtbl_init_data *);
+static void add_vcall_offset_vtbl_entries_r (tree, vtbl_init_data *);
+static void add_vcall_offset_vtbl_entries_1 (tree, vtbl_init_data *);
+static void build_vcall_offset_vtbl_entries (tree, vtbl_init_data *);
static void add_vcall_offset (tree, 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));
-static tree 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 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_bases PARAMS ((tree));
-static bool type_requires_array_cookie PARAMS ((tree));
+static void layout_vtable_decl (tree, int);
+static tree dfs_find_final_overrider (tree, void *);
+static tree dfs_find_final_overrider_post (tree, void *);
+static tree dfs_find_final_overrider_q (tree, int, void *);
+static tree find_final_overrider (tree, tree, tree);
+static int make_new_vtable (tree, tree);
+static int maybe_indent_hierarchy (FILE *, int, int);
+static tree dump_class_hierarchy_r (FILE *, int, tree, tree, int);
+static void dump_class_hierarchy (tree);
+static void dump_class_hierarchy_1 (FILE *, int, tree);
+static void dump_array (FILE *, tree);
+static void dump_vtable (tree, tree, tree);
+static void dump_vtt (tree, tree);
+static void dump_thunk (FILE *, int, tree);
+static tree build_vtable (tree, tree, tree);
+static void initialize_vtable (tree, tree);
+static void initialize_array (tree, tree);
+static void layout_nonempty_base_or_field (record_layout_info,
+ tree, tree, splay_tree);
+static tree end_of_class (tree, int);
+static bool layout_empty_base (tree, tree, splay_tree);
+static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
+static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
+ tree);
+static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
+static void build_vcall_and_vbase_vtbl_entries (tree,
+ vtbl_init_data *);
+static void mark_primary_bases (tree);
+static void clone_constructors_and_destructors (tree);
+static tree build_clone (tree, tree);
+static void update_vtable_entry_for_fn (tree, tree, tree, tree *, unsigned);
+static tree copy_virtuals (tree);
+static void build_ctor_vtbl_group (tree, tree);
+static void build_vtt (tree);
+static tree binfo_ctor_vtable (tree);
+static tree *build_vtt_inits (tree, tree, tree *, tree *);
+static tree dfs_build_secondary_vptr_vtt_inits (tree, void *);
+static tree dfs_ctor_vtable_bases_queue_p (tree, int, void *data);
+static tree dfs_fixup_binfo_vtbls (tree, void *);
+static int record_subobject_offset (tree, tree, splay_tree);
+static int check_subobject_offset (tree, tree, splay_tree);
+static int walk_subobject_offsets (tree, subobject_offset_fn,
+ tree, splay_tree, tree, int);
+static void record_subobject_offsets (tree, tree, splay_tree, int);
+static int layout_conflict_p (tree, tree, splay_tree, int);
+static int splay_tree_compare_integer_csts (splay_tree_key k1,
+ splay_tree_key k2);
+static void warn_about_ambiguous_bases (tree);
+static bool type_requires_array_cookie (tree);
static bool contains_empty_class_p (tree);
-static tree dfs_base_derived_from (tree, void *);
static bool base_derived_from (tree, tree);
static int empty_base_at_nonzero_offset_p (tree, tree, splay_tree);
static tree end_of_base (tree);
@@ -231,7 +225,6 @@ int n_vtable_searches = 0;
int n_vtable_elems = 0;
int n_convert_harshness = 0;
int n_compute_conversion_costs = 0;
-int n_build_method_call = 0;
int n_inner_fields_searched = 0;
#endif
@@ -246,11 +239,10 @@ int n_inner_fields_searched = 0;
from EXPR. */
tree
-build_base_path (code, expr, binfo, nonnull)
- enum tree_code code;
- tree expr;
- tree binfo;
- int nonnull;
+build_base_path (enum tree_code code,
+ tree expr,
+ tree binfo,
+ int nonnull)
{
tree v_binfo = NULL_TREE;
tree d_binfo = NULL_TREE;
@@ -313,10 +305,7 @@ build_base_path (code, expr, binfo, nonnull)
{
/* In a base member initializer, we cannot rely on
the vtable being set up. We have to use the vtt_parm. */
- tree derived = v_binfo;
-
- while (BINFO_INHERITANCE_CHAIN (derived))
- derived = BINFO_INHERITANCE_CHAIN (derived);
+ tree derived = BINFO_INHERITANCE_CHAIN (v_binfo);
v_offset = build (PLUS_EXPR, TREE_TYPE (current_vtt_parm),
current_vtt_parm, BINFO_VPTR_INDEX (derived));
@@ -324,23 +313,22 @@ build_base_path (code, expr, binfo, nonnull)
v_offset = build1 (INDIRECT_REF,
TREE_TYPE (TYPE_VFIELD (BINFO_TYPE (derived))),
v_offset);
+
}
else
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);
- TREE_CONSTANT (v_offset) = 1;
- offset = cp_convert (ptrdiff_type_node,
- size_diffop (offset, BINFO_OFFSET (v_binfo)));
+ offset = convert_to_integer (ptrdiff_type_node,
+ size_diffop (offset,
+ BINFO_OFFSET (v_binfo)));
if (!integer_zerop (offset))
v_offset = build (code, ptrdiff_type_node, v_offset, offset);
@@ -430,43 +418,13 @@ convert_to_base_statically (tree expr, tree base)
}
-/* Virtual function things. */
-
-static tree
-build_vtable_entry_ref (array_ref, instance, idx)
- tree array_ref, instance, idx;
-{
- tree i, i2, vtable, first_fn, basetype;
-
- basetype = TREE_TYPE (instance);
- if (TREE_CODE (basetype) == REFERENCE_TYPE)
- basetype = TREE_TYPE (basetype);
-
- vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (basetype));
- first_fn = TYPE_BINFO_VTABLE (basetype);
-
- 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));
-
- if (TREE_CODE (i) != INTEGER_CST)
- abort ();
-
- return build (VTABLE_REF, TREE_TYPE (array_ref), array_ref, vtable, i);
-}
-
/* Given an object INSTANCE, return an expression which yields the
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. */
static tree
-build_vtbl_ref_1 (instance, idx)
- tree instance, idx;
+build_vtbl_ref_1 (tree instance, tree idx)
{
tree aref;
tree vtbl = NULL_TREE;
@@ -477,9 +435,7 @@ build_vtbl_ref_1 (instance, idx)
int cdtorp = 0;
tree fixed_type = fixed_type_or_null (instance, NULL, &cdtorp);
- tree basetype = TREE_TYPE (instance);
- if (TREE_CODE (basetype) == REFERENCE_TYPE)
- basetype = TREE_TYPE (basetype);
+ tree basetype = non_reference (TREE_TYPE (instance));
if (fixed_type && !cdtorp)
{
@@ -490,27 +446,20 @@ build_vtbl_ref_1 (instance, idx)
}
if (!vtbl)
- {
- vtbl = build_vfield_ref (instance, basetype);
- }
-
+ vtbl = build_vfield_ref (instance, basetype);
+
assemble_external (vtbl);
aref = build_array_ref (vtbl, idx);
- TREE_CONSTANT (aref) = 1;
return aref;
}
tree
-build_vtbl_ref (instance, idx)
- tree instance, idx;
+build_vtbl_ref (tree instance, tree idx)
{
tree aref = build_vtbl_ref_1 (instance, idx);
- if (flag_vtable_gc)
- aref = build_vtable_entry_ref (aref, instance, idx);
-
return aref;
}
@@ -518,8 +467,7 @@ build_vtbl_ref (instance, idx)
function pointer corresponding to vtable element INDEX. */
tree
-build_vfn_ref (instance, idx)
- tree instance, idx;
+build_vfn_ref (tree instance, tree idx)
{
tree aref = build_vtbl_ref_1 (instance, idx);
@@ -529,9 +477,6 @@ build_vfn_ref (instance, idx)
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;
}
@@ -539,8 +484,7 @@ build_vfn_ref (instance, idx)
for the given TYPE. */
static tree
-get_vtable_name (type)
- tree type;
+get_vtable_name (tree type)
{
return mangle_vtbl_for_type (type);
}
@@ -549,8 +493,7 @@ get_vtable_name (type)
for TYPE. */
tree
-get_vtt_name (type)
- tree type;
+get_vtt_name (tree type)
{
return mangle_vtt_for_type (type);
}
@@ -560,10 +503,7 @@ get_vtt_name (type)
Use NAME for the name of the vtable, and VTABLE_TYPE for its type. */
static tree
-build_vtable (class_type, name, vtable_type)
- tree class_type;
- tree name;
- tree vtable_type;
+build_vtable (tree class_type, tree name, tree vtable_type)
{
tree decl;
@@ -577,6 +517,12 @@ build_vtable (class_type, name, vtable_type)
TREE_READONLY (decl) = 1;
DECL_VIRTUAL_P (decl) = 1;
DECL_ALIGN (decl) = TARGET_VTABLE_ENTRY_ALIGN;
+ DECL_VTABLE_OR_VTT_P (decl) = 1;
+
+ /* 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));
import_export_vtable (decl, class_type, 0);
@@ -590,23 +536,16 @@ build_vtable (class_type, name, vtable_type)
which are known to exist in the runtime. */
tree
-get_vtable_decl (type, complete)
- tree type;
- int complete;
+get_vtable_decl (tree type, int complete)
{
tree decl;
if (CLASSTYPE_VTABLES (type))
return CLASSTYPE_VTABLES (type);
- decl = build_vtable (type, get_vtable_name (type), void_type_node);
+ decl = build_vtable (type, get_vtable_name (type), vtbl_type_node);
CLASSTYPE_VTABLES (type) = decl;
- /* 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 (complete)
{
DECL_EXTERNAL (decl) = 1;
@@ -620,8 +559,7 @@ get_vtable_decl (type, complete)
BV_VCALL_INDEX for each entry is cleared. */
static tree
-copy_virtuals (binfo)
- tree binfo;
+copy_virtuals (tree binfo)
{
tree copies;
tree t;
@@ -640,8 +578,7 @@ copy_virtuals (binfo)
created. */
static int
-build_primary_vtable (binfo, type)
- tree binfo, type;
+build_primary_vtable (tree binfo, tree type)
{
tree decl;
tree virtuals;
@@ -650,7 +587,7 @@ build_primary_vtable (binfo, type)
if (binfo)
{
- if (BINFO_NEW_VTABLE_MARKED (binfo, type))
+ if (BINFO_NEW_VTABLE_MARKED (binfo))
/* We have already created a vtable for this base, so there's
no need to do it again. */
return 0;
@@ -662,8 +599,7 @@ build_primary_vtable (binfo, type)
}
else
{
- my_friendly_assert (TREE_CODE (TREE_TYPE (decl)) == VOID_TYPE,
- 20000118);
+ my_friendly_assert (TREE_TYPE (decl) == vtbl_type_node, 20000118);
virtuals = NULL_TREE;
}
@@ -676,7 +612,7 @@ build_primary_vtable (binfo, type)
on our first approximation. */
TYPE_BINFO_VTABLE (type) = decl;
TYPE_BINFO_VIRTUALS (type) = virtuals;
- SET_BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (type), type);
+ SET_BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (type));
return 1;
}
@@ -695,19 +631,16 @@ build_primary_vtable (binfo, type)
can result. */
static int
-build_secondary_vtable (binfo, for_type)
- tree binfo, for_type;
+build_secondary_vtable (tree binfo)
{
- my_friendly_assert (binfo == CANONICAL_BINFO (binfo, for_type), 20010605);
-
- if (BINFO_NEW_VTABLE_MARKED (binfo, for_type))
+ if (BINFO_NEW_VTABLE_MARKED (binfo))
/* 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);
+ SET_BINFO_NEW_VTABLE_MARKED (binfo);
/* Make fresh virtual list, so we can smash it later. */
BINFO_VIRTUALS (binfo) = copy_virtuals (binfo);
@@ -722,9 +655,7 @@ build_secondary_vtable (binfo, for_type)
T. Return nonzero if we actually created a new vtable. */
static int
-make_new_vtable (t, binfo)
- tree t;
- tree binfo;
+make_new_vtable (tree t, tree binfo)
{
if (binfo == TYPE_BINFO (t))
/* In this case, it is *type*'s vtable we are modifying. We start
@@ -739,7 +670,7 @@ make_new_vtable (t, binfo)
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);
+ return build_secondary_vtable (binfo);
}
/* Make *VIRTUALS, an entry on the BINFO_VIRTUALS list for BINFO
@@ -749,12 +680,11 @@ make_new_vtable (t, binfo)
the function is actually called. */
static void
-modify_vtable_entry (t, binfo, fndecl, delta, virtuals)
- tree t;
- tree binfo;
- tree fndecl;
- tree delta;
- tree *virtuals;
+modify_vtable_entry (tree t,
+ tree binfo,
+ tree fndecl,
+ tree delta,
+ tree *virtuals)
{
tree v;
@@ -763,8 +693,6 @@ modify_vtable_entry (t, binfo, fndecl, delta, virtuals)
if (fndecl != BV_FN (v)
|| !tree_int_cst_equal (delta, BV_DELTA (v)))
{
- tree base_fndecl;
-
/* We need a new vtable for BINFO. */
if (make_new_vtable (t, binfo))
{
@@ -777,7 +705,6 @@ modify_vtable_entry (t, binfo, fndecl, delta, virtuals)
v = *virtuals;
}
- base_fndecl = BV_FN (v);
BV_DELTA (v) = delta;
BV_VCALL_INDEX (v) = NULL_TREE;
BV_FN (v) = fndecl;
@@ -791,17 +718,20 @@ modify_vtable_entry (t, binfo, fndecl, delta, virtuals)
add the method for improved error recovery.) */
void
-add_method (type, method, error_p)
- tree type;
- tree method;
- int error_p;
+add_method (tree type, tree method, int error_p)
{
- int using = (DECL_CONTEXT (method) != type);
+ int using;
int len;
int slot;
tree method_vec;
- int template_conv_p = (TREE_CODE (method) == TEMPLATE_DECL
- && DECL_TEMPLATE_CONV_FN_P (method));
+ int template_conv_p;
+
+ if (method == error_mark_node)
+ return;
+
+ using = (DECL_CONTEXT (method) != type);
+ template_conv_p = (TREE_CODE (method) == TEMPLATE_DECL
+ && DECL_TEMPLATE_CONV_FN_P (method));
if (!CLASSTYPE_METHOD_VEC (type))
/* Make a new method vector. We start with 8 entries. We must
@@ -823,7 +753,16 @@ add_method (type, method, error_p)
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;
+ {
+ slot = CLASSTYPE_DESTRUCTOR_SLOT;
+ TYPE_HAS_DESTRUCTOR (type) = 1;
+
+ if (TYPE_FOR_JAVA (type))
+ error (DECL_ARTIFICIAL (method)
+ ? "Java class '%T' cannot have an implicit non-trivial destructor"
+ : "Java class '%T' cannot have a destructor",
+ DECL_CONTEXT (method));
+ }
else
{
int have_template_convs_p = 0;
@@ -925,7 +864,7 @@ add_method (type, method, error_p)
}
}
- if (template_class_depth (type))
+ if (processing_template_decl)
/* TYPE is a template class. Don't issue any errors now; wait
until instantiation time to complain. */
;
@@ -990,7 +929,7 @@ add_method (type, method, error_p)
else
{
cp_error_at ("`%#D' and `%#D' cannot be overloaded",
- method, fn, method);
+ method, fn);
/* We don't call duplicate_decls here to merge
the declarations because that will confuse
@@ -1016,124 +955,18 @@ add_method (type, method, error_p)
/* Subroutines of finish_struct. */
-/* Look through the list of fields for this struct, deleting
- duplicates as we go. This must be recursive to handle
- anonymous unions.
-
- FIELD is the field which may not appear anywhere in FIELDS.
- FIELD_PTR, if non-null, is the starting point at which
- chained deletions may take place.
- The value returned is the first acceptable entry found
- in FIELDS.
-
- Note that anonymous fields which are not of UNION_TYPE are
- not duplicates, they are just anonymous fields. This happens
- when we have unnamed bitfields, for example. */
-
-static tree
-delete_duplicate_fields_1 (field, fields)
- tree field, fields;
-{
- tree x;
- tree prev = 0;
- if (DECL_NAME (field) == 0)
- {
- if (! ANON_AGGR_TYPE_P (TREE_TYPE (field)))
- return fields;
-
- for (x = TYPE_FIELDS (TREE_TYPE (field)); x; x = TREE_CHAIN (x))
- fields = delete_duplicate_fields_1 (x, fields);
- return fields;
- }
- else
- {
- for (x = fields; x; prev = x, x = TREE_CHAIN (x))
- {
- if (DECL_NAME (x) == 0)
- {
- if (! ANON_AGGR_TYPE_P (TREE_TYPE (x)))
- continue;
- TYPE_FIELDS (TREE_TYPE (x))
- = delete_duplicate_fields_1 (field, TYPE_FIELDS (TREE_TYPE (x)));
- if (TYPE_FIELDS (TREE_TYPE (x)) == 0)
- {
- if (prev == 0)
- fields = TREE_CHAIN (fields);
- else
- TREE_CHAIN (prev) = TREE_CHAIN (x);
- }
- }
- 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 (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);
- }
- }
- }
- return fields;
-}
-
-static void
-delete_duplicate_fields (fields)
- tree fields;
-{
- tree x;
- for (x = fields; x && TREE_CHAIN (x); x = TREE_CHAIN (x))
- TREE_CHAIN (x) = delete_duplicate_fields_1 (x, TREE_CHAIN (x));
-}
-
/* Change the access of FDECL to ACCESS in T. Return 1 if change was
legit, otherwise return 0. */
static int
-alter_access (t, fdecl, access)
- tree t;
- tree fdecl;
- tree access;
+alter_access (tree t, tree fdecl, tree access)
{
tree elem;
if (!DECL_LANG_SPECIFIC (fdecl))
retrofit_lang_decl (fdecl);
- if (DECL_DISCRIMINATOR_P (fdecl))
- abort ();
+ my_friendly_assert (!DECL_DISCRIMINATOR_P (fdecl), 20030624);
elem = purpose_member (t, DECL_ACCESS (fdecl));
if (elem)
@@ -1155,7 +988,7 @@ alter_access (t, fdecl, access)
}
else
{
- enforce_access (t, fdecl);
+ perform_or_defer_access_check (TYPE_BINFO (t), fdecl);
DECL_ACCESS (fdecl) = tree_cons (t, access, DECL_ACCESS (fdecl));
return 1;
}
@@ -1165,9 +998,7 @@ alter_access (t, fdecl, access)
/* Process the USING_DECL, which is a member of T. */
static void
-handle_using_decl (using_decl, t)
- tree using_decl;
- tree t;
+handle_using_decl (tree using_decl, tree t)
{
tree ctype = DECL_INITIAL (using_decl);
tree name = DECL_NAME (using_decl);
@@ -1185,7 +1016,11 @@ handle_using_decl (using_decl, t)
binfo = lookup_base (t, ctype, ba_any, NULL);
if (! binfo)
{
- error_not_base_type (t, ctype);
+ location_t saved_loc = input_location;
+
+ input_location = DECL_SOURCE_LOCATION (using_decl);
+ error_not_base_type (ctype, t);
+ input_location = saved_loc;
return;
}
@@ -1200,7 +1035,7 @@ handle_using_decl (using_decl, t)
return;
}
- fdecl = lookup_member (binfo, name, 0, 0);
+ fdecl = lookup_member (binfo, name, 0, false);
if (!fdecl)
{
@@ -1249,7 +1084,7 @@ handle_using_decl (using_decl, t)
return;
}
- /* Make type T see field decl FDECL with access ACCESS.*/
+ /* Make type T see field decl FDECL with access ACCESS. */
if (flist)
for (; flist; flist = OVL_NEXT (flist))
{
@@ -1266,12 +1101,10 @@ handle_using_decl (using_decl, t)
the bases. */
static void
-check_bases (t, cant_have_default_ctor_p, cant_have_const_ctor_p,
- no_const_asn_ref_p)
- tree t;
- int *cant_have_default_ctor_p;
- int *cant_have_const_ctor_p;
- int *no_const_asn_ref_p;
+check_bases (tree t,
+ int* cant_have_default_ctor_p,
+ int* cant_have_const_ctor_p,
+ int* no_const_asn_ref_p)
{
int n_baseclasses;
int i;
@@ -1367,237 +1200,52 @@ check_bases (t, cant_have_default_ctor_p, cant_have_const_ctor_p,
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);
CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t)
|= CLASSTYPE_CONTAINS_EMPTY_CLASS_P (basetype);
}
}
-/* 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. */
-
-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. */
-
-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;
+mark_primary_bases (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);
+ tree 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
+ if (!base_binfo)
+ /* Not a dynamic base. */;
+ else if (BINFO_PRIMARY_P (base_binfo))
BINFO_LOST_PRIMARY_P (binfo) = 1;
-
- BINFO_UNSHARED_MARKED (binfo) = 1;
+ else
+ {
+ BINFO_PRIMARY_BASE_OF (base_binfo) = binfo;
+ /* A virtual binfo might have been copied from within
+ another hierarchy. As we're about to use it as a primary
+ base, make sure the offsets match. */
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ {
+ tree delta = size_diffop (convert (ssizetype,
+ BINFO_OFFSET (binfo)),
+ convert (ssizetype,
+ BINFO_OFFSET (base_binfo)));
+
+ propagate_binfo_offsets (base_binfo, delta);
+ }
+ }
}
- /* 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)
- tree t;
- tree binfo;
+set_primary_base (tree t, tree binfo)
{
tree basetype;
@@ -1611,8 +1259,7 @@ set_primary_base (t, binfo)
/* Determine the primary class for T. */
static void
-determine_primary_base (t)
- tree t;
+determine_primary_base (tree t)
{
int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
tree vbases;
@@ -1754,8 +1401,7 @@ determine_primary_base (t)
use. */
static void
-finish_struct_bits (t)
- tree t;
+finish_struct_bits (tree t)
{
int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
@@ -1834,8 +1480,7 @@ finish_struct_bits (t)
non-private static member functions. */
static void
-maybe_warn_about_overly_private_class (t)
- tree t;
+maybe_warn_about_overly_private_class (tree t)
{
int has_member_fn = 0;
int has_nonprivate_method = 0;
@@ -1899,10 +1544,10 @@ maybe_warn_about_overly_private_class (t)
issues error messages specifically referring to
constructors/destructors.) */
int i;
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
- for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); i++)
- if (TREE_VIA_PUBLIC (TREE_VEC_ELT (binfos, i))
- || TREE_VIA_PROTECTED (TREE_VEC_ELT (binfos, i)))
+ tree binfo = TYPE_BINFO (t);
+
+ for (i = 0; i < BINFO_N_BASETYPES (binfo); i++)
+ if (BINFO_BASEACCESS (binfo, i) != access_private_node)
{
has_nonprivate_method = 1;
break;
@@ -1917,16 +1562,12 @@ maybe_warn_about_overly_private_class (t)
/* Even if some of the member functions are non-private, the class
won't be useful for much if all the constructors or destructors
are private: such an object can never be created or destroyed. */
- if (TYPE_HAS_DESTRUCTOR (t))
+ if (TYPE_HAS_DESTRUCTOR (t)
+ && TREE_PRIVATE (CLASSTYPE_DESTRUCTORS (t)))
{
- tree dtor = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 1);
-
- if (TREE_PRIVATE (dtor))
- {
- warning ("`%#T' only defines a private destructor and has no friends",
- t);
- return;
- }
+ warning ("`%#T' only defines a private destructor and has no friends",
+ t);
+ return;
}
if (TYPE_HAS_CONSTRUCTOR (t))
@@ -1973,41 +1614,85 @@ maybe_warn_about_overly_private_class (t)
}
}
-/* Function to help qsort sort FIELD_DECLs by name order. */
+static struct {
+ gt_pointer_operator new_value;
+ void *cookie;
+} resort_data;
+
+/* Comparison function to compare two TYPE_METHOD_VEC entries by name. */
static int
-field_decl_cmp (x, y)
- const tree *x, *y;
+method_name_cmp (const void* m1_p, const void* m2_p)
{
- 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)
+ const tree *const m1 = m1_p;
+ const tree *const m2 = m2_p;
+
+ if (*m1 == NULL_TREE && *m2 == NULL_TREE)
+ return 0;
+ if (*m1 == NULL_TREE)
return -1;
- if (DECL_NAME (*y) == NULL_TREE)
+ if (*m2 == NULL_TREE)
return 1;
- if (DECL_NAME (*x) < DECL_NAME (*y))
+ if (DECL_NAME (OVL_CURRENT (*m1)) < DECL_NAME (OVL_CURRENT (*m2)))
return -1;
return 1;
}
-/* Comparison function to compare two TYPE_METHOD_VEC entries by name. */
+/* This routine compares two fields like method_name_cmp but using the
+ pointer operator in resort_field_decl_data. */
static int
-method_name_cmp (m1, m2)
- const tree *m1, *m2;
+resort_method_name_cmp (const void* m1_p, const void* m2_p)
{
+ const tree *const m1 = m1_p;
+ const tree *const m2 = m2_p;
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;
+ {
+ tree d1 = DECL_NAME (OVL_CURRENT (*m1));
+ tree d2 = DECL_NAME (OVL_CURRENT (*m2));
+ resort_data.new_value (&d1, resort_data.cookie);
+ resort_data.new_value (&d2, resort_data.cookie);
+ if (d1 < d2)
+ return -1;
+ }
return 1;
}
+/* Resort TYPE_METHOD_VEC because pointers have been reordered. */
+
+void
+resort_type_method_vec (void* obj,
+ void* orig_obj ATTRIBUTE_UNUSED ,
+ gt_pointer_operator new_value,
+ void* cookie)
+{
+ tree method_vec = obj;
+ int len = TREE_VEC_LENGTH (method_vec);
+ int slot;
+
+ /* 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)
+ {
+ resort_data.new_value = new_value;
+ resort_data.cookie = cookie;
+ qsort (&TREE_VEC_ELT (method_vec, slot), len - slot, sizeof (tree),
+ resort_method_name_cmp);
+ }
+}
+
/* Warn about duplicate methods in fn_fields. Also compact method
lists so that lookup can be made faster.
@@ -2025,8 +1710,7 @@ method_name_cmp (m1, m2)
search. */
static void
-finish_struct_methods (t)
- tree t;
+finish_struct_methods (tree t)
{
tree fn_fields;
tree method_vec;
@@ -2078,80 +1762,7 @@ finish_struct_methods (t)
}
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. */
-
-void
-duplicate_tag_error (t)
- tree t;
-{
- error ("redefinition of `%#T'", t);
- cp_error_at ("previous definition of `%#T'", t);
-
- /* Pretend we haven't defined this type. */
-
- /* All of the component_decl's were TREE_CHAINed together in the parser.
- finish_struct_methods walks these chains and assembles all methods with
- the same base name into DECL_CHAINs. Now we don't need the parser chains
- anymore, so we unravel them. */
-
- /* This used to be in finish_struct, but it turns out that the
- TREE_CHAIN is used by dbxout_type_methods and perhaps some other
- things... */
- if (CLASSTYPE_METHOD_VEC (t))
- {
- tree method_vec = CLASSTYPE_METHOD_VEC (t);
- int i, len = TREE_VEC_LENGTH (method_vec);
- for (i = 0; i < len; i++)
- {
- tree unchain = TREE_VEC_ELT (method_vec, i);
- while (unchain != NULL_TREE)
- {
- TREE_CHAIN (OVL_CURRENT (unchain)) = NULL_TREE;
- unchain = OVL_NEXT (unchain);
- }
- }
- }
-
- if (TYPE_LANG_SPECIFIC (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);
-
- memset ((char *) TYPE_LANG_SPECIFIC (t), 0, sizeof (struct lang_type));
- BINFO_BASETYPES(binfo) = NULL_TREE;
-
- TYPE_LANG_SPECIFIC (t)->u.h.is_lang_type_class = 1;
- 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;
- CLASSTYPE_DECL_LIST (t) = NULL_TREE;
- }
- TYPE_SIZE (t) = NULL_TREE;
- TYPE_MODE (t) = VOIDmode;
- TYPE_FIELDS (t) = NULL_TREE;
- 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);
+ method_name_cmp);
}
/* Make BINFO's vtable have N entries, including RTTI entries,
@@ -2159,9 +1770,7 @@ duplicate_tag_error (t)
to lay it out. */
static void
-layout_vtable_decl (binfo, n)
- tree binfo;
- int n;
+layout_vtable_decl (tree binfo, int n)
{
tree atype;
tree vtable;
@@ -2177,11 +1786,6 @@ layout_vtable_decl (binfo, n)
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));
}
}
@@ -2189,8 +1793,7 @@ layout_vtable_decl (binfo, n)
have the same signature. */
int
-same_signature_p (fndecl, base_fndecl)
- tree fndecl, base_fndecl;
+same_signature_p (tree fndecl, tree base_fndecl)
{
/* One destructor overrides another if they are the same kind of
destructor. */
@@ -2204,7 +1807,11 @@ same_signature_p (fndecl, base_fndecl)
if (DECL_DESTRUCTOR_P (base_fndecl) || DECL_DESTRUCTOR_P (fndecl))
return 0;
- if (DECL_NAME (fndecl) == DECL_NAME (base_fndecl))
+ if (DECL_NAME (fndecl) == DECL_NAME (base_fndecl)
+ || (DECL_CONV_FN_P (fndecl)
+ && DECL_CONV_FN_P (base_fndecl)
+ && same_type_p (DECL_CONV_FN_TYPE (fndecl),
+ DECL_CONV_FN_TYPE (base_fndecl))))
{
tree types, base_types;
types = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
@@ -2217,27 +1824,27 @@ same_signature_p (fndecl, base_fndecl)
return 0;
}
-/* Called from base_derived_from via dfs_walk. */
-
-static tree
-dfs_base_derived_from (tree binfo, void *data)
-{
- tree base = (tree) data;
-
- if (same_type_p (TREE_TYPE (base), TREE_TYPE (binfo))
- && tree_int_cst_equal (BINFO_OFFSET (base), BINFO_OFFSET (binfo)))
- return error_mark_node;
-
- return NULL_TREE;
-}
-
/* Returns TRUE if DERIVED is a binfo containing the binfo BASE as a
subobject. */
static bool
base_derived_from (tree derived, tree base)
{
- return dfs_walk (derived, dfs_base_derived_from, NULL, base) != NULL_TREE;
+ tree probe;
+
+ for (probe = base; probe; probe = BINFO_INHERITANCE_CHAIN (probe))
+ {
+ if (probe == derived)
+ return true;
+ else if (TREE_VIA_VIRTUAL (probe))
+ /* If we meet a virtual base, we can't follow the inheritance
+ any more. See if the complete type of DERIVED contains
+ such a virtual base. */
+ return purpose_member (BINFO_TYPE (probe),
+ CLASSTYPE_VBASECLASSES (BINFO_TYPE (derived)))
+ != NULL_TREE;
+ }
+ return false;
}
typedef struct find_final_overrider_data_s {
@@ -2249,72 +1856,93 @@ typedef struct find_final_overrider_data_s {
tree most_derived_type;
/* The candidate overriders. */
tree candidates;
+ /* Binfos which inherited virtually on the current path. */
+ tree vpath;
} find_final_overrider_data;
/* Called from find_final_overrider via dfs_walk. */
static tree
-dfs_find_final_overrider (binfo, data)
- tree binfo;
- void *data;
+dfs_find_final_overrider (tree binfo, void* data)
{
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. */
- path = reverse_path (binfo);
- while (!same_type_p (BINFO_TYPE (TREE_VALUE (path)),
- ffod->most_derived_type))
- path = TREE_CHAIN (path);
- while (path)
+ if (binfo == ffod->declaring_base)
+ {
+ /* We've found a path to the declaring base. Walk the path from
+ derived to base, looking for an overrider for FN. */
+ tree path, probe, vpath;
+
+ /* Build the path, using the inheritance chain and record of
+ virtual inheritance. */
+ for (path = NULL_TREE, probe = binfo, vpath = ffod->vpath;;)
{
- method = look_for_overrides_here (BINFO_TYPE (TREE_VALUE (path)),
- ffod->fn);
+ path = tree_cons (NULL_TREE, probe, path);
+ if (same_type_p (BINFO_TYPE (probe), ffod->most_derived_type))
+ break;
+ if (TREE_VIA_VIRTUAL (probe))
+ {
+ probe = TREE_VALUE (vpath);
+ vpath = TREE_CHAIN (vpath);
+ }
+ else
+ probe = BINFO_INHERITANCE_CHAIN (probe);
+ }
+ /* Now walk path, looking for overrides. */
+ for (; path; path = TREE_CHAIN (path))
+ {
+ tree method = look_for_overrides_here
+ (BINFO_TYPE (TREE_VALUE (path)), ffod->fn);
+
if (method)
{
+ tree *candidate = &ffod->candidates;
path = TREE_VALUE (path);
+
+ /* Remove any candidates overridden by this new function. */
+ while (*candidate)
+ {
+ /* If *CANDIDATE overrides METHOD, then METHOD
+ cannot override anything else on the list. */
+ if (base_derived_from (TREE_VALUE (*candidate), path))
+ return NULL_TREE;
+ /* If METHOD overrides *CANDIDATE, remove *CANDIDATE. */
+ if (base_derived_from (path, TREE_VALUE (*candidate)))
+ *candidate = TREE_CHAIN (*candidate);
+ else
+ candidate = &TREE_CHAIN (*candidate);
+ }
+
+ /* Add the new function. */
+ ffod->candidates = tree_cons (method, path, ffod->candidates);
break;
}
-
- path = TREE_CHAIN (path);
}
+ }
- /* If we found an overrider, record the overriding function, and
- the base from which it came. */
- if (path)
- {
- tree *candidate;
+ return NULL_TREE;
+}
- /* Remove any candidates overridden by this new function. */
- candidate = &ffod->candidates;
- while (*candidate)
- {
- /* If *CANDIDATE overrides METHOD, then METHOD
- cannot override anything else on the list. */
- if (base_derived_from (TREE_VALUE (*candidate), path))
- return NULL_TREE;
- /* If METHOD overrides *CANDIDATE, remove *CANDIDATE. */
- if (base_derived_from (path, TREE_VALUE (*candidate)))
- *candidate = TREE_CHAIN (*candidate);
- else
- candidate = &TREE_CHAIN (*candidate);
- }
+static tree
+dfs_find_final_overrider_q (tree derived, int ix, void *data)
+{
+ tree binfo = BINFO_BASETYPE (derived, ix);
+ find_final_overrider_data *ffod = (find_final_overrider_data *) data;
- /* Add the new function. */
- ffod->candidates = tree_cons (method, path, ffod->candidates);
- }
- }
+ if (TREE_VIA_VIRTUAL (binfo))
+ ffod->vpath = tree_cons (NULL_TREE, derived, ffod->vpath);
+
+ return binfo;
+}
+static tree
+dfs_find_final_overrider_post (tree binfo, void *data)
+{
+ find_final_overrider_data *ffod = (find_final_overrider_data *) data;
+
+ if (TREE_VIA_VIRTUAL (binfo) && TREE_CHAIN (ffod->vpath))
+ ffod->vpath = TREE_CHAIN (ffod->vpath);
+
return NULL_TREE;
}
@@ -2324,10 +1952,7 @@ dfs_find_final_overrider (binfo, data)
DERIVED) is the base object in which FN is declared. */
static tree
-find_final_overrider (derived, binfo, fn)
- tree derived;
- tree binfo;
- tree fn;
+find_final_overrider (tree derived, tree binfo, tree fn)
{
find_final_overrider_data ffod;
@@ -2349,15 +1974,20 @@ find_final_overrider (derived, binfo, fn)
The solution is to look at all paths to BINFO. If we find
different overriders along any two, then there is a problem. */
+ if (DECL_THUNK_P (fn))
+ fn = THUNK_TARGET (fn);
+
ffod.fn = fn;
ffod.declaring_base = binfo;
ffod.most_derived_type = BINFO_TYPE (derived);
ffod.candidates = NULL_TREE;
+ ffod.vpath = NULL_TREE;
- dfs_walk (derived,
- dfs_find_final_overrider,
- NULL,
- &ffod);
+ dfs_walk_real (derived,
+ dfs_find_final_overrider,
+ dfs_find_final_overrider_post,
+ dfs_find_final_overrider_q,
+ &ffod);
/* If there was no winner, issue an error message. */
if (!ffod.candidates || TREE_CHAIN (ffod.candidates))
@@ -2390,21 +2020,21 @@ get_vcall_index (tree fn, tree type)
}
/* 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
+ dominated by T. FN has been overridden in BINFO; VIRTUALS points to the
corresponding position in the BINFO_VIRTUALS list. */
static void
-update_vtable_entry_for_fn (t, binfo, fn, virtuals)
- tree t;
- tree binfo;
- tree fn;
- tree *virtuals;
+update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
+ unsigned ix)
{
tree b;
tree overrider;
tree delta;
tree virtual_base;
tree first_defn;
+ tree overrider_fn, overrider_target;
+ tree target_fn = DECL_THUNK_P (fn) ? THUNK_TARGET (fn) : fn;
+ tree over_return, base_return;
bool lost = false;
/* Find the nearest primary base (possibly binfo itself) which defines
@@ -2412,7 +2042,8 @@ update_vtable_entry_for_fn (t, binfo, fn, virtuals)
calling FN through BINFO. */
for (b = binfo; ; b = get_primary_binfo (b))
{
- if (look_for_overrides_here (BINFO_TYPE (b), fn))
+ my_friendly_assert (b, 20021227);
+ if (look_for_overrides_here (BINFO_TYPE (b), target_fn))
break;
/* The nearest definition is from a lost primary. */
@@ -2422,14 +2053,92 @@ update_vtable_entry_for_fn (t, binfo, fn, virtuals)
first_defn = b;
/* Find the final overrider. */
- overrider = find_final_overrider (TYPE_BINFO (t), b, fn);
+ overrider = find_final_overrider (TYPE_BINFO (t), b, target_fn);
if (overrider == error_mark_node)
return;
+ overrider_target = overrider_fn = TREE_PURPOSE (overrider);
+
+ /* Check for adjusting covariant return types. */
+ over_return = TREE_TYPE (TREE_TYPE (overrider_target));
+ base_return = TREE_TYPE (TREE_TYPE (target_fn));
+
+ if (POINTER_TYPE_P (over_return)
+ && TREE_CODE (over_return) == TREE_CODE (base_return)
+ && CLASS_TYPE_P (TREE_TYPE (over_return))
+ && CLASS_TYPE_P (TREE_TYPE (base_return)))
+ {
+ /* If FN is a covariant thunk, we must figure out the adjustment
+ to the final base FN was converting to. As OVERRIDER_TARGET might
+ also be converting to the return type of FN, we have to
+ combine the two conversions here. */
+ tree fixed_offset, virtual_offset;
+
+ if (DECL_THUNK_P (fn))
+ {
+ my_friendly_assert (DECL_RESULT_THUNK_P (fn), 20031211);
+ fixed_offset = ssize_int (THUNK_FIXED_OFFSET (fn));
+ virtual_offset = THUNK_VIRTUAL_OFFSET (fn);
+ }
+ else
+ fixed_offset = virtual_offset = NULL_TREE;
+
+ if (virtual_offset)
+ /* Find the equivalent binfo within the return type of the
+ overriding function. We will want the vbase offset from
+ there. */
+ virtual_offset =
+ TREE_VALUE (purpose_member
+ (BINFO_TYPE (virtual_offset),
+ CLASSTYPE_VBASECLASSES (TREE_TYPE (over_return))));
+ else if (!same_type_p (TREE_TYPE (over_return),
+ TREE_TYPE (base_return)))
+ {
+ /* There was no existing virtual thunk (which takes
+ precedence). */
+ tree thunk_binfo;
+ base_kind kind;
+
+ thunk_binfo = lookup_base (TREE_TYPE (over_return),
+ TREE_TYPE (base_return),
+ ba_check | ba_quiet, &kind);
- /* Check for unsupported covariant returns again now that we've
- calculated the base offsets. */
- check_final_overrider (TREE_PURPOSE (overrider), fn);
+ if (thunk_binfo && (kind == bk_via_virtual
+ || !BINFO_OFFSET_ZEROP (thunk_binfo)))
+ {
+ tree offset = convert (ssizetype, BINFO_OFFSET (thunk_binfo));
+ if (kind == bk_via_virtual)
+ {
+ /* We convert via virtual base. Find the virtual
+ base and adjust the fixed offset to be from there. */
+ while (!TREE_VIA_VIRTUAL (thunk_binfo))
+ thunk_binfo = BINFO_INHERITANCE_CHAIN (thunk_binfo);
+
+ virtual_offset = thunk_binfo;
+ offset = size_diffop
+ (offset, convert
+ (ssizetype, BINFO_OFFSET (virtual_offset)));
+ }
+ if (fixed_offset)
+ /* There was an existing fixed offset, this must be
+ from the base just converted to, and the base the
+ FN was thunking to. */
+ fixed_offset = size_binop (PLUS_EXPR, fixed_offset, offset);
+ else
+ fixed_offset = offset;
+ }
+ }
+
+ if (fixed_offset || virtual_offset)
+ /* Replace the overriding function with a covariant thunk. We
+ will emit the overriding function in its own slot as
+ well. */
+ overrider_fn = make_thunk (overrider_target, /*this_adjusting=*/0,
+ fixed_offset, virtual_offset);
+ }
+ else
+ my_friendly_assert (!DECL_THUNK_P (fn), 20021231);
+
/* 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;
@@ -2447,18 +2156,51 @@ update_vtable_entry_for_fn (t, binfo, fn, 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;
+ if (TREE_VIA_VIRTUAL (b))
+ {
+ virtual_base = b;
+ break;
+ }
}
+ if (overrider_fn != overrider_target && !virtual_base)
+ {
+ /* The ABI specifies that a covariant thunk includes a mangling
+ for a this pointer adjustment. This-adjusting thunks that
+ override a function from a virtual base have a vcall
+ adjustment. When the virtual base in question is a primary
+ virtual base, we know the adjustments are zero, (and in the
+ non-covariant case, we would not use the thunk).
+ Unfortunately we didn't notice this could happen, when
+ designing the ABI and so never mandated that such a covariant
+ thunk should be emitted. Because we must use the ABI mandated
+ name, we must continue searching from the binfo where we
+ found the most recent definition of the function, towards the
+ primary binfo which first introduced the function into the
+ vtable. If that enters a virtual base, we must use a vcall
+ this-adjusting thunk. Bleah! */
+ tree probe = first_defn;
+
+ while ((probe = get_primary_binfo (probe))
+ && (unsigned) list_length (BINFO_VIRTUALS (probe)) > ix)
+ if (TREE_VIA_VIRTUAL (probe))
+ virtual_base = probe;
+
+ if (virtual_base)
+ /* Even if we find a virtual base, the correct delta is
+ between the overrider and the binfo we're building a vtable
+ for. */
+ goto virtual_covariant;
+ }
+
/* 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));
+ delta = size_diffop (convert (ssizetype, BINFO_OFFSET (virtual_base)),
+ convert (ssizetype, 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,
@@ -2469,27 +2211,22 @@ update_vtable_entry_for_fn (t, binfo, fn, virtuals)
/* 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));
+ virtual_covariant:
+ delta = size_diffop (convert (ssizetype,
+ BINFO_OFFSET (TREE_VALUE (overrider))),
+ convert (ssizetype, BINFO_OFFSET (binfo)));
- modify_vtable_entry (t,
- binfo,
- TREE_PURPOSE (overrider),
- delta,
- virtuals);
+ modify_vtable_entry (t, binfo, overrider_fn, delta, virtuals);
if (virtual_base)
BV_VCALL_INDEX (*virtuals)
- = get_vcall_index (TREE_PURPOSE (overrider),
- BINFO_TYPE (virtual_base));
+ = get_vcall_index (overrider_target, BINFO_TYPE (virtual_base));
}
/* Called from modify_all_vtables via dfs_walk. */
static tree
-dfs_modify_vtables (binfo, data)
- tree binfo;
- void *data;
+dfs_modify_vtables (tree binfo, void* data)
{
if (/* There's no need to modify the vtable for a non-virtual
primary base; we're not going to use that vtable anyhow.
@@ -2499,29 +2236,28 @@ dfs_modify_vtables (binfo, data)
/* Similarly, a base without a vtable needs no modification. */
&& CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
{
- tree t;
+ tree t = (tree) data;
tree virtuals;
tree old_virtuals;
-
- t = (tree) data;
-
+ unsigned ix;
+
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),
+ for (ix = 0, virtuals = BINFO_VIRTUALS (binfo),
old_virtuals = BINFO_VIRTUALS (TYPE_BINFO (BINFO_TYPE (binfo)));
virtuals;
- virtuals = TREE_CHAIN (virtuals),
+ ix++, virtuals = TREE_CHAIN (virtuals),
old_virtuals = TREE_CHAIN (old_virtuals))
update_vtable_entry_for_fn (t,
binfo,
BV_FN (old_virtuals),
- &virtuals);
+ &virtuals, ix);
}
- SET_BINFO_MARKED (binfo);
+ BINFO_MARKED (binfo) = 1;
return NULL_TREE;
}
@@ -2536,19 +2272,14 @@ dfs_modify_vtables (binfo, data)
should therefore be appended to the end of the vtable for T. */
static tree
-modify_all_vtables (t, virtuals)
- tree t;
- tree virtuals;
+modify_all_vtables (tree t, tree virtuals)
{
tree binfo = TYPE_BINFO (t);
tree *fnsp;
/* 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);
+ dfs_walk (binfo, dfs_modify_vtables, unmarkedp, t);
+ dfs_walk (binfo, dfs_unmark, markedp, t);
/* Add virtual functions not already in our primary vtable. These
will be both those introduced by this class, and those overridden
@@ -2581,8 +2312,7 @@ modify_all_vtables (t, virtuals)
indicated NAME. */
static tree
-get_basefndecls (name, t)
- tree name, t;
+get_basefndecls (tree name, tree t)
{
tree methods;
tree base_fndecls = NULL_TREE;
@@ -2621,8 +2351,7 @@ get_basefndecls (name, t)
mark this field as being virtual as well. */
static void
-check_for_override (decl, ctype)
- tree decl, ctype;
+check_for_override (tree decl, tree ctype)
{
if (TREE_CODE (decl) == TEMPLATE_DECL)
/* In [temp.mem] we have:
@@ -2631,7 +2360,8 @@ check_for_override (decl, ctype)
override a virtual function from a base class. */
return;
if ((DECL_DESTRUCTOR_P (decl)
- || IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)))
+ || IDENTIFIER_VIRTUAL_P (DECL_NAME (decl))
+ || DECL_CONV_FN_P (decl))
&& look_for_overrides (ctype, decl)
&& !DECL_STATIC_FUNCTION_P (decl))
/* Set DECL_VINDEX to a value that is neither an INTEGER_CST nor
@@ -2651,8 +2381,7 @@ check_for_override (decl, ctype)
We know that constructors and destructors don't apply. */
void
-warn_hidden (t)
- tree t;
+warn_hidden (tree t)
{
tree method_vec = CLASSTYPE_METHOD_VEC (t);
int n_methods = method_vec ? TREE_VEC_LENGTH (method_vec) : 0;
@@ -2721,8 +2450,7 @@ warn_hidden (t)
things we should check for also. */
static void
-finish_struct_anon (t)
- tree t;
+finish_struct_anon (tree t)
{
tree field;
@@ -2751,10 +2479,6 @@ finish_struct_anon (t)
|| TYPE_ANONYMOUS_P (TREE_TYPE (elt))))
continue;
- 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 (elt) != FIELD_DECL)
{
cp_pedwarn_at ("`%#D' invalid; an anonymous union can only have non-static data members",
@@ -2787,10 +2511,7 @@ finish_struct_anon (t)
(FUNCTION_DECL, TEMPLATE_DECL). */
void
-maybe_add_class_template_decl_list (type, t, friend_p)
- tree type;
- tree t;
- int friend_p;
+maybe_add_class_template_decl_list (tree type, tree t, int friend_p)
{
/* Save some memory by not creating TREE_LIST if TYPE is not template. */
if (CLASSTYPE_TEMPLATE_INFO (type))
@@ -2809,13 +2530,10 @@ maybe_add_class_template_decl_list (type, t, friend_p)
DECL is returned; otherwise the return value is NULL_TREE. */
static void
-add_implicitly_declared_members (t, cant_have_default_ctor,
- cant_have_const_cctor,
- cant_have_const_assignment)
- tree t;
- int cant_have_default_ctor;
- int cant_have_const_cctor;
- int cant_have_const_assignment;
+add_implicitly_declared_members (tree t,
+ int cant_have_default_ctor,
+ int cant_have_const_cctor,
+ int cant_have_const_assignment)
{
tree default_fn;
tree implicit_fns = NULL_TREE;
@@ -2906,8 +2624,7 @@ add_implicitly_declared_members (t, cant_have_default_ctor,
in TYPE, including anonymous union members. */
static int
-count_fields (fields)
- tree fields;
+count_fields (tree fields)
{
tree x;
int n_fields = 0;
@@ -2922,20 +2639,18 @@ count_fields (fields)
}
/* 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. */
+ TREE_LIST FIELDS to the SORTED_FIELDS_TYPE elts, starting at offset IDX. */
static int
-add_fields_to_vec (fields, field_vec, idx)
- tree fields, field_vec;
- int idx;
+add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec, int idx)
{
tree x;
for (x = fields; x; x = TREE_CHAIN (x))
{
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);
+ idx = add_fields_to_record_type (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx);
else
- TREE_VEC_ELT (field_vec, idx++) = x;
+ field_vec->elts[idx++] = x;
}
return idx;
}
@@ -2945,8 +2660,7 @@ add_fields_to_vec (fields, field_vec, idx)
flags. */
static void
-check_bitfield_decl (field)
- tree field;
+check_bitfield_decl (tree field)
{
tree type = TREE_TYPE (field);
tree w = NULL_TREE;
@@ -3013,31 +2727,12 @@ check_bitfield_decl (field)
{
DECL_SIZE (field) = convert (bitsizetype, w);
DECL_BIT_FIELD (field) = 1;
-
- if (integer_zerop (w)
- && ! (* targetm.ms_bitfield_layout_p) (DECL_FIELD_CONTEXT (field)))
- {
-#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
{
/* 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);
}
}
@@ -3046,15 +2741,12 @@ check_bitfield_decl (field)
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;
+check_field_decl (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));
@@ -3118,7 +2810,7 @@ check_field_decl (field, t, cant_have_const_ctor,
/* `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");
+ error ("multiple fields in union `%T' initialized", t);
*any_default_members = 1;
}
}
@@ -3163,9 +2855,6 @@ check_field_decls (tree t, tree *access_decls,
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. */
@@ -3183,7 +2872,15 @@ check_field_decls (tree t, tree *access_decls,
if (TREE_CODE (x) == FIELD_DECL)
{
- DECL_PACKED (x) |= TYPE_PACKED (t);
+ if (TYPE_PACKED (t))
+ {
+ if (!pod_type_p (TREE_TYPE (x)) && !TYPE_PACKED (TREE_TYPE (x)))
+ cp_warning_at
+ ("ignoring packed attribute on unpacked non-POD field `%#D'",
+ x);
+ else
+ DECL_PACKED (x) = 1;
+ }
if (DECL_C_BIT_FIELD (x) && integer_zerop (DECL_INITIAL (x)))
/* We don't treat zero-width bitfields as making a class
@@ -3226,9 +2923,30 @@ check_field_decls (tree t, tree *access_decls,
/* If we've gotten this far, it's a data member, possibly static,
or an enumerator. */
-
DECL_CONTEXT (x) = t;
+ /* When this goes into scope, it will be a non-local reference. */
+ DECL_NONLOCAL (x) = 1;
+
+ if (TREE_CODE (t) == UNION_TYPE)
+ {
+ /* [class.union]
+
+ If a union contains a static data member, or a member of
+ reference type, the program is ill-formed. */
+ if (TREE_CODE (x) == VAR_DECL)
+ {
+ cp_error_at ("`%D' may not be static because it is a member of a union", x);
+ continue;
+ }
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ {
+ cp_error_at ("`%D' may not have reference type `%T' because it is a member of a union",
+ x, type);
+ continue;
+ }
+ }
+
/* ``A local class cannot have static data members.'' ARM 9.4 */
if (current_function_decl && TREE_STATIC (x))
cp_error_at ("field `%D' in local class cannot be static", x);
@@ -3248,31 +2966,13 @@ check_field_decls (tree t, tree *access_decls,
type = build_pointer_type (type);
TREE_TYPE (x) = type;
}
- else if (TREE_CODE (type) == OFFSET_TYPE)
- {
- cp_error_at ("field `%D' invalidly declared offset type", x);
- type = build_pointer_type (type);
- TREE_TYPE (x) = type;
- }
if (type == error_mark_node)
continue;
- /* When this goes into scope, it will be a non-local reference. */
- DECL_NONLOCAL (x) = 1;
-
- if (TREE_CODE (x) == CONST_DECL)
+ if (TREE_CODE (x) == CONST_DECL || TREE_CODE (x) == VAR_DECL)
continue;
- if (TREE_CODE (x) == VAR_DECL)
- {
- if (TREE_CODE (t) == UNION_TYPE)
- /* Unions cannot have static members. */
- cp_error_at ("field `%D' declared static in union", x);
-
- continue;
- }
-
/* Now it can only be a FIELD_DECL. */
if (TREE_PRIVATE (x) || TREE_PROTECTED (x))
@@ -3300,9 +3000,17 @@ check_field_decls (tree t, tree *access_decls,
type = strip_array_types (type);
- if (TREE_CODE (type) == POINTER_TYPE)
+ if (TYPE_PTR_P (type))
has_pointers = 1;
+ if (CLASS_TYPE_P (type))
+ {
+ if (CLASSTYPE_REF_FIELDS_NEED_INIT (type))
+ SET_CLASSTYPE_REF_FIELDS_NEED_INIT (t, 1);
+ if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (type))
+ SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT (t, 1);
+ }
+
if (DECL_MUTABLE_P (x) || TYPE_HAS_MUTABLE_P (type))
CLASSTYPE_HAS_MUTABLE (t) = 1;
@@ -3333,7 +3041,7 @@ check_field_decls (tree t, tree *access_decls,
cp_warning_at ("non-static const member `%#D' in class without a constructor", x);
}
/* A field that is pseudo-const makes the structure likewise. */
- else if (IS_AGGR_TYPE (type))
+ else if (CLASS_TYPE_P (type))
{
C_TYPE_FIELDS_READONLY (t) |= C_TYPE_FIELDS_READONLY (type);
SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT (t,
@@ -3344,8 +3052,7 @@ check_field_decls (tree t, tree *access_decls,
/* 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))
+ if (constructor_name_p (DECL_NAME (x), t) && TYPE_HAS_CONSTRUCTOR (t))
cp_pedwarn_at ("field `%#D' with same name as class", x);
/* We set DECL_C_BIT_FIELD in grokbitfield.
@@ -3389,10 +3096,7 @@ check_field_decls (tree t, tree *access_decls,
OFFSETS. */
static int
-record_subobject_offset (type, offset, offsets)
- tree type;
- tree offset;
- splay_tree offsets;
+record_subobject_offset (tree type, tree offset, splay_tree offsets)
{
splay_tree_node n;
@@ -3417,10 +3121,7 @@ record_subobject_offset (type, offset, offsets)
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;
+check_subobject_offset (tree type, tree offset, splay_tree offsets)
{
splay_tree_node n;
tree t;
@@ -3452,13 +3153,12 @@ check_subobject_offset (type, offset, offsets)
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;
+walk_subobject_offsets (tree type,
+ subobject_offset_fn f,
+ tree offset,
+ splay_tree offsets,
+ tree max_offset,
+ int vbases_p)
{
int r = 0;
tree type_binfo = NULL_TREE;
@@ -3567,22 +3267,14 @@ walk_subobject_offsets (type, f, offset, offsets, max_offset, vbases_p)
virtual. (If it is non-virtual, then it was walked
above.) */
vbase = get_primary_binfo (type_binfo);
- if (vbase && TREE_VIA_VIRTUAL (vbase))
+ if (vbase && TREE_VIA_VIRTUAL (vbase)
+ && BINFO_PRIMARY_BASE_OF (vbase) == type_binfo)
{
- tree derived = type_binfo;
- while (BINFO_INHERITANCE_CHAIN (derived))
- derived = BINFO_INHERITANCE_CHAIN (derived);
- derived = TREE_TYPE (derived);
- vbase = binfo_for_vbase (TREE_TYPE (vbase), derived);
-
- if (BINFO_PRIMARY_BASE_OF (vbase) == type_binfo)
- {
- r = (walk_subobject_offsets
- (vbase, f, offset,
- offsets, max_offset, /*vbases_p=*/0));
- if (r)
- return r;
- }
+ r = (walk_subobject_offsets
+ (vbase, f, offset,
+ offsets, max_offset, /*vbases_p=*/0));
+ if (r)
+ return r;
}
}
}
@@ -3656,11 +3348,10 @@ walk_subobject_offsets (type, f, offset, offsets, max_offset, vbases_p)
examined. */
static void
-record_subobject_offsets (type, offset, offsets, vbases_p)
- tree type;
- tree offset;
- splay_tree offsets;
- int vbases_p;
+record_subobject_offsets (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);
@@ -3671,11 +3362,10 @@ record_subobject_offsets (type, offset, offsets, vbases_p)
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;
+layout_conflict_p (tree type,
+ tree offset,
+ splay_tree offsets,
+ int vbases_p)
{
splay_tree_node max_node;
@@ -3704,7 +3394,6 @@ layout_nonempty_base_or_field (record_layout_info rli,
tree binfo,
splay_tree offsets)
{
- tree t = rli->t;
tree offset = NULL_TREE;
bool field_p;
tree type;
@@ -3734,14 +3423,14 @@ layout_nonempty_base_or_field (record_layout_info 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:
+ For example, consider:
- struct S {};
- struct T : public S { int i; };
- struct U : public S, public T {};
+ 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
@@ -3750,6 +3439,10 @@ layout_nonempty_base_or_field (record_layout_info rli,
empty class, have nonzero size, any overlap can happen only
with a direct or indirect base-class -- it can't happen with
a data member. */
+ /* In a union, overlap is permitted; all members are placed at
+ offset zero. */
+ if (TREE_CODE (rli->t) == UNION_TYPE)
+ break;
/* G++ 3.2 did not check for overlaps when placing a non-empty
virtual base. */
if (!abi_version_at_least (2) && binfo && TREE_VIA_VIRTUAL (binfo))
@@ -3785,8 +3478,7 @@ layout_nonempty_base_or_field (record_layout_info rli,
propagate_binfo_offsets (binfo,
size_diffop (convert (ssizetype, offset),
convert (ssizetype,
- BINFO_OFFSET (binfo))),
- t);
+ BINFO_OFFSET (binfo))));
}
/* Returns true if TYPE is empty and OFFSET is nonzero. */
@@ -3806,11 +3498,7 @@ empty_base_at_nonzero_offset_p (tree type,
type. Return nonzero 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;
+layout_empty_base (tree binfo, tree eoc, splay_tree offsets)
{
tree alignment;
tree basetype = BINFO_TYPE (binfo);
@@ -3819,14 +3507,18 @@ layout_empty_base (binfo, eoc, offsets, t)
/* This routine should only be used for empty classes. */
my_friendly_assert (is_empty_class (basetype), 20000321);
alignment = ssize_int (CLASSTYPE_ALIGN_UNIT (basetype));
-
- if (abi_version_at_least (2))
- BINFO_OFFSET (binfo) = size_zero_node;
- if (warn_abi && !integer_zerop (BINFO_OFFSET (binfo)))
- warning ("offset of empty base `%T' may not be ABI-compliant and may"
- "change in a future version of GCC",
- BINFO_TYPE (binfo));
+ if (!integer_zerop (BINFO_OFFSET (binfo)))
+ {
+ if (abi_version_at_least (2))
+ propagate_binfo_offsets
+ (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo)));
+ else if (warn_abi)
+ warning ("offset of empty base `%T' may not be ABI-compliant and may"
+ "change in a future version of GCC",
+ BINFO_TYPE (binfo));
+ }
+
/* This is an empty base class. We first try to put it at offset
zero. */
if (layout_conflict_p (binfo,
@@ -3837,7 +3529,7 @@ layout_empty_base (binfo, eoc, offsets, t)
/* 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);
+ propagate_binfo_offsets (binfo, convert (ssizetype, eoc));
while (1)
{
if (!layout_conflict_p (binfo,
@@ -3848,7 +3540,7 @@ layout_empty_base (binfo, eoc, offsets, t)
break;
/* There's overlap here, too. Bump along to the next spot. */
- propagate_binfo_offsets (binfo, alignment, t);
+ propagate_binfo_offsets (binfo, alignment);
}
}
return atend;
@@ -3912,7 +3604,7 @@ build_base_field (record_layout_info rli, tree binfo,
byte-aligned. */
eoc = round_up (rli_size_unit_so_far (rli),
CLASSTYPE_ALIGN_UNIT (basetype));
- atend = layout_empty_base (binfo, eoc, offsets, t);
+ atend = layout_empty_base (binfo, eoc, offsets);
/* A nearly-empty class "has no proper base class that is empty,
not morally virtual, and at an offset other than zero." */
if (!TREE_VIA_VIRTUAL (binfo) && CLASSTYPE_NEARLY_EMPTY_P (t))
@@ -3991,11 +3683,9 @@ build_base_fields (record_layout_info rli,
if (base_binfo == CLASSTYPE_PRIMARY_BINFO (t))
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))
+ /* Virtual bases are added at the end (a primary virtual base
+ will have already been added). */
+ if (TREE_VIA_VIRTUAL (base_binfo))
continue;
next_field = build_base_field (rli, base_binfo,
@@ -4008,8 +3698,7 @@ build_base_fields (record_layout_info rli,
methods, and so forth. */
static void
-check_methods (t)
- tree t;
+check_methods (tree t)
{
tree x;
@@ -4041,9 +3730,7 @@ check_methods (t)
NAME. */
static tree
-build_clone (fn, name)
- tree fn;
- tree name;
+build_clone (tree fn, tree name)
{
tree parms;
tree clone;
@@ -4092,12 +3779,15 @@ build_clone (fn, name)
/* 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);
+ = build_method_type_directly (basetype,
+ TREE_TYPE (TREE_TYPE (clone)),
+ parmtypes);
if (exceptions)
TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone),
exceptions);
+ TREE_TYPE (clone)
+ = cp_build_type_attribute_variant (TREE_TYPE (clone),
+ TYPE_ATTRIBUTES (TREE_TYPE (fn)));
}
/* Copy the function parameters. But, DECL_ARGUMENTS on a TEMPLATE_DECL
@@ -4162,9 +3852,7 @@ build_clone (fn, name)
CLASTYPE_METHOD_VEC as well. */
void
-clone_function_decl (fn, update_method_vec_p)
- tree fn;
- int update_method_vec_p;
+clone_function_decl (tree fn, int update_method_vec_p)
{
tree clone;
@@ -4223,8 +3911,7 @@ clone_function_decl (fn, update_method_vec_p)
clones. */
void
-adjust_clone_args (decl)
- tree decl;
+adjust_clone_args (tree decl)
{
tree clone;
@@ -4274,9 +3961,9 @@ adjust_clone_args (decl)
clone_parms);
TREE_TYPE (clone_parms) = TREE_TYPE (orig_clone_parms);
}
- type = build_cplus_method_type (basetype,
- TREE_TYPE (TREE_TYPE (clone)),
- clone_parms);
+ type = build_method_type_directly (basetype,
+ TREE_TYPE (TREE_TYPE (clone)),
+ clone_parms);
if (exceptions)
type = build_exception_variant (type, exceptions);
TREE_TYPE (clone) = type;
@@ -4293,8 +3980,7 @@ adjust_clone_args (decl)
in-charge and not-in-charge variant. */
static void
-clone_constructors_and_destructors (t)
- tree t;
+clone_constructors_and_destructors (tree t)
{
tree fns;
@@ -4312,8 +3998,7 @@ clone_constructors_and_destructors (t)
/* Remove all zero-width bit-fields from T. */
static void
-remove_zero_width_bit_fields (t)
- tree t;
+remove_zero_width_bit_fields (tree t)
{
tree *fieldsp;
@@ -4333,8 +4018,7 @@ remove_zero_width_bit_fields (t)
array whose elements have the indicated class TYPE. */
static bool
-type_requires_array_cookie (type)
- tree type;
+type_requires_array_cookie (tree type)
{
tree fns;
bool has_two_argument_delete_p = false;
@@ -4476,9 +4160,7 @@ check_bases_and_members (tree t)
on VIRTUALS_P. */
static tree
-create_vtable_ptr (t, virtuals_p)
- tree t;
- tree *virtuals_p;
+create_vtable_ptr (tree t, tree* virtuals_p)
{
tree fn;
@@ -4512,7 +4194,7 @@ create_vtable_ptr (t, virtuals_p)
type-based alias analysis code would decide that assignments
to the base class vtable pointer can't alias assignments to
the derived class vtable pointer, since they have different
- types. Thus, in an derived class destructor, where the base
+ types. Thus, in a derived class destructor, where the base
class constructor was inlined, we could generate bad code for
setting up the vtable pointer.
@@ -4529,8 +4211,6 @@ create_vtable_ptr (t, virtuals_p)
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;
@@ -4554,8 +4234,7 @@ create_vtable_ptr (t, virtuals_p)
complete. */
static void
-fixup_pending_inline (fn)
- tree fn;
+fixup_pending_inline (tree fn)
{
if (DECL_PENDING_INLINE_INFO (fn))
{
@@ -4572,8 +4251,7 @@ fixup_pending_inline (fn)
complete. */
static void
-fixup_inline_methods (type)
- tree type;
+fixup_inline_methods (tree type)
{
tree method = TYPE_METHODS (type);
@@ -4605,10 +4283,7 @@ fixup_inline_methods (type)
OFFSET, which is a type offset, is number of bytes. */
static void
-propagate_binfo_offsets (binfo, offset, t)
- tree binfo;
- tree offset;
- tree t;
+propagate_binfo_offsets (tree binfo, tree offset)
{
int i;
tree primary_binfo;
@@ -4649,39 +4324,11 @@ propagate_binfo_offsets (binfo, offset, t)
/* 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)))
+ && BINFO_PRIMARY_BASE_OF (base_binfo) != binfo)
continue;
- propagate_binfo_offsets (base_binfo, offset, t);
- }
-}
-
-/* Called via dfs_walk from layout_virtual bases. */
-
-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))
- {
- 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);
- }
+ propagate_binfo_offsets (base_binfo, offset);
}
-
- return NULL_TREE;
}
/* Set BINFO_OFFSET for all of the virtual bases for RLI->T. Update
@@ -4691,7 +4338,7 @@ dfs_set_offset_for_unshared_vbases (binfo, data)
static void
layout_virtual_bases (record_layout_info rli, splay_tree offsets)
{
- tree vbases;
+ tree vbase;
tree t = rli->t;
bool first_vbase = true;
tree *next_field;
@@ -4707,7 +4354,7 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
#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);
+ TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), (unsigned) STRUCTURE_SIZE_BOUNDARY);
#endif
rli->offset = TYPE_SIZE_UNIT (t);
rli->bitpos = bitsize_zero_node;
@@ -4723,17 +4370,11 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
/* 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))
+ for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
{
- tree vbase;
-
- if (!TREE_VIA_VIRTUAL (vbases))
+ if (!TREE_VIA_VIRTUAL (vbase))
continue;
- vbase = binfo_for_vbase (BINFO_TYPE (vbases), t);
-
if (!BINFO_PRIMARY_P (vbase))
{
tree basetype = TREE_TYPE (vbase);
@@ -4764,13 +4405,6 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
first_vbase = false;
}
}
-
- /* 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);
}
/* Returns the offset of the byte just past the end of the base class
@@ -4797,9 +4431,7 @@ end_of_base (tree binfo)
only non-virtual bases are included. */
static tree
-end_of_class (t, include_virtuals_p)
- tree t;
- int include_virtuals_p;
+end_of_class (tree t, int include_virtuals_p)
{
tree result = size_zero_node;
tree binfo;
@@ -4845,8 +4477,7 @@ end_of_class (t, include_virtuals_p)
subobjects of U. */
static void
-warn_about_ambiguous_bases (t)
- tree t;
+warn_about_ambiguous_bases (tree t)
{
int i;
tree vbases;
@@ -4879,9 +4510,7 @@ warn_about_ambiguous_bases (t)
/* Compare two INTEGER_CSTs K1 and K2. */
static int
-splay_tree_compare_integer_csts (k1, k2)
- splay_tree_key k1;
- splay_tree_key k2;
+splay_tree_compare_integer_csts (splay_tree_key k1, splay_tree_key k2)
{
return tree_int_cst_compare ((tree) k1, (tree) k2);
}
@@ -4906,7 +4535,19 @@ include_empty_classes (record_layout_info rli)
if (TREE_CODE (rli_size) == INTEGER_CST
&& INT_CST_LT_UNSIGNED (rli_size, eoc))
{
- rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT);
+ if (!abi_version_at_least (2))
+ /* In version 1 of the ABI, the size of a class that ends with
+ a bitfield was not rounded up to a whole multiple of a
+ byte. Because rli_size_unit_so_far returns only the number
+ of fully allocated bytes, any extra bits were not included
+ in the size. */
+ rli->bitpos = round_down (rli->bitpos, BITS_PER_UNIT);
+ else
+ /* The size should have been rounded to a whole byte. */
+ my_friendly_assert (tree_int_cst_equal (rli->bitpos,
+ round_down (rli->bitpos,
+ BITS_PER_UNIT)),
+ 20030903);
rli->bitpos
= size_binop (PLUS_EXPR,
rli->bitpos,
@@ -4996,6 +4637,8 @@ layout_class_type (tree t, tree *virtuals_p)
}
type = TREE_TYPE (field);
+
+ padding = NULL_TREE;
/* If this field is a bit-field whose width is greater than its
type, then there are some special rules for allocating
@@ -5005,7 +4648,7 @@ layout_class_type (tree t, tree *virtuals_p)
{
integer_type_kind itk;
tree integer_type;
-
+ bool was_unnamed_p = false;
/* 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
@@ -5020,25 +4663,47 @@ layout_class_type (tree t, tree *virtuals_p)
type that fits. */
integer_type = integer_types[itk - 1];
- if (abi_version_at_least (2) && TREE_CODE (t) == UNION_TYPE)
- /* In a union, the padding field must have the full width
- of the bit-field; all fields start at offset zero. */
- padding = DECL_SIZE (field);
- else
+ /* Figure out how much additional padding is required. GCC
+ 3.2 always created a padding field, even if it had zero
+ width. */
+ if (!abi_version_at_least (2)
+ || INT_CST_LT (TYPE_SIZE (integer_type), DECL_SIZE (field)))
+ {
+ if (abi_version_at_least (2) && TREE_CODE (t) == UNION_TYPE)
+ /* In a union, the padding field must have the full width
+ of the bit-field; all fields start at offset zero. */
+ padding = DECL_SIZE (field);
+ else
+ {
+ if (warn_abi && TREE_CODE (t) == UNION_TYPE)
+ warning ("size assigned to `%T' may not be "
+ "ABI-compliant and may change in a future "
+ "version of GCC",
+ t);
+ padding = size_binop (MINUS_EXPR, DECL_SIZE (field),
+ TYPE_SIZE (integer_type));
+ }
+ }
+#ifdef PCC_BITFIELD_TYPE_MATTERS
+ /* An unnamed bitfield does not normally affect the
+ alignment of the containing class on a target where
+ PCC_BITFIELD_TYPE_MATTERS. But, the C++ ABI does not
+ make any exceptions for unnamed bitfields when the
+ bitfields are longer than their types. Therefore, we
+ temporarily give the field a name. */
+ if (PCC_BITFIELD_TYPE_MATTERS && !DECL_NAME (field))
{
- if (warn_abi && TREE_CODE (t) == UNION_TYPE)
- warning ("size assigned to `%T' may not be "
- "ABI-compliant and may change in a future "
- "version of GCC",
- t);
- padding = size_binop (MINUS_EXPR, DECL_SIZE (field),
- TYPE_SIZE (integer_type));
+ was_unnamed_p = true;
+ DECL_NAME (field) = make_anon_name ();
}
+#endif
DECL_SIZE (field) = TYPE_SIZE (integer_type);
DECL_ALIGN (field) = TYPE_ALIGN (integer_type);
DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (integer_type);
layout_nonempty_base_or_field (rli, field, NULL_TREE,
empty_base_offsets);
+ if (was_unnamed_p)
+ DECL_NAME (field) = NULL_TREE;
/* Now that layout has been performed, set the size of the
field to the size of its declared type; the rest of the
field is effectively invisible. */
@@ -5054,11 +4719,8 @@ layout_class_type (tree t, tree *virtuals_p)
"change in a future version of GCC", field);
}
else
- {
- padding = NULL_TREE;
- layout_nonempty_base_or_field (rli, field, NULL_TREE,
- empty_base_offsets);
- }
+ layout_nonempty_base_or_field (rli, field, NULL_TREE,
+ empty_base_offsets);
/* Remember the location of any empty classes in FIELD. */
if (abi_version_at_least (2))
@@ -5101,8 +4763,8 @@ layout_class_type (tree t, tree *virtuals_p)
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;
+ DECL_CONTEXT (padding_field) = t;
+ DECL_ARTIFICIAL (padding_field) = 1;
layout_nonempty_base_or_field (rli, padding_field,
NULL_TREE,
empty_base_offsets);
@@ -5189,6 +4851,8 @@ layout_class_type (tree t, tree *virtuals_p)
DECL_FIELD_OFFSET (*next_field) = DECL_FIELD_OFFSET (field);
DECL_FIELD_BIT_OFFSET (*next_field)
= DECL_FIELD_BIT_OFFSET (field);
+ DECL_SIZE (*next_field) = DECL_SIZE (field);
+ DECL_MODE (*next_field) = DECL_MODE (field);
next_field = &TREE_CHAIN (*next_field);
}
@@ -5261,8 +4925,7 @@ key_method (tree type)
is complete. */
void
-finish_struct_1 (t)
- tree t;
+finish_struct_1 (tree t)
{
tree x;
/* A TREE_LIST. The TREE_VALUE of each node is a FUNCTION_DECL. */
@@ -5283,7 +4946,6 @@ finish_struct_1 (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;
fixup_inline_methods (t);
@@ -5298,19 +4960,23 @@ finish_struct_1 (t)
bases and members and add implicitly generated methods. */
check_bases_and_members (t);
- /* Find the key method */
- if (TYPE_CONTAINS_VPTR_P (t))
+ /* Find the key method. */
+ if (TYPE_CONTAINS_VPTR_P (t))
{
CLASSTYPE_KEY_METHOD (t) = key_method (t);
/* If a polymorphic class has no key method, we may emit the vtable
- in every translation unit where the class definition appears. */
+ in every translation unit where the class definition appears. */
if (CLASSTYPE_KEY_METHOD (t) == NULL_TREE)
keyed_classes = tree_cons (NULL_TREE, t, keyed_classes);
}
/* Layout the class itself. */
layout_class_type (t, &virtuals);
+ if (CLASSTYPE_AS_BASE (t) != t)
+ /* We use the base type for trivial assignments, and hence it
+ needs a mode. */
+ compute_record_mode (CLASSTYPE_AS_BASE (t));
/* Make sure that we get our own copy of the vfield FIELD_DECL. */
vfield = TYPE_VFIELD (t);
@@ -5348,7 +5014,7 @@ finish_struct_1 (t)
/* 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))
+ else if (! BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (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);
@@ -5375,8 +5041,17 @@ finish_struct_1 (t)
fn = TREE_CHAIN (fn),
vindex += (TARGET_VTABLE_USES_DESCRIPTORS
? TARGET_VTABLE_USES_DESCRIPTORS : 1))
- if (TREE_CODE (DECL_VINDEX (BV_FN (fn))) != INTEGER_CST)
- DECL_VINDEX (BV_FN (fn)) = build_shared_int_cst (vindex);
+ {
+ tree fndecl = BV_FN (fn);
+
+ if (DECL_THUNK_P (fndecl))
+ /* A thunk. We should never be calling this entry directly
+ from this vtable -- we'd use the entry for the non
+ thunk base function. */
+ DECL_VINDEX (fndecl) = NULL_TREE;
+ else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
+ DECL_VINDEX (fndecl) = build_shared_int_cst (vindex);
+ }
}
finish_struct_bits (t);
@@ -5398,10 +5073,12 @@ finish_struct_1 (t)
n_fields = count_fields (TYPE_FIELDS (t));
if (n_fields > 7)
{
- 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);
+ struct sorted_fields_type *field_vec = ggc_alloc (sizeof (struct sorted_fields_type)
+ + n_fields * sizeof (tree));
+ field_vec->len = n_fields;
+ add_fields_to_record_type (TYPE_FIELDS (t), field_vec, 0);
+ qsort (field_vec->elts, n_fields, sizeof (tree),
+ 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;
@@ -5448,8 +5125,7 @@ finish_struct_1 (t)
order. Rearrange them to declaration order. */
void
-unreverse_member_declarations (t)
- tree t;
+unreverse_member_declarations (tree t)
{
tree next;
tree prev;
@@ -5480,11 +5156,9 @@ unreverse_member_declarations (t)
}
tree
-finish_struct (t, attributes)
- tree t, attributes;
+finish_struct (tree t, tree attributes)
{
- const char *saved_filename = input_filename;
- int saved_lineno = lineno;
+ location_t saved_loc = input_location;
/* Now that we've got all the field declarations, reverse everything
as necessary. */
@@ -5494,8 +5168,7 @@ finish_struct (t, attributes)
/* 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));
+ input_location = DECL_SOURCE_LOCATION (TYPE_NAME (t));
if (processing_template_decl)
{
@@ -5505,8 +5178,7 @@ finish_struct (t, attributes)
else
finish_struct_1 (t);
- input_filename = saved_filename;
- lineno = saved_lineno;
+ input_location = saved_loc;
TYPE_BEING_DEFINED (t) = 0;
@@ -5530,10 +5202,7 @@ finish_struct (t, attributes)
before this function is called. */
static tree
-fixed_type_or_null (instance, nonnull, cdtorp)
- tree instance;
- int *nonnull;
- int *cdtorp;
+fixed_type_or_null (tree instance, int* nonnull, int* cdtorp)
{
switch (TREE_CODE (instance))
{
@@ -5665,9 +5334,7 @@ fixed_type_or_null (instance, nonnull, cdtorp)
before this function is called. */
int
-resolves_to_fixed_type_p (instance, nonnull)
- tree instance;
- int *nonnull;
+resolves_to_fixed_type_p (tree instance, int* nonnull)
{
tree t = TREE_TYPE (instance);
int cdtorp = 0;
@@ -5684,51 +5351,21 @@ resolves_to_fixed_type_p (instance, nonnull)
void
-init_class_processing ()
+init_class_processing (void)
{
current_class_depth = 0;
current_class_stack_size = 10;
current_class_stack
- = (class_stack_node_t) xmalloc (current_class_stack_size
- * sizeof (struct class_stack_node));
+ = xmalloc (current_class_stack_size * sizeof (struct class_stack_node));
VARRAY_TREE_INIT (local_classes, 8, "local_classes");
- access_default_node = build_int_2 (0, 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 (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);
-
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
- STRUCT, UNION, or ENUM environment.
-
- NAME may end up being NULL_TREE if this is an anonymous or
- late-bound struct (as in "struct { ... } foo;") */
-
-/* Set global variables CURRENT_CLASS_NAME and CURRENT_CLASS_TYPE to
- appropriate values, found by looking up the type definition of
- NAME (as a CODE).
-
- If MODIFY is 1, we set IDENTIFIER_CLASS_VALUE's of names
- which can be seen locally to the class. They are shadowed by
- any subsequent local declaration (including parameter names).
-
- If MODIFY is 2, we set IDENTIFIER_CLASS_VALUE's of names
- which have static meaning (i.e., static members, static
- member functions, enum declarations, etc).
-
- If MODIFY is 3, we set IDENTIFIER_CLASS_VALUE of names
- which can be seen locally to the class (as in 1), but
- know that we are doing this for declaration purposes
- (i.e. friend foo::bar (int)).
+/* Set global variables CURRENT_CLASS_NAME and CURRENT_CLASS_TYPE as
+ appropriate for TYPE.
So that we may avoid calls to lookup_name, we cache the _TYPE
nodes of local TYPE_DECLs in the TREE_TYPE field of the name.
@@ -5742,9 +5379,7 @@ init_class_processing ()
that name becomes `error_mark_node'. */
void
-pushclass (type, modify)
- tree type;
- int modify;
+pushclass (tree type)
{
type = TYPE_MAIN_VARIANT (type);
@@ -5753,9 +5388,9 @@ pushclass (type, modify)
{
current_class_stack_size *= 2;
current_class_stack
- = (class_stack_node_t) xrealloc (current_class_stack,
- current_class_stack_size
- * sizeof (struct class_stack_node));
+ = xrealloc (current_class_stack,
+ current_class_stack_size
+ * sizeof (struct class_stack_node));
}
/* Insert a new entry on the class stack. */
@@ -5788,39 +5423,50 @@ pushclass (type, modify)
/* If we're about to enter a nested class, clear
IDENTIFIER_CLASS_VALUE for the enclosing classes. */
- if (modify && current_class_depth > 1)
+ if (current_class_depth > 1)
clear_identifier_class_values ();
pushlevel_class ();
- if (modify)
+ if (type != previous_class_type || current_class_depth > 1)
{
- if (type != previous_class_type || current_class_depth > 1)
- push_class_decls (type);
- else
+ push_class_decls (type);
+ if (CLASSTYPE_TEMPLATE_INFO (type) && !CLASSTYPE_USE_TEMPLATE (type))
{
- tree item;
-
- /* We are re-entering the same class we just left, so we
- don't have to search the whole inheritance matrix to find
- all the decls to bind again. Instead, we install the
- cached class_shadowed list, and walk through it binding
- names and setting up IDENTIFIER_TYPE_VALUEs. */
- set_class_shadows (previous_class_values);
- for (item = previous_class_values; item; item = TREE_CHAIN (item))
- {
- tree id = TREE_PURPOSE (item);
- tree decl = TREE_TYPE (item);
-
- push_class_binding (id, decl);
- if (TREE_CODE (decl) == TYPE_DECL)
- set_identifier_type_value (id, TREE_TYPE (decl));
- }
- unuse_fields (type);
+ /* If we are entering the scope of a template declaration (not a
+ specialization), we need to push all the using decls with
+ dependent scope too. */
+ tree fields;
+
+ for (fields = TYPE_FIELDS (type);
+ fields; fields = TREE_CHAIN (fields))
+ if (TREE_CODE (fields) == USING_DECL && !TREE_TYPE (fields))
+ pushdecl_class_level (fields);
}
+ }
+ else
+ {
+ tree item;
- cxx_remember_type_decls (CLASSTYPE_NESTED_UDTS (type));
+ /* We are re-entering the same class we just left, so we don't
+ have to search the whole inheritance matrix to find all the
+ decls to bind again. Instead, we install the cached
+ class_shadowed list, and walk through it binding names and
+ setting up IDENTIFIER_TYPE_VALUEs. */
+ set_class_shadows (previous_class_values);
+ for (item = previous_class_values; item; item = TREE_CHAIN (item))
+ {
+ tree id = TREE_PURPOSE (item);
+ tree decl = TREE_TYPE (item);
+
+ push_class_binding (id, decl);
+ if (TREE_CODE (decl) == TYPE_DECL)
+ set_identifier_type_value (id, decl);
+ }
+ unuse_fields (type);
}
+
+ cxx_remember_type_decls (CLASSTYPE_NESTED_UTDS (type));
}
/* When we exit a toplevel class scope, we save the
@@ -5829,7 +5475,7 @@ pushclass (type, modify)
must invalidate our cache. */
void
-invalidate_class_lookup_cache ()
+invalidate_class_lookup_cache (void)
{
tree t;
@@ -5845,7 +5491,7 @@ invalidate_class_lookup_cache ()
previously, that is the one popped to. */
void
-popclass ()
+popclass (void)
{
poplevel_class ();
pop_class_decls ();
@@ -5863,14 +5509,14 @@ popclass ()
no type. */
int
-currently_open_class (t)
- tree t;
+currently_open_class (tree t)
{
int i;
- if (t == current_class_type)
+ if (current_class_type && same_type_p (t, current_class_type))
return 1;
for (i = 1; i < current_class_depth; ++i)
- if (current_class_stack [i].type == t)
+ if (current_class_stack[i].type
+ && same_type_p (current_class_stack [i].type, t))
return 1;
return 0;
}
@@ -5880,11 +5526,17 @@ currently_open_class (t)
something via unqualified lookup. */
tree
-currently_open_derived_class (t)
- tree t;
+currently_open_derived_class (tree t)
{
int i;
+ /* The bases of a dependent type are unknown. */
+ if (dependent_type_p (t))
+ return NULL_TREE;
+
+ if (!current_class_type)
+ return NULL_TREE;
+
if (DERIVED_FROM_P (t, current_class_type))
return current_class_type;
@@ -5896,16 +5548,13 @@ currently_open_derived_class (t)
}
/* 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
- enclosing class contexts until global or a local scope is reached.
- TYPE is the enclosed class and MODIFY is equivalent with the pushclass
- formal of the same name. */
+ static meaning (static variables, static functions, types and
+ enumerators) have to be visible. This recursive function calls
+ pushclass for all enclosing class contexts until global or a local
+ scope is reached. TYPE is the enclosed class. */
void
-push_nested_class (type, modify)
- tree type;
- int modify;
+push_nested_class (tree type)
{
tree context;
@@ -5921,14 +5570,14 @@ push_nested_class (type, modify)
context = DECL_CONTEXT (TYPE_MAIN_DECL (type));
if (context && CLASS_TYPE_P (context))
- push_nested_class (context, 2);
- pushclass (type, modify);
+ push_nested_class (context);
+ pushclass (type);
}
-/* Undoes a push_nested_class call. MODIFY is passed on to popclass. */
+/* Undoes a push_nested_class call. */
void
-pop_nested_class ()
+pop_nested_class (void)
{
tree context = DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type));
@@ -5940,7 +5589,7 @@ pop_nested_class ()
/* Returns the number of extern "LANG" blocks we are nested within. */
int
-current_lang_depth ()
+current_lang_depth (void)
{
return VARRAY_ACTIVE_SIZE (current_lang_base);
}
@@ -5949,8 +5598,7 @@ current_lang_depth ()
so that behavior of name-mangling machinery is correct. */
void
-push_lang_context (name)
- tree name;
+push_lang_context (tree name)
{
VARRAY_PUSH_TREE (current_lang_base, current_lang_name);
@@ -5985,7 +5633,7 @@ push_lang_context (name)
/* Get out of the current language scope. */
void
-pop_lang_context ()
+pop_lang_context (void)
{
current_lang_name = VARRAY_TOP_TREE (current_lang_base);
VARRAY_POP (current_lang_base);
@@ -5995,25 +5643,18 @@ 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
- nonzero. Permit pointers to member function if PTRMEM is nonzero.
- If TEMPLATE_ONLY, the name of the overloaded function
- was a template-id, and EXPLICIT_TARGS are the explicitly provided
+ error_mark_node, and issue a error & warning messages under control
+ of FLAGS. Permit pointers to member function if FLAGS permits. 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,
- flags,
- ptrmem,
- template_only,
- explicit_targs)
- tree target_type;
- tree overload;
- tsubst_flags_t flags;
- int ptrmem;
- int template_only;
- tree explicit_targs;
+resolve_address_of_overloaded_function (tree target_type,
+ tree overload,
+ tsubst_flags_t flags,
+ bool template_only,
+ tree explicit_targs)
{
/* Here's what the standard says:
@@ -6056,9 +5697,8 @@ 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);
-
+ my_friendly_assert (is_overloaded_fn (overload), 20030910);
+
/* Check that the TARGET_TYPE is reasonable. */
if (TYPE_PTRFN_P (target_type))
/* This is OK. */;
@@ -6089,9 +5729,9 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
{
tree fns;
- for (fns = overload; fns; fns = OVL_CHAIN (fns))
+ for (fns = overload; fns; fns = OVL_NEXT (fns))
{
- tree fn = OVL_FUNCTION (fns);
+ tree fn = OVL_CURRENT (fns);
tree fntype;
if (TREE_CODE (fn) == TEMPLATE_DECL)
@@ -6142,9 +5782,9 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
if (TREE_CODE (target_fn_type) == METHOD_TYPE)
target_arg_types = TREE_CHAIN (target_arg_types);
- for (fns = overload; fns; fns = OVL_CHAIN (fns))
+ for (fns = overload; fns; fns = OVL_NEXT (fns))
{
- tree fn = OVL_FUNCTION (fns);
+ tree fn = OVL_CURRENT (fns);
tree instantiation;
tree instantiation_type;
tree targs;
@@ -6168,7 +5808,7 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
continue;
/* Instantiate the template. */
- instantiation = instantiate_template (fn, targs);
+ instantiation = instantiate_template (fn, targs, flags);
if (instantiation == error_mark_node)
/* Instantiation failed. */
continue;
@@ -6242,7 +5882,7 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
fn = TREE_PURPOSE (matches);
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
- && !ptrmem && !flag_ms_extensions)
+ && !(flags & tf_ptrmem_ok) && !flag_ms_extensions)
{
static int explained;
@@ -6279,7 +5919,7 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
/* 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. FLAGS is a bit mask. If ITF_COMPLAIN is set, then
+ error_mark_node. FLAGS is a bit mask. If TF_ERROR 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.
@@ -6288,33 +5928,36 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
function, or a pointer to member function. */
tree
-instantiate_type (lhstype, rhs, flags)
- tree lhstype, rhs;
- tsubst_flags_t flags;
+instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
{
tsubst_flags_t flags_in = flags;
- int complain = (flags & tf_error);
- int strict = (flags & tf_no_attributes)
- ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
- int allow_ptrmem = flags & tf_ptrmem_ok;
flags &= ~tf_ptrmem_ok;
if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
{
- if (complain)
+ if (flags & tf_error)
error ("not enough type information");
return error_mark_node;
}
if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs)))
{
- if (comptypes (lhstype, TREE_TYPE (rhs), strict))
+ if (same_type_p (lhstype, TREE_TYPE (rhs)))
return rhs;
- if (complain)
- error ("argument of type `%T' does not match `%T'",
- TREE_TYPE (rhs), lhstype);
- return error_mark_node;
+ if (flag_ms_extensions
+ && TYPE_PTRMEMFUNC_P (lhstype)
+ && !TYPE_PTRMEMFUNC_P (TREE_TYPE (rhs)))
+ /* Microsoft allows `A::f' to be resolved to a
+ pointer-to-member. */
+ ;
+ else
+ {
+ if (flags & tf_error)
+ error ("argument of type `%T' does not match `%T'",
+ TREE_TYPE (rhs), lhstype);
+ return error_mark_node;
+ }
}
if (TREE_CODE (rhs) == BASELINK)
@@ -6361,13 +6004,21 @@ instantiate_type (lhstype, rhs, flags)
return instantiate_type (lhstype, rhs, flags);
case COMPONENT_REF:
- return instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
+ {
+ tree addr = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
+
+ if (addr != error_mark_node
+ && TREE_SIDE_EFFECTS (TREE_OPERAND (rhs, 0)))
+ /* Do not lose object's side effects. */
+ addr = build (COMPOUND_EXPR, TREE_TYPE (addr),
+ TREE_OPERAND (rhs, 0), addr);
+ return addr;
+ }
case OFFSET_REF:
rhs = TREE_OPERAND (rhs, 1);
if (BASELINK_P (rhs))
- return instantiate_type (lhstype, BASELINK_FUNCTIONS (rhs),
- flags | allow_ptrmem);
+ return instantiate_type (lhstype, BASELINK_FUNCTIONS (rhs), flags_in);
/* This can happen if we are forming a pointer-to-member for a
member template. */
@@ -6381,21 +6032,16 @@ instantiate_type (lhstype, rhs, flags)
tree args = TREE_OPERAND (rhs, 1);
return
- resolve_address_of_overloaded_function (lhstype,
- fns,
- flags_in,
- allow_ptrmem,
- /*template_only=*/1,
+ resolve_address_of_overloaded_function (lhstype, fns, flags_in,
+ /*template_only=*/true,
args);
}
case OVERLOAD:
+ case FUNCTION_DECL:
return
- resolve_address_of_overloaded_function (lhstype,
- rhs,
- flags_in,
- allow_ptrmem,
- /*template_only=*/0,
+ resolve_address_of_overloaded_function (lhstype, rhs, flags_in,
+ /*template_only=*/false,
/*explicit_targs=*/NULL_TREE);
case TREE_LIST:
@@ -6443,7 +6089,6 @@ instantiate_type (lhstype, rhs, flags)
case ABS_EXPR:
case MAX_EXPR:
case MIN_EXPR:
- case FFS_EXPR:
case BIT_AND_EXPR:
case BIT_IOR_EXPR:
@@ -6457,7 +6102,7 @@ instantiate_type (lhstype, rhs, flags)
case PREDECREMENT_EXPR:
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
- if (complain)
+ if (flags & tf_error)
error ("invalid operation on uninstantiated type");
return error_mark_node;
@@ -6473,14 +6118,14 @@ instantiate_type (lhstype, rhs, flags)
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
case TRUTH_NOT_EXPR:
- if (complain)
+ if (flags & tf_error)
error ("not enough type information");
return error_mark_node;
case COND_EXPR:
if (type_unknown_p (TREE_OPERAND (rhs, 0)))
{
- if (complain)
+ if (flags & tf_error)
error ("not enough type information");
return error_mark_node;
}
@@ -6532,8 +6177,7 @@ instantiate_type (lhstype, rhs, flags)
all be the same name. Who knows for multiple inheritance). */
static tree
-get_vfield_name (type)
- tree type;
+get_vfield_name (tree type)
{
tree binfo = TYPE_BINFO (type);
char *buf;
@@ -6544,21 +6188,18 @@ get_vfield_name (type)
binfo = BINFO_BASETYPE (binfo, 0);
type = BINFO_TYPE (binfo);
- buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT)
- + TYPE_NAME_LENGTH (type) + 2);
+ buf = alloca (sizeof (VFIELD_NAME_FORMAT) + TYPE_NAME_LENGTH (type) + 2);
sprintf (buf, VFIELD_NAME_FORMAT,
IDENTIFIER_POINTER (constructor_name (type)));
return get_identifier (buf);
}
void
-print_class_statistics ()
+print_class_statistics (void)
{
#ifdef GATHER_STATISTICS
fprintf (stderr, "convert_harshness = %d\n", n_convert_harshness);
fprintf (stderr, "compute_conversion_costs = %d\n", n_compute_conversion_costs);
- fprintf (stderr, "build_method_call = %d (inner = %d)\n",
- n_build_method_call, n_inner_fields_searched);
if (n_vtables)
{
fprintf (stderr, "vtables = %d; vtable searches = %d\n",
@@ -6576,7 +6217,7 @@ print_class_statistics ()
the inserted class name is treated as if it were a public member name. */
void
-build_self_reference ()
+build_self_reference (void)
{
tree name = constructor_name (current_class_type);
tree value = build_lang_decl (TYPE_DECL, name, current_class_type);
@@ -6599,8 +6240,7 @@ build_self_reference ()
/* Returns 1 if TYPE contains only padding bytes. */
int
-is_empty_class (type)
- tree type;
+is_empty_class (tree type)
{
if (type == error_mark_node)
return 0;
@@ -6646,8 +6286,7 @@ contains_empty_class_p (tree type)
a *_TYPE node. NODE can also be a local class. */
tree
-get_enclosing_class (type)
- tree type;
+get_enclosing_class (tree type)
{
tree node = type;
@@ -6672,34 +6311,16 @@ get_enclosing_class (type)
return NULL_TREE;
}
-/* Return 1 if TYPE or one of its enclosing classes is derived from BASE. */
-
-int
-is_base_of_enclosing_class (base, type)
- tree base, type;
-{
- while (type)
- {
- if (lookup_base (type, base, ba_any, NULL))
- return 1;
-
- type = get_enclosing_class (type);
- }
- return 0;
-}
-
/* Note that NAME was looked up while the current class was being
defined and that the result of that lookup was DECL. */
void
-maybe_note_name_used_in_class (name, decl)
- tree name;
- tree decl;
+maybe_note_name_used_in_class (tree name, tree decl)
{
splay_tree names_used;
/* If we're not defining a class, there's nothing to do. */
- if (!innermost_scope_is_class_p ())
+ if (innermost_scope_kind() != sk_class)
return;
/* If there's already a binding for this NAME, then we don't have
@@ -6721,9 +6342,7 @@ maybe_note_name_used_in_class (name, decl)
to see that the declaration is valid. */
void
-note_name_declared_in_class (name, decl)
- tree name;
- tree decl;
+note_name_declared_in_class (tree name, tree decl)
{
splay_tree names_used;
splay_tree_node n;
@@ -6754,8 +6373,7 @@ note_name_declared_in_class (name, decl)
will return the VAR_DECL for the primary vtable. */
tree
-get_vtbl_decl_for_binfo (binfo)
- tree binfo;
+get_vtbl_decl_for_binfo (tree binfo)
{
tree decl;
@@ -6771,147 +6389,63 @@ get_vtbl_decl_for_binfo (binfo)
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. */
+/* Returns the binfo for the primary base of BINFO. If the resulting
+ BINFO is a virtual base, and it is inherited elsewhere in the
+ hierarchy, then the returned binfo might not be the primary base of
+ BINFO in the complete object. Check BINFO_PRIMARY_P or
+ BINFO_LOST_PRIMARY_P to be sure. */
tree
-get_primary_binfo (binfo)
- tree binfo;
+get_primary_binfo (tree binfo)
{
tree primary_base;
- tree result = NULL_TREE;
- tree virtuals;
+ tree result;
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);
+ result = copied_binfo (primary_base, binfo);
return result;
}
/* If INDENTED_P is zero, indent to INDENT. Return nonzero. */
static int
-maybe_indent_hierarchy (stream, indent, indented_p)
- FILE *stream;
- int indent;
- int indented_p;
+maybe_indent_hierarchy (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. */
+/* Dump the offsets of all the bases rooted at BINFO to STREAM.
+ INDENT should be zero when called from the top level; it is
+ incremented recursively. IGO indicates the next expected BINFO in
+ inheritance graph ordering. */
-static void
-dump_class_hierarchy_r (stream, flags, t, binfo, indent)
- FILE *stream;
- int flags;
- tree t;
- tree binfo;
- int indent;
+static tree
+dump_class_hierarchy_r (FILE *stream,
+ int flags,
+ tree binfo,
+ tree igo,
+ int indent)
{
- int i;
int indented = 0;
+ tree base_binfos;
indented = maybe_indent_hierarchy (stream, indent, 0);
fprintf (stream, "%s (0x%lx) ",
type_as_string (binfo, TFF_PLAIN_IDENTIFIER),
(unsigned long) binfo);
+ if (binfo != igo)
+ {
+ fprintf (stream, "alternative-path\n");
+ return igo;
+ }
+ igo = TREE_CHAIN (binfo);
+
fprintf (stream, HOST_WIDE_INT_PRINT_DEC,
tree_low_cst (BINFO_OFFSET (binfo), 0));
if (is_empty_class (BINFO_TYPE (binfo)))
@@ -6919,15 +6453,7 @@ dump_class_hierarchy_r (stream, flags, t, binfo, indent)
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, " virtual");
fprintf (stream, "\n");
indented = 0;
@@ -6984,38 +6510,65 @@ dump_class_hierarchy_r (stream, flags, t, binfo, indent)
fprintf (stream, "\n");
}
+ base_binfos = BINFO_BASETYPES (binfo);
+ if (base_binfos)
+ {
+ int ix, n;
- for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
- dump_class_hierarchy_r (stream, flags,
- t, BINFO_BASETYPE (binfo, i),
- indent + 2);
+ n = TREE_VEC_LENGTH (base_binfos);
+ for (ix = 0; ix != n; ix++)
+ {
+ tree base_binfo = TREE_VEC_ELT (base_binfos, ix);
+
+ igo = dump_class_hierarchy_r (stream, flags, base_binfo,
+ igo, indent + 2);
+ }
+ }
+
+ return igo;
}
/* Dump the BINFO hierarchy for T. */
static void
-dump_class_hierarchy (t)
- tree t;
+dump_class_hierarchy_1 (FILE *stream, int flags, 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, " base size=%lu base align=%lu\n",
+ (unsigned long)(tree_low_cst (TYPE_SIZE (CLASSTYPE_AS_BASE (t)), 0)
+ / BITS_PER_UNIT),
+ (unsigned long)(TYPE_ALIGN (CLASSTYPE_AS_BASE (t))
+ / BITS_PER_UNIT));
+ dump_class_hierarchy_r (stream, flags, TYPE_BINFO (t), TYPE_BINFO (t), 0);
fprintf (stream, "\n");
- dump_end (TDI_class, stream);
+}
+
+/* Debug interface to hierarchy dumping. */
+
+extern void
+debug_class (tree t)
+{
+ dump_class_hierarchy_1 (stderr, TDF_SLIM, t);
+}
+
+static void
+dump_class_hierarchy (tree t)
+{
+ int flags;
+ FILE *stream = dump_begin (TDI_class, &flags);
+
+ if (stream)
+ {
+ dump_class_hierarchy_1 (stream, flags, t);
+ dump_end (TDI_class, stream);
+ }
}
static void
-dump_array (stream, decl)
- FILE *stream;
- tree decl;
+dump_array (FILE * stream, tree decl)
{
tree inits;
int ix;
@@ -7030,17 +6583,14 @@ dump_array (stream, decl)
TFF_PLAIN_IDENTIFIER));
fprintf (stream, "\n");
- for (ix = 0, inits = TREE_OPERAND (DECL_INITIAL (decl), 1);
+ for (ix = 0, inits = CONSTRUCTOR_ELTS (DECL_INITIAL (decl));
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;
+dump_vtable (tree t, tree binfo, tree vtable)
{
int flags;
FILE *stream = dump_begin (TDI_class, &flags);
@@ -7070,9 +6620,7 @@ dump_vtable (t, binfo, vtable)
}
static void
-dump_vtt (t, vtt)
- tree t;
- tree vtt;
+dump_vtt (tree t, tree vtt)
{
int flags;
FILE *stream = dump_begin (TDI_class, &flags);
@@ -7091,17 +6639,60 @@ dump_vtt (t, vtt)
dump_end (TDI_class, stream);
}
+/* Dump a function or thunk and its thunkees. */
+
+static void
+dump_thunk (FILE *stream, int indent, tree thunk)
+{
+ static const char spaces[] = " ";
+ tree name = DECL_NAME (thunk);
+ tree thunks;
+
+ fprintf (stream, "%.*s%p %s %s", indent, spaces,
+ (void *)thunk,
+ !DECL_THUNK_P (thunk) ? "function"
+ : DECL_THIS_THUNK_P (thunk) ? "this-thunk" : "covariant-thunk",
+ name ? IDENTIFIER_POINTER (name) : "<unset>");
+ if (DECL_THUNK_P (thunk))
+ {
+ HOST_WIDE_INT fixed_adjust = THUNK_FIXED_OFFSET (thunk);
+ tree virtual_adjust = THUNK_VIRTUAL_OFFSET (thunk);
+
+ fprintf (stream, " fixed=" HOST_WIDE_INT_PRINT_DEC, fixed_adjust);
+ if (!virtual_adjust)
+ /*NOP*/;
+ else if (DECL_THIS_THUNK_P (thunk))
+ fprintf (stream, " vcall=" HOST_WIDE_INT_PRINT_DEC,
+ tree_low_cst (virtual_adjust, 0));
+ else
+ fprintf (stream, " vbase=" HOST_WIDE_INT_PRINT_DEC "(%s)",
+ tree_low_cst (BINFO_VPTR_FIELD (virtual_adjust), 0),
+ type_as_string (BINFO_TYPE (virtual_adjust), TFF_SCOPE));
+ if (THUNK_ALIAS (thunk))
+ fprintf (stream, " alias to %p", (void *)THUNK_ALIAS (thunk));
+ }
+ fprintf (stream, "\n");
+ for (thunks = DECL_THUNKS (thunk); thunks; thunks = TREE_CHAIN (thunks))
+ dump_thunk (stream, indent + 2, thunks);
+}
+
+/* Dump the thunks for FN. */
+
+extern void
+debug_thunks (tree fn)
+{
+ dump_thunk (stderr, 0, fn);
+}
+
/* Virtual function table initialization. */
/* Create all the necessary vtables for T and its base classes. */
static void
-finish_vtbls (t)
- tree t;
+finish_vtbls (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
@@ -7113,29 +6704,9 @@ finish_vtbls (t)
/* 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);
- }
+ accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
}
if (TYPE_BINFO_VTABLE (t))
@@ -7145,9 +6716,7 @@ finish_vtbls (t)
/* Initialize the vtable for BINFO with the INITS. */
static void
-initialize_vtable (binfo, inits)
- tree binfo;
- tree inits;
+initialize_vtable (tree binfo, tree inits)
{
tree decl;
@@ -7161,15 +6730,13 @@ initialize_vtable (binfo, inits)
the INITS. */
static void
-initialize_array (decl, inits)
- tree decl;
- tree inits;
+initialize_array (tree decl, tree inits)
{
tree context;
context = DECL_CONTEXT (decl);
DECL_CONTEXT (decl) = NULL_TREE;
- DECL_INITIAL (decl) = build_nt (CONSTRUCTOR, NULL_TREE, inits);
+ DECL_INITIAL (decl) = build_constructor (NULL_TREE, inits);
TREE_HAS_CONSTRUCTOR (DECL_INITIAL (decl)) = 1;
cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0);
DECL_CONTEXT (decl) = context;
@@ -7189,8 +6756,7 @@ initialize_array (decl, inits)
Secondary VTTs look like complete object VTTs without part 4. */
static void
-build_vtt (t)
- tree t;
+build_vtt (tree t)
{
tree inits;
tree type;
@@ -7220,41 +6786,13 @@ build_vtt (t)
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;
+binfo_ctor_vtable (tree binfo)
{
tree vt;
@@ -7281,11 +6819,7 @@ binfo_ctor_vtable (binfo)
vtables for the BINFO-in-T variant. */
static tree *
-build_vtt_inits (binfo, t, inits, index)
- tree binfo;
- tree t;
- tree *inits;
- tree *index;
+build_vtt_inits (tree binfo, tree t, tree* inits, tree* index)
{
int i;
tree b;
@@ -7361,13 +6895,10 @@ build_vtt_inits (binfo, t, inits, index)
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);
+ inits = build_vtt_inits (b, t, inits, index);
}
if (!top_level_p)
@@ -7392,9 +6923,7 @@ build_vtt_inits (binfo, t, inits, index)
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;
+dfs_build_secondary_vptr_vtt_inits (tree binfo, void* data)
{
tree l;
tree t;
@@ -7406,7 +6935,7 @@ dfs_build_secondary_vptr_vtt_inits (binfo, data)
t = TREE_CHAIN (l);
top_level_p = VTT_TOP_LEVEL_P (l);
- SET_BINFO_MARKED (binfo);
+ BINFO_MARKED (binfo) = 1;
/* We don't care about bases that don't have vtables. */
if (!TYPE_VFIELD (BINFO_TYPE (binfo)))
@@ -7457,14 +6986,11 @@ dfs_build_secondary_vptr_vtt_inits (binfo, data)
hierarchy. */
static tree
-dfs_ctor_vtable_bases_queue_p (binfo, data)
- tree binfo;
- void *data;
+dfs_ctor_vtable_bases_queue_p (tree derived, int ix,
+ void* data)
{
- if (TREE_VIA_VIRTUAL (binfo))
- /* Get the shared version. */
- binfo = binfo_for_vbase (BINFO_TYPE (binfo), TREE_PURPOSE ((tree) data));
-
+ tree binfo = BINFO_BASETYPE (derived, ix);
+
if (!BINFO_MARKED (binfo) == VTT_MARKED_BINFO_P ((tree) data))
return NULL_TREE;
return binfo;
@@ -7476,11 +7002,9 @@ dfs_ctor_vtable_bases_queue_p (binfo, data)
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;
+dfs_fixup_binfo_vtbls (tree binfo, void* data)
{
- CLEAR_BINFO_MARKED (binfo);
+ BINFO_MARKED (binfo) = 0;
/* We don't care about bases that don't have vtables. */
if (!TYPE_VFIELD (BINFO_TYPE (binfo)))
@@ -7501,9 +7025,7 @@ dfs_fixup_binfo_vtbls (binfo, data)
hierarchy dominated by T. */
static void
-build_ctor_vtbl_group (binfo, t)
- tree binfo;
- tree t;
+build_ctor_vtbl_group (tree binfo, tree t)
{
tree list;
tree type;
@@ -7533,14 +7055,12 @@ build_ctor_vtbl_group (binfo, t)
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));
+ b = copied_binfo (vbase, binfo);
- accumulate_vtbl_inits (b, orig_base, binfo, t, list);
+ accumulate_vtbl_inits (b, vbase, binfo, t, list);
}
inits = TREE_VALUE (list);
@@ -7566,12 +7086,11 @@ build_ctor_vtbl_group (binfo, t)
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;
+accumulate_vtbl_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);
@@ -7620,12 +7139,11 @@ accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, inits)
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;
+dfs_accumulate_vtbl_inits (tree binfo,
+ tree orig_binfo,
+ tree rtti_binfo,
+ tree t,
+ tree l)
{
tree inits = NULL_TREE;
tree vtbl = NULL_TREE;
@@ -7672,8 +7190,8 @@ dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l)
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))))
+ || (b && purpose_member (BINFO_TYPE (b),
+ CLASSTYPE_VBASECLASSES (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. */
@@ -7681,7 +7199,7 @@ dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l)
/* Otherwise, this is case 3 and we get our own. */
}
- else if (!BINFO_NEW_VTABLE_MARKED (orig_binfo, BINFO_TYPE (rtti_binfo)))
+ else if (!BINFO_NEW_VTABLE_MARKED (orig_binfo))
return inits;
if (!vtbl)
@@ -7747,12 +7265,11 @@ dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l)
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;
+build_vtbl_initializer (tree binfo,
+ tree orig_binfo,
+ tree t,
+ tree rtti_binfo,
+ int* non_fn_entries_p)
{
tree v, b;
tree vfun_inits;
@@ -7785,7 +7302,7 @@ build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo, non_fn_entries_p)
for (vbase = CLASSTYPE_VBASECLASSES (t);
vbase;
vbase = TREE_CHAIN (vbase))
- CLEAR_BINFO_VTABLE_PATH_MARKED (TREE_VALUE (vbase));
+ BINFO_VTABLE_PATH_MARKED (TREE_VALUE (vbase)) = 0;
/* If the target requires padding between data entries, add that now. */
if (TARGET_VTABLE_DATA_ENTRY_DISTANCE > 1)
@@ -7816,11 +7333,23 @@ build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo, non_fn_entries_p)
{
tree delta;
tree vcall_index;
- tree fn;
+ tree fn, fn_original;
tree init = NULL_TREE;
fn = BV_FN (v);
-
+ fn_original = fn;
+ if (DECL_THUNK_P (fn))
+ {
+ if (!DECL_NAME (fn))
+ finish_thunk (fn);
+ if (THUNK_ALIAS (fn))
+ {
+ fn = THUNK_ALIAS (fn);
+ BV_FN (v) = fn;
+ }
+ fn_original = THUNK_TARGET (fn);
+ }
+
/* 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
@@ -7834,7 +7363,7 @@ build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo, non_fn_entries_p)
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))
+ if (look_for_overrides_here (BINFO_TYPE (b), fn_original))
break;
/* The nearest definition is from a lost primary; clear the
@@ -7858,10 +7387,14 @@ build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo, non_fn_entries_p)
/* 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))
+ if (DECL_PURE_VIRTUAL_P (fn_original))
fn = abort_fndecl;
else if (!integer_zerop (delta) || vcall_index)
- fn = make_thunk (fn, delta, vcall_index);
+ {
+ fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index);
+ if (!DECL_NAME (fn))
+ finish_thunk (fn);
+ }
/* Take the address of the function, considering it to be of an
appropriate generic type. */
init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
@@ -7906,9 +7439,7 @@ build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo, non_fn_entries_p)
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;
+build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid)
{
tree b;
@@ -7930,9 +7461,7 @@ build_vcall_and_vbase_vtbl_entries (binfo, vid)
where the next vbase offset will go. */
static void
-build_vbase_offset_vtbl_entries (binfo, vid)
- tree binfo;
- vtbl_init_data *vid;
+build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
{
tree vbase;
tree t;
@@ -7982,13 +7511,13 @@ build_vbase_offset_vtbl_entries (binfo, vid)
/* Find the instance of this virtual base in the complete
object. */
- b = binfo_for_vbase (BINFO_TYPE (vbase), t);
+ b = copied_binfo (vbase, binfo);
/* 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);
+ BINFO_VTABLE_PATH_MARKED (b) = 1;
/* Figure out where we can find this vbase offset. */
delta = size_binop (MULT_EXPR,
@@ -8000,16 +7529,10 @@ build_vbase_offset_vtbl_entries (binfo, vid)
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 ();
+ my_friendly_assert (tree_int_cst_equal (delta,
+ BINFO_VPTR_FIELD (vbase)),
+ 20030202);
}
/* The next vbase will come at a more negative offset. */
@@ -8036,9 +7559,7 @@ build_vbase_offset_vtbl_entries (binfo, vid)
to VID->INITS. */
static void
-build_vcall_offset_vtbl_entries (binfo, vid)
- tree binfo;
- vtbl_init_data *vid;
+build_vcall_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
{
/* We only need these entries if this base is a virtual base. We
compute the indices -- but do not add to the vtable -- when
@@ -8076,9 +7597,7 @@ build_vcall_offset_vtbl_entries (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;
+add_vcall_offset_vtbl_entries_r (tree binfo, vtbl_init_data* vid)
{
int i;
tree primary_binfo;
@@ -8112,9 +7631,7 @@ add_vcall_offset_vtbl_entries_r (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;
+add_vcall_offset_vtbl_entries_1 (tree binfo, vtbl_init_data* vid)
{
/* Make entries for the rest of the virtuals. */
if (abi_version_at_least (2))
@@ -8169,8 +7686,8 @@ add_vcall_offset_vtbl_entries_1 (binfo, vid)
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)));
+ non_primary_binfo
+ = original_binfo (non_primary_binfo, vid->rtti_binfo);
for (base_virtuals = BINFO_VIRTUALS (binfo),
derived_virtuals = BINFO_VIRTUALS (non_primary_binfo),
@@ -8261,20 +7778,18 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
vcall_offset = fold (build1 (NOP_EXPR, vtable_entry_type,
vcall_offset));
}
- /* Add the intiailizer to the vtable. */
+ /* Add the initializer to the vtable. */
*vid->last_init = build_tree_list (NULL_TREE, vcall_offset);
vid->last_init = &TREE_CHAIN (*vid->last_init);
}
}
-/* Return vtbl initializers for the RTTI entries coresponding to the
+/* Return vtbl initializers for the RTTI entries corresponding 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;
+build_rtti_vtbl_entries (tree binfo, vtbl_init_data* vid)
{
tree b;
tree t;
diff --git a/contrib/gcc/cp/config-lang.in b/contrib/gcc/cp/config-lang.in
index b8feb03..8ba5506 100644
--- a/contrib/gcc/cp/config-lang.in
+++ b/contrib/gcc/cp/config-lang.in
@@ -1,21 +1,21 @@
# Top level configure fragment for GNU C++.
-# Copyright (C) 1994, 1995, 1997, 1998, 2000, 2001
+# Copyright (C) 1994, 1995, 1997, 1998, 2000, 2001, 2002
# Free Software Foundation, Inc.
-#This file is part of GNU CC.
+#This file is part of GCC.
-#GNU CC is free software; you can redistribute it and/or modify
+#GCC 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,
+#GCC 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
+#along with GCC; see the file COPYING. If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.
@@ -32,6 +32,6 @@ compilers="cc1plus\$(exeext)"
stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)"
-target_libs="${libstdcxx_version} target-gperf"
+target_libs="target-libstdc++-v3 target-gperf"
-gtfiles="\$(srcdir)/cp/mangle.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/lex.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/parse.y \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/spew.c \$(srcdir)/cp/tree.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.c"
+gtfiles="\$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/lex.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.c"
diff --git a/contrib/gcc/cp/cp-lang.c b/contrib/gcc/cp/cp-lang.c
index 0d8a4e3..f1f5eed 100644
--- a/contrib/gcc/cp/cp-lang.c
+++ b/contrib/gcc/cp/cp-lang.c
@@ -2,40 +2,50 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
Contributed by Alexandre Oliva <aoliva@redhat.com>
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "c-common.h"
#include "toplev.h"
#include "langhooks.h"
#include "langhooks-def.h"
+#include "diagnostic.h"
+#include "cxx-pretty-print.h"
-static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree));
-static bool ok_to_generate_alias_set_for_type PARAMS ((tree));
-static bool cxx_warn_unused_global_decl PARAMS ((tree));
-static tree cp_expr_size PARAMS ((tree));
-static bool cp_var_mod_type_p PARAMS ((tree));
+enum c_language_kind c_language = clk_cxx;
+
+static HOST_WIDE_INT cxx_get_alias_set (tree);
+static bool ok_to_generate_alias_set_for_type (tree);
+static bool cxx_warn_unused_global_decl (tree);
+static tree cp_expr_size (tree);
+static size_t cp_tree_size (enum tree_code);
+static bool cp_var_mod_type_p (tree);
+static void cxx_initialize_diagnostics (diagnostic_context *);
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "GNU C++"
+#undef LANG_HOOKS_TREE_SIZE
+#define LANG_HOOKS_TREE_SIZE cp_tree_size
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT cxx_init
#undef LANG_HOOKS_FINISH
@@ -43,9 +53,15 @@ static bool cp_var_mod_type_p PARAMS ((tree));
#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 c_common_decode_option
+#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
+#undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
+#define LANG_HOOKS_INITIALIZE_DIAGNOSTICS cxx_initialize_diagnostics
+#undef LANG_HOOKS_HANDLE_OPTION
+#define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
+#undef LANG_HOOKS_HANDLE_FILENAME
+#define LANG_HOOKS_HANDLE_FILENAME c_common_handle_filename
+#undef LANG_HOOKS_MISSING_ARGUMENT
+#define LANG_HOOKS_MISSING_ARGUMENT c_common_missing_argument
#undef LANG_HOOKS_POST_OPTIONS
#define LANG_HOOKS_POST_OPTIONS c_common_post_options
#undef LANG_HOOKS_GET_ALIAS_SET
@@ -66,8 +82,6 @@ static bool cp_var_mod_type_p PARAMS ((tree));
#define LANG_HOOKS_MAYBE_BUILD_CLEANUP cxx_maybe_build_cleanup
#undef LANG_HOOKS_TRUTHVALUE_CONVERSION
#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion
-#undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES
-#define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES cxx_insert_default_attributes
#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
#undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
@@ -88,10 +102,18 @@ static bool cp_var_mod_type_p PARAMS ((tree));
#define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name
#undef LANG_HOOKS_PRINT_ERROR_FUNCTION
#define LANG_HOOKS_PRINT_ERROR_FUNCTION cxx_print_error_function
+#undef LANG_HOOKS_BUILTIN_TYPE_DECLS
+#define LANG_HOOKS_BUILTIN_TYPE_DECLS cxx_builtin_type_decls
+#undef LANG_HOOKS_PUSHLEVEL
+#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i
+#undef LANG_HOOKS_POPLEVEL
+#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree
#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL cxx_warn_unused_global_decl
#undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS lhd_do_nothing
+#undef LANG_HOOKS_DECL_UNINIT
+#define LANG_HOOKS_DECL_UNINIT c_decl_uninit
#undef LANG_HOOKS_FUNCTION_INIT
@@ -99,6 +121,11 @@ static bool cp_var_mod_type_p PARAMS ((tree));
#undef LANG_HOOKS_FUNCTION_FINAL
#define LANG_HOOKS_FUNCTION_FINAL cxx_pop_function_context
+#undef LANG_HOOKS_RTL_EXPAND_START
+#define LANG_HOOKS_RTL_EXPAND_START cxx_expand_function_start
+#undef LANG_HOOKS_RTL_EXPAND_STMT
+#define LANG_HOOKS_RTL_EXPAND_STMT expand_stmt
+
/* Attribute hooks. */
#undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE c_common_attribute_table
@@ -129,10 +156,8 @@ static bool cp_var_mod_type_p PARAMS ((tree));
#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p
#undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P cp_var_mod_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_INLINING_ESTIMATE_NUM_INSNS
+#define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS c_estimate_num_insns
#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
@@ -140,6 +165,11 @@ static bool cp_var_mod_type_p PARAMS ((tree));
#undef LANG_HOOKS_EXPR_SIZE
#define LANG_HOOKS_EXPR_SIZE cp_expr_size
+#undef LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR
+#define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR cxx_callgraph_analyze_expr
+#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
+#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION expand_body
+
#undef LANG_HOOKS_MAKE_TYPE
#define LANG_HOOKS_MAKE_TYPE cxx_make_type
#undef LANG_HOOKS_TYPE_FOR_MODE
@@ -156,6 +186,8 @@ static bool cp_var_mod_type_p PARAMS ((tree));
#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR cxx_incomplete_type_error
#undef LANG_HOOKS_TYPE_PROMOTES_TO
#define LANG_HOOKS_TYPE_PROMOTES_TO cxx_type_promotes_to
+#undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
+#define LANG_HOOKS_REGISTER_BUILTIN_TYPE c_register_builtin_type
/* Each front end provides its own hooks, for toplev.c. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
@@ -205,8 +237,7 @@ const char *const tree_code_name[] = {
Return TRUE if T safe for aliasing FALSE otherwise. */
static bool
-ok_to_generate_alias_set_for_type (t)
- tree t;
+ok_to_generate_alias_set_for_type (tree t)
{
if (TYPE_PTRMEMFUNC_P (t))
return true;
@@ -259,9 +290,15 @@ ok_to_generate_alias_set_for_type (t)
/* Special routine to get the alias set for C++. */
static HOST_WIDE_INT
-cxx_get_alias_set (t)
- tree t;
+cxx_get_alias_set (tree t)
{
+ if (TREE_CODE (t) == RECORD_TYPE
+ && TYPE_CONTEXT (t) && CLASS_TYPE_P (TYPE_CONTEXT (t))
+ && CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t)
+ /* The base variant of a type must be in the same alias set as the
+ complete type. */
+ return get_alias_set (TYPE_CONTEXT (t));
+
if (/* It's not yet safe to use alias sets for some classes in C++. */
!ok_to_generate_alias_set_for_type (t)
/* Nor is it safe to use alias sets for pointers-to-member
@@ -277,8 +314,7 @@ cxx_get_alias_set (t)
/* Called from check_global_declarations. */
static bool
-cxx_warn_unused_global_decl (decl)
- tree decl;
+cxx_warn_unused_global_decl (tree decl)
{
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
return false;
@@ -297,8 +333,7 @@ cxx_warn_unused_global_decl (decl)
might have allocated something there. */
static tree
-cp_expr_size (exp)
- tree exp;
+cp_expr_size (tree exp)
{
if (CLASS_TYPE_P (TREE_TYPE (exp)))
{
@@ -312,13 +347,33 @@ cp_expr_size (exp)
abort ();
/* This would be wrong for a type with virtual bases, but they are
caught by the abort above. */
- return CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp));
+ return (is_empty_class (TREE_TYPE (exp))
+ ? size_zero_node
+ : CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp)));
}
else
/* Use the default code. */
return lhd_expr_size (exp);
}
+/* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */
+static size_t
+cp_tree_size (enum tree_code code)
+{
+ switch (code)
+ {
+ case PTRMEM_CST: return sizeof (struct ptrmem_cst);
+ case BASELINK: return sizeof (struct tree_baselink);
+ case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
+ case DEFAULT_ARG: return sizeof (struct tree_default_arg);
+ case OVERLOAD: return sizeof (struct tree_overload);
+ case WRAPPER: return sizeof (struct tree_wrapper);
+ default:
+ abort ();
+ }
+ /* NOTREACHED */
+}
+
/* Returns true if T is a variably modified type, in the sense of C99.
This routine needs only check cases that cannot be handled by the
language-independent logic in tree-inline.c. */
@@ -328,7 +383,7 @@ cp_var_mod_type_p (tree type)
{
/* If TYPE is a pointer-to-member, it is variably modified if either
the class or the member are variably modified. */
- if (TYPE_PTRMEM_P (type) || TYPE_PTRMEMFUNC_P (type))
+ if (TYPE_PTR_TO_MEMBER_P (type))
return (variably_modified_type_p (TYPE_PTRMEM_CLASS_TYPE (type))
|| variably_modified_type_p (TYPE_PTRMEM_POINTED_TO_TYPE (type)));
@@ -336,3 +391,24 @@ cp_var_mod_type_p (tree type)
return false;
}
+/* Stub routine to tell people that this doesn't work yet. */
+void
+c_reset_state (void)
+{
+ sorry ("inter-module optimisations not implemented yet");
+}
+
+/* Construct a C++-aware pretty-printer for CONTEXT. It is assumed
+ that CONTEXT->printer is an already constructed basic pretty_printer. */
+static void
+cxx_initialize_diagnostics (diagnostic_context *context)
+{
+ pretty_printer *base = context->printer;
+ cxx_pretty_printer *pp = xmalloc (sizeof (cxx_pretty_printer));
+ memcpy (pp_base (pp), base, sizeof (pretty_printer));
+ pp_cxx_pretty_printer_init (pp);
+ context->printer = (pretty_printer *) pp;
+
+ /* It is safe to free this object because it was previously malloc()'d. */
+ free (base);
+}
diff --git a/contrib/gcc/cp/cp-tree.def b/contrib/gcc/cp/cp-tree.def
index cee19ab..36b7aaa 100644
--- a/contrib/gcc/cp/cp-tree.def
+++ b/contrib/gcc/cp/cp-tree.def
@@ -1,24 +1,24 @@
/* 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,
- 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998, 2003,
+ 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -26,28 +26,28 @@ Boston, MA 02111-1307, USA. */
/* An OFFSET_REF is used in two situations:
1. An expression of the form `A::m' where `A' is a class and `m' is
- a non-static data member. In this case, operand 0 will be a
- TYPE (corresponding to `A') and operand 1 will be a FIELD_DECL
- (corresponding to `m'.
+ a non-static member. In this case, operand 0 will be a TYPE
+ (corresponding to `A') and operand 1 will be a FIELD_DECL,
+ BASELINK, or TEMPLATE_ID_EXPR (corresponding to `m').
The expression is a pointer-to-member if its address is taken,
but simply denotes a member of the object if its address isnot
taken. In the latter case, resolve_offset_ref is used to
convert it to a representation of the member referred to by the
OFFSET_REF.
+
+ This form is only used during the parsing phase; once semantic
+ analysis has taken place they are eliminated.
2. An expression of the form `x.*p'. In this case, operand 0 will
be an expression corresponding to `x' and operand 1 will be an
- expression with pointer-to-member type.
-
- OFFSET_REFs are only used during the parsing phase; once semantic
- analysis has taken place they are eliminated. */
+ expression with pointer-to-member type. */
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', 2)
+DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 0)
/* For NEW_EXPR, operand 0 is the placement list.
Operand 1 is the new-declarator.
@@ -62,8 +62,7 @@ DEFTREECODE (DELETE_EXPR, "dl_expr", 'e', 2)
DEFTREECODE (VEC_DELETE_EXPR, "vec_dl_expr", 'e', 2)
/* Value is reference to particular overloaded class method.
- Operand 0 is the class name (an IDENTIFIER_NODE);
- operand 1 is the field (also an IDENTIFIER_NODE).
+ Operand 0 is the class, operand 1 is the field
The COMPLEXITY field holds the class level (usually 0). */
DEFTREECODE (SCOPE_REF, "scope_ref", 'r', 2)
@@ -89,6 +88,10 @@ DEFTREECODE (THROW_EXPR, "throw_expr", 'e', 1)
these to avoid actually creating instances of the empty classes. */
DEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", 'e', 0)
+/* A DECL which is really just a placeholder for an expression. Used to
+ implement non-class scope anonymous unions. */
+DEFTREECODE (ALIAS_DECL, "alias_decl", 'd', 0)
+
/* A reference to a member function or member functions from a base
class. BASELINK_FUNCTIONS gives the FUNCTION_DECL,
TEMPLATE_DECL, OVERLOAD, or TEMPLATE_ID_EXPR corresponding to the
@@ -101,7 +104,7 @@ DEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", 'e', 0)
the type of the expression. This type is either a FUNCTION_TYPE,
METHOD_TYPE, or `unknown_type_node' indicating that the function is
overloaded. */
-DEFTREECODE (BASELINK, "baselink", 'e', 3)
+DEFTREECODE (BASELINK, "baselink", 'x', 0)
/* Template definition. The following fields have the specified uses,
although there are other macros in cp-tree.h that should be used for
@@ -153,16 +156,7 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0)
The LEVEL is the level of the parameter when we are worrying about
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(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))
+DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', 0)
/* Index into a template parameter list. This parameter must be a type.
The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX. */
@@ -201,36 +195,31 @@ DEFTREECODE (UNBOUND_CLASS_TEMPLATE, "unbound_class_template", 't', 0)
DEFTREECODE (TYPEOF_TYPE, "typeof_type", 't', 0)
/* A using declaration. DECL_INITIAL contains the specified scope.
- This is not an alias, but is later expanded into multiple aliases. */
+ This is not an alias, but is later expanded into multiple aliases.
+ The decl will have a NULL_TYPE iff the scope is a dependent scope,
+ otherwise it will have a void type. */
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", 'x', 2)
+DEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 0)
/* A template-id, like foo<int>. The first operand is the template.
- The second is the TREE_LIST or TREE_VEC of explicitly specified
- arguments. The template will be a FUNCTION_DECL, TEMPLATE_DECL, or
- an OVERLOAD. If the template-id refers to a member template, the
- template may be an IDENTIFIER_NODE. In an uninstantiated template,
- the template may be a LOOKUP_EXPR. */
+ The second is NULL if there are no explicit arguments, or a
+ TREE_VEC of arguments. The template will be a FUNCTION_DECL,
+ TEMPLATE_DECL, or an OVERLOAD. If the template-id refers to a
+ member template, the template may be an IDENTIFIER_NODE. */
DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", 'e', 2)
/* A list-like node for chaining overloading candidates. TREE_TYPE is
the original name, and the parameter is the FUNCTION_DECL. */
-DEFTREECODE (OVERLOAD, "overload", 'x', 1)
+DEFTREECODE (OVERLOAD, "overload", 'x', 0)
/* A generic wrapper for something not tree that we want to include in
tree structure. */
-DEFTREECODE (WRAPPER, "wrapper", 'x', 1)
-
-/* 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
- unused. */
-DEFTREECODE (LOOKUP_EXPR, "lookup_expr", 'e', 1)
+DEFTREECODE (WRAPPER, "wrapper", 'x', 0)
/* A whole bunch of tree codes for the initial, superficial parsing of
templates. */
@@ -244,10 +233,20 @@ DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", 'e', 2)
DEFTREECODE (TYPEID_EXPR, "typeid_expr", 'e', 1)
DEFTREECODE (PSEUDO_DTOR_EXPR, "pseudo_dtor_expr", 'e', 3)
+/* A placeholder for an expression that is not type-dependent, but
+ does occur in a template. When an expression that is not
+ type-dependent appears in a larger expression, we must compute the
+ type of that larger expression. That computation would normally
+ modify the original expression, which would change the mangling of
+ that expression if it appeared in a template argument list. In
+ that situation, we create a NON_DEPENDENT_EXPR to take the place of
+ the original expression. The expression is the only operand -- it
+ is only needed for diagnostics. */
+DEFTREECODE (NON_DEPENDENT_EXPR, "non_dependent_expr", 'e', 1)
+
/* 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', 1)
-DEFTREECODE (RETURN_INIT, "return_init", '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
diff --git a/contrib/gcc/cp/cp-tree.h b/contrib/gcc/cp/cp-tree.h
index 493206d..b3ceab4 100644
--- a/contrib/gcc/cp/cp-tree.h
+++ b/contrib/gcc/cp/cp-tree.h
@@ -1,38 +1,36 @@
/* Definitions for C++ parsing and type checking.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef GCC_CP_TREE_H
#define GCC_CP_TREE_H
+#include "ggc.h"
#include "function.h"
#include "hashtab.h"
#include "splay-tree.h"
#include "varray.h"
-#ifndef __GNUC__
-#error "You should be using 'make bootstrap' -- see installation instructions"
-#endif
-
#include "c-common.h"
+#include "name-lookup.h"
struct diagnostic_context;
@@ -41,13 +39,15 @@ struct diagnostic_context;
IDENTIFIER_MARKED (IDENTIFIER_NODEs)
NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
- LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
+ COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR).
TREE_INDIRECT_USING (in NAMESPACE_DECL).
ICS_USER_FLAG (in _CONV)
CLEANUP_P (in TRY_BLOCK)
AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF)
PARMLIST_ELLIPSIS_P (in PARMLIST)
+ DECL_PRETTY_FUNCTION_P (in VAR_DECL)
+ KOENIG_LOOKUP_P (in CALL_EXPR)
1: IDENTIFIER_VIRTUAL_P.
TI_PENDING_TEMPLATE_FLAG.
TEMPLATE_PARMS_FOR_INLINE.
@@ -55,13 +55,14 @@ struct diagnostic_context;
(TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE).
ICS_ELLIPSIS_FLAG (in _CONV)
- BINFO_ACCESS (in BINFO)
+ BINFO_DEPENDENT_BASE_P (in BINFO)
DECL_INITIALIZED_P (in VAR_DECL)
2: IDENTIFIER_OPNAME_P.
TYPE_POLYMORPHIC_P (in _TYPE)
ICS_THIS_FLAG (in _CONV)
BINFO_LOST_PRIMARY_P (in BINFO)
TREE_PARMLIST (in TREE_LIST)
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
BINFO_VTABLE_PATH_MARKED.
BINFO_PUSHDECLS_MARKED.
@@ -75,16 +76,17 @@ struct diagnostic_context;
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)
+ DECL_VTABLE_OR_VTT_P (in VAR_DECL)
+ 6: For future expansion
Usage of TYPE_LANG_FLAG_?:
- 0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
+ 0: TYPE_DEPENDENT_P
1: TYPE_HAS_CONSTRUCTOR.
2: TYPE_HAS_DESTRUCTOR.
3: TYPE_FOR_JAVA.
4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
5: IS_AGGR_TYPE.
- 6: TYPE_BUILT_IN.
+ 6: TYPE_DEPENDENT_P_VALID
Usage of DECL_LANG_FLAG_?:
0: DECL_ERROR_REPORTED (in VAR_DECL).
@@ -125,7 +127,7 @@ struct diagnostic_context;
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
+ overridden 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.
@@ -147,7 +149,7 @@ struct diagnostic_context;
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.
+ function is overridden, 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
@@ -157,7 +159,7 @@ struct diagnostic_context;
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
-#define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
+#define VAR_OR_FUNCTION_DECL_CHECK(NODE) __extension__ \
({ const tree __t = (NODE); \
enum tree_code const __c = TREE_CODE(__t); \
if (__c != VAR_DECL && __c != FUNCTION_DECL) \
@@ -165,7 +167,7 @@ struct diagnostic_context;
__FUNCTION__); \
__t; })
-#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
+#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) __extension__ \
({ const tree __t = (NODE); \
enum tree_code const __c = TREE_CODE(__t); \
if (__c != VAR_DECL \
@@ -175,7 +177,7 @@ struct diagnostic_context;
__FUNCTION__); \
__t; })
-#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
+#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) __extension__ \
({ const tree __t = (NODE); \
enum tree_code const __c = TREE_CODE(__t); \
if (__c != VAR_DECL \
@@ -186,7 +188,7 @@ struct diagnostic_context;
__FUNCTION__); \
__t; })
-#define RECORD_OR_UNION_TYPE_CHECK(NODE) \
+#define RECORD_OR_UNION_TYPE_CHECK(NODE) __extension__ \
({ const tree __t = (NODE); \
enum tree_code const __c = TREE_CODE(__t); \
if (__c != RECORD_TYPE && __c != UNION_TYPE) \
@@ -194,7 +196,7 @@ struct diagnostic_context;
__FUNCTION__); \
__t; })
-#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
+#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) __extension__ \
({ const tree __t = (NODE); \
enum tree_code const __c = TREE_CODE(__t); \
if (__c != BOUND_TEMPLATE_TEMPLATE_PARM) \
@@ -212,62 +214,6 @@ struct diagnostic_context;
#endif
-/* Returns TRUE if generated code should match ABI version N or
- greater is in use. */
-
-#define abi_version_at_least(N) \
- (flag_abi_version == 0 || flag_abi_version >= (N))
-
-
-/* Datatype used to temporarily save C++ bindings (for implicit
- instantiations purposes and like). Implemented in decl.c. */
-typedef struct cxx_saved_binding cxx_saved_binding;
-
-/* Datatype that represents binding established by a declaration between
- a name and a C++ entity. */
-typedef struct cxx_binding cxx_binding;
-
-/* (GC-)allocate a cxx_binding object. */
-#define cxx_binding_make() (ggc_alloc (sizeof (cxx_binding)))
-
-/* Zero out a cxx_binding pointed to by B. */
-#define cxx_binding_clear(B) memset ((B), 0, sizeof (cxx_binding))
-
-struct cxx_binding GTY(())
-{
- /* Link to chain together various bindings for this name. */
- cxx_binding *previous;
- /* The non-type entity this name is bound to. */
- tree value;
- /* The type entity this name is bound to. */
- tree type;
- union tree_binding_u {
- tree GTY ((tag ("0"))) scope;
- struct cp_binding_level * GTY ((tag ("1"))) level;
- } GTY ((desc ("%0.has_level"))) scope;
- unsigned has_level : 1;
- unsigned value_is_inherited : 1;
- unsigned is_local : 1;
-};
-
-/* The type of dictionary used to map names to types declared at
- a given scope. */
-typedef struct binding_table_s *binding_table;
-typedef struct binding_entry_s *binding_entry;
-
-/* The type of a routine repeatedly called by binding_table_foreach. */
-typedef void (*bt_foreach_proc) (binding_entry, void *);
-
-struct binding_entry_s GTY(())
-{
- binding_entry chain;
- tree name;
- tree type;
-};
-
-extern void binding_table_foreach (binding_table, bt_foreach_proc, void *);
-extern binding_entry binding_table_find (binding_table, tree);
-extern void cxx_remember_type_decls (binding_table);
/* Language-dependent contents of an identifier. */
@@ -278,7 +224,9 @@ struct lang_identifier GTY(())
cxx_binding *bindings;
tree class_value;
tree class_template_info;
- struct lang_id2 *x;
+ tree label_value;
+ tree implicit_decl;
+ tree error_locus;
};
/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
@@ -287,26 +235,9 @@ struct lang_identifier GTY(())
#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 GTY(())
-{
- tree label_value;
- tree implicit_decl;
- tree error_locus;
-};
-
-typedef struct flagged_type_tree_s GTY(())
-{
- tree t;
- int new_type_flag;
- tree lookups;
-} flagged_type_tree;
-
typedef struct template_parm_index_s GTY(())
{
struct tree_common common;
@@ -326,31 +257,6 @@ struct ptrmem_cst GTY(())
};
typedef struct ptrmem_cst * 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) ((NODE)->is_local)
-
-/* Nonzero if BINDING_VALUE is from a base class of the class which is
- currently being defined. */
-#define INHERITED_VALUE_BINDING_P(NODE) ((NODE)->value_is_inherited)
-
-/* 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) ((NODE)->scope.scope)
-
-/* Nonzero if NODE has BINDING_LEVEL, rather than BINDING_SCOPE. */
-#define BINDING_HAS_LEVEL_P(NODE) ((NODE)->has_level)
-
-/* This is the declaration bound to the name. Possible values:
- variable, overloaded function, namespace, template, enumerator. */
-#define BINDING_VALUE(NODE) ((NODE)->value)
-
-/* If name is bound to a type, this is the type (struct, union, enum). */
-#define BINDING_TYPE(NODE) ((NODE)->type)
-
#define IDENTIFIER_GLOBAL_VALUE(NODE) \
namespace_binding ((NODE), global_namespace)
#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
@@ -408,16 +314,16 @@ struct tree_overload GTY(())
(TREE_CODE (NODE) == BASELINK)
/* The BINFO indicating the base from which the BASELINK_FUNCTIONS came. */
#define BASELINK_BINFO(NODE) \
- (TREE_OPERAND (BASELINK_CHECK (NODE), 0))
+ (((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo)
/* The functions referred to by the BASELINK; either a FUNCTION_DECL,
a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR. */
#define BASELINK_FUNCTIONS(NODE) \
- (TREE_OPERAND (BASELINK_CHECK (NODE), 1))
+ (((struct tree_baselink*) BASELINK_CHECK (NODE))->functions)
/* The BINFO in which the search for the functions indicated by this baselink
began. This base is used to determine the accessibility of functions
selected by overload resolution. */
#define BASELINK_ACCESS_BINFO(NODE) \
- (TREE_OPERAND (BASELINK_CHECK (NODE), 2))
+ (((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo)
/* For a type-conversion operator, the BASELINK_OPTYPE indicates the type
to which the conversion should occur. This value is important if
the BASELINK_FUNCTIONS include a template conversion operator --
@@ -426,6 +332,14 @@ struct tree_overload GTY(())
#define BASELINK_OPTYPE(NODE) \
(TREE_CHAIN (BASELINK_CHECK (NODE)))
+struct tree_baselink GTY(())
+{
+ struct tree_common common;
+ tree binfo;
+ tree functions;
+ tree access_binfo;
+};
+
#define WRAPPER_ZC(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->z_c)
struct tree_wrapper GTY(())
@@ -434,14 +348,21 @@ struct tree_wrapper GTY(())
struct z_candidate *z_c;
};
-#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 GTY(())
+/* The different kinds of ids that we ecounter. */
+
+typedef enum cp_id_kind
{
- struct tree_common common;
- const char *filename;
- int linenum;
-};
+ /* Not an id at all. */
+ CP_ID_KIND_NONE,
+ /* An unqualified-id that is not a template-id. */
+ CP_ID_KIND_UNQUALIFIED,
+ /* An unqualified-id that is a dependent name. */
+ CP_ID_KIND_UNQUALIFIED_DEPENDENT,
+ /* An unqualified template-id. */
+ CP_ID_KIND_TEMPLATE_ID,
+ /* A qualified-id. */
+ CP_ID_KIND_QUALIFIED
+} cp_id_kind;
/* Macros for access to language-specific slots in an identifier. */
@@ -452,22 +373,22 @@ struct tree_srcloc GTY(())
/* The IDENTIFIER_BINDING is the innermost cxx_binding for the
identifier. It's PREVIOUS is the next outermost binding. Each
- BINDING_VALUE is a DECL for the associated declaration. Thus,
+ VALUE field is a DECL for the associated declaration. Thus,
name lookup consists simply of pulling off the node at the front
of the list (modulo oddities for looking up the names of types,
- and such.) You can use BINDING_SCOPE or BINDING_LEVEL to
- determine the scope that bound the name. */
+ and such.) You can use SCOPE field to determine the scope
+ that bound the name. */
#define IDENTIFIER_BINDING(NODE) \
(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) ? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) : 0)
+ (IDENTIFIER_BINDING (NODE) ? IDENTIFIER_BINDING (NODE)->value : NULL)
/* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current
class, and IDENTIFIER_CLASS_VALUE is the value binding. This is
- just a pointer to the BINDING_VALUE of one of the bindings in the
+ just a pointer to the VALUE field of one of the bindings in the
IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is
IDENTIFIER_BINDING. */
#define IDENTIFIER_CLASS_VALUE(NODE) \
@@ -482,30 +403,20 @@ struct tree_srcloc GTY(())
#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) \
- (LANG_IDENTIFIER_CAST (NODE)->x \
- ? LANG_IDENTIFIER_CAST (NODE)->x->NAME : 0)
-
-#define SET_LANG_ID(NODE, VALUE, NAME) \
- (LANG_IDENTIFIER_CAST (NODE)->x == 0 \
- ? LANG_IDENTIFIER_CAST (NODE)->x \
- = (struct lang_id2 *)ggc_alloc_cleared (sizeof (struct lang_id2)) : 0, \
- LANG_IDENTIFIER_CAST (NODE)->x->NAME = (VALUE))
-
#define IDENTIFIER_LABEL_VALUE(NODE) \
- LANG_ID_FIELD (label_value, NODE)
+ (LANG_IDENTIFIER_CAST (NODE)->label_value)
#define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \
- SET_LANG_ID (NODE, VALUE, label_value)
+ IDENTIFIER_LABEL_VALUE (NODE) = (VALUE)
#define IDENTIFIER_IMPLICIT_DECL(NODE) \
- LANG_ID_FIELD (implicit_decl, NODE)
+ (LANG_IDENTIFIER_CAST (NODE)->implicit_decl)
#define SET_IDENTIFIER_IMPLICIT_DECL(NODE, VALUE) \
- SET_LANG_ID (NODE, VALUE, implicit_decl)
+ IDENTIFIER_IMPLICIT_DECL (NODE) = (VALUE)
#define IDENTIFIER_ERROR_LOCUS(NODE) \
- LANG_ID_FIELD (error_locus, NODE)
+ (LANG_IDENTIFIER_CAST (NODE)->error_locus)
#define SET_IDENTIFIER_ERROR_LOCUS(NODE, VALUE) \
- SET_LANG_ID (NODE, VALUE, error_locus)
+ IDENTIFIER_ERROR_LOCUS (NODE) = (VALUE)
/* Nonzero if this identifier is used as a virtual function name somewhere
(optimizes searches). */
@@ -526,21 +437,34 @@ struct tree_srcloc GTY(())
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)
+#define C_TYPE_FIELDS_READONLY(TYPE) \
+ (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
/* Store a value in that field. */
#define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
(TREE_COMPLEXITY (EXP) = (int)(CODE))
+/* The tokens stored in the default argument. */
+
+#define DEFARG_TOKENS(NODE) \
+ (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens)
+
+struct tree_default_arg GTY (())
+{
+ struct tree_common common;
+ struct cp_token_cache *tokens;
+};
+
enum cp_tree_node_structure_enum {
- TS_CP_COMMON,
TS_CP_GENERIC,
TS_CP_IDENTIFIER,
TS_CP_TPI,
TS_CP_PTRMEM,
+ TS_CP_BINDING,
TS_CP_OVERLOAD,
+ TS_CP_BASELINK,
TS_CP_WRAPPER,
- TS_CP_SRCLOC,
+ TS_CP_DEFAULT_ARG,
LAST_TS_CP_ENUM
};
@@ -548,14 +472,14 @@ enum cp_tree_node_structure_enum {
union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"),
chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
- struct tree_common GTY ((tag ("TS_CP_COMMON"))) common;
union tree_node GTY ((tag ("TS_CP_GENERIC"),
desc ("tree_node_structure (&%h)"))) generic;
struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
+ struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
struct tree_wrapper GTY ((tag ("TS_CP_WRAPPER"))) wrapper;
- struct tree_srcloc GTY ((tag ("TS_CP_SRCLOC"))) srcloc;
+ struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
};
@@ -591,9 +515,6 @@ enum cp_tree_index
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,
@@ -601,19 +522,11 @@ enum cp_tree_index
CPTI_ABI,
CPTI_TYPE_INFO_TYPE,
CPTI_TYPE_INFO_PTR_TYPE,
+ CPTI_TYPE_INFO_REF_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,
@@ -680,9 +593,6 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#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]
@@ -690,23 +600,11 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define abi_node cp_global_trees[CPTI_ABI]
#define type_info_type_node cp_global_trees[CPTI_TYPE_INFO_TYPE]
#define type_info_ptr_type cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE]
+#define type_info_ref_type cp_global_trees[CPTI_TYPE_INFO_REF_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. */
@@ -780,6 +678,11 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define keyed_classes cp_global_trees[CPTI_KEYED_CLASSES]
+/* Node to indicate default access. This must be distinct from the
+ access nodes in tree.h. */
+
+#define access_default_node null_node
+
/* Global state. */
struct saved_scope GTY(())
@@ -797,12 +700,10 @@ struct saved_scope GTY(())
tree x_previous_class_type;
tree x_previous_class_values;
tree x_saved_tree;
- tree lookups;
- tree last_parms;
HOST_WIDE_INT x_processing_template_decl;
int x_processing_specialization;
- int x_processing_explicit_instantiation;
+ bool x_processing_explicit_instantiation;
int need_pop_function_context;
struct stmt_tree_s x_stmt_tree;
@@ -863,12 +764,8 @@ struct saved_scope GTY(())
/* A list of private types mentioned, for deferred access checking. */
-#define type_lookups scope_chain->lookups
-
extern GTY(()) struct saved_scope *scope_chain;
-struct unparsed_text;
-
/* Global state pertinent to the current function. */
struct language_function GTY(())
@@ -888,10 +785,9 @@ struct language_function GTY(())
int returns_abnormally;
int in_function_try_handler;
int in_base_initializer;
- int x_expanding_p;
/* True if this function can throw an exception. */
- bool can_throw : 1;
+ BOOL_BITFIELD can_throw : 1;
struct named_label_use_list *x_named_label_uses;
struct named_label_list *x_named_labels;
@@ -899,7 +795,6 @@ struct language_function GTY(())
varray_type x_local_names;
const char *cannot_inline;
- struct unparsed_text *unparsed_inlines;
};
/* The current C++-specific per-function global variables. */
@@ -951,18 +846,7 @@ struct language_function GTY(())
#define current_function_returns_abnormally \
cp_function_chain->returns_abnormally
-/* Nonzero 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
-
-/* Nonzero if we are in the semantic analysis phase for the current
- function. */
-
-#define doing_semantic_analysis_p() (!expanding_p)
-
-/* Non-zero if we are processing a base initializer. Zero elsewhere. */
+/* Nonzero if we are processing a base initializer. Zero elsewhere. */
#define in_base_initializer cp_function_chain->in_base_initializer
#define in_function_try_handler cp_function_chain->in_function_try_handler
@@ -973,7 +857,13 @@ struct language_function GTY(())
#define current_function_return_value \
(cp_function_chain->x_return_value)
-extern GTY(()) tree global_namespace;
+/* True if NAME is the IDENTIFIER_NODE for an overloaded "operator
+ new" or "operator delete". */
+#define NEW_DELETE_OPNAME_P(NAME) \
+ ((NAME) == ansi_opname (NEW_EXPR) \
+ || (NAME) == ansi_opname (VEC_NEW_EXPR) \
+ || (NAME) == ansi_opname (DELETE_EXPR) \
+ || (NAME) == ansi_opname (VEC_DELETE_EXPR))
#define ansi_opname(CODE) \
(operator_name_info[(int) (CODE)].identifier)
@@ -1002,6 +892,10 @@ enum cplus_tree_code {
};
#undef DEFTREECODE
+#define cp_stmt_codes \
+ CTOR_INITIALIZER, TRY_BLOCK, HANDLER, \
+ EH_SPEC_BLOCK, USING_STMT, TAG_DEFN
+
enum languages { lang_c, lang_cplusplus, lang_java };
/* Macros to make error reporting functions' lives easier. */
@@ -1046,19 +940,21 @@ enum languages { lang_c, lang_cplusplus, lang_java };
(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) \
- (TREE_CODE (TYPE1) == TREE_CODE (TYPE2) \
- && 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)
-
/* True if this a "Java" type, defined in 'extern "Java"'. */
#define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE)
+/* True if this type is dependent. This predicate is only valid if
+ TYPE_DEPENDENT_P_VALID is true. */
+#define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE)
+
+/* True if dependent_type_p has been called for this type, with the
+ result that TYPE_DEPENDENT_P is valid. */
+#define TYPE_DEPENDENT_P_VALID(NODE) TYPE_LANG_FLAG_6(NODE)
+
/* Nonzero if this type is const-qualified. */
#define CP_TYPE_CONST_P(NODE) \
((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
@@ -1099,7 +995,7 @@ enum languages { lang_c, lang_cplusplus, lang_java };
/* 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) != NULL_TREE)
+ (lookup_base ((TYPE), (PARENT), ba_any, NULL) != NULL_TREE)
/* Nonzero iff TYPE is uniquely derived from PARENT. Ignores
accessibility. */
#define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) \
@@ -1118,15 +1014,15 @@ enum languages { lang_c, lang_cplusplus, lang_java };
are put in this structure to save space. */
struct lang_type_header GTY(())
{
- unsigned is_lang_type_class : 1;
-
- 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;
+ BOOL_BITFIELD is_lang_type_class : 1;
+
+ BOOL_BITFIELD has_type_conversion : 1;
+ BOOL_BITFIELD has_init_ref : 1;
+ BOOL_BITFIELD has_default_ctor : 1;
+ BOOL_BITFIELD uses_multiple_inheritance : 1;
+ BOOL_BITFIELD const_needs_init : 1;
+ BOOL_BITFIELD ref_needs_init : 1;
+ BOOL_BITFIELD has_const_assign_ref : 1;
};
/* This structure provides additional information above and beyond
@@ -1158,11 +1054,12 @@ struct lang_type_class GTY(())
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 contains_empty_class_p : 1;
+ unsigned anon_aggr : 1;
+ unsigned non_zero_init : 1;
+ unsigned empty_p : 1;
unsigned marks: 6;
unsigned vec_new_uses_cookie : 1;
@@ -1172,7 +1069,7 @@ struct lang_type_class GTY(())
unsigned redefined : 1;
unsigned debug_requested : 1;
unsigned use_template : 2;
- unsigned got_semicolon : 1;
+ unsigned fields_readonly : 1;
unsigned ptrmemfunc_flag : 1;
unsigned was_anonymous : 1;
@@ -1182,14 +1079,8 @@ struct lang_type_class GTY(())
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;
- unsigned anon_aggr : 1;
- unsigned non_zero_init : 1;
- unsigned empty_p : 1;
- unsigned contains_empty_class_p : 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! */
@@ -1197,7 +1088,7 @@ struct lang_type_class GTY(())
/* 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 : 5;
+ unsigned dummy : 9;
tree primary_base;
tree vfields;
@@ -1209,7 +1100,7 @@ struct lang_type_class GTY(())
tree as_base;
tree pure_virtuals;
tree friend_classes;
- tree methods;
+ tree GTY ((reorder ("resort_type_method_vec"))) methods;
tree key_method;
tree decl_list;
tree template_info;
@@ -1234,13 +1125,13 @@ struct lang_type GTY(())
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
-#define LANG_TYPE_CLASS_CHECK(NODE) \
+#define LANG_TYPE_CLASS_CHECK(NODE) __extension__ \
({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
if (! lt->u.h.is_lang_type_class) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
&lt->u.c; })
-#define LANG_TYPE_PTRMEM_CHECK(NODE) \
+#define LANG_TYPE_PTRMEM_CHECK(NODE) __extension__ \
({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
if (lt->u.h.is_lang_type_class) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
@@ -1308,18 +1199,6 @@ struct lang_type GTY(())
convenient, don't reprocess any methods that appear in its redefinition. */
#define TYPE_REDEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->redefined)
-/* Nonzero means that this _CLASSTYPE node overloads operator(). */
-#define TYPE_OVERLOADS_CALL_EXPR(NODE) \
- (LANG_TYPE_CLASS_CHECK (NODE)->has_call_overloaded)
-
-/* Nonzero means that this _CLASSTYPE node overloads operator[]. */
-#define TYPE_OVERLOADS_ARRAY_REF(NODE) \
- (LANG_TYPE_CLASS_CHECK (NODE)->has_array_ref_overloaded)
-
-/* Nonzero means that this _CLASSTYPE node overloads operator->. */
-#define TYPE_OVERLOADS_ARROW(NODE) \
- (LANG_TYPE_CLASS_CHECK (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. */
@@ -1417,11 +1296,10 @@ struct lang_type GTY(())
#define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N (NODE, 5)
#define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 5)
-/* A binding_table of the nested tag-types (class, struct, union, or enum)
- found within this class. The ENTRY->name of each node is the name
- of the type; the ENTRY->type is the type itself. This table includes
- nested member class templates. */
-#define CLASSTYPE_NESTED_UDTS(NODE) \
+/* A dictionary of the nested user-defined-types (class-types, or enums)
+ found within this class. This table includes nested member class
+ templates. */
+#define CLASSTYPE_NESTED_UTDS(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->nested_udts)
/* Nonzero if NODE has a primary base class, i.e., a base class with
@@ -1438,21 +1316,9 @@ struct lang_type GTY(())
/* 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. */
+ should be initialized.) */
#define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (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) \
(BINFO_N_BASETYPES (TYPE_BINFO (NODE)))
@@ -1482,14 +1348,11 @@ struct lang_type GTY(())
class must provide its own definition for each of these functions. */
#define CLASSTYPE_PURE_VIRTUALS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals)
-/* Nonzero means that this aggr type has been `closed' by a semicolon. */
-#define CLASSTYPE_GOT_SEMICOLON(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->got_semicolon)
-
/* Nonzero means that this type has an X() constructor. */
#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor)
-/* Nonzero means that this type contains a mutable member */
+/* Nonzero means that this type contains a mutable member. */
#define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable)
#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
@@ -1575,63 +1438,28 @@ struct lang_type GTY(())
/* Additional macros for inheritance information. */
/* The BINFO_INHERITANCE_CHAIN is used opposite to the description in
- gcc/tree.h. In particular if D is derived from B then the BINFO
- 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.
-
- 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_VIA_PRIVATE, which is unused. */
-
-/* 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)
+ gcc/tree.h. In particular if D is non-virtually derived from B
+ then the BINFO for B (in D) will have a BINFO_INHERITANCE_CHAIN
+ pointing to D. If D is virtually derived, its
+ BINFO_INHERITANCE_CHAIN will point to the most derived binfo. In
+ tree.h, this pointer is described as pointing in other
+ direction. The binfos of virtual bases are shared. */
/* 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)) \
- : (void)(TREE_LANG_FLAG_0 (NODE) = 1))
-#define CLEAR_BINFO_MARKED(NODE) \
- (TREE_VIA_VIRTUAL (NODE) \
- ? CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
- : (void)(TREE_LANG_FLAG_0 (NODE) = 0))
+#define BINFO_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
/* 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 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)))
+#define BINFO_VTABLE_PATH_MARKED(NODE) TREE_LANG_FLAG_3 (NODE)
+
+/* Nonzero means B (a BINFO) has its own vtable. Any copies will not
+ have this flag set. */
+#define BINFO_NEW_VTABLE_MARKED(B) (TREE_LANG_FLAG_4 (B))
/* 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, \
+#define SET_BINFO_NEW_VTABLE_MARKED(B) \
+ (BINFO_NEW_VTABLE_MARKED (B) = 1, \
my_friendly_assert (!BINFO_PRIMARY_P (B) \
|| TREE_VIA_VIRTUAL (B), 20000517), \
my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \
@@ -1639,11 +1467,9 @@ struct lang_type GTY(())
/* 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. Note, this can be
- set for non-canononical virtual bases. For a virtual primary base
+ set for non-canonical virtual bases. For a virtual primary base
you might also need to check whether it is canonical. */
#define BINFO_PRIMARY_P(NODE) \
@@ -1651,17 +1477,25 @@ struct lang_type GTY(())
/* 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)
+#define BINFO_SUBVTT_INDEX(NODE) TREE_VEC_ELT (NODE, BINFO_ELTS + 0)
/* 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)
+#define BINFO_VPTR_INDEX(NODE) TREE_VEC_ELT (NODE, BINFO_ELTS + 1)
/* 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)
+#define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT (NODE, BINFO_ELTS + 2)
+
+/* C++ binfos have 3 additional entries. */
+
+#define BINFO_LANG_ELTS (BINFO_ELTS + 3)
+
+/* Nonzero if this binfo is for a dependent base - one that should not
+ be searched. */
+#define BINFO_DEPENDENT_BASE_P(NODE) TREE_LANG_FLAG_1(NODE)
/* 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
@@ -1766,8 +1600,6 @@ struct lang_type GTY(())
struct lang_decl_flags GTY(())
{
- struct c_lang_decl base;
-
ENUM_BITFIELD(languages) language : 8;
unsigned operator_attr : 1;
@@ -1794,15 +1626,20 @@ struct lang_decl_flags GTY(())
unsigned u1sel : 1;
unsigned u2sel : 1;
unsigned can_be_full : 1;
- unsigned unused : 1; /* One unused bit. */
+ unsigned this_thunk_p : 1;
union lang_decl_u {
- /* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
- is DECL_TEMPLATE_INFO. */
+ /* In a FUNCTION_DECL for which DECL_THUNK_P does not hold,
+ VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is
+ DECL_TEMPLATE_INFO. */
tree GTY ((tag ("0"))) template_info;
/* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */
struct cp_binding_level * GTY ((tag ("1"))) level;
+
+ /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
+ THUNK_ALIAS. */
+ tree GTY ((tag ("2"))) thunk_alias;
} GTY ((desc ("%1.u1sel"))) u;
union lang_decl_u2 {
@@ -1810,14 +1647,17 @@ struct lang_decl_flags GTY(())
tree GTY ((tag ("0"))) access;
/* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */
- int discriminator;
+ int GTY ((tag ("1"))) discriminator;
/* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
- THUNK_VCALL_OFFSET. */
- tree GTY((tag ("2"))) vcall_offset;
+ THUNK_VIRTUAL_OFFSET. */
+ tree GTY((tag ("2"))) virtual_offset;
} GTY ((desc ("%1.u2sel"))) u2;
};
+/* sorted_fields is sorted based on a pointer, so we need to be able
+ to resort it if pointers get rearranged. */
+
struct lang_decl GTY(())
{
struct lang_decl_flags decl_flags;
@@ -1826,19 +1666,25 @@ struct lang_decl GTY(())
{
struct full_lang_decl
{
+ /* For a non-thunk function decl, this is a tree list of
+ friendly classes. For a thunk function decl, it is the
+ thunked to function decl. */
tree befriending_classes;
/* For a non-virtual FUNCTION_DECL, this is
DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which
- DECL_THUNK_P does not hold, this is DECL_THUNKS. */
+ DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both
+ this pointer and result pointer adjusting thunks are
+ chained here. This pointer thunks to return pointer thunks
+ will be chained on the return pointer thunk. */
tree context;
/* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */
tree cloned_function;
/* In a FUNCTION_DECL for which THUNK_P holds, this is
- THUNK_DELTA. */
- HOST_WIDE_INT delta;
+ THUNK_FIXED_OFFSET. */
+ HOST_WIDE_INT fixed_offset;
/* In an overloaded operator, this is the value of
DECL_OVERLOADED_OPERATOR_P. */
@@ -1849,8 +1695,9 @@ struct lang_decl GTY(())
union lang_decl_u3
{
- tree GTY ((tag ("0"))) sorted_fields;
- struct unparsed_text * GTY ((tag ("2"))) pending_inline_info;
+ struct sorted_fields_type * GTY ((tag ("0"), reorder ("resort_sorted_fields")))
+ sorted_fields;
+ struct cp_token_cache * GTY ((tag ("2"))) pending_inline_info;
struct language_function * GTY ((tag ("1")))
saved_language_function;
} GTY ((desc ("%1.u3sel + %1.pending_inline_p"))) u;
@@ -1860,7 +1707,7 @@ struct lang_decl GTY(())
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
-#define LANG_DECL_U2_CHECK(NODE, TF) \
+#define LANG_DECL_U2_CHECK(NODE, TF) __extension__ \
({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
if (lt->decl_flags.u2sel != TF) \
lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
@@ -1873,8 +1720,6 @@ struct lang_decl GTY(())
#endif /* ENABLE_TREE_CHECKING */
-#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,
@@ -1886,15 +1731,7 @@ struct lang_decl GTY(())
((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)))
-
-/* Nonzero iff DECL is memory-based. The DECL_RTL of
- certain const variables might be a CONST_INT, or a REG
- in some cases. We cannot use `memory_operand' as a test
- 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_SET_P (NODE) && GET_CODE (DECL_RTL (NODE)) == MEM)
+ || (((flag_syntax_only || flag_unit_at_a_time) && TREE_USED (DECL))))
/* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the
declaration. Some entities (like a member function in a local
@@ -2003,7 +1840,7 @@ struct lang_decl GTY(())
/* Nonzero if NODE is a user-defined conversion operator. */
#define DECL_CONV_FN_P(NODE) \
- (IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
+ (DECL_NAME (NODE) && IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
/* If FN is a conversion operator, the type to which it converts.
Otherwise, NULL_TREE. */
@@ -2021,7 +1858,7 @@ struct lang_decl GTY(())
(DECL_LANG_SPECIFIC (NODE)->u.f.operator_code = (CODE))
/* If NODE is an overloaded operator, then this returns the TREE_CODE
- associcated with the overloaded operator.
+ associated 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
@@ -2057,9 +1894,14 @@ struct lang_decl GTY(())
#define DECL_INITIALIZED_P(NODE) \
(TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE)))
+/* Nonzero for a VAR_DECL that was initialized with a
+ constant-expression. */
+#define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \
+ (TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE)))
+
/* Nonzero if the DECL was initialized in the class definition itself,
rather than outside the class. This is used for both static member
- VAR_DECLS, and FUNTION_DECLS that are defined in the class. */
+ VAR_DECLS, and FUNTION_DECLS that are defined in the class. */
#define DECL_INITIALIZED_IN_CLASS_P(DECL) \
(DECL_LANG_SPECIFIC (DECL)->decl_flags.initialized_in_class)
@@ -2126,8 +1968,7 @@ struct lang_decl GTY(())
#define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) \
(DECL_LANG_SPECIFIC (NODE)->decl_flags.needs_final_overrider)
-/* The thunks associated with NODE, a FUNCTION_DECL that is not itself
- a thunk. */
+/* The thunks associated with NODE, a FUNCTION_DECL. */
#define DECL_THUNKS(NODE) \
(DECL_LANG_SPECIFIC (NODE)->u.f.context)
@@ -2136,6 +1977,14 @@ struct lang_decl GTY(())
(TREE_CODE (NODE) == FUNCTION_DECL \
&& DECL_LANG_FLAG_7 (NODE))
+/* Nonzero if NODE is a this pointer adjusting thunk. */
+#define DECL_THIS_THUNK_P(NODE) \
+ (DECL_THUNK_P (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
+
+/* Nonzero if NODE is a result pointer adjusting thunk. */
+#define DECL_RESULT_THUNK_P(NODE) \
+ (DECL_THUNK_P (NODE) && !DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
+
/* 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))
@@ -2149,14 +1998,15 @@ struct lang_decl GTY(())
(DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
/* Set DECL_THUNK_P for node. */
-#define SET_DECL_THUNK_P(NODE) \
+#define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \
(DECL_LANG_FLAG_7 (NODE) = 1, \
- DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1)
+ DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1, \
+ DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p = (THIS_ADJUSTING))
/* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
template function. */
#define DECL_PRETTY_FUNCTION_P(NODE) \
- (TREE_LANG_FLAG_0 (NODE))
+ (TREE_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)))
/* The _TYPE context in which this _DECL appears. This field holds the
class where a virtual function instance is actually defined. */
@@ -2197,6 +2047,9 @@ struct lang_decl GTY(())
(DECL_CONTEXT (NODE) \
&& TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
+/* 1 iff VAR_DECL node NODE is virtual table or VTT. */
+#define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE))
+
/* 1 iff NODE is function-local, but for types. */
#define LOCAL_CLASS_P(NODE) \
(decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
@@ -2210,6 +2063,11 @@ struct lang_decl GTY(())
of a namespace, to record the transitive closure of using namespace. */
#define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
+/* In a NAMESPACE_DECL, the list of namespaces which have associated
+ themselves with this one. */
+#define DECL_NAMESPACE_ASSOCIATIONS(NODE) \
+ (NAMESPACE_DECL_CHECK (NODE)->decl.saved_tree)
+
/* In a NAMESPACE_DECL, points to the original namespace if this is
a namespace alias. */
#define DECL_NAMESPACE_ALIAS(NODE) \
@@ -2318,11 +2176,8 @@ struct lang_decl GTY(())
/* Nonzero 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 \
+#define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
+ (NODE && TREE_VEC_ELT (NODE, 0) \
&& TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
/* The depth of a template argument vector. When called directly by
@@ -2356,9 +2211,7 @@ struct lang_decl GTY(())
/* 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)))
+ (TREE_VEC_LENGTH (NODE))
/* Returns the innermost level of template arguments in ARGS. */
#define INNERMOST_TEMPLATE_ARGS(NODE) \
@@ -2378,14 +2231,13 @@ struct lang_decl GTY(())
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, IDENTIFIER_NODE or OVERLOAD indicating the name of
- the template and any explicit template arguments provided. For
- example, in:
+ class, this value will not be a TEMPLATE_DECL, but rather an
+ 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
+ the DECL_TI_TEMPLATE will be an IDENTIFIER_NODE for `f' and the
DECL_TI_ARGS will be {int}. */
#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
@@ -2402,6 +2254,14 @@ struct lang_decl GTY(())
#define ENUM_TI_ARGS(NODE) \
TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
+/* For a template instantiation TYPE, returns the TYPE corresponding
+ to the primary template. Otherwise returns TYPE itself. */
+#define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \
+ ((CLASSTYPE_USE_TEMPLATE ((TYPE)) && !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE))) \
+ ? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \
+ (CLASSTYPE_TI_TEMPLATE ((TYPE))))) \
+ : (TYPE))
+
/* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
#define TYPE_TI_TEMPLATE(NODE) \
(TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
@@ -2425,7 +2285,14 @@ struct lang_decl GTY(())
#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)
+
+/* Indicates that this is a non-dependent COMPOUND_EXPR which will
+ resolve to a function call. */
+#define COMPOUND_EXPR_OVERLOADED(NODE) TREE_LANG_FLAG_0 (NODE)
+
+/* In a CALL_EXPR appearing in a template, true if Koenig lookup
+ should be performed at instantiation time. */
+#define KOENIG_LOOKUP_P(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. */
@@ -2447,17 +2314,6 @@ struct lang_decl GTY(())
TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
#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 (INTEGER_CST_CHECK (NODE))
@@ -2539,16 +2395,18 @@ struct lang_decl GTY(())
(ARITHMETIC_TYPE_P (TYPE) \
|| TREE_CODE (TYPE) == ENUMERAL_TYPE \
|| TYPE_PTR_P (TYPE) \
- || TYPE_PTRMEM_P (TYPE) \
- || TYPE_PTRMEMFUNC_P (TYPE))
+ || TYPE_PTR_TO_MEMBER_P (TYPE))
/* [dcl.init.aggr]
An aggregate is an array or a class with no user-declared
constructors, no private or protected non-static data members, no
- base classes, and no virtual functions. */
+ base classes, and no virtual functions.
+
+ As an extension, we also treat vectors as aggregates. */
#define CP_AGGREGATE_TYPE_P(TYPE) \
(TREE_CODE (TYPE) == ARRAY_TYPE \
+ || TREE_CODE (TYPE) == VECTOR_TYPE \
|| (CLASS_TYPE_P (TYPE) \
&& !CLASSTYPE_NON_AGGREGATE (TYPE)))
@@ -2623,14 +2481,15 @@ struct lang_decl GTY(())
#define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
(TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
-#define TYPE_PTRMEM_P(NODE) \
- (TREE_CODE (NODE) == POINTER_TYPE \
- && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
-#define TYPE_PTR_P(NODE) \
- (TREE_CODE (NODE) == POINTER_TYPE \
- && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
-#define TYPE_PTROB_P(NODE) \
- (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
+/* Returns true if NODE is a pointer-to-data-member. */
+#define TYPE_PTRMEM_P(NODE) \
+ (TREE_CODE (NODE) == OFFSET_TYPE)
+#define TYPE_PTR_P(NODE) \
+ (TREE_CODE (NODE) == POINTER_TYPE)
+#define TYPE_PTROB_P(NODE) \
+ (TYPE_PTR_P (NODE) \
+ && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
+ && TREE_CODE (TREE_TYPE (NODE)) != METHOD_TYPE \
&& TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
#define TYPE_PTROBV_P(NODE) \
(TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
@@ -2651,6 +2510,10 @@ struct lang_decl GTY(())
#define TYPE_PTRMEMFUNC_FLAG(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->ptrmemfunc_flag)
+/* Returns true if NODE is a pointer-to-member. */
+#define TYPE_PTR_TO_MEMBER_P(NODE) \
+ (TYPE_PTRMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE))
+
/* 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)
@@ -2689,13 +2552,13 @@ struct lang_decl GTY(())
type `const X*'. */
#define TYPE_PTRMEM_CLASS_TYPE(NODE) \
(TYPE_PTRMEM_P (NODE) \
- ? TYPE_OFFSET_BASETYPE (TREE_TYPE (NODE)) \
+ ? TYPE_OFFSET_BASETYPE (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 (NODE) \
: TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
/* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
@@ -2742,14 +2605,8 @@ struct lang_decl GTY(())
/* The format of each node in the DECL_FRIENDLIST is as follows:
The TREE_PURPOSE will be the name of a function, i.e., an
- IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, the
- list of functions with that name which are friends. The
- TREE_PURPOSE of each node in this sublist will be error_mark_node,
- if the function was declared a friend individually, in which case
- the TREE_VALUE will be the function_decl. If, however, all
- functions with a given name in a class were declared to be friends,
- the TREE_PUROSE will be the class type, and the TREE_VALUE will be
- NULL_TREE. */
+ IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, whose
+ TREE_VALUEs are friends with the given name. */
#define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
#define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
#define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
@@ -2780,7 +2637,7 @@ struct lang_decl GTY(())
TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
non-type parameter), or a TYPE_DECL (if the parameter is a type
parameter). The TREE_PURPOSE is the default value, if any. The
- TEMPLATE_PARM_INDEX for the parameter is avilable as the
+ TEMPLATE_PARM_INDEX for the parameter is available 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)
@@ -2864,13 +2721,20 @@ struct lang_decl GTY(())
#define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
(TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
+/* Nonzero if NODE is a TEMPLATE_DECL representing an
+ UNBOUND_CLASS_TEMPLATE tree node. */
+#define DECL_UNBOUND_CLASS_TEMPLATE_P(NODE) \
+ (TREE_CODE (NODE) == TEMPLATE_DECL && !DECL_TEMPLATE_RESULT (NODE))
+
#define DECL_FUNCTION_TEMPLATE_P(NODE) \
(TREE_CODE (NODE) == TEMPLATE_DECL \
+ && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \
&& TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
/* Nonzero for a DECL that represents a template class. */
#define DECL_CLASS_TEMPLATE_P(NODE) \
(TREE_CODE (NODE) == TEMPLATE_DECL \
+ && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \
&& TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
&& !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
@@ -2951,12 +2815,6 @@ struct lang_decl GTY(())
#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
(DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
-/* Nonzero if TYPE is a partial instantiation of a template class,
- i.e., an instantiation whose instantiation arguments involve
- template types. */
-#define PARTIAL_INSTANTIATION_P(TYPE) \
- (LANG_TYPE_CLASS_CHECK (TYPE)->is_partial_instantiation)
-
/* Nonzero iff we are currently processing a declaration for an
entity with its own template parameter list, and which is not a
full specialization. */
@@ -2972,12 +2830,6 @@ struct lang_decl GTY(())
/* We know what we're doing with this decl now. */
#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
-/* 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_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
tell us whether the decl is really not external. */
@@ -2992,33 +2844,65 @@ struct lang_decl GTY(())
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.
-
+ FUNCTION_DECL. The job of the thunk is to either adjust the this
+ pointer before transferring control to the FUNCTION_DECL, or call
+ FUNCTION_DECL and then adjust the result value. Note, the result
+ pointer adjusting thunk must perform a call to the thunked
+ function, (or be implemented via passing some invisible parameter
+ to the thunked function, which is modified to perform the
+ adjustment just before returning).
+
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
+ o Adjust the this or result pointer by a constant offset.
+ o Adjust the this or result pointer by looking up a vcall or vbase offset
in the vtable.
- If both operations are performed, then the constant adjument to
- `this' is performed first.
-
- 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. */
+ A this pointer adjusting thunk converts from a base to a derived
+ class, and hence adds the offsets. A result pointer adjusting thunk
+ converts from a derived class to a base, and hence subtracts the
+ offsets. If both operations are performed, then the constant
+ adjustment is performed first for this pointer adjustment and last
+ for the result pointer adjustment.
+
+ The constant adjustment is given by THUNK_FIXED_OFFSET. If the
+ vcall or vbase offset is required, THUNK_VIRTUAL_OFFSET is
+ used. For this pointer adjusting thunks, it is the vcall offset
+ into the vtable. For result pointer adjusting thunks it is the
+ binfo of the virtual base to convert to. Use that binfo's vbase
+ offset.
+
+ It is possible to have equivalent covariant thunks. These are
+ distinct virtual covariant thunks whose vbase offsets happen to
+ have the same value. THUNK_ALIAS is used to pick one as the
+ canonical thunk, which will get all the this pointer adjusting
+ thunks attached to it. */
/* An integer indicating how many bytes should be subtracted from the
- `this' pointer when this function is called. */
-#define THUNK_DELTA(DECL) \
- (DECL_LANG_SPECIFIC (DECL)->u.f.delta)
-
-/* 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) \
- (LANG_DECL_U2_CHECK (DECL, 0)->vcall_offset)
+ this or result pointer when this function is called. */
+#define THUNK_FIXED_OFFSET(DECL) \
+ (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL))->u.f.fixed_offset)
+
+/* A tree indicating how to perform the virtual adjustment. For a this
+ adjusting thunk it is the number of bytes to be added to the vtable
+ to find the vcall offset. For a result adjusting thunk, it is the
+ binfo of the relevant virtual base. If NULL, then there is no
+ virtual adjust. (The vptr is always located at offset zero from
+ the this or result pointer.) (If the covariant type is within the
+ class hierarchy being laid out, the vbase index is not yet known
+ at the point we need to create the thunks, hence the need to use
+ binfos.) */
+
+#define THUNK_VIRTUAL_OFFSET(DECL) \
+ (LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->virtual_offset)
+
+/* A thunk which is equivalent to another thunk. */
+#define THUNK_ALIAS(DECL) \
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.u.thunk_alias)
+
+/* For thunk NODE, this is the FUNCTION_DECL thunked to. */
+#define THUNK_TARGET(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes)
/* These macros provide convenient access to the various _STMT nodes
created when parsing template declarations. */
@@ -3049,7 +2933,14 @@ struct lang_decl GTY(())
(TREE_TYPE (NODE))
/* An enumeration of the kind of tags that C++ accepts. */
-enum tag_types { record_type, class_type, union_type, enum_type };
+enum tag_types {
+ none_type = 0, /* Not a tag type. */
+ record_type, /* "struct" types. */
+ class_type, /* "class" types. */
+ union_type, /* "union" types. */
+ enum_type, /* "enum" types. */
+ typename_type /* "typename" types. */
+};
/* The various kinds of lvalues we distinguish. */
typedef enum cp_lvalue_kind {
@@ -3057,16 +2948,9 @@ typedef enum cp_lvalue_kind {
clk_ordinary = 1, /* An ordinary lvalue. */
clk_class = 2, /* An rvalue of class-type. */
clk_bitfield = 4, /* An lvalue for a bit-field. */
+ clk_packed = 8 /* An lvalue for a packed 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. */
@@ -3142,19 +3026,22 @@ typedef enum tsubst_flags_t {
tf_none = 0, /* nothing special */
tf_error = 1 << 0, /* give error messages */
tf_warning = 1 << 1, /* give warnings too */
- tf_no_attributes = 1 << 2, /* ignore attributes on comparisons
- (instantiate_type use) */
- tf_ignore_bad_quals = 1 << 3, /* ignore bad cvr qualifiers */
- tf_keep_type_decl = 1 << 4, /* retain typedef type decls
+ tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */
+ tf_keep_type_decl = 1 << 3, /* retain typedef type decls
(make_typename_type use) */
- tf_ptrmem_ok = 1 << 5, /* pointers to member ok (internal
- instantiate_type use) */
- tf_parsing = 1 << 6, /* called from parser
- (make_typename_type use) */
- tf_conv = 1 << 8, /* We are determining what kind of
- conversion might be permissible, not
- actually performing the
- conversion. */
+ tf_ptrmem_ok = 1 << 4, /* pointers to member ok (internal
+ instantiate_type use) */
+ tf_user = 1 << 5, /* found template must be a user template
+ (lookup_template_class use) */
+ tf_stmt_expr_cmpd = 1 << 6, /* tsubsting the compound statement of
+ a statement expr. */
+ tf_stmt_expr_body = 1 << 7, /* tsubsting the statements in the
+ body of the compound statement of a
+ statement expr. */
+ tf_conv = 1 << 8 /* We are determining what kind of
+ conversion might be permissible,
+ not actually performing the
+ conversion. */
} tsubst_flags_t;
/* The kind of checking we can do looking in a class hierarchy. */
@@ -3165,9 +3052,16 @@ typedef enum base_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). */
+ ba_quiet = 4 /* Do not issue error messages (bit mask). */
} base_access;
+/* The various kinds of access check during parsing. */
+typedef enum deferring_kind {
+ dk_no_deferred = 0, /* Check access immediately */
+ dk_deferred = 1, /* Deferred check */
+ dk_no_check = 2 /* No access check */
+} deferring_kind;
+
/* The kind of base we can find, looking in a class hierarchy.
Values <0 indicate we failed. */
typedef enum base_kind {
@@ -3199,13 +3093,37 @@ extern GTY(()) tree error_mark_list;
extern GTY(()) tree integer_two_node;
extern GTY(()) tree integer_three_node;
-extern GTY(()) tree anonymous_namespace_name;
-
/* 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;
+typedef struct deferred_access GTY(())
+{
+ /* A TREE_LIST representing name-lookups for which we have deferred
+ checking access controls. We cannot check the accessibility of
+ names used in a decl-specifier-seq until we know what is being
+ declared because code like:
+
+ class A {
+ class B {};
+ B* f();
+ }
+
+ A::B* A::f() { return 0; }
+
+ is valid, even though `A::B' is not generally accessible.
+
+ The TREE_PURPOSE of each node is the scope used to qualify the
+ name being looked up; the TREE_VALUE is the DECL to which the
+ name was resolved. */
+ tree deferred_access_checks;
+ /* The current mode of access checks. */
+ enum deferring_kind deferring_access_checks_kind;
+ /* The next deferred access data in stack or linked-list. */
+ struct deferred_access *next;
+} deferred_access;
+
/* in pt.c */
/* These values are used for the `STRICT' parameter to type_unification and
@@ -3382,7 +3300,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
#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
+/* These are uses as bits in flags passed to build_new_method_call
to control its error reporting behavior.
LOOKUP_PROTECT means flag access violations.
@@ -3412,25 +3330,23 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
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.
- LOOKUP_TEMPLATES_EXPECTED means that class templates also count
- as types. */
-
-#define LOOKUP_PROTECT (1)
-#define LOOKUP_COMPLAIN (2)
-#define LOOKUP_NORMAL (3)
-#define LOOKUP_NONVIRTUAL (8)
-#define LOOKUP_GLOBAL (16)
-#define LOOKUP_SPECULATIVELY (64)
-#define LOOKUP_ONLYCONVERTING (128)
-#define DIRECT_BIND (256)
-#define LOOKUP_NO_CONVERSION (512)
-#define LOOKUP_DESTRUCTOR (512)
-#define LOOKUP_NO_TEMP_BIND (1024)
-#define LOOKUP_PREFER_TYPES (2048)
-#define LOOKUP_PREFER_NAMESPACES (4096)
-#define LOOKUP_PREFER_BOTH (6144)
-#define LOOKUP_TEMPLATES_EXPECTED (8192)
+ LOOKUP_PREFER_BOTH means class-or-namespace-name. */
+
+#define LOOKUP_PROTECT (1 << 0)
+#define LOOKUP_COMPLAIN (1 << 1)
+#define LOOKUP_NORMAL (LOOKUP_PROTECT | LOOKUP_COMPLAIN)
+#define LOOKUP_NONVIRTUAL (1 << 2)
+#define LOOKUP_GLOBAL (1 << 3)
+#define LOOKUP_SPECULATIVELY (1 << 4)
+#define LOOKUP_ONLYCONVERTING (1 << 5)
+#define DIRECT_BIND (1 << 6)
+#define LOOKUP_NO_CONVERSION (1 << 7)
+#define LOOKUP_DESTRUCTOR (1 << 8)
+#define LOOKUP_NO_TEMP_BIND (1 << 9)
+#define LOOKUP_PREFER_TYPES (1 << 10)
+#define LOOKUP_PREFER_NAMESPACES (1 << 11)
+#define LOOKUP_PREFER_BOTH (LOOKUP_PREFER_TYPES | LOOKUP_PREFER_NAMESPACES)
+#define LOOKUP_CONSTRUCTOR_CALLABLE (1 << 12)
#define LOOKUP_NAMESPACES_ONLY(F) \
(((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
@@ -3477,20 +3393,12 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
#define COMPARE_STRICT 0 /* Just check if the types are the
same. */
#define COMPARE_BASE 1 /* Check to see if the second type is
- derived from the first, or if both
- are pointers (or references) and
- the types pointed to by the second
- type is derived from the pointed to
- by the first. */
-#define COMPARE_RELAXED 2 /* Like COMPARE_DERIVED, but in
- reverse. Also treat enumeration
- types as the same as integer types
- of the same width. */
-#define COMPARE_REDECLARATION 4 /* The comparsion is being done when
+ derived from the first. */
+#define COMPARE_DERIVED 2 /* Like COMPARE_BASE, but in
+ reverse. */
+#define COMPARE_REDECLARATION 4 /* The comparison is being done when
another declaration of an existing
entity is seen. */
-#define COMPARE_NO_ATTRIBUTES 8 /* The comparison should ignore
- extra-linguistic type attributes. */
/* Used with push_overloaded_decl. */
#define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
@@ -3548,7 +3456,8 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
TFF_TEMPLATE_HEADER: show the template<...> header in a
template-declaration.
TFF_TEMPLATE_NAME: show only template-name.
- TFF_EXPR_IN_PARENS: Parenthesize expressions. */
+ TFF_EXPR_IN_PARENS: parenthesize expressions.
+ TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments. */
#define TFF_PLAIN_IDENTIFIER (0)
#define TFF_SCOPE (1)
@@ -3561,6 +3470,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
#define TFF_TEMPLATE_HEADER (1 << 7)
#define TFF_TEMPLATE_NAME (1 << 8)
#define TFF_EXPR_IN_PARENS (1 << 9)
+#define TFF_NO_FUNCTION_ARGUMENTS (1 << 10)
/* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
node. */
@@ -3571,14 +3481,14 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
/* in lex.c */
-extern void init_reswords PARAMS ((void));
+extern void init_reswords (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 const char **opname_tab, **assignop_tab;
-typedef struct operator_name_info_t
+typedef struct operator_name_info_t GTY(())
{
/* The IDENTIFIER_NODE for the operator. */
tree identifier;
@@ -3591,856 +3501,745 @@ typedef struct operator_name_info_t
} operator_name_info_t;
/* A mapping from tree codes to operator name information. */
-extern operator_name_info_t operator_name_info[];
+extern GTY(()) operator_name_info_t operator_name_info
+ [(int) LAST_CPLUS_TREE_CODE];
/* Similar, but for assignment operators. */
-extern operator_name_info_t assignment_operator_name_info[];
+extern GTY(()) operator_name_info_t assignment_operator_name_info
+ [(int) LAST_CPLUS_TREE_CODE];
/* in call.c */
-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 resolve_scoped_fn_name PARAMS ((tree, tree));
-extern tree build_user_type_conversion PARAMS ((tree, tree, int));
-extern tree build_new_function_call PARAMS ((tree, tree));
-extern tree build_new_method_call (tree, tree, tree, tree, int);
-extern tree build_special_member_call (tree, tree, tree, tree, int);
-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 cxx_type_promotes_to PARAMS ((tree));
-extern tree type_passed_as PARAMS ((tree));
-extern tree convert_for_arg_passing PARAMS ((tree, tree));
-extern tree cp_convert_parm_for_inlining PARAMS ((tree, tree, tree));
-extern int is_properly_derived_from PARAMS ((tree, tree));
-extern tree initialize_reference PARAMS ((tree, tree, tree, tree *));
-extern tree make_temporary_var_for_ref_to_temp (tree, tree);
-extern tree strip_top_quals PARAMS ((tree));
-extern tree perform_implicit_conversion PARAMS ((tree, tree));
+extern bool check_dtor_name (tree, tree);
+
+extern tree build_vfield_ref (tree, tree);
+extern tree build_conditional_expr (tree, tree, tree);
+extern tree build_addr_func (tree);
+extern tree build_call (tree, tree);
+extern bool null_ptr_cst_p (tree);
+extern bool sufficient_parms_p (tree);
+extern tree type_decays_to (tree);
+extern tree build_user_type_conversion (tree, tree, int);
+extern tree build_new_function_call (tree, tree);
+extern tree build_operator_new_call (tree, tree, tree *, tree *);
+extern tree build_new_method_call (tree, tree, tree, tree, int);
+extern tree build_special_member_call (tree, tree, tree, tree, int);
+extern tree build_new_op (enum tree_code, int, tree, tree, tree, bool *);
+extern tree build_op_delete_call (enum tree_code, tree, tree, int, tree);
+extern bool can_convert (tree, tree);
+extern bool can_convert_arg (tree, tree, tree);
+extern bool can_convert_arg_bad (tree, tree, tree);
+extern bool enforce_access (tree, tree);
+extern tree convert_default_arg (tree, tree, tree, int);
+extern tree convert_arg_to_ellipsis (tree);
+extern tree build_x_va_arg (tree, tree);
+extern tree cxx_type_promotes_to (tree);
+extern tree type_passed_as (tree);
+extern tree convert_for_arg_passing (tree, tree);
+extern tree cp_convert_parm_for_inlining (tree, tree, tree);
+extern bool is_properly_derived_from (tree, tree);
+extern tree initialize_reference (tree, tree, tree, tree *);
+extern tree make_temporary_var_for_ref_to_temp (tree, tree);
+extern tree strip_top_quals (tree);
+extern tree perform_implicit_conversion (tree, tree);
extern tree perform_direct_initialization_if_possible (tree, tree);
+extern tree in_charge_arg_for_name (tree);
+extern tree build_cxx_call (tree, tree, tree);
/* in class.c */
-extern tree build_base_path PARAMS ((enum tree_code, tree, tree, int));
+extern tree build_base_path (enum tree_code, tree, tree, int);
extern tree convert_to_base (tree, tree, bool);
-extern tree convert_to_base_statically (tree, tree);
-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, tsubst_flags_t));
-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_print_error_function PARAMS ((struct diagnostic_context *,
- const char *));
-extern void build_self_reference PARAMS ((void));
-extern int same_signature_p PARAMS ((tree, tree));
-extern void warn_hidden PARAMS ((tree));
-extern void maybe_add_class_template_decl_list PARAMS ((tree, tree, int));
-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 build_cxx_call PARAMS ((tree, tree, tree));
-extern tree get_vtt_name PARAMS ((tree));
-extern tree get_primary_binfo PARAMS ((tree));
+extern tree convert_to_base_statically (tree, tree);
+extern tree build_vtbl_ref (tree, tree);
+extern tree build_vfn_ref (tree, tree);
+extern tree get_vtable_decl (tree, int);
+extern void resort_type_method_vec
+ (void *, void *, gt_pointer_operator, void *);
+extern void add_method (tree, tree, int);
+extern int currently_open_class (tree);
+extern tree currently_open_derived_class (tree);
+extern tree finish_struct (tree, tree);
+extern void finish_struct_1 (tree);
+extern int resolves_to_fixed_type_p (tree, int *);
+extern void init_class_processing (void);
+extern int is_empty_class (tree);
+extern void pushclass (tree);
+extern void popclass (void);
+extern void push_nested_class (tree);
+extern void pop_nested_class (void);
+extern int current_lang_depth (void);
+extern void push_lang_context (tree);
+extern void pop_lang_context (void);
+extern tree instantiate_type (tree, tree, tsubst_flags_t);
+extern void print_class_statistics (void);
+extern void cxx_print_statistics (void);
+extern void cxx_print_xnode (FILE *, tree, int);
+extern void cxx_print_decl (FILE *, tree, int);
+extern void cxx_print_type (FILE *, tree, int);
+extern void cxx_print_identifier (FILE *, tree, int);
+extern void cxx_print_error_function (struct diagnostic_context *,
+ const char *);
+extern void build_self_reference (void);
+extern int same_signature_p (tree, tree);
+extern void warn_hidden (tree);
+extern void maybe_add_class_template_decl_list (tree, tree, int);
+extern tree get_enclosing_class (tree);
+extern void unreverse_member_declarations (tree);
+extern void invalidate_class_lookup_cache (void);
+extern void maybe_note_name_used_in_class (tree, tree);
+extern void note_name_declared_in_class (tree, tree);
+extern tree get_vtbl_decl_for_binfo (tree);
+extern tree get_vtt_name (tree);
+extern tree get_primary_binfo (tree);
+extern void debug_class (tree);
+extern void debug_thunks (tree);
/* in cvt.c */
-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 force_rvalue PARAMS ((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));
-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));
+extern tree convert_to_reference (tree, tree, int, int, tree);
+extern tree convert_from_reference (tree);
+extern tree convert_lvalue (tree, tree);
+extern tree force_rvalue (tree);
+extern tree ocp_convert (tree, tree, int, int);
+extern tree cp_convert (tree, tree);
+extern tree convert_to_void (tree, const char */*implicit context*/);
+extern tree convert_force (tree, tree, int);
+extern tree build_type_conversion (tree, tree);
+extern tree build_expr_type_conversion (int, tree, bool);
+extern tree type_promotes_to (tree);
+extern tree perform_qualification_conversions (tree, tree);
+extern void clone_function_decl (tree, int);
+extern void adjust_clone_args (tree);
/* decl.c */
-extern int global_bindings_p PARAMS ((void));
-extern int kept_level_p PARAMS ((void));
-extern bool innermost_scope_is_class_p (void);
-extern tree getdecls PARAMS ((void));
-extern void pushlevel PARAMS ((int));
-extern tree poplevel PARAMS ((int,int, int));
-extern void insert_block PARAMS ((tree));
-extern void set_block PARAMS ((tree));
-extern tree pushdecl PARAMS ((tree));
-extern void cxx_init_decl_processing PARAMS ((void));
+extern void insert_block (tree);
+extern void set_block (tree);
+extern tree pushdecl (tree);
+extern void cxx_init_decl_processing (void);
enum cp_tree_node_structure_enum cp_tree_node_structure
- PARAMS ((union lang_tree_node *));
-extern void cxx_insert_default_attributes PARAMS ((tree));
-extern bool cxx_mark_addressable PARAMS ((tree));
-extern void cxx_push_function_context PARAMS ((struct function *));
-extern void cxx_pop_function_context PARAMS ((struct function *));
-extern void cxx_mark_function_context PARAMS ((struct function *));
-extern int toplevel_bindings_p PARAMS ((void));
-extern int namespace_bindings_p PARAMS ((void));
-extern void keep_next_level PARAMS ((int));
-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 cp_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 cp_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));
+ (union lang_tree_node *);
+extern bool cxx_mark_addressable (tree);
+extern void cxx_push_function_context (struct function *);
+extern void cxx_pop_function_context (struct function *);
+extern void cxx_mark_function_context (struct function *);
+extern void maybe_push_cleanup_level (tree);
+extern void finish_scope (void);
+extern void delete_block (tree);
+extern void add_block_current_level (tree);
+extern void push_switch (tree);
+extern void pop_switch (void);
+extern void pushtag (tree, tree, int);
+extern tree make_anon_name (void);
+extern void clear_anon_tags (void);
+extern int decls_match (tree, tree);
+extern tree duplicate_decls (tree, tree);
+extern tree pushdecl_top_level (tree);
extern tree pushdecl_top_level_and_finish (tree, tree);
-extern bool pushdecl_class_level (tree);
-extern tree pushdecl_namespace_level PARAMS ((tree));
-extern tree push_using_decl PARAMS ((tree, tree));
-extern tree push_using_directive PARAMS ((tree));
-extern bool push_class_level_binding (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 cxx_binding *binding_for_name (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, tsubst_flags_t));
-extern tree make_unbound_class_template PARAMS ((tree, tree, tsubst_flags_t));
-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 bool is_ancestor (tree, tree);
-extern tree unqualified_namespace_lookup PARAMS ((tree, int, tree *));
+extern tree push_using_decl (tree, tree);
+extern tree implicitly_declare (tree);
+extern tree declare_local_label (tree);
+extern tree define_label (location_t, tree);
+extern void check_goto (tree);
+extern void define_case_label (void);
+extern tree make_typename_type (tree, tree, tsubst_flags_t);
+extern tree make_unbound_class_template (tree, tree, tsubst_flags_t);
extern tree check_for_out_of_scope_variable (tree);
-extern bool lookup_using_namespace (tree, cxx_binding *, tree, tree, int, tree *);
-extern bool qualified_lookup_using_namespace (tree, tree, cxx_binding *, 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 tree start_handler_parms PARAMS ((tree, tree));
-extern int complete_array_type PARAMS ((tree, tree, int));
-extern tree build_ptrmemfunc_type PARAMS ((tree));
+extern tree build_library_fn (tree, tree);
+extern tree build_library_fn_ptr (const char *, tree);
+extern tree build_cp_library_fn_ptr (const char *, tree);
+extern tree push_library_fn (tree, tree);
+extern tree push_void_library_fn (tree, tree);
+extern tree push_throw_library_fn (tree, tree);
+extern int init_type_desc (void);
+extern tree check_tag_decl (tree);
+extern tree shadow_tag (tree);
+extern tree groktypename (tree);
+extern tree start_decl (tree, tree, int, tree, tree);
+extern void start_decl_1 (tree);
+extern void cp_finish_decl (tree, tree, tree, int);
+extern void finish_decl (tree, tree, tree);
+extern void maybe_inject_for_scope_var (tree);
+extern tree start_handler_parms (tree, tree);
+extern int complete_array_type (tree, tree, int);
+extern tree build_ptrmemfunc_type (tree);
extern tree build_ptrmem_type (tree, tree);
/* the grokdeclarator prototype is in decl.h */
-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 (enum tag_types, tree, tree, bool);
-extern tree xref_tag_from_type PARAMS ((tree, tree, int));
-extern void xref_basetypes PARAMS ((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 maybe_register_incomplete_var PARAMS ((tree));
-extern void complete_vars PARAMS ((tree));
-extern void finish_stmt PARAMS ((void));
-extern void print_other_binding_stack PARAMS ((struct cp_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 *));
-extern int walk_vtables PARAMS ((walk_globals_pred,
- walk_globals_fn,
- void *));
-typedef int (*walk_namespaces_fn) PARAMS ((tree, void *));
-extern int walk_namespaces PARAMS ((walk_namespaces_fn,
- 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 cxx_binding *cxx_scope_find_binding_for_name (tree, tree);
-extern tree cp_fname_init PARAMS ((const char *));
+extern int copy_fn_p (tree);
+extern tree get_scope_of_declarator (tree);
+extern void grok_special_member_properties (tree);
+extern int grok_ctor_properties (tree, tree);
+extern bool grok_op_properties (tree, int, bool);
+extern tree xref_tag (enum tag_types, tree, bool, bool);
+extern tree xref_tag_from_type (tree, tree, int);
+extern void xref_basetypes (tree, tree);
+extern tree start_enum (tree);
+extern void finish_enum (tree);
+extern void build_enumerator (tree, tree, tree);
+extern int start_function (tree, tree, tree, int);
+extern tree begin_function_body (void);
+extern void finish_function_body (tree);
+extern tree finish_function (int);
+extern tree start_method (tree, tree, tree);
+extern tree finish_method (tree);
+extern void maybe_register_incomplete_var (tree);
+extern void complete_vars (tree);
+extern void finish_stmt (void);
+extern void print_other_binding_stack (struct cp_binding_level *);
+extern void revert_static_member_fn (tree);
+extern void fixup_anonymous_aggr (tree);
+extern int check_static_variable_definition (tree, tree);
+extern tree compute_array_index_type (tree, tree);
+extern tree check_default_argument (tree, tree);
+extern int vtable_decl_p (tree, void *);
+extern int vtype_decl_p (tree, void *);
+extern int sigtable_decl_p (tree, void *);
+typedef bool (*walk_globals_pred) (tree, void *);
+typedef bool (*walk_globals_fn) (tree *, void *);
+extern bool walk_globals (walk_globals_pred, walk_globals_fn, void *);
+extern bool walk_vtables (walk_globals_pred, walk_globals_fn, void *);
+typedef int (*walk_namespaces_fn) (tree, void *);
+extern int walk_namespaces (walk_namespaces_fn,
+ void *);
+extern int wrapup_globals_for_namespace (tree, void *);
+extern tree create_implicit_typedef (tree, tree);
+extern tree maybe_push_decl (tree);
+extern tree force_target_expr (tree, tree);
+extern tree build_target_expr_with_type (tree, tree);
+extern int local_variable_p (tree);
+extern int nonstatic_local_decl_p (tree);
+extern tree declare_global_var (tree, tree);
+extern void register_dtor_fn (tree);
+extern tmpl_spec_kind current_tmpl_spec_kind (int);
+extern tree cp_fname_init (const char *, tree *);
+extern tree check_elaborated_type_specifier (enum tag_types, tree, bool);
+extern tree cxx_builtin_type_decls (void);
+extern void warn_extern_redeclared_static (tree, tree);
+
extern bool have_extern_spec;
/* in decl2.c */
-extern int check_java_method PARAMS ((tree));
-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, tree));
-extern void cplus_decl_attributes PARAMS ((tree *, tree, int));
-extern tree constructor_name_full PARAMS ((tree));
-extern tree constructor_name PARAMS ((tree));
-extern bool constructor_name_p (tree, 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 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 void import_export_tinfo PARAMS ((tree, tree, int));
-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 bool check_java_method (tree);
+extern int grok_method_quals (tree, tree, tree);
+extern void grok_x_components (tree);
+extern void maybe_retrofit_in_chrg (tree);
+extern void maybe_make_one_only (tree);
+extern void grokclassfn (tree, tree, enum overload_flags, tree);
+extern tree grok_array_decl (tree, tree);
+extern tree delete_sanity (tree, tree, bool, int);
+extern tree check_classfn (tree, tree, bool);
+extern void check_member_template (tree);
+extern tree grokfield (tree, tree, tree, tree, tree);
+extern tree grokbitfield (tree, tree, tree);
+extern tree groktypefield (tree, tree);
+extern void cplus_decl_attributes (tree *, tree, int);
+extern void defer_fn (tree);
+extern void finish_anon_union (tree);
+extern tree finish_table (tree, tree, tree, int);
+extern tree coerce_new_type (tree);
+extern tree coerce_delete_type (tree);
+extern void comdat_linkage (tree);
+extern void import_export_vtable (tree, tree, int);
+extern void import_export_decl (tree);
+extern void import_export_tinfo (tree, tree, bool);
+extern tree build_cleanup (tree);
extern tree build_offset_ref_call_from_tree (tree, tree);
-extern tree build_call_from_tree (tree, tree, bool);
-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 (enum tag_types, tree, tree, tree, int, int *);
-extern tree handle_class_head_apparent_template (tree, int *);
-extern tree lookup_arg_dependent PARAMS ((tree, tree, tree));
-extern void finish_static_data_member_decl PARAMS ((tree, tree, tree, int));
-extern tree cp_build_parm_decl PARAMS ((tree, tree));
-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));
-
-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, ...));
+extern void check_default_args (tree);
+extern void mark_used (tree);
+extern void finish_static_data_member_decl (tree, tree, tree, int);
+extern tree cp_build_parm_decl (tree, tree);
+extern tree build_artificial_parm (tree, tree);
+extern tree get_guard (tree);
+extern tree get_guard_cond (tree);
+extern tree set_guard (tree);
+extern tree cxx_callgraph_analyze_expr (tree *, int *, tree);
/* XXX Not i18n clean. */
-#define cp_deprecated(STR) \
- do { \
- if (warn_deprecated) \
- warning ("%s is deprecated, please see the documentation for details", \
- (STR)); \
+#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 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));
+extern void init_error (void);
+extern const char *type_as_string (tree, int);
+extern const char *decl_as_string (tree, int);
+extern const char *expr_as_string (tree, int);
+extern const char *context_as_string (tree, int);
+extern const char *lang_decl_name (tree, int);
+extern const char *language_to_string (enum languages);
+extern void print_instantiation_context (void);
/* in except.c */
-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));
+extern void init_exception_processing (void);
+extern tree expand_start_catch_block (tree);
+extern void expand_end_catch_block (void);
+extern void expand_builtin_throw (void);
+extern void expand_eh_spec_block (tree);
+extern void expand_exception_blocks (void);
+extern tree build_exc_ptr (void);
+extern tree build_throw (tree);
+extern void mark_all_runtime_matches (void);
+extern int nothrow_libfn_p (tree);
+extern void check_handlers (tree);
+extern void choose_personality_routine (enum languages);
+extern tree eh_type_info (tree);
/* in expr.c */
-extern rtx cxx_expand_expr PARAMS ((tree, rtx,
- enum machine_mode,
- int));
-extern tree cplus_expand_constant PARAMS ((tree));
+extern rtx cxx_expand_expr (tree, rtx,
+ enum machine_mode,
+ int, rtx *);
+extern tree cplus_expand_constant (tree);
/* friend.c */
-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));
+extern int is_friend (tree, tree);
+extern void make_friend_class (tree, tree, bool);
+extern void add_friend (tree, tree, bool);
+extern tree do_friend (tree, tree, tree, tree, enum overload_flags, tree, int);
/* in init.c */
extern tree expand_member_init (tree);
extern void emit_mem_initializers (tree);
-extern tree build_aggr_init PARAMS ((tree, tree, int));
-extern tree build_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_aggr_init (tree, tree, int);
+extern tree build_init (tree, tree, int);
+extern int is_aggr_type (tree, int);
+extern tree get_aggr_from_typedef (tree, int);
+extern tree get_type_value (tree);
extern tree build_zero_init (tree, tree, bool);
-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, 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));
+extern tree build_offset_ref (tree, tree, bool);
+extern tree build_new (tree, tree, tree, int);
+extern tree build_vec_init (tree, tree, tree, int);
+extern tree build_x_delete (tree, int, tree);
+extern tree build_delete (tree, tree, special_function_kind, int, int);
+extern void push_base_cleanups (void);
+extern tree build_vbase_delete (tree, tree);
+extern tree build_vec_delete (tree, tree, special_function_kind, int);
+extern tree create_temporary_var (tree);
+extern void initialize_vtbl_ptrs (tree);
+extern tree build_java_class_ref (tree);
/* in input.c */
/* in lex.c */
-extern void cxx_dup_lang_specific_decl PARAMS ((tree));
-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 void unqualified_name_lookup_error PARAMS ((tree));
-extern tree do_identifier PARAMS ((tree, int, tree));
-extern tree do_scoped_id PARAMS ((tree, tree));
-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 cxx_make_type PARAMS ((enum tree_code));
-extern tree make_aggr_type PARAMS ((enum tree_code));
-extern void yyerror PARAMS ((const char *));
-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_dup_lang_specific_decl (tree);
+extern tree make_pointer_declarator (tree, tree);
+extern tree make_reference_declarator (tree, tree);
+extern tree make_call_declarator (tree, tree, tree, tree);
+extern void set_quals_and_spec (tree, tree, tree);
+extern void print_parse_statistics (void);
+extern void do_pending_inlines (void);
+extern void yyungetc (int, int);
+extern void snarf_method (tree);
+
+extern void see_typename (void);
+extern tree unqualified_name_lookup_error (tree);
+extern tree unqualified_fn_lookup_error (tree);
+extern tree build_lang_decl (enum tree_code, tree, tree);
+extern void retrofit_lang_decl (tree);
+extern tree copy_decl (tree);
+extern tree copy_type (tree);
+extern tree cxx_make_type (enum tree_code);
+extern tree make_aggr_type (enum tree_code);
+extern void yyerror (const char *);
+extern void yyhook (int);
+extern int cp_type_qual_from_rid (tree);
+extern bool cxx_init (void);
+extern void cxx_finish (void);
/* in method.c */
-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));
+extern void init_method (void);
+extern void set_mangled_name_for_decl (tree);
+extern tree make_thunk (tree, bool, tree, tree);
+extern void finish_thunk (tree);
+extern void use_thunk (tree, bool);
+extern void synthesize_method (tree);
+extern tree implicitly_declare_fn (special_function_kind, tree, bool);
+extern tree skip_artificial_parms_for (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));
+extern void optimize_function (tree);
+extern bool calls_setjmp_p (tree);
+extern bool maybe_clone_body (tree);
/* in pt.c */
-extern void check_template_shadow PARAMS ((tree));
-extern tree get_innermost_template_args PARAMS ((tree, int));
-extern tree tsubst PARAMS ((tree, tree, tsubst_flags_t, tree));
-extern tree tsubst_expr PARAMS ((tree, tree, tsubst_flags_t, tree));
-extern tree tsubst_copy PARAMS ((tree, tree, tsubst_flags_t, 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, tsubst_flags_t));
-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 check_template_shadow (tree);
+extern tree get_innermost_template_args (tree, int);
+extern void maybe_begin_member_template_processing (tree);
+extern void maybe_end_member_template_processing (void);
+extern tree finish_member_template_decl (tree);
+extern void begin_template_parm_list (void);
+extern void begin_specialization (void);
+extern void reset_specialization (void);
+extern void end_specialization (void);
+extern void begin_explicit_instantiation (void);
+extern void end_explicit_instantiation (void);
+extern tree check_explicit_specialization (tree, tree, int, int);
+extern tree process_template_parm (tree, tree);
+extern tree end_template_parm_list (tree);
+extern void end_template_decl (void);
+extern tree current_template_args (void);
+extern tree push_template_decl (tree);
+extern tree push_template_decl_real (tree, int);
+extern void redeclare_class_template (tree, tree);
+extern tree lookup_template_class (tree, tree, tree, tree, int, tsubst_flags_t);
+extern tree lookup_template_function (tree, tree);
+extern int uses_template_parms (tree);
+extern int uses_template_parms_level (tree, int);
+extern tree instantiate_class_template (tree);
+extern tree instantiate_template (tree, tree, tsubst_flags_t);
+extern int fn_type_unification (tree, tree, tree, tree, tree, unification_kind_t, int);
+extern tree tinst_for_decl (void);
+extern void mark_decl_instantiated (tree, int);
+extern int more_specialized (tree, tree, int, int);
+extern void mark_class_instantiated (tree, int);
extern void do_decl_instantiation (tree, tree);
-extern void do_type_instantiation PARAMS ((tree, tree, tsubst_flags_t));
-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, tree));
-extern int is_member_template PARAMS ((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));
-extern int problematic_instantiation_changed PARAMS ((void));
-extern void record_last_problematic_instantiation PARAMS ((void));
-extern tree current_instantiation PARAMS ((void));
+extern void do_type_instantiation (tree, tree, tsubst_flags_t);
+extern tree instantiate_decl (tree, int);
+extern int push_tinst_level (tree);
+extern void pop_tinst_level (void);
+extern int more_specialized_class (tree, tree, tree);
+extern int is_member_template (tree);
+extern int comp_template_parms (tree, tree);
+extern int template_class_depth (tree);
+extern int is_specialization_of (tree, tree);
+extern bool is_specialization_of_friend (tree, tree);
+extern int comp_template_args (tree, tree);
+extern void maybe_process_partial_specialization (tree);
+extern void maybe_check_template_type (tree);
+extern tree most_specialized_instantiation (tree);
+extern void print_candidates (tree);
+extern int instantiate_pending_templates (void);
+extern tree tsubst_default_argument (tree, tree, tree);
+extern tree tsubst_copy_and_build (tree, tree, tsubst_flags_t, tree, bool);
+extern tree most_general_template (tree);
+extern tree get_mostly_instantiated_function_type (tree);
+extern int problematic_instantiation_changed (void);
+extern void record_last_problematic_instantiation (void);
+extern tree current_instantiation (void);
+extern tree maybe_get_template_decl_from_type_decl (tree);
extern int processing_template_parmlist;
+extern bool dependent_type_p (tree);
+extern bool any_dependent_template_arguments_p (tree);
+extern bool dependent_template_p (tree);
+extern bool dependent_template_id_p (tree, tree);
+extern bool type_dependent_expression_p (tree);
+extern bool any_type_dependent_arguments_p (tree);
+extern bool value_dependent_expression_p (tree);
+extern tree resolve_typename_type (tree, bool);
+extern tree template_for_substitution (tree);
+extern tree build_non_dependent_expr (tree);
+extern tree build_non_dependent_args (tree);
+extern bool reregister_specialization (tree, tree, tree);
+extern tree fold_non_dependent_expr (tree);
/* in repo.c */
-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));
+extern void repo_template_used (tree);
+extern void repo_template_instantiated (tree, bool);
+extern void init_repo (const char *);
+extern void finish_repo (void);
/* in rtti.c */
-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 unemitted_tinfo_decl_p PARAMS((tree, void *));
-extern int emit_tinfo_decl PARAMS((tree *, void *));
+/* A varray of all tinfo decls that haven't been emitted yet. */
+extern GTY(()) varray_type unemitted_tinfo_decls;
+
+extern void init_rtti_processing (void);
+extern tree build_typeid (tree);
+extern tree get_tinfo_decl (tree);
+extern tree get_typeid (tree);
+extern tree build_dynamic_cast (tree, tree);
+extern void emit_support_tinfos (void);
+extern bool emit_tinfo_decl (tree);
/* in search.c */
extern bool accessible_base_p (tree, tree);
-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 int accessible_p PARAMS ((tree, tree));
+extern tree lookup_base (tree, tree, base_access, base_kind *);
+extern int types_overlap_p (tree, tree);
+extern tree get_dynamic_cast_base_type (tree, tree);
+extern int accessible_p (tree, tree);
extern tree lookup_field_1 (tree, tree, bool);
-extern tree lookup_field PARAMS ((tree, tree, int, int));
-extern tree lookup_nested_field PARAMS ((tree, 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 lookup_field (tree, tree, int, bool);
+extern int lookup_fnfields_1 (tree, tree);
+extern tree lookup_fnfields (tree, tree, int);
+extern tree lookup_member (tree, tree, int, bool);
+extern int look_for_overrides (tree, tree);
+extern void get_pure_virtuals (tree);
+extern void maybe_suppress_debug_info (tree);
+extern void note_debug_info_needed (tree);
+extern void push_class_decls (tree);
+extern void pop_class_decls (void);
+extern void unuse_fields (tree);
+extern void print_search_statistics (void);
+extern void init_search_processing (void);
+extern void reinit_search_statistics (void);
+extern tree current_scope (void);
+extern int at_function_scope_p (void);
extern bool at_class_scope_p (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 int check_final_overrider 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 PARAMS ((tree, void *));
-extern tree markedp PARAMS ((tree, void *));
-extern tree unmarkedp 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));
+extern bool at_namespace_scope_p (void);
+extern tree context_for_name_lookup (tree);
+extern tree lookup_conversions (tree);
+extern tree binfo_for_vtable (tree);
+extern tree binfo_from_vbase (tree);
+extern tree look_for_overrides_here (tree, tree);
+extern int check_final_overrider (tree, tree);
+extern tree dfs_walk (tree,
+ tree (*) (tree, void *),
+ tree (*) (tree, int, void *),
+ void *);
+extern tree dfs_walk_real (tree,
+ tree (*) (tree, void *),
+ tree (*) (tree, void *),
+ tree (*) (tree, int, void *),
+ void *);
+extern tree dfs_unmark (tree, void *);
+extern tree markedp (tree, int, void *);
+extern tree unmarkedp (tree, int, void *);
+extern tree binfo_via_virtual (tree, tree);
extern tree build_baselink (tree, tree, tree, tree);
extern tree adjust_result_of_qualified_name_lookup
(tree, tree, tree);
+extern tree copied_binfo (tree, tree);
+extern tree original_binfo (tree, tree);
+
/* in semantics.c */
-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 (tree, tree, bool);
-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_unary_op_expr PARAMS ((enum tree_code, tree));
-extern tree finish_id_expr PARAMS ((tree));
+extern void push_deferring_access_checks (deferring_kind);
+extern void resume_deferring_access_checks (void);
+extern void stop_deferring_access_checks (void);
+extern void pop_deferring_access_checks (void);
+extern tree get_deferred_access_checks (void);
+extern void pop_to_parent_deferring_access_checks (void);
+extern void perform_deferred_access_checks (void);
+extern void perform_or_defer_access_check (tree, tree);
+extern void init_cp_semantics (void);
+extern tree finish_expr_stmt (tree);
+extern tree begin_if_stmt (void);
+extern void finish_if_stmt_cond (tree, tree);
+extern tree finish_then_clause (tree);
+extern void begin_else_clause (void);
+extern void finish_else_clause (tree);
+extern void finish_if_stmt (void);
+extern tree begin_while_stmt (void);
+extern void finish_while_stmt_cond (tree, tree);
+extern void finish_while_stmt (tree);
+extern tree begin_do_stmt (void);
+extern void finish_do_body (tree);
+extern void finish_do_stmt (tree, tree);
+extern tree finish_return_stmt (tree);
+extern tree begin_for_stmt (void);
+extern void finish_for_init_stmt (tree);
+extern void finish_for_cond (tree, tree);
+extern void finish_for_expr (tree, tree);
+extern void finish_for_stmt (tree);
+extern tree finish_break_stmt (void);
+extern tree finish_continue_stmt (void);
+extern tree begin_switch_stmt (void);
+extern void finish_switch_cond (tree, tree);
+extern void finish_switch_stmt (tree);
+extern tree finish_case_label (tree, tree);
+extern tree finish_goto_stmt (tree);
+extern tree begin_try_block (void);
+extern void finish_try_block (tree);
+extern tree begin_eh_spec_block (void);
+extern void finish_eh_spec_block (tree, tree);
+extern void finish_handler_sequence (tree);
+extern tree begin_function_try_block (void);
+extern void finish_function_try_block (tree);
+extern void finish_function_handler_sequence (tree);
+extern void finish_cleanup_try_block (tree);
+extern tree begin_handler (void);
+extern void finish_handler_parms (tree, tree);
+extern void begin_catch_block (tree);
+extern void finish_handler (tree);
+extern void finish_cleanup (tree, tree);
+extern tree begin_compound_stmt (bool);
+extern tree finish_compound_stmt (tree);
+extern tree finish_asm_stmt (tree, tree, tree, tree, tree);
+extern tree finish_label_stmt (tree);
+extern void finish_label_decl (tree);
+extern void finish_subobject (tree);
+extern tree finish_parenthesized_expr (tree);
+extern tree finish_non_static_data_member (tree, tree, tree);
+extern tree begin_stmt_expr (void);
+extern tree finish_stmt_expr_expr (tree);
+extern tree finish_stmt_expr (tree, bool);
+extern tree perform_koenig_lookup (tree, tree);
+extern tree finish_call_expr (tree, tree, bool, bool);
+extern tree finish_increment_expr (tree, enum tree_code);
+extern tree finish_this_expr (void);
+extern tree finish_pseudo_destructor_expr (tree, tree, tree);
+extern tree finish_unary_op_expr (enum tree_code, tree);
+extern tree finish_compound_literal (tree, tree);
extern tree finish_fname (tree);
-extern void save_type_access_control PARAMS ((tree));
-extern void reset_type_access_control PARAMS ((void));
-extern void decl_type_access_control PARAMS ((tree));
extern int begin_function_definition (tree, 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 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_eh_cleanup PARAMS ((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 begin_mem_initializers (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));
+extern void finish_translation_unit (void);
+extern tree finish_template_type_parm (tree, tree);
+extern tree finish_template_template_parm (tree, tree);
+extern tree finish_parmlist (tree, int);
+extern tree begin_class_definition (tree);
+extern void finish_default_args (void);
+extern tree finish_member_class_template (tree);
+extern void finish_template_decl (tree);
+extern tree finish_template_type (tree, tree, int);
+extern tree finish_base_specifier (tree, tree, bool);
+extern void finish_member_declaration (tree);
+extern void check_multiple_declarators (void);
+extern void qualified_name_lookup_error (tree, tree);
+extern tree finish_id_expression (tree, tree, tree,
+ cp_id_kind *, tree *,
+ bool, bool, bool *,
+ const char **);
+extern tree finish_typeof (tree);
+extern void finish_decl_cleanup (tree, tree);
+extern void finish_eh_cleanup (tree);
+extern void expand_body (tree);
+extern void cxx_expand_function_start (void);
+extern tree nullify_returns_r (tree *, int *, void *);
+extern void do_pushlevel (scope_kind);
+extern tree do_poplevel (void);
+extern void finish_mem_initializers (tree);
+extern void setup_vtbl_ptr (tree, tree);
+extern void clear_out_block (void);
extern tree check_template_template_default_arg (tree);
-
-/* in spew.c */
-extern void init_spew PARAMS ((void));
-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));
+extern void expand_or_defer_fn (tree);
+extern void check_accessibility_of_qualified_id (tree, tree, tree);
+extern tree finish_qualified_id_expr (tree, tree, bool, bool);
+extern void simplify_aggr_init_expr (tree *);
/* in tree.c */
-extern void lang_check_failed PARAMS ((const char *, int,
- const char *));
-extern tree stabilize_expr PARAMS ((tree, tree *));
-extern tree cxx_unsave_expr_now PARAMS ((tree));
-extern tree cxx_maybe_build_cleanup PARAMS ((tree));
-extern void init_tree PARAMS ((void));
-extern int pod_type_p PARAMS ((tree));
-extern int zero_init_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 cp_lvalue_kind real_non_cast_lvalue_p (tree);
-extern int non_cast_lvalue_p PARAMS ((tree));
-extern int non_cast_lvalue_or_else PARAMS ((tree, const char *));
-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 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_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 *cxx_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_zc_wrapper PARAMS ((struct z_candidate *));
-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 void lang_check_failed (const char *, int,
+ const char *);
+extern tree stabilize_expr (tree, tree *);
+extern void stabilize_call (tree, tree *);
+extern bool stabilize_init (tree, tree *);
+extern tree cxx_unsave_expr_now (tree);
+extern tree cxx_maybe_build_cleanup (tree);
+extern void init_tree (void);
+extern int pod_type_p (tree);
+extern int zero_init_p (tree);
+extern tree canonical_type_variant (tree);
+extern tree copy_base_binfos (tree, tree, tree);
+extern int member_p (tree);
+extern cp_lvalue_kind real_lvalue_p (tree);
+extern tree build_min (enum tree_code, tree, ...);
+extern tree build_min_nt (enum tree_code, ...);
+extern tree build_min_non_dep (enum tree_code, tree, ...);
+extern tree build_cplus_new (tree, tree);
+extern tree get_target_expr (tree);
+extern tree build_cplus_staticfn_type (tree, tree, tree);
+extern tree build_cplus_array_type (tree, tree);
+extern tree hash_tree_cons (tree, tree, tree);
+extern tree hash_tree_chain (tree, tree);
+extern tree hash_chainon (tree, tree);
+extern tree make_binfo (tree, tree, tree, tree);
+extern int count_functions (tree);
+extern int is_overloaded_fn (tree);
+extern tree get_first_fn (tree);
+extern int bound_pmf_p (tree);
+extern tree ovl_cons (tree, tree);
+extern tree build_overload (tree, tree);
+extern tree function_arg_chain (tree);
+extern int promotes_to_aggr_type (tree, enum tree_code);
+extern const char *cxx_printable_name (tree, int);
+extern tree build_exception_variant (tree, tree);
+extern tree bind_template_template_parm (tree, tree);
+extern tree array_type_nelts_total (tree);
+extern tree array_type_nelts_top (tree);
+extern tree break_out_target_exprs (tree);
+extern tree get_type_decl (tree);
+extern tree vec_binfo_member (tree, tree);
+extern tree decl_namespace_context (tree);
+extern tree lvalue_type (tree);
+extern tree error_type (tree);
+extern tree build_zc_wrapper (struct z_candidate *);
+extern int varargs_function_p (tree);
+extern int really_overloaded_fn (tree);
+extern bool cp_tree_equal (tree, tree);
+extern tree no_linkage_check (tree);
+extern void debug_binfo (tree);
+extern tree build_dummy_object (tree);
+extern tree maybe_dummy_object (tree, tree *);
+extern int is_dummy_object (tree);
extern const struct attribute_spec cxx_attribute_table[];
-extern tree make_ptrmem_cst PARAMS ((tree, tree));
-extern tree cp_build_qualified_type_real PARAMS ((tree, int, tsubst_flags_t));
+extern tree make_ptrmem_cst (tree, tree);
+extern tree cp_build_type_attribute_variant (tree, tree);
+extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t);
#define cp_build_qualified_type(TYPE, QUALS) \
cp_build_qualified_type_real ((TYPE), (QUALS), tf_error | tf_warning)
-extern tree build_shared_int_cst PARAMS ((int));
-extern special_function_kind special_function_p PARAMS ((tree));
+extern tree build_shared_int_cst (int);
+extern special_function_kind special_function_p (tree);
extern bool name_p (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));
+extern int count_trees (tree);
+extern int char_type_p (tree);
+extern void verify_stmt_tree (tree);
+extern tree find_tree (tree, tree);
+extern linkage_kind decl_linkage (tree);
+extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
+ void*, void*);
+extern int cp_cannot_inline_tree_fn (tree*);
+extern tree cp_add_pending_fn_decls (void*,tree);
+extern int cp_is_overload_p (tree);
+extern int cp_auto_var_in_fn_p (tree,tree);
+extern tree cp_copy_res_decl_for_inlining (tree, tree, tree, void*,
+ int*, tree);
/* in typeck.c */
-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_diagnostic PARAMS ((tree, tree, int));
+extern int string_conv_p (tree, tree, int);
+extern tree cp_truthvalue_conversion (tree);
+extern tree condition_conversion (tree);
+extern tree target_type (tree);
+extern tree require_complete_type (tree);
+extern tree complete_type (tree);
+extern tree complete_type_or_diagnostic (tree, tree, int);
#define complete_type_or_else(T,V) (complete_type_or_diagnostic ((T), (V), 0))
-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 cxx_sizeof_or_alignof_type PARAMS ((tree, enum tree_code, int));
+extern int type_unknown_p (tree);
+extern tree commonparms (tree, tree);
+extern tree original_type (tree);
+extern bool comp_except_specs (tree, tree, bool);
+extern bool comptypes (tree, tree, int);
+extern bool compparms (tree, tree);
+extern int comp_cv_qualification (tree, tree);
+extern int comp_cv_qual_signature (tree, tree);
+extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code);
+extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool);
#define cxx_sizeof_nowarn(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false)
-extern tree inline_conversion PARAMS ((tree));
-extern tree decay_conversion PARAMS ((tree));
+extern tree inline_conversion (tree);
+extern tree decay_conversion (tree);
+extern tree perform_integral_promotions (tree);
extern tree build_class_member_access_expr (tree, tree, tree, bool);
extern tree finish_class_member_access_expr (tree, tree);
-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 get_member_function_from_ptrfunc PARAMS ((tree *, tree));
-extern tree build_function_call_real PARAMS ((tree, tree, 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 merge_types PARAMS ((tree, tree));
-extern tree check_return_expr PARAMS ((tree));
+extern tree build_x_indirect_ref (tree, const char *);
+extern tree build_indirect_ref (tree, const char *);
+extern tree build_array_ref (tree, tree);
+extern tree get_member_function_from_ptrfunc (tree *, tree);
+extern tree convert_arguments (tree, tree, tree, int);
+extern tree build_x_binary_op (enum tree_code, tree, tree,
+ bool *);
+extern tree build_x_unary_op (enum tree_code, tree);
+extern tree unary_complex_lvalue (enum tree_code, tree);
+extern tree build_x_conditional_expr (tree, tree, tree);
+extern tree build_x_compound_expr_from_list (tree, const char *);
+extern tree build_x_compound_expr (tree, tree);
+extern tree build_compound_expr (tree, tree);
+extern tree build_static_cast (tree, tree);
+extern tree build_reinterpret_cast (tree, tree);
+extern tree build_const_cast (tree, tree);
+extern tree build_c_cast (tree, tree);
+extern tree build_x_modify_expr (tree, enum tree_code, tree);
+extern tree build_modify_expr (tree, enum tree_code, tree);
+extern tree dubious_conversion_warnings (tree, tree, const char *, tree, int);
+extern tree convert_for_initialization (tree, tree, tree, int, const char *, tree, int);
+extern int comp_ptr_ttypes (tree, tree);
+extern int ptr_reasonably_similar (tree, tree);
+extern tree build_ptrmemfunc (tree, tree, int);
+extern int cp_type_quals (tree);
+extern bool cp_has_mutable_p (tree);
+extern bool at_least_as_qualified_p (tree, tree);
+extern bool more_qualified_p (tree, tree);
+extern tree build_ptrmemfunc1 (tree, tree, tree);
+extern void expand_ptrmemfunc_cst (tree, tree *, tree *);
+extern tree pfn_from_ptrmemfunc (tree);
+extern tree type_after_usual_arithmetic_conversions (tree, tree);
+extern tree composite_pointer_type (tree, tree, tree, tree,
+ const char*);
+extern tree merge_types (tree, tree);
+extern tree check_return_expr (tree);
#define cp_build_binary_op(code, arg1, arg2) \
build_binary_op(code, arg1, arg2, 1)
#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true)
@@ -4448,47 +4247,63 @@ extern tree check_return_expr PARAMS ((tree));
extern tree build_ptrmemfunc_access_expr (tree, tree);
extern tree build_address (tree);
extern tree build_nop (tree, tree);
+extern tree non_reference (tree);
+extern tree lookup_anon_field (tree, tree);
+extern bool invalid_nonstatic_memfn_p (tree);
/* in typeck2.c */
-extern void require_complete_eh_spec_types PARAMS ((tree, tree));
-extern void cxx_incomplete_type_diagnostic PARAMS ((tree, tree, int));
+extern void require_complete_eh_spec_types (tree, tree);
+extern void cxx_incomplete_type_diagnostic (tree, tree, int);
#undef cxx_incomplete_type_error
-extern void cxx_incomplete_type_error PARAMS ((tree, tree));
+extern void cxx_incomplete_type_error (tree, tree);
#define cxx_incomplete_type_error(V,T) \
(cxx_incomplete_type_diagnostic ((V), (T), 0))
-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));
-
-extern tree store_init_value PARAMS ((tree, tree));
-extern tree digest_init PARAMS ((tree, tree, tree *));
-extern tree build_scoped_ref PARAMS ((tree, 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));
+extern tree error_not_base_type (tree, tree);
+extern tree binfo_or_else (tree, tree);
+extern void readonly_error (tree, const char *, int);
+extern int abstract_virtuals_error (tree, tree);
+
+extern tree store_init_value (tree, tree);
+extern tree digest_init (tree, tree, tree *);
+extern tree build_scoped_ref (tree, tree, tree *);
+extern tree build_x_arrow (tree);
+extern tree build_m_component_ref (tree, tree);
+extern tree build_functional_cast (tree, tree);
+extern tree add_exception_specifier (tree, tree, int);
+extern tree merge_exception_specifiers (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));
+extern void init_mangle (void);
+extern void mangle_decl (tree);
+extern const char *mangle_type_string (tree);
+extern tree mangle_type (tree);
+extern tree mangle_typeinfo_for_type (tree);
+extern tree mangle_typeinfo_string_for_type (tree);
+extern tree mangle_vtbl_for_type (tree);
+extern tree mangle_vtt_for_type (tree);
+extern tree mangle_ctor_vtbl_for_type (tree, tree);
+extern tree mangle_thunk (tree, int, tree, tree);
+extern tree mangle_conv_op_name_for_type (tree);
+extern tree mangle_guard_variable (tree);
+extern tree mangle_ref_init_variable (tree);
/* in dump.c */
-extern int cp_dump_tree PARAMS ((void *, tree));
+extern bool cp_dump_tree (void *, tree);
/* -- end of C++ */
+/* In order for the format checking to accept the C++ frontend
+ diagnostic framework extensions, you must include this file before
+ toplev.h, not after. */
+#define GCC_DIAG_STYLE __gcc_cxxdiag__
+#if GCC_VERSION >= 3004
+#define ATTRIBUTE_GCC_CXXDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
+#else
+#define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
+#endif
+
+extern void cp_error_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2);
+extern void cp_warning_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2);
+extern void cp_pedwarn_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2);
+
#endif /* ! GCC_CP_TREE_H */
diff --git a/contrib/gcc/cp/cvt.c b/contrib/gcc/cp/cvt.c
index 75a6a3a..48be5c5 100644
--- a/contrib/gcc/cp/cvt.c
+++ b/contrib/gcc/cp/cvt.c
@@ -1,33 +1,35 @@
/* Language-level data type conversion for GNU C++.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* This file contains the functions for converting C expressions
+/* This file contains the functions for converting C++ expressions
to different data types. The only entry point is `convert'.
Every language front end must have a `convert' function
but what kind of conversions it does will depend on the language. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "flags.h"
#include "cp-tree.h"
@@ -35,10 +37,10 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "decl.h"
-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));
+static tree cp_convert_to_pointer (tree, tree, bool);
+static tree convert_to_pointer_force (tree, tree);
+static tree build_up_reference (tree, tree, int, tree);
+static void warn_ref_binding (tree, tree, tree);
/* Change of width--truncation and extension of integers or reals--
is represented with NOP_EXPR. Proper functioning of many things
@@ -72,12 +74,10 @@ static void warn_ref_binding PARAMS ((tree, tree, tree));
but not static_cast). */
static tree
-cp_convert_to_pointer (type, expr, force)
- tree type, expr;
- int force;
+cp_convert_to_pointer (tree type, tree expr, bool force)
{
- register tree intype = TREE_TYPE (expr);
- register enum tree_code form;
+ tree intype = TREE_TYPE (expr);
+ enum tree_code form;
tree rval;
if (IS_AGGR_TYPE (intype))
@@ -109,24 +109,26 @@ cp_convert_to_pointer (type, expr, force)
functions. */
if (TYPE_PTRMEMFUNC_P (intype))
{
- tree fntype = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (intype));
- tree decl = maybe_dummy_object (TYPE_METHOD_BASETYPE (fntype), 0);
- expr = build (OFFSET_REF, fntype, decl, expr);
+ if (pedantic || warn_pmf2ptr)
+ pedwarn ("converting from `%T' to `%T'", intype, type);
+ if (TREE_CODE (expr) == PTRMEM_CST)
+ expr = build_address (PTRMEM_CST_MEMBER (expr));
+ else
+ {
+ tree decl = maybe_dummy_object (TYPE_PTRMEM_CLASS_TYPE (intype),
+ 0);
+ decl = build_address (decl);
+ expr = get_member_function_from_ptrfunc (&decl, expr);
+ }
}
-
- if (TREE_CODE (expr) == OFFSET_REF
- && TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE)
- expr = resolve_offset_ref (expr);
- if (TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE)
- expr = build_addr_func (expr);
- if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
+ else if (TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE)
{
- if (TREE_CODE (TREE_TYPE (TREE_TYPE (expr))) == METHOD_TYPE)
- if (pedantic || warn_pmf2ptr)
- pedwarn ("converting from `%T' to `%T'", TREE_TYPE (expr),
- type);
- return build1 (NOP_EXPR, type, expr);
+ if (pedantic || warn_pmf2ptr)
+ pedwarn ("converting from `%T' to `%T'", intype, type);
+ expr = build_addr_func (expr);
}
+ if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
+ return build_nop (type, expr);
intype = TREE_TYPE (expr);
}
@@ -178,68 +180,81 @@ cp_convert_to_pointer (type, expr, force)
}
}
- if (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
+ if (TYPE_PTRMEMFUNC_P (type))
{
- tree b1;
- tree b2;
- tree binfo;
- enum tree_code code = PLUS_EXPR;
- base_kind bk;
+ error ("cannot convert `%E' from type `%T' to type `%T'",
+ expr, intype, type);
+ return error_mark_node;
+ }
- 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 = lookup_base (b2, b1, ba_check, &bk);
- code = MINUS_EXPR;
- }
- if (binfo == error_mark_node)
- return error_mark_node;
+ return build_nop (type, expr);
+ }
+ else if (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
+ {
+ tree b1;
+ tree b2;
+ tree binfo;
+ enum tree_code code = PLUS_EXPR;
+ base_kind bk;
+
+ b1 = TYPE_PTRMEM_CLASS_TYPE (type);
+ b2 = TYPE_PTRMEM_CLASS_TYPE (intype);
+ binfo = lookup_base (b1, b2, ba_check, &bk);
+ if (!binfo)
+ {
+ binfo = lookup_base (b2, b1, ba_check, &bk);
+ code = MINUS_EXPR;
+ }
+ if (binfo == error_mark_node)
+ return error_mark_node;
- if (bk == bk_via_virtual)
+ if (bk == bk_via_virtual)
+ {
+ if (force)
+ warning ("pointer to member cast from `%T' to `%T' is via virtual base",
+ intype, type);
+ else
{
- 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);
+ error ("pointer to member cast from `%T' to `%T' is via virtual base",
+ intype, type);
+ return error_mark_node;
}
-
- 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))
- {
- error ("cannot convert `%E' from type `%T' to type `%T'",
- expr, intype, 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 && !integer_zerop (BINFO_OFFSET (binfo)))
+ expr = size_binop (code,
+ build_nop (sizetype, expr),
+ BINFO_OFFSET (binfo));
return build_nop (type, expr);
}
else if (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype))
return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0);
else if (TYPE_PTRMEMFUNC_P (intype))
{
+ if (!warn_pmf2ptr)
+ {
+ if (TREE_CODE (expr) == PTRMEM_CST)
+ return cp_convert_to_pointer (type,
+ PTRMEM_CST_MEMBER (expr),
+ force);
+ else if (TREE_CODE (expr) == OFFSET_REF)
+ {
+ tree object = TREE_OPERAND (expr, 0);
+ return get_member_function_from_ptrfunc (&object,
+ TREE_OPERAND (expr, 1));
+ }
+ }
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 (integer_zerop (expr))
{
if (TYPE_PTRMEMFUNC_P (type))
@@ -256,8 +271,7 @@ cp_convert_to_pointer (type, expr, force)
force_fit_type (expr, 0);
return expr;
}
- else if ((TYPE_PTRMEM_P (type) || TYPE_PTRMEMFUNC_P (type))
- && INTEGRAL_CODE_P (form))
+ else if (TYPE_PTR_TO_MEMBER_P (type) && INTEGRAL_CODE_P (form))
{
error ("invalid conversion from '%T' to '%T'", intype, type);
return error_mark_node;
@@ -290,11 +304,10 @@ cp_convert_to_pointer (type, expr, force)
(such as conversion from sub-type to private super-type). */
static tree
-convert_to_pointer_force (type, expr)
- tree type, expr;
+convert_to_pointer_force (tree type, tree expr)
{
- register tree intype = TREE_TYPE (expr);
- register enum tree_code form = TREE_CODE (intype);
+ tree intype = TREE_TYPE (expr);
+ enum tree_code form = TREE_CODE (intype);
if (form == POINTER_TYPE)
{
@@ -333,7 +346,7 @@ convert_to_pointer_force (type, expr)
}
}
- return cp_convert_to_pointer (type, expr, 1);
+ return cp_convert_to_pointer (type, expr, true);
}
/* We are passing something to a function which requires a reference.
@@ -345,9 +358,7 @@ convert_to_pointer_force (type, expr)
If DIRECT_BIND is set, DECL is the reference we're binding to. */
static tree
-build_up_reference (type, arg, flags, decl)
- tree type, arg, decl;
- int flags;
+build_up_reference (tree type, tree arg, int flags, tree decl)
{
tree rval;
tree argtype = TREE_TYPE (arg);
@@ -406,8 +417,7 @@ build_up_reference (type, arg, flags, decl)
non-volatile const type. */
static void
-warn_ref_binding (reftype, intype, decl)
- tree reftype, intype, decl;
+warn_ref_binding (tree reftype, tree intype, tree decl)
{
tree ttl = TREE_TYPE (reftype);
@@ -436,41 +446,35 @@ warn_ref_binding (reftype, intype, decl)
we know it's an initialization. */
tree
-convert_to_reference (reftype, expr, convtype, flags, decl)
- tree reftype, expr;
- int convtype, flags;
- tree decl;
+convert_to_reference (tree reftype, tree expr, int convtype,
+ int flags, tree decl)
{
- register tree type = TYPE_MAIN_VARIANT (TREE_TYPE (reftype));
- register tree intype;
+ tree type = TYPE_MAIN_VARIANT (TREE_TYPE (reftype));
+ tree intype;
tree rval = NULL_TREE;
tree rval_as_conversion = NULL_TREE;
- int i;
+ bool can_convert_intype_to_type;
if (TREE_CODE (type) == FUNCTION_TYPE
&& TREE_TYPE (expr) == unknown_type_node)
- {
- expr = instantiate_type (type, expr,
- (flags & LOOKUP_COMPLAIN)
- ? tf_error | tf_warning : tf_none);
- if (expr == error_mark_node)
- return error_mark_node;
-
- intype = TREE_TYPE (expr);
- }
+ expr = instantiate_type (type, expr,
+ (flags & LOOKUP_COMPLAIN)
+ ? tf_error | tf_warning : tf_none);
else
- {
- expr = convert_from_reference (expr);
- intype = TREE_TYPE (expr);
- }
+ expr = convert_from_reference (expr);
+
+ if (expr == error_mark_node)
+ return error_mark_node;
+
+ intype = TREE_TYPE (expr);
my_friendly_assert (TREE_CODE (intype) != REFERENCE_TYPE, 364);
intype = TYPE_MAIN_VARIANT (intype);
- i = comp_target_types (type, intype, 0);
-
- if (i <= 0 && (convtype & CONV_IMPLICIT) && IS_AGGR_TYPE (intype)
+ can_convert_intype_to_type = can_convert (type, intype);
+ if (!can_convert_intype_to_type
+ && (convtype & CONV_IMPLICIT) && IS_AGGR_TYPE (intype)
&& ! (flags & LOOKUP_NO_CONVERSION))
{
/* Look for a user-defined conversion to lvalue that we can use. */
@@ -484,12 +488,12 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
expr = rval_as_conversion;
rval_as_conversion = NULL_TREE;
intype = type;
- i = 1;
+ can_convert_intype_to_type = 1;
}
}
- if (((convtype & CONV_STATIC) && i == -1)
- || ((convtype & CONV_IMPLICIT) && i == 1))
+ if (((convtype & CONV_STATIC) && can_convert (intype, type))
+ || ((convtype & CONV_IMPLICIT) && can_convert_intype_to_type))
{
if (flags & LOOKUP_COMPLAIN)
{
@@ -517,10 +521,10 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
/* B* bp; A& ar = (A&)bp; is valid, but it's probably not what they
meant. */
if (TREE_CODE (intype) == POINTER_TYPE
- && (comptypes (TREE_TYPE (intype), type,
- COMPARE_BASE | COMPARE_RELAXED )))
+ && (comptypes (TREE_TYPE (intype), type,
+ COMPARE_BASE | COMPARE_DERIVED)))
warning ("casting `%T' to `%T' does not dereference pointer",
- intype, reftype);
+ intype, reftype);
rval = build_unary_op (ADDR_EXPR, expr, 0);
if (rval != error_mark_node)
@@ -545,8 +549,6 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
return rval;
}
- my_friendly_assert (TREE_CODE (intype) != OFFSET_TYPE, 189);
-
if (flags & LOOKUP_COMPLAIN)
error ("cannot convert type `%T' to type `%T'", intype, reftype);
@@ -560,14 +562,9 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
way down to its lowest form. */
tree
-convert_from_reference (val)
- tree val;
+convert_from_reference (tree val)
{
- tree type = TREE_TYPE (val);
-
- if (TREE_CODE (type) == OFFSET_TYPE)
- type = TREE_TYPE (type);
- if (TREE_CODE (type) == REFERENCE_TYPE)
+ if (TREE_CODE (TREE_TYPE (val)) == REFERENCE_TYPE)
return build_indirect_ref (val, NULL);
return val;
}
@@ -576,8 +573,7 @@ convert_from_reference (val)
preserving cv-qualification. */
tree
-convert_lvalue (totype, expr)
- tree totype, expr;
+convert_lvalue (tree totype, tree expr)
{
totype = cp_build_qualified_type (totype, TYPE_QUALS (TREE_TYPE (expr)));
totype = build_reference_type (totype);
@@ -604,8 +600,7 @@ force_rvalue (tree expr)
/* C++ conversions, preference to static cast conversions. */
tree
-cp_convert (type, expr)
- tree type, expr;
+cp_convert (tree type, tree expr)
{
return ocp_convert (type, expr, CONV_OLD_CONVERT, LOOKUP_NORMAL);
}
@@ -615,15 +610,12 @@ cp_convert (type, expr)
FLAGS indicates how we should behave. */
tree
-ocp_convert (type, expr, convtype, flags)
- tree type, expr;
- int convtype, flags;
+ocp_convert (tree type, tree expr, int convtype, int flags)
{
- register tree e = expr;
- register enum tree_code code = TREE_CODE (type);
+ tree e = expr;
+ enum tree_code code = TREE_CODE (type);
- if (e == error_mark_node
- || TREE_TYPE (e) == error_mark_node)
+ if (error_operand_p (e) || type == error_mark_node)
return error_mark_node;
complete_type (type);
@@ -642,7 +634,7 @@ ocp_convert (type, expr, convtype, flags)
if (same_type_p (type, TREE_TYPE (e)))
/* The call to fold will not always remove the NOP_EXPR as
might be expected, since if one of the types is a typedef;
- the comparsion in fold is just equality of pointers, not a
+ the comparison in fold is just equality of pointers, not a
call to comptypes. We don't call fold in this case because
that can result in infinite recursion; fold will call
convert, which will call ocp_convert, etc. */
@@ -651,6 +643,20 @@ ocp_convert (type, expr, convtype, flags)
conversion. */
else if (TREE_CODE (type) == COMPLEX_TYPE)
return fold (convert_to_complex (type, e));
+ else if (TREE_CODE (e) == TARGET_EXPR)
+ {
+ /* Don't build a NOP_EXPR of class type. Instead, change the
+ type of the temporary. Only allow this for cv-qual changes,
+ though. */
+ if (!same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (e)),
+ TYPE_MAIN_VARIANT (type)))
+ abort ();
+ TREE_TYPE (e) = TREE_TYPE (TARGET_EXPR_SLOT (e)) = type;
+ return e;
+ }
+ else if (TREE_ADDRESSABLE (type))
+ /* We shouldn't be treating objects of ADDRESSABLE type as rvalues. */
+ abort ();
else
return fold (build1 (NOP_EXPR, type, e));
}
@@ -661,16 +667,6 @@ ocp_convert (type, expr, convtype, flags)
return e;
}
- /* Just convert to the type of the member. */
- if (code == OFFSET_TYPE)
- {
- type = TREE_TYPE (type);
- code = TREE_CODE (type);
- }
-
- if (TREE_CODE (e) == OFFSET_REF)
- e = resolve_offset_ref (e);
-
if (INTEGRAL_CODE_P (code))
{
tree intype = TREE_TYPE (e);
@@ -698,25 +694,12 @@ ocp_convert (type, expr, convtype, flags)
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)
- 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 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, 0));
+ if (POINTER_TYPE_P (type) || TYPE_PTR_TO_MEMBER_P (type))
+ return fold (cp_convert_to_pointer (type, e, false));
if (code == VECTOR_TYPE)
return fold (convert_to_vector (type, e));
if (code == REAL_TYPE || code == COMPLEX_TYPE)
@@ -787,7 +770,7 @@ ocp_convert (type, expr, convtype, flags)
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
+ object is, but there is reason to believe 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++
@@ -801,15 +784,15 @@ ocp_convert (type, expr, convtype, flags)
IMPLICIT is tells us the context of an implicit void conversion. */
tree
-convert_to_void (expr, implicit)
- tree expr;
- const char *implicit;
+convert_to_void (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 (invalid_nonstatic_memfn_p (expr))
+ return error_mark_node;
if (VOID_TYPE_P (TREE_TYPE (expr)))
return expr;
switch (TREE_CODE (expr))
@@ -819,8 +802,12 @@ convert_to_void (expr, implicit)
/* 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);
+ tree new_op1 = convert_to_void
+ (op1, (implicit && !TREE_SIDE_EFFECTS (op2)
+ ? "second operand of conditional" : NULL));
+ tree new_op2 = convert_to_void
+ (op2, (implicit && !TREE_SIDE_EFFECTS (op1)
+ ? "third operand of conditional" : NULL));
expr = build (COND_EXPR, TREE_TYPE (new_op1),
TREE_OPERAND (expr, 0), new_op1, new_op2);
@@ -831,14 +818,14 @@ convert_to_void (expr, implicit)
{
/* The second part of a compound expr contains the value. */
tree op1 = TREE_OPERAND (expr,1);
- tree new_op1 = convert_to_void (op1, implicit);
+ tree new_op1 = convert_to_void
+ (op1, (implicit && !TREE_NO_UNUSED_WARNING (expr)
+ ? "right-hand operand of comma" : NULL));
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);
- TREE_NO_UNUSED_WARNING (t) = TREE_NO_UNUSED_WARNING (expr);
expr = t;
}
@@ -850,7 +837,7 @@ convert_to_void (expr, implicit)
/* These have already decayed to rvalue. */
break;
- case CALL_EXPR: /* we have a special meaning for volatile void fn() */
+ case CALL_EXPR: /* We have a special meaning for volatile void fn(). */
break;
case INDIRECT_REF:
@@ -886,10 +873,6 @@ convert_to_void (expr, implicit)
break;
}
- case OFFSET_REF:
- expr = resolve_offset_ref (expr);
- break;
-
default:;
}
{
@@ -903,6 +886,7 @@ convert_to_void (expr, implicit)
of an overloaded function, and this is not one of them. */
pedwarn ("%s cannot resolve address of overloaded function",
implicit ? implicit : "void cast");
+ expr = void_zero_node;
}
else if (implicit && probe == expr && is_overloaded_fn (probe))
/* Only warn when there is no &. */
@@ -912,13 +896,9 @@ convert_to_void (expr, implicit)
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);
+ if (implicit && !TREE_SIDE_EFFECTS (expr) && warn_unused_value)
+ warning ("%s has no effect", implicit);
+ expr = build1 (CONVERT_EXPR, void_type_node, expr);
}
return expr;
}
@@ -941,8 +921,7 @@ convert_to_void (expr, implicit)
do a little bit more work. */
tree
-convert (type, expr)
- tree type, expr;
+convert (tree type, tree expr)
{
tree intype;
@@ -966,13 +945,10 @@ convert (type, expr)
(such as conversion from sub-type to private super-type). */
tree
-convert_force (type, expr, convtype)
- tree type;
- tree expr;
- int convtype;
+convert_force (tree type, tree expr, int convtype)
{
- register tree e = expr;
- register enum tree_code code = TREE_CODE (type);
+ tree e = expr;
+ enum tree_code code = TREE_CODE (type);
if (code == REFERENCE_TYPE)
return fold (convert_to_reference (type, e, CONV_C_CAST, LOOKUP_COMPLAIN,
@@ -1010,8 +986,7 @@ convert_force (type, expr, convtype)
(jason 8/9/95) */
tree
-build_type_conversion (xtype, expr)
- tree xtype, expr;
+build_type_conversion (tree xtype, tree expr)
{
/* C++: check to see if we can convert this aggregate type
into the required type. */
@@ -1020,14 +995,11 @@ build_type_conversion (xtype, expr)
/* Convert the given EXPR to one of a group of types suitable for use in an
expression. DESIRES is a combination of various WANT_* flags (q.v.)
- which indicates which types are suitable. If COMPLAIN is 1, complain
+ which indicates which types are suitable. If COMPLAIN is true, complain
about ambiguity; otherwise, the caller will deal with it. */
tree
-build_expr_type_conversion (desires, expr, complain)
- int desires;
- tree expr;
- int complain;
+build_expr_type_conversion (int desires, tree expr, bool complain)
{
tree basetype = TREE_TYPE (expr);
tree conv = NULL_TREE;
@@ -1038,8 +1010,6 @@ build_expr_type_conversion (desires, expr, complain)
&& !(desires & WANT_NULL))
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);
@@ -1065,7 +1035,7 @@ build_expr_type_conversion (desires, expr, complain)
case FUNCTION_TYPE:
case ARRAY_TYPE:
- return (desires & WANT_POINTER) ? default_conversion (expr)
+ return (desires & WANT_POINTER) ? decay_conversion (expr)
: NULL_TREE;
default:
return NULL_TREE;
@@ -1073,8 +1043,9 @@ build_expr_type_conversion (desires, expr, complain)
/* The code for conversions from class type is currently only used for
delete expressions. Other expressions are handled by build_new_op. */
-
- if (! TYPE_HAS_CONVERSION (basetype))
+ if (!complete_type_or_else (basetype, expr))
+ return error_mark_node;
+ if (!TYPE_HAS_CONVERSION (basetype))
return NULL_TREE;
for (conv = lookup_conversions (basetype); conv; conv = TREE_CHAIN (conv))
@@ -1086,9 +1057,7 @@ build_expr_type_conversion (desires, expr, complain)
if (winner && winner == cand)
continue;
- candidate = TREE_TYPE (TREE_TYPE (cand));
- if (TREE_CODE (candidate) == REFERENCE_TYPE)
- candidate = TREE_TYPE (candidate);
+ candidate = non_reference (TREE_TYPE (TREE_TYPE (cand)));
switch (TREE_CODE (candidate))
{
@@ -1126,9 +1095,7 @@ build_expr_type_conversion (desires, expr, complain)
if (winner)
{
- tree type = TREE_TYPE (TREE_TYPE (winner));
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
+ tree type = non_reference (TREE_TYPE (TREE_TYPE (winner)));
return build_user_type_conversion (type, expr, LOOKUP_NORMAL);
}
@@ -1138,15 +1105,11 @@ build_expr_type_conversion (desires, expr, complain)
/* Implements integral promotion (4.1) and float->double promotion. */
tree
-type_promotes_to (type)
- tree type;
+type_promotes_to (tree type)
{
- int type_quals;
-
if (type == error_mark_node)
return error_mark_node;
- type_quals = cp_type_quals (type);
type = TYPE_MAIN_VARIANT (type);
/* bool always promotes to int (not unsigned), even if it's the same
@@ -1179,8 +1142,8 @@ type_promotes_to (type)
}
else if (type == float_type_node)
type = double_type_node;
-
- return cp_build_qualified_type (type, type_quals);
+
+ return type;
}
/* The routines below this point are carefully written to conform to
@@ -1193,14 +1156,22 @@ type_promotes_to (type)
the conversion was impossible. */
tree
-perform_qualification_conversions (type, expr)
- tree type;
- tree expr;
+perform_qualification_conversions (tree type, tree expr)
{
- if (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE
- && comp_ptr_ttypes (TREE_TYPE (type), TREE_TYPE (TREE_TYPE (expr))))
- return build1 (NOP_EXPR, type, expr);
+ tree expr_type;
+
+ expr_type = TREE_TYPE (expr);
+
+ if (TYPE_PTR_P (type) && TYPE_PTR_P (expr_type)
+ && comp_ptr_ttypes (TREE_TYPE (type), TREE_TYPE (expr_type)))
+ return build_nop (type, expr);
+ else if (TYPE_PTR_TO_MEMBER_P (type)
+ && TYPE_PTR_TO_MEMBER_P (expr_type)
+ && same_type_p (TYPE_PTRMEM_CLASS_TYPE (type),
+ TYPE_PTRMEM_CLASS_TYPE (expr_type))
+ && comp_ptr_ttypes (TYPE_PTRMEM_POINTED_TO_TYPE (type),
+ TYPE_PTRMEM_POINTED_TO_TYPE (expr_type)))
+ return build_nop (type, expr);
else
return error_mark_node;
}
diff --git a/contrib/gcc/cp/cxx-pretty-print.c b/contrib/gcc/cp/cxx-pretty-print.c
new file mode 100644
index 0000000..53c677a
--- /dev/null
+++ b/contrib/gcc/cp/cxx-pretty-print.c
@@ -0,0 +1,1737 @@
+/* Implementation of subroutines for the GNU C++ pretty-printer.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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 GCC; 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 "coretypes.h"
+#include "tm.h"
+#include "real.h"
+#include "cxx-pretty-print.h"
+#include "cp-tree.h"
+#include "toplev.h"
+
+static void pp_cxx_unqualified_id (cxx_pretty_printer *, tree);
+static void pp_cxx_nested_name_specifier (cxx_pretty_printer *, tree);
+static void pp_cxx_qualified_id (cxx_pretty_printer *, tree);
+static void pp_cxx_assignment_expression (cxx_pretty_printer *, tree);
+static void pp_cxx_expression (cxx_pretty_printer *, tree);
+static void pp_cxx_template_argument_list (cxx_pretty_printer *, tree);
+static void pp_cxx_type_specifier_seq (cxx_pretty_printer *, tree);
+static void pp_cxx_ptr_operator (cxx_pretty_printer *, tree);
+static void pp_cxx_type_id (cxx_pretty_printer *, tree);
+static void pp_cxx_direct_abstract_declarator (cxx_pretty_printer *, tree);
+static void pp_cxx_declarator (cxx_pretty_printer *, tree);
+static void pp_cxx_abstract_declarator (cxx_pretty_printer *, tree);
+static void pp_cxx_template_parameter (cxx_pretty_printer *, tree);
+
+#define pp_cxx_whitespace(PP) pp_c_whitespace (pp_c_base (PP))
+#define pp_cxx_left_paren(PP) pp_c_left_paren (pp_c_base (PP))
+#define pp_cxx_right_paren(PP) pp_c_right_paren (pp_c_base (PP))
+#define pp_cxx_left_brace(PP) pp_c_left_brace (pp_c_base (PP))
+#define pp_cxx_right_brace(PP) pp_c_right_brace (pp_c_base (PP))
+#define pp_cxx_dot(PP) pp_c_dot (pp_c_base (PP))
+#define pp_cxx_arrow(PP) pp_c_arrow (pp_c_base (PP))
+#define pp_cxx_semicolon(PP) pp_c_semicolon (pp_c_base (PP))
+
+static inline void
+pp_cxx_nonconsecutive_character (cxx_pretty_printer *pp, int c)
+{
+ const char *p = pp_last_position_in_text (pp);
+
+ if (p != NULL && *p == c)
+ pp_cxx_whitespace (pp);
+ pp_character (pp, c);
+ pp_base (pp)->padding = pp_none;
+}
+
+#define pp_cxx_begin_template_argument_list(PP) \
+ pp_cxx_nonconsecutive_character (PP, '<')
+#define pp_cxx_end_template_argument_list(PP) \
+ pp_cxx_nonconsecutive_character (PP, '>')
+
+#define pp_cxx_identifier(PP, ID) pp_c_identifier (pp_c_base (PP), ID)
+#define pp_cxx_tree_identifier(PP, T) pp_c_tree_identifier (pp_c_base (PP), T)
+
+#define pp_cxx_cv_qualifier_seq(PP, T) \
+ pp_c_type_qualifier_list (pp_c_base (PP), T)
+#define pp_cxx_storage_class_specifier(PP, T) \
+ pp_c_storage_class_specifier (pp_c_base (PP), T)
+#define pp_cxx_expression_list(PP, T) \
+ pp_c_expression_list (pp_c_base (PP), T)
+#define pp_cxx_space_for_pointer_operator(PP, T) \
+ pp_c_space_for_pointer_operator (pp_c_base (PP), T)
+#define pp_cxx_init_declarator(PP, T) \
+ pp_c_init_declarator (pp_c_base (PP), T)
+#define pp_cxx_call_argument_list(PP, T) \
+ pp_c_call_argument_list (pp_c_base (PP), T)
+
+static void
+pp_cxx_colon_colon (cxx_pretty_printer *pp)
+{
+ pp_colon_colon (pp);
+ pp_base (pp)->padding = pp_none;
+}
+
+
+/* Expressions. */
+
+static inline bool
+is_destructor_name (tree name)
+{
+ return name == complete_dtor_identifier
+ || name == base_dtor_identifier
+ || name == deleting_dtor_identifier;
+}
+
+/* conversion-function-id:
+ operator conversion-type-id
+
+ conversion-type-id:
+ type-specifier-seq conversion-declarator(opt)
+
+ conversion-declarator:
+ ptr-operator conversion-declarator(opt) */
+static inline void
+pp_cxx_conversion_function_id (cxx_pretty_printer *pp, tree t)
+{
+ pp_cxx_identifier (pp, "operator");
+ pp_cxx_type_specifier_seq (pp, TREE_TYPE (t));
+}
+
+static inline void
+pp_cxx_template_id (cxx_pretty_printer *pp, tree t)
+{
+ pp_cxx_unqualified_id (pp, TREE_OPERAND (t, 0));
+ pp_cxx_begin_template_argument_list (pp);
+ pp_cxx_template_argument_list (pp, TREE_OPERAND (t, 1));
+ pp_cxx_end_template_argument_list (pp);
+}
+
+/* unqualified-id:
+ identifier
+ operator-function-id
+ conversion-function-id
+ ~ class-name
+ template-id */
+static void
+pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
+{
+ enum tree_code code = TREE_CODE (t);
+ switch (code)
+ {
+ case RESULT_DECL:
+ pp_cxx_identifier (pp, "<return-value>");
+ break;
+
+ case OVERLOAD:
+ t = OVL_CURRENT (t);
+ case VAR_DECL:
+ case PARM_DECL:
+ case CONST_DECL:
+ case TYPE_DECL:
+ case FUNCTION_DECL:
+ case NAMESPACE_DECL:
+ case FIELD_DECL:
+ case LABEL_DECL:
+ case USING_DECL:
+ case TEMPLATE_DECL:
+ t = DECL_NAME (t);
+
+ case IDENTIFIER_NODE:
+ if (t == NULL)
+ pp_cxx_identifier (pp, "<anonymous>");
+ else if (IDENTIFIER_TYPENAME_P (t))
+ pp_cxx_conversion_function_id (pp, t);
+ else
+ {
+ if (is_destructor_name (t))
+ {
+ pp_complement (pp);
+ /* FIXME: Why is this necessary? */
+ if (TREE_TYPE (t))
+ t = constructor_name (TREE_TYPE (t));
+ }
+ pp_cxx_tree_identifier (pp, t);
+ }
+ break;
+
+ case TEMPLATE_ID_EXPR:
+ pp_cxx_template_id (pp, t);
+ break;
+
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ case ENUMERAL_TYPE:
+ pp_cxx_unqualified_id (pp, TYPE_NAME (t));
+ break;
+
+ case TEMPLATE_TYPE_PARM:
+ t = TYPE_FIELDS (t);
+ case TEMPLATE_PARM_INDEX:
+ pp_cxx_unqualified_id (pp, TEMPLATE_PARM_DECL (t));
+ break;
+
+ default:
+ pp_unsupported_tree (pp, t);
+ break;
+ }
+}
+
+static inline void
+pp_cxx_template_keyword_if_needed (cxx_pretty_printer *pp, tree scope, tree t)
+{
+ if (TREE_CODE (t) == TEMPLATE_ID_EXPR
+ && TYPE_P (scope) && dependent_type_p (scope))
+ pp_cxx_identifier (pp, "template");
+}
+
+/* nested-name-specifier:
+ class-or-namespace-name :: nested-name-specifier(opt)
+ class-or-namespace-name :: template nested-name-specifier */
+static void
+pp_cxx_nested_name_specifier (cxx_pretty_printer *pp, tree t)
+{
+ if (t != NULL && t != pp->enclosing_scope)
+ {
+ tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
+ pp_cxx_nested_name_specifier (pp, scope);
+ pp_cxx_template_keyword_if_needed (pp, scope, t);
+ pp_cxx_unqualified_id (pp, t);
+ pp_cxx_colon_colon (pp);
+ }
+}
+
+/* qualified-id:
+ nested-name-specifier template(opt) unqualified-id */
+static void
+pp_cxx_qualified_id (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case PTRMEM_CST:
+ pp_cxx_nested_name_specifier (pp, PTRMEM_CST_CLASS (t));
+ pp_cxx_unqualified_id (pp, PTRMEM_CST_MEMBER (t));
+ break;
+
+ case OVERLOAD:
+ t = OVL_CURRENT (t);
+ case FUNCTION_DECL:
+ if (DECL_FUNCTION_MEMBER_P (t))
+ pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
+ pp_cxx_unqualified_id
+ (pp, DECL_CONSTRUCTOR_P (t) ? DECL_CONTEXT (t) : t);
+ break;
+
+ case OFFSET_REF:
+ case SCOPE_REF:
+ pp_cxx_nested_name_specifier (pp, TREE_OPERAND (t, 0));
+ pp_cxx_unqualified_id (pp, TREE_OPERAND (t, 1));
+ break;
+
+ default:
+ {
+ tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
+ if (scope != pp->enclosing_scope)
+ {
+ pp_cxx_nested_name_specifier (pp, scope);
+ pp_cxx_template_keyword_if_needed (pp, scope, t);
+ }
+ pp_cxx_unqualified_id (pp, t);
+ }
+ break;
+ }
+}
+
+/* id-expression:
+ unqualified-id
+ qualified-id */
+static inline void
+pp_cxx_id_expression (cxx_pretty_printer *pp, tree t)
+{
+ if (TREE_CODE (t) == OVERLOAD)
+ t = OVL_CURRENT (t);
+ if (DECL_P (t) && DECL_CONTEXT (t))
+ pp_cxx_qualified_id (pp, t);
+ else
+ pp_cxx_unqualified_id (pp, t);
+}
+
+/* primary-expression:
+ literal
+ this
+ :: identifier
+ :: operator-function-id
+ :: qualifier-id
+ ( expression )
+ id-expression */
+static void
+pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case STRING_CST:
+ case INTEGER_CST:
+ case REAL_CST:
+ pp_c_constant (pp_c_base (pp), t);
+ break;
+
+ case BASELINK:
+ t = BASELINK_FUNCTIONS (t);
+ case VAR_DECL:
+ case PARM_DECL:
+ case FIELD_DECL:
+ case FUNCTION_DECL:
+ case OVERLOAD:
+ case CONST_DECL:
+ case TEMPLATE_DECL:
+ pp_cxx_id_expression (pp, t);
+ break;
+
+ case RESULT_DECL:
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_PARM_INDEX:
+ pp_cxx_unqualified_id (pp, t);
+ break;
+
+ default:
+ pp_c_primary_expression (pp_c_base (pp), t);
+ break;
+ }
+}
+
+/* postfix-expression:
+ primary-expression
+ postfix-expression [ expression ]
+ postfix-expression ( expression-list(opt) )
+ simple-type-specifier ( expression-list(opt) )
+ typename ::(opt) nested-name-specifier identifier ( expression-list(opt) )
+ typename ::(opt) nested-name-specifier template(opt)
+ template-id ( expression-list(opt) )
+ postfix-expression . template(opt) ::(opt) id-expression
+ postfix-expression -> template(opt) ::(opt) id-expression
+ postfix-expression . pseudo-destructor-name
+ postfix-expression -> pseudo-destructor-name
+ postfix-expression ++
+ postfix-expression --
+ dynamic_cast < type-id > ( expression )
+ static_cast < type-id > ( expression )
+ reinterpret_cast < type-id > ( expression )
+ const_cast < type-id > ( expression )
+ typeid ( expression )
+ typeif ( type-id ) */
+
+static void
+pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
+{
+ enum tree_code code = TREE_CODE (t);
+
+ switch (code)
+ {
+ case AGGR_INIT_EXPR:
+ case CALL_EXPR:
+ {
+ tree fun = TREE_OPERAND (t, 0);
+ tree args = TREE_OPERAND (t, 1);
+ tree saved_scope = pp->enclosing_scope;
+
+ if (TREE_CODE (fun) == ADDR_EXPR)
+ fun = TREE_OPERAND (fun, 0);
+
+ /* In templates, where there is no way to tell whether a given
+ call uses an actual member function. So the parser builds
+ FUN as a COMPONENT_REF or a plain IDENTIFIER_NODE until
+ instantiation time. */
+ if (TREE_CODE (fun) != FUNCTION_DECL)
+ ;
+ else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun))
+ {
+ tree object = code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t)
+ ? TREE_OPERAND (t, 2)
+ : TREE_VALUE (args);
+
+ while (TREE_CODE (object) == NOP_EXPR)
+ object = TREE_OPERAND (object, 0);
+
+ if (TREE_CODE (object) == ADDR_EXPR)
+ object = TREE_OPERAND (object, 0);
+
+ if (TREE_CODE (TREE_TYPE (object)) != POINTER_TYPE)
+ {
+ pp_cxx_postfix_expression (pp, object);
+ pp_cxx_dot (pp);
+ }
+ else
+ {
+ pp_cxx_postfix_expression (pp, object);
+ pp_cxx_arrow (pp);
+ }
+ args = TREE_CHAIN (args);
+ pp->enclosing_scope = strip_pointer_operator (TREE_TYPE (object));
+ }
+
+ pp_cxx_postfix_expression (pp, fun);
+ pp->enclosing_scope = saved_scope;
+ pp_cxx_call_argument_list (pp, args);
+ }
+ if (code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t))
+ {
+ pp_separate_with (pp, ',');
+ pp_cxx_postfix_expression (pp, TREE_OPERAND (t, 2));
+ }
+ break;
+
+ case BASELINK:
+ case VAR_DECL:
+ case PARM_DECL:
+ case FIELD_DECL:
+ case FUNCTION_DECL:
+ case OVERLOAD:
+ case CONST_DECL:
+ case TEMPLATE_DECL:
+ case RESULT_DECL:
+ pp_cxx_primary_expression (pp, t);
+ break;
+
+ case DYNAMIC_CAST_EXPR:
+ case STATIC_CAST_EXPR:
+ case REINTERPRET_CAST_EXPR:
+ case CONST_CAST_EXPR:
+ if (code == DYNAMIC_CAST_EXPR)
+ pp_identifier (pp, "dynamic_cast");
+ else if (code == STATIC_CAST_EXPR)
+ pp_identifier (pp, "static_cast");
+ else if (code == REINTERPRET_CAST_EXPR)
+ pp_identifier (pp, "reinterpret_cast");
+ else
+ pp_identifier (pp, "const_cast");
+ pp_cxx_begin_template_argument_list (pp);
+ pp_cxx_type_id (pp, TREE_TYPE (t));
+ pp_cxx_end_template_argument_list (pp);
+ pp_left_paren (pp);
+ pp_cxx_expression (pp, TREE_OPERAND (t, 0));
+ pp_right_paren (pp);
+ break;
+
+ case EMPTY_CLASS_EXPR:
+ pp_cxx_type_id (pp, TREE_TYPE (t));
+ pp_left_paren (pp);
+ pp_right_paren (pp);
+ break;
+
+ case TYPEID_EXPR:
+ t = TREE_OPERAND (t, 0);
+ pp_cxx_identifier (pp, "typeid");
+ pp_left_paren (pp);
+ if (TYPE_P (t))
+ pp_cxx_type_id (pp, t);
+ else
+ pp_cxx_expression (pp, t);
+ pp_right_paren (pp);
+ break;
+
+ case PSEUDO_DTOR_EXPR:
+ pp_cxx_postfix_expression (pp, TREE_OPERAND (t, 0));
+ pp_cxx_dot (pp);
+ pp_cxx_qualified_id (pp, TREE_OPERAND (t, 1));
+ pp_cxx_colon_colon (pp);
+ pp_complement (pp);
+ pp_cxx_unqualified_id (pp, TREE_OPERAND (t, 2));
+ break;
+
+ default:
+ pp_c_postfix_expression (pp_c_base (pp), t);
+ break;
+ }
+}
+
+/* new-expression:
+ ::(opt) new new-placement(opt) new-type-id new-initializer(opt)
+ ::(opt) new new-placement(opt) ( type-id ) new-initializer(opt)
+
+ new-placement:
+ ( expression-list )
+
+ new-type-id:
+ type-specifier-seq new-declarator(opt)
+
+ new-declarator:
+ ptr-operator new-declarator(opt)
+ direct-new-declarator
+
+ direct-new-declarator
+ [ expression ]
+ direct-new-declarator [ constant-expression ]
+
+ new-initializer:
+ ( expression-list(opt) ) */
+static void
+pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
+{
+ enum tree_code code = TREE_CODE (t);
+ switch (code)
+ {
+ case NEW_EXPR:
+ case VEC_NEW_EXPR:
+ if (NEW_EXPR_USE_GLOBAL (t))
+ pp_cxx_colon_colon (pp);
+ pp_cxx_identifier (pp, "new");
+ if (TREE_OPERAND (t, 0))
+ {
+ pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0));
+ pp_space (pp);
+ }
+ /* FIXME: array-types are built with one more element. */
+ pp_cxx_type_id (pp, TREE_OPERAND (t, 1));
+ if (TREE_OPERAND (t, 2))
+ {
+ pp_left_paren (pp);
+ t = TREE_OPERAND (t, 2);
+ if (TREE_CODE (t) == TREE_LIST)
+ pp_c_expression_list (pp_c_base (pp), t);
+ else if (t == void_zero_node)
+ ; /* OK, empty initializer list. */
+ else
+ pp_cxx_expression (pp, t);
+ pp_right_paren (pp);
+ }
+ break;
+
+ default:
+ pp_unsupported_tree (pp, t);
+ }
+}
+
+/* delete-expression:
+ ::(opt) delete cast-expression
+ ::(opt) delete [ ] cast-expression */
+static void
+pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
+{
+ enum tree_code code = TREE_CODE (t);
+ switch (code)
+ {
+ case DELETE_EXPR:
+ case VEC_DELETE_EXPR:
+ if (DELETE_EXPR_USE_GLOBAL (t))
+ pp_cxx_colon_colon (pp);
+ pp_cxx_identifier (pp, "delete");
+ if (code == VEC_DELETE_EXPR)
+ {
+ pp_left_bracket (pp);
+ pp_right_bracket (pp);
+ }
+ pp_c_cast_expression (pp_c_base (pp), TREE_OPERAND (t, 0));
+ break;
+
+ default:
+ pp_unsupported_tree (pp, t);
+ }
+}
+
+/* unary-expression:
+ postfix-expression
+ ++ cast-expression
+ -- cast-expression
+ unary-operator cast-expression
+ sizeof unary-expression
+ sizeof ( type-id )
+ new-expression
+ delete-expression
+
+ unary-operator: one of
+ * & + - !
+
+ GNU extensions:
+ __alignof__ unary-expression
+ __alignof__ ( type-id ) */
+static void
+pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
+{
+ enum tree_code code = TREE_CODE (t);
+ switch (code)
+ {
+ case NEW_EXPR:
+ case VEC_NEW_EXPR:
+ pp_cxx_new_expression (pp, t);
+ break;
+
+ case DELETE_EXPR:
+ case VEC_DELETE_EXPR:
+ pp_cxx_delete_expression (pp, t);
+ break;
+
+ default:
+ pp_c_unary_expression (pp_c_base (pp), t);
+ break;
+ }
+}
+
+/* cast-expression:
+ unary-expression
+ ( type-id ) cast-expression */
+static void
+pp_cxx_cast_expression (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case CAST_EXPR:
+ pp_cxx_type_id (pp, TREE_TYPE (t));
+ pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0));
+ break;
+
+ default:
+ pp_c_cast_expression (pp_c_base (pp), t);
+ break;
+ }
+}
+
+/* pm-expression:
+ cast-expression
+ pm-expression .* cast-expression
+ pm-expression ->* cast-expression */
+static void
+pp_cxx_pm_expression (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ /* Handle unfortunate OFFESET_REF overloading here. */
+ case OFFSET_REF:
+ if (TYPE_P (TREE_OPERAND (t, 0)))
+ {
+ pp_cxx_qualified_id (pp, t);
+ break;
+ }
+ /* Else fall through. */
+ case MEMBER_REF:
+ case DOTSTAR_EXPR:
+ pp_cxx_pm_expression (pp, TREE_OPERAND (t, 0));
+ pp_cxx_dot (pp);
+ pp_star(pp);
+ pp_cxx_cast_expression (pp, TREE_OPERAND (t, 1));
+ break;
+
+
+ default:
+ pp_cxx_cast_expression (pp, t);
+ break;
+ }
+}
+
+/* multiplicative-expression:
+ pm-expression
+ multiplicative-expression * pm-expression
+ multiplicative-expression / pm-expression
+ multiplicative-expression % pm-expression */
+static void
+pp_cxx_multiplicative_expression (cxx_pretty_printer *pp, tree e)
+{
+ enum tree_code code = TREE_CODE (e);
+ switch (code)
+ {
+ case MULT_EXPR:
+ case TRUNC_DIV_EXPR:
+ case TRUNC_MOD_EXPR:
+ pp_cxx_multiplicative_expression (pp, TREE_OPERAND (e, 0));
+ pp_space (pp);
+ if (code == MULT_EXPR)
+ pp_star (pp);
+ else if (code == TRUNC_DIV_EXPR)
+ pp_slash (pp);
+ else
+ pp_modulo (pp);
+ pp_space (pp);
+ pp_cxx_pm_expression (pp, TREE_OPERAND (e, 1));
+ break;
+
+ default:
+ pp_cxx_pm_expression (pp, e);
+ break;
+ }
+}
+
+/* conditional-expression:
+ logical-or-expression
+ logical-or-expression ? expression : assignment-expression */
+static void
+pp_cxx_conditional_expression (cxx_pretty_printer *pp, tree e)
+{
+ if (TREE_CODE (e) == COND_EXPR)
+ {
+ pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
+ pp_space (pp);
+ pp_question (pp);
+ pp_space (pp);
+ pp_cxx_expression (pp, TREE_OPERAND (e, 1));
+ pp_space (pp);
+ pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 2));
+ }
+ else
+ pp_c_logical_or_expression (pp_c_base (pp), e);
+}
+
+static void
+pp_cxx_assignment_operator (cxx_pretty_printer *pp, tree t)
+{
+ const char *op;
+
+ switch (TREE_CODE (t))
+ {
+ case NOP_EXPR:
+ op = "=";
+ break;
+
+ case PLUS_EXPR:
+ op = "+=";
+ break;
+
+ case MINUS_EXPR:
+ op = "-=";
+ break;
+
+ case TRUNC_DIV_EXPR:
+ op = "/=";
+ break;
+
+ case TRUNC_MOD_EXPR:
+ op = "%=";
+ break;
+
+ default:
+ op = tree_code_name[TREE_CODE (t)];
+ break;
+ }
+
+ pp_cxx_identifier (pp, op);
+}
+
+
+/* assignment-expression:
+ conditional-expression
+ logical-or-expression assignment-operator assignment-expression
+ throw-expression
+
+ throw-expression:
+ throw assignment-expression(opt)
+
+ assignment-operator: one of
+ = *= /= %= += -= >>= <<= &= ^= |= */
+static void
+pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree e)
+{
+ switch (TREE_CODE (e))
+ {
+ case MODIFY_EXPR:
+ case INIT_EXPR:
+ pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
+ pp_space (pp);
+ pp_equal (pp);
+ pp_space (pp);
+ pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 1));
+ break;
+
+ case THROW_EXPR:
+ pp_cxx_identifier (pp, "throw");
+ if (TREE_OPERAND (e, 0))
+ pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 0));
+ break;
+
+ case MODOP_EXPR:
+ pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
+ pp_cxx_assignment_operator (pp, TREE_OPERAND (e, 1));
+ pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 2));
+ break;
+
+ default:
+ pp_cxx_conditional_expression (pp, e);
+ break;
+ }
+}
+
+static void
+pp_cxx_expression (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case STRING_CST:
+ case INTEGER_CST:
+ case REAL_CST:
+ pp_c_constant (pp_c_base (pp), t);
+ break;
+
+ case RESULT_DECL:
+ pp_cxx_unqualified_id (pp, t);
+ break;
+
+#if 0
+ case OFFSET_REF:
+#endif
+ case SCOPE_REF:
+ case PTRMEM_CST:
+ pp_cxx_qualified_id (pp, t);
+ break;
+
+ case OVERLOAD:
+ t = OVL_CURRENT (t);
+ case VAR_DECL:
+ case PARM_DECL:
+ case FIELD_DECL:
+ case CONST_DECL:
+ case FUNCTION_DECL:
+ case BASELINK:
+ case TEMPLATE_DECL:
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_PARM_INDEX:
+ pp_cxx_primary_expression (pp, t);
+ break;
+
+ case CALL_EXPR:
+ case DYNAMIC_CAST_EXPR:
+ case STATIC_CAST_EXPR:
+ case REINTERPRET_CAST_EXPR:
+ case CONST_CAST_EXPR:
+#if 0
+ case MEMBER_REF:
+#endif
+ case EMPTY_CLASS_EXPR:
+ case TYPEID_EXPR:
+ case PSEUDO_DTOR_EXPR:
+ case AGGR_INIT_EXPR:
+ pp_cxx_postfix_expression (pp, t);
+ break;
+
+ case NEW_EXPR:
+ case VEC_NEW_EXPR:
+ pp_cxx_new_expression (pp, t);
+ break;
+
+ case DELETE_EXPR:
+ case VEC_DELETE_EXPR:
+ pp_cxx_delete_expression (pp, t);
+ break;
+
+ case CAST_EXPR:
+ pp_cxx_cast_expression (pp, t);
+ break;
+
+ case OFFSET_REF:
+ case MEMBER_REF:
+ case DOTSTAR_EXPR:
+ pp_cxx_pm_expression (pp, t);
+ break;
+
+ case MULT_EXPR:
+ case TRUNC_DIV_EXPR:
+ case TRUNC_MOD_EXPR:
+ pp_cxx_multiplicative_expression (pp, t);
+ break;
+
+ case COND_EXPR:
+ pp_cxx_conditional_expression (pp, t);
+ break;
+
+ case MODIFY_EXPR:
+ case INIT_EXPR:
+ case THROW_EXPR:
+ case MODOP_EXPR:
+ pp_cxx_assignment_expression (pp, t);
+ break;
+
+ default:
+ pp_c_expression (pp_c_base (pp), t);
+ break;
+ }
+}
+
+
+/* Declarations. */
+
+/* function-specifier:
+ inline
+ virtual
+ explicit */
+static void
+pp_cxx_function_specifier (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case FUNCTION_DECL:
+ if (DECL_VIRTUAL_P (t))
+ pp_cxx_identifier (pp, "virtual");
+ else if (DECL_CONSTRUCTOR_P (t) && DECL_NONCONVERTING_P (t))
+ pp_cxx_identifier (pp, "explicit");
+ else
+ pp_c_function_specifier (pp_c_base (pp), t);
+
+ default:
+ break;
+ }
+}
+
+/* decl-specifier-seq:
+ decl-specifier-seq(opt) decl-specifier
+
+ decl-specifier:
+ storage-class-specifier
+ type-specifier
+ function-specifier
+ friend
+ typedef */
+static void
+pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case VAR_DECL:
+ case PARM_DECL:
+ case CONST_DECL:
+ case FIELD_DECL:
+ pp_cxx_storage_class_specifier (pp, t);
+ pp_cxx_decl_specifier_seq (pp, TREE_TYPE (t));
+ break;
+
+ case TYPE_DECL:
+ pp_cxx_identifier (pp, "typedef");
+ pp_cxx_decl_specifier_seq (pp, TREE_TYPE (t));
+ break;
+
+ case RECORD_TYPE:
+ if (TYPE_PTRMEMFUNC_P (t))
+ {
+ tree pfm = TYPE_PTRMEMFUNC_FN_TYPE (t);
+ pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (pfm)));
+ pp_cxx_whitespace (pp);
+ pp_cxx_ptr_operator (pp, t);
+ }
+ break;
+
+ case FUNCTION_DECL:
+ /* Constructors don't have return types. And conversion functions
+ do not have a type-specifier in their return types. */
+ if (DECL_CONSTRUCTOR_P (t) || DECL_CONV_FN_P (t))
+ pp_cxx_function_specifier (pp, t);
+ else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
+ pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t)));
+ else
+ default:
+ pp_c_declaration_specifiers (pp_c_base (pp), t);
+ break;
+ }
+}
+
+/* simple-type-specifier:
+ ::(opt) nested-name-specifier(opt) type-name
+ ::(opt) nested-name-specifier(opt) template(opt) template-id
+ char
+ wchar_t
+ bool
+ short
+ int
+ long
+ signed
+ unsigned
+ float
+ double
+ void */
+static void
+pp_cxx_simple_type_specifier (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ case ENUMERAL_TYPE:
+ pp_cxx_qualified_id (pp, t);
+ break;
+
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_PARM_INDEX:
+ pp_cxx_unqualified_id (pp, t);
+ break;
+
+ case TYPENAME_TYPE:
+ pp_cxx_identifier (pp, "typename");
+ pp_cxx_nested_name_specifier (pp, TYPE_CONTEXT (t));
+ pp_cxx_unqualified_id (pp, TYPE_NAME (t));
+ break;
+
+ default:
+ pp_c_type_specifier (pp_c_base (pp), t);
+ break;
+ }
+}
+
+/* type-specifier-seq:
+ type-specifier type-specifier-seq(opt)
+
+ type-specifier:
+ simple-type-specifier
+ class-specifier
+ enum-specifier
+ elaborated-type-specifier
+ cv-qualifier */
+
+static void
+pp_cxx_type_specifier_seq (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case TEMPLATE_DECL:
+ case TEMPLATE_TYPE_PARM:
+ case TYPE_DECL:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ pp_c_type_qualifier_list (pp_c_base (pp), t);
+ pp_cxx_simple_type_specifier (pp, t);
+ break;
+
+ case METHOD_TYPE:
+ pp_cxx_type_specifier_seq (pp, TREE_TYPE (t));
+ pp_cxx_space_for_pointer_operator (pp, TREE_TYPE (t));
+ pp_cxx_nested_name_specifier (pp, TYPE_METHOD_BASETYPE (t));
+ break;
+
+ default:
+ if (!(TREE_CODE (t) == FUNCTION_DECL && DECL_CONSTRUCTOR_P (t)))
+ pp_c_specifier_qualifier_list (pp_c_base (pp), t);
+ }
+}
+
+/* ptr-operator:
+ * cv-qualifier-seq(opt)
+ &
+ ::(opt) nested-name-specifier * cv-qualifier-seq(opt) */
+
+static void
+pp_cxx_ptr_operator (cxx_pretty_printer *pp, tree t)
+{
+ if (!TYPE_P (t) && TREE_CODE (t) != TYPE_DECL)
+ t = TREE_TYPE (t);
+ switch (TREE_CODE (t))
+ {
+ case REFERENCE_TYPE:
+ case POINTER_TYPE:
+ if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE
+ || TYPE_PTR_TO_MEMBER_P (TREE_TYPE (t)))
+ pp_cxx_ptr_operator (pp, TREE_TYPE (t));
+ if (TREE_CODE (t) == POINTER_TYPE)
+ {
+ pp_star (pp);
+ pp_cxx_cv_qualifier_seq (pp, t);
+ }
+ else
+ pp_ampersand (pp);
+ break;
+
+ case RECORD_TYPE:
+ if (TYPE_PTRMEMFUNC_P (t))
+ {
+ pp_cxx_left_paren (pp);
+ pp_cxx_nested_name_specifier (pp, TYPE_PTRMEMFUNC_OBJECT_TYPE (t));
+ pp_star (pp);
+ break;
+ }
+ case OFFSET_TYPE:
+ if (TYPE_PTR_TO_MEMBER_P (t))
+ {
+ pp_cxx_nested_name_specifier (pp, TYPE_PTRMEM_CLASS_TYPE (t));
+ pp_star (pp);
+ pp_cxx_cv_qualifier_seq (pp, t);
+ break;
+ }
+ /* else fall through. */
+
+ default:
+ pp_unsupported_tree (pp, t);
+ break;
+ }
+}
+
+static inline tree
+pp_cxx_implicit_parameter_type (tree mf)
+{
+ return TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (mf))));
+}
+
+/*
+ parameter-declaration:
+ decl-specifier-seq declarator
+ decl-specifier-seq declarator = assignment-expression
+ decl-specifier-seq abstract-declarator(opt)
+ decl-specifier-seq abstract-declarator(opt) assignment-expression */
+static inline void
+pp_cxx_parameter_declaration (cxx_pretty_printer *pp, tree t)
+{
+ pp_cxx_decl_specifier_seq (pp, t);
+ if (TYPE_P (t))
+ pp_cxx_abstract_declarator (pp, t);
+ else
+ pp_cxx_declarator (pp, t);
+}
+
+/* parameter-declaration-clause:
+ parameter-declaration-list(opt) ...(opt)
+ parameter-declaration-list , ...
+
+ parameter-declaration-list:
+ parameter-declaration
+ parameter-declaration-list , parameter-declaration */
+static void
+pp_cxx_parameter_declaration_clause (cxx_pretty_printer *pp, tree t)
+{
+ tree args = TYPE_P (t) ? NULL : FUNCTION_FIRST_USER_PARM (t);
+ tree types = TYPE_P (t) ? TYPE_ARG_TYPES (t) : FUNCTION_FIRST_USER_PARMTYPE (t);
+ const bool abstract = args == NULL
+ || pp_c_base (pp)->flags & pp_c_flag_abstract;
+ bool first = true;
+
+ /* Skip artificial parameter for nonstatic member functions. */
+ if (TREE_CODE (t) == METHOD_TYPE)
+ types = TREE_CHAIN (types);
+
+ pp_cxx_left_paren (pp);
+ for (; args; args = TREE_CHAIN (args), types = TREE_CHAIN (types))
+ {
+ if (!first)
+ pp_separate_with (pp, ',');
+ first = false;
+ pp_cxx_parameter_declaration (pp, abstract ? TREE_VALUE (types) : args);
+ if (!abstract && pp_c_base (pp)->flags & pp_cxx_flag_default_argument)
+ {
+ pp_cxx_whitespace (pp);
+ pp_equal (pp);
+ pp_cxx_whitespace (pp);
+ pp_cxx_assignment_expression (pp, TREE_PURPOSE (types));
+ }
+ }
+ pp_cxx_right_paren (pp);
+}
+
+/* exception-specification:
+ throw ( type-id-list(opt) )
+
+ type-id-list
+ type-id
+ type-id-list , type-id */
+static void
+pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t)
+{
+ tree ex_spec = TYPE_RAISES_EXCEPTIONS (t);
+
+ if (!TYPE_NOTHROW_P (t) && ex_spec == NULL)
+ return;
+ pp_cxx_identifier (pp, "throw");
+ pp_cxx_left_paren (pp);
+ for (; ex_spec && TREE_VALUE (ex_spec); ex_spec = TREE_CHAIN (ex_spec))
+ {
+ pp_cxx_type_id (pp, TREE_VALUE (ex_spec));
+ if (TREE_CHAIN (ex_spec))
+ pp_separate_with (pp, ',');
+ }
+ pp_cxx_right_paren (pp);
+}
+
+/* direct-declarator:
+ declarator-id
+ direct-declarator ( parameter-declaration-clause ) cv-qualifier-seq(opt)
+ exception-specification(opt)
+ direct-declaration [ constant-expression(opt) ]
+ ( declarator ) */
+static void
+pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case VAR_DECL:
+ case PARM_DECL:
+ case CONST_DECL:
+ case FIELD_DECL:
+ if (DECL_NAME (t))
+ {
+ pp_cxx_space_for_pointer_operator (pp, TREE_TYPE (t));
+ pp_cxx_id_expression (pp, DECL_NAME (t));
+ }
+ pp_cxx_abstract_declarator (pp, TREE_TYPE (t));
+ break;
+
+ case FUNCTION_DECL:
+ pp_cxx_space_for_pointer_operator (pp, TREE_TYPE (TREE_TYPE (t)));
+ pp_cxx_id_expression (pp, t);
+ pp_cxx_parameter_declaration_clause (pp, t);
+
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
+ {
+ pp_base (pp)->padding = pp_before;
+ pp_cxx_cv_qualifier_seq (pp, pp_cxx_implicit_parameter_type (t));
+ }
+
+ pp_cxx_exception_specification (pp, TREE_TYPE (t));
+ break;
+
+ case TYPENAME_TYPE:
+ case TEMPLATE_DECL:
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_PARM_INDEX:
+ break;
+
+ default:
+ pp_c_direct_declarator (pp_c_base (pp), t);
+ break;
+ }
+}
+
+/* declarator:
+ direct-declarator
+ ptr-operator declarator */
+static void
+pp_cxx_declarator (cxx_pretty_printer *pp, tree t)
+{
+ pp_cxx_direct_declarator (pp, t);
+}
+
+/* ctor-initializer:
+ : mem-initializer-list
+
+ mem-initializer-list:
+ mem-initializer
+ mem-initializer , mem-initializer-list
+
+ mem-initializer:
+ mem-initializer-id ( expression-list(opt) )
+
+ mem-initializer-id:
+ ::(opt) nested-name-specifier(opt) class-name
+ identifier */
+static void
+pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t)
+{
+ t = TREE_OPERAND (t, 0);
+ pp_cxx_whitespace (pp);
+ pp_colon (pp);
+ pp_cxx_whitespace (pp);
+ for (; t; t = TREE_CHAIN (t))
+ {
+ pp_cxx_primary_expression (pp, TREE_PURPOSE (t));
+ pp_cxx_call_argument_list (pp, TREE_VALUE (t));
+ if (TREE_CHAIN (t))
+ pp_separate_with (pp, ',');
+ }
+}
+
+/* function-definition:
+ decl-specifier-seq(opt) declarator ctor-initializer(opt) function-body
+ decl-specifier-seq(opt) declarator function-try-block */
+
+void
+pp_cxx_function_definition (cxx_pretty_printer *pp, tree t)
+{
+ tree saved_scope = pp->enclosing_scope;
+ pp_cxx_decl_specifier_seq (pp, t);
+ pp_cxx_declarator (pp, t);
+ pp_needs_newline (pp) = true;
+ pp->enclosing_scope = DECL_CONTEXT (t);
+ if (DECL_SAVED_TREE (t))
+ {
+ tree body = DECL_SAVED_TREE (t);
+ if (TREE_CODE (body) == COMPOUND_STMT
+ && TREE_CODE (COMPOUND_BODY (body)) == CTOR_INITIALIZER)
+ {
+ body = COMPOUND_BODY (body);
+ pp_cxx_ctor_initializer (pp, body);
+ body = TREE_CHAIN (body);
+ }
+ pp_cxx_statement (pp, body);
+ }
+ else
+ {
+ pp_cxx_semicolon (pp);
+ pp_needs_newline (pp) = true;
+ }
+ pp_flush (pp);
+ pp->enclosing_scope = saved_scope;
+}
+
+/* abstract-declarator:
+ ptr-operator abstract-declarator(opt)
+ direct-abstract-declarator */
+static void
+pp_cxx_abstract_declarator (cxx_pretty_printer *pp, tree t)
+{
+ if (TYPE_PTRMEM_P (t) || TYPE_PTRMEMFUNC_P (t))
+ pp_cxx_right_paren (pp);
+ else if (POINTER_TYPE_P (t))
+ {
+ if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
+ || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
+ pp_cxx_right_paren (pp);
+ t = TREE_TYPE (t);
+ }
+ pp_cxx_direct_abstract_declarator (pp, t);
+}
+
+/* direct-abstract-declarator:
+ direct-abstract-declarator(opt) ( parameter-declaration-clause )
+ cv-qualifier-seq(opt) exception-specification(opt)
+ direct-abstract-declarator(opt) [ constant-expression(opt) ]
+ ( abstract-declarator ) */
+static void
+pp_cxx_direct_abstract_declarator (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case REFERENCE_TYPE:
+ pp_cxx_abstract_declarator (pp, t);
+ break;
+
+ case RECORD_TYPE:
+ if (TYPE_PTRMEMFUNC_P (t))
+ pp_cxx_direct_abstract_declarator (pp, TYPE_PTRMEMFUNC_FN_TYPE (t));
+ break;
+
+ case METHOD_TYPE:
+ case FUNCTION_TYPE:
+ pp_cxx_parameter_declaration_clause (pp, t);
+ pp_cxx_direct_abstract_declarator (pp, TREE_TYPE (t));
+ if (TREE_CODE (t) == METHOD_TYPE)
+ {
+ pp_base (pp)->padding = pp_before;
+ pp_cxx_cv_qualifier_seq
+ (pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))));
+ }
+ pp_cxx_exception_specification (pp, t);
+ break;
+
+ case TYPENAME_TYPE:
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ case UNBOUND_CLASS_TEMPLATE:
+ break;
+
+ default:
+ pp_c_direct_abstract_declarator (pp_c_base (pp), t);
+ break;
+ }
+}
+
+/* type-id:
+ type-specifier-seq abstract-declarator(opt) */
+static void
+pp_cxx_type_id (cxx_pretty_printer *pp, tree t)
+{
+ pp_flags saved_flags = pp_c_base (pp)->flags;
+ pp_c_base (pp)->flags |= pp_c_flag_abstract;
+
+ switch (TREE_CODE (t))
+ {
+ case TYPE_DECL:
+ case UNION_TYPE:
+ case RECORD_TYPE:
+ case ENUMERAL_TYPE:
+ case TYPENAME_TYPE:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ case UNBOUND_CLASS_TEMPLATE:
+ case TEMPLATE_TEMPLATE_PARM:
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_PARM_INDEX:
+ case TEMPLATE_DECL:
+ case TYPEOF_TYPE:
+ case TEMPLATE_ID_EXPR:
+ /* FIXME: Should be pp_cxx_type_specifier_seq. */
+ pp_cxx_type_specifier_seq (pp, t);
+ pp_cxx_declarator (pp, t);
+ break;
+
+ default:
+ pp_c_type_id (pp_c_base (pp), t);
+ break;
+ }
+
+ pp_c_base (pp)->flags = saved_flags;
+}
+
+/* template-argument-list:
+ template-argument
+ template-argument-list, template-argument
+
+ template-argument:
+ assignment-expression
+ type-id
+ template-name */
+static void
+pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t)
+{
+ int i;
+ if (t == NULL)
+ return;
+ for (i = 0; i < TREE_VEC_LENGTH (t); ++i)
+ {
+ tree arg = TREE_VEC_ELT (t, i);
+ if (i != 0)
+ pp_separate_with (pp, ',');
+ if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL
+ && TYPE_P (DECL_TEMPLATE_RESULT (arg))))
+ pp_cxx_type_id (pp, arg);
+ else
+ pp_cxx_expression (pp, arg);
+ }
+}
+
+
+static void
+pp_cxx_exception_declaration (cxx_pretty_printer *pp, tree t)
+{
+ t = DECL_STMT_DECL (t);
+ pp_cxx_type_specifier_seq (pp, t);
+ if (TYPE_P (t))
+ pp_cxx_abstract_declarator (pp, t);
+ else
+ pp_cxx_declarator (pp, t);
+}
+
+/* Statements. */
+
+void
+pp_cxx_statement (cxx_pretty_printer *pp, tree t)
+{
+ switch (TREE_CODE (t))
+ {
+ case USING_STMT:
+ pp_cxx_identifier (pp, "using");
+ pp_cxx_identifier (pp, "namespace");
+ pp_cxx_qualified_id (pp, USING_STMT_NAMESPACE (t));
+ break;
+
+ case USING_DECL:
+ pp_cxx_identifier (pp, "using");
+ pp_cxx_nested_name_specifier (pp, DECL_INITIAL (t));
+ pp_cxx_unqualified_id (pp, DECL_NAME (t));
+ break;
+
+ case EH_SPEC_BLOCK:
+ break;
+
+ /* try-block:
+ try compound-statement handler-seq */
+ case TRY_BLOCK:
+ pp_maybe_newline_and_indent (pp, 0);
+ pp_cxx_identifier (pp, "try");
+ pp_newline_and_indent (pp, 3);
+ pp_cxx_statement (pp, TRY_STMTS (t));
+ pp_newline_and_indent (pp, -3);
+ if (CLEANUP_P (t))
+ ;
+ else
+ pp_cxx_statement (pp, TRY_HANDLERS (t));
+ break;
+
+ /*
+ handler-seq:
+ handler handler-seq(opt)
+
+ handler:
+ catch ( exception-declaration ) compound-statement
+
+ exception-declaration:
+ type-specifier-seq declarator
+ type-specifier-seq abstract-declarator
+ ... */
+ case HANDLER:
+ pp_cxx_identifier (pp, "catch");
+ pp_cxx_left_paren (pp);
+ pp_cxx_exception_declaration (pp, HANDLER_PARMS (t));
+ pp_cxx_right_paren (pp);
+ pp_indentation (pp) += 3;
+ pp_needs_newline (pp) = true;
+ pp_cxx_statement (pp, HANDLER_BODY (t));
+ pp_indentation (pp) -= 3;
+ pp_needs_newline (pp) = true;
+ break;
+
+ default:
+ pp_c_statement (pp_c_base (pp), t);
+ break;
+ }
+}
+
+/* original-namespace-definition:
+ namespace identifier { namespace-body }
+
+ As an edge case, we also handle unnamed namespace definition here. */
+
+static void
+pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t)
+{
+ pp_cxx_identifier (pp, "namespace");
+ if (DECL_NAME (t))
+ pp_cxx_unqualified_id (pp, t);
+ pp_cxx_whitespace (pp);
+ pp_cxx_left_brace (pp);
+ /* We do not print the namespace-body. */
+ pp_cxx_whitespace (pp);
+ pp_cxx_right_brace (pp);
+}
+
+/* namespace-alias:
+ identifier
+
+ namespace-alias-definition:
+ namespace identifier = qualified-namespace-specifier ;
+
+ qualified-namespace-specifier:
+ ::(opt) nested-name-specifier(opt) namespace-name */
+
+static void
+pp_cxx_namespace_alias_definition (cxx_pretty_printer *pp, tree t)
+{
+ pp_cxx_identifier (pp, "namespace");
+ pp_cxx_unqualified_id (pp, t);
+ pp_cxx_whitespace (pp);
+ pp_equal (pp);
+ pp_cxx_whitespace (pp);
+ pp_cxx_qualified_id (pp, DECL_NAMESPACE_ALIAS (t));
+ pp_cxx_semicolon (pp);
+}
+
+/* simple-declaration:
+ decl-specifier-seq(opt) init-declarator-list(opt) */
+static void
+pp_cxx_simple_declaration (cxx_pretty_printer *pp, tree t)
+{
+ pp_cxx_decl_specifier_seq (pp, t);
+ pp_cxx_init_declarator (pp, t);
+ pp_cxx_semicolon (pp);
+ pp_needs_newline (pp) = true;
+}
+
+/*
+ template-parameter-list:
+ template-parameter
+ template-parameter-list , template-parameter */
+
+static inline void
+pp_cxx_template_parameter_list (cxx_pretty_printer *pp, tree t)
+{
+ const int n = TREE_VEC_LENGTH (t);
+ int i;
+ for (i = 0; i < n; ++i)
+ {
+ if (i)
+ pp_separate_with (pp, ',');
+ pp_cxx_template_parameter (pp, TREE_VEC_ELT (t, i));
+ }
+}
+
+/* template-parameter:
+ type-parameter
+ parameter-declaration
+
+ type-parameter:
+ class identifier(opt)
+ class identifier(op) = type-id
+ typename identifier(opt)
+ typename identifier(opt) = type-id
+ template < template-parameter-list > class identifier(opt)
+ template < template-parameter-list > class identifier(opt) = template-name
+*/
+static void
+pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t)
+{
+ tree parameter = TREE_VALUE (t);
+ switch (TREE_CODE (parameter))
+ {
+ case TYPE_DECL:
+ pp_cxx_identifier (pp, "class");
+ if (DECL_NAME (parameter))
+ pp_cxx_tree_identifier (pp, DECL_NAME (parameter));
+ /* FIXME: Chech if we should print also default argument. */
+ break;
+
+ case PARM_DECL:
+ pp_cxx_parameter_declaration (pp, parameter);
+ break;
+
+ case TEMPLATE_DECL:
+ break;
+
+ default:
+ pp_unsupported_tree (pp, t);
+ break;
+ }
+}
+
+/* Pretty-print a template parameter in the canonical form
+ "template-parameter-<level>-<position in parameter list>". */
+
+void
+pp_cxx_canonical_template_parameter (cxx_pretty_printer *pp, tree parm)
+{
+ const enum tree_code code = TREE_CODE (parm);
+
+ /* Brings type template parameters to the canonical forms. */
+ if (code == TEMPLATE_TYPE_PARM || code == TEMPLATE_TEMPLATE_PARM
+ || code == BOUND_TEMPLATE_TEMPLATE_PARM)
+ parm = TEMPLATE_TYPE_PARM_INDEX (parm);
+
+ pp_cxx_begin_template_argument_list (pp);
+ pp_cxx_identifier (pp, "template-parameter-");
+ pp_wide_integer (pp, TEMPLATE_PARM_LEVEL (parm));
+ pp_minus (pp);
+ pp_wide_integer (pp, TEMPLATE_PARM_IDX (parm) + 1);
+ pp_cxx_end_template_argument_list (pp);
+}
+
+/*
+ template-declaration:
+ export(opt) template < template-parameter-list > declaration */
+static void
+pp_cxx_template_declaration (cxx_pretty_printer *pp, tree t)
+{
+ tree tmpl = most_general_template (t);
+ tree level;
+ int i = 0;
+
+ pp_maybe_newline_and_indent (pp, 0);
+ for (level = DECL_TEMPLATE_PARMS (tmpl); level; level = TREE_CHAIN (level))
+ {
+ pp_cxx_identifier (pp, "template");
+ pp_cxx_begin_template_argument_list (pp);
+ pp_cxx_template_parameter_list (pp, TREE_VALUE (level));
+ pp_cxx_end_template_argument_list (pp);
+ pp_newline_and_indent (pp, 3);
+ i += 3;
+ }
+ if (TREE_CODE (t) == FUNCTION_DECL && DECL_SAVED_TREE (t))
+ pp_cxx_function_definition (pp, t);
+ else
+ pp_cxx_simple_declaration (pp, t);
+}
+
+static void
+pp_cxx_explicit_specialization (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_explicit_instantiation (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+/*
+ declaration:
+ block-declaration
+ function-definition
+ template-declaration
+ explicit-instantiation
+ explicit-specialization
+ linkage-specification
+ namespace-definition
+
+ block-declaration:
+ simple-declaration
+ asm-definition
+ namespace-alias-definition
+ using-declaration
+ using-directive */
+void
+pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
+{
+ if (!DECL_LANG_SPECIFIC (t))
+ pp_cxx_simple_declaration (pp, t);
+ else if (DECL_USE_TEMPLATE (t))
+ switch (DECL_USE_TEMPLATE (t))
+ {
+ case 1:
+ pp_cxx_template_declaration (pp, t);
+ break;
+
+ case 2:
+ pp_cxx_explicit_specialization (pp, t);
+ break;
+
+ case 3:
+ pp_cxx_explicit_instantiation (pp, t);
+ break;
+
+ default:
+ break;
+ }
+ else switch (TREE_CODE (t))
+ {
+ case VAR_DECL:
+ case TYPE_DECL:
+ pp_cxx_simple_declaration (pp, t);
+ break;
+
+ case FUNCTION_DECL:
+ if (DECL_SAVED_TREE (t))
+ pp_cxx_function_definition (pp, t);
+ else
+ pp_cxx_simple_declaration (pp, t);
+ break;
+
+ case NAMESPACE_DECL:
+ if (DECL_NAMESPACE_ALIAS (t))
+ pp_cxx_namespace_alias_definition (pp, t);
+ else
+ pp_cxx_original_namespace_definition (pp, t);
+ break;
+
+ default:
+ pp_unsupported_tree (pp, t);
+ break;
+ }
+}
+
+
+typedef c_pretty_print_fn pp_fun;
+
+void
+pp_cxx_pretty_printer_init (cxx_pretty_printer *pp)
+{
+ pp_c_pretty_printer_init (pp_c_base (pp));
+ pp_set_line_maximum_length (pp, 0);
+
+ pp->c_base.declaration = (pp_fun) pp_cxx_declaration;
+ pp->c_base.declaration_specifiers = (pp_fun) pp_cxx_decl_specifier_seq;
+ pp->c_base.function_specifier = (pp_fun) pp_cxx_function_specifier;
+ pp->c_base.type_specifier_seq = (pp_fun) pp_cxx_type_specifier_seq;
+ pp->c_base.declarator = (pp_fun) pp_cxx_declarator;
+ pp->c_base.direct_declarator = (pp_fun) pp_cxx_direct_declarator;
+ pp->c_base.parameter_list = (pp_fun) pp_cxx_parameter_declaration_clause;
+ pp->c_base.type_id = (pp_fun) pp_cxx_type_id;
+ pp->c_base.abstract_declarator = (pp_fun) pp_cxx_abstract_declarator;
+ pp->c_base.direct_abstract_declarator =
+ (pp_fun) pp_cxx_direct_abstract_declarator;
+ pp->c_base.simple_type_specifier = (pp_fun)pp_cxx_simple_type_specifier;
+
+ /* pp->c_base.statement = (pp_fun) pp_cxx_statement; */
+
+ pp->c_base.id_expression = (pp_fun) pp_cxx_id_expression;
+ pp->c_base.primary_expression = (pp_fun) pp_cxx_primary_expression;
+ pp->c_base.postfix_expression = (pp_fun) pp_cxx_postfix_expression;
+ pp->c_base.unary_expression = (pp_fun) pp_cxx_unary_expression;
+ pp->c_base.multiplicative_expression = (pp_fun) pp_cxx_multiplicative_expression;
+ pp->c_base.conditional_expression = (pp_fun) pp_cxx_conditional_expression;
+ pp->c_base.assignment_expression = (pp_fun) pp_cxx_assignment_expression;
+ pp->c_base.expression = (pp_fun) pp_cxx_expression;
+ pp->enclosing_scope = global_namespace;
+}
diff --git a/contrib/gcc/cp/cxx-pretty-print.h b/contrib/gcc/cp/cxx-pretty-print.h
new file mode 100644
index 0000000..b47eff0
--- /dev/null
+++ b/contrib/gcc/cp/cxx-pretty-print.h
@@ -0,0 +1,52 @@
+/* Interface for the GNU C++ pretty-printer.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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 GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#ifndef GCC_CXX_PRETTY_PRINT_H
+#define GCC_CXX_PRETTY_PRINT_H
+
+#include "c-pretty-print.h"
+
+#undef pp_c_base
+#define pp_c_base(PP) (&(PP)->c_base)
+
+typedef enum
+{
+ /* Ask for an qualified-id. */
+ pp_cxx_flag_default_argument = 1 << pp_c_flag_last_bit
+
+} cxx_pretty_printer_flags;
+
+typedef struct
+{
+ c_pretty_printer c_base;
+ /* This is the enclosing scope of the entity being pretty-printed. */
+ tree enclosing_scope;
+} cxx_pretty_printer;
+
+void pp_cxx_pretty_printer_init (cxx_pretty_printer *);
+
+void pp_cxx_declaration (cxx_pretty_printer *, tree);
+void pp_cxx_function_definition (cxx_pretty_printer *, tree);
+void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree);
+void pp_cxx_statement (cxx_pretty_printer *, tree);
+
+
+#endif /* GCC_CXX_PRETTY_PRINT_H */
diff --git a/contrib/gcc/cp/decl.h b/contrib/gcc/cp/decl.h
index 2b917a4..46a1ec8 100644
--- a/contrib/gcc/cp/decl.h
+++ b/contrib/gcc/cp/decl.h
@@ -1,20 +1,20 @@
/* Variables and structures for declaration processing.
Copyright (C) 1993, 2000, 2002 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -31,12 +31,7 @@ enum decl_context
};
/* We need this in here to get the decl_context definition. */
-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. */
-extern GTY(()) tree last_function_parms;
+extern tree grokdeclarator (tree, tree, enum decl_context, int, tree*);
#ifdef DEBUG_CP_BINDING_LEVELS
/* Purely for debugging purposes. */
diff --git a/contrib/gcc/cp/decl2.c b/contrib/gcc/cp/decl2.c
index 5561370..4e8c2f8 100644
--- a/contrib/gcc/cp/decl2.c
+++ b/contrib/gcc/cp/decl2.c
@@ -1,27 +1,27 @@
-/* Process declarations and variables for C compiler.
+/* Process declarations and variables for C++ compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* Process declarations and symbol lookup for C front end.
+/* Process declarations and symbol lookup for C++ front end.
Also constructs types; the standard scalar types at initialization,
and structure, union, array and enum types when they are declared. */
@@ -30,6 +30,8 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "rtl.h"
#include "expr.h"
@@ -40,12 +42,12 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "except.h"
#include "toplev.h"
-#include "ggc.h"
#include "timevar.h"
#include "cpplib.h"
#include "target.h"
#include "c-common.h"
-#include "timevar.h"
+#include "cgraph.h"
+#include "tree-inline.h"
extern cpp_reader *parse_in;
/* This structure contains information about the initializations
@@ -59,35 +61,27 @@ typedef struct priority_info_s {
int destructions_p;
} *priority_info;
-static void mark_vtable_entries PARAMS ((tree));
-static void grok_function_init PARAMS ((tree, tree));
-static int maybe_emit_vtables (tree);
-static void add_using_namespace PARAMS ((tree, tree, int));
-static cxx_binding *ambiguous_decl (tree, cxx_binding *, cxx_binding *,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 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
- 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 get_guard_bits PARAMS ((tree));
+static void mark_vtable_entries (tree);
+static void grok_function_init (tree, tree);
+static bool maybe_emit_vtables (tree);
+static tree build_anon_union_vars (tree);
+static bool acceptable_java_type (tree);
+static tree start_objects (int, int);
+static void finish_objects (int, int, tree);
+static tree start_static_storage_duration_function (unsigned);
+static void finish_static_storage_duration_function (tree);
+static priority_info get_priority_info (int);
+static void do_static_initialization (tree, tree);
+static void do_static_destruction (tree);
+static tree start_static_initialization_or_destruction (tree, int);
+static void finish_static_initialization_or_destruction (tree);
+static void generate_ctor_or_dtor_function (bool, int, location_t *);
+static int generate_ctor_and_dtor_functions_for_priority (splay_tree_node,
+ void *);
+static tree prune_vars_needing_no_initialization (tree *);
+static void write_out_vars (tree);
+static void import_export_class (tree);
+static tree get_guard_bits (tree);
/* A list of static class variables. This is needed, because a
static class variable can be declared inside the class without
@@ -115,9 +109,6 @@ int at_eof;
tree static_ctors;
tree static_dtors;
-/* The :: namespace. */
-
-tree global_namespace;
/* Incorporate `const' and `volatile' qualifiers for member functions.
FUNCTION is a TYPE_DECL or a FUNCTION_DECL.
@@ -126,8 +117,7 @@ tree global_namespace;
TYPE_UNQUALIFIED will be an extension. */
int
-grok_method_quals (ctype, function, quals)
- tree ctype, function, quals;
+grok_method_quals (tree ctype, tree function, tree quals)
{
tree fntype = TREE_TYPE (function);
tree raises = TYPE_RAISES_EXCEPTIONS (fntype);
@@ -155,10 +145,10 @@ grok_method_quals (ctype, function, quals)
? "member function" : "type");
ctype = cp_build_qualified_type (ctype, type_quals);
- fntype = build_cplus_method_type (ctype, TREE_TYPE (fntype),
- (TREE_CODE (fntype) == METHOD_TYPE
- ? TREE_CHAIN (TYPE_ARG_TYPES (fntype))
- : TYPE_ARG_TYPES (fntype)));
+ fntype = build_method_type_directly (ctype, TREE_TYPE (fntype),
+ (TREE_CODE (fntype) == METHOD_TYPE
+ ? TREE_CHAIN (TYPE_ARG_TYPES (fntype))
+ : TYPE_ARG_TYPES (fntype)));
if (raises)
fntype = build_exception_variant (fntype, raises);
@@ -166,44 +156,10 @@ grok_method_quals (ctype, function, quals)
return this_quals;
}
-/* Warn when -fexternal-templates is used and #pragma
- interface/implementation is not used all the times it should be,
- inform the user. */
-
-void
-warn_if_unknown_interface (decl)
- tree decl;
-{
- static int already_warned = 0;
- if (already_warned++)
- return;
-
- if (flag_alt_external_templates)
- {
- tree til = tinst_for_decl ();
- int sl = lineno;
- const char *sf = input_filename;
-
- if (til)
- {
- lineno = TINST_LINE (til);
- input_filename = TINST_FILE (til);
- }
- warning ("template `%#D' instantiated in file without #pragma interface",
- decl);
- lineno = sl;
- input_filename = sf;
- }
- else
- cp_warning_at ("template `%#D' defined in file without #pragma interface",
- decl);
-}
-
/* A subroutine of the parser, to handle a component list. */
void
-grok_x_components (specs)
- tree specs;
+grok_x_components (tree specs)
{
tree t;
@@ -225,12 +181,13 @@ grok_x_components (specs)
appropriately. */
tree
-cp_build_parm_decl (name, type)
- tree name;
- tree type;
+cp_build_parm_decl (tree name, tree type)
{
tree parm = build_decl (PARM_DECL, name, type);
- DECL_ARG_TYPE (parm) = type_passed_as (type);
+ /* DECL_ARG_TYPE is only used by the back end and the back end never
+ sees templates. */
+ if (!processing_template_decl)
+ DECL_ARG_TYPE (parm) = type_passed_as (type);
return parm;
}
@@ -238,9 +195,7 @@ cp_build_parm_decl (name, type)
indicated NAME. */
tree
-build_artificial_parm (name, type)
- tree name;
- tree type;
+build_artificial_parm (tree name, tree type)
{
tree parm = cp_build_parm_decl (name, type);
DECL_ARTIFICIAL (parm) = 1;
@@ -264,8 +219,7 @@ build_artificial_parm (name, type)
VTT parm (if any), then the user-written parms. */
void
-maybe_retrofit_in_chrg (fn)
- tree fn;
+maybe_retrofit_in_chrg (tree fn)
{
tree basetype, arg_types, parms, parm, fntype;
@@ -275,7 +229,7 @@ maybe_retrofit_in_chrg (fn)
/* When processing templates we can't know, in general, whether or
not we're going to have virtual baseclasses. */
- if (uses_template_parms (fn))
+ if (processing_template_decl)
return;
/* We don't need an in-charge parameter for constructors that don't
@@ -316,8 +270,8 @@ maybe_retrofit_in_chrg (fn)
TREE_CHAIN (DECL_ARGUMENTS (fn)) = parms;
/* And rebuild the function type. */
- fntype = build_cplus_method_type (basetype, TREE_TYPE (TREE_TYPE (fn)),
- arg_types);
+ fntype = build_method_type_directly (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)));
@@ -348,10 +302,7 @@ maybe_retrofit_in_chrg (fn)
QUALS are the qualifiers for the this pointer. */
void
-grokclassfn (ctype, function, flags, quals)
- tree ctype, function;
- enum overload_flags flags;
- tree quals;
+grokclassfn (tree ctype, tree function, enum overload_flags flags, tree quals)
{
tree fn_name = DECL_NAME (function);
int this_quals = TYPE_UNQUALIFIED;
@@ -385,11 +336,10 @@ grokclassfn (ctype, function, flags, quals)
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;
+ TREE_CHAIN (parm) = DECL_ARGUMENTS (function);
+ DECL_ARGUMENTS (function) = parm;
}
- DECL_ARGUMENTS (function) = last_function_parms;
DECL_CONTEXT (function) = ctype;
if (flags == DTOR_FLAG)
@@ -397,101 +347,99 @@ grokclassfn (ctype, function, flags, quals)
if (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function))
maybe_retrofit_in_chrg (function);
-
- if (flags == DTOR_FLAG)
- {
- DECL_DESTRUCTOR_P (function) = 1;
- TYPE_HAS_DESTRUCTOR (ctype) = 1;
- }
}
/* Create an ARRAY_REF, checking for the user doing things backwards
along the way. */
tree
-grok_array_decl (array_expr, index_exp)
- tree array_expr, index_exp;
+grok_array_decl (tree array_expr, tree index_exp)
{
- tree type = TREE_TYPE (array_expr);
- tree p1, p2, i1, i2;
+ tree type;
+ tree expr;
+ tree orig_array_expr = array_expr;
+ tree orig_index_exp = index_exp;
- if (type == error_mark_node || index_exp == error_mark_node)
+ if (error_operand_p (array_expr) || error_operand_p (index_exp))
return error_mark_node;
- if (processing_template_decl)
- return build_min (ARRAY_REF, type ? TREE_TYPE (type) : NULL_TREE,
- array_expr, index_exp);
- if (type == NULL_TREE)
+ if (processing_template_decl)
{
- /* Something has gone very wrong. Assume we are mistakenly reducing
- an expression instead of a declaration. */
- error ("parser may be lost: is there a '{' missing somewhere?");
- return NULL_TREE;
+ if (type_dependent_expression_p (array_expr)
+ || type_dependent_expression_p (index_exp))
+ return build_min_nt (ARRAY_REF, array_expr, index_exp);
+ array_expr = build_non_dependent_expr (array_expr);
+ index_exp = build_non_dependent_expr (index_exp);
}
- if (TREE_CODE (type) == OFFSET_TYPE
- || TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
+ type = TREE_TYPE (array_expr);
+ my_friendly_assert (type, 20030626);
+ type = non_reference (type);
/* If they have an `operator[]', use that. */
if (IS_AGGR_TYPE (type) || IS_AGGR_TYPE (TREE_TYPE (index_exp)))
- return build_opfncall (ARRAY_REF, LOOKUP_NORMAL,
- array_expr, index_exp, NULL_TREE);
-
- /* Otherwise, create an ARRAY_REF for a pointer or array type. It
- is a little-known fact that, if `a' is an array and `i' is an
- int, you can write `i[a]', which means the same thing as `a[i]'. */
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- p1 = array_expr;
+ expr = build_new_op (ARRAY_REF, LOOKUP_NORMAL,
+ array_expr, index_exp, NULL_TREE,
+ /*overloaded_p=*/NULL);
else
- p1 = build_expr_type_conversion (WANT_POINTER, array_expr, 0);
+ {
+ tree p1, p2, i1, i2;
- if (TREE_CODE (TREE_TYPE (index_exp)) == ARRAY_TYPE)
- p2 = index_exp;
- else
- p2 = build_expr_type_conversion (WANT_POINTER, index_exp, 0);
+ /* Otherwise, create an ARRAY_REF for a pointer or array type.
+ It is a little-known fact that, if `a' is an array and `i' is
+ an int, you can write `i[a]', which means the same thing as
+ `a[i]'. */
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ p1 = array_expr;
+ else
+ p1 = build_expr_type_conversion (WANT_POINTER, array_expr, false);
- i1 = build_expr_type_conversion (WANT_INT | WANT_ENUM, array_expr, 0);
- i2 = build_expr_type_conversion (WANT_INT | WANT_ENUM, index_exp, 0);
+ if (TREE_CODE (TREE_TYPE (index_exp)) == ARRAY_TYPE)
+ p2 = index_exp;
+ else
+ p2 = build_expr_type_conversion (WANT_POINTER, index_exp, false);
- if ((p1 && i2) && (i1 && p2))
- error ("ambiguous conversion for array subscript");
+ i1 = build_expr_type_conversion (WANT_INT | WANT_ENUM, array_expr,
+ false);
+ i2 = build_expr_type_conversion (WANT_INT | WANT_ENUM, index_exp,
+ false);
- if (p1 && i2)
- array_expr = p1, index_exp = i2;
- else if (i1 && p2)
- array_expr = p2, index_exp = i1;
- else
- {
- error ("invalid types `%T[%T]' for array subscript",
- type, TREE_TYPE (index_exp));
- return error_mark_node;
- }
+ if ((p1 && i2) && (i1 && p2))
+ error ("ambiguous conversion for array subscript");
+
+ if (p1 && i2)
+ array_expr = p1, index_exp = i2;
+ else if (i1 && p2)
+ array_expr = p2, index_exp = i1;
+ else
+ {
+ error ("invalid types `%T[%T]' for array subscript",
+ type, TREE_TYPE (index_exp));
+ return error_mark_node;
+ }
- if (array_expr == error_mark_node || index_exp == error_mark_node)
- error ("ambiguous conversion for array subscript");
+ if (array_expr == error_mark_node || index_exp == error_mark_node)
+ error ("ambiguous conversion for array subscript");
- return build_array_ref (array_expr, index_exp);
+ expr = build_array_ref (array_expr, index_exp);
+ }
+ if (processing_template_decl && expr != error_mark_node)
+ return build_min_non_dep (ARRAY_REF, expr,
+ orig_array_expr, orig_index_exp);
+ return expr;
}
/* Given the cast expression EXP, checking out its validity. Either return
an error_mark_node if there was an unavoidable error, return a cast to
void for trying to delete a pointer w/ the value 0, or return the
- call to delete. If DOING_VEC is 1, we handle things differently
- for doing an array delete. If DOING_VEC is 2, they gave us the
- array size as an argument to delete.
+ call to delete. If DOING_VEC is true, we handle things differently
+ for doing an array delete.
Implements ARM $5.3.4. This is called from the parser. */
tree
-delete_sanity (exp, size, doing_vec, use_global_delete)
- tree exp, size;
- int doing_vec, use_global_delete;
+delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete)
{
tree t, type;
- /* For a regular vector delete (aka, no size argument) we will pass
- this down as a NULL_TREE into build_vec_delete. */
- tree maxindex = NULL_TREE;
if (exp == error_mark_node)
return exp;
@@ -501,14 +449,18 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
t = build_min (DELETE_EXPR, void_type_node, exp, size);
DELETE_EXPR_USE_GLOBAL (t) = use_global_delete;
DELETE_EXPR_USE_VEC (t) = doing_vec;
+ TREE_SIDE_EFFECTS (t) = 1;
return t;
}
- if (TREE_CODE (exp) == OFFSET_REF)
- exp = resolve_offset_ref (exp);
exp = convert_from_reference (exp);
- t = stabilize_reference (exp);
- t = build_expr_type_conversion (WANT_POINTER, t, 1);
+
+ /* An array can't have been allocated by new, so complain. */
+ if (TREE_CODE (exp) == VAR_DECL
+ && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
+ warning ("deleting array `%#D'", exp);
+
+ t = build_expr_type_conversion (WANT_POINTER, exp, true);
if (t == NULL_TREE || t == error_mark_node)
{
@@ -517,12 +469,6 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
return error_mark_node;
}
- if (doing_vec == 2)
- {
- maxindex = cp_build_binary_op (MINUS_EXPR, size, integer_one_node);
- pedwarn ("anachronistic use of array size in vector delete");
- }
-
type = TREE_TYPE (t);
/* As of Valley Forge, you can delete a pointer to const. */
@@ -541,18 +487,13 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
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)
- 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, sfk_deleting_destructor,
+ return build_vec_delete (t, /*maxindex=*/NULL_TREE,
+ sfk_deleting_destructor,
use_global_delete);
else
return build_delete (type, t, sfk_deleting_destructor,
@@ -563,8 +504,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
sort of thing that should be a member template. */
void
-check_member_template (tmpl)
- tree tmpl;
+check_member_template (tree tmpl)
{
tree decl;
@@ -603,9 +543,8 @@ check_member_template (tmpl)
/* Return true iff TYPE is a valid Java parameter or return type. */
-static int
-acceptable_java_type (type)
- tree type;
+static bool
+acceptable_java_type (tree type)
{
if (TREE_CODE (type) == VOID_TYPE || TYPE_FOR_JAVA (type))
return 1;
@@ -616,9 +555,9 @@ acceptable_java_type (type)
{
tree args; int i;
if (! TYPE_FOR_JAVA (type))
- return 0;
+ return false;
if (! CLASSTYPE_TEMPLATE_INFO (type))
- return 1;
+ return true;
args = CLASSTYPE_TI_ARGS (type);
i = TREE_VEC_LENGTH (args);
while (--i >= 0)
@@ -627,51 +566,59 @@ acceptable_java_type (type)
if (TREE_CODE (type) == POINTER_TYPE)
type = TREE_TYPE (type);
if (! TYPE_FOR_JAVA (type))
- return 0;
+ return false;
}
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
-/* For a METHOD in a Java class CTYPE, return 1 if
+/* For a METHOD in a Java class CTYPE, return true if
the parameter and return types are valid Java types.
- Otherwise, print appropriate error messages, and return 0. */
+ Otherwise, print appropriate error messages, and return false. */
-int
-check_java_method (method)
- tree method;
+bool
+check_java_method (tree method)
{
- int jerr = 0;
+ bool jerr = false;
tree arg_types = TYPE_ARG_TYPES (TREE_TYPE (method));
tree ret_type = TREE_TYPE (TREE_TYPE (method));
- if (! acceptable_java_type (ret_type))
+
+ if (!acceptable_java_type (ret_type))
{
error ("Java method '%D' has non-Java return type `%T'",
method, ret_type);
- jerr++;
+ jerr = true;
}
+
+ arg_types = TREE_CHAIN (arg_types);
+ if (DECL_HAS_IN_CHARGE_PARM_P (method))
+ arg_types = TREE_CHAIN (arg_types);
+ if (DECL_HAS_VTT_PARM_P (method))
+ arg_types = TREE_CHAIN (arg_types);
+
for (; arg_types != NULL_TREE; arg_types = TREE_CHAIN (arg_types))
{
tree type = TREE_VALUE (arg_types);
- if (! acceptable_java_type (type))
+ if (!acceptable_java_type (type))
{
error ("Java method '%D' has non-Java parameter type `%T'",
method, type);
- jerr++;
+ jerr = true;
}
}
- return jerr ? 0 : 1;
+ return !jerr;
}
/* Sanity check: report error if this function FUNCTION is not
really a member of the class (CTYPE) it is supposed to belong to.
- CNAME is the same here as it is for grokclassfn above. */
+ CNAME is the same here as it is for grokclassfn above.
+ TEMPLATE_HEADER_P is true when this declaration comes with a
+ template header. */
tree
-check_classfn (ctype, function)
- tree ctype, function;
+check_classfn (tree ctype, tree function, bool template_header_p)
{
int ix;
int is_template;
@@ -694,7 +641,7 @@ check_classfn (ctype, function)
/* OK, is this a definition of a member template? */
is_template = (TREE_CODE (function) == TEMPLATE_DECL
- || (processing_template_decl - template_class_depth (ctype)));
+ || template_header_p);
ix = lookup_fnfields_1 (complete_type (ctype),
DECL_CONSTRUCTOR_P (function) ? ctor_identifier :
@@ -706,8 +653,10 @@ check_classfn (ctype, function)
tree methods = CLASSTYPE_METHOD_VEC (ctype);
tree fndecls, fndecl = 0;
bool is_conv_op;
+ bool pop_p;
const char *format = NULL;
+ pop_p = push_scope (ctype);
for (fndecls = TREE_VEC_ELT (methods, ix);
fndecls; fndecls = OVL_NEXT (fndecls))
{
@@ -741,8 +690,12 @@ check_classfn (ctype, function)
&& (!DECL_TEMPLATE_SPECIALIZATION (function)
|| (DECL_TI_TEMPLATE (function)
== DECL_TI_TEMPLATE (fndecl))))
- return fndecl;
+ break;
}
+ if (pop_p)
+ pop_scope (ctype);
+ if (fndecls)
+ return OVL_CURRENT (fndecls);
error ("prototype for `%#D' does not match any in class `%T'",
function, ctype);
is_conv_op = DECL_CONV_FN_P (fndecl);
@@ -800,11 +753,8 @@ check_classfn (ctype, function)
FLAGS is as for cp_finish_decl. */
void
-finish_static_data_member_decl (decl, init, asmspec_tree, flags)
- tree decl;
- tree init;
- tree asmspec_tree;
- int flags;
+finish_static_data_member_decl (tree decl, tree init, tree asmspec_tree,
+ int flags)
{
my_friendly_assert (TREE_PUBLIC (decl), 0);
@@ -870,42 +820,13 @@ finish_static_data_member_decl (decl, init, asmspec_tree, flags)
CHANGES TO CODE IN `start_method'. */
tree
-grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
- tree declarator, declspecs, init, asmspec_tree, attrlist;
+grokfield (tree declarator, tree declspecs, tree init, tree asmspec_tree,
+ tree attrlist)
{
tree value;
const char *asmspec = 0;
int flags = LOOKUP_ONLYCONVERTING;
- /* Convert () initializers to = initializers. */
- if (init == NULL_TREE && declarator != NULL_TREE
- && TREE_CODE (declarator) == CALL_EXPR
- && TREE_OPERAND (declarator, 0)
- && (TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE
- || TREE_CODE (TREE_OPERAND (declarator, 0)) == SCOPE_REF)
- && parmlist_is_exprlist (CALL_DECLARATOR_PARMS (declarator)))
- {
- /* 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;
- }
-
if (declspecs == NULL_TREE
&& TREE_CODE (declarator) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (declarator, 1)) == IDENTIFIER_NODE)
@@ -925,10 +846,8 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
init = NULL_TREE;
value = grokdeclarator (declarator, declspecs, FIELD, init != 0, &attrlist);
- if (! value || value == error_mark_node)
+ if (! value || error_operand_p (value))
/* friend or constructor went bad. */
- return value;
- if (TREE_TYPE (value) == error_mark_node)
return error_mark_node;
if (TREE_CODE (value) == TYPE_DECL && init)
@@ -938,8 +857,14 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
}
/* Pass friendly classes back. */
- if (TREE_CODE (value) == VOID_TYPE)
- return void_type_node;
+ if (value == void_type_node)
+ return value;
+
+ /* Pass friend decls back. */
+ if ((TREE_CODE (value) == FUNCTION_DECL
+ || TREE_CODE (value) == TEMPLATE_DECL)
+ && DECL_CONTEXT (value) != current_class_type)
+ return value;
if (DECL_NAME (value) != NULL_TREE
&& IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
@@ -953,9 +878,6 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
DECL_NONLOCAL (value) = 1;
DECL_CONTEXT (value) = current_class_type;
- if (CLASS_TYPE_P (TREE_TYPE (value)))
- CLASSTYPE_GOT_SEMICOLON (TREE_TYPE (value)) = 1;
-
if (processing_template_decl)
value = push_template_decl (value);
@@ -1021,7 +943,11 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
if (processing_template_decl
&& (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == FUNCTION_DECL))
- value = push_template_decl (value);
+ {
+ value = push_template_decl (value);
+ if (error_operand_p (value))
+ return error_mark_node;
+ }
if (attrlist)
cplus_decl_attributes (&value, attrlist, 0);
@@ -1050,7 +976,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
/* This must override the asm specifier which was placed
by grokclassfn. Lay this out fresh. */
SET_DECL_RTL (value, NULL_RTX);
- SET_DECL_ASSEMBLER_NAME (value, get_identifier (asmspec));
+ change_decl_assembler_name (value, get_identifier (asmspec));
}
if (!DECL_FRIEND_P (value))
grok_special_member_properties (value);
@@ -1073,11 +999,9 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
WIDTH is non-NULL for bit fields only, and is an INTEGER_CST node. */
tree
-grokbitfield (declarator, declspecs, width)
- tree declarator, declspecs, width;
+grokbitfield (tree declarator, tree declspecs, tree width)
{
- register tree value = grokdeclarator (declarator, declspecs, BITFIELD,
- 0, NULL);
+ tree value = grokdeclarator (declarator, declspecs, BITFIELD, 0, NULL);
if (! value) return NULL_TREE; /* friends went bad. */
@@ -1127,32 +1051,6 @@ grokbitfield (declarator, declspecs, width)
return value;
}
-/* Convert a conversion operator name to an identifier. SCOPE is the
- scope of the conversion operator, if explicit. */
-
-tree
-grokoptypename (declspecs, declarator, scope)
- tree declspecs, declarator;
- tree scope;
-{
- tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, NULL);
-
- /* Resolve any TYPENAME_TYPEs that refer to SCOPE, before mangling
- the name, so that we mangle the right thing. */
- if (scope && current_template_parms
- && uses_template_parms (t)
- && uses_template_parms (scope))
- {
- tree args = current_template_args ();
-
- push_scope (scope);
- t = tsubst (t, args, tf_error | tf_warning, NULL_TREE);
- pop_scope (scope);
- }
-
- return mangle_conv_op_name_for_type (t);
-}
-
/* When a function is declared with an initializer,
do the right thing. Currently, there are two possibilities:
@@ -1189,9 +1087,7 @@ grokoptypename (declspecs, declarator, scope)
*/
static void
-grok_function_init (decl, init)
- tree decl;
- tree init;
+grok_function_init (tree decl, tree init)
{
/* An initializer for a function tells how this function should
be inherited. */
@@ -1206,9 +1102,7 @@ grok_function_init (decl, init)
}
void
-cplus_decl_attributes (decl, attributes, flags)
- tree *decl, attributes;
- int flags;
+cplus_decl_attributes (tree *decl, tree attributes, int flags)
{
if (*decl == NULL_TREE || *decl == void_type_node)
return;
@@ -1222,94 +1116,29 @@ cplus_decl_attributes (decl, attributes, flags)
SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (*decl), TREE_TYPE (*decl));
}
-/* CONSTRUCTOR_NAME:
- Return the name for the constructor (or destructor) for the
- specified class. Argument can be RECORD_TYPE, TYPE_DECL, or
- IDENTIFIER_NODE. When given a template, this routine doesn't
- lose the specialization. */
-
-tree
-constructor_name_full (thing)
- tree thing;
-{
- if (TREE_CODE (thing) == TEMPLATE_TYPE_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)))
- {
- if (TYPE_WAS_ANONYMOUS (thing) && TYPE_HAS_CONSTRUCTOR (thing))
- thing = DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (thing), 0)));
- else
- thing = TYPE_NAME (thing);
- }
- if (TREE_CODE (thing) == TYPE_DECL
- || (TREE_CODE (thing) == TEMPLATE_DECL
- && TREE_CODE (DECL_TEMPLATE_RESULT (thing)) == TYPE_DECL))
- thing = DECL_NAME (thing);
- my_friendly_assert (TREE_CODE (thing) == IDENTIFIER_NODE, 197);
- return thing;
-}
-
-/* CONSTRUCTOR_NAME:
- Return the name for the constructor (or destructor) for the
- specified class. Argument can be RECORD_TYPE, TYPE_DECL, or
- IDENTIFIER_NODE. When given a template, return the plain
- unspecialized name. */
-
-tree
-constructor_name (thing)
- tree thing;
-{
- tree t;
- thing = constructor_name_full (thing);
- t = IDENTIFIER_TEMPLATE (thing);
- if (!t)
- return thing;
- return t;
-}
-
-/* Returns TRUE if NAME is the name for the constructor for TYPE. */
-
-bool
-constructor_name_p (tree name, tree type)
-{
- return (name == constructor_name (type)
- || name == constructor_name_full (type));
-}
-
-
/* Defer the compilation of the FN until the end of compilation. */
void
-defer_fn (fn)
- tree fn;
+defer_fn (tree fn)
{
if (DECL_DEFERRED_FN (fn))
return;
DECL_DEFERRED_FN (fn) = 1;
+ DECL_DEFER_OUTPUT (fn) = 1;
if (!deferred_fns)
VARRAY_TREE_INIT (deferred_fns, 32, "deferred_fns");
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.
-
- FIXME: we should really handle anonymous unions by binding the names
- of the members to COMPONENT_REFs rather than this kludge. */
+/* Walks through the namespace- or function-scope anonymous union OBJECT,
+ building appropriate ALIAS_DECLs. Returns one of the fields for use in
+ the mangled name. */
-static tree
-build_anon_union_vars (anon_decl, elems, static_p, external_p)
- tree anon_decl;
- tree* elems;
- int static_p;
- int external_p;
+static tree
+build_anon_union_vars (tree object)
{
- tree type = TREE_TYPE (anon_decl);
+ tree type = TREE_TYPE (object);
tree main_decl = NULL_TREE;
tree field;
@@ -1323,12 +1152,14 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p)
field = TREE_CHAIN (field))
{
tree decl;
+ tree ref;
if (DECL_ARTIFICIAL (field))
continue;
if (TREE_CODE (field) != FIELD_DECL)
{
- cp_pedwarn_at ("`%#D' invalid; an anonymous union can only have non-static data members",
+ cp_pedwarn_at ("\
+`%#D' invalid; an anonymous union can only have non-static data members",
field);
continue;
}
@@ -1338,55 +1169,30 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p)
else if (TREE_PROTECTED (field))
cp_pedwarn_at ("protected member `%#D' in anonymous union", field);
- if (DECL_NAME (field) == NULL_TREE
- && ANON_AGGR_TYPE_P (TREE_TYPE (field)))
- {
- decl = build_anon_union_vars (field, elems, static_p, external_p);
- if (!decl)
- continue;
- }
- else if (DECL_NAME (field) == NULL_TREE)
- continue;
+ if (processing_template_decl)
+ ref = build_min_nt (COMPONENT_REF, object, DECL_NAME (field));
else
+ ref = build_class_member_access_expr (object, field, NULL_TREE,
+ false);
+
+ if (DECL_NAME (field))
{
- decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field));
- /* tell `pushdecl' that this is not tentative. */
- DECL_INITIAL (decl) = error_mark_node;
+ decl = build_decl (ALIAS_DECL, DECL_NAME (field), TREE_TYPE (field));
+ DECL_INITIAL (decl) = ref;
TREE_PUBLIC (decl) = 0;
- TREE_STATIC (decl) = static_p;
- DECL_EXTERNAL (decl) = external_p;
+ TREE_STATIC (decl) = 0;
+ DECL_EXTERNAL (decl) = 1;
decl = pushdecl (decl);
- DECL_INITIAL (decl) = NULL_TREE;
- }
-
- /* 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
- || 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
- && ANON_AGGR_TYPE_P (TREE_TYPE (field)))
- /* The remainder of the processing was already done in the
- recursive call. */
- continue;
+ else if (ANON_AGGR_TYPE_P (TREE_TYPE (field)))
+ decl = build_anon_union_vars (ref);
+ else
+ decl = 0;
- /* If there's a cleanup to do, it belongs in the
- TREE_PURPOSE of the following TREE_LIST. */
- *elems = tree_cons (NULL_TREE, decl, *elems);
- TREE_TYPE (*elems) = type;
+ if (main_decl == NULL_TREE)
+ main_decl = decl;
}
-
+
return main_decl;
}
@@ -1395,14 +1201,11 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p)
is nonzero if this union is not declared static. */
void
-finish_anon_union (anon_union_decl)
- tree anon_union_decl;
+finish_anon_union (tree anon_union_decl)
{
tree type = TREE_TYPE (anon_union_decl);
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);
+ bool public_p = TREE_PUBLIC (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));
@@ -1416,68 +1219,28 @@ finish_anon_union (anon_union_decl)
return;
}
- if (!processing_template_decl)
+ main_decl = build_anon_union_vars (anon_union_decl);
+ if (main_decl == NULL_TREE)
{
- 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 aggregate with no members");
- return;
- }
-
- if (static_p)
- {
- 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));
- return;
- }
+ warning ("anonymous union with no members");
+ return;
}
- add_decl_stmt (anon_union_decl);
-}
-
-/* Finish processing a builtin type TYPE. It's name is NAME,
- its fields are in the array FIELDS. LEN is the number of elements
- in FIELDS minus one, or put another way, it is the maximum subscript
- used in FIELDS.
-
- It is given the same alignment as ALIGN_TYPE. */
-
-void
-finish_builtin_type (type, name, fields, len, align_type)
- tree type;
- const char *name;
- tree fields[];
- int len;
- tree align_type;
-{
- register int i;
-
- TYPE_FIELDS (type) = fields[0];
- for (i = 0; i < len; i++)
+ if (!processing_template_decl)
{
- layout_type (TREE_TYPE (fields[i]));
- DECL_FIELD_CONTEXT (fields[i]) = type;
- TREE_CHAIN (fields[i]) = fields[i+1];
+ /* Use main_decl to set the mangled name. */
+ DECL_NAME (anon_union_decl) = DECL_NAME (main_decl);
+ mangle_decl (anon_union_decl);
+ DECL_NAME (anon_union_decl) = NULL_TREE;
}
- DECL_FIELD_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);
-#else
- TYPE_NAME (type) = build_decl (TYPE_DECL, get_identifier (name), type);
-#endif
- TYPE_STUB_DECL (type) = TYPE_NAME (type);
- layout_decl (TYPE_NAME (type), 0);
+
+ pushdecl (anon_union_decl);
+ if (building_stmt_tree ()
+ && at_function_scope_p ())
+ add_decl_stmt (anon_union_decl);
+ else if (!processing_template_decl)
+ rest_of_decl_compilation (anon_union_decl, NULL,
+ toplevel_bindings_p (), at_eof);
}
/* Auxiliary functions to make type signatures for
@@ -1485,8 +1248,7 @@ finish_builtin_type (type, name, fields, len, align_type)
what compiler will be expecting. */
tree
-coerce_new_type (type)
- tree type;
+coerce_new_type (tree type)
{
int e = 0;
tree args = TYPE_ARG_TYPES (type);
@@ -1508,20 +1270,19 @@ coerce_new_type (type)
{
case 2:
args = tree_cons (NULL_TREE, size_type_node, args);
- /* FALLTHROUGH */
+ /* Fall through. */
case 1:
type = build_exception_variant
(build_function_type (ptr_type_node, args),
TYPE_RAISES_EXCEPTIONS (type));
- /* FALLTHROUGH */
+ /* Fall through. */
default:;
}
return type;
}
tree
-coerce_delete_type (type)
- tree type;
+coerce_delete_type (tree type)
{
int e = 0;
tree args = TYPE_ARG_TYPES (type);
@@ -1543,12 +1304,12 @@ coerce_delete_type (type)
{
case 2:
args = tree_cons (NULL_TREE, ptr_type_node, args);
- /* FALLTHROUGH */
+ /* Fall through. */
case 1:
type = build_exception_variant
(build_function_type (void_type_node, args),
TYPE_RAISES_EXCEPTIONS (type));
- /* FALLTHROUGH */
+ /* Fall through. */
default:;
}
@@ -1556,8 +1317,7 @@ coerce_delete_type (type)
}
static void
-mark_vtable_entries (decl)
- tree decl;
+mark_vtable_entries (tree decl)
{
tree entries = CONSTRUCTOR_ELTS (DECL_INITIAL (decl));
@@ -1565,7 +1325,9 @@ mark_vtable_entries (decl)
{
tree fnaddr = TREE_VALUE (entries);
tree fn;
-
+
+ STRIP_NOPS (fnaddr);
+
if (TREE_CODE (fnaddr) != ADDR_EXPR
&& TREE_CODE (fnaddr) != FDESC_EXPR)
/* This entry is an offset: a virtual base class offset, a
@@ -1588,8 +1350,7 @@ mark_vtable_entries (decl)
linkage available. */
void
-comdat_linkage (decl)
- tree decl;
+comdat_linkage (tree decl)
{
if (flag_weak)
make_decl_one_only (decl);
@@ -1642,8 +1403,7 @@ comdat_linkage (decl)
instantiations; otherwise we get duplicate symbol errors. */
void
-maybe_make_one_only (decl)
- tree decl;
+maybe_make_one_only (tree decl)
{
/* We used to say that this was not necessary on targets that support weak
symbols, because the implicit instantiations will defer to the explicit
@@ -1665,11 +1425,10 @@ maybe_make_one_only (decl)
{
DECL_COMDAT (decl) = 1;
/* Mark it needed so we don't forget to emit it. */
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) = 1;
+ mark_referenced (DECL_ASSEMBLER_NAME (decl));
}
}
-
/* Set TREE_PUBLIC and/or DECL_EXTERN on the vtable DECL,
based on TYPE and other static flags.
@@ -1677,9 +1436,7 @@ maybe_make_one_only (decl)
it's public in this file or in another one. */
void
-import_export_vtable (decl, type, final)
- tree decl, type;
- int final;
+import_export_vtable (tree decl, tree type, int final)
{
if (DECL_INTERFACE_KNOWN (decl))
return;
@@ -1721,8 +1478,7 @@ import_export_vtable (decl, type, final)
using various heuristics. */
static void
-import_export_class (ctype)
- tree ctype;
+import_export_class (tree ctype)
{
/* -1 for imported, 1 for exported. */
int import_export = 0;
@@ -1778,60 +1534,46 @@ import_export_class (ctype)
CLASSTYPE_INTERFACE_ONLY (ctype) = (import_export < 0);
}
}
-
-/* We need to describe to the assembler the relationship between
- a vtable and the vtable of the parent class. */
-static void
-output_vtable_inherit (vars)
- tree vars;
+/* Return true if VAR has already been provided to the back end; in that
+ case VAR should not be modified further by the front end. */
+static bool
+var_finalized_p (tree var)
{
- tree parent;
- rtx child_rtx, parent_rtx;
-
- child_rtx = XEXP (DECL_RTL (vars), 0); /* strip the mem ref */
-
- parent = binfo_for_vtable (vars);
-
- if (parent == TYPE_BINFO (DECL_CONTEXT (vars)))
- parent_rtx = const0_rtx;
- else if (parent)
- {
- parent = get_vtbl_decl_for_binfo (TYPE_BINFO (BINFO_TYPE (parent)));
- parent_rtx = XEXP (DECL_RTL (parent), 0); /* strip the mem ref */
- }
+ if (flag_unit_at_a_time)
+ return cgraph_varpool_node (var)->finalized;
else
- abort ();
-
- assemble_vtable_inherit (child_rtx, parent_rtx);
+ return TREE_ASM_WRITTEN (var);
}
/* If necessary, write out the vtables for the dynamic class CTYPE.
- Returns nonzero if any vtables were emitted. */
+ Returns true if any vtables were emitted. */
-static int
+static bool
maybe_emit_vtables (tree ctype)
{
tree vtbl;
tree primary_vtbl;
+ bool needed = false;
/* If the vtables for this class have already been emitted there is
nothing more to do. */
primary_vtbl = CLASSTYPE_VTABLES (ctype);
- if (TREE_ASM_WRITTEN (primary_vtbl))
- return 0;
+ if (var_finalized_p (primary_vtbl))
+ return false;
/* Ignore dummy vtables made by get_vtable_decl. */
if (TREE_TYPE (primary_vtbl) == void_type_node)
- return 0;
+ return false;
import_export_class (ctype);
- import_export_vtable (primary_vtbl, ctype, 1);
/* See if any of the vtables are needed. */
for (vtbl = CLASSTYPE_VTABLES (ctype); vtbl; vtbl = TREE_CHAIN (vtbl))
- if (!DECL_EXTERNAL (vtbl) && DECL_NEEDED_P (vtbl))
- break;
-
+ {
+ import_export_vtable (vtbl, ctype, 1);
+ if (!DECL_EXTERNAL (vtbl) && DECL_NEEDED_P (vtbl))
+ break;
+ }
if (!vtbl)
{
/* If the references to this class' vtables are optimized away,
@@ -1840,8 +1582,11 @@ maybe_emit_vtables (tree ctype)
if (DECL_COMDAT (primary_vtbl)
&& CLASSTYPE_DEBUG_REQUESTED (ctype))
note_debug_info_needed (ctype);
- return 0;
+ return false;
}
+ else if (TREE_PUBLIC (vtbl) && !DECL_COMDAT (vtbl))
+ needed = true;
+
/* The ABI requires that we emit all of the vtables if we emit any
of them. */
@@ -1850,8 +1595,17 @@ maybe_emit_vtables (tree ctype)
/* Write it out. */
import_export_vtable (vtbl, ctype, 1);
mark_vtable_entries (vtbl);
+
+ /* If we know that DECL is needed, mark it as such for the varpool. */
+ if (needed)
+ cgraph_varpool_mark_needed_node (cgraph_varpool_node (vtbl));
+
if (TREE_TYPE (DECL_INITIAL (vtbl)) == 0)
- store_init_value (vtbl, DECL_INITIAL (vtbl));
+ {
+ /* It had better be all done at compile-time. */
+ if (store_init_value (vtbl, DECL_INITIAL (vtbl)))
+ abort ();
+ }
if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
{
@@ -1885,9 +1639,6 @@ maybe_emit_vtables (tree ctype)
rest_of_decl_compilation (vtbl, NULL, 1, 1);
- if (flag_vtable_gc)
- output_vtable_inherit (vtbl);
-
/* Because we're only doing syntax-checking, we'll never end up
actually marking the variable as written. */
if (flag_syntax_only)
@@ -1898,15 +1649,14 @@ maybe_emit_vtables (tree ctype)
info. */
note_debug_info_needed (ctype);
- return 1;
+ return true;
}
/* Determines the proper settings of TREE_PUBLIC and DECL_EXTERNAL for an
inline function or template instantiation at end-of-file. */
void
-import_export_decl (decl)
- tree decl;
+import_export_decl (tree decl)
{
if (DECL_INTERFACE_KNOWN (decl))
return;
@@ -1918,7 +1668,8 @@ import_export_decl (decl)
if ((DECL_IMPLICIT_INSTANTIATION (decl)
|| DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl))
&& (flag_implicit_templates
- || (flag_implicit_inline_templates
+ || (flag_implicit_inline_templates
+ && TREE_CODE (decl) == FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (decl))))
{
if (!TREE_PUBLIC (decl))
@@ -1972,10 +1723,7 @@ import_export_decl (decl)
typeinfo for TYPE should be in the runtime library. */
void
-import_export_tinfo (decl, type, is_in_library)
- tree decl;
- tree type;
- int is_in_library;
+import_export_tinfo (tree decl, tree type, bool is_in_library)
{
if (DECL_INTERFACE_KNOWN (decl))
return;
@@ -2013,8 +1761,7 @@ import_export_tinfo (decl, type, is_in_library)
an array whose (innermost) elements have a non-trivial destructor. */
tree
-build_cleanup (decl)
- tree decl;
+build_cleanup (tree decl)
{
tree temp;
tree type = TREE_TYPE (decl);
@@ -2044,8 +1791,7 @@ build_cleanup (decl)
which has static storage duration. */
tree
-get_guard (decl)
- tree decl;
+get_guard (tree decl)
{
tree sname;
tree guard;
@@ -2080,8 +1826,7 @@ get_guard (decl)
guarded entity is actually initialized. */
static tree
-get_guard_bits (guard)
- tree guard;
+get_guard_bits (tree guard)
{
/* We only set the first byte of the guard, in order to leave room
for a mutex in the high-order bits. */
@@ -2100,8 +1845,7 @@ get_guard_bits (guard)
variable has already been initialized. */
tree
-get_guard_cond (guard)
- tree guard;
+get_guard_cond (tree guard)
{
tree guard_value;
@@ -2117,8 +1861,7 @@ get_guard_cond (guard)
the variable being guarded has been initialized. */
tree
-set_guard (guard)
- tree guard;
+set_guard (tree guard)
{
tree guard_init;
@@ -2134,8 +1877,7 @@ set_guard (guard)
or destructors. Subroutine of do_[cd]tors. */
static tree
-start_objects (method_type, initp)
- int method_type, initp;
+start_objects (int method_type, int initp)
{
tree fnname;
tree body;
@@ -2179,11 +1921,11 @@ start_objects (method_type, initp)
DECL_GLOBAL_DTOR_P (current_function_decl) = 1;
DECL_LANG_SPECIFIC (current_function_decl)->decl_flags.u2sel = 1;
- body = begin_compound_stmt (/*has_no_scope=*/0);
+ body = begin_compound_stmt (/*has_no_scope=*/false);
/* We cannot allow these functions to be elided, even if they do not
have external linkage. And, there's no point in deferring
- copmilation of thes functions; they're all going to have to be
+ compilation of thes functions; they're all going to have to be
out anyhow. */
current_function_cannot_inline
= "static constructors and destructors cannot be inlined";
@@ -2195,16 +1937,14 @@ start_objects (method_type, initp)
or destructors. Subroutine of do_[cd]tors. */
static void
-finish_objects (method_type, initp, body)
- int method_type, initp;
- tree body;
+finish_objects (int method_type, int initp, tree body)
{
tree fn;
/* Finish up. */
- finish_compound_stmt (/*has_no_scope=*/0, body);
+ finish_compound_stmt (body);
fn = finish_function (0);
- expand_body (fn);
+ expand_or_defer_fn (fn);
/* When only doing semantic analysis, and no RTL generation, we
can't call functions that directly emit assembly code; there is
@@ -2263,10 +2003,8 @@ static splay_tree priority_info_map;
translation unit. */
static tree
-start_static_storage_duration_function ()
+start_static_storage_duration_function (unsigned count)
{
- static unsigned ssdf_number;
-
tree parm_types;
tree type;
tree body;
@@ -2274,14 +2012,7 @@ start_static_storage_duration_function ()
/* Create the identifier for this function. It will be of the form
SSDF_IDENTIFIER_<number>. */
- sprintf (id, "%s_%u", SSDF_IDENTIFIER, ssdf_number++);
- if (ssdf_number == 0)
- {
- /* Overflow occurred. That means there are at least 4 billion
- initialization functions. */
- sorry ("too many initialization functions required");
- abort ();
- }
+ sprintf (id, "%s_%u", SSDF_IDENTIFIER, count);
/* Create the parameters. */
parm_types = void_list_node;
@@ -2334,7 +2065,7 @@ start_static_storage_duration_function ()
/* Put the function in the global scope. */
pushdecl (ssdf_decl);
- /* Start the function itself. This is equivalent to declarating the
+ /* Start the function itself. This is equivalent to declaring the
function as:
static void __ssdf (int __initialize_p, init __priority_p);
@@ -2347,7 +2078,7 @@ start_static_storage_duration_function ()
SF_PRE_PARSED);
/* Set up the scope of the outermost block in the function. */
- body = begin_compound_stmt (/*has_no_scope=*/0);
+ body = begin_compound_stmt (/*has_no_scope=*/false);
/* This function must not be deferred because we are depending on
its compilation to tell us what is TREE_SYMBOL_REFERENCED. */
@@ -2362,12 +2093,11 @@ start_static_storage_duration_function ()
this point, no more such objects can be created. */
static void
-finish_static_storage_duration_function (body)
- tree body;
+finish_static_storage_duration_function (tree body)
{
/* Close out the function. */
- finish_compound_stmt (/*has_no_scope=*/0, body);
- expand_body (finish_function (0));
+ finish_compound_stmt (body);
+ expand_or_defer_fn (finish_function (0));
}
/* Return the information about the indicated PRIORITY level. If no
@@ -2375,8 +2105,7 @@ finish_static_storage_duration_function (body)
appropriate prologue. */
static priority_info
-get_priority_info (priority)
- int priority;
+get_priority_info (int priority)
{
priority_info pi;
splay_tree_node n;
@@ -2387,7 +2116,7 @@ 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 = xmalloc (sizeof (struct priority_info_s));
pi->initializations_p = 0;
pi->destructions_p = 0;
splay_tree_insert (priority_info_map,
@@ -2405,9 +2134,7 @@ get_priority_info (priority)
are destroying it. */
static tree
-start_static_initialization_or_destruction (decl, initp)
- tree decl;
- int initp;
+start_static_initialization_or_destruction (tree decl, int initp)
{
tree guard_if_stmt = NULL_TREE;
int priority;
@@ -2433,8 +2160,7 @@ start_static_initialization_or_destruction (decl, initp)
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);
+ input_location = DECL_SOURCE_LOCATION (decl);
/* Because of:
@@ -2529,8 +2255,7 @@ start_static_initialization_or_destruction (decl, initp)
the initialization. */
static void
-finish_static_initialization_or_destruction (guard_if_stmt)
- tree guard_if_stmt;
+finish_static_initialization_or_destruction (tree guard_if_stmt)
{
finish_then_clause (guard_if_stmt);
finish_if_stmt ();
@@ -2545,9 +2270,7 @@ finish_static_initialization_or_destruction (guard_if_stmt)
static storage duration. The initialization is INIT. */
static void
-do_static_initialization (decl, init)
- tree decl;
- tree init;
+do_static_initialization (tree decl, tree init)
{
tree guard_if_stmt;
@@ -2575,8 +2298,7 @@ do_static_initialization (decl, init)
destruction. */
static void
-do_static_destruction (decl)
- tree decl;
+do_static_destruction (tree decl)
{
tree guard_if_stmt;
@@ -2604,8 +2326,7 @@ do_static_destruction (decl)
i.e., the first variable should be initialized first. */
static tree
-prune_vars_needing_no_initialization (vars)
- tree *vars;
+prune_vars_needing_no_initialization (tree *vars)
{
tree *var = vars;
tree result = NULL_TREE;
@@ -2657,13 +2378,12 @@ prune_vars_needing_no_initialization (vars)
VARS. */
static void
-write_out_vars (vars)
- tree vars;
+write_out_vars (tree vars)
{
tree v;
for (v = vars; v; v = TREE_CHAIN (v))
- if (! TREE_ASM_WRITTEN (TREE_VALUE (v)))
+ if (!var_finalized_p (TREE_VALUE (v)))
rest_of_decl_compilation (TREE_VALUE (v), 0, 1, 1);
}
@@ -2672,36 +2392,45 @@ write_out_vars (vars)
storage duration having the indicated PRIORITY. */
static void
-generate_ctor_or_dtor_function (constructor_p, priority)
- int constructor_p;
- int priority;
+generate_ctor_or_dtor_function (bool constructor_p, int priority,
+ location_t *locus)
{
char function_key;
tree arguments;
+ tree fndecl;
tree body;
size_t i;
+ input_location = *locus;
+ locus->line++;
+
/* We use `I' to indicate initialization and `D' to indicate
destruction. */
- if (constructor_p)
- function_key = 'I';
- else
- function_key = 'D';
+ function_key = constructor_p ? 'I' : 'D';
- /* Begin the function. */
- body = start_objects (function_key, priority);
+ /* We emit the function lazily, to avoid generating empty
+ global constructors and destructors. */
+ body = NULL_TREE;
/* Call the static storage duration function with appropriate
arguments. */
if (ssdf_decls)
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);
- finish_expr_stmt (build_function_call (VARRAY_TREE (ssdf_decls, i),
- arguments));
+ fndecl = VARRAY_TREE (ssdf_decls, i);
+
+ /* Calls to pure or const functions will expand to nothing. */
+ if (! (flags_from_decl_or_type (fndecl) & (ECF_CONST | ECF_PURE)))
+ {
+ if (! body)
+ body = start_objects (function_key, priority);
+
+ arguments = tree_cons (NULL_TREE, build_int_2 (priority, 0),
+ NULL_TREE);
+ arguments = tree_cons (NULL_TREE, build_int_2 (constructor_p, 0),
+ arguments);
+ finish_expr_stmt (build_function_call (fndecl, arguments));
+ }
}
/* If we're generating code for the DEFAULT_INIT_PRIORITY, throw in
@@ -2714,21 +2443,31 @@ generate_ctor_or_dtor_function (constructor_p, priority)
for (fns = constructor_p ? static_ctors : static_dtors;
fns;
fns = TREE_CHAIN (fns))
- finish_expr_stmt (build_function_call (TREE_VALUE (fns), NULL_TREE));
+ {
+ fndecl = TREE_VALUE (fns);
+
+ /* Calls to pure/const functions will expand to nothing. */
+ if (! (flags_from_decl_or_type (fndecl) & (ECF_CONST | ECF_PURE)))
+ {
+ if (! body)
+ body = start_objects (function_key, priority);
+ finish_expr_stmt (build_function_call (fndecl, NULL_TREE));
+ }
+ }
}
/* Close out the function. */
- finish_objects (function_key, priority, body);
+ if (body)
+ finish_objects (function_key, priority, body);
}
/* Generate constructor and destructor functions for the priority
indicated by N. */
static int
-generate_ctor_and_dtor_functions_for_priority (n, data)
- splay_tree_node n;
- void *data ATTRIBUTE_UNUSED;
+generate_ctor_and_dtor_functions_for_priority (splay_tree_node n, void * data)
{
+ location_t *locus = data;
int priority = (int) n->key;
priority_info pi = (priority_info) n->value;
@@ -2736,38 +2475,73 @@ generate_ctor_and_dtor_functions_for_priority (n, data)
needed. */
if (pi->initializations_p
|| (priority == DEFAULT_INIT_PRIORITY && static_ctors))
- generate_ctor_or_dtor_function (/*constructor_p=*/1,
- priority);
+ generate_ctor_or_dtor_function (/*constructor_p=*/true, priority, locus);
if (pi->destructions_p
|| (priority == DEFAULT_INIT_PRIORITY && static_dtors))
- generate_ctor_or_dtor_function (/*constructor_p=*/0,
- priority);
+ generate_ctor_or_dtor_function (/*constructor_p=*/false, priority, locus);
/* Keep iterating. */
return 0;
}
+/* Called via LANGHOOK_CALLGRAPH_ANALYZE_EXPR. It is supposed to mark
+ decls referenced from frontend specific constructs; it will be called
+ only for language-specific tree nodes.
+
+ Here we must deal with member pointers. */
+
+tree
+cxx_callgraph_analyze_expr (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ tree from ATTRIBUTE_UNUSED)
+{
+ tree t = *tp;
+
+ if (flag_unit_at_a_time)
+ switch (TREE_CODE (t))
+ {
+ case PTRMEM_CST:
+ if (TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
+ cgraph_mark_needed_node (cgraph_node (PTRMEM_CST_MEMBER (t)));
+ break;
+ case BASELINK:
+ if (TREE_CODE (BASELINK_FUNCTIONS (t)) == FUNCTION_DECL)
+ cgraph_mark_needed_node (cgraph_node (BASELINK_FUNCTIONS (t)));
+ break;
+
+ default:
+ break;
+ }
+
+ return NULL;
+}
+
/* 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
first, since that way we only need to reverse the decls once. */
void
-finish_file ()
+finish_file (void)
{
tree vars;
- int reconsider;
+ bool reconsider;
size_t i;
+ location_t locus;
+ unsigned ssdf_count = 0;
+ locus = input_location;
at_eof = 1;
/* Bad parse errors. Just forget about it. */
if (! global_bindings_p () || current_class_type || decl_namespace_list)
return;
+ if (pch_file)
+ c_common_write_pch ();
+
/* Otherwise, GDB can get confused, because in only knows
about source for LINENO-1 lines. */
- lineno -= 1;
+ input_line -= 1;
interface_unknown = 1;
interface_only = 0;
@@ -2795,49 +2569,75 @@ finish_file ()
do
{
tree t;
+ size_t n_old, n_new;
- reconsider = 0;
+ reconsider = false;
/* If there are templates that we've put off instantiating, do
them now. */
instantiate_pending_templates ();
+ ggc_collect ();
/* 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 we write out
- vtables then we remove the class from our list so we don't
- have to look at it again. */
-
+ the virtual table for a template class may cause the
+ instantiation of members of that class. If we write out
+ vtables then we remove the class from our list so we don't
+ have to look at it again. */
+
while (keyed_classes != NULL_TREE
- && maybe_emit_vtables (TREE_VALUE (keyed_classes)))
- {
- reconsider = 1;
- keyed_classes = TREE_CHAIN (keyed_classes);
- }
-
+ && maybe_emit_vtables (TREE_VALUE (keyed_classes)))
+ {
+ reconsider = true;
+ keyed_classes = TREE_CHAIN (keyed_classes);
+ }
+
t = keyed_classes;
if (t != NULL_TREE)
- {
- tree next = TREE_CHAIN (t);
-
- while (next)
- {
- if (maybe_emit_vtables (TREE_VALUE (next)))
- {
- reconsider = 1;
- TREE_CHAIN (t) = TREE_CHAIN (next);
- }
- else
- t = next;
-
- next = TREE_CHAIN (t);
- }
- }
-
- /* Write out needed type info variables. Writing out one variable
- might cause others to be needed. */
- if (walk_globals (unemitted_tinfo_decl_p, emit_tinfo_decl, /*data=*/0))
- reconsider = 1;
+ {
+ tree next = TREE_CHAIN (t);
+
+ while (next)
+ {
+ if (maybe_emit_vtables (TREE_VALUE (next)))
+ {
+ reconsider = true;
+ TREE_CHAIN (t) = TREE_CHAIN (next);
+ }
+ else
+ t = next;
+
+ next = TREE_CHAIN (t);
+ }
+ }
+
+ /* Write out needed type info variables. We have to be careful
+ looping through unemitted decls, because emit_tinfo_decl may
+ cause other variables to be needed. We stick new elements
+ (and old elements that we may need to reconsider) at the end
+ of the array, then shift them back to the beginning once we're
+ done. */
+
+ n_old = VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls);
+ for (i = 0; i < n_old; ++i)
+ {
+ tree tinfo_decl = VARRAY_TREE (unemitted_tinfo_decls, i);
+ if (emit_tinfo_decl (tinfo_decl))
+ reconsider = true;
+ else
+ VARRAY_PUSH_TREE (unemitted_tinfo_decls, tinfo_decl);
+ }
+
+ /* The only elements we want to keep are the new ones. Copy
+ them to the beginning of the array, then get rid of the
+ leftovers. */
+ n_new = VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls) - n_old;
+ if (n_new)
+ memmove (&VARRAY_TREE (unemitted_tinfo_decls, 0),
+ &VARRAY_TREE (unemitted_tinfo_decls, n_old),
+ n_new * sizeof (tree));
+ memset (&VARRAY_TREE (unemitted_tinfo_decls, n_new),
+ 0, n_old * sizeof (tree));
+ VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls) = n_new;
/* The list of objects with static storage duration is built up
in reverse order. We clear STATIC_AGGREGATES so that any new
@@ -2857,7 +2657,12 @@ finish_file ()
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 ();
+ tree ssdf_body;
+
+ /* Set the line and file, so that it is obviously not from
+ the source file. */
+ input_location = locus;
+ ssdf_body = start_static_storage_duration_function (ssdf_count);
/* Make sure the back end knows about all the variables. */
write_out_vars (vars);
@@ -2884,12 +2689,15 @@ finish_file ()
/* Finish up the static storage duration function for this
round. */
+ input_location = locus;
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;
+ reconsider = true;
+ ssdf_count++;
+ locus.line++;
}
for (i = 0; i < deferred_fns_used; ++i)
@@ -2909,7 +2717,7 @@ finish_file ()
push_to_top_level ();
synthesize_method (decl);
pop_from_top_level ();
- reconsider = 1;
+ reconsider = true;
}
/* If the function has no body, avoid calling
@@ -2922,7 +2730,7 @@ finish_file ()
continue;
import_export_decl (decl);
-
+
/* 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 unnecessarily. But, we must
@@ -2945,41 +2753,33 @@ finish_file ()
if (!DECL_EXTERNAL (decl)
&& DECL_NEEDED_P (decl)
&& DECL_SAVED_TREE (decl)
- && !TREE_ASM_WRITTEN (decl))
+ && !TREE_ASM_WRITTEN (decl)
+ && (!flag_unit_at_a_time
+ || !cgraph_node (decl)->local.finalized))
{
- 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);
+ /* We will output the function; no longer consider it in this
+ loop. */
+ DECL_DEFER_OUTPUT (decl) = 0;
/* 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;
+ expand_or_defer_fn (decl);
/* 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;
+ reconsider = true;
}
}
- 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;
+ reconsider = true;
/* Static data members are just like namespace-scope globals. */
for (i = 0; i < pending_statics_used; ++i)
{
tree decl = VARRAY_TREE (pending_statics, i);
- if (TREE_ASM_WRITTEN (decl))
+ if (var_finalized_p (decl))
continue;
import_export_decl (decl);
if (DECL_NOT_REALLY_EXTERN (decl) && ! DECL_IN_AGGR_P (decl))
@@ -2988,11 +2788,14 @@ finish_file ()
if (pending_statics
&& wrapup_global_declarations (&VARRAY_TREE (pending_statics, 0),
pending_statics_used))
- reconsider = 1;
+ reconsider = true;
+
+ if (cgraph_assemble_pending_functions ())
+ reconsider = true;
}
while (reconsider);
- /* All used inline functions must have a definition at this point. */
+ /* All used inline functions must have a definition at this point. */
for (i = 0; i < deferred_fns_used; ++i)
{
tree decl = VARRAY_TREE (deferred_fns, i);
@@ -3000,10 +2803,17 @@ finish_file ()
if (TREE_USED (decl) && DECL_DECLARED_INLINE_P (decl)
&& !(TREE_ASM_WRITTEN (decl) || DECL_SAVED_TREE (decl)
/* An explicit instantiation can be used to specify
- that the body is in another unit. It will have
- already verified there was a definition. */
+ that the body is in another unit. It will have
+ already verified there was a definition. */
|| DECL_EXPLICIT_INSTANTIATION (decl)))
- cp_warning_at ("inline function `%D' used but never defined", decl);
+ {
+ cp_warning_at ("inline function `%D' used but never defined", decl);
+ /* This symbol is effectively an "extern" declaration now.
+ This is not strictly necessary, but removes a duplicate
+ warning. */
+ TREE_PUBLIC (decl) = 1;
+ }
+
}
/* We give C linkage to static constructors and destructors. */
@@ -3014,15 +2824,16 @@ finish_file ()
if (priority_info_map)
splay_tree_foreach (priority_info_map,
generate_ctor_and_dtor_functions_for_priority,
- /*data=*/0);
+ /*data=*/&locus);
else
{
+
if (static_ctors)
generate_ctor_or_dtor_function (/*constructor_p=*/true,
- DEFAULT_INIT_PRIORITY);
+ DEFAULT_INIT_PRIORITY, &locus);
if (static_dtors)
generate_ctor_or_dtor_function (/*constructor_p=*/false,
- DEFAULT_INIT_PRIORITY);
+ DEFAULT_INIT_PRIORITY, &locus);
}
/* We're done with the splay-tree now. */
@@ -3033,6 +2844,12 @@ finish_file ()
linkage now. */
pop_lang_context ();
+ if (flag_unit_at_a_time)
+ {
+ cgraph_finalize_compilation_unit ();
+ cgraph_optimize ();
+ }
+
/* Now, issue warnings about static, but not defined, functions,
etc., and emit debugging information. */
walk_namespaces (wrapup_globals_for_namespace, /*data=*/&reconsider);
@@ -3062,1756 +2879,78 @@ finish_file ()
dump_tree_statistics ();
dump_time_statistics ();
}
+ input_location = locus;
}
-/* This is something of the form 'A()()()()()+1' that has turned out to be an
- expr. Since it was parsed like a type, we need to wade through and fix
- that. Unfortunately, since operator() is left-associative, we can't use
- tail recursion. In the above example, TYPE is `A', and DECL is
- `()()()()()'.
-
- Maybe this shouldn't be recursive, but how often will it actually be
- used? (jason) */
+/* FN is an OFFSET_REF, DOTSTAR_EXPR or MEMBER_REF indicating the
+ function to call in parse-tree form; it has not yet been
+ semantically analyzed. ARGS are the arguments to the function.
+ They have already been semantically analyzed. */
tree
-reparse_absdcl_as_expr (type, decl)
- tree type, decl;
-{
- /* do build_functional_cast (type, NULL_TREE) at bottom */
- if (TREE_OPERAND (decl, 0) == NULL_TREE)
- return build_functional_cast (type, NULL_TREE);
-
- /* recurse */
- decl = reparse_absdcl_as_expr (type, TREE_OPERAND (decl, 0));
-
- return finish_call_expr (decl, NULL_TREE, /*disallow_virtual=*/false);
-}
-
-/* This is something of the form `int ((int)(int)(int)1)' that has turned
- out to be an expr. Since it was parsed like a type, we need to wade
- through and fix that. Since casts are right-associative, we are
- reversing the order, so we don't have to recurse.
-
- In the above example, DECL is the `(int)(int)(int)', and EXPR is the
- `1'. */
-
-tree
-reparse_absdcl_as_casts (decl, expr)
- tree decl, expr;
+build_offset_ref_call_from_tree (tree fn, tree args)
{
- tree type;
- int non_void_p = 0;
-
- if (TREE_CODE (expr) == CONSTRUCTOR
- && TREE_TYPE (expr) == 0)
- {
- type = groktypename (TREE_VALUE (CALL_DECLARATOR_PARMS (decl)));
- decl = TREE_OPERAND (decl, 0);
-
- if (processing_template_decl)
- TREE_TYPE (expr) = type;
- else
- {
- 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 (CALL_DECLARATOR_PARMS (decl)));
- decl = TREE_OPERAND (decl, 0);
- if (!VOID_TYPE_P (type))
- non_void_p = 1;
- expr = build_c_cast (type, expr);
- }
+ tree orig_fn;
+ tree orig_args;
+ tree expr;
+ tree object;
- if (warn_old_style_cast && ! in_system_header
- && non_void_p && current_lang_name != lang_name_c)
- warning ("use of old-style cast");
+ orig_fn = fn;
+ orig_args = args;
+ object = TREE_OPERAND (fn, 0);
- return expr;
-}
-
-/* T is the parse tree for an expression. Return the expression after
- performing semantic analysis. */
-
-tree
-build_expr_from_tree (t)
- tree t;
-{
- if (t == NULL_TREE || t == error_mark_node)
- return t;
-
- switch (TREE_CODE (t))
+ if (processing_template_decl)
{
- case IDENTIFIER_NODE:
- return do_identifier (t, 0, NULL_TREE);
-
- case LOOKUP_EXPR:
- if (LOOKUP_EXPR_GLOBAL (t))
- {
- tree token = TREE_OPERAND (t, 0);
- return do_scoped_id (token, IDENTIFIER_GLOBAL_VALUE (token));
- }
- else
- return do_identifier (TREE_OPERAND (t, 0), 0, NULL_TREE);
-
- case TEMPLATE_ID_EXPR:
- {
- tree template;
- tree args;
- tree object;
-
- template = build_expr_from_tree (TREE_OPERAND (t, 0));
- args = build_expr_from_tree (TREE_OPERAND (t, 1));
-
- if (TREE_CODE (template) == COMPONENT_REF)
- {
- object = TREE_OPERAND (template, 0);
- template = TREE_OPERAND (template, 1);
- }
- else
- object = NULL_TREE;
-
- template = lookup_template_function (template, args);
- if (object)
- return build (COMPONENT_REF, TREE_TYPE (template),
- object, template);
- else
- return template;
- }
-
- case INDIRECT_REF:
- return build_x_indirect_ref
- (build_expr_from_tree (TREE_OPERAND (t, 0)), "unary *");
-
- case CAST_EXPR:
- return build_functional_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case REINTERPRET_CAST_EXPR:
- return build_reinterpret_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case CONST_CAST_EXPR:
- return build_const_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case DYNAMIC_CAST_EXPR:
- return build_dynamic_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case STATIC_CAST_EXPR:
- return build_static_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case NEGATE_EXPR:
- case BIT_NOT_EXPR:
- case ABS_EXPR:
- 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),
- build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case EXACT_DIV_EXPR:
- case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case RSHIFT_EXPR:
- case LSHIFT_EXPR:
- case RROTATE_EXPR:
- case LROTATE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case MAX_EXPR:
- case MIN_EXPR:
- case LE_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case GT_EXPR:
- case MEMBER_REF:
- return build_x_binary_op
- (TREE_CODE (t),
- build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)));
-
- case DOTSTAR_EXPR:
- return build_m_component_ref
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)));
-
- case SCOPE_REF:
- return build_offset_ref (TREE_OPERAND (t, 0), TREE_OPERAND (t, 1));
-
- case ARRAY_REF:
- if (TREE_OPERAND (t, 0) == NULL_TREE)
- /* new-type-id */
- 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)));
-
- case SIZEOF_EXPR:
- case ALIGNOF_EXPR:
- {
- tree r = build_expr_from_tree (TREE_OPERAND (t, 0));
- if (!TYPE_P (r))
- return TREE_CODE (t) == SIZEOF_EXPR ? expr_sizeof (r) : c_alignof_expr (r);
- else
- return cxx_sizeof_or_alignof_type (r, TREE_CODE (t), true);
- }
-
- case MODOP_EXPR:
- return build_x_modify_expr
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- TREE_CODE (TREE_OPERAND (t, 1)),
- build_expr_from_tree (TREE_OPERAND (t, 2)));
-
- case ARROW_EXPR:
- return build_x_arrow
- (build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case NEW_EXPR:
- return build_new
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)),
- build_expr_from_tree (TREE_OPERAND (t, 2)),
- NEW_EXPR_USE_GLOBAL (t));
-
- case DELETE_EXPR:
- return delete_sanity
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)),
- DELETE_EXPR_USE_VEC (t), DELETE_EXPR_USE_GLOBAL (t));
-
- case COMPOUND_EXPR:
- if (TREE_OPERAND (t, 1) == NULL_TREE)
- return build_x_compound_expr
- (build_expr_from_tree (TREE_OPERAND (t, 0)));
- else
- 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)),
- name,
- build_expr_from_tree (TREE_OPERAND (t, 2)));
- }
- else
- {
- tree fn = TREE_OPERAND (t, 0);
-
- /* We can get a TEMPLATE_ID_EXPR here on code like:
-
- x->f<2>();
-
- so we must resolve that. However, we can also get things
- like a BIT_NOT_EXPR here, when referring to a destructor,
- and things like that are not correctly resolved by
- build_expr_from_tree. So, just use build_expr_from_tree
- when we really need it. */
- if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
- fn = lookup_template_function
- (TREE_OPERAND (fn, 0),
- build_expr_from_tree (TREE_OPERAND (fn, 1)));
-
- return build_method_call
- (build_expr_from_tree (TREE_OPERAND (t, 1)),
- fn,
- build_expr_from_tree (TREE_OPERAND (t, 2)),
- NULL_TREE, LOOKUP_NORMAL);
- }
-
- case CALL_EXPR:
- if (TREE_CODE (TREE_OPERAND (t, 0)) == SCOPE_REF)
- {
- tree ref = TREE_OPERAND (t, 0);
- tree name = TREE_OPERAND (ref, 1);
- tree fn, scope, args;
-
- 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)));
-
- scope = build_expr_from_tree (TREE_OPERAND (ref, 0));
- args = build_expr_from_tree (TREE_OPERAND (t, 1));
- fn = resolve_scoped_fn_name (scope, name);
-
- return build_call_from_tree (fn, args, 1);
- }
- else
- {
- tree name = TREE_OPERAND (t, 0);
- tree id;
- tree args = build_expr_from_tree (TREE_OPERAND (t, 1));
- if (args != NULL_TREE && TREE_CODE (name) == LOOKUP_EXPR
- && !LOOKUP_EXPR_GLOBAL (name)
- && TREE_CODE ((id = TREE_OPERAND (name, 0))) == IDENTIFIER_NODE
- && (!current_class_type
- || !lookup_member (current_class_type, id, 0, 0)))
- {
- /* Do Koenig lookup if there are no class members. */
- name = do_identifier (id, 0, args);
- }
- else if (TREE_CODE (name) == TEMPLATE_ID_EXPR
- || ! really_overloaded_fn (name))
- name = build_expr_from_tree (name);
-
- if (TREE_CODE (name) == OFFSET_REF)
- return build_offset_ref_call_from_tree (name, args);
- if (TREE_CODE (name) == COMPONENT_REF)
- return finish_object_call_expr (TREE_OPERAND (name, 1),
- TREE_OPERAND (name, 0),
- args);
- name = convert_from_reference (name);
- return build_call_from_tree (name, args,
- /*disallow_virtual=*/false);
- }
-
- case COND_EXPR:
- return build_x_conditional_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 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;
-
- if (t == void_list_node)
- return t;
-
- purpose = TREE_PURPOSE (t);
- if (purpose)
- purpose = build_expr_from_tree (purpose);
- value = TREE_VALUE (t);
- if (value)
- value = build_expr_from_tree (value);
- chain = TREE_CHAIN (t);
- if (chain && chain != void_type_node)
- chain = build_expr_from_tree (chain);
- return tree_cons (purpose, value, chain);
- }
-
- case COMPONENT_REF:
- {
- tree object = build_expr_from_tree (TREE_OPERAND (t, 0));
- return finish_class_member_access_expr (object,
- TREE_OPERAND (t, 1));
- }
-
- case THROW_EXPR:
- return build_throw (build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- 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 (type && TYPE_PTRMEMFUNC_P (type))
- return 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 (type)
- return digest_init (type, r, 0);
- return r;
- }
-
- case TYPEID_EXPR:
- if (TYPE_P (TREE_OPERAND (t, 0)))
- return get_typeid (TREE_OPERAND (t, 0));
- return build_typeid (build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case VAR_DECL:
- return convert_from_reference (t);
+ my_friendly_assert (TREE_CODE (fn) == DOTSTAR_EXPR
+ || TREE_CODE (fn) == MEMBER_REF,
+ 20030708);
+ if (type_dependent_expression_p (fn)
+ || any_type_dependent_arguments_p (args))
+ return build_min_nt (CALL_EXPR, fn, args);
- case VA_ARG_EXPR:
- return build_va_arg (build_expr_from_tree (TREE_OPERAND (t, 0)),
- TREE_TYPE (t));
-
- default:
- return t;
+ /* Transform the arguments and add the implicit "this"
+ parameter. That must be done before the FN is transformed
+ because we depend on the form of FN. */
+ args = build_non_dependent_args (args);
+ if (TREE_CODE (fn) == DOTSTAR_EXPR)
+ object = build_unary_op (ADDR_EXPR, object, 0);
+ object = build_non_dependent_expr (object);
+ args = tree_cons (NULL_TREE, object, args);
+ /* Now that the arguments are done, transform FN. */
+ fn = build_non_dependent_expr (fn);
}
-}
-
-/* FN is an OFFSET_REF indicating the function to call in parse-tree
- form; it has not yet been semantically analyzed. ARGS are the
- arguments to the function. They have already been semantically
- analzyed. */
-
-tree
-build_offset_ref_call_from_tree (tree fn, tree args)
-{
- tree object_addr;
-
- my_friendly_assert (TREE_CODE (fn) == OFFSET_REF, 20020725);
- /* A qualified name corresponding to a non-static member
- function or a pointer-to-member is represented as an
- OFFSET_REF.
-
- For both of these function calls, FN will be an OFFSET_REF.
-
- struct A { void f(); };
- void A::f() { (A::f) (); }
+ /* A qualified name corresponding to a bound pointer-to-member is
+ represented as an OFFSET_REF:
struct B { void g(); };
void (B::*p)();
void B::g() { (this->*p)(); } */
-
- /* This code is not really correct (for example, it does not
- handle the case that `A::f' is overloaded), but it is
- historically how we have handled this situation. */
- if (TREE_CODE (TREE_OPERAND (fn, 1)) == FIELD_DECL)
- fn = resolve_offset_ref (fn);
- else
+ if (TREE_CODE (fn) == OFFSET_REF)
{
- object_addr = build_unary_op (ADDR_EXPR, TREE_OPERAND (fn, 0), 0);
+ tree object_addr = build_unary_op (ADDR_EXPR, object, 0);
fn = TREE_OPERAND (fn, 1);
fn = get_member_function_from_ptrfunc (&object_addr, fn);
args = tree_cons (NULL_TREE, object_addr, args);
}
- return build_function_call (fn, args);
-}
-
-/* FN indicates the function to call. Name resolution has been
- performed on FN. ARGS are the arguments to the function. They
- have already been semantically analyzed. DISALLOW_VIRTUAL is true
- if the function call should be determined at compile time, even if
- FN is virtual. */
-
-tree
-build_call_from_tree (tree fn, tree args, bool disallow_virtual)
-{
- tree template_args;
- tree template_id;
- tree f;
-
- /* Check to see that name lookup has already been performed. */
- my_friendly_assert (TREE_CODE (fn) != OFFSET_REF, 20020725);
- my_friendly_assert (TREE_CODE (fn) != SCOPE_REF, 20020725);
-
- /* In the future all of this should be eliminated. Instead,
- name-lookup for a member function should simply return a
- baselink, instead of a FUNCTION_DECL, TEMPLATE_DECL, or
- TEMPLATE_ID_EXPR. */
-
- if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
- {
- template_id = fn;
- template_args = TREE_OPERAND (fn, 1);
- fn = TREE_OPERAND (fn, 0);
- }
- else
- {
- template_id = NULL_TREE;
- template_args = NULL_TREE;
- }
-
- f = (TREE_CODE (fn) == OVERLOAD) ? get_first_fn (fn) : fn;
- /* Make sure we have a baselink (rather than simply a
- FUNCTION_DECL) for a member function. */
- if (current_class_type
- && ((TREE_CODE (f) == FUNCTION_DECL
- && DECL_FUNCTION_MEMBER_P (f))
- || (DECL_FUNCTION_TEMPLATE_P (f)
- && DECL_FUNCTION_MEMBER_P (f))))
- {
- f = lookup_member (current_class_type, DECL_NAME (f),
- /*protect=*/1, /*want_type=*/0);
- if (f)
- fn = f;
- }
-
- if (template_id)
- {
- if (BASELINK_P (fn))
- BASELINK_FUNCTIONS (fn) = build_nt (TEMPLATE_ID_EXPR,
- BASELINK_FUNCTIONS (fn),
- template_args);
- else
- fn = template_id;
- }
-
- return finish_call_expr (fn, args, disallow_virtual);
-}
-
-/* This is something of the form `int (*a)++' that has turned out to be an
- expr. It was only converted into parse nodes, so we need to go through
- and build up the semantics. Most of the work is done by
- build_expr_from_tree, above.
-
- In the above example, TYPE is `int' and DECL is `*a'. */
-
-tree
-reparse_decl_as_expr (type, decl)
- tree type, decl;
-{
- decl = build_expr_from_tree (decl);
- if (type)
- return build_functional_cast (type, build_tree_list (NULL_TREE, decl));
- else
- return decl;
-}
-
-/* This is something of the form `int (*a)' that has turned out to be a
- decl. It was only converted into parse nodes, so we need to do the
- checking that make_{pointer,reference}_declarator do. */
-
-tree
-finish_decl_parsing (decl)
- tree decl;
-{
- switch (TREE_CODE (decl))
- {
- case IDENTIFIER_NODE:
- return decl;
- case INDIRECT_REF:
- return make_pointer_declarator
- (NULL_TREE, finish_decl_parsing (TREE_OPERAND (decl, 0)));
- case ADDR_EXPR:
- return make_reference_declarator
- (NULL_TREE, finish_decl_parsing (TREE_OPERAND (decl, 0)));
- case BIT_NOT_EXPR:
- TREE_OPERAND (decl, 0) = finish_decl_parsing (TREE_OPERAND (decl, 0));
- return decl;
- case SCOPE_REF:
- push_nested_class (TREE_TYPE (TREE_OPERAND (decl, 0)), 3);
- TREE_COMPLEXITY (decl) = current_class_depth;
- return decl;
- case ARRAY_REF:
- TREE_OPERAND (decl, 0) = finish_decl_parsing (TREE_OPERAND (decl, 0));
- return decl;
- case TREE_LIST:
- /* For attribute handling. */
- TREE_VALUE (decl) = finish_decl_parsing (TREE_VALUE (decl));
- return decl;
- case TEMPLATE_ID_EXPR:
- return decl;
- default:
- abort ();
- return NULL_TREE;
- }
-}
-
-/* Returns true if ROOT (a namespace, class, or function) encloses
- CHILD. CHILD may be either a class type or a namespace. */
-
-bool
-is_ancestor (tree root, tree child)
-{
- my_friendly_assert ((TREE_CODE (root) == NAMESPACE_DECL
- || TREE_CODE (root) == FUNCTION_DECL
- || CLASS_TYPE_P (root)), 20030307);
- my_friendly_assert ((TREE_CODE (child) == NAMESPACE_DECL
- || TREE_CODE (root) == FUNCTION_DECL
- || CLASS_TYPE_P (child)),
- 20030307);
-
- /* The global namespace encloses everything. */
- if (root == global_namespace)
- return true;
-
- while (true)
- {
- /* If we've run out of scopes, stop. */
- if (!child)
- return false;
- /* If we've reached the ROOT, it encloses CHILD. */
- if (root == child)
- return true;
- /* Go out one level. */
- if (TYPE_P (child))
- child = TYPE_NAME (child);
- child = DECL_CONTEXT (child);
- }
-}
-
-/* Return the namespace that is the common ancestor
- of two given namespaces. */
-
-tree
-namespace_ancestor (ns1, ns2)
- tree ns1, ns2;
-{
- timevar_push (TV_NAME_LOOKUP);
- if (is_ancestor (ns1, ns2))
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ns1);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
- namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2));
-}
-
-/* Insert used into the using list of user. Set indirect_flag if this
- directive is not directly from the source. Also find the common
- ancestor and let our users know about the new namespace */
-static void
-add_using_namespace (user, used, indirect)
- tree user;
- tree used;
- int indirect;
-{
- tree t;
- timevar_push (TV_NAME_LOOKUP);
- /* Using oneself is a no-op. */
- if (user == used)
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
- my_friendly_assert (TREE_CODE (user) == NAMESPACE_DECL, 380);
- my_friendly_assert (TREE_CODE (used) == NAMESPACE_DECL, 380);
- /* Check if we already have this. */
- t = purpose_member (used, DECL_NAMESPACE_USING (user));
- if (t != NULL_TREE)
- {
- if (!indirect)
- /* Promote to direct usage. */
- TREE_INDIRECT_USING (t) = 0;
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
- }
- /* Add used to the user's using list. */
- 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)
- = tree_cons (user, 0, DECL_NAMESPACE_USERS (used));
-
- /* Recursively add all namespaces used. */
- for (t = DECL_NAMESPACE_USING (used); t; t = TREE_CHAIN (t))
- /* indirect usage */
- add_using_namespace (user, TREE_PURPOSE (t), 1);
-
- /* Tell everyone using us about the new used namespaces. */
- for (t = DECL_NAMESPACE_USERS (user); t; t = TREE_CHAIN (t))
- add_using_namespace (TREE_PURPOSE (t), used, 1);
- timevar_pop (TV_NAME_LOOKUP);
-}
-
-/* Combines two sets of overloaded functions into an OVERLOAD chain, removing
- duplicates. The first list becomes the tail of the result.
-
- The algorithm is O(n^2). We could get this down to O(n log n) by
- doing a sort on the addresses of the functions, if that becomes
- necessary. */
-
-static tree
-merge_functions (s1, s2)
- tree s1;
- tree s2;
-{
- for (; s2; s2 = OVL_NEXT (s2))
- {
- 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;
-}
-
-/* This should return an error not all definitions define functions.
- It is not an error if we find two functions with exactly the
- same signature, only if these are selected in overload resolution.
- old is the current set of bindings, new the freshly-found binding.
- XXX Do we want to give *all* candidates in case of ambiguity?
- XXX In what way should I treat extern declarations?
- XXX I don't want to repeat the entire duplicate_decls here */
-
-static cxx_binding *
-ambiguous_decl (tree name, cxx_binding *old, cxx_binding *new, int flags)
-{
- tree val, type;
- my_friendly_assert (old != NULL, 393);
- /* Copy the value. */
- val = BINDING_VALUE (new);
- if (val)
- switch (TREE_CODE (val))
- {
- case TEMPLATE_DECL:
- /* If we expect types or namespaces, and not templates,
- or this is not a template class. */
- if (LOOKUP_QUALIFIERS_ONLY (flags)
- && !DECL_CLASS_TEMPLATE_P (val))
- val = NULL_TREE;
- break;
- case TYPE_DECL:
- if (LOOKUP_NAMESPACES_ONLY (flags))
- val = NULL_TREE;
- break;
- case NAMESPACE_DECL:
- if (LOOKUP_TYPES_ONLY (flags))
- val = NULL_TREE;
- break;
- case FUNCTION_DECL:
- /* Ignore built-in functions that are still anticipated. */
- if (LOOKUP_QUALIFIERS_ONLY (flags) || DECL_ANTICIPATED (val))
- val = NULL_TREE;
- break;
- default:
- if (LOOKUP_QUALIFIERS_ONLY (flags))
- val = NULL_TREE;
- }
-
- if (!BINDING_VALUE (old))
- BINDING_VALUE (old) = val;
- else if (val && val != BINDING_VALUE (old))
- {
- if (is_overloaded_fn (BINDING_VALUE (old))
- && is_overloaded_fn (val))
- {
- BINDING_VALUE (old) = merge_functions (BINDING_VALUE (old),
- val);
- }
- else
- {
- /* Some declarations are functions, some are not. */
- if (flags & LOOKUP_COMPLAIN)
- {
- /* If we've already given this error for this lookup,
- BINDING_VALUE (old) is error_mark_node, so let's not
- repeat ourselves. */
- if (BINDING_VALUE (old) != error_mark_node)
- {
- 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);
- }
- BINDING_VALUE (old) = error_mark_node;
- }
- }
- /* ... and copy the type. */
- type = BINDING_TYPE (new);
- if (LOOKUP_NAMESPACES_ONLY (flags))
- type = NULL_TREE;
- if (!BINDING_TYPE (old))
- BINDING_TYPE (old) = type;
- else if (type && BINDING_TYPE (old) != type)
- {
- if (flags & LOOKUP_COMPLAIN)
- {
- error ("`%D' denotes an ambiguous type",name);
- cp_error_at (" first type here", BINDING_TYPE (old));
- cp_error_at (" other type here", type);
- }
- }
- return old;
-}
-
-/* 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. */
-
-bool
-lookup_using_namespace (tree name, cxx_binding *val, tree usings,
- tree scope, int flags, tree *spacesp)
-{
- tree iter;
- cxx_binding *val1;
- timevar_push (TV_NAME_LOOKUP);
- /* Iterate over all used namespaces in current, searching for using
- directives of scope. */
- 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 = cxx_scope_find_binding_for_name (TREE_PURPOSE (iter), name);
- /* Resolve possible ambiguities. */
- if (val1)
- val = ambiguous_decl (name, val, val1, flags);
- }
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
- BINDING_VALUE (val) != error_mark_node);
-}
-
-/* [namespace.qual]
- Accepts the NAME to lookup and its qualifying SCOPE.
- Returns the name/type pair found into the cxx_binding *RESULT,
- or 0 on error. */
-
-bool
-qualified_lookup_using_namespace (tree name, tree scope, cxx_binding *result,
- int flags)
-{
- /* Maintain a list of namespaces visited... */
- tree seen = NULL_TREE;
- /* ... and a list of namespace yet to see. */
- tree todo = NULL_TREE;
- tree usings;
- timevar_push (TV_NAME_LOOKUP);
- /* Look through namespace aliases. */
- scope = ORIGINAL_NAMESPACE (scope);
- while (scope && result->value != error_mark_node)
- {
- cxx_binding *b = cxx_scope_find_binding_for_name (scope, name);
- /* Record SCOPE and resolve declaration ambiguities if NAME was
- bound in SCOPE. */
- if (b)
- {
- seen = tree_cons (scope, NULL_TREE, seen);
- result = ambiguous_decl (name, result, b, flags);
- }
- if (!BINDING_VALUE (result) && !BINDING_TYPE (result))
- /* Consider using directives. */
- for (usings = DECL_NAMESPACE_USING (scope); usings;
- usings = TREE_CHAIN (usings))
- /* If this was a real directive, and we have not seen it. */
- if (!TREE_INDIRECT_USING (usings)
- && !purpose_member (TREE_PURPOSE (usings), seen))
- todo = tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
- if (todo)
- {
- scope = TREE_PURPOSE (todo);
- todo = TREE_CHAIN (todo);
- }
- else
- scope = NULL_TREE; /* If there never was a todo list. */
- }
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, result->value != error_mark_node);
-}
-
-/* [namespace.memdef]/2 */
-
-/* Set the context of a declaration to scope. Complain if we are not
- outside scope. */
-
-void
-set_decl_namespace (decl, scope, friendp)
- tree decl;
- tree scope;
- int friendp;
-{
- tree old;
-
- /* Get rid of namespace aliases. */
- scope = ORIGINAL_NAMESPACE (scope);
-
- /* It is ok for friends to be qualified in parallel space. */
- if (!friendp && !is_ancestor (current_namespace, scope))
- error ("declaration of `%D' not in a namespace surrounding `%D'",
- decl, scope);
- DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
- if (scope != current_namespace)
- {
- /* See whether this has been declared in the namespace. */
- old = namespace_binding (DECL_NAME (decl), scope);
- 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
- point. pushdecl will find those errors later. */
- return;
- /* Since decl is a function, old should contain a function decl. */
- if (!is_overloaded_fn (old))
- goto complain;
- if (processing_template_decl || processing_specialization)
- /* We have not yet called push_template_decl to turn the
- FUNCTION_DECL into a TEMPLATE_DECL, so the declarations
- won't match. But, we'll check later, when we construct the
- template. */
- return;
- for (; old; old = OVL_NEXT (old))
- if (decls_match (decl, OVL_CURRENT (old)))
- return;
- }
- else
- return;
- complain:
- error ("`%D' should have been declared inside `%D'",
- decl, scope);
-}
-
-/* Compute the namespace where a declaration is defined. */
-
-static tree
-decl_namespace (decl)
- tree decl;
-{
- timevar_push (TV_NAME_LOOKUP);
- if (TYPE_P (decl))
- decl = TYPE_STUB_DECL (decl);
- while (DECL_CONTEXT (decl))
- {
- decl = DECL_CONTEXT (decl);
- if (TREE_CODE (decl) == NAMESPACE_DECL)
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
- if (TYPE_P (decl))
- decl = TYPE_STUB_DECL (decl);
- my_friendly_assert (DECL_P (decl), 390);
- }
-
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, global_namespace);
-}
-
-/* Return the namespace where the current declaration is declared. */
-
-tree
-current_decl_namespace ()
-{
- tree result;
- /* If we have been pushed into a different namespace, use it. */
- if (decl_namespace_list)
- return TREE_PURPOSE (decl_namespace_list);
-
- if (current_class_type)
- result = decl_namespace (TYPE_STUB_DECL (current_class_type));
- else if (current_function_decl)
- result = decl_namespace (current_function_decl);
- else
- result = current_namespace;
- return result;
-}
-
-/* Temporarily set the namespace for the current declaration. */
-
-void
-push_decl_namespace (decl)
- tree decl;
-{
- if (TREE_CODE (decl) != NAMESPACE_DECL)
- decl = decl_namespace (decl);
- decl_namespace_list = tree_cons (ORIGINAL_NAMESPACE (decl),
- NULL_TREE, decl_namespace_list);
-}
-
-void
-pop_decl_namespace ()
-{
- decl_namespace_list = TREE_CHAIN (decl_namespace_list);
-}
-
-/* Enter a class or namespace scope. */
-
-void
-push_scope (t)
- tree t;
-{
- if (TREE_CODE (t) == NAMESPACE_DECL)
- push_decl_namespace (t);
- else if (CLASS_TYPE_P (t))
- pushclass (t, 2);
-}
-
-/* Leave scope pushed by push_scope. */
-
-void
-pop_scope (t)
- tree t;
-{
- if (TREE_CODE (t) == NAMESPACE_DECL)
- pop_decl_namespace ();
- else if (CLASS_TYPE_P (t))
- popclass ();
-}
-
-/* [basic.lookup.koenig] */
-/* A nonzero return value in the functions below indicates an error. */
-
-struct arg_lookup
-{
- tree name;
- tree namespaces;
- tree classes;
- tree functions;
-};
-
-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. */
-
-static int
-add_function (k, fn)
- struct arg_lookup *k;
- tree fn;
-{
- /* 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)
- k->functions = fn;
- else if (fn == k->functions)
- ;
- else if (is_overloaded_fn (k->functions) && is_overloaded_fn (fn))
- k->functions = build_overload (fn, k->functions);
- 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;
-}
-
-/* Add functions of a namespace to the lookup structure.
- Returns 1 on error. */
-
-static int
-arg_assoc_namespace (k, scope)
- struct arg_lookup *k;
- tree scope;
-{
- tree value;
-
- if (purpose_member (scope, k->namespaces))
- return 0;
- k->namespaces = tree_cons (scope, NULL_TREE, k->namespaces);
-
- 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;
-
- 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. */
-
-static int
-arg_assoc_class (k, type)
- struct arg_lookup* k;
- tree 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);
-
- context = decl_namespace (TYPE_MAIN_DECL (type));
- if (arg_assoc_namespace (k, context))
- return 1;
-
- /* Process baseclasses. */
- for (i = 0; i < CLASSTYPE_N_BASECLASSES (type); i++)
- if (arg_assoc_class (k, TYPE_BINFO_BASETYPE (type, i)))
- return 1;
-
- /* Process friends. */
- for (list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type)); list;
- list = TREE_CHAIN (list))
- if (k->name == TREE_PURPOSE (list))
- for (friends = TREE_VALUE (list); friends;
- friends = TREE_CHAIN (friends))
- /* Only interested in global functions with potentially hidden
- (i.e. unqualified) declarations. */
- if (TREE_PURPOSE (friends) == error_mark_node && TREE_VALUE (friends)
- && CP_DECL_CONTEXT (TREE_VALUE (friends)) == context)
- if (add_function (k, TREE_VALUE (friends)))
- return 1;
-
- /* Process template arguments. */
- if (CLASSTYPE_TEMPLATE_INFO (type))
- {
- 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;
-}
-
-/* Adds everything associated with a given type.
- Returns 1 on error. */
-
-static int
-arg_assoc_type (k, type)
- struct arg_lookup *k;
- tree type;
-{
- switch (TREE_CODE (type))
- {
- case VOID_TYPE:
- case INTEGER_TYPE:
- case REAL_TYPE:
- case COMPLEX_TYPE:
- case VECTOR_TYPE:
- case CHAR_TYPE:
- case BOOLEAN_TYPE:
- return 0;
- case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_P (type))
- return arg_assoc_type (k, TYPE_PTRMEMFUNC_FN_TYPE (type));
- return arg_assoc_class (k, type);
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- case ARRAY_TYPE:
- return arg_assoc_type (k, TREE_TYPE (type));
- case UNION_TYPE:
- case ENUMERAL_TYPE:
- return arg_assoc_namespace (k, decl_namespace (TYPE_MAIN_DECL (type)));
- case OFFSET_TYPE:
- /* Pointer to member: associate class type and value type. */
- if (arg_assoc_type (k, TYPE_OFFSET_BASETYPE (type)))
- return 1;
- return arg_assoc_type (k, TREE_TYPE (type));
- case METHOD_TYPE:
- /* The basetype is referenced in the first arg type, so just
- fall through. */
- case FUNCTION_TYPE:
- /* Associate the parameter types. */
- if (arg_assoc_args (k, TYPE_ARG_TYPES (type)))
- return 1;
- /* Associate the return type. */
- return arg_assoc_type (k, TREE_TYPE (type));
- case TEMPLATE_TYPE_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:
- abort ();
- }
- return 0;
-}
-
-/* Adds everything associated with arguments. Returns 1 on error. */
-
-static int
-arg_assoc_args (k, args)
- struct arg_lookup* k;
- tree args;
-{
- for (; args; args = TREE_CHAIN (args))
- if (arg_assoc (k, TREE_VALUE (args)))
- return 1;
- return 0;
-}
-
-/* Adds everything associated with a given tree_node. Returns 1 on error. */
-
-static int
-arg_assoc (k, n)
- struct arg_lookup* k;
- tree n;
-{
- if (n == error_mark_node)
- return 0;
-
- if (TYPE_P (n))
- return arg_assoc_type (k, n);
-
- if (! type_unknown_p (n))
- return arg_assoc_type (k, TREE_TYPE (n));
-
- if (TREE_CODE (n) == ADDR_EXPR)
- n = TREE_OPERAND (n, 0);
- if (TREE_CODE (n) == COMPONENT_REF)
- n = TREE_OPERAND (n, 1);
- if (TREE_CODE (n) == OFFSET_REF)
- n = TREE_OPERAND (n, 1);
- while (TREE_CODE (n) == TREE_LIST)
- n = TREE_VALUE (n);
- if (TREE_CODE (n) == BASELINK)
- n = BASELINK_FUNCTIONS (n);
-
- if (TREE_CODE (n) == FUNCTION_DECL)
- return arg_assoc_type (k, TREE_TYPE (n));
- if (TREE_CODE (n) == TEMPLATE_ID_EXPR)
- {
- /* [basic.lookup.koenig]
-
- 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... */
- 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
- namespace. */
- template = OVL_CURRENT (template);
-
- ctx = CP_DECL_CONTEXT (template);
-
- if (TREE_CODE (ctx) == NAMESPACE_DECL)
- {
- if (arg_assoc_namespace (k, ctx) == 1)
- return 1;
- }
- /* It must be a member template. */
- else if (arg_assoc_class (k, ctx) == 1)
- return 1;
-
- /* Now the arguments. */
- for (arg = args; arg != NULL_TREE; arg = TREE_CHAIN (arg))
- if (arg_assoc_template_arg (k, TREE_VALUE (arg)) == 1)
- return 1;
- }
- else
- {
- my_friendly_assert (TREE_CODE (n) == OVERLOAD, 980715);
-
- for (; n; n = OVL_CHAIN (n))
- if (arg_assoc_type (k, TREE_TYPE (OVL_FUNCTION (n))))
- return 1;
- }
-
- return 0;
-}
-
-/* Performs Koenig lookup depending on arguments, where fns
- are the functions found in normal lookup. */
-
-tree
-lookup_arg_dependent (name, fns, args)
- tree name;
- tree fns;
- tree args;
-{
- struct arg_lookup k;
- tree fn = NULL_TREE;
-
- if (fns == error_mark_node)
- fns = NULL_TREE;
-
- timevar_push (TV_NAME_LOOKUP);
- k.name = name;
- k.functions = fns;
- k.classes = NULL_TREE;
-
- /* Note that we've already looked at some namespaces during normal
- unqualified lookup, unless we found a decl in function scope. */
- if (fns)
- fn = OVL_CURRENT (fns);
- if (fn && TREE_CODE (fn) == FUNCTION_DECL && DECL_LOCAL_FUNCTION_P (fn))
- k.namespaces = NULL_TREE;
- else
- unqualified_namespace_lookup (name, 0, &k.namespaces);
-
- arg_assoc_args (&k, args);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, k.functions);
-}
-
-/* Process a namespace-alias declaration. */
-
-void
-do_namespace_alias (alias, namespace)
- tree alias, namespace;
-{
- if (TREE_CODE (namespace) != NAMESPACE_DECL)
- {
- /* The parser did not find it, so it's not there. */
- error ("unknown namespace `%D'", namespace);
- return;
- }
-
- namespace = ORIGINAL_NAMESPACE (namespace);
-
- /* Build the alias. */
- alias = build_lang_decl (NAMESPACE_DECL, alias, void_type_node);
- DECL_NAMESPACE_ALIAS (alias) = namespace;
- pushdecl (alias);
-}
-
-/* Check a non-member using-declaration. Return the name and scope
- being used, and the USING_DECL, or NULL_TREE on failure. */
-
-static tree
-validate_nonmember_using_decl (decl, scope, name)
- tree decl;
- tree *scope;
- tree *name;
-{
- if (TREE_CODE (decl) == SCOPE_REF)
- {
- *scope = TREE_OPERAND (decl, 0);
- *name = TREE_OPERAND (decl, 1);
-
- 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
- || TREE_CODE (decl) == TEMPLATE_DECL)
- {
- *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
- abort ();
- if (DECL_P (*name))
- *name = DECL_NAME (*name);
- /* Make a USING_DECL. */
- return push_using_decl (*scope, *name);
-}
-
-/* Process local and global using-declarations. */
-
-static void
-do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
- tree scope, name;
- tree oldval, oldtype;
- tree *newval, *newtype;
-{
- cxx_binding decls;
-
- *newval = *newtype = NULL_TREE;
- cxx_binding_clear (&decls);
- if (!qualified_lookup_using_namespace (name, scope, &decls, 0))
- /* Lookup error */
- return;
-
- if (!decls.value && !decls.type)
- {
- error ("`%D' not declared", name);
- return;
- }
-
- /* Check for using functions. */
- if (decls.value && is_overloaded_fn (decls.value))
- {
- tree tmp, tmp1;
-
- if (oldval && !is_overloaded_fn (oldval))
- {
- if (!DECL_IMPLICIT_TYPEDEF_P (oldval))
- error ("`%D' is already declared in this scope", name);
- oldval = NULL_TREE;
- }
-
- *newval = oldval;
- for (tmp = decls.value; tmp; tmp = OVL_NEXT (tmp))
- {
- tree new_fn = OVL_CURRENT (tmp);
-
- /* [namespace.udecl]
-
- If a function declaration in namespace scope or block
- scope has the same name and the same parameter types as a
- function introduced by a using declaration the program is
- ill-formed. */
- for (tmp1 = oldval; tmp1; tmp1 = OVL_NEXT (tmp1))
- {
- tree old_fn = OVL_CURRENT (tmp1);
-
- 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. If both
- are the same extern "C" functions, that's ok. */
- if (decls_match (new_fn, old_fn))
- {
- /* If the OLD_FN was a builtin, there is now a
- real declaration. */
- if (DECL_ANTICIPATED (old_fn))
- DECL_ANTICIPATED (old_fn) = 0;
- break;
- }
- else if (!DECL_ANTICIPATED (old_fn))
- {
- /* If the OLD_FN was really declared, the
- declarations don't match. */
- error ("`%D' is already declared in this scope", name);
- break;
- }
-
- /* If the OLD_FN was not really there, just ignore
- it and keep going. */
- }
- }
-
- /* If we broke out of the loop, there's no reason to add
- this function to the using declarations for this
- scope. */
- if (tmp1)
- continue;
-
- *newval = build_overload (OVL_CURRENT (tmp), *newval);
- if (TREE_CODE (*newval) != OVERLOAD)
- *newval = ovl_cons (*newval, NULL_TREE);
- OVL_USED (*newval) = 1;
- }
- }
- else
- {
- *newval = decls.value;
- if (oldval && !decls_match (*newval, oldval))
- error ("`%D' is already declared in this scope", name);
- }
-
- *newtype = decls.type;
- if (oldtype && *newtype && !same_type_p (oldtype, *newtype))
- {
- error ("using declaration `%D' introduced ambiguous type `%T'",
- name, oldtype);
- return;
- }
-}
-
-/* Process a using-declaration not appearing in class or local scope. */
-
-void
-do_toplevel_using_decl (decl)
- tree decl;
-{
- tree scope, name;
- tree oldval, oldtype, newval, newtype;
- cxx_binding *binding;
-
- decl = validate_nonmember_using_decl (decl, &scope, &name);
- if (decl == NULL_TREE)
- return;
-
- /* A multiple using-declaration is valid, so we call binding_for_name,
- not just cxx_binding_make. */
- binding = binding_for_name (name, current_namespace);
-
- oldval = BINDING_VALUE (binding);
- oldtype = BINDING_TYPE (binding);
-
- do_nonmember_using_decl (scope, name, oldval, oldtype, &newval, &newtype);
-
- /* Copy declarations found. */
- if (newval)
- BINDING_VALUE (binding) = newval;
- if (newtype)
- BINDING_TYPE (binding) = newtype;
- return;
-}
-
-/* Process a using-declaration at function scope. */
-
-void
-do_local_using_decl (decl)
- tree decl;
-{
- tree scope, name;
- tree oldval, oldtype, newval, newtype;
-
- decl = validate_nonmember_using_decl (decl, &scope, &name);
- 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);
-
- do_nonmember_using_decl (scope, name, oldval, oldtype, &newval, &newtype);
-
- if (newval)
- {
- if (is_overloaded_fn (newval))
- {
- tree fn, term;
-
- /* We only need to push declarations for those functions
- that were not already bound in the current level.
- The old value might be NULL_TREE, it might be a single
- function, or an OVERLOAD. */
- if (oldval && TREE_CODE (oldval) == OVERLOAD)
- term = OVL_FUNCTION (oldval);
- else
- term = oldval;
- for (fn = newval; fn && OVL_CURRENT (fn) != term;
- fn = OVL_NEXT (fn))
- push_overloaded_decl (OVL_CURRENT (fn),
- PUSH_LOCAL | PUSH_USING);
- }
- else
- push_local_binding (name, newval, PUSH_USING);
- }
- if (newtype)
- set_identifier_type_value (name, newtype);
-}
-
-tree
-do_class_using_decl (decl)
- tree decl;
-{
- tree name, value;
-
- if (TREE_CODE (decl) != SCOPE_REF
- || !TYPE_P (TREE_OPERAND (decl, 0)))
- {
- error ("using-declaration for non-member at class scope");
- return NULL_TREE;
- }
- name = TREE_OPERAND (decl, 1);
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- 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 || TREE_CODE (name) == TEMPLATE_DECL)
- name = DECL_NAME (name);
- else if (BASELINK_P (name))
- {
- name = BASELINK_FUNCTIONS (name);
- if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
- name = TREE_OPERAND (name, 0);
- name = DECL_NAME (get_first_fn (name));
- }
-
- my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 980716);
-
- value = build_lang_decl (USING_DECL, name, void_type_node);
- DECL_INITIAL (value) = TREE_OPERAND (decl, 0);
- return value;
+ expr = build_function_call (fn, args);
+ if (processing_template_decl && expr != error_mark_node)
+ return build_min_non_dep (CALL_EXPR, expr, orig_fn, orig_args);
+ return expr;
}
-
-/* Process a using-directive. */
-
-void
-do_using_directive (namespace)
- tree namespace;
-{
- 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. */
- if (!processing_template_decl)
- error ("namespace `%T' undeclared", namespace);
- return;
- }
- if (TREE_CODE (namespace) != NAMESPACE_DECL)
- {
- if (!processing_template_decl)
- error ("`%T' is not a namespace", namespace);
- return;
- }
- namespace = ORIGINAL_NAMESPACE (namespace);
- if (!toplevel_bindings_p ())
- push_using_directive (namespace);
- else
- /* direct usage */
- add_using_namespace (current_namespace, namespace, 0);
-}
void
-check_default_args (x)
- tree x;
+check_default_args (tree x)
{
tree arg = TYPE_ARG_TYPES (TREE_TYPE (x));
- int saw_def = 0, i = 0 - (TREE_CODE (TREE_TYPE (x)) == METHOD_TYPE);
+ bool saw_def = false;
+ int i = 0 - (TREE_CODE (TREE_TYPE (x)) == METHOD_TYPE);
for (; arg && arg != void_list_node; arg = TREE_CHAIN (arg), ++i)
{
if (TREE_PURPOSE (arg))
- saw_def = 1;
+ saw_def = true;
else if (saw_def)
{
cp_error_at ("default argument missing for parameter %P of `%+#D'",
@@ -4822,8 +2961,7 @@ check_default_args (x)
}
void
-mark_used (decl)
- tree decl;
+mark_used (tree decl)
{
TREE_USED (decl) = 1;
if (processing_template_decl || skip_evaluation)
@@ -4840,6 +2978,7 @@ mark_used (decl)
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
&& DECL_ARTIFICIAL (decl)
+ && !DECL_THUNK_P (decl)
&& ! DECL_INITIAL (decl)
/* Kludge: don't synthesize for default args. */
&& current_function_decl)
@@ -4857,7 +2996,9 @@ mark_used (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)
- || (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))))
+ || (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_INLINE (DECL_TEMPLATE_RESULT
+ (template_for_substitution (decl))))))
{
bool defer;
@@ -4868,13 +3009,20 @@ mark_used (decl)
However, if instantiating this function might help us mark
the current function TREE_NOTHROW, we go ahead and
- instantiate it now. */
+ instantiate it now.
+
+ This is not needed for unit-at-a-time since we reorder the functions
+ in topological order anyway.
+ */
defer = (!flag_exceptions
+ || flag_unit_at_a_time
+ || !optimize
|| TREE_CODE (decl) != FUNCTION_DECL
/* If the called function can't throw, we don't need to
generate its body to find that out. */
|| TREE_NOTHROW (decl)
|| !cfun
+ || !current_function_decl
/* If we already know the current function can't throw,
then we don't need to work hard to prove it. */
|| TREE_NOTHROW (current_function_decl)
@@ -4887,196 +3035,4 @@ mark_used (decl)
}
}
-/* 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 nonzero, 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 (tag_kind, scope, id, attributes, defn_p, new_type_p)
- enum tag_types tag_kind;
- tree scope, id, attributes;
- int defn_p;
- int *new_type_p;
-{
- tree decl = NULL_TREE;
- tree type;
- tree current = current_scope ();
- bool xrefd_p = false;
-
- if (current == NULL_TREE)
- current = current_namespace;
-
- *new_type_p = 0;
-
- if (scope)
- {
- 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
- {
- 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, tf_error);
- 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 = xref_tag (tag_kind, id, attributes, !defn_p);
- if (decl == error_mark_node)
- return error_mark_node;
- decl = TYPE_MAIN_DECL (decl);
- xrefd_p = true;
- }
-
- type = TREE_TYPE (decl);
-
- if (!TYPE_BINFO (type))
- {
- error ("`%T' is not a class or union type", decl);
- return error_mark_node;
- }
-
- /* When `A' is a template class, using `class A' without template
- argument is invalid unless
- - we are inside the scope of the template class `A' or one of its
- specialization.
- - we are declaring the template class `A' itself. */
- if (TREE_CODE (type) == RECORD_TYPE
- && CLASSTYPE_IS_TEMPLATE (type)
- && processing_template_decl <= template_class_depth (current)
- && ! is_base_of_enclosing_class (type, current_class_type))
- {
- error ("template argument is required for `%T'", type);
- 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);
-
- if (IMPLICIT_TYPENAME_P (context))
- context = TREE_TYPE (context);
-
- /* If that scope does not contain the scope in which the
- class was originally declared, the program is invalid. */
- if (current && !is_ancestor (current, context))
- {
- error ("declaration of `%D' in `%D' which does not "
- "enclose `%D'", decl, current, CP_DECL_CONTEXT (decl));
- return NULL_TREE;
- }
-
- *new_type_p = (current != context
- && TREE_CODE (context) != TEMPLATE_TYPE_PARM
- && TREE_CODE (context) != BOUND_TEMPLATE_TEMPLATE_PARM);
- if (*new_type_p)
- push_scope (context);
-
- if (TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE)
- /* It is valid to define a class with a different class key,
- and this changes the default member access. */
- CLASSTYPE_DECLARED_CLASS (TREE_TYPE (decl))
- = (tag_kind == class_type);
-
- if (!xrefd_p && PROCESSING_REAL_TEMPLATE_DECL_P ())
- decl = push_template_decl (decl);
- }
- else
- {
- /* For elaborated type specifier in declaration like
-
- class A::B *a;
-
- we get an implicit typename here. Let's remove its
- implicitness so that we don't issue any implicit
- typename warning later. Note that when defn_p is true,
- implicitness is still required by begin_class_definition. */
- if (IMPLICIT_TYPENAME_P (type))
- decl = TYPE_STUB_DECL (build_typename_type (TYPE_CONTEXT (type),
- TYPE_IDENTIFIER (type),
- TYPENAME_TYPE_FULLNAME (type),
- NULL_TREE));
- }
-
- return decl;
-}
-
-/* Like handle_class_head but for a definition of a class specialization.
- DECL is a TYPE_DECL node representing the class. NEW_TYPE_P is set to
- nonzero, 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_apparent_template (decl, new_type_p)
- tree decl;
- int *new_type_p;
-{
- tree context;
- tree current;
-
- if (decl == error_mark_node)
- return decl;
-
- current = current_scope ();
- if (current == NULL_TREE)
- current = current_namespace;
-
- *new_type_p = 0;
-
- /* 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. */
- context = CP_DECL_CONTEXT (decl);
-
- if (IMPLICIT_TYPENAME_P (context))
- context = TREE_TYPE (context);
-
- *new_type_p = (current != context
- && TREE_CODE (context) != TEMPLATE_TYPE_PARM
- && TREE_CODE (context) != BOUND_TEMPLATE_TEMPLATE_PARM);
- if (*new_type_p)
- push_scope (context);
-
- if (TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE)
- /* We might be specializing a template with a different
- class-key. */
- CLASSTYPE_DECLARED_CLASS (TREE_TYPE (decl))
- = (current_aggr == class_type_node);
-
- return decl;
-}
-
#include "gt-cp-decl2.h"
diff --git a/contrib/gcc/cp/dump.c b/contrib/gcc/cp/dump.c
index 39e72dc..17b30c9 100644
--- a/contrib/gcc/cp/dump.c
+++ b/contrib/gcc/cp/dump.c
@@ -2,42 +2,40 @@
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com>
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "tree-dump.h"
-static void dump_access
- PARAMS ((dump_info_p, tree));
+static void dump_access (dump_info_p, tree);
-static void dump_op
- PARAMS ((dump_info_p, tree));
+static void dump_op (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;
+dump_access (dump_info_p di, tree t)
{
if (TREE_PROTECTED(t))
dump_string (di, "protected");
@@ -51,9 +49,7 @@ dump_access (di, t)
operator associated with node t. */
static void
-dump_op (di, t)
- dump_info_p di;
- tree t;
+dump_op (dump_info_p di, tree t)
{
switch (DECL_OVERLOADED_OPERATOR_P (t)) {
case NEW_EXPR:
@@ -206,10 +202,8 @@ dump_op (di, t)
}
}
-int
-cp_dump_tree (dump_info, t)
- void *dump_info;
- tree t;
+bool
+cp_dump_tree (void* dump_info, tree t)
{
enum tree_code code;
dump_info_p di = (dump_info_p) dump_info;
@@ -220,7 +214,7 @@ cp_dump_tree (dump_info, 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));
+ dump_string (di, language_to_string (DECL_LANGUAGE (t)));
}
switch (code)
@@ -229,48 +223,43 @@ cp_dump_tree (dump_info, t)
if (IDENTIFIER_OPNAME_P (t))
{
dump_string (di, "operator");
- return 1;
+ return true;
}
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;
+ return true;
}
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 OFFSET_TYPE:
+ dump_string (di, "ptrmem");
+ dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
+ dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
+ return true;
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;
+ return true;
}
+ /* Fall through. */
+ case UNION_TYPE:
/* Is it a type used as a base? */
if (TYPE_CONTEXT (t) && TREE_CODE (TYPE_CONTEXT (t)) == TREE_CODE (t)
&& CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t)
{
dump_child ("bfld", TYPE_CONTEXT (t));
- return 1;
+ return true;
}
+ if (! IS_AGGR_TYPE (t))
+ break;
+
dump_child ("vfld", TYPE_VFIELD (t));
if (CLASSTYPE_TEMPLATE_SPECIALIZATION(t))
dump_string(di, "spec");
@@ -325,21 +314,29 @@ cp_dump_tree (dump_info, 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");
- }
+ if (DECL_GLOBAL_CTOR_P (t))
+ dump_string (di, "global init");
+ if (DECL_GLOBAL_DTOR_P (t))
+ dump_string (di, "global fini");
if (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t))
dump_string (di, "pseudo tmpl");
}
else
{
+ tree virt = THUNK_VIRTUAL_OFFSET (t);
+
dump_string (di, "thunk");
- dump_int (di, "dlta", THUNK_DELTA (t));
- dump_child ("vcll", THUNK_VCALL_OFFSET (t));
+ if (DECL_THIS_THUNK_P (t))
+ dump_string (di, "this adjusting");
+ else
+ {
+ dump_string (di, "result adjusting");
+ if (virt)
+ virt = BINFO_VPTR_FIELD (virt);
+ }
+ dump_int (di, "fixd", THUNK_FIXED_OFFSET (t));
+ if (virt)
+ dump_int (di, "virt", tree_low_cst (virt, 0));
dump_child ("fn", DECL_INITIAL (t));
}
break;
diff --git a/contrib/gcc/cp/error.c b/contrib/gcc/cp/error.c
index 804c918..9c9561f 100644
--- a/contrib/gcc/cp/error.c
+++ b/contrib/gcc/cp/error.c
@@ -1,26 +1,28 @@
/* Call-backs for C++ error reporting.
This code is non-reentrant.
- Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002
- Free Software Foundation, Inc.
- This file is part of GNU CC.
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
+ 2003 Free Software Foundation, Inc.
+ This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "real.h"
@@ -28,110 +30,93 @@ Boston, MA 02111-1307, USA. */
#include "flags.h"
#include "diagnostic.h"
#include "langhooks-def.h"
+#include "cxx-pretty-print.h"
enum pad { none, before, after };
-#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_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), ", ")
+#define pp_template_argument_list_start(PP) \
+ pp_non_consecutive_character (PP, '<')
+#define pp_template_argument_list_end(PP) \
+ pp_non_consecutive_character (PP, '>')
+#define pp_separate_with_comma(PP) pp_string (PP, ", ")
/* 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;
+static cxx_pretty_printer scratch_pretty_printer;
+#define cxx_pp (&scratch_pretty_printer)
# 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 maybe_print_instantiation_context PARAMS ((diagnostic_context *));
-static void print_instantiation_full_context PARAMS ((diagnostic_context *));
-static void print_instantiation_partial_context PARAMS ((diagnostic_context *,
- tree,
- const char *, int));
-static void cp_diagnostic_starter PARAMS ((diagnostic_context *,
- diagnostic_info *));
-static void cp_diagnostic_finalizer PARAMS ((diagnostic_context *,
- diagnostic_info *));
-static void cp_print_error_function PARAMS ((diagnostic_context *,
- diagnostic_info *));
-
-static bool cp_printer PARAMS ((output_buffer *, text_info *));
-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));
+static const char *args_to_string (tree, int);
+static const char *assop_to_string (enum tree_code);
+static const char *code_to_string (enum tree_code);
+static const char *cv_to_string (tree, int);
+static const char *decl_to_string (tree, int);
+static const char *expr_to_string (tree);
+static const char *fndecl_to_string (tree, int);
+static const char *op_to_string (enum tree_code);
+static const char *parm_to_string (int);
+static const char *type_to_string (tree, int);
+
+static void dump_type (tree, int);
+static void dump_typename (tree, int);
+static void dump_simple_decl (tree, tree, int);
+static void dump_decl (tree, int);
+static void dump_template_decl (tree, int);
+static void dump_function_decl (tree, int);
+static void dump_expr (tree, int);
+static void dump_unary_op (const char *, tree, int);
+static void dump_binary_op (const char *, tree, int);
+static void dump_aggr_type (tree, int);
+static enum pad dump_type_prefix (tree, int);
+static void dump_type_suffix (tree, int);
+static void dump_function_name (tree, int);
+static void dump_expr_list (tree, int);
+static void dump_global_iord (tree);
+static enum pad dump_qualifiers (tree, enum pad);
+static void dump_parameters (tree, int);
+static void dump_exception_spec (tree, int);
+static const char *class_key_or_enum (tree);
+static void dump_template_argument (tree, int);
+static void dump_template_argument_list (tree, int);
+static void dump_template_parameter (tree, int);
+static void dump_template_bindings (tree, tree);
+static void dump_scope (tree, int);
+static void dump_template_parms (tree, int, int);
+
+static const char *function_category (tree);
+static void maybe_print_instantiation_context (diagnostic_context *);
+static void print_instantiation_full_context (diagnostic_context *);
+static void print_instantiation_partial_context (diagnostic_context *,
+ tree, location_t);
+static void cp_diagnostic_starter (diagnostic_context *, diagnostic_info *);
+static void cp_diagnostic_finalizer (diagnostic_context *, diagnostic_info *);
+static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
+
+static bool cp_printer (pretty_printer *, text_info *);
+static void pp_non_consecutive_character (cxx_pretty_printer *, int);
+static tree locate_error (const char *, va_list);
+static location_t location_of (tree);
void
-init_error ()
+init_error (void)
{
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);
+ pp_construct (pp_base (cxx_pp), NULL, 0);
+ pp_cxx_pretty_printer_init (cxx_pp);
}
/* Dump a scope, if deemed necessary. */
static void
-dump_scope (scope, flags)
- tree scope;
- int flags;
+dump_scope (tree scope, int flags)
{
int f = ~TFF_RETURN_TYPE & (flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF));
@@ -143,18 +128,18 @@ dump_scope (scope, flags)
if (scope != global_namespace)
{
dump_decl (scope, f);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
}
}
else if (AGGREGATE_TYPE_P (scope))
{
dump_type (scope, f);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
}
else if ((flags & TFF_SCOPE) && TREE_CODE (scope) == FUNCTION_DECL)
{
dump_function_decl (scope, f);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
}
}
@@ -162,9 +147,7 @@ dump_scope (scope, flags)
indication of whether we dumped something. */
static enum pad
-dump_qualifiers (t, p)
- tree t;
- enum pad p;
+dump_qualifiers (tree t, enum pad p)
{
static const int masks[] =
{TYPE_QUAL_CONST, TYPE_QUAL_VOLATILE, TYPE_QUAL_RESTRICT};
@@ -180,28 +163,22 @@ dump_qualifiers (t, p)
if (masks[ix] & quals)
{
if (p == before)
- output_add_space (scratch_buffer);
+ pp_space (cxx_pp);
p = before;
- print_identifier (scratch_buffer, names[ix]);
+ pp_identifier (cxx_pp, names[ix]);
}
if (do_after)
- output_add_space (scratch_buffer);
+ pp_space (cxx_pp);
}
else
p = none;
return p;
}
-/* This must be large enough to hold any printed integer or floating-point
- value. */
-static char digit_buffer[128];
-
/* Dump the template ARGument under control of FLAGS. */
static void
-dump_template_argument (arg, flags)
- tree arg;
- int flags;
+dump_template_argument (tree arg, int flags)
{
if (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)
dump_type (arg, flags & ~TFF_CLASS_KEY_OR_ENUM);
@@ -213,9 +190,7 @@ dump_template_argument (arg, flags)
of FLAGS. */
static void
-dump_template_argument_list (args, flags)
- tree args;
- int flags;
+dump_template_argument_list (tree args, int flags)
{
int n = TREE_VEC_LENGTH (args);
int need_comma = 0;
@@ -224,7 +199,7 @@ dump_template_argument_list (args, flags)
for (i = 0; i< n; ++i)
{
if (need_comma)
- separate_with_comma (scratch_buffer);
+ pp_separate_with_comma (cxx_pp);
dump_template_argument (TREE_VEC_ELT (args, i), flags);
need_comma = 1;
}
@@ -233,9 +208,7 @@ dump_template_argument_list (args, flags)
/* Dump a template parameter PARM (a TREE_LIST) under control of FLAGS. */
static void
-dump_template_parameter (parm, flags)
- tree parm;
- int flags;
+dump_template_parameter (tree parm, int flags)
{
tree p = TREE_VALUE (parm);
tree a = TREE_PURPOSE (parm);
@@ -244,24 +217,24 @@ dump_template_parameter (parm, flags)
{
if (flags & TFF_DECL_SPECIFIERS)
{
- print_identifier (scratch_buffer, "class");
+ pp_identifier (cxx_pp, "class");
if (DECL_NAME (p))
{
- output_add_space (scratch_buffer);
- print_tree_identifier (scratch_buffer, DECL_NAME (p));
+ pp_space (cxx_pp);
+ pp_tree_identifier (cxx_pp, DECL_NAME (p));
}
}
else if (DECL_NAME (p))
- print_tree_identifier (scratch_buffer, DECL_NAME (p));
+ pp_tree_identifier (cxx_pp, DECL_NAME (p));
else
- print_identifier (scratch_buffer, "{template default argument error}");
+ pp_cxx_canonical_template_parameter (cxx_pp, TREE_TYPE (p));
}
else
dump_decl (p, flags | TFF_DECL_SPECIFIERS);
if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && a != NULL_TREE)
{
- output_add_string (scratch_buffer, " = ");
+ pp_string (cxx_pp, " = ");
if (TREE_CODE (p) == TYPE_DECL || TREE_CODE (p) == TEMPLATE_DECL)
dump_type (a, flags & ~TFF_CHASE_TYPEDEF);
else
@@ -274,8 +247,7 @@ dump_template_parameter (parm, flags)
TREE_VEC. */
static void
-dump_template_bindings (parms, args)
- tree parms, args;
+dump_template_bindings (tree parms, tree args)
{
int need_comma = 0;
@@ -299,13 +271,13 @@ dump_template_bindings (parms, args)
}
if (need_comma)
- separate_with_comma (scratch_buffer);
+ pp_separate_with_comma (cxx_pp);
dump_template_parameter (TREE_VEC_ELT (p, i), TFF_PLAIN_IDENTIFIER);
- output_add_string (scratch_buffer, " = ");
+ pp_string (cxx_pp, " = ");
if (arg)
dump_template_argument (arg, TFF_PLAIN_IDENTIFIER);
else
- print_identifier (scratch_buffer, "<missing>");
+ pp_identifier (cxx_pp, "<missing>");
++arg_idx;
need_comma = 1;
@@ -319,9 +291,7 @@ dump_template_bindings (parms, args)
format. */
static void
-dump_type (t, flags)
- tree t;
- int flags;
+dump_type (tree t, int flags)
{
if (t == NULL_TREE)
return;
@@ -332,7 +302,7 @@ dump_type (t, flags)
switch (TREE_CODE (t))
{
case UNKNOWN_TYPE:
- print_identifier (scratch_buffer, "<unknown type>");
+ pp_identifier (cxx_pp, "<unknown type>");
break;
case TREE_LIST:
@@ -341,7 +311,7 @@ dump_type (t, flags)
break;
case IDENTIFIER_NODE:
- print_tree_identifier (scratch_buffer, t);
+ pp_tree_identifier (cxx_pp, t);
break;
case TREE_VEC:
@@ -361,80 +331,49 @@ dump_type (t, flags)
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), flags);
break;
}
- /* else fallthrough */
+ /* Else fall through. */
case TEMPLATE_DECL:
case NAMESPACE_DECL:
dump_decl (t, flags & ~TFF_DECL_SPECIFIERS);
break;
- case COMPLEX_TYPE:
- output_add_string (scratch_buffer, "__complex__ ");
- dump_type (TREE_TYPE (t), flags);
- break;
-
- case VECTOR_TYPE:
- output_add_string (scratch_buffer, "vector ");
- {
- /* The subtype of a VECTOR_TYPE is something like intQI_type_node,
- which has no name and is not very useful for diagnostics. So
- look up the equivalent C type and print its name. */
- tree elt = TREE_TYPE (t);
- elt = c_common_type_for_mode (TYPE_MODE (elt), TREE_UNSIGNED (elt));
- dump_type (elt, flags);
- }
- break;
-
case INTEGER_TYPE:
- if (!TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)) && TREE_UNSIGNED (t))
- output_add_string (scratch_buffer, "unsigned ");
- else if (TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)) && !TREE_UNSIGNED (t))
- output_add_string (scratch_buffer, "signed ");
-
- /* fall through. */
case REAL_TYPE:
case VOID_TYPE:
case BOOLEAN_TYPE:
- {
- tree type;
- dump_qualifiers (t, after);
- type = flags & TFF_CHASE_TYPEDEF ? TYPE_MAIN_VARIANT (t) : t;
- if (TYPE_NAME (type) && 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. */
- print_identifier (scratch_buffer, "<anonymous>");
- }
+ case COMPLEX_TYPE:
+ case VECTOR_TYPE:
+ pp_base (cxx_pp)->padding = pp_none;
+ pp_type_specifier_seq (cxx_pp, t);
break;
case TEMPLATE_TEMPLATE_PARM:
/* For parameters inside template signature. */
if (TYPE_IDENTIFIER (t))
- print_tree_identifier (scratch_buffer, TYPE_IDENTIFIER (t));
+ pp_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
else
- print_identifier
- (scratch_buffer, "<anonymous template template parameter>");
+ pp_cxx_canonical_template_parameter (cxx_pp, t);
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_qualifiers (t, after);
+ pp_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
+ pp_template_argument_list_start (cxx_pp);
dump_template_argument_list (args, flags);
- print_template_argument_list_end (scratch_buffer);
+ pp_template_argument_list_end (cxx_pp);
}
break;
case TEMPLATE_TYPE_PARM:
dump_qualifiers (t, after);
if (TYPE_IDENTIFIER (t))
- print_tree_identifier (scratch_buffer, TYPE_IDENTIFIER (t));
+ pp_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
else
- print_identifier
- (scratch_buffer, "<anonymous template type parameter>");
+ pp_cxx_canonical_template_parameter
+ (cxx_pp, TEMPLATE_TYPE_PARM_INDEX (t));
break;
/* This is not always necessary for pointers and such, but doing this
@@ -452,30 +391,30 @@ dump_type (t, flags)
break;
}
case TYPENAME_TYPE:
- if (!IMPLICIT_TYPENAME_P (t))
- output_add_string (scratch_buffer, "typename ");
+ dump_qualifiers (t, after);
+ pp_string (cxx_pp, "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 ");
+ pp_colon_colon (cxx_pp);
+ pp_identifier (cxx_pp, "template ");
dump_type (DECL_NAME (TYPE_NAME (t)), flags);
break;
case TYPEOF_TYPE:
- output_add_string (scratch_buffer, "__typeof (");
+ pp_string (cxx_pp, "__typeof (");
dump_expr (TYPE_FIELDS (t), flags & ~TFF_EXPR_IN_PARENS);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
break;
default:
- sorry_for_unsupported_tree (t);
+ pp_unsupported_tree (cxx_pp, t);
/* Fall through to error. */
case ERROR_MARK:
- print_identifier (scratch_buffer, "<type error>");
+ pp_identifier (cxx_pp, "<type error>");
break;
}
}
@@ -484,9 +423,7 @@ dump_type (t, flags)
a TYPENAME_TYPE. */
static void
-dump_typename (t, flags)
- tree t;
- int flags;
+dump_typename (tree t, int flags)
{
tree ctx = TYPE_CONTEXT (t);
@@ -494,15 +431,14 @@ dump_typename (t, flags)
dump_typename (ctx, flags);
else
dump_type (ctx, flags & ~TFF_CLASS_KEY_OR_ENUM);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
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;
+class_key_or_enum (tree t)
{
if (TREE_CODE (t) == ENUMERAL_TYPE)
return "enum";
@@ -518,9 +454,7 @@ class_key_or_enum (t)
in the form `class foo'. */
static void
-dump_aggr_type (t, flags)
- tree t;
- int flags;
+dump_aggr_type (tree t, int flags)
{
tree name;
const char *variety = class_key_or_enum (t);
@@ -531,8 +465,8 @@ dump_aggr_type (t, flags)
if (flags & TFF_CLASS_KEY_OR_ENUM)
{
- print_identifier (scratch_buffer, variety);
- output_add_space (scratch_buffer);
+ pp_identifier (cxx_pp, variety);
+ pp_space (cxx_pp);
}
if (flags & TFF_CHASE_TYPEDEF)
@@ -566,12 +500,12 @@ dump_aggr_type (t, flags)
if (name == 0 || ANON_AGGRNAME_P (name))
{
if (flags & TFF_CLASS_KEY_OR_ENUM)
- print_identifier (scratch_buffer, "<anonymous>");
+ pp_identifier (cxx_pp, "<anonymous>");
else
- output_printf (scratch_buffer, "<anonymous %s>", variety);
+ pp_printf (pp_base (cxx_pp), "<anonymous %s>", variety);
}
else
- print_tree_identifier (scratch_buffer, name);
+ pp_tree_identifier (cxx_pp, name);
if (tmplate)
dump_template_parms (TYPE_TEMPLATE_INFO (t),
!CLASSTYPE_USE_TEMPLATE (t),
@@ -593,9 +527,7 @@ dump_aggr_type (t, flags)
want to pad non-*, non-& cores, but not pad * or & types. */
static enum pad
-dump_type_prefix (t, flags)
- tree t;
- int flags;
+dump_type_prefix (tree t, int flags)
{
enum pad padding = before;
@@ -613,19 +545,13 @@ dump_type_prefix (t, flags)
tree sub = TREE_TYPE (t);
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))
+ if (TREE_CODE (sub) == ARRAY_TYPE)
{
- 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);
+ pp_space (cxx_pp);
+ pp_left_paren (cxx_pp);
}
+ pp_character (cxx_pp, "&*"[TREE_CODE (t) == POINTER_TYPE]);
+ padding = dump_qualifiers (t, before);
}
break;
@@ -635,11 +561,11 @@ dump_type_prefix (t, flags)
if (TREE_CODE (t) == OFFSET_TYPE) /* pmfs deal with this in d_t_p */
{
if (padding != none)
- output_add_space (scratch_buffer);
+ pp_space (cxx_pp);
dump_type (TYPE_OFFSET_BASETYPE (t), flags);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
}
- output_add_character (scratch_buffer, '*');
+ pp_star (cxx_pp);
padding = dump_qualifiers (t, none);
break;
@@ -648,19 +574,19 @@ dump_type_prefix (t, flags)
case FUNCTION_TYPE:
padding = dump_type_prefix (TREE_TYPE (t), flags);
if (padding != none)
- output_add_space (scratch_buffer);
- print_left_paren (scratch_buffer);
+ pp_space (cxx_pp);
+ pp_left_paren (cxx_pp);
padding = none;
break;
case METHOD_TYPE:
padding = dump_type_prefix (TREE_TYPE (t), flags);
if (padding != none)
- output_add_space (scratch_buffer);
- print_left_paren (scratch_buffer);
+ pp_space (cxx_pp);
+ pp_left_paren (cxx_pp);
padding = none;
dump_aggr_type (TYPE_METHOD_BASETYPE (t), flags);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
break;
case ARRAY_TYPE:
@@ -691,10 +617,10 @@ dump_type_prefix (t, flags)
break;
default:
- sorry_for_unsupported_tree (t);
+ pp_unsupported_tree (cxx_pp, t);
/* fall through. */
case ERROR_MARK:
- print_identifier (scratch_buffer, "<typeprefixerror>");
+ pp_identifier (cxx_pp, "<typeprefixerror>");
break;
}
return padding;
@@ -704,9 +630,7 @@ dump_type_prefix (t, flags)
which appears after the identifier (or function parms). */
static void
-dump_type_suffix (t, flags)
- tree t;
- int flags;
+dump_type_suffix (tree t, int flags)
{
if (TYPE_PTRMEMFUNC_P (t))
t = TYPE_PTRMEMFUNC_FN_TYPE (t);
@@ -717,16 +641,16 @@ dump_type_suffix (t, flags)
case REFERENCE_TYPE:
case OFFSET_TYPE:
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
dump_type_suffix (TREE_TYPE (t), flags);
break;
- /* Can only be reached through function pointer */
+ /* Can only be reached through function pointer. */
case FUNCTION_TYPE:
case METHOD_TYPE:
{
tree arg;
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
arg = TYPE_ARG_TYPES (t);
if (TREE_CODE (t) == METHOD_TYPE)
arg = TREE_CHAIN (arg);
@@ -744,13 +668,12 @@ dump_type_suffix (t, flags)
}
case ARRAY_TYPE:
- print_left_bracket (scratch_buffer);
+ pp_left_bracket (cxx_pp);
if (TYPE_DOMAIN (t))
{
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);
+ pp_wide_integer
+ (cxx_pp, 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),
flags & ~TFF_EXPR_IN_PARENS);
@@ -760,7 +683,7 @@ dump_type_suffix (t, flags)
integer_one_node)),
flags & ~TFF_EXPR_IN_PARENS);
}
- print_right_bracket (scratch_buffer);
+ pp_right_bracket (cxx_pp);
dump_type_suffix (TREE_TYPE (t), flags);
break;
@@ -786,7 +709,7 @@ dump_type_suffix (t, flags)
break;
default:
- sorry_for_unsupported_tree (t);
+ pp_unsupported_tree (cxx_pp, t);
case ERROR_MARK:
/* Don't mark it here, we should have already done in
dump_type_prefix. */
@@ -795,8 +718,7 @@ dump_type_suffix (t, flags)
}
static void
-dump_global_iord (t)
- tree t;
+dump_global_iord (tree t)
{
const char *p = NULL;
@@ -807,26 +729,23 @@ dump_global_iord (t)
else
abort ();
- output_printf (scratch_buffer, "(static %s for %s)", p, input_filename);
+ pp_printf (pp_base (cxx_pp), "(static %s for %s)", p, input_filename);
}
static void
-dump_simple_decl (t, type, flags)
- tree t;
- tree type;
- int flags;
+dump_simple_decl (tree t, tree type, int flags)
{
if (flags & TFF_DECL_SPECIFIERS)
{
if (dump_type_prefix (type, flags) != none)
- output_add_space (scratch_buffer);
+ pp_space (cxx_pp);
}
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), flags);
else
- print_identifier (scratch_buffer, "<anonymous>");
+ pp_identifier (cxx_pp, "<anonymous>");
if (flags & TFF_DECL_SPECIFIERS)
dump_type_suffix (type, flags);
}
@@ -834,9 +753,7 @@ dump_simple_decl (t, type, flags)
/* Dump a human readable string for the decl T under control of FLAGS. */
static void
-dump_decl (t, flags)
- tree t;
- int flags;
+dump_decl (tree t, int flags)
{
if (t == NULL_TREE)
return;
@@ -851,14 +768,14 @@ dump_decl (t, flags)
if ((flags & TFF_DECL_SPECIFIERS)
&& TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
/* Say `class T' not just `T'. */
- output_add_string (scratch_buffer, "class ");
+ pp_string (cxx_pp, "class ");
dump_type (TREE_TYPE (t), flags);
break;
}
}
if (flags & TFF_DECL_SPECIFIERS)
- output_add_string (scratch_buffer, "typedef ");
+ pp_string (cxx_pp, "typedef ");
dump_simple_decl (t, DECL_ORIGINAL_TYPE (t)
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t),
flags);
@@ -867,41 +784,47 @@ dump_decl (t, flags)
case VAR_DECL:
if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t)))
{
- output_add_string (scratch_buffer, "vtable for ");
+ pp_string (cxx_pp, "vtable for ");
my_friendly_assert (TYPE_P (DECL_CONTEXT (t)), 20010720);
dump_type (DECL_CONTEXT (t), flags);
break;
}
- /* else fall through */
+ /* Else fall through. */
case FIELD_DECL:
case PARM_DECL:
+ case ALIAS_DECL:
dump_simple_decl (t, TREE_TYPE (t), flags);
break;
case RESULT_DECL:
- output_add_string (scratch_buffer, "<return value> ");
+ pp_string (cxx_pp, "<return value> ");
dump_simple_decl (t, TREE_TYPE (t), flags);
break;
case NAMESPACE_DECL:
- dump_scope (CP_DECL_CONTEXT (t), flags);
- if (DECL_NAME (t) == anonymous_namespace_name)
- print_identifier (scratch_buffer, "<unnamed>");
+ if (flags & TFF_DECL_SPECIFIERS)
+ pp_cxx_declaration (cxx_pp, t);
else
- print_tree_identifier (scratch_buffer, DECL_NAME (t));
+ {
+ dump_scope (CP_DECL_CONTEXT (t), flags);
+ if (DECL_NAME (t) == NULL_TREE)
+ pp_identifier (cxx_pp, "<unnamed>");
+ else
+ pp_tree_identifier (cxx_pp, DECL_NAME (t));
+ }
break;
case SCOPE_REF:
dump_decl (TREE_OPERAND (t, 0), flags & ~TFF_DECL_SPECIFIERS);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
dump_decl (TREE_OPERAND (t, 1), flags);
break;
case ARRAY_REF:
dump_decl (TREE_OPERAND (t, 0), flags);
- print_left_bracket (scratch_buffer);
+ pp_left_bracket (cxx_pp);
dump_decl (TREE_OPERAND (t, 1), flags);
- print_right_bracket (scratch_buffer);
+ pp_right_bracket (cxx_pp);
break;
/* So that we can do dump_decl on an aggr type. */
@@ -911,6 +834,13 @@ dump_decl (t, flags)
dump_type (t, flags);
break;
+ case BIT_NOT_EXPR:
+ /* This is a pseudo destructor call which has not been folded into
+ a PSEUDO_DTOR_EXPR yet. */
+ pp_complement (cxx_pp);
+ dump_type (TREE_OPERAND (t, 0), flags);
+ break;
+
case TYPE_EXPR:
abort ();
break;
@@ -920,13 +850,13 @@ dump_decl (t, flags)
case IDENTIFIER_NODE:
if (IDENTIFIER_TYPENAME_P (t))
{
- output_add_string (scratch_buffer, "operator ");
+ pp_string (cxx_pp, "operator ");
/* Not exactly IDENTIFIER_TYPE_VALUE. */
dump_type (TREE_TYPE (t), flags);
break;
}
else
- print_tree_identifier (scratch_buffer, t);
+ pp_tree_identifier (cxx_pp, t);
break;
case OVERLOAD:
@@ -936,12 +866,12 @@ dump_decl (t, flags)
if (DECL_CLASS_SCOPE_P (t))
{
dump_type (DECL_CONTEXT (t), flags);
- output_add_string (scratch_buffer, "::");
+ pp_colon_colon (cxx_pp);
}
else if (DECL_CONTEXT (t))
{
dump_decl (DECL_CONTEXT (t), flags);
- output_add_string (scratch_buffer, "::");
+ pp_colon_colon (cxx_pp);
}
dump_decl (DECL_NAME (t), flags);
break;
@@ -956,7 +886,7 @@ dump_decl (t, flags)
if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
dump_global_iord (t);
else if (! DECL_LANG_SPECIFIC (t))
- print_identifier (scratch_buffer, "<internal>");
+ pp_identifier (cxx_pp, "<internal>");
else
dump_function_decl (t, flags);
break;
@@ -967,28 +897,20 @@ dump_decl (t, flags)
case TEMPLATE_ID_EXPR:
{
- tree args;
tree name = TREE_OPERAND (t, 0);
+
if (is_overloaded_fn (name))
name = DECL_NAME (get_first_fn (name));
dump_decl (name, flags);
- print_template_argument_list_start (scratch_buffer);
- for (args = TREE_OPERAND (t, 1); args; args = TREE_CHAIN (args))
- {
- dump_template_argument (TREE_VALUE (args), flags);
- if (TREE_CHAIN (args))
- separate_with_comma (scratch_buffer);
- }
- print_template_argument_list_end (scratch_buffer);
+ pp_template_argument_list_start (cxx_pp);
+ if (TREE_OPERAND (t, 1))
+ dump_template_argument_list (TREE_OPERAND (t, 1), flags);
+ pp_template_argument_list_end (cxx_pp);
}
break;
- case LOOKUP_EXPR:
- dump_decl (TREE_OPERAND (t, 0), flags);
- break;
-
case LABEL_DECL:
- print_tree_identifier (scratch_buffer, DECL_NAME (t));
+ pp_tree_identifier (cxx_pp, DECL_NAME (t));
break;
case CONST_DECL:
@@ -1001,13 +923,13 @@ dump_decl (t, flags)
else if (DECL_INITIAL (t))
dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS);
else
- print_identifier (scratch_buffer, "enumerator");
+ pp_identifier (cxx_pp, "<enumerator>");
break;
case USING_DECL:
- output_add_string (scratch_buffer, "using ");
+ pp_string (cxx_pp, "using ");
dump_type (DECL_INITIAL (t), flags);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
dump_decl (DECL_NAME (t), flags);
break;
@@ -1015,12 +937,23 @@ dump_decl (t, flags)
dump_decl (BASELINK_FUNCTIONS (t), flags);
break;
+ case NON_DEPENDENT_EXPR:
+ dump_expr (t, flags);
+ break;
+
+ case TEMPLATE_TYPE_PARM:
+ if (flags & TFF_DECL_SPECIFIERS)
+ pp_cxx_declaration (cxx_pp, t);
+ else
+ pp_type_id (cxx_pp, t);
+ break;
+
default:
- sorry_for_unsupported_tree (t);
+ pp_unsupported_tree (cxx_pp, t);
/* Fallthrough to error. */
case ERROR_MARK:
- print_identifier (scratch_buffer, "<declaration error>");
+ pp_identifier (cxx_pp, "<declaration error>");
break;
}
}
@@ -1029,9 +962,7 @@ dump_decl (t, flags)
'template <...> leaders plus the 'class X' or 'void fn(...)' part. */
static void
-dump_template_decl (t, flags)
- tree t;
- int flags;
+dump_template_decl (tree t, int flags)
{
tree orig_parms = DECL_TEMPLATE_PARMS (t);
tree parms;
@@ -1046,7 +977,7 @@ dump_template_decl (t, flags)
tree inner_parms = INNERMOST_TEMPLATE_PARMS (parms);
int len = TREE_VEC_LENGTH (inner_parms);
- output_add_string (scratch_buffer, "template<");
+ pp_string (cxx_pp, "template<");
/* If we've shown the template prefix, we'd better show the
parameters' and decl's type too. */
@@ -1055,17 +986,17 @@ dump_template_decl (t, flags)
for (i = 0; i < len; i++)
{
if (i)
- separate_with_comma (scratch_buffer);
+ pp_separate_with_comma (cxx_pp);
dump_template_parameter (TREE_VEC_ELT (inner_parms, i), flags);
}
- print_template_argument_list_end (scratch_buffer);
- output_add_space (scratch_buffer);
+ pp_template_argument_list_end (cxx_pp);
+ pp_space (cxx_pp);
}
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 ");
+ pp_string (cxx_pp, "class ");
}
if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
@@ -1097,9 +1028,7 @@ dump_template_decl (t, flags)
is %D which doesn't print the throw specs, and %F which does. */
static void
-dump_function_decl (t, flags)
- tree t;
- int flags;
+dump_function_decl (tree t, int flags)
{
tree fntype;
tree parmtypes;
@@ -1130,16 +1059,16 @@ dump_function_decl (t, flags)
if (DECL_CLASS_SCOPE_P (t))
cname = DECL_CONTEXT (t);
- /* this is for partially instantiated template methods */
+ /* This is for partially instantiated template methods. */
else if (TREE_CODE (fntype) == METHOD_TYPE)
cname = TREE_TYPE (TREE_VALUE (parmtypes));
if (!(flags & TFF_DECL_SPECIFIERS))
/* OK */;
else if (DECL_STATIC_FUNCTION_P (t))
- print_identifier (scratch_buffer, "static ");
+ pp_identifier (cxx_pp, "static ");
else if (DECL_VIRTUAL_P (t))
- print_identifier (scratch_buffer, "virtual ");
+ pp_identifier (cxx_pp, "virtual ");
/* Print the return type? */
if (show_return)
@@ -1148,21 +1077,21 @@ dump_function_decl (t, flags)
if (show_return)
{
dump_type_prefix (TREE_TYPE (fntype), flags);
- output_add_space (scratch_buffer);
+ pp_space (cxx_pp);
}
/* Print the function name. */
if (cname)
{
dump_type (cname, flags);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
}
else
dump_scope (CP_DECL_CONTEXT (t), flags);
dump_function_name (t, flags);
- if (1)
+ if (!(flags & TFF_NO_FUNCTION_ARGUMENTS))
{
dump_parameters (parmtypes, flags);
@@ -1180,9 +1109,9 @@ dump_function_decl (t, flags)
/* If T is a template instantiation, dump the parameter binding. */
if (template_parms != NULL_TREE && template_args != NULL_TREE)
{
- output_add_string (scratch_buffer, " [with ");
+ pp_string (cxx_pp, " [with ");
dump_template_bindings (template_parms, template_args);
- print_right_bracket (scratch_buffer);
+ pp_right_bracket (cxx_pp);
}
}
@@ -1191,47 +1120,43 @@ dump_function_decl (t, flags)
already been removed. */
static void
-dump_parameters (parmtypes, flags)
- tree parmtypes;
- int flags;
+dump_parameters (tree parmtypes, int flags)
{
int first;
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
for (first = 1; parmtypes != void_list_node;
parmtypes = TREE_CHAIN (parmtypes))
{
if (!first)
- separate_with_comma (scratch_buffer);
+ pp_separate_with_comma (cxx_pp);
first = 0;
if (!parmtypes)
{
- print_identifier (scratch_buffer, "...");
+ pp_identifier (cxx_pp, "...");
break;
}
dump_type (TREE_VALUE (parmtypes), flags);
if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && TREE_PURPOSE (parmtypes))
{
- output_add_string (scratch_buffer, " = ");
+ pp_string (cxx_pp, " = ");
dump_expr (TREE_PURPOSE (parmtypes), flags | TFF_EXPR_IN_PARENS);
}
}
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
}
/* Print an exception specification. T is the exception specification. */
static void
-dump_exception_spec (t, flags)
- tree t;
- int flags;
+dump_exception_spec (tree t, int flags)
{
if (t)
{
- output_add_string (scratch_buffer, " throw (");
+ pp_string (cxx_pp, " throw (");
if (TREE_VALUE (t) != NULL_TREE)
while (1)
{
@@ -1239,9 +1164,9 @@ dump_exception_spec (t, flags)
t = TREE_CHAIN (t);
if (!t)
break;
- separate_with_comma (scratch_buffer);
+ pp_separate_with_comma (cxx_pp);
}
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
}
}
@@ -1249,9 +1174,7 @@ dump_exception_spec (t, flags)
and destructors properly. */
static void
-dump_function_name (t, flags)
- tree t;
- int flags;
+dump_function_name (tree t, int flags)
{
tree name = DECL_NAME (t);
@@ -1265,7 +1188,7 @@ dump_function_name (t, flags)
if (DECL_DESTRUCTOR_P (t))
{
- output_add_character (scratch_buffer, '~');
+ pp_complement (cxx_pp);
dump_decl (name, TFF_PLAIN_IDENTIFIER);
}
else if (DECL_CONV_FN_P (t))
@@ -1276,11 +1199,11 @@ dump_function_name (t, flags)
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. */
- output_add_string (scratch_buffer, "operator ");
+ pp_string (cxx_pp, "operator ");
dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
}
else if (IDENTIFIER_OPNAME_P (name))
- print_tree_identifier (scratch_buffer, name);
+ pp_tree_identifier (cxx_pp, name);
else
dump_decl (name, flags);
@@ -1300,57 +1223,37 @@ dump_function_name (t, flags)
decoration. */
static void
-dump_template_parms (info, primary, flags)
- tree info;
- int primary;
- int flags;
+dump_template_parms (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);
+ pp_template_argument_list_start (cxx_pp);
/* Be careful only to print things when we have them, so as not
to crash producing error messages. */
if (args && !primary)
{
- int len = 0;
- int ix = 0;
- int need_comma = 0;
+ int len, ix;
- 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);
+ if (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (args))
+ args = TREE_VEC_ELT (args, TREE_VEC_LENGTH (args) - 1);
+
+ len = TREE_VEC_LENGTH (args);
- len = TREE_VEC_LENGTH (args);
- }
- else if (TREE_CODE (args) == TREE_LIST)
- len = -1;
- while (ix != len && args)
+ for (ix = 0; ix != len; ix++)
{
- 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);
+ tree arg = TREE_VEC_ELT (args, ix);
+
+ if (ix)
+ pp_separate_with_comma (cxx_pp);
if (!arg)
- print_identifier (scratch_buffer, "<template parameter error>");
+ pp_identifier (cxx_pp, "<template parameter error>");
else
dump_template_argument (arg, flags);
- need_comma = 1;
}
}
else if (primary)
@@ -1367,83 +1270,32 @@ dump_template_parms (info, primary, flags)
tree parm = TREE_VALUE (TREE_VEC_ELT (parms, ix));
if (ix)
- separate_with_comma (scratch_buffer);
+ pp_separate_with_comma (cxx_pp);
dump_decl (parm, flags & ~TFF_DECL_SPECIFIERS);
}
}
- print_template_argument_list_end (scratch_buffer);
+ pp_template_argument_list_end (cxx_pp);
}
-static void
-dump_char (c)
- int c;
-{
- switch (c)
- {
- case TARGET_NEWLINE:
- output_add_string (scratch_buffer, "\\n");
- break;
- case TARGET_TAB:
- output_add_string (scratch_buffer, "\\t");
- break;
- case TARGET_VT:
- output_add_string (scratch_buffer, "\\v");
- break;
- case TARGET_BS:
- output_add_string (scratch_buffer, "\\b");
- break;
- case TARGET_CR:
- output_add_string (scratch_buffer, "\\r");
- break;
- case TARGET_FF:
- output_add_string (scratch_buffer, "\\f");
- break;
- case TARGET_BELL:
- output_add_string (scratch_buffer, "\\a");
- break;
- case '\\':
- output_add_string (scratch_buffer, "\\\\");
- break;
- case '\'':
- output_add_string (scratch_buffer, "\\'");
- break;
- case '\"':
- output_add_string (scratch_buffer, "\\\"");
- break;
- default:
- if (ISPRINT (c))
- output_add_character (scratch_buffer, c);
- else
- {
- sprintf (digit_buffer, "\\%03o", (int) c);
- output_add_string (scratch_buffer, digit_buffer);
- }
- }
-}
-
-/* Print out a list of initializers (subr of dump_expr) */
+/* Print out a list of initializers (subr of dump_expr). */
static void
-dump_expr_list (l, flags)
- tree l;
- int flags;
+dump_expr_list (tree l, int flags)
{
while (l)
{
dump_expr (TREE_VALUE (l), flags | TFF_EXPR_IN_PARENS);
l = TREE_CHAIN (l);
if (l)
- separate_with_comma (scratch_buffer);
+ pp_separate_with_comma (cxx_pp);
}
}
/* Print out an expression E under control of FLAGS. */
static void
-dump_expr (t, flags)
- tree t;
- int flags;
+dump_expr (tree t, int flags)
{
if (t == 0)
return;
@@ -1458,138 +1310,54 @@ dump_expr (t, flags)
case TEMPLATE_DECL:
case NAMESPACE_DECL:
case OVERLOAD:
- dump_decl (t, flags & ~TFF_DECL_SPECIFIERS);
+ case IDENTIFIER_NODE:
+ dump_decl (t, (flags & ~TFF_DECL_SPECIFIERS) | TFF_NO_FUNCTION_ARGUMENTS);
break;
case INTEGER_CST:
- {
- tree type = TREE_TYPE (t);
- my_friendly_assert (type != 0, 81);
-
- /* If it's an enum, output its tag, rather than its value. */
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- {
- 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 || integer_zerop (t))
- print_identifier (scratch_buffer, "false");
- else if (t == boolean_true_node)
- print_identifier (scratch_buffer, "true");
- }
- else if (type == char_type_node)
- {
- output_add_character (scratch_buffer, '\'');
- if (host_integerp (t, TREE_UNSIGNED (type)))
- dump_char (tree_low_cst (t, TREE_UNSIGNED (type)));
- else
- output_printf (scratch_buffer, "\\x%x",
- (unsigned int) TREE_INT_CST_LOW (t));
- output_add_character (scratch_buffer, '\'');
- }
- else
- {
- do_int:
- if (! host_integerp (t, 0))
- {
- 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);
- }
- }
- else
- print_integer (scratch_buffer, TREE_INT_CST_LOW (t));
- }
- }
+ case STRING_CST:
+ case REAL_CST:
+ pp_c_constant (pp_c_base (cxx_pp), t);
break;
- case REAL_CST:
- real_to_decimal (digit_buffer, &TREE_REAL_CST (t),
- sizeof (digit_buffer), 0, 1);
- output_add_string (scratch_buffer, digit_buffer);
+ case THROW_EXPR:
+ pp_identifier (cxx_pp, "throw");
+ dump_expr (TREE_OPERAND (t, 0), flags);
break;
case PTRMEM_CST:
- output_add_character (scratch_buffer, '&');
+ pp_ampersand (cxx_pp);
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:
- {
- const char *p = TREE_STRING_POINTER (t);
- int len = TREE_STRING_LENGTH (t) - 1;
- int i;
-
- output_add_character (scratch_buffer, '\"');
- for (i = 0; i < len; i++)
- dump_char (p[i]);
- output_add_character (scratch_buffer, '\"');
- }
+ pp_colon_colon (cxx_pp);
+ pp_tree_identifier (cxx_pp, DECL_NAME (PTRMEM_CST_MEMBER (t)));
break;
case COMPOUND_EXPR:
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
- separate_with_comma (scratch_buffer);
+ pp_separate_with_comma (cxx_pp);
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
break;
case COND_EXPR:
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
- output_add_string (scratch_buffer, " ? ");
+ pp_string (cxx_pp, " ? ");
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
- output_add_string (scratch_buffer, " : ");
+ pp_string (cxx_pp, " : ");
dump_expr (TREE_OPERAND (t, 2), flags | TFF_EXPR_IN_PARENS);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
break;
case SAVE_EXPR:
if (TREE_HAS_CONSTRUCTOR (t))
{
- output_add_string (scratch_buffer, "new ");
+ pp_string (cxx_pp, "new ");
dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
}
else
- {
- dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
- }
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
break;
case AGGR_INIT_EXPR:
@@ -1602,18 +1370,17 @@ dump_expr (t, flags)
if (fn && TREE_CODE (fn) == FUNCTION_DECL)
{
if (DECL_CONSTRUCTOR_P (fn))
- print_tree_identifier
- (scratch_buffer, TYPE_IDENTIFIER (TREE_TYPE (t)));
+ pp_tree_identifier (cxx_pp, TYPE_IDENTIFIER (TREE_TYPE (t)));
else
dump_decl (fn, 0);
}
else
dump_expr (TREE_OPERAND (t, 0), 0);
}
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
if (TREE_OPERAND (t, 1))
dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)), flags);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
break;
case CALL_EXPR:
@@ -1630,20 +1397,20 @@ dump_expr (t, flags)
if (TREE_CODE (ob) == ADDR_EXPR)
{
dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
- output_add_character (scratch_buffer, '.');
+ pp_dot (cxx_pp);
}
else if (TREE_CODE (ob) != PARM_DECL
|| strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
{
dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
- output_add_string (scratch_buffer, "->");
+ pp_arrow (cxx_pp);
}
args = TREE_CHAIN (args);
}
dump_expr (fn, flags | TFF_EXPR_IN_PARENS);
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
dump_expr_list (args, flags);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
}
break;
@@ -1652,13 +1419,13 @@ dump_expr (t, flags)
tree type = TREE_OPERAND (t, 1);
tree init = TREE_OPERAND (t, 2);
if (NEW_EXPR_USE_GLOBAL (t))
- print_scope_operator (scratch_buffer);
- output_add_string (scratch_buffer, "new ");
+ pp_colon_colon (cxx_pp);
+ pp_string (cxx_pp, "new ");
if (TREE_OPERAND (t, 0))
{
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
dump_expr_list (TREE_OPERAND (t, 0), flags);
- output_add_string (scratch_buffer, ") ");
+ pp_string (cxx_pp, ") ");
}
if (TREE_CODE (type) == ARRAY_REF)
type = build_cplus_array_type
@@ -1669,7 +1436,7 @@ dump_expr (t, flags)
dump_type (type, flags);
if (init)
{
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
if (TREE_CODE (init) == TREE_LIST)
dump_expr_list (init, flags);
else if (init == void_zero_node)
@@ -1678,7 +1445,7 @@ dump_expr (t, flags)
;
else
dump_expr (init, flags);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
}
}
break;
@@ -1707,7 +1474,6 @@ dump_expr (t, flags)
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:
@@ -1742,13 +1508,13 @@ dump_expr (t, flags)
|| strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
{
dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
- output_add_string (scratch_buffer, "->");
+ pp_arrow (cxx_pp);
}
}
else
{
dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
- output_add_character (scratch_buffer, '.');
+ pp_dot (cxx_pp);
}
dump_expr (TREE_OPERAND (t, 1), flags & ~TFF_EXPR_IN_PARENS);
}
@@ -1756,17 +1522,17 @@ dump_expr (t, flags)
case ARRAY_REF:
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
- print_left_bracket (scratch_buffer);
+ pp_left_bracket (cxx_pp);
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
- print_right_bracket (scratch_buffer);
+ pp_right_bracket (cxx_pp);
break;
case CONVERT_EXPR:
if (TREE_TYPE (t) && VOID_TYPE_P (TREE_TYPE (t)))
{
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
dump_type (TREE_TYPE (t), flags);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags);
}
else
@@ -1792,9 +1558,9 @@ dump_expr (t, flags)
t = TREE_OPERAND (t, 0);
my_friendly_assert (TREE_CODE (t) == CALL_EXPR, 237);
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)), flags);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
}
else
{
@@ -1817,11 +1583,10 @@ dump_expr (t, flags)
case POSTDECREMENT_EXPR:
case POSTINCREMENT_EXPR:
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
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);
+ pp_identifier (cxx_pp, operator_name_info[(int)TREE_CODE (t)].name);
+ pp_right_paren (cxx_pp);
break;
case NON_LVALUE_EXPR:
@@ -1838,22 +1603,40 @@ dump_expr (t, flags)
if (TREE_CODE (next) == FUNCTION_TYPE)
{
if (flags & TFF_EXPR_IN_PARENS)
- print_left_paren (scratch_buffer);
- output_add_character (scratch_buffer, '*');
+ pp_left_paren (cxx_pp);
+ pp_star (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
if (flags & TFF_EXPR_IN_PARENS)
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
break;
}
- /* else FALLTHRU */
+ /* Else fall through. */
}
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
break;
case NOP_EXPR:
- dump_expr (TREE_OPERAND (t, 0), flags);
- break;
-
+ {
+ tree op = TREE_OPERAND (t, 0);
+
+ if (!same_type_p (TREE_TYPE (op), TREE_TYPE (t)))
+ {
+ /* It is a cast, but we cannot tell whether it is a
+ reinterpret or static cast. Use the C style notation. */
+ if (flags & TFF_EXPR_IN_PARENS)
+ pp_left_paren (cxx_pp);
+ pp_left_paren (cxx_pp);
+ dump_type (TREE_TYPE (t), flags);
+ pp_right_paren (cxx_pp);
+ dump_expr (op, flags | TFF_EXPR_IN_PARENS);
+ if (flags & TFF_EXPR_IN_PARENS)
+ pp_right_paren (cxx_pp);
+ }
+ else
+ dump_expr (op, flags);
+ break;
+ }
+
case EXPR_WITH_FILE_LOCATION:
dump_expr (EXPR_WFL_NODE (t), flags);
break;
@@ -1866,9 +1649,11 @@ dump_expr (t, flags)
if (integer_zerop (idx))
{
/* A NULL pointer-to-member constant. */
- output_add_string (scratch_buffer, "((");
+ pp_left_paren (cxx_pp);
+ pp_left_paren (cxx_pp);
dump_type (TREE_TYPE (t), flags);
- output_add_string (scratch_buffer, ") 0)");
+ pp_right_paren (cxx_pp);
+ pp_string (cxx_pp, ")0)");
break;
}
else if (host_integerp (idx, 0))
@@ -1899,19 +1684,19 @@ dump_expr (t, flags)
}
}
}
- /* We've gotten an rvalue of the form 'T()'. */
- else if (TREE_TYPE (t))
- {
- dump_type (TREE_TYPE (t), flags);
- print_left_paren (scratch_buffer);
- print_right_paren (scratch_buffer);
- }
+ if (TREE_TYPE (t) && !CONSTRUCTOR_ELTS (t))
+ {
+ dump_type (TREE_TYPE (t), 0);
+ pp_left_paren (cxx_pp);
+ pp_right_paren (cxx_pp);
+ }
else
- {
- output_add_character (scratch_buffer, '{');
- dump_expr_list (CONSTRUCTOR_ELTS (t), flags);
- output_add_character (scratch_buffer, '}');
- }
+ {
+ pp_left_brace (cxx_pp);
+ dump_expr_list (CONSTRUCTOR_ELTS (t), flags);
+ pp_right_brace (cxx_pp);
+ }
+
break;
case OFFSET_REF:
@@ -1934,12 +1719,12 @@ dump_expr (t, flags)
if (TREE_CODE (ob) == INDIRECT_REF)
{
dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
- output_add_string (scratch_buffer, "->*");
+ pp_string (cxx_pp, "->*");
}
else
{
dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
- output_add_string (scratch_buffer, ".*");
+ pp_string (cxx_pp, ".*");
}
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
}
@@ -1950,13 +1735,9 @@ dump_expr (t, flags)
dump_decl (TEMPLATE_PARM_DECL (t), flags & ~TFF_DECL_SPECIFIERS);
break;
- case IDENTIFIER_NODE:
- print_tree_identifier (scratch_buffer, t);
- break;
-
case SCOPE_REF:
dump_type (TREE_OPERAND (t, 0), flags);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
break;
@@ -1965,65 +1746,68 @@ dump_expr (t, flags)
|| TREE_CHAIN (TREE_OPERAND (t, 0)))
{
dump_type (TREE_TYPE (t), flags);
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
dump_expr_list (TREE_OPERAND (t, 0), flags);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
}
else
{
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
dump_type (TREE_TYPE (t), flags);
- output_add_string (scratch_buffer, ")(");
+ pp_string (cxx_pp, ")(");
dump_expr_list (TREE_OPERAND (t, 0), flags);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
}
break;
case STATIC_CAST_EXPR:
- output_add_string (scratch_buffer, "static_cast<");
+ pp_string (cxx_pp, "static_cast<");
goto cast;
case REINTERPRET_CAST_EXPR:
- output_add_string (scratch_buffer, "reinterpret_cast<");
+ pp_string (cxx_pp, "reinterpret_cast<");
goto cast;
case CONST_CAST_EXPR:
- output_add_string (scratch_buffer, "const_cast<");
+ pp_string (cxx_pp, "const_cast<");
goto cast;
case DYNAMIC_CAST_EXPR:
- output_add_string (scratch_buffer, "dynamic_cast<");
+ pp_string (cxx_pp, "dynamic_cast<");
cast:
dump_type (TREE_TYPE (t), flags);
- output_add_string (scratch_buffer, ">(");
+ pp_string (cxx_pp, ">(");
dump_expr (TREE_OPERAND (t, 0), flags);
- print_right_paren (scratch_buffer);
- break;
-
- case LOOKUP_EXPR:
- print_tree_identifier (scratch_buffer, TREE_OPERAND (t, 0));
+ pp_right_paren (cxx_pp);
break;
case ARROW_EXPR:
dump_expr (TREE_OPERAND (t, 0), flags);
- output_add_string (scratch_buffer, "->");
+ pp_arrow (cxx_pp);
break;
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
if (TREE_CODE (t) == SIZEOF_EXPR)
- output_add_string (scratch_buffer, "sizeof (");
+ pp_string (cxx_pp, "sizeof (");
else
{
my_friendly_assert (TREE_CODE (t) == ALIGNOF_EXPR, 0);
- output_add_string (scratch_buffer, "__alignof__ (");
+ pp_string (cxx_pp, "__alignof__ (");
}
if (TYPE_P (TREE_OPERAND (t, 0)))
dump_type (TREE_OPERAND (t, 0), flags);
else
- dump_unary_op ("*", t, flags | TFF_EXPR_IN_PARENS);
- print_right_paren (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 0), flags);
+ pp_right_paren (cxx_pp);
+ break;
+
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ pp_identifier (cxx_pp, operator_name_info[TREE_CODE (t)].name);
+ pp_space (cxx_pp);
+ dump_expr (TREE_OPERAND (t, 0), flags);
break;
case DEFAULT_ARG:
- print_identifier (scratch_buffer, "<unparsed>");
+ pp_identifier (cxx_pp, "<unparsed>");
break;
case TRY_CATCH_EXPR:
@@ -2034,9 +1818,10 @@ dump_expr (t, flags)
case PSEUDO_DTOR_EXPR:
dump_expr (TREE_OPERAND (t, 2), flags);
- output_add_character (scratch_buffer, '.');
+ pp_dot (cxx_pp);
dump_type (TREE_OPERAND (t, 0), flags);
- output_add_string (scratch_buffer, "::~");
+ pp_colon_colon (cxx_pp);
+ pp_complement (cxx_pp);
dump_type (TREE_OPERAND (t, 1), flags);
break;
@@ -2047,150 +1832,127 @@ dump_expr (t, flags)
case STMT_EXPR:
/* We don't yet have a way of dumping statements in a
human-readable format. */
- output_add_string (scratch_buffer, "({...})");
+ pp_string (cxx_pp, "({...})");
break;
case BIND_EXPR:
- output_add_character (scratch_buffer, '{');
+ pp_left_brace (cxx_pp);
dump_expr (TREE_OPERAND (t, 1), flags & ~TFF_EXPR_IN_PARENS);
- output_add_character (scratch_buffer, '}');
+ pp_right_brace (cxx_pp);
break;
case LOOP_EXPR:
- output_add_string (scratch_buffer, "while (1) { ");
+ pp_string (cxx_pp, "while (1) { ");
dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
- output_add_character (scratch_buffer, '}');
+ pp_right_brace (cxx_pp);
break;
case EXIT_EXPR:
- output_add_string (scratch_buffer, "if (");
+ pp_string (cxx_pp, "if (");
dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
- output_add_string (scratch_buffer, ") break; ");
+ pp_string (cxx_pp, ") break; ");
break;
case BASELINK:
- print_tree_identifier (scratch_buffer, DECL_NAME (get_first_fn (t)));
+ dump_expr (get_first_fn (t), flags & ~TFF_EXPR_IN_PARENS);
break;
- case TREE_LIST:
- if (TREE_VALUE (t) && TREE_CODE (TREE_VALUE (t)) == FUNCTION_DECL)
- {
- print_tree_identifier (scratch_buffer, DECL_NAME (TREE_VALUE (t)));
- break;
- }
- /* else fall through */
+ case EMPTY_CLASS_EXPR:
+ dump_type (TREE_TYPE (t), flags);
+ pp_left_paren (cxx_pp);
+ pp_right_paren (cxx_pp);
+ break;
+
+ case NON_DEPENDENT_EXPR:
+ dump_expr (TREE_OPERAND (t, 0), flags);
+ break;
/* 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_for_unsupported_tree (t);
+ pp_unsupported_tree (cxx_pp, t);
/* fall through to ERROR_MARK... */
case ERROR_MARK:
- print_identifier (scratch_buffer, "<expression error>");
+ pp_identifier (cxx_pp, "<expression error>");
break;
}
}
static void
-dump_binary_op (opstring, t, flags)
- const char *opstring;
- tree t;
- int flags;
+dump_binary_op (const char *opstring, tree t, int flags)
{
- print_left_paren (scratch_buffer);
+ pp_left_paren (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
- output_add_space (scratch_buffer);
+ pp_space (cxx_pp);
if (opstring)
- print_identifier (scratch_buffer, opstring);
+ pp_identifier (cxx_pp, opstring);
else
- print_identifier (scratch_buffer, "<unknown operator>");
- output_add_space (scratch_buffer);
+ pp_identifier (cxx_pp, "<unknown operator>");
+ pp_space (cxx_pp);
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
}
static void
-dump_unary_op (opstring, t, flags)
- const char *opstring;
- tree t;
- int flags;
+dump_unary_op (const char *opstring, tree t, int flags)
{
if (flags & TFF_EXPR_IN_PARENS)
- print_left_paren (scratch_buffer);
- print_identifier (scratch_buffer, opstring);
+ pp_left_paren (cxx_pp);
+ pp_identifier (cxx_pp, opstring);
dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
if (flags & TFF_EXPR_IN_PARENS)
- print_right_paren (scratch_buffer);
+ pp_right_paren (cxx_pp);
}
/* Exported interface to stringifying types, exprs and decls under TFF_*
control. */
const char *
-type_as_string (typ, flags)
- tree typ;
- int flags;
+type_as_string (tree typ, int flags)
{
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
dump_type (typ, flags);
-
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
const char *
-expr_as_string (decl, flags)
- tree decl;
- int flags;
+expr_as_string (tree decl, int flags)
{
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
dump_expr (decl, flags);
-
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
const char *
-decl_as_string (decl, flags)
- tree decl;
- int flags;
+decl_as_string (tree decl, int flags)
{
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
dump_decl (decl, flags);
-
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
const char *
-context_as_string (context, flags)
- tree context;
- int flags;
+context_as_string (tree context, int flags)
{
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
dump_scope (context, flags);
-
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
/* Generate the three forms of printable names for cxx_printable_name. */
const char *
-lang_decl_name (decl, v)
- tree decl;
- int v;
+lang_decl_name (tree decl, int v)
{
if (v >= 2)
return decl_as_string (decl, TFF_DECL_SPECIFIERS);
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
if (v == 1 && DECL_CLASS_SCOPE_P (decl))
{
dump_type (CP_DECL_CONTEXT (decl), TFF_PLAIN_IDENTIFIER);
- print_scope_operator (scratch_buffer);
+ pp_colon_colon (cxx_pp);
}
if (TREE_CODE (decl) == FUNCTION_DECL)
@@ -2198,45 +1960,20 @@ lang_decl_name (decl, v)
else
dump_decl (DECL_NAME (decl), TFF_PLAIN_IDENTIFIER);
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
-const char *
-cp_file_of (t)
- tree t;
+static location_t
+location_of (tree t)
{
if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
- return DECL_SOURCE_FILE (DECL_CONTEXT (t));
+ t = DECL_CONTEXT (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));
- else
- return DECL_SOURCE_FILE (t);
-}
-
-int
-cp_line_of (t)
- tree t;
-{
- int line = 0;
- if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
- line = DECL_SOURCE_LINE (DECL_CONTEXT (t));
- if (TREE_CODE (t) == TYPE_DECL && DECL_ARTIFICIAL (t)
- && TYPE_MAIN_DECL (TREE_TYPE (t)))
- t = TREE_TYPE (t);
-
- if (TYPE_P (t))
- line = DECL_SOURCE_LINE (TYPE_MAIN_DECL (t));
+ t = TYPE_MAIN_DECL (t);
else if (TREE_CODE (t) == OVERLOAD)
- line = DECL_SOURCE_LINE (OVL_FUNCTION (t));
- else
- line = DECL_SOURCE_LINE (t);
-
- if (line == 0)
- return lineno;
-
- return line;
+ t = OVL_FUNCTION (t);
+
+ return DECL_SOURCE_LOCATION (t);
}
/* Now the interfaces from error et al to dump_type et al. Each takes an
@@ -2244,9 +1981,7 @@ cp_line_of (t)
function. */
static const char *
-decl_to_string (decl, verbose)
- tree decl;
- int verbose;
+decl_to_string (tree decl, int verbose)
{
int flags = 0;
@@ -2259,55 +1994,41 @@ decl_to_string (decl, verbose)
flags |= TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE;
flags |= TFF_TEMPLATE_HEADER;
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
dump_decl (decl, flags);
-
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
static const char *
-expr_to_string (decl, verbose)
- tree decl;
- int verbose ATTRIBUTE_UNUSED;
+expr_to_string (tree decl)
{
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
dump_expr (decl, 0);
-
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
static const char *
-fndecl_to_string (fndecl, verbose)
- tree fndecl;
- int verbose;
+fndecl_to_string (tree fndecl, int verbose)
{
int flags;
flags = TFF_EXCEPTION_SPECIFICATION | TFF_DECL_SPECIFIERS;
if (verbose)
flags |= TFF_FUNCTION_DEFAULT_ARGUMENTS;
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
dump_decl (fndecl, flags);
-
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
static const char *
-code_to_string (c, v)
- enum tree_code c;
- int v ATTRIBUTE_UNUSED;
+code_to_string (enum tree_code c)
{
return tree_code_name [c];
}
const char *
-language_to_string (c, v)
- enum languages c;
- int v ATTRIBUTE_UNUSED;
+language_to_string (enum languages c)
{
switch (c)
{
@@ -2329,62 +2050,45 @@ language_to_string (c, v)
/* Return the proper printed version of a parameter to a C++ function. */
static const char *
-parm_to_string (p, v)
- int p;
- int v ATTRIBUTE_UNUSED;
+parm_to_string (int p)
{
+ pp_clear_output_area (cxx_pp);
if (p < 0)
- return "`this'";
-
- sprintf (digit_buffer, "%d", p+1);
- return digit_buffer;
+ pp_string (cxx_pp, "'this'");
+ else
+ pp_decimal_int (cxx_pp, p + 1);
+ return pp_formatted_text (cxx_pp);
}
static const char *
-op_to_string (p, v)
- enum tree_code p;
- int v ATTRIBUTE_UNUSED;
+op_to_string (enum tree_code p)
{
- tree id;
-
- id = operator_name_info[(int) p].identifier;
- return id ? IDENTIFIER_POINTER (id) : "{unknown}";
+ tree 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;
+type_to_string (tree typ, int verbose)
{
- int flags;
-
- flags = 0;
+ int flags = 0;
if (verbose)
flags |= TFF_CLASS_KEY_OR_ENUM;
flags |= TFF_TEMPLATE_HEADER;
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
dump_type (typ, flags);
-
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
static const char *
-assop_to_string (p, v)
- enum tree_code p;
- int v ATTRIBUTE_UNUSED;
+assop_to_string (enum tree_code p)
{
- tree id;
-
- id = assignment_operator_name_info[(int) p].identifier;
+ tree id = assignment_operator_name_info[(int) p].identifier;
return id ? IDENTIFIER_POINTER (id) : "{unknown}";
}
static const char *
-args_to_string (p, verbose)
- tree p;
- int verbose;
+args_to_string (tree p, int verbose)
{
int flags = 0;
if (verbose)
@@ -2396,95 +2100,85 @@ args_to_string (p, verbose)
if (TYPE_P (TREE_VALUE (p)))
return type_as_string (p, flags);
- reinit_global_formatting_buffer ();
+ pp_clear_output_area (cxx_pp);
for (; p; p = TREE_CHAIN (p))
{
if (TREE_VALUE (p) == null_node)
- print_identifier (scratch_buffer, "NULL");
+ pp_identifier (cxx_pp, "NULL");
else
dump_type (error_type (TREE_VALUE (p)), flags);
if (TREE_CHAIN (p))
- separate_with_comma (scratch_buffer);
+ pp_separate_with_comma (cxx_pp);
}
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
static const char *
-cv_to_string (p, v)
- tree p;
- int v;
+cv_to_string (tree p, int v)
{
- reinit_global_formatting_buffer ();
-
+ pp_clear_output_area (cxx_pp);
dump_qualifiers (p, v ? before : none);
-
- return output_finalize_message (scratch_buffer);
+ return pp_formatted_text (cxx_pp);
}
/* Langhook for print_error_function. */
void
-cxx_print_error_function (context, file)
- diagnostic_context *context;
- const char *file;
+cxx_print_error_function (diagnostic_context *context, const char *file)
{
lhd_print_error_function (context, file);
- output_set_prefix (&context->buffer, file);
+ pp_base_set_prefix (context->printer, file);
maybe_print_instantiation_context (context);
}
static void
-cp_diagnostic_starter (context, diagnostic)
- diagnostic_context *context;
- diagnostic_info *diagnostic;
+cp_diagnostic_starter (diagnostic_context *context,
+ diagnostic_info *diagnostic)
{
diagnostic_report_current_module (context);
cp_print_error_function (context, diagnostic);
maybe_print_instantiation_context (context);
- output_set_prefix (&context->buffer, diagnostic_build_prefix (diagnostic));
+ pp_base_set_prefix (context->printer, diagnostic_build_prefix (diagnostic));
}
static void
-cp_diagnostic_finalizer (context, diagnostic)
- diagnostic_context *context;
- diagnostic_info *diagnostic __attribute__((unused));
+cp_diagnostic_finalizer (diagnostic_context *context,
+ diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
{
- output_destroy_prefix (&context->buffer);
+ pp_base_destroy_prefix (context->printer);
}
/* Print current function onto BUFFER, in the process of reporting
a diagnostic message. Called from cp_diagnostic_starter. */
static void
-cp_print_error_function (context, diagnostic)
- diagnostic_context *context;
- diagnostic_info *diagnostic;
+cp_print_error_function (diagnostic_context *context,
+ diagnostic_info *diagnostic)
{
if (diagnostic_last_function_changed (context))
{
- const char *old_prefix = output_prefix (&context->buffer);
+ const char *old_prefix = context->printer->prefix;
char *new_prefix = diagnostic->location.file
? file_name_as_prefix (diagnostic->location.file)
: NULL;
- output_set_prefix (&context->buffer, new_prefix);
+ pp_base_set_prefix (context->printer, new_prefix);
if (current_function_decl == NULL)
- output_add_string (&context->buffer, "At global scope:");
+ pp_base_string (context->printer, "At global scope:");
else
- output_printf (&context->buffer, "In %s `%s':",
- function_category (current_function_decl),
- cxx_printable_name (current_function_decl, 2));
- output_add_newline (&context->buffer);
+ pp_printf (context->printer, "In %s `%s':",
+ function_category (current_function_decl),
+ cxx_printable_name (current_function_decl, 2));
+ pp_base_newline (context->printer);
diagnostic_set_last_function (context);
- output_destroy_prefix (&context->buffer);
- context->buffer.state.prefix = old_prefix;
+ pp_base_destroy_prefix (context->printer);
+ context->printer->prefix = old_prefix;
}
}
/* Returns a description of FUNCTION using standard terminology. */
static const char *
-function_category (fn)
- tree fn;
+function_category (tree fn)
{
if (DECL_FUNCTION_MEMBER_P (fn))
{
@@ -2506,13 +2200,11 @@ function_category (fn)
/* Report the full context of a current template instantiation,
onto BUFFER. */
static void
-print_instantiation_full_context (context)
- diagnostic_context *context;
+print_instantiation_full_context (diagnostic_context *context)
{
tree p = current_instantiation ();
- int line = lineno;
- const char *file = input_filename;
-
+ location_t location = input_location;
+
if (p)
{
if (current_function_decl != TINST_DECL (p)
@@ -2526,43 +2218,41 @@ print_instantiation_full_context (context)
if (current_function_decl == TINST_DECL (p))
/* Avoid redundancy with the the "In function" line. */;
else
- output_verbatim (&context->buffer,
- "%s: In instantiation of `%s':\n", file,
- decl_as_string (TINST_DECL (p),
- TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
+ pp_verbatim (context->printer,
+ "%s: In instantiation of `%s':\n", location.file,
+ decl_as_string (TINST_DECL (p),
+ TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
- line = TINST_LINE (p);
- file = TINST_FILE (p);
+ location.line = TINST_LINE (p);
+ location.file = TINST_FILE (p);
p = TREE_CHAIN (p);
}
}
- print_instantiation_partial_context (context, p, file, line);
+ print_instantiation_partial_context (context, p, location);
}
/* Same as above but less verbose. */
static void
-print_instantiation_partial_context (context, t, file, line)
- diagnostic_context *context;
- tree t;
- const char *file;
- int line;
+print_instantiation_partial_context (diagnostic_context *context,
+ tree t, location_t loc)
{
for (; t; t = TREE_CHAIN (t))
{
- output_verbatim
- (&context->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);
+ pp_verbatim (context->printer, "%s:%d: instantiated from `%s'\n",
+ loc.file, loc.line,
+ decl_as_string (TINST_DECL (t),
+ TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
+ loc.line = TINST_LINE (t);
+ loc.file = TINST_FILE (t);
}
- output_verbatim (&context->buffer, "%s:%d: instantiated from here\n", file, line);
+ pp_verbatim (context->printer, "%s:%d: instantiated from here\n",
+ loc.file, loc.line);
}
/* Called from cp_thing to print the template context for an error. */
static void
-maybe_print_instantiation_context (context)
- diagnostic_context *context;
+maybe_print_instantiation_context (diagnostic_context *context)
{
if (!problematic_instantiation_changed () || current_instantiation () == 0)
return;
@@ -2573,10 +2263,10 @@ maybe_print_instantiation_context (context)
/* Report the bare minimum context of a template instantiation. */
void
-print_instantiation_context ()
+print_instantiation_context (void)
{
print_instantiation_partial_context
- (global_dc, current_instantiation (), input_filename, lineno);
+ (global_dc, current_instantiation (), input_location);
diagnostic_flush_buffer (global_dc);
}
@@ -2594,9 +2284,7 @@ print_instantiation_context ()
%T type.
%V cv-qualifier. */
static bool
-cp_printer (buffer, text)
- output_buffer *buffer;
- text_info *text;
+cp_printer (pretty_printer *pp, text_info *text)
{
int verbose = 0;
const char *result;
@@ -2616,14 +2304,14 @@ cp_printer (buffer, text)
switch (*text->format_spec)
{
case 'A': result = args_to_string (next_tree, verbose); break;
- case 'C': result = code_to_string (next_tcode, verbose); break;
+ case 'C': result = code_to_string (next_tcode); break;
case 'D': result = decl_to_string (next_tree, verbose); break;
- case 'E': result = expr_to_string (next_tree, verbose); break;
+ case 'E': result = expr_to_string (next_tree); 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 'L': result = language_to_string (next_lang); break;
+ case 'O': result = op_to_string (next_tcode); break;
+ case 'P': result = parm_to_string (next_int); break;
+ case 'Q': result = assop_to_string (next_tcode); break;
case 'T': result = type_to_string (next_tree, verbose); break;
case 'V': result = cv_to_string (next_tree, verbose); break;
@@ -2631,7 +2319,7 @@ cp_printer (buffer, text)
return false;
}
- output_add_string (buffer, result);
+ pp_base_string (pp, result);
return true;
#undef next_tree
#undef next_tcode
@@ -2640,33 +2328,20 @@ cp_printer (buffer, text)
}
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;
+pp_non_consecutive_character (cxx_pretty_printer *pp, int c)
{
- const char *p = output_last_position (buffer);
+ const char *p = pp_last_position_in_text (pp);
if (p != NULL && *p == c)
- output_add_space (buffer);
- output_add_character (buffer, c);
+ pp_space (pp);
+ pp_character (pp, 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;
+locate_error (const char *msgid, va_list ap)
{
tree here = 0, t;
int plus = 0;
@@ -2687,6 +2362,7 @@ locate_error (msgid, ap)
{
/* Just ignore these possibilities. */
case '%': break;
+ case 'P':
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;
@@ -2700,7 +2376,6 @@ locate_error (msgid, ap)
case 'D':
case 'E':
case 'F':
- case 'P':
case 'T':
case 'V':
t = va_arg (ap, tree);
@@ -2723,62 +2398,55 @@ locate_error (msgid, ap)
void
-cp_error_at VPARAMS ((const char *msgid, ...))
+cp_error_at (const char *msgid, ...)
{
tree here;
diagnostic_info diagnostic;
+ va_list ap;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_start (ap, msgid);
here = locate_error (msgid, ap);
- VA_CLOSE (ap);
-
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_end (ap);
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
- cp_file_of (here), cp_line_of (here), DK_ERROR);
+ location_of (here), DK_ERROR);
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
}
void
-cp_warning_at VPARAMS ((const char *msgid, ...))
+cp_warning_at (const char *msgid, ...)
{
tree here;
diagnostic_info diagnostic;
+ va_list ap;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_start (ap, msgid);
here = locate_error (msgid, ap);
- VA_CLOSE (ap);
-
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_end (ap);
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
- cp_file_of (here), cp_line_of (here), DK_WARNING);
+ location_of (here), DK_WARNING);
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
}
void
-cp_pedwarn_at VPARAMS ((const char *msgid, ...))
+cp_pedwarn_at (const char *msgid, ...)
{
tree here;
diagnostic_info diagnostic;
+ va_list ap;
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_start (ap, msgid);
here = locate_error (msgid, ap);
- VA_CLOSE (ap);
-
- VA_OPEN (ap, msgid);
- VA_FIXEDARG (ap, const char *, msgid);
+ va_end (ap);
+ va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
- cp_file_of (here), cp_line_of (here),
- pedantic_error_kind());
+ location_of (here), pedantic_error_kind());
report_diagnostic (&diagnostic);
- VA_CLOSE (ap);
+ va_end (ap);
}
diff --git a/contrib/gcc/cp/expr.c b/contrib/gcc/cp/expr.c
index cc9dae9..34e7224 100644
--- a/contrib/gcc/cp/expr.c
+++ b/contrib/gcc/cp/expr.c
@@ -1,28 +1,30 @@
/* Convert language-specific tree expression to rtl instructions,
for GNU compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 2000, 2001 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "rtl.h"
#include "tree.h"
#include "flags.h"
@@ -36,8 +38,7 @@ Boston, MA 02111-1307, USA. */
constants. */
tree
-cplus_expand_constant (cst)
- tree cst;
+cplus_expand_constant (tree cst)
{
switch (TREE_CODE (cst))
{
@@ -52,8 +53,18 @@ cplus_expand_constant (cst)
if (TREE_CODE (member) == FIELD_DECL)
{
/* Find the offset for the field. */
- tree offset = byte_position (member);
- cst = fold (build1 (NOP_EXPR, type, offset));
+ cst = byte_position (member);
+ while (!same_type_p (DECL_CONTEXT (member),
+ TYPE_PTRMEM_CLASS_TYPE (type)))
+ {
+ /* The MEMBER must have been nestled within an
+ anonymous aggregate contained in TYPE. Find the
+ anonymous aggregate. */
+ member = lookup_anon_field (TYPE_PTRMEM_CLASS_TYPE (type),
+ DECL_CONTEXT (member));
+ cst = size_binop (PLUS_EXPR, cst, byte_position (member));
+ }
+ cst = fold (build_nop (type, cst));
}
else
{
@@ -77,15 +88,12 @@ cplus_expand_constant (cst)
/* Hook used by expand_expr to expand language-specific tree codes. */
rtx
-cxx_expand_expr (exp, target, tmode, modifier)
- tree exp;
- rtx target;
- enum machine_mode tmode;
- int modifier; /* Actually an enum expand_modifier. */
+cxx_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier,
+ rtx *alt_rtl)
{
tree type = TREE_TYPE (exp);
- register enum machine_mode mode = TYPE_MODE (type);
- register enum tree_code code = TREE_CODE (exp);
+ enum machine_mode mode = TYPE_MODE (type);
+ enum tree_code code = TREE_CODE (exp);
rtx ret;
/* No sense saving up arithmetic to be done
@@ -120,8 +128,12 @@ cxx_expand_expr (exp, target, tmode, modifier)
/* We don't need to generate any code for an empty class. */
return const0_rtx;
+ case BASELINK:
+ return expand_expr (BASELINK_FUNCTIONS (exp), target, tmode,
+ modifier);
+
default:
- return c_expand_expr (exp, target, tmode, modifier);
+ return c_expand_expr (exp, target, tmode, modifier, alt_rtl);
}
abort ();
/* NOTREACHED */
diff --git a/contrib/gcc/cp/friend.c b/contrib/gcc/cp/friend.c
index 0727c39..ac24de2 100644
--- a/contrib/gcc/cp/friend.c
+++ b/contrib/gcc/cp/friend.c
@@ -1,25 +1,28 @@
/* Help friends in C++.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "rtl.h"
#include "expr.h"
@@ -33,11 +36,10 @@ Boston, MA 02111-1307, USA. */
/* Returns nonzero if SUPPLICANT is a friend of TYPE. */
int
-is_friend (type, supplicant)
- tree type, supplicant;
+is_friend (tree type, tree supplicant)
{
int declp;
- register tree list;
+ tree list;
tree context;
if (supplicant == NULL_TREE || type == NULL_TREE)
@@ -58,29 +60,15 @@ is_friend (type, supplicant)
tree friends = FRIEND_DECLS (list);
for (; friends ; friends = TREE_CHAIN (friends))
{
- if (TREE_VALUE (friends) == NULL_TREE)
- continue;
+ tree friend = TREE_VALUE (friends);
- if (supplicant == TREE_VALUE (friends))
- return 1;
-
- /* We haven't completed the instantiation yet. */
- if (TREE_CODE (supplicant) == TEMPLATE_DECL)
- return 1;
+ if (friend == NULL_TREE)
+ continue;
- /* 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))))
+ if (supplicant == friend)
return 1;
- if (TREE_CODE (TREE_VALUE (friends)) == TEMPLATE_DECL
- && is_specialization_of (supplicant,
- TREE_VALUE (friends)))
+ if (is_specialization_of_friend (supplicant, friend))
return 1;
}
break;
@@ -129,11 +117,14 @@ is_friend (type, supplicant)
}
/* Add a new friend to the friends of the aggregate type TYPE.
- DECL is the FUNCTION_DECL of the friend being added. */
+ DECL is the FUNCTION_DECL of the friend being added.
+
+ If COMPLAIN is true, warning about duplicate friend is issued.
+ We want to have this diagnostics during parsing but not
+ when a template is being instantiated. */
void
-add_friend (type, decl)
- tree type, decl;
+add_friend (tree type, tree decl, bool complain)
{
tree typedecl;
tree list;
@@ -156,27 +147,33 @@ add_friend (type, decl)
{
if (decl == TREE_VALUE (friends))
{
- warning ("`%D' is already a friend of class `%T'",
- decl, type);
- cp_warning_at ("previous friend declaration of `%D'",
- TREE_VALUE (friends));
+ if (complain)
+ warning ("`%D' is already a friend of class `%T'",
+ decl, type);
return;
}
}
maybe_add_class_template_decl_list (type, decl, /*friend_p=*/1);
- TREE_VALUE (list) = tree_cons (error_mark_node, decl,
+ TREE_VALUE (list) = tree_cons (NULL_TREE, decl,
TREE_VALUE (list));
return;
}
list = TREE_CHAIN (list);
}
+ if (DECL_CLASS_SCOPE_P (decl))
+ {
+ tree class_binfo = TYPE_BINFO (DECL_CONTEXT (decl));
+ if (!uses_template_parms (BINFO_TYPE (class_binfo)))
+ perform_or_defer_access_check (class_binfo, decl);
+ }
+
maybe_add_class_template_decl_list (type, decl, /*friend_p=*/1);
DECL_FRIENDLIST (typedecl)
- = tree_cons (DECL_NAME (decl), build_tree_list (error_mark_node, decl),
+ = tree_cons (DECL_NAME (decl), build_tree_list (NULL_TREE, decl),
DECL_FRIENDLIST (typedecl));
if (!uses_template_parms (type))
DECL_BEFRIENDING_CLASSES (decl)
@@ -192,11 +189,14 @@ add_friend (type, decl)
classes that are not defined. If a type has not yet been defined,
then the DECL_WAITING_FRIENDS contains a list of types
waiting to make it their friend. Note that these two can both
- be in use at the same time! */
+ be in use at the same time!
+
+ If COMPLAIN is true, warning about duplicate friend is issued.
+ We want to have this diagnostics during parsing but not
+ when a template is being instantiated. */
void
-make_friend_class (type, friend_type)
- tree type, friend_type;
+make_friend_class (tree type, tree friend_type, bool complain)
{
tree classes;
int is_template_friend;
@@ -228,8 +228,9 @@ make_friend_class (type, friend_type)
}
else if (same_type_p (type, friend_type))
{
- pedwarn ("class `%T' is implicitly friends with itself",
- type);
+ if (complain)
+ pedwarn ("class `%T' is implicitly friends with itself",
+ type);
return;
}
else
@@ -265,17 +266,36 @@ make_friend_class (type, friend_type)
if (is_template_friend)
friend_type = CLASSTYPE_TI_TEMPLATE (friend_type);
- classes = CLASSTYPE_FRIEND_CLASSES (type);
- while (classes
- /* Stop if we find the same type on the list. */
- && !(TREE_CODE (TREE_VALUE (classes)) == TEMPLATE_DECL ?
- friend_type == TREE_VALUE (classes) :
- same_type_p (TREE_VALUE (classes), friend_type)))
- classes = TREE_CHAIN (classes);
- if (classes)
- warning ("`%T' is already a friend of `%T'",
- TREE_VALUE (classes), type);
- else
+ /* See if it is already a friend. */
+ for (classes = CLASSTYPE_FRIEND_CLASSES (type);
+ classes;
+ classes = TREE_CHAIN (classes))
+ {
+ tree probe = TREE_VALUE (classes);
+
+ if (TREE_CODE (friend_type) == TEMPLATE_DECL)
+ {
+ if (friend_type == probe)
+ {
+ if (complain)
+ warning ("`%D' is already a friend of `%T'",
+ probe, type);
+ break;
+ }
+ }
+ else if (TREE_CODE (probe) != TEMPLATE_DECL)
+ {
+ if (same_type_p (probe, friend_type))
+ {
+ if (complain)
+ warning ("`%T' is already a friend of `%T'",
+ probe, type);
+ break;
+ }
+ }
+ }
+
+ if (!classes)
{
maybe_add_class_template_decl_list (type, friend_type, /*friend_p=*/1);
@@ -290,10 +310,7 @@ make_friend_class (type, friend_type)
}
}
-/* Main friend processor. This is large, and for modularity purposes,
- has been removed from grokdeclarator. It returns `void_type_node'
- to indicate that something happened, though a FIELD_DECL is
- not returned.
+/* Main friend processor.
CTYPE is the class this friend belongs to.
@@ -301,33 +318,22 @@ make_friend_class (type, friend_type)
DECL is the FUNCTION_DECL that the friend is.
- In case we are parsing a friend which is part of an inline
- definition, we will need to store PARM_DECL chain that comes
- with it into the DECL_ARGUMENTS slot of the FUNCTION_DECL.
-
FLAGS is just used for `grokclassfn'.
QUALS say what special qualifies should apply to the object
pointed to by `this'. */
tree
-do_friend (ctype, declarator, decl, parmdecls, attrlist,
- flags, quals, funcdef_flag)
- tree ctype, declarator, decl, parmdecls, attrlist;
- enum overload_flags flags;
- tree quals;
- int funcdef_flag;
+do_friend (tree ctype, tree declarator, tree decl,
+ tree attrlist, enum overload_flags flags, tree quals,
+ int funcdef_flag)
{
- int is_friend_template = 0;
-
/* Every decl that gets here is a friend of something. */
DECL_FRIEND_P (decl) = 1;
if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
{
declarator = TREE_OPERAND (declarator, 0);
- if (TREE_CODE (declarator) == LOOKUP_EXPR)
- declarator = TREE_OPERAND (declarator, 0);
if (is_overloaded_fn (declarator))
declarator = DECL_NAME (get_first_fn (declarator));
}
@@ -335,42 +341,73 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
if (TREE_CODE (decl) != FUNCTION_DECL)
abort ();
- is_friend_template = PROCESSING_REAL_TEMPLATE_DECL_P ();
-
if (ctype)
{
+ /* CLASS_TEMPLATE_DEPTH counts the number of template headers for
+ the enclosing class. FRIEND_DEPTH counts the number of template
+ headers used for this friend declaration. TEMPLATE_MEMBER_P is
+ true if a template header in FRIEND_DEPTH is intended for
+ DECLARATOR. For example, the code
+
+ template <class T> struct A {
+ template <class U> struct B {
+ template <class V> template <class W>
+ friend void C<V>::f(W);
+ };
+ };
+
+ will eventually give the following results
+
+ 1. CLASS_TEMPLATE_DEPTH equals 2 (for `T' and `U').
+ 2. FRIEND_DEPTH equals 2 (for `V' and `W').
+ 3. TEMPLATE_MEMBER_P is true (for `W'). */
+
+ int class_template_depth = template_class_depth (current_class_type);
+ int friend_depth = processing_template_decl - class_template_depth;
+ /* We will figure this out later. */
+ bool template_member_p = false;
+
tree cname = TYPE_NAME (ctype);
if (TREE_CODE (cname) == TYPE_DECL)
cname = DECL_NAME (cname);
/* A method friend. */
- if (flags == NO_SPECIAL && ctype && declarator == cname)
+ if (flags == NO_SPECIAL && declarator == cname)
DECL_CONSTRUCTOR_P (decl) = 1;
/* This will set up DECL_ARGUMENTS for us. */
grokclassfn (ctype, decl, flags, quals);
- if (is_friend_template)
- decl = DECL_TI_TEMPLATE (push_template_decl (decl));
- else if (DECL_TEMPLATE_INFO (decl))
- ;
- else if (template_class_depth (current_class_type))
- decl = push_template_decl_real (decl, /*is_friend=*/1);
-
- /* 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 (processing_template_decl)
- add_friend (current_class_type, decl);
+ if (friend_depth)
+ {
+ if (!uses_template_parms_level (ctype, class_template_depth
+ + friend_depth))
+ template_member_p = true;
+ }
+
/* 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 (COMPLETE_TYPE_P (ctype) || TYPE_BEING_DEFINED (ctype))
+ if (class_template_depth
+ || COMPLETE_TYPE_P (ctype)
+ || TYPE_BEING_DEFINED (ctype))
{
- decl = check_classfn (ctype, decl);
+ if (DECL_TEMPLATE_INFO (decl))
+ /* DECL is a template specialization. No need to
+ build a new TEMPLATE_DECL. */
+ ;
+ else if (class_template_depth)
+ /* We rely on tsubst_friend_function to check the
+ validity of the declaration later. */
+ decl = push_template_decl_real (decl, /*is_friend=*/1);
+ else
+ decl = check_classfn (ctype, decl, template_member_p);
+
+ if (template_member_p && decl && TREE_CODE (decl) == FUNCTION_DECL)
+ decl = DECL_TI_TEMPLATE (decl);
if (decl)
- add_friend (current_class_type, decl);
+ add_friend (current_class_type, decl, /*complain=*/true);
}
else
error ("member `%D' declared as friend before type `%T' defined",
@@ -380,12 +417,13 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
@@ or possibly a friend from a base class ?!? */
else if (TREE_CODE (decl) == FUNCTION_DECL)
{
+ int is_friend_template = PROCESSING_REAL_TEMPLATE_DECL_P ();
+
/* Friends must all go through the overload machinery,
even though they may not technically be overloaded.
Note that because classes all wind up being top-level
in their scope, their friend wind up in top-level scope as well. */
- DECL_ARGUMENTS (decl) = parmdecls;
if (funcdef_flag)
SET_DECL_FRIEND_CONTEXT (decl, current_class_type);
@@ -437,8 +475,12 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
}
}
+ if (decl == error_mark_node)
+ return error_mark_node;
+
add_friend (current_class_type,
- is_friend_template ? DECL_TI_TEMPLATE (decl) : decl);
+ is_friend_template ? DECL_TI_TEMPLATE (decl) : decl,
+ /*complain=*/true);
DECL_FRIEND_P (decl) = 1;
}
diff --git a/contrib/gcc/cp/g++spec.c b/contrib/gcc/cp/g++spec.c
index af30f1c..e6c9ee6 100644
--- a/contrib/gcc/cp/g++spec.c
+++ b/contrib/gcc/cp/g++spec.c
@@ -1,25 +1,28 @@
/* Specific flags and argument handling of the C++ front-end.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "gcc.h"
/* This bit is set if we saw a `-xfoo' language specification. */
@@ -44,10 +47,8 @@ Boston, MA 02111-1307, USA. */
#endif
void
-lang_specific_driver (in_argc, in_argv, in_added_libraries)
- int *in_argc;
- const char *const **in_argv;
- int *in_added_libraries;
+lang_specific_driver (int *in_argc, const char *const **in_argv,
+ int *in_added_libraries)
{
int i, j;
@@ -57,14 +58,16 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
/* If nonzero, the user gave us the `-v' flag. */
int saw_verbose_flag = 0;
- /* This will be 0 if we encounter a situation where we should not
- link in libstdc++. */
- int library = 1;
+ /* This is a tristate:
+ -1 means we should not link in libstdc++
+ 0 means we should link in libstdc++ if it is needed
+ 1 means libstdc++ is needed and should be linked in. */
+ int library = 0;
/* The number of arguments being added to what's in argv, other than
libraries. We use this to track the number of times we've inserted
-xc++/-xnone. */
- int added = 2;
+ int added = 0;
/* Used to track options that take arguments, so we don't go wrapping
those with -xc++/-xnone. */
@@ -110,7 +113,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
argv = *in_argv;
added_libraries = *in_added_libraries;
- args = (int *) xcalloc (argc, sizeof (int));
+ args = xcalloc (argc, sizeof (int));
for (i = 1; i < argc; i++)
{
@@ -128,17 +131,14 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
if (argv[i][0] == '-')
{
- if (library != 0 && (strcmp (argv[i], "-nostdlib") == 0
- || strcmp (argv[i], "-nodefaultlibs") == 0))
+ if (strcmp (argv[i], "-nostdlib") == 0
+ || strcmp (argv[i], "-nodefaultlibs") == 0)
{
- library = 0;
+ library = -1;
}
else if (strcmp (argv[i], "-lm") == 0
|| strcmp (argv[i], "-lmath") == 0
|| strcmp (argv[i], MATH_LIBRARY) == 0
-#ifdef ALT_LIBM
- || strcmp (argv[i], ALT_LIBM) == 0
-#endif
)
{
args[i] |= MATHLIB;
@@ -149,31 +149,37 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
else if (strcmp (argv[i], "-pg") == 0 || strcmp (argv[i], "-p") == 0)
saw_profile_flag++;
else if (strcmp (argv[i], "-v") == 0)
+ saw_verbose_flag = 1;
+ else if (strncmp (argv[i], "-x", 2) == 0)
{
- saw_verbose_flag = 1;
- if (argc == 2)
+ if (library == 0)
{
- /* If they only gave us `-v', don't try to link
- in libg++. */
- library = 0;
+ const char * arg;
+ if (argv[i][2] != '\0')
+ arg = argv[i]+2;
+ else if (argv[i+1] != NULL)
+ arg = argv[i+1];
+ else /* Error condition, message will be printed later. */
+ arg = "";
+ if (strcmp (arg, "c++") == 0
+ || strcmp (arg, "c++-cpp-output") == 0)
+ library = 1;
}
+ saw_speclang = 1;
}
- else if (strncmp (argv[i], "-x", 2) == 0)
- saw_speclang = 1;
else if (((argv[i][2] == '\0'
- && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL)
+ && 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], "-fsyntax-only") == 0))
+ else if ((argv[i][2] == '\0'
+ && strchr ("cSEM", argv[i][1]) != NULL)
+ || 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;
+ library = -1;
}
else if (strcmp (argv[i], "-static-libgcc") == 0
|| strcmp (argv[i], "-static") == 0)
@@ -194,16 +200,28 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
continue;
}
- /* If the filename ends in .c or .i, put options around it.
+ /* If the filename ends in .[chi], put options around it.
But not if a specified -x option is currently active. */
len = strlen (argv[i]);
if (len > 2
- && (argv[i][len - 1] == 'c' || argv[i][len - 1] == 'i')
+ && (argv[i][len - 1] == 'c'
+ || argv[i][len - 1] == 'i'
+ || argv[i][len - 1] == 'h')
&& argv[i][len - 2] == '.')
{
args[i] |= LANGSPEC;
added += 2;
}
+
+ /* If we don't know that this is a header file, we might
+ need to be linking in the libraries. */
+ if (library == 0)
+ {
+ if ((len <= 2 || strcmp (argv[i] + (len - 2), ".H") != 0)
+ && (len <= 2 || strcmp (argv[i] + (len - 2), ".h") != 0)
+ && (len <= 3 || strcmp (argv[i] + (len - 3), ".hh") != 0))
+ library = 1;
+ }
}
}
@@ -211,7 +229,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
fatal ("argument to `%s' missing\n", quote);
/* If we know we don't have to do anything, bail now. */
- if (! added && ! library)
+ if (! added && library <= 0)
{
free (args);
return;
@@ -224,8 +242,8 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
#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 *));
+ num_args = argc + added + need_math + shared_libgcc + (library > 0) + 1;
+ arglist = xmalloc (num_args * sizeof (char *));
i = 0;
j = 0;
@@ -240,27 +258,37 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
/* Make sure -lstdc++ is before the math library, since libstdc++
itself uses those math routines. */
- if (!saw_math && (args[i] & MATHLIB) && library)
+ if (!saw_math && (args[i] & MATHLIB) && library > 0)
{
--j;
saw_math = argv[i];
}
- if (!saw_libc && (args[i] & WITHLIBC) && library)
+ if (!saw_libc && (args[i] & WITHLIBC) && library > 0)
{
--j;
saw_libc = argv[i];
}
- /* Wrap foo.c and foo.i files in a language specification to
+ /* Wrap foo.[chi] files in a language specification to
force the gcc compiler driver to run cc1plus on them. */
if (args[i] & LANGSPEC)
{
int len = strlen (argv[i]);
- if (argv[i][len - 1] == 'i')
- arglist[j++] = "-xc++-cpp-output";
- else
- arglist[j++] = "-xc++";
+ switch (argv[i][len - 1])
+ {
+ case 'c':
+ arglist[j++] = "-xc++";
+ break;
+ case 'i':
+ arglist[j++] = "-xc++-cpp-output";
+ break;
+ case 'h':
+ arglist[j++] = "-xc++-header";
+ break;
+ default:
+ abort ();
+ }
arglist[j++] = argv[i];
arglist[j] = "-xnone";
}
@@ -270,21 +298,14 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
}
/* Add `-lstdc++' if we haven't already done so. */
- if (library)
+ if (library > 0)
{
arglist[j++] = saw_profile_flag ? LIBSTDCXX_PROFILE : LIBSTDCXX;
added_libraries++;
-#ifdef USE_LIBUNWIND_EXCEPTIONS
-# ifndef LIBUNWIND
-# define LIBUNWIND "-lunwind"
-# endif
- arglist[j++] = LIBUNWIND;
- added_libraries++;
-#endif
}
if (saw_math)
arglist[j++] = saw_math;
- else if (library && need_math)
+ else if (library > 0 && need_math)
{
arglist[j++] = saw_profile_flag ? MATH_LIBRARY_PROFILE : MATH_LIBRARY;
added_libraries++;
@@ -302,7 +323,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
}
/* Called before linking. Returns 0 on success and -1 on failure. */
-int lang_specific_pre_link () /* Not used for C++. */
+int lang_specific_pre_link (void) /* Not used for C++. */
{
return 0;
}
diff --git a/contrib/gcc/cp/init.c b/contrib/gcc/cp/init.c
index 91ea10c..c81736c 100644
--- a/contrib/gcc/cp/init.c
+++ b/contrib/gcc/cp/init.c
@@ -1,22 +1,22 @@
/* Handle initialization things in C++.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -24,6 +24,8 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "rtl.h"
#include "expr.h"
@@ -32,27 +34,28 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "except.h"
#include "toplev.h"
-#include "ggc.h"
+static bool begin_init_stmts (tree *, tree *);
+static tree finish_init_stmts (bool, tree, tree);
static void construct_virtual_base (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 expand_aggr_init_1 (tree, tree, tree, tree, int);
+static void expand_default_init (tree, tree, tree, tree, int);
+static tree build_vec_delete_1 (tree, tree, tree, special_function_kind, int);
static void perform_member_init (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 build_builtin_delete_call (tree);
+static int member_init_ok_or_else (tree, tree, tree);
+static void expand_virtual_init (tree, tree);
static tree sort_mem_initializers (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, 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));
+static tree initializing_context (tree);
+static void expand_cleanup_for_base (tree, tree);
+static tree get_temp_regvar (tree, tree);
+static tree dfs_initialize_vtbl_ptrs (tree, void *);
+static tree build_default_init (tree, tree);
+static tree build_new_1 (tree);
+static tree get_cookie_size (tree);
+static tree build_dtor_call (tree, special_function_kind, int);
+static tree build_field_list (tree, tree, int *);
+static tree build_vtbl_address (tree);
/* We are about to generate some complex initialization code.
Conceptually, it is all a single expression. However, we may want
@@ -63,45 +66,29 @@ static tree build_vtbl_address PARAMS ((tree));
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;
+static bool
+begin_init_stmts (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 ();
+ bool is_global = !building_stmt_tree ();
- if (building_stmt_tree ())
- *compound_stmt_p = begin_compound_stmt (/*has_no_scope=*/1);
+ *stmt_expr_p = begin_stmt_expr ();
+ *compound_stmt_p = begin_compound_stmt (/*has_no_scope=*/true);
+
+ return is_global;
}
/* Finish out the statement-expression begun by the previous call to
begin_init_stmts. Returns the statement-expression itself. */
-tree
-finish_init_stmts (stmt_expr, compound_stmt)
- tree stmt_expr;
- tree compound_stmt;
-
+static tree
+finish_init_stmts (bool is_global, tree stmt_expr, tree compound_stmt)
{
- if (building_stmt_tree ())
- finish_compound_stmt (/*has_no_scope=*/1, compound_stmt);
-
- if (building_stmt_tree ())
- {
- stmt_expr = finish_stmt_expr (stmt_expr);
- STMT_EXPR_NO_SCOPE (stmt_expr) = true;
- }
- else
- stmt_expr = finish_global_stmt_expr (stmt_expr);
+ finish_compound_stmt (compound_stmt);
- /* To avoid spurious warnings about unused values, we set
- TREE_USED. */
- if (stmt_expr)
- TREE_USED (stmt_expr) = 1;
+ stmt_expr = finish_stmt_expr (stmt_expr, true);
+ my_friendly_assert (!building_stmt_tree () == is_global, 20030726);
+
return stmt_expr;
}
@@ -112,9 +99,7 @@ finish_init_stmts (stmt_expr, compound_stmt)
TREE_LIST whose TREE_VALUE is the this ptr expression. */
static tree
-dfs_initialize_vtbl_ptrs (binfo, data)
- tree binfo;
- void *data;
+dfs_initialize_vtbl_ptrs (tree binfo, void *data)
{
if ((!BINFO_PRIMARY_P (binfo) || TREE_VIA_VIRTUAL (binfo))
&& CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
@@ -126,7 +111,7 @@ dfs_initialize_vtbl_ptrs (binfo, data)
expand_virtual_init (binfo, base_ptr);
}
- SET_BINFO_MARKED (binfo);
+ BINFO_MARKED (binfo) = 1;
return NULL_TREE;
}
@@ -135,8 +120,7 @@ dfs_initialize_vtbl_ptrs (binfo, data)
ADDR. */
void
-initialize_vtbl_ptrs (addr)
- tree addr;
+initialize_vtbl_ptrs (tree addr)
{
tree list;
tree type;
@@ -148,10 +132,9 @@ initialize_vtbl_ptrs (addr)
class. We do these in pre-order because we 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);
+ dfs_walk_real (TYPE_BINFO (type), dfs_initialize_vtbl_ptrs,
+ NULL, unmarkedp, list);
+ dfs_walk (TYPE_BINFO (type), dfs_unmark, markedp, type);
}
/* Return an expression for the zero-initialization of an object with
@@ -207,7 +190,7 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
tree inits;
/* Build a constructor to contain the initializations. */
- init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
+ init = build_constructor (type, NULL_TREE);
/* Iterate over the fields, building initializations. */
inits = NULL_TREE;
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
@@ -239,20 +222,23 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
tree inits;
/* Build a constructor to contain the initializations. */
- init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
+ init = build_constructor (type, NULL_TREE);
/* Iterate over the array elements, building initializations. */
inits = NULL_TREE;
max_index = nelts ? nelts : array_type_nelts (type);
my_friendly_assert (TREE_CODE (max_index) == INTEGER_CST, 20030618);
- for (index = size_zero_node;
- !tree_int_cst_lt (max_index, index);
- index = size_binop (PLUS_EXPR, index, size_one_node))
- inits = tree_cons (index,
- build_zero_init (TREE_TYPE (type),
- /*nelts=*/NULL_TREE,
- static_storage_p),
- inits);
+ /* A zero-sized array, which is accepted as an extension, will
+ have an upper bound of -1. */
+ if (!tree_int_cst_equal (max_index, integer_minus_one_node))
+ for (index = size_zero_node;
+ !tree_int_cst_lt (max_index, index);
+ index = size_binop (PLUS_EXPR, index, size_one_node))
+ inits = tree_cons (index,
+ build_zero_init (TREE_TYPE (type),
+ /*nelts=*/NULL_TREE,
+ static_storage_p),
+ inits);
CONSTRUCTOR_ELTS (init) = nreverse (inits);
}
else if (TREE_CODE (type) == REFERENCE_TYPE)
@@ -275,9 +261,7 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
constructors to be called. */
static tree
-build_default_init (type, nelts)
- tree type;
- tree nelts;
+build_default_init (tree type, tree nelts)
{
/* [dcl.init]:
@@ -311,7 +295,7 @@ build_default_init (type, nelts)
return NULL_TREE;
/* At this point, TYPE is either a POD class type, an array of POD
- classes, or something even more inoccuous. */
+ classes, or something even more innocuous. */
return build_zero_init (type, nelts, /*static_storage_p=*/false);
}
@@ -387,19 +371,14 @@ perform_member_init (tree member, tree init)
/* member traversal: note it leaves init NULL */
else if (TREE_CODE (type) == REFERENCE_TYPE)
pedwarn ("uninitialized reference member `%D'", member);
+ else if (CP_TYPE_CONST_P (type))
+ pedwarn ("uninitialized member `%D' with `const' type `%T'",
+ member, type);
}
else if (TREE_CODE (init) == TREE_LIST)
- {
- /* There was an explicit member initialization. Do some
- work in that case. */
- if (TREE_CHAIN (init))
- {
- warning ("initializer list treated as compound expression");
- init = build_compound_expr (init);
- }
- else
- init = TREE_VALUE (init);
- }
+ /* There was an explicit member initialization. Do some work
+ in that case. */
+ init = build_x_compound_expr_from_list (init, "member initializer");
if (init)
finish_expr_stmt (build_modify_expr (decl, INIT_EXPR, init));
@@ -424,10 +403,7 @@ perform_member_init (tree member, tree init)
the FIELD_DECLs on the TYPE_FIELDS list for T, in reverse order. */
static tree
-build_field_list (t, list, uses_unions_p)
- tree t;
- tree list;
- int *uses_unions_p;
+build_field_list (tree t, tree list, int *uses_unions_p)
{
tree fields;
@@ -544,6 +520,7 @@ sort_mem_initializers (tree t, tree mem_inits)
cp_warning_at (" `%#D'", subobject);
else
warning (" base `%T'", subobject);
+ warning (" when initialized here");
}
/* Look again, from the beginning of the list. */
@@ -730,8 +707,7 @@ emit_mem_initializers (tree mem_inits)
assigned to the vptr) for BINFO. */
static tree
-build_vtbl_address (binfo)
- tree binfo;
+build_vtbl_address (tree binfo)
{
tree binfo_for = binfo;
tree vtbl;
@@ -770,8 +746,7 @@ build_vtbl_address (binfo)
multiple inheritance, this might mean "C's A" if C : A, B. */
static void
-expand_virtual_init (binfo, decl)
- tree binfo, decl;
+expand_virtual_init (tree binfo, tree decl)
{
tree vtbl, vtbl_ptr;
tree vtt_index;
@@ -823,9 +798,7 @@ expand_virtual_init (binfo, decl)
destroyed. */
static void
-expand_cleanup_for_base (binfo, flag)
- tree binfo;
- tree flag;
+expand_cleanup_for_base (tree binfo, tree flag)
{
tree expr;
@@ -874,7 +847,7 @@ construct_virtual_base (tree vbase, tree arguments)
flag = TREE_CHAIN (DECL_ARGUMENTS (current_function_decl));
inner_if_stmt = begin_if_stmt ();
finish_if_stmt_cond (flag, inner_if_stmt);
- compound_stmt = begin_compound_stmt (/*has_no_scope=*/1);
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/true);
/* Compute the location of the virtual base. If we're
constructing virtual bases, then we must be the most derived
@@ -884,7 +857,7 @@ construct_virtual_base (tree vbase, tree arguments)
expand_aggr_init_1 (vbase, current_class_ref, exp, arguments,
LOOKUP_COMPLAIN);
- finish_compound_stmt (/*has_no_scope=*/1, compound_stmt);
+ finish_compound_stmt (compound_stmt);
finish_then_clause (inner_if_stmt);
finish_if_stmt ();
@@ -894,8 +867,7 @@ construct_virtual_base (tree vbase, tree arguments)
/* Find the context in which this FIELD can be initialized. */
static tree
-initializing_context (field)
- tree field;
+initializing_context (tree field)
{
tree t = DECL_CONTEXT (field);
@@ -914,23 +886,33 @@ initializing_context (field)
MEMBER_NAME is the name of the member. */
static int
-member_init_ok_or_else (field, type, member_name)
- tree field;
- tree type;
- tree member_name;
+member_init_ok_or_else (tree field, tree type, tree member_name)
{
if (field == error_mark_node)
return 0;
- if (field == NULL_TREE || initializing_context (field) != type)
+ if (!field)
{
error ("class `%T' does not have any field named `%D'", type,
- member_name);
+ member_name);
+ return 0;
+ }
+ if (TREE_CODE (field) == VAR_DECL)
+ {
+ error ("`%#D' is a static data member; it can only be "
+ "initialized at its definition",
+ field);
return 0;
}
- if (TREE_STATIC (field))
+ if (TREE_CODE (field) != FIELD_DECL)
{
- error ("field `%#D' is static; the only point of initialization is its definition",
- field);
+ error ("`%#D' is not a non-static data member of `%T'",
+ field, type);
+ return 0;
+ }
+ if (initializing_context (field) != type)
+ {
+ error ("class `%T' does not have any field named `%D'", type,
+ member_name);
return 0;
}
@@ -986,22 +968,50 @@ expand_member_init (tree name)
if (basetype)
{
- tree binfo;
+ tree class_binfo;
+ tree direct_binfo;
+ tree virtual_binfo;
+ int i;
if (current_template_parms)
return basetype;
- binfo = lookup_base (current_class_type, basetype,
- ba_ignore, NULL);
- if (binfo)
+ class_binfo = TYPE_BINFO (current_class_type);
+ direct_binfo = NULL_TREE;
+ virtual_binfo = NULL_TREE;
+
+ /* Look for a direct base. */
+ for (i = 0; i < BINFO_N_BASETYPES (class_binfo); ++i)
+ if (same_type_p (basetype,
+ TYPE_BINFO_BASETYPE (current_class_type, i)))
+ {
+ direct_binfo = BINFO_BASETYPE (class_binfo, i);
+ break;
+ }
+ /* Look for a virtual base -- unless the direct base is itself
+ virtual. */
+ if (!direct_binfo || !TREE_VIA_VIRTUAL (direct_binfo))
+ {
+ virtual_binfo
+ = purpose_member (basetype,
+ CLASSTYPE_VBASECLASSES (current_class_type));
+ if (virtual_binfo)
+ virtual_binfo = TREE_VALUE (virtual_binfo);
+ }
+
+ /* [class.base.init]
+
+ If a mem-initializer-id is ambiguous because it designates
+ both a direct non-virtual base class and an inherited virtual
+ base class, the mem-initializer is ill-formed. */
+ if (direct_binfo && virtual_binfo)
{
- if (TREE_VIA_VIRTUAL (binfo))
- binfo = binfo_for_vbase (basetype, current_class_type);
- else if (BINFO_INHERITANCE_CHAIN (binfo)
- != TYPE_BINFO (current_class_type))
- binfo = NULL_TREE;
+ error ("'%D' is both a direct base and an indirect virtual base",
+ basetype);
+ return NULL_TREE;
}
- if (!binfo)
+
+ if (!direct_binfo && !virtual_binfo)
{
if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
error ("type `%D' is not a direct or virtual base of `%T'",
@@ -1012,13 +1022,12 @@ expand_member_init (tree name)
return NULL_TREE;
}
- if (binfo)
- return binfo;
+ return direct_binfo ? direct_binfo : virtual_binfo;
}
else
{
if (TREE_CODE (name) == IDENTIFIER_NODE)
- field = lookup_field (current_class_type, name, 1, 0);
+ field = lookup_field (current_class_type, name, 1, false);
else
field = name;
@@ -1061,9 +1070,7 @@ expand_member_init (tree name)
perform the initialization, but not both, as it would be ambiguous. */
tree
-build_aggr_init (exp, init, flags)
- tree exp, init;
- int flags;
+build_aggr_init (tree exp, tree init, int flags)
{
tree stmt_expr;
tree compound_stmt;
@@ -1071,6 +1078,7 @@ build_aggr_init (exp, init, flags)
tree type = TREE_TYPE (exp);
int was_const = TREE_READONLY (exp);
int was_volatile = TREE_THIS_VOLATILE (exp);
+ int is_global;
if (init == error_mark_node)
return error_mark_node;
@@ -1120,16 +1128,16 @@ build_aggr_init (exp, init, flags)
}
if (TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == PARM_DECL)
- /* just know that we've seen something for this node */
+ /* Just know that we've seen something for this node. */
TREE_USED (exp) = 1;
TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
- begin_init_stmts (&stmt_expr, &compound_stmt);
+ is_global = 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);
+ stmt_expr = finish_init_stmts (is_global, stmt_expr, compound_stmt);
current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
TREE_TYPE (exp) = type;
TREE_READONLY (exp) = was_const;
@@ -1141,15 +1149,17 @@ build_aggr_init (exp, init, flags)
/* Like build_aggr_init, but not just for aggregates. */
tree
-build_init (decl, init, flags)
- tree decl, init;
- int flags;
+build_init (tree decl, tree init, int flags)
{
tree expr;
- if (IS_AGGR_TYPE (TREE_TYPE (decl))
- || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
+ if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
expr = build_aggr_init (decl, init, flags);
+ else if (CLASS_TYPE_P (TREE_TYPE (decl)))
+ expr = build_special_member_call (decl, complete_ctor_identifier,
+ build_tree_list (NULL_TREE, init),
+ TYPE_BINFO (TREE_TYPE (decl)),
+ LOOKUP_NORMAL|flags);
else
expr = build (INIT_EXPR, TREE_TYPE (decl), decl, init);
@@ -1157,11 +1167,7 @@ build_init (decl, init, flags)
}
static void
-expand_default_init (binfo, true_exp, exp, init, flags)
- tree binfo;
- tree true_exp, exp;
- tree init;
- int flags;
+expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags)
{
tree type = TREE_TYPE (exp);
tree ctor_name;
@@ -1198,13 +1204,16 @@ expand_default_init (binfo, true_exp, exp, init, flags)
else
init = ocp_convert (type, init, CONV_IMPLICIT|CONV_FORCE_TEMP, flags);
- if (TREE_CODE (init) == TRY_CATCH_EXPR)
- /* We need to protect the initialization of a catch parm
- with a call to terminate(), which shows up as a TRY_CATCH_EXPR
+ if (TREE_CODE (init) == MUST_NOT_THROW_EXPR)
+ /* We need to protect the initialization of a catch parm with a
+ call to terminate(), which shows up as a MUST_NOT_THROW_EXPR
around the TARGET_EXPR for the copy constructor. See
- expand_start_catch_block. */
- TREE_OPERAND (init, 0) = build (INIT_EXPR, TREE_TYPE (exp), exp,
- TREE_OPERAND (init, 0));
+ initialize_handler_parm. */
+ {
+ TREE_OPERAND (init, 0) = build (INIT_EXPR, TREE_TYPE (exp), exp,
+ TREE_OPERAND (init, 0));
+ TREE_TYPE (init) = void_type_node;
+ }
else
init = build (INIT_EXPR, TREE_TYPE (exp), exp, init);
TREE_SIDE_EFFECTS (init) = 1;
@@ -1229,12 +1238,7 @@ expand_default_init (binfo, true_exp, exp, init, flags)
rval = build_special_member_call (exp, ctor_name, parms, binfo, flags);
if (TREE_SIDE_EFFECTS (rval))
- {
- if (building_stmt_tree ())
- finish_expr_stmt (rval);
- else
- genrtl_expr_stmt (rval);
- }
+ finish_expr_stmt (convert_to_void (rval, NULL));
}
/* This function is responsible for initializing EXP with INIT
@@ -1254,15 +1258,11 @@ expand_default_init (binfo, true_exp, exp, init, flags)
from TRUE_EXP. In constructors, we don't know anything about
the value being initialized.
- FLAGS is just passes to `build_method_call'. See that function for
- its description. */
+ FLAGS is just passed to `build_new_method_call'. See that function
+ for its description. */
static void
-expand_aggr_init_1 (binfo, true_exp, exp, init, flags)
- tree binfo;
- tree true_exp, exp;
- tree init;
- int flags;
+expand_aggr_init_1 (tree binfo, tree true_exp, tree exp, tree init, int flags)
{
tree type = TREE_TYPE (exp);
@@ -1282,8 +1282,9 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, flags)
/* 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))
- finish_expr_stmt (build (INIT_EXPR, type, exp, init));
+ init = store_init_value (exp, init);
+ if (init)
+ finish_expr_stmt (init);
return;
}
@@ -1296,9 +1297,7 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, flags)
OR_ELSE is nonzero, give an error message. */
int
-is_aggr_type (type, or_else)
- tree type;
- int or_else;
+is_aggr_type (tree type, int or_else)
{
if (type == error_mark_node)
return 0;
@@ -1317,9 +1316,7 @@ is_aggr_type (type, or_else)
/* Like is_aggr_typedef, but returns typedef if successful. */
tree
-get_aggr_from_typedef (name, or_else)
- tree name;
- int or_else;
+get_aggr_from_typedef (tree name, int or_else)
{
tree type;
@@ -1347,8 +1344,7 @@ get_aggr_from_typedef (name, or_else)
}
tree
-get_type_value (name)
- tree name;
+get_type_value (tree name)
{
if (name == error_mark_node)
return NULL_TREE;
@@ -1359,162 +1355,11 @@ get_type_value (name)
return NULL_TREE;
}
-
-/* This code could just as well go in `class.c', but is placed here for
- modularity. */
-
-/* For an expression of the form TYPE :: NAME (PARMLIST), build
- the appropriate function call. */
-
-tree
-build_member_call (type, name, parmlist)
- tree type, name, parmlist;
-{
- tree t;
- tree method_name;
- tree fns;
- int dtor = 0;
- tree basetype_path, decl;
-
- if (TREE_CODE (name) == TEMPLATE_ID_EXPR
- && TREE_CODE (type) == NAMESPACE_DECL)
- {
- /* 'name' already refers to the decls from the namespace, since we
- hit do_identifier for template_ids. */
- method_name = TREE_OPERAND (name, 0);
- /* FIXME: Since we don't do independent names right yet, the
- name might also be a LOOKUP_EXPR. Once we resolve this to a
- real decl earlier, this can go. This may happen during
- tsubst'ing. */
- if (TREE_CODE (method_name) == LOOKUP_EXPR)
- {
- method_name = lookup_namespace_name
- (type, TREE_OPERAND (method_name, 0));
- TREE_OPERAND (name, 0) = method_name;
- }
- my_friendly_assert (is_overloaded_fn (method_name), 980519);
- return finish_call_expr (name, parmlist, /*disallow_virtual=*/true);
- }
-
- if (DECL_P (name))
- name = DECL_NAME (name);
-
- if (TREE_CODE (type) == NAMESPACE_DECL)
- return finish_call_expr (lookup_namespace_name (type, name),
- parmlist,
- /*disallow_virtual=*/true);
-
- if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
- {
- method_name = TREE_OPERAND (name, 0);
- if (TREE_CODE (method_name) == COMPONENT_REF)
- method_name = TREE_OPERAND (method_name, 1);
- if (is_overloaded_fn (method_name))
- method_name = DECL_NAME (OVL_CURRENT (method_name));
- TREE_OPERAND (name, 0) = method_name;
- }
- else
- method_name = name;
-
- if (TREE_CODE (method_name) == BIT_NOT_EXPR)
- {
- method_name = TREE_OPERAND (method_name, 0);
- dtor = 1;
- }
-
- /* This shouldn't be here, and build_member_call shouldn't appear in
- parse.y! (mrs) */
- if (type && TREE_CODE (type) == IDENTIFIER_NODE
- && get_aggr_from_typedef (type, 0) == 0)
- {
- tree ns = lookup_name (type, 0);
- if (ns && TREE_CODE (ns) == NAMESPACE_DECL)
- return finish_call_expr (lookup_namespace_name (ns, name),
- parmlist,
- /*disallow_virtual=*/true);
- }
-
- if (type == NULL_TREE || ! is_aggr_type (type, 1))
- return error_mark_node;
-
- /* An operator we did not like. */
- if (name == NULL_TREE)
- return error_mark_node;
-
- if (dtor)
- {
- error ("cannot call destructor `%T::~%T' without object", type,
- method_name);
- return error_mark_node;
- }
-
- decl = maybe_dummy_object (type, &basetype_path);
-
- fns = lookup_fnfields (basetype_path, method_name, 0);
- if (fns)
- {
- if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
- BASELINK_FUNCTIONS (fns) = build_nt (TEMPLATE_ID_EXPR,
- BASELINK_FUNCTIONS (fns),
- TREE_OPERAND (name, 1));
- return build_new_method_call (decl, fns, parmlist,
- /*conversion_path=*/NULL_TREE,
- LOOKUP_NORMAL|LOOKUP_NONVIRTUAL);
- }
-
- /* Convert 'this' to the specified type to disambiguate conversion
- to the function's context. */
- if (decl == current_class_ref
- /* ??? this is wrong, but if this conversion is invalid we need to
- defer it until we know whether we are calling a static or
- non-static member function. Be conservative for now. */
- && ACCESSIBLY_UNIQUELY_DERIVED_P (type, current_class_type))
- {
- basetype_path = NULL_TREE;
- decl = build_scoped_ref (decl, type, &basetype_path);
- if (decl == error_mark_node)
- return error_mark_node;
- }
-
- if (constructor_name_p (method_name, type))
- return build_functional_cast (type, parmlist);
- if (TREE_CODE (name) == IDENTIFIER_NODE
- && ((t = lookup_field (TYPE_BINFO (type), name, 1, 0))))
- {
- if (t == error_mark_node)
- return error_mark_node;
- if (TREE_CODE (t) == FIELD_DECL)
- {
- if (is_dummy_object (decl))
- {
- error ("invalid use of non-static field `%D'", t);
- return error_mark_node;
- }
- decl = build (COMPONENT_REF, TREE_TYPE (t), decl, t);
- }
- else if (TREE_CODE (t) == VAR_DECL)
- decl = t;
- else
- {
- error ("invalid use of member `%D'", t);
- return error_mark_node;
- }
- if (TYPE_LANG_SPECIFIC (TREE_TYPE (decl)))
- return build_opfncall (CALL_EXPR, LOOKUP_NORMAL, decl,
- parmlist, NULL_TREE);
- return build_function_call (decl, parmlist);
- }
- else
- {
- error ("no method `%T::%D'", type, name);
- return error_mark_node;
- }
-}
-
-/* Build a reference to a member of an aggregate. This is not a
- C++ `&', but really something which can have its address taken,
- and then act as a pointer to member, for example TYPE :: FIELD
- can have its address taken by saying & TYPE :: FIELD.
+/* Build a reference to a member of an aggregate. This is not a C++
+ `&', but really something which can have its address taken, and
+ then act as a pointer to member, for example TYPE :: FIELD can have
+ its address taken by saying & TYPE :: FIELD. ADDRESS_P is true if
+ this expression is the operand of "&".
@@ Prints out lousy diagnostics for operator <typename>
@@ fields.
@@ -1522,10 +1367,9 @@ build_member_call (type, name, parmlist)
@@ This function should be rewritten and placed in search.c. */
tree
-build_offset_ref (type, name)
- tree type, name;
+build_offset_ref (tree type, tree name, bool address_p)
{
- tree decl, t = error_mark_node;
+ tree decl;
tree member;
tree basebinfo = NULL_TREE;
tree orig_name = name;
@@ -1549,16 +1393,10 @@ build_offset_ref (type, 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));
- }
+ 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);
@@ -1570,7 +1408,7 @@ build_offset_ref (type, name)
/* Handle namespace names fully here. */
if (TREE_CODE (type) == NAMESPACE_DECL)
{
- t = lookup_namespace_name (type, name);
+ tree t = lookup_namespace_name (type, name);
if (t == error_mark_node)
return t;
if (TREE_CODE (orig_name) == TEMPLATE_ID_EXPR)
@@ -1616,12 +1454,37 @@ build_offset_ref (type, name)
return error_mark_node;
}
+ if (!member)
+ {
+ error ("`%D' is not a member of type `%T'", name, type);
+ return error_mark_node;
+ }
+
+ if (TREE_CODE (member) == TYPE_DECL)
+ {
+ TREE_USED (member) = 1;
+ return member;
+ }
+ /* static class members and class-specific enum
+ values can be returned without further ado. */
+ if (TREE_CODE (member) == VAR_DECL || TREE_CODE (member) == CONST_DECL)
+ {
+ mark_used (member);
+ return convert_from_reference (member);
+ }
+
+ if (TREE_CODE (member) == FIELD_DECL && DECL_C_BIT_FIELD (member))
+ {
+ error ("invalid pointer to bit-field `%D'", member);
+ return error_mark_node;
+ }
+
/* A lot of this logic is now handled in lookup_member. */
- if (member && BASELINK_P (member))
+ if (BASELINK_P (member))
{
/* Go from the TREE_BASELINK to the member function info. */
tree fnfields = member;
- t = BASELINK_FUNCTIONS (fnfields);
+ tree t = BASELINK_FUNCTIONS (fnfields);
if (TREE_CODE (orig_name) == TEMPLATE_ID_EXPR)
{
@@ -1648,200 +1511,122 @@ build_offset_ref (type, name)
if (TREE_CODE (t) != TEMPLATE_ID_EXPR && !really_overloaded_fn (t))
{
- /* Get rid of a potential OVERLOAD around it */
+ /* Get rid of a potential OVERLOAD around it. */
t = OVL_CURRENT (t);
- /* unique functions are handled easily. */
- if (!enforce_access (basebinfo, t))
- return error_mark_node;
+ /* Unique functions are handled easily. */
+
+ /* For non-static member of base class, we need a special rule
+ for access checking [class.protected]:
+
+ If the access is to form a pointer to member, the
+ nested-name-specifier shall name the derived class
+ (or any class derived from that class). */
+ if (address_p && DECL_P (t)
+ && DECL_NONSTATIC_MEMBER_P (t))
+ perform_or_defer_access_check (TYPE_BINFO (type), t);
+ else
+ perform_or_defer_access_check (basebinfo, t);
+
mark_used (t);
if (DECL_STATIC_FUNCTION_P (t))
return t;
- t = build (OFFSET_REF, TREE_TYPE (t), decl, t);
- PTRMEM_OK_P (t) = 1;
- return t;
+ member = t;
}
-
- TREE_TYPE (fnfields) = unknown_type_node;
-
- t = build (OFFSET_REF, unknown_type_node, decl, fnfields);
- PTRMEM_OK_P (t) = 1;
- return t;
- }
-
- t = member;
-
- if (t == NULL_TREE)
- {
- error ("`%D' is not a member of type `%T'", name, type);
- return error_mark_node;
- }
-
- if (TREE_CODE (t) == TYPE_DECL)
- {
- TREE_USED (t) = 1;
- return t;
- }
- /* static class members and class-specific enum
- values can be returned without further ado. */
- if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == CONST_DECL)
- {
- mark_used (t);
- return convert_from_reference (t);
- }
-
- if (TREE_CODE (t) == FIELD_DECL && DECL_C_BIT_FIELD (t))
- {
- error ("invalid 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)
- abort ();
-
- /* In member functions, the form `type::name' is no longer
- equivalent to `this->type::name', at least not until
- resolve_offset_ref. */
- 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
- not have its address taken. */
-
-tree
-resolve_offset_ref (exp)
- tree exp;
-{
- tree type = TREE_TYPE (exp);
- tree base = NULL_TREE;
- tree member;
- tree basetype, addr;
-
- if (TREE_CODE (exp) == OFFSET_REF)
- {
- member = TREE_OPERAND (exp, 1);
- base = TREE_OPERAND (exp, 0);
- }
- else
- {
- my_friendly_assert (TREE_CODE (type) == OFFSET_TYPE, 214);
- if (TYPE_OFFSET_BASETYPE (type) != current_class_type)
+ else
{
- error ("object missing in use of pointer-to-member construct");
- return error_mark_node;
+ TREE_TYPE (fnfields) = unknown_type_node;
+ member = fnfields;
}
- member = exp;
- type = TREE_TYPE (type);
- base = current_class_ref;
- }
-
- 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)
- {
- 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)))
- || TREE_CODE (TREE_TYPE (member)) == FUNCTION_TYPE)
- {
- /* These were static members. */
- if (!cxx_mark_addressable (member))
- return error_mark_node;
- return member;
- }
-
- if (TREE_CODE (TREE_TYPE (member)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_TYPE (member))) == METHOD_TYPE)
- return member;
-
- /* Syntax error can cause a member which should
- have been seen as static to be grok'd as non-static. */
- if (TREE_CODE (member) == FIELD_DECL && current_class_ref == NULL_TREE)
- {
- 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;
}
+ else if (address_p && TREE_CODE (member) == FIELD_DECL)
+ /* We need additional test besides the one in
+ check_accessibility_of_qualified_id in case it is
+ a pointer to non-static member. */
+ perform_or_defer_access_check (TYPE_BINFO (type), member);
- /* The first case is really just a reference to a member of `this'. */
- if (TREE_CODE (member) == FIELD_DECL
- && (base == current_class_ref || is_dummy_object (base)))
+ if (!address_p)
{
- tree binfo = NULL_TREE;
+ /* If MEMBER is non-static, then the program has fallen afoul of
+ [expr.prim]:
- /* Try to get to basetype from 'this'; if that doesn't work,
- nothing will. */
- base = current_class_ref;
+ An id-expression that denotes a nonstatic data member or
+ nonstatic member function of a class can only be used:
- /* First convert to the intermediate base specified, if appropriate. */
- if (TREE_CODE (exp) == OFFSET_REF && TREE_CODE (type) == OFFSET_TYPE)
- base = build_scoped_ref (base, TYPE_OFFSET_BASETYPE (type), &binfo);
+ -- as part of a class member access (_expr.ref_) in which the
+ object-expression refers to the member's class or a class
+ derived from that class, or
- return build_class_member_access_expr (base, member,
- /*access_path=*/NULL_TREE,
- /*preserve_reference=*/false);
- }
+ -- to form a pointer to member (_expr.unary.op_), or
- /* Ensure that we have an object. */
- if (is_dummy_object (base))
- addr = error_mark_node;
- else
- /* If this is a reference to a member function, then return the
- address of the member function (which may involve going
- through the object's vtable), otherwise, return an expression
- for the dereferenced pointer-to-member construct. */
- addr = build_unary_op (ADDR_EXPR, base, 0);
+ -- in the body of a nonstatic member function of that class or
+ of a class derived from that class (_class.mfct.nonstatic_), or
- if (TYPE_PTRMEM_P (TREE_TYPE (member)))
- {
- if (addr == error_mark_node)
+ -- in a mem-initializer for a constructor for that class or for
+ a class derived from that class (_class.base.init_). */
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (member))
+ {
+ /* Build a representation of a the qualified name suitable
+ for use as the operand to "&" -- even though the "&" is
+ not actually present. */
+ member = build (OFFSET_REF, TREE_TYPE (member), decl, member);
+ /* In Microsoft mode, treat a non-static member function as if
+ it were a pointer-to-member. */
+ if (flag_ms_extensions)
+ {
+ PTRMEM_OK_P (member) = 1;
+ return build_unary_op (ADDR_EXPR, member, 0);
+ }
+ error ("invalid use of non-static member function `%D'",
+ TREE_OPERAND (member, 1));
+ return member;
+ }
+ else if (TREE_CODE (member) == FIELD_DECL)
{
- error ("object missing in `%E'", exp);
+ error ("invalid use of non-static data member `%D'", member);
return error_mark_node;
}
-
- basetype = TYPE_OFFSET_BASETYPE (TREE_TYPE (TREE_TYPE (member)));
- basetype = lookup_base (TREE_TYPE (TREE_TYPE (addr)),
- basetype, ba_check, NULL);
- addr = build_base_path (PLUS_EXPR, addr, basetype, 1);
-
- member = cp_convert (ptrdiff_type_node, 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);
+ return member;
}
- abort ();
- /* NOTREACHED */
- return NULL_TREE;
+
+ /* In member functions, the form `type::name' is no longer
+ equivalent to `this->type::name', at least not until
+ resolve_offset_ref. */
+ member = build (OFFSET_REF, TREE_TYPE (member), decl, member);
+ PTRMEM_OK_P (member) = 1;
+ return member;
}
/* If DECL is a `const' declaration, and its value is a known
constant, then return that value. */
tree
-decl_constant_value (decl)
- tree decl;
+decl_constant_value (tree decl)
{
- if (TREE_READONLY_DECL_P (decl)
- && ! TREE_THIS_VOLATILE (decl)
+ /* When we build a COND_EXPR, we don't know whether it will be used
+ as an lvalue or as an rvalue. If it is an lvalue, it's not safe
+ to replace the second and third operands with their
+ initializers. So, we do that here. */
+ if (TREE_CODE (decl) == COND_EXPR)
+ {
+ tree d1;
+ tree d2;
+
+ d1 = decl_constant_value (TREE_OPERAND (decl, 1));
+ d2 = decl_constant_value (TREE_OPERAND (decl, 2));
+
+ if (d1 != TREE_OPERAND (decl, 1) || d2 != TREE_OPERAND (decl, 2))
+ return build (COND_EXPR,
+ TREE_TYPE (decl),
+ TREE_OPERAND (decl, 0), d1, d2);
+ }
+
+ if (DECL_P (decl)
+ && (/* Enumeration constants are constant. */
+ TREE_CODE (decl) == CONST_DECL
+ /* And so are variables with a 'const' type -- unless they
+ are also 'volatile'. */
+ || CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl)))
&& DECL_INITIAL (decl)
&& DECL_INITIAL (decl) != error_mark_node
/* This is invalid if initial value is not constant.
@@ -1859,8 +1644,7 @@ decl_constant_value (decl)
/* Call the global __builtin_delete to delete ADDR. */
static tree
-build_builtin_delete_call (addr)
- tree addr;
+build_builtin_delete_call (tree addr)
{
mark_used (global_delete_fndecl);
return build_call (global_delete_fndecl, build_tree_list (NULL_TREE, addr));
@@ -1893,10 +1677,7 @@ build_builtin_delete_call (addr)
PLACEMENT is the `placement' list for user-defined operator new (). */
tree
-build_new (placement, decl, init, use_global_new)
- tree placement;
- tree decl, init;
- int use_global_new;
+build_new (tree placement, tree decl, tree init, int use_global_new)
{
tree type, rval;
tree nelts = NULL_TREE, t;
@@ -1926,7 +1707,7 @@ build_new (placement, decl, init, use_global_new)
if (absdcl && TREE_CODE (absdcl) == ARRAY_REF)
{
- /* probably meant to be a vec new */
+ /* Probably meant to be a vec new. */
tree this_nelts;
while (TREE_OPERAND (absdcl, 0)
@@ -1950,7 +1731,7 @@ build_new (placement, decl, init, use_global_new)
else
{
if (build_expr_type_conversion (WANT_INT | WANT_ENUM,
- this_nelts, 0)
+ this_nelts, false)
== NULL_TREE)
pedwarn ("size in array new must have integral type");
@@ -2013,8 +1794,10 @@ build_new (placement, decl, init, use_global_new)
else
t = type;
- rval = build_min_nt (NEW_EXPR, placement, t, init);
+ rval = build_min (NEW_EXPR, build_pointer_type (type),
+ placement, t, init);
NEW_EXPR_USE_GLOBAL (rval) = use_global_new;
+ TREE_SIDE_EFFECTS (rval) = 1;
return rval;
}
@@ -2065,8 +1848,7 @@ build_new (placement, decl, init, use_global_new)
/* Given a Java class, return a decl for the corresponding java.lang.Class. */
tree
-build_java_class_ref (type)
- tree type;
+build_java_class_ref (tree type)
{
tree name = NULL_TREE, class_decl;
static tree CL_suffix = NULL_TREE;
@@ -2081,7 +1863,7 @@ build_java_class_ref (type)
jclass_node = TREE_TYPE (jclass_node);
}
- /* Mangle the class$ field */
+ /* Mangle the class$ field. */
{
tree field;
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
@@ -2115,8 +1897,7 @@ build_java_class_ref (type)
known that a cookie is needed. */
static tree
-get_cookie_size (type)
- tree type;
+get_cookie_size (tree type)
{
tree cookie_size;
@@ -2139,25 +1920,33 @@ get_cookie_size (type)
value is immediately handed to expand_expr. */
static tree
-build_new_1 (exp)
- tree exp;
+build_new_1 (tree exp)
{
tree placement, init;
- tree type, true_type, size, rval, t;
+ tree true_type, size, rval;
+ /* The type of the new-expression. (This type is always a pointer
+ type.) */
+ tree pointer_type;
+ /* The type pointed to by POINTER_TYPE. */
+ tree type;
+ /* The type being allocated. For "new T[...]" this will be an
+ ARRAY_TYPE. */
tree full_type;
+ /* A pointer type pointing to to the FULL_TYPE. */
+ tree full_pointer_type;
tree outer_nelts = NULL_TREE;
tree nelts = NULL_TREE;
- tree alloc_call, alloc_expr, alloc_node;
+ tree alloc_call, alloc_expr;
+ /* The address returned by the call to "operator new". This node is
+ a VAR_DECL and is therefore reusable. */
+ tree alloc_node;
tree alloc_fn;
tree cookie_expr, init_expr;
int has_array = 0;
enum tree_code code;
- int use_cookie, nothrow, check_new;
+ int 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
@@ -2166,6 +1955,16 @@ build_new_1 (exp)
/* True if the function we are calling is a placement allocation
function. */
bool placement_allocation_fn_p;
+ tree args = NULL_TREE;
+ /* True if the storage must be initialized, either by a constructor
+ or due to an explicit new-initializer. */
+ bool is_initialized;
+ /* The address of the thing allocated, not including any cookie. In
+ particular, if an array cookie is in use, DATA_ADDR is the
+ address of the first array element. This node is a VAR_DECL, and
+ is therefore reusable. */
+ tree data_addr;
+ tree init_preeval_expr = NULL_TREE;
placement = TREE_OPERAND (exp, 0);
type = TREE_OPERAND (exp, 1);
@@ -2200,10 +1999,6 @@ build_new_1 (exp)
if (!complete_type_or_else (true_type, exp))
return error_mark_node;
- size = size_in_bytes (true_type);
- if (has_array)
- size = size_binop (MULT_EXPR, size, convert (sizetype, nelts));
-
if (TREE_CODE (true_type) == VOID_TYPE)
{
error ("invalid type `void' for new");
@@ -2213,42 +2008,18 @@ build_new_1 (exp)
if (abstract_virtuals_error (NULL_TREE, true_type))
return error_mark_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 new[]. */
- 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)
+ is_initialized = (TYPE_NEEDS_CONSTRUCTING (type) || init);
+ if (CP_TYPE_CONST_P (true_type) && !is_initialized)
{
- cookie_size = get_cookie_size (true_type);
- size = size_binop (PLUS_EXPR, size, cookie_size);
+ error ("uninitialized const in `new' of `%#T'", true_type);
+ return error_mark_node;
}
+ size = size_in_bytes (true_type);
+ if (has_array)
+ size = size_binop (MULT_EXPR, size, convert (sizetype, nelts));
+
/* Allocate the object. */
-
if (! placement && TYPE_FOR_JAVA (true_type))
{
tree class_addr, alloc_decl;
@@ -2256,11 +2027,18 @@ build_new_1 (exp)
tree class_size = size_in_bytes (true_type);
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_error ("call to Java constructor with `%s' undefined",
- alloc_name);
-
+ if (!get_global_value_if_present (get_identifier (alloc_name),
+ &alloc_decl))
+ {
+ error ("call to Java constructor with `%s' undefined", alloc_name);
+ return error_mark_node;
+ }
+ else if (really_overloaded_fn (alloc_decl))
+ {
+ error ("`%D' should never be overloaded", alloc_decl);
+ return error_mark_node;
+ }
+ alloc_decl = OVL_CURRENT (alloc_decl);
class_addr = build1 (ADDR_EXPR, jclass_node, class_decl);
alloc_call = (build_function_call
(alloc_decl,
@@ -2270,33 +2048,82 @@ build_new_1 (exp)
else
{
tree fnname;
- tree args;
+ tree fns;
- args = tree_cons (NULL_TREE, size, placement);
fnname = ansi_opname (code);
- if (use_global_new)
- alloc_call = (build_new_function_call
- (lookup_function_nonclass (fnname, args),
- args));
+ if (!globally_qualified_p
+ && CLASS_TYPE_P (true_type)
+ && (has_array
+ ? TYPE_HAS_ARRAY_NEW_OPERATOR (true_type)
+ : TYPE_HAS_NEW_OPERATOR (true_type)))
+ {
+ /* Use a class-specific operator new. */
+ /* If a cookie is required, add some extra space. */
+ if (has_array && TYPE_VEC_NEW_USES_COOKIE (true_type))
+ {
+ cookie_size = get_cookie_size (true_type);
+ size = size_binop (PLUS_EXPR, size, cookie_size);
+ }
+ /* Create the argument list. */
+ args = tree_cons (NULL_TREE, size, placement);
+ /* Do name-lookup to find the appropriate operator. */
+ fns = lookup_fnfields (true_type, fnname, /*protect=*/2);
+ if (!fns)
+ {
+ /* See PR 15967. This should never happen (and it is
+ fixed correctly in mainline), but on the release branch
+ we prefer this less-intrusive approacch. */
+ error ("no suitable or ambiguous `%D' found in class `%T'",
+ fnname, true_type);
+ return error_mark_node;
+ }
+ if (TREE_CODE (fns) == TREE_LIST)
+ {
+ error ("request for member `%D' is ambiguous", fnname);
+ print_candidates (fns);
+ return error_mark_node;
+ }
+ alloc_call = build_new_method_call (build_dummy_object (true_type),
+ fns, args,
+ /*conversion_path=*/NULL_TREE,
+ LOOKUP_NORMAL);
+ }
else
- alloc_call = build_method_call (build_dummy_object (true_type),
- fnname, args,
- TYPE_BINFO (true_type),
- LOOKUP_NORMAL);
+ {
+ /* Use a global operator new. */
+ /* See if a cookie might be required. */
+ if (has_array && TYPE_VEC_NEW_USES_COOKIE (true_type))
+ cookie_size = get_cookie_size (true_type);
+ else
+ cookie_size = NULL_TREE;
+
+ alloc_call = build_operator_new_call (fnname, placement,
+ &size, &cookie_size);
+ }
}
if (alloc_call == error_mark_node)
return error_mark_node;
- /* The ALLOC_CALL should be a CALL_EXPR -- or a COMPOUND_EXPR whose
- right-hand-side is ultimately a CALL_EXPR -- and the first
- operand should be the address of a known FUNCTION_DECL. */
- t = alloc_call;
- while (TREE_CODE (t) == COMPOUND_EXPR)
- t = TREE_OPERAND (t, 1);
- alloc_fn = get_callee_fndecl (t);
+ /* In the simple case, we can stop now. */
+ pointer_type = build_pointer_type (type);
+ if (!cookie_size && !is_initialized)
+ return build_nop (pointer_type, alloc_call);
+
+ /* While we're working, use a pointer to the type we've actually
+ allocated. Store the result of the call in a variable so that we
+ can use it more than once. */
+ full_pointer_type = build_pointer_type (full_type);
+ alloc_expr = get_target_expr (build_nop (full_pointer_type, alloc_call));
+ alloc_node = TARGET_EXPR_SLOT (alloc_expr);
+
+ /* Strip any COMPOUND_EXPRs from ALLOC_CALL. */
+ while (TREE_CODE (alloc_call) == COMPOUND_EXPR)
+ alloc_call = TREE_OPERAND (alloc_call, 1);
+ alloc_fn = get_callee_fndecl (alloc_call);
my_friendly_assert (alloc_fn != NULL_TREE, 20020325);
+
/* 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:
@@ -2311,6 +2138,17 @@ build_new_1 (exp)
= (type_num_arguments (TREE_TYPE (alloc_fn)) > 1
|| varargs_function_p (alloc_fn));
+ /* Preevaluate the placement args so that we don't reevaluate them for a
+ placement delete. */
+ if (placement_allocation_fn_p)
+ {
+ tree inits;
+ stabilize_call (alloc_call, &inits);
+ if (inits)
+ alloc_expr = build (COMPOUND_EXPR, TREE_TYPE (alloc_expr), inits,
+ alloc_expr);
+ }
+
/* 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_,
@@ -2324,81 +2162,81 @@ build_new_1 (exp)
nothrow = TYPE_NOTHROW_P (TREE_TYPE (alloc_fn));
check_new = (flag_check_new || nothrow) && ! use_java_new;
- 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)
+ if (cookie_size)
{
tree cookie;
+ /* Adjust so we're pointing to the start of the object. */
+ data_addr = get_target_expr (build (PLUS_EXPR, full_pointer_type,
+ alloc_node, cookie_size));
+
/* 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));
+ data_addr, size_in_bytes (sizetype));
cookie = build_indirect_ref (cookie, NULL);
- cookie_expr = build (MODIFY_EXPR, void_type_node, cookie, nelts);
- TREE_SIDE_EFFECTS (cookie_expr) = 1;
+ cookie_expr = build (MODIFY_EXPR, sizetype, cookie, nelts);
+ data_addr = TARGET_EXPR_SLOT (data_addr);
}
else
- cookie_expr = NULL_TREE;
+ {
+ cookie_expr = NULL_TREE;
+ data_addr = alloc_node;
+ }
- /* Now initialize the allocated object. */
- init_expr = NULL_TREE;
- if (TYPE_NEEDS_CONSTRUCTING (type) || init)
+ /* Now initialize the allocated object. Note that we preevaluate the
+ initialization expression, apart from the actual constructor call or
+ assignment--we do this because we want to delay the allocation as long
+ as possible in order to minimize the size of the exception region for
+ placement delete. */
+ if (is_initialized)
{
- init_expr = build_indirect_ref (alloc_node, NULL);
+ bool stable;
+
+ init_expr = build_indirect_ref (data_addr, NULL);
if (init == void_zero_node)
init = build_default_init (full_type, nelts);
- else if (init && pedantic && has_array)
+ else if (init && has_array)
pedwarn ("ISO C++ forbids initialization in array new");
if (has_array)
- init_expr
- = build_vec_init (init_expr,
- cp_build_binary_op (MINUS_EXPR, outer_nelts,
- integer_one_node),
- init, /*from_array=*/0);
+ {
+ init_expr
+ = build_vec_init (init_expr,
+ cp_build_binary_op (MINUS_EXPR, outer_nelts,
+ integer_one_node),
+ init, /*from_array=*/0);
+
+ /* An array initialization is stable because the initialization
+ of each element is a full-expression, so the temporaries don't
+ leak out. */
+ stable = true;
+ }
else if (TYPE_NEEDS_CONSTRUCTING (type))
- init_expr = build_special_member_call (init_expr,
- complete_ctor_identifier,
- init, TYPE_BINFO (true_type),
- LOOKUP_NORMAL);
+ {
+ init_expr = build_special_member_call (init_expr,
+ complete_ctor_identifier,
+ init, TYPE_BINFO (true_type),
+ LOOKUP_NORMAL);
+ stable = stabilize_init (init_expr, &init_preeval_expr);
+ }
else
{
/* We are processing something like `new int (10)', which
means allocate an int, and initialize it with 10. */
if (TREE_CODE (init) == TREE_LIST)
- {
- if (TREE_CHAIN (init) != NULL_TREE)
- pedwarn
- ("initializer list being treated as compound expression");
- init = build_compound_expr (init);
- }
+ init = build_x_compound_expr_from_list (init, "new initializer");
+
else if (TREE_CODE (init) == CONSTRUCTOR
&& TREE_TYPE (init) == NULL_TREE)
- {
- pedwarn ("ISO C++ forbids aggregate initializer to new");
- init = digest_init (type, init, 0);
- }
+ abort ();
init_expr = build_modify_expr (init_expr, INIT_EXPR, init);
+ stable = stabilize_init (init_expr, &init_preeval_expr);
}
if (init_expr == error_mark_node)
@@ -2418,47 +2256,34 @@ build_new_1 (exp)
tree cleanup;
int flags = (LOOKUP_NORMAL
| (globally_qualified_p * LOOKUP_GLOBAL));
- tree delete_node;
-
- if (use_cookie)
- /* Subtract the padding back out to get to the pointer returned
- from operator new. */
- delete_node = fold (build (MINUS_EXPR, TREE_TYPE (alloc_node),
- alloc_node, cookie_size));
- else
- delete_node = alloc_node;
/* 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. */
+ is to use the same method for finding deallocation
+ functions that we use for finding allocation functions. */
flags |= LOOKUP_SPECULATIVELY;
- cleanup = build_op_delete_call (dcode, delete_node, size, flags,
+ 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 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. Er, no, it wouldn't;
- we just don't run the constructor. The standard says it's
- unspecified whether or not the args are evaluated. */
-
- if (cleanup)
+ if (!cleanup)
+ /* We're done. */;
+ else if (stable)
+ /* This is much simpler if we were able to preevaluate all of
+ the arguments to the constructor call. */
+ init_expr = build (TRY_CATCH_EXPR, void_type_node,
+ init_expr, cleanup);
+ else
+ /* 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
+ finally clear the sentry.
+
+ We need to do this because we allocate the space first, so
+ if there are any temporaries with cleanups in the
+ constructor args and we weren't able to preevaluate them, we
+ need this EH region to extend until end of full-expression
+ to preserve nesting. */
{
tree end, sentry, begin;
@@ -2479,14 +2304,15 @@ build_new_1 (exp)
build (COMPOUND_EXPR, void_type_node, init_expr,
end));
}
+
}
}
- else if (CP_TYPE_CONST_P (true_type))
- error ("uninitialized const in `new' of `%#T'", true_type);
+ else
+ init_expr = NULL_TREE;
/* Now build up the return value in reverse order. */
- rval = alloc_node;
+ rval = data_addr;
if (init_expr)
rval = build (COMPOUND_EXPR, TREE_TYPE (rval), init_expr, rval);
@@ -2494,28 +2320,28 @@ build_new_1 (exp)
rval = build (COMPOUND_EXPR, TREE_TYPE (rval), cookie_expr, rval);
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);
+ /* If we don't have an initializer or a cookie, strip the TARGET_EXPR
+ and return the call (which doesn't need to be adjusted). */
+ rval = TARGET_EXPR_INITIAL (alloc_expr);
else
{
if (check_new)
{
- tree nullexp;
- tree ifexp;
-
- nullexp = convert (TREE_TYPE (alloc_node),
- use_cookie ? cookie_size : size_zero_node);
- ifexp = cp_build_binary_op (NE_EXPR, alloc_node, nullexp);
+ tree ifexp = cp_build_binary_op (NE_EXPR, alloc_node,
+ integer_zero_node);
rval = build_conditional_expr (ifexp, rval, alloc_node);
}
+ /* Perform the allocation before anything else, so that ALLOC_NODE
+ has been initialized before we start using it. */
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);
+ if (init_preeval_expr)
+ rval = build (COMPOUND_EXPR, TREE_TYPE (rval), init_preeval_expr, rval);
+
+ /* Convert to the final type. */
+ rval = build_nop (pointer_type, rval);
/* A new-expression is never an lvalue. */
if (real_lvalue_p (rval))
@@ -2525,10 +2351,8 @@ build_new_1 (exp)
}
static tree
-build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete)
- tree base, maxindex, type;
- special_function_kind auto_delete_vec;
- int use_global_delete;
+build_vec_delete_1 (tree base, tree maxindex, tree type,
+ special_function_kind auto_delete_vec, int use_global_delete)
{
tree virtual_size;
tree ptype = build_pointer_type (type = complete_type (type));
@@ -2542,7 +2366,7 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete)
tree body;
/* This is the LOOP_EXPR that governs the deletion of the elements. */
- tree loop;
+ tree loop = 0;
/* This is the thing that governs what to do after the loop has run. */
tree deallocate_expr = 0;
@@ -2558,10 +2382,7 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete)
abort ();
if (! IS_AGGR_TYPE (type) || TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
- {
- loop = integer_zero_node;
- goto no_destructor;
- }
+ goto no_destructor;
/* The below is short by the cookie size. */
virtual_size = size_binop (MULT_EXPR, size_exp,
@@ -2576,32 +2397,21 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete)
controller = build (BIND_EXPR, void_type_node, tbase, NULL_TREE, NULL_TREE);
TREE_SIDE_EFFECTS (controller) = 1;
- body = NULL_TREE;
-
- body = tree_cons (NULL_TREE,
- build_delete (ptype, tbase, sfk_complete_destructor,
- LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 1),
- body);
+ body = build (EXIT_EXPR, void_type_node,
+ build (EQ_EXPR, boolean_type_node, base, tbase));
+ body = build_compound_expr
+ (body, build_modify_expr (tbase, NOP_EXPR,
+ build (MINUS_EXPR, ptype, tbase, size_exp)));
+ body = build_compound_expr
+ (body, build_delete (ptype, tbase, sfk_complete_destructor,
+ LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 1));
- body = tree_cons (NULL_TREE,
- build_modify_expr (tbase, NOP_EXPR, build (MINUS_EXPR, ptype, tbase, size_exp)),
- body);
-
- 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 = tree_cons (NULL_TREE, tbase_init,
- tree_cons (NULL_TREE, loop, NULL_TREE));
- loop = build_compound_expr (loop);
+ loop = build (LOOP_EXPR, void_type_node, body);
+ loop = build_compound_expr (tbase_init, loop);
no_destructor:
/* If the delete flag is one, or anything else with the low bit set,
delete the storage. */
- deallocate_expr = integer_zero_node;
if (auto_delete_vec != sfk_base_destructor)
{
tree base_tbd;
@@ -2634,15 +2444,17 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete)
virtual_size);
}
- if (loop && deallocate_expr != integer_zero_node)
- {
- body = tree_cons (NULL_TREE, loop,
- tree_cons (NULL_TREE, deallocate_expr, NULL_TREE));
- body = build_compound_expr (body);
- }
+ body = loop;
+ if (!deallocate_expr)
+ ;
+ else if (!body)
+ body = deallocate_expr;
else
- body = loop;
-
+ body = build_compound_expr (body, deallocate_expr);
+
+ if (!body)
+ body = integer_zero_node;
+
/* Outermost wrapper: If pointer is null, punt. */
body = fold (build (COND_EXPR, void_type_node,
fold (build (NE_EXPR, boolean_type_node, base,
@@ -2653,25 +2465,27 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete)
if (controller)
{
TREE_OPERAND (controller, 1) = body;
- return controller;
+ body = controller;
}
- else
- return cp_convert (void_type_node, body);
+
+ if (TREE_CODE (base) == SAVE_EXPR)
+ /* Pre-evaluate the SAVE_EXPR outside of the BIND_EXPR. */
+ body = build (COMPOUND_EXPR, void_type_node, base, body);
+
+ return convert_to_void (body, /*implicit=*/NULL);
}
/* Create an unnamed variable of the indicated TYPE. */
tree
-create_temporary_var (type)
- tree type;
+create_temporary_var (tree type)
{
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_SOURCE_LOCATION (decl) = input_location;
DECL_IGNORED_P (decl) = 1;
DECL_CONTEXT (decl) = current_function_decl;
@@ -2686,16 +2500,13 @@ create_temporary_var (type)
"outside" the binding contour of the function). */
static tree
-get_temp_regvar (type, init)
- tree type, init;
+get_temp_regvar (tree type, tree init)
{
tree decl;
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));
+ add_decl_stmt (decl);
+
finish_expr_stmt (build_modify_expr (decl, INIT_EXPR, init));
return decl;
@@ -2718,9 +2529,7 @@ get_temp_regvar (type, init)
but use assignment instead of initialization. */
tree
-build_vec_init (base, maxindex, init, from_array)
- tree base, init, maxindex;
- int from_array;
+build_vec_init (tree base, tree maxindex, tree init, int from_array)
{
tree rval;
tree base2 = NULL_TREE;
@@ -2739,7 +2548,8 @@ build_vec_init (base, maxindex, init, from_array)
tree try_block = NULL_TREE;
tree try_body = NULL_TREE;
int num_initialized_elts = 0;
-
+ bool is_global;
+
if (TYPE_DOMAIN (atype))
maxindex = array_type_nelts (atype);
@@ -2769,22 +2579,23 @@ build_vec_init (base, maxindex, init, from_array)
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));
+ base = cp_convert (ptype, decay_conversion (base));
/* The code we are generating looks like:
-
+ ({
T* t1 = (T*) base;
T* rval = t1;
ptrdiff_t iterator = maxindex;
try {
- do {
+ for (; iterator != -1; --iterator) {
... initialize *t1 ...
++t1;
- } while (--iterator != -1);
+ }
} catch (...) {
... destroy elements that were constructed ...
}
- return rval;
+ rval;
+ })
We can omit the try and catch blocks if we know that the
initialization will never throw an exception, or if the array
@@ -2800,7 +2611,7 @@ build_vec_init (base, maxindex, init, from_array)
of whatever cleverness the back-end has for dealing with copies
of blocks of memory. */
- begin_init_stmts (&stmt_expr, &compound_stmt);
+ is_global = 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);
@@ -2814,7 +2625,7 @@ build_vec_init (base, maxindex, init, from_array)
&& from_array != 2)
{
try_block = begin_try_block ();
- try_body = begin_compound_stmt (/*has_no_scope=*/1);
+ try_body = begin_compound_stmt (/*has_no_scope=*/true);
}
if (init != NULL_TREE && TREE_CODE (init) == CONSTRUCTOR)
@@ -2832,11 +2643,13 @@ build_vec_init (base, maxindex, init, from_array)
num_initialized_elts++;
+ current_stmt_tree ()->stmts_are_full_exprs_p = 1;
if (IS_AGGR_TYPE (type) || TREE_CODE (type) == ARRAY_TYPE)
finish_expr_stmt (build_aggr_init (baseref, elt, 0));
else
finish_expr_stmt (build_modify_expr (baseref, NOP_EXPR,
elt));
+ current_stmt_tree ()->stmts_are_full_exprs_p = 0;
finish_expr_stmt (build_unary_op (PREINCREMENT_EXPR, base, 0));
finish_expr_stmt (build_unary_op (PREDECREMENT_EXPR, iterator, 0));
@@ -2852,7 +2665,7 @@ build_vec_init (base, maxindex, init, from_array)
checking. */
if (init)
{
- base2 = default_conversion (init);
+ base2 = decay_conversion (init);
itype = TREE_TYPE (base2);
base2 = get_temp_regvar (itype, base2);
itype = TREE_TYPE (itype);
@@ -2880,33 +2693,20 @@ build_vec_init (base, maxindex, init, from_array)
{
/* If the ITERATOR is equal to -1, then we don't have to loop;
we've already initialized all the elements. */
- tree if_stmt;
- tree do_stmt;
- tree do_body;
+ tree for_stmt;
+ tree for_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);
+ for_stmt = begin_for_stmt ();
+ finish_for_init_stmt (for_stmt);
+ finish_for_cond (build (NE_EXPR, boolean_type_node,
+ iterator, integer_minus_one_node),
+ for_stmt);
+ finish_for_expr (build_unary_op (PREDECREMENT_EXPR, iterator, 0),
+ for_stmt);
/* Otherwise, loop through the elements. */
- 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 ();
+ for_body = begin_compound_stmt (/*has_no_scope=*/true);
if (from_array)
{
@@ -2939,33 +2739,16 @@ build_vec_init (base, maxindex, init, from_array)
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;
- }
+ current_stmt_tree ()->stmts_are_full_exprs_p = 1;
+ finish_expr_stmt (elt_init);
+ current_stmt_tree ()->stmts_are_full_exprs_p = 0;
finish_expr_stmt (build_unary_op (PREINCREMENT_EXPR, base, 0));
if (base2)
finish_expr_stmt (build_unary_op (PREINCREMENT_EXPR, base2, 0));
- 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);
-
- finish_then_clause (if_stmt);
- finish_if_stmt ();
+ finish_compound_stmt (for_body);
+ finish_for_stmt (for_stmt);
}
/* Make sure to cleanup any partially constructed elements. */
@@ -2984,20 +2767,24 @@ build_vec_init (base, maxindex, init, from_array)
type = strip_array_types (type);
}
- finish_compound_stmt (/*has_no_scope=*/1, try_body);
+ finish_compound_stmt (try_body);
finish_cleanup_try_block (try_block);
- e = build_vec_delete_1 (rval, m,
- type,
- sfk_base_destructor,
+ e = build_vec_delete_1 (rval, m, type, sfk_base_destructor,
/*use_global_delete=*/0);
finish_cleanup (e, try_block);
}
- /* The value of the array initialization is the address of the
- first element in the array. */
- finish_expr_stmt (rval);
+ /* The value of the array initialization is the array itself, RVAL
+ is a pointer to the first element. */
+ finish_stmt_expr_expr (rval);
+
+ stmt_expr = finish_init_stmts (is_global, stmt_expr, compound_stmt);
- stmt_expr = finish_init_stmts (stmt_expr, compound_stmt);
+ /* Now convert make the result have the correct type. */
+ atype = build_pointer_type (atype);
+ stmt_expr = build1 (NOP_EXPR, atype, stmt_expr);
+ stmt_expr = build_indirect_ref (stmt_expr, NULL);
+
current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
return stmt_expr;
}
@@ -3017,10 +2804,7 @@ build_vec_init (base, maxindex, init, from_array)
This does not call any destructors. */
tree
-build_x_delete (addr, which_delete, virtual_size)
- tree addr;
- int which_delete;
- tree virtual_size;
+build_x_delete (tree addr, int which_delete, tree virtual_size)
{
int use_global_delete = which_delete & 1;
int use_vec_delete = !!(which_delete & 2);
@@ -3034,13 +2818,10 @@ build_x_delete (addr, which_delete, virtual_size)
build_delete. */
static tree
-build_dtor_call (exp, dtor_kind, flags)
- tree exp;
- special_function_kind dtor_kind;
- int flags;
+build_dtor_call (tree exp, special_function_kind dtor_kind, int flags)
{
tree name;
-
+ tree fn;
switch (dtor_kind)
{
case sfk_complete_destructor:
@@ -3058,8 +2839,13 @@ build_dtor_call (exp, dtor_kind, flags)
default:
abort ();
}
- return build_method_call (exp, name, NULL_TREE,
- TYPE_BINFO (TREE_TYPE (exp)), flags);
+
+ exp = convert_from_reference (exp);
+ fn = lookup_fnfields (TREE_TYPE (exp), name, /*protect=*/2);
+ return build_new_method_call (exp, fn,
+ /*args=*/NULL_TREE,
+ /*conversion_path=*/NULL_TREE,
+ flags);
}
/* Generate a call to a destructor. TYPE is the type to cast ADDR to.
@@ -3072,11 +2858,8 @@ build_dtor_call (exp, dtor_kind, flags)
flags. See cp-tree.h for more info. */
tree
-build_delete (type, addr, auto_delete, flags, use_global_delete)
- tree type, addr;
- special_function_kind auto_delete;
- int flags;
- int use_global_delete;
+build_delete (tree type, tree addr, special_function_kind auto_delete,
+ int flags, int use_global_delete)
{
tree expr;
@@ -3092,27 +2875,39 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
if (TREE_CODE (type) == POINTER_TYPE)
{
+ bool complete_p = true;
+
type = TYPE_MAIN_VARIANT (TREE_TYPE (type));
if (TREE_CODE (type) == ARRAY_TYPE)
goto handle_array;
- if (VOID_TYPE_P (type)
- /* We don't want to warn about delete of void*, only other
- incomplete types. Deleting other incomplete types
- invokes undefined behavior, but it is not ill-formed, so
- compile to something that would even do The Right Thing
- (TM) should the type have a trivial dtor and no delete
- operator. */
- || !complete_type_or_diagnostic (type, addr, 1)
- || !IS_AGGR_TYPE (type))
+ /* We don't want to warn about delete of void*, only other
+ incomplete types. Deleting other incomplete types
+ invokes undefined behavior, but it is not ill-formed, so
+ compile to something that would even do The Right Thing
+ (TM) should the type have a trivial dtor and no delete
+ operator. */
+ if (!VOID_TYPE_P (type))
{
- /* Call the builtin operator delete. */
- return build_builtin_delete_call (addr);
+ complete_type (type);
+ if (!COMPLETE_TYPE_P (type))
+ {
+ warning ("possible problem detected in invocation of "
+ "delete operator:");
+ cxx_incomplete_type_diagnostic (addr, type, 1);
+ inform ("neither the destructor nor the class-specific "
+ "operator delete will be called, even if they are "
+ "declared when the class is defined.");
+ complete_p = false;
+ }
}
+ if (VOID_TYPE_P (type) || !complete_p || !IS_AGGR_TYPE (type))
+ /* Call the builtin operator delete. */
+ return build_builtin_delete_call (addr);
if (TREE_SIDE_EFFECTS (addr))
addr = save_expr (addr);
- /* throw away const and volatile on target type of addr */
+ /* Throw away const and volatile on target type of addr. */
addr = convert_force (build_pointer_type (type), addr, 0);
}
else if (TREE_CODE (type) == ARRAY_TYPE)
@@ -3223,7 +3018,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
Called from begin_destructor_body. */
void
-push_base_cleanups ()
+push_base_cleanups (void)
{
tree binfos;
int i, n_baseclasses;
@@ -3305,28 +3100,26 @@ push_base_cleanups ()
/* For type TYPE, delete the virtual baseclass objects of DECL. */
tree
-build_vbase_delete (type, decl)
- tree type, decl;
+build_vbase_delete (tree type, tree decl)
{
tree vbases = CLASSTYPE_VBASECLASSES (type);
- tree result = NULL_TREE;
+ tree result;
tree addr = build_unary_op (ADDR_EXPR, decl, 0);
my_friendly_assert (addr != error_mark_node, 222);
- while (vbases)
+ for (result = convert_to_void (integer_zero_node, NULL);
+ vbases; vbases = TREE_CHAIN (vbases))
{
- 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,
- sfk_base_destructor,
- LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0),
- result);
- vbases = TREE_CHAIN (vbases);
+ tree base_addr = convert_force
+ (build_pointer_type (BINFO_TYPE (TREE_VALUE (vbases))), addr, 0);
+ tree base_delete = build_delete
+ (TREE_TYPE (base_addr), base_addr, sfk_base_destructor,
+ LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0);
+
+ result = build_compound_expr (result, base_delete);
}
- return build_compound_expr (nreverse (result));
+ return result;
}
/* Build a C++ vector delete expression.
@@ -3346,27 +3139,25 @@ build_vbase_delete (type, decl)
be worth bothering.) */
tree
-build_vec_delete (base, maxindex, auto_delete_vec, use_global_delete)
- tree base, maxindex;
- special_function_kind auto_delete_vec;
- int use_global_delete;
+build_vec_delete (tree base, tree maxindex,
+ special_function_kind auto_delete_vec, int use_global_delete)
{
tree type;
-
- if (TREE_CODE (base) == OFFSET_REF)
- base = resolve_offset_ref (base);
+ tree rval;
+ tree base_init = NULL_TREE;
type = TREE_TYPE (base);
- base = stabilize_reference (base);
-
if (TREE_CODE (type) == POINTER_TYPE)
{
/* Step back one from start of vector, and read dimension. */
tree cookie_addr;
if (TREE_SIDE_EFFECTS (base))
- base = save_expr (base);
+ {
+ base_init = get_target_expr (base);
+ base = TARGET_EXPR_SLOT (base_init);
+ }
type = strip_array_types (TREE_TYPE (type));
cookie_addr = build (MINUS_EXPR,
build_pointer_type (sizetype),
@@ -3376,12 +3167,16 @@ build_vec_delete (base, maxindex, auto_delete_vec, use_global_delete)
}
else if (TREE_CODE (type) == ARRAY_TYPE)
{
- /* get the total number of things in the array, maxindex is a bad name */
+ /* Get the total number of things in the array, maxindex is a
+ bad name. */
maxindex = array_type_nelts_total (type);
type = strip_array_types (type);
base = build_unary_op (ADDR_EXPR, base, 1);
if (TREE_SIDE_EFFECTS (base))
- base = save_expr (base);
+ {
+ base_init = get_target_expr (base);
+ base = TARGET_EXPR_SLOT (base_init);
+ }
}
else
{
@@ -3390,6 +3185,10 @@ build_vec_delete (base, maxindex, auto_delete_vec, use_global_delete)
return error_mark_node;
}
- return build_vec_delete_1 (base, maxindex, type, auto_delete_vec,
+ rval = build_vec_delete_1 (base, maxindex, type, auto_delete_vec,
use_global_delete);
+ if (base_init)
+ rval = build (COMPOUND_EXPR, TREE_TYPE (rval), base_init, rval);
+
+ return rval;
}
diff --git a/contrib/gcc/cp/lang-specs.h b/contrib/gcc/cp/lang-specs.h
index f7de6d4..5815ea5 100644
--- a/contrib/gcc/cp/lang-specs.h
+++ b/contrib/gcc/cp/lang-specs.h
@@ -1,21 +1,21 @@
/* Definitions for specs for C++.
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -32,14 +32,26 @@ Boston, MA 02111-1307, USA. */
{".cpp", "@c++", 0},
{".c++", "@c++", 0},
{".C", "@c++", 0},
+ {".CPP", "@c++", 0},
+ {".H", "@c++-header", 0},
+ {".hh", "@c++-header", 0},
+ {"@c++-header",
+ "%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}\
+ %{!E:%{!M:%{!MM:\
+ %{save-temps|no-integrated-cpp:cc1plus -E\
+ %(cpp_options) %2 -o %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\
+ cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\
+ %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+ %(cc1_options) %2 %{+e1*}\
+ -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
+ CPLUSPLUS_CPP_SPEC},
{"@c++",
- "%{E|M|MM:cc1plus -E %{!no-gcc:-D__GNUG__=%v1}\
- %(cpp_options) %2 %(cpp_debug_options)}\
+ "%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}\
%{!E:%{!M:%{!MM:\
- %{save-temps|no-integrated-cpp:cc1plus -E %{!no-gcc:-D__GNUG__=%v1}\
- %(cpp_options) %2 %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\
+ %{save-temps|no-integrated-cpp:cc1plus -E\
+ %(cpp_options) %2 -o %{save-temps:%b.ii} %{!save-temps:%g.ii} \n}\
cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\
- %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options) %{!no-gcc:-D__GNUG__=%v1}}}\
+ %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
%(cc1_options) %2 %{+e1*}\
%{!fsyntax-only:%(invoke_as)}}}}",
CPLUSPLUS_CPP_SPEC},
diff --git a/contrib/gcc/cp/lex.c b/contrib/gcc/cp/lex.c
index 6660c84..2239c76 100644
--- a/contrib/gcc/cp/lex.c
+++ b/contrib/gcc/cp/lex.c
@@ -1,22 +1,22 @@
/* Separate lexical analyzer for GNU C++.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -25,71 +25,35 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "input.h"
#include "tree.h"
#include "cp-tree.h"
#include "cpplib.h"
#include "lex.h"
-#include "parse.h"
#include "flags.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
-
-extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
-
-static int interface_strcmp PARAMS ((const char *));
-static int *init_cpp_parse PARAMS ((void));
-static void init_cp_pragma PARAMS ((void));
+static int interface_strcmp (const char *);
+static void init_cp_pragma (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 *));
+static tree parse_strconst_pragma (const char *, int);
+static void handle_pragma_vtable (cpp_reader *);
+static void handle_pragma_unit (cpp_reader *);
+static void handle_pragma_interface (cpp_reader *);
+static void handle_pragma_implementation (cpp_reader *);
+static void handle_pragma_java_exceptions (cpp_reader *);
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
-static int reduce_cmp PARAMS ((int *, int *));
-static int token_cmp PARAMS ((int *, int *));
-#endif
-#endif
-static int is_global PARAMS ((tree));
-static void init_operators PARAMS ((void));
-static void copy_lang_type PARAMS ((tree));
+static void init_operators (void);
+static void copy_lang_type (tree);
/* A constraint that can be tested at compile time. */
-#ifdef __STDC__
#define CONSTRAINT(name, expr) extern int constraint_##name [(expr) ? 1 : -1]
-#else
-#define CONSTRAINT(name, expr) extern int constraint_/**/name [(expr) ? 1 : -1]
-#endif
-
-#include "cpplib.h"
-
-extern int yychar; /* the lookahead symbol */
-extern YYSTYPE yylval; /* the semantic value of the */
- /* lookahead symbol */
-
-/* the declaration found for the last IDENTIFIER token read in. yylex
- must look this up to detect typedefs, which get token type
- tTYPENAME, so it is left around in case the identifier is not a
- typedef but is used in a context which makes it a reference to a
- variable. */
-tree lastiddecl;
-
-/* Array for holding counts of the numbers of tokens seen. */
-extern int *token_count;
/* Functions and data structures for #pragma interface.
@@ -128,8 +92,7 @@ static struct impl_files *impl_file_chain;
and whose type is the modifier list. */
tree
-make_pointer_declarator (cv_qualifiers, target)
- tree cv_qualifiers, target;
+make_pointer_declarator (tree cv_qualifiers, tree target)
{
if (target && TREE_CODE (target) == IDENTIFIER_NODE
&& ANON_AGGRNAME_P (target))
@@ -148,32 +111,16 @@ make_pointer_declarator (cv_qualifiers, target)
and whose type is the modifier list. */
tree
-make_reference_declarator (cv_qualifiers, target)
- tree cv_qualifiers, target;
+make_reference_declarator (tree cv_qualifiers, tree target)
{
- if (target)
- {
- if (TREE_CODE (target) == ADDR_EXPR)
- {
- error ("cannot declare references to references");
- return target;
- }
- if (TREE_CODE (target) == INDIRECT_REF)
- {
- error ("cannot declare pointers to references");
- return target;
- }
- if (TREE_CODE (target) == IDENTIFIER_NODE && ANON_AGGRNAME_P (target))
- error ("type name expected before `&'");
- }
target = build_nt (ADDR_EXPR, target);
TREE_TYPE (target) = cv_qualifiers;
return target;
}
tree
-make_call_declarator (target, parms, cv_qualifiers, exception_specification)
- tree target, parms, cv_qualifiers, exception_specification;
+make_call_declarator (tree target, tree parms, tree cv_qualifiers,
+ tree exception_specification)
{
target = build_nt (CALL_EXPR, target,
tree_cons (parms, cv_qualifiers, NULL_TREE),
@@ -185,8 +132,8 @@ make_call_declarator (target, parms, cv_qualifiers, exception_specification)
}
void
-set_quals_and_spec (call_declarator, cv_qualifiers, exception_specification)
- tree call_declarator, cv_qualifiers, exception_specification;
+set_quals_and_spec (tree call_declarator, tree cv_qualifiers,
+ tree exception_specification)
{
CALL_DECLARATOR_QUALS (call_declarator) = cv_qualifiers;
CALL_DECLARATOR_EXCEPTION_SPEC (call_declarator) = exception_specification;
@@ -198,42 +145,12 @@ int interface_unknown; /* whether or not we know this class
to behave according to #pragma interface. */
-/* Initialization before switch parsing. */
void
-cxx_init_options ()
-{
- c_common_init_options (clk_cplusplus);
-
- /* 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;
-}
-
-void
-cxx_finish ()
+cxx_finish (void)
{
c_common_finish ();
}
-static int *
-init_cpp_parse ()
-{
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
- reduce_count = (int *) xcalloc (sizeof (int), (REDUCE_LENGTH + 1));
- reduce_count += 1;
- token_count = (int *) xcalloc (sizeof (int), (TOKEN_LENGTH + 1));
- token_count += 1;
-#endif
-#endif
- return token_count;
-}
-
/* 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. */
@@ -247,7 +164,7 @@ operator_name_info_t assignment_operator_name_info[(int) LAST_CPLUS_TREE_CODE];
#undef DEF_OPERATOR
static void
-init_operators ()
+init_operators (void)
{
tree identifier;
char buffer[256];
@@ -288,8 +205,6 @@ init_operators ()
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";
@@ -316,7 +231,7 @@ init_operators ()
struct resword
{
const char *const word;
- const ENUM_BITFIELD(rid) rid : 16;
+ ENUM_BITFIELD(rid) const rid : 16;
const unsigned int disable : 16;
};
@@ -351,6 +266,8 @@ static const struct resword reswords[] =
{ "__inline__", RID_INLINE, 0 },
{ "__label__", RID_LABEL, 0 },
{ "__null", RID_NULL, 0 },
+ { "__offsetof", RID_OFFSETOF, 0 },
+ { "__offsetof__", RID_OFFSETOF, 0 },
{ "__real", RID_REALPART, 0 },
{ "__real__", RID_REALPART, 0 },
{ "__restrict", RID_RESTRICT, 0 },
@@ -429,146 +346,15 @@ static const struct resword reswords[] =
};
-/* 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,
- /* RID_THREAD */ SCSPEC,
-
- /* 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,
-
- /* 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 ()
+init_reswords (void)
{
unsigned int i;
tree id;
int mask = ((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));
+ ridpointers = ggc_calloc ((int) RID_MAX, sizeof (tree));
for (i = 0; i < ARRAY_SIZE (reswords); i++)
{
id = get_identifier (reswords[i].word);
@@ -580,34 +366,37 @@ init_reswords ()
}
static void
-init_cp_pragma ()
+init_cp_pragma (void)
{
- cpp_register_pragma (parse_in, 0, "vtable", handle_pragma_vtable);
- cpp_register_pragma (parse_in, 0, "unit", handle_pragma_unit);
-
- 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);
+ c_register_pragma (0, "vtable", handle_pragma_vtable);
+ c_register_pragma (0, "unit", handle_pragma_unit);
+ c_register_pragma (0, "interface", handle_pragma_interface);
+ c_register_pragma (0, "implementation", handle_pragma_implementation);
+ c_register_pragma ("GCC", "interface", handle_pragma_interface);
+ c_register_pragma ("GCC", "implementation", handle_pragma_implementation);
+ c_register_pragma ("GCC", "java_exceptions", handle_pragma_java_exceptions);
}
-
+
/* 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;
+bool
+cxx_init (void)
{
- input_filename = "<internal>";
+ static const enum tree_code stmt_codes[] = {
+ c_common_stmt_codes,
+ cp_stmt_codes
+ };
+
+ INIT_STATEMENT_CODES (stmt_codes);
+
+ /* We cannot just assign to input_filename because it has already
+ been initialized and will be used later as an N_BINCL for stabs+
+ debugging. */
+ push_srcloc ("<internal>", 0);
init_reswords ();
- init_spew ();
init_tree ();
init_cp_semantics ();
init_operators ();
@@ -616,21 +405,7 @@ cxx_init (filename)
current_function_decl = NULL;
- 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_STRUCT] = record_type_node;
-
- union_type_node = build_int_2 (union_type, 0);
- TREE_TYPE (union_type_node) = union_type_node;
- ridpointers[(int) RID_UNION] = union_type_node;
-
- enum_type_node = build_int_2 (enum_type, 0);
- TREE_TYPE (enum_type_node) = enum_type_node;
- ridpointers[(int) RID_ENUM] = enum_type_node;
+ class_type_node = ridpointers[(int) RID_CLASS];
cxx_init_decl_processing ();
@@ -639,193 +414,31 @@ cxx_init (filename)
TREE_TYPE (null_node) = c_common_type_for_size (POINTER_SIZE, 0);
ridpointers[RID_NULL] = null_node;
- token_count = init_cpp_parse ();
interface_unknown = 1;
- filename = c_common_init (filename);
- if (filename == NULL)
- return NULL;
-
- init_cp_pragma ();
-
- init_repo (filename);
-
- return filename;
-}
-
-inline void
-yyprint (file, yychar, yylval)
- FILE *file;
- int yychar;
- YYSTYPE yylval;
-{
- tree t;
- switch (yychar)
+ if (c_common_init () == false)
{
- case IDENTIFIER:
- case tTYPENAME:
- case TYPESPEC:
- case PTYPENAME:
- case PFUNCNAME:
- case IDENTIFIER_DEFN:
- case TYPENAME_DEFN:
- case PTYPENAME_DEFN:
- case SCSPEC:
- case PRE_PARSED_CLASS_DECL:
- t = yylval.ttype;
- if (TREE_CODE (t) == TYPE_DECL || TREE_CODE (t) == TEMPLATE_DECL)
- {
- fprintf (file, " `%s'", IDENTIFIER_POINTER (DECL_NAME (t)));
- break;
- }
- my_friendly_assert (TREE_CODE (t) == IDENTIFIER_NODE, 224);
- if (IDENTIFIER_POINTER (t))
- fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
- break;
-
- case AGGR:
- if (yylval.ttype == class_type_node)
- fprintf (file, " `class'");
- else if (yylval.ttype == record_type_node)
- fprintf (file, " `struct'");
- else if (yylval.ttype == union_type_node)
- fprintf (file, " `union'");
- else if (yylval.ttype == enum_type_node)
- fprintf (file, " `enum'");
- else
- 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;
+ pop_srcloc();
+ return false;
}
-}
-
-#if defined(GATHER_STATISTICS) && defined(REDUCE_LENGTH)
-static int *reduce_count;
-#endif
-
-int *token_count;
-
-#if 0
-#define REDUCE_LENGTH ARRAY_SIZE (yyr2)
-#define TOKEN_LENGTH (256 + ARRAY_SIZE (yytname))
-#endif
-
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
-void
-yyhook (yyn)
- int yyn;
-{
- reduce_count[yyn] += 1;
-}
-
-static int
-reduce_cmp (p, q)
- int *p, *q;
-{
- return reduce_count[*q] - reduce_count[*p];
-}
-static int
-token_cmp (p, q)
- int *p, *q;
-{
- return token_count[*q] - token_count[*p];
-}
-#endif
-#endif
-
-void
-print_parse_statistics ()
-{
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
-#if YYDEBUG != 0
- int i;
- int maxlen = REDUCE_LENGTH;
- unsigned *sorted;
-
- if (reduce_count[-1] == 0)
- return;
+ init_cp_pragma ();
- if (TOKEN_LENGTH > REDUCE_LENGTH)
- maxlen = TOKEN_LENGTH;
- sorted = (unsigned *) alloca (sizeof (int) * maxlen);
+ init_repo (main_input_filename);
- for (i = 0; i < TOKEN_LENGTH; i++)
- sorted[i] = i;
- qsort (sorted, TOKEN_LENGTH, sizeof (int), token_cmp);
- for (i = 0; i < TOKEN_LENGTH; i++)
- {
- int idx = sorted[i];
- if (token_count[idx] == 0)
- break;
- if (token_count[idx] < token_count[-1])
- break;
- fprintf (stderr, "token %d, `%s', count = %d\n",
- idx, yytname[YYTRANSLATE (idx)], token_count[idx]);
- }
- fprintf (stderr, "\n");
- for (i = 0; i < REDUCE_LENGTH; i++)
- sorted[i] = i;
- qsort (sorted, REDUCE_LENGTH, sizeof (int), reduce_cmp);
- for (i = 0; i < REDUCE_LENGTH; i++)
- {
- int idx = sorted[i];
- if (reduce_count[idx] == 0)
- break;
- if (reduce_count[idx] < reduce_count[-1])
- break;
- fprintf (stderr, "rule %d, line %d, count = %d\n",
- idx, yyrline[idx], reduce_count[idx]);
- }
- fprintf (stderr, "\n");
-#endif
-#endif
-#endif
+ pop_srcloc();
+ return true;
}
-
+
/* Helper function to load global variables with interface
information. */
void
-extract_interface_info ()
+extract_interface_info (void)
{
- struct c_fileinfo *finfo = 0;
-
- if (flag_alt_external_templates)
- {
- tree til = tinst_for_decl ();
-
- if (til)
- finfo = get_fileinfo (TINST_FILE (til));
- }
- if (!finfo)
- finfo = get_fileinfo (input_filename);
+ struct c_fileinfo *finfo;
+ finfo = get_fileinfo (input_filename);
interface_only = finfo->interface_only;
interface_unknown = finfo->interface_unknown;
}
@@ -834,8 +447,7 @@ extract_interface_info ()
INTERFACE/IMPLEMENTATION pair. Otherwise, return 0. */
static int
-interface_strcmp (s)
- const char *s;
+interface_strcmp (const char* s)
{
/* Set the interface/implementation bits for this scope. */
struct impl_files *ifiles;
@@ -871,68 +483,12 @@ interface_strcmp (s)
return 1;
}
-/* 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. */
-
-void
-check_for_missing_semicolon (type)
- tree type;
-{
- if (yychar < 0)
- yychar = yylex ();
-
- if ((yychar > 255
- && yychar != SCSPEC
- && yychar != IDENTIFIER
- && yychar != tTYPENAME
- && yychar != CV_QUALIFIER
- && yychar != SELFNAME)
- || yychar == 0 /* EOF */)
- {
- if (TYPE_ANONYMOUS_P (type))
- error ("semicolon missing after %s declaration",
- TREE_CODE (type) == ENUMERAL_TYPE ? "enum" : "struct");
- else
- error ("semicolon missing after declaration of `%T'", type);
- shadow_tag (build_tree_list (0, type));
- }
- /* Could probably also hack cases where class { ... } f (); appears. */
- clear_anon_tags ();
-}
-
-void
-note_got_semicolon (type)
- tree type;
-{
- if (!TYPE_P (type))
- abort ();
- if (CLASS_TYPE_P (type))
- CLASSTYPE_GOT_SEMICOLON (type) = 1;
-}
-
-void
-note_list_got_semicolon (declspecs)
- tree declspecs;
-{
- tree link;
-
- for (link = declspecs; link; link = TREE_CHAIN (link))
- {
- tree type = TREE_VALUE (link);
- if (type && TYPE_P (type))
- note_got_semicolon (type);
- }
- clear_anon_tags ();
-}
/* 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;
+parse_strconst_pragma (const char* name, int opt)
{
tree result, x;
enum cpp_ttype t;
@@ -954,24 +510,21 @@ parse_strconst_pragma (name, opt)
}
static void
-handle_pragma_vtable (dfile)
- cpp_reader *dfile ATTRIBUTE_UNUSED;
+handle_pragma_vtable (cpp_reader* dfile ATTRIBUTE_UNUSED )
{
parse_strconst_pragma ("vtable", 0);
sorry ("#pragma vtable no longer supported");
}
static void
-handle_pragma_unit (dfile)
- cpp_reader *dfile ATTRIBUTE_UNUSED;
+handle_pragma_unit (cpp_reader* dfile ATTRIBUTE_UNUSED )
{
/* Validate syntax, but don't do anything. */
parse_strconst_pragma ("unit", 0);
}
static void
-handle_pragma_interface (dfile)
- cpp_reader *dfile ATTRIBUTE_UNUSED;
+handle_pragma_interface (cpp_reader* dfile ATTRIBUTE_UNUSED )
{
tree fname = parse_strconst_pragma ("interface", 1);
struct c_fileinfo *finfo;
@@ -1013,8 +566,7 @@ handle_pragma_interface (dfile)
a matching #p interface for this to have any effect. */
static void
-handle_pragma_implementation (dfile)
- cpp_reader *dfile ATTRIBUTE_UNUSED;
+handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED )
{
tree fname = parse_strconst_pragma ("implementation", 1);
const char *main_filename;
@@ -1046,7 +598,7 @@ handle_pragma_implementation (dfile)
}
if (ifiles == 0)
{
- ifiles = (struct impl_files*) xmalloc (sizeof (struct impl_files));
+ ifiles = xmalloc (sizeof (struct impl_files));
ifiles->filename = main_filename;
ifiles->next = impl_file_chain;
impl_file_chain = ifiles;
@@ -1055,8 +607,7 @@ handle_pragma_implementation (dfile)
/* Indicate that this file uses Java-personality exception handling. */
static void
-handle_pragma_java_exceptions (dfile)
- cpp_reader *dfile ATTRIBUTE_UNUSED;
+handle_pragma_java_exceptions (cpp_reader* dfile ATTRIBUTE_UNUSED )
{
tree x;
if (c_lex (&x) != CPP_EOF)
@@ -1065,40 +616,10 @@ handle_pragma_java_exceptions (dfile)
choose_personality_routine (lang_java);
}
-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 ();
-}
-
-/* Return true if d is in a global scope. */
-
-static int
-is_global (d)
- tree d;
-{
- while (1)
- switch (TREE_CODE (d))
- {
- case ERROR_MARK:
- return 1;
-
- case OVERLOAD: d = OVL_FUNCTION (d); continue;
- case TREE_LIST: d = TREE_VALUE (d); continue;
- default:
- my_friendly_assert (DECL_P (d), 980629);
-
- return DECL_NAMESPACE_SCOPE_P (d);
- }
-}
-
/* Issue an error message indicating that the lookup of NAME (an
- IDENTIFIER_NODE) failed. */
+ IDENTIFIER_NODE) failed. Returns the ERROR_MARK_NODE. */
-void
+tree
unqualified_name_lookup_error (tree name)
{
if (IDENTIFIER_OPNAME_P (name))
@@ -1127,218 +648,52 @@ unqualified_name_lookup_error (tree name)
SET_IDENTIFIER_NAMESPACE_VALUE (name, error_mark_node);
SET_IDENTIFIER_ERROR_LOCUS (name, current_function_decl);
}
-}
-
-tree
-do_identifier (token, parsing, args)
- register tree token;
- int parsing;
- tree args;
-{
- register tree id;
- int lexing = (parsing == 1 || parsing == 3);
-
- timevar_push (TV_NAME_LOOKUP);
- if (! lexing)
- id = lookup_name (token, 0);
- else
- id = lastiddecl;
-
- if (lexing && id && TREE_DEPRECATED (id))
- warn_deprecated_use (id);
-
- /* Do Koenig lookup if appropriate (inside templates we build lookup
- 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)))
- 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 && parsing != 3)
- maybe_note_name_used_in_class (token, id);
-
- if (id == error_mark_node)
- {
- /* lookup_name quietly returns error_mark_node if we're parsing,
- as we don't want to complain about an identifier that ends up
- being used as a declarator. So we call it again to get the error
- message. */
- id = lookup_name (token, 0);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
- }
- if (!id || (TREE_CODE (id) == FUNCTION_DECL
- && DECL_ANTICIPATED (id)))
- {
- if (current_template_parms)
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
- build_min_nt (LOOKUP_EXPR, token));
- else if (IDENTIFIER_TYPENAME_P (token))
- /* A templated conversion operator might exist. */
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, token);
- else
- {
- unqualified_name_lookup_error (token);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
- }
- }
-
- id = check_for_out_of_scope_variable (id);
-
- /* TREE_USED is set in `hack_identifier'. */
- if (TREE_CODE (id) == CONST_DECL)
- {
- /* Check access. */
- if (IDENTIFIER_CLASS_VALUE (token) == id)
- enforce_access (CP_DECL_CONTEXT(id), id);
- if (!processing_template_decl || DECL_TEMPLATE_PARM_P (id))
- id = DECL_INITIAL (id);
- }
- else
- id = hack_identifier (id, token);
-
- /* We must look up dependent names when the template is
- instantiated, not while parsing it. For now, we don't
- distinguish between dependent and independent names. So, for
- example, we look up all overloaded functions at
- instantiation-time, even though in some cases we should just use
- the DECL we have here. We also use LOOKUP_EXPRs to find things
- 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)
- || (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);
-
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, id);
+ return error_mark_node;
}
+/* Like unqualified_name_lookup_error, but NAME is an unqualified-id
+ used as a function. Returns an appropriate expression for
+ NAME. */
+
tree
-do_scoped_id (token, id)
- tree token;
- tree id;
+unqualified_fn_lookup_error (tree name)
{
- timevar_push (TV_NAME_LOOKUP);
- if (!id || (TREE_CODE (id) == FUNCTION_DECL
- && DECL_ANTICIPATED (id)))
- {
- if (processing_template_decl)
- {
- id = build_min_nt (LOOKUP_EXPR, token);
- LOOKUP_EXPR_GLOBAL (id) = 1;
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, id);
- }
- 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
- {
- if (TREE_CODE (id) == ADDR_EXPR)
- mark_used (TREE_OPERAND (id, 0));
- else if (TREE_CODE (id) != OVERLOAD)
- mark_used (id);
- }
- if (TREE_CODE (id) == CONST_DECL && ! processing_template_decl)
- {
- /* XXX CHS - should we set TREE_USED of the constant? */
- id = DECL_INITIAL (id);
- /* This is to prevent an enum whose value is 0
- from being considered a null pointer constant. */
- id = build1 (NOP_EXPR, TREE_TYPE (id), id);
- TREE_CONSTANT (id) = 1;
- }
-
if (processing_template_decl)
{
- if (is_overloaded_fn (id))
+ /* In a template, it is invalid to write "f()" or "f(3)" if no
+ declaration of "f" is available. Historically, G++ and most
+ other compilers accepted that usage since they deferred all name
+ lookup until instantiation time rather than doing unqualified
+ name lookup at template definition time; explain to the user what
+ is going wrong.
+
+ Note that we have the exact wording of the following message in
+ the manual (trouble.texi, node "Name lookup"), so they need to
+ be kept in synch. */
+ pedwarn ("there are no arguments to `%D' that depend on a template "
+ "parameter, so a declaration of `%D' must be available",
+ name, name);
+
+ if (!flag_permissive)
{
- id = build_min_nt (LOOKUP_EXPR, token);
- LOOKUP_EXPR_GLOBAL (id) = 1;
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, id);
+ static bool hint;
+ if (!hint)
+ {
+ error ("(if you use `-fpermissive', G++ will accept your code, "
+ "but allowing the use of an undeclared name is "
+ "deprecated)");
+ hint = true;
+ }
}
- /* else just use the decl */
- }
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, convert_from_reference (id));
-}
-
-tree
-identifier_typedecl_value (node)
- tree node;
-{
- tree t, type;
- type = IDENTIFIER_TYPE_VALUE (node);
- if (type == NULL_TREE)
- return NULL_TREE;
-
- if (IDENTIFIER_BINDING (node))
- {
- t = IDENTIFIER_VALUE (node);
- if (t && TREE_CODE (t) == TYPE_DECL && TREE_TYPE (t) == type)
- return t;
- }
- if (IDENTIFIER_NAMESPACE_VALUE (node))
- {
- t = IDENTIFIER_NAMESPACE_VALUE (node);
- if (t && TREE_CODE (t) == TYPE_DECL && TREE_TYPE (t) == type)
- return t;
+ return name;
}
- /* Will this one ever happen? */
- if (TYPE_MAIN_DECL (type))
- return TYPE_MAIN_DECL (type);
-
- /* We used to do an internal error of 62 here, but instead we will
- handle the return of a null appropriately in the callers. */
- return NULL_TREE;
+ return unqualified_name_lookup_error (name);
}
-#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
- instead. */
-/* Statistics-gathering stuff. */
-typedef enum
-{
- d_kind,
- t_kind,
- b_kind,
- s_kind,
- r_kind,
- e_kind,
- c_kind,
- id_kind,
- op_id_kind,
- perm_list_kind,
- temp_list_kind,
- vec_kind,
- x_kind,
- lang_decl,
- lang_type,
- all_kinds
-} tree_node_kind;
-
-extern int tree_node_counts[];
-extern int tree_node_sizes[];
-#endif
-
tree
-build_lang_decl (code, name, type)
- enum tree_code code;
- tree name;
- tree type;
+build_lang_decl (enum tree_code code, tree name, tree type)
{
tree t;
@@ -1352,8 +707,7 @@ build_lang_decl (code, name, type)
and pushdecl (for functions generated by the backend). */
void
-retrofit_lang_decl (t)
- tree t;
+retrofit_lang_decl (tree t)
{
struct lang_decl *ld;
size_t size;
@@ -1363,7 +717,7 @@ retrofit_lang_decl (t)
else
size = sizeof (struct lang_decl_flags);
- ld = (struct lang_decl *) ggc_alloc_cleared (size);
+ ld = ggc_alloc_cleared (size);
ld->decl_flags.can_be_full = CAN_HAVE_FULL_LANG_DECL_P (t) ? 1 : 0;
ld->decl_flags.u1sel = TREE_CODE (t) == NAMESPACE_DECL ? 1 : 0;
@@ -1372,7 +726,8 @@ retrofit_lang_decl (t)
ld->u.f.u3sel = TREE_CODE (t) == FUNCTION_DECL ? 1 : 0;
DECL_LANG_SPECIFIC (t) = ld;
- if (current_lang_name == lang_name_cplusplus)
+ if (current_lang_name == lang_name_cplusplus
+ || decl_linkage (t) == lk_none)
SET_DECL_LANGUAGE (t, lang_cplusplus);
else if (current_lang_name == lang_name_c)
SET_DECL_LANGUAGE (t, lang_c);
@@ -1387,8 +742,7 @@ retrofit_lang_decl (t)
}
void
-cxx_dup_lang_specific_decl (node)
- tree node;
+cxx_dup_lang_specific_decl (tree node)
{
int size;
struct lang_decl *ld;
@@ -1400,7 +754,7 @@ cxx_dup_lang_specific_decl (node)
size = sizeof (struct lang_decl_flags);
else
size = sizeof (struct lang_decl);
- ld = (struct lang_decl *) ggc_alloc (size);
+ ld = ggc_alloc (size);
memcpy (ld, DECL_LANG_SPECIFIC (node), size);
DECL_LANG_SPECIFIC (node) = ld;
@@ -1413,8 +767,7 @@ cxx_dup_lang_specific_decl (node)
/* Copy DECL, including any language-specific parts. */
tree
-copy_decl (decl)
- tree decl;
+copy_decl (tree decl)
{
tree copy;
@@ -1426,8 +779,7 @@ copy_decl (decl)
/* Replace the shared language-specific parts of NODE with a new copy. */
static void
-copy_lang_type (node)
- tree node;
+copy_lang_type (tree node)
{
int size;
struct lang_type *lt;
@@ -1439,7 +791,7 @@ copy_lang_type (node)
size = sizeof (struct lang_type);
else
size = sizeof (struct lang_type_ptrmem);
- lt = (struct lang_type *) ggc_alloc (size);
+ lt = ggc_alloc (size);
memcpy (lt, TYPE_LANG_SPECIFIC (node), size);
TYPE_LANG_SPECIFIC (node) = lt;
@@ -1452,8 +804,7 @@ copy_lang_type (node)
/* Copy TYPE, including any language-specific parts. */
tree
-copy_type (type)
- tree type;
+copy_type (tree type)
{
tree copy;
@@ -1463,10 +814,9 @@ copy_type (type)
}
tree
-cxx_make_type (code)
- enum tree_code code;
+cxx_make_type (enum tree_code code)
{
- register tree t = make_node (code);
+ tree t = make_node (code);
/* Create lang_type structure. */
if (IS_AGGR_TYPE_CODE (code)
@@ -1474,8 +824,7 @@ cxx_make_type (code)
{
struct lang_type *pi;
- pi = ((struct lang_type *)
- ggc_alloc_cleared (sizeof (struct lang_type)));
+ pi = ggc_alloc_cleared (sizeof (struct lang_type));
TYPE_LANG_SPECIFIC (t) = pi;
pi->u.c.h.is_lang_type_class = 1;
@@ -1516,8 +865,7 @@ cxx_make_type (code)
}
tree
-make_aggr_type (code)
- enum tree_code code;
+make_aggr_type (enum tree_code code)
{
tree t = cxx_make_type (code);
@@ -1531,8 +879,7 @@ make_aggr_type (code)
RID. */
int
-cp_type_qual_from_rid (rid)
- tree rid;
+cp_type_qual_from_rid (tree rid)
{
if (rid == ridpointers[(int) RID_CONST])
return TYPE_QUAL_CONST;
diff --git a/contrib/gcc/cp/lex.h b/contrib/gcc/cp/lex.h
index 15de168..35c3503 100644
--- a/contrib/gcc/cp/lex.h
+++ b/contrib/gcc/cp/lex.h
@@ -1,25 +1,26 @@
-/* Define constants and variables for communication with parse.y.
+/* Define constants and variables for communication with the parser.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 2000 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
and by Brendan Kehoe (brendan@cygnus.com).
-This file is part of GNU CC.
+ This file is part of GCC.
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the GNU CC General Public
-License for full details.
+ GCC 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.
+
+ GCC 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 GCC; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
-Everyone is granted permission to copy, modify and redistribute
-GNU CC, but only under the conditions described in the
-GNU CC General Public License. A copy of this license is
-supposed to have been given to you along with GNU CC so you
-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
@@ -64,24 +65,4 @@ typedef unsigned long RID_BIT_TYPE; /* assumed at least 32 bits */
#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,
- so it is left around in case the identifier is not a typedef but is
- used in a context which makes it a reference to a variable. */
-extern GTY(()) tree lastiddecl;
-
-/* Back-door communication channel to the lexer. */
-extern int looking_for_typename;
-extern int looking_for_template;
-
-/* Tell the lexer where to look for names. */
-extern GTY(()) tree got_scope;
-extern GTY(()) tree got_object;
-
-/* Pending language change.
- Positive is push count, negative is pop count. */
-extern int pending_lang_change;
-
-extern int yylex PARAMS ((void));
-
#endif /* ! GCC_CP_LEX_H */
diff --git a/contrib/gcc/cp/mangle.c b/contrib/gcc/cp/mangle.c
index 7180648..760d8b3 100644
--- a/contrib/gcc/cp/mangle.c
+++ b/contrib/gcc/cp/mangle.c
@@ -1,21 +1,21 @@
/* Name mangling for the 3.0 C++ ABI.
- Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Written by Alex Samuel <sameul@codesourcery.com>
- This file is part of GNU CC.
+ This file is part of GCC.
- GNU CC is free software; you can redistribute it and/or modify it
+ GCC 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
+ GCC 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
+ along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
@@ -49,6 +49,8 @@
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "tm_p.h"
#include "cp-tree.h"
@@ -56,7 +58,7 @@
#include "obstack.h"
#include "toplev.h"
#include "varray.h"
-#include "ggc.h"
+#include "flags.h"
/* Debugging support. */
@@ -122,7 +124,7 @@ substitution_identifier_index_t;
/* For quick substitution checks, look up these common identifiers
once only. */
-static tree subst_identifiers[SUBID_MAX];
+static GTY(()) tree subst_identifiers[SUBID_MAX];
/* Single-letter codes for builtin integer types, defined in
<builtin-type>. These are indexed by integer_type_kind values. */
@@ -142,70 +144,74 @@ integer_type_codes[itk_none] =
'y' /* itk_unsigned_long_long */
};
-static int decl_is_template_id PARAMS ((tree, tree*));
+static int decl_is_template_id (const tree, tree* const);
/* 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));
+static inline tree canonicalize_for_substitution (tree);
+static void add_substitution (tree);
+static inline int is_std_substitution (const tree,
+ const substitution_identifier_index_t);
+static inline int is_std_substitution_char (const tree,
+ const substitution_identifier_index_t);
+static int find_substitution (tree);
+static void mangle_call_offset (const tree, const 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_conversion_operator_name (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_real_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));
+static void write_mangled_name (const tree, bool);
+static void write_encoding (const tree);
+static void write_name (tree, const int);
+static void write_unscoped_name (const tree);
+static void write_unscoped_template_name (const tree);
+static void write_nested_name (const tree);
+static void write_prefix (const tree);
+static void write_template_prefix (const tree);
+static void write_unqualified_name (const tree);
+static void write_conversion_operator_name (const tree);
+static void write_source_name (tree);
+static int hwint_to_ascii (unsigned HOST_WIDE_INT, const unsigned int, char *,
+ const unsigned int);
+static void write_number (unsigned HOST_WIDE_INT, const int,
+ const unsigned int);
+static void write_integer_cst (const tree);
+static void write_real_cst (const tree);
+static void write_identifier (const char *);
+static void write_special_name_constructor (const tree);
+static void write_special_name_destructor (const tree);
+static void write_type (tree);
+static int write_CV_qualifiers_for_type (const tree);
+static void write_builtin_type (tree);
+static void write_function_type (const tree);
+static void write_bare_function_type (const tree, const int, const tree);
+static void write_method_parms (tree, const int, const tree);
+static void write_class_enum_type (const tree);
+static void write_template_args (tree);
+static void write_expression (tree);
+static void write_template_arg_literal (const tree);
+static void write_template_arg (tree);
+static void write_template_template_arg (const tree);
+static void write_array_type (const tree);
+static void write_pointer_to_member_type (const tree);
+static void write_template_param (const tree);
+static void write_template_template_param (const tree);
+static void write_substitution (const int);
+static int discriminator_for_local_entity (tree);
+static int discriminator_for_string_literal (tree, tree);
+static void write_discriminator (const int);
+static void write_local_name (const tree, const tree, const tree);
+static void dump_substitution_candidates (void);
+static const char *mangle_decl_string (const tree);
/* Control functions. */
-static inline void start_mangling (tree);
-static inline const char *finish_mangling (bool);
-static tree mangle_special_for_type PARAMS ((tree, const char *));
+static inline void start_mangling (const tree);
+static inline const char *finish_mangling (const bool);
+static tree mangle_special_for_type (const tree, const char *);
/* Foreign language functions. */
-static void write_java_integer_type_codes PARAMS ((tree));
+static void write_java_integer_type_codes (const tree);
/* Append a single character to the end of the mangled
representation. */
@@ -242,15 +248,13 @@ static void write_java_integer_type_codes PARAMS ((tree));
Otherwise return zero. */
static int
-decl_is_template_id (decl, template_info)
- tree decl;
- tree* template_info;
+decl_is_template_id (const tree decl, tree* const 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);
+ const tree type = TREE_TYPE (decl);
if (CLASS_TYPE_P (type) && CLASSTYPE_TEMPLATE_ID_P (type))
{
@@ -284,7 +288,7 @@ decl_is_template_id (decl, template_info)
/* Produce debugging output of current substitution candidates. */
static void
-dump_substitution_candidates ()
+dump_substitution_candidates (void)
{
unsigned i;
@@ -316,13 +320,12 @@ dump_substitution_candidates ()
/* 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
+ be treated accordingly 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;
+canonicalize_for_substitution (tree node)
{
/* For a TYPE_DECL, use the type instead. */
if (TREE_CODE (node) == TYPE_DECL)
@@ -337,8 +340,7 @@ canonicalize_for_substitution (node)
the list of candidates. */
static void
-add_substitution (node)
- tree node;
+add_substitution (tree node)
{
tree c;
@@ -359,7 +361,7 @@ add_substitution (node)
int i;
for (i = VARRAY_ACTIVE_SIZE (G.substitutions); --i >= 0; )
{
- tree candidate = VARRAY_TREE (G.substitutions, i);
+ const tree candidate = VARRAY_TREE (G.substitutions, i);
if ((DECL_P (node)
&& node == candidate)
|| (TYPE_P (node)
@@ -382,9 +384,8 @@ add_substitution (node)
name of substitution_index[INDEX] in the ::std namespace. */
static inline int
-is_std_substitution (node, index)
- tree node;
- substitution_identifier_index_t index;
+is_std_substitution (const tree node,
+ const substitution_identifier_index_t index)
{
tree type = NULL;
tree decl = NULL;
@@ -416,9 +417,8 @@ is_std_substitution (node, index)
substitution_index[INDEX]. */
static inline int
-is_std_substitution_char (node, index)
- tree node;
- substitution_identifier_index_t index;
+is_std_substitution_char (const tree node,
+ const substitution_identifier_index_t index)
{
tree args;
/* Check NODE's name is ::std::identifier. */
@@ -473,11 +473,10 @@ is_std_substitution_char (node, index)
return nonzero. If none is found, just return zero. */
static int
-find_substitution (node)
- tree node;
+find_substitution (tree node)
{
int i;
- int size = VARRAY_ACTIVE_SIZE (G.substitutions);
+ const int size = VARRAY_ACTIVE_SIZE (G.substitutions);
tree decl;
tree type;
@@ -548,6 +547,7 @@ find_substitution (node)
args <char, std::char_traits<char> > . */
tree args = CLASSTYPE_TI_ARGS (type);
if (TREE_VEC_LENGTH (args) == 2
+ && TYPE_P (TREE_VEC_ELT (args, 0))
&& same_type_p (TREE_VEC_ELT (args, 0), char_type_node)
&& is_std_substitution_char (TREE_VEC_ELT (args, 1),
SUBID_CHAR_TRAITS))
@@ -603,28 +603,66 @@ find_substitution (node)
}
-/* <mangled-name> ::= _Z <encoding> */
+/* TOP_LEVEL is true, if this is being called at outermost level of
+ mangling. It should be false when mangling a decl appearing in an
+ expression within some other mangling.
+
+ <mangled-name> ::= _Z <encoding> */
-static inline void
-write_mangled_name (decl)
- tree decl;
+static void
+write_mangled_name (const tree decl, bool top_level)
{
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));
+ 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))
+ {
+ unmangled_name:;
+
+ if (top_level)
+ write_string (IDENTIFIER_POINTER (DECL_NAME (decl)));
+ else
+ {
+ /* 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. */
+ if (abi_version_at_least (2))
+ write_string ("_Z");
+ else
+ G.need_abi_warning = true;
+ write_source_name (DECL_NAME (decl));
+ }
+ }
+ else if (TREE_CODE (decl) == VAR_DECL
+ /* The names of global variables aren't mangled. */
+ && (CP_DECL_CONTEXT (decl) == global_namespace
+ /* And neither are `extern "C"' variables. */
+ || DECL_EXTERN_C_P (decl)))
+ {
+ if (top_level || abi_version_at_least (2))
+ goto unmangled_name;
+ else
+ {
+ G.need_abi_warning = true;
+ goto mangled_name;
+ }
+ }
else
- /* C++ name; needs to be mangled. */
{
+ mangled_name:;
write_string ("_Z");
write_encoding (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* ");
}
}
@@ -632,8 +670,7 @@ write_mangled_name (decl)
::= <data name> */
static void
-write_encoding (decl)
- tree decl;
+write_encoding (const tree decl)
{
MANGLE_TRACE_TREE ("encoding", decl);
@@ -652,18 +689,25 @@ write_encoding (decl)
if (TREE_CODE (decl) == FUNCTION_DECL)
{
tree fn_type;
+ tree d;
if (decl_is_template_id (decl, NULL))
- fn_type = get_mostly_instantiated_function_type (decl);
+ {
+ fn_type = get_mostly_instantiated_function_type (decl);
+ d = NULL_TREE;
+ }
else
- fn_type = TREE_TYPE (decl);
+ {
+ fn_type = TREE_TYPE (decl);
+ d = 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);
+ d);
}
}
@@ -679,9 +723,7 @@ write_encoding (decl)
production, to avoid an infinite recursion. */
static void
-write_name (decl, ignore_local_scope)
- tree decl;
- int ignore_local_scope;
+write_name (tree decl, const int ignore_local_scope)
{
tree context;
@@ -763,8 +805,7 @@ write_name (decl, ignore_local_scope)
::= St <unqualified-name> # ::std:: */
static void
-write_unscoped_name (decl)
- tree decl;
+write_unscoped_name (const tree decl)
{
tree context = CP_DECL_CONTEXT (decl);
@@ -790,8 +831,7 @@ write_unscoped_name (decl)
::= <substitution> */
static void
-write_unscoped_template_name (decl)
- tree decl;
+write_unscoped_template_name (const tree decl)
{
MANGLE_TRACE_TREE ("unscoped-template-name", decl);
@@ -809,8 +849,7 @@ write_unscoped_template_name (decl)
<CV-qualifiers> ::= [r] [V] [K] */
static void
-write_nested_name (decl)
- tree decl;
+write_nested_name (const tree decl)
{
tree template_info;
@@ -851,8 +890,7 @@ write_nested_name (decl)
::= <substitution> */
static void
-write_prefix (node)
- tree node;
+write_prefix (const tree node)
{
tree decl;
/* Non-NULL if NODE represents a template-id. */
@@ -917,8 +955,7 @@ write_prefix (node)
::= <substitution> */
static void
-write_template_prefix (node)
- tree node;
+write_template_prefix (const tree node)
{
tree decl = DECL_P (node) ? node : TYPE_NAME (node);
tree type = DECL_P (node) ? TREE_TYPE (node) : node;
@@ -993,8 +1030,7 @@ write_template_prefix (node)
::= <source-name> */
static void
-write_unqualified_name (decl)
- tree decl;
+write_unqualified_name (const tree decl)
{
MANGLE_TRACE_TREE ("unqualified-name", decl);
@@ -1002,6 +1038,8 @@ write_unqualified_name (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_NAME (decl) == NULL_TREE)
+ write_source_name (DECL_ASSEMBLER_NAME (decl));
else if (DECL_CONV_FN_P (decl))
{
/* Conversion operator. Handle it right here.
@@ -1033,19 +1071,18 @@ write_unqualified_name (decl)
/* Write the unqualified-name for a conversion operator to TYPE. */
static void
-write_conversion_operator_name (tree type)
+write_conversion_operator_name (const tree type)
{
write_string ("cv");
write_type (type);
}
-/* Non-termial <source-name>. IDENTIFIER is an IDENTIFIER_NODE.
+/* Non-terminal <source-name>. IDENTIFIER is an IDENTIFIER_NODE.
<source-name> ::= </length/ number> <identifier> */
static void
-write_source_name (identifier)
- tree identifier;
+write_source_name (tree identifier)
{
MANGLE_TRACE_TREE ("source-name", identifier);
@@ -1065,11 +1102,8 @@ write_source_name (identifier)
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;
+hwint_to_ascii (unsigned HOST_WIDE_INT number, const unsigned int base,
+ char *buffer, const unsigned int min_digits)
{
static const char base_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
unsigned digits = 0;
@@ -1095,10 +1129,8 @@ hwint_to_ascii (number, base, buffer, min_digits)
<number> ::= [n] </decimal integer/> */
static void
-write_number (number, unsigned_p, base)
- unsigned HOST_WIDE_INT number;
- int unsigned_p;
- unsigned int base;
+write_number (unsigned HOST_WIDE_INT number, const int unsigned_p,
+ const unsigned int base)
{
char buffer[sizeof (HOST_WIDE_INT) * 8];
unsigned count = 0;
@@ -1117,8 +1149,7 @@ write_number (number, unsigned_p, base)
bigger than that, which we must deal with. */
static inline void
-write_integer_cst (cst)
- tree cst;
+write_integer_cst (const tree cst)
{
int sign = tree_int_cst_sgn (cst);
@@ -1161,7 +1192,7 @@ write_integer_cst (cst)
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,
@@ -1208,8 +1239,7 @@ write_integer_cst (cst)
Caller is responsible for the Lx and the E. */
static void
-write_real_cst (value)
- tree value;
+write_real_cst (const tree value)
{
if (abi_version_at_least (2))
{
@@ -1258,8 +1288,7 @@ write_real_cst (value)
<identifier> ::= </unqualified source code identifier> */
static void
-write_identifier (identifier)
- const char *identifier;
+write_identifier (const char *identifier)
{
MANGLE_TRACE ("identifier", identifier);
write_string (identifier);
@@ -1279,8 +1308,7 @@ write_identifier (identifier)
append *INTERNAL* to that, to make sure we never emit it. */
static void
-write_special_name_constructor (ctor)
- tree ctor;
+write_special_name_constructor (const tree ctor)
{
if (DECL_COMPLETE_CONSTRUCTOR_P (ctor)
/* Even though we don't ever emit a definition of the
@@ -1306,8 +1334,7 @@ write_special_name_constructor (ctor)
append *INTERNAL* to that, to make sure we never emit it. */
static void
-write_special_name_destructor (dtor)
- tree dtor;
+write_special_name_destructor (const tree dtor)
{
if (DECL_DELETING_DESTRUCTOR_P (dtor))
write_string ("D0");
@@ -1328,14 +1355,12 @@ write_special_name_destructor (dtor)
entities with the same name in the same FUNCTION. */
static int
-discriminator_for_local_entity (entity)
- tree entity;
+discriminator_for_local_entity (tree entity)
{
tree *type;
- int discriminator;
/* Assume this is the only local entity with this name. */
- discriminator = 0;
+ int discriminator = 0;
if (DECL_DISCRIMINATOR_P (entity) && DECL_LANG_SPECIFIC (entity))
discriminator = DECL_DISCRIMINATOR (entity);
@@ -1353,13 +1378,12 @@ discriminator_for_local_entity (entity)
}
/* Return the discriminator for STRING, a string literal used inside
- FUNCTION. The disciminator is the lexical ordinal of STRING among
+ FUNCTION. The discriminator 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;
+discriminator_for_string_literal (tree function ATTRIBUTE_UNUSED,
+ tree string ATTRIBUTE_UNUSED)
{
/* For now, we don't discriminate amongst string literals. */
return 0;
@@ -1372,8 +1396,7 @@ discriminator_for_string_literal (function, string)
n - 2, if this is the nth occurrence, in lexical order. */
static void
-write_discriminator (discriminator)
- int discriminator;
+write_discriminator (const int discriminator)
{
/* If discriminator is zero, don't write anything. Otherwise... */
if (discriminator > 0)
@@ -1393,10 +1416,8 @@ write_discriminator (discriminator)
:= Z <function encoding> E s [<discriminator>] */
static void
-write_local_name (function, local_entity, entity)
- tree function;
- tree local_entity;
- tree entity;
+write_local_name (const tree function, const tree local_entity,
+ const tree entity)
{
MANGLE_TRACE_TREE ("local-name", entity);
@@ -1438,8 +1459,7 @@ write_local_name (function, local_entity, entity)
TYPE is a type node. */
static void
-write_type (type)
- tree type;
+write_type (tree type)
{
/* This gets set to nonzero if TYPE turns out to be a (possibly
CV-qualified) builtin type. */
@@ -1456,7 +1476,7 @@ write_type (type)
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
+ since both the qualified and unqualified types are substitution
candidates. */
write_type (TYPE_MAIN_VARIANT (type));
else if (TREE_CODE (type) == ARRAY_TYPE)
@@ -1469,7 +1489,9 @@ write_type (type)
/* See through any typedefs. */
type = TYPE_MAIN_VARIANT (type);
- switch (TREE_CODE (type))
+ if (TYPE_PTRMEM_P (type))
+ write_pointer_to_member_type (type);
+ else switch (TREE_CODE (type))
{
case VOID_TYPE:
case BOOLEAN_TYPE:
@@ -1511,15 +1533,8 @@ write_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));
- }
+ write_char ('P');
+ write_type (TREE_TYPE (type));
break;
case REFERENCE_TYPE:
@@ -1542,10 +1557,6 @@ write_type (type)
(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));
@@ -1567,8 +1578,7 @@ write_type (type)
<CV-qualifiers> ::= [r] [V] [K] */
static int
-write_CV_qualifiers_for_type (type)
- tree type;
+write_CV_qualifiers_for_type (const tree type)
{
int num_qualifiers = 0;
@@ -1626,8 +1636,7 @@ write_CV_qualifiers_for_type (type)
::= u <source-name> # vendor extended type */
static void
-write_builtin_type (type)
- tree type;
+write_builtin_type (tree type)
{
switch (TREE_CODE (type))
{
@@ -1710,8 +1719,7 @@ write_builtin_type (type)
<function-type> ::= F [Y] <bare-function-type> E */
static void
-write_function_type (type)
- tree type;
+write_function_type (const tree type)
{
MANGLE_TRACE_TREE ("function-type", type);
@@ -1752,10 +1760,8 @@ write_function_type (type)
<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;
+write_bare_function_type (const tree type, const int include_return_type_p,
+ const tree decl)
{
MANGLE_TRACE_TREE ("bare-function-type", type);
@@ -1776,10 +1782,7 @@ write_bare_function_type (type, include_return_type_p, decl)
parameters are being emitted. */
static void
-write_method_parms (parm_types, method_p, decl)
- tree decl;
- tree parm_types;
- int method_p;
+write_method_parms (tree parm_types, const int method_p, const tree decl)
{
tree first_parm_type;
tree parm_decl = decl ? DECL_ARGUMENTS (decl) : NULL_TREE;
@@ -1837,8 +1840,7 @@ write_method_parms (parm_types, method_p, decl)
/* <class-enum-type> ::= <name> */
static void
-write_class_enum_type (type)
- tree type;
+write_class_enum_type (const tree type)
{
write_name (TYPE_NAME (type), /*ignore_local_scope=*/0);
}
@@ -1849,40 +1851,27 @@ write_class_enum_type (type)
<template-args> ::= I <template-arg>+ E */
static void
-write_template_args (args)
- tree args;
+write_template_args (tree args)
{
+ int i;
+ int length = TREE_VEC_LENGTH (args);
+
MANGLE_TRACE_TREE ("template-args", args);
write_char ('I');
- if (TREE_CODE (args) == TREE_VEC)
- {
- int i;
- int length = TREE_VEC_LENGTH (args);
- my_friendly_assert (length > 0, 20000422);
+ 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);
- }
- for (i = 0; i < length; ++i)
- write_template_arg (TREE_VEC_ELT (args, i));
- }
- else
+ if (TREE_CODE (TREE_VEC_ELT (args, 0)) == TREE_VEC)
{
- my_friendly_assert (TREE_CODE (args) == TREE_LIST, 20021014);
-
- while (args)
- {
- write_template_arg (TREE_VALUE (args));
- args = TREE_CHAIN (args);
- }
+ /* We have nested template args. We want the innermost template
+ argument list. */
+ args = TREE_VEC_ELT (args, length - 1);
+ length = TREE_VEC_LENGTH (args);
}
-
+ for (i = 0; i < length; ++i)
+ write_template_arg (TREE_VEC_ELT (args, i));
+
write_char ('E');
}
@@ -1897,8 +1886,7 @@ write_template_args (args)
::= sr <type> <unqualified-name> <template-args> */
static void
-write_expression (expr)
- tree expr;
+write_expression (tree expr)
{
enum tree_code code;
@@ -1942,7 +1930,7 @@ write_expression (expr)
if (code == CONST_DECL)
G.need_abi_warning = 1;
write_char ('L');
- write_mangled_name (expr);
+ write_mangled_name (expr, false);
write_char ('E');
}
else if (TREE_CODE (expr) == SIZEOF_EXPR
@@ -1975,8 +1963,6 @@ write_expression (expr)
{
template_args = TREE_OPERAND (member, 1);
member = TREE_OPERAND (member, 0);
- if (TREE_CODE (member) == LOOKUP_EXPR)
- member = TREE_OPERAND (member, 0);
}
else
template_args = NULL_TREE;
@@ -2068,6 +2054,19 @@ write_expression (expr)
write_type (TREE_OPERAND (expr, 0));
if (TREE_CODE (TREE_OPERAND (expr, 1)) == IDENTIFIER_NODE)
write_source_name (TREE_OPERAND (expr, 1));
+ else if (TREE_CODE (TREE_OPERAND (expr, 1)) == TEMPLATE_ID_EXPR)
+ {
+ tree template_id;
+ tree name;
+
+ template_id = TREE_OPERAND (expr, 1);
+ name = TREE_OPERAND (template_id, 0);
+ /* FIXME: What about operators? */
+ my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE,
+ 20030707);
+ write_source_name (TREE_OPERAND (template_id, 0));
+ write_template_args (TREE_OPERAND (template_id, 1));
+ }
else
{
/* G++ 3.2 incorrectly put out both the "sr" code and
@@ -2079,7 +2078,21 @@ write_expression (expr)
default:
for (i = 0; i < TREE_CODE_LENGTH (code); ++i)
- write_expression (TREE_OPERAND (expr, i));
+ {
+ tree operand = TREE_OPERAND (expr, i);
+ /* As a GNU expression, the middle operand of a
+ conditional may be omitted. Since expression
+ manglings are supposed to represent the input token
+ stream, there's no good way to mangle such an
+ expression without extending the C++ ABI. */
+ if (code == COND_EXPR && i == 1 && !operand)
+ {
+ error ("omitted middle operand to `?:' operand "
+ "cannot be mangled");
+ continue;
+ }
+ write_expression (operand);
+ }
}
}
}
@@ -2092,8 +2105,7 @@ write_expression (expr)
encoded as 0, true as 1." */
static void
-write_template_arg_literal (value)
- tree value;
+write_template_arg_literal (const tree value)
{
tree type = TREE_TYPE (value);
write_char ('L');
@@ -2105,9 +2117,9 @@ write_template_arg_literal (value)
{
if (same_type_p (type, boolean_type_node))
{
- if (value == boolean_false_node || integer_zerop (value))
+ if (integer_zerop (value))
write_unsigned_number (0);
- else if (value == boolean_true_node)
+ else if (integer_onep (value))
write_unsigned_number (1);
else
abort ();
@@ -2131,14 +2143,13 @@ write_template_arg_literal (value)
::= X <expression> E # expression */
static void
-write_template_arg (node)
- tree node;
+write_template_arg (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
+ /* A template template parameter's argument list contains TREE_LIST
nodes of which the value field is the the actual argument. */
if (code == TREE_LIST)
{
@@ -2150,6 +2161,20 @@ write_template_arg (node)
code = TREE_CODE (node);
}
}
+
+ if (TREE_CODE (node) == NOP_EXPR
+ && TREE_CODE (TREE_TYPE (node)) == REFERENCE_TYPE)
+ {
+ /* Template parameters can be of reference type. To maintain
+ internal consistency, such arguments use a conversion from
+ address of object to reference type. */
+ my_friendly_assert (TREE_CODE (TREE_OPERAND (node, 0)) == ADDR_EXPR,
+ 20031215);
+ if (abi_version_at_least (2))
+ node = TREE_OPERAND (TREE_OPERAND (node, 0), 0);
+ else
+ G.need_abi_warning = 1;
+ }
if (TYPE_P (node))
write_type (node);
@@ -2183,8 +2208,8 @@ write_template_arg (node)
::= <name>
::= <substitution> */
-void
-write_template_template_arg (tree decl)
+static void
+write_template_template_arg (const tree decl)
{
MANGLE_TRACE_TREE ("template-template-arg", decl);
@@ -2204,9 +2229,8 @@ write_template_template_arg (tree decl)
element type. For variable length arrays, the dimension (but not
the '_' separator) is omitted." */
-static void
-write_array_type (type)
- tree type;
+static void
+write_array_type (const tree type)
{
write_char ('A');
if (TYPE_DOMAIN (type))
@@ -2226,7 +2250,20 @@ write_array_type (type)
write_unsigned_number (tree_low_cst (max, 1));
}
else
- write_expression (TREE_OPERAND (max, 0));
+ {
+ max = TREE_OPERAND (max, 0);
+ if (!abi_version_at_least (2))
+ {
+ /* value_dependent_expression_p presumes nothing is
+ dependent when PROCESSING_TEMPLATE_DECL is zero. */
+ ++processing_template_decl;
+ if (!value_dependent_expression_p (max))
+ G.need_abi_warning = 1;
+ --processing_template_decl;
+ }
+ write_expression (max);
+ }
+
}
write_char ('_');
write_type (TREE_TYPE (type));
@@ -2238,8 +2275,7 @@ write_array_type (type)
<pointer-to-member-type> ::= M </class/ type> </member/ type> */
static void
-write_pointer_to_member_type (type)
- tree type;
+write_pointer_to_member_type (const tree type)
{
write_char ('M');
write_type (TYPE_PTRMEM_CLASS_TYPE (type));
@@ -2250,18 +2286,10 @@ write_pointer_to_member_type (type)
TEMPLATE_TEMPLATE_PARM, BOUND_TEMPLATE_TEMPLATE_PARM or a
TEMPLATE_PARM_INDEX.
- <template-param> ::= T </parameter/ number> _
-
- If we are internally mangling then we distinguish level and, for
- non-type parms, type too. The mangling appends
-
- </level/ number> _ </non-type type/ type> _
-
- This is used by mangle_conv_op_name_for_type. */
+ <template-param> ::= T </parameter/ number> _ */
static void
-write_template_param (parm)
- tree parm;
+write_template_param (const tree parm)
{
int parm_index;
int parm_level;
@@ -2301,8 +2329,7 @@ write_template_param (parm)
::= <substitution> */
static void
-write_template_template_param (parm)
- tree parm;
+write_template_template_param (const tree parm)
{
tree template = NULL_TREE;
@@ -2330,8 +2357,7 @@ write_template_template_param (parm)
::= S_ */
static void
-write_substitution (seq_id)
- int seq_id;
+write_substitution (const int seq_id)
{
MANGLE_TRACE ("substitution", "");
@@ -2344,7 +2370,7 @@ write_substitution (seq_id)
/* Start mangling ENTITY. */
static inline void
-start_mangling (tree entity)
+start_mangling (const tree entity)
{
G.entity = entity;
G.need_abi_warning = false;
@@ -2357,7 +2383,7 @@ start_mangling (tree entity)
future version of the ABI, issue a warning. */
static inline const char *
-finish_mangling (bool warn)
+finish_mangling (const bool warn)
{
if (warn_abi && warn && G.need_abi_warning)
warning ("the mangled name of `%D' will change in a future "
@@ -2376,7 +2402,7 @@ finish_mangling (bool warn)
/* Initialize data structures for mangling. */
void
-init_mangle ()
+init_mangle (void)
{
gcc_obstack_init (&G.name_obstack);
@@ -2393,8 +2419,7 @@ init_mangle ()
/* Generate the mangled name of DECL. */
static const char *
-mangle_decl_string (decl)
- tree decl;
+mangle_decl_string (const tree decl)
{
const char *result;
@@ -2402,29 +2427,9 @@ mangle_decl_string (decl)
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* ");
- }
-
+ write_mangled_name (decl, true);
+
result = finish_mangling (/*warn=*/true);
if (DEBUG_MANGLE)
fprintf (stderr, "mangle_decl_string = '%s'\n\n", result);
@@ -2434,8 +2439,7 @@ mangle_decl_string (decl)
/* Create an identifier for the external mangled name of DECL. */
void
-mangle_decl (decl)
- tree decl;
+mangle_decl (const tree decl)
{
tree id = get_identifier (mangle_decl_string (decl));
@@ -2445,8 +2449,7 @@ mangle_decl (decl)
/* Generate the mangled representation of TYPE. */
const char *
-mangle_type_string (type)
- tree type;
+mangle_type_string (const tree type)
{
const char *result;
@@ -2461,8 +2464,7 @@ mangle_type_string (type)
/* Create an identifier for the mangled representation of TYPE. */
tree
-mangle_type (type)
- tree type;
+mangle_type (const tree type)
{
return get_identifier (mangle_type_string (type));
}
@@ -2472,9 +2474,7 @@ mangle_type (type)
component. */
static tree
-mangle_special_for_type (type, code)
- tree type;
- const char *code;
+mangle_special_for_type (const tree type, const char *code)
{
const char *result;
@@ -2500,8 +2500,7 @@ mangle_special_for_type (type, code)
structure for TYPE. */
tree
-mangle_typeinfo_for_type (type)
- tree type;
+mangle_typeinfo_for_type (const tree type)
{
return mangle_special_for_type (type, "TI");
}
@@ -2510,8 +2509,7 @@ mangle_typeinfo_for_type (type)
the mangled name of TYPE. */
tree
-mangle_typeinfo_string_for_type (type)
- tree type;
+mangle_typeinfo_string_for_type (const tree type)
{
return mangle_special_for_type (type, "TS");
}
@@ -2519,8 +2517,7 @@ mangle_typeinfo_string_for_type (type)
/* Create an identifier for the mangled name of the vtable for TYPE. */
tree
-mangle_vtbl_for_type (type)
- tree type;
+mangle_vtbl_for_type (const tree type)
{
return mangle_special_for_type (type, "TV");
}
@@ -2528,8 +2525,7 @@ mangle_vtbl_for_type (type)
/* Returns an identifier for the mangled name of the VTT for TYPE. */
tree
-mangle_vtt_for_type (type)
- tree type;
+mangle_vtt_for_type (const tree type)
{
return mangle_special_for_type (type, "TT");
}
@@ -2549,9 +2545,7 @@ mangle_vtt_for_type (type)
<special-name> ::= CT <type> <offset number> _ <base type> */
tree
-mangle_ctor_vtbl_for_type (type, binfo)
- tree type;
- tree binfo;
+mangle_ctor_vtbl_for_type (const tree type, const tree binfo)
{
const char *result;
@@ -2570,45 +2564,74 @@ mangle_ctor_vtbl_for_type (type, binfo)
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.
+/* Mangle a this pointer or result pointer adjustment.
+
+ <call-offset> ::= h <fixed offset number> _
+ ::= v <fixed offset number> _ <virtual offset number> _ */
+
+static void
+mangle_call_offset (const tree fixed_offset, const tree virtual_offset)
+{
+ write_char (virtual_offset ? 'v' : 'h');
+
+ /* For either flavor, write the fixed offset. */
+ write_integer_cst (fixed_offset);
+ write_char ('_');
+
+ /* For a virtual thunk, add the virtual offset. */
+ if (virtual_offset)
+ {
+ write_integer_cst (virtual_offset);
+ write_char ('_');
+ }
+}
- <special-name> ::= Th <offset number> _ <base encoding>
- ::= Tv <offset number> _ <vcall offset number> _
- <base encoding>
+/* Return an identifier for the mangled name of a this-adjusting or
+ covariant thunk to FN_DECL. FIXED_OFFSET is the initial adjustment
+ to this used to find the vptr. If VIRTUAL_OFFSET is non-NULL, this
+ is a virtual thunk, and it is the vtbl offset in
+ bytes. THIS_ADJUSTING is nonzero for a this adjusting thunk and
+ zero for a covariant thunk. Note, that FN_DECL might be a covariant
+ thunk itself. A covariant thunk name always includes the adjustment
+ for the this pointer, even if there is none.
+
+ <special-name> ::= T <call-offset> <base encoding>
+ ::= Tc <this_adjust call-offset> <result_adjust call-offset>
+ <base encoding>
*/
tree
-mangle_thunk (fn_decl, offset, vcall_offset)
- tree fn_decl;
- tree offset;
- tree vcall_offset;
+mangle_thunk (tree fn_decl, const int this_adjusting, tree fixed_offset,
+ tree virtual_offset)
{
const char *result;
start_mangling (fn_decl);
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');
+
+ if (!this_adjusting)
+ {
+ /* Covariant thunk with no this adjustment */
+ write_char ('c');
+ mangle_call_offset (integer_zero_node, NULL_TREE);
+ mangle_call_offset (fixed_offset, virtual_offset);
+ }
+ else if (!DECL_THUNK_P (fn_decl))
+ /* Plain this adjusting thunk. */
+ mangle_call_offset (fixed_offset, virtual_offset);
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 ('_');
+ /* This adjusting thunk to covariant thunk. */
+ write_char ('c');
+ mangle_call_offset (fixed_offset, virtual_offset);
+ fixed_offset = ssize_int (THUNK_FIXED_OFFSET (fn_decl));
+ virtual_offset = THUNK_VIRTUAL_OFFSET (fn_decl);
+ if (virtual_offset)
+ virtual_offset = BINFO_VPTR_FIELD (virtual_offset);
+ mangle_call_offset (fixed_offset, virtual_offset);
+ fn_decl = THUNK_TARGET (fn_decl);
}
/* Scoped name. */
@@ -2621,8 +2644,8 @@ mangle_thunk (fn_decl, offset, vcall_offset)
}
/* This hash table maps TYPEs to the IDENTIFIER for a conversion
- operator to TYPE. The nodes are TREE_LISTs whose TREE_PURPOSE is
- the TYPE and whose TREE_VALUE is the IDENTIFIER. */
+ operator to TYPE. The nodes are IDENTIFIERs whose TREE_TYPE is the
+ TYPE. */
static GTY ((param_is (union tree_node))) htab_t conv_type_names;
@@ -2631,7 +2654,7 @@ static GTY ((param_is (union tree_node))) htab_t conv_type_names;
static hashval_t
hash_type (const void *val)
{
- return htab_hash_pointer (TREE_PURPOSE ((tree) val));
+ return (hashval_t) TYPE_UID (TREE_TYPE ((tree) val));
}
/* Compare VAL1 (a node in the table) with VAL2 (a TYPE). */
@@ -2639,41 +2662,44 @@ hash_type (const void *val)
static int
compare_type (const void *val1, const void *val2)
{
- return TREE_PURPOSE ((tree) val1) == (tree) val2;
+ return TREE_TYPE ((tree) val1) == (tree) val2;
}
/* 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 (const tree type)
{
void **slot;
tree identifier;
- char buffer[64];
-
+
if (conv_type_names == NULL)
conv_type_names = htab_create_ggc (31, &hash_type, &compare_type, NULL);
slot = htab_find_slot_with_hash (conv_type_names, type,
- htab_hash_pointer (type), INSERT);
- if (*slot)
- return TREE_VALUE ((tree) *slot);
-
- /* Create a unique name corresponding to TYPE. */
- sprintf (buffer, "operator %lu",
- (unsigned long) htab_elements (conv_type_names));
- identifier = get_identifier (buffer);
- *slot = build_tree_list (type, identifier);
+ (hashval_t) TYPE_UID (type), INSERT);
+ identifier = (tree)*slot;
+ if (!identifier)
+ {
+ char buffer[64];
+
+ /* Create a unique name corresponding to TYPE. */
+ sprintf (buffer, "operator %lu",
+ (unsigned long) htab_elements (conv_type_names));
+ identifier = get_identifier (buffer);
+ *slot = identifier;
+
+ /* Hang TYPE off the identifier so it can be found easily later
+ when performing conversions. */
+ TREE_TYPE (identifier) = type;
+
+ /* Set bits on the identifier so we know later it's a conversion. */
+ IDENTIFIER_OPNAME_P (identifier) = 1;
+ IDENTIFIER_TYPENAME_P (identifier) = 1;
+ }
- /* 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;
}
@@ -2681,8 +2707,7 @@ mangle_conv_op_name_for_type (const tree type)
variable for indicated VARIABLE. */
tree
-mangle_guard_variable (variable)
- tree variable;
+mangle_guard_variable (const tree variable)
{
start_mangling (variable);
write_string ("_ZGV");
@@ -2700,8 +2725,7 @@ mangle_guard_variable (variable)
as well call them something readable. */
tree
-mangle_ref_init_variable (variable)
- tree variable;
+mangle_ref_init_variable (const tree variable)
{
start_mangling (variable);
write_string ("_ZGR");
@@ -2715,8 +2739,7 @@ mangle_ref_init_variable (variable)
/* How to write the type codes for the integer Java type. */
static void
-write_java_integer_type_codes (type)
- tree type;
+write_java_integer_type_codes (const tree type)
{
if (type == java_int_type_node)
write_char ('i');
diff --git a/contrib/gcc/cp/method.c b/contrib/gcc/cp/method.c
index 1c2d2ea..0f72dc7 100644
--- a/contrib/gcc/cp/method.c
+++ b/contrib/gcc/cp/method.c
@@ -1,23 +1,23 @@
/* Handle the hair of processing (but not expanding) inline functions.
Also manage function and variable name overloading.
- Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -25,6 +25,8 @@ Boston, MA 02111-1307, USA. */
/* Handle method declarations. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "rtl.h"
@@ -32,7 +34,6 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "flags.h"
#include "toplev.h"
-#include "ggc.h"
#include "tm_p.h"
#include "target.h"
@@ -49,22 +50,26 @@ enum mangling_flags
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,
+ mf_use_underscores_around_value = 2
};
typedef enum mangling_flags mangling_flags;
-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 *));
+static tree thunk_adjust (tree, bool, HOST_WIDE_INT, tree);
+static void do_build_assign_ref (tree);
+static void do_build_copy_constructor (tree);
+static tree synthesize_exception_spec (tree, tree (*) (tree, void *), void *);
+static tree locate_dtor (tree, void *);
+static tree locate_ctor (tree, void *);
+static tree locate_copy (tree, void *);
+#ifdef ASM_OUTPUT_DEF
+static tree make_alias_for_thunk (tree);
+#endif
/* Called once to initialize method.c. */
void
-init_method ()
+init_method (void)
{
init_mangle ();
}
@@ -73,8 +78,7 @@ init_method ()
/* Set the mangled name (DECL_ASSEMBLER_NAME) for DECL. */
void
-set_mangled_name_for_decl (decl)
- tree decl;
+set_mangled_name_for_decl (tree decl)
{
if (processing_template_decl)
/* There's no need to mangle the name of a template function. */
@@ -84,248 +88,79 @@ set_mangled_name_for_decl (decl)
}
-/* Given a tree_code CODE, and some arguments (at least one),
- attempt to use an overloaded operator on the arguments.
-
- For unary operators, only the first argument need be checked.
- For binary operators, both arguments may need to be checked.
-
- Member functions can convert class references to class pointers,
- for one-level deep indirection. More than that is not supported.
- Operators [](), ()(), and ->() must be member functions.
-
- We call function call building calls with LOOKUP_COMPLAIN if they
- are our only hope. This is true when we see a vanilla operator
- applied to something of aggregate type. If this fails, we are free
- to return `error_mark_node', because we will have reported the
- error.
-
- Operators NEW and DELETE overload in funny ways: operator new takes
- a single `size' parameter, and operator delete takes a pointer to the
- storage being deleted. When overloading these operators, success is
- assumed. If there is a failure, report an error message and return
- `error_mark_node'. */
-
-/* NOSTRICT */
-tree
-build_opfncall (code, flags, xarg1, xarg2, arg3)
- enum tree_code code;
- int flags;
- tree xarg1, xarg2, arg3;
-{
- return build_new_op (code, flags, xarg1, xarg2, arg3);
-}
-
-/* This function takes an identifier, ID, and attempts to figure out what
- it means. There are a number of possible scenarios, presented in increasing
- order of hair:
-
- 1) not in a class's scope
- 2) in class's scope, member name of the class's method
- 3) in class's scope, but not a member name of the class
- 4) in class's scope, member name of a class's variable
-
- NAME is $1 from the bison rule. It is an IDENTIFIER_NODE.
- VALUE is $$ from the bison rule. It is the value returned by lookup_name ($1)
-
- As a last ditch, try to look up the name as a label and return that
- address.
-
- Values which are declared as being of REFERENCE_TYPE are
- automatically dereferenced here (as a hack to make the
- compiler faster). */
-
-tree
-hack_identifier (value, name)
- tree value, name;
-{
- tree type;
-
- if (value == error_mark_node)
- return error_mark_node;
-
- type = TREE_TYPE (value);
- if (TREE_CODE (value) == FIELD_DECL)
- {
- if (current_class_ptr == NULL_TREE)
- {
- if (current_function_decl
- && DECL_STATIC_FUNCTION_P (current_function_decl))
- 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); } */
- error ("invalid use of member `%D'", value);
-
- return error_mark_node;
- }
- TREE_USED (current_class_ptr) = 1;
- if (processing_template_decl)
- value = build_min_nt (COMPONENT_REF, current_class_ref, name);
- else
- {
- tree access_type = current_class_type;
-
- while (!DERIVED_FROM_P (context_for_name_lookup (value),
- access_type))
- {
- access_type = TYPE_CONTEXT (access_type);
- while (DECL_P (access_type))
- access_type = DECL_CONTEXT (access_type);
- }
-
- enforce_access (access_type, value);
- value
- = build_class_member_access_expr (current_class_ref, value,
- /*access_path=*/NULL_TREE,
- /*preserve_reference=*/false);
- }
- }
- else if ((TREE_CODE (value) == FUNCTION_DECL
- && DECL_FUNCTION_MEMBER_P (value))
- || (TREE_CODE (value) == OVERLOAD
- && DECL_FUNCTION_MEMBER_P (OVL_CURRENT (value))))
- {
- tree decl;
-
- if (TREE_CODE (value) == OVERLOAD)
- value = OVL_CURRENT (value);
-
- decl = maybe_dummy_object (DECL_CONTEXT (value), 0);
- value = finish_class_member_access_expr (decl, name);
- }
- else if (really_overloaded_fn (value))
- ;
- else if (TREE_CODE (value) == OVERLOAD)
- /* not really overloaded function */
- mark_used (OVL_FUNCTION (value));
- else if (TREE_CODE (value) == TREE_LIST)
- {
- /* Ambiguous reference to base members, possibly other cases?. */
- tree t = value;
- while (t && TREE_CODE (t) == TREE_LIST)
- {
- mark_used (TREE_VALUE (t));
- t = TREE_CHAIN (t);
- }
- }
- else if (TREE_CODE (value) == NAMESPACE_DECL)
- {
- error ("use of namespace `%D' as expression", value);
- return error_mark_node;
- }
- else if (DECL_CLASS_TEMPLATE_P (value))
- {
- error ("use of class template `%T' as expression", value);
- return error_mark_node;
- }
- else
- mark_used (value);
-
- if (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == PARM_DECL
- || TREE_CODE (value) == RESULT_DECL)
- {
- tree context = decl_function_context (value);
- if (context != NULL_TREE && context != current_function_decl
- && ! TREE_STATIC (value))
- {
- error ("use of %s from containing function",
- (TREE_CODE (value) == VAR_DECL
- ? "`auto' variable" : "parameter"));
- cp_error_at (" `%#D' declared here", value);
- value = error_mark_node;
- }
- }
-
- if (DECL_P (value) && DECL_NONLOCAL (value))
- {
- if (DECL_CLASS_SCOPE_P (value)
- && DECL_CONTEXT (value) != current_class_type)
- {
- tree path;
- 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 `%D' is ambiguous in multiple inheritance lattice",
- name);
- print_candidates (value);
- return error_mark_node;
- }
-
- if (! processing_template_decl)
- value = convert_from_reference (value);
- return value;
-}
-
-
-/* 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. */
+/* Return a this or result adjusting thunk to FUNCTION. THIS_ADJUSTING
+ indicates whether it is a this or result adjusting thunk.
+ FIXED_OFFSET and VIRTUAL_OFFSET indicate how to do the adjustment
+ (see thunk_adjust). VIRTUAL_OFFSET can be NULL, but FIXED_OFFSET
+ never is. VIRTUAL_OFFSET is the /index/ into the vtable for this
+ adjusting thunks, we scale it to a byte offset. For covariant
+ thunks VIRTUAL_OFFSET is the virtual binfo. You must post process
+ the returned thunk with finish_thunk. */
tree
-make_thunk (function, delta, vcall_index)
- tree function;
- tree delta;
- tree vcall_index;
+make_thunk (tree function, bool this_adjusting,
+ tree fixed_offset, tree virtual_offset)
{
- tree thunk_id;
- tree thunk;
- tree vcall_offset;
HOST_WIDE_INT d;
-
+ tree thunk;
+
my_friendly_assert (TREE_CODE (function) == FUNCTION_DECL, 20021025);
-
- /* Scale the VCALL_INDEX to be in terms of bytes. */
- if (vcall_index)
- vcall_offset
+ /* We can have this thunks to covariant thunks, but not vice versa. */
+ my_friendly_assert (!DECL_THIS_THUNK_P (function), 20021127);
+ my_friendly_assert (!DECL_RESULT_THUNK_P (function) || this_adjusting,
+ 20031123);
+
+ /* Scale the VIRTUAL_OFFSET to be in terms of bytes. */
+ if (this_adjusting && virtual_offset)
+ virtual_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);
-
- /* See if we already have the thunk in question. */
+ virtual_offset,
+ convert (ssizetype,
+ TYPE_SIZE_UNIT (vtable_entry_type)));
+
+ d = tree_low_cst (fixed_offset, 0);
+
+ /* See if we already have the thunk in question. For this_adjusting
+ thunks VIRTUAL_OFFSET will be an INTEGER_CST, for covariant thunks it
+ will be a BINFO. */
for (thunk = DECL_THUNKS (function); thunk; thunk = TREE_CHAIN (thunk))
- if (THUNK_DELTA (thunk) == d
- && ((THUNK_VCALL_OFFSET (thunk) != NULL_TREE)
- == (vcall_offset != NULL_TREE))
- && (THUNK_VCALL_OFFSET (thunk)
- ? tree_int_cst_equal (THUNK_VCALL_OFFSET (thunk),
- vcall_offset)
- : true))
+ if (DECL_THIS_THUNK_P (thunk) == this_adjusting
+ && THUNK_FIXED_OFFSET (thunk) == d
+ && !virtual_offset == !THUNK_VIRTUAL_OFFSET (thunk)
+ && (!virtual_offset
+ || (this_adjusting
+ ? tree_int_cst_equal (THUNK_VIRTUAL_OFFSET (thunk),
+ virtual_offset)
+ : THUNK_VIRTUAL_OFFSET (thunk) == virtual_offset)))
return thunk;
-
+
/* All thunks must be created before FUNCTION is actually emitted;
the ABI requires that all thunks be emitted together with the
function to which they transfer control. */
my_friendly_assert (!TREE_ASM_WRITTEN (function), 20021025);
+ /* Likewise, we can only be adding thunks to a function declared in
+ the class currently being laid out. */
+ my_friendly_assert (TYPE_SIZE (DECL_CONTEXT (function))
+ && TYPE_BEING_DEFINED (DECL_CONTEXT (function)),
+ 20031211);
- thunk_id = mangle_thunk (function, delta, vcall_offset);
- thunk = build_decl (FUNCTION_DECL, thunk_id, TREE_TYPE (function));
+ thunk = build_decl (FUNCTION_DECL, NULL_TREE, TREE_TYPE (function));
DECL_LANG_SPECIFIC (thunk) = DECL_LANG_SPECIFIC (function);
- cxx_dup_lang_specific_decl (function);
- SET_DECL_ASSEMBLER_NAME (thunk, thunk_id);
+ cxx_dup_lang_specific_decl (thunk);
+ DECL_THUNKS (thunk) = NULL_TREE;
+
DECL_CONTEXT (thunk) = DECL_CONTEXT (function);
TREE_READONLY (thunk) = TREE_READONLY (function);
TREE_THIS_VOLATILE (thunk) = TREE_THIS_VOLATILE (function);
TREE_PUBLIC (thunk) = TREE_PUBLIC (function);
if (flag_weak)
comdat_linkage (thunk);
- SET_DECL_THUNK_P (thunk);
- DECL_INITIAL (thunk) = build1 (ADDR_EXPR, vfunc_ptr_type_node, function);
- THUNK_DELTA (thunk) = d;
- THUNK_VCALL_OFFSET (thunk) = vcall_offset;
+ SET_DECL_THUNK_P (thunk, this_adjusting);
+ THUNK_TARGET (thunk) = function;
+ THUNK_FIXED_OFFSET (thunk) = d;
+ THUNK_VIRTUAL_OFFSET (thunk) = virtual_offset;
+ THUNK_ALIAS (thunk) = NULL_TREE;
+
/* The thunk itself is not a constructor or destructor, even if
the thing it is thunking to is. */
DECL_INTERFACE_KNOWN (thunk) = 1;
@@ -346,6 +181,7 @@ make_thunk (function, delta, vcall_index)
DECL_DECLARED_INLINE_P (thunk) = 0;
/* Nor has it been deferred. */
DECL_DEFERRED_FN (thunk) = 0;
+
/* Add it to the list of thunks associated with FUNCTION. */
TREE_CHAIN (thunk) = DECL_THUNKS (function);
DECL_THUNKS (function) = thunk;
@@ -353,24 +189,170 @@ make_thunk (function, delta, vcall_index)
return thunk;
}
-/* Emit the definition of a C++ multiple inheritance vtable thunk. If
- EMIT_P is nonzero, the thunk is emitted immediately. */
+/* Finish THUNK, a thunk decl. */
void
-use_thunk (thunk_fndecl, emit_p)
- tree thunk_fndecl;
- int emit_p;
+finish_thunk (tree thunk)
{
- tree fnaddr;
- tree function;
- tree vcall_offset;
- HOST_WIDE_INT delta, vcall_value;
+ tree function, name;
+ tree fixed_offset = ssize_int (THUNK_FIXED_OFFSET (thunk));
+ tree virtual_offset = THUNK_VIRTUAL_OFFSET (thunk);
+
+ my_friendly_assert (!DECL_NAME (thunk) && DECL_THUNK_P (thunk), 20021127);
+ if (virtual_offset && DECL_RESULT_THUNK_P (thunk))
+ virtual_offset = BINFO_VPTR_FIELD (virtual_offset);
+ function = THUNK_TARGET (thunk);
+ name = mangle_thunk (function, DECL_THIS_THUNK_P (thunk),
+ fixed_offset, virtual_offset);
+
+ /* We can end up with declarations of (logically) different
+ covariant thunks, that do identical adjustments. The two thunks
+ will be adjusting between within different hierarchies, which
+ happen to have the same layout. We must nullify one of them to
+ refer to the other. */
+ if (DECL_RESULT_THUNK_P (thunk))
+ {
+ tree cov_probe;
+
+ for (cov_probe = DECL_THUNKS (function);
+ cov_probe; cov_probe = TREE_CHAIN (cov_probe))
+ if (DECL_NAME (cov_probe) == name)
+ {
+ my_friendly_assert (!DECL_THUNKS (thunk), 20031023);
+ THUNK_ALIAS (thunk) = (THUNK_ALIAS (cov_probe)
+ ? THUNK_ALIAS (cov_probe) : cov_probe);
+ break;
+ }
+ }
+
+ DECL_NAME (thunk) = name;
+ SET_DECL_ASSEMBLER_NAME (thunk, name);
+}
+
+/* Adjust PTR by the constant FIXED_OFFSET, and by the vtable
+ offset indicated by VIRTUAL_OFFSET, if that is
+ non-null. THIS_ADJUSTING is nonzero for a this adjusting thunk and
+ zero for a result adjusting thunk. */
+
+static tree
+thunk_adjust (tree ptr, bool this_adjusting,
+ HOST_WIDE_INT fixed_offset, tree virtual_offset)
+{
+ if (this_adjusting)
+ /* Adjust the pointer by the constant. */
+ ptr = fold (build (PLUS_EXPR, TREE_TYPE (ptr), ptr,
+ ssize_int (fixed_offset)));
+
+ /* If there's a virtual offset, look up that value in the vtable and
+ adjust the pointer again. */
+ if (virtual_offset)
+ {
+ tree vtable;
+
+ ptr = save_expr (ptr);
+ /* The vptr is always at offset zero in the object. */
+ vtable = build1 (NOP_EXPR,
+ build_pointer_type (build_pointer_type
+ (vtable_entry_type)),
+ ptr);
+ /* Form the vtable address. */
+ vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable);
+ /* Find the entry with the vcall offset. */
+ vtable = build (PLUS_EXPR, TREE_TYPE (vtable), vtable, virtual_offset);
+ /* Get the offset itself. */
+ vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable);
+ /* Adjust the `this' pointer. */
+ ptr = fold (build (PLUS_EXPR, TREE_TYPE (ptr), ptr, vtable));
+ }
+
+ if (!this_adjusting)
+ /* Adjust the pointer by the constant. */
+ ptr = fold (build (PLUS_EXPR, TREE_TYPE (ptr), ptr,
+ ssize_int (fixed_offset)));
+
+ return ptr;
+}
+
+/* Garbage collector tables contains thunk_labelno even when places
+ inside ifdef block. */
+static GTY (()) int thunk_labelno;
+#ifdef ASM_OUTPUT_DEF
+
+/* Create a static alias to function. */
+
+static tree
+make_alias_for_thunk (tree function)
+{
+ tree alias;
+ char buf[256];
+
+#if defined (TARGET_IS_PE_COFF)
+ if (DECL_ONE_ONLY (function))
+ return function;
+#endif
+
+ ASM_GENERATE_INTERNAL_LABEL (buf, "LTHUNK", thunk_labelno);
+ thunk_labelno++;
+ alias = build_decl (FUNCTION_DECL, get_identifier (buf),
+ TREE_TYPE (function));
+ DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function);
+ cxx_dup_lang_specific_decl (alias);
+ DECL_CONTEXT (alias) = NULL;
+ TREE_READONLY (alias) = TREE_READONLY (function);
+ TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (function);
+ TREE_PUBLIC (alias) = 0;
+ DECL_INTERFACE_KNOWN (alias) = 1;
+ DECL_NOT_REALLY_EXTERN (alias) = 1;
+ DECL_THIS_STATIC (alias) = 1;
+ DECL_SAVED_FUNCTION_DATA (alias) = NULL;
+ DECL_DESTRUCTOR_P (alias) = 0;
+ DECL_CONSTRUCTOR_P (alias) = 0;
+ DECL_CLONED_FUNCTION (alias) = NULL_TREE;
+ DECL_EXTERNAL (alias) = 0;
+ DECL_ARTIFICIAL (alias) = 1;
+ DECL_NO_STATIC_CHAIN (alias) = 1;
+ DECL_PENDING_INLINE_P (alias) = 0;
+ DECL_INLINE (alias) = 0;
+ DECL_DECLARED_INLINE_P (alias) = 0;
+ DECL_DEFERRED_FN (alias) = 0;
+ DECL_USE_TEMPLATE (alias) = 0;
+ DECL_TEMPLATE_INSTANTIATED (alias) = 0;
+ DECL_TEMPLATE_INFO (alias) = NULL;
+ DECL_INITIAL (alias) = error_mark_node;
+ TREE_ADDRESSABLE (alias) = 1;
+ TREE_USED (alias) = 1;
+ SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias));
+ TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias)) = 1;
+ if (!flag_syntax_only)
+ assemble_alias (alias, DECL_ASSEMBLER_NAME (function));
+ return alias;
+}
+#endif
+
+/* Emit the definition of a C++ multiple inheritance or covariant
+ return vtable thunk. If EMIT_P is nonzero, the thunk is emitted
+ immediately. */
+
+void
+use_thunk (tree thunk_fndecl, bool emit_p)
+{
+ tree function, alias;
+ tree virtual_offset;
+ HOST_WIDE_INT fixed_offset, virtual_value;
+ bool this_adjusting = DECL_THIS_THUNK_P (thunk_fndecl);
+
+ /* We should have called finish_thunk to give it a name. */
+ my_friendly_assert (DECL_NAME (thunk_fndecl), 20021127);
+
+ /* We should never be using an alias, always refer to the
+ aliased thunk. */
+ my_friendly_assert (!THUNK_ALIAS (thunk_fndecl), 20031023);
if (TREE_ASM_WRITTEN (thunk_fndecl))
return;
- fnaddr = DECL_INITIAL (thunk_fndecl);
- if (TREE_CODE (DECL_INITIAL (thunk_fndecl)) != ADDR_EXPR)
+ function = THUNK_TARGET (thunk_fndecl);
+ if (DECL_RESULT (thunk_fndecl))
/* We already turned this thunk into an ordinary function.
There's no need to process this thunk again. */
return;
@@ -380,27 +362,30 @@ use_thunk (thunk_fndecl, emit_p)
/* 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;
- delta = THUNK_DELTA (thunk_fndecl);
- vcall_offset = THUNK_VCALL_OFFSET (thunk_fndecl);
+#ifdef ASM_OUTPUT_DEF
+ alias = make_alias_for_thunk (function);
+#else
+ alias = function;
+#endif
- if (vcall_offset)
- {
- vcall_value = tree_low_cst (vcall_offset, /*pos=*/0);
+ fixed_offset = THUNK_FIXED_OFFSET (thunk_fndecl);
+ virtual_offset = THUNK_VIRTUAL_OFFSET (thunk_fndecl);
- /* It is expected that a value of zero means no vcall. */
- if (!vcall_value)
- abort ();
+ if (virtual_offset)
+ {
+ if (!this_adjusting)
+ virtual_offset = BINFO_VPTR_FIELD (virtual_offset);
+ virtual_value = tree_low_cst (virtual_offset, /*pos=*/0);
+ my_friendly_assert (virtual_value, 20021026);
}
else
- vcall_value = 0;
-
+ virtual_value = 0;
+
/* And, if we need to emit the thunk, it's used. */
mark_used (thunk_fndecl);
/* This thunk is actually defined. */
@@ -408,6 +393,7 @@ use_thunk (thunk_fndecl, emit_p)
/* The linkage of the function may have changed. FIXME in linkage
rewrite. */
TREE_PUBLIC (thunk_fndecl) = TREE_PUBLIC (function);
+ DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function);
if (flag_syntax_only)
{
@@ -417,26 +403,42 @@ use_thunk (thunk_fndecl, emit_p)
push_to_top_level ();
+#if defined (ASM_OUTPUT_DEF) \
+ && !defined (TARGET_IS_PE_COFF)
+ if (targetm.have_named_sections)
+ {
+ resolve_unique_section (function, 0, flag_function_sections);
+
+ if (DECL_SECTION_NAME (function) != NULL && DECL_ONE_ONLY (function))
+ {
+ resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
+
+ /* Output the thunk into the same section as function. */
+ DECL_SECTION_NAME (thunk_fndecl) = DECL_SECTION_NAME (function);
+ }
+ }
+#endif
+
/* 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);
-
- if (targetm.asm_out.can_output_mi_thunk (thunk_fndecl, delta,
- vcall_value, function))
+ BLOCK_VARS (DECL_INITIAL (thunk_fndecl)) = DECL_ARGUMENTS (thunk_fndecl);
+
+ if (this_adjusting
+ && targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset,
+ virtual_value, alias))
{
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);
+ init_function_start (thunk_fndecl);
current_function_is_thunk = 1;
assemble_start_function (thunk_fndecl, fnname);
- targetm.asm_out.output_mi_thunk (asm_out_file, thunk_fndecl, delta,
- vcall_value, function);
+ targetm.asm_out.output_mi_thunk (asm_out_file, thunk_fndecl,
+ fixed_offset, virtual_value, alias);
assemble_end_function (thunk_fndecl, fnname);
current_function_decl = 0;
@@ -448,9 +450,10 @@ use_thunk (thunk_fndecl, emit_p)
}
else
{
- /* If we don't have the necessary code for efficient thunks,
- generate a thunk function that just makes a call to the real
- function. Unfortunately, this doesn't work for varargs. */
+ /* If this is a covariant thunk, or we don't have the necessary
+ code for efficient thunks, generate a thunk function that
+ just makes a call to the real function. Unfortunately, this
+ doesn't work for varargs. */
tree a, t;
@@ -458,13 +461,14 @@ use_thunk (thunk_fndecl, emit_p)
error ("generic thunk code fails for method `%#D' which uses `...'",
function);
- /* Set up clone argument trees for the thunk. */
+ /* Set up cloned argument trees for the thunk. */
t = NULL_TREE;
for (a = DECL_ARGUMENTS (function); a; a = TREE_CHAIN (a))
{
tree x = copy_node (a);
TREE_CHAIN (x) = t;
DECL_CONTEXT (x) = thunk_fndecl;
+ SET_DECL_RTL (x, NULL_RTX);
t = x;
}
a = nreverse (t);
@@ -474,42 +478,26 @@ use_thunk (thunk_fndecl, emit_p)
start_function (NULL_TREE, thunk_fndecl, NULL_TREE, SF_PRE_PARSED);
/* We don't bother with a body block for thunks. */
- /* Adjust the this pointer by the constant. */
- t = ssize_int (delta);
- t = fold (build (PLUS_EXPR, TREE_TYPE (a), a, t));
-
- /* 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))
- {
- 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));
- }
+ /* There's no need to check accessibility inside the thunk body. */
+ push_deferring_access_checks (dk_no_check);
+ t = a;
+ if (this_adjusting)
+ t = thunk_adjust (t, /*this_adjusting=*/1,
+ fixed_offset, virtual_offset);
+
/* 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);
+ t = build_call (alias, t);
+ CALL_FROM_THUNK_P (t) = 1;
+ t = force_target_expr (TREE_TYPE (t), t);
+ if (!this_adjusting)
+ t = thunk_adjust (t, /*this_adjusting=*/0,
+ fixed_offset, virtual_offset);
+
if (VOID_TYPE_P (TREE_TYPE (t)))
finish_expr_stmt (t);
else
@@ -517,11 +505,14 @@ use_thunk (thunk_fndecl, emit_p)
/* Since we want to emit the thunk, we explicitly mark its name as
referenced. */
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (thunk_fndecl)) = 1;
+ mark_referenced (DECL_ASSEMBLER_NAME (thunk_fndecl));
/* But we don't want debugging information about it. */
DECL_IGNORED_P (thunk_fndecl) = 1;
+ /* Re-enable access control. */
+ pop_deferring_access_checks ();
+
expand_body (finish_function (0));
}
@@ -533,8 +524,7 @@ use_thunk (thunk_fndecl, emit_p)
/* Generate code for default X(X&) constructor. */
static void
-do_build_copy_constructor (fndecl)
- tree fndecl;
+do_build_copy_constructor (tree fndecl)
{
tree parm = FUNCTION_FIRST_USER_PARM (fndecl);
tree t;
@@ -637,13 +627,12 @@ do_build_copy_constructor (fndecl)
}
static void
-do_build_assign_ref (fndecl)
- tree fndecl;
+do_build_assign_ref (tree fndecl)
{
tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl));
tree compound_stmt;
- compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
parm = convert_from_reference (parm);
if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)
@@ -736,16 +725,15 @@ do_build_assign_ref (fndecl)
}
}
finish_return_stmt (current_class_ref);
- finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
+ finish_compound_stmt (compound_stmt);
}
void
-synthesize_method (fndecl)
- tree fndecl;
+synthesize_method (tree fndecl)
{
- int nested = (current_function_decl != NULL_TREE);
+ bool nested = (current_function_decl != NULL_TREE);
tree context = decl_function_context (fndecl);
- int need_body = 1;
+ bool need_body = true;
tree stmt;
if (at_eof)
@@ -760,6 +748,10 @@ synthesize_method (fndecl)
return;
}
+ /* We may be in the middle of deferred access check. Disable
+ it now. */
+ push_deferring_access_checks (dk_no_deferred);
+
if (! context)
push_to_top_level ();
else if (nested)
@@ -771,8 +763,7 @@ synthesize_method (fndecl)
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;
+ DECL_SOURCE_LOCATION (fndecl) = input_location;
interface_unknown = 1;
start_function (NULL_TREE, fndecl, NULL_TREE, SF_DEFAULT | SF_PRE_PARSED);
@@ -782,7 +773,7 @@ synthesize_method (fndecl)
if (DECL_OVERLOADED_OPERATOR_P (fndecl) == NOP_EXPR)
{
do_build_assign_ref (fndecl);
- need_body = 0;
+ need_body = false;
}
else if (DECL_CONSTRUCTOR_P (fndecl))
{
@@ -798,18 +789,20 @@ synthesize_method (fndecl)
if (need_body)
{
tree compound_stmt;
- compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
- finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
+ finish_compound_stmt (compound_stmt);
}
finish_function_body (stmt);
- expand_body (finish_function (0));
+ expand_or_defer_fn (finish_function (0));
extract_interface_info ();
if (! context)
pop_from_top_level ();
else if (nested)
pop_function_context_from (context);
+
+ pop_deferring_access_checks ();
}
/* Use EXTRACTOR to locate the relevant function called for each base &
@@ -819,10 +812,8 @@ synthesize_method (fndecl)
variants yet, so we need to look at the main one. */
static tree
-synthesize_exception_spec (type, extractor, client)
- tree type;
- tree (*extractor) (tree, void *);
- void *client;
+synthesize_exception_spec (tree type, tree (*extractor) (tree, void*),
+ void *client)
{
tree raises = empty_except_spec;
tree fields = TYPE_FIELDS (type);
@@ -866,9 +857,7 @@ synthesize_exception_spec (type, extractor, client)
/* Locate the dtor of TYPE. */
static tree
-locate_dtor (type, client)
- tree type;
- void *client ATTRIBUTE_UNUSED;
+locate_dtor (tree type, void *client ATTRIBUTE_UNUSED)
{
tree fns;
@@ -882,9 +871,7 @@ locate_dtor (type, client)
/* Locate the default ctor of TYPE. */
static tree
-locate_ctor (type, client)
- tree type;
- void *client ATTRIBUTE_UNUSED;
+locate_ctor (tree type, void *client ATTRIBUTE_UNUSED)
{
tree fns;
@@ -915,15 +902,13 @@ struct copy_data
and desired qualifiers of the source operand. */
static tree
-locate_copy (type, client_)
- tree type;
- void *client_;
+locate_copy (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;
+ bool excess_p = false;
if (client->name)
{
@@ -947,9 +932,7 @@ locate_copy (type, client_)
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);
+ src_type = non_reference (TREE_VALUE (parms));
if (!same_type_ignoring_top_level_qualifiers_p (src_type, type))
continue;
if (!sufficient_parms_p (TREE_CHAIN (parms)))
@@ -976,17 +959,14 @@ locate_copy (type, client_)
reference argument or a non-const reference. */
tree
-implicitly_declare_fn (kind, type, const_p)
- special_function_kind kind;
- tree type;
- int const_p;
+implicitly_declare_fn (special_function_kind kind, tree type, bool 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));
+ bool retref = false;
+ bool has_parm = false;
+ tree name = constructor_name (type);
switch (kind)
{
@@ -1009,12 +989,12 @@ implicitly_declare_fn (kind, type, const_p)
struct copy_data data;
tree argtype = type;
- has_parm = 1;
+ has_parm = true;
data.name = NULL;
data.quals = 0;
if (kind == sfk_assignment_operator)
{
- retref = 1;
+ retref = true;
declspecs = build_tree_list (NULL_TREE, type);
name = ansi_assopname (NOP_EXPR);
@@ -1066,8 +1046,7 @@ implicitly_declare_fn (kind, type, const_p)
as there are artificial parms in FN. */
tree
-skip_artificial_parms_for (fn, list)
- tree fn, list;
+skip_artificial_parms_for (tree fn, tree list)
{
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
list = TREE_CHAIN (list);
@@ -1080,3 +1059,5 @@ skip_artificial_parms_for (fn, list)
list = TREE_CHAIN (list);
return list;
}
+
+#include "gt-cp-method.h"
diff --git a/contrib/gcc/cp/name-lookup.c b/contrib/gcc/cp/name-lookup.c
new file mode 100644
index 0000000..a4e996f
--- /dev/null
+++ b/contrib/gcc/cp/name-lookup.c
@@ -0,0 +1,4923 @@
+/* Definitions for C++ name lookup routines.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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 GCC; 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 "coretypes.h"
+#include "tm.h"
+#include "flags.h"
+#include "tree.h"
+#include "cp-tree.h"
+#include "name-lookup.h"
+#include "timevar.h"
+#include "toplev.h"
+#include "diagnostic.h"
+
+static cxx_scope *innermost_nonclass_level (void);
+static tree select_decl (cxx_binding *, int);
+static cxx_binding *binding_for_name (cxx_scope *, tree);
+static tree lookup_name_current_level (tree);
+static void push_local_binding (tree, tree, int);
+static tree push_overloaded_decl (tree, int);
+static bool lookup_using_namespace (tree, cxx_binding *, tree,
+ tree, int);
+static bool qualified_lookup_using_namespace (tree, tree, cxx_binding *, int);
+static tree lookup_type_current_level (tree);
+static tree push_using_directive (tree);
+
+
+/* The :: namespace. */
+
+tree global_namespace;
+
+/* The name of the anonymous namespace, throughout this translation
+ unit. */
+GTY(()) tree anonymous_namespace_name;
+
+
+/* Compute the chain index of a binding_entry given the HASH value of its
+ name and the total COUNT of chains. COUNT is assumed to be a power
+ of 2. */
+
+#define ENTRY_INDEX(HASH, COUNT) (((HASH) >> 3) & ((COUNT) - 1))
+
+/* A free list of "binding_entry"s awaiting for re-use. */
+
+static GTY((deletable(""))) binding_entry free_binding_entry = NULL;
+
+/* Create a binding_entry object for (NAME, TYPE). */
+
+static inline binding_entry
+binding_entry_make (tree name, tree type)
+{
+ binding_entry entry;
+
+ if (free_binding_entry)
+ {
+ entry = free_binding_entry;
+ free_binding_entry = entry->chain;
+ }
+ else
+ entry = ggc_alloc (sizeof (struct binding_entry_s));
+
+ entry->name = name;
+ entry->type = type;
+ entry->chain = NULL;
+
+ return entry;
+}
+
+/* Put ENTRY back on the free list. */
+
+static inline void
+binding_entry_free (binding_entry entry)
+{
+ entry->name = NULL;
+ entry->type = NULL;
+ entry->chain = free_binding_entry;
+ free_binding_entry = entry;
+}
+
+/* The datatype used to implement the mapping from names to types at
+ a given scope. */
+struct binding_table_s GTY(())
+{
+ /* Array of chains of "binding_entry"s */
+ binding_entry * GTY((length ("%h.chain_count"))) chain;
+
+ /* The number of chains in this table. This is the length of the
+ the member "chain" considered as an array. */
+ size_t chain_count;
+
+ /* Number of "binding_entry"s in this table. */
+ size_t entry_count;
+};
+
+/* Construct TABLE with an initial CHAIN_COUNT. */
+
+static inline void
+binding_table_construct (binding_table table, size_t chain_count)
+{
+ table->chain_count = chain_count;
+ table->entry_count = 0;
+ table->chain = ggc_alloc_cleared
+ (table->chain_count * sizeof (binding_entry));
+}
+
+/* Make TABLE's entries ready for reuse. */
+
+static void
+binding_table_free (binding_table table)
+{
+ size_t i;
+ size_t count;
+
+ if (table == NULL)
+ return;
+
+ for (i = 0, count = table->chain_count; i < count; ++i)
+ {
+ binding_entry temp = table->chain[i];
+ while (temp != NULL)
+ {
+ binding_entry entry = temp;
+ temp = entry->chain;
+ binding_entry_free (entry);
+ }
+ table->chain[i] = NULL;
+ }
+ table->entry_count = 0;
+}
+
+/* Allocate a table with CHAIN_COUNT, assumed to be a power of two. */
+
+static inline binding_table
+binding_table_new (size_t chain_count)
+{
+ binding_table table = ggc_alloc (sizeof (struct binding_table_s));
+ table->chain = NULL;
+ binding_table_construct (table, chain_count);
+ return table;
+}
+
+/* Expand TABLE to twice its current chain_count. */
+
+static void
+binding_table_expand (binding_table table)
+{
+ const size_t old_chain_count = table->chain_count;
+ const size_t old_entry_count = table->entry_count;
+ const size_t new_chain_count = 2 * old_chain_count;
+ binding_entry *old_chains = table->chain;
+ size_t i;
+
+ binding_table_construct (table, new_chain_count);
+ for (i = 0; i < old_chain_count; ++i)
+ {
+ binding_entry entry = old_chains[i];
+ for (; entry != NULL; entry = old_chains[i])
+ {
+ const unsigned int hash = IDENTIFIER_HASH_VALUE (entry->name);
+ const size_t j = ENTRY_INDEX (hash, new_chain_count);
+
+ old_chains[i] = entry->chain;
+ entry->chain = table->chain[j];
+ table->chain[j] = entry;
+ }
+ }
+ table->entry_count = old_entry_count;
+}
+
+/* Insert a binding for NAME to TYPE into TABLE. */
+
+static void
+binding_table_insert (binding_table table, tree name, tree type)
+{
+ const unsigned int hash = IDENTIFIER_HASH_VALUE (name);
+ const size_t i = ENTRY_INDEX (hash, table->chain_count);
+ binding_entry entry = binding_entry_make (name, type);
+
+ entry->chain = table->chain[i];
+ table->chain[i] = entry;
+ ++table->entry_count;
+
+ if (3 * table->chain_count < 5 * table->entry_count)
+ binding_table_expand (table);
+}
+
+/* Return the binding_entry, if any, that maps NAME. */
+
+binding_entry
+binding_table_find (binding_table table, tree name)
+{
+ const unsigned int hash = IDENTIFIER_HASH_VALUE (name);
+ binding_entry entry = table->chain[ENTRY_INDEX (hash, table->chain_count)];
+
+ while (entry != NULL && entry->name != name)
+ entry = entry->chain;
+
+ return entry;
+}
+
+/* Return the binding_entry, if any, that maps NAME to an anonymous type. */
+
+static tree
+binding_table_find_anon_type (binding_table table, tree name)
+{
+ const unsigned int hash = IDENTIFIER_HASH_VALUE (name);
+ binding_entry entry = table->chain[ENTRY_INDEX (hash, table->chain_count)];
+
+ while (entry != NULL && TYPE_IDENTIFIER (entry->type) != name)
+ entry = entry->chain;
+
+ return entry ? entry->type : NULL;
+}
+
+/* Return the binding_entry, if any, that has TYPE as target. If NAME
+ is non-null, then set the domain and rehash that entry. */
+
+static binding_entry
+binding_table_reverse_maybe_remap (binding_table table, tree type, tree name)
+{
+ const size_t chain_count = table->chain_count;
+ binding_entry entry = NULL;
+ binding_entry *p = NULL;
+ size_t i;
+
+ for (i = 0; i < chain_count && entry == NULL; ++i)
+ {
+ p = &table->chain[i];
+ while (*p != NULL && entry == NULL)
+ if ((*p)->type == type)
+ entry = *p;
+ else
+ p = &(*p)->chain;
+ }
+
+ if (entry != NULL && name != NULL && entry->name != name)
+ {
+ /* Remove the bucket from the previous chain. */
+ *p = (*p)->chain;
+
+ /* Remap the name type to type. */
+ i = ENTRY_INDEX (IDENTIFIER_HASH_VALUE (name), chain_count);
+ entry->chain = table->chain[i];
+ entry->name = name;
+ table->chain[i] = entry;
+ }
+
+ return entry;
+}
+
+/* Remove from TABLE all entries that map to anonymous enums or
+ class-types. */
+
+void
+binding_table_remove_anonymous_types (binding_table table)
+{
+ const size_t chain_count = table->chain_count;
+ size_t i;
+
+ for (i = 0; i < chain_count; ++i)
+ {
+ binding_entry *p = &table->chain[i];
+
+ while (*p != NULL)
+ if (ANON_AGGRNAME_P ((*p)->name))
+ {
+ binding_entry e = *p;
+ *p = (*p)->chain;
+ --table->entry_count;
+ binding_entry_free (e);
+ }
+ else
+ p = &(*p)->chain;
+ }
+}
+
+/* Apply PROC -- with DATA -- to all entries in TABLE. */
+
+void
+binding_table_foreach (binding_table table, bt_foreach_proc proc, void *data)
+{
+ const size_t chain_count = table->chain_count;
+ size_t i;
+
+ for (i = 0; i < chain_count; ++i)
+ {
+ binding_entry entry = table->chain[i];
+ for (; entry != NULL; entry = entry->chain)
+ proc (entry, data);
+ }
+}
+
+#ifndef ENABLE_SCOPE_CHECKING
+# define ENABLE_SCOPE_CHECKING 0
+#else
+# define ENABLE_SCOPE_CHECKING 1
+#endif
+
+/* A free list of "cxx_binding"s, connected by their PREVIOUS. */
+
+static GTY((deletable (""))) cxx_binding *free_bindings;
+
+/* Zero out a cxx_binding pointed to by B. */
+#define cxx_binding_clear(B) memset ((B), 0, sizeof (cxx_binding))
+
+/* (GC)-allocate a binding object with VALUE and TYPE member initialized. */
+
+static cxx_binding *
+cxx_binding_make (tree value, tree type)
+{
+ cxx_binding *binding;
+ if (free_bindings)
+ {
+ binding = free_bindings;
+ free_bindings = binding->previous;
+ }
+ else
+ binding = ggc_alloc (sizeof (cxx_binding));
+
+ binding->value = value;
+ binding->type = type;
+ binding->previous = NULL;
+
+ return binding;
+}
+
+/* Put BINDING back on the free list. */
+
+static inline void
+cxx_binding_free (cxx_binding *binding)
+{
+ binding->scope = NULL;
+ binding->previous = free_bindings;
+ free_bindings = binding;
+}
+
+/* Make DECL the innermost binding for ID. The LEVEL is the binding
+ level at which this declaration is being bound. */
+
+static void
+push_binding (tree id, tree decl, cxx_scope* level)
+{
+ cxx_binding *binding = cxx_binding_make (decl, NULL);
+
+ /* Now, fill in the binding information. */
+ binding->previous = IDENTIFIER_BINDING (id);
+ binding->scope = level;
+ INHERITED_VALUE_BINDING_P (binding) = 0;
+ LOCAL_BINDING_P (binding) = (level != class_binding_level);
+
+ /* And put it on the front of the list of bindings for ID. */
+ IDENTIFIER_BINDING (id) = binding;
+}
+
+/* Remove the binding for DECL which should be the innermost binding
+ for ID. */
+
+void
+pop_binding (tree id, tree decl)
+{
+ cxx_binding *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
+ get here for such an entity. */
+ return;
+
+ /* Get the innermost binding for ID. */
+ binding = IDENTIFIER_BINDING (id);
+
+ /* The name should be bound. */
+ my_friendly_assert (binding != NULL, 0);
+
+ /* The DECL will be either the ordinary binding or the type
+ binding for this identifier. Remove that binding. */
+ if (binding->value == decl)
+ binding->value = NULL_TREE;
+ else if (binding->type == decl)
+ binding->type = NULL_TREE;
+ else
+ abort ();
+
+ if (!binding->value && !binding->type)
+ {
+ /* We're completely done with the innermost binding for this
+ identifier. Unhook it from the list of bindings. */
+ IDENTIFIER_BINDING (id) = binding->previous;
+
+ /* Add it to the free list. */
+ cxx_binding_free (binding);
+ }
+}
+
+/* BINDING records an existing declaration for a namein the current scope.
+ But, DECL is another declaration for that same identifier in the
+ same scope. This is the `struct stat' hack whereby a non-typedef
+ class name or enum-name can be bound at the same level as some other
+ kind of entity.
+ 3.3.7/1
+
+ A class name (9.1) or enumeration name (7.2) can be hidden by the
+ name of an object, function, or enumerator declared in the same scope.
+ If a class or enumeration name and an object, function, or enumerator
+ are declared in the same scope (in any order) with the same name, the
+ class or enumeration name is hidden wherever the object, function, or
+ enumerator name is visible.
+
+ It's the responsibility of the caller to check that
+ inserting this name is valid here. Returns nonzero if the new binding
+ was successful. */
+
+static bool
+supplement_binding (cxx_binding *binding, tree decl)
+{
+ tree bval = binding->value;
+ bool ok = true;
+
+ timevar_push (TV_NAME_LOOKUP);
+ if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl))
+ /* The new name is the type name. */
+ binding->type = decl;
+ else if (/* BVAL is null when push_class_level_binding moves an
+ inherited type-binding out of the way to make room for a
+ new value binding. */
+ !bval
+ /* BVAL is error_mark_node when DECL's name has been used
+ in a non-class scope prior declaration. In that case,
+ we should have already issued a diagnostic; for graceful
+ error recovery purpose, pretend this was the intended
+ declaration for that name. */
+ || bval == error_mark_node
+ /* If BVAL is a built-in that has not yet been declared,
+ pretend it is not there at all. */
+ || (TREE_CODE (bval) == FUNCTION_DECL
+ && DECL_ANTICIPATED (bval)))
+ binding->value = decl;
+ else if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval))
+ {
+ /* The old binding was a type name. It was placed in
+ VALUE field because it was thought, at the point it was
+ declared, to be the only entity with such a name. Move the
+ type name into the type slot; it is now hidden by the new
+ binding. */
+ binding->type = bval;
+ binding->value = decl;
+ binding->value_is_inherited = false;
+ }
+ else if (TREE_CODE (bval) == TYPE_DECL
+ && TREE_CODE (decl) == TYPE_DECL
+ && DECL_NAME (decl) == DECL_NAME (bval)
+ && (same_type_p (TREE_TYPE (decl), TREE_TYPE (bval))
+ /* If either type involves template parameters, we must
+ wait until instantiation. */
+ || uses_template_parms (TREE_TYPE (decl))
+ || uses_template_parms (TREE_TYPE (bval))))
+ /* 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 = false;
+ /* There can be two block-scope declarations of the same variable,
+ so long as they are `extern' declarations. However, there cannot
+ be two declarations of the same static data member:
+
+ [class.mem]
+
+ A member shall not be declared twice in the
+ member-specification. */
+ else if (TREE_CODE (decl) == VAR_DECL && TREE_CODE (bval) == VAR_DECL
+ && DECL_EXTERNAL (decl) && DECL_EXTERNAL (bval)
+ && !DECL_CLASS_SCOPE_P (decl))
+ {
+ duplicate_decls (decl, binding->value);
+ ok = false;
+ }
+ else if (TREE_CODE (decl) == NAMESPACE_DECL
+ && TREE_CODE (bval) == NAMESPACE_DECL
+ && DECL_NAMESPACE_ALIAS (decl)
+ && DECL_NAMESPACE_ALIAS (bval)
+ && ORIGINAL_NAMESPACE (bval) == ORIGINAL_NAMESPACE (decl))
+ /* [namespace.alias]
+
+ In a declarative region, a namespace-alias-definition can be
+ used to redefine a namespace-alias declared in that declarative
+ region to refer only to the namespace to which it already
+ refers. */
+ ok = false;
+ else
+ {
+ error ("declaration of `%#D'", decl);
+ cp_error_at ("conflicts with previous declaration `%#D'", bval);
+ ok = false;
+ }
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ok);
+}
+
+/* Add DECL to the list of things declared in B. */
+
+static void
+add_decl_to_level (tree decl, cxx_scope *b)
+{
+ if (TREE_CODE (decl) == NAMESPACE_DECL
+ && !DECL_NAMESPACE_ALIAS (decl))
+ {
+ TREE_CHAIN (decl) = b->namespaces;
+ b->namespaces = decl;
+ }
+ else if (TREE_CODE (decl) == VAR_DECL && DECL_VIRTUAL_P (decl))
+ {
+ TREE_CHAIN (decl) = b->vtables;
+ b->vtables = decl;
+ }
+ else
+ {
+ /* We build up the list in reverse order, and reverse it later if
+ necessary. */
+ TREE_CHAIN (decl) = b->names;
+ b->names = decl;
+ b->names_size++;
+
+ /* If appropriate, add decl to separate list of statics. We
+ include extern variables because they might turn out to be
+ static later. It's OK for this list to contain a few false
+ positives. */
+ if (b->kind == sk_namespace)
+ if ((TREE_CODE (decl) == VAR_DECL
+ && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
+ || (TREE_CODE (decl) == FUNCTION_DECL
+ && (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
+ VARRAY_PUSH_TREE (b->static_decls, decl);
+ }
+}
+
+/* Record a decl-node X as belonging to the current lexical scope.
+ Check for errors (such as an incompatible declaration for the same
+ name already seen in the same scope).
+
+ Returns either X or an old decl for the same name.
+ If an old decl is returned, it may have been smashed
+ to agree with what X says. */
+
+tree
+pushdecl (tree x)
+{
+ tree t;
+ tree name;
+ int need_new_binding;
+
+ timevar_push (TV_NAME_LOOKUP);
+
+ need_new_binding = 1;
+
+ if (DECL_TEMPLATE_PARM_P (x))
+ /* Template parameters have no context; they are not X::T even
+ when declared within a class or namespace. */
+ ;
+ else
+ {
+ if (current_function_decl && x != current_function_decl
+ /* A local declaration for a function doesn't constitute
+ nesting. */
+ && TREE_CODE (x) != FUNCTION_DECL
+ /* 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 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)
+ {
+ int different_binding_level = 0;
+
+ if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
+ name = TREE_OPERAND (name, 0);
+
+ /* In case this decl was explicitly namespace-qualified, look it
+ up in its namespace context. */
+ if (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 (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)
+ /* This is probably 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))
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+ }
+ 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))
+ pedwarn ("redeclaration of `wchar_t' as `%T'",
+ TREE_TYPE (x));
+
+ /* Throw away the redeclaration. */
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+ }
+ else
+ {
+ tree olddecl = duplicate_decls (x, t);
+
+ /* If the redeclaration failed, we can stop at this
+ point. */
+ if (olddecl == error_mark_node)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+
+ if (olddecl)
+ {
+ if (TREE_CODE (t) == TYPE_DECL)
+ SET_IDENTIFIER_TYPE_VALUE (name, TREE_TYPE (t));
+ else if (TREE_CODE (t) == FUNCTION_DECL)
+ check_default_args (t);
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+ }
+ else if (DECL_MAIN_P (x) && TREE_CODE (t) == FUNCTION_DECL)
+ {
+ /* A redeclaration of main, but not a duplicate of the
+ previous one.
+
+ [basic.start.main]
+
+ This function shall not be overloaded. */
+ cp_error_at ("invalid redeclaration of `%D'", t);
+ error ("as `%D'", x);
+ /* We don't try to push this declaration since that
+ causes a crash. */
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
+ }
+ }
+ }
+
+ check_template_shadow (x);
+
+ /* If this is a function conjured up by the backend, massage it
+ so it looks friendly. */
+ if (DECL_NON_THUNK_FUNCTION_P (x) && ! DECL_LANG_SPECIFIC (x))
+ {
+ retrofit_lang_decl (x);
+ SET_DECL_LANGUAGE (x, lang_c);
+ }
+
+ if (DECL_NON_THUNK_FUNCTION_P (x) && ! DECL_FUNCTION_MEMBER_P (x))
+ {
+ t = push_overloaded_decl (x, PUSH_LOCAL);
+ if (t != x)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+ if (!namespace_bindings_p ())
+ /* We do not need to create a binding for this name;
+ push_overloaded_decl will have already done so if
+ necessary. */
+ need_new_binding = 0;
+ }
+ else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_NAMESPACE_SCOPE_P (x))
+ {
+ t = push_overloaded_decl (x, PUSH_GLOBAL);
+ if (t == x)
+ add_decl_to_level (x, NAMESPACE_LEVEL (CP_DECL_CONTEXT (t)));
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, 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
+ name. See the extensive comment in ../c-decl.c (pushdecl). */
+ if (TREE_CODE (x) == TYPE_DECL)
+ {
+ tree type = TREE_TYPE (x);
+ if (DECL_SOURCE_LINE (x) == 0)
+ {
+ if (TYPE_NAME (type) == 0)
+ TYPE_NAME (type) = x;
+ }
+ else if (type != error_mark_node && TYPE_NAME (type) != 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) != DECL_ABSTRACT_ORIGIN (x)))
+ {
+ 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;
+ }
+
+ if (type != error_mark_node
+ && TYPE_NAME (type)
+ && TYPE_IDENTIFIER (type))
+ set_identifier_type_value (DECL_NAME (x), x);
+ }
+
+ /* Multiple external decls of the same identifier ought to match.
+
+ 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;
+
+ decl = IDENTIFIER_NAMESPACE_VALUE (name);
+ if (decl && TREE_CODE (decl) == OVERLOAD)
+ decl = OVL_FUNCTION (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)))
+ {
+ pedwarn ("type mismatch with previous external decl of `%#D'", x);
+ cp_pedwarn_at ("previous external decl of `%#D'", decl);
+ }
+ }
+
+ /* This name is new in its binding level.
+ Install the new declaration and return it. */
+ if (namespace_bindings_p ())
+ {
+ /* Install a global value. */
+
+ /* If the first global decl has external linkage,
+ warn if we later see static one. */
+ if (IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE && TREE_PUBLIC (x))
+ TREE_PUBLIC (name) = 1;
+
+ /* 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) == ALIAS_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)
+ && TREE_USED (IDENTIFIER_IMPLICIT_DECL (name)))
+ TREE_USED (x) = 1;
+
+ /* Don't forget if its address was taken in that way. */
+ if (IDENTIFIER_IMPLICIT_DECL (name)
+ && TREE_ADDRESSABLE (IDENTIFIER_IMPLICIT_DECL (name)))
+ TREE_ADDRESSABLE (x) = 1;
+
+ /* Warn about mismatches against previous implicit decl. */
+ if (IDENTIFIER_IMPLICIT_DECL (name) != NULL_TREE
+ /* If this real decl matches the implicit, don't complain. */
+ && ! (TREE_CODE (x) == FUNCTION_DECL
+ && TREE_TYPE (TREE_TYPE (x)) == integer_type_node))
+ warning
+ ("`%D' was previously implicitly declared to return `int'", x);
+
+ /* If new decl is `static' and an `extern' was seen previously,
+ warn about it. */
+ if (x != NULL_TREE && t != NULL_TREE && decls_match (x, t))
+ warn_extern_redeclared_static (x, t);
+ }
+ else
+ {
+ /* Here to install a non-global value. */
+ tree oldlocal = IDENTIFIER_VALUE (name);
+ tree oldglobal = IDENTIFIER_NAMESPACE_VALUE (name);
+
+ if (need_new_binding)
+ {
+ push_local_binding (name, x, 0);
+ /* Because push_local_binding will hook X on to the
+ current_binding_level's name list, we don't want to
+ do that again below. */
+ need_new_binding = 0;
+ }
+
+ /* If this is a TYPE_DECL, push it into the type value slot. */
+ if (TREE_CODE (x) == TYPE_DECL)
+ set_identifier_type_value (name, x);
+
+ /* 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 (name, NULL_TREE);
+
+ 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
+ && DECL_EXTERNAL (x)
+ && oldglobal != NULL_TREE
+ && TREE_CODE (x) == FUNCTION_DECL
+ && TREE_CODE (oldglobal) == FUNCTION_DECL)
+ {
+ /* We have one. Their types must agree. */
+ if (decls_match (x, oldglobal))
+ /* OK */;
+ else
+ {
+ warning ("extern declaration of `%#D' doesn't match", x);
+ cp_warning_at ("global declaration `%#D'", oldglobal);
+ }
+ }
+ /* If we have a local external declaration,
+ and no file-scope declaration has yet been seen,
+ then if we later have a file-scope decl it must not be static. */
+ if (oldlocal == NULL_TREE
+ && oldglobal == NULL_TREE
+ && DECL_EXTERNAL (x)
+ && TREE_PUBLIC (x))
+ TREE_PUBLIC (name) = 1;
+
+ /* Warn if shadowing an argument at the top level of the body. */
+ if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x)
+ /* Inline decls shadow nothing. */
+ && !DECL_FROM_INLINE (x)
+ && TREE_CODE (oldlocal) == PARM_DECL
+ /* Don't check the `this' parameter. */
+ && !DECL_ARTIFICIAL (oldlocal))
+ {
+ bool err = false;
+
+ /* 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 cp_binding_level *b = current_binding_level->level_chain;
+
+ /* Skip the ctor/dtor cleanup level. */
+ b = b->level_chain;
+
+ /* ARM $8.3 */
+ if (b->kind == sk_function_parms)
+ {
+ error ("declaration of '%#D' shadows a parameter", x);
+ err = true;
+ }
+ }
+
+ if (warn_shadow && !err)
+ {
+ warning ("declaration of '%#D' shadows a parameter", x);
+ warning ("%Jshadowed declaration is here", 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))
+ {
+ if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE
+ && current_class_ptr
+ && !TREE_STATIC (name))
+ {
+ /* Location of previous decl is not useful in this case. */
+ warning ("declaration of '%D' shadows a member of 'this'",
+ x);
+ }
+ else if (oldlocal != NULL_TREE
+ && TREE_CODE (oldlocal) == VAR_DECL)
+ {
+ warning ("declaration of '%D' shadows a previous local", x);
+ warning ("%Jshadowed declaration is here", oldlocal);
+ }
+ else if (oldglobal != NULL_TREE
+ && TREE_CODE (oldglobal) == VAR_DECL)
+ /* XXX shadow warnings in outer-more namespaces */
+ {
+ warning ("declaration of '%D' shadows a global declaration",
+ x);
+ warning ("%Jshadowed declaration is here", oldglobal);
+ }
+ }
+ }
+
+ if (TREE_CODE (x) == FUNCTION_DECL)
+ check_default_args (x);
+
+ if (TREE_CODE (x) == VAR_DECL)
+ maybe_register_incomplete_var (x);
+ }
+
+ if (need_new_binding)
+ add_decl_to_level (x,
+ DECL_NAMESPACE_SCOPE_P (x)
+ ? NAMESPACE_LEVEL (CP_DECL_CONTEXT (x))
+ : current_binding_level);
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
+}
+
+/* Enter DECL into the symbol table, if that's appropriate. Returns
+ DECL, or a modified version thereof. */
+
+tree
+maybe_push_decl (tree decl)
+{
+ tree type = TREE_TYPE (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 (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);
+}
+
+/* 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. */
+
+static void
+push_local_binding (tree id, tree decl, int flags)
+{
+ struct cp_binding_level *b;
+
+ /* Skip over any local classes. This makes sense if we call
+ push_local_binding with a friend decl of a local class. */
+ b = innermost_nonclass_level ();
+
+ if (lookup_name_current_level (id))
+ {
+ /* Supplement the existing binding. */
+ if (!supplement_binding (IDENTIFIER_BINDING (id), decl))
+ /* It didn't work. Something else must be bound at this
+ level. Do not add DECL to the list of things to pop
+ later. */
+ return;
+ }
+ else
+ /* Create a new binding. */
+ push_binding (id, decl, b);
+
+ if (TREE_CODE (decl) == OVERLOAD || (flags & PUSH_USING))
+ /* We must put the OVERLOAD into a TREE_LIST since the
+ TREE_CHAIN of an OVERLOAD is already used. Similarly for
+ decls that got here through a using-declaration. */
+ decl = build_tree_list (NULL_TREE, decl);
+
+ /* And put DECL on the list of things declared by the current
+ binding level. */
+ add_decl_to_level (decl, b);
+}
+
+/* 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 (tree decl)
+{
+ timevar_push (TV_NAME_LOOKUP);
+ if (!DECL_NAME (decl))
+ {
+ timevar_pop (TV_NAME_LOOKUP);
+ return;
+ }
+
+ /* Declarations of __FUNCTION__ and its ilk appear magically when
+ the variable is first used. If that happens to be inside a
+ for-loop, we don't want to do anything special. */
+ if (DECL_PRETTY_FUNCTION_P (decl))
+ {
+ timevar_pop (TV_NAME_LOOKUP);
+ return;
+ }
+
+ if (current_binding_level->kind == sk_for)
+ {
+ struct cp_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. */
+
+ cxx_binding *outer_binding
+ = IDENTIFIER_BINDING (DECL_NAME (decl))->previous;
+
+ if (outer_binding && outer_binding->scope == outer
+ && (TREE_CODE (outer_binding->value) == VAR_DECL)
+ && DECL_DEAD_FOR_LOCAL (outer_binding->value))
+ {
+ outer_binding->value = DECL_SHADOWED_FOR_VAR (outer_binding->value);
+ current_binding_level->kind = sk_block;
+ }
+ }
+ timevar_pop (TV_NAME_LOOKUP);
+}
+
+/* Check to see whether or not DECL is a variable that would have been
+ in scope under the ARM, but is not in scope under the ANSI/ISO
+ standard. If so, issue an error message. If name lookup would
+ work in both cases, but return a different result, this function
+ returns the result of ANSI/ISO lookup. Otherwise, it returns
+ DECL. */
+
+tree
+check_for_out_of_scope_variable (tree decl)
+{
+ tree shadowed;
+
+ /* We only care about out of scope variables. */
+ if (!(TREE_CODE (decl) == VAR_DECL && DECL_DEAD_FOR_LOCAL (decl)))
+ return decl;
+
+ shadowed = DECL_SHADOWED_FOR_VAR (decl);
+ while (shadowed != NULL_TREE && TREE_CODE (shadowed) == VAR_DECL
+ && DECL_DEAD_FOR_LOCAL (shadowed))
+ shadowed = DECL_SHADOWED_FOR_VAR (shadowed);
+ if (!shadowed)
+ shadowed = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (decl));
+ if (shadowed)
+ {
+ if (!DECL_ERROR_REPORTED (decl))
+ {
+ warning ("name lookup of `%D' changed",
+ DECL_NAME (decl));
+ cp_warning_at (" matches this `%D' under ISO standard rules",
+ shadowed);
+ cp_warning_at (" matches this `%D' under old rules", decl);
+ DECL_ERROR_REPORTED (decl) = 1;
+ }
+ return shadowed;
+ }
+
+ /* If we have already complained about this declaration, there's no
+ need to do it again. */
+ if (DECL_ERROR_REPORTED (decl))
+ return decl;
+
+ DECL_ERROR_REPORTED (decl) = 1;
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
+ {
+ error ("name lookup of `%D' changed for new ISO `for' scoping",
+ DECL_NAME (decl));
+ cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", decl);
+ return error_mark_node;
+ }
+ else
+ {
+ pedwarn ("name lookup of `%D' changed for new ISO `for' scoping",
+ DECL_NAME (decl));
+ cp_pedwarn_at (" using obsolete binding at `%D'", decl);
+ }
+
+ return decl;
+}
+
+/* true means unconditionally make a BLOCK for the next level pushed. */
+
+static bool keep_next_level_flag;
+
+static int binding_depth = 0;
+static int is_class_level = 0;
+
+static void
+indent (int depth)
+{
+ int i;
+
+ for (i = 0; i < depth * 2; i++)
+ putc (' ', stderr);
+}
+
+/* Return a string describing the kind of SCOPE we have. */
+static const char *
+cxx_scope_descriptor (cxx_scope *scope)
+{
+ /* The order of this table must match the "scope_kind"
+ enumerators. */
+ static const char* scope_kind_names[] = {
+ "block-scope",
+ "cleanup-scope",
+ "try-scope",
+ "catch-scope",
+ "for-scope",
+ "function-parameter-scope",
+ "class-scope",
+ "namespace-scope",
+ "template-parameter-scope",
+ "template-explicit-spec-scope"
+ };
+ const scope_kind kind = scope->explicit_spec_p
+ ? sk_template_spec : scope->kind;
+
+ return scope_kind_names[kind];
+}
+
+/* Output a debugging information about SCOPE when performing
+ ACTION at LINE. */
+static void
+cxx_scope_debug (cxx_scope *scope, int line, const char *action)
+{
+ const char *desc = cxx_scope_descriptor (scope);
+ if (scope->this_entity)
+ verbatim ("%s %s(%E) %p %d\n", action, desc,
+ scope->this_entity, (void *) scope, line);
+ else
+ verbatim ("%s %s %p %d\n", action, desc, (void *) scope, line);
+}
+
+/* Return the estimated initial size of the hashtable of a NAMESPACE
+ scope. */
+
+static inline size_t
+namespace_scope_ht_size (tree ns)
+{
+ tree name = DECL_NAME (ns);
+
+ return name == std_identifier
+ ? NAMESPACE_STD_HT_SIZE
+ : (name == global_scope_name
+ ? GLOBAL_SCOPE_HT_SIZE
+ : NAMESPACE_ORDINARY_HT_SIZE);
+}
+
+/* A chain of binding_level structures awaiting reuse. */
+
+static GTY((deletable (""))) struct cp_binding_level *free_binding_level;
+
+/* Create a new KIND scope and make it the top of the active scopes stack.
+ ENTITY is the scope of the associated C++ entity (namespace, class,
+ function); it is NULL otherwise. */
+
+cxx_scope *
+begin_scope (scope_kind kind, tree entity)
+{
+ cxx_scope *scope;
+
+ /* Reuse or create a struct for this binding level. */
+ if (!ENABLE_SCOPE_CHECKING && free_binding_level)
+ {
+ scope = free_binding_level;
+ free_binding_level = scope->level_chain;
+ }
+ else
+ scope = ggc_alloc (sizeof (cxx_scope));
+ memset (scope, 0, sizeof (cxx_scope));
+
+ scope->this_entity = entity;
+ scope->more_cleanups_ok = true;
+ switch (kind)
+ {
+ case sk_cleanup:
+ scope->keep = true;
+ break;
+
+ case sk_template_spec:
+ scope->explicit_spec_p = true;
+ kind = sk_template_parms;
+ /* Fall through. */
+ case sk_template_parms:
+ case sk_block:
+ case sk_try:
+ case sk_catch:
+ case sk_for:
+ case sk_class:
+ case sk_function_parms:
+ scope->keep = keep_next_level_flag;
+ break;
+
+ case sk_namespace:
+ scope->type_decls = binding_table_new (namespace_scope_ht_size (entity));
+ NAMESPACE_LEVEL (entity) = scope;
+ VARRAY_TREE_INIT (scope->static_decls,
+ DECL_NAME (entity) == std_identifier
+ || DECL_NAME (entity) == global_scope_name
+ ? 200 : 10,
+ "Static declarations");
+ break;
+
+ default:
+ /* Should not happen. */
+ my_friendly_assert (false, 20030922);
+ break;
+ }
+ scope->kind = kind;
+
+ /* Add it to the front of currently active scopes stack. */
+ scope->level_chain = current_binding_level;
+ current_binding_level = scope;
+ keep_next_level_flag = false;
+
+ if (ENABLE_SCOPE_CHECKING)
+ {
+ scope->binding_depth = binding_depth;
+ indent (binding_depth);
+ cxx_scope_debug (scope, input_location.line, "push");
+ is_class_level = 0;
+ binding_depth++;
+ }
+
+ return scope;
+}
+
+/* We're about to leave current scope. Pop the top of the stack of
+ currently active scopes. Return the enclosing scope, now active. */
+
+cxx_scope *
+leave_scope (void)
+{
+ cxx_scope *scope = current_binding_level;
+
+ if (scope->kind == sk_namespace && class_binding_level)
+ current_binding_level = class_binding_level;
+
+ /* We cannot leave a scope, if there are none left. */
+ if (NAMESPACE_LEVEL (global_namespace))
+ my_friendly_assert (!global_scope_p (scope), 20030527);
+
+ if (ENABLE_SCOPE_CHECKING)
+ {
+ indent (--binding_depth);
+ cxx_scope_debug (scope, input_location.line, "leave");
+ if (is_class_level != (scope == class_binding_level))
+ {
+ indent (binding_depth);
+ verbatim ("XXX is_class_level != (current_scope == class_scope)\n");
+ }
+ is_class_level = 0;
+ }
+
+ /* Move one nesting level up. */
+ current_binding_level = scope->level_chain;
+
+ /* Namespace-scopes are left most probably temporarily, not completely;
+ they can be reopen later, e.g. in namespace-extension or any name
+ binding activity that requires us to resume a namespace. For other
+ scopes, we just make the structure available for reuse. */
+ if (scope->kind != sk_namespace)
+ {
+ scope->level_chain = free_binding_level;
+ if (scope->kind == sk_class)
+ scope->type_decls = NULL;
+ else
+ binding_table_free (scope->type_decls);
+ my_friendly_assert (!ENABLE_SCOPE_CHECKING
+ || scope->binding_depth == binding_depth,
+ 20030529);
+ free_binding_level = scope;
+ }
+
+ /* Find the innermost enclosing class scope, and reset
+ CLASS_BINDING_LEVEL appropriately. */
+ for (scope = current_binding_level;
+ scope && scope->kind != sk_class;
+ scope = scope->level_chain)
+ ;
+ class_binding_level = scope && scope->kind == sk_class ? scope : NULL;
+
+ return current_binding_level;
+}
+
+static void
+resume_scope (struct cp_binding_level* b)
+{
+ /* Resuming binding levels is meant only for namespaces,
+ and those cannot nest into classes. */
+ my_friendly_assert(!class_binding_level, 386);
+ /* Also, resuming a non-directly nested namespace is a no-no. */
+ my_friendly_assert(b->level_chain == current_binding_level, 386);
+ current_binding_level = b;
+ if (ENABLE_SCOPE_CHECKING)
+ {
+ b->binding_depth = binding_depth;
+ indent (binding_depth);
+ cxx_scope_debug (b, input_location.line, "resume");
+ is_class_level = 0;
+ binding_depth++;
+ }
+}
+
+/* Return the innermost binding level that is not for a class scope. */
+
+static cxx_scope *
+innermost_nonclass_level (void)
+{
+ cxx_scope *b;
+
+ b = current_binding_level;
+ while (b->kind == sk_class)
+ b = b->level_chain;
+
+ return b;
+}
+
+/* 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 (tree type)
+{
+ if (type != error_mark_node
+ && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
+ && current_binding_level->more_cleanups_ok == 0)
+ {
+ begin_scope (sk_cleanup, NULL);
+ clear_last_expr ();
+ add_scope_stmt (/*begin_p=*/1, /*partial_p=*/1);
+ }
+}
+
+/* Nonzero if we are currently in the global binding level. */
+
+int
+global_bindings_p (void)
+{
+ return global_scope_p (current_binding_level);
+}
+
+/* True 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 template parameter level. We
+ also include a class whose context is toplevel. */
+
+bool
+toplevel_bindings_p (void)
+{
+ struct cp_binding_level *b = innermost_nonclass_level ();
+
+ return b->kind == sk_namespace || b->kind == sk_template_parms;
+}
+
+/* True if this is a namespace scope, or if we are defining a class
+ which is itself at namespace scope, or whose enclosing class is
+ such a class, etc. */
+
+bool
+namespace_bindings_p (void)
+{
+ struct cp_binding_level *b = innermost_nonclass_level ();
+
+ return b->kind == sk_namespace;
+}
+
+/* True if the current level needs to have a BLOCK made. */
+
+bool
+kept_level_p (void)
+{
+ return (current_binding_level->blocks != NULL_TREE
+ || current_binding_level->keep
+ || current_binding_level->kind == sk_cleanup
+ || current_binding_level->names != NULL_TREE
+ || current_binding_level->type_decls != NULL);
+}
+
+/* Returns the kind of the innermost scope. */
+
+scope_kind
+innermost_scope_kind (void)
+{
+ return current_binding_level->kind;
+}
+
+/* Returns true if this scope was created to store template parameters. */
+
+bool
+template_parm_scope_p (void)
+{
+ return innermost_scope_kind () == sk_template_parms;
+}
+
+/* If KEEP is true, 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 (bool keep)
+{
+ keep_next_level_flag = keep;
+}
+
+/* Return the list of declarations of the current level.
+ Note that this list is in reverse order unless/until
+ you nreverse it; and when you do nreverse it, you must
+ store the result back using `storedecls' or you will lose. */
+
+tree
+getdecls (void)
+{
+ return current_binding_level->names;
+}
+
+/* Set the current binding TABLE for type declarations.. This is a
+ temporary workaround of the fact that the data structure classtypes
+ does not currently carry its allocated cxx_scope structure. */
+void
+cxx_remember_type_decls (binding_table table)
+{
+ current_binding_level->type_decls = table;
+}
+
+/* For debugging. */
+static int no_print_functions = 0;
+static int no_print_builtins = 0;
+
+/* Called from print_binding_level through binding_table_foreach to
+ print the content of binding ENTRY. DATA is a pointer to line offset
+ marker. */
+static void
+bt_print_entry (binding_entry entry, void *data)
+{
+ int *p = (int *) data;
+ int len;
+
+ if (entry->name == NULL)
+ len = 3;
+ else if (entry->name == TYPE_IDENTIFIER (entry->type))
+ len = 2;
+ else
+ len = 4;
+ len = 4;
+
+ *p += len;
+
+ if (*p > 5)
+ {
+ fprintf (stderr, "\n\t");
+ *p = len;
+ }
+ if (entry->name == NULL)
+ {
+ print_node_brief (stderr, "<unnamed-typedef", entry->type, 0);
+ fprintf (stderr, ">");
+ }
+ else if (entry->name == TYPE_IDENTIFIER (entry->type))
+ print_node_brief (stderr, "", entry->type, 0);
+ else
+ {
+ print_node_brief (stderr, "<typedef", entry->name, 0);
+ print_node_brief (stderr, "", entry->type, 0);
+ fprintf (stderr, ">");
+ }
+}
+
+void
+print_binding_level (struct cp_binding_level* lvl)
+{
+ tree t;
+ int i = 0, len;
+ fprintf (stderr, " blocks=" HOST_PTR_PRINTF, (void *) lvl->blocks);
+ if (lvl->more_cleanups_ok)
+ fprintf (stderr, " more-cleanups-ok");
+ if (lvl->have_cleanups)
+ fprintf (stderr, " have-cleanups");
+ fprintf (stderr, "\n");
+ if (lvl->names)
+ {
+ fprintf (stderr, " names:\t");
+ /* 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))
+ continue;
+ if (no_print_builtins
+ && (TREE_CODE (t) == TYPE_DECL)
+ && (!strcmp (DECL_SOURCE_FILE (t),"<built-in>")))
+ continue;
+
+ /* Function decls tend to have longer names. */
+ if (TREE_CODE (t) == FUNCTION_DECL)
+ len = 3;
+ else
+ len = 2;
+ i += len;
+ if (i > 6)
+ {
+ fprintf (stderr, "\n\t");
+ i = len;
+ }
+ print_node_brief (stderr, "", t, 0);
+ if (t == error_mark_node)
+ break;
+ }
+ if (i)
+ fprintf (stderr, "\n");
+ }
+ if (lvl->type_decls)
+ {
+ fprintf (stderr, " tags:\t");
+ i = 0;
+ binding_table_foreach (lvl->type_decls, bt_print_entry, &i);
+ if (i)
+ fprintf (stderr, "\n");
+ }
+ if (lvl->class_shadowed)
+ {
+ fprintf (stderr, " class-shadowed:");
+ for (t = lvl->class_shadowed; t; t = TREE_CHAIN (t))
+ {
+ fprintf (stderr, " %s ", IDENTIFIER_POINTER (TREE_PURPOSE (t)));
+ }
+ fprintf (stderr, "\n");
+ }
+ if (lvl->type_shadowed)
+ {
+ fprintf (stderr, " type-shadowed:");
+ for (t = lvl->type_shadowed; t; t = TREE_CHAIN (t))
+ {
+ fprintf (stderr, " %s ", IDENTIFIER_POINTER (TREE_PURPOSE (t)));
+ }
+ fprintf (stderr, "\n");
+ }
+}
+
+void
+print_other_binding_stack (struct cp_binding_level *stack)
+{
+ struct cp_binding_level *level;
+ for (level = stack; !global_scope_p (level); level = level->level_chain)
+ {
+ fprintf (stderr, "binding level " HOST_PTR_PRINTF "\n", (void *) level);
+ print_binding_level (level);
+ }
+}
+
+void
+print_binding_stack (void)
+{
+ struct cp_binding_level *b;
+ fprintf (stderr, "current_binding_level=" HOST_PTR_PRINTF
+ "\nclass_binding_level=" HOST_PTR_PRINTF
+ "\nNAMESPACE_LEVEL (global_namespace)=" HOST_PTR_PRINTF "\n",
+ (void *) current_binding_level, (void *) class_binding_level,
+ (void *) NAMESPACE_LEVEL (global_namespace));
+ if (class_binding_level)
+ {
+ for (b = class_binding_level; b; b = b->level_chain)
+ if (b == current_binding_level)
+ break;
+ if (b)
+ b = class_binding_level;
+ else
+ b = current_binding_level;
+ }
+ else
+ b = current_binding_level;
+ print_other_binding_stack (b);
+ fprintf (stderr, "global:\n");
+ print_binding_level (NAMESPACE_LEVEL (global_namespace));
+}
+
+/* Return the type associated with id. */
+
+tree
+identifier_type_value (tree id)
+{
+ timevar_push (TV_NAME_LOOKUP);
+ /* There is no type with that name, anywhere. */
+ if (REAL_IDENTIFIER_TYPE_VALUE (id) == NULL_TREE)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+ /* This is not the type marker, but the real thing. */
+ if (REAL_IDENTIFIER_TYPE_VALUE (id) != global_type_node)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, REAL_IDENTIFIER_TYPE_VALUE (id));
+ /* Have to search for it. It must be on the global level, now.
+ Ask lookup_name not to return non-types. */
+ id = lookup_name_real (id, 2, 1, 0, LOOKUP_COMPLAIN);
+ if (id)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_TYPE (id));
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+}
+
+/* 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++. */
+
+tree
+identifier_global_value (tree t)
+{
+ return IDENTIFIER_GLOBAL_VALUE (t);
+}
+
+/* Push a definition of struct, union or enum tag named ID. into
+ binding_level B. DECL is a TYPE_DECL for the type. We assume that
+ the tag ID is not already defined. */
+
+static void
+set_identifier_type_value_with_scope (tree id, tree decl, cxx_scope *b)
+{
+ tree type;
+
+ if (b->kind != sk_namespace)
+ {
+ /* Shadow the marker, not the real thing, so that the marker
+ gets restored later. */
+ tree old_type_value = REAL_IDENTIFIER_TYPE_VALUE (id);
+ b->type_shadowed
+ = tree_cons (id, old_type_value, b->type_shadowed);
+ type = decl ? TREE_TYPE (decl) : NULL_TREE;
+ }
+ else
+ {
+ cxx_binding *binding =
+ binding_for_name (NAMESPACE_LEVEL (current_namespace), id);
+ if (decl)
+ {
+ if (binding->value)
+ supplement_binding (binding, decl);
+ else
+ binding->value = decl;
+ }
+ else
+ abort ();
+ /* Store marker instead of real type. */
+ type = global_type_node;
+ }
+ SET_IDENTIFIER_TYPE_VALUE (id, type);
+}
+
+/* As set_identifier_type_value_with_scope, but using
+ current_binding_level. */
+
+void
+set_identifier_type_value (tree id, tree decl)
+{
+ set_identifier_type_value_with_scope (id, decl, current_binding_level);
+}
+
+/* Return the name for the constructor (or destructor) for the
+ specified class TYPE. When given a template, this routine doesn't
+ lose the specialization. */
+
+tree
+constructor_name_full (tree type)
+{
+ type = TYPE_MAIN_VARIANT (type);
+ if (CLASS_TYPE_P (type) && TYPE_WAS_ANONYMOUS (type)
+ && TYPE_HAS_CONSTRUCTOR (type))
+ return DECL_NAME (OVL_CURRENT (CLASSTYPE_CONSTRUCTORS (type)));
+ else
+ return TYPE_IDENTIFIER (type);
+}
+
+/* Return the name for the constructor (or destructor) for the
+ specified class. When given a template, return the plain
+ unspecialized name. */
+
+tree
+constructor_name (tree type)
+{
+ tree name;
+ name = constructor_name_full (type);
+ if (IDENTIFIER_TEMPLATE (name))
+ name = IDENTIFIER_TEMPLATE (name);
+ return name;
+}
+
+/* Returns TRUE if NAME is the name for the constructor for TYPE. */
+
+bool
+constructor_name_p (tree name, tree type)
+{
+ tree ctor_name;
+
+ if (!name)
+ return false;
+
+ if (TREE_CODE (name) != IDENTIFIER_NODE)
+ return false;
+
+ ctor_name = constructor_name_full (type);
+ if (name == ctor_name)
+ return true;
+ if (IDENTIFIER_TEMPLATE (ctor_name)
+ && name == IDENTIFIER_TEMPLATE (ctor_name))
+ return true;
+ return false;
+}
+
+/* Counter used to create anonymous type names. */
+
+static GTY(()) int anon_cnt;
+
+/* Return an IDENTIFIER which can be used as a name for
+ anonymous structs and unions. */
+
+tree
+make_anon_name (void)
+{
+ char buf[32];
+
+ sprintf (buf, ANON_AGGRNAME_FORMAT, anon_cnt++);
+ return get_identifier (buf);
+}
+
+/* Clear the TREE_PURPOSE slot of UTDs which have anonymous typenames.
+ This keeps dbxout from getting confused. */
+
+void
+clear_anon_tags (void)
+{
+ struct cp_binding_level *b;
+ static int last_cnt = 0;
+
+ /* Fast out if no new anon names were declared. */
+ if (last_cnt == anon_cnt)
+ return;
+
+ b = current_binding_level;
+ while (b->kind == sk_cleanup)
+ b = b->level_chain;
+ if (b->type_decls != NULL)
+ binding_table_remove_anonymous_types (b->type_decls);
+ last_cnt = anon_cnt;
+}
+
+/* Return (from the stack of) the BINDING, if any, established at SCOPE. */
+
+static inline cxx_binding *
+find_binding (cxx_scope *scope, cxx_binding *binding)
+{
+ timevar_push (TV_NAME_LOOKUP);
+
+ for (; binding != NULL; binding = binding->previous)
+ if (binding->scope == scope)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, binding);
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (cxx_binding *)0);
+}
+
+/* Return the binding for NAME in SCOPE, if any. Otherwise, return NULL. */
+
+static inline cxx_binding *
+cxx_scope_find_binding_for_name (cxx_scope *scope, tree name)
+{
+ cxx_binding *b = IDENTIFIER_NAMESPACE_BINDINGS (name);
+ if (b)
+ {
+ /* Fold-in case where NAME is used only once. */
+ if (scope == b->scope && b->previous == NULL)
+ return b;
+ return find_binding (scope, b);
+ }
+ return NULL;
+}
+
+/* Always returns a binding for name in scope. If no binding is
+ found, make a new one. */
+
+static cxx_binding *
+binding_for_name (cxx_scope *scope, tree name)
+{
+ cxx_binding *result;
+
+ result = cxx_scope_find_binding_for_name (scope, name);
+ if (result)
+ return result;
+ /* Not found, make a new one. */
+ result = cxx_binding_make (NULL, NULL);
+ result->previous = IDENTIFIER_NAMESPACE_BINDINGS (name);
+ result->scope = scope;
+ result->is_local = false;
+ result->value_is_inherited = false;
+ IDENTIFIER_NAMESPACE_BINDINGS (name) = result;
+ return result;
+}
+
+/* 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 (tree scope, tree name)
+{
+ tree decl;
+
+ timevar_push (TV_NAME_LOOKUP);
+ 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)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
+ 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;
+ current_binding_level->usings = decl;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
+}
+
+/* Same as pushdecl, but define X in binding-level LEVEL. We rely on the
+ caller to set DECL_CONTEXT properly. */
+
+tree
+pushdecl_with_scope (tree x, cxx_scope *level)
+{
+ struct cp_binding_level *b;
+ tree function_decl = current_function_decl;
+
+ timevar_push (TV_NAME_LOOKUP);
+ current_function_decl = NULL_TREE;
+ if (level->kind == sk_class)
+ {
+ b = class_binding_level;
+ class_binding_level = level;
+ pushdecl_class_level (x);
+ class_binding_level = b;
+ }
+ else
+ {
+ b = current_binding_level;
+ current_binding_level = level;
+ x = pushdecl (x);
+ current_binding_level = b;
+ }
+ current_function_decl = function_decl;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
+}
+
+/* DECL is a FUNCTION_DECL for a non-member function, which may have
+ other definitions already in place. We get around this by making
+ the value of the identifier point to a list of all the things that
+ 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_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.
+
+ The value returned may be a previous declaration if we guessed wrong
+ about what language DECL should belong to (C or C++). Otherwise,
+ it's always DECL (and never something that's not a _DECL). */
+
+static tree
+push_overloaded_decl (tree decl, int flags)
+{
+ tree name = DECL_NAME (decl);
+ tree old;
+ tree new_binding;
+ int doing_global = (namespace_bindings_p () || !(flags & PUSH_LOCAL));
+
+ timevar_push (TV_NAME_LOOKUP);
+ if (doing_global)
+ old = namespace_binding (name, DECL_CONTEXT (decl));
+ else
+ old = lookup_name_current_level (name);
+
+ if (old)
+ {
+ if (TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old))
+ {
+ tree t = TREE_TYPE (old);
+ if (IS_AGGR_TYPE (t) && warn_shadow
+ && (! DECL_IN_SYSTEM_HEADER (decl)
+ || ! DECL_IN_SYSTEM_HEADER (old)))
+ 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);
+
+ if (TREE_CODE (tmp) == OVERLOAD && OVL_USED (tmp)
+ && !(flags & PUSH_USING)
+ && compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
+ TYPE_ARG_TYPES (TREE_TYPE (decl))))
+ error ("`%#D' conflicts with previous using declaration `%#D'",
+ decl, fn);
+
+ if (duplicate_decls (decl, fn) == fn)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, 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);
+ error ("conflicts with function declaration `%#D'", decl);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
+ }
+ }
+
+ if (old || TREE_CODE (decl) == TEMPLATE_DECL
+ /* If it's a using declaration, we always need to build an OVERLOAD,
+ because it's the only way to remember that the declaration comes
+ from 'using', and have the lookup behave correctly. */
+ || (flags & PUSH_USING))
+ {
+ if (old && TREE_CODE (old) != OVERLOAD)
+ new_binding = ovl_cons (decl, ovl_cons (old, NULL_TREE));
+ else
+ new_binding = ovl_cons (decl, old);
+ if (flags & PUSH_USING)
+ OVL_USED (new_binding) = 1;
+ }
+ else
+ /* NAME is not ambiguous. */
+ new_binding = decl;
+
+ if (doing_global)
+ set_namespace_binding (name, current_namespace, new_binding);
+ else
+ {
+ /* We only create an OVERLOAD if there was a previous binding at
+ this level, or if decl is a template. In the former case, we
+ need to remove the old binding and replace it with the new
+ binding. We must also run through the NAMES on the binding
+ level where the name was bound to update the chain. */
+
+ if (TREE_CODE (new_binding) == OVERLOAD && old)
+ {
+ tree *d;
+
+ for (d = &IDENTIFIER_BINDING (name)->scope->names;
+ *d;
+ d = &TREE_CHAIN (*d))
+ if (*d == old
+ || (TREE_CODE (*d) == TREE_LIST
+ && TREE_VALUE (*d) == old))
+ {
+ if (TREE_CODE (*d) == TREE_LIST)
+ /* Just replace the old binding with the new. */
+ TREE_VALUE (*d) = new_binding;
+ else
+ /* Build a TREE_LIST to wrap the OVERLOAD. */
+ *d = tree_cons (NULL_TREE, new_binding,
+ TREE_CHAIN (*d));
+
+ /* And update the cxx_binding node. */
+ IDENTIFIER_BINDING (name)->value = new_binding;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
+ }
+
+ /* We should always find a previous binding in this case. */
+ abort ();
+ }
+
+ /* Install the new binding. */
+ push_local_binding (name, new_binding, flags);
+ }
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
+}
+
+/* Check a non-member using-declaration. Return the name and scope
+ being used, and the USING_DECL, or NULL_TREE on failure. */
+
+static tree
+validate_nonmember_using_decl (tree decl, tree scope, tree name)
+{
+ if (TREE_CODE (decl) == TEMPLATE_ID_EXPR)
+ {
+ /* 7.3.3/5
+ A using-declaration shall not name a template-id. */
+ error ("a using-declaration cannot specify a template-id. Try `using %D'", name);
+ return NULL_TREE;
+ }
+
+ if (TREE_CODE (decl) == NAMESPACE_DECL)
+ {
+ error ("namespace `%D' not allowed in using-declaration", decl);
+ return NULL_TREE;
+ }
+
+ if (TREE_CODE (decl) == SCOPE_REF)
+ {
+ /* It's a nested name with template parameter dependent scope.
+ This can only be using-declaration for class member. */
+ error ("`%T' is not a namespace", TREE_OPERAND (decl, 0));
+ return NULL_TREE;
+ }
+
+ if (is_overloaded_fn (decl))
+ decl = get_first_fn (decl);
+
+ my_friendly_assert (DECL_P (decl), 20020908);
+
+ /* [namespace.udecl]
+ A using-declaration for a class member shall be a
+ member-declaration. */
+ if (TYPE_P (scope))
+ {
+ error ("`%T' is not a namespace", scope);
+ return NULL_TREE;
+ }
+
+ /* Make a USING_DECL. */
+ return push_using_decl (scope, name);
+}
+
+/* Process local and global using-declarations. */
+
+static void
+do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
+ tree *newval, tree *newtype)
+{
+ cxx_binding decls;
+
+ *newval = *newtype = NULL_TREE;
+ cxx_binding_clear (&decls);
+ if (!qualified_lookup_using_namespace (name, scope, &decls, 0))
+ /* Lookup error */
+ return;
+
+ if (!decls.value && !decls.type)
+ {
+ error ("`%D' not declared", name);
+ return;
+ }
+
+ /* Check for using functions. */
+ if (decls.value && is_overloaded_fn (decls.value))
+ {
+ tree tmp, tmp1;
+
+ if (oldval && !is_overloaded_fn (oldval))
+ {
+ if (!DECL_IMPLICIT_TYPEDEF_P (oldval))
+ error ("`%D' is already declared in this scope", name);
+ oldval = NULL_TREE;
+ }
+
+ *newval = oldval;
+ for (tmp = decls.value; tmp; tmp = OVL_NEXT (tmp))
+ {
+ tree new_fn = OVL_CURRENT (tmp);
+
+ /* [namespace.udecl]
+
+ If a function declaration in namespace scope or block
+ scope has the same name and the same parameter types as a
+ function introduced by a using declaration the program is
+ ill-formed. */
+ for (tmp1 = oldval; tmp1; tmp1 = OVL_NEXT (tmp1))
+ {
+ tree old_fn = OVL_CURRENT (tmp1);
+
+ 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. If both
+ are the same extern "C" functions, that's ok. */
+ if (decls_match (new_fn, old_fn))
+ {
+ /* If the OLD_FN was a builtin, there is now a
+ real declaration. */
+ if (DECL_ANTICIPATED (old_fn))
+ DECL_ANTICIPATED (old_fn) = 0;
+ break;
+ }
+ else if (!DECL_ANTICIPATED (old_fn))
+ {
+ /* If the OLD_FN was really declared, the
+ declarations don't match. */
+ error ("`%D' is already declared in this scope", name);
+ break;
+ }
+
+ /* If the OLD_FN was not really there, just ignore
+ it and keep going. */
+ }
+ }
+
+ /* If we broke out of the loop, there's no reason to add
+ this function to the using declarations for this
+ scope. */
+ if (tmp1)
+ continue;
+
+ /* If we are adding to an existing OVERLOAD, then we no
+ longer know the type of the set of functions. */
+ if (*newval && TREE_CODE (*newval) == OVERLOAD)
+ TREE_TYPE (*newval) = unknown_type_node;
+ /* Add this new function to the set. */
+ *newval = build_overload (OVL_CURRENT (tmp), *newval);
+ /* If there is only one function, then we use its type. (A
+ using-declaration naming a single function can be used in
+ contexts where overload resolution cannot be
+ performed.) */
+ if (TREE_CODE (*newval) != OVERLOAD)
+ {
+ *newval = ovl_cons (*newval, NULL_TREE);
+ TREE_TYPE (*newval) = TREE_TYPE (OVL_CURRENT (tmp));
+ }
+ OVL_USED (*newval) = 1;
+ }
+ }
+ else
+ {
+ *newval = decls.value;
+ if (oldval && !decls_match (*newval, oldval))
+ error ("`%D' is already declared in this scope", name);
+ }
+
+ *newtype = decls.type;
+ if (oldtype && *newtype && !same_type_p (oldtype, *newtype))
+ {
+ error ("using declaration `%D' introduced ambiguous type `%T'",
+ name, oldtype);
+ return;
+ }
+}
+
+/* Process a using-declaration at function scope. */
+
+void
+do_local_using_decl (tree decl, tree scope, tree name)
+{
+ tree oldval, oldtype, newval, newtype;
+
+ decl = validate_nonmember_using_decl (decl, scope, name);
+ 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);
+
+ do_nonmember_using_decl (scope, name, oldval, oldtype, &newval, &newtype);
+
+ if (newval)
+ {
+ if (is_overloaded_fn (newval))
+ {
+ tree fn, term;
+
+ /* We only need to push declarations for those functions
+ that were not already bound in the current level.
+ The old value might be NULL_TREE, it might be a single
+ function, or an OVERLOAD. */
+ if (oldval && TREE_CODE (oldval) == OVERLOAD)
+ term = OVL_FUNCTION (oldval);
+ else
+ term = oldval;
+ for (fn = newval; fn && OVL_CURRENT (fn) != term;
+ fn = OVL_NEXT (fn))
+ push_overloaded_decl (OVL_CURRENT (fn),
+ PUSH_LOCAL | PUSH_USING);
+ }
+ else
+ push_local_binding (name, newval, PUSH_USING);
+ }
+ if (newtype)
+ {
+ push_local_binding (name, newtype, PUSH_USING);
+ set_identifier_type_value (name, newtype);
+ }
+}
+
+/* Return the type that should be used when TYPE's name is preceded
+ by a tag such as 'struct' or 'union', or null if the name cannot
+ be used in this way.
+
+ For example, when processing the third line of:
+
+ struct A;
+ typedef struct A A;
+ struct A;
+
+ lookup of A will find the typedef. Given A's typedef, this function
+ will return the type associated with "struct A". For the tag to be
+ anything other than TYPE, TYPE must be a typedef whose original type
+ has the same name and context as TYPE itself.
+
+ It is not valid for a typedef of an anonymous type to be used with
+ an explicit tag:
+
+ typedef struct { ... } B;
+ struct B;
+
+ Return null for this case. */
+
+static tree
+follow_tag_typedef (tree type)
+{
+ tree original;
+
+ original = original_type (type);
+ if (! TYPE_NAME (original))
+ return NULL_TREE;
+ if (TYPE_IDENTIFIER (original) == TYPE_IDENTIFIER (type)
+ && (CP_DECL_CONTEXT (TYPE_NAME (original))
+ == CP_DECL_CONTEXT (TYPE_NAME (type)))
+ && !(CLASS_TYPE_P (original) && TYPE_WAS_ANONYMOUS (original)))
+ return original;
+ else
+ return NULL_TREE;
+}
+
+/* Given NAME, an IDENTIFIER_NODE,
+ return the structure (or union or enum) definition for that name.
+ Searches binding levels from its SCOPE up to the global level.
+ If THISLEVEL_ONLY is nonzero, searches only the specified context
+ (but skips any sk_cleanup contexts to find one that is
+ meaningful for tags).
+ FORM says which kind of type the caller wants;
+ it is RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE.
+ If the wrong kind of type is found, and it's not a template, an error is
+ reported. */
+
+tree
+lookup_tag (enum tree_code form, tree name,
+ cxx_scope *binding_level, int thislevel_only)
+{
+ struct cp_binding_level *level;
+ /* Nonzero if, we should look past a template parameter level, even
+ if THISLEVEL_ONLY. */
+ int allow_template_parms_p = 1;
+ bool type_is_anonymous = ANON_AGGRNAME_P (name);
+
+ timevar_push (TV_NAME_LOOKUP);
+ for (level = binding_level; level; level = level->level_chain)
+ {
+ tree tail;
+ if (type_is_anonymous && level->type_decls != NULL)
+ {
+ tree type = binding_table_find_anon_type (level->type_decls, name);
+ /* There is no need for error checking here, because
+ anon names are unique throughout the compilation. */
+ if (type != NULL)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, type);
+ }
+ else if (level->kind == sk_namespace)
+ /* Do namespace lookup. */
+ for (tail = current_namespace; 1; tail = CP_DECL_CONTEXT (tail))
+ {
+ cxx_binding *binding =
+ cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (tail), name);
+ tree old;
+
+ /* 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_template_parms_p
+ && binding && binding->value
+ && DECL_CLASS_TEMPLATE_P (binding->value))
+ old = binding->value;
+ else if (binding)
+ old = select_decl (binding, LOOKUP_PREFER_TYPES);
+ else
+ old = NULL_TREE;
+
+ if (old)
+ {
+ /* We've found something at this binding level. If it is
+ a typedef, extract the tag it refers to. Lookup fails
+ if the typedef doesn't refer to a taggable type. */
+ old = TREE_TYPE (old);
+ old = follow_tag_typedef (old);
+ if (!old)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+ if (TREE_CODE (old) != form
+ && (form == ENUMERAL_TYPE
+ || TREE_CODE (old) == ENUMERAL_TYPE))
+ {
+ error ("`%#D' redeclared as %C", old, form);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+ }
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old);
+ }
+ if (thislevel_only || tail == global_namespace)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+ }
+ else if (level->type_decls != NULL)
+ {
+ binding_entry entry = binding_table_find (level->type_decls, name);
+ if (entry != NULL)
+ {
+ enum tree_code code = TREE_CODE (entry->type);
+
+ if (code != form
+ && (form == ENUMERAL_TYPE || code == ENUMERAL_TYPE))
+ {
+ /* Definition isn't the kind we were looking for. */
+ error ("`%#D' redeclared as %C", entry->type, form);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+ }
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, entry->type);
+ }
+ }
+ if (thislevel_only && level->kind != sk_cleanup)
+ {
+ if (level->kind == sk_template_parms && 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 nonzero. */
+ allow_template_parms_p = 0;
+ continue;
+ }
+ else
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+ }
+ }
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+}
+
+/* Given a type, find the tag that was defined for it and return the tag name.
+ Otherwise return 0. However, the value can never be 0
+ in the cases in which this is used.
+
+ C++: If NAME is nonzero, this is the new name to install. This is
+ done when replacing anonymous tags with real tag names. */
+
+tree
+lookup_tag_reverse (tree type, tree name)
+{
+ struct cp_binding_level *level;
+
+ timevar_push (TV_NAME_LOOKUP);
+ for (level = current_binding_level; level; level = level->level_chain)
+ {
+ binding_entry entry = level->type_decls == NULL
+ ? NULL
+ : binding_table_reverse_maybe_remap (level->type_decls, type, name);
+ if (entry)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, entry->name);
+ }
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+}
+
+/* Returns true if ROOT (a namespace, class, or function) encloses
+ CHILD. CHILD may be either a class type or a namespace. */
+
+bool
+is_ancestor (tree root, tree child)
+{
+ my_friendly_assert ((TREE_CODE (root) == NAMESPACE_DECL
+ || TREE_CODE (root) == FUNCTION_DECL
+ || CLASS_TYPE_P (root)), 20030307);
+ my_friendly_assert ((TREE_CODE (child) == NAMESPACE_DECL
+ || CLASS_TYPE_P (child)),
+ 20030307);
+
+ /* The global namespace encloses everything. */
+ if (root == global_namespace)
+ return true;
+
+ while (true)
+ {
+ /* If we've run out of scopes, stop. */
+ if (!child)
+ return false;
+ /* If we've reached the ROOT, it encloses CHILD. */
+ if (root == child)
+ return true;
+ /* Go out one level. */
+ if (TYPE_P (child))
+ child = TYPE_NAME (child);
+ child = DECL_CONTEXT (child);
+ }
+}
+
+/* Enter the class or namespace scope indicated by T. Returns TRUE iff
+ pop_scope should be called later to exit this scope. */
+
+bool
+push_scope (tree t)
+{
+ bool pop = true;
+
+ if (TREE_CODE (t) == NAMESPACE_DECL)
+ push_decl_namespace (t);
+ else if (CLASS_TYPE_P (t))
+ {
+ if (!at_class_scope_p ()
+ || !same_type_p (current_class_type, t))
+ push_nested_class (t);
+ else
+ /* T is the same as the current scope. There is therefore no
+ need to re-enter the scope. Since we are not actually
+ pushing a new scope, our caller should not call
+ pop_scope. */
+ pop = false;
+ }
+
+ return pop;
+}
+
+/* Leave scope pushed by push_scope. */
+
+void
+pop_scope (tree t)
+{
+ if (TREE_CODE (t) == NAMESPACE_DECL)
+ pop_decl_namespace ();
+ else if CLASS_TYPE_P (t)
+ pop_nested_class ();
+}
+
+/* Do a pushlevel for class declarations. */
+
+void
+pushlevel_class (void)
+{
+ if (ENABLE_SCOPE_CHECKING)
+ is_class_level = 1;
+
+ class_binding_level = begin_scope (sk_class, current_class_type);
+}
+
+/* ...and a poplevel for class declarations. */
+
+void
+poplevel_class (void)
+{
+ struct cp_binding_level *level = class_binding_level;
+ tree shadowed;
+
+ timevar_push (TV_NAME_LOOKUP);
+ my_friendly_assert (level != 0, 354);
+
+ /* 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,
+ if we don't touch it here, we're able to use the cache effect if the
+ next time we're entering a class scope, it is the same class. */
+ if (current_class_depth != 1)
+ {
+ struct cp_binding_level* b;
+
+ /* Clear out our IDENTIFIER_CLASS_VALUEs. */
+ for (shadowed = level->class_shadowed;
+ 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;
+ while (b && b->kind != sk_class)
+ b = b->level_chain;
+
+ if (b)
+ for (shadowed = b->class_shadowed;
+ shadowed;
+ shadowed = TREE_CHAIN (shadowed))
+ {
+ cxx_binding *binding;
+
+ binding = IDENTIFIER_BINDING (TREE_PURPOSE (shadowed));
+ while (binding && binding->scope != b)
+ binding = binding->previous;
+
+ if (binding)
+ IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed))
+ = binding->value;
+ }
+ }
+ else
+ /* Remember to save what IDENTIFIER's were bound in this scope so we
+ can recover from cache misses. */
+ {
+ previous_class_type = current_class_type;
+ previous_class_values = class_binding_level->class_shadowed;
+ }
+ for (shadowed = level->type_shadowed;
+ shadowed;
+ shadowed = TREE_CHAIN (shadowed))
+ 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;
+ shadowed = TREE_CHAIN (shadowed))
+ pop_binding (TREE_PURPOSE (shadowed), TREE_TYPE (shadowed));
+
+ /* Now, pop out of the binding level which we created up in the
+ `pushlevel_class' routine. */
+ if (ENABLE_SCOPE_CHECKING)
+ is_class_level = 1;
+
+ leave_scope ();
+ timevar_pop (TV_NAME_LOOKUP);
+}
+
+/* Bind DECL to ID in the class_binding_level. Returns nonzero if the
+ binding was successful. */
+
+int
+push_class_binding (tree id, tree decl)
+{
+ int result = 1;
+ cxx_binding *binding = IDENTIFIER_BINDING (id);
+ tree context;
+
+ timevar_push (TV_NAME_LOOKUP);
+ /* Note that we declared this value so that we can issue an error if
+ this is an invalid redeclaration of a name already used for some
+ other purpose. */
+ note_name_declared_in_class (id, decl);
+
+ if (binding && binding->scope == class_binding_level)
+ /* Supplement the existing binding. */
+ result = supplement_binding (IDENTIFIER_BINDING (id), decl);
+ else
+ /* Create a new binding. */
+ push_binding (id, decl, class_binding_level);
+
+ /* Update the IDENTIFIER_CLASS_VALUE for this ID to be the
+ class-level declaration. Note that we do not use DECL here
+ because of the possibility of the `struct stat' hack; if DECL is
+ a class-name or enum-name we might prefer a field-name, or some
+ such. */
+ IDENTIFIER_CLASS_VALUE (id) = IDENTIFIER_BINDING (id)->value;
+
+ /* If this is a binding from a base class, mark it as such. */
+ binding = IDENTIFIER_BINDING (id);
+ if (binding->value == decl && TREE_CODE (decl) != TREE_LIST)
+ {
+ if (TREE_CODE (decl) == OVERLOAD)
+ context = CP_DECL_CONTEXT (OVL_CURRENT (decl));
+ else
+ {
+ my_friendly_assert (DECL_P (decl), 0);
+ context = context_for_name_lookup (decl);
+ }
+
+ if (is_properly_derived_from (current_class_type, context))
+ INHERITED_VALUE_BINDING_P (binding) = 1;
+ else
+ INHERITED_VALUE_BINDING_P (binding) = 0;
+ }
+ else if (binding->value == decl)
+ /* We only encounter a TREE_LIST when push_class_decls detects an
+ ambiguity. Such an ambiguity can be overridden by a definition
+ in this class. */
+ INHERITED_VALUE_BINDING_P (binding) = 1;
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, result);
+}
+
+/* We are entering the scope of a class. Clear IDENTIFIER_CLASS_VALUE
+ for any names in enclosing classes. */
+
+void
+clear_identifier_class_values (void)
+{
+ tree t;
+
+ if (!class_binding_level)
+ return;
+
+ for (t = class_binding_level->class_shadowed;
+ t;
+ t = TREE_CHAIN (t))
+ IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE;
+}
+
+/* Make the declaration of X appear in CLASS scope. */
+
+bool
+pushdecl_class_level (tree x)
+{
+ tree name;
+ bool is_valid = true;
+
+ timevar_push (TV_NAME_LOOKUP);
+ /* Get the name of X. */
+ if (TREE_CODE (x) == OVERLOAD)
+ name = DECL_NAME (get_first_fn (x));
+ else
+ name = DECL_NAME (x);
+
+ if (name)
+ {
+ is_valid = push_class_level_binding (name, x);
+ if (TREE_CODE (x) == TYPE_DECL)
+ set_identifier_type_value (name, x);
+ }
+ else if (ANON_AGGR_TYPE_P (TREE_TYPE (x)))
+ {
+ /* If X is an anonymous aggregate, all of its members are
+ treated as if they were members of the class containing the
+ aggregate, for naming purposes. */
+ tree f;
+
+ for (f = TYPE_FIELDS (TREE_TYPE (x)); f; f = TREE_CHAIN (f))
+ {
+ location_t save_location = input_location;
+ input_location = DECL_SOURCE_LOCATION (f);
+ if (!pushdecl_class_level (f))
+ is_valid = false;
+ input_location = save_location;
+ }
+ }
+ timevar_pop (TV_NAME_LOOKUP);
+
+ return is_valid;
+}
+
+/* Make the declaration(s) of X appear in CLASS scope under the name
+ NAME. Returns true if the binding is valid. */
+
+bool
+push_class_level_binding (tree name, tree x)
+{
+ cxx_binding *binding;
+
+ timevar_push (TV_NAME_LOOKUP);
+ /* The class_binding_level will be NULL if x is a template
+ parameter name in a member template. */
+ if (!class_binding_level)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, true);
+
+ /* Make sure that this new member does not have the same name
+ as a template parameter. */
+ if (TYPE_BEING_DEFINED (current_class_type))
+ check_template_shadow (x);
+
+ /* [class.mem]
+
+ If T is the name of a class, then each of the following shall
+ have a name different from T:
+
+ -- every static data member of class T;
+
+ -- every member of class T that is itself a type;
+
+ -- every enumerator of every member of class T that is an
+ enumerated type;
+
+ -- every member of every anonymous union that is a member of
+ class T.
+
+ (Non-static data members were also forbidden to have the same
+ name as T until TC1.) */
+ if ((TREE_CODE (x) == VAR_DECL
+ || TREE_CODE (x) == CONST_DECL
+ || (TREE_CODE (x) == TYPE_DECL
+ && !DECL_SELF_REFERENCE_P (x))
+ /* A data member of an anonymous union. */
+ || (TREE_CODE (x) == FIELD_DECL
+ && DECL_CONTEXT (x) != current_class_type))
+ && DECL_NAME (x) == constructor_name (current_class_type))
+ {
+ tree scope = context_for_name_lookup (x);
+ if (TYPE_P (scope) && same_type_p (scope, current_class_type))
+ {
+ error ("`%D' has the same name as the class in which it is declared",
+ x);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false);
+ }
+ }
+
+ /* If this declaration shadows a declaration from an enclosing
+ 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 && binding->value)
+ {
+ tree bval = binding->value;
+ tree old_decl = NULL_TREE;
+
+ if (INHERITED_VALUE_BINDING_P (binding))
+ {
+ /* If the old binding was from a base class, and was for a
+ tag name, slide it over to make room for the new binding.
+ The old binding is still visible if explicitly qualified
+ with a class-key. */
+ if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval)
+ && !(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)))
+ {
+ old_decl = binding->type;
+ binding->type = bval;
+ binding->value = NULL_TREE;
+ INHERITED_VALUE_BINDING_P (binding) = 0;
+ }
+ else
+ old_decl = bval;
+ }
+ else if (TREE_CODE (x) == OVERLOAD && is_overloaded_fn (bval))
+ old_decl = bval;
+ else if (TREE_CODE (x) == USING_DECL && TREE_CODE (bval) == USING_DECL)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, true);
+ else if (TREE_CODE (x) == USING_DECL && is_overloaded_fn (bval))
+ old_decl = bval;
+ else if (TREE_CODE (bval) == USING_DECL && is_overloaded_fn (x))
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, true);
+
+ if (old_decl)
+ {
+ tree shadow;
+
+ /* 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))
+ if (TREE_PURPOSE (shadow) == name
+ && TREE_TYPE (shadow) == old_decl)
+ {
+ binding->value = x;
+ INHERITED_VALUE_BINDING_P (binding) = 0;
+ TREE_TYPE (shadow) = x;
+ IDENTIFIER_CLASS_VALUE (name) = x;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, true);
+ }
+ }
+ }
+
+ /* If we didn't replace an existing binding, put the binding on the
+ stack of bindings for the identifier, and update the shadowed list. */
+ if (push_class_binding (name, x))
+ {
+ class_binding_level->class_shadowed
+ = tree_cons (name, NULL,
+ class_binding_level->class_shadowed);
+ /* 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;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, true);
+ }
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false);
+}
+
+tree
+do_class_using_decl (tree decl)
+{
+ tree name, value, scope, type;
+
+ if (TREE_CODE (decl) != SCOPE_REF
+ || !TREE_OPERAND (decl, 0)
+ || !TYPE_P (TREE_OPERAND (decl, 0)))
+ {
+ error ("using-declaration for non-member at class scope");
+ return NULL_TREE;
+ }
+ scope = TREE_OPERAND (decl, 0);
+ name = TREE_OPERAND (decl, 1);
+ if (TREE_CODE (name) == BIT_NOT_EXPR)
+ {
+ error ("using-declaration cannot name destructor");
+ return NULL_TREE;
+ }
+ if (TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+ else if (TREE_CODE (name) == TEMPLATE_DECL)
+ name = DECL_NAME (name);
+ else if (BASELINK_P (name))
+ {
+ tree fns = BASELINK_FUNCTIONS (name);
+ name = DECL_NAME (get_first_fn (fns));
+ }
+
+ my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 980716);
+
+ /* Dependent using decls have a NULL type, non-dependent ones have a
+ void type. */
+ type = dependent_type_p (scope) ? NULL_TREE : void_type_node;
+ value = build_lang_decl (USING_DECL, name, type);
+ DECL_INITIAL (value) = scope;
+ return value;
+}
+
+void
+set_class_shadows (tree shadows)
+{
+ class_binding_level->class_shadowed = shadows;
+}
+
+/* Return the binding value for name in scope. */
+
+tree
+namespace_binding (tree name, tree scope)
+{
+ cxx_binding *binding;
+
+ if (scope == NULL)
+ scope = global_namespace;
+ scope = ORIGINAL_NAMESPACE (scope);
+ binding = cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
+
+ return binding ? binding->value : NULL_TREE;
+}
+
+/* Set the binding value for name in scope. */
+
+void
+set_namespace_binding (tree name, tree scope, tree val)
+{
+ cxx_binding *b;
+
+ timevar_push (TV_NAME_LOOKUP);
+ if (scope == NULL_TREE)
+ scope = global_namespace;
+ b = binding_for_name (NAMESPACE_LEVEL (scope), name);
+ if (!b->value || TREE_CODE (val) == OVERLOAD || val == error_mark_node)
+ b->value = val;
+ else
+ supplement_binding (b, val);
+ timevar_pop (TV_NAME_LOOKUP);
+}
+
+/* Compute the namespace where a declaration is defined. */
+
+static tree
+decl_namespace (tree decl)
+{
+ timevar_push (TV_NAME_LOOKUP);
+ if (TYPE_P (decl))
+ decl = TYPE_STUB_DECL (decl);
+ while (DECL_CONTEXT (decl))
+ {
+ decl = DECL_CONTEXT (decl);
+ if (TREE_CODE (decl) == NAMESPACE_DECL)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
+ if (TYPE_P (decl))
+ decl = TYPE_STUB_DECL (decl);
+ my_friendly_assert (DECL_P (decl), 390);
+ }
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, global_namespace);
+}
+
+/* Set the context of a declaration to scope. Complain if we are not
+ outside scope. */
+
+void
+set_decl_namespace (tree decl, tree scope, bool friendp)
+{
+ tree old;
+
+ /* Get rid of namespace aliases. */
+ scope = ORIGINAL_NAMESPACE (scope);
+
+ /* It is ok for friends to be qualified in parallel space. */
+ if (!friendp && !is_ancestor (current_namespace, scope))
+ error ("declaration of `%D' not in a namespace surrounding `%D'",
+ decl, scope);
+ DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
+ if (scope != current_namespace)
+ {
+ /* See whether this has been declared in the namespace. */
+ old = namespace_binding (DECL_NAME (decl), scope);
+ 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
+ point. pushdecl will find those errors later. */
+ return;
+ /* Since decl is a function, old should contain a function decl. */
+ if (!is_overloaded_fn (old))
+ goto complain;
+ if (processing_template_decl || processing_specialization)
+ /* We have not yet called push_template_decl to turn a
+ FUNCTION_DECL into a TEMPLATE_DECL, so the declarations
+ won't match. But, we'll check later, when we construct the
+ template. */
+ return;
+ if (is_overloaded_fn (old))
+ {
+ for (; old; old = OVL_NEXT (old))
+ if (decls_match (decl, OVL_CURRENT (old)))
+ return;
+ }
+ else
+ if (decls_match (decl, old))
+ return;
+ }
+ else
+ return;
+ complain:
+ error ("`%D' should have been declared inside `%D'",
+ decl, scope);
+}
+
+/* Return the namespace where the current declaration is declared. */
+
+tree
+current_decl_namespace (void)
+{
+ tree result;
+ /* If we have been pushed into a different namespace, use it. */
+ if (decl_namespace_list)
+ return TREE_PURPOSE (decl_namespace_list);
+
+ if (current_class_type)
+ result = decl_namespace (TYPE_STUB_DECL (current_class_type));
+ else if (current_function_decl)
+ result = decl_namespace (current_function_decl);
+ else
+ result = current_namespace;
+ return result;
+}
+
+/* Push into the scope of the NAME namespace. If NAME is NULL_TREE, then we
+ select a name that is unique to this compilation unit. */
+
+void
+push_namespace (tree name)
+{
+ tree d = NULL_TREE;
+ int need_new = 1;
+ int implicit_use = 0;
+ bool anon = !name;
+
+ timevar_push (TV_NAME_LOOKUP);
+
+ /* We should not get here if the global_namespace is not yet constructed
+ nor if NAME designates the global namespace: The global scope is
+ constructed elsewhere. */
+ my_friendly_assert (global_namespace != NULL && name != global_scope_name,
+ 20030531);
+
+ if (anon)
+ {
+ /* The name of anonymous namespace is unique for the translation
+ unit. */
+ if (!anonymous_namespace_name)
+ anonymous_namespace_name = get_file_function_name ('N');
+ name = anonymous_namespace_name;
+ d = IDENTIFIER_NAMESPACE_VALUE (name);
+ if (d)
+ /* Reopening anonymous namespace. */
+ need_new = 0;
+ implicit_use = 1;
+ }
+ else
+ {
+ /* Check whether this is an extended namespace definition. */
+ d = IDENTIFIER_NAMESPACE_VALUE (name);
+ if (d != NULL_TREE && TREE_CODE (d) == NAMESPACE_DECL)
+ {
+ need_new = 0;
+ if (DECL_NAMESPACE_ALIAS (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. */
+ d = build_lang_decl (NAMESPACE_DECL, name, void_type_node);
+ DECL_CONTEXT (d) = FROB_CONTEXT (current_namespace);
+ d = pushdecl (d);
+ if (anon)
+ {
+ /* Clear DECL_NAME for the benefit of debugging back ends. */
+ SET_DECL_ASSEMBLER_NAME (d, name);
+ DECL_NAME (d) = NULL_TREE;
+ }
+ begin_scope (sk_namespace, d);
+ }
+ else
+ resume_scope (NAMESPACE_LEVEL (d));
+
+ if (implicit_use)
+ do_using_directive (d);
+ /* Enter the name space. */
+ current_namespace = d;
+
+ timevar_pop (TV_NAME_LOOKUP);
+}
+
+/* Pop from the scope of the current namespace. */
+
+void
+pop_namespace (void)
+{
+ 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. */
+ leave_scope ();
+}
+
+/* Push into the scope of the namespace NS, even if it is deeply
+ nested within another namespace. */
+
+void
+push_nested_namespace (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 (tree ns)
+{
+ timevar_push (TV_NAME_LOOKUP);
+ while (ns != global_namespace)
+ {
+ pop_namespace ();
+ ns = CP_DECL_CONTEXT (ns);
+ }
+
+ pop_from_top_level ();
+ timevar_pop (TV_NAME_LOOKUP);
+}
+
+/* Temporarily set the namespace for the current declaration. */
+
+void
+push_decl_namespace (tree decl)
+{
+ if (TREE_CODE (decl) != NAMESPACE_DECL)
+ decl = decl_namespace (decl);
+ decl_namespace_list = tree_cons (ORIGINAL_NAMESPACE (decl),
+ NULL_TREE, decl_namespace_list);
+}
+
+/* [namespace.memdef]/2 */
+
+void
+pop_decl_namespace (void)
+{
+ decl_namespace_list = TREE_CHAIN (decl_namespace_list);
+}
+
+/* Return the namespace that is the common ancestor
+ of two given namespaces. */
+
+static tree
+namespace_ancestor (tree ns1, tree ns2)
+{
+ timevar_push (TV_NAME_LOOKUP);
+ if (is_ancestor (ns1, ns2))
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ns1);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
+ namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2));
+}
+
+/* Process a namespace-alias declaration. */
+
+void
+do_namespace_alias (tree alias, tree namespace)
+{
+ if (TREE_CODE (namespace) != NAMESPACE_DECL)
+ {
+ /* The parser did not find it, so it's not there. */
+ error ("unknown namespace `%D'", namespace);
+ return;
+ }
+
+ namespace = ORIGINAL_NAMESPACE (namespace);
+
+ /* Build the alias. */
+ alias = build_lang_decl (NAMESPACE_DECL, alias, void_type_node);
+ DECL_NAMESPACE_ALIAS (alias) = namespace;
+ DECL_EXTERNAL (alias) = 1;
+ pushdecl (alias);
+}
+
+/* Like pushdecl, only it places X in the current namespace,
+ if appropriate. */
+
+tree
+pushdecl_namespace_level (tree x)
+{
+ struct cp_binding_level *b = current_binding_level;
+ tree t;
+
+ timevar_push (TV_NAME_LOOKUP);
+ t = pushdecl_with_scope (x, NAMESPACE_LEVEL (current_namespace));
+
+ /* Now, the type_shadowed stack may screw us. Munge it so it does
+ what we want. */
+ if (TREE_CODE (x) == TYPE_DECL)
+ {
+ tree name = DECL_NAME (x);
+ tree newval;
+ tree *ptr = (tree *)0;
+ for (; !global_scope_p (b); b = b->level_chain)
+ {
+ tree shadowed = b->type_shadowed;
+ for (; shadowed; shadowed = TREE_CHAIN (shadowed))
+ if (TREE_PURPOSE (shadowed) == name)
+ {
+ ptr = &TREE_VALUE (shadowed);
+ /* Can't break out of the loop here because sometimes
+ a binding level will have duplicate bindings for
+ PT names. It's gross, but I haven't time to fix it. */
+ }
+ }
+ newval = TREE_TYPE (x);
+ if (ptr == (tree *)0)
+ {
+ /* @@ This shouldn't be needed. My test case "zstring.cc" trips
+ up here if this is changed to an assertion. --KR */
+ SET_IDENTIFIER_TYPE_VALUE (name, x);
+ }
+ else
+ {
+ *ptr = newval;
+ }
+ }
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+}
+
+/* Insert USED into the using list of USER. Set INDIRECT_flag if this
+ directive is not directly from the source. Also find the common
+ ancestor and let our users know about the new namespace */
+static void
+add_using_namespace (tree user, tree used, bool indirect)
+{
+ tree t;
+ timevar_push (TV_NAME_LOOKUP);
+ /* Using oneself is a no-op. */
+ if (user == used)
+ {
+ timevar_pop (TV_NAME_LOOKUP);
+ return;
+ }
+ my_friendly_assert (TREE_CODE (user) == NAMESPACE_DECL, 380);
+ my_friendly_assert (TREE_CODE (used) == NAMESPACE_DECL, 380);
+ /* Check if we already have this. */
+ t = purpose_member (used, DECL_NAMESPACE_USING (user));
+ if (t != NULL_TREE)
+ {
+ if (!indirect)
+ /* Promote to direct usage. */
+ TREE_INDIRECT_USING (t) = 0;
+ timevar_pop (TV_NAME_LOOKUP);
+ return;
+ }
+
+ /* Add used to the user's using list. */
+ 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)
+ = tree_cons (user, 0, DECL_NAMESPACE_USERS (used));
+
+ /* Recursively add all namespaces used. */
+ for (t = DECL_NAMESPACE_USING (used); t; t = TREE_CHAIN (t))
+ /* indirect usage */
+ add_using_namespace (user, TREE_PURPOSE (t), 1);
+
+ /* Tell everyone using us about the new used namespaces. */
+ for (t = DECL_NAMESPACE_USERS (user); t; t = TREE_CHAIN (t))
+ add_using_namespace (TREE_PURPOSE (t), used, 1);
+ timevar_pop (TV_NAME_LOOKUP);
+}
+
+/* Process a using-declaration not appearing in class or local scope. */
+
+void
+do_toplevel_using_decl (tree decl, tree scope, tree name)
+{
+ tree oldval, oldtype, newval, newtype;
+ cxx_binding *binding;
+
+ decl = validate_nonmember_using_decl (decl, scope, name);
+ if (decl == NULL_TREE)
+ return;
+
+ binding = binding_for_name (NAMESPACE_LEVEL (current_namespace), name);
+
+ oldval = binding->value;
+ oldtype = binding->type;
+
+ do_nonmember_using_decl (scope, name, oldval, oldtype, &newval, &newtype);
+
+ /* Copy declarations found. */
+ if (newval)
+ binding->value = newval;
+ if (newtype)
+ binding->type = newtype;
+ return;
+}
+
+/* Process a using-directive. */
+
+void
+do_using_directive (tree namespace)
+{
+ 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. */
+ if (!processing_template_decl)
+ error ("namespace `%T' undeclared", namespace);
+ return;
+ }
+ if (TREE_CODE (namespace) != NAMESPACE_DECL)
+ {
+ if (!processing_template_decl)
+ error ("`%T' is not a namespace", namespace);
+ return;
+ }
+ namespace = ORIGINAL_NAMESPACE (namespace);
+ if (!toplevel_bindings_p ())
+ push_using_directive (namespace);
+ else
+ /* direct usage */
+ add_using_namespace (current_namespace, namespace, 0);
+}
+
+/* Deal with a using-directive seen by the parser. Currently we only
+ handle attributes here, since they cannot appear inside a template. */
+
+void
+parse_using_directive (tree namespace, tree attribs)
+{
+ tree a;
+
+ do_using_directive (namespace);
+
+ for (a = attribs; a; a = TREE_CHAIN (a))
+ {
+ tree name = TREE_PURPOSE (a);
+ if (is_attribute_p ("strong", name))
+ {
+ if (!toplevel_bindings_p ())
+ error ("strong using only meaningful at namespace scope");
+ else
+ DECL_NAMESPACE_ASSOCIATIONS (namespace)
+ = tree_cons (current_namespace, 0,
+ DECL_NAMESPACE_ASSOCIATIONS (namespace));
+ }
+ else
+ warning ("`%D' attribute directive ignored", name);
+ }
+}
+
+/* Like pushdecl, only it places X in the global scope if appropriate.
+ Calls cp_finish_decl to register the variable, initializing it with
+ *INIT, if INIT is non-NULL. */
+
+static tree
+pushdecl_top_level_1 (tree x, tree *init)
+{
+ timevar_push (TV_NAME_LOOKUP);
+ push_to_top_level ();
+ x = pushdecl_namespace_level (x);
+ if (init)
+ cp_finish_decl (x, *init, NULL_TREE, 0);
+ pop_from_top_level ();
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
+}
+
+/* Like pushdecl, only it places X in the global scope if appropriate. */
+
+tree
+pushdecl_top_level (tree x)
+{
+ return pushdecl_top_level_1 (x, NULL);
+}
+
+/* Like pushdecl, only it places X in the global scope if
+ appropriate. Calls cp_finish_decl to register the variable,
+ initializing it with INIT. */
+
+tree
+pushdecl_top_level_and_finish (tree x, tree init)
+{
+ return pushdecl_top_level_1 (x, &init);
+}
+
+/* Combines two sets of overloaded functions into an OVERLOAD chain, removing
+ duplicates. The first list becomes the tail of the result.
+
+ The algorithm is O(n^2). We could get this down to O(n log n) by
+ doing a sort on the addresses of the functions, if that becomes
+ necessary. */
+
+static tree
+merge_functions (tree s1, tree s2)
+{
+ for (; s2; s2 = OVL_NEXT (s2))
+ {
+ 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;
+}
+
+/* This should return an error not all definitions define functions.
+ It is not an error if we find two functions with exactly the
+ same signature, only if these are selected in overload resolution.
+ old is the current set of bindings, new the freshly-found binding.
+ XXX Do we want to give *all* candidates in case of ambiguity?
+ XXX In what way should I treat extern declarations?
+ XXX I don't want to repeat the entire duplicate_decls here */
+
+static cxx_binding *
+ambiguous_decl (tree name, cxx_binding *old, cxx_binding *new, int flags)
+{
+ tree val, type;
+ my_friendly_assert (old != NULL, 393);
+ /* Copy the value. */
+ val = new->value;
+ if (val)
+ switch (TREE_CODE (val))
+ {
+ case TEMPLATE_DECL:
+ /* If we expect types or namespaces, and not templates,
+ or this is not a template class. */
+ if (LOOKUP_QUALIFIERS_ONLY (flags)
+ && !DECL_CLASS_TEMPLATE_P (val))
+ val = NULL_TREE;
+ break;
+ case TYPE_DECL:
+ if (LOOKUP_NAMESPACES_ONLY (flags))
+ val = NULL_TREE;
+ break;
+ case NAMESPACE_DECL:
+ if (LOOKUP_TYPES_ONLY (flags))
+ val = NULL_TREE;
+ break;
+ case FUNCTION_DECL:
+ /* Ignore built-in functions that are still anticipated. */
+ if (LOOKUP_QUALIFIERS_ONLY (flags) || DECL_ANTICIPATED (val))
+ val = NULL_TREE;
+ break;
+ default:
+ if (LOOKUP_QUALIFIERS_ONLY (flags))
+ val = NULL_TREE;
+ }
+
+ if (!old->value)
+ old->value = val;
+ else if (val && val != old->value)
+ {
+ if (is_overloaded_fn (old->value) && is_overloaded_fn (val))
+ old->value = merge_functions (old->value, val);
+ else
+ {
+ /* Some declarations are functions, some are not. */
+ if (flags & LOOKUP_COMPLAIN)
+ {
+ /* If we've already given this error for this lookup,
+ old->value is error_mark_node, so let's not
+ repeat ourselves. */
+ if (old->value != error_mark_node)
+ {
+ error ("use of `%D' is ambiguous", name);
+ cp_error_at (" first declared as `%#D' here",
+ old->value);
+ }
+ cp_error_at (" also declared as `%#D' here", val);
+ }
+ old->value = error_mark_node;
+ }
+ }
+ /* ... and copy the type. */
+ type = new->type;
+ if (LOOKUP_NAMESPACES_ONLY (flags))
+ type = NULL_TREE;
+ if (!old->type)
+ old->type = type;
+ else if (type && old->type != type)
+ {
+ if (flags & LOOKUP_COMPLAIN)
+ {
+ error ("`%D' denotes an ambiguous type",name);
+ error ("%J first type here", TYPE_MAIN_DECL (old->type));
+ error ("%J other type here", TYPE_MAIN_DECL (type));
+ }
+ }
+ return old;
+}
+
+/* Return the declarations that are members of the namespace NS. */
+
+tree
+cp_namespace_decls (tree ns)
+{
+ return NAMESPACE_LEVEL (ns)->names;
+}
+
+/* Combine prefer_type and namespaces_only into flags. */
+
+static int
+lookup_flags (int prefer_type, int namespaces_only)
+{
+ if (namespaces_only)
+ return LOOKUP_PREFER_NAMESPACES;
+ if (prefer_type > 1)
+ return LOOKUP_PREFER_TYPES;
+ if (prefer_type > 0)
+ return LOOKUP_PREFER_BOTH;
+ return 0;
+}
+
+/* Given a lookup that returned VAL, use FLAGS to decide if we want to
+ ignore it or not. Subroutine of lookup_name_real. */
+
+static tree
+qualify_lookup (tree val, int flags)
+{
+ if (val == NULL_TREE)
+ return val;
+ if ((flags & LOOKUP_PREFER_NAMESPACES) && TREE_CODE (val) == NAMESPACE_DECL)
+ return val;
+ if ((flags & LOOKUP_PREFER_TYPES)
+ && (TREE_CODE (val) == TYPE_DECL || TREE_CODE (val) == TEMPLATE_DECL))
+ return val;
+ if (flags & (LOOKUP_PREFER_NAMESPACES | LOOKUP_PREFER_TYPES))
+ return NULL_TREE;
+ return val;
+}
+
+/* Look up NAME in the NAMESPACE. */
+
+tree
+lookup_namespace_name (tree namespace, tree name)
+{
+ tree val;
+ tree template_id = NULL_TREE;
+ cxx_binding binding;
+
+ timevar_push (TV_NAME_LOOKUP);
+ my_friendly_assert (TREE_CODE (namespace) == NAMESPACE_DECL, 370);
+
+ if (TREE_CODE (name) == NAMESPACE_DECL)
+ /* This happens for A::B<int> when B is a namespace. */
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, name);
+ else if (TREE_CODE (name) == TEMPLATE_DECL)
+ {
+ /* This happens for A::B where B is a template, and there are no
+ template arguments. */
+ error ("invalid use of `%D'", name);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, 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);
+
+ cxx_binding_clear (&binding);
+ if (!qualified_lookup_using_namespace (name, namespace, &binding, 0))
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+
+ if (binding.value)
+ {
+ val = binding.value;
+
+ 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,
+ tf_error | tf_warning);
+ 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);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, 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);
+
+ /* Ignore built-in functions that haven't been prototyped yet. */
+ if (!val || !DECL_P(val)
+ || !DECL_LANG_SPECIFIC(val)
+ || !DECL_ANTICIPATED (val))
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
+ }
+
+ error ("`%D' undeclared in namespace `%D'", name, namespace);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+}
+
+/* Select the right _DECL from multiple choices. */
+
+static tree
+select_decl (cxx_binding *binding, int flags)
+{
+ tree val;
+ val = binding->value;
+
+ timevar_push (TV_NAME_LOOKUP);
+ if (LOOKUP_NAMESPACES_ONLY (flags))
+ {
+ /* We are not interested in types. */
+ if (val && TREE_CODE (val) == NAMESPACE_DECL)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+ }
+
+ /* If looking for a type, or if there is no non-type binding, select
+ the value binding. */
+ if (binding->type && (!val || (flags & LOOKUP_PREFER_TYPES)))
+ val = binding->type;
+ /* Don't return non-types if we really prefer types. */
+ else if (val && LOOKUP_TYPES_ONLY (flags) && TREE_CODE (val) != TYPE_DECL
+ && (TREE_CODE (val) != TEMPLATE_DECL
+ || !DECL_CLASS_TEMPLATE_P (val)))
+ val = NULL_TREE;
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
+}
+
+/* Unscoped lookup of a global: iterate over current namespaces,
+ considering using-directives. */
+
+static tree
+unqualified_namespace_lookup (tree name, int flags)
+{
+ tree initial = current_decl_namespace ();
+ tree scope = initial;
+ tree siter;
+ struct cp_binding_level *level;
+ tree val = NULL_TREE;
+ cxx_binding binding;
+
+ timevar_push (TV_NAME_LOOKUP);
+ cxx_binding_clear (&binding);
+
+ for (; !val; scope = CP_DECL_CONTEXT (scope))
+ {
+ cxx_binding *b =
+ cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
+
+ if (b)
+ {
+ if (b->value && DECL_P (b->value)
+ && DECL_LANG_SPECIFIC (b->value)
+ && DECL_ANTICIPATED (b->value))
+ /* Ignore anticipated built-in functions. */
+ ;
+ else
+ binding.value = b->value;
+ binding.type = b->type;
+ }
+
+ /* Add all _DECLs seen through local using-directives. */
+ for (level = current_binding_level;
+ level->kind != sk_namespace;
+ level = level->level_chain)
+ if (!lookup_using_namespace (name, &binding, level->using_directives,
+ scope, flags))
+ /* Give up because of error. */
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+
+ /* Add all _DECLs seen through global using-directives. */
+ /* XXX local and global using lists should work equally. */
+ siter = initial;
+ while (1)
+ {
+ if (!lookup_using_namespace (name, &binding,
+ DECL_NAMESPACE_USING (siter),
+ scope, flags))
+ /* Give up because of error. */
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ if (siter == scope) break;
+ siter = CP_DECL_CONTEXT (siter);
+ }
+
+ val = select_decl (&binding, flags);
+ if (scope == global_namespace)
+ break;
+ }
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
+}
+
+/* Look up NAME (an IDENTIFIER_NODE) in SCOPE (either a NAMESPACE_DECL
+ or a class TYPE). If IS_TYPE_P is TRUE, then ignore non-type
+ bindings.
+
+ Returns a DECL (or OVERLOAD, or BASELINK) representing the
+ declaration found. If no suitable declaration can be found,
+ ERROR_MARK_NODE is returned. Iif COMPLAIN is true and SCOPE is
+ neither a class-type nor a namespace a diagnostic is issued. */
+
+tree
+lookup_qualified_name (tree scope, tree name, bool is_type_p, bool complain)
+{
+ int flags = 0;
+
+ if (TREE_CODE (scope) == NAMESPACE_DECL)
+ {
+ cxx_binding binding;
+
+ cxx_binding_clear (&binding);
+ flags |= LOOKUP_COMPLAIN;
+ if (is_type_p)
+ flags |= LOOKUP_PREFER_TYPES;
+ if (qualified_lookup_using_namespace (name, scope, &binding, flags))
+ return select_decl (&binding, flags);
+ }
+ else if (is_aggr_type (scope, complain))
+ {
+ tree t;
+ t = lookup_member (scope, name, 0, is_type_p);
+ if (t)
+ return t;
+ }
+
+ return error_mark_node;
+}
+
+/* Subroutine of unqualified_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 false on errors. */
+
+static bool
+lookup_using_namespace (tree name, cxx_binding *val, tree usings, tree scope,
+ int flags)
+{
+ tree iter;
+ timevar_push (TV_NAME_LOOKUP);
+ /* Iterate over all used namespaces in current, searching for using
+ directives of scope. */
+ for (iter = usings; iter; iter = TREE_CHAIN (iter))
+ if (TREE_VALUE (iter) == scope)
+ {
+ tree used = ORIGINAL_NAMESPACE (TREE_PURPOSE (iter));
+ cxx_binding *val1 =
+ cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (used), name);
+ /* Resolve ambiguities. */
+ if (val1)
+ val = ambiguous_decl (name, val, val1, flags);
+ }
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val->value != error_mark_node);
+}
+
+/* [namespace.qual]
+ Accepts the NAME to lookup and its qualifying SCOPE.
+ Returns the name/type pair found into the cxx_binding *RESULT,
+ or false on error. */
+
+static bool
+qualified_lookup_using_namespace (tree name, tree scope, cxx_binding *result,
+ int flags)
+{
+ /* Maintain a list of namespaces visited... */
+ tree seen = NULL_TREE;
+ /* ... and a list of namespace yet to see. */
+ tree todo = NULL_TREE;
+ tree todo_maybe = NULL_TREE;
+ tree usings;
+ timevar_push (TV_NAME_LOOKUP);
+ /* Look through namespace aliases. */
+ scope = ORIGINAL_NAMESPACE (scope);
+ while (scope && result->value != error_mark_node)
+ {
+ cxx_binding *binding =
+ cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
+ seen = tree_cons (scope, NULL_TREE, seen);
+ if (binding)
+ result = ambiguous_decl (name, result, binding, flags);
+
+ /* Consider strong using directives always, and non-strong ones
+ if we haven't found a binding yet. ??? Shouldn't we consider
+ non-strong ones if the initial RESULT is non-NULL, but the
+ binding in the given namespace is? */
+ for (usings = DECL_NAMESPACE_USING (scope); usings;
+ usings = TREE_CHAIN (usings))
+ /* If this was a real directive, and we have not seen it. */
+ if (!TREE_INDIRECT_USING (usings))
+ {
+ /* Try to avoid queuing the same namespace more than once,
+ the exception being when a namespace was already
+ enqueued for todo_maybe and then a strong using is
+ found for it. We could try to remove it from
+ todo_maybe, but it's probably not worth the effort. */
+ if (is_associated_namespace (scope, TREE_PURPOSE (usings))
+ && !purpose_member (TREE_PURPOSE (usings), seen)
+ && !purpose_member (TREE_PURPOSE (usings), todo))
+ todo = tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
+ else if ((!result->value && !result->type)
+ && !purpose_member (TREE_PURPOSE (usings), seen)
+ && !purpose_member (TREE_PURPOSE (usings), todo)
+ && !purpose_member (TREE_PURPOSE (usings), todo_maybe))
+ todo_maybe = tree_cons (TREE_PURPOSE (usings), NULL_TREE,
+ todo_maybe);
+ }
+ if (todo)
+ {
+ scope = TREE_PURPOSE (todo);
+ todo = TREE_CHAIN (todo);
+ }
+ else if (todo_maybe
+ && (!result->value && !result->type))
+ {
+ scope = TREE_PURPOSE (todo_maybe);
+ todo = TREE_CHAIN (todo_maybe);
+ todo_maybe = NULL_TREE;
+ }
+ else
+ scope = NULL_TREE; /* If there never was a todo list. */
+ }
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, result->value != error_mark_node);
+}
+
+/* Look up NAME in the current binding level and its superiors in the
+ namespace of variables, functions and typedefs. Return a ..._DECL
+ node of some kind representing its definition if there is only one
+ such declaration, or return a TREE_LIST with all the overloaded
+ definitions if there are many, or return 0 if it is undefined.
+
+ If PREFER_TYPE is > 0, we prefer TYPE_DECLs or namespaces.
+ If PREFER_TYPE is > 1, we reject non-type decls (e.g. namespaces).
+ Otherwise we prefer non-TYPE_DECLs.
+
+ If NONCLASS is nonzero, we don't look for the NAME in class scope,
+ using IDENTIFIER_CLASS_VALUE. */
+
+tree
+lookup_name_real (tree name, int prefer_type, int nonclass,
+ int namespaces_only, int flags)
+{
+ cxx_binding *iter;
+ tree val = NULL_TREE;
+
+ timevar_push (TV_NAME_LOOKUP);
+ /* Conversion operators are handled specially because ordinary
+ unqualified name lookup will not find template conversion
+ operators. */
+ if (IDENTIFIER_TYPENAME_P (name))
+ {
+ struct cp_binding_level *level;
+
+ for (level = current_binding_level;
+ level && level->kind != sk_namespace;
+ level = level->level_chain)
+ {
+ tree class_type;
+ tree operators;
+
+ /* A conversion operator can only be declared in a class
+ scope. */
+ if (level->kind != sk_class)
+ continue;
+
+ /* Lookup the conversion operator in the class. */
+ class_type = level->this_entity;
+ operators = lookup_fnfields (class_type, name, /*protect=*/0);
+ if (operators)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, operators);
+ }
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+ }
+
+ flags |= lookup_flags (prefer_type, namespaces_only);
+
+ /* First, look in non-namespace scopes. */
+
+ if (current_class_type == NULL_TREE)
+ nonclass = 1;
+
+ for (iter = IDENTIFIER_BINDING (name); iter; iter = iter->previous)
+ {
+ tree binding;
+
+ if (!LOCAL_BINDING_P (iter) && 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 (iter->value, flags))
+ binding = iter->value;
+ else if ((flags & LOOKUP_PREFER_TYPES)
+ && qualify_lookup (iter->type, flags))
+ binding = iter->type;
+ else
+ binding = NULL_TREE;
+
+ if (binding)
+ {
+ val = binding;
+ break;
+ }
+ }
+
+ /* Now lookup in namespace scopes. */
+ if (!val)
+ {
+ tree t = unqualified_namespace_lookup (name, flags);
+ if (t)
+ val = t;
+ }
+
+ if (val)
+ {
+ /* 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);
+ }
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
+}
+
+tree
+lookup_name_nonclass (tree name)
+{
+ return lookup_name_real (name, 0, 1, 0, LOOKUP_COMPLAIN);
+}
+
+tree
+lookup_function_nonclass (tree name, tree args)
+{
+ return lookup_arg_dependent (name, lookup_name_nonclass (name), args);
+}
+
+tree
+lookup_name (tree name, int prefer_type)
+{
+ return lookup_name_real (name, prefer_type, 0, 0, LOOKUP_COMPLAIN);
+}
+
+/* Similar to `lookup_name' but look only in the innermost non-class
+ binding level. */
+
+static tree
+lookup_name_current_level (tree name)
+{
+ struct cp_binding_level *b;
+ tree t = NULL_TREE;
+
+ timevar_push (TV_NAME_LOOKUP);
+ b = innermost_nonclass_level ();
+
+ if (b->kind == sk_namespace)
+ {
+ 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)
+ && LOCAL_BINDING_P (IDENTIFIER_BINDING (name)))
+ {
+ while (1)
+ {
+ if (IDENTIFIER_BINDING (name)->scope == b)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, IDENTIFIER_VALUE (name));
+
+ if (b->kind == sk_cleanup)
+ b = b->level_chain;
+ else
+ break;
+ }
+ }
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+}
+
+/* Like lookup_name_current_level, but for types. */
+
+static tree
+lookup_type_current_level (tree name)
+{
+ tree t = NULL_TREE;
+
+ timevar_push (TV_NAME_LOOKUP);
+ my_friendly_assert (current_binding_level->kind != sk_namespace,
+ 980716);
+
+ if (REAL_IDENTIFIER_TYPE_VALUE (name) != NULL_TREE
+ && REAL_IDENTIFIER_TYPE_VALUE (name) != global_type_node)
+ {
+ struct cp_binding_level *b = current_binding_level;
+ while (1)
+ {
+ if (purpose_member (name, b->type_shadowed))
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
+ REAL_IDENTIFIER_TYPE_VALUE (name));
+ if (b->kind == sk_cleanup)
+ b = b->level_chain;
+ else
+ break;
+ }
+ }
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+}
+
+/* [basic.lookup.koenig] */
+/* A nonzero return value in the functions below indicates an error. */
+
+struct arg_lookup
+{
+ tree name;
+ tree namespaces;
+ tree classes;
+ tree functions;
+};
+
+static bool arg_assoc (struct arg_lookup*, tree);
+static bool arg_assoc_args (struct arg_lookup*, tree);
+static bool arg_assoc_type (struct arg_lookup*, tree);
+static bool add_function (struct arg_lookup *, tree);
+static bool arg_assoc_namespace (struct arg_lookup *, tree);
+static bool arg_assoc_class (struct arg_lookup *, tree);
+static bool arg_assoc_template_arg (struct arg_lookup*, tree);
+
+/* Add a function to the lookup structure.
+ Returns true on error. */
+
+static bool
+add_function (struct arg_lookup *k, tree fn)
+{
+ /* 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)
+ k->functions = fn;
+ else if (fn == k->functions)
+ ;
+ else if (is_overloaded_fn (k->functions) && is_overloaded_fn (fn))
+ k->functions = build_overload (fn, k->functions);
+ 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 true;
+ }
+
+ return false;
+}
+
+/* Returns true iff CURRENT has declared itself to be an associated
+ namespace of SCOPE via a strong using-directive (or transitive chain
+ thereof). Both are namespaces. */
+
+bool
+is_associated_namespace (tree current, tree scope)
+{
+ tree seen = NULL_TREE;
+ tree todo = NULL_TREE;
+ tree t;
+ while (1)
+ {
+ if (scope == current)
+ return true;
+ seen = tree_cons (scope, NULL_TREE, seen);
+ for (t = DECL_NAMESPACE_ASSOCIATIONS (scope); t; t = TREE_CHAIN (t))
+ if (!purpose_member (TREE_PURPOSE (t), seen))
+ todo = tree_cons (TREE_PURPOSE (t), NULL_TREE, todo);
+ if (todo)
+ {
+ scope = TREE_PURPOSE (todo);
+ todo = TREE_CHAIN (todo);
+ }
+ else
+ return false;
+ }
+}
+
+/* Add functions of a namespace to the lookup structure.
+ Returns true on error. */
+
+static bool
+arg_assoc_namespace (struct arg_lookup *k, tree scope)
+{
+ tree value;
+
+ if (purpose_member (scope, k->namespaces))
+ return 0;
+ k->namespaces = tree_cons (scope, NULL_TREE, k->namespaces);
+
+ /* Check out our super-users. */
+ for (value = DECL_NAMESPACE_ASSOCIATIONS (scope); value;
+ value = TREE_CHAIN (value))
+ if (arg_assoc_namespace (k, TREE_PURPOSE (value)))
+ return true;
+
+ value = namespace_binding (k->name, scope);
+ if (!value)
+ return false;
+
+ for (; value; value = OVL_NEXT (value))
+ if (add_function (k, OVL_CURRENT (value)))
+ return true;
+
+ return false;
+}
+
+/* Adds everything associated with a template argument to the lookup
+ structure. Returns true on error. */
+
+static bool
+arg_assoc_template_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 false;
+ 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 false;
+}
+
+/* Adds everything associated with class to the lookup structure.
+ Returns true on error. */
+
+static bool
+arg_assoc_class (struct arg_lookup *k, tree 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 false;
+
+ if (purpose_member (type, k->classes))
+ return false;
+ k->classes = tree_cons (type, NULL_TREE, k->classes);
+
+ context = decl_namespace (TYPE_MAIN_DECL (type));
+ if (arg_assoc_namespace (k, context))
+ return true;
+
+ /* Process baseclasses. */
+ for (i = 0; i < CLASSTYPE_N_BASECLASSES (type); i++)
+ if (arg_assoc_class (k, TYPE_BINFO_BASETYPE (type, i)))
+ return true;
+
+ /* Process friends. */
+ for (list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type)); list;
+ list = TREE_CHAIN (list))
+ if (k->name == FRIEND_NAME (list))
+ for (friends = FRIEND_DECLS (list); friends;
+ friends = TREE_CHAIN (friends))
+ {
+ tree fn = TREE_VALUE (friends);
+
+ /* Only interested in global functions with potentially hidden
+ (i.e. unqualified) declarations. */
+ if (CP_DECL_CONTEXT (fn) != context)
+ continue;
+ /* Template specializations are never found by name lookup.
+ (Templates themselves can be found, but not template
+ specializations.) */
+ if (TREE_CODE (fn) == FUNCTION_DECL && DECL_USE_TEMPLATE (fn))
+ continue;
+ if (add_function (k, fn))
+ return true;
+ }
+
+ /* Process template arguments. */
+ if (CLASSTYPE_TEMPLATE_INFO (type))
+ {
+ 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 false;
+}
+
+/* Adds everything associated with a given type.
+ Returns 1 on error. */
+
+static bool
+arg_assoc_type (struct arg_lookup *k, tree type)
+{
+ /* As we do not get the type of non-type dependent expressions
+ right, we can end up with such things without a type. */
+ if (!type)
+ return false;
+
+ if (TYPE_PTRMEM_P (type))
+ {
+ /* Pointer to member: associate class type and value type. */
+ if (arg_assoc_type (k, TYPE_PTRMEM_CLASS_TYPE (type)))
+ return true;
+ return arg_assoc_type (k, TYPE_PTRMEM_POINTED_TO_TYPE (type));
+ }
+ else switch (TREE_CODE (type))
+ {
+ case ERROR_MARK:
+ return false;
+ case VOID_TYPE:
+ case INTEGER_TYPE:
+ case REAL_TYPE:
+ case COMPLEX_TYPE:
+ case VECTOR_TYPE:
+ case CHAR_TYPE:
+ case BOOLEAN_TYPE:
+ return false;
+ case RECORD_TYPE:
+ if (TYPE_PTRMEMFUNC_P (type))
+ return arg_assoc_type (k, TYPE_PTRMEMFUNC_FN_TYPE (type));
+ return arg_assoc_class (k, type);
+ case POINTER_TYPE:
+ case REFERENCE_TYPE:
+ case ARRAY_TYPE:
+ return arg_assoc_type (k, TREE_TYPE (type));
+ case UNION_TYPE:
+ case ENUMERAL_TYPE:
+ return arg_assoc_namespace (k, decl_namespace (TYPE_MAIN_DECL (type)));
+ case METHOD_TYPE:
+ /* The basetype is referenced in the first arg type, so just
+ fall through. */
+ case FUNCTION_TYPE:
+ /* Associate the parameter types. */
+ if (arg_assoc_args (k, TYPE_ARG_TYPES (type)))
+ return true;
+ /* Associate the return type. */
+ return arg_assoc_type (k, TREE_TYPE (type));
+ case TEMPLATE_TYPE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ return false;
+ case TYPENAME_TYPE:
+ return false;
+ case LANG_TYPE:
+ if (type == unknown_type_node)
+ return false;
+ /* else fall through */
+ default:
+ abort ();
+ }
+ return false;
+}
+
+/* Adds everything associated with arguments. Returns true on error. */
+
+static bool
+arg_assoc_args (struct arg_lookup *k, tree args)
+{
+ for (; args; args = TREE_CHAIN (args))
+ if (arg_assoc (k, TREE_VALUE (args)))
+ return true;
+ return false;
+}
+
+/* Adds everything associated with a given tree_node. Returns 1 on error. */
+
+static bool
+arg_assoc (struct arg_lookup *k, tree n)
+{
+ if (n == error_mark_node)
+ return false;
+
+ if (TYPE_P (n))
+ return arg_assoc_type (k, n);
+
+ if (! type_unknown_p (n))
+ return arg_assoc_type (k, TREE_TYPE (n));
+
+ if (TREE_CODE (n) == ADDR_EXPR)
+ n = TREE_OPERAND (n, 0);
+ if (TREE_CODE (n) == COMPONENT_REF)
+ n = TREE_OPERAND (n, 1);
+ if (TREE_CODE (n) == OFFSET_REF)
+ n = TREE_OPERAND (n, 1);
+ while (TREE_CODE (n) == TREE_LIST)
+ n = TREE_VALUE (n);
+ if (TREE_CODE (n) == BASELINK)
+ n = BASELINK_FUNCTIONS (n);
+
+ if (TREE_CODE (n) == FUNCTION_DECL)
+ return arg_assoc_type (k, TREE_TYPE (n));
+ if (TREE_CODE (n) == TEMPLATE_ID_EXPR)
+ {
+ /* [basic.lookup.koenig]
+
+ 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... */
+ tree template = TREE_OPERAND (n, 0);
+ tree args = TREE_OPERAND (n, 1);
+ tree ctx;
+ int ix;
+
+ 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
+ namespace. */
+ template = OVL_CURRENT (template);
+
+ ctx = CP_DECL_CONTEXT (template);
+
+ if (TREE_CODE (ctx) == NAMESPACE_DECL)
+ {
+ if (arg_assoc_namespace (k, ctx) == 1)
+ return true;
+ }
+ /* It must be a member template. */
+ else if (arg_assoc_class (k, ctx) == 1)
+ return true;
+
+ /* Now the arguments. */
+ for (ix = TREE_VEC_LENGTH (args); ix--;)
+ if (arg_assoc_template_arg (k, TREE_VEC_ELT (args, ix)) == 1)
+ return true;
+ }
+ else if (TREE_CODE (n) == OVERLOAD)
+ {
+ for (; n; n = OVL_CHAIN (n))
+ if (arg_assoc_type (k, TREE_TYPE (OVL_FUNCTION (n))))
+ return true;
+ }
+
+ return false;
+}
+
+/* Performs Koenig lookup depending on arguments, where fns
+ are the functions found in normal lookup. */
+
+tree
+lookup_arg_dependent (tree name, tree fns, tree args)
+{
+ struct arg_lookup k;
+ tree fn = NULL_TREE;
+
+ timevar_push (TV_NAME_LOOKUP);
+ k.name = name;
+ k.functions = fns;
+ k.classes = NULL_TREE;
+
+ /* We've already looked at some namespaces during normal unqualified
+ lookup -- but we don't know exactly which ones. If the functions
+ we found were brought into the current namespace via a using
+ declaration, we have not really checked the namespace from which
+ they came. Therefore, we check all namespaces here -- unless the
+ function we have is from the current namespace. Even then, we
+ must check all namespaces if the function is a local
+ declaration; any other declarations present at namespace scope
+ should be visible during argument-dependent lookup. */
+ if (fns)
+ fn = OVL_CURRENT (fns);
+ if (fn && TREE_CODE (fn) == FUNCTION_DECL
+ && (CP_DECL_CONTEXT (fn) != current_decl_namespace ()
+ || DECL_LOCAL_FUNCTION_P (fn)))
+ k.namespaces = NULL_TREE;
+ else
+ /* Setting NAMESPACES is purely an optimization; it prevents
+ adding functions which are already in FNS. Adding them would
+ be safe -- "joust" will eliminate the duplicates -- but
+ wasteful. */
+ k.namespaces = build_tree_list (current_decl_namespace (), NULL_TREE);
+
+ arg_assoc_args (&k, args);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, k.functions);
+}
+
+/* Add namespace to using_directives. Return NULL_TREE if nothing was
+ changed (i.e. there was already a directive), or the fresh
+ TREE_LIST otherwise. */
+
+static tree
+push_using_directive (tree used)
+{
+ tree ud = current_binding_level->using_directives;
+ tree iter, ancestor;
+
+ timevar_push (TV_NAME_LOOKUP);
+ /* Check if we already have this. */
+ if (purpose_member (used, ud) != NULL_TREE)
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+
+ ancestor = namespace_ancestor (current_decl_namespace (), used);
+ ud = current_binding_level->using_directives;
+ ud = tree_cons (used, ancestor, ud);
+ current_binding_level->using_directives = ud;
+
+ /* Recursively add all namespaces used. */
+ for (iter = DECL_NAMESPACE_USING (used); iter; iter = TREE_CHAIN (iter))
+ push_using_directive (TREE_PURPOSE (iter));
+
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ud);
+}
+
+/* The type TYPE is being declared. If it is a class template, or a
+ specialization of a class template, do any processing required and
+ perform error-checking. If IS_FRIEND is nonzero, this TYPE is
+ being declared a friend. B is the binding level at which this TYPE
+ should be bound.
+
+ Returns the TYPE_DECL for TYPE, which may have been altered by this
+ processing. */
+
+static tree
+maybe_process_template_type_declaration (tree type, int globalize,
+ cxx_scope *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
+ {
+ maybe_check_template_type (type);
+
+ my_friendly_assert (IS_AGGR_TYPE (type)
+ || TREE_CODE (type) == ENUMERAL_TYPE, 0);
+
+
+ if (processing_template_decl)
+ {
+ /* This may change after the call to
+ push_template_decl_real, but we want the original value. */
+ tree name = DECL_NAME (decl);
+
+ decl = push_template_decl_real (decl, globalize);
+ /* If the current binding level is the binding level for the
+ template parameters (see the comment in
+ begin_template_parm_list) and the enclosing level is a class
+ scope, and we're not looking at a friend, push the
+ declaration of the member class into the class scope. In the
+ friend case, push_template_decl will already have put the
+ friend into global scope, if appropriate. */
+ if (TREE_CODE (type) != ENUMERAL_TYPE
+ && !globalize && b->kind == sk_template_parms
+ && b->level_chain->kind == sk_class)
+ {
+ finish_member_declaration (CLASSTYPE_TI_TEMPLATE (type));
+ /* Put this UDT in the table of UDTs for the class, since
+ that won't happen below because B is not the class
+ binding level, but is instead the pseudo-global level. */
+ if (b->level_chain->type_decls == NULL)
+ b->level_chain->type_decls =
+ binding_table_new (SCOPE_DEFAULT_HT_SIZE);
+ binding_table_insert (b->level_chain->type_decls, name, type);
+ if (!COMPLETE_TYPE_P (current_class_type))
+ {
+ maybe_add_class_template_decl_list (current_class_type,
+ type, /*friend_p=*/0);
+ CLASSTYPE_NESTED_UTDS (current_class_type) =
+ b->level_chain->type_decls;
+ }
+ }
+ }
+ }
+
+ return decl;
+}
+
+/* Push a tag name NAME for struct/class/union/enum type TYPE.
+ Normally put it into the inner-most non-sk_cleanup scope,
+ but if GLOBALIZE is true, put it in the inner-most non-class scope.
+ The latter is needed for implicit declarations. */
+
+void
+pushtag (tree name, tree type, int globalize)
+{
+ struct cp_binding_level *b;
+
+ timevar_push (TV_NAME_LOOKUP);
+ b = current_binding_level;
+ while (/* Cleanup scopes are not scopes from the point of view of
+ the language. */
+ b->kind == sk_cleanup
+ /* Neither are the scopes used to hold template parameters
+ for an explicit specialization. For an ordinary template
+ declaration, these scopes are not scopes from the point of
+ view of the language -- but we need a place to stash
+ things that will go in the containing namespace when the
+ template is instantiated. */
+ || (b->kind == sk_template_parms && b->explicit_spec_p)
+ || (b->kind == sk_class
+ && (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_entity))))
+ b = b->level_chain;
+
+ if (b->type_decls == NULL)
+ b->type_decls = binding_table_new (SCOPE_DEFAULT_HT_SIZE);
+ binding_table_insert (b->type_decls, name, type);
+
+ if (name)
+ {
+ /* Do C++ gratuitous typedefing. */
+ if (IDENTIFIER_TYPE_VALUE (name) != type)
+ {
+ tree d = NULL_TREE;
+ int in_class = 0;
+ tree context = TYPE_CONTEXT (type);
+
+ if (! context)
+ {
+ tree cs = current_scope ();
+
+ if (! globalize)
+ context = cs;
+ 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 = decl_function_context (get_type_decl (cs));
+ }
+ if (!context)
+ context = current_namespace;
+
+ if (b->kind == sk_class
+ || (b->kind == sk_template_parms
+ && b->level_chain->kind == sk_class))
+ in_class = 1;
+
+ if (current_lang_name == lang_name_java)
+ TYPE_FOR_JAVA (type) = 1;
+
+ d = create_implicit_typedef (name, type);
+ DECL_CONTEXT (d) = FROB_CONTEXT (context);
+ if (! in_class)
+ set_identifier_type_value_with_scope (name, d, b);
+
+ d = maybe_process_template_type_declaration (type,
+ globalize, b);
+
+ if (b->kind == sk_class)
+ {
+ 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
+ is done later. */
+ finish_member_declaration (d);
+ else
+ pushdecl_class_level (d);
+ }
+ else
+ d = pushdecl_with_scope (d, b);
+
+ /* 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->kind == sk_class
+ && !COMPLETE_TYPE_P (current_class_type))
+ {
+ maybe_add_class_template_decl_list (current_class_type,
+ type, /*friend_p=*/0);
+ CLASSTYPE_NESTED_UTDS (current_class_type) = b->type_decls;
+ }
+ }
+
+ if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
+ /* Use the canonical TYPE_DECL for this node. */
+ TYPE_STUB_DECL (type) = TYPE_NAME (type);
+ else
+ {
+ /* Create a fake NULL-named TYPE_DECL node whose TREE_TYPE
+ will be the tagged type we just added to the current
+ binding level. This fake NULL-named TYPE_DECL node helps
+ dwarfout.c to know when it needs to output a
+ representation of a tagged type, and it also gives us a
+ convenient place to record the "scope start" address for
+ the tagged type. */
+
+ tree d = build_decl (TYPE_DECL, NULL_TREE, type);
+ TYPE_STUB_DECL (type) = pushdecl_with_scope (d, b);
+ }
+ timevar_pop (TV_NAME_LOOKUP);
+}
+
+/* Allocate storage for saving a C++ binding. */
+#define cxx_saved_binding_make() \
+ (ggc_alloc (sizeof (cxx_saved_binding)))
+
+struct cxx_saved_binding GTY(())
+{
+ /* Link that chains saved C++ bindings for a given name into a stack. */
+ cxx_saved_binding *previous;
+ /* The name of the current binding. */
+ tree identifier;
+ /* The binding we're saving. */
+ cxx_binding *binding;
+ tree class_value;
+ tree real_type_value;
+};
+
+/* 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 *scope_chain;
+
+static cxx_saved_binding *
+store_bindings (tree names, cxx_saved_binding *old_bindings)
+{
+ tree t;
+ cxx_saved_binding *search_bindings = old_bindings;
+
+ timevar_push (TV_NAME_LOOKUP);
+ for (t = names; t; t = TREE_CHAIN (t))
+ {
+ tree id;
+ cxx_saved_binding *saved;
+ cxx_saved_binding *t1;
+
+ if (TREE_CODE (t) == TREE_LIST)
+ id = TREE_PURPOSE (t);
+ else
+ id = DECL_NAME (t);
+
+ 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 = search_bindings; t1; t1 = t1->previous)
+ if (t1->identifier == id)
+ goto skip_it;
+
+ my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135);
+ saved = cxx_saved_binding_make ();
+ saved->previous = old_bindings;
+ saved->identifier = id;
+ saved->binding = IDENTIFIER_BINDING (id);
+ saved->class_value = IDENTIFIER_CLASS_VALUE (id);;
+ saved->real_type_value = REAL_IDENTIFIER_TYPE_VALUE (id);
+ IDENTIFIER_BINDING (id) = NULL;
+ IDENTIFIER_CLASS_VALUE (id) = NULL_TREE;
+ old_bindings = saved;
+ skip_it:
+ ;
+ }
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old_bindings);
+}
+
+void
+push_to_top_level (void)
+{
+ struct saved_scope *s;
+ struct cp_binding_level *b;
+ cxx_saved_binding *old_bindings;
+ int need_pop;
+
+ timevar_push (TV_NAME_LOOKUP);
+ s = ggc_alloc_cleared (sizeof (struct saved_scope));
+
+ 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;
+ if (scope_chain && previous_class_type)
+ old_bindings = store_bindings (previous_class_values, old_bindings);
+
+ /* Have to include the global scope, because class-scope decls
+ aren't listed anywhere useful. */
+ for (; b; b = b->level_chain)
+ {
+ tree t;
+
+ /* Template IDs are inserted into the global level. If they were
+ 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 (global_scope_p (b))
+ break;
+
+ old_bindings = store_bindings (b->names, old_bindings);
+ /* We also need to check class_shadowed to save class-level type
+ bindings, since pushclass doesn't fill in b->names. */
+ if (b->kind == sk_class)
+ old_bindings = store_bindings (b->class_shadowed, old_bindings);
+
+ /* Unwind type-value slots back to top level. */
+ for (t = b->type_shadowed; t; t = TREE_CHAIN (t))
+ SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t));
+ }
+ 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;
+
+ scope_chain = s;
+ current_function_decl = NULL_TREE;
+ VARRAY_TREE_INIT (current_lang_base, 10, "current_lang_base");
+ current_lang_name = lang_name_cplusplus;
+ current_namespace = global_namespace;
+ timevar_pop (TV_NAME_LOOKUP);
+}
+
+void
+pop_from_top_level (void)
+{
+ struct saved_scope *s = scope_chain;
+ cxx_saved_binding *saved;
+
+ timevar_push (TV_NAME_LOOKUP);
+ /* Clear out class-level bindings cache. */
+ if (previous_class_type)
+ invalidate_class_lookup_cache ();
+
+ current_lang_base = 0;
+
+ scope_chain = s->prev;
+ for (saved = s->old_bindings; saved; saved = saved->previous)
+ {
+ tree id = saved->identifier;
+
+ IDENTIFIER_BINDING (id) = saved->binding;
+ IDENTIFIER_CLASS_VALUE (id) = saved->class_value;
+ SET_IDENTIFIER_TYPE_VALUE (id, saved->real_type_value);
+ }
+
+ /* 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;
+ timevar_pop (TV_NAME_LOOKUP);
+}
+
+/* Pop off extraneous binding levels left over due to syntax errors.
+
+ We don't pop past namespaces, as they might be valid. */
+
+void
+pop_everything (void)
+{
+ if (ENABLE_SCOPE_CHECKING)
+ verbatim ("XXX entering pop_everything ()\n");
+ while (!toplevel_bindings_p ())
+ {
+ if (current_binding_level->kind == sk_class)
+ pop_nested_class ();
+ else
+ poplevel (0, 0, 0);
+ }
+ if (ENABLE_SCOPE_CHECKING)
+ verbatim ("XXX leaving pop_everything ()\n");
+}
+
+#include "gt-cp-name-lookup.h"
diff --git a/contrib/gcc/cp/name-lookup.h b/contrib/gcc/cp/name-lookup.h
new file mode 100644
index 0000000..8377575
--- /dev/null
+++ b/contrib/gcc/cp/name-lookup.h
@@ -0,0 +1,335 @@
+/* Declarations for C++ name lookup routines.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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 GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef GCC_CP_NAME_LOOKUP_H
+#define GCC_CP_NAME_LOOKUP_H
+
+#include "c-common.h"
+
+/* The type of dictionary used to map names to types declared at
+ a given scope. */
+typedef struct binding_table_s *binding_table;
+typedef struct binding_entry_s *binding_entry;
+
+/* The type of a routine repeatedly called by binding_table_foreach. */
+typedef void (*bt_foreach_proc) (binding_entry, void *);
+
+struct binding_entry_s GTY(())
+{
+ binding_entry chain;
+ tree name;
+ tree type;
+};
+
+/* These macros indicate the initial chains count for binding_table. */
+#define SCOPE_DEFAULT_HT_SIZE (1 << 3)
+#define CLASS_SCOPE_HT_SIZE (1 << 3)
+#define NAMESPACE_ORDINARY_HT_SIZE (1 << 5)
+#define NAMESPACE_STD_HT_SIZE (1 << 8)
+#define GLOBAL_SCOPE_HT_SIZE (1 << 8)
+
+extern void binding_table_remove_anonymous_types (binding_table);
+extern void binding_table_foreach (binding_table, bt_foreach_proc, void *);
+extern binding_entry binding_table_find (binding_table, tree);
+extern void cxx_remember_type_decls (binding_table);
+
+/* Datatype used to temporarily save C++ bindings (for implicit
+ instantiations purposes and like). Implemented in decl.c. */
+typedef struct cxx_saved_binding cxx_saved_binding;
+
+/* Datatype that represents binding established by a declaration between
+ a name and a C++ entity. */
+typedef struct cxx_binding cxx_binding;
+
+/* The datatype used to implement C++ scope. */
+typedef struct cp_binding_level cxx_scope;
+
+/* Nonzero if this binding is for a local scope, as opposed to a class
+ or namespace scope. */
+#define LOCAL_BINDING_P(NODE) ((NODE)->is_local)
+
+/* True if NODE->value is from a base class of the class which is
+ currently being defined. */
+#define INHERITED_VALUE_BINDING_P(NODE) ((NODE)->value_is_inherited)
+
+struct cxx_binding GTY(())
+{
+ /* Link to chain together various bindings for this name. */
+ cxx_binding *previous;
+ /* The non-type entity this name is bound to. */
+ tree value;
+ /* The type entity this name is bound to. */
+ tree type;
+ /* The scope at which this binding was made. */
+ cxx_scope *scope;
+ unsigned value_is_inherited : 1;
+ unsigned is_local : 1;
+};
+
+extern tree identifier_type_value (tree);
+extern void set_identifier_type_value (tree, tree);
+extern void pop_binding (tree, tree);
+extern void clear_identifier_class_values (void);
+extern tree constructor_name_full (tree);
+extern tree constructor_name (tree);
+extern bool constructor_name_p (tree, tree);
+
+/* The kinds of scopes we recognize. */
+typedef enum scope_kind {
+ sk_block = 0, /* An ordinary block scope. This enumerator must
+ have the value zero because "cp_binding_level"
+ is initialized by using "memset" to set the
+ contents to zero, and the default scope kind
+ is "sk_block". */
+ sk_cleanup, /* A scope for (pseudo-)scope for cleanup. It is
+ peusdo in that it is transparent to name lookup
+ activities. */
+ sk_try, /* A try-block. */
+ sk_catch, /* A catch-block. */
+ sk_for, /* The scope of the variable declared in a
+ for-init-statement. */
+ sk_function_parms, /* The scope containing function parameters. */
+ sk_class, /* The scope containing the members of a class. */
+ sk_namespace, /* The scope containing the members of a
+ namespace, including the global scope. */
+ sk_template_parms, /* A scope for template parameters. */
+ sk_template_spec /* Like sk_template_parms, but for an explicit
+ specialization. Since, by definition, an
+ explicit specialization is introduced by
+ "template <>", this scope is always empty. */
+} scope_kind;
+
+/* For each binding contour we allocate a binding_level structure
+ which records the names defined in that contour.
+ Contours include:
+ 0) the global one
+ 1) one for each function definition,
+ where internal declarations of the parameters appear.
+ 2) one for each compound statement,
+ to record its declarations.
+
+ The current meaning of a name can be found by searching the levels
+ from the current one out to the global one.
+
+ Off to the side, may be the class_binding_level. This exists only
+ to catch class-local declarations. It is otherwise nonexistent.
+
+ Also there may be binding levels that catch cleanups that must be
+ run when exceptions occur. Thus, to see whether a name is bound in
+ the current scope, it is not enough to look in the
+ CURRENT_BINDING_LEVEL. You should use lookup_name_current_level
+ instead. */
+
+/* Note that the information in the `names' component of the global contour
+ is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */
+
+struct cp_binding_level GTY(())
+ {
+ /* A chain of _DECL nodes for all variables, constants, functions,
+ and typedef types. These are in the reverse of the order
+ supplied. There may be OVERLOADs on this list, too, but they
+ are wrapped in TREE_LISTs; the TREE_VALUE is the OVERLOAD. */
+ tree names;
+
+ /* Count of elements in names chain. */
+ size_t names_size;
+
+ /* A chain of NAMESPACE_DECL nodes. */
+ tree namespaces;
+
+ /* An array of static functions and variables (for namespaces only) */
+ varray_type static_decls;
+
+ /* A chain of VTABLE_DECL nodes. */
+ tree vtables;
+
+ /* A dictionary for looking up user-defined-types. */
+ binding_table type_decls;
+
+ /* A list of USING_DECL nodes. */
+ tree usings;
+
+ /* A list of used namespaces. PURPOSE is the namespace,
+ VALUE the common ancestor with this binding_level's namespace. */
+ tree using_directives;
+
+ /* 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_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. 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 entity (namespace, class, function) the scope of which this
+ binding contour corresponds to. Otherwise NULL. */
+ tree this_entity;
+
+ /* The binding level which this one is contained in (inherits from). */
+ struct cp_binding_level *level_chain;
+
+ /* List of VAR_DECLS saved from a previous for statement.
+ 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;
+
+ /* Binding depth at which this level began. */
+ int binding_depth;
+
+ /* The kind of scope that this object represents. However, a
+ SK_TEMPLATE_SPEC scope is represented with KIND set to
+ SK_TEMPALTE_PARMS and EXPLICIT_SPEC_P set to true. */
+ ENUM_BITFIELD (scope_kind) kind : 4;
+
+ /* True if this scope is an SK_TEMPLATE_SPEC scope. This field is
+ only valid if KIND == SK_TEMPLATE_PARMS. */
+ BOOL_BITFIELD explicit_spec_p : 1;
+
+ /* true means make a BLOCK for this level regardless of all else. */
+ unsigned keep : 1;
+
+ /* Nonzero if this level can safely have additional
+ cleanup-needing variables added to it. */
+ unsigned more_cleanups_ok : 1;
+ unsigned have_cleanups : 1;
+
+ /* 22 bits left to fill a 32-bit word. */
+ };
+
+/* The binding level currently in effect. */
+
+#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. */
+
+#define class_binding_level scope_chain->class_bindings
+
+/* The tree node representing the global scope. */
+extern GTY(()) tree global_namespace;
+extern GTY(()) tree global_scope_name;
+
+/* Indicates that there is a type value in some namespace, although
+ that is not necessarily in scope at the moment. */
+
+extern GTY(()) tree global_type_node;
+
+/* True if SCOPE designates the global scope binding contour. */
+#define global_scope_p(SCOPE) \
+ ((SCOPE) == NAMESPACE_LEVEL (global_namespace))
+
+extern cxx_scope *leave_scope (void);
+extern bool kept_level_p (void);
+extern int global_bindings_p (void);
+extern bool toplevel_bindings_p (void);
+extern bool namespace_bindings_p (void);
+extern bool template_parm_scope_p (void);
+extern scope_kind innermost_scope_kind (void);
+extern cxx_scope *begin_scope (scope_kind, tree);
+extern void print_binding_stack (void);
+extern void print_binding_level (cxx_scope *);
+extern void push_to_top_level (void);
+extern void pop_from_top_level (void);
+extern void pop_everything (void);
+extern void keep_next_level (bool);
+extern bool is_ancestor (tree, tree);
+extern bool push_scope (tree);
+extern void pop_scope (tree);
+
+extern void push_namespace (tree);
+extern void pop_namespace (void);
+extern void push_nested_namespace (tree);
+extern void pop_nested_namespace (tree);
+extern void pushlevel_class (void);
+extern void poplevel_class (void);
+extern tree pushdecl_with_scope (tree, cxx_scope *);
+extern tree lookup_tag (enum tree_code, tree, cxx_scope *, int);
+extern tree lookup_tag_reverse (tree, tree);
+extern tree lookup_name (tree, int);
+extern tree lookup_name_real (tree, int, int, int, int);
+extern tree namespace_binding (tree, tree);
+extern void set_namespace_binding (tree, tree, tree);
+extern tree lookup_namespace_name (tree, tree);
+extern tree lookup_qualified_name (tree, tree, bool, bool);
+extern tree lookup_name_nonclass (tree);
+extern tree lookup_function_nonclass (tree, tree);
+extern int push_class_binding (tree, tree);
+extern bool pushdecl_class_level (tree);
+extern tree pushdecl_namespace_level (tree);
+extern bool push_class_level_binding (tree, tree);
+extern void storetags (tree);
+extern tree getdecls (void);
+extern tree cp_namespace_decls (tree);
+extern void set_class_shadows (tree);
+extern void set_decl_namespace (tree, tree, bool);
+extern tree current_decl_namespace (void);
+extern void push_decl_namespace (tree);
+extern void pop_decl_namespace (void);
+extern void do_namespace_alias (tree, tree);
+extern void do_toplevel_using_decl (tree, tree, tree);
+extern void do_local_using_decl (tree, tree, tree);
+extern tree do_class_using_decl (tree);
+extern void do_using_directive (tree);
+extern tree lookup_arg_dependent (tree, tree, tree);
+extern bool is_associated_namespace (tree, tree);
+extern void parse_using_directive (tree, tree);
+
+
+/* Set *DECL to the (non-hidden) declaration for ID at global scope,
+ if present and return true; otherwise return false. */
+
+static inline bool
+get_global_value_if_present (tree id, tree *decl)
+{
+ tree global_value = namespace_binding (id, global_namespace);
+
+ if (global_value)
+ *decl = global_value;
+ return global_value != NULL;
+}
+
+/* True is the binding of IDENTIFIER at global scope names a type. */
+
+static inline bool
+is_typename_at_global_scope (tree id)
+{
+ tree global_value = namespace_binding (id, global_namespace);
+
+ return global_value && TREE_CODE (global_value) == TYPE_DECL;
+}
+
+#endif /* GCC_CP_NAME_LOOKUP_H */
diff --git a/contrib/gcc/cp/operators.def b/contrib/gcc/cp/operators.def
index 42e4a47..16e603d 100644
--- a/contrib/gcc/cp/operators.def
+++ b/contrib/gcc/cp/operators.def
@@ -3,24 +3,24 @@
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>
+ Written by Mark Mitchell <mark@codesourcery.com>
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -93,8 +93,10 @@ 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. */
+/* These are extensions. */
DEF_SIMPLE_OPERATOR ("alignof", ALIGNOF_EXPR, "v17alignof", 1)
+DEF_SIMPLE_OPERATOR ("__imag__", IMAGPART_EXPR, "v18__imag__", 1)
+DEF_SIMPLE_OPERATOR ("__real__", REALPART_EXPR, "v18__real__", 1)
/* The cast operator. */
DEF_SIMPLE_OPERATOR ("", TYPE_EXPR, "cv", 1)
@@ -131,7 +133,7 @@ DEF_SIMPLE_OPERATOR ("--", POSTDECREMENT_EXPR, "mm", 2)
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);
+DEF_SIMPLE_OPERATOR ("::", SCOPE_REF, "sr", 2)
/* Assignment operators. */
DEF_ASSN_OPERATOR ("=", NOP_EXPR, "aS", 2)
@@ -146,8 +148,8 @@ DEF_ASSN_OPERATOR ("^=", BIT_XOR_EXPR, "eO", 2)
DEF_ASSN_OPERATOR ("<<=", LSHIFT_EXPR, "lS", 2)
DEF_ASSN_OPERATOR (">>=", RSHIFT_EXPR, "rS", 2)
/* These operators are GNU extensions. */
-DEF_ASSN_OPERATOR ("<?=", MIN_EXPR, "v23miN", 2);
-DEF_ASSN_OPERATOR (">?=", MAX_EXPR, "v23maX", 2);
+DEF_ASSN_OPERATOR ("<?=", MIN_EXPR, "v23miN", 2)
+DEF_ASSN_OPERATOR (">?=", MAX_EXPR, "v23maX", 2)
/* Ternary operators. */
DEF_SIMPLE_OPERATOR ("?:", COND_EXPR, "qu", 3)
diff --git a/contrib/gcc/cp/optimize.c b/contrib/gcc/cp/optimize.c
index 654d4cd..5ada131 100644
--- a/contrib/gcc/cp/optimize.c
+++ b/contrib/gcc/cp/optimize.c
@@ -1,26 +1,29 @@
/* Perform optimizations on tree structure.
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
+ Free Software Foundation, Inc.
Written by Mark Michell (mark@codesourcery.com).
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify it
+GCC 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
+GCC 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
+along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "rtl.h"
@@ -29,7 +32,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "integrate.h"
#include "toplev.h"
#include "varray.h"
-#include "ggc.h"
#include "params.h"
#include "hashtab.h"
#include "debug.h"
@@ -37,29 +39,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* 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));
+static tree calls_setjmp_r (tree *, int *, void *);
+static void update_cloned_parm (tree, tree);
+static void dump_function (enum tree_dump_index, tree);
/* Optimize the body of FN. */
void
-optimize_function (fn)
- tree fn;
+optimize_function (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
@@ -68,23 +58,17 @@ optimize_function (fn)
&& !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;
+calls_setjmp_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
{
/* We're only interested in FUNCTION_DECLS. */
if (TREE_CODE (*tp) != FUNCTION_DECL)
@@ -98,9 +82,8 @@ calls_setjmp_r (tp, walk_subtrees, data)
occasionally return a nonzero value even when FN does not actually
call `setjmp'. */
-int
-calls_setjmp_p (fn)
- tree fn;
+bool
+calls_setjmp_p (tree fn)
{
return walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
calls_setjmp_r,
@@ -113,9 +96,7 @@ calls_setjmp_p (fn)
debugging generation code will be able to find the original PARM. */
static void
-update_cloned_parm (parm, cloned_parm)
- tree parm;
- tree cloned_parm;
+update_cloned_parm (tree parm, tree cloned_parm)
{
DECL_ABSTRACT_ORIGIN (cloned_parm) = parm;
@@ -136,12 +117,10 @@ update_cloned_parm (parm, cloned_parm)
necessary. Returns nonzero if there's no longer any need to
process the main body. */
-int
-maybe_clone_body (fn)
- tree fn;
+bool
+maybe_clone_body (tree fn)
{
tree clone;
- int first = 1;
/* We only clone constructors and destructors. */
if (!DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
@@ -155,7 +134,7 @@ maybe_clone_body (fn)
list. */
for (clone = TREE_CHAIN (fn);
clone && DECL_CLONED_FUNCTION_P (clone);
- clone = TREE_CHAIN (clone), first = 0)
+ clone = TREE_CHAIN (clone))
{
tree parm;
tree clone_parm;
@@ -165,7 +144,6 @@ maybe_clone_body (fn)
/* Update CLONE's source position information to match FN's. */
DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn);
DECL_INLINE (clone) = DECL_INLINE (fn);
- DID_INLINE_FUNC (clone) = DID_INLINE_FUNC (fn);
DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn);
DECL_COMDAT (clone) = DECL_COMDAT (fn);
DECL_WEAK (clone) = DECL_WEAK (fn);
@@ -176,6 +154,7 @@ maybe_clone_body (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);
+ DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn);
/* Adjust the parameter names and locations. */
parm = DECL_ARGUMENTS (fn);
@@ -192,13 +171,8 @@ maybe_clone_body (fn)
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;
- }
+ /* Update this parameter. */
+ update_cloned_parm (parm, clone_parm);
/* Start processing the function. */
push_to_top_level ();
@@ -258,10 +232,6 @@ maybe_clone_body (fn)
/* 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);
@@ -271,7 +241,7 @@ maybe_clone_body (fn)
/* Now, expand this function into RTL, if appropriate. */
finish_function (0);
BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone)) = DECL_INITIAL (fn);
- expand_body (clone);
+ expand_or_defer_fn (clone);
pop_from_top_level ();
}
@@ -282,9 +252,7 @@ maybe_clone_body (fn)
/* Dump FUNCTION_DECL FN as tree dump PHASE. */
static void
-dump_function (phase, fn)
- enum tree_dump_index phase;
- tree fn;
+dump_function (enum tree_dump_index phase, tree fn)
{
FILE *stream;
int flags;
@@ -296,7 +264,7 @@ dump_function (phase, fn)
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, ";; enabled by -fdump-%s\n", dump_flag_name (phase));
fprintf (stream, "\n");
dump_node (fn, TDF_SLIM | flags, stream);
diff --git a/contrib/gcc/cp/parser.c b/contrib/gcc/cp/parser.c
new file mode 100644
index 0000000..344a8f5
--- /dev/null
+++ b/contrib/gcc/cp/parser.c
@@ -0,0 +1,15323 @@
+/* C++ Parser.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Written by Mark Mitchell <mark@codesourcery.com>.
+
+ This file is part of GCC.
+
+ GCC 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.
+
+ GCC 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 GCC; 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 "coretypes.h"
+#include "tm.h"
+#include "dyn-string.h"
+#include "varray.h"
+#include "cpplib.h"
+#include "tree.h"
+#include "cp-tree.h"
+#include "c-pragma.h"
+#include "decl.h"
+#include "flags.h"
+#include "diagnostic.h"
+#include "toplev.h"
+#include "output.h"
+
+
+/* The lexer. */
+
+/* Overview
+ --------
+
+ A cp_lexer represents a stream of cp_tokens. It allows arbitrary
+ look-ahead.
+
+ Methodology
+ -----------
+
+ We use a circular buffer to store incoming tokens.
+
+ Some artifacts of the C++ language (such as the
+ expression/declaration ambiguity) require arbitrary look-ahead.
+ The strategy we adopt for dealing with these problems is to attempt
+ to parse one construct (e.g., the declaration) and fall back to the
+ other (e.g., the expression) if that attempt does not succeed.
+ Therefore, we must sometimes store an arbitrary number of tokens.
+
+ The parser routinely peeks at the next token, and then consumes it
+ later. That also requires a buffer in which to store the tokens.
+
+ In order to easily permit adding tokens to the end of the buffer,
+ while removing them from the beginning of the buffer, we use a
+ circular buffer. */
+
+/* A C++ token. */
+
+typedef struct cp_token GTY (())
+{
+ /* The kind of token. */
+ ENUM_BITFIELD (cpp_ttype) type : 8;
+ /* If this token is a keyword, this value indicates which keyword.
+ Otherwise, this value is RID_MAX. */
+ ENUM_BITFIELD (rid) keyword : 8;
+ /* Token flags. */
+ unsigned char flags;
+ /* The value associated with this token, if any. */
+ tree value;
+ /* The location at which this token was found. */
+ location_t location;
+} cp_token;
+
+/* The number of tokens in a single token block.
+ Computed so that cp_token_block fits in a 512B allocation unit. */
+
+#define CP_TOKEN_BLOCK_NUM_TOKENS ((512 - 3*sizeof (char*))/sizeof (cp_token))
+
+/* A group of tokens. These groups are chained together to store
+ large numbers of tokens. (For example, a token block is created
+ when the body of an inline member function is first encountered;
+ the tokens are processed later after the class definition is
+ complete.)
+
+ This somewhat ungainly data structure (as opposed to, say, a
+ variable-length array), is used due to constraints imposed by the
+ current garbage-collection methodology. If it is made more
+ flexible, we could perhaps simplify the data structures involved. */
+
+typedef struct cp_token_block GTY (())
+{
+ /* The tokens. */
+ cp_token tokens[CP_TOKEN_BLOCK_NUM_TOKENS];
+ /* The number of tokens in this block. */
+ size_t num_tokens;
+ /* The next token block in the chain. */
+ struct cp_token_block *next;
+ /* The previous block in the chain. */
+ struct cp_token_block *prev;
+} cp_token_block;
+
+typedef struct cp_token_cache GTY (())
+{
+ /* The first block in the cache. NULL if there are no tokens in the
+ cache. */
+ cp_token_block *first;
+ /* The last block in the cache. NULL If there are no tokens in the
+ cache. */
+ cp_token_block *last;
+} cp_token_cache;
+
+/* Prototypes. */
+
+static cp_token_cache *cp_token_cache_new
+ (void);
+static void cp_token_cache_push_token
+ (cp_token_cache *, cp_token *);
+
+/* Create a new cp_token_cache. */
+
+static cp_token_cache *
+cp_token_cache_new (void)
+{
+ return ggc_alloc_cleared (sizeof (cp_token_cache));
+}
+
+/* Add *TOKEN to *CACHE. */
+
+static void
+cp_token_cache_push_token (cp_token_cache *cache,
+ cp_token *token)
+{
+ cp_token_block *b = cache->last;
+
+ /* See if we need to allocate a new token block. */
+ if (!b || b->num_tokens == CP_TOKEN_BLOCK_NUM_TOKENS)
+ {
+ b = ggc_alloc_cleared (sizeof (cp_token_block));
+ b->prev = cache->last;
+ if (cache->last)
+ {
+ cache->last->next = b;
+ cache->last = b;
+ }
+ else
+ cache->first = cache->last = b;
+ }
+ /* Add this token to the current token block. */
+ b->tokens[b->num_tokens++] = *token;
+}
+
+/* The cp_lexer structure represents the C++ lexer. It is responsible
+ for managing the token stream from the preprocessor and supplying
+ it to the parser. */
+
+typedef struct cp_lexer GTY (())
+{
+ /* The memory allocated for the buffer. Never NULL. */
+ cp_token * GTY ((length ("(%h.buffer_end - %h.buffer)"))) buffer;
+ /* A pointer just past the end of the memory allocated for the buffer. */
+ cp_token * GTY ((skip (""))) buffer_end;
+ /* The first valid token in the buffer, or NULL if none. */
+ cp_token * GTY ((skip (""))) first_token;
+ /* The next available token. If NEXT_TOKEN is NULL, then there are
+ no more available tokens. */
+ cp_token * GTY ((skip (""))) next_token;
+ /* A pointer just past the last available token. If FIRST_TOKEN is
+ NULL, however, there are no available tokens, and then this
+ location is simply the place in which the next token read will be
+ placed. If LAST_TOKEN == FIRST_TOKEN, then the buffer is full.
+ When the LAST_TOKEN == BUFFER, then the last token is at the
+ highest memory address in the BUFFER. */
+ cp_token * GTY ((skip (""))) last_token;
+
+ /* A stack indicating positions at which cp_lexer_save_tokens was
+ called. The top entry is the most recent position at which we
+ began saving tokens. The entries are differences in token
+ position between FIRST_TOKEN and the first saved token.
+
+ If the stack is non-empty, we are saving tokens. When a token is
+ consumed, the NEXT_TOKEN pointer will move, but the FIRST_TOKEN
+ pointer will not. The token stream will be preserved so that it
+ can be reexamined later.
+
+ If the stack is empty, then we are not saving tokens. Whenever a
+ token is consumed, the FIRST_TOKEN pointer will be moved, and the
+ consumed token will be gone forever. */
+ varray_type saved_tokens;
+
+ /* The STRING_CST tokens encountered while processing the current
+ string literal. */
+ varray_type string_tokens;
+
+ /* True if we should obtain more tokens from the preprocessor; false
+ if we are processing a saved token cache. */
+ bool main_lexer_p;
+
+ /* True if we should output debugging information. */
+ bool debugging_p;
+
+ /* The next lexer in a linked list of lexers. */
+ struct cp_lexer *next;
+} cp_lexer;
+
+/* Prototypes. */
+
+static cp_lexer *cp_lexer_new_main
+ (void);
+static cp_lexer *cp_lexer_new_from_tokens
+ (struct cp_token_cache *);
+static int cp_lexer_saving_tokens
+ (const cp_lexer *);
+static cp_token *cp_lexer_next_token
+ (cp_lexer *, cp_token *);
+static cp_token *cp_lexer_prev_token
+ (cp_lexer *, cp_token *);
+static ptrdiff_t cp_lexer_token_difference
+ (cp_lexer *, cp_token *, cp_token *);
+static cp_token *cp_lexer_read_token
+ (cp_lexer *);
+static void cp_lexer_maybe_grow_buffer
+ (cp_lexer *);
+static void cp_lexer_get_preprocessor_token
+ (cp_lexer *, cp_token *);
+static cp_token *cp_lexer_peek_token
+ (cp_lexer *);
+static cp_token *cp_lexer_peek_nth_token
+ (cp_lexer *, size_t);
+static inline bool cp_lexer_next_token_is
+ (cp_lexer *, enum cpp_ttype);
+static bool cp_lexer_next_token_is_not
+ (cp_lexer *, enum cpp_ttype);
+static bool cp_lexer_next_token_is_keyword
+ (cp_lexer *, enum rid);
+static cp_token *cp_lexer_consume_token
+ (cp_lexer *);
+static void cp_lexer_purge_token
+ (cp_lexer *);
+static void cp_lexer_purge_tokens_after
+ (cp_lexer *, cp_token *);
+static void cp_lexer_save_tokens
+ (cp_lexer *);
+static void cp_lexer_commit_tokens
+ (cp_lexer *);
+static void cp_lexer_rollback_tokens
+ (cp_lexer *);
+static inline void cp_lexer_set_source_position_from_token
+ (cp_lexer *, const cp_token *);
+static void cp_lexer_print_token
+ (FILE *, cp_token *);
+static inline bool cp_lexer_debugging_p
+ (cp_lexer *);
+static void cp_lexer_start_debugging
+ (cp_lexer *) ATTRIBUTE_UNUSED;
+static void cp_lexer_stop_debugging
+ (cp_lexer *) ATTRIBUTE_UNUSED;
+
+/* Manifest constants. */
+
+#define CP_TOKEN_BUFFER_SIZE 5
+#define CP_SAVED_TOKENS_SIZE 5
+
+/* A token type for keywords, as opposed to ordinary identifiers. */
+#define CPP_KEYWORD ((enum cpp_ttype) (N_TTYPES + 1))
+
+/* A token type for template-ids. If a template-id is processed while
+ parsing tentatively, it is replaced with a CPP_TEMPLATE_ID token;
+ the value of the CPP_TEMPLATE_ID is whatever was returned by
+ cp_parser_template_id. */
+#define CPP_TEMPLATE_ID ((enum cpp_ttype) (CPP_KEYWORD + 1))
+
+/* A token type for nested-name-specifiers. If a
+ nested-name-specifier is processed while parsing tentatively, it is
+ replaced with a CPP_NESTED_NAME_SPECIFIER token; the value of the
+ CPP_NESTED_NAME_SPECIFIER is whatever was returned by
+ cp_parser_nested_name_specifier_opt. */
+#define CPP_NESTED_NAME_SPECIFIER ((enum cpp_ttype) (CPP_TEMPLATE_ID + 1))
+
+/* A token type for tokens that are not tokens at all; these are used
+ to mark the end of a token block. */
+#define CPP_NONE (CPP_NESTED_NAME_SPECIFIER + 1)
+
+/* Variables. */
+
+/* The stream to which debugging output should be written. */
+static FILE *cp_lexer_debug_stream;
+
+/* Create a new main C++ lexer, the lexer that gets tokens from the
+ preprocessor. */
+
+static cp_lexer *
+cp_lexer_new_main (void)
+{
+ cp_lexer *lexer;
+ cp_token first_token;
+
+ /* It's possible that lexing the first token will load a PCH file,
+ which is a GC collection point. So we have to grab the first
+ token before allocating any memory. */
+ cp_lexer_get_preprocessor_token (NULL, &first_token);
+ c_common_no_more_pch ();
+
+ /* Allocate the memory. */
+ lexer = ggc_alloc_cleared (sizeof (cp_lexer));
+
+ /* Create the circular buffer. */
+ lexer->buffer = ggc_calloc (CP_TOKEN_BUFFER_SIZE, sizeof (cp_token));
+ lexer->buffer_end = lexer->buffer + CP_TOKEN_BUFFER_SIZE;
+
+ /* There is one token in the buffer. */
+ lexer->last_token = lexer->buffer + 1;
+ lexer->first_token = lexer->buffer;
+ lexer->next_token = lexer->buffer;
+ memcpy (lexer->buffer, &first_token, sizeof (cp_token));
+
+ /* This lexer obtains more tokens by calling c_lex. */
+ lexer->main_lexer_p = true;
+
+ /* Create the SAVED_TOKENS stack. */
+ VARRAY_INT_INIT (lexer->saved_tokens, CP_SAVED_TOKENS_SIZE, "saved_tokens");
+
+ /* Create the STRINGS array. */
+ VARRAY_TREE_INIT (lexer->string_tokens, 32, "strings");
+
+ /* Assume we are not debugging. */
+ lexer->debugging_p = false;
+
+ return lexer;
+}
+
+/* Create a new lexer whose token stream is primed with the TOKENS.
+ When these tokens are exhausted, no new tokens will be read. */
+
+static cp_lexer *
+cp_lexer_new_from_tokens (cp_token_cache *tokens)
+{
+ cp_lexer *lexer;
+ cp_token *token;
+ cp_token_block *block;
+ ptrdiff_t num_tokens;
+
+ /* Allocate the memory. */
+ lexer = ggc_alloc_cleared (sizeof (cp_lexer));
+
+ /* Create a new buffer, appropriately sized. */
+ num_tokens = 0;
+ for (block = tokens->first; block != NULL; block = block->next)
+ num_tokens += block->num_tokens;
+ lexer->buffer = ggc_alloc (num_tokens * sizeof (cp_token));
+ lexer->buffer_end = lexer->buffer + num_tokens;
+
+ /* Install the tokens. */
+ token = lexer->buffer;
+ for (block = tokens->first; block != NULL; block = block->next)
+ {
+ memcpy (token, block->tokens, block->num_tokens * sizeof (cp_token));
+ token += block->num_tokens;
+ }
+
+ /* The FIRST_TOKEN is the beginning of the buffer. */
+ lexer->first_token = lexer->buffer;
+ /* The next available token is also at the beginning of the buffer. */
+ lexer->next_token = lexer->buffer;
+ /* The buffer is full. */
+ lexer->last_token = lexer->first_token;
+
+ /* This lexer doesn't obtain more tokens. */
+ lexer->main_lexer_p = false;
+
+ /* Create the SAVED_TOKENS stack. */
+ VARRAY_INT_INIT (lexer->saved_tokens, CP_SAVED_TOKENS_SIZE, "saved_tokens");
+
+ /* Create the STRINGS array. */
+ VARRAY_TREE_INIT (lexer->string_tokens, 32, "strings");
+
+ /* Assume we are not debugging. */
+ lexer->debugging_p = false;
+
+ return lexer;
+}
+
+/* Returns nonzero if debugging information should be output. */
+
+static inline bool
+cp_lexer_debugging_p (cp_lexer *lexer)
+{
+ return lexer->debugging_p;
+}
+
+/* Set the current source position from the information stored in
+ TOKEN. */
+
+static inline void
+cp_lexer_set_source_position_from_token (cp_lexer *lexer ATTRIBUTE_UNUSED ,
+ const cp_token *token)
+{
+ /* Ideally, the source position information would not be a global
+ variable, but it is. */
+
+ /* Update the line number. */
+ if (token->type != CPP_EOF)
+ input_location = token->location;
+}
+
+/* TOKEN points into the circular token buffer. Return a pointer to
+ the next token in the buffer. */
+
+static inline cp_token *
+cp_lexer_next_token (cp_lexer* lexer, cp_token* token)
+{
+ token++;
+ if (token == lexer->buffer_end)
+ token = lexer->buffer;
+ return token;
+}
+
+/* TOKEN points into the circular token buffer. Return a pointer to
+ the previous token in the buffer. */
+
+static inline cp_token *
+cp_lexer_prev_token (cp_lexer* lexer, cp_token* token)
+{
+ if (token == lexer->buffer)
+ token = lexer->buffer_end;
+ return token - 1;
+}
+
+/* nonzero if we are presently saving tokens. */
+
+static int
+cp_lexer_saving_tokens (const cp_lexer* lexer)
+{
+ return VARRAY_ACTIVE_SIZE (lexer->saved_tokens) != 0;
+}
+
+/* Return a pointer to the token that is N tokens beyond TOKEN in the
+ buffer. */
+
+static cp_token *
+cp_lexer_advance_token (cp_lexer *lexer, cp_token *token, ptrdiff_t n)
+{
+ token += n;
+ if (token >= lexer->buffer_end)
+ token = lexer->buffer + (token - lexer->buffer_end);
+ return token;
+}
+
+/* Returns the number of times that START would have to be incremented
+ to reach FINISH. If START and FINISH are the same, returns zero. */
+
+static ptrdiff_t
+cp_lexer_token_difference (cp_lexer* lexer, cp_token* start, cp_token* finish)
+{
+ if (finish >= start)
+ return finish - start;
+ else
+ return ((lexer->buffer_end - lexer->buffer)
+ - (start - finish));
+}
+
+/* Obtain another token from the C preprocessor and add it to the
+ token buffer. Returns the newly read token. */
+
+static cp_token *
+cp_lexer_read_token (cp_lexer* lexer)
+{
+ cp_token *token;
+
+ /* Make sure there is room in the buffer. */
+ cp_lexer_maybe_grow_buffer (lexer);
+
+ /* If there weren't any tokens, then this one will be the first. */
+ if (!lexer->first_token)
+ lexer->first_token = lexer->last_token;
+ /* Similarly, if there were no available tokens, there is one now. */
+ if (!lexer->next_token)
+ lexer->next_token = lexer->last_token;
+
+ /* Figure out where we're going to store the new token. */
+ token = lexer->last_token;
+
+ /* Get a new token from the preprocessor. */
+ cp_lexer_get_preprocessor_token (lexer, token);
+
+ /* Increment LAST_TOKEN. */
+ lexer->last_token = cp_lexer_next_token (lexer, token);
+
+ /* Strings should have type `const char []'. Right now, we will
+ have an ARRAY_TYPE that is constant rather than an array of
+ constant elements.
+ FIXME: Make fix_string_type get this right in the first place. */
+ if ((token->type == CPP_STRING || token->type == CPP_WSTRING)
+ && flag_const_strings)
+ {
+ tree type;
+
+ /* Get the current type. It will be an ARRAY_TYPE. */
+ type = TREE_TYPE (token->value);
+ /* Use build_cplus_array_type to rebuild the array, thereby
+ getting the right type. */
+ type = build_cplus_array_type (TREE_TYPE (type), TYPE_DOMAIN (type));
+ /* Reset the type of the token. */
+ TREE_TYPE (token->value) = type;
+ }
+
+ return token;
+}
+
+/* If the circular buffer is full, make it bigger. */
+
+static void
+cp_lexer_maybe_grow_buffer (cp_lexer* lexer)
+{
+ /* If the buffer is full, enlarge it. */
+ if (lexer->last_token == lexer->first_token)
+ {
+ cp_token *new_buffer;
+ cp_token *old_buffer;
+ cp_token *new_first_token;
+ ptrdiff_t buffer_length;
+ size_t num_tokens_to_copy;
+
+ /* Remember the current buffer pointer. It will become invalid,
+ but we will need to do pointer arithmetic involving this
+ value. */
+ old_buffer = lexer->buffer;
+ /* Compute the current buffer size. */
+ buffer_length = lexer->buffer_end - lexer->buffer;
+ /* Allocate a buffer twice as big. */
+ new_buffer = ggc_realloc (lexer->buffer,
+ 2 * buffer_length * sizeof (cp_token));
+
+ /* Because the buffer is circular, logically consecutive tokens
+ are not necessarily placed consecutively in memory.
+ Therefore, we must keep move the tokens that were before
+ FIRST_TOKEN to the second half of the newly allocated
+ buffer. */
+ num_tokens_to_copy = (lexer->first_token - old_buffer);
+ memcpy (new_buffer + buffer_length,
+ new_buffer,
+ num_tokens_to_copy * sizeof (cp_token));
+ /* Clear the rest of the buffer. We never look at this storage,
+ but the garbage collector may. */
+ memset (new_buffer + buffer_length + num_tokens_to_copy, 0,
+ (buffer_length - num_tokens_to_copy) * sizeof (cp_token));
+
+ /* Now recompute all of the buffer pointers. */
+ new_first_token
+ = new_buffer + (lexer->first_token - old_buffer);
+ if (lexer->next_token != NULL)
+ {
+ ptrdiff_t next_token_delta;
+
+ if (lexer->next_token > lexer->first_token)
+ next_token_delta = lexer->next_token - lexer->first_token;
+ else
+ next_token_delta =
+ buffer_length - (lexer->first_token - lexer->next_token);
+ lexer->next_token = new_first_token + next_token_delta;
+ }
+ lexer->last_token = new_first_token + buffer_length;
+ lexer->buffer = new_buffer;
+ lexer->buffer_end = new_buffer + buffer_length * 2;
+ lexer->first_token = new_first_token;
+ }
+}
+
+/* Store the next token from the preprocessor in *TOKEN. */
+
+static void
+cp_lexer_get_preprocessor_token (cp_lexer *lexer ATTRIBUTE_UNUSED ,
+ cp_token *token)
+{
+ bool done;
+
+ /* If this not the main lexer, return a terminating CPP_EOF token. */
+ if (lexer != NULL && !lexer->main_lexer_p)
+ {
+ token->type = CPP_EOF;
+ token->location.line = 0;
+ token->location.file = NULL;
+ token->value = NULL_TREE;
+ token->keyword = RID_MAX;
+
+ return;
+ }
+
+ done = false;
+ /* Keep going until we get a token we like. */
+ while (!done)
+ {
+ /* Get a new token from the preprocessor. */
+ token->type = c_lex_with_flags (&token->value, &token->flags);
+ /* Issue messages about tokens we cannot process. */
+ switch (token->type)
+ {
+ case CPP_ATSIGN:
+ case CPP_HASH:
+ case CPP_PASTE:
+ error ("invalid token");
+ break;
+
+ default:
+ /* This is a good token, so we exit the loop. */
+ done = true;
+ break;
+ }
+ }
+ /* Now we've got our token. */
+ token->location = input_location;
+
+ /* Check to see if this token is a keyword. */
+ if (token->type == CPP_NAME
+ && C_IS_RESERVED_WORD (token->value))
+ {
+ /* Mark this token as a keyword. */
+ token->type = CPP_KEYWORD;
+ /* Record which keyword. */
+ token->keyword = C_RID_CODE (token->value);
+ /* Update the value. Some keywords are mapped to particular
+ entities, rather than simply having the value of the
+ corresponding IDENTIFIER_NODE. For example, `__const' is
+ mapped to `const'. */
+ token->value = ridpointers[token->keyword];
+ }
+ else
+ token->keyword = RID_MAX;
+}
+
+/* Return a pointer to the next token in the token stream, but do not
+ consume it. */
+
+static cp_token *
+cp_lexer_peek_token (cp_lexer* lexer)
+{
+ cp_token *token;
+
+ /* If there are no tokens, read one now. */
+ if (!lexer->next_token)
+ cp_lexer_read_token (lexer);
+
+ /* Provide debugging output. */
+ if (cp_lexer_debugging_p (lexer))
+ {
+ fprintf (cp_lexer_debug_stream, "cp_lexer: peeking at token: ");
+ cp_lexer_print_token (cp_lexer_debug_stream, lexer->next_token);
+ fprintf (cp_lexer_debug_stream, "\n");
+ }
+
+ token = lexer->next_token;
+ cp_lexer_set_source_position_from_token (lexer, token);
+ return token;
+}
+
+/* Return true if the next token has the indicated TYPE. */
+
+static bool
+cp_lexer_next_token_is (cp_lexer* lexer, enum cpp_ttype type)
+{
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (lexer);
+ /* Check to see if it has the indicated TYPE. */
+ return token->type == type;
+}
+
+/* Return true if the next token does not have the indicated TYPE. */
+
+static bool
+cp_lexer_next_token_is_not (cp_lexer* lexer, enum cpp_ttype type)
+{
+ return !cp_lexer_next_token_is (lexer, type);
+}
+
+/* Return true if the next token is the indicated KEYWORD. */
+
+static bool
+cp_lexer_next_token_is_keyword (cp_lexer* lexer, enum rid keyword)
+{
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (lexer);
+ /* Check to see if it is the indicated keyword. */
+ return token->keyword == keyword;
+}
+
+/* Return a pointer to the Nth token in the token stream. If N is 1,
+ then this is precisely equivalent to cp_lexer_peek_token. */
+
+static cp_token *
+cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n)
+{
+ cp_token *token;
+
+ /* N is 1-based, not zero-based. */
+ my_friendly_assert (n > 0, 20000224);
+
+ /* Skip ahead from NEXT_TOKEN, reading more tokens as necessary. */
+ token = lexer->next_token;
+ /* If there are no tokens in the buffer, get one now. */
+ if (!token)
+ {
+ cp_lexer_read_token (lexer);
+ token = lexer->next_token;
+ }
+
+ /* Now, read tokens until we have enough. */
+ while (--n > 0)
+ {
+ /* Advance to the next token. */
+ token = cp_lexer_next_token (lexer, token);
+ /* If that's all the tokens we have, read a new one. */
+ if (token == lexer->last_token)
+ token = cp_lexer_read_token (lexer);
+ }
+
+ return token;
+}
+
+/* Consume the next token. The pointer returned is valid only until
+ another token is read. Callers should preserve copy the token
+ explicitly if they will need its value for a longer period of
+ time. */
+
+static cp_token *
+cp_lexer_consume_token (cp_lexer* lexer)
+{
+ cp_token *token;
+
+ /* If there are no tokens, read one now. */
+ if (!lexer->next_token)
+ cp_lexer_read_token (lexer);
+
+ /* Remember the token we'll be returning. */
+ token = lexer->next_token;
+
+ /* Increment NEXT_TOKEN. */
+ lexer->next_token = cp_lexer_next_token (lexer,
+ lexer->next_token);
+ /* Check to see if we're all out of tokens. */
+ if (lexer->next_token == lexer->last_token)
+ lexer->next_token = NULL;
+
+ /* If we're not saving tokens, then move FIRST_TOKEN too. */
+ if (!cp_lexer_saving_tokens (lexer))
+ {
+ /* If there are no tokens available, set FIRST_TOKEN to NULL. */
+ if (!lexer->next_token)
+ lexer->first_token = NULL;
+ else
+ lexer->first_token = lexer->next_token;
+ }
+
+ /* Provide debugging output. */
+ if (cp_lexer_debugging_p (lexer))
+ {
+ fprintf (cp_lexer_debug_stream, "cp_lexer: consuming token: ");
+ cp_lexer_print_token (cp_lexer_debug_stream, token);
+ fprintf (cp_lexer_debug_stream, "\n");
+ }
+
+ return token;
+}
+
+/* Permanently remove the next token from the token stream. There
+ must be a valid next token already; this token never reads
+ additional tokens from the preprocessor. */
+
+static void
+cp_lexer_purge_token (cp_lexer *lexer)
+{
+ cp_token *token;
+ cp_token *next_token;
+
+ token = lexer->next_token;
+ while (true)
+ {
+ next_token = cp_lexer_next_token (lexer, token);
+ if (next_token == lexer->last_token)
+ break;
+ *token = *next_token;
+ token = next_token;
+ }
+
+ lexer->last_token = token;
+ /* The token purged may have been the only token remaining; if so,
+ clear NEXT_TOKEN. */
+ if (lexer->next_token == token)
+ lexer->next_token = NULL;
+}
+
+/* Permanently remove all tokens after TOKEN, up to, but not
+ including, the token that will be returned next by
+ cp_lexer_peek_token. */
+
+static void
+cp_lexer_purge_tokens_after (cp_lexer *lexer, cp_token *token)
+{
+ cp_token *peek;
+ cp_token *t1;
+ cp_token *t2;
+
+ if (lexer->next_token)
+ {
+ /* Copy the tokens that have not yet been read to the location
+ immediately following TOKEN. */
+ t1 = cp_lexer_next_token (lexer, token);
+ t2 = peek = cp_lexer_peek_token (lexer);
+ /* Move tokens into the vacant area between TOKEN and PEEK. */
+ while (t2 != lexer->last_token)
+ {
+ *t1 = *t2;
+ t1 = cp_lexer_next_token (lexer, t1);
+ t2 = cp_lexer_next_token (lexer, t2);
+ }
+ /* Now, the next available token is right after TOKEN. */
+ lexer->next_token = cp_lexer_next_token (lexer, token);
+ /* And the last token is wherever we ended up. */
+ lexer->last_token = t1;
+ }
+ else
+ {
+ /* There are no tokens in the buffer, so there is nothing to
+ copy. The last token in the buffer is TOKEN itself. */
+ lexer->last_token = cp_lexer_next_token (lexer, token);
+ }
+}
+
+/* Begin saving tokens. All tokens consumed after this point will be
+ preserved. */
+
+static void
+cp_lexer_save_tokens (cp_lexer* lexer)
+{
+ /* Provide debugging output. */
+ if (cp_lexer_debugging_p (lexer))
+ fprintf (cp_lexer_debug_stream, "cp_lexer: saving tokens\n");
+
+ /* Make sure that LEXER->NEXT_TOKEN is non-NULL so that we can
+ restore the tokens if required. */
+ if (!lexer->next_token)
+ cp_lexer_read_token (lexer);
+
+ VARRAY_PUSH_INT (lexer->saved_tokens,
+ cp_lexer_token_difference (lexer,
+ lexer->first_token,
+ lexer->next_token));
+}
+
+/* Commit to the portion of the token stream most recently saved. */
+
+static void
+cp_lexer_commit_tokens (cp_lexer* lexer)
+{
+ /* Provide debugging output. */
+ if (cp_lexer_debugging_p (lexer))
+ fprintf (cp_lexer_debug_stream, "cp_lexer: committing tokens\n");
+
+ VARRAY_POP (lexer->saved_tokens);
+}
+
+/* Return all tokens saved since the last call to cp_lexer_save_tokens
+ to the token stream. Stop saving tokens. */
+
+static void
+cp_lexer_rollback_tokens (cp_lexer* lexer)
+{
+ size_t delta;
+
+ /* Provide debugging output. */
+ if (cp_lexer_debugging_p (lexer))
+ fprintf (cp_lexer_debug_stream, "cp_lexer: restoring tokens\n");
+
+ /* Find the token that was the NEXT_TOKEN when we started saving
+ tokens. */
+ delta = VARRAY_TOP_INT(lexer->saved_tokens);
+ /* Make it the next token again now. */
+ lexer->next_token = cp_lexer_advance_token (lexer,
+ lexer->first_token,
+ delta);
+ /* It might be the case that there were no tokens when we started
+ saving tokens, but that there are some tokens now. */
+ if (!lexer->next_token && lexer->first_token)
+ lexer->next_token = lexer->first_token;
+
+ /* Stop saving tokens. */
+ VARRAY_POP (lexer->saved_tokens);
+}
+
+/* Print a representation of the TOKEN on the STREAM. */
+
+static void
+cp_lexer_print_token (FILE * stream, cp_token* token)
+{
+ const char *token_type = NULL;
+
+ /* Figure out what kind of token this is. */
+ switch (token->type)
+ {
+ case CPP_EQ:
+ token_type = "EQ";
+ break;
+
+ case CPP_COMMA:
+ token_type = "COMMA";
+ break;
+
+ case CPP_OPEN_PAREN:
+ token_type = "OPEN_PAREN";
+ break;
+
+ case CPP_CLOSE_PAREN:
+ token_type = "CLOSE_PAREN";
+ break;
+
+ case CPP_OPEN_BRACE:
+ token_type = "OPEN_BRACE";
+ break;
+
+ case CPP_CLOSE_BRACE:
+ token_type = "CLOSE_BRACE";
+ break;
+
+ case CPP_SEMICOLON:
+ token_type = "SEMICOLON";
+ break;
+
+ case CPP_NAME:
+ token_type = "NAME";
+ break;
+
+ case CPP_EOF:
+ token_type = "EOF";
+ break;
+
+ case CPP_KEYWORD:
+ token_type = "keyword";
+ break;
+
+ /* This is not a token that we know how to handle yet. */
+ default:
+ break;
+ }
+
+ /* If we have a name for the token, print it out. Otherwise, we
+ simply give the numeric code. */
+ if (token_type)
+ fprintf (stream, "%s", token_type);
+ else
+ fprintf (stream, "%d", token->type);
+ /* And, for an identifier, print the identifier name. */
+ if (token->type == CPP_NAME
+ /* Some keywords have a value that is not an IDENTIFIER_NODE.
+ For example, `struct' is mapped to an INTEGER_CST. */
+ || (token->type == CPP_KEYWORD
+ && TREE_CODE (token->value) == IDENTIFIER_NODE))
+ fprintf (stream, " %s", IDENTIFIER_POINTER (token->value));
+}
+
+/* Start emitting debugging information. */
+
+static void
+cp_lexer_start_debugging (cp_lexer* lexer)
+{
+ ++lexer->debugging_p;
+}
+
+/* Stop emitting debugging information. */
+
+static void
+cp_lexer_stop_debugging (cp_lexer* lexer)
+{
+ --lexer->debugging_p;
+}
+
+
+/* The parser. */
+
+/* Overview
+ --------
+
+ A cp_parser parses the token stream as specified by the C++
+ grammar. Its job is purely parsing, not semantic analysis. For
+ example, the parser breaks the token stream into declarators,
+ expressions, statements, and other similar syntactic constructs.
+ It does not check that the types of the expressions on either side
+ of an assignment-statement are compatible, or that a function is
+ not declared with a parameter of type `void'.
+
+ The parser invokes routines elsewhere in the compiler to perform
+ semantic analysis and to build up the abstract syntax tree for the
+ code processed.
+
+ The parser (and the template instantiation code, which is, in a
+ way, a close relative of parsing) are the only parts of the
+ compiler that should be calling push_scope and pop_scope, or
+ related functions. The parser (and template instantiation code)
+ keeps track of what scope is presently active; everything else
+ should simply honor that. (The code that generates static
+ initializers may also need to set the scope, in order to check
+ access control correctly when emitting the initializers.)
+
+ Methodology
+ -----------
+
+ The parser is of the standard recursive-descent variety. Upcoming
+ tokens in the token stream are examined in order to determine which
+ production to use when parsing a non-terminal. Some C++ constructs
+ require arbitrary look ahead to disambiguate. For example, it is
+ impossible, in the general case, to tell whether a statement is an
+ expression or declaration without scanning the entire statement.
+ Therefore, the parser is capable of "parsing tentatively." When the
+ parser is not sure what construct comes next, it enters this mode.
+ Then, while we attempt to parse the construct, the parser queues up
+ error messages, rather than issuing them immediately, and saves the
+ tokens it consumes. If the construct is parsed successfully, the
+ parser "commits", i.e., it issues any queued error messages and
+ the tokens that were being preserved are permanently discarded.
+ If, however, the construct is not parsed successfully, the parser
+ rolls back its state completely so that it can resume parsing using
+ a different alternative.
+
+ Future Improvements
+ -------------------
+
+ The performance of the parser could probably be improved
+ substantially. Some possible improvements include:
+
+ - The expression parser recurses through the various levels of
+ precedence as specified in the grammar, rather than using an
+ operator-precedence technique. Therefore, parsing a simple
+ identifier requires multiple recursive calls.
+
+ - We could often eliminate the need to parse tentatively by
+ looking ahead a little bit. In some places, this approach
+ might not entirely eliminate the need to parse tentatively, but
+ it might still speed up the average case. */
+
+/* Flags that are passed to some parsing functions. These values can
+ be bitwise-ored together. */
+
+typedef enum cp_parser_flags
+{
+ /* No flags. */
+ CP_PARSER_FLAGS_NONE = 0x0,
+ /* The construct is optional. If it is not present, then no error
+ should be issued. */
+ CP_PARSER_FLAGS_OPTIONAL = 0x1,
+ /* When parsing a type-specifier, do not allow user-defined types. */
+ CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES = 0x2
+} cp_parser_flags;
+
+/* The different kinds of declarators we want to parse. */
+
+typedef enum cp_parser_declarator_kind
+{
+ /* We want an abstract declartor. */
+ CP_PARSER_DECLARATOR_ABSTRACT,
+ /* We want a named declarator. */
+ CP_PARSER_DECLARATOR_NAMED,
+ /* We don't mind, but the name must be an unqualified-id. */
+ CP_PARSER_DECLARATOR_EITHER
+} cp_parser_declarator_kind;
+
+/* A mapping from a token type to a corresponding tree node type. */
+
+typedef struct cp_parser_token_tree_map_node
+{
+ /* The token type. */
+ ENUM_BITFIELD (cpp_ttype) token_type : 8;
+ /* The corresponding tree code. */
+ ENUM_BITFIELD (tree_code) tree_type : 8;
+} cp_parser_token_tree_map_node;
+
+/* A complete map consists of several ordinary entries, followed by a
+ terminator. The terminating entry has a token_type of CPP_EOF. */
+
+typedef cp_parser_token_tree_map_node cp_parser_token_tree_map[];
+
+/* The status of a tentative parse. */
+
+typedef enum cp_parser_status_kind
+{
+ /* No errors have occurred. */
+ CP_PARSER_STATUS_KIND_NO_ERROR,
+ /* An error has occurred. */
+ CP_PARSER_STATUS_KIND_ERROR,
+ /* We are committed to this tentative parse, whether or not an error
+ has occurred. */
+ CP_PARSER_STATUS_KIND_COMMITTED
+} cp_parser_status_kind;
+
+/* Context that is saved and restored when parsing tentatively. */
+
+typedef struct cp_parser_context GTY (())
+{
+ /* If this is a tentative parsing context, the status of the
+ tentative parse. */
+ enum cp_parser_status_kind status;
+ /* If non-NULL, we have just seen a `x->' or `x.' expression. Names
+ that are looked up in this context must be looked up both in the
+ scope given by OBJECT_TYPE (the type of `x' or `*x') and also in
+ the context of the containing expression. */
+ tree object_type;
+ /* The next parsing context in the stack. */
+ struct cp_parser_context *next;
+} cp_parser_context;
+
+/* Prototypes. */
+
+/* Constructors and destructors. */
+
+static cp_parser_context *cp_parser_context_new
+ (cp_parser_context *);
+
+/* Class variables. */
+
+static GTY((deletable (""))) cp_parser_context* cp_parser_context_free_list;
+
+/* Constructors and destructors. */
+
+/* Construct a new context. The context below this one on the stack
+ is given by NEXT. */
+
+static cp_parser_context *
+cp_parser_context_new (cp_parser_context* next)
+{
+ cp_parser_context *context;
+
+ /* Allocate the storage. */
+ if (cp_parser_context_free_list != NULL)
+ {
+ /* Pull the first entry from the free list. */
+ context = cp_parser_context_free_list;
+ cp_parser_context_free_list = context->next;
+ memset (context, 0, sizeof (*context));
+ }
+ else
+ context = ggc_alloc_cleared (sizeof (cp_parser_context));
+ /* No errors have occurred yet in this context. */
+ context->status = CP_PARSER_STATUS_KIND_NO_ERROR;
+ /* If this is not the bottomost context, copy information that we
+ need from the previous context. */
+ if (next)
+ {
+ /* If, in the NEXT context, we are parsing an `x->' or `x.'
+ expression, then we are parsing one in this context, too. */
+ context->object_type = next->object_type;
+ /* Thread the stack. */
+ context->next = next;
+ }
+
+ return context;
+}
+
+/* The cp_parser structure represents the C++ parser. */
+
+typedef struct cp_parser GTY(())
+{
+ /* The lexer from which we are obtaining tokens. */
+ cp_lexer *lexer;
+
+ /* The scope in which names should be looked up. If NULL_TREE, then
+ we look up names in the scope that is currently open in the
+ source program. If non-NULL, this is either a TYPE or
+ NAMESPACE_DECL for the scope in which we should look.
+
+ This value is not cleared automatically after a name is looked
+ up, so we must be careful to clear it before starting a new look
+ up sequence. (If it is not cleared, then `X::Y' followed by `Z'
+ will look up `Z' in the scope of `X', rather than the current
+ scope.) Unfortunately, it is difficult to tell when name lookup
+ is complete, because we sometimes peek at a token, look it up,
+ and then decide not to consume it. */
+ tree scope;
+
+ /* OBJECT_SCOPE and QUALIFYING_SCOPE give the scopes in which the
+ last lookup took place. OBJECT_SCOPE is used if an expression
+ like "x->y" or "x.y" was used; it gives the type of "*x" or "x",
+ respectively. QUALIFYING_SCOPE is used for an expression of the
+ form "X::Y"; it refers to X. */
+ tree object_scope;
+ tree qualifying_scope;
+
+ /* A stack of parsing contexts. All but the bottom entry on the
+ stack will be tentative contexts.
+
+ We parse tentatively in order to determine which construct is in
+ use in some situations. For example, in order to determine
+ whether a statement is an expression-statement or a
+ declaration-statement we parse it tentatively as a
+ declaration-statement. If that fails, we then reparse the same
+ token stream as an expression-statement. */
+ cp_parser_context *context;
+
+ /* True if we are parsing GNU C++. If this flag is not set, then
+ GNU extensions are not recognized. */
+ bool allow_gnu_extensions_p;
+
+ /* TRUE if the `>' token should be interpreted as the greater-than
+ operator. FALSE if it is the end of a template-id or
+ template-parameter-list. */
+ bool greater_than_is_operator_p;
+
+ /* TRUE if default arguments are allowed within a parameter list
+ that starts at this point. FALSE if only a gnu extension makes
+ them permissible. */
+ bool default_arg_ok_p;
+
+ /* TRUE if we are parsing an integral constant-expression. See
+ [expr.const] for a precise definition. */
+ bool integral_constant_expression_p;
+
+ /* TRUE if we are parsing an integral constant-expression -- but a
+ non-constant expression should be permitted as well. This flag
+ is used when parsing an array bound so that GNU variable-length
+ arrays are tolerated. */
+ bool allow_non_integral_constant_expression_p;
+
+ /* TRUE if ALLOW_NON_CONSTANT_EXPRESSION_P is TRUE and something has
+ been seen that makes the expression non-constant. */
+ bool non_integral_constant_expression_p;
+
+ /* TRUE if we are parsing the argument to "__offsetof__". */
+ bool in_offsetof_p;
+
+ /* TRUE if local variable names and `this' are forbidden in the
+ current context. */
+ bool local_variables_forbidden_p;
+
+ /* TRUE if the declaration we are parsing is part of a
+ linkage-specification of the form `extern string-literal
+ declaration'. */
+ bool in_unbraced_linkage_specification_p;
+
+ /* TRUE if we are presently parsing a declarator, after the
+ direct-declarator. */
+ bool in_declarator_p;
+
+ /* TRUE if we are presently parsing a template-argument-list. */
+ bool in_template_argument_list_p;
+
+ /* TRUE if we are presently parsing the body of an
+ iteration-statement. */
+ bool in_iteration_statement_p;
+
+ /* TRUE if we are presently parsing the body of a switch
+ statement. */
+ bool in_switch_statement_p;
+
+ /* TRUE if we are parsing a type-id in an expression context. In
+ such a situation, both "type (expr)" and "type (type)" are valid
+ alternatives. */
+ bool in_type_id_in_expr_p;
+
+ /* If non-NULL, then we are parsing a construct where new type
+ definitions are not permitted. The string stored here will be
+ issued as an error message if a type is defined. */
+ const char *type_definition_forbidden_message;
+
+ /* A list of lists. The outer list is a stack, used for member
+ functions of local classes. At each level there are two sub-list,
+ one on TREE_VALUE and one on TREE_PURPOSE. Each of those
+ sub-lists has a FUNCTION_DECL or TEMPLATE_DECL on their
+ TREE_VALUE's. The functions are chained in reverse declaration
+ order.
+
+ The TREE_PURPOSE sublist contains those functions with default
+ arguments that need post processing, and the TREE_VALUE sublist
+ contains those functions with definitions that need post
+ processing.
+
+ These lists can only be processed once the outermost class being
+ defined is complete. */
+ tree unparsed_functions_queues;
+
+ /* The number of classes whose definitions are currently in
+ progress. */
+ unsigned num_classes_being_defined;
+
+ /* The number of template parameter lists that apply directly to the
+ current declaration. */
+ unsigned num_template_parameter_lists;
+} cp_parser;
+
+/* The type of a function that parses some kind of expression. */
+typedef tree (*cp_parser_expression_fn) (cp_parser *);
+
+/* Prototypes. */
+
+/* Constructors and destructors. */
+
+static cp_parser *cp_parser_new
+ (void);
+
+/* Routines to parse various constructs.
+
+ Those that return `tree' will return the error_mark_node (rather
+ than NULL_TREE) if a parse error occurs, unless otherwise noted.
+ Sometimes, they will return an ordinary node if error-recovery was
+ attempted, even though a parse error occurred. So, to check
+ whether or not a parse error occurred, you should always use
+ cp_parser_error_occurred. If the construct is optional (indicated
+ either by an `_opt' in the name of the function that does the
+ parsing or via a FLAGS parameter), then NULL_TREE is returned if
+ the construct is not present. */
+
+/* Lexical conventions [gram.lex] */
+
+static tree cp_parser_identifier
+ (cp_parser *);
+
+/* Basic concepts [gram.basic] */
+
+static bool cp_parser_translation_unit
+ (cp_parser *);
+
+/* Expressions [gram.expr] */
+
+static tree cp_parser_primary_expression
+ (cp_parser *, cp_id_kind *, tree *);
+static tree cp_parser_id_expression
+ (cp_parser *, bool, bool, bool *, bool);
+static tree cp_parser_unqualified_id
+ (cp_parser *, bool, bool, bool);
+static tree cp_parser_nested_name_specifier_opt
+ (cp_parser *, bool, bool, bool, bool);
+static tree cp_parser_nested_name_specifier
+ (cp_parser *, bool, bool, bool, bool);
+static tree cp_parser_class_or_namespace_name
+ (cp_parser *, bool, bool, bool, bool, bool);
+static tree cp_parser_postfix_expression
+ (cp_parser *, bool);
+static tree cp_parser_parenthesized_expression_list
+ (cp_parser *, bool, bool *);
+static void cp_parser_pseudo_destructor_name
+ (cp_parser *, tree *, tree *);
+static tree cp_parser_unary_expression
+ (cp_parser *, bool);
+static enum tree_code cp_parser_unary_operator
+ (cp_token *);
+static tree cp_parser_new_expression
+ (cp_parser *);
+static tree cp_parser_new_placement
+ (cp_parser *);
+static tree cp_parser_new_type_id
+ (cp_parser *);
+static tree cp_parser_new_declarator_opt
+ (cp_parser *);
+static tree cp_parser_direct_new_declarator
+ (cp_parser *);
+static tree cp_parser_new_initializer
+ (cp_parser *);
+static tree cp_parser_delete_expression
+ (cp_parser *);
+static tree cp_parser_cast_expression
+ (cp_parser *, bool);
+static tree cp_parser_pm_expression
+ (cp_parser *);
+static tree cp_parser_multiplicative_expression
+ (cp_parser *);
+static tree cp_parser_additive_expression
+ (cp_parser *);
+static tree cp_parser_shift_expression
+ (cp_parser *);
+static tree cp_parser_relational_expression
+ (cp_parser *);
+static tree cp_parser_equality_expression
+ (cp_parser *);
+static tree cp_parser_and_expression
+ (cp_parser *);
+static tree cp_parser_exclusive_or_expression
+ (cp_parser *);
+static tree cp_parser_inclusive_or_expression
+ (cp_parser *);
+static tree cp_parser_logical_and_expression
+ (cp_parser *);
+static tree cp_parser_logical_or_expression
+ (cp_parser *);
+static tree cp_parser_question_colon_clause
+ (cp_parser *, tree);
+static tree cp_parser_assignment_expression
+ (cp_parser *);
+static enum tree_code cp_parser_assignment_operator_opt
+ (cp_parser *);
+static tree cp_parser_expression
+ (cp_parser *);
+static tree cp_parser_constant_expression
+ (cp_parser *, bool, bool *);
+
+/* Statements [gram.stmt.stmt] */
+
+static void cp_parser_statement
+ (cp_parser *, bool);
+static tree cp_parser_labeled_statement
+ (cp_parser *, bool);
+static tree cp_parser_expression_statement
+ (cp_parser *, bool);
+static tree cp_parser_compound_statement
+ (cp_parser *, bool);
+static void cp_parser_statement_seq_opt
+ (cp_parser *, bool);
+static tree cp_parser_selection_statement
+ (cp_parser *);
+static tree cp_parser_condition
+ (cp_parser *);
+static tree cp_parser_iteration_statement
+ (cp_parser *);
+static void cp_parser_for_init_statement
+ (cp_parser *);
+static tree cp_parser_jump_statement
+ (cp_parser *);
+static void cp_parser_declaration_statement
+ (cp_parser *);
+
+static tree cp_parser_implicitly_scoped_statement
+ (cp_parser *);
+static void cp_parser_already_scoped_statement
+ (cp_parser *);
+
+/* Declarations [gram.dcl.dcl] */
+
+static void cp_parser_declaration_seq_opt
+ (cp_parser *);
+static void cp_parser_declaration
+ (cp_parser *);
+static void cp_parser_block_declaration
+ (cp_parser *, bool);
+static void cp_parser_simple_declaration
+ (cp_parser *, bool);
+static tree cp_parser_decl_specifier_seq
+ (cp_parser *, cp_parser_flags, tree *, int *);
+static tree cp_parser_storage_class_specifier_opt
+ (cp_parser *);
+static tree cp_parser_function_specifier_opt
+ (cp_parser *);
+static tree cp_parser_type_specifier
+ (cp_parser *, cp_parser_flags, bool, bool, int *, bool *);
+static tree cp_parser_simple_type_specifier
+ (cp_parser *, cp_parser_flags, bool);
+static tree cp_parser_type_name
+ (cp_parser *);
+static tree cp_parser_elaborated_type_specifier
+ (cp_parser *, bool, bool);
+static tree cp_parser_enum_specifier
+ (cp_parser *);
+static void cp_parser_enumerator_list
+ (cp_parser *, tree);
+static void cp_parser_enumerator_definition
+ (cp_parser *, tree);
+static tree cp_parser_namespace_name
+ (cp_parser *);
+static void cp_parser_namespace_definition
+ (cp_parser *);
+static void cp_parser_namespace_body
+ (cp_parser *);
+static tree cp_parser_qualified_namespace_specifier
+ (cp_parser *);
+static void cp_parser_namespace_alias_definition
+ (cp_parser *);
+static void cp_parser_using_declaration
+ (cp_parser *);
+static void cp_parser_using_directive
+ (cp_parser *);
+static void cp_parser_asm_definition
+ (cp_parser *);
+static void cp_parser_linkage_specification
+ (cp_parser *);
+
+/* Declarators [gram.dcl.decl] */
+
+static tree cp_parser_init_declarator
+ (cp_parser *, tree, tree, bool, bool, int, bool *);
+static tree cp_parser_declarator
+ (cp_parser *, cp_parser_declarator_kind, int *, bool *);
+static tree cp_parser_direct_declarator
+ (cp_parser *, cp_parser_declarator_kind, int *);
+static enum tree_code cp_parser_ptr_operator
+ (cp_parser *, tree *, tree *);
+static tree cp_parser_cv_qualifier_seq_opt
+ (cp_parser *);
+static tree cp_parser_cv_qualifier_opt
+ (cp_parser *);
+static tree cp_parser_declarator_id
+ (cp_parser *);
+static tree cp_parser_type_id
+ (cp_parser *);
+static tree cp_parser_type_specifier_seq
+ (cp_parser *);
+static tree cp_parser_parameter_declaration_clause
+ (cp_parser *);
+static tree cp_parser_parameter_declaration_list
+ (cp_parser *);
+static tree cp_parser_parameter_declaration
+ (cp_parser *, bool, bool *);
+static void cp_parser_function_body
+ (cp_parser *);
+static tree cp_parser_initializer
+ (cp_parser *, bool *, bool *);
+static tree cp_parser_initializer_clause
+ (cp_parser *, bool *);
+static tree cp_parser_initializer_list
+ (cp_parser *, bool *);
+
+static bool cp_parser_ctor_initializer_opt_and_function_body
+ (cp_parser *);
+
+/* Classes [gram.class] */
+
+static tree cp_parser_class_name
+ (cp_parser *, bool, bool, bool, bool, bool, bool);
+static tree cp_parser_class_specifier
+ (cp_parser *);
+static tree cp_parser_class_head
+ (cp_parser *, bool *, tree *);
+static enum tag_types cp_parser_class_key
+ (cp_parser *);
+static void cp_parser_member_specification_opt
+ (cp_parser *);
+static void cp_parser_member_declaration
+ (cp_parser *);
+static tree cp_parser_pure_specifier
+ (cp_parser *);
+static tree cp_parser_constant_initializer
+ (cp_parser *);
+
+/* Derived classes [gram.class.derived] */
+
+static tree cp_parser_base_clause
+ (cp_parser *);
+static tree cp_parser_base_specifier
+ (cp_parser *);
+
+/* Special member functions [gram.special] */
+
+static tree cp_parser_conversion_function_id
+ (cp_parser *);
+static tree cp_parser_conversion_type_id
+ (cp_parser *);
+static tree cp_parser_conversion_declarator_opt
+ (cp_parser *);
+static bool cp_parser_ctor_initializer_opt
+ (cp_parser *);
+static void cp_parser_mem_initializer_list
+ (cp_parser *);
+static tree cp_parser_mem_initializer
+ (cp_parser *);
+static tree cp_parser_mem_initializer_id
+ (cp_parser *);
+
+/* Overloading [gram.over] */
+
+static tree cp_parser_operator_function_id
+ (cp_parser *);
+static tree cp_parser_operator
+ (cp_parser *);
+
+/* Templates [gram.temp] */
+
+static void cp_parser_template_declaration
+ (cp_parser *, bool);
+static tree cp_parser_template_parameter_list
+ (cp_parser *);
+static tree cp_parser_template_parameter
+ (cp_parser *);
+static tree cp_parser_type_parameter
+ (cp_parser *);
+static tree cp_parser_template_id
+ (cp_parser *, bool, bool, bool);
+static tree cp_parser_template_name
+ (cp_parser *, bool, bool, bool, bool *);
+static tree cp_parser_template_argument_list
+ (cp_parser *);
+static tree cp_parser_template_argument
+ (cp_parser *);
+static void cp_parser_explicit_instantiation
+ (cp_parser *);
+static void cp_parser_explicit_specialization
+ (cp_parser *);
+
+/* Exception handling [gram.exception] */
+
+static tree cp_parser_try_block
+ (cp_parser *);
+static bool cp_parser_function_try_block
+ (cp_parser *);
+static void cp_parser_handler_seq
+ (cp_parser *);
+static void cp_parser_handler
+ (cp_parser *);
+static tree cp_parser_exception_declaration
+ (cp_parser *);
+static tree cp_parser_throw_expression
+ (cp_parser *);
+static tree cp_parser_exception_specification_opt
+ (cp_parser *);
+static tree cp_parser_type_id_list
+ (cp_parser *);
+
+/* GNU Extensions */
+
+static tree cp_parser_asm_specification_opt
+ (cp_parser *);
+static tree cp_parser_asm_operand_list
+ (cp_parser *);
+static tree cp_parser_asm_clobber_list
+ (cp_parser *);
+static tree cp_parser_attributes_opt
+ (cp_parser *);
+static tree cp_parser_attribute_list
+ (cp_parser *);
+static bool cp_parser_extension_opt
+ (cp_parser *, int *);
+static void cp_parser_label_declaration
+ (cp_parser *);
+
+/* Utility Routines */
+
+static tree cp_parser_lookup_name
+ (cp_parser *, tree, bool, bool, bool, bool);
+static tree cp_parser_lookup_name_simple
+ (cp_parser *, tree);
+static tree cp_parser_maybe_treat_template_as_class
+ (tree, bool);
+static bool cp_parser_check_declarator_template_parameters
+ (cp_parser *, tree);
+static bool cp_parser_check_template_parameters
+ (cp_parser *, unsigned);
+static tree cp_parser_simple_cast_expression
+ (cp_parser *);
+static tree cp_parser_binary_expression
+ (cp_parser *, const cp_parser_token_tree_map, cp_parser_expression_fn);
+static tree cp_parser_global_scope_opt
+ (cp_parser *, bool);
+static bool cp_parser_constructor_declarator_p
+ (cp_parser *, bool);
+static tree cp_parser_function_definition_from_specifiers_and_declarator
+ (cp_parser *, tree, tree, tree);
+static tree cp_parser_function_definition_after_declarator
+ (cp_parser *, bool);
+static void cp_parser_template_declaration_after_export
+ (cp_parser *, bool);
+static tree cp_parser_single_declaration
+ (cp_parser *, bool, bool *);
+static tree cp_parser_functional_cast
+ (cp_parser *, tree);
+static tree cp_parser_save_member_function_body
+ (cp_parser *, tree, tree, tree);
+static tree cp_parser_enclosed_template_argument_list
+ (cp_parser *);
+static void cp_parser_save_default_args
+ (cp_parser *, tree);
+static void cp_parser_late_parsing_for_member
+ (cp_parser *, tree);
+static void cp_parser_late_parsing_default_args
+ (cp_parser *, tree);
+static tree cp_parser_sizeof_operand
+ (cp_parser *, enum rid);
+static bool cp_parser_declares_only_class_p
+ (cp_parser *);
+static bool cp_parser_friend_p
+ (tree);
+static cp_token *cp_parser_require
+ (cp_parser *, enum cpp_ttype, const char *);
+static cp_token *cp_parser_require_keyword
+ (cp_parser *, enum rid, const char *);
+static bool cp_parser_token_starts_function_definition_p
+ (cp_token *);
+static bool cp_parser_next_token_starts_class_definition_p
+ (cp_parser *);
+static bool cp_parser_next_token_ends_template_argument_p
+ (cp_parser *);
+static bool cp_parser_nth_token_starts_template_argument_list_p
+ (cp_parser *, size_t);
+static enum tag_types cp_parser_token_is_class_key
+ (cp_token *);
+static void cp_parser_check_class_key
+ (enum tag_types, tree type);
+static void cp_parser_check_access_in_redeclaration
+ (tree type);
+static bool cp_parser_optional_template_keyword
+ (cp_parser *);
+static void cp_parser_pre_parsed_nested_name_specifier
+ (cp_parser *);
+static void cp_parser_cache_group
+ (cp_parser *, cp_token_cache *, enum cpp_ttype, unsigned);
+static void cp_parser_parse_tentatively
+ (cp_parser *);
+static void cp_parser_commit_to_tentative_parse
+ (cp_parser *);
+static void cp_parser_abort_tentative_parse
+ (cp_parser *);
+static bool cp_parser_parse_definitely
+ (cp_parser *);
+static inline bool cp_parser_parsing_tentatively
+ (cp_parser *);
+static bool cp_parser_committed_to_tentative_parse
+ (cp_parser *);
+static void cp_parser_error
+ (cp_parser *, const char *);
+static void cp_parser_name_lookup_error
+ (cp_parser *, tree, tree, const char *);
+static bool cp_parser_simulate_error
+ (cp_parser *);
+static void cp_parser_check_type_definition
+ (cp_parser *);
+static void cp_parser_check_for_definition_in_return_type
+ (tree, int);
+static void cp_parser_check_for_invalid_template_id
+ (cp_parser *, tree);
+static bool cp_parser_non_integral_constant_expression
+ (cp_parser *, const char *);
+static bool cp_parser_diagnose_invalid_type_name
+ (cp_parser *);
+static int cp_parser_skip_to_closing_parenthesis
+ (cp_parser *, bool, bool, bool);
+static void cp_parser_skip_to_end_of_statement
+ (cp_parser *);
+static void cp_parser_consume_semicolon_at_end_of_statement
+ (cp_parser *);
+static void cp_parser_skip_to_end_of_block_or_statement
+ (cp_parser *);
+static void cp_parser_skip_to_closing_brace
+ (cp_parser *);
+static void cp_parser_skip_until_found
+ (cp_parser *, enum cpp_ttype, const char *);
+static bool cp_parser_error_occurred
+ (cp_parser *);
+static bool cp_parser_allow_gnu_extensions_p
+ (cp_parser *);
+static bool cp_parser_is_string_literal
+ (cp_token *);
+static bool cp_parser_is_keyword
+ (cp_token *, enum rid);
+
+/* Returns nonzero if we are parsing tentatively. */
+
+static inline bool
+cp_parser_parsing_tentatively (cp_parser* parser)
+{
+ return parser->context->next != NULL;
+}
+
+/* Returns nonzero if TOKEN is a string literal. */
+
+static bool
+cp_parser_is_string_literal (cp_token* token)
+{
+ return (token->type == CPP_STRING || token->type == CPP_WSTRING);
+}
+
+/* Returns nonzero if TOKEN is the indicated KEYWORD. */
+
+static bool
+cp_parser_is_keyword (cp_token* token, enum rid keyword)
+{
+ return token->keyword == keyword;
+}
+
+/* Issue the indicated error MESSAGE. */
+
+static void
+cp_parser_error (cp_parser* parser, const char* message)
+{
+ /* Output the MESSAGE -- unless we're parsing tentatively. */
+ if (!cp_parser_simulate_error (parser))
+ {
+ cp_token *token;
+ token = cp_lexer_peek_token (parser->lexer);
+ c_parse_error (message,
+ /* Because c_parser_error does not understand
+ CPP_KEYWORD, keywords are treated like
+ identifiers. */
+ (token->type == CPP_KEYWORD ? CPP_NAME : token->type),
+ token->value);
+ }
+}
+
+/* Issue an error about name-lookup failing. NAME is the
+ IDENTIFIER_NODE DECL is the result of
+ the lookup (as returned from cp_parser_lookup_name). DESIRED is
+ the thing that we hoped to find. */
+
+static void
+cp_parser_name_lookup_error (cp_parser* parser,
+ tree name,
+ tree decl,
+ const char* desired)
+{
+ /* If name lookup completely failed, tell the user that NAME was not
+ declared. */
+ if (decl == error_mark_node)
+ {
+ if (parser->scope && parser->scope != global_namespace)
+ error ("`%D::%D' has not been declared",
+ parser->scope, name);
+ else if (parser->scope == global_namespace)
+ error ("`::%D' has not been declared", name);
+ else
+ error ("`%D' has not been declared", name);
+ }
+ else if (parser->scope && parser->scope != global_namespace)
+ error ("`%D::%D' %s", parser->scope, name, desired);
+ else if (parser->scope == global_namespace)
+ error ("`::%D' %s", name, desired);
+ else
+ error ("`%D' %s", name, desired);
+}
+
+/* If we are parsing tentatively, remember that an error has occurred
+ during this tentative parse. Returns true if the error was
+ simulated; false if a messgae should be issued by the caller. */
+
+static bool
+cp_parser_simulate_error (cp_parser* parser)
+{
+ if (cp_parser_parsing_tentatively (parser)
+ && !cp_parser_committed_to_tentative_parse (parser))
+ {
+ parser->context->status = CP_PARSER_STATUS_KIND_ERROR;
+ return true;
+ }
+ return false;
+}
+
+/* This function is called when a type is defined. If type
+ definitions are forbidden at this point, an error message is
+ issued. */
+
+static void
+cp_parser_check_type_definition (cp_parser* parser)
+{
+ /* If types are forbidden here, issue a message. */
+ if (parser->type_definition_forbidden_message)
+ /* Use `%s' to print the string in case there are any escape
+ characters in the message. */
+ error ("%s", parser->type_definition_forbidden_message);
+}
+
+/* This function is called when a declaration is parsed. If
+ DECLARATOR is a function declarator and DECLARES_CLASS_OR_ENUM
+ indicates that a type was defined in the decl-specifiers for DECL,
+ then an error is issued. */
+
+static void
+cp_parser_check_for_definition_in_return_type (tree declarator,
+ int declares_class_or_enum)
+{
+ /* [dcl.fct] forbids type definitions in return types.
+ Unfortunately, it's not easy to know whether or not we are
+ processing a return type until after the fact. */
+ while (declarator
+ && (TREE_CODE (declarator) == INDIRECT_REF
+ || TREE_CODE (declarator) == ADDR_EXPR))
+ declarator = TREE_OPERAND (declarator, 0);
+ if (declarator
+ && TREE_CODE (declarator) == CALL_EXPR
+ && declares_class_or_enum & 2)
+ error ("new types may not be defined in a return type");
+}
+
+/* A type-specifier (TYPE) has been parsed which cannot be followed by
+ "<" in any valid C++ program. If the next token is indeed "<",
+ issue a message warning the user about what appears to be an
+ invalid attempt to form a template-id. */
+
+static void
+cp_parser_check_for_invalid_template_id (cp_parser* parser,
+ tree type)
+{
+ ptrdiff_t start;
+ cp_token *token;
+
+ if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
+ {
+ if (TYPE_P (type))
+ error ("`%T' is not a template", type);
+ else if (TREE_CODE (type) == IDENTIFIER_NODE)
+ error ("`%s' is not a template", IDENTIFIER_POINTER (type));
+ else
+ error ("invalid template-id");
+ /* Remember the location of the invalid "<". */
+ if (cp_parser_parsing_tentatively (parser)
+ && !cp_parser_committed_to_tentative_parse (parser))
+ {
+ token = cp_lexer_peek_token (parser->lexer);
+ token = cp_lexer_prev_token (parser->lexer, token);
+ start = cp_lexer_token_difference (parser->lexer,
+ parser->lexer->first_token,
+ token);
+ }
+ else
+ start = -1;
+ /* Consume the "<". */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the template arguments. */
+ cp_parser_enclosed_template_argument_list (parser);
+ /* Permanently remove the invalid template arguments so that
+ this error message is not issued again. */
+ if (start >= 0)
+ {
+ token = cp_lexer_advance_token (parser->lexer,
+ parser->lexer->first_token,
+ start);
+ cp_lexer_purge_tokens_after (parser->lexer, token);
+ }
+ }
+}
+
+/* If parsing an integral constant-expression, issue an error message
+ about the fact that THING appeared and return true. Otherwise,
+ return false, marking the current expression as non-constant. */
+
+static bool
+cp_parser_non_integral_constant_expression (cp_parser *parser,
+ const char *thing)
+{
+ if (parser->integral_constant_expression_p)
+ {
+ if (!parser->allow_non_integral_constant_expression_p)
+ {
+ error ("%s cannot appear in a constant-expression", thing);
+ return true;
+ }
+ parser->non_integral_constant_expression_p = true;
+ }
+ return false;
+}
+
+/* Check for a common situation where a type-name should be present,
+ but is not, and issue a sensible error message. Returns true if an
+ invalid type-name was detected. */
+
+static bool
+cp_parser_diagnose_invalid_type_name (cp_parser *parser)
+{
+ /* If the next two tokens are both identifiers, the code is
+ erroneous. The usual cause of this situation is code like:
+
+ T t;
+
+ where "T" should name a type -- but does not. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_NAME)
+ && cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_NAME)
+ {
+ tree name;
+
+ /* If parsing tentatively, we should commit; we really are
+ looking at a declaration. */
+ /* Consume the first identifier. */
+ name = cp_lexer_consume_token (parser->lexer)->value;
+ /* Issue an error message. */
+ error ("`%s' does not name a type", IDENTIFIER_POINTER (name));
+ /* If we're in a template class, it's possible that the user was
+ referring to a type from a base class. For example:
+
+ template <typename T> struct A { typedef T X; };
+ template <typename T> struct B : public A<T> { X x; };
+
+ The user should have said "typename A<T>::X". */
+ if (processing_template_decl && current_class_type)
+ {
+ tree b;
+
+ for (b = TREE_CHAIN (TYPE_BINFO (current_class_type));
+ b;
+ b = TREE_CHAIN (b))
+ {
+ tree base_type = BINFO_TYPE (b);
+ if (CLASS_TYPE_P (base_type)
+ && dependent_type_p (base_type))
+ {
+ tree field;
+ /* Go from a particular instantiation of the
+ template (which will have an empty TYPE_FIELDs),
+ to the main version. */
+ base_type = CLASSTYPE_PRIMARY_TEMPLATE_TYPE (base_type);
+ for (field = TYPE_FIELDS (base_type);
+ field;
+ field = TREE_CHAIN (field))
+ if (TREE_CODE (field) == TYPE_DECL
+ && DECL_NAME (field) == name)
+ {
+ error ("(perhaps `typename %T::%s' was intended)",
+ BINFO_TYPE (b), IDENTIFIER_POINTER (name));
+ break;
+ }
+ if (field)
+ break;
+ }
+ }
+ }
+ /* Skip to the end of the declaration; there's no point in
+ trying to process it. */
+ cp_parser_skip_to_end_of_statement (parser);
+
+ return true;
+ }
+
+ return false;
+}
+
+/* Consume tokens up to, and including, the next non-nested closing `)'.
+ Returns 1 iff we found a closing `)'. RECOVERING is true, if we
+ are doing error recovery. Returns -1 if OR_COMMA is true and we
+ found an unnested comma. */
+
+static int
+cp_parser_skip_to_closing_parenthesis (cp_parser *parser,
+ bool recovering,
+ bool or_comma,
+ bool consume_paren)
+{
+ unsigned paren_depth = 0;
+ unsigned brace_depth = 0;
+
+ if (recovering && !or_comma && cp_parser_parsing_tentatively (parser)
+ && !cp_parser_committed_to_tentative_parse (parser))
+ return 0;
+
+ while (true)
+ {
+ cp_token *token;
+
+ /* If we've run out of tokens, then there is no closing `)'. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_EOF))
+ return 0;
+
+ token = cp_lexer_peek_token (parser->lexer);
+
+ /* This matches the processing in skip_to_end_of_statement. */
+ if (token->type == CPP_SEMICOLON && !brace_depth)
+ return 0;
+ if (token->type == CPP_OPEN_BRACE)
+ ++brace_depth;
+ if (token->type == CPP_CLOSE_BRACE)
+ {
+ if (!brace_depth--)
+ return 0;
+ }
+ if (recovering && or_comma && token->type == CPP_COMMA
+ && !brace_depth && !paren_depth)
+ return -1;
+
+ if (!brace_depth)
+ {
+ /* If it is an `(', we have entered another level of nesting. */
+ if (token->type == CPP_OPEN_PAREN)
+ ++paren_depth;
+ /* If it is a `)', then we might be done. */
+ else if (token->type == CPP_CLOSE_PAREN && !paren_depth--)
+ {
+ if (consume_paren)
+ cp_lexer_consume_token (parser->lexer);
+ return 1;
+ }
+ }
+
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+}
+
+/* Consume tokens until we reach the end of the current statement.
+ Normally, that will be just before consuming a `;'. However, if a
+ non-nested `}' comes first, then we stop before consuming that. */
+
+static void
+cp_parser_skip_to_end_of_statement (cp_parser* parser)
+{
+ unsigned nesting_depth = 0;
+
+ while (true)
+ {
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If we've run out of tokens, stop. */
+ if (token->type == CPP_EOF)
+ break;
+ /* If the next token is a `;', we have reached the end of the
+ statement. */
+ if (token->type == CPP_SEMICOLON && !nesting_depth)
+ break;
+ /* If the next token is a non-nested `}', then we have reached
+ the end of the current block. */
+ if (token->type == CPP_CLOSE_BRACE)
+ {
+ /* If this is a non-nested `}', stop before consuming it.
+ That way, when confronted with something like:
+
+ { 3 + }
+
+ we stop before consuming the closing `}', even though we
+ have not yet reached a `;'. */
+ if (nesting_depth == 0)
+ break;
+ /* If it is the closing `}' for a block that we have
+ scanned, stop -- but only after consuming the token.
+ That way given:
+
+ void f g () { ... }
+ typedef int I;
+
+ we will stop after the body of the erroneously declared
+ function, but before consuming the following `typedef'
+ declaration. */
+ if (--nesting_depth == 0)
+ {
+ cp_lexer_consume_token (parser->lexer);
+ break;
+ }
+ }
+ /* If it the next token is a `{', then we are entering a new
+ block. Consume the entire block. */
+ else if (token->type == CPP_OPEN_BRACE)
+ ++nesting_depth;
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+}
+
+/* This function is called at the end of a statement or declaration.
+ If the next token is a semicolon, it is consumed; otherwise, error
+ recovery is attempted. */
+
+static void
+cp_parser_consume_semicolon_at_end_of_statement (cp_parser *parser)
+{
+ /* Look for the trailing `;'. */
+ if (!cp_parser_require (parser, CPP_SEMICOLON, "`;'"))
+ {
+ /* If there is additional (erroneous) input, skip to the end of
+ the statement. */
+ cp_parser_skip_to_end_of_statement (parser);
+ /* If the next token is now a `;', consume it. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
+ cp_lexer_consume_token (parser->lexer);
+ }
+}
+
+/* Skip tokens until we have consumed an entire block, or until we
+ have consumed a non-nested `;'. */
+
+static void
+cp_parser_skip_to_end_of_block_or_statement (cp_parser* parser)
+{
+ unsigned nesting_depth = 0;
+
+ while (true)
+ {
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If we've run out of tokens, stop. */
+ if (token->type == CPP_EOF)
+ break;
+ /* If the next token is a `;', we have reached the end of the
+ statement. */
+ if (token->type == CPP_SEMICOLON && !nesting_depth)
+ {
+ /* Consume the `;'. */
+ cp_lexer_consume_token (parser->lexer);
+ break;
+ }
+ /* Consume the token. */
+ token = cp_lexer_consume_token (parser->lexer);
+ /* If the next token is a non-nested `}', then we have reached
+ the end of the current block. */
+ if (token->type == CPP_CLOSE_BRACE
+ && (nesting_depth == 0 || --nesting_depth == 0))
+ break;
+ /* If it the next token is a `{', then we are entering a new
+ block. Consume the entire block. */
+ if (token->type == CPP_OPEN_BRACE)
+ ++nesting_depth;
+ }
+}
+
+/* Skip tokens until a non-nested closing curly brace is the next
+ token. */
+
+static void
+cp_parser_skip_to_closing_brace (cp_parser *parser)
+{
+ unsigned nesting_depth = 0;
+
+ while (true)
+ {
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If we've run out of tokens, stop. */
+ if (token->type == CPP_EOF)
+ break;
+ /* If the next token is a non-nested `}', then we have reached
+ the end of the current block. */
+ if (token->type == CPP_CLOSE_BRACE && nesting_depth-- == 0)
+ break;
+ /* If it the next token is a `{', then we are entering a new
+ block. Consume the entire block. */
+ else if (token->type == CPP_OPEN_BRACE)
+ ++nesting_depth;
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+}
+
+/* Create a new C++ parser. */
+
+static cp_parser *
+cp_parser_new (void)
+{
+ cp_parser *parser;
+ cp_lexer *lexer;
+
+ /* cp_lexer_new_main is called before calling ggc_alloc because
+ cp_lexer_new_main might load a PCH file. */
+ lexer = cp_lexer_new_main ();
+
+ parser = ggc_alloc_cleared (sizeof (cp_parser));
+ parser->lexer = lexer;
+ parser->context = cp_parser_context_new (NULL);
+
+ /* For now, we always accept GNU extensions. */
+ parser->allow_gnu_extensions_p = 1;
+
+ /* The `>' token is a greater-than operator, not the end of a
+ template-id. */
+ parser->greater_than_is_operator_p = true;
+
+ parser->default_arg_ok_p = true;
+
+ /* We are not parsing a constant-expression. */
+ parser->integral_constant_expression_p = false;
+ parser->allow_non_integral_constant_expression_p = false;
+ parser->non_integral_constant_expression_p = false;
+
+ /* We are not parsing offsetof. */
+ parser->in_offsetof_p = false;
+
+ /* Local variable names are not forbidden. */
+ parser->local_variables_forbidden_p = false;
+
+ /* We are not processing an `extern "C"' declaration. */
+ parser->in_unbraced_linkage_specification_p = false;
+
+ /* We are not processing a declarator. */
+ parser->in_declarator_p = false;
+
+ /* We are not processing a template-argument-list. */
+ parser->in_template_argument_list_p = false;
+
+ /* We are not in an iteration statement. */
+ parser->in_iteration_statement_p = false;
+
+ /* We are not in a switch statement. */
+ parser->in_switch_statement_p = false;
+
+ /* We are not parsing a type-id inside an expression. */
+ parser->in_type_id_in_expr_p = false;
+
+ /* The unparsed function queue is empty. */
+ parser->unparsed_functions_queues = build_tree_list (NULL_TREE, NULL_TREE);
+
+ /* There are no classes being defined. */
+ parser->num_classes_being_defined = 0;
+
+ /* No template parameters apply. */
+ parser->num_template_parameter_lists = 0;
+
+ return parser;
+}
+
+/* Lexical conventions [gram.lex] */
+
+/* Parse an identifier. Returns an IDENTIFIER_NODE representing the
+ identifier. */
+
+static tree
+cp_parser_identifier (cp_parser* parser)
+{
+ cp_token *token;
+
+ /* Look for the identifier. */
+ token = cp_parser_require (parser, CPP_NAME, "identifier");
+ /* Return the value. */
+ return token ? token->value : error_mark_node;
+}
+
+/* Basic concepts [gram.basic] */
+
+/* Parse a translation-unit.
+
+ translation-unit:
+ declaration-seq [opt]
+
+ Returns TRUE if all went well. */
+
+static bool
+cp_parser_translation_unit (cp_parser* parser)
+{
+ while (true)
+ {
+ cp_parser_declaration_seq_opt (parser);
+
+ /* If there are no tokens left then all went well. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_EOF))
+ break;
+
+ /* Otherwise, issue an error message. */
+ cp_parser_error (parser, "expected declaration");
+ return false;
+ }
+
+ /* Consume the EOF token. */
+ cp_parser_require (parser, CPP_EOF, "end-of-file");
+
+ /* Finish up. */
+ finish_translation_unit ();
+
+ /* All went well. */
+ return true;
+}
+
+/* Expressions [gram.expr] */
+
+/* Parse a primary-expression.
+
+ primary-expression:
+ literal
+ this
+ ( expression )
+ id-expression
+
+ GNU Extensions:
+
+ primary-expression:
+ ( compound-statement )
+ __builtin_va_arg ( assignment-expression , type-id )
+
+ literal:
+ __null
+
+ Returns a representation of the expression.
+
+ *IDK indicates what kind of id-expression (if any) was present.
+
+ *QUALIFYING_CLASS is set to a non-NULL value if the id-expression can be
+ used as the operand of a pointer-to-member. In that case,
+ *QUALIFYING_CLASS gives the class that is used as the qualifying
+ class in the pointer-to-member. */
+
+static tree
+cp_parser_primary_expression (cp_parser *parser,
+ cp_id_kind *idk,
+ tree *qualifying_class)
+{
+ cp_token *token;
+
+ /* Assume the primary expression is not an id-expression. */
+ *idk = CP_ID_KIND_NONE;
+ /* And that it cannot be used as pointer-to-member. */
+ *qualifying_class = NULL_TREE;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ switch (token->type)
+ {
+ /* literal:
+ integer-literal
+ character-literal
+ floating-literal
+ string-literal
+ boolean-literal */
+ case CPP_CHAR:
+ case CPP_WCHAR:
+ case CPP_STRING:
+ case CPP_WSTRING:
+ case CPP_NUMBER:
+ token = cp_lexer_consume_token (parser->lexer);
+ return token->value;
+
+ case CPP_OPEN_PAREN:
+ {
+ tree expr;
+ bool saved_greater_than_is_operator_p;
+
+ /* Consume the `('. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Within a parenthesized expression, a `>' token is always
+ the greater-than operator. */
+ saved_greater_than_is_operator_p
+ = parser->greater_than_is_operator_p;
+ parser->greater_than_is_operator_p = true;
+ /* If we see `( { ' then we are looking at the beginning of
+ a GNU statement-expression. */
+ if (cp_parser_allow_gnu_extensions_p (parser)
+ && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ /* Statement-expressions are not allowed by the standard. */
+ if (pedantic)
+ pedwarn ("ISO C++ forbids braced-groups within expressions");
+
+ /* And they're not allowed outside of a function-body; you
+ cannot, for example, write:
+
+ int i = ({ int j = 3; j + 1; });
+
+ at class or namespace scope. */
+ if (!at_function_scope_p ())
+ error ("statement-expressions are allowed only inside functions");
+ /* Start the statement-expression. */
+ expr = begin_stmt_expr ();
+ /* Parse the compound-statement. */
+ cp_parser_compound_statement (parser, true);
+ /* Finish up. */
+ expr = finish_stmt_expr (expr, false);
+ }
+ else
+ {
+ /* Parse the parenthesized expression. */
+ expr = cp_parser_expression (parser);
+ /* Let the front end know that this expression was
+ enclosed in parentheses. This matters in case, for
+ example, the expression is of the form `A::B', since
+ `&A::B' might be a pointer-to-member, but `&(A::B)' is
+ not. */
+ finish_parenthesized_expr (expr);
+ }
+ /* The `>' token might be the end of a template-id or
+ template-parameter-list now. */
+ parser->greater_than_is_operator_p
+ = saved_greater_than_is_operator_p;
+ /* Consume the `)'. */
+ if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"))
+ cp_parser_skip_to_end_of_statement (parser);
+
+ return expr;
+ }
+
+ case CPP_KEYWORD:
+ switch (token->keyword)
+ {
+ /* These two are the boolean literals. */
+ case RID_TRUE:
+ cp_lexer_consume_token (parser->lexer);
+ return boolean_true_node;
+ case RID_FALSE:
+ cp_lexer_consume_token (parser->lexer);
+ return boolean_false_node;
+
+ /* The `__null' literal. */
+ case RID_NULL:
+ cp_lexer_consume_token (parser->lexer);
+ return null_node;
+
+ /* Recognize the `this' keyword. */
+ case RID_THIS:
+ cp_lexer_consume_token (parser->lexer);
+ if (parser->local_variables_forbidden_p)
+ {
+ error ("`this' may not be used in this context");
+ return error_mark_node;
+ }
+ /* Pointers cannot appear in constant-expressions. */
+ if (cp_parser_non_integral_constant_expression (parser,
+ "`this'"))
+ return error_mark_node;
+ return finish_this_expr ();
+
+ /* The `operator' keyword can be the beginning of an
+ id-expression. */
+ case RID_OPERATOR:
+ goto id_expression;
+
+ case RID_FUNCTION_NAME:
+ case RID_PRETTY_FUNCTION_NAME:
+ case RID_C99_FUNCTION_NAME:
+ /* The symbols __FUNCTION__, __PRETTY_FUNCTION__, and
+ __func__ are the names of variables -- but they are
+ treated specially. Therefore, they are handled here,
+ rather than relying on the generic id-expression logic
+ below. Grammatically, these names are id-expressions.
+
+ Consume the token. */
+ token = cp_lexer_consume_token (parser->lexer);
+ /* Look up the name. */
+ return finish_fname (token->value);
+
+ case RID_VA_ARG:
+ {
+ tree expression;
+ tree type;
+
+ /* The `__builtin_va_arg' construct is used to handle
+ `va_arg'. Consume the `__builtin_va_arg' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the opening `('. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ /* Now, parse the assignment-expression. */
+ expression = cp_parser_assignment_expression (parser);
+ /* Look for the `,'. */
+ cp_parser_require (parser, CPP_COMMA, "`,'");
+ /* Parse the type-id. */
+ type = cp_parser_type_id (parser);
+ /* Look for the closing `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ /* Using `va_arg' in a constant-expression is not
+ allowed. */
+ if (cp_parser_non_integral_constant_expression (parser,
+ "`va_arg'"))
+ return error_mark_node;
+ return build_x_va_arg (expression, type);
+ }
+
+ case RID_OFFSETOF:
+ {
+ tree expression;
+ bool saved_in_offsetof_p;
+
+ /* Consume the "__offsetof__" token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Consume the opening `('. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ /* Parse the parenthesized (almost) constant-expression. */
+ saved_in_offsetof_p = parser->in_offsetof_p;
+ parser->in_offsetof_p = true;
+ expression
+ = cp_parser_constant_expression (parser,
+ /*allow_non_constant_p=*/false,
+ /*non_constant_p=*/NULL);
+ parser->in_offsetof_p = saved_in_offsetof_p;
+ /* Consume the closing ')'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+
+ return expression;
+ }
+
+ default:
+ cp_parser_error (parser, "expected primary-expression");
+ return error_mark_node;
+ }
+
+ /* An id-expression can start with either an identifier, a
+ `::' as the beginning of a qualified-id, or the "operator"
+ keyword. */
+ case CPP_NAME:
+ case CPP_SCOPE:
+ case CPP_TEMPLATE_ID:
+ case CPP_NESTED_NAME_SPECIFIER:
+ {
+ tree id_expression;
+ tree decl;
+ const char *error_msg;
+
+ id_expression:
+ /* Parse the id-expression. */
+ id_expression
+ = cp_parser_id_expression (parser,
+ /*template_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*template_p=*/NULL,
+ /*declarator_p=*/false);
+ if (id_expression == error_mark_node)
+ return error_mark_node;
+ /* If we have a template-id, then no further lookup is
+ required. If the template-id was for a template-class, we
+ will sometimes have a TYPE_DECL at this point. */
+ else if (TREE_CODE (id_expression) == TEMPLATE_ID_EXPR
+ || TREE_CODE (id_expression) == TYPE_DECL)
+ decl = id_expression;
+ /* Look up the name. */
+ else
+ {
+ decl = cp_parser_lookup_name_simple (parser, id_expression);
+ /* If name lookup gives us a SCOPE_REF, then the
+ qualifying scope was dependent. Just propagate the
+ name. */
+ if (TREE_CODE (decl) == SCOPE_REF)
+ {
+ if (TYPE_P (TREE_OPERAND (decl, 0)))
+ *qualifying_class = TREE_OPERAND (decl, 0);
+ return decl;
+ }
+ /* Check to see if DECL is a local variable in a context
+ where that is forbidden. */
+ if (parser->local_variables_forbidden_p
+ && local_variable_p (decl))
+ {
+ /* It might be that we only found DECL because we are
+ trying to be generous with pre-ISO scoping rules.
+ For example, consider:
+
+ int i;
+ void g() {
+ for (int i = 0; i < 10; ++i) {}
+ extern void f(int j = i);
+ }
+
+ Here, name look up will originally find the out
+ of scope `i'. We need to issue a warning message,
+ but then use the global `i'. */
+ decl = check_for_out_of_scope_variable (decl);
+ if (local_variable_p (decl))
+ {
+ error ("local variable `%D' may not appear in this context",
+ decl);
+ return error_mark_node;
+ }
+ }
+ }
+
+ decl = finish_id_expression (id_expression, decl, parser->scope,
+ idk, qualifying_class,
+ parser->integral_constant_expression_p,
+ parser->allow_non_integral_constant_expression_p,
+ &parser->non_integral_constant_expression_p,
+ &error_msg);
+ if (error_msg)
+ cp_parser_error (parser, error_msg);
+ return decl;
+ }
+
+ /* Anything else is an error. */
+ default:
+ cp_parser_error (parser, "expected primary-expression");
+ return error_mark_node;
+ }
+}
+
+/* Parse an id-expression.
+
+ id-expression:
+ unqualified-id
+ qualified-id
+
+ qualified-id:
+ :: [opt] nested-name-specifier template [opt] unqualified-id
+ :: identifier
+ :: operator-function-id
+ :: template-id
+
+ Return a representation of the unqualified portion of the
+ identifier. Sets PARSER->SCOPE to the qualifying scope if there is
+ a `::' or nested-name-specifier.
+
+ Often, if the id-expression was a qualified-id, the caller will
+ want to make a SCOPE_REF to represent the qualified-id. This
+ function does not do this in order to avoid wastefully creating
+ SCOPE_REFs when they are not required.
+
+ If TEMPLATE_KEYWORD_P is true, then we have just seen the
+ `template' keyword.
+
+ If CHECK_DEPENDENCY_P is false, then names are looked up inside
+ uninstantiated templates.
+
+ If *TEMPLATE_P is non-NULL, it is set to true iff the
+ `template' keyword is used to explicitly indicate that the entity
+ named is a template.
+
+ If DECLARATOR_P is true, the id-expression is appearing as part of
+ a declarator, rather than as part of an expression. */
+
+static tree
+cp_parser_id_expression (cp_parser *parser,
+ bool template_keyword_p,
+ bool check_dependency_p,
+ bool *template_p,
+ bool declarator_p)
+{
+ bool global_scope_p;
+ bool nested_name_specifier_p;
+
+ /* Assume the `template' keyword was not used. */
+ if (template_p)
+ *template_p = false;
+
+ /* Look for the optional `::' operator. */
+ global_scope_p
+ = (cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/false)
+ != NULL_TREE);
+ /* Look for the optional nested-name-specifier. */
+ nested_name_specifier_p
+ = (cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/false,
+ check_dependency_p,
+ /*type_p=*/false,
+ /*is_declarator=*/false)
+ != NULL_TREE);
+ /* If there is a nested-name-specifier, then we are looking at
+ the first qualified-id production. */
+ if (nested_name_specifier_p)
+ {
+ tree saved_scope;
+ tree saved_object_scope;
+ tree saved_qualifying_scope;
+ tree unqualified_id;
+ bool is_template;
+
+ /* See if the next token is the `template' keyword. */
+ if (!template_p)
+ template_p = &is_template;
+ *template_p = cp_parser_optional_template_keyword (parser);
+ /* Name lookup we do during the processing of the
+ unqualified-id might obliterate SCOPE. */
+ saved_scope = parser->scope;
+ saved_object_scope = parser->object_scope;
+ saved_qualifying_scope = parser->qualifying_scope;
+ /* Process the final unqualified-id. */
+ unqualified_id = cp_parser_unqualified_id (parser, *template_p,
+ check_dependency_p,
+ declarator_p);
+ /* Restore the SAVED_SCOPE for our caller. */
+ parser->scope = saved_scope;
+ parser->object_scope = saved_object_scope;
+ parser->qualifying_scope = saved_qualifying_scope;
+
+ return unqualified_id;
+ }
+ /* Otherwise, if we are in global scope, then we are looking at one
+ of the other qualified-id productions. */
+ else if (global_scope_p)
+ {
+ cp_token *token;
+ tree id;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ /* If it's an identifier, and the next token is not a "<", then
+ we can avoid the template-id case. This is an optimization
+ for this common case. */
+ if (token->type == CPP_NAME
+ && !cp_parser_nth_token_starts_template_argument_list_p
+ (parser, 2))
+ return cp_parser_identifier (parser);
+
+ cp_parser_parse_tentatively (parser);
+ /* Try a template-id. */
+ id = cp_parser_template_id (parser,
+ /*template_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ declarator_p);
+ /* If that worked, we're done. */
+ if (cp_parser_parse_definitely (parser))
+ return id;
+
+ /* Peek at the next token. (Changes in the token buffer may
+ have invalidated the pointer obtained above.) */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ switch (token->type)
+ {
+ case CPP_NAME:
+ return cp_parser_identifier (parser);
+
+ case CPP_KEYWORD:
+ if (token->keyword == RID_OPERATOR)
+ return cp_parser_operator_function_id (parser);
+ /* Fall through. */
+
+ default:
+ cp_parser_error (parser, "expected id-expression");
+ return error_mark_node;
+ }
+ }
+ else
+ return cp_parser_unqualified_id (parser, template_keyword_p,
+ /*check_dependency_p=*/true,
+ declarator_p);
+}
+
+/* Parse an unqualified-id.
+
+ unqualified-id:
+ identifier
+ operator-function-id
+ conversion-function-id
+ ~ class-name
+ template-id
+
+ If TEMPLATE_KEYWORD_P is TRUE, we have just seen the `template'
+ keyword, in a construct like `A::template ...'.
+
+ Returns a representation of unqualified-id. For the `identifier'
+ production, an IDENTIFIER_NODE is returned. For the `~ class-name'
+ production a BIT_NOT_EXPR is returned; the operand of the
+ BIT_NOT_EXPR is an IDENTIFIER_NODE for the class-name. For the
+ other productions, see the documentation accompanying the
+ corresponding parsing functions. If CHECK_DEPENDENCY_P is false,
+ names are looked up in uninstantiated templates. If DECLARATOR_P
+ is true, the unqualified-id is appearing as part of a declarator,
+ rather than as part of an expression. */
+
+static tree
+cp_parser_unqualified_id (cp_parser* parser,
+ bool template_keyword_p,
+ bool check_dependency_p,
+ bool declarator_p)
+{
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ switch (token->type)
+ {
+ case CPP_NAME:
+ {
+ tree id;
+
+ /* We don't know yet whether or not this will be a
+ template-id. */
+ cp_parser_parse_tentatively (parser);
+ /* Try a template-id. */
+ id = cp_parser_template_id (parser, template_keyword_p,
+ check_dependency_p,
+ declarator_p);
+ /* If it worked, we're done. */
+ if (cp_parser_parse_definitely (parser))
+ return id;
+ /* Otherwise, it's an ordinary identifier. */
+ return cp_parser_identifier (parser);
+ }
+
+ case CPP_TEMPLATE_ID:
+ return cp_parser_template_id (parser, template_keyword_p,
+ check_dependency_p,
+ declarator_p);
+
+ case CPP_COMPL:
+ {
+ tree type_decl;
+ tree qualifying_scope;
+ tree object_scope;
+ tree scope;
+
+ /* Consume the `~' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the class-name. The standard, as written, seems to
+ say that:
+
+ template <typename T> struct S { ~S (); };
+ template <typename T> S<T>::~S() {}
+
+ is invalid, since `~' must be followed by a class-name, but
+ `S<T>' is dependent, and so not known to be a class.
+ That's not right; we need to look in uninstantiated
+ templates. A further complication arises from:
+
+ template <typename T> void f(T t) {
+ t.T::~T();
+ }
+
+ Here, it is not possible to look up `T' in the scope of `T'
+ itself. We must look in both the current scope, and the
+ scope of the containing complete expression.
+
+ Yet another issue is:
+
+ struct S {
+ int S;
+ ~S();
+ };
+
+ S::~S() {}
+
+ The standard does not seem to say that the `S' in `~S'
+ should refer to the type `S' and not the data member
+ `S::S'. */
+
+ /* DR 244 says that we look up the name after the "~" in the
+ same scope as we looked up the qualifying name. That idea
+ isn't fully worked out; it's more complicated than that. */
+ scope = parser->scope;
+ object_scope = parser->object_scope;
+ qualifying_scope = parser->qualifying_scope;
+
+ /* If the name is of the form "X::~X" it's OK. */
+ if (scope && TYPE_P (scope)
+ && cp_lexer_next_token_is (parser->lexer, CPP_NAME)
+ && (cp_lexer_peek_nth_token (parser->lexer, 2)->type
+ == CPP_OPEN_PAREN)
+ && (cp_lexer_peek_token (parser->lexer)->value
+ == TYPE_IDENTIFIER (scope)))
+ {
+ cp_lexer_consume_token (parser->lexer);
+ return build_nt (BIT_NOT_EXPR, scope);
+ }
+
+ /* If there was an explicit qualification (S::~T), first look
+ in the scope given by the qualification (i.e., S). */
+ if (scope)
+ {
+ cp_parser_parse_tentatively (parser);
+ type_decl = cp_parser_class_name (parser,
+ /*typename_keyword_p=*/false,
+ /*template_keyword_p=*/false,
+ /*type_p=*/false,
+ /*check_dependency=*/false,
+ /*class_head_p=*/false,
+ declarator_p);
+ if (cp_parser_parse_definitely (parser))
+ return build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl));
+ }
+ /* In "N::S::~S", look in "N" as well. */
+ if (scope && qualifying_scope)
+ {
+ cp_parser_parse_tentatively (parser);
+ parser->scope = qualifying_scope;
+ parser->object_scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ type_decl
+ = cp_parser_class_name (parser,
+ /*typename_keyword_p=*/false,
+ /*template_keyword_p=*/false,
+ /*type_p=*/false,
+ /*check_dependency=*/false,
+ /*class_head_p=*/false,
+ declarator_p);
+ if (cp_parser_parse_definitely (parser))
+ return build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl));
+ }
+ /* In "p->S::~T", look in the scope given by "*p" as well. */
+ else if (object_scope)
+ {
+ cp_parser_parse_tentatively (parser);
+ parser->scope = object_scope;
+ parser->object_scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ type_decl
+ = cp_parser_class_name (parser,
+ /*typename_keyword_p=*/false,
+ /*template_keyword_p=*/false,
+ /*type_p=*/false,
+ /*check_dependency=*/false,
+ /*class_head_p=*/false,
+ declarator_p);
+ if (cp_parser_parse_definitely (parser))
+ return build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl));
+ }
+ /* Look in the surrounding context. */
+ parser->scope = NULL_TREE;
+ parser->object_scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ type_decl
+ = cp_parser_class_name (parser,
+ /*typename_keyword_p=*/false,
+ /*template_keyword_p=*/false,
+ /*type_p=*/false,
+ /*check_dependency=*/false,
+ /*class_head_p=*/false,
+ declarator_p);
+ /* If an error occurred, assume that the name of the
+ destructor is the same as the name of the qualifying
+ class. That allows us to keep parsing after running
+ into ill-formed destructor names. */
+ if (type_decl == error_mark_node && scope && TYPE_P (scope))
+ return build_nt (BIT_NOT_EXPR, scope);
+ else if (type_decl == error_mark_node)
+ return error_mark_node;
+
+ /* [class.dtor]
+
+ A typedef-name that names a class shall not be used as the
+ identifier in the declarator for a destructor declaration. */
+ if (declarator_p
+ && !DECL_IMPLICIT_TYPEDEF_P (type_decl)
+ && !DECL_SELF_REFERENCE_P (type_decl))
+ error ("typedef-name `%D' used as destructor declarator",
+ type_decl);
+
+ return build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl));
+ }
+
+ case CPP_KEYWORD:
+ if (token->keyword == RID_OPERATOR)
+ {
+ tree id;
+
+ /* This could be a template-id, so we try that first. */
+ cp_parser_parse_tentatively (parser);
+ /* Try a template-id. */
+ id = cp_parser_template_id (parser, template_keyword_p,
+ /*check_dependency_p=*/true,
+ declarator_p);
+ /* If that worked, we're done. */
+ if (cp_parser_parse_definitely (parser))
+ return id;
+ /* We still don't know whether we're looking at an
+ operator-function-id or a conversion-function-id. */
+ cp_parser_parse_tentatively (parser);
+ /* Try an operator-function-id. */
+ id = cp_parser_operator_function_id (parser);
+ /* If that didn't work, try a conversion-function-id. */
+ if (!cp_parser_parse_definitely (parser))
+ id = cp_parser_conversion_function_id (parser);
+
+ return id;
+ }
+ /* Fall through. */
+
+ default:
+ cp_parser_error (parser, "expected unqualified-id");
+ return error_mark_node;
+ }
+}
+
+/* Parse an (optional) nested-name-specifier.
+
+ nested-name-specifier:
+ class-or-namespace-name :: nested-name-specifier [opt]
+ class-or-namespace-name :: template nested-name-specifier [opt]
+
+ PARSER->SCOPE should be set appropriately before this function is
+ called. TYPENAME_KEYWORD_P is TRUE if the `typename' keyword is in
+ effect. TYPE_P is TRUE if we non-type bindings should be ignored
+ in name lookups.
+
+ Sets PARSER->SCOPE to the class (TYPE) or namespace
+ (NAMESPACE_DECL) specified by the nested-name-specifier, or leaves
+ it unchanged if there is no nested-name-specifier. Returns the new
+ scope iff there is a nested-name-specifier, or NULL_TREE otherwise.
+
+ If IS_DECLARATION is TRUE, the nested-name-specifier is known to be
+ part of a declaration and/or decl-specifier. */
+
+static tree
+cp_parser_nested_name_specifier_opt (cp_parser *parser,
+ bool typename_keyword_p,
+ bool check_dependency_p,
+ bool type_p,
+ bool is_declaration)
+{
+ bool success = false;
+ tree access_check = NULL_TREE;
+ ptrdiff_t start;
+ cp_token* token;
+
+ /* If the next token corresponds to a nested name specifier, there
+ is no need to reparse it. However, if CHECK_DEPENDENCY_P is
+ false, it may have been true before, in which case something
+ like `A<X>::B<Y>::C' may have resulted in a nested-name-specifier
+ of `A<X>::', where it should now be `A<X>::B<Y>::'. So, when
+ CHECK_DEPENDENCY_P is false, we have to fall through into the
+ main loop. */
+ if (check_dependency_p
+ && cp_lexer_next_token_is (parser->lexer, CPP_NESTED_NAME_SPECIFIER))
+ {
+ cp_parser_pre_parsed_nested_name_specifier (parser);
+ return parser->scope;
+ }
+
+ /* Remember where the nested-name-specifier starts. */
+ if (cp_parser_parsing_tentatively (parser)
+ && !cp_parser_committed_to_tentative_parse (parser))
+ {
+ token = cp_lexer_peek_token (parser->lexer);
+ start = cp_lexer_token_difference (parser->lexer,
+ parser->lexer->first_token,
+ token);
+ }
+ else
+ start = -1;
+
+ push_deferring_access_checks (dk_deferred);
+
+ while (true)
+ {
+ tree new_scope;
+ tree old_scope;
+ tree saved_qualifying_scope;
+ bool template_keyword_p;
+
+ /* Spot cases that cannot be the beginning of a
+ nested-name-specifier. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ /* If the next token is CPP_NESTED_NAME_SPECIFIER, just process
+ the already parsed nested-name-specifier. */
+ if (token->type == CPP_NESTED_NAME_SPECIFIER)
+ {
+ /* Grab the nested-name-specifier and continue the loop. */
+ cp_parser_pre_parsed_nested_name_specifier (parser);
+ success = true;
+ continue;
+ }
+
+ /* Spot cases that cannot be the beginning of a
+ nested-name-specifier. On the second and subsequent times
+ through the loop, we look for the `template' keyword. */
+ if (success && token->keyword == RID_TEMPLATE)
+ ;
+ /* A template-id can start a nested-name-specifier. */
+ else if (token->type == CPP_TEMPLATE_ID)
+ ;
+ else
+ {
+ /* If the next token is not an identifier, then it is
+ definitely not a class-or-namespace-name. */
+ if (token->type != CPP_NAME)
+ break;
+ /* If the following token is neither a `<' (to begin a
+ template-id), nor a `::', then we are not looking at a
+ nested-name-specifier. */
+ token = cp_lexer_peek_nth_token (parser->lexer, 2);
+ if (token->type != CPP_SCOPE
+ && !cp_parser_nth_token_starts_template_argument_list_p
+ (parser, 2))
+ break;
+ }
+
+ /* The nested-name-specifier is optional, so we parse
+ tentatively. */
+ cp_parser_parse_tentatively (parser);
+
+ /* Look for the optional `template' keyword, if this isn't the
+ first time through the loop. */
+ if (success)
+ template_keyword_p = cp_parser_optional_template_keyword (parser);
+ else
+ template_keyword_p = false;
+
+ /* Save the old scope since the name lookup we are about to do
+ might destroy it. */
+ old_scope = parser->scope;
+ saved_qualifying_scope = parser->qualifying_scope;
+ /* Parse the qualifying entity. */
+ new_scope
+ = cp_parser_class_or_namespace_name (parser,
+ typename_keyword_p,
+ template_keyword_p,
+ check_dependency_p,
+ type_p,
+ is_declaration);
+ /* Look for the `::' token. */
+ cp_parser_require (parser, CPP_SCOPE, "`::'");
+
+ /* If we found what we wanted, we keep going; otherwise, we're
+ done. */
+ if (!cp_parser_parse_definitely (parser))
+ {
+ bool error_p = false;
+
+ /* Restore the OLD_SCOPE since it was valid before the
+ failed attempt at finding the last
+ class-or-namespace-name. */
+ parser->scope = old_scope;
+ parser->qualifying_scope = saved_qualifying_scope;
+ /* If the next token is an identifier, and the one after
+ that is a `::', then any valid interpretation would have
+ found a class-or-namespace-name. */
+ while (cp_lexer_next_token_is (parser->lexer, CPP_NAME)
+ && (cp_lexer_peek_nth_token (parser->lexer, 2)->type
+ == CPP_SCOPE)
+ && (cp_lexer_peek_nth_token (parser->lexer, 3)->type
+ != CPP_COMPL))
+ {
+ token = cp_lexer_consume_token (parser->lexer);
+ if (!error_p)
+ {
+ tree decl;
+
+ decl = cp_parser_lookup_name_simple (parser, token->value);
+ if (TREE_CODE (decl) == TEMPLATE_DECL)
+ error ("`%D' used without template parameters",
+ decl);
+ else
+ cp_parser_name_lookup_error
+ (parser, token->value, decl,
+ "is not a class or namespace");
+ parser->scope = NULL_TREE;
+ error_p = true;
+ /* Treat this as a successful nested-name-specifier
+ due to:
+
+ [basic.lookup.qual]
+
+ If the name found is not a class-name (clause
+ _class_) or namespace-name (_namespace.def_), the
+ program is ill-formed. */
+ success = true;
+ }
+ cp_lexer_consume_token (parser->lexer);
+ }
+ break;
+ }
+
+ /* We've found one valid nested-name-specifier. */
+ success = true;
+ /* Make sure we look in the right scope the next time through
+ the loop. */
+ parser->scope = (TREE_CODE (new_scope) == TYPE_DECL
+ ? TREE_TYPE (new_scope)
+ : new_scope);
+ /* If it is a class scope, try to complete it; we are about to
+ be looking up names inside the class. */
+ if (TYPE_P (parser->scope)
+ /* Since checking types for dependency can be expensive,
+ avoid doing it if the type is already complete. */
+ && !COMPLETE_TYPE_P (parser->scope)
+ /* Do not try to complete dependent types. */
+ && !dependent_type_p (parser->scope))
+ complete_type (parser->scope);
+ }
+
+ /* Retrieve any deferred checks. Do not pop this access checks yet
+ so the memory will not be reclaimed during token replacing below. */
+ access_check = get_deferred_access_checks ();
+
+ /* If parsing tentatively, replace the sequence of tokens that makes
+ up the nested-name-specifier with a CPP_NESTED_NAME_SPECIFIER
+ token. That way, should we re-parse the token stream, we will
+ not have to repeat the effort required to do the parse, nor will
+ we issue duplicate error messages. */
+ if (success && start >= 0)
+ {
+ /* Find the token that corresponds to the start of the
+ template-id. */
+ token = cp_lexer_advance_token (parser->lexer,
+ parser->lexer->first_token,
+ start);
+
+ /* Reset the contents of the START token. */
+ token->type = CPP_NESTED_NAME_SPECIFIER;
+ token->value = build_tree_list (access_check, parser->scope);
+ TREE_TYPE (token->value) = parser->qualifying_scope;
+ token->keyword = RID_MAX;
+ /* Purge all subsequent tokens. */
+ cp_lexer_purge_tokens_after (parser->lexer, token);
+ }
+
+ pop_deferring_access_checks ();
+ return success ? parser->scope : NULL_TREE;
+}
+
+/* Parse a nested-name-specifier. See
+ cp_parser_nested_name_specifier_opt for details. This function
+ behaves identically, except that it will an issue an error if no
+ nested-name-specifier is present, and it will return
+ ERROR_MARK_NODE, rather than NULL_TREE, if no nested-name-specifier
+ is present. */
+
+static tree
+cp_parser_nested_name_specifier (cp_parser *parser,
+ bool typename_keyword_p,
+ bool check_dependency_p,
+ bool type_p,
+ bool is_declaration)
+{
+ tree scope;
+
+ /* Look for the nested-name-specifier. */
+ scope = cp_parser_nested_name_specifier_opt (parser,
+ typename_keyword_p,
+ check_dependency_p,
+ type_p,
+ is_declaration);
+ /* If it was not present, issue an error message. */
+ if (!scope)
+ {
+ cp_parser_error (parser, "expected nested-name-specifier");
+ parser->scope = NULL_TREE;
+ return error_mark_node;
+ }
+
+ return scope;
+}
+
+/* Parse a class-or-namespace-name.
+
+ class-or-namespace-name:
+ class-name
+ namespace-name
+
+ TYPENAME_KEYWORD_P is TRUE iff the `typename' keyword is in effect.
+ TEMPLATE_KEYWORD_P is TRUE iff the `template' keyword is in effect.
+ CHECK_DEPENDENCY_P is FALSE iff dependent names should be looked up.
+ TYPE_P is TRUE iff the next name should be taken as a class-name,
+ even the same name is declared to be another entity in the same
+ scope.
+
+ Returns the class (TYPE_DECL) or namespace (NAMESPACE_DECL)
+ specified by the class-or-namespace-name. If neither is found the
+ ERROR_MARK_NODE is returned. */
+
+static tree
+cp_parser_class_or_namespace_name (cp_parser *parser,
+ bool typename_keyword_p,
+ bool template_keyword_p,
+ bool check_dependency_p,
+ bool type_p,
+ bool is_declaration)
+{
+ tree saved_scope;
+ tree saved_qualifying_scope;
+ tree saved_object_scope;
+ tree scope;
+ bool only_class_p;
+
+ /* Before we try to parse the class-name, we must save away the
+ current PARSER->SCOPE since cp_parser_class_name will destroy
+ it. */
+ saved_scope = parser->scope;
+ saved_qualifying_scope = parser->qualifying_scope;
+ saved_object_scope = parser->object_scope;
+ /* Try for a class-name first. If the SAVED_SCOPE is a type, then
+ there is no need to look for a namespace-name. */
+ only_class_p = template_keyword_p || (saved_scope && TYPE_P (saved_scope));
+ if (!only_class_p)
+ cp_parser_parse_tentatively (parser);
+ scope = cp_parser_class_name (parser,
+ typename_keyword_p,
+ template_keyword_p,
+ type_p,
+ check_dependency_p,
+ /*class_head_p=*/false,
+ is_declaration);
+ /* If that didn't work, try for a namespace-name. */
+ if (!only_class_p && !cp_parser_parse_definitely (parser))
+ {
+ /* Restore the saved scope. */
+ parser->scope = saved_scope;
+ parser->qualifying_scope = saved_qualifying_scope;
+ parser->object_scope = saved_object_scope;
+ /* If we are not looking at an identifier followed by the scope
+ resolution operator, then this is not part of a
+ nested-name-specifier. (Note that this function is only used
+ to parse the components of a nested-name-specifier.) */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_NAME)
+ || cp_lexer_peek_nth_token (parser->lexer, 2)->type != CPP_SCOPE)
+ return error_mark_node;
+ scope = cp_parser_namespace_name (parser);
+ }
+
+ return scope;
+}
+
+/* Parse a postfix-expression.
+
+ postfix-expression:
+ primary-expression
+ postfix-expression [ expression ]
+ postfix-expression ( expression-list [opt] )
+ simple-type-specifier ( expression-list [opt] )
+ typename :: [opt] nested-name-specifier identifier
+ ( expression-list [opt] )
+ typename :: [opt] nested-name-specifier template [opt] template-id
+ ( expression-list [opt] )
+ postfix-expression . template [opt] id-expression
+ postfix-expression -> template [opt] id-expression
+ postfix-expression . pseudo-destructor-name
+ postfix-expression -> pseudo-destructor-name
+ postfix-expression ++
+ postfix-expression --
+ dynamic_cast < type-id > ( expression )
+ static_cast < type-id > ( expression )
+ reinterpret_cast < type-id > ( expression )
+ const_cast < type-id > ( expression )
+ typeid ( expression )
+ typeid ( type-id )
+
+ GNU Extension:
+
+ postfix-expression:
+ ( type-id ) { initializer-list , [opt] }
+
+ This extension is a GNU version of the C99 compound-literal
+ construct. (The C99 grammar uses `type-name' instead of `type-id',
+ but they are essentially the same concept.)
+
+ If ADDRESS_P is true, the postfix expression is the operand of the
+ `&' operator.
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_postfix_expression (cp_parser *parser, bool address_p)
+{
+ cp_token *token;
+ enum rid keyword;
+ cp_id_kind idk = CP_ID_KIND_NONE;
+ tree postfix_expression = NULL_TREE;
+ /* Non-NULL only if the current postfix-expression can be used to
+ form a pointer-to-member. In that case, QUALIFYING_CLASS is the
+ class used to qualify the member. */
+ tree qualifying_class = NULL_TREE;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* Some of the productions are determined by keywords. */
+ keyword = token->keyword;
+ switch (keyword)
+ {
+ case RID_DYNCAST:
+ case RID_STATCAST:
+ case RID_REINTCAST:
+ case RID_CONSTCAST:
+ {
+ tree type;
+ tree expression;
+ const char *saved_message;
+
+ /* All of these can be handled in the same way from the point
+ of view of parsing. Begin by consuming the token
+ identifying the cast. */
+ cp_lexer_consume_token (parser->lexer);
+
+ /* New types cannot be defined in the cast. */
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = "types may not be defined in casts";
+
+ /* Look for the opening `<'. */
+ cp_parser_require (parser, CPP_LESS, "`<'");
+ /* Parse the type to which we are casting. */
+ type = cp_parser_type_id (parser);
+ /* Look for the closing `>'. */
+ cp_parser_require (parser, CPP_GREATER, "`>'");
+ /* Restore the old message. */
+ parser->type_definition_forbidden_message = saved_message;
+
+ /* And the expression which is being cast. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ expression = cp_parser_expression (parser);
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+
+ /* Only type conversions to integral or enumeration types
+ can be used in constant-expressions. */
+ if (parser->integral_constant_expression_p
+ && !dependent_type_p (type)
+ && !INTEGRAL_OR_ENUMERATION_TYPE_P (type)
+ /* A cast to pointer or reference type is allowed in the
+ implementation of "offsetof". */
+ && !(parser->in_offsetof_p && POINTER_TYPE_P (type))
+ && (cp_parser_non_integral_constant_expression
+ (parser,
+ "a cast to a type other than an integral or "
+ "enumeration type")))
+ return error_mark_node;
+
+ switch (keyword)
+ {
+ case RID_DYNCAST:
+ postfix_expression
+ = build_dynamic_cast (type, expression);
+ break;
+ case RID_STATCAST:
+ postfix_expression
+ = build_static_cast (type, expression);
+ break;
+ case RID_REINTCAST:
+ postfix_expression
+ = build_reinterpret_cast (type, expression);
+ break;
+ case RID_CONSTCAST:
+ postfix_expression
+ = build_const_cast (type, expression);
+ break;
+ default:
+ abort ();
+ }
+ }
+ break;
+
+ case RID_TYPEID:
+ {
+ tree type;
+ const char *saved_message;
+ bool saved_in_type_id_in_expr_p;
+
+ /* Consume the `typeid' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the `(' token. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ /* Types cannot be defined in a `typeid' expression. */
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = "types may not be defined in a `typeid\' expression";
+ /* We can't be sure yet whether we're looking at a type-id or an
+ expression. */
+ cp_parser_parse_tentatively (parser);
+ /* Try a type-id first. */
+ saved_in_type_id_in_expr_p = parser->in_type_id_in_expr_p;
+ parser->in_type_id_in_expr_p = true;
+ type = cp_parser_type_id (parser);
+ parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p;
+ /* Look for the `)' token. Otherwise, we can't be sure that
+ we're not looking at an expression: consider `typeid (int
+ (3))', for example. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ /* If all went well, simply lookup the type-id. */
+ if (cp_parser_parse_definitely (parser))
+ postfix_expression = get_typeid (type);
+ /* Otherwise, fall back to the expression variant. */
+ else
+ {
+ tree expression;
+
+ /* Look for an expression. */
+ expression = cp_parser_expression (parser);
+ /* Compute its typeid. */
+ postfix_expression = build_typeid (expression);
+ /* Look for the `)' token. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ }
+ /* `typeid' may not appear in an integral constant expression. */
+ if (cp_parser_non_integral_constant_expression(parser,
+ "`typeid' operator"))
+ return error_mark_node;
+ /* Restore the saved message. */
+ parser->type_definition_forbidden_message = saved_message;
+ }
+ break;
+
+ case RID_TYPENAME:
+ {
+ bool template_p = false;
+ tree id;
+ tree type;
+
+ /* Consume the `typename' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the optional `::' operator. */
+ cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false);
+ /* Look for the nested-name-specifier. */
+ cp_parser_nested_name_specifier (parser,
+ /*typename_keyword_p=*/true,
+ /*check_dependency_p=*/true,
+ /*type_p=*/true,
+ /*is_declaration=*/true);
+ /* Look for the optional `template' keyword. */
+ template_p = cp_parser_optional_template_keyword (parser);
+ /* We don't know whether we're looking at a template-id or an
+ identifier. */
+ cp_parser_parse_tentatively (parser);
+ /* Try a template-id. */
+ id = cp_parser_template_id (parser, template_p,
+ /*check_dependency_p=*/true,
+ /*is_declaration=*/true);
+ /* If that didn't work, try an identifier. */
+ if (!cp_parser_parse_definitely (parser))
+ id = cp_parser_identifier (parser);
+ /* If we look up a template-id in a non-dependent qualifying
+ scope, there's no need to create a dependent type. */
+ if (TREE_CODE (id) == TYPE_DECL
+ && !dependent_type_p (parser->scope))
+ type = TREE_TYPE (id);
+ /* Create a TYPENAME_TYPE to represent the type to which the
+ functional cast is being performed. */
+ else
+ type = make_typename_type (parser->scope, id,
+ /*complain=*/1);
+
+ postfix_expression = cp_parser_functional_cast (parser, type);
+ }
+ break;
+
+ default:
+ {
+ tree type;
+
+ /* If the next thing is a simple-type-specifier, we may be
+ looking at a functional cast. We could also be looking at
+ an id-expression. So, we try the functional cast, and if
+ that doesn't work we fall back to the primary-expression. */
+ cp_parser_parse_tentatively (parser);
+ /* Look for the simple-type-specifier. */
+ type = cp_parser_simple_type_specifier (parser,
+ CP_PARSER_FLAGS_NONE,
+ /*identifier_p=*/false);
+ /* Parse the cast itself. */
+ if (!cp_parser_error_occurred (parser))
+ postfix_expression
+ = cp_parser_functional_cast (parser, type);
+ /* If that worked, we're done. */
+ if (cp_parser_parse_definitely (parser))
+ break;
+
+ /* If the functional-cast didn't work out, try a
+ compound-literal. */
+ if (cp_parser_allow_gnu_extensions_p (parser)
+ && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
+ {
+ tree initializer_list = NULL_TREE;
+ bool saved_in_type_id_in_expr_p;
+
+ cp_parser_parse_tentatively (parser);
+ /* Consume the `('. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the type. */
+ saved_in_type_id_in_expr_p = parser->in_type_id_in_expr_p;
+ parser->in_type_id_in_expr_p = true;
+ type = cp_parser_type_id (parser);
+ parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p;
+ /* Look for the `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ /* Look for the `{'. */
+ cp_parser_require (parser, CPP_OPEN_BRACE, "`{'");
+ /* If things aren't going well, there's no need to
+ keep going. */
+ if (!cp_parser_error_occurred (parser))
+ {
+ bool non_constant_p;
+ /* Parse the initializer-list. */
+ initializer_list
+ = cp_parser_initializer_list (parser, &non_constant_p);
+ /* Allow a trailing `,'. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the final `}'. */
+ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
+ }
+ /* If that worked, we're definitely looking at a
+ compound-literal expression. */
+ if (cp_parser_parse_definitely (parser))
+ {
+ /* Warn the user that a compound literal is not
+ allowed in standard C++. */
+ if (pedantic)
+ pedwarn ("ISO C++ forbids compound-literals");
+ /* Form the representation of the compound-literal. */
+ postfix_expression
+ = finish_compound_literal (type, initializer_list);
+ break;
+ }
+ }
+
+ /* It must be a primary-expression. */
+ postfix_expression = cp_parser_primary_expression (parser,
+ &idk,
+ &qualifying_class);
+ }
+ break;
+ }
+
+ /* If we were avoiding committing to the processing of a
+ qualified-id until we knew whether or not we had a
+ pointer-to-member, we now know. */
+ if (qualifying_class)
+ {
+ bool done;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ done = (token->type != CPP_OPEN_SQUARE
+ && token->type != CPP_OPEN_PAREN
+ && token->type != CPP_DOT
+ && token->type != CPP_DEREF
+ && token->type != CPP_PLUS_PLUS
+ && token->type != CPP_MINUS_MINUS);
+
+ postfix_expression = finish_qualified_id_expr (qualifying_class,
+ postfix_expression,
+ done,
+ address_p);
+ if (done)
+ return postfix_expression;
+ }
+
+ /* Keep looping until the postfix-expression is complete. */
+ while (true)
+ {
+ if (idk == CP_ID_KIND_UNQUALIFIED
+ && TREE_CODE (postfix_expression) == IDENTIFIER_NODE
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN))
+ /* It is not a Koenig lookup function call. */
+ postfix_expression
+ = unqualified_name_lookup_error (postfix_expression);
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ switch (token->type)
+ {
+ case CPP_OPEN_SQUARE:
+ /* postfix-expression [ expression ] */
+ {
+ tree index;
+
+ /* Consume the `[' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the index expression. */
+ index = cp_parser_expression (parser);
+ /* Look for the closing `]'. */
+ cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'");
+
+ /* Build the ARRAY_REF. */
+ postfix_expression
+ = grok_array_decl (postfix_expression, index);
+ idk = CP_ID_KIND_NONE;
+ /* Array references are not permitted in
+ constant-expressions (but they are allowed
+ in offsetof). */
+ if (!parser->in_offsetof_p
+ && cp_parser_non_integral_constant_expression
+ (parser, "an array reference"))
+ postfix_expression = error_mark_node;
+ }
+ break;
+
+ case CPP_OPEN_PAREN:
+ /* postfix-expression ( expression-list [opt] ) */
+ {
+ bool koenig_p;
+ tree args = (cp_parser_parenthesized_expression_list
+ (parser, false, /*non_constant_p=*/NULL));
+
+ if (args == error_mark_node)
+ {
+ postfix_expression = error_mark_node;
+ break;
+ }
+
+ /* Function calls are not permitted in
+ constant-expressions. */
+ if (cp_parser_non_integral_constant_expression (parser,
+ "a function call"))
+ {
+ postfix_expression = error_mark_node;
+ break;
+ }
+
+ koenig_p = false;
+ if (idk == CP_ID_KIND_UNQUALIFIED)
+ {
+ /* We do not perform argument-dependent lookup if
+ normal lookup finds a non-function, in accordance
+ with the expected resolution of DR 218. */
+ if (args
+ && (is_overloaded_fn (postfix_expression)
+ || TREE_CODE (postfix_expression) == IDENTIFIER_NODE))
+ {
+ koenig_p = true;
+ postfix_expression
+ = perform_koenig_lookup (postfix_expression, args);
+ }
+ else if (TREE_CODE (postfix_expression) == IDENTIFIER_NODE)
+ postfix_expression
+ = unqualified_fn_lookup_error (postfix_expression);
+ }
+
+ if (TREE_CODE (postfix_expression) == COMPONENT_REF)
+ {
+ tree instance = TREE_OPERAND (postfix_expression, 0);
+ tree fn = TREE_OPERAND (postfix_expression, 1);
+
+ if (processing_template_decl
+ && (type_dependent_expression_p (instance)
+ || (!BASELINK_P (fn)
+ && TREE_CODE (fn) != FIELD_DECL)
+ || type_dependent_expression_p (fn)
+ || any_type_dependent_arguments_p (args)))
+ {
+ postfix_expression
+ = build_min_nt (CALL_EXPR, postfix_expression, args);
+ break;
+ }
+
+ if (BASELINK_P (fn))
+ postfix_expression
+ = (build_new_method_call
+ (instance, fn, args, NULL_TREE,
+ (idk == CP_ID_KIND_QUALIFIED
+ ? LOOKUP_NONVIRTUAL : LOOKUP_NORMAL)));
+ else
+ postfix_expression
+ = finish_call_expr (postfix_expression, args,
+ /*disallow_virtual=*/false,
+ /*koenig_p=*/false);
+ }
+ else if (TREE_CODE (postfix_expression) == OFFSET_REF
+ || TREE_CODE (postfix_expression) == MEMBER_REF
+ || TREE_CODE (postfix_expression) == DOTSTAR_EXPR)
+ postfix_expression = (build_offset_ref_call_from_tree
+ (postfix_expression, args));
+ else if (idk == CP_ID_KIND_QUALIFIED)
+ /* A call to a static class member, or a namespace-scope
+ function. */
+ postfix_expression
+ = finish_call_expr (postfix_expression, args,
+ /*disallow_virtual=*/true,
+ koenig_p);
+ else
+ /* All other function calls. */
+ postfix_expression
+ = finish_call_expr (postfix_expression, args,
+ /*disallow_virtual=*/false,
+ koenig_p);
+
+ /* The POSTFIX_EXPRESSION is certainly no longer an id. */
+ idk = CP_ID_KIND_NONE;
+ }
+ break;
+
+ case CPP_DOT:
+ case CPP_DEREF:
+ /* postfix-expression . template [opt] id-expression
+ postfix-expression . pseudo-destructor-name
+ postfix-expression -> template [opt] id-expression
+ postfix-expression -> pseudo-destructor-name */
+ {
+ tree name;
+ bool dependent_p;
+ bool template_p;
+ tree scope = NULL_TREE;
+ enum cpp_ttype token_type = token->type;
+
+ /* If this is a `->' operator, dereference the pointer. */
+ if (token->type == CPP_DEREF)
+ postfix_expression = build_x_arrow (postfix_expression);
+ /* Check to see whether or not the expression is
+ type-dependent. */
+ dependent_p = type_dependent_expression_p (postfix_expression);
+ /* The identifier following the `->' or `.' is not
+ qualified. */
+ parser->scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ parser->object_scope = NULL_TREE;
+ idk = CP_ID_KIND_NONE;
+ /* Enter the scope corresponding to the type of the object
+ given by the POSTFIX_EXPRESSION. */
+ if (!dependent_p
+ && TREE_TYPE (postfix_expression) != NULL_TREE)
+ {
+ scope = TREE_TYPE (postfix_expression);
+ /* According to the standard, no expression should
+ ever have reference type. Unfortunately, we do not
+ currently match the standard in this respect in
+ that our internal representation of an expression
+ may have reference type even when the standard says
+ it does not. Therefore, we have to manually obtain
+ the underlying type here. */
+ scope = non_reference (scope);
+ /* The type of the POSTFIX_EXPRESSION must be
+ complete. */
+ scope = complete_type_or_else (scope, NULL_TREE);
+ /* Let the name lookup machinery know that we are
+ processing a class member access expression. */
+ parser->context->object_type = scope;
+ /* If something went wrong, we want to be able to
+ discern that case, as opposed to the case where
+ there was no SCOPE due to the type of expression
+ being dependent. */
+ if (!scope)
+ scope = error_mark_node;
+ /* If the SCOPE was erroneous, make the various
+ semantic analysis functions exit quickly -- and
+ without issuing additional error messages. */
+ if (scope == error_mark_node)
+ postfix_expression = error_mark_node;
+ }
+
+ /* Consume the `.' or `->' operator. */
+ cp_lexer_consume_token (parser->lexer);
+ /* If the SCOPE is not a scalar type, we are looking at an
+ ordinary class member access expression, rather than a
+ pseudo-destructor-name. */
+ if (!scope || !SCALAR_TYPE_P (scope))
+ {
+ template_p = cp_parser_optional_template_keyword (parser);
+ /* Parse the id-expression. */
+ name = cp_parser_id_expression (parser,
+ template_p,
+ /*check_dependency_p=*/true,
+ /*template_p=*/NULL,
+ /*declarator_p=*/false);
+ /* In general, build a SCOPE_REF if the member name is
+ qualified. However, if the name was not dependent
+ and has already been resolved; there is no need to
+ build the SCOPE_REF. For example;
+
+ struct X { void f(); };
+ template <typename T> void f(T* t) { t->X::f(); }
+
+ Even though "t" is dependent, "X::f" is not and has
+ been resolved to a BASELINK; there is no need to
+ include scope information. */
+
+ /* But we do need to remember that there was an explicit
+ scope for virtual function calls. */
+ if (parser->scope)
+ idk = CP_ID_KIND_QUALIFIED;
+
+ if (name != error_mark_node
+ && !BASELINK_P (name)
+ && parser->scope)
+ {
+ name = build_nt (SCOPE_REF, parser->scope, name);
+ parser->scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ parser->object_scope = NULL_TREE;
+ }
+ if (scope && name && BASELINK_P (name))
+ adjust_result_of_qualified_name_lookup
+ (name, BINFO_TYPE (BASELINK_BINFO (name)), scope);
+ postfix_expression
+ = finish_class_member_access_expr (postfix_expression, name);
+ }
+ /* Otherwise, try the pseudo-destructor-name production. */
+ else
+ {
+ tree s = NULL_TREE;
+ tree type;
+
+ /* Parse the pseudo-destructor-name. */
+ cp_parser_pseudo_destructor_name (parser, &s, &type);
+ /* Form the call. */
+ postfix_expression
+ = finish_pseudo_destructor_expr (postfix_expression,
+ s, TREE_TYPE (type));
+ }
+
+ /* We no longer need to look up names in the scope of the
+ object on the left-hand side of the `.' or `->'
+ operator. */
+ parser->context->object_type = NULL_TREE;
+ /* These operators may not appear in constant-expressions. */
+ if (/* The "->" operator is allowed in the implementation
+ of "offsetof". The "." operator may appear in the
+ name of the member. */
+ !parser->in_offsetof_p
+ && (cp_parser_non_integral_constant_expression
+ (parser,
+ token_type == CPP_DEREF ? "'->'" : "`.'")))
+ postfix_expression = error_mark_node;
+ }
+ break;
+
+ case CPP_PLUS_PLUS:
+ /* postfix-expression ++ */
+ /* Consume the `++' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Generate a representation for the complete expression. */
+ postfix_expression
+ = finish_increment_expr (postfix_expression,
+ POSTINCREMENT_EXPR);
+ /* Increments may not appear in constant-expressions. */
+ if (cp_parser_non_integral_constant_expression (parser,
+ "an increment"))
+ postfix_expression = error_mark_node;
+ idk = CP_ID_KIND_NONE;
+ break;
+
+ case CPP_MINUS_MINUS:
+ /* postfix-expression -- */
+ /* Consume the `--' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Generate a representation for the complete expression. */
+ postfix_expression
+ = finish_increment_expr (postfix_expression,
+ POSTDECREMENT_EXPR);
+ /* Decrements may not appear in constant-expressions. */
+ if (cp_parser_non_integral_constant_expression (parser,
+ "a decrement"))
+ postfix_expression = error_mark_node;
+ idk = CP_ID_KIND_NONE;
+ break;
+
+ default:
+ return postfix_expression;
+ }
+ }
+
+ /* We should never get here. */
+ abort ();
+ return error_mark_node;
+}
+
+/* Parse a parenthesized expression-list.
+
+ expression-list:
+ assignment-expression
+ expression-list, assignment-expression
+
+ attribute-list:
+ expression-list
+ identifier
+ identifier, expression-list
+
+ Returns a TREE_LIST. The TREE_VALUE of each node is a
+ representation of an assignment-expression. Note that a TREE_LIST
+ is returned even if there is only a single expression in the list.
+ error_mark_node is returned if the ( and or ) are
+ missing. NULL_TREE is returned on no expressions. The parentheses
+ are eaten. IS_ATTRIBUTE_LIST is true if this is really an attribute
+ list being parsed. If NON_CONSTANT_P is non-NULL, *NON_CONSTANT_P
+ indicates whether or not all of the expressions in the list were
+ constant. */
+
+static tree
+cp_parser_parenthesized_expression_list (cp_parser* parser,
+ bool is_attribute_list,
+ bool *non_constant_p)
+{
+ tree expression_list = NULL_TREE;
+ tree identifier = NULL_TREE;
+
+ /* Assume all the expressions will be constant. */
+ if (non_constant_p)
+ *non_constant_p = false;
+
+ if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('"))
+ return error_mark_node;
+
+ /* Consume expressions until there are no more. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN))
+ while (true)
+ {
+ tree expr;
+
+ /* At the beginning of attribute lists, check to see if the
+ next token is an identifier. */
+ if (is_attribute_list
+ && cp_lexer_peek_token (parser->lexer)->type == CPP_NAME)
+ {
+ cp_token *token;
+
+ /* Consume the identifier. */
+ token = cp_lexer_consume_token (parser->lexer);
+ /* Save the identifier. */
+ identifier = token->value;
+ }
+ else
+ {
+ /* Parse the next assignment-expression. */
+ if (non_constant_p)
+ {
+ bool expr_non_constant_p;
+ expr = (cp_parser_constant_expression
+ (parser, /*allow_non_constant_p=*/true,
+ &expr_non_constant_p));
+ if (expr_non_constant_p)
+ *non_constant_p = true;
+ }
+ else
+ expr = cp_parser_assignment_expression (parser);
+
+ /* Add it to the list. We add error_mark_node
+ expressions to the list, so that we can still tell if
+ the correct form for a parenthesized expression-list
+ is found. That gives better errors. */
+ expression_list = tree_cons (NULL_TREE, expr, expression_list);
+
+ if (expr == error_mark_node)
+ goto skip_comma;
+ }
+
+ /* After the first item, attribute lists look the same as
+ expression lists. */
+ is_attribute_list = false;
+
+ get_comma:;
+ /* If the next token isn't a `,', then we are done. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA))
+ break;
+
+ /* Otherwise, consume the `,' and keep going. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"))
+ {
+ int ending;
+
+ skip_comma:;
+ /* We try and resync to an unnested comma, as that will give the
+ user better diagnostics. */
+ ending = cp_parser_skip_to_closing_parenthesis (parser,
+ /*recovering=*/true,
+ /*or_comma=*/true,
+ /*consume_paren=*/true);
+ if (ending < 0)
+ goto get_comma;
+ if (!ending)
+ return error_mark_node;
+ }
+
+ /* We built up the list in reverse order so we must reverse it now. */
+ expression_list = nreverse (expression_list);
+ if (identifier)
+ expression_list = tree_cons (NULL_TREE, identifier, expression_list);
+
+ return expression_list;
+}
+
+/* Parse a pseudo-destructor-name.
+
+ pseudo-destructor-name:
+ :: [opt] nested-name-specifier [opt] type-name :: ~ type-name
+ :: [opt] nested-name-specifier template template-id :: ~ type-name
+ :: [opt] nested-name-specifier [opt] ~ type-name
+
+ If either of the first two productions is used, sets *SCOPE to the
+ TYPE specified before the final `::'. Otherwise, *SCOPE is set to
+ NULL_TREE. *TYPE is set to the TYPE_DECL for the final type-name,
+ or ERROR_MARK_NODE if the parse fails. */
+
+static void
+cp_parser_pseudo_destructor_name (cp_parser* parser,
+ tree* scope,
+ tree* type)
+{
+ bool nested_name_specifier_p;
+
+ /* Look for the optional `::' operator. */
+ cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/true);
+ /* Look for the optional nested-name-specifier. */
+ nested_name_specifier_p
+ = (cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*type_p=*/false,
+ /*is_declaration=*/true)
+ != NULL_TREE);
+ /* Now, if we saw a nested-name-specifier, we might be doing the
+ second production. */
+ if (nested_name_specifier_p
+ && cp_lexer_next_token_is_keyword (parser->lexer, RID_TEMPLATE))
+ {
+ /* Consume the `template' keyword. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the template-id. */
+ cp_parser_template_id (parser,
+ /*template_keyword_p=*/true,
+ /*check_dependency_p=*/false,
+ /*is_declaration=*/true);
+ /* Look for the `::' token. */
+ cp_parser_require (parser, CPP_SCOPE, "`::'");
+ }
+ /* If the next token is not a `~', then there might be some
+ additional qualification. */
+ else if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMPL))
+ {
+ /* Look for the type-name. */
+ *scope = TREE_TYPE (cp_parser_type_name (parser));
+
+ /* If we didn't get an aggregate type, or we don't have ::~,
+ then something has gone wrong. Since the only caller of this
+ function is looking for something after `.' or `->' after a
+ scalar type, most likely the program is trying to get a
+ member of a non-aggregate type. */
+ if (*scope == error_mark_node
+ || cp_lexer_next_token_is_not (parser->lexer, CPP_SCOPE)
+ || cp_lexer_peek_nth_token (parser->lexer, 2)->type != CPP_COMPL)
+ {
+ cp_parser_error (parser, "request for member of non-aggregate type");
+ *type = error_mark_node;
+ return;
+ }
+
+ /* Look for the `::' token. */
+ cp_parser_require (parser, CPP_SCOPE, "`::'");
+ }
+ else
+ *scope = NULL_TREE;
+
+ /* Look for the `~'. */
+ cp_parser_require (parser, CPP_COMPL, "`~'");
+ /* Look for the type-name again. We are not responsible for
+ checking that it matches the first type-name. */
+ *type = cp_parser_type_name (parser);
+}
+
+/* Parse a unary-expression.
+
+ unary-expression:
+ postfix-expression
+ ++ cast-expression
+ -- cast-expression
+ unary-operator cast-expression
+ sizeof unary-expression
+ sizeof ( type-id )
+ new-expression
+ delete-expression
+
+ GNU Extensions:
+
+ unary-expression:
+ __extension__ cast-expression
+ __alignof__ unary-expression
+ __alignof__ ( type-id )
+ __real__ cast-expression
+ __imag__ cast-expression
+ && identifier
+
+ ADDRESS_P is true iff the unary-expression is appearing as the
+ operand of the `&' operator.
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_unary_expression (cp_parser *parser, bool address_p)
+{
+ cp_token *token;
+ enum tree_code unary_operator;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* Some keywords give away the kind of expression. */
+ if (token->type == CPP_KEYWORD)
+ {
+ enum rid keyword = token->keyword;
+
+ switch (keyword)
+ {
+ case RID_ALIGNOF:
+ case RID_SIZEOF:
+ {
+ tree operand;
+ enum tree_code op;
+
+ op = keyword == RID_ALIGNOF ? ALIGNOF_EXPR : SIZEOF_EXPR;
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the operand. */
+ operand = cp_parser_sizeof_operand (parser, keyword);
+
+ if (TYPE_P (operand))
+ return cxx_sizeof_or_alignof_type (operand, op, true);
+ else
+ return cxx_sizeof_or_alignof_expr (operand, op);
+ }
+
+ case RID_NEW:
+ return cp_parser_new_expression (parser);
+
+ case RID_DELETE:
+ return cp_parser_delete_expression (parser);
+
+ case RID_EXTENSION:
+ {
+ /* The saved value of the PEDANTIC flag. */
+ int saved_pedantic;
+ tree expr;
+
+ /* Save away the PEDANTIC flag. */
+ cp_parser_extension_opt (parser, &saved_pedantic);
+ /* Parse the cast-expression. */
+ expr = cp_parser_simple_cast_expression (parser);
+ /* Restore the PEDANTIC flag. */
+ pedantic = saved_pedantic;
+
+ return expr;
+ }
+
+ case RID_REALPART:
+ case RID_IMAGPART:
+ {
+ tree expression;
+
+ /* Consume the `__real__' or `__imag__' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the cast-expression. */
+ expression = cp_parser_simple_cast_expression (parser);
+ /* Create the complete representation. */
+ return build_x_unary_op ((keyword == RID_REALPART
+ ? REALPART_EXPR : IMAGPART_EXPR),
+ expression);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /* Look for the `:: new' and `:: delete', which also signal the
+ beginning of a new-expression, or delete-expression,
+ respectively. If the next token is `::', then it might be one of
+ these. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_SCOPE))
+ {
+ enum rid keyword;
+
+ /* See if the token after the `::' is one of the keywords in
+ which we're interested. */
+ keyword = cp_lexer_peek_nth_token (parser->lexer, 2)->keyword;
+ /* If it's `new', we have a new-expression. */
+ if (keyword == RID_NEW)
+ return cp_parser_new_expression (parser);
+ /* Similarly, for `delete'. */
+ else if (keyword == RID_DELETE)
+ return cp_parser_delete_expression (parser);
+ }
+
+ /* Look for a unary operator. */
+ unary_operator = cp_parser_unary_operator (token);
+ /* The `++' and `--' operators can be handled similarly, even though
+ they are not technically unary-operators in the grammar. */
+ if (unary_operator == ERROR_MARK)
+ {
+ if (token->type == CPP_PLUS_PLUS)
+ unary_operator = PREINCREMENT_EXPR;
+ else if (token->type == CPP_MINUS_MINUS)
+ unary_operator = PREDECREMENT_EXPR;
+ /* Handle the GNU address-of-label extension. */
+ else if (cp_parser_allow_gnu_extensions_p (parser)
+ && token->type == CPP_AND_AND)
+ {
+ tree identifier;
+
+ /* Consume the '&&' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the identifier. */
+ identifier = cp_parser_identifier (parser);
+ /* Create an expression representing the address. */
+ return finish_label_address_expr (identifier);
+ }
+ }
+ if (unary_operator != ERROR_MARK)
+ {
+ tree cast_expression;
+ tree expression = error_mark_node;
+ const char *non_constant_p = NULL;
+
+ /* Consume the operator token. */
+ token = cp_lexer_consume_token (parser->lexer);
+ /* Parse the cast-expression. */
+ cast_expression
+ = cp_parser_cast_expression (parser, unary_operator == ADDR_EXPR);
+ /* Now, build an appropriate representation. */
+ switch (unary_operator)
+ {
+ case INDIRECT_REF:
+ non_constant_p = "`*'";
+ expression = build_x_indirect_ref (cast_expression, "unary *");
+ break;
+
+ case ADDR_EXPR:
+ /* The "&" operator is allowed in the implementation of
+ "offsetof". */
+ if (!parser->in_offsetof_p)
+ non_constant_p = "`&'";
+ /* Fall through. */
+ case BIT_NOT_EXPR:
+ expression = build_x_unary_op (unary_operator, cast_expression);
+ break;
+
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ non_constant_p = (unary_operator == PREINCREMENT_EXPR
+ ? "`++'" : "`--'");
+ /* Fall through. */
+ case CONVERT_EXPR:
+ case NEGATE_EXPR:
+ case TRUTH_NOT_EXPR:
+ expression = finish_unary_op_expr (unary_operator, cast_expression);
+ break;
+
+ default:
+ abort ();
+ }
+
+ if (non_constant_p
+ && cp_parser_non_integral_constant_expression (parser,
+ non_constant_p))
+ expression = error_mark_node;
+
+ return expression;
+ }
+
+ return cp_parser_postfix_expression (parser, address_p);
+}
+
+/* Returns ERROR_MARK if TOKEN is not a unary-operator. If TOKEN is a
+ unary-operator, the corresponding tree code is returned. */
+
+static enum tree_code
+cp_parser_unary_operator (cp_token* token)
+{
+ switch (token->type)
+ {
+ case CPP_MULT:
+ return INDIRECT_REF;
+
+ case CPP_AND:
+ return ADDR_EXPR;
+
+ case CPP_PLUS:
+ return CONVERT_EXPR;
+
+ case CPP_MINUS:
+ return NEGATE_EXPR;
+
+ case CPP_NOT:
+ return TRUTH_NOT_EXPR;
+
+ case CPP_COMPL:
+ return BIT_NOT_EXPR;
+
+ default:
+ return ERROR_MARK;
+ }
+}
+
+/* Parse a new-expression.
+
+ new-expression:
+ :: [opt] new new-placement [opt] new-type-id new-initializer [opt]
+ :: [opt] new new-placement [opt] ( type-id ) new-initializer [opt]
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_new_expression (cp_parser* parser)
+{
+ bool global_scope_p;
+ tree placement;
+ tree type;
+ tree initializer;
+
+ /* Look for the optional `::' operator. */
+ global_scope_p
+ = (cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false)
+ != NULL_TREE);
+ /* Look for the `new' operator. */
+ cp_parser_require_keyword (parser, RID_NEW, "`new'");
+ /* There's no easy way to tell a new-placement from the
+ `( type-id )' construct. */
+ cp_parser_parse_tentatively (parser);
+ /* Look for a new-placement. */
+ placement = cp_parser_new_placement (parser);
+ /* If that didn't work out, there's no new-placement. */
+ if (!cp_parser_parse_definitely (parser))
+ placement = NULL_TREE;
+
+ /* If the next token is a `(', then we have a parenthesized
+ type-id. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
+ {
+ /* Consume the `('. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the type-id. */
+ type = cp_parser_type_id (parser);
+ /* Look for the closing `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ /* There should not be a direct-new-declarator in this production,
+ but GCC used to allowed this, so we check and emit a sensible error
+ message for this case. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
+ {
+ error ("array bound forbidden after parenthesized type-id");
+ inform ("try removing the parentheses around the type-id");
+ cp_parser_direct_new_declarator (parser);
+ }
+ }
+ /* Otherwise, there must be a new-type-id. */
+ else
+ type = cp_parser_new_type_id (parser);
+
+ /* If the next token is a `(', then we have a new-initializer. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
+ initializer = cp_parser_new_initializer (parser);
+ else
+ initializer = NULL_TREE;
+
+ /* A new-expression may not appear in an integral constant
+ expression. */
+ if (cp_parser_non_integral_constant_expression (parser, "`new'"))
+ return error_mark_node;
+
+ /* Create a representation of the new-expression. */
+ return build_new (placement, type, initializer, global_scope_p);
+}
+
+/* Parse a new-placement.
+
+ new-placement:
+ ( expression-list )
+
+ Returns the same representation as for an expression-list. */
+
+static tree
+cp_parser_new_placement (cp_parser* parser)
+{
+ tree expression_list;
+
+ /* Parse the expression-list. */
+ expression_list = (cp_parser_parenthesized_expression_list
+ (parser, false, /*non_constant_p=*/NULL));
+
+ return expression_list;
+}
+
+/* Parse a new-type-id.
+
+ new-type-id:
+ type-specifier-seq new-declarator [opt]
+
+ Returns a TREE_LIST whose TREE_PURPOSE is the type-specifier-seq,
+ and whose TREE_VALUE is the new-declarator. */
+
+static tree
+cp_parser_new_type_id (cp_parser* parser)
+{
+ tree type_specifier_seq;
+ tree declarator;
+ const char *saved_message;
+
+ /* The type-specifier sequence must not contain type definitions.
+ (It cannot contain declarations of new types either, but if they
+ are not definitions we will catch that because they are not
+ complete.) */
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = "types may not be defined in a new-type-id";
+ /* Parse the type-specifier-seq. */
+ type_specifier_seq = cp_parser_type_specifier_seq (parser);
+ /* Restore the old message. */
+ parser->type_definition_forbidden_message = saved_message;
+ /* Parse the new-declarator. */
+ declarator = cp_parser_new_declarator_opt (parser);
+
+ return build_tree_list (type_specifier_seq, declarator);
+}
+
+/* Parse an (optional) new-declarator.
+
+ new-declarator:
+ ptr-operator new-declarator [opt]
+ direct-new-declarator
+
+ Returns a representation of the declarator. See
+ cp_parser_declarator for the representations used. */
+
+static tree
+cp_parser_new_declarator_opt (cp_parser* parser)
+{
+ enum tree_code code;
+ tree type;
+ tree cv_qualifier_seq;
+
+ /* We don't know if there's a ptr-operator next, or not. */
+ cp_parser_parse_tentatively (parser);
+ /* Look for a ptr-operator. */
+ code = cp_parser_ptr_operator (parser, &type, &cv_qualifier_seq);
+ /* If that worked, look for more new-declarators. */
+ if (cp_parser_parse_definitely (parser))
+ {
+ tree declarator;
+
+ /* Parse another optional declarator. */
+ declarator = cp_parser_new_declarator_opt (parser);
+
+ /* Create the representation of the declarator. */
+ if (code == INDIRECT_REF)
+ declarator = make_pointer_declarator (cv_qualifier_seq,
+ declarator);
+ else
+ declarator = make_reference_declarator (cv_qualifier_seq,
+ declarator);
+
+ /* Handle the pointer-to-member case. */
+ if (type)
+ declarator = build_nt (SCOPE_REF, type, declarator);
+
+ return declarator;
+ }
+
+ /* If the next token is a `[', there is a direct-new-declarator. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
+ return cp_parser_direct_new_declarator (parser);
+
+ return NULL_TREE;
+}
+
+/* Parse a direct-new-declarator.
+
+ direct-new-declarator:
+ [ expression ]
+ direct-new-declarator [constant-expression]
+
+ Returns an ARRAY_REF, following the same conventions as are
+ documented for cp_parser_direct_declarator. */
+
+static tree
+cp_parser_direct_new_declarator (cp_parser* parser)
+{
+ tree declarator = NULL_TREE;
+
+ while (true)
+ {
+ tree expression;
+
+ /* Look for the opening `['. */
+ cp_parser_require (parser, CPP_OPEN_SQUARE, "`['");
+ /* The first expression is not required to be constant. */
+ if (!declarator)
+ {
+ expression = cp_parser_expression (parser);
+ /* The standard requires that the expression have integral
+ type. DR 74 adds enumeration types. We believe that the
+ real intent is that these expressions be handled like the
+ expression in a `switch' condition, which also allows
+ classes with a single conversion to integral or
+ enumeration type. */
+ if (!processing_template_decl)
+ {
+ expression
+ = build_expr_type_conversion (WANT_INT | WANT_ENUM,
+ expression,
+ /*complain=*/true);
+ if (!expression)
+ {
+ error ("expression in new-declarator must have integral or enumeration type");
+ expression = error_mark_node;
+ }
+ }
+ }
+ /* But all the other expressions must be. */
+ else
+ expression
+ = cp_parser_constant_expression (parser,
+ /*allow_non_constant=*/false,
+ NULL);
+ /* Look for the closing `]'. */
+ cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'");
+
+ /* Add this bound to the declarator. */
+ declarator = build_nt (ARRAY_REF, declarator, expression);
+
+ /* If the next token is not a `[', then there are no more
+ bounds. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_SQUARE))
+ break;
+ }
+
+ return declarator;
+}
+
+/* Parse a new-initializer.
+
+ new-initializer:
+ ( expression-list [opt] )
+
+ Returns a representation of the expression-list. If there is no
+ expression-list, VOID_ZERO_NODE is returned. */
+
+static tree
+cp_parser_new_initializer (cp_parser* parser)
+{
+ tree expression_list;
+
+ expression_list = (cp_parser_parenthesized_expression_list
+ (parser, false, /*non_constant_p=*/NULL));
+ if (!expression_list)
+ expression_list = void_zero_node;
+
+ return expression_list;
+}
+
+/* Parse a delete-expression.
+
+ delete-expression:
+ :: [opt] delete cast-expression
+ :: [opt] delete [ ] cast-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_delete_expression (cp_parser* parser)
+{
+ bool global_scope_p;
+ bool array_p;
+ tree expression;
+
+ /* Look for the optional `::' operator. */
+ global_scope_p
+ = (cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false)
+ != NULL_TREE);
+ /* Look for the `delete' keyword. */
+ cp_parser_require_keyword (parser, RID_DELETE, "`delete'");
+ /* See if the array syntax is in use. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
+ {
+ /* Consume the `[' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the `]' token. */
+ cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'");
+ /* Remember that this is the `[]' construct. */
+ array_p = true;
+ }
+ else
+ array_p = false;
+
+ /* Parse the cast-expression. */
+ expression = cp_parser_simple_cast_expression (parser);
+
+ /* A delete-expression may not appear in an integral constant
+ expression. */
+ if (cp_parser_non_integral_constant_expression (parser, "`delete'"))
+ return error_mark_node;
+
+ return delete_sanity (expression, NULL_TREE, array_p, global_scope_p);
+}
+
+/* Parse a cast-expression.
+
+ cast-expression:
+ unary-expression
+ ( type-id ) cast-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_cast_expression (cp_parser *parser, bool address_p)
+{
+ /* If it's a `(', then we might be looking at a cast. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
+ {
+ tree type = NULL_TREE;
+ tree expr = NULL_TREE;
+ bool compound_literal_p;
+ const char *saved_message;
+
+ /* There's no way to know yet whether or not this is a cast.
+ For example, `(int (3))' is a unary-expression, while `(int)
+ 3' is a cast. So, we resort to parsing tentatively. */
+ cp_parser_parse_tentatively (parser);
+ /* Types may not be defined in a cast. */
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = "types may not be defined in casts";
+ /* Consume the `('. */
+ cp_lexer_consume_token (parser->lexer);
+ /* A very tricky bit is that `(struct S) { 3 }' is a
+ compound-literal (which we permit in C++ as an extension).
+ But, that construct is not a cast-expression -- it is a
+ postfix-expression. (The reason is that `(struct S) { 3 }.i'
+ is legal; if the compound-literal were a cast-expression,
+ you'd need an extra set of parentheses.) But, if we parse
+ the type-id, and it happens to be a class-specifier, then we
+ will commit to the parse at that point, because we cannot
+ undo the action that is done when creating a new class. So,
+ then we cannot back up and do a postfix-expression.
+
+ Therefore, we scan ahead to the closing `)', and check to see
+ if the token after the `)' is a `{'. If so, we are not
+ looking at a cast-expression.
+
+ Save tokens so that we can put them back. */
+ cp_lexer_save_tokens (parser->lexer);
+ /* Skip tokens until the next token is a closing parenthesis.
+ If we find the closing `)', and the next token is a `{', then
+ we are looking at a compound-literal. */
+ compound_literal_p
+ = (cp_parser_skip_to_closing_parenthesis (parser, false, false,
+ /*consume_paren=*/true)
+ && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE));
+ /* Roll back the tokens we skipped. */
+ cp_lexer_rollback_tokens (parser->lexer);
+ /* If we were looking at a compound-literal, simulate an error
+ so that the call to cp_parser_parse_definitely below will
+ fail. */
+ if (compound_literal_p)
+ cp_parser_simulate_error (parser);
+ else
+ {
+ bool saved_in_type_id_in_expr_p = parser->in_type_id_in_expr_p;
+ parser->in_type_id_in_expr_p = true;
+ /* Look for the type-id. */
+ type = cp_parser_type_id (parser);
+ /* Look for the closing `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p;
+ }
+
+ /* Restore the saved message. */
+ parser->type_definition_forbidden_message = saved_message;
+
+ /* If ok so far, parse the dependent expression. We cannot be
+ sure it is a cast. Consider `(T ())'. It is a parenthesized
+ ctor of T, but looks like a cast to function returning T
+ without a dependent expression. */
+ if (!cp_parser_error_occurred (parser))
+ expr = cp_parser_simple_cast_expression (parser);
+
+ if (cp_parser_parse_definitely (parser))
+ {
+ /* Warn about old-style casts, if so requested. */
+ if (warn_old_style_cast
+ && !in_system_header
+ && !VOID_TYPE_P (type)
+ && current_lang_name != lang_name_c)
+ warning ("use of old-style cast");
+
+ /* Only type conversions to integral or enumeration types
+ can be used in constant-expressions. */
+ if (parser->integral_constant_expression_p
+ && !dependent_type_p (type)
+ && !INTEGRAL_OR_ENUMERATION_TYPE_P (type)
+ && (cp_parser_non_integral_constant_expression
+ (parser,
+ "a casts to a type other than an integral or "
+ "enumeration type")))
+ return error_mark_node;
+
+ /* Perform the cast. */
+ expr = build_c_cast (type, expr);
+ return expr;
+ }
+ }
+
+ /* If we get here, then it's not a cast, so it must be a
+ unary-expression. */
+ return cp_parser_unary_expression (parser, address_p);
+}
+
+/* Parse a pm-expression.
+
+ pm-expression:
+ cast-expression
+ pm-expression .* cast-expression
+ pm-expression ->* cast-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_pm_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_DEREF_STAR, MEMBER_REF },
+ { CPP_DOT_STAR, DOTSTAR_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser, map,
+ cp_parser_simple_cast_expression);
+}
+
+/* Parse a multiplicative-expression.
+
+ mulitplicative-expression:
+ pm-expression
+ multiplicative-expression * pm-expression
+ multiplicative-expression / pm-expression
+ multiplicative-expression % pm-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_multiplicative_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_MULT, MULT_EXPR },
+ { CPP_DIV, TRUNC_DIV_EXPR },
+ { CPP_MOD, TRUNC_MOD_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_pm_expression);
+}
+
+/* Parse an additive-expression.
+
+ additive-expression:
+ multiplicative-expression
+ additive-expression + multiplicative-expression
+ additive-expression - multiplicative-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_additive_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_PLUS, PLUS_EXPR },
+ { CPP_MINUS, MINUS_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_multiplicative_expression);
+}
+
+/* Parse a shift-expression.
+
+ shift-expression:
+ additive-expression
+ shift-expression << additive-expression
+ shift-expression >> additive-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_shift_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_LSHIFT, LSHIFT_EXPR },
+ { CPP_RSHIFT, RSHIFT_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_additive_expression);
+}
+
+/* Parse a relational-expression.
+
+ relational-expression:
+ shift-expression
+ relational-expression < shift-expression
+ relational-expression > shift-expression
+ relational-expression <= shift-expression
+ relational-expression >= shift-expression
+
+ GNU Extension:
+
+ relational-expression:
+ relational-expression <? shift-expression
+ relational-expression >? shift-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_relational_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_LESS, LT_EXPR },
+ { CPP_GREATER, GT_EXPR },
+ { CPP_LESS_EQ, LE_EXPR },
+ { CPP_GREATER_EQ, GE_EXPR },
+ { CPP_MIN, MIN_EXPR },
+ { CPP_MAX, MAX_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_shift_expression);
+}
+
+/* Parse an equality-expression.
+
+ equality-expression:
+ relational-expression
+ equality-expression == relational-expression
+ equality-expression != relational-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_equality_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_EQ_EQ, EQ_EXPR },
+ { CPP_NOT_EQ, NE_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_relational_expression);
+}
+
+/* Parse an and-expression.
+
+ and-expression:
+ equality-expression
+ and-expression & equality-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_and_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_AND, BIT_AND_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_equality_expression);
+}
+
+/* Parse an exclusive-or-expression.
+
+ exclusive-or-expression:
+ and-expression
+ exclusive-or-expression ^ and-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_exclusive_or_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_XOR, BIT_XOR_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_and_expression);
+}
+
+
+/* Parse an inclusive-or-expression.
+
+ inclusive-or-expression:
+ exclusive-or-expression
+ inclusive-or-expression | exclusive-or-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_inclusive_or_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_OR, BIT_IOR_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_exclusive_or_expression);
+}
+
+/* Parse a logical-and-expression.
+
+ logical-and-expression:
+ inclusive-or-expression
+ logical-and-expression && inclusive-or-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_logical_and_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_AND_AND, TRUTH_ANDIF_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_inclusive_or_expression);
+}
+
+/* Parse a logical-or-expression.
+
+ logical-or-expression:
+ logical-and-expression
+ logical-or-expression || logical-and-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_logical_or_expression (cp_parser* parser)
+{
+ static const cp_parser_token_tree_map map = {
+ { CPP_OR_OR, TRUTH_ORIF_EXPR },
+ { CPP_EOF, ERROR_MARK }
+ };
+
+ return cp_parser_binary_expression (parser,
+ map,
+ cp_parser_logical_and_expression);
+}
+
+/* Parse the `? expression : assignment-expression' part of a
+ conditional-expression. The LOGICAL_OR_EXPR is the
+ logical-or-expression that started the conditional-expression.
+ Returns a representation of the entire conditional-expression.
+
+ This routine is used by cp_parser_assignment_expression.
+
+ ? expression : assignment-expression
+
+ GNU Extensions:
+
+ ? : assignment-expression */
+
+static tree
+cp_parser_question_colon_clause (cp_parser* parser, tree logical_or_expr)
+{
+ tree expr;
+ tree assignment_expr;
+
+ /* Consume the `?' token. */
+ cp_lexer_consume_token (parser->lexer);
+ if (cp_parser_allow_gnu_extensions_p (parser)
+ && cp_lexer_next_token_is (parser->lexer, CPP_COLON))
+ /* Implicit true clause. */
+ expr = NULL_TREE;
+ else
+ /* Parse the expression. */
+ expr = cp_parser_expression (parser);
+
+ /* The next token should be a `:'. */
+ cp_parser_require (parser, CPP_COLON, "`:'");
+ /* Parse the assignment-expression. */
+ assignment_expr = cp_parser_assignment_expression (parser);
+
+ /* Build the conditional-expression. */
+ return build_x_conditional_expr (logical_or_expr,
+ expr,
+ assignment_expr);
+}
+
+/* Parse an assignment-expression.
+
+ assignment-expression:
+ conditional-expression
+ logical-or-expression assignment-operator assignment_expression
+ throw-expression
+
+ Returns a representation for the expression. */
+
+static tree
+cp_parser_assignment_expression (cp_parser* parser)
+{
+ tree expr;
+
+ /* If the next token is the `throw' keyword, then we're looking at
+ a throw-expression. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_THROW))
+ expr = cp_parser_throw_expression (parser);
+ /* Otherwise, it must be that we are looking at a
+ logical-or-expression. */
+ else
+ {
+ /* Parse the logical-or-expression. */
+ expr = cp_parser_logical_or_expression (parser);
+ /* If the next token is a `?' then we're actually looking at a
+ conditional-expression. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_QUERY))
+ return cp_parser_question_colon_clause (parser, expr);
+ else
+ {
+ enum tree_code assignment_operator;
+
+ /* If it's an assignment-operator, we're using the second
+ production. */
+ assignment_operator
+ = cp_parser_assignment_operator_opt (parser);
+ if (assignment_operator != ERROR_MARK)
+ {
+ tree rhs;
+
+ /* Parse the right-hand side of the assignment. */
+ rhs = cp_parser_assignment_expression (parser);
+ /* An assignment may not appear in a
+ constant-expression. */
+ if (cp_parser_non_integral_constant_expression (parser,
+ "an assignment"))
+ return error_mark_node;
+ /* Build the assignment expression. */
+ expr = build_x_modify_expr (expr,
+ assignment_operator,
+ rhs);
+ }
+ }
+ }
+
+ return expr;
+}
+
+/* Parse an (optional) assignment-operator.
+
+ assignment-operator: one of
+ = *= /= %= += -= >>= <<= &= ^= |=
+
+ GNU Extension:
+
+ assignment-operator: one of
+ <?= >?=
+
+ If the next token is an assignment operator, the corresponding tree
+ code is returned, and the token is consumed. For example, for
+ `+=', PLUS_EXPR is returned. For `=' itself, the code returned is
+ NOP_EXPR. For `/', TRUNC_DIV_EXPR is returned; for `%',
+ TRUNC_MOD_EXPR is returned. If TOKEN is not an assignment
+ operator, ERROR_MARK is returned. */
+
+static enum tree_code
+cp_parser_assignment_operator_opt (cp_parser* parser)
+{
+ enum tree_code op;
+ cp_token *token;
+
+ /* Peek at the next toen. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ switch (token->type)
+ {
+ case CPP_EQ:
+ op = NOP_EXPR;
+ break;
+
+ case CPP_MULT_EQ:
+ op = MULT_EXPR;
+ break;
+
+ case CPP_DIV_EQ:
+ op = TRUNC_DIV_EXPR;
+ break;
+
+ case CPP_MOD_EQ:
+ op = TRUNC_MOD_EXPR;
+ break;
+
+ case CPP_PLUS_EQ:
+ op = PLUS_EXPR;
+ break;
+
+ case CPP_MINUS_EQ:
+ op = MINUS_EXPR;
+ break;
+
+ case CPP_RSHIFT_EQ:
+ op = RSHIFT_EXPR;
+ break;
+
+ case CPP_LSHIFT_EQ:
+ op = LSHIFT_EXPR;
+ break;
+
+ case CPP_AND_EQ:
+ op = BIT_AND_EXPR;
+ break;
+
+ case CPP_XOR_EQ:
+ op = BIT_XOR_EXPR;
+ break;
+
+ case CPP_OR_EQ:
+ op = BIT_IOR_EXPR;
+ break;
+
+ case CPP_MIN_EQ:
+ op = MIN_EXPR;
+ break;
+
+ case CPP_MAX_EQ:
+ op = MAX_EXPR;
+ break;
+
+ default:
+ /* Nothing else is an assignment operator. */
+ op = ERROR_MARK;
+ }
+
+ /* If it was an assignment operator, consume it. */
+ if (op != ERROR_MARK)
+ cp_lexer_consume_token (parser->lexer);
+
+ return op;
+}
+
+/* Parse an expression.
+
+ expression:
+ assignment-expression
+ expression , assignment-expression
+
+ Returns a representation of the expression. */
+
+static tree
+cp_parser_expression (cp_parser* parser)
+{
+ tree expression = NULL_TREE;
+
+ while (true)
+ {
+ tree assignment_expression;
+
+ /* Parse the next assignment-expression. */
+ assignment_expression
+ = cp_parser_assignment_expression (parser);
+ /* If this is the first assignment-expression, we can just
+ save it away. */
+ if (!expression)
+ expression = assignment_expression;
+ else
+ expression = build_x_compound_expr (expression,
+ assignment_expression);
+ /* If the next token is not a comma, then we are done with the
+ expression. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA))
+ break;
+ /* Consume the `,'. */
+ cp_lexer_consume_token (parser->lexer);
+ /* A comma operator cannot appear in a constant-expression. */
+ if (cp_parser_non_integral_constant_expression (parser,
+ "a comma operator"))
+ expression = error_mark_node;
+ }
+
+ return expression;
+}
+
+/* Parse a constant-expression.
+
+ constant-expression:
+ conditional-expression
+
+ If ALLOW_NON_CONSTANT_P a non-constant expression is silently
+ accepted. If ALLOW_NON_CONSTANT_P is true and the expression is not
+ constant, *NON_CONSTANT_P is set to TRUE. If ALLOW_NON_CONSTANT_P
+ is false, NON_CONSTANT_P should be NULL. */
+
+static tree
+cp_parser_constant_expression (cp_parser* parser,
+ bool allow_non_constant_p,
+ bool *non_constant_p)
+{
+ bool saved_integral_constant_expression_p;
+ bool saved_allow_non_integral_constant_expression_p;
+ bool saved_non_integral_constant_expression_p;
+ tree expression;
+
+ /* It might seem that we could simply parse the
+ conditional-expression, and then check to see if it were
+ TREE_CONSTANT. However, an expression that is TREE_CONSTANT is
+ one that the compiler can figure out is constant, possibly after
+ doing some simplifications or optimizations. The standard has a
+ precise definition of constant-expression, and we must honor
+ that, even though it is somewhat more restrictive.
+
+ For example:
+
+ int i[(2, 3)];
+
+ is not a legal declaration, because `(2, 3)' is not a
+ constant-expression. The `,' operator is forbidden in a
+ constant-expression. However, GCC's constant-folding machinery
+ will fold this operation to an INTEGER_CST for `3'. */
+
+ /* Save the old settings. */
+ saved_integral_constant_expression_p = parser->integral_constant_expression_p;
+ saved_allow_non_integral_constant_expression_p
+ = parser->allow_non_integral_constant_expression_p;
+ saved_non_integral_constant_expression_p = parser->non_integral_constant_expression_p;
+ /* We are now parsing a constant-expression. */
+ parser->integral_constant_expression_p = true;
+ parser->allow_non_integral_constant_expression_p = allow_non_constant_p;
+ parser->non_integral_constant_expression_p = false;
+ /* Although the grammar says "conditional-expression", we parse an
+ "assignment-expression", which also permits "throw-expression"
+ and the use of assignment operators. In the case that
+ ALLOW_NON_CONSTANT_P is false, we get better errors than we would
+ otherwise. In the case that ALLOW_NON_CONSTANT_P is true, it is
+ actually essential that we look for an assignment-expression.
+ For example, cp_parser_initializer_clauses uses this function to
+ determine whether a particular assignment-expression is in fact
+ constant. */
+ expression = cp_parser_assignment_expression (parser);
+ /* Restore the old settings. */
+ parser->integral_constant_expression_p = saved_integral_constant_expression_p;
+ parser->allow_non_integral_constant_expression_p
+ = saved_allow_non_integral_constant_expression_p;
+ if (allow_non_constant_p)
+ *non_constant_p = parser->non_integral_constant_expression_p;
+ parser->non_integral_constant_expression_p = saved_non_integral_constant_expression_p;
+
+ return expression;
+}
+
+/* Statements [gram.stmt.stmt] */
+
+/* Parse a statement.
+
+ statement:
+ labeled-statement
+ expression-statement
+ compound-statement
+ selection-statement
+ iteration-statement
+ jump-statement
+ declaration-statement
+ try-block */
+
+static void
+cp_parser_statement (cp_parser* parser, bool in_statement_expr_p)
+{
+ tree statement;
+ cp_token *token;
+ int statement_line_number;
+
+ /* There is no statement yet. */
+ statement = NULL_TREE;
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* Remember the line number of the first token in the statement. */
+ statement_line_number = token->location.line;
+ /* If this is a keyword, then that will often determine what kind of
+ statement we have. */
+ if (token->type == CPP_KEYWORD)
+ {
+ enum rid keyword = token->keyword;
+
+ switch (keyword)
+ {
+ case RID_CASE:
+ case RID_DEFAULT:
+ statement = cp_parser_labeled_statement (parser,
+ in_statement_expr_p);
+ break;
+
+ case RID_IF:
+ case RID_SWITCH:
+ statement = cp_parser_selection_statement (parser);
+ break;
+
+ case RID_WHILE:
+ case RID_DO:
+ case RID_FOR:
+ statement = cp_parser_iteration_statement (parser);
+ break;
+
+ case RID_BREAK:
+ case RID_CONTINUE:
+ case RID_RETURN:
+ case RID_GOTO:
+ statement = cp_parser_jump_statement (parser);
+ break;
+
+ case RID_TRY:
+ statement = cp_parser_try_block (parser);
+ break;
+
+ default:
+ /* It might be a keyword like `int' that can start a
+ declaration-statement. */
+ break;
+ }
+ }
+ else if (token->type == CPP_NAME)
+ {
+ /* If the next token is a `:', then we are looking at a
+ labeled-statement. */
+ token = cp_lexer_peek_nth_token (parser->lexer, 2);
+ if (token->type == CPP_COLON)
+ statement = cp_parser_labeled_statement (parser, in_statement_expr_p);
+ }
+ /* Anything that starts with a `{' must be a compound-statement. */
+ else if (token->type == CPP_OPEN_BRACE)
+ statement = cp_parser_compound_statement (parser, false);
+
+ /* Everything else must be a declaration-statement or an
+ expression-statement. Try for the declaration-statement
+ first, unless we are looking at a `;', in which case we know that
+ we have an expression-statement. */
+ if (!statement)
+ {
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
+ {
+ cp_parser_parse_tentatively (parser);
+ /* Try to parse the declaration-statement. */
+ cp_parser_declaration_statement (parser);
+ /* If that worked, we're done. */
+ if (cp_parser_parse_definitely (parser))
+ return;
+ }
+ /* Look for an expression-statement instead. */
+ statement = cp_parser_expression_statement (parser, in_statement_expr_p);
+ }
+
+ /* Set the line number for the statement. */
+ if (statement && STATEMENT_CODE_P (TREE_CODE (statement)))
+ STMT_LINENO (statement) = statement_line_number;
+}
+
+/* Parse a labeled-statement.
+
+ labeled-statement:
+ identifier : statement
+ case constant-expression : statement
+ default : statement
+
+ GNU Extension:
+
+ labeled-statement:
+ case constant-expression ... constant-expression : statement
+
+ Returns the new CASE_LABEL, for a `case' or `default' label. For
+ an ordinary label, returns a LABEL_STMT. */
+
+static tree
+cp_parser_labeled_statement (cp_parser* parser, bool in_statement_expr_p)
+{
+ cp_token *token;
+ tree statement = error_mark_node;
+
+ /* The next token should be an identifier. */
+ token = cp_lexer_peek_token (parser->lexer);
+ if (token->type != CPP_NAME
+ && token->type != CPP_KEYWORD)
+ {
+ cp_parser_error (parser, "expected labeled-statement");
+ return error_mark_node;
+ }
+
+ switch (token->keyword)
+ {
+ case RID_CASE:
+ {
+ tree expr, expr_hi;
+ cp_token *ellipsis;
+
+ /* Consume the `case' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the constant-expression. */
+ expr = cp_parser_constant_expression (parser,
+ /*allow_non_constant_p=*/false,
+ NULL);
+
+ ellipsis = cp_lexer_peek_token (parser->lexer);
+ if (ellipsis->type == CPP_ELLIPSIS)
+ {
+ /* Consume the `...' token. */
+ cp_lexer_consume_token (parser->lexer);
+ expr_hi =
+ cp_parser_constant_expression (parser,
+ /*allow_non_constant_p=*/false,
+ NULL);
+ /* We don't need to emit warnings here, as the common code
+ will do this for us. */
+ }
+ else
+ expr_hi = NULL_TREE;
+
+ if (!parser->in_switch_statement_p)
+ error ("case label `%E' not within a switch statement", expr);
+ else
+ statement = finish_case_label (expr, expr_hi);
+ }
+ break;
+
+ case RID_DEFAULT:
+ /* Consume the `default' token. */
+ cp_lexer_consume_token (parser->lexer);
+ if (!parser->in_switch_statement_p)
+ error ("case label not within a switch statement");
+ else
+ statement = finish_case_label (NULL_TREE, NULL_TREE);
+ break;
+
+ default:
+ /* Anything else must be an ordinary label. */
+ statement = finish_label_stmt (cp_parser_identifier (parser));
+ break;
+ }
+
+ /* Require the `:' token. */
+ cp_parser_require (parser, CPP_COLON, "`:'");
+ /* Parse the labeled statement. */
+ cp_parser_statement (parser, in_statement_expr_p);
+
+ /* Return the label, in the case of a `case' or `default' label. */
+ return statement;
+}
+
+/* Parse an expression-statement.
+
+ expression-statement:
+ expression [opt] ;
+
+ Returns the new EXPR_STMT -- or NULL_TREE if the expression
+ statement consists of nothing more than an `;'. IN_STATEMENT_EXPR_P
+ indicates whether this expression-statement is part of an
+ expression statement. */
+
+static tree
+cp_parser_expression_statement (cp_parser* parser, bool in_statement_expr_p)
+{
+ tree statement = NULL_TREE;
+
+ /* If the next token is a ';', then there is no expression
+ statement. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
+ statement = cp_parser_expression (parser);
+
+ /* Consume the final `;'. */
+ cp_parser_consume_semicolon_at_end_of_statement (parser);
+
+ if (in_statement_expr_p
+ && cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
+ {
+ /* This is the final expression statement of a statement
+ expression. */
+ statement = finish_stmt_expr_expr (statement);
+ }
+ else if (statement)
+ statement = finish_expr_stmt (statement);
+ else
+ finish_stmt ();
+
+ return statement;
+}
+
+/* Parse a compound-statement.
+
+ compound-statement:
+ { statement-seq [opt] }
+
+ Returns a COMPOUND_STMT representing the statement. */
+
+static tree
+cp_parser_compound_statement (cp_parser *parser, bool in_statement_expr_p)
+{
+ tree compound_stmt;
+
+ /* Consume the `{'. */
+ if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'"))
+ return error_mark_node;
+ /* Begin the compound-statement. */
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
+ /* Parse an (optional) statement-seq. */
+ cp_parser_statement_seq_opt (parser, in_statement_expr_p);
+ /* Finish the compound-statement. */
+ finish_compound_stmt (compound_stmt);
+ /* Consume the `}'. */
+ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
+
+ return compound_stmt;
+}
+
+/* Parse an (optional) statement-seq.
+
+ statement-seq:
+ statement
+ statement-seq [opt] statement */
+
+static void
+cp_parser_statement_seq_opt (cp_parser* parser, bool in_statement_expr_p)
+{
+ /* Scan statements until there aren't any more. */
+ while (true)
+ {
+ /* If we're looking at a `}', then we've run out of statements. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE)
+ || cp_lexer_next_token_is (parser->lexer, CPP_EOF))
+ break;
+
+ /* Parse the statement. */
+ cp_parser_statement (parser, in_statement_expr_p);
+ }
+}
+
+/* Parse a selection-statement.
+
+ selection-statement:
+ if ( condition ) statement
+ if ( condition ) statement else statement
+ switch ( condition ) statement
+
+ Returns the new IF_STMT or SWITCH_STMT. */
+
+static tree
+cp_parser_selection_statement (cp_parser* parser)
+{
+ cp_token *token;
+ enum rid keyword;
+
+ /* Peek at the next token. */
+ token = cp_parser_require (parser, CPP_KEYWORD, "selection-statement");
+
+ /* See what kind of keyword it is. */
+ keyword = token->keyword;
+ switch (keyword)
+ {
+ case RID_IF:
+ case RID_SWITCH:
+ {
+ tree statement;
+ tree condition;
+
+ /* Look for the `('. */
+ if (!cp_parser_require (parser, CPP_OPEN_PAREN, "`('"))
+ {
+ cp_parser_skip_to_end_of_statement (parser);
+ return error_mark_node;
+ }
+
+ /* Begin the selection-statement. */
+ if (keyword == RID_IF)
+ statement = begin_if_stmt ();
+ else
+ statement = begin_switch_stmt ();
+
+ /* Parse the condition. */
+ condition = cp_parser_condition (parser);
+ /* Look for the `)'. */
+ if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"))
+ cp_parser_skip_to_closing_parenthesis (parser, true, false,
+ /*consume_paren=*/true);
+
+ if (keyword == RID_IF)
+ {
+ tree then_stmt;
+
+ /* Add the condition. */
+ finish_if_stmt_cond (condition, statement);
+
+ /* Parse the then-clause. */
+ then_stmt = cp_parser_implicitly_scoped_statement (parser);
+ finish_then_clause (statement);
+
+ /* If the next token is `else', parse the else-clause. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer,
+ RID_ELSE))
+ {
+ tree else_stmt;
+
+ /* Consume the `else' keyword. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the else-clause. */
+ else_stmt
+ = cp_parser_implicitly_scoped_statement (parser);
+ finish_else_clause (statement);
+ }
+
+ /* Now we're all done with the if-statement. */
+ finish_if_stmt ();
+ }
+ else
+ {
+ tree body;
+ bool in_switch_statement_p;
+
+ /* Add the condition. */
+ finish_switch_cond (condition, statement);
+
+ /* Parse the body of the switch-statement. */
+ in_switch_statement_p = parser->in_switch_statement_p;
+ parser->in_switch_statement_p = true;
+ body = cp_parser_implicitly_scoped_statement (parser);
+ parser->in_switch_statement_p = in_switch_statement_p;
+
+ /* Now we're all done with the switch-statement. */
+ finish_switch_stmt (statement);
+ }
+
+ return statement;
+ }
+ break;
+
+ default:
+ cp_parser_error (parser, "expected selection-statement");
+ return error_mark_node;
+ }
+}
+
+/* Parse a condition.
+
+ condition:
+ expression
+ type-specifier-seq declarator = assignment-expression
+
+ GNU Extension:
+
+ condition:
+ type-specifier-seq declarator asm-specification [opt]
+ attributes [opt] = assignment-expression
+
+ Returns the expression that should be tested. */
+
+static tree
+cp_parser_condition (cp_parser* parser)
+{
+ tree type_specifiers;
+ const char *saved_message;
+
+ /* Try the declaration first. */
+ cp_parser_parse_tentatively (parser);
+ /* New types are not allowed in the type-specifier-seq for a
+ condition. */
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = "types may not be defined in conditions";
+ /* Parse the type-specifier-seq. */
+ type_specifiers = cp_parser_type_specifier_seq (parser);
+ /* Restore the saved message. */
+ parser->type_definition_forbidden_message = saved_message;
+ /* If all is well, we might be looking at a declaration. */
+ if (!cp_parser_error_occurred (parser))
+ {
+ tree decl;
+ tree asm_specification;
+ tree attributes;
+ tree declarator;
+ tree initializer = NULL_TREE;
+
+ /* Parse the declarator. */
+ declarator = cp_parser_declarator (parser, CP_PARSER_DECLARATOR_NAMED,
+ /*ctor_dtor_or_conv_p=*/NULL,
+ /*parenthesized_p=*/NULL);
+ /* Parse the attributes. */
+ attributes = cp_parser_attributes_opt (parser);
+ /* Parse the asm-specification. */
+ asm_specification = cp_parser_asm_specification_opt (parser);
+ /* If the next token is not an `=', then we might still be
+ looking at an expression. For example:
+
+ if (A(a).x)
+
+ looks like a decl-specifier-seq and a declarator -- but then
+ there is no `=', so this is an expression. */
+ cp_parser_require (parser, CPP_EQ, "`='");
+ /* If we did see an `=', then we are looking at a declaration
+ for sure. */
+ if (cp_parser_parse_definitely (parser))
+ {
+ /* Create the declaration. */
+ decl = start_decl (declarator, type_specifiers,
+ /*initialized_p=*/true,
+ attributes, /*prefix_attributes=*/NULL_TREE);
+ /* Parse the assignment-expression. */
+ initializer = cp_parser_assignment_expression (parser);
+
+ /* Process the initializer. */
+ cp_finish_decl (decl,
+ initializer,
+ asm_specification,
+ LOOKUP_ONLYCONVERTING);
+
+ return convert_from_reference (decl);
+ }
+ }
+ /* If we didn't even get past the declarator successfully, we are
+ definitely not looking at a declaration. */
+ else
+ cp_parser_abort_tentative_parse (parser);
+
+ /* Otherwise, we are looking at an expression. */
+ return cp_parser_expression (parser);
+}
+
+/* Parse an iteration-statement.
+
+ iteration-statement:
+ while ( condition ) statement
+ do statement while ( expression ) ;
+ for ( for-init-statement condition [opt] ; expression [opt] )
+ statement
+
+ Returns the new WHILE_STMT, DO_STMT, or FOR_STMT. */
+
+static tree
+cp_parser_iteration_statement (cp_parser* parser)
+{
+ cp_token *token;
+ enum rid keyword;
+ tree statement;
+ bool in_iteration_statement_p;
+
+
+ /* Peek at the next token. */
+ token = cp_parser_require (parser, CPP_KEYWORD, "iteration-statement");
+ if (!token)
+ return error_mark_node;
+
+ /* Remember whether or not we are already within an iteration
+ statement. */
+ in_iteration_statement_p = parser->in_iteration_statement_p;
+
+ /* See what kind of keyword it is. */
+ keyword = token->keyword;
+ switch (keyword)
+ {
+ case RID_WHILE:
+ {
+ tree condition;
+
+ /* Begin the while-statement. */
+ statement = begin_while_stmt ();
+ /* Look for the `('. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ /* Parse the condition. */
+ condition = cp_parser_condition (parser);
+ finish_while_stmt_cond (condition, statement);
+ /* Look for the `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ /* Parse the dependent statement. */
+ parser->in_iteration_statement_p = true;
+ cp_parser_already_scoped_statement (parser);
+ parser->in_iteration_statement_p = in_iteration_statement_p;
+ /* We're done with the while-statement. */
+ finish_while_stmt (statement);
+ }
+ break;
+
+ case RID_DO:
+ {
+ tree expression;
+
+ /* Begin the do-statement. */
+ statement = begin_do_stmt ();
+ /* Parse the body of the do-statement. */
+ parser->in_iteration_statement_p = true;
+ cp_parser_implicitly_scoped_statement (parser);
+ parser->in_iteration_statement_p = in_iteration_statement_p;
+ finish_do_body (statement);
+ /* Look for the `while' keyword. */
+ cp_parser_require_keyword (parser, RID_WHILE, "`while'");
+ /* Look for the `('. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ /* Parse the expression. */
+ expression = cp_parser_expression (parser);
+ /* We're done with the do-statement. */
+ finish_do_stmt (expression, statement);
+ /* Look for the `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ /* Look for the `;'. */
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+ }
+ break;
+
+ case RID_FOR:
+ {
+ tree condition = NULL_TREE;
+ tree expression = NULL_TREE;
+
+ /* Begin the for-statement. */
+ statement = begin_for_stmt ();
+ /* Look for the `('. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ /* Parse the initialization. */
+ cp_parser_for_init_statement (parser);
+ finish_for_init_stmt (statement);
+
+ /* If there's a condition, process it. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
+ condition = cp_parser_condition (parser);
+ finish_for_cond (condition, statement);
+ /* Look for the `;'. */
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+
+ /* If there's an expression, process it. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN))
+ expression = cp_parser_expression (parser);
+ finish_for_expr (expression, statement);
+ /* Look for the `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+
+ /* Parse the body of the for-statement. */
+ parser->in_iteration_statement_p = true;
+ cp_parser_already_scoped_statement (parser);
+ parser->in_iteration_statement_p = in_iteration_statement_p;
+
+ /* We're done with the for-statement. */
+ finish_for_stmt (statement);
+ }
+ break;
+
+ default:
+ cp_parser_error (parser, "expected iteration-statement");
+ statement = error_mark_node;
+ break;
+ }
+
+ return statement;
+}
+
+/* Parse a for-init-statement.
+
+ for-init-statement:
+ expression-statement
+ simple-declaration */
+
+static void
+cp_parser_for_init_statement (cp_parser* parser)
+{
+ /* If the next token is a `;', then we have an empty
+ expression-statement. Grammatically, this is also a
+ simple-declaration, but an invalid one, because it does not
+ declare anything. Therefore, if we did not handle this case
+ specially, we would issue an error message about an invalid
+ declaration. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
+ {
+ /* We're going to speculatively look for a declaration, falling back
+ to an expression, if necessary. */
+ cp_parser_parse_tentatively (parser);
+ /* Parse the declaration. */
+ cp_parser_simple_declaration (parser,
+ /*function_definition_allowed_p=*/false);
+ /* If the tentative parse failed, then we shall need to look for an
+ expression-statement. */
+ if (cp_parser_parse_definitely (parser))
+ return;
+ }
+
+ cp_parser_expression_statement (parser, false);
+}
+
+/* Parse a jump-statement.
+
+ jump-statement:
+ break ;
+ continue ;
+ return expression [opt] ;
+ goto identifier ;
+
+ GNU extension:
+
+ jump-statement:
+ goto * expression ;
+
+ Returns the new BREAK_STMT, CONTINUE_STMT, RETURN_STMT, or
+ GOTO_STMT. */
+
+static tree
+cp_parser_jump_statement (cp_parser* parser)
+{
+ tree statement = error_mark_node;
+ cp_token *token;
+ enum rid keyword;
+
+ /* Peek at the next token. */
+ token = cp_parser_require (parser, CPP_KEYWORD, "jump-statement");
+ if (!token)
+ return error_mark_node;
+
+ /* See what kind of keyword it is. */
+ keyword = token->keyword;
+ switch (keyword)
+ {
+ case RID_BREAK:
+ if (!parser->in_switch_statement_p
+ && !parser->in_iteration_statement_p)
+ {
+ error ("break statement not within loop or switch");
+ statement = error_mark_node;
+ }
+ else
+ statement = finish_break_stmt ();
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+ break;
+
+ case RID_CONTINUE:
+ if (!parser->in_iteration_statement_p)
+ {
+ error ("continue statement not within a loop");
+ statement = error_mark_node;
+ }
+ else
+ statement = finish_continue_stmt ();
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+ break;
+
+ case RID_RETURN:
+ {
+ tree expr;
+
+ /* If the next token is a `;', then there is no
+ expression. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
+ expr = cp_parser_expression (parser);
+ else
+ expr = NULL_TREE;
+ /* Build the return-statement. */
+ statement = finish_return_stmt (expr);
+ /* Look for the final `;'. */
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+ }
+ break;
+
+ case RID_GOTO:
+ /* Create the goto-statement. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_MULT))
+ {
+ /* Issue a warning about this use of a GNU extension. */
+ if (pedantic)
+ pedwarn ("ISO C++ forbids computed gotos");
+ /* Consume the '*' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the dependent expression. */
+ finish_goto_stmt (cp_parser_expression (parser));
+ }
+ else
+ finish_goto_stmt (cp_parser_identifier (parser));
+ /* Look for the final `;'. */
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+ break;
+
+ default:
+ cp_parser_error (parser, "expected jump-statement");
+ break;
+ }
+
+ return statement;
+}
+
+/* Parse a declaration-statement.
+
+ declaration-statement:
+ block-declaration */
+
+static void
+cp_parser_declaration_statement (cp_parser* parser)
+{
+ /* Parse the block-declaration. */
+ cp_parser_block_declaration (parser, /*statement_p=*/true);
+
+ /* Finish off the statement. */
+ finish_stmt ();
+}
+
+/* Some dependent statements (like `if (cond) statement'), are
+ implicitly in their own scope. In other words, if the statement is
+ a single statement (as opposed to a compound-statement), it is
+ none-the-less treated as if it were enclosed in braces. Any
+ declarations appearing in the dependent statement are out of scope
+ after control passes that point. This function parses a statement,
+ but ensures that is in its own scope, even if it is not a
+ compound-statement.
+
+ Returns the new statement. */
+
+static tree
+cp_parser_implicitly_scoped_statement (cp_parser* parser)
+{
+ tree statement;
+
+ /* If the token is not a `{', then we must take special action. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
+ {
+ /* Create a compound-statement. */
+ statement = begin_compound_stmt (/*has_no_scope=*/false);
+ /* Parse the dependent-statement. */
+ cp_parser_statement (parser, false);
+ /* Finish the dummy compound-statement. */
+ finish_compound_stmt (statement);
+ }
+ /* Otherwise, we simply parse the statement directly. */
+ else
+ statement = cp_parser_compound_statement (parser, false);
+
+ /* Return the statement. */
+ return statement;
+}
+
+/* For some dependent statements (like `while (cond) statement'), we
+ have already created a scope. Therefore, even if the dependent
+ statement is a compound-statement, we do not want to create another
+ scope. */
+
+static void
+cp_parser_already_scoped_statement (cp_parser* parser)
+{
+ /* If the token is not a `{', then we must take special action. */
+ if (cp_lexer_next_token_is_not(parser->lexer, CPP_OPEN_BRACE))
+ {
+ tree statement;
+
+ /* Create a compound-statement. */
+ statement = begin_compound_stmt (/*has_no_scope=*/true);
+ /* Parse the dependent-statement. */
+ cp_parser_statement (parser, false);
+ /* Finish the dummy compound-statement. */
+ finish_compound_stmt (statement);
+ }
+ /* Otherwise, we simply parse the statement directly. */
+ else
+ cp_parser_statement (parser, false);
+}
+
+/* Declarations [gram.dcl.dcl] */
+
+/* Parse an optional declaration-sequence.
+
+ declaration-seq:
+ declaration
+ declaration-seq declaration */
+
+static void
+cp_parser_declaration_seq_opt (cp_parser* parser)
+{
+ while (true)
+ {
+ cp_token *token;
+
+ token = cp_lexer_peek_token (parser->lexer);
+
+ if (token->type == CPP_CLOSE_BRACE
+ || token->type == CPP_EOF)
+ break;
+
+ if (token->type == CPP_SEMICOLON)
+ {
+ /* A declaration consisting of a single semicolon is
+ invalid. Allow it unless we're being pedantic. */
+ if (pedantic && !in_system_header)
+ pedwarn ("extra `;'");
+ cp_lexer_consume_token (parser->lexer);
+ continue;
+ }
+
+ /* The C lexer modifies PENDING_LANG_CHANGE when it wants the
+ parser to enter or exit implicit `extern "C"' blocks. */
+ while (pending_lang_change > 0)
+ {
+ push_lang_context (lang_name_c);
+ --pending_lang_change;
+ }
+ while (pending_lang_change < 0)
+ {
+ pop_lang_context ();
+ ++pending_lang_change;
+ }
+
+ /* Parse the declaration itself. */
+ cp_parser_declaration (parser);
+ }
+}
+
+/* Parse a declaration.
+
+ declaration:
+ block-declaration
+ function-definition
+ template-declaration
+ explicit-instantiation
+ explicit-specialization
+ linkage-specification
+ namespace-definition
+
+ GNU extension:
+
+ declaration:
+ __extension__ declaration */
+
+static void
+cp_parser_declaration (cp_parser* parser)
+{
+ cp_token token1;
+ cp_token token2;
+ int saved_pedantic;
+
+ /* Check for the `__extension__' keyword. */
+ if (cp_parser_extension_opt (parser, &saved_pedantic))
+ {
+ /* Parse the qualified declaration. */
+ cp_parser_declaration (parser);
+ /* Restore the PEDANTIC flag. */
+ pedantic = saved_pedantic;
+
+ return;
+ }
+
+ /* Try to figure out what kind of declaration is present. */
+ token1 = *cp_lexer_peek_token (parser->lexer);
+ if (token1.type != CPP_EOF)
+ token2 = *cp_lexer_peek_nth_token (parser->lexer, 2);
+
+ /* If the next token is `extern' and the following token is a string
+ literal, then we have a linkage specification. */
+ if (token1.keyword == RID_EXTERN
+ && cp_parser_is_string_literal (&token2))
+ cp_parser_linkage_specification (parser);
+ /* If the next token is `template', then we have either a template
+ declaration, an explicit instantiation, or an explicit
+ specialization. */
+ else if (token1.keyword == RID_TEMPLATE)
+ {
+ /* `template <>' indicates a template specialization. */
+ if (token2.type == CPP_LESS
+ && cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_GREATER)
+ cp_parser_explicit_specialization (parser);
+ /* `template <' indicates a template declaration. */
+ else if (token2.type == CPP_LESS)
+ cp_parser_template_declaration (parser, /*member_p=*/false);
+ /* Anything else must be an explicit instantiation. */
+ else
+ cp_parser_explicit_instantiation (parser);
+ }
+ /* If the next token is `export', then we have a template
+ declaration. */
+ else if (token1.keyword == RID_EXPORT)
+ cp_parser_template_declaration (parser, /*member_p=*/false);
+ /* If the next token is `extern', 'static' or 'inline' and the one
+ after that is `template', we have a GNU extended explicit
+ instantiation directive. */
+ else if (cp_parser_allow_gnu_extensions_p (parser)
+ && (token1.keyword == RID_EXTERN
+ || token1.keyword == RID_STATIC
+ || token1.keyword == RID_INLINE)
+ && token2.keyword == RID_TEMPLATE)
+ cp_parser_explicit_instantiation (parser);
+ /* If the next token is `namespace', check for a named or unnamed
+ namespace definition. */
+ else if (token1.keyword == RID_NAMESPACE
+ && (/* A named namespace definition. */
+ (token2.type == CPP_NAME
+ && (cp_lexer_peek_nth_token (parser->lexer, 3)->type
+ == CPP_OPEN_BRACE))
+ /* An unnamed namespace definition. */
+ || token2.type == CPP_OPEN_BRACE))
+ cp_parser_namespace_definition (parser);
+ /* We must have either a block declaration or a function
+ definition. */
+ else
+ /* Try to parse a block-declaration, or a function-definition. */
+ cp_parser_block_declaration (parser, /*statement_p=*/false);
+}
+
+/* Parse a block-declaration.
+
+ block-declaration:
+ simple-declaration
+ asm-definition
+ namespace-alias-definition
+ using-declaration
+ using-directive
+
+ GNU Extension:
+
+ block-declaration:
+ __extension__ block-declaration
+ label-declaration
+
+ If STATEMENT_P is TRUE, then this block-declaration is occurring as
+ part of a declaration-statement. */
+
+static void
+cp_parser_block_declaration (cp_parser *parser,
+ bool statement_p)
+{
+ cp_token *token1;
+ int saved_pedantic;
+
+ /* Check for the `__extension__' keyword. */
+ if (cp_parser_extension_opt (parser, &saved_pedantic))
+ {
+ /* Parse the qualified declaration. */
+ cp_parser_block_declaration (parser, statement_p);
+ /* Restore the PEDANTIC flag. */
+ pedantic = saved_pedantic;
+
+ return;
+ }
+
+ /* Peek at the next token to figure out which kind of declaration is
+ present. */
+ token1 = cp_lexer_peek_token (parser->lexer);
+
+ /* If the next keyword is `asm', we have an asm-definition. */
+ if (token1->keyword == RID_ASM)
+ {
+ if (statement_p)
+ cp_parser_commit_to_tentative_parse (parser);
+ cp_parser_asm_definition (parser);
+ }
+ /* If the next keyword is `namespace', we have a
+ namespace-alias-definition. */
+ else if (token1->keyword == RID_NAMESPACE)
+ cp_parser_namespace_alias_definition (parser);
+ /* If the next keyword is `using', we have either a
+ using-declaration or a using-directive. */
+ else if (token1->keyword == RID_USING)
+ {
+ cp_token *token2;
+
+ if (statement_p)
+ cp_parser_commit_to_tentative_parse (parser);
+ /* If the token after `using' is `namespace', then we have a
+ using-directive. */
+ token2 = cp_lexer_peek_nth_token (parser->lexer, 2);
+ if (token2->keyword == RID_NAMESPACE)
+ cp_parser_using_directive (parser);
+ /* Otherwise, it's a using-declaration. */
+ else
+ cp_parser_using_declaration (parser);
+ }
+ /* If the next keyword is `__label__' we have a label declaration. */
+ else if (token1->keyword == RID_LABEL)
+ {
+ if (statement_p)
+ cp_parser_commit_to_tentative_parse (parser);
+ cp_parser_label_declaration (parser);
+ }
+ /* Anything else must be a simple-declaration. */
+ else
+ cp_parser_simple_declaration (parser, !statement_p);
+}
+
+/* Parse a simple-declaration.
+
+ simple-declaration:
+ decl-specifier-seq [opt] init-declarator-list [opt] ;
+
+ init-declarator-list:
+ init-declarator
+ init-declarator-list , init-declarator
+
+ If FUNCTION_DEFINITION_ALLOWED_P is TRUE, then we also recognize a
+ function-definition as a simple-declaration. */
+
+static void
+cp_parser_simple_declaration (cp_parser* parser,
+ bool function_definition_allowed_p)
+{
+ tree decl_specifiers;
+ tree attributes;
+ int declares_class_or_enum;
+ bool saw_declarator;
+
+ /* Defer access checks until we know what is being declared; the
+ checks for names appearing in the decl-specifier-seq should be
+ done as if we were in the scope of the thing being declared. */
+ push_deferring_access_checks (dk_deferred);
+
+ /* Parse the decl-specifier-seq. We have to keep track of whether
+ or not the decl-specifier-seq declares a named class or
+ enumeration type, since that is the only case in which the
+ init-declarator-list is allowed to be empty.
+
+ [dcl.dcl]
+
+ In a simple-declaration, the optional init-declarator-list can be
+ omitted only when declaring a class or enumeration, that is when
+ the decl-specifier-seq contains either a class-specifier, an
+ elaborated-type-specifier, or an enum-specifier. */
+ decl_specifiers
+ = cp_parser_decl_specifier_seq (parser,
+ CP_PARSER_FLAGS_OPTIONAL,
+ &attributes,
+ &declares_class_or_enum);
+ /* We no longer need to defer access checks. */
+ stop_deferring_access_checks ();
+
+ /* In a block scope, a valid declaration must always have a
+ decl-specifier-seq. By not trying to parse declarators, we can
+ resolve the declaration/expression ambiguity more quickly. */
+ if (!function_definition_allowed_p && !decl_specifiers)
+ {
+ cp_parser_error (parser, "expected declaration");
+ goto done;
+ }
+
+ /* If the next two tokens are both identifiers, the code is
+ erroneous. The usual cause of this situation is code like:
+
+ T t;
+
+ where "T" should name a type -- but does not. */
+ if (cp_parser_diagnose_invalid_type_name (parser))
+ {
+ /* If parsing tentatively, we should commit; we really are
+ looking at a declaration. */
+ cp_parser_commit_to_tentative_parse (parser);
+ /* Give up. */
+ goto done;
+ }
+
+ /* Keep going until we hit the `;' at the end of the simple
+ declaration. */
+ saw_declarator = false;
+ while (cp_lexer_next_token_is_not (parser->lexer,
+ CPP_SEMICOLON))
+ {
+ cp_token *token;
+ bool function_definition_p;
+ tree decl;
+
+ saw_declarator = true;
+ /* Parse the init-declarator. */
+ decl = cp_parser_init_declarator (parser, decl_specifiers, attributes,
+ function_definition_allowed_p,
+ /*member_p=*/false,
+ declares_class_or_enum,
+ &function_definition_p);
+ /* If an error occurred while parsing tentatively, exit quickly.
+ (That usually happens when in the body of a function; each
+ statement is treated as a declaration-statement until proven
+ otherwise.) */
+ if (cp_parser_error_occurred (parser))
+ goto done;
+ /* Handle function definitions specially. */
+ if (function_definition_p)
+ {
+ /* If the next token is a `,', then we are probably
+ processing something like:
+
+ void f() {}, *p;
+
+ which is erroneous. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ error ("mixing declarations and function-definitions is forbidden");
+ /* Otherwise, we're done with the list of declarators. */
+ else
+ {
+ pop_deferring_access_checks ();
+ return;
+ }
+ }
+ /* The next token should be either a `,' or a `;'. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's a `,', there are more declarators to come. */
+ if (token->type == CPP_COMMA)
+ cp_lexer_consume_token (parser->lexer);
+ /* If it's a `;', we are done. */
+ else if (token->type == CPP_SEMICOLON)
+ break;
+ /* Anything else is an error. */
+ else
+ {
+ cp_parser_error (parser, "expected `,' or `;'");
+ /* Skip tokens until we reach the end of the statement. */
+ cp_parser_skip_to_end_of_statement (parser);
+ /* If the next token is now a `;', consume it. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
+ cp_lexer_consume_token (parser->lexer);
+ goto done;
+ }
+ /* After the first time around, a function-definition is not
+ allowed -- even if it was OK at first. For example:
+
+ int i, f() {}
+
+ is not valid. */
+ function_definition_allowed_p = false;
+ }
+
+ /* Issue an error message if no declarators are present, and the
+ decl-specifier-seq does not itself declare a class or
+ enumeration. */
+ if (!saw_declarator)
+ {
+ if (cp_parser_declares_only_class_p (parser))
+ shadow_tag (decl_specifiers);
+ /* Perform any deferred access checks. */
+ perform_deferred_access_checks ();
+ }
+
+ /* Consume the `;'. */
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+
+ done:
+ pop_deferring_access_checks ();
+}
+
+/* Parse a decl-specifier-seq.
+
+ decl-specifier-seq:
+ decl-specifier-seq [opt] decl-specifier
+
+ decl-specifier:
+ storage-class-specifier
+ type-specifier
+ function-specifier
+ friend
+ typedef
+
+ GNU Extension:
+
+ decl-specifier:
+ attributes
+
+ Returns a TREE_LIST, giving the decl-specifiers in the order they
+ appear in the source code. The TREE_VALUE of each node is the
+ decl-specifier. For a keyword (such as `auto' or `friend'), the
+ TREE_VALUE is simply the corresponding TREE_IDENTIFIER. For the
+ representation of a type-specifier, see cp_parser_type_specifier.
+
+ If there are attributes, they will be stored in *ATTRIBUTES,
+ represented as described above cp_parser_attributes.
+
+ If FRIEND_IS_NOT_CLASS_P is non-NULL, and the `friend' specifier
+ appears, and the entity that will be a friend is not going to be a
+ class, then *FRIEND_IS_NOT_CLASS_P will be set to TRUE. Note that
+ even if *FRIEND_IS_NOT_CLASS_P is FALSE, the entity to which
+ friendship is granted might not be a class.
+
+ *DECLARES_CLASS_OR_ENUM is set to the bitwise or of the following
+ flags:
+
+ 1: one of the decl-specifiers is an elaborated-type-specifier
+ (i.e., a type declaration)
+ 2: one of the decl-specifiers is an enum-specifier or a
+ class-specifier (i.e., a type definition)
+
+ */
+
+static tree
+cp_parser_decl_specifier_seq (cp_parser* parser,
+ cp_parser_flags flags,
+ tree* attributes,
+ int* declares_class_or_enum)
+{
+ tree decl_specs = NULL_TREE;
+ bool friend_p = false;
+ bool constructor_possible_p = !parser->in_declarator_p;
+
+ /* Assume no class or enumeration type is declared. */
+ *declares_class_or_enum = 0;
+
+ /* Assume there are no attributes. */
+ *attributes = NULL_TREE;
+
+ /* Keep reading specifiers until there are no more to read. */
+ while (true)
+ {
+ tree decl_spec = NULL_TREE;
+ bool constructor_p;
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* Handle attributes. */
+ if (token->keyword == RID_ATTRIBUTE)
+ {
+ /* Parse the attributes. */
+ decl_spec = cp_parser_attributes_opt (parser);
+ /* Add them to the list. */
+ *attributes = chainon (*attributes, decl_spec);
+ continue;
+ }
+ /* If the next token is an appropriate keyword, we can simply
+ add it to the list. */
+ switch (token->keyword)
+ {
+ case RID_FRIEND:
+ /* decl-specifier:
+ friend */
+ if (friend_p)
+ error ("duplicate `friend'");
+ else
+ friend_p = true;
+ /* The representation of the specifier is simply the
+ appropriate TREE_IDENTIFIER node. */
+ decl_spec = token->value;
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
+ break;
+
+ /* function-specifier:
+ inline
+ virtual
+ explicit */
+ case RID_INLINE:
+ case RID_VIRTUAL:
+ case RID_EXPLICIT:
+ decl_spec = cp_parser_function_specifier_opt (parser);
+ break;
+
+ /* decl-specifier:
+ typedef */
+ case RID_TYPEDEF:
+ /* The representation of the specifier is simply the
+ appropriate TREE_IDENTIFIER node. */
+ decl_spec = token->value;
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* A constructor declarator cannot appear in a typedef. */
+ constructor_possible_p = false;
+ /* The "typedef" keyword can only occur in a declaration; we
+ may as well commit at this point. */
+ cp_parser_commit_to_tentative_parse (parser);
+ break;
+
+ /* storage-class-specifier:
+ auto
+ register
+ static
+ extern
+ mutable
+
+ GNU Extension:
+ thread */
+ case RID_AUTO:
+ case RID_REGISTER:
+ case RID_STATIC:
+ case RID_EXTERN:
+ case RID_MUTABLE:
+ case RID_THREAD:
+ decl_spec = cp_parser_storage_class_specifier_opt (parser);
+ break;
+
+ default:
+ break;
+ }
+
+ /* Constructors are a special case. The `S' in `S()' is not a
+ decl-specifier; it is the beginning of the declarator. */
+ constructor_p = (!decl_spec
+ && constructor_possible_p
+ && cp_parser_constructor_declarator_p (parser,
+ friend_p));
+
+ /* If we don't have a DECL_SPEC yet, then we must be looking at
+ a type-specifier. */
+ if (!decl_spec && !constructor_p)
+ {
+ int decl_spec_declares_class_or_enum;
+ bool is_cv_qualifier;
+
+ decl_spec
+ = cp_parser_type_specifier (parser, flags,
+ friend_p,
+ /*is_declaration=*/true,
+ &decl_spec_declares_class_or_enum,
+ &is_cv_qualifier);
+
+ *declares_class_or_enum |= decl_spec_declares_class_or_enum;
+
+ /* If this type-specifier referenced a user-defined type
+ (a typedef, class-name, etc.), then we can't allow any
+ more such type-specifiers henceforth.
+
+ [dcl.spec]
+
+ The longest sequence of decl-specifiers that could
+ possibly be a type name is taken as the
+ decl-specifier-seq of a declaration. The sequence shall
+ be self-consistent as described below.
+
+ [dcl.type]
+
+ As a general rule, at most one type-specifier is allowed
+ in the complete decl-specifier-seq of a declaration. The
+ only exceptions are the following:
+
+ -- const or volatile can be combined with any other
+ type-specifier.
+
+ -- signed or unsigned can be combined with char, long,
+ short, or int.
+
+ -- ..
+
+ Example:
+
+ typedef char* Pc;
+ void g (const int Pc);
+
+ Here, Pc is *not* part of the decl-specifier seq; it's
+ the declarator. Therefore, once we see a type-specifier
+ (other than a cv-qualifier), we forbid any additional
+ user-defined types. We *do* still allow things like `int
+ int' to be considered a decl-specifier-seq, and issue the
+ error message later. */
+ if (decl_spec && !is_cv_qualifier)
+ flags |= CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES;
+ /* A constructor declarator cannot follow a type-specifier. */
+ if (decl_spec)
+ constructor_possible_p = false;
+ }
+
+ /* If we still do not have a DECL_SPEC, then there are no more
+ decl-specifiers. */
+ if (!decl_spec)
+ {
+ /* Issue an error message, unless the entire construct was
+ optional. */
+ if (!(flags & CP_PARSER_FLAGS_OPTIONAL))
+ {
+ cp_parser_error (parser, "expected decl specifier");
+ return error_mark_node;
+ }
+
+ break;
+ }
+
+ /* Add the DECL_SPEC to the list of specifiers. */
+ if (decl_specs == NULL || TREE_VALUE (decl_specs) != error_mark_node)
+ decl_specs = tree_cons (NULL_TREE, decl_spec, decl_specs);
+
+ /* After we see one decl-specifier, further decl-specifiers are
+ always optional. */
+ flags |= CP_PARSER_FLAGS_OPTIONAL;
+ }
+
+ /* Don't allow a friend specifier with a class definition. */
+ if (friend_p && (*declares_class_or_enum & 2))
+ error ("class definition may not be declared a friend");
+
+ /* We have built up the DECL_SPECS in reverse order. Return them in
+ the correct order. */
+ return nreverse (decl_specs);
+}
+
+/* Parse an (optional) storage-class-specifier.
+
+ storage-class-specifier:
+ auto
+ register
+ static
+ extern
+ mutable
+
+ GNU Extension:
+
+ storage-class-specifier:
+ thread
+
+ Returns an IDENTIFIER_NODE corresponding to the keyword used. */
+
+static tree
+cp_parser_storage_class_specifier_opt (cp_parser* parser)
+{
+ switch (cp_lexer_peek_token (parser->lexer)->keyword)
+ {
+ case RID_AUTO:
+ case RID_REGISTER:
+ case RID_STATIC:
+ case RID_EXTERN:
+ case RID_MUTABLE:
+ case RID_THREAD:
+ /* Consume the token. */
+ return cp_lexer_consume_token (parser->lexer)->value;
+
+ default:
+ return NULL_TREE;
+ }
+}
+
+/* Parse an (optional) function-specifier.
+
+ function-specifier:
+ inline
+ virtual
+ explicit
+
+ Returns an IDENTIFIER_NODE corresponding to the keyword used. */
+
+static tree
+cp_parser_function_specifier_opt (cp_parser* parser)
+{
+ switch (cp_lexer_peek_token (parser->lexer)->keyword)
+ {
+ case RID_INLINE:
+ case RID_VIRTUAL:
+ case RID_EXPLICIT:
+ /* Consume the token. */
+ return cp_lexer_consume_token (parser->lexer)->value;
+
+ default:
+ return NULL_TREE;
+ }
+}
+
+/* Parse a linkage-specification.
+
+ linkage-specification:
+ extern string-literal { declaration-seq [opt] }
+ extern string-literal declaration */
+
+static void
+cp_parser_linkage_specification (cp_parser* parser)
+{
+ cp_token *token;
+ tree linkage;
+
+ /* Look for the `extern' keyword. */
+ cp_parser_require_keyword (parser, RID_EXTERN, "`extern'");
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's not a string-literal, then there's a problem. */
+ if (!cp_parser_is_string_literal (token))
+ {
+ cp_parser_error (parser, "expected language-name");
+ return;
+ }
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
+
+ /* Transform the literal into an identifier. If the literal is a
+ wide-character string, or contains embedded NULs, then we can't
+ handle it as the user wants. */
+ if (token->type == CPP_WSTRING
+ || (strlen (TREE_STRING_POINTER (token->value))
+ != (size_t) (TREE_STRING_LENGTH (token->value) - 1)))
+ {
+ cp_parser_error (parser, "invalid linkage-specification");
+ /* Assume C++ linkage. */
+ linkage = get_identifier ("c++");
+ }
+ /* If it's a simple string constant, things are easier. */
+ else
+ linkage = get_identifier (TREE_STRING_POINTER (token->value));
+
+ /* We're now using the new linkage. */
+ push_lang_context (linkage);
+
+ /* If the next token is a `{', then we're using the first
+ production. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ /* Consume the `{' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the declarations. */
+ cp_parser_declaration_seq_opt (parser);
+ /* Look for the closing `}'. */
+ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
+ }
+ /* Otherwise, there's just one declaration. */
+ else
+ {
+ bool saved_in_unbraced_linkage_specification_p;
+
+ saved_in_unbraced_linkage_specification_p
+ = parser->in_unbraced_linkage_specification_p;
+ parser->in_unbraced_linkage_specification_p = true;
+ have_extern_spec = true;
+ cp_parser_declaration (parser);
+ have_extern_spec = false;
+ parser->in_unbraced_linkage_specification_p
+ = saved_in_unbraced_linkage_specification_p;
+ }
+
+ /* We're done with the linkage-specification. */
+ pop_lang_context ();
+}
+
+/* Special member functions [gram.special] */
+
+/* Parse a conversion-function-id.
+
+ conversion-function-id:
+ operator conversion-type-id
+
+ Returns an IDENTIFIER_NODE representing the operator. */
+
+static tree
+cp_parser_conversion_function_id (cp_parser* parser)
+{
+ tree type;
+ tree saved_scope;
+ tree saved_qualifying_scope;
+ tree saved_object_scope;
+ bool pop_p = false;
+
+ /* Look for the `operator' token. */
+ if (!cp_parser_require_keyword (parser, RID_OPERATOR, "`operator'"))
+ return error_mark_node;
+ /* When we parse the conversion-type-id, the current scope will be
+ reset. However, we need that information in able to look up the
+ conversion function later, so we save it here. */
+ saved_scope = parser->scope;
+ saved_qualifying_scope = parser->qualifying_scope;
+ saved_object_scope = parser->object_scope;
+ /* We must enter the scope of the class so that the names of
+ entities declared within the class are available in the
+ conversion-type-id. For example, consider:
+
+ struct S {
+ typedef int I;
+ operator I();
+ };
+
+ S::operator I() { ... }
+
+ In order to see that `I' is a type-name in the definition, we
+ must be in the scope of `S'. */
+ if (saved_scope)
+ pop_p = push_scope (saved_scope);
+ /* Parse the conversion-type-id. */
+ type = cp_parser_conversion_type_id (parser);
+ /* Leave the scope of the class, if any. */
+ if (pop_p)
+ pop_scope (saved_scope);
+ /* Restore the saved scope. */
+ parser->scope = saved_scope;
+ parser->qualifying_scope = saved_qualifying_scope;
+ parser->object_scope = saved_object_scope;
+ /* If the TYPE is invalid, indicate failure. */
+ if (type == error_mark_node)
+ return error_mark_node;
+ return mangle_conv_op_name_for_type (type);
+}
+
+/* Parse a conversion-type-id:
+
+ conversion-type-id:
+ type-specifier-seq conversion-declarator [opt]
+
+ Returns the TYPE specified. */
+
+static tree
+cp_parser_conversion_type_id (cp_parser* parser)
+{
+ tree attributes;
+ tree type_specifiers;
+ tree declarator;
+
+ /* Parse the attributes. */
+ attributes = cp_parser_attributes_opt (parser);
+ /* Parse the type-specifiers. */
+ type_specifiers = cp_parser_type_specifier_seq (parser);
+ /* If that didn't work, stop. */
+ if (type_specifiers == error_mark_node)
+ return error_mark_node;
+ /* Parse the conversion-declarator. */
+ declarator = cp_parser_conversion_declarator_opt (parser);
+
+ return grokdeclarator (declarator, type_specifiers, TYPENAME,
+ /*initialized=*/0, &attributes);
+}
+
+/* Parse an (optional) conversion-declarator.
+
+ conversion-declarator:
+ ptr-operator conversion-declarator [opt]
+
+ Returns a representation of the declarator. See
+ cp_parser_declarator for details. */
+
+static tree
+cp_parser_conversion_declarator_opt (cp_parser* parser)
+{
+ enum tree_code code;
+ tree class_type;
+ tree cv_qualifier_seq;
+
+ /* We don't know if there's a ptr-operator next, or not. */
+ cp_parser_parse_tentatively (parser);
+ /* Try the ptr-operator. */
+ code = cp_parser_ptr_operator (parser, &class_type,
+ &cv_qualifier_seq);
+ /* If it worked, look for more conversion-declarators. */
+ if (cp_parser_parse_definitely (parser))
+ {
+ tree declarator;
+
+ /* Parse another optional declarator. */
+ declarator = cp_parser_conversion_declarator_opt (parser);
+
+ /* Create the representation of the declarator. */
+ if (code == INDIRECT_REF)
+ declarator = make_pointer_declarator (cv_qualifier_seq,
+ declarator);
+ else
+ declarator = make_reference_declarator (cv_qualifier_seq,
+ declarator);
+
+ /* Handle the pointer-to-member case. */
+ if (class_type)
+ declarator = build_nt (SCOPE_REF, class_type, declarator);
+
+ return declarator;
+ }
+
+ return NULL_TREE;
+}
+
+/* Parse an (optional) ctor-initializer.
+
+ ctor-initializer:
+ : mem-initializer-list
+
+ Returns TRUE iff the ctor-initializer was actually present. */
+
+static bool
+cp_parser_ctor_initializer_opt (cp_parser* parser)
+{
+ /* If the next token is not a `:', then there is no
+ ctor-initializer. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_COLON))
+ {
+ /* Do default initialization of any bases and members. */
+ if (DECL_CONSTRUCTOR_P (current_function_decl))
+ finish_mem_initializers (NULL_TREE);
+
+ return false;
+ }
+
+ /* Consume the `:' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* And the mem-initializer-list. */
+ cp_parser_mem_initializer_list (parser);
+
+ return true;
+}
+
+/* Parse a mem-initializer-list.
+
+ mem-initializer-list:
+ mem-initializer
+ mem-initializer , mem-initializer-list */
+
+static void
+cp_parser_mem_initializer_list (cp_parser* parser)
+{
+ tree mem_initializer_list = NULL_TREE;
+
+ /* Let the semantic analysis code know that we are starting the
+ mem-initializer-list. */
+ if (!DECL_CONSTRUCTOR_P (current_function_decl))
+ error ("only constructors take base initializers");
+
+ /* Loop through the list. */
+ while (true)
+ {
+ tree mem_initializer;
+
+ /* Parse the mem-initializer. */
+ mem_initializer = cp_parser_mem_initializer (parser);
+ /* Add it to the list, unless it was erroneous. */
+ if (mem_initializer)
+ {
+ TREE_CHAIN (mem_initializer) = mem_initializer_list;
+ mem_initializer_list = mem_initializer;
+ }
+ /* If the next token is not a `,', we're done. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA))
+ break;
+ /* Consume the `,' token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ /* Perform semantic analysis. */
+ if (DECL_CONSTRUCTOR_P (current_function_decl))
+ finish_mem_initializers (mem_initializer_list);
+}
+
+/* Parse a mem-initializer.
+
+ mem-initializer:
+ mem-initializer-id ( expression-list [opt] )
+
+ GNU extension:
+
+ mem-initializer:
+ ( expression-list [opt] )
+
+ Returns a TREE_LIST. The TREE_PURPOSE is the TYPE (for a base
+ class) or FIELD_DECL (for a non-static data member) to initialize;
+ the TREE_VALUE is the expression-list. */
+
+static tree
+cp_parser_mem_initializer (cp_parser* parser)
+{
+ tree mem_initializer_id;
+ tree expression_list;
+ tree member;
+
+ /* Find out what is being initialized. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
+ {
+ pedwarn ("anachronistic old-style base class initializer");
+ mem_initializer_id = NULL_TREE;
+ }
+ else
+ mem_initializer_id = cp_parser_mem_initializer_id (parser);
+ member = expand_member_init (mem_initializer_id);
+ if (member && !DECL_P (member))
+ in_base_initializer = 1;
+
+ expression_list
+ = cp_parser_parenthesized_expression_list (parser, false,
+ /*non_constant_p=*/NULL);
+ if (!expression_list)
+ expression_list = void_type_node;
+
+ in_base_initializer = 0;
+
+ return member ? build_tree_list (member, expression_list) : NULL_TREE;
+}
+
+/* Parse a mem-initializer-id.
+
+ mem-initializer-id:
+ :: [opt] nested-name-specifier [opt] class-name
+ identifier
+
+ Returns a TYPE indicating the class to be initializer for the first
+ production. Returns an IDENTIFIER_NODE indicating the data member
+ to be initialized for the second production. */
+
+static tree
+cp_parser_mem_initializer_id (cp_parser* parser)
+{
+ bool global_scope_p;
+ bool nested_name_specifier_p;
+ bool template_p = false;
+ tree id;
+
+ /* `typename' is not allowed in this context ([temp.res]). */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
+ {
+ error ("keyword `typename' not allowed in this context (a qualified "
+ "member initializer is implicitly a type)");
+ cp_lexer_consume_token (parser->lexer);
+ }
+ /* Look for the optional `::' operator. */
+ global_scope_p
+ = (cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false)
+ != NULL_TREE);
+ /* Look for the optional nested-name-specifier. The simplest way to
+ implement:
+
+ [temp.res]
+
+ The keyword `typename' is not permitted in a base-specifier or
+ mem-initializer; in these contexts a qualified name that
+ depends on a template-parameter is implicitly assumed to be a
+ type name.
+
+ is to assume that we have seen the `typename' keyword at this
+ point. */
+ nested_name_specifier_p
+ = (cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/true,
+ /*check_dependency_p=*/true,
+ /*type_p=*/true,
+ /*is_declaration=*/true)
+ != NULL_TREE);
+ if (nested_name_specifier_p)
+ template_p = cp_parser_optional_template_keyword (parser);
+ /* If there is a `::' operator or a nested-name-specifier, then we
+ are definitely looking for a class-name. */
+ if (global_scope_p || nested_name_specifier_p)
+ return cp_parser_class_name (parser,
+ /*typename_keyword_p=*/true,
+ /*template_keyword_p=*/template_p,
+ /*type_p=*/false,
+ /*check_dependency_p=*/true,
+ /*class_head_p=*/false,
+ /*is_declaration=*/true);
+ /* Otherwise, we could also be looking for an ordinary identifier. */
+ cp_parser_parse_tentatively (parser);
+ /* Try a class-name. */
+ id = cp_parser_class_name (parser,
+ /*typename_keyword_p=*/true,
+ /*template_keyword_p=*/false,
+ /*type_p=*/false,
+ /*check_dependency_p=*/true,
+ /*class_head_p=*/false,
+ /*is_declaration=*/true);
+ /* If we found one, we're done. */
+ if (cp_parser_parse_definitely (parser))
+ return id;
+ /* Otherwise, look for an ordinary identifier. */
+ return cp_parser_identifier (parser);
+}
+
+/* Overloading [gram.over] */
+
+/* Parse an operator-function-id.
+
+ operator-function-id:
+ operator operator
+
+ Returns an IDENTIFIER_NODE for the operator which is a
+ human-readable spelling of the identifier, e.g., `operator +'. */
+
+static tree
+cp_parser_operator_function_id (cp_parser* parser)
+{
+ /* Look for the `operator' keyword. */
+ if (!cp_parser_require_keyword (parser, RID_OPERATOR, "`operator'"))
+ return error_mark_node;
+ /* And then the name of the operator itself. */
+ return cp_parser_operator (parser);
+}
+
+/* Parse an operator.
+
+ operator:
+ new delete new[] delete[] + - * / % ^ & | ~ ! = < >
+ += -= *= /= %= ^= &= |= << >> >>= <<= == != <= >= &&
+ || ++ -- , ->* -> () []
+
+ GNU Extensions:
+
+ operator:
+ <? >? <?= >?=
+
+ Returns an IDENTIFIER_NODE for the operator which is a
+ human-readable spelling of the identifier, e.g., `operator +'. */
+
+static tree
+cp_parser_operator (cp_parser* parser)
+{
+ tree id = NULL_TREE;
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* Figure out which operator we have. */
+ switch (token->type)
+ {
+ case CPP_KEYWORD:
+ {
+ enum tree_code op;
+
+ /* The keyword should be either `new' or `delete'. */
+ if (token->keyword == RID_NEW)
+ op = NEW_EXPR;
+ else if (token->keyword == RID_DELETE)
+ op = DELETE_EXPR;
+ else
+ break;
+
+ /* Consume the `new' or `delete' token. */
+ cp_lexer_consume_token (parser->lexer);
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's a `[' token then this is the array variant of the
+ operator. */
+ if (token->type == CPP_OPEN_SQUARE)
+ {
+ /* Consume the `[' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the `]' token. */
+ cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'");
+ id = ansi_opname (op == NEW_EXPR
+ ? VEC_NEW_EXPR : VEC_DELETE_EXPR);
+ }
+ /* Otherwise, we have the non-array variant. */
+ else
+ id = ansi_opname (op);
+
+ return id;
+ }
+
+ case CPP_PLUS:
+ id = ansi_opname (PLUS_EXPR);
+ break;
+
+ case CPP_MINUS:
+ id = ansi_opname (MINUS_EXPR);
+ break;
+
+ case CPP_MULT:
+ id = ansi_opname (MULT_EXPR);
+ break;
+
+ case CPP_DIV:
+ id = ansi_opname (TRUNC_DIV_EXPR);
+ break;
+
+ case CPP_MOD:
+ id = ansi_opname (TRUNC_MOD_EXPR);
+ break;
+
+ case CPP_XOR:
+ id = ansi_opname (BIT_XOR_EXPR);
+ break;
+
+ case CPP_AND:
+ id = ansi_opname (BIT_AND_EXPR);
+ break;
+
+ case CPP_OR:
+ id = ansi_opname (BIT_IOR_EXPR);
+ break;
+
+ case CPP_COMPL:
+ id = ansi_opname (BIT_NOT_EXPR);
+ break;
+
+ case CPP_NOT:
+ id = ansi_opname (TRUTH_NOT_EXPR);
+ break;
+
+ case CPP_EQ:
+ id = ansi_assopname (NOP_EXPR);
+ break;
+
+ case CPP_LESS:
+ id = ansi_opname (LT_EXPR);
+ break;
+
+ case CPP_GREATER:
+ id = ansi_opname (GT_EXPR);
+ break;
+
+ case CPP_PLUS_EQ:
+ id = ansi_assopname (PLUS_EXPR);
+ break;
+
+ case CPP_MINUS_EQ:
+ id = ansi_assopname (MINUS_EXPR);
+ break;
+
+ case CPP_MULT_EQ:
+ id = ansi_assopname (MULT_EXPR);
+ break;
+
+ case CPP_DIV_EQ:
+ id = ansi_assopname (TRUNC_DIV_EXPR);
+ break;
+
+ case CPP_MOD_EQ:
+ id = ansi_assopname (TRUNC_MOD_EXPR);
+ break;
+
+ case CPP_XOR_EQ:
+ id = ansi_assopname (BIT_XOR_EXPR);
+ break;
+
+ case CPP_AND_EQ:
+ id = ansi_assopname (BIT_AND_EXPR);
+ break;
+
+ case CPP_OR_EQ:
+ id = ansi_assopname (BIT_IOR_EXPR);
+ break;
+
+ case CPP_LSHIFT:
+ id = ansi_opname (LSHIFT_EXPR);
+ break;
+
+ case CPP_RSHIFT:
+ id = ansi_opname (RSHIFT_EXPR);
+ break;
+
+ case CPP_LSHIFT_EQ:
+ id = ansi_assopname (LSHIFT_EXPR);
+ break;
+
+ case CPP_RSHIFT_EQ:
+ id = ansi_assopname (RSHIFT_EXPR);
+ break;
+
+ case CPP_EQ_EQ:
+ id = ansi_opname (EQ_EXPR);
+ break;
+
+ case CPP_NOT_EQ:
+ id = ansi_opname (NE_EXPR);
+ break;
+
+ case CPP_LESS_EQ:
+ id = ansi_opname (LE_EXPR);
+ break;
+
+ case CPP_GREATER_EQ:
+ id = ansi_opname (GE_EXPR);
+ break;
+
+ case CPP_AND_AND:
+ id = ansi_opname (TRUTH_ANDIF_EXPR);
+ break;
+
+ case CPP_OR_OR:
+ id = ansi_opname (TRUTH_ORIF_EXPR);
+ break;
+
+ case CPP_PLUS_PLUS:
+ id = ansi_opname (POSTINCREMENT_EXPR);
+ break;
+
+ case CPP_MINUS_MINUS:
+ id = ansi_opname (PREDECREMENT_EXPR);
+ break;
+
+ case CPP_COMMA:
+ id = ansi_opname (COMPOUND_EXPR);
+ break;
+
+ case CPP_DEREF_STAR:
+ id = ansi_opname (MEMBER_REF);
+ break;
+
+ case CPP_DEREF:
+ id = ansi_opname (COMPONENT_REF);
+ break;
+
+ case CPP_OPEN_PAREN:
+ /* Consume the `('. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the matching `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ return ansi_opname (CALL_EXPR);
+
+ case CPP_OPEN_SQUARE:
+ /* Consume the `['. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the matching `]'. */
+ cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'");
+ return ansi_opname (ARRAY_REF);
+
+ /* Extensions. */
+ case CPP_MIN:
+ id = ansi_opname (MIN_EXPR);
+ break;
+
+ case CPP_MAX:
+ id = ansi_opname (MAX_EXPR);
+ break;
+
+ case CPP_MIN_EQ:
+ id = ansi_assopname (MIN_EXPR);
+ break;
+
+ case CPP_MAX_EQ:
+ id = ansi_assopname (MAX_EXPR);
+ break;
+
+ default:
+ /* Anything else is an error. */
+ break;
+ }
+
+ /* If we have selected an identifier, we need to consume the
+ operator token. */
+ if (id)
+ cp_lexer_consume_token (parser->lexer);
+ /* Otherwise, no valid operator name was present. */
+ else
+ {
+ cp_parser_error (parser, "expected operator");
+ id = error_mark_node;
+ }
+
+ return id;
+}
+
+/* Parse a template-declaration.
+
+ template-declaration:
+ export [opt] template < template-parameter-list > declaration
+
+ If MEMBER_P is TRUE, this template-declaration occurs within a
+ class-specifier.
+
+ The grammar rule given by the standard isn't correct. What
+ is really meant is:
+
+ template-declaration:
+ export [opt] template-parameter-list-seq
+ decl-specifier-seq [opt] init-declarator [opt] ;
+ export [opt] template-parameter-list-seq
+ function-definition
+
+ template-parameter-list-seq:
+ template-parameter-list-seq [opt]
+ template < template-parameter-list > */
+
+static void
+cp_parser_template_declaration (cp_parser* parser, bool member_p)
+{
+ /* Check for `export'. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_EXPORT))
+ {
+ /* Consume the `export' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Warn that we do not support `export'. */
+ warning ("keyword `export' not implemented, and will be ignored");
+ }
+
+ cp_parser_template_declaration_after_export (parser, member_p);
+}
+
+/* Parse a template-parameter-list.
+
+ template-parameter-list:
+ template-parameter
+ template-parameter-list , template-parameter
+
+ Returns a TREE_LIST. Each node represents a template parameter.
+ The nodes are connected via their TREE_CHAINs. */
+
+static tree
+cp_parser_template_parameter_list (cp_parser* parser)
+{
+ tree parameter_list = NULL_TREE;
+
+ while (true)
+ {
+ tree parameter;
+ cp_token *token;
+
+ /* Parse the template-parameter. */
+ parameter = cp_parser_template_parameter (parser);
+ /* Add it to the list. */
+ parameter_list = process_template_parm (parameter_list,
+ parameter);
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's not a `,', we're done. */
+ if (token->type != CPP_COMMA)
+ break;
+ /* Otherwise, consume the `,' token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ return parameter_list;
+}
+
+/* Parse a template-parameter.
+
+ template-parameter:
+ type-parameter
+ parameter-declaration
+
+ Returns a TREE_LIST. The TREE_VALUE represents the parameter. The
+ TREE_PURPOSE is the default value, if any. */
+
+static tree
+cp_parser_template_parameter (cp_parser* parser)
+{
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it is `class' or `template', we have a type-parameter. */
+ if (token->keyword == RID_TEMPLATE)
+ return cp_parser_type_parameter (parser);
+ /* If it is `class' or `typename' we do not know yet whether it is a
+ type parameter or a non-type parameter. Consider:
+
+ template <typename T, typename T::X X> ...
+
+ or:
+
+ template <class C, class D*> ...
+
+ Here, the first parameter is a type parameter, and the second is
+ a non-type parameter. We can tell by looking at the token after
+ the identifier -- if it is a `,', `=', or `>' then we have a type
+ parameter. */
+ if (token->keyword == RID_TYPENAME || token->keyword == RID_CLASS)
+ {
+ /* Peek at the token after `class' or `typename'. */
+ token = cp_lexer_peek_nth_token (parser->lexer, 2);
+ /* If it's an identifier, skip it. */
+ if (token->type == CPP_NAME)
+ token = cp_lexer_peek_nth_token (parser->lexer, 3);
+ /* Now, see if the token looks like the end of a template
+ parameter. */
+ if (token->type == CPP_COMMA
+ || token->type == CPP_EQ
+ || token->type == CPP_GREATER)
+ return cp_parser_type_parameter (parser);
+ }
+
+ /* Otherwise, it is a non-type parameter.
+
+ [temp.param]
+
+ When parsing a default template-argument for a non-type
+ template-parameter, the first non-nested `>' is taken as the end
+ of the template parameter-list rather than a greater-than
+ operator. */
+ return
+ cp_parser_parameter_declaration (parser, /*template_parm_p=*/true,
+ /*parenthesized_p=*/NULL);
+}
+
+/* Parse a type-parameter.
+
+ type-parameter:
+ class identifier [opt]
+ class identifier [opt] = type-id
+ typename identifier [opt]
+ typename identifier [opt] = type-id
+ template < template-parameter-list > class identifier [opt]
+ template < template-parameter-list > class identifier [opt]
+ = id-expression
+
+ Returns a TREE_LIST. The TREE_VALUE is itself a TREE_LIST. The
+ TREE_PURPOSE is the default-argument, if any. The TREE_VALUE is
+ the declaration of the parameter. */
+
+static tree
+cp_parser_type_parameter (cp_parser* parser)
+{
+ cp_token *token;
+ tree parameter;
+
+ /* Look for a keyword to tell us what kind of parameter this is. */
+ token = cp_parser_require (parser, CPP_KEYWORD,
+ "`class', `typename', or `template'");
+ if (!token)
+ return error_mark_node;
+
+ switch (token->keyword)
+ {
+ case RID_CLASS:
+ case RID_TYPENAME:
+ {
+ tree identifier;
+ tree default_argument;
+
+ /* If the next token is an identifier, then it names the
+ parameter. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
+ identifier = cp_parser_identifier (parser);
+ else
+ identifier = NULL_TREE;
+
+ /* Create the parameter. */
+ parameter = finish_template_type_parm (class_type_node, identifier);
+
+ /* If the next token is an `=', we have a default argument. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_EQ))
+ {
+ /* Consume the `=' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the default-argument. */
+ default_argument = cp_parser_type_id (parser);
+ }
+ else
+ default_argument = NULL_TREE;
+
+ /* Create the combined representation of the parameter and the
+ default argument. */
+ parameter = build_tree_list (default_argument, parameter);
+ }
+ break;
+
+ case RID_TEMPLATE:
+ {
+ tree parameter_list;
+ tree identifier;
+ tree default_argument;
+
+ /* Look for the `<'. */
+ cp_parser_require (parser, CPP_LESS, "`<'");
+ /* Parse the template-parameter-list. */
+ begin_template_parm_list ();
+ parameter_list
+ = cp_parser_template_parameter_list (parser);
+ parameter_list = end_template_parm_list (parameter_list);
+ /* Look for the `>'. */
+ cp_parser_require (parser, CPP_GREATER, "`>'");
+ /* Look for the `class' keyword. */
+ cp_parser_require_keyword (parser, RID_CLASS, "`class'");
+ /* If the next token is an `=', then there is a
+ default-argument. If the next token is a `>', we are at
+ the end of the parameter-list. If the next token is a `,',
+ then we are at the end of this parameter. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_EQ)
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_GREATER)
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA))
+ identifier = cp_parser_identifier (parser);
+ else
+ identifier = NULL_TREE;
+ /* Create the template parameter. */
+ parameter = finish_template_template_parm (class_type_node,
+ identifier);
+
+ /* If the next token is an `=', then there is a
+ default-argument. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_EQ))
+ {
+ bool is_template;
+
+ /* Consume the `='. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the id-expression. */
+ default_argument
+ = cp_parser_id_expression (parser,
+ /*template_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*template_p=*/&is_template,
+ /*declarator_p=*/false);
+ if (TREE_CODE (default_argument) == TYPE_DECL)
+ /* If the id-expression was a template-id that refers to
+ a template-class, we already have the declaration here,
+ so no further lookup is needed. */
+ ;
+ else
+ /* Look up the name. */
+ default_argument
+ = cp_parser_lookup_name (parser, default_argument,
+ /*is_type=*/false,
+ /*is_template=*/is_template,
+ /*is_namespace=*/false,
+ /*check_dependency=*/true);
+ /* See if the default argument is valid. */
+ default_argument
+ = check_template_template_default_arg (default_argument);
+ }
+ else
+ default_argument = NULL_TREE;
+
+ /* Create the combined representation of the parameter and the
+ default argument. */
+ parameter = build_tree_list (default_argument, parameter);
+ }
+ break;
+
+ default:
+ /* Anything else is an error. */
+ cp_parser_error (parser,
+ "expected `class', `typename', or `template'");
+ parameter = error_mark_node;
+ }
+
+ return parameter;
+}
+
+/* Parse a template-id.
+
+ template-id:
+ template-name < template-argument-list [opt] >
+
+ If TEMPLATE_KEYWORD_P is TRUE, then we have just seen the
+ `template' keyword. In this case, a TEMPLATE_ID_EXPR will be
+ returned. Otherwise, if the template-name names a function, or set
+ of functions, returns a TEMPLATE_ID_EXPR. If the template-name
+ names a class, returns a TYPE_DECL for the specialization.
+
+ If CHECK_DEPENDENCY_P is FALSE, names are looked up in
+ uninstantiated templates. */
+
+static tree
+cp_parser_template_id (cp_parser *parser,
+ bool template_keyword_p,
+ bool check_dependency_p,
+ bool is_declaration)
+{
+ tree template;
+ tree arguments;
+ tree template_id;
+ ptrdiff_t start_of_id;
+ tree access_check = NULL_TREE;
+ cp_token *next_token, *next_token_2;
+ bool is_identifier;
+
+ /* If the next token corresponds to a template-id, there is no need
+ to reparse it. */
+ next_token = cp_lexer_peek_token (parser->lexer);
+ if (next_token->type == CPP_TEMPLATE_ID)
+ {
+ tree value;
+ tree check;
+
+ /* Get the stored value. */
+ value = cp_lexer_consume_token (parser->lexer)->value;
+ /* Perform any access checks that were deferred. */
+ for (check = TREE_PURPOSE (value); check; check = TREE_CHAIN (check))
+ perform_or_defer_access_check (TREE_PURPOSE (check),
+ TREE_VALUE (check));
+ /* Return the stored value. */
+ return TREE_VALUE (value);
+ }
+
+ /* Avoid performing name lookup if there is no possibility of
+ finding a template-id. */
+ if ((next_token->type != CPP_NAME && next_token->keyword != RID_OPERATOR)
+ || (next_token->type == CPP_NAME
+ && !cp_parser_nth_token_starts_template_argument_list_p
+ (parser, 2)))
+ {
+ cp_parser_error (parser, "expected template-id");
+ return error_mark_node;
+ }
+
+ /* Remember where the template-id starts. */
+ if (cp_parser_parsing_tentatively (parser)
+ && !cp_parser_committed_to_tentative_parse (parser))
+ {
+ next_token = cp_lexer_peek_token (parser->lexer);
+ start_of_id = cp_lexer_token_difference (parser->lexer,
+ parser->lexer->first_token,
+ next_token);
+ }
+ else
+ start_of_id = -1;
+
+ push_deferring_access_checks (dk_deferred);
+
+ /* Parse the template-name. */
+ is_identifier = false;
+ template = cp_parser_template_name (parser, template_keyword_p,
+ check_dependency_p,
+ is_declaration,
+ &is_identifier);
+ if (template == error_mark_node || is_identifier)
+ {
+ pop_deferring_access_checks ();
+ return template;
+ }
+
+ /* If we find the sequence `[:' after a template-name, it's probably
+ a digraph-typo for `< ::'. Substitute the tokens and check if we can
+ parse correctly the argument list. */
+ next_token = cp_lexer_peek_nth_token (parser->lexer, 1);
+ next_token_2 = cp_lexer_peek_nth_token (parser->lexer, 2);
+ if (next_token->type == CPP_OPEN_SQUARE
+ && next_token->flags & DIGRAPH
+ && next_token_2->type == CPP_COLON
+ && !(next_token_2->flags & PREV_WHITE))
+ {
+ cp_parser_parse_tentatively (parser);
+ /* Change `:' into `::'. */
+ next_token_2->type = CPP_SCOPE;
+ /* Consume the first token (CPP_OPEN_SQUARE - which we pretend it is
+ CPP_LESS. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the arguments. */
+ arguments = cp_parser_enclosed_template_argument_list (parser);
+ if (!cp_parser_parse_definitely (parser))
+ {
+ /* If we couldn't parse an argument list, then we revert our changes
+ and return simply an error. Maybe this is not a template-id
+ after all. */
+ next_token_2->type = CPP_COLON;
+ cp_parser_error (parser, "expected `<'");
+ pop_deferring_access_checks ();
+ return error_mark_node;
+ }
+ /* Otherwise, emit an error about the invalid digraph, but continue
+ parsing because we got our argument list. */
+ pedwarn ("`<::' cannot begin a template-argument list");
+ inform ("`<:' is an alternate spelling for `['. Insert whitespace "
+ "between `<' and `::'");
+ if (!flag_permissive)
+ {
+ static bool hint;
+ if (!hint)
+ {
+ inform ("(if you use `-fpermissive' G++ will accept your code)");
+ hint = true;
+ }
+ }
+ }
+ else
+ {
+ /* Look for the `<' that starts the template-argument-list. */
+ if (!cp_parser_require (parser, CPP_LESS, "`<'"))
+ {
+ pop_deferring_access_checks ();
+ return error_mark_node;
+ }
+ /* Parse the arguments. */
+ arguments = cp_parser_enclosed_template_argument_list (parser);
+ }
+
+ /* Build a representation of the specialization. */
+ if (TREE_CODE (template) == IDENTIFIER_NODE)
+ template_id = build_min_nt (TEMPLATE_ID_EXPR, template, arguments);
+ else if (DECL_CLASS_TEMPLATE_P (template)
+ || DECL_TEMPLATE_TEMPLATE_PARM_P (template))
+ template_id
+ = finish_template_type (template, arguments,
+ cp_lexer_next_token_is (parser->lexer,
+ CPP_SCOPE));
+ else
+ {
+ /* If it's not a class-template or a template-template, it should be
+ a function-template. */
+ my_friendly_assert ((DECL_FUNCTION_TEMPLATE_P (template)
+ || TREE_CODE (template) == OVERLOAD
+ || BASELINK_P (template)),
+ 20010716);
+
+ template_id = lookup_template_function (template, arguments);
+ }
+
+ /* Retrieve any deferred checks. Do not pop this access checks yet
+ so the memory will not be reclaimed during token replacing below. */
+ access_check = get_deferred_access_checks ();
+
+ /* If parsing tentatively, replace the sequence of tokens that makes
+ up the template-id with a CPP_TEMPLATE_ID token. That way,
+ should we re-parse the token stream, we will not have to repeat
+ the effort required to do the parse, nor will we issue duplicate
+ error messages about problems during instantiation of the
+ template. */
+ if (start_of_id >= 0)
+ {
+ cp_token *token;
+
+ /* Find the token that corresponds to the start of the
+ template-id. */
+ token = cp_lexer_advance_token (parser->lexer,
+ parser->lexer->first_token,
+ start_of_id);
+
+ /* Reset the contents of the START_OF_ID token. */
+ token->type = CPP_TEMPLATE_ID;
+ token->value = build_tree_list (access_check, template_id);
+ token->keyword = RID_MAX;
+ /* Purge all subsequent tokens. */
+ cp_lexer_purge_tokens_after (parser->lexer, token);
+ }
+
+ pop_deferring_access_checks ();
+ return template_id;
+}
+
+/* Parse a template-name.
+
+ template-name:
+ identifier
+
+ The standard should actually say:
+
+ template-name:
+ identifier
+ operator-function-id
+
+ A defect report has been filed about this issue.
+
+ A conversion-function-id cannot be a template name because they cannot
+ be part of a template-id. In fact, looking at this code:
+
+ a.operator K<int>()
+
+ the conversion-function-id is "operator K<int>", and K<int> is a type-id.
+ It is impossible to call a templated conversion-function-id with an
+ explicit argument list, since the only allowed template parameter is
+ the type to which it is converting.
+
+ If TEMPLATE_KEYWORD_P is true, then we have just seen the
+ `template' keyword, in a construction like:
+
+ T::template f<3>()
+
+ In that case `f' is taken to be a template-name, even though there
+ is no way of knowing for sure.
+
+ Returns the TEMPLATE_DECL for the template, or an OVERLOAD if the
+ name refers to a set of overloaded functions, at least one of which
+ is a template, or an IDENTIFIER_NODE with the name of the template,
+ if TEMPLATE_KEYWORD_P is true. If CHECK_DEPENDENCY_P is FALSE,
+ names are looked up inside uninstantiated templates. */
+
+static tree
+cp_parser_template_name (cp_parser* parser,
+ bool template_keyword_p,
+ bool check_dependency_p,
+ bool is_declaration,
+ bool *is_identifier)
+{
+ tree identifier;
+ tree decl;
+ tree fns;
+
+ /* If the next token is `operator', then we have either an
+ operator-function-id or a conversion-function-id. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_OPERATOR))
+ {
+ /* We don't know whether we're looking at an
+ operator-function-id or a conversion-function-id. */
+ cp_parser_parse_tentatively (parser);
+ /* Try an operator-function-id. */
+ identifier = cp_parser_operator_function_id (parser);
+ /* If that didn't work, try a conversion-function-id. */
+ if (!cp_parser_parse_definitely (parser))
+ {
+ cp_parser_error (parser, "expected template-name");
+ return error_mark_node;
+ }
+ }
+ /* Look for the identifier. */
+ else
+ identifier = cp_parser_identifier (parser);
+
+ /* If we didn't find an identifier, we don't have a template-id. */
+ if (identifier == error_mark_node)
+ return error_mark_node;
+
+ /* If the name immediately followed the `template' keyword, then it
+ is a template-name. However, if the next token is not `<', then
+ we do not treat it as a template-name, since it is not being used
+ as part of a template-id. This enables us to handle constructs
+ like:
+
+ template <typename T> struct S { S(); };
+ template <typename T> S<T>::S();
+
+ correctly. We would treat `S' as a template -- if it were `S<T>'
+ -- but we do not if there is no `<'. */
+
+ if (processing_template_decl
+ && cp_parser_nth_token_starts_template_argument_list_p (parser, 1))
+ {
+ /* In a declaration, in a dependent context, we pretend that the
+ "template" keyword was present in order to improve error
+ recovery. For example, given:
+
+ template <typename T> void f(T::X<int>);
+
+ we want to treat "X<int>" as a template-id. */
+ if (is_declaration
+ && !template_keyword_p
+ && parser->scope && TYPE_P (parser->scope)
+ && dependent_type_p (parser->scope)
+ /* Do not do this for dtors (or ctors), since they never
+ need the template keyword before their name. */
+ && !constructor_name_p (identifier, parser->scope))
+ {
+ ptrdiff_t start;
+ cp_token* token;
+ /* Explain what went wrong. */
+ error ("non-template `%D' used as template", identifier);
+ inform ("use `%T::template %D' to indicate that it is a template",
+ parser->scope, identifier);
+ /* If parsing tentatively, find the location of the "<"
+ token. */
+ if (cp_parser_parsing_tentatively (parser)
+ && !cp_parser_committed_to_tentative_parse (parser))
+ {
+ cp_parser_simulate_error (parser);
+ token = cp_lexer_peek_token (parser->lexer);
+ token = cp_lexer_prev_token (parser->lexer, token);
+ start = cp_lexer_token_difference (parser->lexer,
+ parser->lexer->first_token,
+ token);
+ }
+ else
+ start = -1;
+ /* Parse the template arguments so that we can issue error
+ messages about them. */
+ cp_lexer_consume_token (parser->lexer);
+ cp_parser_enclosed_template_argument_list (parser);
+ /* Skip tokens until we find a good place from which to
+ continue parsing. */
+ cp_parser_skip_to_closing_parenthesis (parser,
+ /*recovering=*/true,
+ /*or_comma=*/true,
+ /*consume_paren=*/false);
+ /* If parsing tentatively, permanently remove the
+ template argument list. That will prevent duplicate
+ error messages from being issued about the missing
+ "template" keyword. */
+ if (start >= 0)
+ {
+ token = cp_lexer_advance_token (parser->lexer,
+ parser->lexer->first_token,
+ start);
+ cp_lexer_purge_tokens_after (parser->lexer, token);
+ }
+ if (is_identifier)
+ *is_identifier = true;
+ return identifier;
+ }
+
+ /* If the "template" keyword is present, then there is generally
+ no point in doing name-lookup, so we just return IDENTIFIER.
+ But, if the qualifying scope is non-dependent then we can
+ (and must) do name-lookup normally. */
+ if (template_keyword_p
+ && (!parser->scope
+ || (TYPE_P (parser->scope)
+ && dependent_type_p (parser->scope))))
+ return identifier;
+ }
+
+ /* Look up the name. */
+ decl = cp_parser_lookup_name (parser, identifier,
+ /*is_type=*/false,
+ /*is_template=*/false,
+ /*is_namespace=*/false,
+ check_dependency_p);
+ decl = maybe_get_template_decl_from_type_decl (decl);
+
+ /* If DECL is a template, then the name was a template-name. */
+ if (TREE_CODE (decl) == TEMPLATE_DECL)
+ ;
+ else
+ {
+ /* The standard does not explicitly indicate whether a name that
+ names a set of overloaded declarations, some of which are
+ templates, is a template-name. However, such a name should
+ be a template-name; otherwise, there is no way to form a
+ template-id for the overloaded templates. */
+ fns = BASELINK_P (decl) ? BASELINK_FUNCTIONS (decl) : decl;
+ if (TREE_CODE (fns) == OVERLOAD)
+ {
+ tree fn;
+
+ for (fn = fns; fn; fn = OVL_NEXT (fn))
+ if (TREE_CODE (OVL_CURRENT (fn)) == TEMPLATE_DECL)
+ break;
+ }
+ else
+ {
+ /* Otherwise, the name does not name a template. */
+ cp_parser_error (parser, "expected template-name");
+ return error_mark_node;
+ }
+ }
+
+ /* If DECL is dependent, and refers to a function, then just return
+ its name; we will look it up again during template instantiation. */
+ if (DECL_FUNCTION_TEMPLATE_P (decl) || !DECL_P (decl))
+ {
+ tree scope = CP_DECL_CONTEXT (get_first_fn (decl));
+ if (TYPE_P (scope) && dependent_type_p (scope))
+ return identifier;
+ }
+
+ return decl;
+}
+
+/* Parse a template-argument-list.
+
+ template-argument-list:
+ template-argument
+ template-argument-list , template-argument
+
+ Returns a TREE_VEC containing the arguments. */
+
+static tree
+cp_parser_template_argument_list (cp_parser* parser)
+{
+ tree fixed_args[10];
+ unsigned n_args = 0;
+ unsigned alloced = 10;
+ tree *arg_ary = fixed_args;
+ tree vec;
+ bool saved_in_template_argument_list_p;
+
+ saved_in_template_argument_list_p = parser->in_template_argument_list_p;
+ parser->in_template_argument_list_p = true;
+ do
+ {
+ tree argument;
+
+ if (n_args)
+ /* Consume the comma. */
+ cp_lexer_consume_token (parser->lexer);
+
+ /* Parse the template-argument. */
+ argument = cp_parser_template_argument (parser);
+ if (n_args == alloced)
+ {
+ alloced *= 2;
+
+ if (arg_ary == fixed_args)
+ {
+ arg_ary = xmalloc (sizeof (tree) * alloced);
+ memcpy (arg_ary, fixed_args, sizeof (tree) * n_args);
+ }
+ else
+ arg_ary = xrealloc (arg_ary, sizeof (tree) * alloced);
+ }
+ arg_ary[n_args++] = argument;
+ }
+ while (cp_lexer_next_token_is (parser->lexer, CPP_COMMA));
+
+ vec = make_tree_vec (n_args);
+
+ while (n_args--)
+ TREE_VEC_ELT (vec, n_args) = arg_ary[n_args];
+
+ if (arg_ary != fixed_args)
+ free (arg_ary);
+ parser->in_template_argument_list_p = saved_in_template_argument_list_p;
+ return vec;
+}
+
+/* Parse a template-argument.
+
+ template-argument:
+ assignment-expression
+ type-id
+ id-expression
+
+ The representation is that of an assignment-expression, type-id, or
+ id-expression -- except that the qualified id-expression is
+ evaluated, so that the value returned is either a DECL or an
+ OVERLOAD.
+
+ Although the standard says "assignment-expression", it forbids
+ throw-expressions or assignments in the template argument.
+ Therefore, we use "conditional-expression" instead. */
+
+static tree
+cp_parser_template_argument (cp_parser* parser)
+{
+ tree argument;
+ bool template_p;
+ bool address_p;
+ bool maybe_type_id = false;
+ cp_token *token;
+ cp_id_kind idk;
+ tree qualifying_class;
+
+ /* There's really no way to know what we're looking at, so we just
+ try each alternative in order.
+
+ [temp.arg]
+
+ In a template-argument, an ambiguity between a type-id and an
+ expression is resolved to a type-id, regardless of the form of
+ the corresponding template-parameter.
+
+ Therefore, we try a type-id first. */
+ cp_parser_parse_tentatively (parser);
+ argument = cp_parser_type_id (parser);
+ /* If there was no error parsing the type-id but the next token is a '>>',
+ we probably found a typo for '> >'. But there are type-id which are
+ also valid expressions. For instance:
+
+ struct X { int operator >> (int); };
+ template <int V> struct Foo {};
+ Foo<X () >> 5> r;
+
+ Here 'X()' is a valid type-id of a function type, but the user just
+ wanted to write the expression "X() >> 5". Thus, we remember that we
+ found a valid type-id, but we still try to parse the argument as an
+ expression to see what happens. */
+ if (!cp_parser_error_occurred (parser)
+ && cp_lexer_next_token_is (parser->lexer, CPP_RSHIFT))
+ {
+ maybe_type_id = true;
+ cp_parser_abort_tentative_parse (parser);
+ }
+ else
+ {
+ /* If the next token isn't a `,' or a `>', then this argument wasn't
+ really finished. This means that the argument is not a valid
+ type-id. */
+ if (!cp_parser_next_token_ends_template_argument_p (parser))
+ cp_parser_error (parser, "expected template-argument");
+ /* If that worked, we're done. */
+ if (cp_parser_parse_definitely (parser))
+ return argument;
+ }
+ /* We're still not sure what the argument will be. */
+ cp_parser_parse_tentatively (parser);
+ /* Try a template. */
+ argument = cp_parser_id_expression (parser,
+ /*template_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ &template_p,
+ /*declarator_p=*/false);
+ /* If the next token isn't a `,' or a `>', then this argument wasn't
+ really finished. */
+ if (!cp_parser_next_token_ends_template_argument_p (parser))
+ cp_parser_error (parser, "expected template-argument");
+ if (!cp_parser_error_occurred (parser))
+ {
+ /* Figure out what is being referred to. If the id-expression
+ was for a class template specialization, then we will have a
+ TYPE_DECL at this point. There is no need to do name lookup
+ at this point in that case. */
+ if (TREE_CODE (argument) != TYPE_DECL)
+ argument = cp_parser_lookup_name (parser, argument,
+ /*is_type=*/false,
+ /*is_template=*/template_p,
+ /*is_namespace=*/false,
+ /*check_dependency=*/true);
+ if (TREE_CODE (argument) != TEMPLATE_DECL
+ && TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
+ cp_parser_error (parser, "expected template-name");
+ }
+ if (cp_parser_parse_definitely (parser))
+ return argument;
+ /* It must be a non-type argument. There permitted cases are given
+ in [temp.arg.nontype]:
+
+ -- an integral constant-expression of integral or enumeration
+ type; or
+
+ -- the name of a non-type template-parameter; or
+
+ -- the name of an object or function with external linkage...
+
+ -- the address of an object or function with external linkage...
+
+ -- a pointer to member... */
+ /* Look for a non-type template parameter. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
+ {
+ cp_parser_parse_tentatively (parser);
+ argument = cp_parser_primary_expression (parser,
+ &idk,
+ &qualifying_class);
+ if (TREE_CODE (argument) != TEMPLATE_PARM_INDEX
+ || !cp_parser_next_token_ends_template_argument_p (parser))
+ cp_parser_simulate_error (parser);
+ if (cp_parser_parse_definitely (parser))
+ return argument;
+ }
+ /* If the next token is "&", the argument must be the address of an
+ object or function with external linkage. */
+ address_p = cp_lexer_next_token_is (parser->lexer, CPP_AND);
+ if (address_p)
+ cp_lexer_consume_token (parser->lexer);
+ /* See if we might have an id-expression. */
+ token = cp_lexer_peek_token (parser->lexer);
+ if (token->type == CPP_NAME
+ || token->keyword == RID_OPERATOR
+ || token->type == CPP_SCOPE
+ || token->type == CPP_TEMPLATE_ID
+ || token->type == CPP_NESTED_NAME_SPECIFIER)
+ {
+ cp_parser_parse_tentatively (parser);
+ argument = cp_parser_primary_expression (parser,
+ &idk,
+ &qualifying_class);
+ if (cp_parser_error_occurred (parser)
+ || !cp_parser_next_token_ends_template_argument_p (parser))
+ cp_parser_abort_tentative_parse (parser);
+ else
+ {
+ if (qualifying_class)
+ argument = finish_qualified_id_expr (qualifying_class,
+ argument,
+ /*done=*/true,
+ address_p);
+ if (TREE_CODE (argument) == VAR_DECL)
+ {
+ /* A variable without external linkage might still be a
+ valid constant-expression, so no error is issued here
+ if the external-linkage check fails. */
+ if (!DECL_EXTERNAL_LINKAGE_P (argument))
+ cp_parser_simulate_error (parser);
+ }
+ else if (is_overloaded_fn (argument))
+ /* All overloaded functions are allowed; if the external
+ linkage test does not pass, an error will be issued
+ later. */
+ ;
+ else if (address_p
+ && (TREE_CODE (argument) == OFFSET_REF
+ || TREE_CODE (argument) == SCOPE_REF))
+ /* A pointer-to-member. */
+ ;
+ else
+ cp_parser_simulate_error (parser);
+
+ if (cp_parser_parse_definitely (parser))
+ {
+ if (address_p)
+ argument = build_x_unary_op (ADDR_EXPR, argument);
+ return argument;
+ }
+ }
+ }
+ /* If the argument started with "&", there are no other valid
+ alternatives at this point. */
+ if (address_p)
+ {
+ cp_parser_error (parser, "invalid non-type template argument");
+ return error_mark_node;
+ }
+ /* If the argument wasn't successfully parsed as a type-id followed
+ by '>>', the argument can only be a constant expression now.
+ Otherwise, we try parsing the constant-expression tentatively,
+ because the argument could really be a type-id. */
+ if (maybe_type_id)
+ cp_parser_parse_tentatively (parser);
+ argument = cp_parser_constant_expression (parser,
+ /*allow_non_constant_p=*/false,
+ /*non_constant_p=*/NULL);
+ argument = fold_non_dependent_expr (argument);
+ if (!maybe_type_id)
+ return argument;
+ if (!cp_parser_next_token_ends_template_argument_p (parser))
+ cp_parser_error (parser, "expected template-argument");
+ if (cp_parser_parse_definitely (parser))
+ return argument;
+ /* We did our best to parse the argument as a non type-id, but that
+ was the only alternative that matched (albeit with a '>' after
+ it). We can assume it's just a typo from the user, and a
+ diagnostic will then be issued. */
+ return cp_parser_type_id (parser);
+}
+
+/* Parse an explicit-instantiation.
+
+ explicit-instantiation:
+ template declaration
+
+ Although the standard says `declaration', what it really means is:
+
+ explicit-instantiation:
+ template decl-specifier-seq [opt] declarator [opt] ;
+
+ Things like `template int S<int>::i = 5, int S<double>::j;' are not
+ supposed to be allowed. A defect report has been filed about this
+ issue.
+
+ GNU Extension:
+
+ explicit-instantiation:
+ storage-class-specifier template
+ decl-specifier-seq [opt] declarator [opt] ;
+ function-specifier template
+ decl-specifier-seq [opt] declarator [opt] ; */
+
+static void
+cp_parser_explicit_instantiation (cp_parser* parser)
+{
+ int declares_class_or_enum;
+ tree decl_specifiers;
+ tree attributes;
+ tree extension_specifier = NULL_TREE;
+
+ /* Look for an (optional) storage-class-specifier or
+ function-specifier. */
+ if (cp_parser_allow_gnu_extensions_p (parser))
+ {
+ extension_specifier
+ = cp_parser_storage_class_specifier_opt (parser);
+ if (!extension_specifier)
+ extension_specifier = cp_parser_function_specifier_opt (parser);
+ }
+
+ /* Look for the `template' keyword. */
+ cp_parser_require_keyword (parser, RID_TEMPLATE, "`template'");
+ /* Let the front end know that we are processing an explicit
+ instantiation. */
+ begin_explicit_instantiation ();
+ /* [temp.explicit] says that we are supposed to ignore access
+ control while processing explicit instantiation directives. */
+ push_deferring_access_checks (dk_no_check);
+ /* Parse a decl-specifier-seq. */
+ decl_specifiers
+ = cp_parser_decl_specifier_seq (parser,
+ CP_PARSER_FLAGS_OPTIONAL,
+ &attributes,
+ &declares_class_or_enum);
+ /* If there was exactly one decl-specifier, and it declared a class,
+ and there's no declarator, then we have an explicit type
+ instantiation. */
+ if (declares_class_or_enum && cp_parser_declares_only_class_p (parser))
+ {
+ tree type;
+
+ type = check_tag_decl (decl_specifiers);
+ /* Turn access control back on for names used during
+ template instantiation. */
+ pop_deferring_access_checks ();
+ if (type)
+ do_type_instantiation (type, extension_specifier, /*complain=*/1);
+ }
+ else
+ {
+ tree declarator;
+ tree decl;
+
+ /* Parse the declarator. */
+ declarator
+ = cp_parser_declarator (parser, CP_PARSER_DECLARATOR_NAMED,
+ /*ctor_dtor_or_conv_p=*/NULL,
+ /*parenthesized_p=*/NULL);
+ cp_parser_check_for_definition_in_return_type (declarator,
+ declares_class_or_enum);
+ if (declarator != error_mark_node)
+ {
+ decl = grokdeclarator (declarator, decl_specifiers,
+ NORMAL, 0, NULL);
+ /* Turn access control back on for names used during
+ template instantiation. */
+ pop_deferring_access_checks ();
+ /* Do the explicit instantiation. */
+ do_decl_instantiation (decl, extension_specifier);
+ }
+ else
+ {
+ pop_deferring_access_checks ();
+ /* Skip the body of the explicit instantiation. */
+ cp_parser_skip_to_end_of_statement (parser);
+ }
+ }
+ /* We're done with the instantiation. */
+ end_explicit_instantiation ();
+
+ cp_parser_consume_semicolon_at_end_of_statement (parser);
+}
+
+/* Parse an explicit-specialization.
+
+ explicit-specialization:
+ template < > declaration
+
+ Although the standard says `declaration', what it really means is:
+
+ explicit-specialization:
+ template <> decl-specifier [opt] init-declarator [opt] ;
+ template <> function-definition
+ template <> explicit-specialization
+ template <> template-declaration */
+
+static void
+cp_parser_explicit_specialization (cp_parser* parser)
+{
+ /* Look for the `template' keyword. */
+ cp_parser_require_keyword (parser, RID_TEMPLATE, "`template'");
+ /* Look for the `<'. */
+ cp_parser_require (parser, CPP_LESS, "`<'");
+ /* Look for the `>'. */
+ cp_parser_require (parser, CPP_GREATER, "`>'");
+ /* We have processed another parameter list. */
+ ++parser->num_template_parameter_lists;
+ /* Let the front end know that we are beginning a specialization. */
+ begin_specialization ();
+
+ /* If the next keyword is `template', we need to figure out whether
+ or not we're looking a template-declaration. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TEMPLATE))
+ {
+ if (cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_LESS
+ && cp_lexer_peek_nth_token (parser->lexer, 3)->type != CPP_GREATER)
+ cp_parser_template_declaration_after_export (parser,
+ /*member_p=*/false);
+ else
+ cp_parser_explicit_specialization (parser);
+ }
+ else
+ /* Parse the dependent declaration. */
+ cp_parser_single_declaration (parser,
+ /*member_p=*/false,
+ /*friend_p=*/NULL);
+
+ /* We're done with the specialization. */
+ end_specialization ();
+ /* We're done with this parameter list. */
+ --parser->num_template_parameter_lists;
+}
+
+/* Parse a type-specifier.
+
+ type-specifier:
+ simple-type-specifier
+ class-specifier
+ enum-specifier
+ elaborated-type-specifier
+ cv-qualifier
+
+ GNU Extension:
+
+ type-specifier:
+ __complex__
+
+ Returns a representation of the type-specifier. If the
+ type-specifier is a keyword (like `int' or `const', or
+ `__complex__') then the corresponding IDENTIFIER_NODE is returned.
+ For a class-specifier, enum-specifier, or elaborated-type-specifier
+ a TREE_TYPE is returned; otherwise, a TYPE_DECL is returned.
+
+ If IS_FRIEND is TRUE then this type-specifier is being declared a
+ `friend'. If IS_DECLARATION is TRUE, then this type-specifier is
+ appearing in a decl-specifier-seq.
+
+ If DECLARES_CLASS_OR_ENUM is non-NULL, and the type-specifier is a
+ class-specifier, enum-specifier, or elaborated-type-specifier, then
+ *DECLARES_CLASS_OR_ENUM is set to a nonzero value. The value is 1
+ if a type is declared; 2 if it is defined. Otherwise, it is set to
+ zero.
+
+ If IS_CV_QUALIFIER is non-NULL, and the type-specifier is a
+ cv-qualifier, then IS_CV_QUALIFIER is set to TRUE. Otherwise, it
+ is set to FALSE. */
+
+static tree
+cp_parser_type_specifier (cp_parser* parser,
+ cp_parser_flags flags,
+ bool is_friend,
+ bool is_declaration,
+ int* declares_class_or_enum,
+ bool* is_cv_qualifier)
+{
+ tree type_spec = NULL_TREE;
+ cp_token *token;
+ enum rid keyword;
+
+ /* Assume this type-specifier does not declare a new type. */
+ if (declares_class_or_enum)
+ *declares_class_or_enum = 0;
+ /* And that it does not specify a cv-qualifier. */
+ if (is_cv_qualifier)
+ *is_cv_qualifier = false;
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ /* If we're looking at a keyword, we can use that to guide the
+ production we choose. */
+ keyword = token->keyword;
+ switch (keyword)
+ {
+ /* Any of these indicate either a class-specifier, or an
+ elaborated-type-specifier. */
+ case RID_CLASS:
+ case RID_STRUCT:
+ case RID_UNION:
+ case RID_ENUM:
+ /* Parse tentatively so that we can back up if we don't find a
+ class-specifier or enum-specifier. */
+ cp_parser_parse_tentatively (parser);
+ /* Look for the class-specifier or enum-specifier. */
+ if (keyword == RID_ENUM)
+ type_spec = cp_parser_enum_specifier (parser);
+ else
+ type_spec = cp_parser_class_specifier (parser);
+
+ /* If that worked, we're done. */
+ if (cp_parser_parse_definitely (parser))
+ {
+ if (declares_class_or_enum)
+ *declares_class_or_enum = 2;
+ return type_spec;
+ }
+
+ /* Fall through. */
+
+ case RID_TYPENAME:
+ /* Look for an elaborated-type-specifier. */
+ type_spec = cp_parser_elaborated_type_specifier (parser,
+ is_friend,
+ is_declaration);
+ /* We're declaring a class or enum -- unless we're using
+ `typename'. */
+ if (declares_class_or_enum && keyword != RID_TYPENAME)
+ *declares_class_or_enum = 1;
+ return type_spec;
+
+ case RID_CONST:
+ case RID_VOLATILE:
+ case RID_RESTRICT:
+ type_spec = cp_parser_cv_qualifier_opt (parser);
+ /* Even though we call a routine that looks for an optional
+ qualifier, we know that there should be one. */
+ my_friendly_assert (type_spec != NULL, 20000328);
+ /* This type-specifier was a cv-qualified. */
+ if (is_cv_qualifier)
+ *is_cv_qualifier = true;
+
+ return type_spec;
+
+ case RID_COMPLEX:
+ /* The `__complex__' keyword is a GNU extension. */
+ return cp_lexer_consume_token (parser->lexer)->value;
+
+ default:
+ break;
+ }
+
+ /* If we do not already have a type-specifier, assume we are looking
+ at a simple-type-specifier. */
+ type_spec = cp_parser_simple_type_specifier (parser, flags,
+ /*identifier_p=*/true);
+
+ /* If we didn't find a type-specifier, and a type-specifier was not
+ optional in this context, issue an error message. */
+ if (!type_spec && !(flags & CP_PARSER_FLAGS_OPTIONAL))
+ {
+ cp_parser_error (parser, "expected type specifier");
+ return error_mark_node;
+ }
+
+ return type_spec;
+}
+
+/* Parse a simple-type-specifier.
+
+ simple-type-specifier:
+ :: [opt] nested-name-specifier [opt] type-name
+ :: [opt] nested-name-specifier template template-id
+ char
+ wchar_t
+ bool
+ short
+ int
+ long
+ signed
+ unsigned
+ float
+ double
+ void
+
+ GNU Extension:
+
+ simple-type-specifier:
+ __typeof__ unary-expression
+ __typeof__ ( type-id )
+
+ For the various keywords, the value returned is simply the
+ TREE_IDENTIFIER representing the keyword if IDENTIFIER_P is true.
+ For the first two productions, and if IDENTIFIER_P is false, the
+ value returned is the indicated TYPE_DECL. */
+
+static tree
+cp_parser_simple_type_specifier (cp_parser* parser, cp_parser_flags flags,
+ bool identifier_p)
+{
+ tree type = NULL_TREE;
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ /* If we're looking at a keyword, things are easy. */
+ switch (token->keyword)
+ {
+ case RID_CHAR:
+ type = char_type_node;
+ break;
+ case RID_WCHAR:
+ type = wchar_type_node;
+ break;
+ case RID_BOOL:
+ type = boolean_type_node;
+ break;
+ case RID_SHORT:
+ type = short_integer_type_node;
+ break;
+ case RID_INT:
+ type = integer_type_node;
+ break;
+ case RID_LONG:
+ type = long_integer_type_node;
+ break;
+ case RID_SIGNED:
+ type = integer_type_node;
+ break;
+ case RID_UNSIGNED:
+ type = unsigned_type_node;
+ break;
+ case RID_FLOAT:
+ type = float_type_node;
+ break;
+ case RID_DOUBLE:
+ type = double_type_node;
+ break;
+ case RID_VOID:
+ type = void_type_node;
+ break;
+
+ case RID_TYPEOF:
+ {
+ tree operand;
+
+ /* Consume the `typeof' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the operand to `typeof'. */
+ operand = cp_parser_sizeof_operand (parser, RID_TYPEOF);
+ /* If it is not already a TYPE, take its type. */
+ if (!TYPE_P (operand))
+ operand = finish_typeof (operand);
+
+ return operand;
+ }
+
+ default:
+ break;
+ }
+
+ /* If the type-specifier was for a built-in type, we're done. */
+ if (type)
+ {
+ tree id;
+
+ /* Consume the token. */
+ id = cp_lexer_consume_token (parser->lexer)->value;
+
+ /* There is no valid C++ program where a non-template type is
+ followed by a "<". That usually indicates that the user thought
+ that the type was a template. */
+ cp_parser_check_for_invalid_template_id (parser, type);
+
+ return identifier_p ? id : TYPE_NAME (type);
+ }
+
+ /* The type-specifier must be a user-defined type. */
+ if (!(flags & CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES))
+ {
+ bool qualified_p;
+ bool global_p;
+
+ /* Don't gobble tokens or issue error messages if this is an
+ optional type-specifier. */
+ if (flags & CP_PARSER_FLAGS_OPTIONAL)
+ cp_parser_parse_tentatively (parser);
+
+ /* Look for the optional `::' operator. */
+ global_p
+ = (cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false)
+ != NULL_TREE);
+ /* Look for the nested-name specifier. */
+ qualified_p
+ = (cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*type_p=*/false,
+ /*is_declaration=*/false)
+ != NULL_TREE);
+ /* If we have seen a nested-name-specifier, and the next token
+ is `template', then we are using the template-id production. */
+ if (parser->scope
+ && cp_parser_optional_template_keyword (parser))
+ {
+ /* Look for the template-id. */
+ type = cp_parser_template_id (parser,
+ /*template_keyword_p=*/true,
+ /*check_dependency_p=*/true,
+ /*is_declaration=*/false);
+ /* If the template-id did not name a type, we are out of
+ luck. */
+ if (TREE_CODE (type) != TYPE_DECL)
+ {
+ cp_parser_error (parser, "expected template-id for type");
+ type = NULL_TREE;
+ }
+ }
+ /* Otherwise, look for a type-name. */
+ else
+ type = cp_parser_type_name (parser);
+ /* Keep track of all name-lookups performed in class scopes. */
+ if (type
+ && !global_p
+ && !qualified_p
+ && TREE_CODE (type) == TYPE_DECL
+ && TREE_CODE (DECL_NAME (type)) == IDENTIFIER_NODE)
+ maybe_note_name_used_in_class (DECL_NAME (type), type);
+ /* If it didn't work out, we don't have a TYPE. */
+ if ((flags & CP_PARSER_FLAGS_OPTIONAL)
+ && !cp_parser_parse_definitely (parser))
+ type = NULL_TREE;
+ }
+
+ /* If we didn't get a type-name, issue an error message. */
+ if (!type && !(flags & CP_PARSER_FLAGS_OPTIONAL))
+ {
+ cp_parser_error (parser, "expected type-name");
+ return error_mark_node;
+ }
+
+ /* There is no valid C++ program where a non-template type is
+ followed by a "<". That usually indicates that the user thought
+ that the type was a template. */
+ if (type && type != error_mark_node)
+ cp_parser_check_for_invalid_template_id (parser, TREE_TYPE (type));
+
+ return type;
+}
+
+/* Parse a type-name.
+
+ type-name:
+ class-name
+ enum-name
+ typedef-name
+
+ enum-name:
+ identifier
+
+ typedef-name:
+ identifier
+
+ Returns a TYPE_DECL for the the type. */
+
+static tree
+cp_parser_type_name (cp_parser* parser)
+{
+ tree type_decl;
+ tree identifier;
+
+ /* We can't know yet whether it is a class-name or not. */
+ cp_parser_parse_tentatively (parser);
+ /* Try a class-name. */
+ type_decl = cp_parser_class_name (parser,
+ /*typename_keyword_p=*/false,
+ /*template_keyword_p=*/false,
+ /*type_p=*/false,
+ /*check_dependency_p=*/true,
+ /*class_head_p=*/false,
+ /*is_declaration=*/false);
+ /* If it's not a class-name, keep looking. */
+ if (!cp_parser_parse_definitely (parser))
+ {
+ /* It must be a typedef-name or an enum-name. */
+ identifier = cp_parser_identifier (parser);
+ if (identifier == error_mark_node)
+ return error_mark_node;
+
+ /* Look up the type-name. */
+ type_decl = cp_parser_lookup_name_simple (parser, identifier);
+ /* Issue an error if we did not find a type-name. */
+ if (TREE_CODE (type_decl) != TYPE_DECL)
+ {
+ if (!cp_parser_simulate_error (parser))
+ cp_parser_name_lookup_error (parser, identifier, type_decl,
+ "is not a type");
+ type_decl = error_mark_node;
+ }
+ /* Remember that the name was used in the definition of the
+ current class so that we can check later to see if the
+ meaning would have been different after the class was
+ entirely defined. */
+ else if (type_decl != error_mark_node
+ && !parser->scope)
+ maybe_note_name_used_in_class (identifier, type_decl);
+ }
+
+ return type_decl;
+}
+
+
+/* Parse an elaborated-type-specifier. Note that the grammar given
+ here incorporates the resolution to DR68.
+
+ elaborated-type-specifier:
+ class-key :: [opt] nested-name-specifier [opt] identifier
+ class-key :: [opt] nested-name-specifier [opt] template [opt] template-id
+ enum :: [opt] nested-name-specifier [opt] identifier
+ typename :: [opt] nested-name-specifier identifier
+ typename :: [opt] nested-name-specifier template [opt]
+ template-id
+
+ GNU extension:
+
+ elaborated-type-specifier:
+ class-key attributes :: [opt] nested-name-specifier [opt] identifier
+ class-key attributes :: [opt] nested-name-specifier [opt]
+ template [opt] template-id
+ enum attributes :: [opt] nested-name-specifier [opt] identifier
+
+ If IS_FRIEND is TRUE, then this elaborated-type-specifier is being
+ declared `friend'. If IS_DECLARATION is TRUE, then this
+ elaborated-type-specifier appears in a decl-specifiers-seq, i.e.,
+ something is being declared.
+
+ Returns the TYPE specified. */
+
+static tree
+cp_parser_elaborated_type_specifier (cp_parser* parser,
+ bool is_friend,
+ bool is_declaration)
+{
+ enum tag_types tag_type;
+ tree identifier;
+ tree type = NULL_TREE;
+ tree attributes = NULL_TREE;
+
+ /* See if we're looking at the `enum' keyword. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_ENUM))
+ {
+ /* Consume the `enum' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Remember that it's an enumeration type. */
+ tag_type = enum_type;
+ /* Parse the attributes. */
+ attributes = cp_parser_attributes_opt (parser);
+ }
+ /* Or, it might be `typename'. */
+ else if (cp_lexer_next_token_is_keyword (parser->lexer,
+ RID_TYPENAME))
+ {
+ /* Consume the `typename' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Remember that it's a `typename' type. */
+ tag_type = typename_type;
+ /* The `typename' keyword is only allowed in templates. */
+ if (!processing_template_decl)
+ pedwarn ("using `typename' outside of template");
+ }
+ /* Otherwise it must be a class-key. */
+ else
+ {
+ tag_type = cp_parser_class_key (parser);
+ if (tag_type == none_type)
+ return error_mark_node;
+ /* Parse the attributes. */
+ attributes = cp_parser_attributes_opt (parser);
+ }
+
+ /* Look for the `::' operator. */
+ cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false);
+ /* Look for the nested-name-specifier. */
+ if (tag_type == typename_type)
+ {
+ if (cp_parser_nested_name_specifier (parser,
+ /*typename_keyword_p=*/true,
+ /*check_dependency_p=*/true,
+ /*type_p=*/true,
+ is_declaration)
+ == error_mark_node)
+ return error_mark_node;
+ }
+ else
+ /* Even though `typename' is not present, the proposed resolution
+ to Core Issue 180 says that in `class A<T>::B', `B' should be
+ considered a type-name, even if `A<T>' is dependent. */
+ cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/true,
+ /*check_dependency_p=*/true,
+ /*type_p=*/true,
+ is_declaration);
+ /* For everything but enumeration types, consider a template-id. */
+ if (tag_type != enum_type)
+ {
+ bool template_p = false;
+ tree decl;
+
+ /* Allow the `template' keyword. */
+ template_p = cp_parser_optional_template_keyword (parser);
+ /* If we didn't see `template', we don't know if there's a
+ template-id or not. */
+ if (!template_p)
+ cp_parser_parse_tentatively (parser);
+ /* Parse the template-id. */
+ decl = cp_parser_template_id (parser, template_p,
+ /*check_dependency_p=*/true,
+ is_declaration);
+ /* If we didn't find a template-id, look for an ordinary
+ identifier. */
+ if (!template_p && !cp_parser_parse_definitely (parser))
+ ;
+ /* If DECL is a TEMPLATE_ID_EXPR, and the `typename' keyword is
+ in effect, then we must assume that, upon instantiation, the
+ template will correspond to a class. */
+ else if (TREE_CODE (decl) == TEMPLATE_ID_EXPR
+ && tag_type == typename_type)
+ type = make_typename_type (parser->scope, decl,
+ /*complain=*/1);
+ else
+ type = TREE_TYPE (decl);
+ }
+
+ /* For an enumeration type, consider only a plain identifier. */
+ if (!type)
+ {
+ identifier = cp_parser_identifier (parser);
+
+ if (identifier == error_mark_node)
+ {
+ parser->scope = NULL_TREE;
+ return error_mark_node;
+ }
+
+ /* For a `typename', we needn't call xref_tag. */
+ if (tag_type == typename_type)
+ return make_typename_type (parser->scope, identifier,
+ /*complain=*/1);
+ /* Look up a qualified name in the usual way. */
+ if (parser->scope)
+ {
+ tree decl;
+
+ /* In an elaborated-type-specifier, names are assumed to name
+ types, so we set IS_TYPE to TRUE when calling
+ cp_parser_lookup_name. */
+ decl = cp_parser_lookup_name (parser, identifier,
+ /*is_type=*/true,
+ /*is_template=*/false,
+ /*is_namespace=*/false,
+ /*check_dependency=*/true);
+
+ /* If we are parsing friend declaration, DECL may be a
+ TEMPLATE_DECL tree node here. However, we need to check
+ whether this TEMPLATE_DECL results in valid code. Consider
+ the following example:
+
+ namespace N {
+ template <class T> class C {};
+ }
+ class X {
+ template <class T> friend class N::C; // #1, valid code
+ };
+ template <class T> class Y {
+ friend class N::C; // #2, invalid code
+ };
+
+ For both case #1 and #2, we arrive at a TEMPLATE_DECL after
+ name lookup of `N::C'. We see that friend declaration must
+ be template for the code to be valid. Note that
+ processing_template_decl does not work here since it is
+ always 1 for the above two cases. */
+
+ decl = (cp_parser_maybe_treat_template_as_class
+ (decl, /*tag_name_p=*/is_friend
+ && parser->num_template_parameter_lists));
+
+ if (TREE_CODE (decl) != TYPE_DECL)
+ {
+ error ("expected type-name");
+ return error_mark_node;
+ }
+
+ if (TREE_CODE (TREE_TYPE (decl)) != TYPENAME_TYPE)
+ check_elaborated_type_specifier
+ (tag_type, decl,
+ (parser->num_template_parameter_lists
+ || DECL_SELF_REFERENCE_P (decl)));
+
+ type = TREE_TYPE (decl);
+ }
+ else
+ {
+ /* An elaborated-type-specifier sometimes introduces a new type and
+ sometimes names an existing type. Normally, the rule is that it
+ introduces a new type only if there is not an existing type of
+ the same name already in scope. For example, given:
+
+ struct S {};
+ void f() { struct S s; }
+
+ the `struct S' in the body of `f' is the same `struct S' as in
+ the global scope; the existing definition is used. However, if
+ there were no global declaration, this would introduce a new
+ local class named `S'.
+
+ An exception to this rule applies to the following code:
+
+ namespace N { struct S; }
+
+ Here, the elaborated-type-specifier names a new type
+ unconditionally; even if there is already an `S' in the
+ containing scope this declaration names a new type.
+ This exception only applies if the elaborated-type-specifier
+ forms the complete declaration:
+
+ [class.name]
+
+ A declaration consisting solely of `class-key identifier ;' is
+ either a redeclaration of the name in the current scope or a
+ forward declaration of the identifier as a class name. It
+ introduces the name into the current scope.
+
+ We are in this situation precisely when the next token is a `;'.
+
+ An exception to the exception is that a `friend' declaration does
+ *not* name a new type; i.e., given:
+
+ struct S { friend struct T; };
+
+ `T' is not a new type in the scope of `S'.
+
+ Also, `new struct S' or `sizeof (struct S)' never results in the
+ definition of a new type; a new type can only be declared in a
+ declaration context. */
+
+ /* Warn about attributes. They are ignored. */
+ if (attributes)
+ warning ("type attributes are honored only at type definition");
+
+ type = xref_tag (tag_type, identifier,
+ (is_friend
+ || !is_declaration
+ || cp_lexer_next_token_is_not (parser->lexer,
+ CPP_SEMICOLON)),
+ parser->num_template_parameter_lists);
+ }
+ }
+ if (tag_type != enum_type)
+ cp_parser_check_class_key (tag_type, type);
+
+ /* A "<" cannot follow an elaborated type specifier. If that
+ happens, the user was probably trying to form a template-id. */
+ cp_parser_check_for_invalid_template_id (parser, type);
+
+ return type;
+}
+
+/* Parse an enum-specifier.
+
+ enum-specifier:
+ enum identifier [opt] { enumerator-list [opt] }
+
+ Returns an ENUM_TYPE representing the enumeration. */
+
+static tree
+cp_parser_enum_specifier (cp_parser* parser)
+{
+ cp_token *token;
+ tree identifier = NULL_TREE;
+ tree type;
+
+ /* Look for the `enum' keyword. */
+ if (!cp_parser_require_keyword (parser, RID_ENUM, "`enum'"))
+ return error_mark_node;
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ /* See if it is an identifier. */
+ if (token->type == CPP_NAME)
+ identifier = cp_parser_identifier (parser);
+
+ /* Look for the `{'. */
+ if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'"))
+ return error_mark_node;
+
+ /* At this point, we're going ahead with the enum-specifier, even
+ if some other problem occurs. */
+ cp_parser_commit_to_tentative_parse (parser);
+
+ /* Issue an error message if type-definitions are forbidden here. */
+ cp_parser_check_type_definition (parser);
+
+ /* Create the new type. */
+ type = start_enum (identifier ? identifier : make_anon_name ());
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's not a `}', then there are some enumerators. */
+ if (token->type != CPP_CLOSE_BRACE)
+ cp_parser_enumerator_list (parser, type);
+ /* Look for the `}'. */
+ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
+
+ /* Finish up the enumeration. */
+ finish_enum (type);
+
+ return type;
+}
+
+/* Parse an enumerator-list. The enumerators all have the indicated
+ TYPE.
+
+ enumerator-list:
+ enumerator-definition
+ enumerator-list , enumerator-definition */
+
+static void
+cp_parser_enumerator_list (cp_parser* parser, tree type)
+{
+ while (true)
+ {
+ cp_token *token;
+
+ /* Parse an enumerator-definition. */
+ cp_parser_enumerator_definition (parser, type);
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's not a `,', then we've reached the end of the
+ list. */
+ if (token->type != CPP_COMMA)
+ break;
+ /* Otherwise, consume the `,' and keep going. */
+ cp_lexer_consume_token (parser->lexer);
+ /* If the next token is a `}', there is a trailing comma. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
+ {
+ if (pedantic && !in_system_header)
+ pedwarn ("comma at end of enumerator list");
+ break;
+ }
+ }
+}
+
+/* Parse an enumerator-definition. The enumerator has the indicated
+ TYPE.
+
+ enumerator-definition:
+ enumerator
+ enumerator = constant-expression
+
+ enumerator:
+ identifier */
+
+static void
+cp_parser_enumerator_definition (cp_parser* parser, tree type)
+{
+ cp_token *token;
+ tree identifier;
+ tree value;
+
+ /* Look for the identifier. */
+ identifier = cp_parser_identifier (parser);
+ if (identifier == error_mark_node)
+ return;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's an `=', then there's an explicit value. */
+ if (token->type == CPP_EQ)
+ {
+ /* Consume the `=' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the value. */
+ value = cp_parser_constant_expression (parser,
+ /*allow_non_constant_p=*/false,
+ NULL);
+ }
+ else
+ value = NULL_TREE;
+
+ /* Create the enumerator. */
+ build_enumerator (identifier, value, type);
+}
+
+/* Parse a namespace-name.
+
+ namespace-name:
+ original-namespace-name
+ namespace-alias
+
+ Returns the NAMESPACE_DECL for the namespace. */
+
+static tree
+cp_parser_namespace_name (cp_parser* parser)
+{
+ tree identifier;
+ tree namespace_decl;
+
+ /* Get the name of the namespace. */
+ identifier = cp_parser_identifier (parser);
+ if (identifier == error_mark_node)
+ return error_mark_node;
+
+ /* Look up the identifier in the currently active scope. Look only
+ for namespaces, due to:
+
+ [basic.lookup.udir]
+
+ When looking up a namespace-name in a using-directive or alias
+ definition, only namespace names are considered.
+
+ And:
+
+ [basic.lookup.qual]
+
+ During the lookup of a name preceding the :: scope resolution
+ operator, object, function, and enumerator names are ignored.
+
+ (Note that cp_parser_class_or_namespace_name only calls this
+ function if the token after the name is the scope resolution
+ operator.) */
+ namespace_decl = cp_parser_lookup_name (parser, identifier,
+ /*is_type=*/false,
+ /*is_template=*/false,
+ /*is_namespace=*/true,
+ /*check_dependency=*/true);
+ /* If it's not a namespace, issue an error. */
+ if (namespace_decl == error_mark_node
+ || TREE_CODE (namespace_decl) != NAMESPACE_DECL)
+ {
+ cp_parser_error (parser, "expected namespace-name");
+ namespace_decl = error_mark_node;
+ }
+
+ return namespace_decl;
+}
+
+/* Parse a namespace-definition.
+
+ namespace-definition:
+ named-namespace-definition
+ unnamed-namespace-definition
+
+ named-namespace-definition:
+ original-namespace-definition
+ extension-namespace-definition
+
+ original-namespace-definition:
+ namespace identifier { namespace-body }
+
+ extension-namespace-definition:
+ namespace original-namespace-name { namespace-body }
+
+ unnamed-namespace-definition:
+ namespace { namespace-body } */
+
+static void
+cp_parser_namespace_definition (cp_parser* parser)
+{
+ tree identifier;
+
+ /* Look for the `namespace' keyword. */
+ cp_parser_require_keyword (parser, RID_NAMESPACE, "`namespace'");
+
+ /* Get the name of the namespace. We do not attempt to distinguish
+ between an original-namespace-definition and an
+ extension-namespace-definition at this point. The semantic
+ analysis routines are responsible for that. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
+ identifier = cp_parser_identifier (parser);
+ else
+ identifier = NULL_TREE;
+
+ /* Look for the `{' to start the namespace. */
+ cp_parser_require (parser, CPP_OPEN_BRACE, "`{'");
+ /* Start the namespace. */
+ push_namespace (identifier);
+ /* Parse the body of the namespace. */
+ cp_parser_namespace_body (parser);
+ /* Finish the namespace. */
+ pop_namespace ();
+ /* Look for the final `}'. */
+ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
+}
+
+/* Parse a namespace-body.
+
+ namespace-body:
+ declaration-seq [opt] */
+
+static void
+cp_parser_namespace_body (cp_parser* parser)
+{
+ cp_parser_declaration_seq_opt (parser);
+}
+
+/* Parse a namespace-alias-definition.
+
+ namespace-alias-definition:
+ namespace identifier = qualified-namespace-specifier ; */
+
+static void
+cp_parser_namespace_alias_definition (cp_parser* parser)
+{
+ tree identifier;
+ tree namespace_specifier;
+
+ /* Look for the `namespace' keyword. */
+ cp_parser_require_keyword (parser, RID_NAMESPACE, "`namespace'");
+ /* Look for the identifier. */
+ identifier = cp_parser_identifier (parser);
+ if (identifier == error_mark_node)
+ return;
+ /* Look for the `=' token. */
+ cp_parser_require (parser, CPP_EQ, "`='");
+ /* Look for the qualified-namespace-specifier. */
+ namespace_specifier
+ = cp_parser_qualified_namespace_specifier (parser);
+ /* Look for the `;' token. */
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+
+ /* Register the alias in the symbol table. */
+ do_namespace_alias (identifier, namespace_specifier);
+}
+
+/* Parse a qualified-namespace-specifier.
+
+ qualified-namespace-specifier:
+ :: [opt] nested-name-specifier [opt] namespace-name
+
+ Returns a NAMESPACE_DECL corresponding to the specified
+ namespace. */
+
+static tree
+cp_parser_qualified_namespace_specifier (cp_parser* parser)
+{
+ /* Look for the optional `::'. */
+ cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false);
+
+ /* Look for the optional nested-name-specifier. */
+ cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*type_p=*/false,
+ /*is_declaration=*/true);
+
+ return cp_parser_namespace_name (parser);
+}
+
+/* Parse a using-declaration.
+
+ using-declaration:
+ using typename [opt] :: [opt] nested-name-specifier unqualified-id ;
+ using :: unqualified-id ; */
+
+static void
+cp_parser_using_declaration (cp_parser* parser)
+{
+ cp_token *token;
+ bool typename_p = false;
+ bool global_scope_p;
+ tree decl;
+ tree identifier;
+ tree scope;
+ tree qscope;
+
+ /* Look for the `using' keyword. */
+ cp_parser_require_keyword (parser, RID_USING, "`using'");
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* See if it's `typename'. */
+ if (token->keyword == RID_TYPENAME)
+ {
+ /* Remember that we've seen it. */
+ typename_p = true;
+ /* Consume the `typename' token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ /* Look for the optional global scope qualification. */
+ global_scope_p
+ = (cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false)
+ != NULL_TREE);
+
+ /* If we saw `typename', or didn't see `::', then there must be a
+ nested-name-specifier present. */
+ if (typename_p || !global_scope_p)
+ qscope = cp_parser_nested_name_specifier (parser, typename_p,
+ /*check_dependency_p=*/true,
+ /*type_p=*/false,
+ /*is_declaration=*/true);
+ /* Otherwise, we could be in either of the two productions. In that
+ case, treat the nested-name-specifier as optional. */
+ else
+ qscope = cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*type_p=*/false,
+ /*is_declaration=*/true);
+ if (!qscope)
+ qscope = global_namespace;
+
+ /* Parse the unqualified-id. */
+ identifier = cp_parser_unqualified_id (parser,
+ /*template_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*declarator_p=*/true);
+
+ /* The function we call to handle a using-declaration is different
+ depending on what scope we are in. */
+ if (identifier == error_mark_node)
+ ;
+ else if (TREE_CODE (identifier) != IDENTIFIER_NODE
+ && TREE_CODE (identifier) != BIT_NOT_EXPR)
+ /* [namespace.udecl]
+
+ A using declaration shall not name a template-id. */
+ error ("a template-id may not appear in a using-declaration");
+ else
+ {
+ scope = current_scope ();
+ if (scope && TYPE_P (scope))
+ {
+ /* Create the USING_DECL. */
+ decl = do_class_using_decl (build_nt (SCOPE_REF,
+ parser->scope,
+ identifier));
+ /* Add it to the list of members in this class. */
+ finish_member_declaration (decl);
+ }
+ else
+ {
+ decl = cp_parser_lookup_name_simple (parser, identifier);
+ if (decl == error_mark_node)
+ cp_parser_name_lookup_error (parser, identifier, decl, NULL);
+ else if (scope)
+ do_local_using_decl (decl, qscope, identifier);
+ else
+ do_toplevel_using_decl (decl, qscope, identifier);
+ }
+ }
+
+ /* Look for the final `;'. */
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+}
+
+/* Parse a using-directive.
+
+ using-directive:
+ using namespace :: [opt] nested-name-specifier [opt]
+ namespace-name ; */
+
+static void
+cp_parser_using_directive (cp_parser* parser)
+{
+ tree namespace_decl;
+ tree attribs;
+
+ /* Look for the `using' keyword. */
+ cp_parser_require_keyword (parser, RID_USING, "`using'");
+ /* And the `namespace' keyword. */
+ cp_parser_require_keyword (parser, RID_NAMESPACE, "`namespace'");
+ /* Look for the optional `::' operator. */
+ cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/false);
+ /* And the optional nested-name-specifier. */
+ cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*type_p=*/false,
+ /*is_declaration=*/true);
+ /* Get the namespace being used. */
+ namespace_decl = cp_parser_namespace_name (parser);
+ /* And any specified attributes. */
+ attribs = cp_parser_attributes_opt (parser);
+ /* Update the symbol table. */
+ parse_using_directive (namespace_decl, attribs);
+ /* Look for the final `;'. */
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+}
+
+/* Parse an asm-definition.
+
+ asm-definition:
+ asm ( string-literal ) ;
+
+ GNU Extension:
+
+ asm-definition:
+ asm volatile [opt] ( string-literal ) ;
+ asm volatile [opt] ( string-literal : asm-operand-list [opt] ) ;
+ asm volatile [opt] ( string-literal : asm-operand-list [opt]
+ : asm-operand-list [opt] ) ;
+ asm volatile [opt] ( string-literal : asm-operand-list [opt]
+ : asm-operand-list [opt]
+ : asm-operand-list [opt] ) ; */
+
+static void
+cp_parser_asm_definition (cp_parser* parser)
+{
+ cp_token *token;
+ tree string;
+ tree outputs = NULL_TREE;
+ tree inputs = NULL_TREE;
+ tree clobbers = NULL_TREE;
+ tree asm_stmt;
+ bool volatile_p = false;
+ bool extended_p = false;
+
+ /* Look for the `asm' keyword. */
+ cp_parser_require_keyword (parser, RID_ASM, "`asm'");
+ /* See if the next token is `volatile'. */
+ if (cp_parser_allow_gnu_extensions_p (parser)
+ && cp_lexer_next_token_is_keyword (parser->lexer, RID_VOLATILE))
+ {
+ /* Remember that we saw the `volatile' keyword. */
+ volatile_p = true;
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+ /* Look for the opening `('. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ /* Look for the string. */
+ token = cp_parser_require (parser, CPP_STRING, "asm body");
+ if (!token)
+ return;
+ string = token->value;
+ /* If we're allowing GNU extensions, check for the extended assembly
+ syntax. Unfortunately, the `:' tokens need not be separated by
+ a space in C, and so, for compatibility, we tolerate that here
+ too. Doing that means that we have to treat the `::' operator as
+ two `:' tokens. */
+ if (cp_parser_allow_gnu_extensions_p (parser)
+ && at_function_scope_p ()
+ && (cp_lexer_next_token_is (parser->lexer, CPP_COLON)
+ || cp_lexer_next_token_is (parser->lexer, CPP_SCOPE)))
+ {
+ bool inputs_p = false;
+ bool clobbers_p = false;
+
+ /* The extended syntax was used. */
+ extended_p = true;
+
+ /* Look for outputs. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
+ {
+ /* Consume the `:'. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the output-operands. */
+ if (cp_lexer_next_token_is_not (parser->lexer,
+ CPP_COLON)
+ && cp_lexer_next_token_is_not (parser->lexer,
+ CPP_SCOPE)
+ && cp_lexer_next_token_is_not (parser->lexer,
+ CPP_CLOSE_PAREN))
+ outputs = cp_parser_asm_operand_list (parser);
+ }
+ /* If the next token is `::', there are no outputs, and the
+ next token is the beginning of the inputs. */
+ else if (cp_lexer_next_token_is (parser->lexer, CPP_SCOPE))
+ {
+ /* Consume the `::' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* The inputs are coming next. */
+ inputs_p = true;
+ }
+
+ /* Look for inputs. */
+ if (inputs_p
+ || cp_lexer_next_token_is (parser->lexer, CPP_COLON))
+ {
+ if (!inputs_p)
+ /* Consume the `:'. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the output-operands. */
+ if (cp_lexer_next_token_is_not (parser->lexer,
+ CPP_COLON)
+ && cp_lexer_next_token_is_not (parser->lexer,
+ CPP_SCOPE)
+ && cp_lexer_next_token_is_not (parser->lexer,
+ CPP_CLOSE_PAREN))
+ inputs = cp_parser_asm_operand_list (parser);
+ }
+ else if (cp_lexer_next_token_is (parser->lexer, CPP_SCOPE))
+ /* The clobbers are coming next. */
+ clobbers_p = true;
+
+ /* Look for clobbers. */
+ if (clobbers_p
+ || cp_lexer_next_token_is (parser->lexer, CPP_COLON))
+ {
+ if (!clobbers_p)
+ /* Consume the `:'. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the clobbers. */
+ if (cp_lexer_next_token_is_not (parser->lexer,
+ CPP_CLOSE_PAREN))
+ clobbers = cp_parser_asm_clobber_list (parser);
+ }
+ }
+ /* Look for the closing `)'. */
+ if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"))
+ cp_parser_skip_to_closing_parenthesis (parser, true, false,
+ /*consume_paren=*/true);
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+
+ /* Create the ASM_STMT. */
+ if (at_function_scope_p ())
+ {
+ asm_stmt =
+ finish_asm_stmt (volatile_p
+ ? ridpointers[(int) RID_VOLATILE] : NULL_TREE,
+ string, outputs, inputs, clobbers);
+ /* If the extended syntax was not used, mark the ASM_STMT. */
+ if (!extended_p)
+ ASM_INPUT_P (asm_stmt) = 1;
+ }
+ else
+ assemble_asm (string);
+}
+
+/* Declarators [gram.dcl.decl] */
+
+/* Parse an init-declarator.
+
+ init-declarator:
+ declarator initializer [opt]
+
+ GNU Extension:
+
+ init-declarator:
+ declarator asm-specification [opt] attributes [opt] initializer [opt]
+
+ function-definition:
+ decl-specifier-seq [opt] declarator ctor-initializer [opt]
+ function-body
+ decl-specifier-seq [opt] declarator function-try-block
+
+ GNU Extension:
+
+ function-definition:
+ __extension__ function-definition
+
+ The DECL_SPECIFIERS and PREFIX_ATTRIBUTES apply to this declarator.
+ Returns a representation of the entity declared. If MEMBER_P is TRUE,
+ then this declarator appears in a class scope. The new DECL created
+ by this declarator is returned.
+
+ If FUNCTION_DEFINITION_ALLOWED_P then we handle the declarator and
+ for a function-definition here as well. If the declarator is a
+ declarator for a function-definition, *FUNCTION_DEFINITION_P will
+ be TRUE upon return. By that point, the function-definition will
+ have been completely parsed.
+
+ FUNCTION_DEFINITION_P may be NULL if FUNCTION_DEFINITION_ALLOWED_P
+ is FALSE. */
+
+static tree
+cp_parser_init_declarator (cp_parser* parser,
+ tree decl_specifiers,
+ tree prefix_attributes,
+ bool function_definition_allowed_p,
+ bool member_p,
+ int declares_class_or_enum,
+ bool* function_definition_p)
+{
+ cp_token *token;
+ tree declarator;
+ tree attributes;
+ tree asm_specification;
+ tree initializer;
+ tree decl = NULL_TREE;
+ tree scope;
+ bool is_initialized;
+ bool is_parenthesized_init;
+ bool is_non_constant_init;
+ int ctor_dtor_or_conv_p;
+ bool friend_p;
+ bool pop_p = false;
+
+ /* Assume that this is not the declarator for a function
+ definition. */
+ if (function_definition_p)
+ *function_definition_p = false;
+
+ /* Defer access checks while parsing the declarator; we cannot know
+ what names are accessible until we know what is being
+ declared. */
+ resume_deferring_access_checks ();
+
+ /* Parse the declarator. */
+ declarator
+ = cp_parser_declarator (parser, CP_PARSER_DECLARATOR_NAMED,
+ &ctor_dtor_or_conv_p,
+ /*parenthesized_p=*/NULL);
+ /* Gather up the deferred checks. */
+ stop_deferring_access_checks ();
+
+ /* If the DECLARATOR was erroneous, there's no need to go
+ further. */
+ if (declarator == error_mark_node)
+ return error_mark_node;
+
+ cp_parser_check_for_definition_in_return_type (declarator,
+ declares_class_or_enum);
+
+ /* Figure out what scope the entity declared by the DECLARATOR is
+ located in. `grokdeclarator' sometimes changes the scope, so
+ we compute it now. */
+ scope = get_scope_of_declarator (declarator);
+
+ /* If we're allowing GNU extensions, look for an asm-specification
+ and attributes. */
+ if (cp_parser_allow_gnu_extensions_p (parser))
+ {
+ /* Look for an asm-specification. */
+ asm_specification = cp_parser_asm_specification_opt (parser);
+ /* And attributes. */
+ attributes = cp_parser_attributes_opt (parser);
+ }
+ else
+ {
+ asm_specification = NULL_TREE;
+ attributes = NULL_TREE;
+ }
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* Check to see if the token indicates the start of a
+ function-definition. */
+ if (cp_parser_token_starts_function_definition_p (token))
+ {
+ if (!function_definition_allowed_p)
+ {
+ /* If a function-definition should not appear here, issue an
+ error message. */
+ cp_parser_error (parser,
+ "a function-definition is not allowed here");
+ return error_mark_node;
+ }
+ else
+ {
+ /* Neither attributes nor an asm-specification are allowed
+ on a function-definition. */
+ if (asm_specification)
+ error ("an asm-specification is not allowed on a function-definition");
+ if (attributes)
+ error ("attributes are not allowed on a function-definition");
+ /* This is a function-definition. */
+ *function_definition_p = true;
+
+ /* Parse the function definition. */
+ if (member_p)
+ decl = cp_parser_save_member_function_body (parser,
+ decl_specifiers,
+ declarator,
+ prefix_attributes);
+ else
+ decl
+ = (cp_parser_function_definition_from_specifiers_and_declarator
+ (parser, decl_specifiers, prefix_attributes, declarator));
+
+ return decl;
+ }
+ }
+
+ /* [dcl.dcl]
+
+ Only in function declarations for constructors, destructors, and
+ type conversions can the decl-specifier-seq be omitted.
+
+ We explicitly postpone this check past the point where we handle
+ function-definitions because we tolerate function-definitions
+ that are missing their return types in some modes. */
+ if (!decl_specifiers && ctor_dtor_or_conv_p <= 0)
+ {
+ cp_parser_error (parser,
+ "expected constructor, destructor, or type conversion");
+ return error_mark_node;
+ }
+
+ /* An `=' or an `(' indicates an initializer. */
+ is_initialized = (token->type == CPP_EQ
+ || token->type == CPP_OPEN_PAREN);
+ /* If the init-declarator isn't initialized and isn't followed by a
+ `,' or `;', it's not a valid init-declarator. */
+ if (!is_initialized
+ && token->type != CPP_COMMA
+ && token->type != CPP_SEMICOLON)
+ {
+ cp_parser_error (parser, "expected init-declarator");
+ return error_mark_node;
+ }
+
+ /* Because start_decl has side-effects, we should only call it if we
+ know we're going ahead. By this point, we know that we cannot
+ possibly be looking at any other construct. */
+ cp_parser_commit_to_tentative_parse (parser);
+
+ /* If the decl specifiers were bad, issue an error now that we're
+ sure this was intended to be a declarator. Then continue
+ declaring the variable(s), as int, to try to cut down on further
+ errors. */
+ if (decl_specifiers != NULL
+ && TREE_VALUE (decl_specifiers) == error_mark_node)
+ {
+ cp_parser_error (parser, "invalid type in declaration");
+ TREE_VALUE (decl_specifiers) = integer_type_node;
+ }
+
+ /* Check to see whether or not this declaration is a friend. */
+ friend_p = cp_parser_friend_p (decl_specifiers);
+
+ /* Check that the number of template-parameter-lists is OK. */
+ if (!cp_parser_check_declarator_template_parameters (parser, declarator))
+ return error_mark_node;
+
+ /* Enter the newly declared entry in the symbol table. If we're
+ processing a declaration in a class-specifier, we wait until
+ after processing the initializer. */
+ if (!member_p)
+ {
+ if (parser->in_unbraced_linkage_specification_p)
+ {
+ decl_specifiers = tree_cons (error_mark_node,
+ get_identifier ("extern"),
+ decl_specifiers);
+ have_extern_spec = false;
+ }
+ decl = start_decl (declarator, decl_specifiers,
+ is_initialized, attributes, prefix_attributes);
+ }
+
+ /* Enter the SCOPE. That way unqualified names appearing in the
+ initializer will be looked up in SCOPE. */
+ if (scope)
+ pop_p = push_scope (scope);
+
+ /* Perform deferred access control checks, now that we know in which
+ SCOPE the declared entity resides. */
+ if (!member_p && decl)
+ {
+ tree saved_current_function_decl = NULL_TREE;
+
+ /* If the entity being declared is a function, pretend that we
+ are in its scope. If it is a `friend', it may have access to
+ things that would not otherwise be accessible. */
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ saved_current_function_decl = current_function_decl;
+ current_function_decl = decl;
+ }
+
+ /* Perform the access control checks for the declarator and the
+ the decl-specifiers. */
+ perform_deferred_access_checks ();
+
+ /* Restore the saved value. */
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ current_function_decl = saved_current_function_decl;
+ }
+
+ /* Parse the initializer. */
+ if (is_initialized)
+ initializer = cp_parser_initializer (parser,
+ &is_parenthesized_init,
+ &is_non_constant_init);
+ else
+ {
+ initializer = NULL_TREE;
+ is_parenthesized_init = false;
+ is_non_constant_init = true;
+ }
+
+ /* The old parser allows attributes to appear after a parenthesized
+ initializer. Mark Mitchell proposed removing this functionality
+ on the GCC mailing lists on 2002-08-13. This parser accepts the
+ attributes -- but ignores them. */
+ if (cp_parser_allow_gnu_extensions_p (parser) && is_parenthesized_init)
+ if (cp_parser_attributes_opt (parser))
+ warning ("attributes after parenthesized initializer ignored");
+
+ /* Leave the SCOPE, now that we have processed the initializer. It
+ is important to do this before calling cp_finish_decl because it
+ makes decisions about whether to create DECL_STMTs or not based
+ on the current scope. */
+ if (pop_p)
+ pop_scope (scope);
+
+ /* For an in-class declaration, use `grokfield' to create the
+ declaration. */
+ if (member_p)
+ {
+ decl = grokfield (declarator, decl_specifiers,
+ initializer, /*asmspec=*/NULL_TREE,
+ /*attributes=*/NULL_TREE);
+ if (decl && TREE_CODE (decl) == FUNCTION_DECL)
+ cp_parser_save_default_args (parser, decl);
+ }
+
+ /* Finish processing the declaration. But, skip friend
+ declarations. */
+ if (!friend_p && decl)
+ cp_finish_decl (decl,
+ initializer,
+ asm_specification,
+ /* If the initializer is in parentheses, then this is
+ a direct-initialization, which means that an
+ `explicit' constructor is OK. Otherwise, an
+ `explicit' constructor cannot be used. */
+ ((is_parenthesized_init || !is_initialized)
+ ? 0 : LOOKUP_ONLYCONVERTING));
+
+ /* Remember whether or not variables were initialized by
+ constant-expressions. */
+ if (decl && TREE_CODE (decl) == VAR_DECL
+ && is_initialized && !is_non_constant_init)
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = true;
+
+ return decl;
+}
+
+/* Parse a declarator.
+
+ declarator:
+ direct-declarator
+ ptr-operator declarator
+
+ abstract-declarator:
+ ptr-operator abstract-declarator [opt]
+ direct-abstract-declarator
+
+ GNU Extensions:
+
+ declarator:
+ attributes [opt] direct-declarator
+ attributes [opt] ptr-operator declarator
+
+ abstract-declarator:
+ attributes [opt] ptr-operator abstract-declarator [opt]
+ attributes [opt] direct-abstract-declarator
+
+ Returns a representation of the declarator. If the declarator has
+ the form `* declarator', then an INDIRECT_REF is returned, whose
+ only operand is the sub-declarator. Analogously, `& declarator' is
+ represented as an ADDR_EXPR. For `X::* declarator', a SCOPE_REF is
+ used. The first operand is the TYPE for `X'. The second operand
+ is an INDIRECT_REF whose operand is the sub-declarator.
+
+ Otherwise, the representation is as for a direct-declarator.
+
+ (It would be better to define a structure type to represent
+ declarators, rather than abusing `tree' nodes to represent
+ declarators. That would be much clearer and save some memory.
+ There is no reason for declarators to be garbage-collected, for
+ example; they are created during parser and no longer needed after
+ `grokdeclarator' has been called.)
+
+ For a ptr-operator that has the optional cv-qualifier-seq,
+ cv-qualifiers will be stored in the TREE_TYPE of the INDIRECT_REF
+ node.
+
+ If CTOR_DTOR_OR_CONV_P is not NULL, *CTOR_DTOR_OR_CONV_P is used to
+ detect constructor, destructor or conversion operators. It is set
+ to -1 if the declarator is a name, and +1 if it is a
+ function. Otherwise it is set to zero. Usually you just want to
+ test for >0, but internally the negative value is used.
+
+ (The reason for CTOR_DTOR_OR_CONV_P is that a declaration must have
+ a decl-specifier-seq unless it declares a constructor, destructor,
+ or conversion. It might seem that we could check this condition in
+ semantic analysis, rather than parsing, but that makes it difficult
+ to handle something like `f()'. We want to notice that there are
+ no decl-specifiers, and therefore realize that this is an
+ expression, not a declaration.)
+
+ If PARENTHESIZED_P is non-NULL, *PARENTHESIZED_P is set to true iff
+ the declarator is a direct-declarator of the form "(...)". */
+
+static tree
+cp_parser_declarator (cp_parser* parser,
+ cp_parser_declarator_kind dcl_kind,
+ int* ctor_dtor_or_conv_p,
+ bool* parenthesized_p)
+{
+ cp_token *token;
+ tree declarator;
+ enum tree_code code;
+ tree cv_qualifier_seq;
+ tree class_type;
+ tree attributes = NULL_TREE;
+
+ /* Assume this is not a constructor, destructor, or type-conversion
+ operator. */
+ if (ctor_dtor_or_conv_p)
+ *ctor_dtor_or_conv_p = 0;
+
+ if (cp_parser_allow_gnu_extensions_p (parser))
+ attributes = cp_parser_attributes_opt (parser);
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ /* Check for the ptr-operator production. */
+ cp_parser_parse_tentatively (parser);
+ /* Parse the ptr-operator. */
+ code = cp_parser_ptr_operator (parser,
+ &class_type,
+ &cv_qualifier_seq);
+ /* If that worked, then we have a ptr-operator. */
+ if (cp_parser_parse_definitely (parser))
+ {
+ /* If a ptr-operator was found, then this declarator was not
+ parenthesized. */
+ if (parenthesized_p)
+ *parenthesized_p = true;
+ /* The dependent declarator is optional if we are parsing an
+ abstract-declarator. */
+ if (dcl_kind != CP_PARSER_DECLARATOR_NAMED)
+ cp_parser_parse_tentatively (parser);
+
+ /* Parse the dependent declarator. */
+ declarator = cp_parser_declarator (parser, dcl_kind,
+ /*ctor_dtor_or_conv_p=*/NULL,
+ /*parenthesized_p=*/NULL);
+
+ /* If we are parsing an abstract-declarator, we must handle the
+ case where the dependent declarator is absent. */
+ if (dcl_kind != CP_PARSER_DECLARATOR_NAMED
+ && !cp_parser_parse_definitely (parser))
+ declarator = NULL_TREE;
+
+ /* Build the representation of the ptr-operator. */
+ if (code == INDIRECT_REF)
+ declarator = make_pointer_declarator (cv_qualifier_seq,
+ declarator);
+ else
+ declarator = make_reference_declarator (cv_qualifier_seq,
+ declarator);
+ /* Handle the pointer-to-member case. */
+ if (class_type)
+ declarator = build_nt (SCOPE_REF, class_type, declarator);
+ }
+ /* Everything else is a direct-declarator. */
+ else
+ {
+ if (parenthesized_p)
+ *parenthesized_p = cp_lexer_next_token_is (parser->lexer,
+ CPP_OPEN_PAREN);
+ declarator = cp_parser_direct_declarator (parser, dcl_kind,
+ ctor_dtor_or_conv_p);
+ }
+
+ if (attributes && declarator != error_mark_node)
+ declarator = tree_cons (attributes, declarator, NULL_TREE);
+
+ return declarator;
+}
+
+/* Parse a direct-declarator or direct-abstract-declarator.
+
+ direct-declarator:
+ declarator-id
+ direct-declarator ( parameter-declaration-clause )
+ cv-qualifier-seq [opt]
+ exception-specification [opt]
+ direct-declarator [ constant-expression [opt] ]
+ ( declarator )
+
+ direct-abstract-declarator:
+ direct-abstract-declarator [opt]
+ ( parameter-declaration-clause )
+ cv-qualifier-seq [opt]
+ exception-specification [opt]
+ direct-abstract-declarator [opt] [ constant-expression [opt] ]
+ ( abstract-declarator )
+
+ Returns a representation of the declarator. DCL_KIND is
+ CP_PARSER_DECLARATOR_ABSTRACT, if we are parsing a
+ direct-abstract-declarator. It is CP_PARSER_DECLARATOR_NAMED, if
+ we are parsing a direct-declarator. It is
+ CP_PARSER_DECLARATOR_EITHER, if we can accept either - in the case
+ of ambiguity we prefer an abstract declarator, as per
+ [dcl.ambig.res]. CTOR_DTOR_OR_CONV_P is as for
+ cp_parser_declarator.
+
+ For the declarator-id production, the representation is as for an
+ id-expression, except that a qualified name is represented as a
+ SCOPE_REF. A function-declarator is represented as a CALL_EXPR;
+ see the documentation of the FUNCTION_DECLARATOR_* macros for
+ information about how to find the various declarator components.
+ An array-declarator is represented as an ARRAY_REF. The
+ direct-declarator is the first operand; the constant-expression
+ indicating the size of the array is the second operand. */
+
+static tree
+cp_parser_direct_declarator (cp_parser* parser,
+ cp_parser_declarator_kind dcl_kind,
+ int* ctor_dtor_or_conv_p)
+{
+ cp_token *token;
+ tree declarator = NULL_TREE;
+ tree scope = NULL_TREE;
+ bool saved_default_arg_ok_p = parser->default_arg_ok_p;
+ bool saved_in_declarator_p = parser->in_declarator_p;
+ bool first = true;
+ bool pop_p = false;
+
+ while (true)
+ {
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ if (token->type == CPP_OPEN_PAREN)
+ {
+ /* This is either a parameter-declaration-clause, or a
+ parenthesized declarator. When we know we are parsing a
+ named declarator, it must be a parenthesized declarator
+ if FIRST is true. For instance, `(int)' is a
+ parameter-declaration-clause, with an omitted
+ direct-abstract-declarator. But `((*))', is a
+ parenthesized abstract declarator. Finally, when T is a
+ template parameter `(T)' is a
+ parameter-declaration-clause, and not a parenthesized
+ named declarator.
+
+ We first try and parse a parameter-declaration-clause,
+ and then try a nested declarator (if FIRST is true).
+
+ It is not an error for it not to be a
+ parameter-declaration-clause, even when FIRST is
+ false. Consider,
+
+ int i (int);
+ int i (3);
+
+ The first is the declaration of a function while the
+ second is a the definition of a variable, including its
+ initializer.
+
+ Having seen only the parenthesis, we cannot know which of
+ these two alternatives should be selected. Even more
+ complex are examples like:
+
+ int i (int (a));
+ int i (int (3));
+
+ The former is a function-declaration; the latter is a
+ variable initialization.
+
+ Thus again, we try a parameter-declaration-clause, and if
+ that fails, we back out and return. */
+
+ if (!first || dcl_kind != CP_PARSER_DECLARATOR_NAMED)
+ {
+ tree params;
+ unsigned saved_num_template_parameter_lists;
+
+ cp_parser_parse_tentatively (parser);
+
+ /* Consume the `('. */
+ cp_lexer_consume_token (parser->lexer);
+ if (first)
+ {
+ /* If this is going to be an abstract declarator, we're
+ in a declarator and we can't have default args. */
+ parser->default_arg_ok_p = false;
+ parser->in_declarator_p = true;
+ }
+
+ /* Inside the function parameter list, surrounding
+ template-parameter-lists do not apply. */
+ saved_num_template_parameter_lists
+ = parser->num_template_parameter_lists;
+ parser->num_template_parameter_lists = 0;
+
+ /* Parse the parameter-declaration-clause. */
+ params = cp_parser_parameter_declaration_clause (parser);
+
+ parser->num_template_parameter_lists
+ = saved_num_template_parameter_lists;
+
+ /* If all went well, parse the cv-qualifier-seq and the
+ exception-specification. */
+ if (cp_parser_parse_definitely (parser))
+ {
+ tree cv_qualifiers;
+ tree exception_specification;
+
+ if (ctor_dtor_or_conv_p)
+ *ctor_dtor_or_conv_p = *ctor_dtor_or_conv_p < 0;
+ first = false;
+ /* Consume the `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+
+ /* Parse the cv-qualifier-seq. */
+ cv_qualifiers = cp_parser_cv_qualifier_seq_opt (parser);
+ /* And the exception-specification. */
+ exception_specification
+ = cp_parser_exception_specification_opt (parser);
+
+ /* Create the function-declarator. */
+ declarator = make_call_declarator (declarator,
+ params,
+ cv_qualifiers,
+ exception_specification);
+ /* Any subsequent parameter lists are to do with
+ return type, so are not those of the declared
+ function. */
+ parser->default_arg_ok_p = false;
+
+ /* Repeat the main loop. */
+ continue;
+ }
+ }
+
+ /* If this is the first, we can try a parenthesized
+ declarator. */
+ if (first)
+ {
+ bool saved_in_type_id_in_expr_p;
+
+ parser->default_arg_ok_p = saved_default_arg_ok_p;
+ parser->in_declarator_p = saved_in_declarator_p;
+
+ /* Consume the `('. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the nested declarator. */
+ saved_in_type_id_in_expr_p = parser->in_type_id_in_expr_p;
+ parser->in_type_id_in_expr_p = true;
+ declarator
+ = cp_parser_declarator (parser, dcl_kind, ctor_dtor_or_conv_p,
+ /*parenthesized_p=*/NULL);
+ parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p;
+ first = false;
+ /* Expect a `)'. */
+ if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"))
+ declarator = error_mark_node;
+ if (declarator == error_mark_node)
+ break;
+
+ goto handle_declarator;
+ }
+ /* Otherwise, we must be done. */
+ else
+ break;
+ }
+ else if ((!first || dcl_kind != CP_PARSER_DECLARATOR_NAMED)
+ && token->type == CPP_OPEN_SQUARE)
+ {
+ /* Parse an array-declarator. */
+ tree bounds;
+
+ if (ctor_dtor_or_conv_p)
+ *ctor_dtor_or_conv_p = 0;
+
+ first = false;
+ parser->default_arg_ok_p = false;
+ parser->in_declarator_p = true;
+ /* Consume the `['. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If the next token is `]', then there is no
+ constant-expression. */
+ if (token->type != CPP_CLOSE_SQUARE)
+ {
+ bool non_constant_p;
+
+ bounds
+ = cp_parser_constant_expression (parser,
+ /*allow_non_constant=*/true,
+ &non_constant_p);
+ if (!non_constant_p)
+ bounds = fold_non_dependent_expr (bounds);
+ }
+ else
+ bounds = NULL_TREE;
+ /* Look for the closing `]'. */
+ if (!cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"))
+ {
+ declarator = error_mark_node;
+ break;
+ }
+
+ declarator = build_nt (ARRAY_REF, declarator, bounds);
+ }
+ else if (first && dcl_kind != CP_PARSER_DECLARATOR_ABSTRACT)
+ {
+ /* Parse a declarator-id */
+ if (dcl_kind == CP_PARSER_DECLARATOR_EITHER)
+ cp_parser_parse_tentatively (parser);
+ declarator = cp_parser_declarator_id (parser);
+ if (dcl_kind == CP_PARSER_DECLARATOR_EITHER)
+ {
+ if (!cp_parser_parse_definitely (parser))
+ declarator = error_mark_node;
+ else if (TREE_CODE (declarator) != IDENTIFIER_NODE)
+ {
+ cp_parser_error (parser, "expected unqualified-id");
+ declarator = error_mark_node;
+ }
+ }
+
+ if (declarator == error_mark_node)
+ break;
+
+ if (TREE_CODE (declarator) == SCOPE_REF
+ && !current_scope ())
+ {
+ tree scope = TREE_OPERAND (declarator, 0);
+
+ /* In the declaration of a member of a template class
+ outside of the class itself, the SCOPE will sometimes
+ be a TYPENAME_TYPE. For example, given:
+
+ template <typename T>
+ int S<T>::R::i = 3;
+
+ the SCOPE will be a TYPENAME_TYPE for `S<T>::R'. In
+ this context, we must resolve S<T>::R to an ordinary
+ type, rather than a typename type.
+
+ The reason we normally avoid resolving TYPENAME_TYPEs
+ is that a specialization of `S' might render
+ `S<T>::R' not a type. However, if `S' is
+ specialized, then this `i' will not be used, so there
+ is no harm in resolving the types here. */
+ if (TREE_CODE (scope) == TYPENAME_TYPE)
+ {
+ tree type;
+
+ /* Resolve the TYPENAME_TYPE. */
+ type = resolve_typename_type (scope,
+ /*only_current_p=*/false);
+ /* If that failed, the declarator is invalid. */
+ if (type == error_mark_node)
+ error ("`%T::%D' is not a type",
+ TYPE_CONTEXT (scope),
+ TYPE_IDENTIFIER (scope));
+ /* Build a new DECLARATOR. */
+ declarator = build_nt (SCOPE_REF,
+ type,
+ TREE_OPERAND (declarator, 1));
+ }
+ }
+
+ /* Check to see whether the declarator-id names a constructor,
+ destructor, or conversion. */
+ if (declarator && ctor_dtor_or_conv_p
+ && ((TREE_CODE (declarator) == SCOPE_REF
+ && CLASS_TYPE_P (TREE_OPERAND (declarator, 0)))
+ || (TREE_CODE (declarator) != SCOPE_REF
+ && at_class_scope_p ())))
+ {
+ tree unqualified_name;
+ tree class_type;
+
+ /* Get the unqualified part of the name. */
+ if (TREE_CODE (declarator) == SCOPE_REF)
+ {
+ class_type = TREE_OPERAND (declarator, 0);
+ unqualified_name = TREE_OPERAND (declarator, 1);
+ }
+ else
+ {
+ class_type = current_class_type;
+ unqualified_name = declarator;
+ }
+
+ /* See if it names ctor, dtor or conv. */
+ if (TREE_CODE (unqualified_name) == BIT_NOT_EXPR
+ || IDENTIFIER_TYPENAME_P (unqualified_name)
+ || constructor_name_p (unqualified_name, class_type)
+ || (TREE_CODE (unqualified_name) == TYPE_DECL
+ && same_type_p (TREE_TYPE (unqualified_name),
+ class_type)))
+ *ctor_dtor_or_conv_p = -1;
+ }
+
+ handle_declarator:;
+ scope = get_scope_of_declarator (declarator);
+ if (scope)
+ /* Any names that appear after the declarator-id for a
+ member are looked up in the containing scope. */
+ pop_p = push_scope (scope);
+ parser->in_declarator_p = true;
+ if ((ctor_dtor_or_conv_p && *ctor_dtor_or_conv_p)
+ || (declarator
+ && (TREE_CODE (declarator) == SCOPE_REF
+ || TREE_CODE (declarator) == IDENTIFIER_NODE)))
+ /* Default args are only allowed on function
+ declarations. */
+ parser->default_arg_ok_p = saved_default_arg_ok_p;
+ else
+ parser->default_arg_ok_p = false;
+
+ first = false;
+ }
+ /* We're done. */
+ else
+ break;
+ }
+
+ /* For an abstract declarator, we might wind up with nothing at this
+ point. That's an error; the declarator is not optional. */
+ if (!declarator)
+ cp_parser_error (parser, "expected declarator");
+
+ /* If we entered a scope, we must exit it now. */
+ if (pop_p)
+ pop_scope (scope);
+
+ parser->default_arg_ok_p = saved_default_arg_ok_p;
+ parser->in_declarator_p = saved_in_declarator_p;
+
+ return declarator;
+}
+
+/* Parse a ptr-operator.
+
+ ptr-operator:
+ * cv-qualifier-seq [opt]
+ &
+ :: [opt] nested-name-specifier * cv-qualifier-seq [opt]
+
+ GNU Extension:
+
+ ptr-operator:
+ & cv-qualifier-seq [opt]
+
+ Returns INDIRECT_REF if a pointer, or pointer-to-member, was
+ used. Returns ADDR_EXPR if a reference was used. In the
+ case of a pointer-to-member, *TYPE is filled in with the
+ TYPE containing the member. *CV_QUALIFIER_SEQ is filled in
+ with the cv-qualifier-seq, or NULL_TREE, if there are no
+ cv-qualifiers. Returns ERROR_MARK if an error occurred. */
+
+static enum tree_code
+cp_parser_ptr_operator (cp_parser* parser,
+ tree* type,
+ tree* cv_qualifier_seq)
+{
+ enum tree_code code = ERROR_MARK;
+ cp_token *token;
+
+ /* Assume that it's not a pointer-to-member. */
+ *type = NULL_TREE;
+ /* And that there are no cv-qualifiers. */
+ *cv_qualifier_seq = NULL_TREE;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's a `*' or `&' we have a pointer or reference. */
+ if (token->type == CPP_MULT || token->type == CPP_AND)
+ {
+ /* Remember which ptr-operator we were processing. */
+ code = (token->type == CPP_AND ? ADDR_EXPR : INDIRECT_REF);
+
+ /* Consume the `*' or `&'. */
+ cp_lexer_consume_token (parser->lexer);
+
+ /* A `*' can be followed by a cv-qualifier-seq, and so can a
+ `&', if we are allowing GNU extensions. (The only qualifier
+ that can legally appear after `&' is `restrict', but that is
+ enforced during semantic analysis. */
+ if (code == INDIRECT_REF
+ || cp_parser_allow_gnu_extensions_p (parser))
+ *cv_qualifier_seq = cp_parser_cv_qualifier_seq_opt (parser);
+ }
+ else
+ {
+ /* Try the pointer-to-member case. */
+ cp_parser_parse_tentatively (parser);
+ /* Look for the optional `::' operator. */
+ cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false);
+ /* Look for the nested-name specifier. */
+ cp_parser_nested_name_specifier (parser,
+ /*typename_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*type_p=*/false,
+ /*is_declaration=*/false);
+ /* If we found it, and the next token is a `*', then we are
+ indeed looking at a pointer-to-member operator. */
+ if (!cp_parser_error_occurred (parser)
+ && cp_parser_require (parser, CPP_MULT, "`*'"))
+ {
+ /* The type of which the member is a member is given by the
+ current SCOPE. */
+ *type = parser->scope;
+ /* The next name will not be qualified. */
+ parser->scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ parser->object_scope = NULL_TREE;
+ /* Indicate that the `*' operator was used. */
+ code = INDIRECT_REF;
+ /* Look for the optional cv-qualifier-seq. */
+ *cv_qualifier_seq = cp_parser_cv_qualifier_seq_opt (parser);
+ }
+ /* If that didn't work we don't have a ptr-operator. */
+ if (!cp_parser_parse_definitely (parser))
+ cp_parser_error (parser, "expected ptr-operator");
+ }
+
+ return code;
+}
+
+/* Parse an (optional) cv-qualifier-seq.
+
+ cv-qualifier-seq:
+ cv-qualifier cv-qualifier-seq [opt]
+
+ Returns a TREE_LIST. The TREE_VALUE of each node is the
+ representation of a cv-qualifier. */
+
+static tree
+cp_parser_cv_qualifier_seq_opt (cp_parser* parser)
+{
+ tree cv_qualifiers = NULL_TREE;
+
+ while (true)
+ {
+ tree cv_qualifier;
+
+ /* Look for the next cv-qualifier. */
+ cv_qualifier = cp_parser_cv_qualifier_opt (parser);
+ /* If we didn't find one, we're done. */
+ if (!cv_qualifier)
+ break;
+
+ /* Add this cv-qualifier to the list. */
+ cv_qualifiers
+ = tree_cons (NULL_TREE, cv_qualifier, cv_qualifiers);
+ }
+
+ /* We built up the list in reverse order. */
+ return nreverse (cv_qualifiers);
+}
+
+/* Parse an (optional) cv-qualifier.
+
+ cv-qualifier:
+ const
+ volatile
+
+ GNU Extension:
+
+ cv-qualifier:
+ __restrict__ */
+
+static tree
+cp_parser_cv_qualifier_opt (cp_parser* parser)
+{
+ cp_token *token;
+ tree cv_qualifier = NULL_TREE;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* See if it's a cv-qualifier. */
+ switch (token->keyword)
+ {
+ case RID_CONST:
+ case RID_VOLATILE:
+ case RID_RESTRICT:
+ /* Save the value of the token. */
+ cv_qualifier = token->value;
+ /* Consume the token. */
+ cp_lexer_consume_token (parser->lexer);
+ break;
+
+ default:
+ break;
+ }
+
+ return cv_qualifier;
+}
+
+/* Parse a declarator-id.
+
+ declarator-id:
+ id-expression
+ :: [opt] nested-name-specifier [opt] type-name
+
+ In the `id-expression' case, the value returned is as for
+ cp_parser_id_expression if the id-expression was an unqualified-id.
+ If the id-expression was a qualified-id, then a SCOPE_REF is
+ returned. The first operand is the scope (either a NAMESPACE_DECL
+ or TREE_TYPE), but the second is still just a representation of an
+ unqualified-id. */
+
+static tree
+cp_parser_declarator_id (cp_parser* parser)
+{
+ tree id_expression;
+
+ /* The expression must be an id-expression. Assume that qualified
+ names are the names of types so that:
+
+ template <class T>
+ int S<T>::R::i = 3;
+
+ will work; we must treat `S<T>::R' as the name of a type.
+ Similarly, assume that qualified names are templates, where
+ required, so that:
+
+ template <class T>
+ int S<T>::R<T>::i = 3;
+
+ will work, too. */
+ id_expression = cp_parser_id_expression (parser,
+ /*template_keyword_p=*/false,
+ /*check_dependency_p=*/false,
+ /*template_p=*/NULL,
+ /*declarator_p=*/true);
+ /* If the name was qualified, create a SCOPE_REF to represent
+ that. */
+ if (parser->scope)
+ {
+ id_expression = build_nt (SCOPE_REF, parser->scope, id_expression);
+ parser->scope = NULL_TREE;
+ }
+
+ return id_expression;
+}
+
+/* Parse a type-id.
+
+ type-id:
+ type-specifier-seq abstract-declarator [opt]
+
+ Returns the TYPE specified. */
+
+static tree
+cp_parser_type_id (cp_parser* parser)
+{
+ tree type_specifier_seq;
+ tree abstract_declarator;
+
+ /* Parse the type-specifier-seq. */
+ type_specifier_seq
+ = cp_parser_type_specifier_seq (parser);
+ if (type_specifier_seq == error_mark_node)
+ return error_mark_node;
+
+ /* There might or might not be an abstract declarator. */
+ cp_parser_parse_tentatively (parser);
+ /* Look for the declarator. */
+ abstract_declarator
+ = cp_parser_declarator (parser, CP_PARSER_DECLARATOR_ABSTRACT, NULL,
+ /*parenthesized_p=*/NULL);
+ /* Check to see if there really was a declarator. */
+ if (!cp_parser_parse_definitely (parser))
+ abstract_declarator = NULL_TREE;
+
+ return groktypename (build_tree_list (type_specifier_seq,
+ abstract_declarator));
+}
+
+/* Parse a type-specifier-seq.
+
+ type-specifier-seq:
+ type-specifier type-specifier-seq [opt]
+
+ GNU extension:
+
+ type-specifier-seq:
+ attributes type-specifier-seq [opt]
+
+ Returns a TREE_LIST. Either the TREE_VALUE of each node is a
+ type-specifier, or the TREE_PURPOSE is a list of attributes. */
+
+static tree
+cp_parser_type_specifier_seq (cp_parser* parser)
+{
+ bool seen_type_specifier = false;
+ tree type_specifier_seq = NULL_TREE;
+
+ /* Parse the type-specifiers and attributes. */
+ while (true)
+ {
+ tree type_specifier;
+
+ /* Check for attributes first. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_ATTRIBUTE))
+ {
+ type_specifier_seq = tree_cons (cp_parser_attributes_opt (parser),
+ NULL_TREE,
+ type_specifier_seq);
+ continue;
+ }
+
+ /* After the first type-specifier, others are optional. */
+ if (seen_type_specifier)
+ cp_parser_parse_tentatively (parser);
+ /* Look for the type-specifier. */
+ type_specifier = cp_parser_type_specifier (parser,
+ CP_PARSER_FLAGS_NONE,
+ /*is_friend=*/false,
+ /*is_declaration=*/false,
+ NULL,
+ NULL);
+ /* If the first type-specifier could not be found, this is not a
+ type-specifier-seq at all. */
+ if (!seen_type_specifier && type_specifier == error_mark_node)
+ return error_mark_node;
+ /* If subsequent type-specifiers could not be found, the
+ type-specifier-seq is complete. */
+ else if (seen_type_specifier && !cp_parser_parse_definitely (parser))
+ break;
+
+ /* Add the new type-specifier to the list. */
+ type_specifier_seq
+ = tree_cons (NULL_TREE, type_specifier, type_specifier_seq);
+ seen_type_specifier = true;
+ }
+
+ /* We built up the list in reverse order. */
+ return nreverse (type_specifier_seq);
+}
+
+/* Parse a parameter-declaration-clause.
+
+ parameter-declaration-clause:
+ parameter-declaration-list [opt] ... [opt]
+ parameter-declaration-list , ...
+
+ Returns a representation for the parameter declarations. Each node
+ is a TREE_LIST. (See cp_parser_parameter_declaration for the exact
+ representation.) If the parameter-declaration-clause ends with an
+ ellipsis, PARMLIST_ELLIPSIS_P will hold of the first node in the
+ list. A return value of NULL_TREE indicates a
+ parameter-declaration-clause consisting only of an ellipsis. */
+
+static tree
+cp_parser_parameter_declaration_clause (cp_parser* parser)
+{
+ tree parameters;
+ cp_token *token;
+ bool ellipsis_p;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* Check for trivial parameter-declaration-clauses. */
+ if (token->type == CPP_ELLIPSIS)
+ {
+ /* Consume the `...' token. */
+ cp_lexer_consume_token (parser->lexer);
+ return NULL_TREE;
+ }
+ else if (token->type == CPP_CLOSE_PAREN)
+ /* There are no parameters. */
+ {
+#ifndef NO_IMPLICIT_EXTERN_C
+ if (in_system_header && current_class_type == NULL
+ && current_lang_name == lang_name_c)
+ return NULL_TREE;
+ else
+#endif
+ return void_list_node;
+ }
+ /* Check for `(void)', too, which is a special case. */
+ else if (token->keyword == RID_VOID
+ && (cp_lexer_peek_nth_token (parser->lexer, 2)->type
+ == CPP_CLOSE_PAREN))
+ {
+ /* Consume the `void' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* There are no parameters. */
+ return void_list_node;
+ }
+
+ /* Parse the parameter-declaration-list. */
+ parameters = cp_parser_parameter_declaration_list (parser);
+ /* If a parse error occurred while parsing the
+ parameter-declaration-list, then the entire
+ parameter-declaration-clause is erroneous. */
+ if (parameters == error_mark_node)
+ return error_mark_node;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's a `,', the clause should terminate with an ellipsis. */
+ if (token->type == CPP_COMMA)
+ {
+ /* Consume the `,'. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Expect an ellipsis. */
+ ellipsis_p
+ = (cp_parser_require (parser, CPP_ELLIPSIS, "`...'") != NULL);
+ }
+ /* It might also be `...' if the optional trailing `,' was
+ omitted. */
+ else if (token->type == CPP_ELLIPSIS)
+ {
+ /* Consume the `...' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* And remember that we saw it. */
+ ellipsis_p = true;
+ }
+ else
+ ellipsis_p = false;
+
+ /* Finish the parameter list. */
+ return finish_parmlist (parameters, ellipsis_p);
+}
+
+/* Parse a parameter-declaration-list.
+
+ parameter-declaration-list:
+ parameter-declaration
+ parameter-declaration-list , parameter-declaration
+
+ Returns a representation of the parameter-declaration-list, as for
+ cp_parser_parameter_declaration_clause. However, the
+ `void_list_node' is never appended to the list. */
+
+static tree
+cp_parser_parameter_declaration_list (cp_parser* parser)
+{
+ tree parameters = NULL_TREE;
+
+ /* Look for more parameters. */
+ while (true)
+ {
+ tree parameter;
+ bool parenthesized_p;
+ /* Parse the parameter. */
+ parameter
+ = cp_parser_parameter_declaration (parser,
+ /*template_parm_p=*/false,
+ &parenthesized_p);
+
+ /* If a parse error occurred parsing the parameter declaration,
+ then the entire parameter-declaration-list is erroneous. */
+ if (parameter == error_mark_node)
+ {
+ parameters = error_mark_node;
+ break;
+ }
+ /* Add the new parameter to the list. */
+ TREE_CHAIN (parameter) = parameters;
+ parameters = parameter;
+
+ /* Peek at the next token. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN)
+ || cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
+ /* The parameter-declaration-list is complete. */
+ break;
+ else if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ {
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_nth_token (parser->lexer, 2);
+ /* If it's an ellipsis, then the list is complete. */
+ if (token->type == CPP_ELLIPSIS)
+ break;
+ /* Otherwise, there must be more parameters. Consume the
+ `,'. */
+ cp_lexer_consume_token (parser->lexer);
+ /* When parsing something like:
+
+ int i(float f, double d)
+
+ we can tell after seeing the declaration for "f" that we
+ are not looking at an initialization of a variable "i",
+ but rather at the declaration of a function "i".
+
+ Due to the fact that the parsing of template arguments
+ (as specified to a template-id) requires backtracking we
+ cannot use this technique when inside a template argument
+ list. */
+ if (!parser->in_template_argument_list_p
+ && !parser->in_type_id_in_expr_p
+ && cp_parser_parsing_tentatively (parser)
+ && !cp_parser_committed_to_tentative_parse (parser)
+ /* However, a parameter-declaration of the form
+ "foat(f)" (which is a valid declaration of a
+ parameter "f") can also be interpreted as an
+ expression (the conversion of "f" to "float"). */
+ && !parenthesized_p)
+ cp_parser_commit_to_tentative_parse (parser);
+ }
+ else
+ {
+ cp_parser_error (parser, "expected `,' or `...'");
+ if (!cp_parser_parsing_tentatively (parser)
+ || cp_parser_committed_to_tentative_parse (parser))
+ cp_parser_skip_to_closing_parenthesis (parser,
+ /*recovering=*/true,
+ /*or_comma=*/false,
+ /*consume_paren=*/false);
+ break;
+ }
+ }
+
+ /* We built up the list in reverse order; straighten it out now. */
+ return nreverse (parameters);
+}
+
+/* Parse a parameter declaration.
+
+ parameter-declaration:
+ decl-specifier-seq declarator
+ decl-specifier-seq declarator = assignment-expression
+ decl-specifier-seq abstract-declarator [opt]
+ decl-specifier-seq abstract-declarator [opt] = assignment-expression
+
+ If TEMPLATE_PARM_P is TRUE, then this parameter-declaration
+ declares a template parameter. (In that case, a non-nested `>'
+ token encountered during the parsing of the assignment-expression
+ is not interpreted as a greater-than operator.)
+
+ Returns a TREE_LIST representing the parameter-declaration. The
+ TREE_PURPOSE is the default argument expression, or NULL_TREE if
+ there is no default argument. The TREE_VALUE is a representation
+ of the decl-specifier-seq and declarator. In particular, the
+ TREE_VALUE will be a TREE_LIST whose TREE_PURPOSE represents the
+ decl-specifier-seq and whose TREE_VALUE represents the declarator.
+ If PARENTHESIZED_P is non-NULL, *PARENTHESIZED_P is set to true iff
+ the declarator is of the form "(p)". */
+
+static tree
+cp_parser_parameter_declaration (cp_parser *parser,
+ bool template_parm_p,
+ bool *parenthesized_p)
+{
+ int declares_class_or_enum;
+ bool greater_than_is_operator_p;
+ tree decl_specifiers;
+ tree attributes;
+ tree declarator;
+ tree default_argument;
+ tree parameter;
+ cp_token *token;
+ const char *saved_message;
+
+ /* In a template parameter, `>' is not an operator.
+
+ [temp.param]
+
+ When parsing a default template-argument for a non-type
+ template-parameter, the first non-nested `>' is taken as the end
+ of the template parameter-list rather than a greater-than
+ operator. */
+ greater_than_is_operator_p = !template_parm_p;
+
+ /* Type definitions may not appear in parameter types. */
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = "types may not be defined in parameter types";
+
+ /* Parse the declaration-specifiers. */
+ decl_specifiers
+ = cp_parser_decl_specifier_seq (parser,
+ CP_PARSER_FLAGS_NONE,
+ &attributes,
+ &declares_class_or_enum);
+ /* If an error occurred, there's no reason to attempt to parse the
+ rest of the declaration. */
+ if (cp_parser_error_occurred (parser))
+ {
+ parser->type_definition_forbidden_message = saved_message;
+ return error_mark_node;
+ }
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If the next token is a `)', `,', `=', `>', or `...', then there
+ is no declarator. */
+ if (token->type == CPP_CLOSE_PAREN
+ || token->type == CPP_COMMA
+ || token->type == CPP_EQ
+ || token->type == CPP_ELLIPSIS
+ || token->type == CPP_GREATER)
+ {
+ declarator = NULL_TREE;
+ if (parenthesized_p)
+ *parenthesized_p = false;
+ }
+ /* Otherwise, there should be a declarator. */
+ else
+ {
+ bool saved_default_arg_ok_p = parser->default_arg_ok_p;
+ parser->default_arg_ok_p = false;
+
+ /* After seeing a decl-specifier-seq, if the next token is not a
+ "(", there is no possibility that the code is a valid
+ expression. Therefore, if parsing tentatively, we commit at
+ this point. */
+ if (!parser->in_template_argument_list_p
+ /* In an expression context, having seen:
+
+ (int((char ...
+
+ we cannot be sure whether we are looking at a
+ function-type (taking a "char" as a parameter) or a cast
+ of some object of type "char" to "int". */
+ && !parser->in_type_id_in_expr_p
+ && cp_parser_parsing_tentatively (parser)
+ && !cp_parser_committed_to_tentative_parse (parser)
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN))
+ cp_parser_commit_to_tentative_parse (parser);
+ /* Parse the declarator. */
+ declarator = cp_parser_declarator (parser,
+ CP_PARSER_DECLARATOR_EITHER,
+ /*ctor_dtor_or_conv_p=*/NULL,
+ parenthesized_p);
+ parser->default_arg_ok_p = saved_default_arg_ok_p;
+ /* After the declarator, allow more attributes. */
+ attributes = chainon (attributes, cp_parser_attributes_opt (parser));
+ }
+
+ /* The restriction on defining new types applies only to the type
+ of the parameter, not to the default argument. */
+ parser->type_definition_forbidden_message = saved_message;
+
+ /* If the next token is `=', then process a default argument. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_EQ))
+ {
+ bool saved_greater_than_is_operator_p;
+ /* Consume the `='. */
+ cp_lexer_consume_token (parser->lexer);
+
+ /* If we are defining a class, then the tokens that make up the
+ default argument must be saved and processed later. */
+ if (!template_parm_p && at_class_scope_p ()
+ && TYPE_BEING_DEFINED (current_class_type))
+ {
+ unsigned depth = 0;
+
+ /* Create a DEFAULT_ARG to represented the unparsed default
+ argument. */
+ default_argument = make_node (DEFAULT_ARG);
+ DEFARG_TOKENS (default_argument) = cp_token_cache_new ();
+
+ /* Add tokens until we have processed the entire default
+ argument. */
+ while (true)
+ {
+ bool done = false;
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* What we do depends on what token we have. */
+ switch (token->type)
+ {
+ /* In valid code, a default argument must be
+ immediately followed by a `,' `)', or `...'. */
+ case CPP_COMMA:
+ case CPP_CLOSE_PAREN:
+ case CPP_ELLIPSIS:
+ /* If we run into a non-nested `;', `}', or `]',
+ then the code is invalid -- but the default
+ argument is certainly over. */
+ case CPP_SEMICOLON:
+ case CPP_CLOSE_BRACE:
+ case CPP_CLOSE_SQUARE:
+ if (depth == 0)
+ done = true;
+ /* Update DEPTH, if necessary. */
+ else if (token->type == CPP_CLOSE_PAREN
+ || token->type == CPP_CLOSE_BRACE
+ || token->type == CPP_CLOSE_SQUARE)
+ --depth;
+ break;
+
+ case CPP_OPEN_PAREN:
+ case CPP_OPEN_SQUARE:
+ case CPP_OPEN_BRACE:
+ ++depth;
+ break;
+
+ case CPP_GREATER:
+ /* If we see a non-nested `>', and `>' is not an
+ operator, then it marks the end of the default
+ argument. */
+ if (!depth && !greater_than_is_operator_p)
+ done = true;
+ break;
+
+ /* If we run out of tokens, issue an error message. */
+ case CPP_EOF:
+ error ("file ends in default argument");
+ done = true;
+ break;
+
+ case CPP_NAME:
+ case CPP_SCOPE:
+ /* In these cases, we should look for template-ids.
+ For example, if the default argument is
+ `X<int, double>()', we need to do name lookup to
+ figure out whether or not `X' is a template; if
+ so, the `,' does not end the default argument.
+
+ That is not yet done. */
+ break;
+
+ default:
+ break;
+ }
+
+ /* If we've reached the end, stop. */
+ if (done)
+ break;
+
+ /* Add the token to the token block. */
+ token = cp_lexer_consume_token (parser->lexer);
+ cp_token_cache_push_token (DEFARG_TOKENS (default_argument),
+ token);
+ }
+ }
+ /* Outside of a class definition, we can just parse the
+ assignment-expression. */
+ else
+ {
+ bool saved_local_variables_forbidden_p;
+
+ /* Make sure that PARSER->GREATER_THAN_IS_OPERATOR_P is
+ set correctly. */
+ saved_greater_than_is_operator_p
+ = parser->greater_than_is_operator_p;
+ parser->greater_than_is_operator_p = greater_than_is_operator_p;
+ /* Local variable names (and the `this' keyword) may not
+ appear in a default argument. */
+ saved_local_variables_forbidden_p
+ = parser->local_variables_forbidden_p;
+ parser->local_variables_forbidden_p = true;
+ /* Parse the assignment-expression. */
+ default_argument = cp_parser_assignment_expression (parser);
+ /* Restore saved state. */
+ parser->greater_than_is_operator_p
+ = saved_greater_than_is_operator_p;
+ parser->local_variables_forbidden_p
+ = saved_local_variables_forbidden_p;
+ }
+ if (!parser->default_arg_ok_p)
+ {
+ if (!flag_pedantic_errors)
+ warning ("deprecated use of default argument for parameter of non-function");
+ else
+ {
+ error ("default arguments are only permitted for function parameters");
+ default_argument = NULL_TREE;
+ }
+ }
+ }
+ else
+ default_argument = NULL_TREE;
+
+ /* Create the representation of the parameter. */
+ if (attributes)
+ decl_specifiers = tree_cons (attributes, NULL_TREE, decl_specifiers);
+ parameter = build_tree_list (default_argument,
+ build_tree_list (decl_specifiers,
+ declarator));
+
+ return parameter;
+}
+
+/* Parse a function-body.
+
+ function-body:
+ compound_statement */
+
+static void
+cp_parser_function_body (cp_parser *parser)
+{
+ cp_parser_compound_statement (parser, false);
+}
+
+/* Parse a ctor-initializer-opt followed by a function-body. Return
+ true if a ctor-initializer was present. */
+
+static bool
+cp_parser_ctor_initializer_opt_and_function_body (cp_parser *parser)
+{
+ tree body;
+ bool ctor_initializer_p;
+
+ /* Begin the function body. */
+ body = begin_function_body ();
+ /* Parse the optional ctor-initializer. */
+ ctor_initializer_p = cp_parser_ctor_initializer_opt (parser);
+ /* Parse the function-body. */
+ cp_parser_function_body (parser);
+ /* Finish the function body. */
+ finish_function_body (body);
+
+ return ctor_initializer_p;
+}
+
+/* Parse an initializer.
+
+ initializer:
+ = initializer-clause
+ ( expression-list )
+
+ Returns a expression representing the initializer. If no
+ initializer is present, NULL_TREE is returned.
+
+ *IS_PARENTHESIZED_INIT is set to TRUE if the `( expression-list )'
+ production is used, and zero otherwise. *IS_PARENTHESIZED_INIT is
+ set to FALSE if there is no initializer present. If there is an
+ initializer, and it is not a constant-expression, *NON_CONSTANT_P
+ is set to true; otherwise it is set to false. */
+
+static tree
+cp_parser_initializer (cp_parser* parser, bool* is_parenthesized_init,
+ bool* non_constant_p)
+{
+ cp_token *token;
+ tree init;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ /* Let our caller know whether or not this initializer was
+ parenthesized. */
+ *is_parenthesized_init = (token->type == CPP_OPEN_PAREN);
+ /* Assume that the initializer is constant. */
+ *non_constant_p = false;
+
+ if (token->type == CPP_EQ)
+ {
+ /* Consume the `='. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the initializer-clause. */
+ init = cp_parser_initializer_clause (parser, non_constant_p);
+ }
+ else if (token->type == CPP_OPEN_PAREN)
+ init = cp_parser_parenthesized_expression_list (parser, false,
+ non_constant_p);
+ else
+ {
+ /* Anything else is an error. */
+ cp_parser_error (parser, "expected initializer");
+ init = error_mark_node;
+ }
+
+ return init;
+}
+
+/* Parse an initializer-clause.
+
+ initializer-clause:
+ assignment-expression
+ { initializer-list , [opt] }
+ { }
+
+ Returns an expression representing the initializer.
+
+ If the `assignment-expression' production is used the value
+ returned is simply a representation for the expression.
+
+ Otherwise, a CONSTRUCTOR is returned. The CONSTRUCTOR_ELTS will be
+ the elements of the initializer-list (or NULL_TREE, if the last
+ production is used). The TREE_TYPE for the CONSTRUCTOR will be
+ NULL_TREE. There is no way to detect whether or not the optional
+ trailing `,' was provided. NON_CONSTANT_P is as for
+ cp_parser_initializer. */
+
+static tree
+cp_parser_initializer_clause (cp_parser* parser, bool* non_constant_p)
+{
+ tree initializer;
+
+ /* If it is not a `{', then we are looking at an
+ assignment-expression. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
+ {
+ initializer
+ = cp_parser_constant_expression (parser,
+ /*allow_non_constant_p=*/true,
+ non_constant_p);
+ if (!*non_constant_p)
+ initializer = fold_non_dependent_expr (initializer);
+ }
+ else
+ {
+ /* Consume the `{' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Create a CONSTRUCTOR to represent the braced-initializer. */
+ initializer = make_node (CONSTRUCTOR);
+ /* Mark it with TREE_HAS_CONSTRUCTOR. This should not be
+ necessary, but check_initializer depends upon it, for
+ now. */
+ TREE_HAS_CONSTRUCTOR (initializer) = 1;
+ /* If it's not a `}', then there is a non-trivial initializer. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_BRACE))
+ {
+ /* Parse the initializer list. */
+ CONSTRUCTOR_ELTS (initializer)
+ = cp_parser_initializer_list (parser, non_constant_p);
+ /* A trailing `,' token is allowed. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ cp_lexer_consume_token (parser->lexer);
+ }
+ /* Now, there should be a trailing `}'. */
+ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
+ }
+
+ return initializer;
+}
+
+/* Parse an initializer-list.
+
+ initializer-list:
+ initializer-clause
+ initializer-list , initializer-clause
+
+ GNU Extension:
+
+ initializer-list:
+ identifier : initializer-clause
+ initializer-list, identifier : initializer-clause
+
+ Returns a TREE_LIST. The TREE_VALUE of each node is an expression
+ for the initializer. If the TREE_PURPOSE is non-NULL, it is the
+ IDENTIFIER_NODE naming the field to initialize. NON_CONSTANT_P is
+ as for cp_parser_initializer. */
+
+static tree
+cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p)
+{
+ tree initializers = NULL_TREE;
+
+ /* Assume all of the expressions are constant. */
+ *non_constant_p = false;
+
+ /* Parse the rest of the list. */
+ while (true)
+ {
+ cp_token *token;
+ tree identifier;
+ tree initializer;
+ bool clause_non_constant_p;
+
+ /* If the next token is an identifier and the following one is a
+ colon, we are looking at the GNU designated-initializer
+ syntax. */
+ if (cp_parser_allow_gnu_extensions_p (parser)
+ && cp_lexer_next_token_is (parser->lexer, CPP_NAME)
+ && cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_COLON)
+ {
+ /* Consume the identifier. */
+ identifier = cp_lexer_consume_token (parser->lexer)->value;
+ /* Consume the `:'. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+ else
+ identifier = NULL_TREE;
+
+ /* Parse the initializer. */
+ initializer = cp_parser_initializer_clause (parser,
+ &clause_non_constant_p);
+ /* If any clause is non-constant, so is the entire initializer. */
+ if (clause_non_constant_p)
+ *non_constant_p = true;
+ /* Add it to the list. */
+ initializers = tree_cons (identifier, initializer, initializers);
+
+ /* If the next token is not a comma, we have reached the end of
+ the list. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA))
+ break;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_nth_token (parser->lexer, 2);
+ /* If the next token is a `}', then we're still done. An
+ initializer-clause can have a trailing `,' after the
+ initializer-list and before the closing `}'. */
+ if (token->type == CPP_CLOSE_BRACE)
+ break;
+
+ /* Consume the `,' token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ /* The initializers were built up in reverse order, so we need to
+ reverse them now. */
+ return nreverse (initializers);
+}
+
+/* Classes [gram.class] */
+
+/* Parse a class-name.
+
+ class-name:
+ identifier
+ template-id
+
+ TYPENAME_KEYWORD_P is true iff the `typename' keyword has been used
+ to indicate that names looked up in dependent types should be
+ assumed to be types. TEMPLATE_KEYWORD_P is true iff the `template'
+ keyword has been used to indicate that the name that appears next
+ is a template. TYPE_P is true iff the next name should be treated
+ as class-name, even if it is declared to be some other kind of name
+ as well. If CHECK_DEPENDENCY_P is FALSE, names are looked up in
+ dependent scopes. If CLASS_HEAD_P is TRUE, this class is the class
+ being defined in a class-head.
+
+ Returns the TYPE_DECL representing the class. */
+
+static tree
+cp_parser_class_name (cp_parser *parser,
+ bool typename_keyword_p,
+ bool template_keyword_p,
+ bool type_p,
+ bool check_dependency_p,
+ bool class_head_p,
+ bool is_declaration)
+{
+ tree decl;
+ tree scope;
+ bool typename_p;
+ cp_token *token;
+
+ /* All class-names start with an identifier. */
+ token = cp_lexer_peek_token (parser->lexer);
+ if (token->type != CPP_NAME && token->type != CPP_TEMPLATE_ID)
+ {
+ cp_parser_error (parser, "expected class-name");
+ return error_mark_node;
+ }
+
+ /* PARSER->SCOPE can be cleared when parsing the template-arguments
+ to a template-id, so we save it here. */
+ scope = parser->scope;
+ if (scope == error_mark_node)
+ return error_mark_node;
+
+ /* Any name names a type if we're following the `typename' keyword
+ in a qualified name where the enclosing scope is type-dependent. */
+ typename_p = (typename_keyword_p && scope && TYPE_P (scope)
+ && dependent_type_p (scope));
+ /* Handle the common case (an identifier, but not a template-id)
+ efficiently. */
+ if (token->type == CPP_NAME
+ && !cp_parser_nth_token_starts_template_argument_list_p (parser, 2))
+ {
+ tree identifier;
+
+ /* Look for the identifier. */
+ identifier = cp_parser_identifier (parser);
+ /* If the next token isn't an identifier, we are certainly not
+ looking at a class-name. */
+ if (identifier == error_mark_node)
+ decl = error_mark_node;
+ /* If we know this is a type-name, there's no need to look it
+ up. */
+ else if (typename_p)
+ decl = identifier;
+ else
+ {
+ /* If the next token is a `::', then the name must be a type
+ name.
+
+ [basic.lookup.qual]
+
+ During the lookup for a name preceding the :: scope
+ resolution operator, object, function, and enumerator
+ names are ignored. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_SCOPE))
+ type_p = true;
+ /* Look up the name. */
+ decl = cp_parser_lookup_name (parser, identifier,
+ type_p,
+ /*is_template=*/false,
+ /*is_namespace=*/false,
+ check_dependency_p);
+ }
+ }
+ else
+ {
+ /* Try a template-id. */
+ decl = cp_parser_template_id (parser, template_keyword_p,
+ check_dependency_p,
+ is_declaration);
+ if (decl == error_mark_node)
+ return error_mark_node;
+ }
+
+ decl = cp_parser_maybe_treat_template_as_class (decl, class_head_p);
+
+ /* If this is a typename, create a TYPENAME_TYPE. */
+ if (typename_p && decl != error_mark_node)
+ {
+ decl = make_typename_type (scope, decl, /*complain=*/1);
+ if (decl != error_mark_node)
+ decl = TYPE_NAME (decl);
+ }
+
+ /* Check to see that it is really the name of a class. */
+ if (TREE_CODE (decl) == TEMPLATE_ID_EXPR
+ && TREE_CODE (TREE_OPERAND (decl, 0)) == IDENTIFIER_NODE
+ && cp_lexer_next_token_is (parser->lexer, CPP_SCOPE))
+ /* Situations like this:
+
+ template <typename T> struct A {
+ typename T::template X<int>::I i;
+ };
+
+ are problematic. Is `T::template X<int>' a class-name? The
+ standard does not seem to be definitive, but there is no other
+ valid interpretation of the following `::'. Therefore, those
+ names are considered class-names. */
+ decl = TYPE_NAME (make_typename_type (scope, decl, tf_error));
+ else if (decl == error_mark_node
+ || TREE_CODE (decl) != TYPE_DECL
+ || !IS_AGGR_TYPE (TREE_TYPE (decl)))
+ {
+ cp_parser_error (parser, "expected class-name");
+ return error_mark_node;
+ }
+
+ return decl;
+}
+
+/* Parse a class-specifier.
+
+ class-specifier:
+ class-head { member-specification [opt] }
+
+ Returns the TREE_TYPE representing the class. */
+
+static tree
+cp_parser_class_specifier (cp_parser* parser)
+{
+ cp_token *token;
+ tree type;
+ tree attributes;
+ int has_trailing_semicolon;
+ bool nested_name_specifier_p;
+ unsigned saved_num_template_parameter_lists;
+ bool pop_p = false;
+
+ push_deferring_access_checks (dk_no_deferred);
+
+ /* Parse the class-head. */
+ type = cp_parser_class_head (parser,
+ &nested_name_specifier_p,
+ &attributes);
+ /* If the class-head was a semantic disaster, skip the entire body
+ of the class. */
+ if (!type)
+ {
+ cp_parser_skip_to_end_of_block_or_statement (parser);
+ pop_deferring_access_checks ();
+ return error_mark_node;
+ }
+
+ /* Look for the `{'. */
+ if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'"))
+ {
+ pop_deferring_access_checks ();
+ return error_mark_node;
+ }
+
+ /* Issue an error message if type-definitions are forbidden here. */
+ cp_parser_check_type_definition (parser);
+ /* Remember that we are defining one more class. */
+ ++parser->num_classes_being_defined;
+ /* Inside the class, surrounding template-parameter-lists do not
+ apply. */
+ saved_num_template_parameter_lists
+ = parser->num_template_parameter_lists;
+ parser->num_template_parameter_lists = 0;
+
+ /* Start the class. */
+ if (nested_name_specifier_p)
+ pop_p = push_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (type)));
+ type = begin_class_definition (type);
+ if (type == error_mark_node)
+ /* If the type is erroneous, skip the entire body of the class. */
+ cp_parser_skip_to_closing_brace (parser);
+ else
+ /* Parse the member-specification. */
+ cp_parser_member_specification_opt (parser);
+ /* Look for the trailing `}'. */
+ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
+ /* We get better error messages by noticing a common problem: a
+ missing trailing `;'. */
+ token = cp_lexer_peek_token (parser->lexer);
+ has_trailing_semicolon = (token->type == CPP_SEMICOLON);
+ /* Look for trailing attributes to apply to this class. */
+ if (cp_parser_allow_gnu_extensions_p (parser))
+ {
+ tree sub_attr = cp_parser_attributes_opt (parser);
+ attributes = chainon (attributes, sub_attr);
+ }
+ if (type != error_mark_node)
+ type = finish_struct (type, attributes);
+ if (pop_p)
+ pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (type)));
+ /* If this class is not itself within the scope of another class,
+ then we need to parse the bodies of all of the queued function
+ definitions. Note that the queued functions defined in a class
+ are not always processed immediately following the
+ class-specifier for that class. Consider:
+
+ struct A {
+ struct B { void f() { sizeof (A); } };
+ };
+
+ If `f' were processed before the processing of `A' were
+ completed, there would be no way to compute the size of `A'.
+ Note that the nesting we are interested in here is lexical --
+ not the semantic nesting given by TYPE_CONTEXT. In particular,
+ for:
+
+ struct A { struct B; };
+ struct A::B { void f() { } };
+
+ there is no need to delay the parsing of `A::B::f'. */
+ if (--parser->num_classes_being_defined == 0)
+ {
+ tree queue_entry;
+ tree fn;
+
+ /* In a first pass, parse default arguments to the functions.
+ Then, in a second pass, parse the bodies of the functions.
+ This two-phased approach handles cases like:
+
+ struct S {
+ void f() { g(); }
+ void g(int i = 3);
+ };
+
+ */
+ for (TREE_PURPOSE (parser->unparsed_functions_queues)
+ = nreverse (TREE_PURPOSE (parser->unparsed_functions_queues));
+ (queue_entry = TREE_PURPOSE (parser->unparsed_functions_queues));
+ TREE_PURPOSE (parser->unparsed_functions_queues)
+ = TREE_CHAIN (TREE_PURPOSE (parser->unparsed_functions_queues)))
+ {
+ fn = TREE_VALUE (queue_entry);
+ /* Make sure that any template parameters are in scope. */
+ maybe_begin_member_template_processing (fn);
+ /* If there are default arguments that have not yet been processed,
+ take care of them now. */
+ cp_parser_late_parsing_default_args (parser, fn);
+ /* Remove any template parameters from the symbol table. */
+ maybe_end_member_template_processing ();
+ }
+ /* Now parse the body of the functions. */
+ for (TREE_VALUE (parser->unparsed_functions_queues)
+ = nreverse (TREE_VALUE (parser->unparsed_functions_queues));
+ (queue_entry = TREE_VALUE (parser->unparsed_functions_queues));
+ TREE_VALUE (parser->unparsed_functions_queues)
+ = TREE_CHAIN (TREE_VALUE (parser->unparsed_functions_queues)))
+ {
+ /* Figure out which function we need to process. */
+ fn = TREE_VALUE (queue_entry);
+
+ /* A hack to prevent garbage collection. */
+ function_depth++;
+
+ /* Parse the function. */
+ cp_parser_late_parsing_for_member (parser, fn);
+ function_depth--;
+ }
+
+ }
+
+ /* Put back any saved access checks. */
+ pop_deferring_access_checks ();
+
+ /* Restore the count of active template-parameter-lists. */
+ parser->num_template_parameter_lists
+ = saved_num_template_parameter_lists;
+
+ return type;
+}
+
+/* Parse a class-head.
+
+ class-head:
+ class-key identifier [opt] base-clause [opt]
+ class-key nested-name-specifier identifier base-clause [opt]
+ class-key nested-name-specifier [opt] template-id
+ base-clause [opt]
+
+ GNU Extensions:
+ class-key attributes identifier [opt] base-clause [opt]
+ class-key attributes nested-name-specifier identifier base-clause [opt]
+ class-key attributes nested-name-specifier [opt] template-id
+ base-clause [opt]
+
+ Returns the TYPE of the indicated class. Sets
+ *NESTED_NAME_SPECIFIER_P to TRUE iff one of the productions
+ involving a nested-name-specifier was used, and FALSE otherwise.
+
+ Returns NULL_TREE if the class-head is syntactically valid, but
+ semantically invalid in a way that means we should skip the entire
+ body of the class. */
+
+static tree
+cp_parser_class_head (cp_parser* parser,
+ bool* nested_name_specifier_p,
+ tree *attributes_p)
+{
+ cp_token *token;
+ tree nested_name_specifier;
+ enum tag_types class_key;
+ tree id = NULL_TREE;
+ tree type = NULL_TREE;
+ tree attributes;
+ bool template_id_p = false;
+ bool qualified_p = false;
+ bool invalid_nested_name_p = false;
+ bool invalid_explicit_specialization_p = false;
+ bool pop_p = false;
+ unsigned num_templates;
+
+ /* Assume no nested-name-specifier will be present. */
+ *nested_name_specifier_p = false;
+ /* Assume no template parameter lists will be used in defining the
+ type. */
+ num_templates = 0;
+
+ /* Look for the class-key. */
+ class_key = cp_parser_class_key (parser);
+ if (class_key == none_type)
+ return error_mark_node;
+
+ /* Parse the attributes. */
+ attributes = cp_parser_attributes_opt (parser);
+
+ /* If the next token is `::', that is invalid -- but sometimes
+ people do try to write:
+
+ struct ::S {};
+
+ Handle this gracefully by accepting the extra qualifier, and then
+ issuing an error about it later if this really is a
+ class-head. If it turns out just to be an elaborated type
+ specifier, remain silent. */
+ if (cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/false))
+ qualified_p = true;
+
+ push_deferring_access_checks (dk_no_check);
+
+ /* Determine the name of the class. Begin by looking for an
+ optional nested-name-specifier. */
+ nested_name_specifier
+ = cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/false,
+ /*check_dependency_p=*/false,
+ /*type_p=*/false,
+ /*is_declaration=*/false);
+ /* If there was a nested-name-specifier, then there *must* be an
+ identifier. */
+ if (nested_name_specifier)
+ {
+ /* Although the grammar says `identifier', it really means
+ `class-name' or `template-name'. You are only allowed to
+ define a class that has already been declared with this
+ syntax.
+
+ The proposed resolution for Core Issue 180 says that whever
+ you see `class T::X' you should treat `X' as a type-name.
+
+ It is OK to define an inaccessible class; for example:
+
+ class A { class B; };
+ class A::B {};
+
+ We do not know if we will see a class-name, or a
+ template-name. We look for a class-name first, in case the
+ class-name is a template-id; if we looked for the
+ template-name first we would stop after the template-name. */
+ cp_parser_parse_tentatively (parser);
+ type = cp_parser_class_name (parser,
+ /*typename_keyword_p=*/false,
+ /*template_keyword_p=*/false,
+ /*type_p=*/true,
+ /*check_dependency_p=*/false,
+ /*class_head_p=*/true,
+ /*is_declaration=*/false);
+ /* If that didn't work, ignore the nested-name-specifier. */
+ if (!cp_parser_parse_definitely (parser))
+ {
+ invalid_nested_name_p = true;
+ id = cp_parser_identifier (parser);
+ if (id == error_mark_node)
+ id = NULL_TREE;
+ }
+ /* If we could not find a corresponding TYPE, treat this
+ declaration like an unqualified declaration. */
+ if (type == error_mark_node)
+ nested_name_specifier = NULL_TREE;
+ /* Otherwise, count the number of templates used in TYPE and its
+ containing scopes. */
+ else
+ {
+ tree scope;
+
+ for (scope = TREE_TYPE (type);
+ scope && TREE_CODE (scope) != NAMESPACE_DECL;
+ scope = (TYPE_P (scope)
+ ? TYPE_CONTEXT (scope)
+ : DECL_CONTEXT (scope)))
+ if (TYPE_P (scope)
+ && CLASS_TYPE_P (scope)
+ && CLASSTYPE_TEMPLATE_INFO (scope)
+ && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (scope))
+ && !CLASSTYPE_TEMPLATE_SPECIALIZATION (scope))
+ ++num_templates;
+ }
+ }
+ /* Otherwise, the identifier is optional. */
+ else
+ {
+ /* We don't know whether what comes next is a template-id,
+ an identifier, or nothing at all. */
+ cp_parser_parse_tentatively (parser);
+ /* Check for a template-id. */
+ id = cp_parser_template_id (parser,
+ /*template_keyword_p=*/false,
+ /*check_dependency_p=*/true,
+ /*is_declaration=*/true);
+ /* If that didn't work, it could still be an identifier. */
+ if (!cp_parser_parse_definitely (parser))
+ {
+ if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
+ id = cp_parser_identifier (parser);
+ else
+ id = NULL_TREE;
+ }
+ else
+ {
+ template_id_p = true;
+ ++num_templates;
+ }
+ }
+
+ pop_deferring_access_checks ();
+
+ if (id)
+ cp_parser_check_for_invalid_template_id (parser, id);
+
+ /* If it's not a `:' or a `{' then we can't really be looking at a
+ class-head, since a class-head only appears as part of a
+ class-specifier. We have to detect this situation before calling
+ xref_tag, since that has irreversible side-effects. */
+ if (!cp_parser_next_token_starts_class_definition_p (parser))
+ {
+ cp_parser_error (parser, "expected `{' or `:'");
+ return error_mark_node;
+ }
+
+ /* At this point, we're going ahead with the class-specifier, even
+ if some other problem occurs. */
+ cp_parser_commit_to_tentative_parse (parser);
+ /* Issue the error about the overly-qualified name now. */
+ if (qualified_p)
+ cp_parser_error (parser,
+ "global qualification of class name is invalid");
+ else if (invalid_nested_name_p)
+ cp_parser_error (parser,
+ "qualified name does not name a class");
+ else if (nested_name_specifier)
+ {
+ tree scope;
+ /* Figure out in what scope the declaration is being placed. */
+ scope = current_scope ();
+ if (!scope)
+ scope = current_namespace;
+ /* If that scope does not contain the scope in which the
+ class was originally declared, the program is invalid. */
+ if (scope && !is_ancestor (scope, nested_name_specifier))
+ {
+ error ("declaration of `%D' in `%D' which does not "
+ "enclose `%D'", type, scope, nested_name_specifier);
+ type = NULL_TREE;
+ goto done;
+ }
+ /* [dcl.meaning]
+
+ A declarator-id shall not be qualified exception of the
+ definition of a ... nested class outside of its class
+ ... [or] a the definition or explicit instantiation of a
+ class member of a namespace outside of its namespace. */
+ if (scope == nested_name_specifier)
+ {
+ pedwarn ("extra qualification ignored");
+ nested_name_specifier = NULL_TREE;
+ num_templates = 0;
+ }
+ }
+ /* An explicit-specialization must be preceded by "template <>". If
+ it is not, try to recover gracefully. */
+ if (at_namespace_scope_p ()
+ && parser->num_template_parameter_lists == 0
+ && template_id_p)
+ {
+ error ("an explicit specialization must be preceded by 'template <>'");
+ invalid_explicit_specialization_p = true;
+ /* Take the same action that would have been taken by
+ cp_parser_explicit_specialization. */
+ ++parser->num_template_parameter_lists;
+ begin_specialization ();
+ }
+ /* There must be no "return" statements between this point and the
+ end of this function; set "type "to the correct return value and
+ use "goto done;" to return. */
+ /* Make sure that the right number of template parameters were
+ present. */
+ if (!cp_parser_check_template_parameters (parser, num_templates))
+ {
+ /* If something went wrong, there is no point in even trying to
+ process the class-definition. */
+ type = NULL_TREE;
+ goto done;
+ }
+
+ /* Look up the type. */
+ if (template_id_p)
+ {
+ type = TREE_TYPE (id);
+ maybe_process_partial_specialization (type);
+ }
+ else if (!nested_name_specifier)
+ {
+ /* If the class was unnamed, create a dummy name. */
+ if (!id)
+ id = make_anon_name ();
+ type = xref_tag (class_key, id, /*globalize=*/false,
+ parser->num_template_parameter_lists);
+ }
+ else
+ {
+ tree class_type;
+ bool pop_p = false;
+
+ /* Given:
+
+ template <typename T> struct S { struct T };
+ template <typename T> struct S<T>::T { };
+
+ we will get a TYPENAME_TYPE when processing the definition of
+ `S::T'. We need to resolve it to the actual type before we
+ try to define it. */
+ if (TREE_CODE (TREE_TYPE (type)) == TYPENAME_TYPE)
+ {
+ class_type = resolve_typename_type (TREE_TYPE (type),
+ /*only_current_p=*/false);
+ if (class_type != error_mark_node)
+ type = TYPE_NAME (class_type);
+ else
+ {
+ cp_parser_error (parser, "could not resolve typename type");
+ type = error_mark_node;
+ }
+ }
+
+ maybe_process_partial_specialization (TREE_TYPE (type));
+ class_type = current_class_type;
+ /* Enter the scope indicated by the nested-name-specifier. */
+ if (nested_name_specifier)
+ pop_p = push_scope (nested_name_specifier);
+ /* Get the canonical version of this type. */
+ type = TYPE_MAIN_DECL (TREE_TYPE (type));
+ if (PROCESSING_REAL_TEMPLATE_DECL_P ()
+ && !CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (type)))
+ type = push_template_decl (type);
+ type = TREE_TYPE (type);
+ if (nested_name_specifier)
+ {
+ *nested_name_specifier_p = true;
+ if (pop_p)
+ pop_scope (nested_name_specifier);
+ }
+ }
+ /* Indicate whether this class was declared as a `class' or as a
+ `struct'. */
+ if (TREE_CODE (type) == RECORD_TYPE)
+ CLASSTYPE_DECLARED_CLASS (type) = (class_key == class_type);
+ cp_parser_check_class_key (class_key, type);
+
+ /* Enter the scope containing the class; the names of base classes
+ should be looked up in that context. For example, given:
+
+ struct A { struct B {}; struct C; };
+ struct A::C : B {};
+
+ is valid. */
+ if (nested_name_specifier)
+ pop_p = push_scope (nested_name_specifier);
+ /* Now, look for the base-clause. */
+ token = cp_lexer_peek_token (parser->lexer);
+ if (token->type == CPP_COLON)
+ {
+ tree bases;
+
+ /* Get the list of base-classes. */
+ bases = cp_parser_base_clause (parser);
+ /* Process them. */
+ xref_basetypes (type, bases);
+ }
+ /* Leave the scope given by the nested-name-specifier. We will
+ enter the class scope itself while processing the members. */
+ if (pop_p)
+ pop_scope (nested_name_specifier);
+
+ done:
+ if (invalid_explicit_specialization_p)
+ {
+ end_specialization ();
+ --parser->num_template_parameter_lists;
+ }
+ *attributes_p = attributes;
+ return type;
+}
+
+/* Parse a class-key.
+
+ class-key:
+ class
+ struct
+ union
+
+ Returns the kind of class-key specified, or none_type to indicate
+ error. */
+
+static enum tag_types
+cp_parser_class_key (cp_parser* parser)
+{
+ cp_token *token;
+ enum tag_types tag_type;
+
+ /* Look for the class-key. */
+ token = cp_parser_require (parser, CPP_KEYWORD, "class-key");
+ if (!token)
+ return none_type;
+
+ /* Check to see if the TOKEN is a class-key. */
+ tag_type = cp_parser_token_is_class_key (token);
+ if (!tag_type)
+ cp_parser_error (parser, "expected class-key");
+ return tag_type;
+}
+
+/* Parse an (optional) member-specification.
+
+ member-specification:
+ member-declaration member-specification [opt]
+ access-specifier : member-specification [opt] */
+
+static void
+cp_parser_member_specification_opt (cp_parser* parser)
+{
+ while (true)
+ {
+ cp_token *token;
+ enum rid keyword;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's a `}', or EOF then we've seen all the members. */
+ if (token->type == CPP_CLOSE_BRACE || token->type == CPP_EOF)
+ break;
+
+ /* See if this token is a keyword. */
+ keyword = token->keyword;
+ switch (keyword)
+ {
+ case RID_PUBLIC:
+ case RID_PROTECTED:
+ case RID_PRIVATE:
+ /* Consume the access-specifier. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Remember which access-specifier is active. */
+ current_access_specifier = token->value;
+ /* Look for the `:'. */
+ cp_parser_require (parser, CPP_COLON, "`:'");
+ break;
+
+ default:
+ /* Otherwise, the next construction must be a
+ member-declaration. */
+ cp_parser_member_declaration (parser);
+ }
+ }
+}
+
+/* Parse a member-declaration.
+
+ member-declaration:
+ decl-specifier-seq [opt] member-declarator-list [opt] ;
+ function-definition ; [opt]
+ :: [opt] nested-name-specifier template [opt] unqualified-id ;
+ using-declaration
+ template-declaration
+
+ member-declarator-list:
+ member-declarator
+ member-declarator-list , member-declarator
+
+ member-declarator:
+ declarator pure-specifier [opt]
+ declarator constant-initializer [opt]
+ identifier [opt] : constant-expression
+
+ GNU Extensions:
+
+ member-declaration:
+ __extension__ member-declaration
+
+ member-declarator:
+ declarator attributes [opt] pure-specifier [opt]
+ declarator attributes [opt] constant-initializer [opt]
+ identifier [opt] attributes [opt] : constant-expression */
+
+static void
+cp_parser_member_declaration (cp_parser* parser)
+{
+ tree decl_specifiers;
+ tree prefix_attributes;
+ tree decl;
+ int declares_class_or_enum;
+ bool friend_p;
+ cp_token *token;
+ int saved_pedantic;
+
+ /* Check for the `__extension__' keyword. */
+ if (cp_parser_extension_opt (parser, &saved_pedantic))
+ {
+ /* Recurse. */
+ cp_parser_member_declaration (parser);
+ /* Restore the old value of the PEDANTIC flag. */
+ pedantic = saved_pedantic;
+
+ return;
+ }
+
+ /* Check for a template-declaration. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TEMPLATE))
+ {
+ /* Parse the template-declaration. */
+ cp_parser_template_declaration (parser, /*member_p=*/true);
+
+ return;
+ }
+
+ /* Check for a using-declaration. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_USING))
+ {
+ /* Parse the using-declaration. */
+ cp_parser_using_declaration (parser);
+
+ return;
+ }
+
+ /* Parse the decl-specifier-seq. */
+ decl_specifiers
+ = cp_parser_decl_specifier_seq (parser,
+ CP_PARSER_FLAGS_OPTIONAL,
+ &prefix_attributes,
+ &declares_class_or_enum);
+ /* Check for an invalid type-name. */
+ if (cp_parser_diagnose_invalid_type_name (parser))
+ return;
+ /* If there is no declarator, then the decl-specifier-seq should
+ specify a type. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
+ {
+ /* If there was no decl-specifier-seq, and the next token is a
+ `;', then we have something like:
+
+ struct S { ; };
+
+ [class.mem]
+
+ Each member-declaration shall declare at least one member
+ name of the class. */
+ if (!decl_specifiers)
+ {
+ if (pedantic)
+ pedwarn ("extra semicolon");
+ }
+ else
+ {
+ tree type;
+
+ /* See if this declaration is a friend. */
+ friend_p = cp_parser_friend_p (decl_specifiers);
+ /* If there were decl-specifiers, check to see if there was
+ a class-declaration. */
+ type = check_tag_decl (decl_specifiers);
+ /* Nested classes have already been added to the class, but
+ a `friend' needs to be explicitly registered. */
+ if (friend_p)
+ {
+ /* If the `friend' keyword was present, the friend must
+ be introduced with a class-key. */
+ if (!declares_class_or_enum)
+ error ("a class-key must be used when declaring a friend");
+ /* In this case:
+
+ template <typename T> struct A {
+ friend struct A<T>::B;
+ };
+
+ A<T>::B will be represented by a TYPENAME_TYPE, and
+ therefore not recognized by check_tag_decl. */
+ if (!type)
+ {
+ tree specifier;
+
+ for (specifier = decl_specifiers;
+ specifier;
+ specifier = TREE_CHAIN (specifier))
+ {
+ tree s = TREE_VALUE (specifier);
+
+ if (TREE_CODE (s) == IDENTIFIER_NODE)
+ get_global_value_if_present (s, &type);
+ if (TREE_CODE (s) == TYPE_DECL)
+ s = TREE_TYPE (s);
+ if (TYPE_P (s))
+ {
+ type = s;
+ break;
+ }
+ }
+ }
+ if (!type || !TYPE_P (type))
+ error ("friend declaration does not name a class or "
+ "function");
+ else
+ make_friend_class (current_class_type, type,
+ /*complain=*/true);
+ }
+ /* If there is no TYPE, an error message will already have
+ been issued. */
+ else if (!type)
+ ;
+ /* An anonymous aggregate has to be handled specially; such
+ a declaration really declares a data member (with a
+ particular type), as opposed to a nested class. */
+ else if (ANON_AGGR_TYPE_P (type))
+ {
+ /* Remove constructors and such from TYPE, now that we
+ know it is an anonymous aggregate. */
+ fixup_anonymous_aggr (type);
+ /* And make the corresponding data member. */
+ decl = build_decl (FIELD_DECL, NULL_TREE, type);
+ /* Add it to the class. */
+ finish_member_declaration (decl);
+ }
+ else
+ cp_parser_check_access_in_redeclaration (TYPE_NAME (type));
+ }
+ }
+ else
+ {
+ /* See if these declarations will be friends. */
+ friend_p = cp_parser_friend_p (decl_specifiers);
+
+ /* Keep going until we hit the `;' at the end of the
+ declaration. */
+ while (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
+ {
+ tree attributes = NULL_TREE;
+ tree first_attribute;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+
+ /* Check for a bitfield declaration. */
+ if (token->type == CPP_COLON
+ || (token->type == CPP_NAME
+ && cp_lexer_peek_nth_token (parser->lexer, 2)->type
+ == CPP_COLON))
+ {
+ tree identifier;
+ tree width;
+
+ /* Get the name of the bitfield. Note that we cannot just
+ check TOKEN here because it may have been invalidated by
+ the call to cp_lexer_peek_nth_token above. */
+ if (cp_lexer_peek_token (parser->lexer)->type != CPP_COLON)
+ identifier = cp_parser_identifier (parser);
+ else
+ identifier = NULL_TREE;
+
+ /* Consume the `:' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Get the width of the bitfield. */
+ width
+ = cp_parser_constant_expression (parser,
+ /*allow_non_constant=*/false,
+ NULL);
+
+ /* Look for attributes that apply to the bitfield. */
+ attributes = cp_parser_attributes_opt (parser);
+ /* Remember which attributes are prefix attributes and
+ which are not. */
+ first_attribute = attributes;
+ /* Combine the attributes. */
+ attributes = chainon (prefix_attributes, attributes);
+
+ /* Create the bitfield declaration. */
+ decl = grokbitfield (identifier,
+ decl_specifiers,
+ width);
+ /* Apply the attributes. */
+ cplus_decl_attributes (&decl, attributes, /*flags=*/0);
+ }
+ else
+ {
+ tree declarator;
+ tree initializer;
+ tree asm_specification;
+ int ctor_dtor_or_conv_p;
+
+ /* Parse the declarator. */
+ declarator
+ = cp_parser_declarator (parser, CP_PARSER_DECLARATOR_NAMED,
+ &ctor_dtor_or_conv_p,
+ /*parenthesized_p=*/NULL);
+
+ /* If something went wrong parsing the declarator, make sure
+ that we at least consume some tokens. */
+ if (declarator == error_mark_node)
+ {
+ /* Skip to the end of the statement. */
+ cp_parser_skip_to_end_of_statement (parser);
+ /* If the next token is not a semicolon, that is
+ probably because we just skipped over the body of
+ a function. So, we consume a semicolon if
+ present, but do not issue an error message if it
+ is not present. */
+ if (cp_lexer_next_token_is (parser->lexer,
+ CPP_SEMICOLON))
+ cp_lexer_consume_token (parser->lexer);
+ return;
+ }
+
+ cp_parser_check_for_definition_in_return_type
+ (declarator, declares_class_or_enum);
+
+ /* Look for an asm-specification. */
+ asm_specification = cp_parser_asm_specification_opt (parser);
+ /* Look for attributes that apply to the declaration. */
+ attributes = cp_parser_attributes_opt (parser);
+ /* Remember which attributes are prefix attributes and
+ which are not. */
+ first_attribute = attributes;
+ /* Combine the attributes. */
+ attributes = chainon (prefix_attributes, attributes);
+
+ /* If it's an `=', then we have a constant-initializer or a
+ pure-specifier. It is not correct to parse the
+ initializer before registering the member declaration
+ since the member declaration should be in scope while
+ its initializer is processed. However, the rest of the
+ front end does not yet provide an interface that allows
+ us to handle this correctly. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_EQ))
+ {
+ /* In [class.mem]:
+
+ A pure-specifier shall be used only in the declaration of
+ a virtual function.
+
+ A member-declarator can contain a constant-initializer
+ only if it declares a static member of integral or
+ enumeration type.
+
+ Therefore, if the DECLARATOR is for a function, we look
+ for a pure-specifier; otherwise, we look for a
+ constant-initializer. When we call `grokfield', it will
+ perform more stringent semantics checks. */
+ if (TREE_CODE (declarator) == CALL_EXPR)
+ initializer = cp_parser_pure_specifier (parser);
+ else
+ /* Parse the initializer. */
+ initializer = cp_parser_constant_initializer (parser);
+ }
+ /* Otherwise, there is no initializer. */
+ else
+ initializer = NULL_TREE;
+
+ /* See if we are probably looking at a function
+ definition. We are certainly not looking at at a
+ member-declarator. Calling `grokfield' has
+ side-effects, so we must not do it unless we are sure
+ that we are looking at a member-declarator. */
+ if (cp_parser_token_starts_function_definition_p
+ (cp_lexer_peek_token (parser->lexer)))
+ {
+ /* The grammar does not allow a pure-specifier to be
+ used when a member function is defined. (It is
+ possible that this fact is an oversight in the
+ standard, since a pure function may be defined
+ outside of the class-specifier. */
+ if (initializer)
+ error ("pure-specifier on function-definition");
+ decl = cp_parser_save_member_function_body (parser,
+ decl_specifiers,
+ declarator,
+ attributes);
+ /* If the member was not a friend, declare it here. */
+ if (!friend_p)
+ finish_member_declaration (decl);
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If the next token is a semicolon, consume it. */
+ if (token->type == CPP_SEMICOLON)
+ cp_lexer_consume_token (parser->lexer);
+ return;
+ }
+ else
+ {
+ /* Create the declaration. */
+ decl = grokfield (declarator, decl_specifiers,
+ initializer, asm_specification,
+ attributes);
+ /* Any initialization must have been from a
+ constant-expression. */
+ if (decl && TREE_CODE (decl) == VAR_DECL && initializer)
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = 1;
+ }
+ }
+
+ /* Reset PREFIX_ATTRIBUTES. */
+ while (attributes && TREE_CHAIN (attributes) != first_attribute)
+ attributes = TREE_CHAIN (attributes);
+ if (attributes)
+ TREE_CHAIN (attributes) = NULL_TREE;
+
+ /* If there is any qualification still in effect, clear it
+ now; we will be starting fresh with the next declarator. */
+ parser->scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ parser->object_scope = NULL_TREE;
+ /* If it's a `,', then there are more declarators. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ cp_lexer_consume_token (parser->lexer);
+ /* If the next token isn't a `;', then we have a parse error. */
+ else if (cp_lexer_next_token_is_not (parser->lexer,
+ CPP_SEMICOLON))
+ {
+ cp_parser_error (parser, "expected `;'");
+ /* Skip tokens until we find a `;'. */
+ cp_parser_skip_to_end_of_statement (parser);
+
+ break;
+ }
+
+ if (decl)
+ {
+ /* Add DECL to the list of members. */
+ if (!friend_p)
+ finish_member_declaration (decl);
+
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ cp_parser_save_default_args (parser, decl);
+ }
+ }
+ }
+
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+}
+
+/* Parse a pure-specifier.
+
+ pure-specifier:
+ = 0
+
+ Returns INTEGER_ZERO_NODE if a pure specifier is found.
+ Otherwise, ERROR_MARK_NODE is returned. */
+
+static tree
+cp_parser_pure_specifier (cp_parser* parser)
+{
+ cp_token *token;
+
+ /* Look for the `=' token. */
+ if (!cp_parser_require (parser, CPP_EQ, "`='"))
+ return error_mark_node;
+ /* Look for the `0' token. */
+ token = cp_parser_require (parser, CPP_NUMBER, "`0'");
+ /* Unfortunately, this will accept `0L' and `0x00' as well. We need
+ to get information from the lexer about how the number was
+ spelled in order to fix this problem. */
+ if (!token || !integer_zerop (token->value))
+ return error_mark_node;
+
+ return integer_zero_node;
+}
+
+/* Parse a constant-initializer.
+
+ constant-initializer:
+ = constant-expression
+
+ Returns a representation of the constant-expression. */
+
+static tree
+cp_parser_constant_initializer (cp_parser* parser)
+{
+ /* Look for the `=' token. */
+ if (!cp_parser_require (parser, CPP_EQ, "`='"))
+ return error_mark_node;
+
+ /* It is invalid to write:
+
+ struct S { static const int i = { 7 }; };
+
+ */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ cp_parser_error (parser,
+ "a brace-enclosed initializer is not allowed here");
+ /* Consume the opening brace. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Skip the initializer. */
+ cp_parser_skip_to_closing_brace (parser);
+ /* Look for the trailing `}'. */
+ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
+
+ return error_mark_node;
+ }
+
+ return cp_parser_constant_expression (parser,
+ /*allow_non_constant=*/false,
+ NULL);
+}
+
+/* Derived classes [gram.class.derived] */
+
+/* Parse a base-clause.
+
+ base-clause:
+ : base-specifier-list
+
+ base-specifier-list:
+ base-specifier
+ base-specifier-list , base-specifier
+
+ Returns a TREE_LIST representing the base-classes, in the order in
+ which they were declared. The representation of each node is as
+ described by cp_parser_base_specifier.
+
+ In the case that no bases are specified, this function will return
+ NULL_TREE, not ERROR_MARK_NODE. */
+
+static tree
+cp_parser_base_clause (cp_parser* parser)
+{
+ tree bases = NULL_TREE;
+
+ /* Look for the `:' that begins the list. */
+ cp_parser_require (parser, CPP_COLON, "`:'");
+
+ /* Scan the base-specifier-list. */
+ while (true)
+ {
+ cp_token *token;
+ tree base;
+
+ /* Look for the base-specifier. */
+ base = cp_parser_base_specifier (parser);
+ /* Add BASE to the front of the list. */
+ if (base != error_mark_node)
+ {
+ TREE_CHAIN (base) = bases;
+ bases = base;
+ }
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's not a comma, then the list is complete. */
+ if (token->type != CPP_COMMA)
+ break;
+ /* Consume the `,'. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ /* PARSER->SCOPE may still be non-NULL at this point, if the last
+ base class had a qualified name. However, the next name that
+ appears is certainly not qualified. */
+ parser->scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ parser->object_scope = NULL_TREE;
+
+ return nreverse (bases);
+}
+
+/* Parse a base-specifier.
+
+ base-specifier:
+ :: [opt] nested-name-specifier [opt] class-name
+ virtual access-specifier [opt] :: [opt] nested-name-specifier
+ [opt] class-name
+ access-specifier virtual [opt] :: [opt] nested-name-specifier
+ [opt] class-name
+
+ Returns a TREE_LIST. The TREE_PURPOSE will be one of
+ ACCESS_{DEFAULT,PUBLIC,PROTECTED,PRIVATE}_[VIRTUAL]_NODE to
+ indicate the specifiers provided. The TREE_VALUE will be a TYPE
+ (or the ERROR_MARK_NODE) indicating the type that was specified. */
+
+static tree
+cp_parser_base_specifier (cp_parser* parser)
+{
+ cp_token *token;
+ bool done = false;
+ bool virtual_p = false;
+ bool duplicate_virtual_error_issued_p = false;
+ bool duplicate_access_error_issued_p = false;
+ bool class_scope_p, template_p;
+ tree access = access_default_node;
+ tree type;
+
+ /* Process the optional `virtual' and `access-specifier'. */
+ while (!done)
+ {
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* Process `virtual'. */
+ switch (token->keyword)
+ {
+ case RID_VIRTUAL:
+ /* If `virtual' appears more than once, issue an error. */
+ if (virtual_p && !duplicate_virtual_error_issued_p)
+ {
+ cp_parser_error (parser,
+ "`virtual' specified more than once in base-specified");
+ duplicate_virtual_error_issued_p = true;
+ }
+
+ virtual_p = true;
+
+ /* Consume the `virtual' token. */
+ cp_lexer_consume_token (parser->lexer);
+
+ break;
+
+ case RID_PUBLIC:
+ case RID_PROTECTED:
+ case RID_PRIVATE:
+ /* If more than one access specifier appears, issue an
+ error. */
+ if (access != access_default_node
+ && !duplicate_access_error_issued_p)
+ {
+ cp_parser_error (parser,
+ "more than one access specifier in base-specified");
+ duplicate_access_error_issued_p = true;
+ }
+
+ access = ridpointers[(int) token->keyword];
+
+ /* Consume the access-specifier. */
+ cp_lexer_consume_token (parser->lexer);
+
+ break;
+
+ default:
+ done = true;
+ break;
+ }
+ }
+ /* It is not uncommon to see programs mechanically, errouneously, use
+ the 'typename' keyword to denote (dependent) qualified types
+ as base classes. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
+ {
+ if (!processing_template_decl)
+ error ("keyword `typename' not allowed outside of templates");
+ else
+ error ("keyword `typename' not allowed in this context "
+ "(the base class is implicitly a type)");
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ /* Look for the optional `::' operator. */
+ cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/false);
+ /* Look for the nested-name-specifier. The simplest way to
+ implement:
+
+ [temp.res]
+
+ The keyword `typename' is not permitted in a base-specifier or
+ mem-initializer; in these contexts a qualified name that
+ depends on a template-parameter is implicitly assumed to be a
+ type name.
+
+ is to pretend that we have seen the `typename' keyword at this
+ point. */
+ cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/true,
+ /*check_dependency_p=*/true,
+ /*type_p=*/true,
+ /*is_declaration=*/true);
+ /* If the base class is given by a qualified name, assume that names
+ we see are type names or templates, as appropriate. */
+ class_scope_p = (parser->scope && TYPE_P (parser->scope));
+ template_p = class_scope_p && cp_parser_optional_template_keyword (parser);
+
+ /* Finally, look for the class-name. */
+ type = cp_parser_class_name (parser,
+ class_scope_p,
+ template_p,
+ /*type_p=*/true,
+ /*check_dependency_p=*/true,
+ /*class_head_p=*/false,
+ /*is_declaration=*/true);
+
+ if (type == error_mark_node)
+ return error_mark_node;
+
+ return finish_base_specifier (TREE_TYPE (type), access, virtual_p);
+}
+
+/* Exception handling [gram.exception] */
+
+/* Parse an (optional) exception-specification.
+
+ exception-specification:
+ throw ( type-id-list [opt] )
+
+ Returns a TREE_LIST representing the exception-specification. The
+ TREE_VALUE of each node is a type. */
+
+static tree
+cp_parser_exception_specification_opt (cp_parser* parser)
+{
+ cp_token *token;
+ tree type_id_list;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's not `throw', then there's no exception-specification. */
+ if (!cp_parser_is_keyword (token, RID_THROW))
+ return NULL_TREE;
+
+ /* Consume the `throw'. */
+ cp_lexer_consume_token (parser->lexer);
+
+ /* Look for the `('. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's not a `)', then there is a type-id-list. */
+ if (token->type != CPP_CLOSE_PAREN)
+ {
+ const char *saved_message;
+
+ /* Types may not be defined in an exception-specification. */
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = "types may not be defined in an exception-specification";
+ /* Parse the type-id-list. */
+ type_id_list = cp_parser_type_id_list (parser);
+ /* Restore the saved message. */
+ parser->type_definition_forbidden_message = saved_message;
+ }
+ else
+ type_id_list = empty_except_spec;
+
+ /* Look for the `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+
+ return type_id_list;
+}
+
+/* Parse an (optional) type-id-list.
+
+ type-id-list:
+ type-id
+ type-id-list , type-id
+
+ Returns a TREE_LIST. The TREE_VALUE of each node is a TYPE,
+ in the order that the types were presented. */
+
+static tree
+cp_parser_type_id_list (cp_parser* parser)
+{
+ tree types = NULL_TREE;
+
+ while (true)
+ {
+ cp_token *token;
+ tree type;
+
+ /* Get the next type-id. */
+ type = cp_parser_type_id (parser);
+ /* Add it to the list. */
+ types = add_exception_specifier (types, type, /*complain=*/1);
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it is not a `,', we are done. */
+ if (token->type != CPP_COMMA)
+ break;
+ /* Consume the `,'. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ return nreverse (types);
+}
+
+/* Parse a try-block.
+
+ try-block:
+ try compound-statement handler-seq */
+
+static tree
+cp_parser_try_block (cp_parser* parser)
+{
+ tree try_block;
+
+ cp_parser_require_keyword (parser, RID_TRY, "`try'");
+ try_block = begin_try_block ();
+ cp_parser_compound_statement (parser, false);
+ finish_try_block (try_block);
+ cp_parser_handler_seq (parser);
+ finish_handler_sequence (try_block);
+
+ return try_block;
+}
+
+/* Parse a function-try-block.
+
+ function-try-block:
+ try ctor-initializer [opt] function-body handler-seq */
+
+static bool
+cp_parser_function_try_block (cp_parser* parser)
+{
+ tree try_block;
+ bool ctor_initializer_p;
+
+ /* Look for the `try' keyword. */
+ if (!cp_parser_require_keyword (parser, RID_TRY, "`try'"))
+ return false;
+ /* Let the rest of the front-end know where we are. */
+ try_block = begin_function_try_block ();
+ /* Parse the function-body. */
+ ctor_initializer_p
+ = cp_parser_ctor_initializer_opt_and_function_body (parser);
+ /* We're done with the `try' part. */
+ finish_function_try_block (try_block);
+ /* Parse the handlers. */
+ cp_parser_handler_seq (parser);
+ /* We're done with the handlers. */
+ finish_function_handler_sequence (try_block);
+
+ return ctor_initializer_p;
+}
+
+/* Parse a handler-seq.
+
+ handler-seq:
+ handler handler-seq [opt] */
+
+static void
+cp_parser_handler_seq (cp_parser* parser)
+{
+ while (true)
+ {
+ cp_token *token;
+
+ /* Parse the handler. */
+ cp_parser_handler (parser);
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's not `catch' then there are no more handlers. */
+ if (!cp_parser_is_keyword (token, RID_CATCH))
+ break;
+ }
+}
+
+/* Parse a handler.
+
+ handler:
+ catch ( exception-declaration ) compound-statement */
+
+static void
+cp_parser_handler (cp_parser* parser)
+{
+ tree handler;
+ tree declaration;
+
+ cp_parser_require_keyword (parser, RID_CATCH, "`catch'");
+ handler = begin_handler ();
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ declaration = cp_parser_exception_declaration (parser);
+ finish_handler_parms (declaration, handler);
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ cp_parser_compound_statement (parser, false);
+ finish_handler (handler);
+}
+
+/* Parse an exception-declaration.
+
+ exception-declaration:
+ type-specifier-seq declarator
+ type-specifier-seq abstract-declarator
+ type-specifier-seq
+ ...
+
+ Returns a VAR_DECL for the declaration, or NULL_TREE if the
+ ellipsis variant is used. */
+
+static tree
+cp_parser_exception_declaration (cp_parser* parser)
+{
+ tree type_specifiers;
+ tree declarator;
+ const char *saved_message;
+
+ /* If it's an ellipsis, it's easy to handle. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
+ {
+ /* Consume the `...' token. */
+ cp_lexer_consume_token (parser->lexer);
+ return NULL_TREE;
+ }
+
+ /* Types may not be defined in exception-declarations. */
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = "types may not be defined in exception-declarations";
+
+ /* Parse the type-specifier-seq. */
+ type_specifiers = cp_parser_type_specifier_seq (parser);
+ /* If it's a `)', then there is no declarator. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN))
+ declarator = NULL_TREE;
+ else
+ declarator = cp_parser_declarator (parser, CP_PARSER_DECLARATOR_EITHER,
+ /*ctor_dtor_or_conv_p=*/NULL,
+ /*parenthesized_p=*/NULL);
+
+ /* Restore the saved message. */
+ parser->type_definition_forbidden_message = saved_message;
+
+ return start_handler_parms (type_specifiers, declarator);
+}
+
+/* Parse a throw-expression.
+
+ throw-expression:
+ throw assignment-expression [opt]
+
+ Returns a THROW_EXPR representing the throw-expression. */
+
+static tree
+cp_parser_throw_expression (cp_parser* parser)
+{
+ tree expression;
+ cp_token* token;
+
+ cp_parser_require_keyword (parser, RID_THROW, "`throw'");
+ token = cp_lexer_peek_token (parser->lexer);
+ /* Figure out whether or not there is an assignment-expression
+ following the "throw" keyword. */
+ if (token->type == CPP_COMMA
+ || token->type == CPP_SEMICOLON
+ || token->type == CPP_CLOSE_PAREN
+ || token->type == CPP_CLOSE_SQUARE
+ || token->type == CPP_CLOSE_BRACE
+ || token->type == CPP_COLON)
+ expression = NULL_TREE;
+ else
+ expression = cp_parser_assignment_expression (parser);
+
+ return build_throw (expression);
+}
+
+/* GNU Extensions */
+
+/* Parse an (optional) asm-specification.
+
+ asm-specification:
+ asm ( string-literal )
+
+ If the asm-specification is present, returns a STRING_CST
+ corresponding to the string-literal. Otherwise, returns
+ NULL_TREE. */
+
+static tree
+cp_parser_asm_specification_opt (cp_parser* parser)
+{
+ cp_token *token;
+ tree asm_specification;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If the next token isn't the `asm' keyword, then there's no
+ asm-specification. */
+ if (!cp_parser_is_keyword (token, RID_ASM))
+ return NULL_TREE;
+
+ /* Consume the `asm' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the `('. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+
+ /* Look for the string-literal. */
+ token = cp_parser_require (parser, CPP_STRING, "string-literal");
+ if (token)
+ asm_specification = token->value;
+ else
+ asm_specification = NULL_TREE;
+
+ /* Look for the `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`('");
+
+ return asm_specification;
+}
+
+/* Parse an asm-operand-list.
+
+ asm-operand-list:
+ asm-operand
+ asm-operand-list , asm-operand
+
+ asm-operand:
+ string-literal ( expression )
+ [ string-literal ] string-literal ( expression )
+
+ Returns a TREE_LIST representing the operands. The TREE_VALUE of
+ each node is the expression. The TREE_PURPOSE is itself a
+ TREE_LIST whose TREE_PURPOSE is a STRING_CST for the bracketed
+ string-literal (or NULL_TREE if not present) and whose TREE_VALUE
+ is a STRING_CST for the string literal before the parenthesis. */
+
+static tree
+cp_parser_asm_operand_list (cp_parser* parser)
+{
+ tree asm_operands = NULL_TREE;
+
+ while (true)
+ {
+ tree string_literal;
+ tree expression;
+ tree name;
+ cp_token *token;
+
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
+ {
+ /* Consume the `[' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Read the operand name. */
+ name = cp_parser_identifier (parser);
+ if (name != error_mark_node)
+ name = build_string (IDENTIFIER_LENGTH (name),
+ IDENTIFIER_POINTER (name));
+ /* Look for the closing `]'. */
+ cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'");
+ }
+ else
+ name = NULL_TREE;
+ /* Look for the string-literal. */
+ token = cp_parser_require (parser, CPP_STRING, "string-literal");
+ string_literal = token ? token->value : error_mark_node;
+ /* Look for the `('. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ /* Parse the expression. */
+ expression = cp_parser_expression (parser);
+ /* Look for the `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ /* Add this operand to the list. */
+ asm_operands = tree_cons (build_tree_list (name, string_literal),
+ expression,
+ asm_operands);
+ /* If the next token is not a `,', there are no more
+ operands. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA))
+ break;
+ /* Consume the `,'. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ return nreverse (asm_operands);
+}
+
+/* Parse an asm-clobber-list.
+
+ asm-clobber-list:
+ string-literal
+ asm-clobber-list , string-literal
+
+ Returns a TREE_LIST, indicating the clobbers in the order that they
+ appeared. The TREE_VALUE of each node is a STRING_CST. */
+
+static tree
+cp_parser_asm_clobber_list (cp_parser* parser)
+{
+ tree clobbers = NULL_TREE;
+
+ while (true)
+ {
+ cp_token *token;
+ tree string_literal;
+
+ /* Look for the string literal. */
+ token = cp_parser_require (parser, CPP_STRING, "string-literal");
+ string_literal = token ? token->value : error_mark_node;
+ /* Add it to the list. */
+ clobbers = tree_cons (NULL_TREE, string_literal, clobbers);
+ /* If the next token is not a `,', then the list is
+ complete. */
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA))
+ break;
+ /* Consume the `,' token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ return clobbers;
+}
+
+/* Parse an (optional) series of attributes.
+
+ attributes:
+ attributes attribute
+
+ attribute:
+ __attribute__ (( attribute-list [opt] ))
+
+ The return value is as for cp_parser_attribute_list. */
+
+static tree
+cp_parser_attributes_opt (cp_parser* parser)
+{
+ tree attributes = NULL_TREE;
+
+ while (true)
+ {
+ cp_token *token;
+ tree attribute_list;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's not `__attribute__', then we're done. */
+ if (token->keyword != RID_ATTRIBUTE)
+ break;
+
+ /* Consume the `__attribute__' keyword. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the two `(' tokens. */
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+ cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ if (token->type != CPP_CLOSE_PAREN)
+ /* Parse the attribute-list. */
+ attribute_list = cp_parser_attribute_list (parser);
+ else
+ /* If the next token is a `)', then there is no attribute
+ list. */
+ attribute_list = NULL;
+
+ /* Look for the two `)' tokens. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+
+ /* Add these new attributes to the list. */
+ attributes = chainon (attributes, attribute_list);
+ }
+
+ return attributes;
+}
+
+/* Parse an attribute-list.
+
+ attribute-list:
+ attribute
+ attribute-list , attribute
+
+ attribute:
+ identifier
+ identifier ( identifier )
+ identifier ( identifier , expression-list )
+ identifier ( expression-list )
+
+ Returns a TREE_LIST. Each node corresponds to an attribute. THe
+ TREE_PURPOSE of each node is the identifier indicating which
+ attribute is in use. The TREE_VALUE represents the arguments, if
+ any. */
+
+static tree
+cp_parser_attribute_list (cp_parser* parser)
+{
+ tree attribute_list = NULL_TREE;
+
+ while (true)
+ {
+ cp_token *token;
+ tree identifier;
+ tree attribute;
+
+ /* Look for the identifier. We also allow keywords here; for
+ example `__attribute__ ((const))' is legal. */
+ token = cp_lexer_peek_token (parser->lexer);
+ if (token->type != CPP_NAME
+ && token->type != CPP_KEYWORD)
+ return error_mark_node;
+ /* Consume the token. */
+ token = cp_lexer_consume_token (parser->lexer);
+
+ /* Save away the identifier that indicates which attribute this is. */
+ identifier = token->value;
+ attribute = build_tree_list (identifier, NULL_TREE);
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If it's an `(', then parse the attribute arguments. */
+ if (token->type == CPP_OPEN_PAREN)
+ {
+ tree arguments;
+
+ arguments = (cp_parser_parenthesized_expression_list
+ (parser, true, /*non_constant_p=*/NULL));
+ /* Save the identifier and arguments away. */
+ TREE_VALUE (attribute) = arguments;
+ }
+
+ /* Add this attribute to the list. */
+ TREE_CHAIN (attribute) = attribute_list;
+ attribute_list = attribute;
+
+ /* Now, look for more attributes. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If the next token isn't a `,', we're done. */
+ if (token->type != CPP_COMMA)
+ break;
+
+ /* Consume the comma and keep going. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+
+ /* We built up the list in reverse order. */
+ return nreverse (attribute_list);
+}
+
+/* Parse an optional `__extension__' keyword. Returns TRUE if it is
+ present, and FALSE otherwise. *SAVED_PEDANTIC is set to the
+ current value of the PEDANTIC flag, regardless of whether or not
+ the `__extension__' keyword is present. The caller is responsible
+ for restoring the value of the PEDANTIC flag. */
+
+static bool
+cp_parser_extension_opt (cp_parser* parser, int* saved_pedantic)
+{
+ /* Save the old value of the PEDANTIC flag. */
+ *saved_pedantic = pedantic;
+
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_EXTENSION))
+ {
+ /* Consume the `__extension__' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* We're not being pedantic while the `__extension__' keyword is
+ in effect. */
+ pedantic = 0;
+
+ return true;
+ }
+
+ return false;
+}
+
+/* Parse a label declaration.
+
+ label-declaration:
+ __label__ label-declarator-seq ;
+
+ label-declarator-seq:
+ identifier , label-declarator-seq
+ identifier */
+
+static void
+cp_parser_label_declaration (cp_parser* parser)
+{
+ /* Look for the `__label__' keyword. */
+ cp_parser_require_keyword (parser, RID_LABEL, "`__label__'");
+
+ while (true)
+ {
+ tree identifier;
+
+ /* Look for an identifier. */
+ identifier = cp_parser_identifier (parser);
+ /* Declare it as a lobel. */
+ finish_label_decl (identifier);
+ /* If the next token is a `;', stop. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
+ break;
+ /* Look for the `,' separating the label declarations. */
+ cp_parser_require (parser, CPP_COMMA, "`,'");
+ }
+
+ /* Look for the final `;'. */
+ cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+}
+
+/* Support Functions */
+
+/* Looks up NAME in the current scope, as given by PARSER->SCOPE.
+ NAME should have one of the representations used for an
+ id-expression. If NAME is the ERROR_MARK_NODE, the ERROR_MARK_NODE
+ is returned. If PARSER->SCOPE is a dependent type, then a
+ SCOPE_REF is returned.
+
+ If NAME is a TEMPLATE_ID_EXPR, then it will be immediately
+ returned; the name was already resolved when the TEMPLATE_ID_EXPR
+ was formed. Abstractly, such entities should not be passed to this
+ function, because they do not need to be looked up, but it is
+ simpler to check for this special case here, rather than at the
+ call-sites.
+
+ In cases not explicitly covered above, this function returns a
+ DECL, OVERLOAD, or baselink representing the result of the lookup.
+ If there was no entity with the indicated NAME, the ERROR_MARK_NODE
+ is returned.
+
+ If IS_TYPE is TRUE, bindings that do not refer to types are
+ ignored.
+
+ If IS_TEMPLATE is TRUE, bindings that do not refer to templates are
+ ignored.
+
+ If IS_NAMESPACE is TRUE, bindings that do not refer to namespaces
+ are ignored.
+
+ If CHECK_DEPENDENCY is TRUE, names are not looked up in dependent
+ types. */
+
+static tree
+cp_parser_lookup_name (cp_parser *parser, tree name,
+ bool is_type, bool is_template, bool is_namespace,
+ bool check_dependency)
+{
+ tree decl;
+ tree object_type = parser->context->object_type;
+
+ /* Now that we have looked up the name, the OBJECT_TYPE (if any) is
+ no longer valid. Note that if we are parsing tentatively, and
+ the parse fails, OBJECT_TYPE will be automatically restored. */
+ parser->context->object_type = NULL_TREE;
+
+ if (name == error_mark_node)
+ return error_mark_node;
+
+ /* A template-id has already been resolved; there is no lookup to
+ do. */
+ if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
+ return name;
+ if (BASELINK_P (name))
+ {
+ my_friendly_assert ((TREE_CODE (BASELINK_FUNCTIONS (name))
+ == TEMPLATE_ID_EXPR),
+ 20020909);
+ return name;
+ }
+
+ /* A BIT_NOT_EXPR is used to represent a destructor. By this point,
+ it should already have been checked to make sure that the name
+ used matches the type being destroyed. */
+ if (TREE_CODE (name) == BIT_NOT_EXPR)
+ {
+ tree type;
+
+ /* Figure out to which type this destructor applies. */
+ if (parser->scope)
+ type = parser->scope;
+ else if (object_type)
+ type = object_type;
+ else
+ type = current_class_type;
+ /* If that's not a class type, there is no destructor. */
+ if (!type || !CLASS_TYPE_P (type))
+ return error_mark_node;
+ if (!CLASSTYPE_DESTRUCTORS (type))
+ return error_mark_node;
+ /* If it was a class type, return the destructor. */
+ return CLASSTYPE_DESTRUCTORS (type);
+ }
+
+ /* By this point, the NAME should be an ordinary identifier. If
+ the id-expression was a qualified name, the qualifying scope is
+ stored in PARSER->SCOPE at this point. */
+ my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE,
+ 20000619);
+
+ /* Perform the lookup. */
+ if (parser->scope)
+ {
+ bool dependent_p;
+
+ if (parser->scope == error_mark_node)
+ return error_mark_node;
+
+ /* If the SCOPE is dependent, the lookup must be deferred until
+ the template is instantiated -- unless we are explicitly
+ looking up names in uninstantiated templates. Even then, we
+ cannot look up the name if the scope is not a class type; it
+ might, for example, be a template type parameter. */
+ dependent_p = (TYPE_P (parser->scope)
+ && !(parser->in_declarator_p
+ && currently_open_class (parser->scope))
+ && dependent_type_p (parser->scope));
+ if ((check_dependency || !CLASS_TYPE_P (parser->scope))
+ && dependent_p)
+ {
+ if (is_type)
+ /* The resolution to Core Issue 180 says that `struct A::B'
+ should be considered a type-name, even if `A' is
+ dependent. */
+ decl = TYPE_NAME (make_typename_type (parser->scope,
+ name,
+ /*complain=*/1));
+ else if (is_template)
+ decl = make_unbound_class_template (parser->scope,
+ name,
+ /*complain=*/1);
+ else
+ decl = build_nt (SCOPE_REF, parser->scope, name);
+ }
+ else
+ {
+ bool pop_p = false;
+
+ /* If PARSER->SCOPE is a dependent type, then it must be a
+ class type, and we must not be checking dependencies;
+ otherwise, we would have processed this lookup above. So
+ that PARSER->SCOPE is not considered a dependent base by
+ lookup_member, we must enter the scope here. */
+ if (dependent_p)
+ pop_p = push_scope (parser->scope);
+ /* If the PARSER->SCOPE is a a template specialization, it
+ may be instantiated during name lookup. In that case,
+ errors may be issued. Even if we rollback the current
+ tentative parse, those errors are valid. */
+ decl = lookup_qualified_name (parser->scope, name, is_type,
+ /*complain=*/true);
+ if (pop_p)
+ pop_scope (parser->scope);
+ }
+ parser->qualifying_scope = parser->scope;
+ parser->object_scope = NULL_TREE;
+ }
+ else if (object_type)
+ {
+ tree object_decl = NULL_TREE;
+ /* Look up the name in the scope of the OBJECT_TYPE, unless the
+ OBJECT_TYPE is not a class. */
+ if (CLASS_TYPE_P (object_type))
+ /* If the OBJECT_TYPE is a template specialization, it may
+ be instantiated during name lookup. In that case, errors
+ may be issued. Even if we rollback the current tentative
+ parse, those errors are valid. */
+ object_decl = lookup_member (object_type,
+ name,
+ /*protect=*/0, is_type);
+ /* Look it up in the enclosing context, too. */
+ decl = lookup_name_real (name, is_type, /*nonclass=*/0,
+ is_namespace,
+ /*flags=*/0);
+ parser->object_scope = object_type;
+ parser->qualifying_scope = NULL_TREE;
+ if (object_decl)
+ decl = object_decl;
+ }
+ else
+ {
+ decl = lookup_name_real (name, is_type, /*nonclass=*/0,
+ is_namespace,
+ /*flags=*/0);
+ parser->qualifying_scope = NULL_TREE;
+ parser->object_scope = NULL_TREE;
+ }
+
+ /* If the lookup failed, let our caller know. */
+ if (!decl
+ || decl == error_mark_node
+ || (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_ANTICIPATED (decl)))
+ return error_mark_node;
+
+ /* If it's a TREE_LIST, the result of the lookup was ambiguous. */
+ if (TREE_CODE (decl) == TREE_LIST)
+ {
+ /* The error message we have to print is too complicated for
+ cp_parser_error, so we incorporate its actions directly. */
+ if (!cp_parser_simulate_error (parser))
+ {
+ error ("reference to `%D' is ambiguous", name);
+ print_candidates (decl);
+ }
+ return error_mark_node;
+ }
+
+ my_friendly_assert (DECL_P (decl)
+ || TREE_CODE (decl) == OVERLOAD
+ || TREE_CODE (decl) == SCOPE_REF
+ || TREE_CODE (decl) == UNBOUND_CLASS_TEMPLATE
+ || BASELINK_P (decl),
+ 20000619);
+
+ /* If we have resolved the name of a member declaration, check to
+ see if the declaration is accessible. When the name resolves to
+ set of overloaded functions, accessibility is checked when
+ overload resolution is done.
+
+ During an explicit instantiation, access is not checked at all,
+ as per [temp.explicit]. */
+ if (DECL_P (decl))
+ check_accessibility_of_qualified_id (decl, object_type, parser->scope);
+
+ return decl;
+}
+
+/* Like cp_parser_lookup_name, but for use in the typical case where
+ CHECK_ACCESS is TRUE, IS_TYPE is FALSE, IS_TEMPLATE is FALSE,
+ IS_NAMESPACE is FALSE, and CHECK_DEPENDENCY is TRUE. */
+
+static tree
+cp_parser_lookup_name_simple (cp_parser* parser, tree name)
+{
+ return cp_parser_lookup_name (parser, name,
+ /*is_type=*/false,
+ /*is_template=*/false,
+ /*is_namespace=*/false,
+ /*check_dependency=*/true);
+}
+
+/* If DECL is a TEMPLATE_DECL that can be treated like a TYPE_DECL in
+ the current context, return the TYPE_DECL. If TAG_NAME_P is
+ true, the DECL indicates the class being defined in a class-head,
+ or declared in an elaborated-type-specifier.
+
+ Otherwise, return DECL. */
+
+static tree
+cp_parser_maybe_treat_template_as_class (tree decl, bool tag_name_p)
+{
+ /* If the TEMPLATE_DECL is being declared as part of a class-head,
+ the translation from TEMPLATE_DECL to TYPE_DECL occurs:
+
+ struct A {
+ template <typename T> struct B;
+ };
+
+ template <typename T> struct A::B {};
+
+ Similarly, in a elaborated-type-specifier:
+
+ namespace N { struct X{}; }
+
+ struct A {
+ template <typename T> friend struct N::X;
+ };
+
+ However, if the DECL refers to a class type, and we are in
+ the scope of the class, then the name lookup automatically
+ finds the TYPE_DECL created by build_self_reference rather
+ than a TEMPLATE_DECL. For example, in:
+
+ template <class T> struct S {
+ S s;
+ };
+
+ there is no need to handle such case. */
+
+ if (DECL_CLASS_TEMPLATE_P (decl) && tag_name_p)
+ return DECL_TEMPLATE_RESULT (decl);
+
+ return decl;
+}
+
+/* If too many, or too few, template-parameter lists apply to the
+ declarator, issue an error message. Returns TRUE if all went well,
+ and FALSE otherwise. */
+
+static bool
+cp_parser_check_declarator_template_parameters (cp_parser* parser,
+ tree declarator)
+{
+ unsigned num_templates;
+
+ /* We haven't seen any classes that involve template parameters yet. */
+ num_templates = 0;
+
+ switch (TREE_CODE (declarator))
+ {
+ case CALL_EXPR:
+ case ARRAY_REF:
+ case INDIRECT_REF:
+ case ADDR_EXPR:
+ {
+ tree main_declarator = TREE_OPERAND (declarator, 0);
+ return
+ cp_parser_check_declarator_template_parameters (parser,
+ main_declarator);
+ }
+
+ case SCOPE_REF:
+ {
+ tree scope;
+ tree member;
+
+ scope = TREE_OPERAND (declarator, 0);
+ member = TREE_OPERAND (declarator, 1);
+
+ /* If this is a pointer-to-member, then we are not interested
+ in the SCOPE, because it does not qualify the thing that is
+ being declared. */
+ if (TREE_CODE (member) == INDIRECT_REF)
+ return (cp_parser_check_declarator_template_parameters
+ (parser, member));
+
+ while (scope && CLASS_TYPE_P (scope))
+ {
+ /* 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 (scope)
+ && (CLASSTYPE_TEMPLATE_INSTANTIATION (scope)
+ || uses_template_parms (CLASSTYPE_TI_ARGS (scope)))
+ && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (scope)))
+ ++num_templates;
+
+ scope = TYPE_CONTEXT (scope);
+ }
+ }
+
+ /* Fall through. */
+
+ default:
+ /* If the DECLARATOR has the form `X<y>' then it uses one
+ additional level of template parameters. */
+ if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
+ ++num_templates;
+
+ return cp_parser_check_template_parameters (parser,
+ num_templates);
+ }
+}
+
+/* NUM_TEMPLATES were used in the current declaration. If that is
+ invalid, return FALSE and issue an error messages. Otherwise,
+ return TRUE. */
+
+static bool
+cp_parser_check_template_parameters (cp_parser* parser,
+ unsigned num_templates)
+{
+ /* If there are more template classes than parameter lists, we have
+ something like:
+
+ template <class T> void S<T>::R<T>::f (); */
+ if (parser->num_template_parameter_lists < num_templates)
+ {
+ error ("too few template-parameter-lists");
+ return false;
+ }
+ /* If there are the same number of template classes and parameter
+ lists, that's OK. */
+ if (parser->num_template_parameter_lists == num_templates)
+ return true;
+ /* If there are more, but only one more, then we are referring to a
+ member template. That's OK too. */
+ if (parser->num_template_parameter_lists == num_templates + 1)
+ return true;
+ /* Otherwise, there are too many template parameter lists. We have
+ something like:
+
+ template <class T> template <class U> void S::f(); */
+ error ("too many template-parameter-lists");
+ return false;
+}
+
+/* Parse a binary-expression of the general form:
+
+ binary-expression:
+ <expr>
+ binary-expression <token> <expr>
+
+ The TOKEN_TREE_MAP maps <token> types to <expr> codes. FN is used
+ to parser the <expr>s. If the first production is used, then the
+ value returned by FN is returned directly. Otherwise, a node with
+ the indicated EXPR_TYPE is returned, with operands corresponding to
+ the two sub-expressions. */
+
+static tree
+cp_parser_binary_expression (cp_parser* parser,
+ const cp_parser_token_tree_map token_tree_map,
+ cp_parser_expression_fn fn)
+{
+ tree lhs;
+
+ /* Parse the first expression. */
+ lhs = (*fn) (parser);
+ /* Now, look for more expressions. */
+ while (true)
+ {
+ cp_token *token;
+ const cp_parser_token_tree_map_node *map_node;
+ tree rhs;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If the token is `>', and that's not an operator at the
+ moment, then we're done. */
+ if (token->type == CPP_GREATER
+ && !parser->greater_than_is_operator_p)
+ break;
+ /* If we find one of the tokens we want, build the corresponding
+ tree representation. */
+ for (map_node = token_tree_map;
+ map_node->token_type != CPP_EOF;
+ ++map_node)
+ if (map_node->token_type == token->type)
+ {
+ /* Assume that an overloaded operator will not be used. */
+ bool overloaded_p = false;
+
+ /* Consume the operator token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the right-hand side of the expression. */
+ rhs = (*fn) (parser);
+ /* Build the binary tree node. */
+ lhs = build_x_binary_op (map_node->tree_type, lhs, rhs,
+ &overloaded_p);
+ /* If the binary operator required the use of an
+ overloaded operator, then this expression cannot be an
+ integral constant-expression. An overloaded operator
+ can be used even if both operands are otherwise
+ permissible in an integral constant-expression if at
+ least one of the operands is of enumeration type. */
+ if (overloaded_p
+ && (cp_parser_non_integral_constant_expression
+ (parser, "calls to overloaded operators")))
+ lhs = error_mark_node;
+ break;
+ }
+
+ /* If the token wasn't one of the ones we want, we're done. */
+ if (map_node->token_type == CPP_EOF)
+ break;
+ }
+
+ return lhs;
+}
+
+/* Parse an optional `::' token indicating that the following name is
+ from the global namespace. If so, PARSER->SCOPE is set to the
+ GLOBAL_NAMESPACE. Otherwise, PARSER->SCOPE is set to NULL_TREE,
+ unless CURRENT_SCOPE_VALID_P is TRUE, in which case it is left alone.
+ Returns the new value of PARSER->SCOPE, if the `::' token is
+ present, and NULL_TREE otherwise. */
+
+static tree
+cp_parser_global_scope_opt (cp_parser* parser, bool current_scope_valid_p)
+{
+ cp_token *token;
+
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If we're looking at a `::' token then we're starting from the
+ global namespace, not our current location. */
+ if (token->type == CPP_SCOPE)
+ {
+ /* Consume the `::' token. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Set the SCOPE so that we know where to start the lookup. */
+ parser->scope = global_namespace;
+ parser->qualifying_scope = global_namespace;
+ parser->object_scope = NULL_TREE;
+
+ return parser->scope;
+ }
+ else if (!current_scope_valid_p)
+ {
+ parser->scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ parser->object_scope = NULL_TREE;
+ }
+
+ return NULL_TREE;
+}
+
+/* Returns TRUE if the upcoming token sequence is the start of a
+ constructor declarator. If FRIEND_P is true, the declarator is
+ preceded by the `friend' specifier. */
+
+static bool
+cp_parser_constructor_declarator_p (cp_parser *parser, bool friend_p)
+{
+ bool constructor_p;
+ tree type_decl = NULL_TREE;
+ bool nested_name_p;
+ cp_token *next_token;
+
+ /* The common case is that this is not a constructor declarator, so
+ try to avoid doing lots of work if at all possible. It's not
+ valid declare a constructor at function scope. */
+ if (at_function_scope_p ())
+ return false;
+ /* And only certain tokens can begin a constructor declarator. */
+ next_token = cp_lexer_peek_token (parser->lexer);
+ if (next_token->type != CPP_NAME
+ && next_token->type != CPP_SCOPE
+ && next_token->type != CPP_NESTED_NAME_SPECIFIER
+ && next_token->type != CPP_TEMPLATE_ID)
+ return false;
+
+ /* Parse tentatively; we are going to roll back all of the tokens
+ consumed here. */
+ cp_parser_parse_tentatively (parser);
+ /* Assume that we are looking at a constructor declarator. */
+ constructor_p = true;
+
+ /* Look for the optional `::' operator. */
+ cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false);
+ /* Look for the nested-name-specifier. */
+ nested_name_p
+ = (cp_parser_nested_name_specifier_opt (parser,
+ /*typename_keyword_p=*/false,
+ /*check_dependency_p=*/false,
+ /*type_p=*/false,
+ /*is_declaration=*/false)
+ != NULL_TREE);
+ /* Outside of a class-specifier, there must be a
+ nested-name-specifier. */
+ if (!nested_name_p &&
+ (!at_class_scope_p () || !TYPE_BEING_DEFINED (current_class_type)
+ || friend_p))
+ constructor_p = false;
+ /* If we still think that this might be a constructor-declarator,
+ look for a class-name. */
+ if (constructor_p)
+ {
+ /* If we have:
+
+ template <typename T> struct S { S(); };
+ template <typename T> S<T>::S ();
+
+ we must recognize that the nested `S' names a class.
+ Similarly, for:
+
+ template <typename T> S<T>::S<T> ();
+
+ we must recognize that the nested `S' names a template. */
+ type_decl = cp_parser_class_name (parser,
+ /*typename_keyword_p=*/false,
+ /*template_keyword_p=*/false,
+ /*type_p=*/false,
+ /*check_dependency_p=*/false,
+ /*class_head_p=*/false,
+ /*is_declaration=*/false);
+ /* If there was no class-name, then this is not a constructor. */
+ constructor_p = !cp_parser_error_occurred (parser);
+ }
+
+ /* If we're still considering a constructor, we have to see a `(',
+ to begin the parameter-declaration-clause, followed by either a
+ `)', an `...', or a decl-specifier. We need to check for a
+ type-specifier to avoid being fooled into thinking that:
+
+ S::S (f) (int);
+
+ is a constructor. (It is actually a function named `f' that
+ takes one parameter (of type `int') and returns a value of type
+ `S::S'. */
+ if (constructor_p
+ && cp_parser_require (parser, CPP_OPEN_PAREN, "`('"))
+ {
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN)
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_ELLIPSIS)
+ /* A parameter declaration begins with a decl-specifier,
+ which is either the "attribute" keyword, a storage class
+ specifier, or (usually) a type-specifier. */
+ && !cp_lexer_next_token_is_keyword (parser->lexer, RID_ATTRIBUTE)
+ && !cp_parser_storage_class_specifier_opt (parser))
+ {
+ tree type;
+ bool pop_p = false;
+ unsigned saved_num_template_parameter_lists;
+
+ /* Names appearing in the type-specifier should be looked up
+ in the scope of the class. */
+ if (current_class_type)
+ type = NULL_TREE;
+ else
+ {
+ type = TREE_TYPE (type_decl);
+ if (TREE_CODE (type) == TYPENAME_TYPE)
+ {
+ type = resolve_typename_type (type,
+ /*only_current_p=*/false);
+ if (type == error_mark_node)
+ {
+ cp_parser_abort_tentative_parse (parser);
+ return false;
+ }
+ }
+ pop_p = push_scope (type);
+ }
+
+ /* Inside the constructor parameter list, surrounding
+ template-parameter-lists do not apply. */
+ saved_num_template_parameter_lists
+ = parser->num_template_parameter_lists;
+ parser->num_template_parameter_lists = 0;
+
+ /* Look for the type-specifier. */
+ cp_parser_type_specifier (parser,
+ CP_PARSER_FLAGS_NONE,
+ /*is_friend=*/false,
+ /*is_declarator=*/true,
+ /*declares_class_or_enum=*/NULL,
+ /*is_cv_qualifier=*/NULL);
+
+ parser->num_template_parameter_lists
+ = saved_num_template_parameter_lists;
+
+ /* Leave the scope of the class. */
+ if (pop_p)
+ pop_scope (type);
+
+ constructor_p = !cp_parser_error_occurred (parser);
+ }
+ }
+ else
+ constructor_p = false;
+ /* We did not really want to consume any tokens. */
+ cp_parser_abort_tentative_parse (parser);
+
+ return constructor_p;
+}
+
+/* Parse the definition of the function given by the DECL_SPECIFIERS,
+ ATTRIBUTES, and DECLARATOR. The access checks have been deferred;
+ they must be performed once we are in the scope of the function.
+
+ Returns the function defined. */
+
+static tree
+cp_parser_function_definition_from_specifiers_and_declarator
+ (cp_parser* parser,
+ tree decl_specifiers,
+ tree attributes,
+ tree declarator)
+{
+ tree fn;
+ bool success_p;
+
+ /* Begin the function-definition. */
+ success_p = begin_function_definition (decl_specifiers,
+ attributes,
+ declarator);
+
+ /* If there were names looked up in the decl-specifier-seq that we
+ did not check, check them now. We must wait until we are in the
+ scope of the function to perform the checks, since the function
+ might be a friend. */
+ perform_deferred_access_checks ();
+
+ if (!success_p)
+ {
+ /* If begin_function_definition didn't like the definition, skip
+ the entire function. */
+ error ("invalid function declaration");
+ cp_parser_skip_to_end_of_block_or_statement (parser);
+ fn = error_mark_node;
+ }
+ else
+ fn = cp_parser_function_definition_after_declarator (parser,
+ /*inline_p=*/false);
+
+ return fn;
+}
+
+/* Parse the part of a function-definition that follows the
+ declarator. INLINE_P is TRUE iff this function is an inline
+ function defined with a class-specifier.
+
+ Returns the function defined. */
+
+static tree
+cp_parser_function_definition_after_declarator (cp_parser* parser,
+ bool inline_p)
+{
+ tree fn;
+ bool ctor_initializer_p = false;
+ bool saved_in_unbraced_linkage_specification_p;
+ unsigned saved_num_template_parameter_lists;
+
+ /* If the next token is `return', then the code may be trying to
+ make use of the "named return value" extension that G++ used to
+ support. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_RETURN))
+ {
+ /* Consume the `return' keyword. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Look for the identifier that indicates what value is to be
+ returned. */
+ cp_parser_identifier (parser);
+ /* Issue an error message. */
+ error ("named return values are no longer supported");
+ /* Skip tokens until we reach the start of the function body. */
+ while (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_EOF))
+ cp_lexer_consume_token (parser->lexer);
+ }
+ /* The `extern' in `extern "C" void f () { ... }' does not apply to
+ anything declared inside `f'. */
+ saved_in_unbraced_linkage_specification_p
+ = parser->in_unbraced_linkage_specification_p;
+ parser->in_unbraced_linkage_specification_p = false;
+ /* Inside the function, surrounding template-parameter-lists do not
+ apply. */
+ saved_num_template_parameter_lists
+ = parser->num_template_parameter_lists;
+ parser->num_template_parameter_lists = 0;
+ /* If the next token is `try', then we are looking at a
+ function-try-block. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TRY))
+ ctor_initializer_p = cp_parser_function_try_block (parser);
+ /* A function-try-block includes the function-body, so we only do
+ this next part if we're not processing a function-try-block. */
+ else
+ ctor_initializer_p
+ = cp_parser_ctor_initializer_opt_and_function_body (parser);
+
+ /* Finish the function. */
+ fn = finish_function ((ctor_initializer_p ? 1 : 0) |
+ (inline_p ? 2 : 0));
+ /* Generate code for it, if necessary. */
+ expand_or_defer_fn (fn);
+ /* Restore the saved values. */
+ parser->in_unbraced_linkage_specification_p
+ = saved_in_unbraced_linkage_specification_p;
+ parser->num_template_parameter_lists
+ = saved_num_template_parameter_lists;
+
+ return fn;
+}
+
+/* Parse a template-declaration, assuming that the `export' (and
+ `extern') keywords, if present, has already been scanned. MEMBER_P
+ is as for cp_parser_template_declaration. */
+
+static void
+cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
+{
+ tree decl = NULL_TREE;
+ tree parameter_list;
+ bool friend_p = false;
+
+ /* Look for the `template' keyword. */
+ if (!cp_parser_require_keyword (parser, RID_TEMPLATE, "`template'"))
+ return;
+
+ /* And the `<'. */
+ if (!cp_parser_require (parser, CPP_LESS, "`<'"))
+ return;
+
+ /* If the next token is `>', then we have an invalid
+ specialization. Rather than complain about an invalid template
+ parameter, issue an error message here. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_GREATER))
+ {
+ cp_parser_error (parser, "invalid explicit specialization");
+ begin_specialization ();
+ parameter_list = NULL_TREE;
+ }
+ else
+ {
+ /* Parse the template parameters. */
+ begin_template_parm_list ();
+ parameter_list = cp_parser_template_parameter_list (parser);
+ parameter_list = end_template_parm_list (parameter_list);
+ }
+
+ /* Look for the `>'. */
+ cp_parser_skip_until_found (parser, CPP_GREATER, "`>'");
+ /* We just processed one more parameter list. */
+ ++parser->num_template_parameter_lists;
+ /* If the next token is `template', there are more template
+ parameters. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer,
+ RID_TEMPLATE))
+ cp_parser_template_declaration_after_export (parser, member_p);
+ else
+ {
+ decl = cp_parser_single_declaration (parser,
+ member_p,
+ &friend_p);
+
+ /* If this is a member template declaration, let the front
+ end know. */
+ if (member_p && !friend_p && decl)
+ {
+ if (TREE_CODE (decl) == TYPE_DECL)
+ cp_parser_check_access_in_redeclaration (decl);
+
+ decl = finish_member_template_decl (decl);
+ }
+ else if (friend_p && decl && TREE_CODE (decl) == TYPE_DECL)
+ make_friend_class (current_class_type, TREE_TYPE (decl),
+ /*complain=*/true);
+ }
+ /* We are done with the current parameter list. */
+ --parser->num_template_parameter_lists;
+
+ /* Finish up. */
+ finish_template_decl (parameter_list);
+
+ /* Register member declarations. */
+ if (member_p && !friend_p && decl && !DECL_CLASS_TEMPLATE_P (decl))
+ finish_member_declaration (decl);
+
+ /* If DECL is a function template, we must return to parse it later.
+ (Even though there is no definition, there might be default
+ arguments that need handling.) */
+ if (member_p && decl
+ && (TREE_CODE (decl) == FUNCTION_DECL
+ || DECL_FUNCTION_TEMPLATE_P (decl)))
+ TREE_VALUE (parser->unparsed_functions_queues)
+ = tree_cons (NULL_TREE, decl,
+ TREE_VALUE (parser->unparsed_functions_queues));
+}
+
+/* Parse a `decl-specifier-seq [opt] init-declarator [opt] ;' or
+ `function-definition' sequence. MEMBER_P is true, this declaration
+ appears in a class scope.
+
+ Returns the DECL for the declared entity. If FRIEND_P is non-NULL,
+ *FRIEND_P is set to TRUE iff the declaration is a friend. */
+
+static tree
+cp_parser_single_declaration (cp_parser* parser,
+ bool member_p,
+ bool* friend_p)
+{
+ int declares_class_or_enum;
+ tree decl = NULL_TREE;
+ tree decl_specifiers;
+ tree attributes;
+ bool function_definition_p = false;
+
+ /* Defer access checks until we know what is being declared. */
+ push_deferring_access_checks (dk_deferred);
+
+ /* Try the `decl-specifier-seq [opt] init-declarator [opt]'
+ alternative. */
+ decl_specifiers
+ = cp_parser_decl_specifier_seq (parser,
+ CP_PARSER_FLAGS_OPTIONAL,
+ &attributes,
+ &declares_class_or_enum);
+ if (friend_p)
+ *friend_p = cp_parser_friend_p (decl_specifiers);
+ /* Gather up the access checks that occurred the
+ decl-specifier-seq. */
+ stop_deferring_access_checks ();
+
+ /* Check for the declaration of a template class. */
+ if (declares_class_or_enum)
+ {
+ if (cp_parser_declares_only_class_p (parser))
+ {
+ decl = shadow_tag (decl_specifiers);
+ if (decl)
+ decl = TYPE_NAME (decl);
+ else
+ decl = error_mark_node;
+ }
+ }
+ else
+ decl = NULL_TREE;
+ /* If it's not a template class, try for a template function. If
+ the next token is a `;', then this declaration does not declare
+ anything. But, if there were errors in the decl-specifiers, then
+ the error might well have come from an attempted class-specifier.
+ In that case, there's no need to warn about a missing declarator. */
+ if (!decl
+ && (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)
+ || !value_member (error_mark_node, decl_specifiers)))
+ decl = cp_parser_init_declarator (parser,
+ decl_specifiers,
+ attributes,
+ /*function_definition_allowed_p=*/true,
+ member_p,
+ declares_class_or_enum,
+ &function_definition_p);
+
+ pop_deferring_access_checks ();
+
+ /* Clear any current qualification; whatever comes next is the start
+ of something new. */
+ parser->scope = NULL_TREE;
+ parser->qualifying_scope = NULL_TREE;
+ parser->object_scope = NULL_TREE;
+ /* Look for a trailing `;' after the declaration. */
+ if (!function_definition_p
+ && !cp_parser_require (parser, CPP_SEMICOLON, "`;'"))
+ cp_parser_skip_to_end_of_block_or_statement (parser);
+
+ return decl;
+}
+
+/* Parse a cast-expression that is not the operand of a unary "&". */
+
+static tree
+cp_parser_simple_cast_expression (cp_parser *parser)
+{
+ return cp_parser_cast_expression (parser, /*address_p=*/false);
+}
+
+/* Parse a functional cast to TYPE. Returns an expression
+ representing the cast. */
+
+static tree
+cp_parser_functional_cast (cp_parser* parser, tree type)
+{
+ tree expression_list;
+ tree cast;
+
+ expression_list
+ = cp_parser_parenthesized_expression_list (parser, false,
+ /*non_constant_p=*/NULL);
+
+ cast = build_functional_cast (type, expression_list);
+ /* [expr.const]/1: In an integral constant expression "only type
+ conversions to integral or enumeration type can be used". */
+ if (cast != error_mark_node && !type_dependent_expression_p (type)
+ && !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (type)))
+ {
+ if (cp_parser_non_integral_constant_expression
+ (parser, "a call to a constructor"))
+ return error_mark_node;
+ }
+ return cast;
+}
+
+/* Save the tokens that make up the body of a member function defined
+ in a class-specifier. The DECL_SPECIFIERS and DECLARATOR have
+ already been parsed. The ATTRIBUTES are any GNU "__attribute__"
+ specifiers applied to the declaration. Returns the FUNCTION_DECL
+ for the member function. */
+
+static tree
+cp_parser_save_member_function_body (cp_parser* parser,
+ tree decl_specifiers,
+ tree declarator,
+ tree attributes)
+{
+ cp_token_cache *cache;
+ tree fn;
+
+ /* Create the function-declaration. */
+ fn = start_method (decl_specifiers, declarator, attributes);
+ /* If something went badly wrong, bail out now. */
+ if (fn == error_mark_node)
+ {
+ /* If there's a function-body, skip it. */
+ if (cp_parser_token_starts_function_definition_p
+ (cp_lexer_peek_token (parser->lexer)))
+ cp_parser_skip_to_end_of_block_or_statement (parser);
+ return error_mark_node;
+ }
+
+ /* Remember it, if there default args to post process. */
+ cp_parser_save_default_args (parser, fn);
+
+ /* Create a token cache. */
+ cache = cp_token_cache_new ();
+ /* Save away the tokens that make up the body of the
+ function. */
+ cp_parser_cache_group (parser, cache, CPP_CLOSE_BRACE, /*depth=*/0);
+ /* Handle function try blocks. */
+ while (cp_lexer_next_token_is_keyword (parser->lexer, RID_CATCH))
+ cp_parser_cache_group (parser, cache, CPP_CLOSE_BRACE, /*depth=*/0);
+
+ /* Save away the inline definition; we will process it when the
+ class is complete. */
+ DECL_PENDING_INLINE_INFO (fn) = cache;
+ DECL_PENDING_INLINE_P (fn) = 1;
+
+ /* We need to know that this was defined in the class, so that
+ friend templates are handled correctly. */
+ DECL_INITIALIZED_IN_CLASS_P (fn) = 1;
+
+ /* We're done with the inline definition. */
+ finish_method (fn);
+
+ /* Add FN to the queue of functions to be parsed later. */
+ TREE_VALUE (parser->unparsed_functions_queues)
+ = tree_cons (NULL_TREE, fn,
+ TREE_VALUE (parser->unparsed_functions_queues));
+
+ return fn;
+}
+
+/* Parse a template-argument-list, as well as the trailing ">" (but
+ not the opening ">"). See cp_parser_template_argument_list for the
+ return value. */
+
+static tree
+cp_parser_enclosed_template_argument_list (cp_parser* parser)
+{
+ tree arguments;
+ tree saved_scope;
+ tree saved_qualifying_scope;
+ tree saved_object_scope;
+ bool saved_greater_than_is_operator_p;
+
+ /* [temp.names]
+
+ When parsing a template-id, the first non-nested `>' is taken as
+ the end of the template-argument-list rather than a greater-than
+ operator. */
+ saved_greater_than_is_operator_p
+ = parser->greater_than_is_operator_p;
+ parser->greater_than_is_operator_p = false;
+ /* Parsing the argument list may modify SCOPE, so we save it
+ here. */
+ saved_scope = parser->scope;
+ saved_qualifying_scope = parser->qualifying_scope;
+ saved_object_scope = parser->object_scope;
+ /* Parse the template-argument-list itself. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_GREATER))
+ arguments = NULL_TREE;
+ else
+ arguments = cp_parser_template_argument_list (parser);
+ /* Look for the `>' that ends the template-argument-list. If we find
+ a '>>' instead, it's probably just a typo. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_RSHIFT))
+ {
+ if (!saved_greater_than_is_operator_p)
+ {
+ /* If we're in a nested template argument list, the '>>' has to be
+ a typo for '> >'. We emit the error message, but we continue
+ parsing and we push a '>' as next token, so that the argument
+ list will be parsed correctly.. */
+ cp_token* token;
+ error ("`>>' should be `> >' within a nested template argument list");
+ token = cp_lexer_peek_token (parser->lexer);
+ token->type = CPP_GREATER;
+ }
+ else
+ {
+ /* If this is not a nested template argument list, the '>>' is
+ a typo for '>'. Emit an error message and continue. */
+ error ("spurious `>>', use `>' to terminate a template argument list");
+ cp_lexer_consume_token (parser->lexer);
+ }
+ }
+ else if (!cp_parser_require (parser, CPP_GREATER, "`>'"))
+ error ("missing `>' to terminate the template argument list");
+ /* The `>' token might be a greater-than operator again now. */
+ parser->greater_than_is_operator_p
+ = saved_greater_than_is_operator_p;
+ /* Restore the SAVED_SCOPE. */
+ parser->scope = saved_scope;
+ parser->qualifying_scope = saved_qualifying_scope;
+ parser->object_scope = saved_object_scope;
+
+ return arguments;
+}
+
+/* MEMBER_FUNCTION is a member function, or a friend. If default
+ arguments, or the body of the function have not yet been parsed,
+ parse them now. */
+
+static void
+cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function)
+{
+ cp_lexer *saved_lexer;
+
+ /* If this member is a template, get the underlying
+ FUNCTION_DECL. */
+ if (DECL_FUNCTION_TEMPLATE_P (member_function))
+ member_function = DECL_TEMPLATE_RESULT (member_function);
+
+ /* There should not be any class definitions in progress at this
+ point; the bodies of members are only parsed outside of all class
+ definitions. */
+ my_friendly_assert (parser->num_classes_being_defined == 0, 20010816);
+ /* While we're parsing the member functions we might encounter more
+ classes. We want to handle them right away, but we don't want
+ them getting mixed up with functions that are currently in the
+ queue. */
+ parser->unparsed_functions_queues
+ = tree_cons (NULL_TREE, NULL_TREE, parser->unparsed_functions_queues);
+
+ /* Make sure that any template parameters are in scope. */
+ maybe_begin_member_template_processing (member_function);
+
+ /* If the body of the function has not yet been parsed, parse it
+ now. */
+ if (DECL_PENDING_INLINE_P (member_function))
+ {
+ tree function_scope;
+ cp_token_cache *tokens;
+
+ /* The function is no longer pending; we are processing it. */
+ tokens = DECL_PENDING_INLINE_INFO (member_function);
+ DECL_PENDING_INLINE_INFO (member_function) = NULL;
+ DECL_PENDING_INLINE_P (member_function) = 0;
+ /* If this was an inline function in a local class, enter the scope
+ of the containing function. */
+ function_scope = decl_function_context (member_function);
+ if (function_scope)
+ push_function_context_to (function_scope);
+
+ /* Save away the current lexer. */
+ saved_lexer = parser->lexer;
+ /* Make a new lexer to feed us the tokens saved for this function. */
+ parser->lexer = cp_lexer_new_from_tokens (tokens);
+ parser->lexer->next = saved_lexer;
+
+ /* Set the current source position to be the location of the first
+ token in the saved inline body. */
+ cp_lexer_peek_token (parser->lexer);
+
+ /* Let the front end know that we going to be defining this
+ function. */
+ start_function (NULL_TREE, member_function, NULL_TREE,
+ SF_PRE_PARSED | SF_INCLASS_INLINE);
+
+ /* Now, parse the body of the function. */
+ cp_parser_function_definition_after_declarator (parser,
+ /*inline_p=*/true);
+
+ /* Leave the scope of the containing function. */
+ if (function_scope)
+ pop_function_context_from (function_scope);
+ /* Restore the lexer. */
+ parser->lexer = saved_lexer;
+ }
+
+ /* Remove any template parameters from the symbol table. */
+ maybe_end_member_template_processing ();
+
+ /* Restore the queue. */
+ parser->unparsed_functions_queues
+ = TREE_CHAIN (parser->unparsed_functions_queues);
+}
+
+/* If DECL contains any default args, remember it on the unparsed
+ functions queue. */
+
+static void
+cp_parser_save_default_args (cp_parser* parser, tree decl)
+{
+ tree probe;
+
+ for (probe = TYPE_ARG_TYPES (TREE_TYPE (decl));
+ probe;
+ probe = TREE_CHAIN (probe))
+ if (TREE_PURPOSE (probe))
+ {
+ TREE_PURPOSE (parser->unparsed_functions_queues)
+ = tree_cons (NULL_TREE, decl,
+ TREE_PURPOSE (parser->unparsed_functions_queues));
+ break;
+ }
+ return;
+}
+
+/* FN is a FUNCTION_DECL which may contains a parameter with an
+ unparsed DEFAULT_ARG. Parse the default args now. */
+
+static void
+cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
+{
+ cp_lexer *saved_lexer;
+ cp_token_cache *tokens;
+ bool saved_local_variables_forbidden_p;
+ tree parameters;
+
+ /* While we're parsing the default args, we might (due to the
+ statement expression extension) encounter more classes. We want
+ to handle them right away, but we don't want them getting mixed
+ up with default args that are currently in the queue. */
+ parser->unparsed_functions_queues
+ = tree_cons (NULL_TREE, NULL_TREE, parser->unparsed_functions_queues);
+
+ for (parameters = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ parameters;
+ parameters = TREE_CHAIN (parameters))
+ {
+ if (!TREE_PURPOSE (parameters)
+ || TREE_CODE (TREE_PURPOSE (parameters)) != DEFAULT_ARG)
+ continue;
+
+ /* Save away the current lexer. */
+ saved_lexer = parser->lexer;
+ /* Create a new one, using the tokens we have saved. */
+ tokens = DEFARG_TOKENS (TREE_PURPOSE (parameters));
+ parser->lexer = cp_lexer_new_from_tokens (tokens);
+
+ /* Set the current source position to be the location of the
+ first token in the default argument. */
+ cp_lexer_peek_token (parser->lexer);
+
+ /* Local variable names (and the `this' keyword) may not appear
+ in a default argument. */
+ saved_local_variables_forbidden_p = parser->local_variables_forbidden_p;
+ parser->local_variables_forbidden_p = true;
+ /* Parse the assignment-expression. */
+ if (DECL_CLASS_SCOPE_P (fn))
+ push_nested_class (DECL_CONTEXT (fn));
+ TREE_PURPOSE (parameters) = cp_parser_assignment_expression (parser);
+ if (DECL_CLASS_SCOPE_P (fn))
+ pop_nested_class ();
+
+ /* If the token stream has not been completely used up, then
+ there was extra junk after the end of the default
+ argument. */
+ if (!cp_lexer_next_token_is (parser->lexer, CPP_EOF))
+ cp_parser_error (parser, "expected `,'");
+
+ /* Restore saved state. */
+ parser->lexer = saved_lexer;
+ parser->local_variables_forbidden_p = saved_local_variables_forbidden_p;
+ }
+
+ /* Restore the queue. */
+ parser->unparsed_functions_queues
+ = TREE_CHAIN (parser->unparsed_functions_queues);
+}
+
+/* Parse the operand of `sizeof' (or a similar operator). Returns
+ either a TYPE or an expression, depending on the form of the
+ input. The KEYWORD indicates which kind of expression we have
+ encountered. */
+
+static tree
+cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword)
+{
+ static const char *format;
+ tree expr = NULL_TREE;
+ const char *saved_message;
+ bool saved_integral_constant_expression_p;
+
+ /* Initialize FORMAT the first time we get here. */
+ if (!format)
+ format = "types may not be defined in `%s' expressions";
+
+ /* Types cannot be defined in a `sizeof' expression. Save away the
+ old message. */
+ saved_message = parser->type_definition_forbidden_message;
+ /* And create the new one. */
+ parser->type_definition_forbidden_message
+ = xmalloc (strlen (format)
+ + strlen (IDENTIFIER_POINTER (ridpointers[keyword]))
+ + 1 /* `\0' */);
+ sprintf ((char *) parser->type_definition_forbidden_message,
+ format, IDENTIFIER_POINTER (ridpointers[keyword]));
+
+ /* The restrictions on constant-expressions do not apply inside
+ sizeof expressions. */
+ saved_integral_constant_expression_p = parser->integral_constant_expression_p;
+ parser->integral_constant_expression_p = false;
+
+ /* Do not actually evaluate the expression. */
+ ++skip_evaluation;
+ /* If it's a `(', then we might be looking at the type-id
+ construction. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
+ {
+ tree type;
+ bool saved_in_type_id_in_expr_p;
+
+ /* We can't be sure yet whether we're looking at a type-id or an
+ expression. */
+ cp_parser_parse_tentatively (parser);
+ /* Consume the `('. */
+ cp_lexer_consume_token (parser->lexer);
+ /* Parse the type-id. */
+ saved_in_type_id_in_expr_p = parser->in_type_id_in_expr_p;
+ parser->in_type_id_in_expr_p = true;
+ type = cp_parser_type_id (parser);
+ parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p;
+ /* Now, look for the trailing `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
+ /* If all went well, then we're done. */
+ if (cp_parser_parse_definitely (parser))
+ {
+ /* Build a list of decl-specifiers; right now, we have only
+ a single type-specifier. */
+ type = build_tree_list (NULL_TREE,
+ type);
+
+ /* Call grokdeclarator to figure out what type this is. */
+ expr = grokdeclarator (NULL_TREE,
+ type,
+ TYPENAME,
+ /*initialized=*/0,
+ /*attrlist=*/NULL);
+ }
+ }
+
+ /* If the type-id production did not work out, then we must be
+ looking at the unary-expression production. */
+ if (!expr)
+ expr = cp_parser_unary_expression (parser, /*address_p=*/false);
+ /* Go back to evaluating expressions. */
+ --skip_evaluation;
+
+ /* Free the message we created. */
+ free ((char *) parser->type_definition_forbidden_message);
+ /* And restore the old one. */
+ parser->type_definition_forbidden_message = saved_message;
+ parser->integral_constant_expression_p = saved_integral_constant_expression_p;
+
+ return expr;
+}
+
+/* If the current declaration has no declarator, return true. */
+
+static bool
+cp_parser_declares_only_class_p (cp_parser *parser)
+{
+ /* If the next token is a `;' or a `,' then there is no
+ declarator. */
+ return (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)
+ || cp_lexer_next_token_is (parser->lexer, CPP_COMMA));
+}
+
+/* DECL_SPECIFIERS is the representation of a decl-specifier-seq.
+ Returns TRUE iff `friend' appears among the DECL_SPECIFIERS. */
+
+static bool
+cp_parser_friend_p (tree decl_specifiers)
+{
+ while (decl_specifiers)
+ {
+ /* See if this decl-specifier is `friend'. */
+ if (TREE_CODE (TREE_VALUE (decl_specifiers)) == IDENTIFIER_NODE
+ && C_RID_CODE (TREE_VALUE (decl_specifiers)) == RID_FRIEND)
+ return true;
+
+ /* Go on to the next decl-specifier. */
+ decl_specifiers = TREE_CHAIN (decl_specifiers);
+ }
+
+ return false;
+}
+
+/* If the next token is of the indicated TYPE, consume it. Otherwise,
+ issue an error message indicating that TOKEN_DESC was expected.
+
+ Returns the token consumed, if the token had the appropriate type.
+ Otherwise, returns NULL. */
+
+static cp_token *
+cp_parser_require (cp_parser* parser,
+ enum cpp_ttype type,
+ const char* token_desc)
+{
+ if (cp_lexer_next_token_is (parser->lexer, type))
+ return cp_lexer_consume_token (parser->lexer);
+ else
+ {
+ /* Output the MESSAGE -- unless we're parsing tentatively. */
+ if (!cp_parser_simulate_error (parser))
+ {
+ char *message = concat ("expected ", token_desc, NULL);
+ cp_parser_error (parser, message);
+ free (message);
+ }
+ return NULL;
+ }
+}
+
+/* Like cp_parser_require, except that tokens will be skipped until
+ the desired token is found. An error message is still produced if
+ the next token is not as expected. */
+
+static void
+cp_parser_skip_until_found (cp_parser* parser,
+ enum cpp_ttype type,
+ const char* token_desc)
+{
+ cp_token *token;
+ unsigned nesting_depth = 0;
+
+ if (cp_parser_require (parser, type, token_desc))
+ return;
+
+ /* Skip tokens until the desired token is found. */
+ while (true)
+ {
+ /* Peek at the next token. */
+ token = cp_lexer_peek_token (parser->lexer);
+ /* If we've reached the token we want, consume it and
+ stop. */
+ if (token->type == type && !nesting_depth)
+ {
+ cp_lexer_consume_token (parser->lexer);
+ return;
+ }
+ /* If we've run out of tokens, stop. */
+ if (token->type == CPP_EOF)
+ return;
+ if (token->type == CPP_OPEN_BRACE
+ || token->type == CPP_OPEN_PAREN
+ || token->type == CPP_OPEN_SQUARE)
+ ++nesting_depth;
+ else if (token->type == CPP_CLOSE_BRACE
+ || token->type == CPP_CLOSE_PAREN
+ || token->type == CPP_CLOSE_SQUARE)
+ {
+ if (nesting_depth-- == 0)
+ return;
+ }
+ /* Consume this token. */
+ cp_lexer_consume_token (parser->lexer);
+ }
+}
+
+/* If the next token is the indicated keyword, consume it. Otherwise,
+ issue an error message indicating that TOKEN_DESC was expected.
+
+ Returns the token consumed, if the token had the appropriate type.
+ Otherwise, returns NULL. */
+
+static cp_token *
+cp_parser_require_keyword (cp_parser* parser,
+ enum rid keyword,
+ const char* token_desc)
+{
+ cp_token *token = cp_parser_require (parser, CPP_KEYWORD, token_desc);
+
+ if (token && token->keyword != keyword)
+ {
+ dyn_string_t error_msg;
+
+ /* Format the error message. */
+ error_msg = dyn_string_new (0);
+ dyn_string_append_cstr (error_msg, "expected ");
+ dyn_string_append_cstr (error_msg, token_desc);
+ cp_parser_error (parser, error_msg->s);
+ dyn_string_delete (error_msg);
+ return NULL;
+ }
+
+ return token;
+}
+
+/* Returns TRUE iff TOKEN is a token that can begin the body of a
+ function-definition. */
+
+static bool
+cp_parser_token_starts_function_definition_p (cp_token* token)
+{
+ return (/* An ordinary function-body begins with an `{'. */
+ token->type == CPP_OPEN_BRACE
+ /* A ctor-initializer begins with a `:'. */
+ || token->type == CPP_COLON
+ /* A function-try-block begins with `try'. */
+ || token->keyword == RID_TRY
+ /* The named return value extension begins with `return'. */
+ || token->keyword == RID_RETURN);
+}
+
+/* Returns TRUE iff the next token is the ":" or "{" beginning a class
+ definition. */
+
+static bool
+cp_parser_next_token_starts_class_definition_p (cp_parser *parser)
+{
+ cp_token *token;
+
+ token = cp_lexer_peek_token (parser->lexer);
+ return (token->type == CPP_OPEN_BRACE || token->type == CPP_COLON);
+}
+
+/* Returns TRUE iff the next token is the "," or ">" ending a
+ template-argument. ">>" is also accepted (after the full
+ argument was parsed) because it's probably a typo for "> >",
+ and there is a specific diagnostic for this. */
+
+static bool
+cp_parser_next_token_ends_template_argument_p (cp_parser *parser)
+{
+ cp_token *token;
+
+ token = cp_lexer_peek_token (parser->lexer);
+ return (token->type == CPP_COMMA || token->type == CPP_GREATER
+ || token->type == CPP_RSHIFT);
+}
+
+/* Returns TRUE iff the n-th token is a ">", or the n-th is a "[" and the
+ (n+1)-th is a ":" (which is a possible digraph typo for "< ::"). */
+
+static bool
+cp_parser_nth_token_starts_template_argument_list_p (cp_parser * parser,
+ size_t n)
+{
+ cp_token *token;
+
+ token = cp_lexer_peek_nth_token (parser->lexer, n);
+ if (token->type == CPP_LESS)
+ return true;
+ /* Check for the sequence `<::' in the original code. It would be lexed as
+ `[:', where `[' is a digraph, and there is no whitespace before
+ `:'. */
+ if (token->type == CPP_OPEN_SQUARE && token->flags & DIGRAPH)
+ {
+ cp_token *token2;
+ token2 = cp_lexer_peek_nth_token (parser->lexer, n+1);
+ if (token2->type == CPP_COLON && !(token2->flags & PREV_WHITE))
+ return true;
+ }
+ return false;
+}
+
+/* Returns the kind of tag indicated by TOKEN, if it is a class-key,
+ or none_type otherwise. */
+
+static enum tag_types
+cp_parser_token_is_class_key (cp_token* token)
+{
+ switch (token->keyword)
+ {
+ case RID_CLASS:
+ return class_type;
+ case RID_STRUCT:
+ return record_type;
+ case RID_UNION:
+ return union_type;
+
+ default:
+ return none_type;
+ }
+}
+
+/* Issue an error message if the CLASS_KEY does not match the TYPE. */
+
+static void
+cp_parser_check_class_key (enum tag_types class_key, tree type)
+{
+ if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type))
+ pedwarn ("`%s' tag used in naming `%#T'",
+ class_key == union_type ? "union"
+ : class_key == record_type ? "struct" : "class",
+ type);
+}
+
+/* Issue an error message if DECL is redeclared with different
+ access than its original declaration [class.access.spec/3].
+ This applies to nested classes and nested class templates.
+ [class.mem/1]. */
+
+static void cp_parser_check_access_in_redeclaration (tree decl)
+{
+ if (!CLASS_TYPE_P (TREE_TYPE (decl)))
+ return;
+
+ if ((TREE_PRIVATE (decl)
+ != (current_access_specifier == access_private_node))
+ || (TREE_PROTECTED (decl)
+ != (current_access_specifier == access_protected_node)))
+ error ("%D redeclared with different access", decl);
+}
+
+/* Look for the `template' keyword, as a syntactic disambiguator.
+ Return TRUE iff it is present, in which case it will be
+ consumed. */
+
+static bool
+cp_parser_optional_template_keyword (cp_parser *parser)
+{
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TEMPLATE))
+ {
+ /* The `template' keyword can only be used within templates;
+ outside templates the parser can always figure out what is a
+ template and what is not. */
+ if (!processing_template_decl)
+ {
+ error ("`template' (as a disambiguator) is only allowed "
+ "within templates");
+ /* If this part of the token stream is rescanned, the same
+ error message would be generated. So, we purge the token
+ from the stream. */
+ cp_lexer_purge_token (parser->lexer);
+ return false;
+ }
+ else
+ {
+ /* Consume the `template' keyword. */
+ cp_lexer_consume_token (parser->lexer);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/* The next token is a CPP_NESTED_NAME_SPECIFIER. Consume the token,
+ set PARSER->SCOPE, and perform other related actions. */
+
+static void
+cp_parser_pre_parsed_nested_name_specifier (cp_parser *parser)
+{
+ tree value;
+ tree check;
+
+ /* Get the stored value. */
+ value = cp_lexer_consume_token (parser->lexer)->value;
+ /* Perform any access checks that were deferred. */
+ for (check = TREE_PURPOSE (value); check; check = TREE_CHAIN (check))
+ perform_or_defer_access_check (TREE_PURPOSE (check), TREE_VALUE (check));
+ /* Set the scope from the stored value. */
+ parser->scope = TREE_VALUE (value);
+ parser->qualifying_scope = TREE_TYPE (value);
+ parser->object_scope = NULL_TREE;
+}
+
+/* Add tokens to CACHE until an non-nested END token appears. */
+
+static void
+cp_parser_cache_group (cp_parser *parser,
+ cp_token_cache *cache,
+ enum cpp_ttype end,
+ unsigned depth)
+{
+ while (true)
+ {
+ cp_token *token;
+
+ /* Abort a parenthesized expression if we encounter a brace. */
+ if ((end == CPP_CLOSE_PAREN || depth == 0)
+ && cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
+ return;
+ /* If we've reached the end of the file, stop. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_EOF))
+ return;
+ /* Consume the next token. */
+ token = cp_lexer_consume_token (parser->lexer);
+ /* Add this token to the tokens we are saving. */
+ cp_token_cache_push_token (cache, token);
+ /* See if it starts a new group. */
+ if (token->type == CPP_OPEN_BRACE)
+ {
+ cp_parser_cache_group (parser, cache, CPP_CLOSE_BRACE, depth + 1);
+ if (depth == 0)
+ return;
+ }
+ else if (token->type == CPP_OPEN_PAREN)
+ cp_parser_cache_group (parser, cache, CPP_CLOSE_PAREN, depth + 1);
+ else if (token->type == end)
+ return;
+ }
+}
+
+/* Begin parsing tentatively. We always save tokens while parsing
+ tentatively so that if the tentative parsing fails we can restore the
+ tokens. */
+
+static void
+cp_parser_parse_tentatively (cp_parser* parser)
+{
+ /* Enter a new parsing context. */
+ parser->context = cp_parser_context_new (parser->context);
+ /* Begin saving tokens. */
+ cp_lexer_save_tokens (parser->lexer);
+ /* In order to avoid repetitive access control error messages,
+ access checks are queued up until we are no longer parsing
+ tentatively. */
+ push_deferring_access_checks (dk_deferred);
+}
+
+/* Commit to the currently active tentative parse. */
+
+static void
+cp_parser_commit_to_tentative_parse (cp_parser* parser)
+{
+ cp_parser_context *context;
+ cp_lexer *lexer;
+
+ /* Mark all of the levels as committed. */
+ lexer = parser->lexer;
+ for (context = parser->context; context->next; context = context->next)
+ {
+ if (context->status == CP_PARSER_STATUS_KIND_COMMITTED)
+ break;
+ context->status = CP_PARSER_STATUS_KIND_COMMITTED;
+ while (!cp_lexer_saving_tokens (lexer))
+ lexer = lexer->next;
+ cp_lexer_commit_tokens (lexer);
+ }
+}
+
+/* Abort the currently active tentative parse. All consumed tokens
+ will be rolled back, and no diagnostics will be issued. */
+
+static void
+cp_parser_abort_tentative_parse (cp_parser* parser)
+{
+ cp_parser_simulate_error (parser);
+ /* Now, pretend that we want to see if the construct was
+ successfully parsed. */
+ cp_parser_parse_definitely (parser);
+}
+
+/* Stop parsing tentatively. If a parse error has occurred, restore the
+ token stream. Otherwise, commit to the tokens we have consumed.
+ Returns true if no error occurred; false otherwise. */
+
+static bool
+cp_parser_parse_definitely (cp_parser* parser)
+{
+ bool error_occurred;
+ cp_parser_context *context;
+
+ /* Remember whether or not an error occurred, since we are about to
+ destroy that information. */
+ error_occurred = cp_parser_error_occurred (parser);
+ /* Remove the topmost context from the stack. */
+ context = parser->context;
+ parser->context = context->next;
+ /* If no parse errors occurred, commit to the tentative parse. */
+ if (!error_occurred)
+ {
+ /* Commit to the tokens read tentatively, unless that was
+ already done. */
+ if (context->status != CP_PARSER_STATUS_KIND_COMMITTED)
+ cp_lexer_commit_tokens (parser->lexer);
+
+ pop_to_parent_deferring_access_checks ();
+ }
+ /* Otherwise, if errors occurred, roll back our state so that things
+ are just as they were before we began the tentative parse. */
+ else
+ {
+ cp_lexer_rollback_tokens (parser->lexer);
+ pop_deferring_access_checks ();
+ }
+ /* Add the context to the front of the free list. */
+ context->next = cp_parser_context_free_list;
+ cp_parser_context_free_list = context;
+
+ return !error_occurred;
+}
+
+/* Returns true if we are parsing tentatively -- but have decided that
+ we will stick with this tentative parse, even if errors occur. */
+
+static bool
+cp_parser_committed_to_tentative_parse (cp_parser* parser)
+{
+ return (cp_parser_parsing_tentatively (parser)
+ && parser->context->status == CP_PARSER_STATUS_KIND_COMMITTED);
+}
+
+/* Returns nonzero iff an error has occurred during the most recent
+ tentative parse. */
+
+static bool
+cp_parser_error_occurred (cp_parser* parser)
+{
+ return (cp_parser_parsing_tentatively (parser)
+ && parser->context->status == CP_PARSER_STATUS_KIND_ERROR);
+}
+
+/* Returns nonzero if GNU extensions are allowed. */
+
+static bool
+cp_parser_allow_gnu_extensions_p (cp_parser* parser)
+{
+ return parser->allow_gnu_extensions_p;
+}
+
+
+
+/* The parser. */
+
+static GTY (()) cp_parser *the_parser;
+
+/* External interface. */
+
+/* Parse one entire translation unit. */
+
+void
+c_parse_file (void)
+{
+ bool error_occurred;
+
+ the_parser = cp_parser_new ();
+ push_deferring_access_checks (flag_access_control
+ ? dk_no_deferred : dk_no_check);
+ error_occurred = cp_parser_translation_unit (the_parser);
+ the_parser = NULL;
+}
+
+/* This variable must be provided by every front end. */
+
+int yydebug;
+
+#include "gt-cp-parser.h"
diff --git a/contrib/gcc/cp/pt.c b/contrib/gcc/cp/pt.c
index 64d4428..c5c8e32 100644
--- a/contrib/gcc/cp/pt.c
+++ b/contrib/gcc/cp/pt.c
@@ -1,23 +1,23 @@
/* Handle parameterized types (templates) for GNU C++.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (jason@cygnus.com).
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -28,34 +28,33 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.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 "except.h"
#include "toplev.h"
#include "rtl.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) PARAMS ((tree, void*));
+typedef int (*tree_fn_t) (tree, void*);
/* 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
- work. The TREE_PURPOSE of each entry is a SRCLOC indicating where
- the instantiate request occurred; the TREE_VALUE is either a DECL
- (for a function or static data member), or a TYPE (for a class)
- indicating what we are hoping to instantiate. */
+ were not yet available, or because we were putting off doing the work.
+ The TREE_PURPOSE of each entry is either a DECL (for a function or
+ static data member), or a TYPE (for a class) indicating what we are
+ hoping to instantiate. The TREE_VALUE is not used. */
static GTY(()) tree pending_templates;
-static tree last_pending_template;
+static GTY(()) tree last_pending_template;
int processing_template_parmlist;
static int template_header_count;
@@ -89,134 +88,104 @@ static htab_t local_specializations;
#define GTB_IGNORE_TYPE 2 /* We don't need to try to unify the current
type with the desired type. */
-static void push_access_scope_real PARAMS ((tree, tree, tree));
-static void push_access_scope PARAMS ((tree));
-static void pop_access_scope PARAMS ((tree));
-static int resolve_overloaded_unification PARAMS ((tree, tree, tree, tree,
- unification_kind_t, int));
-static int try_one_overload PARAMS ((tree, tree, tree, tree, tree,
- unification_kind_t, int, bool));
-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,
- tsubst_flags_t, 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 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,
- tsubst_flags_t, int, tree));
-static tree get_bindings_overload PARAMS ((tree, tree, tree));
-static int for_each_template_parm PARAMS ((tree, tree_fn_t, void*, htab_t));
-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 reregister_specialization PARAMS ((tree, 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 int template_parm_this_level_p PARAMS ((tree, void *));
-static tree tsubst_friend_function PARAMS ((tree, tree));
-static tree tsubst_friend_class PARAMS ((tree, tree));
-static int can_complete_type_without_circularity PARAMS ((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, tsubst_flags_t));
-static tree tsubst_template_parms PARAMS ((tree, tree, tsubst_flags_t));
-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, tsubst_flags_t, tree, int));
-static tree tsubst_decl PARAMS ((tree, tree, tree, tsubst_flags_t));
-static tree tsubst_arg_types PARAMS ((tree, tree, tsubst_flags_t, tree));
-static tree tsubst_function_type PARAMS ((tree, tree, tsubst_flags_t, 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,
- tsubst_flags_t, tree));
-static tree get_template_base_recursive PARAMS ((tree, tree,
- tree, 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, tsubst_flags_t,
- tree, tree));
-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, tsubst_flags_t));
+static void push_access_scope (tree);
+static void pop_access_scope (tree);
+static int resolve_overloaded_unification (tree, tree, tree, tree,
+ unification_kind_t, int);
+static int try_one_overload (tree, tree, tree, tree, tree,
+ unification_kind_t, int, bool);
+static int unify (tree, tree, tree, tree, int);
+static void add_pending_template (tree);
+static void reopen_tinst_level (tree);
+static tree classtype_mangled_name (tree);
+static char* mangle_class_name_for_template (const char *, tree, tree);
+static tree tsubst_initializer_list (tree, tree);
+static tree get_class_bindings (tree, tree, tree);
+static tree coerce_template_parms (tree, tree, tree, tsubst_flags_t, int);
+static void tsubst_enum (tree, tree, tree);
+static tree add_to_template_args (tree, tree);
+static tree add_outermost_template_args (tree, tree);
+static bool check_instantiated_args (tree, tree, tsubst_flags_t);
+static int maybe_adjust_types_for_deduction (unification_kind_t, tree*, tree*);
+static int type_unification_real (tree, tree, tree, tree,
+ int, unification_kind_t, int, int);
+static void note_template_header (int);
+static tree convert_nontype_argument (tree, tree);
+static tree convert_template_argument (tree, tree, tree,
+ tsubst_flags_t, int, tree);
+static tree get_bindings_overload (tree, tree, tree);
+static int for_each_template_parm (tree, tree_fn_t, void*, htab_t);
+static tree build_template_parm_index (int, int, int, tree, tree);
+static int inline_needs_template_parms (tree);
+static void push_inline_template_parms_recursive (tree, int);
+static tree retrieve_specialization (tree, tree);
+static tree retrieve_local_specialization (tree);
+static tree register_specialization (tree, tree, tree);
+static void register_local_specialization (tree, tree);
+static tree reduce_template_parm_level (tree, tree, int);
+static tree build_template_decl (tree, tree);
+static int mark_template_parm (tree, void *);
+static int template_parm_this_level_p (tree, void *);
+static tree tsubst_friend_function (tree, tree);
+static tree tsubst_friend_class (tree, tree);
+static int can_complete_type_without_circularity (tree);
+static tree get_bindings (tree, tree, tree);
+static tree get_bindings_real (tree, tree, tree, int, int, int);
+static int template_decl_level (tree);
+static int check_cv_quals_for_unify (int, tree, tree);
+static tree tsubst_template_arg (tree, tree, tsubst_flags_t, tree);
+static tree tsubst_template_args (tree, tree, tsubst_flags_t, tree);
+static tree tsubst_template_parms (tree, tree, tsubst_flags_t);
+static void regenerate_decl_from_template (tree, tree);
+static tree most_specialized (tree, tree, tree);
+static tree most_specialized_class (tree, tree);
+static int template_class_depth_real (tree, int);
+static tree tsubst_aggr_type (tree, tree, tsubst_flags_t, tree, int);
+static tree tsubst_decl (tree, tree, tree, tsubst_flags_t);
+static tree tsubst_arg_types (tree, tree, tsubst_flags_t, tree);
+static tree tsubst_function_type (tree, tree, tsubst_flags_t, tree);
+static void check_specialization_scope (void);
+static tree process_partial_specialization (tree);
+static void set_current_access_from_decl (tree);
+static void check_default_tmpl_args (tree, tree, int, int);
+static tree tsubst_call_declarator_parms (tree, tree, tsubst_flags_t, tree);
+static tree get_template_base_recursive (tree, tree, tree, tree, tree, int);
+static tree get_template_base (tree, tree, tree, tree);
+static int verify_class_unification (tree, tree, tree);
+static tree try_class_unification (tree, tree, tree, tree);
+static int coerce_template_template_parms (tree, tree, tsubst_flags_t,
+ tree, tree);
+static tree determine_specialization (tree, tree, tree *, int);
+static int template_args_equal (tree, tree);
+static void tsubst_default_arguments (tree);
+static tree for_each_template_parm_r (tree *, int *, void *);
+static tree copy_default_args_to_explicit_spec_1 (tree, tree);
+static void copy_default_args_to_explicit_spec (tree);
+static int invalid_nontype_parm_type_p (tree, tsubst_flags_t);
+static int eq_local_specializations (const void *, const void *);
+static bool dependent_type_p_r (tree);
+static tree tsubst (tree, tree, tsubst_flags_t, tree);
+static tree tsubst_expr (tree, tree, tsubst_flags_t, tree);
+static tree tsubst_copy (tree, tree, tsubst_flags_t, tree);
/* Make the current scope suitable for access checking when we are
processing T. T can be FUNCTION_DECL for instantiated function
- template, TEMPLATE_DECL for uninstantiated one, or VAR_DECL for
- static member variable (need by instantiate_decl). ARGS is the
- template argument for TEMPLATE_DECL. If CONTEXT is not NULL_TREE,
- this is used instead of the context of T. */
+ template, or VAR_DECL for static member variable (need by
+ instantiate_decl). */
-void
-push_access_scope_real (t, args, context)
- tree t, args, context;
+static void
+push_access_scope (tree t)
{
- if (TREE_CODE (t) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (t))
- {
- /* When we are processing specialization `foo<Outer>' for code like
-
- template <class U> typename U::Inner foo ();
- class Outer {
- struct Inner {};
- friend Outer::Inner foo<Outer> ();
- };
-
- `T' is a TEMPLATE_DECL, but `Outer' is only a friend of one of
- its specialization. We can get the FUNCTION_DECL with the right
- information because this specialization has already been
- registered by the friend declaration above. */
-
- if (DECL_FUNCTION_TEMPLATE_P (t) && args)
- {
- tree full_args = tsubst_template_arg_vector
- (DECL_TI_ARGS (DECL_TEMPLATE_RESULT (t)), args, tf_none);
- tree spec = NULL_TREE;
- if (full_args != error_mark_node)
- spec = retrieve_specialization (t, full_args);
- if (spec)
- t = spec;
- }
- }
+ my_friendly_assert (TREE_CODE (t) == FUNCTION_DECL
+ || TREE_CODE (t) == VAR_DECL,
+ 0);
- if (!context)
- context = DECL_CONTEXT (t);
- if (context && TYPE_P (context))
- push_nested_class (context, 2);
+ if (DECL_CLASS_SCOPE_P (t))
+ push_nested_class (DECL_CONTEXT (t));
else
push_to_top_level ();
- if (TREE_CODE (t) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (t))
+ if (TREE_CODE (t) == FUNCTION_DECL)
{
saved_access_scope = tree_cons
(NULL_TREE, current_function_decl, saved_access_scope);
@@ -224,23 +193,13 @@ push_access_scope_real (t, args, context)
}
}
-/* Like push_access_scope_real, but always uses DECL_CONTEXT. */
-
-void
-push_access_scope (t)
- tree t;
-{
- push_access_scope_real (t, NULL_TREE, NULL_TREE);
-}
-
/* Restore the scope set up by push_access_scope. T is the node we
are processing. */
-void
-pop_access_scope (t)
- tree t;
+static void
+pop_access_scope (tree t)
{
- if (TREE_CODE (t) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (t))
+ if (TREE_CODE (t) == FUNCTION_DECL)
{
current_function_decl = TREE_VALUE (saved_access_scope);
saved_access_scope = TREE_CHAIN (saved_access_scope);
@@ -252,29 +211,29 @@ pop_access_scope (t)
pop_from_top_level ();
}
-/* Do any processing required when DECL (a member template declaration
- using TEMPLATE_PARAMETERS as its innermost parameter list) is
- finished. Returns the TEMPLATE_DECL corresponding to DECL, unless
- it is a specialization, in which case the DECL itself is returned. */
+/* Do any processing required when DECL (a member template
+ declaration) is finished. Returns the TEMPLATE_DECL corresponding
+ to DECL, unless it is a specialization, in which case the DECL
+ itself is returned. */
tree
-finish_member_template_decl (decl)
- tree decl;
+finish_member_template_decl (tree decl)
{
- if (decl == NULL_TREE || decl == void_type_node)
- return NULL_TREE;
- else if (decl == error_mark_node)
- /* By returning NULL_TREE, the parser will just ignore this
- declaration. We have already issued the error. */
- return NULL_TREE;
- else if (TREE_CODE (decl) == TREE_LIST)
+ if (decl == error_mark_node)
+ return error_mark_node;
+
+ my_friendly_assert (DECL_P (decl), 20020812);
+
+ if (TREE_CODE (decl) == TYPE_DECL)
{
- /* Assume that the class is the only declspec. */
- decl = TREE_VALUE (decl);
- if (IS_AGGR_TYPE (decl) && CLASSTYPE_TEMPLATE_INFO (decl)
- && ! CLASSTYPE_TEMPLATE_SPECIALIZATION (decl))
+ tree type;
+
+ type = TREE_TYPE (decl);
+ if (IS_AGGR_TYPE (type)
+ && CLASSTYPE_TEMPLATE_INFO (type)
+ && !CLASSTYPE_TEMPLATE_SPECIALIZATION (type))
{
- tree tmpl = CLASSTYPE_TI_TEMPLATE (decl);
+ tree tmpl = CLASSTYPE_TI_TEMPLATE (type);
check_member_template (tmpl);
return tmpl;
}
@@ -318,9 +277,7 @@ finish_member_template_decl (decl)
always safe. */
static int
-template_class_depth_real (type, count_specializations)
- tree type;
- int count_specializations;
+template_class_depth_real (tree type, int count_specializations)
{
int depth;
@@ -357,8 +314,7 @@ template_class_depth_real (type, count_specializations)
the depth. */
int
-template_class_depth (type)
- tree type;
+template_class_depth (tree type)
{
return template_class_depth_real (type, /*count_specializations=*/0);
}
@@ -367,8 +323,7 @@ template_class_depth (type)
needs us to push template parms. */
static int
-inline_needs_template_parms (decl)
- tree decl;
+inline_needs_template_parms (tree decl)
{
if (! DECL_TEMPLATE_INFO (decl))
return 0;
@@ -383,9 +338,7 @@ inline_needs_template_parms (decl)
innermost first. */
static void
-push_inline_template_parms_recursive (parmlist, levels)
- tree parmlist;
- int levels;
+push_inline_template_parms_recursive (tree parmlist, int levels)
{
tree parms = TREE_VALUE (parmlist);
int i;
@@ -399,7 +352,8 @@ push_inline_template_parms_recursive (parmlist, levels)
parms, current_template_parms);
TEMPLATE_PARMS_FOR_INLINE (current_template_parms) = 1;
- pushlevel (0);
+ begin_scope (TREE_VEC_LENGTH (parms) ? sk_template_parms : sk_template_spec,
+ NULL);
for (i = 0; i < TREE_VEC_LENGTH (parms); ++i)
{
tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
@@ -421,6 +375,7 @@ push_inline_template_parms_recursive (parmlist, levels)
tree decl = build_decl (CONST_DECL, DECL_NAME (parm),
TREE_TYPE (parm));
DECL_ARTIFICIAL (decl) = 1;
+ TREE_CONSTANT (decl) = TREE_READONLY (decl) = 1;
DECL_INITIAL (decl) = DECL_INITIAL (parm);
SET_DECL_TEMPLATE_PARM_P (decl);
pushdecl (decl);
@@ -437,8 +392,7 @@ push_inline_template_parms_recursive (parmlist, levels)
a friend template defined in a class definition. */
void
-maybe_begin_member_template_processing (decl)
- tree decl;
+maybe_begin_member_template_processing (tree decl)
{
tree parms;
int levels = 0;
@@ -470,7 +424,7 @@ maybe_begin_member_template_processing (decl)
/* Undo the effects of begin_member_template_processing. */
void
-maybe_end_member_template_processing ()
+maybe_end_member_template_processing (void)
{
int i;
@@ -504,8 +458,7 @@ maybe_end_member_template_processing ()
C<int>::f(U)' is considered a member template. */
int
-is_member_template (t)
- tree t;
+is_member_template (tree t)
{
if (!DECL_FUNCTION_TEMPLATE_P (t))
/* Anything that isn't a function or a template function is
@@ -530,8 +483,7 @@ is_member_template (t)
a member template. */
int
-is_member_template_class (t)
- tree t;
+is_member_template_class (tree t)
{
if (!DECL_CLASS_TEMPLATE_P (t))
/* Anything that isn't a class template, is certainly not a member
@@ -555,9 +507,7 @@ is_member_template_class (t)
but has as its innermost set of arguments the EXTRA_ARGS. */
static tree
-add_to_template_args (args, extra_args)
- tree args;
- tree extra_args;
+add_to_template_args (tree args, tree extra_args)
{
tree new_args;
int extra_depth;
@@ -584,9 +534,7 @@ add_to_template_args (args, extra_args)
partial instantiation. */
static tree
-add_outermost_template_args (args, extra_args)
- tree args;
- tree extra_args;
+add_outermost_template_args (tree args, tree extra_args)
{
tree new_args;
@@ -614,9 +562,7 @@ add_outermost_template_args (args, extra_args)
/* Return the N levels of innermost template arguments from the ARGS. */
tree
-get_innermost_template_args (args, n)
- tree args;
- int n;
+get_innermost_template_args (tree args, int n)
{
tree new_args;
int extra_levels;
@@ -648,7 +594,7 @@ get_innermost_template_args (args, n)
the parms. */
void
-begin_template_parm_list ()
+begin_template_parm_list (void)
{
/* We use a non-tag-transparent scope here, which causes pushtag to
put tags in this scope, rather than in the enclosing class or
@@ -664,7 +610,7 @@ begin_template_parm_list ()
pushtag contains special code to call pushdecl_with_scope on the
TEMPLATE_DECL for S2. */
- begin_scope (sk_template_parms);
+ begin_scope (sk_template_parms, NULL);
++processing_template_decl;
++processing_template_parmlist;
note_template_header (0);
@@ -674,7 +620,7 @@ begin_template_parm_list ()
invalid to declare a specialization here, an error is reported. */
static void
-check_specialization_scope ()
+check_specialization_scope (void)
{
tree scope = current_scope ();
@@ -706,9 +652,9 @@ check_specialization_scope ()
/* We've just seen template <>. */
void
-begin_specialization ()
+begin_specialization (void)
{
- begin_scope (sk_template_spec);
+ begin_scope (sk_template_spec, NULL);
note_template_header (1);
check_specialization_scope ();
}
@@ -717,7 +663,7 @@ begin_specialization ()
template<>. */
void
-end_specialization ()
+end_specialization (void)
{
finish_scope ();
reset_specialization ();
@@ -727,7 +673,7 @@ end_specialization ()
function specialization. */
void
-reset_specialization ()
+reset_specialization (void)
{
processing_specialization = 0;
template_header_count = 0;
@@ -737,8 +683,7 @@ reset_specialization ()
it was of the form template <>. */
static void
-note_template_header (specialization)
- int specialization;
+note_template_header (int specialization)
{
processing_specialization = specialization;
template_header_count++;
@@ -747,25 +692,25 @@ note_template_header (specialization)
/* We're beginning an explicit instantiation. */
void
-begin_explicit_instantiation ()
+begin_explicit_instantiation (void)
{
- ++processing_explicit_instantiation;
+ my_friendly_assert (!processing_explicit_instantiation, 20020913);
+ processing_explicit_instantiation = true;
}
void
-end_explicit_instantiation ()
+end_explicit_instantiation (void)
{
- my_friendly_assert(processing_explicit_instantiation > 0, 0);
- --processing_explicit_instantiation;
+ my_friendly_assert(processing_explicit_instantiation, 20020913);
+ processing_explicit_instantiation = false;
}
/* The TYPE is being declared. If it is a template type, that means it
is a partial specialization. Do appropriate error-checking. */
void
-maybe_process_partial_specialization (type)
- tree type;
+maybe_process_partial_specialization (tree type)
{
/* TYPE maybe an ERROR_MARK_NODE. */
tree context = TYPE_P (type) ? TYPE_CONTEXT (type) : NULL_TREE;
@@ -786,8 +731,10 @@ maybe_process_partial_specialization (type)
if (CLASSTYPE_IMPLICIT_INSTANTIATION (type)
&& !COMPLETE_TYPE_P (type))
{
- if (current_namespace
- != decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type)))
+ tree tpl_ns = decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type));
+ if (is_associated_namespace (current_namespace, tpl_ns))
+ /* Same or super-using namespace. */;
+ else
{
pedwarn ("specializing `%#T' in different namespace", type);
cp_pedwarn_at (" from definition of `%#D'",
@@ -868,9 +815,7 @@ maybe_process_partial_specialization (type)
templates with more than one level of parameters. */
static tree
-retrieve_specialization (tmpl, args)
- tree tmpl;
- tree args;
+retrieve_specialization (tree tmpl, tree args)
{
tree s;
@@ -894,18 +839,17 @@ retrieve_specialization (tmpl, args)
/* Like retrieve_specialization, but for local declarations. */
static tree
-retrieve_local_specialization (tmpl)
- tree tmpl;
+retrieve_local_specialization (tree tmpl)
{
- return (tree) htab_find (local_specializations, tmpl);
+ tree spec = htab_find_with_hash (local_specializations, tmpl,
+ htab_hash_pointer (tmpl));
+ return spec ? TREE_PURPOSE (spec) : NULL_TREE;
}
/* Returns nonzero iff DECL is a specialization of TMPL. */
int
-is_specialization_of (decl, tmpl)
- tree decl;
- tree tmpl;
+is_specialization_of (tree decl, tree tmpl)
{
tree t;
@@ -932,15 +876,146 @@ is_specialization_of (decl, tmpl)
return 0;
}
+/* Returns nonzero iff DECL is a specialization of friend declaration
+ FRIEND according to [temp.friend]. */
+
+bool
+is_specialization_of_friend (tree decl, tree friend)
+{
+ bool need_template = true;
+ int template_depth;
+
+ my_friendly_assert (TREE_CODE (decl) == FUNCTION_DECL, 0);
+
+ /* For [temp.friend/6] when FRIEND is an ordinary member function
+ of a template class, we want to check if DECL is a specialization
+ if this. */
+ if (TREE_CODE (friend) == FUNCTION_DECL
+ && DECL_TEMPLATE_INFO (friend)
+ && !DECL_USE_TEMPLATE (friend))
+ {
+ friend = DECL_TI_TEMPLATE (friend);
+ need_template = false;
+ }
+
+ /* There is nothing to do if this is not a template friend. */
+ if (TREE_CODE (friend) != TEMPLATE_DECL)
+ return 0;
+
+ if (is_specialization_of (decl, friend))
+ return 1;
+
+ /* [temp.friend/6]
+ A member of a class template may be declared to be a friend of a
+ non-template class. In this case, the corresponding member of
+ every specialization of the class template is a friend of the
+ class granting friendship.
+
+ For example, given a template friend declaration
+
+ template <class T> friend void A<T>::f();
+
+ the member function below is considered a friend
+
+ template <> struct A<int> {
+ void f();
+ };
+
+ For this type of template friend, TEMPLATE_DEPTH below will be
+ nonzero. To determine if DECL is a friend of FRIEND, we first
+ check if the enclosing class is a specialization of another. */
+
+ template_depth = template_class_depth (DECL_CONTEXT (friend));
+ if (template_depth
+ && DECL_CLASS_SCOPE_P (decl)
+ && is_specialization_of (TYPE_NAME (DECL_CONTEXT (decl)),
+ CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (friend))))
+ {
+ /* Next, we check the members themselves. In order to handle
+ a few tricky cases like
+
+ template <class T> friend void A<T>::g(T t);
+ template <class T> template <T t> friend void A<T>::h();
+
+ we need to figure out what ARGS is (corresponding to `T' in above
+ examples) from DECL for later processing. */
+
+ tree context = DECL_CONTEXT (decl);
+ tree args = NULL_TREE;
+ int current_depth = 0;
+ while (current_depth < template_depth)
+ {
+ if (CLASSTYPE_TEMPLATE_INFO (context))
+ {
+ if (current_depth == 0)
+ args = TYPE_TI_ARGS (context);
+ else
+ args = add_to_template_args (TYPE_TI_ARGS (context), args);
+ current_depth++;
+ }
+ context = TYPE_CONTEXT (context);
+ }
+
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ bool is_template;
+ tree friend_type;
+ tree decl_type;
+ tree friend_args_type;
+ tree decl_args_type;
+
+ /* Make sure that both DECL and FRIEND are templates or
+ non-templates. */
+ is_template = DECL_TEMPLATE_INFO (decl)
+ && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl));
+ if (need_template ^ is_template)
+ return 0;
+ else if (is_template)
+ {
+ /* If both are templates, check template parameter list. */
+ tree friend_parms
+ = tsubst_template_parms (DECL_TEMPLATE_PARMS (friend),
+ args, tf_none);
+ if (!comp_template_parms
+ (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (decl)),
+ friend_parms))
+ return 0;
+
+ decl_type = TREE_TYPE (DECL_TI_TEMPLATE (decl));
+ }
+ else
+ decl_type = TREE_TYPE (decl);
+
+ friend_type = tsubst_function_type (TREE_TYPE (friend), args,
+ tf_none, NULL_TREE);
+ if (friend_type == error_mark_node)
+ return 0;
+
+ /* Check if return types match. */
+ if (!same_type_p (TREE_TYPE (decl_type), TREE_TYPE (friend_type)))
+ return 0;
+
+ /* Check if function parameter types match, ignoring the
+ `this' parameter. */
+ friend_args_type = TYPE_ARG_TYPES (friend_type);
+ decl_args_type = TYPE_ARG_TYPES (decl_type);
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (friend))
+ friend_args_type = TREE_CHAIN (friend_args_type);
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+ decl_args_type = TREE_CHAIN (decl_args_type);
+ if (compparms (decl_args_type, friend_args_type))
+ return 1;
+ }
+ }
+ return 0;
+}
+
/* Register the specialization SPEC as a specialization of TMPL with
the indicated ARGS. Returns SPEC, or an equivalent prior
declaration, if available. */
static tree
-register_specialization (spec, tmpl, args)
- tree spec;
- tree tmpl;
- tree args;
+register_specialization (tree spec, tree tmpl, tree args)
{
tree s;
@@ -960,7 +1035,7 @@ register_specialization (spec, tmpl, args)
the default argument expression is not substituted for in an
instantiation unless and until it is actually needed. */
return spec;
-
+
/* There should be as many levels of arguments as there are
levels of parameters. */
my_friendly_assert (TMPL_ARGS_DEPTH (args)
@@ -1027,7 +1102,12 @@ register_specialization (spec, tmpl, args)
}
else if (DECL_TEMPLATE_SPECIALIZATION (fn))
{
- duplicate_decls (spec, fn);
+ if (!duplicate_decls (spec, fn) && DECL_INITIAL (spec))
+ /* Dup decl failed, but this is a new
+ definition. Set the line number so any errors
+ match this new definition. */
+ DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (spec);
+
return fn;
}
}
@@ -1044,7 +1124,7 @@ register_specialization (spec, tmpl, args)
Replace it with NEW_SPEC, if NEW_SPEC is non-NULL. Returns true
if the SPEC was listed as a specialization of TMPL. */
-static int
+bool
reregister_specialization (tree spec, tree tmpl, tree new_spec)
{
tree* s;
@@ -1064,25 +1144,41 @@ reregister_specialization (tree spec, tree tmpl, tree new_spec)
return 0;
}
+/* Compare an entry in the local specializations hash table P1 (which
+ is really a pointer to a TREE_LIST) with P2 (which is really a
+ DECL). */
+
+static int
+eq_local_specializations (const void *p1, const void *p2)
+{
+ return TREE_VALUE ((tree) p1) == (tree) p2;
+}
+
+/* Hash P1, an entry in the local specializations table. */
+
+static hashval_t
+hash_local_specialization (const void* p1)
+{
+ return htab_hash_pointer (TREE_VALUE ((tree) p1));
+}
+
/* 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;
+register_local_specialization (tree spec, tree tmpl)
{
void **slot;
- slot = htab_find_slot (local_specializations, tmpl, INSERT);
- *slot = spec;
+ slot = htab_find_slot_with_hash (local_specializations, tmpl,
+ htab_hash_pointer (tmpl), INSERT);
+ *slot = build_tree_list (spec, tmpl);
}
/* Print the list of candidate FNS in an error message. */
void
-print_candidates (fns)
- tree fns;
+print_candidates (tree fns)
{
tree fn;
@@ -1114,12 +1210,10 @@ print_candidates (fns)
issued. The error_mark_node is returned to indicate failure. */
static tree
-determine_specialization (template_id, decl, targs_out,
- need_member_template)
- tree template_id;
- tree decl;
- tree* targs_out;
- int need_member_template;
+determine_specialization (tree template_id,
+ tree decl,
+ tree* targs_out,
+ int need_member_template)
{
tree fns;
tree targs;
@@ -1155,6 +1249,7 @@ determine_specialization (template_id, decl, targs_out,
if (TREE_CODE (fn) == TEMPLATE_DECL)
{
tree decl_arg_types;
+ tree fn_arg_types;
/* DECL might be a specialization of FN. */
@@ -1171,8 +1266,16 @@ determine_specialization (template_id, decl, targs_out,
The specialization f<int> is invalid but is not caught
by get_bindings below. */
- if (list_length (TYPE_ARG_TYPES (TREE_TYPE (fn)))
- != list_length (decl_arg_types))
+ fn_arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ if (list_length (fn_arg_types) != list_length (decl_arg_types))
+ continue;
+
+ /* For a non-static member function, we need to make sure that
+ the const qualification is the same. This can be done by
+ checking the 'this' in the argument list. */
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+ && !same_type_p (TREE_VALUE (fn_arg_types),
+ TREE_VALUE (decl_arg_types)))
continue;
/* See whether this function might be a specialization of this
@@ -1326,10 +1429,8 @@ determine_specialization (template_id, decl, targs_out,
TMPL_TYPES. */
static tree
-copy_default_args_to_explicit_spec_1 (spec_types,
- tmpl_types)
- tree spec_types;
- tree tmpl_types;
+copy_default_args_to_explicit_spec_1 (tree spec_types,
+ tree tmpl_types)
{
tree new_spec_types;
@@ -1362,8 +1463,7 @@ copy_default_args_to_explicit_spec_1 (spec_types,
is consistent with how implicit instantiations are handled. */
static void
-copy_default_args_to_explicit_spec (decl)
- tree decl;
+copy_default_args_to_explicit_spec (tree decl)
{
tree tmpl;
tree spec_types;
@@ -1428,15 +1528,15 @@ copy_default_args_to_explicit_spec (decl)
TREE_VALUE (in_charge),
new_spec_types);
- new_type = build_cplus_method_type (object_type,
- TREE_TYPE (old_type),
- new_spec_types);
+ new_type = build_method_type_directly (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 = cp_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;
@@ -1480,11 +1580,10 @@ copy_default_args_to_explicit_spec (decl)
for that template. */
tree
-check_explicit_specialization (declarator, decl, template_count, flags)
- tree declarator;
- tree decl;
- int template_count;
- int flags;
+check_explicit_specialization (tree declarator,
+ tree decl,
+ int template_count,
+ int flags)
{
int have_def = flags & 2;
int is_friend = flags & 4;
@@ -1638,15 +1737,21 @@ check_explicit_specialization (declarator, decl, template_count, flags)
{
tree fns;
- my_friendly_assert (TREE_CODE (declarator) == IDENTIFIER_NODE,
- 0);
- if (!ctype)
- fns = IDENTIFIER_NAMESPACE_VALUE (dname);
- else
+ my_friendly_assert (TREE_CODE (declarator) == IDENTIFIER_NODE, 0);
+ if (ctype)
fns = dname;
+ else
+ {
+ /* If there is no class context, the explicit instantiation
+ must be at namespace scope. */
+ my_friendly_assert (DECL_NAMESPACE_SCOPE_P (decl), 20030625);
+
+ /* Find the namespace binding, using the declaration
+ context. */
+ fns = namespace_binding (dname, CP_DECL_CONTEXT (decl));
+ }
- declarator =
- lookup_template_function (fns, NULL_TREE);
+ declarator = lookup_template_function (fns, NULL_TREE);
}
if (declarator == error_mark_node)
@@ -1678,15 +1783,6 @@ check_explicit_specialization (declarator, decl, template_count, flags)
return decl;
}
- 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. */
- my_friendly_assert (is_friend != 0, 0);
- my_friendly_assert (!explicit_instantiation, 0);
- SET_DECL_IMPLICIT_INSTANTIATION (decl);
- return decl;
- }
else if (ctype != NULL_TREE
&& (TREE_CODE (TREE_OPERAND (declarator, 0)) ==
IDENTIFIER_NODE))
@@ -1809,20 +1905,15 @@ check_explicit_specialization (declarator, decl, template_count, flags)
targs = new_targs;
}
- return instantiate_template (tmpl, targs);
+ return instantiate_template (tmpl, targs, tf_error);
}
/* 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. We also have
- to adjust last_function_parms to avoid confusing
- start_function later. */
+ 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);
- last_function_parms = TREE_CHAIN (last_function_parms);
- }
+ revert_static_member_fn (decl);
/* If this is a specialization of a member template of a
template class. In we want to return the TEMPLATE_DECL,
@@ -1831,6 +1922,12 @@ check_explicit_specialization (declarator, decl, template_count, flags)
{
SET_DECL_TEMPLATE_SPECIALIZATION (tmpl);
DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl)) = NULL_TREE;
+ if (have_def)
+ {
+ DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl);
+ DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (tmpl))
+ = DECL_SOURCE_LOCATION (decl);
+ }
return tmpl;
}
@@ -1870,8 +1967,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
and such is reasonable. Issue error messages if not. */
void
-maybe_check_template_type (type)
- tree type;
+maybe_check_template_type (tree type)
{
if (template_header_count)
{
@@ -1914,9 +2010,7 @@ maybe_check_template_type (type)
parameters. These are represented in the same format used for
DECL_TEMPLATE_PARMS. */
-int comp_template_parms (parms1, parms2)
- tree parms1;
- tree parms2;
+int comp_template_parms (tree parms1, tree parms2)
{
tree p1;
tree p2;
@@ -1967,8 +2061,7 @@ int comp_template_parms (parms1, parms2)
scope (including nested scopes). */
void
-check_template_shadow (decl)
- tree decl;
+check_template_shadow (tree decl)
{
tree olddecl;
@@ -2009,12 +2102,11 @@ check_template_shadow (decl)
ORIG_LEVEL, DECL, and TYPE. */
static tree
-build_template_parm_index (index, level, orig_level, decl, type)
- int index;
- int level;
- int orig_level;
- tree decl;
- tree type;
+build_template_parm_index (int index,
+ int level,
+ int orig_level,
+ tree decl,
+ tree type)
{
tree t = make_node (TEMPLATE_PARM_INDEX);
TEMPLATE_PARM_IDX (t) = index;
@@ -2022,6 +2114,8 @@ build_template_parm_index (index, level, orig_level, decl, type)
TEMPLATE_PARM_ORIG_LEVEL (t) = orig_level;
TEMPLATE_PARM_DECL (t) = decl;
TREE_TYPE (t) = type;
+ TREE_CONSTANT (t) = TREE_CONSTANT (decl);
+ TREE_READONLY (t) = TREE_READONLY (decl);
return t;
}
@@ -2032,29 +2126,27 @@ build_template_parm_index (index, level, orig_level, decl, type)
new one is created. */
static tree
-reduce_template_parm_level (index, type, levels)
- tree index;
- tree type;
- int levels;
+reduce_template_parm_level (tree index, tree type, int levels)
{
if (TEMPLATE_PARM_DESCENDANTS (index) == NULL_TREE
|| (TEMPLATE_PARM_LEVEL (TEMPLATE_PARM_DESCENDANTS (index))
!= TEMPLATE_PARM_LEVEL (index) - levels))
{
- tree decl
- = build_decl (TREE_CODE (TEMPLATE_PARM_DECL (index)),
- DECL_NAME (TEMPLATE_PARM_DECL (index)),
- type);
- tree t
- = build_template_parm_index (TEMPLATE_PARM_IDX (index),
+ tree orig_decl = TEMPLATE_PARM_DECL (index);
+ tree decl, t;
+
+ decl = build_decl (TREE_CODE (orig_decl), DECL_NAME (orig_decl), type);
+ TREE_CONSTANT (decl) = TREE_CONSTANT (orig_decl);
+ TREE_READONLY (decl) = TREE_READONLY (orig_decl);
+ DECL_ARTIFICIAL (decl) = 1;
+ SET_DECL_TEMPLATE_PARM_P (decl);
+
+ t = build_template_parm_index (TEMPLATE_PARM_IDX (index),
TEMPLATE_PARM_LEVEL (index) - levels,
TEMPLATE_PARM_ORIG_LEVEL (index),
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));
@@ -2067,8 +2159,7 @@ reduce_template_parm_level (index, type, levels)
LIST being built. */
tree
-process_template_parm (list, next)
- tree list, next;
+process_template_parm (tree list, tree next)
{
tree parm;
tree decl = 0;
@@ -2109,10 +2200,11 @@ process_template_parm (list, next)
TREE_TYPE (parm) = TYPE_MAIN_VARIANT (TREE_TYPE (parm));
/* A template parameter is not modifiable. */
- TREE_READONLY (parm) = 1;
+ TREE_READONLY (parm) = TREE_CONSTANT (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));
+ TREE_CONSTANT (decl) = TREE_READONLY (decl) = 1;
DECL_INITIAL (parm) = DECL_INITIAL (decl)
= build_template_parm_index (idx, processing_template_decl,
processing_template_decl,
@@ -2135,7 +2227,7 @@ process_template_parm (list, next)
else
{
t = make_aggr_type (TEMPLATE_TYPE_PARM);
- /* parm is either IDENTIFIER_NODE or NULL_TREE */
+ /* parm is either IDENTIFIER_NODE or NULL_TREE. */
decl = build_decl (TYPE_DECL, parm, t);
}
@@ -2160,8 +2252,7 @@ process_template_parm (list, next)
as PARM_DECLs. */
tree
-end_template_parm_list (parms)
- tree parms;
+end_template_parm_list (tree parms)
{
int nparms;
tree parm, next;
@@ -2186,7 +2277,7 @@ end_template_parm_list (parms)
/* end_template_decl is called after a template declaration is seen. */
void
-end_template_decl ()
+end_template_decl (void)
{
reset_specialization ();
@@ -2204,7 +2295,7 @@ end_template_decl ()
The innermost PARMS are given first. */
tree
-current_template_args ()
+current_template_args (void)
{
tree header;
tree args = NULL_TREE;
@@ -2256,9 +2347,7 @@ current_template_args ()
template PARMS. Used by push_template_decl below. */
static tree
-build_template_decl (decl, parms)
- tree decl;
- tree parms;
+build_template_decl (tree decl, tree parms)
{
tree tmpl = build_lang_decl (TEMPLATE_DECL, DECL_NAME (decl), NULL_TREE);
DECL_TEMPLATE_PARMS (tmpl) = parms;
@@ -2306,9 +2395,7 @@ struct template_parm_data
appropriately. */
static int
-mark_template_parm (t, data)
- tree t;
- void* data;
+mark_template_parm (tree t, void* data)
{
int level;
int idx;
@@ -2339,8 +2426,7 @@ mark_template_parm (t, data)
/* Process the partial specialization DECL. */
static tree
-process_partial_specialization (decl)
- tree decl;
+process_partial_specialization (tree decl)
{
tree type = TREE_TYPE (decl);
tree maintmpl = CLASSTYPE_TI_TEMPLATE (type);
@@ -2387,10 +2473,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);
- memset ((PTR) tpd.parms, 0, sizeof (int) * ntparms);
+ memset (tpd.parms, 0, sizeof (int) * ntparms);
tpd.arg_uses_template_parms = alloca (sizeof (int) * nargs);
- memset ((PTR) tpd.arg_uses_template_parms, 0, sizeof (int) * nargs);
+ memset (tpd.arg_uses_template_parms, 0, sizeof (int) * nargs);
for (i = 0; i < nargs; ++i)
{
tpd.current_arg = i;
@@ -2461,11 +2547,11 @@ process_partial_specialization (decl)
{
/* We haven't yet initialized TPD2. Do so now. */
tpd2.arg_uses_template_parms
- = (int*) alloca (sizeof (int) * nargs);
+ = alloca (sizeof (int) * nargs);
/* The number of parameters here is the number in the
main template, which, as checked in the assertion
above, is NARGS. */
- tpd2.parms = (int*) alloca (sizeof (int) * nargs);
+ tpd2.parms = alloca (sizeof (int) * nargs);
tpd2.level =
TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (maintmpl));
}
@@ -2475,7 +2561,7 @@ process_partial_specialization (decl)
template, not in the specialization. */
tpd2.current_arg = i;
tpd2.arg_uses_template_parms[i] = 0;
- memset ((PTR) tpd2.parms, 0, sizeof (int) * nargs);
+ memset (tpd2.parms, 0, sizeof (int) * nargs);
for_each_template_parm (type,
&mark_template_parm,
&tpd2,
@@ -2518,11 +2604,7 @@ process_partial_specialization (decl)
IS_PARTIAL is nonzero if DECL is a partial specialization. */
static void
-check_default_tmpl_args (decl, parms, is_primary, is_partial)
- tree decl;
- tree parms;
- int is_primary;
- int is_partial;
+check_default_tmpl_args (tree decl, tree parms, int is_primary, int is_partial)
{
const char *msg;
int last_level_to_check;
@@ -2546,14 +2628,15 @@ check_default_tmpl_args (decl, parms, is_primary, is_partial)
&& DECL_LANG_SPECIFIC (decl)
/* If this is either a friend defined in the scope of the class
or a member function. */
- && ((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)))
+ && (DECL_FUNCTION_MEMBER_P (decl)
+ ? same_type_p (DECL_CONTEXT (decl), current_class_type)
+ : DECL_FRIEND_CONTEXT (decl)
+ ? same_type_p (DECL_FRIEND_CONTEXT (decl), current_class_type)
+ : false)
/* And, if it was a member function, it really was defined in
the scope of the class. */
- && (!DECL_FUNCTION_MEMBER_P (decl) || DECL_INITIALIZED_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
@@ -2665,9 +2748,7 @@ check_default_tmpl_args (decl, parms, is_primary, is_partial)
parameter of that level, return nonzero. */
static int
-template_parm_this_level_p (t, data)
- tree t;
- void *data;
+template_parm_this_level_p (tree t, void* data)
{
int this_level = *(int *)data;
int level;
@@ -2687,9 +2768,7 @@ template_parm_this_level_p (t, data)
If IS_FRIEND is nonzero, DECL is a friend declaration. */
tree
-push_template_decl_real (decl, is_friend)
- tree decl;
- int is_friend;
+push_template_decl_real (tree decl, int is_friend)
{
tree tmpl;
tree args;
@@ -2736,13 +2815,25 @@ push_template_decl_real (decl, is_friend)
else if (TREE_CODE (decl) == TYPE_DECL
&& ANON_AGGRNAME_P (DECL_NAME (decl)))
error ("template class without a name");
+ else if (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_DESTRUCTOR_P (decl))
+ {
+ /* [temp.mem]
+
+ A destructor shall not be a member template. */
+ error ("destructor `%D' declared as member template", decl);
+ return error_mark_node;
+ }
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);
+ {
+ error ("template declaration of `%#D'", decl);
+ return error_mark_node;
+ }
}
/* Check to see that the rules regarding the use of default
@@ -2757,9 +2848,7 @@ push_template_decl_real (decl, is_friend)
if (!ctx
|| TREE_CODE (ctx) == FUNCTION_DECL
- || (TREE_CODE (ctx) != TEMPLATE_TYPE_PARM
- && TREE_CODE (ctx) != BOUND_TEMPLATE_TEMPLATE_PARM
- && TYPE_BEING_DEFINED (ctx))
+ || (CLASS_TYPE_P (ctx) && TYPE_BEING_DEFINED (ctx))
|| (is_friend && !DECL_TEMPLATE_INFO (decl)))
{
if (DECL_LANG_SPECIFIC (decl)
@@ -2824,10 +2913,10 @@ push_template_decl_real (decl, is_friend)
else
tmpl = DECL_TI_TEMPLATE (decl);
- if (is_member_template (tmpl)
- && DECL_FUNCTION_TEMPLATE_P (tmpl)
+ if (DECL_FUNCTION_TEMPLATE_P (tmpl)
&& DECL_TEMPLATE_INFO (decl) && DECL_TI_ARGS (decl)
- && DECL_TEMPLATE_SPECIALIZATION (decl))
+ && DECL_TEMPLATE_SPECIALIZATION (decl)
+ && is_member_template (tmpl))
{
tree new_tmpl;
@@ -2910,14 +2999,19 @@ push_template_decl_real (decl, is_friend)
/* It is a conversion operator. See if the type converted to
depends on innermost template operands. */
- if (for_each_template_parm (TREE_TYPE (TREE_TYPE (tmpl)),
- template_parm_this_level_p,
- &depth,
- NULL))
+ if (uses_template_parms_level (TREE_TYPE (TREE_TYPE (tmpl)),
+ depth))
DECL_TEMPLATE_CONV_FN_P (tmpl) = 1;
}
}
+ /* The DECL_TI_ARGS of DECL contains full set of arguments refering
+ back to its most general template. If TMPL is a specialization,
+ ARGS may only have the innermost set of arguments. Add the missing
+ argument levels if necessary. */
+ if (DECL_TEMPLATE_INFO (tmpl))
+ args = add_outermost_template_args (DECL_TI_ARGS (tmpl), args);
+
info = tree_cons (tmpl, args, NULL_TREE);
if (DECL_IMPLICIT_TYPEDEF_P (decl))
@@ -2936,8 +3030,7 @@ push_template_decl_real (decl, is_friend)
}
tree
-push_template_decl (decl)
- tree decl;
+push_template_decl (tree decl)
{
return push_template_decl_real (decl, 0);
}
@@ -2949,9 +3042,7 @@ push_template_decl (decl)
template <class T> struct S {}; */
void
-redeclare_class_template (type, parms)
- tree type;
- tree parms;
+redeclare_class_template (tree type, tree parms)
{
tree tmpl;
tree tmpl_parms;
@@ -3004,7 +3095,7 @@ redeclare_class_template (type, parms)
A template-parameter may not be given default arguments
by two different declarations in the same scope. */
error ("redefinition of default argument for `%#D'", parm);
- cp_error_at (" original definition appeared here", tmpl_parm);
+ error ("%J original definition appeared here", tmpl_parm);
return;
}
@@ -3019,22 +3110,60 @@ redeclare_class_template (type, parms)
}
}
+/* Simplify EXPR if it is a non-dependent expression. Returns the
+ (possibly simplified) expression. */
+
+tree
+fold_non_dependent_expr (tree expr)
+{
+ /* If we're in a template, but EXPR isn't value dependent, simplify
+ it. We're supposed to treat:
+
+ template <typename T> void f(T[1 + 1]);
+ template <typename T> void f(T[2]);
+
+ as two declarations of the same function, for example. */
+ if (processing_template_decl
+ && !type_dependent_expression_p (expr)
+ && !value_dependent_expression_p (expr))
+ {
+ HOST_WIDE_INT saved_processing_template_decl;
+
+ saved_processing_template_decl = processing_template_decl;
+ processing_template_decl = 0;
+ expr = tsubst_copy_and_build (expr,
+ /*args=*/NULL_TREE,
+ tf_error,
+ /*in_decl=*/NULL_TREE,
+ /*function_p=*/false);
+ processing_template_decl = saved_processing_template_decl;
+ }
+ return expr;
+}
+
/* 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 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
- might be just trying to do argument deduction. By the time this
- function is called, neither TYPE nor EXPR may make use of template
- parameters. */
+ might be just trying to do argument deduction. Both TYPE and EXPR
+ must be non-dependent. */
static tree
-convert_nontype_argument (type, expr)
- tree type;
- tree expr;
+convert_nontype_argument (tree type, tree expr)
{
- tree expr_type = TREE_TYPE (expr);
+ tree expr_type;
+
+ /* If we are in a template, EXPR may be non-dependent, but still
+ have a syntactic, rather than semantic, form. For example, EXPR
+ might be a SCOPE_REF, rather than the VAR_DECL to which the
+ SCOPE_REF refers. Preserving the qualifying scope is necessary
+ so that access checking can be performed when the template is
+ instantiated -- but here we need the resolved form so that we can
+ convert the argument. */
+ expr = fold_non_dependent_expr (expr);
+ expr_type = TREE_TYPE (expr);
/* A template-argument for a non-type, non-template
template-parameter shall be one of:
@@ -3058,26 +3187,43 @@ 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. Simplify things by folding them to their values,
+. 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 (INTEGRAL_TYPE_P (expr_type) && TREE_CODE (type) != REFERENCE_TYPE)
+ while (true)
+ {
+ tree const_expr = decl_constant_value (expr);
+ /* In a template, the initializer for a VAR_DECL may not be
+ marked as TREE_CONSTANT, in which case decl_constant_value
+ will not return the initializer. Handle that special case
+ here. */
+ if (expr == const_expr
+ && TREE_CODE (expr) == VAR_DECL
+ && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (expr)
+ && CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (expr))
+ /* DECL_INITIAL can be NULL if we are processing a
+ variable initialized to an expression involving itself.
+ We know it is initialized to a constant -- but not what
+ constant, yet. */
+ && DECL_INITIAL (expr))
+ const_expr = DECL_INITIAL (expr);
+ if (expr == const_expr)
+ break;
+ expr = fold_non_dependent_expr (const_expr);
+ }
if (is_overloaded_fn (expr))
/* OK for now. We'll check that it has external linkage later.
Check this first since if expr_type is the unknown_type_node
we would otherwise complain below. */
;
- else if (TYPE_PTRMEM_P (expr_type)
- || TYPE_PTRMEMFUNC_P (expr_type))
+ else if (TYPE_PTR_TO_MEMBER_P (expr_type))
{
if (TREE_CODE (expr) != PTRMEM_CST)
goto bad_argument;
}
else if (TYPE_PTR_P (expr_type)
- || TYPE_PTRMEM_P (expr_type)
|| TREE_CODE (expr_type) == ARRAY_TYPE
|| TREE_CODE (type) == REFERENCE_TYPE
/* If expr is the address of an overloaded function, we
@@ -3105,8 +3251,7 @@ convert_nontype_argument (type, expr)
else
error ("it must be the address of an object with external linkage");
}
- else if (TYPE_PTRMEM_P (expr_type)
- || TYPE_PTRMEMFUNC_P (expr_type))
+ else if (TYPE_PTR_TO_MEMBER_P (expr_type))
error ("it must be a pointer-to-member of the form `&X::Y'");
return NULL_TREE;
@@ -3123,6 +3268,9 @@ convert_nontype_argument (type, expr)
return NULL_TREE;
}
+ if (TREE_CODE (referent) == SCOPE_REF)
+ referent = TREE_OPERAND (referent, 1);
+
if (is_overloaded_fn (referent))
/* We'll check that it has external linkage later. */
;
@@ -3134,9 +3282,7 @@ convert_nontype_argument (type, expr)
return error_mark_node;
}
}
- else if (INTEGRAL_TYPE_P (expr_type)
- || TYPE_PTRMEM_P (expr_type)
- || TYPE_PTRMEMFUNC_P (expr_type))
+ else if (INTEGRAL_TYPE_P (expr_type) || TYPE_PTR_TO_MEMBER_P (expr_type))
{
if (! TREE_CONSTANT (expr))
{
@@ -3148,7 +3294,14 @@ convert_nontype_argument (type, expr)
}
else
{
- error ("object `%E' cannot be used as template argument", expr);
+ if (TYPE_P (expr))
+ error ("type '%T' cannot be used as a value for a non-type "
+ "template-parameter", expr);
+ else if (DECL_P (expr))
+ error ("invalid use of '%D' as a non-type template-argument", expr);
+ else
+ error ("invalid use of '%E' as a non-type template-argument", expr);
+
return NULL_TREE;
}
@@ -3174,31 +3327,32 @@ convert_nontype_argument (type, expr)
goto non_constant;
return expr;
-
+
+ case OFFSET_TYPE:
+ {
+ tree e;
+
+ /* For a non-type template-parameter of type pointer to data
+ member, qualification conversions (_conv.qual_) are
+ applied. */
+ e = perform_qualification_conversions (type, expr);
+ if (TREE_CODE (e) == NOP_EXPR)
+ /* The call to perform_qualification_conversions will
+ insert a NOP_EXPR over EXPR to do express conversion,
+ if necessary. But, that will confuse us if we use
+ this (converted) template parameter to instantiate
+ another template; then the thing will not look like a
+ valid template argument. So, just make a new
+ constant, of the appropriate type. */
+ e = make_ptrmem_cst (type, PTRMEM_CST_MEMBER (expr));
+ return e;
+ }
+
case POINTER_TYPE:
{
tree type_pointed_to = TREE_TYPE (type);
- if (TYPE_PTRMEM_P (type))
- {
- tree e;
-
- /* For a non-type template-parameter of type pointer to data
- member, qualification conversions (_conv.qual_) are
- applied. */
- e = perform_qualification_conversions (type, expr);
- if (TREE_CODE (e) == NOP_EXPR)
- /* The call to perform_qualification_conversions will
- insert a NOP_EXPR over EXPR to do express conversion,
- if necessary. But, that will confuse us if we use
- this (converted) template parameter to instantiate
- another template; then the thing will not look like a
- valid template argument. So, just make a new
- constant, of the appropriate type. */
- e = make_ptrmem_cst (type, PTRMEM_CST_MEMBER (expr));
- return e;
- }
- else if (TREE_CODE (type_pointed_to) == FUNCTION_TYPE)
+ if (TREE_CODE (type_pointed_to) == FUNCTION_TYPE)
{
/* For a non-type template-parameter of type pointer to
function, only the function-to-pointer conversion
@@ -3262,9 +3416,12 @@ convert_nontype_argument (type, expr)
tree type_referred_to = TREE_TYPE (type);
/* If this expression already has reference type, get the
- underling object. */
+ underlying object. */
if (TREE_CODE (expr_type) == REFERENCE_TYPE)
{
+ if (TREE_CODE (expr) == NOP_EXPR
+ && TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR)
+ STRIP_NOPS (expr);
my_friendly_assert (TREE_CODE (expr) == ADDR_EXPR, 20000604);
expr = TREE_OPERAND (expr, 0);
expr_type = TREE_TYPE (expr);
@@ -3318,7 +3475,7 @@ convert_nontype_argument (type, expr)
}
cxx_mark_addressable (expr);
- return build1 (ADDR_EXPR, type, expr);
+ return build_nop (type, build_address (expr));
}
break;
@@ -3353,8 +3510,9 @@ convert_nontype_argument (type, expr)
if (expr == error_mark_node)
return error_mark_node;
- my_friendly_assert (same_type_p (type, TREE_TYPE (expr)),
- 0);
+ if (!same_type_p (type, TREE_TYPE (expr)))
+ return error_mark_node;
+
return expr;
}
break;
@@ -3386,11 +3544,11 @@ convert_nontype_argument (type, expr)
substitute the TT parameter. */
static int
-coerce_template_template_parms (parm_parms, arg_parms, complain,
- in_decl, outer_args)
- tree parm_parms, arg_parms;
- tsubst_flags_t complain;
- tree in_decl, outer_args;
+coerce_template_template_parms (tree parm_parms,
+ tree arg_parms,
+ tsubst_flags_t complain,
+ tree in_decl,
+ tree outer_args)
{
int nparms, nargs, i;
tree parm, arg;
@@ -3432,9 +3590,8 @@ coerce_template_template_parms (parm_parms, arg_parms, 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,
- outer_args))
+ if (!coerce_template_template_parms
+ (parmparm, argparm, complain, in_decl, outer_args))
return 0;
}
break;
@@ -3443,9 +3600,9 @@ coerce_template_template_parms (parm_parms, arg_parms, complain,
/* The tsubst call is used to handle cases such as
template <class T, template <T> class TT> class D;
i.e. the parameter list of TT depends on earlier parameters. */
- if (!same_type_p (tsubst (TREE_TYPE (parm), outer_args,
- complain, in_decl),
- TREE_TYPE (arg)))
+ if (!same_type_p
+ (tsubst (TREE_TYPE (parm), outer_args, complain, in_decl),
+ TREE_TYPE (arg)))
return 0;
break;
@@ -3464,13 +3621,12 @@ coerce_template_template_parms (parm_parms, arg_parms, complain,
the full set of template arguments deduced so far. */
static tree
-convert_template_argument (parm, arg, args, complain, i, in_decl)
- tree parm;
- tree arg;
- tree args;
- tsubst_flags_t complain;
- int i;
- tree in_decl;
+convert_template_argument (tree parm,
+ tree arg,
+ tree args,
+ tsubst_flags_t complain,
+ int i,
+ tree in_decl)
{
tree val;
tree inner_args;
@@ -3479,8 +3635,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
inner_args = INNERMOST_TEMPLATE_ARGS (args);
if (TREE_CODE (arg) == TREE_LIST
- && TREE_TYPE (arg) != NULL_TREE
- && TREE_CODE (TREE_TYPE (arg)) == OFFSET_TYPE)
+ && TREE_CODE (TREE_VALUE (arg)) == OFFSET_REF)
{
/* The template argument was the name of some
member function. That's usually
@@ -3495,28 +3650,15 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
requires_type = (TREE_CODE (parm) == TYPE_DECL
|| requires_tmpl_type);
- 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_IS_TEMPLATE (arg)
- && 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
- /* 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;
+ 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);
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 = TYPE_P (arg) || is_tmpl_type;
@@ -3542,6 +3684,8 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
error (" expected a constant of type `%T', got `%T'",
TREE_TYPE (parm),
(is_tmpl_type ? DECL_NAME (arg) : arg));
+ else if (requires_tmpl_type)
+ error (" expected a class template, got `%E'", arg);
else
error (" expected a type, got `%E'", arg);
}
@@ -3601,39 +3745,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
}
}
else
- {
- val = groktypename (arg);
- if (! processing_template_decl)
- {
- /* [basic.link]: A name with no linkage (notably, the
- name of a class or enumeration declared in a local
- scope) shall not be used to declare an entity with
- linkage. This implies that names with no linkage
- cannot be used as template arguments. */
- tree t = no_linkage_check (val);
- if (t)
- {
- if (TYPE_ANONYMOUS_P (t))
- pedwarn
- ("template-argument `%T' uses anonymous type", val);
- else
- error
- ("template-argument `%T' uses local type `%T'",
- val, t);
- return error_mark_node;
- }
-
- /* In order to avoid all sorts of complications, we do
- not allow variably-modified types as template
- arguments. */
- if (variably_modified_type_p (val))
- {
- error ("template-argument `%T' is a variably modified type",
- val);
- return error_mark_node;
- }
- }
- }
+ val = groktypename (arg);
}
else
{
@@ -3642,9 +3754,6 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
if (invalid_nontype_parm_type_p (t, complain))
return error_mark_node;
- if (processing_template_decl)
- arg = maybe_fold_nontype_arg (arg);
-
if (!uses_template_parms (arg) && !uses_template_parms (t))
/* We used to call digest_init here. However, digest_init
will report errors, which we don't want when complain
@@ -3673,9 +3782,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
/* Convert all template arguments to their appropriate types, and
return a vector containing the innermost resulting template
arguments. If any error occurs, return error_mark_node. Error and
- warning messages are issued under control of COMPLAIN. Some error
- messages are issued even if COMPLAIN is zero; for instance, if a
- template argument is composed from a local class.
+ warning messages are issued under control of COMPLAIN.
If REQUIRE_ALL_ARGUMENTS is nonzero, all arguments must be
provided in ARGLIST, or else trailing parameters must have default
@@ -3683,13 +3790,11 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
deduction for any unspecified trailing arguments. */
static tree
-coerce_template_parms (parms, args, in_decl,
- complain,
- require_all_arguments)
- tree parms, args;
- tree in_decl;
- tsubst_flags_t complain;
- int require_all_arguments;
+coerce_template_parms (tree parms,
+ tree args,
+ tree in_decl,
+ tsubst_flags_t complain,
+ int require_all_arguments)
{
int nparms, nargs, i, lost = 0;
tree inner_args;
@@ -3697,7 +3802,7 @@ coerce_template_parms (parms, args, in_decl,
tree new_inner_args;
inner_args = INNERMOST_TEMPLATE_ARGS (args);
- nargs = NUM_TMPL_ARGS (inner_args);
+ nargs = inner_args ? NUM_TMPL_ARGS (inner_args) : 0;
nparms = TREE_VEC_LENGTH (parms);
if (nargs > nparms
@@ -3728,39 +3833,18 @@ coerce_template_parms (parms, args, in_decl,
parm = TREE_VEC_ELT (parms, i);
/* Calculate the Ith argument. */
- if (inner_args && TREE_CODE (inner_args) == TREE_LIST)
- {
- arg = TREE_VALUE (inner_args);
- inner_args = TREE_CHAIN (inner_args);
- }
- else if (i < nargs)
+ if (i < nargs)
arg = TREE_VEC_ELT (inner_args, i);
- /* If no template argument was supplied, look for a default
- value. */
- else if (TREE_PURPOSE (parm) == NULL_TREE)
- {
- /* There was no default value. */
- my_friendly_assert (!require_all_arguments, 0);
- break;
- }
- else if (TREE_CODE (TREE_VALUE (parm)) == TYPE_DECL)
- arg = tsubst (TREE_PURPOSE (parm), new_args, complain, in_decl);
+ else if (require_all_arguments)
+ /* There must be a default arg in this case. */
+ arg = tsubst_template_arg (TREE_PURPOSE (parm), new_args,
+ complain, in_decl);
else
- arg = tsubst_expr (TREE_PURPOSE (parm), new_args, complain,
- in_decl);
-
- /* Now, convert the Ith argument, as necessary. */
- if (arg == NULL_TREE)
- /* We're out of arguments. */
- {
- my_friendly_assert (!require_all_arguments, 0);
- break;
- }
- else if (arg == error_mark_node)
- {
- error ("template argument %d is invalid", i + 1);
- arg = error_mark_node;
- }
+ break;
+
+ my_friendly_assert (arg, 20030727);
+ if (arg == error_mark_node)
+ error ("template argument %d is invalid", i + 1);
else
arg = convert_template_argument (TREE_VALUE (parm),
arg, new_args, complain, i,
@@ -3780,8 +3864,7 @@ coerce_template_parms (parms, args, in_decl,
/* Returns 1 if template args OT and NT are equivalent. */
static int
-template_args_equal (ot, nt)
- tree ot, nt;
+template_args_equal (tree ot, tree nt)
{
if (nt == ot)
return 1;
@@ -3794,15 +3877,14 @@ template_args_equal (ot, nt)
else if (TREE_CODE (ot) == TREE_VEC || TYPE_P (ot))
return 0;
else
- return (cp_tree_equal (ot, nt) > 0);
+ return cp_tree_equal (ot, nt);
}
/* Returns 1 iff the OLDARGS and NEWARGS are in fact identical sets
of template arguments. Returns 0 otherwise. */
int
-comp_template_args (oldargs, newargs)
- tree oldargs, newargs;
+comp_template_args (tree oldargs, tree newargs)
{
int i;
@@ -3824,9 +3906,7 @@ comp_template_args (oldargs, newargs)
for the instantiation. */
static char *
-mangle_class_name_for_template (name, parms, arglist)
- const char *name;
- tree parms, arglist;
+mangle_class_name_for_template (const char* name, tree parms, tree arglist)
{
static struct obstack scratch_obstack;
static char *scratch_firstobj;
@@ -3879,20 +3959,13 @@ mangle_class_name_for_template (name, parms, arglist)
cat (IDENTIFIER_POINTER (DECL_NAME (arg)));
}
else
- /* Output the parameter declaration */
+ /* Output the parameter declaration. */
cat (type_as_string (arg, TFF_CHASE_TYPEDEF));
continue;
}
else
my_friendly_assert (TREE_CODE (parm) == PARM_DECL, 269);
- if (TREE_CODE (arg) == TREE_LIST)
- {
- /* New list cell was built because old chain link was in
- use. */
- my_friendly_assert (TREE_PURPOSE (arg) == NULL_TREE, 270);
- arg = TREE_VALUE (arg);
- }
/* 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, TFF_PLAIN_IDENTIFIER));
@@ -3914,8 +3987,7 @@ mangle_class_name_for_template (name, parms, arglist)
}
static tree
-classtype_mangled_name (t)
- tree t;
+classtype_mangled_name (tree t)
{
if (CLASSTYPE_TEMPLATE_INFO (t)
/* Specializations have already had their names set up in
@@ -3943,8 +4015,7 @@ classtype_mangled_name (t)
}
static void
-add_pending_template (d)
- tree d;
+add_pending_template (tree d)
{
tree ti = (TYPE_P (d)
? CLASSTYPE_TEMPLATE_INFO (d)
@@ -3983,15 +4054,15 @@ add_pending_template (d)
documentation for TEMPLATE_ID_EXPR. */
tree
-lookup_template_function (fns, arglist)
- tree fns, arglist;
+lookup_template_function (tree fns, tree arglist)
{
tree type;
if (fns == error_mark_node || arglist == error_mark_node)
return error_mark_node;
- if (fns == NULL_TREE
+ my_friendly_assert (!arglist || TREE_CODE (arglist) == TREE_VEC, 20030726);
+ if (fns == NULL_TREE
|| TREE_CODE (fns) == FUNCTION_DECL)
{
error ("non-template used as template");
@@ -4001,8 +4072,7 @@ lookup_template_function (fns, arglist)
my_friendly_assert (TREE_CODE (fns) == TEMPLATE_DECL
|| TREE_CODE (fns) == OVERLOAD
|| BASELINK_P (fns)
- || TREE_CODE (fns) == IDENTIFIER_NODE
- || TREE_CODE (fns) == LOOKUP_EXPR,
+ || TREE_CODE (fns) == IDENTIFIER_NODE,
20020730);
if (BASELINK_P (fns))
@@ -4028,9 +4098,8 @@ lookup_template_function (fns, arglist)
return the associated TEMPLATE_DECL. Otherwise, the original
DECL is returned. */
-static tree
-maybe_get_template_decl_from_type_decl (decl)
- tree decl;
+tree
+maybe_get_template_decl_from_type_decl (tree decl)
{
return (decl != NULL_TREE
&& TREE_CODE (decl) == TYPE_DECL
@@ -4044,9 +4113,6 @@ maybe_get_template_decl_from_type_decl (decl)
parameters, find the desired type.
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.)
IN_DECL, if non-NULL, is the template declaration we are trying to
instantiate.
@@ -4061,17 +4127,18 @@ maybe_get_template_decl_from_type_decl (decl)
being instantiated. */
tree
-lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
- tree d1, arglist;
- tree in_decl;
- tree context;
- int entering_scope;
- tsubst_flags_t complain;
+lookup_template_class (tree d1,
+ tree arglist,
+ tree in_decl,
+ tree context,
+ int entering_scope,
+ tsubst_flags_t complain)
{
tree template = NULL_TREE, parmlist;
tree t;
-
+
timevar_push (TV_NAME_LOOKUP);
+
if (TREE_CODE (d1) == IDENTIFIER_NODE)
{
if (IDENTIFIER_VALUE (d1)
@@ -4088,20 +4155,10 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
}
if (template)
context = DECL_CONTEXT (template);
- if (template
- && TREE_CODE (template) == TYPE_DECL
- && IS_AGGR_TYPE (TREE_TYPE (template))
- && TREE_CODE (TREE_TYPE (template)) != TEMPLATE_TYPE_PARM)
- {
- d1 = template;
- goto type_decl;
- }
}
else if (TREE_CODE (d1) == TYPE_DECL && IS_AGGR_TYPE (TREE_TYPE (d1)))
{
- tree type;
- type_decl:
- type = TREE_TYPE (d1);
+ tree type = TREE_TYPE (d1);
/* If we are declaring a constructor, say A<T>::A<T>, we will get
an implicit typename for the second A. Deal with it. */
@@ -4141,11 +4198,10 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
}
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)))
+ /* Make sure it's a user visible template, if it was named by
+ the user. */
+ || ((complain & tf_user) && !DECL_TEMPLATE_PARM_P (template)
+ && !PRIMARY_TEMPLATE_P (template)))
{
if (complain & tf_error)
{
@@ -4156,6 +4212,8 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
+ complain &= ~tf_user;
+
if (DECL_TEMPLATE_TEMPLATE_PARM_P (template))
{
/* Create a new TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM node to store
@@ -4187,8 +4245,10 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
arglist2 = coerce_template_parms (parmlist, arglist, template,
complain, /*require_all_args=*/1);
- if (arglist2 == error_mark_node)
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ if (arglist2 == error_mark_node
+ || (!uses_template_parms (arglist2)
+ && check_instantiated_args (template, arglist2, complain)))
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
parm = bind_template_template_parm (TREE_TYPE (template), arglist2);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, parm);
@@ -4255,6 +4315,15 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
tree a = coerce_template_parms (TREE_VALUE (t),
arglist, template,
complain, /*require_all_args=*/1);
+
+ /* Don't process further if one of the levels fails. */
+ if (a == error_mark_node)
+ {
+ /* Restore the ARGLIST to its full size. */
+ TREE_VEC_LENGTH (arglist) = saved_depth;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ }
+
SET_TMPL_ARGS_LEVEL (bound_args, i, a);
/* We temporarily reduce the length of the ARGLIST so
@@ -4297,21 +4366,18 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
{
tree ctx;
- /* 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 namespace
- scopes. */
for (ctx = current_class_type;
- ctx;
- ctx = (TYPE_P (ctx)) ? TYPE_CONTEXT (ctx) : DECL_CONTEXT (ctx))
- if (same_type_p (ctx, template_type))
- break;
+ ctx && TREE_CODE (ctx) != NAMESPACE_DECL;
+ ctx = (TYPE_P (ctx)
+ ? TYPE_CONTEXT (ctx)
+ : DECL_CONTEXT (ctx)))
+ if (TYPE_P (ctx) && same_type_p (ctx, template_type))
+ goto found_ctx;
- if (!ctx)
- /* We're not in the scope of the class, so the
- TEMPLATE_TYPE is not the type we want after
- all. */
- found = NULL_TREE;
+ /* We're not in the scope of the class, so the
+ TEMPLATE_TYPE is not the type we want after all. */
+ found = NULL_TREE;
+ found_ctx:;
}
}
if (found)
@@ -4340,6 +4406,14 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
well. */
is_partial_instantiation = uses_template_parms (arglist);
+ /* If the deduced arguments are invalid, then the binding
+ failed. */
+ if (!is_partial_instantiation
+ && check_instantiated_args (template,
+ INNERMOST_TEMPLATE_ARGS (arglist),
+ complain))
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+
if (!is_partial_instantiation
&& !PRIMARY_TEMPLATE_P (template)
&& TREE_CODE (CP_DECL_CONTEXT (template)) == NAMESPACE_DECL)
@@ -4375,7 +4449,6 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
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);
@@ -4486,19 +4559,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
is set up. */
if (TREE_CODE (t) != ENUMERAL_TYPE)
DECL_NAME (type_decl) = classtype_mangled_name (t);
- if (!is_partial_instantiation)
- {
- /* For backwards compatibility; code that uses
- -fexternal-templates expects looking up a template to
- instantiate it. I think DDD still relies on this.
- (jason 8/20/1998) */
- if (TREE_CODE (t) != ENUMERAL_TYPE
- && flag_external_templates
- && CLASSTYPE_INTERFACE_KNOWN (TREE_TYPE (template))
- && ! CLASSTYPE_INTERFACE_ONLY (TREE_TYPE (template)))
- add_pending_template (t);
- }
- else
+ if (is_partial_instantiation)
/* If the type makes use of template parameters, the
code that generates debugging information will crash. */
DECL_IGNORED_P (TYPE_STUB_DECL (t)) = 1;
@@ -4518,26 +4579,12 @@ struct pair_fn_data
/* 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;
+for_each_template_parm_r (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;
- void **slot;
-
- /* If we have already visited this tree, there's no need to walk
- subtrees. Otherwise, add it to the visited table. */
- slot = htab_find_slot (pfd->visited, *tp, INSERT);
- if (*slot)
- {
- *walk_subtrees = 0;
- return NULL_TREE;
- }
- *slot = *tp;
if (TYPE_P (t)
&& for_each_template_parm (TYPE_CONTEXT (t), fn, data, pfd->visited))
@@ -4592,6 +4639,12 @@ for_each_template_parm_r (tp, walk_subtrees, d)
}
break;
+ case TYPEOF_TYPE:
+ if (for_each_template_parm (TYPE_FIELDS (t), fn, data,
+ pfd->visited))
+ return error_mark_node;
+ break;
+
case FUNCTION_DECL:
case VAR_DECL:
if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t)
@@ -4600,8 +4653,12 @@ for_each_template_parm_r (tp, walk_subtrees, d)
return error_mark_node;
/* Fall through. */
- case CONST_DECL:
case PARM_DECL:
+ case CONST_DECL:
+ if (TREE_CODE (t) == CONST_DECL && DECL_TEMPLATE_PARM_P (t)
+ && for_each_template_parm (DECL_INITIAL (t), fn, data,
+ pfd->visited))
+ return error_mark_node;
if (DECL_CONTEXT (t)
&& for_each_template_parm (DECL_CONTEXT (t), fn, data,
pfd->visited))
@@ -4624,7 +4681,7 @@ for_each_template_parm_r (tp, walk_subtrees, d)
break;
case TEMPLATE_DECL:
- /* A template template parameter is encountered */
+ /* A template template parameter is encountered. */
if (DECL_TEMPLATE_TEMPLATE_PARM_P (t)
&& for_each_template_parm (TREE_TYPE (t), fn, data, pfd->visited))
return error_mark_node;
@@ -4665,7 +4722,6 @@ for_each_template_parm_r (tp, walk_subtrees, d)
case ARROW_EXPR:
case DOTSTAR_EXPR:
case TYPEID_EXPR:
- case LOOKUP_EXPR:
case PSEUDO_DTOR_EXPR:
if (!fn)
return error_mark_node;
@@ -4699,11 +4755,7 @@ for_each_template_parm_r (tp, walk_subtrees, d)
considered to be the function which always returns 1. */
static int
-for_each_template_parm (t, fn, data, visited)
- tree t;
- tree_fn_t fn;
- void* data;
- htab_t visited;
+for_each_template_parm (tree t, tree_fn_t fn, void* data, htab_t visited)
{
struct pair_fn_data pfd;
int result;
@@ -4725,7 +4777,7 @@ for_each_template_parm (t, fn, data, visited)
result = walk_tree (&t,
for_each_template_parm_r,
&pfd,
- NULL) != NULL_TREE;
+ pfd.visited) != NULL_TREE;
/* Clean up. */
if (!visited)
@@ -4734,11 +4786,47 @@ for_each_template_parm (t, fn, data, visited)
return result;
}
+/* Returns true if T depends on any template parameter. */
+
+int
+uses_template_parms (tree t)
+{
+ bool dependent_p;
+ int saved_processing_template_decl;
+
+ saved_processing_template_decl = processing_template_decl;
+ if (!saved_processing_template_decl)
+ processing_template_decl = 1;
+ if (TYPE_P (t))
+ dependent_p = dependent_type_p (t);
+ else if (TREE_CODE (t) == TREE_VEC)
+ dependent_p = any_dependent_template_arguments_p (t);
+ else if (TREE_CODE (t) == TREE_LIST)
+ dependent_p = (uses_template_parms (TREE_VALUE (t))
+ || uses_template_parms (TREE_CHAIN (t)));
+ else if (DECL_P (t)
+ || EXPR_P (t)
+ || TREE_CODE (t) == TEMPLATE_PARM_INDEX
+ || TREE_CODE (t) == OVERLOAD
+ || TREE_CODE (t) == BASELINK
+ || TREE_CODE_CLASS (TREE_CODE (t)) == 'c')
+ dependent_p = (type_dependent_expression_p (t)
+ || value_dependent_expression_p (t));
+ else if (t == error_mark_node)
+ dependent_p = false;
+ else
+ abort ();
+ processing_template_decl = saved_processing_template_decl;
+
+ return dependent_p;
+}
+
+/* Returns true if T depends on any template parameter with level LEVEL. */
+
int
-uses_template_parms (t)
- tree t;
+uses_template_parms_level (tree t, int level)
{
- return for_each_template_parm (t, 0, 0, NULL);
+ return for_each_template_parm (t, template_parm_this_level_p, &level, NULL);
}
static int tinst_depth;
@@ -4753,8 +4841,7 @@ static int last_template_error_tick;
for diagnostics and to restore it later. */
int
-push_tinst_level (d)
- tree d;
+push_tinst_level (tree d)
{
tree new;
@@ -4775,7 +4862,7 @@ push_tinst_level (d)
return 0;
}
- new = build_expr_wfl (d, input_filename, lineno, 0);
+ new = build_expr_wfl (d, input_filename, input_line, 0);
TREE_CHAIN (new) = current_tinst_level;
current_tinst_level = new;
@@ -4793,13 +4880,13 @@ push_tinst_level (d)
context. */
void
-pop_tinst_level ()
+pop_tinst_level (void)
{
tree old = current_tinst_level;
/* Restore the filename and line number stashed away when we started
this instantiation. */
- lineno = TINST_LINE (old);
+ input_line = TINST_LINE (old);
input_filename = TINST_FILE (old);
extract_interface_info ();
@@ -4813,8 +4900,7 @@ pop_tinst_level ()
is one step out from LEVEL. */
static void
-reopen_tinst_level (level)
- tree level;
+reopen_tinst_level (tree level)
{
tree t;
@@ -4830,7 +4916,7 @@ reopen_tinst_level (level)
-falt-external-templates. */
tree
-tinst_for_decl ()
+tinst_for_decl (void)
{
tree p = current_tinst_level;
@@ -4846,16 +4932,12 @@ tinst_for_decl ()
Returns an appropriate tsubst'd friend declaration. */
static tree
-tsubst_friend_function (decl, args)
- tree decl;
- tree args;
+tsubst_friend_function (tree decl, tree args)
{
tree new_friend;
- int line = lineno;
- const char *file = input_filename;
+ location_t saved_loc = input_location;
- lineno = DECL_SOURCE_LINE (decl);
- input_filename = DECL_SOURCE_FILE (decl);
+ input_location = DECL_SOURCE_LOCATION (decl);
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_TEMPLATE_INSTANTIATION (decl)
@@ -4889,7 +4971,7 @@ tsubst_friend_function (decl, args)
tmpl = determine_specialization (template_id, new_friend,
&new_args,
/*need_member_template=*/0);
- new_friend = instantiate_template (tmpl, new_args);
+ new_friend = instantiate_template (tmpl, new_args, tf_error);
goto done;
}
@@ -4905,6 +4987,9 @@ tsubst_friend_function (decl, args)
Then, in S<int>, template <class U> void f(int, U) is not an
instantiation of anything. */
+ if (new_friend == error_mark_node)
+ return error_mark_node;
+
DECL_USE_TEMPLATE (new_friend) = 0;
if (TREE_CODE (decl) == TEMPLATE_DECL)
{
@@ -4935,21 +5020,20 @@ tsubst_friend_function (decl, args)
duplicate decls since that function will free NEW_FRIEND if
possible. */
new_friend_template_info = DECL_TEMPLATE_INFO (new_friend);
+ new_friend_is_defn =
+ (DECL_INITIAL (DECL_TEMPLATE_RESULT
+ (template_for_substitution (new_friend)))
+ != NULL_TREE);
if (TREE_CODE (new_friend) == TEMPLATE_DECL)
{
/* This declaration is a `primary' template. */
DECL_PRIMARY_TEMPLATE (new_friend) = new_friend;
- new_friend_is_defn
- = DECL_INITIAL (DECL_TEMPLATE_RESULT (new_friend)) != NULL_TREE;
new_friend_result_template_info
= DECL_TEMPLATE_INFO (DECL_TEMPLATE_RESULT (new_friend));
}
else
- {
- new_friend_is_defn = DECL_INITIAL (new_friend) != NULL_TREE;
- new_friend_result_template_info = NULL_TREE;
- }
+ new_friend_result_template_info = NULL_TREE;
/* Inside pushdecl_namespace_level, we will push into the
current namespace. However, the friend function should go
@@ -5056,15 +5140,14 @@ tsubst_friend_function (decl, args)
/* Check to see that the declaration is really present, and,
possibly obtain an improved declaration. */
tree fn = check_classfn (DECL_CONTEXT (new_friend),
- new_friend);
+ new_friend, false);
if (fn)
new_friend = fn;
}
done:
- lineno = line;
- input_filename = file;
+ input_location = saved_loc;
return new_friend;
}
@@ -5075,9 +5158,7 @@ tsubst_friend_function (decl, args)
failure. */
static tree
-tsubst_friend_class (friend_tmpl, args)
- tree friend_tmpl;
- tree args;
+tsubst_friend_class (tree friend_tmpl, tree args)
{
tree friend_type;
tree tmpl;
@@ -5090,7 +5171,7 @@ tsubst_friend_class (friend_tmpl, args)
if (TREE_CODE (context) == NAMESPACE_DECL)
push_nested_namespace (context);
else
- push_nested_class (tsubst (context, args, tf_none, NULL_TREE), 2);
+ push_nested_class (tsubst (context, args, tf_none, NULL_TREE));
}
/* First, we look for a class template. */
@@ -5146,6 +5227,8 @@ tsubst_friend_class (friend_tmpl, args)
DECL_USE_TEMPLATE (tmpl) = 0;
DECL_TEMPLATE_INFO (tmpl) = NULL_TREE;
CLASSTYPE_USE_TEMPLATE (TREE_TYPE (tmpl)) = 0;
+ CLASSTYPE_TI_ARGS (TREE_TYPE (tmpl))
+ = INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (TREE_TYPE (tmpl)));
/* Inject this template into the global scope. */
friend_type = TREE_TYPE (pushdecl_top_level (tmpl));
@@ -5166,8 +5249,7 @@ tsubst_friend_class (friend_tmpl, args)
Otherwise returns one. */
static int
-can_complete_type_without_circularity (type)
- tree type;
+can_complete_type_without_circularity (tree type)
{
if (type == NULL_TREE || type == error_mark_node)
return 0;
@@ -5175,23 +5257,26 @@ can_complete_type_without_circularity (type)
return 1;
else if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type))
return can_complete_type_without_circularity (TREE_TYPE (type));
- else if (CLASS_TYPE_P (type) && TYPE_BEING_DEFINED (TYPE_MAIN_VARIANT (type)))
+ else if (CLASS_TYPE_P (type)
+ && TYPE_BEING_DEFINED (TYPE_MAIN_VARIANT (type)))
return 0;
else
return 1;
}
tree
-instantiate_class_template (type)
- tree type;
+instantiate_class_template (tree type)
{
tree template, args, pattern, t, member;
tree typedecl;
-
+ tree pbinfo;
+
if (type == error_mark_node)
return error_mark_node;
- if (TYPE_BEING_DEFINED (type) || COMPLETE_TYPE_P (type))
+ if (TYPE_BEING_DEFINED (type)
+ || COMPLETE_TYPE_P (type)
+ || dependent_type_p (type))
return type;
/* Figure out which template is being instantiated. */
@@ -5201,63 +5286,25 @@ instantiate_class_template (type)
/* Figure out which arguments are being used to do the
instantiation. */
args = CLASSTYPE_TI_ARGS (type);
- PARTIAL_INSTANTIATION_P (type) = uses_template_parms (args);
-
- if (pedantic && PARTIAL_INSTANTIATION_P (type))
- /* If this is a partial instantiation, then we can't instantiate
- the type; there's no telling whether or not one of the
- template parameters might eventually be instantiated to some
- value that results in a specialization being used. For
- example, consider:
-
- template <class T>
- struct S {};
-
- template <class U>
- void f(S<U>);
-
- template <>
- struct S<int> {};
-
- Now, the `S<U>' in `f<int>' is the specialization, not an
- instantiation of the original template. */
- return type;
/* Determine what specialization of the original template to
instantiate. */
- if (PARTIAL_INSTANTIATION_P (type))
- /* There's no telling which specialization is appropriate at this
- point. Since all peeking at the innards of this partial
- instantiation are extensions (like the "implicit typename"
- extension, which allows users to omit the keyword `typename' on
- names that are declared as types in template base classes), we
- are free to do what we please.
-
- Trying to figure out which partial instantiation to use can
- cause a crash. (Some of the template arguments don't even have
- types.) So, we just use the most general version. */
- t = NULL_TREE;
- else
+ t = most_specialized_class (template, args);
+ if (t == error_mark_node)
{
- t = most_specialized_class (template, args);
-
- if (t == error_mark_node)
+ const char *str = "candidates are:";
+ error ("ambiguous class template instantiation for `%#T'", type);
+ for (t = DECL_TEMPLATE_SPECIALIZATIONS (template); t;
+ t = TREE_CHAIN (t))
{
- const char *str = "candidates are:";
- error ("ambiguous class template instantiation for `%#T'", type);
- for (t = DECL_TEMPLATE_SPECIALIZATIONS (template); t;
- t = TREE_CHAIN (t))
+ if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t), args))
{
- if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t),
- args))
- {
- cp_error_at ("%s %+#T", str, TREE_TYPE (t));
- str = " ";
- }
+ cp_error_at ("%s %+#T", str, TREE_TYPE (t));
+ str = " ";
}
- TYPE_BEING_DEFINED (type) = 1;
- return error_mark_node;
}
+ TYPE_BEING_DEFINED (type) = 1;
+ return error_mark_node;
}
if (t)
@@ -5270,26 +5317,6 @@ instantiate_class_template (type)
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
- matter. All that matters is whether a particular name is a type. */
- if (PARTIAL_INSTANTIATION_P (type))
- {
- /* The fields set here must be kept in sync with those cleared
- in begin_class_definition. */
- TYPE_BINFO_BASETYPES (type) = TYPE_BINFO_BASETYPES (pattern);
- TYPE_FIELDS (type) = TYPE_FIELDS (pattern);
- TYPE_METHODS (type) = TYPE_METHODS (pattern);
- CLASSTYPE_DECL_LIST (type) = CLASSTYPE_DECL_LIST (pattern);
- CLASSTYPE_NESTED_UDTS (type) = CLASSTYPE_NESTED_UDTS (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) = bitsize_zero_node;
- return type;
- }
-
/* If we've recursively instantiated too many templates, stop. */
if (! push_tinst_level (type))
return type;
@@ -5298,7 +5325,11 @@ instantiate_class_template (type)
the process of being defined. */
TYPE_BEING_DEFINED (type) = 1;
- maybe_push_to_top_level (uses_template_parms (type));
+ /* We may be in the middle of deferred access check. Disable
+ it now. */
+ push_deferring_access_checks (dk_no_deferred);
+
+ push_to_top_level ();
if (t)
{
@@ -5328,30 +5359,14 @@ instantiate_class_template (type)
args = inner_args;
}
- if (flag_external_templates)
- {
- if (flag_alt_external_templates)
- {
- CLASSTYPE_INTERFACE_ONLY (type) = interface_only;
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X (type, interface_unknown);
- }
- else
- {
- CLASSTYPE_INTERFACE_ONLY (type) = CLASSTYPE_INTERFACE_ONLY (pattern);
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X
- (type, CLASSTYPE_INTERFACE_UNKNOWN (pattern));
- }
- }
- else
- {
- SET_CLASSTYPE_INTERFACE_UNKNOWN (type);
- }
+ SET_CLASSTYPE_INTERFACE_UNKNOWN (type);
+
+ /* Set the input location to the template definition. This is needed
+ if tsubsting causes an error. */
+ input_location = DECL_SOURCE_LOCATION (TYPE_NAME (pattern));
TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern);
TYPE_HAS_DESTRUCTOR (type) = TYPE_HAS_DESTRUCTOR (pattern);
- 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_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);
@@ -5375,16 +5390,33 @@ instantiate_class_template (type)
if (ANON_AGGR_TYPE_P (pattern))
SET_ANON_AGGR_TYPE_P (type);
- if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern)))
- /* First instantiate our enclosing class. */
- complete_type (TYPE_CONTEXT (type));
+ pbinfo = TYPE_BINFO (pattern);
+
+#ifdef ENABLE_CHECKING
+ if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern))
+ && ! COMPLETE_TYPE_P (TYPE_CONTEXT (type))
+ && ! TYPE_BEING_DEFINED (TYPE_CONTEXT (type)))
+ /* We should never instantiate a nested class before its enclosing
+ class; we need to look up the nested class by name before we can
+ instantiate it, and that lookup should instantiate the enclosing
+ class. */
+ abort ();
+#endif
- if (TYPE_BINFO_BASETYPES (pattern))
+ if (BINFO_BASETYPES (pbinfo))
{
tree base_list = NULL_TREE;
- tree pbases = TYPE_BINFO_BASETYPES (pattern);
+ tree pbases = BINFO_BASETYPES (pbinfo);
+ tree paccesses = BINFO_BASEACCESSES (pbinfo);
+ tree context = TYPE_CONTEXT (type);
+ bool pop_p;
int i;
+ /* We must enter the scope containing the type, as that is where
+ the accessibility of types named in dependent bases are
+ looked up from. */
+ pop_p = push_scope (context ? context : global_namespace);
+
/* Substitute into each of the bases to determine the actual
basetypes. */
for (i = 0; i < TREE_VEC_LENGTH (pbases); ++i)
@@ -5394,33 +5426,15 @@ instantiate_class_template (type)
tree pbase;
pbase = TREE_VEC_ELT (pbases, i);
+ access = TREE_VEC_ELT (paccesses, i);
/* Substitute to figure out the base class. */
base = tsubst (BINFO_TYPE (pbase), args, tf_error, NULL_TREE);
if (base == error_mark_node)
continue;
-
- /* Calculate the correct access node. */
- if (TREE_VIA_VIRTUAL (pbase))
- {
- if (TREE_VIA_PUBLIC (pbase))
- access = access_public_virtual_node;
- else if (TREE_VIA_PROTECTED (pbase))
- access = access_protected_virtual_node;
- else
- access = access_private_virtual_node;
- }
- else
- {
- if (TREE_VIA_PUBLIC (pbase))
- access = access_public_node;
- else if (TREE_VIA_PROTECTED (pbase))
- access = access_protected_node;
- else
- access = access_private_node;
- }
-
+
base_list = tree_cons (access, base, base_list);
+ TREE_VIA_VIRTUAL (base_list) = TREE_VIA_VIRTUAL (pbase);
}
/* The list is now in reverse order; correct that. */
@@ -5429,6 +5443,9 @@ instantiate_class_template (type)
/* Now call xref_basetypes to set up all the base-class
information. */
xref_basetypes (type, base_list);
+
+ if (pop_p)
+ pop_scope (context ? context : global_namespace);
}
/* Now that our base classes are set up, enter the scope of the
@@ -5436,10 +5453,11 @@ instantiate_class_template (type)
correctly. This is precisely analogous to what we do in
begin_class_definition when defining an ordinary non-template
class. */
- pushclass (type, 1);
+ pushclass (type);
/* Now members are processed in the order of declaration. */
- for (member = CLASSTYPE_DECL_LIST (pattern); member; member = TREE_CHAIN (member))
+ for (member = CLASSTYPE_DECL_LIST (pattern);
+ member; member = TREE_CHAIN (member))
{
tree t = TREE_VALUE (member);
@@ -5447,25 +5465,29 @@ instantiate_class_template (type)
{
if (TYPE_P (t))
{
- /* Build new CLASSTYPE_NESTED_UDTS. */
+ /* Build new CLASSTYPE_NESTED_UTDS. */
tree tag = t;
tree name = TYPE_IDENTIFIER (tag);
tree newtag;
newtag = tsubst (tag, args, tf_error, NULL_TREE);
- my_friendly_assert (newtag != error_mark_node, 20010206);
+ if (newtag == error_mark_node)
+ continue;
+
if (TREE_CODE (newtag) != ENUMERAL_TYPE)
{
if (TYPE_LANG_SPECIFIC (tag) && CLASSTYPE_IS_TEMPLATE (tag))
/* Unfortunately, lookup_template_class sets
CLASSTYPE_IMPLICIT_INSTANTIATION for a partial
- instantiation (i.e., for the type of a member template
- class nested within a template class.) This behavior is
- required for maybe_process_partial_specialization to work
- correctly, but is not accurate in this case; the TAG is not
- an instantiation of anything. (The corresponding
- TEMPLATE_DECL is an instantiation, but the TYPE is not.) */
+ instantiation (i.e., for the type of a member
+ template class nested within a template class.)
+ This behavior is required for
+ maybe_process_partial_specialization to work
+ correctly, but is not accurate in this case;
+ the TAG is not an instantiation of anything.
+ (The corresponding TEMPLATE_DECL is an
+ instantiation, but the TYPE is not.) */
CLASSTYPE_USE_TEMPLATE (newtag) = 0;
/* Now, we call pushtag to put this NEWTAG into the scope of
@@ -5482,8 +5504,13 @@ instantiate_class_template (type)
|| DECL_FUNCTION_TEMPLATE_P (t))
{
/* Build new TYPE_METHODS. */
-
- tree r = tsubst (t, args, tf_error, NULL_TREE);
+ tree r;
+
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ ++processing_template_decl;
+ r = tsubst (t, args, tf_error, NULL_TREE);
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ --processing_template_decl;
set_current_access_from_decl (r);
grok_special_member_properties (r);
finish_member_declaration (r);
@@ -5496,13 +5523,17 @@ instantiate_class_template (type)
{
tree r;
- /* The the file and line for this declaration, to assist
- in error message reporting. Since we called
- push_tinst_level above, we don't need to restore these. */
- lineno = DECL_SOURCE_LINE (t);
- input_filename = DECL_SOURCE_FILE (t);
+ /* The the file and line for this declaration, to
+ assist in error message reporting. Since we
+ called push_tinst_level above, we don't need to
+ restore these. */
+ input_location = DECL_SOURCE_LOCATION (t);
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ ++processing_template_decl;
r = tsubst (t, args, tf_error | tf_warning, NULL_TREE);
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ --processing_template_decl;
if (TREE_CODE (r) == VAR_DECL)
{
tree init;
@@ -5513,9 +5544,8 @@ instantiate_class_template (type)
else
init = NULL_TREE;
- finish_static_data_member_decl (r, init,
- /*asmspec_tree=*/NULL_TREE,
- /*flags=*/0);
+ finish_static_data_member_decl
+ (r, init, /*asmspec_tree=*/NULL_TREE, /*flags=*/0);
if (DECL_INITIALIZED_IN_CLASS_P (r))
check_static_variable_definition (r, TREE_TYPE (r));
@@ -5540,7 +5570,7 @@ instantiate_class_template (type)
/* If it is a TYPE_DECL for a class-scoped ENUMERAL_TYPE,
such a thing will already have been added to the field
list by tsubst_enum in finish_member_declaration in the
- CLASSTYPE_NESTED_UDTS case above. */
+ CLASSTYPE_NESTED_UTDS case above. */
if (!(TREE_CODE (r) == TYPE_DECL
&& TREE_CODE (TREE_TYPE (r)) == ENUMERAL_TYPE
&& DECL_ARTIFICIAL (r)))
@@ -5565,6 +5595,8 @@ instantiate_class_template (type)
else if (uses_template_parms (friend_type))
new_friend_type = tsubst (friend_type, args,
tf_error | tf_warning, NULL_TREE);
+ else if (CLASSTYPE_USE_TEMPLATE (friend_type))
+ new_friend_type = friend_type;
else
{
tree ns = decl_namespace_context (TYPE_MAIN_DECL (friend_type));
@@ -5586,14 +5618,24 @@ instantiate_class_template (type)
++processing_template_decl;
if (new_friend_type != error_mark_node)
- make_friend_class (type, new_friend_type);
+ make_friend_class (type, new_friend_type,
+ /*complain=*/false);
if (TREE_CODE (friend_type) == TEMPLATE_DECL)
--processing_template_decl;
}
else
- /* Build new DECL_FRIENDLIST. */
- add_friend (type, tsubst_friend_function (t, args));
+ {
+ /* Build new DECL_FRIENDLIST. */
+ tree r;
+
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ ++processing_template_decl;
+ r = tsubst_friend_function (t, args);
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ --processing_template_decl;
+ add_friend (type, r, /*complain=*/false);
+ }
}
}
@@ -5602,12 +5644,10 @@ instantiate_class_template (type)
implicit functions at a predictable point, and the same point
that would be used for non-template classes. */
typedecl = TYPE_MAIN_DECL (type);
- lineno = DECL_SOURCE_LINE (typedecl);
- input_filename = DECL_SOURCE_FILE (typedecl);
-
+ input_location = DECL_SOURCE_LOCATION (typedecl);
+
unreverse_member_declarations (type);
finish_struct_1 (type);
- CLASSTYPE_GOT_SEMICOLON (type) = 1;
/* Clear this now so repo_template_used is happy. */
TYPE_BEING_DEFINED (type) = 0;
@@ -5627,6 +5667,7 @@ instantiate_class_template (type)
popclass ();
pop_from_top_level ();
+ pop_deferring_access_checks ();
pop_tinst_level ();
if (TYPE_CONTAINS_VPTR_P (type))
@@ -5635,89 +5676,78 @@ instantiate_class_template (type)
return type;
}
-static int
-list_eq (t1, t2)
- tree t1, t2;
+static tree
+tsubst_template_arg (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
- if (t1 == NULL_TREE)
- return t2 == NULL_TREE;
- if (t2 == NULL_TREE)
- return 0;
- /* Don't care if one declares its arg const and the other doesn't -- the
- main variant of the arg type is all that matters. */
- if (TYPE_MAIN_VARIANT (TREE_VALUE (t1))
- != TYPE_MAIN_VARIANT (TREE_VALUE (t2)))
- return 0;
- return list_eq (TREE_CHAIN (t1), TREE_CHAIN (t2));
-}
-
-/* If arg is a non-type template parameter that does not depend on template
- arguments, fold it like we weren't in the body of a template. */
+ tree r;
+
+ if (!t)
+ r = t;
+ else if (TYPE_P (t))
+ r = tsubst (t, args, complain, in_decl);
+ else
+ {
+ r = tsubst_expr (t, args, complain, in_decl);
-static tree
-maybe_fold_nontype_arg (arg)
- tree 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
- tsubst'd, we might have something like 2 - 1. This will
- confuse lookup_template_class, so we do constant folding
- here. We have to unset processing_template_decl, to
- fool build_expr_from_tree() into building an actual
- tree. */
-
- /* 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))
+ if (!uses_template_parms (r))
{
- 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;
+ /* Sometimes, one of the args was an expression involving a
+ template constant parameter, like N - 1. Now that we've
+ tsubst'd, we might have something like 2 - 1. This will
+ confuse lookup_template_class, so we do constant folding
+ here. We have to unset processing_template_decl, to fool
+ tsubst_copy_and_build() into building an actual tree. */
+
+ /* 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. Once tsubst_expr et al DTRT for
+ non-dependent exprs, this code can go away, as the type
+ will always be set. */
+ if (!TREE_TYPE (r))
+ {
+ int saved_processing_template_decl = processing_template_decl;
+ processing_template_decl = 0;
+ r = tsubst_copy_and_build (r, /*args=*/NULL_TREE,
+ tf_error, /*in_decl=*/NULL_TREE,
+ /*function_p=*/false);
+ processing_template_decl = saved_processing_template_decl;
+ }
+ r = fold (r);
}
-
- arg = fold (arg);
}
- return arg;
+ return r;
}
-/* Substitute ARGS into the vector of template arguments T. */
+/* Substitute ARGS into the vector or list of template arguments T. */
static tree
-tsubst_template_arg_vector (t, args, complain)
- tree t;
- tree args;
- tsubst_flags_t complain;
+tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
- int len = TREE_VEC_LENGTH (t), need_new = 0, i;
- tree *elts = (tree *) alloca (len * sizeof (tree));
-
- memset ((char *) elts, 0, len * sizeof (tree));
+ int len = TREE_VEC_LENGTH (t);
+ int need_new = 0, i;
+ tree *elts = alloca (len * sizeof (tree));
for (i = 0; i < len; i++)
{
- if (TREE_VEC_ELT (t, i) != NULL_TREE
- && TREE_CODE (TREE_VEC_ELT (t, i)) == TREE_VEC)
- elts[i] = tsubst_template_arg_vector (TREE_VEC_ELT (t, i),
- args, complain);
+ tree orig_arg = TREE_VEC_ELT (t, i);
+ tree new_arg;
+
+ if (TREE_CODE (orig_arg) == TREE_VEC)
+ new_arg = tsubst_template_args (orig_arg, args, complain, in_decl);
else
- elts[i] = maybe_fold_nontype_arg
- (tsubst_expr (TREE_VEC_ELT (t, i), args, complain,
- NULL_TREE));
+ new_arg = tsubst_template_arg (orig_arg, args, complain, in_decl);
- if (elts[i] == error_mark_node)
+ if (new_arg == error_mark_node)
return error_mark_node;
- if (elts[i] != TREE_VEC_ELT (t, i))
+ elts[i] = new_arg;
+ if (new_arg != orig_arg)
need_new = 1;
}
if (!need_new)
return t;
-
+
t = make_tree_vec (len);
for (i = 0; i < len; i++)
TREE_VEC_ELT (t, i) = elts[i];
@@ -5733,10 +5763,7 @@ tsubst_template_arg_vector (t, args, complain)
result will be `template <int*, double, class V>'. */
static tree
-tsubst_template_parms (parms, args, complain)
- tree parms;
- tree args;
- tsubst_flags_t complain;
+tsubst_template_parms (tree parms, tree args, tsubst_flags_t complain)
{
tree r = NULL_TREE;
tree* new_parms;
@@ -5757,10 +5784,10 @@ tsubst_template_parms (parms, args, complain)
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);
+ default_value = tsubst_template_arg (default_value, args,
+ complain, NULL_TREE);
+
+ tuple = build_tree_list (default_value, parm_decl);
TREE_VEC_ELT (new_vec, i) = tuple;
}
@@ -5780,12 +5807,11 @@ tsubst_template_parms (parms, args, complain)
we are presently tsubst'ing. Return the substituted value. */
static tree
-tsubst_aggr_type (t, args, complain, in_decl, entering_scope)
- tree t;
- tree args;
- tsubst_flags_t complain;
- tree in_decl;
- int entering_scope;
+tsubst_aggr_type (tree t,
+ tree args,
+ tsubst_flags_t complain,
+ tree in_decl,
+ int entering_scope)
{
if (t == NULL_TREE)
return NULL_TREE;
@@ -5796,7 +5822,7 @@ tsubst_aggr_type (t, args, complain, in_decl, entering_scope)
if (TYPE_PTRMEMFUNC_P (t))
return tsubst (TYPE_PTRMEMFUNC_FN_TYPE (t), args, complain, in_decl);
- /* else fall through */
+ /* Else fall through. */
case ENUMERAL_TYPE:
case UNION_TYPE:
if (TYPE_TEMPLATE_INFO (t))
@@ -5807,12 +5833,10 @@ tsubst_aggr_type (t, args, complain, in_decl, entering_scope)
/* First, determine the context for the type we are looking
up. */
- if (TYPE_CONTEXT (t) != NULL_TREE)
- context = tsubst_aggr_type (TYPE_CONTEXT (t), args,
- complain,
+ context = TYPE_CONTEXT (t);
+ if (context)
+ context = tsubst_aggr_type (context, args, complain,
in_decl, /*entering_scope=*/1);
- else
- context = NULL_TREE;
/* Then, figure out what arguments are appropriate for the
type we are trying to find. For example, given:
@@ -5823,8 +5847,8 @@ 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}. */
- argvec = tsubst_template_arg_vector (TYPE_TI_ARGS (t), args,
- complain);
+ argvec = tsubst_template_args (TYPE_TI_ARGS (t), args,
+ complain, in_decl);
if (argvec == error_mark_node)
return error_mark_node;
@@ -5846,10 +5870,7 @@ tsubst_aggr_type (t, args, complain, in_decl, entering_scope)
FN), which has the indicated TYPE. */
tree
-tsubst_default_argument (fn, type, arg)
- tree fn;
- tree type;
- tree arg;
+tsubst_default_argument (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
@@ -5862,18 +5883,18 @@ tsubst_default_argument (fn, type, arg)
};
we must be careful to do name lookup in the scope of S<T>,
- rather than in the current class.
-
- ??? current_class_type affects a lot more than name lookup. This is
- very fragile. Fortunately, it will go away when we do 2-phase name
- binding properly. */
-
- /* FN is already the desired FUNCTION_DECL. */
+ rather than in the current class. */
push_access_scope (fn);
+ /* The default argument expression should not be considered to be
+ within the scope of FN. Since push_access_scope sets
+ current_function_decl, we must explicitly clear it here. */
+ current_function_decl = NULL_TREE;
+ push_deferring_access_checks(dk_no_deferred);
arg = tsubst_expr (arg, DECL_TI_ARGS (fn),
tf_error | tf_warning, NULL_TREE);
-
+ pop_deferring_access_checks();
+
pop_access_scope (fn);
/* Make sure the default argument is reasonable. */
@@ -5885,8 +5906,7 @@ tsubst_default_argument (fn, type, arg)
/* Substitute into all the default arguments for FN. */
static void
-tsubst_default_arguments (fn)
- tree fn;
+tsubst_default_arguments (tree fn)
{
tree arg;
tree tmpl_args;
@@ -5913,22 +5933,15 @@ tsubst_default_arguments (fn)
and warning messages under control of COMPLAIN. */
static tree
-tsubst_decl (t, args, type, complain)
- tree t;
- tree args;
- tree type;
- tsubst_flags_t complain;
-{
- int saved_lineno;
- const char *saved_filename;
+tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain)
+{
+ location_t saved_loc;
tree r = NULL_TREE;
tree in_decl = t;
/* Set the filename and linenumber to improve error-reporting. */
- saved_lineno = lineno;
- saved_filename = input_filename;
- lineno = DECL_SOURCE_LINE (t);
- input_filename = DECL_SOURCE_FILE (t);
+ saved_loc = input_location;
+ input_location = DECL_SOURCE_LOCATION (t);
switch (TREE_CODE (t))
{
@@ -5951,10 +5964,10 @@ tsubst_decl (t, args, type, complain)
: DECL_TI_ARGS (DECL_TEMPLATE_RESULT (t));
tree full_args;
- full_args = tsubst_template_arg_vector (tmpl_args, args,
- complain);
+ full_args = tsubst_template_args (tmpl_args, args,
+ complain, in_decl);
- /* tsubst_template_arg_vector doesn't copy the vector if
+ /* tsubst_template_args doesn't copy the vector if
nothing changed. But, *something* should have
changed. */
my_friendly_assert (full_args != tmpl_args, 0);
@@ -5993,6 +6006,9 @@ tsubst_decl (t, args, type, complain)
if (TREE_CODE (decl) == TYPE_DECL)
{
tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl);
+ if (new_type == error_mark_node)
+ return error_mark_node;
+
TREE_TYPE (r) = new_type;
CLASSTYPE_TI_TEMPLATE (new_type) = r;
DECL_TEMPLATE_RESULT (r) = TYPE_MAIN_DECL (new_type);
@@ -6001,6 +6017,8 @@ tsubst_decl (t, args, type, complain)
else
{
tree new_decl = tsubst (decl, args, complain, in_decl);
+ if (new_decl == error_mark_node)
+ return error_mark_node;
DECL_TEMPLATE_RESULT (r) = new_decl;
DECL_TI_TEMPLATE (new_decl) = r;
@@ -6022,14 +6040,10 @@ tsubst_decl (t, args, type, complain)
if (PRIMARY_TEMPLATE_P (t))
DECL_PRIMARY_TEMPLATE (r) = r;
- /* We don't partially instantiate partial specializations. */
- if (TREE_CODE (decl) == TYPE_DECL)
- break;
-
- /* Record this partial instantiation. */
- register_specialization (r, t,
- DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)));
-
+ if (TREE_CODE (decl) != TYPE_DECL)
+ /* Record this non-type partial instantiation. */
+ register_specialization (r, t,
+ DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)));
}
break;
@@ -6049,19 +6063,25 @@ tsubst_decl (t, args, type, complain)
if (TREE_CODE (DECL_TI_TEMPLATE (t)) == TEMPLATE_DECL)
{
tree spec;
-
- /* If T is not dependent, just return it. */
- if (!uses_template_parms (DECL_TI_ARGS (t)))
+ bool dependent_p;
+
+ /* If T is not dependent, just return it. We have to
+ increment PROCESSING_TEMPLATE_DECL because
+ value_dependent_expression_p assumes that nothing is
+ dependent when PROCESSING_TEMPLATE_DECL is zero. */
+ ++processing_template_decl;
+ dependent_p = value_dependent_expression_p (t);
+ --processing_template_decl;
+ if (!dependent_p)
return t;
/* Calculate the most general template of which R is a
specialization, and the complete set of arguments used to
specialize R. */
gen_tmpl = most_general_template (DECL_TI_TEMPLATE (t));
- argvec
- = tsubst_template_arg_vector (DECL_TI_ARGS
- (DECL_TEMPLATE_RESULT (gen_tmpl)),
- args, complain);
+ argvec = tsubst_template_args (DECL_TI_ARGS
+ (DECL_TEMPLATE_RESULT (gen_tmpl)),
+ args, complain, in_decl);
/* Check to see if we already have this specialization. */
spec = retrieve_specialization (gen_tmpl, argvec);
@@ -6120,14 +6140,10 @@ tsubst_decl (t, args, type, complain)
};
Here, the DECL_TI_TEMPLATE for the friend declaration
- will be a LOOKUP_EXPR or an IDENTIFIER_NODE. We are
- being called from tsubst_friend_function, and we want
- only to create a new decl (R) with appropriate types so
- that we can call determine_specialization. */
- my_friendly_assert ((TREE_CODE (DECL_TI_TEMPLATE (t))
- == LOOKUP_EXPR)
- || (TREE_CODE (DECL_TI_TEMPLATE (t))
- == IDENTIFIER_NODE), 0);
+ will be an IDENTIFIER_NODE. We are being called from
+ tsubst_friend_function, and we want only to create a
+ new decl (R) with appropriate types so that we can call
+ determine_specialization. */
gen_tmpl = NULL_TREE;
}
@@ -6138,8 +6154,7 @@ tsubst_decl (t, args, type, complain)
else
member = 1;
ctx = tsubst_aggr_type (DECL_CONTEXT (t), args,
- complain, t,
- /*entering_scope=*/1);
+ complain, t, /*entering_scope=*/1);
}
else
{
@@ -6160,7 +6175,7 @@ tsubst_decl (t, args, type, complain)
/* Clear out the mangled name and RTL for the instantiation. */
SET_DECL_ASSEMBLER_NAME (r, NULL_TREE);
SET_DECL_RTL (r, NULL_RTX);
-
+ DECL_INITIAL (r) = NULL_TREE;
DECL_CONTEXT (r) = ctx;
if (member && DECL_CONV_FN_P (r))
@@ -6240,7 +6255,13 @@ tsubst_decl (t, args, type, complain)
clone_function_decl (r, /*update_method_vec_p=*/0);
}
else if (IDENTIFIER_OPNAME_P (DECL_NAME (r)))
- grok_op_properties (r, DECL_FRIEND_P (r));
+ grok_op_properties (r, DECL_FRIEND_P (r),
+ (complain & tf_error) != 0);
+
+ if (DECL_FRIEND_P (t) && DECL_FRIEND_CONTEXT (t))
+ SET_DECL_FRIEND_CONTEXT (r,
+ tsubst (DECL_FRIEND_CONTEXT (t),
+ args, complain, in_decl));
}
break;
@@ -6253,11 +6274,14 @@ tsubst_decl (t, args, type, complain)
TREE_TYPE (r) = type;
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);
- else
- DECL_INITIAL (r) = tsubst (DECL_INITIAL (r), args,
- complain, in_decl);
+ if (DECL_INITIAL (r))
+ {
+ if (TREE_CODE (DECL_INITIAL (r)) != TEMPLATE_PARM_INDEX)
+ DECL_INITIAL (r) = TREE_TYPE (r);
+ else
+ DECL_INITIAL (r) = tsubst (DECL_INITIAL (r), args,
+ complain, in_decl);
+ }
DECL_CONTEXT (r) = NULL_TREE;
@@ -6288,8 +6312,12 @@ tsubst_decl (t, args, type, complain)
case USING_DECL:
{
r = copy_node (t);
+ /* It is not a dependent using decl any more. */
+ TREE_TYPE (r) = void_type_node;
DECL_INITIAL (r)
= tsubst_copy (DECL_INITIAL (t), args, complain, in_decl);
+ DECL_NAME (r)
+ = tsubst_copy (DECL_NAME (t), args, complain, in_decl);
TREE_CHAIN (r) = NULL_TREE;
}
break;
@@ -6352,7 +6380,11 @@ tsubst_decl (t, args, type, complain)
r = copy_decl (t);
if (TREE_CODE (r) == VAR_DECL)
- type = complete_type (type);
+ {
+ type = complete_type (type);
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (r)
+ = DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (t);
+ }
else if (DECL_SELF_REFERENCE_P (t))
SET_DECL_SELF_REFERENCE_P (r);
TREE_TYPE (r) = type;
@@ -6404,20 +6436,18 @@ tsubst_decl (t, args, type, complain)
}
/* Restore the file and line information. */
- lineno = saved_lineno;
- input_filename = saved_filename;
+ input_location = saved_loc;
return r;
}
-/* Substitue into the ARG_TYPES of a function type. */
+/* Substitute into the ARG_TYPES of a function type. */
static tree
-tsubst_arg_types (arg_types, args, complain, in_decl)
- tree arg_types;
- tree args;
- tsubst_flags_t complain;
- tree in_decl;
+tsubst_arg_types (tree arg_types,
+ tree args,
+ tsubst_flags_t complain,
+ tree in_decl)
{
tree remaining_arg_types;
tree type;
@@ -6474,11 +6504,10 @@ tsubst_arg_types (arg_types, args, complain, in_decl)
results in an invalid type.] */
static tree
-tsubst_function_type (t, args, complain, in_decl)
- tree t;
- tree args;
- tsubst_flags_t complain;
- tree in_decl;
+tsubst_function_type (tree t,
+ tree args,
+ tsubst_flags_t complain,
+ tree in_decl)
{
tree return_type;
tree arg_types;
@@ -6492,7 +6521,7 @@ tsubst_function_type (t, args, complain, in_decl)
if (return_type == error_mark_node)
return error_mark_node;
- /* Substitue the argument types. */
+ /* Substitute the argument types. */
arg_types = tsubst_arg_types (TYPE_ARG_TYPES (t), args,
complain, in_decl);
if (arg_types == error_mark_node)
@@ -6519,11 +6548,11 @@ tsubst_function_type (t, args, complain, in_decl)
return error_mark_node;
}
- fntype = build_cplus_method_type (r, return_type, TREE_CHAIN
- (arg_types));
+ fntype = build_method_type_directly (r, return_type,
+ TREE_CHAIN (arg_types));
}
fntype = cp_build_qualified_type_real (fntype, TYPE_QUALS (t), complain);
- fntype = build_type_attribute_variant (fntype, TYPE_ATTRIBUTES (t));
+ fntype = cp_build_type_attribute_variant (fntype, TYPE_ATTRIBUTES (t));
return fntype;
}
@@ -6531,11 +6560,10 @@ tsubst_function_type (t, args, complain, in_decl)
/* Substitute into the PARMS of a call-declarator. */
static tree
-tsubst_call_declarator_parms (parms, args, complain, in_decl)
- tree parms;
- tree args;
- tsubst_flags_t complain;
- tree in_decl;
+tsubst_call_declarator_parms (tree parms,
+ tree args,
+ tsubst_flags_t complain,
+ tree in_decl)
{
tree new_parms;
tree type;
@@ -6581,11 +6609,8 @@ tsubst_call_declarator_parms (parms, args, complain, in_decl)
This function is used for dealing with types, decls and the like;
for expressions, use tsubst_expr or tsubst_copy. */
-tree
-tsubst (t, args, complain, in_decl)
- tree t, args;
- tsubst_flags_t complain;
- tree in_decl;
+static tree
+tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
tree type, r;
@@ -6600,8 +6625,8 @@ tsubst (t, args, complain, in_decl)
type = IDENTIFIER_TYPE_VALUE (t);
else
type = TREE_TYPE (t);
- if (type == unknown_type_node)
- abort ();
+
+ my_friendly_assert (type != unknown_type_node, 20030716);
if (type && TREE_CODE (t) != FUNCTION_DECL
&& TREE_CODE (t) != TYPENAME_TYPE
@@ -6647,32 +6672,12 @@ tsubst (t, args, complain, in_decl)
{
tree max, omax = TREE_OPERAND (TYPE_MAX_VALUE (t), 0);
- max = tsubst_expr (omax, args, complain, in_decl);
- if (max == error_mark_node)
- return error_mark_node;
-
- /* See if we can reduce this expression to something simpler. */
- max = maybe_fold_nontype_arg (max);
+ /* The array dimension behaves like a non-type template arg,
+ in that we want to fold it as much as possible. */
+ max = tsubst_template_arg (omax, args, complain, in_decl);
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. 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;
- TYPE_MAX_VALUE (itype) = build_min (MINUS_EXPR, sizetype, max,
- integer_one_node);
- return itype;
- }
-
if (integer_zerop (omax))
{
/* Still allow an explicit array of size zero. */
@@ -6745,7 +6750,7 @@ tsubst (t, args, complain, in_decl)
else if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
{
/* We are processing a type constructed from
- a template template parameter */
+ a template template parameter. */
tree argvec = tsubst (TYPE_TI_ARGS (t),
args, complain, in_decl);
if (argvec == error_mark_node)
@@ -6896,7 +6901,7 @@ tsubst (t, args, complain, in_decl)
}
/* Otherwise, a vector of template arguments. */
- return tsubst_template_arg_vector (t, args, complain);
+ return tsubst_template_args (t, args, complain, in_decl);
case POINTER_TYPE:
case REFERENCE_TYPE:
@@ -6920,14 +6925,14 @@ tsubst (t, args, complain, in_decl)
if (TREE_CODE (type) == REFERENCE_TYPE
|| (code == REFERENCE_TYPE && TREE_CODE (type) == VOID_TYPE))
{
- static int last_line = 0;
- static const char* last_file = 0;
+ static location_t last_loc;
/* We keep track of the last time we issued this error
message to avoid spewing a ton of messages during a
single bad template instantiation. */
if (complain & tf_error
- && (last_line != lineno || last_file != input_filename))
+ && (last_loc.line != input_line
+ || last_loc.file != input_filename))
{
if (TREE_CODE (type) == VOID_TYPE)
error ("forming reference to void");
@@ -6935,8 +6940,7 @@ tsubst (t, args, complain, in_decl)
error ("forming %s to reference type `%T'",
(code == POINTER_TYPE) ? "pointer" : "reference",
type);
- last_line = lineno;
- last_file = input_filename;
+ last_loc = input_location;
}
return error_mark_node;
@@ -6982,21 +6986,28 @@ tsubst (t, args, complain, in_decl)
}
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));
+ {
+ /* 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::*);
+
+ */
+ tree method_type;
+
+ method_type = build_method_type_directly (TYPE_MAIN_VARIANT (r),
+ TREE_TYPE (type),
+ TYPE_ARG_TYPES (type));
+ return build_ptrmemfunc_type (build_pointer_type (method_type));
+ }
else
- return build_offset_type (r, type);
+ return cp_build_qualified_type_real (build_ptrmem_type (r, type),
+ TYPE_QUALS (t),
+ complain);
}
case FUNCTION_TYPE:
case METHOD_TYPE:
@@ -7008,7 +7019,7 @@ tsubst (t, args, complain, in_decl)
if (fntype == error_mark_node)
return error_mark_node;
- /* Substitue the exception specification. */
+ /* Substitute the exception specification. */
raises = TYPE_RAISES_EXCEPTIONS (t);
if (raises)
{
@@ -7048,7 +7059,8 @@ tsubst (t, args, complain, in_decl)
The deduction may fail for any of the following reasons:
-- Attempting to create an array with an element type that
- is void, a function type, or a reference type. */
+ is void, a function type, or a reference type, or [DR337]
+ an abstract class type. */
if (TREE_CODE (type) == VOID_TYPE
|| TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == REFERENCE_TYPE)
@@ -7057,6 +7069,13 @@ tsubst (t, args, complain, in_decl)
error ("creating array of `%T'", type);
return error_mark_node;
}
+ if (CLASS_TYPE_P (type) && CLASSTYPE_PURE_VIRTUALS (type))
+ {
+ if (complain & tf_error)
+ error ("creating array of `%T', which is an abstract class type",
+ type);
+ return error_mark_node;
+ }
r = build_cplus_array_type (type, domain);
return r;
@@ -7169,7 +7188,7 @@ tsubst (t, args, complain, in_decl)
if (e1 == error_mark_node || e2 == error_mark_node)
return error_mark_node;
- return build_nt (ARRAY_REF, e1, e2, tsubst_expr);
+ return build_nt (ARRAY_REF, e1, e2);
}
case CALL_EXPR:
@@ -7199,13 +7218,13 @@ tsubst (t, args, complain, in_decl)
case TYPEOF_TYPE:
{
- tree e1 = tsubst_expr (TYPE_FIELDS (t), args, complain, in_decl);
- if (e1 == error_mark_node)
- return error_mark_node;
+ tree type;
- return cp_build_qualified_type_real (TREE_TYPE (e1),
+ type = finish_typeof (tsubst_expr (TYPE_FIELDS (t), args, complain,
+ in_decl));
+ return cp_build_qualified_type_real (type,
cp_type_quals (t)
- | cp_type_quals (TREE_TYPE (e1)),
+ | cp_type_quals (type),
complain);
}
@@ -7216,15 +7235,150 @@ tsubst (t, args, complain, in_decl)
}
}
+/* Like tsubst_expr for a BASELINK. OBJECT_TYPE, if non-NULL, is the
+ type of the expression on the left-hand side of the "." or "->"
+ operator. */
+
+static tree
+tsubst_baselink (tree baselink, tree object_type,
+ tree args, tsubst_flags_t complain, tree in_decl)
+{
+ tree name;
+ tree qualifying_scope;
+ tree fns;
+ tree template_args = 0;
+ bool template_id_p = false;
+
+ /* A baselink indicates a function from a base class. The
+ BASELINK_ACCESS_BINFO and BASELINK_BINFO are going to have
+ non-dependent types; otherwise, the lookup could not have
+ succeeded. However, they may indicate bases of the template
+ class, rather than the instantiated class.
+
+ In addition, lookups that were not ambiguous before may be
+ ambiguous now. Therefore, we perform the lookup again. */
+ qualifying_scope = BINFO_TYPE (BASELINK_ACCESS_BINFO (baselink));
+ fns = BASELINK_FUNCTIONS (baselink);
+ if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
+ {
+ template_id_p = true;
+ template_args = TREE_OPERAND (fns, 1);
+ fns = TREE_OPERAND (fns, 0);
+ if (template_args)
+ template_args = tsubst_template_args (template_args, args,
+ complain, in_decl);
+ }
+ name = DECL_NAME (get_first_fn (fns));
+ baselink = lookup_fnfields (qualifying_scope, name, /*protect=*/1);
+ if (BASELINK_P (baselink) && template_id_p)
+ BASELINK_FUNCTIONS (baselink)
+ = build_nt (TEMPLATE_ID_EXPR,
+ BASELINK_FUNCTIONS (baselink),
+ template_args);
+ if (!object_type)
+ object_type = current_class_type;
+ return adjust_result_of_qualified_name_lookup (baselink,
+ qualifying_scope,
+ object_type);
+}
+
+/* Like tsubst_expr for a SCOPE_REF, given by QUALIFIED_ID. DONE is
+ true if the qualified-id will be a postfix-expression in-and-of
+ itself; false if more of the postfix-expression follows the
+ QUALIFIED_ID. ADDRESS_P is true if the qualified-id is the operand
+ of "&". */
+
+static tree
+tsubst_qualified_id (tree qualified_id, tree args,
+ tsubst_flags_t complain, tree in_decl,
+ bool done, bool address_p)
+{
+ tree expr;
+ tree scope;
+ tree name;
+ bool is_template;
+ tree template_args;
+
+ my_friendly_assert (TREE_CODE (qualified_id) == SCOPE_REF, 20030706);
+
+ /* Figure out what name to look up. */
+ name = TREE_OPERAND (qualified_id, 1);
+ if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
+ {
+ is_template = true;
+ template_args = TREE_OPERAND (name, 1);
+ if (template_args)
+ template_args = tsubst_template_args (template_args, args,
+ complain, in_decl);
+ name = TREE_OPERAND (name, 0);
+ }
+ else
+ {
+ is_template = false;
+ template_args = NULL_TREE;
+ }
+
+ /* Substitute into the qualifying scope. When there are no ARGS, we
+ are just trying to simplify a non-dependent expression. In that
+ case the qualifying scope may be dependent, and, in any case,
+ substituting will not help. */
+ scope = TREE_OPERAND (qualified_id, 0);
+ if (args)
+ {
+ scope = tsubst (scope, args, complain, in_decl);
+ expr = tsubst_copy (name, args, complain, in_decl);
+ }
+ else
+ expr = name;
+
+ if (dependent_type_p (scope))
+ return build_nt (SCOPE_REF, scope, expr);
+
+ if (!BASELINK_P (name) && !DECL_P (expr))
+ {
+ expr = lookup_qualified_name (scope, expr, /*is_type_p=*/0, false);
+ if (TREE_CODE (TREE_CODE (expr) == TEMPLATE_DECL
+ ? DECL_TEMPLATE_RESULT (expr) : expr) == TYPE_DECL)
+ {
+ if (complain & tf_error)
+ {
+ error ("dependent-name `%E' is parsed as a non-type, but "
+ "instantiation yields a type", qualified_id);
+ inform ("say `typename %E' if a type is meant", qualified_id);
+ }
+ return error_mark_node;
+ }
+ }
+
+ if (DECL_P (expr))
+ check_accessibility_of_qualified_id (expr, /*object_type=*/NULL_TREE,
+ scope);
+
+ /* Remember that there was a reference to this entity. */
+ if (DECL_P (expr))
+ mark_used (expr);
+
+ if (is_template)
+ expr = lookup_template_function (expr, template_args);
+
+ if (expr == error_mark_node && complain & tf_error)
+ qualified_name_lookup_error (scope, TREE_OPERAND (qualified_id, 1));
+ else if (TYPE_P (scope))
+ {
+ expr = (adjust_result_of_qualified_name_lookup
+ (expr, scope, current_class_type));
+ expr = finish_qualified_id_expr (scope, expr, done, address_p);
+ }
+
+ return expr;
+}
+
/* Like tsubst, but deals with expressions. This function just replaces
template parms; to finish processing the resultant expression, use
tsubst_expr. */
-tree
-tsubst_copy (t, args, complain, in_decl)
- tree t, args;
- tsubst_flags_t complain;
- tree in_decl;
+static tree
+tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
enum tree_code code;
tree r;
@@ -7237,16 +7391,25 @@ tsubst_copy (t, args, complain, in_decl)
switch (code)
{
case PARM_DECL:
- return do_identifier (DECL_NAME (t), 0, NULL_TREE);
+ r = retrieve_local_specialization (t);
+ my_friendly_assert (r != NULL, 20020903);
+ mark_used (r);
+ return r;
case CONST_DECL:
{
tree enum_type;
tree v;
- if (!DECL_CONTEXT (t))
- /* This is a global enumeration constant. */
+ if (DECL_TEMPLATE_PARM_P (t))
+ return tsubst_copy (DECL_INITIAL (t), args, complain, in_decl);
+ /* There is no need to substitute into namespace-scope
+ enumerators. */
+ if (DECL_NAMESPACE_SCOPE_P (t))
return t;
+ /* If ARGS is NULL, then T is known to be non-dependent. */
+ if (args == NULL_TREE)
+ return decl_constant_value (t);
/* Unfortunately, we cannot just call lookup_name here.
Consider:
@@ -7283,41 +7446,51 @@ tsubst_copy (t, args, complain, in_decl)
ctx = tsubst_aggr_type (DECL_CONTEXT (t), args, complain, in_decl,
/*entering_scope=*/1);
if (ctx != DECL_CONTEXT (t))
- return lookup_field (ctx, DECL_NAME (t), 0, 0);
+ return lookup_field (ctx, DECL_NAME (t), 0, false);
}
return t;
case VAR_DECL:
case FUNCTION_DECL:
- if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t))
+ if ((DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t))
+ || local_variable_p (t))
t = tsubst (t, args, complain, in_decl);
mark_used (t);
return t;
+ case BASELINK:
+ return tsubst_baselink (t, current_class_type, args, complain, in_decl);
+
case TEMPLATE_DECL:
- if (is_member_template (t))
+ if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
+ return tsubst (TREE_TYPE (DECL_TEMPLATE_RESULT (t)),
+ args, complain, in_decl);
+ else if (is_member_template (t))
return tsubst (t, args, complain, in_decl);
- else
- return t;
+ else if (DECL_CLASS_SCOPE_P (t)
+ && uses_template_parms (DECL_CONTEXT (t)))
+ {
+ /* Template template argument like the following example need
+ special treatment:
- case LOOKUP_EXPR:
- {
- /* 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. */
-
- tree id = tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl);
+ template <template <class> class TT> struct C {};
+ template <class T> struct D {
+ template <class U> struct E {};
+ C<E> c; // #1
+ };
+ D<int> d; // #2
- if (id != TREE_OPERAND (t, 0))
- {
- r = build_nt (LOOKUP_EXPR, id);
- LOOKUP_EXPR_GLOBAL (r) = LOOKUP_EXPR_GLOBAL (t);
- t = r;
- }
+ We are processing the template argument `E' in #1 for
+ the template instantiation #2. Originally, `E' is a
+ TEMPLATE_DECL with `D<T>' as its DECL_CONTEXT. Now we
+ have to substitute this with one having context `D<int>'. */
+ tree context = tsubst (DECL_CONTEXT (t), args, complain, in_decl);
+ return lookup_field (context, DECL_NAME(t), 0, false);
+ }
+ else
+ /* Ordinary template template argument. */
return t;
- }
case CAST_EXPR:
case REINTERPRET_CAST_EXPR:
@@ -7346,6 +7519,40 @@ tsubst_copy (t, args, complain, in_decl)
(code, tsubst (TREE_TYPE (t), args, complain, in_decl),
tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl));
+ case COMPONENT_REF:
+ {
+ tree object;
+ tree name;
+
+ object = tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl);
+ name = TREE_OPERAND (t, 1);
+ if (TREE_CODE (name) == BIT_NOT_EXPR)
+ {
+ name = tsubst_copy (TREE_OPERAND (name, 0), args,
+ complain, in_decl);
+ name = build1 (BIT_NOT_EXPR, NULL_TREE, name);
+ }
+ else if (TREE_CODE (name) == SCOPE_REF
+ && TREE_CODE (TREE_OPERAND (name, 1)) == BIT_NOT_EXPR)
+ {
+ tree base = tsubst_copy (TREE_OPERAND (name, 0), args,
+ complain, in_decl);
+ name = TREE_OPERAND (name, 1);
+ name = tsubst_copy (TREE_OPERAND (name, 0), args,
+ complain, in_decl);
+ name = build1 (BIT_NOT_EXPR, NULL_TREE, name);
+ name = build_nt (SCOPE_REF, base, name);
+ }
+ else if (TREE_CODE (name) == BASELINK)
+ name = tsubst_baselink (name,
+ non_reference (TREE_TYPE (object)),
+ args, complain,
+ in_decl);
+ else
+ name = tsubst_copy (name, args, complain, in_decl);
+ return build_nt (COMPONENT_REF, object, name);
+ }
+
case PLUS_EXPR:
case MINUS_EXPR:
case MULT_EXPR:
@@ -7355,7 +7562,6 @@ tsubst_copy (t, args, complain, in_decl)
case ROUND_DIV_EXPR:
case EXACT_DIV_EXPR:
case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case TRUNC_MOD_EXPR:
@@ -7376,7 +7582,6 @@ tsubst_copy (t, args, complain, in_decl)
case GE_EXPR:
case LT_EXPR:
case GT_EXPR:
- case COMPONENT_REF:
case ARRAY_REF:
case COMPOUND_EXPR:
case SCOPE_REF:
@@ -7391,60 +7596,25 @@ tsubst_copy (t, args, complain, in_decl)
tsubst_copy (TREE_OPERAND (t, 1), args, complain, in_decl));
case CALL_EXPR:
- {
- tree fn = TREE_OPERAND (t, 0);
- if (is_overloaded_fn (fn))
- fn = tsubst_copy (get_first_fn (fn), args, complain, in_decl);
- else
- /* Sometimes FN is a LOOKUP_EXPR. */
- fn = tsubst_copy (fn, args, complain, in_decl);
- return build_nt
- (code, fn, tsubst_copy (TREE_OPERAND (t, 1), args, complain,
- in_decl),
- NULL_TREE);
- }
-
- case METHOD_CALL_EXPR:
- {
- tree name = TREE_OPERAND (t, 0);
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- name = tsubst_copy (TREE_OPERAND (name, 0), args,
- complain, in_decl);
- name = build1 (BIT_NOT_EXPR, NULL_TREE, name);
- }
- else if (TREE_CODE (name) == SCOPE_REF
- && TREE_CODE (TREE_OPERAND (name, 1)) == BIT_NOT_EXPR)
- {
- tree base = tsubst_copy (TREE_OPERAND (name, 0), args,
- complain, in_decl);
- name = TREE_OPERAND (TREE_OPERAND (name, 1), 0);
- if (TREE_CODE (name) == TYPE_DECL)
- name = TREE_TYPE (name);
- name = tsubst_copy (name, args, complain, in_decl);
- name = build1 (BIT_NOT_EXPR, NULL_TREE, name);
- name = build_nt (SCOPE_REF, base, name);
- }
- else
- name = tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl);
- return build_nt
- (code, name, tsubst_copy (TREE_OPERAND (t, 1), args,
+ return build_nt (code,
+ tsubst_copy (TREE_OPERAND (t, 0), args,
complain, in_decl),
- tsubst_copy (TREE_OPERAND (t, 2), args, complain, in_decl),
- NULL_TREE);
- }
+ tsubst_copy (TREE_OPERAND (t, 1), args, complain,
+ in_decl),
+ NULL_TREE);
case STMT_EXPR:
- /* This processing should really occur in tsubst_expr, However,
+ /* 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. */
+ assumes that there aren't any statements inside them. 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);
+
+ tsubst_expr (STMT_EXPR_STMT (t), args,
+ complain | tf_stmt_expr_cmpd, in_decl);
+ return finish_stmt_expr (stmt_expr, false);
}
return t;
@@ -7483,25 +7653,14 @@ tsubst_copy (t, args, complain, in_decl)
case TEMPLATE_ID_EXPR:
{
/* Substituted template arguments */
- tree targs = tsubst_copy (TREE_OPERAND (t, 1), args, complain,
- in_decl);
-
- if (targs && TREE_CODE (targs) == TREE_LIST)
- {
- tree chain;
- for (chain = targs; chain; chain = TREE_CHAIN (chain))
- TREE_VALUE (chain) = maybe_fold_nontype_arg (TREE_VALUE (chain));
- }
- else if (targs)
- {
- int i;
- for (i = 0; i < TREE_VEC_LENGTH (targs); ++i)
- TREE_VEC_ELT (targs, i)
- = maybe_fold_nontype_arg (TREE_VEC_ELT (targs, i));
- }
+ tree fn = TREE_OPERAND (t, 0);
+ tree targs = TREE_OPERAND (t, 1);
- return lookup_template_function
- (tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl), targs);
+ fn = tsubst_copy (fn, args, complain, in_decl);
+ if (targs)
+ targs = tsubst_template_args (targs, args, complain, in_decl);
+
+ return lookup_template_function (fn, targs);
}
case TREE_LIST:
@@ -7558,10 +7717,9 @@ tsubst_copy (t, args, complain, in_decl)
case CONSTRUCTOR:
{
- r = build
- (CONSTRUCTOR, tsubst (TREE_TYPE (t), args, complain, in_decl),
- NULL_TREE, tsubst_copy (CONSTRUCTOR_ELTS (t), args,
- complain, in_decl));
+ r = build_constructor
+ (tsubst (TREE_TYPE (t), args, complain, in_decl),
+ tsubst_copy (CONSTRUCTOR_ELTS (t), args, complain, in_decl));
TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t);
return r;
}
@@ -7576,34 +7734,26 @@ tsubst_copy (t, args, complain, in_decl)
}
}
-/* Like tsubst_copy, but also does semantic processing. */
+/* Like tsubst_copy for expressions, etc. but also does semantic
+ processing. */
-tree
-tsubst_expr (t, args, complain, in_decl)
- tree t, args;
- tsubst_flags_t complain;
- tree in_decl;
+static tree
+tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
tree stmt, tmp;
+ tsubst_flags_t stmt_expr
+ = complain & (tf_stmt_expr_cmpd | tf_stmt_expr_body);
+ complain ^= stmt_expr;
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));
+ if (!STATEMENT_CODE_P (TREE_CODE (t)))
+ return tsubst_copy_and_build (t, args, complain, in_decl,
+ /*function_p=*/false);
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, in_decl));
- break;
-
case CTOR_INITIALIZER:
prep_stmt (t);
finish_mem_initializers (tsubst_initializer_list
@@ -7617,10 +7767,18 @@ tsubst_expr (t, args, complain, in_decl)
break;
case EXPR_STMT:
- prep_stmt (t);
- finish_expr_stmt (tsubst_expr (EXPR_STMT_EXPR (t),
- args, complain, in_decl));
- break;
+ {
+ tree r;
+
+ prep_stmt (t);
+
+ r = tsubst_expr (EXPR_STMT_EXPR (t), args, complain, in_decl);
+ if (stmt_expr & tf_stmt_expr_body && !TREE_CHAIN (t))
+ finish_stmt_expr_expr (r);
+ else
+ finish_expr_stmt (r);
+ break;
+ }
case USING_STMT:
prep_stmt (t);
@@ -7641,9 +7799,16 @@ tsubst_expr (t, args, complain, in_decl)
{
tree scope = DECL_INITIAL (decl);
tree name = DECL_NAME (decl);
+ tree decl;
scope = tsubst_expr (scope, args, complain, in_decl);
- do_local_using_decl (build_nt (SCOPE_REF, scope, name));
+ decl = lookup_qualified_name (scope, name,
+ /*is_type_p=*/false,
+ /*complain=*/false);
+ if (decl == error_mark_node)
+ qualified_name_lookup_error (scope, name);
+ else
+ do_local_using_decl (decl, scope, name);
}
else
{
@@ -7667,14 +7832,14 @@ tsubst_expr (t, args, complain, in_decl)
else
{
maybe_push_decl (decl);
- if (DECL_PRETTY_FUNCTION_P (decl))
+ if (TREE_CODE (decl) == VAR_DECL
+ && DECL_PRETTY_FUNCTION_P (decl))
{
/* For __PRETTY_FUNCTION__ we have to adjust the
initializer. */
const char *const name
= cxx_printable_name (current_function_decl, 2);
- init = cp_fname_init (name);
- TREE_TYPE (decl) = TREE_TYPE (init);
+ init = cp_fname_init (name, &TREE_TYPE (decl));
}
else
init = tsubst_expr (init, args, complain, in_decl);
@@ -7765,12 +7930,14 @@ tsubst_expr (t, args, complain, in_decl)
else
stmt = begin_compound_stmt (COMPOUND_STMT_NO_SCOPE (t));
- tsubst_expr (COMPOUND_BODY (t), args, complain, in_decl);
+ tsubst_expr (COMPOUND_BODY (t), args,
+ complain | ((stmt_expr & tf_stmt_expr_cmpd) << 1),
+ in_decl);
if (COMPOUND_STMT_BODY_BLOCK (t))
finish_function_body (stmt);
else
- finish_compound_stmt (COMPOUND_STMT_NO_SCOPE (t), stmt);
+ finish_compound_stmt (stmt);
}
break;
@@ -7805,7 +7972,7 @@ tsubst_expr (t, args, complain, in_decl)
break;
case LABEL_STMT:
- lineno = STMT_LINENO (t);
+ input_line = STMT_LINENO (t);
finish_label_stmt (DECL_NAME (LABEL_STMT_LABEL (t)));
break;
@@ -7903,21 +8070,585 @@ tsubst_expr (t, args, complain, in_decl)
abort ();
}
- return tsubst_expr (TREE_CHAIN (t), args, complain, in_decl);
+ return tsubst_expr (TREE_CHAIN (t), args, complain | stmt_expr, in_decl);
+}
+
+/* T is a postfix-expression that is not being used in a function
+ call. Return the substituted version of T. */
+
+static tree
+tsubst_non_call_postfix_expression (tree t, tree args,
+ tsubst_flags_t complain,
+ tree in_decl)
+{
+ if (TREE_CODE (t) == SCOPE_REF)
+ t = tsubst_qualified_id (t, args, complain, in_decl,
+ /*done=*/false, /*address_p=*/false);
+ else
+ t = tsubst_copy_and_build (t, args, complain, in_decl,
+ /*function_p=*/false);
+
+ return t;
+}
+
+/* Like tsubst but deals with expressions and performs semantic
+ analysis. FUNCTION_P is true if T is the "F" in "F (ARGS)". */
+
+tree
+tsubst_copy_and_build (tree t,
+ tree args,
+ tsubst_flags_t complain,
+ tree in_decl,
+ bool function_p)
+{
+#define RECUR(NODE) \
+ tsubst_copy_and_build (NODE, args, complain, in_decl, /*function_p=*/false)
+
+ tree op1;
+
+ if (t == NULL_TREE || t == error_mark_node)
+ return t;
+
+ switch (TREE_CODE (t))
+ {
+ case USING_DECL:
+ t = DECL_NAME (t);
+ /* Fallthrough. */
+ case IDENTIFIER_NODE:
+ {
+ tree decl;
+ cp_id_kind idk;
+ tree qualifying_class;
+ bool non_integral_constant_expression_p;
+ const char *error_msg;
+
+ if (IDENTIFIER_TYPENAME_P (t))
+ {
+ tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl);
+ t = mangle_conv_op_name_for_type (new_type);
+ }
+
+ /* Look up the name. */
+ decl = lookup_name (t, 0);
+
+ /* By convention, expressions use ERROR_MARK_NODE to indicate
+ failure, not NULL_TREE. */
+ if (decl == NULL_TREE)
+ decl = error_mark_node;
+
+ decl = finish_id_expression (t, decl, NULL_TREE,
+ &idk,
+ &qualifying_class,
+ /*integral_constant_expression_p=*/false,
+ /*allow_non_integral_constant_expression_p=*/false,
+ &non_integral_constant_expression_p,
+ &error_msg);
+ if (error_msg)
+ error (error_msg);
+ if (!function_p && TREE_CODE (decl) == IDENTIFIER_NODE)
+ decl = unqualified_name_lookup_error (decl);
+ return decl;
+ }
+
+ case TEMPLATE_ID_EXPR:
+ {
+ tree object;
+ tree template = RECUR (TREE_OPERAND (t, 0));
+ tree targs = TREE_OPERAND (t, 1);
+
+ if (targs)
+ targs = tsubst_template_args (targs, args, complain, in_decl);
+
+ if (TREE_CODE (template) == COMPONENT_REF)
+ {
+ object = TREE_OPERAND (template, 0);
+ template = TREE_OPERAND (template, 1);
+ }
+ else
+ object = NULL_TREE;
+ template = lookup_template_function (template, targs);
+
+ if (object)
+ return build (COMPONENT_REF, TREE_TYPE (template),
+ object, template);
+ else
+ return template;
+ }
+
+ case INDIRECT_REF:
+ return build_x_indirect_ref (RECUR (TREE_OPERAND (t, 0)), "unary *");
+
+ case NOP_EXPR:
+ return build_nop
+ (tsubst (TREE_TYPE (t), args, complain, in_decl),
+ RECUR (TREE_OPERAND (t, 0)));
+
+ case CAST_EXPR:
+ return build_functional_cast
+ (tsubst (TREE_TYPE (t), args, complain, in_decl),
+ RECUR (TREE_OPERAND (t, 0)));
+
+ case REINTERPRET_CAST_EXPR:
+ return build_reinterpret_cast
+ (tsubst (TREE_TYPE (t), args, complain, in_decl),
+ RECUR (TREE_OPERAND (t, 0)));
+
+ case CONST_CAST_EXPR:
+ return build_const_cast
+ (tsubst (TREE_TYPE (t), args, complain, in_decl),
+ RECUR (TREE_OPERAND (t, 0)));
+
+ case DYNAMIC_CAST_EXPR:
+ return build_dynamic_cast
+ (tsubst (TREE_TYPE (t), args, complain, in_decl),
+ RECUR (TREE_OPERAND (t, 0)));
+
+ case STATIC_CAST_EXPR:
+ return build_static_cast
+ (tsubst (TREE_TYPE (t), args, complain, in_decl),
+ RECUR (TREE_OPERAND (t, 0)));
+
+ case POSTDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ op1 = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0),
+ args, complain, in_decl);
+ return build_x_unary_op (TREE_CODE (t), op1);
+
+ case PREDECREMENT_EXPR:
+ case PREINCREMENT_EXPR:
+ case NEGATE_EXPR:
+ case BIT_NOT_EXPR:
+ case ABS_EXPR:
+ case TRUTH_NOT_EXPR:
+ case CONVERT_EXPR: /* Unary + */
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ return build_x_unary_op (TREE_CODE (t), RECUR (TREE_OPERAND (t, 0)));
+
+ case ADDR_EXPR:
+ op1 = TREE_OPERAND (t, 0);
+ if (TREE_CODE (op1) == SCOPE_REF)
+ op1 = tsubst_qualified_id (op1, args, complain, in_decl,
+ /*done=*/true, /*address_p=*/true);
+ else
+ op1 = tsubst_non_call_postfix_expression (op1, args, complain,
+ in_decl);
+ if (TREE_CODE (op1) == LABEL_DECL)
+ return finish_label_address_expr (DECL_NAME (op1));
+ return build_x_unary_op (ADDR_EXPR, op1);
+
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ case MULT_EXPR:
+ case TRUNC_DIV_EXPR:
+ case CEIL_DIV_EXPR:
+ case FLOOR_DIV_EXPR:
+ case ROUND_DIV_EXPR:
+ case EXACT_DIV_EXPR:
+ case BIT_AND_EXPR:
+ case BIT_IOR_EXPR:
+ case BIT_XOR_EXPR:
+ case TRUNC_MOD_EXPR:
+ case FLOOR_MOD_EXPR:
+ case TRUTH_ANDIF_EXPR:
+ case TRUTH_ORIF_EXPR:
+ case TRUTH_AND_EXPR:
+ case TRUTH_OR_EXPR:
+ case RSHIFT_EXPR:
+ case LSHIFT_EXPR:
+ case RROTATE_EXPR:
+ case LROTATE_EXPR:
+ case EQ_EXPR:
+ case NE_EXPR:
+ case MAX_EXPR:
+ case MIN_EXPR:
+ case LE_EXPR:
+ case GE_EXPR:
+ case LT_EXPR:
+ case GT_EXPR:
+ case MEMBER_REF:
+ case DOTSTAR_EXPR:
+ return build_x_binary_op
+ (TREE_CODE (t),
+ RECUR (TREE_OPERAND (t, 0)),
+ RECUR (TREE_OPERAND (t, 1)),
+ /*overloaded_p=*/NULL);
+
+ case SCOPE_REF:
+ return tsubst_qualified_id (t, args, complain, in_decl, /*done=*/true,
+ /*address_p=*/false);
+
+ case ARRAY_REF:
+ if (tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl)
+ == NULL_TREE)
+ /* new-type-id */
+ return build_nt (ARRAY_REF, NULL_TREE, RECUR (TREE_OPERAND (t, 1)));
+
+ op1 = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0),
+ args, complain, in_decl);
+ /* Remember that there was a reference to this entity. */
+ if (DECL_P (op1))
+ mark_used (op1);
+ return grok_array_decl (op1, RECUR (TREE_OPERAND (t, 1)));
+
+ case SIZEOF_EXPR:
+ case ALIGNOF_EXPR:
+ op1 = TREE_OPERAND (t, 0);
+ if (!args)
+ {
+ /* When there are no ARGS, we are trying to evaluate a
+ non-dependent expression from the parser. Trying to do
+ the substitutions may not work. */
+ if (!TYPE_P (op1))
+ op1 = TREE_TYPE (op1);
+ }
+ else
+ {
+ ++skip_evaluation;
+ op1 = RECUR (op1);
+ --skip_evaluation;
+ }
+ if (TYPE_P (op1))
+ return cxx_sizeof_or_alignof_type (op1, TREE_CODE (t), true);
+ else
+ return cxx_sizeof_or_alignof_expr (op1, TREE_CODE (t));
+
+ case MODOP_EXPR:
+ return build_x_modify_expr
+ (RECUR (TREE_OPERAND (t, 0)),
+ TREE_CODE (TREE_OPERAND (t, 1)),
+ RECUR (TREE_OPERAND (t, 2)));
+
+ case ARROW_EXPR:
+ op1 = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0),
+ args, complain, in_decl);
+ /* Remember that there was a reference to this entity. */
+ if (DECL_P (op1))
+ mark_used (op1);
+ return build_x_arrow (op1);
+
+ case NEW_EXPR:
+ return build_new
+ (RECUR (TREE_OPERAND (t, 0)),
+ RECUR (TREE_OPERAND (t, 1)),
+ RECUR (TREE_OPERAND (t, 2)),
+ NEW_EXPR_USE_GLOBAL (t));
+
+ case DELETE_EXPR:
+ return delete_sanity
+ (RECUR (TREE_OPERAND (t, 0)),
+ RECUR (TREE_OPERAND (t, 1)),
+ DELETE_EXPR_USE_VEC (t),
+ DELETE_EXPR_USE_GLOBAL (t));
+
+ case COMPOUND_EXPR:
+ return build_x_compound_expr (RECUR (TREE_OPERAND (t, 0)),
+ RECUR (TREE_OPERAND (t, 1)));
+
+ case CALL_EXPR:
+ {
+ tree function;
+ tree call_args;
+ bool qualified_p;
+ bool koenig_p;
+
+ function = TREE_OPERAND (t, 0);
+ /* When we parsed the expression, we determined whether or
+ not Koenig lookup should be performed. */
+ koenig_p = KOENIG_LOOKUP_P (t);
+ if (TREE_CODE (function) == SCOPE_REF)
+ {
+ qualified_p = true;
+ function = tsubst_qualified_id (function, args, complain, in_decl,
+ /*done=*/false,
+ /*address_p=*/false);
+ }
+ else
+ {
+ qualified_p = (TREE_CODE (function) == COMPONENT_REF
+ && (TREE_CODE (TREE_OPERAND (function, 1))
+ == SCOPE_REF));
+ function = tsubst_copy_and_build (function, args, complain,
+ in_decl,
+ !qualified_p);
+ if (BASELINK_P (function))
+ qualified_p = true;
+ }
+
+ call_args = RECUR (TREE_OPERAND (t, 1));
+
+ /* We do not perform argument-dependent lookup if normal
+ lookup finds a non-function, in accordance with the
+ expected resolution of DR 218. */
+ if (koenig_p
+ && (is_overloaded_fn (function)
+ || TREE_CODE (function) == IDENTIFIER_NODE))
+ function = perform_koenig_lookup (function, call_args);
+
+ if (TREE_CODE (function) == IDENTIFIER_NODE)
+ {
+ unqualified_name_lookup_error (function);
+ return error_mark_node;
+ }
+
+ /* Remember that there was a reference to this entity. */
+ if (DECL_P (function))
+ mark_used (function);
+
+ function = convert_from_reference (function);
+
+ if (TREE_CODE (function) == OFFSET_REF)
+ return build_offset_ref_call_from_tree (function, call_args);
+ if (TREE_CODE (function) == COMPONENT_REF)
+ {
+ if (!BASELINK_P (TREE_OPERAND (function, 1)))
+ return finish_call_expr (function, call_args,
+ /*disallow_virtual=*/false,
+ /*koenig_p=*/false);
+ else
+ return (build_new_method_call
+ (TREE_OPERAND (function, 0),
+ TREE_OPERAND (function, 1),
+ call_args, NULL_TREE,
+ qualified_p ? LOOKUP_NONVIRTUAL : LOOKUP_NORMAL));
+ }
+ return finish_call_expr (function, call_args,
+ /*disallow_virtual=*/qualified_p,
+ koenig_p);
+ }
+
+ case COND_EXPR:
+ return build_x_conditional_expr
+ (RECUR (TREE_OPERAND (t, 0)),
+ RECUR (TREE_OPERAND (t, 1)),
+ RECUR (TREE_OPERAND (t, 2)));
+
+ case PSEUDO_DTOR_EXPR:
+ return finish_pseudo_destructor_expr
+ (RECUR (TREE_OPERAND (t, 0)),
+ RECUR (TREE_OPERAND (t, 1)),
+ RECUR (TREE_OPERAND (t, 2)));
+
+ case TREE_LIST:
+ {
+ tree purpose, value, chain;
+
+ if (t == void_list_node)
+ return t;
+
+ purpose = TREE_PURPOSE (t);
+ if (purpose)
+ purpose = RECUR (purpose);
+ value = TREE_VALUE (t);
+ if (value)
+ value = RECUR (value);
+ chain = TREE_CHAIN (t);
+ if (chain && chain != void_type_node)
+ chain = RECUR (chain);
+ if (purpose == TREE_PURPOSE (t)
+ && value == TREE_VALUE (t)
+ && chain == TREE_CHAIN (t))
+ return t;
+ return tree_cons (purpose, value, chain);
+ }
+
+ case COMPONENT_REF:
+ {
+ tree object;
+ tree member;
+
+ object = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0),
+ args, complain, in_decl);
+ /* Remember that there was a reference to this entity. */
+ if (DECL_P (object))
+ mark_used (object);
+
+ member = TREE_OPERAND (t, 1);
+ if (BASELINK_P (member))
+ member = tsubst_baselink (member,
+ non_reference (TREE_TYPE (object)),
+ args, complain, in_decl);
+ else
+ member = tsubst_copy (member, args, complain, in_decl);
+
+ if (!CLASS_TYPE_P (TREE_TYPE (object)))
+ {
+ if (TREE_CODE (member) == BIT_NOT_EXPR)
+ return finish_pseudo_destructor_expr (object,
+ NULL_TREE,
+ TREE_TYPE (object));
+ else if (TREE_CODE (member) == SCOPE_REF
+ && (TREE_CODE (TREE_OPERAND (member, 1)) == BIT_NOT_EXPR))
+ return finish_pseudo_destructor_expr (object,
+ object,
+ TREE_TYPE (object));
+ }
+ else if (TREE_CODE (member) == SCOPE_REF
+ && TREE_CODE (TREE_OPERAND (member, 1)) == TEMPLATE_ID_EXPR)
+ {
+ tree tmpl;
+ tree args;
+
+ /* Lookup the template functions now that we know what the
+ scope is. */
+ tmpl = TREE_OPERAND (TREE_OPERAND (member, 1), 0);
+ args = TREE_OPERAND (TREE_OPERAND (member, 1), 1);
+ member = lookup_qualified_name (TREE_OPERAND (member, 0), tmpl,
+ /*is_type_p=*/false,
+ /*complain=*/false);
+ if (BASELINK_P (member))
+ BASELINK_FUNCTIONS (member)
+ = build_nt (TEMPLATE_ID_EXPR, BASELINK_FUNCTIONS (member),
+ args);
+ else
+ {
+ qualified_name_lookup_error (TREE_TYPE (object), tmpl);
+ return error_mark_node;
+ }
+ }
+ else if (TREE_CODE (member) == FIELD_DECL)
+ return finish_non_static_data_member (member, object, NULL_TREE);
+
+ return finish_class_member_access_expr (object, member);
+ }
+
+ case THROW_EXPR:
+ return build_throw
+ (RECUR (TREE_OPERAND (t, 0)));
+
+ case CONSTRUCTOR:
+ {
+ tree r;
+ tree elts;
+ tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
+ bool purpose_p;
+
+ /* digest_init will do the wrong thing if we let it. */
+ if (type && TYPE_PTRMEMFUNC_P (type))
+ return 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 = RECUR (purpose);
+ value = RECUR (value);
+ r = tree_cons (purpose, value, r);
+ }
+
+ r = build_constructor (NULL_TREE, nreverse (r));
+ TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t);
+
+ if (type)
+ return digest_init (type, r, 0);
+ return r;
+ }
+
+ case TYPEID_EXPR:
+ {
+ tree operand_0 = RECUR (TREE_OPERAND (t, 0));
+ if (TYPE_P (operand_0))
+ return get_typeid (operand_0);
+ return build_typeid (operand_0);
+ }
+
+ case PARM_DECL:
+ return convert_from_reference (tsubst_copy (t, args, complain, in_decl));
+
+ case VAR_DECL:
+ if (args)
+ t = tsubst_copy (t, args, complain, in_decl);
+ return convert_from_reference (t);
+
+ case VA_ARG_EXPR:
+ return build_x_va_arg (RECUR (TREE_OPERAND (t, 0)),
+ tsubst_copy (TREE_TYPE (t), args, complain,
+ in_decl));
+
+ default:
+ return tsubst_copy (t, args, complain, in_decl);
+ }
+
+#undef RECUR
+}
+
+/* Verify that the instantiated ARGS are valid. For type arguments,
+ make sure that the type's linkage is ok. For non-type arguments,
+ make sure they are constants if they are integral or enumerations.
+ Emit an error under control of COMPLAIN, and return TRUE on error. */
+
+static bool
+check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
+{
+ int ix, len = DECL_NTPARMS (tmpl);
+ bool result = false;
+
+ for (ix = 0; ix != len; ix++)
+ {
+ tree t = TREE_VEC_ELT (args, ix);
+
+ if (TYPE_P (t))
+ {
+ /* [basic.link]: A name with no linkage (notably, the name
+ of a class or enumeration declared in a local scope)
+ shall not be used to declare an entity with linkage.
+ This implies that names with no linkage cannot be used as
+ template arguments. */
+ tree nt = no_linkage_check (t);
+
+ if (nt)
+ {
+ if (!(complain & tf_error))
+ /*OK*/;
+ else if (TYPE_ANONYMOUS_P (nt))
+ error ("`%T' uses anonymous type", t);
+ else
+ error ("`%T' uses local type `%T'", t, nt);
+ result = true;
+ }
+ /* In order to avoid all sorts of complications, we do not
+ allow variably-modified types as template arguments. */
+ else if (variably_modified_type_p (t))
+ {
+ if (complain & tf_error)
+ error ("`%T' is a variably modified type", t);
+ result = true;
+ }
+ }
+ /* A non-type argument of integral or enumerated type must be a
+ constant. */
+ else if (TREE_TYPE (t)
+ && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (t))
+ && !TREE_CONSTANT (t))
+ {
+ if (complain & tf_error)
+ error ("integral expression `%E' is not constant", t);
+ result = true;
+ }
+ }
+ if (result && complain & tf_error)
+ error (" trying to instantiate `%D'", tmpl);
+ return result;
}
/* Instantiate the indicated variable or function template TMPL with
the template arguments in TARG_PTR. */
tree
-instantiate_template (tmpl, targ_ptr)
- tree tmpl, targ_ptr;
+instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain)
{
tree fndecl;
tree gen_tmpl;
tree spec;
- int i, len;
- tree inner_args;
if (tmpl == error_mark_node)
return error_mark_node;
@@ -7927,9 +8658,14 @@ instantiate_template (tmpl, targ_ptr)
/* 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 spec;
tree clone;
+ spec = instantiate_template (DECL_CLONED_FUNCTION (tmpl), targ_ptr,
+ complain);
+ if (spec == error_mark_node)
+ return error_mark_node;
+
/* Look for the clone. */
for (clone = TREE_CHAIN (spec);
clone && DECL_CLONED_FUNCTION_P (clone);
@@ -7961,44 +8697,32 @@ instantiate_template (tmpl, targ_ptr)
return spec;
}
- len = DECL_NTPARMS (gen_tmpl);
- inner_args = INNERMOST_TEMPLATE_ARGS (targ_ptr);
- i = len;
- while (i--)
- {
- tree t = TREE_VEC_ELT (inner_args, i);
- if (TYPE_P (t))
- {
- tree nt = target_type (t);
- if (IS_AGGR_TYPE (nt) && decl_function_context (TYPE_MAIN_DECL (nt)))
- {
- 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;
- }
- }
- }
-
- /* Make sure that we can see identifiers, and compute access
- correctly. The desired FUNCTION_DECL for FNDECL may or may not be
- created earlier. Let push_access_scope_real figure that out. */
- push_access_scope_real
- (gen_tmpl, targ_ptr, tsubst (DECL_CONTEXT (gen_tmpl), targ_ptr,
- tf_error, gen_tmpl));
-
- /* substitute template parameters */
+ if (check_instantiated_args (gen_tmpl, INNERMOST_TEMPLATE_ARGS (targ_ptr),
+ complain))
+ return error_mark_node;
+
+ /* We are building a FUNCTION_DECL, during which the access of its
+ parameters and return types have to be checked. However this
+ FUNCTION_DECL which is the desired context for access checking
+ is not built yet. We solve this chicken-and-egg problem by
+ deferring all checks until we have the FUNCTION_DECL. */
+ push_deferring_access_checks (dk_deferred);
+
+ /* Substitute template parameters. */
fndecl = tsubst (DECL_TEMPLATE_RESULT (gen_tmpl),
- targ_ptr, tf_error, gen_tmpl);
+ targ_ptr, complain, gen_tmpl);
- pop_access_scope (gen_tmpl);
+ /* Now we know the specialization, compute access previously
+ deferred. */
+ push_access_scope (fndecl);
+ perform_deferred_access_checks ();
+ pop_access_scope (fndecl);
+ pop_deferring_access_checks ();
/* The DECL_TI_TEMPLATE should always be the immediate parent
template, not the most general template. */
DECL_TI_TEMPLATE (fndecl) = tmpl;
- if (flag_external_templates)
- add_pending_template (fndecl);
-
/* 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
@@ -8051,11 +8775,13 @@ instantiate_template (tmpl, targ_ptr)
partial ordering in [temp.func.order]/6). */
int
-fn_type_unification (fn, explicit_targs, targs, args, return_type,
- strict, len)
- tree fn, explicit_targs, targs, args, return_type;
- unification_kind_t strict;
- int len;
+fn_type_unification (tree fn,
+ tree explicit_targs,
+ tree targs,
+ tree args,
+ tree return_type,
+ unification_kind_t strict,
+ int len)
{
tree parms;
tree fntype;
@@ -8085,6 +8811,7 @@ fn_type_unification (fn, explicit_targs, targs, args, return_type,
template results in an invalid type, type deduction fails. */
int i;
tree converted_args;
+ bool incomplete;
converted_args
= (coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (fn),
@@ -8093,12 +8820,22 @@ fn_type_unification (fn, explicit_targs, targs, args, return_type,
if (converted_args == error_mark_node)
return 1;
+ /* Substitute the explicit args into the function type. This is
+ necessary so that, for instance, explicitly declared function
+ arguments can match null pointed constants. If we were given
+ an incomplete set of explicit args, we must not do semantic
+ processing during substitution as we could create partial
+ instantiations. */
+ incomplete = NUM_TMPL_ARGS (explicit_targs) != NUM_TMPL_ARGS (targs);
+ processing_template_decl += incomplete;
fntype = tsubst (fntype, converted_args, tf_none, NULL_TREE);
+ processing_template_decl -= incomplete;
+
if (fntype == error_mark_node)
return 1;
/* Place the explicitly specified arguments in TARGS. */
- for (i = 0; i < TREE_VEC_LENGTH (targs); i++)
+ for (i = NUM_TMPL_ARGS (converted_args); i--;)
TREE_VEC_ELT (targs, i) = TREE_VEC_ELT (converted_args, i);
}
@@ -8149,10 +8886,9 @@ fn_type_unification (fn, explicit_targs, targs, args, return_type,
initialized with the result of the conversion function. */
static int
-maybe_adjust_types_for_deduction (strict, parm, arg)
- unification_kind_t strict;
- tree* parm;
- tree* arg;
+maybe_adjust_types_for_deduction (unification_kind_t strict,
+ tree* parm,
+ tree* arg)
{
int result = 0;
@@ -8256,12 +8992,14 @@ maybe_adjust_types_for_deduction (strict, parm, arg)
template). */
static int
-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, xlen;
+type_unification_real (tree tparms,
+ tree targs,
+ tree xparms,
+ tree xargs,
+ int subr,
+ unification_kind_t strict,
+ int allow_incomplete,
+ int xlen)
{
tree parm, arg;
int i;
@@ -8274,9 +9012,7 @@ type_unification_real (tparms, targs, xparms, xargs, subr,
my_friendly_assert (TREE_CODE (tparms) == TREE_VEC, 289);
my_friendly_assert (xparms == NULL_TREE
|| TREE_CODE (xparms) == TREE_LIST, 290);
- /* ARGS could be NULL. */
- if (xargs)
- my_friendly_assert (TREE_CODE (xargs) == TREE_LIST, 291);
+ my_friendly_assert (!xargs || TREE_CODE (xargs) == TREE_LIST, 291);
my_friendly_assert (ntparms > 0, 292);
switch (strict)
@@ -8331,17 +9067,14 @@ type_unification_real (tparms, targs, xparms, xargs, subr,
corresponds with a function parameter that contains only
non-deducible template parameters and explicitly specified
template parameters. */
- if (! uses_template_parms (parm))
+ if (!uses_template_parms (parm))
{
tree type;
if (!TYPE_P (arg))
type = TREE_TYPE (arg);
else
- {
- type = arg;
- arg = NULL_TREE;
- }
+ type = arg;
if (strict == DEDUCE_EXACT || strict == DEDUCE_ORDER)
{
@@ -8375,6 +9108,8 @@ type_unification_real (tparms, targs, xparms, xargs, subr,
continue;
}
arg = TREE_TYPE (arg);
+ if (arg == error_mark_node)
+ return 1;
}
{
@@ -8395,7 +9130,7 @@ type_unification_real (tparms, targs, xparms, xargs, subr,
are present, and the parm list isn't variadic. */
if (args && args != void_list_node && parms == void_list_node)
return 1;
- /* Fail if parms are left and they don't have default values. */
+ /* Fail if parms are left and they don't have default values. */
if (parms
&& parms != void_list_node
&& TREE_PURPOSE (parms) == NULL_TREE)
@@ -8430,11 +9165,12 @@ type_unification_real (tparms, targs, xparms, xargs, subr,
succeeds, we go with that. Modifies TARGS and returns 0 on success. */
static int
-resolve_overloaded_unification (tparms, targs, parm, arg, strict,
- sub_strict)
- tree tparms, targs, parm, arg;
- unification_kind_t strict;
- int sub_strict;
+resolve_overloaded_unification (tree tparms,
+ tree targs,
+ tree parm,
+ tree arg,
+ unification_kind_t strict,
+ int sub_strict)
{
tree tempargs = copy_node (targs);
int good = 0;
@@ -8529,11 +9265,11 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
static int
try_one_overload (tree tparms,
- tree orig_targs,
- tree targs,
- tree parm,
- tree arg,
- unification_kind_t strict,
+ tree orig_targs,
+ tree targs,
+ tree parm,
+ tree arg,
+ unification_kind_t strict,
int sub_strict,
bool addr_p)
{
@@ -8618,8 +9354,7 @@ try_one_overload (tree tparms,
ARGS contains template arguments from all levels. */
static int
-verify_class_unification (targs, parms, args)
- tree targs, parms, args;
+verify_class_unification (tree targs, tree parms, tree args)
{
parms = tsubst (parms, add_outermost_template_args (args, targs),
tf_none, NULL_TREE);
@@ -8635,11 +9370,7 @@ verify_class_unification (targs, parms, args)
TARGS are as for unify. */
static tree
-try_class_unification (tparms, targs, parm, arg)
- tree tparms;
- tree targs;
- tree parm;
- tree arg;
+try_class_unification (tree tparms, tree targs, tree parm, tree arg)
{
tree copy_of_targs;
@@ -8693,14 +9424,12 @@ try_class_unification (tparms, targs, parm, arg)
for the base class of ARG that we are currently examining. */
static tree
-get_template_base_recursive (tparms, targs, parm,
- arg_binfo, rval, flags)
- tree tparms;
- tree targs;
- tree arg_binfo;
- tree rval;
- tree parm;
- int flags;
+get_template_base_recursive (tree tparms,
+ tree targs,
+ tree parm,
+ tree arg_binfo,
+ tree rval,
+ int flags)
{
tree binfos;
int i, n_baselinks;
@@ -8744,7 +9473,7 @@ get_template_base_recursive (tparms, targs, parm,
/* When searching for a non-virtual, we cannot mark virtually
found binfos. */
if (! this_virtual)
- SET_BINFO_MARKED (base_binfo);
+ BINFO_MARKED (base_binfo) = 1;
rval = get_template_base_recursive (tparms, targs,
parm,
@@ -8769,11 +9498,7 @@ get_template_base_recursive (tparms, targs, parm,
as well as a plain template type. Used by unify. */
static tree
-get_template_base (tparms, targs, parm, arg)
- tree tparms;
- tree targs;
- tree parm;
- tree arg;
+get_template_base (tree tparms, tree targs, tree parm, tree arg)
{
tree rval;
tree arg_binfo;
@@ -8796,8 +9521,7 @@ get_template_base (tparms, targs, parm, arg)
/* Returns the level of DECL, which declares a template parameter. */
static int
-template_decl_level (decl)
- tree decl;
+template_decl_level (tree decl)
{
switch (TREE_CODE (decl))
{
@@ -8816,28 +9540,34 @@ template_decl_level (decl)
/* Decide whether ARG can be unified with PARM, considering only the
cv-qualifiers of each type, given STRICT as documented for unify.
- Returns nonzero iff the unification is OK on that basis.*/
+ Returns nonzero iff the unification is OK on that basis. */
static int
-check_cv_quals_for_unify (strict, arg, parm)
- int strict;
- tree arg;
- tree parm;
+check_cv_quals_for_unify (int strict, tree arg, tree parm)
{
int arg_quals = cp_type_quals (arg);
int parm_quals = cp_type_quals (parm);
- if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM)
- {
- /* If the cvr quals of parm will not unify with ARG, they'll be
- ignored in instantiation, so we have to do the same here. */
- if (TREE_CODE (arg) == REFERENCE_TYPE)
- parm_quals &= ~(TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
- if (!POINTER_TYPE_P (arg) &&
- TREE_CODE (arg) != TEMPLATE_TYPE_PARM)
- parm_quals &= ~TYPE_QUAL_RESTRICT;
+ if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM
+ && !(strict & UNIFY_ALLOW_OUTER_MORE_CV_QUAL))
+ {
+ /* Although a CVR qualifier is ignored when being applied to a
+ substituted template parameter ([8.3.2]/1 for example), that
+ does not apply during deduction [14.8.2.4]/1, (even though
+ that is not explicitly mentioned, [14.8.2.4]/9 indicates
+ this). Except when we're allowing additional CV qualifiers
+ at the outer level [14.8.2.1]/3,1st bullet. */
+ if ((TREE_CODE (arg) == REFERENCE_TYPE
+ || TREE_CODE (arg) == FUNCTION_TYPE
+ || TREE_CODE (arg) == METHOD_TYPE)
+ && (parm_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)))
+ return 0;
+
+ if ((!POINTER_TYPE_P (arg) && TREE_CODE (arg) != TEMPLATE_TYPE_PARM)
+ && (parm_quals & TYPE_QUAL_RESTRICT))
+ return 0;
}
-
+
if (!(strict & (UNIFY_ALLOW_MORE_CV_QUAL | UNIFY_ALLOW_OUTER_MORE_CV_QUAL))
&& (arg_quals & parm_quals) != parm_quals)
return 0;
@@ -8889,9 +9619,7 @@ check_cv_quals_for_unify (strict, arg, parm)
folding PARM. */
static int
-unify (tparms, targs, parm, arg, strict)
- tree tparms, targs, parm, arg;
- int strict;
+unify (tree tparms, tree targs, tree parm, tree arg, int strict)
{
int idx;
tree targ;
@@ -9036,12 +9764,6 @@ unify (tparms, targs, parm, arg, strict)
}
else
{
- /* If ARG is an offset type, we're trying to unify '*T' with
- 'U C::*', which is ill-formed. See the comment in the
- POINTER_TYPE case about this ugliness. */
- if (TREE_CODE (arg) == OFFSET_TYPE)
- return 1;
-
/* If PARM is `const T' and ARG is only `int', we don't have
a match unless we are allowing additional qualification.
If ARG is `const int' and PARM is just `T' that's OK;
@@ -9084,22 +9806,14 @@ unify (tparms, targs, parm, arg, strict)
!= template_decl_level (tparm))
/* The PARM is not one we're trying to unify. Just check
to see if it matches ARG. */
- return (TREE_CODE (arg) == TREE_CODE (parm)
- && cp_tree_equal (parm, arg) > 0) ? 0 : 1;
+ return !(TREE_CODE (arg) == TREE_CODE (parm)
+ && cp_tree_equal (parm, arg));
idx = TEMPLATE_PARM_IDX (parm);
targ = TREE_VEC_ELT (targs, idx);
if (targ)
- {
- int i = (cp_tree_equal (targ, arg) > 0);
- if (i == 1)
- return 0;
- else if (i == 0)
- return 1;
- else
- abort ();
- }
+ return !cp_tree_equal (targ, arg);
/* [temp.deduct.type] If, in the declaration of a function template
with a non-type template-parameter, the non-type
@@ -9130,6 +9844,27 @@ unify (tparms, targs, parm, arg, strict)
TREE_VEC_ELT (targs, idx) = arg;
return 0;
+ case PTRMEM_CST:
+ {
+ /* A pointer-to-member constant can be unified only with
+ another constant. */
+ if (TREE_CODE (arg) != PTRMEM_CST)
+ return 1;
+
+ /* Just unify the class member. It would be useless (and possibly
+ wrong, depending on the strict flags) to unify also
+ PTRMEM_CST_CLASS, because we want to be sure that both parm and
+ arg refer to the same variable, even if through different
+ classes. For instance:
+
+ struct A { int x; };
+ struct B : A { };
+
+ Unification of &A::x and &B::x must succeed. */
+ return unify (tparms, targs, PTRMEM_CST_MEMBER (parm),
+ PTRMEM_CST_MEMBER (arg), strict);
+ }
+
case POINTER_TYPE:
{
if (TREE_CODE (arg) != POINTER_TYPE)
@@ -9150,18 +9885,6 @@ unify (tparms, targs, parm, arg, strict)
level of pointers. */
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... */
-
- parm = TREE_TYPE (parm);
- arg = TREE_TYPE (arg);
- goto offset;
- }
-
return unify (tparms, targs, TREE_TYPE (parm),
TREE_TYPE (arg), strict);
}
@@ -9315,7 +10038,6 @@ unify (tparms, targs, parm, arg, strict)
DEDUCE_EXACT, 0, -1);
case OFFSET_TYPE:
- offset:
if (TREE_CODE (arg) != OFFSET_TYPE)
return 1;
if (unify (tparms, targs, TYPE_OFFSET_BASETYPE (parm),
@@ -9325,10 +10047,13 @@ unify (tparms, targs, parm, arg, strict)
strict);
case CONST_DECL:
+ if (DECL_TEMPLATE_PARM_P (parm))
+ return unify (tparms, targs, DECL_INITIAL (parm), arg, strict);
if (arg != decl_constant_value (parm))
return 1;
return 0;
+ case FIELD_DECL:
case TEMPLATE_DECL:
/* Matched cases are handled by the ARG == PARM test above. */
return 1;
@@ -9352,7 +10077,7 @@ unify (tparms, targs, parm, arg, strict)
return unify (tparms, targs, t1, t, strict);
}
- /* else fall through */
+ /* Else fall through. */
default:
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (parm))))
@@ -9396,9 +10121,7 @@ unify (tparms, targs, parm, arg, strict)
instantiation of RESULT has been assigned to this file. */
void
-mark_decl_instantiated (result, extern_p)
- tree result;
- int extern_p;
+mark_decl_instantiated (tree result, int extern_p)
{
/* We used to set this unconditionally; we moved that to
do_decl_instantiation so it wouldn't get set on members of
@@ -9450,14 +10173,15 @@ mark_decl_instantiated (result, extern_p)
LEN is passed through to fn_type_unification. */
int
-more_specialized (pat1, pat2, deduce, len)
- tree pat1, pat2;
- int deduce;
- int len;
+more_specialized (tree pat1, tree pat2, int deduce, int len)
{
tree targs;
int winner = 0;
+ /* If template argument deduction succeeds, we substitute the
+ resulting arguments into non-deduced contexts. While doing that,
+ we must be aware that we may encounter dependent types. */
+ ++processing_template_decl;
targs = get_bindings_real (pat1, DECL_TEMPLATE_RESULT (pat2),
NULL_TREE, 0, deduce, len);
if (targs)
@@ -9467,6 +10191,7 @@ more_specialized (pat1, pat2, deduce, len)
NULL_TREE, 0, deduce, len);
if (targs)
++winner;
+ --processing_template_decl;
return winner;
}
@@ -9481,12 +10206,16 @@ more_specialized (pat1, pat2, deduce, len)
partial ordering. */
int
-more_specialized_class (pat1, pat2, full_args)
- tree pat1, pat2, full_args;
+more_specialized_class (tree pat1, tree pat2, tree full_args)
{
tree targs;
int winner = 0;
+ /* Just like what happens for functions, if we are ordering between
+ different class template specializations, we may encounter dependent
+ types in the arguments, and we need our dependency check functions
+ to behave correctly. */
+ ++processing_template_decl;
targs = get_class_bindings (TREE_VALUE (pat1), TREE_PURPOSE (pat1),
add_outermost_template_args (full_args, TREE_PURPOSE (pat2)));
if (targs)
@@ -9496,6 +10225,7 @@ more_specialized_class (pat1, pat2, full_args)
add_outermost_template_args (full_args, TREE_PURPOSE (pat1)));
if (targs)
++winner;
+ --processing_template_decl;
return winner;
}
@@ -9507,9 +10237,12 @@ more_specialized_class (pat1, pat2, full_args)
found. DEDUCE and LEN are passed through to fn_type_unification. */
static tree
-get_bindings_real (fn, decl, explicit_args, check_rettype, deduce, len)
- tree fn, decl, explicit_args;
- int check_rettype, deduce, len;
+get_bindings_real (tree fn,
+ tree decl,
+ tree explicit_args,
+ int check_rettype,
+ int deduce,
+ int len)
{
int ntparms = DECL_NTPARMS (fn);
tree targs = make_tree_vec (ntparms);
@@ -9563,9 +10296,8 @@ get_bindings_real (fn, decl, explicit_args, check_rettype, deduce, len)
/* For most uses, we want to check the return type. */
-tree
-get_bindings (fn, decl, explicit_args)
- tree fn, decl, explicit_args;
+static tree
+get_bindings (tree fn, tree decl, tree explicit_args)
{
return get_bindings_real (fn, decl, explicit_args, 1, DEDUCE_EXACT, -1);
}
@@ -9574,8 +10306,7 @@ get_bindings (fn, decl, explicit_args)
types. */
static tree
-get_bindings_overload (fn, decl, explicit_args)
- tree fn, decl, explicit_args;
+get_bindings_overload (tree fn, tree decl, tree explicit_args)
{
return get_bindings_real (fn, decl, explicit_args, 0, DEDUCE_EXACT, -1);
}
@@ -9596,8 +10327,7 @@ get_bindings_overload (fn, decl, explicit_args)
is bound to `double'. */
static tree
-get_class_bindings (tparms, parms, args)
- tree tparms, parms, args;
+get_class_bindings (tree tparms, tree parms, tree args)
{
int i, ntparms = TREE_VEC_LENGTH (tparms);
tree vec = make_tree_vec (ntparms);
@@ -9624,8 +10354,7 @@ get_class_bindings (tparms, parms, args)
NULL_TREE is returned. */
tree
-most_specialized_instantiation (instantiations)
- tree instantiations;
+most_specialized_instantiation (tree instantiations)
{
tree fn, champ;
int fate;
@@ -9668,8 +10397,7 @@ most_specialized_instantiation (instantiations)
arguments EXPLICIT_ARGS. */
static tree
-most_specialized (fns, decl, explicit_args)
- tree fns, decl, explicit_args;
+most_specialized (tree fns, tree decl, tree explicit_args)
{
tree candidates = NULL_TREE;
tree fn, args;
@@ -9703,8 +10431,7 @@ most_specialized (fns, decl, explicit_args)
`template <class T> template <class U> S<T*>::f(U)'. */
tree
-most_general_template (decl)
- tree decl;
+most_general_template (tree decl)
{
/* If DECL is a FUNCTION_DECL, find the TEMPLATE_DECL of which it is
an immediate specialization. */
@@ -9724,8 +10451,8 @@ most_general_template (decl)
/* Look for more and more general templates. */
while (DECL_TEMPLATE_INFO (decl))
{
- /* The DECL_TI_TEMPLATE can be a LOOKUP_EXPR or IDENTIFIER_NODE
- in some cases. (See cp-tree.h for details.) */
+ /* The DECL_TI_TEMPLATE can be an IDENTIFIER_NODE in some cases.
+ (See cp-tree.h for details.) */
if (TREE_CODE (DECL_TI_TEMPLATE (decl)) != TEMPLATE_DECL)
break;
@@ -9750,9 +10477,7 @@ most_general_template (decl)
error_mark_node if the choice is ambiguous. */
static tree
-most_specialized_class (tmpl, args)
- tree tmpl;
- tree args;
+most_specialized_class (tree tmpl, tree args)
{
tree list = NULL_TREE;
tree t;
@@ -9831,10 +10556,10 @@ do_decl_instantiation (tree decl, tree storage)
VAR_DECLs so we do the lookup here. Probably, grokdeclarator
should handle VAR_DECLs as it currently handles
FUNCTION_DECLs. */
- result = lookup_field (DECL_CONTEXT (decl), DECL_NAME (decl), 0, 0);
- if (result && TREE_CODE (result) != VAR_DECL)
+ result = lookup_field (DECL_CONTEXT (decl), DECL_NAME (decl), 0, false);
+ if (!result || TREE_CODE (result) != VAR_DECL)
{
- error ("no matching template for `%D' found", result);
+ error ("no matching template for `%D' found", decl);
return;
}
}
@@ -9894,9 +10619,6 @@ do_decl_instantiation (tree decl, tree storage)
return;
}
- if (flag_external_templates)
- return;
-
if (storage == NULL_TREE)
;
else if (storage == ridpointers[(int) RID_EXTERN])
@@ -9917,9 +10639,7 @@ do_decl_instantiation (tree decl, tree storage)
}
void
-mark_class_instantiated (t, extern_p)
- tree t;
- int extern_p;
+mark_class_instantiated (tree t, int extern_p)
{
SET_CLASSTYPE_EXPLICIT_INSTANTIATION (t);
SET_CLASSTYPE_INTERFACE_KNOWN (t);
@@ -9933,7 +10653,7 @@ mark_class_instantiated (t, extern_p)
}
/* Called from do_type_instantiation through binding_table_foreach to
- do recursive instantiation for the type bound in ENTRY. */
+ do recursive instantiation for the type bound in ENTRY. */
static void
bt_instantiate_type_proc (binding_entry entry, void *data)
{
@@ -9950,9 +10670,7 @@ bt_instantiate_type_proc (binding_entry entry, void *data)
since the standard is unclear (as detailed below). */
void
-do_type_instantiation (t, storage, complain)
- tree t, storage;
- tsubst_flags_t complain;
+do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
{
int extern_p = 0;
int nomem_p = 0;
@@ -9969,11 +10687,6 @@ do_type_instantiation (t, storage, complain)
complete_type (t);
- /* With -fexternal-templates, explicit instantiations are treated the same
- as implicit ones. */
- if (flag_external_templates)
- return;
-
if (!COMPLETE_TYPE_P (t))
{
if (complain & tf_error)
@@ -10084,8 +10797,8 @@ do_type_instantiation (t, storage, complain)
instantiate_decl (tmp, /*defer_ok=*/1);
}
- if (CLASSTYPE_NESTED_UDTS (t))
- binding_table_foreach (CLASSTYPE_NESTED_UDTS (t),
+ if (CLASSTYPE_NESTED_UTDS (t))
+ binding_table_foreach (CLASSTYPE_NESTED_UTDS (t),
bt_instantiate_type_proc, &storage);
}
}
@@ -10111,9 +10824,7 @@ do_type_instantiation (t, storage, complain)
to instantiate the DECL, we regenerate it. */
static void
-regenerate_decl_from_template (decl, tmpl)
- tree decl;
- tree tmpl;
+regenerate_decl_from_template (tree decl, tree tmpl)
{
/* The most general version of TMPL. */
tree gen_tmpl;
@@ -10122,7 +10833,7 @@ regenerate_decl_from_template (decl, tmpl)
tree args;
tree code_pattern;
tree new_decl;
- int unregistered;
+ bool unregistered;
args = DECL_TI_ARGS (decl);
code_pattern = DECL_TEMPLATE_RESULT (tmpl);
@@ -10133,14 +10844,17 @@ regenerate_decl_from_template (decl, tmpl)
instantiation of a specialization, which it isn't: it's a full
instantiation. */
gen_tmpl = most_general_template (tmpl);
- push_access_scope_real (gen_tmpl, args, DECL_CONTEXT (decl));
- unregistered = reregister_specialization (decl, gen_tmpl, NULL_TREE);
+ unregistered = reregister_specialization (decl, gen_tmpl,
+ /*new_spec=*/NULL_TREE);
/* If the DECL was not unregistered then something peculiar is
happening: we created a specialization but did not call
register_specialization for it. */
my_friendly_assert (unregistered, 0);
+ /* Make sure that we can see identifiers, and compute access
+ correctly. */
+ push_access_scope (decl);
/* Do the substitution to get the new declaration. */
new_decl = tsubst (code_pattern, args, tf_error, NULL_TREE);
@@ -10183,14 +10897,71 @@ regenerate_decl_from_template (decl, tmpl)
register_specialization (decl, gen_tmpl, args);
}
+/* Return the TEMPLATE_DECL into which DECL_TI_ARGS(DECL) should be
+ substituted to get DECL. */
+
+tree
+template_for_substitution (tree decl)
+{
+ tree tmpl = DECL_TI_TEMPLATE (decl);
+
+ /* Set TMPL to the template whose DECL_TEMPLATE_RESULT is the pattern
+ for the instantiation. This is not always the most general
+ template. Consider, for example:
+
+ template <class T>
+ struct S { template <class U> void f();
+ template <> void f<int>(); };
+
+ 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>. */
+ while (/* An instantiation cannot have a definition, so we need a
+ more general template. */
+ DECL_TEMPLATE_INSTANTIATION (tmpl)
+ /* 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 (decl) == FUNCTION_DECL
+ && DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (tmpl)
+ && !DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl))))
+ {
+ /* The present template, TD, should not be a definition. If it
+ were a definition, we should be using it! Note that we
+ cannot restructure the loop to just keep going until we find
+ a template with a definition, since that might go too far if
+ a specialization was declared, but not defined. */
+ my_friendly_assert (!(TREE_CODE (decl) == VAR_DECL
+ && !DECL_IN_AGGR_P (DECL_TEMPLATE_RESULT (tmpl))),
+ 0);
+
+ /* Fetch the more general template. */
+ tmpl = DECL_TI_TEMPLATE (tmpl);
+ }
+
+ return tmpl;
+}
+
/* Produce the definition of D, a _DECL generated from a template. If
DEFER_OK is nonzero, then we don't have to actually do the
instantiation now; we just have to do it sometime. */
tree
-instantiate_decl (d, defer_ok)
- tree d;
- int defer_ok;
+instantiate_decl (tree d, int defer_ok)
{
tree tmpl = DECL_TI_TEMPLATE (d);
tree gen_args;
@@ -10200,15 +10971,19 @@ instantiate_decl (d, defer_ok)
tree spec;
tree gen_tmpl;
int pattern_defined;
- int line = lineno;
int need_push;
- const char *file = input_filename;
-
+ location_t saved_loc = input_location;
+
/* 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);
+ /* Variables are never deferred; if instantiation is required, they
+ are instantiated right away. That allows for better code in the
+ case that an expression refers to the value of the variable --
+ if the variable has a constant value the referring expression can
+ take advantage of that fact. */
if (TREE_CODE (d) == VAR_DECL)
defer_ok = 0;
@@ -10242,55 +11017,12 @@ instantiate_decl (d, defer_ok)
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:
-
- template <class T>
- struct S { template <class U> void f();
- template <> void f<int>(); };
-
- 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;
- 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
- cannot restructure the loop to just keep going until we find
- a template with a definition, since that might go too far if
- a specialization was declared, but not defined. */
- my_friendly_assert (!(TREE_CODE (d) == VAR_DECL
- && !DECL_IN_AGGR_P (DECL_TEMPLATE_RESULT (td))),
- 0);
-
- /* Fetch the more general template. */
- td = DECL_TI_TEMPLATE (td);
- }
+ /* We may be in the middle of deferred access check. Disable it now. */
+ push_deferring_access_checks (dk_no_deferred);
+ /* Set TD to the template whose DECL_TEMPLATE_RESULT is the pattern
+ for the instantiation. */
+ td = template_for_substitution (d);
code_pattern = DECL_TEMPLATE_RESULT (td);
if ((DECL_NAMESPACE_SCOPE_P (d) && !DECL_INITIALIZED_IN_CLASS_P (d))
@@ -10308,8 +11040,7 @@ instantiate_decl (d, defer_ok)
else
pattern_defined = ! DECL_IN_AGGR_P (code_pattern);
- lineno = DECL_SOURCE_LINE (d);
- input_filename = DECL_SOURCE_FILE (d);
+ input_location = DECL_SOURCE_LOCATION (d);
if (pattern_defined)
{
@@ -10333,22 +11064,6 @@ instantiate_decl (d, defer_ok)
else
repo_template_used (d);
- if (flag_external_templates && ! DECL_INTERFACE_KNOWN (d))
- {
- if (flag_alt_external_templates)
- {
- if (interface_unknown)
- warn_if_unknown_interface (d);
- }
- else if (DECL_INTERFACE_KNOWN (code_pattern))
- {
- DECL_INTERFACE_KNOWN (d) = 1;
- DECL_NOT_REALLY_EXTERN (d) = ! DECL_EXTERNAL (code_pattern);
- }
- else
- warn_if_unknown_interface (code_pattern);
- }
-
if (at_eof)
import_export_decl (d);
}
@@ -10396,8 +11111,7 @@ instantiate_decl (d, defer_ok)
because it's used by add_pending_template. */
else if (! pattern_defined || defer_ok)
{
- lineno = line;
- input_filename = file;
+ input_location = saved_loc;
if (at_eof && !pattern_defined
&& DECL_EXPLICIT_INSTANTIATION (d))
@@ -10419,14 +11133,18 @@ instantiate_decl (d, defer_ok)
if (need_push)
push_to_top_level ();
+ /* Mark D as instantiated so that recursive calls to
+ instantiate_decl do not try to instantiate it again. */
+ DECL_TEMPLATE_INSTANTIATED (d) = 1;
+
/* Regenerate the declaration in case the template has been modified
by a subsequent redeclaration. */
regenerate_decl_from_template (d, td);
/* We already set the file and line above. Reset them now in case
- they changed as a result of calling regenerate_decl_from_template. */
- lineno = DECL_SOURCE_LINE (d);
- input_filename = DECL_SOURCE_FILE (d);
+ they changed as a result of calling
+ regenerate_decl_from_template. */
+ input_location = DECL_SOURCE_LOCATION (d);
if (TREE_CODE (d) == VAR_DECL)
{
@@ -10445,7 +11163,7 @@ instantiate_decl (d, defer_ok)
(1) D is a template static data member, for which a
definition is available.
- (2) An implicit or explicit instantiation has occured.
+ (2) An implicit or explicit instantiation has occurred.
(3) We are not going to emit a definition of the static
data member at this time.
@@ -10455,22 +11173,38 @@ instantiate_decl (d, defer_ok)
instantiation. There, we cannot implicitly instantiate a
defined static data member in more than one translation
unit, so import_export_decl marks the declaration as
- external; we must rely on explicit instantiation. */
+ external; we must rely on explicit instantiation.
+
+ Reset instantiated marker to make sure that later
+ explicit instantiation will be processed. */
+ DECL_TEMPLATE_INSTANTIATED (d) = 0;
}
else
{
- /* Mark D as instantiated so that recursive calls to
- instantiate_decl do not try to instantiate it again. */
- DECL_TEMPLATE_INSTANTIATED (d) = 1;
+ /* This is done in analogous to `start_decl'. It is
+ required for correct access checking. */
+ push_nested_class (DECL_CONTEXT (d));
cp_finish_decl (d,
(!DECL_INITIALIZED_IN_CLASS_P (d)
? DECL_INITIAL (d) : NULL_TREE),
NULL_TREE, 0);
+ /* Normally, pop_nested_class is called by cp_finish_decl
+ above. But when instantiate_decl is triggered during
+ instantiate_class_template processing, its DECL_CONTEXT
+ is still not completed yet, and pop_nested_class isn't
+ called. */
+ if (!COMPLETE_TYPE_P (DECL_CONTEXT (d)))
+ pop_nested_class ();
}
+ /* We're not deferring instantiation any more. */
+ TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
}
else if (TREE_CODE (d) == FUNCTION_DECL)
{
htab_t saved_local_specializations;
+ tree subst_decl;
+ tree tmpl_parm;
+ tree spec_parm;
/* Mark D as instantiated so that recursive calls to
instantiate_decl do not try to instantiate it again. */
@@ -10482,14 +11216,32 @@ instantiate_decl (d, defer_ok)
/* Set up the list of local specializations. */
local_specializations = htab_create (37,
- htab_hash_pointer,
- htab_eq_pointer,
+ hash_local_specialization,
+ eq_local_specializations,
NULL);
/* Set up context. */
import_export_decl (d);
start_function (NULL_TREE, d, NULL_TREE, SF_PRE_PARSED);
+ /* Create substitution entries for the parameters. */
+ subst_decl = DECL_TEMPLATE_RESULT (template_for_substitution (d));
+ tmpl_parm = DECL_ARGUMENTS (subst_decl);
+ spec_parm = DECL_ARGUMENTS (d);
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (d))
+ {
+ register_local_specialization (spec_parm, tmpl_parm);
+ spec_parm = skip_artificial_parms_for (d, spec_parm);
+ tmpl_parm = skip_artificial_parms_for (subst_decl, tmpl_parm);
+ }
+ while (tmpl_parm)
+ {
+ register_local_specialization (spec_parm, tmpl_parm);
+ tmpl_parm = TREE_CHAIN (tmpl_parm);
+ spec_parm = TREE_CHAIN (spec_parm);
+ }
+ my_friendly_assert (!spec_parm, 20020813);
+
/* Substitute into the body of the function. */
tsubst_expr (DECL_SAVED_TREE (code_pattern), args,
tf_error | tf_warning, tmpl);
@@ -10498,21 +11250,20 @@ instantiate_decl (d, defer_ok)
htab_delete (local_specializations);
local_specializations = saved_local_specializations;
+ /* We're not deferring instantiation any more. */
+ TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
+
/* Finish the function. */
d = finish_function (0);
- expand_body (d);
+ expand_or_defer_fn (d);
}
- /* 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;
-
+ input_location = saved_loc;
+ pop_deferring_access_checks ();
pop_tinst_level ();
timevar_pop (TV_PARSE);
@@ -10524,12 +11275,13 @@ out:
instantiate, and instantiate any we can. */
int
-instantiate_pending_templates ()
+instantiate_pending_templates (void)
{
tree *t;
tree last = NULL_TREE;
int instantiated_something = 0;
int reconsider;
+ location_t saved_loc = input_location;
do
{
@@ -10604,6 +11356,7 @@ instantiate_pending_templates ()
}
while (reconsider);
+ input_location = saved_loc;
return instantiated_something;
}
@@ -10613,8 +11366,7 @@ instantiate_pending_templates ()
instantiate_decl. */
static tree
-tsubst_initializer_list (t, argvec)
- tree t, argvec;
+tsubst_initializer_list (tree t, tree argvec)
{
tree inits = NULL_TREE;
@@ -10655,8 +11407,7 @@ tsubst_initializer_list (t, argvec)
/* Set CURRENT_ACCESS_SPECIFIER based on the protection of DECL. */
static void
-set_current_access_from_decl (decl)
- tree decl;
+set_current_access_from_decl (tree decl)
{
if (TREE_PRIVATE (decl))
current_access_specifier = access_private_node;
@@ -10671,28 +11422,27 @@ set_current_access_from_decl (decl)
start_enum) and ARGS are the template arguments to use. */
static void
-tsubst_enum (tag, newtag, args)
- tree tag;
- tree newtag;
- tree args;
+tsubst_enum (tree tag, tree newtag, tree args)
{
tree e;
for (e = TYPE_VALUES (tag); e; e = TREE_CHAIN (e))
{
tree value;
-
+ tree decl;
+
+ decl = TREE_VALUE (e);
/* 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)),
+ value = tsubst_expr (DECL_INITIAL (decl),
args, tf_error | tf_warning,
NULL_TREE);
/* Give this enumeration constant the correct access. */
- set_current_access_from_decl (TREE_VALUE (e));
+ set_current_access_from_decl (decl);
/* Actually build the enumerator itself. */
- build_enumerator (TREE_PURPOSE (e), value, newtag);
+ build_enumerator (DECL_NAME (decl), value, newtag);
}
finish_enum (newtag);
@@ -10706,8 +11456,7 @@ tsubst_enum (tag, newtag, args)
the type. */
tree
-get_mostly_instantiated_function_type (decl)
- tree decl;
+get_mostly_instantiated_function_type (tree decl)
{
tree fn_type;
tree tmpl;
@@ -10751,9 +11500,11 @@ get_mostly_instantiated_function_type (decl)
specialized or not. */
push_access_scope (decl);
+ ++processing_template_decl;
/* Now, do the (partial) substitution to figure out the
appropriate function type. */
fn_type = tsubst (fn_type, partial_args, tf_error, NULL_TREE);
+ --processing_template_decl;
/* Substitute into the template parameters to obtain the real
innermost set of parameters. This step is important if the
@@ -10771,20 +11522,20 @@ get_mostly_instantiated_function_type (decl)
/* Return truthvalue if we're processing a template different from
the last one involved in diagnostics. */
int
-problematic_instantiation_changed ()
+problematic_instantiation_changed (void)
{
return last_template_error_tick != tinst_level_tick;
}
/* Remember current template involved in diagnostics. */
void
-record_last_problematic_instantiation ()
+record_last_problematic_instantiation (void)
{
last_template_error_tick = tinst_level_tick;
}
tree
-current_instantiation ()
+current_instantiation (void)
{
return current_tinst_level;
}
@@ -10794,17 +11545,13 @@ current_instantiation ()
warning messages under control of COMPLAIN. */
static int
-invalid_nontype_parm_type_p (type, complain)
- tree type;
- tsubst_flags_t complain;
+invalid_nontype_parm_type_p (tree type, tsubst_flags_t 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))
+ else if (TYPE_PTR_TO_MEMBER_P (type))
return 0;
else if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
return 0;
@@ -10817,4 +11564,657 @@ invalid_nontype_parm_type_p (type, complain)
return 1;
}
+/* Returns TRUE if TYPE is dependent, in the sense of [temp.dep.type].
+ Assumes that TYPE really is a type, and not the ERROR_MARK_NODE.*/
+
+static bool
+dependent_type_p_r (tree type)
+{
+ tree scope;
+
+ /* [temp.dep.type]
+
+ A type is dependent if it is:
+
+ -- a template parameter. Template template parameters are
+ types for us (since TYPE_P holds true for them) so we
+ handle them here. */
+ if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
+ || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM)
+ return true;
+ /* -- a qualified-id with a nested-name-specifier which contains a
+ class-name that names a dependent type or whose unqualified-id
+ names a dependent type. */
+ if (TREE_CODE (type) == TYPENAME_TYPE)
+ return true;
+ /* -- a cv-qualified type where the cv-unqualified type is
+ dependent. */
+ type = TYPE_MAIN_VARIANT (type);
+ /* -- a compound type constructed from any dependent type. */
+ if (TYPE_PTR_TO_MEMBER_P (type))
+ return (dependent_type_p (TYPE_PTRMEM_CLASS_TYPE (type))
+ || dependent_type_p (TYPE_PTRMEM_POINTED_TO_TYPE
+ (type)));
+ else if (TREE_CODE (type) == POINTER_TYPE
+ || TREE_CODE (type) == REFERENCE_TYPE)
+ return dependent_type_p (TREE_TYPE (type));
+ else if (TREE_CODE (type) == FUNCTION_TYPE
+ || TREE_CODE (type) == METHOD_TYPE)
+ {
+ tree arg_type;
+
+ if (dependent_type_p (TREE_TYPE (type)))
+ return true;
+ for (arg_type = TYPE_ARG_TYPES (type);
+ arg_type;
+ arg_type = TREE_CHAIN (arg_type))
+ if (dependent_type_p (TREE_VALUE (arg_type)))
+ return true;
+ return false;
+ }
+ /* -- an array type constructed from any dependent type or whose
+ size is specified by a constant expression that is
+ value-dependent. */
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ if (TYPE_DOMAIN (type)
+ && ((value_dependent_expression_p
+ (TYPE_MAX_VALUE (TYPE_DOMAIN (type))))
+ || (type_dependent_expression_p
+ (TYPE_MAX_VALUE (TYPE_DOMAIN (type))))))
+ return true;
+ return dependent_type_p (TREE_TYPE (type));
+ }
+
+ /* -- a template-id in which either the template name is a template
+ parameter ... */
+ if (TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM)
+ return true;
+ /* ... or any of the template arguments is a dependent type or
+ an expression that is type-dependent or value-dependent. */
+ else if (CLASS_TYPE_P (type) && CLASSTYPE_TEMPLATE_INFO (type)
+ && (any_dependent_template_arguments_p
+ (INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (type)))))
+ return true;
+
+ /* All TYPEOF_TYPEs are dependent; if the argument of the `typeof'
+ expression is not type-dependent, then it should already been
+ have resolved. */
+ if (TREE_CODE (type) == TYPEOF_TYPE)
+ return true;
+
+ /* The standard does not specifically mention types that are local
+ to template functions or local classes, but they should be
+ considered dependent too. For example:
+
+ template <int I> void f() {
+ enum E { a = I };
+ S<sizeof (E)> s;
+ }
+
+ The size of `E' cannot be known until the value of `I' has been
+ determined. Therefore, `E' must be considered dependent. */
+ scope = TYPE_CONTEXT (type);
+ if (scope && TYPE_P (scope))
+ return dependent_type_p (scope);
+ else if (scope && TREE_CODE (scope) == FUNCTION_DECL)
+ return type_dependent_expression_p (scope);
+
+ /* Other types are non-dependent. */
+ return false;
+}
+
+/* Returns TRUE if TYPE is dependent, in the sense of
+ [temp.dep.type]. */
+
+bool
+dependent_type_p (tree type)
+{
+ /* If there are no template parameters in scope, then there can't be
+ any dependent types. */
+ if (!processing_template_decl)
+ return false;
+
+ /* If the type is NULL, we have not computed a type for the entity
+ in question; in that case, the type is dependent. */
+ if (!type)
+ return true;
+
+ /* Erroneous types can be considered non-dependent. */
+ if (type == error_mark_node)
+ return false;
+
+ /* If we have not already computed the appropriate value for TYPE,
+ do so now. */
+ if (!TYPE_DEPENDENT_P_VALID (type))
+ {
+ TYPE_DEPENDENT_P (type) = dependent_type_p_r (type);
+ TYPE_DEPENDENT_P_VALID (type) = 1;
+ }
+
+ return TYPE_DEPENDENT_P (type);
+}
+
+/* Returns TRUE if EXPRESSION is dependent, according to CRITERION. */
+
+static bool
+dependent_scope_ref_p (tree expression, bool criterion (tree))
+{
+ tree scope;
+ tree name;
+
+ my_friendly_assert (TREE_CODE (expression) == SCOPE_REF, 20030714);
+
+ if (!TYPE_P (TREE_OPERAND (expression, 0)))
+ return true;
+
+ scope = TREE_OPERAND (expression, 0);
+ name = TREE_OPERAND (expression, 1);
+
+ /* [temp.dep.expr]
+
+ An id-expression is type-dependent if it contains a
+ nested-name-specifier that contains a class-name that names a
+ dependent type. */
+ /* The suggested resolution to Core Issue 2 implies that if the
+ qualifying type is the current class, then we must peek
+ inside it. */
+ if (DECL_P (name)
+ && currently_open_class (scope)
+ && !criterion (name))
+ return false;
+ if (dependent_type_p (scope))
+ return true;
+
+ return false;
+}
+
+/* Returns TRUE if the EXPRESSION is value-dependent, in the sense of
+ [temp.dep.constexpr] */
+
+bool
+value_dependent_expression_p (tree expression)
+{
+ if (!processing_template_decl)
+ return false;
+
+ /* A name declared with a dependent type. */
+ if (TREE_CODE (expression) == IDENTIFIER_NODE
+ || (DECL_P (expression)
+ && type_dependent_expression_p (expression)))
+ return true;
+ /* A non-type template parameter. */
+ if ((TREE_CODE (expression) == CONST_DECL
+ && DECL_TEMPLATE_PARM_P (expression))
+ || TREE_CODE (expression) == TEMPLATE_PARM_INDEX)
+ return true;
+ /* A constant with integral or enumeration type and is initialized
+ with an expression that is value-dependent. */
+ if (TREE_CODE (expression) == VAR_DECL
+ && DECL_INITIAL (expression)
+ && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (expression))
+ && value_dependent_expression_p (DECL_INITIAL (expression)))
+ return true;
+ /* These expressions are value-dependent if the type to which the
+ cast occurs is dependent or the expression being casted is
+ value-dependent. */
+ if (TREE_CODE (expression) == DYNAMIC_CAST_EXPR
+ || TREE_CODE (expression) == STATIC_CAST_EXPR
+ || TREE_CODE (expression) == CONST_CAST_EXPR
+ || TREE_CODE (expression) == REINTERPRET_CAST_EXPR
+ || TREE_CODE (expression) == CAST_EXPR)
+ {
+ tree type = TREE_TYPE (expression);
+ if (dependent_type_p (type))
+ return true;
+ /* A functional cast has a list of operands. */
+ expression = TREE_OPERAND (expression, 0);
+ if (!expression)
+ {
+ /* If there are no operands, it must be an expression such
+ as "int()". This should not happen for aggregate types
+ because it would form non-constant expressions. */
+ my_friendly_assert (INTEGRAL_OR_ENUMERATION_TYPE_P (type),
+ 20040318);
+
+ return false;
+ }
+ if (TREE_CODE (expression) == TREE_LIST)
+ {
+ do
+ {
+ if (value_dependent_expression_p (TREE_VALUE (expression)))
+ return true;
+ expression = TREE_CHAIN (expression);
+ }
+ while (expression);
+ return false;
+ }
+ else
+ return value_dependent_expression_p (expression);
+ }
+ /* A `sizeof' expression is value-dependent if the operand is
+ type-dependent. */
+ if (TREE_CODE (expression) == SIZEOF_EXPR
+ || TREE_CODE (expression) == ALIGNOF_EXPR)
+ {
+ expression = TREE_OPERAND (expression, 0);
+ if (TYPE_P (expression))
+ return dependent_type_p (expression);
+ return type_dependent_expression_p (expression);
+ }
+ if (TREE_CODE (expression) == SCOPE_REF)
+ return dependent_scope_ref_p (expression, value_dependent_expression_p);
+ if (TREE_CODE (expression) == COMPONENT_REF)
+ return (value_dependent_expression_p (TREE_OPERAND (expression, 0))
+ || value_dependent_expression_p (TREE_OPERAND (expression, 1)));
+ /* A constant expression is value-dependent if any subexpression is
+ value-dependent. */
+ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expression))))
+ {
+ switch (TREE_CODE_CLASS (TREE_CODE (expression)))
+ {
+ case '1':
+ return (value_dependent_expression_p
+ (TREE_OPERAND (expression, 0)));
+ case '<':
+ case '2':
+ return ((value_dependent_expression_p
+ (TREE_OPERAND (expression, 0)))
+ || (value_dependent_expression_p
+ (TREE_OPERAND (expression, 1))));
+ case 'e':
+ {
+ int i;
+ for (i = 0; i < first_rtl_op (TREE_CODE (expression)); ++i)
+ /* In some cases, some of the operands may be missing.
+ (For example, in the case of PREDECREMENT_EXPR, the
+ amount to increment by may be missing.) That doesn't
+ make the expression dependent. */
+ if (TREE_OPERAND (expression, i)
+ && (value_dependent_expression_p
+ (TREE_OPERAND (expression, i))))
+ return true;
+ return false;
+ }
+ }
+ }
+
+ /* The expression is not value-dependent. */
+ return false;
+}
+
+/* Returns TRUE if the EXPRESSION is type-dependent, in the sense of
+ [temp.dep.expr]. */
+
+bool
+type_dependent_expression_p (tree expression)
+{
+ if (!processing_template_decl)
+ return false;
+
+ if (expression == error_mark_node)
+ return false;
+
+ /* An unresolved name is always dependent. */
+ if (TREE_CODE (expression) == IDENTIFIER_NODE)
+ return true;
+
+ /* Some expression forms are never type-dependent. */
+ if (TREE_CODE (expression) == PSEUDO_DTOR_EXPR
+ || TREE_CODE (expression) == SIZEOF_EXPR
+ || TREE_CODE (expression) == ALIGNOF_EXPR
+ || TREE_CODE (expression) == TYPEID_EXPR
+ || TREE_CODE (expression) == DELETE_EXPR
+ || TREE_CODE (expression) == VEC_DELETE_EXPR
+ || TREE_CODE (expression) == THROW_EXPR)
+ return false;
+
+ /* The types of these expressions depends only on the type to which
+ the cast occurs. */
+ if (TREE_CODE (expression) == DYNAMIC_CAST_EXPR
+ || TREE_CODE (expression) == STATIC_CAST_EXPR
+ || TREE_CODE (expression) == CONST_CAST_EXPR
+ || TREE_CODE (expression) == REINTERPRET_CAST_EXPR
+ || TREE_CODE (expression) == CAST_EXPR)
+ return dependent_type_p (TREE_TYPE (expression));
+
+ /* The types of these expressions depends only on the type created
+ by the expression. */
+ if (TREE_CODE (expression) == NEW_EXPR
+ || TREE_CODE (expression) == VEC_NEW_EXPR)
+ {
+ /* For NEW_EXPR tree nodes created inside a template, either
+ the object type itself or a TREE_LIST may appear as the
+ operand 1. */
+ tree type = TREE_OPERAND (expression, 1);
+ if (TREE_CODE (type) == TREE_LIST)
+ /* This is an array type. We need to check array dimensions
+ as well. */
+ return dependent_type_p (TREE_VALUE (TREE_PURPOSE (type)))
+ || value_dependent_expression_p
+ (TREE_OPERAND (TREE_VALUE (type), 1));
+ else
+ return dependent_type_p (type);
+ }
+
+ if (TREE_CODE (expression) == SCOPE_REF
+ && dependent_scope_ref_p (expression,
+ type_dependent_expression_p))
+ return true;
+
+ if (TREE_CODE (expression) == FUNCTION_DECL
+ && DECL_LANG_SPECIFIC (expression)
+ && DECL_TEMPLATE_INFO (expression)
+ && (any_dependent_template_arguments_p
+ (INNERMOST_TEMPLATE_ARGS (DECL_TI_ARGS (expression)))))
+ return true;
+
+ if (TREE_CODE (expression) == TEMPLATE_DECL
+ && !DECL_TEMPLATE_TEMPLATE_PARM_P (expression))
+ return false;
+
+ if (TREE_TYPE (expression) == unknown_type_node)
+ {
+ if (TREE_CODE (expression) == ADDR_EXPR)
+ return type_dependent_expression_p (TREE_OPERAND (expression, 0));
+ if (TREE_CODE (expression) == COMPONENT_REF
+ || TREE_CODE (expression) == OFFSET_REF)
+ {
+ if (type_dependent_expression_p (TREE_OPERAND (expression, 0)))
+ return true;
+ expression = TREE_OPERAND (expression, 1);
+ if (TREE_CODE (expression) == IDENTIFIER_NODE)
+ return false;
+ }
+
+ if (TREE_CODE (expression) == BASELINK)
+ expression = BASELINK_FUNCTIONS (expression);
+ if (TREE_CODE (expression) == TEMPLATE_ID_EXPR)
+ {
+ if (any_dependent_template_arguments_p
+ (TREE_OPERAND (expression, 1)))
+ return true;
+ expression = TREE_OPERAND (expression, 0);
+ }
+ if (TREE_CODE (expression) == OVERLOAD)
+ {
+ while (expression)
+ {
+ if (type_dependent_expression_p (OVL_CURRENT (expression)))
+ return true;
+ expression = OVL_NEXT (expression);
+ }
+ return false;
+ }
+ abort ();
+ }
+
+ return (dependent_type_p (TREE_TYPE (expression)));
+}
+
+/* Returns TRUE if ARGS (a TREE_LIST of arguments to a function call)
+ contains a type-dependent expression. */
+
+bool
+any_type_dependent_arguments_p (tree args)
+{
+ while (args)
+ {
+ tree arg = TREE_VALUE (args);
+
+ if (type_dependent_expression_p (arg))
+ return true;
+ args = TREE_CHAIN (args);
+ }
+ return false;
+}
+
+/* Returns TRUE if the ARG (a template argument) is dependent. */
+
+static bool
+dependent_template_arg_p (tree arg)
+{
+ if (!processing_template_decl)
+ return false;
+
+ if (TREE_CODE (arg) == TEMPLATE_DECL
+ || TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
+ return dependent_template_p (arg);
+ else if (TYPE_P (arg))
+ return dependent_type_p (arg);
+ else
+ return (type_dependent_expression_p (arg)
+ || value_dependent_expression_p (arg));
+}
+
+/* Returns true if ARGS (a collection of template arguments) contains
+ any dependent arguments. */
+
+bool
+any_dependent_template_arguments_p (tree args)
+{
+ int i;
+ int j;
+
+ if (!args)
+ return false;
+
+ for (i = 0; i < TMPL_ARGS_DEPTH (args); ++i)
+ {
+ tree level = TMPL_ARGS_LEVEL (args, i + 1);
+ for (j = 0; j < TREE_VEC_LENGTH (level); ++j)
+ if (dependent_template_arg_p (TREE_VEC_ELT (level, j)))
+ return true;
+ }
+
+ return false;
+}
+
+/* Returns TRUE if the template TMPL is dependent. */
+
+bool
+dependent_template_p (tree tmpl)
+{
+ if (TREE_CODE (tmpl) == OVERLOAD)
+ {
+ while (tmpl)
+ {
+ if (dependent_template_p (OVL_FUNCTION (tmpl)))
+ return true;
+ tmpl = OVL_CHAIN (tmpl);
+ }
+ return false;
+ }
+
+ /* Template template parameters are dependent. */
+ if (DECL_TEMPLATE_TEMPLATE_PARM_P (tmpl)
+ || TREE_CODE (tmpl) == TEMPLATE_TEMPLATE_PARM)
+ return true;
+ /* So are qualified names that have not been looked up. */
+ if (TREE_CODE (tmpl) == SCOPE_REF)
+ return true;
+ /* So are member templates of dependent classes. */
+ if (TYPE_P (CP_DECL_CONTEXT (tmpl)))
+ return dependent_type_p (DECL_CONTEXT (tmpl));
+ return false;
+}
+
+/* Returns TRUE if the specialization TMPL<ARGS> is dependent. */
+
+bool
+dependent_template_id_p (tree tmpl, tree args)
+{
+ return (dependent_template_p (tmpl)
+ || any_dependent_template_arguments_p (args));
+}
+
+/* TYPE is a TYPENAME_TYPE. Returns the ordinary TYPE to which the
+ TYPENAME_TYPE corresponds. Returns ERROR_MARK_NODE if no such TYPE
+ can be found. Note that this function peers inside uninstantiated
+ templates and therefore should be used only in extremely limited
+ situations. */
+
+tree
+resolve_typename_type (tree type, bool only_current_p)
+{
+ tree scope;
+ tree name;
+ tree decl;
+ int quals;
+ bool pop_p;
+
+ my_friendly_assert (TREE_CODE (type) == TYPENAME_TYPE,
+ 20010702);
+
+ scope = TYPE_CONTEXT (type);
+ name = TYPE_IDENTIFIER (type);
+
+ /* If the SCOPE is itself a TYPENAME_TYPE, then we need to resolve
+ it first before we can figure out what NAME refers to. */
+ if (TREE_CODE (scope) == TYPENAME_TYPE)
+ scope = resolve_typename_type (scope, only_current_p);
+ /* If we don't know what SCOPE refers to, then we cannot resolve the
+ TYPENAME_TYPE. */
+ if (scope == error_mark_node || TREE_CODE (scope) == TYPENAME_TYPE)
+ return error_mark_node;
+ /* If the SCOPE is a template type parameter, we have no way of
+ resolving the name. */
+ if (TREE_CODE (scope) == TEMPLATE_TYPE_PARM)
+ return type;
+ /* If the SCOPE is not the current instantiation, there's no reason
+ to look inside it. */
+ if (only_current_p && !currently_open_class (scope))
+ return error_mark_node;
+ /* If SCOPE is a partial instantiation, it will not have a valid
+ TYPE_FIELDS list, so use the original template. */
+ scope = CLASSTYPE_PRIMARY_TEMPLATE_TYPE (scope);
+ /* Enter the SCOPE so that name lookup will be resolved as if we
+ were in the class definition. In particular, SCOPE will no
+ longer be considered a dependent type. */
+ pop_p = push_scope (scope);
+ /* Look up the declaration. */
+ decl = lookup_member (scope, name, /*protect=*/0, /*want_type=*/true);
+ /* Obtain the set of qualifiers applied to the TYPE. */
+ quals = cp_type_quals (type);
+ /* For a TYPENAME_TYPE like "typename X::template Y<T>", we want to
+ find a TEMPLATE_DECL. Otherwise, we want to find a TYPE_DECL. */
+ if (!decl)
+ type = error_mark_node;
+ else if (TREE_CODE (TYPENAME_TYPE_FULLNAME (type)) == IDENTIFIER_NODE
+ && TREE_CODE (decl) == TYPE_DECL)
+ type = TREE_TYPE (decl);
+ else if (TREE_CODE (TYPENAME_TYPE_FULLNAME (type)) == TEMPLATE_ID_EXPR
+ && DECL_CLASS_TEMPLATE_P (decl))
+ {
+ tree tmpl;
+ tree args;
+ /* Obtain the template and the arguments. */
+ tmpl = TREE_OPERAND (TYPENAME_TYPE_FULLNAME (type), 0);
+ args = TREE_OPERAND (TYPENAME_TYPE_FULLNAME (type), 1);
+ /* Instantiate the template. */
+ type = lookup_template_class (tmpl, args, NULL_TREE, NULL_TREE,
+ /*entering_scope=*/0, tf_error | tf_user);
+ }
+ else
+ type = error_mark_node;
+ /* Qualify the resulting type. */
+ if (type != error_mark_node && quals)
+ type = cp_build_qualified_type (type, quals);
+ /* Leave the SCOPE. */
+ if (pop_p)
+ pop_scope (scope);
+
+ return type;
+}
+
+/* EXPR is an expression which is not type-dependent. Return a proxy
+ for EXPR that can be used to compute the types of larger
+ expressions containing EXPR. */
+
+tree
+build_non_dependent_expr (tree expr)
+{
+ tree inner_expr;
+
+ /* Preserve null pointer constants so that the type of things like
+ "p == 0" where "p" is a pointer can be determined. */
+ if (null_ptr_cst_p (expr))
+ return expr;
+ /* Preserve OVERLOADs; the functions must be available to resolve
+ types. */
+ inner_expr = (TREE_CODE (expr) == ADDR_EXPR ?
+ TREE_OPERAND (expr, 0) : expr);
+ if (TREE_CODE (inner_expr) == OVERLOAD
+ || TREE_CODE (inner_expr) == FUNCTION_DECL
+ || TREE_CODE (inner_expr) == TEMPLATE_DECL
+ || TREE_CODE (inner_expr) == TEMPLATE_ID_EXPR)
+ return expr;
+ /* Preserve string constants; conversions from string constants to
+ "char *" are allowed, even though normally a "const char *"
+ cannot be used to initialize a "char *". */
+ if (TREE_CODE (expr) == STRING_CST)
+ return expr;
+ /* Preserve arithmetic constants, as an optimization -- there is no
+ reason to create a new node. */
+ if (TREE_CODE (expr) == INTEGER_CST || TREE_CODE (expr) == REAL_CST)
+ return expr;
+ /* Preserve THROW_EXPRs -- all throw-expressions have type "void".
+ There is at least one place where we want to know that a
+ particular expression is a throw-expression: when checking a ?:
+ expression, there are special rules if the second or third
+ argument is a throw-expresion. */
+ if (TREE_CODE (expr) == THROW_EXPR)
+ return expr;
+
+ if (TREE_CODE (expr) == COND_EXPR)
+ return build (COND_EXPR,
+ TREE_TYPE (expr),
+ TREE_OPERAND (expr, 0),
+ (TREE_OPERAND (expr, 1)
+ ? build_non_dependent_expr (TREE_OPERAND (expr, 1))
+ : build_non_dependent_expr (TREE_OPERAND (expr, 0))),
+ build_non_dependent_expr (TREE_OPERAND (expr, 2)));
+ if (TREE_CODE (expr) == COMPOUND_EXPR
+ && !COMPOUND_EXPR_OVERLOADED (expr))
+ return build (COMPOUND_EXPR,
+ TREE_TYPE (expr),
+ TREE_OPERAND (expr, 0),
+ build_non_dependent_expr (TREE_OPERAND (expr, 1)));
+
+ /* Otherwise, build a NON_DEPENDENT_EXPR.
+
+ REFERENCE_TYPEs are not stripped for expressions in templates
+ because doing so would play havoc with mangling. Consider, for
+ example:
+
+ template <typename T> void f<T& g>() { g(); }
+
+ In the body of "f", the expression for "g" will have
+ REFERENCE_TYPE, even though the standard says that it should
+ not. The reason is that we must preserve the syntactic form of
+ the expression so that mangling (say) "f<g>" inside the body of
+ "f" works out correctly. Therefore, the REFERENCE_TYPE is
+ stripped here. */
+ return build1 (NON_DEPENDENT_EXPR, non_reference (TREE_TYPE (expr)), expr);
+}
+
+/* ARGS is a TREE_LIST of expressions as arguments to a function call.
+ Return a new TREE_LIST with the various arguments replaced with
+ equivalent non-dependent expressions. */
+
+tree
+build_non_dependent_args (tree args)
+{
+ tree a;
+ tree new_args;
+
+ new_args = NULL_TREE;
+ for (a = args; a; a = TREE_CHAIN (a))
+ new_args = tree_cons (NULL_TREE,
+ build_non_dependent_expr (TREE_VALUE (a)),
+ new_args);
+ return nreverse (new_args);
+}
+
#include "gt-cp-pt.h"
diff --git a/contrib/gcc/cp/repo.c b/contrib/gcc/cp/repo.c
index 64c6ec87..a9a5b35 100644
--- a/contrib/gcc/cp/repo.c
+++ b/contrib/gcc/cp/repo.c
@@ -1,21 +1,22 @@
/* Code to maintain a C++ template repository.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
Contributed by Jason Merrill (jason@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -27,20 +28,21 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "input.h"
#include "obstack.h"
#include "toplev.h"
-#include "ggc.h"
#include "diagnostic.h"
-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 repo_get_id (tree);
+static char *extract_string (char **);
+static const char *get_base_filename (const char *);
+static void open_repo_file (const char *);
+static char *afgets (FILE *);
+static void reopen_repo_file_for_write (void);
static GTY(()) tree pending_repo;
static GTY(()) tree original_repo;
@@ -58,9 +60,7 @@ static struct obstack temporary_obstack;
/* Record the flags used to compile this translation unit. */
void
-repo_compile_flags (argc, argv)
- int argc;
- char **argv;
+repo_compile_flags (int argc, char **argv)
{
}
@@ -69,30 +69,26 @@ repo_compile_flags (argc, argv)
definition at link time. */
void
-repo_template_declared (t)
- tree t;
+repo_template_declared (tree t)
{}
/* Note where the definition of a template lives so that instantiations can
be generated later. */
void
-repo_template_defined (t)
- tree t;
+repo_template_defined (tree t)
{}
/* Note where the definition of a class lives to that template
instantiations can use it. */
void
-repo_class_defined (t)
- tree t;
+repo_class_defined (tree t)
{}
#endif
static tree
-repo_get_id (t)
- tree t;
+repo_get_id (tree t)
{
if (TYPE_P (t))
{
@@ -117,8 +113,7 @@ repo_get_id (t)
to emit it. */
void
-repo_template_used (t)
- tree t;
+repo_template_used (tree t)
{
tree id;
@@ -159,8 +154,7 @@ repo_template_used (t)
/* Note that the vtable for a class has been used, and offer to emit it. */
static void
-repo_vtable_used (t)
- tree t;
+repo_vtable_used (tree t)
{
if (! flag_use_repository)
return;
@@ -172,8 +166,7 @@ repo_vtable_used (t)
emit it. */
void
-repo_inline_used (fn)
- tree fn;
+repo_inline_used (tree fn)
{
if (! flag_use_repository)
return;
@@ -193,16 +186,13 @@ repo_inline_used (fn)
emit it. */
void
-repo_tinfo_used (ti)
- tree ti;
+repo_tinfo_used (tree ti)
{
}
#endif
void
-repo_template_instantiated (t, extern_p)
- tree t;
- int extern_p;
+repo_template_instantiated (tree t, bool extern_p)
{
if (! extern_p)
{
@@ -215,8 +205,7 @@ repo_template_instantiated (t, extern_p)
/* Parse a reasonable subset of shell quoting syntax. */
static char *
-extract_string (pp)
- char **pp;
+extract_string (char **pp)
{
char *p = *pp;
int backquote = 0;
@@ -245,9 +234,8 @@ extract_string (pp)
return obstack_finish (&temporary_obstack);
}
-const char *
-get_base_filename (filename)
- const char *filename;
+static const char *
+get_base_filename (const char *filename)
{
char *p = getenv ("COLLECT_GCC_OPTIONS");
char *output = NULL;
@@ -277,10 +265,9 @@ get_base_filename (filename)
}
static void
-open_repo_file (filename)
- const char *filename;
+open_repo_file (const char *filename)
{
- register const char *p;
+ const char *p;
const char *s = get_base_filename (filename);
if (s == NULL)
@@ -299,8 +286,7 @@ open_repo_file (filename)
}
static char *
-afgets (stream)
- FILE *stream;
+afgets (FILE *stream)
{
int c;
while ((c = getc (stream)) != EOF && c != '\n')
@@ -312,8 +298,7 @@ afgets (stream)
}
void
-init_repo (filename)
- const char *filename;
+init_repo (const char *filename)
{
char *buf;
@@ -365,7 +350,7 @@ init_repo (filename)
}
static void
-reopen_repo_file_for_write ()
+reopen_repo_file_for_write (void)
{
if (repo_file)
fclose (repo_file);
@@ -381,13 +366,13 @@ reopen_repo_file_for_write ()
/* Emit any pending repos. */
void
-finish_repo ()
+finish_repo (void)
{
tree t;
- int repo_changed = 0;
+ bool repo_changed = false;
char *dir, *args;
- if (! flag_use_repository)
+ if (!flag_use_repository)
return;
/* Do we have to write out a new info file? */
@@ -397,10 +382,10 @@ finish_repo ()
for (t = original_repo; t; t = TREE_CHAIN (t))
{
- if (! IDENTIFIER_REPO_USED (TREE_VALUE (t))
- || (! TREE_PURPOSE (t) && IDENTIFIER_REPO_CHOSEN (TREE_VALUE (t))))
+ if (!IDENTIFIER_REPO_USED (TREE_VALUE (t))
+ || (!TREE_PURPOSE (t) && IDENTIFIER_REPO_CHOSEN (TREE_VALUE (t))))
{
- repo_changed = 1;
+ repo_changed = true;
break;
}
IDENTIFIER_REPO_USED (TREE_VALUE (t)) = 0;
@@ -408,12 +393,12 @@ finish_repo ()
/* Are there any templates that are newly used? */
- if (! repo_changed)
+ if (!repo_changed)
for (t = pending_repo; t; t = TREE_CHAIN (t))
{
if (IDENTIFIER_REPO_USED (TREE_VALUE (t)))
{
- repo_changed = 1;
+ repo_changed = true;
break;
}
}
@@ -421,14 +406,14 @@ finish_repo ()
dir = getpwd ();
args = getenv ("COLLECT_GCC_OPTIONS");
- if (! repo_changed && pending_repo)
+ if (!repo_changed && pending_repo)
if (strcmp (old_main, main_input_filename) != 0
|| strcmp (old_dir, dir) != 0
|| (args == NULL) != (old_args == NULL)
|| (args && strcmp (old_args, args) != 0))
- repo_changed = 1;
+ repo_changed = true;
- if (! repo_changed || errorcount || sorrycount)
+ if (!repo_changed || errorcount || sorrycount)
goto out;
reopen_repo_file_for_write ();
diff --git a/contrib/gcc/cp/rtti.c b/contrib/gcc/cp/rtti.c
index 7b4a248..e9c0616 100644
--- a/contrib/gcc/cp/rtti.c
+++ b/contrib/gcc/cp/rtti.c
@@ -1,34 +1,37 @@
/* RunTime Type Identification
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Mostly written by Jason Merrill (jason@cygnus.com).
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "flags.h"
#include "output.h"
#include "assert.h"
#include "toplev.h"
+#include "convert.h"
/* C++ returns type information to the user in struct type_info
objects. We also use type information to implement dynamic_cast and
@@ -71,30 +74,34 @@ Boston, MA 02111-1307, USA. */
/* The IDENTIFIER_NODE naming the real class. */
#define TINFO_REAL_NAME(NODE) TREE_PURPOSE (NODE)
-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 tree get_tinfo_ptr 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 create_pseudo_type_info PARAMS((const char *, int, ...));
-static tree get_pseudo_ti_init PARAMS ((tree, tree, int *));
-static tree get_pseudo_ti_desc PARAMS((tree));
-static void create_tinfo_types PARAMS((void));
-static int typeinfo_in_lib_p PARAMS((tree));
+/* A varray of all tinfo decls that haven't yet been emitted. */
+varray_type unemitted_tinfo_decls;
+
+static tree build_headof (tree);
+static tree ifnonnull (tree, tree);
+static tree tinfo_name (tree);
+static tree build_dynamic_cast_1 (tree, tree);
+static tree throw_bad_cast (void);
+static tree throw_bad_typeid (void);
+static tree get_tinfo_decl_dynamic (tree);
+static tree get_tinfo_ptr (tree);
+static bool typeid_ok_p (void);
+static int qualifier_flags (tree);
+static bool target_incomplete_p (tree);
+static tree tinfo_base_init (tree, tree);
+static tree generic_initializer (tree, tree);
+static tree ptr_initializer (tree, tree, bool *);
+static tree ptm_initializer (tree, tree, bool *);
+static tree dfs_class_hint_mark (tree, void *);
+static tree dfs_class_hint_unmark (tree, void *);
+static int class_hint_flags (tree);
+static tree class_initializer (tree, tree, tree);
+static tree create_pseudo_type_info (const char *, int, ...);
+static tree get_pseudo_ti_init (tree, tree, bool *);
+static tree get_pseudo_ti_desc (tree);
+static void create_tinfo_types (void);
+static bool typeinfo_in_lib_p (tree);
+static bool unemitted_tinfo_decl_p (tree);
static int doing_runtime = 0;
@@ -106,16 +113,21 @@ static int doing_runtime = 0;
the internal versions of the ABI types. */
void
-init_rtti_processing ()
+init_rtti_processing (void)
{
+ tree const_type_info_type;
+
push_namespace (std_identifier);
type_info_type_node
= xref_tag (class_type, get_identifier ("type_info"),
- /*attributes=*/NULL_TREE, 1);
+ true, false);
pop_namespace ();
- type_info_ptr_type =
- build_pointer_type
- (build_qualified_type (type_info_type_node, TYPE_QUAL_CONST));
+ const_type_info_type = build_qualified_type (type_info_type_node,
+ TYPE_QUAL_CONST);
+ type_info_ptr_type = build_pointer_type (const_type_info_type);
+ type_info_ref_type = build_reference_type (const_type_info_type);
+
+ VARRAY_TREE_INIT (unemitted_tinfo_decls, 10, "RTTI decls");
create_tinfo_types ();
}
@@ -126,8 +138,7 @@ init_rtti_processing ()
expression. */
static tree
-build_headof (exp)
- tree exp;
+build_headof (tree exp)
{
tree type = TREE_TYPE (exp);
tree offset;
@@ -149,8 +160,8 @@ build_headof (exp)
type = build_qualified_type (ptr_type_node,
cp_type_quals (TREE_TYPE (exp)));
- return build (PLUS_EXPR, type, exp,
- cp_convert (ptrdiff_type_node, offset));
+ return build (PLUS_EXPR, type, exp,
+ convert_to_integer (ptrdiff_type_node, offset));
}
/* Get a bad_cast node for the program to throw...
@@ -158,52 +169,49 @@ build_headof (exp)
See libstdc++/exception.cc for __throw_bad_cast */
static tree
-throw_bad_cast ()
+throw_bad_cast (void)
{
tree fn = get_identifier ("__cxa_bad_cast");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
+ if (!get_global_value_if_present (fn, &fn))
fn = push_throw_library_fn (fn, build_function_type (ptr_type_node,
void_list_node));
return build_cxx_call (fn, NULL_TREE, NULL_TREE);
}
+/* Return an expression for "__cxa_bad_typeid()". The expression
+ returned is an lvalue of type "const std::type_info". */
+
static tree
-throw_bad_typeid ()
+throw_bad_typeid (void)
{
tree fn = get_identifier ("__cxa_bad_typeid");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
+ if (!get_global_value_if_present (fn, &fn))
{
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_cxx_call (fn, NULL_TREE, NULL_TREE);
+ return convert_from_reference (build_cxx_call (fn, NULL_TREE, NULL_TREE));
}
-/* 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;
+/* Return an lvalue expression whose type is "const std::type_info"
+ and whose value indicates the type of the expression EXP. If EXP
+ is a reference to a polymorphic class, return the dynamic type;
otherwise return the static type of the expression. */
static tree
-get_tinfo_decl_dynamic (exp)
- tree exp;
+get_tinfo_decl_dynamic (tree exp)
{
tree type;
+ tree t;
if (exp == error_mark_node)
return error_mark_node;
- type = TREE_TYPE (exp);
-
/* peel back references, so they match. */
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
+ type = non_reference (TREE_TYPE (exp));
/* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type);
@@ -218,22 +226,22 @@ get_tinfo_decl_dynamic (exp)
if (TYPE_POLYMORPHIC_P (type) && ! resolves_to_fixed_type_p (exp, 0))
{
/* build reference to type_info from vtable. */
- tree t;
tree index;
/* The RTTI information is at index -1. */
index = build_int_2 (-1 * TARGET_VTABLE_DATA_ENTRY_DISTANCE, -1);
t = build_vtbl_ref (exp, index);
TREE_TYPE (t) = type_info_ptr_type;
- return t;
}
+ else
+ /* Otherwise return the type_info for the static type of the expr. */
+ t = get_tinfo_ptr (TYPE_MAIN_VARIANT (type));
- /* Otherwise return the type_info for the static type of the expr. */
- return get_tinfo_ptr (TYPE_MAIN_VARIANT (type));
+ return build_indirect_ref (t, NULL);
}
static bool
-typeid_ok_p ()
+typeid_ok_p (void)
{
if (! flag_rtti)
{
@@ -250,9 +258,11 @@ typeid_ok_p ()
return true;
}
+/* Return an expression for "typeid(EXP)". The expression returned is
+ an lvalue of type "const std::type_info". */
+
tree
-build_typeid (exp)
- tree exp;
+build_typeid (tree exp)
{
tree cond = NULL_TREE;
int nonnull = 0;
@@ -261,7 +271,7 @@ build_typeid (exp)
return error_mark_node;
if (processing_template_decl)
- return build_min_nt (TYPEID_EXPR, exp);
+ return build_min (TYPEID_EXPR, type_info_ref_type, exp);
if (TREE_CODE (exp) == INDIRECT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
@@ -278,8 +288,6 @@ build_typeid (exp)
if (exp == error_mark_node)
return error_mark_node;
- exp = build_indirect_ref (exp, NULL);
-
if (cond)
{
tree bad = throw_bad_typeid ();
@@ -287,13 +295,12 @@ build_typeid (exp)
exp = build (COND_EXPR, TREE_TYPE (exp), cond, exp, bad);
}
- return convert_from_reference (exp);
+ return exp;
}
/* Generate the NTBS name of a type. */
static tree
-tinfo_name (type)
- tree type;
+tinfo_name (tree type)
{
const char *name;
tree name_string;
@@ -308,8 +315,7 @@ tinfo_name (type)
it --- decls in vtables are only used if the vtable is output. */
tree
-get_tinfo_decl (type)
- tree type;
+get_tinfo_decl (tree type)
{
tree name;
tree d;
@@ -322,8 +328,6 @@ get_tinfo_decl (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)));
@@ -350,8 +354,9 @@ get_tinfo_decl (type)
TREE_READONLY (d) = 1;
TREE_STATIC (d) = 1;
DECL_EXTERNAL (d) = 1;
- SET_DECL_ASSEMBLER_NAME (d, name);
DECL_COMDAT (d) = 1;
+ TREE_PUBLIC (d) = 1;
+ SET_DECL_ASSEMBLER_NAME (d, name);
pushdecl_top_level_and_finish (d, NULL_TREE);
@@ -360,6 +365,10 @@ get_tinfo_decl (type)
/* Remember the type it is for. */
TREE_TYPE (name) = type;
+
+ /* Add decl to the global array of tinfo decls. */
+ my_friendly_assert (unemitted_tinfo_decls != 0, 20030312);
+ VARRAY_PUSH_TREE (unemitted_tinfo_decls, d);
}
return d;
@@ -369,35 +378,30 @@ get_tinfo_decl (type)
cast to the language defined type. */
static tree
-get_tinfo_ptr (type)
- tree type;
+get_tinfo_ptr (tree type)
{
- tree exp = get_tinfo_decl (type);
-
- /* Convert to type_info type. */
- exp = build_unary_op (ADDR_EXPR, exp, 0);
- exp = ocp_convert (type_info_ptr_type, exp, CONV_REINTERPRET, 0);
+ tree decl = get_tinfo_decl (type);
- return exp;
+ mark_used (decl);
+ return build_nop (type_info_ptr_type,
+ build_address (decl));
}
/* Return the type_info object for TYPE. */
tree
-get_typeid (type)
- tree type;
+get_typeid (tree type)
{
if (type == error_mark_node || !typeid_ok_p ())
return error_mark_node;
if (processing_template_decl)
- return build_min_nt (TYPEID_EXPR, type);
+ return build_min (TYPEID_EXPR, type_info_ref_type, type);
/* If the type of the type-id is a reference type, the result of the
typeid expression refers to a type_info object representing the
referenced type. */
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
+ type = non_reference (type);
/* The top-level cv-qualifiers of the lvalue expression or the type-id
that is the operand of typeid are always ignored. */
@@ -416,8 +420,7 @@ get_typeid (type)
RESULT, it must have previously had a save_expr applied to it. */
static tree
-ifnonnull (test, result)
- tree test, result;
+ifnonnull (tree test, tree result)
{
return build (COND_EXPR, TREE_TYPE (result),
build (EQ_EXPR, boolean_type_node, test, integer_zero_node),
@@ -429,8 +432,7 @@ ifnonnull (test, result)
paper. */
static tree
-build_dynamic_cast_1 (type, expr)
- tree type, expr;
+build_dynamic_cast_1 (tree type, tree expr)
{
enum tree_code tc = TREE_CODE (type);
tree exprtype = TREE_TYPE (expr);
@@ -463,12 +465,6 @@ build_dynamic_cast_1 (type, expr)
goto fail;
}
- 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)
@@ -605,8 +601,12 @@ 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);
+ td2 = get_tinfo_decl (target_type);
+ mark_used (td2);
+ td2 = build_unary_op (ADDR_EXPR, td2, 0);
+ td3 = get_tinfo_decl (static_type);
+ mark_used (td3);
+ td3 = build_unary_op (ADDR_EXPR, td3, 0);
/* Determine how T and V are related. */
boff = get_dynamic_cast_base_type (static_type, target_type);
@@ -635,8 +635,7 @@ build_dynamic_cast_1 (type, expr)
push_nested_namespace (ns);
tinfo_ptr = xref_tag (class_type,
get_identifier ("__class_type_info"),
- /*attributes=*/NULL_TREE,
- 1);
+ true, false);
tinfo_ptr = build_pointer_type
(build_qualified_type
@@ -649,6 +648,7 @@ build_dynamic_cast_1 (type, expr)
(NULL_TREE, ptrdiff_type_node, void_list_node))));
tmp = build_function_type (ptr_type_node, tmp);
dcast_fn = build_library_fn_ptr (name, tmp);
+ DECL_IS_PURE (dcast_fn) = 1;
pop_nested_namespace (ns);
dynamic_cast_node = dcast_fn;
}
@@ -677,14 +677,18 @@ build_dynamic_cast_1 (type, expr)
}
tree
-build_dynamic_cast (type, expr)
- tree type, expr;
+build_dynamic_cast (tree type, tree expr)
{
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
if (processing_template_decl)
- return build_min (DYNAMIC_CAST_EXPR, type, expr);
+ {
+ expr = build_min (DYNAMIC_CAST_EXPR, type, expr);
+ TREE_SIDE_EFFECTS (expr) = 1;
+
+ return expr;
+ }
return convert_from_reference (build_dynamic_cast_1 (type, expr));
}
@@ -692,8 +696,7 @@ build_dynamic_cast (type, expr)
/* Return the runtime bit mask encoding the qualifiers of TYPE. */
static int
-qualifier_flags (type)
- tree type;
+qualifier_flags (tree type)
{
int flags = 0;
int quals = cp_type_quals (type);
@@ -707,26 +710,23 @@ qualifier_flags (type)
return flags;
}
-/* Return nonzero, if the pointer chain TYPE ends at an incomplete type, or
+/* Return true, if the pointer chain TYPE ends at an incomplete type, or
contains a pointer to member of an incomplete class. */
-static int
-target_incomplete_p (type)
- tree type;
+static bool
+target_incomplete_p (tree type)
{
- while (TREE_CODE (type) == POINTER_TYPE)
+ while (true)
if (TYPE_PTRMEM_P (type))
{
- if (!COMPLETE_TYPE_P (TYPE_PTRMEM_CLASS_TYPE (type)))
- return 1;
- type = TYPE_PTRMEM_POINTED_TO_TYPE (type);
+ if (!COMPLETE_TYPE_P (TYPE_PTRMEM_CLASS_TYPE (type)))
+ return true;
+ type = TYPE_PTRMEM_POINTED_TO_TYPE (type);
}
- else
+ else if (TREE_CODE (type) == POINTER_TYPE)
type = TREE_TYPE (type);
- if (!COMPLETE_OR_VOID_TYPE_P (type))
- return 1;
-
- return 0;
+ else
+ return !COMPLETE_OR_VOID_TYPE_P (type);
}
/* Return a CONSTRUCTOR for the common part of the type_info objects. This
@@ -736,9 +736,7 @@ target_incomplete_p (type)
as comdat, because of pointers to incomplete.) */
static tree
-tinfo_base_init (desc, target)
- tree desc;
- tree target;
+tinfo_base_init (tree desc, tree target)
{
tree init = NULL_TREE;
tree name_decl;
@@ -761,12 +759,13 @@ tinfo_base_init (desc, target)
TREE_STATIC (name_decl) = 1;
DECL_EXTERNAL (name_decl) = 0;
TREE_PUBLIC (name_decl) = 1;
- comdat_linkage (name_decl);
+ import_export_tinfo (name_decl, target, typeinfo_in_lib_p (target));
/* 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;
+ mark_used (name_decl);
pushdecl_top_level_and_finish (name_decl, name_string);
}
@@ -777,7 +776,7 @@ tinfo_base_init (desc, target)
push_nested_namespace (abi_node);
real_type = xref_tag (class_type, TINFO_REAL_NAME (desc),
- /*attributes=*/NULL_TREE, 1);
+ true, false);
pop_nested_namespace (abi_node);
if (!COMPLETE_TYPE_P (real_type))
@@ -807,7 +806,7 @@ tinfo_base_init (desc, target)
init = tree_cons (NULL_TREE, decay_conversion (name_decl), init);
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
+ init = build_constructor (NULL_TREE, nreverse (init));
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
init = tree_cons (NULL_TREE, init, NULL_TREE);
@@ -819,13 +818,11 @@ tinfo_base_init (desc, target)
additional fields to the type_info base. */
static tree
-generic_initializer (desc, target)
- tree desc;
- tree target;
+generic_initializer (tree desc, tree target)
{
tree init = tinfo_base_init (desc, target);
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, init);
+ init = build_constructor (NULL_TREE, init);
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
return init;
}
@@ -835,27 +832,24 @@ generic_initializer (desc, target)
which adds target type and qualifier flags members to the type_info base. */
static tree
-ptr_initializer (desc, target, non_public_ptr)
- tree desc;
- tree target;
- int *non_public_ptr;
+ptr_initializer (tree desc, tree target, bool *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);
+ bool incomplete = target_incomplete_p (to);
if (incomplete)
{
flags |= 8;
- *non_public_ptr = 1;
+ *non_public_ptr = true;
}
init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init);
init = tree_cons (NULL_TREE,
get_tinfo_ptr (TYPE_MAIN_VARIANT (to)),
init);
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
+ init = build_constructor (NULL_TREE, nreverse (init));
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
return init;
}
@@ -866,26 +860,23 @@ ptr_initializer (desc, target, non_public_ptr)
base. */
static tree
-ptm_initializer (desc, target, non_public_ptr)
- tree desc;
- tree target;
- int *non_public_ptr;
+ptm_initializer (tree desc, tree target, bool *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);
+ bool incomplete = target_incomplete_p (to);
if (incomplete)
{
flags |= 0x8;
- *non_public_ptr = 1;
+ *non_public_ptr = true;
}
if (!COMPLETE_TYPE_P (klass))
{
flags |= 0x10;
- *non_public_ptr = 1;
+ *non_public_ptr = true;
}
init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init);
init = tree_cons (NULL_TREE,
@@ -895,7 +886,7 @@ ptm_initializer (desc, target, non_public_ptr)
get_tinfo_ptr (klass),
init);
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
+ init = build_constructor (NULL_TREE, nreverse (init));
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
return init;
}
@@ -906,9 +897,7 @@ ptm_initializer (desc, target, non_public_ptr)
possible for a type to be both a virtual and non-virtual base. */
static tree
-dfs_class_hint_mark (binfo, data)
- tree binfo;
- void *data;
+dfs_class_hint_mark (tree binfo, void *data)
{
tree basetype = BINFO_TYPE (binfo);
int *hint = (int *) data;
@@ -927,17 +916,13 @@ dfs_class_hint_mark (binfo, data)
*hint |= 1;
SET_CLASSTYPE_MARKED (basetype);
}
- if (!TREE_VIA_PUBLIC (binfo) && TYPE_BINFO (basetype) != binfo)
- *hint |= 4;
return NULL_TREE;
-};
+}
/* Clear the base's dfs marks, after searching for duplicate bases. */
static tree
-dfs_class_hint_unmark (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
+dfs_class_hint_unmark (tree binfo, void *data ATTRIBUTE_UNUSED)
{
tree basetype = BINFO_TYPE (binfo);
@@ -949,22 +934,13 @@ dfs_class_hint_unmark (binfo, data)
/* Determine the hint flags describing the features of a class's hierarchy. */
static int
-class_hint_flags (type)
- tree type;
+class_hint_flags (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);
- 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;
}
@@ -973,25 +949,21 @@ class_hint_flags (type)
which adds hint flags and TRAIL initializers to the type_info base. */
static tree
-class_initializer (desc, target, trail)
- tree desc;
- tree target;
- tree trail;
+class_initializer (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);
+ init = build_constructor (NULL_TREE, init);
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
return init;
}
-/* Returns nonzero if the typeinfo for type should be placed in
+/* Returns true if the typeinfo for type should be placed in
the runtime library. */
-static int
-typeinfo_in_lib_p (type)
- tree type;
+static bool
+typeinfo_in_lib_p (tree type)
{
/* The typeinfo objects for `T*' and `const T*' are in the runtime
library for simple types T. */
@@ -1007,10 +979,10 @@ typeinfo_in_lib_p (type)
case CHAR_TYPE:
case REAL_TYPE:
case VOID_TYPE:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
@@ -1021,20 +993,15 @@ typeinfo_in_lib_p (type)
types will be completed. */
static tree
-get_pseudo_ti_init (type, var_desc, non_public_p)
- tree type;
- tree var_desc;
- int *non_public_p;
+get_pseudo_ti_init (tree type, tree var_desc, bool *non_public_p)
{
my_friendly_assert (at_eof, 20021120);
switch (TREE_CODE (type))
{
+ case OFFSET_TYPE:
+ return ptm_initializer (var_desc, type, non_public_p);
case POINTER_TYPE:
- if (TYPE_PTRMEM_P (type))
- return ptm_initializer (var_desc, type, non_public_p);
- else
- return ptr_initializer (var_desc, type, non_public_p);
- break;
+ return ptr_initializer (var_desc, type, non_public_p);
case ENUMERAL_TYPE:
return generic_initializer (var_desc, type);
break;
@@ -1052,7 +1019,7 @@ get_pseudo_ti_init (type, var_desc, non_public_p)
{
if (!COMPLETE_TYPE_P (type))
/* Emit a non-public class_type_info. */
- *non_public_p = 1;
+ *non_public_p = true;
return class_initializer (var_desc, type, NULL_TREE);
}
else if (var_desc == si_class_desc_type_node)
@@ -1070,6 +1037,7 @@ get_pseudo_ti_init (type, var_desc, non_public_p)
tree binfo = TYPE_BINFO (type);
int nbases = BINFO_N_BASETYPES (binfo);
tree base_binfos = BINFO_BASETYPES (binfo);
+ tree base_accesses = BINFO_BASEACCESSES (binfo);
tree base_inits = NULL_TREE;
int ix;
@@ -1082,34 +1050,32 @@ get_pseudo_ti_init (type, var_desc, non_public_p)
tree tinfo;
tree offset;
- if (TREE_PUBLIC (base_binfo))
+ if (TREE_VEC_ELT (base_accesses, ix) == access_public_node)
flags |= 2;
tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo));
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), type));
+ offset = BINFO_VPTR_FIELD (base_binfo);
offset = convert (sizetype, offset);
flags |= 1;
}
else
offset = BINFO_OFFSET (base_binfo);
- /* combine offset and flags into one field */
+ /* 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_init = build_constructor (NULL_TREE, base_init);
TREE_HAS_CONSTRUCTOR (base_init) = 1;
base_inits = tree_cons (NULL_TREE, base_init, base_inits);
}
- base_inits = build (CONSTRUCTOR,
- NULL_TREE, NULL_TREE, base_inits);
+ base_inits = build_constructor (NULL_TREE, base_inits);
TREE_HAS_CONSTRUCTOR (base_inits) = 1;
base_inits = tree_cons (NULL_TREE, base_inits, NULL_TREE);
/* Prepend the number of bases. */
@@ -1144,36 +1110,37 @@ get_pseudo_ti_init (type, var_desc, non_public_p)
NULL. */
static tree
-create_pseudo_type_info VPARAMS((const char *real_name, int ident, ...))
+create_pseudo_type_info (const char *real_name, int ident, ...)
{
tree pseudo_type;
char *pseudo_name;
- int ix;
- tree fields[10];
+ tree fields;
tree field_decl;
tree result;
+ va_list ap;
- VA_OPEN (ap, ident);
- VA_FIXEDARG (ap, const char *, real_name);
- VA_FIXEDARG (ap, int, ident);
+ va_start (ap, ident);
/* Generate the pseudo type name. */
- pseudo_name = (char *)alloca (strlen (real_name) + 30);
+ pseudo_name = alloca (strlen (real_name) + 30);
strcpy (pseudo_name, real_name);
strcat (pseudo_name, "_pseudo");
if (ident)
sprintf (pseudo_name + strlen (pseudo_name), "%d", ident);
/* First field is the pseudo type_info base class. */
- fields[0] = build_decl (FIELD_DECL, NULL_TREE, ti_desc_type_node);
+ fields = 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;
+ while ((field_decl = va_arg (ap, tree)))
+ {
+ TREE_CHAIN (field_decl) = fields;
+ fields = 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);
+ finish_builtin_struct (pseudo_type, pseudo_name, fields, NULL_TREE);
CLASSTYPE_AS_BASE (pseudo_type) = pseudo_type;
result = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE);
@@ -1181,7 +1148,7 @@ create_pseudo_type_info VPARAMS((const char *real_name, int ident, ...))
TINFO_PSEUDO_TYPE (result) =
cp_build_qualified_type (pseudo_type, TYPE_QUAL_CONST);
- VA_CLOSE (ap);
+ va_end (ap);
return result;
}
@@ -1190,13 +1157,14 @@ create_pseudo_type_info VPARAMS((const char *real_name, int ident, ...))
translation unit. */
static tree
-get_pseudo_ti_desc (type)
- tree type;
+get_pseudo_ti_desc (tree type)
{
switch (TREE_CODE (type))
{
+ case OFFSET_TYPE:
+ return ptm_desc_type_node;
case POINTER_TYPE:
- return TYPE_PTRMEM_P (type) ? ptm_desc_type_node : ptr_desc_type_node;
+ return ptr_desc_type_node;
case ENUMERAL_TYPE:
return enum_desc_type_node;
case FUNCTION_TYPE:
@@ -1217,12 +1185,14 @@ get_pseudo_ti_desc (type)
return class_desc_type_node;
else
{
- tree base_binfo =
- TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)), 0);
- int num_bases = BINFO_N_BASETYPES (TYPE_BINFO (type));
+ tree binfo = TYPE_BINFO (type);
+ tree base_binfos = BINFO_BASETYPES (binfo);
+ tree base_accesses = BINFO_BASEACCESSES (binfo);
+ tree base_binfo = TREE_VEC_ELT (base_binfos, 0);
+ int num_bases = TREE_VEC_LENGTH (base_binfos);
if (num_bases == 1
- && TREE_PUBLIC (base_binfo)
+ && TREE_VEC_ELT (base_accesses, 0) == access_public_node
&& !TREE_VIA_VIRTUAL (base_binfo)
&& integer_zerop (BINFO_OFFSET (base_binfo)))
/* single non-virtual public. */
@@ -1246,9 +1216,14 @@ get_pseudo_ti_desc (type)
if (var_desc)
return var_desc;
- /* Add number of bases and trailing array of
- base_class_type_info. */
- array_domain = build_index_type (size_int (num_bases));
+ /* Create the array of __base_class_type_info entries.
+ G++ 3.2 allocated an array that had one too many
+ entries, and then filled that extra entries with
+ zeros. */
+ if (abi_version_at_least (2))
+ array_domain = build_index_type (size_int (num_bases - 1));
+ else
+ array_domain = build_index_type (size_int (num_bases));
base_array =
build_array_type (base_desc_type_node, array_domain);
@@ -1274,7 +1249,7 @@ get_pseudo_ti_desc (type)
varable definitions. */
static void
-create_tinfo_types ()
+create_tinfo_types (void)
{
my_friendly_assert (!ti_desc_type_node, 20020609);
@@ -1283,13 +1258,18 @@ create_tinfo_types ()
/* Create the internal type_info structure. This is used as a base for
the other structures. */
{
- tree fields[2];
+ tree field, fields;
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);
+ field = build_decl (FIELD_DECL, NULL_TREE, const_ptr_type_node);
+ fields = field;
+
+ field = build_decl (FIELD_DECL, NULL_TREE, const_string_type_node);
+ TREE_CHAIN (field) = fields;
+ fields = field;
+
+ finish_builtin_struct (ti_desc_type_node, "__type_info_pseudo",
+ fields, NULL_TREE);
TYPE_HAS_CONSTRUCTOR (ti_desc_type_node) = 1;
}
@@ -1324,13 +1304,18 @@ create_tinfo_types ()
/* Base class internal helper. Pointer to base type, offset to base,
flags. */
{
- tree fields[2];
+ tree field, fields;
+
+ field = build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type);
+ fields = field;
- fields[0] = build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type);
- fields[1] = build_decl (FIELD_DECL, NULL_TREE, integer_types[itk_long]);
+ field = build_decl (FIELD_DECL, NULL_TREE, integer_types[itk_long]);
+ TREE_CHAIN (field) = fields;
+ fields = field;
+
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);
+ finish_builtin_struct (base_desc_type_node, "__base_class_type_info_pseudo",
+ fields, NULL_TREE);
TYPE_HAS_CONSTRUCTOR (base_desc_type_node) = 1;
}
@@ -1366,7 +1351,7 @@ create_tinfo_types ()
destructor is defined, then the runtime is being built. */
void
-emit_support_tinfos ()
+emit_support_tinfos (void)
{
static tree *const fundamentals[] =
{
@@ -1387,8 +1372,7 @@ emit_support_tinfos ()
push_nested_namespace (abi_node);
bltn_type = xref_tag (class_type,
get_identifier ("__fundamental_type_info"),
- /*attributes=*/NULL_TREE,
- 1);
+ true, false);
pop_nested_namespace (abi_node);
if (!COMPLETE_TYPE_P (bltn_type))
return;
@@ -1418,17 +1402,17 @@ emit_support_tinfos ()
}
}
-/* Return nonzero, iff T is a type_info variable which has not had a
+/* Return true, iff T is a type_info variable which has not had a
definition emitted for it. */
-int
-unemitted_tinfo_decl_p (t, data)
- tree t;
- void *data ATTRIBUTE_UNUSED;
+static bool
+unemitted_tinfo_decl_p (tree t)
{
if (/* It's a var decl */
TREE_CODE (t) == VAR_DECL
- /* whos name points back to itself */
+ /* which has a name */
+ && DECL_NAME (t)
+ /* whose name points back to itself */
&& IDENTIFIER_GLOBAL_VALUE (DECL_NAME (t)) == t
/* whose name's type is non-null */
&& TREE_TYPE (DECL_NAME (t))
@@ -1438,33 +1422,32 @@ unemitted_tinfo_decl_p (t, data)
&& TYPE_FIELDS (TREE_TYPE (t))
/* which is our pseudo type info */
&& TREE_TYPE (TYPE_FIELDS (TREE_TYPE (t))) == ti_desc_type_node)
- return 1;
- return 0;
+ return true;
+ return false;
}
/* Finish a type info decl. DECL_PTR is a pointer to an unemitted
tinfo decl. Determine whether it needs emitting, and if so
generate the initializer. */
-int
-emit_tinfo_decl (decl_ptr, data)
- tree *decl_ptr;
- void *data ATTRIBUTE_UNUSED;
+bool
+emit_tinfo_decl (tree decl)
{
- tree decl = *decl_ptr;
tree type = TREE_TYPE (DECL_NAME (decl));
- int non_public;
+ bool non_public;
int in_library = typeinfo_in_lib_p (type);
tree var_desc, var_init;
+
+ my_friendly_assert (unemitted_tinfo_decl_p (decl), 20030307);
import_export_tinfo (decl, type, in_library);
if (DECL_REALLY_EXTERN (decl) || !DECL_NEEDED_P (decl))
- return 0;
+ return false;
if (!doing_runtime && in_library)
- return 0;
+ return false;
- non_public = 0;
+ non_public = false;
var_desc = get_pseudo_ti_desc (type);
var_init = get_pseudo_ti_init (type, var_desc, &non_public);
@@ -1474,11 +1457,12 @@ emit_tinfo_decl (decl_ptr, data)
DECL_COMDAT (decl) = 0;
DECL_INITIAL (decl) = var_init;
+ mark_used (decl);
cp_finish_decl (decl, var_init, NULL_TREE, 0);
/* cp_finish_decl will have dealt with linkage. */
/* Say we've dealt with it. */
TREE_TYPE (DECL_NAME (decl)) = NULL_TREE;
- return 1;
+ return true;
}
diff --git a/contrib/gcc/cp/search.c b/contrib/gcc/cp/search.c
index c43dd21..65ed660 100644
--- a/contrib/gcc/cp/search.c
+++ b/contrib/gcc/cp/search.c
@@ -4,20 +4,20 @@
1999, 2000, 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -25,13 +25,14 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "obstack.h"
#include "flags.h"
#include "rtl.h"
#include "output.h"
-#include "ggc.h"
#include "toplev.h"
#include "stack.h"
@@ -42,10 +43,8 @@ static struct obstack search_obstack;
/* Methods for pushing and popping objects to and from obstacks. */
struct stack_level *
-push_stack_level (obstack, tp, size)
- struct obstack *obstack;
- char *tp; /* Sony NewsOS 5.0 compiler doesn't like void * here. */
- int size;
+push_stack_level (struct obstack *obstack, char *tp,/* Sony NewsOS 5.0 compiler doesn't like void * here. */
+ int size)
{
struct stack_level *stack;
obstack_grow (obstack, tp, size);
@@ -58,8 +57,7 @@ push_stack_level (obstack, tp, size)
}
struct stack_level *
-pop_stack_level (stack)
- struct stack_level *stack;
+pop_stack_level (struct stack_level *stack)
{
struct stack_level *tem = stack;
struct obstack *obstack = tem->obstack;
@@ -80,59 +78,41 @@ struct vbase_info
tree inits;
};
-static int is_subobject_of_p PARAMS ((tree, tree, tree));
-static int is_subobject_of_p_1 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, 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 look_for_overrides_r PARAMS ((tree, tree));
-static struct search_level *push_search_level
- PARAMS ((struct stack_level *, struct obstack *));
-static struct search_level *pop_search_level
- PARAMS ((struct stack_level *));
-static tree bfs_walk
- PARAMS ((tree, tree (*) (tree, void *), tree (*) (tree, void *),
- void *));
-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 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 *));
+static tree dfs_check_overlap (tree, void *);
+static tree dfs_no_overlap_yet (tree, int, void *);
+static base_kind lookup_base_r (tree, tree, base_access, bool, tree *);
+static int dynamic_cast_base_recurse (tree, tree, bool, tree *);
+static tree marked_pushdecls_p (tree, int, void *);
+static tree unmarked_pushdecls_p (tree, int, void *);
+static tree dfs_debug_unmarkedp (tree, int, void *);
+static tree dfs_debug_mark (tree, void *);
+static tree dfs_push_type_decls (tree, void *);
+static tree dfs_push_decls (tree, void *);
+static tree dfs_unuse_fields (tree, void *);
+static tree add_conversions (tree, void *);
+static int look_for_overrides_r (tree, tree);
+static struct search_level *push_search_level (struct stack_level *,
+ struct obstack *);
+static struct search_level *pop_search_level (struct stack_level *);
+static tree bfs_walk (tree, tree (*) (tree, void *),
+ tree (*) (tree, int, void *), void *);
+static tree lookup_field_queue_p (tree, int, void *);
+static int shared_member_p (tree);
+static tree lookup_field_r (tree, void *);
+static tree dfs_accessible_queue_p (tree, int, void *);
+static tree dfs_accessible_p (tree, void *);
+static tree dfs_access_in_type (tree, void *);
+static access_kind access_in_type (tree, tree);
+static int protected_accessible_p (tree, tree, tree);
+static int friend_accessible_p (tree, tree, tree);
+static void setup_class_bindings (tree, int);
+static int template_self_reference_p (tree, tree);
+static tree dfs_get_pure_virtuals (tree, void *);
/* Allocate a level of searching. */
static struct search_level *
-push_search_level (stack, obstack)
- struct stack_level *stack;
- struct obstack *obstack;
+push_search_level (struct stack_level *stack, struct obstack *obstack)
{
struct search_level tem;
@@ -143,10 +123,9 @@ push_search_level (stack, obstack)
/* Discard a level of search allocation. */
static struct search_level *
-pop_search_level (obstack)
- struct stack_level *obstack;
+pop_search_level (struct stack_level *obstack)
{
- register struct search_level *stack = pop_stack_level (obstack);
+ struct search_level *stack = pop_stack_level (obstack);
return stack;
}
@@ -175,14 +154,12 @@ static int n_contexts_saved;
Otherwise BINFO's bases are searched. */
static base_kind
-lookup_base_r (binfo, base, access, is_virtual, binfo_ptr)
- tree binfo, base;
- base_access access;
- int is_virtual; /* inside a virtual part */
- tree *binfo_ptr;
+lookup_base_r (tree binfo, tree base, base_access access,
+ bool is_virtual, /* inside a virtual part */
+ tree *binfo_ptr)
{
int i;
- tree bases;
+ tree bases, accesses;
base_kind found = bk_not_base;
if (same_type_p (BINFO_TYPE (binfo), base))
@@ -195,8 +172,7 @@ lookup_base_r (binfo, base, access, is_virtual, binfo_ptr)
if (!*binfo_ptr)
*binfo_ptr = binfo;
- else if (!is_virtual || !tree_int_cst_equal (BINFO_OFFSET (binfo),
- BINFO_OFFSET (*binfo_ptr)))
+ else if (binfo != *binfo_ptr)
{
if (access != ba_any)
*binfo_ptr = NULL;
@@ -210,6 +186,7 @@ lookup_base_r (binfo, base, access, is_virtual, binfo_ptr)
}
bases = BINFO_BASETYPES (binfo);
+ accesses = BINFO_BASEACCESSES (binfo);
if (!bases)
return bk_not_base;
@@ -255,7 +232,7 @@ lookup_base_r (binfo, base, access, is_virtual, binfo_ptr)
}
/* Returns true if type BASE is accessible in T. (BASE is known to be
- a base class of T.) */
+ a (possibly non-proper) base class of T.) */
bool
accessible_base_p (tree t, tree base)
@@ -265,7 +242,12 @@ accessible_base_p (tree t, tree base)
/* [class.access.base]
A base class is said to be accessible if an invented public
- member of the base class is accessible. */
+ member of the base class is accessible.
+
+ If BASE is a non-proper base, this condition is trivially
+ true. */
+ if (same_type_p (t, base))
+ return true;
/* Rather than inventing a public member, we use the implicit
public typedef created in the scope of every class. */
decl = TYPE_FIELDS (base);
@@ -277,9 +259,9 @@ accessible_base_p (tree t, tree base)
}
/* 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.
+ ACCESS specifies. Return the binfo we discover. If KIND_PTR is
+ non-NULL, fill with information about what kind of base we
+ discovered.
If the base is inaccessible, or ambiguous, and the ba_quiet bit is
not set in ACCESS, then an error is issued and error_mark_node is
@@ -287,10 +269,7 @@ accessible_base_p (tree t, tree base)
NULL_TREE is returned. */
tree
-lookup_base (t, base, access, kind_ptr)
- tree t, base;
- base_access access;
- base_kind *kind_ptr;
+lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr)
{
tree binfo = NULL; /* The binfo we've found so far. */
tree t_binfo = NULL;
@@ -366,19 +345,16 @@ lookup_base (t, base, access, kind_ptr)
/* Worker function for get_dynamic_cast_base_type. */
static int
-dynamic_cast_base_recurse (subtype, binfo, via_virtual, offset_ptr)
- tree subtype;
- tree binfo;
- int via_virtual;
- tree *offset_ptr;
+dynamic_cast_base_recurse (tree subtype, tree binfo, bool is_via_virtual,
+ tree *offset_ptr)
{
- tree binfos;
+ tree binfos, accesses;
int i, n_baselinks;
int worst = -2;
if (BINFO_TYPE (binfo) == subtype)
{
- if (via_virtual)
+ if (is_via_virtual)
return -1;
else
{
@@ -388,17 +364,19 @@ dynamic_cast_base_recurse (subtype, binfo, via_virtual, offset_ptr)
}
binfos = BINFO_BASETYPES (binfo);
+ accesses = BINFO_BASEACCESSES (binfo);
n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
for (i = 0; i < n_baselinks; i++)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
+ tree base_access = TREE_VEC_ELT (accesses, i);
int rval;
- if (!TREE_VIA_PUBLIC (base_binfo))
+ if (base_access != access_public_node)
continue;
rval = dynamic_cast_base_recurse
(subtype, base_binfo,
- via_virtual || TREE_VIA_VIRTUAL (base_binfo), offset_ptr);
+ is_via_virtual || TREE_VIA_VIRTUAL (base_binfo), offset_ptr);
if (worst == -2)
worst = rval;
else if (rval >= 0)
@@ -423,13 +401,11 @@ dynamic_cast_base_recurse (subtype, binfo, via_virtual, offset_ptr)
BOFF == -3, SUBTYPE occurs as multiple public non-virtual bases. */
tree
-get_dynamic_cast_base_type (subtype, target)
- tree subtype;
- tree target;
+get_dynamic_cast_base_type (tree subtype, tree target)
{
tree offset = NULL_TREE;
int boff = dynamic_cast_base_recurse (subtype, TYPE_BINFO (target),
- 0, &offset);
+ false, &offset);
if (!boff)
return offset;
@@ -438,10 +414,11 @@ get_dynamic_cast_base_type (subtype, target)
return offset;
}
-/* Search for a member with name NAME in a multiple inheritance lattice
- specified by TYPE. If it does not exist, return NULL_TREE.
+/* Search for a member with name NAME in a multiple inheritance
+ lattice specified by TYPE. If it does not exist, return NULL_TREE.
If the member is ambiguously referenced, return `error_mark_node'.
- Otherwise, return the FIELD_DECL. */
+ Otherwise, return a DECL with the indicated name. If WANT_TYPE is
+ true, type declarations are preferred. */
/* Do a 1-level search for NAME as a member of TYPE. The caller must
figure out whether it can access this field. (Since it is only one
@@ -450,7 +427,7 @@ get_dynamic_cast_base_type (subtype, target)
tree
lookup_field_1 (tree type, tree name, bool want_type)
{
- register tree field;
+ tree field;
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
|| TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM
@@ -467,8 +444,8 @@ lookup_field_1 (tree type, tree name, bool want_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)));
+ tree *fields = &DECL_SORTED_FIELDS (TYPE_NAME (type))->elts[0];
+ int lo = 0, hi = DECL_SORTED_FIELDS (TYPE_NAME (type))->len;
int i;
while (lo < hi)
@@ -571,7 +548,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
function. If so, we know to put the decls into the class's scope. */
tree
-current_scope ()
+current_scope (void)
{
if (current_function_decl == NULL_TREE)
return current_class_type;
@@ -593,7 +570,7 @@ current_scope ()
not within a member function body of the local class. */
int
-at_function_scope_p ()
+at_function_scope_p (void)
{
tree cs = current_scope ();
return cs && TREE_CODE (cs) == FUNCTION_DECL;
@@ -602,17 +579,26 @@ at_function_scope_p ()
/* Returns true if the innermost active scope is a class scope. */
bool
-at_class_scope_p ()
+at_class_scope_p (void)
{
tree cs = current_scope ();
return cs && TYPE_P (cs);
}
+/* Returns true if the innermost active scope is a namespace scope. */
+
+bool
+at_namespace_scope_p (void)
+{
+ /* We are in a namespace scope if we are not it a class scope or a
+ function scope. */
+ return !current_scope();
+}
+
/* Return the scope of DECL, as appropriate when doing name-lookup. */
tree
-context_for_name_lookup (decl)
- tree decl;
+context_for_name_lookup (tree decl)
{
/* [class.union]
@@ -630,92 +616,23 @@ context_for_name_lookup (decl)
return context;
}
-/* Return a canonical BINFO if BINFO is a virtual base, or just BINFO
- otherwise. */
-
-static tree
-canonical_binfo (binfo)
- tree binfo;
-{
- return (TREE_VIA_VIRTUAL (binfo)
- ? TYPE_BINFO (BINFO_TYPE (binfo)) : binfo);
-}
-
-/* A queue function that simply ensures that we walk into the
- canonical versions of virtual bases. */
-
-static tree
-dfs_canonical_queue (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- return canonical_binfo (binfo);
-}
-
-/* Called via dfs_walk from assert_canonical_unmarked. */
-
-static tree
-dfs_assert_unmarked_p (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- my_friendly_assert (!BINFO_MARKED (binfo), 0);
- return NULL_TREE;
-}
-
-/* Asserts that all the nodes below BINFO (using the canonical
- versions of virtual bases) are unmarked. */
-
-static void
-assert_canonical_unmarked (binfo)
- tree binfo;
-{
- dfs_walk (binfo, dfs_assert_unmarked_p, dfs_canonical_queue, 0);
-}
-
-/* If BINFO is marked, return a canonical version of BINFO.
- Otherwise, return NULL_TREE. */
-
-static tree
-shared_marked_p (binfo, data)
- tree binfo;
- void *data;
-{
- binfo = canonical_binfo (binfo);
- return markedp (binfo, data);
-}
-
-/* If BINFO is not marked, return a canonical version of BINFO.
- Otherwise, return NULL_TREE. */
-
-static tree
-shared_unmarked_p (binfo, data)
- tree binfo;
- void *data;
-{
- binfo = canonical_binfo (binfo);
- return unmarkedp (binfo, data);
-}
-
/* The accessibility routines use BINFO_ACCESS for scratch space
- during the computation of the accssibility of some declaration. */
+ during the computation of the accessibility of some declaration. */
#define BINFO_ACCESS(NODE) \
- ((access_kind) ((TREE_LANG_FLAG_1 (NODE) << 1) | TREE_LANG_FLAG_6 (NODE)))
+ ((access_kind) ((TREE_PUBLIC (NODE) << 1) | TREE_PRIVATE (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))
+ ((TREE_PUBLIC (NODE) = ((ACCESS) & 2) != 0), \
+ (TREE_PRIVATE (NODE) = ((ACCESS) & 1) != 0))
/* Called from access_in_type via dfs_walk. Calculate the access to
DATA (which is really a DECL) in BINFO. */
static tree
-dfs_access_in_type (binfo, data)
- tree binfo;
- void *data;
+dfs_access_in_type (tree binfo, void *data)
{
tree decl = (tree) data;
tree type = BINFO_TYPE (binfo);
@@ -723,7 +640,7 @@ dfs_access_in_type (binfo, data)
if (context_for_name_lookup (decl) == type)
{
- /* If we have desceneded to the scope of DECL, just note the
+ /* If we have descended to the scope of DECL, just note the
appropriate access. */
if (TREE_PRIVATE (decl))
access = ak_private;
@@ -741,51 +658,59 @@ dfs_access_in_type (binfo, data)
if (DECL_LANG_SPECIFIC (decl) && !DECL_DISCRIMINATOR_P (decl))
{
tree decl_access = purpose_member (type, DECL_ACCESS (decl));
+
if (decl_access)
- access = ((access_kind)
- TREE_INT_CST_LOW (TREE_VALUE (decl_access)));
+ {
+ decl_access = TREE_VALUE (decl_access);
+
+ if (decl_access == access_public_node)
+ access = ak_public;
+ else if (decl_access == access_protected_node)
+ access = ak_protected;
+ else if (decl_access == access_private_node)
+ access = ak_private;
+ else
+ my_friendly_assert (false, 20030217);
+ }
}
if (!access)
{
int i;
int n_baselinks;
- tree binfos;
+ tree binfos, accesses;
/* Otherwise, scan our baseclasses, and pick the most favorable
access. */
binfos = BINFO_BASETYPES (binfo);
+ accesses = BINFO_BASEACCESSES (binfo);
n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
for (i = 0; i < n_baselinks; ++i)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
- access_kind base_access
- = BINFO_ACCESS (canonical_binfo (base_binfo));
+ tree base_access = TREE_VEC_ELT (accesses, i);
+ access_kind base_access_now = BINFO_ACCESS (base_binfo);
- if (base_access == ak_none || base_access == ak_private)
+ if (base_access_now == ak_none || base_access_now == 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 = ak_none;
- else if (TREE_VIA_PROTECTED (base_binfo))
- /* Public and protected members in the base are
+ base_access_now = ak_none;
+ else if (base_access == access_protected_node)
+ /* Public and protected members in the base become
protected here. */
- base_access = ak_protected;
- else if (!TREE_VIA_PUBLIC (base_binfo))
- /* Public and protected members in the base are
+ base_access_now = ak_protected;
+ else if (base_access == access_private_node)
+ /* Public and protected members in the base become
private here. */
- base_access = ak_private;
+ base_access_now = ak_private;
/* See if the new access, via this base, gives more
access than our previous best access. */
- if (base_access != ak_none
- && (base_access == ak_public
- || (base_access == ak_protected
- && access != ak_public)
- || (base_access == ak_private
- && access == ak_none)))
+ if (base_access_now != ak_none
+ && (access == ak_none || base_access_now < access))
{
- access = base_access;
+ access = base_access_now;
/* If the new access is public, we can't do better. */
if (access == ak_public)
@@ -800,7 +725,7 @@ dfs_access_in_type (binfo, data)
/* Mark TYPE as visited so that if we reach it again we do not
duplicate our efforts here. */
- SET_BINFO_MARKED (binfo);
+ BINFO_MARKED (binfo) = 1;
return NULL_TREE;
}
@@ -808,9 +733,7 @@ dfs_access_in_type (binfo, data)
/* Return the access to DECL in TYPE. */
static access_kind
-access_in_type (type, decl)
- tree type;
- tree decl;
+access_in_type (tree type, tree decl)
{
tree binfo = TYPE_BINFO (type);
@@ -825,62 +748,52 @@ access_in_type (type, decl)
The algorithm we use is to make a post-order depth-first traversal
of the base-class hierarchy. As we come up the tree, we annotate
each node with the most lenient access. */
- dfs_walk_real (binfo, 0, dfs_access_in_type, shared_unmarked_p, decl);
- dfs_walk (binfo, dfs_unmark, shared_marked_p, 0);
- assert_canonical_unmarked (binfo);
+ dfs_walk_real (binfo, 0, dfs_access_in_type, unmarkedp, decl);
+ dfs_walk (binfo, dfs_unmark, markedp, 0);
return BINFO_ACCESS (binfo);
}
-/* Called from dfs_accessible_p via dfs_walk. */
+/* Called from accessible_p via dfs_walk. */
static tree
-dfs_accessible_queue_p (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
+dfs_accessible_queue_p (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
+ tree binfo = BINFO_BASETYPE (derived, ix);
+
if (BINFO_MARKED (binfo))
return NULL_TREE;
/* If this class is inherited via private or protected inheritance,
- then we can't see it, unless we are a friend of the subclass. */
- if (!TREE_VIA_PUBLIC (binfo)
- && !is_friend (BINFO_TYPE (BINFO_INHERITANCE_CHAIN (binfo)),
- current_scope ()))
+ then we can't see it, unless we are a friend of the derived class. */
+ if (BINFO_BASEACCESS (derived, ix) != access_public_node
+ && !is_friend (BINFO_TYPE (derived), current_scope ()))
return NULL_TREE;
- return canonical_binfo (binfo);
+ return binfo;
}
-/* Called from dfs_accessible_p via dfs_walk. */
+/* Called from accessible_p via dfs_walk. */
static tree
-dfs_accessible_p (binfo, data)
- tree binfo;
- void *data;
+dfs_accessible_p (tree binfo, void *data ATTRIBUTE_UNUSED)
{
- int protected_ok = data != 0;
access_kind access;
- SET_BINFO_MARKED (binfo);
+ BINFO_MARKED (binfo) = 1;
access = BINFO_ACCESS (binfo);
- if (access == ak_public || (access == ak_protected && protected_ok))
- return binfo;
- else if (access != ak_none
- && is_friend (BINFO_TYPE (binfo), current_scope ()))
+ if (access != ak_none
+ && is_friend (BINFO_TYPE (binfo), current_scope ()))
return binfo;
return NULL_TREE;
}
/* Returns nonzero if it is OK to access DECL through an object
- indiated by BINFO in the context of DERIVED. */
+ indicated by BINFO in the context of DERIVED. */
static int
-protected_accessible_p (decl, derived, binfo)
- tree decl;
- tree derived;
- tree binfo;
+protected_accessible_p (tree decl, tree derived, tree binfo)
{
access_kind access;
@@ -940,10 +853,7 @@ protected_accessible_p (decl, derived, binfo)
to access DECL through the object indicated by BINFO. */
static int
-friend_accessible_p (scope, decl, binfo)
- tree scope;
- tree decl;
- tree binfo;
+friend_accessible_p (tree scope, tree decl, tree binfo)
{
tree befriending_classes;
tree t;
@@ -989,41 +899,6 @@ friend_accessible_p (scope, decl, binfo)
return 0;
}
-/* Perform access control on TYPE_DECL or TEMPLATE_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) != TEMPLATE_DECL && 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
class used to name DECL. Return nonzero if, in the current
context, DECL is accessible. If TYPE is actually a BINFO node,
@@ -1031,27 +906,34 @@ type_access_control (type, val)
at the most derived class along the path indicated by BINFO. */
int
-accessible_p (type, decl)
- tree type;
- tree decl;
-
+accessible_p (tree type, tree decl)
{
tree binfo;
tree t;
+ tree scope;
+ access_kind access;
/* Nonzero if it's OK to access DECL if it has protected
accessibility in TYPE. */
int protected_ok = 0;
- /* If we're not checking access, everything is accessible. */
- if (!flag_access_control)
- return 1;
-
/* If this declaration is in a block or namespace scope, there's no
access control. */
if (!TYPE_P (context_for_name_lookup (decl)))
return 1;
+ /* There is no need to perform access checks inside a thunk. */
+ scope = current_scope ();
+ if (scope && DECL_THUNK_P (scope))
+ return 1;
+
+ /* In a template declaration, we cannot be sure whether the
+ particular specialization that is instantiated will be a friend
+ or not. Therefore, all access checks are deferred until
+ instantiation. */
+ if (processing_template_decl)
+ return 1;
+
if (!TYPE_P (type))
{
binfo = type;
@@ -1087,7 +969,7 @@ accessible_p (type, decl)
/* Now, loop through the classes of which we are a friend. */
if (!protected_ok)
- protected_ok = friend_accessible_p (current_scope (), decl, binfo);
+ protected_ok = friend_accessible_p (scope, decl, binfo);
/* Standardize the binfo that access_in_type will use. We don't
need to know what path was chosen from this point onwards. */
@@ -1095,83 +977,22 @@ accessible_p (type, decl)
/* Compute the accessibility of DECL in the class hierarchy
dominated by type. */
- access_in_type (type, decl);
- /* Walk the hierarchy again, looking for a base class that allows
- access. */
- t = dfs_walk (binfo, dfs_accessible_p,
- dfs_accessible_queue_p,
- protected_ok ? &protected_ok : 0);
- /* Clear any mark bits. Note that we have to walk the whole tree
- here, since we have aborted the previous walk from some point
- deep in the tree. */
- dfs_walk (binfo, dfs_unmark, dfs_canonical_queue, 0);
- assert_canonical_unmarked (binfo);
-
- return t != NULL_TREE;
-}
-
-/* Recursive helper funciton for is_subobject_of_p; see that routine
- for documentation of the parameters. */
-
-static int
-is_subobject_of_p_1 (parent, binfo, most_derived)
- tree parent, binfo, most_derived;
-{
- tree binfos;
- int i, n_baselinks;
-
- if (parent == binfo)
+ access = access_in_type (type, decl);
+ if (access == ak_public
+ || (access == ak_protected && protected_ok))
return 1;
-
- binfos = BINFO_BASETYPES (binfo);
- n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Iterate through the base types. */
- for (i = 0; i < n_baselinks; i++)
+ else
{
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree base_type;
-
- base_type = TREE_TYPE (base_binfo);
- if (!CLASS_TYPE_P (base_type))
- /* If we see a TEMPLATE_TYPE_PARM, or some such, as a base
- class there's no way to descend into it. */
- continue;
-
- /* Avoid walking into the same virtual base more than once. */
- if (TREE_VIA_VIRTUAL (base_binfo))
- {
- if (CLASSTYPE_MARKED4 (base_type))
- continue;
- SET_CLASSTYPE_MARKED4 (base_type);
- base_binfo = binfo_for_vbase (base_type, most_derived);
- }
-
- if (is_subobject_of_p_1 (parent, base_binfo, most_derived))
- return 1;
+ /* Walk the hierarchy again, looking for a base class that allows
+ access. */
+ t = dfs_walk (binfo, dfs_accessible_p, dfs_accessible_queue_p, 0);
+ /* Clear any mark bits. Note that we have to walk the whole tree
+ here, since we have aborted the previous walk from some point
+ deep in the tree. */
+ dfs_walk (binfo, dfs_unmark, 0, 0);
+
+ return t != NULL_TREE;
}
- return 0;
-}
-
-/* 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. MOST_DERIVED is the most derived type of the hierarchy being
- searched. */
-
-static int
-is_subobject_of_p (tree parent, tree binfo, tree most_derived)
-{
- int result;
- tree vbase;
-
- result = is_subobject_of_p_1 (parent, binfo, most_derived);
- /* Clear the mark bits on virtual bases. */
- for (vbase = CLASSTYPE_VBASECLASSES (most_derived);
- vbase;
- vbase = TREE_CHAIN (vbase))
- CLEAR_CLASSTYPE_MARKED4 (TREE_TYPE (TREE_VALUE (vbase)));
-
- return result;
}
struct lookup_field_info {
@@ -1188,8 +1009,6 @@ struct lookup_field_info {
tree ambiguous;
/* If nonzero, we are looking for types, not data members. */
int want_type;
- /* If nonzero, RVAL was found by looking through a dependent base. */
- int from_dep_base_p;
/* If something went wrong, a message indicating what. */
const char *errstr;
};
@@ -1200,10 +1019,9 @@ struct lookup_field_info {
lookup_field via breadth_first_search. */
static tree
-lookup_field_queue_p (binfo, data)
- tree binfo;
- void *data;
+lookup_field_queue_p (tree derived, int ix, void *data)
{
+ tree binfo = BINFO_BASETYPE (derived, ix);
struct lookup_field_info *lfi = (struct lookup_field_info *) data;
/* Don't look for constructors or destructors in base classes. */
@@ -1212,11 +1030,13 @@ lookup_field_queue_p (binfo, data)
/* If this base class is hidden by the best-known value so far, we
don't need to look. */
- binfo = CANONICAL_BINFO (binfo, lfi->type);
- if (!lfi->from_dep_base_p && lfi->rval_binfo
- && is_subobject_of_p (binfo, lfi->rval_binfo, lfi->type))
+ if (lfi->rval_binfo && original_binfo (binfo, lfi->rval_binfo))
return NULL_TREE;
+ /* If this is a dependent base, don't look in it. */
+ if (BINFO_DEPENDENT_BASE_P (binfo))
+ return NULL_TREE;
+
return binfo;
}
@@ -1229,9 +1049,7 @@ lookup_field_queue_p (binfo, data)
Returns nonzero if DECL is such a declaration in a class TYPE. */
static int
-template_self_reference_p (type, decl)
- tree type;
- tree decl;
+template_self_reference_p (tree type, tree decl)
{
return (CLASSTYPE_USE_TEMPLATE (type)
&& PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (type))
@@ -1252,8 +1070,7 @@ template_self_reference_p (type, decl)
This function checks that T contains no nonstatic members. */
static int
-shared_member_p (t)
- tree t;
+shared_member_p (tree t)
{
if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == TYPE_DECL \
|| TREE_CODE (t) == CONST_DECL)
@@ -1277,14 +1094,11 @@ shared_member_p (t)
lookup_field via breadth_first_search. */
static tree
-lookup_field_r (binfo, data)
- tree binfo;
- void *data;
+lookup_field_r (tree binfo, void *data)
{
struct lookup_field_info *lfi = (struct lookup_field_info *) data;
tree type = BINFO_TYPE (binfo);
tree nval = NULL_TREE;
- int from_dep_base_p;
/* First, look for a function. There can't be a function and a data
member with the same name, and if there's a function and a type
@@ -1323,9 +1137,9 @@ lookup_field_r (binfo, data)
}
else
nval = NULL_TREE;
- if (!nval && CLASSTYPE_NESTED_UDTS (type) != NULL)
+ if (!nval && CLASSTYPE_NESTED_UTDS (type) != NULL)
{
- binding_entry e = binding_table_find (CLASSTYPE_NESTED_UDTS (type),
+ binding_entry e = binding_table_find (CLASSTYPE_NESTED_UTDS (type),
lfi->name);
if (e != NULL)
nval = TYPE_MAIN_DECL (e->type);
@@ -1339,40 +1153,14 @@ lookup_field_r (binfo, data)
&& template_self_reference_p (type, nval))
return NULL_TREE;
- from_dep_base_p = dependent_base_p (binfo);
- if (lfi->from_dep_base_p && !from_dep_base_p)
- {
- /* If the new declaration is not found via a dependent base, and
- the old one was, then we must prefer the new one. We weren't
- really supposed to be able to find the old one, so we don't
- want to be affected by a specialization. Consider:
-
- struct B { typedef int I; };
- template <typename T> struct D1 : virtual public B {};
- template <typename T> struct D :
- public D1, virtual pubic B { I i; };
-
- The `I' in `D<T>' is unambigousuly `B::I', regardless of how
- D1 is specialized. */
- lfi->from_dep_base_p = 0;
- lfi->rval = NULL_TREE;
- lfi->rval_binfo = NULL_TREE;
- lfi->ambiguous = NULL_TREE;
- lfi->errstr = 0;
- }
- else if (lfi->rval_binfo && !lfi->from_dep_base_p && from_dep_base_p)
- /* Similarly, if the old declaration was not found via a dependent
- base, and the new one is, ignore the new one. */
- return NULL_TREE;
-
/* 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 && !is_subobject_of_p (lfi->rval_binfo, binfo, lfi->type))
+ if (lfi->rval_binfo && !original_binfo (lfi->rval_binfo, binfo))
{
if (nval == lfi->rval && shared_member_p (nval))
/* The two things are really the same. */
;
- else if (is_subobject_of_p (binfo, lfi->rval_binfo, lfi->type))
+ else if (original_binfo (binfo, lfi->rval_binfo))
/* The previous value hides the new one. */
;
else
@@ -1396,18 +1184,7 @@ lookup_field_r (binfo, data)
}
else
{
- 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
- way? */
- && !DECL_CLASS_TEMPLATE_P (nval))
- /* The thing we're looking for isn't a type, so the implicit
- typename extension doesn't apply, so we just pretend we
- didn't find anything. */
- return NULL_TREE;
-
lfi->rval = nval;
- lfi->from_dep_base_p = from_dep_base_p;
lfi->rval_binfo = binfo;
}
@@ -1431,8 +1208,8 @@ build_baselink (tree binfo, tree access_binfo, tree functions, tree optype)
my_friendly_assert (!optype || TYPE_P (optype), 20020730);
my_friendly_assert (TREE_TYPE (functions), 20020805);
- baselink = build (BASELINK, TREE_TYPE (functions), NULL_TREE,
- NULL_TREE, NULL_TREE);
+ baselink = make_node (BASELINK);
+ TREE_TYPE (baselink) = TREE_TYPE (functions);
BASELINK_BINFO (baselink) = binfo;
BASELINK_ACCESS_BINFO (baselink) = access_binfo;
BASELINK_FUNCTIONS (baselink) = functions;
@@ -1454,9 +1231,7 @@ build_baselink (tree binfo, tree access_binfo, tree functions, tree optype)
If nothing can be found return NULL_TREE and do not issue an error. */
tree
-lookup_member (xbasetype, name, protect, want_type)
- register tree xbasetype, name;
- int protect, want_type;
+lookup_member (tree xbasetype, tree name, int protect, bool want_type)
{
tree rval, rval_binfo = NULL_TREE;
tree type = NULL_TREE, basetype_path = NULL_TREE;
@@ -1471,31 +1246,31 @@ lookup_member (xbasetype, name, protect, want_type)
const char *errstr = 0;
- if (xbasetype == current_class_type && TYPE_BEING_DEFINED (xbasetype)
- && IDENTIFIER_CLASS_VALUE (name))
- {
- tree field = IDENTIFIER_CLASS_VALUE (name);
- if (! is_overloaded_fn (field)
- && ! (want_type && TREE_CODE (field) != TYPE_DECL))
- /* We're in the scope of this class, and the value has already
- been looked up. Just return the cached value. */
- return field;
- }
+ my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 20030624);
if (TREE_CODE (xbasetype) == TREE_VEC)
{
type = BINFO_TYPE (xbasetype);
basetype_path = xbasetype;
}
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)))
+ else
{
+ my_friendly_assert (IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)), 20030624);
type = xbasetype;
basetype_path = TYPE_BINFO (type);
- my_friendly_assert (BINFO_INHERITANCE_CHAIN (basetype_path) == NULL_TREE,
- 980827);
+ my_friendly_assert (!BINFO_INHERITANCE_CHAIN (basetype_path), 980827);
+ }
+
+ if (type == current_class_type && TYPE_BEING_DEFINED (type)
+ && IDENTIFIER_CLASS_VALUE (name))
+ {
+ tree field = IDENTIFIER_CLASS_VALUE (name);
+ if (! is_overloaded_fn (field)
+ && ! (want_type && TREE_CODE (field) != TYPE_DECL))
+ /* We're in the scope of this class, and the value has already
+ been looked up. Just return the cached value. */
+ return field;
}
- else
- abort ();
complete_type (type);
@@ -1503,7 +1278,7 @@ lookup_member (xbasetype, name, protect, want_type)
n_calls_lookup_field++;
#endif /* GATHER_STATISTICS */
- memset ((PTR) &lfi, 0, sizeof (lfi));
+ memset (&lfi, 0, sizeof (lfi));
lfi.type = type;
lfi.name = name;
lfi.want_type = want_type;
@@ -1531,9 +1306,8 @@ 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)
- && !enforce_access (xbasetype, rval))
- return error_mark_node;
+ if (rval && protect && !is_overloaded_fn (rval))
+ perform_or_defer_access_check (basetype_path, rval);
if (errstr && protect)
{
@@ -1543,13 +1317,6 @@ lookup_member (xbasetype, name, protect, want_type)
rval = error_mark_node;
}
- /* If the thing we found was found via the implicit typename
- extension, build the typename type. */
- if (rval && lfi.from_dep_base_p && !DECL_CLASS_TEMPLATE_P (rval))
- rval = TYPE_STUB_DECL (build_typename_type (BINFO_TYPE (basetype_path),
- name, name,
- TREE_TYPE (rval)));
-
if (rval && is_overloaded_fn (rval))
rval = build_baselink (rval_binfo, basetype_path, rval,
(IDENTIFIER_TYPENAME_P (name)
@@ -1561,9 +1328,7 @@ lookup_member (xbasetype, name, protect, want_type)
return NULL_TREE. */
tree
-lookup_field (xbasetype, name, protect, want_type)
- register tree xbasetype, name;
- int protect, want_type;
+lookup_field (tree xbasetype, tree name, int protect, bool want_type)
{
tree rval = lookup_member (xbasetype, name, protect, want_type);
@@ -1578,11 +1343,9 @@ lookup_field (xbasetype, name, protect, want_type)
return NULL_TREE. */
tree
-lookup_fnfields (xbasetype, name, protect)
- register tree xbasetype, name;
- int protect;
+lookup_fnfields (tree xbasetype, tree name, int protect)
{
- tree rval = lookup_member (xbasetype, name, protect, /*want_type=*/0);
+ tree rval = lookup_member (xbasetype, name, protect, /*want_type=*/false);
/* Ignore non-functions. */
if (rval && !BASELINK_P (rval))
@@ -1591,70 +1354,6 @@ lookup_fnfields (xbasetype, name, protect)
return rval;
}
-/* Try to find NAME inside a nested class. */
-
-tree
-lookup_nested_field (name, complain)
- tree name;
- int complain;
-{
- register tree t;
-
- tree id = NULL_TREE;
- if (TYPE_MAIN_DECL (current_class_type))
- {
- /* Climb our way up the nested ladder, seeing if we're trying to
- modify a field in an enclosing class. If so, we should only
- be able to modify if it's static. */
- for (t = TYPE_MAIN_DECL (current_class_type);
- t && DECL_CONTEXT (t);
- t = TYPE_MAIN_DECL (DECL_CONTEXT (t)))
- {
- if (TREE_CODE (DECL_CONTEXT (t)) != RECORD_TYPE)
- break;
-
- /* N.B.: lookup_field will do the access checking for us */
- id = lookup_field (DECL_CONTEXT (t), name, complain, 0);
- if (id == error_mark_node)
- {
- id = NULL_TREE;
- continue;
- }
-
- if (id != NULL_TREE)
- {
- if (TREE_CODE (id) == FIELD_DECL
- && ! TREE_STATIC (id)
- && TREE_TYPE (id) != error_mark_node)
- {
- if (complain)
- {
- /* At parse time, we don't want to give this error, since
- we won't have enough state to make this kind of
- decision properly. But there are times (e.g., with
- enums in nested classes) when we do need to call
- this fn at parse time. So, in those cases, we pass
- complain as a 0 and just return a NULL_TREE. */
- error ("assignment to non-static member `%D' of enclosing class `%T'",
- id, DECL_CONTEXT (t));
- /* Mark this for do_identifier(). It would otherwise
- claim that the variable was undeclared. */
- TREE_TYPE (id) = error_mark_node;
- }
- else
- {
- id = NULL_TREE;
- continue;
- }
- }
- break;
- }
- }
- }
-
- return id;
-}
-
/* Return the index in the CLASSTYPE_METHOD_VEC for CLASS_TYPE
corresponding to "operator TYPE ()", or -1 if there is no such
operator. Only CLASS_TYPE itself is searched; this routine does
@@ -1685,7 +1384,7 @@ lookup_conversion_operator (tree class_type, tree type)
fn = OVL_CURRENT (fn);
if (!DECL_CONV_FN_P (fn))
break;
-
+
if (pass == 0)
{
/* On the first pass we only consider exact matches. If
@@ -1771,7 +1470,7 @@ lookup_fnfields_1 (tree type, tree name)
tmp = methods[i];
/* This slot may be empty; we allocate more slots than we
need. In that case, the entry we're looking for is
- closer to the beginning of the list. */
+ closer to the beginning of the list. */
if (tmp)
tmp = DECL_NAME (OVL_CURRENT (tmp));
if (!tmp || tmp > name)
@@ -1788,7 +1487,7 @@ lookup_fnfields_1 (tree type, tree name)
#ifdef GATHER_STATISTICS
n_outer_fields_searched++;
#endif /* GATHER_STATISTICS */
-
+
tmp = OVL_CURRENT (methods[i]);
if (DECL_NAME (tmp) == name)
return i;
@@ -1797,11 +1496,11 @@ lookup_fnfields_1 (tree type, tree name)
return -1;
}
-/* DECL is the result of a qualified name lookup. QUALIFYING_CLASS
- was the class used to qualify the name. CONTEXT_CLASS is the class
- corresponding to the object in which DECL will be used. Return a
- possibly modified version of DECL that takes into account the
- CONTEXT_CLASS.
+/* DECL is the result of a qualified name lookup. QUALIFYING_SCOPE is
+ the class or namespace used to qualify the name. CONTEXT_CLASS is
+ the class corresponding to the object in which DECL will be used.
+ Return a possibly modified version of DECL that takes into account
+ the CONTEXT_CLASS.
In particular, consider an expression like `B::m' in the context of
a derived class `D'. If `B::m' has been resolved to a BASELINK,
@@ -1810,23 +1509,23 @@ lookup_fnfields_1 (tree type, tree name)
tree
adjust_result_of_qualified_name_lookup (tree decl,
- tree qualifying_class,
+ tree qualifying_scope,
tree context_class)
{
- my_friendly_assert (CLASS_TYPE_P (qualifying_class), 20020808);
- my_friendly_assert (CLASS_TYPE_P (context_class), 20020808);
-
- if (BASELINK_P (decl)
- && DERIVED_FROM_P (qualifying_class, context_class))
+ if (context_class && CLASS_TYPE_P (qualifying_scope)
+ && DERIVED_FROM_P (qualifying_scope, context_class)
+ && BASELINK_P (decl))
{
tree base;
- /* Look for the QUALIFYING_CLASS as a base of the CONTEXT_CLASS.
+ my_friendly_assert (CLASS_TYPE_P (context_class), 20020808);
+
+ /* Look for the QUALIFYING_SCOPE as a base of the CONTEXT_CLASS.
Because we do not yet know which function will be chosen by
overload resolution, we cannot yet check either accessibility
or ambiguity -- in either case, the choice of a static member
function might make the usage valid. */
- base = lookup_base (context_class, qualifying_class,
+ base = lookup_base (context_class, qualifying_scope,
ba_ignore | ba_quiet, NULL);
if (base)
{
@@ -1846,69 +1545,91 @@ adjust_result_of_qualified_name_lookup (tree decl,
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
- BINFO indicating the path from the curently visited base-class to
+ BINFO indicating the path from the currently visited base-class to
TYPE. Before each base-class is walked QFN is called. If the
value returned is nonzero, 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. */
+ called.
+
+ Implementation notes: Uses a circular queue, which starts off on
+ the stack but gets moved to the malloc arena if it needs to be
+ enlarged. The underflow and overflow conditions are
+ indistinguishable except by context: if head == tail and we just
+ moved the head pointer, the queue is empty, but if we just moved
+ the tail pointer, the queue is full.
+ Start with enough room for ten concurrent base classes. That
+ will be enough for most hierarchies. */
+#define BFS_WALK_INITIAL_QUEUE_SIZE 10
static tree
-bfs_walk (binfo, fn, qfn, data)
- tree binfo;
- tree (*fn) PARAMS ((tree, void *));
- tree (*qfn) PARAMS ((tree, void *));
- void *data;
-{
- size_t head;
- size_t tail;
+bfs_walk (tree binfo,
+ tree (*fn) (tree, void *),
+ tree (*qfn) (tree, int, void *),
+ void *data)
+{
tree rval = NULL_TREE;
- /* An array of the base classes of BINFO. These will be built up in
- breadth-first order, except where QFN prunes the search. */
- varray_type bfs_bases;
- /* Start with enough room for ten base classes. That will be enough
- for most hierarchies. */
- VARRAY_TREE_INIT (bfs_bases, 10, "search_stack");
+ tree bases_initial[BFS_WALK_INITIAL_QUEUE_SIZE];
+ /* A circular queue of the base classes of BINFO. These will be
+ built up in breadth-first order, except where QFN prunes the
+ search. */
+ size_t head, tail;
+ size_t base_buffer_size = BFS_WALK_INITIAL_QUEUE_SIZE;
+ tree *base_buffer = bases_initial;
- /* Put the first type into the stack. */
- VARRAY_TREE (bfs_bases, 0) = binfo;
- tail = 1;
+ head = tail = 0;
+ base_buffer[tail++] = binfo;
- for (head = 0; head < tail; ++head)
+ while (head != tail)
{
- int i;
- int n_baselinks;
- tree binfos;
-
- /* Pull the next type out of the queue. */
- binfo = VARRAY_TREE (bfs_bases, head);
+ int n_bases, ix;
+ tree binfo = base_buffer[head++];
+ if (head == base_buffer_size)
+ head = 0;
- /* If this is the one we're looking for, we're done. */
- rval = (*fn) (binfo, data);
+ /* Is this the one we're looking for? If so, we're done. */
+ rval = fn (binfo, data);
if (rval)
- break;
+ goto done;
- /* Queue up the base types. */
- binfos = BINFO_BASETYPES (binfo);
- n_baselinks = binfos ? TREE_VEC_LENGTH (binfos): 0;
- for (i = 0; i < n_baselinks; i++)
+ n_bases = BINFO_N_BASETYPES (binfo);
+ for (ix = 0; ix != n_bases; ix++)
{
- tree base_binfo = TREE_VEC_ELT (binfos, i);
-
+ tree base_binfo;
+
if (qfn)
- base_binfo = (*qfn) (base_binfo, data);
-
- if (base_binfo)
+ base_binfo = (*qfn) (binfo, ix, data);
+ else
+ base_binfo = BINFO_BASETYPE (binfo, ix);
+
+ if (base_binfo)
{
- if (tail == VARRAY_SIZE (bfs_bases))
- VARRAY_GROW (bfs_bases, 2 * VARRAY_SIZE (bfs_bases));
- VARRAY_TREE (bfs_bases, tail) = base_binfo;
- ++tail;
+ base_buffer[tail++] = base_binfo;
+ if (tail == base_buffer_size)
+ tail = 0;
+ if (tail == head)
+ {
+ tree *new_buffer = xmalloc (2 * base_buffer_size
+ * sizeof (tree));
+ memcpy (&new_buffer[0], &base_buffer[0],
+ tail * sizeof (tree));
+ memcpy (&new_buffer[head + base_buffer_size],
+ &base_buffer[head],
+ (base_buffer_size - head) * sizeof (tree));
+ if (base_buffer_size != BFS_WALK_INITIAL_QUEUE_SIZE)
+ free (base_buffer);
+ base_buffer = new_buffer;
+ head += base_buffer_size;
+ base_buffer_size *= 2;
+ }
}
}
}
+ done:
+ if (base_buffer_size != BFS_WALK_INITIAL_QUEUE_SIZE)
+ free (base_buffer);
return rval;
}
@@ -1917,16 +1638,12 @@ bfs_walk (binfo, fn, qfn, data)
in postorder. */
tree
-dfs_walk_real (binfo, prefn, postfn, qfn, data)
- tree binfo;
- tree (*prefn) PARAMS ((tree, void *));
- tree (*postfn) PARAMS ((tree, void *));
- tree (*qfn) PARAMS ((tree, void *));
- void *data;
+dfs_walk_real (tree binfo,
+ tree (*prefn) (tree, void *),
+ tree (*postfn) (tree, void *),
+ tree (*qfn) (tree, int, void *),
+ void *data)
{
- int i;
- int n_baselinks;
- tree binfos;
tree rval = NULL_TREE;
/* Call the pre-order walking function. */
@@ -1938,20 +1655,24 @@ dfs_walk_real (binfo, prefn, postfn, qfn, data)
}
/* Process the basetypes. */
- binfos = BINFO_BASETYPES (binfo);
- n_baselinks = BINFO_N_BASETYPES (binfo);
- for (i = 0; i < n_baselinks; i++)
+ if (BINFO_BASETYPES (binfo))
{
- tree base_binfo = TREE_VEC_ELT (binfos, i);
-
- if (qfn)
- base_binfo = (*qfn) (base_binfo, data);
-
- if (base_binfo)
+ int i, n = TREE_VEC_LENGTH (BINFO_BASETYPES (binfo));
+ for (i = 0; i != n; i++)
{
- rval = dfs_walk_real (base_binfo, prefn, postfn, qfn, data);
- if (rval)
- return rval;
+ tree base_binfo;
+
+ if (qfn)
+ base_binfo = (*qfn) (binfo, i, data);
+ else
+ base_binfo = BINFO_BASETYPE (binfo, i);
+
+ if (base_binfo)
+ {
+ rval = dfs_walk_real (base_binfo, prefn, postfn, qfn, data);
+ if (rval)
+ return rval;
+ }
}
}
@@ -1966,73 +1687,19 @@ dfs_walk_real (binfo, prefn, postfn, qfn, data)
performed. */
tree
-dfs_walk (binfo, fn, qfn, data)
- tree binfo;
- tree (*fn) PARAMS ((tree, void *));
- tree (*qfn) PARAMS ((tree, void *));
- void *data;
+dfs_walk (tree binfo,
+ tree (*fn) (tree, void *),
+ tree (*qfn) (tree, int, void *),
+ void *data)
{
return dfs_walk_real (binfo, 0, fn, qfn, data);
}
-/* Returns > 0 if a function with type DRETTYPE overriding a function
- with type BRETTYPE is covariant, as defined in [class.virtual].
-
- Returns 1 if trivial covariance, 2 if non-trivial (requiring runtime
- adjustment), or -1 if pedantically invalid covariance. */
-
-static int
-covariant_return_p (brettype, drettype)
- tree brettype, drettype;
-{
- tree binfo;
- base_kind kind;
-
- if (TREE_CODE (brettype) == FUNCTION_DECL)
- {
- brettype = TREE_TYPE (TREE_TYPE (brettype));
- drettype = TREE_TYPE (TREE_TYPE (drettype));
- }
- else if (TREE_CODE (brettype) == METHOD_TYPE)
- {
- brettype = TREE_TYPE (brettype);
- drettype = TREE_TYPE (drettype);
- }
-
- if (same_type_p (brettype, drettype))
- return 0;
-
- if (! (TREE_CODE (brettype) == TREE_CODE (drettype)
- && (TREE_CODE (brettype) == POINTER_TYPE
- || TREE_CODE (brettype) == REFERENCE_TYPE)
- && TYPE_QUALS (brettype) == TYPE_QUALS (drettype)))
- return 0;
-
- if (! can_convert (brettype, drettype))
- return 0;
-
- brettype = TREE_TYPE (brettype);
- drettype = TREE_TYPE (drettype);
-
- /* If not pedantic, allow any standard pointer conversion. */
- if (! IS_AGGR_TYPE (drettype) || ! IS_AGGR_TYPE (brettype))
- return -1;
-
- 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. */
int
-check_final_overrider (overrider, basefn)
- tree overrider, basefn;
+check_final_overrider (tree overrider, tree basefn)
{
tree over_type = TREE_TYPE (overrider);
tree base_type = TREE_TYPE (basefn);
@@ -2040,32 +1707,72 @@ check_final_overrider (overrider, basefn)
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;
+ int fail = 0;
if (same_type_p (base_return, over_return))
/* OK */;
- else if ((i = covariant_return_p (base_return, over_return)))
+ else if ((CLASS_TYPE_P (over_return) && CLASS_TYPE_P (base_return))
+ || (TREE_CODE (base_return) == TREE_CODE (over_return)
+ && POINTER_TYPE_P (base_return)))
{
- if (i == 2)
- sorry ("adjusting pointers for covariant returns");
+ /* Potentially covariant. */
+ unsigned base_quals, over_quals;
+
+ fail = !POINTER_TYPE_P (base_return);
+ if (!fail)
+ {
+ fail = cp_type_quals (base_return) != cp_type_quals (over_return);
+
+ base_return = TREE_TYPE (base_return);
+ over_return = TREE_TYPE (over_return);
+ }
+ base_quals = cp_type_quals (base_return);
+ over_quals = cp_type_quals (over_return);
- if (pedantic && i == -1)
+ if ((base_quals & over_quals) != over_quals)
+ fail = 1;
+
+ if (CLASS_TYPE_P (base_return) && CLASS_TYPE_P (over_return))
{
- cp_pedwarn_at ("invalid covariant return type for `%#D'", overrider);
- cp_pedwarn_at (" overriding `%#D' (must be pointer or reference to class)", basefn);
+ tree binfo = lookup_base (over_return, base_return,
+ ba_check | ba_quiet, NULL);
+
+ if (!binfo)
+ fail = 1;
}
+ else if (!pedantic
+ && can_convert (TREE_TYPE (base_type), TREE_TYPE (over_type)))
+ /* GNU extension, allow trivial pointer conversions such as
+ converting to void *, or qualification conversion. */
+ {
+ /* can_convert will permit user defined conversion from a
+ (reference to) class type. We must reject them. */
+ over_return = non_reference (TREE_TYPE (over_type));
+ if (CLASS_TYPE_P (over_return))
+ fail = 2;
+ }
+ else
+ fail = 2;
}
- 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)
+ else
+ fail = 2;
+ if (!fail)
+ /* OK */;
+ else if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (overrider)))
+ return 0;
+ else
{
- cp_error_at ("conflicting return type specified for `%#D'", overrider);
- cp_error_at (" overriding `%#D'", basefn);
+ if (fail == 1)
+ {
+ cp_error_at ("invalid covariant return type for `%#D'", overrider);
+ cp_error_at (" overriding `%#D'", basefn);
+ }
+ else
+ {
+ 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;
@@ -2074,10 +1781,16 @@ check_final_overrider (overrider, basefn)
/* Check throw specifier is at least as strict. */
if (!comp_except_specs (base_throw, over_throw, 0))
{
- cp_error_at ("looser throw specifier for `%#F'", overrider);
- cp_error_at (" overriding `%#F'", basefn);
+ if (!IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (overrider)))
+ {
+ cp_error_at ("looser throw specifier for `%#F'", overrider);
+ cp_error_at (" overriding `%#F'", basefn);
+ SET_IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (overrider),
+ DECL_CONTEXT (overrider));
+ }
return 0;
}
+
return 1;
}
@@ -2092,8 +1805,7 @@ check_final_overrider (overrider, basefn)
overridden. */
int
-look_for_overrides (type, fndecl)
- tree type, fndecl;
+look_for_overrides (tree type, tree fndecl)
{
tree binfo = TYPE_BINFO (type);
tree basebinfos = BINFO_BASETYPES (binfo);
@@ -2115,8 +1827,7 @@ look_for_overrides (type, fndecl)
FNDECL. */
tree
-look_for_overrides_here (type, fndecl)
- tree type, fndecl;
+look_for_overrides_here (tree type, tree fndecl)
{
int ix;
@@ -2154,8 +1865,7 @@ look_for_overrides_here (type, fndecl)
TYPE itself and its bases. */
static int
-look_for_overrides_r (type, fndecl)
- tree type, fndecl;
+look_for_overrides_r (tree type, tree fndecl)
{
tree fn = look_for_overrides_here (type, fndecl);
if (fn)
@@ -2180,71 +1890,10 @@ look_for_overrides_r (type, fndecl)
return look_for_overrides (type, fndecl);
}
-/* A queue function to use with dfs_walk that only walks into
- canonical bases. 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
-dfs_unmarked_real_bases_queue_p (binfo, data)
- tree binfo;
- void *data;
-{
- if (TREE_VIA_VIRTUAL (binfo))
- {
- tree type = (tree) data;
-
- if (TREE_CODE (type) == TREE_LIST)
- type = TREE_PURPOSE (type);
- binfo = binfo_for_vbase (BINFO_TYPE (binfo), type);
- }
- return unmarkedp (binfo, NULL);
-}
-
-/* Like dfs_unmarked_real_bases_queue_p but walks only into things
- that are marked, rather than unmarked. */
-
-tree
-dfs_marked_real_bases_queue_p (binfo, data)
- tree binfo;
- void *data;
-{
- if (TREE_VIA_VIRTUAL (binfo))
- {
- tree type = (tree) data;
-
- if (TREE_CODE (type) == TREE_LIST)
- type = TREE_PURPOSE (type);
- binfo = binfo_for_vbase (BINFO_TYPE (binfo), type);
- }
- return markedp (binfo, NULL);
-}
-
-/* A queue function that skips all virtual bases (and their
- bases). */
-
-tree
-dfs_skip_vbases (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- if (TREE_VIA_VIRTUAL (binfo))
- return NULL_TREE;
-
- return binfo;
-}
-
/* Called via dfs_walk from dfs_get_pure_virtuals. */
static tree
-dfs_get_pure_virtuals (binfo, data)
- tree binfo;
- void *data;
+dfs_get_pure_virtuals (tree binfo, void *data)
{
tree type = (tree) data;
@@ -2264,7 +1913,7 @@ dfs_get_pure_virtuals (binfo, data)
CLASSTYPE_PURE_VIRTUALS (type));
}
- SET_BINFO_MARKED (binfo);
+ BINFO_MARKED (binfo) = 1;
return NULL_TREE;
}
@@ -2272,8 +1921,7 @@ dfs_get_pure_virtuals (binfo, data)
/* Set CLASSTYPE_PURE_VIRTUALS for TYPE. */
void
-get_pure_virtuals (type)
- tree type;
+get_pure_virtuals (tree type)
{
tree vbases;
@@ -2286,10 +1934,8 @@ get_pure_virtuals (type)
(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);
+ dfs_walk (TYPE_BINFO (type), dfs_get_pure_virtuals, unmarkedp, type);
+ dfs_walk (TYPE_BINFO (type), dfs_unmark, markedp, type);
/* Put the pure virtuals in dfs order. */
CLASSTYPE_PURE_VIRTUALS (type) = nreverse (CLASSTYPE_PURE_VIRTUALS (type));
@@ -2314,52 +1960,36 @@ get_pure_virtuals (type)
/* DEPTH-FIRST SEARCH ROUTINES. */
tree
-markedp (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
+markedp (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
+{
+ tree binfo = BINFO_BASETYPE (derived, ix);
+
return BINFO_MARKED (binfo) ? binfo : NULL_TREE;
}
tree
-unmarkedp (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
+unmarkedp (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
- return !BINFO_MARKED (binfo) ? binfo : NULL_TREE;
-}
-
-tree
-marked_vtable_pathp (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- return BINFO_VTABLE_PATH_MARKED (binfo) ? binfo : NULL_TREE;
-}
-
-tree
-unmarked_vtable_pathp (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- return !BINFO_VTABLE_PATH_MARKED (binfo) ? binfo : NULL_TREE;
+ tree binfo = BINFO_BASETYPE (derived, ix);
+
+ return !BINFO_MARKED (binfo) ? binfo : NULL_TREE;
}
static tree
-marked_pushdecls_p (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
+marked_pushdecls_p (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
- return (CLASS_TYPE_P (BINFO_TYPE (binfo))
+ tree binfo = BINFO_BASETYPE (derived, ix);
+
+ return (!BINFO_DEPENDENT_BASE_P (binfo)
&& BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE;
}
static tree
-unmarked_pushdecls_p (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
+unmarked_pushdecls_p (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
- return (CLASS_TYPE_P (BINFO_TYPE (binfo))
+ tree binfo = BINFO_BASETYPE (derived, ix);
+
+ return (!BINFO_DEPENDENT_BASE_P (binfo)
&& !BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE;
}
@@ -2368,111 +1998,12 @@ unmarked_pushdecls_p (binfo, data)
a predicate function (above). */
tree
-dfs_unmark (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- CLEAR_BINFO_MARKED (binfo);
- 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. */
-
-static tree
-dfs_get_vbase_types (binfo, data)
- tree binfo;
- void *data;
-{
- 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;
-}
-
-/* Called via dfs_walk from mark_primary_bases. Builds the
- inheritance graph order list of BINFOs. */
-
-static tree
-dfs_build_inheritance_graph_order (binfo, data)
- tree binfo;
- void *data;
-{
- tree *last_binfo = (tree *) data;
-
- if (*last_binfo)
- TREE_CHAIN (*last_binfo) = binfo;
- *last_binfo = binfo;
- SET_BINFO_MARKED (binfo);
- return NULL_TREE;
-}
-
-/* Set CLASSTYPE_VBASECLASSES for TYPE. */
-
-void
-get_vbase_types (type)
- tree type;
-{
- tree last_binfo;
-
- 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_find_vbase_instance (binfo, data)
- tree binfo;
- void *data;
+dfs_unmark (tree binfo, void *data ATTRIBUTE_UNUSED)
{
- tree base = TREE_VALUE ((tree) data);
-
- if (BINFO_PRIMARY_P (binfo)
- && same_type_p (BINFO_TYPE (binfo), base))
- return binfo;
-
+ BINFO_MARKED (binfo) = 0;
return NULL_TREE;
}
-/* Find the real occurrence of the virtual BASE (a class type) in the
- hierarchy dominated by TYPE. */
-
-tree
-find_vbase_instance (base, type)
- tree base;
- tree type;
-{
- tree instance;
-
- instance = binfo_for_vbase (base, type);
- if (!BINFO_PRIMARY_P (instance))
- return instance;
-
- return dfs_walk (TYPE_BINFO (type),
- dfs_find_vbase_instance,
- NULL,
- build_tree_list (type, base));
-}
-
/* Debug info for C++ classes can get very large; try to avoid
emitting it everywhere.
@@ -2482,8 +2013,7 @@ find_vbase_instance (base, type)
linker. */
void
-maybe_suppress_debug_info (t)
- tree t;
+maybe_suppress_debug_info (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
@@ -2525,9 +2055,7 @@ maybe_suppress_debug_info (t)
information anyway. */
static tree
-dfs_debug_mark (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
+dfs_debug_mark (tree binfo, void *data ATTRIBUTE_UNUSED)
{
tree t = BINFO_TYPE (binfo);
@@ -2540,10 +2068,10 @@ dfs_debug_mark (binfo, data)
info for this base class. */
static tree
-dfs_debug_unmarkedp (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
+dfs_debug_unmarkedp (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
+{
+ tree binfo = BINFO_BASETYPE (derived, ix);
+
return (!CLASSTYPE_DEBUG_REQUESTED (BINFO_TYPE (binfo))
? binfo : NULL_TREE);
}
@@ -2556,8 +2084,7 @@ dfs_debug_unmarkedp (binfo, data)
the vtables themselves, were optimized away. */
void
-note_debug_info_needed (type)
- tree type;
+note_debug_info_needed (tree type)
{
if (TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)))
{
@@ -2570,27 +2097,8 @@ note_debug_info_needed (type)
/* Subroutines of push_class_decls (). */
-/* Returns 1 iff BINFO is a base we shouldn't really be able to see into,
- because it (or one of the intermediate bases) depends on template parms. */
-
-static int
-dependent_base_p (binfo)
- tree binfo;
-{
- for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo))
- {
- if (currently_open_class (TREE_TYPE (binfo)))
- break;
- if (uses_template_parms (TREE_TYPE (binfo)))
- return 1;
- }
- return 0;
-}
-
static void
-setup_class_bindings (name, type_binding_p)
- tree name;
- int type_binding_p;
+setup_class_bindings (tree name, int type_binding_p)
{
tree type_binding = NULL_TREE;
tree value_binding;
@@ -2604,8 +2112,7 @@ setup_class_bindings (name, type_binding_p)
if (type_binding_p)
{
type_binding = lookup_member (current_class_type, name,
- /*protect=*/2,
- /*want_type=*/1);
+ /*protect=*/2, /*want_type=*/true);
if (TREE_CODE (type_binding) == TREE_LIST
&& TREE_TYPE (type_binding) == error_mark_node)
/* NAME is ambiguous. */
@@ -2616,8 +2123,7 @@ setup_class_bindings (name, type_binding_p)
/* Now, do the value binding. */
value_binding = lookup_member (current_class_type, name,
- /*protect=*/2,
- /*want_type=*/0);
+ /*protect=*/2, /*want_type=*/false);
if (type_binding_p
&& (TREE_CODE (value_binding) == TYPE_DECL
@@ -2663,9 +2169,7 @@ setup_class_bindings (name, type_binding_p)
are TYPE_DECLS. */
static tree
-dfs_push_type_decls (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
+dfs_push_type_decls (tree binfo, void *data ATTRIBUTE_UNUSED)
{
tree type;
tree fields;
@@ -2679,7 +2183,7 @@ dfs_push_type_decls (binfo, data)
/* We can't just use BINFO_MARKED because envelope_add_decl uses
DERIVED_FROM_P, which calls get_base_distance. */
- SET_BINFO_PUSHDECLS_MARKED (binfo);
+ BINFO_PUSHDECLS_MARKED (binfo) = 1;
return NULL_TREE;
}
@@ -2688,50 +2192,41 @@ dfs_push_type_decls (binfo, data)
are not TYPE_DECLS. */
static tree
-dfs_push_decls (binfo, data)
- tree binfo;
- void *data;
+dfs_push_decls (tree binfo, void *data)
{
- tree type;
+ tree type = BINFO_TYPE (binfo);
tree method_vec;
- int dep_base_p;
-
- type = BINFO_TYPE (binfo);
- dep_base_p = (processing_template_decl && type != current_class_type
- && dependent_base_p (binfo));
- if (!dep_base_p)
+ tree fields;
+
+ for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
+ if (DECL_NAME (fields)
+ && TREE_CODE (fields) != TYPE_DECL
+ && TREE_CODE (fields) != USING_DECL
+ && !DECL_ARTIFICIAL (fields))
+ setup_class_bindings (DECL_NAME (fields), /*type_binding_p=*/0);
+ else if (TREE_CODE (fields) == FIELD_DECL
+ && ANON_AGGR_TYPE_P (TREE_TYPE (fields)))
+ dfs_push_decls (TYPE_BINFO (TREE_TYPE (fields)), data);
+
+ method_vec = (CLASS_TYPE_P (type)
+ ? CLASSTYPE_METHOD_VEC (type) : NULL_TREE);
+
+ if (method_vec && TREE_VEC_LENGTH (method_vec) >= 3)
{
- tree fields;
- for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
- if (DECL_NAME (fields)
- && TREE_CODE (fields) != TYPE_DECL
- && TREE_CODE (fields) != USING_DECL
- && !DECL_ARTIFICIAL (fields))
- setup_class_bindings (DECL_NAME (fields), /*type_binding_p=*/0);
- else if (TREE_CODE (fields) == FIELD_DECL
- && ANON_AGGR_TYPE_P (TREE_TYPE (fields)))
- dfs_push_decls (TYPE_BINFO (TREE_TYPE (fields)), data);
-
- method_vec = (CLASS_TYPE_P (type)
- ? CLASSTYPE_METHOD_VEC (type) : NULL_TREE);
-
- if (method_vec && TREE_VEC_LENGTH (method_vec) >= 3)
- {
- tree *methods;
- tree *end;
-
- /* Farm out constructors and destructors. */
- end = TREE_VEC_END (method_vec);
-
- for (methods = &TREE_VEC_ELT (method_vec, 2);
- methods < end && *methods;
- methods++)
- setup_class_bindings (DECL_NAME (OVL_CURRENT (*methods)),
- /*type_binding_p=*/0);
- }
+ tree *methods;
+ tree *end;
+
+ /* Farm out constructors and destructors. */
+ end = TREE_VEC_END (method_vec);
+
+ for (methods = &TREE_VEC_ELT (method_vec, 2);
+ methods < end && *methods;
+ methods++)
+ setup_class_bindings (DECL_NAME (OVL_CURRENT (*methods)),
+ /*type_binding_p=*/0);
}
- CLEAR_BINFO_PUSHDECLS_MARKED (binfo);
+ BINFO_PUSHDECLS_MARKED (binfo) = 0;
return NULL_TREE;
}
@@ -2744,8 +2239,7 @@ dfs_push_decls (binfo, data)
message. */
void
-push_class_decls (type)
- tree type;
+push_class_decls (tree type)
{
search_stack = push_search_level (search_stack, &search_obstack);
@@ -2759,9 +2253,7 @@ push_class_decls (type)
/* Here's a subroutine we need because C lacks lambdas. */
static tree
-dfs_unuse_fields (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
+dfs_unuse_fields (tree binfo, void *data ATTRIBUTE_UNUSED)
{
tree type = TREE_TYPE (binfo);
tree fields;
@@ -2781,14 +2273,13 @@ dfs_unuse_fields (binfo, data)
}
void
-unuse_fields (type)
- tree type;
+unuse_fields (tree type)
{
dfs_walk (TYPE_BINFO (type), dfs_unuse_fields, unmarkedp, 0);
}
void
-pop_class_decls ()
+pop_class_decls (void)
{
/* We haven't pushed a search level when dealing with cached classes,
so we'd better not try to pop it. */
@@ -2797,7 +2288,7 @@ pop_class_decls ()
}
void
-print_search_statistics ()
+print_search_statistics (void)
{
#ifdef GATHER_STATISTICS
fprintf (stderr, "%d fields searched in %d[%d] calls to lookup_field[_1]\n",
@@ -2811,13 +2302,13 @@ print_search_statistics ()
}
void
-init_search_processing ()
+init_search_processing (void)
{
gcc_obstack_init (&search_obstack);
}
void
-reinit_search_statistics ()
+reinit_search_statistics (void)
{
#ifdef GATHER_STATISTICS
n_fields_searched = 0;
@@ -2830,9 +2321,7 @@ reinit_search_statistics ()
}
static tree
-add_conversions (binfo, data)
- tree binfo;
- void *data;
+add_conversions (tree binfo, void *data)
{
int i;
tree method_vec = CLASSTYPE_METHOD_VEC (BINFO_TYPE (binfo));
@@ -2888,8 +2377,7 @@ add_conversions (binfo, data)
from which the conversion functions in this node were selected. */
tree
-lookup_conversions (type)
- tree type;
+lookup_conversions (tree type)
{
tree t;
tree conversions = NULL_TREE;
@@ -2913,9 +2401,7 @@ struct overlap_info
at offset 0 in COMPARE_TYPE, and set found_overlap if so. */
static tree
-dfs_check_overlap (empty_binfo, data)
- tree empty_binfo;
- void *data;
+dfs_check_overlap (tree empty_binfo, void *data)
{
struct overlap_info *oi = (struct overlap_info *) data;
tree binfo;
@@ -2938,11 +2424,11 @@ dfs_check_overlap (empty_binfo, data)
/* Trivial function to stop base traversal when we find something. */
static tree
-dfs_no_overlap_yet (binfo, data)
- tree binfo;
- void *data;
+dfs_no_overlap_yet (tree derived, int ix, void *data)
{
+ tree binfo = BINFO_BASETYPE (derived, ix);
struct overlap_info *oi = (struct overlap_info *) data;
+
return !oi->found_overlap ? binfo : NULL_TREE;
}
@@ -2950,8 +2436,7 @@ dfs_no_overlap_yet (binfo, data)
offset 0 in NEXT_TYPE. Used in laying out empty base class subobjects. */
int
-types_overlap_p (empty_type, next_type)
- tree empty_type, next_type;
+types_overlap_p (tree empty_type, tree next_type)
{
struct overlap_info oi;
@@ -2970,8 +2455,7 @@ types_overlap_p (empty_type, next_type)
FIXME: This does not work with the new ABI. */
tree
-binfo_for_vtable (var)
- tree var;
+binfo_for_vtable (tree var)
{
tree main_binfo = TYPE_BINFO (DECL_CONTEXT (var));
tree binfos = TYPE_BINFO_BASETYPES (BINFO_TYPE (main_binfo));
@@ -2997,8 +2481,7 @@ binfo_for_vtable (var)
from BINFO, or NULL if binfo is not via virtual. */
tree
-binfo_from_vbase (binfo)
- tree binfo;
+binfo_from_vbase (tree binfo)
{
for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo))
{
@@ -3013,9 +2496,7 @@ binfo_from_vbase (binfo)
via virtual. */
tree
-binfo_via_virtual (binfo, limit)
- tree binfo;
- tree limit;
+binfo_via_virtual (tree binfo, tree limit)
{
for (; binfo && (!limit || !same_type_p (BINFO_TYPE (binfo), limit));
binfo = BINFO_INHERITANCE_CHAIN (binfo))
@@ -3026,16 +2507,99 @@ binfo_via_virtual (binfo, limit)
return NULL_TREE;
}
-/* Returns the BINFO (if any) for the virtual baseclass T of the class
- C from the CLASSTYPE_VBASECLASSES list. */
+/* BINFO is a base binfo in the complete type BINFO_TYPE (HERE).
+ Find the equivalent binfo within whatever graph HERE is located.
+ This is the inverse of original_binfo. */
tree
-binfo_for_vbase (basetype, classtype)
- tree basetype;
- tree classtype;
+copied_binfo (tree binfo, tree here)
{
- tree binfo;
+ tree result = NULL_TREE;
+
+ if (TREE_VIA_VIRTUAL (binfo))
+ {
+ tree t;
+
+ for (t = here; BINFO_INHERITANCE_CHAIN (t);
+ t = BINFO_INHERITANCE_CHAIN (t))
+ continue;
+
+ result = purpose_member (BINFO_TYPE (binfo),
+ CLASSTYPE_VBASECLASSES (BINFO_TYPE (t)));
+ result = TREE_VALUE (result);
+ }
+ else if (BINFO_INHERITANCE_CHAIN (binfo))
+ {
+ tree base_binfos;
+ int ix, n;
+
+ base_binfos = copied_binfo (BINFO_INHERITANCE_CHAIN (binfo), here);
+ base_binfos = BINFO_BASETYPES (base_binfos);
+ n = TREE_VEC_LENGTH (base_binfos);
+ for (ix = 0; ix != n; ix++)
+ {
+ tree base = TREE_VEC_ELT (base_binfos, ix);
+
+ if (BINFO_TYPE (base) == BINFO_TYPE (binfo))
+ {
+ result = base;
+ break;
+ }
+ }
+ }
+ else
+ {
+ my_friendly_assert (BINFO_TYPE (here) == BINFO_TYPE (binfo), 20030202);
+ result = here;
+ }
- binfo = purpose_member (basetype, CLASSTYPE_VBASECLASSES (classtype));
- return binfo ? TREE_VALUE (binfo) : NULL_TREE;
+ my_friendly_assert (result, 20030202);
+ return result;
}
+
+/* BINFO is some base binfo of HERE, within some other
+ hierarchy. Return the equivalent binfo, but in the hierarchy
+ dominated by HERE. This is the inverse of copied_binfo. If BINFO
+ is not a base binfo of HERE, returns NULL_TREE. */
+
+tree
+original_binfo (tree binfo, tree here)
+{
+ tree result = NULL;
+
+ if (BINFO_TYPE (binfo) == BINFO_TYPE (here))
+ result = here;
+ else if (TREE_VIA_VIRTUAL (binfo))
+ {
+ result = purpose_member (BINFO_TYPE (binfo),
+ CLASSTYPE_VBASECLASSES (BINFO_TYPE (here)));
+ if (result)
+ result = TREE_VALUE (result);
+ }
+ else if (BINFO_INHERITANCE_CHAIN (binfo))
+ {
+ tree base_binfos;
+
+ base_binfos = original_binfo (BINFO_INHERITANCE_CHAIN (binfo), here);
+ if (base_binfos)
+ {
+ int ix, n;
+
+ base_binfos = BINFO_BASETYPES (base_binfos);
+ n = TREE_VEC_LENGTH (base_binfos);
+ for (ix = 0; ix != n; ix++)
+ {
+ tree base = TREE_VEC_ELT (base_binfos, ix);
+
+ if (BINFO_TYPE (base) == BINFO_TYPE (binfo))
+ {
+ result = base;
+ break;
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
diff --git a/contrib/gcc/cp/semantics.c b/contrib/gcc/cp/semantics.c
index 110eb3a..966b004 100644
--- a/contrib/gcc/cp/semantics.c
+++ b/contrib/gcc/cp/semantics.c
@@ -3,29 +3,32 @@
building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004 Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
- This file is part of GNU CC.
+ This file is part of GCC.
- GNU CC is free software; you can redistribute it and/or modify it
+ GCC 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
+ GCC 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
+ along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "tree-inline.h"
@@ -33,12 +36,12 @@
#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"
+#include "cgraph.h"
/* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or
@@ -49,18 +52,14 @@
parsing into this file; that will make implementing the new parser
much easier since it will be able to make use of these routines. */
-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_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 *));
+static tree maybe_convert_cond (tree);
+static tree simplify_aggr_init_exprs_r (tree *, int *, void *);
+static void emit_associated_thunks (tree);
+static void genrtl_try_block (tree);
+static void genrtl_eh_spec_block (tree);
+static void genrtl_handler (tree);
+static void cp_expand_stmt (tree);
+
/* Finish processing the COND, the SUBSTMT condition for STMT. */
@@ -79,12 +78,233 @@ static tree clear_decl_rtl PARAMS ((tree *, int *, void *));
(SUBSTMT) = (COND); \
} while (0)
+/* Deferred Access Checking Overview
+ ---------------------------------
+
+ Most C++ expressions and declarations require access checking
+ to be performed during parsing. However, in several cases,
+ this has to be treated differently.
+
+ For member declarations, access checking has to be deferred
+ until more information about the declaration is known. For
+ example:
+
+ class A {
+ typedef int X;
+ public:
+ X f();
+ };
+
+ A::X A::f();
+ A::X g();
+
+ When we are parsing the function return type `A::X', we don't
+ really know if this is allowed until we parse the function name.
+
+ Furthermore, some contexts require that access checking is
+ never performed at all. These include class heads, and template
+ instantiations.
+
+ Typical use of access checking functions is described here:
+
+ 1. When we enter a context that requires certain access checking
+ mode, the function `push_deferring_access_checks' is called with
+ DEFERRING argument specifying the desired mode. Access checking
+ may be performed immediately (dk_no_deferred), deferred
+ (dk_deferred), or not performed (dk_no_check).
+
+ 2. When a declaration such as a type, or a variable, is encountered,
+ the function `perform_or_defer_access_check' is called. It
+ maintains a TREE_LIST of all deferred checks.
+
+ 3. The global `current_class_type' or `current_function_decl' is then
+ setup by the parser. `enforce_access' relies on these information
+ to check access.
+
+ 4. Upon exiting the context mentioned in step 1,
+ `perform_deferred_access_checks' is called to check all declaration
+ stored in the TREE_LIST. `pop_deferring_access_checks' is then
+ called to restore the previous access checking mode.
+
+ In case of parsing error, we simply call `pop_deferring_access_checks'
+ without `perform_deferred_access_checks'. */
+
+/* Data for deferred access checking. */
+static GTY(()) deferred_access *deferred_access_stack;
+static GTY(()) deferred_access *deferred_access_free_list;
+
+/* Save the current deferred access states and start deferred
+ access checking iff DEFER_P is true. */
+
+void
+push_deferring_access_checks (deferring_kind deferring)
+{
+ deferred_access *d;
+
+ /* For context like template instantiation, access checking
+ disabling applies to all nested context. */
+ if (deferred_access_stack
+ && deferred_access_stack->deferring_access_checks_kind == dk_no_check)
+ deferring = dk_no_check;
+
+ /* Recycle previously used free store if available. */
+ if (deferred_access_free_list)
+ {
+ d = deferred_access_free_list;
+ deferred_access_free_list = d->next;
+ }
+ else
+ d = ggc_alloc (sizeof (deferred_access));
+
+ d->next = deferred_access_stack;
+ d->deferred_access_checks = NULL_TREE;
+ d->deferring_access_checks_kind = deferring;
+ deferred_access_stack = d;
+}
+
+/* Resume deferring access checks again after we stopped doing
+ this previously. */
+
+void
+resume_deferring_access_checks (void)
+{
+ if (deferred_access_stack->deferring_access_checks_kind == dk_no_deferred)
+ deferred_access_stack->deferring_access_checks_kind = dk_deferred;
+}
+
+/* Stop deferring access checks. */
+
+void
+stop_deferring_access_checks (void)
+{
+ if (deferred_access_stack->deferring_access_checks_kind == dk_deferred)
+ deferred_access_stack->deferring_access_checks_kind = dk_no_deferred;
+}
+
+/* Discard the current deferred access checks and restore the
+ previous states. */
+
+void
+pop_deferring_access_checks (void)
+{
+ deferred_access *d = deferred_access_stack;
+ deferred_access_stack = d->next;
+
+ /* Remove references to access checks TREE_LIST. */
+ d->deferred_access_checks = NULL_TREE;
+
+ /* Store in free list for later use. */
+ d->next = deferred_access_free_list;
+ deferred_access_free_list = d;
+}
+
+/* Returns a TREE_LIST representing the deferred checks.
+ The TREE_PURPOSE of each node is the type through which the
+ access occurred; the TREE_VALUE is the declaration named.
+ */
+
+tree
+get_deferred_access_checks (void)
+{
+ return deferred_access_stack->deferred_access_checks;
+}
+
+/* Take current deferred checks and combine with the
+ previous states if we also defer checks previously.
+ Otherwise perform checks now. */
+
+void
+pop_to_parent_deferring_access_checks (void)
+{
+ tree deferred_check = get_deferred_access_checks ();
+ deferred_access *d1 = deferred_access_stack;
+ deferred_access *d2 = deferred_access_stack->next;
+ deferred_access *d3 = deferred_access_stack->next->next;
+
+ /* Temporary swap the order of the top two states, just to make
+ sure the garbage collector will not reclaim the memory during
+ processing below. */
+ deferred_access_stack = d2;
+ d2->next = d1;
+ d1->next = d3;
+
+ for ( ; deferred_check; deferred_check = TREE_CHAIN (deferred_check))
+ /* Perform deferred check if required. */
+ perform_or_defer_access_check (TREE_PURPOSE (deferred_check),
+ TREE_VALUE (deferred_check));
+
+ deferred_access_stack = d1;
+ d1->next = d2;
+ d2->next = d3;
+ pop_deferring_access_checks ();
+}
+
+/* Perform the deferred access checks.
+
+ After performing the checks, we still have to keep the list
+ `deferred_access_stack->deferred_access_checks' since we may want
+ to check access for them again later in a different context.
+ For example:
+
+ class A {
+ typedef int X;
+ static X a;
+ };
+ A::X A::a, x; // No error for `A::a', error for `x'
+
+ We have to perform deferred access of `A::X', first with `A::a',
+ next with `x'. */
+
+void
+perform_deferred_access_checks (void)
+{
+ tree deferred_check;
+ for (deferred_check = deferred_access_stack->deferred_access_checks;
+ deferred_check;
+ deferred_check = TREE_CHAIN (deferred_check))
+ /* Check access. */
+ enforce_access (TREE_PURPOSE (deferred_check),
+ TREE_VALUE (deferred_check));
+}
+
+/* Defer checking the accessibility of DECL, when looked up in
+ BINFO. */
+
+void
+perform_or_defer_access_check (tree binfo, tree decl)
+{
+ tree check;
+
+ my_friendly_assert (TREE_CODE (binfo) == TREE_VEC, 20030623);
+
+ /* If we are not supposed to defer access checks, just check now. */
+ if (deferred_access_stack->deferring_access_checks_kind == dk_no_deferred)
+ {
+ enforce_access (binfo, decl);
+ return;
+ }
+ /* Exit if we are in a context that no access checking is performed. */
+ else if (deferred_access_stack->deferring_access_checks_kind == dk_no_check)
+ return;
+
+ /* See if we are already going to perform this check. */
+ for (check = deferred_access_stack->deferred_access_checks;
+ check;
+ check = TREE_CHAIN (check))
+ if (TREE_VALUE (check) == decl && TREE_PURPOSE (check) == binfo)
+ return;
+ /* If not, record the check. */
+ deferred_access_stack->deferred_access_checks
+ = tree_cons (binfo, decl,
+ deferred_access_stack->deferred_access_checks);
+}
+
/* Returns nonzero if the current statement is a full expression,
i.e. temporaries created during that statement should be destroyed
at the end of the statement. */
int
-stmts_are_full_exprs_p ()
+stmts_are_full_exprs_p (void)
{
return current_stmt_tree ()->stmts_are_full_exprs_p;
}
@@ -94,7 +314,7 @@ stmts_are_full_exprs_p ()
returned. */
stmt_tree
-current_stmt_tree ()
+current_stmt_tree (void)
{
return (cfun
? &cfun->language->base.x_stmt_tree
@@ -106,8 +326,7 @@ current_stmt_tree ()
declared is not an anonymous union" [class.union]. */
int
-anon_aggr_type_p (node)
- tree node;
+anon_aggr_type_p (tree node)
{
return ANON_AGGR_TYPE_P (node);
}
@@ -115,7 +334,7 @@ anon_aggr_type_p (node)
/* Finish a scope. */
tree
-do_poplevel ()
+do_poplevel (void)
{
tree block = NULL_TREE;
@@ -123,14 +342,17 @@ do_poplevel ()
{
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)
+ if (!processing_template_decl)
{
- SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
- SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
+ /* This needs to come after the poplevel so that partial scopes
+ are properly nested. */
+ scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
+ if (block)
+ {
+ SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
+ SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
+ }
}
}
@@ -140,21 +362,20 @@ do_poplevel ()
/* Begin a new scope. */
void
-do_pushlevel ()
+do_pushlevel (scope_kind sk)
{
if (stmts_are_full_exprs_p ())
{
- pushlevel (0);
if (!processing_template_decl)
add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
+ begin_scope (sk, NULL);
}
}
/* Finish a goto-statement. */
tree
-finish_goto_stmt (destination)
- tree destination;
+finish_goto_stmt (tree destination)
{
if (TREE_CODE (destination) == IDENTIFIER_NODE)
destination = lookup_label (destination);
@@ -163,13 +384,17 @@ finish_goto_stmt (destination)
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;
+ else
+ {
+ /* The DESTINATION is being used as an rvalue. */
+ if (!processing_template_decl)
+ destination = decay_conversion (destination);
+ /* 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);
@@ -179,9 +404,8 @@ finish_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;
+static tree
+maybe_convert_cond (tree cond)
{
/* Empty conditions remain empty. */
if (!cond)
@@ -199,36 +423,22 @@ maybe_convert_cond (cond)
/* Finish an expression-statement, whose EXPRESSION is as indicated. */
tree
-finish_expr_stmt (expr)
- tree expr;
+finish_expr_stmt (tree expr)
{
tree r = NULL_TREE;
- tree expr_type = NULL_TREE;;
if (expr != NULL_TREE)
{
- 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);
-
- /* Remember the type of the expression. */
- expr_type = TREE_TYPE (expr);
-
- if (stmts_are_full_exprs_p ())
+ if (!processing_template_decl)
expr = convert_to_void (expr, "statement");
+ else if (!type_dependent_expression_p (expr))
+ convert_to_void (build_non_dependent_expr (expr), "statement");
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_type;
-
return r;
}
@@ -237,10 +447,10 @@ finish_expr_stmt (expr)
appropriate. */
tree
-begin_if_stmt ()
+begin_if_stmt (void)
{
tree r;
- do_pushlevel ();
+ do_pushlevel (sk_block);
r = build_stmt (IF_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
add_stmt (r);
return r;
@@ -250,9 +460,7 @@ begin_if_stmt ()
IF_STMT. */
void
-finish_if_stmt_cond (cond, if_stmt)
- tree cond;
- tree if_stmt;
+finish_if_stmt_cond (tree cond, tree if_stmt)
{
cond = maybe_convert_cond (cond);
FINISH_COND (cond, if_stmt, IF_COND (if_stmt));
@@ -262,8 +470,7 @@ finish_if_stmt_cond (cond, if_stmt)
IF_STMT. */
tree
-finish_then_clause (if_stmt)
- tree if_stmt;
+finish_then_clause (tree if_stmt)
{
RECHAIN_STMTS (if_stmt, THEN_CLAUSE (if_stmt));
return if_stmt;
@@ -272,7 +479,7 @@ finish_then_clause (if_stmt)
/* Begin the else-clause of an if-statement. */
void
-begin_else_clause ()
+begin_else_clause (void)
{
}
@@ -280,8 +487,7 @@ begin_else_clause ()
IF_STMT. */
void
-finish_else_clause (if_stmt)
- tree if_stmt;
+finish_else_clause (tree if_stmt)
{
RECHAIN_STMTS (if_stmt, ELSE_CLAUSE (if_stmt));
}
@@ -289,7 +495,7 @@ finish_else_clause (if_stmt)
/* Finish an if-statement. */
void
-finish_if_stmt ()
+finish_if_stmt (void)
{
finish_stmt ();
do_poplevel ();
@@ -299,12 +505,12 @@ finish_if_stmt ()
appropriate. */
tree
-begin_while_stmt ()
+begin_while_stmt (void)
{
tree r;
r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE);
add_stmt (r);
- do_pushlevel ();
+ do_pushlevel (sk_block);
return r;
}
@@ -312,9 +518,7 @@ begin_while_stmt ()
WHILE_STMT. */
void
-finish_while_stmt_cond (cond, while_stmt)
- tree cond;
- tree while_stmt;
+finish_while_stmt_cond (tree cond, tree while_stmt)
{
cond = maybe_convert_cond (cond);
if (processing_template_decl)
@@ -345,8 +549,7 @@ finish_while_stmt_cond (cond, while_stmt)
/* Finish a while-statement, which may be given by WHILE_STMT. */
void
-finish_while_stmt (while_stmt)
- tree while_stmt;
+finish_while_stmt (tree while_stmt)
{
do_poplevel ();
RECHAIN_STMTS (while_stmt, WHILE_BODY (while_stmt));
@@ -357,7 +560,7 @@ finish_while_stmt (while_stmt)
appropriate. */
tree
-begin_do_stmt ()
+begin_do_stmt (void)
{
tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE);
add_stmt (r);
@@ -367,8 +570,7 @@ begin_do_stmt ()
/* Finish the body of a do-statement, which may be given by DO_STMT. */
void
-finish_do_body (do_stmt)
- tree do_stmt;
+finish_do_body (tree do_stmt)
{
RECHAIN_STMTS (do_stmt, DO_BODY (do_stmt));
}
@@ -377,9 +579,7 @@ finish_do_body (do_stmt)
COND is as indicated. */
void
-finish_do_stmt (cond, do_stmt)
- tree cond;
- tree do_stmt;
+finish_do_stmt (tree cond, tree do_stmt)
{
cond = maybe_convert_cond (cond);
DO_COND (do_stmt) = cond;
@@ -390,13 +590,11 @@ finish_do_stmt (cond, do_stmt)
indicated. */
tree
-finish_return_stmt (expr)
- tree expr;
+finish_return_stmt (tree expr)
{
tree r;
- if (!processing_template_decl)
- expr = check_return_expr (expr);
+ expr = check_return_expr (expr);
if (!processing_template_decl)
{
if (DECL_DESTRUCTOR_P (current_function_decl))
@@ -417,7 +615,7 @@ finish_return_stmt (expr)
/* Begin a for-statement. Returns a new FOR_STMT if appropriate. */
tree
-begin_for_stmt ()
+begin_for_stmt (void)
{
tree r;
@@ -425,10 +623,7 @@ begin_for_stmt ()
NULL_TREE, NULL_TREE);
NEW_FOR_SCOPE_P (r) = flag_new_for_scope > 0;
if (NEW_FOR_SCOPE_P (r))
- {
- do_pushlevel ();
- note_level_for_for ();
- }
+ do_pushlevel (sk_for);
add_stmt (r);
return r;
@@ -438,21 +633,18 @@ begin_for_stmt ()
given by FOR_STMT. */
void
-finish_for_init_stmt (for_stmt)
- tree for_stmt;
+finish_for_init_stmt (tree for_stmt)
{
if (last_tree != for_stmt)
RECHAIN_STMTS (for_stmt, FOR_INIT_STMT (for_stmt));
- do_pushlevel ();
+ do_pushlevel (sk_block);
}
/* Finish the COND of a for-statement, which may be given by
FOR_STMT. */
void
-finish_for_cond (cond, for_stmt)
- tree cond;
- tree for_stmt;
+finish_for_cond (tree cond, tree for_stmt)
{
cond = maybe_convert_cond (cond);
if (processing_template_decl)
@@ -484,10 +676,15 @@ finish_for_cond (cond, for_stmt)
given by FOR_STMT. */
void
-finish_for_expr (expr, for_stmt)
- tree expr;
- tree for_stmt;
+finish_for_expr (tree expr, tree for_stmt)
{
+ /* If EXPR is an overloaded function, issue an error; there is no
+ context available to use to perform overload resolution. */
+ if (expr && type_unknown_p (expr))
+ {
+ cxx_incomplete_type_error (expr, TREE_TYPE (expr));
+ expr = error_mark_node;
+ }
FOR_EXPR (for_stmt) = expr;
}
@@ -496,8 +693,7 @@ finish_for_expr (expr, for_stmt)
provided. */
void
-finish_for_stmt (for_stmt)
- tree for_stmt;
+finish_for_stmt (tree for_stmt)
{
/* Pop the scope for the body of the loop. */
do_poplevel ();
@@ -510,7 +706,7 @@ finish_for_stmt (for_stmt)
/* Finish a break-statement. */
tree
-finish_break_stmt ()
+finish_break_stmt (void)
{
return add_stmt (build_break_stmt ());
}
@@ -518,7 +714,7 @@ finish_break_stmt ()
/* Finish a continue-statement. */
tree
-finish_continue_stmt ()
+finish_continue_stmt (void)
{
return add_stmt (build_continue_stmt ());
}
@@ -527,10 +723,10 @@ finish_continue_stmt ()
appropriate. */
tree
-begin_switch_stmt ()
+begin_switch_stmt (void)
{
tree r;
- do_pushlevel ();
+ do_pushlevel (sk_block);
r = build_stmt (SWITCH_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
add_stmt (r);
return r;
@@ -539,9 +735,7 @@ begin_switch_stmt ()
/* Finish the cond of a switch-statement. */
void
-finish_switch_cond (cond, switch_stmt)
- tree cond;
- tree switch_stmt;
+finish_switch_cond (tree cond, tree switch_stmt)
{
tree orig_type = NULL;
if (!processing_template_decl)
@@ -549,7 +743,7 @@ finish_switch_cond (cond, switch_stmt)
tree index;
/* Convert the condition to an integer or enumeration type. */
- cond = build_expr_type_conversion (WANT_INT | WANT_ENUM, cond, 1);
+ cond = build_expr_type_conversion (WANT_INT | WANT_ENUM, cond, true);
if (cond == NULL_TREE)
{
error ("switch quantity not an integer");
@@ -558,7 +752,10 @@ finish_switch_cond (cond, switch_stmt)
orig_type = TREE_TYPE (cond);
if (cond != error_mark_node)
{
- cond = default_conversion (cond);
+ /* [stmt.switch]
+
+ Integral promotions are performed. */
+ cond = perform_integral_promotions (cond);
cond = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (cond), cond));
}
@@ -583,8 +780,7 @@ finish_switch_cond (cond, switch_stmt)
SWITCH_STMT. The COND to switch on is indicated. */
void
-finish_switch_stmt (switch_stmt)
- tree switch_stmt;
+finish_switch_stmt (tree switch_stmt)
{
RECHAIN_STMTS (switch_stmt, SWITCH_BODY (switch_stmt));
pop_switch ();
@@ -595,8 +791,7 @@ finish_switch_stmt (switch_stmt)
/* Generate the RTL for T, which is a TRY_BLOCK. */
static void
-genrtl_try_block (t)
- tree t;
+genrtl_try_block (tree t)
{
if (CLEANUP_P (t))
{
@@ -607,7 +802,7 @@ genrtl_try_block (t)
else
{
if (!FN_TRY_BLOCK_P (t))
- emit_line_note (input_filename, lineno);
+ emit_line_note (input_location);
expand_eh_region_start ();
expand_stmt (TRY_STMTS (t));
@@ -632,8 +827,7 @@ genrtl_try_block (t)
/* Generate the RTL for T, which is an EH_SPEC_BLOCK. */
static void
-genrtl_eh_spec_block (t)
- tree t;
+genrtl_eh_spec_block (tree t)
{
expand_eh_region_start ();
expand_stmt (EH_SPEC_STMTS (t));
@@ -648,7 +842,7 @@ genrtl_eh_spec_block (t)
appropriate. */
tree
-begin_try_block ()
+begin_try_block (void)
{
tree r = build_stmt (TRY_BLOCK, NULL_TREE, NULL_TREE);
add_stmt (r);
@@ -658,7 +852,7 @@ begin_try_block ()
/* Likewise, for a function-try-block. */
tree
-begin_function_try_block ()
+begin_function_try_block (void)
{
tree r = build_stmt (TRY_BLOCK, NULL_TREE, NULL_TREE);
FN_TRY_BLOCK_P (r) = 1;
@@ -669,8 +863,7 @@ begin_function_try_block ()
/* Finish a try-block, which may be given by TRY_BLOCK. */
void
-finish_try_block (try_block)
- tree try_block;
+finish_try_block (tree try_block)
{
RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
}
@@ -679,8 +872,7 @@ finish_try_block (try_block)
TRY_BLOCK. */
void
-finish_cleanup_try_block (try_block)
- tree try_block;
+finish_cleanup_try_block (tree try_block)
{
RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
}
@@ -689,9 +881,7 @@ finish_cleanup_try_block (try_block)
by CLEANUP. */
void
-finish_cleanup (cleanup, try_block)
- tree cleanup;
- tree try_block;
+finish_cleanup (tree cleanup, tree try_block)
{
TRY_HANDLERS (try_block) = cleanup;
CLEANUP_P (try_block) = 1;
@@ -700,8 +890,7 @@ finish_cleanup (cleanup, try_block)
/* Likewise, for a function-try-block. */
void
-finish_function_try_block (try_block)
- tree try_block;
+finish_function_try_block (tree try_block)
{
if (TREE_CHAIN (try_block)
&& TREE_CODE (TREE_CHAIN (try_block)) == CTOR_INITIALIZER)
@@ -720,8 +909,7 @@ finish_function_try_block (try_block)
TRY_BLOCK. */
void
-finish_handler_sequence (try_block)
- tree try_block;
+finish_handler_sequence (tree try_block)
{
RECHAIN_STMTS (try_block, TRY_HANDLERS (try_block));
check_handlers (TRY_HANDLERS (try_block));
@@ -730,8 +918,7 @@ finish_handler_sequence (try_block)
/* Likewise, for a function-try-block. */
void
-finish_function_handler_sequence (try_block)
- tree try_block;
+finish_function_handler_sequence (tree try_block)
{
in_function_try_handler = 0;
RECHAIN_STMTS (try_block, TRY_HANDLERS (try_block));
@@ -741,8 +928,7 @@ finish_function_handler_sequence (try_block)
/* Generate the RTL for T, which is a HANDLER. */
static void
-genrtl_handler (t)
- tree t;
+genrtl_handler (tree t)
{
genrtl_do_pushlevel ();
if (!processing_template_decl)
@@ -755,15 +941,14 @@ genrtl_handler (t)
/* Begin a handler. Returns a HANDLER if appropriate. */
tree
-begin_handler ()
+begin_handler (void)
{
tree r;
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 ();
+ do_pushlevel (sk_catch);
return r;
}
@@ -772,9 +957,7 @@ begin_handler ()
if this is a `catch (...)' clause. */
void
-finish_handler_parms (decl, handler)
- tree decl;
- tree handler;
+finish_handler_parms (tree decl, tree handler)
{
tree type = NULL_TREE;
if (processing_template_decl)
@@ -792,14 +975,15 @@ finish_handler_parms (decl, handler)
type = expand_start_catch_block (decl);
HANDLER_TYPE (handler) = type;
+ if (!processing_template_decl && type)
+ mark_used (eh_type_info (type));
}
/* 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;
+finish_handler (tree handler)
{
if (!processing_template_decl)
expand_end_catch_block ();
@@ -807,13 +991,12 @@ finish_handler (handler)
RECHAIN_STMTS (handler, HANDLER_BODY (handler));
}
-/* Begin a compound-statement. If HAS_NO_SCOPE is nonzero, the
+/* Begin a compound-statement. If HAS_NO_SCOPE is true, the
compound-statement does not define a scope. Returns a new
- COMPOUND_STMT if appropriate. */
+ COMPOUND_STMT. */
tree
-begin_compound_stmt (has_no_scope)
- int has_no_scope;
+begin_compound_stmt (bool has_no_scope)
{
tree r;
int is_try = 0;
@@ -830,37 +1013,29 @@ begin_compound_stmt (has_no_scope)
last_expr_type = NULL_TREE;
if (!has_no_scope)
- {
- do_pushlevel ();
- if (is_try)
- note_level_for_try ();
- }
+ do_pushlevel (is_try ? sk_try : sk_block);
else
/* 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);
+ keep_next_level (false);
return r;
}
-/* Finish a compound-statement, which may be given by COMPOUND_STMT.
- If HAS_NO_SCOPE is nonzero, the compound statement does not define
- a scope. */
+/* Finish a compound-statement, which is given by COMPOUND_STMT. */
tree
-finish_compound_stmt (has_no_scope, compound_stmt)
- int has_no_scope;
- tree compound_stmt;
+finish_compound_stmt (tree compound_stmt)
{
tree r;
tree t;
- if (!has_no_scope)
- r = do_poplevel ();
- else
+ if (COMPOUND_STMT_NO_SCOPE (compound_stmt))
r = NULL_TREE;
+ else
+ r = do_poplevel ();
RECHAIN_STMTS (compound_stmt, COMPOUND_BODY (compound_stmt));
@@ -880,13 +1055,11 @@ finish_compound_stmt (has_no_scope, compound_stmt)
CLOBBERS. */
tree
-finish_asm_stmt (cv_qualifier, string, output_operands,
- input_operands, clobbers)
- tree cv_qualifier;
- tree string;
- tree output_operands;
- tree input_operands;
- tree clobbers;
+finish_asm_stmt (tree cv_qualifier,
+ tree string,
+ tree output_operands,
+ tree input_operands,
+ tree clobbers)
{
tree r;
tree t;
@@ -943,9 +1116,9 @@ finish_asm_stmt (cv_qualifier, string, output_operands,
&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;
+ /* By marking this operand as erroneous, we will not try
+ to process this operand again in expand_asm_operands. */
+ TREE_VALUE (t) = error_mark_node;
continue;
}
@@ -968,12 +1141,11 @@ finish_asm_stmt (cv_qualifier, string, output_operands,
/* Finish a label with the indicated NAME. */
-void
-finish_label_stmt (name)
- tree name;
+tree
+finish_label_stmt (tree name)
{
- tree decl = define_label (input_filename, lineno, name);
- add_stmt (build_stmt (LABEL_STMT, decl));
+ tree decl = define_label (input_location, name);
+ return add_stmt (build_stmt (LABEL_STMT, decl));
}
/* Finish a series of declarations for local labels. G++ allows users
@@ -981,8 +1153,7 @@ finish_label_stmt (name)
is useful when writing code involving statement-expressions. */
void
-finish_label_decl (name)
- tree name;
+finish_label_decl (tree name)
{
tree decl = declare_local_label (name);
add_decl_stmt (decl);
@@ -991,9 +1162,7 @@ finish_label_decl (name)
/* When DECL goes out of scope, make sure that CLEANUP is executed. */
void
-finish_decl_cleanup (decl, cleanup)
- tree decl;
- tree cleanup;
+finish_decl_cleanup (tree decl, tree cleanup)
{
add_stmt (build_stmt (CLEANUP_STMT, decl, cleanup));
}
@@ -1001,105 +1170,13 @@ finish_decl_cleanup (decl, cleanup)
/* If the current scope exits with an exception, run CLEANUP. */
void
-finish_eh_cleanup (cleanup)
- tree cleanup;
+finish_eh_cleanup (tree cleanup)
{
tree r = build_stmt (CLEANUP_STMT, NULL_TREE, cleanup);
CLEANUP_EH_ONLY (r) = 1;
add_stmt (r);
}
-/* 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))
- {
- /* 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, /*rescan=*/true);
- }
-
- 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
- {
- 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;
-}
-
-/* Begin processing a mem-initializer-list. */
-
-void
-begin_mem_initializers ()
-{
- if (! DECL_CONSTRUCTOR_P (current_function_decl))
- error ("only constructors take base initializers");
-}
-
/* The MEM_INITS is a list of mem-initializers, in reverse of the
order they were written by the user. Each node is as for
emit_mem_initializers. */
@@ -1120,7 +1197,7 @@ finish_mem_initializers (tree mem_inits)
/* Returns the stack of SCOPE_STMTs for the current function. */
tree *
-current_scope_stmt_stack ()
+current_scope_stmt_stack (void)
{
return &cfun->language->base.x_scope_stmt_stack;
}
@@ -1128,8 +1205,7 @@ current_scope_stmt_stack ()
/* Finish a parenthesized expression EXPR. */
tree
-finish_parenthesized_expr (expr)
- tree expr;
+finish_parenthesized_expr (tree expr)
{
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
/* This inhibits warnings in c_common_truthvalue_conversion. */
@@ -1142,11 +1218,209 @@ finish_parenthesized_expr (expr)
return expr;
}
+/* Finish a reference to a non-static data member (DECL) that is not
+ preceded by `.' or `->'. */
+
+tree
+finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
+{
+ my_friendly_assert (TREE_CODE (decl) == FIELD_DECL, 20020909);
+
+ if (!object)
+ {
+ if (current_function_decl
+ && DECL_STATIC_FUNCTION_P (current_function_decl))
+ cp_error_at ("invalid use of member `%D' in static member function",
+ decl);
+ else
+ cp_error_at ("invalid use of non-static data member `%D'", decl);
+ error ("from this location");
+
+ return error_mark_node;
+ }
+ TREE_USED (current_class_ptr) = 1;
+ if (processing_template_decl && !qualifying_scope)
+ {
+ tree type = TREE_TYPE (decl);
+
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
+ else
+ {
+ /* Set the cv qualifiers. */
+ int quals = cp_type_quals (TREE_TYPE (current_class_ref));
+
+ if (DECL_MUTABLE_P (decl))
+ quals &= ~TYPE_QUAL_CONST;
+
+ quals |= cp_type_quals (TREE_TYPE (decl));
+ type = cp_build_qualified_type (type, quals);
+ }
+
+ return build_min (COMPONENT_REF, type, object, decl);
+ }
+ else
+ {
+ tree access_type = TREE_TYPE (object);
+ tree lookup_context = context_for_name_lookup (decl);
+
+ while (!DERIVED_FROM_P (lookup_context, access_type))
+ {
+ access_type = TYPE_CONTEXT (access_type);
+ while (access_type && DECL_P (access_type))
+ access_type = DECL_CONTEXT (access_type);
+
+ if (!access_type)
+ {
+ cp_error_at ("object missing in reference to `%D'", decl);
+ error ("from this location");
+ return error_mark_node;
+ }
+ }
+
+ /* If PROCESSING_TEMPLATE_DECL is nonzero here, then
+ QUALIFYING_SCOPE is also non-null. Wrap this in a SCOPE_REF
+ for now. */
+ if (processing_template_decl)
+ return build_min (SCOPE_REF, TREE_TYPE (decl),
+ qualifying_scope, DECL_NAME (decl));
+
+ perform_or_defer_access_check (TYPE_BINFO (access_type), decl);
+
+ /* If the data member was named `C::M', convert `*this' to `C'
+ first. */
+ if (qualifying_scope)
+ {
+ tree binfo = NULL_TREE;
+ object = build_scoped_ref (object, qualifying_scope,
+ &binfo);
+ }
+
+ return build_class_member_access_expr (object, decl,
+ /*access_path=*/NULL_TREE,
+ /*preserve_reference=*/false);
+ }
+}
+
+/* DECL was the declaration to which a qualified-id resolved. Issue
+ an error message if it is not accessible. If OBJECT_TYPE is
+ non-NULL, we have just seen `x->' or `x.' and OBJECT_TYPE is the
+ type of `*x', or `x', respectively. If the DECL was named as
+ `A::B' then NESTED_NAME_SPECIFIER is `A'. */
+
+void
+check_accessibility_of_qualified_id (tree decl,
+ tree object_type,
+ tree nested_name_specifier)
+{
+ tree scope;
+ tree qualifying_type = NULL_TREE;
+
+ /* Determine the SCOPE of DECL. */
+ scope = context_for_name_lookup (decl);
+ /* If the SCOPE is not a type, then DECL is not a member. */
+ if (!TYPE_P (scope))
+ return;
+ /* Compute the scope through which DECL is being accessed. */
+ if (object_type
+ /* OBJECT_TYPE might not be a class type; consider:
+
+ class A { typedef int I; };
+ I *p;
+ p->A::I::~I();
+
+ In this case, we will have "A::I" as the DECL, but "I" as the
+ OBJECT_TYPE. */
+ && CLASS_TYPE_P (object_type)
+ && DERIVED_FROM_P (scope, object_type))
+ /* If we are processing a `->' or `.' expression, use the type of the
+ left-hand side. */
+ qualifying_type = object_type;
+ else if (nested_name_specifier)
+ {
+ /* If the reference is to a non-static member of the
+ current class, treat it as if it were referenced through
+ `this'. */
+ if (DECL_NONSTATIC_MEMBER_P (decl)
+ && current_class_ptr
+ && DERIVED_FROM_P (scope, current_class_type))
+ qualifying_type = current_class_type;
+ /* Otherwise, use the type indicated by the
+ nested-name-specifier. */
+ else
+ qualifying_type = nested_name_specifier;
+ }
+ else
+ /* Otherwise, the name must be from the current class or one of
+ its bases. */
+ qualifying_type = currently_open_derived_class (scope);
+
+ if (qualifying_type)
+ perform_or_defer_access_check (TYPE_BINFO (qualifying_type), decl);
+}
+
+/* EXPR is the result of a qualified-id. The QUALIFYING_CLASS was the
+ class named to the left of the "::" operator. DONE is true if this
+ expression is a complete postfix-expression; it is false if this
+ expression is followed by '->', '[', '(', etc. ADDRESS_P is true
+ iff this expression is the operand of '&'. */
+
+tree
+finish_qualified_id_expr (tree qualifying_class, tree expr, bool done,
+ bool address_p)
+{
+ if (error_operand_p (expr))
+ return error_mark_node;
+
+ /* If EXPR occurs as the operand of '&', use special handling that
+ permits a pointer-to-member. */
+ if (address_p && done)
+ {
+ if (TREE_CODE (expr) == SCOPE_REF)
+ expr = TREE_OPERAND (expr, 1);
+ expr = build_offset_ref (qualifying_class, expr,
+ /*address_p=*/true);
+ return expr;
+ }
+
+ if (TREE_CODE (expr) == FIELD_DECL)
+ expr = finish_non_static_data_member (expr, current_class_ref,
+ qualifying_class);
+ else if (BASELINK_P (expr) && !processing_template_decl)
+ {
+ tree fn;
+ tree fns;
+
+ /* See if any of the functions are non-static members. */
+ fns = BASELINK_FUNCTIONS (expr);
+ if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
+ fns = TREE_OPERAND (fns, 0);
+ for (fn = fns; fn; fn = OVL_NEXT (fn))
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+ break;
+ /* If so, the expression may be relative to the current
+ class. */
+ if (fn && current_class_type
+ && DERIVED_FROM_P (qualifying_class, current_class_type))
+ expr = (build_class_member_access_expr
+ (maybe_dummy_object (qualifying_class, NULL),
+ expr,
+ BASELINK_ACCESS_BINFO (expr),
+ /*preserve_reference=*/false));
+ else if (done)
+ /* The expression is a qualified name whose address is not
+ being taken. */
+ expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false);
+ }
+
+ return expr;
+}
+
/* Begin a statement-expression. The value returned must be passed to
finish_stmt_expr. */
tree
-begin_stmt_expr ()
+begin_stmt_expr (void)
{
/* 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
@@ -1154,61 +1428,102 @@ begin_stmt_expr ()
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. */
+ last_expr_type = NULL_TREE;
+
+ keep_next_level (true);
+
return last_tree;
}
-/* Used when beginning a statement-expression outside function scope.
- For example, when handling a file-scope initializer, we use this
- function. */
+/* Process the final expression of a statement expression. EXPR can be
+ NULL, if the final expression is empty. Build up a TARGET_EXPR so
+ that the result value can be safely returned to the enclosing
+ expression. */
tree
-begin_global_stmt_expr ()
+finish_stmt_expr_expr (tree expr)
{
- if (! cfun && !last_tree)
- begin_stmt_tree (&scope_chain->x_saved_tree);
-
- keep_next_level (1);
-
- return last_tree ? last_tree : expand_start_stmt_expr(/*has_scope=*/1);
-}
+ tree result = NULL_TREE;
+ tree type = void_type_node;
-/* Finish the STMT_EXPR last begun with begin_global_stmt_expr. */
+ if (expr)
+ {
+ type = TREE_TYPE (expr);
+
+ if (!processing_template_decl && !VOID_TYPE_P (TREE_TYPE (expr)))
+ {
+ if (TREE_CODE (type) == ARRAY_TYPE
+ || TREE_CODE (type) == FUNCTION_TYPE)
+ expr = decay_conversion (expr);
+
+ expr = convert_from_reference (expr);
+ expr = require_complete_type (expr);
+
+ /* Build a TARGET_EXPR for this aggregate. finish_stmt_expr
+ will then pull it apart so the lifetime of the target is
+ within the scope of the expression containing this statement
+ expression. */
+ if (TREE_CODE (expr) == TARGET_EXPR)
+ ;
+ else if (!IS_AGGR_TYPE (type) || TYPE_HAS_TRIVIAL_INIT_REF (type))
+ expr = build_target_expr_with_type (expr, type);
+ else
+ {
+ /* Copy construct. */
+ expr = build_special_member_call
+ (NULL_TREE, complete_ctor_identifier,
+ build_tree_list (NULL_TREE, expr),
+ TYPE_BINFO (type), LOOKUP_NORMAL);
+ expr = build_cplus_new (type, expr);
+ my_friendly_assert (TREE_CODE (expr) == TARGET_EXPR, 20030729);
+ }
+ }
-tree
-finish_global_stmt_expr (stmt_expr)
- tree stmt_expr;
-{
- stmt_expr = expand_end_stmt_expr (stmt_expr);
+ if (expr != error_mark_node)
+ {
+ result = build_stmt (EXPR_STMT, expr);
+ add_stmt (result);
+ }
+ }
- if (! cfun
- && TREE_CHAIN (scope_chain->x_saved_tree) == NULL_TREE)
- finish_stmt_tree (&scope_chain->x_saved_tree);
+ finish_stmt ();
- return stmt_expr;
+ /* Remember the last expression so that finish_stmt_expr can pull it
+ apart. */
+ last_expr_type = result ? result : void_type_node;
+
+ return result;
}
-/* Finish a statement-expression. RTL_EXPR should be the value
- returned by the previous begin_stmt_expr; EXPR is the
- statement-expression. Returns an expression representing the
- statement-expression. */
+/* Finish a statement-expression. EXPR should be the value returned
+ by the previous begin_stmt_expr. Returns an expression
+ representing the statement-expression. */
tree
-finish_stmt_expr (rtl_expr)
- tree rtl_expr;
+finish_stmt_expr (tree rtl_expr, bool has_no_scope)
{
tree result;
-
- /* If the last thing in the statement-expression was not an
- expression-statement, then it has type `void'. */
+ tree result_stmt = last_expr_type;
+ tree type;
+
if (!last_expr_type)
- last_expr_type = void_type_node;
- result = build_min (STMT_EXPR, last_expr_type, last_tree);
+ type = void_type_node;
+ else
+ {
+ if (result_stmt == void_type_node)
+ {
+ type = void_type_node;
+ result_stmt = NULL_TREE;
+ }
+ else
+ type = TREE_TYPE (EXPR_STMT_EXPR (result_stmt));
+ }
+
+ result = build_min (STMT_EXPR, type, last_tree);
TREE_SIDE_EFFECTS (result) = 1;
+ STMT_EXPR_NO_SCOPE (result) = has_no_scope;
+
+ last_expr_type = NULL_TREE;
/* Remove the compound statement from the tree structure; it is
now saved in the STMT_EXPR. */
@@ -1221,9 +1536,67 @@ finish_stmt_expr (rtl_expr)
&& TREE_CHAIN (scope_chain->x_saved_tree) == NULL_TREE)
finish_stmt_tree (&scope_chain->x_saved_tree);
+ if (processing_template_decl)
+ return result;
+
+ if (!VOID_TYPE_P (type))
+ {
+ /* Pull out the TARGET_EXPR that is the final expression. Put
+ the target's init_expr as the final expression and then put
+ the statement expression itself as the target's init
+ expr. Finally, return the target expression. */
+ tree last_expr = EXPR_STMT_EXPR (result_stmt);
+
+ my_friendly_assert (TREE_CODE (last_expr) == TARGET_EXPR, 20030729);
+ EXPR_STMT_EXPR (result_stmt) = TREE_OPERAND (last_expr, 1);
+ TREE_OPERAND (last_expr, 1) = result;
+ result = last_expr;
+ }
return result;
}
+/* Perform Koenig lookup. FN is the postfix-expression representing
+ the function (or functions) to call; ARGS are the arguments to the
+ call. Returns the functions to be considered by overload
+ resolution. */
+
+tree
+perform_koenig_lookup (tree fn, tree args)
+{
+ tree identifier = NULL_TREE;
+ tree functions = NULL_TREE;
+
+ /* Find the name of the overloaded function. */
+ if (TREE_CODE (fn) == IDENTIFIER_NODE)
+ identifier = fn;
+ else if (is_overloaded_fn (fn))
+ {
+ functions = fn;
+ identifier = DECL_NAME (get_first_fn (functions));
+ }
+ else if (DECL_P (fn))
+ {
+ functions = fn;
+ identifier = DECL_NAME (fn);
+ }
+
+ /* A call to a namespace-scope function using an unqualified name.
+
+ Do Koenig lookup -- unless any of the arguments are
+ type-dependent. */
+ if (!any_type_dependent_arguments_p (args))
+ {
+ fn = lookup_arg_dependent (identifier, functions, args);
+ if (!fn)
+ /* The unqualified name could not be resolved. */
+ fn = unqualified_fn_lookup_error (identifier);
+ }
+ else
+ fn = identifier;
+
+ return fn;
+}
+
/* Generate an expression for `FN (ARGS)'.
If DISALLOW_VIRTUAL is true, the call to FN will be not generated
@@ -1235,18 +1608,60 @@ finish_stmt_expr (rtl_expr)
Returns code for the call. */
tree
-finish_call_expr (tree fn, tree args, bool disallow_virtual)
+finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p)
{
+ tree result;
+ tree orig_fn;
+ tree orig_args;
+
if (fn == error_mark_node || args == error_mark_node)
return error_mark_node;
- if (processing_template_decl)
- return build_nt (CALL_EXPR, fn, args, NULL_TREE);
-
/* ARGS should be a list of arguments. */
my_friendly_assert (!args || TREE_CODE (args) == TREE_LIST,
20020712);
+ orig_fn = fn;
+ orig_args = args;
+
+ if (processing_template_decl)
+ {
+ if (type_dependent_expression_p (fn)
+ || any_type_dependent_arguments_p (args))
+ {
+ result = build_nt (CALL_EXPR, fn, args);
+ KOENIG_LOOKUP_P (result) = koenig_p;
+ return result;
+ }
+ if (!BASELINK_P (fn)
+ && TREE_CODE (fn) != PSEUDO_DTOR_EXPR
+ && TREE_TYPE (fn) != unknown_type_node)
+ fn = build_non_dependent_expr (fn);
+ args = build_non_dependent_args (orig_args);
+ }
+
+ /* A reference to a member function will appear as an overloaded
+ function (rather than a BASELINK) if an unqualified name was used
+ to refer to it. */
+ if (!BASELINK_P (fn) && is_overloaded_fn (fn))
+ {
+ tree f = fn;
+
+ if (TREE_CODE (f) == TEMPLATE_ID_EXPR)
+ f = TREE_OPERAND (f, 0);
+ f = get_first_fn (f);
+ if (DECL_FUNCTION_MEMBER_P (f))
+ {
+ tree type = currently_open_derived_class (DECL_CONTEXT (f));
+ if (!type)
+ type = DECL_CONTEXT (f);
+ fn = build_baselink (TYPE_BINFO (type),
+ TYPE_BINFO (type),
+ fn, /*optype=*/NULL_TREE);
+ }
+ }
+
+ result = NULL_TREE;
if (BASELINK_P (fn))
{
tree object;
@@ -1286,25 +1701,46 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual)
object = build_dummy_object (DECL_CONTEXT (representative_fn));
}
- return build_new_method_call (object, fn, args, NULL_TREE,
- (disallow_virtual
- ? LOOKUP_NONVIRTUAL : 0));
+ if (processing_template_decl)
+ {
+ if (type_dependent_expression_p (object))
+ return build_nt (CALL_EXPR, orig_fn, orig_args);
+ object = build_non_dependent_expr (object);
+ }
+
+ result = build_new_method_call (object, fn, args, NULL_TREE,
+ (disallow_virtual
+ ? LOOKUP_NONVIRTUAL : 0));
}
else if (is_overloaded_fn (fn))
/* A call to a namespace-scope function. */
- return build_new_function_call (fn, args);
- else if (CLASS_TYPE_P (TREE_TYPE (fn)))
+ result = build_new_function_call (fn, args);
+ else if (TREE_CODE (fn) == PSEUDO_DTOR_EXPR)
{
- /* If the "function" is really an object of class type, it might
- have an overloaded `operator ()'. */
- tree result;
- result = build_opfncall (CALL_EXPR, LOOKUP_NORMAL, fn, args, NULL_TREE);
- if (result)
- return result;
+ if (args)
+ error ("arguments to destructor are not allowed");
+ /* Mark the pseudo-destructor call as having side-effects so
+ that we do not issue warnings about its use. */
+ result = build1 (NOP_EXPR,
+ void_type_node,
+ TREE_OPERAND (fn, 0));
+ TREE_SIDE_EFFECTS (result) = 1;
}
+ else if (CLASS_TYPE_P (TREE_TYPE (fn)))
+ /* If the "function" is really an object of class type, it might
+ have an overloaded `operator ()'. */
+ result = build_new_op (CALL_EXPR, LOOKUP_NORMAL, fn, args, NULL_TREE,
+ /*overloaded_p=*/NULL);
+ if (!result)
+ /* A call where the function is unknown. */
+ result = build_function_call (fn, args);
- /* A call where the function is unknown. */
- return build_function_call (fn, args);
+ if (processing_template_decl)
+ {
+ result = build (CALL_EXPR, TREE_TYPE (result), orig_fn, orig_args);
+ KOENIG_LOOKUP_P (result) = koenig_p;
+ }
+ return result;
}
/* Finish a call to a postfix increment or decrement or EXPR. (Which
@@ -1312,24 +1748,15 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual)
POSTDECREMENT_EXPR.) */
tree
-finish_increment_expr (expr, code)
- tree expr;
- enum tree_code code;
+finish_increment_expr (tree expr, enum tree_code code)
{
- /* If we get an OFFSET_REF, turn it into what it really means (e.g.,
- a COMPONENT_REF). This way if we've got, say, a reference to a
- static member that's being operated on, we don't end up trying to
- find a member operator for the class it's in. */
-
- if (TREE_CODE (expr) == OFFSET_REF)
- expr = resolve_offset_ref (expr);
return build_x_unary_op (code, expr);
}
/* Finish a use of `this'. Returns an expression for `this'. */
tree
-finish_this_expr ()
+finish_this_expr (void)
{
tree result;
@@ -1355,84 +1782,55 @@ finish_this_expr ()
return result;
}
-/* Finish a member function call using OBJECT and ARGS as arguments to
- FN. Returns an expression for the call. */
+/* Finish a pseudo-destructor expression. If SCOPE is NULL, the
+ expression was of the form `OBJECT.~DESTRUCTOR' where DESTRUCTOR is
+ the TYPE for the type given. If SCOPE is non-NULL, the expression
+ was of the form `OBJECT.SCOPE::~DESTRUCTOR'. */
tree
-finish_object_call_expr (fn, object, args)
- tree fn;
- tree object;
- tree args;
+finish_pseudo_destructor_expr (tree object, tree scope, tree destructor)
{
- if (DECL_DECLARES_TYPE_P (fn))
- {
- if (processing_template_decl)
- /* This can happen on code like:
+ if (destructor == error_mark_node)
+ return error_mark_node;
- class X;
- template <class T> void f(T t) {
- t.X();
- }
+ my_friendly_assert (TYPE_P (destructor), 20010905);
- We just grab the underlying IDENTIFIER. */
- fn = DECL_NAME (fn);
- else
+ if (!processing_template_decl)
+ {
+ if (scope == error_mark_node)
{
- error ("calling type `%T' like a method", fn);
+ error ("invalid qualifying scope in pseudo-destructor name");
return error_mark_node;
}
- }
-
- if (processing_template_decl || name_p (fn))
- return build_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
- else
- return build_new_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
-}
-
-/* Finish a qualified member function call using OBJECT and ARGS as
- arguments to FN. Returns an expression for the call. */
-
-tree
-finish_qualified_object_call_expr (fn, object, args)
- tree fn;
- tree object;
- tree args;
-{
- return build_scoped_method_call (object, TREE_OPERAND (fn, 0),
- TREE_OPERAND (fn, 1), args);
-}
+
+ /* [expr.pseudo] says both:
-/* Finish a pseudo-destructor call expression of OBJECT, with SCOPE
- being the scope, if any, of DESTRUCTOR. Returns an expression for
- the call. */
+ The type designated by the pseudo-destructor-name shall be
+ the same as the object type.
-tree
-finish_pseudo_destructor_call_expr (object, scope, destructor)
- tree object;
- tree scope;
- tree destructor;
-{
- if (processing_template_decl)
- return build_min_nt (PSEUDO_DTOR_EXPR, object, scope, destructor);
+ and:
- if (scope && scope != destructor)
- error ("destructor specifier `%T::~%T()' must have matching names",
- scope, destructor);
+ The cv-unqualified versions of the object type and of the
+ type designated by the pseudo-destructor-name shall be the
+ same type.
- if ((scope == NULL_TREE || IDENTIFIER_GLOBAL_VALUE (destructor))
- && (TREE_CODE (TREE_TYPE (object)) !=
- TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (destructor)))))
- error ("`%E' is not of type `%T'", object, destructor);
+ We implement the more generous second sentence, since that is
+ what most other compilers do. */
+ if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (object),
+ destructor))
+ {
+ error ("`%E' is not of type `%T'", object, destructor);
+ return error_mark_node;
+ }
+ }
- return cp_convert (void_type_node, object);
+ return build (PSEUDO_DTOR_EXPR, void_type_node, object, scope, destructor);
}
/* Finish an expression of the form CODE EXPR. */
tree
-finish_unary_op_expr (code, expr)
- enum tree_code code;
- tree expr;
+finish_unary_op_expr (enum tree_code code, tree expr)
{
tree result = build_x_unary_op (code, expr);
/* Inside a template, build_x_unary_op does not fold the
@@ -1447,18 +1845,35 @@ finish_unary_op_expr (code, expr)
return result;
}
-/* Finish an id-expression. */
+/* Finish a compound-literal expression. TYPE is the type to which
+ the INITIALIZER_LIST is being cast. */
tree
-finish_id_expr (expr)
- tree expr;
+finish_compound_literal (tree type, tree initializer_list)
{
- if (TREE_CODE (expr) == IDENTIFIER_NODE)
- expr = do_identifier (expr, 1, NULL_TREE);
+ tree compound_literal;
- if (TREE_TYPE (expr) == error_mark_node)
- expr = error_mark_node;
- return expr;
+ /* Build a CONSTRUCTOR for the INITIALIZER_LIST. */
+ compound_literal = build_constructor (NULL_TREE, initializer_list);
+ /* Mark it as a compound-literal. */
+ TREE_HAS_CONSTRUCTOR (compound_literal) = 1;
+ if (processing_template_decl)
+ TREE_TYPE (compound_literal) = type;
+ else
+ {
+ /* Check the initialization. */
+ compound_literal = digest_init (type, compound_literal, NULL);
+ /* If the TYPE was an array type with an unknown bound, then we can
+ figure out the dimension now. For example, something like:
+
+ `(int []) { 2, 3 }'
+
+ implies that the array has two elements. */
+ if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
+ complete_array_type (type, compound_literal, 1);
+ }
+
+ return compound_literal;
}
/* Return the declaration for the function-name variable indicated by
@@ -1471,83 +1886,20 @@ finish_fname (tree id)
decl = fname_decl (C_RID_CODE (id), id);
if (processing_template_decl)
- decl = build_min_nt (LOOKUP_EXPR, DECL_NAME (decl));
+ decl = DECL_NAME (decl);
return decl;
}
-static tree current_type_lookups;
-
-/* Perform deferred access control for types used in the type of a
- declaration. */
-
-static void
-deferred_type_access_control ()
-{
- tree lookup = type_lookups;
-
- if (lookup == error_mark_node)
- return;
-
- for (; lookup; lookup = TREE_CHAIN (lookup))
- enforce_access (TREE_PURPOSE (lookup), TREE_VALUE (lookup));
-}
-
-void
-decl_type_access_control (decl)
- tree decl;
-{
- tree save_fn;
-
- 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;
-}
-
-void
-save_type_access_control (lookups)
- tree lookups;
-{
- current_type_lookups = lookups;
-}
-
-/* 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, ATTRIBUTES,
and DECLARATOR. Returns nonzero if the function-declaration is
valid. */
int
-begin_function_definition (decl_specs, attributes, declarator)
- tree decl_specs;
- tree attributes;
- tree declarator;
+begin_function_definition (tree decl_specs, tree attributes, tree declarator)
{
if (!start_function (decl_specs, declarator, attributes, SF_DEFAULT))
return 0;
- 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 ();
@@ -1555,38 +1907,10 @@ begin_function_definition (decl_specs, attributes, declarator)
return 1;
}
-/* Begin a constructor declarator of the form `SCOPE::NAME'. Returns
- a SCOPE_REF. */
-
-tree
-begin_constructor_declarator (scope, name)
- tree scope;
- tree name;
-{
- tree result = build_nt (SCOPE_REF, scope, name);
- enter_scope_of (result);
- return result;
-}
-
-/* Finish an init-declarator. Returns a DECL. */
-
-tree
-finish_declarator (declarator, declspecs, attributes,
- prefix_attributes, initialized)
- tree declarator;
- tree declspecs;
- tree attributes;
- tree prefix_attributes;
- int initialized;
-{
- return start_decl (declarator, declspecs, initialized, attributes,
- prefix_attributes);
-}
-
/* Finish a translation unit. */
void
-finish_translation_unit ()
+finish_translation_unit (void)
{
/* In case there were missing closebraces,
get us back to the global binding level. */
@@ -1596,17 +1920,13 @@ finish_translation_unit ()
/* Do file scope __FUNCTION__ et al. */
finish_fname_decls ();
-
- finish_file ();
}
/* Finish a template type parameter, specified as AGGR IDENTIFIER.
Returns the parameter. */
tree
-finish_template_type_parm (aggr, identifier)
- tree aggr;
- tree identifier;
+finish_template_type_parm (tree aggr, tree identifier)
{
if (aggr != class_type_node)
{
@@ -1621,9 +1941,7 @@ finish_template_type_parm (aggr, identifier)
Returns the parameter. */
tree
-finish_template_template_parm (aggr, identifier)
- tree aggr;
- tree identifier;
+finish_template_template_parm (tree aggr, tree identifier)
{
tree decl = build_decl (TYPE_DECL, identifier, NULL_TREE);
tree tmpl = build_lang_decl (TEMPLATE_DECL, identifier, NULL_TREE);
@@ -1646,10 +1964,24 @@ check_template_template_default_arg (tree argument)
{
if (TREE_CODE (argument) != TEMPLATE_DECL
&& TREE_CODE (argument) != TEMPLATE_TEMPLATE_PARM
- && TREE_CODE (argument) != TYPE_DECL
&& TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
{
- error ("invalid default template argument");
+ if (TREE_CODE (argument) == TYPE_DECL)
+ {
+ tree t = TREE_TYPE (argument);
+
+ /* Try to emit a slightly smarter error message if we detect
+ that the user is using a template instantiation. */
+ if (CLASSTYPE_TEMPLATE_INFO (t)
+ && CLASSTYPE_TEMPLATE_INSTANTIATION (t))
+ error ("invalid use of type `%T' as a default value for a "
+ "template template-parameter", t);
+ else
+ error ("invalid use of `%D' as a default value for a template "
+ "template-parameter", argument);
+ }
+ else
+ error ("invalid default argument for a template template parameter");
return error_mark_node;
}
@@ -1660,9 +1992,7 @@ check_template_template_default_arg (tree argument)
nonzero, the parameter list was terminated by a `...'. */
tree
-finish_parmlist (parms, ellipsis)
- tree parms;
- int ellipsis;
+finish_parmlist (tree parms, int ellipsis)
{
if (parms)
{
@@ -1679,26 +2009,16 @@ finish_parmlist (parms, ellipsis)
/* Begin a class definition, as indicated by T. */
tree
-begin_class_definition (t)
- tree t;
+begin_class_definition (tree t)
{
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 (processing_template_parmlist)
{
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. */
- if (IMPLICIT_TYPENAME_P (t))
- t = TREE_TYPE (t);
/* A non-implicit typename comes from code like:
template <typename T> struct A {
@@ -1717,61 +2037,17 @@ begin_class_definition (t)
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:
-
- template <class T, class U>
- struct Y {};
-
- template <class T>
- struct X {};
-
- template <class T, class U>
- void f()
- {
- typename X<Y<T, U> >::A a;
- }
-
- template <class T, class U>
- struct X<Y<T, U> >
- {
- };
-
- We have to undo the effects of the previous partial
- instantiation. */
- if (PARTIAL_INSTANTIATION_P (t))
- {
- if (!pedantic)
- {
- /* Unfortunately, when we're not in pedantic mode, we
- attempt to actually fill in some of the fields of the
- partial instantiation, in order to support the implicit
- typename extension. Clear those fields now, in
- preparation for the definition here. The fields cleared
- here must match those set in instantiate_class_template.
- Look for a comment mentioning begin_class_definition
- there. */
- TYPE_BINFO_BASETYPES (t) = NULL_TREE;
- TYPE_FIELDS (t) = NULL_TREE;
- TYPE_METHODS (t) = NULL_TREE;
- CLASSTYPE_DECL_LIST (t) = NULL_TREE;
- CLASSTYPE_NESTED_UDTS (t) = NULL;
- CLASSTYPE_VBASECLASSES (t) = NULL_TREE;
- TYPE_SIZE (t) = NULL_TREE;
- }
-
- /* This isn't a partial instantiation any more. */
- PARTIAL_INSTANTIATION_P (t) = 0;
- }
/* If this type was already complete, and we see another definition,
that's an error. */
- else if (COMPLETE_TYPE_P (t))
- duplicate_tag_error (t);
+ if (COMPLETE_TYPE_P (t))
+ {
+ error ("redefinition of `%#T'", t);
+ cp_error_at ("previous definition of `%#T'", t);
+ return error_mark_node;
+ }
/* Update the location of the decl. */
- DECL_SOURCE_FILE (TYPE_NAME (t)) = input_filename;
- DECL_SOURCE_LINE (TYPE_NAME (t)) = lineno;
+ DECL_SOURCE_LOCATION (TYPE_NAME (t)) = input_location;
if (TYPE_BEING_DEFINED (t))
{
@@ -1779,9 +2055,18 @@ begin_class_definition (t)
pushtag (TYPE_IDENTIFIER (t), t, 0);
}
maybe_process_partial_specialization (t);
- pushclass (t, 1);
+ pushclass (t);
TYPE_BEING_DEFINED (t) = 1;
- TYPE_PACKED (t) = flag_pack_struct;
+ if (flag_pack_struct)
+ {
+ tree v;
+ TYPE_PACKED (t) = 1;
+ /* Even though the type is being defined for the first time
+ here, there might have been a forward declaration, so there
+ might be cv-qualified variants of T. */
+ for (v = TYPE_NEXT_VARIANT (t); v; v = TYPE_NEXT_VARIANT (v))
+ TYPE_PACKED (v) = 1;
+ }
/* Reset the interface data, at the earliest possible
moment, as it might have been set via a class foo;
before. */
@@ -1802,8 +2087,7 @@ begin_class_definition (t)
/* Finish the member declaration given by DECL. */
void
-finish_member_declaration (decl)
- tree decl;
+finish_member_declaration (tree decl)
{
if (decl == error_mark_node || decl == NULL_TREE)
return;
@@ -1854,7 +2138,8 @@ finish_member_declaration (decl)
/*friend_p=*/0);
}
/* Enter the DECL into the scope of the class. */
- else if (TREE_CODE (decl) == USING_DECL || pushdecl_class_level (decl))
+ else if ((TREE_CODE (decl) == USING_DECL && TREE_TYPE (decl))
+ || pushdecl_class_level (decl))
{
/* All TYPE_DECLs go at the end of TYPE_FIELDS. Ordinary fields
go at the beginning. The reason is that lookup_field_1
@@ -1887,65 +2172,11 @@ finish_member_declaration (decl)
}
}
-/* Finish a class definition T with the indicate ATTRIBUTES. If SEMI,
- the definition is immediately followed by a semicolon. Returns the
- type. */
-
-tree
-finish_class_definition (t, attributes, semi, pop_scope_p)
- tree t;
- tree attributes;
- 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)
- note_got_semicolon (t);
-
- /* If we got any attributes in class_head, xref_tag will stick them in
- TREE_TYPE of the type. Grab them now. */
- attributes = chainon (TYPE_ATTRIBUTES (t), attributes);
- TYPE_ATTRIBUTES (t) = NULL_TREE;
-
- if (TREE_CODE (t) == ENUMERAL_TYPE)
- ;
- else
- {
- t = finish_struct (t, attributes);
- if (semi)
- note_got_semicolon (t);
- }
-
- if (! semi)
- check_for_missing_semicolon (t);
- if (pop_scope_p)
- pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (t)));
- if (current_scope () == current_function_decl)
- do_pending_defargs ();
-
- return t;
-}
-
-/* Finish processing the default argument expressions cached during
- the processing of a class definition. */
-
-void
-begin_inline_definitions ()
-{
- if (current_scope () == current_function_decl)
- do_pending_inlines ();
-}
-
/* Finish processing the declaration of a member class template
TYPES whose template parameters are given by PARMS. */
tree
-finish_member_class_template (types)
- tree types;
+finish_member_class_template (tree types)
{
tree t;
@@ -1956,7 +2187,6 @@ finish_member_class_template (types)
if (IS_AGGR_TYPE_CODE (TREE_CODE (TREE_VALUE (t))))
maybe_process_partial_specialization (TREE_VALUE (t));
- note_list_got_semicolon (types);
grok_x_components (types);
if (TYPE_CONTEXT (TREE_VALUE (types)) != current_class_type)
/* The component was in fact a friend declaration. We avoid
@@ -1976,8 +2206,7 @@ finish_member_class_template (types)
the template parameters. */
void
-finish_template_decl (parms)
- tree parms;
+finish_template_decl (tree parms)
{
if (parms)
end_template_decl ();
@@ -1991,50 +2220,19 @@ finish_template_decl (parms)
the scope of template-id indicated. */
tree
-finish_template_type (name, args, entering_scope)
- tree name;
- tree args;
- int entering_scope;
+finish_template_type (tree name, tree args, int entering_scope)
{
tree decl;
decl = lookup_template_class (name, args,
- NULL_TREE, NULL_TREE,
- entering_scope, /*complain=*/1);
+ NULL_TREE, NULL_TREE, entering_scope,
+ tf_error | tf_warning | tf_user);
if (decl != error_mark_node)
decl = TYPE_STUB_DECL (decl);
return decl;
}
-/* SR is a SCOPE_REF node. Enter the scope of SR, whether it is a
- namespace scope or a class scope. */
-
-void
-enter_scope_of (sr)
- tree sr;
-{
- tree scope = TREE_OPERAND (sr, 0);
-
- if (TREE_CODE (scope) == NAMESPACE_DECL)
- {
- push_decl_namespace (scope);
- TREE_COMPLEXITY (sr) = -1;
- }
- else if (scope != current_class_type)
- {
- if (TREE_CODE (scope) == TYPENAME_TYPE)
- {
- /* In a declarator for a template class member, the scope will
- get here as an implicit typename, a TYPENAME_TYPE with a type. */
- scope = TREE_TYPE (scope);
- TREE_OPERAND (sr, 0) = scope;
- }
- push_nested_class (scope, 3);
- TREE_COMPLEXITY (sr) = current_class_depth;
- }
-}
-
/* 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
@@ -2042,37 +2240,36 @@ enter_scope_of (sr)
access_{default,public,protected_private}[_virtual]_node.*/
tree
-finish_base_specifier (access_specifier, base_class)
- tree access_specifier;
- tree base_class;
+finish_base_specifier (tree base, tree access, bool virtual_p)
{
tree result;
- if (base_class == error_mark_node)
+ if (base == error_mark_node)
{
error ("invalid base-class specification");
result = NULL_TREE;
}
- else if (! is_aggr_type (base_class, 1))
+ else if (! is_aggr_type (base, 1))
result = NULL_TREE;
else
{
- if (cp_type_quals (base_class) != 0)
+ if (cp_type_quals (base) != 0)
{
- error ("base class `%T' has cv qualifiers", base_class);
- base_class = TYPE_MAIN_VARIANT (base_class);
+ error ("base class `%T' has cv qualifiers", base);
+ base = TYPE_MAIN_VARIANT (base);
}
- result = build_tree_list (access_specifier, base_class);
+ result = build_tree_list (access, base);
+ TREE_VIA_VIRTUAL (result) = virtual_p;
}
return result;
}
/* Called when multiple declarators are processed. If that is not
- premitted in this context, an error is issued. */
+ permitted in this context, an error is issued. */
void
-check_multiple_declarators ()
+check_multiple_declarators (void)
{
/* [temp]
@@ -2093,16 +2290,420 @@ check_multiple_declarators ()
error ("multiple declarators in template declaration");
}
+/* Issue a diagnostic that NAME cannot be found in SCOPE. */
+
+void
+qualified_name_lookup_error (tree scope, tree name)
+{
+ if (TYPE_P (scope))
+ {
+ if (!COMPLETE_TYPE_P (scope))
+ error ("incomplete type `%T' used in nested name specifier", scope);
+ else
+ error ("`%D' is not a member of `%T'", name, scope);
+ }
+ else if (scope != global_namespace)
+ error ("`%D' is not a member of `%D'", name, scope);
+ else
+ error ("`::%D' has not been declared", name);
+}
+
+/* ID_EXPRESSION is a representation of parsed, but unprocessed,
+ id-expression. (See cp_parser_id_expression for details.) SCOPE,
+ if non-NULL, is the type or namespace used to explicitly qualify
+ ID_EXPRESSION. DECL is the entity to which that name has been
+ resolved.
+
+ *CONSTANT_EXPRESSION_P is true if we are presently parsing a
+ constant-expression. In that case, *NON_CONSTANT_EXPRESSION_P will
+ be set to true if this expression isn't permitted in a
+ constant-expression, but it is otherwise not set by this function.
+ *ALLOW_NON_CONSTANT_EXPRESSION_P is true if we are parsing a
+ constant-expression, but a non-constant expression is also
+ permissible.
+
+ If an error occurs, and it is the kind of error that might cause
+ the parser to abort a tentative parse, *ERROR_MSG is filled in. It
+ is the caller's responsibility to issue the message. *ERROR_MSG
+ will be a string with static storage duration, so the caller need
+ not "free" it.
+
+ Return an expression for the entity, after issuing appropriate
+ diagnostics. This function is also responsible for transforming a
+ reference to a non-static member into a COMPONENT_REF that makes
+ the use of "this" explicit.
+
+ Upon return, *IDK will be filled in appropriately. */
+
+tree
+finish_id_expression (tree id_expression,
+ tree decl,
+ tree scope,
+ cp_id_kind *idk,
+ tree *qualifying_class,
+ bool integral_constant_expression_p,
+ bool allow_non_integral_constant_expression_p,
+ bool *non_integral_constant_expression_p,
+ const char **error_msg)
+{
+ /* Initialize the output parameters. */
+ *idk = CP_ID_KIND_NONE;
+ *error_msg = NULL;
+
+ if (id_expression == error_mark_node)
+ return error_mark_node;
+ /* If we have a template-id, then no further lookup is
+ required. If the template-id was for a template-class, we
+ will sometimes have a TYPE_DECL at this point. */
+ else if (TREE_CODE (decl) == TEMPLATE_ID_EXPR
+ || TREE_CODE (decl) == TYPE_DECL)
+ ;
+ /* Look up the name. */
+ else
+ {
+ if (decl == error_mark_node)
+ {
+ /* Name lookup failed. */
+ if (scope
+ && (!TYPE_P (scope)
+ || (!dependent_type_p (scope)
+ && !(TREE_CODE (id_expression) == IDENTIFIER_NODE
+ && IDENTIFIER_TYPENAME_P (id_expression)
+ && dependent_type_p (TREE_TYPE (id_expression))))))
+ {
+ /* If the qualifying type is non-dependent (and the name
+ does not name a conversion operator to a dependent
+ type), issue an error. */
+ qualified_name_lookup_error (scope, id_expression);
+ return error_mark_node;
+ }
+ else if (!scope)
+ {
+ /* It may be resolved via Koenig lookup. */
+ *idk = CP_ID_KIND_UNQUALIFIED;
+ return id_expression;
+ }
+ else
+ decl = id_expression;
+ }
+ /* If DECL is a variable that would be out of scope under
+ ANSI/ISO rules, but in scope in the ARM, name lookup
+ will succeed. Issue a diagnostic here. */
+ else
+ decl = check_for_out_of_scope_variable (decl);
+
+ /* Remember that the name was used in the definition of
+ the current class so that we can check later to see if
+ the meaning would have been different after the class
+ was entirely defined. */
+ if (!scope && decl != error_mark_node)
+ maybe_note_name_used_in_class (id_expression, decl);
+ }
+
+ /* If we didn't find anything, or what we found was a type,
+ then this wasn't really an id-expression. */
+ if (TREE_CODE (decl) == TEMPLATE_DECL
+ && !DECL_FUNCTION_TEMPLATE_P (decl))
+ {
+ *error_msg = "missing template arguments";
+ return error_mark_node;
+ }
+ else if (TREE_CODE (decl) == TYPE_DECL
+ || TREE_CODE (decl) == NAMESPACE_DECL)
+ {
+ *error_msg = "expected primary-expression";
+ return error_mark_node;
+ }
+
+ /* If the name resolved to a template parameter, there is no
+ need to look it up again later. */
+ if ((TREE_CODE (decl) == CONST_DECL && DECL_TEMPLATE_PARM_P (decl))
+ || TREE_CODE (decl) == TEMPLATE_PARM_INDEX)
+ {
+ *idk = CP_ID_KIND_NONE;
+ if (TREE_CODE (decl) == TEMPLATE_PARM_INDEX)
+ decl = TEMPLATE_PARM_DECL (decl);
+ if (integral_constant_expression_p
+ && !dependent_type_p (TREE_TYPE (decl))
+ && !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl)))
+ {
+ if (!allow_non_integral_constant_expression_p)
+ error ("template parameter `%D' of type `%T' is not allowed in "
+ "an integral constant expression because it is not of "
+ "integral or enumeration type", decl, TREE_TYPE (decl));
+ *non_integral_constant_expression_p = true;
+ }
+ return DECL_INITIAL (decl);
+ }
+ /* Similarly, we resolve enumeration constants to their
+ underlying values. */
+ else if (TREE_CODE (decl) == CONST_DECL)
+ {
+ *idk = CP_ID_KIND_NONE;
+ if (!processing_template_decl)
+ return DECL_INITIAL (decl);
+ return decl;
+ }
+ else
+ {
+ bool dependent_p;
+
+ /* If the declaration was explicitly qualified indicate
+ that. The semantics of `A::f(3)' are different than
+ `f(3)' if `f' is virtual. */
+ *idk = (scope
+ ? CP_ID_KIND_QUALIFIED
+ : (TREE_CODE (decl) == TEMPLATE_ID_EXPR
+ ? CP_ID_KIND_TEMPLATE_ID
+ : CP_ID_KIND_UNQUALIFIED));
+
+
+ /* [temp.dep.expr]
+
+ An id-expression is type-dependent if it contains an
+ identifier that was declared with a dependent type.
+
+ The standard is not very specific about an id-expression that
+ names a set of overloaded functions. What if some of them
+ have dependent types and some of them do not? Presumably,
+ such a name should be treated as a dependent name. */
+ /* Assume the name is not dependent. */
+ dependent_p = false;
+ if (!processing_template_decl)
+ /* No names are dependent outside a template. */
+ ;
+ /* A template-id where the name of the template was not resolved
+ is definitely dependent. */
+ else if (TREE_CODE (decl) == TEMPLATE_ID_EXPR
+ && (TREE_CODE (TREE_OPERAND (decl, 0))
+ == IDENTIFIER_NODE))
+ dependent_p = true;
+ /* For anything except an overloaded function, just check its
+ type. */
+ else if (!is_overloaded_fn (decl))
+ dependent_p
+ = dependent_type_p (TREE_TYPE (decl));
+ /* For a set of overloaded functions, check each of the
+ functions. */
+ else
+ {
+ tree fns = decl;
+
+ if (BASELINK_P (fns))
+ fns = BASELINK_FUNCTIONS (fns);
+
+ /* For a template-id, check to see if the template
+ arguments are dependent. */
+ if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
+ {
+ tree args = TREE_OPERAND (fns, 1);
+ dependent_p = any_dependent_template_arguments_p (args);
+ /* The functions are those referred to by the
+ template-id. */
+ fns = TREE_OPERAND (fns, 0);
+ }
+
+ /* If there are no dependent template arguments, go through
+ the overloaded functions. */
+ while (fns && !dependent_p)
+ {
+ tree fn = OVL_CURRENT (fns);
+
+ /* Member functions of dependent classes are
+ dependent. */
+ if (TREE_CODE (fn) == FUNCTION_DECL
+ && type_dependent_expression_p (fn))
+ dependent_p = true;
+ else if (TREE_CODE (fn) == TEMPLATE_DECL
+ && dependent_template_p (fn))
+ dependent_p = true;
+
+ fns = OVL_NEXT (fns);
+ }
+ }
+
+ /* If the name was dependent on a template parameter, we will
+ resolve the name at instantiation time. */
+ if (dependent_p)
+ {
+ /* Create a SCOPE_REF for qualified names, if the scope is
+ dependent. */
+ if (scope)
+ {
+ if (TYPE_P (scope))
+ *qualifying_class = scope;
+ /* Since this name was dependent, the expression isn't
+ constant -- yet. No error is issued because it might
+ be constant when things are instantiated. */
+ if (integral_constant_expression_p)
+ *non_integral_constant_expression_p = true;
+ if (TYPE_P (scope) && dependent_type_p (scope))
+ return build_nt (SCOPE_REF, scope, id_expression);
+ else if (TYPE_P (scope) && DECL_P (decl))
+ return build (SCOPE_REF, TREE_TYPE (decl), scope,
+ id_expression);
+ else
+ return decl;
+ }
+ /* A TEMPLATE_ID already contains all the information we
+ need. */
+ if (TREE_CODE (id_expression) == TEMPLATE_ID_EXPR)
+ return id_expression;
+ /* Since this name was dependent, the expression isn't
+ constant -- yet. No error is issued because it might be
+ constant when things are instantiated. */
+ if (integral_constant_expression_p)
+ *non_integral_constant_expression_p = true;
+ *idk = CP_ID_KIND_UNQUALIFIED_DEPENDENT;
+ /* If we found a variable, then name lookup during the
+ instantiation will always resolve to the same VAR_DECL
+ (or an instantiation thereof). */
+ if (TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == PARM_DECL)
+ return decl;
+ return id_expression;
+ }
+
+ /* Only certain kinds of names are allowed in constant
+ expression. Enumerators and template parameters
+ have already been handled above. */
+ if (integral_constant_expression_p)
+ {
+ /* Const variables or static data members of integral or
+ enumeration types initialized with constant expressions
+ are OK. */
+ if (TREE_CODE (decl) == VAR_DECL
+ && CP_TYPE_CONST_P (TREE_TYPE (decl))
+ && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl))
+ && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl))
+ ;
+ else
+ {
+ if (!allow_non_integral_constant_expression_p)
+ {
+ error ("`%D' cannot appear in a constant-expression", decl);
+ return error_mark_node;
+ }
+ *non_integral_constant_expression_p = true;
+ }
+ }
+
+ if (TREE_CODE (decl) == NAMESPACE_DECL)
+ {
+ error ("use of namespace `%D' as expression", decl);
+ return error_mark_node;
+ }
+ else if (DECL_CLASS_TEMPLATE_P (decl))
+ {
+ error ("use of class template `%T' as expression", decl);
+ return error_mark_node;
+ }
+ else if (TREE_CODE (decl) == TREE_LIST)
+ {
+ /* Ambiguous reference to base members. */
+ error ("request for member `%D' is ambiguous in "
+ "multiple inheritance lattice", id_expression);
+ print_candidates (decl);
+ return error_mark_node;
+ }
+
+ /* Mark variable-like entities as used. Functions are similarly
+ marked either below or after overload resolution. */
+ if (TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == PARM_DECL
+ || TREE_CODE (decl) == RESULT_DECL)
+ mark_used (decl);
+
+ if (scope)
+ {
+ decl = (adjust_result_of_qualified_name_lookup
+ (decl, scope, current_class_type));
+
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ mark_used (decl);
+
+ if (TREE_CODE (decl) == FIELD_DECL || BASELINK_P (decl))
+ *qualifying_class = scope;
+ else if (!processing_template_decl)
+ decl = convert_from_reference (decl);
+ else if (TYPE_P (scope))
+ decl = build (SCOPE_REF, TREE_TYPE (decl), scope, decl);
+ }
+ else if (TREE_CODE (decl) == FIELD_DECL)
+ decl = finish_non_static_data_member (decl, current_class_ref,
+ /*qualifying_scope=*/NULL_TREE);
+ else if (is_overloaded_fn (decl))
+ {
+ tree first_fn = OVL_CURRENT (decl);
+
+ if (TREE_CODE (first_fn) == TEMPLATE_DECL)
+ first_fn = DECL_TEMPLATE_RESULT (first_fn);
+
+ if (!really_overloaded_fn (decl))
+ mark_used (first_fn);
+
+ if (TREE_CODE (first_fn) == FUNCTION_DECL
+ && DECL_FUNCTION_MEMBER_P (first_fn))
+ {
+ /* A set of member functions. */
+ decl = maybe_dummy_object (DECL_CONTEXT (first_fn), 0);
+ return finish_class_member_access_expr (decl, id_expression);
+ }
+ }
+ else
+ {
+ if (TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == PARM_DECL
+ || TREE_CODE (decl) == RESULT_DECL)
+ {
+ tree context = decl_function_context (decl);
+
+ if (context != NULL_TREE && context != current_function_decl
+ && ! TREE_STATIC (decl))
+ {
+ error ("use of %s from containing function",
+ (TREE_CODE (decl) == VAR_DECL
+ ? "`auto' variable" : "parameter"));
+ cp_error_at (" `%#D' declared here", decl);
+ return error_mark_node;
+ }
+ }
+
+ if (DECL_P (decl) && DECL_NONLOCAL (decl)
+ && DECL_CLASS_SCOPE_P (decl)
+ && DECL_CONTEXT (decl) != current_class_type)
+ {
+ tree path;
+
+ path = currently_open_derived_class (DECL_CONTEXT (decl));
+ perform_or_defer_access_check (TYPE_BINFO (path), decl);
+ }
+
+ if (! processing_template_decl)
+ decl = convert_from_reference (decl);
+ }
+
+ /* Resolve references to variables of anonymous unions
+ into COMPONENT_REFs. */
+ if (TREE_CODE (decl) == ALIAS_DECL)
+ decl = DECL_INITIAL (decl);
+ }
+
+ if (TREE_DEPRECATED (decl))
+ warn_deprecated_use (decl);
+
+ return decl;
+}
+
/* Implement the __typeof keyword: Return the type of EXPR, suitable for
use as a type-specifier. */
tree
-finish_typeof (expr)
- tree expr;
+finish_typeof (tree expr)
{
tree type;
- if (processing_template_decl)
+ if (type_dependent_expression_p (expr))
{
type = make_aggr_type (TYPEOF_TYPE);
TYPE_FIELDS (type) = expr;
@@ -2110,9 +2711,6 @@ finish_typeof (expr)
return type;
}
- if (TREE_CODE (expr) == OFFSET_REF)
- expr = resolve_offset_ref (expr);
-
type = TREE_TYPE (expr);
if (!type || type == unknown_type_node)
@@ -2124,37 +2722,11 @@ finish_typeof (expr)
return type;
}
-/* 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) ? cxx_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) ? cxx_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;
+cp_expand_stmt (tree t)
{
switch (TREE_CODE (t))
{
@@ -2170,10 +2742,6 @@ cp_expand_stmt (t)
genrtl_handler (t);
break;
- case RETURN_INIT:
- genrtl_named_return_value ();
- break;
-
case USING_STMT:
break;
@@ -2187,95 +2755,120 @@ cp_expand_stmt (t)
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;
+simplify_aggr_init_exprs_r (tree* tp,
+ int* walk_subtrees,
+ 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))
+ if (TYPE_P (*tp))
{
*walk_subtrees = 0;
return NULL_TREE;
}
/* Only AGGR_INIT_EXPRs are interesting. */
- else if (TREE_CODE (aggr_init_expr) != AGGR_INIT_EXPR)
+ else if (TREE_CODE (*tp) != AGGR_INIT_EXPR)
return NULL_TREE;
+ simplify_aggr_init_expr (tp);
+
+ /* Keep iterating. */
+ return NULL_TREE;
+}
+
+/* Replace the AGGR_INIT_EXPR at *TP with an equivalent CALL_EXPR. This
+ function is broken out from the above for the benefit of the tree-ssa
+ project. */
+
+void
+simplify_aggr_init_expr (tree *tp)
+{
+ tree aggr_init_expr = *tp;
+
/* 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);
+ tree fn = TREE_OPERAND (aggr_init_expr, 0);
+ tree args = TREE_OPERAND (aggr_init_expr, 1);
+ tree slot = TREE_OPERAND (aggr_init_expr, 2);
+ tree type = TREE_TYPE (aggr_init_expr);
+
+ tree call_expr;
+ enum style_t { ctor, arg, pcc } style;
+
if (AGGR_INIT_VIA_CTOR_P (aggr_init_expr))
+ style = ctor;
+#ifdef PCC_STATIC_STRUCT_RETURN
+ else if (1)
+ style = pcc;
+#endif
+ else if (TREE_ADDRESSABLE (type))
+ style = arg;
+ else
+ /* We shouldn't build an AGGR_INIT_EXPR if we don't need any special
+ handling. See build_cplus_new. */
+ abort ();
+
+ if (style == ctor || style == arg)
{
- /* Replace the first argument with the address of the third
- argument to the AGGR_INIT_EXPR. */
+ /* Pass the address of the slot. If this is a constructor, we
+ replace the first argument; otherwise, we tack on a new one. */
+ tree addr;
+
+ if (style == ctor)
+ args = TREE_CHAIN (args);
+
cxx_mark_addressable (slot);
- args = tree_cons (NULL_TREE,
- build1 (ADDR_EXPR,
- build_pointer_type (TREE_TYPE (slot)),
- slot),
- TREE_CHAIN (args));
+ addr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (slot)), slot);
+ if (style == arg)
+ {
+ /* The return type might have different cv-quals from the slot. */
+ tree fntype = TREE_TYPE (TREE_TYPE (fn));
+#ifdef ENABLE_CHECKING
+ if (TREE_CODE (fntype) != FUNCTION_TYPE
+ && TREE_CODE (fntype) != METHOD_TYPE)
+ abort ();
+#endif
+ addr = convert (build_pointer_type (TREE_TYPE (fntype)), addr);
+ }
+
+ args = tree_cons (NULL_TREE, addr, 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))
+ if (style == arg)
+ /* Tell the backend that we've added our return slot to the argument
+ list. */
+ CALL_EXPR_HAS_RETURN_SLOT_ADDR (call_expr) = 1;
+ else if (style == pcc)
{
- int old_ac = flag_access_control;
-
- flag_access_control = 0;
+ /* 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. */
+ push_deferring_access_checks (dk_no_check);
call_expr = build_aggr_init (slot, call_expr,
DIRECT_BIND | LOOKUP_ONLYCONVERTING);
- flag_access_control = old_ac;
- copy_from_buffer_p = 1;
+ pop_deferring_access_checks ();
}
-#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;
- }
+ /* We want to use the value of the initialized location as the
+ result. */
+ call_expr = build (COMPOUND_EXPR, type,
+ call_expr, slot);
/* 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;
+emit_associated_thunks (tree fn)
{
/* When we use vcall offsets, we emit thunks with the virtual
functions to which they thunk. The whole point of vcall offsets
@@ -2285,30 +2878,104 @@ emit_associated_thunks (fn)
if (DECL_VIRTUAL_P (fn))
{
tree thunk;
+
for (thunk = DECL_THUNKS (fn); thunk; thunk = TREE_CHAIN (thunk))
- use_thunk (thunk, /*emit_p=*/1);
+ {
+ if (!THUNK_ALIAS (thunk))
+ {
+ use_thunk (thunk, /*emit_p=*/1);
+ if (DECL_RESULT_THUNK_P (thunk))
+ {
+ tree probe;
+
+ for (probe = DECL_THUNKS (thunk);
+ probe; probe = TREE_CHAIN (probe))
+ use_thunk (probe, /*emit_p=*/1);
+ }
+ }
+ else
+ my_friendly_assert (!DECL_THUNKS (thunk), 20031023);
+ }
}
}
/* Generate RTL for FN. */
void
-expand_body (fn)
- tree fn;
+expand_body (tree fn)
{
- int saved_lineno;
- const char *saved_input_filename;
tree saved_function;
+
+ /* 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;
+
+ /* ??? When is this needed? */
+ saved_function = current_function_decl;
+
+ /* Emit any thunks that should be emitted at the same time as FN. */
+ emit_associated_thunks (fn);
+
+ timevar_push (TV_INTEGRATION);
+ optimize_function (fn);
+ timevar_pop (TV_INTEGRATION);
+
+ tree_rest_of_compilation (fn, function_depth > 1);
+
+ current_function_decl = saved_function;
+
+ extract_interface_info ();
+ /* 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);
+
+ if (DECL_CLONED_FUNCTION_P (fn))
+ {
+ /* If this is a clone, go through the other clones now and mark
+ their parameters used. We have to do that here, as we don't
+ know whether any particular clone will be expanded, and
+ therefore cannot pick one arbitrarily. */
+ tree probe;
+
+ for (probe = TREE_CHAIN (DECL_CLONED_FUNCTION (fn));
+ probe && DECL_CLONED_FUNCTION_P (probe);
+ probe = TREE_CHAIN (probe))
+ {
+ tree parms;
+
+ for (parms = DECL_ARGUMENTS (probe);
+ parms; parms = TREE_CHAIN (parms))
+ TREE_USED (parms) = 1;
+ }
+ }
+}
+
+/* Generate RTL for FN. */
+
+void
+expand_or_defer_fn (tree fn)
+{
/* 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))))
+ function, we don't really want to expand the body. */
+ if (processing_template_decl)
{
/* Normally, collection only occurs in rest_of_compilation. So,
if we don't collect here, we never collect junk generated
@@ -2338,102 +3005,16 @@ expand_body (fn)
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. */
+ /* 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;
-
- /* 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;
- saved_function = current_function_decl;
- lineno = DECL_SOURCE_LINE (fn);
- input_filename = DECL_SOURCE_FILE (fn);
- current_function_decl = fn;
+ function_depth++;
- timevar_push (TV_INTEGRATION);
-
- /* Optimize the body of the function before expanding it. */
- optimize_function (fn);
-
- timevar_pop (TV_INTEGRATION);
- timevar_push (TV_EXPAND);
+ /* Expand or defer, at the whim of the compilation unit manager. */
+ cgraph_finalize_function (fn, function_depth > 1);
- 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. */
- current_function_decl = saved_function;
- lineno = saved_lineno;
- input_filename = saved_input_filename;
- extract_interface_info ();
-
- timevar_pop (TV_EXPAND);
-
- /* Emit any thunks that should be emitted at the same time as FN. */
- emit_associated_thunks (fn);
+ function_depth--;
}
/* Helper function for walk_tree, used by finish_function to override all
@@ -2441,10 +3022,7 @@ expand_body (fn)
value optimization. */
tree
-nullify_returns_r (tp, walk_subtrees, data)
- tree *tp;
- int *walk_subtrees;
- void *data;
+nullify_returns_r (tree* tp, int* walk_subtrees, void* data)
{
tree nrv = (tree) data;
@@ -2464,206 +3042,20 @@ nullify_returns_r (tp, walk_subtrees, data)
/* 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. Unless this is an inline
- function; we need the named return value info for
- cp_copy_res_decl_for_inlining. */
- if (! DECL_INLINE (fn))
- DECL_SAVED_FUNCTION_DATA (fn) = NULL;
- }
-
- /* 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 ();
-
+void
+cxx_expand_function_start (void)
+{
/* 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;
+ COPY_DECL_RTL (DECL_RESULT (cfun->decl), current_function_return_value);
}
/* Perform initialization related to this module. */
void
-init_cp_semantics ()
+init_cp_semantics (void)
{
lang_expand_stmt = cp_expand_stmt;
}
+
+#include "gt-cp-semantics.h"
diff --git a/contrib/gcc/cp/tree.c b/contrib/gcc/cp/tree.c
index 1551df0..d39ff76 100644
--- a/contrib/gcc/cp/tree.c
+++ b/contrib/gcc/cp/tree.c
@@ -1,69 +1,67 @@
/* Language-dependent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; 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 "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "flags.h"
#include "real.h"
#include "rtl.h"
#include "toplev.h"
-#include "ggc.h"
#include "insn-config.h"
#include "integrate.h"
#include "tree-inline.h"
#include "target.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, 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 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 *));
+static tree bot_manip (tree *, int *, void *);
+static tree bot_replace (tree *, int *, void *);
+static tree build_cplus_array_type_1 (tree, tree);
+static int list_hash_eq (const void *, const void *);
+static hashval_t list_hash_pieces (tree, tree, tree);
+static hashval_t list_hash (const void *);
+static cp_lvalue_kind lvalue_p_1 (tree, int);
+static tree no_linkage_helper (tree *, int *, void *);
+static tree mark_local_for_remap_r (tree *, int *, void *);
+static tree cp_unsave_r (tree *, int *, void *);
+static tree build_target_expr (tree, tree);
+static tree count_trees_r (tree *, int *, void *);
+static tree verify_stmt_tree_r (tree *, int *, void *);
+static tree find_tree_r (tree *, int *, void *);
+static tree build_local_temp (tree);
+
+static tree handle_java_interface_attribute (tree *, tree, tree, int, bool *);
+static tree handle_com_interface_attribute (tree *, tree, tree, int, bool *);
+static tree handle_init_priority_attribute (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
nonzero, rvalues of class type are considered lvalues. */
static cp_lvalue_kind
-lvalue_p_1 (ref, treat_class_rvalues_as_lvalues, allow_cast_as_lvalue)
- tree ref;
- int treat_class_rvalues_as_lvalues;
- int allow_cast_as_lvalue;
+lvalue_p_1 (tree ref,
+ int treat_class_rvalues_as_lvalues)
{
cp_lvalue_kind op1_lvalue_kind = clk_none;
cp_lvalue_kind op2_lvalue_kind = clk_none;
@@ -87,39 +85,31 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues, allow_cast_as_lvalue)
case REALPART_EXPR:
case IMAGPART_EXPR:
return lvalue_p_1 (TREE_OPERAND (ref, 0),
- treat_class_rvalues_as_lvalues,
- allow_cast_as_lvalue);
-
- case NOP_EXPR:
- /* If expression doesn't change the type, we consider it as an
- lvalue even when cast_as_lvalue extension isn't selected.
- That's because parts of the compiler are alleged to be sloppy
- about sticking in NOP_EXPR node for no good reason. */
- if (allow_cast_as_lvalue ||
- same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (ref)),
- TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (ref, 0)))))
- return lvalue_p_1 (TREE_OPERAND (ref, 0),
- treat_class_rvalues_as_lvalues,
- allow_cast_as_lvalue);
- else
- return clk_none;
+ treat_class_rvalues_as_lvalues);
case COMPONENT_REF:
op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 0),
- treat_class_rvalues_as_lvalues,
- allow_cast_as_lvalue);
- 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)))
+ treat_class_rvalues_as_lvalues);
+ /* In an expression of the form "X.Y", the packed-ness of the
+ expression does not depend on "X". */
+ op1_lvalue_kind &= ~clk_packed;
+ /* Look at the member designator. */
+ 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)
+ ;
+ else if (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. */
+ /* The lvalue is for a bitfield. */
op1_lvalue_kind |= clk_bitfield;
}
+ else if (DECL_PACKED (TREE_OPERAND (ref, 1)))
+ op1_lvalue_kind |= clk_packed;
+
return op1_lvalue_kind;
case STRING_CST:
@@ -141,27 +131,19 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues, allow_cast_as_lvalue)
/* A currently unresolved scope ref. */
case SCOPE_REF:
abort ();
- case OFFSET_REF:
- if (TREE_CODE (TREE_OPERAND (ref, 1)) == FUNCTION_DECL)
- 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,
- allow_cast_as_lvalue);
+ treat_class_rvalues_as_lvalues);
op2_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 1),
- treat_class_rvalues_as_lvalues,
- allow_cast_as_lvalue);
+ treat_class_rvalues_as_lvalues);
break;
case COND_EXPR:
op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 1),
- treat_class_rvalues_as_lvalues,
- allow_cast_as_lvalue);
+ treat_class_rvalues_as_lvalues);
op2_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 2),
- treat_class_rvalues_as_lvalues,
- allow_cast_as_lvalue);
+ treat_class_rvalues_as_lvalues);
break;
case MODIFY_EXPR:
@@ -169,17 +151,15 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues, allow_cast_as_lvalue)
case COMPOUND_EXPR:
return lvalue_p_1 (TREE_OPERAND (ref, 1),
- treat_class_rvalues_as_lvalues,
- allow_cast_as_lvalue);
+ treat_class_rvalues_as_lvalues);
case TARGET_EXPR:
return treat_class_rvalues_as_lvalues ? clk_class : clk_none;
case CALL_EXPR:
case VA_ARG_EXPR:
- return ((treat_class_rvalues_as_lvalues
- && IS_AGGR_TYPE (TREE_TYPE (ref)))
- ? clk_class : clk_none);
+ /* Any class-valued call would be wrapped in a TARGET_EXPR. */
+ return clk_none;
case FUNCTION_DECL:
/* All functions (except non-static-member functions) are
@@ -187,6 +167,14 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues, allow_cast_as_lvalue)
return (DECL_NONSTATIC_MEMBER_FUNCTION_P (ref)
? clk_none : clk_ordinary);
+ case NON_DEPENDENT_EXPR:
+ /* We must consider NON_DEPENDENT_EXPRs to be lvalues so that
+ things like "&E" where "E" is an expression with a
+ non-dependent type work. It is safe to be lenient because an
+ error will be issued when the template is instantiated if "E"
+ is not an lvalue. */
+ return clk_ordinary;
+
default:
break;
}
@@ -206,82 +194,45 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues, allow_cast_as_lvalue)
return op1_lvalue_kind;
}
-/* 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. */
-
-cp_lvalue_kind
-real_lvalue_p (ref)
- tree ref;
-{
- return lvalue_p_1 (ref, /*treat_class_rvalues_as_lvalues=*/ 0, /*cast*/ 1);
-}
-
/* Returns the kind of lvalue that REF is, in the sense of
[basic.lval]. This function should really be named lvalue_p; it
computes the C++ definition of lvalue. */
cp_lvalue_kind
-real_non_cast_lvalue_p (tree ref)
+real_lvalue_p (tree ref)
{
return lvalue_p_1 (ref,
- /*treat_class_rvalues_as_lvalues=*/0,
- /*allow_cast_as_lvalue=*/0);
+ /*treat_class_rvalues_as_lvalues=*/0);
}
/* This differs from real_lvalue_p in that class rvalues are
considered lvalues. */
int
-lvalue_p (ref)
- tree ref;
-{
- return
- (lvalue_p_1 (ref, /*class rvalue ok*/ 1, /*cast*/ 1) != clk_none);
-}
-
-int
-non_cast_lvalue_p (ref)
- tree ref;
+lvalue_p (tree ref)
{
return
- (lvalue_p_1 (ref, /*class rvalue ok*/ 1, /*cast*/ 0) != clk_none);
+ (lvalue_p_1 (ref, /*class rvalue ok*/ 1) != clk_none);
}
/* Return nonzero if REF is an lvalue valid for this language;
otherwise, print an error message and return zero. */
int
-lvalue_or_else (ref, string)
- tree ref;
- const char *string;
+lvalue_or_else (tree ref, const char* string)
{
- int ret = lvalue_p_1 (ref, /* class rvalue ok */ 1, /* cast ok */ 1);
- int win = (ret != clk_none);
- if (! win)
- error ("non-lvalue in %s", string);
- return win;
-}
-
-int
-non_cast_lvalue_or_else (ref, string)
- tree ref;
- const char *string;
-{
- int ret = lvalue_p_1 (ref, /* class rvalue ok */ 1, /* cast ok */ 0);
- int win = (ret != clk_none);
- if (! win)
- error ("non-lvalue in %s", string);
- return win;
+ if (!lvalue_p (ref))
+ {
+ error ("non-lvalue in %s", string);
+ return 0;
+ }
+ return 1;
}
/* Build a TARGET_EXPR, initializing the DECL with the VALUE. */
static tree
-build_target_expr (decl, value)
- tree decl;
- tree value;
+build_target_expr (tree decl, tree value)
{
tree t;
@@ -296,6 +247,19 @@ build_target_expr (decl, value)
return t;
}
+/* Return an undeclared local temporary of type TYPE for use in building a
+ TARGET_EXPR. */
+
+static tree
+build_local_temp (tree type)
+{
+ tree slot = build_decl (VAR_DECL, NULL_TREE, type);
+ DECL_ARTIFICIAL (slot) = 1;
+ DECL_CONTEXT (slot) = current_function_decl;
+ layout_decl (slot, 0);
+ return slot;
+}
+
/* INIT is a CALL_EXPR which needs info about its target.
TYPE is the type that this initialization should appear to have.
@@ -304,13 +268,12 @@ build_target_expr (decl, value)
and language-specific expression expanders. */
tree
-build_cplus_new (type, init)
- tree type;
- tree init;
+build_cplus_new (tree type, tree init)
{
tree fn;
tree slot;
tree rval;
+ int is_ctor;
/* Make sure that we're not trying to create an instance of an
abstract class. */
@@ -319,10 +282,12 @@ build_cplus_new (type, init)
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);
+ fn = TREE_OPERAND (init, 0);
+ is_ctor = (TREE_CODE (fn) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
+ && DECL_CONSTRUCTOR_P (TREE_OPERAND (fn, 0)));
+
+ slot = build_local_temp (type);
/* We split the CALL_EXPR into its function and its arguments here.
Then, in expand_expr, we put them back together. The reason for
@@ -332,13 +297,18 @@ build_cplus_new (type, init)
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)));
+
+ /* If we don't need to use a constructor to create an object of this
+ type, don't mess with AGGR_INIT_EXPR. */
+ if (is_ctor || TREE_ADDRESSABLE (type))
+ {
+ rval = build (AGGR_INIT_EXPR, type, fn, TREE_OPERAND (init, 1), slot);
+ TREE_SIDE_EFFECTS (rval) = 1;
+ AGGR_INIT_VIA_CTOR_P (rval) = is_ctor;
+ }
+ else
+ rval = init;
+
rval = build_target_expr (slot, rval);
return rval;
@@ -348,98 +318,58 @@ build_cplus_new (type, init)
indicated TYPE. */
tree
-build_target_expr_with_type (init, type)
- tree init;
- tree type;
+build_target_expr_with_type (tree init, tree type)
{
tree slot;
- tree rval;
if (TREE_CODE (init) == TARGET_EXPR)
return init;
else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type)
&& TREE_CODE (init) != COND_EXPR
- && TREE_CODE (init) != CONSTRUCTOR)
+ && TREE_CODE (init) != CONSTRUCTOR
+ && TREE_CODE (init) != VA_ARG_EXPR)
/* We need to build up a copy constructor call. COND_EXPR is a special
case because we already have copies on the arms and we don't want
another one here. A CONSTRUCTOR is aggregate initialization, which
- is handled separately. */
+ is handled separately. A VA_ARG_EXPR is magic creation of an
+ aggregate; there's no additional work to be done. */
return force_rvalue (init);
- slot = build (VAR_DECL, type);
- DECL_ARTIFICIAL (slot) = 1;
- DECL_CONTEXT (slot) = current_function_decl;
- layout_decl (slot, 0);
- rval = build_target_expr (slot, init);
-
- return rval;
+ slot = build_local_temp (type);
+ return build_target_expr (slot, init);
}
-/* Like build_target_expr_with_type, but use the type of INIT. */
+/* Like the above function, but without the checking. This function should
+ only be used by code which is deliberately trying to subvert the type
+ system, such as call_builtin_trap. */
tree
-get_target_expr (init)
- tree init;
+force_target_expr (tree type, tree init)
{
- return build_target_expr_with_type (init, TREE_TYPE (init));
+ tree slot = build_local_temp (type);
+ return build_target_expr (slot, init);
}
-
-/* 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. */
+
+/* Like build_target_expr_with_type, but use the type of INIT. */
tree
-build_cplus_method_type (basetype, rettype, argtypes)
- tree basetype, rettype, argtypes;
+get_target_expr (tree init)
{
- register tree t;
- tree ptype;
- int hashcode;
-
- /* Make a node of the sort we want. */
- t = make_node (METHOD_TYPE);
-
- TYPE_METHOD_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype);
- TREE_TYPE (t) = rettype;
- 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);
-
- t = type_hash_canon (hashcode, t);
-
- if (!COMPLETE_TYPE_P (t))
- layout_type (t);
-
- return t;
+ return build_target_expr_with_type (init, TREE_TYPE (init));
}
+
static tree
-build_cplus_array_type_1 (elt_type, index_type)
- tree elt_type;
- tree index_type;
+build_cplus_array_type_1 (tree elt_type, tree index_type)
{
tree t;
if (elt_type == error_mark_node || index_type == error_mark_node)
return error_mark_node;
- /* Don't do the minimal thing just because processing_template_decl is
- set; we want to give string constants the right type immediately, so
- we don't have to fix them up at instantiation time. */
- if ((processing_template_decl
- && index_type && TYPE_MAX_VALUE (index_type)
- && TREE_CODE (TYPE_MAX_VALUE (index_type)) != INTEGER_CST)
- || uses_template_parms (elt_type)
- || (index_type && uses_template_parms (index_type)))
+ if (dependent_type_p (elt_type)
+ || (index_type
+ && value_dependent_expression_p (TYPE_MAX_VALUE (index_type))))
{
t = make_node (ARRAY_TYPE);
TREE_TYPE (t) = elt_type;
@@ -458,22 +388,18 @@ build_cplus_array_type_1 (elt_type, index_type)
}
tree
-build_cplus_array_type (elt_type, index_type)
- tree elt_type;
- tree index_type;
+build_cplus_array_type (tree elt_type, tree index_type)
{
tree t;
int type_quals = cp_type_quals (elt_type);
- int cv_quals = type_quals & (TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE);
- int other_quals = type_quals & ~(TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE);
- if (cv_quals)
- elt_type = cp_build_qualified_type (elt_type, other_quals);
+ 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);
- if (cv_quals)
- t = cp_build_qualified_type (t, cv_quals);
+ if (type_quals != TYPE_UNQUALIFIED)
+ t = cp_build_qualified_type (t, type_quals);
return t;
}
@@ -495,22 +421,16 @@ build_cplus_array_type (elt_type, index_type)
via a typedef or template type argument. [dcl.ref] No such
dispensation is provided for qualifying a function type. [dcl.fct]
DR 295 queries this and the proposed resolution brings it into line
- with qualifiying a reference. We implement the DR. We also behave
+ with qualifying a reference. We implement the DR. We also behave
in a similar manner for restricting non-pointer types. */
tree
-cp_build_qualified_type_real (type, type_quals, complain)
- tree type;
- int type_quals;
- tsubst_flags_t complain;
+cp_build_qualified_type_real (tree type,
+ int type_quals,
+ tsubst_flags_t complain)
{
tree result;
int bad_quals = TYPE_UNQUALIFIED;
- /* We keep bad function qualifiers separate, so that we can decide
- whether to implement DR 295 or not. DR 295 break existing code,
- unfortunately. Remove this variable to implement the defect
- report. */
- int bad_func_quals = TYPE_UNQUALIFIED;
if (type == error_mark_node)
return type;
@@ -518,54 +438,6 @@ cp_build_qualified_type_real (type, type_quals, complain)
if (type_quals == cp_type_quals (type))
return type;
- /* A reference, fucntion or method type shall not be cv qualified.
- [dcl.ref], [dct.fct] */
- if (type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)
- && (TREE_CODE (type) == REFERENCE_TYPE
- || TREE_CODE (type) == FUNCTION_TYPE
- || TREE_CODE (type) == METHOD_TYPE))
- {
- bad_quals |= type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
- if (TREE_CODE (type) != REFERENCE_TYPE)
- bad_func_quals |= type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
- type_quals &= ~(TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
- }
-
- /* A restrict-qualified type must be a pointer (or reference)
- to object or incomplete type. */
- if ((type_quals & TYPE_QUAL_RESTRICT)
- && TREE_CODE (type) != TEMPLATE_TYPE_PARM
- && TREE_CODE (type) != TYPENAME_TYPE
- && !POINTER_TYPE_P (type))
- {
- bad_quals |= TYPE_QUAL_RESTRICT;
- type_quals &= ~TYPE_QUAL_RESTRICT;
- }
-
- if (bad_quals == TYPE_UNQUALIFIED)
- /*OK*/;
- else if (!(complain & (tf_error | tf_ignore_bad_quals)))
- return error_mark_node;
- else if (bad_func_quals && !(complain & tf_error))
- return error_mark_node;
- else
- {
- if (complain & tf_ignore_bad_quals)
- /* We're not going to warn about constifying things that can't
- be constified. */
- bad_quals &= ~TYPE_QUAL_CONST;
- bad_quals |= bad_func_quals;
- if (bad_quals)
- {
- tree bad_type = build_qualified_type (ptr_type_node, bad_quals);
-
- if (!(complain & tf_ignore_bad_quals)
- || bad_func_quals)
- error ("`%V' qualifiers cannot be applied to `%T'",
- bad_type, type);
- }
- }
-
if (TREE_CODE (type) == ARRAY_TYPE)
{
/* In C++, the qualification really applies to the array element
@@ -620,6 +492,48 @@ cp_build_qualified_type_real (type, type_quals, complain)
return build_ptrmemfunc_type (t);
}
+ /* A reference, function or method type shall not be cv qualified.
+ [dcl.ref], [dct.fct] */
+ if (type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)
+ && (TREE_CODE (type) == REFERENCE_TYPE
+ || TREE_CODE (type) == FUNCTION_TYPE
+ || TREE_CODE (type) == METHOD_TYPE))
+ {
+ bad_quals |= type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
+ type_quals &= ~(TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
+ }
+
+ /* A restrict-qualified type must be a pointer (or reference)
+ to object or incomplete type. */
+ if ((type_quals & TYPE_QUAL_RESTRICT)
+ && TREE_CODE (type) != TEMPLATE_TYPE_PARM
+ && TREE_CODE (type) != TYPENAME_TYPE
+ && !POINTER_TYPE_P (type))
+ {
+ bad_quals |= TYPE_QUAL_RESTRICT;
+ type_quals &= ~TYPE_QUAL_RESTRICT;
+ }
+
+ if (bad_quals == TYPE_UNQUALIFIED)
+ /*OK*/;
+ else if (!(complain & (tf_error | tf_ignore_bad_quals)))
+ return error_mark_node;
+ else
+ {
+ if (complain & tf_ignore_bad_quals)
+ /* We're not going to warn about constifying things that can't
+ be constified. */
+ bad_quals &= ~TYPE_QUAL_CONST;
+ if (bad_quals)
+ {
+ tree bad_type = build_qualified_type (ptr_type_node, bad_quals);
+
+ if (!(complain & tf_ignore_bad_quals))
+ error ("`%V' qualifiers cannot be applied to `%T'",
+ bad_type, type);
+ }
+ }
+
/* Retrieve (or create) the appropriately qualified variant. */
result = build_qualified_type (type, type_quals);
@@ -641,43 +555,85 @@ cp_build_qualified_type_real (type, type_quals, complain)
compatible types. */
tree
-canonical_type_variant (t)
- tree t;
+canonical_type_variant (tree t)
{
return cp_build_qualified_type (TYPE_MAIN_VARIANT (t), cp_type_quals (t));
}
-/* Makes new binfos for the indirect bases under BINFO, and updates
- BINFO_OFFSET for them and their bases. */
+/* Makes new binfos for the indirect bases under BINFO. T is the most
+ derived TYPE. PREV is the previous binfo, whose TREE_CHAIN we make
+ point to this binfo. We return the last BINFO created.
-void
-unshare_base_binfos (binfo)
- tree binfo;
+ The CLASSTYPE_VBASECLASSES list of T is constructed in reverse
+ order (pre-order, depth-first, right-to-left). You must nreverse it.
+
+ The BINFO_INHERITANCE of a virtual base class points to the binfo
+ og the most derived type.
+
+ The binfo's TREE_CHAIN is set to inheritance graph order, but bases
+ for non-class types are not included (i.e. those which are
+ dependent bases in non-instantiated templates). */
+
+tree
+copy_base_binfos (tree binfo, tree t, tree prev)
{
tree binfos = BINFO_BASETYPES (binfo);
- tree new_binfo;
- int j;
+ int n, ix;
+ if (prev)
+ TREE_CHAIN (prev) = binfo;
+ prev = binfo;
+
if (binfos == NULL_TREE)
- return;
+ return prev;
- /* Now unshare the structure beneath BINFO. */
- for (j = TREE_VEC_LENGTH (binfos)-1;
- j >= 0; j--)
+ n = TREE_VEC_LENGTH (binfos);
+
+ /* Now copy the structure beneath BINFO. */
+ for (ix = 0; ix != n; ix++)
{
- tree base_binfo = TREE_VEC_ELT (binfos, j);
- new_binfo = TREE_VEC_ELT (binfos, j)
- = make_binfo (BINFO_OFFSET (base_binfo),
- base_binfo,
- BINFO_VTABLE (base_binfo),
- BINFO_VIRTUALS (base_binfo));
- TREE_VIA_PUBLIC (new_binfo) = TREE_VIA_PUBLIC (base_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);
+ tree base_binfo = TREE_VEC_ELT (binfos, ix);
+ tree new_binfo = NULL_TREE;
+
+ if (!CLASS_TYPE_P (BINFO_TYPE (base_binfo)))
+ {
+ my_friendly_assert (binfo == TYPE_BINFO (t), 20030204);
+
+ new_binfo = base_binfo;
+ TREE_CHAIN (prev) = new_binfo;
+ prev = new_binfo;
+ BINFO_INHERITANCE_CHAIN (new_binfo) = binfo;
+ BINFO_DEPENDENT_BASE_P (new_binfo) = 1;
+ }
+ else if (TREE_VIA_VIRTUAL (base_binfo))
+ {
+ new_binfo = purpose_member (BINFO_TYPE (base_binfo),
+ CLASSTYPE_VBASECLASSES (t));
+ if (new_binfo)
+ new_binfo = TREE_VALUE (new_binfo);
+ }
+
+ if (!new_binfo)
+ {
+ new_binfo = make_binfo (BINFO_OFFSET (base_binfo),
+ base_binfo, NULL_TREE,
+ BINFO_VIRTUALS (base_binfo));
+ prev = copy_base_binfos (new_binfo, t, prev);
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ {
+ CLASSTYPE_VBASECLASSES (t)
+ = tree_cons (BINFO_TYPE (new_binfo), new_binfo,
+ CLASSTYPE_VBASECLASSES (t));
+ TREE_VIA_VIRTUAL (new_binfo) = 1;
+ BINFO_INHERITANCE_CHAIN (new_binfo) = TYPE_BINFO (t);
+ }
+ else
+ BINFO_INHERITANCE_CHAIN (new_binfo) = binfo;
+ }
+ TREE_VEC_ELT (binfos, ix) = new_binfo;
}
+
+ return prev;
}
@@ -703,9 +659,7 @@ struct list_proxy
for a node we are thinking about adding). */
static int
-list_hash_eq (entry, data)
- const void *entry;
- const void *data;
+list_hash_eq (const void* entry, const void* data)
{
tree t = (tree) entry;
struct list_proxy *proxy = (struct list_proxy *) data;
@@ -720,10 +674,7 @@ list_hash_eq (entry, data)
TREE_COMMON slots), by adding the hash codes of the individual entries. */
static hashval_t
-list_hash_pieces (purpose, value, chain)
- tree purpose;
- tree value;
- tree chain;
+list_hash_pieces (tree purpose, tree value, tree chain)
{
hashval_t hashcode = 0;
@@ -744,8 +695,7 @@ list_hash_pieces (purpose, value, chain)
/* Hash an already existing TREE_LIST. */
static hashval_t
-list_hash (p)
- const void *p;
+list_hash (const void* p)
{
tree t = (tree) p;
return list_hash_pieces (TREE_PURPOSE (t),
@@ -758,11 +708,10 @@ list_hash (p)
new one, and record it as the canonical object. */
tree
-hash_tree_cons (purpose, value, chain)
- tree purpose, value, chain;
+hash_tree_cons (tree purpose, tree value, tree chain)
{
int hashcode = 0;
- PTR* slot;
+ void **slot;
struct list_proxy proxy;
/* Hash the list node. */
@@ -777,15 +726,14 @@ hash_tree_cons (purpose, value, chain)
INSERT);
/* If not, create a new node. */
if (!*slot)
- *slot = (PTR) tree_cons (purpose, value, chain);
+ *slot = tree_cons (purpose, value, chain);
return *slot;
}
/* Constructor for hashed lists. */
tree
-hash_tree_chain (value, chain)
- tree value, chain;
+hash_tree_chain (tree value, tree chain)
{
return hash_tree_cons (NULL_TREE, value, chain);
}
@@ -793,8 +741,7 @@ hash_tree_chain (value, chain)
/* Similar, but used for concatenating two lists. */
tree
-hash_chainon (list1, list2)
- tree list1, list2;
+hash_chainon (tree list1, tree list2)
{
if (list2 == 0)
return list1;
@@ -822,19 +769,21 @@ hash_chainon (list1, list2)
VIRTUALS are the virtual functions sitting in VTABLE. */
tree
-make_binfo (offset, binfo, vtable, virtuals)
- tree offset, binfo;
- tree vtable, virtuals;
+make_binfo (tree offset, tree binfo, tree vtable, tree virtuals)
{
- tree new_binfo = make_tree_vec (11);
+ tree new_binfo = make_tree_vec (BINFO_LANG_ELTS);
tree type;
if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
+ {
+ type = BINFO_TYPE (binfo);
+ BINFO_DEPENDENT_BASE_P (new_binfo) = BINFO_DEPENDENT_BASE_P (binfo);
+ }
else
{
type = binfo;
- binfo = CLASS_TYPE_P (type) ? TYPE_BINFO (binfo) : NULL_TREE;
+ binfo = NULL_TREE;
+ BINFO_DEPENDENT_BASE_P (new_binfo) = 1;
}
TREE_TYPE (new_binfo) = TYPE_MAIN_VARIANT (type);
@@ -842,45 +791,26 @@ make_binfo (offset, binfo, vtable, virtuals)
BINFO_VTABLE (new_binfo) = vtable;
BINFO_VIRTUALS (new_binfo) = virtuals;
- if (binfo && BINFO_BASETYPES (binfo) != NULL_TREE)
- BINFO_BASETYPES (new_binfo) = copy_node (BINFO_BASETYPES (binfo));
- return new_binfo;
-}
-
-/* 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
-reverse_path (binfo)
- tree binfo;
-{
- tree reversed_path;
-
- reversed_path = NULL_TREE;
- while (binfo)
+ if (binfo && !BINFO_DEPENDENT_BASE_P (binfo)
+ && BINFO_BASETYPES (binfo) != NULL_TREE)
{
- reversed_path = tree_cons (NULL_TREE, binfo, reversed_path);
- binfo = BINFO_INHERITANCE_CHAIN (binfo);
+ BINFO_BASETYPES (new_binfo) = copy_node (BINFO_BASETYPES (binfo));
+ /* We do not need to copy the accesses, as they are read only. */
+ BINFO_BASEACCESSES (new_binfo) = BINFO_BASEACCESSES (binfo);
}
-
- return reversed_path;
+ return new_binfo;
}
void
-debug_binfo (elem)
- tree elem;
+debug_binfo (tree elem)
{
HOST_WIDE_INT n;
tree virtuals;
- fprintf (stderr, "type \"%s\", offset = ",
- TYPE_NAME_STRING (BINFO_TYPE (elem)));
- fprintf (stderr, HOST_WIDE_INT_PRINT_DEC,
+ fprintf (stderr, "type \"%s\", offset = " HOST_WIDE_INT_PRINT_DEC
+ "\nvtable type:\n",
+ TYPE_NAME_STRING (BINFO_TYPE (elem)),
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",
@@ -903,15 +833,14 @@ debug_binfo (elem)
}
int
-count_functions (t)
- tree t;
+count_functions (tree t)
{
int i;
if (TREE_CODE (t) == FUNCTION_DECL)
return 1;
else if (TREE_CODE (t) == OVERLOAD)
{
- for (i=0; t; t = OVL_CHAIN (t))
+ for (i = 0; t; t = OVL_CHAIN (t))
i++;
return i;
}
@@ -921,8 +850,7 @@ count_functions (t)
}
int
-is_overloaded_fn (x)
- tree x;
+is_overloaded_fn (tree x)
{
/* A baselink is also considered an overloaded function. */
if (TREE_CODE (x) == OFFSET_REF)
@@ -936,8 +864,7 @@ is_overloaded_fn (x)
}
int
-really_overloaded_fn (x)
- tree x;
+really_overloaded_fn (tree x)
{
/* A baselink is also considered an overloaded function. */
if (TREE_CODE (x) == OFFSET_REF)
@@ -950,23 +877,8 @@ really_overloaded_fn (x)
|| TREE_CODE (x) == TEMPLATE_ID_EXPR);
}
-/* Return the OVERLOAD or FUNCTION_DECL inside FNS. FNS can be an
- OVERLOAD, FUNCTION_DECL, TEMPLATE_ID_EXPR, or baselink. */
-
tree
-get_overloaded_fn (fns)
- tree fns;
-{
- if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
- fns = TREE_OPERAND (fns, 0);
- if (BASELINK_P (fns))
- fns = BASELINK_FUNCTIONS (fns);
- return fns;
-}
-
-tree
-get_first_fn (from)
- tree from;
+get_first_fn (tree from)
{
my_friendly_assert (is_overloaded_fn (from), 9);
/* A baselink is also considered an overloaded function. */
@@ -979,8 +891,7 @@ get_first_fn (from)
member function. */
int
-bound_pmf_p (t)
- tree t;
+bound_pmf_p (tree t)
{
return (TREE_CODE (t) == OFFSET_REF
&& TYPE_PTRMEMFUNC_P (TREE_TYPE (TREE_OPERAND (t, 1))));
@@ -989,9 +900,7 @@ bound_pmf_p (t)
/* Return a new OVL node, concatenating it with the old one. */
tree
-ovl_cons (decl, chain)
- tree decl;
- tree chain;
+ovl_cons (tree decl, tree chain)
{
tree result = make_node (OVERLOAD);
TREE_TYPE (result) = unknown_type_node;
@@ -1005,9 +914,7 @@ ovl_cons (decl, chain)
just return it; otherwise, ovl_cons the _DECLs */
tree
-build_overload (decl, chain)
- tree decl;
- tree chain;
+build_overload (tree decl, tree chain)
{
if (! chain && TREE_CODE (decl) != TEMPLATE_DECL)
return decl;
@@ -1016,43 +923,11 @@ build_overload (decl, chain)
return ovl_cons (decl, chain);
}
-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);
-}
-
-/* Returns nonzero if CODE is the code for a statement. */
-
-int
-cp_statement_code_p (code)
- enum tree_code code;
-{
- switch (code)
- {
- case CTOR_INITIALIZER:
- case RETURN_INIT:
- case TRY_BLOCK:
- case HANDLER:
- case EH_SPEC_BLOCK:
- case USING_STMT:
- case TAG_DEFN:
- return 1;
-
- default:
- return 0;
- }
-}
#define PRINT_RING_SIZE 4
const char *
-cxx_printable_name (decl, v)
- tree decl;
- int v;
+cxx_printable_name (tree decl, int v)
{
static tree decl_ring[PRINT_RING_SIZE];
static char *print_ring[PRINT_RING_SIZE];
@@ -1096,16 +971,15 @@ cxx_printable_name (decl, v)
listed in RAISES. */
tree
-build_exception_variant (type, raises)
- tree type;
- tree raises;
+build_exception_variant (tree type, tree raises)
{
tree v = TYPE_MAIN_VARIANT (type);
int type_quals = TYPE_QUALS (type);
for (; v; v = TYPE_NEXT_VARIANT (v))
if (TYPE_QUALS (v) == type_quals
- && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1))
+ && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1)
+ && (*targetm.comp_type_attributes) (type, v))
return v;
/* Need to build a new variant. */
@@ -1119,9 +993,7 @@ build_exception_variant (type, raises)
arguments. */
tree
-bind_template_template_parm (t, newargs)
- tree t;
- tree newargs;
+bind_template_template_parm (tree t, tree newargs)
{
tree decl = TYPE_NAME (t);
tree t2;
@@ -1148,10 +1020,9 @@ bind_template_template_parm (t, newargs)
/* Called from count_trees via walk_tree. */
static tree
-count_trees_r (tp, walk_subtrees, data)
- tree *tp ATTRIBUTE_UNUSED;
- int *walk_subtrees ATTRIBUTE_UNUSED;
- void *data;
+count_trees_r (tree* tp ATTRIBUTE_UNUSED ,
+ int* walk_subtrees ATTRIBUTE_UNUSED ,
+ void* data)
{
++ *((int*) data);
return NULL_TREE;
@@ -1161,8 +1032,7 @@ count_trees_r (tp, walk_subtrees, data)
representation. */
int
-count_trees (t)
- tree t;
+count_trees (tree t)
{
int n_trees = 0;
walk_tree_without_duplicates (&t, count_trees_r, &n_trees);
@@ -1172,16 +1042,15 @@ count_trees (t)
/* 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;
+verify_stmt_tree_r (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)))
+ if (!STATEMENT_CODE_P (TREE_CODE (t)))
return NULL_TREE;
/* If this statement is already present in the hash table, then
@@ -1200,8 +1069,7 @@ verify_stmt_tree_r (tp, walk_subtrees, data)
circularities. */
void
-verify_stmt_tree (t)
- tree t;
+verify_stmt_tree (tree t)
{
htab_t statements;
statements = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL);
@@ -1212,10 +1080,9 @@ verify_stmt_tree (t)
/* Called from find_tree via walk_tree. */
static tree
-find_tree_r (tp, walk_subtrees, data)
- tree *tp;
- int *walk_subtrees ATTRIBUTE_UNUSED;
- void *data;
+find_tree_r (tree* tp,
+ int* walk_subtrees ATTRIBUTE_UNUSED ,
+ void* data)
{
if (*tp == (tree) data)
return (tree) data;
@@ -1226,9 +1093,7 @@ find_tree_r (tp, walk_subtrees, data)
/* Returns X if X appears in the tree structure rooted at T. */
tree
-find_tree (t, x)
- tree t;
- tree x;
+find_tree (tree t, tree x)
{
return walk_tree_without_duplicates (&t, find_tree_r, x);
}
@@ -1236,10 +1101,9 @@ find_tree (t, x)
/* Passed to walk_tree. Checks for the use of types with no linkage. */
static tree
-no_linkage_helper (tp, walk_subtrees, data)
- tree *tp;
- int *walk_subtrees ATTRIBUTE_UNUSED;
- void *data ATTRIBUTE_UNUSED;
+no_linkage_helper (tree* tp,
+ int* walk_subtrees ATTRIBUTE_UNUSED ,
+ void* data ATTRIBUTE_UNUSED )
{
tree t = *tp;
@@ -1255,8 +1119,7 @@ no_linkage_helper (tp, walk_subtrees, data)
it. */
tree
-no_linkage_check (t)
- tree t;
+no_linkage_check (tree t)
{
/* There's no point in checking linkage on template functions; we
can't know their complete types. */
@@ -1274,7 +1137,7 @@ extern int depth_reached;
#endif
void
-cxx_print_statistics ()
+cxx_print_statistics (void)
{
print_search_statistics ();
print_class_statistics ();
@@ -1289,8 +1152,7 @@ cxx_print_statistics ()
array. */
tree
-array_type_nelts_top (type)
- tree type;
+array_type_nelts_top (tree type)
{
return fold (build (PLUS_EXPR, sizetype,
array_type_nelts (type),
@@ -1302,8 +1164,7 @@ array_type_nelts_top (type)
ARRAY_TYPEs that are clumped together. */
tree
-array_type_nelts_total (type)
- tree type;
+array_type_nelts_total (tree type)
{
tree sz = array_type_nelts_top (type);
type = TREE_TYPE (type);
@@ -1319,10 +1180,7 @@ array_type_nelts_total (type)
/* Called from break_out_target_exprs via mapcar. */
static tree
-bot_manip (tp, walk_subtrees, data)
- tree *tp;
- int *walk_subtrees;
- void *data;
+bot_manip (tree* tp, int* walk_subtrees, void* data)
{
splay_tree target_remap = ((splay_tree) data);
tree t = *tp;
@@ -1376,10 +1234,9 @@ bot_manip (tp, walk_subtrees, data)
variables. */
static tree
-bot_replace (t, walk_subtrees, data)
- tree *t;
- int *walk_subtrees ATTRIBUTE_UNUSED;
- void *data;
+bot_replace (tree* t,
+ int* walk_subtrees ATTRIBUTE_UNUSED ,
+ void* data)
{
splay_tree target_remap = ((splay_tree) data);
@@ -1400,8 +1257,7 @@ bot_replace (t, walk_subtrees, data)
we must replace the temporaries with appropriate local versions. */
tree
-break_out_target_exprs (t)
- tree t;
+break_out_target_exprs (tree t)
{
static int target_remap_count;
static splay_tree target_remap;
@@ -1422,25 +1278,22 @@ break_out_target_exprs (t)
return t;
}
-/* Obstack used for allocating nodes in template function and variable
- definitions. */
-
-/* Similar to `build_nt', except that we set TREE_COMPLEXITY to be the
- current line number. */
+/* Similar to `build_nt', but for template definitions of dependent
+ expressions */
tree
-build_min_nt VPARAMS ((enum tree_code code, ...))
+build_min_nt (enum tree_code code, ...)
{
- register tree t;
- register int length;
- register int i;
+ tree t;
+ int length;
+ int i;
+ va_list p;
- VA_OPEN (p, code);
- VA_FIXEDARG (p, enum tree_code, code);
+ va_start (p, code);
t = make_node (code);
length = TREE_CODE_LENGTH (code);
- TREE_COMPLEXITY (t) = lineno;
+ TREE_COMPLEXITY (t) = input_line;
for (i = 0; i < length; i++)
{
@@ -1448,28 +1301,58 @@ build_min_nt VPARAMS ((enum tree_code code, ...))
TREE_OPERAND (t, i) = x;
}
- VA_CLOSE (p);
+ va_end (p);
return t;
}
-/* Similar to `build', except we set TREE_COMPLEXITY to the current
- line-number. */
+/* Similar to `build', but for template definitions. */
tree
-build_min VPARAMS ((enum tree_code code, tree tt, ...))
+build_min (enum tree_code code, tree tt, ...)
{
- register tree t;
- register int length;
- register int i;
+ tree t;
+ int length;
+ int i;
+ va_list p;
- VA_OPEN (p, tt);
- VA_FIXEDARG (p, enum tree_code, code);
- VA_FIXEDARG (p, tree, tt);
+ va_start (p, tt);
t = make_node (code);
length = TREE_CODE_LENGTH (code);
TREE_TYPE (t) = tt;
- TREE_COMPLEXITY (t) = lineno;
+ TREE_COMPLEXITY (t) = input_line;
+
+ for (i = 0; i < length; i++)
+ {
+ tree x = va_arg (p, tree);
+ TREE_OPERAND (t, i) = x;
+ if (x && TREE_SIDE_EFFECTS (x))
+ TREE_SIDE_EFFECTS (t) = 1;
+ }
+
+ va_end (p);
+ return t;
+}
+
+/* Similar to `build', but for template definitions of non-dependent
+ expressions. NON_DEP is the non-dependent expression that has been
+ built. */
+
+tree
+build_min_non_dep (enum tree_code code, tree non_dep, ...)
+{
+ tree t;
+ int length;
+ int i;
+ va_list p;
+
+ va_start (p, non_dep);
+
+ t = make_node (code);
+ length = TREE_CODE_LENGTH (code);
+ TREE_TYPE (t) = TREE_TYPE (non_dep);
+ TREE_COMPLEXITY (t) = input_line;
+ TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (non_dep);
for (i = 0; i < length; i++)
{
@@ -1477,7 +1360,12 @@ build_min VPARAMS ((enum tree_code code, tree tt, ...))
TREE_OPERAND (t, i) = x;
}
- VA_CLOSE (p);
+ if (code == COMPOUND_EXPR && TREE_CODE (non_dep) != COMPOUND_EXPR)
+ /* This should not be considered a COMPOUND_EXPR, because it
+ resolves to an overload. */
+ COMPOUND_EXPR_OVERLOADED (t) = 1;
+
+ va_end (p);
return t;
}
@@ -1489,8 +1377,7 @@ build_min VPARAMS ((enum tree_code code, tree tt, ...))
static GTY(()) tree shared_int_cache[256];
tree
-build_shared_int_cst (i)
- int i;
+build_shared_int_cst (int i)
{
if (i >= 256)
return build_int_2 (i, 0);
@@ -1502,8 +1389,7 @@ build_shared_int_cst (i)
}
tree
-get_type_decl (t)
- tree t;
+get_type_decl (tree t)
{
if (TREE_CODE (t) == TYPE_DECL)
return t;
@@ -1522,8 +1408,7 @@ get_type_decl (t)
Return 0 if ELEM is not in VEC. VEC may be NULL_TREE. */
tree
-vec_binfo_member (elem, vec)
- tree elem, vec;
+vec_binfo_member (tree elem, tree vec)
{
int i;
@@ -1539,8 +1424,7 @@ vec_binfo_member (elem, vec)
indirectly. */
tree
-decl_namespace_context (decl)
- tree decl;
+decl_namespace_context (tree decl)
{
while (1)
{
@@ -1554,39 +1438,35 @@ decl_namespace_context (decl)
}
/* Return truthvalue of whether T1 is the same tree structure as T2.
- Return 1 if they are the same.
- Return 0 if they are understandably different.
- Return -1 if either contains tree structure not understood by
- this function. */
+ Return 1 if they are the same. Return 0 if they are different. */
-int
-cp_tree_equal (t1, t2)
- tree t1, t2;
+bool
+cp_tree_equal (tree t1, tree t2)
{
- register enum tree_code code1, code2;
- int cmp;
+ enum tree_code code1, code2;
if (t1 == t2)
- return 1;
- if (t1 == 0 || t2 == 0)
- return 0;
-
- code1 = TREE_CODE (t1);
- code2 = TREE_CODE (t2);
-
- if (code1 == NOP_EXPR || code1 == CONVERT_EXPR || code1 == NON_LVALUE_EXPR)
- {
- if (code2 == NOP_EXPR || code2 == CONVERT_EXPR || code2 == NON_LVALUE_EXPR)
- return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- else
- return cp_tree_equal (TREE_OPERAND (t1, 0), t2);
- }
- else if (code2 == NOP_EXPR || code2 == CONVERT_EXPR
- || code2 == NON_LVALUE_EXPR)
- return cp_tree_equal (t1, TREE_OPERAND (t2, 0));
-
+ return true;
+ if (!t1 || !t2)
+ return false;
+
+ for (code1 = TREE_CODE (t1);
+ code1 == NOP_EXPR || code1 == CONVERT_EXPR
+ || code1 == NON_LVALUE_EXPR;
+ code1 = TREE_CODE (t1))
+ t1 = TREE_OPERAND (t1, 0);
+ for (code2 = TREE_CODE (t2);
+ code2 == NOP_EXPR || code2 == CONVERT_EXPR
+ || code1 == NON_LVALUE_EXPR;
+ code2 = TREE_CODE (t2))
+ t2 = TREE_OPERAND (t2, 0);
+
+ /* They might have become equal now. */
+ if (t1 == t2)
+ return true;
+
if (code1 != code2)
- return 0;
+ return false;
switch (code1)
{
@@ -1600,7 +1480,7 @@ cp_tree_equal (t1, t2)
case STRING_CST:
return TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2)
&& !memcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2),
- TREE_STRING_LENGTH (t1));
+ TREE_STRING_LENGTH (t1));
case CONSTRUCTOR:
/* We need to do this when determining whether or not two
@@ -1609,61 +1489,62 @@ cp_tree_equal (t1, t2)
if (!(same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))
/* The first operand is RTL. */
&& TREE_OPERAND (t1, 0) == TREE_OPERAND (t2, 0)))
- return 0;
+ return false;
return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
case TREE_LIST:
- cmp = cp_tree_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2));
- if (cmp <= 0)
- return cmp;
- cmp = cp_tree_equal (TREE_VALUE (t1), TREE_VALUE (t2));
- if (cmp <= 0)
- return cmp;
+ if (!cp_tree_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2)))
+ return false;
+ if (!cp_tree_equal (TREE_VALUE (t1), TREE_VALUE (t2)))
+ return false;
return cp_tree_equal (TREE_CHAIN (t1), TREE_CHAIN (t2));
case SAVE_EXPR:
return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
case CALL_EXPR:
- cmp = cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- if (cmp <= 0)
- return cmp;
- return simple_cst_list_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
-
- case TARGET_EXPR:
- /* Special case: if either target is an unallocated VAR_DECL,
- it means that it's going to be unified with whatever the
- TARGET_EXPR is really supposed to initialize, so treat it
- as being equivalent to anything. */
- if ((TREE_CODE (TREE_OPERAND (t1, 0)) == VAR_DECL
- && DECL_NAME (TREE_OPERAND (t1, 0)) == NULL_TREE
- && !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_SET_P (TREE_OPERAND (t2, 0))))
- cmp = 1;
- else
- cmp = cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- if (cmp <= 0)
- return cmp;
+ if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)))
+ return false;
return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
+ case TARGET_EXPR:
+ {
+ tree o1 = TREE_OPERAND (t1, 0);
+ tree o2 = TREE_OPERAND (t2, 0);
+
+ /* Special case: if either target is an unallocated VAR_DECL,
+ it means that it's going to be unified with whatever the
+ TARGET_EXPR is really supposed to initialize, so treat it
+ as being equivalent to anything. */
+ if (TREE_CODE (o1) == VAR_DECL && DECL_NAME (o1) == NULL_TREE
+ && !DECL_RTL_SET_P (o1))
+ /*Nop*/;
+ else if (TREE_CODE (o2) == VAR_DECL && DECL_NAME (o2) == NULL_TREE
+ && !DECL_RTL_SET_P (o2))
+ /*Nop*/;
+ else if (!cp_tree_equal (o1, o2))
+ return false;
+
+ return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
+ }
+
case WITH_CLEANUP_EXPR:
- cmp = cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- if (cmp <= 0)
- return cmp;
+ if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)))
+ return false;
return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t1, 1));
case COMPONENT_REF:
- if (TREE_OPERAND (t1, 1) == TREE_OPERAND (t2, 1))
- return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- return 0;
+ if (TREE_OPERAND (t1, 1) != TREE_OPERAND (t2, 1))
+ return false;
+ return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
case VAR_DECL:
case PARM_DECL:
case CONST_DECL:
case FUNCTION_DECL:
- return 0;
+ case TEMPLATE_DECL:
+ case IDENTIFIER_NODE:
+ return false;
case TEMPLATE_PARM_INDEX:
return (TEMPLATE_PARM_IDX (t1) == TEMPLATE_PARM_IDX (t2)
@@ -1671,19 +1552,51 @@ cp_tree_equal (t1, t2)
&& same_type_p (TREE_TYPE (TEMPLATE_PARM_DECL (t1)),
TREE_TYPE (TEMPLATE_PARM_DECL (t2))));
+ case TEMPLATE_ID_EXPR:
+ {
+ unsigned ix;
+ tree vec1, vec2;
+
+ if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)))
+ return false;
+ vec1 = TREE_OPERAND (t1, 1);
+ vec2 = TREE_OPERAND (t2, 1);
+
+ if (!vec1 || !vec2)
+ return !vec1 && !vec2;
+
+ if (TREE_VEC_LENGTH (vec1) != TREE_VEC_LENGTH (vec2))
+ return false;
+
+ for (ix = TREE_VEC_LENGTH (vec1); ix--;)
+ if (!cp_tree_equal (TREE_VEC_ELT (vec1, ix),
+ TREE_VEC_ELT (vec2, ix)))
+ return false;
+
+ return true;
+ }
+
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
- if (TREE_CODE (TREE_OPERAND (t1, 0)) != TREE_CODE (TREE_OPERAND (t2, 0)))
- return 0;
- if (TYPE_P (TREE_OPERAND (t1, 0)))
- return same_type_p (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- break;
-
+ {
+ tree o1 = TREE_OPERAND (t1, 0);
+ tree o2 = TREE_OPERAND (t2, 0);
+
+ if (TREE_CODE (o1) != TREE_CODE (o2))
+ return false;
+ if (TYPE_P (o1))
+ return same_type_p (o1, o2);
+ else
+ return cp_tree_equal (o1, o2);
+ }
+
case PTRMEM_CST:
/* Two pointer-to-members are the same if they point to the same
field or function in the same class. */
- return (PTRMEM_CST_MEMBER (t1) == PTRMEM_CST_MEMBER (t2)
- && same_type_p (PTRMEM_CST_CLASS (t1), PTRMEM_CST_CLASS (t2)));
+ if (PTRMEM_CST_MEMBER (t1) != PTRMEM_CST_MEMBER (t2))
+ return false;
+
+ return same_type_p (PTRMEM_CST_CLASS (t1), PTRMEM_CST_CLASS (t2));
default:
break;
@@ -1700,64 +1613,38 @@ cp_tree_equal (t1, t2)
{
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;
+ if (!cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i)))
+ return false;
+
+ return true;
}
- case 't':
- return same_type_p (t1, t2) ? 1 : 0;
+ case 't':
+ return same_type_p (t1, t2);
}
- return -1;
+ my_friendly_assert (0, 20030617);
+ return false;
}
/* Build a wrapper around a 'struct z_candidate' so we can use it as a
tree. */
tree
-build_zc_wrapper (ptr)
- struct z_candidate *ptr;
+build_zc_wrapper (struct z_candidate* ptr)
{
tree t = make_node (WRAPPER);
WRAPPER_ZC (t) = ptr;
return t;
}
-static tree
-build_srcloc (file, line)
- const char *file;
- int line;
-{
- tree t;
-
- t = make_node (SRCLOC);
- SRCLOC_FILE (t) = file;
- SRCLOC_LINE (t) = line;
-
- return t;
-}
-
-tree
-build_srcloc_here ()
-{
- return build_srcloc (input_filename, lineno);
-}
-
/* The type of ARG when used as an lvalue. */
tree
-lvalue_type (arg)
- tree arg;
+lvalue_type (tree arg)
{
tree type = TREE_TYPE (arg);
- if (TREE_CODE (arg) == OVERLOAD)
- type = unknown_type_node;
return type;
}
@@ -1765,12 +1652,14 @@ lvalue_type (arg)
reference types. */
tree
-error_type (arg)
- tree arg;
+error_type (tree arg)
{
tree type = TREE_TYPE (arg);
+
if (TREE_CODE (type) == ARRAY_TYPE)
;
+ else if (TREE_CODE (type) == ERROR_MARK)
+ ;
else if (real_lvalue_p (arg))
type = build_reference_type (lvalue_type (arg));
else if (IS_AGGR_TYPE (type))
@@ -1782,8 +1671,7 @@ error_type (arg)
/* Does FUNCTION use a variable-length argument list? */
int
-varargs_function_p (function)
- tree function;
+varargs_function_p (tree function)
{
tree parm = TYPE_ARG_TYPES (TREE_TYPE (function));
for (; parm; parm = TREE_CHAIN (parm))
@@ -1795,8 +1683,7 @@ varargs_function_p (function)
/* Returns 1 if decl is a member of a class. */
int
-member_p (decl)
- tree decl;
+member_p (tree decl)
{
const tree ctx = DECL_CONTEXT (decl);
return (ctx && TYPE_P (ctx));
@@ -1806,8 +1693,7 @@ member_p (decl)
object that the access is against. */
tree
-build_dummy_object (type)
- tree type;
+build_dummy_object (tree type)
{
tree decl = build1 (NOP_EXPR, build_pointer_type (type), void_zero_node);
return build_indirect_ref (decl, NULL);
@@ -1818,9 +1704,7 @@ build_dummy_object (type)
binfo path from current_class_type to TYPE, or 0. */
tree
-maybe_dummy_object (type, binfop)
- tree type;
- tree *binfop;
+maybe_dummy_object (tree type, tree* binfop)
{
tree decl, context;
tree binfo;
@@ -1855,8 +1739,7 @@ maybe_dummy_object (type, binfop)
/* Returns 1 if OB is a placeholder object, or a pointer to one. */
int
-is_dummy_object (ob)
- tree ob;
+is_dummy_object (tree ob)
{
if (TREE_CODE (ob) == INDIRECT_REF)
ob = TREE_OPERAND (ob, 0);
@@ -1867,8 +1750,7 @@ is_dummy_object (ob)
/* Returns 1 iff type T is a POD type, as defined in [basic.types]. */
int
-pod_type_p (t)
- tree t;
+pod_type_p (tree t)
{
t = strip_array_types (t);
@@ -1880,10 +1762,8 @@ pod_type_p (t)
return 1;
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 (TYPE_PTR_TO_MEMBER_P (t))
+ return 1; /* pointer to member */
if (! CLASS_TYPE_P (t))
return 0; /* other non-class type (reference or function) */
@@ -1896,8 +1776,7 @@ pod_type_p (t)
zeros in it. */
int
-zero_init_p (t)
- tree t;
+zero_init_p (tree t)
{
t = strip_array_types (t);
@@ -1929,12 +1808,11 @@ const struct attribute_spec cxx_attribute_table[] =
/* 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;
+handle_java_interface_attribute (tree* node,
+ tree name,
+ tree args ATTRIBUTE_UNUSED ,
+ int flags,
+ bool* no_add_attrs)
{
if (DECL_P (*node)
|| !CLASS_TYPE_P (*node)
@@ -1955,12 +1833,11 @@ handle_java_interface_attribute (node, name, args, flags, no_add_attrs)
/* 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;
+handle_com_interface_attribute (tree* node,
+ tree name,
+ tree args ATTRIBUTE_UNUSED ,
+ int flags ATTRIBUTE_UNUSED ,
+ bool* no_add_attrs)
{
static int warned;
@@ -1985,12 +1862,11 @@ handle_com_interface_attribute (node, name, args, flags, no_add_attrs)
/* 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;
+handle_init_priority_attribute (tree* node,
+ tree name,
+ tree args,
+ int flags ATTRIBUTE_UNUSED ,
+ bool* no_add_attrs)
{
tree initp_expr = TREE_VALUE (args);
tree decl = *node;
@@ -2061,9 +1937,7 @@ handle_init_priority_attribute (node, name, args, flags, no_add_attrs)
thing pointed to by the constant. */
tree
-make_ptrmem_cst (type, member)
- tree type;
- tree member;
+make_ptrmem_cst (tree type, tree member)
{
tree ptrmem_cst = make_node (PTRMEM_CST);
/* If would seem a great convenience if make_node would set
@@ -2074,16 +1948,32 @@ make_ptrmem_cst (type, member)
return ptrmem_cst;
}
+/* Build a variant of TYPE that has the indicated ATTRIBUTES. May
+ return an existing type of an appropriate type already exists. */
+
+tree
+cp_build_type_attribute_variant (tree type, tree attributes)
+{
+ tree new_type;
+
+ new_type = build_type_attribute_variant (type, attributes);
+ if (TREE_CODE (new_type) == FUNCTION_TYPE
+ && (TYPE_RAISES_EXCEPTIONS (new_type)
+ != TYPE_RAISES_EXCEPTIONS (type)))
+ new_type = build_exception_variant (new_type,
+ TYPE_RAISES_EXCEPTIONS (type));
+ return new_type;
+}
+
/* 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;
+cp_walk_subtrees (tree* tp,
+ int* walk_subtrees_p,
+ walk_tree_fn func,
+ void* data,
+ void* htab)
{
enum tree_code code = TREE_CODE (*tp);
tree result;
@@ -2109,7 +1999,8 @@ cp_walk_subtrees (tp, walk_subtrees_p, func, data, htab)
case TEMPLATE_TYPE_PARM:
case TYPENAME_TYPE:
case TYPEOF_TYPE:
- /* None of thse have subtrees other than those already walked
+ case BASELINK:
+ /* None of these have subtrees other than those already walked
above. */
*walk_subtrees_p = 0;
break;
@@ -2120,9 +2011,7 @@ cp_walk_subtrees (tp, walk_subtrees_p, func, data, htab)
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));
+ WALK_SUBTREE (TREE_PURPOSE (*tp));
break;
case OVERLOAD:
@@ -2150,25 +2039,31 @@ cp_walk_subtrees (tp, walk_subtrees_p, func, data, htab)
function as a tree. */
int
-cp_cannot_inline_tree_fn (fnp)
- tree *fnp;
+cp_cannot_inline_tree_fn (tree* fnp)
{
tree fn = *fnp;
- if (flag_really_no_inline
- && lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) == NULL)
- return 1;
-
/* 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)))
{
+ /* Don't instantiate functions that are not going to be
+ inlined. */
+ if (!DECL_INLINE (DECL_TEMPLATE_RESULT
+ (template_for_substitution (fn))))
+ return 1;
+
fn = *fnp = instantiate_decl (fn, /*defer_ok=*/0);
+
if (TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
return 1;
}
+ if (flag_really_no_inline
+ && lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) == NULL)
+ return 1;
+
/* Don't auto-inline anything that might not be bound within
this unit of translation. */
if (!DECL_DECLARED_INLINE_P (fn) && !(*targetm.binds_local_p) (fn))
@@ -2197,9 +2092,7 @@ cp_cannot_inline_tree_fn (fnp)
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;
+cp_add_pending_fn_decls (void* fns_p, tree prev_fn)
{
varray_type *fnsp = (varray_type *)fns_p;
struct saved_scope *s;
@@ -2219,8 +2112,7 @@ cp_add_pending_fn_decls (fns_p, prev_fn)
function. */
int
-cp_is_overload_p (t)
- tree t;
+cp_is_overload_p (tree t)
{
return TREE_CODE (t) == OVERLOAD;
}
@@ -2229,8 +2121,7 @@ cp_is_overload_p (t)
function FN. */
int
-cp_auto_var_in_fn_p (var, fn)
- tree var, fn;
+cp_auto_var_in_fn_p (tree var, tree fn)
{
return (DECL_P (var) && DECL_CONTEXT (var) == fn
&& nonstatic_local_decl_p (var));
@@ -2241,34 +2132,33 @@ cp_auto_var_in_fn_p (var, fn)
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;
+cp_copy_res_decl_for_inlining (tree result,
+ tree fn,
+ tree caller,
+ void* decl_map_,
+ int* need_decl,
+ tree return_slot_addr)
{
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
+ /* If FN returns an aggregate then the caller will always pass the
+ address of the return slot explicitly. 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)
+
+ /* We should have an explicit return slot iff the return type is
+ TREE_ADDRESSABLE. See simplify_aggr_init_expr. */
+ if (TREE_ADDRESSABLE (TREE_TYPE (result))
+ != (return_slot_addr != NULL_TREE))
+ abort ();
+
+ *need_decl = !return_slot_addr;
+ if (return_slot_addr)
{
- if (VARRAY_ACTIVE_SIZE (*texps) == 0)
- abort ();
- var = TREE_OPERAND (VARRAY_TOP_TREE (*texps), 0);
+ var = build_indirect_ref (return_slot_addr, "");
if (! same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (var),
TREE_TYPE (result)))
abort ();
@@ -2285,13 +2175,19 @@ cp_copy_res_decl_for_inlining (result, fn, caller, decl_map_,
/* 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_LOCATION (var) = DECL_SOURCE_LOCATION (nrv);
- DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv);
- /* Don't lose initialization info. */
- DECL_INITIAL (var) = DECL_INITIAL (nrv);
- /* Don't forget that it needs to go in the stack. */
- TREE_ADDRESSABLE (var) = TREE_ADDRESSABLE (nrv);
+ if (TREE_CODE (var) == VAR_DECL
+ /* But not if we're initializing a variable from the
+ enclosing function which already has its own name. */
+ && DECL_NAME (var) == NULL_TREE)
+ {
+ DECL_NAME (var) = DECL_NAME (nrv);
+ DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (nrv);
+ DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv);
+ /* Don't lose initialization info. */
+ DECL_INITIAL (var) = DECL_INITIAL (nrv);
+ /* Don't forget that it needs to go in the stack. */
+ TREE_ADDRESSABLE (var) = TREE_ADDRESSABLE (nrv);
+ }
splay_tree_insert (decl_map,
(splay_tree_key) nrv,
@@ -2302,36 +2198,11 @@ cp_copy_res_decl_for_inlining (result, fn, caller, decl_map_,
return var;
}
-/* Record that we're about to start inlining FN, and return nonzero 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 ()
+init_tree (void)
{
- lang_statement_code_p = cp_statement_code_p;
list_hash_table = htab_create_ggc (31, list_hash, list_hash_eq, NULL);
}
@@ -2340,10 +2211,9 @@ init_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;
+mark_local_for_remap_r (tree* tp,
+ int* walk_subtrees ATTRIBUTE_UNUSED ,
+ void* data)
{
tree t = *tp;
splay_tree st = (splay_tree) data;
@@ -2386,10 +2256,9 @@ mark_local_for_remap_r (tp, walk_subtrees, data)
remaps all local declarations to appropriate replacements. */
static tree
-cp_unsave_r (tp, walk_subtrees, data)
- tree *tp;
- int *walk_subtrees;
- void *data;
+cp_unsave_r (tree* tp,
+ int* walk_subtrees,
+ void* data)
{
splay_tree st = (splay_tree) data;
splay_tree_node n;
@@ -2421,8 +2290,7 @@ cp_unsave_r (tp, walk_subtrees, data)
/* Called whenever an expression needs to be unsaved. */
tree
-cxx_unsave_expr_now (tp)
- tree tp;
+cxx_unsave_expr_now (tree tp)
{
splay_tree st;
@@ -2447,8 +2315,7 @@ cxx_unsave_expr_now (tp)
predicate to test whether or not DECL is a special function. */
special_function_kind
-special_function_p (decl)
- tree decl;
+special_function_p (tree decl)
{
/* Rather than doing all this stuff with magic names, we should
probably have a field of type `special_function_kind' in
@@ -2492,8 +2359,7 @@ name_p (tree node)
/* Returns nonzero if TYPE is a character type, including wchar_t. */
int
-char_type_p (type)
- tree type;
+char_type_p (tree type)
{
return (same_type_p (type, char_type_node)
|| same_type_p (type, unsigned_char_type_node)
@@ -2509,8 +2375,7 @@ char_type_p (type)
as a global symbol when you run `nm' on the resulting object file. */
linkage_kind
-decl_linkage (decl)
- tree decl;
+decl_linkage (tree decl)
{
/* This function doesn't attempt to calculate the linkage from first
principles as given in [basic.link]. Instead, it makes use of
@@ -2549,15 +2414,13 @@ decl_linkage (decl)
expression to use the precalculated result. */
tree
-stabilize_expr (exp, initp)
- tree exp;
- tree *initp;
+stabilize_expr (tree exp, tree* initp)
{
tree init_expr;
if (!TREE_SIDE_EFFECTS (exp))
{
- init_expr = void_zero_node;
+ init_expr = NULL_TREE;
}
else if (!real_lvalue_p (exp)
|| !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp)))
@@ -2576,16 +2439,87 @@ stabilize_expr (exp, initp)
*initp = init_expr;
return exp;
}
+
+/* Like stabilize_expr, but for a call whose args we want to
+ pre-evaluate. */
+
+void
+stabilize_call (tree call, tree *initp)
+{
+ tree inits = NULL_TREE;
+ tree t;
+
+ if (call == error_mark_node)
+ return;
+
+ if (TREE_CODE (call) != CALL_EXPR
+ && TREE_CODE (call) != AGGR_INIT_EXPR)
+ abort ();
+
+ for (t = TREE_OPERAND (call, 1); t; t = TREE_CHAIN (t))
+ if (TREE_SIDE_EFFECTS (TREE_VALUE (t)))
+ {
+ tree init;
+ TREE_VALUE (t) = stabilize_expr (TREE_VALUE (t), &init);
+ if (!init)
+ /* Nothing. */;
+ else if (inits)
+ inits = build (COMPOUND_EXPR, void_type_node, inits, init);
+ else
+ inits = init;
+ }
+
+ *initp = inits;
+}
+
+/* Like stabilize_expr, but for an initialization. If we are initializing
+ an object of class type, we don't want to introduce an extra temporary,
+ so we look past the TARGET_EXPR and stabilize the arguments of the call
+ instead. */
+
+bool
+stabilize_init (tree init, tree *initp)
+{
+ tree t = init;
+
+ if (t == error_mark_node)
+ return true;
+
+ if (TREE_CODE (t) == INIT_EXPR
+ && TREE_CODE (TREE_OPERAND (t, 1)) != TARGET_EXPR)
+ TREE_OPERAND (t, 1) = stabilize_expr (TREE_OPERAND (t, 1), initp);
+ else
+ {
+ if (TREE_CODE (t) == INIT_EXPR)
+ t = TREE_OPERAND (t, 1);
+ if (TREE_CODE (t) == TARGET_EXPR)
+ t = TARGET_EXPR_INITIAL (t);
+ if (TREE_CODE (t) == CONSTRUCTOR
+ && CONSTRUCTOR_ELTS (t) == NULL_TREE)
+ {
+ /* Default-initialization. */
+ *initp = NULL_TREE;
+ return true;
+ }
+
+ /* If the initializer is a COND_EXPR, we can't preevaluate
+ anything. */
+ if (TREE_CODE (t) == COND_EXPR)
+ return false;
+
+ stabilize_call (t, initp);
+ }
+
+ return true;
+}
+
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
/* Complain that some language-specific thing hanging off a tree
node has been accessed improperly. */
void
-lang_check_failed (file, line, function)
- const char *file;
- int line;
- const char *function;
+lang_check_failed (const char* file, int line, const char* function)
{
internal_error ("lang_* check: failed in %s, at %s:%d",
function, trim_filename (file), line);
diff --git a/contrib/gcc/cp/typeck.c b/contrib/gcc/cp/typeck.c
index 4b36cc2..5044db4 100644
--- a/contrib/gcc/cp/typeck.c
+++ b/contrib/gcc/cp/typeck.c
@@ -1,22 +1,22 @@
/* Build expressions with type checking for C++ compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -32,6 +32,8 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "rtl.h"
#include "expr.h"
@@ -42,43 +44,35 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "diagnostic.h"
#include "target.h"
-
-static tree convert_for_assignment PARAMS ((tree, tree, const char *, tree,
- int));
-static tree cp_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 PARAMS ((tree, tree));
-static tree lookup_anon_field PARAMS ((tree, tree));
-static tree pointer_diff PARAMS ((tree, 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));
+#include "convert.h"
+
+static tree convert_for_assignment (tree, tree, const char *, tree, int);
+static tree cp_pointer_int_sum (enum tree_code, tree, tree);
+static tree rationalize_conditional_expr (enum tree_code, tree);
+static int comp_ptr_ttypes_real (tree, tree, int);
+static int comp_ptr_ttypes_const (tree, tree);
+static bool comp_except_types (tree, tree, bool);
+static bool comp_array_types (tree, tree, bool);
+static tree common_base_type (tree, tree);
+static tree pointer_diff (tree, tree, tree);
+static tree get_delta_difference (tree, tree, int);
+static void casts_away_constness_r (tree *, tree *);
+static bool casts_away_constness (tree, tree);
+static void maybe_warn_about_returning_address_of_local (tree);
+static tree lookup_destructor (tree, tree, tree);
/* Return the target type of TYPE, which means return T for:
T*, T&, T[], T (...), and otherwise, just T. */
tree
-target_type (type)
- tree type;
+target_type (tree type)
{
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
+ type = non_reference (type);
while (TREE_CODE (type) == POINTER_TYPE
|| TREE_CODE (type) == ARRAY_TYPE
|| TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE
- || TREE_CODE (type) == OFFSET_TYPE)
+ || TYPE_PTRMEM_P (type))
type = TREE_TYPE (type);
return type;
}
@@ -89,8 +83,7 @@ target_type (type)
complete type when this function returns. */
tree
-require_complete_type (value)
- tree value;
+require_complete_type (tree value)
{
tree type;
@@ -106,17 +99,6 @@ require_complete_type (value)
if (COMPLETE_TYPE_P (type))
return value;
- /* If we see X::Y, we build an OFFSET_TYPE which has
- not been laid out. Try to avoid an error by interpreting
- it as this->X::Y, if reasonable. */
- if (TREE_CODE (value) == OFFSET_REF
- && current_class_ref != 0
- && TREE_OPERAND (value, 0) == current_class_ref)
- {
- value = resolve_offset_ref (value);
- return require_complete_type (value);
- }
-
if (complete_type_or_else (type, value))
return value;
else
@@ -129,8 +111,7 @@ require_complete_type (value)
horribly wrong, in which case the error_mark_node is returned. */
tree
-complete_type (type)
- tree type;
+complete_type (tree type)
{
if (type == NULL_TREE)
/* Rather than crash, we return something sure to cause an error
@@ -142,7 +123,7 @@ complete_type (type)
else if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type))
{
tree t = complete_type (TREE_TYPE (type));
- if (COMPLETE_TYPE_P (t) && ! processing_template_decl)
+ if (COMPLETE_TYPE_P (t) && !dependent_type_p (type))
layout_type (type);
TYPE_NEEDS_CONSTRUCTING (type)
= TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (t));
@@ -161,10 +142,7 @@ complete_type (type)
Returns NULL_TREE if the type cannot be made complete. */
tree
-complete_type_or_diagnostic (type, value, diag_type)
- tree type;
- tree value;
- int diag_type;
+complete_type_or_diagnostic (tree type, tree value, int diag_type)
{
type = complete_type (type);
if (type == error_mark_node)
@@ -182,58 +160,12 @@ complete_type_or_diagnostic (type, value, diag_type)
/* Return truthvalue of whether type of EXP is instantiated. */
int
-type_unknown_p (exp)
- tree exp;
+type_unknown_p (tree exp)
{
- return (TREE_CODE (exp) == OVERLOAD
- || TREE_CODE (exp) == TREE_LIST
- || TREE_TYPE (exp) == unknown_type_node
- || (TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE
- && TREE_TYPE (TREE_TYPE (exp)) == unknown_type_node));
+ return (TREE_CODE (exp) == TREE_LIST
+ || TREE_TYPE (exp) == unknown_type_node);
}
-/* 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]. */
-
-static tree
-qualify_type_recursive (t1, t2)
- tree t1, t2;
-{
- if ((TYPE_PTR_P (t1) && TYPE_PTR_P (t2))
- || (TYPE_PTRMEM_P (t1) && TYPE_PTRMEM_P (t2)))
- {
- tree tt1;
- tree tt2;
- tree b1;
- int type_quals;
- tree tgt;
- tree attributes = (*targetm.merge_type_attributes) (t1, t2);
-
- if (TYPE_PTRMEM_P (t1))
- {
- b1 = TYPE_PTRMEM_CLASS_TYPE (t1);
- tt1 = TYPE_PTRMEM_POINTED_TO_TYPE (t1);
- tt2 = TYPE_PTRMEM_POINTED_TO_TYPE (t2);
- }
- else
- {
- b1 = NULL_TREE;
- tt1 = TREE_TYPE (t1);
- tt2 = TREE_TYPE (t2);
- }
-
- 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)
- t1 = build_ptrmem_type (b1, tgt);
- else
- t1 = build_pointer_type (tgt);
- t1 = build_type_attribute_variant (t1, attributes);
- }
- return t1;
-}
/* Return the common type of two parameter lists.
We assume that comptypes has already been done and returned 1;
@@ -243,8 +175,7 @@ qualify_type_recursive (t1, t2)
lists are already common. */
tree
-commonparms (p1, p2)
- tree p1, p2;
+commonparms (tree p1, tree p2)
{
tree oldargs = p1, newargs, n;
int i, len;
@@ -305,8 +236,7 @@ commonparms (p1, p2)
/* Given a type, perhaps copied for a typedef,
find the "original" version of it. */
tree
-original_type (t)
- tree t;
+original_type (tree t)
{
while (TYPE_NAME (t) != NULL_TREE)
{
@@ -326,9 +256,7 @@ original_type (t)
T2 as described in [expr]. */
tree
-type_after_usual_arithmetic_conversions (t1, t2)
- tree t1;
- tree t2;
+type_after_usual_arithmetic_conversions (tree t1, tree t2)
{
enum tree_code code1 = TREE_CODE (t1);
enum tree_code code2 = TREE_CODE (t2);
@@ -466,20 +394,86 @@ type_after_usual_arithmetic_conversions (t1, t2)
}
}
+/* Subroutine of composite_pointer_type to implement the recursive
+ case. See that function for documentation fo the parameters. */
+
+static tree
+composite_pointer_type_r (tree t1, tree t2, const char* location)
+{
+ tree pointee1;
+ tree pointee2;
+ tree result_type;
+ tree attributes;
+
+ /* Determine the types pointed to by T1 and T2. */
+ if (TREE_CODE (t1) == POINTER_TYPE)
+ {
+ pointee1 = TREE_TYPE (t1);
+ pointee2 = TREE_TYPE (t2);
+ }
+ else
+ {
+ pointee1 = TYPE_PTRMEM_POINTED_TO_TYPE (t1);
+ pointee2 = TYPE_PTRMEM_POINTED_TO_TYPE (t2);
+ }
+
+ /* [expr.rel]
+
+ Otherwise, the composite pointer type is a pointer type
+ similar (_conv.qual_) to the type of one of the operands,
+ with a cv-qualification signature (_conv.qual_) that is the
+ union of the cv-qualification signatures of the operand
+ types. */
+ if (same_type_ignoring_top_level_qualifiers_p (pointee1, pointee2))
+ result_type = pointee1;
+ else if ((TREE_CODE (pointee1) == POINTER_TYPE
+ && TREE_CODE (pointee2) == POINTER_TYPE)
+ || (TYPE_PTR_TO_MEMBER_P (pointee1)
+ && TYPE_PTR_TO_MEMBER_P (pointee2)))
+ result_type = composite_pointer_type_r (pointee1, pointee2, location);
+ else
+ {
+ pedwarn ("%s between distinct pointer types `%T' and `%T' "
+ "lacks a cast",
+ location, t1, t2);
+ result_type = void_type_node;
+ }
+ result_type = cp_build_qualified_type (result_type,
+ (cp_type_quals (pointee1)
+ | cp_type_quals (pointee2)));
+ /* If the original types were pointers to members, so is the
+ result. */
+ if (TYPE_PTR_TO_MEMBER_P (t1))
+ {
+ if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
+ TYPE_PTRMEM_CLASS_TYPE (t2)))
+ pedwarn ("%s between distinct pointer types `%T' and `%T' "
+ "lacks a cast",
+ location, t1, t2);
+ result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1),
+ result_type);
+ }
+ else
+ result_type = build_pointer_type (result_type);
+
+ /* Merge the attributes. */
+ attributes = (*targetm.merge_type_attributes) (t1, t2);
+ return build_type_attribute_variant (result_type, 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. */
+ string describing the current location, in case an error occurs.
+
+ This routine also implements the computation of a common type for
+ pointers-to-members as per [expr.eq]. */
tree
-composite_pointer_type (t1, t2, arg1, arg2, location)
- tree t1;
- tree t2;
- tree arg1;
- tree arg2;
- const char* location;
+composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
+ const char* location)
{
- tree result_type;
- tree attributes;
+ tree class1;
+ tree class2;
/* [expr.rel]
@@ -490,16 +484,6 @@ composite_pointer_type (t1, t2, arg1, arg2, location)
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);
-
- /* Merge the attributes. */
- attributes = (*targetm.merge_type_attributes) (t1, t2);
-
/* We have:
[expr.rel]
@@ -510,45 +494,78 @@ composite_pointer_type (t1, t2, arg1, arg2, location)
and cv2.
If either type is a pointer to void, make sure it is T1. */
- if (VOID_TYPE_P (TREE_TYPE (t2)))
+ if (TREE_CODE (t2) == POINTER_TYPE && 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 (TREE_CODE (t1) == POINTER_TYPE && VOID_TYPE_P (TREE_TYPE (t1)))
{
+ tree attributes;
+ tree result_type;
+
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
+ = cp_build_qualified_type (void_type_node,
+ (cp_type_quals (TREE_TYPE (t1))
+ | cp_type_quals (TREE_TYPE (t2))));
result_type = build_pointer_type (result_type);
+ /* Merge the attributes. */
+ attributes = (*targetm.merge_type_attributes) (t1, t2);
+ return build_type_attribute_variant (result_type, attributes);
+ }
+
+ /* [expr.eq] permits the application of a pointer conversion to
+ bring the pointers to a common type. */
+ if (TREE_CODE (t1) == POINTER_TYPE && TREE_CODE (t2) == POINTER_TYPE
+ && CLASS_TYPE_P (TREE_TYPE (t1))
+ && CLASS_TYPE_P (TREE_TYPE (t2))
+ && !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (t1),
+ TREE_TYPE (t2)))
+ {
+ class1 = TREE_TYPE (t1);
+ class2 = TREE_TYPE (t2);
+
+ if (DERIVED_FROM_P (class1, class2))
+ t2 = (build_pointer_type
+ (cp_build_qualified_type (class1, TYPE_QUALS (class2))));
+ else if (DERIVED_FROM_P (class2, class1))
+ t1 = (build_pointer_type
+ (cp_build_qualified_type (class2, TYPE_QUALS (class1))));
+ else
+ {
+ error ("%s between distinct pointer types `%T' and `%T' "
+ "lacks a cast", location, t1, t2);
+ return error_mark_node;
+ }
}
- else
+ /* [expr.eq] permits the application of a pointer-to-member
+ conversion to change the class type of one of the types. */
+ else if (TYPE_PTR_TO_MEMBER_P (t1)
+ && !same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
+ TYPE_PTRMEM_CLASS_TYPE (t2)))
{
- tree full1 = qualify_type_recursive (t1, t2);
- tree full2 = qualify_type_recursive (t2, t1);
+ class1 = TYPE_PTRMEM_CLASS_TYPE (t1);
+ class2 = TYPE_PTRMEM_CLASS_TYPE (t2);
- int val = comp_target_types (full1, full2, 1);
-
- if (val > 0)
- result_type = full1;
- else if (val < 0)
- result_type = full2;
+ if (DERIVED_FROM_P (class1, class2))
+ t1 = build_ptrmem_type (class2, TYPE_PTRMEM_POINTED_TO_TYPE (t1));
+ else if (DERIVED_FROM_P (class2, class1))
+ t2 = build_ptrmem_type (class1, TYPE_PTRMEM_POINTED_TO_TYPE (t2));
else
{
- pedwarn ("%s between distinct pointer types `%T' and `%T' lacks a cast",
- location, t1, t2);
- result_type = ptr_type_node;
+ error ("%s between distinct pointer-to-member types `%T' and `%T' "
+ "lacks a cast", location, t1, t2);
+ return error_mark_node;
}
}
- return build_type_attribute_variant (result_type, attributes);
+ return composite_pointer_type_r (t1, t2, location);
}
/* Return the merged type of two types.
@@ -559,11 +576,10 @@ composite_pointer_type (t1, t2, arg1, arg2, location)
differences would cause the two types to compare unalike. */
tree
-merge_types (t1, t2)
- tree t1, t2;
+merge_types (tree t1, tree t2)
{
- register enum tree_code code1;
- register enum tree_code code2;
+ enum tree_code code1;
+ enum tree_code code2;
tree attributes;
/* Save time if the two types are the same. */
@@ -581,8 +597,6 @@ merge_types (t1, t2)
/* Merge the attributes. */
attributes = (*targetm.merge_type_attributes) (t1, t2);
- /* Treat an enum type as the unsigned integer type of the same width. */
-
if (TYPE_PTRMEMFUNC_P (t1))
t1 = TYPE_PTRMEMFUNC_FN_TYPE (t1);
if (TYPE_PTRMEMFUNC_P (t2))
@@ -615,9 +629,14 @@ merge_types (t1, t2)
case OFFSET_TYPE:
{
- tree base = TYPE_OFFSET_BASETYPE (t1);
- tree target = merge_types (TREE_TYPE (t1), TREE_TYPE (t2));
- t1 = build_offset_type (base, target);
+ int quals;
+ tree pointee;
+ quals = cp_type_quals (t1);
+ pointee = merge_types (TYPE_PTRMEM_POINTED_TO_TYPE (t1),
+ TYPE_PTRMEM_POINTED_TO_TYPE (t2));
+ t1 = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1),
+ pointee);
+ t1 = cp_build_qualified_type (t1, quals);
break;
}
@@ -646,9 +665,9 @@ merge_types (t1, t2)
/* Save space: see if the result is identical to one of the args. */
if (valtype == TREE_TYPE (t1) && ! p2)
- return build_type_attribute_variant (t1, attributes);
+ return cp_build_type_attribute_variant (t1, attributes);
if (valtype == TREE_TYPE (t2) && ! p1)
- return build_type_attribute_variant (t2, attributes);
+ return cp_build_type_attribute_variant (t2, attributes);
/* Simple way if one arg fails to specify argument types. */
if (p1 == NULL_TREE || TREE_VALUE (p1) == void_type_node)
@@ -656,7 +675,7 @@ merge_types (t1, t2)
rval = build_function_type (valtype, p2);
if ((raises = TYPE_RAISES_EXCEPTIONS (t2)))
rval = build_exception_variant (rval, raises);
- return build_type_attribute_variant (rval, attributes);
+ return cp_build_type_attribute_variant (rval, attributes);
}
raises = TYPE_RAISES_EXCEPTIONS (t1);
if (p2 == NULL_TREE || TREE_VALUE (p2) == void_type_node)
@@ -664,7 +683,7 @@ merge_types (t1, t2)
rval = build_function_type (valtype, p1);
if (raises)
rval = build_exception_variant (rval, raises);
- return build_type_attribute_variant (rval, attributes);
+ return cp_build_type_attribute_variant (rval, attributes);
}
rval = build_function_type (valtype, commonparms (p1, p2));
@@ -688,15 +707,21 @@ merge_types (t1, t2)
t2 = build_function_type (TREE_TYPE (t2),
TREE_CHAIN (TYPE_ARG_TYPES (t2)));
t3 = merge_types (t1, t2);
- t3 = build_cplus_method_type (basetype, TREE_TYPE (t3),
- TYPE_ARG_TYPES (t3));
+ t3 = build_method_type_directly (basetype, TREE_TYPE (t3),
+ TYPE_ARG_TYPES (t3));
t1 = build_exception_variant (t3, raises);
break;
}
+ case TYPENAME_TYPE:
+ /* There is no need to merge attributes into a TYPENAME_TYPE.
+ When the type is instantiated it will have whatever
+ attributes result from the instantiation. */
+ return t1;
+
default:;
}
- return build_type_attribute_variant (t1, attributes);
+ return cp_build_type_attribute_variant (t1, attributes);
}
/* Return the common type of two types.
@@ -707,8 +732,7 @@ merge_types (t1, t2)
if the operands have the given two types. */
tree
-common_type (t1, t2)
- tree t1, t2;
+common_type (tree t1, tree t2)
{
enum tree_code code1;
enum tree_code code2;
@@ -731,18 +755,18 @@ common_type (t1, t2)
|| (TYPE_PTRMEMFUNC_P (t1) && TYPE_PTRMEMFUNC_P (t2)))
return composite_pointer_type (t1, t2, error_mark_node, error_mark_node,
"conversion");
-
else
abort ();
}
/* 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.
+ allowed. Returns false for mismatch, true for match (same, or
+ derived and !exact).
[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 * ...
+ and unambiguously derived 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
+ unambiguously derived 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
@@ -751,17 +775,15 @@ common_type (t1, t2)
We implement the letter of the standard. */
-static int
-comp_except_types (a, b, exact)
- tree a, b;
- int exact;
+static bool
+comp_except_types (tree a, tree b, bool exact)
{
if (same_type_p (a, b))
- return 1;
+ return true;
else if (!exact)
{
if (cp_type_quals (a) || cp_type_quals (b))
- return 0;
+ return false;
if (TREE_CODE (a) == POINTER_TYPE
&& TREE_CODE (b) == POINTER_TYPE)
@@ -769,43 +791,41 @@ comp_except_types (a, b, exact)
a = TREE_TYPE (a);
b = TREE_TYPE (b);
if (cp_type_quals (a) || cp_type_quals (b))
- return 0;
+ return false;
}
if (TREE_CODE (a) != RECORD_TYPE
|| TREE_CODE (b) != RECORD_TYPE)
- return 0;
+ return false;
if (ACCESSIBLY_UNIQUELY_DERIVED_P (a, b))
- return 2;
+ return true;
}
- return 0;
+ return false;
}
-/* Return 1 if TYPE1 and TYPE2 are equivalent exception specifiers.
- If EXACT is 0, T2 can be stricter than T1 (according to 15.4/7),
+/* Return true if TYPE1 and TYPE2 are equivalent exception specifiers.
+ If EXACT is false, T2 can be stricter than 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
-comp_except_specs (t1, t2, exact)
- tree t1, t2;
- int exact;
+bool
+comp_except_specs (tree t1, tree t2, bool exact)
{
tree probe;
tree base;
int length = 0;
if (t1 == t2)
- return 1;
+ return true;
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;
+ return false;
if (TREE_VALUE (t1) && !TREE_VALUE (t2)) /* T2 is EMPTY, T1 is not */
return !exact;
@@ -829,37 +849,33 @@ comp_except_specs (t1, t2, exact)
}
}
if (probe == NULL_TREE)
- return 0;
+ return false;
}
return !exact || base == NULL_TREE || length == list_length (t1);
}
-/* Compare the array types T1 and T2, using CMP as the type comparison
- function for the element types. STRICT is as for comptypes. */
+/* Compare the array types T1 and T2. ALLOW_REDECLARATION is true if
+ [] can match [size]. */
-static int
-comp_array_types (cmp, t1, t2, strict)
- register int (*cmp) PARAMS ((tree, tree, int));
- tree t1, t2;
- int strict;
+static bool
+comp_array_types (tree t1, tree t2, bool allow_redeclaration)
{
tree d1;
tree d2;
+ tree max1, max2;
if (t1 == t2)
- return 1;
+ return true;
/* The type of the array elements must be the same. */
- if (!(TREE_TYPE (t1) == TREE_TYPE (t2)
- || (*cmp) (TREE_TYPE (t1), TREE_TYPE (t2),
- strict & ~COMPARE_REDECLARATION)))
- return 0;
+ if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
+ return false;
d1 = TYPE_DOMAIN (t1);
d2 = TYPE_DOMAIN (t2);
if (d1 == d2)
- return 1;
+ return true;
/* If one of the arrays is dimensionless, and the other has a
dimension, they are of different types. However, it is valid to
@@ -874,68 +890,75 @@ comp_array_types (cmp, t1, t2, strict)
array types that differ by the presence or absence of a major
array bound (_dcl.array_). */
if (!d1 || !d2)
- return strict & COMPARE_REDECLARATION;
+ return allow_redeclaration;
/* Check that the dimensions are the same. */
- return (cp_tree_equal (TYPE_MIN_VALUE (d1),
- TYPE_MIN_VALUE (d2))
- && cp_tree_equal (TYPE_MAX_VALUE (d1),
- TYPE_MAX_VALUE (d2)));
-}
-
-/* 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 (t1, t2, strict)
- tree t1;
- tree t2;
- int strict;
-{
- int attrval, val;
- int orig_strict = strict;
+ if (!cp_tree_equal (TYPE_MIN_VALUE (d1), TYPE_MIN_VALUE (d2)))
+ return false;
+ max1 = TYPE_MAX_VALUE (d1);
+ max2 = TYPE_MAX_VALUE (d2);
+ if (processing_template_decl && !abi_version_at_least (2)
+ && !value_dependent_expression_p (max1)
+ && !value_dependent_expression_p (max2))
+ {
+ /* With abi-1 we do not fold non-dependent array bounds, (and
+ consequently mangle them incorrectly). We must therefore
+ fold them here, to verify the domains have the same
+ value. */
+ max1 = fold (max1);
+ max2 = fold (max2);
+ }
- /* The special exemption for redeclaring array types without an
- array bound only applies at the top level:
+ if (!cp_tree_equal (max1, max2))
+ return false;
- extern int (*i)[];
- int (*i)[8];
+ return true;
+}
- is invalid, for example. */
- strict &= ~COMPARE_REDECLARATION;
+/* Return true if T1 and T2 are related as allowed by STRICT. STRICT
+ is a bitwise-or of the COMPARE_* flags. */
- /* Suppress errors caused by previously reported errors */
+bool
+comptypes (tree t1, tree t2, int strict)
+{
if (t1 == t2)
- return 1;
+ return true;
- /* Suppress errors caused by previously reported errors */
+ /* Suppress errors caused by previously reported errors. */
if (t1 == error_mark_node || t2 == error_mark_node)
- return 0;
+ return false;
+
+ my_friendly_assert (TYPE_P (t1) && TYPE_P (t2), 20030623);
+
+ /* TYPENAME_TYPEs should be resolved if the qualifying scope is the
+ current instantiation. */
+ if (TREE_CODE (t1) == TYPENAME_TYPE)
+ {
+ tree resolved = resolve_typename_type (t1, /*only_current_p=*/true);
+
+ if (resolved != error_mark_node)
+ t1 = resolved;
+ }
+
+ if (TREE_CODE (t2) == TYPENAME_TYPE)
+ {
+ tree resolved = resolve_typename_type (t2, /*only_current_p=*/true);
+
+ if (resolved != error_mark_node)
+ t2 = resolved;
+ }
- /* If either type is the internal version of sizetype, return the
+ /* If either type is the internal version of sizetype, use the
language version. */
if (TREE_CODE (t1) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t1)
- && TYPE_DOMAIN (t1) != 0)
+ && TYPE_DOMAIN (t1))
t1 = TYPE_DOMAIN (t1);
if (TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2)
- && TYPE_DOMAIN (t2) != 0)
+ && TYPE_DOMAIN (t2))
t2 = TYPE_DOMAIN (t2);
- if (strict & COMPARE_RELAXED)
- {
- /* Treat an enum type as the unsigned integer type of the same width. */
-
- if (TREE_CODE (t1) == ENUMERAL_TYPE)
- t1 = c_common_type_for_size (TYPE_PRECISION (t1), 1);
- if (TREE_CODE (t2) == ENUMERAL_TYPE)
- t2 = c_common_type_for_size (TYPE_PRECISION (t2), 1);
-
- if (t1 == t2)
- return 1;
- }
-
if (TYPE_PTRMEMFUNC_P (t1))
t1 = TYPE_PTRMEMFUNC_FN_TYPE (t1);
if (TYPE_PTRMEMFUNC_P (t2))
@@ -943,30 +966,26 @@ comptypes (t1, t2, strict)
/* Different classes of types can't be compatible. */
if (TREE_CODE (t1) != TREE_CODE (t2))
- return 0;
+ return false;
- /* Qualifiers must match. */
- if (cp_type_quals (t1) != cp_type_quals (t2))
- return 0;
- if (strict == COMPARE_STRICT
- && TYPE_FOR_JAVA (t1) != TYPE_FOR_JAVA (t2))
- return 0;
+ /* Qualifiers must match. For array types, we will check when we
+ recur on the array element types. */
+ if (TREE_CODE (t1) != ARRAY_TYPE
+ && TYPE_QUALS (t1) != TYPE_QUALS (t2))
+ return false;
+ if (TYPE_FOR_JAVA (t1) != TYPE_FOR_JAVA (t2))
+ return false;
/* Allow for two different type nodes which have essentially the same
definition. Note that we already checked for equality of the type
qualifiers (just above). */
- if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
- return 1;
+ if (TREE_CODE (t1) != ARRAY_TYPE
+ && TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
+ return true;
- if (strict & COMPARE_NO_ATTRIBUTES)
- attrval = 1;
- /* 1 if no need for warning yet, 2 if warning cause has been seen. */
- 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. */
- val = 0;
+ if (!(*targetm.comp_type_attributes) (t1, t2))
+ return false;
switch (TREE_CODE (t1))
{
@@ -974,79 +993,65 @@ comptypes (t1, t2, strict)
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 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t1)),
- DECL_TEMPLATE_PARMS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t2))))
- return 0;
+ return false;
+ if (!comp_template_parms
+ (DECL_TEMPLATE_PARMS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t1)),
+ DECL_TEMPLATE_PARMS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t2))))
+ return false;
if (TREE_CODE (t1) == TEMPLATE_TEMPLATE_PARM)
- return 1;
+ return true;
/* Don't check inheritance. */
strict = COMPARE_STRICT;
- /* fall through */
+ /* Fall through. */
case RECORD_TYPE:
case UNION_TYPE:
if (TYPE_TEMPLATE_INFO (t1) && TYPE_TEMPLATE_INFO (t2)
&& (TYPE_TI_TEMPLATE (t1) == TYPE_TI_TEMPLATE (t2)
- || TREE_CODE (t1) == BOUND_TEMPLATE_TEMPLATE_PARM))
- val = comp_template_args (TYPE_TI_ARGS (t1),
- TYPE_TI_ARGS (t2));
- look_hard:
+ || TREE_CODE (t1) == BOUND_TEMPLATE_TEMPLATE_PARM)
+ && comp_template_args (TYPE_TI_ARGS (t1), TYPE_TI_ARGS (t2)))
+ return true;
+
if ((strict & COMPARE_BASE) && DERIVED_FROM_P (t1, t2))
- val = 1;
- else if ((strict & COMPARE_RELAXED) && DERIVED_FROM_P (t2, t1))
- val = 1;
- break;
+ return true;
+ else if ((strict & COMPARE_DERIVED) && DERIVED_FROM_P (t2, t1))
+ return true;
+
+ return false;
case OFFSET_TYPE:
- val = (comptypes (build_pointer_type (TYPE_OFFSET_BASETYPE (t1)),
- build_pointer_type (TYPE_OFFSET_BASETYPE (t2)), strict)
- && comptypes (TREE_TYPE (t1), TREE_TYPE (t2), strict));
- break;
+ if (!comptypes (TYPE_OFFSET_BASETYPE (t1), TYPE_OFFSET_BASETYPE (t2),
+ strict & ~COMPARE_REDECLARATION))
+ return false;
+ /* Fall through. */
case POINTER_TYPE:
case REFERENCE_TYPE:
- t1 = TREE_TYPE (t1);
- t2 = TREE_TYPE (t2);
- /* first, check whether the referred types match with the
- required level of strictness */
- val = comptypes (t1, t2, strict);
- if (val)
- break;
- if (TREE_CODE (t1) == RECORD_TYPE
- && TREE_CODE (t2) == RECORD_TYPE)
- goto look_hard;
- break;
+ return same_type_p (TREE_TYPE (t1), TREE_TYPE (t2));
case METHOD_TYPE:
case FUNCTION_TYPE:
- val = ((TREE_TYPE (t1) == TREE_TYPE (t2)
- || comptypes (TREE_TYPE (t1), TREE_TYPE (t2), strict))
- && compparms (TYPE_ARG_TYPES (t1), TYPE_ARG_TYPES (t2)));
- break;
+ if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
+ return false;
+ return compparms (TYPE_ARG_TYPES (t1), TYPE_ARG_TYPES (t2));
case ARRAY_TYPE:
- /* Target types must match incl. qualifiers. We use ORIG_STRICT
- here since this is the one place where
- COMPARE_REDECLARATION should be used. */
- val = comp_array_types (comptypes, t1, t2, orig_strict);
- break;
+ /* Target types must match incl. qualifiers. */
+ return comp_array_types (t1, t2, !!(strict & COMPARE_REDECLARATION));
case TEMPLATE_TYPE_PARM:
- return TEMPLATE_TYPE_IDX (t1) == TEMPLATE_TYPE_IDX (t2)
- && TEMPLATE_TYPE_LEVEL (t1) == TEMPLATE_TYPE_LEVEL (t2);
+ return (TEMPLATE_TYPE_IDX (t1) == TEMPLATE_TYPE_IDX (t2)
+ && TEMPLATE_TYPE_LEVEL (t1) == TEMPLATE_TYPE_LEVEL (t2));
case TYPENAME_TYPE:
- if (cp_tree_equal (TYPENAME_TYPE_FULLNAME (t1),
- TYPENAME_TYPE_FULLNAME (t2)) < 1)
- return 0;
+ if (!cp_tree_equal (TYPENAME_TYPE_FULLNAME (t1),
+ TYPENAME_TYPE_FULLNAME (t2)))
+ return false;
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;
+ if (!cp_tree_equal (TYPE_IDENTIFIER (t1), TYPE_IDENTIFIER (t2)))
+ return false;
return same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2));
case COMPLEX_TYPE:
@@ -1055,254 +1060,47 @@ comptypes (t1, t2, strict)
default:
break;
}
- return attrval == 2 && val == 1 ? 2 : val;
-}
-
-/* Subroutine of comp_target-types. Make sure that the cv-quals change
- only in the same direction as the target type. */
-
-static int
-comp_cv_target_types (ttl, ttr, nptrs)
- tree ttl, ttr;
- int nptrs;
-{
- int t;
-
- if (!at_least_as_qualified_p (ttl, ttr)
- && !at_least_as_qualified_p (ttr, ttl))
- /* The qualifications are incomparable. */
- return 0;
-
- if (TYPE_MAIN_VARIANT (ttl) == TYPE_MAIN_VARIANT (ttr))
- return more_qualified_p (ttr, ttl) ? -1 : 1;
-
- t = comp_target_types (ttl, ttr, nptrs);
- if ((t == 1 && at_least_as_qualified_p (ttl, ttr))
- || (t == -1 && at_least_as_qualified_p (ttr, ttl)))
- return t;
-
- return 0;
-}
-
-/* Return 1 or -1 if TTL and TTR are pointers to types that are equivalent,
- ignoring their qualifiers, 0 if not. Return 1 means that TTR can be
- converted to TTL. Return -1 means that TTL can be converted to TTR but
- not vice versa.
-
- NPTRS is the number of pointers we can strip off and keep cool.
- This is used to permit (for aggr A, aggr B) A, B* to convert to A*,
- but to not permit B** to convert to A**.
-
- This should go away. Callers should use can_convert or something
- similar instead. (jason 17 Apr 1997) */
-
-int
-comp_target_types (ttl, ttr, nptrs)
- tree ttl, ttr;
- int nptrs;
-{
- ttl = TYPE_MAIN_VARIANT (ttl);
- ttr = TYPE_MAIN_VARIANT (ttr);
- if (same_type_p (ttl, ttr))
- return 1;
-
- if (TREE_CODE (ttr) != TREE_CODE (ttl))
- return 0;
-
- if ((TREE_CODE (ttr) == POINTER_TYPE
- || TREE_CODE (ttr) == REFERENCE_TYPE)
- /* If we get a pointer with nptrs == 0, we don't allow any tweaking
- of the type pointed to. This is necessary for reference init
- semantics. We won't get here from a previous call with nptrs == 1;
- for multi-level pointers we end up in comp_ptr_ttypes. */
- && nptrs > 0)
- {
- int is_ptr = TREE_CODE (ttr) == POINTER_TYPE;
-
- ttl = TREE_TYPE (ttl);
- ttr = TREE_TYPE (ttr);
-
- if (is_ptr)
- {
- if (TREE_CODE (ttl) == UNKNOWN_TYPE
- || TREE_CODE (ttr) == UNKNOWN_TYPE)
- return 1;
- else if (TREE_CODE (ttl) == VOID_TYPE
- && TREE_CODE (ttr) != FUNCTION_TYPE
- && TREE_CODE (ttr) != METHOD_TYPE
- && TREE_CODE (ttr) != OFFSET_TYPE)
- return 1;
- else if (TREE_CODE (ttr) == VOID_TYPE
- && TREE_CODE (ttl) != FUNCTION_TYPE
- && TREE_CODE (ttl) != METHOD_TYPE
- && TREE_CODE (ttl) != OFFSET_TYPE)
- return -1;
- else if (TREE_CODE (ttl) == POINTER_TYPE
- || TREE_CODE (ttl) == ARRAY_TYPE)
- {
- if (comp_ptr_ttypes (ttl, ttr))
- return 1;
- else if (comp_ptr_ttypes (ttr, ttl))
- return -1;
- return 0;
- }
- }
-
- /* Const and volatile mean something different for function types,
- so the usual checks are not appropriate. */
- if (TREE_CODE (ttl) == FUNCTION_TYPE || TREE_CODE (ttl) == METHOD_TYPE)
- return comp_target_types (ttl, ttr, nptrs - 1);
-
- return comp_cv_target_types (ttl, ttr, nptrs - 1);
- }
-
- if (TREE_CODE (ttr) == ARRAY_TYPE)
- return comp_array_types (comp_target_types, ttl, ttr, COMPARE_STRICT);
- else if (TREE_CODE (ttr) == FUNCTION_TYPE || TREE_CODE (ttr) == METHOD_TYPE)
- {
- tree argsl, argsr;
- int saw_contra = 0;
-
- if (pedantic)
- {
- if (!same_type_p (TREE_TYPE (ttl), TREE_TYPE (ttr)))
- return 0;
- }
- else
- {
- switch (comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), -1))
- {
- case 0:
- return 0;
- case -1:
- saw_contra = 1;
- }
- }
-
- argsl = TYPE_ARG_TYPES (ttl);
- argsr = TYPE_ARG_TYPES (ttr);
-
- /* Compare 'this' here, not in comp_target_parms. */
- if (TREE_CODE (ttr) == METHOD_TYPE)
- {
- tree tl = TYPE_METHOD_BASETYPE (ttl);
- tree tr = TYPE_METHOD_BASETYPE (ttr);
-
- if (!same_or_base_type_p (tr, tl))
- {
- if (same_or_base_type_p (tl, tr))
- saw_contra = 1;
- else
- return 0;
- }
-
- argsl = TREE_CHAIN (argsl);
- argsr = TREE_CHAIN (argsr);
- }
-
- switch (comp_target_parms (argsl, argsr))
- {
- case 0:
- return 0;
- case -1:
- saw_contra = 1;
- }
-
- return saw_contra ? -1 : 1;
- }
- /* for C++ */
- else if (TREE_CODE (ttr) == OFFSET_TYPE)
- {
- int base;
-
- /* Contravariance: we can assign a pointer to base member to a pointer
- to derived member. Note difference from simple pointer case, where
- we can pass a pointer to derived to a pointer to base. */
- if (same_or_base_type_p (TYPE_OFFSET_BASETYPE (ttr),
- TYPE_OFFSET_BASETYPE (ttl)))
- base = 1;
- else if (same_or_base_type_p (TYPE_OFFSET_BASETYPE (ttl),
- TYPE_OFFSET_BASETYPE (ttr)))
- {
- tree tmp = ttl;
- ttl = ttr;
- ttr = tmp;
- base = -1;
- }
- else
- return 0;
-
- ttl = TREE_TYPE (ttl);
- ttr = TREE_TYPE (ttr);
-
- if (TREE_CODE (ttl) == POINTER_TYPE
- || TREE_CODE (ttl) == ARRAY_TYPE)
- {
- if (comp_ptr_ttypes (ttl, ttr))
- return base;
- return 0;
- }
- else
- {
- if (comp_cv_target_types (ttl, ttr, nptrs) == 1)
- return base;
- return 0;
- }
- }
- else if (IS_AGGR_TYPE (ttl))
- {
- if (nptrs < 0)
- return 0;
- if (same_or_base_type_p (build_pointer_type (ttl),
- build_pointer_type (ttr)))
- return 1;
- if (same_or_base_type_p (build_pointer_type (ttr),
- build_pointer_type (ttl)))
- return -1;
- return 0;
- }
-
- return 0;
+ return false;
}
/* Returns 1 if TYPE1 is at least as qualified as TYPE2. */
-int
-at_least_as_qualified_p (type1, type2)
- tree type1;
- tree type2;
+bool
+at_least_as_qualified_p (tree type1, tree type2)
{
+ int q1 = cp_type_quals (type1);
+ int q2 = cp_type_quals (type2);
+
/* All qualifiers for TYPE2 must also appear in TYPE1. */
- return ((cp_type_quals (type1) & cp_type_quals (type2))
- == cp_type_quals (type2));
+ return (q1 & q2) == q2;
}
/* Returns 1 if TYPE1 is more qualified than TYPE2. */
-int
-more_qualified_p (type1, type2)
- tree type1;
- tree type2;
+bool
+more_qualified_p (tree type1, tree type2)
{
- return (cp_type_quals (type1) != cp_type_quals (type2)
- && at_least_as_qualified_p (type1, type2));
+ int q1 = cp_type_quals (type1);
+ int q2 = cp_type_quals (type2);
+
+ return q1 != q2 && (q1 & q2) == q2;
}
/* Returns 1 if TYPE1 is more cv-qualified than TYPE2, -1 if TYPE2 is
more cv-qualified that TYPE1, and 0 otherwise. */
int
-comp_cv_qualification (type1, type2)
- tree type1;
- tree type2;
+comp_cv_qualification (tree type1, tree type2)
{
- if (cp_type_quals (type1) == cp_type_quals (type2))
+ int q1 = cp_type_quals (type1);
+ int q2 = cp_type_quals (type2);
+
+ if (q1 == q2)
return 0;
- if (at_least_as_qualified_p (type1, type2))
+ if ((q1 & q2) == q2)
return 1;
-
- else if (at_least_as_qualified_p (type2, type1))
+ else if ((q1 & q2) == q1)
return -1;
return 0;
@@ -1313,9 +1111,7 @@ comp_cv_qualification (type1, type2)
are similar. Returns -1 if the other way 'round, and 0 otherwise. */
int
-comp_cv_qual_signature (type1, type2)
- tree type1;
- tree type2;
+comp_cv_qual_signature (tree type1, tree type2)
{
if (comp_ptr_ttypes_real (type2, type1, -1))
return 1;
@@ -1330,8 +1126,7 @@ comp_cv_qual_signature (type1, type2)
returns ERROR_MARK_NODE. */
static tree
-common_base_type (tt1, tt2)
- tree tt1, tt2;
+common_base_type (tree tt1, tree tt2)
{
tree best = NULL_TREE;
int i;
@@ -1379,133 +1174,58 @@ common_base_type (tt1, tt2)
/* Subroutines of `comptypes'. */
-/* Return 1 if two parameter type lists PARMS1 and PARMS2 are
+/* Return true if two parameter type lists PARMS1 and PARMS2 are
equivalent in the sense that functions with those parameter types
can have equivalent types. The two lists must be equivalent,
- element by element.
-
- C++: See comment above about TYPE1, TYPE2. */
+ element by element. */
-int
-compparms (parms1, parms2)
- tree parms1, parms2;
+bool
+compparms (tree parms1, tree parms2)
{
- register tree t1 = parms1, t2 = parms2;
+ tree t1, t2;
/* An unspecified parmlist matches any specified parmlist
whose argument types don't need default promotions. */
- while (1)
+ for (t1 = parms1, t2 = parms2;
+ t1 || t2;
+ t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2))
{
- if (t1 == 0 && t2 == 0)
- return 1;
/* If one parmlist is shorter than the other,
they fail to match. */
- if (t1 == 0 || t2 == 0)
- return 0;
+ if (!t1 || !t2)
+ return false;
if (!same_type_p (TREE_VALUE (t1), TREE_VALUE (t2)))
- return 0;
-
- t1 = TREE_CHAIN (t1);
- t2 = TREE_CHAIN (t2);
+ return false;
}
+ return true;
}
-/* This really wants return whether or not parameter type lists
- would make their owning functions assignment compatible or not.
-
- The return value is like for comp_target_types.
-
- This should go away, possibly with the exception of the empty parmlist
- conversion; there are no conversions between function types in C++.
- (jason 17 Apr 1997) */
-
-static int
-comp_target_parms (parms1, parms2)
- tree parms1, parms2;
-{
- register tree t1 = parms1, t2 = parms2;
- int warn_contravariance = 0;
-
- /* In C, an unspecified parmlist matches any specified parmlist
- whose argument types don't need default promotions. This is not
- true for C++, but let's do it anyway for unfixed headers. */
-
- if (t1 == 0 && t2 != 0)
- {
- pedwarn ("ISO C++ prohibits conversion from `%#T' to `(...)'",
- parms2);
- return self_promoting_args_p (t2);
- }
- if (t2 == 0)
- return self_promoting_args_p (t1);
-
- for (; t1 || t2; t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2))
- {
- tree p1, p2;
-
- /* If one parmlist is shorter than the other,
- they fail to match, unless STRICT is <= 0. */
- if (t1 == 0 || t2 == 0)
- return 0;
- p1 = TREE_VALUE (t1);
- p2 = TREE_VALUE (t2);
- if (same_type_p (p1, p2))
- continue;
-
- if (pedantic)
- return 0;
-
- if ((TREE_CODE (p1) == POINTER_TYPE && TREE_CODE (p2) == POINTER_TYPE)
- || (TREE_CODE (p1) == REFERENCE_TYPE
- && TREE_CODE (p2) == REFERENCE_TYPE))
- {
- /* The following is wrong for contravariance,
- but many programs depend on it. */
- if (TREE_TYPE (p1) == void_type_node)
- continue;
- if (TREE_TYPE (p2) == void_type_node)
- {
- warn_contravariance = 1;
- continue;
- }
- if (IS_AGGR_TYPE (TREE_TYPE (p1))
- && !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (p1),
- TREE_TYPE (p2)))
- return 0;
- }
- /* Note backwards order due to contravariance. */
- if (comp_target_types (p2, p1, 1) <= 0)
- {
- if (comp_target_types (p1, p2, 1) > 0)
- {
- warn_contravariance = 1;
- continue;
- }
- return 0;
- }
- }
- return warn_contravariance ? -1 : 1;
-}
+/* Process a sizeof or alignof expression where the operand is a
+ type. */
+
tree
-cxx_sizeof_or_alignof_type (type, op, complain)
- tree type;
- enum tree_code op;
- int complain;
+cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain)
{
enum tree_code type_code;
tree value;
const char *op_name;
my_friendly_assert (op == SIZEOF_EXPR || op == ALIGNOF_EXPR, 20020720);
+ if (type == error_mark_node)
+ return error_mark_node;
+
if (processing_template_decl)
- return build_min_nt (op, type);
+ {
+ value = build_min (op, size_type_node, type);
+ TREE_READONLY (value) = 1;
+ return value;
+ }
op_name = operator_name_info[(int) op].name;
-
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
+
+ type = non_reference (type);
type_code = TREE_CODE (type);
if (type_code == METHOD_TYPE)
@@ -1514,66 +1234,94 @@ cxx_sizeof_or_alignof_type (type, op, complain)
pedwarn ("invalid application of `%s' to a member function", op_name);
value = size_one_node;
}
- else if (type_code == OFFSET_TYPE)
- {
- if (complain)
- error ("invalid application of `%s' to non-static member", op_name);
- value = size_zero_node;
- }
else
value = c_sizeof_or_alignof_type (complete_type (type), op, complain);
return value;
}
+/* Process a sizeof or alignof expression where the operand is an
+ expression. */
+
tree
-expr_sizeof (e)
- tree e;
+cxx_sizeof_or_alignof_expr (tree e, enum tree_code op)
{
+ const char *op_name = operator_name_info[(int) op].name;
+
+ if (e == error_mark_node)
+ return error_mark_node;
+
if (processing_template_decl)
- return build_min_nt (SIZEOF_EXPR, e);
-
+ {
+ e = build_min (op, size_type_node, e);
+ TREE_SIDE_EFFECTS (e) = 0;
+ TREE_READONLY (e) = 1;
+
+ return e;
+ }
+
if (TREE_CODE (e) == COMPONENT_REF
+ && TREE_CODE (TREE_OPERAND (e, 1)) == FIELD_DECL
&& DECL_C_BIT_FIELD (TREE_OPERAND (e, 1)))
- error ("sizeof applied to a bit-field");
- if (is_overloaded_fn (e))
{
- pedwarn ("ISO C++ forbids applying `sizeof' to an expression of function type");
- return c_sizeof (char_type_node);
+ error ("invalid application of `%s' to a bit-field", op_name);
+ e = char_type_node;
+ }
+ else if (is_overloaded_fn (e))
+ {
+ pedwarn ("ISO C++ forbids applying `%s' to an expression of function type", op_name);
+ e = char_type_node;
}
else if (type_unknown_p (e))
{
cxx_incomplete_type_error (e, TREE_TYPE (e));
- return c_sizeof (char_type_node);
+ e = char_type_node;
}
- /* It's invalid 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 cxx_sizeof (TREE_TYPE (e));
+ else
+ e = TREE_TYPE (e);
+
+ return cxx_sizeof_or_alignof_type (e, op, true);
}
-/* Perform the array-to-pointer and function-to-pointer conversions
- for EXP.
+/* EXPR is being used in a context that is not a function call.
+ Enforce:
- In addition, references are converted to lvalues and manifest
- constants are replaced by their values. */
+ [expr.ref]
-tree
-decay_conversion (exp)
- tree exp;
+ The expression can be used only as the left-hand operand of a
+ member function call.
+
+ [expr.mptr.operator]
+
+ If the result of .* or ->* is a function, then that result can be
+ used only as the operand for the function call operator ().
+
+ by issuing an error message if appropriate. Returns true iff EXPR
+ violates these rules. */
+
+bool
+invalid_nonstatic_memfn_p (tree expr)
{
- register tree type;
- register enum tree_code code;
+ if (TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE)
+ {
+ error ("invalid use of non-static member function");
+ return true;
+ }
+ return false;
+}
+
+/* Perform the conversions in [expr] that apply when an lvalue appears
+ in an rvalue context: the lvalue-to-rvalue, array-to-pointer, and
+ function-to-pointer conversions.
- if (TREE_CODE (exp) == OFFSET_REF)
- exp = resolve_offset_ref (exp);
+ In addition manifest constants are replaced by their values. */
+
+tree
+decay_conversion (tree exp)
+{
+ tree type;
+ enum tree_code code;
type = TREE_TYPE (exp);
code = TREE_CODE (type);
@@ -1615,30 +1363,18 @@ decay_conversion (exp)
error ("void value not ignored as it ought to be");
return error_mark_node;
}
- if (code == METHOD_TYPE)
- abort ();
+ if (invalid_nonstatic_memfn_p (exp))
+ return error_mark_node;
if (code == FUNCTION_TYPE || is_overloaded_fn (exp))
return build_unary_op (ADDR_EXPR, exp, 0);
if (code == ARRAY_TYPE)
{
- register tree adr;
+ tree adr;
tree ptrtype;
if (TREE_CODE (exp) == INDIRECT_REF)
- {
- /* Stripping away the INDIRECT_REF is not the right
- thing to do for references... */
- tree inner = TREE_OPERAND (exp, 0);
- if (TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE)
- {
- inner = build1 (CONVERT_EXPR,
- build_pointer_type (TREE_TYPE
- (TREE_TYPE (inner))),
- inner);
- TREE_CONSTANT (inner) = TREE_CONSTANT (TREE_OPERAND (inner, 0));
- }
- return cp_convert (build_pointer_type (TREE_TYPE (type)), inner);
- }
+ return build_nop (build_pointer_type (TREE_TYPE (type)),
+ TREE_OPERAND (exp, 0));
if (TREE_CODE (exp) == COMPOUND_EXPR)
{
@@ -1658,14 +1394,9 @@ decay_conversion (exp)
if (TREE_CODE (exp) == VAR_DECL)
{
- /* ??? This is not really quite correct
- in that the type of the operand of ADDR_EXPR
- is not the target type of the type of the ADDR_EXPR itself.
- Question is, can this lossage be avoided? */
- adr = build1 (ADDR_EXPR, ptrtype, exp);
if (!cxx_mark_addressable (exp))
return error_mark_node;
- TREE_CONSTANT (adr) = staticp (exp);
+ adr = build_nop (ptrtype, build_address (exp));
TREE_SIDE_EFFECTS (adr) = 0; /* Default would be, same as EXP. */
return adr;
}
@@ -1684,33 +1415,39 @@ decay_conversion (exp)
}
tree
-default_conversion (exp)
- tree exp;
+default_conversion (tree exp)
{
- tree type;
- enum tree_code code;
-
exp = decay_conversion (exp);
- type = TREE_TYPE (exp);
- code = TREE_CODE (type);
-
- if (INTEGRAL_CODE_P (code))
- {
- tree t = type_promotes_to (type);
- if (t != type)
- return cp_convert (t, exp);
- }
+ if (INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (exp)))
+ exp = perform_integral_promotions (exp);
return exp;
}
+/* EXPR is an expression with an integral or enumeration type.
+ Perform the integral promotions in [conv.prom], and return the
+ converted value. */
+
+tree
+perform_integral_promotions (tree expr)
+{
+ tree type;
+ tree promoted_type;
+
+ type = TREE_TYPE (expr);
+ my_friendly_assert (INTEGRAL_OR_ENUMERATION_TYPE_P (type), 20030703);
+ promoted_type = type_promotes_to (type);
+ if (type != promoted_type)
+ expr = cp_convert (promoted_type, expr);
+ return expr;
+}
+
/* Take the address of an inline function without setting TREE_ADDRESSABLE
or TREE_USED. */
tree
-inline_conversion (exp)
- tree exp;
+inline_conversion (tree exp)
{
if (TREE_CODE (exp) == FUNCTION_DECL)
exp = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (exp)), exp);
@@ -1722,9 +1459,7 @@ inline_conversion (exp)
decay_conversion to one. */
int
-string_conv_p (totype, exp, warn)
- tree totype, exp;
- int warn;
+string_conv_p (tree totype, tree exp, int warn)
{
tree t;
@@ -1770,9 +1505,7 @@ string_conv_p (totype, exp, warn)
get it there. */
static tree
-rationalize_conditional_expr (code, t)
- enum tree_code code;
- tree t;
+rationalize_conditional_expr (enum tree_code code, tree t)
{
/* For MIN_EXPR or MAX_EXPR, fold-const.c has arranged things so that
the first operand is always the one to be used if both operands
@@ -1783,7 +1516,8 @@ rationalize_conditional_expr (code, t)
build_conditional_expr (build_x_binary_op ((TREE_CODE (t) == MIN_EXPR
? LE_EXPR : GE_EXPR),
TREE_OPERAND (t, 0),
- TREE_OPERAND (t, 1)),
+ TREE_OPERAND (t, 1),
+ /*overloaded_p=*/NULL),
build_unary_op (code, TREE_OPERAND (t, 0), 0),
build_unary_op (code, TREE_OPERAND (t, 1), 0));
}
@@ -1799,9 +1533,8 @@ rationalize_conditional_expr (code, t)
anonymous unions can nest, we must also search all anonymous unions
that are directly reachable. */
-static tree
-lookup_anon_field (t, type)
- tree t, type;
+tree
+lookup_anon_field (tree t, tree type)
{
tree field;
@@ -1854,36 +1587,19 @@ build_class_member_access_expr (tree object, tree member,
if (object == error_mark_node || member == error_mark_node)
return error_mark_node;
+ if (TREE_CODE (member) == PSEUDO_DTOR_EXPR)
+ return member;
+
my_friendly_assert (DECL_P (member) || BASELINK_P (member),
20020801);
- /* Transform `(a, b).x' into `a, b.x' and `(a ? b : c).x' into
- `a ? b.x : c.x'. These transformations should not really be
- necessary, but they are. */
- if (TREE_CODE (object) == COMPOUND_EXPR)
- {
- result = build_class_member_access_expr (TREE_OPERAND (object, 1),
- member, access_path,
- preserve_reference);
- return build (COMPOUND_EXPR, TREE_TYPE (result),
- TREE_OPERAND (object, 0), result);
- }
- else if (TREE_CODE (object) == COND_EXPR)
- return (build_conditional_expr
- (TREE_OPERAND (object, 0),
- build_class_member_access_expr (TREE_OPERAND (object, 1),
- member, access_path,
- preserve_reference),
- build_class_member_access_expr (TREE_OPERAND (object, 2),
- member, access_path,
- preserve_reference)));
-
/* [expr.ref]
The type of the first expression shall be "class object" (of a
complete type). */
object_type = TREE_TYPE (object);
- if (!complete_type_or_else (object_type, object))
+ if (!currently_open_class (object_type)
+ && !complete_type_or_else (object_type, object))
return error_mark_node;
if (!CLASS_TYPE_P (object_type))
{
@@ -1913,10 +1629,22 @@ build_class_member_access_expr (tree object, tree member,
member_scope = TYPE_CONTEXT (member_scope);
if (!member_scope || !DERIVED_FROM_P (member_scope, object_type))
{
- error ("`%D' is not a member of `%T'", member, object_type);
+ if (TREE_CODE (member) == FIELD_DECL)
+ error ("invalid use of nonstatic data member '%E'", member);
+ else
+ error ("`%D' is not a member of `%T'", member, object_type);
return error_mark_node;
}
+ /* Transform `(a, b).x' into `(*(a, &b)).x', `(a ? b : c).x' into
+ `(*(a ? &b : &c)).x', and so on. A COND_EXPR is only an lvalue
+ in the frontend; only _DECLs and _REFs are lvalues in the backend. */
+ {
+ tree temp = unary_complex_lvalue (ADDR_EXPR, object);
+ if (temp)
+ object = build_indirect_ref (temp, NULL);
+ }
+
/* In [expr.ref], there is an explicit list of the valid choices for
MEMBER. We check for each of those cases here. */
if (TREE_CODE (member) == VAR_DECL)
@@ -1973,7 +1701,8 @@ build_class_member_access_expr (tree object, tree member,
give the right answer. Note that we complain whether or not they
actually used the offsetof macro, since there's no way to know at this
point. So we just give a warning, instead of a pedwarn. */
- if (null_object_p && CLASSTYPE_NON_POD_P (object_type))
+ if (null_object_p && warn_invalid_offsetof
+ && CLASSTYPE_NON_POD_P (object_type))
{
warning ("invalid access to non-static data member `%D' of NULL object",
member);
@@ -2034,6 +1763,7 @@ build_class_member_access_expr (tree object, tree member,
{
/* The member is a (possibly overloaded) member function. */
tree functions;
+ tree type;
/* If the MEMBER is exactly one static member function, then we
know the type of the expression. Otherwise, we must wait
@@ -2041,19 +1771,12 @@ build_class_member_access_expr (tree object, tree member,
functions = BASELINK_FUNCTIONS (member);
if (TREE_CODE (functions) == FUNCTION_DECL
&& DECL_STATIC_FUNCTION_P (functions))
- {
- /* A static member function. */
- result = functions;
- mark_used (result);
- /* If OBJECT has side-effects, they are supposed to occur. */
- if (TREE_SIDE_EFFECTS (object))
- result = build (COMPOUND_EXPR, TREE_TYPE (result),
- object, result);
- }
+ type = TREE_TYPE (functions);
else
- /* Note that we do not convert OBJECT to the BASELINK_BINFO
- base. That will happen when the function is called. */
- result = build (COMPONENT_REF, unknown_type_node, object, member);
+ type = unknown_type_node;
+ /* Note that we do not convert OBJECT to the BASELINK_BINFO
+ base. That will happen when the function is called. */
+ result = build (COMPONENT_REF, type, object, member);
}
else if (TREE_CODE (member) == CONST_DECL)
{
@@ -2080,6 +1803,38 @@ build_class_member_access_expr (tree object, tree member,
return result;
}
+/* Return the destructor denoted by OBJECT.SCOPE::~DTOR_NAME, or, if
+ SCOPE is NULL, by OBJECT.~DTOR_NAME. */
+
+static tree
+lookup_destructor (tree object, tree scope, tree dtor_name)
+{
+ tree object_type = TREE_TYPE (object);
+ tree dtor_type = TREE_OPERAND (dtor_name, 0);
+ tree expr;
+
+ if (scope && !check_dtor_name (scope, dtor_name))
+ {
+ error ("qualified type `%T' does not match destructor name `~%T'",
+ scope, dtor_type);
+ return error_mark_node;
+ }
+ if (!DERIVED_FROM_P (dtor_type, TYPE_MAIN_VARIANT (object_type)))
+ {
+ error ("the type being destroyed is `%T', but the destructor refers to `%T'",
+ TYPE_MAIN_VARIANT (object_type), dtor_type);
+ return error_mark_node;
+ }
+ if (!TYPE_HAS_DESTRUCTOR (dtor_type))
+ return build (PSEUDO_DTOR_EXPR, void_type_node, object, scope,
+ dtor_type);
+ expr = lookup_member (dtor_type, complete_dtor_identifier,
+ /*protect=*/1, /*want_type=*/false);
+ expr = (adjust_result_of_qualified_name_lookup
+ (expr, dtor_type, object_type));
+ return expr;
+}
+
/* This function is called by the parser to process a class member
access expression of the form OBJECT.NAME. NAME is a node used by
the parser to represent a name; it is not yet a DECL. It may,
@@ -2091,20 +1846,39 @@ build_class_member_access_expr (tree object, tree member,
tree
finish_class_member_access_expr (tree object, tree name)
{
+ tree expr;
tree object_type;
tree member;
tree access_path = NULL_TREE;
+ tree orig_object = object;
+ tree orig_name = name;
if (object == error_mark_node || name == error_mark_node)
return error_mark_node;
+ object_type = TREE_TYPE (object);
+
if (processing_template_decl)
- return build_min_nt (COMPONENT_REF, object, name);
+ {
+ if (/* If OBJECT_TYPE is dependent, so is OBJECT.NAME. */
+ dependent_type_p (object_type)
+ /* If NAME is just an IDENTIFIER_NODE, then the expression
+ is dependent. */
+ || TREE_CODE (object) == IDENTIFIER_NODE
+ /* If NAME is "f<args>", where either 'f' or 'args' is
+ dependent, then the expression is dependent. */
+ || (TREE_CODE (name) == TEMPLATE_ID_EXPR
+ && dependent_template_id_p (TREE_OPERAND (name, 0),
+ TREE_OPERAND (name, 1)))
+ /* If NAME is "T::X" where "T" is dependent, then the
+ expression is dependent. */
+ || (TREE_CODE (name) == SCOPE_REF
+ && TYPE_P (TREE_OPERAND (name, 0))
+ && dependent_type_p (TREE_OPERAND (name, 0))))
+ return build_min_nt (COMPONENT_REF, object, name);
+ object = build_non_dependent_expr (object);
+ }
- if (TREE_CODE (object) == OFFSET_REF)
- object = resolve_offset_ref (object);
-
- object_type = TREE_TYPE (object);
if (TREE_CODE (object_type) == REFERENCE_TYPE)
{
object = convert_from_reference (object);
@@ -2115,7 +1889,8 @@ finish_class_member_access_expr (tree object, tree name)
The type of the first expression shall be "class object" (of a
complete type). */
- if (!complete_type_or_else (object_type, object))
+ if (!currently_open_class (object_type)
+ && !complete_type_or_else (object_type, object))
return error_mark_node;
if (!CLASS_TYPE_P (object_type))
{
@@ -2136,18 +1911,22 @@ finish_class_member_access_expr (tree object, tree name)
{
bool is_template_id = false;
tree template_args = NULL_TREE;
+ tree scope;
if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
{
is_template_id = true;
template_args = TREE_OPERAND (name, 1);
name = TREE_OPERAND (name, 0);
+
+ if (TREE_CODE (name) == OVERLOAD)
+ name = DECL_NAME (get_first_fn (name));
+ else if (DECL_P (name))
+ name = DECL_NAME (name);
}
if (TREE_CODE (name) == SCOPE_REF)
{
- tree scope;
-
/* A qualified name. The qualifying class or namespace `S' has
already been looked up; it is either a TYPE or a
NAMESPACE_DECL. The member name is either an IDENTIFIER_NODE
@@ -2179,66 +1958,35 @@ finish_class_member_access_expr (tree object, tree name)
error ("`%T' is not a base of `%T'", scope, object_type);
return error_mark_node;
}
-
- /* Look up the member. */
- member = lookup_member (access_path, name, /*protect=*/1,
- /*want_type=*/0);
- if (member == NULL_TREE)
- {
- error ("'%D' has no member named '%E'", object_type, name);
- return error_mark_node;
- }
- else if (member == error_mark_node)
- return error_mark_node;
}
- else if (TREE_CODE (name) == BIT_NOT_EXPR)
+ else
{
- /* A destructor. */
- if (TYPE_IDENTIFIER (object_type) != TREE_OPERAND (name, 0))
- {
- error ("destructor specifier `%T::~%T' must have matching names",
- object_type, TREE_OPERAND (name, 0));
- return error_mark_node;
- }
- if (! TYPE_HAS_DESTRUCTOR (object_type))
- {
- error ("type `%T' has no destructor", object_type);
- return error_mark_node;
- }
- member = CLASSTYPE_DESTRUCTORS (object_type);
+ scope = NULL_TREE;
+ access_path = object_type;
}
- else if (TREE_CODE (name) == IDENTIFIER_NODE)
+
+ if (TREE_CODE (name) == BIT_NOT_EXPR)
+ member = lookup_destructor (object, scope, name);
+ else
{
- /* An unqualified name. */
- member = lookup_member (object_type, name, /*protect=*/1,
- /*want_type=*/0);
+ /* Look up the member. */
+ member = lookup_member (access_path, name, /*protect=*/1,
+ /*want_type=*/false);
if (member == NULL_TREE)
{
error ("'%D' has no member named '%E'", object_type, name);
return error_mark_node;
}
- else if (member == error_mark_node)
+ if (member == error_mark_node)
return error_mark_node;
}
- else
- {
- /* The YACC parser sometimes gives us things that are not names.
- These always indicate errors. The recursive-descent parser
- does not do this, so this code can go away once that parser
- replaces the YACC parser. */
- error ("invalid use of `%D'", name);
- return error_mark_node;
- }
if (is_template_id)
{
tree template = member;
if (BASELINK_P (template))
- BASELINK_FUNCTIONS (template)
- = build_nt (TEMPLATE_ID_EXPR,
- BASELINK_FUNCTIONS (template),
- template_args);
+ template = lookup_template_function (template, template_args);
else
{
error ("`%D' is not a member template function", name);
@@ -2247,8 +1995,15 @@ finish_class_member_access_expr (tree object, tree name)
}
}
- return build_class_member_access_expr (object, member, access_path,
+ if (TREE_DEPRECATED (member))
+ warn_deprecated_use (member);
+
+ expr = build_class_member_access_expr (object, member, access_path,
/*preserve_reference=*/false);
+ if (processing_template_decl && expr != error_mark_node)
+ return build_min_non_dep (COMPONENT_REF, expr,
+ orig_object, orig_name);
+ return expr;
}
/* Return an expression for the MEMBER_NAME field in the internal
@@ -2272,7 +2027,7 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
ptrmem_type = TREE_TYPE (ptrmem);
my_friendly_assert (TYPE_PTRMEMFUNC_P (ptrmem_type), 20020804);
member = lookup_member (ptrmem_type, member_name, /*protect=*/0,
- /*want_type=*/0);
+ /*want_type=*/false);
member_type = cp_build_qualified_type (TREE_TYPE (member),
cp_type_quals (ptrmem_type));
return fold (build (COMPONENT_REF, member_type, ptrmem, member));
@@ -2286,28 +2041,33 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
Must also handle REFERENCE_TYPEs for C++. */
tree
-build_x_indirect_ref (ptr, errorstring)
- tree ptr;
- const char *errorstring;
+build_x_indirect_ref (tree expr, const char *errorstring)
{
+ tree orig_expr = expr;
tree rval;
if (processing_template_decl)
- return build_min_nt (INDIRECT_REF, ptr);
+ {
+ if (type_dependent_expression_p (expr))
+ return build_min_nt (INDIRECT_REF, expr);
+ expr = build_non_dependent_expr (expr);
+ }
- rval = build_opfncall (INDIRECT_REF, LOOKUP_NORMAL, ptr, NULL_TREE,
- NULL_TREE);
- if (rval)
+ rval = build_new_op (INDIRECT_REF, LOOKUP_NORMAL, expr, NULL_TREE,
+ NULL_TREE, /*overloaded_p=*/NULL);
+ if (!rval)
+ rval = build_indirect_ref (expr, errorstring);
+
+ if (processing_template_decl && rval != error_mark_node)
+ return build_min_non_dep (INDIRECT_REF, rval, orig_expr);
+ else
return rval;
- return build_indirect_ref (ptr, errorstring);
}
tree
-build_indirect_ref (ptr, errorstring)
- tree ptr;
- const char *errorstring;
+build_indirect_ref (tree ptr, const char *errorstring)
{
- register tree pointer, type;
+ tree pointer, type;
if (ptr == error_mark_node)
return error_mark_node;
@@ -2316,7 +2076,7 @@ build_indirect_ref (ptr, errorstring)
return current_class_ref;
pointer = (TREE_CODE (TREE_TYPE (ptr)) == REFERENCE_TYPE
- ? ptr : default_conversion (ptr));
+ ? ptr : decay_conversion (ptr));
type = TREE_TYPE (pointer);
if (TYPE_PTR_P (type) || TREE_CODE (type) == REFERENCE_TYPE)
@@ -2339,7 +2099,6 @@ build_indirect_ref (ptr, errorstring)
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
`x'. */
@@ -2354,14 +2113,13 @@ build_indirect_ref (ptr, errorstring)
TREE_READONLY (ref) = CP_TYPE_CONST_P (t);
TREE_THIS_VOLATILE (ref) = CP_TYPE_VOLATILE_P (t);
TREE_SIDE_EFFECTS (ref)
- = (TREE_THIS_VOLATILE (ref) || TREE_SIDE_EFFECTS (pointer)
- || flag_volatile);
+ = (TREE_THIS_VOLATILE (ref) || TREE_SIDE_EFFECTS (pointer));
return ref;
}
}
/* `pointer' won't be an error_mark_node if we were given a
pointer to member, so it's cool to check for this here. */
- else if (TYPE_PTRMEM_P (type) || TYPE_PTRMEMFUNC_P (type))
+ else if (TYPE_PTR_TO_MEMBER_P (type))
error ("invalid use of `%s' on pointer to member", errorstring);
else if (pointer != error_mark_node)
{
@@ -2387,8 +2145,7 @@ build_indirect_ref (ptr, errorstring)
will inherit the type of the array, which will be some pointer type. */
tree
-build_array_ref (array, idx)
- tree array, idx;
+build_array_ref (tree array, tree idx)
{
if (idx == 0)
{
@@ -2436,15 +2193,19 @@ build_array_ref (array, idx)
&& TYPE_MAIN_VARIANT (TREE_TYPE (idx)) == char_type_node)
warning ("array subscript has type `char'");
- /* Apply default promotions *after* noticing character types. */
- idx = default_conversion (idx);
-
- if (TREE_CODE (TREE_TYPE (idx)) != INTEGER_TYPE)
+ if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (idx)))
{
error ("array subscript is not an integer");
return error_mark_node;
}
+ /* Apply integral promotions *after* noticing character types.
+ (It is unclear why we do these promotions -- the standard
+ does not say that we should. In fact, the natual thing would
+ seem to be to convert IDX to ptrdiff_t; we're performing
+ pointer arithmetic.) */
+ idx = perform_integral_promotions (idx);
+
/* An array that is indexed by a non-constant
cannot be stored in a register; we must be able to do
address arithmetic on its address.
@@ -2540,9 +2301,7 @@ build_array_ref (array, idx)
later has the right member. */
tree
-get_member_function_from_ptrfunc (instance_ptrptr, function)
- tree *instance_ptrptr;
- tree function;
+get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
{
if (TREE_CODE (function) == OFFSET_REF)
function = TREE_OPERAND (function, 1);
@@ -2644,12 +2403,10 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
}
tree
-build_function_call_real (function, params, flags)
- tree function, params;
- int flags;
+build_function_call (tree function, tree params)
{
- register tree fntype, fndecl;
- register tree coerced_params;
+ tree fntype, fndecl;
+ tree coerced_params;
tree result;
tree name = NULL_TREE, assembler_name = NULL_TREE;
int is_method;
@@ -2719,20 +2476,10 @@ build_function_call_real (function, params, flags)
/* Convert the parameters to the types declared in the
function prototype, or apply default promotions. */
- if (flags & LOOKUP_COMPLAIN)
- coerced_params = convert_arguments (TYPE_ARG_TYPES (fntype),
- params, fndecl, LOOKUP_NORMAL);
- else
- coerced_params = convert_arguments (TYPE_ARG_TYPES (fntype),
- params, fndecl, 0);
-
+ coerced_params = convert_arguments (TYPE_ARG_TYPES (fntype),
+ params, fndecl, LOOKUP_NORMAL);
if (coerced_params == error_mark_node)
- {
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
- else
- return error_mark_node;
- }
+ return error_mark_node;
/* Check for errors in format strings. */
@@ -2755,13 +2502,6 @@ build_function_call_real (function, params, flags)
return build_cxx_call (function, params, coerced_params);
}
-
-tree
-build_function_call (function, params)
- tree function, params;
-{
- return build_function_call_real (function, params, LOOKUP_NORMAL);
-}
/* Convert the actual parameter expressions in the list VALUES
to the types in the list TYPELIST.
@@ -2781,12 +2521,10 @@ build_function_call (function, params)
default arguments, if such were specified. Do so here. */
tree
-convert_arguments (typelist, values, fndecl, flags)
- tree typelist, values, fndecl;
- int flags;
+convert_arguments (tree typelist, tree values, tree fndecl, int flags)
{
- register tree typetail, valtail;
- register tree result = NULL_TREE;
+ tree typetail, valtail;
+ tree result = NULL_TREE;
const char *called_thing = 0;
int i = 0;
@@ -2811,8 +2549,8 @@ convert_arguments (typelist, values, fndecl, flags)
valtail;
valtail = TREE_CHAIN (valtail), i++)
{
- register tree type = typetail ? TREE_VALUE (typetail) : 0;
- register tree val = TREE_VALUE (valtail);
+ tree type = typetail ? TREE_VALUE (typetail) : 0;
+ tree val = TREE_VALUE (valtail);
if (val == error_mark_node)
return error_mark_node;
@@ -2834,9 +2572,6 @@ convert_arguments (typelist, values, fndecl, flags)
break;
}
- if (TREE_CODE (val) == OFFSET_REF)
- val = resolve_offset_ref (val);
-
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
Strip such NOP_EXPRs, since VAL is used in non-lvalue context. */
if (TREE_CODE (val) == NOP_EXPR
@@ -2849,7 +2584,7 @@ convert_arguments (typelist, values, fndecl, flags)
if (TREE_CODE (TREE_TYPE (val)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (val)) == FUNCTION_TYPE
|| TREE_CODE (TREE_TYPE (val)) == METHOD_TYPE)
- val = default_conversion (val);
+ val = decay_conversion (val);
}
if (val == error_mark_node)
@@ -2862,8 +2597,12 @@ convert_arguments (typelist, values, fndecl, flags)
if (!COMPLETE_TYPE_P (complete_type (type)))
{
- error ("parameter type of called function is incomplete");
- parmval = val;
+ if (fndecl)
+ error ("parameter %P of `%D' has incomplete type `%T'",
+ i, fndecl, type);
+ else
+ error ("parameter %P has incomplete type `%T'", i, type);
+ parmval = error_mark_node;
}
else
{
@@ -2901,8 +2640,9 @@ convert_arguments (typelist, values, fndecl, flags)
if (typetail != 0 && typetail != void_list_node)
{
- /* See if there are default arguments that can be used */
- if (TREE_PURPOSE (typetail))
+ /* See if there are default arguments that can be used. */
+ if (TREE_PURPOSE (typetail)
+ && TREE_CODE (TREE_PURPOSE (typetail)) != DEFAULT_ARG)
{
for (; typetail != void_list_node; ++i)
{
@@ -2942,14 +2682,35 @@ convert_arguments (typelist, values, fndecl, flags)
conversions on the operands. CODE is the kind of expression to build. */
tree
-build_x_binary_op (code, arg1, arg2)
- enum tree_code code;
- tree arg1, arg2;
+build_x_binary_op (enum tree_code code, tree arg1, tree arg2,
+ bool *overloaded_p)
{
+ tree orig_arg1;
+ tree orig_arg2;
+ tree expr;
+
+ orig_arg1 = arg1;
+ orig_arg2 = arg2;
+
if (processing_template_decl)
- return build_min_nt (code, arg1, arg2);
+ {
+ if (type_dependent_expression_p (arg1)
+ || type_dependent_expression_p (arg2))
+ return build_min_nt (code, arg1, arg2);
+ arg1 = build_non_dependent_expr (arg1);
+ arg2 = build_non_dependent_expr (arg2);
+ }
- return build_new_op (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE);
+ if (code == DOTSTAR_EXPR)
+ expr = build_m_component_ref (arg1, arg2);
+ else
+ expr = build_new_op (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE,
+ overloaded_p);
+
+ if (processing_template_decl && expr != error_mark_node)
+ return build_min_non_dep (code, expr, orig_arg1, orig_arg2);
+
+ return expr;
}
/* Build a binary-operation expression without default conversions.
@@ -2971,23 +2732,21 @@ build_x_binary_op (code, arg1, arg2)
multiple inheritance, and deal with pointer to member functions. */
tree
-build_binary_op (code, orig_op0, orig_op1, convert_p)
- enum tree_code code;
- tree orig_op0, orig_op1;
- int convert_p ATTRIBUTE_UNUSED;
+build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
+ int convert_p ATTRIBUTE_UNUSED)
{
tree op0, op1;
- register enum tree_code code0, code1;
+ enum tree_code code0, code1;
tree type0, type1;
/* Expression code to give to the expression when it is built.
Normally this is CODE, which is what the caller asked for,
but in some special cases we change it. */
- register enum tree_code resultcode = code;
+ enum tree_code resultcode = code;
/* Data type in which the computation is to be performed.
In the simplest cases this is the common type of the arguments. */
- register tree result_type = NULL;
+ tree result_type = NULL;
/* Nonzero means operands have already been type-converted
in whatever way is necessary.
@@ -3099,7 +2858,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
/* Subtraction of two similar pointers.
We must subtract them as integers, then divide by object size. */
if (code0 == POINTER_TYPE && code1 == POINTER_TYPE
- && comp_target_types (type0, type1, 1))
+ && same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (type0),
+ TREE_TYPE (type1)))
return pointer_diff (op0, op1, common_type (type0, type1));
/* Handle pointer minus int. Just like pointer plus int. */
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
@@ -3145,7 +2905,6 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
break;
case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
@@ -3261,12 +3020,15 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE
|| code1 == COMPLEX_TYPE))
short_compare = 1;
- else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
+ else if ((code0 == POINTER_TYPE && code1 == POINTER_TYPE)
+ || (TYPE_PTRMEM_P (type0) && TYPE_PTRMEM_P (type1)))
result_type = composite_pointer_type (type0, type1, op0, op1,
"comparison");
- else if (code0 == POINTER_TYPE && null_ptr_cst_p (op1))
+ else if ((code0 == POINTER_TYPE || TYPE_PTRMEM_P (type0))
+ && null_ptr_cst_p (op1))
result_type = type0;
- else if (code1 == POINTER_TYPE && null_ptr_cst_p (op0))
+ else if ((code1 == POINTER_TYPE || TYPE_PTRMEM_P (type1))
+ && null_ptr_cst_p (op0))
result_type = type1;
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
@@ -3535,7 +3297,10 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
}
if ((short_compare || code == MIN_EXPR || code == MAX_EXPR)
- && warn_sign_compare)
+ && warn_sign_compare
+ /* Do not warn until the template is instantiated; we cannot
+ bound the ranges of the arguments until that point. */
+ && !processing_template_decl)
{
int op0_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op0));
int op1_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op1));
@@ -3690,8 +3455,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
build_type = result_type;
{
- register tree result = build (resultcode, build_type, op0, op1);
- register tree folded;
+ tree result = build (resultcode, build_type, op0, op1);
+ tree folded;
folded = fold (result);
if (folded == result)
@@ -3706,9 +3471,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
of pointer PTROP and integer INTOP. */
static tree
-cp_pointer_int_sum (resultcode, ptrop, intop)
- enum tree_code resultcode;
- register tree ptrop, intop;
+cp_pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
{
tree res_type = TREE_TYPE (ptrop);
@@ -3726,11 +3489,9 @@ cp_pointer_int_sum (resultcode, ptrop, intop)
The resulting tree has type int. */
static tree
-pointer_diff (op0, op1, ptrtype)
- register tree op0, op1;
- register tree ptrtype;
+pointer_diff (tree op0, tree op1, tree ptrtype)
{
- register tree result, folded;
+ tree result, folded;
tree restype = ptrdiff_type_node;
tree target_type = TREE_TYPE (ptrtype);
@@ -3745,8 +3506,6 @@ pointer_diff (op0, op1, ptrtype)
pedwarn ("ISO C++ forbids using pointer to a function in subtraction");
if (TREE_CODE (target_type) == METHOD_TYPE)
pedwarn ("ISO C++ forbids using pointer to a method in subtraction");
- if (TREE_CODE (target_type) == OFFSET_TYPE)
- pedwarn ("ISO C++ forbids using pointer to a member in subtraction");
}
/* First do the subtraction as integers;
@@ -3760,12 +3519,9 @@ pointer_diff (op0, op1, ptrtype)
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
- || TREE_CODE (target_type) == METHOD_TYPE
- || TREE_CODE (target_type) == OFFSET_TYPE)
- ? integer_one_node
- : size_in_bytes (target_type));
+ op1 = (TYPE_PTROB_P (ptrtype)
+ ? size_in_bytes (target_type)
+ : integer_one_node);
/* Do the division. */
@@ -3782,34 +3538,39 @@ pointer_diff (op0, op1, ptrtype)
and XARG is the operand. */
tree
-build_x_unary_op (code, xarg)
- enum tree_code code;
- tree xarg;
+build_x_unary_op (enum tree_code code, tree xarg)
{
+ tree orig_expr = xarg;
tree exp;
int ptrmem = 0;
if (processing_template_decl)
- return build_min_nt (code, xarg, NULL_TREE);
+ {
+ if (type_dependent_expression_p (xarg))
+ return build_min_nt (code, xarg, NULL_TREE);
+ xarg = build_non_dependent_expr (xarg);
+ }
+
+ exp = NULL_TREE;
+
+ /* [expr.unary.op] says:
- /* & rec, on incomplete RECORD_TYPEs is the simple opr &, not an
- error message. */
+ The address of an object of incomplete type can be taken.
+
+ (And is just the ordinary address operator, not an overloaded
+ "operator &".) However, if the type is a template
+ specialization, we must complete the type at this point so that
+ an overloaded "operator &" will be available if required. */
if (code == ADDR_EXPR
&& TREE_CODE (xarg) != TEMPLATE_ID_EXPR
- && ((IS_AGGR_TYPE_CODE (TREE_CODE (TREE_TYPE (xarg)))
- && !COMPLETE_TYPE_P (TREE_TYPE (xarg)))
+ && ((CLASS_TYPE_P (TREE_TYPE (xarg))
+ && !COMPLETE_TYPE_P (complete_type (TREE_TYPE (xarg))))
|| (TREE_CODE (xarg) == OFFSET_REF)))
- /* don't look for a function */;
+ /* Don't look for a function. */;
else
- {
- tree rval;
-
- rval = build_new_op (code, LOOKUP_NORMAL, xarg,
- NULL_TREE, NULL_TREE);
- if (rval || code != ADDR_EXPR)
- return rval;
- }
- if (code == ADDR_EXPR)
+ exp = build_new_op (code, LOOKUP_NORMAL, xarg, NULL_TREE, NULL_TREE,
+ /*overloaded_p=*/NULL);
+ if (!exp && code == ADDR_EXPR)
{
/* A pointer to member-function can be formed only by saying
&X::mf. */
@@ -3843,16 +3604,18 @@ build_x_unary_op (code, 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 (ADDR_EXPR, xarg, 0);
+ if (TREE_CODE (exp) == ADDR_EXPR)
+ PTRMEM_OK_P (exp) = ptrmem;
}
- exp = build_unary_op (code, xarg, 0);
- if (TREE_CODE (exp) == ADDR_EXPR)
- PTRMEM_OK_P (exp) = ptrmem;
+ if (processing_template_decl && exp != error_mark_node)
+ return build_min_non_dep (code, exp, orig_expr,
+ /*For {PRE,POST}{INC,DEC}REMENT_EXPR*/NULL_TREE);
return exp;
}
@@ -3861,8 +3624,7 @@ build_x_unary_op (code, xarg)
-1. */
tree
-cp_truthvalue_conversion (expr)
- tree expr;
+cp_truthvalue_conversion (tree expr)
{
tree type = TREE_TYPE (expr);
if (TYPE_PTRMEM_P (type))
@@ -3874,14 +3636,11 @@ cp_truthvalue_conversion (expr)
/* Just like cp_truthvalue_conversion, but we want a CLEANUP_POINT_EXPR. */
tree
-condition_conversion (expr)
- tree expr;
+condition_conversion (tree expr)
{
tree t;
if (processing_template_decl)
return 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;
@@ -3899,9 +3658,7 @@ build_address (tree t)
if (error_operand_p (t) || !cxx_mark_addressable (t))
return error_mark_node;
- addr = build1 (ADDR_EXPR,
- build_pointer_type (TREE_TYPE (t)),
- t);
+ addr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t);
if (staticp (t))
TREE_CONSTANT (addr) = 1;
@@ -3935,14 +3692,11 @@ build_nop (tree type, tree expr)
(such as from short to int). */
tree
-build_unary_op (code, xarg, noconvert)
- enum tree_code code;
- tree xarg;
- int noconvert;
+build_unary_op (enum tree_code code, tree xarg, int noconvert)
{
/* No default_conversion here. It causes trouble for ADDR_EXPR. */
- register tree arg = xarg;
- register tree argtype = 0;
+ tree arg = xarg;
+ tree argtype = 0;
const char *errstring = NULL;
tree val;
@@ -3956,7 +3710,7 @@ build_unary_op (code, xarg, noconvert)
is enough to prevent anybody from looking inside for
associativity, but won't generate any code. */
if (!(arg = build_expr_type_conversion
- (WANT_ARITH | WANT_ENUM | WANT_POINTER, arg, 1)))
+ (WANT_ARITH | WANT_ENUM | WANT_POINTER, arg, true)))
errstring = "wrong type argument to unary plus";
else
{
@@ -3968,10 +3722,10 @@ build_unary_op (code, xarg, noconvert)
break;
case NEGATE_EXPR:
- if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
+ if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, true)))
errstring = "wrong type argument to unary minus";
- else if (!noconvert)
- arg = default_conversion (arg);
+ else if (!noconvert && CP_INTEGRAL_TYPE_P (TREE_TYPE (arg)))
+ arg = perform_integral_promotions (arg);
break;
case BIT_NOT_EXPR:
@@ -3982,14 +3736,14 @@ build_unary_op (code, xarg, noconvert)
arg = default_conversion (arg);
}
else if (!(arg = build_expr_type_conversion (WANT_INT | WANT_ENUM,
- arg, 1)))
+ arg, true)))
errstring = "wrong type argument to bit-complement";
else if (!noconvert)
- arg = default_conversion (arg);
+ arg = perform_integral_promotions (arg);
break;
case ABS_EXPR:
- if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
+ if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, true)))
errstring = "wrong type argument to abs";
else if (!noconvert)
arg = default_conversion (arg);
@@ -3997,14 +3751,14 @@ build_unary_op (code, xarg, noconvert)
case CONJ_EXPR:
/* Conjugating a real value is a no-op, but allow it anyway. */
- if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
+ if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, true)))
errstring = "wrong type argument to conjugation";
else if (!noconvert)
arg = default_conversion (arg);
break;
case TRUTH_NOT_EXPR:
- arg = cp_convert (boolean_type_node, arg);
+ arg = perform_implicit_conversion (boolean_type_node, arg);
val = invert_truthvalue (arg);
if (arg != error_mark_node)
return val;
@@ -4057,7 +3811,7 @@ build_unary_op (code, xarg, noconvert)
/* Report invalid types. */
if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_POINTER,
- arg, 1)))
+ arg, true)))
{
if (code == PREINCREMENT_EXPR)
errstring ="no pre-increment operator for type";
@@ -4080,7 +3834,7 @@ build_unary_op (code, xarg, noconvert)
0);
{
- register tree inc;
+ tree inc;
tree result_type = TREE_TYPE (arg);
arg = get_unwidened (arg, 0);
@@ -4096,7 +3850,6 @@ build_unary_op (code, xarg, noconvert)
if (TREE_CODE (argtype) == POINTER_TYPE)
{
- enum tree_code tmp = TREE_CODE (TREE_TYPE (argtype));
tree type = complete_type (TREE_TYPE (argtype));
if (!COMPLETE_OR_VOID_TYPE_P (type))
@@ -4105,8 +3858,7 @@ build_unary_op (code, xarg, noconvert)
|| 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))
+ && !TYPE_PTROB_P (argtype))
pedwarn ("ISO C++ forbids %sing a pointer of type `%T'",
((code == PREINCREMENT_EXPR
|| code == POSTINCREMENT_EXPR)
@@ -4169,13 +3921,7 @@ build_unary_op (code, xarg, noconvert)
error ("invalid use of `--' on bool variable `%D'", arg);
return error_mark_node;
}
-#if 0
- /* This will only work if someone can convince Kenner to accept
- my patch to expand_increment. (jason) */
- val = build (code, TREE_TYPE (arg), arg, inc);
-#else
val = boolean_increment (code, arg);
-#endif
}
else
val = build (code, TREE_TYPE (arg), arg, inc);
@@ -4189,6 +3935,10 @@ build_unary_op (code, xarg, noconvert)
regardless of NOCONVERT. */
argtype = lvalue_type (arg);
+
+ if (TREE_CODE (arg) == OFFSET_REF)
+ goto offset_ref;
+
if (TREE_CODE (argtype) == REFERENCE_TYPE)
{
arg = build1
@@ -4223,8 +3973,12 @@ build_unary_op (code, xarg, noconvert)
return arg;
}
- /* For &x[y], return x+y */
- if (TREE_CODE (arg) == ARRAY_REF)
+ /* For &x[y], return x+y. But, in a template, ARG may be an
+ ARRAY_REF representing a non-dependent expression. In that
+ case, there may be an overloaded "operator []" that will be
+ chosen at instantiation time; we must not try to optimize
+ here. */
+ if (TREE_CODE (arg) == ARRAY_REF && !processing_template_decl)
{
if (!cxx_mark_addressable (TREE_OPERAND (arg, 0)))
return error_mark_node;
@@ -4258,7 +4012,11 @@ build_unary_op (code, xarg, noconvert)
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));
+ /* Inside constant member functions, the `this' pointer
+ contains an extra const qualifier. TYPE_MAIN_VARIANT
+ is used here to remove this const from the diagnostics
+ and the created OFFSET_REF. */
+ tree base = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg, 0)));
tree name = DECL_NAME (get_first_fn (TREE_OPERAND (arg, 1)));
if (! flag_ms_extensions)
@@ -4266,13 +4024,20 @@ build_unary_op (code, xarg, noconvert)
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);
+ pedwarn ("ISO C++ forbids taking the address of an unqualified"
+ " or parenthesized 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);
+ 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);
+ arg = build_offset_ref (base, name, /*address_p=*/true);
}
-
+
+ offset_ref:
if (type_unknown_p (arg))
return build1 (ADDR_EXPR, unknown_type_node, arg);
@@ -4294,7 +4059,11 @@ build_unary_op (code, xarg, noconvert)
if (! lvalue_p (arg) && pedantic)
pedwarn ("ISO C++ forbids taking the address of a cast to a non-lvalue expression");
break;
-
+
+ case OVERLOAD:
+ arg = OVL_CURRENT (arg);
+ break;
+
default:
break;
}
@@ -4308,7 +4077,7 @@ build_unary_op (code, xarg, noconvert)
is an error. */
else if (TREE_CODE (argtype) != FUNCTION_TYPE
&& TREE_CODE (argtype) != METHOD_TYPE
- && !non_cast_lvalue_or_else (arg, "unary `&'"))
+ && !lvalue_or_else (arg, "unary `&'"))
return error_mark_node;
if (argtype != error_mark_node)
@@ -4317,8 +4086,28 @@ build_unary_op (code, xarg, noconvert)
{
tree addr;
- if (TREE_CODE (arg) != COMPONENT_REF)
+ if (TREE_CODE (arg) != COMPONENT_REF
+ /* Inside a template, we are processing a non-dependent
+ expression so we can just form an ADDR_EXPR with the
+ correct type. */
+ || processing_template_decl)
addr = build_address (arg);
+ else if (TREE_CODE (TREE_OPERAND (arg, 1)) == BASELINK)
+ {
+ tree fn = BASELINK_FUNCTIONS (TREE_OPERAND (arg, 1));
+
+ /* We can only get here with a single static member
+ function. */
+ my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL
+ && DECL_STATIC_FUNCTION_P (fn),
+ 20030906);
+ mark_used (fn);
+ addr = build_address (fn);
+ if (TREE_SIDE_EFFECTS (TREE_OPERAND (arg, 0)))
+ /* Do not lose object's side effects. */
+ addr = build (COMPOUND_EXPR, TREE_TYPE (addr),
+ TREE_OPERAND (arg, 0), addr);
+ }
else if (DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1)))
{
error ("attempt to take address of bit-field structure member `%D'",
@@ -4337,8 +4126,7 @@ build_unary_op (code, xarg, noconvert)
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));
+ rval = build_nop (argtype, rval);
addr = fold (build (PLUS_EXPR, argtype, rval,
cp_convert (argtype, byte_position (field))));
}
@@ -4375,9 +4163,7 @@ build_unary_op (code, xarg, noconvert)
If ARG is not a kind of expression we can handle, return zero. */
tree
-unary_complex_lvalue (code, arg)
- enum tree_code code;
- tree arg;
+unary_complex_lvalue (enum tree_code code, tree arg)
{
/* Handle (a, b) used as an "lvalue". */
if (TREE_CODE (arg) == COMPOUND_EXPR)
@@ -4423,11 +4209,8 @@ unary_complex_lvalue (code, arg)
if (TREE_CODE (TREE_TYPE (arg)) == FUNCTION_TYPE
|| TREE_CODE (TREE_TYPE (arg)) == METHOD_TYPE
- || TREE_CODE (TREE_TYPE (arg)) == OFFSET_TYPE)
+ || TREE_CODE (arg) == OFFSET_REF)
{
- /* The representation of something of type OFFSET_TYPE
- is really the representation of a pointer to it.
- Here give the representation its true type. */
tree t;
my_friendly_assert (TREE_CODE (arg) != SCOPE_REF, 313);
@@ -4458,15 +4241,7 @@ unary_complex_lvalue (code, arg)
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);
- }
+ return build_unary_op (code, arg, 0);
if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
{
@@ -4474,7 +4249,8 @@ unary_complex_lvalue (code, arg)
return error_mark_node;
}
- type = build_ptrmem_type (DECL_FIELD_CONTEXT (t), TREE_TYPE (t));
+ type = build_ptrmem_type (context_for_name_lookup (t),
+ TREE_TYPE (t));
t = make_ptrmem_cst (type, TREE_OPERAND (arg, 1));
return t;
}
@@ -4514,10 +4290,9 @@ unary_complex_lvalue (code, arg)
C++: we do not allow `current_class_ptr' to be addressable. */
bool
-cxx_mark_addressable (exp)
- tree exp;
+cxx_mark_addressable (tree exp)
{
- register tree x = exp;
+ tree x = exp;
while (1)
switch (TREE_CODE (x))
@@ -4534,10 +4309,10 @@ cxx_mark_addressable (exp)
if (x == current_class_ptr)
{
error ("cannot take the address of `this', which is an rvalue expression");
- TREE_ADDRESSABLE (x) = 1; /* so compiler doesn't die later */
+ TREE_ADDRESSABLE (x) = 1; /* so compiler doesn't die later. */
return true;
}
- /* FALLTHRU */
+ /* Fall through. */
case VAR_DECL:
/* Caller should not be trying to mark initialized
@@ -4546,7 +4321,7 @@ cxx_mark_addressable (exp)
|| DECL_IN_AGGR_P (x) == 0
|| TREE_STATIC (x)
|| DECL_EXTERNAL (x), 314);
- /* FALLTHRU */
+ /* Fall through. */
case CONST_DECL:
case RESULT_DECL:
@@ -4580,114 +4355,128 @@ cxx_mark_addressable (exp)
/* Build and return a conditional expression IFEXP ? OP1 : OP2. */
tree
-build_x_conditional_expr (ifexp, op1, op2)
- tree ifexp, op1, op2;
+build_x_conditional_expr (tree ifexp, tree op1, tree op2)
{
- if (processing_template_decl)
- return build_min_nt (COND_EXPR, ifexp, op1, op2);
+ tree orig_ifexp = ifexp;
+ tree orig_op1 = op1;
+ tree orig_op2 = op2;
+ tree expr;
- return build_conditional_expr (ifexp, op1, op2);
+ if (processing_template_decl)
+ {
+ /* The standard says that the expression is type-dependent if
+ IFEXP is type-dependent, even though the eventual type of the
+ expression doesn't dependent on IFEXP. */
+ if (type_dependent_expression_p (ifexp)
+ /* As a GNU extension, the middle operand may be omitted. */
+ || (op1 && type_dependent_expression_p (op1))
+ || type_dependent_expression_p (op2))
+ return build_min_nt (COND_EXPR, ifexp, op1, op2);
+ ifexp = build_non_dependent_expr (ifexp);
+ if (op1)
+ op1 = build_non_dependent_expr (op1);
+ op2 = build_non_dependent_expr (op2);
+ }
+
+ expr = build_conditional_expr (ifexp, op1, op2);
+ if (processing_template_decl && expr != error_mark_node)
+ return build_min_non_dep (COND_EXPR, expr,
+ orig_ifexp, orig_op1, orig_op2);
+ return expr;
}
-/* Handle overloading of the ',' operator when needed. Otherwise,
- this function just builds an expression list. */
+/* Given a list of expressions, return a compound expression
+ that performs them all and returns the value of the last of them. */
+
+tree build_x_compound_expr_from_list (tree list, const char *msg)
+{
+ tree expr = TREE_VALUE (list);
+
+ if (TREE_CHAIN (list))
+ {
+ if (msg)
+ pedwarn ("%s expression list treated as compound expression", msg);
+
+ for (list = TREE_CHAIN (list); list; list = TREE_CHAIN (list))
+ expr = build_x_compound_expr (expr, TREE_VALUE (list));
+ }
+
+ return expr;
+}
+
+/* Handle overloading of the ',' operator when needed. */
tree
-build_x_compound_expr (list)
- tree list;
+build_x_compound_expr (tree op1, tree op2)
{
- tree rest = TREE_CHAIN (list);
tree result;
+ tree orig_op1 = op1;
+ tree orig_op2 = op2;
if (processing_template_decl)
- return build_min_nt (COMPOUND_EXPR, list, NULL_TREE);
+ {
+ if (type_dependent_expression_p (op1)
+ || type_dependent_expression_p (op2))
+ return build_min_nt (COMPOUND_EXPR, op1, op2);
+ op1 = build_non_dependent_expr (op1);
+ op2 = build_non_dependent_expr (op2);
+ }
- if (rest == NULL_TREE)
- return build_compound_expr (list);
+ result = build_new_op (COMPOUND_EXPR, LOOKUP_NORMAL, op1, op2, NULL_TREE,
+ /*overloaded_p=*/NULL);
+ if (!result)
+ result = build_compound_expr (op1, op2);
- result = build_opfncall (COMPOUND_EXPR, LOOKUP_NORMAL,
- TREE_VALUE (list), TREE_VALUE (rest), NULL_TREE);
- if (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_value)
- && !(TREE_CODE (TREE_VALUE(list)) == CONVERT_EXPR
- && 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_value)
- warn_if_unused_value (TREE_VALUE(list));
-#endif
-
- return build_compound_expr
- (tree_cons (NULL_TREE, TREE_VALUE (list),
- build_tree_list (NULL_TREE,
- build_x_compound_expr (rest))));
+ if (processing_template_decl && result != error_mark_node)
+ return build_min_non_dep (COMPOUND_EXPR, result, orig_op1, orig_op2);
+
+ return result;
}
-/* Given a list of expressions, return a compound expression
- that performs them all and returns the value of the last of them. */
+/* Build a compound expression. */
tree
-build_compound_expr (list)
- tree list;
+build_compound_expr (tree lhs, tree rhs)
{
- register tree rest;
- tree first;
-
- TREE_VALUE (list) = decl_constant_value (TREE_VALUE (list));
-
- if (TREE_CHAIN (list) == 0)
+ lhs = decl_constant_value (lhs);
+ lhs = convert_to_void (lhs, "left-hand operand of comma");
+
+ if (lhs == error_mark_node || rhs == error_mark_node)
+ return error_mark_node;
+
+ if (TREE_CODE (rhs) == TARGET_EXPR)
{
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Strip such NOP_EXPRs, since LIST is used in non-lvalue context. */
- if (TREE_CODE (list) == NOP_EXPR
- && TREE_TYPE (list) == TREE_TYPE (TREE_OPERAND (list, 0)))
- list = TREE_OPERAND (list, 0);
-
- return TREE_VALUE (list);
+ /* If the rhs is a TARGET_EXPR, then build the compound
+ expression inside the target_expr's initializer. This
+ helps the compiler to eliminate unnecessary temporaries. */
+ tree init = TREE_OPERAND (rhs, 1);
+
+ init = build (COMPOUND_EXPR, TREE_TYPE (init), lhs, init);
+ TREE_OPERAND (rhs, 1) = init;
+
+ return rhs;
}
-
- first = TREE_VALUE (list);
- first = convert_to_void (first, "left-hand operand of comma");
- if (first == error_mark_node)
- return error_mark_node;
- rest = build_compound_expr (TREE_CHAIN (list));
- if (rest == error_mark_node)
- return error_mark_node;
-
- /* When pedantic, a compound expression cannot be a constant expression. */
- if (! TREE_SIDE_EFFECTS (first) && ! pedantic)
- return rest;
-
- return build (COMPOUND_EXPR, TREE_TYPE (rest), first, rest);
+ return build (COMPOUND_EXPR, TREE_TYPE (rhs), lhs, rhs);
}
/* Issue an error message if casting from SRC_TYPE to DEST_TYPE casts
- away constness. */
+ away constness. DESCRIPTION explains what operation is taking
+ place. */
static void
-check_for_casting_away_constness (tree src_type, tree dest_type)
+check_for_casting_away_constness (tree src_type, tree dest_type,
+ const char *description)
{
if (casts_away_constness (src_type, dest_type))
- error ("static_cast from type `%T' to type `%T' casts away constness",
- src_type, dest_type);
+ error ("%s from type `%T' to type `%T' casts away constness",
+ description, src_type, dest_type);
}
/* Return an expression representing static_cast<TYPE>(EXPR). */
tree
-build_static_cast (type, expr)
- tree type, expr;
+build_static_cast (tree type, tree expr)
{
tree intype;
tree result;
@@ -4695,13 +4484,12 @@ build_static_cast (type, expr)
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
- if (TREE_CODE (expr) == OFFSET_REF)
- expr = resolve_offset_ref (expr);
-
if (processing_template_decl)
{
- tree t = build_min (STATIC_CAST_EXPR, type, expr);
- return t;
+ expr = build_min (STATIC_CAST_EXPR, type, expr);
+ /* We don't know if it will or will not have side effects. */
+ TREE_SIDE_EFFECTS (expr) = 1;
+ return expr;
}
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
@@ -4735,7 +4523,7 @@ build_static_cast (type, expr)
if (TREE_CODE (type) == REFERENCE_TYPE
&& CLASS_TYPE_P (TREE_TYPE (type))
&& CLASS_TYPE_P (intype)
- && real_non_cast_lvalue_p (expr)
+ && real_lvalue_p (expr)
&& DERIVED_FROM_P (intype, TREE_TYPE (type))
&& can_convert (build_pointer_type (TYPE_MAIN_VARIANT (intype)),
build_pointer_type (TYPE_MAIN_VARIANT
@@ -4764,7 +4552,17 @@ build_static_cast (type, expr)
t. */
result = perform_direct_initialization_if_possible (type, expr);
if (result)
- return convert_from_reference (result);
+ {
+ result = convert_from_reference (result);
+ /* [expr.static.cast]
+
+ If T is a reference type, the result is an lvalue; otherwise,
+ the result is an rvalue. */
+ if (TREE_CODE (type) != REFERENCE_TYPE
+ && real_lvalue_p (result))
+ result = build1 (NON_LVALUE_EXPR, TREE_TYPE (result), result);
+ return result;
+ }
/* [expr.static.cast]
@@ -4792,9 +4590,10 @@ build_static_cast (type, expr)
converted to an enumeration type. */
|| (INTEGRAL_OR_ENUMERATION_TYPE_P (type)
&& INTEGRAL_OR_ENUMERATION_TYPE_P (intype)))
- /* Really, build_c_cast should defer to this function rather
- than the other way around. */
- return build_c_cast (type, expr);
+ /* Really, build_c_cast should defer to this function rather
+ than the other way around. */
+ return build_c_cast (type, expr);
+
if (TYPE_PTR_P (type) && TYPE_PTR_P (intype)
&& CLASS_TYPE_P (TREE_TYPE (type))
&& CLASS_TYPE_P (TREE_TYPE (intype))
@@ -4805,11 +4604,12 @@ build_static_cast (type, expr)
{
tree base;
- check_for_casting_away_constness (intype, type);
- base = lookup_base (TREE_TYPE (type), TREE_TYPE (intype),
- ba_check, NULL);
+ check_for_casting_away_constness (intype, type, "static_cast");
+ base = lookup_base (TREE_TYPE (type), TREE_TYPE (intype), ba_check,
+ NULL);
return build_base_path (MINUS_EXPR, expr, base, /*nonnull=*/false);
}
+
if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
{
@@ -4837,15 +4637,18 @@ build_static_cast (type, expr)
}
if (can_convert (t1, t2))
{
- check_for_casting_away_constness (intype, type);
+ check_for_casting_away_constness (intype, type, "static_cast");
if (TYPE_PTRMEM_P (type))
{
+ tree delta;
+
if (TREE_CODE (expr) == PTRMEM_CST)
expr = cplus_expand_constant (expr);
- expr = cp_build_binary_op (PLUS_EXPR,
- cp_convert (ptrdiff_type_node, expr),
- get_delta_difference (c1, c2,
- /*force=*/1));
+ delta = get_delta_difference (c1, c2, /*force=*/1);
+ if (!integer_zerop (delta))
+ expr = cp_build_binary_op (PLUS_EXPR,
+ build_nop (ptrdiff_type_node, expr),
+ delta);
return build_nop (type, expr);
}
else
@@ -4864,7 +4667,7 @@ build_static_cast (type, expr)
&& VOID_TYPE_P (TREE_TYPE (intype))
&& TYPE_PTROB_P (type))
{
- check_for_casting_away_constness (intype, type);
+ check_for_casting_away_constness (intype, type, "static_cast");
return build_nop (type, expr);
}
@@ -4873,20 +4676,21 @@ build_static_cast (type, expr)
}
tree
-build_reinterpret_cast (type, expr)
- tree type, expr;
+build_reinterpret_cast (tree type, tree expr)
{
tree intype;
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
- if (TREE_CODE (expr) == OFFSET_REF)
- expr = resolve_offset_ref (expr);
-
if (processing_template_decl)
{
tree t = build_min (REINTERPRET_CAST_EXPR, type, expr);
+
+ if (!TREE_SIDE_EFFECTS (t)
+ && type_dependent_expression_p (expr))
+ /* There might turn out to be side effects inside expr. */
+ TREE_SIDE_EFFECTS (t) = 1;
return t;
}
@@ -4939,10 +4743,7 @@ build_reinterpret_cast (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)))
- pedwarn ("reinterpret_cast from `%T' to `%T' casts away const (or volatile)",
- intype, type);
-
+ check_for_casting_away_constness (intype, type, "reinterpret_cast");
expr = decl_constant_value (expr);
return fold (build1 (NOP_EXPR, type, expr));
}
@@ -4964,24 +4765,25 @@ build_reinterpret_cast (type, expr)
}
tree
-build_const_cast (type, expr)
- tree type, expr;
+build_const_cast (tree type, tree expr)
{
tree intype;
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
- if (TREE_CODE (expr) == OFFSET_REF)
- expr = resolve_offset_ref (expr);
-
if (processing_template_decl)
{
tree t = build_min (CONST_CAST_EXPR, type, expr);
+
+ if (!TREE_SIDE_EFFECTS (t)
+ && type_dependent_expression_p (expr))
+ /* There might turn out to be side effects inside expr. */
+ TREE_SIDE_EFFECTS (t) = 1;
return t;
}
- if (!POINTER_TYPE_P (type))
+ if (!POINTER_TYPE_P (type) && !TYPE_PTRMEM_P (type))
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)
{
@@ -5019,8 +4821,9 @@ build_const_cast (type, expr)
return convert_from_reference (expr);
}
}
- else if (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (intype) == POINTER_TYPE
+ else if (((TREE_CODE (type) == POINTER_TYPE
+ && TREE_CODE (intype) == POINTER_TYPE)
+ || (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype)))
&& comp_ptr_ttypes_const (TREE_TYPE (type), TREE_TYPE (intype)))
return cp_convert (type, expr);
@@ -5034,10 +4837,9 @@ build_const_cast (type, expr)
when doing the cast. */
tree
-build_c_cast (type, expr)
- tree type, expr;
+build_c_cast (tree type, tree expr)
{
- register tree value = expr;
+ tree value = expr;
tree otype;
if (type == error_mark_node || expr == error_mark_node)
@@ -5047,6 +4849,8 @@ build_c_cast (type, expr)
{
tree t = build_min (CAST_EXPR, type,
tree_cons (NULL_TREE, value, NULL_TREE));
+ /* We don't know if it will or will not have side effects. */
+ TREE_SIDE_EFFECTS (t) = 1;
return t;
}
@@ -5057,9 +4861,6 @@ build_c_cast (type, expr)
&& TREE_TYPE (value) == TREE_TYPE (TREE_OPERAND (value, 0)))
value = TREE_OPERAND (value, 0);
- if (TREE_CODE (value) == OFFSET_REF)
- value = resolve_offset_ref (value);
-
if (TREE_CODE (type) == ARRAY_TYPE)
{
/* Allow casting from T1* to T2[] because Cfront allows it.
@@ -5117,7 +4918,7 @@ build_c_cast (type, expr)
&& bound_pmf_p (value)))
|| TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (value)) == REFERENCE_TYPE)
- value = default_conversion (value);
+ value = decay_conversion (value);
}
else if (TREE_CODE (TREE_TYPE (value)) == REFERENCE_TYPE)
/* However, even for class types, we still need to strip away
@@ -5139,11 +4940,11 @@ build_c_cast (type, expr)
otype, type);
if (TREE_CODE (type) == INTEGER_TYPE
- && TREE_CODE (otype) == POINTER_TYPE
+ && TYPE_PTR_P (otype)
&& TYPE_PRECISION (type) != TYPE_PRECISION (otype))
warning ("cast from pointer to integer of different size");
- if (TREE_CODE (type) == POINTER_TYPE
+ if (TYPE_PTR_P (type)
&& TREE_CODE (otype) == INTEGER_TYPE
&& TYPE_PRECISION (type) != TYPE_PRECISION (otype)
/* Don't warn about converting any constant. */
@@ -5201,16 +5002,13 @@ build_c_cast (type, expr)
C++: If MODIFYCODE is INIT_EXPR, then leave references unbashed. */
tree
-build_modify_expr (lhs, modifycode, rhs)
- tree lhs;
- enum tree_code modifycode;
- tree rhs;
+build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
{
- register tree result;
+ tree result;
tree newrhs = rhs;
tree lhstype = TREE_TYPE (lhs);
tree olhstype = lhstype;
- tree olhs = lhs;
+ tree olhs = NULL_TREE;
/* Avoid duplicate error messages from operands that had errors. */
if (lhs == error_mark_node || rhs == error_mark_node)
@@ -5219,7 +5017,7 @@ build_modify_expr (lhs, modifycode, rhs)
/* Handle control structure constructs used as "lvalues". */
switch (TREE_CODE (lhs))
{
- /* Handle --foo = 5; as these are valid constructs in C++ */
+ /* Handle --foo = 5; as these are valid constructs in C++. */
case PREDECREMENT_EXPR:
case PREINCREMENT_EXPR:
if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0)))
@@ -5279,15 +5077,11 @@ build_modify_expr (lhs, modifycode, rhs)
return cond;
/* Make sure the code to compute the rhs comes out
before the split. */
- return build (COMPOUND_EXPR, TREE_TYPE (lhs), preeval, cond);
+ if (preeval)
+ cond = build (COMPOUND_EXPR, TREE_TYPE (lhs), preeval, cond);
+ return 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;
}
@@ -5304,7 +5098,7 @@ build_modify_expr (lhs, modifycode, rhs)
return result;
}
else if (! IS_AGGR_TYPE (lhstype))
- /* Do the default thing */;
+ /* Do the default thing. */;
else
{
result = build_special_member_call (lhs, complete_ctor_identifier,
@@ -5331,11 +5125,12 @@ build_modify_expr (lhs, modifycode, rhs)
{
/* `operator=' is not an inheritable operator. */
if (! IS_AGGR_TYPE (lhstype))
- /* Do the default thing */;
+ /* Do the default thing. */;
else
{
- result = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL,
- lhs, rhs, make_node (NOP_EXPR));
+ result = build_new_op (MODIFY_EXPR, LOOKUP_NORMAL,
+ lhs, rhs, make_node (NOP_EXPR),
+ /*overloaded_p=*/NULL);
if (result == NULL_TREE)
return error_mark_node;
return result;
@@ -5391,7 +5186,7 @@ build_modify_expr (lhs, modifycode, rhs)
|| 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);
+ newrhs = decay_conversion (newrhs);
/* ISO C++ 5.4/1: The result is an lvalue if T is a reference
type, otherwise the result is an rvalue. */
@@ -5426,7 +5221,7 @@ build_modify_expr (lhs, modifycode, rhs)
|| 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))
+ || (CLASS_TYPE_P (lhstype)
&& C_TYPE_FIELDS_READONLY (lhstype))))
readonly_error (lhs, "assignment", 0);
@@ -5446,6 +5241,15 @@ build_modify_expr (lhs, modifycode, rhs)
if (lhstype != TREE_TYPE (lhs))
{
+ /* Avoid warnings converting integral types back into enums for
+ enum bit fields. */
+ if (TREE_CODE (lhstype) == INTEGER_TYPE
+ && TREE_CODE (olhstype) == ENUMERAL_TYPE)
+ {
+ if (TREE_SIDE_EFFECTS (lhs))
+ lhs = stabilize_reference (lhs);
+ olhs = lhs;
+ }
lhs = copy_node (lhs);
TREE_TYPE (lhs) = lhstype;
}
@@ -5518,10 +5322,7 @@ build_modify_expr (lhs, modifycode, rhs)
if (olhstype == TREE_TYPE (result))
return result;
- /* Avoid warnings converting integral types back into enums
- for enum bit fields. */
- if (TREE_CODE (TREE_TYPE (result)) == INTEGER_TYPE
- && TREE_CODE (olhstype) == ENUMERAL_TYPE)
+ if (olhs)
{
result = build (COMPOUND_EXPR, olhstype, result, olhs);
TREE_NO_UNUSED_WARNING (result) = 1;
@@ -5532,10 +5333,7 @@ build_modify_expr (lhs, modifycode, rhs)
}
tree
-build_x_modify_expr (lhs, modifycode, rhs)
- tree lhs;
- enum tree_code modifycode;
- tree rhs;
+build_x_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
{
if (processing_template_decl)
return build_min_nt (MODOP_EXPR, lhs,
@@ -5543,8 +5341,9 @@ build_x_modify_expr (lhs, modifycode, rhs)
if (modifycode != NOP_EXPR)
{
- tree rval = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL, lhs, rhs,
- make_node (modifycode));
+ tree rval = build_new_op (MODIFY_EXPR, LOOKUP_NORMAL, lhs, rhs,
+ make_node (modifycode),
+ /*overloaded_p=*/NULL);
if (rval)
return rval;
}
@@ -5553,8 +5352,9 @@ build_x_modify_expr (lhs, modifycode, rhs)
/* Get difference in deltas for different pointer to member function
- types. Return integer_zero_node, if FROM cannot be converted to a
- TO type. If FORCE is true, then allow reverse conversions as well.
+ types. Returns an integer constant of type PTRDIFF_TYPE_NODE. If
+ the conversion is invalid, the constant is zero. If FORCE is true,
+ then allow reverse conversions as well.
Note that the naming of FROM and TO is kind of backwards; the return
value is what we add to a TO in order to get a FROM. They are named
@@ -5562,11 +5362,8 @@ build_x_modify_expr (lhs, modifycode, rhs)
a pointer to member of FROM to a pointer to member of TO. */
static tree
-get_delta_difference (from, to, force)
- tree from, to;
- int force;
+get_delta_difference (tree from, tree to, int force)
{
- tree delta = integer_zero_node;
tree binfo;
tree virt_binfo;
base_kind kind;
@@ -5575,7 +5372,7 @@ get_delta_difference (from, to, force)
if (kind == bk_inaccessible || kind == bk_ambig)
{
error (" in pointer to member function conversion");
- return delta;
+ goto error;
}
if (!binfo)
{
@@ -5583,55 +5380,45 @@ get_delta_difference (from, to, force)
{
error_not_base_type (from, to);
error (" in pointer to member conversion");
- return delta;
+ goto error;
}
binfo = lookup_base (from, to, ba_check, &kind);
- if (binfo == 0)
- return delta;
+ if (!binfo)
+ goto error;
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;
+ warning ("pointer to member cast via virtual base `%T'",
+ BINFO_TYPE (virt_binfo));
+ goto error;
}
- delta = BINFO_OFFSET (binfo);
- delta = cp_convert (ptrdiff_type_node, delta);
- delta = cp_build_binary_op (MINUS_EXPR,
- integer_zero_node,
- delta);
-
- return delta;
+ return fold (convert_to_integer (ptrdiff_type_node,
+ size_diffop (size_zero_node,
+ BINFO_OFFSET (binfo))));
}
virt_binfo = binfo_from_vbase (binfo);
- if (virt_binfo)
- {
- /* This is a reinterpret cast, we choose to do nothing. */
- if (force)
- warning ("pointer to member cast via virtual base `%T' of `%T'",
- BINFO_TYPE (virt_binfo),
- BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)));
- else
- 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);
+ if (!virt_binfo)
+ return fold (convert_to_integer (ptrdiff_type_node, BINFO_OFFSET (binfo)));
+
+ /* This is a reinterpret cast, we choose to do nothing. */
+ if (force)
+ warning ("pointer to member cast via virtual base `%T'",
+ BINFO_TYPE (virt_binfo));
+ else
+ error ("pointer to member conversion via virtual base `%T'",
+ BINFO_TYPE (virt_binfo));
- return cp_convert (ptrdiff_type_node, delta);
+ error:
+ return fold (convert_to_integer(ptrdiff_type_node, integer_zero_node));
}
/* Return a constructor for the pointer-to-member-function TYPE using
the other components as specified. */
tree
-build_ptrmemfunc1 (type, delta, pfn)
- tree type, delta, pfn;
+build_ptrmemfunc1 (tree type, tree delta, tree pfn)
{
tree u = NULL_TREE;
tree delta_field;
@@ -5647,7 +5434,7 @@ build_ptrmemfunc1 (type, delta, pfn)
/* Finish creating the initializer. */
u = tree_cons (pfn_field, pfn,
build_tree_list (delta_field, delta));
- u = build (CONSTRUCTOR, type, NULL_TREE, u);
+ u = build_constructor (type, u);
TREE_CONSTANT (u) = TREE_CONSTANT (pfn) && TREE_CONSTANT (delta);
TREE_STATIC (u) = (TREE_CONSTANT (u)
&& (initializer_constant_valid_p (pfn, TREE_TYPE (pfn))
@@ -5669,9 +5456,7 @@ build_ptrmemfunc1 (type, delta, pfn)
Return error_mark_node, if something goes wrong. */
tree
-build_ptrmemfunc (type, pfn, force)
- tree type, pfn;
- int force;
+build_ptrmemfunc (tree type, tree pfn, int force)
{
tree fn;
tree pfn_type;
@@ -5724,7 +5509,7 @@ build_ptrmemfunc (type, pfn, force)
}
/* Just adjust the DELTA field. */
- delta = cp_convert (ptrdiff_type_node, delta);
+ my_friendly_assert (TREE_TYPE (delta) == ptrdiff_type_node, 20030727);
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);
@@ -5756,10 +5541,7 @@ build_ptrmemfunc (type, pfn, force)
integer_type_node. */
void
-expand_ptrmemfunc_cst (cst, delta, pfn)
- tree cst;
- tree *delta;
- tree *pfn;
+expand_ptrmemfunc_cst (tree cst, tree *delta, tree *pfn)
{
tree type = TREE_TYPE (cst);
tree fn = PTRMEM_CST_MEMBER (cst);
@@ -5822,8 +5604,7 @@ expand_ptrmemfunc_cst (cst, delta, pfn)
given by T. */
tree
-pfn_from_ptrmemfunc (t)
- tree t;
+pfn_from_ptrmemfunc (tree t)
{
if (TREE_CODE (t) == PTRMEM_CST)
{
@@ -5843,15 +5624,10 @@ pfn_from_ptrmemfunc (t)
marked EXPR. */
tree
-dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum)
- tree type;
- tree expr;
- const char *errtype;
- tree fndecl;
- int parmnum;
+dubious_conversion_warnings (tree type, tree expr,
+ const char *errtype, tree fndecl, int parmnum)
{
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
+ type = non_reference (type);
/* Issue warnings about peculiar, but valid, uses of NULL. */
if (ARITHMETIC_TYPE_P (type) && expr == null_node)
@@ -5903,21 +5679,11 @@ dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum)
FNDECL. */
static tree
-convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
- tree type, rhs;
- const char *errtype;
- tree fndecl;
- int parmnum;
+convert_for_assignment (tree type, tree rhs,
+ const char *errtype, tree fndecl, int parmnum)
{
- register enum tree_code codel = TREE_CODE (type);
- register tree rhstype;
- register enum tree_code coder;
-
- if (codel == OFFSET_TYPE)
- abort ();
-
- if (TREE_CODE (rhs) == OFFSET_REF)
- rhs = resolve_offset_ref (rhs);
+ tree rhstype;
+ enum tree_code coder;
/* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
if (TREE_CODE (rhs) == NON_LVALUE_EXPR)
@@ -5926,13 +5692,16 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
rhstype = TREE_TYPE (rhs);
coder = TREE_CODE (rhstype);
+ if (TREE_CODE (type) == VECTOR_TYPE && coder == VECTOR_TYPE
+ && ((*targetm.vector_opaque_p) (type)
+ || (*targetm.vector_opaque_p) (rhstype)))
+ return convert (type, 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;
- rhs = dubious_conversion_warnings (type, rhs, errtype, fndecl, parmnum);
-
/* The RHS of an assignment cannot have void type. */
if (coder == VOID_TYPE)
{
@@ -6007,16 +5776,12 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
If flags doesn't include LOOKUP_COMPLAIN, don't complain about anything. */
tree
-convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
- tree exp, type, rhs;
- int flags;
- const char *errtype;
- tree fndecl;
- int parmnum;
+convert_for_initialization (tree exp, tree type, tree rhs, int flags,
+ const char *errtype, tree fndecl, int parmnum)
{
- register enum tree_code codel = TREE_CODE (type);
- register tree rhstype;
- register enum tree_code coder;
+ enum tree_code codel = TREE_CODE (type);
+ tree rhstype;
+ enum tree_code coder;
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
Strip such NOP_EXPRs, since RHS is used in non-lvalue context. */
@@ -6029,13 +5794,6 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
|| (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node))
return error_mark_node;
- if (TREE_CODE (rhs) == OFFSET_REF)
- {
- rhs = resolve_offset_ref (rhs);
- if (rhs == error_mark_node)
- return error_mark_node;
- }
-
if (TREE_CODE (TREE_TYPE (rhs)) == REFERENCE_TYPE)
rhs = convert_from_reference (rhs);
@@ -6047,7 +5805,7 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
&& (TREE_CODE (type) != REFERENCE_TYPE
|| TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE))
|| TREE_CODE (TREE_TYPE (rhs)) == METHOD_TYPE)
- rhs = default_conversion (rhs);
+ rhs = decay_conversion (rhs);
rhstype = TREE_TYPE (rhs);
coder = TREE_CODE (rhstype);
@@ -6082,8 +5840,7 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
if (exp == error_mark_node)
return error_mark_node;
- if (TREE_CODE (rhstype) == REFERENCE_TYPE)
- rhstype = TREE_TYPE (rhstype);
+ rhstype = non_reference (rhstype);
type = complete_type (type);
@@ -6103,17 +5860,14 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
up operands that are expected to be in memory. */
void
-c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
- tree string, outputs, inputs, clobbers;
- int vol;
- const char *filename;
- int line;
+c_expand_asm_operands (tree string, tree outputs, tree inputs, tree clobbers,
+ int vol, location_t locus)
{
int noutputs = list_length (outputs);
- register int i;
+ int i;
/* o[I] is the place that output number I should be written. */
- register tree *o = (tree *) alloca (noutputs * sizeof (tree));
- register tree tail;
+ tree *o = alloca (noutputs * sizeof (tree));
+ tree tail;
/* Record the contents of OUTPUTS before it is modified. */
for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
@@ -6122,7 +5876,7 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
/* Generate the ASM_OPERANDS insn;
store into the TREE_VALUEs of OUTPUTS some trees for
where the values were actually stored. */
- expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line);
+ expand_asm_operands (string, outputs, inputs, clobbers, vol, locus);
/* Copy all the intermediate outputs into the specified outputs. */
for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
@@ -6144,8 +5898,7 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
tree type = TREE_TYPE (o[i]);
if (type != error_mark_node
&& (CP_TYPE_CONST_P (type)
- || (IS_AGGR_TYPE_CODE (TREE_CODE (type))
- && C_TYPE_FIELDS_READONLY (type))))
+ || (CLASS_TYPE_P (type) && C_TYPE_FIELDS_READONLY (type))))
readonly_error (o[i], "modification by `asm'", 1);
}
}
@@ -6155,11 +5908,10 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
}
/* If RETVAL is the address of, or a reference to, a local variable or
- temporary give an appropraite warning. */
+ temporary give an appropriate warning. */
static void
-maybe_warn_about_returning_address_of_local (retval)
- tree retval;
+maybe_warn_about_returning_address_of_local (tree retval)
{
tree valtype = TREE_TYPE (DECL_RESULT (current_function_decl));
tree whats_returned = retval;
@@ -6185,8 +5937,6 @@ maybe_warn_about_returning_address_of_local (retval)
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;
}
@@ -6221,8 +5971,7 @@ maybe_warn_about_returning_address_of_local (retval)
the DECL_RESULT for the function. */
tree
-check_return_expr (retval)
- tree retval;
+check_return_expr (tree retval)
{
tree result;
/* The type actually returned by the function, after any
@@ -6255,6 +6004,12 @@ check_return_expr (retval)
return NULL_TREE;
}
+ if (processing_template_decl)
+ {
+ current_function_returns_value = 1;
+ return retval;
+ }
+
/* 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);
@@ -6268,7 +6023,8 @@ check_return_expr (retval)
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");
+ pedwarn ("return-statement with no value, in function returning '%T'",
+ valtype);
/* 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!). */
@@ -6284,7 +6040,8 @@ check_return_expr (retval)
its side-effects. */
finish_expr_stmt (retval);
else
- pedwarn ("return-statement with a value, in function declared with a void return type");
+ pedwarn ("return-statement with a value, in function "
+ "returning 'void'");
current_function_returns_null = 1;
@@ -6330,8 +6087,9 @@ check_return_expr (retval)
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. */
+ See finish_function, cxx_expand_function_start, and
+ cp_copy_res_decl_for_inlining for other pieces of this
+ optimization. */
if (fn_returns_value_p && flag_elide_constructors)
{
@@ -6404,11 +6162,9 @@ check_return_expr (retval)
const-qualified. */
static int
-comp_ptr_ttypes_real (to, from, constp)
- tree to, from;
- int constp;
+comp_ptr_ttypes_real (tree to, tree from, int constp)
{
- int to_more_cv_qualified = 0;
+ bool to_more_cv_qualified = false;
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{
@@ -6416,9 +6172,9 @@ comp_ptr_ttypes_real (to, from, constp)
return 0;
if (TREE_CODE (from) == OFFSET_TYPE
- && same_type_p (TYPE_OFFSET_BASETYPE (from),
- TYPE_OFFSET_BASETYPE (to)))
- continue;
+ && !same_type_p (TYPE_OFFSET_BASETYPE (from),
+ TYPE_OFFSET_BASETYPE (to)))
+ return 0;
/* Const and volatile mean something different for function types,
so the usual checks are not appropriate. */
@@ -6431,28 +6187,25 @@ comp_ptr_ttypes_real (to, from, constp)
{
if (constp == 0)
return 0;
- else
- ++to_more_cv_qualified;
+ to_more_cv_qualified = true;
}
if (constp > 0)
constp &= TYPE_READONLY (to);
}
- if (TREE_CODE (to) != POINTER_TYPE)
- return
- same_type_ignoring_top_level_qualifiers_p (to, from)
- && (constp >= 0 || to_more_cv_qualified);
+ if (TREE_CODE (to) != POINTER_TYPE && !TYPE_PTRMEM_P (to))
+ return ((constp >= 0 || to_more_cv_qualified)
+ && same_type_ignoring_top_level_qualifiers_p (to, from));
}
}
-/* When comparing, say, char ** to char const **, this function takes the
- 'char *' and 'char const *'. Do not pass non-pointer types to this
- function. */
+/* When comparing, say, char ** to char const **, this function takes
+ the 'char *' and 'char const *'. Do not pass non-pointer/reference
+ types to this function. */
int
-comp_ptr_ttypes (to, from)
- tree to, from;
+comp_ptr_ttypes (tree to, tree from)
{
return comp_ptr_ttypes_real (to, from, 1);
}
@@ -6461,8 +6214,7 @@ comp_ptr_ttypes (to, from)
type or inheritance-related types, regardless of cv-quals. */
int
-ptr_reasonably_similar (to, from)
- tree to, from;
+ptr_reasonably_similar (tree to, tree from)
{
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{
@@ -6477,7 +6229,7 @@ ptr_reasonably_similar (to, from)
if (TREE_CODE (from) == OFFSET_TYPE
&& comptypes (TYPE_OFFSET_BASETYPE (to),
TYPE_OFFSET_BASETYPE (from),
- COMPARE_BASE | COMPARE_RELAXED))
+ COMPARE_BASE | COMPARE_DERIVED))
continue;
if (TREE_CODE (to) == INTEGER_TYPE
@@ -6490,15 +6242,14 @@ ptr_reasonably_similar (to, from)
if (TREE_CODE (to) != POINTER_TYPE)
return comptypes
(TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from),
- COMPARE_BASE | COMPARE_RELAXED);
+ COMPARE_BASE | COMPARE_DERIVED);
}
}
/* Like comp_ptr_ttypes, for const_cast. */
static int
-comp_ptr_ttypes_const (to, from)
- tree to, from;
+comp_ptr_ttypes_const (tree to, tree from)
{
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{
@@ -6515,47 +6266,11 @@ comp_ptr_ttypes_const (to, from)
}
}
-/* Like comp_ptr_ttypes, for reinterpret_cast. */
-
-static int
-comp_ptr_ttypes_reinterpret (to, from)
- tree to, from;
-{
- int constp = 1;
-
- for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
- {
- if (TREE_CODE (from) == OFFSET_TYPE)
- from = TREE_TYPE (from);
- if (TREE_CODE (to) == OFFSET_TYPE)
- to = TREE_TYPE (to);
-
- /* Const and volatile mean something different for function types,
- so the usual checks are not appropriate. */
- if (TREE_CODE (from) != FUNCTION_TYPE && TREE_CODE (from) != METHOD_TYPE
- && TREE_CODE (to) != FUNCTION_TYPE && TREE_CODE (to) != METHOD_TYPE)
- {
- if (!at_least_as_qualified_p (to, from))
- return 0;
-
- if (! constp
- && !at_least_as_qualified_p (from, to))
- return 0;
- constp &= TYPE_READONLY (to);
- }
-
- if (TREE_CODE (from) != POINTER_TYPE
- || TREE_CODE (to) != POINTER_TYPE)
- return 1;
- }
-}
-
/* Returns the type qualifiers for this type, including the qualifiers on the
elements for an array type. */
int
-cp_type_quals (type)
- tree type;
+cp_type_quals (tree type)
{
type = strip_array_types (type);
if (type == error_mark_node)
@@ -6563,11 +6278,10 @@ cp_type_quals (type)
return TYPE_QUALS (type);
}
-/* Returns nonzero if the TYPE contains a mutable member */
+/* Returns nonzero if the TYPE contains a mutable member. */
-int
-cp_has_mutable_p (type)
- tree type;
+bool
+cp_has_mutable_p (tree type)
{
type = strip_array_types (type);
@@ -6579,9 +6293,7 @@ cp_has_mutable_p (type)
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;
+casts_away_constness_r (tree *t1, tree *t2)
{
int quals1;
int quals2;
@@ -6593,9 +6305,9 @@ casts_away_constness_r (t1, t2)
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)));
+ *t1 = build_pointer_type (TYPE_PTRMEM_POINTED_TO_TYPE (*t1));
if (TYPE_PTRMEM_P (*t2))
- *t2 = build_pointer_type (TREE_TYPE (TREE_TYPE (*t2)));
+ *t2 = build_pointer_type (TYPE_PTRMEM_POINTED_TO_TYPE (*t2));
/* [expr.const.cast]
@@ -6639,10 +6351,8 @@ casts_away_constness_r (t1, t2)
/* Returns nonzero if casting from TYPE1 to TYPE2 casts away
constness. */
-static int
-casts_away_constness (t1, t2)
- tree t1;
- tree t2;
+static bool
+casts_away_constness (tree t1, tree t2)
{
if (TREE_CODE (t2) == REFERENCE_TYPE)
{
@@ -6652,8 +6362,7 @@ casts_away_constness (t1, 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);
+ t1 = (TREE_CODE (t1) == REFERENCE_TYPE ? TREE_TYPE (t1) : t1);
return casts_away_constness (build_pointer_type (t1),
build_pointer_type (TREE_TYPE (t2)));
}
@@ -6667,39 +6376,32 @@ casts_away_constness (t1, t2)
"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))));
+ (build_pointer_type (TYPE_PTRMEM_POINTED_TO_TYPE (t1)),
+ build_pointer_type (TYPE_PTRMEM_POINTED_TO_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;
+ return false;
/* 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 true;
- return 0;
+ return false;
}
-/* 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.) */
+/* If T is a REFERENCE_TYPE return the type to which T refers.
+ Otherwise, return T itself. */
-static tree
-strip_all_pointer_quals (type)
- tree type;
+tree
+non_reference (tree t)
{
- 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);
+ if (TREE_CODE (t) == REFERENCE_TYPE)
+ t = TREE_TYPE (t);
+ return t;
}
diff --git a/contrib/gcc/cp/typeck2.c b/contrib/gcc/cp/typeck2.c
index b063f42..300e8e6 100644
--- a/contrib/gcc/cp/typeck2.c
+++ b/contrib/gcc/cp/typeck2.c
@@ -1,23 +1,23 @@
/* Report error messages, build initializers, and perform
some front-end optimizations for C++ compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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,
+GCC 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
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@@ -33,6 +33,8 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "cp-tree.h"
#include "flags.h"
@@ -40,14 +42,13 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "diagnostic.h"
-static tree process_init_constructor PARAMS ((tree, tree, tree *));
+static tree process_init_constructor (tree, tree, tree *);
/* Print an error message stemming from an attempt to use
BASETYPE as a base class for TYPE. */
tree
-error_not_base_type (basetype, type)
- tree basetype, type;
+error_not_base_type (tree basetype, tree type)
{
if (TREE_CODE (basetype) == FUNCTION_DECL)
basetype = DECL_CONTEXT (basetype);
@@ -56,8 +57,7 @@ error_not_base_type (basetype, type)
}
tree
-binfo_or_else (base, type)
- tree base, type;
+binfo_or_else (tree base, tree type)
{
tree binfo = lookup_base (type, base, ba_ignore, NULL);
@@ -74,13 +74,10 @@ binfo_or_else (base, type)
example, conversions to references.) */
void
-readonly_error (arg, string, soft)
- tree arg;
- const char *string;
- int soft;
+readonly_error (tree arg, const char* string, int soft)
{
const char *fmt;
- void (*fn) PARAMS ((const char *, ...));
+ void (*fn) (const char *, ...);
if (soft)
fn = pedwarn;
@@ -126,19 +123,11 @@ readonly_error (arg, string, soft)
occurred; zero if all was well. */
int
-abstract_virtuals_error (decl, type)
- tree decl;
- tree type;
+abstract_virtuals_error (tree decl, tree type)
{
tree u;
tree tu;
- if (processing_template_decl)
- /* If we are processing a template, TYPE may be a template
- class where CLASSTYPE_PURE_VIRTUALS always contains
- inline friends. */
- return 0;
-
if (!CLASS_TYPE_P (type) || !CLASSTYPE_PURE_VIRTUALS (type))
return 0;
@@ -147,6 +136,11 @@ abstract_virtuals_error (decl, type)
CLASSTYPE_PURE_VIRTUALS holds the inline friends. */
return 0;
+ if (dependent_type_p (type))
+ /* For a dependent type, we do not yet know which functions are pure
+ virtuals. */
+ return 0;
+
u = CLASSTYPE_PURE_VIRTUALS (type);
if (decl)
{
@@ -193,14 +187,11 @@ abstract_virtuals_error (decl, type)
pedwarn. */
void
-cxx_incomplete_type_diagnostic (value, type, diag_type)
- tree value;
- tree type;
- int diag_type;
+cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
{
int decl = 0;
- void (*p_msg) PARAMS ((const char *, ...));
- void (*p_msg_at) PARAMS ((const char *, ...));
+ void (*p_msg) (const char *, ...);
+ void (*p_msg_at) (const char *, ...);
if (diag_type == 1)
{
@@ -279,8 +270,7 @@ retry:
break;
default:
- (*p_msg) ("invalid use of incomplete type");
- break;
+ abort ();
}
}
@@ -288,14 +278,115 @@ retry:
required by ../tree.c. */
#undef cxx_incomplete_type_error
void
-cxx_incomplete_type_error (value, type)
- tree value;
- tree type;
+cxx_incomplete_type_error (tree value, tree type)
{
cxx_incomplete_type_diagnostic (value, type, 0);
}
+/* The recursive part of split_nonconstant_init. DEST is an lvalue
+ expression to which INIT should be assigned. INIT is a CONSTRUCTOR.
+ PCODE is a pointer to the tail of a chain of statements being emitted.
+ The return value is the new tail of that chain after new statements
+ are generated. */
+
+static tree *
+split_nonconstant_init_1 (tree dest, tree init, tree *pcode)
+{
+ tree *pelt, elt, type = TREE_TYPE (dest);
+ tree sub, code, inner_type = NULL;
+ bool array_type_p = false;
+
+ pelt = &CONSTRUCTOR_ELTS (init);
+ switch (TREE_CODE (type))
+ {
+ case ARRAY_TYPE:
+ inner_type = TREE_TYPE (type);
+ array_type_p = true;
+ /* FALLTHRU */
+
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ case QUAL_UNION_TYPE:
+ while ((elt = *pelt))
+ {
+ tree field_index = TREE_PURPOSE (elt);
+ tree value = TREE_VALUE (elt);
+
+ if (!array_type_p)
+ inner_type = TREE_TYPE (field_index);
+
+ if (TREE_CODE (value) == CONSTRUCTOR)
+ {
+ if (array_type_p)
+ sub = build (ARRAY_REF, inner_type, dest, field_index);
+ else
+ sub = build (COMPONENT_REF, inner_type, dest, field_index);
+
+ pcode = split_nonconstant_init_1 (sub, value, pcode);
+ }
+ else if (!initializer_constant_valid_p (value, inner_type))
+ {
+ *pelt = TREE_CHAIN (elt);
+
+ if (array_type_p)
+ sub = build (ARRAY_REF, inner_type, dest, field_index);
+ else
+ sub = build (COMPONENT_REF, inner_type, dest, field_index);
+
+ code = build (MODIFY_EXPR, inner_type, sub, value);
+ code = build_stmt (EXPR_STMT, code);
+
+ *pcode = code;
+ pcode = &TREE_CHAIN (code);
+ continue;
+ }
+ pelt = &TREE_CHAIN (elt);
+ }
+ break;
+
+ case VECTOR_TYPE:
+ if (!initializer_constant_valid_p (init, type))
+ {
+ CONSTRUCTOR_ELTS (init) = NULL;
+ code = build (MODIFY_EXPR, type, dest, init);
+ code = build_stmt (EXPR_STMT, code);
+ pcode = &TREE_CHAIN (code);
+ }
+ break;
+
+ default:
+ abort ();
+ }
+
+ return pcode;
+}
+
+/* A subroutine of store_init_value. Splits non-constant static
+ initializer INIT into a constant part and generates code to
+ perform the non-constant part of the initialization to DEST.
+ Returns the code for the runtime init. */
+
+static tree
+split_nonconstant_init (tree dest, tree init)
+{
+ tree code;
+
+ if (TREE_CODE (init) == CONSTRUCTOR)
+ {
+ code = build_stmt (COMPOUND_STMT, NULL_TREE);
+ split_nonconstant_init_1 (dest, init, &COMPOUND_BODY (code));
+ code = build1 (STMT_EXPR, void_type_node, code);
+ TREE_SIDE_EFFECTS (code) = 1;
+ DECL_INITIAL (dest) = init;
+ TREE_READONLY (dest) = 0;
+ }
+ else
+ code = build (INIT_EXPR, TREE_TYPE (dest), dest, init);
+
+ return code;
+}
+
/* Perform appropriate conversions on the initial value of a variable,
store it in the declaration DECL,
and print any error messages that are appropriate.
@@ -311,15 +402,13 @@ cxx_incomplete_type_error (value, type)
into a CONSTRUCTOR and use standard initialization techniques.
Perhaps a warning should be generated?
- Returns value of initializer if initialization could not be
- performed for static variable. In that case, caller must do
- the storing. */
+ Returns code to be executed if initialization could not be performed
+ for static variable. In that case, caller must emit the code. */
tree
-store_init_value (decl, init)
- tree decl, init;
+store_init_value (tree decl, tree init)
{
- register tree value, type;
+ tree value, type;
/* If variable's type was invalidly declared, just ignore it. */
@@ -336,22 +425,15 @@ store_init_value (decl, init)
if (TREE_CODE (init) == TREE_LIST)
{
error ("constructor syntax used, but no constructor declared for type `%T'", type);
- init = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (init));
+ init = build_constructor (NULL_TREE, nreverse (init));
}
}
else if (TREE_CODE (init) == TREE_LIST
&& TREE_TYPE (init) != unknown_type_node)
{
if (TREE_CODE (decl) == RESULT_DECL)
- {
- if (TREE_CHAIN (init))
- {
- warning ("comma expression used to initialize return value");
- init = build_compound_expr (init);
- }
- else
- init = TREE_VALUE (init);
- }
+ init = build_x_compound_expr_from_list (init,
+ "return value initializer");
else if (TREE_CODE (init) == TREE_LIST
&& TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
{
@@ -359,17 +441,8 @@ store_init_value (decl, init)
return NULL_TREE;
}
else
- {
- /* We get here with code like `int a (2);' */
-
- if (TREE_CHAIN (init) != NULL_TREE)
- {
- pedwarn ("initializer list being treated as compound expression");
- init = build_compound_expr (init);
- }
- else
- init = TREE_VALUE (init);
- }
+ /* We get here with code like `int a (2);' */
+ init = build_x_compound_expr_from_list (init, "initializer");
}
/* End of special C++ code. */
@@ -385,11 +458,11 @@ store_init_value (decl, init)
constructing never make it into DECL_INITIAL, and passes 'init' to
build_aggr_init without checking DECL_INITIAL. So just return. */
else if (TYPE_NEEDS_CONSTRUCTING (type))
- return value;
+ return build (INIT_EXPR, type, decl, value);
else if (TREE_STATIC (decl)
&& (! TREE_CONSTANT (value)
|| ! initializer_constant_valid_p (value, TREE_TYPE (value))))
- return value;
+ return split_nonconstant_init (decl, value);
/* Store the VALUE in DECL_INITIAL. If we're building a
statement-tree we will actually expand the initialization later
@@ -409,8 +482,7 @@ store_init_value (decl, init)
TYPE is an aggregate and INIT is not a constructor. */
tree
-digest_init (type, init, tail)
- tree type, init, *tail;
+digest_init (tree type, tree init, tree* tail)
{
enum tree_code code = TREE_CODE (type);
tree element = NULL_TREE;
@@ -500,8 +572,7 @@ digest_init (type, init, tail)
if (TYPE_DOMAIN (type) != 0
&& TREE_CONSTANT (TYPE_SIZE (type)))
{
- register int size
- = TREE_INT_CST_LOW (TYPE_SIZE (type));
+ int size = TREE_INT_CST_LOW (TYPE_SIZE (type));
size = (size + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
/* In C it is ok to subtract 1 from the length of the string
because it's ok to ignore the terminating null char that is
@@ -520,7 +591,7 @@ 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))
+ || TYPE_PTR_TO_MEMBER_P (type))
{
if (raw_constructor)
{
@@ -605,14 +676,13 @@ digest_init (type, init, tail)
constants that the assembler and linker can compute them. */
static tree
-process_init_constructor (type, init, elts)
- tree type, init, *elts;
+process_init_constructor (tree type, tree init, tree* elts)
{
- register tree tail;
+ tree tail;
/* List of the elements of the result constructor,
in reverse order. */
- register tree members = NULL;
- register tree next1;
+ tree members = NULL;
+ tree next1;
tree result;
int allconstant = 1;
int allsimple = 1;
@@ -636,8 +706,8 @@ process_init_constructor (type, init, elts)
if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == VECTOR_TYPE)
{
- register long len;
- register int i;
+ long len;
+ int i;
if (TREE_CODE (type) == ARRAY_TYPE)
{
@@ -647,7 +717,7 @@ process_init_constructor (type, init, elts)
- TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain))
+ 1);
else
- len = -1; /* Take as many as there are */
+ len = -1; /* Take as many as there are. */
}
else
{
@@ -704,7 +774,7 @@ process_init_constructor (type, init, elts)
if (IS_AGGR_TYPE (TREE_TYPE (type)))
next1 = build_functional_cast (TREE_TYPE (type), NULL_TREE);
else
- next1 = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, NULL_TREE);
+ next1 = build_constructor (NULL_TREE, NULL_TREE);
next1 = digest_init (TREE_TYPE (type), next1, 0);
}
else if (! zero_init_p (TREE_TYPE (type)))
@@ -727,7 +797,7 @@ process_init_constructor (type, init, elts)
}
else if (TREE_CODE (type) == RECORD_TYPE)
{
- register tree field;
+ tree field;
if (tail)
{
@@ -797,8 +867,7 @@ process_init_constructor (type, init, elts)
NULL_TREE);
else
{
- next1 = build (CONSTRUCTOR, NULL_TREE, NULL_TREE,
- NULL_TREE);
+ next1 = build_constructor (NULL_TREE, NULL_TREE);
if (init)
TREE_HAS_CONSTRUCTOR (next1)
= TREE_HAS_CONSTRUCTOR (init);
@@ -849,7 +918,7 @@ process_init_constructor (type, init, elts)
/* If the initializer was empty, use default zero initialization. */
&& tail)
{
- register tree field = TYPE_FIELDS (type);
+ tree field = TYPE_FIELDS (type);
/* Find the first named field. ANSI decided in September 1990
that only named fields count here. */
@@ -926,7 +995,7 @@ process_init_constructor (type, init, elts)
if (erroneous)
return error_mark_node;
- result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (members));
+ result = build_constructor (type, nreverse (members));
if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == NULL_TREE)
complete_array_type (type, result, /*do_default=*/0);
if (init)
@@ -965,10 +1034,7 @@ process_init_constructor (type, init, elts)
binfo for the specific base subobject we want to convert to. */
tree
-build_scoped_ref (datum, basetype, binfo_p)
- tree datum;
- tree basetype;
- tree *binfo_p;
+build_scoped_ref (tree datum, tree basetype, tree* binfo_p)
{
tree binfo;
@@ -999,51 +1065,49 @@ build_scoped_ref (datum, basetype, binfo_p)
delegation is detected. */
tree
-build_x_arrow (datum)
- tree datum;
+build_x_arrow (tree expr)
{
+ tree orig_expr = expr;
tree types_memoized = NULL_TREE;
- register tree rval = datum;
- tree type = TREE_TYPE (rval);
+ tree type = TREE_TYPE (expr);
tree last_rval = NULL_TREE;
if (type == error_mark_node)
return error_mark_node;
if (processing_template_decl)
- return build_min_nt (ARROW_EXPR, rval);
-
- if (TREE_CODE (rval) == OFFSET_REF)
{
- rval = resolve_offset_ref (datum);
- type = TREE_TYPE (rval);
+ if (type_dependent_expression_p (expr))
+ return build_min_nt (ARROW_EXPR, expr);
+ expr = build_non_dependent_expr (expr);
}
if (TREE_CODE (type) == REFERENCE_TYPE)
{
- rval = convert_from_reference (rval);
- type = TREE_TYPE (rval);
+ expr = convert_from_reference (expr);
+ type = TREE_TYPE (expr);
}
if (IS_AGGR_TYPE (type))
{
- while ((rval = build_opfncall (COMPONENT_REF, LOOKUP_NORMAL, rval,
- NULL_TREE, NULL_TREE)))
+ while ((expr = build_new_op (COMPONENT_REF, LOOKUP_NORMAL, expr,
+ NULL_TREE, NULL_TREE,
+ /*overloaded_p=*/NULL)))
{
- if (rval == error_mark_node)
+ if (expr == error_mark_node)
return error_mark_node;
- if (value_member (TREE_TYPE (rval), types_memoized))
+ if (value_member (TREE_TYPE (expr), types_memoized))
{
error ("circular pointer delegation detected");
return error_mark_node;
}
else
{
- types_memoized = tree_cons (NULL_TREE, TREE_TYPE (rval),
+ types_memoized = tree_cons (NULL_TREE, TREE_TYPE (expr),
types_memoized);
}
- last_rval = rval;
+ last_rval = expr;
}
if (last_rval == NULL_TREE)
@@ -1056,10 +1120,20 @@ build_x_arrow (datum)
last_rval = convert_from_reference (last_rval);
}
else
- last_rval = default_conversion (rval);
+ last_rval = decay_conversion (expr);
if (TREE_CODE (TREE_TYPE (last_rval)) == POINTER_TYPE)
- return build_indirect_ref (last_rval, NULL);
+ {
+ if (processing_template_decl)
+ {
+ expr = build_min_non_dep (ARROW_EXPR, last_rval, orig_expr);
+ /* It will be dereferenced. */
+ TREE_TYPE (expr) = TREE_TYPE (TREE_TYPE (last_rval));
+ return expr;
+ }
+
+ return build_indirect_ref (last_rval, NULL);
+ }
if (types_memoized)
error ("result of `operator->()' yields non-pointer result");
@@ -1068,73 +1142,31 @@ build_x_arrow (datum)
return error_mark_node;
}
-/* Make an expression to refer to the COMPONENT field of
- structure or union value DATUM. COMPONENT is an arbitrary
- expression. DATUM has not already been checked out to be of
- aggregate type.
-
- For C++, COMPONENT may be a TREE_LIST. This happens when we must
- return an object of member type to a method of the current class,
- but there is not yet enough typing information to know which one.
- As a special case, if there is only one method by that name,
- it is returned. Otherwise we return an expression which other
- routines will have to know how to deal with later. */
+/* Return an expression for "DATUM .* COMPONENT". DATUM has not
+ already been checked out to be of aggregate type. */
tree
-build_m_component_ref (datum, component)
- tree datum, component;
+build_m_component_ref (tree datum, tree component)
{
- tree type;
+ tree ptrmem_type;
tree objtype;
- tree field_type;
- int type_quals;
+ tree type;
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)));
- field_type = type;
- }
- else if (TYPE_PTRMEM_P (TREE_TYPE (component)))
- {
- type = TREE_TYPE (TREE_TYPE (component));
- 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)));
-
- /* There's no such thing as a mutable pointer-to-member, so
- things are not as complex as they are for references to
- non-static data members. */
- field_type = cp_build_qualified_type (field_type, type_quals);
- }
- }
- else
+ ptrmem_type = TREE_TYPE (component);
+ if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type))
{
error ("`%E' cannot be used as a member pointer, since it is of type `%T'",
- component, TREE_TYPE (component));
+ component, ptrmem_type);
return error_mark_node;
}
-
+
+ objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));
if (! IS_AGGR_TYPE (objtype))
{
error ("cannot apply member pointer `%E' to `%E', which is of non-aggregate type `%T'",
@@ -1142,29 +1174,43 @@ build_m_component_ref (datum, component)
return error_mark_node;
}
- binfo = lookup_base (objtype, TYPE_METHOD_BASETYPE (type),
+ type = TYPE_PTRMEM_POINTED_TO_TYPE (ptrmem_type);
+ binfo = lookup_base (objtype, TYPE_PTRMEM_CLASS_TYPE (ptrmem_type),
ba_check, NULL);
if (!binfo)
{
error ("member type `%T::' incompatible with object type `%T'",
- TYPE_METHOD_BASETYPE (type), objtype);
+ type, objtype);
return error_mark_node;
}
else if (binfo == error_mark_node)
return error_mark_node;
- component = build (OFFSET_REF, field_type, datum, component);
- if (TREE_CODE (type) == OFFSET_TYPE)
- component = resolve_offset_ref (component);
- return component;
+ if (TYPE_PTRMEM_P (ptrmem_type))
+ {
+ /* Compute the type of the field, as described in [expr.ref].
+ There's no such thing as a mutable pointer-to-member, so
+ things are not as complex as they are for references to
+ non-static data members. */
+ type = cp_build_qualified_type (type,
+ (cp_type_quals (type)
+ | cp_type_quals (TREE_TYPE (datum))));
+ /* Build an expression for "object + offset" where offset is the
+ value stored in the pointer-to-data-member. */
+ datum = build (PLUS_EXPR, build_pointer_type (type),
+ build_base_path (PLUS_EXPR, build_address (datum),
+ binfo, 1),
+ build_nop (ptrdiff_type_node, component));
+ return build_indirect_ref (datum, 0);
+ }
+ else
+ return build (OFFSET_REF, type, datum, component);
}
/* Return a tree node for the expression TYPENAME '(' PARMS ')'. */
tree
-build_functional_cast (exp, parms)
- tree exp;
- tree parms;
+build_functional_cast (tree exp, tree parms)
{
/* This is either a call to a constructor,
or a C cast in C++'s `functional' notation. */
@@ -1173,41 +1219,26 @@ build_functional_cast (exp, parms)
if (exp == error_mark_node || parms == error_mark_node)
return error_mark_node;
- if (TREE_CODE (exp) == IDENTIFIER_NODE)
- {
- if (IDENTIFIER_HAS_TYPE_VALUE (exp))
- /* Either an enum or an aggregate type. */
- type = IDENTIFIER_TYPE_VALUE (exp);
- else
- {
- type = lookup_name (exp, 1);
- if (!type || TREE_CODE (type) != TYPE_DECL)
- {
- error ("`%T' fails to be a typedef or built-in type", exp);
- return error_mark_node;
- }
- type = TREE_TYPE (type);
- }
- }
- else if (TREE_CODE (exp) == TYPE_DECL)
+ if (TREE_CODE (exp) == TYPE_DECL)
type = TREE_TYPE (exp);
else
type = exp;
if (processing_template_decl)
- return build_min (CAST_EXPR, type, parms);
+ {
+ tree t = build_min (CAST_EXPR, type, parms);
+ /* We don't know if it will or will not have side effects. */
+ TREE_SIDE_EFFECTS (t) = 1;
+ return t;
+ }
if (! IS_AGGR_TYPE (type))
{
- /* this must build a C cast */
+ /* This must build a C cast. */
if (parms == NULL_TREE)
parms = integer_zero_node;
else
- {
- if (TREE_CHAIN (parms) != NULL_TREE)
- pedwarn ("initializer list being treated as compound expression");
- parms = build_compound_expr (parms);
- }
+ parms = build_x_compound_expr_from_list (parms, "functional cast");
return build_c_cast (type, parms);
}
@@ -1232,7 +1263,7 @@ build_functional_cast (exp, parms)
if (parms == NULL_TREE && !TYPE_NEEDS_CONSTRUCTING (type)
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
{
- exp = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
+ exp = build_constructor (type, NULL_TREE);
return get_target_expr (exp);
}
@@ -1246,32 +1277,17 @@ build_functional_cast (exp, parms)
}
-/* Complain about defining new types in inappropriate places. We give an
- exception for C-style casts, to accommodate GNU C stylings. */
-
-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);
-}
-
/* 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. */
tree
-add_exception_specifier (list, spec, complain)
- tree list, spec;
- int complain;
+add_exception_specifier (tree list, tree spec, int complain)
{
- int ok;
+ bool ok;
tree core = spec;
- int is_ptr;
+ bool is_ptr;
int diag_type = -1; /* none */
if (spec == error_mark_node)
@@ -1286,16 +1302,16 @@ add_exception_specifier (list, spec, complain)
if (is_ptr || TREE_CODE (core) == REFERENCE_TYPE)
core = TREE_TYPE (core);
if (complain < 0)
- ok = 1;
+ ok = true;
else if (VOID_TYPE_P (core))
ok = is_ptr;
else if (TREE_CODE (core) == TEMPLATE_TYPE_PARM)
- ok = 1;
+ ok = true;
else if (processing_template_decl)
- ok = 1;
+ ok = true;
else
{
- ok = 1;
+ ok = true;
/* 15.4/1 says that types in an exception specifier must be complete,
but it seems more reasonable to only require this on definitions
and calls. So just give a pedwarn at this point; we will give an
@@ -1327,8 +1343,7 @@ add_exception_specifier (list, spec, complain)
their union. */
tree
-merge_exception_specifiers (list, add)
- tree list, add;
+merge_exception_specifiers (tree list, tree add)
{
if (!list || !add)
return NULL_TREE;
@@ -1366,8 +1381,7 @@ merge_exception_specifiers (list, add)
function is defined or called. See also add_exception_specifier. */
void
-require_complete_eh_spec_types (fntype, decl)
- tree fntype, decl;
+require_complete_eh_spec_types (tree fntype, tree decl)
{
tree raises;
/* Don't complain about calls to op new. */
OpenPOWER on IntegriCloud