From b4b98e51655012ea42dbc8ab9e455fbec0d04b39 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 13 Aug 2017 18:38:42 +0000 Subject: (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) --- src/stdafx.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/stdafx.h') diff --git a/src/stdafx.h b/src/stdafx.h index 4616212f1..43e52ff27 100644 --- 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 -- cgit v1.2.3-54-g00ecf