From 2668ecb8216d02f4cbb94b14eb3ca0c944a684ca Mon Sep 17 00:00:00 2001 From: root Date: Mon, 21 Mar 2022 18:23:50 +0100 Subject: [PATCH] misleading #line directive error message fix --- libcpp/directives.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libcpp/directives.cc b/libcpp/directives.cc index f804a441f394f..036ec0f94ec97 100644 --- a/libcpp/directives.cc +++ b/libcpp/directives.cc @@ -990,7 +990,12 @@ do_line (cpp_reader *pfile) &new_lineno, &wrapped)) { if (token->type == CPP_EOF) - cpp_error (pfile, CPP_DL_ERROR, "unexpected end of file after #line"); + { + if (pfile->buffer->next_line < pfile->buffer->rlimit) + cpp_error (pfile, CPP_DL_ERROR, "missing #line directive arguments"); + else + cpp_error (pfile, CPP_DL_ERROR, "unexpected end of file after #line"); + } else cpp_error (pfile, CPP_DL_ERROR, "\"%s\" after #line is not a positive integer",