aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-19 11:51:45 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-19 12:24:56 +0200
commita4bc4121ef3ae3a8d863618200c4787bfd4d64a9 (patch)
tree3a980d77e4c787b867931e1054ed0c6150d9d023
parent8d65e9c3e451d9ad3a715dacdb2b415bc2dca8a3 (diff)
shiboken: Add a cast to Py_hash_t in the hash function generator
Task-number: PYSIDE-904 Change-Id: I95449299f7e6f5b798b77e51aa63a2fb609bd443 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 28c7bf320..cf9d4508f 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -6052,10 +6052,13 @@ void CppGenerator::writeReturnValueHeuristics(QTextStream &s, const AbstractMeta
void CppGenerator::writeHashFunction(QTextStream &s, const GeneratorContext &context)
{
const AbstractMetaClass *metaClass = context.metaClass();
- s << "static Py_hash_t " << cpythonBaseName(metaClass) << "_HashFunc(PyObject *self) {\n";
+ const char hashType[] = "Py_hash_t";
+ s << "static " << hashType << ' ' << cpythonBaseName(metaClass)
+ << "_HashFunc(PyObject *self) {\n";
writeCppSelfDefinition(s, context);
- s << INDENT << "return " << metaClass->typeEntry()->hashFunction() << '(';
- s << (isObjectType(metaClass) ? "" : "*") << CPP_SELF_VAR << ");\n";
+ s << INDENT << "return " << hashType << '('
+ << metaClass->typeEntry()->hashFunction() << '('
+ << (isObjectType(metaClass) ? "" : "*") << CPP_SELF_VAR << "));\n";
s<< "}\n\n";
}