Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58807 - in trunk/boost/iostreams: . detail/adapter detail/config
From: daniel_james_at_[hidden]
Date: 2010-01-08 01:44:52


Author: danieljames
Date: 2010-01-08 01:44:51 EST (Fri, 08 Jan 2010)
New Revision: 58807
URL: http://svn.boost.org/trac/boost/changeset/58807

Log:
More unreachable returns. This should only be a temporary workaround.
Added:
   trunk/boost/iostreams/detail/config/unreachable_return.hpp (contents, props changed)
Text files modified:
   trunk/boost/iostreams/checked_operations.hpp | 16 +++++++++++-----
   trunk/boost/iostreams/detail/adapter/concept_adapter.hpp | 9 +--------
   2 files changed, 12 insertions(+), 13 deletions(-)

Modified: trunk/boost/iostreams/checked_operations.hpp
==============================================================================
--- trunk/boost/iostreams/checked_operations.hpp (original)
+++ trunk/boost/iostreams/checked_operations.hpp 2010-01-08 01:44:51 EST (Fri, 08 Jan 2010)
@@ -14,6 +14,7 @@
 #include <boost/iostreams/categories.hpp>
 #include <boost/iostreams/detail/dispatch.hpp>
 #include <boost/iostreams/detail/error.hpp>
+#include <boost/iostreams/detail/config/unreachable_return.hpp>
 #include <boost/iostreams/get.hpp>
 #include <boost/iostreams/put.hpp>
 #include <boost/iostreams/read.hpp>
@@ -94,24 +95,28 @@
 
     template<typename T>
     static bool put(T&, typename char_type_of<T>::type)
- { boost::throw_exception(cant_write()); }
+ { boost::throw_exception(cant_write());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(false) }
 
     template<typename T>
     static std::streamsize
     write(T&, const typename char_type_of<T>::type*, std::streamsize)
- { boost::throw_exception(cant_write()); }
+ { boost::throw_exception(cant_write());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(0) }
 };
 
 template<>
 struct read_write_if_impl<output> {
     template<typename T>
     static typename int_type_of<T>::type get(T&)
- { boost::throw_exception(cant_read()); }
+ { boost::throw_exception(cant_read());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(0) }
 
     template<typename T>
     static std::streamsize
     read(T&, typename char_type_of<T>::type*, std::streamsize)
- { boost::throw_exception(cant_read()); }
+ { boost::throw_exception(cant_read());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(0) }
 
     template<typename T>
     static bool put(T& t, typename char_type_of<T>::type c)
@@ -140,7 +145,8 @@
     template<typename T>
     static std::streampos
     seek(T&, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode)
- { boost::throw_exception(cant_seek()); }
+ { boost::throw_exception(cant_seek());
+ BOOST_IOSTREAMS_UNREACHABLE_RETURN(std::streampos()) }
 };
 
 } // End namespace detail.

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-08 01:44:51 EST (Fri, 08 Jan 2010)
@@ -17,6 +17,7 @@
 #include <boost/iostreams/detail/dispatch.hpp>
 #include <boost/iostreams/detail/error.hpp>
 #include <boost/iostreams/detail/streambuf.hpp> // pubsync.
+#include <boost/iostreams/detail/config/unreachable_return.hpp>
 #include <boost/iostreams/device/null.hpp>
 #include <boost/iostreams/traits.hpp>
 #include <boost/iostreams/operations.hpp>
@@ -27,14 +28,6 @@
 // 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 {
 

Added: trunk/boost/iostreams/detail/config/unreachable_return.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/iostreams/detail/config/unreachable_return.hpp 2010-01-08 01:44:51 EST (Fri, 08 Jan 2010)
@@ -0,0 +1,25 @@
+// (C) Copyright 2010 Daniel James
+// 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.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+#ifndef BOOST_IOSTREAMS_DETAIL_UNREACHABLE_RETURN_HPP_INCLUDED
+#define BOOST_IOSTREAMS_DETAIL_UNREACHABLE_RETURN_HPP_INCLUDED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+
+// 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
+
+#endif
\ No newline at end of file


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