diff options
author | Eugene Kliuchnikov <eustas@google.com> | 2018-04-20 14:10:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-20 14:10:55 +0200 |
commit | 6000396155a418aba75c0dab1d97cf5124aa4fb2 (patch) | |
tree | 2999142be20fab368275e97cdcc7d3e7d6b8dca8 /c/common | |
parent | 68db5c0272d46f316efab575b67dae5b9ce4378d (diff) | |
download | brotli-6000396155a418aba75c0dab1d97cf5124aa4fb2.zip brotli-6000396155a418aba75c0dab1d97cf5124aa4fb2.tar.gz brotli-6000396155a418aba75c0dab1d97cf5124aa4fb2.tar.bz2 |
Remove unprefixed macros from public headers (#662)
Diffstat (limited to 'c/common')
-rwxr-xr-x | c/common/platform.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/c/common/platform.h b/c/common/platform.h index 8d14290..b4e435a 100755 --- a/c/common/platform.h +++ b/c/common/platform.h @@ -32,6 +32,18 @@ #include <stdio.h> #endif +#if defined(__has_builtin) +#define BROTLI_HAS_BUILTIN(x) __has_builtin(x) +#else +#define BROTLI_HAS_BUILTIN(x) 0 +#endif + +#if defined(__has_attribute) +#define BROTLI_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +#define BROTLI_HAS_ATTRIBUTE(x) 0 +#endif + /* Macros for compiler / platform specific features and build options. Build options are: @@ -48,7 +60,7 @@ * BROTLI_ENABLE_LOG enables asserts and dumps various state information */ -#if BROTLI_MODERN_COMPILER || __has_attribute(always_inline) +#if BROTLI_MODERN_COMPILER || BROTLI_HAS_ATTRIBUTE(always_inline) #define BROTLI_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline)) #else #define BROTLI_ATTRIBUTE_ALWAYS_INLINE @@ -56,7 +68,7 @@ #if defined(_WIN32) || defined(__CYGWIN__) #define BROTLI_ATTRIBUTE_VISIBILITY_HIDDEN -#elif BROTLI_MODERN_COMPILER || __has_attribute(visibility) +#elif BROTLI_MODERN_COMPILER || BROTLI_HAS_ATTRIBUTE(visibility) #define BROTLI_ATTRIBUTE_VISIBILITY_HIDDEN \ __attribute__ ((visibility ("hidden"))) #else @@ -78,7 +90,7 @@ #define BROTLI_INLINE __forceinline #endif /* _MSC_VER */ -#if BROTLI_MODERN_COMPILER || __has_attribute(unused) +#if BROTLI_MODERN_COMPILER || BROTLI_HAS_ATTRIBUTE(unused) #define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE __attribute__ ((unused)) #else #define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE @@ -93,7 +105,7 @@ #define BROTLI_RESTRICT #endif -#if BROTLI_MODERN_COMPILER || __has_attribute(noinline) +#if BROTLI_MODERN_COMPILER || BROTLI_HAS_ATTRIBUTE(noinline) #define BROTLI_NOINLINE __attribute__((noinline)) #else #define BROTLI_NOINLINE @@ -324,7 +336,7 @@ OR: } */ -#if BROTLI_MODERN_COMPILER || __has_builtin(__builtin_expect) +#if BROTLI_MODERN_COMPILER || BROTLI_HAS_BUILTIN(__builtin_expect) #define BROTLI_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) #define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0)) #else @@ -333,7 +345,7 @@ OR: #endif /* BROTLI_IS_CONSTANT macros returns true for compile-time constants. */ -#if BROTLI_MODERN_COMPILER || __has_builtin(__builtin_constant_p) +#if BROTLI_MODERN_COMPILER || BROTLI_HAS_BUILTIN(__builtin_constant_p) #define BROTLI_IS_CONSTANT(x) (!!__builtin_constant_p(x)) #else #define BROTLI_IS_CONSTANT(x) (!!0) |