mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 05:43:03 +00:00
diagnostics: Windows compatibility issues
Suggested by Bruno Haible <https://lists.gnu.org/r/bug-bison/2022-08/msg00006.html> following a report from Andrei Malashkin <https://lists.gnu.org/r/bug-bison/2022-08/msg00003.html> * src/location.c (caret_set_file): Read the file in binary. We already deal with CRLF in caret_getc_internal.
This commit is contained in:
@@ -268,13 +268,13 @@ caret_set_file (const char *file)
|
||||
if (!caret_info.pos.file)
|
||||
{
|
||||
caret_info.pos.file = file;
|
||||
if ((caret_info.file = fopen (caret_info.pos.file, "r")))
|
||||
if ((caret_info.file = fopen (caret_info.pos.file, "rb")))
|
||||
{
|
||||
/* If the file is not regular (imagine #line 1 "/dev/stdin"
|
||||
in the input file for instance), don't try to quote the
|
||||
file. Keep caret_info.file set so that we don't try to
|
||||
open it again, but leave caret_info.file NULL so that we
|
||||
don't try to quote it. */
|
||||
file. Keep caret_info.pos.file set so that we don't try
|
||||
to open it again, but leave caret_info.file NULL so that
|
||||
we don't try to quote it. */
|
||||
struct stat buf;
|
||||
if (fstat (fileno (caret_info.file), &buf) == 0
|
||||
&& buf.st_mode & S_IFREG)
|
||||
|
||||
Reference in New Issue
Block a user