Skip spaces (after #) earlier to catch blank line or end-of-buffer.
The C preprocessor does believe in a # [nothing] line; and we may as well give up before checking for keywords if we've run out of buffer. Change-Id: I64dc3ad2808435389d0d7b56dcbc9d92ae72aa6e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
parent
00a855d643
commit
3780b3da99
@ -539,8 +539,18 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
|
||||
break;
|
||||
|
||||
// preprocessor directive
|
||||
if (beginning && buffer[x] == '#')
|
||||
if (beginning && buffer[x] == '#') {
|
||||
// Advance to start of preprocessing directive
|
||||
while (++x < buffer_len
|
||||
&& (buffer[x] == ' ' || buffer[x] == '\t')) {} // skip
|
||||
|
||||
if (qmake_endOfLine(buffer[x])) {
|
||||
++line_count;
|
||||
beginning = 1;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// quoted strings
|
||||
if (buffer[x] == '\'' || buffer[x] == '"') {
|
||||
@ -561,13 +571,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
|
||||
if(x >= buffer_len)
|
||||
break;
|
||||
|
||||
//got a preprocessor symbol
|
||||
++x;
|
||||
while(x < buffer_len) {
|
||||
if (buffer[x] != ' ' && buffer[x] != '\t')
|
||||
break;
|
||||
++x;
|
||||
}
|
||||
// Got a preprocessor directive
|
||||
|
||||
int keyword_len = 0;
|
||||
const char *const keyword = buffer + x;
|
||||
|
Loading…
x
Reference in New Issue
Block a user