diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index 05e691bd1..64a502e6d 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -46,6 +46,7 @@ #include "CrossFade.hxx" #include "tag/Tag.hxx" #include "Idle.hxx" +#include "util/Compiler.h" #include "util/Domain.hxx" #include "thread/Name.hxx" #include "Log.hxx" @@ -1171,6 +1172,7 @@ try { } /* fall through */ + gcc_fallthrough; case PlayerCommand::PAUSE: next_song.reset(); diff --git a/src/util/Compiler.h b/src/util/Compiler.h index 6a64ad098..a97b34529 100644 --- a/src/util/Compiler.h +++ b/src/util/Compiler.h @@ -143,6 +143,12 @@ #define gcc_flatten #endif +#if CLANG_OR_GCC_VERSION(7,0) +#define gcc_fallthrough __attribute__((fallthrough)) +#else +#define gcc_fallthrough +#endif + #ifndef __cplusplus /* plain C99 has "restrict" */ #define gcc_restrict restrict diff --git a/src/util/format.c b/src/util/format.c index 62099b32e..10b53c771 100644 --- a/src/util/format.c +++ b/src/util/format.c @@ -19,6 +19,7 @@ */ #include "format.h" +#include "util/Compiler.h" #include #include @@ -238,6 +239,7 @@ format_object2(const char *format, const char **last, const void *object, } /* fall through */ + gcc_fallthrough; default: /* pass-through non-escaped portions of the format string */