From e024eb55c6eb4582ce22aadec440ada3c9deaab9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 9 Feb 2015 12:37:12 -0800 Subject: Remove #define inline from Harfbuzz-NG This code is C++ only. There isn't a single C++ compiler that fails to understand the "inline" keyword, since it's required by C++98. Any compiler older than C++98 is likely to choke on the template usage further down, so this isn't necessary. Moreover, the C++ standard says you cannot define macros. [lib.macro.names] says "Nor shall such a translation unit define macros for names lexically identical to keywords." -- technically, it's a promise that the Standard Library headers won't do it, the wording means that the entire translation unit won't do it, which implies no source can do it. MSVC complains about it: fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro. Change-Id: Ic2a0a03a0af47386e34bb698454a2040ef3f6a9d Reviewed-by: Simon Hausmann Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/3rdparty/harfbuzz-ng/src/hb-private.hh | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/3rdparty') diff --git a/src/3rdparty/harfbuzz-ng/src/hb-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-private.hh index 3f70d74c26..3a4cf611f0 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-private.hh +++ b/src/3rdparty/harfbuzz-ng/src/hb-private.hh @@ -98,16 +98,6 @@ #define snprintf _snprintf #endif -#ifdef _MSC_VER -#undef inline -#define inline __inline -#endif - -#ifdef __STRICT_ANSI__ -#undef inline -#define inline __inline__ -#endif - #if __GNUC__ >= 3 #define HB_FUNC __PRETTY_FUNCTION__ #elif defined(_MSC_VER) -- cgit v1.2.3 From d6ce94ae6367337ade2c590f182b973e2bcfa98c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 1 Feb 2015 14:31:55 -0200 Subject: 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 Reviewed-by: Marc Mutz --- src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 4 ++-- src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src/3rdparty') diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index 6b51d9679a..a8885d71df 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -7,14 +7,14 @@ CONFIG += \ load(qt_helper_lib) -DEFINES += HAVE_OT HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED +DEFINES += HAVE_OT HAVE_QT5_ATOMICS HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED # platform/compiler specific definitions DEFINES += HAVE_ATEXIT -gcc: DEFINES += HAVE_INTEL_ATOMIC_PRIMITIVES unix: DEFINES += HAVE_PTHREAD HAVE_SCHED_H HAVE_SCHED_YIELD INCLUDEPATH += $$PWD/include +INCLUDEPATH += $$OUT_PWD/../../../include SOURCES += \ $$PWD/src/hb-blob.cc \ 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 + +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 QAtomicPointer *makeAtomicPointer(T * const &ptr) +{ + return reinterpret_cast *>(const_cast(&ptr)); +} +} + +typedef int hb_atomic_int_t; +#define hb_atomic_int_add(AI, V) reinterpret_cast(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__)) -- cgit v1.2.3 From 69196b38c481610ef30bfe8ce8e7ba6826729ab8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 16 Feb 2015 15:31:58 +0100 Subject: fix non-git shadow builds the qt headers live in the source dir in this configuration. instead of hard-coding the path in the project file, use the correct module variable. this requires harfbuzz-ng to be built after corelib. Change-Id: If1b64b59a0939d3b5190331fcf70da566d4eeedd Reviewed-by: Thiago Macieira --- src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/3rdparty') diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index a8885d71df..300b22ec57 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -14,7 +14,7 @@ DEFINES += HAVE_ATEXIT unix: DEFINES += HAVE_PTHREAD HAVE_SCHED_H HAVE_SCHED_YIELD INCLUDEPATH += $$PWD/include -INCLUDEPATH += $$OUT_PWD/../../../include +INCLUDEPATH += $$QT.core.includes SOURCES += \ $$PWD/src/hb-blob.cc \ -- cgit v1.2.3