Added BOOST_NORETURN macro to mark functions that do not return normally.

The implementation is based on boost/exception/detail/attribute_noreturn.hpp.
This commit is contained in:
Andrey Semashev committed 2014-05-31 14:50:59 +04:00
1 parent 80ffbcb8c3
commit e9c3612560
2 files changed
+37 -2

No files matched your search

+15
View File
@@ -603,6 +603,21 @@ namespace std{ using ::type_info; }
# endif
#endif
// BOOST_NORETURN ---------------------------------------------//
// Macro to use before a function declaration/definition to designate
// the function as not returning normally (i.e. with a return statement
// or by leaving the function scope, if the function return type is void).
#if !defined(BOOST_NORETURN)
# if defined(_MSC_VER)
# define BOOST_NORETURN __declspec(noreturn)
# elif defined(__GNUC__)
# define BOOST_NORETURN __attribute__ ((__noreturn__))
# else
# define BOOST_NO_NORETURN
# define BOOST_NORETURN
# endif
#endif
// Branch prediction hints
// These macros are intended to wrap conditional expressions that yield true or false
//