aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2019-09-17 14:14:04 +0200
committerChristian Tismer <tismer@stackless.com>2019-09-21 10:06:25 +0200
commit9c5950320814d6e0cfe7d6ebe9850ae49c18ae06 (patch)
tree30033b9dd57056d220145b8df71a8ceab167d502
parent68bcc8ec491edca74b2dc79ee9e0fa3450f0fe30 (diff)
Ignore deprecation warning about QSysInfo class
Amends 1bb4368a420ef12e3714bd4edfff34b8b3c983a8 . QSysInfo is deprecated and replaced by the QOperatingSystemVersion class which already exists. Before Qt 6.0 is out, we can not remove these classes. Fortunately, the warning can be suppressed by setting QT_WARNING_DISABLE_DEPRECATED. The options was already in the generated code, but the placement was too late. The qsysinfo include happens in the line // module include #include "pyside2_qtcore_python.h" which comes right after the first "usePySideExtensions" section. Furthermore, the used template in headergenerator.cpp needed the setting when the deprecated enum ocurred. The section after "// Macros for type check" got the setting, too, so that all calls to HeaderGenerator::writeSbkTypeFunction were excluded from warnings. Change-Id: Ife96f5ade26437b23cb756ee1b94af23d4a81faa Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp8
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp7
2 files changed, 11 insertions, 4 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index dd6c5ee9..a2b67b91 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -317,7 +317,10 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
s << "#include <pyside.h>" << endl;
s << "#include <destroylistener.h>" << endl;
s << "#include <qapp_macro.h>" << endl;
- }
+ s << endl;
+ s << "QT_WARNING_DISABLE_DEPRECATED" << endl;
+ s << endl;
+ }
s << "#include <typeinfo>" << endl;
if (usePySideExtensions() && metaClass->isQObject()) {
@@ -368,9 +371,6 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
if (metaClass->typeEntry()->typeFlags() & ComplexTypeEntry::Deprecated)
s << "#Deprecated" << endl;
- if (usePySideExtensions())
- s << "\nQT_WARNING_DISABLE_DEPRECATED\n";
-
// Use class base namespace
{
const AbstractMetaClass *context = metaClass->enclosingClass();
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index 8a2c5623..e47c3752 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -454,6 +454,11 @@ bool HeaderGenerator::finishGeneration()
// TODO-CONVERTER ------------------------------------------------------------------------------
macrosStream << "// Macros for type check" << endl;
+
+ if (usePySideExtensions()) {
+ typeFunctions << "QT_WARNING_PUSH" << endl;
+ typeFunctions << "QT_WARNING_DISABLE_DEPRECATED" << endl;
+ }
for (const AbstractMetaEnum *cppEnum : qAsConst(globalEnums)) {
if (cppEnum->isAnonymous() || cppEnum->isPrivate())
continue;
@@ -489,6 +494,8 @@ bool HeaderGenerator::finishGeneration()
includes << classType->include();
writeSbkTypeFunction(typeFunctions, metaType);
}
+ if (usePySideExtensions())
+ typeFunctions << "QT_WARNING_POP" << endl;
QString moduleHeaderFileName(outputDirectory()
+ QDir::separator() + subDirectoryForPackage(packageName())