Commit Graph

809 Commits

Author SHA1 Message Date
Paolo Bonzini 096f22f424 function.h (struct function): Remove cannot_inline field.
gcc/ChangeLog:
2004-06-15  Paolo Bonzini  <bonzini@gnu.org>

	* function.h (struct function): Remove cannot_inline field.
	(current_function_cannot_inline): Remove.
	* passes.c (rest_of_compilation): Reset DECL_DEFER_OUTPUT.
	Simplify conditionals to ignore warn_return_type.
	* tree-optimize.c (tree_rest_of_compilation): Do not reset
	DECL_DEFER_OUTPUT.
	* objc/objc-act.c (build_module_descriptor, finish_method_def):
	Do not set current_function_cannot_inline.

gcc/java/ChangeLog:
2004-06-15  Paolo Bonzini  <bonzini@gnu.org>

	* class.c (emit_register_classes): Make the function uninlinable,
	do not set current_function_cannot_inline.
	* resource.c (write_resource_constructor): Do not reset
	flag_inline_functions around rest_of_compilation.

gcc/cp/ChangeLog:
2004-06-15  Paolo Bonzini  <bonzini@gnu.org>

	* cp-tree.h (struct language_function): Remove cannot_inline.
	* decl.c (save_function_data): cannot_inline is no more.
	(cxx_push_function_context): Likewise.
	* decl2.c (start_objects, start_static_storage_duration_function):
	Reset DECL_INLINE, set DECL_UNINLINABLE.

