preproc: Fix garbage at the end of #warning/#error lines at EOF
Using #warning or #error at the very end of a file would generate a trailing garbage character in diagnostics, apparently caused by read_rest_of_line() checking for EOF before the stream can actually know it's at EOF. I'm not good at streams, but this fixes the bug for me with no regressions, and the function in question is only used by the code handling #warning/#error anyway.
This commit is contained in:
parent
695026c7e6
commit
db0a663858
1 changed files with 1 additions and 1 deletions
|
@ -734,7 +734,7 @@ std::string preprocessor_data::read_line()
|
|||
std::string preprocessor_data::read_rest_of_line()
|
||||
{
|
||||
std::string res;
|
||||
while(!in_.eof() && in_.peek() != '\n') {
|
||||
while(in_.peek() != '\n' && !in_.eof()) {
|
||||
int c = in_.get();
|
||||
if (c != '\r')
|
||||
res += static_cast<char>(c);
|
||||
|
|
Loading…
Add table
Reference in a new issue