* 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
+2016-09-26 Marek Polacek <polacek@redhat.com>
+
+ * system.h: Use __has_attribute to check whether the fallthrough
+ attribute is supported.
+
2016-09-26 Marek Polacek <polacek@redhat.com>
* ipa-inline-analysis.c (find_foldable_builtin_expect): Use
+2016-09-26 Marek Polacek <polacek@redhat.com>
+
+ * c-lex.c (c_common_has_attribute): Handle attribute fallthrough.
+
2016-09-26 Marek Polacek <polacek@redhat.com>
PR c/7652
else if (is_attribute_p ("deprecated", attr_name))
result = 201309;
else if (is_attribute_p ("maybe_unused", attr_name)
- || is_attribute_p ("nodiscard", attr_name))
+ || is_attribute_p ("nodiscard", attr_name)
+ || is_attribute_p ("fallthrough", attr_name))
result = 201603;
if (result)
attr_name = NULL_TREE;
#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
+2016-09-26 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/cpp1z/feat-cxx1z.C: Test attribute fallthrough.
+
2016-09-26 Martin Liska <mliska@suse.cz>
* c-c++-common/ubsan/sanitize-recover-1.c: New test.
# error "__has_cpp_attribute(nodiscard) != 201603"
# endif
+# if ! __has_cpp_attribute(fallthrough)
+# error "__has_cpp_attribute(fallthrough)"
+# elif __has_cpp_attribute(fallthrough) != 201603
+# error "__has_cpp_attribute(fallthrough) != 201603"
+# endif
+
#else
# error "__has_cpp_attribute"
#endif