QFreeList: Resolve symbol ambiguity in unity build

Remove 'qfreelist.cpp' from the NO_UNITY_BUILD_SOURCES section
and fix the underlying problem of the clashing symbols with
'qabstracteventdispatcher.cpp', by wrapping the unnamed enum in
a namespace.

Amends: a07426d23a.

Task-number: QTBUG-109394
Pick-to: 6.6 6.5
Change-Id: I585ab06a33d46a11a48220f504c53a5f4fa91d7e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
bb10
Dennis Oberst 2023-07-31 12:12:36 +02:00
parent 592494e2e5
commit da5f2fc6be
2 changed files with 6 additions and 5 deletions

View File

@ -310,7 +310,6 @@ qt_internal_add_module(Core
tools/qvector.h
tools/qversionnumber.cpp tools/qversionnumber.h
NO_UNITY_BUILD_SOURCES
tools/qfreelist.cpp # Size0/Offset0 (also in qabstracteventdispatcher.cpp)
# MinGW complains about `free-nonheap-object` in ~QSharedDataPointer()
# despite the fact that appropriate checks are in place to avoid that!
tools/qshareddata.cpp tools/qshareddata.h

View File

@ -6,6 +6,7 @@
QT_BEGIN_NAMESPACE
// default sizes and offsets (no need to define these when customizing)
namespace QFreeListDefaultConstantsPrivate {
enum {
Offset0 = 0x00000000,
Offset1 = 0x00008000,
@ -17,12 +18,13 @@ enum {
Size2 = Offset3 - Offset2,
Size3 = QFreeListDefaultConstants::MaxIndex - Offset3
};
}
Q_CONSTINIT const int QFreeListDefaultConstants::Sizes[QFreeListDefaultConstants::BlockCount] = {
Size0,
Size1,
Size2,
Size3
QFreeListDefaultConstantsPrivate::Size0,
QFreeListDefaultConstantsPrivate::Size1,
QFreeListDefaultConstantsPrivate::Size2,
QFreeListDefaultConstantsPrivate::Size3
};
QT_END_NAMESPACE