Commit c6147dc4 by Marek Polacek Committed by Marek Polacek

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
parent 8e4284d0
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
gimple_call_internal_p.
* ipa-split.c (find_return_bb): Likewise.
......
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
* c-common.c (c_common_attribute_table): Add fallthrough attribute.
(handle_fallthrough_attribute): New function.
......
......@@ -350,7 +350,8 @@ c_common_has_attribute (cpp_reader *pfile)
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;
......
......@@ -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
......
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.
......
......@@ -370,6 +370,12 @@
# 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment