appveyor.yml | 3 ++- src/hb-atomic-private.hh | 27 ++++++++++++++++++++++++--- src/hb-open-type-private.hh | 2 +- src/hb-ot-shape-complex-arabic.cc | 2 +- 4 files changed, 28 insertions(+), 6 deletions(-)
New commits: commit 804b59cf4901d471253016e0cbf82cc1bbbc1d15 Author: Behdad Esfahbod <[email protected]> Date: Mon Jul 16 15:44:58 2018 +0200 Relax C++11 atomic ops memory order to acquire-release diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index f234fe04..14960026 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -53,14 +53,14 @@ #include <atomic> typedef int hb_atomic_int_impl_t; -#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<int> *> (&AI)->fetch_add (V)) +#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<int> *> (&AI)->fetch_add (V, std::memory_order_acq_rel)) -#define hb_atomic_ptr_impl_get(P) (reinterpret_cast<std::atomic<void*> *> (P)->load ()) +#define hb_atomic_ptr_impl_get(P) (reinterpret_cast<std::atomic<void*> *> (P)->load (std::memory_order_acquire)) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { const void *O = O_; // Need lvalue - return reinterpret_cast<std::atomic<const void*> *> (P)->compare_exchange_weak ((O), (N)); + return reinterpret_cast<std::atomic<const void*> *> (P)->compare_exchange_weak ((O), (N), std::memory_order_acq_rel); } #define hb_atomic_ptr_impl_cmpexch(P,O,N) (_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N))) commit bda242409fc0cbb79a0ff00eba9856c4b0a9c7a1 Author: Behdad Esfahbod <[email protected]> Date: Mon Jul 16 15:41:09 2018 +0200 Implement C++11 <atomic> operations Fixes https://github.com/harfbuzz/harfbuzz/issues/345 diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index 12caacaa..f234fe04 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -46,6 +46,25 @@ /* Defined externally, i.e. in config.h; must have typedef'ed hb_atomic_int_impl_t as well. */ +#elif !defined(HB_NO_MT) && __cplusplus >= 201103L + +/* Prefer C++11 atomics. */ + +#include <atomic> + +typedef int hb_atomic_int_impl_t; +#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<int> *> (&AI)->fetch_add (V)) + +#define hb_atomic_ptr_impl_get(P) (reinterpret_cast<std::atomic<void*> *> (P)->load ()) +static inline bool +_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) +{ + const void *O = O_; // Need lvalue + return reinterpret_cast<std::atomic<const void*> *> (P)->compare_exchange_weak ((O), (N)); +} +#define hb_atomic_ptr_impl_cmpexch(P,O,N) (_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N))) + + #elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__)) #include <windows.h> @@ -162,16 +181,18 @@ typedef int hb_atomic_int_impl_t; #endif +#ifndef HB_ATOMIC_INT_INIT #define HB_ATOMIC_INT_INIT(V) {V} +#endif struct hb_atomic_int_t { - hb_atomic_int_impl_t v; + mutable hb_atomic_int_impl_t v; inline void set_unsafe (int v_) { v = v_; } inline int get_unsafe (void) const { return v; } - inline int inc (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_int_impl_t &> (v), 1); } - inline int dec (void) { return hb_atomic_int_impl_add (const_cast<hb_atomic_int_impl_t &> (v), -1); } + inline int inc (void) { return hb_atomic_int_impl_add (v, 1); } + inline int dec (void) { return hb_atomic_int_impl_add (v, -1); } }; diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 207f6e0e..f6113c33 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -1247,7 +1247,7 @@ struct hb_lazy_loader_t private: hb_face_t *face; - T *instance; + mutable T *instance; }; /* Logic is shared between hb_lazy_loader_t and hb_table_lazy_loader_t */ diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index b1cba1c7..0c4948df 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -250,7 +250,7 @@ struct arabic_shape_plan_t * mask_array[NONE] == 0. */ hb_mask_t mask_array[ARABIC_NUM_FEATURES + 1]; - arabic_fallback_plan_t *fallback_plan; + mutable arabic_fallback_plan_t *fallback_plan; unsigned int do_fallback : 1; unsigned int has_stch : 1; commit 524411224054b23bab4adad7343314df45c9c183 Merge: 2aae617a 269eb456 Author: Cosimo Lupo <[email protected]> Date: Mon Jul 16 14:42:43 2018 +0200 Merge pull request #1094 from anthrotype/fix-appveyor-msys2 appveyor.yml: try updating msys2 to fix failing mingw-w64-x86_64 build commit 269eb45650be66901627da7f1014339065a948a5 Author: Cosimo Lupo <[email protected]> Date: Mon Jul 16 14:14:42 2018 +0200 appveyor.yml: try only updating msys2 core, not the rest of the packages maybe it'll get a bit faster diff --git a/appveyor.yml b/appveyor.yml index 9b00d84d..6250a91e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -30,7 +30,6 @@ environment: install: - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman -Syu --noconfirm"' - - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman -Su --noconfirm"' - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-ragel" build_script: commit 3ab52c6cb5c405366af804d278216e2d02a39ecb Author: Cosimo Lupo <[email protected]> Date: Mon Jul 16 12:57:27 2018 +0200 appveyor.yml: pass --needed option to pacman so it won't attempt reinstalling packages which are already installed diff --git a/appveyor.yml b/appveyor.yml index 91316e66..9b00d84d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -45,7 +45,7 @@ build_script: - 'if "%compiler%"=="msvc" msbuild harfbuzz.sln /p:Configuration=%configuration% /p:Platform=%platform%' - 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" ctest --output-on-failure -C %configuration%' - - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config,python2}"' + - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S --needed mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config,python2}"' - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "curl https://raw.githubusercontent.com/mirror/mingw-w64/023eb04c396d4e8d8fcf604cfababc53dae13398/mingw-w64-headers/include/dwrite_1.h > %MINGW_PREFIX%/%MINGW_CHOST%/include/dwrite_1.h"' - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --with-directwrite --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || .ci/fail.sh"' commit 5631d70d36aa7952d343ea794bd5169a730706ae Author: Cosimo Lupo <[email protected]> Date: Mon Jul 16 12:41:59 2018 +0200 appveyor.yml: try updating msys2 to fix failing mingw-w64-x86_64 build https://github.com/harfbuzz/harfbuzz/pull/1093#issuecomment-405201903 https://ci.appveyor.com/project/harfbuzz/harfbuzz/build/job/ky7lao1ii1bi7ew4#L71 diff --git a/appveyor.yml b/appveyor.yml index 05a72d96..91316e66 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,6 +29,8 @@ environment: MSYS2_ARCH: i686 install: + - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman -Syu --noconfirm"' + - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman -Su --noconfirm"' - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-ragel" build_script: _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
