forked from boostorg/system
Fix MinGW link errors by properly exporting symbols
This commit is contained in:
@ -43,19 +43,14 @@ namespace detail
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef BOOST_ERROR_CODE_HEADER_ONLY
|
#ifdef BOOST_ERROR_CODE_HEADER_ONLY
|
||||||
# define BOOST_SYSTEM_INLINE inline
|
# define BOOST_SYSTEM_DECL_ inline
|
||||||
#else
|
#else
|
||||||
# define BOOST_SYSTEM_INLINE
|
# define BOOST_SYSTEM_DECL_ BOOST_SYSTEM_DECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// generic_error_category implementation ---------------------------------//
|
// generic_error_category implementation ---------------------------------//
|
||||||
|
|
||||||
BOOST_SYSTEM_INLINE const char * generic_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
BOOST_SYSTEM_DECL_ std::string generic_error_category::message( int ev ) const
|
||||||
{
|
|
||||||
return "generic";
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_SYSTEM_INLINE std::string generic_error_category::message( int ev ) const
|
|
||||||
{
|
{
|
||||||
using namespace boost::system::errc;
|
using namespace boost::system::errc;
|
||||||
#if defined(__PGI)
|
#if defined(__PGI)
|
||||||
@ -148,12 +143,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
// system_error_category implementation --------------------------------------------//
|
// system_error_category implementation --------------------------------------------//
|
||||||
|
|
||||||
BOOST_SYSTEM_INLINE const char * system_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
BOOST_SYSTEM_DECL_ error_condition system_error_category::default_error_condition( int ev ) const
|
||||||
{
|
|
||||||
return "system";
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_SYSTEM_INLINE error_condition system_error_category::default_error_condition( int ev ) const
|
|
||||||
BOOST_SYSTEM_NOEXCEPT
|
BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
using namespace boost::system::errc;
|
using namespace boost::system::errc;
|
||||||
@ -358,13 +348,13 @@ namespace detail
|
|||||||
|
|
||||||
# if !defined( BOOST_WINDOWS_API )
|
# if !defined( BOOST_WINDOWS_API )
|
||||||
|
|
||||||
BOOST_SYSTEM_INLINE std::string system_error_category::message( int ev ) const
|
BOOST_SYSTEM_DECL_ std::string system_error_category::message( int ev ) const
|
||||||
{
|
{
|
||||||
return generic_category().message( ev );
|
return generic_category().message( ev );
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
|
|
||||||
BOOST_SYSTEM_INLINE std::string system_error_category::message( int ev ) const
|
BOOST_SYSTEM_DECL_ std::string system_error_category::message( int ev ) const
|
||||||
{
|
{
|
||||||
#if defined(UNDER_CE) || BOOST_PLAT_WINDOWS_RUNTIME || defined(BOOST_NO_ANSI_APIS)
|
#if defined(UNDER_CE) || BOOST_PLAT_WINDOWS_RUNTIME || defined(BOOST_NO_ANSI_APIS)
|
||||||
std::wstring buf(128, wchar_t());
|
std::wstring buf(128, wchar_t());
|
||||||
@ -443,7 +433,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#undef BOOST_SYSTEM_INLINE
|
#undef BOOST_SYSTEM_DECL_
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
@ -474,17 +464,17 @@ namespace detail
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
BOOST_SYSTEM_CONST_INIT const system_error_category system_category_const;
|
BOOST_SYSTEM_CONST_INIT BOOST_SYSTEM_DECL system_error_category system_category_instance;
|
||||||
BOOST_SYSTEM_CONST_INIT const generic_error_category generic_category_const;
|
BOOST_SYSTEM_CONST_INIT BOOST_SYSTEM_DECL generic_error_category generic_category_instance;
|
||||||
|
|
||||||
BOOST_SYSTEM_DECL const error_category & system_category_ncx() BOOST_SYSTEM_NOEXCEPT
|
BOOST_SYSTEM_DECL const error_category & system_category_ncx() BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
return system_category_const;
|
return system_category_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_SYSTEM_DECL const error_category & generic_category_ncx() BOOST_SYSTEM_NOEXCEPT
|
BOOST_SYSTEM_DECL const error_category & generic_category_ncx() BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
return generic_category_const;
|
return generic_category_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
@ -498,14 +488,14 @@ namespace detail
|
|||||||
|
|
||||||
BOOST_SYSTEM_DECL const error_category & system_category_ncx() BOOST_SYSTEM_NOEXCEPT
|
BOOST_SYSTEM_DECL const error_category & system_category_ncx() BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
static const detail::system_error_category system_category_const;
|
static const detail::system_error_category system_category_instance;
|
||||||
return system_category_const;
|
return system_category_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_SYSTEM_DECL const error_category & generic_category_ncx() BOOST_SYSTEM_NOEXCEPT
|
BOOST_SYSTEM_DECL const error_category & generic_category_ncx() BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
static const detail::generic_error_category generic_category_const;
|
static const detail::generic_error_category generic_category_instance;
|
||||||
return generic_category_const;
|
return generic_category_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
@ -338,22 +338,38 @@ namespace boost
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
class generic_error_category : public error_category
|
#ifdef BOOST_ERROR_CODE_HEADER_ONLY
|
||||||
{
|
# define BOOST_SYSTEM_DECL_
|
||||||
public:
|
#else
|
||||||
BOOST_SYSTEM_CONSTEXPR generic_error_category(){}
|
# define BOOST_SYSTEM_DECL_ BOOST_SYSTEM_DECL
|
||||||
const char * name() const BOOST_SYSTEM_NOEXCEPT;
|
#endif
|
||||||
std::string message( int ev ) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class system_error_category : public error_category
|
class generic_error_category: public error_category
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
const char * name() const BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
public:
|
return "generic";
|
||||||
BOOST_SYSTEM_CONSTEXPR system_error_category(){}
|
}
|
||||||
const char * name() const BOOST_SYSTEM_NOEXCEPT;
|
|
||||||
std::string message( int ev ) const;
|
BOOST_SYSTEM_DECL_ std::string message( int ev ) const;
|
||||||
error_condition default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT;
|
};
|
||||||
};
|
|
||||||
|
class system_error_category: public error_category
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
const char * name() const BOOST_SYSTEM_NOEXCEPT
|
||||||
|
{
|
||||||
|
return "system";
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_SYSTEM_DECL_ std::string message( int ev ) const;
|
||||||
|
BOOST_SYSTEM_DECL_ error_condition default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT;
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef BOOST_SYSTEM_DECL_
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
@ -361,14 +377,14 @@ namespace detail
|
|||||||
|
|
||||||
BOOST_SYSTEM_CONSTEXPR inline const error_category & system_category() BOOST_SYSTEM_NOEXCEPT
|
BOOST_SYSTEM_CONSTEXPR inline const error_category & system_category() BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
static const detail::system_error_category system_category_const;
|
static const detail::system_error_category system_category_instance;
|
||||||
return system_category_const;
|
return system_category_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_SYSTEM_CONSTEXPR inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
|
BOOST_SYSTEM_CONSTEXPR inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
static const detail::generic_error_category generic_category_const;
|
static const detail::generic_error_category generic_category_instance;
|
||||||
return generic_category_const;
|
return generic_category_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(BOOST_SYSTEM_HAS_CONSTEXPR)
|
#elif defined(BOOST_SYSTEM_HAS_CONSTEXPR)
|
||||||
@ -376,19 +392,19 @@ BOOST_SYSTEM_CONSTEXPR inline const error_category & generic_category() BOOST_SY
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
extern const system_error_category system_category_const;
|
extern system_error_category system_category_instance;
|
||||||
extern const generic_error_category generic_category_const;
|
extern generic_error_category generic_category_instance;
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
constexpr const error_category & system_category() BOOST_SYSTEM_NOEXCEPT
|
constexpr const error_category & system_category() BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
return detail::system_category_const;
|
return detail::system_category_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
|
constexpr const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
|
||||||
{
|
{
|
||||||
return detail::generic_category_const;
|
return detail::generic_category_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -38,7 +38,6 @@ static void test_generic_category()
|
|||||||
std::error_category const & st = bt;
|
std::error_category const & st = bt;
|
||||||
|
|
||||||
BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
|
BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
|
||||||
BOOST_TEST_EQ( bt.name(), st.name() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_system_category()
|
static void test_system_category()
|
||||||
@ -47,7 +46,6 @@ static void test_system_category()
|
|||||||
std::error_category const & st = bt;
|
std::error_category const & st = bt;
|
||||||
|
|
||||||
BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
|
BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
|
||||||
BOOST_TEST_EQ( bt.name(), st.name() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
Reference in New Issue
Block a user