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
d4242b8af3
.
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>
This commit is contained in:
parent
df663625af
commit
b41356658e
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user