Commit Graph

648 Commits

Author SHA1 Message Date
Nathan Sidwell 9158f0ba97 [linemap PATCH] Constify lookup
https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01080.html
looking up a line map takes a non-constant line_maps object, which is confusing.
This makes the caching fields mutable, so permits a constant object, as one might expect for a lookup.

	* include/line-map.h (struct maps_info_ordinary): Make cache
	mutable.
	(struct maps_info_macro): Likewise.
	(LINEMAPS_CACHE): Remove non-ref accessor. Constify ref accessor.
	(LINEMAPS_ORDINARY_CACHE, LINEMAPS_MACRO_CACHE): Likewise.
	(LINEMAPS_ORDINARY_MAP_AT, LINEMAPS_MACRO_MAP_AT): Use
	LINEMAPS_USED and LINEMAPS_MAP_AT.
	(linemap_lookup): Constify line_map arg.
	linemap.c (linemap_ordinary_map_lookup, linemap_macro_map_lookup):
	Constify line_map arg.

From-SVN: r276994
2019-10-15 12:03:04 +00:00
Joseph Myers 175a85b297 Support decimal floating-point constants in C2x.
ISO C2x adds decimal floating point as an optional standard feature.
This patch accordingly makes GCC accept DFP constants (DF, DD, DL, df,
dd, dl suffixes) in strict C2X mode, with a pedwarn-if-pedantic for
older standards and a warning with -Wc11-c2x-compat even in C2x mode
(which in turn requires -Wc11-c2x-compat to be newly passed through to
libcpp).

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

gcc/c-family:
	* c.opt (Wc11-c2x-compat): Add CPP(cpp_warn_c11_c2x_compat)
	CppReason(CPP_W_C11_C2X_COMPAT).

gcc/testsuite:
	* gcc.dg/dfp/c11-constants-1.c, gcc.dg/dfp/c11-constants-2.c,
	gcc.dg/dfp/c2x-constants-1.c, gcc.dg/dfp/c2x-constants-2.c: New
	tests.
	* gcc.dg/dfp/constants-pedantic.c: Use -std=gnu17 explicitly.
	Update expected diagnostics.

libcpp:
	* include/cpplib.h (struct cpp_options): Add dfp_constants and
	cpp_warn_c11_c2x_compat.
	(enum cpp_warning_reason): Add CPP_W_C11_C2X_COMPAT.
	* init.c (struct lang_flags): Add dfp_constants.
	(lang_defaults): Set dfp_constants to 1 for GNUC2X and STDC2X and
	0 for other languages.
	(cpp_set_lang): Set dfp_constants from language.
	(cpp_create_reader): Set cpp_warn_c11_c2x_compat to -1.
	* expr.c (interpret_float_suffix): Mention DFP constants as C2X in
	comment.
	(cpp_classify_number): Do not diagnose DFP constants for languages
	setting dfp_constants, unless cpp_warn_c11_c2x_compat.

From-SVN: r276908
2019-10-11 23:22:52 +01:00
Nathan Sidwell 924b927658 [preprocessor/91991] column location overflow
https://gcc.gnu.org/ml/gcc-patches/2019-10/msg00371.html
	PR preprocessor/91991
	* line-map.c (linemap_line_start): Clear max_column_hint if we run
	out of locations.

From-SVN: r276596
2019-10-04 19:08:09 +00:00
Richard Biener 68710ac7da internal.h (enum include_type): Remove trailing comma.
2019-10-02  Richard Biener  <rguenther@suse.de>

	* internal.h (enum include_type): Remove trailing comma.

From-SVN: r276443
2019-10-02 10:22:05 +00:00
Joseph Myers 93313b94fe Handle :: tokens in C for C2x.
As part of adding [[]]-style attributes, C2x adds the token :: for use
in scoped attribute names.

This patch adds corresponding support for that token in C to GCC.  The
token is supported both for C2x and for older gnu* standards (on the
basis that extensions are normally supported in older gnu* versions;
people will expect to be able to use [[]] attributes, before C2x is
the default, without needing to use -std=gnu2x).

There are no cases in older C standards where the token : can be
followed by a token starting with : in syntactically valid sources;
the only cases the :: token could break in older standard C thus are
ones involving concatenation of pp-tokens where the result does not
end up as tokens (e.g., gets stringized).  In GNU C extensions, the
main case where :: might appear in existing sources is in asm
statements, and the C parser is thus made to handle it like two
consecutive : tokens, which the C++ parser already does.  A limited
test of various positionings of :: in asm statements is added to the
testsuite (in particular, to cover the syntax error when :: means too
many colons but a single : would be OK), but existing tests cover a
variety of styles there anyway.

