Fix -Wundef errors with __GNUC__

Fixes https://github.com/harfbuzz/harfbuzz/issues/1549
This commit is contained in:
Behdad Esfahbod 2019-01-18 12:48:01 -05:00
parent 28917e58f9
commit d9f6be3a61
2 changed files with 7 additions and 7 deletions

View File

@ -67,7 +67,7 @@ typedef unsigned __int64 uint64_t;
# include <stdint.h> # include <stdint.h>
#endif #endif
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) #if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
#define HB_DEPRECATED __attribute__((__deprecated__)) #define HB_DEPRECATED __attribute__((__deprecated__))
#elif defined(_MSC_VER) && (_MSC_VER >= 1300) #elif defined(_MSC_VER) && (_MSC_VER >= 1300)
#define HB_DEPRECATED __declspec(deprecated) #define HB_DEPRECATED __declspec(deprecated)
@ -75,7 +75,7 @@ typedef unsigned __int64 uint64_t;
#define HB_DEPRECATED #define HB_DEPRECATED
#endif #endif
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) #if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
#define HB_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead"))) #define HB_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) #elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
#define HB_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead")) #define HB_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))

View File

@ -208,7 +208,7 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size);
HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1] HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1]
#endif // static_assert #endif // static_assert
#ifdef __GNUC__ #if defined(__GNUC__)
#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)) #if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8))
#define thread_local __thread #define thread_local __thread
#endif #endif
@ -258,7 +258,7 @@ struct _hb_alignof
#define __attribute__(x) #define __attribute__(x)
#endif #endif
#if __GNUC__ >= 3 #if defined(__GNUC__) && (__GNUC__ >= 3)
#define HB_PURE_FUNC __attribute__((pure)) #define HB_PURE_FUNC __attribute__((pure))
#define HB_CONST_FUNC __attribute__((const)) #define HB_CONST_FUNC __attribute__((const))
#define HB_PRINTF_FUNC(format_idx, arg_idx) __attribute__((__format__ (__printf__, format_idx, arg_idx))) #define HB_PRINTF_FUNC(format_idx, arg_idx) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
@ -267,7 +267,7 @@ struct _hb_alignof
#define HB_CONST_FUNC #define HB_CONST_FUNC
#define HB_PRINTF_FUNC(format_idx, arg_idx) #define HB_PRINTF_FUNC(format_idx, arg_idx)
#endif #endif
#if __GNUC__ >= 4 #if defined(__GNUC__) && (__GNUC__ >= 4)
#define HB_UNUSED __attribute__((unused)) #define HB_UNUSED __attribute__((unused))
#elif defined(_MSC_VER) /* https://github.com/harfbuzz/harfbuzz/issues/635 */ #elif defined(_MSC_VER) /* https://github.com/harfbuzz/harfbuzz/issues/635 */
#define HB_UNUSED __pragma(warning(suppress: 4100 4101)) #define HB_UNUSED __pragma(warning(suppress: 4100 4101))
@ -290,7 +290,7 @@ struct _hb_alignof
# endif # endif
#endif #endif
#if __GNUC__ >= 3 #if defined(__GNUC__) && (__GNUC__ >= 3)
#define HB_FUNC __PRETTY_FUNCTION__ #define HB_FUNC __PRETTY_FUNCTION__
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define HB_FUNC __FUNCSIG__ #define HB_FUNC __FUNCSIG__
@ -322,7 +322,7 @@ struct _hb_alignof
#if defined(__clang__) && __cplusplus >= 201103L #if defined(__clang__) && __cplusplus >= 201103L
/* clang's fallthrough annotations are only available starting in C++11. */ /* clang's fallthrough annotations are only available starting in C++11. */
# define HB_FALLTHROUGH [[clang::fallthrough]] # define HB_FALLTHROUGH [[clang::fallthrough]]
#elif __GNUC__ >= 7 #elif defined(__GNUC__) && (__GNUC__ >= 7)
/* GNU fallthrough attribute is available from GCC7 */ /* GNU fallthrough attribute is available from GCC7 */
# define HB_FALLTHROUGH __attribute__((fallthrough)) # define HB_FALLTHROUGH __attribute__((fallthrough))
#elif defined(_MSC_VER) #elif defined(_MSC_VER)