Confine a hack to known-broken --enable-pch

The hack was introduced in 7db1150b2c "fix macos
build with clang 16".  (And for our --enable-pch for Clang being known-broken,
also see ffc1ab15ae "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
This commit is contained in:
Stephan Bergmann 2024-09-25 08:56:30 +02:00
parent d95ab8d3a3
commit fea3c9d69c
4 changed files with 15 additions and 4 deletions

View file

@ -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

View file

@ -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])

View file

@ -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

View file

@ -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) {}