diff -Nrc3pad gcc-3.0.4/gcc/cp/ChangeLog gcc-3.1/gcc/cp/ChangeLog *** gcc-3.0.4/gcc/cp/ChangeLog Wed Feb 20 18:41:15 2002 --- gcc-3.1/gcc/cp/ChangeLog Wed May 15 02:19:33 2002 *************** *** 1,155 **** ! 2002-02-20 Release Manager ! * GCC 3.0.4 Released. ! 2002-02-20 Release Manager ! * GCC 3.0.4 Released. ! 2002-02-17 Kaveh R. Ghazi ! * decl.c (start_method): Fix error in 2002-01-10 change. ! 2002-02-13 Richard Smith ! * decl.c (maybe_build_cleanup): Do not destroy thunk parameters. 2002-01-31 Jason Merrill PR c++/3395 ! * semantics.c (finish_class_definition): Clear out TREE_TYPE for ! all variants. 2002-01-23 Jason Merrill PR c++/3331 * init.c (resolve_offset_ref): Use build_indirect_ref. 2002-01-10 Ira Ruben PR c++/907 * decl.c (start_method): Handle attrlist. 2002-01-07 Jason Merrill PR c++/3536 * method.c (make_thunk): If !flag_weak, give the thunk the function's linkage. (use_thunk): Here, too. ! 2001-12-21 Jason Merrill PR c++/4122 * class.c (update_vtable_entry_for_fn): Set delta to zero for a lost primary. 2001-12-18 Jason Merrill 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. ! * optimize.c (maybe_clone_body): Fix parameter updating. ! 2001-12-20 Release Manager ! * GCC 3.0.3 Released. 2001-12-12 Jason Merrill * semantics.c (setup_vtbl_ptr): Always build a CTOR_INITIALIZER if we're in a template. 2001-12-08 John David Anglin * 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-05 Jason Merrill * pt.c (push_tinst_level): No longer static. ! * cp-tree.h: Declare it. ! * optimize.c (expand_call_inline): Record template instantiation ! context. * rtti.c (create_pseudo_type_info): Set CLASSTYPE_INTERFACE_ONLY on the __*_type_info type if we haven't seen a definition. 2001-12-03 Hans-Peter Nilsson * decl.c (xref_basetypes): Don't use C99 construct in tag_code declaration and initialization. ! 2001-12-03 Kriang Lerdsuwanakij ! * 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-12-03 Mumit Khan PR c++/3394 ! * decl.c (xref_basetypes): Handle attributes between 'class' and name. 2001-12-03 Jason Merrill * class.c (finish_vtbls): Fill in BINFO_VPTR_FIELD in the immediate binfos for our virtual bases. 2001-11-29 Mark Mitchell PR c++/3048 * cp-tree.h (ovl_member): Remove. ! * decl2.c (merge_functions): Handle extern "C" functions specially. * tree.c (ovl_member): Remove. 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. PR c++/3471 * call.c (convert_like_real): Do not build additional temporaries for rvalues of class type. ! 2001-11-20 Mark Mitchell PR c++/3637 * 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 Mark Mitchell ! * cp/decl2.c (grok_alignof): Make sure that expression created while processing a template do not have a type. ! * cp/typeck.c (c_sizeof): Likewise. (expr_sizeof): Likewise. ! (c_alignof): Likewise. 2001-11-14 Joseph S. Myers * Make-lang.in: Change all uses of $(manext) to $(man1ext). ! 2001-10-23 Release Manager ! * GCC 3.0.2 Released. 2001-10-03 John David Anglin * rtti.c (get_tinfo_decl): Call typeinfo_in_lib_p with the type used to build the declaration instead of the declaration itself. ! 2001-09-28 Craig Rodrigues ! PR c++/4095 ! * rtti.c (create_pseudo_type_info): Fix parameter. 2001-09-21 Richard Henderson --- 1,2156 ---- ! 2002-05-14 Release Manager ! * GCC 3.1 Released. ! 2002-05-14 Release Manager ! * GCC 3.1 Released. ! 2002-05-03 Jason Merrill ! * decl.c (BOOL_TYPE_SIZE): Move default to defaults.h. ! 2002-05-02 Mark Mitchell ! * init.c (perform_base_cleanups): Correct order of base class ! cleanups. ! ! 2002-05-01 Mark Mitchell ! ! PR c++/6527 ! * init.c (perform_base_cleanups): Emit cleanups in reverse order ! of construction. ! ! 2002-05-01 Gabriel Dos Reis ! ! * error.c (dump_type): Be careful about implicit typenames. ! ! 2002-04-30 Mark Mitchell ! ! 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 ! ! * decl.c (grokdeclarator): Don't override TYPE_NAME of an ! anonymous class with a typedef if there are attributes. ! ! 2002-04-29 Paul Eggert ! ! * parse.y (nomods_initdcl0): Replace $3 with $$. ! ! 2002-04-29 Jakub Jelinek ! ! PR c++/6477 ! * decl.c (follow_tag_typedef): Check if TYPE_NAME (original) is ! non-NULL first. ! ! 2002-04-29 Mark Mitchell ! ! 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 ! ! PR c++/5719 ! * decl.c (grok_op_properties): Assignment ops don't have to return ! by value. operator% should. ! ! 2002-04-28 Franz Sirl ! ! PR c/6343 ! * decl.c (duplicate_decls): Call merge_weak. ! ! 2002-04-26 Mark Mitchell ! ! PR c++/6479 ! * method.c (do_build_assign_ref): Pass a derivation to ! build_method_call when calling base class assignment operators. ! ! 2002-04-24 Mark Mitchell ! ! * mangle.c (write_type): Don't use TYPE_MAIN_VARIANT when writing ! out an array type. ! (write_CV_qualifiers_for_type): Use TYPE_QUALS, not cp_type_quals, ! to determine qualifiers. ! ! * cvt.c (convert_to_void): Don't unconditionally make COND_EXPRs ! void. ! ! 2002-04-24 Jason Merrill ! ! 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 Jason Merrill ! ! PR c++/5504 - but re-breaks c++/411 ! * init.c (push_base_cleanups): Rename to perform_base_cleanups. ! Expand base cleanups now rather than pushing them. ! * decl.c (begin_destructor_body): Don't call push_base_cleanups. ! (finish_destructor_body): Call perform_base_cleanups. ! * cp-tree.h: Adjust prototype. ! ! 2002-04-23 Jakub Jelinek ! ! * parse.y (check_class_key): Allow KEY to be union/enum/struct/class ! node with attributes. ! ! 2002-2-23 David O'Brien ! ! * 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 ! ! 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-18 Jason Merrill ! ! PR c++/5658 ! * search.c (setup_class_bindings): A class template qualifies as a ! type binding. ! ! 2002-04-17 Jakub Jelinek ! ! PR c++/6316 ! * decl2.c (finish_file): Clear DECL_EXTERNAL in a separate loop ! before expanding. ! ! 2002-04-16 Mark Mitchell ! ! * 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 ! ! * decl.c (register_dtor_fn): Pass the address of dso_handle, not ! dso_handle itself, to __cxa_atexit. ! ! 2002-04-14 Jakub Jelinek ! ! * class.c (layout_virtual_bases): Do all dsize computation on trees. ! ! 2002-04-12 Mark Mitchell ! ! PR c++/5373. ! * semantics.c (finish_expr_stmt): Remember the type of the ! expression before any conversions are performed. ! ! PR c++/5189. ! * call.c (add_template_candidate_real): Do not treat member ! templates as copy constructors. ! ! * 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-11 Andrew Haley ! ! * 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-12 Richard Sandiford ! ! * 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-10 Nathan Sidwell ! ! PR c++/5507 ! * decl.c (make_typename_type): Remove implicit typenameness. ! ! 2002-04-09 Jason Merrill ! ! PR optimization/6189 ! * semantics.c (genrtl_start_function): Don't free ! DECL_SAVED_FUNCTION_DATA for inline functions. ! ! 2002-04-08 Paolo Carlini ! ! * 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 ! ! 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 ! ! PR c++/4934 ! * error.c (dump_expr) [CONVERT_EXPR]: Make sure TREE_TYPE (t) is ! set before checking it. ! ! PR c++/6179 ! * method.c (implicitly_declare_fn): Pass unqualified type to ! synthesize_exception_spec. ! ! 2002-04-03 Jason Merrill ! ! PR c++/525 ! * init.c (build_member_call): Convert to intermediate base even ! with -pedantic. ! ! 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 Roger Sayle ! ! PR c++/5998: ! * decl.c (duplicate_decls): Don't mess with assembler names when ! redeclaring builtin functions as static. ! ! 2002-04-01 Roger Sayle ! ! 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-03-28 Roger Sayle ! ! 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 Jakub Jelinek ! ! 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 Mark Mitchell ! ! PR c++/4884 ! * call.c (build_op_delete_call): Allow for the fact the placement ! may be a COMPOUND_EXPR. ! ! 2002-03-26 Nathan Sidwell ! ! 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 Mark Mitchell ! ! 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-25 Jakub Jelinek ! ! PR c++/6037 ! * decl.c (start_enum): Don't set TREE_ADDRESSABLE on TREE_LIST node. ! ! 2002-03-22 Jeff Knaggs ! ! * typeck.c (expand_ptrmemfunc_cst): Scale idx down to an index ! into the vtable_entry array regardless of ! TARGET_PTRMEMFUNC_VBIT_LOCATION. ! ! 2002-03-21 Aldy Hernandez ! ! * tree.c (cp_cannot_inline_tree_fn): Same. ! ! 2002-03-20 Jason Merrill ! ! 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 ! ! PR c++/5118 ! * class.c (get_vfield_name): Use the constructor_name. ! ! 2002-03-18 Eric Botcazou ! ! 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 Ashif Harji ! ! * lang-specs.h (compiler default_compilers): Add ! -no-integrated-cpp flag to invoke an external cpp. ! ! 2002-03-18 Jason Merrill ! ! 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 ! ! PR c++/4460 ! * class.c (build_base_path): Virtual base layout is fixed in ! in-charge [cd]tors. ! ! PR c++/5757 ! * init.c (build_new_1): Pass the right pointer to op delete. ! ! 2002-03-15 Richard Henderson ! ! * init.c (build_new_1): Use size_binop instead of cp_build_binary_op. ! ! 2002-03-15 Richard Henderson ! ! * decl.c (finish_function): Reapply accidentally reverted ! 2002-02-28 patch. ! ! 2002-03-15 Mark Mitchell ! ! * 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 Richard Henderson ! ! * decl.c: Include c-pragma.h. ! (start_decl, start_function): Invoke maybe_apply_pragma_weak. ! * Make-lang.in: Update dependencies. ! ! 2002-03-15 Jason Merrill ! ! 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 Jakub Jelinek ! ! 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 ! ! * mangle.c (write_builtin_type): Handle 128-bit integers even if ! they are not a standard integer type. ! ! 2002-03-12 Nathan Sidwell ! ! 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 ! ! Revert 2001-03-26 Nathan Sidwell , ! 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 ! ! Revert 2000-12-01 Nathan Sidwell , ! It is incorrect. ! * typeck.c (build_static_cast): Compare non-qualified types ! with pointer to member conversions. ! ! 2002-03-08 Craig Rodrigues ! ! * cp-tree.h (CLEAR_BINFO_MARKED): Make both parts of ! conditional return void. ! ! 2002-03-02 Nathan Sidwell ! ! 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 ! ! * typeck.c (cp_pointer_int_sum): Complete inner type which is ! used later by size_in_bytes(). ! ! 2002-03-01 Phil Edwards ! ! * cp-tree.h (build_init): Remove prototype. ! ! 2002-03-01 Phil Edwards ! ! * cp-tree.h: Require __GNUC__ to be #defined. ! (build_init): Add missing prototype. ! ! 2002-02-28 Jason Merrill ! ! * 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-24 Craig Rodrigues ! ! PR c++/4093 ! * cp-tree.h (SET_BINFO_MARKED): Cast false part of condition ! to void. ! ! 2002-02-22 Jakub Jelinek ! ! PR other/5746 ! * semantics.c (finish_switch_cond): Don't call get_unwidened ! if error_mark_node. ! ! 2002-02-22 Nathan Sidwell ! ! 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 alowing 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 ! ! * 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 ! ! * typeck.c (cp_pointer_int_sum): Renamed from ! pointer_int_sum, call pointer_int_sum. ! ! 2002-02-20 Jakub Jelinek ! ! * decl.c (duplicate_decls): Return 0 if issued error about ! redeclaration. ! ! 2002-02-19 Jason Merrill ! ! 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 ! ! * pt.c (do_type_instantiation): Don't pedwarn if in_system_header. ! (do_decl_instantiation): Likewise. ! ! 2002-02-17 Craig Rodrigues ! ! PR c++/5685 ! * decl.c (duplicate_decls): Make warning unconditional ! if duplicate default argument declarations are present. ! ! 2002-02-17 Jakub Jelinek ! ! * typeck.c (build_binary_op) [BIT_XOR_EXPR]: Remove explicit ! shortening. ! ! 2002-02-15 Nathan Sidwell ! ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 ! ! 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 ! ! 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 ! ! * 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 ! ! * error.c (dump_type): Be more helpful about VECTOR_TYPE. ! ! 2002-02-04 Jakub Jelinek ! ! * semantics.c (begin_switch_stmt): Clear SWITCH_TYPE. ! (finish_switch_cond): Set SWITCH_TYPE. ! ! 2002-02-04 Richard Henderson ! ! * 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 ! ! * 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 ! ! * 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 ! ! 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 + * 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 ! ! * 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 ! ! 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 ! ! * 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 ! ! * 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 ! ! * cp-tree.h (my_friendly_abort): Remove. ! ! 2002-01-23 Jakub Jelinek ! ! * 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 ! ! * 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 + 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 + + * 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 + + 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 + + * 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 PR c++/907 * decl.c (start_method): Handle attrlist. + 2002-01-10 Jakub Jelinek + + * decl2.c (max_tinst_depth): Increase default limit to 500. + + 2002-01-10 Graham Stott + + * spew.c (YYCHAR): Uppercase macro parameter and add + parenthesis. + (YYCODE): Likewise. + (NAME): Uppercase macro parameter. + + 2002-01-09 Graham Stott + + * decl.h (grokdeclarator): Wrap long line. + + * semantics.c (FINISH_COND): Uppercase macro paramaters and + add parenthesis. + + 2002-01-08 Graham Stott + + * 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 + * 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 ! ! * 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 ! ! * 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 ! ! * semantics.c (expand_body): Revert last change. ! ! 2002-01-04 Jason Merrill 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 + + * semantics.c (expand_body): Call outlining_inline_function when + emitting an inline function out of line. + + 2002-01-02 Nathan Sidwell + + PR c++/5116, c++/764 reversion + * call.c (build_new_op): Revert the instantiations. They are + incorrect. + + 2002-01-02 Nathan Sidwell + + PR c++/5089 + * decl2.c (reparse_absdcl_as_casts): Don't warn about casts to void. + + 2002-01-02 Nathan Sidwell + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + * 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 + + PR c++/5125 + * pt.c (push_template_decl_real): Make sure DECL has + DECL_LANG_SPECIFIC. + + 2001-12-29 Nathan Sidwell + + 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 + + PR c++/196 + * parse.y (bad_parm): Better diagnostic when given a SCOPE_REF. + + 2001-12-24 Nathan Sidwell + + 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 + + * decl2.c (lang_f_options): Const-ify. + + 2001-12-20 Joseph S. Myers + + * config-lang.in (diff_excludes): Remove. + + 2001-12-19 Nathan Sidwell + + PR c++/90 + * typeck.c (build_function_call_real): Use original function + expression for errors. + 2001-12-18 Jason Merrill 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 ! * 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 ! ! 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 ! ! * 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 ! ! * call.c, decl2.c, init.c: Use "built-in" and "bit-field" ! spellings in messages. ! ! 2001-12-17 Zack Weinberg ! ! * 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 ! ! * decl2.c (finish_file): Remove back_end_hook. ! ! 2001-12-16 Joseph S. Myers ! ! * 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 ! ! * lang-options.h: Use American spelling in messages. ! ! 2001-12-13 Jason Merrill ! ! * 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 + * 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 + + * 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 + + * decl.c (grokdeclarator): Deprecated implicit typename use. + + 2001-12-11 Nathan Sidwell + + 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 + + PR g++/72 + * decl.c (add_binding): Don't reject duplicate typedefs involving + template parameters. + + 2001-12-10 Neil Booth + + * parse.y, semantics.c: Similarly. + + 2001-12-09 Nathan Sidwell + + 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 + + * lex.c (rid_to_yy): Add RID_CHOOSE_EXPR and + RID_TYPES_COMPATIBLE_P. + 2001-12-08 John David Anglin * 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 + + * 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 + * 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 + + * decl.c: Include c-common.h. + (shadow_warning): Move to c-common.c. + + Wed Dec 5 17:00:49 2001 Richard Kenner + + * decl.c (duplicate_decls): Don't copy DECL_NO_CHECK_MEMORY_USAGE. + + 2001-12-04 Nathan Sidwell + + * pt.c (end_template_parm_list): Clear TREE_CHAIN of each parm. + + 2001-12-04 Nathan Sidwell + + 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 * decl.c (xref_basetypes): Don't use C99 construct in tag_code declaration and initialization. ! 2001-12-03 Neil Booth ! * typeck2.c: Remove leading capital from diagnostic messages, as ! per GNU coding standards. 2001-12-03 Mumit Khan PR c++/3394 ! * decl.c (xref_basetypes): Handle attributes between 'class' and name. + 2001-12-03 Nathan Sidwell + + 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 * class.c (finish_vtbls): Fill in BINFO_VPTR_FIELD in the immediate binfos for our virtual bases. + 2001-12-02 Neil Booth + + * 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 + + * 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 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 + 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 + PR c++/3471 * call.c (convert_like_real): Do not build additional temporaries for rvalues of class type. ! 2001-11-28 Nathan Sidwell ! ! * 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 ! ! * Make-lang.in (c++.generated-manpages): New dummy target. ! ! Tue Nov 27 09:03:47 2001 Richard Kenner ! ! * 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 ! ! * 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 ! ! * call.c (joust): Remove COND_EXPR hack. ! ! 2001-11-25 Aldy Hernandez ! ! * search.c (lookup_base_r): Declare bk in variable declaration ! space. ! ! 2001-11-25 Nathan Sidwell ! ! PR g++/3145 ! * class.c (build_vbase_pointer): Remove. ! (build_vbase_path): Remove. ! (build_base_path): New function. ! * cp-tree.h (base_access, base_kind): New enumerations. ! (build_base_path): Declare. ! (convert_pointer_to_real): Remove. ! (convert_pointer_to): Remove. ! (lookup_base): Declare. ! (convert_pointer_to_vbase): Remove. ! * call.c (build_scoped_method_call): Use lookup_base & ! build_base_path instead of convert_pointer_to_real, ! get_base_distance & get_binfo. ! (build_over_call): Likewise. ! * cvt.c (cp_convert_to_pointer): Likewise. ! (convert_to_pointer_force): Likewise. ! (build_up_reference): Likewise. ! (convert_pointer_to_real): Remove. ! (convert_pointer_to): Remove. ! * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path ! instead of convert_pointer_to_vbase & build_vbase_path. ! (emit_base_init): Use build_base_path instead of ! convert_pointer_to_real. ! (expand_virtual_init): Lose unrequired conversions. ! (resolve_offset_ref): Use lookup_base and build_base_path ! instead of convert_pointer_to. ! * rtti.c (build_dynamic_cast_1): Use lookup_base & ! build_base_path instead of get_base_distance & build_vbase_path. ! * search.c (get_vbase_1): Remove. ! (get_vbase): Remove. ! (convert_pointer_to_vbase): Remove. ! (lookup_base_recursive): New function. ! (lookup_base): New function. ! * typeck.c (require_complete_type): Use lookup_base & ! build_base_path instead of convert_pointer_to. ! (build_component_ref): Likewise. ! (build_x_function_call): Likewise. ! (get_member_function_from_ptrfunc): Likewise. ! (build_component_addr): Likewise. ! * typeck2.c (build_scoped_ref): Likewise. ! ! 2001-11-22 Bryce McKinlay ! ! * 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 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 + * 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 + + * 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 ! 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 ! ! * lex.c (cxx_finish): Call c_common_finish. ! (finish_parse): Remove. ! ! 2001-11-17 Kriang Lerdsuwanakij ! ! * 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 ! ! * 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 ! ! * cp-tree.h (print_class_statistics): Restore. ! ! 2001-11-15 Jason Merrill ! ! * 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 ! ! 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 ! ! * 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 ! ! * 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 * Make-lang.in: Change all uses of $(manext) to $(man1ext). ! 2001-11-13 Nathan Sidwell ! PR g++/4206 ! * parse.y (already_scoped_stmt): Remove. ! (simple_stmt, WHILE & FOR): Use implicitly_scoped_stmt. ! ! 2001-11-12 H.J. Lu ! ! * cvt.c (ocp_convert): Don't warn the address of a weak ! function is always `true'. ! ! 2001-11-09 Neil Booth ! ! * 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 ! ! * class.c (dump_array): Fix format specifier warning. ! ! 2001-11-09 Neil Booth ! ! * 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 ! ! * 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 ! ! * Make-lang.in: Update. ! * cp-lang.c: Include langhooks-def.h. ! ! 2001-11-04 Kriang Lerdsuwanakij ! ! * pt.c (tsubst_copy): Call tsubst for TYPEOF_EXPR. ! ! 2001-11-03 Kaveh R. Ghazi ! ! * lex.c (copy_lang_type): Add static prototype. ! ! 2001-11-02 Kriang Lerdsuwanakij ! ! * pt.c (unify): Handle SCOPE_REF. ! ! 2001-11-01 Jakub Jelinek ! ! * tree.c (cp_copy_res_decl_for_inlining): Adjust ! DECL_ABSTRACT_ORIGIN for the return variable. ! ! 2001-10-31 Zack Weinberg ! ! * Make-lang.in: Replace $(INTL_TARGETS) with po-generated. ! ! 2001-10-28 Joseph S. Myers ! ! * ChangeLog.1, ChangeLog.2, ChangeLog, class.c, decl2.c, search.c, ! semantics.c, spew.c: Fix spelling errors. ! ! 2001-10-27 Kriang Lerdsuwanakij ! ! * decl2.c (validate_nonmember_using_decl): Handle NAMESPACE_DECL. ! ! 2001-10-25 Zack Weinberg ! ! * cp-lang.c: Redefine LANG_HOOKS_CLEAR_BINDING_STACK to ! pop_everything. ! ! Tue Oct 23 14:00:20 2001 Richard Kenner ! ! * cp-lang.c (cxx_get_alias_set): New function. ! Point LANG_HOOKS_GET_ALIAS_SET to it. ! ! 2001-10-23 Kriang Lerdsuwanakij ! ! * 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 ! ! * xref.c (GNU_xref_member): Use safe-ctype macros and/or fold ! extra calls into fewer ones. ! ! 2001-10-18 Alexandre Oliva ! ! * 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 ! ! * cp-tree.h (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Defined ! for tree checking disabled. ! ! 2001-10-16 Hans-Peter Nilsson ! ! * cp-tree.h (VFIELD_NAME_FORMAT) [NO_DOLLAR_IN_LABEL && ! NO_DOT_IN_LABEL]: Adjust to match VFIELD_NAME. ! ! 2001-10-15 Richard Sandiford ! ! * 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 ! ! * decl.c (bad_specifiers): Don't allow exception specifications ! on any typedefs. ! ! 2001-10-14 Neil Booth ! ! * cp/lex.c (init_cp_pragma): Similarly. ! ! 2001-10-13 Kriang Lerdsuwanakij ! ! * pt.c (lookup_template_class): Build complete template arguments ! for BOUND_TEMPLATE_TEMPLATE_PARM. ! ! 2001-10-12 Kriang Lerdsuwanakij ! ! * 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 ! ! * pt.c (determine_specialization): Ignore functions without ! DECL_TEMPLATE_INFO. ! ! 2001-10-12 Nathan Sidwell ! ! PR g++/4476 ! * typeck2.c (abstract_virtuals_error): Ignore incomplete classes. ! ! 2001-10-11 Jason Merrill ! ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 * 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 ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 ! ! * 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 ! ! * Make-lang.in (CXX_C_OBJS): Add attribs.o. 2001-09-21 Richard Henderson *************** *** 160,173 **** * call.c (build_over_call): Use it. * decl2.c (mark_vtable_entries): Mark FDESC_EXPR. * typeck.c (get_member_function_from_ptrfunc): Mind descriptors. ! * rtti.c (get_tinfo_decl_dynamic): Use build_vtbl_ref instead ! of build_vfn_ref. 2001-09-15 Gabriel Dos Reis * Make-lang.in (cp/error.o): Depend on real.h * error.c: #include "real.h" 2001-09-06 Nathan Sidwell PR c++/3986 --- 2161,2233 ---- * 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 ! ! * decl.c (grokdeclarator): Use C syntax for attr_flags declaration. ! ! 2001-09-21 Joseph S. Myers ! ! 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 ! * 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 * Make-lang.in (cp/error.o): Depend on real.h * error.c: #include "real.h" + 2001-09-15 Kaveh R. Ghazi + + * mangle.c (mangle_conv_op_name_for_type): Use concat in lieu of + xmalloc/strcpy/strcat. + + 2001-09-13 Kaveh R. Ghazi + + * decl.c (warn_extern_redeclared_static, cp_make_fname_decl): + Const-ification. + * pt.c (tsubst_decl): Likewise. + + 2001-09-12 Kaveh R. Ghazi + + * decl2.c (lang_f_options): Const-ification. + * lex.c (cplus_tree_code_name): Likewise. + * spew.c (yyerror): Likewise. + 2001-09-06 Nathan Sidwell PR c++/3986 *************** *** 178,185 **** (mark_primary_virtual_base): Remove BINFO parameter. (mark_primary_bases): Adjust, set BINFO_LOST_PRIMARY_P here. ! (binfo_ctor_vtable): Add prototype. ! (get_primary_binfo): Initialize RESULT. 2001-09-04 Nathan Sidwell --- 2238,2265 ---- (mark_primary_virtual_base): Remove BINFO parameter. (mark_primary_bases): Adjust, set BINFO_LOST_PRIMARY_P here. ! 2001-09-06 Nathan Sidwell ! ! 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 ! ! * 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 *************** *** 187,222 **** * call.c (build_over_call): Do not optimize any empty base construction. 2001-08-30 Kurt Garloff ! * optimize.c (inlinable_function_p): Allow only smaller single functions. Halve inline limit after reaching recursive limit. - - 2001-08-23 Kriang Lerdsuwanakij ! * 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-19 Release Manager ! * GCC 3.0.1 Released. ! 2001-08-19 Release Manager ! * GCC 3.0.1 Released. 2001-08-16 Mark Mitchell * cvt.c (convert_to_void): Preserve TREE_SIDE_EFFECTS on COMPOUND_EXPRs. 2001-08-13 Mark Mitchell * call.c (build_over_call): Mark COMPOUND_EXPRs generated for empty class assignment as having side-effects to avoid spurious warnings. 2001-08-07 Nathan Sidwell PR c++/3820 --- 2267,2380 ---- * call.c (build_over_call): Do not optimize any empty base construction. + 2001-08-31 Kriang Lerdsuwanakij + + * 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 ! * optimize.c (inlinable_function_p): Allow only smaller single functions. Halve inline limit after reaching recursive limit. ! 2001-08-30 Joern Rennecke ! Jason Merrill ! * class.c (build_vtable_entry_ref): Subtract in char*, not ! ptrdiff_t. ! 2001-08-23 Jason Merrill ! * 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 ! ! * 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 ! ! * typeck2.c (add_exception_specifier): Only require complete type if ! not in processing template declaration. ! ! 2001-08-18 Kaveh R. Ghazi ! ! * 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 * cvt.c (convert_to_void): Preserve TREE_SIDE_EFFECTS on COMPOUND_EXPRs. + 2001-08-14 Richard Henderson + + * 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 * 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 + + * Make-lang.in (cp/except.o): Add libfuncs.h to dependencies. + * except.c: Include libfuncs.h. + + 2001-08-11 Gabriel Dos Reis + + * decl.c (grokdeclarator): Clarify diagnostic message. + + 2001-08-13 Kriang Lerdsuwanakij + + * decl2.c (do_nonmember_using_decl): Replace using directive + with using declaration in the error message. + + 2001-08-11 Kriang Lerdsuwanakij + + * 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 + + 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 + + * decl2.c (finish_objects): Use target hooks instead of + assemble_constructor and assemble_destructor. + + 2001-08-08 John David Anglin + + * g++spec.c (lang_specific_driver): Quote argument after `-Xlinker'. + 2001-08-07 Nathan Sidwell PR c++/3820 *************** *** 231,243 **** * cp-tree.h (TYPE_HAS_TRIVIAL_INIT_REF): Mention _copy_ initialization. 2001-08-02 Nathan Sidwell ! Remove -fhonor-std. * NEWS: Document. ! * decl2.c (lang_f_options): Remove honor-std. (unsupported_options): Add honor-std. * lang-options.h: Remove -fhonor-std, -fno-honor-std. 2001-07-31 Nathan Sidwell --- 2389,2476 ---- * cp-tree.h (TYPE_HAS_TRIVIAL_INIT_REF): Mention _copy_ initialization. + 2001-08-07 Jason Merrill + + * tree.c (walk_tree): Walk siblings even if !walk_subtrees. + + 2001-08-06 Richard Henderson + + * decl2.c (finish_objects): Pass a symbol_ref and priority to + assemble_{constructor,destructor}. Remove priority handling. + + 2001-08-05 Gabriel Dos Reis + + 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 + + * cp/spew.c (read_token): No need to pop buffers. + + 2001-08-02 Stan Shebs + + * 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 + + * repo.c (get_base_filename): Change return value to const char + pointer. + 2001-08-02 Nathan Sidwell ! 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 + + * tree.c (cp_tree_equal): WITH_CLEANUP_EXPR node to use its second + operand while calling cp_tree_equal. + + 2001-07-31 Nathan Sidwell + + 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 *************** *** 250,255 **** --- 2483,2496 ---- * 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 + + * decl2.c: Remove unused var global_temp_name_counter. + + 2001-07-28 Richard Henderson + + * method.c (pending_inlines): Remove. + 2001-07-27 Nathan Sidwell * class.c (mark_primary_virtual_base): Don't adjust base *************** *** 262,267 **** --- 2503,2513 ---- * 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 + + * pt.c (tsubst_template_parms): Call maybe_fold_nontype_arg and + tsubst_expr for default template arguments. + 2001-07-26 Nathan Sidwell PR c++/3621 *************** *** 278,287 **** --- 2524,2555 ---- 2001-07-26 Nathan Sidwell + * 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 + + * 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 PR c++/3416 *************** *** 294,309 **** conversions on overloaded functions. (build_static_cast): Don't do a decay conversion here. - 2001-07-25 Jason Merrill - - PR c++/3529 - Copied from mainline. - * 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. - 2001-07-25 Nathan Sidwell PR c++/3543 --- 2562,2567 ---- *************** *** 312,330 **** --- 2570,2745 ---- 2001-07-25 Nathan Sidwell + * class.c (build_vtbl_or_vbase_field): Remove, move into ... + (create_vtbl_ptr): ... here. + + 2001-07-25 Nathan Sidwell + * class.c (build_vbase_offset_vbtl_entries): Look for non-primary base of which we are a sub vtable. + 2001-07-24 Phil Edwards + + * semantics.c (finish_this_expr): Remove unused code. + + 2001-07-24 Nathan Sidwell + + 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 + + * cp/class.c (type_requires_array_cookie): Fix use of uninitialised + variable has_two_argument_delete_p. + + 2001-07-21 Nathan Sidwell + + 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 + + Remove old-abi remnants. Remove comments about old abi + behaviour. Remove references to 'new-abi' in comments. + * cp-tree.h: Adjust comments. + (vbase_offsets_in_vtable_p): Delete. + (vcall_offsets_in_vtable_p): Delete. + (vptrs_present_everywhere_p): Delete. + (all_overridden_vfuns_in_vtables_p): Delete. + (merge_primary_and_secondary_vtables_p): Delete. + (TYPE_CONTAINS_VPTR_P): Adjust. + (VTT_NAME_PREFIX): Remove. + (CTOR_VTBL_NAME_PREFIX): Remove. + (init_vbase_pointers): Remove. + * class.c: Adjust coments. + (build_vbase_pointer_fields): Delete. + (build_vbase_pointer): Remove old-abi code. + (build_secondary_vtable): Likewise. + (modify_all_vtables): Likewise. + (create_vtable_ptr): Likewise. + (layout_class_type): Likewise. + (finish_struct_1): Likewise. + (finish_vtbls): Likewise. + (dfs_finish_vtbls): Delete. + (build_vbase_offset_vtbl_entries): Remove old-abi code. + * cvt.c: Adjust comments. + * decl.c: Adjust comments. + * decl2.c: Adjust comments. + * init.c: Adjust comments. + (construct_virtual_bases): Remove old-abi code. + * lang-specs.h: Remove -fno-new-abi. + * mangle.c: Adjust comments. + * rtti.c: Adjust comments. + (get_base_offset): Remove old-abi-code. + * search.c: Adjust comments. + (dfs_init_vbase_pointers): Remove. + (dfs_vtable_path_unmark): Remove. + (init_vbase_pointers): Remove. + * semantics.c: Adjust comments. + (emit_associated_thunks): Remove old-abi code. + * typeck.c: Adjust comments. + 2001-07-20 Daniel Berlin * Make-lang.in (cp/optimize.o): Depend on $(PARAMS_H), not params.h. + 2001-07-19 Mark Mitchell + + * class.c (finish_struct_anon): Forbid nested classes. + + 2001-07-19 Neil Booth + + * 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 + + * spew.c (read_token, yyerror): Remove CPP_INT, CPP_FLOAT cases. + + 2001-07-18 Mark Mitchell + + * 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 , Gerald Pfeifer * NEWS (Changes in GCC 3.0): Fix typo. + 2001-07-13 Joseph S. Myers + + * 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 * decl.c (make_rtl_for_nonlocal_decl): Set DECL_C_HARD_REGISTER *************** *** 335,345 **** --- 2750,2870 ---- * semantics.c (finish_asm_stmt): Mark the output operands to an asm addressable, if necessary. + 2001-07-11 Ben Elliston + + * 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 * pt.c (tsubst_decl): Set DECL_CONTEXT for namespace-scope variables. + 2001-07-10 Jason Merrill + + * semantics.c (cp_expand_stmt): Fix for null + current_function_return_value. + + 2001-07-10 Jan van Male + + * 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 + + * 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 + + * 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 + + * decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update + calls to decl_attributes. + + 2001-07-06 Ira Ruben + + * cp-tree.def (TEMPLATE_DECL): Update comment. DECL_RESULT should + be DECL_TEMPLATE_RESULT. + + 2001-07-05 Kriang Lerdsuwanakij + + * 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 + + * 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 + + * 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 + + * typeck.c (COMP_TYPE_ATTRIBUTES): Don't define. + (comptypes): Use target.comp_type_attributes. + + 2001-06-29 Nathan Sidwell + + * cp-tree.h (flag_dump_class_layout): Remove unneeded declaration. + + 2001-06-28 Gabriel Dos Reis + + * error.c (lang_print_error_function): Add a `diagnostic_context *' + parameter. Tweak. + + 2001-06-27 Neil Booth + + * decl2.c (import_export_class): Update. + + 2001-06-26 Gabriel Dos Reis + + * error.c (init_error): Adjust settings. + + 2001-06-26 Gabriel Dos Reis + + * error.c (init_error): Adjust settings. + 2001-06-19 Richard Sandiford * except.c (initialize_handler_parm): Expect __cxa_begin_catch to *************** *** 347,373 **** 2001-06-18 Jason Merrill * 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. - * class.c (dfs_find_final_overrider): Fix logic. - - * 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. - - 20010617 Release Manager - - * GCC 3.0 Released. - 2001-06-14 Jason Merrill * class.c (update_vtable_entry_for_fn): Uncomment optimization to use virtual thunk instead of non-virtual. (get_matching_virtual): Uncomment. 2001-06-14 Nathan Sidwell * class.c (dfs_accumulate_vtbl_inits): For case 2 & 3, make sure --- 2872,2908 ---- 2001-06-18 Jason Merrill + 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 + * 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 + * 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 * class.c (dfs_accumulate_vtbl_inits): For case 2 & 3, make sure *************** *** 429,438 **** Don't clobber delta. (expand_ptrmemfunc_cst) [ptrmemfunc_vbit_in_delta]: Adjust pfn. ! 2001-06-08 Jakub Jelinek ! * 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-06-08 Nathan Sidwell --- 2964,2986 ---- Don't clobber delta. (expand_ptrmemfunc_cst) [ptrmemfunc_vbit_in_delta]: Adjust pfn. ! 2001-06-10 Mark Mitchell ! Gabriel Dos Reis ! * 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 *************** *** 480,488 **** * 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. --- 3028,3036 ---- * 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. *************** *** 495,500 **** --- 3043,3050 ---- * 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 * call.c (convert_default_arg): Use INTEGRAL_TYPE_P. *************** *** 520,525 **** --- 3070,3080 ---- 2001-06-05 Nathan Sidwell + * decl.c (xref_tag): Remove extraneous %s on dependent name + lookup warning. + + 2001-06-05 Nathan Sidwell + * class.c (layout_vtable_decl): Fix off by one error on build_index_type. (build_vtt): Likewise. *************** *** 563,568 **** --- 3118,3131 ---- PR g++/2823 * semantics.c (expand_body): Don't optimize thunks. + 2001-05-25 Sam TH + + * cp-tree.h lex.h: Fix header include guards. + + 2001-05-25 Mark Mitchell + + * decl.c (init_decl_processing): Tweak. + 2001-05-24 Mark Mitchell * decl.c (duplicate_decls): Tidy. *************** *** 580,585 **** --- 3143,3154 ---- TREE_READONLY for a VAR_DECL taking the place of an inlined PARM_DECL. + 2001-05-22 Jason Merrill + + * 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 * parse.y: Refer to compound literals as such, not as *************** *** 595,611 **** 2001-05-21 Jason Merrill * decl2.c (lang_f_options): Remove huge-objects, vtable-thunks. (unsupported_options): Correspondingly. ! 2001-05-19 Zack Weinberg ! * 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-20 Nathan Sidwell --- 3164,3200 ---- 2001-05-21 Jason Merrill + * 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 ! ! * class.c (build_vtable): Set DECL_ASSEMBLER_NAME for vtables here. ! (get_vtable_decl, build_vtt): Not here. 2001-05-20 Nathan Sidwell *************** *** 613,712 **** * optimize.c (update_cloned_parm): Copy addressability and other flags. ! 2001-05-18 Jason Merrill ! * class.c (build_vtable): Set DECL_ASSEMBLER_NAME for vtables here. ! (get_vtable_decl, build_vtt): Not here. 2001-05-17 Mark Mitchell * 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 * spew.c (read_token): Call yyerror on all unexpected tokens. ! 2001-05-12 Richard Henderson ! ! EH merge from mainline: ! 2001-04-23 Jason Merrill ! * except.c (build_throw): Wrap the initialization of the exception ! object in a MUST_NOT_THROW_EXPR. ! (do_free_exception): #if 0. ! * 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. ! * 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. ! * except.c: Use USING_SJLJ_EXCEPTIONS instead of ! exceptions_via_longjmp. 2001-05-12 Alexandre Oliva --- 3202,3262 ---- * optimize.c (update_cloned_parm): Copy addressability and other flags. ! 2001-05-20 Kriang Lerdsuwanakij ! * pt.c (determine_specialization): Ignore artificial functions. ! ! 2001-05-20 Neil Booth ! ! * 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 ! ! * 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 ! ! * 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 * 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 * spew.c (read_token): Call yyerror on all unexpected tokens. ! 2001-05-16 Nathan Sidwell ! * init.c (member_init_ok_or_else): Take a tree rather than ! string for name. ! (expand_member_init): Adjust. ! 2001-05-14 Nick Clifton ! * decl.c (duplicate_decls): Suppress warning about duplicate ! decls if the first decl is a friend. ! 2001-05-12 Zack Weinberg ! ! * 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 ! ! * method.c (build_mangled_C99_name): Remove unused prototype. 2001-05-12 Alexandre Oliva *************** *** 715,726 **** build_ptrmemfunc, expand_ptrmemfunc_cst): Take TARGET_PTRMEMFUNC_VBIT_LOCATION into account. 2001-05-07 Mark Mitchell ! * class.c (walk_subobject_offsets): Add max_offset parameter. ! (record_subobject_offsets): Adjust call. ! (layout_conflict_p): Stop walking when we get past the last empty ! subobject. 2001-05-03 Mark Mitchell --- 3265,3307 ---- 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 + + * cp/cp-tree.h (C_EXP_ORIGINAL_CODE): Delete; declared in c-common.h. + + 2001-05-11 Neil Booth + + * 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 ! * splay-tree.h (splay_tree_max): New function. ! (splay_tree_min): Likewise. ! ! 2001-05-03 Geoffrey Keating ! ! * 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 *************** *** 746,752 **** * decl.c (compute_array_index_type): Don't try to do anything with the indices when processing a template. ! 2001-05-01 Mark Mitchell * decl2.c (do_using_directive): Revert previous patch. --- 3327,3348 ---- * 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 ! ! * 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 * decl2.c (do_using_directive): Revert previous patch. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 815,831 **** * method.c (use_thunk): Make sure that thunks really are emitted when requested. - Remove support for -Wextern-inline, -flabels-ok, -fvtable-gc, -fxref - * cp-tree.h (warn_extern_inline): Remove. - (flag_labels_ok): Likewise. - * decl2.c (warn_extern_inline): Remove. - (flag_labels_ok): Likewise. - (lang_f_options): Remove labels-ok, vtable-gc, xref. - (unsupported_options): Add them. - (cxx_decode_option): Don't accept -Wextern-inline. - * method.c (hack_identifier): Remove -flabels-ok support. - * spew.c (see_typename): Likewise. - 2001-04-26 Nathan Sidwell * mangle.c (write_chars): New macro. --- 3411,3416 ---- *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 851,862 **** walk_tree. (optimize_function): Initialize and free tree_pruner. 2001-04-20 Mark Mitchell * 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 * tree.c (cp_tree_equal): Adjust final switch formatting. Add --- 3436,3498 ---- walk_tree. (optimize_function): Initialize and free tree_pruner. + 2001-04-24 Nathan Sidwell + + 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 + + * pt.c (tsubst_decl): Use VOID_TYPE_P. + * semantics.c: Fix some typos. + + 2001-04-23 Phil Edwards + + * cp/decl2.c (flag_honor_std): Always initialize to 1. + + 2001-04-22 Kaveh R. Ghazi + + * xref.c (GNU_xref_file): Use concat in lieu of xmalloc/sprintf. + + 2001-04-23 Jason Merrill + + * 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 * 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 * tree.c (cp_tree_equal): Adjust final switch formatting. Add *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 875,880 **** --- 3511,3526 ---- if we're an empty class with no empty bases. (dump_class_hierarchy): Dump size and alignment. + 2001-04-20 Jakub Jelinek + + * call.c (maybe_handle_ref_bind): Copy ICS_USER_FLAG and + ICS_BAD_FLAG. + + 2001-04-20 Jakub Jelinek + + * 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 * cp-tree.h (DECL_LANGUAGE): Don't assume DECL_LANG_SPECIFIC is *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 891,897 **** * 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 * semantics.c (simplify_aggr_init_exprs_r): Don't restore --- 3537,3543 ---- * 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 * semantics.c (simplify_aggr_init_exprs_r): Don't restore *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 919,925 **** (expand_ptrmemfunc_cst): Remove idx and delta2 parameters. (delta2_from_ptrmemfunc): Remove. (pfn_from_ptrmemfunc): Adjust call to expand_ptrmemfunc_cst. ! 2001-04-11 Jason Merrill * cp-tree.h (TYPE_LINKAGE_IDENTIFIER): New macro. --- 3565,3600 ---- (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 ! ! * 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 ! ! * 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 ! ! * 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 * cp-tree.h (TYPE_LINKAGE_IDENTIFIER): New macro. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 948,967 **** * optimize.c (maybe_clone_body): Copy DECL_NUM_STMTS from the cloned function to the clone. ! 2001-04-11 Jason Merrill ! * error.c (GLOBAL_THING): Always use '__'. 2001-04-11 Nathan Sidwell * method.c (implicitly_declare_fn): Commonize code for copy ctor and assignment op. Set TREE_USED for parameter. - 2001-04-10 Richard Henderson - - * typeck.c (build_array_ref): Push the array reference inside - COMPOUND_EXPR and COND_EXPR. - 2001-04-10 Mark Mitchell * class.c (find_final_overrider_data): Add `candidates'. --- 3623,3639 ---- * optimize.c (maybe_clone_body): Copy DECL_NUM_STMTS from the cloned function to the clone. ! 2001-04-11 Kaveh R. Ghazi ! * Make-lang.in (cp/semantics.o): Depend on $(EXPR_H). ! ! * semantics.c: Include expr.h. 2001-04-11 Nathan Sidwell * method.c (implicitly_declare_fn): Commonize code for copy ctor and assignment op. Set TREE_USED for parameter. 2001-04-10 Mark Mitchell * class.c (find_final_overrider_data): Add `candidates'. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 972,977 **** --- 3644,3654 ---- (warn_about_ambiguous_direct_bases): New function. (layout_class_type): Use it. + 2001-04-10 Richard Henderson + + * typeck.c (build_array_ref): Push the array reference inside + COMPOUND_EXPR and COND_EXPR. + 2001-04-05 Mark Mitchell * cp-tree.h (DECL_THIS_INLINE): Rename to DECL_DECLARED_INLINE_P. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 984,994 **** (import_export_decl): Likewise. * method.c (implicitly_declare_fn): Likewise. * optimize.c (maybe_clone_body): Likewise. ! 2001-04-05 Benjamin Kosnik * lang-specs.h: Add __DEPRECATED. ! 2001-04-04 Jakub Jelinek * optimize.c (expand_call_inline): Only add newly inlined statements --- 3661,3676 ---- (import_export_decl): Likewise. * method.c (implicitly_declare_fn): Likewise. * optimize.c (maybe_clone_body): Likewise. ! 2001-04-05 Benjamin Kosnik * lang-specs.h: Add __DEPRECATED. ! ! Thu Apr 5 16:54:29 2001 J"orn Rennecke ! ! * search.c (get_dynamic_cast_base_type): When building a new ! constant, set its type to ssizetype. ! 2001-04-04 Jakub Jelinek * optimize.c (expand_call_inline): Only add newly inlined statements *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1005,1023 **** * rtti.c (get_tinfo_decl): Issue error messages about types that have variable size. - 2001-04-03 Gabriel Dos Reis - - Correct semantics restrictions checking in throw-expression. - * except.c (is_admissible_throw_operand): New function. - (build_throw): Use it. - 2001-04-03 Mark Mitchell ! * 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-26 Mike Yang Mark Mitchell --- 3687,3789 ---- * rtti.c (get_tinfo_decl): Issue error messages about types that have variable size. 2001-04-03 Mark Mitchell ! * 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 + + 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 + + * 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 + + * except.c: Use USING_SJLJ_EXCEPTIONS instead of + exceptions_via_longjmp. + + 2001-03-27 Phil Edwards + + * pt.c (check_default_tmpl_args): Make error messages clearer. + + 2001-03-26 Phil Edwards + + * error.c: Also undefine 'A' macro used for cp_printers definition. + + 2001-03-27 Kaveh R. Ghazi + + * Make-lang.in: Depend on $(SYSTEM_H), not system.h. + 2001-03-26 Mike Yang Mark Mitchell *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1046,1058 **** rest_of_compilation. Clear DECL_RTL for local variables afterwards. (clear_decl_rtl): New function. ! ! 2001-03-26 Jakub Jelinek * mangle.c (write_discriminator): Use `_0' for discriminator 1, not `_'. ! 2001-03-26 Jakub Jelinek * decl.c (local_names): Define. (push_local_name): New. --- 3812,3847 ---- rest_of_compilation. Clear DECL_RTL for local variables afterwards. (clear_decl_rtl): New function. ! ! 2001-03-26 Nathan Sidwell ! ! 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 ! ! * class.c (add_method): Use memcpy/memmove, not bcopy. ! ! * decl.c (duplicate_decls): Likewise. ! ! 2001-03-23 Jakub Jelinek * mangle.c (write_discriminator): Use `_0' for discriminator 1, not `_'. ! 2001-03-23 Jakub Jelinek * decl.c (local_names): Define. (push_local_name): New. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1087,1112 **** 2001-03-22 Bryce McKinlay - * call.c (build_java_interface_fn_ref): Fix local declarations. - - 2001-03-22 Bryce McKinlay - 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 Zack Weinberg ! * lang-specs.h: Add zero initializer for cpp_spec field to ! all array elements. Don't put an #ifdef inside the initializer ! list; set a default for CPLUSPLUS_CPP_SPEC and use it. 2001-03-22 Jakub Jelinek --- 3876,3903 ---- 2001-03-22 Bryce McKinlay 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 ! * Make-lang.in (cp/except.o): Don't depend on insn-flags.h. ! * except.c: Don't include it. ! ! 2001-03-22 Gerald Pfeifer ! based on an idea from Joe Buck ! ! * 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 *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1120,1139 **** * pt.c (instantiate_decl): Abort if we see a member constant instantiation that doesn't already have its initializer. ! 2001-03-21 Mark Mitchell ! * class.c (build_clone): Clear DECL_ASSEMBLER_NAME. ! 2001-03-21 Gerald Pfeifer ! based on an idea from Joe Buck ! * parse.y (bad_decl, template_arg_list_ignore, arg_list_ignore): ! New nonterminals. ! (data_def, component_decl): Add reductions to bad_decl. 2001-03-21 Mark Mitchell * mangle.c (mangle_decl_string): Mangle the names of overloaded operators, even when they have `extern "C"' linkage. --- 3911,3956 ---- * 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 + * 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. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1198,1215 **** * 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 Neil Booth - - * lex.c: Delete duplicate pending_lang_change. - - 2001-03-15 Zack Weinberg - - * decl.c: Replace all uses of 'boolean' with 'bool'. - - 2001-03-15 Gabriel Dos Reis - - * except.c: Revert previous patch. 2001-03-15 Gabriel Dos Reis --- 4015,4020 ---- *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1222,1227 **** --- 4027,4034 ---- * decl.c (cp_make_fnname_decl): Set DECL_IGNORED_P on __FUNCTION__ and its ilk. + 2001-03-14 Mark Mitchell + * 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. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1243,1259 **** (expand_body): Likewise. (genrtl_finish_function): Likewise. * tree.c (cp_tree_equal): Likewise. - - 2001-03-06 Zack Weinberg - - * spew.c: Remove references to CPP_OSTRING. - - 2001-03-06 Jeffrey Oldham ! * call.c (joust): Ensure more_specialized()'s argument length ! parameter has correct value for constructors. ! ! 2001-03-03 Nathan Sidwell * call.c (convert_like_real): Add extra semantics to INNER parameter. Don't convert to temporary if a user conversion --- 4050,4057 ---- (expand_body): Likewise. (genrtl_finish_function): Likewise. * tree.c (cp_tree_equal): Likewise. ! 2001-03-12 Nathan Sidwell * call.c (convert_like_real): Add extra semantics to INNER parameter. Don't convert to temporary if a user conversion *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1261,1266 **** --- 4059,4101 ---- Set INNER to indicate pending reference binding on recursive calls. + 2001-03-10 Neil Booth + + * cp/lex.c: Delete duplicate pending_lang_change. + + 2001-03-10 Neil Booth + + * 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 + + * Make-lang.in: Add dependencies on $(TM_P_H) as appropriate. + + 2001-03-08 Stan Shebs + + * cp-tree.h (set_identifier_local_value): Remove unused decl. + + 2001-03-06 Zack Weinberg + + * spew.c: Remove references to CPP_OSTRING. + + 2001-03-06 Andrew Haley + + * typeck.c (convert_arguments): Check that we have an fndecl. + + 2001-03-05 Andrew Haley + + * typeck.c (convert_arguments): Don't do ellipsis conversion for + __built_in_constant_p. + + 2001-03-02 Nathan Sidwell + + * typeck.c (build_static_cast): Allow enum to enum conversions + as per DR 128. + 2001-03-02 Nathan Sidwell * class.c (check_field_decls): Pointers to member do not a *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1271,1276 **** --- 4106,4122 ---- * call.c (joust): cp_pedwarn when using gnu extension concerning worst conversion sequences. + 2001-03-01 Zack Weinberg + + * decl.c: Replace all uses of 'boolean' with 'bool'. + + 2001-03-01 Zack Weinberg + + * 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 Implement using decls inside template functions. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1289,1296 **** 2001-02-28 Nathan Sidwell ! * pt.c (invalid_nontype_parm_type_p): Deprecate float and ! complex types. 2001-02-27 Nathan Sidwell --- 4135,4148 ---- 2001-02-28 Nathan Sidwell ! 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 ! ! * except.c (call_eh_info): Revert "match_function"'s type. 2001-02-27 Nathan Sidwell *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1299,1305 **** (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 --- 4151,4157 ---- (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 *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1307,1316 **** --- 4159,4181 ---- when primary base has been lost. * cp-tree.h (BINFO_VIRTUALS): Remove ambiguity from comment. + 2001-02-26 Jeffrey Oldham + + * call.c (joust): Ensure more_specialized()'s argument length + parameter has correct value for constructors. + + 2001-02-26 Nathan Sidwell + + * except.c (call_eh_info): Cleanup generation of cp_eh_info struct. + + * decl.c (mark_inlined_fns): Prototype. + 2001-02-22 Mark Mitchell * spew.c (yylex): Correct handling of friends. + 2001-02-22 Mark Mitchell + * 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. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1333,1349 **** (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 neccessary. (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-19 Mark Mitchell - - * decl2.c (set_decl_namespace): Allow explicit instantiations in - any namespace. - 2001-02-21 Jason Merrill * cp-tree.h (struct lang_decl_flags): Remove uninlinable flag. --- 4198,4209 ---- (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 * cp-tree.h (struct lang_decl_flags): Remove uninlinable flag. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1358,1363 **** --- 4218,4228 ---- * method.c (implicitly_declare_fn): Don't set DECL_ARTIFICIAL on second parm of op=. + 2001-02-19 Mark Mitchell + + * decl2.c (set_decl_namespace): Allow explicit instantiations in + any namespace. + 2001-02-18 Kriang Lerdsuwanakij * optimize.c (expand_call_inline): Don't walk subtrees of type *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1368,1403 **** * class.c (add_vcall_offset_vtbl_entries_1): Only add one entry for a destructor. - 2001-02-17 Mark Mitchell - - * 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-18 Jason Merrill Do put the VTT parameter in DECL_ARGUMENTS. --- 4233,4238 ---- *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1432,1448 **** * cp-tree.h: Declare it. * search.c (look_for_overrides_r): Use it. ! 2001-02-17 Anthony Green ! * lang-specs.h: Add more -D__EXCEPTIONS. 2001-02-17 Jason Merrill * 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-16 Jason Merrill * cp-tree.h (DECL_USE_VTT_PARM): Remove. --- 4267,4315 ---- * cp-tree.h: Declare it. * search.c (look_for_overrides_r): Use it. ! 2001-02-17 Mark Mitchell ! * 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 + * 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 + + * call.c (check_dtor_name): Handle template names correctly. + 2001-02-16 Jason Merrill * cp-tree.h (DECL_USE_VTT_PARM): Remove. *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1451,1485 **** * call.c (build_new_method_call): Check in_chrg instead. * init.c (expand_virtual_init): Likewise. 2001-02-16 Jakub Jelinek * call.c (convert_like_real): Create a temporary for non-lvalue. ! 2001-02-16 Gabriel Dos Reis ! * decl.c (check_tag_decl): Make sure a typedef for an anonymous ! class-type introduces at least a type-name. 2001-02-16 Jason Merrill * optimize.c (remap_block): If we're compiling a clone, pass the new block to insert_block. ! 2001-02-14 Jakub Jelinek ! * typeck.c (build_unary_op): Clarify error message. 2001-02-15 Mark Mitchell * pt.c (push_template_decl_real): Don't remangle the name of a class template. 2001-02-15 Alexandre Oliva * 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 Nathan Sidwell * cp-tree.h (setup_vtbl_ptr): Move prototype to semantics.c --- 4318,4375 ---- * call.c (build_new_method_call): Check in_chrg instead. * init.c (expand_virtual_init): Likewise. + 2001-02-16 Gabriel Dos Reis + + * 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 * call.c (convert_like_real): Create a temporary for non-lvalue. ! 2001-02-16 Jeffrey Oldham ! * cp-tree.h: Fix typos in comments. 2001-02-16 Jason Merrill * optimize.c (remap_block): If we're compiling a clone, pass the new block to insert_block. ! 2001-02-16 Mark Mitchell ! * semantics.c (finish_asm_stmt): Robustify. 2001-02-15 Mark Mitchell * pt.c (push_template_decl_real): Don't remangle the name of a class template. + 2001-02-15 Jim Meyering + + * Make-lang.in (c++.install-common): Depend on installdirs. + (c++.install-info): Likewise. + (c++.install-man): Likewise. + + 2001-02-15 Mark Mitchell + + * typeck2.c (build_m_component_ref): Robustify. + 2001-02-15 Alexandre Oliva * 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 + + * typeck.c (build_unary_op): Clarify error message. + + 2001-02-08 Aldy Hernandez + + * parse.y (component_constructor_declarator): allow optional + parentheses around constructor class name. + 2001-02-14 Nathan Sidwell * cp-tree.h (setup_vtbl_ptr): Move prototype to semantics.c *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1509,1531 **** * tree.c (cp_build_qualified_type_real): Use CP_TYPE_QUALS to check whether we already have the type. - 2001-02-14 Nathan Sidwell - - * typeck2.c (process_init_constructor): Check - TREE_HAS_CONSTRUCTOR before issuing missing init warning. - - 2001-02-14 Nathan Sidwell - - * errfn.c (cp_deprecated): Tweak diagnostic text. - * parse.y (new_initializer): Deprecate initializer lists - extension. - - 2001-02-14 Nathan Sidwell - - * pt.c (maybe_adjust_types_for_deduction, DEDUCE_ORDER case): - Remove spurious information in comment. Allow further - adjustments of REFERENCE_TYPE args. - 2001-02-13 Mark Mitchell * cp-tree.h (CLASSTYPE_DESTRUCTORS): Fix typo in comment. --- 4399,4404 ---- *************** Mon Apr 30 16:14:10 2001 Mark P Mitchel *** 1542,1547 **** --- 4415,4437 ---- * lang-specs.h: Add more __EXCEPTIONS. + 2001-02-12 Nathan Sidwell + + * typeck2.c (process_init_constructor): Check + TREE_HAS_CONSTRUCTOR before issuing missing init warning. + + 2001-02-12 Nathan Sidwell + + * 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 + + * errfn.c (cp_deprecated): Tweak diagnostic text. + * parse.y (new_initializer): Deprecate initializer lists + extension. + 2001-02-12 Mark Mitchell Remove old ABI support. *************** Sun Feb 4 15:52:44 2001 Richard Kenner *** 2104,2110 **** * decl.c (struct binding_level): Adjust class_shadowed comments to reflect reality. ! (push_class_level_binding): Ajust comments to reflect reality. Set IDENTIFIER_CLASS_VALUE when replacing an existing binding. Don't set TREE_VALUE on the class_shadowed list. --- 4994,5000 ---- * 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. *************** Sun Feb 4 15:52:44 2001 Richard Kenner *** 2405,2412 **** * class.c (check_field_decls): Don't special case anonymous fields in error messages. ! (note_name_declared_inpwdpwd ! _class): Use %D on diagnostic. * tree.c (pod_type_p): Use strip_array_types. (cp_valid_lang_attribute): Likewise. --- 5295,5301 ---- * 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. *************** Wed Jul 26 15:05:51 CEST 2000 Marc Espie *** 4859,4865 **** 2000-06-23 Kriang Lerdsuwanakij * parse.y (template_arg): Convert TEMPLATE_DECL ! that is a template template paramter to TEMPLATE_TEMPLATE_PARM here. * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Adjust comment. --- 7748,7754 ---- 2000-06-23 Kriang Lerdsuwanakij * 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. *************** Sat May 27 11:25:46 2000 Richard Kenner *** 5869,5875 **** (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. ! (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject --- 8758,8764 ---- (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 *************** Sat May 27 11:25:46 2000 Richard Kenner *** 5924,5933 **** * tinfo.h (__user_type_info::contained_virtual_p): New predicate. * tinfo.cc (__user_type_info::do_upcast): Fix bug with diamond ! shaped heirarchy. (__vmi_class_type_info::__do_upcast): Fix bug with NULL pointer to ! diamond shaped heirarchy. Add early out for mixed diamond and ! duplicate shaped heirarchy. 2000-05-24 Mark Mitchell --- 8813,8822 ---- * 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 *************** Mon May 15 11:46:29 2000 Donald Lindsay *** 5972,5978 **** (__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 heirarchy bug. 2000-05-23 Mark Mitchell --- 8861,8867 ---- (__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 *************** Sat Apr 15 16:00:01 2000 Richard Kenner *** 7087,7093 **** 2000-04-05 Benjamin Kosnik ! * decl2.c: Make flag_honor_std dependant on ENABLE_STD_NAMESPACE. 2000-04-05 Mark Mitchell --- 9976,9982 ---- 2000-04-05 Benjamin Kosnik ! * decl2.c: Make flag_honor_std dependent on ENABLE_STD_NAMESPACE. 2000-04-05 Mark Mitchell *************** Mon Mar 6 08:46:47 2000 Richard Kenner *** 7914,7920 **** (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 throught 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. --- 10803,10809 ---- (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. *************** Wed Jan 26 22:19:14 2000 J"orn Rennecke *** 8943,8950 **** (expand_attr_desc): Likewise. (expand_generic_desc): Likewise. ! * tinfo.cc (__GXX_ABI_VERSION): Test value and existance. ! * tinfo.h (__GXX_ABI_VERSION): Test value and existance. 2000-01-23 Mark Mitchell --- 11832,11839 ---- (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 *************** Wed Jan 26 22:19:14 2000 J"orn Rennecke *** 9012,9018 **** 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 diagnotic message routines into a single one. * typeck2.c (readonly_error, abstract_virtuals_error, process_init_constructor, check_for_new_type): Likewise. --- 11901,11907 ---- 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. diff -Nrc3pad gcc-3.0.4/gcc/cp/ChangeLog.1 gcc-3.1/gcc/cp/ChangeLog.1 *** gcc-3.0.4/gcc/cp/ChangeLog.1 Tue Apr 13 22:45:34 1999 --- gcc-3.1/gcc/cp/ChangeLog.1 Sun Dec 16 16:06:57 2001 *************** Wed Jul 19 13:23:12 1995 Gerald Baumgar *** 753,759 **** (init_decl_processing): Initialize vb_off_identifier. Renamed vt_off_identifier from offset_identifier. * sig.c (build_signature_method_call): Renamed offset_identifier and ! local variable offset to vt_off_identifer and vt_off, respecitively. * sig.c (build_signature_table_constructor): Renamed offset to vt_off. * decl.c (init_decl_processing): Add vb_off field to --- 753,759 ---- (init_decl_processing): Initialize vb_off_identifier. Renamed vt_off_identifier from offset_identifier. * sig.c (build_signature_method_call): Renamed offset_identifier and ! local variable offset to vt_off_identifier and vt_off, respectively. * sig.c (build_signature_table_constructor): Renamed offset to vt_off. * decl.c (init_decl_processing): Add vb_off field to *************** Mon Mar 6 15:07:02 1995 Jason Merrill *** 2309,2315 **** function. Make base initialization more re-entrant so that synthesis on the ! fly will work (and, eventually, template instantation on the fly). * init.c (sort_member_init): Don't bother with members that can't be initialized. Reorganize a bit. Don't initialize base members here. (sort_base_init): New function, like sort_member_init, but for base --- 2309,2315 ---- function. Make base initialization more re-entrant so that synthesis on the ! fly will work (and, eventually, template instantiation on the fly). * init.c (sort_member_init): Don't bother with members that can't be initialized. Reorganize a bit. Don't initialize base members here. (sort_base_init): New function, like sort_member_init, but for base diff -Nrc3pad gcc-3.0.4/gcc/cp/ChangeLog.2 gcc-3.1/gcc/cp/ChangeLog.2 *** gcc-3.0.4/gcc/cp/ChangeLog.2 Sun Jul 2 03:01:47 2000 --- gcc-3.1/gcc/cp/ChangeLog.2 Sun Dec 16 16:06:57 2001 *************** Wed Oct 13 22:01:35 1999 J"orn Rennecke *** 1216,1222 **** 1999-10-07 Mark Mitchell * pt.c (tsubst_expr): Set DECL_TEMPLATE_INSTANTIATED for a catch ! paramter. * semantics.c (expand_stmt): Don't pretend to have asmspecs for local statics if we don't really have them. --- 1216,1222 ---- 1999-10-07 Mark Mitchell * pt.c (tsubst_expr): Set DECL_TEMPLATE_INSTANTIATED for a catch ! parameter. * semantics.c (expand_stmt): Don't pretend to have asmspecs for local statics if we don't really have them. *************** Wed Oct 13 22:01:35 1999 J"orn Rennecke *** 1357,1363 **** (mark_lang_function): Use mark_stmt_tree. * expr.c (cplus_expand_expr): Don't handle VEC_INIT_EXPR. * init.c (build_new_1): Remove creation of VEC_INIT_EXPR. ! (build_vec_init): Remove creation of stand-in intializer. * pt.c (begin_tree): Remove. (end_tree): Likewise. * semantics.c (SET_LAST_STMT): New macro. Use it throughout. --- 1357,1363 ---- (mark_lang_function): Use mark_stmt_tree. * expr.c (cplus_expand_expr): Don't handle VEC_INIT_EXPR. * init.c (build_new_1): Remove creation of VEC_INIT_EXPR. ! (build_vec_init): Remove creation of stand-in initializer. * pt.c (begin_tree): Remove. (end_tree): Likewise. * semantics.c (SET_LAST_STMT): New macro. Use it throughout. *************** Thu Sep 30 00:13:27 1999 Dirk Zoller < *** 1463,1469 **** (pushlevel_class): Don't push_decl_level. (poplevel_class): Don't pop_stack_level. (push_class_level_binding): Don't push_cache_obstack. ! (init_decl_processing): Don't intialize decl_obstack. * search.c (push_class_decls): Don't push_cache_obstack. * tree.c (list_hash_add): Put hash node on permanent_obstack. (hash_tree_cons): Don't mess with obstacks. --- 1463,1469 ---- (pushlevel_class): Don't push_decl_level. (poplevel_class): Don't pop_stack_level. (push_class_level_binding): Don't push_cache_obstack. ! (init_decl_processing): Don't initialize decl_obstack. * search.c (push_class_decls): Don't push_cache_obstack. * tree.c (list_hash_add): Put hash node on permanent_obstack. (hash_tree_cons): Don't mess with obstacks. *************** Sun Sep 12 23:29:07 1999 Kaveh R. Ghazi *** 2255,2261 **** if appropriate. (finish_decl_cleanup): New function. (expand_stmt): Use emit_local_var to output variables. ! (expand_body): Set current_funtion_name_declared. 1999-09-10 Mark Mitchell --- 2255,2261 ---- if appropriate. (finish_decl_cleanup): New function. (expand_stmt): Use emit_local_var to output variables. ! (expand_body): Set current_function_name_declared. 1999-09-10 Mark Mitchell *************** Mon Aug 23 22:17:20 1999 Mumit Khan * class.c (finish_vtbls): Copy BINFO_VIRTUALs before using it to ! intialize a vtable. * cp-tree.h (NAMESPACE_LEVEL): Reformat. (lang_decl_flags): Document MEMFUNC_POINTER_TO. Save four bytes --- 4670,4676 ---- 1999-05-25 Mark Mitchell * class.c (finish_vtbls): Copy BINFO_VIRTUALs before using it to ! initialize a vtable. * cp-tree.h (NAMESPACE_LEVEL): Reformat. (lang_decl_flags): Document MEMFUNC_POINTER_TO. Save four bytes *************** Thu Feb 18 23:40:01 1999 Kaveh R. Ghazi *** 6427,6433 **** 1999-02-10 Jason Merrill ! * decl.c (grokdeclarator): Catch wierd declarators. * decl2.c (finish_file): Don't abort because of namespace parsing failure. (check_decl_namespace): Remove. --- 6427,6433 ---- 1999-02-10 Jason Merrill ! * decl.c (grokdeclarator): Catch weird declarators. * decl2.c (finish_file): Don't abort because of namespace parsing failure. (check_decl_namespace): Remove. *************** Fri Aug 14 16:42:27 1998 Nick Clifton *** 9673,9679 **** push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. ! (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. --- 9673,9679 ---- push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. ! (build_overload_identifier): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. diff -Nrc3pad gcc-3.0.4/gcc/cp/Make-lang.in gcc-3.1/gcc/cp/Make-lang.in *** gcc-3.0.4/gcc/cp/Make-lang.in Wed Nov 14 22:33:42 2001 --- gcc-3.1/gcc/cp/Make-lang.in Sat Mar 16 00:59:04 2002 *************** *** 38,51 **** # - define the names for selecting the language in LANGUAGES. # Actual names to use when installing a native compiler. ! CXX_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t` ! GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t` ! DEMANGLER_INSTALL_NAME = `t='$(program_transform_name)'; echo c++filt | sed $$t` # Actual names to use when installing a cross-compiler. ! CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t` ! GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t` ! DEMANGLER_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++filt | sed $$t` # The name to use for the demangler program. DEMANGLER_PROG = c++filt$(exeext) --- 38,53 ---- # - 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)'` ! DEMANGLER_INSTALL_NAME = `echo c++filt|sed '$(program_transform_name)'` ! CXX_TARGET_INSTALL_NAME = $(target_alias)-`echo c++|sed '$(program_transform_name)'` ! GXX_TARGET_INSTALL_NAME = $(target_alias)-`echo g++|sed '$(program_transform_name)'` # Actual names to use when installing a cross-compiler. ! CXX_CROSS_NAME = `echo c++|sed '$(program_transform_cross_name)'` ! GXX_CROSS_NAME = `echo g++|sed '$(program_transform_cross_name)'` ! DEMANGLER_CROSS_NAME = `echo c++filt|sed '$(program_transform_cross_name)'` # The name to use for the demangler program. DEMANGLER_PROG = c++filt$(exeext) *************** C++ c++: cc1plus$(exeext) *** 60,72 **** # 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) (SHLIB_LINK='$(SHLIB_LINK)' \ SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ $(INCLUDES) $(srcdir)/cp/g++spec.c) ! $(INTL_TARGETS): $(srcdir)/cp/parse.c # Create the compiler driver for g++. GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o --- 62,74 ---- # 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) (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 *************** $(DEMANGLER_PROG): cxxmain.o underscore. *** 93,106 **** # The compiler itself. # Shared with C front end: ! CXX_C_OBJS = c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o c-dump.o $(CXX_TARGET_OBJS) # Language-specific object files. ! CXX_OBJS = cp/call.o cp/decl.o cp/errfn.o cp/expr.o cp/pt.o cp/typeck2.o \ cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \ cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ ! cp/search.o cp/semantics.o cp/tree.o cp/xref.o cp/repo.o cp/dump.o \ ! cp/optimize.o cp/mangle.o # Use loose warnings for this front end. cp-warn = --- 95,109 ---- # The compiler itself. # Shared with C front end: ! CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ ! $(CXX_TARGET_OBJS) # Language-specific object files. ! CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \ cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ ! cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o \ ! cp/optimize.o cp/mangle.o cp/cp-lang.o # Use loose warnings for this front end. cp-warn = *************** $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.g *** 115,125 **** gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \ $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h ! $(srcdir)/cp/parse.h $(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y @echo "Expect 33 shift/reduce conflicts and 58 reduce/reduce conflicts." ! cd $(srcdir)/cp; $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y ; \ ! grep '^#define[ ]*YYEMPTY' p$$$$.c >> p$$$$.h ; \ ! mv -f p$$$$.c parse.c ; mv -f p$$$$.h parse.h # # Build hooks: --- 118,135 ---- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \ $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h ! $(srcdir)/cp/parse.h: $(srcdir)/cp/parse.c ! $(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y @echo "Expect 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 # # Build hooks: *************** c++.rest.encap: $(DEMANGLER_PROG) *** 131,136 **** --- 141,147 ---- c++.info: c++.dvi: + c++.generated-manpages: # # Install hooks: *************** c++.install-normal: *** 141,147 **** # Install the driver program as $(target)-g++ # and also as either g++ (if native) or $(tooldir)/bin/g++. ! c++.install-common: -if [ -f cc1plus$(exeext) ] ; then \ if [ -f g++-cross$(exeext) ] ; then \ rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \ --- 152,158 ---- # Install the driver program as $(target)-g++ # and also as either g++ (if native) or $(tooldir)/bin/g++. ! c++.install-common: installdirs -if [ -f cc1plus$(exeext) ] ; then \ if [ -f g++-cross$(exeext) ] ; then \ rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \ *************** c++.install-common: *** 161,170 **** chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ ! rm -f $(bindir)/$(target_alias)-g++$(exeext); \ ! $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-g++$(exeext); \ ! rm -f $(bindir)/$(target_alias)-c++$(exeext); \ ! $(LN) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-c++$(exeext); \ fi ; \ if [ x$(DEMANGLER_PROG) != x ] && [ -x "$(DEMANGLER_PROG)" ]; then \ if [ -f g++-cross$(exeext) ] ; then \ --- 172,181 ---- chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ ! rm -f $(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \ ! $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \ ! rm -f $(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \ ! $(LN) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \ fi ; \ if [ x$(DEMANGLER_PROG) != x ] && [ -x "$(DEMANGLER_PROG)" ]; then \ if [ -f g++-cross$(exeext) ] ; then \ *************** c++.install-common: *** 179,187 **** fi ; \ fi ! c++.install-info: ! c++.install-man: $(srcdir)/cp/g++.1 -if [ -f cc1plus$(exeext) ] ; then \ if [ -f g++-cross$(exeext) ] ; then \ rm -f $(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \ --- 190,198 ---- fi ; \ fi ! c++.install-info: ! c++.install-man: installdirs $(srcdir)/cp/g++.1 -if [ -f cc1plus$(exeext) ] ; then \ if [ -f g++-cross$(exeext) ] ; then \ rm -f $(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \ *************** c++.stage4: stage4-start *** 233,254 **** # # .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) \ $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \ toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \ $(TM_P_H) cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \ output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \ ! $(TM_P_H) cp/operators.def 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 dwarf2out.h dwarfout.h $(GGC_H) $(RTL_H) ! cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) ! cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h ! cp/class.o: cp/class.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) ! cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) $(GGC_H) 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 --- 244,270 ---- # # .o: .h dependencies. CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-common.h cp/cp-tree.def c-common.def \ ! function.h varray.h $(SYSTEM_H) $(CONFIG_H) $(TARGET_H) \ $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \ toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \ $(TM_P_H) + cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) toplev.h langhooks.h langhooks-def.h \ + c-common.h cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \ output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \ ! cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \ ! output.h except.h toplev.h $(GGC_H) $(RTL_H) ! cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \ ! diagnostic.h ! cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ ! diagnostic.h ! cp/class.o: cp/class.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(TARGET_H) ! cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \ ! $(GGC_H) diagnostic.h cp/friend.o: cp/friend.c $(CXX_TREE_H) flags.h $(RTL_H) toplev.h $(EXPR_H) cp/init.o: cp/init.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ $(GGC_H) except.h *************** cp/method.o: cp/method.c $(CXX_TREE_H) t *** 257,284 **** cp/cvt.o: cp/cvt.c $(CXX_TREE_H) cp/decl.h flags.h toplev.h convert.h cp/search.o: cp/search.c $(CXX_TREE_H) stack.h flags.h toplev.h $(RTL_H) cp/tree.o: cp/tree.c $(CXX_TREE_H) flags.h toplev.h $(GGC_H) $(RTL_H) \ ! insn-config.h integrate.h ! cp/ptree.o: cp/ptree.c $(CXX_TREE_H) system.h cp/rtti.o: cp/rtti.c $(CXX_TREE_H) flags.h toplev.h cp/except.o: cp/except.c $(CXX_TREE_H) flags.h $(RTL_H) except.h toplev.h \ ! cp/cfns.h $(EXPR_H) cp/decl.h $(OBSTACK_H) cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \ except.h $(TM_P_H) - cp/xref.o: cp/xref.c $(CXX_TREE_H) input.h toplev.h cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \ ! $(GGC_H) $(RTL_H) except.h ! cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h real.h ! cp/errfn.o: cp/errfn.c $(CXX_TREE_H) toplev.h ! cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \ ! flags.h $(GGC_H) output.h $(RTL_H) $(TIMEVAR_H) ! cp/dump.o: cp/dump.c $(CXX_TREE_H) c-dump.h cp/optimize.o: cp/optimize.c $(CXX_TREE_H) rtl.h integrate.h insn-config.h \ ! input.h $(PARAMS_H) cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \ ! system.h toplev.h $(GGC_H) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \ $(srcdir)/cp/parse.c $(OUTPUT_OPTION) # --- 273,299 ---- cp/cvt.o: cp/cvt.c $(CXX_TREE_H) cp/decl.h flags.h toplev.h convert.h cp/search.o: cp/search.c $(CXX_TREE_H) stack.h flags.h toplev.h $(RTL_H) cp/tree.o: cp/tree.c $(CXX_TREE_H) flags.h toplev.h $(GGC_H) $(RTL_H) \ ! insn-config.h integrate.h tree-inline.h ! cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(SYSTEM_H) cp/rtti.o: cp/rtti.c $(CXX_TREE_H) flags.h toplev.h cp/except.o: cp/except.c $(CXX_TREE_H) flags.h $(RTL_H) except.h toplev.h \ ! cp/cfns.h $(EXPR_H) libfuncs.h cp/decl.h $(OBSTACK_H) cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \ except.h $(TM_P_H) cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \ ! $(GGC_H) $(RTL_H) except.h tree-inline.h ! cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h ! cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \ ! flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \ ! tree-inline.h ! cp/dump.o: cp/dump.c $(CXX_TREE_H) tree-dump.h cp/optimize.o: cp/optimize.c $(CXX_TREE_H) rtl.h integrate.h insn-config.h \ ! input.h $(PARAMS_H) debug.h tree-inline.h cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \ ! $(SYSTEM_H) toplev.h $(GGC_H) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \ $(srcdir)/cp/parse.c $(OUTPUT_OPTION) # diff -Nrc3pad gcc-3.0.4/gcc/cp/NEWS gcc-3.1/gcc/cp/NEWS *** gcc-3.0.4/gcc/cp/NEWS Thu Aug 2 14:23:11 2001 --- gcc-3.1/gcc/cp/NEWS Tue Mar 19 00:21:55 2002 *************** *** 1,9 **** ! *** Changes in GCC 3.0.1: * -fhonor-std and -fno-honor-std have been removed. -fno-honor-std was a workaround to allow std compliant code to work with the non-std compliant libstdc++-v2. libstdc++-v3 is std compliant. *** Changes in GCC 3.0: * Support for guiding declarations has been removed. --- 1,68 ---- ! *** Changes in GCC 3.1: * -fhonor-std and -fno-honor-std have been removed. -fno-honor-std was a workaround to allow std compliant code to work with the non-std compliant libstdc++-v2. libstdc++-v3 is std compliant. + * The C++ ABI has been fixed so that `void (A::*)() const' is mangled as + "M1AKFvvE", rather than "MK1AFvvE" as before. This change only affects + pointer to cv-qualified member function types. + + * The C++ ABI has been changed to correctly handle this code: + + struct A { + void operator delete[] (void *, size_t); + }; + + struct B : public A { + }; + + new B[10]; + + The amount of storage allocated for the array will be greater than + it was in 3.0, in order to store the number of elements in the + array, so that the correct size can be passed to `operator delete[]' + when the array is deleted. Previously, the value passed to + `operator delete[]' was unpredictable. + + This change will only affect code that declares a two-argument + `operator delete[]' with a second parameter of type `size_t' + in a base class, and does not override that definition in a + derived class. + + * The C++ ABI has been changed so that: + + struct A { + void operator delete[] (void *, size_t); + void operator delete[] (void *); + }; + + does not cause unnecessary storage to be allocated when an array of + `A' objects is allocated. + + This change will only affect code that declares both of these + forms of `operator delete[]', and declared the two-argument form + before the one-argument form. + + * The C++ ABI has been changed so that when a parameter is passed by value, + any cleanup for that parameter is performed in the caller, as specified + by the ia64 C++ ABI, rather than the called function as before. As a + result, classes with a non-trivial destructor but a trivial copy + constructor will be passed and returned by invisible reference, rather + than by bitwise copy as before. + + * G++ now supports the "named return value optimization": for code like + + A f () { + A a; + ... + return a; + } + + G++ will allocate 'a' in the return value slot, so that the return + becomes a no-op. For this to work, all return statements in the function + must return the same variable. + *** Changes in GCC 3.0: * Support for guiding declarations has been removed. diff -Nrc3pad gcc-3.0.4/gcc/cp/call.c gcc-3.1/gcc/cp/call.c *** gcc-3.0.4/gcc/cp/call.c Thu Nov 29 20:16:18 2001 --- gcc-3.1/gcc/cp/call.c Sat Apr 13 01:31:06 2002 *************** *** 1,6 **** /* Functions related to invoking methods and overloaded functions. Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, ! 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) and modified by Brendan Kehoe (brendan@cygnus.com). --- 1,6 ---- /* Functions related to invoking methods and overloaded functions. Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, ! 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) and modified by Brendan Kehoe (brendan@cygnus.com). *************** Boston, MA 02111-1307, USA. */ *** 34,39 **** --- 34,40 ---- #include "toplev.h" #include "expr.h" #include "ggc.h" + #include "diagnostic.h" extern int inhibit_warnings; *************** static int joust PARAMS ((struct z_candi *** 46,53 **** static int compare_ics PARAMS ((tree, tree)); static tree build_over_call PARAMS ((struct z_candidate *, tree, int)); static tree build_java_interface_fn_ref PARAMS ((tree, tree)); ! #define convert_like(CONV, EXPR) convert_like_real (CONV, EXPR, NULL_TREE, 0, 0) ! #define convert_like_with_context(CONV, EXPR, FN, ARGNO) convert_like_real (CONV, EXPR, FN, ARGNO, 0) static tree convert_like_real PARAMS ((tree, tree, tree, int, int)); static void op_error PARAMS ((enum tree_code, enum tree_code, tree, tree, tree, const char *)); --- 47,56 ---- static int compare_ics PARAMS ((tree, tree)); static tree build_over_call PARAMS ((struct z_candidate *, tree, int)); static tree build_java_interface_fn_ref PARAMS ((tree, tree)); ! #define convert_like(CONV, EXPR) \ ! convert_like_real ((CONV), (EXPR), NULL_TREE, 0, 0) ! #define convert_like_with_context(CONV, EXPR, FN, ARGNO) \ ! convert_like_real ((CONV), (EXPR), (FN), (ARGNO), 0) static tree convert_like_real PARAMS ((tree, tree, tree, int, int)); static void op_error PARAMS ((enum tree_code, enum tree_code, tree, tree, tree, const char *)); *************** build_field_call (basetype_path, instanc *** 147,153 **** { /* If it's a field, try overloading operator (), or calling if the field is a pointer-to-function. */ ! instance = build_indirect_ref (instance_ptr, NULL_PTR); instance = build_component_ref_1 (instance, field, 0); if (instance == error_mark_node) --- 150,156 ---- { /* 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_component_ref_1 (instance, field, 0); if (instance == error_mark_node) *************** check_dtor_name (basetype, name) *** 193,200 **** else name = get_type_value (name); } else ! my_friendly_abort (980605); if (name && TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (name)) return 1; --- 196,212 ---- else name = get_type_value (name); } + /* In the case of: + + template struct S { ~S(); }; + int i; + i.~S(); + + NAME will be a class template. */ + else if (DECL_CLASS_TEMPLATE_P (name)) + return 0; else ! abort (); if (name && TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (name)) return 1; *************** build_scoped_method_call (exp, basetype, *** 255,261 **** return build_method_call (exp, name, parms, NULL_TREE, LOOKUP_NORMAL); if (! check_dtor_name (basetype, name)) ! cp_error ("qualified type `%T' does not match destructor name `~%T'", basetype, TREE_OPERAND (name, 0)); /* Destructors can be "called" for simple types; see 5.2.4 and 12.4 Note --- 267,273 ---- 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 *************** build_scoped_method_call (exp, basetype, *** 264,270 **** if (! IS_AGGR_TYPE (basetype)) { if (TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (basetype)) ! cp_error ("type of `%E' does not match destructor type `%T' (type was `%T')", exp, basetype, type); return cp_convert (void_type_node, exp); --- 276,282 ---- 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); *************** build_scoped_method_call (exp, basetype, *** 273,279 **** if (TREE_CODE (basetype) == NAMESPACE_DECL) { ! cp_error ("`%D' is a namespace", basetype); return error_mark_node; } if (! is_aggr_type (basetype, 1)) --- 285,291 ---- if (TREE_CODE (basetype) == NAMESPACE_DECL) { ! error ("`%D' is a namespace", basetype); return error_mark_node; } if (! is_aggr_type (basetype, 1)) *************** build_scoped_method_call (exp, basetype, *** 281,294 **** if (! IS_AGGR_TYPE (type)) { ! cp_error ("base object `%E' of scoped method call is of non-aggregate type `%T'", exp, type); return error_mark_node; } if (! binfo) { ! binfo = get_binfo (basetype, type, 1); if (binfo == error_mark_node) return error_mark_node; if (! binfo) --- 293,306 ---- 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; } if (! binfo) { ! binfo = lookup_base (type, basetype, ba_check, NULL); if (binfo == error_mark_node) return error_mark_node; if (! binfo) *************** build_scoped_method_call (exp, basetype, *** 298,306 **** if (binfo) { if (TREE_CODE (exp) == INDIRECT_REF) ! decl = build_indirect_ref ! (convert_pointer_to_real ! (binfo, build_unary_op (ADDR_EXPR, exp, 0)), NULL_PTR); else decl = build_scoped_ref (exp, basetype); --- 310,321 ---- if (binfo) { if (TREE_CODE (exp) == INDIRECT_REF) ! { ! decl = build_base_path (PLUS_EXPR, ! build_unary_op (ADDR_EXPR, exp, 0), ! binfo, 1); ! decl = build_indirect_ref (decl, NULL); ! } else decl = build_scoped_ref (exp, basetype); *************** build_call (function, parms) *** 392,398 **** throw without being declared throw(). */ nothrow = ((decl && TREE_NOTHROW (decl)) || TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (function)))); ! if (decl && DECL_CONSTRUCTOR_P (decl)) is_constructor = 1; --- 407,419 ---- throw without being declared throw(). */ nothrow = ((decl && TREE_NOTHROW (decl)) || TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (function)))); ! ! if (decl && TREE_THIS_VOLATILE (decl)) ! current_function_returns_abnormally = 1; ! ! if (decl && TREE_DEPRECATED (decl)) ! warn_deprecated_use (decl); ! if (decl && DECL_CONSTRUCTOR_P (decl)) is_constructor = 1; *************** build_call (function, parms) *** 405,411 **** || !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "__", 2)) mark_used (decl); else ! my_friendly_abort (990125); } /* Don't pass empty class objects by value. This is useful --- 426,432 ---- || !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "__", 2)) mark_used (decl); else ! abort (); } /* Don't pass empty class objects by value. This is useful *************** build_method_call (instance, name, parms *** 512,518 **** basetype = TREE_TYPE (basetype); if (! check_dtor_name (basetype, name)) ! cp_error ("destructor name `~%T' does not match type `%T' of expression", TREE_OPERAND (name, 0), basetype); --- 533,539 ---- basetype = TREE_TYPE (basetype); if (! check_dtor_name (basetype, name)) ! error ("destructor name `~%T' does not match type `%T' of expression", TREE_OPERAND (name, 0), basetype); *************** struct z_candidate { *** 551,557 **** #define BAD_RANK 7 #define ICS_RANK(NODE) \ ! (ICS_BAD_FLAG (NODE) ? BAD_RANK \ : ICS_ELLIPSIS_FLAG (NODE) ? ELLIPSIS_RANK \ : ICS_USER_FLAG (NODE) ? USER_RANK \ : ICS_STD_RANK (NODE)) --- 572,578 ---- #define BAD_RANK 7 #define ICS_RANK(NODE) \ ! (ICS_BAD_FLAG (NODE) ? BAD_RANK \ : ICS_ELLIPSIS_FLAG (NODE) ? ELLIPSIS_RANK \ : ICS_USER_FLAG (NODE) ? USER_RANK \ : ICS_STD_RANK (NODE)) *************** struct z_candidate { *** 565,571 **** /* In a REF_BIND or a BASE_CONV, this indicates that a temporary should be created to hold the result of the conversion. */ ! #define NEED_TEMPORARY_P(NODE) (TREE_LANG_FLAG_4 ((NODE))) #define USER_CONV_CAND(NODE) \ ((struct z_candidate *)WRAPPER_PTR (TREE_OPERAND (NODE, 1))) --- 586,592 ---- /* In a REF_BIND or a BASE_CONV, this indicates that a temporary should be created to hold the result of the conversion. */ ! #define NEED_TEMPORARY_P(NODE) TREE_LANG_FLAG_4 (NODE) #define USER_CONV_CAND(NODE) \ ((struct z_candidate *)WRAPPER_PTR (TREE_OPERAND (NODE, 1))) *************** standard_conversion (to, from, expr) *** 684,690 **** if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to)) && expr && type_unknown_p (expr)) { ! expr = instantiate_type (to, expr, itf_none); if (expr == error_mark_node) return NULL_TREE; from = TREE_TYPE (expr); --- 705,711 ---- if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to)) && expr && type_unknown_p (expr)) { ! expr = instantiate_type (to, expr, tf_none); if (expr == error_mark_node) return NULL_TREE; from = TREE_TYPE (expr); *************** standard_conversion (to, from, expr) *** 738,743 **** --- 759,780 ---- { conv = build_conv (STD_CONV, to, conv); } + else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE) + || (tcode == POINTER_TYPE && fcode == INTEGER_TYPE)) + { + /* For backwards brain damage compatibility, allow interconversion of + pointers and integers with a pedwarn. */ + conv = build_conv (STD_CONV, to, conv); + ICS_BAD_FLAG (conv) = 1; + } + else if (tcode == ENUMERAL_TYPE && fcode == INTEGER_TYPE + && TYPE_PRECISION (to) == TYPE_PRECISION (from)) + { + /* For backwards brain damage compatibility, allow interconversion of + enums and integers with a pedwarn. */ + conv = build_conv (STD_CONV, to, conv); + ICS_BAD_FLAG (conv) = 1; + } else if (tcode == POINTER_TYPE && fcode == POINTER_TYPE) { enum tree_code ufcode = TREE_CODE (TREE_TYPE (from)); *************** standard_conversion (to, from, expr) *** 751,766 **** { 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) { tree fbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (from)); tree tbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (to)); - tree binfo = get_binfo (fbase, tbase, 1); ! if (binfo && !binfo_from_vbase (binfo) && (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (TREE_TYPE (from)), TREE_TYPE (TREE_TYPE (to))))) --- 788,802 ---- { 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) { tree fbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (from)); tree tbase = TYPE_OFFSET_BASETYPE (TREE_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))))) *************** standard_conversion (to, from, expr) *** 777,783 **** { from = cp_build_qualified_type (TREE_TYPE (to), ! CP_TYPE_QUALS (TREE_TYPE (from))); from = build_pointer_type (from); conv = build_conv (PTR_CONV, from, conv); } --- 813,819 ---- { from = cp_build_qualified_type (TREE_TYPE (to), ! cp_type_quals (TREE_TYPE (from))); from = build_pointer_type (from); conv = build_conv (PTR_CONV, from, conv); } *************** standard_conversion (to, from, expr) *** 806,821 **** tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to)); tree fbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fromfn))); tree tbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (tofn))); - tree binfo = get_binfo (fbase, tbase, 1); ! if (!binfo || binfo_from_vbase (binfo) || !same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn)) || !compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)), TREE_CHAIN (TYPE_ARG_TYPES (tofn))) ! || CP_TYPE_QUALS (fbase) != CP_TYPE_QUALS (tbase)) return 0; ! from = cp_build_qualified_type (tbase, CP_TYPE_QUALS (fbase)); from = build_cplus_method_type (from, TREE_TYPE (fromfn), TREE_CHAIN (TYPE_ARG_TYPES (fromfn))); from = build_ptrmemfunc_type (build_pointer_type (from)); --- 842,856 ---- tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to)); tree fbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fromfn))); tree tbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (tofn))); ! if (!DERIVED_FROM_P (fbase, tbase) || !same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn)) || !compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)), TREE_CHAIN (TYPE_ARG_TYPES (tofn))) ! || cp_type_quals (fbase) != cp_type_quals (tbase)) 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_ptrmemfunc_type (build_pointer_type (from)); *************** reference_binding (rto, rfrom, expr, fla *** 1071,1077 **** if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr)) { ! expr = instantiate_type (to, expr, itf_none); if (expr == error_mark_node) return NULL_TREE; from = TREE_TYPE (expr); --- 1106,1112 ---- if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr)) { ! expr = instantiate_type (to, expr, tf_none); if (expr == error_mark_node) return NULL_TREE; from = TREE_TYPE (expr); *************** reference_binding (rto, rfrom, expr, fla *** 1096,1102 **** { /* [dcl.init.ref] ! If the intializer expression -- is an lvalue (but not an lvalue for a bit-field), and "cv1 T1" is reference-compatible with "cv2 T2," --- 1131,1137 ---- { /* [dcl.init.ref] ! If the initializer expression -- is an lvalue (but not an lvalue for a bit-field), and "cv1 T1" is reference-compatible with "cv2 T2," *************** add_builtin_candidate (candidates, code, *** 1898,1910 **** return candidates; default: ! my_friendly_abort (367); } type1 = build_reference_type (type1); break; case COND_EXPR: ! /* [over.builtin] For every pair of promoted arithmetic types L and R, there exist candidate operator functions of the form --- 1933,1945 ---- return candidates; default: ! abort (); } type1 = build_reference_type (type1); break; case COND_EXPR: ! /* [over.built] For every pair of promoted arithmetic types L and R, there exist candidate operator functions of the form *************** add_builtin_candidate (candidates, code, *** 1942,1948 **** return candidates; default: ! my_friendly_abort (367); } /* If we're dealing with two pointer types or two enumeral types, --- 1977,1983 ---- return candidates; default: ! abort (); } /* If we're dealing with two pointer types or two enumeral types, *************** add_template_candidate_real (candidates, *** 2203,2208 **** --- 2238,2273 ---- if (fn == error_mark_node) return candidates; + /* In [class.copy]: + + A member function template is never instantiated to perform the + copy of a class object to an object of its class type. + + It's a little unclear what this means; the standard explicitly + does allow a template to be used to copy a class. For example, + in: + + struct A { + A(A&); + template A(const T&); + }; + const A f (); + void g () { A a (f ()); } + + the member template will be used to make the copy. The section + quoted above appears in the paragraph that forbids constructors + whose only parameter is (a possibly cv-qualified variant of) the + class type, and a logical interpretation is that the intent was + to forbid the instantiation of member templates which would then + have that form. */ + if (DECL_CONSTRUCTOR_P (fn) && list_length (arglist) == 2) + { + tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (fn); + if (arg_types && same_type_p (TYPE_MAIN_VARIANT (TREE_VALUE (arg_types)), + ctype)) + return candidates; + } + if (obj != NULL_TREE) /* Aha, this is a conversion function. */ cand = add_conv_candidate (candidates, fn, obj, arglist); *************** print_z_candidates (candidates) *** 2306,2325 **** if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE) { if (TREE_VEC_LENGTH (candidates->convs) == 3) ! cp_error ("%s %D(%T, %T, %T) ", str, candidates->fn, TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)), TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)), TREE_TYPE (TREE_VEC_ELT (candidates->convs, 2))); else if (TREE_VEC_LENGTH (candidates->convs) == 2) ! cp_error ("%s %D(%T, %T) ", str, candidates->fn, TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)), TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1))); else ! cp_error ("%s %D(%T) ", str, candidates->fn, TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0))); } else if (TYPE_P (candidates->fn)) ! cp_error ("%s %T ", str, candidates->fn); else cp_error_at ("%s %+#D%s", str, candidates->fn, candidates->viable == -1 ? " " : ""); --- 2371,2390 ---- if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE) { if (TREE_VEC_LENGTH (candidates->convs) == 3) ! error ("%s %D(%T, %T, %T) ", 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) ", str, candidates->fn, TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)), TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1))); else ! error ("%s %D(%T) ", str, candidates->fn, TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0))); } else if (TYPE_P (candidates->fn)) ! error ("%s %T ", str, candidates->fn); else cp_error_at ("%s %+#D%s", str, candidates->fn, candidates->viable == -1 ? " " : ""); *************** build_user_type_conversion_1 (totype, ex *** 2347,2355 **** /* We represent conversion within a hierarchy using RVALUE_CONV and BASE_CONV, as specified by [over.best.ics]; these become plain constructor calls, as specified in [dcl.init]. */ ! if (IS_AGGR_TYPE (fromtype) && IS_AGGR_TYPE (totype) ! && DERIVED_FROM_P (totype, fromtype)) ! abort (); if (IS_AGGR_TYPE (totype)) ctors = lookup_fnfields (TYPE_BINFO (totype), --- 2412,2419 ---- /* We represent conversion within a hierarchy using RVALUE_CONV and BASE_CONV, as specified by [over.best.ics]; these become plain constructor calls, as specified in [dcl.init]. */ ! my_friendly_assert (!IS_AGGR_TYPE (fromtype) || !IS_AGGR_TYPE (totype) ! || !DERIVED_FROM_P (totype, fromtype), 20011226); if (IS_AGGR_TYPE (totype)) ctors = lookup_fnfields (TYPE_BINFO (totype), *************** build_user_type_conversion_1 (totype, ex *** 2371,2381 **** t = build_int_2 (0, 0); TREE_TYPE (t) = build_pointer_type (totype); args = build_tree_list (NULL_TREE, expr); ! if (DECL_HAS_IN_CHARGE_PARM_P (OVL_CURRENT (ctors)) ! || DECL_HAS_VTT_PARM_P (OVL_CURRENT (ctors))) ! /* We should never try to call the abstract or base constructor ! from here. */ ! abort (); args = tree_cons (NULL_TREE, t, args); } for (; ctors; ctors = OVL_NEXT (ctors)) --- 2435,2445 ---- t = build_int_2 (0, 0); TREE_TYPE (t) = build_pointer_type (totype); args = build_tree_list (NULL_TREE, expr); ! /* We should never try to call the abstract or base constructor ! from here. */ ! my_friendly_assert (!DECL_HAS_IN_CHARGE_PARM_P (OVL_CURRENT (ctors)) ! && !DECL_HAS_VTT_PARM_P (OVL_CURRENT (ctors)), ! 20011226); args = tree_cons (NULL_TREE, t, args); } for (; ctors; ctors = OVL_NEXT (ctors)) *************** build_user_type_conversion_1 (totype, ex *** 2479,2485 **** if (candidates && ! candidates->next) /* say why this one won't work or try to be loose */; else ! cp_error ("no viable candidates"); } #endif --- 2543,2549 ---- if (candidates && ! candidates->next) /* say why this one won't work or try to be loose */; else ! error ("no viable candidates"); } #endif *************** build_user_type_conversion_1 (totype, ex *** 2493,2499 **** { if (flags & LOOKUP_COMPLAIN) { ! cp_error ("conversion from `%T' to `%T' is ambiguous", fromtype, totype); print_z_candidates (candidates); } --- 2557,2563 ---- { if (flags & LOOKUP_COMPLAIN) { ! error ("conversion from `%T' to `%T' is ambiguous", fromtype, totype); print_z_candidates (candidates); } *************** build_new_function_call (fn, args) *** 2610,2616 **** { if (candidates && ! candidates->next) return build_function_call (candidates->fn, args); ! cp_error ("no matching function for call to `%D(%A)'", DECL_NAME (OVL_FUNCTION (fn)), args); if (candidates) print_z_candidates (candidates); --- 2674,2680 ---- { if (candidates && ! candidates->next) return build_function_call (candidates->fn, args); ! error ("no matching function for call to `%D(%A)'", DECL_NAME (OVL_FUNCTION (fn)), args); if (candidates) print_z_candidates (candidates); *************** build_new_function_call (fn, args) *** 2621,2627 **** if (cand == 0) { ! cp_error ("call of overloaded `%D(%A)' is ambiguous", DECL_NAME (OVL_FUNCTION (fn)), args); print_z_candidates (candidates); return error_mark_node; --- 2685,2691 ---- 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; *************** build_object_call (obj, args) *** 2648,2654 **** { /* It's no good looking for an overloaded operator() on a pointer-to-member-function. */ ! cp_error ("pointer-to-member function %E cannot be called without an object; consider using .* or ->*", obj); return error_mark_node; } --- 2712,2718 ---- { /* It's no good looking for an overloaded operator() on a pointer-to-member-function. */ ! error ("pointer-to-member function %E cannot be called without an object; consider using .* or ->*", obj); return error_mark_node; } *************** build_object_call (obj, args) *** 2717,2723 **** if (! any_viable (candidates)) { ! cp_error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args); print_z_candidates (candidates); return error_mark_node; } --- 2781,2787 ---- if (! any_viable (candidates)) { ! error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args); print_z_candidates (candidates); return error_mark_node; } *************** build_object_call (obj, args) *** 2727,2733 **** if (cand == 0) { ! cp_error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args); print_z_candidates (candidates); return error_mark_node; } --- 2791,2797 ---- if (cand == 0) { ! error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args); print_z_candidates (candidates); return error_mark_node; } *************** op_error (code, code2, arg1, arg2, arg3, *** 2762,2784 **** switch (code) { case COND_EXPR: ! cp_error ("%s for `%T ? %T : %T' operator", problem, error_type (arg1), error_type (arg2), error_type (arg3)); break; case POSTINCREMENT_EXPR: case POSTDECREMENT_EXPR: ! cp_error ("%s for `%T %s' operator", problem, error_type (arg1), opname); break; case ARRAY_REF: ! cp_error ("%s for `%T [%T]' operator", problem, error_type (arg1), error_type (arg2)); break; default: if (arg2) ! cp_error ("%s for `%T %s %T' operator", problem, error_type (arg1), opname, error_type (arg2)); else ! cp_error ("%s for `%s %T' operator", problem, opname, error_type (arg1)); } } --- 2826,2848 ---- switch (code) { case COND_EXPR: ! error ("%s for `%T ? %T : %T' operator", problem, error_type (arg1), error_type (arg2), error_type (arg3)); break; case POSTINCREMENT_EXPR: case POSTDECREMENT_EXPR: ! error ("%s for `%T %s' operator", problem, error_type (arg1), opname); break; case ARRAY_REF: ! error ("%s for `%T [%T]' operator", problem, error_type (arg1), error_type (arg2)); break; default: if (arg2) ! error ("%s for `%T %s %T' operator", problem, error_type (arg1), opname, error_type (arg2)); else ! error ("%s for `%s %T' operator", problem, opname, error_type (arg1)); } } *************** build_conditional_expr (arg1, arg2, arg3 *** 2929,2935 **** result_type = void_type_node; else { ! cp_error ("`%E' has type `void' and is not a throw-expression", VOID_TYPE_P (arg2_type) ? arg2 : arg3); return error_mark_node; } --- 2993,2999 ---- result_type = void_type_node; else { ! error ("`%E' has type `void' and is not a throw-expression", VOID_TYPE_P (arg2_type) ? arg2 : arg3); return error_mark_node; } *************** build_conditional_expr (arg1, arg2, arg3 *** 2962,2968 **** || (conv2 && TREE_CODE (conv2) == AMBIG_CONV) || (conv3 && TREE_CODE (conv3) == AMBIG_CONV)) { ! cp_error ("operands to ?: have different types"); return error_mark_node; } else if (conv2 && !ICS_BAD_FLAG (conv2)) --- 3026,3032 ---- || (conv2 && TREE_CODE (conv2) == AMBIG_CONV) || (conv3 && TREE_CODE (conv3) == AMBIG_CONV)) { ! error ("operands to ?: have different types"); return error_mark_node; } else if (conv2 && !ICS_BAD_FLAG (conv2)) *************** build_conditional_expr (arg1, arg2, arg3 *** 3115,3128 **** if (TREE_CODE (arg2_type) == ENUMERAL_TYPE && TREE_CODE (arg3_type) == ENUMERAL_TYPE) ! cp_warning ("enumeral mismatch in conditional expression: `%T' vs `%T'", arg2_type, arg3_type); else if (extra_warnings && ((TREE_CODE (arg2_type) == ENUMERAL_TYPE && !same_type_p (arg3_type, type_promotes_to (arg2_type))) || (TREE_CODE (arg3_type) == ENUMERAL_TYPE && !same_type_p (arg2_type, type_promotes_to (arg3_type))))) ! cp_warning ("enumeral and non-enumeral type in conditional expression"); arg2 = perform_implicit_conversion (result_type, arg2); arg3 = perform_implicit_conversion (result_type, arg3); --- 3179,3192 ---- if (TREE_CODE (arg2_type) == ENUMERAL_TYPE && TREE_CODE (arg3_type) == ENUMERAL_TYPE) ! warning ("enumeral mismatch in conditional expression: `%T' vs `%T'", arg2_type, arg3_type); else if (extra_warnings && ((TREE_CODE (arg2_type) == ENUMERAL_TYPE && !same_type_p (arg3_type, type_promotes_to (arg2_type))) || (TREE_CODE (arg3_type) == ENUMERAL_TYPE && !same_type_p (arg2_type, type_promotes_to (arg3_type))))) ! warning ("enumeral and non-enumeral type in conditional expression"); arg2 = perform_implicit_conversion (result_type, arg2); arg3 = perform_implicit_conversion (result_type, arg3); *************** build_conditional_expr (arg1, arg2, arg3 *** 3162,3168 **** if (!result_type) { ! cp_error ("operands to ?: have different types"); return error_mark_node; } --- 3226,3232 ---- if (!result_type) { ! error ("operands to ?: have different types"); return error_mark_node; } *************** build_new_op (code, flags, arg1, arg2, a *** 3203,3209 **** undeclared_template<1, 5, 72>a; */ if (code == LT_EXPR && TREE_CODE (arg1) == TEMPLATE_DECL) { ! cp_error ("`%D' must be declared before use", arg1); return error_mark_node; } --- 3267,3273 ---- 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; } *************** build_new_op (code, flags, arg1, arg2, a *** 3227,3233 **** case VEC_DELETE_EXPR: case DELETE_EXPR: /* Use build_op_new_call and build_op_delete_call instead. */ ! my_friendly_abort (981018); case CALL_EXPR: return build_object_call (arg1, arg2); --- 3291,3297 ---- case VEC_DELETE_EXPR: case DELETE_EXPR: /* Use build_op_new_call and build_op_delete_call instead. */ ! abort (); case CALL_EXPR: return build_object_call (arg1, arg2); *************** build_new_op (code, flags, arg1, arg2, a *** 3265,3277 **** if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR) arg2 = integer_zero_node; ! if (arg2 && arg3) ! arglist = tree_cons (NULL_TREE, arg1, tree_cons ! (NULL_TREE, arg2, build_tree_list (NULL_TREE, arg3))); ! else if (arg2) ! arglist = tree_cons (NULL_TREE, arg1, build_tree_list (NULL_TREE, arg2)); ! else ! arglist = build_tree_list (NULL_TREE, arg1); fns = lookup_function_nonclass (fnname, arglist); --- 3329,3340 ---- if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR) arg2 = integer_zero_node; ! arglist = NULL_TREE; ! if (arg3) ! arglist = tree_cons (NULL_TREE, arg3, arglist); ! if (arg2) ! arglist = tree_cons (NULL_TREE, arg2, arglist); ! arglist = tree_cons (NULL_TREE, arg1, arglist); fns = lookup_function_nonclass (fnname, arglist); *************** build_new_op (code, flags, arg1, arg2, a *** 3367,3373 **** /* Look for an `operator++ (int)'. If they didn't have one, then we fall back to the old way of doing things. */ if (flags & LOOKUP_COMPLAIN) ! cp_pedwarn ("no `%D(int)' declared for postfix `%s', trying prefix operator instead", fnname, operator_name_info[code].name); if (code == POSTINCREMENT_EXPR) --- 3430,3436 ---- /* Look for an `operator++ (int)'. If they didn't have one, then we fall back to the old way of doing things. */ if (flags & LOOKUP_COMPLAIN) ! pedwarn ("no `%D(int)' declared for postfix `%s', trying prefix operator instead", fnname, operator_name_info[code].name); if (code == POSTINCREMENT_EXPR) *************** build_new_op (code, flags, arg1, arg2, a *** 3414,3420 **** && candidates->next && ! candidates->next->next) { ! cp_warning ("using synthesized `%#D' for copy assignment", cand->fn); cp_warning_at (" where cfront would use `%#D'", cand == candidates --- 3477,3483 ---- && candidates->next && ! candidates->next->next) { ! warning ("using synthesized `%#D' for copy assignment", cand->fn); cp_warning_at (" where cfront would use `%#D'", cand == candidates *************** build_new_op (code, flags, arg1, arg2, a *** 3443,3449 **** && (TYPE_MAIN_VARIANT (TREE_TYPE (arg1)) != TYPE_MAIN_VARIANT (TREE_TYPE (arg2)))) { ! cp_warning ("comparison between `%#T' and `%#T'", TREE_TYPE (arg1), TREE_TYPE (arg2)); } break; --- 3506,3512 ---- && (TYPE_MAIN_VARIANT (TREE_TYPE (arg1)) != TYPE_MAIN_VARIANT (TREE_TYPE (arg2)))) { ! warning ("comparison between `%#T' and `%#T'", TREE_TYPE (arg1), TREE_TYPE (arg2)); } break; *************** builtin: *** 3524,3530 **** case MEMBER_REF: return build_m_component_ref ! (build_indirect_ref (arg1, NULL_PTR), arg2); /* The caller will deal with these. */ case ADDR_EXPR: --- 3587,3593 ---- case MEMBER_REF: return build_m_component_ref ! (build_indirect_ref (arg1, NULL), arg2); /* The caller will deal with these. */ case ADDR_EXPR: *************** builtin: *** 3533,3539 **** return NULL_TREE; default: ! my_friendly_abort (367); return NULL_TREE; } } --- 3596,3602 ---- return NULL_TREE; default: ! abort (); return NULL_TREE; } } *************** builtin: *** 3545,3552 **** match with the placement new is accepted. CODE is either DELETE_EXPR or VEC_DELETE_EXPR. ! ADDR is the pointer to be deleted. For placement delete, it is also ! used to determine what the corresponding new looked like. SIZE is the size of the memory block to be deleted. FLAGS are the usual overloading flags. PLACEMENT is the corresponding placement new call, or NULL_TREE. */ --- 3608,3614 ---- match with the placement new is accepted. CODE is either DELETE_EXPR or VEC_DELETE_EXPR. ! ADDR is the pointer to be deleted. SIZE is the size of the memory block to be deleted. FLAGS are the usual overloading flags. PLACEMENT is the corresponding placement new call, or NULL_TREE. */ *************** build_op_delete_call (code, addr, size, *** 3557,3563 **** tree addr, size, placement; int flags; { ! tree fn, fns, fnname, fntype, argtypes, args, type; int pass; if (addr == error_mark_node) --- 3619,3626 ---- tree addr, size, placement; int flags; { ! tree fn = NULL_TREE; ! tree fns, fnname, fntype, argtypes, args, type; int pass; if (addr == error_mark_node) *************** build_op_delete_call (code, addr, size, *** 3590,3604 **** if (placement) { ! /* placement is a CALL_EXPR around an ADDR_EXPR around a function. */ /* Extract the function. */ ! argtypes = TREE_OPERAND (TREE_OPERAND (placement, 0), 0); /* Then the second parm type. */ ! argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (argtypes))); ! /* Also the second argument. */ ! args = TREE_CHAIN (TREE_OPERAND (placement, 1)); } else { --- 3653,3674 ---- if (placement) { ! tree alloc_fn; ! tree call_expr; + /* 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); /* Then the second parm type. */ ! argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn))); /* Also the second argument. */ ! args = TREE_CHAIN (TREE_OPERAND (call_expr, 1)); } else { *************** build_op_delete_call (code, addr, size, *** 3675,3681 **** if (placement) return NULL_TREE; ! cp_error ("no suitable `operator delete' for `%T'", type); return error_mark_node; } --- 3745,3751 ---- if (placement) return NULL_TREE; ! error ("no suitable `operator delete' for `%T'", type); return error_mark_node; } *************** enforce_access (basetype_path, decl) *** 3699,3705 **** cp_error_at ("`%+#D' is protected", decl); else cp_error_at ("`%+#D' is inaccessible", decl); ! cp_error ("within this context"); return 0; } --- 3769,3775 ---- cp_error_at ("`%+#D' is protected", decl); else cp_error_at ("`%+#D' is inaccessible", decl); ! error ("within this context"); return 0; } *************** convert_like_real (convs, expr, fn, argn *** 3719,3725 **** int argnum; int inner; { - extern int warningcount, errorcount; int savew, savee; tree totype = TREE_TYPE (convs); --- 3789,3794 ---- *************** convert_like_real (convs, expr, fn, argn *** 3732,3738 **** tree t = convs; for (; t; t = TREE_OPERAND (t, 0)) { ! if (TREE_CODE (t) == USER_CONV) { expr = convert_like_real (t, expr, fn, argnum, 1); break; --- 3801,3807 ---- tree t = convs; for (; t; t = TREE_OPERAND (t, 0)) { ! if (TREE_CODE (t) == USER_CONV || !ICS_BAD_FLAG (t)) { expr = convert_like_real (t, expr, fn, argnum, 1); break; *************** convert_like_real (convs, expr, fn, argn *** 3742,3750 **** else if (TREE_CODE (t) == IDENTITY_CONV) break; } ! return convert_for_initialization ! (NULL_TREE, totype, expr, LOOKUP_NORMAL, ! "conversion", fn, argnum); } if (!inner) --- 3811,3820 ---- else if (TREE_CODE (t) == IDENTITY_CONV) break; } ! pedwarn ("invalid conversion from `%T' to `%T'", TREE_TYPE (expr), totype); ! if (fn) ! pedwarn (" initializing argument %P of `%D'", argnum, fn); ! return cp_convert (totype, expr); } if (!inner) *************** convert_like_real (convs, expr, fn, argn *** 3805,3825 **** if (fn) { if (warningcount > savew) ! cp_warning (" initializing argument %P of `%D' from result of `%D'", argnum, fn, convfn); else if (errorcount > savee) ! cp_error (" initializing argument %P of `%D' from result of `%D'", argnum, fn, convfn); } else { if (warningcount > savew) ! cp_warning (" initializing temporary from result of `%D'", convfn); else if (errorcount > savee) ! cp_error (" initializing temporary from result of `%D'", convfn); } expr = build_cplus_new (totype, expr); --- 3875,3895 ---- if (fn) { if (warningcount > savew) ! warning (" initializing argument %P of `%D' from result of `%D'", argnum, fn, convfn); else if (errorcount > savee) ! error (" initializing argument %P of `%D' from result of `%D'", argnum, fn, convfn); } else { if (warningcount > savew) ! warning (" initializing temporary from result of `%D'", convfn); else if (errorcount > savee) ! error (" initializing temporary from result of `%D'", convfn); } expr = build_cplus_new (totype, expr); *************** convert_like_real (convs, expr, fn, argn *** 3828,3834 **** } case IDENTITY_CONV: if (type_unknown_p (expr)) ! expr = instantiate_type (totype, expr, itf_complain); return expr; case AMBIG_CONV: /* Call build_user_type_conversion again for the error. */ --- 3898,3904 ---- } case IDENTITY_CONV: if (type_unknown_p (expr)) ! expr = instantiate_type (totype, expr, tf_error | tf_warning); return expr; case AMBIG_CONV: /* Call build_user_type_conversion again for the error. */ *************** convert_like_real (convs, expr, fn, argn *** 3874,3881 **** /* 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] */ ! if (fn) ! savew = warningcount, savee = errorcount; expr = build_new_method_call (NULL_TREE, complete_ctor_identifier, build_tree_list (NULL_TREE, expr), TYPE_BINFO (totype), --- 3944,3950 ---- /* Copy-initialization where the cv-unqualified version of the source type is the same class as, or a derived class of, the class of the destination [is treated as direct-initialization]. [dcl.init] */ ! savew = warningcount, savee = errorcount; expr = build_new_method_call (NULL_TREE, complete_ctor_identifier, build_tree_list (NULL_TREE, expr), TYPE_BINFO (totype), *************** convert_like_real (convs, expr, fn, argn *** 3883,3891 **** if (fn) { if (warningcount > savew) ! cp_warning (" initializing argument %P of `%D'", argnum, fn); else if (errorcount > savee) ! cp_error (" initializing argument %P of `%D'", argnum, fn); } return build_cplus_new (totype, expr); --- 3952,3960 ---- if (fn) { if (warningcount > savew) ! warning (" initializing argument %P of `%D'", argnum, fn); else if (errorcount > savee) ! error (" initializing argument %P of `%D'", argnum, fn); } return build_cplus_new (totype, expr); *************** convert_arg_to_ellipsis (arg) *** 3954,3960 **** if (arg != error_mark_node && ! pod_type_p (TREE_TYPE (arg))) { /* Undefined behaviour [expr.call] 5.2.2/7. */ ! cp_warning ("cannot pass objects of non-POD type `%#T' through `...'", TREE_TYPE (arg)); } --- 4023,4029 ---- if (arg != error_mark_node && ! pod_type_p (TREE_TYPE (arg))) { /* Undefined behaviour [expr.call] 5.2.2/7. */ ! warning ("cannot pass objects of non-POD type `%#T' through `...'", TREE_TYPE (arg)); } *************** build_x_va_arg (expr, type) *** 3979,3985 **** if (! pod_type_p (type)) { /* Undefined behaviour [expr.call] 5.2.2/7. */ ! cp_warning ("cannot receive objects of non-POD type `%#T' through `...'", type); } --- 4048,4054 ---- if (! pod_type_p (type)) { /* Undefined behaviour [expr.call] 5.2.2/7. */ ! warning ("cannot receive objects of non-POD type `%#T' through `...'", type); } *************** convert_default_arg (type, arg, fn, parm *** 4065,4070 **** --- 4134,4144 ---- return arg; } + /* Subroutine of the various build_*_call functions. Overload resolution + has chosen a winning candidate CAND; build up a CALL_EXPR accordingly. + ARGS is a TREE_LIST of the unconverted arguments to the call. FLAGS is a + bitmask of various LOOKUP_* flags which apply to the call itself. */ + static tree build_over_call (cand, args, flags) struct z_candidate *cand; *************** build_over_call (cand, args, flags) *** 4116,4122 **** tree argtype = TREE_TYPE (TREE_VALUE (arg)); tree t; if (ICS_BAD_FLAG (TREE_VEC_ELT (convs, i))) ! cp_pedwarn ("passing `%T' as `this' argument of `%#D' discards qualifiers", TREE_TYPE (argtype), fn); /* [class.mfct.nonstatic]: If a nonstatic member function of a class --- 4190,4196 ---- tree argtype = TREE_TYPE (TREE_VALUE (arg)); tree t; if (ICS_BAD_FLAG (TREE_VEC_ELT (convs, i))) ! pedwarn ("passing `%T' as `this' argument of `%#D' discards qualifiers", TREE_TYPE (argtype), fn); /* [class.mfct.nonstatic]: If a nonstatic member function of a class *************** build_over_call (cand, args, flags) *** 4126,4132 **** So we can assume that anything passed as 'this' is non-null, and optimize accordingly. */ my_friendly_assert (TREE_CODE (parmtype) == POINTER_TYPE, 19990811); ! t = convert_pointer_to_real (TREE_TYPE (parmtype), TREE_VALUE (arg)); converted_args = tree_cons (NULL_TREE, t, converted_args); parm = TREE_CHAIN (parm); arg = TREE_CHAIN (arg); --- 4200,4208 ---- So we can assume that anything passed as 'this' is non-null, and optimize accordingly. */ my_friendly_assert (TREE_CODE (parmtype) == POINTER_TYPE, 19990811); ! t = lookup_base (TREE_TYPE (TREE_TYPE (TREE_VALUE (arg))), ! TREE_TYPE (parmtype), ba_ignore, NULL); ! t = build_base_path (PLUS_EXPR, TREE_VALUE (arg), t, 1); converted_args = tree_cons (NULL_TREE, t, converted_args); parm = TREE_CHAIN (parm); arg = TREE_CHAIN (arg); *************** build_over_call (cand, args, flags) *** 4140,4171 **** tree type = TREE_VALUE (parm); conv = TREE_VEC_ELT (convs, i); ! if (ICS_BAD_FLAG (conv)) ! { ! tree t = conv; ! val = TREE_VALUE (arg); ! ! for (; t; t = TREE_OPERAND (t, 0)) ! { ! if (TREE_CODE (t) == USER_CONV ! || TREE_CODE (t) == AMBIG_CONV) ! { ! val = convert_like_with_context (t, val, fn, i - is_method); ! break; ! } ! else if (TREE_CODE (t) == IDENTITY_CONV) ! break; ! } ! val = convert_for_initialization ! (NULL_TREE, type, val, LOOKUP_NORMAL, ! "argument", fn, i - is_method); ! } ! else ! { ! val = TREE_VALUE (arg); ! val = convert_like_with_context ! (conv, TREE_VALUE (arg), fn, i - is_method); ! } if (PROMOTE_PROTOTYPES && INTEGRAL_TYPE_P (type) --- 4216,4223 ---- tree type = TREE_VALUE (parm); conv = TREE_VEC_ELT (convs, i); ! val = convert_like_with_context ! (conv, TREE_VALUE (arg), fn, i - is_method); if (PROMOTE_PROTOTYPES && INTEGRAL_TYPE_P (type) *************** build_over_call (cand, args, flags) *** 4192,4200 **** converted_args = nreverse (converted_args); ! if (warn_format && (DECL_NAME (fn) || DECL_ASSEMBLER_NAME (fn))) ! check_function_format (NULL, DECL_NAME (fn), DECL_ASSEMBLER_NAME (fn), ! converted_args); /* Avoid actually calling copy constructors and copy assignment operators, if possible. */ --- 4244,4252 ---- converted_args = nreverse (converted_args); ! if (warn_format) ! check_function_format (NULL, TYPE_ATTRIBUTES (TREE_TYPE (fn)), ! converted_args); /* Avoid actually calling copy constructors and copy assignment operators, if possible. */ *************** build_over_call (cand, args, flags) *** 4253,4259 **** be touched as it might overlay things. When the gcc core learns about empty classes, we can treat it like other classes. */ ! && !is_empty_class (DECL_CONTEXT (fn))) { tree address; tree to = stabilize_reference --- 4305,4312 ---- be touched as it might overlay things. When the gcc core learns about empty classes, we can treat it like other classes. */ ! && !(is_empty_class (DECL_CONTEXT (fn)) ! && TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))) { tree address; tree to = stabilize_reference *************** build_over_call (cand, args, flags) *** 4268,4274 **** } } else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR ! && copy_args_p (fn) && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn))) { tree to = stabilize_reference --- 4321,4327 ---- } } else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR ! && copy_fn_p (fn) && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn))) { tree to = stabilize_reference *************** build_over_call (cand, args, flags) *** 4289,4294 **** --- 4342,4348 ---- Ideally, the notions of having side-effects and of being useless would be orthogonal. */ TREE_SIDE_EFFECTS (val) = 1; + TREE_NO_UNUSED_WARNING (val) = 1; } else val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg); *************** build_over_call (cand, args, flags) *** 4300,4315 **** if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0) { tree t, *p = &TREE_VALUE (converted_args); ! tree binfo = get_binfo ! (DECL_VIRTUAL_CONTEXT (fn), TREE_TYPE (TREE_TYPE (*p)), 0); ! *p = convert_pointer_to_real (binfo, *p); if (TREE_SIDE_EFFECTS (*p)) *p = save_expr (*p); t = build_pointer_type (TREE_TYPE (fn)); if (DECL_CONTEXT (fn) && TYPE_JAVA_INTERFACE (DECL_CONTEXT (fn))) fn = build_java_interface_fn_ref (fn, *p); else ! fn = build_vfn_ref (p, build_indirect_ref (*p, 0), DECL_VINDEX (fn)); TREE_TYPE (fn) = t; } else if (DECL_INLINE (fn)) --- 4354,4372 ---- if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0) { tree t, *p = &TREE_VALUE (converted_args); ! tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (*p)), ! DECL_VIRTUAL_CONTEXT (fn), ! ba_any, NULL); ! my_friendly_assert (binfo && binfo != error_mark_node, 20010730); ! ! *p = build_base_path (PLUS_EXPR, *p, binfo, 1); if (TREE_SIDE_EFFECTS (*p)) *p = save_expr (*p); t = build_pointer_type (TREE_TYPE (fn)); if (DECL_CONTEXT (fn) && TYPE_JAVA_INTERFACE (DECL_CONTEXT (fn))) fn = build_java_interface_fn_ref (fn, *p); else ! fn = build_vfn_ref (build_indirect_ref (*p, 0), DECL_VINDEX (fn)); TREE_TYPE (fn) = t; } else if (DECL_INLINE (fn)) *************** build_java_interface_fn_ref (fn, instanc *** 4368,4374 **** java_iface_lookup_fn = builtin_function ("_Jv_LookupInterfaceMethodIdx", build_function_type (ptr_type_node, t), ! 0, NOT_BUILT_IN, NULL_PTR); ggc_add_tree_root (&java_iface_lookup_fn, 1); } --- 4425,4431 ---- java_iface_lookup_fn = builtin_function ("_Jv_LookupInterfaceMethodIdx", build_function_type (ptr_type_node, t), ! 0, NOT_BUILT_IN, NULL); ggc_add_tree_root (&java_iface_lookup_fn, 1); } *************** build_java_interface_fn_ref (fn, instanc *** 4383,4389 **** if (!iface_ref || TREE_CODE (iface_ref) != VAR_DECL || DECL_CONTEXT (iface_ref) != iface) { ! cp_error ("Could not find class$ field in java interface type `%T'", iface); return error_mark_node; } --- 4440,4446 ---- if (!iface_ref || TREE_CODE (iface_ref) != VAR_DECL || DECL_CONTEXT (iface_ref) != iface) { ! error ("could not find class$ field in java interface type `%T'", iface); return error_mark_node; } *************** in_charge_arg_for_name (name) *** 4429,4435 **** /* This function should only be called with one of the names listed above. */ ! my_friendly_abort (20000411); return NULL_TREE; } --- 4486,4492 ---- /* This function should only be called with one of the names listed above. */ ! abort (); return NULL_TREE; } *************** build_new_method_call (instance, name, a *** 4484,4490 **** if (! IS_AGGR_TYPE (basetype)) { if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node) ! cp_error ("request for member `%D' in `%E', which is of non-aggregate type `%T'", name, instance, basetype); return error_mark_node; --- 4541,4547 ---- if (! IS_AGGR_TYPE (basetype)) { if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node) ! error ("request for member `%D' in `%E', which is of non-aggregate type `%T'", name, instance, basetype); return error_mark_node; *************** build_new_method_call (instance, name, a *** 4610,4618 **** if (!COMPLETE_TYPE_P (basetype)) incomplete_type_error (instance_ptr, basetype); else ! cp_error ("no matching function for call to `%T::%D(%A)%V'", ! basetype, pretty_name, user_args, ! TREE_TYPE (TREE_TYPE (instance_ptr))); print_z_candidates (candidates); return error_mark_node; } --- 4667,4675 ---- if (!COMPLETE_TYPE_P (basetype)) 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))); print_z_candidates (candidates); return error_mark_node; } *************** build_new_method_call (instance, name, a *** 4621,4627 **** if (cand == 0) { ! cp_error ("call of overloaded `%D(%A)' is ambiguous", pretty_name, user_args); print_z_candidates (candidates); return error_mark_node; --- 4678,4684 ---- if (cand == 0) { ! error ("call of overloaded `%D(%A)' is ambiguous", pretty_name, user_args); print_z_candidates (candidates); return error_mark_node; *************** build_new_method_call (instance, name, a *** 4633,4652 **** || DECL_DESTRUCTOR_P (current_function_decl)) && ! (flags & LOOKUP_NONVIRTUAL) && value_member (cand->fn, CLASSTYPE_PURE_VIRTUALS (basetype))) ! cp_error ((DECL_CONSTRUCTOR_P (current_function_decl) ? "abstract virtual `%#D' called from constructor" : "abstract virtual `%#D' called from destructor"), cand->fn); if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE && is_dummy_object (instance_ptr)) { ! cp_error ("cannot call member function `%D' without object", cand->fn); return error_mark_node; } if (DECL_VINDEX (cand->fn) && ! (flags & LOOKUP_NONVIRTUAL) ! && ((instance == current_class_ref && (dtor_label || ctor_label)) ! || resolves_to_fixed_type_p (instance, 0))) flags |= LOOKUP_NONVIRTUAL; if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE) --- 4690,4708 ---- || DECL_DESTRUCTOR_P (current_function_decl)) && ! (flags & LOOKUP_NONVIRTUAL) && value_member (cand->fn, CLASSTYPE_PURE_VIRTUALS (basetype))) ! error ((DECL_CONSTRUCTOR_P (current_function_decl) ? "abstract virtual `%#D' called from constructor" : "abstract virtual `%#D' called from destructor"), cand->fn); if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE && is_dummy_object (instance_ptr)) { ! error ("cannot call member function `%D' without object", cand->fn); return error_mark_node; } if (DECL_VINDEX (cand->fn) && ! (flags & LOOKUP_NONVIRTUAL) ! && resolves_to_fixed_type_p (instance, 0)) flags |= LOOKUP_NONVIRTUAL; if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE) *************** maybe_handle_ref_bind (ics) *** 4769,4776 **** { if (TREE_CODE (*ics) == REF_BIND) { ! tree type = TREE_TYPE (TREE_TYPE (*ics)); ! *ics = TREE_OPERAND (*ics, 0); return type; } --- 4825,4835 ---- { if (TREE_CODE (*ics) == REF_BIND) { ! tree old_ics = *ics; ! tree type = TREE_TYPE (TREE_TYPE (old_ics)); ! *ics = TREE_OPERAND (old_ics, 0); ! ICS_USER_FLAG (*ics) = ICS_USER_FLAG (old_ics); ! ICS_BAD_FLAG (*ics) = ICS_BAD_FLAG (old_ics); return type; } *************** source_type (t) *** 5132,5138 **** || TREE_CODE (t) == IDENTITY_CONV) return TREE_TYPE (t); } ! my_friendly_abort (1823); } /* Note a warning about preferring WINNER to LOSER. We do this by storing --- 5191,5197 ---- || TREE_CODE (t) == IDENTITY_CONV) return TREE_TYPE (t); } ! abort (); } /* Note a warning about preferring WINNER to LOSER. We do this by storing *************** static void *** 5143,5149 **** add_warning (winner, loser) struct z_candidate *winner, *loser; { ! winner->warnings = tree_cons (NULL_PTR, build_ptr_wrapper (loser), winner->warnings); } --- 5202,5208 ---- add_warning (winner, loser) struct z_candidate *winner, *loser; { ! winner->warnings = tree_cons (NULL_TREE, build_ptr_wrapper (loser), winner->warnings); } *************** joust (cand1, cand2, warn) *** 5216,5222 **** --len; } else ! my_friendly_abort (42); } for (i = 0; i < len; ++i) --- 5275,5281 ---- --len; } else ! abort (); } for (i = 0; i < len; ++i) *************** joust (cand1, cand2, warn) *** 5251,5259 **** if (warn) { ! cp_warning ("passing `%T' chooses `%T' over `%T'", type, type1, type2); ! cp_warning (" in call to `%D'", w->fn); } else add_warning (w, l); --- 5310,5318 ---- if (warn) { ! warning ("passing `%T' chooses `%T' over `%T'", type, type1, type2); ! warning (" in call to `%D'", w->fn); } else add_warning (w, l); *************** joust (cand1, cand2, warn) *** 5302,5311 **** tree source = source_type (TREE_VEC_ELT (w->convs, 0)); if (! DECL_CONSTRUCTOR_P (w->fn)) source = TREE_TYPE (source); ! cp_warning ("choosing `%D' over `%D'", w->fn, l->fn); ! cp_warning (" for conversion from `%T' to `%T'", source, TREE_TYPE (w->second_conv)); ! cp_warning (" because conversion sequence for the argument is better"); } else add_warning (w, l); --- 5361,5370 ---- 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); *************** joust (cand1, cand2, warn) *** 5334,5370 **** winner = more_specialized (TI_TEMPLATE (cand1->template), TI_TEMPLATE (cand2->template), DEDUCE_ORDER, ! /* Tell the deduction code how many real function arguments ! we saw, not counting the implicit 'this' argument. But, ! add_function_candidate() suppresses the "this" argument ! for constructors. ! ! [temp.func.order]: The presence of unused ellipsis and default ! arguments has no effect on the partial ordering of function ! templates. */ TREE_VEC_LENGTH (cand1->convs) ! - (DECL_NONSTATIC_MEMBER_FUNCTION_P (cand1->fn) ! -DECL_CONSTRUCTOR_P (cand1->fn))); if (winner) return winner; } - /* a non-template user function is better than a builtin. (Pedantically - the builtin which matched the user function should not be added to - the overload set, but we spot it here. - - [over.match.oper] - ... the builtin candidates include ... - - do not have the same parameter type list as any non-template - non-member candidate. */ - - if (TREE_CODE (cand1->fn) != IDENTIFIER_NODE - && TREE_CODE (cand2->fn) == IDENTIFIER_NODE) - return 1; - else if (TREE_CODE (cand1->fn) == IDENTIFIER_NODE - && TREE_CODE (cand2->fn) != IDENTIFIER_NODE) - return -1; - /* or, if not that, the context is an initialization by user-defined conversion (see _dcl.init_ and _over.match.user_) and the standard conversion --- 5393,5414 ---- winner = more_specialized (TI_TEMPLATE (cand1->template), TI_TEMPLATE (cand2->template), DEDUCE_ORDER, ! /* Tell the deduction code how many real function arguments ! we saw, not counting the implicit 'this' argument. But, ! add_function_candidate() suppresses the "this" argument ! for constructors. ! ! [temp.func.order]: The presence of unused ellipsis and default ! arguments has no effect on the partial ordering of function ! templates. */ TREE_VEC_LENGTH (cand1->convs) ! - (DECL_NONSTATIC_MEMBER_FUNCTION_P (cand1->fn) ! - DECL_CONSTRUCTOR_P (cand1->fn))); ! /* HERE */ if (winner) return winner; } /* or, if not that, the context is an initialization by user-defined conversion (see _dcl.init_ and _over.match.user_) and the standard conversion *************** joust (cand1, cand2, warn) *** 5380,5413 **** return winner; } ! /* If the built-in candidates are the same, arbitrarily pick one. */ ! if (cand1->fn == cand2->fn ! && TREE_CODE (cand1->fn) == IDENTIFIER_NODE) { for (i = 0; i < len; ++i) if (!same_type_p (TREE_TYPE (TREE_VEC_ELT (cand1->convs, i)), TREE_TYPE (TREE_VEC_ELT (cand2->convs, i)))) break; if (i == TREE_VEC_LENGTH (cand1->convs)) - return 1; - - /* Kludge around broken overloading rules whereby - Integer a, b; test ? a : b; is ambiguous, since there's a builtin - that takes references and another that takes values. */ - if (cand1->fn == ansi_opname (COND_EXPR)) { ! tree c1 = TREE_VEC_ELT (cand1->convs, 1); ! tree c2 = TREE_VEC_ELT (cand2->convs, 1); ! tree t1 = strip_top_quals (non_reference (TREE_TYPE (c1))); ! tree t2 = strip_top_quals (non_reference (TREE_TYPE (c2))); ! ! if (same_type_p (t1, t2)) ! { ! if (TREE_CODE (c1) == REF_BIND && TREE_CODE (c2) != REF_BIND) ! return 1; ! if (TREE_CODE (c1) != REF_BIND && TREE_CODE (c2) == REF_BIND) ! return -1; ! } } } --- 5424,5458 ---- return winner; } ! /* Check whether we can discard a builtin candidate, either because we ! have two identical ones or matching builtin and non-builtin candidates. ! ! (Pedantically in the latter case the builtin which matched the user ! function should not be added to the overload set, but we spot it here. ! ! [over.match.oper] ! ... the builtin candidates include ... ! - do not have the same parameter type list as any non-template ! non-member candidate. */ ! ! if (TREE_CODE (cand1->fn) == IDENTIFIER_NODE ! || TREE_CODE (cand2->fn) == IDENTIFIER_NODE) { for (i = 0; i < len; ++i) if (!same_type_p (TREE_TYPE (TREE_VEC_ELT (cand1->convs, i)), TREE_TYPE (TREE_VEC_ELT (cand2->convs, i)))) break; if (i == TREE_VEC_LENGTH (cand1->convs)) { ! if (cand1->fn == cand2->fn) ! /* Two built-in candidates; arbitrarily pick one. */ ! return 1; ! else if (TREE_CODE (cand1->fn) == IDENTIFIER_NODE) ! /* cand1 is built-in; prefer cand2. */ ! return -1; ! else ! /* cand2 is built-in; prefer cand1. */ ! return 1; } } *************** tweak: *** 5424,5430 **** if (!pedantic) { int rank1 = IDENTITY_RANK, rank2 = IDENTITY_RANK; ! struct z_candidate *w, *l; for (i = 0; i < len; ++i) { --- 5469,5475 ---- if (!pedantic) { int rank1 = IDENTITY_RANK, rank2 = IDENTITY_RANK; ! struct z_candidate *w = 0, *l = 0; for (i = 0; i < len; ++i) { *************** tweak: *** 5441,5448 **** { if (warn) { ! cp_pedwarn ("choosing `%D' over `%D'", w->fn, l->fn); ! cp_pedwarn ( " because worst conversion for the former is better than worst conversion for the latter"); } else --- 5486,5493 ---- { if (warn) { ! pedwarn ("choosing `%D' over `%D'", w->fn, l->fn); ! pedwarn ( " because worst conversion for the former is better than worst conversion for the latter"); } else *************** can_convert_arg (to, from, arg) *** 5530,5536 **** return (t && ! ICS_BAD_FLAG (t)); } ! /* Convert EXPR to TYPE. Return the converted expression. */ tree perform_implicit_conversion (type, expr) --- 5575,5595 ---- return (t && ! ICS_BAD_FLAG (t)); } ! /* Like can_convert_arg, but allows dubious conversions as well. */ ! ! int ! can_convert_arg_bad (to, from, arg) ! tree to, from, arg; ! { ! tree t = implicit_conversion (to, from, arg, LOOKUP_NORMAL); ! return !!t; ! } ! ! /* Convert EXPR to TYPE. Return the converted expression. ! ! Note that we allow bad conversions here because by the time we get to ! this point we are committed to doing the conversion. If we end up ! doing a bad conversion, convert_like will complain. */ tree perform_implicit_conversion (type, expr) *************** perform_implicit_conversion (type, expr) *** 5543,5551 **** return error_mark_node; conv = implicit_conversion (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL); ! if (!conv || ICS_BAD_FLAG (conv)) { ! cp_error ("could not convert `%E' to `%T'", expr, type); return error_mark_node; } --- 5602,5610 ---- return error_mark_node; conv = implicit_conversion (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL); ! if (!conv) { ! error ("could not convert `%E' to `%T'", expr, type); return error_mark_node; } *************** initialize_reference (type, expr) *** 5566,5572 **** conv = reference_binding (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL); if (!conv || ICS_BAD_FLAG (conv)) { ! cp_error ("could not convert `%E' to `%T'", expr, type); return error_mark_node; } --- 5625,5631 ---- conv = reference_binding (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL); if (!conv || ICS_BAD_FLAG (conv)) { ! error ("could not convert `%E' to `%T'", expr, type); return error_mark_node; } diff -Nrc3pad gcc-3.0.4/gcc/cp/class.c gcc-3.1/gcc/cp/class.c *** gcc-3.0.4/gcc/cp/class.c Thu Jan 3 11:39:44 2002 --- gcc-3.1/gcc/cp/class.c Tue Apr 30 21:53:02 2002 *************** *** 1,6 **** /* Functions related to building classes and their related objects. Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, ! 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. --- 1,6 ---- /* 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. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. *************** Boston, MA 02111-1307, USA. */ *** 33,38 **** --- 33,39 ---- #include "toplev.h" #include "ggc.h" #include "lex.h" + #include "target.h" #include "obstack.h" #define obstack_chunk_alloc xmalloc *************** varray_type local_classes; *** 106,118 **** static tree get_vfield_name PARAMS ((tree)); static void finish_struct_anon PARAMS ((tree)); - static tree build_vbase_pointer PARAMS ((tree, tree)); static tree build_vtable_entry PARAMS ((tree, tree, tree)); static tree get_vtable_name PARAMS ((tree)); static tree get_basefndecls PARAMS ((tree, tree)); static int build_primary_vtable PARAMS ((tree, tree)); static int build_secondary_vtable PARAMS ((tree, tree)); - static tree dfs_finish_vtbls PARAMS ((tree, void *)); static void finish_vtbls PARAMS ((tree)); static void modify_vtable_entry PARAMS ((tree, tree, tree, tree, tree *)); static void add_virtual_function PARAMS ((tree *, tree *, int *, tree, tree)); --- 107,117 ---- *************** static tree add_implicitly_declared_memb *** 134,140 **** static tree fixed_type_or_null PARAMS ((tree, int *, int *)); static tree resolve_address_of_overloaded_function PARAMS ((tree, tree, int, int, int, tree)); ! static void build_vtable_entry_ref PARAMS ((tree, 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)); --- 133,140 ---- static tree fixed_type_or_null PARAMS ((tree, int *, int *)); static tree resolve_address_of_overloaded_function PARAMS ((tree, tree, int, int, int, tree)); ! static tree build_vtable_entry_ref PARAMS ((tree, tree, tree)); ! static tree build_vtbl_ref_1 PARAMS ((tree, tree)); static tree build_vtbl_initializer PARAMS ((tree, tree, tree, tree, int *)); static int count_fields PARAMS ((tree)); static int add_fields_to_vec PARAMS ((tree, tree, int)); *************** static bool build_base_field PARAMS ((re *** 146,154 **** splay_tree, tree)); static bool build_base_fields PARAMS ((record_layout_info, int *, splay_tree, tree)); - static tree build_vbase_pointer_fields PARAMS ((record_layout_info, int *)); - static tree build_vtbl_or_vbase_field PARAMS ((tree, tree, tree, tree, tree, - int *)); static void check_methods PARAMS ((tree)); static void remove_zero_width_bit_fields PARAMS ((tree)); static void check_bases PARAMS ((tree, int *, int *, int *)); --- 146,151 ---- *************** static int layout_conflict_p PARAMS ((tr *** 217,228 **** static int splay_tree_compare_integer_csts PARAMS ((splay_tree_key k1, splay_tree_key k2)); static void warn_about_ambiguous_direct_bases PARAMS ((tree)); /* Macros for dfs walking during vtt construction. See dfs_ctor_vtable_bases_queue_p, dfs_build_secondary_vptr_vtt_inits and dfs_fixup_binfo_vtbls. */ ! #define VTT_TOP_LEVEL_P(node) TREE_UNSIGNED(node) ! #define VTT_MARKED_BINFO_P(node) TREE_USED(node) /* Variables shared between class.c and call.c. */ --- 214,226 ---- static int splay_tree_compare_integer_csts PARAMS ((splay_tree_key k1, splay_tree_key k2)); static void warn_about_ambiguous_direct_bases PARAMS ((tree)); + static bool type_requires_array_cookie PARAMS ((tree)); /* Macros for dfs walking during vtt construction. See dfs_ctor_vtable_bases_queue_p, dfs_build_secondary_vptr_vtt_inits and dfs_fixup_binfo_vtbls. */ ! #define VTT_TOP_LEVEL_P(NODE) TREE_UNSIGNED (NODE) ! #define VTT_MARKED_BINFO_P(NODE) TREE_USED (NODE) /* Variables shared between class.c and call.c. */ *************** int n_build_method_call = 0; *** 237,549 **** int n_inner_fields_searched = 0; #endif ! /* Virtual base class layout. */ ! ! /* Returns a list of virtual base class pointers as a chain of ! FIELD_DECLS. */ ! static tree ! build_vbase_pointer_fields (rli, empty_p) ! record_layout_info rli; ! int *empty_p; { ! /* Chain to hold all the new FIELD_DECLs which point at virtual ! base classes. */ ! tree rec = rli->t; ! tree vbase_decls = NULL_TREE; ! tree binfos = TYPE_BINFO_BASETYPES (rec); ! int n_baseclasses = CLASSTYPE_N_BASECLASSES (rec); ! tree decl; ! int i; ! /* Under the new ABI, there are no vbase pointers in the object. ! Instead, the offsets are stored in the vtable. */ ! if (vbase_offsets_in_vtable_p ()) ! return NULL_TREE; ! /* Loop over the baseclasses, adding vbase pointers as needed. */ ! for (i = 0; i < n_baseclasses; i++) { ! register tree base_binfo = TREE_VEC_ELT (binfos, i); ! register tree basetype = BINFO_TYPE (base_binfo); ! ! if (!COMPLETE_TYPE_P (basetype)) ! /* This error is now reported in xref_tag, thus giving better ! location information. */ ! continue; ! ! /* All basetypes are recorded in the association list of the ! derived type. */ ! ! if (TREE_VIA_VIRTUAL (base_binfo)) ! { ! int j; ! const char *name; ! ! /* The offset for a virtual base class is only used in computing ! virtual function tables and for initializing virtual base ! pointers. It is built once `get_vbase_types' is called. */ ! ! /* If this basetype can come from another vbase pointer ! without an additional indirection, we will share ! that pointer. If an indirection is involved, we ! make our own pointer. */ ! for (j = 0; j < n_baseclasses; j++) ! { ! tree other_base_binfo = TREE_VEC_ELT (binfos, j); ! if (! TREE_VIA_VIRTUAL (other_base_binfo) ! && binfo_for_vbase (basetype, BINFO_TYPE (other_base_binfo))) ! goto got_it; ! } ! FORMAT_VBASE_NAME (name, basetype); ! decl = build_vtbl_or_vbase_field (get_identifier (name), ! get_identifier (VTABLE_BASE), ! build_pointer_type (basetype), ! rec, ! basetype, ! empty_p); ! BINFO_VPTR_FIELD (base_binfo) = decl; ! TREE_CHAIN (decl) = vbase_decls; ! place_field (rli, decl); ! vbase_decls = decl; ! *empty_p = 0; ! ! got_it: ! /* The space this decl occupies has already been accounted for. */ ! ; ! } } ! return vbase_decls; ! } ! ! /* Returns a pointer to the virtual base class of EXP that has the ! indicated TYPE. EXP is of class type, not a pointer type. */ ! ! static tree ! build_vbase_pointer (exp, type) ! tree exp, type; ! { ! if (vbase_offsets_in_vtable_p ()) ! { ! tree vbase; ! tree vbase_ptr; ! ! /* Find the shared copy of TYPE; that's where the vtable offset ! is recorded. */ ! vbase = binfo_for_vbase (type, TREE_TYPE (exp)); ! /* Find the virtual function table pointer. */ ! vbase_ptr = build_vfield_ref (exp, TREE_TYPE (exp)); ! /* Compute the location where the offset will lie. */ ! vbase_ptr = build (PLUS_EXPR, ! TREE_TYPE (vbase_ptr), ! vbase_ptr, ! BINFO_VPTR_FIELD (vbase)); ! vbase_ptr = build1 (NOP_EXPR, ! build_pointer_type (ptrdiff_type_node), ! vbase_ptr); ! /* Add the contents of this location to EXP. */ ! return build (PLUS_EXPR, ! build_pointer_type (type), ! build_unary_op (ADDR_EXPR, exp, /*noconvert=*/0), ! build1 (INDIRECT_REF, ptrdiff_type_node, vbase_ptr)); ! } ! else { ! char *name; ! FORMAT_VBASE_NAME (name, type); ! return build_component_ref (exp, get_identifier (name), NULL_TREE, 0); } - } - - /* Build multi-level access to EXPR using hierarchy path PATH. - CODE is PLUS_EXPR if we are going with the grain, - and MINUS_EXPR if we are not (in which case, we cannot traverse - virtual baseclass links). - - TYPE is the type we want this path to have on exit. - NONNULL is non-zero if we know (for any reason) that EXPR is - not, in fact, zero. */ - - tree - build_vbase_path (code, type, expr, path, nonnull) - enum tree_code code; - tree type, expr, path; - int nonnull; - { - register int changed = 0; - tree last = NULL_TREE, last_virtual = NULL_TREE; - int fixed_type_p; - tree null_expr = 0, nonnull_expr; - tree basetype; - tree offset = integer_zero_node; - - if (BINFO_INHERITANCE_CHAIN (path) == NULL_TREE) - return build1 (NOP_EXPR, type, expr); - - /* We could do better if we had additional logic to convert back to the - unconverted type (the static type of the complete object), and then - convert back to the type we want. Until that is done, we only optimize - if the complete type is the same type as expr has. */ fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull); ! if (fixed_type_p < 0) ! /* Virtual base layout is not fixed, even in ctors and dtors. */ ! fixed_type_p = 0; ! ! if (!fixed_type_p && TREE_SIDE_EFFECTS (expr)) expr = save_expr (expr); - nonnull_expr = expr; ! path = reverse_path (path); ! ! basetype = BINFO_TYPE (path); ! ! while (path) { ! if (TREE_VIA_VIRTUAL (TREE_VALUE (path))) ! { ! last_virtual = BINFO_TYPE (TREE_VALUE (path)); ! if (code == PLUS_EXPR) ! { ! changed = ! fixed_type_p; ! ! if (changed) ! { ! tree ind; ! ! /* We already check for ambiguous things in the caller, just ! find a path. */ ! if (last) ! { ! tree binfo = get_binfo (last, TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (nonnull_expr))), 0); ! nonnull_expr = convert_pointer_to_real (binfo, nonnull_expr); ! } ! ind = build_indirect_ref (nonnull_expr, NULL_PTR); ! nonnull_expr = build_vbase_pointer (ind, last_virtual); ! if (nonnull == 0 ! && TREE_CODE (type) == POINTER_TYPE ! && null_expr == NULL_TREE) ! { ! null_expr = build1 (NOP_EXPR, build_pointer_type (last_virtual), integer_zero_node); ! expr = build (COND_EXPR, build_pointer_type (last_virtual), ! build (EQ_EXPR, boolean_type_node, expr, ! integer_zero_node), ! null_expr, nonnull_expr); ! } ! } ! /* else we'll figure out the offset below. */ ! /* Happens in the case of parse errors. */ ! if (nonnull_expr == error_mark_node) ! return error_mark_node; ! } ! else ! { ! cp_error ("cannot cast up from virtual baseclass `%T'", ! last_virtual); ! return error_mark_node; ! } ! } ! last = TREE_VALUE (path); ! path = TREE_CHAIN (path); ! } ! /* LAST is now the last basetype assoc on the path. */ ! /* A pointer to a virtual base member of a non-null object ! is non-null. Therefore, we only need to test for zeroness once. ! Make EXPR the canonical expression to deal with here. */ ! if (null_expr) ! { ! TREE_OPERAND (expr, 2) = nonnull_expr; ! TREE_TYPE (expr) = TREE_TYPE (TREE_OPERAND (expr, 1)) ! = TREE_TYPE (nonnull_expr); } - else - expr = nonnull_expr; ! /* If we go through any virtual base pointers, make sure that ! casts to BASETYPE from the last virtual base class use ! the right value for BASETYPE. */ ! if (changed) ! { ! tree intype = TREE_TYPE (TREE_TYPE (expr)); ! if (TYPE_MAIN_VARIANT (intype) != BINFO_TYPE (last)) ! offset ! = BINFO_OFFSET (get_binfo (last, TYPE_MAIN_VARIANT (intype), 0)); ! } else ! offset = BINFO_OFFSET (last); ! ! if (! integer_zerop (offset)) ! { ! /* Bash types to make the backend happy. */ ! offset = cp_convert (type, offset); ! ! /* If expr might be 0, we need to preserve that zeroness. */ ! if (nonnull == 0) ! { ! if (null_expr) ! TREE_TYPE (null_expr) = type; ! else ! null_expr = build1 (NOP_EXPR, type, integer_zero_node); ! if (TREE_SIDE_EFFECTS (expr)) ! expr = save_expr (expr); ! return build (COND_EXPR, type, ! build (EQ_EXPR, boolean_type_node, expr, integer_zero_node), ! null_expr, ! build (code, type, expr, offset)); ! } ! else return build (code, type, expr, offset); ! } ! /* Cannot change the TREE_TYPE of a NOP_EXPR here, since it may ! be used multiple times in initialization of multiple inheritance. */ ! if (null_expr) ! { ! TREE_TYPE (expr) = type; ! return expr; ! } ! else ! return build1 (NOP_EXPR, type, expr); } /* Virtual function things. */ ! /* We want to give the assembler the vtable identifier as well as ! the offset to the function pointer. So we generate ! __asm__ __volatile__ (".vtable_entry %c0, %c1" ! : : "s"(&class_vtable), ! "i"((long)&vtbl[idx].pfn - (long)&vtbl[0])); */ ! static void ! build_vtable_entry_ref (basetype, vtbl, idx) ! tree basetype, vtbl, idx; ! { ! static char asm_stmt[] = ".vtable_entry %c0, %c1"; ! tree s, i, i2; ! s = build_unary_op (ADDR_EXPR, ! get_vtbl_decl_for_binfo (TYPE_BINFO (basetype)), ! 0); ! s = build_tree_list (build_string (1, "s"), s); ! i = build_array_ref (vtbl, idx); ! if (!flag_vtable_thunks) ! i = build_component_ref (i, pfn_identifier, vtable_entry_type, 0); ! i = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i, 0)); ! i2 = build_array_ref (vtbl, build_int_2(0,0)); ! i2 = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i2, 0)); ! i = cp_build_binary_op (MINUS_EXPR, i, i2); ! i = build_tree_list (build_string (1, "i"), i); ! finish_asm_stmt (ridpointers[RID_VOLATILE], ! build_string (sizeof(asm_stmt)-1, asm_stmt), ! NULL_TREE, chainon (s, i), NULL_TREE); } /* Given an object INSTANCE, return an expression which yields the --- 235,395 ---- int n_inner_fields_searched = 0; #endif ! /* Convert to or from a base subobject. EXPR is an expression of type ! `A' or `A*', an expression of type `B' or `B*' is returned. To ! convert A to a base B, CODE is PLUS_EXPR and BINFO is the binfo for ! the B base instance within A. To convert base A to derived B, CODE ! is MINUS_EXPR and BINFO is the binfo for the A instance within B. ! In this latter case, A must not be a morally virtual base of B. ! NONNULL is true if EXPR is known to be non-NULL (this is only ! needed when EXPR is of pointer type). CV qualifiers are preserved ! from EXPR. */ ! tree ! build_base_path (code, expr, binfo, nonnull) ! enum tree_code code; ! tree expr; ! tree binfo; ! int nonnull; { ! tree v_binfo = NULL_TREE; ! tree d_binfo = NULL_TREE; ! tree probe; ! tree offset; ! tree target_type; ! tree null_test = NULL; ! tree ptr_target_type; ! int fixed_type_p; ! int want_pointer = TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE; ! if (expr == error_mark_node || binfo == error_mark_node || !binfo) ! return error_mark_node; ! for (probe = binfo; probe; probe = BINFO_INHERITANCE_CHAIN (probe)) { ! d_binfo = probe; ! if (!v_binfo && TREE_VIA_VIRTUAL (probe)) ! v_binfo = probe; } ! probe = TYPE_MAIN_VARIANT (TREE_TYPE (expr)); ! if (want_pointer) ! probe = TYPE_MAIN_VARIANT (TREE_TYPE (probe)); ! ! my_friendly_assert (code == MINUS_EXPR ! ? same_type_p (BINFO_TYPE (binfo), probe) ! : code == PLUS_EXPR ! ? same_type_p (BINFO_TYPE (d_binfo), probe) ! : false, 20010723); ! ! if (code == MINUS_EXPR && v_binfo) { ! error ("cannot convert from base `%T' to derived type `%T' via virtual base `%T'", ! BINFO_TYPE (binfo), BINFO_TYPE (d_binfo), BINFO_TYPE (v_binfo)); ! return error_mark_node; } fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull); ! if (fixed_type_p <= 0 && TREE_SIDE_EFFECTS (expr)) expr = save_expr (expr); ! if (!want_pointer) ! expr = build_unary_op (ADDR_EXPR, expr, 0); ! else if (!nonnull) ! null_test = build (EQ_EXPR, boolean_type_node, expr, integer_zero_node); ! ! offset = BINFO_OFFSET (binfo); ! ! if (v_binfo && fixed_type_p <= 0) { ! /* Going via virtual base V_BINFO. We need the static offset ! from V_BINFO to BINFO, and the dynamic offset from D_BINFO to ! V_BINFO. That offset is an entry in D_BINFO's vtable. */ ! tree v_offset = build_vfield_ref (build_indirect_ref (expr, NULL), ! TREE_TYPE (TREE_TYPE (expr))); ! ! v_binfo = binfo_for_vbase (BINFO_TYPE (v_binfo), BINFO_TYPE (d_binfo)); ! ! v_offset = build (PLUS_EXPR, TREE_TYPE (v_offset), ! v_offset, BINFO_VPTR_FIELD (v_binfo)); ! v_offset = build1 (NOP_EXPR, ! build_pointer_type (ptrdiff_type_node), ! v_offset); ! v_offset = build_indirect_ref (v_offset, NULL); ! ! offset = cp_convert (ptrdiff_type_node, ! size_diffop (offset, BINFO_OFFSET (v_binfo))); ! if (!integer_zerop (offset)) ! v_offset = build (code, ptrdiff_type_node, v_offset, offset); ! if (fixed_type_p < 0) ! /* Negative fixed_type_p means this is a constructor or destructor; ! virtual base layout is fixed in in-charge [cd]tors, but not in ! base [cd]tors. */ ! offset = build (COND_EXPR, ptrdiff_type_node, ! build (EQ_EXPR, boolean_type_node, ! current_in_charge_parm, integer_zero_node), ! v_offset, ! BINFO_OFFSET (binfo)); ! else ! offset = v_offset; } ! target_type = code == PLUS_EXPR ? BINFO_TYPE (binfo) : BINFO_TYPE (d_binfo); ! ! target_type = cp_build_qualified_type ! (target_type, cp_type_quals (TREE_TYPE (TREE_TYPE (expr)))); ! ptr_target_type = build_pointer_type (target_type); ! if (want_pointer) ! target_type = ptr_target_type; ! ! expr = build1 (NOP_EXPR, ptr_target_type, expr); ! if (!integer_zerop (offset)) ! expr = build (code, ptr_target_type, expr, offset); else ! null_test = NULL; ! ! if (!want_pointer) ! expr = build_indirect_ref (expr, NULL); ! if (null_test) ! expr = build (COND_EXPR, target_type, null_test, ! build1 (NOP_EXPR, target_type, integer_zero_node), ! expr); ! return expr; } /* Virtual function things. */ ! 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 *************** build_vtable_entry_ref (basetype, vtbl, *** 551,558 **** cases for INSTANCE which we take care of here, mainly to avoid creating extra tree nodes when we don't have to. */ ! tree ! build_vtbl_ref (instance, idx) tree instance, idx; { tree vtbl, aref; --- 397,404 ---- 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; { tree vtbl, aref; *************** build_vtbl_ref (instance, idx) *** 603,610 **** { vtbl = TYPE_BINFO_VTABLE (basetype); /* Knowing the dynamic type of INSTANCE we can easily obtain ! the correct vtable entry. In the new ABI, we resolve ! this back to be in terms of the primary vtable. */ if (TREE_CODE (vtbl) == PLUS_EXPR) { idx = fold (build (PLUS_EXPR, --- 449,456 ---- { vtbl = TYPE_BINFO_VTABLE (basetype); /* Knowing the dynamic type of INSTANCE we can easily obtain ! the correct vtable entry. We resolve this back to be in ! terms of the primary vtable. */ if (TREE_CODE (vtbl) == PLUS_EXPR) { idx = fold (build (PLUS_EXPR, *************** build_vtbl_ref (instance, idx) *** 623,676 **** assemble_external (vtbl); - if (flag_vtable_gc) - build_vtable_entry_ref (basetype, vtbl, idx); - aref = build_array_ref (vtbl, idx); return aref; } - /* Given an object INSTANCE, return an expression which yields the - virtual function corresponding to INDEX. There are many special - cases for INSTANCE which we take care of here, mainly to avoid - creating extra tree nodes when we don't have to. */ - tree ! build_vfn_ref (ptr_to_instptr, instance, idx) ! tree *ptr_to_instptr, instance; ! tree idx; { ! tree aref = build_vtbl_ref (instance, idx); ! /* When using thunks, there is no extra delta, and we get the pfn ! directly. */ ! if (flag_vtable_thunks) ! { ! /* When using function descriptors, the address of the ! vtable entry is treated as a function pointer. */ ! if (TARGET_VTABLE_USES_DESCRIPTORS) ! return build1 (NOP_EXPR, TREE_TYPE (aref), ! build_unary_op (ADDR_EXPR, aref, /*noconvert=*/1)); ! return aref; ! } ! if (ptr_to_instptr) ! { ! /* Save the intermediate result in a SAVE_EXPR so we don't have to ! compute each component of the virtual function pointer twice. */ ! if (TREE_CODE (aref) == INDIRECT_REF) ! TREE_OPERAND (aref, 0) = save_expr (TREE_OPERAND (aref, 0)); ! *ptr_to_instptr ! = build (PLUS_EXPR, TREE_TYPE (*ptr_to_instptr), ! *ptr_to_instptr, ! cp_convert (ptrdiff_type_node, ! build_component_ref (aref, delta_identifier, NULL_TREE, 0))); ! } ! return build_component_ref (aref, pfn_identifier, NULL_TREE, 0); } /* Return the name of the virtual function table (as an IDENTIFIER_NODE) --- 469,510 ---- assemble_external (vtbl); aref = build_array_ref (vtbl, idx); return aref; } tree ! build_vtbl_ref (instance, idx) ! tree instance, idx; { ! tree aref = build_vtbl_ref_1 (instance, idx); ! if (flag_vtable_gc) ! aref = build_vtable_entry_ref (aref, instance, idx); ! return aref; ! } ! /* Given an object INSTANCE, return an expression which yields a ! function pointer corresponding to vtable element INDEX. */ ! tree ! build_vfn_ref (instance, idx) ! tree instance, idx; ! { ! tree aref = build_vtbl_ref_1 (instance, idx); ! /* When using function descriptors, the address of the ! vtable entry is treated as a function pointer. */ ! if (TARGET_VTABLE_USES_DESCRIPTORS) ! aref = build1 (NOP_EXPR, TREE_TYPE (aref), ! build_unary_op (ADDR_EXPR, aref, /*noconvert=*/1)); ! ! if (flag_vtable_gc) ! aref = build_vtable_entry_ref (aref, instance, idx); ! ! return aref; } /* Return the name of the virtual function table (as an IDENTIFIER_NODE) *************** build_primary_vtable (binfo, type) *** 826,840 **** return 1; } ! /* Give TYPE a new virtual function table which is initialized with a skeleton-copy of its original initialization. The only entry that changes is the `delta' entry, so we can really share a lot of structure. ! FOR_TYPE is the derived type which caused this table to be needed. ! BINFO is the type association which provided TYPE for FOR_TYPE. The order in which vtables are built (by calling this function) for an object must remain the same, otherwise a binary incompatibility --- 660,674 ---- return 1; } ! /* Give BINFO a new virtual function table which is initialized with a skeleton-copy of its original initialization. The only entry that changes is the `delta' entry, so we can really share a lot of structure. ! FOR_TYPE is the most derived type which caused this table to be needed. ! Returns non-zero if we haven't met BINFO before. The order in which vtables are built (by calling this function) for an object must remain the same, otherwise a binary incompatibility *************** static int *** 844,986 **** build_secondary_vtable (binfo, for_type) tree binfo, for_type; { ! tree basetype; ! tree orig_decl = BINFO_VTABLE (binfo); ! tree name; ! tree new_decl; ! tree offset; ! tree path = binfo; ! char *buf; ! const char *buf2; ! char joiner = '_'; ! int i; ! ! #ifdef JOINER ! joiner = JOINER; ! #endif ! ! if (TREE_VIA_VIRTUAL (binfo)) ! my_friendly_assert (binfo == binfo_for_vbase (BINFO_TYPE (binfo), ! current_class_type), ! 170); ! if (BINFO_NEW_VTABLE_MARKED (binfo, current_class_type)) /* We already created a vtable for this base. There's no need to do it again. */ return 0; /* Remember that we've created a vtable for this BINFO, so that we don't try to do so again. */ ! SET_BINFO_NEW_VTABLE_MARKED (binfo, current_class_type); /* Make fresh virtual list, so we can smash it later. */ BINFO_VIRTUALS (binfo) = copy_virtuals (binfo); ! my_friendly_assert (binfo == CANONICAL_BINFO (binfo, for_type), 20010605); ! offset = BINFO_OFFSET (binfo); ! ! /* In the new ABI, secondary vtables are laid out as part of the ! same structure as the primary vtable. */ ! if (merge_primary_and_secondary_vtables_p ()) ! { ! BINFO_VTABLE (binfo) = NULL_TREE; ! return 1; ! } ! ! /* Create the declaration for the secondary vtable. */ ! basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (binfo)); ! buf2 = TYPE_ASSEMBLER_NAME_STRING (basetype); ! i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1; ! ! /* We know that the vtable that we are going to create doesn't exist ! yet in the global namespace, and when we finish, it will be ! pushed into the global namespace. In complex MI hierarchies, we ! have to loop while the name we are thinking of adding is globally ! defined, adding more name components to the vtable name as we ! loop, until the name is unique. This is because in complex MI ! cases, we might have the same base more than once. This means ! that the order in which this function is called for vtables must ! remain the same, otherwise binary compatibility can be ! compromised. */ ! ! while (1) ! { ! char *buf1 = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (for_type) ! + 1 + i); ! char *new_buf2; ! ! sprintf (buf1, "%s%c%s", TYPE_ASSEMBLER_NAME_STRING (for_type), joiner, ! buf2); ! buf = (char *) alloca (strlen (VTABLE_NAME_PREFIX) + strlen (buf1) + 1); ! sprintf (buf, "%s%s", VTABLE_NAME_PREFIX, buf1); ! name = get_identifier (buf); ! ! /* If this name doesn't clash, then we can use it, otherwise ! we add more to the name until it is unique. */ ! ! if (! IDENTIFIER_GLOBAL_VALUE (name)) ! break; ! ! /* Set values for next loop through, if the name isn't unique. */ ! ! path = BINFO_INHERITANCE_CHAIN (path); ! ! /* We better not run out of stuff to make it unique. */ ! my_friendly_assert (path != NULL_TREE, 368); ! ! basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (path)); ! ! if (for_type == basetype) ! { ! /* If we run out of basetypes in the path, we have already ! found created a vtable with that name before, we now ! resort to tacking on _%d to distinguish them. */ ! int j = 2; ! i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i + 1 + 3; ! buf1 = (char *) alloca (i); ! do { ! sprintf (buf1, "%s%c%s%c%d", ! TYPE_ASSEMBLER_NAME_STRING (basetype), joiner, ! buf2, joiner, j); ! buf = (char *) alloca (strlen (VTABLE_NAME_PREFIX) ! + strlen (buf1) + 1); ! sprintf (buf, "%s%s", VTABLE_NAME_PREFIX, buf1); ! name = get_identifier (buf); ! ! /* If this name doesn't clash, then we can use it, ! otherwise we add something different to the name until ! it is unique. */ ! } while (++j <= 999 && IDENTIFIER_GLOBAL_VALUE (name)); ! ! /* Hey, they really like MI don't they? Increase the 3 ! above to 6, and the 999 to 999999. :-) */ ! my_friendly_assert (j <= 999, 369); ! ! break; ! } ! ! i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i; ! new_buf2 = (char *) alloca (i); ! sprintf (new_buf2, "%s%c%s", ! TYPE_ASSEMBLER_NAME_STRING (basetype), joiner, buf2); ! buf2 = new_buf2; ! } ! ! new_decl = build_vtable (for_type, name, TREE_TYPE (orig_decl)); ! DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl); ! DECL_USER_ALIGN (new_decl) = DECL_USER_ALIGN (orig_decl); ! BINFO_VTABLE (binfo) = pushdecl_top_level (new_decl); ! ! #ifdef GATHER_STATISTICS ! n_vtables += 1; ! n_vtable_elems += list_length (BINFO_VIRTUALS (binfo)); ! #endif ! return 1; } /* Create a new vtable for BINFO which is the hierarchy dominated by ! T. */ static int make_new_vtable (t, binfo) --- 678,705 ---- build_secondary_vtable (binfo, for_type) tree binfo, for_type; { ! my_friendly_assert (binfo == CANONICAL_BINFO (binfo, for_type), 20010605); ! if (BINFO_NEW_VTABLE_MARKED (binfo, for_type)) /* We already created a vtable for this base. There's no need to do it again. */ return 0; /* Remember that we've created a vtable for this BINFO, so that we don't try to do so again. */ ! SET_BINFO_NEW_VTABLE_MARKED (binfo, for_type); /* Make fresh virtual list, so we can smash it later. */ BINFO_VIRTUALS (binfo) = copy_virtuals (binfo); ! /* Secondary vtables are laid out as part of the same structure as ! the primary vtable. */ ! BINFO_VTABLE (binfo) = NULL_TREE; return 1; } /* Create a new vtable for BINFO which is the hierarchy dominated by ! T. Return non-zero if we actually created a new vtable. */ static int make_new_vtable (t, binfo) *************** add_method (type, method, error_p) *** 1194,1202 **** new_len = len + 1; new_vec = make_tree_vec (new_len); ! bcopy ((PTR) &TREE_VEC_ELT (method_vec, 0), ! (PTR) &TREE_VEC_ELT (new_vec, 0), ! len * sizeof (tree)); len = new_len; method_vec = CLASSTYPE_METHOD_VEC (type) = new_vec; } --- 913,920 ---- new_len = len + 1; new_vec = make_tree_vec (new_len); ! memcpy (&TREE_VEC_ELT (new_vec, 0), &TREE_VEC_ELT (method_vec, 0), ! len * sizeof (tree)); len = new_len; method_vec = CLASSTYPE_METHOD_VEC (type) = new_vec; } *************** add_method (type, method, error_p) *** 1233,1241 **** /* We know the last slot in the vector is empty because we know that at this point there's room for a new function. */ ! bcopy ((PTR) &TREE_VEC_ELT (method_vec, slot), ! (PTR) &TREE_VEC_ELT (method_vec, slot + 1), ! (len - slot - 1) * sizeof (tree)); TREE_VEC_ELT (method_vec, slot) = NULL_TREE; } } --- 951,959 ---- /* We know the last slot in the vector is empty because we know that at this point there's room for a new function. */ ! memmove (&TREE_VEC_ELT (method_vec, slot + 1), ! &TREE_VEC_ELT (method_vec, slot), ! (len - slot - 1) * sizeof (tree)); TREE_VEC_ELT (method_vec, slot) = NULL_TREE; } } *************** add_method (type, method, error_p) *** 1299,1305 **** /* Defer to the local function. */ return; else ! cp_error ("`%#D' and `%#D' cannot be overloaded", fn, method); } } --- 1017,1023 ---- /* Defer to the local function. */ return; else ! error ("`%#D' and `%#D' cannot be overloaded", fn, method); } } *************** delete_duplicate_fields_1 (field, fields *** 1382,1388 **** } } else if (TREE_CODE (field) == USING_DECL) ! /* A using declaration may 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. */ --- 1100,1106 ---- } } 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. */ *************** check_bases (t, cant_have_default_ctor_p *** 1631,1637 **** dtor is handled in finish_struct_1. */ if (warn_ecpp && ! TYPE_POLYMORPHIC_P (basetype) && TYPE_HAS_DESTRUCTOR (basetype)) ! cp_warning ("base class `%#T' has a non-virtual destructor", basetype); /* If the base class doesn't have copy constructors or --- 1349,1355 ---- dtor is handled in finish_struct_1. */ if (warn_ecpp && ! TYPE_POLYMORPHIC_P (basetype) && TYPE_HAS_DESTRUCTOR (basetype)) ! warning ("base class `%#T' has a non-virtual destructor", basetype); /* If the base class doesn't have copy constructors or *************** check_bases (t, cant_have_default_ctor_p *** 1651,1657 **** { *cant_have_default_ctor_p = 1; if (! TYPE_HAS_CONSTRUCTOR (t)) ! cp_pedwarn ("base `%T' with only non-default constructor in class without a constructor", basetype); } --- 1369,1375 ---- { *cant_have_default_ctor_p = 1; if (! TYPE_HAS_CONSTRUCTOR (t)) ! pedwarn ("base `%T' with only non-default constructor in class without a constructor", basetype); } *************** check_bases (t, cant_have_default_ctor_p *** 1685,1708 **** 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); - - /* Derived classes can implicitly become COMified if their bases - are COM. */ - if (CLASSTYPE_COM_INTERFACE (basetype)) - CLASSTYPE_COM_INTERFACE (t) = 1; - else if (i == 0 && CLASSTYPE_COM_INTERFACE (t)) - { - cp_error - ("COM interface type `%T' with non-COM leftmost base class `%T'", - t, basetype); - CLASSTYPE_COM_INTERFACE (t) = 0; - } } } ! /* Binfo FROM is within a virtual heirarchy which is being reseated to TO. Move primary information from FROM to TO, and recursively traverse ! into FROM's bases. The heirarchy is dominated by TYPE. MAPPINGS is an assoc list of binfos that have already been reseated. */ static void --- 1403,1414 ---- 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); } } ! /* 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, *** 1768,1774 **** } /* FROM is the canonical binfo for a virtual base. It is being reseated to ! make TO the canonical binfo, within the heirarchy 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 --- 1474,1480 ---- } /* 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 *************** mark_primary_virtual_base (base_binfo, t *** 1807,1813 **** if (BINFO_PRIMARY_P (shared_binfo)) { /* It's already allocated in the hierarchy. BINFO won't have a ! primary base in this hierachy, even though the complete object BINFO is for, would do. */ return NULL_TREE; } --- 1513,1519 ---- 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; } *************** determine_primary_base (t, vfuns_p) *** 1965,1973 **** if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) CLASSTYPE_RTTI (t) = CLASSTYPE_RTTI (basetype); ! /* A virtual baseclass can't be the primary base under the ! old ABI. And under the new ABI we still prefer a ! non-virtual base. */ if (TREE_VIA_VIRTUAL (base_binfo)) continue; --- 1671,1678 ---- if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) CLASSTYPE_RTTI (t) = CLASSTYPE_RTTI (basetype); ! /* We prefer a non-virtual base, although a virtual one will ! do. */ if (TREE_VIA_VIRTUAL (base_binfo)) continue; *************** determine_primary_base (t, vfuns_p) *** 2036,2044 **** } } ! /* The new ABI allows for the use of a "nearly-empty" virtual base ! class as the primary base class if no non-virtual polymorphic ! base can be found. */ if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) { /* If not NULL, this is the best primary base candidate we have --- 1741,1748 ---- } } ! /* A "nearly-empty" virtual base class can be the primary base ! class, if no non-virtual polymorphic base can be found. */ if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) { /* If not NULL, this is the best primary base candidate we have *************** finish_struct_bits (t) *** 2146,2162 **** } } ! /* If this type has a copy constructor, force its mode to be BLKmode, and ! force its TREE_ADDRESSABLE bit to be nonzero. This will cause it to ! be passed by invisible reference and prevent it from being returned in ! a register. ! ! Also do this if the class has BLKmode but can still be returned in ! registers, since function_cannot_inline_p won't let us inline ! functions returning such a type. This affects the HP-PA. */ ! if (! TYPE_HAS_TRIVIAL_INIT_REF (t) ! || (TYPE_MODE (t) == BLKmode && ! aggregate_value_p (t) ! && CLASSTYPE_NON_AGGREGATE (t))) { tree variants; DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode; --- 1850,1860 ---- } } ! /* If this type has a copy constructor or a destructor, force its mode to ! be BLKmode, and force its TREE_ADDRESSABLE bit to be nonzero. This ! will cause it to be passed by invisible reference and prevent it from ! being returned in a register. */ ! if (! TYPE_HAS_TRIVIAL_INIT_REF (t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)) { tree variants; DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode; *************** maybe_warn_about_overly_private_class (t *** 2251,2257 **** } if (!has_nonprivate_method) { ! cp_warning ("all member functions in class `%T' are private", t); return; } } --- 1949,1955 ---- } if (!has_nonprivate_method) { ! warning ("all member functions in class `%T' are private", t); return; } } *************** maybe_warn_about_overly_private_class (t *** 2265,2271 **** if (TREE_PRIVATE (dtor)) { ! cp_warning ("`%#T' only defines a private destructor and has no friends", t); return; } --- 1963,1969 ---- if (TREE_PRIVATE (dtor)) { ! warning ("`%#T' only defines a private destructor and has no friends", t); return; } *************** maybe_warn_about_overly_private_class (t *** 2308,2314 **** if (nonprivate_ctor == 0) { ! cp_warning ("`%#T' only defines private constructors and has no friends", t); return; } --- 2006,2012 ---- if (nonprivate_ctor == 0) { ! warning ("`%#T' only defines private constructors and has no friends", t); return; } *************** void *** 2429,2435 **** duplicate_tag_error (t) tree t; { ! cp_error ("redefinition of `%#T'", t); cp_error_at ("previous definition of `%#T'", t); /* Pretend we haven't defined this type. */ --- 2127,2133 ---- 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. */ *************** duplicate_tag_error (t) *** 2481,2487 **** TYPE_METHODS (t) = NULL_TREE; TYPE_VFIELD (t) = NULL_TREE; TYPE_CONTEXT (t) = NULL_TREE; - TYPE_NONCOPIED_PARTS (t) = NULL_TREE; /* Clear TYPE_LANG_FLAGS -- those in TYPE_LANG_SPECIFIC are cleared above. */ TYPE_LANG_FLAG_0 (t) = 0; --- 2179,2184 ---- *************** duplicate_tag_error (t) *** 2495,2501 **** SET_IS_AGGR_TYPE (t, 1); } ! /* Make the BINFO's vtablehave N entries, including RTTI entries, vbase and vcall offsets, etc. Set its type and call the backend to lay it out. */ --- 2192,2198 ---- SET_IS_AGGR_TYPE (t, 1); } ! /* Make BINFO's vtable have N entries, including RTTI entries, vbase and vcall offsets, etc. Set its type and call the backend to lay it out. */ *************** find_final_overrider (t, binfo, fn) *** 2761,2767 **** /* If there was no winner, issue an error message. */ if (!ffod.overriding_fn) { ! cp_error ("no unique final overrider for `%D' in `%T'", fn, t); return error_mark_node; } --- 2458,2464 ---- /* If there was no winner, issue an error message. */ if (!ffod.overriding_fn) { ! error ("no unique final overrider for `%D' in `%T'", fn, t); return error_mark_node; } *************** dfs_modify_vtables (binfo, data) *** 2921,2929 **** t = (tree) data; - /* If we're supporting RTTI then we always need a new vtable to - point to the RTTI information. Under the new ABI we may need - a new vtable to contain vcall and vbase offsets. */ make_new_vtable (t, binfo); /* Now, go through each of the virtual functions in the virtual --- 2618,2623 ---- *************** modify_all_vtables (t, vfuns_p, overridd *** 2960,2968 **** int *vfuns_p; tree overridden_virtuals; { ! tree binfo; ! ! binfo = TYPE_BINFO (t); /* Update all of the vtables. */ dfs_walk (binfo, --- 2654,2661 ---- int *vfuns_p; tree overridden_virtuals; { ! tree binfo = TYPE_BINFO (t); ! tree *fnsp; /* Update all of the vtables. */ dfs_walk (binfo, *************** modify_all_vtables (t, vfuns_p, overridd *** 2971,3029 **** t); dfs_walk (binfo, dfs_unmark, dfs_marked_real_bases_queue_p, t); ! /* If we should include overriding functions for secondary vtables ! in our primary vtable, add them now. */ ! if (all_overridden_vfuns_in_vtables_p ()) { ! tree *fnsp = &overridden_virtuals; ! while (*fnsp) { ! tree fn = TREE_VALUE (*fnsp); ! ! if (!BINFO_VIRTUALS (binfo) ! || !value_member (fn, BINFO_VIRTUALS (binfo))) ! { ! /* Set the vtable index. */ ! set_vindex (fn, vfuns_p); ! /* We don't need to convert to a base class when calling ! this function. */ ! DECL_VIRTUAL_CONTEXT (fn) = t; ! /* We don't need to adjust the `this' pointer when ! calling this function. */ ! BV_DELTA (*fnsp) = integer_zero_node; ! BV_VCALL_INDEX (*fnsp) = NULL_TREE; ! /* This is an overridden function not already in our ! vtable. Keep it. */ ! fnsp = &TREE_CHAIN (*fnsp); ! } ! else ! /* We've already got an entry for this function. Skip ! it. */ ! *fnsp = TREE_CHAIN (*fnsp); } } ! else ! overridden_virtuals = NULL_TREE; ! return overridden_virtuals; } /* Here, we already know that they match in every respect. ! All we have to check is where they had their declarations. */ static int strictly_overrides (fndecl1, fndecl2) tree fndecl1, fndecl2; { ! int distance = get_base_distance (DECL_CONTEXT (fndecl2), ! DECL_CONTEXT (fndecl1), ! 0, (tree *)0); ! if (distance == -2 || distance > 0) ! return 1; ! return 0; } /* Get the base virtual function declarations in T that have the --- 2664,2717 ---- t); dfs_walk (binfo, dfs_unmark, dfs_marked_real_bases_queue_p, t); ! /* Include overriding functions for secondary vtables in our primary ! vtable. */ ! for (fnsp = &overridden_virtuals; *fnsp; ) { ! tree fn = TREE_VALUE (*fnsp); ! if (!BINFO_VIRTUALS (binfo) ! || !value_member (fn, BINFO_VIRTUALS (binfo))) { ! /* Set the vtable index. */ ! set_vindex (fn, vfuns_p); ! /* We don't need to convert to a base class when calling ! this function. */ ! DECL_VIRTUAL_CONTEXT (fn) = t; ! /* We don't need to adjust the `this' pointer when ! calling this function. */ ! BV_DELTA (*fnsp) = integer_zero_node; ! BV_VCALL_INDEX (*fnsp) = NULL_TREE; ! /* This is an overridden function not already in our ! vtable. Keep it. */ ! fnsp = &TREE_CHAIN (*fnsp); } + else + /* We've already got an entry for this function. Skip it. */ + *fnsp = TREE_CHAIN (*fnsp); } ! return overridden_virtuals; } /* Here, we already know that they match in every respect. ! All we have to check is where they had their declarations. ! ! Return non-zero iff FNDECL1 is declared in a class which has a ! proper base class containing FNDECL2. We don't care about ! ambiguity or accessibility. */ static int strictly_overrides (fndecl1, fndecl2) tree fndecl1, fndecl2; { ! base_kind kind; ! ! return (lookup_base (DECL_CONTEXT (fndecl1), DECL_CONTEXT (fndecl2), ! ba_ignore | ba_quiet, &kind) ! && kind != bk_same_type); } /* Get the base virtual function declarations in T that have the *************** finish_struct_anon (t) *** 3182,3188 **** tree elt = TYPE_FIELDS (TREE_TYPE (field)); for (; elt; elt = TREE_CHAIN (elt)) { ! if (DECL_ARTIFICIAL (elt)) continue; if (DECL_NAME (elt) == constructor_name (t)) --- 2870,2885 ---- tree elt = TYPE_FIELDS (TREE_TYPE (field)); for (; elt; elt = TREE_CHAIN (elt)) { ! /* We're generally only interested in entities the user ! declared, but we also find nested classes by noticing ! the TYPE_DECL that we create implicitly. You're ! allowed to put one anonymous union inside another, ! though, so we explicitly tolerate that. We use ! TYPE_ANONYMOUS_P rather than ANON_AGGR_TYPE_P so that ! we also allow unnamed types used for defining fields. */ ! if (DECL_ARTIFICIAL (elt) ! && (!DECL_IMPLICIT_TYPEDEF_P (elt) ! || TYPE_ANONYMOUS_P (TREE_TYPE (elt)))) continue; if (DECL_NAME (elt) == constructor_name (t)) *************** add_implicitly_declared_members (t, cant *** 3233,3238 **** --- 2930,2937 ---- tree virtual_dtor = NULL_TREE; tree *f; + ++adding_implicit_members; + /* Destructor. */ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) && !TYPE_HAS_DESTRUCTOR (t)) { *************** add_implicitly_declared_members (t, cant *** 3292,3297 **** --- 2991,2998 ---- *f = TYPE_METHODS (t); TYPE_METHODS (t) = implicit_fns; + --adding_implicit_members; + return virtual_dtor; } *************** check_bitfield_decl (field) *** 3407,3413 **** DECL_SIZE (field) = convert (bitsizetype, w); DECL_BIT_FIELD (field) = 1; ! if (integer_zerop (w)) { #ifdef EMPTY_FIELD_BOUNDARY DECL_ALIGN (field) = MAX (DECL_ALIGN (field), --- 3108,3115 ---- 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), *************** check_field_decls (t, access_decls, empt *** 3585,3592 **** tree x = *field; tree type = TREE_TYPE (x); - GNU_xref_member (current_class_name, x); - next = &TREE_CHAIN (x); if (TREE_CODE (x) == FIELD_DECL) --- 3287,3292 ---- *************** check_field_decls (t, access_decls, empt *** 3758,3773 **** if (has_pointers && warn_ecpp && TYPE_HAS_CONSTRUCTOR (t) && ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t))) { ! cp_warning ("`%#T' has pointer data members", t); if (! TYPE_HAS_INIT_REF (t)) { ! cp_warning (" but does not override `%T(const %T&)'", t, t); if (! TYPE_HAS_ASSIGN_REF (t)) ! cp_warning (" or `operator=(const %T&)'", t); } else if (! TYPE_HAS_ASSIGN_REF (t)) ! cp_warning (" but does not override `operator=(const %T&)'", t); } --- 3458,3473 ---- if (has_pointers && warn_ecpp && TYPE_HAS_CONSTRUCTOR (t) && ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t))) { ! warning ("`%#T' has pointer data members", t); if (! TYPE_HAS_INIT_REF (t)) { ! warning (" but does not override `%T(const %T&)'", t, t); if (! TYPE_HAS_ASSIGN_REF (t)) ! warning (" or `operator=(const %T&)'", t); } else if (! TYPE_HAS_ASSIGN_REF (t)) ! warning (" but does not override `operator=(const %T&)'", t); } *************** check_field_decls (t, access_decls, empt *** 3779,3821 **** *access_decls = nreverse (*access_decls); } - /* Return a FIELD_DECL for a pointer-to-virtual-table or - pointer-to-virtual-base. The NAME, ASSEMBLER_NAME, and TYPE of the - field are as indicated. The CLASS_TYPE in which this field occurs - is also indicated. FCONTEXT is the type that is needed for the debug - info output routines. *EMPTY_P is set to a non-zero value by this - function to indicate that a class containing this field is - non-empty. */ - - static tree - build_vtbl_or_vbase_field (name, assembler_name, type, class_type, fcontext, - empty_p) - tree name; - tree assembler_name; - tree type; - tree class_type; - tree fcontext; - int *empty_p; - { - tree field; - - /* This class is non-empty. */ - *empty_p = 0; - - /* Build the FIELD_DECL. */ - field = build_decl (FIELD_DECL, name, type); - SET_DECL_ASSEMBLER_NAME (field, assembler_name); - DECL_VIRTUAL_P (field) = 1; - DECL_ARTIFICIAL (field) = 1; - DECL_FIELD_CONTEXT (field) = class_type; - DECL_FCONTEXT (field) = fcontext; - DECL_ALIGN (field) = TYPE_ALIGN (type); - DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (type); - - /* Return it. */ - return field; - } - /* If TYPE is an empty class type, records its OFFSET in the table of OFFSETS. */ --- 3479,3484 ---- *************** build_base_fields (rli, empty_p, offsets *** 4222,4229 **** int i; bool atend = 0; ! /* Under the new ABI, the primary base class is always allocated ! first. */ if (CLASSTYPE_HAS_PRIMARY_BASE_P (rec)) build_base_field (rli, CLASSTYPE_PRIMARY_BINFO (rec), empty_p, offsets, t); --- 3885,3891 ---- int i; bool atend = 0; ! /* The primary base class is always allocated first. */ if (CLASSTYPE_HAS_PRIMARY_BASE_P (rec)) build_base_field (rli, CLASSTYPE_PRIMARY_BINFO (rec), empty_p, offsets, t); *************** build_base_fields (rli, empty_p, offsets *** 4235,4242 **** base_binfo = BINFO_BASETYPE (TYPE_BINFO (rec), i); ! /* Under the new ABI, the primary base was already allocated ! above, so we don't need to allocate it again here. */ if (base_binfo == CLASSTYPE_PRIMARY_BINFO (rec)) continue; --- 3897,3904 ---- base_binfo = BINFO_BASETYPE (TYPE_BINFO (rec), i); ! /* The primary base was already allocated above, so we don't ! need to allocate it again here. */ if (base_binfo == CLASSTYPE_PRIMARY_BINFO (rec)) continue; *************** check_methods (t) *** 4261,4272 **** tree t; { tree x; - int seen_one_arg_array_delete_p = 0; for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x)) { - GNU_xref_member (current_class_name, x); - /* If this was an evil function, don't keep it in class. */ if (DECL_ASSEMBLER_NAME_SET_P (x) && IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (x))) --- 3923,3931 ---- *************** check_methods (t) *** 4285,4316 **** CLASSTYPE_PURE_VIRTUALS (t) = tree_cons (NULL_TREE, x, CLASSTYPE_PURE_VIRTUALS (t)); } - - if (DECL_ARRAY_DELETE_OPERATOR_P (x)) - { - tree second_parm; - - /* When dynamically allocating an array of this type, we - need a "cookie" to record how many elements we allocated, - even if the array elements have no non-trivial - destructor, if the usual array deallocation function - takes a second argument of type size_t. The standard (in - [class.free]) requires that the second argument be set - correctly. */ - second_parm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (x))); - /* Under the new ABI, we choose only those function that are - explicitly declared as `operator delete[] (void *, - size_t)'. */ - if (!seen_one_arg_array_delete_p - && second_parm - && TREE_CHAIN (second_parm) == void_list_node - && same_type_p (TREE_VALUE (second_parm), sizetype)) - TYPE_VEC_DELETE_TAKES_SIZE (t) = 1; - /* If there's no second parameter, then this is the usual - deallocation function. */ - else if (second_parm == void_list_node) - seen_one_arg_array_delete_p = 1; - } } } --- 3944,3949 ---- *************** remove_zero_width_bit_fields (t) *** 4607,4612 **** --- 4240,4298 ---- } } + /* Returns TRUE iff we need a cookie when dynamically allocating an + array whose elements have the indicated class TYPE. */ + + static bool + type_requires_array_cookie (type) + tree type; + { + tree fns; + bool has_two_argument_delete_p = false; + + my_friendly_assert (CLASS_TYPE_P (type), 20010712); + + /* If there's a non-trivial destructor, we need a cookie. In order + to iterate through the array calling the destructor for each + element, we'll have to know how many elements there are. */ + if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) + return true; + + /* If the usual deallocation function is a two-argument whose second + argument is of type `size_t', then we have to pass the size of + the array to the deallocation function, so we will need to store + a cookie. */ + fns = lookup_fnfields (TYPE_BINFO (type), + ansi_opname (VEC_DELETE_EXPR), + /*protect=*/0); + /* If there are no `operator []' members, or the lookup is + ambiguous, then we don't need a cookie. */ + if (!fns || fns == error_mark_node) + return false; + /* Loop through all of the functions. */ + for (fns = TREE_VALUE (fns); fns; fns = OVL_NEXT (fns)) + { + tree fn; + tree second_parm; + + /* Select the current function. */ + fn = OVL_CURRENT (fns); + /* See if this function is a one-argument delete function. If + it is, then it will be the usual deallocation function. */ + second_parm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn))); + if (second_parm == void_list_node) + return false; + /* Otherwise, if we have a two-argument function and the second + argument is `size_t', it will be the usual deallocation + function -- unless there is one-argument function, too. */ + if (TREE_CHAIN (second_parm) == void_list_node + && same_type_p (TREE_VALUE (second_parm), sizetype)) + has_two_argument_delete_p = true; + } + + return has_two_argument_delete_p; + } + /* Check the validity of the bases and members declared in T. Add any implicitly-generated functions (like copy-constructors and assignment operators). Compute various flag bits (like *************** check_bases_and_members (t, empty_p) *** 4692,4697 **** --- 4378,4388 ---- /* Build and sort the CLASSTYPE_METHOD_VEC. */ finish_struct_methods (t); + + /* Figure out whether or not we will need a cookie when dynamically + allocating an array of this type. */ + TYPE_LANG_SPECIFIC (t)->vec_new_uses_cookie + = type_requires_array_cookie (t); } /* If T needs a pointer to its virtual function table, set TYPE_VFIELD *************** create_vtable_ptr (t, empty_p, vfuns_p, *** 4722,4730 **** here. Even if there weren't any new virtual functions, we might need a new virtual function table if we're supposed to include vptrs in all classes that need them. */ ! if (!TYPE_VFIELD (t) ! && (*vfuns_p ! || (TYPE_CONTAINS_VPTR_P (t) && vptrs_present_everywhere_p ()))) { /* We build this decl with vtbl_ptr_type_node, which is a `vtable_entry_type*'. It might seem more precise to use --- 4413,4419 ---- here. Even if there weren't any new virtual functions, we might need a new virtual function table if we're supposed to include vptrs in all classes that need them. */ ! if (!TYPE_VFIELD (t) && (*vfuns_p || TYPE_CONTAINS_VPTR_P (t))) { /* We build this decl with vtbl_ptr_type_node, which is a `vtable_entry_type*'. It might seem more precise to use *************** create_vtable_ptr (t, empty_p, vfuns_p, *** 4745,4757 **** bounds. That's better than using `void*' or some such; it's cleaner, and it let's the alias analysis code know that these stores cannot alias stores to void*! */ ! TYPE_VFIELD (t) ! = build_vtbl_or_vbase_field (get_vfield_name (t), ! get_identifier (VFIELD_BASE), ! vtbl_ptr_type_node, ! t, ! t, ! empty_p); if (CLASSTYPE_N_BASECLASSES (t)) /* If there were any baseclasses, they can't possibly be at --- 4434,4454 ---- bounds. That's better than using `void*' or some such; it's cleaner, and it let's the alias analysis code know that these stores cannot alias stores to void*! */ ! tree field; ! ! field = build_decl (FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node); ! SET_DECL_ASSEMBLER_NAME (field, get_identifier (VFIELD_BASE)); ! DECL_VIRTUAL_P (field) = 1; ! DECL_ARTIFICIAL (field) = 1; ! DECL_FIELD_CONTEXT (field) = t; ! DECL_FCONTEXT (field) = t; ! DECL_ALIGN (field) = TYPE_ALIGN (vtbl_ptr_type_node); ! DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (vtbl_ptr_type_node); ! ! TYPE_VFIELD (t) = field; ! ! /* This class is non-empty. */ ! *empty_p = 0; if (CLASSTYPE_N_BASECLASSES (t)) /* If there were any baseclasses, they can't possibly be at *************** create_vtable_ptr (t, empty_p, vfuns_p, *** 4760,4766 **** take work. */ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (t) = 1; ! return TYPE_VFIELD (t); } return NULL_TREE; --- 4457,4463 ---- take work. */ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (t) = 1; ! return field; } return NULL_TREE; *************** layout_virtual_bases (t, offsets) *** 4909,4916 **** tree t; splay_tree offsets; { ! tree vbases; ! unsigned HOST_WIDE_INT dsize; unsigned HOST_WIDE_INT eoc; if (CLASSTYPE_N_BASECLASSES (t) == 0) --- 4606,4612 ---- tree t; splay_tree offsets; { ! tree vbases, dsize; unsigned HOST_WIDE_INT eoc; if (CLASSTYPE_N_BASECLASSES (t) == 0) *************** layout_virtual_bases (t, offsets) *** 4923,4938 **** #endif /* DSIZE is the size of the class without the virtual bases. */ ! dsize = tree_low_cst (TYPE_SIZE (t), 1); /* Make every class have alignment of at least one. */ TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), BITS_PER_UNIT); /* Go through the virtual bases, allocating space for each virtual ! base that is not already a primary base class. Under the old ! ABI, these are allocated according to a depth-first left-to-right ! postorder traversal; in the new ABI, inheritance graph order is ! used instead. */ for (vbases = TYPE_BINFO (t); vbases; vbases = TREE_CHAIN (vbases)) --- 4619,4632 ---- #endif /* DSIZE is the size of the class without the virtual bases. */ ! dsize = TYPE_SIZE (t); /* Make every class have alignment of at least one. */ TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), BITS_PER_UNIT); /* 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)) *************** layout_virtual_bases (t, offsets) *** 4947,4953 **** { /* This virtual base is not a primary base of any class in the hierarchy, so we have to add space for it. */ ! tree basetype; unsigned int desired_align; basetype = BINFO_TYPE (vbase); --- 4641,4647 ---- { /* This virtual base is not a primary base of any class in the hierarchy, so we have to add space for it. */ ! tree basetype, usize; unsigned int desired_align; basetype = BINFO_TYPE (vbase); *************** layout_virtual_bases (t, offsets) *** 4957,4975 **** /* Add padding so that we can put the virtual base class at an appropriately aligned offset. */ ! dsize = CEIL (dsize, desired_align) * desired_align; ! /* Under the new ABI, we try to squish empty virtual bases in ! just like ordinary empty bases. */ if (is_empty_class (basetype)) layout_empty_base (vbase, ! size_int (CEIL (dsize, BITS_PER_UNIT)), offsets, t); else { tree offset; ! offset = ssize_int (CEIL (dsize, BITS_PER_UNIT)); offset = size_diffop (offset, convert (ssizetype, BINFO_OFFSET (vbase))); --- 4651,4671 ---- /* Add padding so that we can put the virtual base class at an appropriately aligned offset. */ ! dsize = round_up (dsize, desired_align); ! usize = size_binop (CEIL_DIV_EXPR, dsize, bitsize_unit_node); ! ! /* We try to squish empty virtual bases in just like ! ordinary empty bases. */ if (is_empty_class (basetype)) layout_empty_base (vbase, ! convert (sizetype, usize), offsets, t); else { tree offset; ! offset = convert (ssizetype, usize); offset = size_diffop (offset, convert (ssizetype, BINFO_OFFSET (vbase))); *************** layout_virtual_bases (t, offsets) *** 4979,4986 **** /* Every virtual baseclass takes a least a UNIT, so that we can take it's address and get something different for each base. */ ! dsize += MAX (BITS_PER_UNIT, ! tree_low_cst (CLASSTYPE_SIZE (basetype), 0)); } /* Keep track of the offsets assigned to this virtual base. */ --- 4675,4683 ---- /* Every virtual baseclass takes a least a UNIT, so that we can take it's address and get something different for each base. */ ! dsize = size_binop (PLUS_EXPR, dsize, ! size_binop (MAX_EXPR, bitsize_unit_node, ! CLASSTYPE_SIZE (basetype))); } /* Keep track of the offsets assigned to this virtual base. */ *************** layout_virtual_bases (t, offsets) *** 4994,5000 **** /* 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 get_base_distance depend on the BINFO_OFFSETs being set correctly. */ dfs_walk (TYPE_BINFO (t), dfs_set_offset_for_unshared_vbases, NULL, t); --- 4691,4697 ---- /* 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); *************** layout_virtual_bases (t, offsets) *** 5002,5014 **** class, we didn't update DSIZE above; we were hoping to overlay multiple such bases at the same location. */ eoc = end_of_class (t, /*include_virtuals_p=*/1); ! if (eoc * BITS_PER_UNIT > dsize) ! dsize = eoc * BITS_PER_UNIT; /* Now, make sure that the total size of the type is a multiple of its alignment. */ ! dsize = CEIL (dsize, TYPE_ALIGN (t)) * TYPE_ALIGN (t); ! TYPE_SIZE (t) = bitsize_int (dsize); TYPE_SIZE_UNIT (t) = convert (sizetype, size_binop (CEIL_DIV_EXPR, TYPE_SIZE (t), bitsize_unit_node)); --- 4699,4710 ---- class, we didn't update DSIZE above; we were hoping to overlay multiple such bases at the same location. */ eoc = end_of_class (t, /*include_virtuals_p=*/1); ! dsize = size_binop (MAX_EXPR, dsize, bitsize_int (eoc * BITS_PER_UNIT)); /* Now, make sure that the total size of the type is a multiple of its alignment. */ ! dsize = round_up (dsize, TYPE_ALIGN (t)); ! TYPE_SIZE (t) = dsize; TYPE_SIZE_UNIT (t) = convert (sizetype, size_binop (CEIL_DIV_EXPR, TYPE_SIZE (t), bitsize_unit_node)); *************** layout_virtual_bases (t, offsets) *** 5020,5027 **** vbases = TREE_CHAIN (vbases)) { tree basetype = BINFO_TYPE (TREE_VALUE (vbases)); ! if (get_base_distance (basetype, t, 0, (tree*)0) == -2) ! cp_warning ("virtual base `%T' inaccessible in `%T' due to ambiguity", basetype, t); } } --- 4716,4724 ---- vbases = TREE_CHAIN (vbases)) { tree basetype = BINFO_TYPE (TREE_VALUE (vbases)); ! ! if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL)) ! warning ("virtual base `%T' inaccessible in `%T' due to ambiguity", basetype, t); } } *************** warn_about_ambiguous_direct_bases (t) *** 5090,5097 **** { tree basetype = TYPE_BINFO_BASETYPE (t, i); ! if (get_base_distance (basetype, t, 0, NULL) == -2) ! cp_warning ("direct base `%T' inaccessible in `%T' due to ambiguity", basetype, t); } } --- 4787,4794 ---- { tree basetype = TYPE_BINFO_BASETYPE (t, i); ! if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL)) ! warning ("direct base `%T' inaccessible in `%T' due to ambiguity", basetype, t); } } *************** layout_class_type (t, empty_p, vfuns_p, *** 5142,5149 **** vptr = create_vtable_ptr (t, empty_p, vfuns_p, new_virtuals_p, overridden_virtuals_p); ! /* Under the new ABI, the vptr is always the first thing in the ! class. */ if (vptr) { TYPE_FIELDS (t) = chainon (vptr, TYPE_FIELDS (t)); --- 4839,4845 ---- vptr = create_vtable_ptr (t, empty_p, vfuns_p, new_virtuals_p, overridden_virtuals_p); ! /* The vptr is always the first thing in the class. */ if (vptr) { TYPE_FIELDS (t) = chainon (vptr, TYPE_FIELDS (t)); *************** layout_class_type (t, empty_p, vfuns_p, *** 5156,5169 **** if (build_base_fields (rli, empty_p, empty_base_offsets, t)) CLASSTYPE_NEARLY_EMPTY_P (t) = 0; - /* Add pointers to all of our virtual base-classes. */ - TYPE_FIELDS (t) = chainon (build_vbase_pointer_fields (rli, empty_p), - TYPE_FIELDS (t)); - - /* CLASSTYPE_INLINE_FRIENDS is really TYPE_NONCOPIED_PARTS. Thus, - we have to save this before we zap TYPE_NONCOPIED_PARTS. */ - fixup_inline_methods (t); - /* Layout the non-static data members. */ for (field = non_static_data_members; field; field = TREE_CHAIN (field)) { --- 4852,4857 ---- *************** layout_class_type (t, empty_p, vfuns_p, *** 5175,5190 **** if (TREE_CODE (field) != FIELD_DECL) { place_field (rli, field); continue; } type = TREE_TYPE (field); /* If this field is a bit-field whose width is greater than its ! type, then there are some special rules for allocating it ! under the new ABI. Under the old ABI, there were no special ! rules, but the back-end can't handle bitfields longer than a ! `long long', so we use the same mechanism. */ if (DECL_C_BIT_FIELD (field) && INT_CST_LT (TYPE_SIZE (type), DECL_SIZE (field))) { --- 4863,4888 ---- if (TREE_CODE (field) != FIELD_DECL) { place_field (rli, field); + /* If the static data member has incomplete type, keep track + of it so that it can be completed later. (The handling + of pending statics in finish_record_layout is + insufficient; consider: + + struct S1; + struct S2 { static S1 s1; }; + + At this point, finish_record_layout will be called, but + S1 is still incomplete.) */ + if (TREE_CODE (field) == VAR_DECL) + maybe_register_incomplete_var (field); continue; } type = TREE_TYPE (field); /* If this field is a bit-field whose width is greater than its ! type, then there are some special rules for allocating ! it. */ if (DECL_C_BIT_FIELD (field) && INT_CST_LT (TYPE_SIZE (type), DECL_SIZE (field))) { *************** layout_class_type (t, empty_p, vfuns_p, *** 5249,5258 **** } /* We make all structures have at least one element, so that they ! have non-zero size. In the new ABI, the class may be empty even ! if it has basetypes. Therefore, we add the fake field after all ! the other fields; if there are already FIELD_DECLs on the list, ! their offsets will not be disturbed. */ if (!eoc && *empty_p) { tree padding; --- 4947,4956 ---- } /* We make all structures have at least one element, so that they ! have non-zero size. The class may be empty even if it has ! basetypes. Therefore, we add the fake field after all the other ! fields; if there are already FIELD_DECLs on the list, their ! offsets will not be disturbed. */ if (!eoc && *empty_p) { tree padding; *************** finish_struct_1 (t) *** 5356,5370 **** if (COMPLETE_TYPE_P (t)) { if (IS_AGGR_TYPE (t)) ! cp_error ("redefinition of `%#T'", t); else ! my_friendly_abort (172); popclass (); return; } - GNU_xref_decl (current_function_decl, t); - /* If this type was previously laid out as a forward reference, make sure we lay it out again. */ TYPE_SIZE (t) = NULL_TREE; --- 5054,5066 ---- if (COMPLETE_TYPE_P (t)) { if (IS_AGGR_TYPE (t)) ! error ("redefinition of `%#T'", t); else ! abort (); popclass (); return; } /* If this type was previously laid out as a forward reference, make sure we lay it out again. */ TYPE_SIZE (t) = NULL_TREE; *************** finish_struct_1 (t) *** 5373,5378 **** --- 5069,5076 ---- vfuns = 0; CLASSTYPE_RTTI (t) = NULL_TREE; + fixup_inline_methods (t); + /* Do end-of-class semantic processing: checking the validity of the bases and members and add implicitly generated methods. */ check_bases_and_members (t, &empty); *************** finish_struct_1 (t) *** 5413,5421 **** = chainon (CLASSTYPE_VFIELDS (t), build_tree_list (NULL_TREE, t)); /* If necessary, create the primary vtable for this class. */ ! if (new_virtuals ! || overridden_virtuals ! || (TYPE_CONTAINS_VPTR_P (t) && vptrs_present_everywhere_p ())) { new_virtuals = nreverse (new_virtuals); /* We must enter these virtuals into the table. */ --- 5111,5117 ---- = chainon (CLASSTYPE_VFIELDS (t), build_tree_list (NULL_TREE, t)); /* If necessary, create the primary vtable for this class. */ ! if (new_virtuals || overridden_virtuals || TYPE_CONTAINS_VPTR_P (t)) { new_virtuals = nreverse (new_virtuals); /* We must enter these virtuals into the table. */ *************** finish_struct_1 (t) *** 5472,5478 **** working on. */ for (x = TYPE_FIELDS (t); x; x = TREE_CHAIN (x)) if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x) ! && TREE_TYPE (x) == t) DECL_MODE (x) = TYPE_MODE (t); /* Done with FIELDS...now decide whether to sort these for --- 5168,5174 ---- working on. */ for (x = TYPE_FIELDS (t); x; x = TREE_CHAIN (x)) if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x) ! && same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (x)), t)) DECL_MODE (x) = TYPE_MODE (t); /* Done with FIELDS...now decide whether to sort these for *************** finish_struct_1 (t) *** 5519,5527 **** if (warn_nonvdtor && TYPE_POLYMORPHIC_P (t) && TYPE_HAS_DESTRUCTOR (t) && DECL_VINDEX (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 1)) == NULL_TREE) ! cp_warning ("`%#T' has virtual functions but non-virtual destructor", t); ! hack_incomplete_structures (t); if (warn_overloaded_virtual) warn_hidden (t); --- 5215,5223 ---- if (warn_nonvdtor && TYPE_POLYMORPHIC_P (t) && TYPE_HAS_DESTRUCTOR (t) && DECL_VINDEX (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 1)) == NULL_TREE) ! warning ("`%#T' has virtual functions but non-virtual destructor", t); ! complete_vars (t); if (warn_overloaded_virtual) warn_hidden (t); *************** finish_struct (t, attributes) *** 5580,5586 **** as necessary. */ unreverse_member_declarations (t); ! cplus_decl_attributes (t, attributes, NULL_TREE); /* Nadger the current location so that diagnostics point to the start of the struct, not the end. */ --- 5276,5282 ---- as necessary. */ unreverse_member_declarations (t); ! cplus_decl_attributes (&t, attributes, (int) ATTR_FLAG_TYPE_IN_PLACE); /* Nadger the current location so that diagnostics point to the start of the struct, not the end. */ *************** finish_struct (t, attributes) *** 5603,5609 **** if (current_class_type) popclass (); else ! error ("trying to finish struct, but kicked out due to previous parse errors."); if (processing_template_decl) { --- 5299,5305 ---- if (current_class_type) popclass (); else ! error ("trying to finish struct, but kicked out due to previous parse errors"); if (processing_template_decl) { *************** fixed_type_or_null (instance, nonnull, c *** 5632,5642 **** switch (TREE_CODE (instance)) { case INDIRECT_REF: ! /* Check that we are not going through a cast of some sort. */ ! if (TREE_TYPE (instance) ! == TREE_TYPE (TREE_TYPE (TREE_OPERAND (instance, 0)))) ! instance = TREE_OPERAND (instance, 0); ! /* fall through... */ case CALL_EXPR: /* This is a call to a constructor, hence it's never zero. */ if (TREE_HAS_CONSTRUCTOR (instance)) --- 5328,5339 ---- switch (TREE_CODE (instance)) { case INDIRECT_REF: ! if (POINTER_TYPE_P (TREE_TYPE (instance))) ! return NULL_TREE; ! else ! return fixed_type_or_null (TREE_OPERAND (instance, 0), ! nonnull, cdtorp); ! case CALL_EXPR: /* This is a call to a constructor, hence it's never zero. */ if (TREE_HAS_CONSTRUCTOR (instance)) *************** fixed_type_or_null (instance, nonnull, c *** 5727,5737 **** } } ! /* Return non-zero if the dynamic type of INSTANCE is known, and equivalent ! to the static type. We also handle the case where INSTANCE is really ! a pointer. Return negative if this is a ctor/dtor. There the dynamic type ! is known, but this might not be the most derived base of the original object, ! and hence virtual bases may not be layed out according to this type. Used to determine whether the virtual function table is needed or not. --- 5424,5435 ---- } } ! /* Return non-zero if the dynamic type of INSTANCE is known, and ! equivalent to the static type. We also handle the case where ! INSTANCE is really a pointer. Return negative if this is a ! ctor/dtor. There the dynamic type is known, but this might not be ! the most derived base of the original object, and hence virtual ! bases may not be layed out according to this type. Used to determine whether the virtual function table is needed or not. *************** pop_nested_class () *** 6016,6021 **** --- 5714,5727 ---- pop_nested_class (); } + /* Returns the number of extern "LANG" blocks we are nested within. */ + + int + current_lang_depth () + { + return VARRAY_ACTIVE_SIZE (current_lang_base); + } + /* Set global variables CURRENT_LANG_NAME to appropriate value so that behavior of name-mangling machinery is correct. */ *************** void *** 6023,6037 **** push_lang_context (name) tree name; { ! *current_lang_stack++ = current_lang_name; ! if (current_lang_stack - &VARRAY_TREE (current_lang_base, 0) ! >= (ptrdiff_t) VARRAY_SIZE (current_lang_base)) ! { ! size_t old_size = VARRAY_SIZE (current_lang_base); ! ! VARRAY_GROW (current_lang_base, old_size + 10); ! current_lang_stack = &VARRAY_TREE (current_lang_base, old_size); ! } if (name == lang_name_cplusplus) { --- 5729,5735 ---- push_lang_context (name) tree name; { ! VARRAY_PUSH_TREE (current_lang_base, current_lang_name); if (name == lang_name_cplusplus) { *************** push_lang_context (name) *** 6066,6075 **** void pop_lang_context () { ! /* Clear the current entry so that garbage collector won't hold on ! to it. */ ! *current_lang_stack = NULL_TREE; ! current_lang_name = *--current_lang_stack; } /* Type instantiation routines. */ --- 5764,5771 ---- void pop_lang_context () { ! current_lang_name = VARRAY_TOP_TREE (current_lang_base); ! VARRAY_POP (current_lang_base); } /* Type instantiation routines. */ *************** resolve_address_of_overloaded_function ( *** 6156,6162 **** else { if (complain) ! cp_error ("\ cannot resolve overloaded function `%D' based on conversion to type `%T'", DECL_NAME (OVL_FUNCTION (overload)), target_type); return error_mark_node; --- 5852,5858 ---- else { if (complain) ! error ("\ cannot resolve overloaded function `%D' based on conversion to type `%T'", DECL_NAME (OVL_FUNCTION (overload)), target_type); return error_mark_node; *************** cannot resolve overloaded function `%D' *** 6277,6283 **** /* There were *no* matches. */ if (complain) { ! cp_error ("no matches converting function `%D' to type `%#T'", DECL_NAME (OVL_FUNCTION (overload)), target_type); --- 5973,5979 ---- /* There were *no* matches. */ if (complain) { ! error ("no matches converting function `%D' to type `%#T'", DECL_NAME (OVL_FUNCTION (overload)), target_type); *************** cannot resolve overloaded function `%D' *** 6300,6306 **** { tree match; ! cp_error ("converting overloaded function `%D' to type `%#T' is ambiguous", DECL_NAME (OVL_FUNCTION (overload)), target_type); --- 5996,6002 ---- { tree match; ! error ("converting overloaded function `%D' to type `%#T' is ambiguous", DECL_NAME (OVL_FUNCTION (overload)), target_type); *************** cannot resolve overloaded function `%D' *** 6326,6335 **** if (!complain) return error_mark_node; ! cp_pedwarn ("assuming pointer to member `%D'", fn); if (!explained) { ! cp_pedwarn ("(a pointer to member can only be formed with `&%E')", fn); explained = 1; } } --- 6022,6031 ---- if (!complain) return error_mark_node; ! pedwarn ("assuming pointer to member `%D'", fn); if (!explained) { ! pedwarn ("(a pointer to member can only be formed with `&%E')", fn); explained = 1; } } *************** cannot resolve overloaded function `%D' *** 6361,6374 **** tree instantiate_type (lhstype, rhs, flags) tree lhstype, rhs; ! enum instantiate_type_flags flags; { ! int complain = (flags & itf_complain); ! int strict = (flags & itf_no_attributes) ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT; ! int allow_ptrmem = flags & itf_ptrmem_ok; ! flags &= ~itf_ptrmem_ok; if (TREE_CODE (lhstype) == UNKNOWN_TYPE) { --- 6057,6070 ---- tree instantiate_type (lhstype, rhs, flags) tree lhstype, rhs; ! tsubst_flags_t 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) { *************** instantiate_type (lhstype, rhs, flags) *** 6382,6388 **** if (comptypes (lhstype, TREE_TYPE (rhs), strict)) return rhs; if (complain) ! cp_error ("argument of type `%T' does not match `%T'", TREE_TYPE (rhs), lhstype); return error_mark_node; } --- 6078,6084 ---- if (comptypes (lhstype, TREE_TYPE (rhs), strict)) return rhs; if (complain) ! error ("argument of type `%T' does not match `%T'", TREE_TYPE (rhs), lhstype); return error_mark_node; } *************** instantiate_type (lhstype, rhs, flags) *** 6404,6410 **** case SAVE_EXPR: case CONSTRUCTOR: case BUFFER_REF: ! my_friendly_abort (177); return error_mark_node; case INDIRECT_REF: --- 6100,6106 ---- case SAVE_EXPR: case CONSTRUCTOR: case BUFFER_REF: ! abort (); return error_mark_node; case INDIRECT_REF: *************** instantiate_type (lhstype, rhs, flags) *** 6473,6479 **** case CALL_EXPR: /* This is too hard for now. */ ! my_friendly_abort (183); return error_mark_node; case PLUS_EXPR: --- 6169,6175 ---- case CALL_EXPR: /* This is too hard for now. */ ! abort (); return error_mark_node; case PLUS_EXPR: *************** instantiate_type (lhstype, rhs, flags) *** 6575,6593 **** case ADDR_EXPR: { if (PTRMEM_OK_P (rhs)) ! flags |= itf_ptrmem_ok; return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags); } case ENTRY_VALUE_EXPR: ! my_friendly_abort (184); return error_mark_node; case ERROR_MARK: return error_mark_node; default: ! my_friendly_abort (185); return error_mark_node; } } --- 6271,6289 ---- case ADDR_EXPR: { if (PTRMEM_OK_P (rhs)) ! flags |= tf_ptrmem_ok; return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags); } case ENTRY_VALUE_EXPR: ! abort (); return error_mark_node; case ERROR_MARK: return error_mark_node; default: ! abort (); return error_mark_node; } } *************** get_vfield_name (type) *** 6613,6619 **** type = BINFO_TYPE (binfo); buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT) + TYPE_NAME_LENGTH (type) + 2); ! sprintf (buf, VFIELD_NAME_FORMAT, TYPE_NAME_STRING (type)); return get_identifier (buf); } --- 6309,6316 ---- type = BINFO_TYPE (binfo); buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT) + TYPE_NAME_LENGTH (type) + 2); ! sprintf (buf, VFIELD_NAME_FORMAT, ! IDENTIFIER_POINTER (constructor_name (type))); return get_identifier (buf); } *************** get_enclosing_class (type) *** 6700,6706 **** break; default: ! my_friendly_abort (0); } } return NULL_TREE; --- 6397,6403 ---- break; default: ! abort (); } } return NULL_TREE; *************** is_base_of_enclosing_class (base, type) *** 6714,6720 **** { while (type) { ! if (get_binfo (base, type, 0)) return 1; type = get_enclosing_class (type); --- 6411,6417 ---- { while (type) { ! if (lookup_base (type, base, ba_any, NULL)) return 1; type = get_enclosing_class (type); *************** note_name_declared_in_class (name, decl) *** 6776,6792 **** A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. */ ! cp_error ("declaration of `%#D'", decl); cp_error_at ("changes meaning of `%D' from `%+#D'", DECL_NAME (OVL_CURRENT (decl)), (tree) n->value); } } ! /* Returns the VAR_DECL for the complete vtable associated with ! BINFO. (Under the new ABI, secondary vtables are merged with ! primary vtables; this function will return the VAR_DECL for the ! primary vtable.) */ tree get_vtbl_decl_for_binfo (binfo) --- 6473,6488 ---- A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. */ ! error ("declaration of `%#D'", decl); cp_error_at ("changes meaning of `%D' from `%+#D'", DECL_NAME (OVL_CURRENT (decl)), (tree) n->value); } } ! /* Returns the VAR_DECL for the complete vtable associated with BINFO. ! Secondary vtables are merged with primary vtables; this function ! will return the VAR_DECL for the primary vtable. */ tree get_vtbl_decl_for_binfo (binfo) *************** get_primary_binfo (binfo) *** 6865,6871 **** } /* We should always find the primary base. */ ! my_friendly_abort (20000729); } /* For a primary virtual base, we have to scan the entire hierarchy --- 6561,6567 ---- } /* We should always find the primary base. */ ! abort (); } /* For a primary virtual base, we have to scan the entire hierarchy *************** dump_array (stream, decl) *** 7067,7073 **** for (ix = 0, inits = TREE_OPERAND (DECL_INITIAL (decl), 1); inits; ix++, inits = TREE_CHAIN (inits)) ! fprintf (stream, "%-4d %s\n", ix * elt, expr_as_string (TREE_VALUE (inits), TFF_PLAIN_IDENTIFIER)); } --- 6763,6769 ---- for (ix = 0, inits = TREE_OPERAND (DECL_INITIAL (decl), 1); inits; ix++, inits = TREE_CHAIN (inits)) ! fprintf (stream, "%-4ld %s\n", (long)(ix * elt), expr_as_string (TREE_VALUE (inits), TFF_PLAIN_IDENTIFIER)); } *************** static void *** 7134,7210 **** finish_vtbls (t) tree t; { ! if (merge_primary_and_secondary_vtables_p ()) ! { ! tree list; ! tree vbase; ! int i; ! /* Under the new ABI, we lay out the primary and secondary ! vtables in one contiguous vtable. The primary vtable is ! first, followed by the non-virtual secondary vtables in ! inheritance graph order. */ ! list = build_tree_list (TYPE_BINFO_VTABLE (t), NULL_TREE); ! accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t), ! TYPE_BINFO (t), t, list); ! /* Then come the virtual bases, also in inheritance graph ! order. */ ! for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase)) ! { ! tree real_base; ! if (!TREE_VIA_VIRTUAL (vbase)) ! continue; ! /* Although we walk in inheritance order, that might not get the ! canonical base. */ ! real_base = binfo_for_vbase (BINFO_TYPE (vbase), t); ! accumulate_vtbl_inits (real_base, real_base, ! TYPE_BINFO (t), t, list); ! } ! /* Fill in BINFO_VPTR_FIELD in the immediate binfos for our virtual ! base classes, for the benefit of the debugging backends. */ ! for (i = 0; i < BINFO_N_BASETYPES (TYPE_BINFO (t)); ++i) { ! tree base = BINFO_BASETYPE (TYPE_BINFO (t), i); ! if (TREE_VIA_VIRTUAL (base)) ! { ! tree vbase = binfo_for_vbase (BINFO_TYPE (base), t); ! BINFO_VPTR_FIELD (base) = BINFO_VPTR_FIELD (vbase); ! } } - - if (TYPE_BINFO_VTABLE (t)) - initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list)); } - else - { - dfs_walk (TYPE_BINFO (t), dfs_finish_vtbls, - dfs_unmarked_real_bases_queue_p, t); - dfs_walk (TYPE_BINFO (t), dfs_unmark, - dfs_marked_real_bases_queue_p, t); - } - } ! /* Called from finish_vtbls via dfs_walk. */ ! ! static tree ! dfs_finish_vtbls (binfo, data) ! tree binfo; ! void *data; ! { ! tree t = (tree) data; ! ! if (BINFO_NEW_VTABLE_MARKED (binfo, t)) ! initialize_vtable (binfo, ! build_vtbl_initializer (binfo, binfo, t, ! TYPE_BINFO (t), NULL)); ! ! SET_BINFO_MARKED (binfo); ! ! return NULL_TREE; } /* Initialize the vtable for BINFO with the INITS. */ --- 6830,6876 ---- finish_vtbls (t) tree t; { ! tree list; ! tree vbase; ! int i; ! /* We lay out the primary and secondary vtables in one contiguous ! vtable. The primary vtable is first, followed by the non-virtual ! secondary vtables in inheritance graph order. */ ! list = build_tree_list (TYPE_BINFO_VTABLE (t), NULL_TREE); ! accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t), ! TYPE_BINFO (t), t, list); ! ! /* Then come the virtual bases, also in inheritance graph order. */ ! for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase)) ! { ! tree real_base; ! if (!TREE_VIA_VIRTUAL (vbase)) ! continue; ! /* Although we walk in inheritance order, that might not get the ! canonical base. */ ! real_base = binfo_for_vbase (BINFO_TYPE (vbase), t); ! accumulate_vtbl_inits (real_base, real_base, ! TYPE_BINFO (t), t, list); ! } ! /* Fill in BINFO_VPTR_FIELD in the immediate binfos for our virtual ! base classes, for the benefit of the debugging backends. */ ! for (i = 0; i < BINFO_N_BASETYPES (TYPE_BINFO (t)); ++i) ! { ! tree base = BINFO_BASETYPE (TYPE_BINFO (t), i); ! if (TREE_VIA_VIRTUAL (base)) { ! vbase = binfo_for_vbase (BINFO_TYPE (base), t); ! BINFO_VPTR_FIELD (base) = BINFO_VPTR_FIELD (vbase); } } ! if (TYPE_BINFO_VTABLE (t)) ! initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list)); } /* Initialize the vtable for BINFO with the INITS. */ *************** initialize_array (decl, inits) *** 7244,7250 **** This holds 1 - primary virtual pointer for complete object T ! 2 - secondary VTTs for each direct non-virtual base of T which requires a VTT 3 - secondary virtual pointers for each direct or indirect base of T which has virtual bases or is reachable via a virtual path from T. 4 - secondary VTTs for each direct or indirect virtual base of T. --- 6910,6917 ---- This holds 1 - primary virtual pointer for complete object T ! 2 - secondary VTTs for each direct non-virtual base of T which requires a ! VTT 3 - secondary virtual pointers for each direct or indirect base of T which has virtual bases or is reachable via a virtual path from T. 4 - secondary VTTs for each direct or indirect virtual base of T. *************** build_vtt (t) *** 7282,7288 **** } /* The type corresponding to BASE_BINFO is a base of the type of BINFO, but ! from within some heirarchy which is inherited from the type of BINFO. Return BASE_BINFO's equivalent binfo from the hierarchy dominated by BINFO. */ --- 6949,6955 ---- } /* 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. */ *************** get_original_base (base_binfo, binfo) *** 7304,7310 **** if (same_type_p (BINFO_TYPE (base_binfo), BINFO_TYPE (BINFO_BASETYPE (derived, ix)))) return BINFO_BASETYPE (derived, ix); ! my_friendly_abort (20010223); return NULL; } --- 6971,6977 ---- if (same_type_p (BINFO_TYPE (base_binfo), BINFO_TYPE (BINFO_BASETYPE (derived, ix)))) return BINFO_BASETYPE (derived, ix); ! abort (); return NULL; } *************** accumulate_vtbl_inits (binfo, orig_binfo *** 7677,7685 **** } } ! /* Called from accumulate_vtbl_inits when using the new ABI. ! Accumulates the vtable initializers for all of the vtables into ! TREE_VALUE (DATA). Returns the initializers for the BINFO vtable. */ static tree dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l) --- 7344,7351 ---- } } ! /* Called from accumulate_vtbl_inits. Returns the initializers for ! the BINFO vtable. */ static tree dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l) *************** dfs_accumulate_vtbl_inits (binfo, orig_b *** 7760,7765 **** --- 7426,7432 ---- vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, vtbl); + TREE_CONSTANT (vtbl) = 1; index = size_binop (PLUS_EXPR, size_int (non_fn_entries), size_int (list_length (TREE_VALUE (l)))); *************** dfs_accumulate_vtbl_inits (binfo, orig_b *** 7784,7790 **** return inits; } ! /* Construct the initializer for BINFOs virtual function table. BINFO is part of the hierarchy dominated by T. If we're building a construction vtable, the ORIG_BINFO is the binfo we should use to find the actual function pointers to put in the vtable - but they --- 7451,7457 ---- return inits; } ! /* Construct the initializer for BINFO's virtual function table. BINFO is part of the hierarchy dominated by T. If we're building a construction vtable, the ORIG_BINFO is the binfo we should use to find the actual function pointers to put in the vtable - but they *************** build_vtbl_initializer (binfo, orig_binf *** 7861,7922 **** tree vcall_index; tree fn; tree pfn; ! tree init; - /* Pull the offset for `this', and the function to call, out of - the list. */ - delta = BV_DELTA (v); - - if (BV_USE_VCALL_INDEX_P (v)) - { - vcall_index = BV_VCALL_INDEX (v); - my_friendly_assert (vcall_index != NULL_TREE, 20000621); - } - else - vcall_index = NULL_TREE; - fn = BV_FN (v); - my_friendly_assert (TREE_CODE (delta) == INTEGER_CST, 19990727); - my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 19990727); - - /* You can't call an abstract virtual function; it's abstract. - So, we replace these functions with __pure_virtual. */ - if (DECL_PURE_VIRTUAL_P (fn)) - fn = abort_fndecl; - - /* Take the address of the function, considering it to be of an - appropriate generic type. */ - pfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn); - /* The address of a function can't change. */ - TREE_CONSTANT (pfn) = 1; - - /* Enter it in the vtable. */ - init = build_vtable_entry (delta, vcall_index, pfn); /* If the only definition of this function signature along our primary base chain is from a lost primary, this vtable slot will never be used, so just zero it out. This is important to avoid requiring extra thunks which cannot be generated with the function. ! We could also handle this in update_vtable_entry_for_fn; doing it ! here means we zero out unused slots in ctor vtables as well, ! rather than filling them with erroneous values (though harmless, ! apart from relocation costs). */ ! if (fn != abort_fndecl) ! for (b = binfo; ; b = get_primary_binfo (b)) ! { ! /* We found a defn before a lost primary; go ahead as normal. */ ! if (look_for_overrides_here (BINFO_TYPE (b), fn)) break; ! /* The nearest definition is from a lost primary; clear the ! slot. */ ! if (BINFO_LOST_PRIMARY_P (b)) ! { ! init = size_zero_node; ! break; ! } ! } /* And add it to the chain of initializers. */ if (TARGET_VTABLE_USES_DESCRIPTORS) --- 7528,7593 ---- tree vcall_index; tree fn; tree pfn; ! tree init = NULL_TREE; fn = BV_FN (v); /* If the only definition of this function signature along our primary base chain is from a lost primary, this vtable slot will never be used, so just zero it out. This is important to avoid requiring extra thunks which cannot be generated with the function. ! We first check this in update_vtable_entry_for_fn, so we handle ! restored primary bases properly; we also need to do it here so we ! zero out unused slots in ctor vtables, rather than filling themff ! with erroneous values (though harmless, apart from relocation ! costs). */ ! for (b = binfo; ; b = get_primary_binfo (b)) ! { ! /* We found a defn before a lost primary; go ahead as normal. */ ! if (look_for_overrides_here (BINFO_TYPE (b), fn)) ! break; ! ! /* The nearest definition is from a lost primary; clear the ! slot. */ ! if (BINFO_LOST_PRIMARY_P (b)) ! { ! init = size_zero_node; break; + } + } ! if (! init) ! { ! /* Pull the offset for `this', and the function to call, out of ! the list. */ ! delta = BV_DELTA (v); ! ! if (BV_USE_VCALL_INDEX_P (v)) ! { ! vcall_index = BV_VCALL_INDEX (v); ! my_friendly_assert (vcall_index != NULL_TREE, 20000621); ! } ! else ! vcall_index = NULL_TREE; ! ! my_friendly_assert (TREE_CODE (delta) == INTEGER_CST, 19990727); ! my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 19990727); ! ! /* You can't call an abstract virtual function; it's abstract. ! So, we replace these functions with __pure_virtual. */ ! if (DECL_PURE_VIRTUAL_P (fn)) ! fn = abort_fndecl; ! ! /* Take the address of the function, considering it to be of an ! appropriate generic type. */ ! pfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn); ! /* The address of a function can't change. */ ! TREE_CONSTANT (pfn) = 1; ! ! /* Enter it in the vtable. */ ! init = build_vtable_entry (delta, vcall_index, pfn); ! } /* And add it to the chain of initializers. */ if (TARGET_VTABLE_USES_DESCRIPTORS) *************** build_vbase_offset_vtbl_entries (binfo, *** 7987,7997 **** tree t; tree non_primary_binfo; - /* Under the old ABI, pointers to virtual bases are stored in each - object. */ - if (!vbase_offsets_in_vtable_p ()) - return; - /* If there are no virtual baseclasses, then there is nothing to do. */ if (!TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo))) --- 7658,7663 ---- *************** build_vbase_offset_vtbl_entries (binfo, *** 8063,8069 **** /* The vbase offset had better be the same. */ if (!tree_int_cst_equal (delta, BINFO_VPTR_FIELD (orig_vbase))) ! my_friendly_abort (20000403); } /* The next vbase will come at a more negative offset. */ --- 7729,7735 ---- /* The vbase offset had better be the same. */ if (!tree_int_cst_equal (delta, BINFO_VPTR_FIELD (orig_vbase))) ! abort (); } /* The next vbase will come at a more negative offset. */ *************** build_vcall_offset_vtbl_entries (binfo, *** 8093,8103 **** tree binfo; vtbl_init_data *vid; { - /* Under the old ABI, the adjustments to the `this' pointer were made - elsewhere. */ - if (!vcall_offsets_in_vtable_p ()) - return; - /* We only need these entries if this base is a virtual base. */ if (!TREE_VIA_VIRTUAL (binfo)) return; --- 7759,7764 ---- *************** add_vcall_offset_vtbl_entries_1 (binfo, *** 8271,8277 **** were multiple copies, there would not be a unique final overrider and vid->derived would be ill-formed. */ base = DECL_CONTEXT (fn); ! base_binfo = get_binfo (base, vid->derived, /*protect=*/0); /* Compute the vcall offset. */ /* As mentioned above, the vbase we're working on is a primary base of --- 7932,7938 ---- were multiple copies, there would not be a unique final overrider and vid->derived would be ill-formed. */ base = DECL_CONTEXT (fn); ! base_binfo = lookup_base (vid->derived, base, ba_any, NULL); /* Compute the vcall offset. */ /* As mentioned above, the vbase we're working on is a primary base of *************** build_rtti_vtbl_entries (binfo, vid) *** 8320,8329 **** basetype = BINFO_TYPE (binfo); t = BINFO_TYPE (vid->rtti_binfo); - /* For a COM object there is no RTTI entry. */ - if (CLASSTYPE_COM_INTERFACE (basetype)) - return; - /* To find the complete object, we will first convert to our most primary base, and then add the offset in the vtbl to that value. */ b = binfo; --- 7981,7986 ---- *************** build_rtti_vtbl_entries (binfo, vid) *** 8352,8367 **** vid->last_init = &TREE_CHAIN (*vid->last_init); /* Add the offset-to-top entry. It comes earlier in the vtable that ! the the typeinfo entry. */ ! if (flag_vtable_thunks) ! { ! /* Convert the offset to look like a function pointer, so that ! we can put it in the vtable. */ ! init = build1 (NOP_EXPR, vfunc_ptr_type_node, offset); ! TREE_CONSTANT (init) = 1; ! *vid->last_init = build_tree_list (NULL_TREE, init); ! vid->last_init = &TREE_CHAIN (*vid->last_init); ! } } /* Build an entry in the virtual function table. DELTA is the offset --- 8009,8020 ---- vid->last_init = &TREE_CHAIN (*vid->last_init); /* Add the offset-to-top entry. It comes earlier in the vtable that ! the the typeinfo entry. Convert the offset to look like a ! function pointer, so that we can put it in the vtable. */ ! init = build1 (NOP_EXPR, vfunc_ptr_type_node, offset); ! TREE_CONSTANT (init) = 1; ! *vid->last_init = build_tree_list (NULL_TREE, init); ! vid->last_init = &TREE_CHAIN (*vid->last_init); } /* Build an entry in the virtual function table. DELTA is the offset *************** build_vtable_entry (delta, vcall_index, *** 8378,8432 **** tree vcall_index; tree entry; { ! if (flag_vtable_thunks) ! { ! tree fn; ! ! fn = TREE_OPERAND (entry, 0); ! if ((!integer_zerop (delta) || vcall_index != NULL_TREE) ! && fn != abort_fndecl ! && !DECL_TINFO_FN_P (fn)) ! { ! entry = make_thunk (entry, delta, vcall_index); ! entry = build1 (ADDR_EXPR, vtable_entry_type, entry); ! TREE_READONLY (entry) = 1; ! TREE_CONSTANT (entry) = 1; ! } ! #ifdef GATHER_STATISTICS ! n_vtable_entries += 1; ! #endif ! return entry; ! } ! else { ! tree elems = tree_cons (NULL_TREE, delta, ! tree_cons (NULL_TREE, integer_zero_node, ! build_tree_list (NULL_TREE, entry))); ! tree entry = build (CONSTRUCTOR, vtable_entry_type, NULL_TREE, elems); ! ! /* We don't use vcall offsets when not using vtable thunks. */ ! my_friendly_assert (vcall_index == NULL_TREE, 20000125); ! ! /* DELTA used to be constructed by `size_int' and/or size_binop, ! which caused overflow problems when it was negative. That should ! be fixed now. */ ! ! if (! int_fits_type_p (delta, delta_type_node)) ! { ! if (flag_huge_objects) ! sorry ("object size exceeds built-in limit for virtual function table implementation"); ! else ! sorry ("object size exceeds normal limit for virtual function table implementation, recompile all source and use -fhuge-objects"); ! } ! ! TREE_CONSTANT (entry) = 1; ! TREE_STATIC (entry) = 1; TREE_READONLY (entry) = 1; ! #ifdef GATHER_STATISTICS ! n_vtable_entries += 1; #endif ! ! return entry; ! } } --- 8031,8048 ---- tree vcall_index; tree entry; { ! tree fn = TREE_OPERAND (entry, 0); ! ! if ((!integer_zerop (delta) || vcall_index != NULL_TREE) ! && fn != abort_fndecl) { ! entry = make_thunk (entry, delta, vcall_index); ! entry = build1 (ADDR_EXPR, vtable_entry_type, entry); TREE_READONLY (entry) = 1; ! TREE_CONSTANT (entry) = 1; ! } #ifdef GATHER_STATISTICS ! n_vtable_entries += 1; #endif ! return entry; } diff -Nrc3pad gcc-3.0.4/gcc/cp/config-lang.in gcc-3.1/gcc/cp/config-lang.in *** gcc-3.0.4/gcc/cp/config-lang.in Tue Dec 12 20:28:51 2000 --- gcc-3.1/gcc/cp/config-lang.in Thu Dec 20 00:20:45 2001 *************** *** 1,5 **** # Top level configure fragment for GNU C++. ! # Copyright (C) 1994, 1995, 1997, 1998, 2000 Free Software Foundation, Inc. #This file is part of GNU CC. --- 1,6 ---- # Top level configure fragment for GNU C++. ! # Copyright (C) 1994, 1995, 1997, 1998, 2000, 2001 ! # Free Software Foundation, Inc. #This file is part of GNU CC. *************** *** 24,30 **** # language - name of language as it would appear in $(LANGUAGES) # compilers - value to add to $(COMPILERS) # stagestuff - files to add to $(STAGESTUFF) - # diff_excludes - files to ignore when building diffs between two versions. language="c++" --- 25,30 ---- *************** compilers="cc1plus\$(exeext)" *** 32,37 **** stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)" ! diff_excludes="-x parse.c -x parse.h" ! ! target_libs=${libstdcxx_version} --- 32,35 ---- stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)" ! target_libs="${libstdcxx_version} target-gperf" diff -Nrc3pad gcc-3.0.4/gcc/cp/cp-lang.c gcc-3.1/gcc/cp/cp-lang.c *** gcc-3.0.4/gcc/cp/cp-lang.c Thu Jan 1 00:00:00 1970 --- gcc-3.1/gcc/cp/cp-lang.c Wed Dec 5 23:48:14 2001 *************** *** 0 **** --- 1,110 ---- + /* Language-dependent hooks for C++. + Copyright 2001 Free Software Foundation, Inc. + Contributed by Alexandre Oliva + + This file is part of GNU CC. + + GNU CC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GNU CC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU CC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + #include "config.h" + #include "system.h" + #include "tree.h" + #include "cp-tree.h" + #include "c-common.h" + #include "toplev.h" + #include "langhooks.h" + #include "langhooks-def.h" + + static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree)); + + #undef LANG_HOOKS_NAME + #define LANG_HOOKS_NAME "GNU C++" + #undef LANG_HOOKS_INIT + #define LANG_HOOKS_INIT cxx_init + #undef LANG_HOOKS_FINISH + #define LANG_HOOKS_FINISH cxx_finish + #undef LANG_HOOKS_CLEAR_BINDING_STACK + #define LANG_HOOKS_CLEAR_BINDING_STACK pop_everything + #undef LANG_HOOKS_INIT_OPTIONS + #define LANG_HOOKS_INIT_OPTIONS cxx_init_options + #undef LANG_HOOKS_DECODE_OPTION + #define LANG_HOOKS_DECODE_OPTION cxx_decode_option + #undef LANG_HOOKS_POST_OPTIONS + #define LANG_HOOKS_POST_OPTIONS cxx_post_options + #undef LANG_HOOKS_GET_ALIAS_SET + #define LANG_HOOKS_GET_ALIAS_SET cxx_get_alias_set + #undef LANG_HOOKS_EXPAND_CONSTANT + #define LANG_HOOKS_EXPAND_CONSTANT cplus_expand_constant + #undef LANG_HOOKS_SAFE_FROM_P + #define LANG_HOOKS_SAFE_FROM_P c_safe_from_p + #undef LANG_HOOKS_PRINT_STATISTICS + #define LANG_HOOKS_PRINT_STATISTICS cxx_print_statistics + #undef LANG_HOOKS_PRINT_XNODE + #define LANG_HOOKS_PRINT_XNODE cxx_print_xnode + #undef LANG_HOOKS_PRINT_DECL + #define LANG_HOOKS_PRINT_DECL cxx_print_decl + #undef LANG_HOOKS_PRINT_TYPE + #define LANG_HOOKS_PRINT_TYPE cxx_print_type + #undef LANG_HOOKS_PRINT_IDENTIFIER + #define LANG_HOOKS_PRINT_IDENTIFIER cxx_print_identifier + #undef LANG_HOOKS_SET_YYDEBUG + #define LANG_HOOKS_SET_YYDEBUG cxx_set_yydebug + + #undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES + #define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES \ + cp_walk_subtrees + #undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN + #define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \ + cp_cannot_inline_tree_fn + #undef LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS + #define LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS \ + cp_add_pending_fn_decls + #undef LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P + #define LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P \ + cp_is_overload_p + #undef LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P + #define LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P \ + cp_auto_var_in_fn_p + #undef LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING + #define LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING \ + cp_copy_res_decl_for_inlining + #undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P + #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p + #undef LANG_HOOKS_TREE_INLINING_START_INLINING + #define LANG_HOOKS_TREE_INLINING_START_INLINING cp_start_inlining + #undef LANG_HOOKS_TREE_INLINING_END_INLINING + #define LANG_HOOKS_TREE_INLINING_END_INLINING cp_end_inlining + #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN + #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN cp_dump_tree + #undef LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN + #define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN cp_type_quals + + /* Each front end provides its own hooks, for toplev.c. */ + const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; + + /* Special routine to get the alias set for C++. */ + + static HOST_WIDE_INT + cxx_get_alias_set (t) + tree t; + { + /* It's not yet safe to use alias sets for classes in C++ because + the TYPE_FIELDs list for a class doesn't mention base classes. */ + if (AGGREGATE_TYPE_P (t)) + return 0; + + return c_common_get_alias_set (t); + } diff -Nrc3pad gcc-3.0.4/gcc/cp/cp-tree.def gcc-3.1/gcc/cp/cp-tree.def *** gcc-3.0.4/gcc/cp/cp-tree.def Sun May 13 07:10:19 2001 --- gcc-3.1/gcc/cp/cp-tree.def Sat Mar 16 01:07:59 2002 *************** DEFTREECODE (EMPTY_CLASS_EXPR, "empty_cl *** 84,93 **** only done for functions so far For class template: DECL_INITIAL associated templates (methods &c) ! DECL_RESULT null For non-class templates: TREE_TYPE type of object to be constructed ! DECL_RESULT decl for object to be created (e.g., FUNCTION_DECL with tmpl parms used) */ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0) --- 84,93 ---- only done for functions so far For class template: DECL_INITIAL associated templates (methods &c) ! DECL_TEMPLATE_RESULT null For non-class templates: TREE_TYPE type of object to be constructed ! DECL_TEMPLATE_RESULT decl for object to be created (e.g., FUNCTION_DECL with tmpl parms used) */ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0) *************** DEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PAR *** 163,168 **** --- 163,173 ---- of `T'. */ DEFTREECODE (TYPENAME_TYPE, "typename_type", 't', 0) + /* For template template argument of the form `T::template C'. + TYPE_CONTEXT is `T', the template parameter dependent object. + TYPE_NAME is an IDENTIFIER_NODE for `C', the member class template. */ + DEFTREECODE (UNBOUND_CLASS_TEMPLATE, "unbound_class_template", 't', 0) + /* A type designated by `__typeof (expr)'. TYPE_FIELDS is the expression in question. */ DEFTREECODE (TYPEOF_TYPE, "typeof_type", 't', 0) *************** DEFTREECODE (WRAPPER, "wrapper", 'x', 1) *** 203,211 **** unused. */ DEFTREECODE (LOOKUP_EXPR, "lookup_expr", 'e', 1) - /* Used to represent __PRETTY_FUNCTION__ in template bodies. */ - DEFTREECODE (FUNCTION_NAME, "function_name", 'e', 0) - /* A whole bunch of tree codes for the initial, superficial parsing of templates. */ DEFTREECODE (MODOP_EXPR, "modop_expr", 'e', 3) --- 208,213 ---- *************** DEFTREECODE (SUBOBJECT, "subobject", 'e' *** 228,245 **** the cleanups associated with any SUBOBJECT_CLEANUPS need no longer be run. */ DEFTREECODE (CTOR_STMT, "ctor_stmt", 'e', 0) ! /* A CLEANUP_STMT marks the point at which a declaration is fully ! constructed. If, after this point, the CLEANUP_DECL goes out of ! scope, the CLEANUP_EXPR must be run. */ ! DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", 'e', 2) ! /* A START_CATCH_STMT marks the beginning of a catch handler for the ! the START_CATCH_TYPE. If this is CATCH_ALL_TYPE, then the handler ! catches all types. */ ! DEFTREECODE (START_CATCH_STMT, "start_catch_stmt", 'e', 0) DEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", 'e', 2) DEFTREECODE (RETURN_INIT, "return_init", 'e', 2) DEFTREECODE (TRY_BLOCK, "try_block", 'e', 2) DEFTREECODE (EH_SPEC_BLOCK, "eh_spec_block", 'e', 2) DEFTREECODE (HANDLER, "handler", 'e', 2) /* A MUST_NOT_THROW_EXPR wraps an expression that may not --- 230,245 ---- the cleanups associated with any SUBOBJECT_CLEANUPS need no longer be run. */ DEFTREECODE (CTOR_STMT, "ctor_stmt", 'e', 0) ! /* CTOR_INITIALIZER is a placeholder in template code for a call to ! setup_vtbl_pointer (and appears in all functions, not just ctors). */ DEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", 'e', 2) DEFTREECODE (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 + CATCH_ALL_TYPE, then the handler catches all types. The declaration of + the catch variable is in HANDLER_PARMS, and the body block in + HANDLER_BODY. */ DEFTREECODE (HANDLER, "handler", 'e', 2) /* A MUST_NOT_THROW_EXPR wraps an expression that may not diff -Nrc3pad gcc-3.0.4/gcc/cp/cp-tree.h gcc-3.1/gcc/cp/cp-tree.h *** gcc-3.0.4/gcc/cp/cp-tree.h Sat Dec 8 16:12:51 2001 --- gcc-3.1/gcc/cp/cp-tree.h Tue Apr 23 21:51:13 2002 *************** *** 1,6 **** /* Definitions for C++ parsing and type checking. Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, ! 2000, 2001 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. --- 1,6 ---- /* Definitions for C++ parsing and type checking. Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, ! 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. *************** Boston, MA 02111-1307, USA. */ *** 25,32 **** #include "splay-tree.h" #include "varray.h" ! #ifndef _CP_TREE_H ! #define _CP_TREE_H #include "c-common.h" --- 25,36 ---- #include "splay-tree.h" #include "varray.h" ! #ifndef GCC_CP_TREE_H ! #define GCC_CP_TREE_H ! ! #ifndef __GNUC__ ! #error "You should be using 'make bootstrap' -- see installation instructions" ! #endif #include "c-common.h" *************** Boston, MA 02111-1307, USA. */ *** 87,93 **** Usage of DECL_LANG_FLAG_?: 0: DECL_ERROR_REPORTED (in VAR_DECL). ! DECL_TEMPLATE_PARM_P (in CONST_DECL, TYPE_DECL, or TEMPLATE_DECL) DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL) DECL_MUTABLE_P (in FIELD_DECL) 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL). --- 91,97 ---- Usage of DECL_LANG_FLAG_?: 0: DECL_ERROR_REPORTED (in VAR_DECL). ! DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL) DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL) DECL_MUTABLE_P (in FIELD_DECL) 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL). *************** Boston, MA 02111-1307, USA. */ *** 114,122 **** TYPE_BINFO For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO. ! For a TYPENAME_TYPE, this is TYPENAME_TYPE_FULLNAME. ! For a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM, ! this is TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. BINFO_VIRTUALS For a binfo, this is a TREE_LIST. The BV_DELTA of each node --- 118,124 ---- TYPE_BINFO For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO. ! For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS BINFO_VIRTUALS For a binfo, this is a TREE_LIST. The BV_DELTA of each node *************** Boston, MA 02111-1307, USA. */ *** 131,145 **** use a virtual thunk, as opposed to an ordinary thunk. The BV_FN is the declaration for the virtual function itself. - When CLASSTYPE_COM_INTERFACE_P does not hold, the first entry - does not have a BV_FN; it is just an offset. BINFO_VTABLE ! Sometimes this is a VAR_DECL. Under the new ABI, it is instead ! an expression with POINTER_TYPE pointing that gives the value to which the vptr should be initialized. Use get_vtbl_decl_for_binfo ! to extract the VAR_DECL for the complete vtable; that macro works ! in both ABIs. DECL_ARGUMENTS For a VAR_DECL this is DECL_ANON_UNION_ELEMS. --- 133,143 ---- use a virtual thunk, as opposed to an ordinary thunk. The BV_FN is the declaration for the virtual function itself. BINFO_VTABLE ! This is an expression with POINTER_TYPE that gives the value to which the vptr should be initialized. Use get_vtbl_decl_for_binfo ! to extract the VAR_DECL for the complete vtable. DECL_ARGUMENTS For a VAR_DECL this is DECL_ANON_UNION_ELEMS. *************** Boston, MA 02111-1307, USA. */ *** 160,186 **** #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) #define VAR_OR_FUNCTION_DECL_CHECK(NODE) \ ! ({ const tree __t = NODE; \ ! enum tree_code __c = TREE_CODE(__t); \ if (__c != VAR_DECL && __c != FUNCTION_DECL) \ tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \ __FUNCTION__); \ __t; }) #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \ ! ({ const tree __t = NODE; \ ! enum tree_code __c = TREE_CODE(__t); \ ! if (__c != VAR_DECL \ ! && __c != FUNCTION_DECL \ && __c != PARM_DECL) \ tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \ __FUNCTION__); \ __t; }) #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \ ! ({ const tree __t = NODE; \ ! enum tree_code __c = TREE_CODE(__t); \ ! if (__c != VAR_DECL \ && __c != FUNCTION_DECL \ && __c != TYPE_DECL \ && __c != TEMPLATE_DECL) \ --- 158,184 ---- #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) #define VAR_OR_FUNCTION_DECL_CHECK(NODE) \ ! ({ const tree __t = (NODE); \ ! enum tree_code const __c = TREE_CODE(__t); \ if (__c != VAR_DECL && __c != FUNCTION_DECL) \ tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \ __FUNCTION__); \ __t; }) #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \ ! ({ const tree __t = (NODE); \ ! enum tree_code const __c = TREE_CODE(__t); \ ! if (__c != VAR_DECL \ ! && __c != FUNCTION_DECL \ && __c != PARM_DECL) \ tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \ __FUNCTION__); \ __t; }) #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \ ! ({ const tree __t = (NODE); \ ! enum tree_code const __c = TREE_CODE(__t); \ ! if (__c != VAR_DECL \ && __c != FUNCTION_DECL \ && __c != TYPE_DECL \ && __c != TEMPLATE_DECL) \ *************** Boston, MA 02111-1307, USA. */ *** 189,207 **** __t; }) #define RECORD_OR_UNION_TYPE_CHECK(NODE) \ ! ({ const tree __t = NODE; \ ! enum tree_code __c = TREE_CODE(__t); \ if (__c != RECORD_TYPE && __c != UNION_TYPE) \ tree_check_failed (__t, RECORD_TYPE, __FILE__, __LINE__, \ __FUNCTION__); \ __t; }) #else /* not ENABLE_TREE_CHECKING, or not gcc */ ! #define VAR_OR_FUNCTION_DECL_CHECK(NODE) NODE ! #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) NODE ! #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) NODE ! #define RECORD_OR_UNION_TYPE_CHECK(NODE) NODE #endif --- 187,214 ---- __t; }) #define RECORD_OR_UNION_TYPE_CHECK(NODE) \ ! ({ const tree __t = (NODE); \ ! enum tree_code const __c = TREE_CODE(__t); \ if (__c != RECORD_TYPE && __c != UNION_TYPE) \ tree_check_failed (__t, RECORD_TYPE, __FILE__, __LINE__, \ __FUNCTION__); \ __t; }) + #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \ + ({ const tree __t = (NODE); \ + enum tree_code const __c = TREE_CODE(__t); \ + if (__c != BOUND_TEMPLATE_TEMPLATE_PARM) \ + tree_check_failed (__t, BOUND_TEMPLATE_TEMPLATE_PARM, \ + __FILE__, __LINE__, __FUNCTION__); \ + __t; }) + #else /* not ENABLE_TREE_CHECKING, or not gcc */ ! #define VAR_OR_FUNCTION_DECL_CHECK(NODE) (NODE) ! #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) (NODE) ! #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) (NODE) ! #define RECORD_OR_UNION_TYPE_CHECK(NODE) (NODE) ! #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) (NODE) #endif *************** Boston, MA 02111-1307, USA. */ *** 213,222 **** extern int flag_use_cxa_atexit; - /* Nonzero to not ignore namespace std. */ - - extern int flag_honor_std; - /* Nonzero means generate 'rtti' that give run-time type information. */ extern int flag_rtti; --- 220,225 ---- *************** extern int flag_rtti; *** 226,290 **** extern int flag_huge_objects; - /* Nonzero if virtual base class offsets are stored in the virtual - function table. Zero if, instead, a pointer to the virtual base is - stored in the object itself. */ - #define vbase_offsets_in_vtable_p() (1) - - /* Nonzero if displacements to the `this' pointer to use when calling - virtual functions in a virtual base class are present in the - vtable. */ - #define vcall_offsets_in_vtable_p() (1) - - /* Nonzero if a derived class that needs a vptr should always get one, - even if a non-primary base class already has one. For example, - given: - - struct S { int i; virtual void f(); }; - struct T : virtual public S {}; - - one could either reuse the vptr in `S' for `T', or create a new - vptr for `T'. If this flag is nonzero we choose the latter - alternative; otherwise, we choose the former. */ - #define vptrs_present_everywhere_p() (1) - - /* Nonzero if the vtable for a derived class should contain the - virtual functions from the primary base and all virtual functions - present in the class itself. Zero if, instead, it should contain - only those virtual functions from the primary base together with - the functions declared in the derived class (but not in any base - class). */ - #define all_overridden_vfuns_in_vtables_p() (1) - - /* Nonzero if primary and secondary vtables are combined into a single - vtable. */ - #define merge_primary_and_secondary_vtables_p() (1) - /* Language-dependent contents of an identifier. */ struct lang_identifier { ! struct tree_identifier ignore; tree namespace_bindings; tree bindings; tree class_value; tree class_template_info; struct lang_id2 *x; - enum rid rid_code; }; /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a keyword. C_RID_CODE (node) is then the RID_* value of the keyword, and C_RID_YYCODE is the token number wanted by Yacc. */ ! #define C_IS_RESERVED_WORD(id) TREE_LANG_FLAG_5 (id) ! #define C_RID_CODE(id) \ ! (((struct lang_identifier *) (id))->rid_code) extern const short rid_to_yy[RID_MAX]; ! #define C_RID_YYCODE(id) \ ! rid_to_yy[((struct lang_identifier *) (id))->rid_code] #define LANG_IDENTIFIER_CAST(NODE) \ ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE)) --- 229,255 ---- extern int flag_huge_objects; /* Language-dependent contents of an identifier. */ struct lang_identifier { ! struct c_common_identifier ignore; tree namespace_bindings; tree bindings; tree class_value; tree class_template_info; struct lang_id2 *x; }; /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a keyword. C_RID_CODE (node) is then the RID_* value of the keyword, and C_RID_YYCODE is the token number wanted by Yacc. */ ! #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID) extern const short rid_to_yy[RID_MAX]; ! #define C_RID_YYCODE(ID) rid_to_yy[C_RID_CODE (ID)] #define LANG_IDENTIFIER_CAST(NODE) \ ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE)) *************** typedef struct ptrmem_cst *** 316,372 **** struct tree_common common; /* This isn't used, but the middle-end expects all constants to have this field. */ ! struct rtx_def *rtl; tree member; }* ptrmem_cst_t; /* Nonzero if this binding is for a local scope, as opposed to a class or namespace scope. */ ! #define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0(NODE) /* Nonzero if BINDING_VALUE is from a base class of the class which is currently being defined. */ ! #define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1(NODE) /* For a binding between a name and an entity at a non-local scope, defines the scope where the binding is declared. (Either a class _TYPE node, or a NAMESPACE_DECL.) This macro should be used only for namespace-level bindings; on the IDENTIFIER_BINDING list BINDING_LEVEL is used instead. */ ! #define BINDING_SCOPE(NODE) (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->scope.scope) /* Nonzero if NODE has BINDING_LEVEL, rather than BINDING_SCOPE. */ ! #define BINDING_HAS_LEVEL_P(NODE) TREE_LANG_FLAG_2 ((NODE)) /* This is the declaration bound to the name. Possible values: variable, overloaded function, namespace, template, enumerator. */ ! #define BINDING_VALUE(NODE) (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->value) /* If name is bound to a type, this is the type (struct, union, enum). */ ! #define BINDING_TYPE(NODE) TREE_TYPE(NODE) #define IDENTIFIER_GLOBAL_VALUE(NODE) \ ! namespace_binding (NODE, global_namespace) #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \ ! set_namespace_binding (NODE, global_namespace, VAL) #define IDENTIFIER_NAMESPACE_VALUE(NODE) \ ! namespace_binding (NODE, current_namespace) #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \ ! set_namespace_binding (NODE, current_namespace, VAL) #define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE)) - #define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0) - #define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1) /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual sense of `same'. */ ! #define same_type_p(type1, type2) \ ! comptypes ((type1), (type2), COMPARE_STRICT) /* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring top-level qualifiers. */ ! #define same_type_ignoring_top_level_qualifiers_p(type1, type2) \ ! same_type_p (TYPE_MAIN_VARIANT (type1), TYPE_MAIN_VARIANT (type2)) /* Non-zero if we are presently building a statement tree, rather than expanding each statement as we encounter it. */ --- 281,337 ---- struct tree_common common; /* This isn't used, but the middle-end expects all constants to have this field. */ ! rtx rtl; tree member; }* ptrmem_cst_t; /* Nonzero if this binding is for a local scope, as opposed to a class or namespace scope. */ ! #define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0 (NODE) /* Nonzero if BINDING_VALUE is from a base class of the class which is currently being defined. */ ! #define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1 (NODE) /* For a binding between a name and an entity at a non-local scope, defines the scope where the binding is declared. (Either a class _TYPE node, or a NAMESPACE_DECL.) This macro should be used only for namespace-level bindings; on the IDENTIFIER_BINDING list BINDING_LEVEL is used instead. */ ! #define BINDING_SCOPE(NODE) \ ! (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->scope.scope) /* Nonzero if NODE has BINDING_LEVEL, rather than BINDING_SCOPE. */ ! #define BINDING_HAS_LEVEL_P(NODE) TREE_LANG_FLAG_2 (NODE) /* This is the declaration bound to the name. Possible values: variable, overloaded function, namespace, template, enumerator. */ ! #define BINDING_VALUE(NODE) \ ! (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->value) /* If name is bound to a type, this is the type (struct, union, enum). */ ! #define BINDING_TYPE(NODE) TREE_TYPE (NODE) #define IDENTIFIER_GLOBAL_VALUE(NODE) \ ! namespace_binding ((NODE), global_namespace) #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \ ! set_namespace_binding ((NODE), global_namespace, (VAL)) #define IDENTIFIER_NAMESPACE_VALUE(NODE) \ ! namespace_binding ((NODE), current_namespace) #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \ ! set_namespace_binding ((NODE), current_namespace, (VAL)) #define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE)) /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual sense of `same'. */ ! #define same_type_p(TYPE1, TYPE2) \ ! comptypes ((TYPE1), (TYPE2), COMPARE_STRICT) /* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring top-level qualifiers. */ ! #define same_type_ignoring_top_level_qualifiers_p(TYPE1, TYPE2) \ ! same_type_p (TYPE_MAIN_VARIANT (TYPE1), TYPE_MAIN_VARIANT (TYPE2)) /* Non-zero if we are presently building a statement tree, rather than expanding each statement as we encounter it. */ *************** struct tree_binding *** 391,407 **** }; /* The overloaded FUNCTION_DECL. */ ! #define OVL_FUNCTION(NODE) (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function) ! #define OVL_CHAIN(NODE) TREE_CHAIN(NODE) /* Polymorphic access to FUNCTION and CHAIN. */ #define OVL_CURRENT(NODE) \ ! ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE) #define OVL_NEXT(NODE) \ ! ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE) /* If set, this was imported in a using declaration. This is not to confuse with being used somewhere, which is not important for this node. */ ! #define OVL_USED(NODE) TREE_USED(NODE) struct tree_overload { --- 356,373 ---- }; /* The overloaded FUNCTION_DECL. */ ! #define OVL_FUNCTION(NODE) \ ! (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function) ! #define OVL_CHAIN(NODE) TREE_CHAIN (NODE) /* Polymorphic access to FUNCTION and CHAIN. */ #define OVL_CURRENT(NODE) \ ! ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE)) #define OVL_NEXT(NODE) \ ! ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE) /* If set, this was imported in a using declaration. This is not to confuse with being used somewhere, which is not important for this node. */ ! #define OVL_USED(NODE) TREE_USED (NODE) struct tree_overload { *************** struct tree_srcloc *** 474,537 **** type. For namespace scope, the presence of a type in any namespace is indicated with global_type_node, and the real type behind must be found through lookup. */ ! #define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE)) ! #define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE)) ! #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE) #define IDENTIFIER_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 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \ LANG_IDENTIFIER_CAST (NODE)->x->NAME = (VALUE)) ! #define IDENTIFIER_LABEL_VALUE(NODE) LANG_ID_FIELD(label_value, NODE) ! #define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \ ! SET_LANG_ID(NODE, VALUE, label_value) ! #define IDENTIFIER_IMPLICIT_DECL(NODE) LANG_ID_FIELD(implicit_decl, NODE) ! #define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \ ! SET_LANG_ID(NODE, VALUE, implicit_decl) ! #define IDENTIFIER_ERROR_LOCUS(NODE) LANG_ID_FIELD(error_locus, NODE) ! #define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \ ! SET_LANG_ID(NODE, VALUE, error_locus) /* Nonzero if this identifier is used as a virtual function name somewhere (optimizes searches). */ ! #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE) /* Nonzero if this identifier is the prefix for a mangled C++ operator name. */ ! #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE) /* Nonzero if this identifier is the name of a type-conversion operator. */ #define IDENTIFIER_TYPENAME_P(NODE) \ ! (TREE_LANG_FLAG_4 (NODE)) /* Nonzero if this identifier is the name of a constructor or destructor. */ #define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \ TREE_LANG_FLAG_3 (NODE) - /* Nonzero means reject anything that ISO standard C++ forbids. */ - extern int pedantic; - /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ ! #define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type) ! ! /* Record in each node resulting from a binary operator ! what operator was specified for it. */ ! #define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp)) /* Store a value in that field. */ ! #define C_SET_EXP_ORIGINAL_CODE(exp, code) \ ! (TREE_COMPLEXITY (exp) = (int)(code)) /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the next exception handler. */ --- 440,499 ---- type. For namespace scope, the presence of a type in any namespace is indicated with global_type_node, and the real type behind must be found through lookup. */ ! #define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE) ! #define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE) ! #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE)) #define IDENTIFIER_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 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \ LANG_IDENTIFIER_CAST (NODE)->x->NAME = (VALUE)) ! #define IDENTIFIER_LABEL_VALUE(NODE) \ ! LANG_ID_FIELD (label_value, NODE) ! #define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \ ! SET_LANG_ID (NODE, VALUE, label_value) ! #define IDENTIFIER_IMPLICIT_DECL(NODE) \ ! LANG_ID_FIELD (implicit_decl, NODE) ! #define SET_IDENTIFIER_IMPLICIT_DECL(NODE, VALUE) \ ! SET_LANG_ID (NODE, VALUE, implicit_decl) ! #define IDENTIFIER_ERROR_LOCUS(NODE) \ ! LANG_ID_FIELD (error_locus, NODE) ! #define SET_IDENTIFIER_ERROR_LOCUS(NODE, VALUE) \ ! SET_LANG_ID (NODE, VALUE, error_locus) /* Nonzero if this identifier is used as a virtual function name somewhere (optimizes searches). */ ! #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE) /* Nonzero if this identifier is the prefix for a mangled C++ operator name. */ ! #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE) /* Nonzero if this identifier is the name of a type-conversion operator. */ #define IDENTIFIER_TYPENAME_P(NODE) \ ! TREE_LANG_FLAG_4 (NODE) /* Nonzero if this identifier is the name of a constructor or destructor. */ #define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \ TREE_LANG_FLAG_3 (NODE) /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ ! #define C_TYPE_FIELDS_READONLY(TYPE) TYPE_LANG_FLAG_0 (TYPE) /* Store a value in that field. */ ! #define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \ ! (TREE_COMPLEXITY (EXP) = (int)(CODE)) /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the next exception handler. */ *************** enum cp_tree_index *** 575,586 **** CPTI_VTBL_TYPE, CPTI_VTBL_PTR_TYPE, CPTI_STD, - CPTI_FAKE_STD, CPTI_ABI, CPTI_TYPE_INFO_TYPE, - CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE, - CPTI_TINFO_VAR_ID, CPTI_ABORT_FNDECL, CPTI_GLOBAL_DELETE_FNDECL, CPTI_AGGR_TAG, --- 537,545 ---- *************** enum cp_tree_index *** 601,615 **** CPTI_COMPLETE_DTOR_IDENTIFIER, CPTI_BASE_DTOR_IDENTIFIER, CPTI_DELETING_DTOR_IDENTIFIER, - CPTI_DELTA2_IDENTIFIER, CPTI_DELTA_IDENTIFIER, CPTI_IN_CHARGE_IDENTIFIER, CPTI_VTT_PARM_IDENTIFIER, - CPTI_INDEX_IDENTIFIER, CPTI_NELTS_IDENTIFIER, CPTI_THIS_IDENTIFIER, CPTI_PFN_IDENTIFIER, - CPTI_PFN_OR_DELTA2_IDENTIFIER, CPTI_VPTR_IDENTIFIER, CPTI_STD_IDENTIFIER, --- 560,571 ---- *************** extern tree cp_global_trees[CPTI_MAX]; *** 643,650 **** #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL] #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE] /* The type used to represent an offset by which to adjust the `this' ! pointer in pointer-to-member types and, when not using vtable ! thunks, in vtables. */ #define delta_type_node cp_global_trees[CPTI_DELTA_TYPE] /* The type used to represent an index into the vtable. */ #define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE] --- 599,605 ---- #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL] #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE] /* The type used to represent an offset by which to adjust the `this' ! pointer in pointer-to-member types. */ #define delta_type_node cp_global_trees[CPTI_DELTA_TYPE] /* The type used to represent an index into the vtable. */ #define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE] *************** extern tree cp_global_trees[CPTI_MAX]; *** 668,686 **** #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] - /* When the `std' namespace is a real namespace, this is the - corresponding NAMESPACE_DECL. When the `std' namespace is an alias - for the global namespace, this is NULL_TREE. */ #define std_node cp_global_trees[CPTI_STD] - /* When the `std' namespace is a real namespace, this is the - ERROR_MARK_NODE. Otherwise, this is a dummy NAMESPACE_DECL that - should be treated like the global namespace. */ - #define fake_std_node cp_global_trees[CPTI_FAKE_STD] #define abi_node cp_global_trees[CPTI_ABI] #define type_info_type_node cp_global_trees[CPTI_TYPE_INFO_TYPE] - #define tinfo_decl_id cp_global_trees[CPTI_TINFO_DECL_ID] #define tinfo_decl_type cp_global_trees[CPTI_TINFO_DECL_TYPE] - #define tinfo_var_id cp_global_trees[CPTI_TINFO_VAR_ID] #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] --- 623,632 ---- *************** extern tree cp_global_trees[CPTI_MAX]; *** 720,739 **** /* The name of a destructor that destroys virtual base classes, and then deletes the entire object. */ #define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER] - - #define delta2_identifier cp_global_trees[CPTI_DELTA2_IDENTIFIER] #define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER] #define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER] - /* The name of the parameter that contains a pointer to the VTT to use for this subobject constructor or destructor. */ #define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER] - - #define index_identifier cp_global_trees[CPTI_INDEX_IDENTIFIER] #define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER] #define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER] #define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER] - #define pfn_or_delta2_identifier cp_global_trees[CPTI_PFN_OR_DELTA2_IDENTIFIER] #define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER] /* The name of the std namespace. */ #define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER] --- 666,679 ---- *************** extern tree cp_global_trees[CPTI_MAX]; *** 774,795 **** /* Global state. */ ! struct saved_scope { tree old_bindings; tree old_namespace; tree class_name; tree class_type; tree access_specifier; tree function_decl; varray_type lang_base; - tree *lang_stack; tree lang_name; tree template_parms; tree x_previous_class_type; tree x_previous_class_values; tree x_saved_tree; - tree incomplete; tree lookups; HOST_WIDE_INT x_processing_template_decl; int x_processing_specialization; --- 714,736 ---- /* Global state. */ ! struct saved_scope ! { tree old_bindings; tree old_namespace; + tree decl_ns_list; tree class_name; tree class_type; tree access_specifier; tree function_decl; varray_type lang_base; tree lang_name; tree template_parms; tree x_previous_class_type; tree x_previous_class_values; tree x_saved_tree; tree lookups; + tree last_parms; HOST_WIDE_INT x_processing_template_decl; int x_processing_specialization; *************** struct saved_scope { *** 808,813 **** --- 749,758 ---- #define current_namespace scope_chain->old_namespace + /* The stack for namespaces of current declarations. */ + + #define decl_namespace_list scope_chain->decl_ns_list + /* IDENTIFIER_NODE: name of current class */ #define current_class_name scope_chain->class_name *************** struct saved_scope { *** 825,831 **** /* Pointer to the top of the language name stack. */ - #define current_lang_stack scope_chain->lang_stack #define current_lang_base scope_chain->lang_base #define current_lang_name scope_chain->lang_name --- 770,775 ---- *************** struct saved_scope { *** 849,885 **** #define previous_class_values scope_chain->x_previous_class_values - /* A list of the declarations with incomplete type at namespace scope. */ - - #define namespace_scope_incomplete scope_chain->incomplete - /* A list of private types mentioned, for deferred access checking. */ #define type_lookups scope_chain->lookups extern struct saved_scope *scope_chain; /* Global state pertinent to the current function. */ struct cp_language_function { struct language_function base; - tree x_ctor_label; tree x_dtor_label; tree x_current_class_ptr; tree x_current_class_ref; tree x_eh_spec_block; tree x_in_charge_parm; tree x_vtt_parm; tree *x_vcalls_possible_p; int returns_value; int returns_null; int in_function_try_handler; int x_expanding_p; - int vtbls_set_up_p; struct named_label_use_list *x_named_label_uses; struct named_label_list *x_named_labels; --- 793,827 ---- #define previous_class_values scope_chain->x_previous_class_values /* A list of private types mentioned, for deferred access checking. */ #define type_lookups scope_chain->lookups extern struct saved_scope *scope_chain; + struct unparsed_text; + /* Global state pertinent to the current function. */ struct cp_language_function { struct language_function base; tree x_dtor_label; tree x_current_class_ptr; tree x_current_class_ref; tree x_eh_spec_block; tree x_in_charge_parm; tree x_vtt_parm; + tree x_return_value; tree *x_vcalls_possible_p; int returns_value; int returns_null; + int returns_abnormally; int in_function_try_handler; int x_expanding_p; struct named_label_use_list *x_named_label_uses; struct named_label_list *x_named_labels; *************** struct cp_language_function *** 887,892 **** --- 829,835 ---- varray_type x_local_names; const char *cannot_inline; + struct unparsed_text *unparsed_inlines; }; /* The current C++-specific per-function global variables. */ *************** struct cp_language_function *** 899,909 **** #define dtor_label cp_function_chain->x_dtor_label - /* In a constructor, the point at which we are ready to return - the pointer to the initialized object. */ - - #define ctor_label cp_function_chain->x_ctor_label - /* When we're processing a member function, current_class_ptr is the PARM_DECL for the `this' pointer. The current_class_ref is an expression for `*this'. */ --- 842,847 ---- *************** struct cp_language_function *** 944,953 **** #define current_function_returns_null cp_function_chain->returns_null ! /* Nonzero if we have already generated code to initialize virtual ! function tables in this function. */ ! #define vtbls_set_up_p cp_function_chain->vtbls_set_up_p /* Non-zero if we should generate RTL for functions that we process. When this is zero, we just accumulate tree structure, without --- 882,892 ---- #define current_function_returns_null cp_function_chain->returns_null ! /* Set to 0 at beginning of a function definition, set to 1 if ! a call to a noreturn function is seen. */ ! #define current_function_returns_abnormally \ ! cp_function_chain->returns_abnormally /* Non-zero if we should generate RTL for functions that we process. When this is zero, we just accumulate tree structure, without *************** struct cp_language_function *** 962,974 **** #define in_function_try_handler cp_function_chain->in_function_try_handler ! /* Nonzero if __FUNCTION__ and its ilk have been declared in this ! function. */ ! #define function_name_declared_p \ ! (cp_function_chain->base.x_function_name_declared_p) - extern tree current_function_return_value; extern tree global_namespace; #define ansi_opname(CODE) \ --- 901,912 ---- #define in_function_try_handler cp_function_chain->in_function_try_handler ! /* Expression always returned from function, or error_mark_node ! otherwise, for use by the automatic named return value optimization. */ ! #define current_function_return_value \ ! (cp_function_chain->x_return_value) extern tree global_namespace; #define ansi_opname(CODE) \ *************** extern int flag_no_gnu_keywords; *** 992,1001 **** extern int flag_operator_names; - /* For cross referencing. */ - - extern int flag_gnu_xref; - /* For environments where you can use GNU binutils (as, ld in particular). */ extern int flag_gnu_binutils; --- 930,935 ---- *************** extern int warn_implicit; *** 1009,1029 **** extern int warn_ctor_dtor_privacy; - /* Nonzero means warn about function definitions that default the return type - or that use a null return and have a return-type other than void. */ - - extern int warn_return_type; - /* Nonzero means warn about deprecated conversion from string constant to `char *'. */ extern int warn_write_strings; - /* Nonzero means warn about sizeof(function) or addition/subtraction - of function pointers. */ - - extern int warn_pointer_arith; - /* Nonzero means warn about multiple (redundant) decls for the same single variable or function. */ --- 943,953 ---- *************** extern int warn_old_style_cast; *** 1077,1091 **** extern int warn_reorder; /* Nonzero means to treat bitfields as unsigned unless they say `signed'. */ extern int flag_signed_bitfields; - /* True for more efficient but incompatible (not fully tested) - vtable implementation (using thunks). - 0 is old behavior; 1 is new behavior. */ - extern int flag_vtable_thunks; - /* INTERFACE_ONLY nonzero means that we are in an "interface" section of the compiler. INTERFACE_UNKNOWN nonzero means we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN --- 1001,1014 ---- extern int warn_reorder; + /* Non-zero means warn about deprecated features. */ + + extern int warn_deprecated; + /* Nonzero means to treat bitfields as unsigned unless they say `signed'. */ extern int flag_signed_bitfields; /* INTERFACE_ONLY nonzero means that we are in an "interface" section of the compiler. INTERFACE_UNKNOWN nonzero means we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN *************** extern int flag_access_control; *** 1138,1147 **** extern int flag_check_new; - /* Nonnull if we want to dump class heirarchies. */ - - extern const char *flag_dump_class_layout; - /* C++ language-specific tree codes. */ #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM, --- 1061,1066 ---- *************** enum languages { lang_c, lang_cplusplus, *** 1161,1168 **** #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE))) #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE))) ! #define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE)))) ! #define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE)))) /* Nonzero if NODE has no name for linkage purposes. */ #define TYPE_ANONYMOUS_P(NODE) \ --- 1080,1089 ---- #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE))) #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE))) ! #define TYPE_ASSEMBLER_NAME_STRING(NODE) \ ! (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE)))) ! #define TYPE_ASSEMBLER_NAME_LENGTH(NODE) \ ! (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE)))) /* Nonzero if NODE has no name for linkage purposes. */ #define TYPE_ANONYMOUS_P(NODE) \ *************** enum languages { lang_c, lang_cplusplus, *** 1176,1187 **** template template parameters. Despite its name, this macro has nothing to do with the definition of aggregate given in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */ ! #define IS_AGGR_TYPE(t) \ ! (TREE_CODE (t) == TEMPLATE_TYPE_PARM \ ! || TREE_CODE (t) == TYPENAME_TYPE \ ! || TREE_CODE (t) == TYPEOF_TYPE \ ! || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM \ ! || TYPE_LANG_FLAG_5 (t)) /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or union type. */ --- 1097,1108 ---- template template parameters. Despite its name, this macro has nothing to do with the definition of aggregate given in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */ ! #define IS_AGGR_TYPE(T) \ ! (TREE_CODE (T) == TEMPLATE_TYPE_PARM \ ! || TREE_CODE (T) == TYPENAME_TYPE \ ! || TREE_CODE (T) == TYPEOF_TYPE \ ! || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \ ! || TYPE_LANG_FLAG_5 (T)) /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or union type. */ *************** enum languages { lang_c, lang_cplusplus, *** 1190,1269 **** /* Nonzero if T is a class type. Zero for template type parameters, typename types, and so forth. */ ! #define CLASS_TYPE_P(t) \ ! (IS_AGGR_TYPE_CODE (TREE_CODE (t)) && IS_AGGR_TYPE (t)) ! #define 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) ! ! /* The type qualifiers for this type, including the qualifiers on the ! elements for an array type. */ ! #define CP_TYPE_QUALS(NODE) C_TYPE_QUALS (NODE) /* Nonzero if this type is const-qualified. */ #define CP_TYPE_CONST_P(NODE) \ ! ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_CONST) != 0) /* Nonzero if this type is volatile-qualified. */ #define CP_TYPE_VOLATILE_P(NODE) \ ! ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_VOLATILE) != 0) /* Nonzero if this type is restrict-qualified. */ #define CP_TYPE_RESTRICT_P(NODE) \ ! ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_RESTRICT) != 0) /* Nonzero if this type is const-qualified, but not volatile-qualified. Other qualifiers are ignored. This macro is used to test whether or not it is OK to bind an rvalue to a reference. */ #define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \ ! ((CP_TYPE_QUALS (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \ == TYPE_QUAL_CONST) - /* Virtual function addresses can be gotten from a virtual function - table entry using this macro. */ - #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \ - (!flag_vtable_thunks ? \ - TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \ - : !DECL_THUNK_P (TREE_OPERAND ((ENTRY), 0)) \ - ? (ENTRY) \ - : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0))) - #define FUNCTION_ARG_CHAIN(NODE) \ ! (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE)))) /* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES which refers to a user-written parameter. */ #define FUNCTION_FIRST_USER_PARMTYPE(NODE) \ ! (skip_artificial_parms_for (NODE, TYPE_ARG_TYPES (TREE_TYPE (NODE)))) /* Similarly, but for DECL_ARGUMENTS. */ #define FUNCTION_FIRST_USER_PARM(NODE) \ ! (skip_artificial_parms_for (NODE, DECL_ARGUMENTS (NODE))) ! #define PROMOTES_TO_AGGR_TYPE(NODE,CODE) \ (((CODE) == TREE_CODE (NODE) \ ! && IS_AGGR_TYPE (TREE_TYPE (NODE))) \ || IS_AGGR_TYPE (NODE)) ! /* Nonzero iff TYPE is uniquely derived from PARENT. Under MI, PARENT can ! be an ambiguous base class of TYPE, and this macro will be false. */ ! #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0) ! #define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0) ! #define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0) ! #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 2, (tree *)0) >= 0) ! #define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1) /* This structure provides additional information above and beyond what is provide in the ordinary tree_type. In the past, we used it --- 1111,1185 ---- /* Nonzero if T is a class type. Zero for template type parameters, typename types, and so forth. */ ! #define CLASS_TYPE_P(T) \ ! (IS_AGGR_TYPE_CODE (TREE_CODE (T)) && IS_AGGR_TYPE (T)) ! #define 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) /* Nonzero if this type is const-qualified. */ #define CP_TYPE_CONST_P(NODE) \ ! ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0) /* Nonzero if this type is volatile-qualified. */ #define CP_TYPE_VOLATILE_P(NODE) \ ! ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0) /* Nonzero if this type is restrict-qualified. */ #define CP_TYPE_RESTRICT_P(NODE) \ ! ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0) /* Nonzero if this type is const-qualified, but not volatile-qualified. Other qualifiers are ignored. This macro is used to test whether or not it is OK to bind an rvalue to a reference. */ #define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \ ! ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \ == TYPE_QUAL_CONST) #define FUNCTION_ARG_CHAIN(NODE) \ ! TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))) /* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES which refers to a user-written parameter. */ #define FUNCTION_FIRST_USER_PARMTYPE(NODE) \ ! skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE))) /* Similarly, but for DECL_ARGUMENTS. */ #define FUNCTION_FIRST_USER_PARM(NODE) \ ! skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE)) ! #define PROMOTES_TO_AGGR_TYPE(NODE, CODE) \ (((CODE) == TREE_CODE (NODE) \ ! && IS_AGGR_TYPE (TREE_TYPE (NODE))) \ || IS_AGGR_TYPE (NODE)) ! /* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and ! ambiguity issues. */ ! #define DERIVED_FROM_P(PARENT, TYPE) \ ! lookup_base ((TYPE), PARENT, ba_any, NULL) ! /* Nonzero iff TYPE is uniquely derived from PARENT. Ignores ! accessibility. */ ! #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) \ ! lookup_base ((TYPE), (PARENT), ba_ignore | ba_quiet, NULL) ! /* Nonzero iff TYPE is accessible in the current scope and uniquely ! derived from PARENT. */ ! #define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \ ! lookup_base ((TYPE), (PARENT), ba_check | ba_quiet, NULL) ! /* Nonzero iff TYPE is publicly & uniquely derived from PARENT. */ ! #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \ ! lookup_base ((TYPE), (PARENT), ba_not_special | ba_quiet, NULL) /* This structure provides additional information above and beyond what is provide in the ordinary tree_type. In the past, we used it *************** struct lang_type *** 1295,1301 **** unsigned com_interface : 1; unsigned non_pod_class : 1; unsigned nearly_empty_p : 1; ! unsigned vtable_needs_writing : 1; unsigned has_assign_ref : 1; unsigned has_new : 1; unsigned has_array_new : 1; --- 1211,1217 ---- unsigned com_interface : 1; unsigned non_pod_class : 1; unsigned nearly_empty_p : 1; ! unsigned user_align : 1; unsigned has_assign_ref : 1; unsigned has_new : 1; unsigned has_array_new : 1; *************** struct lang_type *** 1309,1315 **** unsigned needs_virtual_reinit : 1; unsigned marks: 6; ! unsigned vec_delete_takes_size : 1; unsigned declared_class : 1; unsigned being_defined : 1; --- 1225,1231 ---- unsigned needs_virtual_reinit : 1; unsigned marks: 6; ! unsigned vec_new_uses_cookie : 1; unsigned declared_class : 1; unsigned being_defined : 1; *************** struct lang_type *** 1327,1333 **** unsigned has_abstract_assign_ref : 1; unsigned non_aggregate : 1; unsigned is_partial_instantiation : 1; ! unsigned user_align : 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 --- 1243,1249 ---- unsigned has_abstract_assign_ref : 1; unsigned non_aggregate : 1; unsigned is_partial_instantiation : 1; ! unsigned java_interface : 1; /* When adding a flag here, consider whether or not it ought to apply to a template instance if it applies to the template. If *************** struct lang_type *** 1336,1343 **** /* 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 java_interface : 1; ! unsigned dummy : 7; int vsize; --- 1252,1258 ---- /* There are some bits left to fill out a 32-bit word. Keep track of this by updating the size of this bitfield whenever you add or remove a flag. */ ! unsigned dummy : 8; int vsize; *************** struct lang_type *** 1360,1402 **** 1=implicit template instantiation 2=explicit template specialization 3=explicit template instantiation */ ! #define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->use_template) /* Fields used for storing information before the class is defined. After the class is defined, these fields hold other information. */ /* List of friends which were defined inline in this class definition. */ ! #define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE)) /* Nonzero for _CLASSTYPE means that operator delete is defined. */ ! #define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->gets_delete) #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1) - /* Nonzero for _CLASSTYPE means that operator vec delete is defined and - takes the optional size_t argument. */ - #define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \ - (TYPE_LANG_SPECIFIC(NODE)->vec_delete_takes_size) - /* Nonzero if `new NODE[x]' should cause the allocation of extra ! storage to indicate how many array elements are in use. The old ! ABI had a bug in that we always allocate the extra storage if NODE ! has a two-argument array operator delete. */ ! #define TYPE_VEC_NEW_USES_COOKIE(NODE) \ ! (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE) \ ! || (TYPE_LANG_SPECIFIC (NODE) \ ! && TYPE_VEC_DELETE_TAKES_SIZE (NODE))) /* Nonzero means that this _CLASSTYPE node defines ways of converting itself to other types. */ ! #define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_type_conversion) /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */ ! #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_assign_ref) ! #define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_const_assign_ref) /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */ ! #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_init_ref) ! #define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_const_init_ref) /* Nonzero if this class defines an overloaded operator new. (An operator new [] doesn't count.) */ --- 1275,1312 ---- 1=implicit template instantiation 2=explicit template specialization 3=explicit template instantiation */ ! #define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC (NODE)->use_template) /* Fields used for storing information before the class is defined. After the class is defined, these fields hold other information. */ /* List of friends which were defined inline in this class definition. */ ! #define CLASSTYPE_INLINE_FRIENDS(NODE) CLASSTYPE_PURE_VIRTUALS (NODE) /* Nonzero for _CLASSTYPE means that operator delete is defined. */ ! #define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC (NODE)->gets_delete) #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1) /* Nonzero if `new NODE[x]' should cause the allocation of extra ! storage to indicate how many array elements are in use. */ ! #define TYPE_VEC_NEW_USES_COOKIE(NODE) \ ! (CLASS_TYPE_P (NODE) \ ! && TYPE_LANG_SPECIFIC (NODE)->vec_new_uses_cookie) /* Nonzero means that this _CLASSTYPE node defines ways of converting itself to other types. */ ! #define TYPE_HAS_CONVERSION(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->has_type_conversion) /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */ ! #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_assign_ref) ! #define TYPE_HAS_CONST_ASSIGN_REF(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->has_const_assign_ref) /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */ ! #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_init_ref) ! #define TYPE_HAS_CONST_INIT_REF(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->has_const_init_ref) /* Nonzero if this class defines an overloaded operator new. (An operator new [] doesn't count.) */ *************** struct lang_type *** 1409,1440 **** /* Nonzero means that this type is being defined. I.e., the left brace starting the definition of this type has been seen. */ ! #define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->being_defined) /* Nonzero means that this type has been redefined. In this case, if convenient, don't reprocess any methods that appear in its redefinition. */ ! #define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->redefined) /* The is the basetype that contains NODE's rtti. */ ! #define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti) /* Nonzero means that this _CLASSTYPE node overloads operator(). */ ! #define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_call_overloaded) /* Nonzero means that this _CLASSTYPE node overloads operator[]. */ ! #define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_array_ref_overloaded) /* Nonzero means that this _CLASSTYPE node overloads operator->. */ ! #define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_arrow_overloaded) /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses multiple inheritance. If this is 0 for the root of a type hierarchy, then we can use more efficient search techniques. */ ! #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->uses_multiple_inheritance) /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses virtual base classes. If this is 0 for the root of a type hierarchy, then we can use more efficient search techniques. */ ! #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE)) /* Vector member functions defined in this class. Each element is either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All --- 1319,1354 ---- /* Nonzero means that this type is being defined. I.e., the left brace starting the definition of this type has been seen. */ ! #define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC (NODE)->being_defined) /* Nonzero means that this type has been redefined. In this case, if convenient, don't reprocess any methods that appear in its redefinition. */ ! #define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC (NODE)->redefined) /* The is the basetype that contains NODE's rtti. */ ! #define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC (NODE)->rtti) /* Nonzero means that this _CLASSTYPE node overloads operator(). */ ! #define TYPE_OVERLOADS_CALL_EXPR(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->has_call_overloaded) /* Nonzero means that this _CLASSTYPE node overloads operator[]. */ ! #define TYPE_OVERLOADS_ARRAY_REF(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->has_array_ref_overloaded) /* Nonzero means that this _CLASSTYPE node overloads operator->. */ ! #define TYPE_OVERLOADS_ARROW(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->has_arrow_overloaded) /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses multiple inheritance. If this is 0 for the root of a type hierarchy, then we can use more efficient search techniques. */ ! #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->uses_multiple_inheritance) /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses virtual base classes. If this is 0 for the root of a type hierarchy, then we can use more efficient search techniques. */ ! #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3 (NODE)) /* Vector member functions defined in this class. Each element is either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All *************** struct lang_type *** 1442,1448 **** two elements are for constructors, and destructors, respectively. Any conversion operators are next, followed by ordinary member functions. There may be empty entries at the end of the vector. */ ! #define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods) /* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */ #define CLASSTYPE_CONSTRUCTOR_SLOT 0 --- 1356,1362 ---- two elements are for constructors, and destructors, respectively. Any conversion operators are next, followed by ordinary member functions. There may be empty entries at the end of the vector. */ ! #define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC (NODE)->methods) /* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */ #define CLASSTYPE_CONSTRUCTOR_SLOT 0 *************** struct lang_type *** 1469,1475 **** /* Get the value of the Nth mark bit. */ #define CLASSTYPE_MARKED_N(NODE, N) \ (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->marks \ ! : ((unsigned) TYPE_ALIAS_SET (NODE))) & (1 << N)) != 0) /* Set the Nth mark bit. */ #define SET_CLASSTYPE_MARKED_N(NODE, N) \ --- 1383,1389 ---- /* Get the value of the Nth mark bit. */ #define CLASSTYPE_MARKED_N(NODE, N) \ (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->marks \ ! : ((unsigned) TYPE_ALIAS_SET (NODE))) & (1 << (N))) != 0) /* Set the Nth mark bit. */ #define SET_CLASSTYPE_MARKED_N(NODE, N) \ *************** struct lang_type *** 1484,1515 **** : (void) (TYPE_ALIAS_SET (NODE) &= ~(1 << (N)))) /* Get the value of the mark bits. */ ! #define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N(NODE, 0) ! #define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N(NODE, 1) ! #define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N(NODE, 2) ! #define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N(NODE, 3) ! #define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N(NODE, 4) ! #define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N(NODE, 5) /* Macros to modify the above flags */ ! #define SET_CLASSTYPE_MARKED(NODE) SET_CLASSTYPE_MARKED_N(NODE, 0) ! #define CLEAR_CLASSTYPE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 0) ! #define SET_CLASSTYPE_MARKED2(NODE) SET_CLASSTYPE_MARKED_N(NODE, 1) ! #define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 1) ! #define SET_CLASSTYPE_MARKED3(NODE) SET_CLASSTYPE_MARKED_N(NODE, 2) ! #define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 2) ! #define SET_CLASSTYPE_MARKED4(NODE) SET_CLASSTYPE_MARKED_N(NODE, 3) ! #define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 3) ! #define SET_CLASSTYPE_MARKED5(NODE) SET_CLASSTYPE_MARKED_N(NODE, 4) ! #define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 4) ! #define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N(NODE, 5) ! #define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 5) /* A list of the nested tag-types (class, struct, union, or enum) found within this class. The TREE_PURPOSE of each node is the name of the type; the TREE_VALUE is the type itself. This list includes nested member class templates. */ ! #define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags) /* Nonzero if NODE has a primary base class, i.e., a base class with which it shares the virtual function table pointer. */ --- 1398,1429 ---- : (void) (TYPE_ALIAS_SET (NODE) &= ~(1 << (N)))) /* Get the value of the mark bits. */ ! #define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N (NODE, 0) ! #define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N (NODE, 1) ! #define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N (NODE, 2) ! #define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N (NODE, 3) ! #define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N (NODE, 4) ! #define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N (NODE, 5) /* Macros to modify the above flags */ ! #define SET_CLASSTYPE_MARKED(NODE) SET_CLASSTYPE_MARKED_N (NODE, 0) ! #define CLEAR_CLASSTYPE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 0) ! #define SET_CLASSTYPE_MARKED2(NODE) SET_CLASSTYPE_MARKED_N (NODE, 1) ! #define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 1) ! #define SET_CLASSTYPE_MARKED3(NODE) SET_CLASSTYPE_MARKED_N (NODE, 2) ! #define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 2) ! #define SET_CLASSTYPE_MARKED4(NODE) SET_CLASSTYPE_MARKED_N (NODE, 3) ! #define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 3) ! #define SET_CLASSTYPE_MARKED5(NODE) SET_CLASSTYPE_MARKED_N (NODE, 4) ! #define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 4) ! #define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N (NODE, 5) ! #define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 5) /* A list of the nested tag-types (class, struct, union, or enum) found within this class. The TREE_PURPOSE of each node is the name of the type; the TREE_VALUE is the type itself. This list includes nested member class templates. */ ! #define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC (NODE)->tags) /* Nonzero if NODE has a primary base class, i.e., a base class with which it shares the virtual function table pointer. */ *************** struct lang_type *** 1524,1530 **** /* The number of virtual functions present in this class' virtual function table. */ ! #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize) /* A chain of BINFOs for the direct and indirect virtual base classes that this type uses in a post-order depth-first left-to-right --- 1438,1444 ---- /* The number of virtual functions present in this class' virtual function table. */ ! #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC (NODE)->vsize) /* A chain of BINFOs for the direct and indirect virtual base classes that this type uses in a post-order depth-first left-to-right *************** struct lang_type *** 1534,1540 **** list are all "real"; they are the same BINFOs that will be encountered when using dfs_unmarked_real_bases_queue_p and related functions. */ ! #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases) /* For a non-virtual BINFO, the BINFO itself; for a virtual BINFO, the binfo_for_vbase. C is the most derived class for the hierarchy --- 1448,1454 ---- list are all "real"; they are the same BINFOs that will be encountered when using dfs_unmarked_real_bases_queue_p and related functions. */ ! #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC (NODE)->vbases) /* For a non-virtual BINFO, the BINFO itself; for a virtual BINFO, the binfo_for_vbase. C is the most derived class for the hierarchy *************** struct lang_type *** 1542,1548 **** #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) \ --- 1456,1462 ---- #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) \ *************** struct lang_type *** 1550,1559 **** /* These are the size and alignment of the type without its virtual base classes, for when we use this type as a base itself. */ ! #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size) ! #define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->size_unit) ! #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align) ! #define CLASSTYPE_USER_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->user_align) /* The alignment of NODE, without its virtual bases, in bytes. */ #define CLASSTYPE_ALIGN_UNIT(NODE) \ --- 1464,1473 ---- /* These are the size and alignment of the type without its virtual base classes, for when we use this type as a base itself. */ ! #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC (NODE)->size) ! #define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC (NODE)->size_unit) ! #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC (NODE)->align) ! #define CLASSTYPE_USER_ALIGN(NODE) (TYPE_LANG_SPECIFIC (NODE)->user_align) /* The alignment of NODE, without its virtual bases, in bytes. */ #define CLASSTYPE_ALIGN_UNIT(NODE) \ *************** struct lang_type *** 1561,1572 **** /* True if this a Java interface type, declared with '__attribute__ ((java_interface))'. */ ! #define TYPE_JAVA_INTERFACE(NODE) (TYPE_LANG_SPECIFIC(NODE)->java_interface) /* A cons list of virtual functions which cannot be inherited by derived classes. When deriving from this type, the derived class must provide its own definition for each of these functions. */ ! #define CLASSTYPE_PURE_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->pure_virtuals) /* Nonzero means that this aggr type has been `closed' by a semicolon. */ #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->got_semicolon) --- 1475,1486 ---- /* True if this a Java interface type, declared with '__attribute__ ((java_interface))'. */ ! #define TYPE_JAVA_INTERFACE(NODE) (TYPE_LANG_SPECIFIC (NODE)->java_interface) /* A cons list of virtual functions which cannot be inherited by derived classes. When deriving from this type, the derived class must provide its own definition for each of these functions. */ ! #define CLASSTYPE_PURE_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC (NODE)->pure_virtuals) /* Nonzero means that this aggr type has been `closed' by a semicolon. */ #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->got_semicolon) *************** struct lang_type *** 1575,1591 **** set because base constructors have placed the wrong value there. If this is zero, it means that they placed the right value there, and there is no need to change it. */ ! #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->needs_virtual_reinit) ! ! /* Nonzero means that if this type has virtual functions, that ! the virtual function table will be written out. */ ! #define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->vtable_needs_writing) /* Nonzero means that this type has an X() constructor. */ ! #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_default_ctor) /* Nonzero means that this type contains a mutable member */ ! #define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_mutable) #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE)) /* Nonzero means that this class type is a non-POD class. */ --- 1489,1503 ---- set because base constructors have placed the wrong value there. If this is zero, it means that they placed the right value there, and there is no need to change it. */ ! #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->needs_virtual_reinit) /* Nonzero means that this type has an X() constructor. */ ! #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->has_default_ctor) /* Nonzero means that this type contains a mutable member */ ! #define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_mutable) #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE)) /* Nonzero means that this class type is a non-POD class. */ *************** struct lang_type *** 1596,1626 **** #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \ (TYPE_LANG_SPECIFIC (NODE)->nearly_empty_p) - /* Nonzero means that this type is meant for communication via COM. */ - #define CLASSTYPE_COM_INTERFACE(NODE) \ - (TYPE_LANG_SPECIFIC(NODE)->com_interface) - /* A list of class types of which this type is a friend. The TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the case of a template friend. */ ! #define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes) /* A list of the classes which grant friendship to this class. */ #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \ (TYPE_LANG_SPECIFIC (NODE)->befriending_classes) /* Say whether this node was declared as a "class" or a "struct". */ ! #define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->declared_class) /* Nonzero if this class has const members which have no specified initialization. */ ! #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->const_needs_init) /* Nonzero if this class has ref members which have no specified initialization. */ ! #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->ref_needs_init) /* Nonzero if this class is included from a header file which employs `#pragma interface', and it is not included in its implementation file. */ ! #define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_only) /* True if we have already determined whether or not vtables, VTTs, typeinfo, and other similar per-class data should be emitted in --- 1508,1539 ---- #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \ (TYPE_LANG_SPECIFIC (NODE)->nearly_empty_p) /* A list of class types of which this type is a friend. The TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the case of a template friend. */ ! #define CLASSTYPE_FRIEND_CLASSES(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->friend_classes) /* A list of the classes which grant friendship to this class. */ #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \ (TYPE_LANG_SPECIFIC (NODE)->befriending_classes) /* Say whether this node was declared as a "class" or a "struct". */ ! #define CLASSTYPE_DECLARED_CLASS(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->declared_class) /* Nonzero if this class has const members which have no specified initialization. */ ! #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->const_needs_init) /* Nonzero if this class has ref members which have no specified initialization. */ ! #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->ref_needs_init) /* Nonzero if this class is included from a header file which employs `#pragma interface', and it is not included in its implementation file. */ ! #define CLASSTYPE_INTERFACE_ONLY(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->interface_only) /* True if we have already determined whether or not vtables, VTTs, typeinfo, and other similar per-class data should be emitted in *************** struct lang_type *** 1628,1647 **** these items should be emitted; it only indicates that we know one way or the other. */ #define CLASSTYPE_INTERFACE_KNOWN(NODE) \ ! (TYPE_LANG_SPECIFIC(NODE)->interface_unknown == 0) /* The opposite of CLASSTYPE_INTERFANCE_KNOWN. */ #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \ ! (TYPE_LANG_SPECIFIC(NODE)->interface_unknown) #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \ ! (TYPE_LANG_SPECIFIC(NODE)->interface_unknown = !!(X)) #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \ ! (TYPE_LANG_SPECIFIC(NODE)->interface_unknown = 1) #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \ ! (TYPE_LANG_SPECIFIC(NODE)->interface_unknown = 0) /* Nonzero if a _DECL node requires us to output debug info for this class. */ ! #define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->debug_requested) /* Additional macros for inheritance information. */ --- 1541,1561 ---- these items should be emitted; it only indicates that we know one way or the other. */ #define CLASSTYPE_INTERFACE_KNOWN(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->interface_unknown == 0) /* The opposite of CLASSTYPE_INTERFANCE_KNOWN. */ #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->interface_unknown) #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \ ! (TYPE_LANG_SPECIFIC (NODE)->interface_unknown = !!(X)) #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->interface_unknown = 1) #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->interface_unknown = 0) /* Nonzero if a _DECL node requires us to output debug info for this class. */ ! #define CLASSTYPE_DEBUG_REQUESTED(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->debug_requested) /* Additional macros for inheritance information. */ *************** struct lang_type *** 1658,1678 **** /* Mark the binfo, whether shared or not. Each instance of a virtual base can be separately marked. */ ! #define BINFO_UNSHARED_MARKED(NODE) TREE_LANG_FLAG_0(NODE) ! /* Nonzero means marked by DFS or BFS search, including searches ! by `get_binfo' and `get_base_distance'. */ ! #define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE)) /* Macros needed because of C compilers that don't allow conditional expressions to be lvalues. Grr! */ ! #define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1)) ! #define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0)) /* Nonzero means 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 --- 1572,1608 ---- /* Mark the binfo, whether shared or not. Each instance of a virtual base can be separately marked. */ ! #define BINFO_UNSHARED_MARKED(NODE) TREE_LANG_FLAG_0 (NODE) ! /* Nonzero means marked by DFS or BFS search. */ ! #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)) /* 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 *************** struct lang_type *** 1687,1693 **** derived class and never become non-primary.) */ #define SET_BINFO_NEW_VTABLE_MARKED(B, C) \ (BINFO_NEW_VTABLE_MARKED (B, C) = 1, \ ! my_friendly_assert (!BINFO_PRIMARY_P (B) || TREE_VIA_VIRTUAL (B), 20000517), \ my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \ 20000517)) --- 1617,1624 ---- derived class and never become non-primary.) */ #define SET_BINFO_NEW_VTABLE_MARKED(B, C) \ (BINFO_NEW_VTABLE_MARKED (B, C) = 1, \ ! my_friendly_assert (!BINFO_PRIMARY_P (B) \ ! || TREE_VIA_VIRTUAL (B), 20000517), \ my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \ 20000517)) *************** struct lang_type *** 1696,1727 **** #define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE) #define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE) ! /* Nonzero if this BINFO is a primary base class. - In the TYPE_BINFO hierarchy, this flag is never set for a base - class of a non-primary virtual base. This flag is only valid for - paths (given by BINFO_INHERITANCE_CHAIN) that really exist in the - final object. */ #define BINFO_PRIMARY_P(NODE) \ (BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE) /* The index in the VTT where this subobject's sub-VTT can be found. NULL_TREE if there is no sub-VTT. */ ! #define BINFO_SUBVTT_INDEX(NODE) TREE_VEC_ELT ((NODE), 8) /* The index in the VTT where the vptr for this subobject can be found. NULL_TREE if there is no secondary vptr in the VTT. */ ! #define BINFO_VPTR_INDEX(NODE) TREE_VEC_ELT ((NODE), 9) /* The binfo of which NODE is a primary base. (This is different from BINFO_INHERITANCE_CHAIN for virtual base because a virtual base is sometimes a primary base for a class for which it is not an immediate base.) */ ! #define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT ((NODE), 10) /* Nonzero if this binfo has lost its primary base binfo (because that is a nearly-empty virtual base that has been taken by some other ! base in the complete heirarchy. */ #define BINFO_LOST_PRIMARY_P(NODE) TREE_LANG_FLAG_2 (NODE) /* Nonzero if this binfo is an indirect primary base, i.e. a virtual --- 1627,1656 ---- #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 ! you might also need to check whether it is canonical. */ #define BINFO_PRIMARY_P(NODE) \ (BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE) /* The index in the VTT where this subobject's sub-VTT can be found. NULL_TREE if there is no sub-VTT. */ ! #define BINFO_SUBVTT_INDEX(NODE) TREE_VEC_ELT (NODE, 8) /* The index in the VTT where the vptr for this subobject can be found. NULL_TREE if there is no secondary vptr in the VTT. */ ! #define BINFO_VPTR_INDEX(NODE) TREE_VEC_ELT (NODE, 9) /* The binfo of which NODE is a primary base. (This is different from BINFO_INHERITANCE_CHAIN for virtual base because a virtual base is sometimes a primary base for a class for which it is not an immediate base.) */ ! #define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT (NODE, 10) /* Nonzero if this binfo has lost its primary base binfo (because that is a nearly-empty virtual base that has been taken by some other ! base in the complete hierarchy. */ #define BINFO_LOST_PRIMARY_P(NODE) TREE_LANG_FLAG_2 (NODE) /* Nonzero if this binfo is an indirect primary base, i.e. a virtual *************** struct lang_type *** 1739,1745 **** TREE_PURPOSE is NULL. Otherwise, the TREE_PURPOSE is the BINFO for the class containing the vfield. The TREE_VALUE is the class where the vfield was first defined. */ ! #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields) /* Get the assoc info that caused this vfield to exist. */ #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE) --- 1668,1674 ---- TREE_PURPOSE is NULL. Otherwise, the TREE_PURPOSE is the BINFO for the class containing the vfield. The TREE_VALUE is the class where the vfield was first defined. */ ! #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC (NODE)->vfields) /* Get the assoc info that caused this vfield to exist. */ #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE) *************** struct lang_type *** 1748,1754 **** #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE) /* Get the value of the top-most type dominating the non-`normal' vfields. */ ! #define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE) /* The number of bytes by which to adjust the `this' pointer when calling this virtual function. */ --- 1677,1684 ---- #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE) /* Get the value of the top-most type dominating the non-`normal' vfields. */ ! #define VF_DERIVED_VALUE(NODE) \ ! (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE) /* The number of bytes by which to adjust the `this' pointer when calling this virtual function. */ *************** struct lang_type *** 1776,1782 **** this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE will be NULL_TREE to indicate a throw specification of `()', or no exceptions allowed. */ ! #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE) /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */ #define TYPE_NOTHROW_P(NODE) \ --- 1706,1712 ---- this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE will be NULL_TREE to indicate a throw specification of `()', or no exceptions allowed. */ ! #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_BINFO (NODE) /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */ #define TYPE_NOTHROW_P(NODE) \ *************** struct lang_type *** 1785,1791 **** /* The binding level associated with the namespace. */ #define NAMESPACE_LEVEL(NODE) \ ! (DECL_LANG_SPECIFIC(NODE)->decl_flags.u.level) /* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or --- 1715,1721 ---- /* The binding level associated with the namespace. */ #define NAMESPACE_LEVEL(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.u.level) /* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or *************** struct lang_type *** 1793,1802 **** This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is the full lang_decl, and not just lang_decl_flags. */ #define CAN_HAVE_FULL_LANG_DECL_P(NODE) \ ! (!(TREE_CODE ((NODE)) == VAR_DECL \ ! || TREE_CODE ((NODE)) == CONST_DECL \ ! || TREE_CODE ((NODE)) == FIELD_DECL \ ! || TREE_CODE ((NODE)) == USING_DECL)) struct lang_decl_flags { --- 1723,1732 ---- This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is the full lang_decl, and not just lang_decl_flags. */ #define CAN_HAVE_FULL_LANG_DECL_P(NODE) \ ! (!(TREE_CODE (NODE) == VAR_DECL \ ! || TREE_CODE (NODE) == CONST_DECL \ ! || TREE_CODE (NODE) == FIELD_DECL \ ! || TREE_CODE (NODE) == USING_DECL)) struct lang_decl_flags { *************** struct lang_decl_flags *** 1816,1833 **** unsigned deferred : 1; unsigned use_template : 2; unsigned nonconverting : 1; - unsigned declared_inline : 1; unsigned not_really_extern : 1; unsigned needs_final_overrider : 1; unsigned initialized_in_class : 1; - unsigned pending_inline_p : 1; unsigned global_ctor_p : 1; unsigned global_dtor_p : 1; - unsigned tinfo_fn_p : 1; unsigned assignment_operator_p : 1; unsigned anticipated_p : 1; ! /* Two unused bits. */ union { /* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this --- 1746,1761 ---- unsigned deferred : 1; unsigned use_template : 2; unsigned nonconverting : 1; unsigned not_really_extern : 1; unsigned needs_final_overrider : 1; unsigned initialized_in_class : 1; unsigned pending_inline_p : 1; + unsigned global_ctor_p : 1; unsigned global_dtor_p : 1; unsigned assignment_operator_p : 1; unsigned anticipated_p : 1; ! /* Four unused bits. */ union { /* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this *************** struct lang_decl_flags *** 1855,1862 **** } u2; }; - struct unparsed_text; - struct lang_decl { struct lang_decl_flags decl_flags; --- 1783,1788 ---- *************** struct lang_decl *** 1870,1879 **** /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */ tree cloned_function; - /* In a FUNCTION_DECL, these are function data which is to be kept - as long as FUNCTION_DECL is kept. */ - tree inlined_fns; - union { tree sorted_fields; --- 1796,1801 ---- *************** struct lang_decl *** 1888,1898 **** } u2; }; ! #define DEFARG_POINTER(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.pointer) ! ! /* Non-zero if NODE is a _DECL with TREE_READONLY set. */ ! #define TREE_READONLY_DECL_P(NODE) \ ! (TREE_READONLY (NODE) && DECL_P (NODE)) /* DECL_NEEDED_P holds of a declaration when we need to emit its definition. This is true when the back-end tells us that --- 1810,1816 ---- } u2; }; ! #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 *************** struct lang_decl *** 1901,1911 **** just been used somewhere, even if it's not really needed. We need anything that isn't comdat, but we don't know for sure whether or not something is comdat until end-of-file. */ ! #define DECL_NEEDED_P(DECL) \ ! ((at_eof && TREE_PUBLIC (DECL) && !DECL_COMDAT (DECL)) \ ! || (DECL_ASSEMBLER_NAME_SET_P (DECL) \ ! && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME ((DECL)))) \ ! || (flag_syntax_only && TREE_USED ((DECL)))) /* Non-zero iff DECL is memory-based. The DECL_RTL of certain const variables might be a CONST_INT, or a REG --- 1819,1829 ---- just been used somewhere, even if it's not really needed. We need anything that isn't comdat, but we don't know for sure whether or not something is comdat until end-of-file. */ ! #define DECL_NEEDED_P(DECL) \ ! ((at_eof && TREE_PUBLIC (DECL) && !DECL_COMDAT (DECL)) \ ! || (DECL_ASSEMBLER_NAME_SET_P (DECL) \ ! && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL))) \ ! || (flag_syntax_only && TREE_USED (DECL))) /* Non-zero iff DECL is memory-based. The DECL_RTL of certain const variables might be a CONST_INT, or a REG *************** struct lang_decl *** 1926,1941 **** we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */ #define DECL_LANGUAGE(NODE) \ (DECL_LANG_SPECIFIC (NODE) \ ! ? DECL_LANG_SPECIFIC(NODE)->decl_flags.language \ : (TREE_CODE (NODE) == FUNCTION_DECL \ ? lang_c : lang_cplusplus)) /* Set the language linkage for NODE to LANGUAGE. */ #define SET_DECL_LANGUAGE(NODE, LANGUAGE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.language = LANGUAGE) /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */ ! #define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr) /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete object. */ --- 1844,1860 ---- we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */ #define DECL_LANGUAGE(NODE) \ (DECL_LANG_SPECIFIC (NODE) \ ! ? DECL_LANG_SPECIFIC (NODE)->decl_flags.language \ : (TREE_CODE (NODE) == FUNCTION_DECL \ ? lang_c : lang_cplusplus)) /* Set the language linkage for NODE to LANGUAGE. */ #define SET_DECL_LANGUAGE(NODE, LANGUAGE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.language = (LANGUAGE)) /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */ ! #define DECL_CONSTRUCTOR_P(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.constructor_attr) /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete object. */ *************** struct lang_decl *** 1957,1963 **** /* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */ #define DECL_COPY_CONSTRUCTOR_P(NODE) \ ! (DECL_CONSTRUCTOR_P (NODE) && copy_args_p (NODE)) /* Nonzero if NODE is a destructor. */ #define DECL_DESTRUCTOR_P(NODE) \ --- 1876,1882 ---- /* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */ #define DECL_COPY_CONSTRUCTOR_P(NODE) \ ! (DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0) /* Nonzero if NODE is a destructor. */ #define DECL_DESTRUCTOR_P(NODE) \ *************** struct lang_decl *** 2000,2009 **** #define DECL_CLONED_FUNCTION(NODE) \ (DECL_LANG_SPECIFIC (NODE)->cloned_function) - /* List of FUNCION_DECLs inlined into this function's body. */ - #define DECL_INLINED_FNS(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->inlined_fns) - /* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */ #define DECL_DISCRIMINATOR_P(NODE) \ (TREE_CODE (NODE) == VAR_DECL \ --- 1919,1924 ---- *************** struct lang_decl *** 2040,2046 **** value of ERROR_MARK is zero, this macro can be used as a predicate to test whether or not NODE is an overloaded operator. */ #define DECL_OVERLOADED_OPERATOR_P(NODE) \ ! (IDENTIFIER_OPNAME_P (DECL_NAME ((NODE))) \ ? DECL_LANG_SPECIFIC (NODE)->u2.operator_code : ERROR_MARK) /* Non-zero if NODE is an assignment operator. */ --- 1955,1961 ---- value of ERROR_MARK is zero, this macro can be used as a predicate to test whether or not NODE is an overloaded operator. */ #define DECL_OVERLOADED_OPERATOR_P(NODE) \ ! (IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \ ? DECL_LANG_SPECIFIC (NODE)->u2.operator_code : ERROR_MARK) /* Non-zero if NODE is an assignment operator. */ *************** struct lang_decl *** 2053,2069 **** #define DECL_HAS_IN_CHARGE_PARM_P(NODE) \ (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_in_charge_parm_p) - /* Non-zero for a FUNCTION_DECL that declares a type-info function. - This only happens in the old abi. */ - #define DECL_TINFO_FN_P(NODE) \ - (TREE_CODE (NODE) == FUNCTION_DECL \ - && DECL_ARTIFICIAL (NODE) \ - && DECL_LANG_SPECIFIC(NODE)->decl_flags.tinfo_fn_p) - - /* Mark NODE as a type-info function. */ - #define SET_DECL_TINFO_FN_P(NODE) \ - (DECL_LANG_SPECIFIC((NODE))->decl_flags.tinfo_fn_p = 1) - /* Nonzero if NODE is an overloaded `operator delete[]' function. */ #define DECL_ARRAY_DELETE_OPERATOR_P(NODE) \ (DECL_OVERLOADED_OPERATOR_P (NODE) == VEC_DELETE_EXPR) --- 1968,1973 ---- *************** struct lang_decl *** 2073,2079 **** detecting circularity in case members are multiply defined. In the case of a VAR_DECL, it is also used to determine how program storage should be allocated. */ ! #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE)) /* Nonzero if the DECL was initialized in the class definition itself, rather than outside the class. */ --- 1977,1983 ---- detecting circularity in case members are multiply defined. In the case of a VAR_DECL, it is also used to determine how program storage should be allocated. */ ! #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE)) /* Nonzero if the DECL was initialized in the class definition itself, rather than outside the class. */ *************** struct lang_decl *** 2083,2097 **** /* Nonzero for FUNCTION_DECL means that this decl is just a friend declaration, and should not be added to the list of member functions for this class. */ ! #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr) /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */ #define DECL_BEFRIENDING_CLASSES(NODE) \ ! (DECL_LANG_SPECIFIC(NODE)->befriending_classes) /* Nonzero for FUNCTION_DECL means that this decl is a static member function. */ ! #define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function) /* Nonzero for FUNCTION_DECL means that this decl is a non-static member function. */ --- 1987,2002 ---- /* Nonzero for FUNCTION_DECL means that this decl is just a friend declaration, and should not be added to the list of member functions for this class. */ ! #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.friend_attr) /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */ #define DECL_BEFRIENDING_CLASSES(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->befriending_classes) /* Nonzero for FUNCTION_DECL means that this decl is a static member function. */ ! #define DECL_STATIC_FUNCTION_P(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.static_function) /* Nonzero for FUNCTION_DECL means that this decl is a non-static member function. */ *************** struct lang_decl *** 2129,2143 **** /* Nonzero for _DECL means that this constructor is a non-converting constructor. */ ! #define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting) /* Nonzero for FUNCTION_DECL means that this member function is a pure virtual function. */ ! #define DECL_PURE_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.pure_virtual) /* Nonzero for FUNCTION_DECL means that this member function must be overridden by derived classes. */ ! #define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.needs_final_overrider) /* Nonzero if NODE is a thunk, rather than an ordinary function. */ #define DECL_THUNK_P(NODE) \ --- 2034,2051 ---- /* Nonzero for _DECL means that this constructor is a non-converting constructor. */ ! #define DECL_NONCONVERTING_P(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.nonconverting) /* Nonzero for FUNCTION_DECL means that this member function is a pure virtual function. */ ! #define DECL_PURE_VIRTUAL_P(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.pure_virtual) /* Nonzero for FUNCTION_DECL means that this member function must be overridden by derived classes. */ ! #define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.needs_final_overrider) /* Nonzero if NODE is a thunk, rather than an ordinary function. */ #define DECL_THUNK_P(NODE) \ *************** struct lang_decl *** 2257,2281 **** /* If DECL_PENDING_INLINE_P holds, this is the saved text of the function. */ #define DECL_PENDING_INLINE_INFO(NODE) \ ! (DECL_LANG_SPECIFIC(NODE)->u.pending_inline_info) /* For a TYPE_DECL: if this function has many fields, we'll sort them and put them into a TREE_VEC. */ #define DECL_SORTED_FIELDS(NODE) \ ! (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.sorted_fields) /* True if on the deferred_fns (see decl2.c) list. */ #define DECL_DEFERRED_FN(DECL) \ ! (DECL_LANG_SPECIFIC(DECL)->decl_flags.deferred) /* For a VAR_DECL, FUNCTION_DECL, TYPE_DECL or TEMPLATE_DECL: template-specific information. */ #define DECL_TEMPLATE_INFO(NODE) \ ! (DECL_LANG_SPECIFIC(VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE))->decl_flags.u.template_info) /* Template information for a RECORD_TYPE or UNION_TYPE. */ #define CLASSTYPE_TEMPLATE_INFO(NODE) \ ! (TYPE_LANG_SPECIFIC(RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info) /* Template information for an ENUMERAL_TYPE. Although an enumeration may not be a primary template, it may be declared within the scope of a --- 2165,2190 ---- /* If DECL_PENDING_INLINE_P holds, this is the saved text of the function. */ #define DECL_PENDING_INLINE_INFO(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->u.pending_inline_info) /* For a TYPE_DECL: if this function has many fields, we'll sort them and put them into a TREE_VEC. */ #define DECL_SORTED_FIELDS(NODE) \ ! (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.sorted_fields) /* True if on the deferred_fns (see decl2.c) list. */ #define DECL_DEFERRED_FN(DECL) \ ! (DECL_LANG_SPECIFIC (DECL)->decl_flags.deferred) /* For a VAR_DECL, FUNCTION_DECL, TYPE_DECL or TEMPLATE_DECL: template-specific information. */ #define DECL_TEMPLATE_INFO(NODE) \ ! (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \ ! ->decl_flags.u.template_info) /* Template information for a RECORD_TYPE or UNION_TYPE. */ #define CLASSTYPE_TEMPLATE_INFO(NODE) \ ! (TYPE_LANG_SPECIFIC (RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info) /* Template information for an ENUMERAL_TYPE. Although an enumeration may not be a primary template, it may be declared within the scope of a *************** struct lang_decl *** 2283,2290 **** non-type template parameters. */ #define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (ENUMERAL_TYPE_CHECK (NODE))) ! /* Template information for a bound template template parameter. */ ! #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE)) /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */ #define TYPE_TEMPLATE_INFO(NODE) \ --- 2192,2201 ---- non-type template parameters. */ #define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (ENUMERAL_TYPE_CHECK (NODE))) ! /* Template information for a template template parameter. */ ! #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \ ! (TYPE_LANG_SPECIFIC (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \ ! ->template_info) /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */ #define TYPE_TEMPLATE_INFO(NODE) \ *************** struct lang_decl *** 2300,2307 **** UNION_TYPE to VAL. */ #define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \ (TREE_CODE (NODE) == ENUMERAL_TYPE \ ! ? (ENUM_TEMPLATE_INFO (NODE) = VAL) \ ! : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL)) #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE)) #define TI_ARGS(NODE) (TREE_VALUE (NODE)) --- 2211,2218 ---- UNION_TYPE to VAL. */ #define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \ (TREE_CODE (NODE) == ENUMERAL_TYPE \ ! ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \ ! : (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL))) #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE)) #define TI_ARGS(NODE) (TREE_VALUE (NODE)) *************** struct lang_decl *** 2322,2328 **** /* Non-zero if the template arguments is actually a vector of vectors, rather than just a vector. */ #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \ ! (NODE != NULL_TREE \ && TREE_CODE (NODE) == TREE_VEC \ && TREE_VEC_LENGTH (NODE) > 0 \ && TREE_VEC_ELT (NODE, 0) != NULL_TREE \ --- 2233,2239 ---- /* Non-zero if the template arguments is actually a vector of vectors, rather than just a vector. */ #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \ ! ((NODE) != NULL_TREE \ && TREE_CODE (NODE) == TREE_VEC \ && TREE_VEC_LENGTH (NODE) > 0 \ && TREE_VEC_ELT (NODE, 0) != NULL_TREE \ *************** struct lang_decl *** 2340,2351 **** args is level 1, not level 0. */ #define TMPL_ARGS_LEVEL(ARGS, LEVEL) \ (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \ ! ? TREE_VEC_ELT ((ARGS), (LEVEL) - 1) : ARGS) /* Set the LEVELth level of the template ARGS to VAL. This macro does not work with single-level argument vectors. */ #define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \ ! (TREE_VEC_ELT ((ARGS), (LEVEL) - 1) = (VAL)) /* Accesses the IDXth parameter in the LEVELth level of the ARGS. */ #define TMPL_ARG(ARGS, LEVEL, IDX) \ --- 2251,2262 ---- args is level 1, not level 0. */ #define TMPL_ARGS_LEVEL(ARGS, LEVEL) \ (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \ ! ? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS)) /* Set the LEVELth level of the template ARGS to VAL. This macro does not work with single-level argument vectors. */ #define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \ ! (TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL)) /* Accesses the IDXth parameter in the LEVELth level of the ARGS. */ #define TMPL_ARG(ARGS, LEVEL, IDX) \ *************** struct lang_decl *** 2369,2375 **** /* The number of levels of template parameters given by NODE. */ #define TMPL_PARMS_DEPTH(NODE) \ ! (TREE_INT_CST_LOW (TREE_PURPOSE (NODE))) /* The TEMPLATE_DECL instantiated or specialized by NODE. This TEMPLATE_DECL will be the immediate parent, not the most general --- 2280,2286 ---- /* The number of levels of template parameters given by NODE. */ #define TMPL_PARMS_DEPTH(NODE) \ ! ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE))) /* The TEMPLATE_DECL instantiated or specialized by NODE. This TEMPLATE_DECL will be the immediate parent, not the most general *************** struct lang_decl *** 2413,2419 **** #define TYPE_TI_ARGS(NODE) \ (TI_ARGS (TYPE_TEMPLATE_INFO (NODE))) ! #define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE(NODE) /* Nonzero if the NODE corresponds to the template parameters for a member template, whose inline definition is being processed after --- 2324,2330 ---- #define TYPE_TI_ARGS(NODE) \ (TI_ARGS (TYPE_TEMPLATE_INFO (NODE))) ! #define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE (NODE) /* Nonzero if the NODE corresponds to the template parameters for a member template, whose inline definition is being processed after *************** struct lang_decl *** 2447,2453 **** this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the corresponding TYPE_DECL. However, this may also be a TEMPLATE_ID_EXPR if we had something like `typename X::Y'. */ ! #define TYPENAME_TYPE_FULLNAME(NODE) TYPE_BINFO (NODE) /* Nonzero if NODE is an implicit typename. */ #define IMPLICIT_TYPENAME_P(NODE) \ --- 2358,2364 ---- this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the corresponding TYPE_DECL. However, this may also be a TEMPLATE_ID_EXPR if we had something like `typename X::Y'. */ ! #define TYPENAME_TYPE_FULLNAME(NODE) (TYPE_FIELDS (NODE)) /* Nonzero if NODE is an implicit typename. */ #define IMPLICIT_TYPENAME_P(NODE) \ *************** struct lang_decl *** 2478,2485 **** /* Nonzero if this class has a virtual function table pointer. */ #define TYPE_CONTAINS_VPTR_P(NODE) \ (TYPE_POLYMORPHIC_P (NODE) \ ! || (vbase_offsets_in_vtable_p () \ ! && TYPE_USES_VIRTUAL_BASECLASSES (NODE))) extern int flag_new_for_scope; --- 2389,2395 ---- /* Nonzero if this class has a virtual function table pointer. */ #define TYPE_CONTAINS_VPTR_P(NODE) \ (TYPE_POLYMORPHIC_P (NODE) \ ! || TYPE_USES_VIRTUAL_BASECLASSES (NODE)) extern int flag_new_for_scope; *************** extern int flag_new_for_scope; *** 2502,2508 **** (DECL_LANG_SPECIFIC (DECL_CHECK (NODE))->decl_flags.anticipated_p) /* Record whether a typedef for type `int' was actually `signed int'. */ ! #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp)) /* Returns non-zero if DECL has external linkage, as specified by the language standard. (This predicate may hold even when the --- 2412,2418 ---- (DECL_LANG_SPECIFIC (DECL_CHECK (NODE))->decl_flags.anticipated_p) /* Record whether a typedef for type `int' was actually `signed int'. */ ! #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP) /* Returns non-zero if DECL has external linkage, as specified by the language standard. (This predicate may hold even when the *************** extern int flag_new_for_scope; *** 2512,2518 **** (decl_linkage (DECL) == lk_external) #define INTEGRAL_CODE_P(CODE) \ ! (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE) /* [basic.fundamental] --- 2422,2428 ---- (decl_linkage (DECL) == lk_external) #define INTEGRAL_CODE_P(CODE) \ ! ((CODE) == INTEGER_TYPE || (CODE) == ENUMERAL_TYPE || (CODE) == BOOLEAN_TYPE) /* [basic.fundamental] *************** extern int flag_new_for_scope; *** 2522,2529 **** Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration types as well, which is incorrect in C++. */ #define CP_INTEGRAL_TYPE_P(TYPE) \ ! (TREE_CODE ((TYPE)) == BOOLEAN_TYPE \ ! || TREE_CODE ((TYPE)) == INTEGER_TYPE) /* [basic.fundamental] --- 2432,2439 ---- Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration types as well, which is incorrect in C++. */ #define CP_INTEGRAL_TYPE_P(TYPE) \ ! (TREE_CODE (TYPE) == BOOLEAN_TYPE \ ! || TREE_CODE (TYPE) == INTEGER_TYPE) /* [basic.fundamental] *************** extern int flag_new_for_scope; *** 2534,2540 **** /* Nonzero for _TYPE means that the _TYPE defines at least one constructor. */ ! #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE)) /* When appearing in an INDIRECT_REF, it means that the tree structure underneath is actually a call to a constructor. This is needed --- 2444,2450 ---- /* Nonzero for _TYPE means that the _TYPE defines at least one constructor. */ ! #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE)) /* When appearing in an INDIRECT_REF, it means that the tree structure underneath is actually a call to a constructor. This is needed *************** extern int flag_new_for_scope; *** 2550,2563 **** When appearing in a FIELD_DECL, it means that this field has been duly initialized in its constructor. */ ! #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE)) #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \ && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \ && ! TREE_HAS_CONSTRUCTOR (NODE)) /* Nonzero for _TYPE means that the _TYPE defines a destructor. */ ! #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE)) /* Nonzero means that an object of this type can not be initialized using an initializer list. */ --- 2460,2473 ---- When appearing in a FIELD_DECL, it means that this field has been duly initialized in its constructor. */ ! #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE)) #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \ && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \ && ! TREE_HAS_CONSTRUCTOR (NODE)) /* Nonzero for _TYPE means that the _TYPE defines a destructor. */ ! #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2 (NODE)) /* Nonzero means that an object of this type can not be initialized using an initializer list. */ *************** extern int flag_new_for_scope; *** 2567,2576 **** (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE)) /* Nonzero if there is a user-defined X::op=(x&) for this class. */ ! #define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_real_assign_ref) ! #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_complex_assign_ref) ! #define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_abstract_assign_ref) ! #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_complex_init_ref) /* Nonzero if TYPE has a trivial destructor. From [class.dtor]: --- 2477,2486 ---- (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE)) /* Nonzero if there is a user-defined X::op=(x&) for this class. */ ! #define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_real_assign_ref) ! #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_complex_assign_ref) ! #define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_abstract_assign_ref) ! #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_complex_init_ref) /* Nonzero if TYPE has a trivial destructor. From [class.dtor]: *************** extern int flag_new_for_scope; *** 2591,2597 **** involve a call to a destructor. This can apply to objects of ARRAY_TYPE is the type of the elements needs a destructor. */ #define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \ ! (TYPE_LANG_FLAG_4(NODE)) /* Nonzero for class type means that copy initialization of this type can use a bitwise copy. */ --- 2501,2507 ---- involve a call to a destructor. This can apply to objects of ARRAY_TYPE is the type of the elements needs a destructor. */ #define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \ ! (TYPE_LANG_FLAG_4 (NODE)) /* Nonzero for class type means that copy initialization of this type can use a bitwise copy. */ *************** extern int flag_new_for_scope; *** 2617,2632 **** #define TYPE_PTRFN_P(NODE) \ (TREE_CODE (NODE) == POINTER_TYPE \ && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) /* Nonzero for _TYPE node means that this type is a pointer to member function type. */ #define TYPE_PTRMEMFUNC_P(NODE) \ ! (TREE_CODE(NODE) == RECORD_TYPE \ ! && TYPE_LANG_SPECIFIC(NODE) \ && TYPE_PTRMEMFUNC_FLAG (NODE)) #define TYPE_PTRMEMFUNC_FLAG(NODE) \ ! (TYPE_LANG_SPECIFIC(NODE)->ptrmemfunc_flag) /* Indicates when overload resolution may resolve to a pointer to member function. [expr.unary.op]/3 */ --- 2527,2545 ---- #define TYPE_PTRFN_P(NODE) \ (TREE_CODE (NODE) == POINTER_TYPE \ && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) + #define TYPE_REFFN_P(NODE) \ + (TREE_CODE (NODE) == REFERENCE_TYPE \ + && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) /* Nonzero for _TYPE node means that this type is a pointer to member function type. */ #define TYPE_PTRMEMFUNC_P(NODE) \ ! (TREE_CODE (NODE) == RECORD_TYPE \ ! && TYPE_LANG_SPECIFIC (NODE) \ && TYPE_PTRMEMFUNC_FLAG (NODE)) #define TYPE_PTRMEMFUNC_FLAG(NODE) \ ! (TYPE_LANG_SPECIFIC (NODE)->ptrmemfunc_flag) /* Indicates when overload resolution may resolve to a pointer to member function. [expr.unary.op]/3 */ *************** extern int flag_new_for_scope; *** 2634,2700 **** /* A pointer-to-function member type looks like: - struct { - short __delta; - short __index; - union { - P __pfn; - short __delta2; - } __pfn_or_delta2; - }; - - where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the - pointer to member. The fields are used as follows: - - If __INDEX is -1, then the function to call is non-virtual, and - is located at the address given by __PFN. - - If __INDEX is zero, then this a NULL pointer-to-member. - - Otherwise, the function to call is virtual. Then, __DELTA2 gives - the offset from an instance of the object to the virtual function - table, and __INDEX - 1 is the index into the vtable to use to - find the function. - - The value to use for the THIS parameter is the address of the - object plus __DELTA. - - For example, given: - - struct B1 { - int i; - }; - - struct B2 { - double d; - void f(); - }; - - struct S : public B1, B2 {}; - - the pointer-to-member for `&S::f' looks like: - - { 4, -1, { &f__2B2 } }; - - The `4' means that given an `S*' you have to add 4 bytes to get to - the address of the `B2*'. Then, the -1 indicates that this is a - non-virtual function. Of course, `&f__2B2' is the name of that - function. - - (Of course, the exact values may differ depending on the mangling - scheme, sizes of types, and such.). - - Under the new ABI, we do: - struct { __P __pfn; ptrdiff_t __delta; }; ! (We don't need DELTA2, because the vtable is always the first thing ! in the object.) If the function is virtual, then PFN is one plus ! twice the index into the vtable; otherwise, it is just a pointer to ! the function. Unfortunately, using the lowest bit of PFN doesn't work in architectures that don't impose alignment requirements on function --- 2547,2563 ---- /* A pointer-to-function member type looks like: struct { __P __pfn; ptrdiff_t __delta; }; ! If __pfn is NULL, it is a NULL pointer-to-member-function. ! ! (Because the vtable is always the first thing in the object, we ! don't need its offset.) If the function is virtual, then PFN is ! one plus twice the index into the vtable; otherwise, it is just a ! pointer to the function. Unfortunately, using the lowest bit of PFN doesn't work in architectures that don't impose alignment requirements on function *************** enum ptrmemfunc_vbit_where_t *** 2720,2727 **** /* These are use to manipulate the canonical RECORD_TYPE from the hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */ ! #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE)) ! #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE))) /* Returns the pfn field from a TYPE_PTRMEMFUNC_P. */ #define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE)) --- 2583,2592 ---- /* These are use to manipulate the canonical RECORD_TYPE from the hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */ ! #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \ ! ((tree)TYPE_LANG_SPECIFIC (NODE)) ! #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \ ! (TYPE_LANG_SPECIFIC (NODE) = ((struct lang_type *)(void*)(VALUE))) /* Returns the pfn field from a TYPE_PTRMEMFUNC_P. */ #define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE)) *************** enum ptrmemfunc_vbit_where_t *** 2731,2745 **** TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have type `const X*'. */ #define TYPE_PTRMEM_CLASS_TYPE(NODE) \ ! (TYPE_PTRMEM_P ((NODE)) \ ! ? TYPE_OFFSET_BASETYPE (TREE_TYPE ((NODE))) \ ! : TYPE_PTRMEMFUNC_OBJECT_TYPE ((NODE))) /* For a pointer-to-member type of the form `T X::*', this is `T'. */ #define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \ ! (TYPE_PTRMEM_P ((NODE)) \ ? TREE_TYPE (TREE_TYPE (NODE)) \ ! : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE ((NODE)))) /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for `X'. */ --- 2596,2610 ---- TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have type `const X*'. */ #define TYPE_PTRMEM_CLASS_TYPE(NODE) \ ! (TYPE_PTRMEM_P (NODE) \ ! ? TYPE_OFFSET_BASETYPE (TREE_TYPE (NODE)) \ ! : TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE)) /* For a pointer-to-member type of the form `T X::*', this is `T'. */ #define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \ ! (TYPE_PTRMEM_P (NODE) \ ? TREE_TYPE (TREE_TYPE (NODE)) \ ! : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE))) /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for `X'. */ *************** enum ptrmemfunc_vbit_where_t *** 2803,2824 **** For example, if a member that would normally be public in a derived class is made protected, then the derived class and the protected_access_node will appear in the DECL_ACCESS for the node. */ ! #define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.u2.access) /* Nonzero if the FUNCTION_DECL is a global constructor. */ #define DECL_GLOBAL_CTOR_P(NODE) \ ! (DECL_LANG_SPECIFIC ((NODE))->decl_flags.global_ctor_p) /* Nonzero if the FUNCTION_DECL is a global destructor. */ #define DECL_GLOBAL_DTOR_P(NODE) \ ! (DECL_LANG_SPECIFIC ((NODE))->decl_flags.global_dtor_p) /* If DECL_GLOBAL_CTOR_P or DECL_GLOBAL_DTOR_P holds, this macro returns the initialization priority for the function. Constructors with lower numbers should be run first. Destructors should be run in the reverse order of constructors. */ #define GLOBAL_INIT_PRIORITY(NODE) \ ! (DECL_LANG_SPECIFIC ((NODE))->decl_flags.u2.init_priority) /* Accessor macros for C++ template decl nodes. */ --- 2668,2689 ---- For example, if a member that would normally be public in a derived class is made protected, then the derived class and the protected_access_node will appear in the DECL_ACCESS for the node. */ ! #define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.u2.access) /* Nonzero if the FUNCTION_DECL is a global constructor. */ #define DECL_GLOBAL_CTOR_P(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_ctor_p) /* Nonzero if the FUNCTION_DECL is a global destructor. */ #define DECL_GLOBAL_DTOR_P(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_dtor_p) /* If DECL_GLOBAL_CTOR_P or DECL_GLOBAL_DTOR_P holds, this macro returns the initialization priority for the function. Constructors with lower numbers should be run first. Destructors should be run in the reverse order of constructors. */ #define GLOBAL_INIT_PRIORITY(NODE) \ ! (DECL_LANG_SPECIFIC (NODE)->decl_flags.u2.init_priority) /* Accessor macros for C++ template decl nodes. */ *************** enum ptrmemfunc_vbit_where_t *** 2833,2845 **** TEMPLATE_PARM_INDEX for the parameter is avilable as the DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a TYPE_DECL). */ ! #define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE) #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \ INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE)) #define DECL_NTPARMS(NODE) \ TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE)) /* For function, method, class-data templates. */ ! #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD(NODE) /* For a static member variable template, the DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and implicitly generated instantiations of the variable. There are no --- 2698,2710 ---- TEMPLATE_PARM_INDEX for the parameter is avilable as the DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a TYPE_DECL). */ ! #define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS (NODE) #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \ INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE)) #define DECL_NTPARMS(NODE) \ TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE)) /* For function, method, class-data templates. */ ! #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD (NODE) /* For a static member variable template, the DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and implicitly generated instantiations of the variable. There are no *************** enum ptrmemfunc_vbit_where_t *** 2865,2871 **** struct S1::S2'. This list is not used for function templates. */ ! #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE) /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists contains all instantiations and specializations of the function, including partial instantiations. For a partial instantiation --- 2730,2736 ---- struct S1::S2'. This list is not used for function templates. */ ! #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX (NODE) /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists contains all instantiations and specializations of the function, including partial instantiations. For a partial instantiation *************** enum ptrmemfunc_vbit_where_t *** 2896,2907 **** for the partial specialization. This list is not used for static variable templates. */ ! #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE(NODE) /* Nonzero for a DECL which is actually a template parameter. */ #define DECL_TEMPLATE_PARM_P(NODE) \ (DECL_LANG_FLAG_0 (NODE) \ && (TREE_CODE (NODE) == CONST_DECL \ || TREE_CODE (NODE) == TYPE_DECL \ || TREE_CODE (NODE) == TEMPLATE_DECL)) --- 2761,2773 ---- for the partial specialization. This list is not used for static variable templates. */ ! #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE (NODE) /* Nonzero for a DECL which is actually a template parameter. */ #define DECL_TEMPLATE_PARM_P(NODE) \ (DECL_LANG_FLAG_0 (NODE) \ && (TREE_CODE (NODE) == CONST_DECL \ + || TREE_CODE (NODE) == PARM_DECL \ || TREE_CODE (NODE) == TYPE_DECL \ || TREE_CODE (NODE) == TEMPLATE_DECL)) *************** enum ptrmemfunc_vbit_where_t *** 2935,2943 **** itself, so that you can say `S::S'. This macro does *not* hold for those typedefs. */ #define DECL_IMPLICIT_TYPEDEF_P(NODE) \ ! (TREE_CODE ((NODE)) == TYPE_DECL && DECL_LANG_FLAG_2 ((NODE))) #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \ ! (DECL_LANG_FLAG_2 ((NODE)) = 1) /* A `primary' template is one that has its own template header. A member function of a class template is a template, but not primary. --- 2801,2809 ---- itself, so that you can say `S::S'. This macro does *not* hold for those typedefs. */ #define DECL_IMPLICIT_TYPEDEF_P(NODE) \ ! (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE)) #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \ ! (DECL_LANG_FLAG_2 (NODE) = 1) /* A `primary' template is one that has its own template header. A member function of a class template is a template, but not primary. *************** enum ptrmemfunc_vbit_where_t *** 2948,2954 **** (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE))) /* Returns non-zero if NODE is a primary template. */ ! #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE) #define CLASSTYPE_TEMPLATE_LEVEL(NODE) \ (TREE_INT_CST_LOW (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE)))) --- 2814,2820 ---- (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE))) /* Returns non-zero if NODE is a primary template. */ ! #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE)) #define CLASSTYPE_TEMPLATE_LEVEL(NODE) \ (TREE_INT_CST_LOW (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE)))) *************** enum ptrmemfunc_vbit_where_t *** 2959,2965 **** 1=implicit template instantiation 2=explicit template specialization, e.g. int min (int, int); 3=explicit template instantiation, e.g. template int min (int, int); */ ! #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template) #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1) #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \ --- 2825,2831 ---- 1=implicit template instantiation 2=explicit template specialization, e.g. int min (int, int); 3=explicit template instantiation, e.g. template int min (int, int); */ ! #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.use_template) #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1) #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \ *************** enum ptrmemfunc_vbit_where_t *** 2975,2990 **** #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1) #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1) #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ ! (CLASSTYPE_USE_TEMPLATE(NODE) == 1) #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ ! (CLASSTYPE_USE_TEMPLATE(NODE) = 1) #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3) #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3) #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ ! (CLASSTYPE_USE_TEMPLATE(NODE) == 3) #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ ! (CLASSTYPE_USE_TEMPLATE(NODE) = 3) /* Non-zero if DECL is a friend function which is an instantiation from the point of view of the compiler, but not from the point of --- 2841,2856 ---- #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1) #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1) #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ ! (CLASSTYPE_USE_TEMPLATE (NODE) == 1) #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ ! (CLASSTYPE_USE_TEMPLATE (NODE) = 1) #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3) #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3) #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ ! (CLASSTYPE_USE_TEMPLATE (NODE) == 3) #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ ! (CLASSTYPE_USE_TEMPLATE (NODE) = 3) /* Non-zero if DECL is a friend function which is an instantiation from the point of view of the compiler, but not from the point of *************** enum ptrmemfunc_vbit_where_t *** 3024,3030 **** 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.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 --- 2890,2896 ---- 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 *************** enum ptrmemfunc_vbit_where_t *** 3072,3088 **** #define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0) #define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1) - #define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0) - #define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0) #define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1) /* Nonzero if this try block is a function try block. */ #define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE)) #define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0) #define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1) #define SUBOBJECT_CLEANUP(NODE) TREE_OPERAND (SUBOBJECT_CHECK (NODE), 0) - #define START_CATCH_TYPE(NODE) TREE_TYPE (START_CATCH_STMT_CHECK (NODE)) /* Nonzero if this CTOR_STMT is for the beginning of a constructor. */ #define CTOR_BEGIN_P(NODE) \ --- 2938,2954 ---- #define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0) #define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1) #define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0) #define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1) + #define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0) + /* Nonzero if this try block is a function try block. */ #define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE)) #define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0) #define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1) + #define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE)) #define SUBOBJECT_CLEANUP(NODE) TREE_OPERAND (SUBOBJECT_CHECK (NODE), 0) /* Nonzero if this CTOR_STMT is for the beginning of a constructor. */ #define CTOR_BEGIN_P(NODE) \ *************** enum ptrmemfunc_vbit_where_t *** 3094,3108 **** /* The parameters for a call-declarator. */ #define CALL_DECLARATOR_PARMS(NODE) \ ! (TREE_PURPOSE (TREE_OPERAND ((NODE), 1))) /* The cv-qualifiers for a call-declarator. */ #define CALL_DECLARATOR_QUALS(NODE) \ ! (TREE_VALUE (TREE_OPERAND ((NODE), 1))) /* The exception-specification for a call-declarator. */ #define CALL_DECLARATOR_EXCEPTION_SPEC(NODE) \ ! (TREE_TYPE ((NODE))) /* An enumeration of the kind of tags that C++ accepts. */ enum tag_types { record_type, class_type, union_type, enum_type }; --- 2960,2974 ---- /* The parameters for a call-declarator. */ #define CALL_DECLARATOR_PARMS(NODE) \ ! (TREE_PURPOSE (TREE_OPERAND (NODE, 1))) /* The cv-qualifiers for a call-declarator. */ #define CALL_DECLARATOR_QUALS(NODE) \ ! (TREE_VALUE (TREE_OPERAND (NODE, 1))) /* The exception-specification for a call-declarator. */ #define CALL_DECLARATOR_EXCEPTION_SPEC(NODE) \ ! (TREE_TYPE (NODE)) /* An enumeration of the kind of tags that C++ accepts. */ enum tag_types { record_type, class_type, union_type, enum_type }; *************** typedef enum linkage_kind { *** 3193,3205 **** lk_external /* External linkage. */ } linkage_kind; ! /* Bitmask flags to pass to instantiate_type. */ ! typedef enum instantiate_type_flags { ! itf_none = 0, /* nothing special */ ! itf_complain = 1 << 0, /* complain about errors */ ! itf_no_attributes = 1 << 1, /* ignore attributes on comparisons */ ! itf_ptrmem_ok = 1 << 2, /* pointers to member ok (internal use) */ ! } instantiate_type_flags; /* Nonzero means allow Microsoft extensions without a pedwarn. */ extern int flag_ms_extensions; --- 3059,3101 ---- lk_external /* External linkage. */ } linkage_kind; ! /* Bitmask flags to control type substitution. */ ! 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 ! (make_typename_type use) */ ! tf_ptrmem_ok = 1 << 5 /* pointers to member ok (internal ! instantiate_type use) */ ! } tsubst_flags_t; ! ! /* The kind of checking we can do looking in a class hierarchy. */ ! typedef enum base_access { ! ba_any = 0, /* Do not check access, allow an ambiguous base, ! prefer a non-virtual base */ ! ba_ignore = 1, /* Do not check access */ ! ba_check = 2, /* Check access */ ! ba_not_special = 3, /* Do not consider special privilege ! current_class_type might give. */ ! ba_quiet = 4, /* Do not issue error messages (bit mask). */ ! } base_access; ! ! /* The kind of base we can find, looking in a class hierarchy. ! Values <0 indicate we failed. */ ! typedef enum base_kind { ! bk_inaccessible = -3, /* The base is inaccessible */ ! bk_ambig = -2, /* The base is ambiguous */ ! bk_not_base = -1, /* It is not a base */ ! bk_same_type = 0, /* It is the same type */ ! bk_proper_base = 1, /* It is a proper base */ ! bk_via_virtual = 2 /* It is a proper base, but via a virtual ! path. This might not be the canonical ! binfo. */ ! } base_kind; /* Nonzero means allow Microsoft extensions without a pedwarn. */ extern int flag_ms_extensions; *************** extern int warn_overloaded_virtual; *** 3212,3217 **** --- 3108,3118 ---- /* Nonzero means warn about use of multicharacter literals. */ extern int warn_multichar; + /* Set by add_implicitly_declared_members() to keep those members from + being flagged as deprecated or reported as using deprecated + types. */ + extern int adding_implicit_members; + /* Non-zero means warn if a non-templatized friend function is declared in a templatized class. This behavior is warned about with flag_guiding_decls in do_friend. */ *************** extern int warn_nontemplate_friend; *** 3221,3233 **** /* A node that is a list (length 1) of error_mark_nodes. */ extern tree error_mark_list; - /* A list of virtual function tables we must make sure to write out. */ - extern tree pending_vtables; - /* Node for "pointer to (virtual) function". This may be distinct from ptr_type_node so gdb can distinguish them. */ ! #define vfunc_ptr_type_node \ ! (flag_vtable_thunks ? vtable_entry_type : ptr_type_node) /* For building calls to `delete'. */ --- 3122,3130 ---- /* A node that is a list (length 1) of error_mark_nodes. */ extern tree error_mark_list; /* Node for "pointer to (virtual) function". This may be distinct from ptr_type_node so gdb can distinguish them. */ ! #define vfunc_ptr_type_node vtable_entry_type /* For building calls to `delete'. */ *************** typedef enum unification_kind_t { *** 3253,3259 **** DEDUCE_ORDER } unification_kind_t; ! /* Macros for operating on a template instantation level node, represented by an EXPR_WITH_FILE_LOCATION. */ #define TINST_DECL(NODE) EXPR_WFL_NODE (NODE) --- 3150,3156 ---- DEDUCE_ORDER } unification_kind_t; ! /* Macros for operating on a template instantiation level node, represented by an EXPR_WITH_FILE_LOCATION. */ #define TINST_DECL(NODE) EXPR_WFL_NODE (NODE) *************** extern varray_type local_classes; *** 3290,3306 **** #define VPTR_NAME "$v" #define THROW_NAME "$eh_throw" - #define DESTRUCTOR_DECL_PREFIX "_$_" #define AUTO_VTABLE_NAME "__vtbl$me__" #define AUTO_TEMP_NAME "_$tmp_" #define AUTO_TEMP_FORMAT "_$tmp_%d" #define VTABLE_BASE "$vb" ! #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt$") #define VFIELD_BASE "$vf" #define VFIELD_NAME "_vptr$" #define VFIELD_NAME_FORMAT "_vptr$%s" - #define VBASE_NAME "_vb$" - #define VBASE_NAME_FORMAT "_vb$%s" #define STATIC_NAME_FORMAT "_%s$%s" #define ANON_AGGRNAME_FORMAT "$_%d" --- 3187,3200 ---- #define VPTR_NAME "$v" #define THROW_NAME "$eh_throw" #define AUTO_VTABLE_NAME "__vtbl$me__" #define AUTO_TEMP_NAME "_$tmp_" #define AUTO_TEMP_FORMAT "_$tmp_%d" #define VTABLE_BASE "$vb" ! #define VTABLE_NAME_PREFIX "__vt_" #define VFIELD_BASE "$vf" #define VFIELD_NAME "_vptr$" #define VFIELD_NAME_FORMAT "_vptr$%s" #define STATIC_NAME_FORMAT "_%s$%s" #define ANON_AGGRNAME_FORMAT "$_%d" *************** extern varray_type local_classes; *** 3312,3328 **** #define VPTR_NAME ".v" #define THROW_NAME ".eh_throw" - #define DESTRUCTOR_DECL_PREFIX "_._" #define AUTO_VTABLE_NAME "__vtbl.me__" #define AUTO_TEMP_NAME "_.tmp_" #define AUTO_TEMP_FORMAT "_.tmp_%d" #define VTABLE_BASE ".vb" ! #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt.") #define VFIELD_BASE ".vf" #define VFIELD_NAME "_vptr." #define VFIELD_NAME_FORMAT "_vptr.%s" - #define VBASE_NAME "_vb." - #define VBASE_NAME_FORMAT "_vb.%s" #define STATIC_NAME_FORMAT "_%s.%s" #define ANON_AGGRNAME_FORMAT "._%d" --- 3206,3219 ---- #define VPTR_NAME ".v" #define THROW_NAME ".eh_throw" #define AUTO_VTABLE_NAME "__vtbl.me__" #define AUTO_TEMP_NAME "_.tmp_" #define AUTO_TEMP_FORMAT "_.tmp_%d" #define VTABLE_BASE ".vb" ! #define VTABLE_NAME_PREFIX "__vt_" #define VFIELD_BASE ".vf" #define VFIELD_NAME "_vptr." #define VFIELD_NAME_FORMAT "_vptr.%s" #define STATIC_NAME_FORMAT "_%s.%s" #define ANON_AGGRNAME_FORMAT "._%d" *************** extern varray_type local_classes; *** 3333,3342 **** #define VPTR_NAME_P(ID_NODE) \ (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1)) #define THROW_NAME "__eh_throw" - #define DESTRUCTOR_DECL_PREFIX "__destr_" - #define DESTRUCTOR_NAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \ - sizeof (DESTRUCTOR_DECL_PREFIX) - 1)) #define IN_CHARGE_NAME "__in_chrg" #define AUTO_VTABLE_NAME "__vtbl_me__" #define AUTO_TEMP_NAME "__tmp_" --- 3224,3229 ---- *************** extern varray_type local_classes; *** 3346,3352 **** #define AUTO_TEMP_FORMAT "__tmp_%d" #define VTABLE_BASE "__vtb" #define VTABLE_NAME "__vt_" ! #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt_") #define VTABLE_NAME_P(ID_NODE) \ (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \ sizeof (VTABLE_NAME) - 1)) --- 3233,3239 ---- #define AUTO_TEMP_FORMAT "__tmp_%d" #define VTABLE_BASE "__vtb" #define VTABLE_NAME "__vt_" ! #define VTABLE_NAME_PREFIX "__vt_" #define VTABLE_NAME_P(ID_NODE) \ (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \ sizeof (VTABLE_NAME) - 1)) *************** extern varray_type local_classes; *** 3355,3366 **** #define VFIELD_NAME_P(ID_NODE) \ (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \ sizeof (VFIELD_NAME) - 1)) ! #define VFIELD_NAME_FORMAT "_vptr_%s" ! #define VBASE_NAME "__vb_" ! #define VBASE_NAME_P(ID_NODE) \ ! (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \ ! sizeof (VBASE_NAME) - 1)) ! #define VBASE_NAME_FORMAT "__vb_%s" #define STATIC_NAME_FORMAT "__static_%s_%s" #define ANON_AGGRNAME_PREFIX "__anon_" --- 3242,3248 ---- #define VFIELD_NAME_P(ID_NODE) \ (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \ sizeof (VFIELD_NAME) - 1)) ! #define VFIELD_NAME_FORMAT "__vptr_%s" #define STATIC_NAME_FORMAT "__static_%s_%s" #define ANON_AGGRNAME_PREFIX "__anon_" *************** extern varray_type local_classes; *** 3368,3383 **** (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \ sizeof (ANON_AGGRNAME_PREFIX) - 1)) #define ANON_AGGRNAME_FORMAT "__anon_%d" - #define ANON_PARMNAME_FORMAT "__%d" - #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \ - && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \ - && IDENTIFIER_POINTER (ID_NODE)[2] <= '9') #endif /* NO_DOT_IN_LABEL */ #endif /* NO_DOLLAR_IN_LABEL */ #define THIS_NAME "this" - #define DESTRUCTOR_NAME_FORMAT "~%s" #define FILE_FUNCTION_PREFIX_LEN 9 #define CTOR_NAME "__ct" #define DTOR_NAME "__dt" --- 3250,3260 ---- *************** extern varray_type local_classes; *** 3386,3444 **** #define VTBL_PTR_TYPE "__vtbl_ptr_type" #define VTABLE_DELTA_NAME "__delta" - #define VTABLE_INDEX_NAME "__index" #define VTABLE_PFN_NAME "__pfn" - #define VTABLE_DELTA2_NAME "__delta2" #define EXCEPTION_CLEANUP_NAME "exception cleanup" - /* The name used as a prefix for VTTs. When the new ABI mangling - scheme is implemented, this should be removed. */ - - #define VTT_NAME_PREFIX "__vtt_" - - /* The name used as a prefix for construction vtables. */ - - #define CTOR_VTBL_NAME_PREFIX "__ctorvt_" - - #define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0) - #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \ && IDENTIFIER_POINTER (ID_NODE)[1] == 'v') - #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \ - && IDENTIFIER_POINTER (ID_NODE)[2] == '_') #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \ && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \ && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER) ! #define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \ ! && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \ ! && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER) ! ! #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1)) ! #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1)) /* For anonymous aggregate types, we need some sort of name to hold on to. In practice, this should not appear, but it should not be harmful if it does. */ #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \ && IDENTIFIER_POINTER (ID_NODE)[1] == '_') - #define ANON_PARMNAME_FORMAT "_%d" - #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \ - && IDENTIFIER_POINTER (ID_NODE)[1] <= '9') #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */ - /* Store the vbase pointer field name for type TYPE into pointer BUF. */ - #define FORMAT_VBASE_NAME(BUF,TYPE) do { \ - char *wbuf = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE) \ - + sizeof (VBASE_NAME) + 1); \ - sprintf (wbuf, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \ - (BUF) = wbuf; \ - } while (0) - /* Returns non-zero iff NODE is a declaration for the global function `main'. */ #define DECL_MAIN_P(NODE) \ --- 3263,3293 ---- #define VTBL_PTR_TYPE "__vtbl_ptr_type" #define VTABLE_DELTA_NAME "__delta" #define VTABLE_PFN_NAME "__pfn" #define EXCEPTION_CLEANUP_NAME "exception cleanup" #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \ && IDENTIFIER_POINTER (ID_NODE)[1] == 'v') #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \ && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \ && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER) ! #define TEMP_NAME_P(ID_NODE) \ ! (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1)) ! #define VFIELD_NAME_P(ID_NODE) \ ! (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1)) /* For anonymous aggregate types, we need some sort of name to hold on to. In practice, this should not appear, but it should not be harmful if it does. */ #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \ && IDENTIFIER_POINTER (ID_NODE)[1] == '_') #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */ /* Returns non-zero iff NODE is a declaration for the global function `main'. */ #define DECL_MAIN_P(NODE) \ *************** extern int flag_implicit_templates; *** 3472,3484 **** extern int flag_weak; - /* 0 if we should not perform inlining. - 1 if we should expand functions calls inline at the tree level. - 2 if we should consider *all* functions to be inline - candidates. */ - - extern int flag_inline_trees; - /* Nonzero if we're done parsing and into end-of-file activities. */ extern int at_eof; --- 3321,3326 ---- *************** extern tree static_dtors; *** 3491,3499 **** enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; /* Some macros for char-based bitfields. */ ! #define B_SET(a,x) (a[x>>3] |= (1 << (x&7))) ! #define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7))) ! #define B_TST(a,x) (a[x>>3] & (1 << (x&7))) /* These are uses as bits in flags passed to build_method_call to control its error reporting behavior. --- 3333,3341 ---- enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; /* Some macros for char-based bitfields. */ ! #define B_SET(A,X) ((A)[(X)>>3] |= (1 << ((X)&7))) ! #define B_CLR(A,X) ((A)[(X)>>3] &= ~(1 << ((X)&7))) ! #define B_TST(A,X) ((A)[(X)>>3] & (1 << ((X)&7))) /* These are uses as bits in flags passed to build_method_call to control its error reporting behavior. *************** enum overload_flags { NO_SPECIAL = 0, DT *** 3545,3555 **** #define LOOKUP_PREFER_BOTH (6144) #define LOOKUP_TEMPLATES_EXPECTED (8192) ! #define LOOKUP_NAMESPACES_ONLY(f) \ ! (((f) & LOOKUP_PREFER_NAMESPACES) && !((f) & LOOKUP_PREFER_TYPES)) ! #define LOOKUP_TYPES_ONLY(f) \ ! (!((f) & LOOKUP_PREFER_NAMESPACES) && ((f) & LOOKUP_PREFER_TYPES)) ! #define LOOKUP_QUALIFIERS_ONLY(f) ((f) & LOOKUP_PREFER_BOTH) /* These flags are used by the conversion code. --- 3387,3397 ---- #define LOOKUP_PREFER_BOTH (6144) #define LOOKUP_TEMPLATES_EXPECTED (8192) ! #define LOOKUP_NAMESPACES_ONLY(F) \ ! (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES)) ! #define LOOKUP_TYPES_ONLY(F) \ ! (!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES)) ! #define LOOKUP_QUALIFIERS_ONLY(F) ((F) & LOOKUP_PREFER_BOTH) /* These flags are used by the conversion code. *************** enum overload_flags { NO_SPECIAL = 0, DT *** 3623,3630 **** /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2 is derived from TYPE1, or if TYPE2 is a pointer (reference) to a class derived from the type pointed to (referred to) by TYPE1. */ ! #define same_or_base_type_p(type1, type2) \ ! comptypes ((type1), (type2), COMPARE_BASE) /* These macros are used to access a TEMPLATE_PARM_INDEX. */ #define TEMPLATE_PARM_INDEX_CAST(NODE) \ --- 3465,3472 ---- /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2 is derived from TYPE1, or if TYPE2 is a pointer (reference) to a class derived from the type pointed to (referred to) by TYPE1. */ ! #define same_or_base_type_p(TYPE1, TYPE2) \ ! comptypes ((TYPE1), (TYPE2), COMPARE_BASE) /* These macros are used to access a TEMPLATE_PARM_INDEX. */ #define TEMPLATE_PARM_INDEX_CAST(NODE) \ *************** enum overload_flags { NO_SPECIAL = 0, DT *** 3650,3660 **** /* These constants can used as bit flags in the process of tree formatting. TFF_PLAIN_IDENTIFIER: unqualified part of a name. ! TFF_NAMESPACE_SCOPE: the complete qualified-id form of a name. ! TFF_CLASS_SCOPE: if possible, include the class-name part of a ! qualified-id. This flag may be implied in some circumstances by ! TFF_NAMESPACE_SCOPE. ! TFF_SCOPE: the combinaison of the two above. TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name. TFF_DECL_SPECIFIERS: print decl-specifiers. TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with --- 3492,3498 ---- /* These constants can used as bit flags in the process of tree formatting. TFF_PLAIN_IDENTIFIER: unqualified part of a name. ! TFF_SCOPE: include the class and namespace scope of the name. TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name. TFF_DECL_SPECIFIERS: print decl-specifiers. TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with *************** enum overload_flags { NO_SPECIAL = 0, DT *** 3662,3688 **** TFF_RETURN_TYPE: include function return type. TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values. TFF_EXCEPTION_SPECIFICATION: show function exception specification. ! TFF_TEMPLATE_HEADER: show the template<...> hearder in a template-declaration. - TFF_TEMPLATE_DEFAULT_ARGUMENTS: show template paramter default values. TFF_TEMPLATE_NAME: show only template-name. TFF_EXPR_IN_PARENS: Parenthesize expressions. */ #define TFF_PLAIN_IDENTIFIER (0) ! #define TFF_NAMESPACE_SCOPE (1) ! #define TFF_CLASS_SCOPE (1 << 1) ! #define TFF_CHASE_NAMESPACE_ALIAS (1 << 2) ! #define TFF_CHASE_TYPEDEF (1 << 3) ! #define TFF_DECL_SPECIFIERS (1 << 4) ! #define TFF_CLASS_KEY_OR_ENUM (1 << 5) ! #define TFF_RETURN_TYPE (1 << 6) ! #define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 7) ! #define TFF_EXCEPTION_SPECIFICATION (1 << 8) ! #define TFF_TEMPLATE_HEADER (1 << 9) ! #define TFF_TEMPLATE_DEFAULT_ARGUMENTS (1 << 10) ! #define TFF_TEMPLATE_NAME (1 << 11) ! #define TFF_EXPR_IN_PARENS (1 << 12) ! #define TFF_SCOPE (TFF_NAMESPACE_SCOPE | TFF_CLASS_SCOPE) /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM node. */ --- 3500,3521 ---- TFF_RETURN_TYPE: include function return type. TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values. TFF_EXCEPTION_SPECIFICATION: show function exception specification. ! TFF_TEMPLATE_HEADER: show the template<...> header in a template-declaration. TFF_TEMPLATE_NAME: show only template-name. TFF_EXPR_IN_PARENS: Parenthesize expressions. */ #define TFF_PLAIN_IDENTIFIER (0) ! #define TFF_SCOPE (1) ! #define TFF_CHASE_TYPEDEF (1 << 1) ! #define TFF_DECL_SPECIFIERS (1 << 2) ! #define TFF_CLASS_KEY_OR_ENUM (1 << 3) ! #define TFF_RETURN_TYPE (1 << 4) ! #define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5) ! #define TFF_EXCEPTION_SPECIFICATION (1 << 6) ! #define TFF_TEMPLATE_HEADER (1 << 7) ! #define TFF_TEMPLATE_NAME (1 << 8) ! #define TFF_EXPR_IN_PARENS (1 << 9) /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM node. */ *************** enum overload_flags { NO_SPECIAL = 0, DT *** 3692,3697 **** --- 3525,3533 ---- : TYPE_NAME (NODE)) /* in lex.c */ + + extern void init_reswords PARAMS ((void)); + /* Indexed by TREE_CODE, these tables give C-looking names to operators represented by TREE_CODES. For example, opname_tab[(int) MINUS_EXPR] == "-". */ *************** extern tree build_new_op PARAMS ((enum *** 3731,3736 **** --- 3567,3573 ---- 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 strip_top_quals *** 3742,3750 **** extern tree perform_implicit_conversion PARAMS ((tree, tree)); /* in class.c */ extern tree build_vbase_path PARAMS ((enum tree_code, tree, tree, tree, int)); extern tree build_vtbl_ref PARAMS ((tree, tree)); ! extern tree build_vfn_ref PARAMS ((tree *, tree, tree)); extern tree get_vtable_decl PARAMS ((tree, int)); extern void add_method PARAMS ((tree, tree, int)); extern int currently_open_class PARAMS ((tree)); --- 3579,3588 ---- extern tree perform_implicit_conversion PARAMS ((tree, tree)); /* in class.c */ + extern tree build_base_path PARAMS ((enum tree_code, tree, tree, int)); extern tree build_vbase_path PARAMS ((enum tree_code, tree, tree, tree, int)); extern tree build_vtbl_ref PARAMS ((tree, tree)); ! extern tree build_vfn_ref PARAMS ((tree, tree)); extern tree get_vtable_decl PARAMS ((tree, int)); extern void add_method PARAMS ((tree, tree, int)); extern int currently_open_class PARAMS ((tree)); *************** extern void pushclass PARAMS ((tree, *** 3759,3768 **** extern void popclass PARAMS ((void)); extern void push_nested_class PARAMS ((tree, int)); extern void pop_nested_class PARAMS ((void)); extern void push_lang_context PARAMS ((tree)); extern void pop_lang_context PARAMS ((void)); ! extern tree instantiate_type PARAMS ((tree, tree, enum instantiate_type_flags)); ! extern void print_class_statistics PARAMS ((void)); extern void build_self_reference PARAMS ((void)); extern int same_signature_p PARAMS ((tree, tree)); extern void warn_hidden PARAMS ((tree)); --- 3597,3613 ---- 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_set_yydebug PARAMS ((int)); extern void build_self_reference PARAMS ((void)); extern int same_signature_p PARAMS ((tree, tree)); extern void warn_hidden PARAMS ((tree)); *************** extern tree get_primary_binfo *** 3781,3792 **** 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 convert_pointer_to_real PARAMS ((tree, tree)); - extern tree convert_pointer_to PARAMS ((tree, tree)); extern tree ocp_convert PARAMS ((tree, tree, int, int)); extern tree cp_convert PARAMS ((tree, tree)); extern tree convert_to_void PARAMS ((tree, const char */*implicit context*/)); - extern tree convert PARAMS ((tree, tree)); extern tree convert_force PARAMS ((tree, tree, int)); extern tree build_type_conversion PARAMS ((tree, tree, int)); extern tree build_expr_type_conversion PARAMS ((int, tree, int)); --- 3626,3634 ---- *************** extern void adjust_clone_args PARAMS ( *** 3797,3804 **** /* decl.c */ /* resume_binding_level */ ! extern void set_identifier_local_value PARAMS ((tree, tree)); ! extern int global_bindings_p PARAMS ((void)); extern int toplevel_bindings_p PARAMS ((void)); extern int namespace_bindings_p PARAMS ((void)); extern void keep_next_level PARAMS ((int)); --- 3639,3645 ---- /* decl.c */ /* resume_binding_level */ ! extern void cxx_init_decl_processing PARAMS ((void)); extern int toplevel_bindings_p PARAMS ((void)); extern int namespace_bindings_p PARAMS ((void)); extern void keep_next_level PARAMS ((int)); *************** extern void note_level_for_try PARAMS *** 3813,3821 **** extern void note_level_for_catch PARAMS ((void)); extern void resume_level PARAMS ((struct binding_level *)); extern void delete_block PARAMS ((tree)); - extern void insert_block PARAMS ((tree)); extern void add_block_current_level PARAMS ((tree)); - extern void set_block PARAMS ((tree)); extern void pushlevel_class PARAMS ((void)); extern void poplevel_class PARAMS ((void)); extern void print_binding_stack PARAMS ((void)); --- 3654,3660 ---- *************** extern tree make_anon_name PARAMS ((vo *** 3837,3843 **** extern void clear_anon_tags PARAMS ((void)); extern int decls_match PARAMS ((tree, tree)); extern int duplicate_decls PARAMS ((tree, tree)); - extern tree pushdecl PARAMS ((tree)); extern tree pushdecl_top_level PARAMS ((tree)); extern void pushdecl_class_level PARAMS ((tree)); extern tree pushdecl_namespace_level PARAMS ((tree)); --- 3676,3681 ---- *************** extern tree push_using_decl *** 3845,3863 **** extern tree push_using_directive PARAMS ((tree)); extern void push_class_level_binding PARAMS ((tree, tree)); extern tree implicitly_declare PARAMS ((tree)); - extern tree lookup_label PARAMS ((tree)); extern tree declare_local_label PARAMS ((tree)); extern tree define_label PARAMS ((const char *, int, tree)); extern void check_goto PARAMS ((tree)); extern void define_case_label PARAMS ((void)); - extern tree getdecls PARAMS ((void)); - extern tree gettags PARAMS ((void)); extern tree binding_for_name PARAMS ((tree, tree)); extern tree namespace_binding PARAMS ((tree, tree)); extern void set_namespace_binding PARAMS ((tree, tree, tree)); extern tree lookup_namespace_name PARAMS ((tree, tree)); extern tree build_typename_type PARAMS ((tree, tree, tree, tree)); ! extern tree make_typename_type PARAMS ((tree, tree, int)); extern tree lookup_name_nonclass PARAMS ((tree)); extern tree lookup_function_nonclass PARAMS ((tree, tree)); extern tree lookup_name PARAMS ((tree, int)); --- 3683,3699 ---- extern tree push_using_directive PARAMS ((tree)); extern void push_class_level_binding PARAMS ((tree, tree)); extern tree implicitly_declare PARAMS ((tree)); extern tree declare_local_label PARAMS ((tree)); extern tree define_label PARAMS ((const char *, int, tree)); extern void check_goto PARAMS ((tree)); extern void define_case_label PARAMS ((void)); extern tree binding_for_name PARAMS ((tree, tree)); extern tree namespace_binding PARAMS ((tree, tree)); extern void set_namespace_binding PARAMS ((tree, tree, tree)); extern tree lookup_namespace_name PARAMS ((tree, tree)); extern tree build_typename_type PARAMS ((tree, tree, tree, tree)); ! extern tree make_typename_type PARAMS ((tree, tree, tsubst_flags_t)); ! extern tree make_unbound_class_template PARAMS ((tree, tree, int)); extern tree lookup_name_nonclass PARAMS ((tree)); extern tree lookup_function_nonclass PARAMS ((tree, tree)); extern tree lookup_name PARAMS ((tree, int)); *************** extern tree build_cp_library_fn_ptr PAR *** 3876,3882 **** 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 void init_decl_processing PARAMS ((void)); extern int init_type_desc PARAMS ((void)); extern tree check_tag_decl PARAMS ((tree)); extern void shadow_tag PARAMS ((tree)); --- 3712,3717 ---- *************** extern int complete_array_type PARAMS *** 3893,3901 **** extern tree build_ptrmemfunc_type PARAMS ((tree)); /* the grokdeclarator prototype is in decl.h */ extern int parmlist_is_exprlist PARAMS ((tree)); ! extern int copy_args_p PARAMS ((tree)); extern int grok_ctor_properties PARAMS ((tree, tree)); ! extern void grok_op_properties PARAMS ((tree, int, int)); extern tree xref_tag PARAMS ((tree, tree, int)); extern tree xref_tag_from_type PARAMS ((tree, tree, int)); extern void xref_basetypes PARAMS ((tree, tree, tree, tree)); --- 3728,3737 ---- extern tree build_ptrmemfunc_type PARAMS ((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 PARAMS ((tree, tree, int)); extern tree xref_tag_from_type PARAMS ((tree, tree, int)); extern void xref_basetypes PARAMS ((tree, tree, tree, tree)); *************** extern tree start_enum PARAMS ((tree) *** 3903,3913 **** 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 finish_function PARAMS ((int)); extern tree start_method PARAMS ((tree, tree, tree)); extern tree finish_method PARAMS ((tree)); ! extern void hack_incomplete_structures PARAMS ((tree)); ! extern tree maybe_build_cleanup PARAMS ((tree)); extern void finish_stmt PARAMS ((void)); extern void print_other_binding_stack PARAMS ((struct binding_level *)); extern void revert_static_member_fn PARAMS ((tree)); --- 3739,3751 ---- 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 binding_level *)); extern void revert_static_member_fn PARAMS ((tree)); *************** extern int nonstatic_local_decl_p *** 3941,3946 **** --- 3779,3785 ---- extern tree declare_global_var PARAMS ((tree, tree)); extern void register_dtor_fn PARAMS ((tree)); extern tmpl_spec_kind current_tmpl_spec_kind PARAMS ((int)); + extern tree cp_fname_init PARAMS ((const char *)); /* in decl2.c */ extern void init_decl2 PARAMS ((void)); *************** extern void grok_x_components PARAMS ( *** 3952,3958 **** 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_alignof PARAMS ((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)); --- 3791,3796 ---- *************** extern tree grokfield PARAMS ((tree, *** 3961,3972 **** extern tree grokbitfield PARAMS ((tree, tree, tree)); extern tree groktypefield PARAMS ((tree, tree)); extern tree grokoptypename PARAMS ((tree, tree)); ! extern int copy_assignment_arg_p PARAMS ((tree, int)); ! extern void cplus_decl_attributes PARAMS ((tree, tree, tree)); extern tree constructor_name_full PARAMS ((tree)); extern tree constructor_name PARAMS ((tree)); extern void defer_fn PARAMS ((tree)); - extern tree get_temp_name 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 *, --- 3799,3808 ---- extern tree grokbitfield PARAMS ((tree, tree, tree)); extern tree groktypefield PARAMS ((tree, tree)); extern tree grokoptypename PARAMS ((tree, tree)); ! extern void cplus_decl_attributes PARAMS ((tree *, tree, int)); extern tree constructor_name_full PARAMS ((tree)); extern tree constructor_name PARAMS ((tree)); extern void defer_fn PARAMS ((tree)); extern void finish_anon_union PARAMS ((tree)); extern tree finish_table PARAMS ((tree, tree, tree, int)); extern void finish_builtin_type PARAMS ((tree, const char *, *************** extern tree do_class_using_decl PARAMS *** 3996,4002 **** extern void do_using_directive PARAMS ((tree)); extern void check_default_args PARAMS ((tree)); extern void mark_used PARAMS ((tree)); ! extern tree handle_class_head PARAMS ((tree, tree, tree)); extern tree lookup_arg_dependent PARAMS ((tree, tree, tree)); extern void finish_static_data_member_decl PARAMS ((tree, tree, tree, int)); extern tree build_artificial_parm PARAMS ((tree, tree)); --- 3832,3838 ---- extern void do_using_directive PARAMS ((tree)); extern void check_default_args PARAMS ((tree)); extern void mark_used PARAMS ((tree)); ! extern tree handle_class_head PARAMS ((tree, tree, tree, int, int *)); extern tree lookup_arg_dependent PARAMS ((tree, tree, tree)); extern void finish_static_data_member_decl PARAMS ((tree, tree, tree, int)); extern tree build_artificial_parm PARAMS ((tree, tree)); *************** extern tree set_guard *** 4007,4023 **** /* in parse.y */ extern void cp_parse_init PARAMS ((void)); ! /* in errfn.c */ ! /* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */ ! extern void cp_error PARAMS ((const char *, ...)); ! extern void cp_error_at PARAMS ((const char *, ...)); ! extern void cp_warning PARAMS ((const char *, ...)); ! extern void cp_warning_at PARAMS ((const char *, ...)); ! extern void cp_pedwarn PARAMS ((const char *, ...)); ! extern void cp_pedwarn_at PARAMS ((const char *, ...)); ! extern void cp_compiler_error PARAMS ((const char *, ...)); ! extern void cp_sprintf PARAMS ((const char *, ...)); ! extern void cp_deprecated PARAMS ((const char*)); /* in error.c */ extern void init_error PARAMS ((void)); --- 3843,3859 ---- /* in parse.y */ extern void cp_parse_init PARAMS ((void)); ! extern void cp_error_at PARAMS ((const char *msgid, ...)); ! extern void cp_warning_at PARAMS ((const char *msgid, ...)); ! extern void cp_pedwarn_at PARAMS ((const char *msgid, ...)); ! ! /* XXX Not i18n clean. */ ! #define cp_deprecated(STR) \ ! do { \ ! if (warn_deprecated) \ ! warning ("%s is deprecated, please see the documentation for details", \ ! (STR)); \ ! } while (0) /* in error.c */ extern void init_error PARAMS ((void)); *************** extern const char *cp_file_of PARAMS ( *** 4030,4047 **** extern int cp_line_of PARAMS ((tree)); extern const char *language_to_string PARAMS ((enum languages, int)); extern void print_instantiation_context PARAMS ((void)); - /* cp_printer is the type of a function which converts an argument into - a string for digestion by printf. The cp_printer function should deal - with all memory management; the functions in errfn will not free - the char*s returned. See error.c for an example use of this code. */ - typedef const char *cp_printer PARAMS ((tree, int)); - extern cp_printer *cp_printers[256]; - /* 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 ((tree)); extern void expand_builtin_throw PARAMS ((void)); extern void expand_eh_spec_block PARAMS ((tree)); extern void expand_exception_blocks PARAMS ((void)); --- 3866,3876 ---- extern int cp_line_of PARAMS ((tree)); extern const char *language_to_string PARAMS ((enum languages, int)); extern void print_instantiation_context PARAMS ((void)); /* in except.c */ extern void init_exception_processing 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_new PARAMS ((tree, *** 4078,4083 **** --- 3907,3913 ---- extern tree build_vec_init PARAMS ((tree, tree, int)); extern tree build_x_delete PARAMS ((tree, int, tree)); extern tree build_delete PARAMS ((tree, tree, special_function_kind, int, int)); + extern void perform_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 tree build_java_class_ref *** 4089,4095 **** /* in input.c */ /* in lex.c */ - extern char *file_name_nondirectory PARAMS ((const char *)); extern tree make_pointer_declarator PARAMS ((tree, tree)); extern tree make_reference_declarator PARAMS ((tree, tree)); extern tree make_call_declarator PARAMS ((tree, tree, tree, tree)); --- 3919,3924 ---- *************** extern tree identifier_typedecl_value P *** 4112,4118 **** 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 void copy_lang_decl PARAMS ((tree)); extern tree cp_make_lang_type PARAMS ((enum tree_code)); extern tree make_aggr_type PARAMS ((enum tree_code)); extern void compiler_error PARAMS ((const char *, ...)) --- 3941,3947 ---- extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree)); extern void retrofit_lang_decl PARAMS ((tree)); extern tree copy_decl PARAMS ((tree)); ! extern tree copy_type PARAMS ((tree)); extern tree cp_make_lang_type PARAMS ((enum tree_code)); extern tree make_aggr_type PARAMS ((enum tree_code)); extern void compiler_error PARAMS ((const char *, ...)) *************** extern void yyerror PARAMS ((const ch *** 4121,4126 **** --- 3950,3959 ---- extern void clear_inline_text_obstack PARAMS ((void)); extern void yyhook PARAMS ((int)); extern int cp_type_qual_from_rid PARAMS ((tree)); + extern const char *cxx_init PARAMS ((const char *)); + extern void cxx_finish PARAMS ((void)); + extern void cxx_init_options PARAMS ((void)); + extern void cxx_post_options PARAMS ((void)); /* in method.c */ extern void init_method PARAMS ((void)); *************** extern int maybe_clone_body *** 4142,4150 **** extern void init_pt PARAMS ((void)); extern void check_template_shadow PARAMS ((tree)); extern tree get_innermost_template_args PARAMS ((tree, int)); ! extern tree tsubst PARAMS ((tree, tree, int, tree)); ! extern tree tsubst_expr PARAMS ((tree, tree, int, tree)); ! extern tree tsubst_copy PARAMS ((tree, tree, int, tree)); extern void maybe_begin_member_template_processing PARAMS ((tree)); extern void maybe_end_member_template_processing PARAMS ((void)); extern tree finish_member_template_decl PARAMS ((tree)); --- 3975,3983 ---- extern void init_pt PARAMS ((void)); extern void check_template_shadow PARAMS ((tree)); extern tree get_innermost_template_args PARAMS ((tree, int)); ! extern tree tsubst PARAMS ((tree, tree, 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 tree current_template_args PARAM *** 4162,4168 **** extern tree push_template_decl PARAMS ((tree)); extern tree push_template_decl_real PARAMS ((tree, int)); extern void redeclare_class_template PARAMS ((tree, tree)); ! extern tree lookup_template_class PARAMS ((tree, tree, tree, tree, int, int)); extern tree lookup_template_function PARAMS ((tree, tree)); extern int uses_template_parms PARAMS ((tree)); extern tree instantiate_class_template PARAMS ((tree)); --- 3995,4001 ---- 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 void mark_decl_instantiated PARA *** 4173,4179 **** extern int more_specialized PARAMS ((tree, tree, int, int)); extern void mark_class_instantiated PARAMS ((tree, int)); extern void do_decl_instantiation PARAMS ((tree, tree, tree)); ! extern void do_type_instantiation PARAMS ((tree, tree, int)); extern tree instantiate_decl PARAMS ((tree, int)); extern tree get_bindings PARAMS ((tree, tree, tree)); extern int push_tinst_level PARAMS ((tree)); --- 4006,4012 ---- extern int more_specialized PARAMS ((tree, tree, int, int)); extern void mark_class_instantiated PARAMS ((tree, int)); extern void do_decl_instantiation PARAMS ((tree, tree, tree)); ! extern void do_type_instantiation PARAMS ((tree, tree, 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 init_rtti_processing PARAMS *** 4209,4225 **** extern tree build_typeid PARAMS((tree)); extern tree get_tinfo_decl PARAMS((tree)); extern tree get_typeid PARAMS((tree)); - extern tree get_typeid_1 PARAMS((tree)); extern tree build_dynamic_cast PARAMS((tree, tree)); extern void emit_support_tinfos PARAMS((void)); extern int tinfo_decl_p PARAMS((tree, void *)); extern int emit_tinfo_decl PARAMS((tree *, void *)); /* in search.c */ extern int types_overlap_p PARAMS ((tree, tree)); extern tree get_vbase PARAMS ((tree, tree)); - extern tree get_binfo PARAMS ((tree, tree, int)); - extern int get_base_distance PARAMS ((tree, tree, int, 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)); --- 4042,4056 ---- extern tree build_typeid PARAMS((tree)); extern tree get_tinfo_decl PARAMS((tree)); extern tree get_typeid PARAMS((tree)); extern tree build_dynamic_cast PARAMS((tree, tree)); extern void emit_support_tinfos PARAMS((void)); extern int tinfo_decl_p PARAMS((tree, void *)); extern int emit_tinfo_decl PARAMS((tree *, void *)); /* in search.c */ + extern 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_fnfields PARAMS ((t *** 4229,4235 **** 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 tree init_vbase_pointers PARAMS ((tree, tree)); extern void get_vbase_types PARAMS ((tree)); extern void maybe_suppress_debug_info PARAMS ((tree)); extern void note_debug_info_needed PARAMS ((tree)); --- 4060,4065 ---- *************** extern tree dfs_walk_real *** 4258,4275 **** extern tree dfs_unmark PARAMS ((tree, void *)); extern tree markedp PARAMS ((tree, void *)); extern tree unmarkedp PARAMS ((tree, void *)); - extern tree dfs_skip_nonprimary_vbases_unmarkedp PARAMS ((tree, void *)); - extern tree dfs_skip_nonprimary_vbases_markedp PARAMS ((tree, void *)); extern tree dfs_unmarked_real_bases_queue_p PARAMS ((tree, void *)); extern tree dfs_marked_real_bases_queue_p PARAMS ((tree, void *)); extern tree dfs_skip_vbases PARAMS ((tree, void *)); extern tree marked_vtable_pathp PARAMS ((tree, void *)); extern tree unmarked_vtable_pathp PARAMS ((tree, void *)); - extern tree convert_pointer_to_vbase PARAMS ((tree, tree)); 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 void fixup_all_virtual_upcast_offsets PARAMS ((tree)); /* in semantics.c */ extern void init_cp_semantics PARAMS ((void)); --- 4088,4101 ---- *************** extern void finish_function_try_block *** 4309,4317 **** extern void finish_function_handler_sequence PARAMS ((tree)); extern void finish_cleanup_try_block PARAMS ((tree)); extern tree begin_handler PARAMS ((void)); ! extern tree finish_handler_parms PARAMS ((tree, tree)); extern void begin_catch_block PARAMS ((tree)); ! extern void finish_handler PARAMS ((tree, tree)); extern void finish_cleanup PARAMS ((tree, tree)); extern tree begin_compound_stmt PARAMS ((int)); extern tree finish_compound_stmt PARAMS ((int, tree)); --- 4135,4143 ---- 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_object_call_expr *** 4329,4338 **** extern tree finish_qualified_object_call_expr PARAMS ((tree, tree, tree)); extern tree finish_pseudo_destructor_call_expr PARAMS ((tree, tree, tree)); extern tree finish_qualified_call_expr PARAMS ((tree, tree)); - extern tree finish_label_address_expr PARAMS ((tree)); extern tree finish_unary_op_expr PARAMS ((enum tree_code, tree)); extern tree finish_id_expr PARAMS ((tree)); extern void save_type_access_control PARAMS ((tree)); extern void decl_type_access_control PARAMS ((tree)); extern int begin_function_definition PARAMS ((tree, tree)); extern tree begin_constructor_declarator PARAMS ((tree, tree)); --- 4155,4164 ---- extern tree finish_qualified_object_call_expr PARAMS ((tree, tree, tree)); extern tree finish_pseudo_destructor_call_expr PARAMS ((tree, tree, tree)); extern tree finish_qualified_call_expr PARAMS ((tree, tree)); extern tree finish_unary_op_expr PARAMS ((enum tree_code, tree)); extern tree finish_id_expr PARAMS ((tree)); extern void save_type_access_control PARAMS ((tree)); + extern void reset_type_access_control PARAMS ((void)); extern void decl_type_access_control PARAMS ((tree)); extern int begin_function_definition PARAMS ((tree, tree)); extern tree begin_constructor_declarator PARAMS ((tree, tree)); *************** extern tree finish_base_specifier *** 4354,4363 **** extern void finish_member_declaration PARAMS ((tree)); extern void check_multiple_declarators PARAMS ((void)); extern tree finish_typeof PARAMS ((tree)); extern void finish_decl_cleanup PARAMS ((tree, tree)); extern void finish_named_return_value PARAMS ((tree, tree)); extern void expand_body PARAMS ((tree)); ! extern void prep_stmt PARAMS ((tree)); extern void do_pushlevel PARAMS ((void)); extern tree do_poplevel PARAMS ((void)); extern void finish_mem_initializers PARAMS ((tree)); --- 4180,4191 ---- extern void finish_member_declaration PARAMS ((tree)); extern void check_multiple_declarators PARAMS ((void)); extern tree finish_typeof PARAMS ((tree)); + extern tree finish_sizeof PARAMS ((tree)); + extern tree finish_alignof PARAMS ((tree)); extern void finish_decl_cleanup PARAMS ((tree, tree)); extern void finish_named_return_value PARAMS ((tree, tree)); extern void expand_body PARAMS ((tree)); ! extern tree nullify_returns_r PARAMS ((tree *, int *, void *)); extern void do_pushlevel PARAMS ((void)); extern tree do_poplevel PARAMS ((void)); extern void finish_mem_initializers PARAMS ((tree)); *************** extern tree finish_global_stmt_expr *** 4369,4376 **** /* in spew.c */ extern void init_spew PARAMS ((void)); extern int peekyylex PARAMS ((void)); - extern int yylex PARAMS ((void)); extern tree arbitrate_lookup PARAMS ((tree, tree, tree)); extern tree frob_opname PARAMS ((tree)); extern void maybe_snarf_defarg PARAMS ((void)); --- 4197,4204 ---- /* in spew.c */ extern void init_spew PARAMS ((void)); + extern void mark_pending_inlines PARAMS ((PTR)); extern int peekyylex PARAMS ((void)); extern tree arbitrate_lookup PARAMS ((tree, tree, tree)); extern tree frob_opname PARAMS ((tree)); extern void maybe_snarf_defarg PARAMS ((void)); *************** extern void do_pending_defargs PARAMS *** 4379,4384 **** --- 4207,4213 ---- extern void done_pending_defargs PARAMS ((void)); extern void unprocessed_defarg_fn PARAMS ((tree)); extern void replace_defarg PARAMS ((tree, tree)); + extern void end_input PARAMS ((void)); /* in tree.c */ extern void init_tree PARAMS ((void)); *************** extern int member_p PARAMS ((tree)); *** 4389,4396 **** extern cp_lvalue_kind real_lvalue_p PARAMS ((tree)); extern tree build_min PARAMS ((enum tree_code, tree, ...)); extern tree build_min_nt PARAMS ((enum tree_code, ...)); - extern int lvalue_p PARAMS ((tree)); - extern int lvalue_or_else PARAMS ((tree, const char *)); extern tree build_cplus_new PARAMS ((tree, tree)); extern tree get_target_expr PARAMS ((tree)); extern tree break_out_calls PARAMS ((tree)); --- 4218,4223 ---- *************** extern tree hash_tree_cons PARAMS ((tr *** 4401,4407 **** 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 binfo_value PARAMS ((tree, tree)); extern tree reverse_path PARAMS ((tree)); extern int count_functions PARAMS ((tree)); extern int is_overloaded_fn PARAMS ((tree)); --- 4228,4233 ---- *************** extern tree get_first_fn PARAMS ((tree *** 4409,4422 **** extern int bound_pmf_p PARAMS ((tree)); extern tree ovl_cons PARAMS ((tree, tree)); extern tree build_overload PARAMS ((tree, tree)); - extern tree fnaddr_from_vtable_entry PARAMS ((tree)); extern tree function_arg_chain PARAMS ((tree)); extern int promotes_to_aggr_type PARAMS ((tree, enum tree_code)); extern int is_aggr_type_2 PARAMS ((tree, tree)); extern const char *lang_printable_name PARAMS ((tree, int)); extern tree build_exception_variant PARAMS ((tree, tree)); ! extern tree copy_template_template_parm PARAMS ((tree, tree)); ! extern void print_lang_statistics PARAMS ((void)); extern tree array_type_nelts_total PARAMS ((tree)); extern tree array_type_nelts_top PARAMS ((tree)); extern tree break_out_target_exprs PARAMS ((tree)); --- 4235,4246 ---- extern int bound_pmf_p PARAMS ((tree)); extern tree ovl_cons PARAMS ((tree, tree)); extern tree build_overload PARAMS ((tree, tree)); extern tree function_arg_chain PARAMS ((tree)); extern int promotes_to_aggr_type PARAMS ((tree, enum tree_code)); extern int is_aggr_type_2 PARAMS ((tree, tree)); extern const char *lang_printable_name PARAMS ((tree, int)); extern tree build_exception_variant PARAMS ((tree, tree)); ! extern tree bind_template_template_parm PARAMS ((tree, tree)); extern tree array_type_nelts_total PARAMS ((tree)); extern tree array_type_nelts_top PARAMS ((tree)); extern tree break_out_target_exprs PARAMS ((tree)); *************** extern void debug_binfo PARAMS ((tree *** 4436,4455 **** extern tree build_dummy_object PARAMS ((tree)); extern tree maybe_dummy_object PARAMS ((tree, tree *)); extern int is_dummy_object PARAMS ((tree)); ! extern tree walk_tree PARAMS ((tree *, ! walk_tree_fn, ! void *, ! htab_t)); ! extern tree walk_tree_without_duplicates PARAMS ((tree *, ! walk_tree_fn, ! void *)); ! extern tree copy_tree_r PARAMS ((tree *, int *, void *)); ! extern int cp_valid_lang_attribute PARAMS ((tree, tree, tree, tree)); extern tree make_ptrmem_cst PARAMS ((tree, tree)); ! extern tree cp_build_qualified_type_real PARAMS ((tree, int, int)); ! extern void remap_save_expr PARAMS ((tree *, splay_tree, tree, int *)); #define cp_build_qualified_type(TYPE, QUALS) \ ! cp_build_qualified_type_real ((TYPE), (QUALS), /*complain=*/1) extern tree build_shared_int_cst PARAMS ((int)); extern special_function_kind special_function_p PARAMS ((tree)); extern int count_trees PARAMS ((tree)); --- 4260,4270 ---- extern tree build_dummy_object PARAMS ((tree)); extern tree maybe_dummy_object PARAMS ((tree, tree *)); extern int is_dummy_object PARAMS ((tree)); ! extern const struct attribute_spec cp_attribute_table[]; extern tree make_ptrmem_cst PARAMS ((tree, tree)); ! extern tree cp_build_qualified_type_real PARAMS ((tree, int, 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 int count_trees PARAMS ((tree)); *************** extern int char_type_p *** 4457,4462 **** --- 4272,4287 ---- extern void verify_stmt_tree PARAMS ((tree)); extern tree find_tree PARAMS ((tree, tree)); extern linkage_kind decl_linkage PARAMS ((tree)); + extern tree cp_walk_subtrees PARAMS ((tree*, int*, walk_tree_fn, + void*, void*)); + extern int cp_cannot_inline_tree_fn PARAMS ((tree*)); + extern tree cp_add_pending_fn_decls PARAMS ((void*,tree)); + extern int cp_is_overload_p PARAMS ((tree)); + extern int cp_auto_var_in_fn_p PARAMS ((tree,tree)); + extern tree cp_copy_res_decl_for_inlining PARAMS ((tree, tree, tree, void*, + int*, void*)); + extern int cp_start_inlining PARAMS ((tree)); + extern void cp_end_inlining PARAMS ((tree)); /* in typeck.c */ extern int string_conv_p PARAMS ((tree, tree, int)); *************** extern int comp_except_specs PARAMS (( *** 4473,4488 **** 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_target_types PARAMS ((tree, tree, int)); extern int comp_cv_qualification PARAMS ((tree, tree)); extern int comp_cv_qual_signature PARAMS ((tree, tree)); - extern tree unsigned_type PARAMS ((tree)); - extern tree signed_type PARAMS ((tree)); - extern tree signed_or_unsigned_type PARAMS ((int, tree)); extern tree expr_sizeof PARAMS ((tree)); - extern tree c_sizeof PARAMS ((tree)); extern tree c_sizeof_nowarn PARAMS ((tree)); - extern tree c_alignof PARAMS ((tree)); extern tree inline_conversion PARAMS ((tree)); extern tree decay_conversion PARAMS ((tree)); extern tree build_object_ref PARAMS ((tree, tree, tree)); --- 4298,4307 ---- *************** extern tree build_array_ref PARAMS ((t *** 4495,4507 **** extern tree build_x_function_call PARAMS ((tree, tree, tree)); extern tree get_member_function_from_ptrfunc PARAMS ((tree *, tree)); extern tree build_function_call_real PARAMS ((tree, tree, int, int)); - extern tree build_function_call PARAMS ((tree, tree)); 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 int mark_addressable PARAMS ((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)); --- 4314,4324 ---- *************** extern tree pfn_from_ptrmemfunc *** 4526,4531 **** --- 4343,4349 ---- 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)); #define cp_build_binary_op(code, arg1, arg2) \ build_binary_op(code, arg1, arg2, 1) *************** extern tree error_not_base_type PARAMS *** 4535,4549 **** 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 void incomplete_type_error PARAMS ((tree, tree)); - extern void friendly_abort PARAMS ((int, const char *, - int, const char *)) - ATTRIBUTE_NORETURN; - #define my_friendly_abort(N) \ - friendly_abort (N, __FILE__, __LINE__, __FUNCTION__) #define my_friendly_assert(EXP, N) (void) \ ! (((EXP) == 0) ? (friendly_abort (N, __FILE__, __LINE__, __FUNCTION__), 0) : 0) extern tree store_init_value PARAMS ((tree, tree)); extern tree digest_init PARAMS ((tree, tree, tree *)); --- 4353,4361 ---- extern tree binfo_or_else PARAMS ((tree, tree)); extern void readonly_error PARAMS ((tree, const char *, int)); extern int abstract_virtuals_error PARAMS ((tree, tree)); #define my_friendly_assert(EXP, N) (void) \ ! (((EXP) == 0) ? (fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0) : 0) extern tree store_init_value PARAMS ((tree, tree)); extern tree digest_init PARAMS ((tree, tree, tree *)); *************** extern void check_for_new_type PARAMS *** 4555,4574 **** extern tree add_exception_specifier PARAMS ((tree, tree, int)); extern tree merge_exception_specifiers PARAMS ((tree, tree)); - /* in xref.c */ - extern void GNU_xref_begin PARAMS ((const char *)); - extern void GNU_xref_end PARAMS ((int)); - extern void GNU_xref_file PARAMS ((const char *)); - extern void GNU_xref_start_scope PARAMS ((HOST_WIDE_INT)); - extern void GNU_xref_end_scope PARAMS ((HOST_WIDE_INT, HOST_WIDE_INT, int, int)); - extern void GNU_xref_ref PARAMS ((tree, const char *)); - extern void GNU_xref_decl PARAMS ((tree, tree)); - extern void GNU_xref_call PARAMS ((tree, const char *)); - extern void GNU_xref_function PARAMS ((tree, tree)); - extern void GNU_xref_assign PARAMS ((tree)); - extern void GNU_xref_hier PARAMS ((tree, tree, int, int, int)); - extern void GNU_xref_member PARAMS ((tree, tree)); - /* in mangle.c */ extern void init_mangle PARAMS ((void)); extern void mangle_decl PARAMS ((tree)); --- 4367,4372 ---- *************** extern tree mangle_ctor_vtbl_for_type *** 4582,4591 **** 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)); /* in dump.c */ ! extern int cp_dump_tree PARAMS ((dump_info_p, tree)); /* -- end of C++ */ ! #endif /* not _CP_TREE_H */ --- 4380,4390 ---- extern tree mangle_thunk PARAMS ((tree, tree, tree)); extern tree mangle_conv_op_name_for_type PARAMS ((tree)); extern tree mangle_guard_variable PARAMS ((tree)); + extern tree mangle_ref_init_variable PARAMS ((tree)); /* in dump.c */ ! extern int cp_dump_tree PARAMS ((void *, tree)); /* -- end of C++ */ ! #endif /* ! GCC_CP_TREE_H */ diff -Nrc3pad gcc-3.0.4/gcc/cp/cvt.c gcc-3.1/gcc/cp/cvt.c *** gcc-3.0.4/gcc/cp/cvt.c Fri Aug 17 04:31:27 2001 --- gcc-3.1/gcc/cp/cvt.c Wed Apr 24 22:40:59 2002 *************** Boston, MA 02111-1307, USA. */ *** 37,43 **** 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)); static void warn_ref_binding PARAMS ((tree, tree, tree)); /* Change of width--truncation and extension of integers or reals-- --- 37,43 ---- static tree cp_convert_to_pointer PARAMS ((tree, tree, int)); static tree convert_to_pointer_force PARAMS ((tree, tree)); ! static tree build_up_reference PARAMS ((tree, tree, int, tree)); static void warn_ref_binding PARAMS ((tree, tree, tree)); /* Change of width--truncation and extension of integers or reals-- *************** cp_convert_to_pointer (type, expr, force *** 85,91 **** intype = complete_type (intype); if (!COMPLETE_TYPE_P (intype)) { ! cp_error ("can't convert from incomplete type `%T' to `%T'", intype, type); return error_mark_node; } --- 85,91 ---- intype = complete_type (intype); if (!COMPLETE_TYPE_P (intype)) { ! error ("can't convert from incomplete type `%T' to `%T'", intype, type); return error_mark_node; } *************** cp_convert_to_pointer (type, expr, force *** 94,100 **** if (rval) { if (rval == error_mark_node) ! cp_error ("conversion of `%E' from `%T' to `%T' is ambiguous", expr, intype, type); return rval; } --- 94,100 ---- if (rval) { if (rval == error_mark_node) ! error ("conversion of `%E' from `%T' to `%T' is ambiguous", expr, intype, type); return rval; } *************** cp_convert_to_pointer (type, expr, force *** 123,129 **** { if (TREE_CODE (TREE_TYPE (TREE_TYPE (expr))) == METHOD_TYPE) if (pedantic || warn_pmf2ptr) ! cp_pedwarn ("converting from `%T' to `%T'", TREE_TYPE (expr), type); return build1 (NOP_EXPR, type, expr); } --- 123,129 ---- { 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); } *************** cp_convert_to_pointer (type, expr, force *** 141,184 **** && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE && IS_AGGR_TYPE (TREE_TYPE (type)) && IS_AGGR_TYPE (TREE_TYPE (intype)) ! && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE ! /* If EXPR is NULL, then we don't need to do any arithmetic ! to convert it: ! ! [conv.ptr] ! ! The null pointer value is converted to the null pointer ! value of the destination type. */ ! && !integer_zerop (expr)) { enum tree_code code = PLUS_EXPR; ! tree binfo = get_binfo (TREE_TYPE (type), TREE_TYPE (intype), 1); ! if (binfo == error_mark_node) ! return error_mark_node; ! if (binfo == NULL_TREE) { ! binfo = get_binfo (TREE_TYPE (intype), TREE_TYPE (type), 1); ! if (binfo == error_mark_node) ! return error_mark_node; code = MINUS_EXPR; } if (binfo) { ! if (TYPE_USES_VIRTUAL_BASECLASSES (TREE_TYPE (type)) ! || TYPE_USES_VIRTUAL_BASECLASSES (TREE_TYPE (intype)) ! || ! BINFO_OFFSET_ZEROP (binfo)) { ! /* Need to get the path we took. */ ! tree path; ! ! if (code == PLUS_EXPR) ! get_base_distance (TREE_TYPE (type), TREE_TYPE (intype), ! 0, &path); ! else ! get_base_distance (TREE_TYPE (intype), TREE_TYPE (type), ! 0, &path); ! return build_vbase_path (code, type, expr, path, 0); } } } --- 141,175 ---- && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE && IS_AGGR_TYPE (TREE_TYPE (type)) && IS_AGGR_TYPE (TREE_TYPE (intype)) ! && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE) { enum tree_code code = PLUS_EXPR; ! tree binfo; ! ! /* Try derived to base conversion. */ ! binfo = lookup_base (TREE_TYPE (intype), TREE_TYPE (type), ! ba_check, NULL); ! if (!binfo) { ! /* Try base to derived conversion. */ ! binfo = lookup_base (TREE_TYPE (type), TREE_TYPE (intype), ! ba_check, NULL); code = MINUS_EXPR; } + if (binfo == error_mark_node) + return error_mark_node; if (binfo) { ! expr = build_base_path (code, expr, binfo, 0); ! /* Add any qualifier conversions. */ ! if (!same_type_p (TREE_TYPE (TREE_TYPE (expr)), ! TREE_TYPE (type))) { ! expr = build1 (NOP_EXPR, type, expr); ! TREE_CONSTANT (expr) = ! TREE_CONSTANT (TREE_OPERAND (expr, 0)); } + return expr; } } *************** cp_convert_to_pointer (type, expr, force *** 187,222 **** tree b1; tree b2; tree binfo; ! tree virt_binfo; ! enum tree_code code; b1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (type)); b2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (intype)); ! binfo = get_binfo (b2, b1, 1); ! ! if (binfo == NULL_TREE) { ! binfo = get_binfo (b1, b2, 1); code = MINUS_EXPR; } - else - code = PLUS_EXPR; - if (binfo == error_mark_node) return error_mark_node; ! virt_binfo = binfo_from_vbase (binfo); ! if (virt_binfo) { if (force) ! cp_warning ("pointer to member cast via virtual base `%T' of `%T'", ! BINFO_TYPE (virt_binfo), ! BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo))); else { ! cp_error ("pointer to member cast via virtual base `%T' of `%T'", ! BINFO_TYPE (virt_binfo), ! BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo))); return error_mark_node; } /* This is a reinterpret cast, whose result is unspecified. --- 178,206 ---- tree b1; tree b2; tree binfo; ! enum tree_code code = PLUS_EXPR; ! base_kind bk; 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; ! if (bk == bk_via_virtual) { if (force) ! warning ("pointer to member cast from `%T' to `%T' is via virtual base", ! TREE_TYPE (intype), TREE_TYPE (type)); else { ! error ("pointer to member cast from `%T' to `%T' is via virtual base", ! TREE_TYPE (intype), TREE_TYPE (type)); return error_mark_node; } /* This is a reinterpret cast, whose result is unspecified. *************** cp_convert_to_pointer (type, expr, force *** 233,239 **** } else if (TYPE_PTRMEMFUNC_P (type)) { ! cp_error ("cannot convert `%E' from type `%T' to type `%T'", expr, intype, type); return error_mark_node; } --- 217,223 ---- } else if (TYPE_PTRMEMFUNC_P (type)) { ! error ("cannot convert `%E' from type `%T' to type `%T'", expr, intype, type); return error_mark_node; } *************** cp_convert_to_pointer (type, expr, force *** 246,252 **** return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0); else if (TYPE_PTRMEMFUNC_P (intype)) { ! cp_error ("cannot convert `%E' from type `%T' to type `%T'", expr, intype, type); return error_mark_node; } --- 230,236 ---- return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0); else if (TYPE_PTRMEMFUNC_P (intype)) { ! error ("cannot convert `%E' from type `%T' to type `%T'", expr, intype, type); return error_mark_node; } *************** cp_convert_to_pointer (type, expr, force *** 259,266 **** return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0); if (TYPE_PTRMEM_P (type)) ! /* Under the new ABI, a NULL pointer-to-member is represented ! by -1, not by zero. */ expr = build_int_2 (-1, -1); else expr = build_int_2 (0, 0); --- 243,250 ---- return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0); if (TYPE_PTRMEM_P (type)) ! /* A NULL pointer-to-member is represented by -1, not by ! zero. */ expr = build_int_2 (-1, -1); else expr = build_int_2 (0, 0); *************** cp_convert_to_pointer (type, expr, force *** 283,291 **** } if (type_unknown_p (expr)) ! return instantiate_type (type, expr, itf_complain); ! cp_error ("cannot convert `%E' from type `%T' to type `%T'", expr, intype, type); return error_mark_node; } --- 267,275 ---- } if (type_unknown_p (expr)) ! return instantiate_type (type, expr, tf_error | tf_warning); ! error ("cannot convert `%E' from type `%T' to type `%T'", expr, intype, type); return error_mark_node; } *************** convert_to_pointer_force (type, expr) *** 319,352 **** && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE) { enum tree_code code = PLUS_EXPR; ! tree path; ! int distance = get_base_distance (TREE_TYPE (type), ! TREE_TYPE (intype), 0, &path); ! if (distance == -2) { ! cp_error ("type `%T' is ambiguous base of `%T'", ! TREE_TYPE (type), ! TREE_TYPE (intype)); ! return error_mark_node; } ! if (distance == -1) { ! distance = get_base_distance (TREE_TYPE (intype), ! TREE_TYPE (type), 0, &path); ! if (distance == -2) ! { ! cp_error ("type `%T' is ambiguous base of `%T'", ! TREE_TYPE (intype), ! TREE_TYPE (type)); ! return error_mark_node; ! } ! if (distance < 0) ! /* Doesn't need any special help from us. */ ! return build1 (NOP_EXPR, type, expr); ! ! code = MINUS_EXPR; } ! return build_vbase_path (code, type, expr, path, 0); } } --- 303,334 ---- && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE) { enum tree_code code = PLUS_EXPR; ! tree binfo; ! ! binfo = lookup_base (TREE_TYPE (intype), TREE_TYPE (type), ! ba_ignore, NULL); ! if (!binfo) { ! binfo = lookup_base (TREE_TYPE (type), TREE_TYPE (intype), ! ba_ignore, NULL); ! code = MINUS_EXPR; } ! if (binfo == error_mark_node) ! return error_mark_node; ! if (binfo) { ! expr = build_base_path (code, expr, binfo, 0); ! /* Add any qualifier conversions. */ ! if (!same_type_p (TREE_TYPE (TREE_TYPE (expr)), ! TREE_TYPE (type))) ! { ! expr = build1 (NOP_EXPR, type, expr); ! TREE_CONSTANT (expr) = ! TREE_CONSTANT (TREE_OPERAND (expr, 0)); ! } ! return expr; } ! } } *************** convert_to_pointer_force (type, expr) *** 358,368 **** value we have to begin with is in ARG. FLAGS controls how we manage access checking. ! DIRECT_BIND in FLAGS controls how any temporaries are generated. */ static tree ! build_up_reference (type, arg, flags) ! tree type, arg; int flags; { tree rval; --- 340,351 ---- value we have to begin with is in ARG. FLAGS controls how we manage access checking. ! DIRECT_BIND in FLAGS controls how any temporaries are generated. ! 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; { tree rval; *************** build_up_reference (type, arg, flags) *** 374,388 **** if ((flags & DIRECT_BIND) && ! real_lvalue_p (arg)) { ! /* Create a new temporary variable. */ tree targ = arg; ! if (toplevel_bindings_p ()) ! arg = get_temp_name (argtype); else { maybe_push_cleanup_level (argtype); ! arg = pushdecl (build_decl (VAR_DECL, NULL_TREE, argtype)); ! DECL_ARTIFICIAL (arg) = 1; } /* Process the initializer for the declaration. */ --- 357,384 ---- if ((flags & DIRECT_BIND) && ! real_lvalue_p (arg)) { ! /* Create a new temporary variable. We can't just use a TARGET_EXPR ! here because it needs to live as long as DECL. */ tree targ = arg; ! ! arg = build_decl (VAR_DECL, NULL_TREE, argtype); ! DECL_ARTIFICIAL (arg) = 1; ! TREE_USED (arg) = 1; ! TREE_STATIC (arg) = TREE_STATIC (decl); ! ! if (TREE_STATIC (decl)) ! { ! /* Namespace-scope or local static; give it a mangled name. */ ! tree name = mangle_ref_init_variable (decl); ! DECL_NAME (arg) = name; ! SET_DECL_ASSEMBLER_NAME (arg, name); ! arg = pushdecl_top_level (arg); ! } else { + /* Automatic; make sure we handle the cleanup properly. */ maybe_push_cleanup_level (argtype); ! arg = pushdecl (arg); } /* Process the initializer for the declaration. */ *************** build_up_reference (type, arg, flags) *** 393,399 **** else if (!(flags & DIRECT_BIND) && ! lvalue_p (arg)) return get_target_expr (arg); ! /* If we had a way to wrap this up, and say, if we ever needed it's address, transform all occurrences of the register, into a memory reference we could win better. */ rval = build_unary_op (ADDR_EXPR, arg, 1); --- 389,395 ---- else if (!(flags & DIRECT_BIND) && ! lvalue_p (arg)) return get_target_expr (arg); ! /* If we had a way to wrap this up, and say, if we ever needed its address, transform all occurrences of the register, into a memory reference we could win better. */ rval = build_unary_op (ADDR_EXPR, arg, 1); *************** build_up_reference (type, arg, flags) *** 405,417 **** && IS_AGGR_TYPE (argtype) && IS_AGGR_TYPE (target_type)) { ! /* We go through get_binfo for the access control. */ ! tree binfo = get_binfo (target_type, argtype, 1); if (binfo == error_mark_node) return error_mark_node; if (binfo == NULL_TREE) return error_not_base_type (target_type, argtype); ! rval = convert_pointer_to_real (binfo, rval); } else rval --- 401,413 ---- && IS_AGGR_TYPE (argtype) && IS_AGGR_TYPE (target_type)) { ! /* We go through lookup_base for the access control. */ ! tree binfo = lookup_base (argtype, target_type, ba_check, NULL); if (binfo == error_mark_node) return error_mark_node; if (binfo == NULL_TREE) return error_not_base_type (target_type, argtype); ! rval = build_base_path (PLUS_EXPR, rval, binfo, 1); } else rval *************** warn_ref_binding (reftype, intype, decl) *** 455,461 **** else msg = "conversion to non-const reference type `%#T' from rvalue of type `%T'"; ! cp_pedwarn (msg, reftype, intype); } } --- 451,457 ---- else msg = "conversion to non-const reference type `%#T' from rvalue of type `%T'"; ! pedwarn (msg, reftype, intype); } } *************** convert_to_reference (reftype, expr, con *** 482,496 **** { expr = instantiate_type (type, expr, (flags & LOOKUP_COMPLAIN) ! ? itf_complain : itf_none); if (expr == error_mark_node) return error_mark_node; intype = TREE_TYPE (expr); } ! if (TREE_CODE (intype) == REFERENCE_TYPE) ! my_friendly_abort (364); intype = TYPE_MAIN_VARIANT (intype); --- 478,491 ---- { 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); } ! my_friendly_assert (TREE_CODE (intype) != REFERENCE_TYPE, 364); intype = TYPE_MAIN_VARIANT (intype); *************** convert_to_reference (reftype, expr, con *** 527,537 **** if (! (convtype & CONV_CONST) && !at_least_as_qualified_p (ttl, ttr)) ! cp_pedwarn ("conversion from `%T' to `%T' discards qualifiers", ttr, reftype); } ! return build_up_reference (reftype, expr, flags); } else if ((convtype & CONV_REINTERPRET) && lvalue_p (expr)) { --- 522,532 ---- if (! (convtype & CONV_CONST) && !at_least_as_qualified_p (ttl, ttr)) ! pedwarn ("conversion from `%T' to `%T' discards qualifiers", ttr, reftype); } ! return build_up_reference (reftype, expr, flags, decl); } else if ((convtype & CONV_REINTERPRET) && lvalue_p (expr)) { *************** convert_to_reference (reftype, expr, con *** 545,551 **** if (TREE_CODE (intype) == POINTER_TYPE && (comptypes (TREE_TYPE (intype), type, COMPARE_BASE | COMPARE_RELAXED ))) ! cp_warning ("casting `%T' to `%T' does not dereference pointer", intype, reftype); rval = build_unary_op (ADDR_EXPR, expr, 0); --- 540,546 ---- if (TREE_CODE (intype) == POINTER_TYPE && (comptypes (TREE_TYPE (intype), type, COMPARE_BASE | COMPARE_RELAXED ))) ! warning ("casting `%T' to `%T' does not dereference pointer", intype, reftype); rval = build_unary_op (ADDR_EXPR, expr, 0); *************** convert_to_reference (reftype, expr, con *** 562,568 **** if (rval == NULL_TREE || rval == error_mark_node) return rval; warn_ref_binding (reftype, intype, decl); ! rval = build_up_reference (reftype, rval, flags); } if (rval) --- 557,563 ---- if (rval == NULL_TREE || rval == error_mark_node) return rval; warn_ref_binding (reftype, intype, decl); ! rval = build_up_reference (reftype, rval, flags, decl); } if (rval) *************** convert_to_reference (reftype, expr, con *** 574,580 **** my_friendly_assert (TREE_CODE (intype) != OFFSET_TYPE, 189); if (flags & LOOKUP_COMPLAIN) ! cp_error ("cannot convert type `%T' to type `%T'", intype, reftype); if (flags & LOOKUP_SPECULATIVELY) return NULL_TREE; --- 569,575 ---- my_friendly_assert (TREE_CODE (intype) != OFFSET_TYPE, 189); if (flags & LOOKUP_COMPLAIN) ! error ("cannot convert type `%T' to type `%T'", intype, reftype); if (flags & LOOKUP_SPECULATIVELY) return NULL_TREE; *************** convert_from_reference (val) *** 594,600 **** if (TREE_CODE (type) == OFFSET_TYPE) type = TREE_TYPE (type); if (TREE_CODE (type) == REFERENCE_TYPE) ! return build_indirect_ref (val, NULL_PTR); return val; } --- 589,595 ---- if (TREE_CODE (type) == OFFSET_TYPE) type = TREE_TYPE (type); if (TREE_CODE (type) == REFERENCE_TYPE) ! return build_indirect_ref (val, NULL); return val; } *************** convert_lvalue (totype, expr) *** 612,698 **** return convert_from_reference (expr); } - /* Call this when we know (for any reason) that expr is not, in fact, - zero. This routine is like convert_pointer_to, but it pays - attention to which specific instance of what type we want to - convert to. This routine should eventually become - convert_to_pointer after all references to convert_to_pointer - are removed. */ - - tree - convert_pointer_to_real (binfo, expr) - tree binfo, expr; - { - register tree intype = TREE_TYPE (expr); - tree ptr_type; - tree type, rval; - - if (intype == error_mark_node) - return error_mark_node; - - if (TREE_CODE (binfo) == TREE_VEC) - type = BINFO_TYPE (binfo); - else if (IS_AGGR_TYPE (binfo)) - { - type = binfo; - } - else - { - type = binfo; - binfo = NULL_TREE; - } - - ptr_type = cp_build_qualified_type (type, - CP_TYPE_QUALS (TREE_TYPE (intype))); - ptr_type = build_pointer_type (ptr_type); - if (same_type_p (ptr_type, TYPE_MAIN_VARIANT (intype))) - return expr; - - my_friendly_assert (!integer_zerop (expr), 191); - - intype = TYPE_MAIN_VARIANT (TREE_TYPE (intype)); - if (TREE_CODE (type) == RECORD_TYPE - && TREE_CODE (intype) == RECORD_TYPE - && type != intype) - { - tree path; - int distance - = get_base_distance (binfo, intype, 0, &path); - - /* This function shouldn't be called with unqualified arguments - but if it is, give them an error message that they can read. */ - if (distance < 0) - { - cp_error ("cannot convert a pointer of type `%T' to a pointer of type `%T'", - intype, type); - - if (distance == -2) - cp_error ("because `%T' is an ambiguous base class", type); - return error_mark_node; - } - - return build_vbase_path (PLUS_EXPR, ptr_type, expr, path, 1); - } - rval = build1 (NOP_EXPR, ptr_type, - TREE_CODE (expr) == NOP_EXPR ? TREE_OPERAND (expr, 0) : expr); - TREE_CONSTANT (rval) = TREE_CONSTANT (expr); - return rval; - } - - /* Call this when we know (for any reason) that expr is - not, in fact, zero. This routine gets a type out of the first - argument and uses it to search for the type to convert to. If there - is more than one instance of that type in the expr, the conversion is - ambiguous. This routine should eventually go away, and all - callers should use convert_to_pointer_real. */ - - tree - convert_pointer_to (binfo, expr) - tree binfo, expr; - { - return convert_pointer_to_real (binfo, expr); - } - /* C++ conversions, preference to static cast conversions. */ tree --- 607,612 ---- *************** ocp_convert (type, expr, convtype, flags *** 772,778 **** && ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC)) || (TREE_CODE (intype) == POINTER_TYPE))) { ! cp_pedwarn ("conversion from `%#T' to `%#T'", intype, type); if (flag_pedantic_errors) return error_mark_node; --- 686,692 ---- && ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC)) || (TREE_CODE (intype) == POINTER_TYPE))) { ! pedwarn ("conversion from `%#T' to `%#T'", intype, type); if (flag_pedantic_errors) return error_mark_node; *************** ocp_convert (type, expr, convtype, flags *** 784,790 **** if (rval) return rval; if (flags & LOOKUP_COMPLAIN) ! cp_error ("`%#T' used where a `%T' was expected", intype, type); if (flags & LOOKUP_SPECULATIVELY) return NULL_TREE; return error_mark_node; --- 698,704 ---- if (rval) return rval; if (flags & LOOKUP_COMPLAIN) ! error ("`%#T' used where a `%T' was expected", intype, type); if (flags & LOOKUP_SPECULATIVELY) return NULL_TREE; return error_mark_node; *************** ocp_convert (type, expr, convtype, flags *** 800,807 **** else if (TREE_CODE (expr) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL) fn = TREE_OPERAND (expr, 0); ! if (fn) ! cp_warning ("the address of `%D', will always be `true'", fn); return cp_truthvalue_conversion (e); } return fold (convert_to_integer (type, e)); --- 714,721 ---- else if (TREE_CODE (expr) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL) fn = TREE_OPERAND (expr, 0); ! if (fn && !DECL_WEAK (fn)) ! warning ("the address of `%D', will always be `true'", fn); return cp_truthvalue_conversion (e); } return fold (convert_to_integer (type, e)); *************** ocp_convert (type, expr, convtype, flags *** 821,827 **** return rval; else if (flags & LOOKUP_COMPLAIN) ! cp_error ("`%#T' used where a floating point value was expected", TREE_TYPE (e)); } if (code == REAL_TYPE) --- 735,741 ---- return rval; else if (flags & LOOKUP_COMPLAIN) ! error ("`%#T' used where a floating point value was expected", TREE_TYPE (e)); } if (code == REAL_TYPE) *************** ocp_convert (type, expr, convtype, flags *** 876,882 **** return e; if (flags & LOOKUP_COMPLAIN) ! cp_error ("conversion from `%T' to non-scalar type `%T' requested", TREE_TYPE (expr), type); if (flags & LOOKUP_SPECULATIVELY) return NULL_TREE; --- 790,796 ---- return e; if (flags & LOOKUP_COMPLAIN) ! error ("conversion from `%T' to non-scalar type `%T' requested", TREE_TYPE (expr), type); if (flags & LOOKUP_SPECULATIVELY) return NULL_TREE; *************** convert_to_void (expr, implicit) *** 922,931 **** tree new_op1 = convert_to_void (op1, implicit); tree new_op2 = convert_to_void (op2, implicit); ! if (new_op1 != op1 || new_op2 != op2) ! expr = build (COND_EXPR, ! implicit ? TREE_TYPE (expr) : void_type_node, ! TREE_OPERAND (expr, 0), new_op1, new_op2); break; } --- 836,843 ---- tree new_op1 = convert_to_void (op1, implicit); tree new_op2 = convert_to_void (op2, implicit); ! expr = build (COND_EXPR, TREE_TYPE (new_op1), ! TREE_OPERAND (expr, 0), new_op1, new_op2); break; } *************** convert_to_void (expr, implicit) *** 940,945 **** --- 852,858 ---- 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; } *************** convert_to_void (expr, implicit) *** 963,972 **** int is_complete = COMPLETE_TYPE_P (complete_type (type)); if (is_volatile && !is_complete) ! cp_warning ("object of incomplete type `%T' will not be accessed in %s", type, implicit ? implicit : "void context"); else if (is_reference && is_volatile) ! cp_warning ("object of type `%T' will not be accessed in %s", TREE_TYPE (TREE_OPERAND (expr, 0)), implicit ? implicit : "void context"); if (is_reference || !is_volatile || !is_complete) --- 876,885 ---- int is_complete = COMPLETE_TYPE_P (complete_type (type)); if (is_volatile && !is_complete) ! warning ("object of incomplete type `%T' will not be accessed in %s", type, implicit ? implicit : "void context"); else if (is_reference && is_volatile) ! warning ("object of type `%T' will not be accessed in %s", TREE_TYPE (TREE_OPERAND (expr, 0)), implicit ? implicit : "void context"); if (is_reference || !is_volatile || !is_complete) *************** convert_to_void (expr, implicit) *** 982,988 **** int is_complete = COMPLETE_TYPE_P (complete_type (type)); if (TYPE_VOLATILE (type) && !is_complete) ! cp_warning ("object `%E' of incomplete type `%T' will not be accessed in %s", expr, type, implicit ? implicit : "void context"); break; } --- 895,901 ---- int is_complete = COMPLETE_TYPE_P (complete_type (type)); if (TYPE_VOLATILE (type) && !is_complete) ! warning ("object `%E' of incomplete type `%T' will not be accessed in %s", expr, type, implicit ? implicit : "void context"); break; } *************** convert_to_void (expr, implicit) *** 1002,1013 **** { /* [over.over] enumerates the places where we can take the address of an overloaded function, and this is not one of them. */ ! cp_pedwarn ("%s cannot resolve address of overloaded function", implicit ? implicit : "void cast"); } else if (implicit && probe == expr && is_overloaded_fn (probe)) /* Only warn when there is no &. */ ! cp_warning ("%s is a reference, not call, to function `%E'", implicit, expr); } --- 915,926 ---- { /* [over.over] enumerates the places where we can take the address of an overloaded function, and this is not one of them. */ ! pedwarn ("%s cannot resolve address of overloaded function", implicit ? implicit : "void cast"); } else if (implicit && probe == expr && is_overloaded_fn (probe)) /* Only warn when there is no &. */ ! warning ("%s is a reference, not call, to function `%E'", implicit, expr); } *************** build_expr_type_conversion (desires, exp *** 1145,1151 **** if (expr == null_node && (desires & WANT_INT) && !(desires & WANT_NULL)) ! cp_warning ("converting NULL to non-pointer type"); if (TREE_CODE (expr) == OFFSET_REF) expr = resolve_offset_ref (expr); --- 1058,1064 ---- if (expr == null_node && (desires & WANT_INT) && !(desires & WANT_NULL)) ! warning ("converting NULL to non-pointer type"); if (TREE_CODE (expr) == OFFSET_REF) expr = resolve_offset_ref (expr); *************** build_expr_type_conversion (desires, exp *** 1221,1229 **** { if (complain) { ! cp_error ("ambiguous default type conversion from `%T'", basetype); ! cp_error (" candidate conversions include `%D' and `%D'", winner, cand); } return error_mark_node; --- 1134,1142 ---- { if (complain) { ! error ("ambiguous default type conversion from `%T'", basetype); ! error (" candidate conversions include `%D' and `%D'", winner, cand); } return error_mark_node; *************** type_promotes_to (type) *** 1255,1261 **** 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 --- 1168,1174 ---- 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 diff -Nrc3pad gcc-3.0.4/gcc/cp/decl.c gcc-3.1/gcc/cp/decl.c *** gcc-3.0.4/gcc/cp/decl.c Mon Feb 18 02:44:54 2002 --- gcc-3.1/gcc/cp/decl.c Fri May 3 18:55:23 2002 *************** *** 1,6 **** /* Process declarations and variables for C compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ! 2001 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. --- 1,6 ---- /* Process declarations and variables for C compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ! 2001, 2002 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. *************** Boston, MA 02111-1307, USA. */ *** 35,40 **** --- 35,41 ---- #include "expr.h" #include "flags.h" #include "cp-tree.h" + #include "tree-inline.h" #include "decl.h" #include "lex.h" #include "output.h" *************** Boston, MA 02111-1307, USA. */ *** 43,60 **** #include "../hash.h" #include "ggc.h" #include "tm_p.h" ! extern int current_class_depth; ! ! extern tree global_namespace; ! ! extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree)); ! ! #ifndef BOOL_TYPE_SIZE ! /* In the new ABI, `bool' has size and alignment `1', on all ! platforms. */ ! #define BOOL_TYPE_SIZE CHAR_TYPE_SIZE ! #endif static tree grokparms PARAMS ((tree)); static const char *redeclaration_error_message PARAMS ((tree, tree)); --- 44,55 ---- #include "../hash.h" #include "ggc.h" #include "tm_p.h" + #include "target.h" + #include "c-common.h" + #include "c-pragma.h" + #include "diagnostic.h" ! extern const struct attribute_spec *lang_attribute_table; static tree grokparms PARAMS ((tree)); static const char *redeclaration_error_message PARAMS ((tree, tree)); *************** static tree grokfndecl PARAMS ((tree, tr *** 82,92 **** --- 77,90 ---- enum overload_flags, tree, tree, int, int, int, int, int, int, tree)); static tree grokvardecl PARAMS ((tree, tree, RID_BIT_TYPE *, int, int, tree)); + static tree follow_tag_typedef PARAMS ((tree)); static tree lookup_tag PARAMS ((enum tree_code, tree, struct binding_level *, int)); static void set_identifier_type_value_with_scope PARAMS ((tree, tree, struct binding_level *)); static void record_unknown_type PARAMS ((tree, const char *)); + static tree builtin_function_1 PARAMS ((const char *, tree, tree, int, + enum built_in_class, const char *)); static tree build_library_fn_1 PARAMS ((tree, enum tree_code, tree)); static int member_function_or_else PARAMS ((tree, tree, enum overload_flags)); static void bad_specifiers PARAMS ((tree, const char *, int, int, int, int, *************** static void mark_lang_function PARAMS (( *** 135,148 **** static void save_function_data PARAMS ((tree)); static void check_function_type PARAMS ((tree, tree)); static void destroy_local_var PARAMS ((tree)); static void finish_constructor_body PARAMS ((void)); static void finish_destructor_body PARAMS ((void)); static tree create_array_type_for_decl PARAMS ((tree, tree, tree)); static tree get_atexit_node PARAMS ((void)); static tree get_dso_handle_node PARAMS ((void)); static tree start_cleanup_fn PARAMS ((void)); static void end_cleanup_fn PARAMS ((void)); ! static tree cp_make_fname_decl PARAMS ((tree, const char *, int)); static void initialize_predefined_identifiers PARAMS ((void)); static tree check_special_function_return_type PARAMS ((special_function_kind, tree, tree)); --- 133,148 ---- static void save_function_data PARAMS ((tree)); static void check_function_type PARAMS ((tree, tree)); static void destroy_local_var PARAMS ((tree)); + static void begin_constructor_body PARAMS ((void)); static void finish_constructor_body PARAMS ((void)); + static void begin_destructor_body PARAMS ((void)); static void finish_destructor_body PARAMS ((void)); static tree create_array_type_for_decl PARAMS ((tree, tree, tree)); static tree get_atexit_node PARAMS ((void)); static tree get_dso_handle_node PARAMS ((void)); static tree start_cleanup_fn PARAMS ((void)); static void end_cleanup_fn PARAMS ((void)); ! static tree cp_make_fname_decl PARAMS ((tree, int)); static void initialize_predefined_identifiers PARAMS ((void)); static tree check_special_function_return_type PARAMS ((special_function_kind, tree, tree)); *************** tree error_mark_list; *** 166,193 **** tree vtable_entry_type; tree delta_type_node; - #if 0 - Old rtti stuff. - tree __baselist_desc_type_node; - tree __i_desc_type_node, __m_desc_type_node; - tree __t_desc_array_type, __i_desc_array_type, __m_desc_array_type; - #endif tree __t_desc_type_node; - #if 0 - tree __tp_desc_type_node; - #endif tree ti_desc_type_node; tree bltn_desc_type_node, ptr_desc_type_node; tree ary_desc_type_node, func_desc_type_node, enum_desc_type_node; tree class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node; tree ptm_desc_type_node; tree base_desc_type_node; - #if 0 - Not needed yet? May be needed one day? - tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type; - tree __ptr_desc_array_type, __attr_dec_array_type, __func_desc_array_type; - tree __ptmf_desc_array_type, __ptmd_desc_array_type; - #endif tree class_type_node, record_type_node, union_type_node, enum_type_node; tree unknown_type_node; --- 166,178 ---- *************** tree cp_global_trees[CPTI_MAX]; *** 225,235 **** static tree global_type_node; - /* If non-zero, this is the number of times we have entered the `std' - namespace when we are treating that namespace as an alias for the - global namespace. */ - static int in_fake_std; - /* Expect only namespace names now. */ static int only_namespace_names; --- 210,215 ---- *************** tree static_aggregates; *** 262,275 **** tree integer_two_node, integer_three_node; - /* Parsing a function declarator leaves here a chain of structure - and enum types declared in the parmlist. */ - - static tree last_function_parm_tags; - /* Similar, for last_function_parm_tags. */ tree last_function_parms; - static tree current_function_parm_tags; /* A list of all LABEL_DECLs in the function that have names. Here so we can clear out their names' definitions at the end of the --- 242,249 ---- *************** struct named_label_list *** 289,301 **** #define named_labels cp_function_chain->x_named_labels - /* Set to 0 at beginning of a function definition, and whenever - a label (case or named) is defined. Set to value of expression - returned from function when that value can be transformed into - a named return value. */ - - tree current_function_return_value; - /* Nonzero means use the ISO C94 dialect of C. */ int flag_isoc94; --- 263,268 ---- *************** extern int flag_conserve_space; *** 321,330 **** /* C and C++ flags are in decl2.c. */ - /* Flag used when debugging spew.c */ - - extern int spew_debug; - /* A expression of value 0 with the same precision as a sizetype node, but signed. */ tree signed_size_zero_node; --- 288,293 ---- *************** tree anonymous_namespace_name; *** 337,342 **** --- 300,322 ---- (Zero if we are at namespace scope, one inside the body of a function, two inside the body of a function in a local class, etc.) */ int function_depth; + + /* States indicating how grokdeclarator() should handle declspecs marked + with __attribute__((deprecated)). An object declared as + __attribute__((deprecated)) suppresses warnings of uses of other + deprecated items. */ + + enum deprecated_states { + DEPRECATED_NORMAL, + DEPRECATED_SUPPRESS + }; + + static enum deprecated_states deprecated_state = DEPRECATED_NORMAL; + + /* Set by add_implicitly_declared_members() to keep those members from + being flagged as deprecated or reported as using deprecated + types. */ + int adding_implicit_members = 0; /* For each binding contour we allocate a binding_level structure which records the names defined in that contour. *************** struct binding_level *** 414,423 **** /* The binding level which this one is contained in (inherits from). */ struct binding_level *level_chain; - /* List of decls in `names' that have incomplete - structure or union types. */ - tree incomplete; - /* 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 --- 394,399 ---- *************** static struct binding_level *global_bind *** 500,505 **** --- 476,487 ---- static int keep_next_level_flag; + /* A TREE_LIST of VAR_DECLs. The TREE_PURPOSE is a RECORD_TYPE or + UNION_TYPE; the TREE_VALUE is a VAR_DECL with that type. At the + time the VAR_DECL was declared, the type was incomplete. */ + + static tree incomplete_vars; + #if defined(DEBUG_CP_BINDING_LEVELS) static int binding_depth = 0; static int is_class_level = 0; *************** pop_binding_level () *** 563,569 **** { /* Cannot pop a level, if there are none left to pop. */ if (current_binding_level == global_binding_level) ! my_friendly_abort (123); } /* Pop the current level, and free the structure for reuse. */ #if defined(DEBUG_CP_BINDING_LEVELS) --- 545,551 ---- { /* Cannot pop a level, if there are none left to pop. */ if (current_binding_level == global_binding_level) ! abort (); } /* Pop the current level, and free the structure for reuse. */ #if defined(DEBUG_CP_BINDING_LEVELS) *************** suspend_binding_level () *** 602,608 **** { /* Cannot suspend a level, if there are none left to suspend. */ if (current_binding_level == global_binding_level) ! my_friendly_abort (123); } /* Suspend the current level. */ #if defined(DEBUG_CP_BINDING_LEVELS) --- 584,590 ---- { /* Cannot suspend a level, if there are none left to suspend. */ if (current_binding_level == global_binding_level) ! abort (); } /* Suspend the current level. */ #if defined(DEBUG_CP_BINDING_LEVELS) *************** pushlevel (tag_transparent) *** 861,867 **** newlevel = make_binding_level (); push_binding_level (newlevel, tag_transparent, keep_next_level_flag); - GNU_xref_start_scope ((HOST_WIDE_INT) newlevel); keep_next_level_flag = 0; } --- 843,848 ---- *************** begin_scope (sk) *** 903,909 **** break; default: ! my_friendly_abort (20000309); } } --- 884,890 ---- break; default: ! abort (); } } *************** note_level_for_catch () *** 940,946 **** /* For a binding between a name and an entity at a block scope, this is the `struct binding_level' for the block. */ #define BINDING_LEVEL(NODE) \ ! (((struct tree_binding*)NODE)->scope.level) /* A free list of CPLUS_BINDING nodes, connected by their TREE_CHAINs. */ --- 921,927 ---- /* For a binding between a name and an entity at a block scope, this is the `struct binding_level' for the block. */ #define BINDING_LEVEL(NODE) \ ! (((struct tree_binding*)(NODE))->scope.level) /* A free list of CPLUS_BINDING nodes, connected by their TREE_CHAINs. */ *************** add_binding (id, decl) *** 1016,1023 **** else if (TREE_CODE (BINDING_VALUE (binding)) == TYPE_DECL && TREE_CODE (decl) == TYPE_DECL && DECL_NAME (decl) == DECL_NAME (BINDING_VALUE (binding)) ! && same_type_p (TREE_TYPE (decl), ! TREE_TYPE (BINDING_VALUE (binding)))) /* We have two typedef-names, both naming the same type to have the same name. This is OK because of: --- 997,1008 ---- else if (TREE_CODE (BINDING_VALUE (binding)) == TYPE_DECL && TREE_CODE (decl) == TYPE_DECL && DECL_NAME (decl) == DECL_NAME (BINDING_VALUE (binding)) ! && (same_type_p (TREE_TYPE (decl), ! TREE_TYPE (BINDING_VALUE (binding))) ! /* If either type involves template parameters, we must ! wait until instantiation. */ ! || uses_template_parms (TREE_TYPE (decl)) ! || uses_template_parms (TREE_TYPE (BINDING_VALUE (binding))))) /* We have two typedef-names, both naming the same type to have the same name. This is OK because of: *************** add_binding (id, decl) *** 1039,1045 **** } else { ! cp_error ("declaration of `%#D'", decl); cp_error_at ("conflicts with previous declaration `%#D'", BINDING_VALUE (binding)); ok = 0; --- 1024,1030 ---- } else { ! error ("declaration of `%#D'", decl); cp_error_at ("conflicts with previous declaration `%#D'", BINDING_VALUE (binding)); ok = 0; *************** pop_binding (id, decl) *** 1199,1205 **** else if (BINDING_TYPE (binding) == decl) BINDING_TYPE (binding) = NULL_TREE; else ! my_friendly_abort (0); if (!BINDING_VALUE (binding) && !BINDING_TYPE (binding)) { --- 1184,1190 ---- else if (BINDING_TYPE (binding) == decl) BINDING_TYPE (binding) = NULL_TREE; else ! abort (); if (!BINDING_VALUE (binding) && !BINDING_TYPE (binding)) { *************** poplevel (keep, reverse, functionbody) *** 1316,1326 **** rather than the end. This hack is no longer used. */ my_friendly_assert (keep == 0 || keep == 1, 0); - GNU_xref_end_scope ((HOST_WIDE_INT) current_binding_level, - (HOST_WIDE_INT) current_binding_level->level_chain, - current_binding_level->parm_flag, - current_binding_level->keep); - if (current_binding_level->keep == 1) keep = 1; --- 1301,1306 ---- *************** poplevel (keep, reverse, functionbody) *** 1503,1509 **** else if (TREE_CODE (decl) == OVERLOAD) pop_binding (DECL_NAME (OVL_FUNCTION (decl)), decl); else ! my_friendly_abort (0); } } --- 1483,1489 ---- else if (TREE_CODE (decl) == OVERLOAD) pop_binding (DECL_NAME (OVL_FUNCTION (decl)), decl); else ! abort (); } } *************** poplevel_class () *** 1742,1752 **** shadowed = TREE_CHAIN (shadowed)) pop_binding (TREE_PURPOSE (shadowed), TREE_TYPE (shadowed)); - GNU_xref_end_scope ((HOST_WIDE_INT) class_binding_level, - (HOST_WIDE_INT) class_binding_level->level_chain, - class_binding_level->parm_flag, - class_binding_level->keep); - /* Now, pop out of the binding level which we created up in the `pushlevel_class' routine. */ #if defined(DEBUG_CP_BINDING_LEVELS) --- 1722,1727 ---- *************** walk_namespaces_r (namespace, f, data) *** 1826,1837 **** if (TREE_CODE (current) != NAMESPACE_DECL || DECL_NAMESPACE_ALIAS (current)) continue; - if (!DECL_LANG_SPECIFIC (current)) - { - /* Hmm. std. */ - my_friendly_assert (current == fake_std_node, 393); - continue; - } /* We found a namespace. */ result |= walk_namespaces_r (current, f, data); --- 1801,1806 ---- *************** mark_binding_level (arg) *** 1986,1992 **** ggc_mark_tree (lvl->shadowed_labels); ggc_mark_tree (lvl->blocks); ggc_mark_tree (lvl->this_class); - ggc_mark_tree (lvl->incomplete); ggc_mark_tree (lvl->dead_vars_from_for); } } --- 1955,1960 ---- *************** print_binding_level (lvl) *** 2024,2031 **** int i = 0, len; fprintf (stderr, " blocks="); fprintf (stderr, HOST_PTR_PRINTF, lvl->blocks); - fprintf (stderr, " n_incomplete=%d parm_flag=%d keep=%d", - list_length (lvl->incomplete), lvl->parm_flag, lvl->keep); if (lvl->tag_transparent) fprintf (stderr, " tag-transparent"); if (lvl->more_cleanups_ok) --- 1992,1997 ---- *************** push_namespace (name) *** 2311,2323 **** need_new = 0; implicit_use = 1; } - else if (current_namespace == global_namespace - && !flag_honor_std - && name == std_identifier) - { - in_fake_std++; - return; - } else { /* Check whether this is an extended namespace definition. */ --- 2277,2282 ---- *************** push_namespace (name) *** 2327,2333 **** need_new = 0; if (DECL_NAMESPACE_ALIAS (d)) { ! cp_error ("namespace alias `%D' not allowed here, assuming `%D'", d, DECL_NAMESPACE_ALIAS (d)); d = DECL_NAMESPACE_ALIAS (d); } --- 2286,2292 ---- 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); } *************** push_namespace (name) *** 2363,2374 **** void pop_namespace () { ! if (current_namespace == global_namespace) ! { ! my_friendly_assert (in_fake_std > 0, 980421); ! in_fake_std--; ! return; ! } current_namespace = CP_DECL_CONTEXT (current_namespace); /* The binding level is not popped, as it might be re-opened later. */ suspend_binding_level (); --- 2322,2328 ---- void pop_namespace () { ! my_friendly_assert (current_namespace != global_namespace, 20010801); current_namespace = CP_DECL_CONTEXT (current_namespace); /* The binding level is not popped, as it might be re-opened later. */ suspend_binding_level (); *************** mark_saved_scope (arg) *** 2426,2431 **** --- 2380,2386 ---- mark_binding_level (&t->class_bindings); ggc_mark_tree (t->old_bindings); ggc_mark_tree (t->old_namespace); + ggc_mark_tree (t->decl_ns_list); ggc_mark_tree (t->class_name); ggc_mark_tree (t->class_type); ggc_mark_tree (t->access_specifier); *************** mark_saved_scope (arg) *** 2437,2443 **** ggc_mark_tree (t->x_previous_class_type); ggc_mark_tree (t->x_previous_class_values); ggc_mark_tree (t->x_saved_tree); - ggc_mark_tree (t->incomplete); ggc_mark_tree (t->lookups); mark_stmt_tree (&t->x_stmt_tree); --- 2392,2397 ---- *************** maybe_push_to_top_level (pseudo) *** 2543,2553 **** 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_stack = &VARRAY_TREE (current_lang_base, 0); current_lang_name = lang_name_cplusplus; current_namespace = global_namespace; } --- 2497,2507 ---- s->bindings = b; s->need_pop_function_context = need_pop; s->function_decl = current_function_decl; + s->last_parms = last_function_parms; 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; } *************** pop_from_top_level () *** 2585,2590 **** --- 2539,2545 ---- if (s->need_pop_function_context) pop_function_context_from (NULL_TREE); current_function_decl = s->function_decl; + last_function_parms = s->last_parms; free (s); } *************** static void *** 3083,3091 **** warn_extern_redeclared_static (newdecl, olddecl) tree newdecl, olddecl; { ! static const char *explicit_extern_static_warning = "`%D' was declared `extern' and later `static'"; ! static const char *implicit_extern_static_warning = "`%D' was declared implicitly `extern' and later `static'"; tree name; --- 3038,3046 ---- warn_extern_redeclared_static (newdecl, olddecl) tree newdecl, olddecl; { ! static const char *const explicit_extern_static_warning = "`%D' was declared `extern' and later `static'"; ! static const char *const implicit_extern_static_warning = "`%D' was declared implicitly `extern' and later `static'"; tree name; *************** warn_extern_redeclared_static (newdecl, *** 3112,3118 **** return; name = DECL_ASSEMBLER_NAME (newdecl); ! cp_pedwarn (IDENTIFIER_IMPLICIT_DECL (name) ? implicit_extern_static_warning : explicit_extern_static_warning, newdecl); cp_pedwarn_at ("previous declaration of `%D'", olddecl); --- 3067,3073 ---- return; name = DECL_ASSEMBLER_NAME (newdecl); ! pedwarn (IDENTIFIER_IMPLICIT_DECL (name) ? implicit_extern_static_warning : explicit_extern_static_warning, newdecl); cp_pedwarn_at ("previous declaration of `%D'", olddecl); *************** duplicate_decls (newdecl, olddecl) *** 3147,3165 **** || TREE_TYPE (olddecl) == error_mark_node) types_match = 1; /* Check for redeclaration and other discrepancies. */ if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_ARTIFICIAL (olddecl)) { if (TREE_CODE (newdecl) != FUNCTION_DECL) { /* If you declare a built-in or predefined function name as static, the old definition is overridden, but optionally warn this was a bad choice of name. */ if (! TREE_PUBLIC (newdecl)) { if (warn_shadow) ! cp_warning ("shadowing %s function `%#D'", DECL_BUILT_IN (olddecl) ? "built-in" : "library", olddecl); /* Discard the old built-in function. */ --- 3102,3157 ---- || TREE_TYPE (olddecl) == error_mark_node) types_match = 1; + if (DECL_P (olddecl) + && TREE_CODE (newdecl) == FUNCTION_DECL + && TREE_CODE (olddecl) == FUNCTION_DECL + && (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl))) + { + if (DECL_DECLARED_INLINE_P (newdecl) + && DECL_UNINLINABLE (newdecl) + && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl))) + /* Already warned elsewhere. */; + else if (DECL_DECLARED_INLINE_P (olddecl) + && DECL_UNINLINABLE (olddecl) + && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl))) + /* Already warned. */; + else if (DECL_DECLARED_INLINE_P (newdecl) + && DECL_UNINLINABLE (olddecl) + && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl))) + { + warning_with_decl (newdecl, + "function `%s' redeclared as inline"); + warning_with_decl (olddecl, + "previous declaration of function `%s' with attribute noinline"); + } + else if (DECL_DECLARED_INLINE_P (olddecl) + && DECL_UNINLINABLE (newdecl) + && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl))) + { + warning_with_decl (newdecl, + "function `%s' redeclared with attribute noinline"); + warning_with_decl (olddecl, + "previous declaration of function `%s' was inline"); + } + } + /* Check for redeclaration and other discrepancies. */ if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_ARTIFICIAL (olddecl)) { if (TREE_CODE (newdecl) != FUNCTION_DECL) { + /* Avoid warnings redeclaring anticipated built-ins. */ + if (DECL_ANTICIPATED (olddecl)) + return 0; + /* If you declare a built-in or predefined function name as static, the old definition is overridden, but optionally warn this was a bad choice of name. */ if (! TREE_PUBLIC (newdecl)) { if (warn_shadow) ! warning ("shadowing %s function `%#D'", DECL_BUILT_IN (olddecl) ? "built-in" : "library", olddecl); /* Discard the old built-in function. */ *************** duplicate_decls (newdecl, olddecl) *** 3168,3186 **** /* If the built-in is not ansi, then programs can override it even globally without an error. */ else if (! DECL_BUILT_IN (olddecl)) ! cp_warning ("library function `%#D' redeclared as non-function `%#D'", olddecl, newdecl); else { ! cp_error ("declaration of `%#D'", newdecl); ! cp_error ("conflicts with built-in declaration `%#D'", olddecl); } return 0; } else if (!types_match) { ! if ((DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) --- 3160,3181 ---- /* If the built-in is not ansi, then programs can override it even globally without an error. */ else if (! DECL_BUILT_IN (olddecl)) ! warning ("library function `%#D' redeclared as non-function `%#D'", olddecl, newdecl); else { ! error ("declaration of `%#D'", newdecl); ! error ("conflicts with built-in declaration `%#D'", olddecl); } return 0; } else if (!types_match) { ! /* Avoid warnings redeclaring anticipated built-ins. */ ! if (DECL_ANTICIPATED (olddecl)) ! ; /* Do nothing yet. */ ! else if ((DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) *************** duplicate_decls (newdecl, olddecl) *** 3189,3206 **** if (TREE_PUBLIC (newdecl)) { ! cp_warning ("new declaration `%#D'", newdecl); ! cp_warning ("ambiguates built-in declaration `%#D'", olddecl); } else if (warn_shadow) ! cp_warning ("shadowing %s function `%#D'", DECL_BUILT_IN (olddecl) ? "built-in" : "library", olddecl); } else /* Discard the old built-in function. */ return 0; } if (DECL_THIS_STATIC (newdecl) && !DECL_THIS_STATIC (olddecl)) --- 3184,3204 ---- if (TREE_PUBLIC (newdecl)) { ! warning ("new declaration `%#D'", newdecl); ! warning ("ambiguates built-in declaration `%#D'", olddecl); } else if (warn_shadow) ! warning ("shadowing %s function `%#D'", DECL_BUILT_IN (olddecl) ? "built-in" : "library", olddecl); } else /* Discard the old built-in function. */ return 0; + + /* Replace the old RTL to avoid problems with inlining. */ + SET_DECL_RTL (olddecl, DECL_RTL (newdecl)); } if (DECL_THIS_STATIC (newdecl) && !DECL_THIS_STATIC (olddecl)) *************** duplicate_decls (newdecl, olddecl) *** 3215,3223 **** will be banished. */ SET_DECL_LANGUAGE (olddecl, DECL_LANGUAGE (newdecl)); SET_DECL_RTL (olddecl, DECL_RTL (newdecl)); - COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl); - SET_IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (newdecl), - newdecl); } } else if (TREE_CODE (olddecl) != TREE_CODE (newdecl)) --- 3213,3218 ---- *************** duplicate_decls (newdecl, olddecl) *** 3246,3252 **** && DECL_FUNCTION_TEMPLATE_P (newdecl))) return 0; ! cp_error ("`%#D' redeclared as different kind of symbol", newdecl); if (TREE_CODE (olddecl) == TREE_LIST) olddecl = TREE_VALUE (olddecl); cp_error_at ("previous declaration of `%#D'", olddecl); --- 3241,3247 ---- && DECL_FUNCTION_TEMPLATE_P (newdecl))) return 0; ! error ("`%#D' redeclared as different kind of symbol", newdecl); if (TREE_CODE (olddecl) == TREE_LIST) olddecl = TREE_VALUE (olddecl); cp_error_at ("previous declaration of `%#D'", olddecl); *************** duplicate_decls (newdecl, olddecl) *** 3271,3277 **** if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL || TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL) { ! cp_error ("declaration of template `%#D'", newdecl); cp_error_at ("conflicts with previous declaration `%#D'", olddecl); } --- 3266,3272 ---- if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL || TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL) { ! error ("declaration of template `%#D'", newdecl); cp_error_at ("conflicts with previous declaration `%#D'", olddecl); } *************** duplicate_decls (newdecl, olddecl) *** 3282,3288 **** && comp_template_parms (DECL_TEMPLATE_PARMS (newdecl), DECL_TEMPLATE_PARMS (olddecl))) { ! cp_error ("new declaration `%#D'", newdecl); cp_error_at ("ambiguates old declaration `%#D'", olddecl); } return 0; --- 3277,3283 ---- && comp_template_parms (DECL_TEMPLATE_PARMS (newdecl), DECL_TEMPLATE_PARMS (olddecl))) { ! error ("new declaration `%#D'", newdecl); cp_error_at ("ambiguates old declaration `%#D'", olddecl); } return 0; *************** duplicate_decls (newdecl, olddecl) *** 3291,3304 **** { if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) { ! cp_error ("declaration of C function `%#D' conflicts with", newdecl); cp_error_at ("previous declaration `%#D' here", olddecl); } else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) { ! cp_error ("new declaration `%#D'", newdecl); cp_error_at ("ambiguates old declaration `%#D'", olddecl); } else --- 3286,3299 ---- { if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) { ! error ("declaration of C function `%#D' conflicts with", newdecl); cp_error_at ("previous declaration `%#D' here", olddecl); } else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) { ! error ("new declaration `%#D'", newdecl); cp_error_at ("ambiguates old declaration `%#D'", olddecl); } else *************** duplicate_decls (newdecl, olddecl) *** 3309,3315 **** else if (current_class_type == NULL_TREE || IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (newdecl)) != current_class_type) { ! cp_error ("conflicting types for `%#D'", newdecl); cp_error_at ("previous declaration as `%#D'", olddecl); } } --- 3304,3310 ---- else if (current_class_type == NULL_TREE || IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (newdecl)) != current_class_type) { ! error ("conflicting types for `%#D'", newdecl); cp_error_at ("previous declaration as `%#D'", olddecl); } } *************** duplicate_decls (newdecl, olddecl) *** 3349,3360 **** const char *errmsg = redeclaration_error_message (newdecl, olddecl); if (errmsg) { ! cp_error (errmsg, newdecl); if (DECL_NAME (olddecl) != NULL_TREE) cp_error_at ((DECL_INITIAL (olddecl) && namespace_bindings_p ()) ? "`%#D' previously defined here" : "`%#D' previously declared here", olddecl); } else if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_INITIAL (olddecl) != NULL_TREE --- 3344,3356 ---- const char *errmsg = redeclaration_error_message (newdecl, olddecl); if (errmsg) { ! error (errmsg, newdecl); if (DECL_NAME (olddecl) != NULL_TREE) cp_error_at ((DECL_INITIAL (olddecl) && namespace_bindings_p ()) ? "`%#D' previously defined here" : "`%#D' previously declared here", olddecl); + return 0; } else if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_INITIAL (olddecl) != NULL_TREE *************** duplicate_decls (newdecl, olddecl) *** 3371,3384 **** /* extern "C" int foo (); int foo () { bar (); } is OK. */ ! if (current_lang_stack ! == &VARRAY_TREE (current_lang_base, 0)) SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl)); else { cp_error_at ("previous declaration of `%#D' with %L linkage", olddecl, DECL_LANGUAGE (olddecl)); ! cp_error ("conflicts with new declaration with %L linkage", DECL_LANGUAGE (newdecl)); } } --- 3367,3379 ---- /* extern "C" int foo (); int foo () { bar (); } is OK. */ ! if (current_lang_depth () == 0) SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl)); else { cp_error_at ("previous declaration of `%#D' with %L linkage", olddecl, DECL_LANGUAGE (olddecl)); ! error ("conflicts with new declaration with %L linkage", DECL_LANGUAGE (newdecl)); } } *************** duplicate_decls (newdecl, olddecl) *** 3401,3417 **** if (1 == simple_cst_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2))) { ! if (pedantic) ! { ! cp_pedwarn ("default argument given for parameter %d of `%#D'", ! i, newdecl); ! cp_pedwarn_at ("after previous specification in `%#D'", ! olddecl); ! } } else { ! cp_error ("default argument given for parameter %d of `%#D'", i, newdecl); cp_error_at ("after previous specification in `%#D'", olddecl); --- 3396,3409 ---- if (1 == simple_cst_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2))) { ! pedwarn ("default argument given for parameter %d of `%#D'", ! i, newdecl); ! cp_pedwarn_at ("after previous specification in `%#D'", ! olddecl); } else { ! error ("default argument given for parameter %d of `%#D'", i, newdecl); cp_error_at ("after previous specification in `%#D'", olddecl); *************** duplicate_decls (newdecl, olddecl) *** 3422,3428 **** && ! DECL_DECLARED_INLINE_P (olddecl) && TREE_ADDRESSABLE (olddecl) && warn_inline) { ! cp_warning ("`%#D' was used before it was declared inline", newdecl); cp_warning_at ("previous non-inline declaration here", olddecl); --- 3414,3420 ---- && ! DECL_DECLARED_INLINE_P (olddecl) && TREE_ADDRESSABLE (olddecl) && warn_inline) { ! warning ("`%#D' was used before it was declared inline", newdecl); cp_warning_at ("previous non-inline declaration here", olddecl); *************** duplicate_decls (newdecl, olddecl) *** 3430,3435 **** --- 3422,3439 ---- } } + /* Do not merge an implicit typedef with an explicit one. In: + + class A; + ... + typedef class A A __attribute__ ((foo)); + + the attribute should apply only to the typedef. */ + if (TREE_CODE (olddecl) == TYPE_DECL + && (DECL_IMPLICIT_TYPEDEF_P (olddecl) + || DECL_IMPLICIT_TYPEDEF_P (newdecl))) + return 0; + /* If new decl is `static' and an `extern' was seen previously, warn about it. */ warn_extern_redeclared_static (newdecl, olddecl); *************** duplicate_decls (newdecl, olddecl) *** 3468,3476 **** /* Don't warn about extern decl followed by definition. */ && !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl)) /* Don't warn about friends, let add_friend take care of it. */ ! && ! DECL_FRIEND_P (newdecl)) { ! cp_warning ("redundant redeclaration of `%D' in same scope", newdecl); cp_warning_at ("previous declaration of `%D'", olddecl); } } --- 3472,3480 ---- /* Don't warn about extern decl followed by definition. */ && !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl)) /* Don't warn about friends, let add_friend take care of it. */ ! && ! (DECL_FRIEND_P (newdecl) || DECL_FRIEND_P (olddecl))) { ! warning ("redundant redeclaration of `%D' in same scope", newdecl); cp_warning_at ("previous declaration of `%D'", olddecl); } } *************** duplicate_decls (newdecl, olddecl) *** 3494,3501 **** /* Copy all the DECL_... slots specified in the new decl except for any that we copy here from the old type. */ ! DECL_MACHINE_ATTRIBUTES (newdecl) ! = merge_machine_decl_attributes (olddecl, newdecl); if (TREE_CODE (newdecl) == TEMPLATE_DECL) { --- 3498,3506 ---- /* Copy all the DECL_... slots specified in the new decl except for any that we copy here from the old type. */ ! DECL_ATTRIBUTES (newdecl) ! = (*targetm.merge_decl_attributes) (olddecl, newdecl); ! decl_attributes (&newdecl, DECL_ATTRIBUTES (newdecl), 0); if (TREE_CODE (newdecl) == TEMPLATE_DECL) { *************** duplicate_decls (newdecl, olddecl) *** 3527,3542 **** tree newtype; /* Merge the data types specified in the two decls. */ ! newtype = common_type (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); ! /* If common_type produces a non-typedef type, just use the old type. */ if (TREE_CODE (newdecl) == TYPE_DECL && newtype == DECL_ORIGINAL_TYPE (newdecl)) newtype = oldtype; if (TREE_CODE (newdecl) == VAR_DECL) DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl); ! /* Do this after calling `common_type' so that default parameters don't confuse us. */ else if (TREE_CODE (newdecl) == FUNCTION_DECL && (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)) --- 3532,3547 ---- tree newtype; /* Merge the data types specified in the two decls. */ ! newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); ! /* If merge_types produces a non-typedef type, just use the old type. */ if (TREE_CODE (newdecl) == TYPE_DECL && newtype == DECL_ORIGINAL_TYPE (newdecl)) newtype = oldtype; if (TREE_CODE (newdecl) == VAR_DECL) DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl); ! /* Do this after calling `merge_types' so that default parameters don't confuse us. */ else if (TREE_CODE (newdecl) == FUNCTION_DECL && (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)) *************** duplicate_decls (newdecl, olddecl) *** 3553,3559 **** && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)), TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1)) { ! cp_error ("declaration of `%F' throws different exceptions", newdecl); cp_error_at ("than previous declaration `%F'", olddecl); } --- 3558,3564 ---- && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)), TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1)) { ! error ("declaration of `%F' throws different exceptions", newdecl); cp_error_at ("than previous declaration `%F'", olddecl); } *************** duplicate_decls (newdecl, olddecl) *** 3600,3616 **** if (DECL_SECTION_NAME (newdecl) == NULL_TREE) DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl); - /* Keep the old rtl since we can safely use it. */ - COPY_DECL_RTL (olddecl, newdecl); - if (TREE_CODE (newdecl) == FUNCTION_DECL) { DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl) |= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl); - DECL_NO_CHECK_MEMORY_USAGE (newdecl) - |= DECL_NO_CHECK_MEMORY_USAGE (olddecl); DECL_NO_LIMIT_STACK (newdecl) |= DECL_NO_LIMIT_STACK (olddecl); } } /* If cannot merge, then use the new type and qualifiers, --- 3605,3627 ---- if (DECL_SECTION_NAME (newdecl) == NULL_TREE) DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl); if (TREE_CODE (newdecl) == FUNCTION_DECL) { DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl) |= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl); DECL_NO_LIMIT_STACK (newdecl) |= DECL_NO_LIMIT_STACK (olddecl); + /* Keep the old RTL. */ + COPY_DECL_RTL (olddecl, newdecl); + } + else if (TREE_CODE (newdecl) == VAR_DECL + && (DECL_SIZE (olddecl) || !DECL_SIZE (newdecl))) + { + /* Keep the old RTL. We cannot keep the old RTL if the old + declaration was for an incomplete object and the new + declaration is not since many attributes of the RTL will + change. */ + COPY_DECL_RTL (olddecl, newdecl); } } /* If cannot merge, then use the new type and qualifiers, *************** duplicate_decls (newdecl, olddecl) *** 3629,3635 **** } /* Merge the storage class information. */ ! DECL_WEAK (newdecl) |= DECL_WEAK (olddecl); DECL_ONE_ONLY (newdecl) |= DECL_ONE_ONLY (olddecl); DECL_DEFER_OUTPUT (newdecl) |= DECL_DEFER_OUTPUT (olddecl); TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl); --- 3640,3647 ---- } /* Merge the storage class information. */ ! merge_weak (newdecl, olddecl); ! DECL_ONE_ONLY (newdecl) |= DECL_ONE_ONLY (olddecl); DECL_DEFER_OUTPUT (newdecl) |= DECL_DEFER_OUTPUT (olddecl); TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl); *************** duplicate_decls (newdecl, olddecl) *** 3682,3688 **** that specialization that would cause an implicit instantiation to take place, in every translation unit in which such a use occurs. */ ! cp_error ("explicit specialization of %D after first use", olddecl); SET_DECL_TEMPLATE_SPECIALIZATION (olddecl); --- 3694,3700 ---- that specialization that would cause an implicit instantiation to take place, in every translation unit in which such a use occurs. */ ! error ("explicit specialization of %D after first use", olddecl); SET_DECL_TEMPLATE_SPECIALIZATION (olddecl); *************** duplicate_decls (newdecl, olddecl) *** 3695,3700 **** --- 3707,3715 ---- DECL_INLINE (olddecl) = 1; DECL_INLINE (newdecl) = DECL_INLINE (olddecl); + DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl) + = (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl)); + /* Preserve abstractness on cloned [cd]tors. */ DECL_ABSTRACT (newdecl) = DECL_ABSTRACT (olddecl); *************** duplicate_decls (newdecl, olddecl) *** 3732,3741 **** DECL_NUM_STMTS (newdecl) = DECL_NUM_STMTS (olddecl); DECL_RESULT (newdecl) = DECL_RESULT (olddecl); - if ((DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl))) - /* Previously saved insns go together with - the function's previous definition. */ - DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); /* Don't clear out the arguments if we're redefining a function. */ if (DECL_ARGUMENTS (olddecl)) DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl); --- 3747,3752 ---- *************** duplicate_decls (newdecl, olddecl) *** 3756,3764 **** function_size = sizeof (struct tree_decl); ! bcopy ((char *) newdecl + sizeof (struct tree_common), ! (char *) olddecl + sizeof (struct tree_common), ! function_size - sizeof (struct tree_common)); if (DECL_TEMPLATE_INSTANTIATION (newdecl)) { --- 3767,3775 ---- function_size = sizeof (struct tree_decl); ! memcpy ((char *) olddecl + sizeof (struct tree_common), ! (char *) newdecl + sizeof (struct tree_common), ! function_size - sizeof (struct tree_common)); if (DECL_TEMPLATE_INSTANTIATION (newdecl)) { *************** duplicate_decls (newdecl, olddecl) *** 3794,3803 **** } else { ! bcopy ((char *) newdecl + sizeof (struct tree_common), ! (char *) olddecl + sizeof (struct tree_common), ! sizeof (struct tree_decl) - sizeof (struct tree_common) ! + tree_code_length [(int)TREE_CODE (newdecl)] * sizeof (char *)); } DECL_UID (olddecl) = olddecl_uid; --- 3805,3814 ---- } else { ! memcpy ((char *) olddecl + sizeof (struct tree_common), ! (char *) newdecl + sizeof (struct tree_common), ! sizeof (struct tree_decl) - sizeof (struct tree_common) ! + tree_code_length [(int)TREE_CODE (newdecl)] * sizeof (char *)); } DECL_UID (olddecl) = olddecl_uid; *************** duplicate_decls (newdecl, olddecl) *** 3806,3812 **** /* NEWDECL contains the merged attribute lists. Update OLDDECL to be the same. */ ! DECL_MACHINE_ATTRIBUTES (olddecl) = DECL_MACHINE_ATTRIBUTES (newdecl); return 1; } --- 3817,3823 ---- /* NEWDECL contains the merged attribute lists. Update OLDDECL to be the same. */ ! DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl); return 1; } *************** pushdecl (x) *** 3959,3965 **** else if (t == wchar_decl_node) { if (pedantic && ! DECL_IN_SYSTEM_HEADER (x)) ! cp_pedwarn ("redeclaration of wchar_t as `%T'", TREE_TYPE (x)); /* Throw away the redeclaration. */ return t; --- 3970,3977 ---- 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. */ return t; *************** pushdecl (x) *** 3987,3993 **** This function shall not be overloaded. */ cp_error_at ("invalid redeclaration of `%D'", t); ! cp_error ("as `%D'", x); /* We don't try to push this declaration since that causes a crash. */ return x; --- 3999,4005 ---- 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. */ return x; *************** pushdecl (x) *** 4076,4082 **** && TREE_CODE (decl) == TREE_CODE (x) && !same_type_p (TREE_TYPE (x), TREE_TYPE (decl))) { ! cp_pedwarn ("type mismatch with previous external decl", x); cp_pedwarn_at ("previous external decl of `%#D'", decl); } } --- 4088,4094 ---- && TREE_CODE (decl) == TREE_CODE (x) && !same_type_p (TREE_TYPE (x), TREE_TYPE (decl))) { ! pedwarn ("type mismatch with previous external decl", x); cp_pedwarn_at ("previous external decl of `%#D'", decl); } } *************** pushdecl (x) *** 4117,4123 **** /* If this real decl matches the implicit, don't complain. */ && ! (TREE_CODE (x) == FUNCTION_DECL && TREE_TYPE (TREE_TYPE (x)) == integer_type_node)) ! cp_warning ("`%D' was previously implicitly declared to return `int'", x); /* If new decl is `static' and an `extern' was seen previously, --- 4129,4135 ---- /* 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, *************** pushdecl (x) *** 4178,4184 **** /* OK */; else { ! cp_warning ("extern declaration of `%#D' doesn't match", x); cp_warning_at ("global declaration `%#D'", oldglobal); } } --- 4190,4196 ---- /* OK */; else { ! warning ("extern declaration of `%#D' doesn't match", x); cp_warning_at ("global declaration `%#D'", oldglobal); } } *************** pushdecl (x) *** 4195,4263 **** if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x) /* Inline decls shadow nothing. */ && !DECL_FROM_INLINE (x) ! && TREE_CODE (oldlocal) == PARM_DECL ! /* Don't complain if it's from an enclosing function. */ ! && DECL_CONTEXT (oldlocal) == current_function_decl ! && TREE_CODE (x) != PARM_DECL) { ! /* Go to where the parms should be and see if we ! find them there. */ ! struct binding_level *b = current_binding_level->level_chain; ! if (cleanup_label) ! b = b->level_chain; ! /* ARM $8.3 */ ! if (b->parm_flag == 1) ! cp_error ("declaration of `%#D' shadows a parameter", name); } /* Maybe warn if shadowing something else. */ ! if (warn_shadow && !DECL_EXTERNAL (x) ! /* Inline decls shadow nothing. */ ! && !DECL_FROM_INLINE (x) /* No shadow warnings for internally generated vars. */ && ! DECL_ARTIFICIAL (x) /* No shadow warnings for vars made for inlining. */ && ! DECL_FROM_INLINE (x)) { ! if (oldlocal != NULL_TREE && TREE_CODE (oldlocal) == PARM_DECL) ! warning ("declaration of `%s' shadows a parameter", ! IDENTIFIER_POINTER (name)); ! else if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE && current_class_ptr && !TREE_STATIC (name)) warning ("declaration of `%s' shadows a member of `this'", ! IDENTIFIER_POINTER (name)); ! else if (oldlocal != NULL_TREE) ! warning ("declaration of `%s' shadows previous local", ! IDENTIFIER_POINTER (name)); ! else if (oldglobal != NULL_TREE) /* XXX shadow warnings in outer-more namespaces */ ! warning ("declaration of `%s' shadows global declaration", ! IDENTIFIER_POINTER (name)); } } if (TREE_CODE (x) == FUNCTION_DECL) check_default_args (x); ! /* Keep count of variables in this level with incomplete type. */ ! if (TREE_CODE (x) == VAR_DECL ! && TREE_TYPE (x) != error_mark_node ! && ((!COMPLETE_TYPE_P (TREE_TYPE (x)) ! && PROMOTES_TO_AGGR_TYPE (TREE_TYPE (x), ARRAY_TYPE)) ! /* RTTI TD entries are created while defining the type_info. */ ! || (TYPE_LANG_SPECIFIC (TREE_TYPE (x)) ! && TYPE_BEING_DEFINED (TREE_TYPE (x))))) ! { ! if (namespace_bindings_p ()) ! namespace_scope_incomplete ! = tree_cons (NULL_TREE, x, namespace_scope_incomplete); ! else ! current_binding_level->incomplete ! = tree_cons (NULL_TREE, x, current_binding_level->incomplete); ! } } if (need_new_binding) --- 4207,4264 ---- if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x) /* Inline decls shadow nothing. */ && !DECL_FROM_INLINE (x) ! && TREE_CODE (oldlocal) == PARM_DECL) { ! 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 binding_level *b = current_binding_level->level_chain; ! /* ARM $8.3 */ ! if (b->parm_flag == 1) ! { ! error ("declaration of `%#D' shadows a parameter", ! name); ! err = true; ! } ! } ! ! if (warn_shadow && !err) ! shadow_warning ("a parameter", name, 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)) warning ("declaration of `%s' shadows a member of `this'", ! IDENTIFIER_POINTER (name)); ! else if (oldlocal != NULL_TREE ! && TREE_CODE (oldlocal) == VAR_DECL) ! shadow_warning ("a previous local", name, oldlocal); ! else if (oldglobal != NULL_TREE ! && TREE_CODE (oldglobal) == VAR_DECL) /* XXX shadow warnings in outer-more namespaces */ ! shadow_warning ("a global declaration", name, 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) *************** push_overloaded_decl (decl, flags) *** 4592,4598 **** if (IS_AGGR_TYPE (t) && warn_shadow && (! DECL_IN_SYSTEM_HEADER (decl) || ! DECL_IN_SYSTEM_HEADER (old))) ! cp_warning ("`%#D' hides constructor for `%#T'", decl, t); old = NULL_TREE; } else if (is_overloaded_fn (old)) --- 4593,4599 ---- 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)) *************** push_overloaded_decl (decl, flags) *** 4607,4613 **** && !(flags & PUSH_USING) && compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)), TYPE_ARG_TYPES (TREE_TYPE (decl)))) ! cp_error ("`%#D' conflicts with previous using declaration `%#D'", decl, fn); if (duplicate_decls (decl, fn)) --- 4608,4614 ---- && !(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)) *************** push_overloaded_decl (decl, flags) *** 4620,4626 **** else { cp_error_at ("previous non-function declaration `%#D'", old); ! cp_error ("conflicts with function declaration `%#D'", decl); return decl; } } --- 4621,4627 ---- else { cp_error_at ("previous non-function declaration `%#D'", old); ! error ("conflicts with function declaration `%#D'", decl); return decl; } } *************** push_overloaded_decl (decl, flags) *** 4674,4680 **** } /* We should always find a previous binding in this case. */ ! my_friendly_abort (0); } /* Install the new binding. */ --- 4675,4681 ---- } /* We should always find a previous binding in this case. */ ! abort (); } /* Install the new binding. */ *************** implicitly_declare (functionid) *** 4704,4716 **** /* ISO standard says implicit declarations are in the innermost block. So we record the decl in the standard fashion. */ pushdecl (decl); ! rest_of_decl_compilation (decl, NULL_PTR, 0, 0); if (warn_implicit /* Only one warning per identifier. */ && IDENTIFIER_IMPLICIT_DECL (functionid) == NULL_TREE) { ! cp_pedwarn ("implicit declaration of function `%#D'", decl); } SET_IDENTIFIER_IMPLICIT_DECL (functionid, decl); --- 4705,4717 ---- /* ISO standard says implicit declarations are in the innermost block. So we record the decl in the standard fashion. */ pushdecl (decl); ! rest_of_decl_compilation (decl, NULL, 0, 0); if (warn_implicit /* Only one warning per identifier. */ && IDENTIFIER_IMPLICIT_DECL (functionid) == NULL_TREE) { ! pedwarn ("implicit declaration of function `%#D'", decl); } SET_IDENTIFIER_IMPLICIT_DECL (functionid, decl); *************** check_previous_goto_1 (decl, level, name *** 4971,4977 **** if (! identified) { if (decl) ! cp_pedwarn ("jump to label `%D'", decl); else pedwarn ("jump to case label"); --- 4972,4978 ---- if (! identified) { if (decl) ! pedwarn ("jump to label `%D'", decl); else pedwarn ("jump to case label"); *************** check_previous_goto_1 (decl, level, name *** 4995,5001 **** if (! identified) { if (decl) ! cp_pedwarn ("jump to label `%D'", decl); else pedwarn ("jump to case label"); --- 4996,5002 ---- if (! identified) { if (decl) ! pedwarn ("jump to label `%D'", decl); else pedwarn ("jump to case label"); *************** define_label (filename, line, name) *** 5137,5147 **** p->more_cleanups_ok = 0; if (name == get_identifier ("wchar_t")) ! cp_pedwarn ("label named wchar_t"); if (DECL_INITIAL (decl) != NULL_TREE) { ! cp_error ("duplicate label `%D'", decl); return 0; } else --- 5138,5148 ---- p->more_cleanups_ok = 0; if (name == get_identifier ("wchar_t")) ! pedwarn ("label named wchar_t"); if (DECL_INITIAL (decl) != NULL_TREE) { ! error ("duplicate label `%D'", decl); return 0; } else *************** define_label (filename, line, name) *** 5157,5163 **** ent->binding_level = current_binding_level; } check_previous_gotos (decl); - current_function_return_value = NULL_TREE; return decl; } } --- 5158,5163 ---- *************** finish_case_label (low_value, high_value *** 5227,5233 **** if (high_value) error ("case label not within a switch statement"); else if (low_value) ! cp_error ("case label `%E' not within a switch statement", low_value); else error ("`default' label not within a switch statement"); --- 5227,5233 ---- if (high_value) error ("case label not within a switch statement"); else if (low_value) ! error ("case label `%E' not within a switch statement", low_value); else error ("`default' label not within a switch statement"); *************** finish_case_label (low_value, high_value *** 5259,5265 **** own new (temporary) binding contour. */ for (p = current_binding_level; !(p->parm_flag); p = p->level_chain) p->more_cleanups_ok = 0; - current_function_return_value = NULL_TREE; return r; } --- 5259,5264 ---- *************** storetags (tags) *** 5303,5308 **** --- 5302,5348 ---- current_binding_level->tags = tags; } + /* 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 (type) + 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 BINDING_LEVEL up to the global level. *************** lookup_tag (form, name, binding_level, t *** 5354,5371 **** else old = BINDING_TYPE (old); ! /* If it has an original type, it is a typedef, and we ! should not return it. */ ! if (old && DECL_ORIGINAL_TYPE (TYPE_NAME (old))) ! old = NULL_TREE; ! if (old && TREE_CODE (old) != form ! && !(form != ENUMERAL_TYPE && TREE_CODE (old) == TEMPLATE_DECL)) { ! cp_error ("`%#D' redeclared as %C", old, form); ! return NULL_TREE; } - if (old) - return old; if (thislevel_only || tail == global_namespace) return NULL_TREE; } --- 5394,5416 ---- else old = BINDING_TYPE (old); ! 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 = follow_tag_typedef (old); ! if (!old) ! return NULL_TREE; ! if (TREE_CODE (old) != form ! && (form == ENUMERAL_TYPE ! || TREE_CODE (old) == ENUMERAL_TYPE)) ! { ! error ("`%#D' redeclared as %C", old, form); ! return NULL_TREE; ! } ! return old; } if (thislevel_only || tail == global_namespace) return NULL_TREE; } *************** lookup_tag (form, name, binding_level, t *** 5375,5388 **** if (TREE_PURPOSE (tail) == name) { enum tree_code code = TREE_CODE (TREE_VALUE (tail)); ! /* Should tighten this up; it'll probably permit ! UNION_TYPE and a struct template, for example. */ if (code != form ! && !(form != ENUMERAL_TYPE && code == TEMPLATE_DECL)) { /* Definition isn't the kind we were looking for. */ ! cp_error ("`%#D' redeclared as %C", TREE_VALUE (tail), ! form); return NULL_TREE; } return TREE_VALUE (tail); --- 5420,5431 ---- if (TREE_PURPOSE (tail) == name) { enum tree_code code = TREE_CODE (TREE_VALUE (tail)); ! if (code != form ! && (form == ENUMERAL_TYPE || code == ENUMERAL_TYPE)) { /* Definition isn't the kind we were looking for. */ ! error ("`%#D' redeclared as %C", TREE_VALUE (tail), form); return NULL_TREE; } return TREE_VALUE (tail); *************** lookup_namespace_name (namespace, name) *** 5470,5476 **** { /* This happens for A::B where B is a template, and there are no template arguments. */ ! cp_error ("invalid use of `%D'", name); return error_mark_node; } --- 5513,5519 ---- { /* This happens for A::B where B is a template, and there are no template arguments. */ ! error ("invalid use of `%D'", name); return error_mark_node; } *************** lookup_namespace_name (namespace, name) *** 5504,5517 **** /*in_decl=*/NULL_TREE, /*context=*/NULL_TREE, /*entering_scope=*/0, ! /*complain=*/1); else if (DECL_FUNCTION_TEMPLATE_P (val) || TREE_CODE (val) == OVERLOAD) val = lookup_template_function (val, TREE_OPERAND (template_id, 1)); else { ! cp_error ("`%D::%D' is not a template", namespace, name); return error_mark_node; } --- 5547,5560 ---- /*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); return error_mark_node; } *************** lookup_namespace_name (namespace, name) *** 5520,5529 **** /* If we have a single function from a using decl, pull it out. */ if (TREE_CODE (val) == OVERLOAD && ! really_overloaded_fn (val)) val = OVL_FUNCTION (val); ! return val; } ! cp_error ("`%D' undeclared in namespace `%D'", name, namespace); return error_mark_node; } --- 5563,5577 ---- /* 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)) ! return val; } ! error ("`%D' undeclared in namespace `%D'", name, namespace); return error_mark_node; } *************** build_typename_type (context, name, full *** 5623,5634 **** /* Resolve `typename CONTEXT::NAME'. Returns an appropriate type, unless an error occurs, in which case error_mark_node is returned. ! If COMPLAIN zero, don't complain about any errors that occur. */ tree make_typename_type (context, name, complain) tree context, name; ! int complain; { tree fullname; --- 5671,5685 ---- /* Resolve `typename CONTEXT::NAME'. Returns an appropriate type, unless an error occurs, in which case error_mark_node is returned. ! If we locate a non-artificial TYPE_DECL and TF_KEEP_TYPE_DECL is ! set, we return that, rather than the _TYPE it corresponds to, in ! other cases we look through the type decl. If TF_ERROR is set, ! complain about errors, otherwise be quiet. */ tree make_typename_type (context, name, complain) tree context, name; ! tsubst_flags_t complain; { tree fullname; *************** make_typename_type (context, name, compl *** 5655,5669 **** if (TREE_CODE (name) == TEMPLATE_DECL) name = TREE_OPERAND (fullname, 0) = DECL_NAME (name); } if (TREE_CODE (name) != IDENTIFIER_NODE) ! my_friendly_abort (2000); if (TREE_CODE (context) == NAMESPACE_DECL) { /* We can get here from typename_sub0 in the explicit_template_type expansion. Just fail. */ ! if (complain) ! cp_error ("no class template named `%#T' in `%#T'", name, context); return error_mark_node; } --- 5706,5725 ---- if (TREE_CODE (name) == TEMPLATE_DECL) name = TREE_OPERAND (fullname, 0) = DECL_NAME (name); } + if (TREE_CODE (name) == TEMPLATE_DECL) + { + error ("`%D' used without template parameters", name); + return error_mark_node; + } if (TREE_CODE (name) != IDENTIFIER_NODE) ! abort (); if (TREE_CODE (context) == NAMESPACE_DECL) { /* We can get here from typename_sub0 in the explicit_template_type expansion. Just fail. */ ! if (complain & tf_error) ! error ("no class template named `%#T' in `%#T'", name, context); return error_mark_node; } *************** make_typename_type (context, name, compl *** 5678,5685 **** tmpl = lookup_field (context, name, 0, 0); if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) { ! if (complain) ! cp_error ("no class template named `%#T' in `%#T'", name, context); return error_mark_node; } --- 5734,5741 ---- tmpl = lookup_field (context, name, 0, 0); if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) { ! if (complain & tf_error) ! error ("no class template named `%#T' in `%#T'", name, context); return error_mark_node; } *************** make_typename_type (context, name, compl *** 5688,5694 **** TREE_OPERAND (fullname, 1), NULL_TREE, context, /*entering_scope=*/0, ! /*complain=*/1); } else { --- 5744,5750 ---- TREE_OPERAND (fullname, 1), NULL_TREE, context, /*entering_scope=*/0, ! tf_error | tf_warning); } else { *************** make_typename_type (context, name, compl *** 5696,5709 **** if (!IS_AGGR_TYPE (context)) { ! if (complain) ! cp_error ("no type named `%#T' in `%#T'", name, context); return error_mark_node; } t = lookup_field (context, name, 0, 1); if (t) ! return TREE_TYPE (t); } } --- 5752,5780 ---- if (!IS_AGGR_TYPE (context)) { ! if (complain & tf_error) ! error ("no type named `%#T' in `%#T'", name, context); return error_mark_node; } t = lookup_field (context, name, 0, 1); if (t) ! { ! if (DECL_ARTIFICIAL (t) || !(complain & tf_keep_type_decl)) ! t = TREE_TYPE (t); ! if (IMPLICIT_TYPENAME_P (t)) ! { ! /* Lookup found an implicit typename that we had ! injected into the current scope. Doing things ! properly would have located the exact same type, ! so there is no error here. We must remove the ! implicitness so that we do not warn about it. */ ! t = copy_node (t); ! TREE_TYPE (t) = NULL_TREE; ! } ! ! return t; ! } } } *************** make_typename_type (context, name, compl *** 5711,5718 **** there now or its never going to be. */ if (!uses_template_parms (context)) { ! if (complain) ! cp_error ("no type named `%#T' in `%#T'", name, context); return error_mark_node; } --- 5782,5789 ---- there now or its never going to be. */ if (!uses_template_parms (context)) { ! if (complain & tf_error) ! error ("no type named `%#T' in `%#T'", name, context); return error_mark_node; } *************** make_typename_type (context, name, compl *** 5720,5725 **** --- 5791,5853 ---- return build_typename_type (context, name, fullname, NULL_TREE); } + /* Resolve `CONTEXT::template NAME'. Returns an appropriate type, + unless an error occurs, in which case error_mark_node is returned. + If we locate a TYPE_DECL, we return that, rather than the _TYPE it + corresponds to. If COMPLAIN zero, don't complain about any errors + that occur. */ + + tree + make_unbound_class_template (context, name, complain) + tree context, name; + int complain; + { + tree t; + tree d; + + if (TYPE_P (name)) + name = TYPE_IDENTIFIER (name); + else if (DECL_P (name)) + name = DECL_NAME (name); + if (TREE_CODE (name) != IDENTIFIER_NODE) + abort (); + + if (!uses_template_parms (context) + || currently_open_class (context)) + { + tree tmpl = NULL_TREE; + + if (IS_AGGR_TYPE (context)) + tmpl = lookup_field (context, name, 0, 0); + + if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) + { + if (complain) + error ("no class template named `%#T' in `%#T'", name, context); + return error_mark_node; + } + + if (!enforce_access (context, tmpl)) + return error_mark_node; + + return tmpl; + } + + /* Build the UNBOUND_CLASS_TEMPLATE. */ + t = make_aggr_type (UNBOUND_CLASS_TEMPLATE); + TYPE_CONTEXT (t) = FROB_CONTEXT (context); + TREE_TYPE (t) = NULL_TREE; + + /* Build the corresponding TEMPLATE_DECL. */ + d = build_decl (TEMPLATE_DECL, name, t); + TYPE_NAME (TREE_TYPE (d)) = d; + TYPE_STUB_DECL (TREE_TYPE (d)) = d; + DECL_CONTEXT (d) = FROB_CONTEXT (context); + DECL_ARTIFICIAL (d) = 1; + + return t; + } + /* Select the right _DECL from multiple choices. */ static tree *************** select_decl (binding, flags) *** 5730,5743 **** tree val; val = BINDING_VALUE (binding); - /* When we implicitly declare some builtin entity, we mark it - DECL_ANTICIPATED, so that we know to ignore it until it is - really declared. */ - if (val && DECL_P (val) - && DECL_LANG_SPECIFIC (val) - && DECL_ANTICIPATED (val)) - return NULL_TREE; - if (LOOKUP_NAMESPACES_ONLY (flags)) { /* We are not interested in types. */ --- 5858,5863 ---- *************** unqualified_namespace_lookup (name, flag *** 5772,5778 **** tree *spacesp; { tree b = make_node (CPLUS_BINDING); ! tree initial = current_decl_namespace(); tree scope = initial; tree siter; struct binding_level *level; --- 5892,5898 ---- tree *spacesp; { tree b = make_node (CPLUS_BINDING); ! tree initial = current_decl_namespace (); tree scope = initial; tree siter; struct binding_level *level; *************** unqualified_namespace_lookup (name, flag *** 5787,5795 **** *spacesp = tree_cons (scope, NULL_TREE, *spacesp); val = binding_for_name (name, scope); ! /* Initialize binding for this context. */ ! BINDING_VALUE (b) = BINDING_VALUE (val); ! BINDING_TYPE (b) = BINDING_TYPE (val); /* Add all _DECLs seen through local using-directives. */ for (level = current_binding_level; --- 5907,5927 ---- *spacesp = tree_cons (scope, NULL_TREE, *spacesp); val = binding_for_name (name, scope); ! /* Ignore anticipated built-in functions. */ ! if (val && BINDING_VALUE (val) ! && DECL_P (BINDING_VALUE (val)) ! && DECL_LANG_SPECIFIC (BINDING_VALUE (val)) ! && DECL_ANTICIPATED (BINDING_VALUE (val))) ! { ! BINDING_VALUE (b) = NULL_TREE; ! BINDING_TYPE (b) = NULL_TREE; ! } ! else ! { ! /* Initialize binding for this context. */ ! BINDING_VALUE (b) = BINDING_VALUE (val); ! BINDING_TYPE (b) = BINDING_TYPE (val); ! } /* Add all _DECLs seen through local using-directives. */ for (level = current_binding_level; *************** warn_about_implicit_typename_lookup (typ *** 5874,5884 **** && ! (TREE_CODE (binding) == TYPE_DECL && same_type_p (TREE_TYPE (binding), subtype))) { ! cp_warning ("lookup of `%D' finds `%#D'", name, binding); ! cp_warning (" instead of `%D' from dependent base class", typename); ! cp_warning (" (use `typename %T::%D' if that's what you meant)", constructor_name (current_class_type), name); } } --- 6006,6016 ---- && ! (TREE_CODE (binding) == TYPE_DECL && same_type_p (TREE_TYPE (binding), subtype))) { ! warning ("lookup of `%D' finds `%#D'", name, binding); ! warning (" instead of `%D' from dependent base class", typename); ! warning (" (use `typename %T::%D' if that's what you meant)", constructor_name (current_class_type), name); } } *************** lookup_name_real (name, prefer_type, non *** 5926,5935 **** if (looking_for_template) flags |= LOOKUP_TEMPLATES_EXPECTED; - /* std:: becomes :: for now. */ - if (got_scope && got_scope == fake_std_node) - got_scope = void_type_node; - if (got_scope) type = got_scope; else if (got_object != error_mark_node) --- 6058,6063 ---- *************** lookup_name_real (name, prefer_type, non *** 6055,6061 **** if (looking_for_typename && TREE_CODE (from_obj) == TYPE_DECL && TREE_CODE (val) == TYPE_DECL && ! same_type_p (TREE_TYPE (from_obj), TREE_TYPE (val))) ! cp_pedwarn ("\ lookup of `%D' in the scope of `%#T' (`%#D') \ does not match lookup in the current scope (`%#D')", name, got_object, from_obj, val); --- 6183,6189 ---- if (looking_for_typename && TREE_CODE (from_obj) == TYPE_DECL && TREE_CODE (val) == TYPE_DECL && ! same_type_p (TREE_TYPE (from_obj), TREE_TYPE (val))) ! pedwarn ("\ lookup of `%D' in the scope of `%#T' (`%#D') \ does not match lookup in the current scope (`%#D')", name, got_object, from_obj, val); *************** record_unknown_type (type, name) *** 6291,6301 **** typedef struct predefined_identifier { /* The name of the identifier. */ ! const char *name; /* The place where the IDENTIFIER_NODE should be stored. */ ! tree *node; /* Non-zero if this is the name of a constructor or destructor. */ ! int ctor_or_dtor_p; } predefined_identifier; /* Create all the predefined identifiers. */ --- 6419,6429 ---- typedef struct predefined_identifier { /* The name of the identifier. */ ! const char *const name; /* The place where the IDENTIFIER_NODE should be stored. */ ! tree *const node; /* Non-zero if this is the name of a constructor or destructor. */ ! const int ctor_or_dtor_p; } predefined_identifier; /* Create all the predefined identifiers. */ *************** typedef struct predefined_identifier *** 6303,6312 **** static void initialize_predefined_identifiers () { ! struct predefined_identifier *pid; /* A table of identifiers to create at startup. */ ! static predefined_identifier predefined_identifiers[] = { { "C++", &lang_name_cplusplus, 0 }, { "C", &lang_name_c, 0 }, { "Java", &lang_name_java, 0 }, --- 6431,6440 ---- static void initialize_predefined_identifiers () { ! const predefined_identifier *pid; /* A table of identifiers to create at startup. */ ! static const predefined_identifier predefined_identifiers[] = { { "C++", &lang_name_cplusplus, 0 }, { "C", &lang_name_c, 0 }, { "Java", &lang_name_java, 0 }, *************** initialize_predefined_identifiers () *** 6317,6330 **** { "__comp_dtor", &complete_dtor_identifier, 1 }, { "__base_dtor", &base_dtor_identifier, 1 }, { "__deleting_dtor", &deleting_dtor_identifier, 1 }, - { VTABLE_DELTA2_NAME, &delta2_identifier, 0 }, - { VTABLE_DELTA_NAME, &delta_identifier, 0 }, { IN_CHARGE_NAME, &in_charge_identifier, 0 }, - { VTABLE_INDEX_NAME, &index_identifier, 0 }, { "nelts", &nelts_identifier, 0 }, { THIS_NAME, &this_identifier, 0 }, { VTABLE_PFN_NAME, &pfn_identifier, 0 }, - { "__pfn_or_delta2", &pfn_or_delta2_identifier, 0 }, { "_vptr", &vptr_identifier, 0 }, { "__vtt_parm", &vtt_parm_identifier, 0 }, { "std", &std_identifier, 0 }, --- 6445,6455 ---- { "__comp_dtor", &complete_dtor_identifier, 1 }, { "__base_dtor", &base_dtor_identifier, 1 }, { "__deleting_dtor", &deleting_dtor_identifier, 1 }, { IN_CHARGE_NAME, &in_charge_identifier, 0 }, { "nelts", &nelts_identifier, 0 }, { THIS_NAME, &this_identifier, 0 }, + { VTABLE_DELTA_NAME, &delta_identifier, 0 }, { VTABLE_PFN_NAME, &pfn_identifier, 0 }, { "_vptr", &vptr_identifier, 0 }, { "__vtt_parm", &vtt_parm_identifier, 0 }, { "std", &std_identifier, 0 }, *************** initialize_predefined_identifiers () *** 6345,6358 **** Make definitions for built-in primitive functions. */ void ! init_decl_processing () { ! tree fields[20]; ! ! /* Check to see that the user did not specify an invalid combination ! of command-line options. */ ! if (!flag_vtable_thunks) ! error ("the ABI requires vtable thunks"); /* Create all the identifiers we need. */ initialize_predefined_identifiers (); --- 6470,6479 ---- Make definitions for built-in primitive functions. */ void ! cxx_init_decl_processing () { ! tree void_ftype; ! tree void_ftype_ptr; /* Create all the identifiers we need. */ initialize_predefined_identifiers (); *************** init_decl_processing () *** 6361,6368 **** init_lang_status = &push_cp_function_context; free_lang_status = &pop_cp_function_context; mark_lang_status = &mark_cp_function_context; - lang_safe_from_p = &c_safe_from_p; - lang_dump_tree = &cp_dump_tree; lang_missing_noreturn_ok_p = &cp_missing_noreturn_ok_p; cp_parse_init (); --- 6482,6487 ---- *************** init_decl_processing () *** 6392,6403 **** flag_inline_functions = 0; } - /* In C++, we never create builtin functions whose name does not - begin with `__'. Users should be using headers to get prototypes - in C++. It would be nice if we could warn when `-fbuiltin' is - used explicitly, but we do not have that information. */ - flag_no_builtin = 1; - /* Initially, C. */ current_lang_name = lang_name_c; --- 6511,6516 ---- *************** init_decl_processing () *** 6418,6437 **** declare_namespace_level (); /* Create the `std' namespace. */ ! if (flag_honor_std) ! { ! push_namespace (std_identifier); ! std_node = current_namespace; ! pop_namespace (); ! fake_std_node = error_mark_node; ! } ! else ! { ! fake_std_node = build_decl (NAMESPACE_DECL, ! std_identifier, ! void_type_node); ! pushdecl (fake_std_node); ! } c_common_nodes_and_builtins (); --- 6531,6541 ---- declare_namespace_level (); /* Create the `std' namespace. */ ! push_namespace (std_identifier); ! std_node = current_namespace; ! pop_namespace (); ! ! lang_attribute_table = cp_attribute_table; c_common_nodes_and_builtins (); *************** init_decl_processing () *** 6466,6472 **** empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE); #if 0 ! record_builtin_type (RID_MAX, NULL_PTR, string_type_node); #endif delta_type_node = ptrdiff_type_node; --- 6570,6576 ---- empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE); #if 0 ! record_builtin_type (RID_MAX, NULL, string_type_node); #endif delta_type_node = ptrdiff_type_node; *************** init_decl_processing () *** 6475,6480 **** --- 6579,6589 ---- vtt_parm_type = build_pointer_type (const_ptr_type_node); lang_type_promotes_to = convert_type_from_ellipsis; + void_ftype = build_function_type (void_type_node, void_list_node); + void_ftype_ptr = build_function_type (void_type_node, + tree_cons (NULL_TREE, + ptr_type_node, + void_list_node)); void_ftype_ptr = build_exception_variant (void_ftype_ptr, empty_except_spec); *************** init_decl_processing () *** 6486,6543 **** /* Indirecting an UNKNOWN_TYPE node yields an UNKNOWN_TYPE node. */ TREE_TYPE (unknown_type_node) = unknown_type_node; - TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0); - /* Looking up TYPE_POINTER_TO and TYPE_REFERENCE_TO yield the same result. */ TYPE_POINTER_TO (unknown_type_node) = unknown_type_node; TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node; ! if (flag_vtable_thunks) ! { ! /* Make sure we get a unique function type, so we can give ! its pointer type a name. (This wins for gdb.) */ ! tree vfunc_type = make_node (FUNCTION_TYPE); ! TREE_TYPE (vfunc_type) = integer_type_node; ! TYPE_ARG_TYPES (vfunc_type) = NULL_TREE; ! layout_type (vfunc_type); ! ! vtable_entry_type = build_pointer_type (vfunc_type); ! } ! else ! { ! vtable_entry_type = make_aggr_type (RECORD_TYPE); ! fields[0] = build_decl (FIELD_DECL, delta_identifier, ! delta_type_node); ! fields[1] = build_decl (FIELD_DECL, index_identifier, ! delta_type_node); ! fields[2] = build_decl (FIELD_DECL, pfn_identifier, ! ptr_type_node); ! finish_builtin_type (vtable_entry_type, VTBL_PTR_TYPE, fields, 2, ! double_type_node); ! /* Make this part of an invisible union. */ ! fields[3] = copy_node (fields[2]); ! TREE_TYPE (fields[3]) = delta_type_node; ! DECL_NAME (fields[3]) = delta2_identifier; ! DECL_MODE (fields[3]) = TYPE_MODE (delta_type_node); ! DECL_SIZE (fields[3]) = TYPE_SIZE (delta_type_node); ! DECL_SIZE_UNIT (fields[3]) = TYPE_SIZE_UNIT (delta_type_node); ! TREE_UNSIGNED (fields[3]) = 0; ! TREE_CHAIN (fields[2]) = fields[3]; ! vtable_entry_type = build_qualified_type (vtable_entry_type, ! TYPE_QUAL_CONST); ! } record_builtin_type (RID_MAX, VTBL_PTR_TYPE, vtable_entry_type); vtbl_type_node = build_cplus_array_type (vtable_entry_type, NULL_TREE); layout_type (vtbl_type_node); vtbl_type_node = build_qualified_type (vtbl_type_node, TYPE_QUAL_CONST); ! record_builtin_type (RID_MAX, NULL_PTR, vtbl_type_node); vtbl_ptr_type_node = build_pointer_type (vtable_entry_type); layout_type (vtbl_ptr_type_node); ! record_builtin_type (RID_MAX, NULL_PTR, vtbl_ptr_type_node); push_namespace (get_identifier ("__cxxabiv1")); abi_node = current_namespace; --- 6595,6625 ---- /* Indirecting an UNKNOWN_TYPE node yields an UNKNOWN_TYPE node. */ TREE_TYPE (unknown_type_node) = unknown_type_node; /* Looking up TYPE_POINTER_TO and TYPE_REFERENCE_TO yield the same result. */ TYPE_POINTER_TO (unknown_type_node) = unknown_type_node; TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node; ! { ! /* Make sure we get a unique function type, so we can give ! its pointer type a name. (This wins for gdb.) */ ! tree vfunc_type = make_node (FUNCTION_TYPE); ! TREE_TYPE (vfunc_type) = integer_type_node; ! TYPE_ARG_TYPES (vfunc_type) = NULL_TREE; ! layout_type (vfunc_type); ! vtable_entry_type = build_pointer_type (vfunc_type); ! } record_builtin_type (RID_MAX, VTBL_PTR_TYPE, vtable_entry_type); vtbl_type_node = build_cplus_array_type (vtable_entry_type, NULL_TREE); layout_type (vtbl_type_node); vtbl_type_node = build_qualified_type (vtbl_type_node, TYPE_QUAL_CONST); ! record_builtin_type (RID_MAX, NULL, vtbl_type_node); vtbl_ptr_type_node = build_pointer_type (vtable_entry_type); layout_type (vtbl_ptr_type_node); ! record_builtin_type (RID_MAX, NULL, vtbl_ptr_type_node); push_namespace (get_identifier ("__cxxabiv1")); abi_node = current_namespace; *************** init_decl_processing () *** 6551,6564 **** { tree bad_alloc_type_node, newtype, deltype; ! if (flag_honor_std) ! push_namespace (std_identifier); bad_alloc_type_node = xref_tag (class_type_node, get_identifier ("bad_alloc"), 1); ! if (flag_honor_std) ! pop_namespace (); newtype = build_exception_variant ! (ptr_ftype_sizetype, add_exception_specifier (NULL_TREE, bad_alloc_type_node, -1)); deltype = build_exception_variant (void_ftype_ptr, empty_except_spec); push_cp_library_fn (NEW_EXPR, newtype); push_cp_library_fn (VEC_NEW_EXPR, newtype); --- 6633,6652 ---- { tree bad_alloc_type_node, newtype, deltype; ! tree ptr_ftype_sizetype; ! ! push_namespace (std_identifier); bad_alloc_type_node = xref_tag (class_type_node, get_identifier ("bad_alloc"), 1); ! pop_namespace (); ! ptr_ftype_sizetype ! = build_function_type (ptr_type_node, ! tree_cons (NULL_TREE, ! c_size_type_node, ! void_list_node)); newtype = build_exception_variant ! (ptr_ftype_sizetype, add_exception_specifier ! (NULL_TREE, bad_alloc_type_node, -1)); deltype = build_exception_variant (void_ftype_ptr, empty_except_spec); push_cp_library_fn (NEW_EXPR, newtype); push_cp_library_fn (VEC_NEW_EXPR, newtype); *************** init_decl_processing () *** 6581,6602 **** if (! supports_one_only ()) flag_weak = 0; - /* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */ - function_id_node = get_identifier ("__FUNCTION__"); - pretty_function_id_node = get_identifier ("__PRETTY_FUNCTION__"); - func_id_node = get_identifier ("__func__"); - make_fname_decl = cp_make_fname_decl; ! declare_function_name (); ! ! /* Prepare to check format strings against argument lists. */ ! init_function_format_info (); /* Show we use EH for cleanups. */ using_eh_for_cleanups (); - valid_lang_attribute = cp_valid_lang_attribute; - /* Maintain consistency. Perhaps we should just complain if they say -fwritable-strings? */ if (flag_writable_strings) --- 6669,6680 ---- if (! supports_one_only ()) flag_weak = 0; make_fname_decl = cp_make_fname_decl; ! start_fname_decls (); /* Show we use EH for cleanups. */ using_eh_for_cleanups (); /* Maintain consistency. Perhaps we should just complain if they say -fwritable-strings? */ if (flag_writable_strings) *************** init_decl_processing () *** 6617,6625 **** ggc_add_tree_root (&static_dtors, 1); ggc_add_tree_root (&lastiddecl, 1); - ggc_add_tree_root (&last_function_parm_tags, 1); - ggc_add_tree_root (¤t_function_return_value, 1); - ggc_add_tree_root (¤t_function_parm_tags, 1); ggc_add_tree_root (&last_function_parms, 1); ggc_add_tree_root (&error_mark_list, 1); --- 6695,6700 ---- *************** init_decl_processing () *** 6633,6698 **** ggc_add_tree_root (¤t_lang_name, 1); ggc_add_tree_root (&static_aggregates, 1); ggc_add_tree_root (&free_bindings, 1); } /* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give the decl, NAME is the initialization string and TYPE_DEP indicates whether NAME depended on the type of the function. We make use of that to detect ! __PRETTY_FUNCTION__ inside a template fn. Because we build a tree for ! the function before emitting any of it, we don't need to treat the ! VAR_DECL specially. We can decide whether to emit it later, if it was ! used. */ static tree ! cp_make_fname_decl (id, name, type_dep) tree id; - const char *name; int type_dep; { ! tree decl, type, init; ! size_t length = strlen (name); ! tree domain = NULL_TREE; ! ! if (!processing_template_decl) ! type_dep = 0; ! if (!type_dep) ! domain = build_index_type (size_int (length)); ! ! type = build_cplus_array_type ! (build_qualified_type (char_type_node, TYPE_QUAL_CONST), ! domain); ! decl = build_decl (VAR_DECL, id, type); TREE_STATIC (decl) = 1; TREE_READONLY (decl) = 1; - DECL_SOURCE_LINE (decl) = 0; DECL_ARTIFICIAL (decl) = 1; - DECL_IN_SYSTEM_HEADER (decl) = 1; - DECL_IGNORED_P (decl) = 1; - pushdecl (decl); - if (processing_template_decl) - decl = push_template_decl (decl); - if (type_dep) - { - init = build (FUNCTION_NAME, type); - DECL_PRETTY_FUNCTION_P (decl) = 1; - } - else - { - init = build_string (length + 1, name); - TREE_TYPE (init) = type; - } DECL_INITIAL (decl) = init; ! cp_finish_decl (decl, init, NULL_TREE, LOOKUP_ONLYCONVERTING); ! /* We will have to make sure we only emit this, if it is actually used. */ return decl; } ! /* Entry point for the benefit of c_common_nodes_and_builtins. ! ! Make a definition for a builtin function named NAME and whose data type ! is TYPE. TYPE should be a function type with argument types. CLASS and CODE tell later passes how to compile calls to this function. See tree.h for possible values. --- 6708,6784 ---- ggc_add_tree_root (¤t_lang_name, 1); ggc_add_tree_root (&static_aggregates, 1); ggc_add_tree_root (&free_bindings, 1); + ggc_add_tree_root (&incomplete_vars, 1); + } + + /* Generate an initializer for a function naming variable from + NAME. NAME may be NULL, in which case we generate a special + ERROR_MARK node which should be replaced later. */ + + tree + cp_fname_init (name) + const char *name; + { + tree domain = NULL_TREE; + tree type; + tree init = NULL_TREE; + size_t length = 0; + + if (name) + { + length = strlen (name); + domain = build_index_type (size_int (length)); + init = build_string (length + 1, name); + } + + type = build_qualified_type (char_type_node, TYPE_QUAL_CONST); + type = build_cplus_array_type (type, domain); + + if (init) + TREE_TYPE (init) = type; + else + /* We don't know the value until instantiation time. Make + something which will be digested now, but replaced later. */ + init = build (ERROR_MARK, type); + + return init; } /* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give the decl, NAME is the initialization string and TYPE_DEP indicates whether NAME depended on the type of the function. We make use of that to detect ! __PRETTY_FUNCTION__ inside a template fn. This is being done ! lazily at the point of first use, so we musn't push the decl now. */ static tree ! cp_make_fname_decl (id, type_dep) tree id; int type_dep; { ! const char *const name = (type_dep && processing_template_decl ! ? NULL : fname_as_string (type_dep)); ! tree init = cp_fname_init (name); ! tree decl = build_decl (VAR_DECL, id, TREE_TYPE (init)); ! /* As we don't push the decl here, we must set the context. */ ! DECL_CONTEXT (decl) = current_function_decl; ! DECL_PRETTY_FUNCTION_P (decl) = type_dep; ! TREE_STATIC (decl) = 1; TREE_READONLY (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_INITIAL (decl) = init; ! ! TREE_USED (decl) = 1; ! cp_finish_decl (decl, init, NULL_TREE, LOOKUP_ONLYCONVERTING); ! return decl; } ! /* Make a definition for a builtin function named NAME in the current ! namespace, whose data type is TYPE and whose context is CONTEXT. ! TYPE should be a function type with argument types. CLASS and CODE tell later passes how to compile calls to this function. See tree.h for possible values. *************** cp_make_fname_decl (id, name, type_dep) *** 6700,6709 **** If LIBNAME is nonzero, use that for DECL_ASSEMBLER_NAME, the name to be called if we can't opencode the function. */ ! tree ! builtin_function (name, type, code, class, libname) const char *name; tree type; int code; enum built_in_class class; const char *libname; --- 6786,6796 ---- If LIBNAME is nonzero, use that for DECL_ASSEMBLER_NAME, the name to be called if we can't opencode the function. */ ! static tree ! builtin_function_1 (name, type, context, code, class, libname) const char *name; tree type; + tree context; int code; enum built_in_class class; const char *libname; *************** builtin_function (name, type, code, clas *** 6711,6729 **** tree decl = build_library_fn_1 (get_identifier (name), ERROR_MARK, type); DECL_BUILT_IN_CLASS (decl) = class; DECL_FUNCTION_CODE (decl) = code; ! my_friendly_assert (DECL_CONTEXT (decl) == NULL_TREE, 392); - /* All builtins that don't begin with an `_' should go in the `std' - namespace. */ - if (flag_honor_std && name[0] != '_') - { - push_namespace (std_identifier); - DECL_CONTEXT (decl) = std_node; - } pushdecl (decl); - if (flag_honor_std && name[0] != '_') - pop_namespace (); /* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME, we cannot change DECL_ASSEMBLER_NAME until we have installed this --- 6798,6810 ---- tree decl = build_library_fn_1 (get_identifier (name), ERROR_MARK, type); DECL_BUILT_IN_CLASS (decl) = class; DECL_FUNCTION_CODE (decl) = code; + DECL_CONTEXT (decl) = context; ! /* The return builtins leave the current function. */ ! if (code == BUILT_IN_RETURN || code == BUILT_IN_EH_RETURN) ! TREE_THIS_VOLATILE (decl) = 1; pushdecl (decl); /* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME, we cannot change DECL_ASSEMBLER_NAME until we have installed this *************** builtin_function (name, type, code, clas *** 6737,6745 **** --- 6818,6862 ---- if (name[0] != '_' || name[1] != '_') DECL_ANTICIPATED (decl) = 1; + /* Possibly apply some default attributes to this built-in function. */ + decl_attributes (&decl, NULL_TREE, 0); + return decl; } + /* Entry point for the benefit of c_common_nodes_and_builtins. + + Make a defintion for a builtin function named NAME and whose data type + is TYPE. TYPE should be a function type with argument types. This + function places the anticipated declaration in the global namespace + and additionally in the std namespace if appropriate. + + CLASS and CODE tell later passes how to compile calls to this function. + See tree.h for possible values. + + If LIBNAME is nonzero, use that for DECL_ASSEMBLER_NAME, + the name to be called if we can't opencode the function. */ + + tree + builtin_function (name, type, code, class, libname) + const char *name; + tree type; + int code; + enum built_in_class class; + const char *libname; + { + /* All builtins that don't begin with an '_' should additionally + go in the 'std' namespace. */ + if (name[0] != '_') + { + push_namespace (std_identifier); + builtin_function_1 (name, type, std_node, code, class, libname); + pop_namespace (); + } + + return builtin_function_1 (name, type, NULL_TREE, code, class, libname); + } + /* Generate a FUNCTION_DECL with the typical flags for a runtime library function. Not called directly. */ *************** push_throw_library_fn (name, type) *** 6859,6864 **** --- 6976,6995 ---- TREE_NOTHROW (fn) = 0; return fn; } + + /* Apply default attributes to a function, if a system function with default + attributes. */ + + void + insert_default_attributes (decl) + tree decl; + { + if (!DECL_EXTERN_C_FUNCTION_P (decl)) + return; + if (!TREE_PUBLIC (decl)) + return; + c_common_insert_default_attributes (decl); + } /* When we call finish_struct for an anonymous union, we create default copy constructors and such. But, an anonymous union *************** check_tag_decl (declspecs) *** 6958,6964 **** if (found_type == 2 && TREE_CODE (value) == IDENTIFIER_NODE) { if (! in_system_header) ! cp_pedwarn ("redeclaration of C++ built-in type `%T'", value); return NULL_TREE; } --- 7089,7095 ---- if (found_type == 2 && TREE_CODE (value) == IDENTIFIER_NODE) { if (! in_system_header) ! pedwarn ("redeclaration of C++ built-in type `%T'", value); return NULL_TREE; } *************** check_tag_decl (declspecs) *** 7020,7026 **** --end example] */ if (saw_typedef) { ! error ("Missing type-name in typedef-declaration."); return NULL_TREE; } /* Anonymous unions are objects, so they can have specifiers. */; --- 7151,7157 ---- --end example] */ if (saw_typedef) { ! error ("missing type-name in typedef-declaration"); return NULL_TREE; } /* Anonymous unions are objects, so they can have specifiers. */; *************** check_tag_decl (declspecs) *** 7034,7047 **** { if (ob_modifier == ridpointers[(int) RID_INLINE] || ob_modifier == ridpointers[(int) RID_VIRTUAL]) ! cp_error ("`%D' can only be specified for functions", ob_modifier); else if (ob_modifier == ridpointers[(int) RID_FRIEND]) ! cp_error ("`%D' can only be specified inside a class", ob_modifier); else if (ob_modifier == ridpointers[(int) RID_EXPLICIT]) ! cp_error ("`%D' can only be specified for constructors", ob_modifier); else ! cp_error ("`%D' can only be specified for objects and functions", ob_modifier); } --- 7165,7178 ---- { if (ob_modifier == ridpointers[(int) RID_INLINE] || ob_modifier == ridpointers[(int) RID_VIRTUAL]) ! error ("`%D' can only be specified for functions", ob_modifier); else if (ob_modifier == ridpointers[(int) RID_FRIEND]) ! error ("`%D' can only be specified inside a class", ob_modifier); else if (ob_modifier == ridpointers[(int) RID_EXPLICIT]) ! error ("`%D' can only be specified for constructors", ob_modifier); else ! error ("`%D' can only be specified for objects and functions", ob_modifier); } *************** shadow_tag (declspecs) *** 7080,7086 **** if (TYPE_FIELDS (t)) { tree decl = grokdeclarator (NULL_TREE, declspecs, NORMAL, 0, ! NULL_TREE); finish_anon_union (decl); } } --- 7211,7217 ---- if (TYPE_FIELDS (t)) { tree decl = grokdeclarator (NULL_TREE, declspecs, NORMAL, 0, ! NULL); finish_anon_union (decl); } } *************** tree *** 7092,7102 **** groktypename (typename) tree typename; { if (TREE_CODE (typename) != TREE_LIST) return typename; ! return grokdeclarator (TREE_VALUE (typename), ! TREE_PURPOSE (typename), ! TYPENAME, 0, NULL_TREE); } /* Decode a declarator in an ordinary declaration or data definition. --- 7223,7238 ---- groktypename (typename) tree typename; { + tree specs, attrs; + tree type; if (TREE_CODE (typename) != TREE_LIST) return typename; ! split_specs_attrs (TREE_PURPOSE (typename), &specs, &attrs); ! type = grokdeclarator (TREE_VALUE (typename), specs, ! TYPENAME, 0, &attrs); ! if (attrs) ! cplus_decl_attributes (&type, attrs, 0); ! return type; } /* Decode a declarator in an ordinary declaration or data definition. *************** start_decl (declarator, declspecs, initi *** 7120,7131 **** int initialized; tree attributes, prefix_attributes; { ! register tree decl; register tree type, tem; tree context; extern int have_extern_spec; extern int used_extern_spec; - tree attrlist; #if 0 /* See code below that used this. */ --- 7256,7266 ---- int initialized; tree attributes, prefix_attributes; { ! tree decl; register tree type, tem; tree context; extern int have_extern_spec; extern int used_extern_spec; #if 0 /* See code below that used this. */ *************** start_decl (declarator, declspecs, initi *** 7140,7152 **** used_extern_spec = 1; } ! if (attributes || prefix_attributes) ! attrlist = build_tree_list (attributes, prefix_attributes); ! else ! attrlist = NULL_TREE; decl = grokdeclarator (declarator, declspecs, NORMAL, initialized, ! attrlist); if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE) return NULL_TREE; --- 7275,7291 ---- used_extern_spec = 1; } ! /* An object declared as __attribute__((deprecated)) suppresses ! warnings of uses of other deprecated items. */ ! if (lookup_attribute ("deprecated", attributes)) ! deprecated_state = DEPRECATED_SUPPRESS; ! ! attributes = chainon (attributes, prefix_attributes); decl = grokdeclarator (declarator, declspecs, NORMAL, initialized, ! &attributes); ! ! deprecated_state = DEPRECATED_NORMAL; if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE) return NULL_TREE; *************** start_decl (declarator, declspecs, initi *** 7182,7194 **** Any other case of an initialization in a TYPE_DECL is an error. */ if (pedantic || list_length (declspecs) > 1) { ! cp_error ("typedef `%D' is initialized", decl); initialized = 0; } break; case FUNCTION_DECL: ! cp_error ("function `%#D' is initialized like a variable", decl); initialized = 0; break; --- 7321,7333 ---- Any other case of an initialization in a TYPE_DECL is an error. */ if (pedantic || list_length (declspecs) > 1) { ! error ("typedef `%D' is initialized", decl); initialized = 0; } break; case FUNCTION_DECL: ! error ("function `%#D' is initialized like a variable", decl); initialized = 0; break; *************** start_decl (declarator, declspecs, initi *** 7200,7206 **** { if (! toplevel_bindings_p () && DECL_EXTERNAL (decl)) ! cp_warning ("declaration of `%#D' has `extern' and is initialized", decl); DECL_EXTERNAL (decl) = 0; if (toplevel_bindings_p ()) --- 7339,7345 ---- { if (! toplevel_bindings_p () && DECL_EXTERNAL (decl)) ! warning ("declaration of `%#D' has `extern' and is initialized", decl); DECL_EXTERNAL (decl) = 0; if (toplevel_bindings_p ()) *************** start_decl (declarator, declspecs, initi *** 7212,7223 **** DECL_INITIAL (decl) = error_mark_node; } - #ifdef SET_DEFAULT_DECL_ATTRIBUTES - SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes); - #endif - /* Set attributes here so if duplicate decl, will have proper attributes. */ ! cplus_decl_attributes (decl, attributes, prefix_attributes); if (context && COMPLETE_TYPE_P (complete_type (context))) { --- 7351,7369 ---- DECL_INITIAL (decl) = error_mark_node; } /* Set attributes here so if duplicate decl, will have proper attributes. */ ! cplus_decl_attributes (&decl, attributes, 0); ! ! /* If #pragma weak was used, mark the decl weak now. */ ! if (current_binding_level == global_binding_level) ! maybe_apply_pragma_weak (decl); ! ! if (TREE_CODE (decl) == FUNCTION_DECL ! && DECL_DECLARED_INLINE_P (decl) ! && DECL_UNINLINABLE (decl) ! && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl))) ! warning_with_decl (decl, ! "inline function `%s' given attribute noinline"); if (context && COMPLETE_TYPE_P (complete_type (context))) { *************** start_decl (declarator, declspecs, initi *** 7227,7238 **** { tree field = lookup_field (context, DECL_NAME (decl), 0, 0); if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL) ! cp_error ("`%#D' is not a static member of `%#T'", decl, context); else { if (DECL_CONTEXT (field) != context) { ! cp_pedwarn ("ISO C++ does not permit `%T::%D' to be defined as `%T::%D'", DECL_CONTEXT (field), DECL_NAME (decl), context, DECL_NAME (decl)); DECL_CONTEXT (decl) = DECL_CONTEXT (field); --- 7373,7384 ---- { tree field = lookup_field (context, DECL_NAME (decl), 0, 0); if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL) ! error ("`%#D' is not a static member of `%#T'", decl, context); else { if (DECL_CONTEXT (field) != context) { ! pedwarn ("ISO C++ does not permit `%T::%D' to be defined as `%T::%D'", DECL_CONTEXT (field), DECL_NAME (decl), context, DECL_NAME (decl)); DECL_CONTEXT (decl) = DECL_CONTEXT (field); *************** start_decl (declarator, declspecs, initi *** 7243,7249 **** initialization. Thus, duplicate_decls won't warn about this situation, and so we check here. */ if (DECL_INITIAL (decl) && DECL_INITIAL (field)) ! cp_error ("duplicate initialization of %D", decl); if (duplicate_decls (decl, field)) decl = field; } --- 7389,7395 ---- initialization. Thus, duplicate_decls won't warn about this situation, and so we check here. */ if (DECL_INITIAL (decl) && DECL_INITIAL (field)) ! error ("duplicate initialization of %D", decl); if (duplicate_decls (decl, field)) decl = field; } *************** start_decl (declarator, declspecs, initi *** 7272,7278 **** } if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl)) ! cp_pedwarn ("declaration of `%#D' outside of class is not definition", decl); } --- 7418,7424 ---- } if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl)) ! pedwarn ("declaration of `%#D' outside of class is not definition", decl); } *************** start_decl_1 (decl) *** 7320,7326 **** ; /* A complete type is ok. */ else if (TREE_CODE (type) != ARRAY_TYPE) { ! cp_error ("variable `%#D' has initializer but incomplete type", decl); initialized = 0; type = TREE_TYPE (decl) = error_mark_node; --- 7466,7472 ---- ; /* A complete type is ok. */ else if (TREE_CODE (type) != ARRAY_TYPE) { ! error ("variable `%#D' has initializer but incomplete type", decl); initialized = 0; type = TREE_TYPE (decl) = error_mark_node; *************** start_decl_1 (decl) *** 7328,7334 **** else if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type)))) { if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)) ! cp_error ("elements of array `%#D' have incomplete type", decl); /* else we already gave an error in start_decl. */ initialized = 0; } --- 7474,7480 ---- else if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type)))) { if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)) ! error ("elements of array `%#D' have incomplete type", decl); /* else we already gave an error in start_decl. */ initialized = 0; } *************** start_decl_1 (decl) *** 7344,7350 **** if ((! processing_template_decl || ! uses_template_parms (type)) && !COMPLETE_TYPE_P (complete_type (type))) { ! cp_error ("aggregate `%#D' has incomplete type and cannot be initialized", decl); /* Change the type so that assemble_variable will give DECL an rtl we can live with: (mem (const_int 0)). */ --- 7490,7496 ---- if ((! processing_template_decl || ! uses_template_parms (type)) && !COMPLETE_TYPE_P (complete_type (type))) { ! error ("aggregate `%#D' has incomplete type and cannot be defined", decl); /* Change the type so that assemble_variable will give DECL an rtl we can live with: (mem (const_int 0)). */ *************** grok_reference_init (decl, type, init) *** 7383,7389 **** if ((DECL_LANG_SPECIFIC (decl) == 0 || DECL_IN_AGGR_P (decl) == 0) && ! DECL_THIS_EXTERN (decl)) ! cp_error ("`%D' declared as reference but not initialized", decl); return NULL_TREE; } --- 7529,7535 ---- if ((DECL_LANG_SPECIFIC (decl) == 0 || DECL_IN_AGGR_P (decl) == 0) && ! DECL_THIS_EXTERN (decl)) ! error ("`%D' declared as reference but not initialized", decl); return NULL_TREE; } *************** grok_reference_init (decl, type, init) *** 7392,7398 **** if (TREE_CODE (init) == CONSTRUCTOR) { ! cp_error ("ISO C++ forbids use of initializer list to initialize reference `%D'", decl); return NULL_TREE; } --- 7538,7544 ---- if (TREE_CODE (init) == CONSTRUCTOR) { ! error ("ISO C++ forbids use of initializer list to initialize reference `%D'", decl); return NULL_TREE; } *************** grok_reference_init (decl, type, init) *** 7425,7447 **** return NULL_TREE; else if (tmp == NULL_TREE) { ! cp_error ("cannot initialize `%T' from `%T'", type, TREE_TYPE (init)); return NULL_TREE; } - init = tmp; - tmp = save_expr (tmp); if (TREE_STATIC (decl) && !TREE_CONSTANT (tmp)) return tmp; ! if (building_stmt_tree ()) ! { ! /* Initialize the declaration. */ ! tmp = build (INIT_EXPR, TREE_TYPE (decl), decl, tmp); ! finish_expr_stmt (tmp); ! } ! else ! DECL_INITIAL (decl) = tmp; return NULL_TREE; } --- 7571,7584 ---- return NULL_TREE; else if (tmp == NULL_TREE) { ! error ("cannot initialize `%T' from `%T'", type, TREE_TYPE (init)); return NULL_TREE; } if (TREE_STATIC (decl) && !TREE_CONSTANT (tmp)) return tmp; ! DECL_INITIAL (decl) = tmp; return NULL_TREE; } *************** maybe_deduce_size_from_array_init (decl, *** 7495,7506 **** int failure = complete_array_type (type, initializer, do_default); if (failure == 1) ! cp_error ("initializer fails to determine size of `%D'", decl); if (failure == 2) { if (do_default) ! cp_error ("array size missing in `%D'", decl); /* If a `static' var's size isn't known, make it extern as well as static, so it does not get allocated. If it's not `static', then don't mark it extern; finish_incomplete_decl --- 7632,7643 ---- int failure = complete_array_type (type, initializer, do_default); if (failure == 1) ! error ("initializer fails to determine size of `%D'", decl); if (failure == 2) { if (do_default) ! error ("array size missing in `%D'", decl); /* If a `static' var's size isn't known, make it extern as well as static, so it does not get allocated. If it's not `static', then don't mark it extern; finish_incomplete_decl *************** maybe_deduce_size_from_array_init (decl, *** 7512,7518 **** if (pedantic && TYPE_DOMAIN (type) != NULL_TREE && tree_int_cst_lt (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), integer_zero_node)) ! cp_error ("zero-size array `%D'", decl); layout_decl (decl, 0); } --- 7649,7655 ---- if (pedantic && TYPE_DOMAIN (type) != NULL_TREE && tree_int_cst_lt (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), integer_zero_node)) ! error ("zero-size array `%D'", decl); layout_decl (decl, 0); } *************** layout_var_decl (decl) *** 7545,7551 **** /* An automatic variable with an incomplete type: that is an error. Don't talk about array types here, since we took care of that message in grokdeclarator. */ ! cp_error ("storage size of `%D' isn't known", decl); TREE_TYPE (decl) = error_mark_node; } #if 0 --- 7682,7688 ---- /* An automatic variable with an incomplete type: that is an error. Don't talk about array types here, since we took care of that message in grokdeclarator. */ ! error ("storage size of `%D' isn't known", decl); TREE_TYPE (decl) = error_mark_node; } #if 0 *************** layout_var_decl (decl) *** 7567,7573 **** if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST) constant_expression_warning (DECL_SIZE (decl)); else ! cp_error ("storage size of `%D' isn't constant", decl); } if (TREE_STATIC (decl) --- 7704,7710 ---- if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST) constant_expression_warning (DECL_SIZE (decl)); else ! error ("storage size of `%D' isn't constant", decl); } if (TREE_STATIC (decl) *************** check_for_uninitialized_const_var (decl) *** 7647,7653 **** && CP_TYPE_CONST_P (type) && !TYPE_NEEDS_CONSTRUCTING (type) && !DECL_INITIAL (decl)) ! cp_error ("uninitialized const `%D'", decl); } /* Verify INIT (the initializer for DECL), and record the --- 7784,7790 ---- && CP_TYPE_CONST_P (type) && !TYPE_NEEDS_CONSTRUCTING (type) && !DECL_INITIAL (decl)) ! error ("uninitialized const `%D'", decl); } /* Verify INIT (the initializer for DECL), and record the *************** check_initializer (decl, init) *** 7682,7699 **** init = NULL_TREE; else if (COMPLETE_TYPE_P (type) && !TREE_CONSTANT (TYPE_SIZE (type))) { ! cp_error ("variable-sized object `%D' may not be initialized", decl); init = NULL_TREE; } else if (TREE_CODE (type) == ARRAY_TYPE ! && !COMPLETE_TYPE_P (TREE_TYPE (type))) { ! cp_error ("elements of array `%#D' have incomplete type", decl); init = NULL_TREE; } ! else if (!COMPLETE_TYPE_P (type)) { ! cp_error ("`%D' has incomplete type", decl); TREE_TYPE (decl) = error_mark_node; init = NULL_TREE; } --- 7819,7836 ---- init = NULL_TREE; else if (COMPLETE_TYPE_P (type) && !TREE_CONSTANT (TYPE_SIZE (type))) { ! error ("variable-sized object `%D' may not be initialized", decl); init = NULL_TREE; } else if (TREE_CODE (type) == ARRAY_TYPE ! && !COMPLETE_TYPE_P (complete_type (TREE_TYPE (type)))) { ! error ("elements of array `%#D' have incomplete type", decl); init = NULL_TREE; } ! else if (TREE_CODE (type) != ARRAY_TYPE && !COMPLETE_TYPE_P (type)) { ! error ("`%D' has incomplete type", decl); TREE_TYPE (decl) = error_mark_node; init = NULL_TREE; } *************** check_initializer (decl, init) *** 7725,7731 **** { if (TYPE_NON_AGGREGATE_CLASS (type)) { ! cp_error ("`%D' must be initialized by constructor, not by `{...}'", decl); init = error_mark_node; } --- 7862,7868 ---- { if (TYPE_NON_AGGREGATE_CLASS (type)) { ! error ("`%D' must be initialized by constructor, not by `{...}'", decl); init = error_mark_node; } *************** check_initializer (decl, init) *** 7755,7763 **** if (! TYPE_NEEDS_CONSTRUCTING (core_type)) { if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type)) ! cp_error ("structure `%D' with uninitialized const members", decl); if (CLASSTYPE_REF_FIELDS_NEED_INIT (core_type)) ! cp_error ("structure `%D' with uninitialized reference members", decl); } --- 7892,7900 ---- if (! TYPE_NEEDS_CONSTRUCTING (core_type)) { if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type)) ! error ("structure `%D' with uninitialized const members", decl); if (CLASSTYPE_REF_FIELDS_NEED_INIT (core_type)) ! error ("structure `%D' with uninitialized reference members", decl); } *************** make_rtl_for_nonlocal_decl (decl, init, *** 7822,7828 **** defer_p = DECL_FUNCTION_SCOPE_P (decl) || DECL_VIRTUAL_P (decl); /* We try to defer namespace-scope static constants so that they are ! not emitted into the object file unncessarily. */ if (!DECL_VIRTUAL_P (decl) && TREE_READONLY (decl) && DECL_INITIAL (decl) != NULL_TREE --- 7959,7965 ---- defer_p = DECL_FUNCTION_SCOPE_P (decl) || DECL_VIRTUAL_P (decl); /* We try to defer namespace-scope static constants so that they are ! not emitted into the object file unnecessarily. */ if (!DECL_VIRTUAL_P (decl) && TREE_READONLY (decl) && DECL_INITIAL (decl) != NULL_TREE *************** make_rtl_for_nonlocal_decl (decl, init, *** 7831,7838 **** && toplev && !TREE_PUBLIC (decl)) { ! /* Fool with the linkage according to #pragma interface. */ ! if (!interface_unknown) { TREE_PUBLIC (decl) = 1; DECL_EXTERNAL (decl) = interface_only; --- 7968,7976 ---- && toplev && !TREE_PUBLIC (decl)) { ! /* Fool with the linkage of static consts according to #pragma ! interface. */ ! if (!interface_unknown && !TREE_PUBLIC (decl)) { TREE_PUBLIC (decl) = 1; DECL_EXTERNAL (decl) = interface_only; *************** make_rtl_for_nonlocal_decl (decl, init, *** 7840,7845 **** --- 7978,7986 ---- defer_p = 1; } + /* Likewise for template instantiations. */ + else if (DECL_COMDAT (decl)) + defer_p = 1; /* If we're deferring the variable, we only need to make RTL if there's an ASMSPEC. Otherwise, we'll lazily create it later when *************** destroy_local_var (decl) *** 7992,7999 **** cleanup = maybe_build_cleanup (decl); /* Record the cleanup required for this declaration. */ ! if (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node ! && cleanup) finish_decl_cleanup (decl, cleanup); } --- 8133,8139 ---- cleanup = maybe_build_cleanup (decl); /* Record the cleanup required for this declaration. */ ! if (DECL_SIZE (decl) && cleanup) finish_decl_cleanup (decl, cleanup); } *************** cp_finish_decl (decl, init, asmspec_tree *** 8027,8038 **** } /* If a name was specified, get the string. */ if (asmspec_tree) ! asmspec = TREE_STRING_POINTER (asmspec_tree); if (init && TREE_CODE (init) == NAMESPACE_DECL) { ! cp_error ("cannot initialize `%D' to namespace `%D'", decl, init); init = NULL_TREE; } --- 8167,8180 ---- } /* If a name was specified, get the string. */ + if (current_binding_level == global_binding_level) + asmspec_tree = maybe_apply_renaming_pragma (decl, asmspec_tree); if (asmspec_tree) ! asmspec = TREE_STRING_POINTER (asmspec_tree); if (init && TREE_CODE (init) == NAMESPACE_DECL) { ! error ("cannot initialize `%D' to namespace `%D'", decl, init); init = NULL_TREE; } *************** cp_finish_decl (decl, init, asmspec_tree *** 8058,8074 **** if (type == error_mark_node) return; - /* Add this declaration to the statement-tree. */ - if (building_stmt_tree () - && at_function_scope_p () - && TREE_CODE (decl) != RESULT_DECL) - add_decl_stmt (decl); - if (TYPE_HAS_MUTABLE_P (type)) TREE_READONLY (decl) = 0; if (processing_template_decl) { if (init && DECL_INITIAL (decl)) DECL_INITIAL (decl) = init; goto finish_end0; --- 8200,8215 ---- if (type == error_mark_node) return; if (TYPE_HAS_MUTABLE_P (type)) TREE_READONLY (decl) = 0; if (processing_template_decl) { + /* Add this declaration to the statement-tree. */ + if (at_function_scope_p () + && TREE_CODE (decl) != RESULT_DECL) + add_decl_stmt (decl); + if (init && DECL_INITIAL (decl)) DECL_INITIAL (decl) = init; goto finish_end0; *************** cp_finish_decl (decl, init, asmspec_tree *** 8090,8100 **** && IS_AGGR_TYPE (type) && DECL_NAME (decl)) { if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type) ! cp_warning ("shadowing previous type declaration of `%#D'", decl); set_identifier_type_value (DECL_NAME (decl), type); CLASSTYPE_GOT_SEMICOLON (type) = 1; } - GNU_xref_decl (current_function_decl, decl); /* If we have installed this as the canonical typedef for this type, and that type has not been defined yet, delay emitting --- 8231,8240 ---- && IS_AGGR_TYPE (type) && DECL_NAME (decl)) { if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type) ! warning ("shadowing previous type declaration of `%#D'", decl); set_identifier_type_value (DECL_NAME (decl), type); CLASSTYPE_GOT_SEMICOLON (type) = 1; } /* If we have installed this as the canonical typedef for this type, and that type has not been defined yet, delay emitting *************** cp_finish_decl (decl, init, asmspec_tree *** 8103,8109 **** && !COMPLETE_TYPE_P (TREE_TYPE (decl))) TYPE_DECL_SUPPRESS_DEBUG (decl) = 1; ! rest_of_decl_compilation (decl, NULL_PTR, DECL_CONTEXT (decl) == NULL_TREE, at_eof); goto finish_end; } --- 8243,8249 ---- && !COMPLETE_TYPE_P (TREE_TYPE (decl))) TYPE_DECL_SUPPRESS_DEBUG (decl) = 1; ! rest_of_decl_compilation (decl, NULL, DECL_CONTEXT (decl) == NULL_TREE, at_eof); goto finish_end; } *************** cp_finish_decl (decl, init, asmspec_tree *** 8132,8141 **** } /* Deduce size of array from initialization, if not already known. */ - maybe_deduce_size_from_array_init (decl, init); init = check_initializer (decl, init); ! GNU_xref_decl (current_function_decl, decl); if (TREE_CODE (decl) == VAR_DECL) layout_var_decl (decl); --- 8272,8287 ---- } /* Deduce size of array from initialization, if not already known. */ init = check_initializer (decl, init); + maybe_deduce_size_from_array_init (decl, init); ! /* Add this declaration to the statement-tree. This needs to happen ! after the call to check_initializer so that the DECL_STMT for a ! reference temp is added before the DECL_STMT for the reference itself. */ ! if (building_stmt_tree () ! && at_function_scope_p () ! && TREE_CODE (decl) != RESULT_DECL) ! add_decl_stmt (decl); if (TREE_CODE (decl) == VAR_DECL) layout_var_decl (decl); *************** start_cleanup_fn () *** 8382,8388 **** DECL_ARTIFICIAL (fndecl) = 1; /* Make the function `inline' so that it is only emitted if it is actually needed. It is unlikely that it will be inlined, since ! it is only called via a function pointer, but we avoid unncessary emissions this way. */ DECL_INLINE (fndecl) = 1; /* Build the parameter. */ --- 8528,8534 ---- DECL_ARTIFICIAL (fndecl) = 1; /* Make the function `inline' so that it is only emitted if it is actually needed. It is unlikely that it will be inlined, since ! it is only called via a function pointer, but we avoid unnecessary emissions this way. */ DECL_INLINE (fndecl) = 1; /* Build the parameter. */ *************** start_cleanup_fn () *** 8399,8405 **** pushdecl (fndecl); start_function (/*specs=*/NULL_TREE, fndecl, NULL_TREE, SF_PRE_PARSED); - do_pushlevel (); interface_unknown = old_interface_unknown; --- 8545,8550 ---- *************** start_cleanup_fn () *** 8413,8420 **** static void end_cleanup_fn () { - do_poplevel (); - expand_body (finish_function (0)); pop_from_top_level (); --- 8558,8563 ---- *************** register_dtor_fn (decl) *** 8465,8471 **** cleanup = build_unary_op (ADDR_EXPR, cleanup, 0); if (flag_use_cxa_atexit) { ! args = tree_cons (NULL_TREE, get_dso_handle_node (), NULL_TREE); args = tree_cons (NULL_TREE, null_pointer_node, args); args = tree_cons (NULL_TREE, cleanup, args); } --- 8608,8616 ---- cleanup = build_unary_op (ADDR_EXPR, cleanup, 0); if (flag_use_cxa_atexit) { ! args = tree_cons (NULL_TREE, ! build_unary_op (ADDR_EXPR, get_dso_handle_node (), 0), ! NULL_TREE); args = tree_cons (NULL_TREE, null_pointer_node, args); args = tree_cons (NULL_TREE, cleanup, args); } *************** expand_static_init (decl, init) *** 8484,8490 **** if (oldstatic) { if (TREE_PURPOSE (oldstatic) && init != NULL_TREE) ! cp_error ("multiple initializations given for `%D'", decl); } else if (! toplevel_bindings_p ()) { --- 8629,8635 ---- if (oldstatic) { if (TREE_PURPOSE (oldstatic) && init != NULL_TREE) ! error ("multiple initializations given for `%D'", decl); } else if (! toplevel_bindings_p ()) { *************** start_handler_parms (declspecs, declarat *** 8582,8588 **** if (declspecs) { decl = grokdeclarator (declarator, declspecs, CATCHPARM, ! 1, NULL_TREE); if (decl == NULL_TREE) error ("invalid catch parameter"); } --- 8727,8733 ---- if (declspecs) { decl = grokdeclarator (declarator, declspecs, CATCHPARM, ! 1, NULL); if (decl == NULL_TREE) error ("invalid catch parameter"); } *************** member_function_or_else (ctype, cur_type *** 8702,8711 **** if (ctype && ctype != cur_type) { if (flags == DTOR_FLAG) ! cp_error ("destructor for alien class `%T' cannot be a member", ctype); else ! cp_error ("constructor for alien class `%T' cannot be a member", ctype); return 0; } --- 8847,8856 ---- if (ctype && ctype != cur_type) { if (flags == DTOR_FLAG) ! error ("destructor for alien class `%T' cannot be a member", ctype); else ! error ("constructor for alien class `%T' cannot be a member", ctype); return 0; } *************** bad_specifiers (object, type, virtualp, *** 8724,8739 **** int virtualp, quals, friendp, raises, inlinep; { if (virtualp) ! cp_error ("`%D' declared as a `virtual' %s", object, type); if (inlinep) ! cp_error ("`%D' declared as an `inline' %s", object, type); if (quals) ! cp_error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration", object, type); if (friendp) cp_error_at ("`%D' declared as a friend", object); ! if (raises && !TYPE_PTRFN_P (TREE_TYPE (object)) ! && !TYPE_PTRMEMFUNC_P (TREE_TYPE (object))) cp_error_at ("`%D' declared with an exception specification", object); } --- 8869,8887 ---- int virtualp, quals, friendp, raises, inlinep; { if (virtualp) ! error ("`%D' declared as a `virtual' %s", object, type); if (inlinep) ! error ("`%D' declared as an `inline' %s", object, type); if (quals) ! error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration", object, type); if (friendp) cp_error_at ("`%D' declared as a friend", object); ! if (raises ! && (TREE_CODE (object) == TYPE_DECL ! || (!TYPE_PTRFN_P (TREE_TYPE (object)) ! && !TYPE_REFFN_P (TREE_TYPE (object)) ! && !TYPE_PTRMEMFUNC_P (TREE_TYPE (object))))) cp_error_at ("`%D' declared with an exception specification", object); } *************** grokfndecl (ctype, type, declarator, ori *** 8771,8779 **** tree t; if (raises) ! { ! type = build_exception_variant (type, raises); ! } decl = build_lang_decl (FUNCTION_DECL, declarator, type); /* Propagate volatile out from type to decl. */ --- 8919,8925 ---- tree t; if (raises) ! type = build_exception_variant (type, raises); decl = build_lang_decl (FUNCTION_DECL, declarator, type); /* Propagate volatile out from type to decl. */ *************** grokfndecl (ctype, type, declarator, ori *** 8846,8852 **** /* Allow this; it's pretty common in C. */; else { ! cp_pedwarn ("non-local function `%#D' uses anonymous type", decl); if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) cp_pedwarn_at ("\ --- 8992,8998 ---- /* Allow this; it's pretty common in C. */; else { ! pedwarn ("non-local function `%#D' uses anonymous type", decl); if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) cp_pedwarn_at ("\ *************** grokfndecl (ctype, type, declarator, ori *** 8855,8861 **** } } else ! cp_pedwarn ("non-local function `%#D' uses local type `%T'", decl, t); } } --- 9001,9007 ---- } } else ! pedwarn ("non-local function `%#D' uses local type `%T'", decl, t); } } *************** grokfndecl (ctype, type, declarator, ori *** 8878,8890 **** DECL_EXTERNAL (decl) = 1; if (quals != NULL_TREE && TREE_CODE (type) == FUNCTION_TYPE) { ! cp_error ("%smember function `%D' cannot have `%T' method qualifier", (ctype ? "static " : "non-"), decl, TREE_VALUE (quals)); quals = NULL_TREE; } if (IDENTIFIER_OPNAME_P (DECL_NAME (decl))) ! grok_op_properties (decl, virtualp, check < 0); if (ctype && decl_function_context (decl)) DECL_NO_STATIC_CHAIN (decl) = 1; --- 9024,9036 ---- DECL_EXTERNAL (decl) = 1; if (quals != NULL_TREE && TREE_CODE (type) == FUNCTION_TYPE) { ! error ("%smember function `%D' cannot have `%T' method qualifier", (ctype ? "static " : "non-"), decl, TREE_VALUE (quals)); quals = NULL_TREE; } if (IDENTIFIER_OPNAME_P (DECL_NAME (decl))) ! grok_op_properties (decl, friendp); if (ctype && decl_function_context (decl)) DECL_NO_STATIC_CHAIN (decl) = 1; *************** grokfndecl (ctype, type, declarator, ori *** 8901,8907 **** && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR) { if (funcdef_flag) ! cp_error ("defining explicit specialization `%D' in friend declaration", orig_declarator); else --- 9047,9053 ---- && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR) { if (funcdef_flag) ! error ("defining explicit specialization `%D' in friend declaration", orig_declarator); else *************** grokfndecl (ctype, type, declarator, ori *** 8912,8918 **** if (PROCESSING_REAL_TEMPLATE_DECL_P ()) { /* Something like `template friend void f()'. */ ! cp_error ("invalid use of template-id `%D' in declaration of primary template", orig_declarator); return NULL_TREE; } --- 9058,9064 ---- if (PROCESSING_REAL_TEMPLATE_DECL_P ()) { /* Something like `template friend void f()'. */ ! error ("invalid use of template-id `%D' in declaration of primary template", orig_declarator); return NULL_TREE; } *************** grokfndecl (ctype, type, declarator, ori *** 8940,8953 **** if (has_default_arg) { ! cp_error ("default arguments are not allowed in declaration of friend template specialization `%D'", decl); return NULL_TREE; } if (inlinep) { ! cp_error ("`inline' is not allowed in declaration of friend template specialization `%D'", decl); return NULL_TREE; } --- 9086,9099 ---- if (has_default_arg) { ! error ("default arguments are not allowed in declaration of friend template specialization `%D'", decl); return NULL_TREE; } if (inlinep) { ! error ("`inline' is not allowed in declaration of friend template specialization `%D'", decl); return NULL_TREE; } *************** grokfndecl (ctype, type, declarator, ori *** 9009,9015 **** last_function_parms = TREE_CHAIN (last_function_parms); } if (old_decl && DECL_ARTIFICIAL (old_decl)) ! cp_error ("definition of implicitly-declared `%D'", old_decl); if (old_decl) { --- 9155,9161 ---- last_function_parms = TREE_CHAIN (last_function_parms); } if (old_decl && DECL_ARTIFICIAL (old_decl)) ! error ("definition of implicitly-declared `%D'", old_decl); if (old_decl) { *************** grokfndecl (ctype, type, declarator, ori *** 9021,9027 **** /* Attempt to merge the declarations. This can fail, in the case of some illegal specialization declarations. */ if (!duplicate_decls (decl, old_decl)) ! cp_error ("no `%#D' member function declared in class `%T'", decl, ctype); return old_decl; } --- 9167,9173 ---- /* Attempt to merge the declarations. This can fail, in the case of some illegal specialization declarations. */ if (!duplicate_decls (decl, old_decl)) ! error ("no `%#D' member function declared in class `%T'", decl, ctype); return old_decl; } *************** grokvardecl (type, declarator, specbits_ *** 9140,9146 **** if (TYPE_ANONYMOUS_P (t)) /* Ignore for now; `enum { foo } e' is pretty common. */; else ! cp_pedwarn ("non-local variable `%#D' uses local type `%T'", decl, t); } } --- 9286,9292 ---- if (TYPE_ANONYMOUS_P (t)) /* Ignore for now; `enum { foo } e' is pretty common. */; else ! pedwarn ("non-local variable `%#D' uses local type `%T'", decl, t); } } *************** build_ptrmemfunc_type (type) *** 9171,9177 **** /* Make sure that we always have the unqualified pointer-to-member type first. */ ! if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED) unqualified_variant = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type)); --- 9317,9323 ---- /* Make sure that we always have the unqualified pointer-to-member type first. */ ! if (cp_type_quals (type) != TYPE_UNQUALIFIED) unqualified_variant = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type)); *************** build_ptrmemfunc_type (type) *** 9194,9202 **** type, set the TYPE_MAIN_VARIANT for this type to be the unqualified type. Since they are actually RECORD_TYPEs that are not variants of each other, we must do this manually. */ ! if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED) { ! t = build_qualified_type (t, CP_TYPE_QUALS (type)); TYPE_MAIN_VARIANT (t) = unqualified_variant; TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant); TYPE_NEXT_VARIANT (unqualified_variant) = t; --- 9340,9348 ---- type, set the TYPE_MAIN_VARIANT for this type to be the unqualified type. Since they are actually RECORD_TYPEs that are not variants of each other, we must do this manually. */ ! if (cp_type_quals (type) != TYPE_UNQUALIFIED) { ! t = build_qualified_type (t, cp_type_quals (type)); TYPE_MAIN_VARIANT (t) = unqualified_variant; TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant); TYPE_NEXT_VARIANT (unqualified_variant) = t; *************** check_static_variable_definition (decl, *** 9230,9236 **** required. */ if (CLASS_TYPE_P (type) || TREE_CODE (type) == REFERENCE_TYPE) { ! cp_error ("invalid in-class initialization of static data member of non-integral type `%T'", type); /* If we just return the declaration, crashes will sometimes occur. We therefore return void_type_node, as if this was a --- 9376,9382 ---- required. */ if (CLASS_TYPE_P (type) || TREE_CODE (type) == REFERENCE_TYPE) { ! error ("invalid in-class initialization of static data member of non-integral type `%T'", type); /* If we just return the declaration, crashes will sometimes occur. We therefore return void_type_node, as if this was a *************** check_static_variable_definition (decl, *** 9239,9248 **** return 1; } else if (!CP_TYPE_CONST_P (type)) ! cp_error ("ISO C++ forbids in-class initialization of non-const static member `%D'", decl); else if (pedantic && !INTEGRAL_TYPE_P (type)) ! cp_pedwarn ("ISO C++ forbids initialization of member constant `%D' of non-integral type `%T'", decl, type); return 0; } --- 9385,9394 ---- return 1; } else if (!CP_TYPE_CONST_P (type)) ! error ("ISO C++ forbids in-class initialization of non-const static member `%D'", decl); else if (pedantic && !INTEGRAL_TYPE_P (type)) ! pedwarn ("ISO C++ forbids initialization of member constant `%D' of non-integral type `%T'", decl, type); return 0; } *************** compute_array_index_type (name, size) *** 9292,9300 **** && TREE_CODE (TREE_TYPE (size)) != BOOLEAN_TYPE) { if (name) ! cp_error ("size of array `%D' has non-integer type", name); else ! cp_error ("size of array has non-integer type"); size = integer_one_node; } --- 9438,9446 ---- && TREE_CODE (TREE_TYPE (size)) != BOOLEAN_TYPE) { if (name) ! error ("size of array `%D' has non-integer type", name); else ! error ("size of array has non-integer type"); size = integer_one_node; } *************** compute_array_index_type (name, size) *** 9314,9322 **** if (INT_CST_LT (size, integer_zero_node)) { if (name) ! cp_error ("size of array `%D' is negative", name); else ! cp_error ("size of array is negative"); size = integer_one_node; } /* Except that an extension we allow zero-sized arrays. We --- 9460,9468 ---- if (INT_CST_LT (size, integer_zero_node)) { if (name) ! error ("size of array `%D' is negative", name); else ! error ("size of array is negative"); size = integer_one_node; } /* Except that an extension we allow zero-sized arrays. We *************** compute_array_index_type (name, size) *** 9325,9343 **** else if (integer_zerop (size) && pedantic && !in_system_header) { if (name) ! cp_pedwarn ("ISO C++ forbids zero-size array `%D'", name); else ! cp_pedwarn ("ISO C++ forbids zero-size array"); } } else if (TREE_CONSTANT (size)) { /* `(int) &fn' is not a valid array bound. */ if (name) ! cp_error ("size of array `%D' is not an integral constant-expression", name); else ! cp_error ("size of array is not an integral constant-expression"); } /* Compute the index of the largest element in the array. It is --- 9471,9489 ---- else if (integer_zerop (size) && pedantic && !in_system_header) { if (name) ! pedwarn ("ISO C++ forbids zero-size array `%D'", name); else ! pedwarn ("ISO C++ forbids zero-size array"); } } else if (TREE_CONSTANT (size)) { /* `(int) &fn' is not a valid array bound. */ if (name) ! error ("size of array `%D' is not an integral constant-expression", name); else ! error ("size of array is not an integral constant-expression"); } /* Compute the index of the largest element in the array. It is *************** compute_array_index_type (name, size) *** 9355,9364 **** if (pedantic) { if (name) ! cp_pedwarn ("ISO C++ forbids variable-size array `%D'", name); else ! cp_pedwarn ("ISO C++ forbids variable-size array"); } /* Create a variable-sized array index type. */ --- 9501,9510 ---- if (pedantic) { if (name) ! pedwarn ("ISO C++ forbids variable-size array `%D'", name); else ! pedwarn ("ISO C++ forbids variable-size array"); } /* Create a variable-sized array index type. */ *************** create_array_type_for_decl (name, type, *** 9428,9436 **** if (error_msg) { if (name) ! cp_error ("declaration of `%D' as %s", name, error_msg); else ! cp_error ("creating %s", error_msg); return error_mark_node; } --- 9574,9582 ---- if (error_msg) { if (name) ! error ("declaration of `%D' as %s", name, error_msg); else ! error ("creating %s", error_msg); return error_mark_node; } *************** create_array_type_for_decl (name, type, *** 9441,9448 **** can be omitted only for the first member of the sequence. */ if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type)) { ! cp_error ("declaration of `%D' as multidimensional array must have bounds for all dimensions except the first", ! name); return error_mark_node; } --- 9587,9597 ---- can be omitted only for the first member of the sequence. */ if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type)) { ! if (name) ! error ("declaration of `%D' as multidimensional array must have bounds for all dimensions except the first", ! name); ! else ! error ("multidimensional array must have bounds for all dimensions except the first"); return error_mark_node; } *************** check_special_function_return_type (sfk, *** 9471,9498 **** { case sfk_constructor: if (type) ! cp_error ("return type specification for constructor invalid"); - /* In the new ABI constructors do not return a value. */ type = void_type_node; break; case sfk_destructor: if (type) ! cp_error ("return type specification for destructor invalid"); type = void_type_node; break; case sfk_conversion: if (type && !same_type_p (type, optype)) ! cp_error ("operator `%T' declared to return `%T'", optype, type); else if (type) ! cp_pedwarn ("return type specified for `operator %T'", optype); type = optype; break; default: ! my_friendly_abort (20000408); break; } --- 9620,9646 ---- { case sfk_constructor: if (type) ! error ("return type specification for constructor invalid"); type = void_type_node; break; case sfk_destructor: if (type) ! error ("return type specification for destructor invalid"); type = void_type_node; break; case sfk_conversion: if (type && !same_type_p (type, optype)) ! error ("operator `%T' declared to return `%T'", optype, type); else if (type) ! pedwarn ("return type specified for `operator %T'", optype); type = optype; break; default: ! abort (); break; } *************** check_special_function_return_type (sfk, *** 9526,9533 **** BITFIELD for a field with specified width. INITIALIZED is 1 if the decl has an initializer. ! ATTRLIST is a TREE_LIST node with prefix attributes in TREE_VALUE and ! normal attributes in TREE_PURPOSE, or NULL_TREE. In the TYPENAME case, DECLARATOR is really an abstract declarator. It may also be so in the PARM case, for a prototype where the --- 9674,9682 ---- BITFIELD for a field with specified width. INITIALIZED is 1 if the decl has an initializer. ! ATTRLIST is a pointer to the list of attributes, which may be NULL ! if there are none; *ATTRLIST may be modified if attributes from inside ! the declarator should be applied to the declaration. In the TYPENAME case, DECLARATOR is really an abstract declarator. It may also be so in the PARM case, for a prototype where the *************** grokdeclarator (declarator, declspecs, d *** 9565,9585 **** tree declarator; enum decl_context decl_context; int initialized; ! tree attrlist; { RID_BIT_TYPE specbits; int nclasses = 0; tree spec; tree type = NULL_TREE; int longlong = 0; - int constp; - int restrictp; - int volatilep; int type_quals; int virtualp, explicitp, friendp, inlinep, staticp; int explicit_int = 0; int explicit_char = 0; int defaulted_int = 0; tree typedef_decl = NULL_TREE; const char *name; tree typedef_type = NULL_TREE; --- 9714,9734 ---- tree declarator; enum decl_context decl_context; int initialized; ! tree *attrlist; { RID_BIT_TYPE specbits; int nclasses = 0; tree spec; tree type = NULL_TREE; int longlong = 0; int type_quals; int virtualp, explicitp, friendp, inlinep, staticp; int explicit_int = 0; int explicit_char = 0; int defaulted_int = 0; + int extern_langp = 0; + tree dependant_name = NULL_TREE; + tree typedef_decl = NULL_TREE; const char *name; tree typedef_type = NULL_TREE; *************** grokdeclarator (declarator, declspecs, d *** 9588,9594 **** int bitfield = 0; #if 0 /* See the code below that used this. */ ! tree decl_machine_attr = NULL_TREE; #endif /* Set this to error_mark_node for FIELD_DECLs we could not handle properly. All FIELD_DECLs we build here have `init' put into their DECL_INITIAL. */ --- 9737,9743 ---- int bitfield = 0; #if 0 /* See the code below that used this. */ ! tree decl_attr = NULL_TREE; #endif /* Set this to error_mark_node for FIELD_DECLs we could not handle properly. All FIELD_DECLs we build here have `init' put into their DECL_INITIAL. */ *************** grokdeclarator (declarator, declspecs, d *** 9607,9614 **** tree raises = NULL_TREE; int template_count = 0; tree in_namespace = NULL_TREE; ! tree inner_attrs; ! int ignore_attrs; RIDBIT_RESET_ALL (specbits); if (decl_context == FUNCDEF) --- 9756,9762 ---- tree raises = NULL_TREE; int template_count = 0; tree in_namespace = NULL_TREE; ! tree returned_attrs = NULL_TREE; RIDBIT_RESET_ALL (specbits); if (decl_context == FUNCDEF) *************** grokdeclarator (declarator, declspecs, d *** 9674,9680 **** if (rename) { ! cp_error ("destructor `%T' must match class name `%T'", name, rename); TREE_OPERAND (decl, 0) = rename; } --- 9822,9828 ---- if (rename) { ! error ("destructor `%T' must match class name `%T'", name, rename); TREE_OPERAND (decl, 0) = rename; } *************** grokdeclarator (declarator, declspecs, d *** 9699,9722 **** cp_finish_decl so we can get the variable initialized... */ ! tree attributes, prefix_attributes; *next = TREE_OPERAND (decl, 0); init = CALL_DECLARATOR_PARMS (decl); if (attrlist) { ! attributes = TREE_PURPOSE (attrlist); ! prefix_attributes = TREE_VALUE (attrlist); } else { attributes = NULL_TREE; - prefix_attributes = NULL_TREE; } decl = start_decl (declarator, declspecs, 1, ! attributes, prefix_attributes); decl_type_access_control (decl); if (decl) { --- 9847,9868 ---- cp_finish_decl so we can get the variable initialized... */ ! tree attributes; *next = TREE_OPERAND (decl, 0); init = CALL_DECLARATOR_PARMS (decl); if (attrlist) { ! attributes = *attrlist; } else { attributes = NULL_TREE; } decl = start_decl (declarator, declspecs, 1, ! attributes, NULL_TREE); decl_type_access_control (decl); if (decl) { *************** grokdeclarator (declarator, declspecs, d *** 9726,9732 **** finish_decl (decl, init, NULL_TREE); } else ! cp_error ("invalid declarator"); return 0; } innermost_code = TREE_CODE (decl); --- 9872,9878 ---- finish_decl (decl, init, NULL_TREE); } else ! error ("invalid declarator"); return 0; } innermost_code = TREE_CODE (decl); *************** grokdeclarator (declarator, declspecs, d *** 9779,9785 **** if (C_IS_RESERVED_WORD (dname)) { ! cp_error ("declarator-id missing; using reserved word `%D'", dname); name = IDENTIFIER_POINTER (dname); } --- 9925,9931 ---- if (C_IS_RESERVED_WORD (dname)) { ! error ("declarator-id missing; using reserved word `%D'", dname); name = IDENTIFIER_POINTER (dname); } *************** grokdeclarator (declarator, declspecs, d *** 9823,9833 **** else if (TREE_CODE (cname) == TEMPLATE_TYPE_PARM || TREE_CODE (cname) == BOUND_TEMPLATE_TEMPLATE_PARM) { ! cp_error ("`%T::%D' is not a valid declarator", cname, ! TREE_OPERAND (decl, 1)); ! cp_error (" perhaps you want `typename %T::%D' to make it a type", ! cname, TREE_OPERAND (decl, 1)); ! return void_type_node; } else if (ctype == NULL_TREE) ctype = cname; --- 9969,9978 ---- else if (TREE_CODE (cname) == TEMPLATE_TYPE_PARM || TREE_CODE (cname) == BOUND_TEMPLATE_TEMPLATE_PARM) { ! /* This might be declaring a member of a template ! parm to be a friend. */ ! ctype = cname; ! dependant_name = TREE_OPERAND (decl, 1); } else if (ctype == NULL_TREE) ctype = cname; *************** grokdeclarator (declarator, declspecs, d *** 9837,9843 **** { if (! UNIQUELY_DERIVED_FROM_P (cname, ctype)) { ! cp_error ("type `%T' is not derived from type `%T'", cname, ctype); TREE_OPERAND (decl, 0) = NULL_TREE; } --- 9982,9988 ---- { if (! UNIQUELY_DERIVED_FROM_P (cname, ctype)) { ! error ("type `%T' is not derived from type `%T'", cname, ctype); TREE_OPERAND (decl, 0) = NULL_TREE; } *************** grokdeclarator (declarator, declspecs, d *** 9883,9891 **** case TYPE_DECL: /* Parse error puts this typespec where a declarator should go. */ ! cp_error ("`%T' specified as declarator-id", DECL_NAME (decl)); if (TREE_TYPE (decl) == current_class_type) ! cp_error (" perhaps you want `%T' for a constructor", current_class_name); dname = DECL_NAME (decl); name = IDENTIFIER_POINTER (dname); --- 10028,10036 ---- case TYPE_DECL: /* Parse error puts this typespec where a declarator should go. */ ! error ("`%T' specified as declarator-id", DECL_NAME (decl)); if (TREE_TYPE (decl) == current_class_type) ! error (" perhaps you want `%T' for a constructor", current_class_name); dname = DECL_NAME (decl); name = IDENTIFIER_POINTER (dname); *************** grokdeclarator (declarator, declspecs, d *** 9899,9906 **** break; default: ! cp_compiler_error ("`%D' as declarator", decl); ! return 0; /* We used to do a 155 abort here. */ } } } --- 10044,10050 ---- break; default: ! internal_error ("`%D' as declarator", decl); } } } *************** grokdeclarator (declarator, declspecs, d *** 9915,9921 **** && innermost_code != CALL_EXPR && ! (ctype && declspecs == NULL_TREE)) { ! cp_error ("declaration of `%D' as non-function", dname); return void_type_node; } --- 10059,10065 ---- && innermost_code != CALL_EXPR && ! (ctype && declspecs == NULL_TREE)) { ! error ("declaration of `%D' as non-function", dname); return void_type_node; } *************** grokdeclarator (declarator, declspecs, d *** 9974,9979 **** --- 10118,10131 ---- id = TREE_VALUE (spec); + /* If the entire declaration is itself tagged as deprecated then + suppress reports of deprecated items. */ + if (!adding_implicit_members && id && TREE_DEPRECATED (id)) + { + if (deprecated_state != DEPRECATED_SUPPRESS) + warn_deprecated_use (id); + } + if (TREE_CODE (id) == IDENTIFIER_NODE) { if (id == ridpointers[(int) RID_INT] *************** grokdeclarator (declarator, declspecs, d *** 9986,9992 **** if (id == ridpointers[(int) RID_BOOL]) error ("`bool' is now a keyword"); else ! cp_error ("extraneous `%T' ignored", id); } else { --- 10138,10144 ---- if (id == ridpointers[(int) RID_BOOL]) error ("`bool' is now a keyword"); else ! error ("extraneous `%T' ignored", id); } else { *************** grokdeclarator (declarator, declspecs, d *** 10002,10008 **** if (IDENTIFIER_HAS_TYPE_VALUE (id)) { if (type) ! cp_error ("multiple declarations `%T' and `%T'", type, id); else type = IDENTIFIER_TYPE_VALUE (id); goto found; --- 10154,10160 ---- if (IDENTIFIER_HAS_TYPE_VALUE (id)) { if (type) ! error ("multiple declarations `%T' and `%T'", type, id); else type = IDENTIFIER_TYPE_VALUE (id); goto found; *************** grokdeclarator (declarator, declspecs, d *** 10023,10043 **** } else if (RIDBIT_SETP (i, specbits)) pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id)); RIDBIT_SET (i, specbits); goto found; } } } - /* C++ aggregate types. */ else if (TREE_CODE (id) == TYPE_DECL) { if (type) ! cp_error ("multiple declarations `%T' and `%T'", type, TREE_TYPE (id)); else { type = TREE_TYPE (id); TREE_VALUE (spec) = type; } goto found; } --- 10175,10199 ---- } else if (RIDBIT_SETP (i, specbits)) pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id)); + if (i == (int)RID_EXTERN + && TREE_PURPOSE (spec) == error_mark_node) + /* This extern was part of a language linkage. */ + extern_langp = 1; RIDBIT_SET (i, specbits); goto found; } } } else if (TREE_CODE (id) == TYPE_DECL) { if (type) ! error ("multiple declarations `%T' and `%T'", type, TREE_TYPE (id)); else { type = TREE_TYPE (id); TREE_VALUE (spec) = type; + typedef_decl = id; } goto found; } *************** grokdeclarator (declarator, declspecs, d *** 10052,10061 **** else { type = TREE_TYPE (t); - #if 0 - /* See the code below that used this. */ - decl_machine_attr = DECL_MACHINE_ATTRIBUTES (id); - #endif typedef_decl = t; } } --- 10208,10213 ---- *************** grokdeclarator (declarator, declspecs, d *** 10066,10071 **** --- 10218,10228 ---- found: ; } + #if 0 + /* See the code below that used this. */ + if (typedef_decl) + decl_attr = DECL_ATTRIBUTES (typedef_decl); + #endif typedef_type = type; /* No type at all: default to `int', and set DEFAULTED_INT *************** grokdeclarator (declarator, declspecs, d *** 10091,10101 **** explicit_int = -1; ! /* We handle `main' specially here, because 'main () { }' is so ! common. With no options, it is allowed. With -Wreturn-type, ! it is a warning. It is only an error with -pedantic-errors. */ is_main = (funcdef_flag ! && MAIN_NAME_P (dname) && ctype == NULL_TREE && in_namespace == NULL_TREE && current_namespace == global_namespace); --- 10248,10258 ---- explicit_int = -1; ! /* We handle `main' specially here, because 'main () { }' is so ! common. With no options, it is allowed. With -Wreturn-type, ! it is a warning. It is only an error with -pedantic-errors. */ is_main = (funcdef_flag ! && dname && MAIN_NAME_P (dname) && ctype == NULL_TREE && in_namespace == NULL_TREE && current_namespace == global_namespace); *************** grokdeclarator (declarator, declspecs, d *** 10103,10116 **** if (in_system_header || flag_ms_extensions) /* Allow it, sigh. */; else if (pedantic || ! is_main) ! cp_pedwarn ("ISO C++ forbids declaration of `%s' with no type", name); else if (warn_return_type) ! cp_warning ("ISO C++ forbids declaration of `%s' with no type", name); type = integer_type_node; } ctype = NULL_TREE; --- 10260,10288 ---- if (in_system_header || flag_ms_extensions) /* Allow it, sigh. */; else if (pedantic || ! is_main) ! pedwarn ("ISO C++ forbids declaration of `%s' with no type", name); else if (warn_return_type) ! warning ("ISO C++ forbids declaration of `%s' with no type", name); type = integer_type_node; } + + if (type && IMPLICIT_TYPENAME_P (type)) + { + /* The implicit typename extension is deprecated and will be + removed. Warn about its use now. */ + warning ("`%T' is implicitly a typename", type); + cp_deprecated ("implicit typename"); + + /* Now remove its implicitness, so that we don't warn again. + For instance this might be a typedef, and we do not want to + warn on uses of the typedef itself. Simply clearing the + TREE_TYPE is insufficient. */ + type = copy_node (type); + TREE_TYPE (type) = NULL_TREE; + } ctype = NULL_TREE; *************** grokdeclarator (declarator, declspecs, d *** 10124,10130 **** { RIDBIT_RESET (RID_LONG, specbits); type = build_qualified_type (long_double_type_node, ! CP_TYPE_QUALS (type)); } /* Check all other uses of type modifiers. */ --- 10296,10302 ---- { RIDBIT_RESET (RID_LONG, specbits); type = build_qualified_type (long_double_type_node, ! cp_type_quals (type)); } /* Check all other uses of type modifiers. */ *************** grokdeclarator (declarator, declspecs, d *** 10254,10279 **** type = build_complex_type (type); } ! if (sfk == sfk_conversion ! && (RIDBIT_SETP (RID_CONST, specbits) ! || RIDBIT_SETP (RID_VOLATILE, specbits) ! || RIDBIT_SETP (RID_RESTRICT, specbits))) ! cp_error ("qualifiers are not allowed on declaration of `operator %T'", ctor_return_type); ! /* Set CONSTP if this declaration is `const', whether by ! explicit specification or via a typedef. ! Likewise for VOLATILEP. */ ! ! constp = !! RIDBIT_SETP (RID_CONST, specbits) + CP_TYPE_CONST_P (type); ! restrictp = ! !! RIDBIT_SETP (RID_RESTRICT, specbits) + CP_TYPE_RESTRICT_P (type); ! volatilep = ! !! RIDBIT_SETP (RID_VOLATILE, specbits) + CP_TYPE_VOLATILE_P (type); ! type_quals = ((constp ? TYPE_QUAL_CONST : 0) ! | (restrictp ? TYPE_QUAL_RESTRICT : 0) ! | (volatilep ? TYPE_QUAL_VOLATILE : 0)); ! type = cp_build_qualified_type (type, type_quals); staticp = 0; inlinep = !! RIDBIT_SETP (RID_INLINE, specbits); virtualp = RIDBIT_SETP (RID_VIRTUAL, specbits); --- 10426,10449 ---- type = build_complex_type (type); } ! type_quals = TYPE_UNQUALIFIED; ! if (RIDBIT_SETP (RID_CONST, specbits)) ! type_quals |= TYPE_QUAL_CONST; ! if (RIDBIT_SETP (RID_VOLATILE, specbits)) ! type_quals |= TYPE_QUAL_VOLATILE; ! if (RIDBIT_SETP (RID_RESTRICT, specbits)) ! type_quals |= TYPE_QUAL_RESTRICT; ! if (sfk == sfk_conversion && type_quals != TYPE_UNQUALIFIED) ! error ("qualifiers are not allowed on declaration of `operator %T'", ctor_return_type); ! type_quals |= cp_type_quals (type); ! type = cp_build_qualified_type_real ! (type, type_quals, ((typedef_decl && !DECL_ARTIFICIAL (typedef_decl) ! ? tf_ignore_bad_quals : 0) | tf_error | tf_warning)); ! /* We might have ignored or rejected some of the qualifiers. */ ! type_quals = cp_type_quals (type); ! staticp = 0; inlinep = !! RIDBIT_SETP (RID_INLINE, specbits); virtualp = RIDBIT_SETP (RID_VIRTUAL, specbits); *************** grokdeclarator (declarator, declspecs, d *** 10286,10304 **** if (virtualp && staticp == 2) { ! cp_error ("member `%D' cannot be declared both virtual and static", dname); staticp = 0; } friendp = RIDBIT_SETP (RID_FRIEND, specbits); RIDBIT_RESET (RID_FRIEND, specbits); /* Warn if two storage classes are given. Default to `auto'. */ if (RIDBIT_ANY_SET (specbits)) { if (RIDBIT_SETP (RID_STATIC, specbits)) nclasses++; ! if (RIDBIT_SETP (RID_EXTERN, specbits)) nclasses++; if (decl_context == PARM && nclasses > 0) error ("storage class specifiers invalid in parameter declarations"); if (RIDBIT_SETP (RID_TYPEDEF, specbits)) --- 10456,10480 ---- if (virtualp && staticp == 2) { ! error ("member `%D' cannot be declared both virtual and static", dname); staticp = 0; } friendp = RIDBIT_SETP (RID_FRIEND, specbits); RIDBIT_RESET (RID_FRIEND, specbits); + if (dependant_name && !friendp) + { + error ("`%T::%D' is not a valid declarator", ctype, dependant_name); + return void_type_node; + } + /* Warn if two storage classes are given. Default to `auto'. */ if (RIDBIT_ANY_SET (specbits)) { if (RIDBIT_SETP (RID_STATIC, specbits)) nclasses++; ! if (RIDBIT_SETP (RID_EXTERN, specbits) && !extern_langp) nclasses++; if (decl_context == PARM && nclasses > 0) error ("storage class specifiers invalid in parameter declarations"); if (RIDBIT_SETP (RID_TYPEDEF, specbits)) *************** grokdeclarator (declarator, declspecs, d *** 10309,10314 **** --- 10485,10492 ---- } if (RIDBIT_SETP (RID_AUTO, specbits)) nclasses++; if (RIDBIT_SETP (RID_REGISTER, specbits)) nclasses++; + if (!nclasses && !friendp && extern_langp) + nclasses++; } /* Give error if `virtual' is used outside of class declaration. */ *************** grokdeclarator (declarator, declspecs, d *** 10413,10421 **** Descend through it, creating more complex types, until we reach the declared identifier (or NULL_TREE, in an absolute declarator). */ - inner_attrs = NULL_TREE; - ignore_attrs = 0; - while (declarator && TREE_CODE (declarator) != IDENTIFIER_NODE && TREE_CODE (declarator) != TEMPLATE_ID_EXPR) { --- 10591,10596 ---- *************** grokdeclarator (declarator, declspecs, d *** 10464,10491 **** } } - /* See the comment for the TREE_LIST case, below. */ - if (ignore_attrs) - ignore_attrs = 0; - else if (inner_attrs) - { - decl_attributes (type, inner_attrs, NULL_TREE); - inner_attrs = NULL_TREE; - } - switch (TREE_CODE (declarator)) { case TREE_LIST: { /* We encode a declarator with embedded attributes using ! a TREE_LIST. The attributes apply to the declarator ! directly inside them, so we have to skip an iteration ! before applying them to the type. If the declarator just ! inside is the declarator-id, we apply the attrs to the ! decl itself. */ ! inner_attrs = TREE_PURPOSE (declarator); ! ignore_attrs = 1; declarator = TREE_VALUE (declarator); } break; --- 10639,10670 ---- } } switch (TREE_CODE (declarator)) { case TREE_LIST: { /* We encode a declarator with embedded attributes using ! a TREE_LIST. */ ! tree attrs = TREE_PURPOSE (declarator); ! tree inner_decl; ! int attr_flags; ! declarator = TREE_VALUE (declarator); + inner_decl = declarator; + while (inner_decl != NULL_TREE + && TREE_CODE (inner_decl) == TREE_LIST) + inner_decl = TREE_VALUE (inner_decl); + attr_flags = 0; + if (inner_decl == NULL_TREE + || TREE_CODE (inner_decl) == IDENTIFIER_NODE) + attr_flags |= (int) ATTR_FLAG_DECL_NEXT; + if (TREE_CODE (inner_decl) == CALL_EXPR) + attr_flags |= (int) ATTR_FLAG_FUNCTION_NEXT; + if (TREE_CODE (inner_decl) == ARRAY_REF) + attr_flags |= (int) ATTR_FLAG_ARRAY_NEXT; + returned_attrs = decl_attributes (&type, + chainon (returned_attrs, attrs), + attr_flags); } break; *************** grokdeclarator (declarator, declspecs, d *** 10510,10516 **** && TYPE_DOMAIN (type) != NULL_TREE && !TREE_CONSTANT (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))) { ! cp_error ("size of member `%D' is not constant", dname); /* Proceed with arbitrary constant size, so that offset computations don't get confused. */ type = create_array_type_for_decl (dname, TREE_TYPE (type), --- 10689,10695 ---- && TYPE_DOMAIN (type) != NULL_TREE && !TREE_CONSTANT (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))) { ! error ("size of member `%D' is not constant", dname); /* Proceed with arbitrary constant size, so that offset computations don't get confused. */ type = create_array_type_for_decl (dname, TREE_TYPE (type), *************** grokdeclarator (declarator, declspecs, d *** 10592,10598 **** error ("destructor cannot be static member function"); if (quals) { ! cp_error ("destructors may not be `%s'", IDENTIFIER_POINTER (TREE_VALUE (quals))); quals = NULL_TREE; } --- 10771,10777 ---- error ("destructor cannot be static member function"); if (quals) { ! error ("destructors may not be `%s'", IDENTIFIER_POINTER (TREE_VALUE (quals))); quals = NULL_TREE; } *************** grokdeclarator (declarator, declspecs, d *** 10621,10627 **** } if (quals) { ! cp_error ("constructors may not be `%s'", IDENTIFIER_POINTER (TREE_VALUE (quals))); quals = NULL_TREE; } --- 10800,10806 ---- } if (quals) { ! error ("constructors may not be `%s'", IDENTIFIER_POINTER (TREE_VALUE (quals))); quals = NULL_TREE; } *************** grokdeclarator (declarator, declspecs, d *** 10661,10667 **** if (decl_context == NORMAL) error ("friend declaration not in class definition"); if (current_function_decl && funcdef_flag) ! cp_error ("can't define friend function `%s' in a local class definition", name); } --- 10840,10846 ---- if (decl_context == NORMAL) error ("friend declaration not in class definition"); if (current_function_decl && funcdef_flag) ! error ("can't define friend function `%s' in a local class definition", name); } *************** grokdeclarator (declarator, declspecs, d *** 10685,10691 **** if (arg_types != void_list_node) { ! cp_error ("destructors may not have parameters"); arg_types = void_list_node; last_function_parms = NULL_TREE; } --- 10864,10870 ---- if (arg_types != void_list_node) { ! error ("destructors may not have parameters"); arg_types = void_list_node; last_function_parms = NULL_TREE; } *************** grokdeclarator (declarator, declspecs, d *** 10726,10732 **** && (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE || TREE_CODE (TREE_TYPE (type)) == REFERENCE_TYPE)) { ! cp_error ("cannot declare pointer to `%#T' member", TREE_TYPE (type)); type = TREE_TYPE (type); } --- 10905,10911 ---- && (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE || TREE_CODE (TREE_TYPE (type)) == REFERENCE_TYPE)) { ! error ("cannot declare pointer to `%#T' member", TREE_TYPE (type)); type = TREE_TYPE (type); } *************** grokdeclarator (declarator, declspecs, d *** 10757,10777 **** { register tree typemodlist; int erred = 0; ! ! constp = 0; ! volatilep = 0; ! restrictp = 0; for (typemodlist = TREE_TYPE (declarator); typemodlist; typemodlist = TREE_CHAIN (typemodlist)) { tree qualifier = TREE_VALUE (typemodlist); if (qualifier == ridpointers[(int) RID_CONST]) ! constp++; else if (qualifier == ridpointers[(int) RID_VOLATILE]) ! volatilep++; else if (qualifier == ridpointers[(int) RID_RESTRICT]) ! restrictp++; else if (!erred) { erred = 1; --- 10936,10965 ---- { register tree typemodlist; int erred = 0; ! int constp = 0; ! int volatilep = 0; ! int restrictp = 0; ! for (typemodlist = TREE_TYPE (declarator); typemodlist; typemodlist = TREE_CHAIN (typemodlist)) { tree qualifier = TREE_VALUE (typemodlist); if (qualifier == ridpointers[(int) RID_CONST]) ! { ! constp++; ! type_quals |= TYPE_QUAL_CONST; ! } else if (qualifier == ridpointers[(int) RID_VOLATILE]) ! { ! volatilep++; ! type_quals |= TYPE_QUAL_VOLATILE; ! } else if (qualifier == ridpointers[(int) RID_RESTRICT]) ! { ! restrictp++; ! type_quals |= TYPE_QUAL_RESTRICT; ! } else if (!erred) { erred = 1; *************** grokdeclarator (declarator, declspecs, d *** 10784,10803 **** pedwarn ("duplicate `volatile'"); if (restrictp > 1) pedwarn ("duplicate `restrict'"); - - type_quals = ((constp ? TYPE_QUAL_CONST : 0) - | (restrictp ? TYPE_QUAL_RESTRICT : 0) - | (volatilep ? TYPE_QUAL_VOLATILE : 0)); - if (TREE_CODE (declarator) == ADDR_EXPR - && (constp || volatilep)) - { - if (constp) - pedwarn ("discarding `const' applied to a reference"); - if (volatilep) - pedwarn ("discarding `volatile' applied to a reference"); - type_quals &= ~(TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE); - } type = cp_build_qualified_type (type, type_quals); } declarator = TREE_OPERAND (declarator, 0); ctype = NULL_TREE; --- 10972,10979 ---- pedwarn ("duplicate `volatile'"); if (restrictp > 1) pedwarn ("duplicate `restrict'"); type = cp_build_qualified_type (type, type_quals); + type_quals = cp_type_quals (type); } declarator = TREE_OPERAND (declarator, 0); ctype = NULL_TREE; *************** grokdeclarator (declarator, declspecs, d *** 10841,10847 **** && uses_template_parms (current_class_type)) { tree args = current_template_args (); ! type = tsubst (type, args, /*complain=*/1, NULL_TREE); } /* This pop_nested_class corresponds to the --- 11017,11024 ---- && uses_template_parms (current_class_type)) { tree args = current_template_args (); ! type = tsubst (type, args, tf_error | tf_warning, ! NULL_TREE); } /* This pop_nested_class corresponds to the *************** grokdeclarator (declarator, declspecs, d *** 10852,10858 **** TREE_COMPLEXITY (declarator) = current_class_depth; } else ! my_friendly_abort (16); if (TREE_OPERAND (declarator, 0) == NULL_TREE) { --- 11029,11035 ---- TREE_COMPLEXITY (declarator) = current_class_depth; } else ! abort (); if (TREE_OPERAND (declarator, 0) == NULL_TREE) { *************** grokdeclarator (declarator, declspecs, d *** 10905,10911 **** Is this ill-formed? */ if (pedantic) ! cp_pedwarn ("extra qualification `%T::' on member `%s' ignored", ctype, name); } else if (TREE_CODE (type) == FUNCTION_TYPE) --- 11082,11088 ---- Is this ill-formed? */ if (pedantic) ! pedwarn ("extra qualification `%T::' on member `%s' ignored", ctype, name); } else if (TREE_CODE (type) == FUNCTION_TYPE) *************** grokdeclarator (declarator, declspecs, d *** 10915,10921 **** TYPE_ARG_TYPES (type)); else { ! cp_error ("cannot declare member function `%T::%s' within `%T'", ctype, name, current_class_type); return void_type_node; } --- 11092,11098 ---- TYPE_ARG_TYPES (type)); else { ! error ("cannot declare member function `%T::%s' within `%T'", ctype, name, current_class_type); return void_type_node; } *************** grokdeclarator (declarator, declspecs, d *** 10930,10936 **** if (current_class_type) { ! cp_error ("cannot declare member `%T::%s' within `%T'", ctype, name, current_class_type); return void_type_node; } --- 11107,11113 ---- if (current_class_type) { ! error ("cannot declare member `%T::%s' within `%T'", ctype, name, current_class_type); return void_type_node; } *************** grokdeclarator (declarator, declspecs, d *** 10945,10951 **** declarator = sname; } else if (TREE_CODE (sname) == SCOPE_REF) ! my_friendly_abort (17); else { done_scoping: --- 11122,11128 ---- declarator = sname; } else if (TREE_CODE (sname) == SCOPE_REF) ! abort (); else { done_scoping: *************** grokdeclarator (declarator, declspecs, d *** 10980,11002 **** break; default: ! my_friendly_abort (158); } } ! /* See the comment for the TREE_LIST case, above. */ ! if (inner_attrs) { ! if (! ignore_attrs) ! decl_attributes (type, inner_attrs, NULL_TREE); ! else if (attrlist) ! TREE_VALUE (attrlist) = chainon (inner_attrs, TREE_VALUE (attrlist)); else ! attrlist = build_tree_list (NULL_TREE, inner_attrs); } /* Now TYPE has the actual type. */ if (explicitp == 1 || (explicitp && friendp)) { /* [dcl.fct.spec] The explicit specifier shall only be used in --- 11157,11188 ---- break; default: ! abort (); } } ! if (returned_attrs) { ! if (attrlist) ! *attrlist = chainon (returned_attrs, *attrlist); else ! attrlist = &returned_attrs; } /* Now TYPE has the actual type. */ + /* Did array size calculations overflow? */ + + if (TREE_CODE (type) == ARRAY_TYPE + && COMPLETE_TYPE_P (type) + && TREE_OVERFLOW (TYPE_SIZE (type))) + { + error ("size of array `%s' is too large", name); + /* If we proceed with the array type as it is, we'll eventually + crash in tree_low_cst(). */ + type = error_mark_node; + } + if (explicitp == 1 || (explicitp && friendp)) { /* [dcl.fct.spec] The explicit specifier shall only be used in *************** grokdeclarator (declarator, declspecs, d *** 11031,11037 **** else if (type_quals & TYPE_QUAL_CONST) { error ("const `%s' cannot be declared `mutable'", name); ! RIDBIT_RESET (RID_MUTABLE, specbits); } } --- 11217,11223 ---- else if (type_quals & TYPE_QUAL_CONST) { error ("const `%s' cannot be declared `mutable'", name); ! RIDBIT_RESET (RID_MUTABLE, specbits); } } *************** grokdeclarator (declarator, declspecs, d *** 11043,11054 **** /* OK */; else if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR) { ! cp_error ("template-id `%D' used as a declarator", declarator); declarator = dname; } else /* Unexpected declarator format. */ ! my_friendly_abort (990210); /* If this is declaring a typedef name, return a TYPE_DECL. */ --- 11229,11240 ---- /* OK */; else if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR) { ! error ("template-id `%D' used as a declarator", declarator); declarator = dname; } else /* Unexpected declarator format. */ ! abort (); /* If this is declaring a typedef name, return a TYPE_DECL. */ *************** grokdeclarator (declarator, declspecs, d *** 11064,11070 **** if (decl_context == FIELD) { if (declarator == constructor_name (current_class_type)) ! cp_pedwarn ("ISO C++ forbids nested type `%D' with same name as enclosing class", declarator); decl = build_lang_decl (TYPE_DECL, declarator, type); } --- 11250,11256 ---- if (decl_context == FIELD) { if (declarator == constructor_name (current_class_type)) ! pedwarn ("ISO C++ forbids nested type `%D' with same name as enclosing class", declarator); decl = build_lang_decl (TYPE_DECL, declarator, type); } *************** grokdeclarator (declarator, declspecs, d *** 11084,11090 **** && TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL && TYPE_ANONYMOUS_P (type) ! && CP_TYPE_QUALS (type) == TYPE_UNQUALIFIED) { tree oldname = TYPE_NAME (type); tree t; --- 11270,11278 ---- && TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL && TYPE_ANONYMOUS_P (type) ! /* Don't do this if there are attributes. */ ! && (!attrlist || !*attrlist) ! && cp_type_quals (type) == TYPE_UNQUALIFIED) { tree oldname = TYPE_NAME (type); tree t; *************** grokdeclarator (declarator, declspecs, d *** 11142,11156 **** /* Detect the case of an array type of unspecified size which came, as such, direct from a typedef name. ! We must copy the type, so that each identifier gets ! a distinct type, so that each identifier's size can be ! controlled separately by its own initializer. */ ! if (type == typedef_type && TREE_CODE (type) == ARRAY_TYPE ! && TYPE_DOMAIN (type) == NULL_TREE) ! { ! type = build_cplus_array_type (TREE_TYPE (type), TYPE_DOMAIN (type)); ! } /* Detect where we're using a typedef of function type to declare a function. last_function_parms will not be set, so we must create --- 11330,11342 ---- /* Detect the case of an array type of unspecified size which came, as such, direct from a typedef name. ! We must copy the type, so that the array's domain can be ! individually set by the object's initializer. */ ! if (type && typedef_type ! && TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type) ! && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (typedef_type)) ! type = build_cplus_array_type (TREE_TYPE (type), NULL_TREE); /* Detect where we're using a typedef of function type to declare a function. last_function_parms will not be set, so we must create *************** grokdeclarator (declarator, declspecs, d *** 11187,11198 **** { if (type_quals != TYPE_UNQUALIFIED) { ! cp_error ("type qualifiers specified for friend class declaration"); type_quals = TYPE_UNQUALIFIED; } if (inlinep) { ! cp_error ("`inline' specified for friend class declaration"); inlinep = 0; } --- 11373,11384 ---- { if (type_quals != TYPE_UNQUALIFIED) { ! error ("type qualifiers specified for friend class declaration"); type_quals = TYPE_UNQUALIFIED; } if (inlinep) { ! error ("`inline' specified for friend class declaration"); inlinep = 0; } *************** grokdeclarator (declarator, declspecs, d *** 11202,11215 **** || IMPLICIT_TYPENAME_P (type))) { if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) ! cp_pedwarn ("template parameters cannot be friends"); else if (TREE_CODE (type) == TYPENAME_TYPE) ! cp_pedwarn ("\ friend declaration requires class-key, i.e. `friend class %T::%T'", constructor_name (current_class_type), TYPE_IDENTIFIER (type)); else ! cp_pedwarn ("\ friend declaration requires class-key, i.e. `friend %#T'", type); } --- 11388,11401 ---- || IMPLICIT_TYPENAME_P (type))) { if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) ! pedwarn ("template parameters cannot be friends"); else if (TREE_CODE (type) == TYPENAME_TYPE) ! pedwarn ("\ friend declaration requires class-key, i.e. `friend class %T::%T'", constructor_name (current_class_type), TYPE_IDENTIFIER (type)); else ! pedwarn ("\ friend declaration requires class-key, i.e. `friend %#T'", type); } *************** friend declaration requires class-key, i *** 11223,11229 **** if (current_class_type) make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type)); else ! cp_error ("trying to make class `%T' a friend of global scope", type); type = void_type_node; --- 11409,11415 ---- if (current_class_type) make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type)); else ! error ("trying to make class `%T' a friend of global scope", type); type = void_type_node; *************** friend declaration requires class-key, i *** 11234,11240 **** if (ctype == NULL_TREE) { if (TREE_CODE (type) != METHOD_TYPE) ! cp_error ("invalid qualifiers on non-member function type"); else ctype = TYPE_METHOD_BASETYPE (type); } --- 11420,11426 ---- if (ctype == NULL_TREE) { if (TREE_CODE (type) != METHOD_TYPE) ! error ("invalid qualifiers on non-member function type"); else ctype = TYPE_METHOD_BASETYPE (type); } *************** friend declaration requires class-key, i *** 11253,11259 **** && TREE_CODE (type) != UNION_TYPE && ! bitfield) { ! cp_error ("abstract declarator `%T' used as declaration", type); declarator = make_anon_name (); } --- 11439,11445 ---- && TREE_CODE (type) != UNION_TYPE && ! bitfield) { ! error ("abstract declarator `%T' used as declaration", type); declarator = make_anon_name (); } *************** friend declaration requires class-key, i *** 11269,11275 **** else if (TREE_CODE (declarator) == IDENTIFIER_NODE) { if (IDENTIFIER_OPNAME_P (declarator)) ! my_friendly_abort (356); else error ("variable or field `%s' declared void", name); } --- 11455,11461 ---- else if (TREE_CODE (declarator) == IDENTIFIER_NODE) { if (IDENTIFIER_OPNAME_P (declarator)) ! abort (); else error ("variable or field `%s' declared void", name); } *************** friend declaration requires class-key, i *** 11330,11336 **** else if (in_namespace && !friendp) { /* Something like struct S { int N::j; }; */ ! cp_error ("invalid use of `::'"); decl = NULL_TREE; } else if (TREE_CODE (type) == FUNCTION_TYPE) --- 11516,11522 ---- else if (in_namespace && !friendp) { /* Something like struct S { int N::j; }; */ ! error ("invalid use of `::'"); decl = NULL_TREE; } else if (TREE_CODE (type) == FUNCTION_TYPE) *************** friend declaration requires class-key, i *** 11342,11348 **** typedefs. */ if (friendp && declarator == ridpointers[(int) RID_SIGNED]) { ! cp_error ("function `%D' cannot be declared friend", declarator); friendp = 0; } --- 11528,11534 ---- typedefs. */ if (friendp && declarator == ridpointers[(int) RID_SIGNED]) { ! error ("function `%D' cannot be declared friend", declarator); friendp = 0; } *************** friend declaration requires class-key, i *** 11354,11360 **** if (ctype == NULL_TREE) { ! cp_error ("can't make `%D' into a method -- not in a class", declarator); return void_type_node; } --- 11540,11546 ---- if (ctype == NULL_TREE) { ! error ("can't make `%D' into a method -- not in a class", declarator); return void_type_node; } *************** friend declaration requires class-key, i *** 11363,11369 **** ARM 9.5 */ if (virtualp && TREE_CODE (ctype) == UNION_TYPE) { ! cp_error ("function `%D' declared virtual inside a union", declarator); return void_type_node; } --- 11549,11555 ---- ARM 9.5 */ if (virtualp && TREE_CODE (ctype) == UNION_TYPE) { ! error ("function `%D' declared virtual inside a union", declarator); return void_type_node; } *************** friend declaration requires class-key, i *** 11375,11381 **** { if (virtualp) { ! cp_error ("`%D' cannot be declared virtual, since it is always static", declarator); virtualp = 0; } --- 11561,11567 ---- { if (virtualp) { ! error ("`%D' cannot be declared virtual, since it is always static", declarator); virtualp = 0; } *************** friend declaration requires class-key, i *** 11401,11408 **** return decl; #if 0 /* This clobbers the attrs stored in `decl' from `attrlist'. */ ! /* The decl and setting of decl_machine_attr is also turned off. */ ! decl = build_decl_attribute_variant (decl, decl_machine_attr); #endif /* [class.conv.ctor] --- 11587,11594 ---- return decl; #if 0 /* This clobbers the attrs stored in `decl' from `attrlist'. */ ! /* The decl and setting of decl_attr is also turned off. */ ! decl = build_decl_attribute_variant (decl, decl_attr); #endif /* [class.conv.ctor] *************** friend declaration requires class-key, i *** 11448,11456 **** && (TREE_CODE (type) != ARRAY_TYPE || initialized == 0)) { if (declarator) ! cp_error ("field `%D' has incomplete type", declarator); else ! cp_error ("name `%T' has incomplete type", type); /* If we're instantiating a template, tell them which instantiation made the field's type be incomplete. */ --- 11634,11642 ---- && (TREE_CODE (type) != ARRAY_TYPE || initialized == 0)) { if (declarator) ! error ("field `%D' has incomplete type", declarator); else ! error ("name `%T' has incomplete type", type); /* If we're instantiating a template, tell them which instantiation made the field's type be incomplete. */ *************** friend declaration requires class-key, i *** 11459,11465 **** && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (current_class_type)) && declspecs && TREE_VALUE (declspecs) && TREE_TYPE (TREE_VALUE (declspecs)) == type) ! cp_error (" in instantiation of template `%T'", current_class_type); type = error_mark_node; --- 11645,11651 ---- && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (current_class_type)) && declspecs && TREE_VALUE (declspecs) && TREE_TYPE (TREE_VALUE (declspecs)) == type) ! error (" in instantiation of template `%T'", current_class_type); type = error_mark_node; *************** friend declaration requires class-key, i *** 11481,11510 **** /* Friends are treated specially. */ if (ctype == current_class_type) warning ("member functions are implicitly friends of their class"); ! else ! { ! tree t = NULL_TREE; ! if (decl && DECL_NAME (decl)) ! { ! if (template_class_depth (current_class_type) == 0) ! { ! decl ! = check_explicit_specialization ! (declarator, decl, ! template_count, 2 * (funcdef_flag != 0) + 4); ! if (decl == error_mark_node) ! return error_mark_node; ! } ! ! t = do_friend (ctype, declarator, decl, ! last_function_parms, attrlist, flags, quals, ! funcdef_flag); ! } ! if (t && funcdef_flag) ! return t; ! ! return void_type_node; ! } } /* Structure field. It may not be a function, except for C++ */ --- 11667,11696 ---- /* Friends are treated specially. */ if (ctype == current_class_type) warning ("member functions are implicitly friends of their class"); ! else ! { ! tree t = NULL_TREE; ! if (decl && DECL_NAME (decl)) ! { ! if (template_class_depth (current_class_type) == 0) ! { ! decl ! = check_explicit_specialization ! (declarator, decl, ! template_count, 2 * (funcdef_flag != 0) + 4); ! if (decl == error_mark_node) ! return error_mark_node; ! } ! ! t = do_friend (ctype, declarator, decl, ! last_function_parms, *attrlist, ! flags, quals, funcdef_flag); ! } ! if (t && funcdef_flag) ! return t; ! ! return void_type_node; ! } } /* Structure field. It may not be a function, except for C++ */ *************** friend declaration requires class-key, i *** 11527,11535 **** the rest of the compiler does not correctly handle the initialization unless the member is static so we make it static below. */ ! cp_pedwarn ("ISO C++ forbids initialization of member `%D'", declarator); ! cp_pedwarn ("making `%D' static", declarator); staticp = 1; } --- 11713,11721 ---- the rest of the compiler does not correctly handle the initialization unless the member is static so we make it static below. */ ! pedwarn ("ISO C++ forbids initialization of member `%D'", declarator); ! pedwarn ("making `%D' static", declarator); staticp = 1; } *************** friend declaration requires class-key, i *** 11553,11559 **** to change that in TC 1 so that they are allowed in classes with no user-defined constructors. */ && staticp) ! cp_pedwarn ("ISO C++ forbids static data member `%D' with same name as enclosing class", declarator); if (staticp) --- 11739,11745 ---- to change that in TC 1 so that they are allowed in classes with no user-defined constructors. */ && staticp) ! pedwarn ("ISO C++ forbids static data member `%D' with same name as enclosing class", declarator); if (staticp) *************** friend declaration requires class-key, i *** 11645,11651 **** declaring main to be static. */ if (TREE_CODE (type) == METHOD_TYPE) { ! cp_pedwarn ("cannot declare member function `%D' to have static linkage", decl); illegal_static = 1; } else if (current_function_decl) --- 11831,11837 ---- declaring main to be static. */ if (TREE_CODE (type) == METHOD_TYPE) { ! pedwarn ("cannot declare member function `%D' to have static linkage", decl); illegal_static = 1; } else if (current_function_decl) *************** friend declaration requires class-key, i *** 11679,11696 **** DECL_CONTEXT (decl) = ctype; if (staticp == 1) { ! cp_pedwarn ("static member `%D' re-declared as static", decl); staticp = 0; RIDBIT_RESET (RID_STATIC, specbits); } if (RIDBIT_SETP (RID_REGISTER, specbits) && TREE_STATIC (decl)) { ! cp_error ("static member `%D' declared `register'", decl); RIDBIT_RESET (RID_REGISTER, specbits); } if (RIDBIT_SETP (RID_EXTERN, specbits) && pedantic) { ! cp_pedwarn ("cannot explicitly declare member `%#D' to have extern linkage", decl); RIDBIT_RESET (RID_EXTERN, specbits); } --- 11865,11882 ---- DECL_CONTEXT (decl) = ctype; if (staticp == 1) { ! pedwarn ("`static' may not be used when defining (as opposed to declaring) a static data member"); staticp = 0; RIDBIT_RESET (RID_STATIC, specbits); } if (RIDBIT_SETP (RID_REGISTER, specbits) && TREE_STATIC (decl)) { ! error ("static member `%D' declared `register'", decl); RIDBIT_RESET (RID_REGISTER, specbits); } if (RIDBIT_SETP (RID_EXTERN, specbits) && pedantic) { ! pedwarn ("cannot explicitly declare member `%#D' to have extern linkage", decl); RIDBIT_RESET (RID_EXTERN, specbits); } *************** check_default_argument (decl, arg) *** 11862,11871 **** || !can_convert_arg (decl_type, TREE_TYPE (arg), arg)) { if (decl) ! cp_error ("default argument for `%#D' has type `%T'", decl, TREE_TYPE (arg)); else ! cp_error ("default argument for parameter of type `%T' has type `%T'", decl_type, TREE_TYPE (arg)); return error_mark_node; --- 12048,12057 ---- || !can_convert_arg (decl_type, TREE_TYPE (arg), arg)) { if (decl) ! error ("default argument for `%#D' has type `%T'", decl, TREE_TYPE (arg)); else ! error ("default argument for parameter of type `%T' has type `%T'", decl_type, TREE_TYPE (arg)); return error_mark_node; *************** check_default_argument (decl, arg) *** 11882,11888 **** NULL); if (var) { ! cp_error ("default argument `%E' uses local variable `%D'", arg, var); return error_mark_node; } --- 12068,12074 ---- NULL); if (var) { ! error ("default argument `%E' uses local variable `%D'", arg, var); return error_mark_node; } *************** grokparms (first_parm) *** 11916,11923 **** for (parm = first_parm; parm != NULL_TREE; parm = chain) { tree type = NULL_TREE; ! register tree decl = TREE_VALUE (parm); tree init = TREE_PURPOSE (parm); chain = TREE_CHAIN (parm); /* @@ weak defense against parse errors. */ --- 12102,12110 ---- for (parm = first_parm; parm != NULL_TREE; parm = chain) { tree type = NULL_TREE; ! tree decl = TREE_VALUE (parm); tree init = TREE_PURPOSE (parm); + tree specs, attrs; chain = TREE_CHAIN (parm); /* @@ weak defense against parse errors. */ *************** grokparms (first_parm) *** 11926,11932 **** { /* Give various messages as the need arises. */ if (TREE_CODE (decl) == STRING_CST) ! cp_error ("invalid string constant `%E'", decl); else if (TREE_CODE (decl) == INTEGER_CST) error ("invalid integer constant in parameter list, did you forget to give parameter name?"); continue; --- 12113,12119 ---- { /* Give various messages as the need arises. */ if (TREE_CODE (decl) == STRING_CST) ! error ("invalid string constant `%E'", decl); else if (TREE_CODE (decl) == INTEGER_CST) error ("invalid integer constant in parameter list, did you forget to give parameter name?"); continue; *************** grokparms (first_parm) *** 11935,11945 **** if (parm == void_list_node) break; ! decl = grokdeclarator (TREE_VALUE (decl), TREE_PURPOSE (decl), ! PARM, init != NULL_TREE, NULL_TREE); if (! decl || TREE_TYPE (decl) == error_mark_node) continue; type = TREE_TYPE (decl); if (VOID_TYPE_P (type)) { --- 12122,12136 ---- if (parm == void_list_node) break; ! split_specs_attrs (TREE_PURPOSE (decl), &specs, &attrs); ! decl = grokdeclarator (TREE_VALUE (decl), specs, ! PARM, init != NULL_TREE, &attrs); if (! decl || TREE_TYPE (decl) == error_mark_node) continue; + if (attrs) + cplus_decl_attributes (&decl, attrs, 0); + type = TREE_TYPE (decl); if (VOID_TYPE_P (type)) { *************** grokparms (first_parm) *** 11962,11974 **** type = TYPE_MAIN_VARIANT (type); if (TREE_CODE (type) == METHOD_TYPE) { ! cp_error ("parameter `%D' invalidly declared method type", decl); type = build_pointer_type (type); TREE_TYPE (decl) = type; } else if (TREE_CODE (type) == OFFSET_TYPE) { ! cp_error ("parameter `%D' invalidly declared offset type", decl); type = build_pointer_type (type); TREE_TYPE (decl) = type; } --- 12153,12165 ---- type = TYPE_MAIN_VARIANT (type); if (TREE_CODE (type) == METHOD_TYPE) { ! error ("parameter `%D' invalidly declared method type", decl); type = build_pointer_type (type); TREE_TYPE (decl) = type; } else if (TREE_CODE (type) == OFFSET_TYPE) { ! error ("parameter `%D' invalidly declared offset type", decl); type = build_pointer_type (type); TREE_TYPE (decl) = type; } *************** grokparms (first_parm) *** 11992,11998 **** t = TREE_TYPE (t); } if (TREE_CODE (t) == ARRAY_TYPE) ! cp_error ("parameter `%D' includes %s to array of unknown bound `%T'", decl, ptr ? "pointer" : "reference", t); } --- 12183,12189 ---- t = TREE_TYPE (t); } if (TREE_CODE (t) == ARRAY_TYPE) ! error ("parameter `%D' includes %s to array of unknown bound `%T'", decl, ptr ? "pointer" : "reference", t); } *************** grokparms (first_parm) *** 12021,12110 **** } ! /* D is a constructor or overloaded `operator='. Returns non-zero if ! D's arguments allow it to be a copy constructor, or copy assignment operator. */ int ! copy_args_p (d) tree d; { ! tree t; ! if (!DECL_FUNCTION_MEMBER_P (d)) return 0; ! t = FUNCTION_FIRST_USER_PARMTYPE (d); ! if (t && TREE_CODE (TREE_VALUE (t)) == REFERENCE_TYPE ! && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (t))) ! == DECL_CONTEXT (d)) ! && (TREE_CHAIN (t) == NULL_TREE ! || TREE_CHAIN (t) == void_list_node ! || TREE_PURPOSE (TREE_CHAIN (t)))) ! return 1; ! return 0; ! } ! /* These memoizing functions keep track of special properties which ! a class may have. `grok_ctor_properties' notices whether a class ! has a constructor of the form X(X&), and also complains ! if the class has a constructor of the form X(X). ! `grok_op_properties' takes notice of the various forms of ! operator= which are defined, as well as what sorts of type conversion ! may apply. Both functions take a FUNCTION_DECL as an argument. */ ! int ! grok_ctor_properties (ctype, decl) ! tree ctype, decl; ! { ! tree parmtypes = FUNCTION_FIRST_USER_PARMTYPE (decl); ! tree parmtype = parmtypes ? TREE_VALUE (parmtypes) : void_type_node; ! /* [class.copy] ! A non-template constructor for class X is a copy constructor if ! its first parameter is of type X&, const X&, volatile X& or const ! volatile X&, and either there are no other parameters or else all ! other parameters have default arguments. */ ! if (TREE_CODE (parmtype) == REFERENCE_TYPE ! && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == ctype ! && sufficient_parms_p (TREE_CHAIN (parmtypes)) ! && !(DECL_TEMPLATE_INSTANTIATION (decl) ! && is_member_template (DECL_TI_TEMPLATE (decl)))) { ! TYPE_HAS_INIT_REF (ctype) = 1; ! if (CP_TYPE_CONST_P (TREE_TYPE (parmtype))) ! TYPE_HAS_CONST_INIT_REF (ctype) = 1; } ! /* [class.copy] ! A declaration of a constructor for a class X is ill-formed if its ! first parameter is of type (optionally cv-qualified) X and either ! there are no other parameters or else all other parameters have ! default arguments. ! We *don't* complain about member template instantiations that ! have this form, though; they can occur as we try to decide what ! constructor to use during overload resolution. Since overload ! resolution will never prefer such a constructor to the ! non-template copy constructor (which is either explicitly or ! implicitly defined), there's no need to worry about their ! existence. Theoretically, they should never even be ! instantiated, but that's hard to forestall. */ ! else if (TYPE_MAIN_VARIANT (parmtype) == ctype ! && sufficient_parms_p (TREE_CHAIN (parmtypes)) ! && !(DECL_TEMPLATE_INSTANTIATION (decl) ! && is_member_template (DECL_TI_TEMPLATE (decl)))) { ! cp_error ("invalid constructor; you probably meant `%T (const %T&)'", ctype, ctype); SET_IDENTIFIER_ERROR_LOCUS (DECL_NAME (decl), ctype); return 0; } ! else if (TREE_CODE (parmtype) == VOID_TYPE ! || TREE_PURPOSE (parmtypes) != NULL_TREE) ! TYPE_HAS_DEFAULT_CONSTRUCTOR (ctype) = 1; ! return 1; } --- 12212,12361 ---- } ! /* D is a constructor or overloaded `operator='. ! ! Let T be the class in which D is declared. Then, this function ! returns: ! ! -1 if D's is an ill-formed constructor or copy assignment operator ! whose first parameter is of type `T'. ! 0 if D is not a copy constructor or copy assignment ! operator. ! 1 if D is a copy constructor or copy assignment operator whose ! first parameter is a reference to const qualified T. ! 2 if D is a copy constructor or copy assignment operator whose ! first parameter is a reference to non-const qualified T. ! ! This function can be used as a predicate. Positive values indicate ! a copy constructor and non-zero values indicate a copy assignment operator. */ int ! copy_fn_p (d) tree d; { ! tree args; ! tree arg_type; ! int result = 1; ! ! my_friendly_assert (DECL_FUNCTION_MEMBER_P (d), 20011208); ! if (DECL_TEMPLATE_INFO (d) && is_member_template (DECL_TI_TEMPLATE (d))) ! /* Instantiations of template member functions are never copy ! functions. Note that member functions of templated classes are ! represented as template functions internally, and we must ! accept those as copy functions. */ ! return 0; ! ! args = FUNCTION_FIRST_USER_PARMTYPE (d); ! if (!args) return 0; ! arg_type = TREE_VALUE (args); ! if (TYPE_MAIN_VARIANT (arg_type) == DECL_CONTEXT (d)) ! { ! /* Pass by value copy assignment operator. */ ! result = -1; ! } ! else if (TREE_CODE (arg_type) == REFERENCE_TYPE ! && TYPE_MAIN_VARIANT (TREE_TYPE (arg_type)) == DECL_CONTEXT (d)) ! { ! if (CP_TYPE_CONST_P (TREE_TYPE (arg_type))) ! result = 2; ! } ! else ! return 0; ! ! args = TREE_CHAIN (args); ! if (args && args != void_list_node && !TREE_PURPOSE (args)) ! /* There are more non-optional args. */ ! return 0; ! return result; ! } ! /* Remember any special properties of member function DECL. */ ! ! void grok_special_member_properties (decl) ! tree decl; ! { ! if (!DECL_NONSTATIC_MEMBER_FUNCTION_P(decl)) ! ; /* Not special. */ ! else if (DECL_CONSTRUCTOR_P (decl)) { ! int ctor = copy_fn_p (decl); ! ! if (ctor > 0) ! { ! /* [class.copy] ! ! A non-template constructor for class X is a copy ! constructor if its first parameter is of type X&, const ! X&, volatile X& or const volatile X&, and either there ! are no other parameters or else all other parameters have ! default arguments. */ ! TYPE_HAS_INIT_REF (DECL_CONTEXT (decl)) = 1; ! if (ctor > 1) ! TYPE_HAS_CONST_INIT_REF (DECL_CONTEXT (decl)) = 1; ! } ! else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl))) ! TYPE_HAS_DEFAULT_CONSTRUCTOR (DECL_CONTEXT (decl)) = 1; } ! else if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR) ! { ! /* [class.copy] ! ! A non-template assignment operator for class X is a copy ! assignment operator if its parameter is of type X, X&, const ! X&, volatile X& or const volatile X&. */ ! ! int assop = copy_fn_p (decl); ! ! if (assop) ! { ! TYPE_HAS_ASSIGN_REF (DECL_CONTEXT (decl)) = 1; ! if (assop != 1) ! TYPE_HAS_CONST_ASSIGN_REF (DECL_CONTEXT (decl)) = 1; ! if (DECL_PURE_VIRTUAL_P (decl)) ! TYPE_HAS_ABSTRACT_ASSIGN_REF (DECL_CONTEXT (decl)) = 1; ! } ! } ! } ! /* Check a constructor DECL has the correct form. Complains ! if the class has a constructor of the form X(X). */ ! int ! grok_ctor_properties (ctype, decl) ! tree ctype, decl; ! { ! int ctor_parm = copy_fn_p (decl); ! ! if (ctor_parm < 0) { ! /* [class.copy] ! ! A declaration of a constructor for a class X is ill-formed if ! its first parameter is of type (optionally cv-qualified) X ! and either there are no other parameters or else all other ! parameters have default arguments. ! ! We *don't* complain about member template instantiations that ! have this form, though; they can occur as we try to decide ! what constructor to use during overload resolution. Since ! overload resolution will never prefer such a constructor to ! the non-template copy constructor (which is either explicitly ! or implicitly defined), there's no need to worry about their ! existence. Theoretically, they should never even be ! instantiated, but that's hard to forestall. */ ! error ("invalid constructor; you probably meant `%T (const %T&)'", ctype, ctype); SET_IDENTIFIER_ERROR_LOCUS (DECL_NAME (decl), ctype); return 0; } ! return 1; } *************** unary_op_p (code) *** 12137,12145 **** /* Do a little sanity-checking on how they declared their operator. */ void ! grok_op_properties (decl, virtualp, friendp) tree decl; ! int virtualp, friendp; { tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl)); tree argtype; --- 12388,12396 ---- /* Do a little sanity-checking on how they declared their operator. */ void ! grok_op_properties (decl, friendp) tree decl; ! int friendp; { tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl)); tree argtype; *************** grok_op_properties (decl, virtualp, frie *** 12165,12176 **** #define DEF_OPERATOR(NAME, CODE, MANGLING, ARITY, ASSN_P) \ if (ansi_opname (CODE) == name) \ { \ ! operator_code = CODE; \ break; \ } \ else if (ansi_assopname (CODE) == name) \ { \ ! operator_code = CODE; \ DECL_ASSIGNMENT_OPERATOR_P (decl) = 1; \ break; \ } --- 12416,12427 ---- #define DEF_OPERATOR(NAME, CODE, MANGLING, ARITY, ASSN_P) \ if (ansi_opname (CODE) == name) \ { \ ! operator_code = (CODE); \ break; \ } \ else if (ansi_assopname (CODE) == name) \ { \ ! operator_code = (CODE); \ DECL_ASSIGNMENT_OPERATOR_P (decl) = 1; \ break; \ } *************** grok_op_properties (decl, virtualp, frie *** 12178,12184 **** #include "operators.def" #undef DEF_OPERATOR ! my_friendly_abort (20000527); } while (0); my_friendly_assert (operator_code != LAST_CPLUS_TREE_CODE, 20000526); --- 12429,12435 ---- #include "operators.def" #undef DEF_OPERATOR ! abort (); } while (0); my_friendly_assert (operator_code != LAST_CPLUS_TREE_CODE, 20000526); *************** grok_op_properties (decl, virtualp, frie *** 12250,12262 **** || operator_code == COMPONENT_REF || operator_code == ARRAY_REF || operator_code == NOP_EXPR) ! cp_error ("`%D' must be a nonstatic member function", decl); else { tree p = argtypes; if (DECL_STATIC_FUNCTION_P (decl)) ! cp_error ("`%D' must be either a non-static member function or a non-member function", decl); if (p) for (; TREE_CODE (TREE_VALUE (p)) != VOID_TYPE ; p = TREE_CHAIN (p)) --- 12501,12513 ---- || operator_code == COMPONENT_REF || operator_code == ARRAY_REF || operator_code == NOP_EXPR) ! error ("`%D' must be a nonstatic member function", decl); else { tree p = argtypes; if (DECL_STATIC_FUNCTION_P (decl)) ! error ("`%D' must be either a non-static member function or a non-member function", decl); if (p) for (; TREE_CODE (TREE_VALUE (p)) != VOID_TYPE ; p = TREE_CHAIN (p)) *************** grok_op_properties (decl, virtualp, frie *** 12272,12278 **** || TREE_CODE (arg) == BOUND_TEMPLATE_TEMPLATE_PARM) goto foundaggr; } ! cp_error ("`%D' must have an argument of class or enumerated type", decl); foundaggr: --- 12523,12529 ---- || TREE_CODE (arg) == BOUND_TEMPLATE_TEMPLATE_PARM) goto foundaggr; } ! error ("`%D' must have an argument of class or enumerated type", decl); foundaggr: *************** grok_op_properties (decl, virtualp, frie *** 12309,12348 **** ref ? "a reference to " : "", what); } } ! ! if (DECL_ASSIGNMENT_OPERATOR_P (decl) ! && operator_code == NOP_EXPR) ! { ! tree parmtype; ! ! if (arity != 2 && methodp) ! { ! cp_error ("`%D' must take exactly one argument", decl); ! return; ! } ! parmtype = TREE_VALUE (TREE_CHAIN (argtypes)); ! ! /* [class.copy] ! ! A user-declared copy assignment operator X::operator= is ! a non-static non-template member function of class X with ! exactly one parameter of type X, X&, const X&, volatile ! X& or const volatile X&. */ ! if (copy_assignment_arg_p (parmtype, virtualp) ! && !(DECL_TEMPLATE_INSTANTIATION (decl) ! && is_member_template (DECL_TI_TEMPLATE (decl))) ! && ! friendp) ! { ! TYPE_HAS_ASSIGN_REF (current_class_type) = 1; ! if (TREE_CODE (parmtype) != REFERENCE_TYPE ! || CP_TYPE_CONST_P (TREE_TYPE (parmtype))) ! TYPE_HAS_CONST_ASSIGN_REF (current_class_type) = 1; ! } ! } ! else if (operator_code == COND_EXPR) { /* 13.4.0.3 */ ! cp_error ("ISO C++ prohibits overloading operator ?:"); } else if (ambi_op_p (operator_code)) { --- 12560,12569 ---- ref ? "a reference to " : "", what); } } ! if (operator_code == COND_EXPR) { /* 13.4.0.3 */ ! error ("ISO C++ prohibits overloading operator ?:"); } else if (ambi_op_p (operator_code)) { *************** grok_op_properties (decl, virtualp, frie *** 12381,12387 **** break; default: ! my_friendly_abort (20000527); } SET_OVERLOADED_OPERATOR_CODE (decl, operator_code); --- 12602,12608 ---- break; default: ! abort (); } SET_OVERLOADED_OPERATOR_CODE (decl, operator_code); *************** grok_op_properties (decl, virtualp, frie *** 12392,12401 **** && ! same_type_p (TREE_VALUE (TREE_CHAIN (argtypes)), integer_type_node)) { if (methodp) ! cp_error ("postfix `%D' must take `int' as its argument", decl); else ! cp_error ("postfix `%D' must take `int' as its second argument", decl); } --- 12613,12622 ---- && ! same_type_p (TREE_VALUE (TREE_CHAIN (argtypes)), integer_type_node)) { if (methodp) ! error ("postfix `%D' must take `int' as its argument", decl); else ! error ("postfix `%D' must take `int' as its second argument", decl); } *************** grok_op_properties (decl, virtualp, frie *** 12403,12411 **** else { if (methodp) ! cp_error ("`%D' must take either zero or one argument", decl); else ! cp_error ("`%D' must take either one or two arguments", decl); } /* More Effective C++ rule 6. */ --- 12624,12632 ---- else { if (methodp) ! error ("`%D' must take either zero or one argument", decl); else ! error ("`%D' must take either one or two arguments", decl); } /* More Effective C++ rule 6. */ *************** grok_op_properties (decl, virtualp, frie *** 12426,12438 **** if (TREE_CODE (ret) != REFERENCE_TYPE || !same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (ret)), arg)) ! cp_warning ("prefix `%D' should return `%T'", decl, build_reference_type (arg)); } else { if (!same_type_p (TYPE_MAIN_VARIANT (ret), arg)) ! cp_warning ("postfix `%D' should return `%T'", decl, arg); } } } --- 12647,12659 ---- if (TREE_CODE (ret) != REFERENCE_TYPE || !same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (ret)), arg)) ! warning ("prefix `%D' should return `%T'", decl, build_reference_type (arg)); } else { if (!same_type_p (TYPE_MAIN_VARIANT (ret), arg)) ! warning ("postfix `%D' should return `%T'", decl, arg); } } } *************** grok_op_properties (decl, virtualp, frie *** 12441,12449 **** if (arity != 1) { if (methodp) ! cp_error ("`%D' must take `void'", decl); else ! cp_error ("`%D' must take exactly one argument", decl); } } else /* if (binary_op_p (operator_code)) */ --- 12662,12670 ---- if (arity != 1) { if (methodp) ! error ("`%D' must take `void'", decl); else ! error ("`%D' must take exactly one argument", decl); } } else /* if (binary_op_p (operator_code)) */ *************** grok_op_properties (decl, virtualp, frie *** 12451,12459 **** if (arity != 2) { if (methodp) ! cp_error ("`%D' must take exactly one argument", decl); else ! cp_error ("`%D' must take exactly two arguments", decl); } /* More Effective C++ rule 7. */ --- 12672,12680 ---- if (arity != 2) { if (methodp) ! error ("`%D' must take exactly one argument", decl); else ! error ("`%D' must take exactly two arguments", decl); } /* More Effective C++ rule 7. */ *************** grok_op_properties (decl, virtualp, frie *** 12461,12481 **** && (operator_code == TRUTH_ANDIF_EXPR || operator_code == TRUTH_ORIF_EXPR || operator_code == COMPOUND_EXPR)) ! cp_warning ("user-defined `%D' always evaluates both arguments", decl); } /* Effective C++ rule 23. */ if (warn_ecpp && arity == 2 && (operator_code == PLUS_EXPR || operator_code == MINUS_EXPR || operator_code == TRUNC_DIV_EXPR ! || operator_code == MULT_EXPR) && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == REFERENCE_TYPE) ! cp_warning ("`%D' should return by value", decl); ! /* 13.4.0.8 */ for (; argtypes && argtypes != void_list_node; argtypes = TREE_CHAIN (argtypes)) if (TREE_PURPOSE (argtypes)) --- 12682,12704 ---- && (operator_code == TRUTH_ANDIF_EXPR || operator_code == TRUTH_ORIF_EXPR || operator_code == COMPOUND_EXPR)) ! warning ("user-defined `%D' always evaluates both arguments", decl); } /* Effective C++ rule 23. */ if (warn_ecpp && arity == 2 + && !DECL_ASSIGNMENT_OPERATOR_P (decl) && (operator_code == PLUS_EXPR || operator_code == MINUS_EXPR || operator_code == TRUNC_DIV_EXPR ! || operator_code == MULT_EXPR ! || operator_code == TRUNC_MOD_EXPR) && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == REFERENCE_TYPE) ! warning ("`%D' should return by value", decl); ! /* [over.oper]/8 */ for (; argtypes && argtypes != void_list_node; argtypes = TREE_CHAIN (argtypes)) if (TREE_PURPOSE (argtypes)) *************** grok_op_properties (decl, virtualp, frie *** 12485,12494 **** || operator_code == POSTDECREMENT_EXPR) { if (pedantic) ! cp_pedwarn ("`%D' cannot have default arguments", decl); } else ! cp_error ("`%D' cannot have default arguments", decl); } } --- 12708,12717 ---- || operator_code == POSTDECREMENT_EXPR) { if (pedantic) ! pedwarn ("`%D' cannot have default arguments", decl); } else ! error ("`%D' cannot have default arguments", decl); } } *************** tag_name (code) *** 12509,12515 **** case enum_type: return "enum"; default: ! my_friendly_abort (981122); } } --- 12732,12738 ---- case enum_type: return "enum"; default: ! abort (); } } *************** xref_tag (code_type_node, name, globaliz *** 12533,12539 **** enum tree_code code; register tree ref, t; struct binding_level *b = current_binding_level; - int got_type = 0; tree attributes = NULL_TREE; tree context = NULL_TREE; --- 12756,12761 ---- *************** xref_tag (code_type_node, name, globaliz *** 12561,12567 **** code = ENUMERAL_TYPE; break; default: ! my_friendly_abort (18); } /* If a cross reference is requested, look up the type --- 12783,12789 ---- code = ENUMERAL_TYPE; break; default: ! abort (); } /* If a cross reference is requested, look up the type *************** xref_tag (code_type_node, name, globaliz *** 12570,12576 **** { t = name; name = TYPE_IDENTIFIER (t); - got_type = 1; } else t = IDENTIFIER_TYPE_VALUE (name); --- 12792,12797 ---- *************** xref_tag (code_type_node, name, globaliz *** 12579,12594 **** if (t && globalize && TREE_CODE (t) == TYPENAME_TYPE) { static int explained; ! cp_warning ("`%s %T' declares a new type at namespace scope;\n\ ! to refer to the inherited type, say `%s %T::%T'%s", ! tag_name (tag_code), name, tag_name (tag_code), ! constructor_name (current_class_type), TYPE_IDENTIFIER (t), ! (!explained ? "\n\ ! (names from dependent base classes are not visible to unqualified name lookup)" ! : "")); ! explained = 1; } if (t && TREE_CODE (t) != code && TREE_CODE (t) != TEMPLATE_TYPE_PARM --- 12800,12825 ---- if (t && globalize && TREE_CODE (t) == TYPENAME_TYPE) { static int explained; + tree shadowed; ! warning ("`%s %T' declares a new type at namespace scope", ! tag_name (tag_code), name); ! if (!explained++) ! warning (" names from dependent base classes are not visible to unqualified name lookup - to refer to the inherited type, say `%s %T::%T'", ! tag_name (tag_code), ! constructor_name (current_class_type), ! TYPE_IDENTIFIER (t)); ! /* We need to remove the class scope binding for the ! TYPENAME_TYPE as otherwise poplevel_class gets confused. */ ! for (shadowed = b->class_shadowed; ! shadowed; ! shadowed = TREE_CHAIN (shadowed)) ! if (TREE_TYPE (shadowed) == TYPE_NAME (t)) ! { ! TREE_PURPOSE (shadowed) = NULL_TREE; ! break; ! } } if (t && TREE_CODE (t) != code && TREE_CODE (t) != TEMPLATE_TYPE_PARM *************** to refer to the inherited type, say `%s *** 12605,12622 **** { if (t) { /* [dcl.type.elab] If the identifier resolves to a typedef-name or a template type-parameter, the elaborated-type-specifier is ill-formed. */ ! if (t != TYPE_MAIN_VARIANT (t) ! || (CLASS_TYPE_P (t) && TYPE_WAS_ANONYMOUS (t))) ! cp_pedwarn ("using typedef-name `%D' after `%s'", ! TYPE_NAME (t), tag_name (tag_code)); else if (TREE_CODE (t) == TEMPLATE_TYPE_PARM) ! cp_error ("using template type parameter `%T' after `%s'", ! t, tag_name (tag_code)); ! ! ref = t; } else ref = lookup_tag (code, name, b, 0); --- 12836,12855 ---- { if (t) { + ref = follow_tag_typedef (t); + /* [dcl.type.elab] If the identifier resolves to a typedef-name or a template type-parameter, the elaborated-type-specifier is ill-formed. */ ! if (!ref) ! { ! pedwarn ("using typedef-name `%D' after `%s'", ! TYPE_NAME (t), tag_name (tag_code)); ! ref = t; ! } else if (TREE_CODE (t) == TEMPLATE_TYPE_PARM) ! error ("using template type parameter `%T' after `%s'", ! t, tag_name (tag_code)); } else ref = lookup_tag (code, name, b, 0); *************** to refer to the inherited type, say `%s *** 12695,12701 **** the forward-reference will be altered into a real type. */ if (code == ENUMERAL_TYPE) { ! cp_error ("use of enum `%#D' without previous declaration", name); ref = make_node (ENUMERAL_TYPE); --- 12928,12934 ---- the forward-reference will be altered into a real type. */ if (code == ENUMERAL_TYPE) { ! error ("use of enum `%#D' without previous declaration", name); ref = make_node (ENUMERAL_TYPE); *************** to refer to the inherited type, say `%s *** 12737,12756 **** redeclare_class_template (ref, current_template_parms); } ! /* Until the type is defined, tentatively accept whatever ! structure tag the user hands us. */ ! if (!COMPLETE_TYPE_P (ref) ! && ref != current_class_type ! /* Have to check this, in case we have contradictory tag info. */ ! && IS_AGGR_TYPE_CODE (TREE_CODE (ref))) ! { ! if (tag_code == class_type) ! CLASSTYPE_DECLARED_CLASS (ref) = 1; ! else if (tag_code == record_type) ! CLASSTYPE_DECLARED_CLASS (ref) = 0; ! } ! ! TREE_TYPE (ref) = attributes; return ref; } --- 12970,12976 ---- redeclare_class_template (ref, current_template_parms); } ! TYPE_ATTRIBUTES (ref) = attributes; return ref; } *************** xref_tag_from_type (old, id, globalize) *** 12783,12789 **** void xref_basetypes (code_type_node, name, ref, binfo) tree code_type_node; ! tree name, ref; tree binfo; { /* In the declaration `A : X, Y, ... Z' we mark all the types --- 13003,13010 ---- void xref_basetypes (code_type_node, name, ref, binfo) tree code_type_node; ! tree name ATTRIBUTE_UNUSED; ! tree ref; tree binfo; { /* In the declaration `A : X, Y, ... Z' we mark all the types *************** xref_basetypes (code_type_node, name, re *** 12805,12811 **** if (tag_code == union_type) { ! cp_error ("derived union `%T' invalid", ref); return; } --- 13026,13032 ---- if (tag_code == union_type) { ! error ("derived union `%T' invalid", ref); return; } *************** xref_basetypes (code_type_node, name, re *** 12849,12867 **** && TREE_CODE (basetype) != TEMPLATE_TYPE_PARM && TREE_CODE (basetype) != BOUND_TEMPLATE_TEMPLATE_PARM)) { ! cp_error ("base type `%T' fails to be a struct or class type", TREE_VALUE (binfo)); continue; } - GNU_xref_hier (name, basetype, via_public, via_virtual, 0); - /* This code replaces similar code in layout_basetypes. We put the complete_type first for implicit `typename'. */ if (!COMPLETE_TYPE_P (basetype) && ! (current_template_parms && uses_template_parms (basetype))) { ! cp_error ("base class `%T' has incomplete type", basetype); continue; } else --- 13070,13086 ---- && TREE_CODE (basetype) != TEMPLATE_TYPE_PARM && TREE_CODE (basetype) != BOUND_TEMPLATE_TEMPLATE_PARM)) { ! error ("base type `%T' fails to be a struct or class type", TREE_VALUE (binfo)); continue; } /* This code replaces similar code in layout_basetypes. We put the complete_type first for implicit `typename'. */ if (!COMPLETE_TYPE_P (basetype) && ! (current_template_parms && uses_template_parms (basetype))) { ! error ("base class `%T' has incomplete type", basetype); continue; } else *************** xref_basetypes (code_type_node, name, re *** 12869,12883 **** if (CLASSTYPE_MARKED (basetype)) { if (basetype == ref) ! cp_error ("recursive type `%T' undefined", basetype); else ! cp_error ("duplicate base type `%T' invalid", basetype); continue; } if (TYPE_FOR_JAVA (basetype) ! && (current_lang_stack ! == &VARRAY_TREE (current_lang_base, 0))) TYPE_FOR_JAVA (ref) = 1; /* Note that the BINFO records which describe individual --- 13088,13101 ---- if (CLASSTYPE_MARKED (basetype)) { if (basetype == ref) ! error ("recursive type `%T' undefined", basetype); else ! error ("duplicate base type `%T' invalid", basetype); continue; } if (TYPE_FOR_JAVA (basetype) ! && (current_lang_depth () == 0)) TYPE_FOR_JAVA (ref) = 1; /* Note that the BINFO records which describe individual *************** start_enum (name) *** 12983,12989 **** if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE) { ! cp_error ("multiple definition of `%#T'", enumtype); cp_error_at ("previous definition here", enumtype); /* Clear out TYPE_VALUES, and start again. */ TYPE_VALUES (enumtype) = NULL_TREE; --- 13201,13207 ---- if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE) { ! error ("multiple definition of `%#T'", enumtype); cp_error_at ("previous definition here", enumtype); /* Clear out TYPE_VALUES, and start again. */ TYPE_VALUES (enumtype) = NULL_TREE; *************** start_enum (name) *** 12994,13003 **** pushtag (name, enumtype, 0); } - if (current_class_type) - TREE_ADDRESSABLE (b->tags) = 1; - - GNU_xref_decl (current_function_decl, enumtype); return enumtype; } --- 13212,13217 ---- *************** finish_enum (enumtype) *** 13038,13043 **** --- 13252,13258 ---- if (scope && TREE_CODE (scope) == FUNCTION_DECL) add_stmt (build_min (TAG_DEFN, enumtype)); + return; } *************** build_enumerator (name, value, enumtype) *** 13158,13164 **** } else { ! cp_error ("enumerator value for `%D' not integer constant", name); value = NULL_TREE; } } --- 13373,13379 ---- } else { ! error ("enumerator value for `%D' not integer constant", name); value = NULL_TREE; } } *************** build_enumerator (name, value, enumtype) *** 13178,13184 **** integer_one_node); if (tree_int_cst_lt (value, prev_value)) ! cp_error ("overflow in enumeration values at `%D'", name); } else value = integer_zero_node; --- 13393,13399 ---- integer_one_node); if (tree_int_cst_lt (value, prev_value)) ! error ("overflow in enumeration values at `%D'", name); } else value = integer_zero_node; *************** build_enumerator (name, value, enumtype) *** 13242,13251 **** things like `S::i' later.) */ finish_member_declaration (decl); else ! { ! pushdecl (decl); ! GNU_xref_decl (current_function_decl, decl); ! } /* Add this enumeration constant to the list for this type. */ TYPE_VALUES (enumtype) = tree_cons (name, decl, TYPE_VALUES (enumtype)); --- 13457,13463 ---- things like `S::i' later.) */ finish_member_declaration (decl); else ! pushdecl (decl); /* Add this enumeration constant to the list for this type. */ TYPE_VALUES (enumtype) = tree_cons (name, decl, TYPE_VALUES (enumtype)); *************** check_function_type (decl, current_funct *** 13267,13273 **** if (!COMPLETE_OR_VOID_TYPE_P (return_type)) { ! cp_error ("return type `%#T' is incomplete", TREE_TYPE (fntype)); /* Make it return void instead, but don't change the type of the DECL_RESULT, in case we have a named return value. */ --- 13479,13485 ---- if (!COMPLETE_OR_VOID_TYPE_P (return_type)) { ! error ("return type `%#T' is incomplete", TREE_TYPE (fntype)); /* Make it return void instead, but don't change the type of the DECL_RESULT, in case we have a named return value. */ *************** start_function (declspecs, declarator, a *** 13363,13383 **** } last_function_parms = DECL_ARGUMENTS (decl1); - last_function_parm_tags = NULL_TREE; } else { ! decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL_TREE); /* If the declarator is not suitable for a function definition, cause a syntax error. */ ! if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) return 0; fntype = TREE_TYPE (decl1); restype = TREE_TYPE (fntype); if (CLASS_TYPE_P (restype) && !CLASSTYPE_GOT_SEMICOLON (restype)) { ! cp_error ("semicolon missing after declaration of `%#T'", restype); shadow_tag (build_tree_list (NULL_TREE, restype)); CLASSTYPE_GOT_SEMICOLON (restype) = 1; if (TREE_CODE (fntype) == FUNCTION_TYPE) --- 13575,13601 ---- } last_function_parms = DECL_ARGUMENTS (decl1); } else { ! decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL); /* If the declarator is not suitable for a function definition, cause a syntax error. */ ! if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) ! return 0; ! ! cplus_decl_attributes (&decl1, attrs, 0); ! ! /* If #pragma weak was used, mark the decl weak now. */ ! if (current_binding_level == global_binding_level) ! maybe_apply_pragma_weak (decl1); fntype = TREE_TYPE (decl1); restype = TREE_TYPE (fntype); if (CLASS_TYPE_P (restype) && !CLASSTYPE_GOT_SEMICOLON (restype)) { ! error ("semicolon missing after declaration of `%#T'", restype); shadow_tag (build_tree_list (NULL_TREE, restype)); CLASSTYPE_GOT_SEMICOLON (restype) = 1; if (TREE_CODE (fntype) == FUNCTION_TYPE) *************** start_function (declspecs, declarator, a *** 13404,13409 **** --- 13622,13632 ---- } } + if (DECL_DECLARED_INLINE_P (decl1) + && lookup_attribute ("noinline", attrs)) + warning_with_decl (decl1, + "inline function `%s' given attribute noinline"); + if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl1)) /* This is a constructor, we must ensure that any default args introduced by this definition are propagated to the clones *************** start_function (declspecs, declarator, a *** 13446,13462 **** if (warn_ecpp && DECL_OVERLOADED_OPERATOR_P (decl1) == NOP_EXPR && TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE) ! cp_warning ("`operator=' should return a reference to `*this'"); /* Make the init_value nonzero so pushdecl knows this is not tentative. error_mark_node is replaced below (in poplevel) with the BLOCK. */ if (!DECL_INITIAL (decl1)) DECL_INITIAL (decl1) = error_mark_node; - #ifdef SET_DEFAULT_DECL_ATTRIBUTES - SET_DEFAULT_DECL_ATTRIBUTES (decl1, attrs); - #endif - /* This function exists in static storage. (This does not mean `static' in the C sense!) */ TREE_STATIC (decl1) = 1; --- 13669,13681 ---- if (warn_ecpp && DECL_OVERLOADED_OPERATOR_P (decl1) == NOP_EXPR && TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE) ! warning ("`operator=' should return a reference to `*this'"); /* Make the init_value nonzero so pushdecl knows this is not tentative. error_mark_node is replaced below (in poplevel) with the BLOCK. */ if (!DECL_INITIAL (decl1)) DECL_INITIAL (decl1) = error_mark_node; /* This function exists in static storage. (This does not mean `static' in the C sense!) */ TREE_STATIC (decl1) = 1; *************** start_function (declspecs, declarator, a *** 13474,13480 **** /* Save the parm names or decls from this function's declarator where store_parm_decls will find them. */ current_function_parms = last_function_parms; - current_function_parm_tags = last_function_parm_tags; /* Make sure the parameter and return types are reasonable. When you declare a function, these types can be incomplete, but they --- 13693,13698 ---- *************** start_function (declspecs, declarator, a *** 13484,13502 **** /* Build the return declaration for the function. */ restype = TREE_TYPE (fntype); ! if (!processing_template_decl) { ! if (!DECL_RESULT (decl1)) ! { ! DECL_RESULT (decl1) ! = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype)); ! c_apply_type_quals_to_decl (CP_TYPE_QUALS (restype), ! DECL_RESULT (decl1)); ! } } - else - /* Just use `void'. Nobody will ever look at this anyhow. */ - DECL_RESULT (decl1) = build_decl (RESULT_DECL, 0, void_type_node); /* Initialize RTL machinery. We cannot do this until CURRENT_FUNCTION_DECL and DECL_RESULT are set up. We do this --- 13702,13717 ---- /* Build the return declaration for the function. */ restype = TREE_TYPE (fntype); ! /* Promote the value to int before returning it. */ ! if (c_promoting_integer_type_p (restype)) ! restype = type_promotes_to (restype); ! if (DECL_RESULT (decl1) == NULL_TREE) { ! DECL_RESULT (decl1) ! = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype)); ! c_apply_type_quals_to_decl (cp_type_quals (restype), ! DECL_RESULT (decl1)); } /* Initialize RTL machinery. We cannot do this until CURRENT_FUNCTION_DECL and DECL_RESULT are set up. We do this *************** start_function (declspecs, declarator, a *** 13567,13573 **** 19990811); cp_function_chain->x_current_class_ref ! = build_indirect_ref (t, NULL_PTR); cp_function_chain->x_current_class_ptr = t; /* Constructors and destructors need to know whether they're "in --- 13782,13788 ---- 19990811); cp_function_chain->x_current_class_ref ! = build_indirect_ref (t, NULL); cp_function_chain->x_current_class_ptr = t; /* Constructors and destructors need to know whether they're "in *************** start_function (declspecs, declarator, a *** 13657,13677 **** pushlevel (0); current_binding_level->parm_flag = 1; - if (attrs) - cplus_decl_attributes (decl1, NULL_TREE, attrs); - - /* Promote the value to int before returning it. */ - if (c_promoting_integer_type_p (restype)) - restype = type_promotes_to (restype); - - if (DECL_RESULT (decl1) == NULL_TREE) - { - DECL_RESULT (decl1) - = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype)); - TREE_READONLY (DECL_RESULT (decl1)) = CP_TYPE_CONST_P (restype); - TREE_THIS_VOLATILE (DECL_RESULT (decl1)) = CP_TYPE_VOLATILE_P (restype); - } - ++function_depth; if (DECL_DESTRUCTOR_P (decl1)) --- 13872,13877 ---- *************** start_function (declspecs, declarator, a *** 13680,13685 **** --- 13880,13887 ---- DECL_CONTEXT (dtor_label) = current_function_decl; } + start_fname_decls (); + store_parm_decls (current_function_parms); return 1; *************** store_parm_decls (current_function_parms *** 13697,13707 **** { register tree fndecl = current_function_decl; register tree parm; - int parms_have_cleanups = 0; - tree cleanups = NULL_TREE; - - /* This is a list of types declared among parms in a prototype. */ - tree parmtags = current_function_parm_tags; /* This is a chain of any other decls that came in among the parm declarations. If a parm is declared with enum {foo, bar} x; --- 13899,13904 ---- *************** store_parm_decls (current_function_parms *** 13732,13751 **** next = TREE_CHAIN (parm); if (TREE_CODE (parm) == PARM_DECL) { - tree cleanup; - if (DECL_NAME (parm) == NULL_TREE || TREE_CODE (parm) != VOID_TYPE) pushdecl (parm); else ! cp_error ("parameter `%D' declared void", parm); ! ! cleanup = (processing_template_decl ! ? NULL_TREE ! : maybe_build_cleanup (parm)); ! ! if (cleanup) ! cleanups = tree_cons (parm, cleanup, cleanups); } else { --- 13929,13939 ---- next = TREE_CHAIN (parm); if (TREE_CODE (parm) == PARM_DECL) { if (DECL_NAME (parm) == NULL_TREE || TREE_CODE (parm) != VOID_TYPE) pushdecl (parm); else ! error ("parameter `%D' declared void", parm); } else { *************** store_parm_decls (current_function_parms *** 13760,13766 **** function. This is all and only the PARM_DECLs that were pushed into scope by the loop above. */ DECL_ARGUMENTS (fndecl) = getdecls (); ! storetags (chainon (parmtags, gettags ())); } else DECL_ARGUMENTS (fndecl) = NULL_TREE; --- 13948,13954 ---- function. This is all and only the PARM_DECLs that were pushed into scope by the loop above. */ DECL_ARGUMENTS (fndecl) = getdecls (); ! storetags (gettags ()); } else DECL_ARGUMENTS (fndecl) = NULL_TREE; *************** store_parm_decls (current_function_parms *** 13771,13791 **** DECL_ARGUMENTS is not modified. */ storedecls (chainon (nonparms, DECL_ARGUMENTS (fndecl))); - /* Now that we have initialized the parms, we can start their - cleanups. We cannot do this before, since expand_decl_cleanup - should not be called before the parm can be used. */ - while (cleanups) - { - finish_decl_cleanup (TREE_PURPOSE (cleanups), - TREE_VALUE (cleanups)); - cleanups = TREE_CHAIN (cleanups); - } - - /* Create a binding contour which can be used to catch - cleanup-generated temporaries. */ - if (parms_have_cleanups) - pushlevel (0); - /* Do the starting of the exception specifications, if we have any. */ if (flag_exceptions && !processing_template_decl && flag_enforce_eh_specs --- 13959,13964 ---- *************** save_function_data (decl) *** 13835,13949 **** } } ! /* At the end of every constructor we generate to code to return ! `this'. Do that now. */ static void finish_constructor_body () { ! /* Any return from a constructor will end up here. */ ! if (ctor_label) ! add_stmt (build_stmt (LABEL_STMT, ctor_label)); ! /* Clear CTOR_LABEL so that finish_return_stmt knows to really ! generate the return, rather than a goto to CTOR_LABEL. */ ! ctor_label = NULL_TREE; ! /* In check_return_expr we translate an empty return from a ! constructor to a return of `this'. */ ! finish_return_stmt (NULL_TREE); ! /* Mark the end of the constructor. */ add_stmt (build_stmt (CTOR_STMT)); } ! /* At the end of every destructor we generate code to restore virtual ! function tables to the values desired by base classes and to call ! to base class destructors. Do that now. */ static void ! finish_destructor_body () { tree compound_stmt; - tree exprstmt; - - /* Create a block to contain all the extra code. */ - compound_stmt = begin_compound_stmt (/*has_no_scope=*/0); - - /* Any return from a destructor will end up here. */ - add_stmt (build_stmt (LABEL_STMT, dtor_label)); ! /* Generate the code to call destructor on base class. If this ! destructor belongs to a class with virtual functions, then set ! the virtual function table pointer to represent the type of our ! base class. */ ! /* This side-effect makes call to `build_delete' generate the code ! we have to have at the end of this destructor. `build_delete' ! will set the flag again. */ ! TYPE_HAS_DESTRUCTOR (current_class_type) = 0; ! exprstmt = build_delete (current_class_type, ! current_class_ref, ! sfk_base_destructor, ! LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, ! 0); ! if (exprstmt != error_mark_node ! && (TREE_CODE (exprstmt) != NOP_EXPR ! || TREE_OPERAND (exprstmt, 0) != integer_zero_node ! || TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))) ! { ! if (exprstmt != void_zero_node) ! /* Don't call `expand_expr_stmt' if we're not going to do ! anything, since -Wall will give a diagnostic. */ ! finish_expr_stmt (exprstmt); ! /* Run destructors for all virtual baseclasses. */ ! if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)) ! { ! tree vbases; ! tree if_stmt; ! if_stmt = begin_if_stmt (); ! finish_if_stmt_cond (build (BIT_AND_EXPR, integer_type_node, ! current_in_charge_parm, ! integer_two_node), ! if_stmt); ! vbases = CLASSTYPE_VBASECLASSES (current_class_type); ! /* The CLASSTYPE_VBASECLASSES list is in initialization ! order, so we have to march through it in reverse order. */ ! for (vbases = nreverse (copy_list (vbases)); ! vbases; ! vbases = TREE_CHAIN (vbases)) ! { ! tree vbase = TREE_VALUE (vbases); ! tree base_type = BINFO_TYPE (vbase); ! if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (base_type)) ! { ! tree base_ptr_type = build_pointer_type (base_type); ! tree expr = current_class_ptr; ! ! /* Convert to the basetype here, as we know the layout is ! fixed. What is more, if we let build_method_call do it, ! it will use the vtable, which may have been clobbered ! by the deletion of our primary base. */ ! ! expr = build1 (NOP_EXPR, base_ptr_type, expr); ! expr = build (PLUS_EXPR, base_ptr_type, expr, ! BINFO_OFFSET (vbase)); ! expr = build_indirect_ref (expr, NULL); ! expr = build_method_call (expr, base_dtor_identifier, ! NULL_TREE, vbase, ! LOOKUP_NORMAL); ! finish_expr_stmt (expr); ! } ! } ! finish_then_clause (if_stmt); ! finish_if_stmt (); ! } ! } /* In a virtual destructor, we must call delete. */ if (DECL_VIRTUAL_P (current_function_decl)) --- 14008,14094 ---- } } ! /* Add a note to mark the beginning of the main body of the constructor. ! This is used to set up the data structures for the cleanup regions for ! fully-constructed bases and members. */ ! ! static void ! begin_constructor_body () ! { ! tree ctor_stmt = build_stmt (CTOR_STMT); ! CTOR_BEGIN_P (ctor_stmt) = 1; ! add_stmt (ctor_stmt); ! } ! ! /* Add a note to mark the end of the main body of the constructor. This is ! used to end the cleanup regions for fully-constructed bases and ! members. */ static void finish_constructor_body () { ! /* Mark the end of the cleanups for a partially constructed object. ! ??? These should really be handled automatically by closing the block, ! as with the destructor cleanups; the only difference is that these are ! only run if an exception is thrown. */ add_stmt (build_stmt (CTOR_STMT)); } ! /* Do all the processing for the beginning of a destructor; set up the ! vtable pointers and cleanups for bases and members. */ static void ! begin_destructor_body () { + tree if_stmt; tree compound_stmt; ! /* If the dtor is empty, and we know there is not any possible ! way we could use any vtable entries, before they are possibly ! set by a base class dtor, we don't have to setup the vtables, ! as we know that any base class dtor will set up any vtables ! it needs. We avoid MI, because one base class dtor can do a ! virtual dispatch to an overridden function that would need to ! have a non-related vtable set up, we cannot avoid setting up ! vtables in that case. We could change this to see if there ! is just one vtable. ! ??? In the destructor for a class, the vtables are set ! appropriately for that class. There will be no non-related ! vtables. jason 2001-12-11. */ ! if_stmt = begin_if_stmt (); ! /* If it is not safe to avoid setting up the vtables, then ! someone will change the condition to be boolean_true_node. ! (Actually, for now, we do not have code to set the condition ! appropriately, so we just assume that we always need to ! initialize the vtables.) */ ! finish_if_stmt_cond (boolean_true_node, if_stmt); ! current_vcalls_possible_p = &IF_COND (if_stmt); ! compound_stmt = begin_compound_stmt (/*has_no_scope=*/0); ! /* Make all virtual function table pointers in non-virtual base ! classes point to CURRENT_CLASS_TYPE's virtual function ! tables. */ ! initialize_vtbl_ptrs (current_class_ptr); ! finish_compound_stmt (/*has_no_scope=*/0, compound_stmt); ! finish_then_clause (if_stmt); ! finish_if_stmt (); ! } ! /* At the end of every destructor we generate code to delete the object if ! necessary. Do that now. */ ! static void ! finish_destructor_body () ! { ! tree exprstmt; ! /* And perform cleanups for our bases and members. */ ! perform_base_cleanups (); /* In a virtual destructor, we must call delete. */ if (DECL_VIRTUAL_P (current_function_decl)) *************** finish_destructor_body () *** 13953,13962 **** /* [class.dtor] ! At the point of definition of a virtual destructor (including ! an implicit definition), non-placement operator delete shall ! be looked up in the scope of the destructor's class and if ! found shall be accessible and unambiguous. */ exprstmt = build_op_delete_call (DELETE_EXPR, current_class_ptr, virtual_size, LOOKUP_NORMAL | LOOKUP_SPECULATIVELY, NULL_TREE); --- 14098,14107 ---- /* [class.dtor] ! At the point of definition of a virtual destructor (including ! an implicit definition), non-placement operator delete shall ! be looked up in the scope of the destructor's class and if ! found shall be accessible and unambiguous. */ exprstmt = build_op_delete_call (DELETE_EXPR, current_class_ptr, virtual_size, LOOKUP_NORMAL | LOOKUP_SPECULATIVELY, NULL_TREE); *************** finish_destructor_body () *** 13970,13989 **** finish_then_clause (if_stmt); finish_if_stmt (); } ! /* Close the block we started above. */ ! finish_compound_stmt (/*has_no_scope=*/0, compound_stmt); } /* Finish up a function declaration and compile that function all the way to assembler language output. The free the storage for the function definition. FLAGS is a bitwise or of the following values: - 1 - CALL_POPLEVEL - An extra call to poplevel (and expand_end_bindings) must be - made to take care of the binding contour for the base - initializers. This is only relevant for constructors. 2 - INCLASS_INLINE We just finished processing the body of an in-class inline function definition. (This processing will have taken place --- 14115,14190 ---- finish_then_clause (if_stmt); finish_if_stmt (); } + } ! /* Do the necessary processing for the beginning of a function body, which ! in this case includes member-initializers, but not the catch clauses of ! a function-try-block. Currently, this means opening a binding level ! for the member-initializers (in a ctor) and member cleanups (in a dtor). ! In other functions, this isn't necessary, but it doesn't hurt. */ ! ! tree ! begin_function_body () ! { ! tree stmt; ! ! if (processing_template_decl) ! /* Do nothing now. */; ! else ! /* Always keep the BLOCK node associated with the outermost pair of ! curly braces of a function. These are needed for correct ! operation of dwarfout.c. */ ! keep_next_level (1); ! ! stmt = begin_compound_stmt (0); ! COMPOUND_STMT_BODY_BLOCK (stmt) = 1; ! ! if (processing_template_decl) ! /* Do nothing now. */; ! else if (DECL_CONSTRUCTOR_P (current_function_decl)) ! begin_constructor_body (); ! else if (DECL_DESTRUCTOR_P (current_function_decl)) ! begin_destructor_body (); ! ! return stmt; } + /* Do the processing for the end of a function body. Currently, this means + closing out the cleanups for fully-constructed bases and members, and in + the case of the destructor, deleting the object if desired. Again, this + is only meaningful for [cd]tors, since they are the only functions where + there is a significant distinction between the main body and any + function catch clauses. Handling, say, main() return semantics here + would be wrong, as flowing off the end of a function catch clause for + main() would also need to return 0. */ + + void + finish_function_body (compstmt) + tree compstmt; + { + if (processing_template_decl) + /* Do nothing now. */; + else if (DECL_DESTRUCTOR_P (current_function_decl)) + /* Any return from a destructor will end up here. Put it before the + cleanups so that an explicit return doesn't duplicate them. */ + add_stmt (build_stmt (LABEL_STMT, dtor_label)); + + /* Close the block; in a destructor, run the member cleanups. */ + finish_compound_stmt (0, compstmt); + + if (processing_template_decl) + /* Do nothing now. */; + else if (DECL_CONSTRUCTOR_P (current_function_decl)) + finish_constructor_body (); + else if (DECL_DESTRUCTOR_P (current_function_decl)) + finish_destructor_body (); + } + /* Finish up a function declaration and compile that function all the way to assembler language output. The free the storage for the function definition. FLAGS is a bitwise or of the following values: 2 - INCLASS_INLINE We just finished processing the body of an in-class inline function definition. (This processing will have taken place *************** finish_function (flags) *** 13995,14001 **** { register tree fndecl = current_function_decl; tree fntype, ctype = NULL_TREE; - int call_poplevel = (flags & 1) != 0; int inclass_inline = (flags & 2) != 0; int nested; --- 14196,14201 ---- *************** finish_function (flags) *** 14013,14034 **** my_friendly_assert (building_stmt_tree (), 20000911); /* For a cloned function, we've already got all the code we need; there's no need to add any extra bits. */ if (!DECL_CLONED_FUNCTION_P (fndecl)) { ! if (DECL_CONSTRUCTOR_P (fndecl)) ! { ! finish_constructor_body (); ! if (call_poplevel) ! do_poplevel (); ! } ! else if (DECL_DESTRUCTOR_P (fndecl) && !processing_template_decl) ! finish_destructor_body (); ! else if (DECL_MAIN_P (fndecl)) { /* Make it so that `main' always returns 0 by default. */ ! #ifdef VMS finish_return_stmt (integer_one_node); #else finish_return_stmt (integer_zero_node); --- 14213,14228 ---- my_friendly_assert (building_stmt_tree (), 20000911); + finish_fname_decls (); + /* For a cloned function, we've already got all the code we need; there's no need to add any extra bits. */ if (!DECL_CLONED_FUNCTION_P (fndecl)) { ! if (DECL_MAIN_P (current_function_decl)) { /* Make it so that `main' always returns 0 by default. */ ! #ifdef VMS_TARGET finish_return_stmt (integer_one_node); #else finish_return_stmt (integer_zero_node); *************** finish_function (flags) *** 14050,14059 **** /* This must come after expand_function_end because cleanups might have declarations (from inline functions) that need to go into this function's blocks. */ if (current_binding_level->parm_flag != 1) ! my_friendly_abort (122); poplevel (1, 0, 1); /* Remember that we were in class scope. */ if (current_class_name) ctype = current_class_type; --- 14244,14295 ---- /* This must come after expand_function_end because cleanups might have declarations (from inline functions) that need to go into this function's blocks. */ + + /* If the current binding level isn't the outermost binding level + for this function, either there is a bug, or we have experienced + syntax errors and the statement tree is malformed. */ if (current_binding_level->parm_flag != 1) ! { ! /* Make sure we have already experienced errors. */ ! if (errorcount == 0) ! abort (); ! ! /* Throw away the broken statement tree and extra binding ! levels. */ ! DECL_SAVED_TREE (fndecl) = build_stmt (COMPOUND_STMT, NULL_TREE); ! ! while (current_binding_level->parm_flag != 1) ! { ! if (current_binding_level->parm_flag == 2) ! pop_nested_class (); ! else ! poplevel (0, 0, 0); ! } ! } poplevel (1, 0, 1); + /* Set up the named return value optimization, if we can. Here, we + eliminate the copy from the nrv into the RESULT_DECL and any cleanup + for the nrv. genrtl_start_function and declare_return_variable + handle making the nrv and RESULT_DECL share space. */ + if (current_function_return_value) + { + tree r = current_function_return_value; + /* This is only worth doing for fns that return in memory--and + simpler, since we don't have to worry about promoted modes. */ + if (r != error_mark_node + && aggregate_value_p (TREE_TYPE (TREE_TYPE (fndecl)))) + { + DECL_ALIGN (r) = DECL_ALIGN (DECL_RESULT (fndecl)); + walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl), + nullify_returns_r, r); + } + else + /* Clear it so genrtl_start_function and declare_return_variable + know we're not optimizing. */ + current_function_return_value = NULL_TREE; + } + /* Remember that we were in class scope. */ if (current_class_name) ctype = current_class_type; *************** finish_function (flags) *** 14081,14086 **** --- 14317,14335 ---- if (!processing_template_decl && calls_setjmp_p (fndecl)) DECL_UNINLINABLE (fndecl) = 1; + /* Complain if there's just no return statement. */ + if (warn_return_type + && !processing_template_decl + && TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE + && !current_function_returns_value && !current_function_returns_null + /* Don't complain if we abort or throw. */ + && !current_function_returns_abnormally + && !DECL_NAME (DECL_RESULT (fndecl)) + /* Normally, with -Wreturn-type, flow will complain. Unless we're an + inline function, as we might never be compiled separately. */ + && DECL_INLINE (fndecl)) + warning ("no return statement in function returning non-void"); + /* Clear out memory we no longer need. */ free_after_parsing (cfun); /* Since we never call rest_of_compilation, we never clear *************** start_method (declspecs, declarator, att *** 14137,14150 **** tree declarator, declspecs, attrlist; { tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0, ! attrlist); /* Something too ugly to handle. */ if (fndecl == NULL_TREE) return NULL_TREE; if (attrlist) ! cplus_decl_attributes (fndecl, attrlist, 0); /* Pass friends other than inline friend functions back. */ if (fndecl == void_type_node) --- 14386,14399 ---- tree declarator, declspecs, attrlist; { tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0, ! &attrlist); /* Something too ugly to handle. */ if (fndecl == NULL_TREE) return NULL_TREE; if (attrlist) ! cplus_decl_attributes (&fndecl, attrlist, 0); /* Pass friends other than inline friend functions back. */ if (fndecl == void_type_node) *************** start_method (declspecs, declarator, att *** 14160,14166 **** { if (DECL_CONTEXT (fndecl) && TREE_CODE( DECL_CONTEXT (fndecl)) != NAMESPACE_DECL) ! cp_error ("`%D' is already defined in class `%T'", fndecl, DECL_CONTEXT (fndecl)); } return void_type_node; --- 14409,14415 ---- { if (DECL_CONTEXT (fndecl) && TREE_CODE( DECL_CONTEXT (fndecl)) != NAMESPACE_DECL) ! error ("`%D' is already defined in class `%T'", fndecl, DECL_CONTEXT (fndecl)); } return void_type_node; *************** start_method (declspecs, declarator, att *** 14184,14197 **** fndecl = copy_node (fndecl); TREE_CHAIN (fndecl) = NULL_TREE; } ! ! if (DECL_CONSTRUCTOR_P (fndecl)) ! { ! if (! grok_ctor_properties (current_class_type, fndecl)) ! return void_type_node; ! } ! else if (IDENTIFIER_OPNAME_P (DECL_NAME (fndecl))) ! grok_op_properties (fndecl, DECL_VIRTUAL_P (fndecl), 0); } cp_finish_decl (fndecl, NULL_TREE, NULL_TREE, 0); --- 14433,14439 ---- fndecl = copy_node (fndecl); TREE_CHAIN (fndecl) = NULL_TREE; } ! grok_special_member_properties (fndecl); } cp_finish_decl (fndecl, NULL_TREE, NULL_TREE, 0); *************** finish_method (decl) *** 14248,14258 **** DECL_CONTEXT (link) = NULL_TREE; } - GNU_xref_end_scope ((HOST_WIDE_INT) current_binding_level, - (HOST_WIDE_INT) current_binding_level->level_chain, - current_binding_level->parm_flag, - current_binding_level->keep); - poplevel (0, 0, 0); DECL_INITIAL (fndecl) = old_initial; --- 14490,14495 ---- *************** finish_method (decl) *** 14270,14341 **** return decl; } ! /* Called when a new struct TYPE is defined. ! If this structure or union completes the type of any previous ! variable declaration, lay it out and output its rtl. */ void ! hack_incomplete_structures (type) ! tree type; { ! tree *list; ! struct binding_level *level; ! ! if (!type) /* Don't do this for class templates. */ ! return; ! if (namespace_bindings_p ()) ! { ! level = 0; ! list = &namespace_scope_incomplete; ! } ! else { ! level = innermost_nonclass_level (); ! list = &level->incomplete; } ! while (1) ! { ! while (*list) ! { ! tree decl = TREE_VALUE (*list); ! if ((decl && TREE_TYPE (decl) == type) ! || (TREE_TYPE (decl) ! && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE ! && TREE_TYPE (TREE_TYPE (decl)) == type)) ! { ! int toplevel = toplevel_bindings_p (); ! if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE ! && TREE_TYPE (TREE_TYPE (decl)) == type) ! layout_type (TREE_TYPE (decl)); ! layout_decl (decl, 0); ! rest_of_decl_compilation (decl, NULL_PTR, toplevel, 0); ! if (! toplevel) ! { ! tree cleanup; ! expand_decl (decl); ! cleanup = maybe_build_cleanup (decl); ! expand_decl_init (decl); ! if (! expand_decl_cleanup (decl, cleanup)) ! cp_error ("parser lost in parsing declaration of `%D'", ! decl); ! } ! *list = TREE_CHAIN (*list); ! } ! else ! list = &TREE_CHAIN (*list); ! } ! /* Keep looking through artificial binding levels generated ! for local variables. */ ! if (level && level->keep == 2) { ! level = level->level_chain; ! list = &level->incomplete; } else ! break; } } --- 14507,14564 ---- return decl; } ! ! /* VAR is a VAR_DECL. If its type is incomplete, remember VAR so that ! we can lay it out later, when and if its type becomes complete. */ void ! maybe_register_incomplete_var (var) ! tree var; { ! my_friendly_assert (TREE_CODE (var) == VAR_DECL, 20020406); ! /* Keep track of variables with incomplete types. */ ! if (!processing_template_decl && TREE_TYPE (var) != error_mark_node ! && DECL_EXTERNAL (var)) { ! tree inner_type = TREE_TYPE (var); ! ! while (TREE_CODE (inner_type) == ARRAY_TYPE) ! inner_type = TREE_TYPE (inner_type); ! inner_type = TYPE_MAIN_VARIANT (inner_type); ! ! if ((!COMPLETE_TYPE_P (inner_type) && CLASS_TYPE_P (inner_type)) ! /* RTTI TD entries are created while defining the type_info. */ ! || (TYPE_LANG_SPECIFIC (inner_type) ! && TYPE_BEING_DEFINED (inner_type))) ! incomplete_vars = tree_cons (inner_type, var, incomplete_vars); } + } ! /* Called when a class type (given by TYPE) is defined. If there are ! any existing VAR_DECLs whose type hsa been completed by this ! declaration, update them now. */ ! void ! complete_vars (type) ! tree type; ! { ! tree *list = &incomplete_vars; ! ! my_friendly_assert (CLASS_TYPE_P (type), 20020406); ! while (*list) ! { ! if (same_type_p (type, TREE_PURPOSE (*list))) { ! tree var = TREE_VALUE (*list); ! /* Complete the type of the variable. The VAR_DECL itself ! will be laid out in expand_expr. */ ! complete_type (TREE_TYPE (var)); ! /* Remove this entry from the list. */ ! *list = TREE_CHAIN (*list); } else ! list = &TREE_CHAIN (*list); } } *************** maybe_build_cleanup (decl) *** 14348,14358 **** { tree type = TREE_TYPE (decl); ! if (type != error_mark_node && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type) ! /* The destructor must not be called on the parameters of a thunk ! because they are not copied when the thunk calls the function ! to which is thunking. */ ! && (! DECL_CONTEXT (decl) || ! DECL_THUNK_P (DECL_CONTEXT (decl)))) { int flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR; tree rval; --- 14571,14577 ---- { tree type = TREE_TYPE (decl); ! if (type != error_mark_node && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) { int flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR; tree rval; *************** maybe_build_cleanup (decl) *** 14380,14386 **** return rval; } ! return 0; } /* When a stmt has been parsed, this function is called. */ --- 14599,14605 ---- return rval; } ! return NULL_TREE; } /* When a stmt has been parsed, this function is called. */ *************** revert_static_member_fn (decl) *** 14405,14418 **** tree function = TREE_TYPE (decl); tree args = TYPE_ARG_TYPES (function); ! if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args))) != TYPE_UNQUALIFIED) ! cp_error ("static member function `%#D' declared with type qualifiers", decl); args = TREE_CHAIN (args); tmp = build_function_type (TREE_TYPE (function), args); ! tmp = build_qualified_type (tmp, CP_TYPE_QUALS (function)); tmp = build_exception_variant (tmp, TYPE_RAISES_EXCEPTIONS (function)); TREE_TYPE (decl) = tmp; --- 14624,14637 ---- tree function = TREE_TYPE (decl); tree args = TYPE_ARG_TYPES (function); ! if (cp_type_quals (TREE_TYPE (TREE_VALUE (args))) != TYPE_UNQUALIFIED) ! error ("static member function `%#D' declared with type qualifiers", decl); args = TREE_CHAIN (args); tmp = build_function_type (TREE_TYPE (function), args); ! tmp = build_qualified_type (tmp, cp_type_quals (function)); tmp = build_exception_variant (tmp, TYPE_RAISES_EXCEPTIONS (function)); TREE_TYPE (decl) = tmp; *************** mark_lang_function (p) *** 14471,14477 **** mark_c_language_function (&p->base); - ggc_mark_tree (p->x_ctor_label); ggc_mark_tree (p->x_dtor_label); ggc_mark_tree (p->x_current_class_ptr); ggc_mark_tree (p->x_current_class_ref); --- 14690,14695 ---- *************** mark_lang_function (p) *** 14480,14485 **** --- 14698,14704 ---- mark_named_label_lists (&p->x_named_labels, &p->x_named_label_uses); mark_binding_level (&p->bindings); + mark_pending_inlines (&p->unparsed_inlines); } /* Mark the language-specific data in F for GC. */ *************** lang_mark_tree (t) *** 14548,14554 **** ggc_mark_tree (ld->befriending_classes); ggc_mark_tree (ld->context); ggc_mark_tree (ld->cloned_function); - ggc_mark_tree (ld->inlined_fns); if (TREE_CODE (t) == TYPE_DECL) ggc_mark_tree (ld->u.sorted_fields); else if (TREE_CODE (t) == FUNCTION_DECL --- 14767,14772 ---- diff -Nrc3pad gcc-3.0.4/gcc/cp/decl.h gcc-3.1/gcc/cp/decl.h *** gcc-3.0.4/gcc/cp/decl.h Wed Jan 26 20:51:34 2000 --- gcc-3.1/gcc/cp/decl.h Wed Jan 9 06:32:47 2002 *************** *** 1,5 **** /* Variables and structures for declaration processing. ! Copyright (C) 1993, 2000 Free Software Foundation, Inc. This file is part of GNU CC. --- 1,5 ---- /* Variables and structures for declaration processing. ! Copyright (C) 1993, 2000, 2002 Free Software Foundation, Inc. This file is part of GNU CC. *************** enum decl_context *** 31,37 **** }; /* 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. */ --- 31,38 ---- }; /* 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. */ diff -Nrc3pad gcc-3.0.4/gcc/cp/decl2.c gcc-3.1/gcc/cp/decl2.c *** gcc-3.0.4/gcc/cp/decl2.c Fri Nov 30 03:12:42 2001 --- gcc-3.1/gcc/cp/decl2.c Wed Apr 17 17:13:39 2002 *************** *** 1,6 **** /* Process declarations and variables for C compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, ! 1999, 2000, 2001 Free Software Foundation, Inc. Hacked by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. --- 1,6 ---- /* Process declarations and variables for C compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, ! 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Hacked by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. *************** Boston, MA 02111-1307, USA. */ *** 40,50 **** #include "output.h" #include "except.h" #include "toplev.h" - #include "dwarf2out.h" - #include "dwarfout.h" #include "ggc.h" #include "timevar.h" #include "cpplib.h" extern cpp_reader *parse_in; /* This structure contains information about the initializations --- 40,49 ---- #include "output.h" #include "except.h" #include "toplev.h" #include "ggc.h" #include "timevar.h" #include "cpplib.h" + #include "target.h" extern cpp_reader *parse_in; /* This structure contains information about the initializations *************** static tree key_method PARAMS ((tree)); *** 92,105 **** static int compare_options PARAMS ((const PTR, const PTR)); static tree get_guard_bits PARAMS ((tree)); - extern int current_class_depth; - - /* A list of virtual function tables we must make sure to write out. */ - tree pending_vtables; - /* A list of static class variables. This is needed, because a static class variable can be declared inside the class without ! an initializer, and then initialized, staticly, outside the class. */ static varray_type pending_statics; #define pending_statics_used \ (pending_statics ? pending_statics->elements_used : 0) --- 91,99 ---- static int compare_options PARAMS ((const PTR, const PTR)); static tree get_guard_bits PARAMS ((tree)); /* A list of static class variables. This is needed, because a static class variable can be declared inside the class without ! an initializer, and then initialized, statically, outside the class. */ static varray_type pending_statics; #define pending_statics_used \ (pending_statics ? pending_statics->elements_used : 0) *************** static varray_type deferred_fns; *** 110,119 **** #define deferred_fns_used \ (deferred_fns ? deferred_fns->elements_used : 0) - /* Same, but not reset. Local temp variables and global temp variables - can have the same name. */ - static int global_temp_name_counter; - /* Flag used when debugging spew.c */ extern int spew_debug; --- 104,109 ---- *************** tree static_dtors; *** 130,140 **** /* The :: namespace. */ tree global_namespace; - - /* The stack for namespaces of current declarations. */ - - static tree decl_namespace_list; - /* C (and C++) language-specific option variables. */ --- 120,125 ---- *************** int warn_long_long = 1; *** 200,210 **** int warn_ctor_dtor_privacy = 1; - /* True if we want to implement vtables using "thunks". - The default is off. */ - - int flag_vtable_thunks = 1; - /* Nonzero means generate separate instantiation control files and juggle them at link time. */ --- 185,190 ---- *************** int flag_default_inline = 1; *** 353,363 **** int flag_rtti = 1; - /* Nonzero if we wish to output cross-referencing information - for the GNU class browser. */ - - extern int flag_gnu_xref; - /* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes) objects. */ --- 333,338 ---- *************** int flag_weak = 1; *** 403,424 **** int flag_use_cxa_atexit; - /* Nonzero to not ignore namespace std. */ - - int flag_honor_std = ENABLE_STD_NAMESPACE; - - /* 0 if we should not perform inlining. - 1 if we should expand functions calls inline at the tree level. - 2 if we should consider *all* functions to be inline - candidates. */ - - int flag_inline_trees = 0; - /* Maximum template instantiation depth. This limit is rather arbitrary, but it exists to limit the time it takes to notice infinite template instantiations. */ ! int max_tinst_depth = 50; /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */ --- 378,388 ---- int flag_use_cxa_atexit; /* Maximum template instantiation depth. This limit is rather arbitrary, but it exists to limit the time it takes to notice infinite template instantiations. */ ! int max_tinst_depth = 500; /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */ *************** int flag_permissive; *** 436,452 **** int flag_enforce_eh_specs = 1; - /* The variant of the C language being processed. */ - - c_language_kind c_language = clk_cplusplus; - /* Table of language-dependent -f options. STRING is the option name. VARIABLE is the address of the variable. ON_VALUE is the value to store in VARIABLE if `-fSTRING' is seen as an option. (If `-fno-STRING' is seen as an option, the opposite value is stored.) */ ! static struct { const char *string; int *variable; int on_value;} lang_f_options[] = { /* C/C++ options. */ --- 400,412 ---- int flag_enforce_eh_specs = 1; /* Table of language-dependent -f options. STRING is the option name. VARIABLE is the address of the variable. ON_VALUE is the value to store in VARIABLE if `-fSTRING' is seen as an option. (If `-fno-STRING' is seen as an option, the opposite value is stored.) */ ! static const struct { const char *const string; int *const variable; const int on_value;} lang_f_options[] = { /* C/C++ options. */ *************** lang_f_options[] = *** 484,489 **** --- 444,450 ---- {"repo", &flag_use_repository, 1}, {"rtti", &flag_rtti, 1}, {"stats", &flag_detailed_statistics, 1}, + {"vtable-gc", &flag_vtable_gc, 1}, {"use-cxa-atexit", &flag_use_cxa_atexit, 1}, {"weak", &flag_weak, 1} }; *************** static const char * const unsupported_op *** 504,510 **** "squangle", "strict-prototype", "this-is-variable", - "vtable-gc", "vtable-thunks", "xref" }; --- 465,470 ---- *************** cxx_decode_option (argc, argv) *** 533,539 **** int strings_processed; const char *p = argv[0]; ! strings_processed = cpp_handle_option (parse_in, argc, argv); if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) /* ignore */; --- 493,499 ---- int strings_processed; const char *p = argv[0]; ! strings_processed = cpp_handle_option (parse_in, argc, argv, 0); if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) /* ignore */; *************** cxx_decode_option (argc, argv) *** 616,632 **** { *lang_f_options[j].variable = lang_f_options[j].on_value; /* A goto here would be cleaner, ! but breaks the vax pcc. */ found = 1; } ! if (p[0] == 'n' && p[1] == 'o' && p[2] == '-' ! && ! strcmp (p+3, lang_f_options[j].string)) { *lang_f_options[j].variable = ! lang_f_options[j].on_value; found = 1; } } ! return found; } } --- 576,592 ---- { *lang_f_options[j].variable = lang_f_options[j].on_value; /* A goto here would be cleaner, ! but breaks the VAX pcc. */ found = 1; } ! else if (p[0] == 'n' && p[1] == 'o' && p[2] == '-' ! && ! strcmp (p+3, lang_f_options[j].string)) { *lang_f_options[j].variable = ! lang_f_options[j].on_value; found = 1; } } ! return found; } } *************** grok_method_quals (ctype, function, qual *** 798,804 **** while (quals); if (dup_quals != TYPE_UNQUALIFIED) ! cp_error ("duplicate type qualifiers in %s declaration", TREE_CODE (function) == FUNCTION_DECL ? "member function" : "type"); --- 758,764 ---- while (quals); if (dup_quals != TYPE_UNQUALIFIED) ! error ("duplicate type qualifiers in %s declaration", TREE_CODE (function) == FUNCTION_DECL ? "member function" : "type"); *************** warn_if_unknown_interface (decl) *** 837,843 **** lineno = TINST_LINE (til); input_filename = TINST_FILE (til); } ! cp_warning ("template `%#D' instantiated in file without #pragma interface", decl); lineno = sl; input_filename = sf; --- 797,803 ---- lineno = TINST_LINE (til); input_filename = TINST_FILE (til); } ! warning ("template `%#D' instantiated in file without #pragma interface", decl); lineno = sl; input_filename = sf; *************** build_artificial_parm (name, type) *** 881,886 **** --- 841,849 ---- parm = build_decl (PARM_DECL, name, type); DECL_ARTIFICIAL (parm) = 1; + /* All our artificial parms are implicitly `const'; they cannot be + assigned to. */ + TREE_READONLY (parm) = 1; DECL_ARG_TYPE (parm) = type; return parm; } *************** grokclassfn (ctype, function, flags, qua *** 1020,1029 **** 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); - - /* We can make this a register, so long as we don't - accidentally complain if someone tries to take its address. */ - DECL_REGISTER (parm) = 1; TREE_CHAIN (parm) = last_function_parms; last_function_parms = parm; } --- 983,988 ---- *************** grokclassfn (ctype, function, flags, qua *** 1044,1085 **** } } - /* Work on the expr used by alignof (this is only called by the parser). */ - - tree - grok_alignof (expr) - tree expr; - { - tree best, t; - int bestalign; - - if (processing_template_decl) - return build_min_nt (ALIGNOF_EXPR, expr); - - if (TREE_CODE (expr) == COMPONENT_REF - && DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1))) - error ("`__alignof__' applied to a bit-field"); - - if (TREE_CODE (expr) == INDIRECT_REF) - { - best = t = TREE_OPERAND (expr, 0); - bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t))); - - while (TREE_CODE (t) == NOP_EXPR - && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE) - { - int thisalign; - t = TREE_OPERAND (t, 0); - thisalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t))); - if (thisalign > bestalign) - best = t, bestalign = thisalign; - } - return c_alignof (TREE_TYPE (TREE_TYPE (best))); - } - else - return c_alignof (TREE_TYPE (expr)); - } - /* Create an ARRAY_REF, checking for the user doing things backwards along the way. */ --- 1003,1008 ---- *************** grok_array_decl (array_expr, index_exp) *** 1139,1145 **** array_expr = p2, index_exp = i1; else { ! cp_error ("invalid types `%T[%T]' for array subscript", type, TREE_TYPE (index_exp)); return error_mark_node; } --- 1062,1068 ---- array_expr = p2, index_exp = i1; else { ! error ("invalid types `%T[%T]' for array subscript", type, TREE_TYPE (index_exp)); return error_mark_node; } *************** delete_sanity (exp, size, doing_vec, use *** 1187,1193 **** if (t == NULL_TREE || t == error_mark_node) { ! cp_error ("type `%#T' argument given to `delete', expected pointer", TREE_TYPE (exp)); return error_mark_node; } --- 1110,1116 ---- if (t == NULL_TREE || t == error_mark_node) { ! error ("type `%#T' argument given to `delete', expected pointer", TREE_TYPE (exp)); return error_mark_node; } *************** delete_sanity (exp, size, doing_vec, use *** 1212,1218 **** /* Deleting ptr to void is undefined behaviour [expr.delete/3]. */ if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE) { ! cp_warning ("deleting `%T' is undefined", type); doing_vec = 0; } --- 1135,1141 ---- /* Deleting ptr to void is undefined behaviour [expr.delete/3]. */ if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE) { ! warning ("deleting `%T' is undefined", type); doing_vec = 0; } *************** delete_sanity (exp, size, doing_vec, use *** 1220,1226 **** if (TREE_CODE (t) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == ARRAY_TYPE) ! cp_warning ("deleting array `%#D'", TREE_OPERAND (t, 0)); /* Deleting a pointer with the value zero is valid and has no effect. */ if (integer_zerop (t)) --- 1143,1149 ---- 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)) *************** delete_sanity (exp, size, doing_vec, use *** 1230,1250 **** return build_vec_delete (t, maxindex, sfk_deleting_destructor, use_global_delete); else ! { ! if (IS_AGGR_TYPE (TREE_TYPE (type)) ! && TYPE_GETS_REG_DELETE (TREE_TYPE (type))) ! { ! /* Only do access checking here; we'll be calling op delete ! from the destructor. */ ! tree tmp = build_op_delete_call (DELETE_EXPR, t, size_zero_node, ! LOOKUP_NORMAL, NULL_TREE); ! if (tmp == error_mark_node) ! return error_mark_node; ! } ! ! return build_delete (type, t, sfk_deleting_destructor, ! LOOKUP_NORMAL, use_global_delete); ! } } /* Report an error if the indicated template declaration is not the --- 1153,1160 ---- return build_vec_delete (t, maxindex, sfk_deleting_destructor, use_global_delete); else ! return build_delete (type, t, sfk_deleting_destructor, ! LOOKUP_NORMAL, use_global_delete); } /* Report an error if the indicated template declaration is not the *************** check_member_template (tmpl) *** 1267,1273 **** /* 14.5.2.2 [temp.mem] A local class shall not have member templates. */ ! cp_error ("invalid declaration of member template `%#D' in local class", decl); if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl)) --- 1177,1183 ---- /* 14.5.2.2 [temp.mem] A local class shall not have member templates. */ ! error ("invalid declaration of member template `%#D' in local class", decl); if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl)) *************** check_member_template (tmpl) *** 1275,1281 **** /* 14.5.2.3 [temp.mem] A member function template shall not be virtual. */ ! cp_error ("invalid use of `virtual' in template declaration of `%#D'", decl); DECL_VIRTUAL_P (decl) = 0; --- 1185,1191 ---- /* 14.5.2.3 [temp.mem] A member function template shall not be virtual. */ ! error ("invalid use of `virtual' in template declaration of `%#D'", decl); DECL_VIRTUAL_P (decl) = 0; *************** check_member_template (tmpl) *** 1286,1292 **** DECL_IGNORED_P (tmpl) = 1; } else ! cp_error ("template declaration of `%#D'", decl); } /* Return true iff TYPE is a valid Java parameter or return type. */ --- 1196,1202 ---- DECL_IGNORED_P (tmpl) = 1; } else ! error ("template declaration of `%#D'", decl); } /* Return true iff TYPE is a valid Java parameter or return type. */ *************** check_java_method (method) *** 1336,1342 **** tree ret_type = TREE_TYPE (TREE_TYPE (method)); if (! acceptable_java_type (ret_type)) { ! cp_error ("Java method '%D' has non-Java return type `%T'", method, ret_type); jerr++; } --- 1246,1252 ---- tree ret_type = TREE_TYPE (TREE_TYPE (method)); if (! acceptable_java_type (ret_type)) { ! error ("Java method '%D' has non-Java return type `%T'", method, ret_type); jerr++; } *************** check_java_method (method) *** 1345,1351 **** tree type = TREE_VALUE (arg_types); if (! acceptable_java_type (type)) { ! cp_error ("Java method '%D' has non-Java parameter type `%T'", method, type); jerr++; } --- 1255,1261 ---- tree type = TREE_VALUE (arg_types); if (! acceptable_java_type (type)) { ! error ("Java method '%D' has non-Java parameter type `%T'", method, type); jerr++; } *************** check_classfn (ctype, function) *** 1441,1447 **** if (methods != end && *methods) { tree fndecl = *methods; ! cp_error ("prototype for `%#D' does not match any in class `%T'", function, ctype); cp_error_at ("candidate%s: %+#D", OVL_NEXT (fndecl) ? "s are" : " is", OVL_CURRENT (fndecl)); --- 1351,1357 ---- if (methods != end && *methods) { tree fndecl = *methods; ! error ("prototype for `%#D' does not match any in class `%T'", function, ctype); cp_error_at ("candidate%s: %+#D", OVL_NEXT (fndecl) ? "s are" : " is", OVL_CURRENT (fndecl)); *************** check_classfn (ctype, function) *** 1454,1460 **** if (!COMPLETE_TYPE_P (ctype)) incomplete_type_error (function, ctype); else ! cp_error ("no `%#D' member function declared in class `%T'", function, ctype); } --- 1364,1370 ---- if (!COMPLETE_TYPE_P (ctype)) incomplete_type_error (function, ctype); else ! error ("no `%#D' member function declared in class `%T'", function, ctype); } *************** finish_static_data_member_decl (decl, in *** 1484,1490 **** DECL_CONTEXT (decl) = current_class_type; /* We cannot call pushdecl here, because that would fill in the ! decl of our TREE_CHAIN. Instead, we modify cp_finish_decl to do the right thing, namely, to put this decl out straight away. */ /* current_class_type can be NULL_TREE in case of error. */ if (!asmspec_tree && current_class_type) --- 1394,1400 ---- DECL_CONTEXT (decl) = current_class_type; /* We cannot call pushdecl here, because that would fill in the ! TREE_CHAIN of our decl. Instead, we modify cp_finish_decl to do the right thing, namely, to put this decl out straight away. */ /* current_class_type can be NULL_TREE in case of error. */ if (!asmspec_tree && current_class_type) *************** finish_static_data_member_decl (decl, in *** 1497,1502 **** --- 1407,1416 ---- VARRAY_PUSH_TREE (pending_statics, decl); } + if (LOCAL_CLASS_P (current_class_type)) + pedwarn ("local class `%#T' shall not have static data member `%#D'", + current_class_type, decl); + /* Static consts need not be initialized in the class definition. */ if (init != NULL_TREE && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))) { *************** tree *** 1542,1548 **** grokfield (declarator, declspecs, init, asmspec_tree, attrlist) tree declarator, declspecs, init, asmspec_tree, attrlist; { ! register tree value; const char *asmspec = 0; int flags = LOOKUP_ONLYCONVERTING; --- 1456,1462 ---- grokfield (declarator, declspecs, init, asmspec_tree, attrlist) tree declarator, declspecs, init, asmspec_tree, attrlist; { ! tree value; const char *asmspec = 0; int flags = LOOKUP_ONLYCONVERTING; *************** grokfield (declarator, declspecs, init, *** 1564,1573 **** Explain that to the user. */ static int explained; ! cp_error ("invalid data member initialization"); if (!explained) { ! cp_error ("(use `=' to initialize static data members)"); explained = 1; } --- 1478,1487 ---- Explain that to the user. */ static int explained; ! error ("invalid data member initialization"); if (!explained) { ! error ("(use `=' to initialize static data members)"); explained = 1; } *************** grokfield (declarator, declspecs, init, *** 1593,1599 **** && TREE_CHAIN (init) == NULL_TREE) init = NULL_TREE; ! value = grokdeclarator (declarator, declspecs, FIELD, init != 0, attrlist); if (! value || value == error_mark_node) /* friend or constructor went bad. */ return value; --- 1507,1513 ---- && TREE_CHAIN (init) == NULL_TREE) init = NULL_TREE; ! value = grokdeclarator (declarator, declspecs, FIELD, init != 0, &attrlist); if (! value || value == error_mark_node) /* friend or constructor went bad. */ return value; *************** grokfield (declarator, declspecs, init, *** 1607,1613 **** if (DECL_NAME (value) != NULL_TREE && IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_' && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr")) ! cp_error ("member `%D' conflicts with virtual function table field name", value); /* Stash away type declarations. */ --- 1521,1527 ---- if (DECL_NAME (value) != NULL_TREE && IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_' && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr")) ! error ("member `%D' conflicts with virtual function table field name", value); /* Stash away type declarations. */ *************** grokfield (declarator, declspecs, init, *** 1627,1633 **** if (DECL_IN_AGGR_P (value)) { ! cp_error ("`%D' is already defined in `%T'", value, DECL_CONTEXT (value)); return void_type_node; } --- 1541,1547 ---- if (DECL_IN_AGGR_P (value)) { ! error ("`%D' is already defined in `%T'", value, DECL_CONTEXT (value)); return void_type_node; } *************** grokfield (declarator, declspecs, init, *** 1690,1697 **** value = push_template_decl (value); if (attrlist) ! cplus_decl_attributes (value, TREE_PURPOSE (attrlist), ! TREE_VALUE (attrlist)); if (TREE_CODE (value) == VAR_DECL) { --- 1604,1610 ---- value = push_template_decl (value); if (attrlist) ! cplus_decl_attributes (&value, attrlist, 0); if (TREE_CODE (value) == VAR_DECL) { *************** grokfield (declarator, declspecs, init, *** 1702,1708 **** if (TREE_CODE (value) == FIELD_DECL) { if (asmspec) ! cp_error ("`asm' specifiers are not permitted on non-static data members"); if (DECL_INITIAL (value) == error_mark_node) init = error_mark_node; cp_finish_decl (value, init, NULL_TREE, flags); --- 1615,1621 ---- if (TREE_CODE (value) == FIELD_DECL) { if (asmspec) ! error ("`asm' specifiers are not permitted on non-static data members"); if (DECL_INITIAL (value) == error_mark_node) init = error_mark_node; cp_finish_decl (value, init, NULL_TREE, flags); *************** grokfield (declarator, declspecs, init, *** 1719,1724 **** --- 1632,1640 ---- SET_DECL_RTL (value, NULL_RTX); SET_DECL_ASSEMBLER_NAME (value, get_identifier (asmspec)); } + if (!DECL_FRIEND_P (value)) + grok_special_member_properties (value); + cp_finish_decl (value, init, asmspec_tree, flags); /* Pass friends back this way. */ *************** grokfield (declarator, declspecs, init, *** 1728,1734 **** DECL_IN_AGGR_P (value) = 1; return value; } ! my_friendly_abort (21); /* NOTREACHED */ return NULL_TREE; } --- 1644,1650 ---- DECL_IN_AGGR_P (value) = 1; return value; } ! abort (); /* NOTREACHED */ return NULL_TREE; } *************** grokbitfield (declarator, declspecs, wid *** 1741,1747 **** tree declarator, declspecs, width; { register tree value = grokdeclarator (declarator, declspecs, BITFIELD, ! 0, NULL_TREE); if (! value) return NULL_TREE; /* friends went bad. */ --- 1657,1663 ---- tree declarator, declspecs, width; { register tree value = grokdeclarator (declarator, declspecs, BITFIELD, ! 0, NULL); if (! value) return NULL_TREE; /* friends went bad. */ *************** grokbitfield (declarator, declspecs, wid *** 1751,1783 **** if (TREE_CODE (value) == TYPE_DECL) { ! cp_error ("cannot declare `%D' to be a bitfield type", value); return NULL_TREE; } ! /* Usually, finish_struct_1 catches bitifields with invalid types. But, in the case of bitfields with function type, we confuse ourselves into thinking they are member functions, so we must check here. */ if (TREE_CODE (value) == FUNCTION_DECL) { ! cp_error ("cannot declare bitfield `%D' with funcion type", ! DECL_NAME (value)); return NULL_TREE; } if (DECL_IN_AGGR_P (value)) { ! cp_error ("`%D' is already defined in the class %T", value, DECL_CONTEXT (value)); return void_type_node; } - GNU_xref_member (current_class_name, value); - if (TREE_STATIC (value)) { ! cp_error ("static member `%D' cannot be a bitfield", value); return NULL_TREE; } cp_finish_decl (value, NULL_TREE, NULL_TREE, 0); --- 1667,1697 ---- if (TREE_CODE (value) == TYPE_DECL) { ! error ("cannot declare `%D' to be a bit-field type", value); return NULL_TREE; } ! /* Usually, finish_struct_1 catches bitfields with invalid types. But, in the case of bitfields with function type, we confuse ourselves into thinking they are member functions, so we must check here. */ if (TREE_CODE (value) == FUNCTION_DECL) { ! error ("cannot declare bit-field `%D' with function type", ! DECL_NAME (value)); return NULL_TREE; } if (DECL_IN_AGGR_P (value)) { ! error ("`%D' is already defined in the class %T", value, DECL_CONTEXT (value)); return void_type_node; } if (TREE_STATIC (value)) { ! error ("static member `%D' cannot be a bit-field", value); return NULL_TREE; } cp_finish_decl (value, NULL_TREE, NULL_TREE, 0); *************** tree *** 1797,1803 **** grokoptypename (declspecs, declarator) tree declspecs, declarator; { ! tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, NULL_TREE); return mangle_conv_op_name_for_type (t); } --- 1711,1717 ---- grokoptypename (declspecs, declarator) tree declspecs, declarator; { ! tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, NULL); return mangle_conv_op_name_for_type (t); } *************** grokoptypename (declspecs, declarator) *** 1836,1863 **** */ - int - copy_assignment_arg_p (parmtype, virtualp) - tree parmtype; - int virtualp ATTRIBUTE_UNUSED; - { - if (current_class_type == NULL_TREE) - return 0; - - if (TREE_CODE (parmtype) == REFERENCE_TYPE) - parmtype = TREE_TYPE (parmtype); - - if ((TYPE_MAIN_VARIANT (parmtype) == current_class_type) - #if 0 - /* Non-standard hack to support old Booch components. */ - || (! virtualp && DERIVED_FROM_P (parmtype, current_class_type)) - #endif - ) - return 1; - - return 0; - } - static void grok_function_init (decl, init) tree decl; --- 1750,1755 ---- *************** grok_function_init (decl, init) *** 1868,1904 **** tree type = TREE_TYPE (decl); if (TREE_CODE (type) == FUNCTION_TYPE) ! cp_error ("initializer specified for non-member function `%D'", decl); else if (integer_zerop (init)) ! { ! DECL_PURE_VIRTUAL_P (decl) = 1; ! if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR) ! { ! tree parmtype ! = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl)))); ! ! if (copy_assignment_arg_p (parmtype, 1)) ! TYPE_HAS_ABSTRACT_ASSIGN_REF (current_class_type) = 1; ! } ! } else ! cp_error ("invalid initializer for virtual method `%D'", decl); } void ! cplus_decl_attributes (decl, attributes, prefix_attributes) ! tree decl, attributes, prefix_attributes; { ! if (decl == NULL_TREE || decl == void_type_node) return; ! if (TREE_CODE (decl) == TEMPLATE_DECL) ! decl = DECL_TEMPLATE_RESULT (decl); ! decl_attributes (decl, attributes, prefix_attributes); ! if (TREE_CODE (decl) == TYPE_DECL) ! SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (decl), TREE_TYPE (decl)); } /* CONSTRUCTOR_NAME: --- 1760,1787 ---- tree type = TREE_TYPE (decl); if (TREE_CODE (type) == FUNCTION_TYPE) ! error ("initializer specified for non-member function `%D'", decl); else if (integer_zerop (init)) ! DECL_PURE_VIRTUAL_P (decl) = 1; else ! error ("invalid initializer for virtual method `%D'", decl); } void ! cplus_decl_attributes (decl, attributes, flags) ! tree *decl, attributes; ! int flags; { ! if (*decl == NULL_TREE || *decl == void_type_node) return; ! if (TREE_CODE (*decl) == TEMPLATE_DECL) ! decl = &DECL_TEMPLATE_RESULT (*decl); ! decl_attributes (decl, attributes, flags); ! if (TREE_CODE (*decl) == TYPE_DECL) ! SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (*decl), TREE_TYPE (*decl)); } /* CONSTRUCTOR_NAME: *************** defer_fn (fn) *** 1963,2007 **** VARRAY_PUSH_TREE (deferred_fns, fn); } - /* Hand off a unique name which can be used for variable we don't really - want to know about anyway, for example, the anonymous variables which - are needed to make references work. Declare this thing so we can use it. - The variable created will be of type TYPE, and will have internal - linkage. */ - - tree - get_temp_name (type) - tree type; - { - char buf[sizeof (AUTO_TEMP_FORMAT) + 20]; - tree decl; - int toplev = toplevel_bindings_p (); - - sprintf (buf, AUTO_TEMP_FORMAT, global_temp_name_counter++); - decl = build_decl (VAR_DECL, get_identifier (buf), type); - DECL_ARTIFICIAL (decl) = 1; - TREE_USED (decl) = 1; - TREE_STATIC (decl) = 1; - - decl = pushdecl_top_level (decl); - - /* If this is a local variable, then lay out its rtl now. - Otherwise, callers of this function are responsible for dealing - with this variable's rtl. */ - if (! toplev) - { - expand_decl (decl); - my_friendly_assert (DECL_INITIAL (decl) == NULL_TREE, - 19990826); - } - - return decl; - } - /* 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. */ static tree build_anon_union_vars (anon_decl, elems, static_p, external_p) --- 1846,1858 ---- 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. */ static tree build_anon_union_vars (anon_decl, elems, static_p, external_p) *************** build_anon_union_vars (anon_decl, elems, *** 2091,2102 **** return main_decl; } ! /* Finish off the processing of a UNION_TYPE structure. ! If there are static members, then all members are ! static, and must be laid out together. If the ! union is an anonymous union, we arrange for that ! as well. PUBLIC_P is nonzero if this union is ! not declared static. */ void finish_anon_union (anon_union_decl) --- 1942,1950 ---- return main_decl; } ! /* Finish off the processing of a UNION_TYPE structure. If the union is an ! anonymous union, then all members must be laid out together. PUBLIC_P ! is nonzero if this union is not declared static. */ void finish_anon_union (anon_union_decl) *************** coerce_new_type (type) *** 2193,2199 **** my_friendly_assert (TREE_CODE (type) == FUNCTION_TYPE, 20001107); if (!same_type_p (TREE_TYPE (type), ptr_type_node)) ! e = 1, cp_error ("`operator new' must return type `%T'", ptr_type_node); if (!args || args == void_list_node || !same_type_p (TREE_VALUE (args), c_size_type_node)) --- 2041,2047 ---- my_friendly_assert (TREE_CODE (type) == FUNCTION_TYPE, 20001107); if (!same_type_p (TREE_TYPE (type), ptr_type_node)) ! e = 1, error ("`operator new' must return type `%T'", ptr_type_node); if (!args || args == void_list_node || !same_type_p (TREE_VALUE (args), c_size_type_node)) *************** coerce_new_type (type) *** 2201,2207 **** e = 2; if (args && args != void_list_node) args = TREE_CHAIN (args); ! cp_error ("`operator new' takes type `size_t' (`%T') as first parameter", c_size_type_node); } switch (e) { --- 2049,2055 ---- e = 2; if (args && args != void_list_node) args = TREE_CHAIN (args); ! pedwarn ("`operator new' takes type `size_t' (`%T') as first parameter", c_size_type_node); } switch (e) { *************** coerce_delete_type (type) *** 2228,2234 **** my_friendly_assert (TREE_CODE (type) == FUNCTION_TYPE, 20001107); if (!same_type_p (TREE_TYPE (type), void_type_node)) ! e = 1, cp_error ("`operator delete' must return type `%T'", void_type_node); if (!args || args == void_list_node || !same_type_p (TREE_VALUE (args), ptr_type_node)) --- 2076,2082 ---- my_friendly_assert (TREE_CODE (type) == FUNCTION_TYPE, 20001107); if (!same_type_p (TREE_TYPE (type), void_type_node)) ! e = 1, error ("`operator delete' must return type `%T'", void_type_node); if (!args || args == void_list_node || !same_type_p (TREE_VALUE (args), ptr_type_node)) *************** coerce_delete_type (type) *** 2236,2242 **** e = 2; if (args && args != void_list_node) args = TREE_CHAIN (args); ! cp_error ("`operator delete' takes type `%T' as first parameter", ptr_type_node); } switch (e) { --- 2084,2090 ---- e = 2; if (args && args != void_list_node) args = TREE_CHAIN (args); ! error ("`operator delete' takes type `%T' as first parameter", ptr_type_node); } switch (e) { *************** mark_vtable_entries (decl) *** 2262,2277 **** for (; entries; entries = TREE_CHAIN (entries)) { ! tree fnaddr; tree fn; ! ! fnaddr = (flag_vtable_thunks ? TREE_VALUE (entries) ! : FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (entries))); ! if (TREE_CODE (fnaddr) != ADDR_EXPR && TREE_CODE (fnaddr) != FDESC_EXPR) /* This entry is an offset: a virtual base class offset, a ! virtual call offset, and RTTI offset, etc. */ continue; fn = TREE_OPERAND (fnaddr, 0); --- 2110,2122 ---- for (; entries; entries = TREE_CHAIN (entries)) { ! tree fnaddr = TREE_VALUE (entries); tree fn; ! if (TREE_CODE (fnaddr) != ADDR_EXPR && TREE_CODE (fnaddr) != FDESC_EXPR) /* This entry is an offset: a virtual base class offset, a ! virtual call offset, an RTTI offset, etc. */ continue; fn = TREE_OPERAND (fnaddr, 0); *************** comdat_linkage (decl) *** 2307,2318 **** address, and this will not hold when we emit multiple copies of the function. However, there's little else we can do. ! Also, by default, the typeinfo implementation for the new ABI ! assumes that there will be only one copy of the string used as ! the name for each type. Therefore, if weak symbols are ! unavailable, the run-time library should perform a more ! conservative check; it should perform a string comparison, ! rather than an address comparison. */ TREE_PUBLIC (decl) = 0; else { --- 2152,2163 ---- address, and this will not hold when we emit multiple copies of the function. However, there's little else we can do. ! Also, by default, the typeinfo implementation assumes that ! there will be only one copy of the string used as the name for ! each type. Therefore, if weak symbols are unavailable, the ! run-time library should perform a more conservative check; it ! should perform a string comparison, rather than an address ! comparison. */ TREE_PUBLIC (decl) = 0; else { *************** maybe_make_one_only (decl) *** 2353,2359 **** after a weak one is an error. Also, not making explicit instantiations one_only means that we can end up with two copies of some template instantiations. */ ! if (! supports_one_only ()) return; /* We can't set DECL_COMDAT on functions, or finish_file will think --- 2198,2204 ---- after a weak one is an error. Also, not making explicit instantiations one_only means that we can end up with two copies of some template instantiations. */ ! if (! flag_weak) return; /* We can't set DECL_COMDAT on functions, or finish_file will think *************** maybe_make_one_only (decl) *** 2363,2370 **** make_decl_one_only (decl); ! if (TREE_CODE (decl) == VAR_DECL && DECL_LANG_SPECIFIC (decl)) ! DECL_COMDAT (decl) = 1; } /* Returns the virtual function with which the vtable for TYPE is --- 2208,2219 ---- make_decl_one_only (decl); ! if (TREE_CODE (decl) == VAR_DECL) ! { ! DECL_COMDAT (decl) = 1; ! /* Mark it needed so we don't forget to emit it. */ ! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) = 1; ! } } /* Returns the virtual function with which the vtable for TYPE is *************** key_method (type) *** 2385,2391 **** method = TREE_CHAIN (method)) if (DECL_VINDEX (method) != NULL_TREE && ! DECL_DECLARED_INLINE_P (method) ! && ! DECL_PURE_VIRTUAL_P (method)) return method; return NULL_TREE; --- 2234,2245 ---- method = TREE_CHAIN (method)) if (DECL_VINDEX (method) != NULL_TREE && ! DECL_DECLARED_INLINE_P (method) ! && (! DECL_PURE_VIRTUAL_P (method) ! #if 0 ! /* This would be nice, but we didn't think of it in time. */ ! || DECL_DESTRUCTOR_P (method) ! #endif ! )) return method; return NULL_TREE; *************** import_export_vtable (decl, type, final) *** 2414,2420 **** else if (CLASSTYPE_INTERFACE_KNOWN (type)) { TREE_PUBLIC (decl) = 1; ! DECL_EXTERNAL (decl) = ! CLASSTYPE_VTABLE_NEEDS_WRITING (type); DECL_INTERFACE_KNOWN (decl) = 1; } else --- 2268,2274 ---- else if (CLASSTYPE_INTERFACE_KNOWN (type)) { TREE_PUBLIC (decl) = 1; ! DECL_EXTERNAL (decl) = CLASSTYPE_INTERFACE_ONLY (type); DECL_INTERFACE_KNOWN (decl) = 1; } else *************** import_export_class (ctype) *** 2466,2478 **** if (CLASSTYPE_INTERFACE_ONLY (ctype)) return; - #ifdef VALID_MACHINE_TYPE_ATTRIBUTE - /* FIXME this should really use some sort of target-independent macro. */ if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (ctype))) import_export = -1; else if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (ctype))) import_export = 1; - #endif /* If we got -fno-implicit-templates, we import template classes that weren't explicitly instantiated. */ --- 2320,2329 ---- *************** import_export_class (ctype) *** 2499,2505 **** if (import_export) { SET_CLASSTYPE_INTERFACE_KNOWN (ctype); - CLASSTYPE_VTABLE_NEEDS_WRITING (ctype) = (import_export > 0); CLASSTYPE_INTERFACE_ONLY (ctype) = (import_export < 0); } } --- 2350,2355 ---- *************** output_vtable_inherit (vars) *** 2512,2534 **** tree vars; { tree parent; ! rtx op[2]; ! op[0] = XEXP (DECL_RTL (vars), 0); /* strip the mem ref */ parent = binfo_for_vtable (vars); if (parent == TYPE_BINFO (DECL_CONTEXT (vars))) ! op[1] = const0_rtx; else if (parent) { parent = get_vtbl_decl_for_binfo (TYPE_BINFO (BINFO_TYPE (parent))); ! op[1] = XEXP (DECL_RTL (parent), 0); /* strip the mem ref */ } else ! my_friendly_abort (980826); ! output_asm_insn (".vtable_inherit %c0, %c1", op); } static int --- 2362,2384 ---- tree vars; { 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 */ } else ! abort (); ! assemble_vtable_inherit (child_rtx, parent_rtx); } static int *************** finish_vtable_vardecl (t, data) *** 2584,2590 **** if (flag_weak) comdat_linkage (vars); ! rest_of_decl_compilation (vars, NULL_PTR, 1, 1); if (flag_vtable_gc) output_vtable_inherit (vars); --- 2434,2440 ---- if (flag_weak) comdat_linkage (vars); ! rest_of_decl_compilation (vars, NULL, 1, 1); if (flag_vtable_gc) output_vtable_inherit (vars); *************** import_export_decl (decl) *** 2673,2679 **** else comdat_linkage (decl); } ! else if (DECL_TINFO_FN_P (decl)) { tree ctype = TREE_TYPE (DECL_NAME (decl)); --- 2523,2529 ---- else comdat_linkage (decl); } ! else if (tinfo_decl_p (decl, 0)) { tree ctype = TREE_TYPE (DECL_NAME (decl)); *************** get_guard (decl) *** 2751,2758 **** { tree guard_type; ! /* Under the new ABI, we use a type that is big enough to ! contain a mutex as well as an integer counter. */ guard_type = long_long_integer_type_node; guard = build_decl (VAR_DECL, sname, guard_type); --- 2601,2608 ---- { tree guard_type; ! /* We use a type that is big enough to contain a mutex as well ! as an integer counter. */ guard_type = long_long_integer_type_node; guard = build_decl (VAR_DECL, sname, guard_type); *************** static tree *** 2779,2786 **** get_guard_bits (guard) tree guard; { ! /* Under the new ABI, we only set the first byte of the guard, ! in order to leave room for a mutex in the high-order bits. */ guard = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (guard)), guard); --- 2629,2636 ---- get_guard_bits (guard) tree guard; { ! /* We only set the first byte of the guard, in order to leave room ! for a mutex in the high-order bits. */ guard = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (guard)), guard); *************** start_objects (method_type, initp) *** 2861,2871 **** NULL_TREE), NULL_TREE, SF_DEFAULT); - #if defined(ASM_OUTPUT_CONSTRUCTOR) && defined(ASM_OUTPUT_DESTRUCTOR) /* It can be a static function as long as collect2 does not have to scan the object file to find its ctor/dtor routine. */ ! TREE_PUBLIC (current_function_decl) = 0; ! #endif /* Mark this declaration as used to avoid spurious warnings. */ TREE_USED (current_function_decl) = 1; --- 2711,2719 ---- NULL_TREE), NULL_TREE, SF_DEFAULT); /* It can be a static function as long as collect2 does not have to scan the object file to find its ctor/dtor routine. */ ! TREE_PUBLIC (current_function_decl) = ! targetm.have_ctors_dtors; /* Mark this declaration as used to avoid spurious warnings. */ TREE_USED (current_function_decl) = 1; *************** finish_objects (method_type, initp, body *** 2897,2903 **** int method_type, initp; tree body; { - const char *fnname; tree fn; /* Finish up. */ --- 2745,2750 ---- *************** finish_objects (method_type, initp, body *** 2911,2941 **** if (flag_syntax_only) return; ! fnname = XSTR (XEXP (DECL_RTL (fn), 0), 0); ! if (initp == DEFAULT_INIT_PRIORITY) { if (method_type == 'I') ! assemble_constructor (fnname); else ! assemble_destructor (fnname); ! } ! #if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR) ! /* If we're using init priority we can't use assemble_*tor, but on ELF ! targets we can stick the references into named sections for GNU ld ! to collect. */ ! else ! { ! char buf[15]; ! sprintf (buf, ".%ctors.%.5u", method_type == 'I' ? 'c' : 'd', ! /* invert the numbering so the linker puts us in the proper ! order; constructors are run from right to left, and the ! linker sorts in increasing order. */ ! MAX_INIT_PRIORITY - initp); ! named_section (NULL_TREE, buf, 0); ! assemble_integer (gen_rtx_SYMBOL_REF (Pmode, fnname), ! POINTER_SIZE / BITS_PER_UNIT, 1); } - #endif } /* The names of the parameters to the function created to handle --- 2758,2771 ---- if (flag_syntax_only) return; ! if (targetm.have_ctors_dtors) { + rtx fnsym = XEXP (DECL_RTL (fn), 0); if (method_type == 'I') ! (* targetm.asm_out.constructor) (fnsym, initp); else ! (* targetm.asm_out.destructor) (fnsym, initp); } } /* The names of the parameters to the function created to handle *************** start_static_storage_duration_function ( *** 2996,3002 **** /* Overflow occurred. That means there are at least 4 billion initialization functions. */ sorry ("too many initialization functions required"); ! my_friendly_abort (19990430); } /* Create the parameters. */ --- 2826,2832 ---- /* Overflow occurred. That means there are at least 4 billion initialization functions. */ sorry ("too many initialization functions required"); ! abort (); } /* Create the parameters. */ *************** finish_file () *** 3611,3617 **** not defined when they really are. This keeps these functions from being put out unnecessarily. But, we must stop lying when the functions are referenced, or if they are not comdat ! since they need to be put out now. */ for (i = 0; i < deferred_fns_used; ++i) { tree decl = VARRAY_TREE (deferred_fns, i); --- 3441,3451 ---- not defined when they really are. This keeps these functions from being put out unnecessarily. But, we must stop lying when the functions are referenced, or if they are not comdat ! since they need to be put out now. ! This is done in a separate for cycle, because if some deferred ! function is contained in another deferred function later in ! deferred_fns varray, rest_of_compilation would skip this ! function and we really cannot expand the same function twice. */ for (i = 0; i < deferred_fns_used; ++i) { tree decl = VARRAY_TREE (deferred_fns, i); *************** finish_file () *** 3620,3625 **** --- 3454,3464 ---- && DECL_INITIAL (decl) && DECL_NEEDED_P (decl)) DECL_EXTERNAL (decl) = 0; + } + + for (i = 0; i < deferred_fns_used; ++i) + { + tree decl = VARRAY_TREE (deferred_fns, i); /* If we're going to need to write this function out, and there's already a body for it, create RTL for it now. *************** finish_file () *** 3628,3634 **** if (!DECL_EXTERNAL (decl) && DECL_NEEDED_P (decl) && DECL_SAVED_TREE (decl) - && !DECL_SAVED_INSNS (decl) && !TREE_ASM_WRITTEN (decl)) { int saved_not_really_extern; --- 3467,3472 ---- *************** finish_file () *** 3723,3733 **** } } - /* If there's some tool that wants to examine the entire translation - unit, let it do so now. */ - if (back_end_hook) - (*back_end_hook) (global_namespace); - timevar_pop (TV_VARCONST); if (flag_detailed_statistics) --- 3561,3566 ---- *************** reparse_absdcl_as_casts (decl, expr) *** 3780,3785 **** --- 3613,3619 ---- tree decl, expr; { tree type; + int non_void_p = 0; if (TREE_CODE (expr) == CONSTRUCTOR && TREE_TYPE (expr) == 0) *************** reparse_absdcl_as_casts (decl, expr) *** 3787,3798 **** type = groktypename (TREE_VALUE (CALL_DECLARATOR_PARMS (decl))); decl = TREE_OPERAND (decl, 0); ! 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); ! if (failure) ! my_friendly_abort (78); } } --- 3621,3636 ---- 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); ! } } } *************** reparse_absdcl_as_casts (decl, expr) *** 3800,3810 **** { type = groktypename (TREE_VALUE (CALL_DECLARATOR_PARMS (decl))); decl = TREE_OPERAND (decl, 0); expr = build_c_cast (type, expr); } if (warn_old_style_cast && ! in_system_header ! && current_lang_name != lang_name_c) warning ("use of old-style cast"); return expr; --- 3638,3650 ---- { type = groktypename (TREE_VALUE (CALL_DECLARATOR_PARMS (decl))); decl = TREE_OPERAND (decl, 0); + if (!VOID_TYPE_P (type)) + non_void_p = 1; expr = build_c_cast (type, expr); } if (warn_old_style_cast && ! in_system_header ! && non_void_p && current_lang_name != lang_name_c) warning ("use of old-style cast"); return expr; *************** build_expr_from_tree (t) *** 3933,3940 **** { tree r = build_expr_from_tree (TREE_OPERAND (t, 0)); if (!TYPE_P (r)) ! r = TREE_TYPE (r); ! return TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r); } case MODOP_EXPR: --- 3773,3781 ---- { 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 TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r); } case MODOP_EXPR: *************** build_expr_from_tree (t) *** 3965,3971 **** return build_x_compound_expr (build_expr_from_tree (TREE_OPERAND (t, 0))); else ! my_friendly_abort (42); case METHOD_CALL_EXPR: if (TREE_CODE (TREE_OPERAND (t, 0)) == SCOPE_REF) --- 3806,3812 ---- 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) *************** build_expr_from_tree (t) *** 4099,4115 **** case CONSTRUCTOR: { tree r; /* digest_init will do the wrong thing if we let it. */ ! if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))) return t; ! r = build_nt (CONSTRUCTOR, NULL_TREE, ! build_expr_from_tree (CONSTRUCTOR_ELTS (t))); TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t); ! if (TREE_TYPE (t)) ! return digest_init (TREE_TYPE (t), r, 0); return r; } --- 3940,3974 ---- 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; } *************** tree *** 4156,4163 **** finish_decl_parsing (decl) tree decl; { - extern int current_class_depth; - switch (TREE_CODE (decl)) { case IDENTIFIER_NODE: --- 4015,4020 ---- *************** finish_decl_parsing (decl) *** 4185,4191 **** case TEMPLATE_ID_EXPR: return decl; default: ! my_friendly_abort (5); return NULL_TREE; } } --- 4042,4048 ---- case TEMPLATE_ID_EXPR: return decl; default: ! abort (); return NULL_TREE; } } *************** ambiguous_decl (name, old, new, flags) *** 4339,4344 **** --- 4196,4206 ---- 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; *************** ambiguous_decl (name, old, new, flags) *** 4364,4370 **** repeat ourselves. */ if (BINDING_VALUE (old) != error_mark_node) { ! cp_error ("use of `%D' is ambiguous", name); cp_error_at (" first declared as `%#D' here", BINDING_VALUE (old)); } --- 4226,4232 ---- 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)); } *************** ambiguous_decl (name, old, new, flags) *** 4383,4389 **** { if (flags & LOOKUP_COMPLAIN) { ! cp_error ("`%D' denotes an ambiguous type",name); cp_error_at (" first type here", BINDING_TYPE (old)); cp_error_at (" other type here", type); } --- 4245,4251 ---- { 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); } *************** set_decl_namespace (decl, scope, friendp *** 4476,4489 **** int friendp; { tree old; ! if (scope == fake_std_node) ! scope = global_namespace; /* Get rid of namespace aliases. */ scope = ORIGINAL_NAMESPACE (scope); /* It is ok for friends to be qualified in parallel space. */ if (!friendp && !is_namespace_ancestor (current_namespace, scope)) ! cp_error ("declaration of `%D' not in a namespace surrounding `%D'", decl, scope); DECL_CONTEXT (decl) = FROB_CONTEXT (scope); if (scope != current_namespace) --- 4338,4350 ---- 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_namespace_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) *************** set_decl_namespace (decl, scope, friendp *** 4517,4523 **** else return; complain: ! cp_error ("`%D' should have been declared inside `%D'", decl, scope); } --- 4378,4384 ---- else return; complain: ! error ("`%D' should have been declared inside `%D'", decl, scope); } *************** add_function (k, fn) *** 4653,4659 **** } cp_error_at ("`%D' is not a function,", f1); cp_error_at (" conflict with `%D'", f2); ! cp_error (" in call to `%D'", k->name); return 1; } --- 4514,4520 ---- } 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; } *************** arg_assoc_template_arg (k, arg) *** 4705,4711 **** contribute to the set of associated namespaces. ] */ /* Consider first template template arguments. */ ! if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM) return 0; else if (TREE_CODE (arg) == TEMPLATE_DECL) { --- 4566,4573 ---- 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) { *************** arg_assoc_type (k, type) *** 4833,4839 **** return 0; /* else fall through */ default: ! my_friendly_abort (390); } return 0; } --- 4695,4701 ---- return 0; /* else fall through */ default: ! abort (); } return 0; } *************** do_namespace_alias (alias, namespace) *** 4965,4971 **** if (TREE_CODE (namespace) != NAMESPACE_DECL) { /* The parser did not find it, so it's not there. */ ! cp_error ("unknown namespace `%D'", namespace); return; } --- 4827,4833 ---- if (TREE_CODE (namespace) != NAMESPACE_DECL) { /* The parser did not find it, so it's not there. */ ! error ("unknown namespace `%D'", namespace); return; } *************** validate_nonmember_using_decl (decl, sco *** 4986,5015 **** tree *scope; tree *name; { ! if (TREE_CODE (decl) == SCOPE_REF ! && TREE_OPERAND (decl, 0) == fake_std_node) ! { ! *scope = global_namespace; ! *name = TREE_OPERAND (decl, 1); ! } ! else if (TREE_CODE (decl) == SCOPE_REF) { *scope = TREE_OPERAND (decl, 0); *name = TREE_OPERAND (decl, 1); ! /* [namespace.udecl] ! ! A using-declaration for a class member shall be a ! member-declaration. */ ! if (!processing_template_decl ! && TREE_CODE (*scope) != NAMESPACE_DECL) ! { ! if (TYPE_P (*scope)) ! cp_error ("`%T' is not a namespace", *scope); ! else ! cp_error ("`%D' is not a namespace", *scope); ! return NULL_TREE; ! } } else if (TREE_CODE (decl) == IDENTIFIER_NODE || TREE_CODE (decl) == TYPE_DECL --- 4848,4881 ---- 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 *************** validate_nonmember_using_decl (decl, sco *** 5018,5025 **** *scope = global_namespace; *name = decl; } else ! my_friendly_abort (382); if (DECL_P (*name)) *name = DECL_NAME (*name); /* Make a USING_DECL. */ --- 4884,4896 ---- *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. */ *************** do_nonmember_using_decl (scope, name, ol *** 5044,5050 **** if (!BINDING_VALUE (decls) && !BINDING_TYPE (decls)) { ! cp_error ("`%D' not declared", name); return; } --- 4915,4921 ---- if (!BINDING_VALUE (decls) && !BINDING_TYPE (decls)) { ! error ("`%D' not declared", name); return; } *************** do_nonmember_using_decl (scope, name, ol *** 5082,5092 **** 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)) ! cp_error ("`%D' is already declared in this scope", name); break; } } --- 4953,4972 ---- else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)), TYPE_ARG_TYPES (TREE_TYPE (old_fn)))) { + /* If this using declaration introduces a function + recognized as a built-in, no longer mark it as + anticipated in this scope. */ + if (DECL_ANTICIPATED (old_fn)) + { + DECL_ANTICIPATED (old_fn) = 0; + break; + } + /* There was already a non-using declaration in this scope with the same parameter types. If both are the same extern "C" functions, that's ok. */ if (!decls_match (new_fn, old_fn)) ! error ("`%D' is already declared in this scope", name); break; } } *************** do_nonmember_using_decl (scope, name, ol *** 5113,5119 **** *newtype = BINDING_TYPE (decls); if (oldtype && *newtype && oldtype != *newtype) { ! cp_error ("using directive `%D' introduced ambiguous type `%T'", name, oldtype); return; } --- 4993,4999 ---- *newtype = BINDING_TYPE (decls); if (oldtype && *newtype && oldtype != *newtype) { ! error ("using declaration `%D' introduced ambiguous type `%T'", name, oldtype); return; } *************** do_class_using_decl (decl) *** 5204,5219 **** if (TREE_CODE (decl) != SCOPE_REF || !TYPE_P (TREE_OPERAND (decl, 0))) { ! cp_error ("using-declaration for non-member at class scope"); return NULL_TREE; } name = TREE_OPERAND (decl, 1); if (TREE_CODE (name) == BIT_NOT_EXPR) { ! cp_error ("using-declaration for destructor"); return NULL_TREE; } ! if (TREE_CODE (name) == TYPE_DECL) name = DECL_NAME (name); my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 980716); --- 5084,5105 ---- 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); my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 980716); *************** void *** 5229,5236 **** do_using_directive (namespace) tree namespace; { - if (namespace == fake_std_node) - return; if (building_stmt_tree ()) add_stmt (build_stmt (USING_STMT, namespace)); --- 5115,5120 ---- *************** do_using_directive (namespace) *** 5241,5253 **** { /* Lookup in lexer did not find a namespace. */ if (!processing_template_decl) ! cp_error ("namespace `%T' undeclared", namespace); return; } if (TREE_CODE (namespace) != NAMESPACE_DECL) { if (!processing_template_decl) ! cp_error ("`%T' is not a namespace", namespace); return; } namespace = ORIGINAL_NAMESPACE (namespace); --- 5125,5137 ---- { /* 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); *************** mark_used (decl) *** 5311,5382 **** instantiate_decl (decl, /*defer_ok=*/1); } ! /* Helper function for named_class_head_sans_basetype nonterminal. We ! have just seen something of the form `AGGR SCOPE::ID'. Return a ! TYPE_DECL for the type declared by ID in SCOPE. */ tree ! handle_class_head (aggr, scope, id) tree aggr, scope, id; { tree decl = NULL_TREE; ! ! 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 ! { ! tree current = current_scope (); ! if (current == NULL_TREE) ! current = current_namespace; ! if (scope == fake_std_node) ! scope = global_namespace; ! if (scope == NULL_TREE) ! scope = global_namespace; ! if (TYPE_P (scope)) { ! /* According to the suggested resolution of core issue 180, ! 'typename' is assumed after a class-key. */ ! decl = make_typename_type (scope, id, 1); ! if (decl != error_mark_node) ! decl = TYPE_MAIN_DECL (decl); else ! decl = NULL_TREE; } - else if (scope == current) - { - /* We've been given AGGR SCOPE::ID, when we're already inside SCOPE. - Be nice about it. */ - if (pedantic) - cp_pedwarn ("extra qualification `%T::' on member `%D' ignored", - FROB_CONTEXT (scope), id); - } - else if (scope != global_namespace) - cp_error ("`%T' does not have a nested type named `%D'", scope, id); - else - cp_error ("no file-scope type named `%D'", id); - - /* Inject it at the current scope. */ - if (! decl) - decl = TYPE_MAIN_DECL (xref_tag (aggr, id, 1)); } ! ! /* Enter the SCOPE. If this turns out not to be a definition, the ! parser must leave the scope. */ ! push_scope (CP_DECL_CONTEXT (decl)); ! /* If we see something like: ! template struct S::I .... ! ! we must create a TEMPLATE_DECL for the nested type. */ ! if (PROCESSING_REAL_TEMPLATE_DECL_P ()) ! decl = push_template_decl (decl); return decl; } --- 5195,5292 ---- instantiate_decl (decl, /*defer_ok=*/1); } ! /* Helper function for class_head_decl and class_head_defn ! nonterminals. AGGR is the class, union or struct tag. SCOPE is the ! explicit scope used (NULL for no scope resolution). ID is the ! name. DEFN_P is true, if this is a definition of the class and ! NEW_TYPE_P is set to non-zero, if we push into the scope containing ! the to be defined aggregate. ! ! Return a TYPE_DECL for the type declared by ID in SCOPE. */ tree ! handle_class_head (aggr, scope, id, defn_p, new_type_p) tree aggr, scope, id; + int defn_p; + int *new_type_p; { tree decl = NULL_TREE; ! 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 = TYPE_MAIN_DECL (xref_tag (aggr, id, !defn_p)); ! xrefd_p = true; ! } ! if (!TYPE_BINFO (TREE_TYPE (decl))) ! { ! error ("`%T' is not a class or union type", decl); ! return error_mark_node; ! } ! ! if (defn_p) ! { ! /* For a definition, we want to enter the containing scope ! before looking up any base classes etc. Only do so, if this ! is different to the current scope. */ ! tree context = CP_DECL_CONTEXT (decl); ! *new_type_p = (current != context ! && 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 legal to define a class with a different class key, ! and this changes the default member access. */ ! CLASSTYPE_DECLARED_CLASS (TREE_TYPE (decl)) ! = aggr == class_type_node; ! ! if (!xrefd_p && PROCESSING_REAL_TEMPLATE_DECL_P ()) ! decl = push_template_decl (decl); ! } return decl; } *************** handle_class_head (aggr, scope, id) *** 5386,5397 **** void init_decl2 () { - ggc_add_tree_root (&decl_namespace_list, 1); ggc_add_tree_varray_root (&deferred_fns, 1); ggc_add_tree_varray_root (&pending_statics, 1); ggc_add_tree_varray_root (&ssdf_decls, 1); ggc_add_tree_root (&ssdf_decl, 1); ggc_add_tree_root (&priority_decl, 1); ggc_add_tree_root (&initialize_p_decl, 1); - ggc_add_tree_root (&pending_vtables, 1); } --- 5296,5305 ---- diff -Nrc3pad gcc-3.0.4/gcc/cp/dump.c gcc-3.1/gcc/cp/dump.c *** gcc-3.0.4/gcc/cp/dump.c Tue Jun 5 07:47:05 2001 --- gcc-3.1/gcc/cp/dump.c Sat Mar 16 01:08:03 2002 *************** *** 1,5 **** /* Tree-dumping functionality for intermediate representation. ! Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. Written by Mark Mitchell This file is part of GNU CC. --- 1,5 ---- /* Tree-dumping functionality for intermediate representation. ! Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Mark Mitchell This file is part of GNU CC. *************** Boston, MA 02111-1307, USA. */ *** 23,33 **** #include "system.h" #include "tree.h" #include "cp-tree.h" ! #include "c-dump.h" static void dump_access PARAMS ((dump_info_p, tree)); /* Dump a representation of the accessibility information associated with T. */ --- 23,36 ---- #include "system.h" #include "tree.h" #include "cp-tree.h" ! #include "tree-dump.h" static void dump_access PARAMS ((dump_info_p, tree)); + static void dump_op + PARAMS ((dump_info_p, tree)); + /* Dump a representation of the accessibility information associated with T. */ *************** dump_access (di, t) *** 44,55 **** dump_string (di, "public"); } ! int ! cp_dump_tree (di, t) dump_info_p di; tree t; { enum tree_code code; /* Figure out what kind of node this is. */ code = TREE_CODE (t); --- 47,219 ---- dump_string (di, "public"); } ! /* Dump a representation of the specific operator for an overloaded ! operator associated with node t. ! */ ! ! static void ! dump_op (di, t) dump_info_p di; tree t; { + switch (DECL_OVERLOADED_OPERATOR_P (t)) { + case NEW_EXPR: + dump_string (di, "new"); + break; + case VEC_NEW_EXPR: + dump_string (di, "vecnew"); + break; + case DELETE_EXPR: + dump_string (di, "delete"); + break; + case VEC_DELETE_EXPR: + dump_string (di, "vecdelete"); + break; + case CONVERT_EXPR: + dump_string (di, "pos"); + break; + case NEGATE_EXPR: + dump_string (di, "neg"); + break; + case ADDR_EXPR: + dump_string (di, "addr"); + break; + case INDIRECT_REF: + dump_string(di, "deref"); + break; + case BIT_NOT_EXPR: + dump_string(di, "not"); + break; + case TRUTH_NOT_EXPR: + dump_string(di, "lnot"); + break; + case PREINCREMENT_EXPR: + dump_string(di, "preinc"); + break; + case PREDECREMENT_EXPR: + dump_string(di, "predec"); + break; + case PLUS_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "plusassign"); + else + dump_string(di, "plus"); + break; + case MINUS_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "minusassign"); + else + dump_string(di, "minus"); + break; + case MULT_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "multassign"); + else + dump_string (di, "mult"); + break; + case TRUNC_DIV_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "divassign"); + else + dump_string (di, "div"); + break; + case TRUNC_MOD_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "modassign"); + else + dump_string (di, "mod"); + break; + case BIT_AND_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "andassign"); + else + dump_string (di, "and"); + break; + case BIT_IOR_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "orassign"); + else + dump_string (di, "or"); + break; + case BIT_XOR_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "xorassign"); + else + dump_string (di, "xor"); + break; + case LSHIFT_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "lshiftassign"); + else + dump_string (di, "lshift"); + break; + case RSHIFT_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "rshiftassign"); + else + dump_string (di, "rshift"); + break; + case EQ_EXPR: + dump_string (di, "eq"); + break; + case NE_EXPR: + dump_string (di, "ne"); + break; + case LT_EXPR: + dump_string (di, "lt"); + break; + case GT_EXPR: + dump_string (di, "gt"); + break; + case LE_EXPR: + dump_string (di, "le"); + break; + case GE_EXPR: + dump_string (di, "ge"); + break; + case TRUTH_ANDIF_EXPR: + dump_string (di, "land"); + break; + case TRUTH_ORIF_EXPR: + dump_string (di, "lor"); + break; + case COMPOUND_EXPR: + dump_string (di, "compound"); + break; + case MEMBER_REF: + dump_string (di, "memref"); + break; + case COMPONENT_REF: + dump_string (di, "ref"); + break; + case ARRAY_REF: + dump_string (di, "subs"); + break; + case POSTINCREMENT_EXPR: + dump_string (di, "postinc"); + break; + case POSTDECREMENT_EXPR: + dump_string (di, "postdec"); + break; + case CALL_EXPR: + dump_string (di, "call"); + break; + case NOP_EXPR: + if (DECL_ASSIGNMENT_OPERATOR_P (t)) + dump_string (di, "assign"); + break; + default: + break; + } + } + + int + cp_dump_tree (dump_info, t) + void *dump_info; + tree t; + { enum tree_code code; + dump_info_p di = (dump_info_p) dump_info; /* Figure out what kind of node this is. */ code = TREE_CODE (t); *************** cp_dump_tree (di, t) *** 101,106 **** --- 265,272 ---- } dump_child ("vfld", TYPE_VFIELD (t)); + if (CLASSTYPE_TEMPLATE_SPECIALIZATION(t)) + dump_string(di, "spec"); if (!dump_flag (di, TDF_SLIM, t)) { *************** cp_dump_tree (di, t) *** 119,140 **** case FIELD_DECL: dump_access (di, t); break; case FUNCTION_DECL: if (!DECL_THUNK_P (t)) { if (DECL_FUNCTION_MEMBER_P (t)) { dump_string (di, "member"); dump_access (di, t); } if (DECL_CONSTRUCTOR_P (t)) dump_string (di, "constructor"); if (DECL_DESTRUCTOR_P (t)) dump_string (di, "destructor"); - if (DECL_OVERLOADED_OPERATOR_P (t)) - dump_string (di, "operator"); if (DECL_CONV_FN_P (t)) dump_string (di, "conversion"); if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t)) --- 285,321 ---- case FIELD_DECL: dump_access (di, t); + if (DECL_MUTABLE_P (t)) + dump_string(di, "mutable"); break; + case VAR_DECL: + if (TREE_CODE (CP_DECL_CONTEXT (t)) == RECORD_TYPE) + dump_access (di, t); + if (TREE_STATIC (t) && !TREE_PUBLIC (t)) + dump_string (di, "static"); + break; + case FUNCTION_DECL: if (!DECL_THUNK_P (t)) { + if (DECL_OVERLOADED_OPERATOR_P (t)) { + dump_string (di, "operator"); + dump_op (di, t); + } if (DECL_FUNCTION_MEMBER_P (t)) { dump_string (di, "member"); dump_access (di, t); } + if (DECL_PURE_VIRTUAL_P (t)) + dump_string (di, "pure"); + if (DECL_VIRTUAL_P (t)) + dump_string (di, "virtual"); if (DECL_CONSTRUCTOR_P (t)) dump_string (di, "constructor"); if (DECL_DESTRUCTOR_P (t)) dump_string (di, "destructor"); if (DECL_CONV_FN_P (t)) dump_string (di, "conversion"); if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t)) *************** cp_dump_tree (di, t) *** 158,167 **** break; case NAMESPACE_DECL: - /* The fake `::std' namespace does not have DECL_LANG_SPECIFIC, - and therefore many other macros do not work on it. */ - if (t == fake_std_node) - break; if (DECL_NAMESPACE_ALIAS (t)) dump_child ("alis", DECL_NAMESPACE_ALIAS (t)); else if (!dump_flag (di, TDF_SLIM, t)) --- 339,344 ---- *************** cp_dump_tree (di, t) *** 213,225 **** dump_child ("decl", TREE_OPERAND (t, 2)); break; - case CLEANUP_STMT: - dump_stmt (di, t); - dump_child ("decl", CLEANUP_DECL (t)); - dump_child ("expr", CLEANUP_EXPR (t)); - dump_next_stmt (di, t); - break; - case CTOR_STMT: dump_stmt (di, t); if (CTOR_BEGIN_P (t)) --- 390,395 ---- *************** cp_dump_tree (di, t) *** 231,236 **** --- 401,407 ---- case HANDLER: dump_stmt (di, t); + dump_child ("parm", HANDLER_PARMS (t)); dump_child ("body", HANDLER_BODY (t)); dump_next_stmt (di, t); break; *************** cp_dump_tree (di, t) *** 247,258 **** dump_next_stmt (di, t); break; - case START_CATCH_STMT: - dump_stmt (di, t); - queue_and_dump_type (di, t); - dump_next_stmt (di, t); - break; - case USING_STMT: dump_stmt (di, t); dump_child ("nmsp", USING_STMT_NAMESPACE (t)); --- 418,423 ---- diff -Nrc3pad gcc-3.0.4/gcc/cp/errfn.c gcc-3.1/gcc/cp/errfn.c *** gcc-3.0.4/gcc/cp/errfn.c Wed Feb 14 10:12:54 2001 --- gcc-3.1/gcc/cp/errfn.c Thu Jan 1 00:00:00 1970 *************** *** 1,344 **** - /* Provide a call-back mechanism for handling error output. - Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 - Free Software Foundation, Inc. - Contributed by Jason Merrill (jason@cygnus.com) - - This file is part of GNU CC. - - GNU CC is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GNU CC is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNU CC; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - - #include "config.h" - #include "system.h" - #include "tree.h" - #include "cp-tree.h" - #include "toplev.h" - - /* Whether or not we should try to be quiet for errors and warnings; this is - used to avoid being too talkative about problems with tentative choices - when we're computing the conversion costs for a method call. */ - int cp_silent = 0; - - typedef void errorfn (); /* deliberately vague */ - - static void cp_thing PARAMS ((errorfn *, int, const char *, va_list)); - - #define STRDUP(f) (ap = (char *) alloca (strlen (f) +1), strcpy (ap, (f)), ap) - - /* This function supports only `%s', `%d', `%%', and the C++ print - codes. */ - - static void - cp_thing (errfn, atarg1, format, ap) - errorfn *errfn; - int atarg1; - const char *format; - va_list ap; - { - static char *buf; - static long buflen; - int nargs = 0; - long len; - long offset; - const char *f; - tree atarg = 0; - - len = strlen (format) + 1; - if (len > buflen) - { - buflen = len; - buf = xrealloc (buf, buflen); - } - offset = 0; - - for (f = format; *f; ++f) - { - cp_printer * function; - int alternate; - int maybe_here; - - /* ignore text */ - if (*f != '%') - { - buf[offset++] = *f; - continue; - } - - ++f; - - alternate = 0; - maybe_here = 0; - - /* Check for '+' and '#' (in that order). */ - if (*f == '+') - { - maybe_here = 1; - ++f; - } - if (*f == '#') - { - alternate = 1; - ++f; - } - - /* no field width or precision */ - - function = cp_printers[(int)*f]; - - if (function || *f == 's') - { - const char *p; - int plen; - - if (*f == 's') - { - p = va_arg (ap, char *); - nargs++; - } - else - { - tree t = va_arg (ap, tree); - nargs++; - - /* This indicates that ATARG comes from a different - location than normal. */ - if (maybe_here && atarg1) - atarg = t; - - /* If atarg1 is set and this is the first argument, then - set ATARG appropriately. */ - if (atarg1 && nargs == 1) - atarg = t; - - p = (*function) (t, alternate); - } - - plen = strlen (p); - len += plen; - if (len > buflen) - { - buflen = len; - buf = xrealloc (buf, len); - } - strcpy (buf + offset, p); - offset += plen; - } - else if (*f == '%') - { - /* A `%%' has occurred in the input string. Replace it with - a `%' in the formatted message buf. */ - - if (++len > buflen) - { - buflen = len; - buf = xrealloc (buf, len); - } - buf[offset++] = '%'; - } - else - { - if (*f != 'd') - abort (); - len += HOST_BITS_PER_INT / 2; - if (len > buflen) - { - buflen = len; - buf = xrealloc (buf, len); - } - sprintf (buf + offset, "%d", va_arg (ap, int)); - nargs++; - offset += strlen (buf + offset); - /* With an ANSI C library one could write - out += sprintf (...); */ - } - } - buf[offset] = '\0'; - - /* If ATARG1 is set, but we haven't extracted any arguments, then - extract one tree argument for ATARG. */ - if (nargs == 0 && atarg1) - atarg = va_arg (ap, tree); - - if (atarg) - { - const char *file = cp_file_of (atarg); - int line = cp_line_of (atarg); - (*errfn) (file, line, "%s", buf); - } - else - (*errfn) ("%s", buf); - - } - - void - cp_error VPARAMS ((const char *format, ...)) - { - #ifndef ANSI_PROTOTYPES - char *format; - #endif - va_list ap; - - VA_START (ap, format); - - #ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); - #endif - - if (! cp_silent) - cp_thing ((errorfn *) error, 0, format, ap); - va_end (ap); - } - - void - cp_warning VPARAMS ((const char *format, ...)) - { - #ifndef ANSI_PROTOTYPES - char *format; - #endif - va_list ap; - - VA_START (ap, format); - - #ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); - #endif - - if (! cp_silent) - cp_thing ((errorfn *) warning, 0, format, ap); - va_end (ap); - } - - void - cp_pedwarn VPARAMS ((const char *format, ...)) - { - #ifndef ANSI_PROTOTYPES - char *format; - #endif - va_list ap; - - VA_START (ap, format); - - #ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); - #endif - - if (! cp_silent) - cp_thing ((errorfn *) pedwarn, 0, format, ap); - va_end (ap); - } - - void - cp_compiler_error VPARAMS ((const char *format, ...)) - { - #ifndef ANSI_PROTOTYPES - char *format; - #endif - va_list ap; - - VA_START (ap, format); - - #ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); - #endif - - if (! cp_silent) - cp_thing ((errorfn *) compiler_error, 0, format, ap); - va_end (ap); - } - - void - cp_deprecated (msg) - const char *msg; - { - extern int warn_deprecated; - if (!warn_deprecated) - return; - cp_warning ("%s is deprecated, please see the documentation for details", msg); - } - - void - cp_sprintf VPARAMS ((const char *format, ...)) - { - #ifndef ANSI_PROTOTYPES - char *format; - #endif - va_list ap; - - VA_START (ap, format); - - #ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); - #endif - - cp_thing ((errorfn *) sprintf, 0, format, ap); - va_end (ap); - } - - void - cp_error_at VPARAMS ((const char *format, ...)) - { - #ifndef ANSI_PROTOTYPES - char *format; - #endif - va_list ap; - - VA_START (ap, format); - - #ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); - #endif - - if (! cp_silent) - cp_thing ((errorfn *) error_with_file_and_line, 1, format, ap); - va_end (ap); - } - - void - cp_warning_at VPARAMS ((const char *format, ...)) - { - #ifndef ANSI_PROTOTYPES - char *format; - #endif - va_list ap; - - VA_START (ap, format); - - #ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); - #endif - - if (! cp_silent) - cp_thing ((errorfn *) warning_with_file_and_line, 1, format, ap); - va_end (ap); - } - - void - cp_pedwarn_at VPARAMS ((const char *format, ...)) - { - #ifndef ANSI_PROTOTYPES - char *format; - #endif - va_list ap; - - VA_START (ap, format); - - #ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); - #endif - - if (! cp_silent) - cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, format, ap); - va_end (ap); - } --- 0 ---- diff -Nrc3pad gcc-3.0.4/gcc/cp/error.c gcc-3.1/gcc/cp/error.c *** gcc-3.0.4/gcc/cp/error.c Sat Sep 15 19:43:41 2001 --- gcc-3.1/gcc/cp/error.c Wed May 1 16:29:27 2002 *************** *** 1,6 **** /* Call-backs for C++ error reporting. This code is non-reentrant. ! Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of GNU CC. --- 1,6 ---- /* 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. *************** Boston, MA 02111-1307, USA. */ *** 26,70 **** #include "real.h" #include "obstack.h" #include "toplev.h" #include "diagnostic.h" enum pad { none, before, after }; - /* This data structure bundles altogether, all the information necessary - for pretty-printing a C++ source-level entity represented by a tree. */ - typedef struct - { - tree decl; - int flags; - enum pad pad; - } tree_formatting_info, *tfi_t; - - #define tree_being_formatted(TFI) (TFI)->decl - #define tree_formatting_flags(TFI) (TFI)->flags - #define put_whitespace(TFI) (TFI)->pad - #define sorry_for_unsupported_tree(T) \ sorry ("`%s' not supported by %s", tree_code_name[(int) TREE_CODE (T)], \ __FUNCTION__) ! #define print_scope_operator(BUFFER) output_add_string (BUFFER, "::") ! #define print_left_paren(BUFFER) output_add_character (BUFFER, '(') ! #define print_right_paren(BUFFER) output_add_character (BUFFER, ')') ! #define print_left_bracket(BUFFER) output_add_character (BUFFER, '[') ! #define print_right_bracket(BUFFER) output_add_character (BUFFER, ']') #define print_template_argument_list_start(BUFFER) \ ! print_non_consecutive_character (BUFFER, '<') #define print_template_argument_list_end(BUFFER) \ ! print_non_consecutive_character (BUFFER, '>') #define print_whitespace(BUFFER, TFI) \ do { \ output_add_space (BUFFER); \ put_whitespace (TFI) = none; \ } while (0) #define print_tree_identifier(BUFFER, TID) \ ! output_add_string (BUFFER, IDENTIFIER_POINTER (TID)) ! #define print_identifier(BUFFER, ID) output_add_string (BUFFER, ID) ! #define separate_with_comma(BUFFER) output_add_string (BUFFER, ", ") /* The global buffer where we dump everything. It is there only for transitional purpose. It is expected, in the near future, to be --- 26,58 ---- #include "real.h" #include "obstack.h" #include "toplev.h" + #include "flags.h" #include "diagnostic.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_whitespace(BUFFER, TFI) \ do { \ output_add_space (BUFFER); \ put_whitespace (TFI) = none; \ } while (0) #define print_tree_identifier(BUFFER, TID) \ ! output_add_string ((BUFFER), IDENTIFIER_POINTER (TID)) ! #define print_identifier(BUFFER, ID) output_add_string ((BUFFER), (ID)) ! #define separate_with_comma(BUFFER) output_add_string ((BUFFER), ", ") /* The global buffer where we dump everything. It is there only for transitional purpose. It is expected, in the near future, to be *************** typedef struct *** 72,78 **** static output_buffer scratch_buffer_rec; static output_buffer *scratch_buffer = &scratch_buffer_rec; ! # define NEXT_CODE(t) (TREE_CODE (TREE_TYPE (t))) #define reinit_global_formatting_buffer() \ output_clear_message_text (scratch_buffer) --- 60,66 ---- static output_buffer scratch_buffer_rec; static output_buffer *scratch_buffer = &scratch_buffer_rec; ! # define NEXT_CODE(T) (TREE_CODE (TREE_TYPE (T))) #define reinit_global_formatting_buffer() \ output_clear_message_text (scratch_buffer) *************** static void dump_char PARAMS ((int)); *** 108,114 **** 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 tree ident_fndecl 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)); --- 96,101 ---- *************** static void dump_scope PARAMS ((tree, in *** 117,123 **** static void dump_template_parms PARAMS ((tree, int, int)); static const char *function_category PARAMS ((tree)); ! static void lang_print_error_function PARAMS ((const char *)); static void maybe_print_instantiation_context PARAMS ((output_buffer *)); static void print_instantiation_full_context PARAMS ((output_buffer *)); static void print_instantiation_partial_context PARAMS ((output_buffer *, tree, --- 104,111 ---- static void dump_template_parms PARAMS ((tree, int, int)); static const char *function_category PARAMS ((tree)); ! static void lang_print_error_function PARAMS ((diagnostic_context *, ! const char *)); static void maybe_print_instantiation_context PARAMS ((output_buffer *)); static void print_instantiation_full_context PARAMS ((output_buffer *)); static void print_instantiation_partial_context PARAMS ((output_buffer *, tree, *************** static void cp_diagnostic_finalizer PARA *** 129,203 **** static void cp_print_error_function PARAMS ((output_buffer *, diagnostic_context *)); ! static int cp_tree_printer PARAMS ((output_buffer *)); ! static void print_function_argument_list PARAMS ((output_buffer *, tfi_t)); ! static void print_declaration PARAMS ((output_buffer *, tfi_t)); ! static void print_expression PARAMS ((output_buffer *, tfi_t)); ! static void print_integer PARAMS ((output_buffer *, HOST_WIDE_INT)); ! static void print_function_declaration PARAMS ((output_buffer *, tfi_t)); ! static void print_function_parameter PARAMS ((output_buffer *, int)); ! static void print_type_id PARAMS ((output_buffer *, tfi_t)); ! static void print_cv_qualifier_seq PARAMS ((output_buffer *, tfi_t)); ! static void print_type_specifier_seq PARAMS ((output_buffer *, tfi_t)); ! static void print_simple_type_specifier PARAMS ((output_buffer *, tfi_t)); ! static void print_elaborated_type_specifier PARAMS ((output_buffer *, tfi_t)); ! static void print_rest_of_abstract_declarator PARAMS ((output_buffer *, ! tfi_t)); ! static void print_parameter_declaration_clause PARAMS ((output_buffer *, ! tfi_t)); ! static void print_exception_specification PARAMS ((output_buffer *, tfi_t)); ! static void print_nested_name_specifier PARAMS ((output_buffer *, tfi_t)); ! static void print_template_id PARAMS ((output_buffer *, tfi_t)); ! static tree typedef_original_name PARAMS ((tree)); static void print_non_consecutive_character PARAMS ((output_buffer *, int)); ! ! #define A args_to_string ! #define C code_to_string ! #define D decl_to_string ! #define E expr_to_string ! #define F fndecl_to_string ! #define L language_to_string ! #define O op_to_string ! #define P parm_to_string ! #define Q assop_to_string ! #define T type_to_string ! #define V cv_to_string ! ! #define o (cp_printer *) 0 ! cp_printer * cp_printers[256] = ! { ! /*0 1 2 3 4 5 6 7 8 9 A B C D E F */ ! o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x00 */ ! o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x10 */ ! o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x20 */ ! o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x30 */ ! o, A, o, C, D, E, F, o, o, o, o, o, L, o, o, O, /* 0x40 */ ! P, Q, o, o, T, o, V, o, o, o, o, o, o, o, o, o, /* 0x50 */ ! o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x60 */ ! o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x70 */ ! }; ! #undef C ! #undef D ! #undef E ! #undef F ! #undef L ! #undef O ! #undef P ! #undef Q ! #undef T ! #undef V ! #undef o void init_error () { - init_output_buffer (scratch_buffer, /* prefix */NULL, /* line-width */0); - print_error_function = lang_print_error_function; ! lang_diagnostic_starter = cp_diagnostic_starter; ! lang_diagnostic_finalizer = cp_diagnostic_finalizer; ! lang_printer = cp_tree_printer; } /* Dump a scope, if deemed necessary. */ --- 117,136 ---- static void cp_print_error_function PARAMS ((output_buffer *, diagnostic_context *)); ! static int cp_printer PARAMS ((output_buffer *)); static void print_non_consecutive_character PARAMS ((output_buffer *, int)); ! static void print_integer PARAMS ((output_buffer *, HOST_WIDE_INT)); ! static tree locate_error PARAMS ((const char *, va_list)); void init_error () { print_error_function = lang_print_error_function; ! diagnostic_starter (global_dc) = cp_diagnostic_starter; ! diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer; ! diagnostic_format_decoder (global_dc) = cp_printer; ! init_output_buffer (scratch_buffer, /* prefix */NULL, /* line-width */0); } /* Dump a scope, if deemed necessary. */ *************** dump_scope (scope, flags) *** 207,214 **** tree scope; int flags; { ! int f = ~TFF_RETURN_TYPE & (TFF_DECL_SPECIFIERS ! | (flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF))); if (scope == NULL_TREE) return; --- 140,146 ---- tree scope; int flags; { ! int f = ~TFF_RETURN_TYPE & (flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF)); if (scope == NULL_TREE) return; *************** dump_type (t, flags) *** 450,456 **** case VECTOR_TYPE: output_add_string (scratch_buffer, "vector "); ! dump_type (TREE_TYPE (t), flags); break; case INTEGER_TYPE: --- 382,395 ---- 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 = type_for_mode (TYPE_MODE (elt), TREE_UNSIGNED (elt)); ! dump_type (elt, flags); ! } break; case INTEGER_TYPE: *************** dump_type (t, flags) *** 520,529 **** break; } case TYPENAME_TYPE: ! output_add_string (scratch_buffer, "typename "); dump_typename (t, flags); break; case TYPEOF_TYPE: output_add_string (scratch_buffer, "__typeof ("); dump_expr (TYPE_FIELDS (t), flags & ~TFF_EXPR_IN_PARENS); --- 459,476 ---- break; } case TYPENAME_TYPE: ! if (IMPLICIT_TYPENAME_P (t)) ! output_add_string (scratch_buffer, "typename "); dump_typename (t, flags); break; + case UNBOUND_CLASS_TEMPLATE: + dump_type (TYPE_CONTEXT (t), flags); + print_scope_operator (scratch_buffer); + print_identifier (scratch_buffer, "template "); + dump_type (DECL_NAME (TYPE_NAME (t)), flags); + break; + case TYPEOF_TYPE: output_add_string (scratch_buffer, "__typeof ("); dump_expr (TYPE_FIELDS (t), flags & ~TFF_EXPR_IN_PARENS); *************** dump_type_suffix (t, flags) *** 797,804 **** if (TREE_CODE (t) == METHOD_TYPE) dump_qualifiers (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))), before); - dump_type_suffix (TREE_TYPE (t), flags); dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags); break; } --- 744,751 ---- if (TREE_CODE (t) == METHOD_TYPE) dump_qualifiers (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))), before); dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags); + dump_type_suffix (TREE_TYPE (t), flags); break; } *************** dump_type_suffix (t, flags) *** 852,881 **** } } - /* Return a function declaration which corresponds to the IDENTIFIER_NODE - argument. */ - - static tree - ident_fndecl (t) - tree t; - { - tree n = lookup_name (t, 0); - - if (n == NULL_TREE) - return NULL_TREE; - - if (TREE_CODE (n) == FUNCTION_DECL) - return n; - else if (TREE_CODE (n) == TREE_LIST - && TREE_CODE (TREE_VALUE (n)) == FUNCTION_DECL) - return TREE_VALUE (n); - - my_friendly_abort (66); - return NULL_TREE; - } - - #define GLOBAL_THING "_GLOBAL__" - static void dump_global_iord (t) tree t; --- 799,804 ---- *************** dump_global_iord (t) *** 887,893 **** else if (DECL_GLOBAL_DTOR_P (t)) p = "destructors"; else ! my_friendly_abort (352); output_printf (scratch_buffer, "(static %s for %s)", p, input_filename); } --- 810,816 ---- else if (DECL_GLOBAL_DTOR_P (t)) p = "destructors"; else ! abort (); output_printf (scratch_buffer, "(static %s for %s)", p, input_filename); } *************** dump_decl (t, flags) *** 950,962 **** if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t))) { output_add_string (scratch_buffer, "vtable for "); ! if (TYPE_P (DECL_CONTEXT (t))) ! dump_type (DECL_CONTEXT (t), flags); ! else ! /* This case can arise with -fno-vtable-thunks. See ! expand_upcast_fixups. It's not clear what to print ! here. */ ! print_identifier (scratch_buffer, ""); break; } /* else fall through */ --- 873,880 ---- if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t))) { output_add_string (scratch_buffer, "vtable for "); ! my_friendly_assert (TYPE_P (DECL_CONTEXT (t)), 20010720); ! dump_type (DECL_CONTEXT (t), flags); break; } /* else fall through */ *************** dump_decl (t, flags) *** 999,1028 **** break; case TYPE_EXPR: ! my_friendly_abort (69); break; /* These special cases are duplicated here so that other functions ! can feed identifiers to cp_error and get them demangled properly. */ case IDENTIFIER_NODE: ! { tree f; ! if (DESTRUCTOR_NAME_P (t) ! && (f = ident_fndecl (t)) ! && DECL_LANGUAGE (f) == lang_cplusplus) ! { ! output_add_character (scratch_buffer, '~'); ! dump_decl (DECL_NAME (f), flags); ! } ! else if (IDENTIFIER_TYPENAME_P (t)) ! { ! output_add_string (scratch_buffer, "operator "); ! /* Not exactly IDENTIFIER_TYPE_VALUE. */ ! dump_type (TREE_TYPE (t), flags); ! break; ! } ! else ! print_tree_identifier (scratch_buffer, t); ! } break; case OVERLOAD: --- 917,937 ---- break; case TYPE_EXPR: ! abort (); break; /* These special cases are duplicated here so that other functions ! can feed identifiers to error and get them demangled properly. */ case IDENTIFIER_NODE: ! if (IDENTIFIER_TYPENAME_P (t)) ! { ! output_add_string (scratch_buffer, "operator "); ! /* Not exactly IDENTIFIER_TYPE_VALUE. */ ! dump_type (TREE_TYPE (t), flags); ! break; ! } ! else ! print_tree_identifier (scratch_buffer, t); break; case OVERLOAD: *************** dump_decl (t, flags) *** 1039,1045 **** break; case TEMPLATE_DECL: ! dump_template_decl (t, flags); break; case TEMPLATE_ID_EXPR: --- 948,954 ---- break; case TEMPLATE_DECL: ! dump_template_decl (t, flags); break; case TEMPLATE_ID_EXPR: *************** dump_template_decl (t, flags) *** 1120,1125 **** --- 1029,1039 ---- int len = TREE_VEC_LENGTH (inner_parms); output_add_string (scratch_buffer, "template<"); + + /* If we've shown the template prefix, we'd better show the + parameters' and decl's type too. */ + flags |= TFF_DECL_SPECIFIERS; + for (i = 0; i < len; i++) { if (i) *************** dump_template_decl (t, flags) *** 1130,1139 **** output_add_space (scratch_buffer); } nreverse(orig_parms); ! /* If we've shown the template prefix, we'd better show the ! decl's type too. */ ! flags |= TFF_DECL_SPECIFIERS; } if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL) dump_type (TREE_TYPE (t), ((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME --- 1044,1055 ---- output_add_space (scratch_buffer); } nreverse(orig_parms); ! ! if (DECL_TEMPLATE_TEMPLATE_PARM_P (t)) ! /* Say `template class TT' not just `template TT'. */ ! output_add_string (scratch_buffer, "class "); } + if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL) dump_type (TREE_TYPE (t), ((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME *************** dump_template_decl (t, flags) *** 1141,1147 **** else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL) dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME); else if (TREE_TYPE (t) == NULL_TREE) ! my_friendly_abort (353); else switch (NEXT_CODE (t)) { --- 1057,1063 ---- else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL) dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME); else if (TREE_TYPE (t) == NULL_TREE) ! abort (); else switch (NEXT_CODE (t)) { *************** dump_template_decl (t, flags) *** 1159,1165 **** /* Pretty print a function decl. There are several ways we want to print a function declaration. The TFF_ bits in FLAGS tells us how to behave. ! As cp_error can only apply the '#' flag once to give 0 and 1 for V, there is %D which doesn't print the throw specs, and %F which does. */ static void --- 1075,1081 ---- /* Pretty print a function decl. There are several ways we want to print a function declaration. The TFF_ bits in FLAGS tells us how to behave. ! As error can only apply the '#' flag once to give 0 and 1 for V, there is %D which doesn't print the throw specs, and %F which does. */ static void *************** dump_function_decl (t, flags) *** 1228,1246 **** dump_function_name (t, flags); ! if (flags & TFF_DECL_SPECIFIERS) { dump_parameters (parmtypes, flags); - if (show_return) - dump_type_suffix (TREE_TYPE (fntype), flags); - if (TREE_CODE (fntype) == METHOD_TYPE) dump_qualifiers (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))), before); if (flags & TFF_EXCEPTION_SPECIFICATION) dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags); } /* If T is a template instantiation, dump the parameter binding. */ --- 1144,1162 ---- dump_function_name (t, flags); ! if (1) { dump_parameters (parmtypes, flags); if (TREE_CODE (fntype) == METHOD_TYPE) dump_qualifiers (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))), before); if (flags & TFF_EXCEPTION_SPECIFICATION) dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags); + + if (show_return) + dump_type_suffix (TREE_TYPE (fntype), flags); } /* If T is a template instantiation, dump the parameter binding. */ *************** dump_expr (t, flags) *** 1819,1825 **** break; case CONVERT_EXPR: ! if (VOID_TYPE_P (TREE_TYPE (t))) { print_left_paren (scratch_buffer); dump_type (TREE_TYPE (t), flags); --- 1735,1741 ---- break; case CONVERT_EXPR: ! if (TREE_TYPE (t) && VOID_TYPE_P (TREE_TYPE (t))) { print_left_paren (scratch_buffer); dump_type (TREE_TYPE (t), flags); *************** dump_expr (t, flags) *** 1918,1933 **** case CONSTRUCTOR: if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))) { ! tree idx = build_component_ref (t, index_identifier, NULL_TREE, 0); ! if (integer_all_onesp (idx)) ! { ! tree pfn = PFN_FROM_PTRMEMFUNC (t); ! dump_unary_op ("&", pfn, flags | TFF_EXPR_IN_PARENS); ! break; ! } ! else if (TREE_CODE (idx) == INTEGER_CST ! && tree_int_cst_equal (idx, integer_zero_node)) { /* A NULL pointer-to-member constant. */ output_add_string (scratch_buffer, "(("); --- 1834,1842 ---- case CONSTRUCTOR: if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))) { ! tree idx = build_component_ref (t, pfn_identifier, NULL_TREE, 0); ! if (integer_zerop (idx)) { /* A NULL pointer-to-member constant. */ output_add_string (scratch_buffer, "(("); *************** cp_line_of (t) *** 2288,2294 **** return line; } ! /* Now the interfaces from cp_error et al to dump_type et al. Each takes an on/off VERBOSE flag and supply the appropriate TFF_ flags to a dump_ function. */ --- 2197,2203 ---- return line; } ! /* Now the interfaces from error et al to dump_type et al. Each takes an on/off VERBOSE flag and supply the appropriate TFF_ flags to a dump_ function. */ *************** language_to_string (c, v) *** 2370,2376 **** return "Java"; default: ! my_friendly_abort (355); return 0; } } --- 2279,2285 ---- return "Java"; default: ! abort (); return 0; } } *************** args_to_string (p, verbose) *** 2461,2486 **** static const char * cv_to_string (p, v) tree p; ! int v ATTRIBUTE_UNUSED; { reinit_global_formatting_buffer (); ! dump_qualifiers (p, before); return output_finalize_message (scratch_buffer); } static void ! lang_print_error_function (file) const char *file; { output_state os; ! default_print_error_function (file); ! os = output_buffer_state (diagnostic_buffer); ! output_set_prefix (diagnostic_buffer, file); ! maybe_print_instantiation_context (diagnostic_buffer); ! output_buffer_state (diagnostic_buffer) = os; } static void --- 2370,2396 ---- static const char * cv_to_string (p, v) tree p; ! int v; { reinit_global_formatting_buffer (); ! dump_qualifiers (p, v ? before : none); return output_finalize_message (scratch_buffer); } static void ! lang_print_error_function (context, file) ! diagnostic_context *context; const char *file; { output_state os; ! default_print_error_function (context, file); ! os = output_buffer_state (context); ! output_set_prefix ((output_buffer *)context, file); ! maybe_print_instantiation_context ((output_buffer *)context); ! output_buffer_state (context) = os; } static void *************** print_instantiation_context () *** 2637,2757 **** /* Called from output_format -- during diagnostic message processing -- to handle C++ specific format specifier with the following meanings: %A function argument-list. %D declaration. %E expression. %F function declaration. %P function parameter whose position is indicated by an integer. %T type. %V cv-qualifier. */ static int ! cp_tree_printer (buffer) output_buffer *buffer; { ! int be_verbose = 0; ! tree_formatting_info tfi; ! ! memset (&tfi, 0, sizeof (tree_formatting_info)); if (*output_buffer_text_cursor (buffer) == '+') ++output_buffer_text_cursor (buffer); if (*output_buffer_text_cursor (buffer) == '#') { ! be_verbose = 1; ++output_buffer_text_cursor (buffer); } switch (*output_buffer_text_cursor (buffer)) { ! case 'A': ! tree_being_formatted (&tfi) = ! va_arg (output_buffer_format_args (buffer), tree); ! if (be_verbose) ! tree_formatting_flags (&tfi) = TFF_SCOPE ! | TFF_FUNCTION_DEFAULT_ARGUMENTS; ! print_function_argument_list (buffer, &tfi); ! break; ! ! case 'D': ! tree_being_formatted (&tfi) = ! va_arg (output_buffer_format_args (buffer), tree); ! if (be_verbose) ! tree_formatting_flags (&tfi) = TFF_SCOPE | TFF_DECL_SPECIFIERS ! | TFF_CLASS_KEY_OR_ENUM | TFF_RETURN_TYPE ! | TFF_FUNCTION_DEFAULT_ARGUMENTS | TFF_TEMPLATE_DEFAULT_ARGUMENTS ! | TFF_EXCEPTION_SPECIFICATION | TFF_CHASE_NAMESPACE_ALIAS; ! print_declaration (buffer, &tfi); ! break; ! ! case 'E': ! tree_being_formatted (&tfi) = ! va_arg (output_buffer_format_args (buffer), tree); ! if (be_verbose) ! tree_formatting_flags (&tfi) = TFF_SCOPE; ! print_expression (buffer, &tfi); ! break; ! ! case 'F': ! tree_being_formatted (&tfi) = ! va_arg (output_buffer_format_args (buffer), tree); ! if (be_verbose) ! tree_formatting_flags (&tfi) = TFF_SCOPE | TFF_DECL_SPECIFIERS ! | TFF_RETURN_TYPE | TFF_FUNCTION_DEFAULT_ARGUMENTS ! | TFF_EXCEPTION_SPECIFICATION; ! print_function_declaration (buffer, &tfi); ! break; ! ! case 'P': ! print_function_parameter ! (buffer, va_arg (output_buffer_format_args (buffer), int)); ! break; ! ! case 'T': ! tree_being_formatted (&tfi) = ! va_arg (output_buffer_format_args (buffer), tree); ! if (be_verbose) ! tree_formatting_flags (&tfi) = TFF_SCOPE | TFF_CLASS_KEY_OR_ENUM ! | TFF_RETURN_TYPE | TFF_EXCEPTION_SPECIFICATION; ! print_type_id (buffer, &tfi); ! break; ! ! case 'V': ! tree_being_formatted (&tfi) = ! va_arg (output_buffer_format_args (buffer), tree); ! print_cv_qualifier_seq (buffer, &tfi); ! break; ! default: return 0; } return 1; ! } ! ! /* Print a function argument-list represented by tree_being_formatted (TFI) ! onto BUFFER. */ ! static void ! print_function_argument_list (buffer, tfi) ! output_buffer *buffer __attribute__ ((__unused__)); ! tfi_t tfi __attribute__ ((__unused__)); ! { ! } ! ! /* Print a declaration represented by tree_being_formatted (TFI) ! onto buffer. */ ! static void ! print_declaration (buffer, tfi) ! output_buffer *buffer __attribute__ ((__unused__)); ! tfi_t tfi __attribute__ ((__unused__)); ! { ! } ! ! /* Print an expression represented by tree_being_formatted (TFI) ! onto BUFFER. */ ! static void ! print_expression (buffer, tfi) ! output_buffer *buffer __attribute__ ((__unused__)); ! tfi_t tfi __attribute__ ((__unused__)); ! { } static void --- 2547,2605 ---- /* Called from output_format -- during diagnostic message processing -- to handle C++ specific format specifier with the following meanings: %A function argument-list. + %C tree code. %D declaration. %E expression. %F function declaration. + %L language as used in extern "lang". + %O binary operator. %P function parameter whose position is indicated by an integer. + %Q assignment operator. %T type. %V cv-qualifier. */ static int ! cp_printer (buffer) output_buffer *buffer; { ! int verbose = 0; ! const char *result; ! #define next_tree va_arg (output_buffer_format_args (buffer), tree) ! #define next_tcode va_arg (output_buffer_format_args (buffer), enum tree_code) ! #define next_lang va_arg (output_buffer_format_args (buffer), enum languages) ! #define next_int va_arg (output_buffer_format_args (buffer), int) if (*output_buffer_text_cursor (buffer) == '+') ++output_buffer_text_cursor (buffer); if (*output_buffer_text_cursor (buffer) == '#') { ! verbose = 1; ++output_buffer_text_cursor (buffer); } switch (*output_buffer_text_cursor (buffer)) { ! case 'A': result = args_to_string (next_tree, verbose); break; ! case 'C': result = code_to_string (next_tcode, verbose); break; ! case 'D': result = decl_to_string (next_tree, verbose); break; ! case 'E': result = expr_to_string (next_tree, verbose); break; ! case 'F': result = fndecl_to_string (next_tree, verbose); break; ! case 'L': result = language_to_string (next_lang, verbose); break; ! case 'O': result = op_to_string (next_tcode, verbose); break; ! case 'P': result = parm_to_string (next_int, verbose); break; ! case 'Q': result = assop_to_string (next_tcode, verbose); break; ! case 'T': result = type_to_string (next_tree, verbose); break; ! case 'V': result = cv_to_string (next_tree, verbose); break; ! default: return 0; } + output_add_string (buffer, result); return 1; ! #undef next_tree ! #undef next_tcode ! #undef next_lang ! #undef next_int } static void *************** print_integer (buffer, i) *** 2763,3379 **** output_add_string (buffer, digit_buffer); } - /* Print a function declaration represented by tree_being_formatted (TFI) - onto BUFFER. */ - static void - print_function_declaration (buffer, tfi) - output_buffer *buffer __attribute__ ((__unused__)); - tfi_t tfi __attribute__ ((__unused__)); - { - } - - /* Print the N'th function parameter onto BUFFER. A negative value of N - means the implicit "this" parameter of a member function. */ static void ! print_function_parameter (buffer, n) ! output_buffer *buffer; ! int n; ! { ! if (n < 0) ! print_identifier (buffer, "this"); ! else ! output_decimal (buffer, n + 1); ! } ! ! /* Print a type represented by tree_being_formatted (TFI) onto BUFFER. */ ! static void ! print_type_id (buffer, tfi) output_buffer *buffer; ! tfi_t tfi; { ! tree t = tree_being_formatted (tfi); ! int flags = tree_formatting_flags (tfi); ! if (t == NULL_TREE) ! return; ! ! if (flags & TFF_CHASE_TYPEDEF) ! tree_being_formatted (tfi) = ! typedef_original_name (tree_being_formatted (tfi)); ! ! /* A type-id is of the form: ! type-id: ! type-specifier-seq abstract-declarator(opt) */ ! print_type_specifier_seq (buffer, tfi); ! ! if (TYPE_PTRMEMFUNC_P (t)) ! goto ptr_mem_fun; ! ! /* For types with abstract-declarator, print_type_specifier_seq prints ! the start of the abstract-declarator. Fiinish the job. */ ! switch (TREE_CODE (t)) ! { ! case ARRAY_TYPE: ! case POINTER_TYPE: ! case REFERENCE_TYPE: ! case OFFSET_TYPE: ! case METHOD_TYPE: ! case FUNCTION_TYPE: ! ptr_mem_fun: ! print_rest_of_abstract_declarator (buffer, tfi); ! ! default: ! break; ! } ! tree_being_formatted (tfi) = t; } ! /* Print the type-specifier-seq part of a type-id. If appropriate, print ! also the prefix of the abstract-declarator. */ ! static void ! print_type_specifier_seq (buffer, tfi) ! output_buffer *buffer; ! tfi_t tfi; ! { ! int flags = tree_formatting_flags (tfi); ! tree t = tree_being_formatted (tfi); ! enum tree_code code = TREE_CODE (t); ! ! /* A type-speficier-seq is: ! type-specifier type-specifier-seq(opt) ! where ! type-specifier: ! simple-type-specifier ! class-specifier ! enum-specifier ! elaborated-type-specifier ! cv-qualifier ! ! We do not, however, pretty-print class-specifier nor enum-specifier. */ ! ! switch (code) ! { ! case UNKNOWN_TYPE: ! case IDENTIFIER_NODE: ! case VOID_TYPE: ! case INTEGER_TYPE: ! case REAL_TYPE: ! case COMPLEX_TYPE: ! case ENUMERAL_TYPE: ! case BOOLEAN_TYPE: ! case UNION_TYPE: ! case TYPE_DECL: ! case TEMPLATE_DECL: ! case TEMPLATE_TYPE_PARM: ! case TYPEOF_TYPE: ! case TEMPLATE_TEMPLATE_PARM: ! case TYPENAME_TYPE: ! class_type: ! print_cv_qualifier_seq (buffer, tfi); ! if ((flags & TFF_DECL_SPECIFIERS) ! && (code == TYPENAME_TYPE || IS_AGGR_TYPE (t))) ! print_elaborated_type_specifier (buffer, tfi); ! else ! print_simple_type_specifier (buffer, tfi); ! break; ! ! /* Because the abstract-declarator can modify the type-specifier-seq ! in a highly non linear manner, we pretty-print its prefix here. ! The suffix part is handled by print_rest_of_abstract_declarator. */ ! ! /* A RECORD_TYPE is also used to represent a pointer to member ! function. */ ! case RECORD_TYPE: ! if (TYPE_PTRMEMFUNC_P (t)) ! { ! /* Print the return type. */ ! tree_being_formatted (tfi) = ! TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (t)); ! print_type_id (buffer, tfi); ! print_whitespace (buffer, tfi); ! ! /* Then the beginning of the abstract-declarator part. */ ! tree_being_formatted (tfi) = ! TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (t)); ! print_left_paren (buffer); ! print_nested_name_specifier (buffer, tfi); ! } ! else ! goto class_type; ! break; ! ! case POINTER_TYPE: ! if (TYPE_PTRMEM_P (t)) ! goto ptr_data_member; ! else ! goto non_ptr_data_member; ! break; ! ! case ARRAY_TYPE: ! case REFERENCE_TYPE: ! case FUNCTION_TYPE: ! case METHOD_TYPE: ! non_ptr_data_member: ! tree_being_formatted (tfi) = TREE_TYPE (t); ! print_type_specifier_seq (buffer, tfi); ! if (code == POINTER_TYPE || code == REFERENCE_TYPE) ! { ! if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) ! print_left_paren (buffer); ! } ! else if (code == FUNCTION_TYPE || code == METHOD_TYPE) ! { ! print_whitespace (buffer, tfi); ! print_left_paren (buffer); ! if (code == METHOD_TYPE) ! { ! tree_being_formatted (tfi) = TYPE_METHOD_BASETYPE (t); ! print_nested_name_specifier (buffer, tfi); ! tree_being_formatted (tfi) = t; ! } ! } ! tree_being_formatted (tfi) = t; ! break; ! ! ptr_data_member: ! case OFFSET_TYPE: ! /* Firstly, the type of the member. */ ! tree_being_formatted (tfi) = TREE_TYPE (t); ! print_type_id (buffer, tfi); ! print_whitespace (buffer, tfi); ! ! /* Then, the containing class. */ ! tree_being_formatted (tfi) = TYPE_OFFSET_BASETYPE (t); ! print_nested_name_specifier (buffer, tfi); ! tree_being_formatted (tfi) = t; ! break; ! ! default: ! sorry_for_unsupported_tree (t); ! /* fall throught */ ! ! case ERROR_MARK: ! print_identifier (buffer, "{type-specifier-seq error}"); ! break; ! } ! ! tree_being_formatted (tfi) = t; ! } ! /* Print the simpe-type-specifier component of a type-specifier. */ ! static void ! print_simple_type_specifier (buffer, tfi) ! output_buffer *buffer; ! tfi_t tfi; { ! int flags = tree_formatting_flags (tfi); ! tree t = tree_being_formatted (tfi); ! enum tree_code code = TREE_CODE (t); ! switch (code) { ! case UNKNOWN_TYPE: ! print_identifier (buffer, "{unknown type}"); ! break; ! ! case IDENTIFIER_NODE: ! print_tree_identifier (buffer, t); ! break; ! ! case COMPLEX_TYPE: ! print_identifier (buffer, "__complex__ "); ! tree_being_formatted (tfi) = TREE_TYPE (t); ! print_type_id (buffer, tfi); ! break; ! ! case TYPENAME_TYPE: ! tree_being_formatted (tfi) = TYPE_CONTEXT (t); ! print_nested_name_specifier (buffer, tfi); ! tree_being_formatted (tfi) = TYPENAME_TYPE_FULLNAME (t); ! tree_formatting_flags (tfi) |= ~TFF_CHASE_TYPEDEF; ! print_type_id (buffer, tfi); ! break; ! ! case TYPEOF_TYPE: ! print_identifier (buffer, "__typeof__"); ! tree_being_formatted (tfi) = TYPE_FIELDS (t); ! print_left_paren (buffer); ! print_expression (buffer, tfi); ! print_right_paren (buffer); ! break; ! ! case INTEGER_TYPE: ! if (TREE_UNSIGNED (t)) ! { ! if (TYPE_MAIN_VARIANT (t) == integer_type_node) ! /* We don't want pedantry like `unsigned int'. */; ! else if (!TREE_UNSIGNED (TYPE_MAIN_VARIANT (t))) ! { ! print_identifier (buffer, "unsigned"); ! print_whitespace (buffer, tfi); ! } ! } ! else if (TYPE_MAIN_VARIANT (t) == char_type_node) ! { ! print_identifier (buffer, "signed"); ! print_whitespace (buffer, tfi); ! } ! case REAL_TYPE: ! case BOOLEAN_TYPE: ! case VOID_TYPE: ! { ! tree s = (flags & TFF_CHASE_TYPEDEF) ? TYPE_MAIN_VARIANT (t) : t; ! ! if (TYPE_NAME (s) && TYPE_IDENTIFIER (s)) ! print_tree_identifier (buffer, TYPE_IDENTIFIER (s)); ! 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 (buffer, "{anonymous}"); ! } ! break; ! ! case TEMPLATE_TEMPLATE_PARM: ! if (TYPE_IDENTIFIER (t)) ! print_tree_identifier (buffer, TYPE_IDENTIFIER (t)); ! else ! print_identifier (buffer, "{anonymous template template parameter}"); ! break; ! ! case TYPE_DECL: ! if (flags & TFF_CHASE_TYPEDEF) ! print_type_id (buffer, tfi); ! else ! print_tree_identifier (buffer, DECL_NAME (t)); ! break; ! case BOUND_TEMPLATE_TEMPLATE_PARM: ! case TEMPLATE_DECL: ! print_template_id (buffer, tfi); ! break; ! case TEMPLATE_TYPE_PARM: ! if (TYPE_IDENTIFIER (t)) ! print_tree_identifier (buffer, TYPE_IDENTIFIER (t)); ! else ! print_identifier (buffer, "{anonymous template type parameter}"); ! break; ! default: ! break; } ! tree_being_formatted (tfi) = t; ! tree_formatting_flags (tfi) = flags; ! } ! ! /* Print the elaborated-type-specifier form of a type-specifier. */ ! static void ! print_elaborated_type_specifier (buffer, tfi) ! output_buffer *buffer; ! tfi_t tfi; ! { ! int flags = tree_formatting_flags (tfi); ! tree t = tree_being_formatted (tfi); ! ! switch (TREE_CODE (t)) ! { ! case TYPENAME_TYPE: ! print_identifier (buffer, "typename"); ! print_whitespace (buffer, tfi); ! tree_formatting_flags (tfi) |= ~TFF_DECL_SPECIFIERS; ! print_simple_type_specifier (buffer, tfi); ! break; ! ! case UNION_TYPE: ! case RECORD_TYPE: ! { ! tree name = NULL_TREE; ! ! if (flags & TFF_CHASE_TYPEDEF) ! tree_being_formatted (tfi) = typedef_original_name (t); ! ! print_identifier ! (buffer, class_key_or_enum (tree_being_formatted (tfi))); ! print_whitespace (buffer, tfi); ! ! name = TYPE_NAME (tree_being_formatted (tfi)); ! if (name) ! { ! if (flags & TFF_SCOPE) ! { ! tree_being_formatted (tfi) = CP_DECL_CONTEXT (name); ! print_nested_name_specifier (buffer, tfi); ! } ! print_tree_identifier (buffer, DECL_NAME (name)); ! } ! else ! print_identifier (buffer, "{anonymous}"); ! } ! break; ! ! default: ! sorry_for_unsupported_tree (t); ! break; ! } ! tree_being_formatted (tfi) = t; ! tree_formatting_flags (tfi) = flags; } - /* Finish the job of printing the abstract-declarator part of a - type-id. */ - static void - print_rest_of_abstract_declarator (buffer, tfi) - output_buffer *buffer; - tfi_t tfi; - { - tree t = tree_being_formatted (tfi); - enum tree_code code = TREE_CODE (t); - - /* An abstract-declarator has the form: - - abstract-declarator: - ptr-operator abstract-declarator(opt) - direct-abstract-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) ] - ( direct-abstract-declarator ) */ - - switch (code) - { - case ARRAY_TYPE: - print_left_bracket (buffer); - if (TYPE_DOMAIN (t)) - { - tree s = TYPE_DOMAIN (t); ! if (host_integerp (TYPE_MAX_VALUE (s), 0)) ! output_decimal (buffer, tree_low_cst (TYPE_MAX_VALUE (s), 0) + 1); ! else if (TREE_CODE (TYPE_MAX_VALUE (s)) == MINUS_EXPR) ! { ! tree_being_formatted (tfi) = ! TREE_OPERAND (TYPE_MAX_VALUE (s), 0); ! print_expression (buffer, tfi); ! tree_being_formatted (tfi) = t; ! } ! else ! { ! tree_being_formatted (tfi) = fold ! (cp_build_binary_op (PLUS_EXPR, TYPE_MAX_VALUE (s), ! integer_one_node)); ! print_expression (buffer, tfi); ! tree_being_formatted (tfi) = t; ! } ! } ! print_right_bracket (buffer); ! put_whitespace (tfi) = none; ! tree_being_formatted (tfi) = TREE_TYPE (t); ! print_rest_of_abstract_declarator (buffer, tfi); ! tree_being_formatted (tfi) = t; ! break; ! ! case POINTER_TYPE: ! case REFERENCE_TYPE: ! case OFFSET_TYPE: ! if (code == POINTER_TYPE || code == REFERENCE_TYPE) ! { ! output_add_character (buffer, "&*"[code == POINTER_TYPE]); ! if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) ! print_right_paren (buffer); ! } ! put_whitespace (tfi) = before; ! print_cv_qualifier_seq (buffer, tfi); ! tree_being_formatted (tfi) = TREE_TYPE (t); ! print_rest_of_abstract_declarator (buffer, tfi); ! tree_being_formatted (tfi) = t; ! break; ! ! case FUNCTION_TYPE: ! case METHOD_TYPE: ! print_right_paren (buffer); ! print_whitespace (buffer, tfi); ! ! /* Skip the `this' implicit parameter if present. */ ! tree_being_formatted (tfi) = TYPE_ARG_TYPES (t); ! if (code == METHOD_TYPE) ! tree_being_formatted (tfi) = TREE_CHAIN (tree_being_formatted (tfi)); ! ! /* Print the parameter-list. */ ! print_left_paren (buffer); ! print_parameter_declaration_clause (buffer, tfi); ! print_right_paren (buffer); ! ! print_whitespace (buffer, tfi); ! ! if (code == METHOD_TYPE) ! { ! tree_being_formatted (tfi) = ! TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))); ! print_cv_qualifier_seq (buffer, tfi); ! } ! ! /* Finish the abstract-declarator. */ ! tree_being_formatted (tfi) = TREE_TYPE (t); ! print_rest_of_abstract_declarator (buffer, tfi); ! ! /* Print the exception-specification for documentaion purpose. */ ! tree_being_formatted (tfi) = TYPE_RAISES_EXCEPTIONS (t); ! print_exception_specification (buffer, tfi); ! tree_being_formatted (tfi) = t; ! break; ! ! /* These types don't have abstract-declarator. */ ! case UNKNOWN_TYPE: ! case IDENTIFIER_NODE: ! case VOID_TYPE: ! case INTEGER_TYPE: ! case REAL_TYPE: ! case COMPLEX_TYPE: ! case ENUMERAL_TYPE: ! case BOOLEAN_TYPE: ! case UNION_TYPE: ! case TYPE_DECL: ! case TEMPLATE_DECL: ! case TEMPLATE_TYPE_PARM: ! case TYPEOF_TYPE: ! case TEMPLATE_TEMPLATE_PARM: ! case TYPENAME_TYPE: ! break; ! ! default: ! sorry_for_unsupported_tree (t); ! /* fall throught. */ ! case ERROR_MARK: ! break; ! } ! } ! ! /* Print the cv-quafilers of tree_being_formatted (TFI) onto BUFFER. */ ! static void ! print_cv_qualifier_seq (buffer, tfi) ! output_buffer *buffer; ! tree_formatting_info *tfi; { ! int cv = TYPE_QUALS (tree_being_formatted (tfi)); ! int pad_after = after == put_whitespace (tfi); ! static const int mask[] ! = {TYPE_QUAL_CONST, TYPE_QUAL_VOLATILE, TYPE_QUAL_RESTRICT}; ! static const char *const qualifier[] ! = { "const", "volatile", "__restrict__" }; ! ! if (cv != 0) ! { ! int i; ! for (i = 0; i != 3; ++i) ! if (mask[i] & cv) ! { ! if (put_whitespace (tfi) == before) ! output_add_space (buffer); ! print_identifier (buffer, qualifier[i]); ! put_whitespace (tfi) = before; ! } ! if (pad_after) ! { ! output_add_space (buffer); ! put_whitespace (tfi) = none; ! } ! } ! } ! static void ! print_parameter_declaration_clause (buffer, tfi) ! output_buffer *buffer __attribute__ ((__unused__)); ! tfi_t tfi __attribute__ ((__unused__)); ! { ! } ! static void ! print_exception_specification (buffer, tfi) ! output_buffer *buffer __attribute__ ((__unused__)); ! tfi_t tfi __attribute__ ((__unused__)); ! { } ! static void ! print_nested_name_specifier (buffer, tfi) ! output_buffer *buffer; ! tfi_t tfi; { ! int flags = tree_formatting_flags (tfi); ! tree t = tree_being_formatted (tfi); ! /* A nested-name-specifier is: ! class-or-namespace-name :: nested-name-specifier(opt) ! class-or-namespace-name :: template nested-name-specifier ! ! The latter form being the correct syntax for a name designating ! a template member, where the preceding class-or-namespace-name part ! is name-dependent. For the time being, we do not do such a ! sophisticated pretty-printing. ! ! class-or-namespace-name: ! class-name ! namespace-name */ ! ! if (t == NULL_TREE || t == global_namespace) ! return; ! ! if (CLASS_TYPE_P (t) && !(flags & TFF_CLASS_SCOPE)) ! return; ! if (TREE_CODE (t) == NAMESPACE_DECL && !(flags & TFF_NAMESPACE_SCOPE)) ! return; ! tree_being_formatted (tfi) = DECL_CONTEXT (t); ! print_nested_name_specifier (buffer, tfi); ! print_scope_operator (buffer); ! if (TREE_CODE (t) == NAMESPACE_DECL) ! print_tree_identifier (buffer, DECL_NAME (t)); ! else if (CLASS_TYPE_P (t)) ! { ! if (!DECL_USE_TEMPLATE (t)) ! print_tree_identifier (buffer, TYPE_IDENTIFIER (t)); ! else ! { ! tree_being_formatted (tfi) = t; ! print_template_id (buffer, tfi); ! } ! } ! tree_being_formatted (tfi) = t; } ! static void ! print_template_id (buffer, tfi) ! output_buffer *buffer; ! tfi_t tfi __attribute__ ((__unused__)); { ! print_template_argument_list_start (buffer); ! /* ... */ ! print_template_argument_list_end (buffer); ! } ! static tree ! typedef_original_name (t) ! tree t; ! { ! return DECL_ORIGINAL_TYPE (t) ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t); ! } ! static void ! print_non_consecutive_character (buffer, c) ! output_buffer *buffer; ! int c; ! { ! const char *p = output_last_position (buffer); ! if (p != NULL && *p == c) ! output_add_space (buffer); ! output_add_character (buffer, c); } --- 2611,2750 ---- output_add_string (buffer, digit_buffer); } static void ! print_non_consecutive_character (buffer, c) output_buffer *buffer; ! int c; { ! const char *p = output_last_position (buffer); ! if (p != NULL && *p == c) ! output_add_space (buffer); ! output_add_character (buffer, c); } ! /* These are temporary wrapper functions which handle the historic ! behavior of cp_*_at. */ ! static tree ! locate_error (msgid, ap) ! const char *msgid; ! va_list ap; { ! tree here = 0, t; ! int plus = 0; ! const char *f; ! for (f = msgid; *f; f++) { ! plus = 0; ! if (*f == '%') ! { ! f++; ! if (*f == '+') ! f++, plus = 1; ! if (*f == '#') ! f++; ! switch (*f) ! { ! /* Just ignore these possibilities. */ ! case '%': break; ! case 'd': (void) va_arg (ap, int); break; ! case 's': (void) va_arg (ap, char *); break; ! case 'L': (void) va_arg (ap, enum languages); break; ! case 'C': ! case 'O': ! case 'Q': (void) va_arg (ap, enum tree_code); break; ! /* These take a tree, which may be where the error is ! located. */ ! case 'A': ! case 'D': ! case 'E': ! case 'F': ! case 'P': ! case 'T': ! case 'V': ! t = va_arg (ap, tree); ! if (!here || plus) ! here = t; ! break; ! default: ! errorcount = 0; /* damn ICE suppression */ ! internal_error ("unexpected letter `%c' in locate_error\n", *f); ! } ! } } ! if (here == 0) ! here = va_arg (ap, tree); ! return here; } ! void ! cp_error_at VPARAMS ((const char *msgid, ...)) { ! tree here; ! diagnostic_context dc; ! VA_OPEN (ap, msgid); ! VA_FIXEDARG (ap, const char *, msgid); ! here = locate_error (msgid, ap); ! VA_CLOSE (ap); ! VA_OPEN (ap, msgid); ! VA_FIXEDARG (ap, const char *, msgid); ! set_diagnostic_context (&dc, msgid, &ap, ! cp_file_of (here), ! cp_line_of (here), /* warning = */ 0); ! report_diagnostic (&dc); ! VA_CLOSE (ap); } ! void ! cp_warning_at VPARAMS ((const char *msgid, ...)) { ! tree here; ! diagnostic_context dc; ! VA_OPEN (ap, msgid); ! VA_FIXEDARG (ap, const char *, msgid); ! here = locate_error (msgid, ap); ! VA_CLOSE (ap); ! VA_OPEN (ap, msgid); ! VA_FIXEDARG (ap, const char *, msgid); ! set_diagnostic_context (&dc, msgid, &ap, ! cp_file_of (here), ! cp_line_of (here), /* warning = */ 1); ! report_diagnostic (&dc); ! VA_CLOSE (ap); } ! void ! cp_pedwarn_at VPARAMS ((const char *msgid, ...)) { ! tree here; ! diagnostic_context dc; ! VA_OPEN (ap, msgid); ! VA_FIXEDARG (ap, const char *, msgid); ! here = locate_error (msgid, ap); ! VA_CLOSE (ap); ! VA_OPEN (ap, msgid); ! VA_FIXEDARG (ap, const char *, msgid); ! set_diagnostic_context (&dc, msgid, &ap, ! cp_file_of (here), ! cp_line_of (here), ! /* warning = */ !flag_pedantic_errors); ! report_diagnostic (&dc); ! VA_CLOSE (ap); } diff -Nrc3pad gcc-3.0.4/gcc/cp/except.c gcc-3.1/gcc/cp/except.c *** gcc-3.0.4/gcc/cp/except.c Wed Jun 27 12:15:10 2001 --- gcc-3.1/gcc/cp/except.c Tue Dec 18 03:35:30 2001 *************** Boston, MA 02111-1307, USA. */ *** 28,33 **** --- 28,34 ---- #include "tree.h" #include "rtl.h" #include "expr.h" + #include "libfuncs.h" #include "cp-tree.h" #include "flags.h" #include "obstack.h" *************** init_exception_processing () *** 62,77 **** { tree tmp; - if (flag_honor_std) - push_namespace (std_identifier); - /* void std::terminate (); */ tmp = build_function_type (void_type_node, void_list_node); terminate_node = build_cp_library_fn_ptr ("terminate", tmp); TREE_THIS_VOLATILE (terminate_node) = 1; TREE_NOTHROW (terminate_node) = 1; ! if (flag_honor_std) ! pop_namespace (); /* void __cxa_call_unexpected(void *); */ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); --- 63,75 ---- { tree tmp; /* void std::terminate (); */ + push_namespace (std_identifier); tmp = build_function_type (void_type_node, void_list_node); terminate_node = build_cp_library_fn_ptr ("terminate", tmp); TREE_THIS_VOLATILE (terminate_node) = 1; TREE_NOTHROW (terminate_node) = 1; ! pop_namespace (); /* void __cxa_call_unexpected(void *); */ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); *************** init_exception_processing () *** 88,94 **** } /* Returns an expression to be executed if an unhandled exception is ! propogated out of a cleanup region. */ static tree cp_protect_cleanup_actions () --- 86,92 ---- } /* Returns an expression to be executed if an unhandled exception is ! propagated out of a cleanup region. */ static tree cp_protect_cleanup_actions () *************** decl_is_java_type (decl, err) *** 244,250 **** && TYPE_FOR_JAVA (TREE_TYPE (decl))) { /* Can't throw a reference. */ ! cp_error ("type `%T' is disallowed in Java `throw' or `catch'", decl); } --- 242,248 ---- && TYPE_FOR_JAVA (TREE_TYPE (decl))) { /* Can't throw a reference. */ ! error ("type `%T' is disallowed in Java `throw' or `catch'", decl); } *************** decl_is_java_type (decl, err) *** 262,268 **** if (! DERIVED_FROM_P (jthrow_node, TREE_TYPE (decl))) { /* Thrown object must be a Throwable. */ ! cp_error ("type `%T' is not derived from `java::lang::Throwable'", TREE_TYPE (decl)); } } --- 260,266 ---- if (! DERIVED_FROM_P (jthrow_node, TREE_TYPE (decl))) { /* Thrown object must be a Throwable. */ ! error ("type `%T' is not derived from `java::lang::Throwable'", TREE_TYPE (decl)); } } *************** tree *** 391,398 **** expand_start_catch_block (decl) tree decl; { - tree compound_stmt_1; - tree compound_stmt_2; tree exp = NULL_TREE; tree type; bool is_java; --- 389,394 ---- *************** expand_start_catch_block (decl) *** 404,419 **** if (decl && !complete_ptr_ref_or_void_ptr_p (TREE_TYPE (decl), NULL_TREE)) decl = NULL_TREE; - /* Create a binding level for the eh_info and the exception object - cleanup. */ - compound_stmt_1 = begin_compound_stmt (/*has_no_scope=*/0); - note_level_for_catch (); - if (decl) type = prepare_eh_type (TREE_TYPE (decl)); else type = NULL_TREE; - begin_catch_block (type); is_java = false; if (decl) --- 400,409 ---- *************** expand_start_catch_block (decl) *** 452,464 **** if (! is_java) push_eh_cleanup (type); - /* Create a binding level for the parm. */ - compound_stmt_2 = begin_compound_stmt (/*has_no_scope=*/0); - if (decl) initialize_handler_parm (decl, exp); ! return build_tree_list (compound_stmt_1, compound_stmt_2); } --- 442,451 ---- if (! is_java) push_eh_cleanup (type); if (decl) initialize_handler_parm (decl, exp); ! return type; } *************** expand_start_catch_block (decl) *** 467,478 **** the label to jump to if this catch block didn't match. */ void ! expand_end_catch_block (blocks) ! tree blocks; { - tree compound_stmt_1 = blocks ? TREE_PURPOSE (blocks): NULL_TREE; - tree compound_stmt_2 = blocks ? TREE_VALUE (blocks): NULL_TREE; - if (! doing_eh (1)) return; --- 454,461 ---- the label to jump to if this catch block didn't match. */ void ! expand_end_catch_block () { if (! doing_eh (1)) return; *************** expand_end_catch_block (blocks) *** 482,492 **** && (DECL_CONSTRUCTOR_P (current_function_decl) || DECL_DESTRUCTOR_P (current_function_decl))) finish_expr_stmt (build_throw (NULL_TREE)); - - /* Cleanup the EH parameter. */ - finish_compound_stmt (/*has_no_scope=*/0, compound_stmt_2); - /* Cleanup the EH object. */ - finish_compound_stmt (/*has_no_scope=*/0, compound_stmt_1); } tree --- 465,470 ---- *************** build_throw (exp) *** 577,583 **** return build_min (THROW_EXPR, void_type_node, exp); if (exp == null_node) ! cp_warning ("throwing NULL, which has integral, not pointer type"); if (exp != NULL_TREE) { --- 555,561 ---- return build_min (THROW_EXPR, void_type_node, exp); if (exp == null_node) ! warning ("throwing NULL, which has integral, not pointer type"); if (exp != NULL_TREE) { *************** is_admissible_throw_operand (expr) *** 794,800 **** conversion. */ else if (CLASS_TYPE_P (type) && CLASSTYPE_PURE_VIRTUALS (type)) { ! cp_error ("Expression '%E' of abstract class type '%T' cannot be used in throw-expression", expr, type); return false; } --- 772,778 ---- conversion. */ else if (CLASS_TYPE_P (type) && CLASSTYPE_PURE_VIRTUALS (type)) { ! error ("expression '%E' of abstract class type '%T' cannot be used in throw-expression", expr, type); return false; } *************** check_handlers_1 (master, handlers) *** 882,891 **** && can_convert_eh (type, TREE_TYPE (handler))) { lineno = STMT_LINENO (handler); ! cp_warning ("exception of type `%T' will be caught", TREE_TYPE (handler)); lineno = STMT_LINENO (master); ! cp_warning (" by earlier handler for `%T'", type); break; } } --- 860,869 ---- && can_convert_eh (type, TREE_TYPE (handler))) { lineno = STMT_LINENO (handler); ! warning ("exception of type `%T' will be caught", TREE_TYPE (handler)); lineno = STMT_LINENO (master); ! warning (" by earlier handler for `%T'", type); break; } } *************** check_handlers (handlers) *** 905,911 **** else if (TREE_TYPE (handler) == NULL_TREE) { lineno = STMT_LINENO (handler); ! cp_pedwarn ("`...' handler must be the last handler for its try block"); } else --- 883,889 ---- else if (TREE_TYPE (handler) == NULL_TREE) { lineno = STMT_LINENO (handler); ! pedwarn ("`...' handler must be the last handler for its try block"); } else diff -Nrc3pad gcc-3.0.4/gcc/cp/expr.c gcc-3.1/gcc/cp/expr.c *** gcc-3.0.4/gcc/cp/expr.c Wed Jul 25 09:01:32 2001 --- gcc-3.1/gcc/cp/expr.c Wed Jan 23 14:25:56 2002 *************** cplus_expand_expr (exp, target, tmode, m *** 106,112 **** case OFFSET_REF: /* Offset refs should not make it through to here. */ ! my_friendly_abort (20010724); return const0_rtx; case THROW_EXPR: --- 106,112 ---- case OFFSET_REF: /* Offset refs should not make it through to here. */ ! abort (); return const0_rtx; case THROW_EXPR: *************** cplus_expand_expr (exp, target, tmode, m *** 126,132 **** default: return c_expand_expr (exp, target, tmode, modifier); } ! my_friendly_abort (40); /* NOTREACHED */ return NULL; } --- 126,132 ---- default: return c_expand_expr (exp, target, tmode, modifier); } ! abort (); /* NOTREACHED */ return NULL; } *************** void *** 135,141 **** init_cplus_expand () { lang_expand_expr = cplus_expand_expr; - lang_expand_constant = cplus_expand_constant; } int --- 135,140 ---- diff -Nrc3pad gcc-3.0.4/gcc/cp/friend.c gcc-3.1/gcc/cp/friend.c *** gcc-3.0.4/gcc/cp/friend.c Fri Jun 8 12:47:57 2001 --- gcc-3.1/gcc/cp/friend.c Mon Feb 4 08:55:43 2002 *************** add_friend (type, decl) *** 152,158 **** { if (decl == TREE_VALUE (friends)) { ! cp_warning ("`%D' is already a friend of class `%T'", decl, type); cp_warning_at ("previous friend declaration of `%D'", TREE_VALUE (friends)); --- 152,158 ---- { 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)); *************** make_friend_class (type, friend_type) *** 194,200 **** if (! IS_AGGR_TYPE (friend_type)) { ! cp_error ("invalid type `%T' declared `friend'", friend_type); return; } --- 194,200 ---- if (! IS_AGGR_TYPE (friend_type)) { ! error ("invalid type `%T' declared `friend'", friend_type); return; } *************** make_friend_class (type, friend_type) *** 206,212 **** Friend declarations shall not declare partial specializations. */ ! cp_error ("partial specialization `%T' declared `friend'", friend_type); return; } --- 206,212 ---- Friend declarations shall not declare partial specializations. */ ! error ("partial specialization `%T' declared `friend'", friend_type); return; } *************** make_friend_class (type, friend_type) *** 218,224 **** is_template_friend = 1; else if (same_type_p (type, friend_type)) { ! cp_pedwarn ("class `%T' is implicitly friends with itself", type); return; } --- 218,224 ---- is_template_friend = 1; else if (same_type_p (type, friend_type)) { ! pedwarn ("class `%T' is implicitly friends with itself", type); return; } *************** make_friend_class (type, friend_type) *** 236,259 **** else if (TREE_CODE (friend_type) == TYPENAME_TYPE) { /* template friend typename S::X; */ ! cp_error ("typename type `%#T' declared `friend'", friend_type); return; } else if (TREE_CODE (friend_type) == TEMPLATE_TYPE_PARM) { /* template friend class T; */ ! cp_error ("template parameter type `%T' declared `friend'", friend_type); return; } else if (!CLASSTYPE_TEMPLATE_INFO (friend_type)) { /* template friend class A; where A is not a template */ ! cp_error ("`%#T' is not a template", friend_type); return; } - GNU_xref_hier (type, friend_type, 0, 0, 1); - if (is_template_friend) friend_type = CLASSTYPE_TI_TEMPLATE (friend_type); --- 236,257 ---- else if (TREE_CODE (friend_type) == TYPENAME_TYPE) { /* template friend typename S::X; */ ! error ("typename type `%#T' declared `friend'", friend_type); return; } else if (TREE_CODE (friend_type) == TEMPLATE_TYPE_PARM) { /* template friend class T; */ ! error ("template parameter type `%T' declared `friend'", friend_type); return; } else if (!CLASSTYPE_TEMPLATE_INFO (friend_type)) { /* template friend class A; where A is not a template */ ! error ("`%#T' is not a template", friend_type); return; } if (is_template_friend) friend_type = CLASSTYPE_TI_TEMPLATE (friend_type); *************** make_friend_class (type, friend_type) *** 265,271 **** same_type_p (TREE_VALUE (classes), friend_type))) classes = TREE_CHAIN (classes); if (classes) ! cp_warning ("`%T' is already a friend of `%T'", TREE_VALUE (classes), type); else { --- 263,269 ---- 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 { *************** do_friend (ctype, declarator, decl, parm *** 309,315 **** int funcdef_flag; { int is_friend_template = 0; - tree prefix_attributes, attributes; /* Every decl that gets here is a friend of something. */ DECL_FRIEND_P (decl) = 1; --- 307,312 ---- *************** do_friend (ctype, declarator, decl, parm *** 324,330 **** } if (TREE_CODE (decl) != FUNCTION_DECL) ! my_friendly_abort (990513); is_friend_template = PROCESSING_REAL_TEMPLATE_DECL_P (); --- 321,327 ---- } if (TREE_CODE (decl) != FUNCTION_DECL) ! abort (); is_friend_template = PROCESSING_REAL_TEMPLATE_DECL_P (); *************** do_friend (ctype, declarator, decl, parm *** 362,368 **** add_friend (current_class_type, decl); } else ! cp_error ("member `%D' declared as friend before type `%T' defined", decl, ctype); } /* A global friend. --- 359,365 ---- add_friend (current_class_type, decl); } else ! error ("member `%D' declared as friend before type `%T' defined", decl, ctype); } /* A global friend. *************** do_friend (ctype, declarator, decl, parm *** 417,426 **** if (warn) { static int explained; ! cp_warning ("friend declaration `%#D' declares a non-template function", decl); if (! explained) { ! warning ("(if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning."); explained = 1; } } --- 414,423 ---- if (warn) { static int explained; ! warning ("friend declaration `%#D' declares a non-template function", decl); if (! explained) { ! warning ("(if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning"); explained = 1; } } *************** do_friend (ctype, declarator, decl, parm *** 435,457 **** handle them in start_decl_1, but since this is a friend decl start_decl_1 never gets to see it. */ - if (attrlist) - { - attributes = TREE_PURPOSE (attrlist); - prefix_attributes = TREE_VALUE (attrlist); - } - else - { - attributes = NULL_TREE; - prefix_attributes = NULL_TREE; - } - - #ifdef SET_DEFAULT_DECL_ATTRIBUTES - SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes); - #endif - /* Set attributes here so if duplicate decl, will have proper attributes. */ ! cplus_decl_attributes (decl, attributes, prefix_attributes); return decl; } --- 432,439 ---- handle them in start_decl_1, but since this is a friend decl start_decl_1 never gets to see it. */ /* Set attributes here so if duplicate decl, will have proper attributes. */ ! cplus_decl_attributes (&decl, attrlist, 0); return decl; } diff -Nrc3pad gcc-3.0.4/gcc/cp/g++spec.c gcc-3.1/gcc/cp/g++spec.c *** gcc-3.0.4/gcc/cp/g++spec.c Fri Feb 2 17:41:57 2001 --- gcc-3.1/gcc/cp/g++spec.c Tue Apr 23 16:36:52 2002 *************** Boston, MA 02111-1307, USA. */ *** 32,41 **** --- 32,47 ---- #ifndef MATH_LIBRARY #define MATH_LIBRARY "-lm" #endif + #ifndef MATH_LIBRARY_PROFILE + #define MATH_LIBRARY_PROFILE "-lm" + #endif #ifndef LIBSTDCXX #define LIBSTDCXX "-lstdc++" #endif + #ifndef LIBSTDCXX_PROFILE + #define LIBSTDCXX_PROFILE "-lstdc++" + #endif void lang_specific_driver (in_argc, in_argv, in_added_libraries) *************** lang_specific_driver (in_argc, in_argv, *** 45,50 **** --- 51,59 ---- { int i, j; + /* If non-zero, the user gave us the `-p' or `-pg' flag. */ + int saw_profile_flag = 0; + /* If non-zero, the user gave us the `-v' flag. */ int saw_verbose_flag = 0; *************** lang_specific_driver (in_argc, in_argv, *** 137,142 **** --- 146,153 ---- } else if (strcmp (argv[i], "-lc") == 0) args[i] |= WITHLIBC; + 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; *************** lang_specific_driver (in_argc, in_argv, *** 151,156 **** --- 162,168 ---- saw_speclang = 1; else if (((argv[i][2] == '\0' && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL) + || strcmp (argv[i], "-Xlinker") == 0 || strcmp (argv[i], "-Tdata") == 0)) quote = argv[i]; else if (library != 0 && ((argv[i][2] == '\0' *************** lang_specific_driver (in_argc, in_argv, *** 258,271 **** /* Add `-lstdc++' if we haven't already done so. */ if (library) { ! arglist[j++] = LIBSTDCXX; added_libraries++; } if (saw_math) arglist[j++] = saw_math; else if (library && need_math) { ! arglist[j++] = MATH_LIBRARY; added_libraries++; } if (saw_libc) --- 270,283 ---- /* Add `-lstdc++' if we haven't already done so. */ if (library) { ! arglist[j++] = saw_profile_flag ? LIBSTDCXX_PROFILE : LIBSTDCXX; added_libraries++; } if (saw_math) arglist[j++] = saw_math; else if (library && need_math) { ! arglist[j++] = saw_profile_flag ? MATH_LIBRARY_PROFILE : MATH_LIBRARY; added_libraries++; } if (saw_libc) diff -Nrc3pad gcc-3.0.4/gcc/cp/init.c gcc-3.1/gcc/cp/init.c *** gcc-3.0.4/gcc/cp/init.c Wed Jan 23 12:47:11 2002 --- gcc-3.1/gcc/cp/init.c Thu May 2 20:02:41 2002 *************** static tree build_vec_delete_1 PARAMS (( *** 42,48 **** static void perform_member_init PARAMS ((tree, tree, int)); static void sort_base_init PARAMS ((tree, tree, tree *, tree *)); static tree build_builtin_delete_call PARAMS ((tree)); ! static int member_init_ok_or_else PARAMS ((tree, tree, const char *)); static void expand_virtual_init PARAMS ((tree, tree)); static tree sort_member_init PARAMS ((tree, tree)); static tree initializing_context PARAMS ((tree)); --- 42,48 ---- static void perform_member_init PARAMS ((tree, tree, int)); static void sort_base_init PARAMS ((tree, tree, tree *, tree *)); static tree build_builtin_delete_call PARAMS ((tree)); ! static int member_init_ok_or_else PARAMS ((tree, tree, tree)); static void expand_virtual_init PARAMS ((tree, tree)); static tree sort_member_init PARAMS ((tree, tree)); static tree initializing_context PARAMS ((tree)); *************** begin_init_stmts (stmt_expr_p, compound_ *** 97,106 **** if (building_stmt_tree ()) *compound_stmt_p = begin_compound_stmt (/*has_no_scope=*/1); - /* - else - *compound_stmt_p = genrtl_begin_compound_stmt (has_no_scope=1); - */ } /* Finish out the statement-expression begun by the previous call to --- 97,102 ---- *************** finish_init_stmts (stmt_expr, compound_s *** 116,122 **** finish_compound_stmt (/*has_no_scope=*/1, compound_stmt); if (building_stmt_tree ()) ! stmt_expr = finish_stmt_expr (stmt_expr); else stmt_expr = finish_global_stmt_expr (stmt_expr); --- 112,121 ---- 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_init_stmts (stmt_expr, compound_s *** 130,136 **** /* Constructors */ ! /* Called from initialize_vtbl_ptrs via dfs_walk. */ static tree dfs_initialize_vtbl_ptrs (binfo, data) --- 129,137 ---- /* Constructors */ ! /* Called from initialize_vtbl_ptrs via dfs_walk. BINFO is the base ! which we want to initialize the vtable pointer for, DATA is ! TREE_LIST whose TREE_VALUE is the this ptr expression. */ static tree dfs_initialize_vtbl_ptrs (binfo, data) *************** dfs_initialize_vtbl_ptrs (binfo, data) *** 142,157 **** { tree base_ptr = TREE_VALUE ((tree) data); ! if (TREE_VIA_VIRTUAL (binfo)) ! base_ptr = convert_pointer_to_vbase (BINFO_TYPE (binfo), ! base_ptr); ! else ! base_ptr ! = build_vbase_path (PLUS_EXPR, ! build_pointer_type (BINFO_TYPE (binfo)), ! base_ptr, ! binfo, ! /*nonnull=*/1); expand_virtual_init (binfo, base_ptr); } --- 143,149 ---- { tree base_ptr = TREE_VALUE ((tree) data); ! base_ptr = build_base_path (PLUS_EXPR, base_ptr, binfo, /*nonnull=*/1); expand_virtual_init (binfo, base_ptr); } *************** initialize_vtbl_ptrs (addr) *** 175,195 **** list = build_tree_list (type, addr); /* Walk through the hierarchy, initializing the vptr in each base ! class. We do these in pre-order because under the new ABI 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); - - /* If we're not using thunks, we may need to adjust the deltas in - the vtable to handle virtual base classes correctly. When we are - using thunks, we either use construction vtables (which are - preloaded with the right answers) or nothing (in which case - vitual function calls sometimes don't work right.) */ - if (TYPE_USES_VIRTUAL_BASECLASSES (type) && !flag_vtable_thunks) - fixup_all_virtual_upcast_offsets (addr); } /* [dcl.init]: --- 167,179 ---- list = build_tree_list (type, addr); /* Walk through the hierarchy, initializing the vptr in each base ! class. We do these in pre-order because can't find the virtual ! bases for a class until we've initialized the vtbl for that ! class. */ dfs_walk_real (TYPE_BINFO (type), dfs_initialize_vtbl_ptrs, NULL, dfs_unmarked_real_bases_queue_p, list); dfs_walk (TYPE_BINFO (type), dfs_unmark, dfs_marked_real_bases_queue_p, type); } /* [dcl.init]: *************** perform_member_init (member, init, expli *** 296,308 **** { init = build_default_init (type); if (TREE_CODE (type) == REFERENCE_TYPE) ! cp_warning ("default-initialization of `%#D', which has reference type", member); } /* member traversal: note it leaves init NULL */ else if (TREE_CODE (type) == REFERENCE_TYPE) ! cp_pedwarn ("uninitialized reference member `%D'", member); } else if (TREE_CODE (init) == TREE_LIST) { --- 280,292 ---- { init = build_default_init (type); if (TREE_CODE (type) == REFERENCE_TYPE) ! warning ("default-initialization of `%#D', which has reference type", member); } /* member traversal: note it leaves init NULL */ else if (TREE_CODE (type) == REFERENCE_TYPE) ! pedwarn ("uninitialized reference member `%D'", member); } else if (TREE_CODE (init) == TREE_LIST) { *************** sort_member_init (t, member_init_list) *** 440,446 **** /* If there was already an explicit initializer for this field, issue an error. */ if (TREE_TYPE (f)) ! cp_error ("multiple initializations given for member `%D'", initialized_field); else { --- 424,430 ---- /* If there was already an explicit initializer for this field, issue an error. */ if (TREE_TYPE (f)) ! error ("multiple initializations given for member `%D'", initialized_field); else { *************** sort_member_init (t, member_init_list) *** 512,518 **** if (same_type_p (last_field_type, field_type)) { if (TREE_CODE (field_type) == UNION_TYPE) ! cp_error ("initializations for multiple members of `%T'", last_field_type); done = 1; break; --- 496,502 ---- if (same_type_p (last_field_type, field_type)) { if (TREE_CODE (field_type) == UNION_TYPE) ! error ("initializations for multiple members of `%T'", last_field_type); done = 1; break; *************** sort_base_init (t, base_init_list, rbase *** 565,632 **** tree vbases = NULL_TREE; /* First walk through and splice out vbase and invalid initializers. ! Also replace names with binfos. */ last = tree_cons (NULL_TREE, NULL_TREE, base_init_list); for (x = TREE_CHAIN (last); x; x = TREE_CHAIN (x)) { tree basetype = TREE_PURPOSE (x); ! tree binfo = NULL_TREE; ! if (basetype == NULL_TREE) { ! /* Initializer for single base class. Must not ! use multiple inheritance or this is ambiguous. */ ! switch (n_baseclasses) ! { ! case 0: ! cp_error ("`%T' does not have a base class to initialize", ! current_class_type); ! return; ! case 1: ! break; ! default: ! cp_error ("unnamed initializer ambiguous for `%T' which uses multiple inheritance", ! current_class_type); ! return; ! } ! binfo = TREE_VEC_ELT (binfos, 0); } ! else if (is_aggr_type (basetype, 1)) { ! binfo = binfo_or_else (basetype, t); ! if (binfo == NULL_TREE) ! continue; ! /* Virtual base classes are special cases. Their initializers ! are recorded with this constructor, and they are used when ! this constructor is the top-level constructor called. */ ! if (TREE_VIA_VIRTUAL (binfo)) ! { ! tree v = binfo_for_vbase (BINFO_TYPE (binfo), t); ! vbases = tree_cons (v, TREE_VALUE (x), vbases); ! continue; ! } ! else ! { ! /* Otherwise, if it is not an immediate base class, complain. */ ! for (i = n_baseclasses-1; i >= 0; i--) ! if (BINFO_TYPE (binfo) == BINFO_TYPE (TREE_VEC_ELT (binfos, i))) ! break; ! if (i < 0) ! { ! cp_error ("`%T' is not an immediate base class of `%T'", ! basetype, current_class_type); ! continue; ! } ! } } - else - my_friendly_abort (365); - - TREE_PURPOSE (x) = binfo; - TREE_CHAIN (last) = x; - last = x; } TREE_CHAIN (last) = NULL_TREE; --- 549,588 ---- tree vbases = NULL_TREE; /* First walk through and splice out vbase and invalid initializers. ! Also replace types with binfos. */ last = tree_cons (NULL_TREE, NULL_TREE, base_init_list); for (x = TREE_CHAIN (last); x; x = TREE_CHAIN (x)) { tree basetype = TREE_PURPOSE (x); ! tree binfo = (TREE_CODE (basetype) == TREE_VEC ! ? basetype : binfo_or_else (basetype, t)); ! ! if (binfo == NULL_TREE) ! /* BASETYPE might be an inaccessible direct base (because it ! is also an indirect base). */ ! continue; ! if (TREE_VIA_VIRTUAL (binfo)) { ! /* Virtual base classes are special cases. Their ! initializers are recorded with this constructor, and they ! are used when this constructor is the top-level ! constructor called. */ ! tree v = binfo_for_vbase (BINFO_TYPE (binfo), t); ! vbases = tree_cons (v, TREE_VALUE (x), vbases); } ! else { ! /* Otherwise, it must be an immediate base class. */ ! my_friendly_assert ! (same_type_p (BINFO_TYPE (BINFO_INHERITANCE_CHAIN (binfo)), ! t), 20011113); ! TREE_PURPOSE (x) = binfo; ! TREE_CHAIN (last) = x; ! last = x; } } TREE_CHAIN (last) = NULL_TREE; *************** sort_base_init (t, base_init_list, rbase *** 671,677 **** } else if (binfo == base_binfo) { ! cp_error ("base class `%T' already initialized", BINFO_TYPE (binfo)); break; } --- 627,633 ---- } else if (binfo == base_binfo) { ! error ("base class `%T' already initialized", BINFO_TYPE (binfo)); break; } *************** emit_base_init (mem_init_list, base_init *** 742,756 **** init = NULL_TREE; if (extra_warnings && DECL_COPY_CONSTRUCTOR_P (current_function_decl)) ! cp_warning ("base class `%#T' should be explicitly initialized in the copy constructor", BINFO_TYPE (base_binfo)); } if (init != void_list_node) { ! member = convert_pointer_to_real (base_binfo, current_class_ptr); expand_aggr_init_1 (base_binfo, NULL_TREE, ! build_indirect_ref (member, NULL_PTR), init, LOOKUP_NORMAL); } --- 698,713 ---- init = NULL_TREE; if (extra_warnings && DECL_COPY_CONSTRUCTOR_P (current_function_decl)) ! warning ("base class `%#T' should be explicitly initialized in the copy constructor", BINFO_TYPE (base_binfo)); } if (init != void_list_node) { ! member = build_base_path (PLUS_EXPR, current_class_ptr, ! base_binfo, 1); expand_aggr_init_1 (base_binfo, NULL_TREE, ! build_indirect_ref (member, NULL), init, LOOKUP_NORMAL); } *************** emit_base_init (mem_init_list, base_init *** 784,790 **** if (warn_ecpp && init == NULL_TREE && !DECL_ARTIFICIAL (member) && TREE_CODE (TREE_TYPE (member)) != ARRAY_TYPE) ! cp_warning ("`%D' should be initialized in the member initialization list", member); } perform_member_init (member, init, from_init_list); --- 741,747 ---- if (warn_ecpp && init == NULL_TREE && !DECL_ARTIFICIAL (member) && TREE_CODE (TREE_TYPE (member)) != ARRAY_TYPE) ! warning ("`%D' should be initialized in the member initialization list", member); } perform_member_init (member, init, from_init_list); *************** static void *** 839,858 **** expand_virtual_init (binfo, decl) tree binfo, decl; { - tree type = BINFO_TYPE (binfo); tree vtbl, vtbl_ptr; - tree vtype, vtype_binfo; tree vtt_index; - /* Compute the location of the vtable. */ - vtype = DECL_CONTEXT (TYPE_VFIELD (type)); - vtype_binfo = get_binfo (vtype, TREE_TYPE (TREE_TYPE (decl)), 0); - /* Compute the initializer for vptr. */ vtbl = build_vtbl_address (binfo); ! /* Under the new ABI, we may get this vptr from a VTT, if this is a ! subobject constructor or subobject destructor. */ vtt_index = BINFO_VPTR_INDEX (binfo); if (vtt_index) { --- 796,809 ---- expand_virtual_init (binfo, decl) tree binfo, decl; { tree vtbl, vtbl_ptr; tree vtt_index; /* Compute the initializer for vptr. */ vtbl = build_vtbl_address (binfo); ! /* We may get this vptr from a VTT, if this is a subobject ! constructor or subobject destructor. */ vtt_index = BINFO_VPTR_INDEX (binfo); if (vtt_index) { *************** expand_virtual_init (binfo, decl) *** 879,888 **** } /* Compute the location of the vtpr. */ ! decl = convert_pointer_to_real (vtype_binfo, decl); ! vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, NULL_PTR), vtype); ! if (vtbl_ptr == error_mark_node) ! return; /* Assign the vtable to the vptr. */ vtbl = convert_force (TREE_TYPE (vtbl_ptr), vtbl, 0); --- 830,838 ---- } /* Compute the location of the vtpr. */ ! vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, NULL), ! TREE_TYPE (binfo)); ! my_friendly_assert (vtbl_ptr != error_mark_node, 20010730); /* Assign the vtable to the vptr. */ vtbl = convert_force (TREE_TYPE (vtbl_ptr), vtbl, 0); *************** expand_aggr_vbase_init_1 (binfo, exp, ad *** 925,931 **** tree binfo, exp, addr, init_list; { tree init = purpose_member (binfo, init_list); ! tree ref = build_indirect_ref (addr, NULL_PTR); if (init) init = TREE_VALUE (init); --- 875,881 ---- tree binfo, exp, addr, init_list; { tree init = purpose_member (binfo, init_list); ! tree ref = build_indirect_ref (addr, NULL); if (init) init = TREE_VALUE (init); *************** construct_virtual_bases (type, this_ref, *** 951,972 **** /* If there are no virtual baseclasses, we shouldn't even be here. */ my_friendly_assert (TYPE_USES_VIRTUAL_BASECLASSES (type), 19990621); - /* First set the pointers in our object that tell us where to find - our virtual baseclasses. */ - if (!vbase_offsets_in_vtable_p ()) - { - tree if_stmt; - tree result; - - if_stmt = begin_if_stmt (); - finish_if_stmt_cond (flag, if_stmt); - result = init_vbase_pointers (type, this_ptr); - if (result) - finish_expr_stmt (build_compound_expr (result)); - finish_then_clause (if_stmt); - finish_if_stmt (); - } - /* Now, run through the baseclasses, initializing each. */ for (vbases = CLASSTYPE_VBASECLASSES (type); vbases; vbases = TREE_CHAIN (vbases)) --- 901,906 ---- *************** static int *** 1043,1061 **** member_init_ok_or_else (field, type, member_name) tree field; tree type; ! const char *member_name; { if (field == error_mark_node) return 0; if (field == NULL_TREE || initializing_context (field) != type) { ! cp_error ("class `%T' does not have any field named `%s'", type, member_name); return 0; } if (TREE_STATIC (field)) { ! cp_error ("field `%#D' is static; only point of initialization is its declaration", field); return 0; } --- 977,995 ---- member_init_ok_or_else (field, type, member_name) tree field; tree type; ! tree member_name; { if (field == error_mark_node) return 0; if (field == NULL_TREE || initializing_context (field) != type) { ! error ("class `%T' does not have any field named `%D'", type, member_name); return 0; } if (TREE_STATIC (field)) { ! error ("field `%#D' is static; the only point of initialization is its definition", field); return 0; } *************** member_init_ok_or_else (field, type, mem *** 1063,1079 **** return 1; } ! /* If NAME is a viable field name for the aggregate DECL, ! and PARMS is a viable parameter list, then expand an _EXPR ! which describes this initialization. ! ! Note that we do not need to chase through the class's base classes ! to look for NAME, because if it's in that list, it will be handled ! by the constructor for that base class. ! We do not yet have a fixed-point f