Files
config/test/boost_no_ret_det.ipp

44 lines
1.0 KiB
Plaintext
Raw Normal View History

// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.
2002-12-13 11:14:29 +00:00
// MACRO: BOOST_NO_UNREACHABLE_RETURN_DETECTION
// TITLE: detection of unreachable returns
// DESCRIPTION: If a return is unreachable, then no return
// statement should be required, however some
// compilers insist on it, while other issue a
// bunch of warnings if it is in fact present.
2016-03-26 18:20:19 +00:00
#if defined( BOOST_NO_EXCEPTIONS )
2014-06-09 01:00:56 +03:00
# include <stdlib.h>
#endif
2002-12-13 11:14:29 +00:00
namespace boost_no_unreachable_return_detection{
int checker()
{
2016-03-26 18:20:19 +00:00
#if defined( BOOST_NO_EXCEPTIONS ) && (!defined( _MSC_VER ) || defined(__clang__))
2014-06-09 01:00:56 +03:00
abort();
#else
2002-12-13 11:14:29 +00:00
throw 0;
2014-06-09 01:00:56 +03:00
#endif
2002-12-13 11:14:29 +00:00
// no return statement: we don't ever get here...
}
int check = 0;
int test()
{
if(check)
return checker();
return 0;
}
}