summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-11-18 18:08:00 -0800
committerThiago Macieira <thiago.macieira@intel.com>2021-11-27 19:10:52 -0800
commitb41356658e522f8fbc1061c4f4c76f0ba17b6acd (patch)
tree2126d860698e5e605b236c19c28657bda9c4e053
parentdf663625afb8b8ed5ad54343471ea498a4a9680f (diff)
QLocale: suppress annoying GCC warning in the bootstrap lib
Happens on line: return QList<QLocale>() << QLocale(QLocale::C); QLocale's constructor taking the C "language" calls findLocalePrivate() that returns indeed the non-heap object c_locale in the c_private() function. But it also sets the refcount to 1, meaning it can never drop to 0 under proper refcounting and will thus never be deleted. Therefore, the compiler is wrong. I don't have time to figure out how to teach it that the deletion can never happen. I just want the warning to go away. It wsa probably introduced by commit d4242b8af3e6eb5e9f68e5ff2efee97de11da892. In destructor ‘QSharedDataPointer<T>::~QSharedDataPointer() [with T = QLocalePrivate]’, inlined from ‘QLocale::~QLocale()’ at /home/tjmaciei/src/qt/qt6/qtbase/src/corelib/text/qlocale.cpp:1035:1, inlined from ‘void QtPrivate::QMovableArrayOps<T>::emplace(qsizetype, Args&& ...) [with Args = {QLocale}; T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qarraydataops.h:829:5, inlined from ‘T& QList<T>::emplaceBack(Args&& ...) [with Args = {QLocale}; T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qlist.h:891:15, inlined from ‘void QList<T>::append(QList<T>::rvalue_ref) [with T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qlist.h:479:24, inlined from ‘QList<T>& QList<T>::operator<<(QList<T>::rvalue_ref) [with T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qlist.h:726:13, inlined from ‘static QList<QLocale> QLocale::matchingLocales(QLocale::Language, QLocale::Script, QLocale::Territory)’ at /home/tjmaciei/src/qt/qt6/qtbase/src/corelib/text/qlocale.cpp:2684:54: /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qshareddata.h:91:55: warning: ‘void operator delete(void*, std::size_t)’ called on unallocated object ‘c_locale’ [-Wfree-nonheap-object] 91 | ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; } | ^~~~~~~~ Pick-to: 6.2 Change-Id: Iccb47e5527544b6fbd75fffd16b8d078987b812b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/corelib/text/qlocale.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index 627b394127..45794cc703 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2019 Intel Corporation.
+** Copyright (C) 2021 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -40,6 +40,10 @@
#include "qglobal.h"
+#if (defined(QT_STATIC) || defined(QT_BOOTSTRAPPED)) && defined(Q_CC_GNU) && Q_CC_GNU >= 1000
+QT_WARNING_DISABLE_GCC("-Wfree-nonheap-object") // false positive tracking
+#endif
+
#if defined(Q_OS_MACOS)
# include "private/qcore_mac_p.h"
# include <CoreFoundation/CoreFoundation.h>