From 46ce03de3afe6dcd7b23572ada199c28ffc10e70 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Nov 2015 09:27:12 +0100 Subject: re PR preprocessor/60736 (Crash in preprocessor including stdc-predef.h when it does not exist on glibc-based systems) PR preprocessor/60736 * include/cpplib.h (cpp_errno_filename): New prototype. * errors.c (cpp_errno): Don't handle msgid "" specially, use _(msgid) instead of msgid as argument to cpp_error. (cpp_errno_filename): New function. * files.c (read_file_guts): Use cpp_errno_filename instead of cpp_errno. (open_file_failed): Likewise. Use file->name if file->path is NULL in diagnostics. From-SVN: r230591 --- libcpp/files.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libcpp/files.c') diff --git a/libcpp/files.c b/libcpp/files.c index 8c388d8..5f532d3 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -715,7 +715,7 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file) if (count < 0) { - cpp_errno (pfile, CPP_DL_ERROR, file->path); + cpp_errno_filename (pfile, CPP_DL_ERROR, file->path); free (buf); return false; } @@ -1053,7 +1053,8 @@ open_file_failed (cpp_reader *pfile, _cpp_file *file, int angle_brackets) /* If the preprocessor output (other than dependency information) is being used, we must also flag an error. */ if (CPP_OPTION (pfile, deps.need_preprocessor_output)) - cpp_errno (pfile, CPP_DL_FATAL, file->path); + cpp_errno_filename (pfile, CPP_DL_FATAL, + file->path ? file->path : file->name); } else { @@ -1067,9 +1068,11 @@ open_file_failed (cpp_reader *pfile, _cpp_file *file, int angle_brackets) if (CPP_OPTION (pfile, deps.style) == DEPS_NONE || print_dep || CPP_OPTION (pfile, deps.need_preprocessor_output)) - cpp_errno (pfile, CPP_DL_FATAL, file->path); + cpp_errno_filename (pfile, CPP_DL_FATAL, + file->path ? file->path : file->name); else - cpp_errno (pfile, CPP_DL_WARNING, file->path); + cpp_errno_filename (pfile, CPP_DL_WARNING, + file->path ? file->path : file->name); } } -- cgit v1.1