Allow disabling multi-threaded support

By defining HB_NO_MT.

Also, only warn once per missing MT feature support.

Mozilla Bug 666661 - gfx/harfbuzz/src/hb-prive.h - compiler warnings on mac
This commit is contained in:
Behdad Esfahbod 2012-02-23 15:06:16 -05:00
parent 634c9e3423
commit bd7ff1dec5
3 changed files with 7 additions and 11 deletions

View File

@ -38,6 +38,7 @@ HBSOURCES = \
hb-tt-font.cc \
hb-unicode-private.hh \
hb-unicode.cc \
hb-warning.cc \
$(NULL)
HBHEADERS = \
hb.h \

View File

@ -40,7 +40,7 @@
/* We need external help for these */
#ifdef HAVE_GLIB
#if !defined(HB_NO_MT) && defined(HAVE_GLIB)
#include <glib.h>
@ -52,7 +52,7 @@ typedef GStaticMutex hb_mutex_impl_t;
#define hb_mutex_impl_free(M) g_static_mutex_free (M)
#elif defined(_MSC_VER) || defined(__MINGW32__)
#elif !defined(HB_NO_MT) && defined(_MSC_VER) || defined(__MINGW32__)
#include <windows.h>
@ -66,7 +66,7 @@ typedef CRITICAL_SECTION hb_mutex_impl_t;
#else
#warning "Could not find any system to define platform macros, library will NOT be thread-safe"
#define HB_MUTEX_IMPL_NIL 1
typedef volatile int hb_mutex_impl_t;
#define HB_MUTEX_IMPL_INIT 0

View File

@ -49,7 +49,7 @@
/* We need external help for these */
#ifdef HAVE_GLIB
#if !defined(HB_NO_MT) && defined(HAVE_GLIB)
#include <glib.h>
@ -63,7 +63,7 @@ typedef volatile int hb_atomic_int_t;
#define hb_atomic_int_set(AI, V) g_atomic_int_set (&(AI), V)
#elif defined(_MSC_VER) && _MSC_VER >= 1600
#elif !defined(HB_NO_MT) && defined(_MSC_VER) && _MSC_VER >= 1600
#include <intrin.h>
@ -75,18 +75,13 @@ typedef long hb_atomic_int_t;
#else
#ifdef _MSC_VER
#pragma message("Could not find any system to define atomic_int macros, library will NOT be thread-safe")
#else
#warning "Could not find any system to define atomic_int macros, library will NOT be thread-safe"
#endif
#define HB_ATOMIC_INT_NIL 1
typedef volatile int hb_atomic_int_t;
#define hb_atomic_int_add(AI, V) ((AI) += (V), (AI) - (V))
#define hb_atomic_int_get(AI) (AI)
#define hb_atomic_int_set(AI, V) ((void) ((AI) = (V)))
#endif