summaryrefslogtreecommitdiffstats
path: root/cmake/modulecppexports.h.in
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-12-15 17:45:56 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-12-16 17:21:56 +0000
commit8602a224b6ade5680329270d8d573b786a7a81a1 (patch)
tree15ce626bb63d17379115d2b55447cdb04ef5610e /cmake/modulecppexports.h.in
parent8e5806b6807df0d39f3bbd2a1c0ed590426e1aa0 (diff)
QT_INLINE_SINCE: never inline for static Qt builds
Static Qt builds are not covered by BC guarantees, but since all 'libraries' are linked into a single executable, we face in all users of the library the same ODR violation that we faced within the implementation DLL: we can't define the same symbol as inline in some TUs and out-of-line in others. In the past, we decided to always inline in static builds, but that breaks users which, by Hyrum's Law, have come to depend on the non-existent BC guarantees for static Qt builds. By switching to never inline¹ in static builds, we restore BC for such users. The performance issues should be minimal, since LTO will anyway inline whatever it wants, independent on how it was declared. ¹ except when the deprecation point has passed over the Qt version the API was inlined (-disable-deprecated-up-to configure switch). [ChangeLog][QtCore] Restored binary compatibility for static Qt builds broken by the QT_INLINE_SINCE mechanism. Qt still does not guarantee BC for static build configurations otherwise. Fixes: QTBUG-109449 Pick-to: 6.5 6.4 Change-Id: Ie3fa62621b74dc5e9dac301b9882c0e3c3999eaf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'cmake/modulecppexports.h.in')
-rw-r--r--cmake/modulecppexports.h.in3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmake/modulecppexports.h.in b/cmake/modulecppexports.h.in
index 725d9d79f1..a7a349084e 100644
--- a/cmake/modulecppexports.h.in
+++ b/cmake/modulecppexports.h.in
@@ -16,8 +16,9 @@
# define Q_@module_define_infix@_EXPORT
#endif
-#if !defined(QT_BUILD_@module_define_infix@_LIB) || defined(QT_STATIC)
+#if !defined(QT_BUILD_@module_define_infix@_LIB) && !defined(QT_STATIC)
/* outside library → inline decl + defi */
+/* static builds treat everything as part of the library, so they never inline */
# define QT_@module_define_infix@_INLINE_SINCE(major, minor) inline
# define QT_@module_define_infix@_INLINE_IMPL_SINCE(major, minor) 1
#elif defined(QT_@module_define_infix@_BUILD_REMOVED_API)