Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59673 - in trunk: boost/system libs/filesystem/test/msvc/filesystem_dll libs/system/test libs/system/test/system_msvc libs/system/test/system_msvc/error_code_test
From: bdawes_at_[hidden]
Date: 2010-02-13 12:08:41


Author: bemandawes
Date: 2010-02-13 12:08:39 EST (Sat, 13 Feb 2010)
New Revision: 59673
URL: http://svn.boost.org/trac/boost/changeset/59673

Log:
Fix #3927
Text files modified:
   trunk/boost/system/system_error.hpp | 7 -
   trunk/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj | 1
   trunk/libs/system/test/error_code_test.cpp | 148 +++++++++++++++++++++------------------
   trunk/libs/system/test/system_error_test.cpp | 15 ++-
   trunk/libs/system/test/system_msvc/common.vsprops | 1
   trunk/libs/system/test/system_msvc/error_code_test/error_code_test.vcproj | 4
   trunk/libs/system/test/system_msvc/system_msvc.sln | 6 +
   7 files changed, 99 insertions(+), 83 deletions(-)

Modified: trunk/boost/system/system_error.hpp
==============================================================================
--- trunk/boost/system/system_error.hpp (original)
+++ trunk/boost/system/system_error.hpp 2010-02-13 12:08:39 EST (Sat, 13 Feb 2010)
@@ -62,11 +62,8 @@
         try
         {
           m_what = this->std::runtime_error::what();
- if ( m_error_code )
- {
- if ( !m_what.empty() ) m_what += ": ";
- m_what += m_error_code.message();
- }
+ if ( !m_what.empty() ) m_what += ": ";
+ m_what += m_error_code.message();
         }
         catch (...) { return std::runtime_error::what(); }
       }

Modified: trunk/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj
==============================================================================
--- trunk/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj (original)
+++ trunk/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj 2010-02-13 12:08:39 EST (Sat, 13 Feb 2010)
@@ -42,6 +42,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
+ AdditionalIncludeDirectories=""
                                 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FILESYSTEM_DLL_EXPORTS"
                                 MinimalRebuild="true"
                                 BasicRuntimeChecks="3"

Modified: trunk/libs/system/test/error_code_test.cpp
==============================================================================
--- trunk/libs/system/test/error_code_test.cpp (original)
+++ trunk/libs/system/test/error_code_test.cpp 2010-02-13 12:08:39 EST (Sat, 13 Feb 2010)
@@ -7,7 +7,10 @@
 
 // See library home page at http://www.boost.org/libs/system
 
-//----------------------------------------------------------------------------//
+//----------------------------------------------------------------------------//
+
+// test without deprecated features
+#define BOOST_SYSTEM_NO_DEPRECATED
 
 #include <boost/config/warning_disable.hpp>
 
@@ -59,31 +62,31 @@
   std::cout << "General tests...\n";
   // unit tests:
 
- BOOST_TEST( posix_category == posix_category );
+ BOOST_TEST( generic_category == generic_category );
   BOOST_TEST( system_category == system_category );
- BOOST_TEST( posix_category != system_category );
- BOOST_TEST( system_category != posix_category );
+ BOOST_TEST( generic_category != system_category );
+ BOOST_TEST( system_category != generic_category );
 
- if ( std::less<const error_category*>()( &posix_category, &system_category ) )
+ if ( std::less<const error_category*>()( &generic_category, &system_category ) )
   {
- BOOST_TEST( posix_category < system_category );
- BOOST_TEST( !(system_category < posix_category) );
+ BOOST_TEST( generic_category < system_category );
+ BOOST_TEST( !(system_category < generic_category) );
   }
   else
   {
- BOOST_TEST( system_category < posix_category );
- BOOST_TEST( !(posix_category < system_category) );
+ BOOST_TEST( system_category < generic_category );
+ BOOST_TEST( !(generic_category < system_category) );
   }
 
 
   error_code ec;
- error_condition dec;
+ error_condition econd;
   BOOST_TEST( !ec );
   BOOST_TEST( ec.value() == 0 );
