From c08ebbeca9f9e141287b4942b265a19cddef3253 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 25 Jan 2021 18:53:36 +0100 Subject: Fix compilation with 32-bit clang Currently fails with: undefined reference to `__mulodi4' Change-Id: Iefa321d6fd7cb989dd4a00166ed65e5b7f3ba33f Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/global/qnumeric.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qnumeric.h b/src/corelib/global/qnumeric.h index 63ba2bb378..49d795902c 100644 --- a/src/corelib/global/qnumeric.h +++ b/src/corelib/global/qnumeric.h @@ -114,9 +114,12 @@ Q_CORE_EXPORT quint64 qFloatDistance(double a, double b); // size_t. Implementations for 8- and 16-bit types will work but may not be as // efficient. Implementations for 64-bit may be missing on 32-bit platforms. -#if ((defined(Q_CC_INTEL) ? (Q_CC_INTEL >= 1800 && !defined(Q_OS_WIN)) : defined(Q_CC_GNU)) \ - && Q_CC_GNU >= 500) || __has_builtin(__builtin_add_overflow) +#if (((defined(Q_CC_INTEL) ? (Q_CC_INTEL >= 1800 && !defined(Q_OS_WIN)) : defined(Q_CC_GNU)) \ + && Q_CC_GNU >= 500) \ + || __has_builtin(__builtin_add_overflow)) \ + && !(QT_POINTER_SIZE == 4 && defined(Q_CC_CLANG)) // GCC 5, ICC 18, and Clang 3.8 have builtins to detect overflows +// 32 bit Clang has the builtins but tries to link a library which hasn't #define Q_INTRINSIC_MUL_OVERFLOW64 template inline -- cgit v1.2.3