From bd7ff1dec5b92ee59fa060e793f88499adcd8c11 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 23 Feb 2012 15:06:16 -0500 Subject: [PATCH] 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 --- src/Makefile.am | 1 + src/hb-mutex-private.hh | 6 +++--- src/hb-object-private.hh | 11 +++-------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 8e8c01311..d7478956f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,6 +38,7 @@ HBSOURCES = \ hb-tt-font.cc \ hb-unicode-private.hh \ hb-unicode.cc \ + hb-warning.cc \ $(NULL) HBHEADERS = \ hb.h \ diff --git a/src/hb-mutex-private.hh b/src/hb-mutex-private.hh index 9855a5654..88442d1d5 100644 --- a/src/hb-mutex-private.hh +++ b/src/hb-mutex-private.hh @@ -40,7 +40,7 @@ /* We need external help for these */ -#ifdef HAVE_GLIB +#if !defined(HB_NO_MT) && defined(HAVE_GLIB) #include @@ -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 @@ -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 diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh index 2e4a38584..6fa0f09da 100644 --- a/src/hb-object-private.hh +++ b/src/hb-object-private.hh @@ -49,7 +49,7 @@ /* We need external help for these */ -#ifdef HAVE_GLIB +#if !defined(HB_NO_MT) && defined(HAVE_GLIB) #include @@ -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 @@ -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