diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-03-10 11:10:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-10 11:10:35 +0100 |
commit | 9e2ba2237f3ead25f6caa0c6838934058f795fa8 (patch) | |
tree | 5811fb7409a0d382df30042b88d1cca896bb3a3f /mfbt/Attributes.h | |
parent | 2e5f399735258263bc1b172b5312567d1256093c (diff) | |
parent | 28b120018135438eaff8307f3cdef921a697d47a (diff) | |
download | UXP-9e2ba2237f3ead25f6caa0c6838934058f795fa8.tar UXP-9e2ba2237f3ead25f6caa0c6838934058f795fa8.tar.gz UXP-9e2ba2237f3ead25f6caa0c6838934058f795fa8.tar.lz UXP-9e2ba2237f3ead25f6caa0c6838934058f795fa8.tar.xz UXP-9e2ba2237f3ead25f6caa0c6838934058f795fa8.zip |
Merge pull request #51 from trav90/buildsystem-work
Improve support for GCC 7.x
Diffstat (limited to 'mfbt/Attributes.h')
-rw-r--r-- | mfbt/Attributes.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mfbt/Attributes.h b/mfbt/Attributes.h index c875e3a8c..a38257969 100644 --- a/mfbt/Attributes.h +++ b/mfbt/Attributes.h @@ -256,6 +256,8 @@ # define MOZ_MUST_USE #endif +#ifdef __cplusplus + /** * MOZ_FALLTHROUGH is an annotation to suppress compiler warnings about switch * cases that fall through without a break or return statement. MOZ_FALLTHROUGH @@ -282,9 +284,14 @@ * return 5; * } */ -#if defined(__clang__) && __cplusplus >= 201103L - /* clang's fallthrough annotations are only available starting in C++11. */ +#ifndef __has_cpp_attribute +# define __has_cpp_attribute(x) 0 +#endif + +#if __has_cpp_attribute(clang::fallthrough) # define MOZ_FALLTHROUGH [[clang::fallthrough]] +#elif __has_cpp_attribute(gnu::fallthrough) +# define MOZ_FALLTHROUGH [[gnu::fallthrough]] #elif defined(_MSC_VER) /* * MSVC's __fallthrough annotations are checked by /analyze (Code Analysis): @@ -296,8 +303,6 @@ # define MOZ_FALLTHROUGH /* FALLTHROUGH */ #endif -#ifdef __cplusplus - /* * The following macros are attributes that support the static analysis plugin * included with Mozilla, and will be implemented (when such support is enabled) |