Commit Graph

950 Commits

Author SHA1 Message Date
Nathan Sidwell 056f95ec95 [preprocessor/91639] #includes at EOF
https://gcc.gnu.org/ml/gcc-patches/2019-09/msg00280.html
	libcpp/
	PR preprocessor/91639
	* directives.c (do_include_common): Tell lexer we're a #include.
	* files.c (_cpp_stack_file): Lexer will have always incremented.
	* internal.h (struct cpp_context): Extend in_directive's
	semantics.
	* lex.c (_cpp_lex_direct): Increment line for final \n when lexing
	for an ISO #include.
	* line-map.c (linemap_line_start): Remember if we overflowed.

	gcc/testsuite/
	PR preprocessor/91639
	* c-c++-common/cpp/pr91639.c: New.
	* c-c++-common/cpp/pr91639-one.h: New.
	* c-c++-common/cpp/pr91639-two.h: New.

From-SVN: r275402
2019-09-05 11:23:48 +00:00
Ulrich Weigand 2f2aeda98f Remove Cell Broadband Engine SPU targets
From-SVN: r275343
2019-09-03 15:08:28 +00:00
Nathan Sidwell b0d11f1ed6 [preprocessor] Include stacking
https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01971.html
	* internal.h (enum include_type): Add IT_MAIN, IT_DIRECTIVE_HWM,
	IT_HEADER_HWM.
	(_cpp_stack_file): Take include_type, not a bool.
	* files.c (_cpp_find_file): Refactor to not hide an if inside a
	for conditional.
	(should_stack_file): Break apart to ...
	(is_known_idempotent_file, has_unique_contents): ... these.
	(_cpp_stack_file): Replace IMPORT boolean with include_type enum.
	Refactor to use new predicates.  Do linemap compensation here ...
	(_cpp_stack_include): ... not here.
	* init.c (cpp_read_main_file): Pass IT_MAIN to _cpp_stack_file.

From-SVN: r275034
2019-08-29 14:06:32 +00:00
Nathan Sidwell a0be978a82 [Preprocessor] small cleanups
https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01904.html
	* directives-only.c (_cpp_preprocess_dir_only): Use false, not
	zero for _cpp_handle_directive call.
	* directives.c (_cpp_handle_directive): Indented is bool.
	* files.c (struct _cpp_file): Make bools 1 bit bitfields.
	* internal.h (enum include_type): Reformat and comment.
	(struct cpp_buffer): Make flags 1 bit bitfields.
	(_cpp_handle_directive): Indented is bool.

From-SVN: r274999
2019-08-28 18:43:37 +00:00
Joseph Myers c94fe79e1e * zh_TW.po: Update.
From-SVN: r274243
2019-08-09 23:02:08 +01:00
Martin Sebor 99b1c316ec PR c++/61339 - add mismatch between struct and class [-Wmismatched-tags] to non-bugs
gcc/c/ChangeLog:

	PR c++/61339
	* c-decl.c (xref_tag): Change class-key of PODs to struct and others
	to class.
	(field_decl_cmp): Same.
	* c-parser.c (c_parser_struct_or_union_specifier): Same.
	* c-tree.h: Same.
	* gimple-parser.c (c_parser_gimple_compound_statement): Same.

gcc/c-family/ChangeLog:

	PR c++/61339
	* c-opts.c (handle_deferred_opts): : Change class-key of PODs to struct
	and others to class.
	* c-pretty-print.h: Same.

gcc/cp/ChangeLog:

	PR c++/61339
	* cp-tree.h: Change class-key of PODs to struct and others to class.
	* search.c: Same.
	* semantics.c (finalize_nrv_r): Same.

gcc/lto/ChangeLog:

	PR c++/61339
	* lto-common.c (lto_splay_tree_new): : Change class-key of PODs
	to struct and others to class.
	(mentions_vars_p): Same.
	(register_resolution): Same.
	(lto_register_var_decl_in_symtab): Same.
	(lto_register_function_decl_in_symtab): Same.
	(cmp_tree): Same.
	(lto_read_decls): Same.

gcc/ChangeLog:

	PR c++/61339
	* auto-profile.c: Change class-key of PODs to struct and others
	to class.
	* basic-block.h: Same.
	* bitmap.c (bitmap_alloc): Same.
	* bitmap.h: Same.
	* builtins.c (expand_builtin_prefetch): Same.
	(expand_builtin_interclass_mathfn): Same.
	(expand_builtin_strlen): Same.
	(expand_builtin_mempcpy_args): Same.
	(expand_cmpstr): Same.
	(expand_builtin___clear_cache): Same.
	(expand_ifn_atomic_bit_test_and): Same.
	(expand_builtin_thread_pointer): Same.
	(expand_builtin_set_thread_pointer): Same.
	* caller-save.c (setup_save_areas): Same.
	(replace_reg_with_saved_mem): Same.
	(insert_restore): Same.
	(insert_save): Same.
	(add_used_regs): Same.
	* cfg.c (get_bb_copy): Same.
	(set_loop_copy): Same.
	* cfg.h: Same.
	* cfganal.h: Same.
	* cfgexpand.c (alloc_stack_frame_space): Same.
	(add_stack_var): Same.
	(add_stack_var_conflict): Same.
	(add_scope_conflicts_1): Same.
	(update_alias_info_with_stack_vars): Same.
	(expand_used_vars): Same.
	* cfghooks.c (redirect_edge_and_branch_force): Same.
	(delete_basic_block): Same.
	(split_edge): Same.
	(make_forwarder_block): Same.
	(force_nonfallthru): Same.
	(duplicate_block): Same.
	(lv_flush_pending_stmts): Same.
	* cfghooks.h: Same.
	* cfgloop.c (flow_loops_cfg_dump): Same.
	(flow_loop_nested_p): Same.
	(superloop_at_depth): Same.
	(get_loop_latch_edges): Same.
	(flow_loop_dump): Same.
	(flow_loops_dump): Same.
	(flow_loops_free): Same.
	(flow_loop_nodes_find): Same.
	(establish_preds): Same.
	(flow_loop_tree_node_add): Same.
	(flow_loop_tree_node_remove): Same.
	(flow_loops_find): Same.
	(find_subloop_latch_edge_by_profile): Same.
	(find_subloop_latch_edge_by_ivs): Same.
	(mfb_redirect_edges_in_set): Same.
	(form_subloop): Same.
	(merge_latch_edges): Same.
	(disambiguate_multiple_latches): Same.
	(disambiguate_loops_with_multiple_latches): Same.
	(flow_bb_inside_loop_p): Same.
	(glb_enum_p): Same.
	(get_loop_body_with_size): Same.
	(get_loop_body): Same.
	(fill_sons_in_loop): Same.
	(get_loop_body_in_dom_order): Same.
	(get_loop_body_in_custom_order): Same.
	(release_recorded_exits): Same.
	(get_loop_exit_edges): Same.
	(num_loop_branches): Same.
	(remove_bb_from_loops): Same.
	(find_common_loop): Same.
	(delete_loop): Same.
	(cancel_loop): Same.
	(verify_loop_structure): Same.
	(loop_preheader_edge): Same.
	(loop_exit_edge_p): Same.
	(single_exit): Same.
	(loop_exits_to_bb_p): Same.
	(loop_exits_from_bb_p): Same.
	(get_loop_location): Same.
	(record_niter_bound): Same.
	(get_estimated_loop_iterations_int): Same.
	(max_stmt_executions_int): Same.
	(likely_max_stmt_executions_int): Same.
	(get_estimated_loop_iterations): Same.
	(get_max_loop_iterations): Same.
	(get_max_loop_iterations_int): Same.
	(get_likely_max_loop_iterations): Same.
	* cfgloop.h (simple_loop_desc): Same.
	(get_loop): Same.
	(loop_depth): Same.
	(loop_outer): Same.
	(loop_iterator::next): Same.
	(loop_outermost): Same.
	* cfgloopanal.c (mark_irreducible_loops): Same.
	(num_loop_insns): Same.
	(average_num_loop_insns): Same.
	(expected_loop_iterations_unbounded): Same.
	(expected_loop_iterations): Same.
	(mark_loop_exit_edges): Same.
	(single_likely_exit): Same.
	* cfgloopmanip.c (fix_bb_placement): Same.
	(fix_bb_placements): Same.
	(remove_path): Same.
	(place_new_loop): Same.
	(add_loop): Same.
	(scale_loop_frequencies): Same.
	(scale_loop_profile): Same.
	(create_empty_if_region_on_edge): Same.
	(create_empty_loop_on_edge): Same.
	(loopify): Same.
	(unloop): Same.
	(fix_loop_placements): Same.
	(copy_loop_info): Same.
	(duplicate_loop): Same.
	(duplicate_subloops): Same.
	(loop_redirect_edge): Same.
	(can_duplicate_loop_p): Same.
	(duplicate_loop_to_header_edge): Same.
	(mfb_keep_just): Same.
	(has_preds_from_loop): Same.
	(create_preheader): Same.
	(create_preheaders): Same.
	(lv_adjust_loop_entry_edge): Same.
	(loop_version): Same.
	* cfgloopmanip.h: Same.
	* cgraph.h: Same.
	* cgraphbuild.c: Same.
	* combine.c (make_extraction): Same.
	* config/i386/i386-features.c: Same.
	* config/i386/i386-features.h: Same.
	* config/i386/i386.c (ix86_emit_outlined_ms2sysv_save): Same.
	(ix86_emit_outlined_ms2sysv_restore): Same.
	(ix86_noce_conversion_profitable_p): Same.
	(ix86_init_cost): Same.
	(ix86_simd_clone_usable): Same.
	* configure.ac: Same.
	* coretypes.h: Same.
	* data-streamer-in.c (string_for_index): Same.
	(streamer_read_indexed_string): Same.
	(streamer_read_string): Same.
	(bp_unpack_indexed_string): Same.
	(bp_unpack_string): Same.
	(streamer_read_uhwi): Same.
	(streamer_read_hwi): Same.
	(streamer_read_gcov_count): Same.
	(streamer_read_wide_int): Same.
	* data-streamer.h (streamer_write_bitpack): Same.
	(bp_unpack_value): Same.
	(streamer_write_char_stream): Same.
	(streamer_write_hwi_in_range): Same.
	(streamer_write_record_start): Same.
	* ddg.c (create_ddg_dep_from_intra_loop_link): Same.
	(add_cross_iteration_register_deps): Same.
	(build_intra_loop_deps): Same.
	* df-core.c (df_analyze): Same.
	(loop_post_order_compute): Same.
	(loop_inverted_post_order_compute): Same.
	* df-problems.c (df_rd_alloc): Same.
	(df_rd_simulate_one_insn): Same.
	(df_rd_local_compute): Same.
	(df_rd_init_solution): Same.
	(df_rd_confluence_n): Same.
	(df_rd_transfer_function): Same.
	(df_rd_free): Same.
	(df_rd_dump_defs_set): Same.
	(df_rd_top_dump): Same.
	(df_lr_alloc): Same.
	(df_lr_reset): Same.
	(df_lr_local_compute): Same.
	(df_lr_init): Same.
	(df_lr_confluence_n): Same.
	(df_lr_free): Same.
	(df_lr_top_dump): Same.
	(df_lr_verify_transfer_functions): Same.
	(df_live_alloc): Same.
	(df_live_reset): Same.
	(df_live_init): Same.
	(df_live_confluence_n): Same.
	(df_live_finalize): Same.
	(df_live_free): Same.
	(df_live_top_dump): Same.
	(df_live_verify_transfer_functions): Same.
	(df_mir_alloc): Same.
	(df_mir_reset): Same.
	(df_mir_init): Same.
	(df_mir_confluence_n): Same.
	(df_mir_free): Same.
	(df_mir_top_dump): Same.
	(df_word_lr_alloc): Same.
	(df_word_lr_reset): Same.
	(df_word_lr_init): Same.
	(df_word_lr_confluence_n): Same.
	(df_word_lr_free): Same.
	(df_word_lr_top_dump): Same.
	(df_md_alloc): Same.
	(df_md_simulate_one_insn): Same.
	(df_md_reset): Same.
	(df_md_init): Same.
	(df_md_free): Same.
	(df_md_top_dump): Same.
	* df-scan.c (df_insn_delete): Same.
	(df_insn_rescan): Same.
	(df_notes_rescan): Same.
	(df_sort_and_compress_mws): Same.
	(df_install_mws): Same.
	(df_refs_add_to_chains): Same.
	(df_ref_create_structure): Same.
	(df_ref_record): Same.
	(df_def_record_1): Same.
	(df_find_hard_reg_defs): Same.
	(df_uses_record): Same.
	(df_get_conditional_uses): Same.
	(df_get_call_refs): Same.
	(df_recompute_luids): Same.
	(df_get_entry_block_def_set): Same.
	(df_entry_block_defs_collect): Same.
	(df_get_exit_block_use_set): Same.
	(df_exit_block_uses_collect): Same.
	(df_mws_verify): Same.
	(df_bb_verify): Same.
	* df.h (df_scan_get_bb_info): Same.
	* doc/tm.texi: Same.
	* dse.c (record_store): Same.
	* dumpfile.h: Same.
	* emit-rtl.c (const_fixed_hasher::equal): Same.
	(set_mem_attributes_minus_bitpos): Same.
	(change_address): Same.
	(adjust_address_1): Same.
	(offset_address): Same.
	* emit-rtl.h: Same.
	* except.c (dw2_build_landing_pads): Same.
	(sjlj_emit_dispatch_table): Same.
	* explow.c (allocate_dynamic_stack_space): Same.
	(emit_stack_probe): Same.
	(probe_stack_range): Same.
	* expmed.c (store_bit_field_using_insv): Same.
	(store_bit_field_1): Same.
	(store_integral_bit_field): Same.
	(extract_bit_field_using_extv): Same.
	(extract_bit_field_1): Same.
	(emit_cstore): Same.
	* expr.c (emit_block_move_via_cpymem): Same.
	(expand_cmpstrn_or_cmpmem): Same.
	(set_storage_via_setmem): Same.
	(emit_single_push_insn_1): Same.
	(expand_assignment): Same.
	(store_constructor): Same.
	(expand_expr_real_2): Same.
	(expand_expr_real_1): Same.
	(try_casesi): Same.
	* flags.h: Same.
	* function.c (try_fit_stack_local): Same.
	(assign_stack_local_1): Same.
	(assign_stack_local): Same.
	(cut_slot_from_list): Same.
	(insert_slot_to_list): Same.
	(max_slot_level): Same.
	(move_slot_to_level): Same.
	(temp_address_hasher::equal): Same.
	(remove_unused_temp_slot_addresses): Same.
	(assign_temp): Same.
	(combine_temp_slots): Same.
	(update_temp_slot_address): Same.
	(preserve_temp_slots): Same.
	* function.h: Same.
	* fwprop.c: Same.
	* gcc-rich-location.h: Same.
	* gcov.c: Same.
	* genattrtab.c (check_attr_test): Same.
	(check_attr_value): Same.
	(convert_set_attr_alternative): Same.
	(convert_set_attr): Same.
	(check_defs): Same.
	(copy_boolean): Same.
	(get_attr_value): Same.
	(expand_delays): Same.
	(make_length_attrs): Same.
	(min_fn): Same.
	(make_alternative_compare): Same.
	(simplify_test_exp): Same.
	(tests_attr_p): Same.
	(get_attr_order): Same.
	(clear_struct_flag): Same.
	(gen_attr): Same.
	(compares_alternatives_p): Same.
	(gen_insn): Same.
	(gen_delay): Same.
	(find_attrs_to_cache): Same.
	(write_test_expr): Same.
	(walk_attr_value): Same.
	(write_attr_get): Same.
	(eliminate_known_true): Same.
	(write_insn_cases): Same.
	(write_attr_case): Same.
	(write_attr_valueq): Same.
	(write_attr_value): Same.
	(write_dummy_eligible_delay): Same.
	(next_comma_elt): Same.
	(find_attr): Same.
	(make_internal_attr): Same.
	(copy_rtx_unchanging): Same.
	(gen_insn_reserv): Same.
	(check_tune_attr): Same.
	(make_automaton_attrs): Same.
	(handle_arg): Same.
	* genextract.c (gen_insn): Same.
	(VEC_char_to_string): Same.
	* genmatch.c (print_operand): Same.
	(lower): Same.
	(parser::parse_operation): Same.
	(parser::parse_capture): Same.
	(parser::parse_c_expr): Same.
	(parser::parse_simplify): Same.
	(main): Same.
	* genoutput.c (output_operand_data): Same.
	(output_get_insn_name): Same.
	(compare_operands): Same.
	(place_operands): Same.
	(process_template): Same.
	(validate_insn_alternatives): Same.
	(validate_insn_operands): Same.
	(gen_expand): Same.
	(note_constraint): Same.
	* genpreds.c (write_one_predicate_function): Same.
	(add_constraint): Same.
	(process_define_register_constraint): Same.
	(write_lookup_constraint_1): Same.
	(write_lookup_constraint_array): Same.
	(write_insn_constraint_len): Same.
	(write_reg_class_for_constraint_1): Same.
	(write_constraint_satisfied_p_array): Same.
	* genrecog.c (optimize_subroutine_group): Same.
	* gensupport.c (process_define_predicate): Same.
	(queue_pattern): Same.
	(remove_from_queue): Same.
	(process_rtx): Same.
	(is_predicable): Same.
	(change_subst_attribute): Same.
	(subst_pattern_match): Same.
	(alter_constraints): Same.
	(alter_attrs_for_insn): Same.
	(shift_output_template): Same.
	(alter_output_for_subst_insn): Same.
	(process_one_cond_exec): Same.
	(subst_dup): Same.
	(process_define_cond_exec): Same.
	(mnemonic_htab_callback): Same.
	(gen_mnemonic_attr): Same.
	(read_md_rtx): Same.
	* ggc-page.c: Same.
	* gimple-loop-interchange.cc (dump_reduction): Same.
	(dump_induction): Same.
	(loop_cand::~loop_cand): Same.
	(free_data_refs_with_aux): Same.
	(tree_loop_interchange::interchange_loops): Same.
	(tree_loop_interchange::map_inductions_to_loop): Same.
	(tree_loop_interchange::move_code_to_inner_loop): Same.
	(compute_access_stride): Same.
	(compute_access_strides): Same.
	(proper_loop_form_for_interchange): Same.
	(tree_loop_interchange_compute_ddrs): Same.
	(prune_datarefs_not_in_loop): Same.
	(prepare_data_references): Same.
	(pass_linterchange::execute): Same.
	* gimple-loop-jam.c (bb_prevents_fusion_p): Same.
	(unroll_jam_possible_p): Same.
	(fuse_loops): Same.
	(adjust_unroll_factor): Same.
	(tree_loop_unroll_and_jam): Same.
	* gimple-loop-versioning.cc (loop_versioning::~loop_versioning): Same.
	(loop_versioning::expensive_stmt_p): Same.
	(loop_versioning::version_for_unity): Same.
	(loop_versioning::dump_inner_likelihood): Same.
	(loop_versioning::find_per_loop_multiplication): Same.
	(loop_versioning::analyze_term_using_scevs): Same.
	(loop_versioning::record_address_fragment): Same.
	(loop_versioning::analyze_expr): Same.
	(loop_versioning::analyze_blocks): Same.
	(loop_versioning::prune_conditions): Same.
	(loop_versioning::merge_loop_info): Same.
	(loop_versioning::add_loop_to_queue): Same.
	(loop_versioning::decide_whether_loop_is_versionable): Same.
	(loop_versioning::make_versioning_decisions): Same.
	(loop_versioning::implement_versioning_decisions): Same.
	* gimple-ssa-evrp-analyze.c
	(evrp_range_analyzer::record_ranges_from_phis): Same.
	* gimple-ssa-store-merging.c (split_store::split_store): Same.
	(count_multiple_uses): Same.
	(split_group): Same.
	(imm_store_chain_info::output_merged_store): Same.
	(pass_store_merging::process_store): Same.
	* gimple-ssa-strength-reduction.c (slsr_process_phi): Same.
	* gimple-ssa-warn-alloca.c (adjusted_warn_limit): Same.
	(is_max): Same.
	(alloca_call_type): Same.
	(pass_walloca::execute): Same.
	* gimple-streamer-in.c (input_phi): Same.
	(input_gimple_stmt): Same.
	* gimple-streamer.h: Same.
	* godump.c (go_force_record_alignment): Same.
	(go_format_type): Same.
	(go_output_type): Same.
	(go_output_fndecl): Same.
	(go_output_typedef): Same.
	(keyword_hash_init): Same.
	(find_dummy_types): Same.
	* graph.c (draw_cfg_nodes_no_loops): Same.
	(draw_cfg_nodes_for_loop): Same.
	* hard-reg-set.h (hard_reg_set_iter_next): Same.
	* hsa-brig.c: Same.
	* hsa-common.h (hsa_internal_fn_hasher::equal): Same.
	* hsa-dump.c (dump_hsa_cfun): Same.
	* hsa-gen.c (gen_function_def_parameters): Same.
	* hsa-regalloc.c (dump_hsa_cfun_regalloc): Same.
	* input.c (dump_line_table_statistics): Same.
	(test_lexer): Same.
	* input.h: Same.
	* internal-fn.c (get_multi_vector_move): Same.
	(expand_load_lanes_optab_fn): Same.
	(expand_GOMP_SIMT_ENTER_ALLOC): Same.
	(expand_GOMP_SIMT_EXIT): Same.
	(expand_GOMP_SIMT_LAST_LANE): Same.
	(expand_GOMP_SIMT_ORDERED_PRED): Same.
	(expand_GOMP_SIMT_VOTE_ANY): Same.
	(expand_GOMP_SIMT_XCHG_BFLY): Same.
	(expand_GOMP_SIMT_XCHG_IDX): Same.
	(expand_addsub_overflow): Same.
	(expand_neg_overflow): Same.
	(expand_mul_overflow): Same.
	(expand_call_mem_ref): Same.
	(expand_mask_load_optab_fn): Same.
	(expand_scatter_store_optab_fn): Same.
	(expand_gather_load_optab_fn): Same.
	* ipa-cp.c (ipa_get_parm_lattices): Same.
	(print_all_lattices): Same.
	(ignore_edge_p): Same.
	(build_toporder_info): Same.
	(free_toporder_info): Same.
	(push_node_to_stack): Same.
	(ipcp_lattice<valtype>::set_contains_variable): Same.
	(set_agg_lats_to_bottom): Same.
	(ipcp_bits_lattice::meet_with): Same.
	(set_single_call_flag): Same.
	(initialize_node_lattices): Same.
	(ipa_get_jf_ancestor_result): Same.
	(ipcp_verify_propagated_values): Same.
	(propagate_scalar_across_jump_function): Same.
	(propagate_context_across_jump_function): Same.
	(propagate_bits_across_jump_function): Same.
	(ipa_vr_operation_and_type_effects): Same.
	(propagate_vr_across_jump_function): Same.
	(set_check_aggs_by_ref): Same.
	(set_chain_of_aglats_contains_variable): Same.
	(merge_aggregate_lattices): Same.
	(agg_pass_through_permissible_p): Same.
	(propagate_aggs_across_jump_function): Same.
	(call_passes_through_thunk_p): Same.
	(propagate_constants_across_call): Same.
	(devirtualization_time_bonus): Same.
	(good_cloning_opportunity_p): Same.
	(context_independent_aggregate_values): Same.
	(gather_context_independent_values): Same.
	(perform_estimation_of_a_value): Same.
	(estimate_local_effects): Same.
	(value_topo_info<valtype>::add_val): Same.
	(add_all_node_vals_to_toposort): Same.
	(value_topo_info<valtype>::propagate_effects): Same.
	(ipcp_propagate_stage): Same.
	(ipcp_discover_new_direct_edges): Same.
	(same_node_or_its_all_contexts_clone_p): Same.
	(cgraph_edge_brings_value_p): Same.
	(gather_edges_for_value): Same.
	(create_specialized_node): Same.
	(find_more_scalar_values_for_callers_subset): Same.
	(find_more_contexts_for_caller_subset): Same.
	(copy_plats_to_inter): Same.
	(intersect_aggregates_with_edge): Same.
	(find_aggregate_values_for_callers_subset): Same.
	(cgraph_edge_brings_all_agg_vals_for_node): Same.
	(decide_about_value): Same.
	(decide_whether_version_node): Same.
	(spread_undeadness): Same.
	(identify_dead_nodes): Same.
	(ipcp_store_vr_results): Same.
	* ipa-devirt.c (final_warning_record::grow_type_warnings): Same.
	* ipa-fnsummary.c (ipa_fn_summary::account_size_time): Same.
	(redirect_to_unreachable): Same.
	(edge_set_predicate): Same.
	(evaluate_conditions_for_known_args): Same.
	(evaluate_properties_for_edge): Same.
	(ipa_fn_summary_t::duplicate): Same.
	(ipa_call_summary_t::duplicate): Same.
	(dump_ipa_call_summary): Same.
	(ipa_dump_fn_summary): Same.
	(eliminated_by_inlining_prob): Same.
	(set_cond_stmt_execution_predicate): Same.
	(set_switch_stmt_execution_predicate): Same.
	(compute_bb_predicates): Same.
	(will_be_nonconstant_expr_predicate): Same.
	(phi_result_unknown_predicate): Same.
	(analyze_function_body): Same.
	(compute_fn_summary): Same.
	(estimate_edge_devirt_benefit): Same.
	(estimate_edge_size_and_time): Same.
	(estimate_calls_size_and_time): Same.
	(estimate_node_size_and_time): Same.
	(remap_edge_change_prob): Same.
	(remap_edge_summaries): Same.
	(ipa_merge_fn_summary_after_inlining): Same.
	(ipa_fn_summary_generate): Same.
	(inline_read_section): Same.
	(ipa_fn_summary_read): Same.
	(ipa_fn_summary_write): Same.
	* ipa-fnsummary.h: Same.
	* ipa-hsa.c (ipa_hsa_read_section): Same.
	* ipa-icf-gimple.c (func_checker::compare_loops): Same.
	* ipa-icf.c (sem_function::param_used_p): Same.
	* ipa-inline-analysis.c (do_estimate_edge_time): Same.
	* ipa-inline.c (edge_badness): Same.
	(inline_small_functions): Same.
	* ipa-polymorphic-call.c
	(ipa_polymorphic_call_context::stream_out): Same.
	* ipa-predicate.c (predicate::remap_after_duplication): Same.
	(predicate::remap_after_inlining): Same.
	(predicate::stream_out): Same.
	* ipa-predicate.h: Same.
	* ipa-profile.c (ipa_profile_read_summary): Same.
	* ipa-prop.c (ipa_get_param_decl_index_1): Same.
	(count_formal_params): Same.
	(ipa_dump_param): Same.
	(ipa_alloc_node_params): Same.
	(ipa_print_node_jump_functions_for_edge): Same.
	(ipa_print_node_jump_functions): Same.
	(ipa_load_from_parm_agg): Same.
	(get_ancestor_addr_info): Same.
	(ipa_compute_jump_functions_for_edge): Same.
	(ipa_analyze_virtual_call_uses): Same.
	(ipa_analyze_stmt_uses): Same.
	(ipa_analyze_params_uses_in_bb): Same.
	(update_jump_functions_after_inlining): Same.
	(try_decrement_rdesc_refcount): Same.
	(ipa_impossible_devirt_target): Same.
	(update_indirect_edges_after_inlining): Same.
	(combine_controlled_uses_counters): Same.
	(ipa_edge_args_sum_t::duplicate): Same.
	(ipa_write_jump_function): Same.
	(ipa_write_indirect_edge_info): Same.
	(ipa_write_node_info): Same.
	(ipa_read_edge_info): Same.
	(ipa_prop_read_section): Same.
	(read_replacements_section): Same.
	* ipa-prop.h (ipa_get_param_count): Same.
	(ipa_get_param): Same.
	(ipa_get_type): Same.
	(ipa_get_param_move_cost): Same.
	(ipa_set_param_used): Same.
	(ipa_get_controlled_uses): Same.
	(ipa_set_controlled_uses): Same.
	(ipa_get_cs_argument_count): Same.
	* ipa-pure-const.c (analyze_function): Same.
	(pure_const_read_summary): Same.
	* ipa-ref.h: Same.
	* ipa-reference.c (ipa_reference_read_optimization_summary): Same.
	* ipa-split.c (test_nonssa_use): Same.
	(dump_split_point): Same.
	(dominated_by_forbidden): Same.
	(split_part_set_ssa_name_p): Same.
	(find_split_points): Same.
	* ira-build.c (finish_loop_tree_nodes): Same.
	(low_pressure_loop_node_p): Same.
	* ira-color.c (ira_reuse_stack_slot): Same.
	* ira-int.h: Same.
	* ira.c (setup_reg_equiv): Same.
	(print_insn_chain): Same.
	(ira): Same.
	* loop-doloop.c (doloop_condition_get): Same.
	(add_test): Same.
	(record_reg_sets): Same.
	(doloop_optimize): Same.
	* loop-init.c (loop_optimizer_init): Same.
	(fix_loop_structure): Same.
	* loop-invariant.c (merge_identical_invariants): Same.
	(compute_always_reached): Same.
	(find_exits): Same.
	(may_assign_reg_p): Same.
	(find_invariants_bb): Same.
	(find_invariants_body): Same.
	(replace_uses): Same.
	(can_move_invariant_reg): Same.
	(free_inv_motion_data): Same.
	(move_single_loop_invariants): Same.
	(change_pressure): Same.
	(mark_ref_regs): Same.
	(calculate_loop_reg_pressure): Same.
	* loop-iv.c (biv_entry_hasher::equal): Same.
	(iv_extend_to_rtx_code): Same.
	(check_iv_ref_table_size): Same.
	(clear_iv_info): Same.
	(latch_dominating_def): Same.
	(iv_get_reaching_def): Same.
	(iv_constant): Same.
	(iv_subreg): Same.
	(iv_extend): Same.
	(iv_neg): Same.
	(iv_add): Same.
	(iv_mult): Same.
	(get_biv_step): Same.
	(record_iv): Same.
	(analyzed_for_bivness_p): Same.
	(record_biv): Same.
	(iv_analyze_biv): Same.
	(iv_analyze_expr): Same.
	(iv_analyze_def): Same.
	(iv_analyze_op): Same.
	(iv_analyze): Same.
	(iv_analyze_result): Same.
	(biv_p): Same.
	(eliminate_implied_conditions): Same.
	(simplify_using_initial_values): Same.
	(shorten_into_mode): Same.
	(canonicalize_iv_subregs): Same.
	(determine_max_iter): Same.
	(check_simple_exit): Same.
	(find_simple_exit): Same.
	(get_simple_loop_desc): Same.
	* loop-unroll.c (report_unroll): Same.
	(decide_unrolling): Same.
	(unroll_loops): Same.
	(loop_exit_at_end_p): Same.
	(decide_unroll_constant_iterations): Same.
	(unroll_loop_constant_iterations): Same.
	(compare_and_jump_seq): Same.
	(unroll_loop_runtime_iterations): Same.
	(decide_unroll_stupid): Same.
	(unroll_loop_stupid): Same.
	(referenced_in_one_insn_in_loop_p): Same.
	(reset_debug_uses_in_loop): Same.
	(analyze_iv_to_split_insn): Same.
	* lra-eliminations.c (lra_debug_elim_table): Same.
	(setup_can_eliminate): Same.
	(form_sum): Same.
	(lra_get_elimination_hard_regno): Same.
	(lra_eliminate_regs_1): Same.
	(eliminate_regs_in_insn): Same.
	(update_reg_eliminate): Same.
	(init_elimination): Same.
	(lra_eliminate): Same.
	* lra-int.h: Same.
	* lra-lives.c (initiate_live_solver): Same.
	* lra-remat.c (create_remat_bb_data): Same.
	* lra-spills.c (lra_spill): Same.
	* lra.c (lra_set_insn_recog_data): Same.
	(lra_set_used_insn_alternative_by_uid): Same.
	(init_reg_info): Same.
	(expand_reg_info): Same.
	* lto-cgraph.c (output_symtab): Same.
	(read_identifier): Same.
	(get_alias_symbol): Same.
	(input_node): Same.
	(input_varpool_node): Same.
	(input_ref): Same.
	(input_edge): Same.
	(input_cgraph_1): Same.
	(input_refs): Same.
	(input_symtab): Same.
	(input_offload_tables): Same.
	(output_cgraph_opt_summary): Same.
	(input_edge_opt_summary): Same.
	(input_cgraph_opt_section): Same.
	* lto-section-in.c (lto_free_raw_section_data): Same.
	(lto_create_simple_input_block): Same.
	(lto_free_function_in_decl_state_for_node): Same.
	* lto-streamer-in.c (lto_tag_check_set): Same.
	(lto_location_cache::revert_location_cache): Same.
	(lto_location_cache::input_location): Same.
	(lto_input_location): Same.
	(stream_input_location_now): Same.
	(lto_input_tree_ref): Same.
	(lto_input_eh_catch_list): Same.
	(input_eh_region): Same.
	(lto_init_eh): Same.
	(make_new_block): Same.
	(input_cfg): Same.
	(fixup_call_stmt_edges): Same.
	(input_struct_function_base): Same.
	(input_function): Same.
	(lto_read_body_or_constructor): Same.
	(lto_read_tree_1): Same.
	(lto_read_tree): Same.
	(lto_input_scc): Same.
	(lto_input_tree_1): Same.
	(lto_input_toplevel_asms): Same.
	(lto_input_mode_table): Same.
	(lto_reader_init): Same.
	(lto_data_in_create): Same.
	* lto-streamer-out.c (output_cfg): Same.
	* lto-streamer.h: Same.
	* modulo-sched.c (duplicate_insns_of_cycles): Same.
	(generate_prolog_epilog): Same.
	(mark_loop_unsched): Same.
	(dump_insn_location): Same.
	(loop_canon_p): Same.
	(sms_schedule): Same.
	* omp-expand.c (expand_omp_for_ordered_loops): Same.
	(expand_omp_for_generic): Same.
	(expand_omp_for_static_nochunk): Same.
	(expand_omp_for_static_chunk): Same.
	(expand_omp_simd): Same.
	(expand_omp_taskloop_for_inner): Same.
	(expand_oacc_for): Same.
	(expand_omp_atomic_pipeline): Same.
	(mark_loops_in_oacc_kernels_region): Same.
	* omp-offload.c (oacc_xform_loop): Same.
	* omp-simd-clone.c (simd_clone_adjust): Same.
	* optabs-query.c (get_traditional_extraction_insn): Same.
	* optabs.c (expand_vector_broadcast): Same.
	(expand_binop_directly): Same.
	(expand_twoval_unop): Same.
	(expand_twoval_binop): Same.
	(expand_unop_direct): Same.
	(emit_indirect_jump): Same.
	(emit_conditional_move): Same.
	(emit_conditional_neg_or_complement): Same.
	(emit_conditional_add): Same.
	(vector_compare_rtx): Same.
	(expand_vec_perm_1): Same.
	(expand_vec_perm_const): Same.
	(expand_vec_cond_expr): Same.
	(expand_vec_series_expr): Same.
	(maybe_emit_atomic_exchange): Same.
	(maybe_emit_sync_lock_test_and_set): Same.
	(expand_atomic_compare_and_swap): Same.
	(expand_atomic_load): Same.
	(expand_atomic_store): Same.
	(maybe_emit_op): Same.
	(valid_multiword_target_p): Same.
	(create_integer_operand): Same.
	(maybe_legitimize_operand_same_code): Same.
	(maybe_legitimize_operand): Same.
	(create_convert_operand_from_type): Same.
	(can_reuse_operands_p): Same.
	(maybe_legitimize_operands): Same.
	(maybe_gen_insn): Same.
	(maybe_expand_insn): Same.
	(maybe_expand_jump_insn): Same.
	(expand_insn): Same.
	* optabs.h (create_expand_operand): Same.
	(create_fixed_operand): Same.
	(create_output_operand): Same.
	(create_input_operand): Same.
	(create_convert_operand_to): Same.
	(create_convert_operand_from): Same.
	* optinfo.h: Same.
	* poly-int.h: Same.
	* predict.c (optimize_insn_for_speed_p): Same.
	(optimize_loop_for_size_p): Same.
	(optimize_loop_for_speed_p): Same.
	(optimize_loop_nest_for_speed_p): Same.
	(get_base_value): Same.
	(predicted_by_loop_heuristics_p): Same.
	(predict_extra_loop_exits): Same.
	(predict_loops): Same.
	(predict_paths_for_bb): Same.
	(predict_paths_leading_to): Same.
	(propagate_freq): Same.
	(pass_profile::execute): Same.
	* predict.h: Same.
	* profile-count.c (profile_count::differs_from_p): Same.
	(profile_probability::differs_lot_from_p): Same.
	* profile-count.h: Same.
	* profile.c (branch_prob): Same.
	* regrename.c (free_chain_data): Same.
	(mark_conflict): Same.
	(create_new_chain): Same.
	(merge_overlapping_regs): Same.
	(init_rename_info): Same.
	(merge_chains): Same.
	(regrename_analyze): Same.
	(regrename_do_replace): Same.
	(scan_rtx_reg): Same.
	(record_out_operands): Same.
	(build_def_use): Same.
	* regrename.h: Same.
	* reload.h: Same.
	* reload1.c (init_reload): Same.
	(maybe_fix_stack_asms): Same.
	(copy_reloads): Same.
	(count_pseudo): Same.
	(count_spilled_pseudo): Same.
	(find_reg): Same.
	(find_reload_regs): Same.
	(select_reload_regs): Same.
	(spill_hard_reg): Same.
	(fixup_eh_region_note): Same.
	(set_reload_reg): Same.
	(allocate_reload_reg): Same.
	(compute_reload_subreg_offset): Same.
	(reload_adjust_reg_for_icode): Same.
	(emit_input_reload_insns): Same.
	(emit_output_reload_insns): Same.
	(do_input_reload): Same.
	(inherit_piecemeal_p): Same.
	* rtl.h: Same.
	* sanopt.c (maybe_get_dominating_check): Same.
	(maybe_optimize_ubsan_ptr_ifn): Same.
	(can_remove_asan_check): Same.
	(maybe_optimize_asan_check_ifn): Same.
	(sanopt_optimize_walker): Same.
	* sched-deps.c (add_dependence_list): Same.
	(chain_to_prev_insn): Same.
	(add_insn_mem_dependence): Same.
	(create_insn_reg_set): Same.
	(maybe_extend_reg_info_p): Same.
	(sched_analyze_reg): Same.
	(sched_analyze_1): Same.
	(get_implicit_reg_pending_clobbers): Same.
	(chain_to_prev_insn_p): Same.
	(deps_analyze_insn): Same.
	(deps_start_bb): Same.
	(sched_free_deps): Same.
	(init_deps): Same.
	(init_deps_reg_last): Same.
	(free_deps): Same.
	* sched-ebb.c: Same.
	* sched-int.h: Same.
	* sched-rgn.c (add_branch_dependences): Same.
	(concat_insn_mem_list): Same.
	(deps_join): Same.
	(sched_rgn_compute_dependencies): Same.
	* sel-sched-ir.c (reset_target_context): Same.
	(copy_deps_context): Same.
	(init_id_from_df): Same.
	(has_dependence_p): Same.
	(change_loops_latches): Same.
	(bb_top_order_comparator): Same.
	(make_region_from_loop_preheader): Same.
	(sel_init_pipelining): Same.
	(get_loop_nest_for_rgn): Same.
	(make_regions_from_the_rest): Same.
	(sel_is_loop_preheader_p): Same.
	* sel-sched-ir.h (inner_loop_header_p): Same.
	(get_all_loop_exits): Same.
	* selftest.h: Same.
	* sese.c (sese_build_liveouts): Same.
	(sese_insert_phis_for_liveouts): Same.
	* sese.h (defined_in_sese_p): Same.
	* sreal.c (sreal::stream_out): Same.
	* sreal.h: Same.
	* streamer-hooks.h: Same.
	* target-globals.c (save_target_globals): Same.
	* target-globals.h: Same.
	* target.def: Same.
	* target.h: Same.
	* targhooks.c (default_has_ifunc_p): Same.
	(default_empty_mask_is_expensive): Same.
	(default_init_cost): Same.
	* targhooks.h: Same.
	* toplev.c: Same.
	* tree-affine.c (aff_combination_mult): Same.
	(aff_combination_expand): Same.
	(aff_combination_constant_multiple_p): Same.
	* tree-affine.h: Same.
	* tree-cfg.c (build_gimple_cfg): Same.
	(replace_loop_annotate_in_block): Same.
	(replace_uses_by): Same.
	(remove_bb): Same.
	(dump_cfg_stats): Same.
	(gimple_duplicate_sese_region): Same.
	(gimple_duplicate_sese_tail): Same.
	(move_block_to_fn): Same.
	(replace_block_vars_by_duplicates): Same.
	(move_sese_region_to_fn): Same.
	(print_loops_bb): Same.
	(print_loop): Same.
	(print_loops): Same.
	(debug): Same.
	(debug_loops): Same.
	* tree-cfg.h: Same.
	* tree-chrec.c (chrec_fold_plus_poly_poly): Same.
	(chrec_fold_multiply_poly_poly): Same.
	(chrec_evaluate): Same.
	(chrec_component_in_loop_num): Same.
	(reset_evolution_in_loop): Same.
	(is_multivariate_chrec): Same.
	(chrec_contains_symbols): Same.
	(nb_vars_in_chrec): Same.
	(chrec_convert_1): Same.
	(chrec_convert_aggressive): Same.
	* tree-chrec.h: Same.
	* tree-core.h: Same.
	* tree-data-ref.c (dump_data_dependence_relation): Same.
	(canonicalize_base_object_address): Same.
	(data_ref_compare_tree): Same.
	(prune_runtime_alias_test_list): Same.
	(get_segment_min_max): Same.
	(create_intersect_range_checks): Same.
	(conflict_fn_no_dependence): Same.
	(object_address_invariant_in_loop_p): Same.
	(analyze_ziv_subscript): Same.
	(analyze_siv_subscript_cst_affine): Same.
	(analyze_miv_subscript): Same.
	(analyze_overlapping_iterations): Same.
	(build_classic_dist_vector_1): Same.
	(add_other_self_distances): Same.
	(same_access_functions): Same.
	(build_classic_dir_vector): Same.
	(subscript_dependence_tester_1): Same.
	(subscript_dependence_tester): Same.
	(access_functions_are_affine_or_constant_p): Same.
	(get_references_in_stmt): Same.
	(loop_nest_has_data_refs): Same.
	(graphite_find_data_references_in_stmt): Same.
	(find_data_references_in_bb): Same.
	(get_base_for_alignment): Same.
	(find_loop_nest_1): Same.
	(find_loop_nest): Same.
	* tree-data-ref.h (dr_alignment): Same.
	(ddr_dependence_level): Same.
	* tree-if-conv.c (fold_build_cond_expr): Same.
	(add_to_predicate_list): Same.
	(add_to_dst_predicate_list): Same.
	(phi_convertible_by_degenerating_args): Same.
	(idx_within_array_bound): Same.
	(all_preds_critical_p): Same.
	(pred_blocks_visited_p): Same.
	(predicate_bbs): Same.
	(build_region): Same.
	(if_convertible_loop_p_1): Same.
	(is_cond_scalar_reduction): Same.
	(predicate_scalar_phi): Same.
	(remove_conditions_and_labels): Same.
	(combine_blocks): Same.
	(version_loop_for_if_conversion): Same.
	(versionable_outer_loop_p): Same.
	(ifcvt_local_dce): Same.
	(tree_if_conversion): Same.
	(pass_if_conversion::gate): Same.
	* tree-if-conv.h: Same.
	* tree-inline.c (maybe_move_debug_stmts_to_successors): Same.
	* tree-loop-distribution.c (bb_top_order_cmp): Same.
	(free_rdg): Same.
	(stmt_has_scalar_dependences_outside_loop): Same.
	(copy_loop_before): Same.
	(create_bb_after_loop): Same.
	(const_with_all_bytes_same): Same.
	(generate_memset_builtin): Same.
	(generate_memcpy_builtin): Same.
	(destroy_loop): Same.
	(build_rdg_partition_for_vertex): Same.
	(compute_access_range): Same.
	(data_ref_segment_size): Same.
	(latch_dominated_by_data_ref): Same.
	(compute_alias_check_pairs): Same.
	(fuse_memset_builtins): Same.
	(finalize_partitions): Same.
	(find_seed_stmts_for_distribution): Same.
	(prepare_perfect_loop_nest): Same.
	* tree-parloops.c (lambda_transform_legal_p): Same.
	(loop_parallel_p): Same.
	(reduc_stmt_res): Same.
	(add_field_for_name): Same.
	(create_call_for_reduction_1): Same.
	(replace_uses_in_bb_by): Same.
	(transform_to_exit_first_loop_alt): Same.
	(try_transform_to_exit_first_loop_alt): Same.
	(transform_to_exit_first_loop): Same.
	(num_phis): Same.
	(gen_parallel_loop): Same.
	(gather_scalar_reductions): Same.
	(get_omp_data_i_param): Same.
	(try_create_reduction_list): Same.
	(oacc_entry_exit_single_gang): Same.
	(parallelize_loops): Same.
	* tree-pass.h: Same.
	* tree-predcom.c (determine_offset): Same.
	(last_always_executed_block): Same.
	(split_data_refs_to_components): Same.
	(suitable_component_p): Same.
	(valid_initializer_p): Same.
	(find_looparound_phi): Same.
	(insert_looparound_copy): Same.
	(add_looparound_copies): Same.
	(determine_roots_comp): Same.
	(predcom_tmp_var): Same.
	(initialize_root_vars): Same.
	(initialize_root_vars_store_elim_1): Same.
	(initialize_root_vars_store_elim_2): Same.
	(finalize_eliminated_stores): Same.
	(initialize_root_vars_lm): Same.
	(remove_stmt): Same.
	(determine_unroll_factor): Same.
	(execute_pred_commoning_cbck): Same.
	(base_names_in_chain_on): Same.
	(combine_chains): Same.
	(pcom_stmt_dominates_stmt_p): Same.
	(try_combine_chains): Same.
	(prepare_initializers_chain_store_elim): Same.
	(prepare_initializers_chain): Same.
	(prepare_initializers): Same.
	(prepare_finalizers_chain): Same.
	(prepare_finalizers): Same.
	(insert_init_seqs): Same.
	* tree-scalar-evolution.c (loop_phi_node_p): Same.
	(compute_overall_effect_of_inner_loop): Same.
	(add_to_evolution_1): Same.
	(add_to_evolution): Same.
	(follow_ssa_edge_binary): Same.
	(follow_ssa_edge_expr): Same.
	(backedge_phi_arg_p): Same.
	(follow_ssa_edge_in_condition_phi_branch): Same.
	(follow_ssa_edge_in_condition_phi): Same.
	(follow_ssa_edge_inner_loop_phi): Same.
	(follow_ssa_edge): Same.
	(analyze_evolution_in_loop): Same.
	(analyze_initial_condition): Same.
	(interpret_loop_phi): Same.
	(interpret_condition_phi): Same.
	(interpret_rhs_expr): Same.
	(interpret_expr): Same.
	(interpret_gimple_assign): Same.
	(analyze_scalar_evolution_1): Same.
	(analyze_scalar_evolution): Same.
	(analyze_scalar_evolution_for_address_of): Same.
	(get_instantiated_value_entry): Same.
	(loop_closed_phi_def): Same.
	(instantiate_scev_name): Same.
	(instantiate_scev_poly): Same.
	(instantiate_scev_binary): Same.
	(instantiate_scev_convert): Same.
	(instantiate_scev_not): Same.
	(instantiate_scev_r): Same.
	(instantiate_scev): Same.
	(resolve_mixers): Same.
	(initialize_scalar_evolutions_analyzer): Same.
	(scev_reset_htab): Same.
	(scev_reset): Same.
	(derive_simple_iv_with_niters): Same.
	(simple_iv_with_niters): Same.
	(expression_expensive_p): Same.
	(final_value_replacement_loop): Same.
	* tree-scalar-evolution.h (block_before_loop): Same.
	* tree-ssa-address.h: Same.
	* tree-ssa-dce.c (find_obviously_necessary_stmts): Same.
	* tree-ssa-dom.c (edge_info::record_simple_equiv): Same.
	(record_edge_info): Same.
	* tree-ssa-live.c (var_map_base_fini): Same.
	(remove_unused_locals): Same.
	* tree-ssa-live.h: Same.
	* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Same.
	(pass_ch_vect::execute): Same.
	(pass_ch::process_loop_p): Same.
	* tree-ssa-loop-im.c (mem_ref_hasher::hash): Same.
	(movement_possibility): Same.
	(outermost_invariant_loop): Same.
	(stmt_cost): Same.
	(determine_max_movement): Same.
	(invariantness_dom_walker::before_dom_children): Same.
	(move_computations): Same.
	(may_move_till): Same.
	(force_move_till_op): Same.
	(force_move_till): Same.
	(memref_free): Same.
	(record_mem_ref_loc): Same.
	(set_ref_stored_in_loop): Same.
	(mark_ref_stored): Same.
	(sort_bbs_in_loop_postorder_cmp): Same.
	(sort_locs_in_loop_postorder_cmp): Same.
	(analyze_memory_references): Same.
	(mem_refs_may_alias_p): Same.
	(find_ref_loc_in_loop_cmp): Same.
	(rewrite_mem_ref_loc::operator): Same.
	(first_mem_ref_loc_1::operator): Same.
	(sm_set_flag_if_changed::operator): Same.
	(execute_sm_if_changed_flag_set): Same.
	(execute_sm): Same.
	(hoist_memory_references): Same.
	(ref_always_accessed::operator): Same.
	(refs_independent_p): Same.
	(record_dep_loop): Same.
	(ref_indep_loop_p_1): Same.
	(ref_indep_loop_p): Same.
	(can_sm_ref_p): Same.
	(find_refs_for_sm): Same.
	(loop_suitable_for_sm): Same.
	(store_motion_loop): Same.
	(store_motion): Same.
	(fill_always_executed_in): Same.
	* tree-ssa-loop-ivcanon.c (constant_after_peeling): Same.
	(estimated_unrolled_size): Same.
	(loop_edge_to_cancel): Same.
	(remove_exits_and_undefined_stmts): Same.
	(remove_redundant_iv_tests): Same.
	(unloop_loops): Same.
	(estimated_peeled_sequence_size): Same.
	(try_peel_loop): Same.
	(canonicalize_loop_induction_variables): Same.
	(canonicalize_induction_variables): Same.
	* tree-ssa-loop-ivopts.c (iv_inv_expr_hasher::equal): Same.
	(name_info): Same.
	(stmt_after_inc_pos): Same.
	(contains_abnormal_ssa_name_p): Same.
	(niter_for_exit): Same.
	(find_bivs): Same.
	(mark_bivs): Same.
	(find_givs_in_bb): Same.
	(find_induction_variables): Same.
	(find_interesting_uses_cond): Same.
	(outermost_invariant_loop_for_expr): Same.
	(idx_find_step): Same.
	(add_candidate_1): Same.
	(add_iv_candidate_derived_from_uses): Same.
	(alloc_use_cost_map): Same.
	(prepare_decl_rtl): Same.
	(generic_predict_doloop_p): Same.
	(computation_cost): Same.
	(determine_common_wider_type): Same.
	(get_computation_aff_1): Same.
	(get_use_type): Same.
	(determine_group_iv_cost_address): Same.
	(iv_period): Same.
	(difference_cannot_overflow_p): Same.
	(may_eliminate_iv): Same.
	(determine_set_costs): Same.
	(cheaper_cost_pair): Same.
	(compare_cost_pair): Same.
	(iv_ca_cand_for_group): Same.
	(iv_ca_recount_cost): Same.
	(iv_ca_set_remove_invs): Same.
	(iv_ca_set_no_cp): Same.
	(iv_ca_set_add_invs): Same.
	(iv_ca_set_cp): Same.
	(iv_ca_add_group): Same.
	(iv_ca_cost): Same.
	(iv_ca_compare_deps): Same.
	(iv_ca_delta_reverse): Same.
	(iv_ca_delta_commit): Same.
	(iv_ca_cand_used_p): Same.
	(iv_ca_delta_free): Same.
	(iv_ca_new): Same.
	(iv_ca_free): Same.
	(iv_ca_dump): Same.
	(iv_ca_extend): Same.
	(iv_ca_narrow): Same.
	(iv_ca_prune): Same.
	(cheaper_cost_with_cand): Same.
	(iv_ca_replace): Same.
	(try_add_cand_for): Same.
	(get_initial_solution): Same.
	(try_improve_iv_set): Same.
	(find_optimal_iv_set_1): Same.
	(create_new_iv): Same.
	(rewrite_use_compare): Same.
	(remove_unused_ivs): Same.
	(determine_scaling_factor): Same.
	* tree-ssa-loop-ivopts.h: Same.
	* tree-ssa-loop-manip.c (create_iv): Same.
	(compute_live_loop_exits): Same.
	(add_exit_phi): Same.
	(add_exit_phis): Same.
	(find_uses_to_rename_use): Same.
	(find_uses_to_rename_def): Same.
	(find_uses_to_rename_in_loop): Same.
	(rewrite_into_loop_closed_ssa): Same.
	(check_loop_closed_ssa_bb): Same.
	(split_loop_exit_edge): Same.
	(ip_end_pos): Same.
	(ip_normal_pos): Same.
	(copy_phi_node_args): Same.
	(gimple_duplicate_loop_to_header_edge): Same.
	(can_unroll_loop_p): Same.
	(determine_exit_conditions): Same.
	(scale_dominated_blocks_in_loop): Same.
	(niter_for_unrolled_loop): Same.
	(tree_transform_and_unroll_loop): Same.
	(rewrite_all_phi_nodes_with_iv): Same.
	* tree-ssa-loop-manip.h: Same.
	* tree-ssa-loop-niter.c (number_of_iterations_ne_max): Same.
	(number_of_iterations_ne): Same.
	(assert_no_overflow_lt): Same.
	(assert_loop_rolls_lt): Same.
	(number_of_iterations_lt): Same.
	(adjust_cond_for_loop_until_wrap): Same.
	(tree_simplify_using_condition): Same.
	(simplify_using_initial_conditions): Same.
	(simplify_using_outer_evolutions): Same.
	(loop_only_exit_p): Same.
	(ssa_defined_by_minus_one_stmt_p): Same.
	(number_of_iterations_popcount): Same.
	(number_of_iterations_exit): Same.
	(find_loop_niter): Same.
	(finite_loop_p): Same.
	(chain_of_csts_start): Same.
	(get_val_for): Same.
	(loop_niter_by_eval): Same.
	(derive_constant_upper_bound_ops): Same.
	(do_warn_aggressive_loop_optimizations): Same.
	(record_estimate): Same.
	(get_cst_init_from_scev): Same.
	(record_nonwrapping_iv): Same.
	(idx_infer_loop_bounds): Same.
	(infer_loop_bounds_from_ref): Same.
	(infer_loop_bounds_from_array): Same.
	(infer_loop_bounds_from_pointer_arith): Same.
	(infer_loop_bounds_from_signedness): Same.
	(bound_index): Same.
	(discover_iteration_bound_by_body_walk): Same.
	(maybe_lower_iteration_bound): Same.
	(estimate_numbers_of_iterations): Same.
	(estimated_loop_iterations): Same.
	(estimated_loop_iterations_int): Same.
	(max_loop_iterations): Same.
	(max_loop_iterations_int): Same.
	(likely_max_loop_iterations): Same.
	(likely_max_loop_iterations_int): Same.
	(estimated_stmt_executions_int): Same.
	(max_stmt_executions): Same.
	(likely_max_stmt_executions): Same.
	(estimated_stmt_executions): Same.
	(stmt_dominates_stmt_p): Same.
	(nowrap_type_p): Same.
	(loop_exits_before_overflow): Same.
	(scev_var_range_cant_overflow): Same.
	(scev_probably_wraps_p): Same.
	(free_numbers_of_iterations_estimates): Same.
	* tree-ssa-loop-niter.h: Same.
	* tree-ssa-loop-prefetch.c (release_mem_refs): Same.
	(idx_analyze_ref): Same.
	(analyze_ref): Same.
	(gather_memory_references_ref): Same.
	(mark_nontemporal_store): Same.
	(emit_mfence_after_loop): Same.
	(may_use_storent_in_loop_p): Same.
	(mark_nontemporal_stores): Same.
	(should_unroll_loop_p): Same.
	(volume_of_dist_vector): Same.
	(add_subscript_strides): Same.
	(self_reuse_distance): Same.
	(insn_to_prefetch_ratio_too_small_p): Same.
	* tree-ssa-loop-split.c (split_at_bb_p): Same.
	(patch_loop_exit): Same.
	(find_or_create_guard_phi): Same.
	(easy_exit_values): Same.
	(connect_loop_phis): Same.
	(connect_loops): Same.
	(compute_new_first_bound): Same.
	(split_loop): Same.
	(tree_ssa_split_loops): Same.
	* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Same.
	(is_maybe_undefined): Same.
	(tree_may_unswitch_on): Same.
	(simplify_using_entry_checks): Same.
	(tree_unswitch_single_loop): Same.
	(tree_unswitch_loop): Same.
	(tree_unswitch_outer_loop): Same.
	(empty_bb_without_guard_p): Same.
	(used_outside_loop_p): Same.
	(get_vop_from_header): Same.
	(hoist_guard): Same.
	* tree-ssa-loop.c (gate_oacc_kernels): Same.
	(get_lsm_tmp_name): Same.
	* tree-ssa-loop.h: Same.
	* tree-ssa-reassoc.c (add_repeat_to_ops_vec): Same.
	(build_and_add_sum): Same.
	(no_side_effect_bb): Same.
	(get_ops): Same.
	(linearize_expr): Same.
	(should_break_up_subtract): Same.
	(linearize_expr_tree): Same.
	* tree-ssa-scopedtables.c: Same.
	* tree-ssa-scopedtables.h: Same.
	* tree-ssa-structalias.c (condense_visit): Same.
	(label_visit): Same.
	(dump_pred_graph): Same.
	(perform_var_substitution): Same.
	(move_complex_constraints): Same.
	(remove_preds_and_fake_succs): Same.
	* tree-ssa-threadupdate.c (dbds_continue_enumeration_p): Same.
	(determine_bb_domination_status): Same.
	(duplicate_thread_path): Same.
	(thread_through_all_blocks): Same.
	* tree-ssa-threadupdate.h: Same.
	* tree-streamer-in.c (streamer_read_string_cst): Same.
	(input_identifier): Same.
	(unpack_ts_type_common_value_fields): Same.
	(unpack_ts_block_value_fields): Same.
	(unpack_ts_translation_unit_decl_value_fields): Same.
	(unpack_ts_omp_clause_value_fields): Same.
	(streamer_read_tree_bitfields): Same.
	(streamer_alloc_tree): Same.
	(lto_input_ts_common_tree_pointers): Same.
	(lto_input_ts_vector_tree_pointers): Same.
	(lto_input_ts_poly_tree_pointers): Same.
	(lto_input_ts_complex_tree_pointers): Same.
	(lto_input_ts_decl_minimal_tree_pointers): Same.
	(lto_input_ts_decl_common_tree_pointers): Same.
	(lto_input_ts_decl_non_common_tree_pointers): Same.
	(lto_input_ts_decl_with_vis_tree_pointers): Same.
	(lto_input_ts_field_decl_tree_pointers): Same.
	(lto_input_ts_function_decl_tree_pointers): Same.
	(lto_input_ts_type_common_tree_pointers): Same.
	(lto_input_ts_type_non_common_tree_pointers): Same.
	(lto_input_ts_list_tree_pointers): Same.
	(lto_input_ts_vec_tree_pointers): Same.
	(lto_input_ts_exp_tree_pointers): Same.
	(lto_input_ts_block_tree_pointers): Same.
	(lto_input_ts_binfo_tree_pointers): Same.
	(lto_input_ts_constructor_tree_pointers): Same.
	(lto_input_ts_omp_clause_tree_pointers): Same.
	(streamer_read_tree_body): Same.
	* tree-streamer.h: Same.
	* tree-switch-conversion.c (bit_test_cluster::is_beneficial): Same.
	* tree-vect-data-refs.c (vect_get_smallest_scalar_type): Same.
	(vect_analyze_possibly_independent_ddr): Same.
	(vect_analyze_data_ref_dependence): Same.
	(vect_compute_data_ref_alignment): Same.
	(vect_enhance_data_refs_alignment): Same.
	(vect_analyze_data_ref_access): Same.
	(vect_check_gather_scatter): Same.
	(vect_find_stmt_data_reference): Same.
	(vect_create_addr_base_for_vector_ref): Same.
	(vect_setup_realignment): Same.
	(vect_supportable_dr_alignment): Same.
	* tree-vect-loop-manip.c (rename_variables_in_bb): Same.
	(adjust_phi_and_debug_stmts): Same.
	(vect_set_loop_mask): Same.
	(add_preheader_seq): Same.
	(vect_maybe_permute_loop_masks): Same.
	(vect_set_loop_masks_directly): Same.
	(vect_set_loop_condition_masked): Same.
	(vect_set_loop_condition_unmasked): Same.
	(slpeel_duplicate_current_defs_from_edges): Same.
	(slpeel_add_loop_guard): Same.
	(slpeel_can_duplicate_loop_p): Same.
	(create_lcssa_for_virtual_phi): Same.
	(iv_phi_p): Same.
	(vect_update_ivs_after_vectorizer): Same.
	(vect_gen_vector_loop_niters_mult_vf): Same.
	(slpeel_update_phi_nodes_for_loops): Same.
	(slpeel_update_phi_nodes_for_guard1): Same.
	(find_guard_arg): Same.
	(slpeel_update_phi_nodes_for_guard2): Same.
	(slpeel_update_phi_nodes_for_lcssa): Same.
	(vect_do_peeling): Same.
	(vect_create_cond_for_alias_checks): Same.
	(vect_loop_versioning): Same.
	* tree-vect-loop.c (vect_determine_vf_for_stmt): Same.
	(vect_inner_phi_in_double_reduction_p): Same.
	(vect_analyze_scalar_cycles_1): Same.
	(vect_fixup_scalar_cycles_with_patterns): Same.
	(vect_get_loop_niters): Same.
	(bb_in_loop_p): Same.
	(vect_get_max_nscalars_per_iter): Same.
	(vect_verify_full_masking): Same.
	(vect_compute_single_scalar_iteration_cost): Same.
	(vect_analyze_loop_form_1): Same.
	(vect_analyze_loop_form): Same.
	(vect_active_double_reduction_p): Same.
	(vect_analyze_loop_operations): Same.
	(neutral_op_for_slp_reduction): Same.
	(vect_is_simple_reduction): Same.
	(vect_model_reduction_cost): Same.
	(get_initial_def_for_reduction): Same.
	(get_initial_defs_for_reduction): Same.
	(vect_create_epilog_for_reduction): Same.
	(vectorize_fold_left_reduction): Same.
	(vectorizable_reduction): Same.
	(vectorizable_induction): Same.
	(vectorizable_live_operation): Same.
	(loop_niters_no_overflow): Same.
	(vect_get_loop_mask): Same.
	(vect_transform_loop_stmt): Same.
	(vect_transform_loop): Same.
	* tree-vect-patterns.c (vect_reassociating_reduction_p): Same.
	(vect_determine_precisions): Same.
	(vect_pattern_recog_1): Same.
	* tree-vect-slp.c (vect_analyze_slp_instance): Same.
	* tree-vect-stmts.c (stmt_vectype): Same.
	(process_use): Same.
	(vect_init_vector_1): Same.
	(vect_truncate_gather_scatter_offset): Same.
	(get_group_load_store_type): Same.
	(vect_build_gather_load_calls): Same.
	(vect_get_strided_load_store_ops): Same.
	(vectorizable_simd_clone_call): Same.
	(vectorizable_store): Same.
	(permute_vec_elements): Same.
	(vectorizable_load): Same.
	(vect_transform_stmt): Same.
	(supportable_widening_operation): Same.
	* tree-vectorizer.c (vec_info::replace_stmt): Same.
	(vec_info::free_stmt_vec_info): Same.
	(vect_free_loop_info_assumptions): Same.
	(vect_loop_vectorized_call): Same.
	(set_uid_loop_bbs): Same.
	(vectorize_loops): Same.
	* tree-vectorizer.h (STMT_VINFO_BB_VINFO): Same.
	* tree.c (add_tree_to_fld_list): Same.
	(fld_type_variant_equal_p): Same.
	(fld_decl_context): Same.
	(fld_incomplete_type_of): Same.
	(free_lang_data_in_binfo): Same.
	(need_assembler_name_p): Same.
	(find_decls_types_r): Same.
	(get_eh_types_for_runtime): Same.
	(find_decls_types_in_eh_region): Same.
	(find_decls_types_in_node): Same.
	(assign_assembler_name_if_needed): Same.
	* value-prof.c (stream_out_histogram_value): Same.
	* value-prof.h: Same.
	* var-tracking.c (use_narrower_mode): Same.
	(prepare_call_arguments): Same.
	(vt_expand_loc_callback): Same.
	(resolve_expansions_pending_recursion): Same.
	(vt_expand_loc): Same.
	* varasm.c (const_hash_1): Same.
	(compare_constant): Same.
	(tree_output_constant_def): Same.
	(simplify_subtraction): Same.
	(get_pool_constant): Same.
	(output_constant_pool_2): Same.
	(output_constant_pool_1): Same.
	(mark_constants_in_pattern): Same.
	(mark_constant_pool): Same.
	(get_section_anchor): Same.
	* vr-values.c (compare_range_with_value): Same.
	(vr_values::extract_range_from_phi_node): Same.
	* vr-values.h: Same.
	* web.c (unionfind_union): Same.
	* wide-int.h: Same.

