diff --git a/src/stdafx.h b/src/stdafx.h --- a/src/stdafx.h +++ b/src/stdafx.h @@ -156,6 +156,17 @@ #else #define FINAL #endif + + /* Use fallthrough attribute where supported */ + #if __GNUC__ >= 7 + #if __cplusplus > 201402L // C++17 + #define FALLTHROUGH [[fallthrough]] + #else + #define FALLTHROUGH __attribute__((fallthrough)) + #endif + #else + #define FALLTHROUGH + #endif #endif /* __GNUC__ */ #if defined(__WATCOMC__) @@ -164,6 +175,7 @@ #define GCC_PACK #define WARN_FORMAT(string, args) #define FINAL + #define FALLTHROUGH #include #endif /* __WATCOMC__ */ @@ -235,6 +247,13 @@ #define WARN_FORMAT(string, args) #define FINAL sealed + /* fallthrough attribute, VS 2017 */ + #if (_MSC_VER >= 1910) + #define FALLTHROUGH [[fallthrough]] + #else + #define FALLTHROUGH + #endif + #if defined(WINCE) int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap); #endif