[Bug preprocessor/91733] No longer treat carriage return as an end-of-line
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 8 14:04:42 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91733
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Lewis Hyatt <lhyatt@gcc.gnu.org>:
https://gcc.gnu.org/g:2bd15617e73acf76207127e5580cd10b1fab91a5
commit r13-1577-g2bd15617e73acf76207127e5580cd10b1fab91a5
Author: Lewis Hyatt <lhyatt@gmail.com>
Date: Thu Jul 7 13:59:27 2022 -0400
diagnostics: Make line-ending logic consistent with libcpp [PR91733]
libcpp recognizes a lone \r as a valid line ending, so the infrastructure
for retrieving source lines to be output in diagnostics needs to do the
same. This patch fixes file_cache_slot::get_next_line() accordingly so that
diagnostics display the correct part of the source when \r line endings are
in
use.
gcc/ChangeLog:
PR preprocessor/91733
* input.cc (find_end_of_line): New helper function.
(file_cache_slot::get_next_line): Recognize \r as a line ending.
* diagnostic-show-locus.cc (test_escaping_bytes_1): Adapt selftest
since \r will now be interpreted as a line-ending.
gcc/testsuite/ChangeLog:
PR preprocessor/91733
* c-c++-common/pr91733.c: New test.
More information about the Gcc-bugs
mailing list