From-SVN: r273311
2019-07-09 12:32:49 -06:00
Martin Sebor 6c1dae73cd PR c++/61339 - add mismatch between struct and class [-Wmismatched-tags] to non-bugs
gcc/c/ChangeLog:

	PR c++/61339
	* c-decl.c: Change class-key from class to struct and vice versa
	to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod.
	* gimple-parser.c: Same.

gcc/c-family/ChangeLog:

	PR c++/61339
	* c-format.c (check_argument_type): Change class-key from class to
	struct and vice versa to match convention and avoid -Wclass-is-pod
	and -Wstruct-no-pod.
	* c-pretty-print.h: Same.

gcc/cp/ChangeLog:

	PR c++/61339
	* constexpr.c (cxx_eval_call_expression): Change class-key from class
	to struct and vice versa to match convention and avoid -Wclass-is-pod
	and -Wstruct-no-pod.
	* constraint.cc (get_concept_definition): Same.
	* cp-tree.h: Same.
	* cxx-pretty-print.h: Same.
	* error.c: Same.
	* logic.cc (term_list::replace): Same.
	* name-lookup.c (find_local_binding): Same.
	* pt.c (tsubst_binary_right_fold): Same.
	* search.c (field_accessor_p): Same.
	* semantics.c (expand_or_defer_fn): Same.

gcc/lto/ChangeLog:

	PR c++/61339
	* lto-dump.c: Change class-key from classi to struct and vice versa
	to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod.

gcc/ChangeLog:

	PR c++/61339
	* align.h: Change class-key from class to struct and vice versa
	to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod.
	* alloc-pool.h: Same.
	* asan.c (shadow_mem_size): Same.
	* auto-profile.c: Same.
	* basic-block.h: Same.
	* bitmap.h: Same.
	* cfgexpand.c (set_rtl): Same.
	(expand_one_stack_var_at): Same.
	* cfghooks.h: Same.
	* cfgloop.h: Same.
	* cgraph.h: Same.
	* config/i386/i386.h: Same.
	* df-problems.c (df_print_bb_index): Same.
	* df-scan.c: Same.
	* df.h (df_single_use): Same.
	* diagnostic-show-locus.c (layout::print_annotation_line): Same.
	(layout::annotation_line_showed_range_p): Same.
	(get_printed_columns): Same.
	(correction::ensure_terminated): Same.
	(line_corrections::~line_corrections): Same.
	* dojump.h: Same.
	* dse.c: Same.
	* dump-context.h: Same.
	* dumpfile.h: Same.
	* dwarf2out.c: Same.
	* edit-context.c: Same.
	* fibonacci_heap.c (test_union_of_equal_heaps): Same.
	* flags.h: Same.
	* function.c (assign_stack_local): Same.
	* function.h: Same.
	* gcc.c: Same.
	* gcov.c (block_info::block_info): Same.
	* genattrtab.c: Same.
	* genextract.c: Same.
	* genmatch.c (comparison_code_p): Same.
	(id_base::id_base): Same.
	(decision_tree::print): Same.
	* genoutput.c: Same.
	* genpreds.c (write_one_predicate_function): Same.
	* genrecog.c (validate_pattern): Same.
	(find_operand_positions): Same.
	(optimize_subroutine_group): Same.
	(merge_pattern_transition::merge_pattern_transition): Same.
	(merge_pattern_info::merge_pattern_info): Same.
	(merge_state_result::merge_state_result): Same.
	(merge_into_state): Same.
	* gensupport.c: Same.
	* gensupport.h: Same.
	* ggc-common.c (init_ggc_heuristics): Same.
	* ggc-tests.c (test_union): Same.
	* gimple-loop-interchange.cc (dump_induction): Same.
	* gimple-loop-versioning.cc: Same.
	* gimple-match.h (gimple_match_cond::any_else): Same.
	* gimple-ssa-backprop.c: Same.
	* gimple-ssa-sprintf.c: Same.
	* gimple-ssa-store-merging.c (store_operand_info::store_operand_info): Same.
	(store_immediate_info::store_immediate_info): Same.
	(merged_store_group::apply_stores): Same.
	(get_location_for_stmts): Same.
	* gimple-ssa-strength-reduction.c: Same.
	* gimple-ssa-warn-alloca.c: Same.
	* gimple-ssa-warn-restrict.c (pass_wrestrict::execute): Same.
	* godump.c (go_type_decl): Same.
	* hash-map-tests.c (test_map_of_strings_to_int): Same.
	* hash-map.h: Same.
	* hash-set-tests.c (test_set_of_strings): Same.
	* hsa-brig.c: Same.
	* hsa-common.h: Same.
	* hsa-gen.c (transformable_switch_to_sbr_p): Same.
	* input.c (assert_loceq): Same.
	* input.h: Same.
	* ipa-cp.c: Same.
	* ipa-devirt.c (possible_polymorphic_call_targets_1): Same.
	* ipa-fnsummary.h: Same.
	* ipa-inline.h: Same.
	* ipa-prop.h: Same.
	* ipa-split.c (visit_bb): Same.
	* ira-int.h (minmax_set_iter_next): Same.
	* loop-invariant.c: Same.
	* loop-iv.c: Same.
	* lra-eliminations.c: Same.
	* lra-int.h: Same.
	* lra-lives.c (mark_regno_dead): Same.
	* lra-remat.c: Same.
	* lra-spills.c: Same.
	* lto-streamer.h: Same.
	* mem-stats.h: Same.
	* omp-grid.c (omp_grid_lastprivate_predicate): Same.
	* omp-low.c (omp_clause_aligned_alignment): Same.
	* optabs-query.h (get_vcond_eq_icode): Same.
	* optabs.h: Same.
	* opts.c (wrap_help): Same.
	* poly-int.h: Same.
	* predict.c (predict_paths_leading_to_edge): Same.
	* pretty-print.h: Same.
	* profile-count.h: Same.
	* read-md.h: Same.
	* read-rtl-function.c: Same.
	* ree.c: Same.
	* reginfo.c: Same.
	* regrename.c: Same.
	* regrename.h: Same.
	* reload.h: Same.
	* rtl-iter.h: Same.
	* rtl.h (costs_add_n_insns): Same.
	* sanopt.c: Same.
	* sched-int.h: Same.
	* sel-sched-ir.h: Same.
	* selftest.h: Same.
	* sese.h (vec_find): Same.
	* stmt.c: Same.
	* target-globals.h: Same.
	* tree-affine.c (aff_combination_find_elt): Same.
	* tree-affine.h: Same.
	* tree-data-ref.h: Same.
	* tree-outof-ssa.c (ssa_is_replaceable_p): Same.
	* tree-predcom.c: Same.
	* tree-scalar-evolution.c (find_var_scev_info): Same.
	* tree-ssa-alias.h: Same.
	* tree-ssa-ccp.c: Same.
	* tree-ssa-coalesce.c (ssa_conflicts_dump): Same.
	* tree-ssa-loop-im.c (for_all_locs_in_loop): Same.
	(rewrite_mem_refs): Same.
	(execute_sm_if_changed): Same.
	(hoist_memory_references): Same.
	* tree-ssa-loop-ivopts.c (operator<=): Same.
	* tree-ssa-loop.h: Same.
	* tree-ssa-pre.c (get_or_alloc_expr_for_name): Same.
	* tree-ssa-structalias.c: Same.
	* tree-switch-conversion.h (cluster::cluster): Same.
	(simple_cluster::simple_cluster): Same.
	* tree-vect-patterns.c (type_conversion_p): Same.
	* tree-vectorizer.c (dump_stmt_cost): Same.
	* tree-vectorizer.h (loop_vec_info_for_loop): Same.
	* tree.c (protected_set_expr_location): Same.
	* tree.h (desired_pro_or_demotion_p): Same.
	(fndecl_built_in_p): Same.
	* unique-ptr-tests.cc: Same.
	* var-tracking.c (delete_variable_part): Same.
	* varasm.c (assemble_real): Same.
	(tree_output_constant_def): Same.
	* vec.c: Same.
	* wide-int-bitmask.h: Same.
	* wide-int.h (decompose): Same.

From-SVN: r273308
2019-07-09 10:36:00 -06:00
Martin Liska 8ba6ea878f Remove another bunch of dead assignment.
2019-07-03  Martin Liska  <mliska@suse.cz>

	* lra-eliminations.c (eliminate_regs_in_insn): Remove
	dead assignemts.
	* reg-stack.c (check_asm_stack_operands): Likewise.
	* tree-ssa-structalias.c (create_function_info_for): Likewise.
	* tree-vect-generic.c (expand_vector_operations_1): Likewise.
	* config/i386/i386-expand.c (ix86_expand_sse2_mulvxdi3): Use
	force_expand_binop.
2019-07-03  Martin Liska  <mliska@suse.cz>

	* c-common.c (try_to_locate_new_include_insertion_point): Remove
	dead assignemts.
2019-07-03  Martin Liska  <mliska@suse.cz>

	* call.c (build_new_op_1): Remove
	dead assignemts.
	* typeck.c (cp_build_binary_op): Likewise.
2019-07-03  Martin Liska  <mliska@suse.cz>

	* check.c (gfc_check_c_funloc): Remove
	dead assignemts.
	* decl.c (variable_decl): Likewise.
	* resolve.c (resolve_typebound_function): Likewise.
	* simplify.c (gfc_simplify_matmul): Likewise.
	(gfc_simplify_scan): Likewise.
	* trans-array.c (gfc_could_be_alias): Likewise.
	* trans-common.c (add_equivalences): Likewise.
	* trans-expr.c (trans_class_vptr_len_assignment): Likewise.
	(gfc_trans_array_constructor_copy): Likewise.
	(gfc_trans_assignment_1): Likewise.
	* trans-intrinsic.c (conv_intrinsic_atomic_op): Likewise.
	* trans-openmp.c (gfc_omp_finish_clause): Likewise.
	* trans-types.c (gfc_get_array_descriptor_base): Likewise.
	* trans.c (gfc_build_final_call): Likewise.
2019-07-03  Martin Liska  <mliska@suse.cz>

	* line-map.c (linemap_get_expansion_filename): Remove
	dead assignemts.
	* mkdeps.c (make_write): Likewise.

From-SVN: r272994
2019-07-03 08:34:20 +00:00
Qing Zhao 1c6ffbab63 re PR preprocessor/90581 (provide an option to adjust the maximum depth of nested #include)
PR preprocessor/90581
Add a cpp option -fmax-include-depth to set the maximum depth of the nested #include.

From-SVN: r272948
2019-07-02 20:23:30 +00:00
Nathan Sidwell 66d7749bce [PR preprocessor/90927] Fixe dependency output
https://gcc.gnu.org/ml/gcc-patches/2019-06/msg01664.html
	libcpp/
	PR preprocessor/90927
	* mkdeps.c (mkdeps::vec::operator[]): Add non-const variant.
	(deps_add_target): Deal with out of order unquoted targets.

	gcc/testsuite/
	* c-c++-common/pr90927.c: New.

From-SVN: r272692
2019-06-26 12:58:39 +00:00
Andrew Pinski 3f23e487f3 [PATCH] Fix PR 81721: ICE with PCH and Pragma warning and C++ operator
libcpp/ChangeLog:
2019-05-19  Andrew Pinski  <apinski@marvell.com>

        PR pch/81721
        * lex.c (cpp_token_val_index <case SPELL_OPERATOR>): If tok->flags
        has NAMED_OP set, then return CPP_TOKEN_FLD_NODE.

gcc/testsuite/ChangeLog:
2019-05-19  Andrew Pinski  <apinski@marvell.com>

        PR pch/81721
        * g++.dg/pch/operator-1.C: New testcase.
        * g++.dg/pch/operator-1.Hs: New file.

From-SVN: r271395
2019-05-19 23:59:06 -07:00
Martin Liska 19eda56db6 Fix min_location usage in line-map.c (PR preprocessor/90382).
2019-05-14  Martin Liska  <mliska@suse.cz>

	PR preprocessor/90382
	* line-map.c (first_map_in_common_1): Handle ADHOC
	locations.

From-SVN: r271163
2019-05-14 11:41:53 +00:00
Martin Liska e6fc8353fc Do a refactoring in linemap (PR preprocessor/90382).
2019-05-14  Martin Liska  <mliska@suse.cz>

	PR preprocessor/90382
	* include/line-map.h (get_data_from_adhoc_loc): Add const to
	the first argument.
	(get_location_from_adhoc_loc): Likewise.
	* line-map.c(get_data_from_adhoc_loc):  Add const to
	the first argument.
	(get_location_from_adhoc_loc): Likewise.
	(get_combined_adhoc_loc): Use get_location_from_adhoc_loc
	(or get_data_from_adhoc_loc).
	(get_range_from_adhoc_loc): Likewise.
	(get_pure_location): Likewise.
	(linemap_position_for_loc_and_offset): Likewise.
	(linemap_lookup): Likewise.
	(linemap_ordinary_map_lookup): Likewise.
	(linemap_macro_map_lookup): Likewise.
	(linemap_get_expansion_line): Likewise.
	(linemap_get_expansion_filename): Likewise.
	(linemap_location_in_system_header_p): Likewise.
	(linemap_location_from_macro_expansion_p): Likewise.
	(linemap_macro_loc_to_exp_point): Likewise.
	(linemap_resolve_location): Likewise.
	(linemap_unwind_toward_expansion): Likewise.
	(linemap_unwind_to_first_non_reserved_loc): Likewise.
	(linemap_expand_location): Likewise.
	(linemap_dump_location): Likewise.

From-SVN: r271162
2019-05-14 11:41:40 +00:00
Nathan Sidwell 61145d937b [libcpp] Reimplement mkdeps data structures
https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00323.html
	* files.c (_cpp_stack_file): Empty filenames aren't dependencies.
	* mkdeps.c (deps_add_dep): Assert not empty.

From-SVN: r270978
2019-05-07 18:13:57 +00:00
Nathan Sidwell d7b6aee8cd [libcpp] Reimplement mkdeps data structures
https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00293.html
	* include/mkdeps.h (deps_write): Add PHONY arg.
	(deps_phony_targets): Delete.
	* init.c (cpp_finish): Just call deps_write.
	* mkdeps.c (struct mkdeps): Add local vector class.  Reimplement
	vector handling.
	(munge): Munge to static buffer.
	(apply_vpath): Adjust vector handling.
	(deps_init, deps_free): Use new, delete.
	(deps_add_target): Do not munge here.  Record quoting low water mark.
	(deps_add_dep): Do not munge here.
	(deps_add_vpath): Adjust vector handling.
	(make_write_name): New.  Munge on demand here.
	(make_write_vec): New.
	(deps_phony_targets): Delete.
	(make_write): New.
	(deps_write): Forward to deps_Write.
	(deps_save, deps_restore): Adjust vector handling.

From-SVN: r270943
2019-05-07 12:39:59 +00:00
Nathan Sidwell b744fc85f5 [libcpp] struct deps renaming
https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00199.html
	libcpp/
	* include/mkdeps.h: Rename struct deps to struct mkdeps.
	* mkdeps.c: Likewise.
	* include/cpplib.h (cpp_get_deps): Rename return type..
	* directives.c (cpp_get_deps): Likewise.
	* internal.h (struct cpp_reader): Rename deps field type.

	gcc/c-family/
	* c-opts.c (handle_defered_opts): Rename struct deps to struc mkdeps.

From-SVN: r270905
2019-05-06 11:34:47 +00:00
Jonathan Wakely 0bf12a5253 Fix typo in comment
* files.c (search_path_exhausted): Fix typo in comment.

From-SVN: r270132
2019-04-03 18:56:41 +01:00
Joseph Myers 479d3a6076 * sv.po: Update.
From-SVN: r269473
2019-03-08 00:06:15 +00:00
Martin Liska 60448173c4 Improve memory statistics report readability.
2019-02-26  Martin Liska  <mliska@suse.cz>

	* alloc-pool.h (struct pool_usage): Remove extra
	print_dash_line.
	* bitmap.h (struct bitmap_usage): Likewise.
	* ggc-common.c (struct ggc_usage): Likewise.
	* mem-stats.h (struct mem_usage): Likewise.
	(mem_alloc_description::dump): Print dash lines
	here and repeat header at the end of a table report.
	It's then more readable.
	* tree-phinodes.c (phinodes_print_statistics): Make
	horizontal alignment.
	* tree-ssanames.c (ssanames_print_statistics): Likewise.
	* vec.c (struct vec_usage): Remove extra print_dash_line.
	* vec.h (vec_safe_grow_cleared): Pass PASS_MEM_STAT.
2019-02-26  Martin Liska  <mliska@suse.cz>

	* symtab.c (ht_dump_statistics): Make
	horizontal alignment for statistics.

From-SVN: r269221
2019-02-26 17:27:52 +00:00
David Malcolm 200a8e1a38 Fix ICE with #line directive (PR c/89410)
PR c/89410 reports various issues with #line directives with very
large numbers; one of them is an ICE inside diagnostic-show-locus.c
when emitting a diagnostic at line 0xffffffff.

The issue is that the arithmetic in layout::calculate_line_spans to
determine if two line spans are sufficiently close to consolidate
was using the unsigned 32-bit linenum_type, which was overflowing
when comparing the line for the expanded location with those of
the location range (all on line 0xffffffff), leading to it
erroneously adding two spans for the same line, leading to an
assertion failure.

This patch fixes the ICE by generalizing the use of long long in
line-map.h's comparison function for linenum_type into a new
linenum_arith_t typedef, and using it here.

Doing so uncovered a second problem: the loop to print the lines
within the line_span for this case is infinite: looping from
0xfffffff upwards, overflowing to 0, and then never becoming
greater than 0xfffffff.  The patch fixes this by using linenum_arith_t
there also.

gcc/ChangeLog:
	PR c/89410
	* diagnostic-show-locus.c (layout::calculate_line_spans): Use
	linenum_arith_t when determining if two adjacent line spans are
	close enough to merge.
	(diagnostic_show_locus): Use linenum_arith_t when iterating over
	lines within each line_span.

gcc/testsuite/ChangeLog:
	PR c/89410
	* gcc.dg/pr89410-1.c: New test.
	* gcc.dg/pr89410-2.c: New test.

libcpp/ChangeLog:
	PR c/89410
	* include/line-map.h (linenum_arith_t): New typedef.
	(compare): Use it.

From-SVN: r269050
2019-02-20 20:07:20 +00:00
Martin Liska a5f87af7ed Use 1UL constant in order to not overflow (PR c++/89383).
2019-02-18  Martin Liska  <mliska@suse.cz>

	PR c++/89383
	* line-map.c (linemap_line_start): Use 1UL in order
	to not overflow.

From-SVN: r268981
2019-02-18 09:46:19 +00:00
Joseph Myers 86b69c6b11 * da.po: Update.
From-SVN: r268901
2019-02-14 20:50:51 +00:00
David Malcolm a4553534df linemap_line_start: protect against location_t overflow (PR lto/88147)
PR lto/88147 reports an assertion failure due to a bogus location_t value
when adding a line to a pre-existing line map, when there's a large
difference between the two line numbers.

For some "large differences", this leads to a location_t value that exceeds
LINE_MAP_MAX_LOCATION, in which case linemap_line_start returns 0.  This
isn't ideal, but at least should lead to safe degradation of location
information.

However, if the difference is very large, it's possible for the line
number offset (relative to the start of the map) to be sufficiently large
that overflow occurs when left-shifted by the column-bits, and hence
the check against the LINE_MAP_MAX_LOCATION limit fails, leading to
a seemingly-valid location_t value, but encoding the wrong location.  This
triggers the assertion failure:
  linemap_assert (SOURCE_LINE (map, r) == to_line);

The fix (thanks to Martin) is to check for overflow when determining
whether to reuse an existing map, and to not reuse it if it would occur.

gcc/ChangeLog: David Malcolm  <dmalcolm@redhat.com>
	PR lto/88147
	* input.c (selftest::test_line_offset_overflow): New selftest.
	(selftest::input_c_tests): Call it.

libcpp/ChangeLog: Martin Liska  <mliska@suse.cz>
	PR lto/88147
	* line-map.c (linemap_line_start): Don't reuse the existing line
	map if the line offset is sufficiently large to cause overflow
	when computing location_t values.

From-SVN: r268789
2019-02-12 01:09:31 +00:00
Joseph Myers 2f2205e2ff * eo.po: Update.
From-SVN: r268592
2019-02-06 21:02:28 +00:00
Joseph Myers d24b0ba320 * ru.po: Update.
From-SVN: r268587
2019-02-06 17:41:59 +00:00
Joseph Myers 4f2f8148e6 Update .po files.
gcc/po:
	* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
	ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
	zh_TW.po: Update.

libcpp/po:
	* be.po, ca.po, da.po, de.po, el.po, eo.po, es.po, fi.po, fr.po,
	id.po, ja.po, nl.po, pr_BR.po, ru.po, sr.po, sv.po, tr.po, uk.po,
	vi.po, zh_CN.po, zh_TW.po: Update.

From-SVN: r268567
2019-02-05 23:20:00 +00:00
Joseph Myers 73353297f3 Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r268464
2019-02-01 23:04:22 +00:00
Jakub Jelinek 18f5df94df re PR preprocessor/88974 (ICE: Segmentation fault (in linemap_resolve_location))
PR preprocessor/88974
	* directives.c (SEEN_EOL): Move macro to ...
	* internal.h (SEEN_EOL): ... here.
	* expr.c (parse_has_include): Don't cpp_get_token if SEEN_EOL ().

	* c-c++-common/cpp/pr88974.c: New test.

From-SVN: r268285
2019-01-26 11:08:00 +01:00
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Mike Gulick bc65bad27f PR preprocessor/83173: Enhance -fdump-internal-locations output
gcc/ChangeLog:
2018-11-27  Mike Gulick  <mgulick@mathworks.com>

	PR preprocessor/83173
	* input.c (dump_location_info): Dump reason and included_from
	fields from line_map_ordinary struct.  Fix indentation when
	location > 5 digits.
	* diagnostic-show-locus.c (num_digits, num_digits): Move to
	diagnostic.c to allow it to be utilized by input.c.
	* diagnostic.c (num_digits, selftest::test_num_digits): Moved
	here.
	(selftest::diagnostic_c_tests): Run selftest::test_num_digits.
	* diagnostic.h (num_digits): Add extern definition.

libcpp/ChangeLog:
2018-11-27  Mike Gulick  <mgulick@mathworks.com>

	PR preprocessor/83173
	* location-example.txt: Update example -fdump-internal-locations
	output.

From-SVN: r266520
2018-11-27 16:04:31 +00:00
Mike Gulick 56c79e7f5d PR preprocessor/83173: Additional check before decrementing highest_location
2018-11-27  Mike Gulick  <mgulick@mathworks.com>

	PR preprocessor/83173
	* files.c (_cpp_stack_include): Check if
	line_table->highest_location is past current line before
	decrementing.

From-SVN: r266516
2018-11-27 15:49:43 +00:00
David Malcolm 620e594be5 Eliminate source_location in favor of location_t
Historically GCC used location_t, while libcpp used source_location.

This inconsistency has been annoying me for a while, so this patch
removes source_location in favor of location_t throughout
(as the latter is shorter).

gcc/ChangeLog:
	* builtins.c: Replace "source_location" with "location_t".
	* diagnostic-show-locus.c: Likewise.
	* diagnostic.c: Likewise.
	* dumpfile.c: Likewise.
	* gcc-rich-location.h: Likewise.
	* genmatch.c: Likewise.
	* gimple.h: Likewise.
	* gimplify.c: Likewise.
	* input.c: Likewise.
	* input.h: Likewise.  Eliminate the typedef.
	* omp-expand.c: Likewise.
	* selftest.h: Likewise.
	* substring-locations.h (get_source_location_for_substring):
	Rename to..
	(get_location_within_string): ...this.
	* tree-cfg.c: Replace "source_location" with "location_t".
	* tree-cfgcleanup.c: Likewise.
	* tree-diagnostic.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-phinodes.c: Likewise.
	* tree-phinodes.h: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa.c: Likewise.
	* tree-ssa.h: Likewise.
	* tree-vect-loop-manip.c: Likewise.

gcc/c-family/ChangeLog:
	* c-common.c (c_get_substring_location): Update for renaming of
	get_source_location_for_substring to get_location_within_string.
	* c-lex.c: Replace "source_location" with "location_t".
	* c-opts.c: Likewise.
	* c-ppoutput.c: Likewise.

gcc/c/ChangeLog:
	* c-decl.c: Replace "source_location" with "location_t".
	* c-tree.h: Likewise.
	* c-typeck.c: Likewise.
	* gimple-parser.c: Likewise.

gcc/cp/ChangeLog:
	* call.c: Replace "source_location" with "location_t".
	* cp-tree.h: Likewise.
	* cvt.c: Likewise.
	* name-lookup.c: Likewise.
	* parser.c: Likewise.
	* typeck.c: Likewise.

gcc/fortran/ChangeLog:
	* cpp.c: Replace "source_location" with "location_t".
	* gfortran.h: Likewise.

gcc/go/ChangeLog:
	* go-gcc-diagnostics.cc: Replace "source_location" with "location_t".
	* go-gcc.cc: Likewise.
	* go-linemap.cc: Likewise.
	* go-location.h: Likewise.
	* gofrontend/README: Likewise.

gcc/jit/ChangeLog:
	* jit-playback.c: Replace "source_location" with "location_t".

gcc/testsuite/ChangeLog:
	* g++.dg/plugin/comment_plugin.c: Replace "source_location" with
	"location_t".
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise.

libcc1/ChangeLog:
	* libcc1plugin.cc: Replace "source_location" with "location_t".
	(plugin_context::get_source_location): Rename to...
	(plugin_context::get_location_t): ...this.
	* libcp1plugin.cc: Likewise.

libcpp/ChangeLog:
	* charset.c: Replace "source_location" with "location_t".
	* directives-only.c: Likewise.
	* directives.c: Likewise.
	* errors.c: Likewise.
	* expr.c: Likewise.
	* files.c: Likewise.
	* include/cpplib.h: Likewise.  Rename MAX_SOURCE_LOCATION to
	MAX_LOCATION_T.
	* include/line-map.h: Likewise.
	* init.c: Likewise.
	* internal.h: Likewise.
	* lex.c: Likewise.
	* line-map.c: Likewise.
	* location-example.txt: Likewise.
	* macro.c: Likewise.
	* pch.c: Likewise.
	* traditional.c: Likewise.

From-SVN: r266085
2018-11-13 20:05:03 +00:00
Hafiz Abid Qadeer e9f3803db3 iconv.m4 (AM_ICONV_LINK): Don't overwrite CPPFLAGS.
2018-11-06  Hafiz Abid Qadeer  <abidh@codesourcery.com>

	* config/iconv.m4 (AM_ICONV_LINK): Don't overwrite CPPFLAGS.
	Append $INCICONV to it.

gcc/
	* configure: Regenerated.

libcpp/
	* configure: Likewise.

libstdc++-v3/
	* configure: Likewise.

intl/
	* configure: Likewise.

From-SVN: r265896
2018-11-07 15:41:21 -07:00
Martin Liska 546f678c5c Do not use %zu format in libcpp.
2018-11-05  Martin Liska  <mliska@suse.cz>

	* symtab.c (ht_dump_statistics): Replace %zu with %lu format.

From-SVN: r265811
2018-11-05 14:32:13 +00:00
Martin Liska 037903cbd1 Fix printf call in symtab.c.
2018-11-05  Martin Liska  <mliska@suse.cz>

	* symtab.c (ht_dump_statistics): Fix format and
	pass missing argument.

From-SVN: r265810
2018-11-05 14:25:37 +00:00
Martin Liska 46aeb07ff8 Fix string pool statistics.
2018-11-05  Martin Liska  <mliska@suse.cz>

	* symtab.c (ht_dump_statistics): Make dump conditional
	based on alloc_subobject.

From-SVN: r265797
2018-11-05 13:35:09 +00:00
Joseph Myers 22e0527251 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856).
This patch updates GCC to use autoconf 2.69 and automake 1.15.1.
(That's not the latest automake version, but it's the one used by
binutils-gdb, with which consistency is desirable, and in any case
seems a useful incremental update that should make a future update to
1.16.1 easier.)

The changes are generally similar to the binutils-gdb ones, and are
copied from there where shared files and directories are involved
(there are some further changes to such shared directories, however,
which I'd expect to apply to binutils-gdb once this patch is in GCC).
Largely, obsolete AC_PREREQ calls are removed, while many
AC_LANG_SOURCE calls are added to avoid warnings from aclocal and
autoconf.  Multilib support is no longer included in core automake,
meaning that multilib.am needs copying from automake's contrib
directory into the GCC source tree.  Autoconf 2.69 has Go support, so
local copies of that support are removed.  I hope the D support will
soon be submitted to upstream autoconf so the local copy of that can
be removed in a future update.  Changes to how automake generates
runtest calls mean quotes are removed from RUNTEST definitions in five
lib*/testsuite/Makefile.am files (libatomic, libgomp, libitm,
libphobos, libvtv; some others have RUNTEST definitions without
quotes, which are still OK); libgo and libphobos also get
-Wno-override added to AM_INIT_AUTOMAKE so those overrides of RUNTEST
do not generate automake warnings.

Note that the regeneration did not include regeneration of
fixincludes/config.h.in (attempting such regeneration resulted in all
the USED_FOR_TARGET conditionals disappearing; and I don't see
anything in the fixincludes/ directory that would result in such
conditionals being generated, unlike in the gcc/ directory).  Also
note that libvtv/testsuite/other-tests/Makefile.in was not
regenerated; that directory is not listed as a subdirectory for which
Makefile.in gets regenerated by calling "automake" in libvtv/, so I'm
not sure how it's meant to be regenerated.

While I mostly fixed warnings should running aclocal / automake /
autoconf, there were various such warnings from automake in the
libgfortran, libgo, libgomp, liboffloadmic, libsanitizer, libphobos
directories that I did not fix, preferring to leave those to the
relevant subsystem maintainers.  Specifically, most of those warnings
were of the following form (example from libgfortran):

Makefile.am:48: warning: source file 'caf/single.c' is in a subdirectory,
Makefile.am:48: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they
will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.

I think it's best for the relevant maintainers to add subdir-objects
and do any other associated Makefile.am changes needed.  In some cases
the paths in the warnings involved ../; I don't know if that adds any
extra complications to the use of subdir-objects.

I've tested this with native, cross and Canadian cross builds.  The
risk of any OS-specific issues should I hope be rather lower than if a
libtool upgrade were included (we *should* do such an upgrade at some
point, but it's more complicated - it involves identifying all our
local libtool changes to see if any aren't included in the upstream
version we update to, and reverting an upstream libtool patch that's
inappropriate for use in GCC); I think it would be better to get this
update into GCC so that people can test in different configurations
and we can fix any issues found, rather than to try to get more and
more testing done before it goes in.

top level:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* multilib.am: New file.  From automake.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
	* ar-lib: New file.
	* test-driver: New file.
	* configure: Re-generate.

config:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* math.m4, tls.m4: Use AC_LANG_SOURCE.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.

fixincludes:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, configure: Regenerate.

gcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use single
	line for second argument of AC_DEFINE_UNQUOTED.
	* doc/install.texi (Tools/packages necessary for modifying GCC):
	Update to autoconf 2.69 and automake 1.15.1.
	* aclocal.m4, config.in, configure: Regenerate.

gnattools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

gotools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* config/go.m4: Remove file.
	* Makefile.am (ACLOCAL_AMFLAGS): Do not use -I ./config.
	* configure.ac:  Remove AC_PREREQ.  Do not include config/go.m4.
	* Makefile.in, aclocal.m4, configure: Regenerate.

intl:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
	* configure: Re-generate.
	* config.h.in: Re-generate.
	* aclocal.m4: Re-generate.

libada:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

libatomic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* acinclude.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libbacktrace:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libcc1:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libcpp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* aclocal.m4, config.in, configure: Regenerate.

libdecnumber:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* aclocal.m4.

libffi:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove doc/libffi.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, fficonfig.h.in,
	include/Makefile.in, man/Makefile.in, testsuite/Makefile.in:
	Regenerate.

libgcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* configure: Regenerate.

libgfortran:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libgo [logically part of this change but omitted from the commit]:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* config/go.m4: Remove file.
	* config/libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use
	-Wno-override in AM_INIT_AUTOMAKE call.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libgomp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libgomp.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libhsail-rt:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libiberty:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* config.in: Re-generate.

libitm:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libitm.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libobjc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, config.h.in, configure: Regenerate.

liboffloadmic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* plugin/Makefile.am: Include multilib.am.
	* plugin/configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, plugin/Makefile.in,
	plugin/aclocal.m4, plugin/configure: Regenerate.

libphobos:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use -Wno-override in
	AM_INIT_AUTOMAKE call.
	* m4/autoconf.m4: Add extra argument to AC_LANG_DEFINE call.
	* m4/druntime/os.m4: Use AC_LANG_SOURCE.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, libdruntime/Makefile.in,
	src/Makefile.in, testsuite/Makefile.in: Regenerate.

libquadmath:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.8.  Add info-in-builddir.
	(all-local): Define outside conditional code.
	(CLEANFILES): Remove libquadmath.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libsanitizer:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, asan/Makefile.in, configure,
	interception/Makefile.in, libbacktrace/Makefile.in,
	lsan/Makefile.in, sanitizer_common/Makefile.in, tsan/Makefile.in,
	ubsan/Makefile.in: Regenerate.

libssp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.9.5.
	* configure.ac: Remove AC_PREREQ.  Quote argument to
	AC_RUN_IFELSE.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libstdc++-v3:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, doc/Makefile.in,
	include/Makefile.in, libsupc++/Makefile.in, po/Makefile.in,
	python/Makefile.in, src/Makefile.in, src/c++11/Makefile.in,
	src/c++17/Makefile.in, src/c++98/Makefile.in,
	src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate.

libvtv:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

lto-plugin:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

zlib:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add foreign.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* configure: Re-generate.

From-SVN: r265695
2018-10-31 17:03:16 +00:00
Nathan Sidwell f3f6029db2 [6/6] Preprocessor forced macro location
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02044.html
	libcpp/
	* internal.h (struct cpp_reader): Rename forced_token_location_p
	to forced_token_location and drop its pointerness.
	* include/cpplib.h (cpp_force_token_locations): Take location, not
	pointer to one.
	* init.c (cpp_create_reader): Adjust.
	* lex.c (cpp_read_main_file): 

	gcc/c-family/
	* c-opts.c (c_finish_options): Adjust cpp_force_token_locations call.

	gcc/fortran/
	* cpp.c (gfc_cpp_init): Adjust cpp_force_token_locations call.

From-SVN: r265692
2018-10-31 15:26:28 +00:00
Nathan Sidwell 705b0c059f [5/6] Preprocessor include
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02041.html
	* directives.c (do_include_common): Commonize cleanup path.
	(_cpp_pop_buffer): Fix leak.

From-SVN: r265690
2018-10-31 15:03:04 +00:00
Nathan Sidwell 87bacc2b39 [4/7] Preprocessor location-kind predicates
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02040.html
	* include/line-map.h (IS_ORDINARY_LOC, IS_MACRO_LOC): New
	predicates.
	(IS_ADHOC_LOC): Move earlier.
	(MAP_ORDINARY_P): Use IS_ORDINARY_LOC.
	* line-map.c (linemap_location_from_macro_expansion_p): Use
	IS_MACRO_LOC.

From-SVN: r265689
2018-10-31 14:57:13 +00:00
Nathan Sidwell c9fb347ea1 [3/7] Preprocessor macro loc
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02039.html
	* include/cpplib.h (cpp_macro_definition_location): Make inline.
	* macro.c (warn_of_redefinition): Fix comments, examine macro
	type, use C++ for.
	(cpp_macro_definition_location): Don't define here.

From-SVN: r265688
2018-10-31 14:51:54 +00:00
Nathan Sidwell 43af5ef1ce [2/7] Preprocessor node access
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02038.html
	* include/cpplib.h (HT_NODE): Don't cast NODE.
	(NODE_LEN, NODE_NAME): Use HT_NODE.

From-SVN: r265687
2018-10-31 14:46:39 +00:00
Nathan Sidwell ff65e98035 [1/7] Preprocessor cleanup
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02037.html
	* directives.c (DIRECTIVE_TABLE): Drop historical frequency
	comments.
	* files.c (_cpp_stack_file): Fix indentation.

From-SVN: r265685
2018-10-31 14:41:35 +00:00
Joseph Myers 9f936c8613 Add -std=c2x, -std=gnu2x, -Wc11-c2x-compat, C2X _Static_assert support.
Now new features are starting to be added to a C2X draft (in the C2x
branch of the C standard git repository, no public WG14 document yet),
it's time to add -std=c2x and associated options to GCC for use in
enabling C2X features.

This patch adds the expected set of options: -std=c2x, -std=gnu2x,
-Wc11-c2x-compat.  A first C2X feature is added (the only one so far
in the repository that's obviously relevant to GCC): support (as in
C++) for the string constant to be omitted in _Static_assert.  This
feature is duly also supported as an extension in earlier standard
modes (diagnosed with -pedantic, unless -Wno-c11-c2x-compat is given,
or with -Wc11-c2x-compat even in C2X mode).

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

gcc/
	* doc/cpp.texi (__STDC_VERSION__): Document C2X handling.
	* doc/invoke.texi (-std=c2x, -std=gnu2x): Document new options.
	* doc/standards.texi (C Language): Document C2X.
	* dwarf2out.c (highest_c_language), config/rl78/rl78.c
	(rl78_option_override): Handle "GNU C2X" language name.

gcc/c/
	* c-errors.c (pedwarn_c11): New function.
	* c-parser.c (disable_extension_diagnostics): Save
	warn_c11_c2x_compat and set it to 0.
	(restore_extension_diagnostics): Restore warn_c11_c2x_compat.
	(c_parser_static_assert_declaration_no_semi): Handle
	_Static_assert without string constant.
	* c-tree.h (pedwarn_c11): New prototype.

gcc/c-family/
	* c-common.c (flag_isoc2x): New variable.
	* c-common.h (clk_c): Update comment to reference C2X.
	(flag_isoc99, flag_isoc11): Update comments to reference future
	standard versions in general.
	(flag_isoc2x): Declare.
	* c-opts.c (set_std_c2x): New function.
	(c_common_handle_option): Handle -std=c2x and -std=gnu2x.
	(set_std_c89, set_std_c99, set_std_c11, set_std_c17): Set
	flag_isoc2x to 0.
	* c.opt (Wc11-c2x-compat, std=c2x, std=gnu2x): New options.

gcc/testsuite/
	* gcc.dg/c11-static-assert-7.c, gcc.dg/c11-static-assert-8.c,
	gcc.dg/c11-static-assert-9.c, gcc.dg/c2x-static-assert-1.c,
	gcc.dg/c2x-static-assert-2.c, gcc.dg/c99-static-assert-2.c,
	gcc.dg/gnu2x-static-assert-1.c: New tests.
	* gcc.dg/missing-symbol-3.c: Update expected fix-it text.

libcpp/
	* include/cpplib.h (enum c_lang): Add CLK_GNUC2X and CLK_STDC2X.
	* init.c (lang_defaults): Add GNUC2X and STDC2X entries.
	(cpp_init_builtins): Define __STDC_VERSION__ to 202000L for C2X.

From-SVN: r265251
2018-10-18 00:58:54 +01:00
David Malcolm 954ad1127e libcpp: show macro definition when used with wrong argument count
Consider:

demo.c: In function 'test':
demo.c:5:40: error: macro "LOG_2" requires 3 arguments, but only 2 given
5 |   LOG_2 ("loading file: %s\n", filename);
  |                                        ^

This patch adds a note showing the definition of the macro in
question, giving:

demo.c: In function 'test':
demo.c:5:40: error: macro "LOG_2" requires 3 arguments, but only 2 given
5 |   LOG_2 ("loading file: %s\n", filename);
  |                                        ^
In file included from demo.c:1:
logging.h:1: note: macro "LOG_2" defined here
1 | #define LOG_2(FMT, ARG0, ARG1) do { fprintf (stderr, (FMT), (ARG0), (ARG1)); }
  | 

gcc/testsuite/ChangeLog:
	* g++.dg/diagnostic/macro-arg-count.C: Move to...
	* c-c++-common/cpp/macro-arg-count-1.c: ...here, generalizing
	output for C vs C++.  Expect notes showing the definitions of the
	macros.
	* c-c++-common/cpp/macro-arg-count-2.c: New test, adapted from the
	above.

libcpp/ChangeLog:
	* macro.c (_cpp_arguments_ok): If the argument count is wrong, add
	a note showing the definition of the macro.

From-SVN: r265040
2018-10-11 13:21:28 +00:00
Nathan Sidwell c1b48b2929 [PATCH] A couple of line map fixes
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00623.html
	* include/line-map.h (LINEMAPS_MACRO_LOWEST_LOCATION): Fix
	off-by-one error.
	* line-map.c (linemap_enter_macro): Use RAII.  Clear all of the
	macro_locations.

From-SVN: r265037
2018-10-11 12:42:37 +00:00
David Malcolm c24300baea Cleanup of libcpp diagnostic callbacks
This patch renames the "error" callback within libcpp
to "diagnostic", and uses the pair of enums in cpplib.h, rather
than passing two different kinds of "int" around.

gcc/c-family/ChangeLog:
	* c-common.c (c_option_controlling_cpp_error): Rename to...
	(c_option_controlling_cpp_diagnostic): ...this, and convert
	"reason" from int to enum.
	(c_cpp_error): Rename to...
	(c_cpp_diagnostic): ...this, converting level and reason to enums.
	* c-common.h (c_cpp_error): Rename to...
	(c_cpp_diagnostic): ...this, converting level and reason to enums.
	* c-opts.c (c_common_init_options): Update for renaming.

gcc/fortran/ChangeLog:
	* cpp.c (gfc_cpp_init_0): Update for renamings.
	(cb_cpp_error): Rename to...
	(cb_cpp_diagnostic): ...this, converting level and reason to
	enums.

gcc/ChangeLog:
	* genmatch.c (error_cb): Rename to...
	(diagnostic_cb): ...this, converting int params to enums.
	(fatal_at): Update for renaming.
	(warning_at): Likewise.
	(main): Likewise.
	* input.c (selftest::ebcdic_execution_charset::apply):
	Update for renaming of...
	(selftest::ebcdic_execution_charset::on_error): ...this, renaming
	to...
	(selftest::ebcdic_execution_charset::on_diagnostic): ...this,
	converting level and reason to enums.
	(class selftest::lexer_error_sink): Rename to...
	(class selftest::lexer_test_options): ...this, renaming field
	"m_errors" to "m_diagnostics".
	(selftest::lexer_test_options::apply): Update for renaming of...
	(selftest::lexer_test_options::on_error): ...this, renaming to...
	(selftest::lexer_test_options::on_diagnostic): ...this
	converting level and reason to enums.
	(selftest::test_lexer_string_locations_raw_string_unterminated):
	Update for renamings.
	* opth-gen.awk (struct cpp_reason_option_codes_t): Use enum for
	"reason".

libcpp/ChangeLog:
	* charset.c (noop_error_cb): Rename to...
	(noop_diagnostic_cb): ...this, converting params to enums.
	(cpp_interpret_string_ranges): Update for renaming and enums.
	* directives.c (check_eol_1): Convert reason to enum.
	(do_diagnostic): Convert code and reason to enum.
	(do_error): Use CPP_W_NONE rather than 0.
	(do_pragma_dependency): Likewise.
	* errors.c (cpp_diagnostic_at): Convert level and reason to enums.
	Update for renaming.
	(cpp_diagnostic): Convert level and reason to enums.
	(cpp_error): Convert level to enum.
	(cpp_warning): Convert reason to enums.
	(cpp_pedwarning): Likewise.
	(cpp_warning_syshdr): Likewise.
	(cpp_diagnostic_with_line): Convert level and reason to enums.
	Update for renaming.
	(cpp_error_with_line): Convert level to enum.
	(cpp_warning_with_line): Convert reason to enums.
	(cpp_pedwarning_with_line): Likewise.
	(cpp_warning_with_line_syshdr): Likewise.
	(cpp_error_at): Convert level to enum.
	(cpp_errno): Likewise.
	(cpp_errno_filename): Likewise.
	* include/cpplib.h (enum cpp_diagnostic_level): Name this enum,
	and move to before struct cpp_callbacks.
	(enum cpp_warning_reason): Likewise.
	(cpp_callbacks::diagnostic): Convert params from int to enums.
	(cpp_error): Convert int param to enum cpp_diagnostic_level.
	(cpp_warning): Convert int param to enum cpp_warning_reason.
	(cpp_pedwarning): Likewise.
	(cpp_warning_syshdr): Likewise.
	(cpp_errno): Convert int param to enum cpp_diagnostic_level.
	(cpp_errno_filename): Likewise.
	(cpp_error_with_line): Likewise.
	(cpp_warning_with_line): Convert int param to enum
	cpp_warning_reason.
	(cpp_pedwarning_with_line): Likewise.
	(cpp_warning_with_line_syshdr): Likewise.
	(cpp_error_at): Convert int param to enum cpp_diagnostic_level.
	* macro.c (create_iso_definition): Convert int to enum.
	(_cpp_create_definition): Likewise.

From-SVN: r264999
2018-10-09 23:37:19 +00:00
David Malcolm 9c4a4b3cbd Add range_idx param to range_label::get_text
This patch updates the pure virtual function range_label::get_text
(and its implementations) so that the index of the range is passed
in, allowing for one label instance to be shared by multiple ranges.

gcc/c-family/ChangeLog:
	* c-format.c (range_label_for_format_type_mismatch::get_text):
	Update for new param.

gcc/c/ChangeLog:
	* c-objc-common.c (range_label_for_type_mismatch::get_text):
	Update for new param.
	* c-typeck.c (maybe_range_label_for_tree_type_mismatch::get_text):
	Likewise.

gcc/cp/ChangeLog:
	* error.c (range_label_for_type_mismatch::get_text): Update for
	new param.

gcc/ChangeLog:
	* diagnostic-show-locus.c (class layout_range): Add field
	"m_original_idx".
	(layout_range::layout_range): Add "original_idx" param and use it
	to initialize new field.
	(make_range): Use 0 for original_idx.
	(layout::layout): Pass in index to calls to
	maybe_add_location_range.
	(layout::maybe_add_location_range): Add param "original_idx" and
	pass it on to layout_range.
	(layout::print_any_labels): Pass on range->m_original_idx to
	get_text call.
	(gcc_rich_location::add_location_if_nearby): Use 0 for
	original_idx.
	* gcc-rich-location.h (text_range_label::get_text): Update for new
	param.
	(range_label_for_type_mismatch::get_text): Likewise.

libcpp/ChangeLog:
	* include/line-map.h (range_label::get_text): Add param
	"range_idx".

From-SVN: r264376
2018-09-17 23:32:12 +00:00
Nathan Sidwell 24c35f687a [libcpp] fix some line map comments
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01978.html
	* include/line-map.h (enum lc_reason): Comment each member
	separately.
	(struct line_maps): Fix reallocator comment.

From-SVN: r263987
2018-08-30 15:16:21 +00:00
Martin Liska 92a285c1a7 Replace 8 spaces with a tabular in ChangeLog files.
From-SVN: r263886
2018-08-27 14:04:23 +00:00
David Malcolm 85204e23e2 Less verbose fix-it hints for missing header files (PR 87091)
This patch tweaks maybe_add_include_fixit so that if we're emitting a note
about adding the header file, the note's primary location will be replaced
by that of the fix-it hint, to avoid repeating a location we've already
emitted (or one close to it).

For example, this simplifies:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: msg 1
  87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
     |                           ^~~~~~
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: msg 2
   73 | # include <debug/vector>
  +++ |+#include <vector>
   74 | #endif
  ....
   87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |                      ^~~

to:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: msg 1
  87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
     |                           ^~~~~~
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
   73 | # include <debug/vector>
  +++ |+#include <vector>
   74 | #endif

eliminating the repetition of line 87 in the note.

Doing so requires converting show_caret_p to a tri-state, to avoid
meaninglessly printing a caret for the first column in the next line
(and colorizing it):

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
   73 | # include <debug/vector>
  +++ |+#include <vector>
   74 | #endif
      | ^

gcc/c-family/ChangeLog:
	PR 87091
	* c-common.c (c_cpp_error): Update for conversion of show_caret_p
	to a tri-state.
	(maybe_suggest_missing_token_insertion): Likewise.
	(maybe_add_include_fixit): Add param "override_location".  If set,
	and source-printing is enabled, then override the rich_location's
	primary location with that of the insertion point for the fix-it
	hint, marking it with SHOW_LINES_WITHOUT_RANGE.
	* c-common.h (extern void maybe_add_include_fixit): Add bool
	param.
	* c-format.c (selftest::test_type_mismatch_range_labels): Update
	for conversion of show_caret_p to a tri-state.
	* c-warn.c (warn_for_restrict): Likewise.
	* known-headers.cc
	(suggest_missing_header::~suggest_missing_header): Update call to
	maybe_add_include_fixit to suggest overriding the location, as it
	is for a note.

gcc/c/ChangeLog:
	PR 87091
	* c-decl.c (implicitly_declare): Update call to
	maybe_add_include_fixit to suggest overriding the location, as it
	is for a note.
	* c-objc-common.c (c_tree_printer): Update for conversion of
	show_caret_p to a tri-state.

gcc/cp/ChangeLog:
	PR 87091
	* decl.c (grokdeclarator): Update for conversion of show_caret_p
	to a tri-state.
	* error.c (cp_printer): Likewise.
	* name-lookup.c (maybe_suggest_missing_std_header): Update call to
	maybe_add_include_fixit to suggest overriding the location, as it
	is for a note.
	* parser.c (cp_parser_string_literal): Update for conversion of
	show_caret_p to a tri-state.
	(cp_parser_elaborated_type_specifier): Likewise.
	(set_and_check_decl_spec_loc): Likewise.
	* pt.c (listify): Update call to maybe_add_include_fixit to not
	override the location, as it is for an error.
	* rtti.c (typeid_ok_p): Likewise.

gcc/ChangeLog:
	PR 87091
	* diagnostic-show-locus.c (class layout_range): Update for
	conversion of show_caret_p to a tri-state.
	(layout_range::layout_range): Likewise.
	(make_range): Likewise.
	(layout::maybe_add_location_range): Likewise.
	(layout::should_print_annotation_line_p): Don't show annotation
	lines for ranges that are SHOW_LINES_WITHOUT_RANGE.
	(layout::get_state_at_point): Update for conversion of
	show_caret_p to a tri-state.  Bail out early for
	SHOW_LINES_WITHOUT_RANGE, so that such ranges don't affect
	underlining or source colorization.
	(gcc_rich_location::add_location_if_nearby): Update for conversion
	of show_caret_p to a tri-state.
	(selftest::test_one_liner_multiple_carets_and_ranges): Likewise.
	(selftest::test_one_liner_fixit_replace_equal_secondary_range):
	Likewise.
	(selftest::test_one_liner_labels): Likewise.
	* gcc-rich-location.c (gcc_rich_location::add_expr): Update for
	conversion of show_caret_p to a tri-state.
	* pretty-print.c (text_info::set_location): Likewise.
	* pretty-print.h (text_info::set_location): Likewise.
	* substring-locations.c (format_warning_n_va): Likewise.
	* tree-diagnostic.c (default_tree_printer): Likewise.
	* tree-pretty-print.c (newline_and_indent): Likewise.

gcc/fortran/ChangeLog:
	PR 87091
	* error.c (gfc_format_decoder): Update for conversion of
	show_caret_p to a tri-state.

gcc/testsuite/ChangeLog:
	PR 87091
	* gcc.dg/empty.h: New file.
	* gcc.dg/fixits-pr84852-1.c: Update for move of fix-it hint to
	top of file and removal of redundant second printing of warning
	location.
	* gcc.dg/fixits-pr84852-2.c: Likewise.
	* gcc.dg/missing-header-fixit-3.c: Likewise.
	* gcc.dg/missing-header-fixit-4.c: New test.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Update for
	conversion of show_caret_p to a tri-state.

libcpp/ChangeLog:
	PR 87091
	* include/line-map.h (enum range_display_kind): New enum.
	(struct location_range): Replace field "m_show_caret_p" with
	"m_range_display_kind", converting from bool to the new enum.
	(class rich_location): Add example of line insertion fix-it hint.
	(rich_location::add_range): Convert param "show_caret_p" from bool
	to enum range_display_kind and rename to "range_display_kind",
	giving it a default of SHOW_RANGE_WITHOUT_CARET.
	(rich_location::set_range): Likewise, albeit without a default.
	* line-map.c (rich_location::rich_location): Update for conversion
	of show_caret_p to tri-state enum.
	(rich_location::add_range): Likewise.
	(rich_location::set_range): Likewise.

From-SVN: r263885
2018-08-27 14:02:05 +00:00
H.J. Lu cf806c7dc3 Set start_location to 0 if we ran out of line map space
With profiledbootstrap and --with-build-config=bootstrap-lto, linemap_add
may create a macro map when we run out of line map space.  This patch
changes start_location to UNKNOWN_LOCATION (0) in this case.

Tested with profiledbootstrap and --with-build-config=bootstrap-lto on
Linux/x86-64.

	PR bootstrap/86872
	* line-map.c (pure_location_p): Return true if linemap_lookup
	returns NULL.
	(linemap_add): Set start_location to 0 if we run out of line map
	space.

From-SVN: r263845
2018-08-24 16:37:53 -07:00
Nathan Sidwell a5a3524717 [CPP PATCH] node field bits
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01171.html
	* include/cpplib.h: Fixup some whitespace.
	(cpp_hashnode): Reduce type to 2 bit & flags to 8.

From-SVN: r263669
2018-08-20 17:45:42 +00:00
Nathan Sidwell a570d97f5b [CPP PATCH] node type
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01164.html
	* include/cpplib.h (NODE_BUILTIN, NODE_MACRO_ARG): Delete.
	Renumber others.
	(enum node_type): Replace NT_MACRO with NT_USER_MACRO,
	NT_BUILTIN_MACRO, NT_MACRO_ARG.  Delete NT_ASSERTION.
	(NTV_MACRO, NTV_ANSWER, NTV_BUILTIN, NTV_ARGUMENT, NTV_NONE):
	Delete.
	(CPP_HASHNODE_VALUE_IDX): Delete.
	(union _cpp_hashnode_value): GTY tag from enum node_type directly.
	(struct cpp_hashnode): Adjust GTY desc for value field.
	(cpp_user_macro_p, cpp_builtin_macro_p, cpp_macro_p): Adjust.
	* directives.c (undefine_macros): Clear value.anwers, adjust flag
	clearing.
	(_cpp_test_assertion): No need to check NT_ASSERTION.
	(do_assert, do_unassert): Likewise.
	* init.c (cpp_init_special_builtins): Set type not flags.
	* macro.c (struct macro_arg_saved_data): Add type field.
	(cpp_get_token_1): Check type not NT_VOID.
	(_cpp_free_definition): Adjust flag clearing.  Nullify
	value.answers.
	(_cpp_save_parameter, _cpp_unsave_parameters): Save and restore
	type.
	(lex_expansion_token): Check type not flags.
	(_cpp_create_definition): Set type to NT_USER_MACRO.
	(_cpp_notify_macro_use): Adjust type checking.
	* pch.c (write_macdef, count_defs, write_defs, cpp_valid_state)
	(save_macros): Adjust node type/flag handling.
	* traditional.c (_cpp_scan_out_logical_line): Check type not flags.

From-SVN: r263667
2018-08-20 16:32:29 +00:00
Nathan Sidwell 7692e253ee [CPP PATCH] Fix warning & other cleanups.
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01162.html
	* directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p.
	* include/cpplib.h (enum cpp_macro_kind): Remove trailing comma.
	(cpp_fun_like_macro_p): Make inline, define.
	* macro.c (cpp_define_lazily): Use UCHAR_MAX.
	(cpp_fun_like_macro_p): Delete.

From-SVN: r263666
2018-08-20 15:28:15 +00:00
Nathan Sidwell abcd1775e0 [PATCH] Kill cpp-id-data.h
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01149.html
	libcpp/
	* Makefile.in (TAGS_SOURCES): Remove cpp-id-data.h.
	* include/cpp-id-data.h: Delete.
	* internal.h: Include cpplib.h not cpp-id-data.h.
	gcc/
	* Makefile.in (CPP_ID_DATA_H): Delete.
	(CPP_INTERNAL_H): Don't add it.
	(GTFILES): Replace CPP_ID_DATA_H with CPPLIB_H.
	* gengtype.c (open_base_files): Replace cpp-id-data.h with cpplib.h

From-SVN: r263663
2018-08-20 14:20:04 +00:00
Nathan Sidwell 3fb558b154 [PATCH] #assert becomes macro-like
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01140.html
	libcpp/
	* include/cpp-id-data.h (struct answer): Delete.
	* include/cpplib.h (struct answer): Don't forward-declare.
	(enum cpp_macro_kind): Add cmk_assert.
	(struct cpp_macro): Union parms and next assert chain.
	(union _cpp_hashnode_value): 'answer' field is cpp_macro.
	* directives.c (parse_answer): Convert to use cpp_macro. Return
	true on success. 
	(parse_assertion, find_answer, _cpp_test_assertion, cpp_do_assert)
	(cpp_do_unassert): Convert to use cpp_macro.
	* macro.c (warn_of_redefinition, _cpp_new_macro)
	(check_trad_stringification, cpp_macro_definition): Adjust macro
	parm access.
	* traditional.c (_cpp_replacement_text_len)
	(_cpp_copy_replacement_text, _cpp_create_trad_definition): Likewise.
	gcc/c-family/
	* c-ada-spec.c (macro_length, dump_ada_macros): Adjust macro parm
	access.

From-SVN: r263658
2018-08-20 12:39:36 +00:00
Nathan Sidwell 800c0e9877 [PATCH] Adjust lazy macro definition
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01072.html
	libcpp/
	* include/cpplib.h (struct cpp_callbacks): Replace
	user_builtin_macro with user_lazy_macro.
	(struct cpp_macro): add lazy field.
	(enum cpp_builtin_type): Remove BT_FIRST_USER, BT_LAST_USER.
	(cpp_define_lazily): Declare.
	* macro.c (enter_macro_context) Use _cpp_maybe_notify_macro_use.
	(warn_of_redefinition): Use cpp_builtin_macro_p, directly call
	user_lazy_macro hook.
	(_cpp_new_macro): Clear lazy field.
	(cpp_define_lazily): Define.
	(_cpp_notify_macro_use): Adjust lazy definition code.
	(cpp_macro_definition): No need to do lazy definition here.
	* pch.c (write_macdef, save_macros): Likewise.
	gcc/c-family/
	* c-cppbuiltin.c (struct lazy_hex_fp_value_struct): Remove macro
	field.
	(laxy_hex_fp_value_count): Make unsigned.
	(lazy_hex_fp_value): Provided with macro & lazy number.  Directly
	manipulate the macro.
	(builtin_defin_with_hex_fp_value): Adjust callback name, use
	cpp_define_lazily.

From-SVN: r263640
2018-08-17 23:18:11 +00:00
Nathan Sidwell 10f04917ab [PATCH] Macro body is trailing array
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01037.html
	* include/cpplib.h (enum cpp_macro_kind): New.
	(struct cpp_macro): Make body trailing array.  Add kind field,
	delete traditional flag.
	* internal.h (_cpp_new_macro): Declare.
	(_cpp_reserve_room): New inline.
	(_cpp_commit_buf): Declare.
	(_cpp_create_trad_definition): Return new macro.
	* lex.c (_cpp_commit_buff): New.
	* macro.c (macro_real_token_count): Count backwards.
	(replace_args): Pointer equality not orderedness.
	(_cpp_save_parameter): Use _cpp_reserve_room.
	(alloc_expansion_token): Delete.
	(lex_expansion_token): Return macro pointer.  Use _cpp_reserve_room.
	(create_iso_definition): Allocate macro itself.  Adjust for
	different allocation ordering.
	(_cpp_new_macro): New.
	(_cpp_create_definition): Adjust for API changes.
	* traditional.c (push_replacement_text): Don't set traditional
	flag.
	(save_replacement_text): Likewise.
	(_cpp_create_trad_definition): Allocate macro itself, Adjust for
	different allocation ordering.

From-SVN: r263622
2018-08-17 16:07:19 +00:00
Nathan Sidwell c5d725c0a8 [PATCH] Move cpp_macro to cpplib.h
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01016.html
	libcpp/
	* cpp-id-data.h (uchar, UC): Move to internal.h
	(struct cpp_macro): Move to cpplib.h.
	* internal.h (uchar, UC): From cpp-id-data.h.
	* include/cpplib.h (struct cpp_macro): From cpp-id-data.h.
	gcc/c-family/
	* c-ada-spec.c: Don't #include "cpp-id-data.h"
	* c-cppbuiltin.c: Likewise.
	gcc/
	* cppbuiltin.c: Include "cpplib.h", not "cpp-id-data.h".

From-SVN: r263618
2018-08-17 12:04:13 +00:00
Nathan Sidwell 729a01f72c [PATCH] Macro definition parameter parsing
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00977.html
	libcpp/
	* internal.h (_cpp_save_parameter): Take parmno, not macro.
	(_cpp_unsave_parameters): Declare.
	* macro.c (_cpp_save_parameter): Take parm number, not macro.
	Return true on success.
	(_cpp_unsave_parameters): New.
	(parse_params): Take parm_no and variadic pointers, not macro.
	Reimplement parsing logic.
	(create_iso_definition): Adjust parse_params changes.  Call
	_cpp_unsave_parameters here.
	(_cpp_create_definition): Don't unsave params here.
	* traditional.c (scan_parameters): Take n_param pointer, adjust.
	(_cpp_create_trad_definition): Ajust scan_parameters change.  Call
	_cpp_unsave_parameters.
	gcc/testsuite/
	* gcc.dg/cpp/macsyntx.c: Adjust expected errors.
	* gcc.dg/cpp/macsyntx2.c: likewise.

From-SVN: r263600
2018-08-16 19:18:42 +00:00
Nathan Sidwell 3f6677f418 [PATCH] CPP Macro predicates
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00897.html
	libcpp/
	* include/cpplib.h (cpp_user_macro_p, cpp_builtin_macro_p)
	(cpp_macro_p): New inlines.
	* directives.c (do_pragma_poison): Use cpp_macro_p.
	(do_ifdef, do_ifndef): Likewise.  Use _cpp_maybe_notify_macro_use.
	(cpp_pop_definition): Use cpp_macro_p.  Move _cpp_free_definition
	earlier.  Don't zap node directly.
	* expr.c (parse_defined): Use _cpp_maybe_notify_macro_use &
	cpp_macro_p.
	* files.c (should_stack_file): Use cpp_macro_p.
	* identifiers.c (cpp_defined): Likewise.
	* internal.h (_cpp_mark_macro): Use cpp_user_macro_p.
	(_cpp_notify_macro_use): Declare.
	(_cpp_maybe_notify_macro_use): New inline.
	* lex.c (is_macro): Use cpp_macro_p.
	* macro.c (_cpp_warn_if_unused_macro): Use cpp_user_macro_p.
	(enter_macro_context): Likewise.
	(_cpp_create_definition): Use cpp_builtin_macro_p,
	cpp_user_macro_p.  Move _cpp_free_definition earlier.
	(_cpp_notify_macro_use): New, broken out of multiple call sites.
	* traditional.c (fun_like_macro_p): Use cpp_builtin_macro_p.
	(maybe_start_funlike, _cpp_scan_out_logical_line)
	(push_replacement_text): Likewise.
	gcc/c-family/
	* c-ada-spec.c (count_ada_macro): Use cpp_user_macro_p.
	(store_ada_macro): Likewise.
	* c-ppoutput.c (cb_used_define, dump_macro): Likewise.
	* c-spellcheck.cc (should-suggest_as_macro_p): Likewise,
	gcc/
	* config/rs6000/rs6000-c.c (rs6000_macro_to_expend): Use cpp_macro_p.
	* config/powerpcspc/powerpcspe-c.c (rs6000_macro_to_expend): Likewise.
	gcc/cp/
	* name-lookup.c (lookup_name_fuzzy): Likewise.
	gcc/fortran/
	* cpp.c (dump_macro): Use cpp_user_macro_p.

From-SVN: r263587
2018-08-16 13:51:38 +00:00
David Malcolm 96e6ae576c diagnostics: add labeling of source ranges
This patch adds the ability to label source ranges within a rich_location,
to be printed by diagnostic_show_locus.

For example:

pr69554-1.c:11:18: error: invalid operands to binary + (have 'const char *' and 'const char *')
11 |   return (p + 1) + (q + 1);
   |          ~~~~~~~ ^ ~~~~~~~
   |             |         |
   |             |         const char *
   |             const char *

The patch implements labels for various type mismatch errors in the C and
C++ frontends, and in -Wformat.  I implemented it wherever accurate location
information was guaranteed (there are other places that could benefit, but
we need better location information in those places).

The labels can be disabled via -fno-diagnostics-show-labels.

Similarly:

param-type-mismatch.C: In function 'int test_1(int, int, float)':
param-type-mismatch.C:11:27: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
11 |   return callee_1 (first, second, third);
   |                           ^~~~~~
   |                           |
   |                           int
param-type-mismatch.C:7:43: note:   initializing argument 2 of 'int callee_1(int, const char*, float)'
7 | extern int callee_1 (int one, const char *two, float three);
  |                               ~~~~~~~~~~~~^~~

where the first "error" describing the bad argument gets a label
describing the type inline (since it's non-obvious from "second").
The "note" describing the type of the param of the callee *doesn't*
get a label, since that information is explicit there in the
source ("const char *two").

The idea is that in any diagnostic where two aspects of the source aren't
in sync it ought to be easier for the user if we directly show them the
mismatching aspects inline (e.g. types).

As well as type mismatch errors, perhaps labels could also be used for
buffer overflow warnings, for describing the capacity of the destination
buffer vs the size of what's being written:

  sprintf (buf, "filename: %s\n", file);
           ^~~   ~~~~~~~~~~~^~~
           |                |
           capacity: 32     10 + strlen(file) + 2

or somesuch.  Another idea might be for macro expansion warnings:

warning: repeated side effects in macro expansion...
   x = MIN (p++, q++);
       ~~~~^~~~~~~~~~
note: ...expanded here as
 #define MIN(X,Y) (X<Y?X:Y)
         ^~~ ~ ~   ~ ~ ~ ~
             | |   | | | |
             | |   | | | q++
             | |   | | p++
             | |   | q++
             | q++ p++
             p++

The patch removes some logic from multiline.exp which special-cased
lines ending with a '|' character (thus complicating testing of this
patch).  I believe that this was a vestige from experiments I did to
support strippng dg directives from the output; it was present in the
earliest version of multiline.exp I posted:
  "[RFC, stage1] Richer source location information for gcc 6 (location ranges etc)"
    https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00837.html
and I believe was neved used.

gcc/c-family/ChangeLog:
	* c-format.c: Include "selftest-diagnostic.h" and
	"gcc-rich-location.h".
	(format_warning_at_char): Pass NULL for new label params of
	format_warning_va.
	(class indirection_suffix): New class.
	(class range_label_for_format_type_mismatch): New class.
	(format_type_warning): Move logic for generating "*" suffix to
	class indirection_suffix.  Create "fmt_label" and "param_label"
	to show their types, and pass them to the
	format_warning_at_substring calls.
	(selftest::test_type_mismatch_range_labels): New test.
	(selftest::c_format_c_tests): Call it.

gcc/c/ChangeLog:
	* c-objc-common.c: Include "gcc-rich-location.h".
	(c_tree_printer): Move implemenation of '%T' to...
	(print_type): ...this new function.
	(range_label_for_type_mismatch::get_text): New function.
	* c-typeck.c (convert_for_assignment): Add type labels to the rhs
	range for the various ic_argpass cases.
	(class maybe_range_label_for_tree_type_mismatch): New class.
	(build_binary_op): Use it when calling binary_op_error.

gcc/cp/ChangeLog:
	* call.c: Include "gcc-rich-location.h".
	(convert_like_real): Add range label for "invalid conversion"
	diagnostic.
	(perform_implicit_conversion_flags): Add type label to the
	"could not convert" error.
	* error.c: Include "gcc-rich-location.h".
	(range_label_for_type_mismatch::get_text): New function.
	* typeck.c (convert_for_assignment): Add type label to
	the "cannot convert" error if a location is available.

gcc/ChangeLog:
	* common.opt (fdiagnostics-show-labels): New option.
	* diagnostic-show-locus.c (class layout_range): Add field
	"m_label".
	(class layout): Add field "m_show_labels_p".
	(layout_range::layout_range): Add param "label" and use it to
	initialize m_label.
	(make_range): Pass in NULL for new "label" param of layout_range's
	ctor.
	(layout::layout): Initialize m_show_labels_p.
	(layout::maybe_add_location_range): Pass in loc_range->m_label
	when constructing layout_range instances.
	(struct line_label): New struct.
	(layout::print_any_labels): New member function.
	(layout::print_line): Call it if label-printing is enabled.
	(selftest::test_one_liner_labels): New test.
	(selftest::test_diagnostic_show_locus_one_liner): Call it.
	* diagnostic.c (diagnostic_initialize): Initialize
	context->show_labels_p.
	* diagnostic.h (struct diagnostic_context): Add field
	"show_labels_p".
	* doc/invoke.texi (Diagnostic Message Formatting Options): Add
	-fno-diagnostics-show-labels.
	* dwarf2out.c (gen_producer_string): Add
	OPT_fdiagnostics_show_labels to the ignored options.
	* gcc-rich-location.c (gcc_rich_location::add_expr): Add "label"
	param.
	(gcc_rich_location::maybe_add_expr): Likewise.
	* gcc-rich-location.h (gcc_rich_location::gcc_rich_location): Add
	label" param, defaulting to NULL.
	(gcc_rich_location::add_expr): Add "label" param.
	(gcc_rich_location::maybe_add_expr): Likewise.
	(class text_range_label): New class.
	(class range_label_for_type_mismatch): New class.
	* gimple-ssa-sprintf.c (fmtwarn): Pass NULL for new label params
	of format_warning_va.
	(fmtwarn_n): Likewise for new params of format_warning_n_va.
	* lto-wrapper.c (merge_and_complain): Add
	OPT_fdiagnostics_show_labels to the "pick one setting" options.
	(append_compiler_options): Likewise to the dropped options.
	(append_diag_options): Likewise to the passed-on options.
	* opts.c (common_handle_option): Handle the new option.
	* selftest-diagnostic.c
	(test_diagnostic_context::test_diagnostic_context): Enable
	show_labels_p.
	* substring-locations.c: Include "gcc-rich-location.h".
	(format_warning_n_va): Add "fmt_label" and "param_label" params
	and use them as appropriate.
	(format_warning_va): Add "fmt_label" and "param_label" params,
	passing them on to format_warning_n_va.
	(format_warning_at_substring): Likewise.
	(format_warning_at_substring_n): Likewise.
	* substring-locations.h (format_warning_va): Add "fmt_label" and
	"param_label" params.
	(format_warning_n_va): Likewise.
	(format_warning_at_substring): Likewise.
	(format_warning_at_substring_n): Likewise.
	* toplev.c (general_init): Initialize global_dc->show_labels_p.

gcc/testsuite/ChangeLog:
	* g++.dg/diagnostic/aka3.C: New test.
	* g++.dg/diagnostic/param-type-mismatch-2.C: Update expected
	output to show range labels.
	* g++.dg/diagnostic/param-type-mismatch.C: Likewise.
	* g++.dg/plugin/plugin.exp (plugin_test_list): Add...
	* g++.dg/plugin/show-template-tree-color-labels.C: New test.
	* gcc.dg/bad-binary-ops.c: Update expected output to show range
	labels.  Add an "aka" example.
	* gcc.dg/cpp/pr66415-1.c: Update expected output to show range
	labels.
	* gcc.dg/format/diagnostic-ranges.c: Likewise.
	* gcc.dg/format/pr72858.c: Likewise.
	* gcc.dg/format/pr78498.c: Likewise.
	* gcc.dg/param-type-mismatch.c: Add "-Wpointer-sign" to options.
	Update expected output to show range labels.  Add examples of
	-Wincompatible-pointer-types and -Wpointer-sign for parameters.
	* gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c:
	Update expected output to show range labels.
	* gcc.dg/plugin/diagnostic-test-show-locus-bw.c: Likewise.
	(test_very_wide_line): Adjust so that label is at left-clipping
	boundary.
	(test_very_wide_line_2): New test.
	* gcc.dg/plugin/diagnostic-test-show-locus-color-line-numbers.c:
	Update expected output to show range labels.
	* gcc.dg/plugin/diagnostic-test-show-locus-color.c: Likewise.
	* gcc.dg/plugin/diagnostic-test-show-locus-no-labels.c: New test.
	* gcc.dg/plugin/diagnostic_plugin_show_trees.c (show_tree): Update
	for new param to gcc_rich_location::add_expr.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (add_range):
	Add "label" param.
	(test_show_locus): Add examples of labels to various tests.  Tweak
	the "very wide_line" test case and duplicate it, to cover the
	boundary values for clipping of labels against the left-margin.
	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add
	diagnostic-test-show-locus-no-labels.c.
	* gcc.dg/pr69554-1.c: Update expected output to show range labels.
	Update line numbers of dg-locus directives.
	* gcc.dg/pr69627.c:  Update expected output to show range labels.
	* lib/multiline.exp (proc _build_multiline_regex): Remove
	special-case handling of lines with trailing '|'.

libcpp/ChangeLog:
	* include/line-map.h (struct location_range): Add "m_label" field.
	(class rich_location): Add description of labels to leading
	comment.
	(rich_location::rich_location): Add "label" param, defaulting to
	NULL.
	(rich_location::add_range): Likewise.
	(struct label_text): New struct.
	(class range_label): New abstract base class.
	* line-map.c (rich_location::rich_location): Add "label" param;
	use it.
	(rich_location::add_range): Likewise.

From-SVN: r263564
2018-08-15 18:09:35 +00:00
Nathan Sidwell f10a91352f [PATCH] line-map include-from representation
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00554.html
	Make linemap::included_from a location
	libcpp/
	* include/line-map.h (struct line_map_ordinary): Replace
	included_from map index with included_at source_location.
	(ORDINARY_MAP_INCLUDER_FILE_INDEX): Delete.
	(LAST_SOURCE_LINE_LOCATION): Delete.
	(LAST_SOURCE_LINE, LAST_SOURCE_COLUMN): Delete.
	(linemap_included_from): New.
	(linemap_included_from_linemap): Declare.
	(MAIN_FILE_P): Adjust.
	* line-map.c (linemap_included_from_linemap): New.
	(lonemap_check_files_exited): Use linemap_included_at.
	(linemap_add): Adjust inclusion setting.
	(linemap_dump, linemap_dump_location): Adjust.
	* directives.c (do_linemarker): Use linemap_included_at.
	gcc/
	* diagnostic.c (diagnostic_report_current_module): Use
	linemap_included_from & linemap_included_from_linemap.
	gcc/c-family/
	* c-common.c (try_to_locate_new_include_inertion_point): Use
	linemap_included_from_linemap.
	* c-lex.c (fe_file_change): Use linemap_included_from.
	* c-ppoutput.c (pp_file_change): Likewise.
	gcc/fortran/
	* cpp.c (cb_file_change): Use linemap_included_from.
	gcc/testsuite/
	* c-c++-common/inc-from-1a.h, c-c++-common/inc-from-1b.h,
	c-c++-common/inc-from-1.c: New

From-SVN: r263429
2018-08-08 18:13:00 +00:00
Nathan Sidwell e81c3c4dc1 [PATCH] Line map table allocation
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00434.html
	* line-map.c: (linemap_init): Set default allocator here.
	(new_linemap): Rather than here.  Refactor allocation logic.

From-SVN: r263366
2018-08-07 21:28:51 +00:00
Joseph Myers 44f916dcce Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r262972
2018-07-25 15:31:18 +01:00
David Malcolm 181463c271 libcpp: remove redundant parameter from rich_location::set_range
gcc/c-family/ChangeLog:
	* c-common.c (c_cpp_error): Remove redundant "line_table"
	parameter from call to rich_location::set_range.
	(maybe_suggest_missing_token_insertion): Likewise.

gcc/ChangeLog:
	* pretty-print.c (text_info::set_location): Remove redundant
	"line_table" parameter from call to rich_location::set_range.

libcpp/ChangeLog:
	* include/line-map.h (rich_location::set_range): Remove redundant
	line_maps * parameter.
	* line-map.c (rich_location::set_range): Likewise.

From-SVN: r262913
2018-07-20 21:39:14 +00:00
Bernd Edlinger 6f41f92beb re PR c/69558 (glib2 warning pragmas stopped working)
libcpp:
2018-07-18  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR 69558
        * macro.c (enter_macro_context): Change the location info for builtin
        macros and _Pragma from location of the closing parenthesis to location
        of the macro expansion point.

testsuite:
2018-07-18  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR 69558
        * c-c++-common/cpp/diagnostic-pragma-2.c: New test.
        * c-c++-common/pr69558.c: Remove xfail.
        * gcc.dg/cpp/builtin-macro-1.c: Adjust test expectations.
        * gcc.dg/pr61817-1.c: Likewise.
        * gcc.dg/pr61817-2.c: Likewise.
        * g++.dg/plugin/pragma_plugin.c: Warn at expansion_point_location.

From-SVN: r262861
2018-07-18 19:36:01 +00:00
Jakub Jelinek 0c86a39db2 lex.c (_cpp_lex_direct): Use CPP_DL_NOTE instead of CPP_DL_PEDWARN...
* lex.c (_cpp_lex_direct): Use CPP_DL_NOTE instead of CPP_DL_PEDWARN,
	CPP_DL_WARNING or CPP_DL_ERROR for note that diagnostics for C++ style
	comments is reported only once per file and guard those calls on the
	preceding cpp_error returning true.

	* gcc.dg/cpp/pr61854-c90.c (foo): Expect a note, rather than error.
	* gcc.dg/cpp/pr61854-c94.c (foo): Likewise.
	* gcc.dg/cpp/pr61854-4.c (foo): Likewise.
	* gcc.dg/cpp/pr61854-8.c: New test.

From-SVN: r262832
2018-07-17 20:10:57 +02:00
Nathan Sidwell 42a98b43bb Reorg line_map data structures for better packing.
* include/line-map.h (enum lc_reason): Add LC_HWM.
	(LINE_MAP_MAX_LOCATION): Define here.
	(struct line_map): Move reason field to line_map_ordinary.  Adjust
	GTY tagging.
	(struct line_map_ordinary): Reorder fields for less padding.
	(struct line_map_macro): Likewise.
	(MAP_ORDINARY_P): New.
	(linemap_check_ordinary, linemap_check_macro): Adjust.
	* line-map.c (LINE_MAP_MAX_SOURCE_LOCATION): Delete.
	(new_linemap): Take start_location, not reason.  Adjust.
	(linemap_add, linemap_enter_macro): Adjust.
	(linemap_line_start): Likewise.
	(linemap_macro_expansion_map_p): Use MAP_ORDINARY_P.
	(linemap_macro_loc_to_spelling_point): Likewise.
	(linemap_macro_loc_to_def_point): Likewise.
	(linemap_dump): Likewise.

From-SVN: r262348
2018-07-03 14:47:11 +00:00
Joseph Myers 61362140d7 * fr.po: Update.
From-SVN: r261439
2018-06-11 18:07:56 +01:00
Joseph Myers fa725532c4 * eo.po: Update.
From-SVN: r261280
2018-06-07 16:26:56 +01:00
Jason Merrill a6b2922160 * system.h: #include <new> earlier.
From-SVN: r260620
2018-05-23 13:13:30 -04:00
Jason Merrill b2ff74575d line-map.c (linemap_init): Use placement new.
* line-map.c (linemap_init): Use placement new.

	* system.h: #include <new>.

From-SVN: r260343
2018-05-17 19:28:34 -04:00
Joseph Myers 71fbbf65fa Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r259575
2018-04-23 21:27:02 +01:00
Joseph Myers fc5dbf7c54 * es.po: Update.
From-SVN: r258906
2018-03-27 23:31:08 +01:00
David Malcolm 082284da9d Fix ICE for missing header fix-it hints with overlarge #line directives (PR c/84852)
PR c/84852 reports an ICE inside diagnostic_show_locus when printing
a diagnostic for a source file with a #line >= 2^31:

  #line 7777777777
  int foo (void) { return strlen(""); }

where we're attempting to print a fix-it hint at the top of the file
and underline the "strlen" (two "line spans").

The
  #line 7777777777
won't fix within the 32-bit linenum_type, and is truncated from
  0x1cf977871
to
   0xcf977871
i.e. 3482810481 in decimal.

Such a #line is reported by -pedantic and -pedantic-errors, but we
shouldn't ICE.

The ICE is an assertion failure within layout::calculate_line_spans,
where the line spans have not been properly sorted.

The layout_ranges are stored as int, rather than linenum_type,
giving line -812156815 for the error, and line 1 for the fix-it hint.

However, line_span uses linenum_type rather than int.

line_span::comparator compares these values as int, and hence
decides that (linenum_type)3482810481 aka (int)-812156815 is less
than line 1.

This leads to this assertion failing in layout::calculate_line_spans:

1105	      gcc_assert (next->m_first_line >= current->m_first_line);

since it isn't the case that 1 >= 3482810481.

The underlying problem is the mix of types for storing line numbers:
in parts of libcpp and diagnostic-show-locus.c we use linenum_type;
in other places (including libcpp's expanded_location) we use int.

I looked at using linenum_type throughout, but doing so turned into
a large patch, so this patch fixes the ICE in a less invasive way
by merely using linenum_type more consistently just within
diagnostic-show-locus.c, and fixing line_span::comparator to properly
handle line numbers (and line number differences) >= 2^31, by using
a new helper function for linenum_type differences, computing the
difference using long long, and using the sign of the difference
(as the difference might not fit in the "int" return type imposed
by qsort).

gcc/ChangeLog:
	PR c/84852
	* diagnostic-show-locus.c (class layout_point): Convert m_line
	from int to linenum_type.
	(line_span::comparator): Use linenum "compare" function when
	comparing line numbers.
	(test_line_span): New function.
	(layout_range::contains_point): Convert param "row" from int to
	linenum_type.
	(layout_range::intersects_line_p): Likewise.
	(layout::will_show_line_p): Likewise.
	(layout::print_source_line): Likewise.
	(layout::should_print_annotation_line_p): Likewise.
	(layout::print_annotation_line): Likewise.
	(layout::print_leading_fixits): Likewise.
	(layout::annotation_line_showed_range_p): Likewise.
	(struct line_corrections): Likewise for field m_row.
	(line_corrections::line_corrections): Likewise for param "row".
	(layout::print_trailing_fixits): Likewise.
	(layout::get_state_at_point): Likewise.
	(layout::get_x_bound_for_row): Likewise.
	(layout::print_line): Likewise.
	(diagnostic_show_locus): Likewise for locals "last_line" and
	"row".
	(selftest::diagnostic_show_locus_c_tests): Call test_line_span.
	* input.c (selftest::test_linenum_comparisons): New function.
	(selftest::input_c_tests): Call it.
	* selftest.c (selftest::test_assertions): Test ASSERT_GT,
	ASSERT_GT_AT, ASSERT_LT, and ASSERT_LT_AT.
	* selftest.h (ASSERT_GT): New macro.
	(ASSERT_GT_AT): New macro.
	(ASSERT_LT): New macro.
	(ASSERT_LT_AT): New macro.

gcc/testsuite/ChangeLog:
	PR c/84852
	* gcc.dg/fixits-pr84852-1.c: New test.
	* gcc.dg/fixits-pr84852-2.c: New test.

libcpp/ChangeLog:
	* include/line-map.h (compare): New function on linenum_type.

From-SVN: r258526
2018-03-14 13:58:13 +00:00
Joseph Myers 250540af39 * da.po: Update.
From-SVN: r258221
2018-03-03 18:55:20 +00:00
Jonathan Wakely b44f8ad8b2 PR preprocessor/84517 allow double-underscore macros after string literals
gcc/testsuite:

	PR preprocessor/84517
	* g++.dg/cpp0x/udlit-macros.C: Expect a warning for ""__FILE__.

libcpp:

	PR preprocessor/84517
	* lex.c (is_macro_not_literal_suffix): New function.
	(lex_raw_string, lex_string): Use is_macro_not_literal_suffix to
	decide when to issue -Wliteral-suffix warnings.

From-SVN: r258069
2018-02-28 15:27:17 +00:00
Richard Biener fe74f9b4ed re PR bootstrap/82939 (genmatch fills up terminal with endless printing of periods)
2018-02-16  Richard Biener  <rguenther@suse.de>

	PR bootstrap/82939
	* line-map.c (linemap_init): Avoid broken value-init when compiling
	with GCC 4.2.

From-SVN: r257732
2018-02-16 12:02:34 +00:00
Jason Merrill 60887f8c2d PR preprocessor/83063 - __VA_OPT__ and ##
PR preprocessor/83708
	* macro.c (vaopt_state): Reorder m_last_was_paste before m_state.
	(vaopt_state::vaopt_state): Adjust.
	(vaopt_state::update_flags): Add BEGIN and END.
	(vaopt_state::update): Return them.
	(copy_paste_flag): Factor out of replace_args.
	(last_token_is): New.
	(replace_args): Handle BEGIN and END.  Avoid padding there.
	(tokens_buff_last_token_ptr): Return NULL if no tokens.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r257696
2018-02-15 12:43:01 -05:00
Jason Merrill 8fa4bd81cb * libcpp/macro.c: Fix typos.
From-SVN: r257682
2018-02-15 00:58:35 -05:00
Joseph Myers e3f62e027f * ru.po: Update.
From-SVN: r257365
2018-02-04 14:01:51 +00:00
Joseph Myers 635ace2c87 * pt_BR.po: Update.
From-SVN: r257350
2018-02-02 21:30:48 +00:00
Joseph Myers 7f93b148cb Update cpplib .po files.
* be.po, ca.po, da.po, de.po, el.po, eo.po, es.po, fi.po, fr.po,
	id.po, ja.po, nl.po, pr_BR.po, ru.po, sr.po, sv.po, tr.po, uk.po,
	vi.po, zh_CN.po, zh_TW.po: Update.

From-SVN: r257273
2018-01-31 22:52:47 +00:00
Jakub Jelinek 1306a81d81 re PR preprocessor/69869 (internal compiler error: Segmentation fault in call to skip_macro_block_comment when using '-traditional-cpp')
PR preprocessor/69869
	* traditional.c (skip_macro_block_comment): Return bool, true if
	the macro block comment is unterminated.
	(copy_comment): Use return value from skip_macro_block_comment instead
	of always false.

	* gcc.dg/cpp/trad/pr69869.c: New test.

From-SVN: r257220
2018-01-31 09:31:52 +01:00
Jakub Jelinek 53723269d6 c-cppbuiltin.c (c_cpp_builtins): Use ggc_strdup for the fp_suffix argument.
* c-cppbuiltin.c (c_cpp_builtins): Use ggc_strdup for the fp_suffix
	argument.
	(LAZY_HEX_FP_VALUES_CNT): Define.
	(lazy_hex_fp_values): Allow up to LAZY_HEX_FP_VALUES_CNT lazy hex fp
	values rather than just 12.
	(builtin_define_with_hex_fp_value): Likewise.

	* include/cpplib.h (enum cpp_builtin_type): Change BT_LAST_USER from
	BT_FIRST_USER + 31 to BT_FIRST_USER + 63.

From-SVN: r257118
2018-01-27 07:27:47 +01:00
Joseph Myers 6db724435a Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r257111
2018-01-26 22:51:02 +00:00
Boris Kolpackov 7365279fca Add ability to remap file names in __FILE__, etc (PR other/70268)
This commit adds the -fmacro-prefix-map option that allows remapping of file
names in __FILE__, __BASE_FILE__, and __builtin_FILE(), similar to how
-fdebug-prefix-map allows to do the same for debug information.

Additionally, it adds -ffile-prefix-map which can be used to specify both
mappings with a single option (and, should we need to add more -f*-prefix-map
options in the future, those as well).

libcpp/ChangeLog:

2018-01-18  Boris Kolpackov  <boris@codesynthesis.com>

        PR other/70268
        * include/cpplib.h (cpp_callbacks::remap_filename): New callback.
        * libcpp/macro.c (_cpp_builtin_macro_text): Call remap_filename for
        __FILE__ and __BASE_FILE__.


gcc/ChangeLog:

2018-01-18  Boris Kolpackov  <boris@codesynthesis.com>

        PR other/70268
        * common.opt: (-ffile-prefix-map): New option.
        * opts.c (common_handle_option): Defer it.
        * opts-global.c (handle_common_deferred_options): Handle it.
        * debug.h (remap_debug_filename, add_debug_prefix_map): Move to...
        * file-prefix-map.h: New file.
        (remap_debug_filename, add_debug_prefix_map): ...here.
        (add_macro_prefix_map, add_file_prefix_map, remap_macro_filename): New.
        * final.c (debug_prefix_map, add_debug_prefix_map
        remap_debug_filename): Move to...
        * file-prefix-map.c: New file.
        (file_prefix_map, add_prefix_map, remap_filename) ...here and rename,
        generalize, get rid of alloca(), use strrchr() instead of strchr().
        (add_macro_prefix_map, add_debug_prefix_map, add_file_prefix_map):
        Implement in terms of add_prefix_map().
        (remap_macro_filename, remap_debug_filename): Implement in term of
        remap_filename().
        * Makefile.in (OBJS, PLUGIN_HEADERS): Add new files.
        * builtins.c (fold_builtin_FILE): Call remap_macro_filename().
        * dbxout.c: Include file-prefix-map.h.
        * varasm.c: Likewise.
        * vmsdbgout.c: Likewise.
        * xcoffout.c: Likewise.
        * dwarf2out.c: Likewise plus omit new options from DW_AT_producer.
        * doc/cppopts.texi (-fmacro-prefix-map): Document.
        * doc/invoke.texi (-ffile-prefix-map): Document.
	(-fdebug-prefix-map): Update description.


gcc/c-family/ChangeLog:

2018-01-18  Boris Kolpackov  <boris@codesynthesis.com>

        PR other/70268
        * c-family/c.opt (-fmacro-prefix-map): New option.
        * c-family/c-opts.c (c_common_handle_option): Handle it.
        * c-family/c-lex.c (init_c_lex): Set remap_filename cpp callback.
        * c-family/c-ppoutput.c (init_pp_output): Likewise.


gcc/testsuite/ChangeLog:

2018-01-18  Boris Kolpackov  <boris@codesynthesis.com>

        PR other/70268
        * c-c++-common/ffile-prefix-map.c: New test.
        * c-c++-common/fmacro-prefix-map.c: New test.
        * c-c++-common/cpp/ffile-prefix-map.c: New test.
        * c-c++-common/cpp/fmacro-prefix-map.c: New test.

From-SVN: r256847
2018-01-18 13:17:37 +00:00
Kelvin Nilsen a3a821c903 rs6000-p8swap.c (rs6000_sum_of_two_registers_p): New function.
gcc/ChangeLog:

2018-01-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	* config/rs6000/rs6000-p8swap.c (rs6000_sum_of_two_registers_p):
	New function.
	(rs6000_quadword_masked_address_p): Likewise.
	(quad_aligned_load_p): Likewise.
	(quad_aligned_store_p): Likewise.
	(const_load_sequence_p): Add comment to describe the outer-most loop.
	(mimic_memory_attributes_and_flags): New function.
	(rs6000_gen_stvx): Likewise.
	(replace_swapped_aligned_store): Likewise.
	(rs6000_gen_lvx): Likewise.
	(replace_swapped_aligned_load): Likewise.
	(replace_swapped_load_constant): Capitalize argument name in
	comment describing this function.
	(rs6000_analyze_swaps): Add a third pass to search for vector loads
	and stores that access quad-word aligned addresses and replace
	with stvx or lvx instructions when appropriate.
	* config/rs6000/rs6000-protos.h (rs6000_sum_of_two_registers_p):
	New function prototype.
	(rs6000_quadword_masked_address_p): Likewise.
	(rs6000_gen_lvx): Likewise.
	(rs6000_gen_stvx): Likewise.
	* config/rs6000/vsx.md (*vsx_le_perm_load_<mode>): For modes
	VSX_D (V2DF, V2DI), modify this split to select lvx instruction
	when memory address is aligned.
	(*vsx_le_perm_load_<mode>): For modes VSX_W (V4SF, V4SI), modify
	this split to select lvx instruction when memory address is aligned.
	(*vsx_le_perm_load_v8hi): Modify this split to select lvx
	instruction when memory address is aligned.
	(*vsx_le_perm_load_v16qi): Likewise.
	(four unnamed splitters): Modify to select the stvx instruction
	when memory is aligned.

gcc/testsuite/ChangeLog:

2018-01-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	* gcc.target/powerpc/pr48857.c: Modify dejagnu directives to look
	for lvx and stvx instead of lxvd2x and stxvd2x and require
	little-endian target.  Add comments.
	* gcc.target/powerpc/swaps-p8-28.c: Add functions for more
	comprehensive testing.
	* gcc.target/powerpc/swaps-p8-29.c: Likewise.
	* gcc.target/powerpc/swaps-p8-30.c: Likewise.
	* gcc.target/powerpc/swaps-p8-31.c: Likewise.
	* gcc.target/powerpc/swaps-p8-32.c: Likewise.
	* gcc.target/powerpc/swaps-p8-33.c: Likewise.
	* gcc.target/powerpc/swaps-p8-34.c: Likewise.
	* gcc.target/powerpc/swaps-p8-35.c: Likewise.
	* gcc.target/powerpc/swaps-p8-36.c: Likewise.
	* gcc.target/powerpc/swaps-p8-37.c: Likewise.
	* gcc.target/powerpc/swaps-p8-38.c: Likewise.
	* gcc.target/powerpc/swaps-p8-39.c: Likewise.
	* gcc.target/powerpc/swaps-p8-40.c: Likewise.
	* gcc.target/powerpc/swaps-p8-41.c: Likewise.
	* gcc.target/powerpc/swaps-p8-42.c: Likewise.
	* gcc.target/powerpc/swaps-p8-43.c: Likewise.
	* gcc.target/powerpc/swaps-p8-44.c: Likewise.
	* gcc.target/powerpc/swaps-p8-45.c: Likewise.
	* gcc.target/powerpc/vec-extract-2.c: Add comment and remove
	scan-assembler-not directives that forbid lvx and xxpermdi.
	* gcc.target/powerpc/vec-extract-3.c: Likewise.
	* gcc.target/powerpc/vec-extract-5.c: Likewise.
	* gcc.target/powerpc/vec-extract-6.c: Likewise.
	* gcc.target/powerpc/vec-extract-7.c: Likewise.
	* gcc.target/powerpc/vec-extract-8.c: Likewise.
	* gcc.target/powerpc/vec-extract-9.c: Likewise.
	* gcc.target/powerpc/vsx-vector-6-le.c: Change
	scan-assembler-times directives to reflect different numbers of
	expected xxlnor, xxlor, xvcmpgtdp, and xxland instructions.

libcpp/ChangeLog:

2018-01-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	* lex.c (search_line_fast): Remove illegal coercion of an
	unaligned pointer value to vector pointer type and replace with
	use of __builtin_vec_vsx_ld () built-in function, which operates
	on unaligned pointer values.

From-SVN: r256656
2018-01-14 05:19:29 +00:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Michael Weiser 35c4515b8b [PATCH, PR83492] Fix selection of aarch64 big-endian shift parameters based on __AARCH64EB__
2017-12-20  Michael Weiser  <michael.weiser@gmx.de>

	PR preprocessor/83492
	* lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]:
	Fix selection of big-endian shift parameters by using
	__ARM_BIG_ENDIAN.

From-SVN: r255896
2017-12-20 15:07:01 +00:00
Bernd Edlinger c65e18d333 invoke.texi: Document -Wcast-function-type.
gcc:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * doc/invoke.texi: Document -Wcast-function-type.
        * recog.h (stored_funcptr): Change signature.
        * tree-dump.c (dump_node): Avoid warning.
        * typed-splay-tree.h (typed_splay_tree): Avoid warning.

libcpp:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * internal.h (maybe_print_line): Change signature.

c-family:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * c.opt (Wcast-function-type): New warning option.
        * c-lex.c (get_fileinfo): Avoid warning.
        * c-ppoutput.c (scan_translation_unit_directives_only): Remove cast.

c:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * c-typeck.c (c_safe_arg_type_equiv_p,
        c_safe_function_type_cast_p): New function.
        (build_c_cast): Implement -Wcast-function-type.

cp:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * decl2.c (start_static_storage_duration_function): Avoid warning.
        * typeck.c (cxx_safe_arg_type_equiv_p,
        cxx_safe_function_type_cast_p): New function.
        (build_reinterpret_cast_1): Implement -Wcast-function-type.

testsuite:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * c-c++-common/Wcast-function-type.c: New test.
        * g++.dg/Wcast-function-type.C: New test.

From-SVN: r255661
2017-12-14 18:59:24 +00:00
Jakub Jelinek a7b1ce0405 re PR c++/79228 ('i' suffix for __complex__ extension interferes with C++14 UDLs for std::complex)
PR c++/79228
	* expr.c (interpret_float_suffix): Avoid memcmp.
	(interpret_int_suffix): Likewise.  Don't check for if.

From-SVN: r255434
2017-12-05 22:00:15 +01:00
Jason Merrill f2b8b8adba PR c++/79228 - extensions hide C++14 complex literal operators
libcpp/
	* expr.c (interpret_float_suffix): Ignore 'i' in C++14 and up.
	(interpret_int_suffix): Likewise.
gcc/cp/
	* parser.c (cp_parser_userdef_numeric_literal): Be helpful about
	'i' in C++14 and up.

From-SVN: r255335
2017-12-01 15:19:07 -05:00
David Malcolm 6df8934f6a Reject fix-it hints for various awkward boundary cases (PR c/82050)
PR c/82050 reports a failed assertion deep within diagnostic_show_locus's
code for printing fix-it hints.

The root cause is a fix-it hint suggesting a textual replacement,
where the affected column numbers straddle the LINE_MAP_MAX_COLUMN_NUMBER
boundary, so that the start of the range has a column number, but the
end of the range doesn't.

The fix is to verify that the column numbers are sane when adding fix-it
hints to a rich_location, rejecting fix-it hints where they are not.

libcpp/ChangeLog:
	PR c/82050
	* include/line-map.h (LINE_MAP_MAX_COLUMN_NUMBER): Move here.
	* line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): ...from here.
	(rich_location::maybe_add_fixit): Reject fix-it hints in which
	the start column exceeds the next column.

From-SVN: r255214
2017-11-28 19:24:35 +00:00
Eric Gallager 34b81eb96c Use -Wtraditional for "would be stringified in traditional C" (PR preprocessor/81794)
libcpp/ChangeLog:

2017-03-24  Eric Gallager  <egall@gwmail.gwu.edu>

	PR preprocessor/81794
	* macro.c (check_trad_stringification): Have warning be controlled
	by -Wtraditional.

gcc/testsuite/ChangeLog:

2017-09-17  Eric Gallager  <egall@gwmail.gwu.edu>

	PR preprocessor/81794
	* gcc.dg/pragma-diag-7.c: Update to include check for
	stringification.

From-SVN: r254981
2017-11-21 00:57:29 +00:00
David Malcolm 01ada12136 C++: provide macro used-before-defined hint (PR c++/72786)
This patch uses the name_hint/deferred_diagnostic to provide
a message in the C++ frontend if a macro is used before it is defined
e.g.:

test.c:6:24: error: expected ';' at end of member declaration
   virtual void clone() const OVERRIDE { }
                        ^~~~~
                             ;
test.c:6:30: error: 'OVERRIDE' does not name a type
   virtual void clone() const OVERRIDE { }
                              ^~~~~~~~
test.c:6:30: note: the macro 'OVERRIDE' had not yet been defined
test.c:15:0: note: it was later defined here
 #define OVERRIDE override

It's possible to do it from the C++ frontend as tokenization happens
up-front (and hence the macro already exists when the above is parsed);
I attempted to do it from the C frontend, but because the C frontend only
tokenizes on-demand during parsing, the macro isn't known about until
later.

gcc/cp/ChangeLog:
	PR c++/72786
	* name-lookup.c (class macro_use_before_def): New class.
	(lookup_name_fuzzy): Detect macro that were used before being
	defined, and report them as such.

gcc/ChangeLog:
	PR c++/72786
	* spellcheck.h (best_match::blithely_get_best_candidate): New
	accessor.

gcc/testsuite/ChangeLog:
	PR c++/72786
	* g++.dg/spellcheck-macro-ordering-2.C: New test case.
	* g++.dg/spellcheck-macro-ordering.C: Add dg-message directives
	for macro used-before-defined.

libcpp/ChangeLog:
	PR c++/72786
	* include/cpplib.h (cpp_macro_definition_location): New decl.
	* macro.c (cpp_macro_definition): New function.

From-SVN: r254978
2017-11-21 00:40:53 +00:00
Tom Tromey fb771b9dad Implement __VA_OPT__
This implements __VA_OPT__, a new preprocessor feature added in C++2A.
The paper can be found here:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0306r4.html

gcc/ChangeLog

        * doc/cpp.texi (Variadic Macros): Document __VA_OPT__.

gcc/testsuite/ChangeLog

        * c-c++-common/cpp/va-opt-pedantic.c: New file.
        * c-c++-common/cpp/va-opt.c: New file.
        * c-c++-common/cpp/va-opt-error.c: New file.

libcpp/ChangeLog

        * pch.c (cpp_read_state): Set n__VA_OPT__.
        * macro.c (vaopt_state): New class.
        (_cpp_arguments_ok): Check va_opt flag.
        (replace_args, create_iso_definition): Use vaopt_state.
        * lex.c (lex_identifier_intern): Possibly issue errors for
        __VA_OPT__.
        (lex_identifier): Likewise.
        (maybe_va_opt_error): New function.
        * internal.h (struct lexer_state) <va_args_ok>: Update comment.
        (struct spec_nodes) <n__VA_OPT__>: New field.
        * init.c (struct lang_flags) <va_opt>: New field.
        (lang_defaults): Add entries for C++2A.  Update all entries for
        va_opt.
        (cpp_set_lang): Initialize va_opt.
        * include/cpplib.h (struct cpp_options) <va_opt>: New field.
        * identifiers.c (_cpp_init_hashtable): Initialize n__VA_OPT__.

From-SVN: r254707
2017-11-13 20:17:42 +00:00
David Malcolm 846b84fba7 libcpp: move line typedef and column-numbering comment to top of file
The description of our 1-based column-numbering convention was in
a non-obvious place withn line-map.h; this patch moves it to the top
of that header.

libcpp/ChangeLog:
	* include/line-map.h (linenum_type): Move this typedef and the
	comment describing column numbering to near the top of the file.

From-SVN: r254703
2017-11-13 19:07:26 +00:00
Mukesh Kapoor 7d19c460ed re PR c++/80955 (Macros expanded in definition of user-defined literals)
/libcpp
2017-11-06  Mukesh Kapoor  <mukesh.kapoor@oracle.com>

	PR c++/80955
	* lex.c (lex_string): When checking for a valid macro for the
	warning related to -Wliteral-suffix (CPP_W_LITERAL_SUFFIX),
	check that the macro name does not start with an underscore
	before calling is_macro().

/gcc/testsuite
2017-11-06  Mukesh Kapoor  <mukesh.kapoor@oracle.com>

	PR c++/80955
	* g++.dg/cpp0x/udlit-macros.C: New.

From-SVN: r254443
2017-11-06 10:33:41 +00:00
Tom de Vries c830c7d5c7 [libcpp] Remove semicolon after do {} while (0) in BUF_APPEND
2017-11-05  Tom de Vries  <tom@codesourcery.com>

	PR other/82784
	* lex.c (BUF_APPEND): Remove semicolon after
	"do {} while (0)".

From-SVN: r254424
2017-11-05 09:58:16 +00:00
David Malcolm 64a5912c9e diagnostics: get rid of *_at_rich_loc in favor of overloading
Adding a fix-it hint currently involves changing e.g.:

  error_at (token->location,
            "unknown type name %qE; did you mean %qs?",
            token->value, hint);
to:

  gcc_rich_location richloc (token->location);
  richloc.add_fixit_replace (hint);
  error_at_rich_loc (&richloc,
                     "unknown type name %qE; did you mean %qs?",
                     token->value, hint);

to make the change from taking a location_t to a rich_location *.

This patch renames the "*_at_rich_loc" diagnostic entrypoints to use
the same function names for rich_location * as for location_t,
via overloading, to simplify the above change to just changing from:

  error_at (token->location,
            "unknown type name %qE; did you mean %qs?",
            token->value, hint);
to:

  gcc_rich_location richloc (token->location);
  richloc.add_fixit_replace (hint);
  error_at (&richloc,
            "unknown type name %qE; did you mean %qs?",
            token->value, hint);

thus saving space (and typing) and usually avoiding the need to reindent
the "error_at" invocation.

With this change, 0 is no longer acceptable as a location_t to these
entrypoints, as e.g.:

../../src/gcc/auto-profile.c:855:37: error: call of overloaded
'inform(int, const char [18])' is ambiguous
       inform (0, "Not expected TAG.");
                                     ^
In file included from ../../src/gcc/auto-profile.c:35:0:
../../src/gcc/diagnostic-core.h:88:13: note: candidate:
'void inform(location_t, const char*, ...)'
 extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
             ^~~~~~
../../src/gcc/diagnostic-core.h:89:13: note: candidate:
'void inform(rich_location*, const char*, ...)'
 extern void inform (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
             ^~~~~~

Such locations now need to be spelled out as UNKNOWN_LOCATION,
rather than 0.

I considered making the API take a rich_location & rather than a
rich_location *, but doing so would mean replacing
  diagnostic_set_info
and
  diagnostic_set_info_translated
with a constructor for diagnostic_info, which was a more invasive
change.  Maybe in the future.

gcc/ChangeLog:
	* auto-profile.c (autofdo_source_profile::read): Use
	UNKNOWN_LOCATION rather than 0.
	* diagnostic-core.h (warning_at_rich_loc): Rename to...
	(warning_at): ...this overload.
	(warning_at_rich_loc_n): Rename to...
	(warning_n): ...this overload.
	(error_at_rich_loc): Rename to...
	(error_at): ...this overload.
	(pedwarn_at_rich_loc): Rename to...
	(pedwarn): ...this overload.
	(permerror_at_rich_loc): Rename to...
	(permerror): ...this overload.
	(inform_at_rich_loc): Rename to...
	(inform): ...this overload.
	* diagnostic.c: (diagnostic_n_impl): Delete location_t-based decl.
	(diagnostic_n_impl_richloc): Rename to...
	(diagnostic_n_impl): ...this rich_location *-based decl.
	(inform_at_rich_loc): Rename to...
	(inform): ...this, and add an assertion.
	(inform_n): Update for removal of location_t-based diagnostic_n_impl.
	(warning_at_rich_loc): Rename to...
	(warning_at): ...this, and add an assertion.
	(warning_at_rich_loc_n): Rename to...
	(warning_n): ...this, and add an assertion.
	(warning_n): Update location_t-based implementation for removal of
	location_t-based diagnostic_n_impl.
	(pedwarn_at_rich_loc): Rename to...
	(pedwarn): ...this, and add an assertion.
	(permerror_at_rich_loc): Rename to...
	(permerror): ...this, and add an assertion.
	(error_n): Update for removal of location_t-based diagnostic_n_impl.
	(error_at_rich_loc): Rename to...
	(error_at): ...this, and add an assertion.
	* gcc.c (do_spec_1): Use UNKNOWN_LOCATION rather than 0.
	(driver::do_spec_on_infiles): Likewise.
	* substring-locations.c (format_warning_va): Update for renaming
	of inform_at_rich_loc.

gcc/c-family/ChangeLog:
	* c-common.c (binary_op_error): Update for renaming of
	error_at_rich_loc.
	(c_parse_error): Likewise.
	* c-warn.c (warn_logical_not_parentheses): Likewise for
	renaming of inform_at_rich_loc.
	(warn_for_restrict): Likewise for renaming of
	warning_at_rich_loc_n.

gcc/c/ChangeLog:
	* c-decl.c (implicit_decl_warning): Update for renaming of
	pedwarn_at_rich_loc and warning_at_rich_loc.
	(implicitly_declare): Likewise for renaming of inform_at_rich_loc.
	(undeclared_variable): Likewise for renaming of error_at_rich_loc.
	* c-parser.c (c_parser_declaration_or_fndef): Likewise.
	(c_parser_struct_or_union_specifier): Likewise for renaming of
	pedwarn_at_rich_loc.
	(c_parser_parameter_declaration): Likewise for renaming of
	error_at_rich_loc.
	* c-typeck.c (build_component_ref): Likewise.
	(build_unary_op): Likewise for renaming of inform_at_rich_loc.
	(pop_init_level): Likewise for renaming of warning_at_rich_loc.
	(set_init_label): Likewise for renaming of error_at_rich_loc.

gcc/cp/ChangeLog:
	* class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
	than 0.
	* name-lookup.c (suggest_alternatives_for): Update for renaming of
	inform_at_rich_loc.
	(maybe_suggest_missing_header): Likewise.
	(suggest_alternative_in_explicit_scope): Likewise.
	* parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
	renaming of error_at_rich_loc.
	(cp_parser_string_literal): Likewise.
	(cp_parser_nested_name_specifier_opt): Likewise.
	(cp_parser_cast_expression): Likewise for renaming of
	warning_at_rich_loc.
	(cp_parser_decl_specifier_seq): Likewise for renaming of
	error_at_rich_loc and warning_at_rich_loc.
	(cp_parser_elaborated_type_specifier): Likewise for renaming of
	pedwarn_at_rich_loc.
	(cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
	error_at_rich_loc.
	(cp_parser_virt_specifier_seq_opt): Likewise.
	(cp_parser_class_specifier_1): Likewise.
	(cp_parser_class_head): Likewise.
	(cp_parser_member_declaration): Likewise for renaming of
	pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
	(cp_parser_enclosed_template_argument_list): Likewise for renaming
	of error_at_rich_loc.
	(set_and_check_decl_spec_loc): Likewise.
	* pt.c (listify): Likewise.
	* rtti.c (typeid_ok_p): Likewise.
	* semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
	than 0.
	* typeck.c (access_failure_info::maybe_suggest_accessor): Update
	for renaming of inform_at_rich_loc.
	(finish_class_member_access_expr): Likewise for renaming of
	error_at_rich_loc.

gcc/objc/ChangeLog:
	* objc-gnu-runtime-abi-01.c (objc_gnu_runtime_abi_01_init): Use
	UNKNOWN_LOCATION rather than 0.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/diagnostic_plugin_show_trees.c (show_tree): Update
	for renaming of error_at_rich_loc and inform_at_rich_loc.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
	(test_show_locus): Likewise for renaming of warning_at_rich_loc.

libcpp/ChangeLog:
	* directives.c (_cpp_handle_directive): Update for renaming of
	cpp_error_at_richloc to cpp_error_at.
	* errors.c (cpp_diagnostic_at_richloc): Rename to...
	(cpp_diagnostic_at): ...this, dropping the location_t-based
	implementation.
	(cpp_diagnostic): Update for removal of location_t-based
	cpp_diagnostic_at.
	(cpp_error_at): Likewise.
	(cpp_error_at_richloc): Rename to...
	(cpp_error_at): ...this, and update for renaming of
	cpp_diagnostic_at_richloc.
	* include/cpplib.h (cpp_error_at_richloc): Rename to...
	(cpp_error_at): ...this.

From-SVN: r254280
2017-10-31 20:21:58 +00:00
Joseph Myers c76dc9c32d Add -std=c17, -std=gnu17.
C17, a bug-fix version of the C11 standard with DR resolutions
integrated, will soon go to ballot.  This patch adds corresponding
options -std=c17, -std=gnu17 (new default version, replacing
-std=gnu11 as the default), -std=iso9899:2017.  As a bug-fix version
of the standard, there is no need for flag_isoc17 or any options for
compatibility warnings; however, there is a new __STDC_VERSION__
value, so new cpplib languages CLK_GNUC17 and CLK_STDC17 are added to
support using that new value with the new options.  (If the standard
ends up being published in 2018 and being known as C18, option aliases
can be added.  Note however that -std=iso9899:199409 corresponds to a
__STDC_VERSION__ value rather than a publication date.)

(There are a couple of DR resolutions needing implementing in GCC, but
that's independent of the new options.)

(I'd propose to add -std=c2x / -std=gnu2x / -Wc11-c2x-compat for the
next major C standard revision once there are actually C2x drafts
being issued with new features included.)

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc:
	* doc/invoke.texi (C Dialect Options): Document -std=c17,
	-std=iso9899:2017 and -std=gnu17.
	* doc/standards.texi (C Language): Document C17 support.
	* doc/cpp.texi (Overview): Mention -std=c17.
	(Standard Predefined Macros): Document C11 and C17 values of
	__STDC_VERSION__.  Do not refer to C99 support as incomplete.
	* doc/extend.texi (Inline): Do not list individual options for
	standards newer than C99.
	* dwarf2out.c (highest_c_language, gen_compile_unit_die): Handle
	"GNU C17".
	* config/rl78/rl78.c (rl78_option_override): Handle "GNU C17"
	language name.

gcc/c-family:
	* c.opt (std=c17, std=gnu17, std=iso9899:2017): New options.
	* c-opts.c (set_std_c17): New function.
	(c_common_init_options): Use gnu17 as default C version.
	(c_common_handle_option): Handle -std=c17 and -std=gnu17.

gcc/testsuite:
	* gcc.dg/c17-version-1.c, gcc.dg/c17-version-2.c: New tests.

libcpp:
	* include/cpplib.h (enum c_lang): Add CLK_GNUC17 and CLK_STDC17.
	* init.c (lang_defaults): Add GNUC17 and STDC17 data.
	(cpp_init_builtins): Handle C17 value of __STDC_VERSION__.

From-SVN: r254216
2017-10-30 12:17:40 +00:00
Nathan Sidwell 35b82d26e5 [PATCH] preprocessor stringizing raw strings
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00611.html
	libcpp/
	PR preprocessor/82506
	* macro.c (cpp_quote_string): Escape raw LFs.

	gcc/testsuite/
	PR preprocessor/82506
	* g++.dg/cpp/string-3.C: New.

From-SVN: r253605
2017-10-10 18:56:31 +00:00
Andrew Sutton 026a79f70c Add support for -std=c++2a.
* c-common.h (cxx_dialect): Add cxx2a as a dialect.
	* opt.c: Add options for -std=c++2a and -std=gnu++2a.
	* c-opts.c (set_std_cxx2a): New.
	(c_common_handle_option): Set options when -std=c++2a is enabled.
	(c_common_post_options): Adjust comments.
	(set_std_cxx14, set_std_cxx17): Likewise.

	* doc/cpp.texi (__cplusplus): Document value for -std=c++2a
	or -std=gnu+2a.
	* doc/invoke.texi: Document -std=c++2a and -std=gnu++2a.

	* lib/target-supports.exp (check_effective_target_c++17): Return
	1 also if check_effective_target_c++2a.
	(check_effective_target_c++17_down): New.
	(check_effective_target_c++2a_only): New.
	(check_effective_target_c++2a): New.
	* g++.dg/cpp2a/cplusplus.C: New.

	* include/cpplib.h (c_lang): Add CXX2A and GNUCXX2A.
	* init.c (lang_defaults): Add rows for CXX2A and GNUCXX2A.
	(cpp_init_builtins): Set __cplusplus to 201709L for C++2a.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r252850
2017-09-15 23:16:37 +02:00
Jakub Jelinek 7b9361409d invoke.texi: Document -std=c++17 and -std=gnu++17 and document c++1z and gnu++1z as deprecated.
* doc/invoke.texi: Document -std=c++17 and -std=gnu++17 and document
	c++1z and gnu++1z as deprecated.  Change other references to
	-std=c++1z to -std=c++17 and -std=gnu++1z to -std=gnu++17.
	Change -Wc++1z-compat to -Wc++17-compat.
	* doc/cpp.texi: Document -std=c++17 defines __cplusplus 201703L.
	* dwarf2out.c (highest_c_language): Handle C++17.
	(gen_compile_unit_die): Likewise.
c-family/
	* c.opt (Wc++1z-compat): Change from option to undocumented alias.
	(Wc++17-compat): Change from undocumented alias to option.
	(Wnoexcept-type): Enable by Wc++17-compat instead of Wc++1z-compat,
	change C++1z to C++17 in description.
	(std=c++1z, std=gnu++1z): Change from option to undocumented
	deprecated alias.
	(std=c++17, std=gnu++17): Change from undocumented alias to option.
	Adjust description.
	* c-common.h (enum cxx_dialect): Rename cxx1z to cxx17.
	* c-opts.c (set_std_cxx1z): Rename to ...
	(set_std_cxx17): ... this.
	(c_common_handle_option): Rename OPT_std_c__1z to OPT_std_c__17
	and OPT_std_gnu__1z to OPT_std_gnu__17.  Adjust set_std_cxx1z
	caller.  
	(c_common_post_options): Use cxx17 instead of cxx1z.  Adjust
	comments.
cp/
	* decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
	adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
	to C++17 or -std=gnu++17 or -std=c++17.  Adjust comments.
	(cxx_init_decl_processing, next_initializable_field,
	is_direct_enum_init, check_initializer, cp_finish_decl,
	mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
	finish_function): Likewise.
	* cp-tree.h (DECL_INLINE_VAR_P): Likewise.
	* pt.c (mark_template_parm, convert_nontype_argument,
	instantiate_class_template_1, type_unification_real, unify,
	get_partial_spec_bindings, dependent_type_p_r): Likewise.
	* typeck.c (cp_build_unary_op): Likewise.
	* constexpr.c (var_in_maybe_constexpr_fn): Likewise.
	* call.c (build_user_type_conversion_1, build_over_call,
	build_special_member_call): Likewise.
	* lambda.c (begin_lambda_type): Likewise.
	* typeck2.c (process_init_constructor_record): Likewise.
	* class.c (build_base_field, finalize_literal_type_property,
	explain_non_literal_class): Likewise.
	* parser.c (cp_parser_diagnose_invalid_type_name,
	cp_parser_primary_expression, cp_parser_lambda_introducer,
	cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
	cp_convert_range_for, cp_parser_perform_range_for_lookup,
	cp_parser_decomposition_declaration, cp_parser_linkage_specification,
	cp_parser_static_assert, cp_parser_simple_type_specifier,
	cp_parser_namespace_definition, cp_parser_using_declaration,
	cp_parser_init_declarator, cp_parser_type_parameter_key,
	cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
	cp_parser_constructor_declarator_p): Likewise.
	* mangle.c (struct globals): Rename need_cxx1z_warning to
	need_cxx17_warning.
	(write_exception_spec, start_mangling, mangle_decl): Likewise.
	* Make-lang.in (check-c++1z): Rename to check-c++17, depend on
	it.
	(check-c++17): New goal.  Use 17 instead of 1z.
	(check-c++-all): Use 17 instead of 1z.
testsuite/
	* lib/g++-dg.exp (g++-dg-runtest): Use 17 instead of 1z.
	* lib/target-supports.exp (check_effective_target_c++14): Use
	check_effective_target_c++17 instead of check_effective_target_c++1z.
	(check_effective_target_c++14_down): Likewise.
	(check_effective_target_c++1z_only): Rename to ...
	(check_effective_target_c++17_only): ... this.
	(check_effective_target_c++1z): Rename to ...
	(check_effective_target_c++17): ... this.
	* g++.dg/debug/dwarf2/inline-var-1.C: Use -std=c++17 or -std=gnu++17
	instead of -std=c++1z or -std=gnu++1z.  Use c++17 instead of c++1z
	and c++17_only instead of c++1z_only.  Adjust expected diagnostics
	and comments refering to 1z to 17.
	* g++.dg/debug/dwarf2/inline-var-2.C: Likewise.
	* g++.dg/template/partial5.C: Likewise.
	* g++.dg/template/nontype8.C: Likewise.
	* g++.dg/cpp1z/noexcept-type5.C: Likewise.
	* g++.dg/cpp1z/nontype3a.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda4.C: Likewise.
	* g++.dg/cpp1z/noexcept-type16.C: Likewise.
	* g++.dg/cpp1z/class-deduction32.C: Likewise.
	* g++.dg/cpp1z/pr78771.C: Likewise.
	* g++.dg/cpp1z/elide1.C: Likewise.
	* g++.dg/cpp1z/fold3.C: Likewise.
	* g++.dg/cpp1z/class-deduction2.C: Likewise.
	* g++.dg/cpp1z/noexcept-type12.C: Likewise.
	* g++.dg/cpp1z/inline-var2.C: Likewise.
	* g++.dg/cpp1z/eval-order2.C: Likewise.
	* g++.dg/cpp1z/decomp21.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda11.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda9.C: Likewise.
	* g++.dg/cpp1z/utf8-neg.C: Likewise.
	* g++.dg/cpp1z/class-deduction41.C: Likewise.
	* g++.dg/cpp1z/class-deduction23.C: Likewise.
	* g++.dg/cpp1z/nodiscard3.C: Likewise.
	* g++.dg/cpp1z/static_assert-nomsg.C: Likewise.
	* g++.dg/cpp1z/noexcept-type9.C: Likewise.
	* g++.dg/cpp1z/class-deduction21.C: Likewise.
	* g++.dg/cpp1z/range-for1.C: Likewise.
	* g++.dg/cpp1z/init-statement4.C: Likewise.
	* g++.dg/cpp1z/udlit-utf8char.C: Likewise.
	* g++.dg/cpp1z/decomp30.C: Likewise.
	* g++.dg/cpp1z/class-deduction39.C: Likewise.
	* g++.dg/cpp1z/register2.C: Likewise.
	* g++.dg/cpp1z/decomp9.C: Likewise.
	* g++.dg/cpp1z/regress1.C: Likewise.
	* g++.dg/cpp1z/direct-enum-init1.C: Likewise.
	* g++.dg/cpp1z/class-deduction30.C: Likewise.
	* g++.dg/cpp1z/abbrev2.C: Likewise.
	* g++.dg/cpp1z/nontype-auto6.C: Likewise.
	* g++.dg/cpp1z/regress2.C: Likewise.
	* g++.dg/cpp1z/decomp16.C: Likewise.
	* g++.dg/cpp1z/bool-increment1.C: Likewise.
	* g++.dg/cpp1z/aligned-new1.C: Likewise.
	* g++.dg/cpp1z/decomp3.C: Likewise.
	* g++.dg/cpp1z/register1.C: Likewise.
	* g++.dg/cpp1z/namespace-attribs.C: Likewise.
	* g++.dg/cpp1z/class-deduction1.C: Likewise.
	* g++.dg/cpp1z/decomp10.C: Likewise.
	* g++.dg/cpp1z/constexpr-if11.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda10.C: Likewise.
	* g++.dg/cpp1z/decomp27.C: Likewise.
	* g++.dg/cpp1z/noexcept-type2.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda6.C: Likewise.
	* g++.dg/cpp1z/class-deduction9.C: Likewise.
	* g++.dg/cpp1z/attributes-enum-1.C: Likewise.
	* g++.dg/cpp1z/decomp11.C: Likewise.
	* g++.dg/cpp1z/aligned-new3.C: Likewise.
	* g++.dg/cpp1z/utf8-2.C: Likewise.
	* g++.dg/cpp1z/lambda-this3.C: Likewise.
	* g++.dg/cpp1z/decomp-constexpr1.C: Likewise.
	* g++.dg/cpp1z/byte1.C: Likewise.
	* g++.dg/cpp1z/nontype-auto9.C: Likewise.
	* g++.dg/cpp1z/aggr-base4.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda1.C: Likewise.
	* g++.dg/cpp1z/nontype-auto3.C: Likewise.
	* g++.dg/cpp1z/utf8-2a.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda7.C: Likewise.
	* g++.dg/cpp1z/aggr-base6.C: Likewise.
	* g++.dg/cpp1z/cplusplus.C: Likewise.
	* g++.dg/cpp1z/class-deduction20.C: Likewise.
	* g++.dg/cpp1z/aggr-base2.C: Likewise.
	* g++.dg/cpp1z/class-deduction6.C: Likewise.
	* g++.dg/cpp1z/noexcept-type3.C: Likewise.
	* g++.dg/cpp1z/class-deduction31.C: Likewise.
	* g++.dg/cpp1z/class-deduction25.C: Likewise.
	* g++.dg/cpp1z/class-deduction18.C: Likewise.
	* g++.dg/cpp1z/fold9.C: Likewise.
	* g++.dg/cpp1z/noexcept-type8.C: Likewise.
	* g++.dg/cpp1z/abbrev1.C: Likewise.
	* g++.dg/cpp1z/constexpr-if10.C: Likewise.
	* g++.dg/cpp1z/utf8.C: Likewise.
	* g++.dg/cpp1z/noexcept-type7.C: Likewise.
	* g++.dg/cpp1z/aggr-base3.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda8.C: Likewise.
	* g++.dg/cpp1z/init-statement2.C: Likewise.
	* g++.dg/cpp1z/nontype-auto4.C: Likewise.
	* g++.dg/cpp1z/constexpr-if12.C: Likewise.
	* g++.dg/cpp1z/class-deduction40.C: Likewise.
	* g++.dg/cpp1z/nontype3.C: Likewise.
	* g++.dg/cpp1z/class-deduction14.C: Likewise.
	* g++.dg/cpp1z/fold7.C: Likewise.
	* g++.dg/cpp1z/nontype2.C: Likewise.
	* g++.dg/cpp1z/class-deduction15.C: Likewise.
	* g++.dg/cpp1z/nested-namespace-def1.C: Likewise.
	* g++.dg/cpp1z/class-deduction13.C: Likewise.
	* g++.dg/cpp1z/aligned-new7.C: Likewise.
	* g++.dg/cpp1z/noexcept-type1.C: Likewise.
	* g++.dg/cpp1z/nontype1.C: Likewise.
	* g++.dg/cpp1z/init-statement5.C: Likewise.
	* g++.dg/cpp1z/nontype-auto2.C: Likewise.
	* g++.dg/cpp1z/decomp17.C: Likewise.
	* g++.dg/cpp1z/fold4.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda2.C: Likewise.
	* g++.dg/cpp1z/fold7a.C: Likewise.
	* g++.dg/cpp1z/nontype-auto5.C: Likewise.
	* g++.dg/cpp1z/init-statement7.C: Likewise.
	* g++.dg/cpp1z/aggr-base5.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda5.C: Likewise.
	* g++.dg/cpp1z/pr79143.C: Likewise.
	* g++.dg/cpp1z/class-deduction38.C: Likewise.
	* g++.dg/cpp1z/nontype-auto8.C: Likewise.
	* g++.dg/cpp1z/class-deduction12.C: Likewise.
	* g++.dg/cpp1z/decomp20.C: Likewise.
	* g++.dg/cpp1z/class-deduction22.C: Likewise.
	* g++.dg/cpp1z/class-deduction29.C: Likewise.
	* g++.dg/cpp1z/class-deduction8.C: Likewise.
	* g++.dg/cpp1z/class-deduction43.C: Likewise.
	* g++.dg/cpp1z/feat-cxx1z.C: Likewise.
	* g++.dg/cpp1z/fold8.C: Likewise.
	* g++.dg/cpp1z/init-statement3.C: Likewise.
	* g++.dg/cpp1z/nontype-auto10.C: Likewise.
	* g++.dg/cpp1z/class-deduction36.C: Likewise.
	* g++.dg/cpp1z/noexcept-type17.C: Likewise.
	* g++.dg/cpp1z/fallthrough1.C: Likewise.
	* g++.dg/cpp1z/fold1.C: Likewise.
	* g++.dg/cpp1z/class-deduction26.C: Likewise.
	* g++.dg/cpp1z/fold-ice1.C: Likewise.
	* g++.dg/cpp1z/fold5.C: Likewise.
	* g++.dg/cpp1z/class-deduction34.C: Likewise.
	* g++.dg/cpp1z/noexcept-type6.C: Likewise.
	* g++.dg/cpp1z/class-deduction7.C: Likewise.
	* g++.dg/cpp1z/class-deduction16.C: Likewise.
	* g++.dg/cpp1z/class-deduction10.C: Likewise.
	* g++.dg/cpp1z/eval-order3.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda13.C: Likewise.
	* g++.dg/cpp1z/aggr-base2a.C: Likewise.
	* g++.dg/cpp1z/nontype-auto1.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda3.C: Likewise.
	* g++.dg/cpp1z/nontype-auto7.C: Likewise.
	* g++.dg/cpp1z/decomp15.C: Likewise.
	* g++.dg/cpp1z/noexcept-type4.C: Likewise.
	* g++.dg/cpp1z/fold-mangle.C: Likewise.
	* g++.dg/cpp1z/class-deduction35.C: Likewise.
	* g++.dg/cpp1z/decomp4.C: Likewise.
	* g++.dg/cpp1z/class-deduction42.C: Likewise.
	* g++.dg/cpp1z/init-statement8.C: Likewise.
	* g++.dg/cpp1z/inline-var1a.C: Likewise.
	* g++.dg/cpp1z/init-statement6.C: Likewise.
	* g++.dg/cpp1z/class-deduction17.C: Likewise.
	* g++.dg/cpp1z/class-deduction28.C: Likewise.
	* g++.dg/cpp1z/class-deduction27.C: Likewise.
	* g++.dg/cpp1z/decomp-bitfield1.C: Likewise.
	* g++.dg/cpp1z/attributes-enum-1a.C: Likewise.
	* g++.dg/cpp1z/class-deduction11.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda12.C: Likewise.
	* g++.dg/cpp1z/init-statement9.C: Likewise.
	* g++.dg/cpp1z/class-deduction19.C: Likewise.
	* g++.dg/cpp1z/class-deduction5.C: Likewise.
	* g++.dg/cpp1z/fold2.C: Likewise.
	* g++.dg/cpp1z/class-deduction33.C: Likewise.
	* g++.dg/cpp1z/class-deduction24.C: Likewise.
	* g++.dg/cpp1z/aggr-base1.C: Likewise.
	* g++.dg/cpp1z/fold6.C: Likewise.
	* g++.dg/cpp1z/decomp12.C: Likewise.
	* g++.dg/cpp1z/class-deduction4.C: Likewise.
	* g++.dg/cpp1z/inline-var1.C: Likewise.
	* g++.dg/cpp1z/aligned-new2.C: Likewise.
	* g++.dg/cpp1z/class-deduction3.C: Likewise.
	* g++.dg/other/error3.C: Likewise.
	* g++.dg/init/new25.C: Likewise.
	* g++.dg/init/new13.C: Likewise.
	* g++.dg/tls/diag-2.C: Likewise.
	* g++.dg/tls/diag-4.C: Likewise.
	* g++.dg/opt/noreturn-1.C: Likewise.
	* g++.dg/eh/async-unwind2.C: Likewise.
	* g++.dg/eh/spec9.C: Likewise.
	* g++.dg/eh/spec7.C: Likewise.
	* g++.dg/eh/template1.C: Likewise.
	* g++.dg/eh/cond4.C: Likewise.
	* g++.dg/eh/pr41819.C: Likewise.
	* g++.dg/eh/delete1.C: Likewise.
	* g++.dg/eh/spec3.C: Likewise.
	* g++.dg/eh/forced4.C: Likewise.
	* g++.dg/eh/spec2.C: Likewise.
	* g++.dg/eh/shadow1.C: Likewise.
	* g++.dg/eh/pr38662.C: Likewise.
	* g++.dg/eh/ehopt1.C: Likewise.
	* g++.dg/eh/spec8.C: Likewise.
	* g++.dg/eh/init-temp2.C: Likewise.
	* g++.dg/rtti/crash3.C: Likewise.
	* g++.dg/warn/Wreturn-type-3.C: Likewise.
	* g++.dg/warn/register-parm-1.C: Likewise.
	* g++.dg/warn/register-var-2.C: Likewise.
	* g++.dg/gcov/gcov-7.C: Likewise.
	* g++.dg/tree-ssa/pr45605.C: Likewise.
	* g++.dg/cpp/pr23827_cxx98_neg.C: Likewise.
	* g++.dg/lookup/exception1.C: Likewise.
	* g++.dg/ubsan/pr79589.C: Likewise.
	* g++.dg/tm/pr47340.C: Likewise.
	* g++.dg/tm/pr46567.C: Likewise.
	* g++.dg/expr/bitfield5.C: Likewise.
	* g++.dg/expr/bool1.C: Likewise.
	* g++.dg/expr/lval3.C: Likewise.
	* g++.dg/expr/lval4.C: Likewise.
	* g++.dg/expr/bitfield4.C: Likewise.
	* g++.dg/expr/bitfield6.C: Likewise.
	* g++.dg/expr/bool3.C: Likewise.
	* g++.dg/ext/has_nothrow_constructor.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-7.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-1.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-2.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-4.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-5.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-6.C: Likewise.
	* g++.dg/ext/has_nothrow_assign.C: Likewise.
	* g++.dg/parse/register1.C: Likewise.
	* g++.dg/parse/error15.C: Likewise.
	* g++.dg/parse/linkage2.C: Likewise.
	* g++.dg/concepts/intro2.C: Likewise.
	* g++.dg/concepts/class.C: Likewise.
	* g++.dg/concepts/traits1.C: Likewise.
	* g++.dg/concepts/req5.C: Likewise.
	* g++.dg/concepts/var-concept5.C: Likewise.
	* g++.dg/concepts/fn-concept2.C: Likewise.
	* g++.dg/concepts/traits2.C: Likewise.
	* g++.dg/concepts/placeholder2.C: Likewise.
	* g++.dg/concepts/class6.C: Likewise.
	* g++.dg/concepts/memtmpl1.C: Likewise.
	* g++.dg/concepts/friend2.C: Likewise.
	* g++.dg/concepts/template-parm3.C: Likewise.
	* g++.dg/concepts/template-parm10.C: Likewise.
	* g++.dg/concepts/explicit-spec1.C: Likewise.
	* g++.dg/concepts/explicit-spec3.C: Likewise.
	* g++.dg/concepts/var-templ2.C: Likewise.
	* g++.dg/concepts/intro5.C: Likewise.
	* g++.dg/concepts/deduction-constraint1.C: Likewise.
	* g++.dg/concepts/iconv1.C: Likewise.
	* g++.dg/concepts/constrained-parm.C: Likewise.
	* g++.dg/concepts/template-template-parm1.C: Likewise.
	* g++.dg/concepts/var-concept3.C: Likewise.
	* g++.dg/concepts/class3.C: Likewise.
	* g++.dg/concepts/memfun2.C: Likewise.
	* g++.dg/concepts/req1.C: Likewise.
	* g++.dg/concepts/disjunction1.C: Likewise.
	* g++.dg/concepts/req17.C: Likewise.
	* g++.dg/concepts/pr65848.C: Likewise.
	* g++.dg/concepts/placeholder4.C: Likewise.
	* g++.dg/concepts/decl-diagnose.C: Likewise.
	* g++.dg/concepts/intro7.C: Likewise.
	* g++.dg/concepts/pr68683.C: Likewise.
	* g++.dg/concepts/partial-spec4.C: Likewise.
	* g++.dg/concepts/template-parm5.C: Likewise.
	* g++.dg/concepts/explicit-inst1.C: Likewise.
	* g++.dg/concepts/class-deduction1.C: Likewise.
	* g++.dg/concepts/class1.C: Likewise.
	* g++.dg/concepts/req15.C: Likewise.
	* g++.dg/concepts/memfun.C: Likewise.
	* g++.dg/concepts/pr68434.C: Likewise.
	* g++.dg/concepts/inherit-ctor4.C: Likewise.
	* g++.dg/concepts/partial-spec6.C: Likewise.
	* g++.dg/concepts/var-templ1.C: Likewise.
	* g++.dg/concepts/template-parm8.C: Likewise.
	* g++.dg/concepts/explicit-inst3.C: Likewise.
	* g++.dg/concepts/class4.C: Likewise.
	* g++.dg/concepts/req6.C: Likewise.
	* g++.dg/concepts/fn8.C: Likewise.
	* g++.dg/concepts/class5.C: Likewise.
	* g++.dg/concepts/placeholder5.C: Likewise.
	* g++.dg/concepts/req16.C: Likewise.
	* g++.dg/concepts/req10.C: Likewise.
	* g++.dg/concepts/var-concept2.C: Likewise.
	* g++.dg/concepts/auto3.C: Likewise.
	* g++.dg/concepts/generic-fn-err.C: Likewise.
	* g++.dg/concepts/pr65552.C: Likewise.
	* g++.dg/concepts/partial-concept-id2.C: Likewise.
	* g++.dg/concepts/fn1.C: Likewise.
	* g++.dg/concepts/partial-spec.C: Likewise.
	* g++.dg/concepts/template-parm12.C: Likewise.
	* g++.dg/concepts/diagnostic1.C: Likewise.
	* g++.dg/concepts/intro1.C: Likewise.
	* g++.dg/concepts/explicit-inst4.C: Likewise.
	* g++.dg/concepts/req18.C: Likewise.
	* g++.dg/concepts/explicit-spec5.C: Likewise.
	* g++.dg/concepts/var-concept6.C: Likewise.
	* g++.dg/concepts/fn9.C: Likewise.
	* g++.dg/concepts/req2.C: Likewise.
	* g++.dg/concepts/template-parm7.C: Likewise.
	* g++.dg/concepts/req14.C: Likewise.
	* g++.dg/concepts/template-parm6.C: Likewise.
	* g++.dg/concepts/variadic4.C: Likewise.
	* g++.dg/concepts/fn6.C: Likewise.
	* g++.dg/concepts/req-neg1.C: Likewise.
	* g++.dg/concepts/alias3.C: Likewise.
	* g++.dg/concepts/expression2.C: Likewise.
	* g++.dg/concepts/partial-spec3.C: Likewise.
	* g++.dg/concepts/expression3.C: Likewise.
	* g++.dg/concepts/memfun-err.C: Likewise.
	* g++.dg/concepts/pr66091.C: Likewise.
	* g++.dg/concepts/explicit-spec2.C: Likewise.
	* g++.dg/concepts/equiv.C: Likewise.
	* g++.dg/concepts/friend1.C: Likewise.
	* g++.dg/concepts/fn4.C: Likewise.
	* g++.dg/concepts/var-templ3.C: Likewise.
	* g++.dg/concepts/explicit-inst2.C: Likewise.
	* g++.dg/concepts/alias2.C: Likewise.
	* g++.dg/concepts/regress/alias-decl-42.C: Likewise.
	* g++.dg/concepts/placeholder6.C: Likewise.
	* g++.dg/concepts/fn10.C: Likewise.
	* g++.dg/concepts/req3.C: Likewise.
	* g++.dg/concepts/variadic2.C: Likewise.
	* g++.dg/concepts/pr65636.C: Likewise.
	* g++.dg/concepts/intro6.C: Likewise.
	* g++.dg/concepts/class2.C: Likewise.
	* g++.dg/concepts/fn2.C: Likewise.
	* g++.dg/concepts/req20.C: Likewise.
	* g++.dg/concepts/req8.C: Likewise.
	* g++.dg/concepts/placeholder1.C: Likewise.
	* g++.dg/concepts/pr65854.C: Likewise.
	* g++.dg/concepts/member-concept.C: Likewise.
	* g++.dg/concepts/template-parm2.C: Likewise.
	* g++.dg/concepts/variadic1.C: Likewise.
	* g++.dg/concepts/fn7.C: Likewise.
	* g++.dg/concepts/intro4.C: Likewise.
	* g++.dg/concepts/req13.C: Likewise.
	* g++.dg/concepts/inherit-ctor3.C: Likewise.
	* g++.dg/concepts/explicit-spec6.C: Likewise.
	* g++.dg/concepts/auto1.C: Likewise.
	* g++.dg/concepts/alias1.C: Likewise.
	* g++.dg/concepts/fn-concept1.C: Likewise.
	* g++.dg/concepts/template-parm11.C: Likewise.
	* g++.dg/concepts/explicit-spec4.C: Likewise.
	* g++.dg/concepts/partial-concept-id1.C: Likewise.
	* g++.dg/concepts/req9.C: Likewise.
	* g++.dg/concepts/req4.C: Likewise.
	* g++.dg/concepts/pr65681.C: Likewise.
	* g++.dg/concepts/req7.C: Likewise.
	* g++.dg/concepts/req12.C: Likewise.
	* g++.dg/concepts/fn5.C: Likewise.
	* g++.dg/concepts/alias4.C: Likewise.
	* g++.dg/concepts/generic-fn.C: Likewise.
	* g++.dg/concepts/feature-macro.C: Likewise.
	* g++.dg/concepts/req19.C: Likewise.
	* g++.dg/concepts/placeholder3.C: Likewise.
	* g++.dg/concepts/intro3.C: Likewise.
	* g++.dg/concepts/partial-spec5.C: Likewise.
	* g++.dg/concepts/template-parm4.C: Likewise.
	* g++.dg/concepts/dr1430.C: Likewise.
	* g++.dg/concepts/pr65634.C: Likewise.
	* g++.dg/concepts/var-concept4.C: Likewise.
	* g++.dg/concepts/pr67249.C: Likewise.
	* g++.dg/concepts/expression.C: Likewise.
	* g++.dg/concepts/pr65575.C: Likewise.
	* g++.dg/concepts/partial-spec2.C: Likewise.
	* g++.dg/concepts/template-parm9.C: Likewise.
	* g++.dg/concepts/inherit-ctor1.C: Likewise.
	* g++.dg/concepts/equiv2.C: Likewise.
	* g++.dg/concepts/req11.C: Likewise.
	* g++.dg/concepts/template-parm1.C: Likewise.
	* g++.dg/concepts/inherit-ctor2.C: Likewise.
	* g++.dg/concepts/var-concept1.C: Likewise.
	* g++.dg/concepts/fn3.C: Likewise.
	* g++.dg/torture/pr46364.C: Likewise.
	* g++.dg/torture/stackalign/eh-alloca-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-fastcall-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-vararg-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-vararg-2.C: Likewise.
	* g++.dg/torture/stackalign/eh-global-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-thiscall-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-inline-2.C: Likewise.
	* g++.dg/torture/stackalign/eh-inline-1.C: Likewise.
	* g++.dg/torture/pr52918-1.C: Likewise.
	* g++.dg/torture/pr49394.C: Likewise.
	* g++.dg/torture/pr57190.C: Likewise.
	* g++.dg/cpp0x/static_assert8.C: Likewise.
	* g++.dg/cpp0x/noexcept19.C: Likewise.
	* g++.dg/cpp0x/variadic-throw.C: Likewise.
	* g++.dg/cpp0x/variadic73.C: Likewise.
	* g++.dg/cpp0x/noexcept02.C: Likewise.
	* g++.dg/cpp0x/defaulted23.C: Likewise.
	* g++.dg/cpp0x/noexcept08.C: Likewise.
	* g++.dg/cpp0x/auto9.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-eh2.C: Likewise.
	* g++.dg/cpp0x/error5.C: Likewise.
	* c-c++-common/gomp/atomic-12.c: Likewise.
	* c-c++-common/gomp/atomic-13.c: Likewise.
	* c-c++-common/gomp/atomic-14.c: Likewise.
	* c-c++-common/Wvarargs-2.c: Likewise.
	* c-c++-common/Wvarargs.c: Likewise.
	* c-c++-common/vector-subscript-2.c: Likewise.
	* g++.old-deja/g++.robertl/eb123.C: Likewise.
	* g++.old-deja/g++.eh/tmpl3.C: Likewise.
	* g++.old-deja/g++.eh/cleanup2.C: Likewise.
	* g++.old-deja/g++.eh/badalloc1.C: Likewise.
	* g++.old-deja/g++.eh/throw2.C: Likewise.
	* g++.old-deja/g++.eh/throw1.C: Likewise.
	* g++.old-deja/g++.eh/tmpl1.C: Likewise.
	* g++.old-deja/g++.other/new7.C: Likewise.
	* g++.old-deja/g++.other/crash30.C: Likewise.
	* g++.old-deja/g++.other/regstack.C: Likewise.
	* g++.old-deja/g++.other/crash28.C: Likewise.
	* g++.old-deja/g++.jason/bool5.C: Likewise.
	* g++.old-deja/g++.mike/p10416.C: Likewise.
	* g++.old-deja/g++.mike/eh25.C: Likewise.
	* g++.old-deja/g++.mike/eh55.C: Likewise.
libcpp/
	* include/cpplib.h (enum c_lang): Rename CLK_GNUCXX1Z
	to CLK_GNUCXX17 and CLK_CXX1Z to CLK_CXX17.
	* init.c (lang_defaults, cpp_init_builtins): Likewise.
	* expr.c (cpp_classify_number): Use C++17 instead of C++1z
	in diagnostics.
libstdc++-v3/
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Use -std=c++17 or
	-std=gnu++17 instead of -std=c++1z or -std=gnu++1z.  Use c++17 instead
	of c++1z and c++17_only instead of c++1z_only.  Adjust expected
	diagnostics and comments refering to 1z to 17.
	* testsuite/30_threads/lock_guard/cons/deduction.cc: Likewise.
	* testsuite/30_threads/scoped_lock/cons/deduction.cc: Likewise.
	* testsuite/30_threads/scoped_lock/cons/1.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/30_threads/unique_lock/cons/deduction.cc: Likewise.
	* testsuite/18_support/launder/1.cc (test02): Likewise.
	* testsuite/18_support/launder/requirements_neg.cc: Likewise.
	* testsuite/18_support/launder/requirements.cc: Likewise.
	* testsuite/18_support/byte/requirements.cc: Likewise.
	* testsuite/18_support/byte/ops.cc: Likewise.
	* testsuite/18_support/byte/global_neg.cc: Likewise.
	* testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc:
	Likewise.
	* testsuite/27_io/types/4.cc: Likewise.
	* testsuite/25_algorithms/sample/81221.cc: Likewise.
	* testsuite/25_algorithms/sample/1.cc: Likewise.
	* testsuite/25_algorithms/sample/2.cc: Likewise.
	* testsuite/25_algorithms/search/searcher.cc: Likewise.
	* testsuite/28_regex/basic_regex/ctors/deduction.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Likewise.
	* testsuite/24_iterators/range_access_cpp17.cc: Likewise.
	* testsuite/24_iterators/container_access.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/priority_queue_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_map_rand.cc: Likewise.
	* testsuite/20_util/shared_ptr/casts/reinterpret.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/deduction.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/array.cc: Likewise.
	* testsuite/20_util/shared_ptr/observers/array.cc (struct A): Likewise.
	* testsuite/20_util/pair/cons/deduction.cc: Likewise.
	* testsuite/20_util/variant/deduction.cc: Likewise.
	* testsuite/20_util/tuple/78939.cc: Likewise.
	* testsuite/20_util/tuple/cons/deduction.cc: Likewise.
	* testsuite/20_util/void_t/1.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/deduction_neg.cc: Likewise.
	* testsuite/20_util/addressof/requirements/constexpr.cc: Likewise.
	* testsuite/20_util/weak_ptr/cons/deduction.cc: Likewise.
	* testsuite/20_util/has_unique_object_representations/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/has_unique_object_representations/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/has_unique_object_representations/value.cc:
	Likewise.
	* testsuite/20_util/time_point/arithmetic/constexpr.cc: Likewise.
	* testsuite/20_util/function_objects/invoke/59768.cc: Likewise.
	* testsuite/20_util/function_objects/mem_fn/80478.cc: Likewise.
	* testsuite/20_util/function/cons/deduction.cc: Likewise.
	* testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc:
	Likewise.
	* testsuite/20_util/is_aggregate/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_aggregate/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_aggregate/value.cc: Likewise.
	* testsuite/26_numerics/lcm/1.cc: Likewise.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
	* testsuite/26_numerics/gcd/1.cc: Likewise.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/deduction.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/hypot.cc: Likewise.
	* testsuite/23_containers/queue/members/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/array/cons/deduction.cc: Likewise.
	* testsuite/23_containers/array/cons/deduction_neg.cc: Likewise.
	* testsuite/23_containers/deque/modifiers/emplace/cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/deque/cons/deduction.cc: Likewise.
	* testsuite/23_containers/stack/members/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/list/modifiers/emplace/cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/list/cons/deduction.cc: Likewise.
	* testsuite/23_containers/forward_list/modifiers/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/forward_list/cons/deduction.cc: Likewise.
	* testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/emplace/cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/vector/cons/deduction.cc: Likewise.
	* testsuite/23_containers/vector/bool/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/21_strings/basic_string/cons/char/9.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/char/deduction.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/char/79162.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/9.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
	Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/79162.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
	Likewise.

From-SVN: r252826
2017-09-15 18:15:46 +02:00
Joseph Myers 872c506b14 Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r250885
2017-08-04 23:21:23 +01:00
David Malcolm 738f7c2e12 libcpp: preserve ranges within macro expansions (PR c++/79300)
gcc/testsuite/ChangeLog:
	PR c++/79300
	* g++.dg/diagnostic/pr79300.C: New test case.

libcpp/ChangeLog:
	PR c++/79300
	* line-map.c (linemap_macro_loc_to_def_point): Preserve range
	information for macro expansions by delaying resolving ad-hoc
	locations until within the loop.

From-SVN: r250058
2017-07-07 18:49:09 +00:00
David Malcolm c471c6edcb diagnostics: fix end-points of ranges within macros (PR c++/79300)
gcc/ChangeLog:
	PR c++/79300
	* diagnostic-show-locus.c (layout::layout): Use start and finish
	spelling location for the start and finish of each range.
	* genmatch.c (linemap_client_expand_location_to_spelling_point):
	Add unused aspect param.
	* input.c (expand_location_1): Add "aspect" param, and use it
	to access the correct part of the location.
	(expand_location): Pass LOCATION_ASPECT_CARET to new param of
	expand_location_1.
	(expand_location_to_spelling_point): Likewise.
	(linemap_client_expand_location_to_spelling_point): Add "aspect"
	param, and pass it to expand_location_1.

gcc/testsuite/ChangeLog:
	PR c++/79300
	* c-c++-common/Wmisleading-indentation-3.c (fn_14): Update
	expected underlining within macro expansion.
	* c-c++-common/pr70264.c: Likewise.
	* g++.dg/plugin/diagnostic-test-expressions-1.C
	(test_within_macro_1): New test.
	(test_within_macro_2): Likewise.
	(test_within_macro_3): Likewise.
	(test_within_macro_4): Likewise.
	* gcc.dg/format/diagnostic-ranges.c (test_macro_3): Update
	expected underlining within macro expansion.
	(test_macro_4): Likewise.
	* gcc.dg/plugin/diagnostic-test-expressions-1.c
	(test_within_macro_1): New test.
	(test_within_macro_2): Likewise.
	(test_within_macro_3): Likewise.
	(test_within_macro_4): Likewise.
	* gcc.dg/spellcheck-fields-2.c (test_macro): Update expected
	underlining within macro expansion.

libcpp/ChangeLog:
	PR c++/79300
	* include/line-map.h (enum location_aspect): New enum.
	(linemap_client_expand_location_to_spelling_point): Add
	enum location_aspect param.
	* line-map.c (rich_location::get_expanded_location): Update for
	new param of linemap_client_expand_location_to_spelling_point.
	(rich_location::maybe_add_fixit): Likewise.
	(fixit_hint::affects_line_p): Likewise.

From-SVN: r250022
2017-07-06 14:17:24 +00:00
Jakub Jelinek 6d52273137 line-map.c (location_adhoc_data_update): Perform addition in uintptr_t type rather than char * type.
* line-map.c (location_adhoc_data_update): Perform addition in
	uintptr_t type rather than char * type.  Read *data using
	ptrdiff_t type instead of int64_t.
	(get_combined_adhoc_loc): Change offset type to ptrdiff_t from
	int64_t.

From-SVN: r249446
2017-06-21 12:59:12 +02:00
David Malcolm c7a980b80b Prevent fix-it hints from affecting more than one line
Attempts to apply a removal or replacement fix-it hint to a source
range that covers multiple lines currently lead to nonsensical
results from the printing code in diagnostic-show-locus.c.

We were already filtering them out in edit-context.c (leading
to -fdiagnostics-generate-patch not generating any output for
the whole TU).

Reject attempts to add such fix-it hints within rich_location,
fixing the diagnostic-show-locus.c issue.

gcc/ChangeLog:
	* diagnostic-show-locus.c
	(selftest::test_fixit_deletion_affecting_newline): New function.
	(selftest::diagnostic_show_locus_c_tests): Call it.

libcpp/ChangeLog:
	* include/line-map.h (class rich_location): Document that attempts
	to delete or replace a range *affecting* multiple lines will fail.
	* line-map.c (rich_location::maybe_add_fixit): Implement this
	restriction.

From-SVN: r249403
2017-06-20 10:40:38 +00:00
Martin Sebor c3684b7b86 PR c++/80560 - warn on undefined memory operations involving non-trivial types
gcc/c-family/ChangeLog:

	PR c++/80560
	* c.opt (-Wclass-memaccess): New option.

gcc/cp/ChangeLog:

	PR c++/80560
	* call.c (first_non_public_field, maybe_warn_class_memaccess): New
	functions.
	(has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
	(build_cxx_call): Call maybe_warn_class_memaccess.

gcc/ChangeLog:

	PR c++/80560
	* dumpfile.c (dump_register): Avoid calling memset to initialize
	a class with a default ctor.
	* gcc.c (struct compiler): Remove const qualification.
	* genattrtab.c (gen_insn_reserv): Replace memset with initialization.
	* hash-table.h: Ditto.
	* ipa-cp.c (allocate_and_init_ipcp_value): Replace memset with
	  assignment.
	* ipa-prop.c (ipa_free_edge_args_substructures): Ditto.
	* omp-low.c (lower_omp_ordered_clauses): Replace memset with
	default ctor.
	* params.h (struct param_info): Make struct members non-const.
	* tree-switch-conversion.c (emit_case_bit_tests): Replace memset
	with default initialization.
	* vec.h (vec_copy_construct, vec_default_construct): New helper
	functions.
	(vec<T>::copy, vec<T>::splice, vec<T>::reserve): Replace memcpy
	with vec_copy_construct.
	(vect<T>::quick_grow_cleared): Replace memset with default ctor.
	(vect<T>::vec_safe_grow_cleared, vec_safe_grow_cleared): Same.
	* doc/invoke.texi (-Wclass-memaccess): Document.

libcpp/ChangeLog:

	PR c++/80560
	* line-map.c (line_maps::~line_maps): Avoid calling htab_delete
	with a null pointer.
	(linemap_init): Avoid calling memset on an object of a non-trivial
	type.

libitm/ChangeLog:

	PR c++/80560
	* beginend.cc (GTM::gtm_thread::rollback): Avoid calling memset
	on an object of a non-trivial type.
	(GTM::gtm_transaction_cp::commit): Use assignment instead of memcpy
	to copy an object.
	* method-ml.cc (orec_iterator::reinit): Avoid -Wclass-memaccess.

gcc/testsuite/ChangeLog:

	PR c++/80560
	* g++.dg/Wclass-memaccess.C: New test.

From-SVN: r249234
2017-06-15 21:48:59 -06:00
David Malcolm b09649fdc6 Add support for mutually-incompatible fix-it hints
This patch adds a method:
  rich_location::fixits_cannot_be_auto_applied
for ensuring that mutually-incompatible fix-its hints don't
lead to insane output from -fdiagnostics-generate-patch.

Fix-it hints within such rich_location instances are printed
as normal by diagnostic_show_locus, but don't affect the output
of -fdiagnostics-generate-patch.

gcc/ChangeLog:
	* diagnostic.c (diagnostic_report_diagnostic): Only add fixits
	to the edit_context if they can be auto-applied.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/diagnostic-test-show-locus-bw.c
	(test_mutually_exclusive_suggestions): New test function.
	* gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c
	(test_mutually_exclusive_suggestions): New test function.
	* gcc.dg/plugin/diagnostic-test-show-locus-parseable-fixits.c
	(test_mutually_exclusive_suggestions): New test function.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
	(test_show_locus): Add special-case for
	"test_mutually_exclusive_suggestions".

libcpp/ChangeLog:
	* include/line-map.h
	(rich_location::fixits_cannot_be_auto_applied): New method.
	(rich_location::fixits_can_be_auto_applied_p): New accessor.
	(rich_location::m_fixits_cannot_be_auto_applied): New field.
	* line-map.c (rich_location::rich_location): Initialize new field.

From-SVN: r249081
2017-06-09 20:57:38 +00:00
David Malcolm 05945a1b83 libcpp: add callback for comment-handling
gcc/testsuite/ChangeLog:
	* g++.dg/plugin/comment_plugin.c: New test plugin.
	* g++.dg/plugin/comments-1.C: New test file.
	* g++.dg/plugin/plugin.exp (plugin_test_list): Add the above.

libcpp/ChangeLog:
	* include/cpplib.h (struct cpp_callbacks): Add "comment"
	callback.
	* lex.c (_cpp_lex_direct): Call the comment callback if non-NULL.

From-SVN: r248901
2017-06-05 20:53:06 +00:00
David Malcolm ad53f12355 Support fix-it hints that add new lines
Previously fix-it hints couldn't contain newlines.  This is
due to the need to print something user-readable for them
within diagnostic-show-locus, and for handling them within
edit-context for printing diffs and regenerating content.

This patch enables limited support for fix-it hints with newlines,
for suggesting adding new lines.
Such a fix-it hint must have exactly one newline character, at the
end of the content.  It must be an insertion at the beginning of
a line (so that e.g. fix-its that split a pre-existing line are
still rejected).

They are printed by diagnostic-show-locus with a '+' in the
left-hand margin, like this:

test.c:42:4: note: suggest adding 'break;' here
+      break;
     case 'b':
     ^~~~~~~~~

and the printer injects "spans" if the insertion location is not
near the primary range of the diagnostic e.g.:

test.c:4:2: note: unrecognized 'putchar'; suggest including '<stdio.h>'
test.c:1:1:
+#include <stdio.h>

test.c:4:2:
  putchar (ch);
  ^~~~~~~

gcc/ChangeLog:
	* diagnostic-show-locus.c
	(layout::should_print_annotation_line_p): Make private.
	(layout::print_annotation_line): Make private.
	(layout::annotation_line_showed_range_p): Make private.
	(layout::show_ruler): Make private.
	(layout::print_source_line): Make private.  Pass in line and
	line_width, rather than calling location_get_source_line.  Drop
	returned value.
	(layout::print_leading_fixits): New method.
	(layout::print_any_fixits): Rename to...
	(layout::print_trailing_fixits): ...this, and make private.
	Don't print newline fixits.
	(diagnostic_show_locus): Move logic for printing one row into...
	(layout::print_line): ...this new function.  Move the
	location_get_source_line call and error-handling from
	print_source_line to here.  Call print_leading_fixits, and rename
	print_any_fixits to print_trailing_fixits.
	(selftest::test_fixit_insert_containing_newline): Update now that
	newlines are partially supported.
	(selftest::test_fixit_insert_containing_newline_2): New test.
	(selftest::test_fixit_replace_containing_newline): Update comments.
	(selftest::diagnostic_show_locus_c_tests): Call the new test.
	* edit-context.c (class added_line): New class.
	(class edited_line): Describe newline handling in comment.
	(edited_line::actually_edited_p): New method.
	(edited_line::print_content): Delete redundant decl.
	(edited_line::m_predecessors): New field.
	(edited_file::print_content): Call edited_line::print_content.
	(edited_file::print_diff): Update to support newlines.
	(edited_file::print_diff_hunk): Likewise.
	(edited_file::print_run_of_changed_lines): New function.
	(edited_file::print_diff_line): Convert to...
	(print_diff_line): ...this.
	(edited_file::get_effective_line_count): New function.
	(edited_line::edited_line): Initialize new field m_predecessors.
	(edited_line::~edited_line): Clean up m_predecessors.
	(edited_line::apply_fixit): Handle newlines.
	(edited_line::get_effective_line_count): New function.
	(edited_line::print_content): New function.
	(edited_line::print_diff_lines): New function.
	(selftest::test_applying_fixits_insert_containing_newline): New
	test.
	(selftest::test_applying_fixits_replace_containing_newline): New
	test.
	(selftest::insert_line): New function.
	(selftest::test_applying_fixits_multiple_lines): Add example of
	inserting a line.
	(selftest::edit_context_c_tests): Call the new tests.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/diagnostic-test-show-locus-bw.c
	(test_fixit_insert_newline): New function.
	* gcc.dg/plugin/diagnostic-test-show-locus-color.c
	(test_fixit_insert_newline): New function.
	* gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c
	(test_fixit_insert_newline): New function.
	* gcc.dg/plugin/diagnostic-test-show-locus-parseable-fixits.c
	(test_fixit_insert_newline): New function.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
	(test_show_locus): Handle test_fixit_insert_newline.

libcpp/ChangeLog:
	* include/line-map.h (class rich_location): Update description of
	newline handling.
	(class fixit_hint): Likewise.
	(fixit_hint::ends_with_newline_p): New decl.
	* line-map.c (rich_location::maybe_add_fixit): Support newlines
	in fix-it hints that are insertions of single lines at the start
	of a line.  Don't consolidate into such fix-it hints.
	(fixit_hint::ends_with_newline_p): New method.

From-SVN: r247522
2017-05-02 19:03:56 +00:00
Joseph Myers 5166bee456 Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r247447
2017-05-01 23:28:02 +01:00
David Malcolm 338035aa19 Eliminate fixit_hint class hierarchy
The original implementation of fix-it hints (r230674) had an abstract
base class "fixit_hint" and three subclasses, representing
each of insertions, replacements, and deletions.

Having multiple classes for fix-it hints was a nuisance, as it required
per-class logic everywhere that the hints were handled.

In r239632 I eliminated the deletion subclass in favor of replacement
with the empty string (two subclasses are easier than three).

This patch eliminates the class hierarchy altogether by implementing
insertion in terms of replacement, by representing replacements via
a half-open interval (so that for an insertion, start == next location,
and we're effectively replacing an empty range at the insertion point
with the new string).

This greatly simplifies the code for handling fix-it hints; for example
it allows removal of a parallel class hierarchy of line_event within
edit-context.c.

It also improves consolidation of hints: we can now consolidate
insertions at the same location, affecting a couple of tests
(selftest::test_one_liner_many_fixits and
gcc.dg/Wmissing-braces-fixits.c).

gcc/ChangeLog:
	* diagnostic-show-locus.c (layout::get_expanded_location): Rewrite
	to use new fixit_hint representation, using the "replace" logic.
	(get_line_span_for_fixit_hint): Likewise.
	(layout::print_any_fixits): Likewise.
	(selftest::test_one_liner_many_fixits): Rename to...
	(selftest::test_one_liner_many_fixits_1): ...this, and update
	comment and expected output to reflect that the multiple fix-it
	hints are now consolidated into one insertion.
	(selftest::test_one_liner_many_fixits_2): New test.
	(selftest::test_diagnostic_show_locus_one_liner): Update for
	above.
	(selftest::test_fixit_consolidation): Update for fix-it API
	change.
	* diagnostic.c (print_parseable_fixits): Likewise.
	* edit-context.c (edited_line::m_line_events): Convert from
	auto_vec <line_event *> to auto_vec <line_event>.
	(class line_event): Convert from abstract base class to a concrete
	class, taking over the role of replace_event.
	(class insert_event): Delete.
	(class replace_event): Rename to class line_event.  Convert to
	half-open range.
	(edit_context::add_fixits): Reimplement.
	(edit_context::apply_insert): Delete.
	(edit_context::apply_replace): Rename to...
	(edit_context::apply_fixit): ...this.  Convert to half-open range.
	(edited_file::apply_insert): Delete.
	(edited_file::apply_replace): Rename to...
	(edited_file::apply_fixit): ...this.
	(edited_line::~edited_line): Drop deletion of events.
	(edited_line::apply_insert): Delete.
	(edited_line::apply_replace): Rename to...
	(edited_line::apply_fixit): ...this.  Convert to half-open range.
	Update for change to type of m_line_events.
	* edit-context.h (edit_context::apply_insert): Delete.
	(edit_context::apply_replace): Rename to...
	(edit_context::apply_fixit): ...this.

gcc/testsuite/ChangeLog:
	* gcc.dg/Wmissing-braces-fixits.c: Update expected output to
	reflect insertion fix-it hints at the same location now being
	consolidated.

libcpp/ChangeLog:
	* include/line-map.h (source_range::intersects_line_p): Delete.
	(rich_location::add_fixit): Delete.
	(rich_location::maybe_add_fixit): New method.
	(class fixit_hint): Reimplement in terms of...
	(class fixit_replace): ...this.
	(class fixit_insert): Delete.
	* line-map.c (linemap_position_for_loc_and_offset): Drop overzealous
	linemap_assert_fails.
	(source_range::intersects_line_p): Rename to...
	(fixit_hint::affects_line_p): New function.
	(rich_location::add_fixit_insert_before): Reimplement in terms of
	maybe_add_fixit, moving validation there.
	(rich_location::add_fixit_insert_after): Likewise.
	(column_before_p): Delete.
	(rich_location::add_fixit_replace): Reimplement in terms of
	maybe_add_fixit, moving validation there.  Convert closed input range
	to half-open range.
	(rich_location::add_fixit): Delete.
	(rich_location::maybe_add_fixit): New function.
	(fixit_insert::fixit_insert): Delete.
	(fixit_insert::~fixit_insert): Delete.
	(fixit_insert::affects_line_p): Delete.
	(fixit_insert::maybe_append_replace): Delete.
	(fixit_replace::fixit_replace): Rename to...
	(fixit_hint::fixit_hint): ...this, rewriting as necessary.
	(fixit_replace::~fixit_replace): Delete.
	(fixit_replace::affects_line_p): Delete.
	(fixit_replace::maybe_append_replace): Rename to...
	(fixit_hint::maybe_append): ...this, rewriting as necessary.

From-SVN: r247445
2017-05-01 19:15:36 +00:00
Joseph Myers 5bda45cddb * fr.po: Update.
From-SVN: r247420
2017-05-01 00:20:45 +01:00
Joseph Myers c1c1c8ea6f Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r247113
2017-04-24 21:37:39 +01:00
Jonathan Wakely 5764ee3c84 Fix numerous typos in comments
gcc:

	* alias.c (base_alias_check): Fix typo in comment.
	* cgraph.h (class ipa_polymorphic_call_context): Likewise.
	* cgraphunit.c (symbol_table::compile): Likewise.
	* collect2.c (maybe_run_lto_and_relink): Likewise.
	* config/arm/arm.c (arm_thumb1_mi_thunk): Likewise.
	* config/avr/avr-arch.h (avr_arch_info_t): Likewise.
	* config/avr/avr.c (avr_map_op_t): Likewise.
	* config/cr16/cr16.h (DATA_ALIGNMENT): Likewise.
	* config/epiphany/epiphany.c (TARGET_ARG_PARTIAL_BYTES): Likewise.
	* config/epiphany/epiphany.md (movcc): Likewise.
	* config/i386/i386.c (legitimize_pe_coff_extern_decl): Likewise.
	* config/m68k/m68k.c (struct _sched_ib, m68k_sched_variable_issue):
	Likewise.
	* config/mips/mips.c (mips_save_restore_reg): Likewise.
	* config/rx/rx.c (rx_is_restricted_memory_address): Likewise.
	* config/s390/s390.c (Z10_EARLYLOAD_DISTANCE): Likewise.
	* config/sh/sh.c (sh_rtx_costs): Likewise.
	* fold-const.c (fold_truth_andor): Likewise.
	* genautomata.c (collapse_flag): Likewise.
	* gengtype.h (struct type::u::s): Likewise.
	* gensupport.c (has_subst_attribute, add_mnemonic_string): Likewise.
	* input.c (FORMAT_AMOUNT): Likewise.
	* ipa-cp.c (class ipcp_lattice, agg_replacements_to_vector)
	(known_aggs_to_agg_replacement_list): Likewise.
	* ipa-inline-analysis.c: Likewise.
	* ipa-inline.h (estimate_edge_time, estimate_edge_hints): Likewise.
	* ipa-polymorphic-call.c
	(ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
	* loop-unroll.c (analyze_insn_to_expand_var): Likewise.
	* lra.c (lra_optional_reload_pseudos, lra_subreg_reload_pseudos):
	Likewise.
	* modulo-sched.c (apply_reg_moves): Likewise.
	* omp-expand.c (build_omp_regions_1): Likewise.
	* trans-mem.c (struct tm_wrapper_hasher): Likewise.
	* tree-ssa-loop-ivopts.c (may_eliminate_iv): Likewise.
	* tree-ssa-loop-niter.c (maybe_lower_iteration_bound): Likewise.
	* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise.
	* value-prof.c: Likewise.
	* var-tracking.c (val_reset): Likewise.

gcc/ada:

	* doc/gnat_ugn/gnat_and_program_execution.rst: Fix typo.
	* g-socket.adb (To_Host_Entry): Fix typo in comment.
	* gnat_ugn.texi: Fix typo.
	* raise.c (_gnat_builtin_longjmp): Fix capitalization in comment.
	* s-stposu.adb (Allocate_Any_Controlled): Fix typo in comment.
	* sem_ch3.adb (Build_Derived_Record_Type): Likewise.
	* sem_util.adb (Mark_Coextensions): Likewise.
	* sem_util.ads (Available_Full_View_Of_Component): Likewise.

gcc/c:

	* c-array-notation.c: Fix typo in comment.

gcc/c-family:

	* c-warn.c (do_warn_double_promotion): Fix typo in comment.

gcc/cp:

        * class.c (update_vtable_entry_for_fn): Fix typo in comment.
	* decl2.c (one_static_initialization_or_destruction): Likewise.
	* name-lookup.c (store_bindings): Likewise.
	* parser.c (make_call_declarator): Likewise.
	* pt.c (check_explicit_specialization): Likewise.

gcc/testsuite:

	* g++.old-deja/g++.benjamin/scope02.C: Fix typo in comment.
	* gcc.dg/20031012-1.c: Likewise.
	* gcc.dg/ipa/ipcp-1.c: Likewise.
	* gcc.dg/torture/matrix-3.c: Likewise.
	* gcc.target/powerpc/ppc-spe.c: Likewise.
	* gcc.target/rx/zero-width-bitfield.c: Likewise.

libcpp:

	* include/line-map.h (LINEMAPS_MACRO_MAPS): Fix typo in comment.
	* lex.c (search_line_fast): Likewise.
	* pch.h (cpp_valid_state): Likewise.

libdecnumber:

	* decCommon.c (decFloatFromPackedChecked): Fix typo in comment.
	* decNumber.c (decNumberPower, decMultiplyOp): Likewise.

libgcc:

	* config/c6x/pr-support.c (__gnu_unwind_execute): Fix typo in comment.

libitm:

	* libitm_i.h (sutrct gtm_thread): Fix typo in comment.

From-SVN: r246664
2017-04-03 23:30:56 +01:00
Andreas Schwab 8c00ae2406 Fix search_line_fast for aarch64/ILP32
* lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]:
	Convert 64-bit value to boolean before passing to
	__builtin_expect.

From-SVN: r246312
2017-03-21 11:10:17 +00:00
Jason Merrill 85e653c925 * init.c (cpp_init_builtins): Update __cplusplus for C++17.
From-SVN: r246211
2017-03-16 17:16:39 -04:00
Gerald Pfeifer e228c50f3a * Makefile.in (po/$(PACKAGE).pot): Adjust bug reporting URL.
From-SVN: r245298
2017-02-09 08:55:46 +00:00
Joseph Myers fe31d6efd7 * de.po, eo.po: Update.
From-SVN: r245046
2017-01-31 00:50:29 +00:00
Joseph Myers 1f44286be0 * sr.po: Update.
From-SVN: r244996
2017-01-27 23:34:48 +00:00
Joseph Myers 01f26e0e1f * da.po: Update.
From-SVN: r244836
2017-01-23 22:28:03 +00:00
David Malcolm b9f4757f8e Fix issues with unrepresentable column numbers (PR c++/77949)
PR c++/77949 identifies an ICE when the C++ frontend attempts to emit a
fix-it hint inserting a missing semicolon at column 4097 of a source file.

This column value exceeds LINE_MAP_MAX_COLUMN_NUMBER and hence isn't
representable using a location_t.

Attempting to do so leads to these problems, which this patch fixes:

(a) when encountering a column number > LINE_MAP_MAX_COLUMN_NUMBER we
create a new linemap with m_column_and_range_bits == 0, but
linemap_position_for_column doesn't check for this, and hence can emit
a bogus location_t value that's calculated relative to the previous
linemap start, but which will be decoded relative to the new linemap,
leading to very large incorrect line values.

(b) when encountering a column number that can't be represented, and
for which the linemap was pre-existing, the code would hit this assertion:
  if (linemap_assert_fails (column < (1u << map->m_column_and_range_bits)))
around a bail-out condition.  The patch replaces this assertion with a
simple conditional, to stop the ICE when this occurs, and fixes the
bit count (effective column bits, vs column+range bits)

(c) the C++ frontend wasn't checking for failure of
linemap_position_for_loc_and_offset when considering emitting the fix-it
hint.  The patch adds a conditional, so that no fix-it hint is emitted
if the location is bogus.

gcc/cp/ChangeLog:
	PR c++/77949
	* parser.c (cp_parser_class_specifier_1): Only suggest inserting
	a missing semicolon if we have a valid insertion location for
	the fix-it hint.

gcc/ChangeLog:
	PR c++/77949
	* input.c (selftest::test_accessing_ordinary_linemaps): Verify
	that we correctly handle column numbers greater than
	LINE_MAP_MAX_COLUMN_NUMBER.

gcc/testsuite/ChangeLog:
	PR c++/77949
	* g++.dg/diagnostic/pr77949.C: New test case.

libcpp/ChangeLog:
	PR c++/77949
	* line-map.c (linemap_position_for_column): When calling
	linemap_start_line, detect if a new linemap was created with
	0 column bits, and bail out early if this is the case.
	(linemap_position_for_loc_and_offset): Replace overzealous
	linemap_assert_fails with a simple conditional; use correct
	bit count.

From-SVN: r244292
2017-01-10 21:54:09 +00:00
Joseph Myers b7cfd5c477 * da.po: Update.
From-SVN: r244288
2017-01-10 20:59:06 +00:00
Joseph Myers 4b85f4e61c * vi.po: Update.
From-SVN: r244230
2017-01-09 16:55:06 +00:00
David Malcolm 5ccf1d8d10 Fix linemap corruption after very wide source lines (PR c++/72803)
PR c++/72803 describes an issue where a fix-it hint is to be emitted at
column 512 of a 511-column source line, leading to an ICE.

The root cause is a bug in linemap_line_start, when transitioning from
lines >= 512 in width to narrow lines.

The wide line in the reproducer has a line map with:
  m_column_and_range_bits = 15, m_range_bits = 5
giving 10 effective bits for representing columns, so that columns <= 1023
can be represented.

When parsing the following line,
  linemap_line_start (..., ..., max_column_hint=0);
is called.  This leads to the "add_map" logic, due to this condition:
      || (max_column_hint <= 80 && effective_column_bits >= 10)
i.e. the new line is sufficiently narrower than the old one to
potentially use a new linemap (so as to conserve values within the
location_t space).

It then attempts to avoid allocating a new line map.  Part of the logic
to determine if we really need a new line map is this condition:
   SOURCE_COLUMN (map, highest) >= (1U << column_bits)
The above condition is incorrect: we need to determine if the highest
column we've handed out will fit within the proposed *effective* column
bits, but "column_bits" here is the column plus the range bits, rather
than just the column bits.

Hence in this case linemap_line_start erroneously decides that we don't
need a new line map, and updates the column bits within the existing
line map, so any location_t values we've already handed out within it
that are offset from the start by
  >= (1<<new_column_and_range_bits)
effectively change meaning, leading to incorrect line&column information
when decoding them, and various "interesting" ways for the linemap
code to fail.

The fix is to use the effective column bits in the above conditional.

gcc/ChangeLog:
	PR c++/72803
	* input.c (selftest::test_accessing_ordinary_linemaps): Verify
	that the transition from a max line width >= 1<<10 to narrower
	lines works correctly.

gcc/testsuite/ChangeLog:
	PR c++/72803
	* g++.dg/diagnostic/pr72803.C: New test case.

libcpp/ChangeLog:
	PR c++/72803
	* line-map.c (linemap_line_start): When determining if the highest
	column given out so far will fit into a proposed change to the
	current map, use the effective number of column bits, rather than
	the total number of column + range bits.

From-SVN: r244199
2017-01-07 21:33:59 +00:00
Joseph Myers e04916e3b8 * pt_BR.po, ru.po: Update.
From-SVN: r244080
2017-01-05 00:04:28 +00:00
Joseph Myers ecfdf05a28 * fi.po: Update.
From-SVN: r244042
2017-01-04 01:16:16 +00:00
Joseph Myers 549a66a54d Update .po files from TP.
gcc/po:
	* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
	ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
	zh_TW.po: Update.

libcpp/po:
	* be.po, ca.po, da.po, de.po, el.po, eo.po, es.po, fi.po, fr.po,
	id.po, ja.po, nl.po, pr_BR.po, ru.po, sr.po, sv.po, tr.po, uk.po,
	vi.po, zh_CN.po, zh_TW.po: Update.

From-SVN: r244032
2017-01-03 20:52:48 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Joseph Myers b35325016d Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r243991
2017-01-01 00:55:25 +00:00
David Malcolm a3998c2fb1 Fix use-after-free lexing unterminated raw strings (PR preprocessor/78811)
gcc/ChangeLog:
	PR preprocessor/78680
	PR preprocessor/78811
	* input.c (struct selftest::lexer_test): Add field
	m_implicitly_expect_EOF.
	(selftest::lexer_error_sink): New class.
	(selftest::lexer_error_sink::s_singleton): New global.
	(selftest::lexer_test::lexer_test): Initialize new field
	"m_implicitly_expect_EOF".
	(selftest::lexer_test::~lexer_test): Conditionalize the
	check for the EOF token on the new field.
	(selftest::test_lexer_string_locations_raw_string_unterminated):
	New function.
	(selftest::input_c_tests): Call the new test.

libcpp/ChangeLog:
	PR preprocessor/78680
	PR preprocessor/78811
	* lex.c (_cpp_lex_direct): Only determine the end-location of
	the token and build a range for non-reserved start locations.
	Do not do it for EOF tokens.

From-SVN: r243721
2016-12-15 18:05:05 +00:00
David Malcolm 470a60b2c4 re PR preprocessor/78680 (ICE in get_substring_ranges_for_loc, at input.c:1398)
Fix for PR preprocessor/78680

PR preprocessor/78680 identifies a crash when attempting to issue
a -Wformat warning, where the format string includes a string token
split across multiple physical source lines via backslash-continued
lines.

The issue is that libcpp is generating bogus range information for
such tokens.

For example, in:

void fn1() {
  __builtin_printf("\
     %ld.\n\
        2\n"); };

the range of the string token is printed as:

   __builtin_printf("\
                    ^~

whereas the range ought to be:

  __builtin_printf("\
                   ^~
     %ld.\n\
     ~~~~~~~
        2\n"); };
        ~~~~

The root cause is that the line notes expressing the update
of the buffer in lex.c aren't yet updated when the end-point of
the token is computed

3095	    tok_range.m_finish
3096	      = linemap_position_for_column (pfile->line_table,
3097					     CPP_BUF_COLUMN (buffer, buffer->cur));

so that the physical line is still regarded as that of the start
of the token, and, where CPP_BUF_COLUMN uses (BUF)->line_base,
line_base is still the location of the first physical line in the
and hence the column information is too large (as if it were the
offset in the *logical* line).

(the printed range is somewhat misleading; the actual buggy range
extends beyond the "\ in the line, but within diagnostic-show-locus.c
layout::print_annotation_line only prints up to the xbound set by
layout::print_source_line and so truncates most of the buggy range).

The fix is to ensure that line notes are handled before calculating
the end-point of the token range.

This leads to the range for the string token being correctly
computed, as:

  __builtin_printf("\
                   ^~
     %ld.\n\
     ~~~~~~~
        2\n"); };
        ~~~~

and this leads to get_substring_ranges_for_loc failing gracefully,
rather than crashing.

gcc/testsuite/ChangeLog:
	PR preprocessor/78680
	* gcc.dg/format/pr78680.c: New test case.
	* gcc.dg/plugin/diagnostic-test-expressions-1.c
	(test_multiline_token): New function.
	* gcc.dg/plugin/diagnostic-test-string-literals-1.c
	(test_backslash_continued_logical_lines): New function.

libcpp/ChangeLog:
	PR preprocessor/78680
	* lex.c (_cpp_lex_direct): Ensure line notes are processed before
	computing the end-point of the token.

From-SVN: r243567
2016-12-12 17:37:48 +00:00
Paolo Bonzini fb2675cb46 system.h (HAVE_DESIGNATED_INITIALIZERS, [...]): Do not use "defined" in macros.
gcc:
2016-11-23  Paolo Bonzini  <bonzini@gnu.org>

	* system.h (HAVE_DESIGNATED_INITIALIZERS,
	HAVE_DESIGNATED_UNION_INITIALIZERS): Do not use
	"defined" in macros.
	* doc/cpp.texi (Defined): Mention -Wexpansion-to-defined.
	* doc/cppopts.texi (Invocation): Document -Wexpansion-to-defined.
	* doc/invoke.texi (Warning Options): Document -Wexpansion-to-defined.

gcc/c-family:
2016-11-23  Paolo Bonzini  <bonzini@gnu.org>

	* c.opt (Wexpansion-to-defined): New.

gcc/testsuite:
2016-11-23  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.dg/cpp/defined.c: Mark newly introduced warnings and
	adjust for warning->pedwarn change.
	* gcc.dg/cpp/defined-syshdr.c,
	gcc.dg/cpp/defined-Wexpansion-to-defined.c,
	gcc.dg/cpp/defined-Wextra-Wno-expansion-to-defined.c,
	gcc.dg/cpp/defined-Wextra.c,
	gcc.dg/cpp/defined-Wno-expansion-to-defined.c: New testcases.

libcpp:
2016-11-23  Paolo Bonzini  <bonzini@gnu.org>

	* include/cpplib.h (struct cpp_options): Add new member
	warn_expansion_to_defined.
	(CPP_W_EXPANSION_TO_DEFINED): New enum member.
	* expr.c (parse_defined): Warn for all uses of "defined"
	in macros, and tie warning to CPP_W_EXPANSION_TO_DEFINED.
	Make it a pedwarning instead of a warning.
	* system.h (HAVE_DESIGNATED_INITIALIZERS): Do not use
	"defined" in macros.

From-SVN: r242743
2016-11-23 10:06:07 +00:00
David Malcolm b8f564124e Fix locations within raw strings
Whilst investigating PR preprocessor/78324 I noticed that the
substring location code currently doesn't handle raw strings
correctly, by not skipping the 'R', opening quote, delimiter
and opening parenthesis.

For example, an attempt to underline chars 4-7 with caret at 6 of
this raw string yields this erroneous output:
   __emit_string_literal_range (R"foo(0123456789)foo",
                                    ~~^~

With the patch, the correct range/caret is printed:

   __emit_string_literal_range (R"foo(0123456789)foo",
                                          ~~^~

gcc/ChangeLog:
	* input.c (selftest::test_lexer_string_locations_long_line): New
	function.
	(selftest::test_lexer_string_locations_raw_string_multiline): New
	function.
	(selftest::input_c_tests): Call the new functions, via
	for_each_line_table_case.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/diagnostic-test-string-literals-1.c
	(test_raw_string_one_liner): New function.
	(test_raw_string_multiline): New function.

libcpp/ChangeLog:
	* charset.c (cpp_interpret_string_1): Skip locations from
	loc_reader when advancing 'p' when handling raw strings.

From-SVN: r242552
2016-11-17 15:55:26 +00:00
Jakub Jelinek 3549e181bd re PR bootstrap/72823 (r239175 causes build failure)
PR bootstrap/72823
	* configure.ac (ENABLE_ASSERT_CHECKING): Define if gcc configure
	would define that macro.
	* configure: Regenerated.
	* config.in: Regenerated.

From-SVN: r242510
2016-11-16 21:10:27 +01:00
Richard Earnshaw a6ac871cdf [AArch64] Optimized implementation of search_line_fast for the CPP lexer
* lex.c (search_line_fast): New implementation for AArch64.

From-SVN: r241964
2016-11-08 13:29:32 +00:00
Joseph Myers fde1c2de05 * eo.po: Update.
From-SVN: r241673
2016-10-29 02:38:09 +01:00
David Malcolm f5ea989d50 input.c/libcpp: fix lifetimes of path buffers
Running "make selftest-valgrind" showed various leaks of the form:

408 bytes in 24 blocks are definitely lost in loss record 572 of 679
   at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x1B0D057: xmalloc (xmalloc.c:148)
   by 0x1ACCAA1: append_file_to_dir(char const*, cpp_dir*) [clone .isra.3] (files.c:1567)
   by 0x1ACD56F: _cpp_find_file (files.c:390)
   by 0x1ACF8FB: cpp_read_main_file(cpp_reader*, char const*) (init.c:632)
   by 0x1AB3D97: selftest::lexer_test::lexer_test(selftest::line_table_case const&, char const*, selftest::lexer_test_options*) (input.c:2014)
   by 0x1AB792B: selftest::test_lexer_string_locations_u8(selftest::line_table_case const&) (input.c:2713)
   by 0x1ABA22A: selftest::for_each_line_table_case(void (*)(selftest::line_table_case const&)) (input.c:3227)
   by 0x1ABA381: selftest::input_c_tests() (input.c:3260)
   by 0x1A295F1: selftest::run_tests() (selftest-run-tests.c:62)
   by 0xF20DC4: toplev::run_self_tests() (toplev.c:2076)
   by 0xF20FCD: toplev::main(int, char**) (toplev.c:2153)

Fix the leak by freeing the file->path in destroy_cpp_file.
However, doing so would lead to a use-after-free in input.c's file cache
since the filenames in this cache are the libcpp file->path buffers.

Hence we need to ensure that any references to the file in the input.c
cache are purged before cleaning up file->path.  This is normally done
by the temp_source_file dtor.  Hence we need to reorder things to that
the temp_source_file dtor runs before cleaning up the cpp_parser.  The
patch does this by introducing a wrapper class around cpp_parser *, so
that the dtor can run after the dtor for temp_source_file.

gcc/ChangeLog:
	* input.c (fcache::file_patch): Add comment about lifetime.
	(selftest::cpp_reader_ptr): New class.
	(selftest::lexer_test): Convert m_parser from cpp_reader *
	to a cpp_reader_ptr, and move m_tempfile to after it.
	(selftest::lexer_test::lexer_test): Update for above reordering.
	(lexer_test::~lexer_test): Move cleanup of m_parser to
	cpp_reader_ptr's dtor.

libcpp/ChangeLog:
	* files.c (destroy_cpp_file): Free file->path.

From-SVN: r241536
2016-10-25 19:24:01 +00:00
David Malcolm 2be1b79650 Implement ~line_maps ()
line_maps instances such as the global line_table are
GC-managed, but the htab within location_adhoc_data_map.htab
is not GC-managed.

Previously this was deleted manually by a call to
location_adhoc_data_fini within toplev::main.

However, on adding a call to forcibly_ggc_collect after the
selftests, all of the htabs for the various line_tables
created during the selftests start showing up as leaks
in "make selftest-valgrind", e.g.:

13,536 (1,344 direct, 12,192 indirect) bytes in 12 blocks are definitely lost in loss record 1,065 of 1,086
   at 0x4A081D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x16DB3B0: xcalloc (xmalloc.c:163)
   by 0x16D8D34: htab_create_typed_alloc (hashtab.c:358)
   by 0x16D8DBD: htab_create_alloc (hashtab.c:286)
   by 0x16A2CCC: linemap_init(line_maps*, unsigned int) (line-map.c:353)
   by 0x1685605: selftest::line_table_test::line_table_test(selftest::line_table_case const&) (input.c:1624)
   by 0x167D09C: selftest::test_applying_fixits_modernize_named_init(selftest::line_table_case const&) (edit-context.c:1430)
   by 0x1686827: selftest::for_each_line_table_case(void (*)(selftest::line_table_case const&)) (input.c:3227)
   by 0x167F067: selftest::edit_context_c_tests() (edit-context.c:1658)
   by 0x1616E67: selftest::run_tests() (selftest-run-tests.c:71)
   by 0xC0DB25: toplev::run_self_tests() (toplev.c:2076)
   by 0x618EB4: toplev::main(int, char**) (toplev.c:2153)

This patch removes the manual one-time cleanup in favor of
adding a destructor to class line_maps, which cleans up
the non-GC-managed htab.

Doing so improves "make selftest-valgrind" from:

==61118== LEAK SUMMARY:
==61118==    definitely lost: 121,248 bytes in 1,515 blocks
==61118==    indirectly lost: 974,344 bytes in 959 blocks
==61118==      possibly lost: 0 bytes in 0 blocks
==61118==    still reachable: 1,332,599 bytes in 3,684 blocks
==61118==         suppressed: 0 bytes in 0 blocks

to:

==57182== LEAK SUMMARY:
==57182==    definitely lost: 13,840 bytes in 556 blocks
==57182==    indirectly lost: 0 bytes in 0 blocks
==57182==      possibly lost: 0 bytes in 0 blocks
==57182==    still reachable: 1,355,703 bytes in 3,684 blocks
==57182==         suppressed: 0 bytes in 0 blocks

gcc/ChangeLog:
	* toplev.c (toplev::main): Remove call to
	location_adhoc_data_fini.

libcpp/ChangeLog:
	* include/line-map.h (line_maps::~line_maps): New dtor.
	(location_adhoc_data_fini): Delete decl.
	* line-map.c (line_maps::~line_maps): New dtor.
	(location_adhoc_data_fini): Delete.

From-SVN: r241533
2016-10-25 18:10:44 +00:00
Andris Pavenis 58f3096372 re PR preprocessor/71681 (header.gcc file lookup is broken for -remap)
2016-10-21  Andris Pavenis  <andris.pavenis@iki.fi>

	PR preprocessor/71681
	* files.c (remap_filename): Fix handling -remap in subdirectories.

From-SVN: r241413
2016-10-21 18:52:25 +03:00
Jakub Jelinek 70f6d5e19b gcc/
* common.opt (Wimplicit-fallthrough) Turn into alias to
	-Wimplicit-fallthrough=3.  Remove EnabledBy.
	(Wimplicit-fallthrough=): New option.
	* gimplify.c (warn_implicit_fallthrough_r): Use
	OPT_Wimplicit_fallthrough_ instead of OPT_Wimplicit_fallthrough.
	* doc/invoke.texi (-Wimplicit-fallthrough): Document as alias
	to -Wimplicit-fallthrough=3.
	(-Wimplicit-fallthrough=): Document.
gcc/c-family/
	* c.opt (Wextra): Add as C/C++/ObjC/ObjC++ option.
	(Wimplicit-fallthrough=): Enable for these languages by -Wextra.
	* c-opts.c (sanitize_cpp_opts): Initialize
	cpp_opts->cpp_warn_implicit_fallthrough.
gcc/testsuite/
	* c-c++-common/Wimplicit-fallthrough-25.c: New test.
	* c-c++-common/Wimplicit-fallthrough-26.c: New test.
	* c-c++-common/Wimplicit-fallthrough-27.c: New test.
	* c-c++-common/Wimplicit-fallthrough-28.c: New test.
	* c-c++-common/Wimplicit-fallthrough-29.c: New test.
	* c-c++-common/Wimplicit-fallthrough-30.c: New test.
	* c-c++-common/Wimplicit-fallthrough-31.c: New test.
	* c-c++-common/Wimplicit-fallthrough-32.c: New test.
	* c-c++-common/Wimplicit-fallthrough-33.c: New test.
libcpp/
	* include/cpplib.h (struct cpp_options): Add
	cpp_warn_implicit_fallthrough.
	* init.c (cpp_create_reader): Initialize it to 0.
	* lex.c (fallthrough_comment_p): Handle different
	cpp_warn_implicit_fallthrough levels.  Whitespace fixes.

From-SVN: r241013
2016-10-12 01:19:06 +02:00
Jakub Jelinek ee19ef45ba invoke.texi: Document accepting Else, fallthrough.
* doc/invoke.texi: Document accepting Else, fallthrough.

	* lex.c (fallthrough_comment_p): Accept Else, fallthrough.

	* c-c++-common/Wimplicit-fallthrough-23.c (foo): Add further tests.

From-SVN: r240886
2016-10-08 12:54:27 +02:00
Jakub Jelinek 81b02905b0 invoke.texi (-Wimplicit-fallthrough): Document FALLTHRU comment style changes.
* doc/invoke.texi (-Wimplicit-fallthrough): Document FALLTHRU comment
	style changes.

	* lex.c (fallthrough_comment_p): Extend to handle more common FALLTHRU
	comment styles.

	* c-c++-common/Wimplicit-fallthrough-23.c (foo): Add further tests.

From-SVN: r240885
2016-10-08 12:53:05 +02:00
Jakub Jelinek 7bad794aa0 c-lex.c (c_lex_with_flags): For CPP_COMMENT token with PREV_FALLTHROUGH...
* c-lex.c (c_lex_with_flags) <case CPP_COMMENT>: For CPP_COMMENT
	token with PREV_FALLTHROUGH, skip all following CPP_PADDING and
	CPP_COMMENT tokens and set add_flags to PREV_FALLTHROUGH afterwards.

	* doc/invoke.texi (-Wimplicit-fallthrough): Document the accepted
	FALLTHRU comment styles.

	* lex.c (fallthrough_comment_p): Fix off-by-one size comparison
	errors, cleanup.
	(_cpp_lex_direct): Allow arbitrary comments in between
	fallthrough_comment_p comment and following token.

	* c-c++-common/Wimplicit-fallthrough-23.c: New test.
	* c-c++-common/Wimplicit-fallthrough-24.c: New test.

From-SVN: r240884
2016-10-08 12:48:54 +02:00