aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-09-08 16:10:32 +0200
committerMartin Ridgers <[email protected]>2021-09-14 14:29:26 +0200
commitbc22ba07f62695ae9ddd8b2a011ed7045f3e9abf (patch)
treeb567b80a3e37409ef52c66bb284c03ab7387cd04
parentSet ZEN_PLATFORM_* defines for Linux and Mac (diff)
downloadzen-bc22ba07f62695ae9ddd8b2a011ed7045f3e9abf.tar.xz
zen-bc22ba07f62695ae9ddd8b2a011ed7045f3e9abf.zip
ZEN_COMPILER_* defines for Clang and GCC
-rw-r--r--zencore/include/zencore/zencore.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/zencore/include/zencore/zencore.h b/zencore/include/zencore/zencore.h
index 59c950ac4..fe6b90c7c 100644
--- a/zencore/include/zencore/zencore.h
+++ b/zencore/include/zencore/zencore.h
@@ -29,8 +29,22 @@
// Compiler
//
-#ifdef _MSC_VER
-# define ZEN_COMPILER_MSC 1
+#define ZEN_COMPILER_CLANG 0
+#define ZEN_COMPILER_MSC 0
+#define ZEN_COMPILER_GCC 0
+
+// Clang can define __GNUC__ and/or _MSC_VER so we check for Clang first
+#ifdef __clang__
+# undef ZEN_COMPILER_CLANG
+# define ZEN_COMPILER_CLANG 1
+#elif defined(_MSC_VER)
+# undef ZEN_COMPILER_MSC
+# define ZEN_COMPILER_MSC 1
+#elif defined(__GNUC__)
+# undef ZEN_COMPILER_GCC
+# define ZEN_COMPILER_GCC 1
+#else
+# error Unknown compiler
#endif
#ifndef ZEN_COMPILER_MSC