mirror of
https://github.com/boostorg/config.git
synced 2025-07-30 04:17:16 +02:00
Add support for __unreachable_return on clang and GCC.
See https://svn.boost.org/trac/boost/ticket/11661.
This commit is contained in:
@ -255,6 +255,11 @@
|
||||
// All versions with __cplusplus above this value seem to support this:
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
//
|
||||
// __builtin_unreachable:
|
||||
#if defined(__has_builtin) && __has_builtin(__builtin_unreachable)
|
||||
#define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable();
|
||||
#endif
|
||||
|
||||
|
||||
// Unused attribute:
|
||||
|
@ -278,6 +278,11 @@
|
||||
#if __GNUC__ >= 4
|
||||
# define BOOST_ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
#endif
|
||||
//
|
||||
// __builtin_unreachable:
|
||||
#if BOOST_GCC_VERSION >= 40800
|
||||
#define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable();
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
# define BOOST_COMPILER "GNU C++ version " __VERSION__
|
||||
|
@ -444,10 +444,12 @@ namespace std {
|
||||
// is defined, in which case it evaluates to return x; Use when you have a return
|
||||
// statement that can never be reached.
|
||||
|
||||
#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
|
||||
# define BOOST_UNREACHABLE_RETURN(x) return x;
|
||||
#else
|
||||
# define BOOST_UNREACHABLE_RETURN(x)
|
||||
#ifndef BOOST_UNREACHABLE_RETURN
|
||||
# ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
|
||||
# define BOOST_UNREACHABLE_RETURN(x) return x;
|
||||
# else
|
||||
# define BOOST_UNREACHABLE_RETURN(x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// BOOST_DEDUCED_TYPENAME workaround ------------------------------------------//
|
||||
|
Reference in New Issue
Block a user