Commit Graph

1054 Commits

Author SHA1 Message Date
Jason Merrill d35311a213 re PR middle-end/41611 (guard variable is emitted even when the guarded symbol isn't)
PR c++/41611
	* decl2.c (get_guard): Don't use the same comdat group as the decl.

From-SVN: r154965
2009-12-03 19:26:35 -05:00
Jason Merrill 0735734176 re PR middle-end/41611 (guard variable is emitted even when the guarded symbol isn't)
PR c++/41611
	* decl2.c (get_guard): Copy DECL_COMDAT.
	(comdat_linkage): Set DECL_COMDAT unconditionally.

From-SVN: r154885
2009-12-01 16:58:04 -05:00
Jakub Jelinek b25833451b re PR c++/3187 (gcc lays down two copies of constructors)
PR c++/3187
	* cgraph.h (struct cgraph_node): Add same_body and same_body_alias
	fields.
	(cgraph_same_body_alias, cgraph_remove_same_body_alias): New
	prototypes.
	* cgraphunit.c (cgraph_expand_function, cgraph_emit_thunks,
	cgraph_materialize_all_clones): Handle same_body aliases.
	* cgraph.c (cgraph_allocate_node): New function.
	(cgraph_create_node): Use it.
	(cgraph_node_for_decl, cgraph_node, cgraph_get_node,
	cgraph_node_for_asm, cgraph_remove_node): Handle same_body aliases.
	(cgraph_same_body_alias, cgraph_remove_same_body_alias): New
	functions.
	* lto-cgraph.c (lto_output_node): Stream out same_body aliases.
	(input_node): Stream in same_body aliases.
	* lto-symtab.c (lto_cgraph_replace_node): Clear node pointers
	for same_body aliases.
	(lto_symtab_merge_cgraph_nodes_1): Handle same_body aliases.

	* cp-tree.h (expand_or_defer_fn_1): New prototype.
	* decl2.c (cp_write_global_declarations): Mark as !DECL_EXTERNAL
	also all same_body aliases.
	* semantics.c (expand_or_defer_fn): Move most of the function
	except registering with cgraph to ...
	(expand_or_defer_fn_1): ... here.  New function.
	* optimize.c: Include cgraph.h.
	(maybe_clone_body): If in charge parm is not used and both base
	and complete clones are created and are not comdat, tell cgraph
	they have the same body.
	* Make-lang.in (cp/optimize.o): Depend on $(CGRAPH_H).

	* g++.dg/abi/mangle26.C: Also match *C2* definition.
	* g++.dg/abi/mangle27.C: Likewise.
	* g++.dg/abi/mangle28.C: Likewise.
	* g++.dg/abi/mangle29.C: Likewise.

From-SVN: r154284
2009-11-18 10:53:52 +01:00
Jason Merrill f208b76886 re PR c++/39560 (Erroneous warnings 'unused variable' in a templated class method with union)
PR c++/39560
	* decl2.c (build_anon_union_vars): Set DECL_ARTIFICIAL.

From-SVN: r154133
2009-11-12 18:21:33 -05:00
Jan Hubicka fcc993f6f5 decl2.c (constrain_visibility): Clear WEAK and COMMON flags.
* decl2.c (constrain_visibility): Clear WEAK and COMMON flags.

	* ipa.c (function_and_variable_visibility): Verify that WEAK || COMMON
	imply PUBLIC || EXTERNAL.

From-SVN: r154115
2009-11-12 06:50:19 +00:00
Jason Merrill 67dc1f24dc re PR c++/18451 (C++ error message regression)
PR c++/18451
	PR c++/40738
	* cp-tree.h (cp_decl_specifier_seq): Add any_type_specifiers_p.
	* parser.c (cp_parser_single_declaration): Call
	cp_parser_parse_and_diagnose_invalid_type_name here, too.
	(cp_parser_parameter_declaration): And here.
	(cp_parser_parse_and_diagnose_invalid_type_name): Be
	less picky about declarator form.  Don't skip to
	the end of the block if	we're in a declarator.
	(cp_parser_decl_specifier_seq): Set any_type_specifiers_p.
	(cp_parser_simple_declaration): Check it.
	(cp_parser_member_declaration): Likewise.
	(cp_parser_diagnose_invalid_type_name): Tweak error message.
	(cp_parser_expression_statement): Likewise.
	* decl2.c (grokfield): Mention decltype instead of typeof.

From-SVN: r154006
2009-11-07 22:47:36 -05:00
Jason Merrill 3c3905fc17 re PR c++/9381 (attribute on member function pointer have no effect)
PR c++/9381
	* decl2.c (build_memfn_type): Preserve attributes.
	(cp_reconstruct_complex_type): Likewise.
	(maybe_retrofit_in_chrg): Likewise.
	* call.c (standard_conversion): Use build_memfn_type.
	* pt.c (tsubst): Likewise.
	* decl.c (build_ptrmem_type): Likewise
	(check_function_type): Preserve attributes.
	* tree.c (cp_build_type_attribute_variant): Propagate exception
	specs on METHOD_TYPE, too.
	(strip_typedefs): Preserve exception specs and attributes.

From-SVN: r153977
2009-11-06 16:18:35 -05:00
Jason Merrill 9a6f7249ea re PR c++/36959 (C++ front-end causing a static inline function to be emitted)
PR c++/36959
	* decl2.c (cxx_callgraph_analyze_expr): Don't reference a function
	just because a static variable in it is needed unless -frepo.

From-SVN: r153878
2009-11-03 18:02:41 -05:00
Jason Merrill 1eee69dd71 Restrict DR 757 change to C++0x mode.
* decl2.c (mark_used): Check cxx_dialect.
	* decl.c (grokfndecl): Do check type linkage in C++98 mode.
	(grokvardecl): Likewise.
	* pt.c (check_instantiated_arg): Likewise.

From-SVN: r153816
2009-11-02 11:14:26 -05:00
Jason Merrill 20f2653ef0 PR c++/38796, Core issue 906
PR c++/38796, Core issue 906
gcc/cp
	* cp-tree.h (DECL_DEFAULTED_OUTSIDE_CLASS_P): New.
	(DECL_DEFAULTED_IN_CLASS_P): New.
	* class.c (user_provided_p): Non-static.
	(check_methods): Use it.
	(check_bases_and_members): Check defaulted fns.
	(defaultable_fn_p): Move and rename to...
	* method.c (defaultable_fn_check): ...this.
	(defaulted_late_check): New.
	* pt.c (tsubst_decl): Call it.
	* decl2.c (grokfield): Adjust.
	* decl.c (cp_finish_decl): Adjust.
	(grok_special_member_properties): Use user_provided_p.
libstdc++-v3
	* include/std/future (~Future_result_base): Default outside class
	body.
	* include/std/system_error (error_category()): Likewise.
	* libsupc++/nested_exception.h (nested_exception): Remove
	exception specifications from defaulted methods.

From-SVN: r153565
2009-10-26 15:07:14 -04:00
Jason Merrill ecc607fc08 decl2.c (determine_visibility): Make anonymous types internal.
* decl2.c (determine_visibility): Make anonymous types internal.
	(mark_used): Complain about types without linkage used in
	decls with internal linkage.
	(vague_linkage_fn_p): Split out from...
	* decl.c (maybe_commonize_var): ...here.
	(grokdeclarator): Adjust linkage when a typedef gives linkage name.
	* tree.c (no_linkage_check): Check the enclosing class and template
	arguments.

	* cp-tree.h (TYPE_NAMESPACE_SCOPE_P): New.

From-SVN: r151868
2009-09-18 17:25:18 -04:00
Paolo Carlini 3937f036d7 re PR c++/28293 (ICE on invalid typedef)
/cp
2009-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/28293
	* decl2.c (grokfield): Check for explicit template argument lists.

/testsuite
2009-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/28293
	* g++.dg/template/crash91.C: New.

From-SVN: r151581
2009-09-09 23:33:38 +00:00
Jason Merrill ee18fe39d3 cp-tree.h (enum overload_flags): Remove OP_FLAG.
* cp-tree.h (enum overload_flags): Remove OP_FLAG.
	* method.c (lazily_declare_fn): Check for dtorness in ABI warning.

From-SVN: r151528
2009-09-08 14:12:54 -04:00
Diego Novillo 4537ec0c86 [multiple changes]
2009-09-01  Diego Novillo  <dnovillo@google.com>

	* c-lang.c (lang_hooks): Remove const qualifier.

java/ChangeLog

	* lang.c (lang_hooks): Remove const qualifier.

objc/ChangeLog

	* objc-lang.c (lang_hooks): Remove const qualifier.

objcp/ChangeLog

	* objcp-lang.c (lang_hooks): Remove const qualifier.

ada/ChangeLog

	* gcc-interface/misc.c (lang_hooks): Remove const qualifier.

fortran/ChangeLog

	* f95-lang.c (lang_hooks): Remove const qualifier.

cp/ChangeLog

	* cp-lang.c (lang_hooks): Remove const qualifier.

2009-09-01  Diego Novillo  <dnovillo@google.com>

	* cgraph.c (cgraph_node_for_decl): New.
	* cgraph.h (cgraph_node_for_decl): Declare.
	* tree.c (host_integerp): Return 0 if T is NULL.


2009-09-01  Diego Novillo  <dnovillo@google.com>

	* tree.h (struct alias_pair): Move from varasm.c.
	(alias_pairs): Likewise.
	(TYPE_MAXVAL): Define.
	(TYPE_MINVAL): Define.
	(iterative_hash_host_wide_int): Declare.
	(remove_unreachable_alias_pairs): Declare.
	* tree-pass.h (pass_ipa_free_lang_data): Declare.
	* diagnostic.c (default_diagnostic_starter): Make extern.
	(default_diagnostic_finalizer): Make extern.
	* diagnostic.h (default_diagnostic_starter): Declare.
	(default_diagnostic_finalizer): Declare.
	(default_tree_printer): Declare.
	* toplev.c (default_tree_printer): Make extern.


2009-09-01  Richard Guenther  <rguenther@suse.de>
	    Diego Novillo  <dnovillo@google.com>

	* cgraph.c (cgraph_add_new_function): Remove gimplification.
	* cgraphunit.c (cgraph_expand_function): Do not emit
	associated thunks from here.
	(cgraph_emit_thunks): New.
	(cgraph_optimize): Call it.
	Return if any IPA pass finds an error.
	* varasm.c (finish_aliases_1): Ignore errorneous aliases used
	by thunks.


2009-09-01  Simon Baldwin  <simonb@google.com>
	    Rafael Espindola  <espindola@google.com>
	    Richard Guenther  <rguenther@suse.de>
	    Doug Kwan  <dougkwan@google.com>
	    Diego Novillo  <dnovillo@google.com>

	* tree.c: Include tree-pass.h, langhooks-def.h,
	diagnostic.h, cgraph.h, timevar.h, except.h and debug.h.
	(free_lang_data_in_type): New.
	(need_assembler_name_p): New.
	(free_lang_data_in_block): New.
	(free_lang_data_in_decl): New.
	(struct free_lang_data_d): New.
	(add_tree_to_fld_list): New.
	(find_decls_types_r): New.
	(get_eh_types_for_runtime): New.
	(find_decls_types_in_eh_region): New.
	(find_decls_types_in_node): New.
	(find_decls_types_in_var): New.
	(free_lang_data_in_cgraph): New.
	(free_lang_data): New.
	(gate_free_lang_data): New.
	(pass_ipa_free_lang_data): New.

2009-09-01  Diego Novillo  <dnovillo@google.com>

	* timevar.def (TV_IPA_FREE_LANG_DATA): Define.
	* langhooks.h (struct lang_hooks): Add field free_lang_data.
	(lang_hooks): Remove const qualifier.
	* ipa.c (cgraph_remove_unreachable_nodes): Call
	remove_unreachable_alias_pairs.
	* except.c (add_type_for_runtime): Check if TYPE has
	already been converted.
	(lookup_type_for_runtime): Likewise.
	(check_handled): Handle converted types.
	* varasm.c (remove_unreachable_alias_pairs): New.
	* gimple.c: Include demangle.h.
	(gimple_decl_printable_name): New.
	(gimple_fold_obj_type_ref): New.
	* gimple.h (gimple_decl_printable_name): Declare.
	(gimple_fold_obj_type_ref): Declare.
	* passes.c (init_optimization_passes): Add pass
	pass_ipa_free_lang_data.
	* langhooks-def.h (LANG_HOOKS_FREE_LANG_DATA): Define.
	(LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_FREE_LANG_DATA.

testsuite/ChangeLog

2009-09-01  Diego Novillo  <dnovillo@google.com>

	* gcc.dg/gomp/combined-1.c: Adjust expected pattern.
	* g++.dg/tree-prof/inline_mismatch_args.C: Likewise.
	* g++.dg/warn/unit-1.C: Likewise.
	* g++.dg/ipa/iinline-1.C: Likewise.
	* g++.dg/template/cond2.C: Adjust expected line location for the
	error.
	* g++.dg/template/pr35240.C: Likewise.


cp/ChangeLog

2009-09-01  Doug Kwan  <dougkwan@google.com>

	* tree.c (cp_fix_function_decl_p): New.
	(cp_free_lang_data): New.

2009-09-01  Diego Novillo  <dnovillo@google.com>

	* Make-lang.in (decl2.o): Add dependency on $(POINTER_SET_H).
	* decl2.c: Include pointer-set.h.
	(collect_candidates_for_java_method_aliases): New.
	(cp_write_global_declarations): Call it.
	Add local variable CANDIDATES.  If set, call
	build_java_method_aliases.
	(build_java_method_aliases): Add argument CANDIDATES.
	Use it to determine if FNDECL should get a hidden alias.
	* cp-objcp-common.h (LANG_HOOKS_FREE_LANG_DATA): Define.
	* cp-tree.h (cp_free_lang_data): Declare.

2009-09-03  Richard Guenther  <rguenther@suse.de>

	* method.c (use_thunk): Use cgraph_finalize_function to hand
	off thunks to the cgraph.
	* semantics.c (emit_associated_thunks): Do not emit thunks
	for really extern functions.

From-SVN: r151360
2009-09-03 00:07:12 -04:00
Jason Merrill 783a452cce cp-tree.h (DECL_DEFERRED_FN): Remove.
* cp-tree.h (DECL_DEFERRED_FN): Remove.
	(struct lang_decl_fn): Remove deferred flag.
	* class.c (build_clone): Don't set it.
	* decl2.c (note_vague_linkage_fn): Don't check or set it.
	(mark_used): Don't check it.
	* method.c (make_thunk, make_alias_for): Don't set it.

From-SVN: r151063
2009-08-24 17:32:24 -04:00
Jason Merrill d9fbd03b21 * decl2.c (mark_used): Streamline logic.
From-SVN: r151062
2009-08-24 17:32:12 -04:00
Jason Merrill 3146f36f93 re PR c++/41109 (Argument flagged as unused despite use in sizeof())
PR c++/41109
	PR c++/41110
	PR c++/41134
	* cp-tree.h (DECL_ODR_USED): New macro.
	(struct lang_decl_base): Add odr_used flag.
	* decl.c (duplicate_decls): Propagate it.  Use it for error.
	* pt.c (register_specialization): Use it for error.
	* decl2.c (mark_used): Use it as gating flag rather than TREE_USED.
	(cp_write_global_declarations): Use it for error.
	(tree_used_ok): Remove.
	* cp-tree.h: Remove tree_used_ok.
	* call.c (build_call_a): Don't call it.
	* init.c (build_offset_ref): Likewise.

From-SVN: r151061
2009-08-24 17:31:54 -04:00
Jason Merrill 62906aaa5c tweak comment
From-SVN: r150940
2009-08-19 14:24:13 -04:00
Jason Merrill 595de3023d re PR c++/41119 (Revision 150805 failed 447.dealII in SPEC CPU 2006)
PR c++/41119
	PR c++/41120
	* decl2.c (mark_used): Increment function_depth during synthesis.
	* parser.c (cp_parser_default_argument): Not here.

From-SVN: r150939
2009-08-19 13:14:33 -04:00
Jason Merrill 15305a736f Make TREE_USED match the [basic.def.odr] concept for FUNCTION_DECL and VAR_DECL...
Make TREE_USED match the [basic.def.odr] concept for FUNCTION_DECL
	and VAR_DECL, so mark_used only has effect the first time.
	* decl2.c (mark_used): Just return if TREE_USED is already set.
	Don't set TREE_USED if cp_unevaluated_operand is set.
	(tree_used_ok): New fn.
	* init.c (build_offset_ref): Check it instead of TREE_USED.
	* call.c (build_call_a): Likewise.
	* cp-tree.h: Declare it.
	(DECL_NO_LINKAGE_CHECKED): No longer needed.
	(struct lang_decl_base): Remove no_linkage_checked bitfield.

From-SVN: r150807
2009-08-16 13:42:56 -04:00
Jason Merrill d3ece023f3 * decl2.c (finish_static_data_member_decl): Don't set TREE_USED.
From-SVN: r150806
2009-08-16 13:42:48 -04:00
Jason Merrill b49bd3798d * decl2.c (mark_used): It's ok to synthesize for default args now.
From-SVN: r150805
2009-08-16 13:42:41 -04:00
Jason Merrill e8f43da6f9 Implement DR 757...
Implement DR 757: It's OK for a decl to use a type without linkage
	so long as the decl is defined in the current translation unit.
	* decl2.c (no_linkage_decls): New vector.
	(mark_used): Add decls that use types with no linkage.
	(cp_write_global_declarations): Check that they are defined.
	(decl_defined_p, no_linkage_error): New fns.
	* cp-tree.h (DECL_NO_LINKAGE_CHECKED): New macro.
	(struct lang_decl_base): Add flag.
	* decl.c (grokfndecl): Don't check type linkage.
	(grokvardecl): If the type has no linkage, just make sure
	DECL_LANG_SPECIFIC is set.
	* pt.c (check_instantiated_arg): Don't check type linkage.
	* name-lookup.c (is_local_extern): New fn.
	* name-lookup.h: Declare it.

From-SVN: r150634
2009-08-10 16:47:55 -04:00
Richard Guenther a406865a08 re PR c/40401 (ICE: verify_gimple failed)
2009-07-17  Richard Guenther  <rguenther@suse.de>

	PR c/40401
	* tree-pass.h (pass_diagnose_omp_blocks): Declare.
	(pass_warn_unused_result): Likewise.
	(TODO_set_props): Remove.
	* omp-low.c (diagnose_omp_structured_block_errors): Change to
	run as a pass.
	(pass_diagnose_omp_blocks): Define.
	* c-decl.c (pop_file_scope): Do not finalize the CU here.
	(c_gimple_diagnostics_recursively): Remove.
	(finish_function): Do not call it.
	(c_write_global_declarations): Continue after errors.
	Finalize the CU here.
	* c-gimplify.c (c_genericize): Do not gimplify here.
	* c-common.c (c_warn_unused_result): Move ...
	* tree-cfg.c (do_warn_unused_result): ... here.
	(run_warn_unused_result): New function.
	(gate_warn_unused_result): New function.
	(pass_warn_unused_result): New pass.
	* c-common.h (c_warn_unused_result): Remove.
	* flags.h (flag_warn_unused_result): Declare.
	* c-opts.c (c_common_init_options): Enable flag_warn_unused_result.
	* opts.c (flag_warn_unused_result): Initialize to false.

	* toplev.c (compile_file): Add comment.
	* omp-low.c (create_omp_child_function): Do not register
	the function with the frontend.
	(diagnose_omp_structured_block_errors): Prepare to be
	called as optimization pass.
	(gate_diagnose_omp_blocks): New function.
	(pass_diagnose_omp_blocks): New pass.
	* cgraph.h (cgraph_optimize): Remove.
	(cgraph_analyze_function): Likewise.
	* cgraph.c (cgraph_add_new_function): Gimplify C++ thunks.
	* cgraphunit.c (cgraph_lower_function): Lower nested functions
	before their parents here.
	(cgraph_finalize_function): Not here.
	(cgraph_analyze_function): Gimplify functions here.
	(cgraph_finalize_compilation_unit): Continue after errors.
	Optimize the callgraph from here.
	(cgraph_optimize): Make static.
	* langhooks.c (write_global_declarations): Finalize the CU.
	* gimplify.c (gimplify_asm_expr): Do not emit ASMs with errors.
	(gimplify_function_tree): Assert we gimplify only once.
	Set PROP_gimple_any property.
	* tree-nested.c (gimplify_all_functions): New function.
	(lower_nested_functions): Gimplify all nested functions.
	* gimple.h (diagnose_omp_structured_block_errors): Remove.
	* passes.c (init_optimization_passes): Add pass_warn_unused_result
	and pass_diagnose_omp_blocks after gimplification.  Do not
	set TODO_set_props on all_lowering_passes.
	(execute_one_pass): Do not handle TODO_set_props.
	* Makefile.in (cgraphunit.o): Add $(TREE_DUMP_H) dependency.
	(gimplify.o): Add tree-pass.h dependency.
	* tree-inline.c (copy_statement_list): Properly copy STATEMENT_LIST.
	(copy_tree_body_r): Properly handle TARGET_EXPR like SAVE_EXPR.
	(unsave_r): Likewise.
	* c-omp.c (c_finish_omp_atomic): Set DECL_CONTEXT on the
	temporary variable.

	cp/
	* decl.c (finish_function): Do not emit unused result warnings
	from here.
	* cp-objcp-common.h (LANG_HOOKS_POST_GIMPLIFY_PASS): Use
	c_warn_unused_result_pass.
	* semantics.c (expand_or_defer_fn): Adjust assertion about IL status.
	* optimize.c (clone_body): Clone in GENERIC.
	(maybe_clone_body): Do not clear DECL_SAVED_TREE.
	* decl2.c (cp_write_global_declarations): Fix body test.
	Do not call cgraph_optimize.
	* Make-lang.in (optimize.o): Add tree-iterator.h dependency.
	* method.c (use_thunk): Register thunk with
	cgraph_finalize_function.
	* error.c (function_category): Guard access of DECL_LANG_SPECIFIC.

	java/
	* java-gimplify.c (java_genericize): Do not gimplify here.
	But replace all local references.
	(java_gimplify_expr): Do not replace local references here.
	(java_gimplify_modify_expr): Likewise.
	* jcf-parse.c (java_parse_file): Do not finalize the CU or
	optimize the cgraph here.
	* decl.c (java_replace_reference): Make static.
	(java_replace_references): New function.
	(end_java_method): Clear base_decl_map.
	* java-tree.h (java_replace_references): Declare.
	(java_replace_reference): Remove.

	ada/
	* utils.c (end_subprog_body): Revert to pre-tuples state.  Remove
	unused parameter.
	(gnat_gimplify_function): Do not gimplify here.
	Fold into its only caller and remove.
	(gnat_builtin_function): Adjust for end_subprog_body signature change.
	(gnat_write_global_declarations): Also finalize the CU.
	* misc.c (gnat_parse_file): Do not finalize the CU here.
	* trans.c (gigi): Revert to pre-tuples state.
	(Subprogram_Body_to_gnu): Adjust for end_subprog_body signature
	change.
	* gigi.h (end_subprog_body): Remove unused parameter.

	fortran/
	* f95-lang.c (gfc_be_parse_file): Do not finalize the CU here.
	* trans-decl.c (gfc_gimplify_function): Remove.
	(build_entry_thunks): Do not gimplify here.
	(create_main_function): Likewise.
	(gfc_generate_function_code): Likewise.

	* g++.dg/rtti/crash4.C: New testcase.
	* g++.dg/torture/20090706-1.C: Likewise.
	* gcc.dg/redecl-17.c: Likewise.

	* gfortran.dg/missing_optional_dummy_5.f90: Adjust pattern.
	* gcc.dg/declspec-9.c: Expect extra error.
	* gcc.dg/declspec-10.c: Likewise.
	* gcc.dg/declspec-11.c: Likewise.
	* gcc.dg/redecl-10.c: Expect extra warnings.
	* gcc.target/i386/pr39082-1.c: Adjust diagnostic location.
	* gcc.target/i386/pr39545-1.c: Likewise.
	* g++.dg/ext/asm3.C: Expect more errors.
	* g++.dg/gomp/block-1.C: Likewise.
	* g++.dg/gomp/block-2.C: Likewise.
	* g++.dg/gomp/block-3.C: Likewise.
	* g++.dg/gomp/block-5.C: Likewise.
	* g++.old-deja/g++.jason/report.C: Expect extra warnings.
	* g++.dg/warn/unused-result1.C: XFAIL.

From-SVN: r149750
2009-07-17 15:49:34 +00:00
Dodji Seketeli 4fdaccea13 re PR debug/40705 (ICE in gen_type_die_with_usage, at dwarf2out.c:15117)
2009-07-14  Dodji Seketeli  <dodji@redhat.com>

gcc/ChangeLog:
	PR debug/40705
	PR c++/403057
	* dwarf2.out.c (gen_type_die_with_usage): Added comment.

gcc/cp/ChangeLog:
	PR debug/40705
	PR c++/403057
	* decl2.c (grokfield): Don't call set_underlying_type on typedef
	decls that are type names.

gcc/testsuite/ChangeLog:
	PR debug/40705
	PR c++/403057
	* g++.dg/debug/dwarf2/typedef1.C: New test.
	* g++.dg/other/typedef3.C: Likewise.

From-SVN: r149628
2009-07-14 17:01:55 +02:00
Jason Merrill ad909c97e2 re PR c++/40619 ([c++0x] ICE on repeated decltype expression in auto functions)
PR c++/40619
	* cp-tree.h (struct lang_decl_parm): New.
	(struct lang_decl): Add it.
	(LANG_DECL_PARM_CHECK): New.
	(DECL_PARM_INDEX): New.
	* decl2.c (parm_index): Remove.
	* lex.c (retrofit_lang_decl): Handle parms.
	(cxx_dup_lang_specific_decl): Likewise.
	* mangle.c (write_expression): Adjust.
	* tree.c (cp_tree_equal): Adjust.
	(decl_linkage): Only check DECL_COMDAT for functions and variables.
	* parser.c (cp_parser_parameter_declaration_list): Set
	DECL_PARM_INDEX.
	* pt.c (iterative_hash_template_arg): Hash it.

From-SVN: r149223
2009-07-04 00:34:03 -04:00
Jason Merrill b97e8a149d cp-tree.h (struct lang_decl): Overhaul.
* cp-tree.h (struct lang_decl): Overhaul.
	(struct lang_decl_flags): Remove.
	(struct lang_decl_base): New.
	(struct lang_decl_min): New.
	(struct lang_decl_fn): New.
	(struct lang_decl_ns): New.
	(CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN.
	(LANG_DECL_MIN_CHECK): New.
	(LANG_DECL_FN_CHECK): New.
	(LANG_DECL_NS_CHECK): New.
	(STRIP_TEMPLATE): New.
	(NON_THUNK_FUNCTION_CHECK): Remove.
	(DECL_DECLARES_FUNCTION_P): New.
	(lots): Adjust.
	* lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust.
	* decl.c (push_local_name, duplicate_decls): Adjust.
	* decl2.c (start_objects): Don't set u2sel.
	* semantics.c (finish_omp_threadprivate): Adjust.
	* class.c (build_clone): Don't do much on TEMPLATE_DECLs.
	(decl_cloned_function_p): Out-of-line implementation of macros.
	(clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P.
	* mangle.c (write_unqualified_name): Don't check function flags
	on non-functions.
	* method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION.
	* pt.c (build_template_decl): Don't set function flags.
	(check_default_tmpl_args): Check that it's a function.
	(instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the
	cloned template.

	* pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst
	DECL_CLONED_FUNCTION.

	* cp-tree.h (struct lang_type_class): Move sorted_fields here.
	* class.c (finish_struct_1): Adjust.
	* ptree.c (cxx_print_decl, cxx_print_type): Adjust.
	* search.c (lookup_field_1): Adjust.

	* cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove.
	* decl.c (finish_method): Don't add to it.
	* class.c (fixup_pending_inline): Remove.
	(fixup_inline_methods): Remove.
	(finish_struct_1): Don't call it.

	* error.c (dump_function_name): Handle null name.

From-SVN: r149217
2009-07-03 20:43:26 -04:00
Aldy Hernandez 3600f67820 class.c (get_vtable_decl): Replace finish_decl with cp_finish_decl.
* class.c (get_vtable_decl): Replace finish_decl with cp_finish_decl.
        * decl.c (finish_decl): Remove.
        (declare_global_var): Replace finish_decl with cp_finish_decl.
        (start_method): Same.
        * rtti.c (emit_tinfo_decl): Same.
        * pt.c (tsubst_expr): Same.
        (instantiate_decl): Same.
        * decl2.c (grokbitfield): Same.
        * name-lookup.c (pushdecl_top_level_1): Same.
        * cp-tree.h: Remove finish_decl.

From-SVN: r148666
2009-06-18 18:09:12 +00:00
Ian Lance Taylor 7d882b8356 c-common.c (skip_evaluation): Don't define.
./:	* c-common.c (skip_evaluation): Don't define.
	(c_inhibit_evaluation_warnings): Define global variable.
	(overflow_warning): Check c_inhibit_evaluation_warnings rather
	than skip_evaluation.
	(convert_and_check, warn_for_div_by_zero): Likewise.
	* c-common.h (skip_evaluation): Don't declare.
	(c_inhibit_evaluation_warnings): Declare.
	* c-parser.c (c_parser_typeof_specifier): Set
	c_inhibit_evaluation_warnings rather than skip_evaluation.
	(c_parser_conditional_expression): Likewise.
	(c_parser_binary_expression): Likewise.
	(c_parser_sizeof_expression): Likewise.
	(c_parser_alignof_expression): Likewise.
	* c-typeck.c (build_indirect_ref): Check
	c_inhibit_evaluation_warnings rather than skip_evaluation.
	(build_conditional_expr, build_binary_op): Likewise.
cp/:
	* parser.c (cp_unevaluated_operand): Define global variable.
	(cp_parser_question_colon_clause): Increment
	c_inhibit_evaluation_warnings when evaluating an expression which
	will never be executed.
	(cp_parser_decltype): Increment cp_unevaluated_operand and
	c_inhibit_evaluation_warnings, not skip_evaluation.
	(cp_parser_sizeof_operand): Likewise.
	(cp_parser_enclosed_template_argument_list): Save
	cp_unevaluated_operand and c_inhibit_evaluation_warnings, not
	skip_evaluation.
	* cp-tree.h (struct saved_scope): Remove skip_evaluation field.
	Add unevaluated_operand and inhibit_evaluation_warnings fields.
	(cp_unevaluated_operand): Declare.
	* name-lookup.c (push_to_top_level): Save cp_unevaluated_operand
	and c_inhibit_evaluation_warnings rather than skip_evaluation.
	(pop_from_top_level): Restore cp_unevaluated_operand and
	c_inhibit_evaluation_warnings rather than skip_evaluation.
	* class.c (build_base_path): Check cp_unevaluated_operand rather
	than skip_evaluation.
	* typeck.c (build_class_member_access_expr): Likewise.
	(cp_build_binary_op): Don't warn about bad shift counts if
	c_inhibit_evaluation_warnings is non-zero.
	* pt.c (coerce_template_parms): Save state of
	cp_unevaluated_operand and c_inhibit_evaluation_warnings, not
	skip_evaluation.
	(tsubst_aggr_type): Likewise.
	(tsubst_pack_expansion): Check cp_unevaluated_operand rather than
	skip_evaluation.
	(tsubst_copy): Likewise.
	(tsubst): Set cp_unevaluated_operand and
	c_inhibit_evaluation_warnings, not skip_evaluation.
	(tsubst_copy_and_build): Likewise.
	* call.c (convert_arg_to_ellipsis): Check cp_unevaluated_operand
	rather than skip_evaluation.
	* decl2.c (mark_used): Likewise.
	* semantics.c (finish_non_static_data_member): Likewise.
	* cvt.c (cp_convert_and_check): Check
	c_inhibit_evaluation_warnings rather than skip_evaluation.
	* mangle.c (write_type): Set cp_unevaluated_operand rather than
	skip_evaluation.
testsuite/:
	* g++.dg/warn/skip-1.C: New testcase.

From-SVN: r148535
2009-06-16 14:24:40 +00:00
Rafael Avila de Espindola fc26fae3db cgraphunit.c (cgraph_function_versioning,save_inline_function_body): Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY.
2009-06-15  Rafael Avila de Espindola  <espindola@google.com>

	* cgraphunit.c (cgraph_function_versioning,save_inline_function_body):
	Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY.
	* cgraph.c (cgraph_create_virtual_clone): Use DECL_COMDAT_GROUP.
	* config/i386/i386.c (ix86_file_end): Compute DECL_COMDAT_GROUP.
	* dwarf2asm.c(dw2_force_const_mem): Update call to make_decl_one_only.
	* langhooks-def.h (lhd_comdat_group, LANG_HOOKS_COMDAT_GROUP): Remove.
	(LANG_HOOKS_DECLS): Remove LANG_HOOKS_COMDAT_GROUP.
	* langhooks.c (lhd_comdat_group): Remove.
	* langhooks.h (lang_hooks_for_decls): Remove comdat_group.
	* tree.h (DECL_COMDAT_GROUP): New.
	(DECL_ONE_ONLY): Use DECL_COMDAT_GROUP.
	(tree_decl_with_vis): Add comdat_group. Remove one_only.
	(make_decl_one_only): Change signature.
	* varasm.c (get_emutls_init_templ_addr, emutls_decl): Update call to
	make_decl_one_only.
	(make_decl_one_only): Change signature.
	(default_elf_asm_named_section): Use DECL_COMDAT_GROUP.

2009-06-15  Rafael Avila de Espindola  <espindola@google.com>

	* cp-objcp-common.h (LANG_HOOKS_COMDAT_GROUP): Remove.
	* cp-tree.h (cxx_comdat_group): Change signature.
	* decl.c (duplicate_decls): Use DECL_COMDAT_GROUP.
	(cxx_comdat_group): Change signature.
	* decl2.c (comdat_linkage, maybe_make_one_only): Update call to
	make_decl_one_only.
	(constrain_visibility, get_guard): Use DECL_COMDAT_GROUP.
	* method.c (use_thunk): Update call to make_decl_one_only.
	* optimize.c (maybe_clone_body): Use DECL_COMDAT_GROUP

2009-06-15  Rafael Avila de Espindola  <espindola@google.com>

	* g++.dg/abi/mangle11.C: Update warning line.
	* g++.dg/abi/mangle12.C: Update warning line.
	* g++.dg/abi/mangle17.C: Update warning line.
	* g++.dg/abi/mangle20-2.C: Update warning line.

From-SVN: r148492
2009-06-15 14:25:50 +00:00
Aldy Hernandez c2255bc488 java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt.
gcc/java/
	* java-gimplify.c (java_gimplify_block): New argument to
	build_empty_stmt.
	* expr.c (force_evaluation_order): Same.
	* typeck.c: Add location to build_decl or PUSH_FIELD calls.
	* class.c: Same.
	* decl.c: Same.
	* jcf-parse.c: Same.
	* constants.c: Same.
	* resource.c: Same.
	* except.c: Same.
	* builtins.c: Same.
	* expr.c: Same.
	* java-tree.h (PUSH_FIELD): Add location field.
gcc/objc/
	* objc-act.c (finish_var_decl): Pass location to finish_decl.
	(objc_get_parm_info): Same.
	(get_super_receiver): Same.
	* objc-act.c (objc_build_component_ref): Pass location to
	build_compound_ref.
	(build_module_initializer_routine): Pass location to
	c_end_compound_stmt.
	(objc_generate_static_init_call): Pass location to build_stmt.
	(build_typed_selector_reference): New location argument.
	(build_selector_reference): Same.
	(objc_substitute_decl): Pass location to build_array_ref.
	(next_sjlj_build_try_catch_finally): Pass location to build_stmt.
	(objc_begin_catch_clause): Same.
	(objc_finish_try_stmt): Same.
	(objc_finish_catch_clause): Pass location to c_end_compound_stmt.
	(objc_build_throw_stmt): New argument.
	(generate_shared_structures): Pass location to build_c_cast.
	(objc_build_message_expr): Use local location.
	(objc_finish_message_expr): Use input_location.
	(build_objc_method_call): New argument.
	(objc_build_selector_expr): Same.
	(get_super_receiver): Pass location to build_c_cast,
	build_modify_expr, build_compound_expr.
	* objc-act.c: Add location to all calls to start_struct, build_decl,
	finish_struct.
gcc/
	* tree-pretty-print.c (dump_generic_node): Dump column numbers.
	* gimple-pretty-print.c (dump_gimple_stmt): Same.
	* gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs
	created.
	* c-parser.c (c_parser_binary_expression): Use current column while
	building binary operations.
	* common.opt (fshow-column): Enable by default.
	* tree-vrp.c (check_array_ref): Use warning_at.
	(check_array_bounds): Use location from call back if expr has no
	location.
	* tree.h: Add location argument to maybe_fold_*.
	* tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*.
	(maybe_fold_offset_to_array_ref): Add location argument and use it.
	(maybe_fold_offset_to_component_ref): Same.
	(maybe_fold_offset_to_reference): Same.
	(maybe_fold_offset_to_address): Same.
	(maybe_fold_stmt_indirect): Same.
	(maybe_fold_stmt_addition): Same.
	(fold_stmt_r): Pass location to maybe_fold_*.
	(fold_gimple_assign): Same.
	* c-tree.h: Add location argument to finish_decl,
	default_function_array_conversion, store_init_value.
	* c-decl.c (define_label): Use error_at.
	(c_make_fname_decl): Pass location to finish_decl.
	(finish_decl): New location argument.
	(build_compound_literal): Pass location to store_init_value.
	(grokdeclarator): Pass location to finish_decl.
	(grokfield): Same.
	* c-typeck.c (array_to_pointer_conversion): New location argument.
	(function_to_pointer_conversion): Same.
	(default_function_array_conversion): Same.
	(parser_build_unary_op): Pass location to overflow_warning.
	(parser_build_binary_op): Same.  Use warning_at.
	(build_unary_op): Pass location to array_to_pointer_conversion.
	(build_c_cast): Pass location to digest_init.
	(build_modify_expr): New location argument.
	(convert_for_assignment): Same.
	(store_init_value): Same.
	(digest_init): Same.
	(output_init_element): Pass location to digest_init and
	array_to_pointer_conversion.
	(c_finish_return): Pass location to convert_for_assignment.
	* gimplify.c (gimplify_conversion): Pass location to
	maybe_fold_offset_to_address.
	* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location
	to maybe_fold_stmt_addition.
	* c-omp.c (c_finish_omp_atomic): Pass new location to
	build_modify_expr.
	(c_finish_omp_for): Same.
	* c-common.c (overflow_warning): New argument.
	* c-common.h: New argument to build_modify_expr, overflow_warning.
	* c-parser.c (c_parser_declaration_or_fndef): Pass location to
	finish_decl.
	(c_parser_initializer): Pass location to
	default_function_array_conversion.
	(c_parser_initelt): Same.
	(c_parser_initval): Same.
	(c_parser_asm_operands): Same.
	(c_parser_expr_no_commas): Same.  Pass location to build_modify_expr.
	(c_parser_conditional_expression): Same.
	(c_parser_binary_expression): Add location info to stack.  Use it.
	(c_parser_unary_expression): Pass location to
	default_function_array_conversion, parser_build_unary_op,
	build_indirect_ref, c_parser_postfix_expression_after_primary.
	(c_parser_postfix_expression_after_primary): New location argument.
	Use it.
	(c_parser_expression_conv): Pass location to
	default_function_array_conversion.
	(c_parser_expr_list): Same.
	(c_parser_omp_atomic): Same.
	(c_parser_omp_for_loop): Same.
	* c-tree.h: (struct c_declarator): Add comment to id_loc.
	(build_array_declarator): New argument.
	* c-decl.c (build_array_declarator): Add location argument.
	(grokdeclarator): Set id_loc for cdk_array.
	* c-parser.c (c_parser_direct_declarator_inner): Pass location to
	build_array_declarator.
	* tree.c (build_omp_clause): Add location argument.
	* tree.h (OMP_CLAUSE_HAS_LOCATION): New macro.
	(OMP_CLAUSE_LOCATION): New macro.
	(struct tree_omp_clause): Add location field.
	(build_omp_clause): Add argument.
	* testsuite/gcc.dg/gomp/for-1.c: Fix column.
	* cp/pt.c (tsubst_omp_for_iterator): Pass location to
	build_omp_clause.
	* cp/parser.c (cp_parser_omp_var_list_no_open): Same.
	(cp_parser_omp_clause_collapse): Same.
	(cp_parser_omp_clause_default): Same.
	(cp_parser_omp_clause_if): Same.
	(cp_parser_omp_clause_nowait): Same.
	(cp_parser_omp_clause_num_threads): Same.
	(cp_parser_omp_clause_ordered): Same.
	(cp_parser_omp_clause_schedule): Same.
	(cp_parser_omp_clause_untied): Same.
	(cp_parser_omp_for_loop): Same.
	(cp_parser_omp_parallel): Pass location to c_split_parallel_clauses.
	* c-tree.h (c_start_case): Add location argument.
	(c_process_expr_stmt): Same.
	(c_finish_goto_*): Same.
	* tree-parloops.c (initialize_reductions): Pass location to
	build_omp_clause.
	(create_parallel_loop): Same.
	* fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same.
	(gfc_trans_omp_reduction_list): Same.
	(gfc_trans_omp_clauses): Same.
	(gfc_trans_omp_do): Same.
	* c-typeck.c (c_finish_goto_label): Same.
	(c_finish_goto_ptr): New location argument.
	(c_start_case): Same.
	(emit_side_effect_warnings): Same.
	(c_process_expr_stmt): Same.
	(c_finish_stmt_expr): Same.
	(c_finish_omp_clauses): Use error_at instead of error.
	* gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to
	build_omp_clause.
	* c-omp.c (c_split_parallel_clauses): New location argument.
	* tree-nested.c (convert_nonlocal_reference_stmt): Pass location
	to build_omp_clause.
	(convert_local_reference_stmt): Same.
	(convert_gimple_call): Same.
	* c-common.h (c_split_parallel_clauses): New argument.
	* c-parser.c (c_parser_statement_after_labels): Pass location to
	c_finish_goto_label.
	(c_parser_switch_statement): Pass location to c_start_case.
	(c_parser_for_statement): Pass location to c_finish_expr_stmt,
	and c_process_expr_stmt.
	(c_parser_omp_variable_list): Add location argument.
	(c_parser_omp_clause_collapse): Pass location to
	build_omp_clause.
	(c_parser_omp_clause_default): Same.
	(c_parser_omp_clause_if): Same.
	(c_parser_omp_clause_num_threads): Same.
	(-c_parser_omp_clause_ordered): Same.
	(c_parser_omp_clause_reduction): Pass location to
	c_parser_omp_variable_list.
	(c_parser_omp_clause_schedule): Pass location to build_omp_clause.
	(c_parser_omp_clause_untied): Same.
	(c_parser_omp_for_loop): Pass location to c_process_expr_stmt.
	(c_parser_omp_parallel): Pass location to
	c_split_parallel_clauses.
	* c-tree.h (check_for_loop_decls, undeclared_variable,
	build_component_ref, build_array_ref, build_external_ref,
	c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op,
	build_conditional_expr, build_compound_expr, c_cast_expr,
	build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr,
	c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New
	argument.
	* c-semantics.c (build_stmt): Same.
	(build_case_label): Same.
	* c-decl.c (c_finish_incomplete_decl): Pass location on down.
	(undeclared_variable): New argument.
	(make_label): Same.
	(lookup_label): Pass location on down.
	(define_label): Same.
	(finish_decl): Same.
	(build_compound_literal): Same.
	(finish_struct): Same.
	(finish_function): Do not set location here.
	(check_for_loop_decls): New argument.
	* tree.c (save_expr): Set location.
	(build_empty_stmt): New argument.
	* tree.h (build_empty_stmt): New argument to build_empty_stmt.
	(CAN_HAVE_LOCATION_P): Make sure we have a non empty node.
	* builtins.c (gimplify_va_arg_expr): Use locations.
	(expand_builtin_sync_operation): Same.
	* c-typeck.c (build_component_ref): New argument.
	(build_array_ref): Same.
	(build_external_ref): Same.
	(c_expr_sizeof_expr): Same.
	(c_expr_sizeof_type): Same.
	(parser_build_unary_op): Same.
	(build_conditional_expr): Same.
	(build_compound_expr): Pass location on down.
	(build_compound_expr): New argument.
	(build_c_cast): Same.
	(c_cast_expr): Same.
	(build_asm_expr): Same.
	(c_finish_return): Same.
	(c_process_expr_stmt): Pass location on down.
	(c_finish_stmt_expr): New argument.
	(push_clenaup): Same.
	(c_finish_omp_parallel): Same.
	(c_finish_omp_task): Same.
	* gimplify.c (gimplify_call_expr): Pass location on down.
	* c-omp.c (c_finish_omp_master): New argument.
	(c_finish_omp_critical): Same.
	(c_finish_omp_ordered): Same.
	(c_finish_omp_barrier): Same.
	(-c_finish_omp_taskwait): Same.
	(c_finish_omp_atomic): Same.
	(c_finish_omp_flush): Same.
	* tree-inline.c (copy_tree_body_r): Pass location on down.
	(inline_forbidden_p): Remove use of input_location.
	* c-gimplify.c (c_build_bind_expr): New argument.
	* c-common.c (c_common_truthvalue_conversion): Pass location on down.
	(c_sizeof_or_alignof_type): New argument.
	(c_alignof_expr): Same.
	(build_va_arg): Same.
	(c_add_case_label): Same.
	* c-common.h (c_sizeof_or_alignof_type, c_alignof_expr,
	c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label,
	c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt,
	c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered,
	c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush,
	c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses):
	New argument.
	* stub-objc.c (objc_build_selector_expr): Same.
	(objc_build_throw_stmt): Same.
	* c-parser.c (c_parser_declaration_or_fndef): Pass location on down.
	(c_parser_initelt): Same.
	(c_parser_compound_statement): Same.
	(c_parser_compound_statement_nostart): Same.
	(c_parser_label): Same.
	(c_parser_statement_after_labels): Same.
	(c_parser_if_body): Same.
	(c_parser_else_body): Same.
	(c_parser_if_statement): Same.
	(c_parser_switch_statement): Same.
	(c_parser_while_statement): Same.
	(c_parser_do_statement): Same.
	(c_parser_for_statement): Same.
	(c_parser_asm_statement): Same.
	(c_parser_conditional_expression): Same.
	(c_parser_binary_expression): Same.
	(c_parser_cast_expression): Same.
	(c_parser_unary_expression): Same.
	(c_parser_sizeof_expression): Same.
	(c_parser_alignof_expression): Same.
	(c_parser_postfix_expression): Same.
	(c_parser_expression): Same.
	(c_parser_objc_receiver): Same.
	(c_parser_omp_variable_list): Same.
	(c_parser_omp_structured_block): Same.
	(c_parser_omp_atomic): New argument.
	(c_parser_omp_barrier): Same.
	(c_parser_omp_critical): Same.
	(c_parser_omp_flush): Pass location on down.
	(c_parser_omp_for_loop): New argument.
	(c_parser_omp_for): Same.
	(c_parser_omp_master): Same.
	(c_parser_omp_ordered): Same.
	(c_parser_omp_sections_scope): Same.
	(c_parser_omp_sections): Same.
	(c_parser_omp_parallel): Same.
	(c_parser_omp_single): Same.
	(c_parser_omp_task): Same.
	(c_parser_omp_taskwait): Pass location on down.
	(c_parser_omp_construct): Same.
	(c_parser_omp_threadprivate): Same.
	* dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h,
	builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c,
	tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c,
	c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c,
	c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c,
	emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c,
	rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h,
	tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c,
	config/i386/i386.c, stmt.c:
	Add location argument to the following function definitions and/or
	function calls: build_decl, objcp_start_struct, objcp_finish_struct,
	start_struct, finish_struct, PUSH_FIELD, create_artificial_label,
	cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl,
	build_compound_literal, parser_xref_tag, resolve_overloaded_builtin,
	do_case, c_finish_bc_stmt, build_compound_literal,
	build_function_call.
	* c-decl.c (build_compound_literal): Add location argument.
	Make all diagnostic calls use location.
	(start_struct): Same.
	(finish_struct): Same.
	(start_enum): Same.
	(build_enumerator): Same.
	(start_function): Same.
	(grokdeclarator): Make all diagnostic calls use location.
	(store_parm_decls_oldstyle): Same.
	* c-typeck.c (build_function_call): Add location argument.
	Make all diagnostic calls use location.
	(do_case): Same.
	(c_finish_bc_stmt): Same.
	* tree-nested.c (get_trampoline_type): Add argument.
	Pass location to build_decl.
	(lookup_tramp_for_decl): Pass location to get_trampoline_type.
	* rtl.h (RTL_LOCATION): New.
	* c-common.c (c_add_case_label): Add location argument.
	Make all diagnostic calls use location.
	* c-common.h: Add location argument to make_fname_decl, do_case,
	c_add_case_label, build_function_call, resolve_overloaded_builtin.
	* c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc.
	Set it appropriately for every case.  Pass enum_loc to start_enum
	call.  Pass value_loc first to build_enumerator.  Pass enum_loc to
	parser_xref_tag.
	(c_parser_struct_or_union_specifier): Save location.  Use it for
	start_struct, finish_struct, and parser_xref_tag.
gcc/testsuite/
	* gcc.dg/old-style-prom-3.c: Add column info.
	* gcc.dg/overflow-warn-1.c
	* gcc.dg/gomp/pr27415.c
	* gcc.dg/gomp/for-1.c: Same.
	* gcc.dg/enum-compat-1.c: Same.
	* gcc.dg/c99-tag-3.c: Same.
	* gcc.dg/Wredundant-decls-2.c: Same.
	* gcc.dg/func-ptr-conv-1.c: Same.
	* gcc.dg/asm-wide-1.c: Same.
	* gcc.dg/nofixed-point-2.c: Same.
	* gcc.dg/cpp/line3.c: Same.
	* gcc.dg/array-10.c: Same.
	* gcc.dg/c99-vla-jump-1.c: Same.
	* gcc.dg/pr20368-1.c: Same.
	* gcc.dg/Wshadow-3.c: Same.
	* gcc.dg/c90-const-expr-8.c: Same.
	* gcc.dg/label-decl-2.c: Same.
	* gcc.dg/dremf-type-compat-2.c: Same.
	* gcc.dg/c90-const-expr-5.c: Same.
	* gcc.dg/builtins-30.c: Same.
	* gcc.dg/Warray-bounds.c: Same.
	* gcc.dg/Wcxx-compat-2.c: Same.
	* gcc.dg/tree-ssa/col-1.c: Same.
	* gcc.dg/old-style-prom-2.c: Same.
	* gcc.dg/cast-function-1.c: Same.
	* gcc.dg/pr15698-1.c: Same.
	* gcc.dg/dremf-type-compat-3.c: Same.
	* gcc.dg/vla-8.c: Same.
	* gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct
	line.
	* gcc.dg/label-decl-2.c: Move label diagnostic to correct line.
	* gcc.dg/old-style-prom-3.c: Check for error on the correct line.
	* gcc.dg/enum-compat-1.c: Same.
	* gcc.dg/dremf-type-compat-2.c: Same.
	* gcc.dg/old-style-prom-2.c: Same.
	* gcc.dg/pr15698-1.c: Same.
	* gcc.dg/pr20368-1.c: Same.
	* gcc.dg/dremf-type-compat-3.c: Same.
	* gcc.dg/builtins-30.c: Same.  Test for columns.
gcc/objcp/
	* objcp-decl.h (c_end_compound_stmt): New argument.
	* objcp-decl.c (objcp_start_struct): Add argument.
	(objcp_finish_struct): Same.
gcc/cp/
	* typeck.c (cp_build_binary_op): Pass location to overflow_warning.
	(build_modify_expr): New arg.
	* semantics.c (finish_unary_op_expr): Pass location to
	overflow_warning.
	(handle_omp_for_class_iterator): Pass location to build_modify_expr.
	* typeck.c (cxx_sizeof_or_alignof_type): Pass location to
	c_sizeof_or_alignof_type.
	(build_array_ref): New argument.
	(build_compound_expr): Same.
	(build_const_cast): Same.
	(build_ptrmemfunc): Pass location to build_c_cast.
	* init.c (avoid_placement_new_aliasing): Pass location to
	build_stmt.
	(build_vec_delete_1): Pass location to cp_build_modify_expr,
	build_compound_expr.
	* class.c (build_vtbl_ref_1): Pass location to build_array_ref.
	* decl.c (poplevel): Pass location to c_build_bind_expr.
	(finish_case_label): Pass location to build_case_label.
	(finish_constructor_body): Same.
	(finish_destructor_body): Pass location to build_stmt.
	(cxx_maybe_build_cleanup): Same, but to build_compound_expr.
	* call.c (build_new_op): Pass location to build_array_ref.
	(build_x_va_arg): Pass location to build_va_arg.
	* except.c (expand_end_catch_block): Pass location to
	build_stmt.
	* cp-tree.h (build_array_ref): New argument.
	(build_compound_expr): Same.
	(build_c_cast): Same.
	* cp-gimplify.c (gimplify_if_stmt): Pass location on down.
	(gimplify_switch_stmt): Same.
	* typeck2.c (split_nonconstant_init_1): Same.
	* pt.c (tsubst_copy): Same.
	* semantics.c (add_decl_expr): Same.
	(do_poplevel): Same.
	(push_cleanup): Same.
	(finish_goto_stmt): Same.
	(finish_expr_stmt): Same.
	(begin_if_stmt): Same.
	(begin_while_stmt): Same.
	(begin_do_stmt): Same.
	(finish_return_stmt): Same.
	(begin_for_stmt): Same.
	(finish_break_stmt): Same.
	(finish_continue_stmt): Same.
	(begin_switch_stmt): Same.
	(begin_try_block): Same.
	(begin_handler): Same.
	(finish_asm_stmt): Same.
	(finish_label_stmt): Same.
	(finish_stmt_expr_expr): Same.
	(finalize_nrv_r): Same.
	(finish_omp_atomic): Same.
	* name-lookup.c (do_using_directive): Same.
	* decl2.c (grok_array_decl): Same.
	* parser.c (cp_parser_cast_expression): Same.
	(cp_parser_selection_statement): Same.
	(cp_parser_implicitly_scoped_statement): Same.
	(cp_parser_objc_selector_expression): Same.
	(cp_parser_objc_synchronized_statement): Same.
	(cp_parser_objc_throw_statement): Same.
	(cp_parser_omp_critical): Same.
	(cp_parser_omp_master): Same.
	* typeck.c (build_function_call): Add location argument.
	* init.c: Add location argument to all build_decl calls.
	* class.c: Same.
	* method.c: Same.
	* rtti.c: Same.
	* tree.c: Same.
	* pt.c: Same.
	* semantics.c: Same.
	* lex.c: Same.
	* decl2.c: Same.
	* cp-gimplify.c: Same.
	* decl.c: Same.
	(cp_make_fname_decl): Add location argument.  Pass location ot
	build_decl.
	(finish_case_label): Same.
	* cp-tree.h (finish_case_label): Add location argument.
	* parser.c (cp_parser_label_for_labeled_statement): Pass location to
	finish_case_label.
gcc/fortran/
	* trans-array.c (gfc_trans_allocate_array_storage): Pass
	location on down.
	(gfc_trans_array_constructor_value): Same.
	(gfc_trans_scalarized_loop_end): Same.
	(gfc_conv_ss_startstride): Same.
	(gfc_trans_g77_array): Same.
	(gfc_trans_dummy_array_bias): Same.
	(gfc_conv_array_parameter): Same.
	(structure_alloc_comps): Same.
	* trans-expr.c (gfc_conv_function_call): Same.
	(fill_with_spaces): Same.
	(gfc_trans_string_copy): Same.
	(gfc_trans_scalar_assign): Same.
	* trans-stmt.c (gfc_trans_goto): Same.
	(gfc_trans_if_1): Same.
	(gfc_trans_simple_do): Same.
	(gfc_trans_do): Same.
	(gfc_trans_do_while): Same.
	(gfc_trans_logical_select): Same.
	(gfc_trans_select): Same.
	(gfc_trans_forall_loop): Same.
	(gfc_trans_nested_forall_loop): Same.
	(generate_loop_for_temp_to_lhs): Same.
	(generate_loop_for_rhs_to_temp): Same.
	(gfc_trans_forall_1): Same.
	(gfc_trans_where_assign): Same.
	(gfc_trans_where_3): Same.
	(gfc_trans_allocate): Same.
	* trans.c (gfc_finish_block): Same.
	(gfc_trans_runtime_check): Same.
	(gfc_call_malloc): Same.
	(gfc_allocate_with_status): Same.
	(gfc_call_free): Same.
	(gfc_deallocate_with_status): Same.
	(gfc_call_realloc): Same.
	(gfc_trans_code): Same.
	* trans-decl.c (gfc_init_default_dt): Same.
	(gfc_generate_constructors): Same.
	* trans-io.c (gfc_trans_io_runtime_check): Same.
	* trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same.
	(gfc_conv_intrinsic_fdate): Same.
	(gfc_conv_intrinsic_ttynam): Same.
	(gfc_conv_intrinsic_minmax): Same.
	(gfc_conv_intrinsic_minmax_char): Same.
	(gfc_conv_intrinsic_anyall): Same.
	(gfc_conv_intrinsic_count): Same.
	(gfc_conv_intrinsic_arith): Same.
	(gfc_conv_intrinsic_minmaxloc): Same.
	(gfc_conv_intrinsic_minmaxval): Same.
	(gfc_conv_intrinsic_rrspacing): Same.
	(gfc_conv_intrinsic_array_transfer): Same.
	(gfc_conv_intrinsic_trim): Same.
	(gfc_conv_intrinsic_repeat): Same.

From-SVN: r148442
2009-06-12 22:06:47 +00:00
Jason Merrill 869fef887f re PR c++/40381 (Revision 142379 caused ICE with deleted functions)
PR c++/40381
	* decl2.c (mark_used): Return after complaining about deleted fn.

From-SVN: r148319
2009-06-09 14:18:45 -04:00
Jason Merrill 550a799d53 re PR c++/38064 ([c++0x] operator== doesn't work for enum classes)
PR c++/38064
	* typeck.c (cp_build_binary_op): Allow ENUMERAL_TYPE in
	arithmetic comparisons.
	(cp_common_type): Handle scoped enums.

	* call.c (promoted_arithmetic_type_p): Don't use INTEGRAL_TYPE_P.
	(add_builtin_candidate, add_builtin_candidates): Likewise.
	(convert_like_real): Likewise.
	* class.c (check_bitfield_decl): Likewise.
	* decl.c (check_static_variable_definition): Likewise.
	(compute_array_index_type): Likewise.
	* decl2.c (grokbitfield): Likewise.
	* init.c (build_new_1): Likewise.
	* pt.c (convert_nontype_argument): Likewise.
	(current_instantiation): Likewise.
	* tree.c (pod_type_p): Likewise.
	* typeck.c (build_static_cast_1): Likewise.
	(build_reinterpret_cast_1): Likewise.

From-SVN: r147854
2009-05-25 19:01:02 -04:00
Mark Mitchell fe2978fba2 tree.c (handle_dll_attribute): Mark dllexport'd inlines as non-external.
gcc/
	* tree.c (handle_dll_attribute): Mark dllexport'd inlines as
	non-external.

	gcc/cp
	* decl2.c (decl_needed_p): Consider dllexport'd functions needed.
	* semantics.c (expand_or_defer_fn): Similarly.

	gcc/testsuite/
	* gcc.dg/dll-6.c: New test.
	* gcc.dg/dll-6a.c: Likewise.
	* gcc.dg/dll-7.c: Likewise.
	* gcc.dg/dll-7a.c: Likewise.
	* g++.dg/ext/dllexport2.C: Likewise.
	* g++.dg/ext/dllexport2a.cc: Likewise.

From-SVN: r147799
2009-05-22 14:57:15 +00:00
Ian Lance Taylor c166b8981f tree.c (build_tree_list_vec_stat): New function.
./:	* tree.c (build_tree_list_vec_stat): New function.
	(ctor_to_vec): New function.
	(build_nt_call_vec): New function.
	(build_call_array): Change args to be a const pointer.
	(build_call_vec): New function.
	* tree.h (build_nt_call_vec): Declare.
	(build_tree_list_vec_stat): Declare.
	(build_tree_list_vec): Define.
	(build_call_array): Update declaration.
	(build_call_vec): Declare.
	(ctor_to_vec): Declare.
	* c-common.c (tree_vector_cache): New static variable.
	(make_tree_vector): New function.
	(release_tree_vector): New function.
	(make_tree_vector_single): New function.
	(make_tree_vector_copy): New function.
	* c-common.h (tree_vector_cache, make_tree_vector): Declare.
	(make_tree_vector_single, make_tree_vector_copy): Declare.
	* c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove.
	(c_parser_expr_list): Don't manage cache here, instead call
	make_tree_vector.
	(c_parser_release_expr_list): Remove static function.
	(c_parser_vec_to_tree_list): Remove static function.
	(c_parser_attributes): Call build_tree_list_vec instead of
	c_parser_vec_to_tree_list.  Call release_tree_vector instead of
	c_parser_release_expr_list.
	(c_parser_postfix_expression_after_primary): Likewise.
	(c_parser_objc_keywordexpr): Likewise.
cp/:
	* parser.c (cp_parser_postfix_expression): Change args to a vec.
	Release it when done.
	(tree_vector): Define typedef.  Define VEC functions.
	(cp_parser_parenthesized_expression_list): Change return type to
	vec.  Change all callers.
	(cp_parser_new_expression): Change placement and initializer to
	vecs.  Release them when done.
	(cp_parser_new_placement): Change return type to vec.  Change all
	callers.
	(cp_parser_new_initializer): Likewise.
	* typeck.c (build_function_call_vec): Just call
	cp_build_function_call_vec.
	(cp_build_function_call): Just build a vec and call
	cp_build_function_call_vec.
	(cp_build_function_call_vec): New function based on old
	cp_build_function_call.
	(convert_arguments): Remove nargs and argarray parameters.  Change
	values to a vec.  Change caller.
	(build_x_compound_expr_from_vec): New function.
	(cp_build_modify_expr): Build vec to pass to
	build_special_member_call.
	* call.c (struct z_candidate): Add first_arg field.  Change args
	field to vec.
	(convert_class_to_reference): Handle first argument separately.
	(add_candidate): Add first_arg parameter.  Change args parameter
	to vec.  Change all callers.
	(add_function_candidate, add_conv_candidate): Likewise.
	(add_template_candidate_real, add_template_candidate): Likewise.
	(add_template_conv_candidate): Likewise.
	(build_user_type_conversion_1): Handle first argument separately.
	(resolve_args): Change return type and parameter type to vecs.
	Change all callers.
	(perform_overload_resolution): Change args parameter to vec.
	Change all callers.
	(build_new_function_call, build_operator_new_call): Likewise.
	(add_candidates): Likewise.
	(build_op_call): New globally visible function, built from and
	replacing static function build_object_call.
	(build_new_op): Don't handle CALL_EXPR.  Build vec, not tree_list,
	of arguments.
	(build_op_delete_call): Build vec to pass to
	cp_build_function_call_vec.
	(build_temp): Build vec to pass to build_special_member_call.
	(convert_like_real): Likewise.
	(perform_direct_initialization_if_possible): Likewise.
	(build_over_call): Handle first_arg field.  Use build_call_array
	rather than build_call_list.
	(build_special_member_call): Change args parameter to vec.  Change
	all callers.
	(build_new_method_call): Likewise.
	* init.c (expand_default_init): Change parms to vec.
	(build_raw_new_expr): Change placement and init to vecs.  Change
	all callers.
	(build_new_1, build_new): Likewise.
	* class.c (resolve_address_of_overloaded_function): Build array to
	pass to fn_type_unification.
	* pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to
	build_new.  For CALL_EXPR create a vec rather than a tree_list;
	expand a pack if necessary.
	(fn_type_unification): Change args parameter to const tree *.  Add
	nargs parameter.  Change all callers.
	(type_unification_real): Likewise.
	(unify): Build array to pass to type_unification_real.
	(get_bindings): Build array to pass to fn_type_unification.
	(any_type_dependent_arguments_p): Change args parameter to a vec.
	Change all callers.
	(make_args_non_dependent): Renamed from build_non_dependent_args.
	Change return type to void.  Change parameter type to vec.  Change
	all callers.
	(do_auto_deduction): Pass an array to type_unification_real.
	* semantics.c (perform_koenig_lookup): Change args to vec.  Change
	all callers.
	(finish_call_expr): Change args to vec.  Change all callers.  Call
	build_op_call instead of passing CALL_EXPR to build_new_op.
	(cxx_omp_create_clause_info): Allocate vec to pass to
	build_special_member_call.
	* decl2.c (build_offset_ref_call_from_tree): Change args parameter
	to vec.  Change all callers.
	* name-lookup.c (lookup_function_nonclass): Likewise.
	(struct arg_lookup): Change args to vec.
	(arg_assoc_namespace): Handle args as a vec.
	(arg_assoc_args_vec): New static function.
	(lookup_arg_dependent): Change args parameter to vec.  Change all
	callers.
	* method.c (do_build_assign_ref): Allocate vec to pass to
	build_special_member_call.
	* except.c (build_throw): Likewise.
	* typeck2.c (build_functional_cast): Likewise.
	* cvt.c (ocp_convert): Likewise.
	* tree.c (build_min_non_dep_call_vec): Change last parameter to
	vec.  Change all callers.
	* cp-tree.h: Update declarations.
	* name-lookup.h: Update declarations.
objc/:
	* objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather
	than NULL_TREE to build_special_member_call.

From-SVN: r147759
2009-05-21 05:58:39 +00:00
Jason Merrill e57d93c6bc Implement explicit conversions ops as specified in N2437.
* decl.c (grokdeclarator): Handle explicit conversion ops.
	(check_initializer): Pass flags to store_init_value.
	* decl2.c (maybe_emit_vtables): Likewise.
	* init.c (expand_aggr_init_1): Likewise.
	* call.c (convert_class_to_reference): Take flags parm,
	check DECL_NONCONVERTING_P.
	(build_user_type_conversion_1): Check DECL_NONCONVERTING_P.
	(add_builtin_candidates): Simplify getting type of conversion.
	(build_object_call): Likewise.  Check DECL_NONCONVERTING_P.
	(implicit_conversion): Pass through LOOKUP_ONLYCONVERTING.
	(reference_binding): Take flags parm.  Direct-initialize copy parm.
	(add_function_candidate): Direct-initialize the copy parm.
	(add_conv_candidate): Use LOOKUP_IMPLICIT, not LOOKUP_NORMAL.
	(build_builtin_candidate): Add LOOKUP_ONLYCONVERTING.
	(conditional_conversion): Likewise.
	(convert_like_real): Only complain about DECL_NONCONVERTING_P
	constructors.
	(perform_implicit_conversion_flags): Add flags parm to
	perform_implicit_conversion.  Improve diagnostics.
	* cp-tree.h (LOOKUP_IMPLICIT): New macro.
	(LOOKUP_COPY_PARM): New bit macro.
	* cvt.c (build_expr_type_conversion): Check DECL_NONCONVERTING_P.
	* typeck.c (convert_for_assignment): Take flags parm, pass it to
	perform_implicit_conversion_flags.
	(cp_build_modify_expr): Pass flags to convert_for_assignment.
	(convert_for_initialization): Likewise.
	* typeck2.c (store_init_value): Take flags parm, pass to
	digest_init_flags.
	(digest_init_flags): Add flags parm to digest_init.
	(digest_init_r): Take flags parm, pass to convert_for_initialization.
	(process_init_constructor_array): Pass it.
	(process_init_constructor_record): Likewise.
	(process_init_constructor_union): Likewise.

From-SVN: r147677
2009-05-18 17:48:02 -04:00
Jan Hubicka 39ff5a9676 cgraphbuild.c (record_reference): Use cgraph_mark_address_taken_node.
* cgraphbuild.c (record_reference): Use cgraph_mark_address_taken_node.
	* cgraph.c (cgraph_mark_address_taken_node): New function.
	(dump_cgraph_node): Dump new flag.
	* cgraph.h (struct cgraph_node): Add address_taken.
	(cgraph_mark_address_taken_node): New function.
	* cp/decl2.c (cxx_callgraph_analyze_expr): Use
	cgraph_mark_address_taken.
	* ipa.c (cgraph_postorder): Prioritize functions with address taken
	since new direct calls can be born.

From-SVN: r147342
2009-05-10 15:11:01 +00:00
Ian Lance Taylor 32e8bb8ebf combine.c (record_value_for_reg): Change 0 to VOIDmode, twice.
gcc/:
	* combine.c (record_value_for_reg): Change 0 to VOIDmode, twice.
	(record_dead_and_set_regs): Likewise.
	* df.h (struct df_mw_hardreg): Change flags field to int.
	(struct df_base_ref): Likewise.
	(struct df): Change changeable_flags field to int.
	* df-scan.c (df_defs_record): Change clobber_flags to int.
	* dwarf2.h (enum dwarf_tag): Make lo_user and hi_user values enum
	constants rather than #define macros.
	(enum dwarf_attribute, enum dwarf_location_atom): Likewise.
	(enum dwarf_type, enum dwarf_endianity_encoding): Likewise.
	(enum dwarf_calling_convention): Likewise.
	(enum dwarf_line_number_x_ops): Likewise.
	(enum dwarf_call_frame_info): Likewise.
	(enum dwarf_source_language): Likewise.
	* dwarf2out.c (int_loc_descriptor): Add cast to enum type.
	(add_calling_convention_attribute): Likewise.
	* fold-const.c (fold_undefer_overflow_warnings): Add cast to enum
	type.
	(combine_comparisons): Change compcode to int.  Add cast to enum
	type.
	* genrecog.c (maybe_both_true_2): Change c to int.
	(write_switch): Likewise.  Add cast to enum type.
	* gimplify.c (gimplify_omp_for): Handle return values from
	gimplify_expr using MIN rather than bitwise or.
	(gimplify_expr): Add cast to enum type.
	* ipa-prop.c (update_jump_functions_after_inlining): Change
	IPA_BOTTOM to IPA_JF_UNKNOWN.
	* ira.c (setup_class_subset_and_memory_move_costs): Change mode to
	int.  Add casts to enum type.
	(setup_cover_and_important_classes): Change cl to int.  Add casts
	to enum type.
	(setup_class_translate): Change cl and mode to int.
	(ira_init_once): Change mode to int.
	(free_register_move_costs): Likewise.
	(setup_prohibited_mode_move_regs): Add casts to enum type.
	* langhooks.c (add_builtin_function_common): Rework assertion that
	value fits bitfield.
	* mcf.c (add_fixup_edge): Change type parameter to edge_type.
	* omega.c (omega_do_elimination): Avoid math on enum types.
	* optabs.c (expand_vec_shift_expr): Remove casts to int.
	* opts.c (set_debug_level): Change 2 to enum constant.  Use new
	int local to handle integral_argment value.
	* regmove.c (try_auto_increment): Change PUT_MODE to
	PUT_REG_NOTE_KIND.
	* reload.c (push_secondary_reload): Add casts to enum type.
	(secondary_reload_class, find_valid_class): Likewise.
	* reload1.c (emit_input_reload_insns): Likewise.
	* rtl.h (NOTE_VAR_LOCATION_STATUS): Likewise.
	* sel-sched.c (init_hard_regs_data): Change cur_mode to int.
	* sel-sched-ir.c (hash_with_unspec_callback): Change 0 to enum
	constant.
	* tree.c (build_common_builtin_nodes): Add casts to enum type.
	* tree-complex.c (complex_lattice_t): Typedef to int rather than
	enum type.
	(expand_complex_libcall): Add casts to enum type.
	* tree-into-ssa.c (get_ssa_name_ann): Change 0 to enum constant.
	* tree-vect-loop.c (vect_model_reduction_cost): Compare reduc_code
	with ERROR_MARK, not NUM_TREE_CODES.
	(vect_create_epilog_for_reduction): Likewise.
	(vectorizable_reduction): Don't initialize epiloc_reduc_code.
	When not using it, set it to ERROR_MARK rather than
	NUM_TREE_CODES.
	* tree-vect-patterns.c (vect_pattern_recog_1): Change vec_mode to
	enum machine_mode.
	* tree-vect-stmts.c (new_stmt_vec_info): Change 0 to
	vect_unused_in_loop.  Change 0 to loop_vect.
	* tree-vectorizer.c (vect_set_verbosity_level): Add casts to enum
	type.
	* var-tracking.c (get_init_value): Change return type to enum
	var_init_status.
	* vec.h (DEF_VEC_FUNC_P) [iterate]: Cast 0 to type T.
	* config/arm/arm.c (fp_model_for_fpu): Change to array to enum
	arm_fp_model.
	(arm_override_options): Add casts to enum type.
	(arm_emit_tls_decoration): Likewise.
	* config/i386/i386.c (ix86_function_specific_restore): Add casts
	to enum type.
	* config/i386/i386-c.c (ix86_pragma_target_parse): Likewise.
	* config/ia64/ia64.c (ia64_expand_compare): Change magic to int.
	* config/rs6000/rs6000.c (rs6000_override_options): Add casts to
	enum type.
	* config/s390/s390.c (code_for_builtin_64): Change to array of
	enum insn_code.
	(code_for_builtin_31): Likewise.
	(s390_expand_builtin): Change code_for_builtin to enum insn_code
	const *.
	* config/sparc/sparc.c (sparc_override_options): Change value
	field in struct code_model to enum cmodel.  In initializer change
	0 to NULL and add cast to enum type.

	* c-typeck.c (build_modify_expr): Add lhs_origtype parameter.
	Change all callers.  Issue a -Wc++-compat warning using
	lhs_origtype if necessary.
	(convert_for_assignment): Issue -Wc++-compat warnings about
	invalid conversions to enum type on assignment.
	* c-common.h (build_modify_expr): Update declaration.

gcc/cp/:
	* call.c (build_temp): Change 0 to enum constant.
	* cp-tree.h (cp_lvalue_kind): Typedef to int rather than enum
	type.
	* cp-gimplify.c (cp_gimplify_expr): Add cast to enum type.
	* decl2.c (constrain_visibility): Likewise.
	* parser.c (cp_lexer_get_preprocessor_token): Likewise.
	(cp_parser_flags): Typedef to int rather than enum type.
	(cp_parser_expression_stack_entry): Change prec field to enum
	cp_parser_prec.

	* typeck.c (build_modify_expr): Add lhs_origtype parameter.
	Change all callers.

gcc/fortran/:
	* gfortran.h (enum gfc_symbol_type): New named enum type, broken
	out of struct gfc_symbol.
	(struct gfc_symbol): Use enum gfc_symbol_type.
	(enum gfc_array_ref_dimen_type): New named enum type, broken out
	of struct gfc_array_ref).
	(struct gfc_array_ref): Use enum gfc_array_ref_dimen_type.
	(mod_pointee_as): Update declaration.
	* decl.c (add_global_entry): Change type to enum gfc_symbol_type.
	(gfc_mod_pointee_as): Change return type to "match".
	* module.c (mio_array_ref): Add cast to enum type.
	(mio_symbol): Likewise.
	* resolve.c (resolve_global_procedure): Change type to enum
	gfc_symbol_type.
	* trans-io.c (gfc_build_st_parameter): Change type to unsigned
	int.

gcc/java/:
	* jcf-parse.c (handle_constant): Add cast to enum type.

gcc/objc/:
	* objc-act.c (get_super_receiver): Update calls to
	build_modify_expr to pass new argument.

gcc/testsuite/:
	* gcc.dg/Wcxx-compat-4.c: New testcase.

From-SVN: r146735
2009-04-24 15:31:38 +00:00
Ian Lance Taylor bbbbb16a88 Fix enum conversions which are invalid in C++:
gcc/:
	Fix enum conversions which are invalid in C++:
	* auto-inc-dec.c (attempt_change): Change 0 to SET in function
	call.
	* calls.c (store_one_arg): Change 0 to EXPAND_NORMAL in function
	call.
	* cse.c (hash_rtx_cb): Change 0 to VOIDmode in function call.
	* dbgcnt.c (dbg_cnt_set_limit_by_name): Add cast to enum type.
	* dbxout.c (dbxout_symbol): Change 0 to VOIDmode in function
	call.
	(dbxout_parms): Likewise.
	* df-core.c (df_set_flags): Change changeable_flags parameter to
	int.
	(df_clear_flags): Likewise.
	* df-problems.c (df_rd_bb_local_compute_process_def): Change
	top_flag parameter to int.
	(df_chain_create_bb_process_use): Likewise.
	(df_chain_add_problem): Change chain_flags parameter to unsigned
	int.  Remove cast.
	* df-scan.c (df_ref_create): Change ref_flags parameter to int.
	(df_ref_create_structure, df_def_record_1): Likewise.
	(df_defs_record, df_uses_record, df_get_call_refs): Likewise.
	(df_notes_rescan): Change 0 to VOIDmode in function call.
	(df_get_call_refs, df_insn_refs_collect): Likewise.
	(df_bb_regs_collect): Likewise.
	(df_entry_block_defs_collect): Likewise.
	(df_exit_block_uses_collect): Likewise.
	* df.h: Update declarations.
	* double-int.c (double_int_divmod): Add cast to enum type.
	* dse.c (replace_inc_dec): Reverse parameters to gen_int_mode.
	* dwarf2out.c (new_reg_loc_descr): Add casts to enum type.
	(based_loc_descr): Likewise.
	(loc_descriptor_from_tree_1): Change first_op and second_op to
	enum dwarf_location_atom.  Add cast to enum type.
	* expmed.c (init_expmed): Change 0 to SET in function call.
	* expr.c (init_expr_target): Change 0 to VOIDmode in function
	call.
	(expand_expr_real_1): Change 0 to EXPAND_NORMAL in function call.
	(do_store_flag): Likewise.
	* fixed-value.h (struct fixed_value): Change mode to enum
	machine_mode.
	* function.c (assign_parms): Change 0 to VOIDmode in function
	call.
	* genautomata.c (insert_automaton_decl): Change 1 to INSERT in
	function call.
	(insert_insn_decl, insert_decl, insert_state): Likewise.
	(automata_list_finish): Likewise.
	* genrecog.c (process_define_predicate): Add cast to enum type.
	* gensupport.c (init_predicate_table): Add cast to enum type.
	* gimple.c (gimple_build_return): Change 0 to ERROR_MARK in
	function call.
	(gimple_build_call_1, gimple_build_label): Likewise.
	(gimple_build_goto, gimple_build_asm_1): Likewise.
	(gimple_build_switch_1, gimple_build_cdt): Likewise.
	* gimple.h (GIMPLE_CHECK): Change 0 to ERROR_MARK in function
	call.
	(enum fallback): Rename from enum fallback_t.
	(fallback_t): Typedef as int.
	* gimple-low.c (lower_builtin_setjmp): Change TSI_SAME_STMT to
	GSI_SAME_STMT in function call.
	* ira.c (setup_class_subset_and_memory_move_costs): Add casts to
	enum type.
	(setup_reg_class_relations): Likewise.
	(setup_reg_class_nregs): Change cl to int.  Add casts to enum
	type.
	(setup_prohibited_class_mode_regs): Add cast to enum type.
	(setup_prohibited_mode_move_regs): Likewise.
	* ira-costs.c (record_reg_classes): Change rclass to enum
	reg_class.
	(record_address_regs): Change i to enum reg_class.
	* lists.c (alloc_EXPR_LIST): Add cast to enum type.
	* machmode.h (GET_MODE_CLASS): Cast value to enum mode_class.
	(GET_MODE_WIDER_MODE): Cast value to enum machine_mode.
	(GET_MODE_2XWIDER_MODE): Likewise.
	(GET_CLASS_NARROWEST_MODE): Likewise.
	* omp-low.c (expand_omp_for): Add cast to enum type.
	* optabs.c (debug_optab_libfuncs): Add casts to enum type.
	* opts.c (enable_warning_as_error): Change kind to diagostic_t.
	* postreload.c (reload_cse_simplify_operands): Change rclass local
	to enum reg_class.
	* predict.c (combine_predictions_for_insn): Change best_predictor
	and predictor to enum br_predictor.
	(combine_predictions_for_bb): Likewise.
	(build_predict_expr): Change assignment to PREDICT_EXPR_OUTCOME to
	use SET_PREDICT_EXPR_OUTCOME.
	* real.c (real_arithmetic): Change icode to code in function
	call.
	* reginfo.c (init_move_cost): Add casts to enum type.
	(init_reg_sets_1, init_fake_stack_mems): Likewise.
	* regmove.c (regclass_compatible_p): Change class0 and class1 to
	enum reg_class.
	* reload.c (find_valid_class): Add casts to enum type.
	(push_reload): Change 0 to NO_REGS in function call.
	(find_reloads): Change this_alternative to array of enum
	reg_class.  Remove some now-unnecessary casts.
	(make_memloc): Change 0 to VOIDmode in function call.
	* reload1.c (reload): Change 0 to VOIDmode in function call.
	(eliminate_regs_1, elimination_effects): Likewise.
	(eliminate_regs_in_insn): Likewise.
	(emit_input_reload_insns): Add cast to enum type.
	(delete_output_reload): Change 0 to VOIDmode in function call.
	* reorg.c (insn_sets_resource_p): Convert include_delayed_effects
	to enum type in function call.
	* tree.h (PREDICT_EXPR_OUTCOME): Add cast to enum type.
	(SET_PREDICT_EXPR_OUTCOME): Define.
	* tree-dump.c (get_dump_file_info): Change phase parameter to
	int.
	(get_dump_file_name, dump_begin, dump_enabled_p): Likewise.
	(dump_initialized_p, dump_flag_name, dump_end): Likewise.
	(dump_function): Likewise.
	* tree-dump.h: Update declarations.
	* tree-pass.h: Update declarations.
	* varasm.c (assemble_integer): Change mclass to enum mode_class.
	* config/arm/arm.c (thumb_legitimize_reload_address): Add cast to
	enum type.
	(arm_rtx_costs_1): Correct parenthesization.
	(arm_rtx_costs): Add casts to enum type.
	(adjacent_mem_locations): Reverse arguments to const_ok_for_op.
	(vfp_emit_fstmd): Use add_rg_note.
	(emit_multi_reg_push, emit_sfm): Likewise.
	(thumb_set_frame_pointer): Likewise.
	(arm_expand_prologue): Likewise.
	(arm_regno_class): Change return type to enum reg_class.
	(thumb1_expand_prologue): Use add_reg_note.
	* config/arm/arm-protos.h (arm_regno_class): Update declaration.
	* config/arm/arm.h (INITIALIZE_TRAMPOLINE): Change 0 to LCT_NORMAL
	in function call.
	* config/arm/gentune.sh: Add cast to enum type.
	* config/arm/arm-tune.md: Rebuild.
	* config/i386/i386.c (ix86_expand_prologue): Use add_reg_note.
	(ix86_split_fp_branch, predict_jump): Likewise.
	(ix86_expand_multi_arg_builtin): Change sub_code from enum
	insn_code to enum rtx_code.
	(ix86_builtin_vectorized_function): Add cast to enum type.
	* config/i386/i386.md (truncdfsf2): Change slot to enum
	ix86_stack_slot.
	(truncxf<mode>2, isinf<mode>2): Likewise.
	* config/i386/i386-c.c (ix86_pragma_target_parse): Add cast to
	enum type.
	* config/ia64/ia64.c (ia64_split_tmode_move): Use add_reg_note.
	(spill_restore_mem, do_spill, ia64_expand_prologue): Likewise.
	(insert_bundle_state): Change 1 to INSERT in function call.
	(ia64_add_bundle_selector_before): Likewise.
	* config/ia64/ia64.md (cpu attr): Add cast to enum type.
	(save_stack_nonlocal): Change 0 to LCT_NORMAL in function call.
	(restore_stack_nonlocal): Likewise.
	* config/mips/mips.h (MIPS_ICACHE_SYNC): Change 0 to LCT_NORMAL in
	function call.
	* config/mips/mips.c (mips_binary_cost): Change 0 to SET in
	function call.
	(mips_rtx_costs): Likewise.
	(mips_override_options): Add casts to enum type.
	* config/mips/sdemtk.h (MIPS_ICACHE_SYNC): Change 0 to LCT_NORMAL
	in function call.
	* config/pa/pa.c (legitimize_pic_address): Use add_reg_note.
	(store_reg, set_reg_plus_d): Likewise.
	(hppa_expand_prologue, hppa_profile_hook): Likewise.
	* config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Add
	cast to enum type.
	(altivec_expand_vec_set_builtin): Change 0 to EXPAND_NORMAL in
	function call.
	(emit_unlikely_jump): Use add_reg_note.
	(rs6000_emit_allocate_stack): Likewise.
	(rs6000_frame_related, rs6000_emit_prologue): Likewise.
	(output_toc): Change 1 to INSERT in function call.
	(output_profile_hook): Change 0 to LCT_NORMAL in function call.
	(rs6000_initialize_trampoline): Likewise.
	(rs6000_init_dwarf_reg_sizes_extra): Change 0 to EXPAND_NORMAL in
	function call.
	* config/s390/s390.c (s390_rtx_costs): Add cast to enum type.
	(s390_expand_movmem): Change 0 to OPTAB_DIRECT in function call.
	(s390_expand_setmem, s390_expand_cmpmem): Likewise.
	(save_gprs): Use add_reg_note.
	(s390_emit_prologue): Likewise.
	(s390_expand_builtin): Change 0 to EXPAND_NORMAL in function
	call.
	* config/sparc/sparc.c (sparc_expand_prologue): Use add_reg_note.
	(sparc_fold_builtin): Add cast to enum type.
	* config/spu/spu.c (spu_emit_branch_or_set): Change ior_code to
	enum insn_code.
	(spu_expand_prologue): Use add_reg_note.
	(expand_builtin_args): Change 0 to EXPAND_NORMAL in function
	call.

	* c-parser.c (c_parser_attributes): Change VEC back to tree list.
	(c_parser_postfix_expression_after_primary): Get VEC for list of
	arguments.  Get original types of arguments.  Call
	build_function_call_vec.
	(cached_expr_list_1, cached_expr_list_2): New static variables.
	(c_parser_expr_list): Change return type to VEC *.  Add
	p_orig_types parameter.  Change all callers.
	(c_parser_release_expr): New static function.
	(c_parser_vec_to_tree_list): New static function.
	* c-typeck.c (build_function_call): Rewrite to build a VEC and
	call build_function_call_vec.
	(build_function_call_vec): New function, based on old
	build_function_call.
	(convert_arguments): Remove nargs and argarray parameters.  Change
	values to a VEC.  Add origtypes parameter.
	(build_modify_expr): Add rhs_origtype parameter.  Change all
	callers.
	(convert_for_assignment): Add origtype parameter.  Change all
	callers.  If warn_cxx_compat, check for conversion to an enum
	type when calling a function.
	(store_init_value): Add origtype parameter.  Change all callers.
	(digest_init): Likewise.
	(struct init_node): Add origtype field.
	(add_pending_init): Add origtype parameter.  Change all callers.
	(output_init_element): Likewise.
	(output_pending_init_elements): Pass origtype from init_node to
	output_init_element.
	(process_init_elemnt): Pass origtype from c_expr to
	output_init_element.
	(c_finish_return): Add origtype parameter.  Change all callers.
	* c-common.c (sync_resolve_size): Change params to VEC *.  Change
	caller.
	(sync_resolve_params): Likewise.
	(sync_resolve_return): Change params to first_param.  Change
	caller.
	(resolve_overloaded_builtins): Change params to VEC *.  Change
	callers.   Save first parameter around call to
	build_function_call_vec.
	* c-decl.c (finish_decl): Add origtype parameter.  Change all
	callers.  Call build_function_call_vec rather than
	build_function_call for cleanup.
	* c-tree.h: Update declarations.
	* c-common.h: Update declarations.
	* stub-objc.c (objc_rewrite_function_call): Change parameter from
	params to first_param.
	* target.h (struct gcc_target): Change resolve_overloaded_builtin
	params parameter from tree to void *.
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
	Change arglist parameter to have type void *, and to be a pointer
	to a VEC.
	* config/rs6000/rs6000-protos.h
	(altivec_resolve_overloaded_builtin): Update declaration.
	* config/spu/spu-c.c (spu_resolved_overloaded_builtin): Change
	fnargs parameter to have type void *, and to be a pointer to a
	VEC.  Call build_function_call_vec instead of
	build_function_call.
	* config/spu/spu-protos.h (spu_expand_builtin): Update
	declaration.

gcc/cp/:
	* typeck.c (build_function_call_vec): New function.
	(cp_build_function_call): Only pass first parameter to
	objc_rewrite_function_call.
	(build_modify_expr): Add rhs_origtype parameter.  Change all
	callers.
	* decl.c (finish_decl): Add origtype parameter.  Change all
	callers.
	* semantics.c (finish_call_expr): Pass VEC to
	resolve_overloaded_builtin.

gcc/objc:
	* objc-act.c (objc_rewrite_function_call): Change parameter from
	params to first_param.  Change all callers.

gcc/testsuite:
	* gcc.dg/Wcxx-compat-3.c: New testcase.

From-SVN: r146451
2009-04-20 19:35:00 +00:00
Dodji Seketeli d0940d5662 re PR c++/26693 (Access checks not performed for types in templates)
gcc/ChangeLog:
2009-04-02  Dodji Seketeli  <dodji@redhat.com>

    PR c++/26693
    * c-decl.c: (clone_underlying_type): Move this ...
    * c-common.c (set_underlying_type): ... here.
    Also, make sure the function properly sets TYPE_STUB_DECL() on
    the newly created typedef variant type.
    * c-common.h (is_typedef_decl, set_underlying_type): Declare ...
    * c-common.c (is_typedef_decl, set_underlying_type): ... new entry points.

gcc/cp/ChangeLog:
2009-04-02  Dodji Seketeli  <dodji@redhat.com>

    PR c++/26693
    * decl2.c (grokfield): when a typedef appears in a
    class, create the typedef variant type node for it.
    (save_template_attributes): Creating typedef variant type node
     here is now useless.
    * decl.c (grokdeclarator): If the typedef'ed struct/class was
    anonymous, set the proper type name to all its type variants.
    (xref_basetypes) : Fixup the variant types after setting
    TYPE_BINFO on REF.
    * name-lookup.c (pushdecl_maybe_friend): Reuse the
    set_underlying_type function to install typedef variant types.
    * cp-tree.h (MEMBER_TYPES_NEEDING_ACCESS_CHECK): New template accessor
    macro.
    (append_type_to_template_for_access_check): New entry points.
    * semantics.c (check_accessibility_of_qualified_id):
    When a typedef that is a member of a class appears in a template,
    add it to the template. It will be ...
    * class.c (finish_struct_bits): Split type variant fixup into ...
    (fixup_type_variants): A new entry point.
    * pt.c (instantiate_class_template, instantiate_template ): ... access
    checked at template instantiation time.
    (resolve_type_name_type): The type name should be the name of the
    main type variant.
    (retrieve_specialization): Specializations of template typedefs aren't
    to be looked up in DECL_TEMPLATE_INSTANTIATIONS (tmpl).
    (append_type_to_template_for_access_check): New entry point.
    (tsubst_decl): For typedefs, build the variant type from the correct
    original type.
    (get_class_bindings): Fix function comment.
    (perform_typedefs_access_check): New entry point.

gcc/testsuite/ChangeLog:
2009-04-02  Dodji Seketeli  <dodji@redhat.com>

    PR c++/26693
    * g++.dg/template/typedef11.C: New test.
    * g++.dg/template/typedef12.C: Likewise.
    * g++.dg/template/typedef13.C: Likewise.
    * g++.dg/template/typedef14.C: Likewise.
    * g++.dg/template/typedef15.C: Likewise.
    * g++.dg/template/typedef16.C: Likewise.
    * g++.dg/template/sfinae3.C: Compile this pedantically.
    The only errors expected should be the one saying the typedef is ill
    formed.
    * g++.old-deja/g++.pt/typename8.C: Likewise.
    * g++.dg/template/access11.C: Update this.

libstdc++-v3/ChangeLog:
2009-04-02  Dodji Seketeli  <dodji@redhat.com>

    * include/ext/bitmap_allocator.h: the typedefs should be made public
    if we want them to be accessible. This has been revealed by the patch
    that fixes PR c++/26693 in g++.

From-SVN: r145440
2009-04-02 11:24:19 +02:00
Andrew Haley 359b867255 re PR c++/39380 (All programs that link Java and C++ libraries fail when optimized)
2009-03-26  Andrew Haley  <aph@redhat.com>

        PR C++/39380
        * decl2.c (possibly_inlined_p): If java exceptions are in use
        don't inline a decl unless it is explicitly marked inline.
        * lex.c: (pragma_java_exceptions): New variable.
        (handle_pragma_java_exceptions): Set pragma_java_exceptions.
        * cp-tree.h (pragma_java_exceptions): Declare new variable.

From-SVN: r145091
2009-03-26 15:17:26 +00:00
Jason Merrill 448545cb51 decl.c (grokfndecl): Set DECL_CONTEXT on parms.
cp/:
        * decl.c (grokfndecl): Set DECL_CONTEXT on parms.
        (duplicate_decls): Adjust DECL_CONTEXT of newdecl's parms.
        * pt.c (check_explicit_specialization): Likewise.
        (tsubst_copy) [PARM_DECL]: Return a dummy parm if we don't have a
        local specialization.
        * tree.c (cp_tree_equal) [PARM_DECL]: Check type and index, not name.
        * decl2.c (parm_index): New fn.
        * semantics.c (finish_decltype_type): Don't use describable_type.
        * mangle.c (write_expression): Likewise.  Mangle ALIGNOF_EXPR.
        Give a sorry for unsupported codes rather than crash.  Mangle
        conversions with other than 1 operand.  New mangling for PARM_DECL.
        * operators.def (ALIGNOF_EXPR): Mangle as az.
  
        * include/demangle.h (enum demangle_component_type): Add
        DEMANGLE_COMPONENT_FUNCTION_PARAM.
        * libiberty/cp-demangle.c (d_make_function_param): new fn.
        (cplus_demangle_mangled_name): Work around abi v2 bug.
        (d_expr_primary): Likewise.
        (cplus_demangle_operators): Add alignof ops.
        (d_expression): Handle function parameters and conversions
        with other than 1 operand.
        (d_print_comp): Handle function parameters.  Fix bug with
        function used in type of function.

From-SVN: r144924
2009-03-17 19:31:18 -04:00
Jakub Jelinek 0981262229 re PR target/39175 (ICE while compiling qt-4.5.0-rc1)
PR target/39175
	* c-common.c (c_determine_visibility): If visibility changed and
	DECL_RTL has been already set, call make_decl_rtl to update symbol
	flags.

	* decl2.c (determine_visibility): If visibility changed and
	DECL_RTL has been already set, call make_decl_rtl to update symbol
	flags.

	* gcc.dg/visibility-20.c: New test.
	* g++.dg/ext/visibility/visibility-11.C: New test.

From-SVN: r144305
2009-02-19 22:15:12 +01:00
H.J. Lu 68017cb410 re PR c++/39188 (G++ doesn't handle static anonymous union right)
gcc/

2009-02-19  H.J. Lu  <hongjiu.lu@intel.com>

	PR c++/39188
	* varasm.c (assemble_variable): Don't check DECL_NAME when
	globalizing a variable.

gcc/cp/

2009-02-19  H.J. Lu  <hongjiu.lu@intel.com>

	PR c++/39188
	* cp-tree.h (maybe_commonize_var): New.

	* decl.c (maybe_commonize_var): Make it extern.

	* decl2.c (finish_anon_union): Call maybe_commonize_var.

gcc/testsuite/

2009-02-19  H.J. Lu  <hongjiu.lu@intel.com>

	PR c++/39188
	* g++.dg/abi/pr39188-1a.C: New.
	* g++.dg/abi/pr39188-1b.C: Likewise.
	* g++.dg/abi/pr39188-1.h: Likewise.
	* g++.dg/abi/pr39188-2a.C: Likewise.
	* g++.dg/abi/pr39188-2b.C: Likewise.
	* g++.dg/abi/pr39188-2.h: Likewise.
	* g++.dg/abi/pr39188-3a.C: Likewise.
	* g++.dg/abi/pr39188-3b.C: Likewise.
	* g++.dg/abi/pr39188-3.h: Likewise.

From-SVN: r144297
2009-02-19 07:22:28 -08:00
Jason Merrill bff54b1987 re PR c++/39153 (virtual default dtor not defined)
PR c++/39153
        * decl2.c (cp_write_global_declarations):
        Check DECL_DEFAULTED_FN, not DECL_ARTIFICIAL.

From-SVN: r144119
2009-02-11 21:01:07 -05:00
Dodji Seketeli 03c2a308f3 Reverted commit 143546 related to PR c++/26693
From-SVN: r143562
2009-01-22 08:15:41 +01:00
Dodji Seketeli d597b3ce68 re PR c++/26693 (Access checks not performed for types in templates)
gcc/ChangeLog:
2009-01-21  Dodji Seketeli  <dodji@redhat.com>

	PR c++/26693
	* c-decl.c: (clone_underlying_type): Move this  ...
	* c-common.c (set_underlying_type): ... here.
	Also, make sure the function  properly sets TYPE_STUB_DECL() on
	the newly created typedef variant type.
	(is_typedef_decl ): New entry point.
	* tree.h: Added a new member member_types_needing_access_check to
	struct tree_decl_non_common.
	(set_underlying_type): New entry point.
	(is_typedef_type): Likewise.

gcc/cp/ChangeLog/
2009-01-21  Dodji Seketeli  <dodji@redhat.com>

	PR c++/26693
	* decl2.c (grokfield): when a typedef appears in a
	class, create the typedef variant type node for it.
	(save_template_attributes): Creating typedef variant type node
	 here is now useless.
	* decl.c (grokdeclarator): If the typedef'ed struct/class was
	anonymous, set the proper type name to all its type variants.
	* name-lookup.c (pushdecl_maybe_friend): Reuse the
	set_underlying_type function to install typedef variant types.
	* cp-tree.h (MEMBER_TYPES_NEEDING_ACCESS_CHECK): New template accessor
	macro.
	(append_type_to_template_for_access_check): New entry points.
	* semantics.c (check_accessibility_of_qualified_id):
	When a typedef that is a member of a class appears in a template,
	add it to the template. It will be ...
	* pt.c (instantiate_class_template, instantiate_template ): ... access
	checked at template instantiation time.
	(tsubst): Handle the case of being called with NULL args.
	(resolve_type_name_type): The type name should be the name of the
	main type variant.
	(append_type_to_template_for_access_check): New entry point.

gcc/testsuite/ChangeLog
2009-01-21  Dodji Seketeli  <dodji@redhat.com>

	PR c++/26693
	* g++.dg/template/typedef11.C: New test.
	* g++.dg/template/typedef12.C: Likewise.
	* g++.dg/template/typedef13.C: Likewise.
	* g++.dg/template/typedef14.C: Likewise.
	* g++.dg/template/sfinae3.C: Compile this pedantically.
	The only errors expected should be the one saying the typedef is ill
	formed.
	* g++.old-deja/g++.pt/typename8.C: Likewise.
	* g++.dg/template/access11.C: Update this.

libstdc++-v3/ChangeLog:
2009-01-21  Dodji Seketeli  <dodji@redhat.com>

	* include/ext/bitmap_allocator.h: the typedefs should be made public
	if we want them to be accessible. This has been revealed by the patch
	that fixes PR c++/26693 in g++.

From-SVN: r143546
2009-01-21 17:14:49 +01:00
Steve Ellcey 9bebdb76f2 * decl2.c (mark_used): Remove assemble_external call.
From-SVN: r142563
2008-12-08 19:27:26 +00:00
Jason Merrill 1dbc1ae77a re PR c++/28743 (ICE with invalid specialization)
PR c++/28743
        * decl2.c (check_classfn): Error rather than abort on parameter
        list mismatch.

From-SVN: r142212
2008-11-25 22:51:40 -05:00
Jason Merrill 01d685ccfd re PR c++/36410 (ICE with transparent union)
PR c++/36410
        * decl2.c (grokfield): Pass ATTR_FLAG_TYPE_IN_PLACE for a typedef
        that names a class for linkage purposes.

From-SVN: r142019
2008-11-19 16:35:27 -05:00