[Boost-bugs] [Boost C++ Libraries] #5904: Patch to suppress "unreachable code" warning from Visual Studio 2008/2010 (VC90/VC100)

Subject: [Boost-bugs] [Boost C++ Libraries] #5904: Patch to suppress "unreachable code" warning from Visual Studio 2008/2010 (VC90/VC100)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-09-16 11:20:20


#5904: Patch to suppress "unreachable code" warning from Visual Studio 2008/2010
(VC90/VC100)
--------------------------------------------------+-------------------------
 Reporter: gareth.sylvester-bradley@… | Owner: danieljames
     Type: Patches | Status: new
Milestone: Boost 1.48.0 | Component: iostreams
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
--------------------------------------------------+-------------------------
 Probably as a result of ticket #3311, Visual Studio correctly identifies
 unreachable code when instantiating a boost::iostreams::stream with a
 Device that doesn't support certain functionality (e.g. a write-only
 Sink). Since the relevant code is reachable for other kinds of Device, the
 simplest fix is to just suppress the warning. The equivalent warning for
 Borland is already suppressed in
 boost/iostreams/detail/config/disable_warnings.hpp.

 Code:

 {{{
 #include <deque>
 #include <boost/iostreams/stream.hpp>
 #include <boost/iostreams/device/back_inserter.hpp>

 boost::iostreams::stream< boost::iostreams::back_insert_device<
 std::deque< char > > > s;
 }}}

 Result (provided not /Od):
 {{{
 1>...\boost_1_47_0\boost\iostreams\detail\adapter\concept_adapter.hpp(77)
 : warning C4702: unreachable code
 1>...\boost_1_47_0\boost\iostreams\detail\streambuf\indirect_streambuf.hpp(259)
 : warning C4702: unreachable code
 1>...\boost_1_47_0\boost\iostreams\detail\streambuf\indirect_streambuf.hpp(260)
 : warning C4702: unreachable code
 1>...\boost_1_47_0\boost\iostreams\detail\streambuf\indirect_streambuf.hpp(261)
 : warning C4702: unreachable code
 1>...\boost_1_47_0\boost\iostreams\detail\streambuf\indirect_streambuf.hpp(263)
 : warning C4702: unreachable code
 1>...\boost_1_47_0\boost\iostreams\detail\streambuf\indirect_streambuf.hpp(266)
 : warning C4702: unreachable code
 1>...\boost_1_47_0\boost\iostreams\detail\adapter\concept_adapter.hpp(95)
 : warning C4702: unreachable code
 1>...\boost_1_47_0\boost\iostreams\detail\streambuf\indirect_streambuf.hpp(333)
 : warning C4702: unreachable code
 }}}

 Patch for boost/iostreams/detail/config/disable_warnings.hpp:
 {{{
 17a18
> # pragma warning(disable:4702) // Unreachable code.
 }}}

 Please would someone apply this for Boost 1.48.0?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5904>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC