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",