Commit Graph

1155 Commits

Author SHA1 Message Date
Arnaud Charlet 3b78de5632 dumpfile.h, dumpfile.c: Remove TDI_ada.
2012-10-04  Arnaud Charlet  <charlet@adacore.com>

	* dumpfile.h, dumpfile.c: Remove TDI_ada.

c-family/
	* c-ada-spec.c (print_ada_declaration): Remove handling of TDF_RAW.
	* c.opt (-fdump-ada-spec, -fdump-ada-spec-slim): Move switch definition
	out of dumpfile.h.

c/
	* c-decl.c (c_write_global_declarations): Fix handling of
	-fdump-ada-spec*.

cp/
        * decl2.c (cp_write_global_declarations): Fix handling of
        -fdump-ada-spec*.

From-SVN: r192067
2012-10-04 10:51:31 +02:00
Sharad Singhai 78c60e3da2 invoke.texi: Add documentation for the new option.
2012-09-30  Sharad Singhai  <singhai@google.com>

	* doc/invoke.texi: Add documentation for the new option.
	* tree-dump.c: Move general dump file related functionality into
	dumpfile.c. Remove unneeded headers.
	* tree-dump.h: Move function declarations into dumpfile.h.
	* dumpfile.h: Include "line-map.h". Add defines for MSG flags.
	(struct dump_file_info): Move here from tree-dump.c.  Rename flags
	to pflags, state to pstate, stream to pstream, filename to
	pfilename. All callers updated. Add alt_flags, alt_state,
	alt_filenmae, alt_stream.
	* tree-vectorizer.c: Include "dumpfile.h". Remove vect_dump.
	(vect_set_dump_settings): Remove.
	(vect_print_dump_info): Ditto.
	* tree-vectorizer.h: Remove declaration of vect_dump and
	vect_print_dump_info.
	* tree-vect-loop.c: Include "dumpfile.h". Use new dump style.
	* tree-vect-data-refs.c: Ditto.
	* tree-vect-stmts.c: Ditto.
	* tree-vect-slp.c: Ditto.
	* tree-vect-patterns.c: Ditto.
	* tree-vect-loop-manip.c: Ditto.
	* testsuite/gcc.target/i386/vect-double-1.c: Fix test.
	* opts.c (vect_set_verbosity_level): Remove.
	(common_handle_option): Handle -fopt-info flag. Deprecate
	-ftree-vectorizer-verbose.
	* tree-parloops.c (gather_scalar_reductions): Remove reference to
	vect_dump.
	* flag-types.h: Remove vect_verbosity_levels.
	* common.opt: Add -fopt-info. Deprecate -ftree-vectorizer-verbose.
	* opts-global.c (dump_remap_tree_vectorizer_verbose): New
	function.
	(handle_common_deferred_options): Handle -fopt-info and
	-ftree-vectorizer-verbose.
	* Makefile.in: Add dumpfile.o.
	(tree-dump.o): Update dependencies.
	(tree-vect-loop.o): Ditto.
	(tree-vect-loop-manip.o): Ditto.
	(tree-vect-slp.o): Ditto.
	(tree-vect-stmts.o): Ditto.
	(tree-vectorizer.o): Ditto.
	(opts.o): Ditto.
	* passes.c (finish_optimization_passes): Instead of using
	dump_begin/dump_end, use dump_start/dump_finish. Do not use dump_file.
	(pass_init_dump_file): Ditto.
	* c-decl.c (c_write_global_declarations): Use a different method
	to determine if the dump has ben initialized.
	* decl2.c (cp_write_global_declarations): Use a different method
	to determine if the dump has ben initialized.

From-SVN: r191883
2012-10-01 05:43:06 +00:00
Paolo Carlini 18140454ab re PR c++/54738 ([C++11][SFINAE] Hard errors for pointer-to-member function expressions)
/cp
2012-09-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/54738
	* decl2.c (build_offset_ref_call_from_tree): Add tsubst_flags_t
	parameter.
	* pt.c (tsubst_copy_and_build): Adjust.
	* parser.c (cp_parser_postfix_expression): Likewise.
	* cp-tree.h: Adjust declaration.

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

	PR c++/54738
	* g++.dg/cpp0x/sfinae42.C: New.

From-SVN: r191862
2012-09-29 22:58:31 +00:00
Dodji Seketeli d10402b413 PR c++/54372 - unused attribute inactive on dependant entities
In the example of this patch, gcc/g++ invoked with
-Wunused-local-typedefs warns on dependant entities even when those
are decorated with the 'unused' attribute.

