+2018-01-27 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR diagnostic/84034
+ * diagnostic-show-locus.c (get_line_width_without_trailing_whitespace):
+ Handle CR like TAB.
+ (layout::print_source_line): Likewise.
+ (test_get_line_width_without_trailing_whitespace): Add test cases.
+
2018-01-27 Jakub Jelinek <jakub@redhat.com>
PR middle-end/84040
while (result > 0)
{
char ch = line[result - 1];
- if (ch == ' ' || ch == '\t')
+ if (ch == ' ' || ch == '\t' || ch == '\r')
result--;
else
break;
gcc_assert (result <= line_width);
gcc_assert (result == 0 ||
(line[result - 1] != ' '
- && line[result -1] != '\t'));
+ && line[result -1] != '\t'
+ && line[result -1] != '\r'));
return result;
}
assert_eq ("", 0);
assert_eq (" ", 0);
assert_eq ("\t", 0);
+ assert_eq ("\r", 0);
assert_eq ("hello world", 11);
assert_eq ("hello world ", 11);
assert_eq ("hello world \t\t ", 11);
+ assert_eq ("hello world\r", 11);
}
#endif /* #if CHECKING_P */
else
m_colorizer.set_normal_text ();
}
- char c = *line == '\t' ? ' ' : *line;
- if (c == '\0')
+ char c = *line;
+ if (c == '\0' || c == '\t' || c == '\r')
c = ' ';
if (c != ' ')
{