summaryrefslogtreecommitdiff
path: root/src/stdafx.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2017-08-13 18:38:42 +0000
committerfrosch <frosch@openttd.org>2017-08-13 18:38:42 +0000
commitb4b98e51655012ea42dbc8ab9e455fbec0d04b39 (patch)
tree948fc802d5dfdca71454f6ce479e4f429e98488d /src/stdafx.h
parent19bae485b028380fbdc94d02ebaecdf3ca23f932 (diff)
downloadopenttd-b4b98e51655012ea42dbc8ab9e455fbec0d04b39.tar.xz
(svn r27893) -Codechange: Use fallthrough attribute. (LordAro)
Diffstat (limited to 'src/stdafx.h')
-rw-r--r--src/stdafx.h19
1 files changed, 19 insertions, 0 deletions
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 <malloc.h>
#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