David Brooks - 2017-05-24

Using Xcode to build PythonQt produces a large number of warnings (over 2000). A few relate to signed/unsigned comparisons; a few to overloaded virtual functions being hidden; there is one where the logic needs to be clarified:

src/PythonQtSignalReceiver.cpp:234:22: warning: '&&' within '||' [-Wlogical-op-parentheses]
  if ((foundCount>0) && (sigId == _destroyedSignal1Id) || (sigId == _destroyedSignal2Id)) {

but the vast majority are about uninitialised return values from generated code. For example:

generated_cpp_56/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp:4057:9: warning: variable 'returnValue' is used uninitialized whenever 'if' condition is false
      [-Wsometimes-uninitialized]
    if (result) {
        ^~~~~~
generated_cpp_56/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp:4069:12: note: uninitialized use occurs here
    return returnValue;
           ^~~~~~~~~~~
generated_cpp_56/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp:4057:5: note: remove the 'if' if its condition is always true
    if (result) {
    ^~~~~~~~~~~~
generated_cpp_56/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp:4054:23: note: initialize the variable 'returnValue' to silence this warning
      bool returnValue;
                      ^
                       = false

Is this intended??

Looking at the sources I would expect returnValue to be initialised. I'm now wondering if something like this could be behind memory corruption issues I'm having.

Thanks.