Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58631 - trunk/boost/iostreams/detail/adapter
From: daniel_james_at_[hidden]
Date: 2010-01-02 06:11:22


Author: danieljames
Date: 2010-01-02 06:11:21 EST (Sat, 02 Jan 2010)
New Revision: 58631
URL: http://svn.boost.org/trac/boost/changeset/58631

Log:
Add dummy returns after calling throw_exception.
Text files modified:
   trunk/boost/iostreams/detail/adapter/concept_adapter.hpp | 25 ++++++++++++++++++++-----
   1 files changed, 20 insertions(+), 5 deletions(-)

Modified: trunk/boost/iostreams/detail/adapter/concept_adapter.hpp
==============================================================================
--- trunk/boost/iostreams/detail/adapter/concept_adapter.hpp (original)
+++ trunk/boost/iostreams/detail/adapter/concept_adapter.hpp 2010-01-02 06:11:21 EST (Sat, 02 Jan 2010)
@@ -27,6 +27,15 @@
 // Must come last.
 #include <boost/iostreams/detail/config/disable_warnings.hpp> // MSVC.
 
+// If Boost.Exception has BOOST_ATTRIBUTE_NORETURN
+#if defined(_MSC_VER) || defined(__GNUC__)
+#define BOOST_IOSTREAMS_UNREACHABLE_RETURN(x) \
+ BOOST_UNREACHABLE_RETURN(x)
+#else
+#define BOOST_IOSTREAMS_UNREACHABLE_RETURN(x) \
+ return x;
+#endif
+
 namespace boost { namespace iostreams { namespace detail {
 
 template<typename Category> struct device_wrapper_impl;
@@ -139,6 +148,7 @@
           BOOST_IOS::openmode, any_tag )
     {
         boost::throw_exception(cant_seek());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(0)
     }
 
     template<typename Device>
@@ -172,7 +182,8 @@
     static std::streamsize
     write( Device&, Dummy*, const typename char_type_of<Device>::type*,
            std::streamsize )
- { boost::throw_exception(cant_write()); }
+ { boost::throw_exception(cant_write());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(0) }
 };
 
 template<>
@@ -180,7 +191,8 @@
     template<typename Device, typename Dummy>
     static std::streamsize
     read(Device&, Dummy*, typename char_type_of<Device>::type*, std::streamsize)
- { boost::throw_exception(cant_read()); }
+ { boost::throw_exception(cant_read());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(0) }
 
     template<typename Device, typename Dummy>
     static std::streamsize
@@ -206,7 +218,8 @@
     static std::streampos
     seek( Filter&, Device*, stream_offset,
           BOOST_IOS::seekdir, BOOST_IOS::openmode, any_tag )
- { boost::throw_exception(cant_seek()); }
+ { boost::throw_exception(cant_seek());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(0) }
 
     template<typename Filter, typename Device>
     static std::streampos
@@ -253,7 +266,8 @@
     static std::streamsize
     write( Filter&, Sink*, const typename char_type_of<Filter>::type*,
            std::streamsize )
- { boost::throw_exception(cant_write()); }
+ { boost::throw_exception(cant_write());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(0) }
 };
 
 template<>
@@ -261,7 +275,8 @@
     template<typename Filter, typename Source>
     static std::streamsize
     read(Filter&, Source*, typename char_type_of<Filter>::type*,std::streamsize)
- { boost::throw_exception(cant_read()); }
+ { boost::throw_exception(cant_read());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(0) }
 
     template<typename Filter, typename Sink>
     static std::streamsize


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk