Don't ignore first character after a string.
The parser in QMakeSourceFileInfo::findDeps() would step over the closing quote of a string, only to have a for loop then step over the character just after that closing quote, which was thus never studied; this could lead to problems in various ways. Fixed that and expanded findDeps() test to catch regressions. Task-number: QTBUG-17533 Change-Id: I7dec5222e38fa188495b39376ffee70bc7bbc87f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
parent
fda85b6d57
commit
8fd05e6289
@ -584,17 +584,14 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
|
||||
// buffer[x] is '"'
|
||||
} else {
|
||||
const char term = buffer[x];
|
||||
while (++x < buffer_len) {
|
||||
if (buffer[x] == term) {
|
||||
while (++x < buffer_len && buffer[x] != term) {
|
||||
if (buffer[x] == '\\')
|
||||
++x;
|
||||
break;
|
||||
} else if (buffer[x] == '\\') {
|
||||
++x;
|
||||
} else if (qmake_endOfLine(buffer[x])) {
|
||||
else if (qmake_endOfLine(buffer[x]))
|
||||
++line_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
// for loop's ++x shall step over the closing quote.
|
||||
}
|
||||
beginning = 0;
|
||||
}
|
||||
|
@ -35,6 +35,9 @@
|
||||
/ #include "needed.cpp"
|
||||
// if not ignored, symbol needed() won't be available ...
|
||||
|
||||
// Check we're not confused by string juxtaposition:
|
||||
static const char text[] = "lorem ""ipsum /*";
|
||||
|
||||
#include <moc_object1.cpp>
|
||||
/**/ #include <moc_object2.cpp>
|
||||
/**//**/ #include <moc_object3.cpp>
|
||||
|
Loading…
Reference in New Issue
Block a user