diff options
author | Jack Lloyd <[email protected]> | 2019-02-27 11:36:49 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-02-27 11:36:49 -0500 |
commit | ef9d76e06ca4a31f8c8aaf484321a6dacf7745f8 (patch) | |
tree | 9ca0746baa791ca298719b2583774a7bad09e435 /src/lib/utils | |
parent | 53ea62781eebb7c2b744cefd1aa7db2e1c1909b4 (diff) |
Prevent a warning with old GCC
GCC 4.8 seems to dislike returns_nonnull attribute, GCC 5 is ok.
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/compiler.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/utils/compiler.h b/src/lib/utils/compiler.h index 3e41daed0..9348909e8 100644 --- a/src/lib/utils/compiler.h +++ b/src/lib/utils/compiler.h @@ -47,7 +47,7 @@ /* * Define BOTAN_GCC_VERSION */ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #define BOTAN_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__) #else #define BOTAN_GCC_VERSION 0 @@ -56,7 +56,7 @@ /* * Define BOTAN_CLANG_VERSION */ -#ifdef __clang__ +#if defined(__clang__) #define BOTAN_CLANG_VERSION (__clang_major__ * 10 + __clang_minor__) #else #define BOTAN_CLANG_VERSION 0 @@ -83,8 +83,10 @@ /* * Define BOTAN_MALLOC_FN */ -#if defined(__GNUG__) || defined(__clang__) +#if defined(__clang__) || (BOTAN_GCC_VERSION >= 500) #define BOTAN_MALLOC_FN __attribute__ ((malloc, returns_nonnull, alloc_size(1,2))) +#elif defined(__GNUG__) + #define BOTAN_MALLOC_FN __attribute__ ((malloc, alloc_size(1,2))) #elif defined(_MSC_VER) #define BOTAN_MALLOC_FN __declspec(restrict) #else @@ -142,7 +144,6 @@ /* * Define BOTAN_IF_CONSTEXPR */ - #if !defined(BOTAN_IF_CONSTEXPR) #if __cplusplus > 201402 #define BOTAN_IF_CONSTEXPR if constexpr |