Commit Graph

1108 Commits

Author SHA1 Message Date
Jan Hubicka 39e2db00da lto-symtab.c (lto_cgraph_replace_node): Kill same body alias code.
* lto-symtab.c (lto_cgraph_replace_node): Kill same body alias code.
	(lto_symtab_resolve_can_prevail_p): Likewise.
	(lto_symtab_merge_cgraph_nodes): Update merging of aliases.
	* cgraph.c (same_body_aliases_done): New global var.
	(cgraph_same_body_alias_1): Rename to ...
	(cgraph_create_function_alias): ... this one; reorg to new
	representation.
	(cgraph_same_body_alias): Use cgraph_create_function_alias;
	record references when asked to.
	(cgraph_add_thunk): Fix formating.
	(cgraph_get_node): Kill same body alias code.
	(cgraph_node_for_asm): Likewise.
	(cgraph_remove_same_body_alias): Remove.
	(cgraph_remove_node): Kill same body alias code.
	(cgraph_mark_address_taken_node): Mark also the aliased function
	as having address taken.
	(dump_cgraph_node): Dump same body aliases.
	(cgraph_for_node_thunks_and_aliases): Update for new alias
	representation.
	(cgraph_for_node_and_aliases): Likewise.
	* cgraph.h (same_body): Kll pointer.
	(same_body_alias): Update comment.
	(same_body_aliases_done): Declare.
	(cgraph_remove_same_body_alias): Remove declaration.
	(cgraph_create_function_alias): Declare.
	(cgraph_process_same_body_aliases): Declare.
	(cgraph_function_with_gimple_body_p): Check for alias.
	(cgraph_can_remove_if_no_direct_calls_p): Look for aliases.
	(cgraph_alias_aliased_node): New function.
	(cgraph_function_node): Update for new aliases.
	(cgraph_function_or_thunk_node): Likewise.
	* ipa-inline-transform.c (can_remove_node_now_p): Look for aliases.
	(inline_call): Remove dead aliases.
	* cgraphunit.c (cgraph_decide_is_function_needed): Disable assembler name
	hack for same body aliases.
	(clone_of_p): Look through aliases.
	(verify_cgraph_node): Verify aliases.
	(cgraph_analyze_function): Analyze aliases; fixup C++ bugs.
	(cgraph_process_same_body_aliases): New function.
	(process_function_and_variable_attributes): Disable weakref warning on
	alias.
	(cgraph_analyze_functions): Handle aliases.
	(cgraph_mark_functions_to_output): Handle aliases same way as thunks.
	(assemble_thunks): Rename to ...
	(assemble_thunks_and_aliases): ... this one; handle aliases, too.
	(cgraph_expand_function): Remove alias output code.
	(cgraph_output_in_order): Skip aliases.
	(cgraph_preserve_function_body_p): Aliases don't need preserving.
	* ipa-ref.c (ipa_ref_use_name): Add alias reference.
	(ipa_record_reference): Do not assert on alias references.
	(ipa_ref_has_aliases_p): New function.
	* ipa-ref.h (enum ipa_ref_use): Add IPA_REF_ALIAS.
	(ipa_ref_has_aliases_p): Declare.
	* lto-cgraph.c (lto_output_node): Handle aliases.
	(input_node): Likewise.
	* lto-streamer-out.c (lto_output): Skip aliases.
	(produce_symtab): Kill same_body_alias code.
	* ipa-utils.c (ipa_reverse_postorder): Add FIXME.
	(ipa_reverse_postorder): Use cgraph_only_called_directly_or_aliased_p.
	* ipa-inline.c (update_caller_keys): Walk aliases.
	(inline_small_functions): Fix thinko in previous patch.
	* ipa.c (cgraph_externally_visible_p): Do not walk aliases.
	(function_and_variable_visibility): Do not walk same body aliases.
	* tree-ssa-structalias.c (associate_varinfo_to_alias): New function.
	(ipa_pta_execute): Use it.

	* lto.c (add_cgraph_node_to_partition_1): Break out from ...
	(add_cgraph_node_to_partition) ... here; walk aliases.
	(lto_1_to_1_map): Remove same body alias code.
	(promote_fn): Likewise.
	(lto_promote_cross_file_statics): Update comment.

	* decl2.c (cp_write_global_declarations): Process aliases; look trhough
	same body aliases.

From-SVN: r174952
2011-06-11 13:01:53 +00:00
Jan Hubicka e44eb8ff70 decl2.c (clear_decl_external): New functoin.
* decl2.c (clear_decl_external): New functoin.
	(cp_write_global_declarations): Use it.

From-SVN: r174922
2011-06-10 18:28:02 +00:00
David Krauss 6904f4b401 re PR c++/49118 (Endless operator-> chain causes infinite loop)
PR c++/49118
	* typeck2.c (build_x_arrow): Push fake template context
	to produce diagnostic on acyclic endless operator-> drill-down.
	* call.c (build_new_op): Change Boolean overload status
	value to a pointer to the overload function.
	* cp-tree.h: Likewise.
	* typeck.c: Likewise.
	* parser.c: Likewise.
	* decl2.c: Likewise.
	* pt.c: Likewise.

From-SVN: r174889
2011-06-10 01:18:36 -04:00
Jason Merrill 1026172832 re PR c++/49107 ([C++0x][4.7 Regression] incomplete type regression with std::pair)
PR c++/49107
	* cp-tree.def (DEFERRED_NOEXCEPT): New.
	* cp-tree.h (struct tree_deferred_noexcept): New.
	(DEFERRED_NOEXCEPT_PATTERN, DEFERRED_NOEXCEPT_ARGS): New.
	(DEFERRED_NOEXCEPT_SPEC_P): New.
	(enum cp_tree_node_structure_enum): Add TS_CP_DEFERRED_NOEXCEPT.
	(union lang_tree_node): Add tree_deferred_noexcept.
	(maybe_instantiate_noexcept): Declare.
	* cp-objcp-common.c (cp_tree_size): Handle DEFERRED_NOEXCEPT.
	* error.c (dump_exception_spec): Likewise.
	* cxx-pretty-print.c (pp_cxx_exception_specification): Likewise.
	* ptree.c (cxx_print_xnode): Likewise.
	* tree.c (cp_tree_equal): Likewise.
	* decl.c (cp_tree_node_structure): Likewise.
	(duplicate_decls): Call maybe_instantiate_noexcept.
	* except.c (build_noexcept_spec): Handle DEFERRED_NOEXCEPT.
	(nothrow_spec_p, type_noexcept_p, type_throw_all_p): Check
	DEFERRED_NOEXCEPT_SPEC_P.
	* typeck2.c (merge_exception_specifiers): Likewise.
	* decl2.c (mark_used): Call maybe_instantiate_noexcept.
	* method.c (process_subob_fn, defaulted_late_check): Likewise.
	* pt.c (tsubst_exception_specification): Add defer_ok parm.
	Build DEFERRED_NOEXCEPT.
	(maybe_instantiate_noexcept): New.
	(tsubst, regenerate_decl_from_template, instantiate_decl): Adjust.
	* search.c (check_final_overrider): Call maybe_instantiate_noexcept.

From-SVN: r174820
2011-06-08 17:35:02 -04:00
Nathan Froyd 38e01f9ec9 move TS_STATEMENT_LIST to be a substructure of TS_TYPED
move TS_STATEMENT_LIST to be a substructure of TS_TYPED
gcc/
	* c-decl.c (c_push_function_context): Copy the current statement
	list stack.
	(add_stmt): Check building_stmt_list_p and push_stmt if necessary.
	(finish_struct): Call building_stmt_list_p instead of checking
	cur_stmt_list.
	* c-parser.c (c_parser_postfix_expression): Likewise.
	* c-typeck.c (c_end_compound_stmt): Likewise.
	* print-tree.c (print_node) [STATEMENT_LIST]: Don't print TREE_CHAIN.
	* tree-iterator.c (stmt_list_cache): Change to a VEC.
	(alloc_stmt_list): Adjust for stmt_list_cache's new type.
	(free_stmt_list): Likewise.
	* tree.h (struct tree_statement_list): Include typed_tree instead
	of tree_common.
	* tree.c (initialize_tree_contains_struct): Mark TS_STATEMENT_LIST
	as TS_TYPED instead of TS_COMMON.

gcc/c-family/
	* c-common.h (struct stmt_tree_s) [x_cur_stmt_list]: Change to a VEC.
	(stmt_list_stack): Define.
	(cur_stmt_list): Adjust for new type of x_cur_stmt_list.
	* c-semantics.c (push_stmt_list, pop_stmt_list): Likewise.

gcc/cp/
	* cp-tree.h (building_stmt_tree): Delete.
	* decl.c (save_function_data): Tweak initializer for x_cur_stmt_list.
	(build_aggr_init_full_exprs): Call building_stmt_list_p
	instead of building_stmt_tree.
	(initialize_local_var): Likewise.
	(finish_function): Likewise.
	* decl2.c (finish_anon_union): Likewise.
	* init.c (begin_init_stmts): Likewise.
	(finish_init_stmts): Likewise.
	(expand_aggr_init_1): Likewise.
	* name-lookup.c (do_local_using_decl): Likewise.
	(do_namespace_alias): Likewise.
	(do_using_directive): Likewise.
	(cp_emit_debug_info_for_using): Likewise.
	* semantics.c (add_stmt): Assert that stmt_list_stack is non-empty.

From-SVN: r174343
2011-05-27 17:43:44 +00:00
Paolo Carlini 754af126c0 re PR c++/48737 ([C++0x][SFINAE] Hard errors with array list-construction with too many elements)
/cp
2011-05-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/48737
	PR c++/48744
	* decl.c (reshape_init): Take a complain parameter and do
	not call error if tf_error is not set.
	(check_initializer, reshape_init_r, reshape_init_array,
	reshape_init_array_1, reshape_init_vector, reshape_init_class):
	Adjust.
	* typeck2.c (digest_init_r): Take a complain parameter and
	pass it to convert_for_initialization.
	(digest_init, digest_init_flags, process_init_constructor_array,
	process_init_constructor_record, process_init_constructor_union,
	process_init_constructor, digest_init_r): Adjust.
	* init.c (expand_default_init, build_new_1): Likewise.
	* typeck.c (cp_build_modify_expr): Likewise.
	* decl2.c (grokfield): Likewise.
	* call.c (convert_like_real, convert_default_arg): Likewise.
	* semantics.c (finish_compound_literal): Pass complain to
	reshape_init and digest_init.
	* cp-tree.h: Adjust declarations.

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

	PR c++/48737
	PR c++/48744
	* g++.dg/template/sfinae28.C: New.
	* g++.dg/template/sfinae29.C: Likewise.

From-SVN: r173590
2011-05-09 19:24:50 +00:00
Nathan Froyd 7e1352fe55 introduce {class,type}_of_this_parm functions
introduce {class,type}_of_this_parm functions
	* cp-tree.h (type_of_this_parm, class_of_this_parm): New functions.
	* call.c (standard_conversion): Call class_of_this_parm.
	* cxx-pretty-print.c (pp_cxx_implicit_parameter_type): Likewise.
	(pp_cxx_direct_abstract_declarator): Likewise.
	* decl2.c (change_return_type): Likewise.
	(cp_reconstruct_complex_type): Likewise.
	* error.c (dump_type_suffix, dump_function_decl): Likewise.
	* mangle.c (write_function_type): Likewise.
	* pt.c (unify): Likewise.
	* typeck.c (merge_types, type_memfn_quals): Likewise.
	* decl.c (build_this_parm): Call type_of_this_parm.

From-SVN: r173496
2011-05-06 17:03:08 +00:00
Lawrence Crowl 575bfb0052 Upgrade the utility of timevars.
Index: gcc/ChangeLog

2011-04-27  Lawrence Crowl  <crowl@google.com>

	* timevar.h (timevar_cond_start): Remove unused POP_TIMEVAR_AND_RETURN.
	(timevar_cond_start): New for starting a timer only when it is not
	already running.
	(timevar_cond_stop): New for stopping a timer when it was not already
	running.

	* timevar.c (timevar_stop): Enable start/stop timers to start again.
	(timevar_cond_start): New as above.
	(timevar_cond_stop): New as above.

	* timevar.def: Add start/stop timers for compiler phases,
	TV_PHASE_SETUP, TV_PHASE_PARSING, TV_PHASE_DEFERRED, TV_PHASE_CGRAPH,
	TV_PHASE_DBGINFO (C), TV_PHASE_CHECK_DBGINFO (C++), TV_PHASE_GENERATE,
	and TV_PHASE_FINALIZE.
	Change push/pop timer TV_PARSE to TV_PARSE_GLOBAL.
	Add push/pop timers TV_PARSE_STRUCT, TV_PARSE_ENUM, TV_PARSE_FUNC,
	TV_PARSE_INLINE, TV_PARSE_INMETH, TV_TEMPLATE_INST.
	Change push/pop timer TV_NAME_LOOKUP into a start/stop timer.
	Make unused TV_OVERLOAD into a start/stop timer.

	Remove unused timers TV_OVERLOAD, TV_TEMPLATE_INSTANTIATION.
	Mark the strings for TV_NAME_LOOKUP and TV_OVERLOAD with a "|"
	to indicate that they are start/stop timers.

	* toplev.c (compile_file): Change TV_PARSE to TV_PARSE_GLOBAL.
	Add start/stop timers TV_PHASE_PARSING and TV_PHASE_GENERATE.
	Move initialization to do_compile.
	(do_compile): Add initialization from above.
	Add start/stop timers TV_PHASE_SETUP and TV_PHASE_FINALIZE.

	* c-decl.c (c_write_global_declarations): Add start/stop of
	TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO.

	* c-parser.c (c_parser_declaration_or_fndef): Push/pop TV_PARSE_FUNC
	or TV_PARSE_INLINE, as appropriate.
	(c_parser_enum_specifier): Push/pop TV_PARSE_ENUM.
	(c_parser_struct_or_union_specifier): Push/pop TV_PARSE_STRUCT.

Index: gcc/cp/ChangeLog

2011-04-27  Lawrence Crowl  <crowl@google.com>

	* decl.c: (push_local_name): Change TV_NAME_LOOKUP to start/stop.
	(poplevel): Refactor POP_TIMEVAR_AND_RETURN to plain code.
	Change TV_NAME_LOOKUP to start/stop.
	(define_label): Refactor timevar calls out to a wrapper function.
	Change TV_NAME_LOOKUP to start/stop.
	(xref_tag): Likewise.
	(lookup_label): Refactor timevar calls out to a wrapper function.
	Change TV_NAME_LOOKUP to start_cond/stop_cond.

        * pt.c: (instantiate_class_template): Add a wrapper to push/pop new
	TV_TEMPLATE_INST.
	(instantiate_template): Add a wrapper to push/pop new TV_TEMPLATE_INST.
	(lookup_template_class): Refactor timevar calls out to a wrapper
	function.  Change use of TV_NAME_LOOKUP to TV_TEMPLATE_INST.
	(instantiate_decl): Change TV_PARSE to TV_TEMPLATE_INST.

	* name-lookup.c: (store_bindings): Change TV_NAME_LOOKUP to start/stop.
	(poplevel_class): Change TV_NAME_LOOKUP to start_cond/stop_cond.
	(push_namespace): Likewise.
	(pop_nested_namespace): Likewise.
	(pushdecl_namespace_level): Likewise.
	(store_class_bindings): Likewise.
	(push_to_top_level): Likewise.
	(identifier_type_value): Refactor timevar calls out to a wrapper
	function.  Change TV_NAME_LOOKUP to start/stop.
	(find_binding): Likewise.
	(push_using_decl): Likewise.
	(lookup_arg_dependent): Likewise.
	(push_using_directive): Likewise.
	(qualified_lookup_using_namespace): Refactor POP_TIMEVAR_AND_RETURN
	to plain code.  Change TV_NAME_LOOKUP to start/stop.
	(lookup_type_current_level): Likewise.  Refactor inner return to
	break.
	(pushdecl_class_level): Refactor POP_TIMEVAR_AND_RETURN to plain
	code.  Change TV_NAME_LOOKUP to start_cond/stop_cond.
	(pushdecl_top_level_1): Likewise.
	(lookup_using_namespace): Likewise.
	(pushdecl_with_scope): Refactor timevar calls out to a wrapper
	function.  Change TV_NAME_LOOKUP to start_cond/stop_cond.
	(push_overloaded_decl): Likewise.
	(push_class_level_binding): Likewise.
	(namespace_binding): Likewise.
	(set_namespace_binding): Likewise.
	(supplement_binding): Likewise.
	(unqualified_namespace_lookup): Likewise.
	(lookup_name_real): Likewise.
	(lookup_type_scope): Likewise.
	(namespace_ancestor): Likewise.
	(lookup_name_innermost_nonclass_level): Likewise.
	(pushtag): Likewise.
	(pop_from_top_level): Likewise.
	(pushdecl_maybe_friend): Refactor timevar calls out to a wrapper
	function.  Change TV_NAME_LOOKUP to start_cond/stop_cond.  Wrap long
	lines.
	(add_using_namespace): Refactor timevar calls out to a wrapper
	function.  Change TV_NAME_LOOKUP to start_cond/stop_cond.  Bypass
	wrapper on call to self.

	* decl2.c: (cp_write_global_declarations):  Add start/stop of
	new TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_CHECK_DBGINFO.
	Remove push/pop calls to TV_VARCONST.

	* parser.c: Add include of "timevar.h".
	(cp_parser_explicit_instantiation): Add push/pop calls to
	TV_TEMPLATE_INST.
	(cp_parser_enum_specifier): Add push/pop calls to new TV_PARSE_ENUM.
	(cp_parser_class_specifier): Add wrapper to add push/pop calls to
	TV_PARSE_STRUCT.
	(cp_parser_function_definition_from_specifiers_and_declarator): Add
	push/pop calls to new TV_PARSE_FUNC or TV_PARSE_INLINE.
	(cp_parser_late_parsing_for_member):  Add push/pop calls to
	new TV_PARSE_INMETH.

	* call.c: Add include of "timevar.h".
        (convert_class_to_reference): Wrap and add push/pop calls to 
	TV_OVERLOAD.
	(build_op_call): Likewise.
	(build_conditional_expr): Likewise.
	(build_new_op): Likewise.
	(build_new_method_call): Likewise.
        (build_user_type_conversion): Reorganize to single return and add
	push/pop calls to TV_OVERLOAD.
        (perform_overload_resolution): Likewise.

	* Make-lang.in: Add dependence of call.o and parser.o on $(TIMEVAR_H).

From-SVN: r173277
2011-05-02 22:19:48 +00:00
Jason Merrill 574cfaa47d re PR c++/48530 ([C++0x][SFINAE] Hard errors with deleted d'tors)
PR c++/48530
	* decl.c (cxx_maybe_build_cleanup): Add complain parm.
	* tree.c (force_target_expr): Add complain parm.
	(build_target_expr_with_type): Likewise.
	(get_target_expr_sfinae): Split out.
	(build_vec_init_expr, bot_manip): Adjust.
	* init.c (build_vec_delete, build_vec_delete_1): Add complain parm.
	(build_delete, build_dtor_call): Likewise.
	(perform_direct_initialization_if_possible): Adjust.
	(build_vec_init): Handle error return.
	* cvt.c (force_rvalue): Add complain parm.
	Call build_special_member_call directly.
	* decl2.c (delete_sanity): Add complain parm.
	(build_cleanup): Adjust.
	* pt.c (tsubst_copy_and_build, tsubst_expr): Adjust.
	* semantics.c (finish_stmt_expr_expr): Adjust.
	(finish_compound_literal): Adjust.
	* parser.c (cp_parser_delete_expression): Adjust.
	* typeck2.c (build_functional_cast): Adjust.
	* cp-tree.h: Adjust.

From-SVN: r172985
2011-04-26 15:28:25 -04:00
Jason Merrill 8adaafcf03 re PR c++/48594 (Rejects valid with pointer-to-member in template)
PR c++/48594
	* decl2.c (build_offset_ref_call_from_tree): Move
	non-dependency of object outside condition.

From-SVN: r172807
2011-04-21 00:28:06 -04:00
Jason Merrill 516d9427ed re PR c++/48594 (Rejects valid with pointer-to-member in template)
PR c++/48594
	* decl2.c (build_offset_ref_call_from_tree): Fix calling a functor
	or pointer to (non-member) function.

From-SVN: r172394
2011-04-13 16:50:26 -04:00
Martin Jambor 0fa1f9b762 class.c (cp_fold_obj_type_ref): Call cgraph_get_node instead of cgraph_get_create_node.
2011-04-12  Martin Jambor  <mjambor@suse.cz>

gcc/cp/
	* class.c (cp_fold_obj_type_ref): Call cgraph_get_node instead of
	cgraph_get_create_node.
	* decl2.c (cp_write_global_declarations): Call cgraph_get_node
	instead of cgraph_get_create_node.
	* method.c (make_alias_for_thunk): Call cgraph_get_node
	instead of cgraph_get_create_node, assert it returns non-NULL.
	(use_thunk): Likewise.
	* optimize.c (maybe_clone_body): Call cgraph_same_body_alias only
	when flag_syntax_only is not set.  Call cgraph_get_node instead of
	cgraph_get_create_node.
	(maybe_clone_body): Call cgraph_get_node instead of
	cgraph_get_create_node.

From-SVN: r172308
2011-04-12 12:02:31 +02:00
Martin Jambor a358e18845 cgraph.h (cgraph_node): Remove function declaration.
2011-04-12  Martin Jambor  <mjambor@suse.cz>

	* cgraph.h (cgraph_node): Remove function declaration.
	(cgraph_create_node): Declare.
	(cgraph_get_create_node): Likewise.
	* cgraph.c (cgraph_create_node): Renamed to cgraph_create_node_1.
	Updated all callers.
	(cgraph_node): Renamed to cgraph_create_node, assert that a node for
	the decl does not already exist.  Call cgraph_get_create_node instead
	of cgraph_node.
	(cgraph_get_create_node): New function.
	(cgraph_same_body_alias): Update comment.
	(cgraph_set_call_stmt): Call cgraph_get_node instead of cgraph_node,
	assert it does not return NULL.
	(cgraph_update_edges_for_call_stmt): Likewise.
	(cgraph_clone_edge): Likewise.
	(cgraph_create_virtual_clone): Likewise.
	(cgraph_update_edges_for_call_stmt_node): Call cgraph_get_create_node
	instead of cgraph_node.
	(cgraph_add_new_function): Call cgraph_create_node or
	cgraph_get_create_node instead of cgraph_node.
	* cgraphbuild.c (record_reference): Call cgraph_get_create_node
	instead of cgraph_node.
	(record_eh_tables): Likewise.
	(mark_address): Likewise.
	(mark_load): Likewise.
	(build_cgraph_edges): Call cgraph_get_create_node instead
	of cgraph_node.
	(rebuild_cgraph_edges): Likewise.
	* cgraphunit.c (cgraph_finalize_function): Call cgraph_get_create_node
	instead of cgraph_node.
	(cgraph_copy_node_for_versioning): Call cgraph_create_node instead of
	cgraph_node.
	* lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Call
	cgraph_create_node instead of cgraph_node.
	* c-decl.c (finish_function): Call cgraph_get_create_node instead
	of cgraph_node.
	* lto-cgraph.c (input_node): Likewise.
	* lto-streamer-in.c (input_function): Likewise.
	* varasm.c (mark_decl_referenced): Likewise.
	(assemble_alias): Likewise.

gcc/c-family/
	* c-gimplify.c (c_genericize): Call cgraph_get_create_node instead
	of cgraph_node.

gcc/cp/
	* cp/class.c (cp_fold_obj_type_ref): Call cgraph_get_create_node
	instead of cgraph_node.
	* cp/decl2.c (cxx_callgraph_analyze_expr): Likewise.
	(cp_write_global_declarations): Likewise.
	* cp/optimize.c (maybe_clone_body): Likewise.
	* cp/semantics.c (maybe_add_lambda_conv_op): Likewise.
	* cp/mangle.c (mangle_decl): Likewise.
	* cp/method.c (make_alias_for_thunk): Likewise.
	(use_thunk): Likewise.

gcc/ada/
	* gcc-interface/utils.c (end_subprog_body): Call
	cgraph_get_create_node instead of cgraph_node.

gcc/fortran/
	* trans-decl.c (gfc_generate_function_code): Call
	cgraph_get_create_node instead of cgraph_node.

gcc/objc/
	* objc-act.c (mark_referenced_methods): Call cgraph_get_create_node
	instead of cgraph_node.

From-SVN: r172307
2011-04-12 11:27:18 +02:00
Rodrigo Rivas Costa 437697b8ee decl2.c (cp_check_const_attributes): New.
* decl2.c (cp_check_const_attributes): New.
	(cplus_decl_attributes): Call cp_check_const_attributes.

From-SVN: r171010
2011-03-15 14:27:19 -04:00
Jason Merrill faa9e9bfca re PR c++/46282 ([C++0x] ICE: SIGSEGV in grokbitfield (decl2.c:1054))
PR c++/46282
	* decl2.c (grokbitfield): Handle type-dependent width.

From-SVN: r170600
2011-03-01 17:44:26 -05:00
Jason Merrill 9931a2bf8c re PR c++/47207 ([C++0x] ICE: in decl_constant_var_p, at cp/decl2.c:3563 on invalid code)
PR c++/47207
	* decl2.c (decl_constant_var_p): A constexpr var needs an
	initializer to be constant.
	* semantics.c (cxx_eval_constant_expression): Complain about
	constexpr var used in its own initializer.
	* call.c (set_up_extended_ref_temp): Set
	DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P too.

From-SVN: r170365
2011-02-21 10:35:44 -05:00
Dave Korn 47ea1edfbc c.opt (-fkeep-inline-dllexport): New switch.
gcc/c-family/ChangeLog:

	* c.opt (-fkeep-inline-dllexport): New switch.

gcc/ChangeLog:

	* tree.c (handle_dll_attribute): Handle it.
	* doc/extend.texi (@item dllexport): Mention it.
	* doc/invoke.texi (@item -fno-keep-inline-dllexport): Document it.

gcc/cp/ChangeLog:

	* semantics.c (expand_or_defer_fn_1): Handle it.
	* decl2.c (decl_needed_p): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.dg/dll-9a.c: New test file.
	* gcc.dg/dll-11.c: Likewise.
	* gcc.dg/dll-12.c: Likewise.
	* gcc.dg/dll-12a.c: Likewise.
	* gcc.dg/dll-11a.c: Likewise.
	* gcc.dg/dll-9.c: Likewise.
	* gcc.dg/dll-10.c: Likewise.
	* gcc.dg/dll-10a.c: Likewise.
	* g++.dg/ext/dllexport4a.cc: Likewise.
	* g++.dg/ext/dllexport4.C: Likewise.
	* g++.dg/ext/dllexport5.C: Likewise.
	* g++.dg/ext/dllexport5a.cc: Likewise.

From-SVN: r169268
2011-01-26 01:41:23 +00:00
Jakub Jelinek cfea9968d1 re PR c++/47303 (ICE: in varpool_node, at varpool.c:134 with -fabi-version=1)
PR c++/47303
	* decl2.c (finish_anon_union): Only call mangle_decl if TREE_STATIC
	or DECL_EXTERNAL.

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

From-SVN: r169000
2011-01-19 16:36:57 +01:00
Kai Tietz a2b63a2001 re PR c++/47213 (ICE: SIGSEGV in determine_visibility (decl2.c:2076) with -fvisibility-ms-compat)
2011-01-13  Kai Tietz  <kai.tietz@onevision.com>

	PR c++/47213
	* g++.dg/ext/pr47213.C: New.

2011-01-13  Kai Tietz  <kai.tietz@onevision.com>

	PR c++/47213
	* cp-tree.h (CLASSTYPE_VISIBILITY): Use
	TYPE_MAIN_DECL instead of TYPE_NAME.
	(CLASSTYPE_VISIBILITY_SPECIFIED): Likewise.
	* decl2.c (determine_visibility): Add check
	of CLASS_TYPE_P for underlying_type.

2011-01-13  Kai Tietz  <kai.tietz@onevision.com>

	PR c++/47213
	* config/i386/cygming.h (TARGET_ASM_ASSEMBLE_VISIBILITY):
	PE specific hook.
	* config/i386/i386-protos.h (i386_pe_assemble_visibility):
	New function prototype.
	* config/i386/winnt.c (i386_pe_assemble_visibility):
	Warn only if attribute was specified by user.

From-SVN: r168763
2011-01-13 21:01:57 +01:00
Jan Hubicka 3a9ed12a58 This time really commit PR middle-end/45388
This time really commit
	PR middle-end/45388
	* decl2.c (start_objects): Do not generate collect2 recognicable name
	for static ctor.
	* ipa.c (cgraph_build_static_cdtor_1): Break out from ... ; add FINAL parameter.
	(cgraph_build_static_cdtor): ... here.
	(build_cdtor): Use cgraph_build_static_cdtor_1.

From-SVN: r167781
2010-12-14 01:26:47 +00:00
Nicola Pero 61d3ce2026 In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/:
2010-12-06  Nicola Pero  <nicola.pero@meta-innovation.com>

	* c-family/c-common.h: Removed the declarations of all the objc_
	callbacks, and moved them into c-objc.h.  Removed
	objc_ivar_visibility_kind and moved it into c-objc.h.
	* c-family/c-objc.h: New file.
	* c-family/c-common.c: Include c-objc.h.
	* c-family/c-format.c: Same change.
	* c-family/stub-objc.c: Same change.
	* c-decl.c: Include c-family/c-objc.h.
	* c-parser.c: Same change.	
	* c-typeck.c: Same change.
	* c-config-lang.in (gtfiles): Added c-family/c-objc.h.
	* Makefile.in (c-decl.o): Depend on c-family/c-objc.h.
	(c-parser.o): same change.
	(c-typeck.o): Same change.
	(c-family/c-format.o): Same change.
	(c-family/stub-objc.o): Same change.
	(c-family/c-common.o): Same change.
	(PLUGIN_HEADERS): Added c-family/c-objc.h.
	
In gcc/cp/:
2010-12-06  Nicola Pero  <nicola.pero@meta-innovation.com>

	* call.c: Include c-family/c-objc.h.
	* decl.c: Same change.
	* decl2.c: Same change.
	* error.c: Same change.
	* lex.c: Same change.
	* parser.c: Same change.
	* pt.c: Same change.
	* semantics.c: Same change.
	* typeck.c: Same change.
	* Make-lang.in (cp/decl.o): Depend on c-family/c-objc.h.
	(cp/decl2.o): Same change.
	(cp/call.o): Same change.
	(cp/error.o): Same change.
	(cp/lex.o): Same change.
	(cp/parser.o): Same change.
	(cp/pt.o): Same change.
	(cp/semantics.o): Same change.
	(cp/typeck.o): Same change.
	* config-lang.in (gtfiles): Added c-family/c-objc.h.
	
In gcc/objc/:
2010-12-06  Nicola Pero  <nicola.pero@meta-innovation.com>

	* objc-act.c: Include c-family/c-objc.h.
	* objc-lang.c: Same change.
	* Make-lang.in (objc/objc-act.o): Depend on
	c-family/c-objc.h.
	(objc/objc-lang.o): Same change.
	* config-lang.in (gtfiles): Added c-family/c-objc.h.
	
In gcc/objcp/:
2010-12-06  Nicola Pero  <nicola.pero@meta-innovation.com>

	* config-lang.in (gtfiles): Added c-family/c-objc.h.
	* Make-lang.in (objcp/objcp-act.o): Depend on
	c-family/c-objc.h.
	(objcp/objcp-lang.o): Same change.
	(objcp/objcp-decl.o): Same change.
	* objcp-lang.c: Include c-family/c-objc.h.
	* objcp-decl.c: Same change.

From-SVN: r167481
2010-12-06 00:56:06 +00:00
Joseph Myers d8a07487de cfgloop.c (verify_loop_structure): Use %' in diagnostics.
* cfgloop.c (verify_loop_structure): Use %' in diagnostics.  Start
	diagnostics with lowercase letters.
	* cgraphunit.c (verify_cgraph_node): Start diagnostics with
	lowercase letters.
	* collect2.c (maybe_run_lto_and_relink): Remove trailing '.' from
	diagnostic.
	* config/alpha/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic.
	* config/arm/arm.c (arm_get_pcs_model): Start diagnostics with
	lowercase letters.
	* config/arm/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic.
	Remove trailing ' ' from diagnostic.
	* config/avr/avr.c (print_operand_address): Start diagnostic with
	a lowercase letter and remove trailing '.'.
	* config/avr/avr.opt (mpmem-wrap-around): Fix typo in help text.
	* config/bfin/bfin.c (bfin_option_override): Start diagnostics
	with lowercase letters.  Use %' in diagnostics.  Remove trailing
	'.' from diagnostics.
	(bfin_handle_longcall_attribute): Use %' in diagnostic.
	* config/cris/cris.c (cris_split_movdx,
	cris_expand_pic_call_address): Start diagnostics with lowercase
	letters.
	(cris_asm_output_label_ref): Use %' in diagnostic.
	* config/cris/cris.h (ASM_SPEC): Start diagnostic with a lowercase
	letter.
	* config/crx/crx.h (FUNCTION_PROFILER): Start diagnostic with a
	lowercase letter.
	* config/darwin-c.c (version_as_macro): Start diagnostic with a
	lowercase letter.
	* config/darwin-driver.c (darwin_default_min_version): Use %' in
	diagnostic.
	* config/host-darwin.c (darwin_gt_pch_use_address): Use %' in
	diagnostic.
	* config/i386/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic.
	* config/i386/host-cygwin.c (cygwin_gt_pch_get_address): Use %' in
	diagnostics.
	* config/i386/i386.c (ix86_option_override_internal): Write
	diagnostic as a single sentence without trailing '.'.  Use %' in
	diagnostics.
	(ix86_function_sseregparm, classify_argument): Start diagnostics
	with lowercase letters.
	(ix86_expand_prologue): Use %' in diagnostic.
	* config/i386/i386.h (CC1_CPU_SPEC_1): Remove trailing '.' from
	diagnostic.
	* config/i386/nwld.h (LINK_SPEC): Start diagnostic with a
	lowercase letter.
	* config/i386/winnt.c (i386_pe_determine_dllimport_p): Use %' in
	diagnostic.
	* config/ia64/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic.
	* config/ia64/ia64.opt (msched-max-memory-insns-hard-limit): Avoid
	'`' in help text.
	* config/lm32/lm32.c (lm32_print_operand): Start diagnostic with a
	lowercase letter.
	* config/mep/mep.c (mep_validate_vliw): Start diagnostics with
	lowercase letters.
	* config/microblaze/microblaze.c (microblaze_handle_option):
	Remove trailing '.' from diagnostic.
	(print_operand): Start diagnostic with a lowercase letter.
	* config/pa/pa-hpux10.h (LINK_SPEC): Start diagnostics with
	lowercase letters.  Avoid '`' in diagnostics.
	* config/pa/pa-hpux11.h (LINK_SPEC): Start diagnostics with
	lowercase letters.  Avoid '`' in diagnostics.
	* config/pa/pa64-hpux.h (LINK_SPEC): Start diagnostics with
	lowercase letters.  Avoid '`' in diagnostics.
	* config/picochip/picochip.c (picochip_option_override,
	picochip_emit_save_register, picochip_function_arg,
	picochip_output_label, picochip_output_internal_label,
	picochip_asm_output_opcode, picochip_output_cbranch,
	picochip_output_compare, picochip_output_branch,
	picochip_get_vliw_alu_id): Remove trailing '.' and '\n' from
	diagnostics. Start diagnostics with lowercase letters.  Use %' in
	diagnostics.
	* config/rs6000/rs6000.c (rs6000_option_override_internal): Use
	"SPE" capitalization.  Start diagnostic with a lowercase letter.
	(rs6000_handle_option): Start diagnostics with lowercase letters.
	(def_builtin): Remove trailing '.' from diagnostic.
	(rs6000_savres_routine_name): Start diagnostic with a lowercase
	letter.
	* config/rs6000/sysv4.h (LINK_OS_FREEBSD_SPEC): Avoid '`' in
	diagnostic.
	* config/rx/rx.c (rx_handle_option): Start diagnostic with a
	lowercase letter.
	* config/s390/s390.c (s390_option_override) Start diagnostics with
	lowercase letters.  Use %' in diagnostic.
	* config/sh/sh.c (sh_output_mi_thunk): Start diagnostics with
	lowercase letters.
	* config/sh/symbian-base.c (sh_symbian_mark_dllimport): Use %' in
	diagnostic.
	* config/sh/symbian-c.c (sh_symbian_is_dllimported): Use %' in
	diagnostic.
	* config/sh/symbian-cxx.c (sh_symbian_is_dllimported): Use %' in
	diagnostic.
	* config/sparc/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic.
	* config/spu/spu.c (spu_option_override): Start diagnostics with
	lowercase letters.  Use %qs for quoting in diagnostics.
	(spu_check_builtin_parm): Remove trailing '.' from diagnostics.
	Use %wd instead of HOST_WIDE_INT_PRINT_DEC in diagnostic .
	* config/v850/v850.c (construct_save_jarl): Remove trailing '\n'
	from diagnostic.
	* convert.c (convert_to_integer, convert_to_vector): Use %' in
	diagnostics.
	* dbgcnt.c (dbg_cnt_process_opt): Start diagnostic with lowercase
	letter and use "cannot" spelling.
	* expmed.c (extract_fixed_bit_field): Start diagnostic with
	lowercase letter and format as a single sentence without '.'.
	* ggc-common.c (write_pch_globals, gt_pch_save, gt_pch_restore):
	Use %' in diagnostics.
	* ggc-page.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read):
	Use %' in diagnostics.
	* ggc-zone.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read):
	Use %' in diagnostics.
	* graph.c (clean_graph_dump_file): Use %' in diagnostic.
	* graphite-poly.c (graphite_read_scop_file): Start diagnostics
	with lowercase letters and remove tailing '.' and '\n'.
	* lto-cgraph.c (input_profile_summary): Start diagnostic with
	lowercase letter and remove trailing '.'.
	(input_cgraph): Start diagnostics with lowercase letters and
	remove trailing '\n'.
	* opts.c (finish_options, common_handle_option): Start diagnostics
	with lowercase letters and remove trailing '.'.  Fix typo in
	diagnostic.
	* passes.c (position_pass): Start diagnostic with lowercase
	letter.	
	* plugin.c (add_new_plugin, parse_plugin_arg_opt,
	register_callback, try_init_one_plugin): Start diagnostics with
	lowercase letters.
	* reload1.c (spill_failure): Use %' in diagnostic.
	(gen_reload): Start diagnostic with a lowercase letter.
	* stor-layout.c (place_field): Start diagnostic with a lowercase
	letter.
	* toplev.c (open_auxiliary_file): Use %' in diagnostic.
	* tree-cfg.c (verify_expr, verify_types_in_gimple_reference,
	verify_gimple_call, verify_gimple_phi, verify_eh_throw_stmt_node):
	Start diagnostics with lowercase letters, remove trailing '.' and
	use %' in diagnostics.
	* tree-ssa.c (verify_def): Remove trailing '.' from diagnostic.
	(verify_ssa): Don't split diagnostic across two error calls.
	Spell out "number" and use %' in diagnostic.
	* value-prof.c (visit_hist, check_counter): Start diagnostics with
	lowercase letters.

