summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-06-14 08:28:40 +0200
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2017-06-19 07:32:18 +0000
commita2322519929bd36a90422dccc0310b8230729197 (patch)
tree107850a87d9f69824a47ac7241bf7342bfa33be3
parent56a29f0e91fc48c5eb9062e81a2b45ecc6082cc2 (diff)
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>
-rw-r--r--src/tools/moc/moc.cpp3
-rw-r--r--tests/auto/tools/moc/namespace.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 36d84a61d8..4d3ccb8680 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -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;
diff --git a/tests/auto/tools/moc/namespace.h b/tests/auto/tools/moc/namespace.h
index 6e04831589..43d00e82f3 100644
--- a/tests/auto/tools/moc/namespace.h
+++ b/tests/auto/tools/moc/namespace.h
@@ -74,4 +74,8 @@ namespace FooNamespace {
}
}
+#ifdef Q_MOC_RUN
+namespace __identifier("<AtlImplementationDetails>") {} // QTBUG-56634
+#endif
+
#endif // NAMESPACE_H