Hi,

We got below errors in Qt 5.13 using C++ QWidgets while running static code
analysis withKlocwork:

1)Address of a local variable is returned via return statement expression
'QStringBuilder<QStringBuilder<const char*,QString>,const char[2]>(a,
&b).b'.
2)Address of a local variable is returned via return statement expression
'QStringBuilder<QStringBuilder<const char*,QString>,const char[2]>(a, &b).b'
3)Address of a local variable is returned via return statement expression
'QStringBuilder<const char[2],QString>(&a, b).a'.

pointing to the below source @
https://github.com/qt/qtbase/blob/dev/src/corelib/text/qstringbuilder.h

template <typename A, typename B>
QStringBuilder<typename QConcatenable<A>::type, typename
QConcatenable<B>::type>
operator%(const A &a, const B &b)
{
   return QStringBuilder<typename QConcatenable<A>::type, typename
QConcatenable<B>::type>(a, b);
}

We are concatenating two QStrings using % which might lead to the above
errors:
For eg: eventString = eventString % eventState

Do you recommend to use QString(%1%2").arg( eventString ).arg( eventState )
instead to resolve above errors or ignore the Klocwork errors reported?

Another Klocwork error reported is

4)
https://github.com/radekp/qt/blob/master/src/corelib/tools/qsharedpointer_impl.h
 inline Basic(Qt::Initialization) { }
        // ~Basic();
'this->value' is not initialized in this constructor.
List of initiations may be incomplete.

Let me know if it makes sense to further analyze or ignore the errors
reported in Qt?

Best Regards,
Ramakanth
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to