aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-25 16:56:17 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-10-01 13:15:34 +0000
commitf5f9ad6b7af6ae85202e3107a94a0d762c0ee3f3 (patch)
tree11caca7ab8e5498a64a371e14a9f074a6f4cbc8e /sources/shiboken2/ApiExtractor
parent9d4aefc1f1d1fb4dfa76baa0d59e96d7193b88b4 (diff)
shiboken: Check whether enum should be converted to int for the protected hack
Find the AbstractMetaEnum belonging to the type entry and perform some checks. Generally do not use int for public enums. Warn when a protected scoped enum is encountered as this cannot be converted. Task-number: PYSIDE-817 Change-Id: I02b566093b331ea2ea627bf72964aad0a1a51c83 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor')
-rw-r--r--sources/shiboken2/ApiExtractor/messages.cpp9
-rw-r--r--sources/shiboken2/ApiExtractor/messages.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/messages.cpp b/sources/shiboken2/ApiExtractor/messages.cpp
index b81585933..fa4c75743 100644
--- a/sources/shiboken2/ApiExtractor/messages.cpp
+++ b/sources/shiboken2/ApiExtractor/messages.cpp
@@ -291,6 +291,15 @@ QString msgCannotOpenForWriting(const QFile &f)
.arg(QDir::toNativeSeparators(f.fileName()), f.errorString());
}
+// generator.cpp
+
+QString msgCannotUseEnumAsInt(const QString &name)
+{
+ return QLatin1String("Cannot convert the protected scoped enum \"") + name
+ + QLatin1String("\" to type int when generating wrappers for the protected hack. "
+ "Compilation errors may occur when used as a function argument.");
+}
+
// main.cpp
QString msgLeftOverArguments(const QMap<QString, QString> &remainingArgs)
diff --git a/sources/shiboken2/ApiExtractor/messages.h b/sources/shiboken2/ApiExtractor/messages.h
index cf6800b5d..539332aef 100644
--- a/sources/shiboken2/ApiExtractor/messages.h
+++ b/sources/shiboken2/ApiExtractor/messages.h
@@ -109,6 +109,8 @@ QString msgCannotOpenForReading(const QFile &f);
QString msgCannotOpenForWriting(const QFile &f);
+QString msgCannotUseEnumAsInt(const QString &name);
+
QString msgLeftOverArguments(const QMap<QString, QString> &remainingArgs);
QString msgInvalidVersion(const QString &package, const QString &version);