From 6a8b96d9c37f0773aa3c1090cfca9453e64a98a9 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Sun, 5 Jul 2009 20:07:20 +0000 Subject: [PATCH] Added BOOST_ATTRIBUTE_NORETURN to suppress warnings in boost::throw_exception [SVN r54683] --- .../exception/detail/attribute_noreturn.hpp | 19 +++++++++++++++++++ include/boost/throw_exception.hpp | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 include/boost/exception/detail/attribute_noreturn.hpp diff --git a/include/boost/exception/detail/attribute_noreturn.hpp b/include/boost/exception/detail/attribute_noreturn.hpp new file mode 100644 index 0000000..1cb0763 --- /dev/null +++ b/include/boost/exception/detail/attribute_noreturn.hpp @@ -0,0 +1,19 @@ +//Copyright (c) 2009 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under 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) + +#ifndef UUID_61531AB0680611DEADD5846855D89593 +#define UUID_61531AB0680611DEADD5846855D89593 + +#include + +#if defined(BOOST_MSVC) +#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn) +#elif defined(__GNUC__) +#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn)) +#else +#define BOOST_ATTRIBUTE_NORETURN +#endif + +#endif diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index da14339..2250bef 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -20,7 +20,7 @@ // http://www.boost.org/libs/utility/throw_exception.html // -#include +#include #include #include @@ -54,7 +54,7 @@ void throw_exception( std::exception const & e ); // user defined inline void throw_exception_assert_compatibility( std::exception const & ) { } -template inline void throw_exception( E const & e ) +template BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const & e ) { //All boost exceptions are required to derive std::exception, //to ensure compatibility with BOOST_NO_EXCEPTIONS.