diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2017-10-14 00:20:35 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2017-10-14 00:20:35 +0200 |
commit | 207d694ac2a580f02b28e216d0843308f5ad129b (patch) | |
tree | bd9743b593cef0580e951b54bced5d505897db5e /Cython/Utility/ModuleSetupCode.c | |
parent | b0e0e184aec348e3c5948b44c6918180b2d2660d (diff) | |
download | cython-207d694ac2a580f02b28e216d0843308f5ad129b.tar.gz |
Fix compiler warnings in clang and C++ about unknown "fallthrough" attribute.
Closes #1930.
Diffstat (limited to 'Cython/Utility/ModuleSetupCode.c')
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index de9aebf04..214ccdebf 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -507,7 +507,7 @@ #ifndef CYTHON_FALLTHROUGH - #ifdef __cplusplus + #if defined(__cplusplus) && __cplusplus >= 201103L #if __has_cpp_attribute(fallthrough) #define CYTHON_FALLTHROUGH [[fallthrough]] #elif __has_cpp_attribute(clang::fallthrough) @@ -516,7 +516,9 @@ #endif #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) || (defined(__GNUC__) && defined(__attribute__)) + #if defined(__clang__) && __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #elif defined(__GNUC__) && defined(__attribute__) #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) #else #define CYTHON_FALLTHROUGH |