Boost logo

Boost-Commit :

From: bdawes_at_[hidden]
Date: 2007-09-26 13:48:28


Author: bemandawes
Date: 2007-09-26 13:48:27 EDT (Wed, 26 Sep 2007)
New Revision: 39553
URL: http://svn.boost.org/trac/boost/changeset/39553

Log:
Turns out the --dep_name errors were due to functions in the wrong namespace (Chris Kohlhoff)
Text files modified:
   trunk/boost/filesystem/convenience.hpp | 3 -
   trunk/boost/system/error_code.hpp | 47 ++++++++++++++++++++++-----------------
   trunk/libs/filesystem/src/path.cpp | 2
   trunk/libs/system/test/error_code_user_test.cpp | 33 +++++++++++++++++-----------
   4 files changed, 48 insertions(+), 37 deletions(-)

Modified: trunk/boost/filesystem/convenience.hpp
==============================================================================
--- trunk/boost/filesystem/convenience.hpp (original)
+++ trunk/boost/filesystem/convenience.hpp 2007-09-26 13:48:27 EDT (Wed, 26 Sep 2007)
@@ -45,8 +45,7 @@
            if ( !ph.empty() && !is_directory(ph) )
                boost::throw_exception( basic_filesystem_error<Path>(
                  "boost::filesystem::create_directories", ph,
- boost::system::make_error_code(
- boost::system::posix::file_exists ) ) );
+ make_error_code( boost::system::posix::file_exists ) ) );
            return false;
          }
 

Modified: trunk/boost/system/error_code.hpp
==============================================================================
--- trunk/boost/system/error_code.hpp (original)
+++ trunk/boost/system/error_code.hpp 2007-09-26 13:48:27 EDT (Wed, 26 Sep 2007)
@@ -172,10 +172,6 @@
     static const error_category & errno_ecat = get_posix_category();
     static const error_category & native_ecat = get_system_category();
 
- // EDG with --dep_name requires make_error_condition be defined before use
-
- template <class T> error_condition make_error_condition(T);
-
     // class error_condition -----------------------------------------------//
 
     // error_conditions are portable, error_codes are system or lib specific
@@ -259,10 +255,6 @@
 
     };
 
- // EDG with --dep_name requires make_error_code be defined before use
-
- template <class T> error_code make_error_code(T);
-
     // class error_code ----------------------------------------------------//
 
     // We want error_code to be a value type that can be copied without slicing
@@ -408,13 +400,16 @@
 
     // make_* functions for posix::posix_errno -----------------------------//
 
- // explicit conversion:
- template<> inline error_code make_error_code( posix::posix_errno e )
- { return error_code( e, posix_category ); }
-
- // implicit conversion:
- template<> inline error_condition make_error_condition( posix::posix_errno e )
- { return error_condition( e, posix_category ); }
+ namespace posix
+ {
+ // explicit conversion:
+ inline error_code make_error_code( posix_errno e )
+ { return error_code( e, posix_category ); }
+
+ // implicit conversion:
+ inline error_condition make_error_condition( posix_errno e )
+ { return error_condition( e, posix_category ); }
+ }
 
     // error_category default implementation -------------------------------//
 
@@ -496,8 +491,11 @@
     template<> struct is_error_code_enum<cygwin::cygwin_errno>
       { static const bool value = true; };
 
- template<> inline error_code make_error_code(cygwin::cygwin_errno e)
- { return error_code( e, system_category ); }
+ namespace cygwin
+ {
+ inline error_code make_error_code( cygwin_errno e )
+ { return error_code( e, system_category ); }
+ }
 
 # elif defined(linux) || defined(__linux) || defined(__linux__)
 
@@ -563,8 +561,11 @@
     template<> struct is_error_code_enum<Linux::linux_error>
       { static const bool value = true; };
 
- template<> inline error_code make_error_code(Linux::linux_error e)
- { return error_code( e, system_category ); }
+ namespace Linux
+ {
+ inline error_code make_error_code( linux_error e )
+ { return error_code( e, system_category ); }
+ }
 
 # endif
 
@@ -642,13 +643,17 @@
 
         // TODO: add more Windows errors
       };
+
     } // namespace windows
 
     template<> struct is_error_code_enum<windows::windows_error>
       { static const bool value = true; };
 
- template<> inline error_code make_error_code(windows::windows_error e)
- { return error_code( e, system_category ); }
+ namespace windows
+ {
+ inline error_code make_error_code( windows_error e )
+ { return error_code( e, system_category ); }
+ }
 
 #else
 # error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined

Modified: trunk/libs/filesystem/src/path.cpp
==============================================================================
--- trunk/libs/filesystem/src/path.cpp (original)
+++ trunk/libs/filesystem/src/path.cpp 2007-09-26 13:48:27 EDT (Wed, 26 Sep 2007)
@@ -69,7 +69,7 @@
       if ( locked ) boost::throw_exception(
         wfilesystem_error(
           "boost::filesystem::wpath_traits::imbue() after lockdown",
- system::make_error_code( system::posix::not_supported ) ) );
+ make_error_code( system::posix::not_supported ) ) );
       imbue( new_loc, std::nothrow );
     }
 

Modified: trunk/libs/system/test/error_code_user_test.cpp
==============================================================================
--- trunk/libs/system/test/error_code_user_test.cpp (original)
+++ trunk/libs/system/test/error_code_user_test.cpp 2007-09-26 13:48:27 EDT (Wed, 26 Sep 2007)
@@ -73,23 +73,26 @@
   namespace lib3
   {
     // lib3 has its own error_category:
- extern const boost::system::error_category & lib3_error_category;
+ const boost::system::error_category & get_lib3_error_category();
+ const boost::system::error_category & lib3_error_category = get_lib3_error_category();
     
     enum error
     {
       boo_boo=123,
       big_boo_boo
     };
-
   }
 
   namespace system
   {
     template<> struct is_error_code_enum<boost::lib3::error>
       { static const bool value = true; };
+ }
 
- template<> inline error_code make_error_code(boost::lib3::error e)
- { return error_code(e,boost::lib3::lib3_error_category); }
+ namespace lib3
+ {
+ inline boost::system::error_code make_error_code(error e)
+ { return boost::system::error_code(e,lib3_error_category); }
   }
 
 }
@@ -125,12 +128,14 @@
         if ( ev == big_boo_boo ) return std::string("big boo boo");
         return std::string("unknown error");
       }
- };
 
- const lib3_error_category_imp lib3_error_category_const;
+ };
 
- const boost::system::error_category & lib3_error_category
- = lib3_error_category_const;
+ const boost::system::error_category & get_lib3_error_category()
+ {
+ static const lib3_error_category_imp l3ecat;
+ return l3ecat;
+ }
   }
 }
 
@@ -147,7 +152,8 @@
 namespace lib4
 {
   // lib4 has its own error_category:
- extern const boost::system::error_category & lib4_error_category;
+ const boost::system::error_category & get_lib4_error_category();
+ const boost::system::error_category & lib4_error_category = get_lib4_error_category();
   
   extern const boost::system::error_code boo_boo;
   extern const boost::system::error_code big_boo_boo;
@@ -183,10 +189,11 @@
     }
   };
 
- const lib4_error_category_imp lib4_error_category_const;
-
- const boost::system::error_category & lib4_error_category
- = lib4_error_category_const;
+ const boost::system::error_category & get_lib4_error_category()
+ {
+ static const lib4_error_category_imp l4ecat;
+ return l4ecat;
+ }
 
   const boost::system::error_code boo_boo( 456, lib4_error_category );
   const boost::system::error_code big_boo_boo( 789, lib4_error_category );


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