summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2019-12-30 21:50:33 +0100
committerMax Kellermann <max@musicpd.org>2019-12-31 13:54:09 +0100
commitdca0519336586be95b920004178114a097681768 (patch)
tree5106d6dc53fa9a16f368609ef7380216ee6e3438 /src
parentb9a7f30443be2686a8ecbc9c639ade0b99b33f72 (diff)
Clang: only use [[fallthrough]] in C++ files
It appears that [[fallthrough]] is valid in C++ but not in C. And in some Clang versions (e.g. Clang 11 on macOS), Clang is pedantic about this and considers it an error to use [[fallthrough]] in a .c file such as src/util/format.c. This changes makes gcc_fallthrough a no-op under Clang in C files.
Diffstat (limited to 'src')
-rw-r--r--src/util/Compiler.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/Compiler.h b/src/util/Compiler.h
index 96f63fae4..04e49bb61 100644
--- a/src/util/Compiler.h
+++ b/src/util/Compiler.h
@@ -145,7 +145,7 @@
#if GCC_CHECK_VERSION(7,0)
#define gcc_fallthrough __attribute__((fallthrough))
-#elif CLANG_CHECK_VERSION(10,0)
+#elif CLANG_CHECK_VERSION(10,0) && defined(__cplusplus)
#define gcc_fallthrough [[fallthrough]]
#else
#define gcc_fallthrough