[Development] warning about variable used uninitialised in qdeclarativeenginedebugservice

René J.V. Bertin rjvbertin at gmail.com
Sun Jul 19 23:10:46 CEST 2015


Hi,

Building Qt 4.8.7, I stumbled upon the clang warning below :

debugger/qdeclarativeenginedebugservice.cpp:523:13: warning: variable 'line' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (!ds.atEnd()) { // backward compatibility from 2.1, 2.2
            ^~~~~~~~~~~
debugger/qdeclarativeenginedebugservice.cpp:526:76: note: uninitialized use occurs here
        setBinding(objectId, propertyName, expr, isLiteralValue, filename, line);
                                                                           ^~~~
debugger/qdeclarativeenginedebugservice.cpp:523:9: note: remove the 'if' if its condition is always true
        if (!ds.atEnd()) { // backward compatibility from 2.1, 2.2
        ^~~~~~~~~~~~~~~~~
debugger/qdeclarativeenginedebugservice.cpp:521:17: note: initialize the variable 'line' to silence this warning
        int line;
                ^
                 = 0

I haven't tried to check if there's any danger to using `line` without initialising it first in this context; should I file a bug report?

R.



More information about the Development mailing list