diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-09-25 08:56:30 +0200 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-09-25 15:13:11 +0200 |
commit | fea3c9d69cad1a0408883bf5dc44670cc53fcbc2 (patch) | |
tree | f77e7223e00d2b58a59588c92c27bb5a014011cb | |
parent | d95ab8d3a3a102c00b69f0b0b49d7eb49e34051e (diff) |
Confine a hack to known-broken --enable-pch
The hack was introduced in 7db1150b2c4a9adb993084d2dceedb450781b1dc "fix macos
build with clang 16". (And for our --enable-pch for Clang being known-broken,
also see ffc1ab15ae358315516aab319778a254688afbd3 "Work around some Clang PCH
consteval issue by disabling HAVE_CPP_CONSTEVAL".)
Change-Id: I5dcd7f96ba39bf4d0748940778699cb7d368f449
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173891
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
-rw-r--r-- | config_host/config_options.h.in | 2 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | include/i18nlangtag/lang.h | 7 | ||||
-rw-r--r-- | include/o3tl/strong_int.hxx | 7 |
4 files changed, 15 insertions, 4 deletions
diff --git a/config_host/config_options.h.in b/config_host/config_options.h.in index e87f6e8db806..7339d48a47e5 100644 --- a/config_host/config_options.h.in +++ b/config_host/config_options.h.in @@ -9,6 +9,8 @@ #define ENABLE_MERGELIBS_MORE 0 +#define ENABLE_PCH 0 + #define ENABLE_RUNTIME_OPTIMIZATIONS 0 // Used to turn off visibility for some classes/symbols when linking with --enable-mergelibs diff --git a/configure.ac b/configure.ac index 32df06e53e70..459ce88b930e 100644 --- a/configure.ac +++ b/configure.ac @@ -6595,6 +6595,9 @@ else AC_MSG_ERROR([Unknown value for --enable-pch]) fi AC_SUBST(ENABLE_PCH) +if test -n "$ENABLE_PCH"; then + AC_DEFINE(ENABLE_PCH) +fi # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then AC_PATH_PROG([CCACHE_BIN],[ccache],[not found]) diff --git a/include/i18nlangtag/lang.h b/include/i18nlangtag/lang.h index 1bd03fb51c98..18d92a2a1038 100644 --- a/include/i18nlangtag/lang.h +++ b/include/i18nlangtag/lang.h @@ -80,6 +80,7 @@ http://support.microsoft.com/default.aspx?scid=KB;en-us;q221435 */ +#include <config_options.h> #include <sal/types.h> #include <o3tl/strong_int.hxx> #include <ostream> @@ -90,8 +91,10 @@ constexpr LanguageType primary(LanguageType lt) { return LanguageType(sal_uInt16 namespace o3tl { -// when compiling LO on macOS, debug builds will display a linking error -#if !(defined MACOSX && defined __clang__ && __clang_major__ == 16) +// when compiling LO on macOS, debug builds will display a linking error where, see +// <https://lists.freedesktop.org/archives/libreoffice/2024-February/091564.html>, "Our Clang +// --enable-pch setup is known broken": +#if !(defined MACOSX && defined __clang__ && __clang_major__ == 16 && ENABLE_PCH) // delete "sal_Int16" constructor via specialization: values > 0x7FFF are // actually used, and unfortunately passed around in the API as signed // "short", so use this to find all places where casts must be inserted diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx index aea775805bda..c0df5f75efc8 100644 --- a/include/o3tl/strong_int.hxx +++ b/include/o3tl/strong_int.hxx @@ -25,6 +25,7 @@ #include <cassert> #include <type_traits> #include <compare> +#include <config_options.h> namespace o3tl { @@ -84,8 +85,10 @@ template <typename UNDERLYING_TYPE, typename PHANTOM_TYPE> struct strong_int { public: -// when compiling LO on macOS, debug builds will display a linking error -#if defined MACOSX && defined __clang__ && __clang_major__ == 16 +// when compiling LO on macOS, debug builds will display a linking error where, see +// <https://lists.freedesktop.org/archives/libreoffice/2024-February/091564.html>, "Our Clang +// --enable-pch setup is known broken": +#if defined MACOSX && defined __clang__ && __clang_major__ == 16 && ENABLE_PCH explicit constexpr strong_int(unsigned long long value) : m_value(value) {} explicit constexpr strong_int(unsigned long value) : m_value(value) {} explicit constexpr strong_int(long value) : m_value(value) {} |