Commit Graph

1145 Commits

Author SHA1 Message Date
Steven Bosscher a4b7d13c17 output.h (merge_weak, [...]): Move protos from here...
* output.h (merge_weak, assemble_alias,
	initializer_constant_valid_p,
	initializer_constant_valid_for_bitfield_p): Move protos from here...
	* tree.h: ... to here.

	* cgraphclones.c: Do not include output.h.
	* gimplify.c: Likewise.
	* reload.c: Likewise.
	* recog.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* c-parser.c: Likewise.
	* c-typeck.c: Likewise.

	* Makefile.in: Fix dependencies.

c-family/
	* c-common.c: Do not include output.h.
	* c-pragma.c: Likewise.

cp/
	* semantics.c: Do not include output.h.
	* decl2.c: Likewise.
	* friend.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.
	* Make-lang.in: Fix dependencies.

ada/
	* gcc-interface/utils2.c: Do not include output.h.
	* gcc-interface/Make-lang.in: Fix dependencies.

From-SVN: r188178
2012-06-04 11:17:58 +00:00
Paolo Carlini 0a9696f022 re PR c++/29185 (inconsistent warning: deleting array)
/cp
2012-05-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/29185
	* decl2.c (delete_sanity): Extend 'deleting array' warning to
	any array type.

/testsuite
2012-05-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/29185
	* g++.dg/warn/delete-array-1.C: New.

From-SVN: r187801
2012-05-23 14:19:27 +00:00
Paolo Carlini f330f5991e re PR c++/44516 (improve error message when no matching operator)
gcc/cp
2012-05-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44516
	* typeck.c (build_x_array_ref, build_x_conditional_expr,
	build_x_compound_expr, build_x_modify_expr): Add location_t parameter.
	(finish_class_member_access_expr, build_x_indirect_ref,
	build_x_binary_op, build_x_compound_expr_from_list,
	build_x_compound_expr_from_vec): Adjust callers.
	* tree.c (build_min_nt_loc): New.
	(build_min_nt): Remove.
	* typeck2.c (build_x_arrow): Adjust callers.
	* pt.c (tsubst_qualified_id, tsubst_omp_for_iterator,
	tsubst_copy_and_build): Likewise.
	* semantics.c (finish_mem_initializers, handle_omp_for_class_iterator,
	 finish_omp_atomic): Likewise.
	* decl2.c (grok_array_decl, build_anon_union_vars): Adjust.
	* parser.c (cp_parser_question_colon_clause,
	cp_parser_assignment_expression, cp_parser_expression,
	cp_parser_template_id, cp_parser_omp_for_loop): Likewise.
	* cp-tree.h: Update.

gcc/testsuite
2012-05-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44516
	* g++.dg/parse/error48.C: New.
	* g++.dg/template/crash89.C: Adjust dg-error line numbers.
	* g++.old-deja/g++.robertl/eb109.C: Add column info to dg-error string.

libstdc++
2012-05-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44516
	* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust
	dg-error line number.

From-SVN: r187627
2012-05-17 10:29:46 +00:00
Dodji Seketeli 0b2c4be5fd PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokens
Now that we track token locations accross macro expansions, it would
be cool to be able to fix PR preprocessor/7263 for real.  That is,
consider this example where we have a system header named header.h
like this:

	#define _Complex __complex__ #define _Complex_I 1.0iF

and then a normal C file like this:

    #include "header.h"

    static _Complex float c = _Complex_I;

If we compile the file with -pedantic, the usages of _Complex or
_Complex_I should not trigger any warning, even though __complex__ and
the complex literal are extensions to the standard C.

They shouldn't trigger any warning because _Complex and _Complex_I are
defined in a system header (and expanded in normal user code).

To be able to handle this, we must address two separate concerns.

First, warnings about non-standard usage of numerical literals are emitted
directly from within libcpp.  So we must teach libcpp's parser for numerical
literals to use virtual locations, instead of the spelling
location it uses today.  Once we have that, as the diagnostics machinery
already knows how to avoid emitting errors happening on tokens that come from
system headers, we win.

Second, there is the issue of tracking locations for declaration
specifiers, like the "_Complex" in the declaration:

	static _Complex float c;

For that, we need to arrange for each possible declaration specifier
to have its own location, because otherwise, we'd warn on e.g, on:

    _Complex float c;

but not on:

    static _Complex float c;

So this patch addresses the two concerns above.  It's actually a
follow-up on an earlier patch[1] I wrote as part of my initial work on
virtual locations.  We then agreed[2] that the second concern was
important to address before the patch could get a chance to go in.

[1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html
[2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html

Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.

libcpp/

	PR preprocessor/7263
	* include/cpplib.h (cpp_classify_number): Take a location
	parameter.
	* expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic
	macros that take a location parameter.
	(cpp_classify_number): Take a (virtual) location parameter.  Use
	it for diagnostics.  Adjust comments.
	(eval_token): Take a location parameter.  Pass it to
	cpp_classify_number and to diagnostic routines.
	(_cpp_parse_expr): Use virtual locations of tokens when parsing
	expressions.  Pass a virtual location to eval_token and to
	diagnostic routines.

gcc/c-family/

	PR preprocessor/7263
	* c-lex.c (c_lex_with_flags):  Pass a virtual location to the call
	to cpp_classify_number.  For diagnostics, use the precise location
	instead of the global input_location.

gcc/
	PR preprocessor/7263
	* c-tree.h (enum c_declspec_word): Declare new enum.
	(struct c_declspecs::locations): New member.
	(declspecs_add_qual, declspecs_add_scspec)
	(declspecs_add_addrspace, declspecs_add_alignas): Take a new
	location parameter.
	* c-decl.c (build_null_declspecs): Initialize the new struct
	c_declspecs::locations member.
	(declspecs_add_addrspace): Take a location parameter for the
	address space.  Store it onto declaration specifiers.
	(declspecs_add_qual): Likewise, take a location parameter for the
	qualifier.
	(declspecs_add_type): Likewise, take a location parameter for the
	type specifier.
	(declspecs_add_scspec): Likewise, take a location parameter for
	the storage class specifier.
	(declspecs_add_attrs): Likewise, take a location parameter for the
	first attribute.
	(declspecs_add_alignas): Likewise, take a location parameter for
	the alignas token.
	(finish_declspecs): For diagnostics, use the location of the
	relevant declspec, instead of the global input_location.
	* c-parser.c (c_parser_parameter_declaration): Pass the precise
	virtual location of the declspec to the declspecs-setters.
	(c_parser_declspecs): Likewise.  Avoid calling c_parser_peek_token
	repeatedly.

gcc/cp/

	PR preprocessor/7263
	* cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all
	the possible declarator specifiers so far.
	(struct cp_decl_specifier_seq::locations): Declare new member.
	(cp_decl_specifier_seq::{specs, type_location}): Remove.
	(decl_spec_seq_has_spec_p): Declare new function.
	* parser.c (cp_parser_check_decl_spec): Remove.
	(set_and_check_decl_spec_loc): Define new static function.
	(decl_spec_seq_has_spec_p): Define new public function.
	(cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt)
	(cp_parser_type_specifier, cp_parser_simple_type_specifier)
	(cp_parser_set_storage_class, cp_parser_set_decl_spec_type)
	(cp_parser_alias_declaration): Set the locations for each
	declspec, using set_and_check_decl_spec_loc.
	(cp_parser_explicit_instantiation, cp_parser_init_declarator)
	(cp_parser_member_declaration, cp_parser_init_declarator): Use the
	new declspec location for specifiers.  Use the new
	decl_spec_seq_has_spec_p.
	(cp_parser_type_specifier_seq): Use the new
	set_and_check_decl_spec_loc.  Stop using
	cp_parser_check_decl_spec.  Use the new decl_spec_seq_has_spec_p.
	(, cp_parser_init_declarator): Use the new
	set_and_check_decl_spec_loc.
	(cp_parser_single_declaration, cp_parser_friend_p)
	(cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration):
	Use the new decl_spec_seq_has_spec_p.
	* decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p.  Use
	the more precise ds_redefined_builtin_type_spec location for
	diagnostics about re-declaring C++ built-in types.
	(start_decl, grokvardecl, grokdeclarator): Use the new
	decl_spec_seq_has_spec_p.

gcc/testsuite/

	PR preprocessor/7263
	* gcc.dg/binary-constants-2.c: Run without tracking locations
	accross macro expansion.
	* gcc.dg/binary-constants-3.c: Likewise.
	* gcc.dg/cpp/sysmac2.c: Likewise.
	* testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise
	location.
	* gcc.dg/cpp/syshdr3.c: New test.
	* gcc.dg/cpp/syshdr3.h: New header for the new test above.
	* gcc.dg/system-binary-constants-1.c: New test.
	* gcc.dg/system-binary-constants-1.h: New header for the new test
	above.
	* g++.dg/cpp/syshdr3.C: New test.
	* g++.dg/cpp/syshdr3.h: New header the new test above.
	* g++.dg/system-binary-constants-1.C: New test.
	* g++.dg/system-binary-constants-1.h: New header the new test
	above.

From-SVN: r187587
2012-05-16 12:51:15 +02:00
Paolo Carlini 4fe977f2d6 re PR c++/53152 (In "no match for operatorXX" error message gives the wrong column info)
2012-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53152
	* call.c (op_error, build_new_op_1, build_new_op): Add location_t
	parameter.
	(build_conditional_expr_1): Adjust.
	* typeck.c (build_x_indirect_ref, build_x_binary_op,
	build_x_unary_op): Add location_t parameter.
	(rationalize_conditional_expr, build_x_array_ref,
	build_x_compound_expr, cp_build_modify_expr, build_x_modify_expr):
	Adjust.
	* typeck2.c (build_x_arrow): Add location_t parameter.
	* semantics.c (finish_unary_op_expr): Likewise.
	(finish_increment_expr, handle_omp_for_class_iterator): Adjust.
	* decl2.c (grok_array_decl): Add location_t parameter.
	* parser.c (cp_parser_postfix_open_square_expression,
	cp_parser_postfix_dot_deref_expression, cp_parser_unary_expression,
	cp_parser_binary_expression, cp_parser_builtin_offsetof,
	do_range_for_auto_deduction, cp_convert_range_for,
	cp_parser_template_argument, cp_parser_omp_for_cond): Pass the
	location, adjust.
	* pt.c (tsubst_copy_and_build): Adjust.
	* tree.c (maybe_dummy_object): Likewise.
	* cp-tree.h: Update declarations.

From-SVN: r187211
2012-05-06 15:06:31 +00:00
Jan Hubicka 65d630d474 cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c
* cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c
	(cgraph_asm_nodes, cgraph_asm_last_node): Move to cgraphunit.c
	(cgraph_add_to_same_comdat_group): Remove.
	(cgraph_add_asm_node): Move to cgraphunit.c.
	(cgraph_make_decl_local): Move to symtab.c
	(cgraph_make_node_local_1): Update.
	(cgraph_can_remove_if_no_direct_calls_and): Update.
	(used_from_object_file_p): Update.
	(resolution_used_from_other_file_p): Move to symtab.c
	(cgraph_used_from_object_file_p): move to symtab.c
	(verify_cgraph_node): Verify same comdat groups.
	* cgraph.h (cgraph_asm_node): Rename to ...
	(asm_node): ... this one.
	(cgraph_asm_nodes): Rename to ...
	(asm_nodes): ... this one.
	(symtab_add_to_same_comdat_group): New function.
	(symtab_dissolve_same_comdat_group_list): New function.
	(symtab_used_from_object_file_p): Declare.
	(symtab_make_decl_local): Declare.
	(cgraph_add_to_same_comdat_group): Remove.
	(cgraph_add_asm_node): Remove.
	(cgraph_used_from_object_file_p, varpool_used_from_object_file_p):
	Remove.
	(cgraph_finalize_compilation_unit): Rename to ...
	(finalize_compilation_unit): ... this one.
	(cgraph_optimize): Rename to ....
	(compile): ... this one.
	(add_asm_node): Declare.
	(fixup_same_cpp_alias_visibility): Declare.
	(cgraph_make_decl_local): Remove.
	(varpool_assemble_pending_decls): Rename to ...
	(varpool_output_variables): ... this one.
	(varpool_remove_unreferenced_decls): Remove.
	* ipa-inline-transform.c (clone_inlined_nodes): Dissolve comdat groups.
	(preserve_function_body_p): Make static.
	* toplev.c (compile_file): Update comments;
	update.
	* cgraphunit.c: Update comments.
	(cgraph_expand_all_functions): Rename to ...
	(expand_all_functions): ... this one; update.
	(cgraph_mark_functions_to_output): Rename to ...
	(mark_functions_to_output): ... this one; cleanup.
	(cgraph_output_pending_asms): Remove prototype.
	(asm_nodes, asm_last_node): New static vars.
	(cgraph_process_new_functions): Update.
	(cgraph_reset_node): Cleanup; add comment.
	(cgraph_add_new_function): Update.
	(cgraph_output_pending_asms): Rename to ...
	(output_asm_statements): ... this one.
	(add_asm_node): New function.
	(fixup_same_cpp_alias_visibility): New function based on code
	in cgraph_analyze_function.
	(cgraph_analyze_function): Use it.
	(cgraph_order_sort): Update.
	(cgraph_output_in_order): Update.
	(cgraph_function_versioning): Update.
	(cgraph_optimize): Rename to ...
	(compile): ... this one; initialize streamer hooks here.
	(cgraph_finalize_compilation_unit): Rename to ...
	(finalize_compilation_unit): ... this one; do not initialize streamer
	hook here.
	* lto-streamer-out.c (lto_output_toplevel_asms): Update.
	* dwarf2out.c: Update ocmment.
	* optimize.c (maybe_clone_body): Use symtab_add_to_same_comdat_group.
	* method.c (use_thunk): Likewise.
	* semantics.c (maybe_add_lambda_conv_op): Likewise.
	* decl2.c (maybe_emit_vtables): Likewise.	
	(cp_write_global_declarations): Use finalize_compilation_unit.
	* parser.c (cp_parser_asm_definition): Use add_asm_node.
	* lto-streamer-in.c (lto_input_toplevel_asms): Use add_asm_node
	* c-decl.c (c_write_global_declarations): Use finalize_compilation_unit.
	* langhooks.c (write_global_declarations): Update.
	* ipa.c (cgraph_externally_visible_p): Update.
	(dissolve_same_comdat_group_list): Remove.
	(function_and_variable_visibility): Update.
	* symtab.c: Inlcude lto-streamer.h and rtl.h
	(ld_plugin_symbol_resolution_names): New.
	(symtab_add_to_same_comdat_group): New.
	(symtab_dissolve_same_comdat_group_list): New.
	(resolution_used_from_other_file_p): Move here from cgraph.c
	(symtab_used_from_object_file_p): New.
	(symtab_make_decl_local): New.
	* passes.c (register_pass): Update comments.
	* c-parser.c (c_parser_asm_definition): Update.
	* varpool.c (varpool_analyze_node): Use fixup_same_cpp_alias_visibility.
	(varpool_remove_unreferenced_decls): Make static.
	(varpool_assemble_pending_decls): Rename to ...
	(varpool_output_variables): ... this one; call
	varpool_remove_unreferenced_decls.
	(varpool_used_from_object_file_p): Remove.

	* gogo-tree.cc (Gogo::write_globals): Use finalize_compilation_unit.

	* gcc-interface/utils.c (rest_of_subprog_body_compilation): Update
	comment.
	(gnat_write_global_declarations): Use finalize_compilation_unit.

	* f95-lang.c (gfc_finish): Update comments.

	* lto.c (lto_main): Use compile ().
	* lto-partition.c (partition_cgraph_node_p): Use symtab_used_from_object_file_p.
	(partition_varpool_node_p): Likewise.

From-SVN: r186998
2012-04-30 17:55:29 +00:00
Marc Glisse 7edaa4d2a5 re PR c++/51033 (generic vector subscript and shuffle support was not added to C++)
PR c++/51033
gcc/
	* c-typeck.c (build_array_ref): Call
	convert_vector_to_pointer_for_subscript.
gcc/c-family
	* c-common.c (convert_vector_to_pointer_for_subscript): New function.
	* c-common.h (convert_vector_to_pointer_for_subscript): Declare it.
gcc/cp/
	* typeck.c (cp_build_array_ref): Handle VECTOR_TYPE.
	* decl2.c (grok_array_decl): Likewise.

From-SVN: r186994
2012-04-30 13:23:28 -04:00
Jan Hubicka 660584689a lto-symtab.c (lto_varpool_replace_node): Do not merge needed flags.
* lto-symtab.c (lto_varpool_replace_node): Do not merge needed flags.
	* cgraphbuild.c (record_reference, record_type_list, mark_address,
	mark_load, mark_store): Do not mark varpool nodes as needed.
	* cgraph.c (cgraph_new_nodes): Remove.
	(cgraph_create_function_alias): Do not mark nodes as reachable.
	(cgraph_add_thunk): Likewise.
	(cgraph_mark_reachable_node): Do not manage the queue.
	* cgraph.h (cgraph_node): Remove next_needed.
	(varpool_nodes_queue): Remove next_needed and prev_needed.
	(x_cgraph_nodes_queue, x_cgraph_nodes_queue, cgraph_new_nodes): Remove.
	(cgraph_new_nodes): Declare.
	(x_varpool_nodes_queue, varpool_nodes_queue); Remove.
	(varpool_analyze_pending_decls): Remove.
	(varpool_analyze_node): New.
	(varpool_mark_needed_node): Remove.
	(varpool_first_variable, varpool_next_variable): New inlines.
	(varpool_first_static_initializer, varpool_next_static_initializer): Update.
	(FOR_EACH_STATIC_VARIABLE): Remove unused walker.
	(varpool_first_defined_variable): New inline.
	(varpool_next_defined_variable): New inline
	(FOR_EACH_VARIABLE): Reimplement.
	(FOR_EACH_DEFINED_VARIABLE): Reimplement.
	* toplev.c (wrapup_global_declaration_2): Use analyzed instead of
	needed flag.
	* cgraphunit.c (cgraph_new_nodes): Declare here.
	(enqueue_node): New function.
	(cgraph_process_new_functions): update for new
	node set; when constructing cgraph enqueue node for processing.
	(cgraph_add_new_function): Use new node set.
	(process_function_and_variable_attributes): Do not set varpool needed
	flags.
	(referred_to_p): New function.
	(varpool_finalize_decl): Move here from varpool.c; enqueue needed node
	when varpool is in construction.
	(cgraph_analyze_functions): Rewrite.
	(cgraph_expand_all_functions): Update.
	(cgraph_output_in_order): Do not analyze pending decls; do not set needed flags.
	(cgraph_optimize): Do not analyze pending decls.
	* lto-cgraph.c (input_varpool_node): Clear analyzed flag for objects in other
	partition; do not mark node as needed.
	* dwarf2out.c (reference_to_unused): Use analyzed flag.
	(premark_types_used_by_global_vars_helper): Likewise.
	* ipa.c (process_references): Do not call varpool_mark_needed_node.
	(cgraph_remove_unreachable_nodes): Do not rely on varpool and
	cgrpah queues.
	(function_and_variable_visibility): Do not mark node as needed.
	(whole_program_function_and_variable_visibility): Likewise.
	* Makefile.in (gt-varpool.h): No longer needed.
	* passes.c (execute_one_pass, execute_ipa_pass_list): Update.
	(ipa_write_summaries): Do not use needed flag.
	* varpool.c: Do not include gt-varpool.h
	(x_varpool_nodes_queue, x_varpool_last_needed_node,
	x_varpool_last_needed_node, x_varpool_first_unanalyzed_node,
	x_varpool_first_unanalyzed_node, varpool_assembled_nodes_queue):
	Remove.
	(varpool_remove_node): Do not update the lists.
	(dump_varpool_node): Do not dump needed flag.
	(varpool_enqueue_needed_node): Remove.
	(varpool_mark_needed_node): Remove.
	(varpool_reset_queue): Remove.
	(varpool_finalize_decl): Move to cgraphunit.c
	(varpool_analyze_node): New functions based on former
	varpool_analyze_pending_decls.
	(varpool_analyze_pending_decls): Remove.
	(varpool_assemble_decl): Do not update the lists.
	(enqueue_node): New function.
	(varpool_remove_unreferenced_decls): Rewrite.
	(varpool_empty_needed_queue): Remove.
	(add_new_static_var): Do not mark node as needed.
	(varpool_create_variable_alias): Handle expansion state
	creation.
	* except.c (output_ttype): Do not mark node as needed.
	* varasm.c (mark_decl_referenced): Do not use mark_needed_node.
	* tree-profile.c (init_ic_make_global_vars, init_ic_make_global_vars):
	Likewise.
	* tree-switch-conversion.c (build_one_array): Likewise.

	* class.c (build_utf8_ref): Do not mark varpool node as needed.

	* gcc-interface/utils.c (gnat_write_global_declarations): Do not mark
	needed node.

	* lto-partition.c (partition_varpool_node_p): Do not use needed flag.

	* decl2.c (maybe_make_one_only): Mark keyed COMDATs as USED so they
	gets finalized.

From-SVN: r186687
2012-04-22 21:28:07 +00:00
Jan Hubicka 7ca8f48652 method.c (make_alias_for): Do not set TREE_SYMBOL_REFERENCED.
* method.c (make_alias_for): Do not set TREE_SYMBOL_REFERENCED.
	* decl2.c (mark_needed): Likewise.
	(decl_needed_p): Do not test TREE_SYMBOL_REFERENCED.

	* decl2.c (cxx_callgraph_analyze_expr): Remove.
	* cp-objcp-common.h (LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): Remove.
	* cp-tree.h (cxx_callgraph_analyze_expr): Remove.

From-SVN: r186658
2012-04-21 23:59:25 +00:00
Jan Hubicka b7262828c0 re PR bootstrap/53042 (AIX bootstrap: cgraph symbol table error)
PR target/53042
	* decl2.c (maybe_emit_vtables): Do not initialize same_comdat_group
	list when target has no support for it.

From-SVN: r186627
2012-04-20 15:18:39 +00:00
Paolo Carlini 89fcabafa1 re PR c++/52422 ([C++11][SFINAE] Hard errors with void or arithmetic expressions)
/cp
2012-04-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/52422
	* cp-tree.h (build_addr_func, decay_conversion,
	get_member_function_from_ptrfunc,
	build_m_component_ref, convert_member_func_to_ptr):
	Add tsubst_flags_t parameter.
	* typeck.c (cp_default_conversion): Add.
	(decay_conversion, default_conversion,
	get_member_function_from_ptrfunc, convert_member_func_to_ptr):
	Add tsubst_flags_t parameter and use it throughout.
	(cp_build_indirect_ref, cp_build_array_ref,
	cp_build_function_call_vec, convert_arguments, build_x_binary_op,
	cp_build_binary_op, cp_build_unary_op, build_reinterpret_cast_1,
	build_const_cast_1, expand_ptrmemfunc_cst,
	convert_for_initialization): Adjust.
	* init.c (build_vec_init): Adjust.
	* decl.c (grok_reference_init, get_atexit_node): Likewise.
	* rtti.c (build_dynamic_cast_1, tinfo_base_init): Likewise.
	* except.c (build_throw): Likewise.
	* typeck2.c (build_x_arrow): Likewise.
	(build_m_component_ref): Add tsubst_flags_t parameter and
	use it throughout.
	* pt.c (convert_nontype_argument): Adjust.
	* semantics.c (finish_asm_stmt, maybe_add_lambda_conv_op): Likewise.
	* decl2.c (build_offset_ref_call_from_tree): Likewise.
	* call.c (build_addr_func): Add tsubst_flags_t parameter and
	use it throughout.
	(build_call_a, build_conditional_expr_1, build_new_op_1,
	convert_like_real, convert_arg_to_ellipsis, build_over_call,
	build_special_member_call): Adjust.
	* cvt.c (cp_convert_to_pointer, force_rvalue,
	build_expr_type_conversion): Likewise.

/testsuite
2012-04-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/52422
	* g++.dg/cpp0x/sfinae33.C: New.
	* g++.dg/cpp0x/sfinae34.C: Likewise.

From-SVN: r186565
2012-04-18 10:21:43 +00:00
Jan Hubicka 65c70e6b03 cgraph.h (FOR_EACH_VARIABLE, [...]): New macros.
* cgraph.h (FOR_EACH_VARIABLE, FOR_EACH_VARIABLE, FOR_EACH_FUNCTION):
	New macros.
	* lto-symtab.c (lto_symtab_merge_cgraph_nodes): Use FOR_EACH
	walkers to walk cgraph and varpool.
	* cgraph.c (cgraph_node_for_asm): Likewise.
	(dump_cgraph): Likewise.
	* value-prof.c (init_node_map): Likewise.
	* tree.c (free_lang_data_in_cgraph): Likewise.
	* tree-emutls.c: (ipa_lower_emutls): Likewise.
	* ipa-reference.c (generate_summary, propagate): Likewise.
	* cgraphunit.c (verify_cgraph, cgraph_process_same_body_aliases,
	cgraph_mark_functions_to_output, cgraph_output_in_order,
	output_weakrefs, cgraph_materialize_all_clones,
	cgraph_optimize): Likewise.
	* lto-cgraph.c (merge_profile_summaries): Likewise.
	(input_cgraph): Likewise.
	* ipa-pure-const.c (generate_summary): Likewise.
	(propagate): Likwise.
	* ipa-utils.c (ipa_reduced_postorder): Likewise.
	(ipa_free_postorder_info): Likewise.
	(ipa_reverse_postorder): Likewise.
	* ipa-inline.c (ipa_inline): Likewise.
	* matrix-reorg.c (find_matrices_decl): Likewise.
	(matrix_reorg): Likewise.
	* tree-vectorizer.c (increase_alignment): Likewise.
	* ipa.c (cgraph_remove_unreachable_nodes): Likewise.
	(function_and_variable_visibility): Likewise.
	(whole_program_function_and_variable_visibility): Likewise.
	(ipa_cdtor_merge): Likewise.
	* trans-mem.c (ipa_tm_execute): Likewise.
	* ipa-inline-analysis.c (dump_inline_summaries): Likewise.
	* ipa-prop.c (ipa_print_all_jump_functions): Likewise.
	(ipa_print_all_params): Likewise.
	(ipa_update_after_lto_read): Likewise.
	* tree-profie.c (tree_profiling): Likewise.
	* tree-ssa-structalias.c (ipa_pta_execute): Likewise.
	* passes.c (dump_passes): Likewise.
	(do_per_function): Likewise.
	(ipa_write_summaries): Likewise.
	* varpool.c (dump_varpool): Likewise.
	(varpool_node_for_asm): Likewise.
	(varpool_assemble_pending_decls): Likewise.


	* decl2.c (collect_candidates_for_java_method_alias): Use FOR_EACH
        walkers to walk cgraph and varpool.

	* lto.c (read_cgraph_and_symbols): Use FOR_EACH
        walkers to walk cgraph and varpool.
	(materialize_cgraph): Likewise.
	* lto-partition.c (lto_1_to_1_map): Likewise.
	(lto_balanced_map): Likewise.
	(lto_promote_cross_file_statics): Likewise.

From-SVN: r186492
2012-04-16 12:04:17 +00:00
Jan Hubicka 960bfb6929 cgraph.h: Update copyrights;
* cgraph.h: Update copyrights;
	(symtab_node): Turn to union typedef.
	(symtab_node_base): New structure.
	(symtab_type): Add SYMTAB_SYMBOL tag.
	* cgraph.c: Update references to fields
	(cgraph_hash, assembler_name_hash): Turn into symtab_node.
	(cgraph_local_info): Remove lto_file_data
	and externally_visible.
	(cgraph_node): Remove decl; same_comdat_group list;
	aux; ref_list; order; address_taken; reachable_from_other_parittion,
	in_other_partition; resolution.
	(varpool_node): Remove decl; same_comdat_group;
	ref_list; lto_file_data; aux; order; resolution; externally_visible;
	used_from_other_partition; in_other_partition.
	(symtab_node_def); New union.
	(cgraph, varpool): Update.
	(varpool_first_static_initializer, varpool_next_static_initializer,
	cgraph_only_called_directly_or_aliased_p,
	varpool_can_remove_if_no_refs, varpool_can_remove_if_no_refs,
	varpool_all_refs_explicit_p, cgraph_alias_aliased_node,
	varpool_alias_aliased_node, cgraph_edge_recursive_p): Update
	field references.
	* cgraph.c: Likewise.
	* cgraphbuild.c: Likewise.
	* lto-symtab.c: Likewise.
	* c-gimplify.c: Likewise.
	* value-prof.c: Likewise.
	* tree.c: Likewise.
	* ipa-cp.c: Likewise.
	* tree-emutls.c: Likewise.
	* ipa-inline-transform.c: Likwise.
	* ipa-reference.c: Likewise.
	* cgraphunit.c: Likewise.
	* ipa-ref.c: Likewise.
	* lto-cgraph.c: Likewise.
	* ipa-ref-inline.h: Likewise.
	* ipa-pure-const.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* ipa-utils.c: Likewise.
	* ipa-inline.c: Likewise.
	* matrix-reorg.c: Likewise.
	* tree-eh.c: Likewise.
	* tree-vectorizer.c: Likewise.
	* ipa-split.c: Likewise.
	* ipa.c: Likewise.
	* trans-mem.c: Likewise.
	* ipa-inline-analysis.c: Likewise.
	* gimplify.c: Likewise.
	* cfgexpand.c: Likewise.
	* tree-sra.c: Likewise.
	* ipa-prop.c: Likewise.
	* varasm.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* passes.c: Likewise.
	* varpool.c: Likewise.

	* tree.c: Update field referenced for new cgraph/varpool layout.
	* decl2.c: Likewise.

	* gcc-interface/trans.c (finalize_nrv): Update field referenced for new
	cgraph/varpool layout.

	* lto.c: Update field referenced for new cgraph/varpool layout.
	* lto-partition.c: Likewise.

From-SVN: r186450
2012-04-14 10:24:59 +00:00
Jason Merrill 7996b7273c re PR c++/52915 ([C++11] Deleted default-constructor of anonymous unions not honored)
PR c++/52915
	* decl2.c (finish_anon_union): Use cp_finish_decl.
	* error.c (dump_function_name): Avoid showing anonymous "name".

From-SVN: r186432
2012-04-13 15:43:37 -04:00
Jason Merrill 852497a31e Implement return type deduction for normal functions with -std=c++1y.
* cp-tree.h (FNDECL_USED_AUTO): New macro.
	(LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P): Remove.
	(dependent_lambda_return_type_node): Remove.
	(CPTI_DEPENDENT_LAMBDA_RETURN_TYPE): Remove.
	(struct language_function): Add x_auto_return_pattern field.
	(current_function_auto_return_pattern): New.
	(enum tsubst_flags): Add tf_partial.
	* decl.c (decls_match): Handle auto return comparison.
	(duplicate_decls): Adjust error message for auto return.
	(cxx_init_decl_processing): Remove dependent_lambda_return_type_node.
	(cp_finish_decl): Don't do auto deduction for functions.
	(grokdeclarator): Allow auto return without trailing return type in
	C++1y mode.
	(check_function_type): Defer checking of deduced return type.
	(start_preparsed_function): Set current_function_auto_return_pattern.
	(finish_function): Set deduced return type to void if not previously
	deduced.
	* decl2.c (change_return_type): Handle error_mark_node.
	(mark_used): Always instantiate functions with deduced return type.
	Complain about use if deduction isn't done.
	* parser.c (cp_parser_lambda_declarator_opt): Use 'auto' for
	initial return type.
	(cp_parser_lambda_body): Don't deduce return type in a template.
	(cp_parser_conversion_type_id): Allow auto in C++1y.
	* pt.c (instantiate_class_template_1): Don't mess with
	LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P.
	(tsubst_copy_and_build): Likewise.
	(fn_type_unification, tsubst): Don't reduce the template parm level
	of 'auto' during deduction.
	(unify): Compare 'auto' specially.
	(get_bindings): Change test.
	(always_instantiate_p): Always instantiate functions with deduced
	return type.
	(do_auto_deduction): Handle error_mark_node and lambda context.
	Don't check for use in initializer.
	(contains_auto_r): Remove.
	* search.c (lookup_conversions_r): Handle auto conversion function.
	* semantics.c (lambda_return_type): Handle null return.  Don't mess
	with dependent_lambda_return_type_node.
	(apply_deduced_return_type): Rename from apply_lambda_return_type.
	* typeck.c (merge_types): Handle auto.
	(check_return_expr): Do auto deduction.
	* typeck2.c (add_exception_specifier): Fix complain check.

From-SVN: r185768
2012-03-24 16:56:08 -04:00
Jason Merrill b50530246a re PR c++/51930 (Explicitly instantiated template gets hidden visibility)
PR c++/51930
	* decl2.c (determine_visibility): Correct calculation of class
	args depth.
	* decl.c (check_tag_decl): Adjust warning.

From-SVN: r184946
2012-03-05 13:08:56 -05:00
Jason Merrill 22197246e3 re PR c++/51930 (Explicitly instantiated template gets hidden visibility)
PR c++/51930
	* decl2.c (determine_visibility): Check for visibility attribute
	on template specialization.

From-SVN: r183455
2012-01-23 15:48:31 -05:00
Kai Tietz 54a9f5eac3 re PR c++/51344 (cc1plus hangs when compiling)
2012-01-19  Kai Tietz  <ktietz@redhat.com>

        PR c++/51344
        * decl2.c (save_template_attributes): Use merge_attributes
        instead of chaining up via TREE_CHAIN.

2012-01-19  Kai Tietz  <ktietz@redhat.com>

        * g++.dg/torture/pr51344.C: New test.

From-SVN: r183313
2012-01-19 23:15:26 +01:00
Steven Bosscher 8554df86e0 c-decl.c: Do not include tree-mudflap.h
gcc/
	* c-decl.c: Do not include tree-mudflap.h
	* tree-optimize.c: Likewise.
	* Makefile.in: Update dependencies.

cp/
	* decl2.c: Do not include tree-mudflap.h
	* semantics.c: Likewise.

From-SVN: r183165
2012-01-13 22:14:21 +00:00
Jason Merrill fc97053254 re PR c++/51813 (-fvisibility=hidden causes std::codecvt members to be undefined)
PR c++/51813
	* decl2.c (constrain_visibility): Clear DECL_VISIBILITY_SPECIFIED
	when reducing the visibility.

From-SVN: r183156
2012-01-13 12:50:58 -05:00
Jason Merrill 99c18869ef re PR c++/50973 ([C++0x] internal compiler error defaulted destructor virtual inheritance)
PR c++/50973
	* decl2.c (mark_used): Defer synthesis of virtual functions.
	* method.c (use_thunk): Make sure the target function has
	DECL_INTERFACE_KNOWN.

From-SVN: r181272
2011-11-10 16:14:42 -05:00
Dodji Seketeli acfdadb47b PR debug/51032 - ICE in dbxout_type, at dbxout.c:2372
gcc/cp/

	* decl2.c (check_member_template): Accept alias templates and ...
	* parser.c (cp_parser_alias_declaration): ... use it here.

gcc/testsuite/

	* g++.dg/cpp0x/alias-decl-debug-0.C: New test.

From-SVN: r181193
2011-11-09 08:51:12 +01:00
Dodji Seketeli 2870428932 PR c++/45114 - Support C++11 alias-declaration
gcc/cp/

	* cp-tree.h (TYPE_DECL_ALIAS_P, TYPE_ALIAS_P)
	(DECL_TYPE_TEMPLATE_P, DECL_ALIAS_TEMPLATE_P): New accessor
	macros.
	(TYPE_TEMPLATE_INFO): Get template info of an alias template
	specializations from its TYPE_DECL.
	(SET_TYPE_TEMPLATE_INFO): Set template info of alias template
	specializations into its TYPE_DECL.
	(DECL_CLASS_TEMPLATE_P): Re-write using the new
	DECL_TYPE_TEMPLATE_P.
	(enum cp_decl_spec): Add new ds_alias enumerator.
	(alias_type_or_template_p, alias_template_specialization_p):
	Declare new functions.
	* parser.c (cp_parser_alias_declaration): New static function.
	(cp_parser_check_decl_spec): Add "using" name for the `alias'
	declspec.
	(cp_parser_type_name): Update comment.  Support simple-template-id
	representing alias template specializations in c++0x mode.
	(cp_parser_qualifying_entity): Update comment.  Use
	cp_parser_type_name.
	(cp_parser_block_declaration): Handle alias-declaration in c++11.
	Update comment.
	(cp_parser_template_id): Handle specializations of alias
	templates.
	(cp_parser_member_declaration): Add alias-declaration production
	to comment.  Support alias-declarations.
	(cp_parser_template_declaration_after_export): Handle alias
	templates in c++11.
	* decl.c (make_typename_type, make_unbound_class_template): Accept
	alias templates.
	(grokdeclarator): Set TYPE_DECL_ALIAS_P on alias
	declarations.
	* decl2.c (grokfield): Move template creation after setting up the
	TYPE_DECL of the alias, so that the TEMPLATE_DECL of the alias
	template actually carries the right type-id of the alias
	declaration.
	* pt.c (alias_type_or_template_p)
	(alias_template_specialization_p): Define new public functions.
	(maybe_process_partial_specialization): Reject partial
	specializations of alias templates.
	(primary_template_instantiation_p): Consider alias template
	instantiations.
	(push_template_decl_real): Assert that TYPE_DECLs of alias
	templates are different from those of class template.  Store
	template info onto the TYPE_DECL of the alias template.
	(convert_template_argument): Strip aliases from template
	arguments.
	(lookup_template_class_1): Handle the creation of the
	specialization of an alias template.
	(tsubst_decl): Create a substituted copy of the TYPE_DECL of an
	member alias template.
	(tsubst): Handle substituting into the type of an alias template.
	Handle substituting UNBOUND_CLASS_TEMPLATE into
	BOUND_TEMPLATE_TEMPLATE_PARM.
	(do_type_instantiation): Better diagnostics when trying to
	explicitely instantiate a non-class template.
	* search.c (lookup_field_1, lookup_field_r): Support looking up
	alias templates.
	* semantics.c (finish_template_type): For instantiations of alias
	templates, return the TYPE_DECL of the actual alias and not the
	one of the aliased type.
	* error.c (dump_alias_template_specialization): New static
	function.
	(dump_type): Handle printing of alias templates and their
	specializations.  templates.
	(dump_aggr_type): For specialization of alias templates, fetch
	arguments from the right place.
	(dump_decl): Print an alias-declaration like `using decl = type;'
	(dump_template_decl):  Support printing of alias templates.

gcc/testsuite/

	* g++.dg/cpp0x/alias-decl-0.C: New test case.
	* g++.dg/cpp0x/alias-decl-1.C: Likewise.
	* g++.dg/cpp0x/alias-decl-3.C: Likewise.
	* g++.dg/cpp0x/alias-decl-4.C: Likewise.
	* g++.dg/cpp0x/alias-decl-6.C: Likewise.
	* g++.dg/cpp0x/alias-decl-7.C: Likewise.
	* g++.dg/cpp0x/alias-decl-8.C: Likewise.
	* g++.dg/cpp0x/alias-decl-9.C: Likewise.
	* g++.dg/cpp0x/alias-decl-10.C: Likewise.
	* g++.dg/ext/alias-decl-attr1.C: Likewise.
	* g++.dg/ext/alias-decl-attr2.C: Likewise.
	* g++.dg/ext/alias-decl-attr3.C: Likewise.
	* g++.dg/ext/alias-decl-attr4.C: Likewise.

From-SVN: r181118
2011-11-07 22:28:50 +01:00
Jason Merrill 6d87092d19 re PR c++/35688 (template visibility not overridden by template arguments)
PR c++/35688
	* decl2.c (constrain_visibility): Return void.  Add tmpl parm
	which gives the constraint priority over an attribute.
	(constrain_visibility_for_template, determine_visibility): Adjust.
	* pt.c (instantiate_class_template_1): Call determine_visibility.

From-SVN: r181102
2011-11-07 12:51:40 -05:00
Jason Merrill 8e7860a17b re PR c++/35688 (template visibility not overridden by template arguments)
PR c++/35688
gcc/c-common/
	* c-common.c (decl_has_visibility_attr): Split out from...
	(c_determine_visibility): ...here.
	* c-common.h: Declare it.
gcc/cp/
	* decl2.c (constrain_visibility): Check decl_has_visibility_attr
	rather than DECL_VISIBILITY_SPECIFIED.

From-SVN: r181069
2011-11-06 23:40:14 -05:00
Paolo Carlini 9965f21f9c re PR c++/47695 ([C++0X] Calling a deleted function fails twice)
2011-11-06  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/47695
	* decl2.c (mark_used): Early return false after error or sorry.
	* cp-tree.h (mark_used): Adjust declaration.
	* semantics.c (finish_id_expression): Check mark_used return value.

From-SVN: r181042
2011-11-06 21:05:44 +00:00
Jason Merrill b25dd954c4 re PR c++/48370 (G++ fails to extend reference temporary lifetime in some situations)
PR c++/48370
	* call.c (extend_ref_init_temps, extend_ref_init_temps_1): New.
	(set_up_extended_ref_temp): Use it.  Change cleanup parm to VEC.
	(initialize_reference): Just call convert_like.
	* decl.c (grok_reference_init): Just call initialize_reference.
	(build_init_list_var_init): Remove.
	(check_initializer): Change cleanup parm to VEC.  Handle references
	like other types.  Call perform_implicit_conversion instead
	of build_init_list_var_init.  Don't use build_aggr_init for
	aggregate initialization of arrays.
	(cp_finish_decl): Change cleanup to VEC.
	* typeck2.c (store_init_value): Call extend_ref_init_temps.
	Use build_vec_init for non-constant arrays.
	* init.c (expand_aggr_init_1): Adjust.
	(build_vec_init): Avoid re-converting an initializer
	that's already digested.
	* mangle.c (mangle_ref_init_variable): Add a discriminator.
	* cp-tree.h: Adjust.
	* typeck.c (convert_for_initialization): Adjust.
	* decl2.c (maybe_emit_vtables): Adjust.

From-SVN: r180944
2011-11-04 08:54:08 -04:00
Roberto Agostino Vitillo fb9120e3b1 re PR c++/30066 (option to make inline functions hidden)
PR c++/30066
gcc/c-family:
	* c.opt (fvisibility-inlines-hidden): Description change.
gcc/cp:
	* decl2.c (determine_hidden_inline): New function.
	(determine_visibility): fvisibility-inlines-hidden affects inline
	functions.

From-SVN: r180589
2011-10-27 22:18:00 -04:00
Paolo Carlini c5ce25ce93 re PR c++/50870 ([C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments)
2011-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

	* typeck.c (cp_build_addr_expr_1): Use BASELINK_P.
	* class.c (instantiate_type): Likewise.
	* pt.c (convert_nontype_argument_function, uses_template_parms,
	tsubst_copy, resolve_nondeduced_context, type_dependent_expression_p):
	Likewise.
	* semantics.c (finish_decltype_type): Likewise.
	* decl2.c (mark_used): Likewise.
	* name-lookup.c (arg_assoc): Likewise.

/cp
2011-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50870
	* typeck.c (non_reference): Pass NULL_TREE through.

/testsuite
2011-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50870
	* g++.dg/cpp0x/decltype34.C: New.

From-SVN: r180531
2011-10-26 17:59:36 +00:00
Jason Merrill eb02633818 Handle deferred parsing of NSDMIs.
* parser.h (cp_unparsed_functions_entry): Add nsdmis field.
	* parser.c (unparsed_nsdmis, cp_parser_save_nsdmi): New.
	(cp_parser_late_parse_one_default_arg): Split out from
	cp_parser_late_parsing_default_args.
	(cp_parser_late_parsing_nsdmi): New.
	(push_unparsed_function_queues): Set it.
	(cp_parser_parameter_declaration): Save the '=' token.
	(cp_parser_template_parameter): Likewise.
	(cp_parser_default_argument): Call cp_parser_initializer
	rather than cp_parser_initializer_clause.
	(cp_parser_class_specifier_1): Parse unparsed_nsdmis.
	(cp_parser_member_declaration): Handle nsdmis.
	* decl2.c (grokfield): Handle DEFAULT_ARG for a function.

From-SVN: r179156
2011-09-24 22:26:01 -04:00
Jason Merrill 0e5f8a598d Implement C++11 non-static data member initializers.
* cp-tree.h (enum cpp_warn_str): Add CPP0X_NSDMI.
	* error.c (maybe_warn_cpp0x): Handle it.
	* call.c (convert_like_real) [ck_user]: Don't complain about
	using an explicit constructor for direct-initialization.
	* class.c (check_field_decl): Fix ancient typo.
	(check_field_decls): NSDMIs make the default ctor non-trivial.
	* decl.c (cp_finish_decl): Record NSDMI.
	(grokdeclarator): Allow NSDMI.
	* decl2.c (grokfield): Allow NSDMI.  Correct LOOKUP flags.
	* init.c (perform_member_init): Use NSDMI.
	* method.c (walk_field_subobs): Check for NSDMI.
	* parser.c (cp_parser_member_declaration): Parse { } init.
	* semantics.c (register_constexpr_fundef): Don't talk about
	a return statement in a constexpr constructor.
	(cxx_eval_call_expression): Check DECL_INITIAL instead of
	DECL_SAVED_TREE.

From-SVN: r179155
2011-09-24 22:25:52 -04:00
Dodji Seketeli 3797cb21ff PR c++/33255 - Support -Wunused-local-typedefs warning
gcc/

	* c-decl.c (lookup_name): Use the new
	maybe_record_typedef_use.
	(pushdecl): Use the new
	record_locally_defined_typedef.
	(store_parm_decls): Allocate cfun->language.
	(finish_function): Use the new maybe_warn_unused_local_typedefs,
	and free cfun->language.
	(c_push_function_context): Allocate cfun->language here only if
	needed.
	(c_pop_function_context): Likewise, mark cfun->language
	for collection only when it should be done.
	* c-common.c (handle_used_attribute): Don't ignore TYPE_DECL
	nodes.
	* c-typeck.c (c_expr_sizeof_type, c_cast_expr): Use the new
	maybe_record_local_typedef_use.

gcc/c-family

	* c-common.h (struct c_language_function::local_typedefs): New
	field.
	(record_locally_defined_typedef, maybe_record_typedef_use)
	(maybe_warn_unused_local_typedefs): Declare new functions.
	* c-common.c (record_locally_defined_typedef)
	(maybe_record_typedef_use)
	(maybe_warn_unused_local_typedefs): Define new functions.
	* c.opt: Declare new -Wunused-local-typedefs flag.

gcc/cp

	* name-lookup.c (pushdecl_maybe_friend_1): Use the new
	record_locally_defined_typedef.
	* decl.c (finish_function): Use the new
	maybe_warn_unused_local_typedefs.
	(grokfield): Use the new record_locally_defined_typedef.
	* parser.c (lookup_name): Use the new maybe_record_typedef_use.

gcc/doc/

	* invoke.texi: Update documentation for -Wunused-local-typedefs.

gcc/testsuite/

	* g++.dg/warn/Wunused-local-typedefs.C: New test file.
	* c-c++-common/Wunused-local-typedefs.c: Likewise.

libstdc++-v3/

	* include/ext/bitmap_allocator.h
	(__detail::__mini_vector::__lower_bound): Remove unused typedef.
	* src/istream.cc (std::operator>>(basic_istream<char>& __in,
	basic_string<char>& __str)): Likewise.
	(std::getline): Likewise.
	* src/valarray.cc (__valarray_product): Likewise.

From-SVN: r178692
2011-09-08 15:54:24 +02:00
Jason Merrill b6c917ff5d Make-lang.in (check-g++-strict-gc): New.
* Make-lang.in (check-g++-strict-gc): New.
	(cp/except.o): Depend on gt-cp-except.h
	* except.c: Include gt-cp-except.h.
	* config-lang.in (gtfiles): Add cp/except.c.
	* decl2.c (mark_used): Adjust constexpr condition, set
	function_depth around template instantiation.
	* parser.c (cp_parser_lambda_body): Set function_depth.
	* semantics.c (maybe_add_lambda_conv_op): Likewise.

From-SVN: r176350
2011-07-16 00:11:53 -04:00
Jason Merrill 5fb8060d5b * decl2.c (decl_constant_var_p): Use decl_maybe_constant_var_p.
From-SVN: r176177
2011-07-11 14:52:19 -04:00
Jason Merrill 4904b64bf7 re PR c++/44609 (Invalid template code causes infinite loop of error messages)
PR c++/44609
	* cp-tree.h (struct tinst_level): Add errors field.
	* pt.c (neglectable_inst_p, limit_bad_template_recurson): New.
	(push_tinst_level): Don't start another decl in that case.
	(reopen_tinst_level): Adjust errors field.
	* decl2.c (cp_write_global_declarations): Don't complain about
	undefined inline if its template was defined.
	* mangle.c (mangle_decl_string): Handle failure from push_tinst_level.

From-SVN: r176176
2011-07-11 14:52:12 -04:00
Paolo Carlini 165d997d2a re PR c++/44625 (ICE after error: anonymous struct not inside named type)
/cp
2011-06-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44625
	* decl2.c (build_anon_union_vars): Early return error_mark_node
	for a nested anonymous struct.

/testsuite
2011-06-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44625
	* g++.dg/template/crash107.C: New.
	* g++.dg/template/error17.C: Adjust.

From-SVN: r175344
2011-06-23 16:58:28 +00:00
Jason Merrill 767de87d05 re PR c++/49507 (ICE because of defaulted template destructor)
PR c++/49507
	* decl2.c (mark_used): Don't call synthesize_method for
	functions defaulted outside the class.

From-SVN: r175342
2011-06-23 12:53:03 -04:00
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