diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-05-20 07:01:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-05-20 07:01:03 +0300 |
commit | 81e584ed17902878579131776b4e5a9f7b54cdab (patch) | |
tree | b69c5e579eaa1c6b40c99a2ad36f75e385f50df3 /source/blender/blenlib/BLI_compiler_attrs.h | |
parent | 6cd1d34dc1953f007ee16e9673e1d112160fb162 (diff) |
CMake: Use GCC7's -Wimplicit-fallthrough=5
Use to avoid accidental missing break statements,
use ATTR_FALLTHROUGH to suppress.
Diffstat (limited to 'source/blender/blenlib/BLI_compiler_attrs.h')
-rw-r--r-- | source/blender/blenlib/BLI_compiler_attrs.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_compiler_attrs.h b/source/blender/blenlib/BLI_compiler_attrs.h index f0d32670229..4c548654e33 100644 --- a/source/blender/blenlib/BLI_compiler_attrs.h +++ b/source/blender/blenlib/BLI_compiler_attrs.h @@ -92,4 +92,12 @@ # define ATTR_PRINTF_FORMAT(format_param, dots_param) #endif +/* Use to suppress '-Wimplicit-fallthrough' (in place of 'break'). */ +#if defined(__GNUC__) && (__GNUC__ >= 7) /* gcc7.0+ only */ +#define ATTR_FALLTHROUGH __attribute__((fallthrough)) +#else +#define ATTR_FALLTHROUGH ((void)0) +#endif + + #endif /* __BLI_COMPILER_ATTRS_H__ */ |