• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//  (C) Copyright John Maddock 2001.
2//  Use, modification and distribution are subject to the
3//  Boost Software License, Version 1.0. (See accompanying file
4//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6//  See http://www.boost.org/libs/config for the most recent version.
7
8//  MACRO:         BOOST_NO_UNREACHABLE_RETURN_DETECTION
9//  TITLE:         detection of unreachable returns
10//  DESCRIPTION:   If a return is unreachable, then no return
11//                 statement should be required, however some
12//                 compilers insist on it, while other issue a
13//                 bunch of warnings if it is in fact present.
14
15#if defined( BOOST_NO_EXCEPTIONS )
16# include <stdlib.h>
17#endif
18
19namespace boost_no_unreachable_return_detection{
20
21int checker()
22{
23#if defined( BOOST_NO_EXCEPTIONS ) && (!defined( _MSC_VER ) || defined(__clang__))
24   abort();
25#else
26   throw 0;
27#endif
28   // no return statement: we don't ever get here...
29}
30
31int check = 0;
32
33int test()
34{
35   if(check)
36      return checker();
37   return 0;
38}
39
40}
41
42
43
44