This is because in cplus_decl_attributes, save_template_attributes
makes so that the 'unused' attribute is applied to its appertaining
entity only at instantiation time.  But then at parsing time
maybe_warn_unused_local_typedefs checks for TREE_USED before warning.

This patch applies the 'unused' attribute at compilation time.

Tested on x86_64-unknown-linux-gnu against trunk.

gcc/cp/

	* decl2.c (is_late_template_attribute): "unused" attribute is to
	be applied at compile time.

gcc/testsuite/

	* c-c++-common/Wunused-local-typedefs-2.c: New test.

From-SVN: r191830
2012-09-28 15:32:41 +02:00
Paolo Carlini 12308bc61d typeck.c (build_indirect_ref, [...]): Remove uses of ATTRIBUTE_UNUSED on the parameters.
2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>

	* typeck.c (build_indirect_ref, build_function_call,
	build_function_call_vec, build_binary_op, build_unary_op,
	build_compound_expr, build_c_cast, build_modify_expr): Remove
	uses of ATTRIBUTE_UNUSED on the parameters.
	* class.c (set_linkage_according_to_type, resort_type_method_vec,
	dfs_find_final_overrider_post, empty_base_at_nonzero_offset_p):
	Likewise.
	* decl.c (local_variable_p_walkfn): Likewise.
	* except.c (wrap_cleanups_r, check_noexcept_r): Likewise.
	* error.c (find_typenames_r): Likewise.
	* tree.c (verify_stmt_tree_r, bot_replace,
	handle_java_interface_attribute, handle_com_interface_attribute,
	handle_init_priority_attribute, c_register_addr_space): Likewise.
	* cp-gimplify.c (cxx_omp_clause_default_ctor): Likewise.
	* cp-lang.c (objcp_tsubst_copy_and_build): Likewise.
	* pt.c (unify_success, unify_invalid, instantiation_dependent_r):
	Likewise.
	* semantics.c (dfs_calculate_bases_pre): Likewise.
	* decl2.c (fix_temporary_vars_context_r, clear_decl_external):
	Likewise.
	* parser.c (cp_lexer_token_at, cp_parser_omp_clause_mergeable,
	cp_parser_omp_clause_nowait, cp_parser_omp_clause_ordered,
	cp_parser_omp_clause_untied): Likewise.
	* mangle.c (write_unnamed_type_name,
	discriminator_for_string_literal): Likewise.
	* search.c (dfs_accessible_post, dfs_debug_mark): Likewise.
	* lex.c (handle_pragma_vtable, handle_pragma_unit,
	handle_pragma_interface, handle_pragma_implementation,
	handle_pragma_java_exceptions): Likewise.

From-SVN: r191281
2012-09-13 22:20:14 +00:00
Paolo Carlini f27a59cf8a re PR c++/51421 ([c++0x] ICE with invalid use of auto)
/cp
2012-08-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51421
	* decl2.c (mark_used): Consistently return false after errors
	about uses before deduction of auto.
	* semantics.c (finish_id_expression): Check mark_used return
	value and return error_mark_node in case of failure.

/testsuite
2012-08-25  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51421
	* g++.dg/cpp0x/auto34.C: New.

From-SVN: r190665
2012-08-25 09:53:30 +00:00
Steven Bosscher 7ee2468b92 system.h (dump_file): Do not define.
gcc/
	* system.h (dump_file): Do not define.
	* tree-pass.h: Include dumpfile.h, which is a new file containing...
	(enum tree_dump_index, TDF_*, get_dump_file_name, dump_enabled_p,
	dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p,
	dump_flag_name, dump_file, dump_flags, dump_file_name,
	get_dump_file_info, struct dump_file_info): all of this, moved to...
	* dumpfile.h: Here, new file.
	* tree-dump.h: Include dumpfile.h, but not tree-pass.h.
	(dump_stmt): Remove prototype for C++ specific function.
	(dump_enumerated_decls): Move prototype from here...
	* tree-flow.h (dump_enumerated_decls): ... to here.
	(get_ref_base_and_extent) Move prototype from here ...
	* tree.h (get_ref_base_and_extent) ... to here.
	* tree-ssa-live.c: Do not inclde tree-pretty-print.h, because
	gimple-pretty-print.h is enough.  Do not include tree-dump.h,
	include timevar.h and dumpfile.h instead.
	(struct numbered_tree_d, compare_decls_by_uid,
	dump_enumerated_decls_push, dump_enumerated_decls): Move from here ...
	* tree-dfa.c:(struct numbered_tree_d, compare_decls_by_uid,
	dump_enumerated_decls_push, dump_enumerated_decls):... to here.
	Do not include timevar.h.
	* tree.c: Do not include timevar.h.
	* tree-cfg.c: Do not include langhooks.h, tree-pretty-print.h, and
	timevar.h.
	(dump_cfg_stats): Use current_function_name.
	(gimple_cfg2vcg): Likewise.
	(dump_function_to_file): Likewise.
	* df-scan.c: Do not include tree-pass.h and timevar.h.
	Include dumpfile.h.
	(df_entry_block_bitmap_verify, df_exit_block_bitmap_verify): Do not
	use print_current_pass.
	* df-problems.c: Include dumpfile.h.
	Always define REG_DEAD_DEBUGGING, avoid #ifdef code, because it
	leads to errors in the code not selected.
	(df_note_compute): Do not print_rtl_with_bb here.  Fix compilation
	bug if REG_DEAD_DEBUGGING is not 0, get_insns is not available here.
	* lcm.c: Include dumpfile.h.
	Remove obsolete include of insn-attr.h.
	* dojump.c (do_compare_rtx_and_jump): Remove failure printing for
	missing probability notes.
	* stmt.c: Include dumpfile.h.
	(emit_case_decision_tree): Re-enable printing expand details only
	if TDF_DETAILS.
	* alias.c, auto-inc-dec.c, bb-reorder.c, caller-save.c, cfg.c, 
	cfgcleanup.c, cfgexpand.c, cfgloop.c, cfgloopmanip.c, cgraph.c, 
	cgraphclones.c, cgraphunit.c, combine.c, combine-stack-adj.c, 
	coverage.c, cprop.c, cse.c, cselib.c, dbgcnt.c, dce.c, df-core.c, 
	dse.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, final.c, 
	function.c, fwprop.c, gcse.c, gimple-fold.c, 
	gimple-pretty-print.c, gimple-ssa-strength-reduction.c, 
	gimplify.c, graphite-blocking.c, graphite-clast-to-gimple.c, 
	graphite-dependences.c, graphite-interchange.c, 
	graphite-optimize-isl.c, graphite-poly.c, 
	graphite-sese-to-poly.c, haifa-sched.c, hw-doloop.c, ifcvt.c, 
	ipa.c, ipa-cp.c, ipa-inline-analysis.c, ipa-inline.c, 
	ipa-inline-transform.c, ipa-prop.c, ipa-pure-const.c, 
	ipa-reference.c, ipa-split.c, ipa-utils.c, ira.c, ira-emit.c, 
	jump.c, loop-doloop.c, loop-init.c, loop-invariant.c, loop-iv.c, 
	loop-unroll.c, loop-unswitch.c, lower-subreg.c, 
	lto-section-out.c, lto-streamer-in.c, matrix-reorg.c, mcf.c, 
	mode-switching.c, modulo-sched.c, omega.c, omp-low.c, passes.c, 
	plugin.c, postreload.c, postreload-gcse.c, predict.c, print-rtl.c, 
	print-tree.c, profile.c, recog.c, ree.c, regcprop.c, reginfo.c, 
	regmove.c, regrename.c, reg-stack.c, reload1.c, reorg.c, 
	sched-rgn.c, sched-vis.c, sel-sched.c, sel-sched-ir.c, 
	store-motion.c, tracer.c, trans-mem.c, tree-affine.c, 
	tree-call-cdce.c, tree-cfgcleanup.c, tree-chrec.c, 
	tree-data-ref.c, tree-diagnostic.c, tree-dump.c,
	tree-eh.c, tree-flow-inline.h, tree-if-conv.c, tree-into-ssa.c, 
	tree-mudflap.c, tree-nrv.c, tree-object-size.c, 
	tree-optimize.c, tree-outof-ssa.c, tree-predcom.c, 
	tree-pretty-print.c, tree-profile.c, tree-scalar-evolution.c, 
	tree-sra.c, tree-ssa-address.c, tree-ssa-alias.c, tree-ssa.c, 
	tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-copy.c, 
	tree-ssa-copyrename.c,, tree-ssa-dce.c, tree-ssa-dom.c, 
	tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, 
	tree-ssa-loop.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, 
	tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, 
	tree-ssa-loop-manip.c, tree-ssa-loop-niter.c, 
	tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, 
	tree-ssa-math-opts.c, tree-ssa-operands.c, tree-ssa-phiopt.c, 
	tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-propagate.c, 
	tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-sink.c, 
	tree-ssa-structalias.c, tree-ssa-tail-merge.c, tree-ssa-ter.c, 
	tree-ssa-threadedge.c, tree-ssa-threadupdate.c, 
	tree-ssa-uncprop.c, tree-ssa-uninit.c, 
	tree-switch-conversion.c, tree-tailcall.c, 
	tree-vect-data-refs.c, tree-vect-loop.c, 
	tree-vect-loop-manip.c, tree-vectorizer.c, 
	tree-vect-patterns.c, tree-vect-slp.c, tree-vect-stmts.c, 
	tree-vrp.c, value-prof.c, var-tracking.c, web.c: Include tree-pass.h
	only if needed.  If tree-pass.h is included, do not include timevar.h
	and dumpfile.h.  If tree-pass.h is not included but dump_file, or
	dump_flags, or the TDF_* flags are used, include dumpfile.h.
	If gimple-pretty-print.h is included, don't include tree-pretty-print.h.
	Remove assorted unnecessary includes.

	* config/mn10300/mn10300.c, config/c6x/c6x.c, config/ia64/ia64.c,
	config/arm/arm.c, config/bfin/bfin.c, config/frv/frv.c,
	config/spu/spu.c, config/mep/mep.c, config/i386/i386.c:
	Include dumpfile.h.
	* config/rl78/rl78.c: Include dumpfile.h instead of tree-pass.h.
	* arm/t-arm, avr/t-avr, i386/t-i386, ia64/t-ia64, mep/t-mep,
	spu/t-spu-elf: Fix dependencies.

