summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-18 10:45:48 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-30 16:44:38 +0000
commitd3e7101032aa8c870fe4eda8ea5abe5bbfe4712e (patch)
tree9972a88e0334a8b716b7cbadb46b947b92b5dd35 /tools
parent93b47fd1375bf76759fd38a720fc815a1c4a1f7b (diff)
dumpcpp: Fix MinGW compile error when declaring enums
For MinGW, add {} to make it syntactically valid C++. Task-number: QTCREATORBUG-22320 Change-Id: I6113fbe91e531ac2b6c087f6813b0608b56bc73b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/dumpcpp/main.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp
index 4601aef..eb6f70a 100644
--- a/tools/dumpcpp/main.cpp
+++ b/tools/dumpcpp/main.cpp
@@ -935,6 +935,19 @@ static QByteArrayList vTableOnlyStubsFromTypeLib(ITypeLib *typelib, const QStrin
return result;
}
+static void writeForwardDeclaration(QTextStream &declOut, const QByteArray &className)
+{
+ if (className.startsWith("enum ")) {
+ declOut << "#ifndef Q_CC_MINGW\n"
+ << " " << className << ';' << endl // Only MSVC accepts this
+ << "#else\n"
+ << " " << className << " {};" << endl
+ << "#endif\n";
+ } else {
+ declOut << " " << className << ';' << endl;
+ }
+}
+
bool generateTypeLibrary(QString typeLibFile, QString outname,
const QString &nameSpace, ObjectCategories category)
{
@@ -1116,7 +1129,7 @@ bool generateTypeLibrary(QString typeLibFile, QString outname,
for (int c = 0; c < classList.count(); ++c) {
QByteArray className = classList.at(c);
if (className.contains(' ')) {
- declOut << " " << className << ';' << endl;
+ writeForwardDeclaration(declOut, className);
namespaceForType.insert(className.mid(className.indexOf(' ') + 1), nspace);
} else {
declOut << " class " << className << ';' << endl;