aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval/typval.c2
-rw-r--r--src/nvim/macros.h18
-rw-r--r--src/nvim/shada.c2
3 files changed, 20 insertions, 2 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 786b766689..19d9d56058 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -1869,7 +1869,7 @@ void tv_free(typval_T *tv)
}
case VAR_FUNC: {
func_unref(tv->vval.v_string);
- // FALLTHROUGH
+ FALLTHROUGH;
}
case VAR_STRING: {
xfree(tv->vval.v_string);
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
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index a6d8cb6563..e1879ca8c0 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -2047,7 +2047,7 @@ static inline ShaDaWriteResult shada_read_when_writing(
}
case kSDReadStatusNotShaDa: {
ret = kSDWriteReadNotShada;
- // fallthrough
+ FALLTHROUGH;
}
case kSDReadStatusReadError: {
return ret;