c-family/
	* c-gimplify.c: Include dumpfile.h instead of tree-dump.h.
	* c-ada-spec.c: Likewise.
	* c-dump.c (dump_stmt): Move to cp/dump.c, the only user.

c/
	* c-decl.c: Include dumpfile.h instead of tree-dump.h.
	* Make-lang.in: Fix dependencies.

cp/
	* dump.c (dump_stmt): Moved here from c-dump.c.
	* optimize.c: Include dumpfile.h instead of tree-dump.h.
	* class.c: Likewise.
	* decl2.c: Likewise.
	* Make-lang.in: Fix dependencies.

fortran/
	* f95-lang.c: Include dumpfile.h instead of tree-dump.h.
	* Make-lang.in: Fix dependencies.

java/
	* java-gimplify.c Include dumpfile.h instead of tree-dump.h
	* Make-lang.in: Fix dependencies.

lto/
	* lto.c: Do not include timevar.h.
	* Make-lang.in: Fix dependencies.

ada/
	* gcc-interface/utils.c: Include timevar.h.
	* Make-lang.in: Fix dependencies.

From-SVN: r189519
2012-07-16 11:32:42 +00:00
Jason Merrill 8d0d1915d9 re PR c++/53524 (Bogus enum comparison warning)
PR c++/53524
gcc/cp/
	* call.c (build_conditional_expr_1): Don't warn about comparison of
	two enumerators before their enumeration is complete.
	(build_new_op_1): Call decay_conversion before warn_logical_operator.
	* decl.c (build_enumerator): Set DECL_CONTEXT of an enumerator to
	its enumeration.
	* decl2.c (mark_used): Call used_types_insert for enums.
	* semantics.c (finish_id_expression): Don't decay CONST_DECL.
	(finish_member_declaration): Don't change DECL_CONTEXT of enumerators.
	* class.c (check_field_decls): Don't change DECL_CONTEXT of enums.
	* typeck.c (convert_for_assignment): Don't decay CONST_DECL.
	(build_class_member_access_expr): Look through unscoped enums.
	* search.c (context_for_name_lookup): Look through unscoped enums.
	* pt.c (tsubst_copy_and_build): Don't decay CONST_DECL.
	(tsubst_copy): Use DECL_CONTEXT to find the enumeration.
	* tree.c (decl_linkage): Likewise.
	* cvt.c (ocp_convert): Check decayed expr for enum range warning.
gcc/c-family/
	* c-common.c (get_priority): Call default_conversion.

From-SVN: r189174
2012-07-02 15:14:23 -04:00
Lawrence Crowl a910399dfd The intent of the phases was to have a high-level but mutually exclusive accounting of compile time.
The intent of the phases was to have a high-level but mutually exclusive
accounting of compile time.  We want to track compile time in a way that
tells us which conceptual phases are taking the most time.  That intent
is not currently satisfied.  This patch restores that intent.

Add code to verify that the sum of the phase times is less than the total
time, to detect when phases are overlapped.  A slight amount of leeway is
required due to time jitters.  This verification is done as the last step
in printing timevars so that any timevar information is not lost.

Rename the phases to be clearer about what they measure, so that they
are less likely to be modified to be overlapping.  The primary example
is to change TV_PHASE_GENERATE to TV_PHASE_LATE_ASM, meaning late work
on the assembly.  This name change avoids confusion n moving the timevar
start call after the call to lang_hooks.decls.final_write_globals, which
prevents overlapping phases.

Each implementation of lang_hooks.decls.final_write_globals, is responsible
for starting and stopping its own phases.  Each implementation currently has
a first phase of TV_PHASE_DEFERRED for front-end work deferred until after
parsing is complete.  The second phase has been renamed from TV_PHASE_CGRAPH
to TV_PHASE_OPT_GEN, to better reflect its use as the main optimization
and generation phase.  This phase accounts for 70%-80% of compilation time
during bootstrap.  The third phase is TV_PHASE_DBGINFO, except in cp/decl2.c,
where it is TV_PHASE_CHECK_DBGINFO because cc1plus mixes checking in with
debug info generation.  In langhooks.c, write_global_declarations was
using TV_PHASE_CHECK_DBGINFO, but it was doing no checking.  So, it now
uses TV_PHASE_DBGINFO.

The changes to LTO are significant.  First, initialization now uses
TV_PHASE_SETUP.  Reading files now uses TV_PHASE_STREAM_IN.  Writing files
now uses TV_PHASE_STREAM_OUT.  The remaining phase is TV_PHASE_OPT_GEN
(formerly TV_PHASE_CGRAPH).  Finally, because LTO is treated as a front
end, TV_PHASE_PARSING and TV_PARSE_GLOBAL active around it.  It is not
parsing, and so those timers should not be active.  Rather than make all
front ends manage them, we turn them off as the first thing in LTO and turn
them back on as the last thing.

Tested on x86_64.


Index: gcc/ChangeLog

2012-06-18  Lawrence Crowl  <crowl@google.com>

	* timevar.def (TV_PHASE_GENERATE): Rename to TV_PHASE_LATE_ASM.
	(TV_PHASE_CGRAPH): Rename to TV_PHASE_OPT_GEN.
	(TV_PHASE_STREAM_IN): New.
	(TV_PHASE_STREAM_OUT): New.
	* timevar.c (validate_phases): New.
	(timevar_print): Call validate_phases.
	* c-decl.c (c_write_global_declarations): Rename use of TV_PHASE_CGRAPH
	to TV_PHASE_OPT_GEN.
	* langhooks.c (write_global_declarations): Rename use of
	TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN.  Use TV_PHASE_DBGINFO instead of
	TV_PHASE_CHECK_DBGINFO.
	* toplev.c (compile_file): Rename use of TV_PHASE_GENERATE to
	TV_PHASE_LATE_ASM.  Move start of TV_PHASE_LATE_ASM to after call to
	lang_hooks.decls.final_write_globals.

Index: gcc/cp/ChangeLog

2012-06-18  Lawrence Crowl  <crowl@google.com>

	* decl2.c (cp_write_global_declarations): Rename use of TV_PHASE_CGRAPH
	to TV_PHASE_OPT_GEN.

Index: gcc/lto/ChangeLog

2012-06-18  Lawrence Crowl  <crowl@google.com>

        * lto.c (do_whole_program_analysis):  Rename use of TV_PHASE_CGRAPH to
	TV_PHASE_OPT_GEN.  Use new timevar TV_PHASE_STREAM_OUT around the call
	to lto_wpa_write_files.
	(lto_main):  Rename use of TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN.  Move
	start of TV_PHASE_OPT_GEN to include call to materialize_cgraph.  Use
	TV_PHASE_SETUP for the call to lto_init.  Use new timevar
	TV_PHASE_STREAM_IN around the call to read_cgraph_and_symbols.
	Turn TV_PHASE_PARSING off then back on again, because LTO is pretending
	to be a front end, but is not one.

From-SVN: r188765
2012-06-19 01:30:31 +00:00
Jason Merrill 637f68e8d2 pt.c (tsubst_expr): Instantiate local class.
* pt.c (tsubst_expr) [TAG_DEFN]: Instantiate local class.
	* class.c (finish_struct): Don't add a TAG_DEFN for a lambda.
	* decl2.c (finish_static_data_member_decl): Avoid redundant error.

From-SVN: r188474
2012-06-12 14:32:13 -04:00
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