Fix empty line handling in line directive callback.
The current line number for the #line directive should be passed in as parameter to the line directive callback. Without it, we don't know how many empty lines we should output.
This commit is contained in:
parent
5cbc990a0a
commit
46ea5396ef
6 changed files with 49 additions and 35 deletions
|
|
@ -624,6 +624,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
|
|||
// "#line line source-string-number"
|
||||
|
||||
int token = scanToken(ppToken);
|
||||
const int directiveLoc = ppToken->loc.line;
|
||||
if (token == '\n') {
|
||||
parseContext.error(ppToken->loc, "must by followed by an integral literal", "#line", "");
|
||||
return token;
|
||||
|
|
@ -653,7 +654,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
|
|||
}
|
||||
}
|
||||
if (!fileErr && !lineErr) {
|
||||
parseContext.notifyLineDirective(lineToken, hasFile, fileRes);
|
||||
parseContext.notifyLineDirective(directiveLoc, lineToken, hasFile, fileRes);
|
||||
}
|
||||
token = extraTokenCheck(lineAtom, ppToken, token);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue