aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/macros.h
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-05-13 07:51:01 -0400
committerGitHub <noreply@github.com>2017-05-13 07:51:01 -0400
commitac47f8a50691e6ce99c54712e5c984db8b1f079e (patch)
treef6863f960fe46983b5efb2a84db0bed6f8c80b75 /src/nvim/macros.h
parentae3d5e5ecc32f4ca6a29976880f225a716bad44b (diff)
parentf3a508b4a3c13cc755b355976c6e0f2fae7e1645 (diff)
downloadrneovim-ac47f8a50691e6ce99c54712e5c984db8b1f079e.tar.gz
rneovim-ac47f8a50691e6ce99c54712e5c984db8b1f079e.tar.bz2
rneovim-ac47f8a50691e6ce99c54712e5c984db8b1f079e.zip
Merge pull request #6514 from jamessan/gcc-7-fixes
Fix GCC 7 issues
Diffstat (limited to 'src/nvim/macros.h')
-rw-r--r--src/nvim/macros.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index 214af82422..9ab6dc5d2b 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -153,4 +153,22 @@
#define STR_(x) #x
#define STR(x) STR_(x)
+#ifndef __has_attribute
+# define NVIM_HAS_ATTRIBUTE(x) 0
+#elif defined(__clang__) && __clang__ == 1 \
+ && (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 5))
+// Starting in Clang 3.6, __has_attribute was fixed to only report true for
+// GNU-style attributes. Prior to that, it reported true if _any_ backend
+// supported the attribute.
+# define NVIM_HAS_ATTRIBUTE(x) 0
+#else
+# define NVIM_HAS_ATTRIBUTE __has_attribute
+#endif
+
+#if NVIM_HAS_ATTRIBUTE(fallthrough)
+# define FALLTHROUGH __attribute__((fallthrough))
+#else
+# define FALLTHROUGH
+#endif
+
#endif // NVIM_MACROS_H