c-family:
	* c-common.c (handle_mode_attribute): Use %' and word "signedness"
	in diagnostic.
	* c-opts.c (c_common_parse_file): Start diagnostics with lowercase
	letter.
	* c-pragma.c (handle_pragma_target, handle_pragma_optimize):
	Remove trailing '.' from diagnostics.
	* c.opt (Wwrite-strings_: Avoid '`' in help text.

cp:
	* cvt.c (cp_convert_to_pointer): Use %' in diagnostic.
	* decl.c (layout_var_decl, maybe_commonize_var, grokdeclarator):
	Use %' in diagnostics.
	* decl2.c (check_classfn): Use %' in diagnostic.
	* init.c (build_java_class_ref): Use %' in diagnostic.
	(build_delete): Remove trailing '.' from diagnostic.
	* method.c (do_build_copy_assign, walk_field_subobs): Use %' in
	diagnostics.
	* name-lookup.c (pushdecl_maybe_friend): Use %' in diagnostic.
	* parser.c (cp_parser_exception_specification_opt): Remove
	trailing '.' from diagnostic.
	(cp_parser_objc_interstitial_code): Use %qs for quoting in
	diagnostic.
	* pt.c (check_valid_ptrmem_cst_expr): Use %< and %> for quoting in
	diagnostic.
	* repo.c (reopen_repo_file_for_write): Use %' in diagnostic.

fortran:
	* trans-array.c (gfc_trans_deferred_array): Use "front-end"
	spelling in diagnostic.
	* trans.c (gfc_allocate_array_with_status): Add missing space in
	diagnostic.

java:
	* expr.c (expand_java_field_op): Use %' in diagnostic.
	* jcf-parse.c (java_parse_file): Use %' in diagnostics.
	* jvspec.c (lang_specific_driver): Use %' in diagnostic.
	* lang.c (java_post_options): Use %' in diagnostics.

lto:
	* lto.c (lto_resolution_read): Start diagnostics with lowercase
	letters and remove trailing '.'.
	(lto_file_finalize): Start diagnostic with a lowercase letter.

objc:
	* objc-act.c (objc_init): Use %' in diagnostic.
	(objc_set_method_opt): Remove trailing '.' from diagnostic.

From-SVN: r166570
2010-11-10 23:23:15 +00:00
Jason Merrill 9e115cec97 Correct conversion/overflow behavior.
* cvt.c (ignore_overflows): Move here from typeck.c.
	(ocp_convert): Use it.
	(cp_fold_convert): Use it.  Don't call rvalue.
	* typeck.c (build_static_cast_1): Don't use it.  Do call rvalue.
	* error.c (location_of): Handle expressions, too.
	* class.c (check_bitfield_decl): Set input_location around call to
	cxx_constant_value.
	* semantics.c (cxx_eval_outermost_constant_expr): Don't
	print the expression if it already had TREE_OVERFLOW set.
	(reduced_constant_expression_p): Check TREE_OVERFLOW_P for C++98, too.
	(verify_constant): Allow overflow with a permerror if we're
	enforcing.
	(cxx_eval_outermost_constant_expr): Use verify_constant.
	(adjust_temp_type): Use cp_fold_convert.
	* decl.c (build_enumerator): Don't call constant_expression_warning.
	* decl2.c (grokbitfield): Likewise.

From-SVN: r166453
2010-11-08 15:17:42 -05:00
Dodji Seketeli 6f1abb06a6 Restore canonical type comparison for dependent type(def)s
This patch restores canonical type comparison for dependent types and
then dependent typedefs. After this patch, two template type
parameters T are equal if they have the same index, level, *and*
number of sibling parameters. The novelty is to take in account the
number of sibling parameters.

To do this we first build the template parameters w/o taking in
account their number of siblings. When we know the number of template
parameters we fix up each template parameter with the number of
slibling parameters and we build the appropriate canonical types
accordingly. The patch fixes the fallouts deemed necessary.

This fixes PR c++/45606 but actually fixes all the previous bugs
related to dependent typedef comparison we had since we started to
properly representing dependent typedefs.

gcc/cp/ChangeLog:
	PR c++/45606
	* cp-tree.h (TEMPLATE_TYPE_PARM_SIBLING_PARMS): Remove.
	(struct template_parm_index_s)<num_siblings>: New field.
	(TEMPLATE_PARM_NUM_SIBLINGS): New accessor.
	(process_template_parm): Extend the API to accept the number of
	template parms in argument.
	(cp_set_underlying_type): Remove this.
	* class.c (build_self_reference): Require canonical type equality
	back on the self reference of class.
	* decl2.c (grokfield): Require canonical type equality back on
	typedef class fields.
	* name-lookup.c (pushdecl_maybe_friend): Require canonical type
	equality back on typedefs.
	* parser.c (cp_parser_template_parameter_list): Do not require
	canonical type equality on dependent types created during
	template parameters parsing.
	* pt.c (fixup_template_type_parm_type, fixup_template_parm_index)
	(fixup_template_parm, fixup_template_parms): New private
	functions.
	(current_template_args): Declare this.
	(process_template_parm): Pass the total number of template parms
	to canonical_type_parameter.
	(build_template_parm_index): Add a new argument to carry the total
	number of template parms.
	(reduce_template_parm_level, process_template_parm, make_auto): Adjust.
	(current_template_args): Fix this for template template
	parameters.
	(tsubst_template_parm): Split out of ...
	(tsubst_template_parms): ... this.
	(reduce_template_parm_level): Don't loose
	TEMPLATE_PARM_NUM_SIBLINGS when cloning a TEMPLATE_PARM_INDEX.
	(template_parm_to_arg): Extracted this function from
	current_template_args. Make it represent invalid template parms
	with an error_mark_node instead of a LIST_TREE containing an
	error_mark_node.
	(current_template_args): Use template_parm_to_arg.
	(dependent_template_arg_p): Consider an invalid template argument
	as dependent.
	(end_template_parm_list): Do not update template sibling parms
	here anymore. Use fixup_template_parms instead.
	(process_template_parm): Pass the number of template parms to
	canonical_type_parameter.
	(make_auto): Require structural equality on auto
	TEMPLATE_TYPE_PARM for now.
	(unify)<BOUND_TEMPLATE_TEMPLATE_PARM>: Coerce template parameters
	using all the arguments deduced so far.
	(tsubst)<TEMPLATE_TYPE_PARM>: Pass the number of sibling parms to
	canonical_type_parameter.
	* tree.c (cp_set_underlying_type): Remove.
	* typeck.c (get_template_parms_of_dependent_type)
	(incompatible_dependent_types_p): Remove.
	(structural_comptypes): Do not call incompatible_dependent_types_p
	anymore.
	(comp_template_parms_position): Re-organized. Take the length of
	template parms list in account.

gcc/testsuite/ChangeLog:
	PR c++/45606
	* g++.dg/template/typedef36.C: New test.
	* gcc/testsuite/g++.dg/template/canon-type-9.C: Likewise.
	* g++.dg/template/canon-type-10.C: Likewise.
	* g++.dg/template/canon-type-11.C: Likewise.
	* g++.dg/template/canon-type-12.C: Likewise.
	* g++.dg/template/canon-type-13.C: Likewise.

From-SVN: r166179
2010-11-02 13:44:19 +01:00
Jason Merrill fa2200cbb1 call.c (null_ptr_cst_p): Use maybe_constant_value.
* call.c (null_ptr_cst_p): Use maybe_constant_value.
	(set_up_extended_ref_temp): Support constant initialization.
	(initialize_reference): Adjust.
	* class.c (check_bitfield_decl): Use cxx_constant_value.
	* cvt.c (ocp_convert): Don't use integral_constant_value when
	converting to class type.
	* decl.c (finish_case_label): Use maybe_constant_value.
	(build_init_list_var_init): Support constant initialization.
	(check_initializer): Likewise.  Reorganize.
	(cp_finish_decl): Likewise.
	(expand_static_init): Likewise.
	(compute_array_index_type): Use maybe_constant_value.
	Add complain parm.
	(create_array_type_for_decl, grokdeclarator): Pass it.
	(build_enumerator): Use cxx_constant_value.
	* decl2.c (grokfield): Use maybe_constant_init.
	* except.c (check_noexcept_r): Handle constexpr.
	(build_noexcept_spec): Use maybe_constant_value.
	* init.c (expand_default_init): Support constant initialization.
	(build_vec_init): Likewise.
	(constant_value_1): Adjust.
	(build_new_1): Adjust.
	* parser.c (cp_parser_constant_expression): Allow non-integral
	in C++0x mode.
	(cp_parser_direct_declarator): Don't fold yet in C++0x mode.
	(cp_parser_initializer_clause): Toss folded result if non-constant.
	* pt.c (fold_decl_constant_value): Remove.
	(convert_nontype_argument): Use maybe_constant_value.  Give clearer
	error about overflow.
	(tsubst): Move array bounds handling into compute_array_index_type.
	(value_dependent_expression_p): Handle constant CALL_EXPR.
	* semantics.c (finish_static_assert): Use maybe_constant_value.
	(ensure_literal_type_for_constexpr_object): Make sure type is complete.
	(potential_constant_expression): Use maybe_constant_value.
	* tree.c (cast_valid_in_integral_constant_expression_p): Any cast
	is potentially valid in C++0x.
	* typeck2.c (store_init_value): Handle constant init.
	(check_narrowing): Use maybe_constant_value.
	(build_functional_cast): Set TREE_CONSTANT on literal T().
	* cp-tree.h (DECL_INTEGRAL_CONSTANT_VAR_P): Remove.
	(LOOKUP_ALREADY_DIGESTED): New.
	(compute_array_index_type): Adjust prototype.

From-SVN: r166167
2010-11-01 21:31:18 -04:00
Jason Merrill aef4a21519 decl2.c (decl_constant_var_p): New fn.
* decl2.c (decl_constant_var_p): New fn.
	(decl_maybe_constant_var_p): New fn.
	(mark_used): Rework instantiation of things needed for constant
	expressions.
	* cp-tree.h: Declare new fns.
	* pt.c (instantiate_decl): Handle cp_unevaluated_operand.
	(always_instantiate_p): Use decl_maybe_constant_var_p.
	(instantiate_decl): Don't defer constexpr functions.
	* repo.c (repo_emit_p): Use decl_maybe_constant_var_p.
	* semantics.c (finish_id_expression): Use decl_constant_var_p.
	Check for valid name in constant expr after mark_used.

From-SVN: r166164
2010-11-01 21:30:39 -04:00
Gabriel Dos Reis 91ea6df357 parser.c (cp_parser_ctor_initializer_opt_and_function_body): Make sure a constexpr ctor has an empty body.
* parser.c (cp_parser_ctor_initializer_opt_and_function_body):
	Make sure a constexpr ctor has an empty body.
	* class.c (type_has_constexpr_default_constructor): New.
	* cp-tree.h: Declare it.
	* init.c (perform_member_init): Complain about uninitialized
	member in constexpr ctor.
	(emit_mem_initializers): And uninitialized base.
	* decl.c (check_tag_decl): Fix typo.

	* semantics.c (valid_type_in_constexpr_fundecl_p): New fn.
	(is_valid_constexpr_fn): New fn.
	(validate_constexpr_fundecl): Use it.
	* decl.c (validate_constexpr_redeclaration): New.
	(duplicate_decls): Use it.
	(cp_finish_decl): Call validate_constexpr_fundecl and
	ensure_literal_type_for_constexpr_object here.
	(start_decl): Not here.  Don't ICE on constexpr reference.
	(check_for_uninitialized_const_var): Don't handle constexpr specially.
	(grokfndecl): Set DECL_DECLARED_CONSTEXPR_P.
	(check_static_variable_definition): Give friendly message about
	missing constexpr.
	(grokdeclarator): Complain about typedef and volatile with constexpr.
	Reorganize.  Give sorry about non-static data members in C++0x mode.
	(start_preparsed_function): Check validate_constexpr_fundecl here.
	(check_function_type): Not here.
	* decl2.c (finish_static_data_member_decl): Don't complain about
	in-class init.
	* parser.c (CP_PARSER_FLAGS_ONLY_TYPE_OR_CONSTEXPR): New.
	(cp_parser_condition): Pass it to cp_parser_decl_specifier_seq.
	(cp_parser_decl_specifier_seq): Handle it.
	(cp_parser_explicit_instantiation): Diagnose inline and constexpr.

Co-Authored-By: Jason Merrill <jason@redhat.com>

From-SVN: r166013
2010-10-27 15:31:33 -04:00
Nicola Pero 977e30bc45 In gcc/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/:
2010-10-20  Nicola Pero  <nicola.pero@meta-innovation.com>

        * c-decl.c (c_write_global_declarations): Call
        objc_write_global_declarations when compiling Objective-C.
        * c-lang.c (finish_file): Removed.

In gcc/c-family/:
2010-10-20  Nicola Pero  <nicola.pero@meta-innovation.com>

        * c-common.h (finish_file): Removed.
        (objc_write_global_declarations): New.
        * c-opts.c (c_common_parse_file): Do not call finish_file.
        * stub-objc.c (objc_write_global_declarations): New.

In gcc/cp/:
2010-10-20  Nicola Pero  <nicola.pero@meta-innovation.com>

        * cp-lang.c (finish_file): Removed.
        * decl2.c (cp_write_global_declarations): Call
        objc_write_global_declarations when compiling Objective-C++.

In gcc/objc/:
2010-10-20  Nicola Pero  <nicola.pero@meta-innovation.com>

        * objc-lang.c (finish_file): Removed.
        * objc-act.c (objc_finish_file): Renamed to
        objc_write_global_declarations.  Do not try to instantiate C++
        templates when compiling Objective-C++ as this is now
        automatically done before this function is called.  Do not check
        for syntax-only run or PCH generation as this is done by the
        callers.
        * objc-act.h (objc_finish_file): Removed.

In gcc/objcp/:
2010-10-20  Nicola Pero  <nicola.pero@meta-innovation.com>

        * objcp-lang.c (finish_file): Removed.

In gcc/testsuite/:
2010-10-20  Nicola Pero  <nicola.pero@meta-innovation.com>

        Merge from 'apple/trunk' branch on FSF servers.  Test adapted to
        not require Foundation and run with the GNU runtime as well.

        2006-03-13  Fariborz Jahanian <fjahanian@apple.com>

        Radar 4439126
        * obj-c++.dg/template-8.mm: New.

From-SVN: r165714
2010-10-20 09:08:57 +00:00
Jason Merrill 93c0e0bb1d Require lvalues as specified by the standard.
* typeck.c (lvalue_or_else): Use real_lvalue_p.
	(cp_build_addr_expr_1): Split out of cp_build_unary_op.
	(cp_build_addr_expr, cp_build_addr_expr_strict): Interfaces.
	(decay_conversion, get_member_function_from_ptrfunc): Adjust.
	(build_x_unary_op, build_reinterpret_cast_1): Adjust.
	(build_const_cast_1): Adjust.
	* cp-tree.h: Declare new fns.
	* call.c (build_this, convert_like_real, build_over_call): Adjust.
	(initialize_reference): Adjust.
	* class.c (build_base_path, convert_to_base_statically): Adjust.
	(build_vfn_ref, resolve_address_of_overloaded_function): Adjust.
	* cvt.c (build_up_reference, convert_to_reference): Adjust.
	* decl.c (register_dtor_fn): Adjust.
	* decl2.c (build_offset_ref_call_from_tree): Adjust.
	* except.c (initialize_handler_parm): Adjust.
	* init.c (build_offset_ref, build_delete, build_vec_delete): Adjust.
	* rtti.c (build_dynamic_cast_1, tinfo_base_init): Adjust.
	* tree.c (stabilize_expr): Adjust.

From-SVN: r164666
2010-09-27 16:05:34 -04:00
Jason Merrill 441b624e3d * decl2.c (grokbitfield): Diagnose non-integral width.
From-SVN: r164321
2010-09-15 19:55:43 -04:00
Nathan Froyd ac47786e99 vec.h (FOR_EACH_VEC_ELT): Define.
gcc/
	* vec.h (FOR_EACH_VEC_ELT): Define.
	* c-decl.c: Use it.
	* cfgloop.c: Likewise.
	* cfgloopmanip.c: Likewise.
	* cgraph.c: Likewise.
	* cgraphunit.c: Likewise.
	* combine.c: Likewise.
	* config/bfin/bfin.c: Likewise.
	* config/mips/mips.c: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* dbxout.c: Likewise.
	* df-scan.c: Likewise.
	* dominance.c: Likewise.
	* dse.c: Likewise.
	* dwarf2out.c: Likewise.
	* except.c: Likewise.
	* expr.c: Likewise.
	* function.c: Likewise.
	* gcse.c: Likewise.
	* genattr.c: Likewise.
	* ggc-common.c: Likewise.
	* gimplify.c: Likewise.
	* graphite-blocking.c: Likewise.
	* graphite-clast-to-gimple.c: Likewise.
	* graphite-dependences.c: Likewise.
	* graphite-interchange.c: Likewise.
	* graphite-poly.c: Likewise.
	* graphite-scop-detection.c: Likewise.
	* graphite-sese-to-poly.c: Likewise.
	* graphite.c: Likewise.
	* haifa-sched.c: Likewise.
	* ifcvt.c: Likewise.
	* implicit-zee.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa.c: Likewise.
	* ira-build.c: Likewise.
	* ira-color.c: Likewise.
	* ira-emit.c: Likewise.
	* lambda-code.c: Likewise.
	* loop-invariant.c: Likewise.
	* loop-unroll.c: Likewise.
	* lower-subreg.c: Likewise.
	* lto-cgraph.c: Likewise.
	* lto-opts.c: Likewise.
	* lto-streamer-in.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* lto-streamer.c: Likewise.
	* lto-symtab.c: Likewise.
	* matrix-reorg.c: Likewise.
	* opts.c: Likewise.
	* predict.c: Likewise.
	* print-tree.c: Likewise.
	* sdbout.c: Likewise.
	* sel-sched-dump.c: Likewise.
	* sel-sched-ir.c: Likewise.
	* sel-sched.c: Likewise.
	* sese.c: Likewise.
	* stor-layout.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-chrec.c: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-emutls.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-loop-linear.c: Likewise.
	* tree-mudflap.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-predcom.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-scalar-evolution.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-ssa-pre.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-ssa.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-loop-manip.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-slp.c: Likewise.
	* tree-vect-stmts.c: Likewise.
	* tree-vrp.c: Likewise.
	* tree.c: Likewise.
	* value-prof.c: Likewise.
	* var-tracking.c: Likewise.
	* varasm.c: Likewise.
	* vmsdbgout.c: Likewise.

gcc/ada/
	* gcc-interface/decl.c: Use FOR_EACH_VEC_ELT.
	* gcc-interface/trans.c: Likewise.
	* gcc-interface/utils.c: Likewise.

gcc/c-family/
	* c-common.c: Use FOR_EACH_VEC_ELT.
	* c-gimplify.c: Likewise.
	* c-pragma.c: Likewise.

gcc/cp/
	* call.c: Use FOR_EACH_VEC_ELT.
	* class.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* error.c: Likewise.
	* except.c: Likewise.
	* mangle.c: Likewise.
	* method.c: Likewise.
	* name-lookup.c: Likewise.
	* parser.c: Likewise.
	* pt.c: Likewise.
	* repo.c: Likewise.
	* semantics.c: Likewise.
	* typeck2.c: Likewise.

gcc/fortran/
	* trans-openmp.c: Use FOR_EACH_VEC_ELT.

gcc/java/
	* class.c: Use FOR_EACH_VEC_ELT.
	* expr.c: Likewise.
	* jcf-parse.c: Likewise.
	* resource.c: Likewise.

gcc/lto/
	* lto.c: Use FOR_EACH_VEC_ELT.

From-SVN: r163401
2010-08-20 12:48:59 +00:00
Jason Merrill 2c5df20f2e except.c (pending_noexcept, [...]): New.
* except.c (pending_noexcept, pending_noexcept_checks): New.
	(perform_deferred_noexcept_checks): New.
	(maybe_noexcept_warning): Split from...
	(finish_noexcept_expr): ...here.  Adjust.
	* decl2.c (cp_write_global_declarations): Call
	perform_deferred_noexcept_checks.
	* cp-tree.h: And declare it.

From-SVN: r163379
2010-08-19 12:59:37 -04:00
Nathan Froyd 910ad8dee5 tree.h (DECL_CHAIN): Define.
gcc/
	* tree.h (DECL_CHAIN): Define.
	* alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* c-decl.c: Likewise.
	* c-parser.c: Likewise.
	* c-typeck.c: Likewise.
	* cfgexpand.c: Likewise.
	* cgraph.c: Likewise.
	* cgraphunit.c: Likewise.
	* combine.c: Likewise.
	* config/alpha/alpha.c: Likewise.
	* config/arm/arm.c: Likewise.
	* config/frv/frv.c: Likewise.
	* config/i386/i386.c: Likewise.
	* config/i386/winnt-cxx.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/iq2000/iq2000.c: Likewise.
	* config/mep/mep.c: Likewise.
	* config/mips/mips.c: Likewise.
	* config/pa/som.h: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/sh/sh.c: Likewise.
	* config/sh/symbian-cxx.c: Likewise.
	* config/sparc/sparc.c: Likewise.
	* config/spu/spu.c: Likewise.
	* config/stormy16/stormy16.c: Likewise.
	* config/vxworks.c: Likewise.
	* config/xtensa/xtensa.c: Likewise.
	* coverage.c: Likewise.
	* dbxout.c: Likewise.
	* dwarf2out.c: Likewise.
	* emit-rtl.c: Likewise.
	* expr.c: Likewise.
	* function.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimplify.c: Likewise.
	* integrate.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-split.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa-type-escape.c: Likewise.
	* langhooks.c: Likewise.
	* lto-cgraph.c: Likewise.
	* omp-low.c: Likewise.
	* stor-layout.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-complex.c: Likewise.
	* tree-dfa.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-mudflap.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-tailcall.c: Likewise.
	* tree-vrp.c: Likewise.
	* tree.c: Likewise.
	* var-tracking.c: Likewise.
	* varasm.c: Likewise.

gcc/ada/
	* gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* gcc-interface/trans.c: Likewise.
	* gcc-interface/utils.c: Likewise.
	* gcc-interface/utils2.c: Likewise.

gcc/c-family/
	* c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* c-format.c: Likewise.

gcc/cp/
	* cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* call.c: Likewise.
	* class.c: Likewise.
	* cp-gimplify.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* init.c: Likewise.
	* mangle.c: Likewise.
	* name-lookup.c: Likewise.
	* optimize.c: Likewise.
	* parser.c: Likewise.
	* pt.c: Likewise.
	* rtti.c: Likewise.
	* search.c: Likewise.
	* semantics.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.

gcc/fortran/
	* f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* trans-common.c: Likewise.
	* trans-decl.c: Likewise.
	* trans-types.c: Likewise.
	* trans.c: Likewise.

gcc/java/
	* java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* boehm.c: Likewise.
	* class.c: Likewise.
	* decl.c: Likewise.
	* expr.c: Likewise.
	* jcf-parse.c: Likewise.
	* typeck.c: Likewise.
	* verify-glue.c: Likewise.

gcc/objc/
	* objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN.

gcc/testsuite/
	* g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN
	with DECL_CHAIN.

From-SVN: r162223
2010-07-15 14:31:28 +00:00
Jason Merrill 9a71b305bf * decl2.c (mark_used): Adjust error for use of deleted function.
From-SVN: r161580
2010-06-29 20:51:13 -04:00
Steven Bosscher 3b06d37902 system.h: Poison GCC_EXCEPT_H for front-end files.
gcc/ChangeLog:
2010-06-28  Steven Bosscher  <steven@gcc.gnu.org>

	* system.h: Poison GCC_EXCEPT_H for front-end files.

	* langhooks.h (struct lang_hooks): Add eh_protect_cleanup_actions
	langhook.
	* langhooks-def.h (LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS) New.
	Define to NULL by default.
	* except.h: Define GCC_EXCEPT_H.
	(doing_eh): Remove prototype.
	(init_eh, init_eh_for_function): Move prototypes to toplev.h.
	(lang_protect_cleanup_actions): Remove.
	* except.c (lang_protect_cleanup_actions): Remove.
	(doing_eh): Remove.
	(gen_eh_region): Don't check doing_eh here.
	* toplev.h (init_eh, init_eh_for_function_): Moved from except.h.
	* tree-eh.c (honor_protect_cleanup_actions): Use new langhook
	instead of lang_protect_cleanup_actions.
	* omp-low.c (maybe_catch_exception): Likewise.
	* Makefile.in: Update dependencies.

gcc/c-family/ChangeLog:
2010-06-28  Steven Bosscher  <steven@gcc.gnu.org>

	* c-cppbuiltin.c: Do not include except.h.

gcc/objc/ChangeLog:
2010-06-28  Steven Bosscher  <steven@gcc.gnu.org>

	* objc-act.c: Do not include except.h.

gcc/cp/ChangeLog:
2010-06-28  Steven Bosscher  <steven@gcc.gnu.org>

	* init.c: Do not include except.h.
	* decl.c: Likewise.
	* expr.c: Likewise.
	* cp-lang.c: Likewise.
	* pt.c: Likewise.
	* semantics.c: Likewise.
	* decl2.c: Likewise.
	* except.c: Likewise.
	(init_exception_processing): Do not set the removed
	lang_protect_cleanup_actions here.
	(cp_protect_cleanup_actions): Make non-static and remove prototype.
	(doing_eh): New, moved from except.c but removed the do_warning flag.
	(expand_start_catch_block): Update doing_eh call.
	(expand_end_catch_block): Likewise.
	(build_throw): Likewise.
	* cp-tree.h: Prototype cp_protect_cleanup_actions.
	* cp-objcp-common.h: Set LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS to
	cp_protect_cleanup_actions.
	* Make-lang.in: Update dependencies.

gcc/objcp/ChangeLog:
2010-06-28  Steven Bosscher  <steven@gcc.gnu.org>

	* objcp-lang.c: Do not include except.h.
	* Make-lang.in: Update dependencies.

gcc/java/ChangeLog:
2010-06-28  Steven Bosscher  <steven@gcc.gnu.org>

	* lang.c: Do not include except.h
	* except.c: Likewise.
	(doing_eh): New, moved from except.c (in gcc/) but removed the
	do_warning flag.
	(maybe_start_try): Update doing_eh call.
	* Make-lang.in: Update dependencies.

gcc/ada/ChangeLog:
2010-06-28  Steven Bosscher  <steven@gcc.gnu.org>

	* gcc-interface/misc.c: Do not include except.h.
	* gcc-interface/Make-lang.in: Update dependencies.

gcc/fortran/ChangeLog:
2010-06-28  Steven Bosscher  <steven@gcc.gnu.org>

	* Make-lang.in: Update dependencies.

From-SVN: r161484
2010-06-28 10:52:46 +00:00
Nathan Froyd 2a4449a3b5 cp-tree.h (struct saved_scope): Change decl_ns_list field type to a VEC.
* cp-tree.h (struct saved_scope): Change decl_ns_list field type
	to a VEC.
	* decl2.c (cp_write_global_declarations): Adjust for new type of
	decl_namespace_list.
	* name-lookup.c (current_decl_namespace): Likewise.
	(push_decl_namespace): Likewise.
	(pop_decl_namespace): Likewise.

From-SVN: r160487
2010-06-09 15:34:07 +00:00
Nathan Froyd 0244e6f7e0 call.c (build_java_interface_fn_ref): Call build_function_type_list instead of build_function_type.
* call.c (build_java_interface_fn_ref): Call build_function_type_list
	instead of build_function_type.
	* decl.c (cxx_init_decl_processing): Likewise.
	(declare_global_var): Likewise.
	(get_atexit_node): Likewise.
	(expand_static_init): Likewise.
	* decl2.c (start_objects): Likewise.
	(start_static_storage_duration_function): Likewise.
	* except.c (init_exception_processing): Likewise.
	(build_exc_ptr): Likewise.
	(build_throw): Likewise.
	* rtti.c (throw_bad_cast): Likewise.
	(throw_bad_typeid): Likewise.
	(build_dynamic_cast_1): Likewise.

From-SVN: r160486
2010-06-09 15:18:40 +00:00
Steven Bosscher 39dabefd0e c-common.c: Move to c-family/.
gcc/ChangeLog:
	* c-common.c: Move to c-family/.
	* c-common.def: Likewise.
	* c-common.h: Likewise.
	* c-cppbuiltin.c: Likewise.
	* c-dump.c: Likewise.
	* c-format.c: Likewise.
	* c-format.h : Likewise.
	* c-gimplify.c: Likewise.
	* c-lex.c: Likewise.
	* c-omp.c: Likewise.
	* c.opt: Likewise.
	* c-opts.c: Likewise.
	* c-pch.c: Likewise.
	* c-ppoutput.c: Likewise.
	* c-pragma.c: Likewise.
	* c-pragma.h: Likewise.
	* c-pretty-print.c: Likewise.
	* c-pretty-print.h: Likewise.
	* c-semantics.c: Likewise.
	* stub-objc.c: Likewise.

	* gengtype.c (get_file_langdir): Special-case files in c-family/.
	(get_output_file_with_visibility): Fix name for c-common.h.
	* c-config-lang.in: Update paths in gtfiles for files in c-family/.

	* c-tree.h: Update include path for moved files.
	* c-lang.c: Likewise.
	* c-lang.h: Likewise.
	* c-parser.c: Likewise.
	* c-convert.c: Likewise.
	* c-decl.c: Likewise.
	* c-objc-common.c: Likewise.
	* configure.ac: Make sure c-family/ exists in the build directory.
	* configure: Regenerate.
	* Makefile.in: Update paths for moved files.  Regroup files per
	location and update dependencies.  Move generated_files down after
	ALL_GTFILES_H.

	* config/spu/spu-c.c: Update paths for moved files.
	* config/mep/mep-pragma.c: Likewise.
	* config/darwin-c.c: Likewise.
	* config/i386/msformat-c.c: Likewise.
	* config/i386/i386-c.c: Likewise.
	* config/avr/avr-c.c: Likewise.
	* config/sol2-c.c: Likewise.
	* config/ia64/ia64-c.c: Likewise.
	* config/rs6000/rs6000-c.c: Likewise.
	* config/arm/arm.c: Likewise.
	* config/arm/arm-c.c: Likewise.
	* config/h8300/h8300.c: Likewise.
	* config/v850/v850-c.c: Likewise.

	* config/t-darwin: Fix dependencies for moved files.
	* config/t-sol2: Fix dependencies for moved files.
	* config/mep/t-mep: Fix dependencies for moved files.
	* config/ia64/t-ia64: Fix dependencies for moved files.
	* config/rs6000/t-rs6000: Fix dependencies for moved files.
	* config/v850/t-v850: Fix dependencies for moved files.
	* config/v850/t-v850e: Fix dependencies for moved files.

	* config/m32c/m32c-pragma.c

	* po/exgettext: Look in c-family/ also.

c-family/ChangeLog:
	* c-common.c: Include gt-c-family-c-common.h.
	* c-pragma.c: Include gt-c-family-c-pragma.h.

objc/ChangeLog:
	* objc-act.c: Update include path for moved files.
	* objc-lang.c: Likewise.
	* config-lang.in: Update paths in gtfiles for files in c-family/.

objcp/ChangeLog:
	* objcp-lang.c: Update include path for moved files.
	* config-lang.in: Update paths in gtfiles for files in c-family/.

cp/ChangeLog:
	* typeck.c: Update include path for moved files.
	* decl.c: Likewise.
	* rtti.c: Likewise.
	* cp-gimplify.c: Likewise.
	* cp-lang.c: Likewise.
	* pt.c: Likewise.
	* semantics.c: Likewise.
	* cxx-pretty-print.h: Likewise.
	* decl2.c: Likewise.
	* parser.c: Likewise.
	* cp-objcp-common.c: Likewise.
	* cp-tree.h: Likewise.
	* name-lookup.c: Likewise.
	* lex.c: Likewise.
	* name-lookup.h: Likewise.
	* config-lang.in: Update paths in gtfiles for files in c-family/.
	* Make-lang.in: Likewise.

From-SVN: r160330
2010-06-05 20:33:22 +00:00
Arnaud Charlet 36a549b86c Make-lang.in (CXX_C_OBJS): Add c-ada-spec.o.
* Make-lang.in (CXX_C_OBJS): Add c-ada-spec.o.
	* decl2.c: Include langhooks.h and c-ada-spec.h.
	(cpp_check, collect_source_refs, collect_ada_namespace,
	collect_all_refs): New functions.
	(cp_write_global_declarations): Add handling of -fdump-ada-spec.
	* lang-specs.h: Ditto.

Co-Authored-By: Matthew Gingell <gingell@adacore.com>

From-SVN: r160103
2010-06-01 15:00:50 +02:00
Nathan Froyd 450f429348 cp-tree.h (cp_build_function_call_nary): Declare.
* cp-tree.h (cp_build_function_call_nary): Declare.
	* typeck.c (cp_build_function_call_nary): Define.
	* decl.c (register_dtor_fn): Use it instead of
	cp_build_function_call.
	(cxx_maybe_build_cleanup): Likewise.
	* decl2.c (generate_ctor_or_dtor_function): Likewise.
	* except.c (do_get_exception_ptr): Likewise.
	(do_begin_catch): Likewise.
	(do_allocate_exception): Likewise.
	(do_free_exception): Likewise.
	(build_throw): Likewise.  Use cp_build_function_call_vec instead
	of cp_build_function_call.
	(do_end_catch): Likewise.

From-SVN: r160045
2010-05-30 03:03:14 +00:00
Steven Bosscher 245763e30a Makefile.in (EXCEPT_H): Fix typo.
gcc/ChangeLog:
	* Makefile.in (EXCEPT_H): Fix typo.

objc/ChangeLog:
	* objc-act.h: Do not include gimple.h.
	* objc-act.c: Do not include rtl.h, expr.h, libfuncs.h, and tm_p.h.
	Include gimple.h.  Explain why except.h has to be included.
	* objc-lang.c: Do not include diagnostics.h.
	* Make-lang.in: Update dependencies.

objcp/ChangeLog:
	* objcp-decl.c: Do not include tm.h, rtl.h, expr.h, c-common.h,
	flags.h, input.h, except.h, output.h, toplev.h, cpplib.h, debug.h,
	and target.h.
	* objcp-lang.c: Do not include tm.h, toplev.h, diagnostics.h,
	and debug.h.  Explain why except.h has to be included.
	* Make-lang.in: Update dependencies.

cp/ChangeLog:
	* cp-tree.h: Do not include splay-tree.h.
	(struct prtmem_cst): Remove unused field and false comment.
	* typeck.c: Do not include rtl.h, expr.h, and tm_p.h.
	* optimize.c: Do not inclde rtl.h, insn-config.h, and integrate.h.
	* init.c: Do not include rtl.h and expr.h.
	* class.c: Do not include rtl.h.  Include splay-tree.h.
	(build_clone): Use plain NULL instead of NULL_RTX.
	* decl.c: Do not include expr.h.  Explain why rtl.h has to be
	included.  Include splay-tree.h.
	* method.c: Do not include rtl.h and expr.h.
	(use_thunk): Use plain NULL instead of NULL_RTX.
	* except.c: Do not include rtl.h, expr.h, and libfuncs.h.
	* tree.c: Do not include rtl.h, insn-config.h, integrate.h,
	and target.h.  Include splay-tree.h.
	* expr.c: Do not include rtl.h and expr.h.
	* pt.c: Do not include obstack.h and rtl.h.
	(tsubst_friend_function): Use plain NULL instead of NULL_RTX.
	(tsubst_decl): Likewise.
	(instantiate_decl): Likewise.
	* semantics.c: Do not include exprt.h and debug.h.  Explain why
	rtl.h has to be included.
	* decl2.c: Do not include rtl.h and expr.h.  Include splay-tree.h.
	* call.c: Do not include rtl.h and expr.h.
	* search.c: Do not include obstack.h and rtl.h.
	* friend.c: Do not include rtl.h and expr.h.
	* Make-lang.in: Update dependencies.

From-SVN: r159839
2010-05-25 18:14:23 +00:00
Jan Hubicka 9f90e80a18 decl2.c (maybe_emit_vtables): Produce same comdat group when outputting comdat vtables.
* decl2.c (maybe_emit_vtables): Produce same comdat group when outputting
	comdat vtables.
	(cxx_callgraph_analyze_expr): Remove code marking vtables needed.

	* cgraph.h (struct varpool_node): Add same_comdat_group.
	* lto-cgrpah.c (lto_output_varpool_node): Output same_comdat_group
	pointer.
	(output_varpool): Update call of lto_output_varpool_node.
	(input_varpool): Read same_comdat_group pointer.
	(input_varpool_1): Fixup same_comdat_group pointer.
	* ipa.c (cgraph_remove_unreachable_nodes): WHen one of same comdat
	group is needed, all are.
	* varpool.c (varpool_remove_node): Remove node from same comdat group
	linklist too.
	(varpool_analyze_pending_decls): Walk same comdat groups.

From-SVN: r159699
2010-05-22 14:48:40 +00:00
Jason Merrill a3360e778c call.c (reference_binding): Use cp_build_qualified_type_real and cp_type_quals consistently.
* call.c (reference_binding): Use cp_build_qualified_type_real
	and cp_type_quals consistently.
	(add_function_candidate): Likewise.
	(build_conditional_expr): Likewise.
	(convert_like_real): Likewise.
	(type_passed_as): Likewise.
	* class.c (add_method): Likewise.
	(same_signature_p): Likewise.
	(layout_class_type): Likewise.
	* decl.c (cxx_init_decl_processing): Likewise.
	(cp_fname_init): Likewise.
	(grokdeclarator): Likewise.
	* decl2.c (cp_reconstruct_complex_type): Likewise.
	* init.c (build_new_1): Likewise.
	* method.c (do_build_copy_constructor): Likewise.
	(implicitly_declare_fn): Likewise.
	* pt.c (tsubst_aggr_type): Likewise.
	(tsubst): Likewise.
	* rtti.c (init_rtti_processing): Likewise.
	(build_headof): Likewise.
	(build_dynamic_cast_1): Likewise.
	(tinfo_base_init): Likewise.
	(emit_support_tinfos): Likewise.
	* semantics.c (capture_decltype): Likewise.
	* tree.c (cv_unqualified): Likewise.
	* typeck.c (composite_pointer_type): Likewise.
	(string_conv_p): Likewise.

	* mangle.c (write_CV_qualifiers_for_type): Tweak.

	* call.c (initialize_reference): Use CP_TYPE_CONST_P.
	* decl.c (start_decl): Likewise.
	* semantics.c (finish_compound_literal): Likewise.
	* typeck.c (check_return_expr): Use CP_TYPE_VOLATILE_P.
	(cp_type_readonly): Remove.
	* cp-tree.h: Remove declaration.

From-SVN: r159599
2010-05-19 17:02:27 -04:00
Jason Merrill 2872152c39 re PR c++/44193 (function types, cv-quals and typename)
PR c++/44193
	* typeck.c (type_memfn_quals): New fn.
	(apply_memfn_quals): New fn.
	(cp_type_quals): Return TYPE_UNQUALIFIED for FUNCTION_TYPE.
	(cp_type_readonly): Use cp_type_quals.
	* cp-tree.h: Add declarations.
	* tree.c (cp_build_qualified_type_real): Don't set, but do
	preserve, quals on FUNCTION_TYPE.
	(strip_typedefs): Use apply_memfn_quals and type_memfn_quals.
	* decl.c (build_ptrmem_type): Likewise.
	(grokdeclarator): Likewise.
	(static_fn_type): Likewise.
	* decl2.c (change_return_type): Likewise.
	(cp_reconstruct_complex_type): Likewise.
	* pt.c (tsubst_function_type): Likewise.
	(unify): Likewise.
	(tsubst): Likewise.  Drop special FUNCTION_TYPE substitution code.

From-SVN: r159596
2010-05-19 17:01:50 -04:00
Jason Merrill 3a11c66591 typeck.c (cp_build_array_ref): Factor out from...
* typeck.c (cp_build_array_ref): Factor out from...
	(build_array_ref): ...here.  Drop complain parm.
	(build_new_op): Adjust.
	* class.c (build_vtbl_ref_1): Adjust.
	* decl2.c (grok_array_decl): Adjust.
	* cp-tree.h: Adjust prototypes.

From-SVN: r159377
2010-05-13 16:53:38 -04:00
Jason Merrill 73647d7519 typeck.c (build_array_ref): Take complain parm.
* typeck.c (build_array_ref): Take complain parm.
	* cp-tree.h: Add it to prototype.
	* call.c (build_new_op): Pass it.
	* class.c (build_vtbl_ref): Pass it.
	* decl2.c (grok_array_decl): Pass it.

From-SVN: r159351
2010-05-13 01:05:21 -04:00
Jason Merrill 483264879c PR c++/11094, DR 408
PR c++/11094, DR 408
	* cp-tree.h (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): New.
	* decl2.c (finish_static_data_member_decl): Set it.
	* decl.c (duplicate_decls): Propagate it.
	* pt.c (tsubst_decl): Don't substitute the domain of an array
	VAR_DECL if it's set.
	(regenerate_decl_from_template): Substitute it here.
	(type_dependent_expression_p): Return true if it's set.
	* semantics.c (finish_decltype_type): Instantiate such a variable.
	* typeck.c (cxx_sizeof_expr): Likewise.
	(strip_array_domain): New.

From-SVN: r158075
2010-04-07 11:55:20 -04:00
Jason Merrill c6be04ad92 Make lambda conversion op and op() non-static.
* semantics.c (maybe_add_lambda_conv_op): Make non-static.
	Also add the thunk function returned by the conversion op.
	Mark the conversion deleted if the op() is variadic.
	* decl2.c (mark_used): Give helpful message about deleted conversion.
	* parser.c (cp_parser_lambda_declarator_opt): Don't make op() static.
	* semantics.c (finish_this_expr): Adjust.
	* mangle.c (write_closure_type_name): Adjust.
	* decl.c (grok_op_properties): Don't allow it.
	* call.c (build_user_type_conversion_1): No static conversion ops.
	(build_op_call): Or op().

	* decl2.c (change_return_type): Fix 'this' quals.

From-SVN: r157681
2010-03-23 18:29:53 -04:00
Simon Martin 7801b86acf re PR c++/43081 (ICE with invalid in-class initializer)
gcc/cp/

2010-03-20  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/43081:
	* decl2.c (grokfield): Handle invalid initializers for member
	functions.

gcc/testsuite/

2010-03-20  Simon Martin  <simartin@users.sourceforge.net>
	    Michael Matz  <matz@suse.de>

	PR c++/43081
	* g++.dg/parse/crash56.C: New test.

Co-Authored-By: Michael Matz <matz@suse.de>

From-SVN: r157597
2010-03-20 18:01:18 +00:00
Dodji Seketeli 39bac0102c re PR c++/43375 (ICE during compiling SSE code)
Fix for PR c++/43375

gcc/cp/ChangeLog:
	PR c++/43375
	* method.c (make_alias_for): Avoid crashing when DECL_LANG_SPECIFIC
	is NULL.
	* decl2.c (vague_linkage_p): Likewise.

gcc/testsuite/g++.dg/ChangeLog:
	PR c++/43375
	* g++.dg/abi/mangle42.C: New test.

From-SVN: r157590
2010-03-20 09:55:32 +01:00