Turns out the --dep_name errors were due to functions in the wrong namespace (Chris Kohlhoff)

[SVN r39553]
This commit is contained in:
Beman Dawes
2007-09-26 17:48:27 +00:00
parent 4bd0f9e70d
commit 35374bcb3d
2 changed files with 45 additions and 33 deletions

View File

@ -172,10 +172,6 @@ namespace boost
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 @@ namespace boost
};
// 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 @@ namespace boost
// 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 ); }
namespace posix
{
// explicit conversion:
inline error_code make_error_code( 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 ); }
// 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 @@ namespace boost
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 @@ namespace boost
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 @@ namespace boost
// 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

View File

@ -73,23 +73,26 @@ namespace boost
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 @@ namespace boost
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 boost
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 @@ namespace lib4
}
};
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 );