Technically there are cases in Objective-C and OpenMP for which this
also changes how previously valid code is lexed: the objc-selector-arg
syntax allows multiple consecutive : tokens (although I don't think
they are particularly useful there), while OpenMP syntax includes
array section syntax such as [:] which, before :: was a token, could
also be written as [::> (there might be other OpenMP cases potentially
affected, I didn't check all the OpenMP syntax in detail).  I don't
think either of those cases affects the basis for supporting the ::
token in all -std=gnu* modes, or that there is any obvious need to
special-case handling of CPP_SCOPE tokens for those constructs the way
there is for asm statements.

cpp_avoid_paste, which determines when spaces need adding between
tokens in preprocessed output where there wouldn't otherwise be
whitespace between them (e.g. if stringized), already inserts space
between : and : unconditionally, rather than only for C++, so no
change is needed there (but a C2x test is added that such space is
indeed inserted).

Bootstrapped with no regressions on x86-64-pc-linux-gnu.

gcc/c:
	* c-parser.c (c_parser_asm_statement): Handle CPP_SCOPE like two
	CPP_COLON tokens.

gcc/testsuite:
	* gcc.dg/asm-scope-1.c, gcc.dg/cpp/c11-scope-1.c,
	gcc.dg/cpp/c17-scope-1.c, gcc.dg/cpp/c2x-scope-1.c,
	gcc.dg/cpp/c2x-scope-2.c, gcc.dg/cpp/c90-scope-1.c,
	gcc.dg/cpp/c94-scope-1.c, gcc.dg/cpp/c99-scope-1.c,
	gcc.dg/cpp/gnu11-scope-1.c, gcc.dg/cpp/gnu17-scope-1.c,
	gcc.dg/cpp/gnu89-scope-1.c, gcc.dg/cpp/gnu99-scope-1.c: New tests.

libcpp:
	* include/cpplib.h (struct cpp_options): Add member scope.
	* init.c (struct lang_flags, lang_defaults): Likewise.
	(cpp_set_lang): Set scope member of pfile.
	* lex.c (_cpp_lex_direct): Test CPP_OPTION (pfile, scope) not
	CPP_OPTION (pfile, cplusplus) for creating CPP_SCOPE tokens.

From-SVN: r276434
2019-10-02 01:08:40 +01:00
Eric Botcazou 0900e29cdb charset.c (UCS_LIMIT): New macro.
* charset.c (UCS_LIMIT): New macro.
	(ucn_valid_in_identifier): Use it instead of a hardcoded constant.
	(_cpp_valid_ucn): Issue a pedantic warning for UCNs larger than
	UCS_LIMIT outside of identifiers in C and in C++2a or later.

From-SVN: r276167
2019-09-26 21:43:51 +00:00
Lewis Hyatt 7d112d6670 Support extended characters in C/C++ identifiers (PR c/67224)
libcpp/ChangeLog
2019-09-19  Lewis Hyatt  <lhyatt@gmail.com>

	PR c/67224
	* charset.c (_cpp_valid_utf8): New function to help lex UTF-8 tokens.
	* internal.h (_cpp_valid_utf8): Declare.
	* lex.c (forms_identifier_p): Use it to recognize UTF-8 identifiers.
	(_cpp_lex_direct): Handle UTF-8 in identifiers and CPP_OTHER tokens.
	Do all work in "default" case to avoid slowing down typical code paths.
	Also handle $ and UCN in the default case for consistency.

gcc/Changelog
2019-09-19  Lewis Hyatt  <lhyatt@gmail.com>

	PR c/67224
	* doc/cpp.texi: Document support for extended characters in
	identifiers.
	* doc/cppopts.texi: Likewise.

gcc/testsuite/ChangeLog
2019-09-19  Lewis Hyatt  <lhyatt@gmail.com>

	PR c/67224
	* c-c++-common/cpp/ucnid-2011-1-utf8.c: New test.
	* g++.dg/cpp/ucnid-1-utf8.C: New test.
	* g++.dg/cpp/ucnid-2-utf8.C: New test.
	* g++.dg/cpp/ucnid-3-utf8.C: New test.
	* g++.dg/cpp/ucnid-4-utf8.C: New test.
	* g++.dg/other/ucnid-1-utf8.C: New test.
	* gcc.dg/cpp/ucnid-1-utf8.c: New test.
	* gcc.dg/cpp/ucnid-10-utf8.c: New test.
	* gcc.dg/cpp/ucnid-11-utf8.c: New test.
	* gcc.dg/cpp/ucnid-12-utf8.c: New test.
	* gcc.dg/cpp/ucnid-13-utf8.c: New test.
	* gcc.dg/cpp/ucnid-14-utf8.c: New test.
	* gcc.dg/cpp/ucnid-15-utf8.c: New test.
	* gcc.dg/cpp/ucnid-2-utf8.c: New test.
	* gcc.dg/cpp/ucnid-3-utf8.c: New test.
	* gcc.dg/cpp/ucnid-4-utf8.c: New test.
	* gcc.dg/cpp/ucnid-6-utf8.c: New test.
	* gcc.dg/cpp/ucnid-7-utf8.c: New test.
	* gcc.dg/cpp/ucnid-9-utf8.c: New test.
	* gcc.dg/ucnid-1-utf8.c: New test.
	* gcc.dg/ucnid-10-utf8.c: New test.
	* gcc.dg/ucnid-11-utf8.c: New test.
	* gcc.dg/ucnid-12-utf8.c: New test.
	* gcc.dg/ucnid-13-utf8.c: New test.
	* gcc.dg/ucnid-14-utf8.c: New test.
	* gcc.dg/ucnid-15-utf8.c: New test.
	* gcc.dg/ucnid-16-utf8.c: New test.
	* gcc.dg/ucnid-2-utf8.c: New test.
	* gcc.dg/ucnid-3-utf8.c: New test.
	* gcc.dg/ucnid-4-utf8.c: New test.
	* gcc.dg/ucnid-5-utf8.c: New test.
	* gcc.dg/ucnid-6-utf8.c: New test.
	* gcc.dg/ucnid-7-utf8.c: New test.
	* gcc.dg/ucnid-8-utf8.c: New test.
	* gcc.dg/ucnid-9-utf8.c: New test.

From-SVN: r275979
2019-09-19 20:56:11 +01:00
Nathan Sidwell 400b8274e6 [preprocessor] Popping "" file names
https://gcc.gnu.org/ml/gcc-patches/2019-08/msg02069.html
	New # semantics for popping to "" name.
	libcpp/
	* directives.c (do_linemarker): Popping to "" name means get the
	name from the include stack..

From-SVN: r275457
2019-09-06 12:54:19 +00:00
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
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
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
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
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