diff options
author | Marek Polacek <polacek@redhat.com> | 2016-09-26 15:53:28 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2016-09-26 15:53:28 +0000 |
commit | c6147dc433015793d92602811e585b83c9018bc2 (patch) | |
tree | 0ae29fdb0d04e4498b59ab6240031213610fb6e8 /gcc/system.h | |
parent | 8e4284d0b24bd3c745c054054d673ed306d30467 (diff) | |
download | gcc-c6147dc433015793d92602811e585b83c9018bc2.zip gcc-c6147dc433015793d92602811e585b83c9018bc2.tar.gz gcc-c6147dc433015793d92602811e585b83c9018bc2.tar.bz2 |
c-lex.c (c_common_has_attribute): Handle attribute fallthrough.
* c-lex.c (c_common_has_attribute): Handle attribute fallthrough.
* system.h: Use __has_attribute to check whether the fallthrough
attribute is supported.
* g++.dg/cpp1z/feat-cxx1z.C: Test attribute fallthrough.
From-SVN: r240499
Diffstat (limited to 'gcc/system.h')
-rw-r--r-- | gcc/system.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/system.h b/gcc/system.h index 8ca71cf..0952e4f 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -746,8 +746,12 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; #define gcc_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__)) #endif -#if GCC_VERSION >= 7000 -# define gcc_fallthrough() __attribute__((fallthrough)) +#if GCC_VERSION >= 7000 && defined(__has_attribute) +# if __has_attribute(fallthrough) +# define gcc_fallthrough() __attribute__((fallthrough)) +# else +# define gcc_fallthrough() +# endif #else # define gcc_fallthrough() #endif |