- dec = ec.default_error_condition();
- BOOST_TEST( dec.value() == 0 );
- BOOST_TEST( dec.category() == posix_category );
- BOOST_TEST( ec == posix::success );
+ econd = ec.default_error_condition();
+ BOOST_TEST( econd.value() == 0 );
+ BOOST_TEST( econd.category() == generic_category );
+ BOOST_TEST( ec == errc::success );
   BOOST_TEST( ec.category() == system_category );
   BOOST_TEST( std::strcmp( ec.category().name(), "system") == 0 );
   BOOST_TEST( !(ec < error_code( 0, system_category )) );
@@ -94,10 +97,10 @@
   error_code ec_0_system( 0, system_category );
   BOOST_TEST( !ec_0_system );
   BOOST_TEST( ec_0_system.value() == 0 );
- dec = ec_0_system.default_error_condition();
- BOOST_TEST( dec.value() == 0 );
- BOOST_TEST( dec.category() == posix_category );
- BOOST_TEST( ec_0_system == posix::success );
+ econd = ec_0_system.default_error_condition();
+ BOOST_TEST( econd.value() == 0 );
+ BOOST_TEST( econd.category() == generic_category );
+ BOOST_TEST( ec_0_system == errc::success );
   BOOST_TEST( ec_0_system.category() == system_category );
   BOOST_TEST( std::strcmp( ec_0_system.category().name(), "system") == 0 );
   check_ostream( ec_0_system, "system:0" );
@@ -115,38 +118,40 @@
   ec = error_code( BOOST_ACCESS_ERROR_MACRO, system_category );
   BOOST_TEST( ec );
   BOOST_TEST( ec.value() == BOOST_ACCESS_ERROR_MACRO );
- dec = ec.default_error_condition();
- BOOST_TEST( dec.value() == static_cast<int>(posix::permission_denied) );
- BOOST_TEST( dec.category() == posix_category );
- BOOST_TEST( dec == error_condition( posix::permission_denied, posix_category ) );
- BOOST_TEST( dec == posix::permission_denied );
- BOOST_TEST( posix::permission_denied == dec );
- BOOST_TEST( ec == posix::permission_denied );
+ econd = ec.default_error_condition();
+ BOOST_TEST( econd.value() == static_cast<int>(errc::permission_denied) );
+ BOOST_TEST( econd.category() == generic_category );
+ BOOST_TEST( econd == error_condition( errc::permission_denied, generic_category ) );
+ BOOST_TEST( econd == errc::permission_denied );
+ BOOST_TEST( errc::permission_denied == econd );
+ BOOST_TEST( ec == errc::permission_denied );
   BOOST_TEST( ec.category() == system_category );
   BOOST_TEST( std::strcmp( ec.category().name(), "system") == 0 );
 
- // test the explicit make_error_code conversion for posix
- ec = make_error_code( posix::bad_message );
+ // test the explicit make_error_code conversion for errc
+ ec = make_error_code( errc::bad_message );
   BOOST_TEST( ec );
- BOOST_TEST( ec == posix::bad_message );
- BOOST_TEST( posix::bad_message == ec );
- BOOST_TEST( ec != posix::permission_denied );
- BOOST_TEST( posix::permission_denied != ec );
- BOOST_TEST( ec.category() == posix_category );
-
- // test the deprecated predefined error_category synonyms
- BOOST_TEST( &system_category == &native_ecat );
- BOOST_TEST( &posix_category == &errno_ecat );
- BOOST_TEST( system_category == native_ecat );
- BOOST_TEST( posix_category == errno_ecat );
+ BOOST_TEST( ec == errc::bad_message );
+ BOOST_TEST( errc::bad_message == ec );
+ BOOST_TEST( ec != errc::permission_denied );
+ BOOST_TEST( errc::permission_denied != ec );
+ BOOST_TEST( ec.category() == generic_category );
+
+ //// test the deprecated predefined error_category synonyms
+ //BOOST_TEST( &system_category == &native_ecat );
+ //BOOST_TEST( &generic_category == &errno_ecat );
+ //BOOST_TEST( system_category == native_ecat );
+ //BOOST_TEST( generic_category == errno_ecat );
 
   // test error_code and error_condition message();
   // see Boost.Filesystem operations_test for code specific message() tests
   ec = error_code( -1, system_category );
   std::cout << "error_code message for -1 is \"" << ec.message() << "\"\n";
+ std::cout << "error_code message for 0 is \"" << ec_0_system.message() << "\"\n";
 #if defined(BOOST_WINDOWS_API)
   // Borland appends newline, so just check text
   BOOST_TEST( ec.message().substr(0,13) == "Unknown error" );
+ BOOST_TEST( ec_0_system.message().substr(0,36) == "The operation completed successfully" );
 #elif defined(linux) || defined(__linux) || defined(__linux__)
   // Linux appends value to message as unsigned, so it varies with # of bits
   BOOST_TEST( ec.message().substr(0,13) == "Unknown error" );
@@ -162,63 +167,66 @@
   BOOST_TEST( ec.message() != "" );
   BOOST_TEST( ec.message().substr( 0, 13) != "Unknown error" );
 
- dec = error_condition( -1, posix_category );
- std::cout << "error_condition message for -1 is \"" << dec.message() << "\"\n";
+ econd = error_condition( -1, generic_category );
+ error_condition econd_ok;
+ std::cout << "error_condition message for -1 is \"" << econd.message() << "\"\n";
+ std::cout << "error_condition message for 0 is \"" << econd_ok.message() << "\"\n";
 #if defined(BOOST_WINDOWS_API)
   // Borland appends newline, so just check text
- BOOST_TEST( dec.message().substr(0,13) == "Unknown error" );
+ BOOST_TEST( econd.message().substr(0,13) == "Unknown error" );
+ BOOST_TEST( econd_ok.message().substr(0,8) == "No error" );
 #elif defined(linux) || defined(__linux) || defined(__linux__)
   // Linux appends value to message as unsigned, so it varies with # of bits
- BOOST_TEST( dec.message().substr(0,13) == "Unknown error" );
+ BOOST_TEST( econd.message().substr(0,13) == "Unknown error" );
 #elif defined(__hpux)
- BOOST_TEST( dec.message() == "" );
+ BOOST_TEST( econd.message() == "" );
 #elif defined(__osf__)
- BOOST_TEST( dec.message() == "Error -1 occurred." );
+ BOOST_TEST( econd.message() == "Error -1 occurred." );
 #elif defined(__vms)
- BOOST_TEST( dec.message() == "error -1" );
+ BOOST_TEST( econd.message() == "error -1" );
 #endif
 
- dec = error_condition( BOOST_ACCESS_ERROR_MACRO, posix_category );
- BOOST_TEST( dec.message() != "" );
- BOOST_TEST( dec.message().substr( 0, 13) != "Unknown error" );
+ econd = error_condition( BOOST_ACCESS_ERROR_MACRO, generic_category );
+ BOOST_TEST( econd.message() != "" );
+ BOOST_TEST( econd.message().substr( 0, 13) != "Unknown error" );
 
 #ifdef BOOST_WINDOWS_API
   std::cout << "Windows tests...\n";
- // these tests probe the Windows posix decoder
+ // these tests probe the Windows errc decoder
   // test the first entry in the decoder table:
   ec = error_code( ERROR_ACCESS_DENIED, system_category );
   BOOST_TEST( ec.value() == ERROR_ACCESS_DENIED );
- BOOST_TEST( ec == posix::permission_denied );
- BOOST_TEST( ec.default_error_condition().value() == posix::permission_denied );
- BOOST_TEST( ec.default_error_condition().category() == posix_category );
+ BOOST_TEST( ec == errc::permission_denied );
+ BOOST_TEST( ec.default_error_condition().value() == errc::permission_denied );
+ BOOST_TEST( ec.default_error_condition().category() == generic_category );
 
   // test the second entry in the decoder table:
   ec = error_code( ERROR_ALREADY_EXISTS, system_category );
   BOOST_TEST( ec.value() == ERROR_ALREADY_EXISTS );
- BOOST_TEST( ec == posix::file_exists );
- BOOST_TEST( ec.default_error_condition().value() == posix::file_exists );
- BOOST_TEST( ec.default_error_condition().category() == posix_category );
+ BOOST_TEST( ec == errc::file_exists );
+ BOOST_TEST( ec.default_error_condition().value() == errc::file_exists );
+ BOOST_TEST( ec.default_error_condition().category() == generic_category );
 
   // test the third entry in the decoder table:
   ec = error_code( ERROR_BAD_UNIT, system_category );
   BOOST_TEST( ec.value() == ERROR_BAD_UNIT );
- BOOST_TEST( ec == posix::no_such_device );
- BOOST_TEST( ec.default_error_condition().value() == posix::no_such_device );
- BOOST_TEST( ec.default_error_condition().category() == posix_category );
+ BOOST_TEST( ec == errc::no_such_device );
+ BOOST_TEST( ec.default_error_condition().value() == errc::no_such_device );
+ BOOST_TEST( ec.default_error_condition().category() == generic_category );
 
   // test the last non-Winsock entry in the decoder table:
   ec = error_code( ERROR_WRITE_PROTECT, system_category );
   BOOST_TEST( ec.value() == ERROR_WRITE_PROTECT );
- BOOST_TEST( ec == posix::permission_denied );
- BOOST_TEST( ec.default_error_condition().value() == posix::permission_denied );
- BOOST_TEST( ec.default_error_condition().category() == posix_category );
+ BOOST_TEST( ec == errc::permission_denied );
+ BOOST_TEST( ec.default_error_condition().value() == errc::permission_denied );
+ BOOST_TEST( ec.default_error_condition().category() == generic_category );
 
   // test the last Winsock entry in the decoder table:
   ec = error_code( WSAEWOULDBLOCK, system_category );
   BOOST_TEST( ec.value() == WSAEWOULDBLOCK );
- BOOST_TEST( ec == posix::operation_would_block );
- BOOST_TEST( ec.default_error_condition().value() == posix::operation_would_block );
- BOOST_TEST( ec.default_error_condition().category() == posix_category );
+ BOOST_TEST( ec == errc::operation_would_block );
+ BOOST_TEST( ec.default_error_condition().value() == errc::operation_would_block );
+ BOOST_TEST( ec.default_error_condition().category() == generic_category );
 
   // test not-in-table condition:
   ec = error_code( 1234567890, system_category );
@@ -230,12 +238,12 @@
 
   std::cout << "POSIX tests...\n";
   ec = error_code( EACCES, system_category );
- BOOST_TEST( ec == error_code( posix::permission_denied, system_category ) );
- BOOST_TEST( error_code( posix::permission_denied, system_category ) == ec );
- BOOST_TEST( ec == posix::permission_denied );
- BOOST_TEST( posix::permission_denied == ec );
- BOOST_TEST( ec.default_error_condition().value() == posix::permission_denied );
- BOOST_TEST( ec.default_error_condition().category() == posix_category );
+ BOOST_TEST( ec == error_code( errc::permission_denied, system_category ) );
+ BOOST_TEST( error_code( errc::permission_denied, system_category ) == ec );
+ BOOST_TEST( ec == errc::permission_denied );
+ BOOST_TEST( errc::permission_denied == ec );
+ BOOST_TEST( ec.default_error_condition().value() == errc::permission_denied );
+ BOOST_TEST( ec.default_error_condition().category() == generic_category );
 
 # ifdef __CYGWIN__
 

Modified: trunk/libs/system/test/system_error_test.cpp
==============================================================================
--- trunk/libs/system/test/system_error_test.cpp (original)
+++ trunk/libs/system/test/system_error_test.cpp 2010-02-13 12:08:39 EST (Sat, 13 Feb 2010)
@@ -9,6 +9,9 @@
 
 //----------------------------------------------------------------------------//
 
+// test without deprecated features
+#define BOOST_SYSTEM_NO_DEPRECATED
+
 #include <boost/config/warning_disable.hpp>
 
 #include <boost/test/minimal.hpp>
@@ -80,24 +83,24 @@
   system_error c6_0( 0, system_category, "c6_0" );
   system_error c6_1( 1, system_category, "c6_1" );
 
- TEST( c1_0, 0, "" );
+ TEST( c1_0, 0, "The operation completed successfully" );
   TEST( c1_1, 1, "Incorrect function" );
   TEST( c1_2u, 2, "The system cannot find the file specified" );
 
- TEST( c2_0, 0, "c2_0" );
+ TEST( c2_0, 0, "c2_0: The operation completed successfully" );
   TEST( c2_1, 1, "c2_1: Incorrect function" );
 
- TEST( c3_0, 0, "c3_0" );
+ TEST( c3_0, 0, "c3_0: The operation completed successfully" );
   TEST( c3_1, 1, "c3_1: Incorrect function" );
 
- TEST( c4_0, 0, "" );
+ TEST( c4_0, 0, "The operation completed successfully" );
   TEST( c4_1, 1, "Incorrect function" );
   TEST( c4_2u, 2, "The system cannot find the file specified" );
 
- TEST( c5_0, 0, "c5_0" );
+ TEST( c5_0, 0, "c5_0: The operation completed successfully" );
   TEST( c5_1, 1, "c5_1: Incorrect function" );
 
- TEST( c6_0, 0, "c6_0" );
+ TEST( c6_0, 0, "c6_0: The operation completed successfully" );
   TEST( c6_1, 1, "c6_1: Incorrect function" );
 
   return 0;

Modified: trunk/libs/system/test/system_msvc/common.vsprops
==============================================================================
--- trunk/libs/system/test/system_msvc/common.vsprops (original)
+++ trunk/libs/system/test/system_msvc/common.vsprops 2010-02-13 12:08:39 EST (Sat, 13 Feb 2010)
@@ -9,6 +9,7 @@
                 AdditionalIncludeDirectories="../../../../.."
                 PreprocessorDefinitions="BOOST_ALL_NO_LIB"
                 ExceptionHandling="2"
+ WarningLevel="4"
         />
         <Tool
                 Name="VCPostBuildEventTool"

Modified: trunk/libs/system/test/system_msvc/error_code_test/error_code_test.vcproj
==============================================================================
--- trunk/libs/system/test/system_msvc/error_code_test/error_code_test.vcproj (original)
+++ trunk/libs/system/test/system_msvc/error_code_test/error_code_test.vcproj 2010-02-13 12:08:39 EST (Sat, 13 Feb 2010)
@@ -47,7 +47,7 @@
                                 BasicRuntimeChecks="3"
                                 RuntimeLibrary="3"
                                 UsePrecompiledHeader="0"
- WarningLevel="3"
+ WarningLevel="4"
                                 DebugInformationFormat="4"
                         />
                         <Tool
@@ -120,7 +120,7 @@
                                 RuntimeLibrary="2"
                                 EnableFunctionLevelLinking="true"
                                 UsePrecompiledHeader="0"
- WarningLevel="3"
+ WarningLevel="4"
                                 DebugInformationFormat="3"
                         />
                         <Tool

Modified: trunk/libs/system/test/system_msvc/system_msvc.sln
==============================================================================
--- trunk/libs/system/test/system_msvc/system_msvc.sln (original)
+++ trunk/libs/system/test/system_msvc/system_msvc.sln 2010-02-13 12:08:39 EST (Sat, 13 Feb 2010)
@@ -3,6 +3,8 @@
 # Visual C++ Express 2008
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "error_code_test", "error_code_test\error_code_test.vcproj", "{81960557-E9A9-4E81-AC96-9E11C33CB058}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "system_error_test", "system_error_test\system_error_test.vcproj", "{CBD12E59-99E5-4F35-9B66-0554D0FBDB76}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -13,6 +15,10 @@
                 {81960557-E9A9-4E81-AC96-9E11C33CB058}.Debug|Win32.Build.0 = Debug|Win32
                 {81960557-E9A9-4E81-AC96-9E11C33CB058}.Release|Win32.ActiveCfg = Release|Win32
                 {81960557-E9A9-4E81-AC96-9E11C33CB058}.Release|Win32.Build.0 = Release|Win32
+ {CBD12E59-99E5-4F35-9B66-0554D0FBDB76}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CBD12E59-99E5-4F35-9B66-0554D0FBDB76}.Debug|Win32.Build.0 = Debug|Win32
+ {CBD12E59-99E5-4F35-9B66-0554D0FBDB76}.Release|Win32.ActiveCfg = Release|Win32
+ {CBD12E59-99E5-4F35-9B66-0554D0FBDB76}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE


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