diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b7a6af285fa99b383a5fdee6c8eea95ce913917..2c515d7e5c5dfa0d0b0e4980a3336eb2ecdbb32b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -503,13 +503,32 @@ else (NOT CHAMELEON_SIMULATION) endif(NOT CHAMELEON_SIMULATION) -# getopt +# Check for getopt +# ---------------- unset(CMAKE_REQUIRED_LIBRARIES) check_include_files(getopt.h CHAMELEON_HAVE_GETOPT_H) if (CHAMELEON_HAVE_GETOPT_H) check_function_exists(getopt_long CHAMELEON_HAVE_GETOPT_LONG) endif() +# Check for attribute fallthrough +# ------------------------------- +check_c_source_compiles(" +#include <stdarg.h> +int main(void) { + int a = 2; + switch( a ){ + case 0: + __attribute__((fallthrough)); + default: + ; + } + return 0; +} +" + HAVE_FALLTHROUGH + ) + # Add option to exploit cublas API v2 # ----------------------------------- cmake_dependent_option(CHAMELEON_USE_CUBLAS_V2 diff --git a/include/chameleon/config.h.in b/include/chameleon/config.h.in index dc878d47b68f1a0e514ca9b9bf6f9c95de0e1ece..2b7e3e4bc644f17cf7980463cfda09363a9ddc54 100644 --- a/include/chameleon/config.h.in +++ b/include/chameleon/config.h.in @@ -70,6 +70,13 @@ /* chameleon runtime starpu */ #cmakedefine CHAMELEON_ENABLE_PRUNING_STATS +#cmakedefine HAVE_FALLTHROUGH +#if defined(HAVE_FALLTHROUGH) +#define chameleon_attr_fallthrough __attribute__((fallthrough)) +#else +#define chameleon_attr_fallthrough do {} while(0) +#endif + #ifdef BEGIN_C_DECLS #undef BEGIN_C_DECLS #endif