aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/parser.c5
-rw-r--r--gcc/input.c26
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/pr77949.C7
6 files changed, 56 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d0c53d0..ff8dac4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2017-01-10 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/77949
+ * input.c (selftest::test_accessing_ordinary_linemaps): Verify
+ that we correctly handle column numbers greater than
+ LINE_MAP_MAX_COLUMN_NUMBER.
+
2017-01-10 Martin Sebor <msebor@redhat.com>
PR tree-optimization/78775
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 25f5a85..892651a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2017-01-10 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/77949
+ * parser.c (cp_parser_class_specifier_1): Only suggest inserting
+ a missing semicolon if we have a valid insertion location for
+ the fix-it hint.
+
2017-01-10 Jason Merrill <jason@redhat.com>
FI 20, decomposition declaration with parenthesized initializer.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 4517313..7b3ee30 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -22164,7 +22164,10 @@ cp_parser_class_specifier_1 (cp_parser* parser)
next_loc = linemap_position_for_loc_and_offset (line_table, loc, 1);
rich_location richloc (line_table, next_loc);
- richloc.add_fixit_insert_before (next_loc, ";");
+
+ /* If we successfully offset the location, suggest the fix-it. */
+ if (next_loc != loc)
+ richloc.add_fixit_insert_before (next_loc, ";");
if (CLASSTYPE_DECLARED_CLASS (type))
error_at_rich_loc (&richloc,
diff --git a/gcc/input.c b/gcc/input.c
index bbb6abb..3e67314 100644
--- a/gcc/input.c
+++ b/gcc/input.c
@@ -1699,6 +1699,22 @@ test_accessing_ordinary_linemaps (const line_table_case &case_)
ASSERT_EQ (7, map->m_column_and_range_bits - map->m_range_bits);
}
+ /* Example of a line that will eventually be seen to be longer
+ than LINE_MAP_MAX_COLUMN_NUMBER; the initially seen width is
+ below that. */
+ linemap_line_start (line_table, 5, 2000);
+
+ location_t loc_start_of_very_long_line
+ = linemap_position_for_column (line_table, 2000);
+ location_t loc_too_wide
+ = linemap_position_for_column (line_table, 4097);
+ location_t loc_too_wide_2
+ = linemap_position_for_column (line_table, 4098);
+
+ /* ...and back to a sane line length. */
+ linemap_line_start (line_table, 6, 100);
+ location_t loc_sane_again = linemap_position_for_column (line_table, 10);
+
linemap_add (line_table, LC_LEAVE, false, NULL, 0);
/* Multiple files. */
@@ -1714,6 +1730,16 @@ test_accessing_ordinary_linemaps (const line_table_case &case_)
assert_loceq ("foo.c", 2, 17, loc_d);
assert_loceq ("foo.c", 3, 700, loc_e);
assert_loceq ("foo.c", 4, 100, loc_back_to_short);
+
+ /* In the very wide line, the initial location should be fully tracked. */
+ assert_loceq ("foo.c", 5, 2000, loc_start_of_very_long_line);
+ /* ...but once we exceed LINE_MAP_MAX_COLUMN_NUMBER column-tracking should
+ be disabled. */
+ assert_loceq ("foo.c", 5, 0, loc_too_wide);
+ assert_loceq ("foo.c", 5, 0, loc_too_wide_2);
+ /*...and column-tracking should be re-enabled for subsequent lines. */
+ assert_loceq ("foo.c", 6, 10, loc_sane_again);
+
assert_loceq ("bar.c", 1, 150, loc_f);
ASSERT_FALSE (is_location_from_builtin_token (loc_a));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f8cba42..59a2fcf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-10 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/77949
+ * g++.dg/diagnostic/pr77949.C: New test case.
+
2017-01-10 Martin Sebor <msebor@redhat.com>
PR tree-optimization/78775
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr77949.C b/gcc/testsuite/g++.dg/diagnostic/pr77949.C
new file mode 100644
index 0000000..0d8b333
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/pr77949.C
@@ -0,0 +1,7 @@
+// Ensure that no fix-it hints are emitted
+// { dg-options "-fdiagnostics-parseable-fixits" }
+
+/* Very long line, where a missing semicolon would be suggested for
+ insertion at column 4097. */
+class test { }
+// { dg-error "0: expected .;. after class definition" "" { target *-*-* } .-1 }