diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-02-08 17:33:45 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-02-08 17:33:45 +0000 |
commit | 44714d8ce1ec1b5ac5dc9a2ed3d57713b9253e81 (patch) | |
tree | 9fcd123fd85a32e3a218356b240e6888a8a295fa /libcpp/line-map.c | |
parent | f258ad62e3ede7069fa9d3926d6377c111f9c6e5 (diff) | |
download | gcc-44714d8ce1ec1b5ac5dc9a2ed3d57713b9253e81.zip gcc-44714d8ce1ec1b5ac5dc9a2ed3d57713b9253e81.tar.gz gcc-44714d8ce1ec1b5ac5dc9a2ed3d57713b9253e81.tar.bz2 |
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
Diffstat (limited to 'libcpp/line-map.c')
-rw-r--r-- | libcpp/line-map.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libcpp/line-map.c b/libcpp/line-map.c index fcf0259..e9175df 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -2036,13 +2036,22 @@ rich_location::lazily_expand_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 rich_location::override_column (int column) { 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_ranges[0].m_caret.column = column; + m_ranges[0].m_start.column = column; + m_ranges[0].m_finish.column = column; } /* Add the given range. */ |