Commit 44714d8c by David Malcolm Committed by David Malcolm

PR preprocessor/69664: fix rich_location::override_column

gcc/testsuite/ChangeLog:
	PR preprocessor/69664
	* gcc.dg/cpp/trad/comment-2.c: Add expected column number.
	* gcc.dg/cpp/warn-comments.c: Likewise.

libcpp/ChangeLog:
	PR preprocessor/69664
	* errors.c (cpp_diagnostic_with_line): Only call
	rich_location::override_column if the column is non-zero.
	* line-map.c (rich_location::override_column): Update columns
	within m_ranges[0].  Add assertions to verify that doing so is
	sane.

From-SVN: r233223
parent f258ad62
2016-02-08 David Malcolm <dmalcolm@redhat.com>
PR preprocessor/69664
* gcc.dg/cpp/trad/comment-2.c: Add expected column number.
* gcc.dg/cpp/warn-comments.c: Likewise.
2016-02-08 Marek Polacek <polacek@redhat.com> 2016-02-08 Marek Polacek <polacek@redhat.com>
PR c++/69688 PR c++/69688
......
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
/* /*
/* { dg-warning "within comment" } */ /* { dg-warning "2: within comment" } */
// { dg-do preprocess } // { dg-do preprocess }
// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wcomments" } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Wcomments" }
/* /* */ // { dg-warning "\"\.\*\" within comment .-Wcomment." } /* /* */ // { dg-warning "4: \"\.\*\" within comment .-Wcomment." }
// \ // \
// { dg-warning "multi-line comment .-Wcomment." "multi-line" { target *-*-* } 6 } // { dg-warning "1: multi-line comment .-Wcomment." "multi-line" { target *-*-* } 6 }
2016-02-08 David Malcolm <dmalcolm@redhat.com>
PR preprocessor/69664
* errors.c (cpp_diagnostic_with_line): Only call
rich_location::override_column if the column is non-zero.
* line-map.c (rich_location::override_column): Update columns
within m_ranges[0]. Add assertions to verify that doing so is
sane.
2016-02-05 Jakub Jelinek <jakub@redhat.com> 2016-02-05 Jakub Jelinek <jakub@redhat.com>
PR c++/69628 PR c++/69628
......
...@@ -141,7 +141,8 @@ cpp_diagnostic_with_line (cpp_reader * pfile, int level, int reason, ...@@ -141,7 +141,8 @@ cpp_diagnostic_with_line (cpp_reader * pfile, int level, int reason,
if (!pfile->cb.error) if (!pfile->cb.error)
abort (); abort ();
rich_location richloc (pfile->line_table, src_loc); rich_location richloc (pfile->line_table, src_loc);
richloc.override_column (column); if (column)
richloc.override_column (column);
ret = pfile->cb.error (pfile, level, reason, &richloc, _(msgid), ap); ret = pfile->cb.error (pfile, level, reason, &richloc, _(msgid), ap);
return ret; return ret;
......
...@@ -2036,13 +2036,22 @@ rich_location::lazily_expand_location () ...@@ -2036,13 +2036,22 @@ rich_location::lazily_expand_location ()
return m_expanded_location; return m_expanded_location;
} }
/* Set the column of the primary location. */ /* Set the column of the primary location. This can only be called for
rich_location instances for which the primary location has
caret==start==finish. */
void void
rich_location::override_column (int column) rich_location::override_column (int column)
{ {
lazily_expand_location (); lazily_expand_location ();
gcc_assert (m_ranges[0].m_show_caret_p);
gcc_assert (m_ranges[0].m_caret.column == m_expanded_location.column);
gcc_assert (m_ranges[0].m_start.column == m_expanded_location.column);
gcc_assert (m_ranges[0].m_finish.column == m_expanded_location.column);
m_expanded_location.column = column; m_expanded_location.column = column;
m_ranges[0].m_caret.column = column;
m_ranges[0].m_start.column = column;
m_ranges[0].m_finish.column = column;
} }
/* Add the given range. */ /* Add the given range. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment