Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61680 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/src libs/filesystem/test
From: bdawes_at_[hidden]
Date: 2010-04-29 12:23:34


Author: bemandawes
Date: 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
New Revision: 61680
URL: http://svn.boost.org/trac/boost/changeset/61680

Log:
Introduce BOOST_FILESYSTEM_THROW to simplify exception dependency testing, clarify reported exception types. MinGW 4.5 now working with static linking. DLL issues still unresolved.
Text files modified:
   sandbox/filesystem-v3/boost/filesystem/config.hpp | 11 +++++++++
   sandbox/filesystem-v3/boost/filesystem/fstream.hpp | 39 +++++++++++++++++++-------------
   sandbox/filesystem-v3/boost/filesystem/path.hpp | 1
   sandbox/filesystem-v3/boost/filesystem/path_traits.hpp | 2
   sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 33 +++++++++++++++------------
   sandbox/filesystem-v3/libs/filesystem/src/path_traits.cpp | 5 +--
   sandbox/filesystem-v3/libs/filesystem/src/unique_path.cpp | 3 -
   sandbox/filesystem-v3/libs/filesystem/test/Jamfile.v2 | 6 +++-
   sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 22 +++++++++++------
   sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp | 48 ++++++++++++++++++++++-----------------
   10 files changed, 101 insertions(+), 69 deletions(-)

Modified: sandbox/filesystem-v3/boost/filesystem/config.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/config.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/config.hpp 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -31,6 +31,17 @@
 # define BOOST_FILESYSTEM_DEPRECATED
 # endif
 
+// throw an exception ----------------------------------------------------------------//
+//
+// Exceptions were originally thrown via boost::throw_exception().
+// As throw_exception() became more complex, it caused catch failures in version tests
+// with various versions of GCC. For all compilers, it also caused user error reporting
+// to be harder to interpret, since the exception reported became much more complex.
+// The immediate fix was to throw directly, wrapped in a macro to make any later change
+// easier.
+
+#define BOOST_FILESYSTEM_THROW(EX) throw EX
+
 // determine platform ----------------------------------------------------------------//
 
 // BOOST_POSIX_API or BOOST_WINDOWS_API specify which API to use

Modified: sandbox/filesystem-v3/boost/filesystem/fstream.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/fstream.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/fstream.hpp 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -12,15 +12,22 @@
 #ifndef BOOST_FILESYSTEM_FSTREAM_HPP
 #define BOOST_FILESYSTEM_FSTREAM_HPP
 
-#include <boost/filesystem/operations.hpp> // for 8.3 hack (see below)
-#include <boost/utility/enable_if.hpp>
-#include <boost/detail/workaround.hpp>
+#include <boost/filesystem/path.hpp>
+#include <boost/config.hpp>
 
 #include <iosfwd>
 #include <fstream>
 
 #include <boost/config/abi_prefix.hpp> // must be the last #include
 
+// glibc++ doesn't have wchar_t overloads for file stream paths, so on Windows use
+// path::string() to get a narrow character c_str()
+#if defined(BOOST_WINDOWS_API) && defined(__GLIBCXX__)
+# define BOOST_FILESYSTEM_C_STR string().c_str()
+#else
+# define BOOST_FILESYSTEM_C_STR c_str()
+#endif
+
 namespace boost
 {
 namespace filesystem
@@ -44,7 +51,7 @@
     basic_filebuf<charT,traits>*
       open(const path& p, std::ios_base::openmode mode)
     {
- return std::basic_filebuf<charT,traits>::open(p.c_str(), mode)
+ return std::basic_filebuf<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode)
         ? this : 0;
     }
   };
@@ -67,16 +74,16 @@
     // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
 
     explicit basic_ifstream(const path& p)
- : std::basic_ifstream<charT,traits>(p.c_str(), std::ios_base::in) {}
+ : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {}
 
     basic_ifstream(const path& p, std::ios_base::openmode mode)
