Skip to content
Snippets Groups Projects
Commit 1e7010fc authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Fix clang warnings

parent a6b1039b
No related branches found
No related tags found
No related merge requests found
......@@ -145,19 +145,28 @@ bool AlgorithmAdapter<BaseAlgorithm>::isRunning() const {
return SuperClass::isRunning();
} else {
Environment::GlobalInterpreterLock gil;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality"
#endif
PyObject *result = PyObject_CallObject(m_isRunningObj, nullptr);
if (PyErr_Occurred())
throw Environment::PythonException();
if (PyBool_Check(result)) {
#if PY_MAJOR_VERSION >= 3
return static_cast<bool>(PyLong_AsLong(result));
#else
return static_cast<bool>(PyInt_AsLong(result));
#endif
} else
throw std::runtime_error(
"Algorithm.isRunning - Expected bool return type.");
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}
/**
......
......@@ -186,6 +186,10 @@ const std::string PropertyWithValueFactory::isArray(PyObject *const object) {
PyObject *item = PySequence_Fast_GET_ITEM(object, 0);
// Boolean can be cast to int, so check first.
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality"
#endif
if (PyBool_Check(item)) {
throw std::runtime_error(
"Unable to support extracting arrays of booleans.");
......@@ -193,6 +197,10 @@ const std::string PropertyWithValueFactory::isArray(PyObject *const object) {
if (PyLong_Check(item)) {
return std::string("LongIntArray");
}
#if __clang__
#pragma clang diagnostic pop
#endif
#if PY_MAJOR_VERSION < 3
// In python 2 ints & longs are separate
if (PyInt_Check(item)) {
......
......@@ -539,7 +539,14 @@ QVariant PythonScript::evaluateImpl() {
}
}
/* bool */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality"
#endif
else if (PyBool_Check(pyret)) {
#ifdef __clang__
#pragma clang diagnostic pop
#endif
qret = QVariant(pyret == Py_True);
}
// could handle advanced types (such as PyList->QValueList) here if needed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment