Compiler.h: add macro CLANG_OR_GCC_VERSION()

This commit is contained in:
Max Kellermann
2014-11-28 19:09:21 +01:00
parent 25429af122
commit d93172bee8
10 changed files with 23 additions and 16 deletions

View File

@@ -84,7 +84,7 @@ ContainerAttributeOffset(const A C::*p)
* Cast the given pointer to a struct member to its parent structure.
*/
template<class C, class A>
#if defined(__clang__) || GCC_CHECK_VERSION(4,7)
#if CLANG_OR_GCC_VERSION(4,7)
constexpr
#endif
static inline C &
@@ -97,7 +97,7 @@ ContainerCast(A &a, A C::*member)
* Cast the given pointer to a struct member to its parent structure.
*/
template<class C, class A>
#if defined(__clang__) || GCC_CHECK_VERSION(4,7)
#if CLANG_OR_GCC_VERSION(4,7)
constexpr
#endif
static inline const C &

View File

@@ -41,7 +41,7 @@
#include <assert.h>
#if defined(__clang__) || GCC_CHECK_VERSION(4,7)
#if CLANG_OR_GCC_VERSION(4,7)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
@@ -114,7 +114,7 @@ public:
}
};
#if defined(__clang__) || GCC_CHECK_VERSION(4,7)
#if CLANG_OR_GCC_VERSION(4,7)
#pragma GCC diagnostic pop
#endif