From-SVN: r83181
2004-06-15 12:46:07 +00:00
Matt Austern 0524c91d1e re PR c++/15428 (vtables shouldn't always be weak on Darwin)
PR c++/15428
	* default.h (TARGET_WEAK_NOT_IN_ARCHIVE_TOC): New name
	for TARGET_EXPLICIT_INSTANTIATIONS_ONE_ONLY, with reversed sense.
	* config/darwin.h (TARGET_WEAK_NOT_IN_ARCHIVE_TOC): Likewise.
	* doc/tm.texi (TARGET_WEAK_NOT_IN_ARCHIVE_TOC): Rewrite
	documentation to reflect the new macro name and to clarify its
	meaning.
	* cp/decl2.c (maybe_emit_vtables): If TARGET_WEAK_NOT_IN_ARCHIVE_TOC
	is nonzero, and if we see a noninline definition of a key method,
	make the vtables nonweak.

From-SVN: r82610
2004-06-03 23:15:01 +00:00
Matt Austern 415c974c0b When a class template is explicitly instantiated, its member should be too.
* cp-tree.h (instantiate_decl): new boolean parameter,
	undefined_ok. Current behavior is equivalent to its being 0.
	* decl2.c (mark_used): Add new argument when calling instantiate_decl
	* pt.c (mark_decl_instantiated): Unconditionally make
	instantiations explicit unconditionally
	(do_decl_instantiation): Don't call SET_DECL_EXPLICIT_INSTANTIATION,
	since mark_decl_instantiated now does it.
	(instantiate_class_member): New.  Instantiate a member of an
	explicitly instantiated class template.
	(do_type_instantiation): Explicitly instantiate members of an
	explicitly instantiated class template.
	(instantiate_decl): if undefined_ok is nonzero, and if we're
	trying to explicitly instantiated a template with no definition,
	change it to an implicit instantiation.
	(instantiate_pending_templates): Add new argument to instantiate_decl.
	* tree.c (cp_cannot_inline_tree_fn): Likewise.

From-SVN: r82585
2004-06-02 21:12:54 +00:00
Kazu Hirata 324f9dfb93 call.c, [...]: Fix comment formatting.
* call.c, class.c, cp-tree.def, decl2.c, name-lookup.c, pt.c,
	typeck.c: Fix comment formatting.

From-SVN: r82476
2004-05-31 08:42:32 +00:00
Mark Mitchell c1cca8d4eb re PR c++/15083 (spurious "statement has no effect" warning)
PR c++/15083
	* decl2.c (delete_sanity): Set TREE_SIDE_EFFECTS on a DELETE_EXPR,
	even in a templat.e
	* init.c (build_new): Likewise.

	PR c++/15640
	* name-lookup.c (arg_assoc): Robustify.

	PR c++/15471
	* typeck.c (unary_complex_lvalue): Use context_for_name_lookup
	when determining the scope to use for a pointer to member.

	PR c++/15083
	* g++.dg/warn/noeffect5.C: New test.

	PR c++/15471
	* g++.dg/expr/ptrmem4.C: New test.

	PR c++/15640
	* g++.dg/template/operator3.C: New test.

From-SVN: r82391
2004-05-28 22:35:50 +00:00
Geoffrey Keating bf2774382d method.c (implicitly_declare_fn): Don't call defer_fn; abort if it might be needed.
* method.c (implicitly_declare_fn): Don't call defer_fn; abort
	if it might be needed.
	* pt.c (mark_decl_instantiated): Only call defer_fn if
	the function actually needs processing in finish_file.
	* decl2.c (finish_file): Add check that elements in
	deferred_fns_used are really needed there.  Remove unnecessary
	test of DECL_SAVED_TREE.

From-SVN: r82217
2004-05-24 21:07:42 +00:00
Zack Weinberg bb9a388dad * cgraph.c (hash_node, eq_node, cgraph_node, cgraph_remove_node)
(cgraph_varpool_hash_node, eq_cgraph_varpool_node)
	(cgraph_varpool_node):
	Use DECL_UID for the key, not DECL_ASSEMBLER_NAME.
	(cgraph_function_possibly_inlined_p): Use the decl itself for
	the key, not DECL_ASSEMBLER_NAME.
	(change_decl_assembler_name): No need to muck with the hash tables.
	(cgraph_node_for_identifier, cgraph_varpool_node_for_identifier):
	Delete.
	* cgraphunit.c (cgraph_mark_inline_edge): Use the decl itself
	for the key, not DECL_ASSEMBLER_NAME.
	* cgraph.h: Remove prototypes of deleted functions.
	* varasm.c (mark_referenced): Just set TREE_SYMBOL_REFERENCED.
	(mark_decl_referenced): New function.
	* tree.h: Prototype mark_decl_referenced.
	* final.c (output_addr_const) <case SYMBOL_REF>: Call
	mark_decl_referenced before assemble_name.
	* c-decl.c (finish_decl): Use mark_decl_referenced.
cp:
	* decl.c (cp_finish_decl): Use mark_decl_referenced.
	* decl2.c (maybe_make_one_only): Likewise.
	* method.c (use_thunk): Likewise.

From-SVN: r82015
2004-05-19 01:28:56 +00:00
Diego Novillo 6de9cd9a88 Merge tree-ssa-20020619-branch into mainline.
From-SVN: r81764
2004-05-13 02:41:07 -04:00
Giovanni Bajo 4402147197 re PR c++/14389 (Out-of-line of overloaded template rejected)
PR c++/14389
	* decl2.c (check_classfn): For member templates, compare also the
	template parameters to match the declaration.
	* cp-tree.h: Adjust declaration of check_classfn.
	* decl.c (start_decl, grokfndecl): Adjust callers of check_classfn.
	* friend.c (do_friend): Likewise.
	* pt.c (tsubst_friend_function): Likewise.

	PR c++/14389
	* g++.dg/template/member5.C: New test.

From-SVN: r81426
2004-05-03 10:11:19 +00:00
Kazu Hirata a692ad2ece class.c, [...]: Fix comment typos.
* class.c, cp-tree.h, decl.c, decl2.c, pt.c, rtti.c: Fix
	comment typos.

From-SVN: r81344
2004-04-30 15:51:53 +00:00
Jakub Jelinek a7485e9375 decl2.c (mark_used): Don't segfault if cfun != NULL but current_function_decl == NULL.
* decl2.c (mark_used): Don't segfault if cfun != NULL but
	current_function_decl == NULL.

From-SVN: r80506
2004-04-08 15:38:00 +02:00
Mark Mitchell 4546865e5b call.c (build_op_delete_call): Do not forget the placement arguments when iterating through mutiple delete...
* call.c (build_op_delete_call): Do not forget the placement
	arguments when iterating through mutiple delete operators.

	* cp-tree.h (svaed_scope): Remove last_parms.
	(NEW_DELETE_OPNAME_P): New macro.
	(last_function_parms): Remove.
	(do_friend): Adjust prototype.
	* decl.c (grokparms): Return the PARM_DECLs directly, rather than
	using last_function_parms.
	(grokfndecl): Take the PARM_DECLs as an argument, rather than
	using last_function_parms.
	(grokdeclarator): Adjust accordingly.  Do not form METHOD_TYPEs
	for class-specific operator new and operator delete.
	(grok_op_properties): Do not look for allocation functions with
	METHOD_TYPEs.
	(start_function): Use DECL_ARGUMENTS instead of
	last_function_parms.
	* decl.h (last_function_parms): Do not declare.
	* decl2.c (grokclassfn): Do not use last_function_parms.
	* friend.c (do_friend): Remove parmdecls parameter.
	* name-lookup.c (push_to_top_level): Do not save last_function_parms.
	(pop_from_top_level): Do not restore it.
	* pt.c (check_explicit_specialization): Do not adjust
	last_function_parms.

	* name-lookup.c (do_local_using_decl): Create a local binding for
	types brought in via using declarations.

	* name-lookup.c (lookup_arg_dependent): Handle block-scope
	function declarations correctly.

	* semantics.c (finish_id_expression): Correct handling of
	conversion operators to dependent types.

	* typeck.c (lookup_destructor): Allow the use of destructors from
	base classes.

	* g++.dg/init/placement3.C: New test.

	* g++.dg/template/spec13.C: New test.

	* g++.dg/lookup/using11.C: New test.

	* g++.dg/lookup/koenig3.C: New test.

	* g++.dg/template/operator2.C: New test.

	* g++.dg/expr/dtor3.C: New test.
	* g++.old-deja/g++.brendan/crash15.C: Remove incorrect dg-error
	marker.
	* g++.old-deja/g++.law/visibility28.C: Likewise.

From-SVN: r79722
2004-03-20 00:18:24 +00:00
Mark Mitchell ec835fb2bf re PR c++/14586 (Bogus warning in templates about taking address of a temporary in a template)
PR c++/14586
	* cp-tree.h (build_new_op): Change prototype.
	(build_x_binary_op): Likewise.
	* call.c (build_new_op): Add overloaded_p parameter.
	* decl2.c (grok_array_decl): Adjust call to build_new_op.
	* parser.c (cp_parser_binary_expression): Note that uses of
	overloaded operators prevents an expression from being considered
	an integral constant.
	* pt.c (tsubst_copy_and_build): Adjust calls to build_new_op and/or
	build_x_binary_op.
	* semantics.c (finish_call_expr): Likewise.
	* typeck.c (rationalize_conditional_expr): Likewise.
	(build_x_indirect_ref): Likewise.
	(build_x_binary_op): Likewise.
	(build_x_unary_op): Likewise.
	(build_x_compound_expr): Likewise.
	(build_modify_expr): Likewise.
	* typeck2.c (build_x_arrow): Likewise.

	PR c++/14586
	* g++.dg/parse/non-dependent3.C: New test.

From-SVN: r79553
2004-03-16 22:18:11 +00:00
Matt Austern 4746cf8447 Enabled linkonce support for Darwin.
* target.h (struct gcc_target): New target hook, unwind_label.
	* target-def.h (TARGET_ASM_EMIT_UNWIND_LABEL): New hook.
	* output.h (default_emit_unwind_label): New function.
	* default.h (TARGET_EXPLICIT_INSTANTIATIONS_ONE_ONLY): New macro.
	(TARGET_USES_WEAK_UNWIND_INFO): New target macro.
	(TARGET_SUPPORTS_HIDDEN): New target macro.
	* dwarf2out.c (struct dw_fde_struct): Add field for function decl
	that corresponds to this FDE.
	(FRAME_BEGIN_LABEL): Allow target to override default label.
	(output_call_frame_info): If FDEs are linknonce, then use extra
	indirection for FDE encoding, output a label for each FDE, and
	output an empty label for each function without an FDE.
	(dwarf2out_begin_prologue): Set up decl field when creating an FDE.
	* varasm.c (globalize_decl): Call ASM_MAKE_LABEL_LINKONCE for
	decls with DECL_ONE_ONLY set, if that macro is defined.
	(make_decl_one_only): Don't use DECL_COMMON if we're compiling
	for a SUPPORTS_ONE_ONLY target.
	* config/darwin-protos.h (darwin_unique_section): Declare.
	(darwin_asm_named_section): Likewise.
	(darwin_section_type_flags): Likewise.
	(darwin_non_lazy_pcrel): Likewise.
	(darwin_emit_unwind_label): Likewise.
	(darwin_make_decl_one_only): Likewise.
	* config/darwin.c (machopic_finish): Get rid of tweak that
	eliminate stubs for symbols that are defined.
	(darwin_encode_section_info): Don't treat weak functions as defined.
	(darwin_make_decl_one_only): Define.
	(darwin_asm_named_section): Likewise.
	(darwin_section_type_flags): Likewise.
	(darwin_unique_section): Likewise.
	(darwin_emit_unwind_label): Likewise.
	(darwin_non_lazy_pcrel): Likewise.
	(darwin_asm_output_dwarf_delta): Difference between two labels is
	local only if both labels are local.
	* config/darwin.h (MAKE_DECL_ONE_ONLY): Define.
	(ASM_MAKE_LABEL_LINKONCE): Likewise.
	(TARGET_SUPPORTS_HIDDEN): Likewise.
	(TARGET_USES_WEAK_UNWIND_INFO): Likewise.
	(TARGET_EXPLICIT_INSTANTIATIONS_ONE_ONLY): Likewise.
	(FRAME_BEGIN_LABEL): Likewise.
	(ASM_DECLARE_OBJECT_NAME): Make references to weak symbols indirect.
	(ASM_DECLARE_FUNCTION_NAME): Likewise.
	(darwin_eh_frame_section): Give __eh_frame section the coalesced flag.
	(TARGET_ASM_UNIQUE_SECTION): Define.
	(EH_FRAME_SECTION_NAME): Define.
	(EH_FRAME_SECTION_ATTR): Likewise.
	(ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Likewise.
	(TARGET_ASM_NAMED_SECTION): Likewise.
	(TARGET_SECTION_TYPE_FLAGS): Likewise.
	* doc/tm.texi: Document TARGET_USES_WEAK_UNWIND_INFO,
	TARGET_EXPLICIT_INSTANTIATIONS_ONE_ONLY, TARGET_SUPPORTS_HIDDEN,
	TARGET_ASM_EMIT_UNWIND_LABEL.

	* cp/decl2.c (maybe_make_one_only): Look at
	TARGET_EXPLICIT_INSTANTIATION_ONE_ONLY when deciding whether
	to make an explicit instantiation weak.
	* cp/method.c (use_thunk): Make sure we call comdat_linkage
	when appropriate.
	* cp/pt.c (do_type_instantiation): On systems where weak symbols
	don't go in a static archive's TOC, explicit instantiation of a
	class must imply *explicit* instantiation of its memeber.

From-SVN: r79394
2004-03-12 17:09:03 +00:00
Mark Mitchell 91b004e5ec re PR c++/14138 (100x -O0 C++ Compile Time Regression {3.2,3.3} -> {3.4,4.0})
PR c++/14138
	* name-lookup.h (push_scope): Change prototype.
	* name-lookup.c (push_scope): Do not reenter the current class
	scope.
	* decl.c (grokfndecl): Check return code from push_scope before
	calling pop_scope.
	* decl2.c (check_classfn): Likewise.
	* parser.c (cp_parser_conversion_function_id): Likewise.
	(cp_parser_init_declarator): Likewise.
	(cp_parser_direct_declarator): Likewise.
	(cp_parser_class_specifier): Likewise.
	(cp_parser_class_head): Likewise.
	(cp_parser_lookup_name): Likewise.
	(cp_parser_constructor_declarator_p): Likewise.
	* pt.c (instantiate_class_template): Likewise.
	(resolve_typename_type): Likewise.

From-SVN: r78696
2004-03-01 06:23:38 +00:00
Mark Mitchell 0e8c9b28a1 re PR c++/14122 (problem with non-type tmplt parm in member template)
PR c++/14122
	* cp-tree.h (delete_sanity): Change prototype.
	* decl2.c (delete_sanity): Make doing_vec a bool, not an int.
	Remove dead code.  Adjust code to warn about deleting an array.
	* typekc.c (decay_conversion): Use build_address and build_nop.

	PR c++/14108
	* search.c (accessible_p): Do not check access in thunks.

	PR c++/14122
	* g++.dg/template/array4.C: New test.

	PR c++/14108
	* g++.dg/inherit/thunk2.C: New test.

From-SVN: r77786
2004-02-14 00:49:15 +00:00
Mark Mitchell 5bd61841e4 call.c (conversion_kind): New type.
* call.c (conversion_kind): New type.
	(conversion_rank): Likewise.
	(conversion): Likewise.
	(CONVERSION_RANK): New macro.
	(conversion_obstack): New variable.
	(obstack_initialized): Likewise.
	(z_candidate): Change type of convs and second_conv.
	(candidate_warning): New type.
	(IDENTITY_RANK): Remove.
	(EXACT_RANK): Likewise.
	(PROMO_RANK): Likewise.
	(STD_RANK): Likewise.
	(PBOOL_RANK): Likewise.
	(USER_RANK): Likewise.
	(ELLIPSIS_RANK): Likewise.
	(BAD_RANK): Likewise.
	(ICS_RANK): Likewise.
	(ICS_STD_RANK): Likewise.
	(ICS_USER_FLAG): Likewise.
	(ICS_ELLIPSIS_FLAG): Likewise.
	(ICS_THIS_FLAG): Likewise.
	(ICS_BAD_FLAG): Likewise.
	(NEED_TEMPORARY_P): Likewise.
	(CHECK_COPY_CONSTRUCTOR_P): Likewise.
	(USER_CONV_CAND): Likewise.
	(USER_CONV_FN): Likewise.
	(conversion_obstack_alloc): New function.
	(alloc_conversion): Likewise.
	(validate_conversion_obstack): Likewise.
	(alloc_conversions): Likewise.
	(build_conv): Adjust to deal with new conversion data structures.
	(build_identity_conv): New function.
	(build_ambiguous_conv): Likewise.
	(standard_conversion): Adjust to deal with new conversion data
	structures.
	(convert_class_to_reference): Likewise.
	(direct_reference_binding): Likewise.
	(reference_binding): Likewise.
	(implicit_conversion): Likewise.
	(add_candidate): Likewise.
	(add_function_candidate): Likewise.
	(add_conv_candidate): Likewise.
	(build_builtin_candidate): Likewise.
	(print_z_candidate): Likewise.
	(merge_conversion_sequences): Likewise.
	(build_user_type_conversion_1): Likewise.
	(build_user_type_conversion): Likewise.
	(build_new_function_call): Likewise.
	(build_object_call): Likewise.
	(conditional_conversion): Likewise.
	(build_conditional_expr): Likewise.
	(build_new_op): Likewise.
	(build_op_delete_call): Likewise.
	(convert_like_real): Likewise.
	(build_over_call): Likewise.
	(build_new_method_call): Likewise.
	(is_subseq): Likewise.
	(maybe_handle_implicit_object): Likewise.
	(maybe_handle_ref_bind): Likewise.
	(compare_ics): Likewise.
	(source_type): Likewise.
	(add_warning): Likewise.
	(joust): Likewise.
	(can_convert_arg): Likewise.
	(can_convert_arg_bad): Likewise.
	(perform_implicit_conversion): Likewise.
	(perform_direct_initialization_if_possible): Likewise.
	(initialize_reference): Likewise.
	* cp-lang.c (cp_tree_size): Do not handle WRAPPER.
	* cp-tree.def (WRAPPER): Likewise.
	(IDENTITY_CONV): Remove.
	(LVALUE_CONV): Likewise.
	(QUAL_CONV): Likewise.
	(STD_CONV): Likewise.
	(PTR_CONV): Likewise.
	(PMEM_CONV): Likewise.
	(BASE_CONV): Likewise.
	(REF_BIND): Likewise.
	(USER_CONV): Likewise.
	(AMBIG_CONV): Likewise.
	(RVALUE_CONV): Likewise.
	* cp-tree.h (tree_wrapper): Remove.
	(WRAPPER_ZC): Remove.
	(lang_tree_node): Remove wrapper.
	(LOOKUP_SPECULATIVELY): Remove.
	(build_op_delete_call): Adjust prototype.
	(validate_conversion_obstack): Declare.
	(build_zc_wrapper): Remove.
	* cvt.c (convert_to_reference): Remove dead code.
	(ocp_convert): Likewise.
	* decl.c (redeclaration_error_message): Correct handling of
	templates.
	(finish_destructor_body): Do not use LOOKUP_SPECULATIVELY.
	(cp_tree_node_structure): Remove WRAPPER case.
	* decl2.c (finish_file): Call validate_conversion_obstack.
	* init.c (build_new_1): Remove use of LOOKUP_SPECULATIVELY.
	(build_op_delete_call): Likewise.
	(build_x_delete): Likewise.
	(build_delete): Adjust call to build_op_delete_call.
	* pt.c (tsubst_friend_declaration): Adjust code to determine
	whether or not a friend template is a definition.
	(tsubst_decl): Clear DECL_INITIAL for new FUNCTION_DECLs.
	* tree.c (build_zc_wrapper): Remove.

From-SVN: r77752
2004-02-13 07:19:25 +00:00
Mark Mitchell c353b8e3fb class.c (add_method): Just check processing_template_decl to determine whether or not we are within a...
* class.c (add_method): Just check processing_template_decl to
	determine whether or not we are within a template.
	* decl2.c (maybe_retrofit_in_chrg): Likewise.
	* init.c (decl_constant_value): Check the type of the declaration,
	not TREE_READONLY.
	* name-lookup.c (maybe_push_to_top_level): Rename to ...
	(push_to_top_level): ... this.
	* name-lookup.h (maybe_push_to_top_level): Do not declare it.
	* pt.c (push_template_decl_real): Reorder condition for speed.
	(convert_template_argument): Use dependency-checking functions in
	place of uses_template_parms.
	(lookup_template_class): Avoid calling uses_template_parms more
	than once.
	(uses_template_parms): Reimplement, using dependency-checking
	functions.
	(instantiate_class_template): Use push_to_top_level, not
	maybe_push_to_top_level.
	(type_unification_real): Simplify.
	(type_dependent_expression_p): Handle OFFSET_REFs and
	TEMPLATE_DECLs.
	(any_dependent_template_arguments_p): Handle multiple levels of
	template argument.
	* semantics.c (expand_or_defer_fn): Do not check
	uses_template_parms for template instantiations.
	* typeck.c (comptypes): Avoid calling cp_type_quals.

From-SVN: r76647
2004-01-26 17:41:50 +00:00
Kazu Hirata 521cc5083b Make-lang.in, [...]: Update copyright.
* Make-lang.in, call.c, class.c, decl2.c, except.c, expr.c,
	init.c, mangle.c, typeck.c: Update copyright.

From-SVN: r76304
2004-01-21 20:52:28 +00:00
Jan Hubicka d34cb6a149 Partial fix PR c++/12850
Partial fix PR c++/12850
	* cgraphunit.c (cgraph_finalize_function): Always ggc_collect when
	at zero nest level.

	* decl2.c (mark_used): Do not proactively instantiate templates
	when compiling in unit-at-a-time or not optimizing.
	* optimize.c (maybe_clone_body): Do not increase function depth.

From-SVN: r75823
2004-01-13 23:59:19 +00:00
Richard Henderson 25ebb82a64 re PR rtl-optimization/10776 (Large aggregate initializers with a single relocated entry causes excessive compile time regression)
PR opt/10776
        * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): New.
        (store_init_value): Use it.
        * decl.c (check_initializer): Expect full initialization code
        from store_init_value.
        * init.c (expand_aggr_init_1): Likewise.
        * decl2.c (maybe_emit_vtables): Abort if runtime init needed.

From-SVN: r75763
2004-01-12 13:38:04 -08:00
Mark Mitchell 57702a80e8 c-common.c (flag_abi_version): Default to 2.
* c-common.c (flag_abi_version): Default to 2.
	* c-cppbuiltin.c (c_cpp_builtins): Define __GXX_ABI_VERSION
	uniformly for versions above 2.
	* doc/invoke.texi: Update documentation for -fabi-version.

	* cp-lang.c (cp_expr_size): Return zero for empty classes.

	* cp-tree.h (warn_if_uknown_interface): Remove unused function.
	* decl2.c (warn_if_unknown_interface): Likewise.

	* g++.dg/abi/macro0.C: New test.
	* g++.dg/abi/macro1.C: Likewise.
	* g++.dg/abi/macro2.C: Likewise.

	* g++.dg/abi/bitfield5.C: Add explicit -fabi-version=1 option.
	* g++.dg/abi/bitfield7.C: Likewise.
	* g++.dg/abi/dtor2.C: Likewise.
	* g++.dg/abi/mangle11.C: Likewise.
	* g++.dg/abi/mangle12.C: Likewise.
	* g++.dg/abi/mangle14.C: Likewise.
	* g++.dg/abi/mangle17.C: Likewise.
	* g++.dg/abi/vbase10.C: Likewise.
	* g++.dg/abi/vbase14.C: Likewise.
	* g++.dg/template/qualttp17.C: Likewise.

From-SVN: r74973
2003-12-23 16:53:53 +00:00
Mark Mitchell 7813d14ccc re PR c++/12862 (Conflicts Between typedefs/enums and Namespace Member Declarations)
* c-common.c (flag_external_templates): Remove.
	(flag_alt_external_templates): Likewise.
	* c-common.h (flag_external_templates): Remove.
	(flag_alt_external_templates): Likewise.
	* c-opts.c (c_common_handle_option): Unsupport
	-falt-external-templates and -ftemplates.
	* doc/invoke.texi: Remove mention of -fexternal-templates and
	-falt-external-templates.

	* decl.c (start_function): Do not check
	flag_alt_external_templates or flag_external_templates.
	* decl2.c (warn_if_unknown_interface): Likewise.
	* lex.c (extract_interface_info): Likewise.
	* pt.c (lookup_template_class): Likewise.

	PR c++/12862
	* name-lookup.c (pushdecl): Look up all namespace-scope entities
	in their corresponding namespace.

	* g++.old-deja/g++.jason/template18.C: Remove.
	* g++.old-deja/g++.jason/template37.C: Likewise.

	PR c++/12862
	* g++.dg/lookup/ns1.C: New test.

From-SVN: r74954
2003-12-22 23:57:08 +00:00
Kazu Hirata f4f206f46f call.c: Fix comment formatting.
* call.c: Fix comment formatting.
	* class.c: Likewise.
	* cp-tree.h: Likewise.
	* cvt.c: Likewise.
	* cxx-pretty-print.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* error.c: Likewise.
	* except.c: Likewise.
	* init.c: Likewise.
	* name-lookup.c: Likewise.
	* parser.c: Likewise.
	* pt.c: Likewise.
	* rtti.c: Likewise.
	* semantics.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.

From-SVN: r74916
2003-12-21 21:07:32 +00:00
Kazu Hirata 926ce8bd97 cvt.c: Remove uses of "register" specifier in declarations of arguments and local...
* cvt.c: Remove uses of "register" specifier in
	declarations of arguments and local variables.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* expr.c: Likewise.
	* friend.c: Likewise.
	* lex.c: Likewise.
	* name-lookup.c: Likewise.
	* repo.c: Likewise.
	* search.c: Likewise.
	* tree.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.

From-SVN: r74855
2003-12-19 23:28:11 +00:00
Mark Mitchell 89f1a6eccc re PR c++/10926 (ICE in build_delete when trying to declare template destructor)
PR c++/10926
	* decl2.c (grokfield): Robustify.

	PR c++/11116
	* parser.c (cp_parser_throw_expression): Determine whether or not
	an assignment-expression is present by doing one-token lookahead.

	PR c++/10926
	* g++.dg/template/error9.C: New test.

	PR c++/11116
	* g++.dg/template/error8.C: New test.

From-SVN: r74664
2003-12-16 02:46:31 +00:00
Nathan Sidwell f5c28a158b class.c (add_method): Disallow destructor for java classes.
cp:
	* class.c (add_method): Disallow destructor for java classes.
	* decl.c (xref_basetypes): Check java class inheritance.
	* decl2.c (check_java_method): Skip artificial params.
testsuite:
	* g++.dg/other/java1.C: New test.

From-SVN: r74629
2003-12-15 14:19:10 +00:00
Kriang Lerdsuwanakij d43f603d85 re PR c++/5369 (template member friend declaration not honored)
PR c++/5369
	* friend.c (is_friend): Handle member function of a class
	template as template friend.
	(do_friend): Likewise.
	* decl2.c (check_classfn): Add template_header_p parameter.
	* decl.c (start_decl): Adjust check_classfn call.
	(grokfndecl): Likewise.
	* pt.c (is_specialization_of_friend): New function.
	(uses_template_parms_level): Likewise.
	(push_template_decl_real): Use uses_template_parms_level.
	(tsubst_friend_function): Adjust check_classfn call.
	* cp-tree.h (check_classfn): Adjust declaration.
	(uses_template_parms_level): Add declaration.
	(is_specialization_of_friend): Likewise.

	* g++.dg/template/memfriend1.C: New test.
	* g++.dg/template/memfriend2.C: Likewise.
	* g++.dg/template/memfriend3.C: Likewise.
	* g++.dg/template/memfriend4.C: Likewise.
	* g++.dg/template/memfriend5.C: Likewise.
	* g++.dg/template/memfriend6.C: Likewise.
	* g++.dg/template/memfriend7.C: Likewise.
	* g++.dg/template/memfriend8.C: Likewise.
	* g++.old-deja/g++.pt/friend44.C: Remove a bogus error.

From-SVN: r73833
2003-11-22 06:49:21 +00:00
Jan Hubicka fccc4eb240 re PR rtl-optimization/12275 ([unit-at-a-time] ICE in htab_clear_slot)
PR opt/12275
	* c-decl.c (finish_decl): Use change_decl_assembler_name.
	* c-pragma.c (handle_pragma_redefine_extname): Likewise.
	* varasm.c (make_decl_rtl): Likewise.
	* cgraph.c (change_decl_assembler_name): New function.
	* tree.h (set_decl_assembler_name): Kill dead declaration.
	(change_decl_assembler_name): Declare.

	* decl.c (make_rtl_for_nonlocal_decl): Use change_decl_assembler_name.
	* decl2.c (make_rtl_for_nonlocal_decl): Use change_decl_assembler_name.

From-SVN: r73532
2003-11-13 02:07:57 +00:00
Kazu Hirata cd0be382c9 ChangeLog: Fix typos.
* ChangeLog: Fix typos.
	* call.c: Fix comment typos.
	* class.c: Likewise.
	* cp-tree.h: Likewise.
	* cvt.c: Likewise.
	* cxx-pretty-print.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* init.c: Likewise.
	* mangle.c: Likewise.
	* name-lookup.c: Likewise.
	* parser.c: Likewise.
	* search.c: Likewise.
	* semantics.c: Likewise.
	* tree.c: Likewise.
	* typeck.c: Likewise.

From-SVN: r72737
2003-10-21 02:16:17 +00:00
Jan Hubicka 2344a722aa problem that current decl duplication mechanizm > > /* If we didn't remap this variable...
problem that current decl duplication mechanizm
>
>         /* If we didn't remap this variable, so we can't mess with its
>   	 TREE_CHAIN.  If we remapped this variable to the return slot, it's

From-SVN: r72539
2003-10-15 23:10:20 +00:00
Gabriel Dos Reis 5a167978fa name-lookup.h (cxx_scope_find_binding_for_name): Don't export.
* name-lookup.h (cxx_scope_find_binding_for_name): Don't export.
	(binding_for_name): Likewise.
	(cxx_binding_clear): Move to name-lookup.c.
	* name-lookup.c (cxx_scope_find_binding_for_name): Now static.
	(binding_for_name): Likewise.
	* decl2.c (is_ancestor): Move to name-lookup.c
	(namespace_ancestor): Likewise.
	(add_using_namespace): Likewise.
	(ambiguous_decl): Likewise.
	(lookup_using_namespace): Likewise.
	(qualified_lookup_using_namespace): Likewise.
	(set_decl_namespace): Likewise.
	(decl_namespace): Likewise.
	(current_decl_namespace): Likewise.
	(push_decl_namespace): Likewise.
	(pop_decl_namespace): Likewise.
	(push_scope): Likewise.
	(pop_scope): Likewise.
	(struct arg_lookup): Likewise.
	(arg_assoc): Likewise.
	(arg_assoc_args): Likewise.
	(arg_assoc_type): Likewise.
	(add_function): Likewise.
	(arg_assoc_namespace): Likewise.
	(arg_assoc_class): Likewise.
	(arg_assoc_template_arg): Likewise.
	(do_namespace_alias): Likewise.
	(validate_nonmember_using_decl): Likewise.
	(do_nonmember_using_decl): Likewise.
	(do_toplevel_using_decl): Likewise.
	(do_local_using_decl): Likewise.
	(do_class_using_decl): Likewise.
	(do_using_directive): Likewise.
	(constructor_name_full): Likewise.
	(constructor_name): Likewise.
	(constructor_name_p): Likewise.

From-SVN: r72462
2003-10-14 08:19:06 +00:00
Andreas Jaeger edaf3e0357 c-decl.c (finish_function): Convert definition to ISO C90.
* c-decl.c (finish_function): Convert definition to ISO C90.
	* ifcvt.c (mark_loop_exit_edges): Likewise.
	* ra-rewrite.c (emit_colors): Likewise.

For cp:

	* decl.c (cxx_builtin_type_decls): Convert to ISO C90 function
	definition.
	* init.c (push_base_cleanups): Likewise.
	* decl2.c (finish_file): Likewise.
	* mangle.c (init_mangle): Likewise.
	(dump_substitution_candidates): Likewise.
	* search.c: Likewise.

From-SVN: r71872
2003-09-28 06:37:41 +02:00
Gabriel Dos Reis 147135cc00 cp-tree.h, [...]: Remove reference to macros BINDING_SCOPE, BINDING_VALUE and BINDING_TYPE.
* cp-tree.h, name-lookup.h, decl.c, decl2.c: Remove reference to
	macros 	BINDING_SCOPE, BINDING_VALUE and BINDING_TYPE.

From-SVN: r71848
2003-09-27 01:55:13 +00:00
Richard Henderson f31686a322 Revert DECL_SOURCE_LOCATION -> TREE_LOCUS change.
From-SVN: r71641
2003-09-21 22:09:32 -07:00
Richard Henderson 7e2af53a14 tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const.
* tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const.
	(TREE_FILENAME, TREE_LINENO): Likewise.
	(set_tree_locus, copy_tree_locus, set_tree_file_line): New.
	(TREE_LOCUS_SET_P): New.
	* c-aux-info.c, c-decl.c, c-parse.in, coverage.c, dbxout.c,
	diagnostic.c, dwarf2out.c, dwarfout.c, function.c, integrate.c,
	print-tree.c, stmt.c, toplev.c, tree-dump.c, tree-inline.c,
	tree-optimize.c, tree.c, tree.def, xcoffout.c, config/alpha/alpha.c,
	config/mips/mips.c, doc/c-tree.texi, objc/objc-act.c: Update to match.

ada/
	* trans.c, utils.c: Update for DECL_SOURCE_LOCATION rename and
	change to const.

cp/
	* class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c,
	method.c, optimize.c, pt.c, semantics.c, tree.c: Update for
	DECL_SOURCE_LOCATION rename and change to const.

f/
	* com.c, ste.c: Update for DECL_SOURCE_LOCATION rename and
	change to const.

java/
	* class.c, decl.c, jcf-parse.c, jcf-write.c, parse.y,
	resource.c: Update for DECL_SOURCE_LOCATION rename and change to const.

treelang/
	* treetree.c: Update for DECL_SOURCE_LOCATION rename and
	change to const.

From-SVN: r71636
2003-09-21 16:39:40 -07:00
Richard Henderson ddd2d57e72 c-format.c (gcc_diag_char_table): Add %J.
* c-format.c (gcc_diag_char_table): Add %J.
        (gcc_cdiag_char_table, gcc_cxxdiag_char_table): Likewise.
        (check_format_types): Fix wanted_type name lookup.
        (init_dynamic_diag_info): Setup %J.
        * diagnostic.c (text_specifies_location): Implement %J.
        * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, calls.c,
        dwarfout.c, expr.c, function.c, stmt.c, stor-layout.c, toplev.c,
        tree-inline.c, tree-optimize.c, varasm.c, config/arm/pe.c,
        config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c,
        config/v850/v850.c, objc/objc-act.c: Use %J in diagnostics.

        * tree-inline.c: Include intl.h
        (inline_forbidden_p_1): Fix i18n of inline_forbidden_reason.
        * Makefile.in (tree-inline.o): Update.
cp/
        * decl.c, decl2.c, pt.c: Use %J in diagnostics.
java/
        * check-init.c, class.c, decl.c, expr.c: Use %J in diagnostics.
testsuite/
        * gcc.dg/format/gcc_diag-1.c: Add tests for %J.

From-SVN: r71619
2003-09-20 22:07:20 -07:00
Richard Henderson f6d1b84aa4 cgraphunit.c (cgraph_assemble_pending_functions): Export.
* cgraphunit.c (cgraph_assemble_pending_functions): Export.
        (cgraph_finalize_function): Revert TREE_ASM_WRITTEN check.
        * cgraph.h: Update.

        * decl2.c (finish_file): Check cgraph_assemble_pending_functions
        during relaxation loop.

From-SVN: r71360
2003-09-13 07:18:47 -07:00
David Edelsohn b44a178ae8 * decl2.c (var_finalized_p): Swap arms of conditional.
From-SVN: r71319
2003-09-11 16:47:13 -04:00
Richard Henderson 08deda2f65 * decl2.c (cxx_callgraph_analyze_expr): Mark argument unused.
From-SVN: r71296
2003-09-10 22:55:16 -07:00
Jan Hubicka c4d2313d39 decl2.c (var_finalized_p): New.
* decl2.c (var_finalized_p): New.
	(maybe_emit_vtables, write_out_vars, finish_file): Use it.

From-SVN: r71284
2003-09-10 23:46:26 +00:00
Richard Henderson 25c84396dd cgraph.h (struct cgraph_node): Rename lowered to analyzed.
* cgraph.h (struct cgraph_node): Rename lowered to analyzed.
        * cgraphunit.c: Update to match.
        (record_call_1): Rearrange.  Call lang hook for language nodes.
        (cgraph_analyze_function): Don't call lower_function.
        * langhooks.h (struct lang_hooks_for_callgraph): Replace
        lower_function with analyze_expr.
        * langhooks-def.h: Update to match.
        * langhooks.c (lhd_callgraph_analyze_expr): New.

        * decl2.c (cxx_callgraph_analyze_expr): New, from corpse of
        mark_member_pointers.
        (lower_function): Remove.
        * cp-tree.h: Update to match.
        * cp-lang.c (LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): New.
        (LANG_HOOKS_CALLGRAPH_LOWER_FUNCTION): Remove.

From-SVN: r71277
2003-09-10 12:16:20 -07:00
Richard Henderson e4d9102785 decl2.c (finish_file): Avoid out-of-bounds array reference during memmove.
* decl2.c (finish_file): Avoid out-of-bounds array reference
        during memmove.

From-SVN: r71261
2003-09-09 19:41:43 -07:00
Richard Henderson dd07abd725 except.c: Include cgraph.h.
* except.c: Include cgraph.h.
        (output_function_exception_table): Invoke
        cgraph_varpool_mark_needed_node.
        * Makefile.in (except.o): Update.

        * decl2.c (mark_member_pointers): Rename from
        mark_member_pointers_and_eh_handlers and don't check eh handlers.

From-SVN: r71254
2003-09-09 17:09:09 -07:00
Mark Mitchell fa531100f1 re PR c++/11786 (operator() call on variable in other namespace not recognized)
PR c++/11786
	* decl2.c (add_function): Do not complain about seeing the same
	non-function twice.
	* semantics.c (perform_koenig_lookup): Improve documentation.

	PR c++/11786
	* g++.dg/lookup/koenig2.C: New test.

From-SVN: r71213
2003-09-08 18:46:20 +00:00
Richard Henderson c1f927e84e c-decl.c (c_expand_body_1): Push and pop function context here.
gcc/
        * c-decl.c (c_expand_body_1): Push and pop function context here.
        * tree-optimize.c (tree_rest_of_compilation): ... not here.  Take
        nested argument instead of computing nesting ourselves.

gcc/cp/
        * decl.c (finish_function): Clear current_function_decl.
        * decl2.c (mark_used): Don't push/pop gc context.
        * optimize.c (optimize_function): Likewise.
        * tree.c (cp_cannot_inline_tree_fn): Likewise.
        * pt.c (instantiate_decl): Inc/dec function_depth instead.
        * semantics.c (expand_body): Update for tree_rest_of_compilation
        nested argument.

From-SVN: r71208
2003-09-08 08:56:27 -07:00
Jan Hubicka c57e159892 decl2.c (maybe_emit_vtables, [...]): Avoid re-emitting variables in unit-at-a-time mode.
* decl2.c (maybe_emit_vtables, write_out_vars, finish_file):
	Avoid re-emitting variables in unit-at-a-time mode.

From-SVN: r71167
2003-09-07 11:15:46 +00:00
Nathan Sidwell 8e1daa3412 re PR c++/12037 (Spurious "statement has no effect" in templates)
cp:
	PR c++/12037
	* cp-tree.h (COMPOUND_EXPR_OVERLOADED): New.
	(build_min_non_dep): Declare.
	* tree.c (build_min): Propagate TREE_SIDE_EFFECTS.
	(build_min_non_dep): New.
	* cvt.c (convert_to_void): Don't explicitly copy
	TREE_SIDE_EFFECTS, TREE_NO_UNUSED_WARNING.
	* call.c (build_new_method_call): Use build_min_non_dep.
	* decl2.c (grok_array_decl): Likewise.
	(build_offset_ref_call_from_tree): Likewise.
	* typeck.c (finish_class_member_access_expr,
	build_x_indirect_ref, build_x_binary_op, build_x_unary_op,
	build_x_conditional_expr, build_x_compound_expr): Likewise.
	(build_static_cast, build_reinterpret_cast,
	build_const_cast): Propagate TREE_SIDE_EFFECTS inside a template.
	* typeck2.c (build_x_arrow): Use build_min_non_dep.
	(build_functional_cast): Propagate TREE_SIDE_EFFECTS inside a
	template.
	* rtti.c (build_dynamic_cast_1): Set DECL_IS_PURE.
	(build_dynamic_cast): Set TREE_SIDE_EFFECTS.
	* pt.c (build_non_dependent_expr): Check COMPOUND_EXPR_OVERLOADED.
testsuite:
	PR c++/12037
	* g++.dg/warn/noeffect4.C: New test.

From-SVN: r71108
2003-09-05 08:24:28 +00:00
Richard Henderson 8dafba3ca4 cgraph.c (cgraph_mark_reachable_node): Split out from ...
* cgraph.c (cgraph_mark_reachable_node): Split out from ...
        (cgraph_mark_needed_node): Remove needed argument.
        * cgraph.h: Update to match.
        * cgraphunit.c (decide_is_function_needed): Split out from ...
        (cgraph_finalize_function): Reorg.  Avoid deferred_inline_function
        if we generated the function.
        (record_call_1): Update for cgraph_mark_reachable_node.
        * varasm.c (mark_referenced): Likewise.
        * objc/objc-act.c (mark_referenced_methods): Likewise.

        * decl2.c (mark_member_pointers_and_eh_handlers): Update for
        change in cgraph_mark_needed_node arguments.

From-SVN: r71104
2003-09-04 21:24:30 -07:00
Geoffrey Keating 1a9861e629 re PR c++/12161 (ICE during bootstrap, locale-inst.c, cp/call.c: 4571)
PR 12161
	* decl2.c (mark_used): Use ggc_push_context/ggc_pop_context.
	* tree.c (cp_cannot_inline_tree_fn): Likewise.

From-SVN: r71084
2003-09-04 19:48:22 +00:00