Commit dca05193 authored by Jacob Vosmaer's avatar Jacob Vosmaer Committed by Max Kellermann

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.
parent b9a7f304
ver 0.21.19 (not yet released) ver 0.21.19 (not yet released)
* fix build failure with clang 10
ver 0.21.18 (2019/12/24) ver 0.21.18 (2019/12/24)
* protocol * protocol
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
#if GCC_CHECK_VERSION(7,0) #if GCC_CHECK_VERSION(7,0)
#define gcc_fallthrough __attribute__((fallthrough)) #define gcc_fallthrough __attribute__((fallthrough))
#elif CLANG_CHECK_VERSION(10,0) #elif CLANG_CHECK_VERSION(10,0) && defined(__cplusplus)
#define gcc_fallthrough [[fallthrough]] #define gcc_fallthrough [[fallthrough]]
#else #else
#define gcc_fallthrough #define gcc_fallthrough
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment