diff options
Diffstat (limited to 'thirdparty/harfbuzz/src/hb.hh')
-rw-r--r-- | thirdparty/harfbuzz/src/hb.hh | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/thirdparty/harfbuzz/src/hb.hh b/thirdparty/harfbuzz/src/hb.hh index 18516581c7..829b5a1ab7 100644 --- a/thirdparty/harfbuzz/src/hb.hh +++ b/thirdparty/harfbuzz/src/hb.hh @@ -117,6 +117,9 @@ #pragma GCC diagnostic ignored "-Wshadow" // TODO fix #pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations" // TODO fix #pragma GCC diagnostic ignored "-Wunused-parameter" // TODO fix +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic ignored "-Wunused-result" // TODO fix +#endif #endif /* Ignored intentionally. */ @@ -179,6 +182,9 @@ #include <cassert> #include <cfloat> #include <climits> +#ifdef _MSC_VER +# define _USE_MATH_DEFINES +#endif #include <cmath> #include <cstdarg> #include <cstddef> @@ -220,10 +226,15 @@ extern "C" void* hb_malloc_impl(size_t size); extern "C" void* hb_calloc_impl(size_t nmemb, size_t size); extern "C" void* hb_realloc_impl(void *ptr, size_t size); extern "C" void hb_free_impl(void *ptr); -#define malloc hb_malloc_impl -#define calloc hb_calloc_impl -#define realloc hb_realloc_impl -#define free hb_free_impl +#define hb_malloc hb_malloc_impl +#define hb_calloc hb_calloc_impl +#define hb_realloc hb_realloc_impl +#define hb_free hb_free_impl +#else +#define hb_malloc malloc +#define hb_calloc calloc +#define hb_realloc realloc +#define hb_free free #endif @@ -335,7 +346,6 @@ extern "C" void hb_free_impl(void *ptr); #else # define HB_NODISCARD #endif -#define hb_success_t HB_NODISCARD bool /* https://github.com/harfbuzz/harfbuzz/issues/1852 */ #if defined(__clang__) && !(defined(_AIX) && (defined(__IBMCPP__) || defined(__ibmxl__))) @@ -376,7 +386,7 @@ extern "C" void hb_free_impl(void *ptr); # define HB_NO_SETLOCALE # define HB_NO_ERRNO # endif -# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# elif !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) # ifndef HB_NO_GETENV # define HB_NO_GETENV # endif @@ -398,6 +408,9 @@ static int HB_UNUSED _hb_errno = 0; # define errno _hb_errno #endif +#define HB_STMT_START do +#define HB_STMT_END while (0) + #if defined(HAVE_ATEXIT) && !defined(HB_USE_ATEXIT) /* atexit() is only safe to be called from shared libraries on certain * platforms. Whitelist. @@ -426,16 +439,23 @@ static int HB_UNUSED _hb_errno = 0; */ # define HB_USE_ATEXIT 1 # endif -#endif +#endif /* defined(HAVE_ATEXIT) && !defined(HB_USE_ATEXIT) */ #ifdef HB_NO_ATEXIT # undef HB_USE_ATEXIT #endif #ifndef HB_USE_ATEXIT # define HB_USE_ATEXIT 0 #endif - -#define HB_STMT_START do -#define HB_STMT_END while (0) +#if !HB_USE_ATEXIT +# define hb_atexit(_) HB_STMT_START { if (0) (_) (); } HB_STMT_END +#else /* HB_USE_ATEXIT */ +# ifdef HAVE_ATEXIT +# define hb_atexit atexit +# else + template <void (*function) (void)> struct hb_atexit_t { ~hb_atexit_t () { function (); } }; +# define hb_atexit(f) static hb_atexit_t<f> _hb_atexit_##__LINE__; +# endif +#endif /* Lets assert int types. Saves trouble down the road. */ static_assert ((sizeof (hb_codepoint_t) == 4), ""); |