Expand suppression of gcc's free-nonheap-object warning

Added a comment to the suppression, to make clear why it's justified.

Change-Id: Ibc8aea809a8e9467b3a194a142296ea6b79e1971
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b460d0bd809b10705d2658bfb62cb0d04835c015)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2024-10-21 19:05:07 +02:00 committed by Qt Cherry-pick Bot
parent 87b6540a08
commit 8196b4d380

View File

@ -4,7 +4,15 @@
#include "qglobal.h"
#if (defined(QT_STATIC) || defined(QT_BOOTSTRAPPED)) && defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1000
#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1000
/* gcc has complained about storing a pointer to a static QLocalePrivate in a
QSharedDataPointer, whose destructor would free the non-heap object if the
refcount ever got down to zero. The static instances this happens to are
instantiated with a refcount of 1 that never gets decremented so as long as
QSharedDataPointer keeps its incref()s and decref()s balanced it'll never get
down to zero - but the clever compiler isn't quite smart enough to figure
that out.
*/
QT_WARNING_DISABLE_GCC("-Wfree-nonheap-object") // false positive tracking
#endif