diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-02-01 14:31:55 -0200 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-02-10 03:21:08 +0000 |
commit | d6ce94ae6367337ade2c590f182b973e2bcfa98c (patch) | |
tree | 793b95b65fb7a8230835d7638092f3ef1e756e27 /src/3rdparty/harfbuzz-ng/src | |
parent | e024eb55c6eb4582ce22aadec440ada3c9deaab9 (diff) |
Force Harfbuzz-NG to use the Qt atomics when built inside Qt
For most cases, the GCC/Intel atomics (__sync functions) are fine, but
there are some systems for which libgcc is incorrectly built (QNX
6.5.0). Additionally, this will allow Harfbuzz-NG to be supported in
exactly the same systems as Qt itself.
Task-number: QTBUG-43850
Change-Id: Ib53f57f70d4ad46863c45e74d60b0eb45ba9bd02
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh index 60cbcf91be..f15ef09799 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh +++ b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh @@ -41,6 +41,25 @@ #if 0 +#elif !defined(HB_NO_MT) && defined(HAVE_QT5_ATOMICS) +#include <QtCore/qatomic.h> + +QT_USE_NAMESPACE + +namespace { +// We need to cast hb_atomic_int_t to QAtomicInt and pointers to +// QAtomicPointer instead of using QAtomicOps, otherwise we get a failed +// overload resolution of the template arguments for testAndSetOrdered. +template <typename T> QAtomicPointer<T> *makeAtomicPointer(T * const &ptr) +{ + return reinterpret_cast<QAtomicPointer<T> *>(const_cast<T **>(&ptr)); +} +} + +typedef int hb_atomic_int_t; +#define hb_atomic_int_add(AI, V) reinterpret_cast<QAtomicInt &>(AI).fetchAndAddOrdered(V) +#define hb_atomic_ptr_get(P) makeAtomicPointer(*P)->loadAcquire() +#define hb_atomic_ptr_cmpexch(P,O,N) makeAtomicPointer(*P)->testAndSetOrdered((O), (N)) #elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__)) |