Commit Graph

659 Commits

Author SHA1 Message Date
Nathan Sidwell bf09d886a4 [PR93306] Short-circuit has_include
the preprocessor evaluator has a skip_eval counter, but we weren't
checking it after parsing has_include(foo), but before looking for
foo.  Resulting in unnecessary io for 'FALSE_COND && has_include <foo>'

	PR preprocessor/93306
	* expr.c (parse_has_include): Refactor.  Check skip_eval before
	looking.
2020-01-17 05:44:30 -08:00
David Malcolm 4bc1899b2e Add diagnostic paths
This patch adds support for associating a "diagnostic_path" with a
diagnostic: a sequence of events predicted by the compiler that leads to
the problem occurring, with their locations in the user's source,
text descriptions, and stack information (for handling interprocedural
paths).

For example, the following (hypothetical) error has a 3-event
intraprocedural path:

test.c: In function 'demo':
test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which
  requires a non-NULL parameter
   29 |     PyList_Append(list, item);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
  'demo': events 1-3
     |
     |   25 |   list = PyList_New(0);
     |      |          ^~~~~~~~~~~~~
     |      |          |
     |      |          (1) when 'PyList_New' fails, returning NULL
     |   26 |
     |   27 |   for (i = 0; i < count; i++) {
     |      |   ~~~
     |      |   |
     |      |   (2) when 'i < count'
     |   28 |     item = PyLong_FromLong(random());
     |   29 |     PyList_Append(list, item);
     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
     |      |     |
     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
     |

The patch adds a new "%@" format code for printing event IDs, so that
in the above, the description of event (3) mentions event (1), showing
the user where the bogus NULL value comes from (the event IDs are
colorized to draw the user's attention to them).

There is a separation between data vs presentation: the above shows how
the diagnostic-printing code has consolidated the path into a single run
of events, since all the events are near each other and within the same
function; more complicated examples (such as interprocedural paths)
might be printed as multiple runs of events.

Examples of how interprocedural paths are printed can be seen in the
test suite (which uses a plugin to exercise the code without relying
on specific warnings using this functionality).

Other output formats include
- JSON,
- printing each event as a separate "note", and
- to not emit paths.

gcc/ChangeLog:
	* Makefile.in (OBJS): Add tree-diagnostic-path.o.
	* common.opt (fdiagnostics-path-format=): New option.
	(diagnostic_path_format): New enum.
	(fdiagnostics-show-path-depths): New option.
	* coretypes.h (diagnostic_event_id_t): New forward decl.
	* diagnostic-color.c (color_dict): Add "path".
	* diagnostic-event-id.h: New file.
	* diagnostic-format-json.cc (json_from_expanded_location): Make
	non-static.
	(json_end_diagnostic): Call context->make_json_for_path if it
	exists and the diagnostic has a path.
	(diagnostic_output_format_init): Clear context->print_path.
	* diagnostic-path.h: New file.
	* diagnostic-show-locus.c (colorizer::set_range): Special-case
	when printing a run of events in a diagnostic_path so that they
	all get the same color.
	(layout::m_diagnostic_path_p): New field.
	(layout::layout): Initialize it.
	(layout::print_any_labels): Don't colorize the label text for an
	event in a diagnostic_path.
	(gcc_rich_location::add_location_if_nearby): Add
	"restrict_to_current_line_spans" and "label" params.  Pass the
	former to layout.maybe_add_location_range; pass the latter
	when calling add_range.
	* diagnostic.c: Include "diagnostic-path.h".
	(diagnostic_initialize): Initialize context->path_format and
	context->show_path_depths.
	(diagnostic_show_any_path): New function.
	(diagnostic_path::interprocedural_p): New function.
	(diagnostic_report_diagnostic): Call diagnostic_show_any_path.
	(simple_diagnostic_path::num_events): New function.
	(simple_diagnostic_path::get_event): New function.
	(simple_diagnostic_path::add_event): New function.
	(simple_diagnostic_event::simple_diagnostic_event): New ctor.
	(simple_diagnostic_event::~simple_diagnostic_event): New dtor.
	(debug): New overload taking a diagnostic_path *.
	* diagnostic.def (DK_DIAGNOSTIC_PATH): New.
	* diagnostic.h (enum diagnostic_path_format): New enum.
	(json::value): New forward decl.
	(diagnostic_context::path_format): New field.
	(diagnostic_context::show_path_depths): New field.
	(diagnostic_context::print_path): New callback field.
	(diagnostic_context::make_json_for_path): New callback field.
	(diagnostic_show_any_path): New decl.
	(json_from_expanded_location): New decl.
	* doc/invoke.texi (-fdiagnostics-path-format=): New option.
	(-fdiagnostics-show-path-depths): New option.
	(-fdiagnostics-color): Add "path" to description of default
	GCC_COLORS; describe it.
	(-fdiagnostics-format=json): Document how diagnostic paths are
	represented in the JSON output format.
	* gcc-rich-location.h (gcc_rich_location::add_location_if_nearby):
	Add optional params "restrict_to_current_line_spans" and "label".
	* opts.c (common_handle_option): Handle
	OPT_fdiagnostics_path_format_ and
	OPT_fdiagnostics_show_path_depths.
	* pretty-print.c: Include "diagnostic-event-id.h".
	(pp_format): Implement "%@" format code for printing
	diagnostic_event_id_t *.
	(selftest::test_pp_format): Add tests for "%@".
	* selftest-run-tests.c (selftest::run_tests): Call
	selftest::tree_diagnostic_path_cc_tests.
	* selftest.h (selftest::tree_diagnostic_path_cc_tests): New decl.
	* toplev.c (general_init): Initialize global_dc->path_format and
	global_dc->show_path_depths.
	* tree-diagnostic-path.cc: New file.
	* tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Make
	non-static.  Drop "diagnostic" param in favor of storing the
	original value of "where" and re-using it.
	(virt_loc_aware_diagnostic_finalizer): Update for dropped param of
	maybe_unwind_expanded_macro_loc.
	(tree_diagnostics_defaults): Initialize context->print_path and
	context->make_json_for_path.
	* tree-diagnostic.h (default_tree_diagnostic_path_printer): New
	decl.
	(default_tree_make_json_for_path): New decl.
	(maybe_unwind_expanded_macro_loc): New decl.

gcc/c-family/ChangeLog:
	* c-format.c (local_event_ptr_node): New.
	(PP_FORMAT_CHAR_TABLE): Add entry for "%@".
	(init_dynamic_diag_info): Initialize local_event_ptr_node.
	* c-format.h (T_EVENT_PTR): New define.

gcc/testsuite/ChangeLog:
	* gcc.dg/format/gcc_diag-10.c (diagnostic_event_id_t): New
	typedef.
	(test_diag): Add coverage of "%@".
	* gcc.dg/plugin/diagnostic-path-format-default.c: New test.
	* gcc.dg/plugin/diagnostic-path-format-inline-events-1.c: New test.
	* gcc.dg/plugin/diagnostic-path-format-inline-events-2.c: New test.
	* gcc.dg/plugin/diagnostic-path-format-inline-events-3.c: New test.
	* gcc.dg/plugin/diagnostic-path-format-none.c: New test.
	* gcc.dg/plugin/diagnostic-test-paths-1.c: New test.
	* gcc.dg/plugin/diagnostic-test-paths-2.c: New test.
	* gcc.dg/plugin/diagnostic-test-paths-3.c: New test.
	* gcc.dg/plugin/diagnostic-test-paths-4.c: New test.
	* gcc.dg/plugin/diagnostic_plugin_test_paths.c: New.
	* gcc.dg/plugin/plugin.exp: Add the new plugin and test cases.

libcpp/ChangeLog:
	* include/line-map.h (class diagnostic_path): New forward decl.
	(rich_location::get_path): New accessor.
	(rich_location::set_path): New function.
	(rich_location::m_path): New field.
	* line-map.c (rich_location::rich_location): Initialize m_path.

From-SVN: r280142
2020-01-10 21:22:12 +00:00
Jakub Jelinek 8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
David Malcolm 6dd0c82021 Drop unused member from cpp_string_location_reader (PR preprocessor/92982)
libcpp/ChangeLog:
	PR preprocessor/92982
	* charset.c
	(cpp_string_location_reader::cpp_string_location_reader): Delete
	initialization of m_line_table.
	* include/cpplib.h (cpp_string_location_reader::m_line_table):
	Delete unused member.

From-SVN: r279541
2019-12-18 17:26:01 +00:00
Jakub Jelinek 937a778ea3 re PR preprocessor/92919 (invalid memory access in wide_str_to_charconst when running ucn2.C testcase (caught by hwasan))
PR preprocessor/92919
	* charset.c (wide_str_to_charconst): If str contains just the
	NUL terminator, punt quietly.

From-SVN: r279399
2019-12-14 23:18:53 +01:00
David Malcolm d68f5d458d Replace label_text ctor with "borrow" and "take"
libcpp's label_text class wraps a text buffer, along with a flag to
determine if it "owns" the buffer.

The existing ctor exposed this directly, but I found it difficult
to remember the sense of flag, so this patch hides the ctor, in
favor of static member functions "borrow" and "take", to make
the effect on ownership explicit in the name.

gcc/c-family/ChangeLog:
	* c-format.c (range_label_for_format_type_mismatch::get_text):
	Replace label_text ctor called with true with label_text::take.

gcc/c/ChangeLog:
	* c-objc-common.c (range_label_for_type_mismatch::get_text):
	Replace label_text ctor calls.

gcc/cp/ChangeLog:
	* error.c (range_label_for_type_mismatch::get_text): Replace
	label_text ctor calls with label_text::borrow.

gcc/ChangeLog:
	* gcc-rich-location.c
	(maybe_range_label_for_tree_type_mismatch::get_text): Replace
	label_text ctor call with label_text::borrow.
	* gcc-rich-location.h (text_range_label::get_text): Replace
	label_text ctor called with false with label_text::borrow.

libcpp/ChangeLog:
	* include/line-map.h (label_text::label_text): Make private.
	(label_text::borrow): New.
	(label_text::take): New.
	(label_text::take_or_copy): New.

From-SVN: r279153
2019-12-10 02:02:38 +00:00
Lewis Hyatt ee9256409f Byte vs column awareness for diagnostic-show-locus.c (PR 49973)
contrib/ChangeLog

2019-12-09  Lewis Hyatt  <lhyatt@gmail.com>

	PR preprocessor/49973
	* unicode/from_glibc/unicode_utils.py: Support script from
	glibc (commit 464cd3) to extract character widths from Unicode data
	files.
	* unicode/from_glibc/utf8_gen.py: Likewise.
	* unicode/UnicodeData.txt: Unicode v. 12.1.0 data file.
	* unicode/EastAsianWidth.txt: Likewise.
	* unicode/PropList.txt: Likewise.
	* unicode/gen_wcwidth.py: New utility to generate
	libcpp/generated_cpp_wcwidth.h with help from the glibc support
	scripts and the Unicode data files.
	* unicode/unicode-license.txt: Added.
	* unicode/README: New explanatory file.

libcpp/ChangeLog

2019-12-09  Lewis Hyatt  <lhyatt@gmail.com>

	PR preprocessor/49973
	* generated_cpp_wcwidth.h: New file generated by
	../contrib/unicode/gen_wcwidth.py, supports new cpp_wcwidth function.
	* charset.c (compute_next_display_width): New function to help
	implement display columns.
	(cpp_byte_column_to_display_column): Likewise.
	(cpp_display_column_to_byte_column): Likewise.
	(cpp_wcwidth): Likewise.
	* include/cpplib.h (cpp_byte_column_to_display_column): Declare.
	(cpp_display_column_to_byte_column): Declare.
	(cpp_wcwidth): Declare.
	(cpp_display_width): New function.

gcc/ChangeLog

2019-12-09  Lewis Hyatt  <lhyatt@gmail.com>

	PR preprocessor/49973
	* input.c (location_compute_display_column): New function to help with
	multibyte awareness in diagnostics.
	(test_cpp_utf8): New self-test.
	(input_c_tests): Call the new test.
	* input.h (location_compute_display_column): Declare.
	* diagnostic-show-locus.c: Pervasive changes to add multibyte awareness
	to all classes and functions.
	(enum column_unit): New enum.
	(class exploc_with_display_col): New class.
	(class layout_point): Convert m_column member to array m_columns[2].
	(layout_range::contains_point): Add col_unit argument.
	(test_layout_range_for_single_point): Pass new argument.
	(test_layout_range_for_single_line): Likewise.
	(test_layout_range_for_multiple_lines): Likewise.
	(line_bounds::convert_to_display_cols): New function.
	(layout::get_state_at_point): Add col_unit argument.
	(make_range): Use empty filename rather than dummy filename.
	(get_line_width_without_trailing_whitespace): Rename to...
	(get_line_bytes_without_trailing_whitespace): ...this.
	(test_get_line_width_without_trailing_whitespace): Rename to...
	(test_get_line_bytes_without_trailing_whitespace): ...this.
	(class layout): m_exploc changed to exploc_with_display_col from
	plain expanded_location.
	(layout::get_linenum_width): New accessor member function.
	(layout::get_x_offset_display): Likewise.
	(layout::calculate_linenum_width): New subroutine for the constuctor.
	(layout::calculate_x_offset_display): Likewise.
	(layout::layout): Use the new subroutines. Add multibyte awareness.
	(layout::print_source_line): Add multibyte awareness.
	(layout::print_line): Likewise.
	(layout::print_annotation_line): Likewise.
	(line_label::line_label): Likewise.
	(layout::print_any_labels): Likewise.
	(layout::annotation_line_showed_range_p): Likewise.
	(get_printed_columns): Likewise.
	(class line_label): Rename m_length to m_display_width.
	(get_affected_columns): Rename to...
	(get_affected_range): ...this; add col_unit argument and multibyte
	awareness.
	(class correction): Add m_affected_bytes and m_display_cols
	members.  Rename m_len to m_byte_length for clarity.  Add multibyte
	awareness throughout.
	(correction::insertion_p): Add multibyte awareness.
	(correction::compute_display_cols): New function.
	(correction::ensure_terminated): Use new member name m_byte_length.
	(line_corrections::add_hint): Add multibyte awareness.
	(layout::print_trailing_fixits): Likewise.
	(layout::get_x_bound_for_row): Likewise.
	(test_one_liner_simple_caret_utf8): New self-test analogous to the one
	with _utf8 suffix removed, testing multibyte awareness.
	(test_one_liner_caret_and_range_utf8): Likewise.
	(test_one_liner_multiple_carets_and_ranges_utf8): Likewise.
	(test_one_liner_fixit_insert_before_utf8): Likewise.
	(test_one_liner_fixit_insert_after_utf8): Likewise.
	(test_one_liner_fixit_remove_utf8): Likewise.
	(test_one_liner_fixit_replace_utf8): Likewise.
	(test_one_liner_fixit_replace_non_equal_range_utf8): Likewise.
	(test_one_liner_fixit_replace_equal_secondary_range_utf8): Likewise.
	(test_one_liner_fixit_validation_adhoc_locations_utf8): Likewise.
	(test_one_liner_many_fixits_1_utf8): Likewise.
	(test_one_liner_many_fixits_2_utf8): Likewise.
	(test_one_liner_labels_utf8): Likewise.
	(test_diagnostic_show_locus_one_liner_utf8): Likewise.
	(test_overlapped_fixit_printing_utf8): Likewise.
	(test_overlapped_fixit_printing): Adapt for changes to
	get_affected_columns, get_printed_columns and class corrections.
	(test_overlapped_fixit_printing_2): Likewise.
	(test_linenum_sep): New constant.
	(test_left_margin): Likewise.
	(test_offset_impl): Helper function for new test.
	(test_layout_x_offset_display_utf8): New test.
	(diagnostic_show_locus_c_tests): Call new tests.

gcc/testsuite/ChangeLog:

2019-12-09  Lewis Hyatt  <lhyatt@gmail.com>

	PR preprocessor/49973
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
	(test_show_locus): Tweak so that expected output is the same as
	before the diagnostic-show-locus.c changes.
	* gcc.dg/cpp/pr66415-1.c: Likewise.

From-SVN: r279137
2019-12-09 20:03:47 +00:00
Joseph Myers 7c5890cc0a Support UTF-8 character constants for C2x.
C2x adds u8'' character constants to C.  This patch adds the
corresponding GCC support.

Most of the support was already present for C++ and just needed
enabling for C2x.  However, in C2x these constants have type unsigned
char, which required corresponding adjustments in the compiler and the
preprocessor to give them that type for C.

For C, it seems clear to me that having type unsigned char means the
constants are unsigned in the preprocessor (and thus treated as having
type uintmax_t in #if conditionals), so this patch implements that.  I
included a conditional in the libcpp change to avoid affecting
signedness for C++, but I'm not sure if in fact these constants should
also be unsigned in the preprocessor for C++ in which case that
!CPP_OPTION (pfile, cplusplus) conditional would not be needed.

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

gcc/c:
	* c-parser.c (c_parser_postfix_expression)
	(c_parser_check_literal_zero): Handle CPP_UTF8CHAR.
	* gimple-parser.c (c_parser_gimple_postfix_expression): Likewise.

gcc/c-family:
	* c-lex.c (lex_charconst): Make CPP_UTF8CHAR constants unsigned
	char for C.

gcc/testsuite:
	* gcc.dg/c11-utf8char-1.c, gcc.dg/c2x-utf8char-1.c,
	gcc.dg/c2x-utf8char-2.c, gcc.dg/c2x-utf8char-3.c,
	gcc.dg/gnu2x-utf8char-1.c: New tests.

libcpp:
	* charset.c (narrow_str_to_charconst): Make CPP_UTF8CHAR constants
	unsigned for C.
	* init.c (lang_defaults): Set utf8_char_literals for GNUC2X and
	STDC2X.

From-SVN: r278265
2019-11-14 20:18:33 +00:00
Jakub Jelinek 2c03d73667 PR c++/91370 - Implement P1041R4 and P1139R2 - Stronger Unicode reqs
PR c++/91370 - Implement P1041R4 and P1139R2 - Stronger Unicode reqs
	* charset.c (narrow_str_to_charconst): Add TYPE argument.  For
	CPP_UTF8CHAR diagnose whenever number of chars is > 1, using
	CPP_DL_ERROR instead of CPP_DL_WARNING.
	(wide_str_to_charconst): For CPP_CHAR16 or CPP_CHAR32, use
	CPP_DL_ERROR instead of CPP_DL_WARNING when multiple char16_t
	or char32_t chars are needed.
	(cpp_interpret_charconst): Adjust narrow_str_to_charconst caller.

	* g++.dg/cpp1z/utf8-neg.C: Expect errors rather than -Wmultichar
	warnings.
	* g++.dg/ext/utf16-4.C: Expect errors rather than warnings.
	* g++.dg/ext/utf32-4.C: Likewise.
	* g++.dg/cpp2a/ucn2.C: New test.

From-SVN: r277929
2019-11-07 21:24:38 +01:00
Jason Merrill b7689b962d Implement C++20 operator<=>.
There are three major pieces to this support: scalar operator<=>,
synthesis of comparison operators, and rewritten/reversed overload
resolution (e.g. a < b becomes 0 > b <=> a).

Unlike other defaulted functions, where we use synthesized_method_walk to
semi-simulate what the definition of the function will be like, this patch
determines the characteristics of a comparison operator by trying to define
it.

My handling of non-dependent rewritten operators in templates can still use
some work: build_min_non_dep_op_overload can't understand the rewrites and
crashes, so I'm avoiding it for now by clearing *overload.  This means we'll
do name lookup again at instantiation time, which can incorrectly mean a
different result.  I'll poke at this more in stage 3.

I'm leaving out a fourth section ("strong structural equality") even though
I've implemented it, because it seems likely to change radically tomorrow.

Thanks to Tim van Deurzen and Jakub for implementing lexing of the <=>
operator, and Jonathan for the initial <compare> header.

gcc/cp/
	* cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield.
	(DECL_MAYBE_DELETED): New.
	(enum special_function_kind): Add sfk_comparison.
	(LOOKUP_REWRITTEN, LOOKUP_REVERSED): New.
	* call.c (struct z_candidate): Add rewritten and reversed methods.
	(add_builtin_candidate): Handle SPACESHIP_EXPR.
	(add_builtin_candidates): Likewise.
	(add_candidates): Don't add a reversed candidate if the parms are
	the same.
	(add_operator_candidates): Split out from build_new_op_1.  Handle
	rewritten and reversed candidates.
	(add_candidate): Swap conversions of reversed candidate.
	(build_new_op_1): Swap them back.  Build a second operation for
	rewritten candidates.
	(extract_call_expr): Handle rewritten calls.
	(same_fn_or_template): New.
	(joust): Handle rewritten and reversed candidates.
	* class.c (add_implicitly_declared_members): Add implicit op==.
	(classtype_has_op, classtype_has_defaulted_op): New.
	* constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR.
	(cxx_eval_constant_expression, potential_constant_expression_1):
	Likewise.
	* cp-gimplify.c (genericize_spaceship): New.
	(cp_genericize_r): Use it.
	* cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR.
	* decl.c (finish_function): Handle deleted function.
	* decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend.
	(mark_used): Check DECL_MAYBE_DELETED.  Remove assumption that
	defaulted functions are non-static members.
	* error.c (dump_expr): Handle SPACESHIP_EXPR.
	* method.c (type_has_trivial_fn): False for sfk_comparison.
	(enum comp_cat_tag, struct comp_cat_info_t): New types.
	(comp_cat_cache): New array variable.
	(lookup_comparison_result, lookup_comparison_category)
	(is_cat, cat_tag_for, spaceship_comp_cat)
	(spaceship_type, genericize_spaceship)
	(common_comparison_type, early_check_defaulted_comparison)
	(comp_info, build_comparison_op): New.
	(synthesize_method): Handle sfk_comparison.  Handle deleted.
	(get_defaulted_eh_spec, maybe_explain_implicit_delete)
	(explain_implicit_non_constexpr, implicitly_declare_fn)
	(defaulted_late_check, defaultable_fn_check): Handle sfk_comparison.
	* name-lookup.c (get_std_name_hint): Add comparison categories.
	* tree.c (special_function_p): Add sfk_comparison.
	* typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR.

2019-11-05  Tim van Deurzen  <tim@kompiler.org>

	Add new tree code for the spaceship operator.
gcc/cp/
	* cp-tree.def: Add new tree code.
	* operators.def: New binary operator.
	* parser.c: Add new token and tree code.
libcpp/
	* cpplib.h: Add spaceship operator for C++.
	* lex.c: Implement conditional lexing of spaceship operator for C++20.

2019-11-05  Jonathan Wakely  <jwakely@redhat.com>

libstdc++-v3/
	* libsupc++/compare: New header.
	* libsupc++/Makefile.am (std_HEADERS): Add compare.
	* include/std/version: Define __cpp_lib_three_way_comparison.
	* include/std/functional: #include <compare>.

From-SVN: r277865
2019-11-05 18:56:18 -05:00
Jakub Jelinek aa23e73b1a re PR preprocessor/92296 (internal compiler error: Segmentation fault #pragma push_macro("__LINE__"))
PR preprocessor/92296
	* internal.h (struct def_pragma_macro): Add is_builtin bitfield.
	(_cpp_restore_special_builtin): Declare.
	* init.c (_cpp_restore_special_builtin): New function.
	* directives.c (do_pragma_push_macro): For NT_BUILTIN_MACRO
	set is_builtin and don't try to grab definition.
	(cpp_pop_definition): Use _cpp_restore_special_builtin to restore
	builtin macros.

	* c-c++-common/cpp/pr92296-1.c: New test.
	* c-c++-common/cpp/pr92296-2.c: New test.

From-SVN: r277685
2019-10-31 18:38:44 +01:00
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