diff options
author | Christian Tismer <tismer@stackless.com> | 2021-04-11 14:32:09 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2021-04-12 14:00:43 +0200 |
commit | 59f92c2133ad1d43ba2f6a7a32c5b70fc6aba614 (patch) | |
tree | 0835d75b75f357ec682c39ca0ab1ba177f22145e /sources | |
parent | 416ccd7516ea4f4a5b8419c2fd7de0346c334df1 (diff) |
shiboken: get rid of some warnings
A few warnings are from
libshiboken: Fix some clang analzyer warnings
where const_cast is still needed in Python 3.
Thanks for helping with
auto writeConversionRegister = [this, &s](const AbstractMetaType &sourceType, const QString &targetTypeName, const QString &targetConverter)
Change-Id: I487c9a5234dd1378c3a834076dd3bb204bb76cb8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources')
6 files changed, 44 insertions, 40 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp index 02a66b40e..7631916fb 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp @@ -95,7 +95,7 @@ static bool runProcess(const QString &program, const QStringList &arguments, static QByteArray frameworkPath() { return QByteArrayLiteral(" (framework directory)"); } -#if defined(Q_OS_MACOS) +# if defined(Q_OS_MACOS) static void filterHomebrewHeaderPaths(HeaderPaths &headerPaths) { QByteArray homebrewPrefix = qgetenv("HOMEBREW_OPT"); @@ -123,7 +123,7 @@ static void filterHomebrewHeaderPaths(HeaderPaths &headerPaths) } } } -#endif +# endif // Determine g++'s internal include paths from the output of // g++ -E -x c++ - -v </dev/null @@ -161,9 +161,9 @@ static HeaderPaths gppInternalIncludePaths(const QString &compiler) } } -#if defined(Q_OS_MACOS) +# if defined(Q_OS_MACOS) filterHomebrewHeaderPaths(result); -#endif +# endif return result; } #endif // Q_CC_MSVC @@ -300,7 +300,7 @@ static QString compilerFromCMake(const QString &defaultCompiler) { // Added !defined(Q_OS_DARWIN) due to PYSIDE-1032 # if defined(CMAKE_CXX_COMPILER) && !defined(Q_OS_DARWIN) - Q_UNUSED(defaultCompiler) + Q_UNUSED(defaultCompiler); return QString::fromLocal8Bit(CMAKE_CXX_COMPILER); # else return defaultCompiler; @@ -329,6 +329,11 @@ static void appendClangBuiltinIncludes(HeaderPaths *p) // Returns clang options needed for emulating the host compiler QByteArrayList emulatedCompilerOptions() { +#if defined(Q_CC_GNU) + // Needed to silence a warning, but needsGppInternalHeaders is used below. + // This seems to be a compiler bug on macOS. + Q_UNUSED(needsGppInternalHeaders); +#endif QByteArrayList result; #if defined(Q_CC_MSVC) HeaderPaths headerPaths; diff --git a/sources/shiboken6/ApiExtractor/typesystemparser.cpp b/sources/shiboken6/ApiExtractor/typesystemparser.cpp index c1780ac89..1436e739a 100644 --- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp +++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp @@ -82,7 +82,6 @@ static inline QString indexAttribute() { return QStringLiteral("index"); } static inline QString invalidateAfterUseAttribute() { return QStringLiteral("invalidate-after-use"); } static inline QString locationAttribute() { return QStringLiteral("location"); } static inline QString modifiedTypeAttribute() { return QStringLiteral("modified-type"); } -static inline QString modifierAttribute() { return QStringLiteral("modifier"); } static inline QString overloadNumberAttribute() { return QStringLiteral("overload-number"); } static inline QString ownershipAttribute() { return QStringLiteral("owner"); } static inline QString packageAttribute() { return QStringLiteral("package"); } diff --git a/sources/shiboken6/libshiboken/basewrapper.cpp b/sources/shiboken6/libshiboken/basewrapper.cpp index 91bd9cd2e..d33ec63e0 100644 --- a/sources/shiboken6/libshiboken/basewrapper.cpp +++ b/sources/shiboken6/libshiboken/basewrapper.cpp @@ -135,12 +135,12 @@ type_set_doc(PyTypeObject *type, PyObject *value, void *context) // explicitly pass __doc__. For __signature__ it _did_ actually work, because // it was not existing before. We add them both for clarity. static PyGetSetDef SbkObjectType_Type_getsetlist[] = { - {"__signature__", reinterpret_cast<getter>(Sbk_TypeGet___signature__), - nullptr, nullptr, nullptr}, - {"__doc__", reinterpret_cast<getter>(Sbk_TypeGet___doc__), - reinterpret_cast<setter>(type_set_doc), nullptr, nullptr}, - {"__dict__", reinterpret_cast<getter>(Sbk_TypeGet___dict__), - nullptr, nullptr, nullptr}, + {const_cast<char *>("__signature__"), reinterpret_cast<getter>(Sbk_TypeGet___signature__), + nullptr, nullptr, nullptr}, + {const_cast<char *>("__doc__"), reinterpret_cast<getter>(Sbk_TypeGet___doc__), + reinterpret_cast<setter>(type_set_doc), nullptr, nullptr}, + {const_cast<char *>("__dict__"), reinterpret_cast<getter>(Sbk_TypeGet___dict__), + nullptr, nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} // Sentinel }; @@ -191,7 +191,7 @@ static PyObject *SbkObjectGetDict(PyObject *pObj, void *) } static PyGetSetDef SbkObjectGetSetList[] = { - {"__dict__", SbkObjectGetDict, nullptr, nullptr, nullptr}, + {const_cast<char *>("__dict__"), SbkObjectGetDict, nullptr, nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} // Sentinel }; diff --git a/sources/shiboken6/libshiboken/sbkenum.cpp b/sources/shiboken6/libshiboken/sbkenum.cpp index c9243d652..a3d17ea2e 100644 --- a/sources/shiboken6/libshiboken/sbkenum.cpp +++ b/sources/shiboken6/libshiboken/sbkenum.cpp @@ -261,7 +261,7 @@ static Py_hash_t enum_hash(PyObject *pyObj) } static PyGetSetDef SbkEnumGetSetList[] = { - {"name", SbkEnumObject_name, nullptr, nullptr, nullptr}, + {const_cast<char *>("name"), SbkEnumObject_name, nullptr, nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} // Sentinel }; diff --git a/sources/shiboken6/libshiboken/signature/signature_extend.cpp b/sources/shiboken6/libshiboken/signature/signature_extend.cpp index 1c50c0d72..43a78ed21 100644 --- a/sources/shiboken6/libshiboken/signature/signature_extend.cpp +++ b/sources/shiboken6/libshiboken/signature/signature_extend.cpp @@ -222,47 +222,47 @@ static int pyside_set___signature__(PyObject *op, PyObject *value) } static PyGetSetDef new_PyCFunction_getsets[] = { - {"__doc__", reinterpret_cast<getter>(pyside_cf_get___doc__), - nullptr, nullptr, nullptr}, - {"__signature__", reinterpret_cast<getter>(pyside_cf_get___signature__), - reinterpret_cast<setter>(pyside_set___signature__), - nullptr, nullptr}, + {const_cast<char *>("__doc__"), reinterpret_cast<getter>(pyside_cf_get___doc__), + nullptr, nullptr, nullptr}, + {const_cast<char *>("__signature__"), reinterpret_cast<getter>(pyside_cf_get___signature__), + reinterpret_cast<setter>(pyside_set___signature__), + nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} }; static PyGetSetDef new_PyStaticMethod_getsets[] = { - {"__doc__", reinterpret_cast<getter>(pyside_sm_get___doc__), - nullptr, nullptr, nullptr}, - {"__signature__", reinterpret_cast<getter>(pyside_sm_get___signature__), - reinterpret_cast<setter>(pyside_set___signature__), - nullptr, nullptr}, + {const_cast<char *>("__doc__"), reinterpret_cast<getter>(pyside_sm_get___doc__), + nullptr, nullptr, nullptr}, + {const_cast<char *>("__signature__"), reinterpret_cast<getter>(pyside_sm_get___signature__), + reinterpret_cast<setter>(pyside_set___signature__), + nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} }; static PyGetSetDef new_PyMethodDescr_getsets[] = { - {"__doc__", reinterpret_cast<getter>(pyside_md_get___doc__), - nullptr, nullptr, nullptr}, - {"__signature__", reinterpret_cast<getter>(pyside_md_get___signature__), - reinterpret_cast<setter>(pyside_set___signature__), - nullptr, nullptr}, + {const_cast<char *>("__doc__"), reinterpret_cast<getter>(pyside_md_get___doc__), + nullptr, nullptr, nullptr}, + {const_cast<char *>("__signature__"), reinterpret_cast<getter>(pyside_md_get___signature__), + reinterpret_cast<setter>(pyside_set___signature__), + nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} }; static PyGetSetDef new_PyType_getsets[] = { - {"__doc__", reinterpret_cast<getter>(pyside_tp_get___doc__), - nullptr, nullptr, nullptr}, - {"__signature__", reinterpret_cast<getter>(pyside_tp_get___signature__), - reinterpret_cast<setter>(pyside_set___signature__), - nullptr, nullptr}, + {const_cast<char *>("__doc__"), reinterpret_cast<getter>(pyside_tp_get___doc__), + nullptr, nullptr, nullptr}, + {const_cast<char *>("__signature__"), reinterpret_cast<getter>(pyside_tp_get___signature__), + reinterpret_cast<setter>(pyside_set___signature__), + nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} }; static PyGetSetDef new_PyWrapperDescr_getsets[] = { - {"__doc__", reinterpret_cast<getter>(pyside_wd_get___doc__), - nullptr, nullptr, nullptr}, - {"__signature__", reinterpret_cast<getter>(pyside_wd_get___signature__), - reinterpret_cast<setter>(pyside_set___signature__), - nullptr, nullptr}, + {const_cast<char *>("__doc__"), reinterpret_cast<getter>(pyside_wd_get___doc__), + nullptr, nullptr, nullptr}, + {const_cast<char *>("__signature__"), reinterpret_cast<getter>(pyside_wd_get___signature__), + reinterpret_cast<setter>(pyside_set___signature__), + nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} }; diff --git a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.h b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.h index 083ebb091..dffbd86c0 100644 --- a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.h +++ b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.h @@ -39,7 +39,7 @@ class QtXmlToSphinxTest : public QObject, public QtXmlToSphinxDocGeneratorInterf public: // QtXmlToSphinxDocGeneratorInterface QString expandFunction(const QString &) const override; - QString expandClass(const QString &, const QString &) const; + QString expandClass(const QString &, const QString &) const override; QString resolveContextForMethod(const QString &, const QString &) const override; const QLoggingCategory &loggingCategory() const override; |