summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c3d2675)
raw | patch | inline | side by side (parent: c3d2675)
author | Max Kellermann <max.kellermann@gmail.com> | |
Fri, 10 Mar 2017 20:34:28 +0000 (21:34 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Fri, 10 Mar 2017 20:36:48 +0000 (21:36 +0100) |
src/Compiler.h | patch | blob | history |
diff --git a/src/Compiler.h b/src/Compiler.h
index 7d19d686d704072739593e97acc2362b2cdf1266..ef13a546c7666b9211f66cc521d3e3e0243ff219 100644 (file)
--- a/src/Compiler.h
+++ b/src/Compiler.h
# define CLANG_VERSION 0
#endif
# define CLANG_VERSION 0
#endif
+/**
+ * Are we building with clang (any version) or at least the specified
+ * gcc version?
+ */
+#define CLANG_OR_GCC_VERSION(major, minor) \
+ (CLANG_VERSION || GCC_CHECK_VERSION(major, minor))
+
/**
* Are we building with gcc (not clang or any other compiler) and a
* version older than the specified one?
/**
* Are we building with gcc (not clang or any other compiler) and a
* version older than the specified one?
(GCC_VERSION && !CLANG_VERSION && \
GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0))
(GCC_VERSION && !CLANG_VERSION && \
GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0))
-#if GCC_CHECK_VERSION(4,0)
+#if CLANG_OR_GCC_VERSION(4,0)
/* GCC 4.x */
/* GCC 4.x */
#endif
#endif
-#if GCC_CHECK_VERSION(4,3)
+#if CLANG_OR_GCC_VERSION(4,3)
#define gcc_hot __attribute__((hot))
#define gcc_cold __attribute__((cold))
#define gcc_hot __attribute__((hot))
#define gcc_cold __attribute__((cold))
#ifndef __cplusplus
/* plain C99 has "restrict" */
#define gcc_restrict restrict
#ifndef __cplusplus
/* plain C99 has "restrict" */
#define gcc_restrict restrict
-#elif GCC_CHECK_VERSION(4,0)
+#elif CLANG_OR_GCC_VERSION(4,0)
/* "__restrict__" is a GCC extension for C++ */
#define gcc_restrict __restrict__
#else
/* "__restrict__" is a GCC extension for C++ */
#define gcc_restrict __restrict__
#else
#define final
#endif
#define final
#endif
-#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
+#if CLANG_OR_GCC_VERSION(4,8)
#define gcc_alignas(T, fallback) alignas(T)
#else
#define gcc_alignas(T, fallback) gcc_aligned(fallback)
#define gcc_alignas(T, fallback) alignas(T)
#else
#define gcc_alignas(T, fallback) gcc_aligned(fallback)