diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index f5645807..3e497dcb 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -242,6 +242,33 @@ int main(void) { return 0; }" HAVE_MSC_THREAD_LOCAL_STORAGE) +check_c_source_compiles(" +#define FALL_THROUGH __attribute__((fallthrough)) + +enum direction_e { + UP = 0, + DOWN, +}; + +int main(void) { + enum direction_e key = UP; + int i = 10; + int j = 0; + + switch (key) { + case UP: + i = 5; + FALL_THROUGH; + case DOWN: + j = i * 2; + break; + default: + break; + } + + return 0; +}" HAVE_FALLTHROUGH_ATTRIBUTE) + check_c_source_compiles(" #include diff --git a/config.h.cmake b/config.h.cmake index 3f34f09b..f8869df7 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -167,6 +167,8 @@ #cmakedefine HAVE_GCC_THREAD_LOCAL_STORAGE 1 #cmakedefine HAVE_MSC_THREAD_LOCAL_STORAGE 1 +#cmakedefine HAVE_FALLTHROUGH_ATTRIBUTE 1 + #cmakedefine HAVE_GCC_VOLATILE_MEMORY_PROTECTION 1 #cmakedefine HAVE_GCC_NARG_MACRO 1