Defining throw_exception with BOOST_NORETURN will (at least for MSVC) stop the compiling from issuing warnings about nothing returned from some boost includes. These warnings don't happen with BOOST_NORETURN not defines throw_exception with BOOST_NORETURN.
An example of a boost include that will generate this warning is:
boost\iostreams\detail\streambuf\direct_streambuf.hpp(165): warning C4715: 'boost::iostreams::detail::direct_streambuf<boost::iostreams::basic_array_source,std::char_traits >::pbackfail': not all control paths return a value
because it's implemented like this:
template<typename T, typename Tr>
typename direct_streambuf<T, Tr>::int_type
direct_streambuf<T, Tr>::pbackfail(inttype c)
{
using namespace std;
if (!ibeg)
boost::throw_exception(cantread());
if (gptr() != 0 && gptr() != ibeg) {
gbump(-1);
if (!traits_type::eq_int_type(c, traits_type::eof()))
*gptr() = traits_type::to_char_type(c);
return traits_type::not_eof(c);
}
boost::throw_exception(bad_putback());
}
Defining throw_exception with BOOST_NORETURN will (at least for MSVC) stop the compiling from issuing warnings about nothing returned from some boost includes. These warnings don't happen with BOOST_NORETURN not defines throw_exception with BOOST_NORETURN.
An example of a boost include that will generate this warning is: boost\iostreams\detail\streambuf\direct_streambuf.hpp(165): warning C4715: 'boost::iostreams::detail::direct_streambuf<boost::iostreams::basic_array_source,std::char_traits >::pbackfail': not all control paths return a value
because it's implemented like this: template<typename T, typename Tr> typename direct_streambuf<T, Tr>::int_type direct_streambuf<T, Tr>::pbackfail(inttype c) { using namespace std; if (!ibeg) boost::throw_exception(cantread()); if (gptr() != 0 && gptr() != ibeg) { gbump(-1); if (!traits_type::eq_int_type(c, traits_type::eof())) *gptr() = traits_type::to_char_type(c); return traits_type::not_eof(c); } boost::throw_exception(bad_putback()); }