diff options
Diffstat (limited to 'src/base/compiler.hh')
-rw-r--r-- | src/base/compiler.hh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/base/compiler.hh b/src/base/compiler.hh index 2fdd323b9..6920dad10 100644 --- a/src/base/compiler.hh +++ b/src/base/compiler.hh @@ -63,6 +63,20 @@ # define M5_CLASS_VAR_USED #endif +// This can be removed once all compilers support C++17 +#if defined __has_cpp_attribute + // Note: We must separate this if statement because GCC < 5.0 doesn't + // support the function-like syntax in #if statements. + #if __has_cpp_attribute(fallthrough) + #define M5_FALLTHROUGH [[fallthrough]] + #else + #define M5_FALLTHROUGH + #endif +#else + // Unsupported (and no warning) on GCC < 7. + #define M5_FALLTHROUGH +#endif + // std::make_unique redefined for C++11 compilers namespace m5 { |