Moc: Don't error out when parsing namespace __identifier(...)

Present for example in the Windows's Atlbase.h header.
We should not abort the compilation, just ignore that construct

Task-number: QTBUG-56634
Change-Id: Id6e4c9f03cb1cef46e330f4fbcae80ce4f3730c6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Olivier Goffart 2017-06-14 08:28:40 +02:00 committed by Olivier Goffart (Woboq GmbH)
parent 56a29f0e91
commit a232251992
2 changed files with 7 additions and 0 deletions

View File

@ -559,6 +559,9 @@ void Moc::parse()
if (test(EQ)) {
// namespace Foo = Bar::Baz;
until(SEMIC);
} else if (test(LPAREN)) {
// Ignore invalid code such as: 'namespace __identifier("x")' (QTBUG-56634)
until(RPAREN);
} else if (!test(SEMIC)) {
NamespaceDef def;
def.classname = nsName;

View File

@ -74,4 +74,8 @@ namespace FooNamespace {
}
}
#ifdef Q_MOC_RUN
namespace __identifier("<AtlImplementationDetails>") {} // QTBUG-56634
#endif
#endif // NAMESPACE_H