- : std::basic_ifstream<charT,traits>(p.c_str(), mode) {}
+ : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {}
 
     void open(const path& p)
- { std::basic_ifstream<charT,traits>::open(p.c_str(), std::ios_base::in); }
+ { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); }
 
     void open(const path& p, std::ios_base::openmode mode)
- { std::basic_ifstream<charT,traits>::open(p.c_str(), mode); }
+ { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); }
 
     virtual ~basic_ifstream() {}
   };
@@ -99,16 +106,16 @@
     // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
 
     explicit basic_ofstream(const path& p)
- : std::basic_ofstream<charT,traits>(p.c_str(), std::ios_base::out) {}
+ : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {}
 
     basic_ofstream(const path& p, std::ios_base::openmode mode)
- : std::basic_ofstream<charT,traits>(p.c_str(), mode) {}
+ : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {}
 
     void open(const path& p)
- { std::basic_ofstream<charT,traits>::open(p.c_str(), std::ios_base::out); }
+ { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); }
 
     void open(const path& p, std::ios_base::openmode mode)
- { std::basic_ofstream<charT,traits>::open(p.c_str(), mode); }
+ { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); }
 
     virtual ~basic_ofstream() {}
   };
@@ -131,18 +138,18 @@
     // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
 
     explicit basic_fstream(const path& p)
- : std::basic_fstream<charT,traits>(p.c_str(),
+ : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR,
           std::ios_base::in | std::ios_base::out) {}
 
     basic_fstream(const path& p, std::ios_base::openmode mode)
- : std::basic_fstream<charT,traits>(p.c_str(), mode) {}
+ : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {}
 
     void open(const path& p)
- { std::basic_fstream<charT,traits>::open(p.c_str(),
+ { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR,
           std::ios_base::in | std::ios_base::out); }
 
     void open(const path& p, std::ios_base::openmode mode)
- { std::basic_fstream<charT,traits>::open(p.c_str(), mode); }
+ { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); }
 
     virtual ~basic_fstream() {}
 

Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -20,7 +20,6 @@
 #include <boost/system/error_code.hpp>
 #include <boost/system/system_error.hpp>
 #include <boost/iterator/iterator_facade.hpp>
-#include <boost/throw_exception.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/static_assert.hpp>
 #include <string>

Modified: sandbox/filesystem-v3/boost/filesystem/path_traits.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path_traits.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path_traits.hpp 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -91,7 +91,7 @@
     if (c.size())
     {
       std::basic_string<typename Container::value_type> s(c.begin(), c.end());
- path_traits::convert(s.c_str(), s.c_str()+s.size(), to, cvt);
+ convert(s.c_str(), s.c_str()+s.size(), to, cvt);
     }
   }
 

Modified: sandbox/filesystem-v3/libs/filesystem/src/operations.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/operations.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/operations.cpp 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -38,7 +38,6 @@
 
 #include <boost/filesystem/operations.hpp>
 #include <boost/scoped_array.hpp>
-#include <boost/throw_exception.hpp>
 #include <boost/detail/workaround.hpp>
 
 #ifdef BOOST_FILEYSTEM_INCLUDE_IOSTREAM
@@ -51,7 +50,6 @@
 using boost::system::error_code;
 using boost::system::error_category;
 using boost::system::system_category;
-using boost::throw_exception;
 using std::string;
 using std::wstring;
 
@@ -78,6 +76,11 @@
 
 # else // BOOST_WINDOW_API
 
+# if defined(__MINGW32__) && !defined(WINVER)
+ // Versions of MinGW that support Filesystem V3 support at least WINVER 0x501.
+ // See MinGW's windef.h
+# define WINVER 0x501
+# endif
 # include <windows.h>
 # include <winnt.h>
 # if !defined(_WIN32_WINNT)
@@ -235,7 +238,7 @@
     else
     { // error
       if (ec == 0)
- throw_exception(filesystem_error(message,
+ BOOST_FILESYSTEM_THROW(filesystem_error(message,
           error_code(BOOST_ERRNO, system_category)));
       else
         ec->assign(BOOST_ERRNO, system_category);
@@ -252,7 +255,7 @@
     else
     { // error
       if (ec == 0)
- throw_exception(filesystem_error(message,
+ BOOST_FILESYSTEM_THROW(filesystem_error(message,
           p, error_code(BOOST_ERRNO, system_category)));
       else
         ec->assign(BOOST_ERRNO, system_category);
@@ -270,7 +273,7 @@
     else
     { // error
       if (ec == 0)
- throw_exception(filesystem_error(message,
+ BOOST_FILESYSTEM_THROW(filesystem_error(message,
           p1, p2, error_code(BOOST_ERRNO, system_category)));
       else
         ec->assign(BOOST_ERRNO, system_category);
@@ -289,7 +292,7 @@
     else
     { // error
       if (ec == 0)
- throw_exception(filesystem_error(message, p, result));
+ BOOST_FILESYSTEM_THROW(filesystem_error(message, p, result));
       else
         *ec = result;
     }
@@ -307,7 +310,7 @@
     else
     { // error
       if (ec == 0)
- throw_exception(filesystem_error(message, p1, p2, result));
+ BOOST_FILESYSTEM_THROW(filesystem_error(message, p1, p2, result));
       else
         *ec = result;
     }
@@ -605,7 +608,7 @@
     else
     {
       if (ec == 0)
- throw_exception(filesystem_error("boost::filesystem::copy",
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::copy",
           from, to, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category)));
       ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category);
     }
@@ -668,7 +671,7 @@
       if (!p.empty() && !is_directory(p))
       {
         if (ec == 0)
- boost::throw_exception(filesystem_error(
+ BOOST_FILESYSTEM_THROW(filesystem_error(
             "boost::filesystem::create_directories", p,
             error_code(system::errc::file_exists, system::generic_category)));
         else ec->assign(system::errc::file_exists, system::generic_category);
@@ -703,7 +706,7 @@
 
     // attempt to create directory failed && it doesn't already exist
     if (ec == 0)
- throw_exception(filesystem_error("boost::filesystem::create_directory",
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::create_directory",
         p, error_code(errval, system_category)));
     else
       ec->assign(errval, system_category);
@@ -1104,7 +1107,7 @@
       if ((result=::readlink(p.c_str(), buf.get(), path_max))== -1)
       {
         if (ec == 0)
- throw_exception(filesystem_error("boost::filesystem::read_symlink",
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::read_symlink",
             p, error_code(errno, system_category)));
         else ec->assign(errno, system_category);
         break;
@@ -1253,7 +1256,7 @@
       return file_status(type_unknown);
     }
     if (ec == 0)
- throw_exception(filesystem_error("boost::filesystem::status",
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
         p, error_code(errval, system_category)));
     return file_status(status_error);
   }
@@ -1275,7 +1278,7 @@
         return fs::file_status(fs::file_not_found);
       }
       if (ec == 0)
- throw_exception(filesystem_error("boost::filesystem::status",
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
           p, error_code(errno, system_category)));
       return fs::file_status(fs::status_error);
     }
@@ -1344,7 +1347,7 @@
         return fs::file_status(fs::file_not_found);
       }
       if (ec == 0)
- throw_exception(filesystem_error("boost::filesystem::status",
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
           p, error_code(errno, system_category)));
       return fs::file_status(fs::status_error);
     }
@@ -1741,7 +1744,7 @@
       {
         it.m_imp.reset();
         if (ec == 0)
- throw_exception(
+ BOOST_FILESYSTEM_THROW(
             filesystem_error("boost::filesystem::directory_iterator::operator++",
               it.m_imp->dir_entry.path().parent_path(),
               error_code(BOOST_ERRNO, system_category)));

Modified: sandbox/filesystem-v3/libs/filesystem/src/path_traits.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/path_traits.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/path_traits.cpp 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -15,7 +15,6 @@
 #include <boost/filesystem/config.hpp>
 #include <boost/system/system_error.hpp>
 #include <boost/scoped_array.hpp>
-#include <boost/throw_exception.hpp>
 #include <locale> // for codecvt_base::result
 #include <cstring> // for strlen
 #include <cwchar> // for wcslen
@@ -72,7 +71,7 @@
            to, to_end, to_next)) != std::codecvt_base::ok)
     {
       //std::cout << " result is " << static_cast<int>(res) << std::endl;
- boost::throw_exception(bs::system_error(res, fs::codecvt_error_category(),
+ BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(),
         "boost::filesystem::path codecvt to wstring"));
     }
     target.append(to, to_next);
@@ -106,7 +105,7 @@
            to, to_end, to_next)) != std::codecvt_base::ok)
     {
       //std::cout << " result is " << static_cast<int>(res) << std::endl;
- boost::throw_exception(bs::system_error(res, fs::codecvt_error_category(),
+ BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(),
         "boost::filesystem::path codecvt to string"));
     }
     target.append(to, to_next);

Modified: sandbox/filesystem-v3/libs/filesystem/src/unique_path.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/unique_path.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/unique_path.cpp 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -14,7 +14,6 @@
 #define BOOST_FILESYSTEM_SOURCE
 
 #include <boost/filesystem/operations.hpp>
-#include <boost/throw_exception.hpp>
 
 # ifdef BOOST_POSIX_API
 # include <fcntl.h>
@@ -29,7 +28,7 @@
 void fail(int err, boost::system::error_code* ec)
 {
   if (ec == 0)
- boost::throw_exception( boost::system::system_error(err,
+ BOOST_FILESYSTEM_THROW( boost::system::system_error(err,
       boost::system::system_category,
       "boost::filesystem::unique_path"));
 

Modified: sandbox/filesystem-v3/libs/filesystem/test/Jamfile.v2
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/Jamfile.v2 (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/Jamfile.v2 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -16,11 +16,13 @@
 
    test-suite "filesystem" :
        [ run path_unit_test.cpp ]
+ [ run path_unit_test.cpp : : : <link>static : path_unit_test_static ]
        [ run path_test.cpp ]
+ [ run path_test.cpp : : : <link>static : path_test_static ]
        [ run operations_unit_test.cpp ]
- # [ run operations_unit_test.cpp : : : <link>static : operations_unit_test_static ]
+ [ run operations_unit_test.cpp : : : <link>static : operations_unit_test_static ]
        [ run operations_test.cpp ]
- # [ run operations_test.cpp : : : <link>static : operations_test_static ]
+ [ run operations_test.cpp : : : <link>static : operations_test_static ]
        [ run fstream_test.cpp ]
        [ run convenience_test.cpp ]
        [ run large_file_support_test.cpp ]

Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -13,13 +13,11 @@
 #define BOOST_FILESYSTEM_NO_DEPRECATED
 
 #include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/convenience.hpp>
 #include <boost/cerrno.hpp>
 namespace fs = boost::filesystem;
 
 #include <boost/config.hpp>
 #include <boost/detail/lightweight_test.hpp>
-//#include <boost/concept_check.hpp>
 
 using boost::system::error_code;
 using boost::system::system_category;
@@ -36,6 +34,14 @@
 # include <windows.h>
 #endif
 
+// glibc++ doesn't have wchar_t overloads for file stream paths, so on Windows use
+// path::string() to get a narrow character c_str()
+#if defined(BOOST_WINDOWS_API) && defined(__GLIBCXX__)
+# define BOOST_FILESYSTEM_C_STR string().c_str()
+#else
+# define BOOST_FILESYSTEM_C_STR c_str()
+#endif
+
 #define CHECK_EXCEPTION(Functor,Expect) throws_fs_error(Functor,Expect,__LINE__)
 
 namespace
@@ -57,7 +63,7 @@
 
   void create_file(const fs::path & ph, const std::string & contents)
   {
- std::ofstream f(ph.c_str());
+ std::ofstream f(ph.BOOST_FILESYSTEM_C_STR);
     if (!f)
       throw fs::filesystem_error("operations_test create_file",
       ph, error_code(errno, system_category));
@@ -66,7 +72,7 @@
 
   void verify_file(const fs::path & ph, const std::string & expected)
   {
- std::ifstream f(ph.c_str());
+ std::ifstream f(ph.BOOST_FILESYSTEM_C_STR);
     if (!f)
       throw fs::filesystem_error("operations_test verify_file",
         ph, error_code(errno, system_category));
@@ -170,11 +176,11 @@
   void exception_tests()
   {
     std::cout << "exception_tests..." << std::endl;
+ bool exception_thrown;
 
- // catch runtime_error
+ // catch runtime_error by value
 
     std::cout << " catch runtime_error by value" << std::endl;
- bool exception_thrown;
     exception_thrown = false;
     try
     {
@@ -193,7 +199,7 @@
     }
     BOOST_TEST(exception_thrown);
 
- // catch system_error
+ // catch system_error by value
 
     std::cout << " catch system_error by value" << std::endl;
     exception_thrown = false;
@@ -1171,7 +1177,7 @@
   std::cout << "BOOST_WINDOWS_API\n";
 #endif
 #ifdef BOOST_POSIX_PATH
- std::cout << "BOOST_PATH_API\n";
+ std::cout << "BOOST_POSIX_PATH\n";
 #endif
 #ifdef BOOST_WINDOWS_PATH
   std::cout << "BOOST_WINDOWS_PATH\n";

Modified: sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp 2010-04-29 12:23:32 EDT (Thu, 29 Apr 2010)
@@ -15,7 +15,7 @@
 // are processed correctly.
 //
 // For full functionality tests, including probes with many different argument
-// values, see path_test.cpp and other test programs.
+// values, see path_test.cpp and other test programs.
 //
 // ---------------------------------------------------------------------------------- //
 
@@ -49,7 +49,7 @@
 #if defined(_MSC_VER)
 # pragma warning(push) // Save warning settings.
 # pragma warning(disable : 4428) // Disable universal-character-name encountered in source warning.
-#endif
+#endif
 
 namespace
 {
@@ -174,7 +174,7 @@
   path y;
 
   // test_assignments ----------------------------------------------------------------//
-
+
   void test_assignments()
   {
     std::cout << "testing assignments..." << std::endl;
@@ -323,7 +323,7 @@
     CHECK(p.generic_string<wstring>() == L"abc\\def/ghi");
     CHECK(p.generic_string<path::string_type>() == "abc\\def/ghi");
 
-# endif
+# endif
   }
 
   // test_relationals ----------------------------------------------------------------//
@@ -475,13 +475,13 @@
 // CHECK(path("").make_absolute("foo") == ""); // should assert
 
 # ifdef BOOST_WINDOWS_PATH
- CHECK(path("baa").make_absolute("c:/") == "c:/baa");
- CHECK(path("/baa").make_absolute("c:/foo").string() == path("c:/baa").string());
+ CHECK(path("baa").make_absolute("c:/") == "c:/baa");
+ CHECK(path("/baa").make_absolute("c:/foo").string() == path("c:/baa").string());
     CHECK(path("baa/baz").make_absolute("c:/foo/bar").string()
       == path("c:/foo/bar\\baa/baz").string());
 # else
- CHECK(path("baa").make_absolute("/") == "/baa");
- CHECK(path("/baa").make_absolute("/foo").string() == path("/baa").string());
+ CHECK(path("baa").make_absolute("/") == "/baa");
+ CHECK(path("/baa").make_absolute("/foo").string() == path("/baa").string());
     CHECK(path("baa/baz").make_absolute("/foo/bar").string()
       == path("/foo/bar/baa/baz").string());
 # endif
@@ -642,7 +642,7 @@
   // test_error_handling -------------------------------------------------------------//
 
   class error_codecvt
- : public std::codecvt< wchar_t, char, std::mbstate_t >
+ : public std::codecvt< wchar_t, char, std::mbstate_t >
   {
   public:
     explicit error_codecvt()
@@ -652,30 +652,30 @@
     virtual bool do_always_noconv() const throw() { return false; }
     virtual int do_encoding() const throw() { return 0; }
 
- virtual std::codecvt_base::result do_in(std::mbstate_t&,
+ virtual std::codecvt_base::result do_in(std::mbstate_t&,
       const char*, const char*, const char*&,
       wchar_t*, wchar_t*, wchar_t*&) const
     {
- static std::codecvt_base::result result = std::codecvt_base::noconv;
- if (result == std::codecvt_base::partial) result = std::codecvt_base::error;
- else if (result == std::codecvt_base::error) result = std::codecvt_base::noconv;
- else if (result == std::codecvt_base::noconv) result = std::codecvt_base::partial;
- return result;
+ static std::codecvt_base::result r = std::codecvt_base::noconv;
+ if (r == std::codecvt_base::partial) r = std::codecvt_base::error;
+ else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv;
+ else r = std::codecvt_base::partial;
+ return r;
     }
 
     virtual std::codecvt_base::result do_out(std::mbstate_t &,
       const wchar_t*, const wchar_t*, const wchar_t*&,
       char*, char*, char*&) const
     {
- static std::codecvt_base::result result = std::codecvt_base::noconv;
- if (result == std::codecvt_base::partial) result = std::codecvt_base::error;
- else if (result == std::codecvt_base::error) result = std::codecvt_base::noconv;
- else if (result == std::codecvt_base::noconv) result = std::codecvt_base::partial;
- return result;
+ static std::codecvt_base::result r = std::codecvt_base::noconv;
+ if (r == std::codecvt_base::partial) r = std::codecvt_base::error;
+ else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv;
+ else r = std::codecvt_base::partial;
+ return r;
     }
 
     virtual std::codecvt_base::result do_unshift(std::mbstate_t&,
- char*, char*, char* &) const { return ok; }
+ char*, char*, char* &) const { return ok; }
     virtual int do_length(std::mbstate_t &,
       const char*, const char*, std::size_t) const { return 0; }
     virtual int do_max_length() const throw () { return 0; }
@@ -700,6 +700,7 @@
 # endif
 
     {
+ std::cout << " testing std::codecvt_base::partial error..." << std::endl;
       bool exception_thrown (false);
       try { path(STRING_FOO_); }
       catch (const bs::system_error & ex)
@@ -708,10 +709,12 @@
         BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::partial,
           fs::codecvt_error_category()));
       }
+ catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; }
       BOOST_TEST(exception_thrown);
     }
 
     {
+ std::cout << " testing std::codecvt_base::error error..." << std::endl;
       bool exception_thrown (false);
       try { path(STRING_FOO_); }
       catch (const bs::system_error & ex)
@@ -720,10 +723,12 @@
         BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::error,
           fs::codecvt_error_category()));
       }
+ catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; }
       BOOST_TEST(exception_thrown);
     }
 
     {
+ std::cout << " testing std::codecvt_base::noconv error..." << std::endl;
       bool exception_thrown (false);
       try { path(STRING_FOO_); }
       catch (const bs::system_error & ex)
@@ -732,6 +737,7 @@
         BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::noconv,
           fs::codecvt_error_category()));
       }
+ catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; }
       BOOST_TEST(exception_thrown);
     }
 


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