diff options
author | Tim Blechmann <tim@klingt.org> | 2022-05-05 10:09:00 +0800 |
---|---|---|
committer | Tim Blechmann <tim@klingt.org> | 2024-02-06 05:03:09 +0000 |
commit | 6b13e0ca593592b34ea34837335db0d5cefdf630 (patch) | |
tree | 6736f8819a6dec3dedcfcbf7515795c5fcff041e /src/gui/painting | |
parent | 9e73917537368d1904cc227da3332e970ad23752 (diff) |
core/gui: fix odr violation
When linking Qt statically, QtCore and QtGui are not separated into
different DSOs.
when both statically linked versions of QtCore and QtGui are linked into
the same binary with LTO, gcc emits:
```
/usr/src/debug/qtbase/6.3.0-r0/git/src/gui/painting/qicc.cpp:105:
warning: type ‘Tag’ violates the C++ One Definition Rule [-Wodr]
/usr/src/debug/qtbase/6.3.0-r0/git/src/corelib/kernel/qtranslator.cpp:78:
note: an enum with different value name is defined in another
translation unit
/usr/src/debug/qtbase/6.3.0-r0/git/src/gui/painting/qicc.cpp:106: note:
name ‘acsp’ differs from name ‘Tag_End’ defined in another translation
unit
/usr/src/debug/qtbase/6.3.0-r0/git/src/corelib/kernel/qtranslator.cpp:78:
note: mismatching definition
```
we therefore define the `struct Tag` in an anonymous namespace or the
QIcc namespace
Change-Id: Ib4edeede35c51322ab1959d70fb87359b196e59b
Pick-to: 6.5 6.6 6.7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qicc.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/painting/qicc.cpp b/src/gui/painting/qicc.cpp index 9d95c80bf8..77aae9ec49 100644 --- a/src/gui/painting/qicc.cpp +++ b/src/gui/painting/qicc.cpp @@ -20,6 +20,8 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcIcc, "qt.gui.icc", QtWarningMsg) +namespace QIcc { + struct ICCProfileHeader { quint32_be profileSize; @@ -104,7 +106,9 @@ enum class Tag : quint32 { aabg = IccTag('a', 'a', 'b', 'g'), }; -inline size_t qHash(const Tag &key, size_t seed = 0) +} // namespace QIcc + +inline size_t qHash(const QIcc::Tag &key, size_t seed = 0) { return qHash(quint32(key), seed); } |