|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62140 - in trunk: boost/config boost/config/compiler boost/config/platform boost/system libs/config/doc libs/system/test libs/system/test/system_msvc libs/system/test/system_msvc/error_code_test
From: bdawes_at_[hidden]
Date: 2010-05-22 08:12:03
Author: bemandawes
Date: 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
New Revision: 62140
URL: http://svn.boost.org/trac/boost/changeset/62140
Log:
Major upgrade to Boost.Config symbol visibility macros for shared libraries, based on patches from Jürgen Hunold with mods by Beman Dawes. Upgrade Boost.System to use the new visibility macros. Fixes #3697 and provides foundation for fixing 2114, 2309, etc.
Added:
trunk/libs/system/test/dynamic_link_test.cpp (contents, props changed)
trunk/libs/system/test/throw_test.cpp (contents, props changed)
Text files modified:
trunk/boost/config/compiler/borland.hpp | 5 +
trunk/boost/config/compiler/clang.hpp | 6 --
trunk/boost/config/compiler/codegear.hpp | 5 +
trunk/boost/config/compiler/gcc.hpp | 22 ++++++++
trunk/boost/config/compiler/visualc.hpp | 5 --
trunk/boost/config/platform/win32.hpp | 9 +++
trunk/boost/config/suffix.hpp | 13 +++++
trunk/boost/system/config.hpp | 37 +++++---------
trunk/boost/system/system_error.hpp | 6 +
trunk/libs/config/doc/macro_reference.qbk | 100 +++++++++++++++++++++++++++++++++++++--
trunk/libs/system/test/Jamfile.v2 | 16 +++++-
trunk/libs/system/test/error_code_test.cpp | 6 ++
trunk/libs/system/test/error_code_user_test.cpp | 48 +++++++++---------
trunk/libs/system/test/header_only_test.cpp | 5 -
trunk/libs/system/test/initialization_test.cpp | 4
trunk/libs/system/test/system_error_test.cpp | 10 ++--
trunk/libs/system/test/system_msvc/common.vsprops | 6 +-
trunk/libs/system/test/system_msvc/error_code_test/error_code_test.vcproj | 8 +-
trunk/libs/system/test/system_msvc/system_msvc.sln | 31 ++++++++++++
19 files changed, 249 insertions(+), 93 deletions(-)
Modified: trunk/boost/config/compiler/borland.hpp
==============================================================================
--- trunk/boost/config/compiler/borland.hpp (original)
+++ trunk/boost/config/compiler/borland.hpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -230,8 +230,9 @@
//
// all versions support __declspec:
//
-#ifndef __STRICT_ANSI__
-# define BOOST_HAS_DECLSPEC
+#if defined(__STRICT_ANSI__)
+// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
+# define BOOST_SYMBOL_EXPORT
#endif
//
// ABI fixing headers:
Modified: trunk/boost/config/compiler/clang.hpp
==============================================================================
--- trunk/boost/config/compiler/clang.hpp (original)
+++ trunk/boost/config/compiler/clang.hpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -18,12 +18,6 @@
# define BOOST_NO_RTTI
#endif
-#if defined(__int32)
-// HACK: Clang only defines the type __int32 in Microsoft-compatibility mode,
-// which means that declspecs are also available
-# define BOOST_HAS_DECLSPEC
-#endif
-
#if defined(__int64)
# define BOOST_HAS_MS_INT64
#endif
Modified: trunk/boost/config/compiler/codegear.hpp
==============================================================================
--- trunk/boost/config/compiler/codegear.hpp (original)
+++ trunk/boost/config/compiler/codegear.hpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -147,8 +147,9 @@
//
// all versions support __declspec:
//
-#if !defined(__STRICT_ANSI__)
-# define BOOST_HAS_DECLSPEC
+#if defined(__STRICT_ANSI__)
+// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
+# define BOOST_SYMBOL_EXPORT
#endif
//
// ABI fixing headers:
Modified: trunk/boost/config/compiler/gcc.hpp
==============================================================================
--- trunk/boost/config/compiler/gcc.hpp (original)
+++ trunk/boost/config/compiler/gcc.hpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -108,6 +108,28 @@
#if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 )
#define BOOST_HAS_NRVO
#endif
+
+//
+// Dynamic shared object (DSO) and dynamic-link library (DLL) support
+//
+#if __GNUC__ >= 4
+# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ // All Win32 development environments, including 64-bit Windows and MinGW, define
+ // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment,
+ // so does not define _WIN32 or its variants.
+# define BOOST_HAS_DECLSPEC
+# define BOOST_SYMBOL_EXPORT __attribute__((dllexport))
+# define BOOST_SYMBOL_IMPORT __attribute__((dllimport))
+# else
+# define BOOST_SYMBOL_EXPORT __attribute__((visibility("default")))
+# define BOOST_SYMBOL_IMPORT
+# endif
+# define BOOST_SYMBOL_VISIBLE __attribute__((visibility("default")))
+#else
+// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
+# define BOOST_SYMBOL_EXPORT
+#endif
+
//
// RTTI and typeinfo detection is possible post gcc-4.3:
//
Modified: trunk/boost/config/compiler/visualc.hpp
==============================================================================
--- trunk/boost/config/compiler/visualc.hpp (original)
+++ trunk/boost/config/compiler/visualc.hpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -164,11 +164,6 @@
#endif
//
-// all versions support __declspec:
-//
-#define BOOST_HAS_DECLSPEC
-
-//
// C++0x features
//
// See above for BOOST_NO_LONG_LONG
Modified: trunk/boost/config/platform/win32.hpp
==============================================================================
--- trunk/boost/config/platform/win32.hpp (original)
+++ trunk/boost/config/platform/win32.hpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -21,10 +21,17 @@
# define BOOST_NO_SWPRINTF
#endif
-#if !defined(__GNUC__) && !defined(BOOST_HAS_DECLSPEC)
+// Default defines for BOOST_SYMBOL_EXPORT and BOOST_SYMBOL_IMPORT
+// If a compiler doesn't support __declspec(dllexport)/__declspec(dllimport),
+// its boost/config/compiler/ file must define BOOST_SYMBOL_EXPORT and
+// BOOST_SYMBOL_IMPORT
+#ifndef BOOST_SYMBOL_EXPORT
# define BOOST_HAS_DECLSPEC
+# define BOOST_SYMBOL_EXPORT __declspec(dllexport)
+# define BOOST_SYMBOL_IMPORT __declspec(dllimport)
#endif
+
#if defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 2) || ((__MINGW32_MAJOR_VERSION == 2) && (__MINGW32_MINOR_VERSION >= 0)))
# define BOOST_HAS_STDINT_H
# define __STDC_LIMIT_MACROS
Modified: trunk/boost/config/suffix.hpp
==============================================================================
--- trunk/boost/config/suffix.hpp (original)
+++ trunk/boost/config/suffix.hpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -26,6 +26,19 @@
#define BOOST_CONFIG_SUFFIX_HPP
//
+// ensure that visibility macros are always defined, thus symplifying use
+//
+#ifndef BOOST_SYMBOL_EXPORT
+# define BOOST_SYMBOL_EXPORT
+#endif
+#ifndef BOOST_SYMBOL_IMPORT
+# define BOOST_SYMBOL_IMPORT
+#endif
+#ifndef BOOST_SYMBOL_VISIBLE
+# define BOOST_SYMBOL_VISIBLE
+#endif
+
+//
// look for long long by looking for the appropriate macros in <limits.h>.
// Note that we use limits.h rather than climits for maximal portability,
// remember that since these just declare a bunch of macros, there should be
Modified: trunk/boost/system/config.hpp
==============================================================================
--- trunk/boost/system/config.hpp (original)
+++ trunk/boost/system/config.hpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -1,4 +1,4 @@
-// boost/system/config.hpp -------------------------------------------------//
+// boost/system/config.hpp -----------------------------------------------------------//
// Copyright Beman Dawes 2003, 2006
@@ -18,40 +18,29 @@
# if defined( BOOST_WINDOWS_API ) && defined( BOOST_POSIX_API )
# error both BOOST_WINDOWS_API and BOOST_POSIX_API are defined
# elif !defined( BOOST_WINDOWS_API ) && !defined( BOOST_POSIX_API )
-# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)
+# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ // All Win32 development environments, including 64-bit Windows and MinGW, define
+ // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment,
+ // so does not define _WIN32 or its variants.
# define BOOST_WINDOWS_API
# else
# define BOOST_POSIX_API
# endif
# endif
-// enable dynamic linking on Windows ---------------------------------------//
+// enable dynamic or static linking as requested --------------------------------------//
-//# if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SYSTEM_DYN_LINK)) && defined(__BORLANDC__) && defined(__WIN32__)
-//# error Dynamic linking Boost.System does not work for Borland; use static linking instead
-//# endif
-
-#ifdef BOOST_HAS_DECLSPEC // defined in config system
-// we need to import/export our code only if the user has specifically
-// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
-// libraries to be dynamically linked, or BOOST_SYSTEM_DYN_LINK
-// if they want just this one to be dynamically liked:
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SYSTEM_DYN_LINK)
-// export if this is our own source, otherwise import:
-#ifdef BOOST_SYSTEM_SOURCE
-# define BOOST_SYSTEM_DECL __declspec(dllexport)
+# if defined(BOOST_SYSTEM_SOURCE)
+# define BOOST_SYSTEM_DECL BOOST_SYMBOL_EXPORT
+# else
+# define BOOST_SYSTEM_DECL BOOST_SYMBOL_IMPORT
+# endif
#else
-# define BOOST_SYSTEM_DECL __declspec(dllimport)
-#endif // BOOST_SYSTEM_SOURCE
-#endif // DYN_LINK
-#endif // BOOST_HAS_DECLSPEC
-//
-// if BOOST_SYSTEM_DECL isn't defined yet define it now:
-#ifndef BOOST_SYSTEM_DECL
-#define BOOST_SYSTEM_DECL
+# define BOOST_SYSTEM_DECL
#endif
-// enable automatic library variant selection ------------------------------//
+// enable automatic library variant selection ----------------------------------------//
#if !defined(BOOST_SYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SYSTEM_NO_LIB)
//
Modified: trunk/boost/system/system_error.hpp
==============================================================================
--- trunk/boost/system/system_error.hpp (original)
+++ trunk/boost/system/system_error.hpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -17,9 +17,11 @@
{
namespace system
{
- // class system_error --------------------------------------------------//
+ // class system_error ------------------------------------------------------------//
- class system_error : public std::runtime_error
+ class BOOST_SYMBOL_VISIBLE system_error : public std::runtime_error
+ // BOOST_SYMBOL_VISIBLE is needed by GCC to ensure system_error thrown from a shared
+ // library can be caught. See svn.boost.org/trac/boost/ticket/3697
{
public:
system_error( error_code ec )
Modified: trunk/libs/config/doc/macro_reference.qbk
==============================================================================
--- trunk/libs/config/doc/macro_reference.qbk (original)
+++ trunk/libs/config/doc/macro_reference.qbk 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -317,6 +317,7 @@
[#config_features]
+
[section Macros that describe optional features]
The following macros describe features that are not required by the C++
@@ -332,10 +333,6 @@
[[`BOOST_HAS_CLOCK_GETTIME`][Platform][
The platform has the POSIX API `clock_gettime`.
]]
-[[`BOOST_HAS_DECLSPEC`][Compiler][
-The compiler uses `__declspec(dllexport)` and `__declspec(dllimport)` to
-export/import symbols from dll's.
-]]
[[`BOOST_HAS_DIRENT_H`][Platform][
The platform has the POSIX header `<dirent.h>`.
]]
@@ -868,9 +865,98 @@
[section Macros for libraries with separate source code]
The following macros and helper headers are of use to authors whose libraries
-include separate source code, and are intended to address two issues: fixing
-the ABI of the compiled library, and selecting which compiled library to link
-against based upon the compilers settings.
+include separate source code, and are intended to address several issues:
+
+* Controlling shared library symbol visibility
+* Fixing the ABI of the compiled library
+* Selecting which compiled library to link against based upon the compilers settings
+
+See [@http://svn.boost.org/trac/boost/wiki/Guidelines/Separate Guidelines for Authors of Boost Libraries Containing Separate Source]
+
+[section Macros controlling shared library symbol visibility]
+
+Some compilers support C++ extensions that control which symbols
+will be exported from shared libraries such as dynamic shared objects (DSO's) on Unix-like
+systems or dynamic-link libraries (DLL's) on Windows.
+
+The Microsoft VC++ compiler has long supplied
+`__declspec(dllexport)` and `__declspec(dllimport)` extensions for this purpose,
+as do virtually all other compilers targeting the Windows platform.
+
+Modern versions of the GNU GCC compiler provide the `__attribute__((visibility("default")))`
+extension to indicate that a symbol should be exported. All other symbols may be hidden by using the
+`-fvisibility-hidden` or `-fvisibility-ms-compat` compiler switches.
+
+Boost supplies several macros to make it easier to manage symbol visibility in a way that
+is portable between compilers and operating systems.
+
+[table
+[[Macro ][Description ]]
+[[`BOOST_SYMBOL_EXPORT`][
+Defines the syntax of a C++ language extension that indicates a symbol is to be exported from a shared library.
+If the compiler has no such extension, the macro is defined with no replacement text.
+]]
+[[`BOOST_SYMBOL_IMPORT`][
+Defines the syntax of a C++ language extension that indicates a symbol is to be imported from a shared library.
+If the compiler has no such extension, the macro is defined with no replacement text.
+]]
+[[`BOOST_SYMBOL_VISIBLE`][
+Defines the syntax of a C++ language extension that indicates a symbol is to be globally visible.
+If the compiler has no such extension, the macro is defined with no replacement text.
+Needed for classes that are not otherwise exported, but are used by RTTI. Examples include
+class for objects that will be thrown as exceptions or used in dynamic_casts,
+across shared library boundaries. For example, a header-only exception class might look like this:
+``
+ class BOOST_SYMBOL_VISIBLE my_exception : public std::runtime_error { ... };
+``
+Without BOOST_SYMBOL_VISIBLE, it would be impossible to catch my_exception thrown from a shared library
+compiled by GCC with the -fvisibility=hidden option.
+]]
+[[`BOOST_HAS_DECLSPEC`][
+The compiler has C++ extensions `__declspec(dllexport)` and `__declspec(dllimport)` to control
+export/import of symbols from shared libraries.
+['Deprecated. This macro is no longer necessary since BOOST_SYMBOL_EXPORT and BOOST_SYMBOL_IMPORT
+are now supplied. It is provided to support legacy code.]
+]]
+]
+
+Typical usage:
+
+[*boost/foo/config.hpp]
+
+ ...
+ #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FOO_DYN_LINK)
+ # if defined(BOOST_FOO_SOURCE)
+ # define BOOST_FOO_DECL BOOST_SYMBOL_EXPORT
+ # else
+ # define BOOST_FOO_DECL BOOST_SYMBOL_IMPORT
+ # endif
+ #else
+ # define BOOST_FOO_DECL
+ #endif
+ ...
+
+[*boost/foo/foo.hpp]
+
+ #include <boost/foo/config.hpp>
+ ...
+ class BOOST_FOO_DECL bar { ... };
+ ...
+ void BOOST_FOO_DECL f();
+ ...
+
+[*boost/libs/foo/src/foo.cpp]
+
+ #define BOOST_FOO_SOURCE
+ #include <boost/foo/foo.hpp>
+ ...
+ void BOOST_FOO_DECL f()
+ {
+ ...
+ }
+ ...
+
+[endsect]
[section ABI Fixing]
Modified: trunk/libs/system/test/Jamfile.v2
==============================================================================
--- trunk/libs/system/test/Jamfile.v2 (original)
+++ trunk/libs/system/test/Jamfile.v2 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -12,6 +12,12 @@
<library>/boost/system//boost_system
<toolset>msvc:<asynch-exceptions>on
;
+
+ lib throw_test
+ : throw_test.cpp
+ : <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
+ ;
+
test-suite "system"
: [ run error_code_test.cpp
@@ -21,21 +27,25 @@
<link>static
]
[ run error_code_test.cpp
- : : : : error_code_test_dll
+ : : : <link>shared : error_code_test_shared
]
[ run error_code_user_test.cpp
: : : <link>static
]
[ run error_code_user_test.cpp
- : : : : error_code_user_test_dll
+ : : : <link>shared : error_code_user_test_shared
]
[ run system_error_test.cpp
: : : <link>static
]
[ run system_error_test.cpp
- : : : : system_error_test_dll
+ : : : <link>shared : system_error_test_shared
+ ]
+ [ run dynamic_link_test.cpp throw_test
+ : : : <link>shared : throw_test_shared
]
[ run initialization_test.cpp
+ : : : <link>shared : initialization_test_shared
]
[ run header_only_test.cpp
: : : <link>static
Added: trunk/libs/system/test/dynamic_link_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/system/test/dynamic_link_test.cpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -0,0 +1,55 @@
+// dynamic_link_test.cpp -------------------------------------------------------------//
+
+// Copyright Beman Dawes 2010
+
+// Distributed under the Boost Software License, Version 1.0.
+// See www.boost.org/LICENSE_1_0.txt
+
+// Library home page is www.boost.org/libs/system
+
+//--------------------------------------------------------------------------------------//
+
+// Dynamic link libraries (DLL's), also know as dynamic shared objects (DSO's),
+// can cause symbol visability problems unless carefully configured. One of the
+// manifestations, particularly with GCC, is that a system_error exception thrown from
+// a DLL or DSO is not caught.
+//
+// The purpose of this program is to test for that error.
+
+//--------------------------------------------------------------------------------------//
+
+#include <boost/system/system_error.hpp>
+
+#include <iostream>
+
+namespace boost
+{
+ namespace system
+ {
+ BOOST_SYSTEM_DECL void throw_test();
+ }
+}
+
+int main()
+{
+ try
+ {
+ boost::system::throw_test();
+ }
+ catch (const boost::system::system_error& ex)
+ {
+ std::cout << " caught boost::system::system_error as expected\n";
+ std::cout << " what() reports " << ex.what() << '\n';
+ return 0;
+ }
+
+ catch (const std::runtime_error& ex)
+ {
+ std::cout << " error: caught std::runtime_error instead of boost::system::system_error\n";
+ std::cout << " what() reports " << ex.what() << '\n';
+ return 1;
+ }
+
+ std::cout << " error: failed to catch boost::system::system_error\n";
+ return 1;
+}
\ No newline at end of file
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-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -59,6 +59,12 @@
int main( int, char ** )
{
+ std::cout << "Conversion use cases...\n";
+ error_condition x1( errc::file_exists );
+ //error_code x2( errc::file_exists ); // should fail to compile
+ make_error_code(errc::file_exists);
+ make_error_condition(errc::file_exists);
+
std::cout << "General tests...\n";
// unit tests:
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 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -18,7 +18,7 @@
#include <boost/cerrno.hpp>
#include <string>
#include <cstdio>
-#include <boost/test/minimal.hpp>
+#include <boost/detail/lightweight_test.hpp>
#ifdef BOOST_POSIX_API
# include <sys/stat.h>
@@ -264,7 +264,7 @@
//
// void check_success(const boost::system::error_code& ec, bool expect)
// {
-// BOOST_CHECK( (ec == boost::system::posix::success) == expect );
+// BOOST_TEST( (ec == boost::system::posix::success) == expect );
// if (ec == boost::system::posix::success)
// std::cout << "yes... " << (expect ? "ok" : "fail") << '\n';
// else
@@ -273,7 +273,7 @@
//
// void check_permission_denied(const boost::system::error_code& ec, bool expect)
// {
-// BOOST_CHECK( (ec == boost::system::posix::permission_denied) == expect );
+// BOOST_TEST( (ec == boost::system::posix::permission_denied) == expect );
// if (ec == boost::system::posix::permission_denied)
// std::cout << "yes... " << (expect ? "ok" : "fail") << '\n';
// else
@@ -282,7 +282,7 @@
//
// void check_out_of_memory(const boost::system::error_code& ec, bool expect)
// {
-// BOOST_CHECK( (ec == boost::system::posix::not_enough_memory) == expect );
+// BOOST_TEST( (ec == boost::system::posix::not_enough_memory) == expect );
// if (ec == boost::system::posix::not_enough_memory)
// std::cout << "yes... " << (expect ? "ok" : "fail") << '\n';
// else
@@ -337,7 +337,7 @@
// ------------------------------------------------------------------------ //
-int test_main( int, char *[] )
+int main( int, char *[] )
{
boost::system::error_code ec;
@@ -346,35 +346,35 @@
ec = my_mkdir( "/no-such-file-or-directory/will-not-succeed" );
std::cout << "ec.value() is " << ec.value() << '\n';
- BOOST_CHECK( ec );
- BOOST_CHECK( ec == boost::system::posix::no_such_file_or_directory );
- BOOST_CHECK( ec.category() == boost::system::system_category );
+ BOOST_TEST( ec );
+ BOOST_TEST( ec == boost::system::posix::no_such_file_or_directory );
+ BOOST_TEST( ec.category() == boost::system::system_category );
// Library 2 tests:
ec = my_remove( "/no-such-file-or-directory" );
std::cout << "ec.value() is " << ec.value() << '\n';
- BOOST_CHECK( ec );
- BOOST_CHECK( ec == boost::system::posix::no_such_file_or_directory );
- BOOST_CHECK( ec.category() == boost::system::posix_category );
+ BOOST_TEST( ec );
+ BOOST_TEST( ec == boost::system::posix::no_such_file_or_directory );
+ BOOST_TEST( ec.category() == boost::system::posix_category );
// Library 3 tests:
ec = boost::lib3::boo_boo;
std::cout << "ec.value() is " << ec.value() << '\n';
- BOOST_CHECK( ec );
- BOOST_CHECK( ec == boost::lib3::boo_boo );
- BOOST_CHECK( ec.value() == boost::lib3::boo_boo );
- BOOST_CHECK( ec.category() == boost::lib3::lib3_error_category );
+ BOOST_TEST( ec );
+ BOOST_TEST( ec == boost::lib3::boo_boo );
+ BOOST_TEST( ec.value() == boost::lib3::boo_boo );
+ BOOST_TEST( ec.category() == boost::lib3::lib3_error_category );
- BOOST_CHECK( ec == boost::system::posix::io_error );
+ BOOST_TEST( ec == boost::system::posix::io_error );
boost::system::error_code ec3( boost::lib3::boo_boo+100,
boost::lib3::lib3_error_category );
- BOOST_CHECK( ec3.category() == boost::lib3::lib3_error_category );
- BOOST_CHECK( ec3.default_error_condition().category()
+ BOOST_TEST( ec3.category() == boost::lib3::lib3_error_category );
+ BOOST_TEST( ec3.default_error_condition().category()
== boost::lib3::lib3_error_category );
// Library 4 tests:
@@ -382,16 +382,16 @@
ec = lib4::boo_boo;
std::cout << "ec.value() is " << ec.value() << '\n';
- BOOST_CHECK( ec );
- BOOST_CHECK( ec == lib4::boo_boo );
- BOOST_CHECK( ec.value() == lib4::boo_boo.value() );
- BOOST_CHECK( ec.category() == lib4::lib4_error_category );
+ BOOST_TEST( ec );
+ BOOST_TEST( ec == lib4::boo_boo );
+ BOOST_TEST( ec.value() == lib4::boo_boo.value() );
+ BOOST_TEST( ec.category() == lib4::lib4_error_category );
- BOOST_CHECK( ec == boost::system::posix::io_error );
+ BOOST_TEST( ec == boost::system::posix::io_error );
boost::system::error_code ec4( lib4::boo_boo.value()+100,
lib4::lib4_error_category );
- BOOST_CHECK( ec4.default_error_condition().category()
+ BOOST_TEST( ec4.default_error_condition().category()
== lib4::lib4_error_category );
// Test 3
Modified: trunk/libs/system/test/header_only_test.cpp
==============================================================================
--- trunk/libs/system/test/header_only_test.cpp (original)
+++ trunk/libs/system/test/header_only_test.cpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -13,11 +13,10 @@
#define BOOST_ERROR_CODE_HEADER_ONLY
-#include <boost/test/minimal.hpp>
-
+#include <boost/detail/lightweight_test.hpp>
#include <boost/system/error_code.hpp>
-int test_main( int, char*[] )
+int main( int, char*[] )
{
boost::system::error_code ec( 0, boost::system::system_category );
return 0;
Modified: trunk/libs/system/test/initialization_test.cpp
==============================================================================
--- trunk/libs/system/test/initialization_test.cpp (original)
+++ trunk/libs/system/test/initialization_test.cpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -10,7 +10,7 @@
// This test verifiies that the error_category vtable does not suffer from
// order-of-initialization problems.
-#include <boost/test/minimal.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <boost/system/error_code.hpp>
struct foo
@@ -22,7 +22,7 @@
}
} f;
-int test_main( int, char ** )
+int main( int, char ** )
{
return 0;
}
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-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -14,7 +14,7 @@
#include <boost/config/warning_disable.hpp>
-#include <boost/test/minimal.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <boost/system/system_error.hpp>
#include <iostream>
#include <string>
@@ -36,8 +36,8 @@
int v, const char * str )
{
std::cout << "test " << desc << "\n what() returns \"" << ex.what() << "\"\n";
- BOOST_CHECK( ex.code().value() == v );
- BOOST_CHECK( ex.code().category() == system_category );
+ BOOST_TEST( ex.code().value() == v );
+ BOOST_TEST( ex.code().category() == system_category );
# ifdef BOOST_WINDOWS_API
LANGID language_id;
# if !defined(__MINGW32__) && !defined(__CYGWIN__)
@@ -48,7 +48,7 @@
// std::cout << "GetUserDefaultUILanguage() returns " << language_id << '\n';
if ( language_id == 0x0409 ) // English (United States)
{
- BOOST_CHECK( std::string( ex.what() ) == str );
+ BOOST_TEST( std::string( ex.what() ) == str );
if ( std::string( ex.what() ) != str )
std::cout << "expected \"" << str << "\", but what() returned \""
<< ex.what() << "\"\n";
@@ -59,7 +59,7 @@
const boost::uint_least32_t uvalue = 2u;
}
-int test_main( int, char *[] )
+int main( int, char *[] )
{
// all constructors, in the same order as they appear in the header:
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-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -7,13 +7,13 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../.."
- PreprocessorDefinitions="BOOST_ALL_NO_LIB"
+ PreprocessorDefinitions="BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK"
ExceptionHandling="2"
WarningLevel="4"
/>
<Tool
Name="VCPostBuildEventTool"
- Description="Executing test $(TargetName).exe..."
- CommandLine=""$(TargetDir)\$(TargetName).exe" --result_code=no --report_level=no"
+ Description=""
+ CommandLine=""
/>
</VisualStudioPropertySheet>
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-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -86,6 +86,8 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ Description="Executing test $(TargetName).exe..."
+ CommandLine=""$(TargetDir)\$(TargetName).exe" --result_code=no --report_level=no"
/>
</Configuration>
<Configuration
@@ -161,6 +163,8 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ Description="Executing test $(TargetName).exe..."
+ CommandLine=""$(TargetDir)\$(TargetName).exe" --result_code=no --report_level=no"
/>
</Configuration>
</Configurations>
@@ -173,10 +177,6 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
- RelativePath="..\..\..\src\error_code.cpp"
- >
- </File>
- <File
RelativePath="..\..\error_code_test.cpp"
>
</File>
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-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -2,8 +2,27 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# 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}"
+ ProjectSection(ProjectDependencies) = postProject
+ {22892211-A1F3-435B-8B97-A12E8772599E} = {22892211-A1F3-435B-8B97-A12E8772599E}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "system_error_test", "system_error_test\system_error_test.vcproj", "{CBD12E59-99E5-4F35-9B66-0554D0FBDB76}"
+ ProjectSection(ProjectDependencies) = postProject
+ {22892211-A1F3-435B-8B97-A12E8772599E} = {22892211-A1F3-435B-8B97-A12E8772599E}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynamic_link_test", "dynamic_link_test\dynamic_link_test.vcproj", "{AD186B11-9132-48A9-9F24-3522C2310B0D}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F6D9B408-84A3-405A-93ED-DE5AA8CF84D7} = {F6D9B408-84A3-405A-93ED-DE5AA8CF84D7}
+ {22892211-A1F3-435B-8B97-A12E8772599E} = {22892211-A1F3-435B-8B97-A12E8772599E}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "system_dll", "system_dll\system_dll.vcproj", "{22892211-A1F3-435B-8B97-A12E8772599E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "throw_test_dll", "throw_test_dll\throw_test_dll.vcproj", "{F6D9B408-84A3-405A-93ED-DE5AA8CF84D7}"
+ ProjectSection(ProjectDependencies) = postProject
+ {22892211-A1F3-435B-8B97-A12E8772599E} = {22892211-A1F3-435B-8B97-A12E8772599E}
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -19,6 +38,18 @@
{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
+ {AD186B11-9132-48A9-9F24-3522C2310B0D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AD186B11-9132-48A9-9F24-3522C2310B0D}.Debug|Win32.Build.0 = Debug|Win32
+ {AD186B11-9132-48A9-9F24-3522C2310B0D}.Release|Win32.ActiveCfg = Release|Win32
+ {AD186B11-9132-48A9-9F24-3522C2310B0D}.Release|Win32.Build.0 = Release|Win32
+ {22892211-A1F3-435B-8B97-A12E8772599E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {22892211-A1F3-435B-8B97-A12E8772599E}.Debug|Win32.Build.0 = Debug|Win32
+ {22892211-A1F3-435B-8B97-A12E8772599E}.Release|Win32.ActiveCfg = Release|Win32
+ {22892211-A1F3-435B-8B97-A12E8772599E}.Release|Win32.Build.0 = Release|Win32
+ {F6D9B408-84A3-405A-93ED-DE5AA8CF84D7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F6D9B408-84A3-405A-93ED-DE5AA8CF84D7}.Debug|Win32.Build.0 = Debug|Win32
+ {F6D9B408-84A3-405A-93ED-DE5AA8CF84D7}.Release|Win32.ActiveCfg = Release|Win32
+ {F6D9B408-84A3-405A-93ED-DE5AA8CF84D7}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Added: trunk/libs/system/test/throw_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/system/test/throw_test.cpp 2010-05-22 08:12:00 EDT (Sat, 22 May 2010)
@@ -0,0 +1,31 @@
+// throw_test.cpp --------------------------------------------------------===========-//
+
+// Copyright Beman Dawes 2010
+
+// Distributed under the Boost Software License, Version 1.0.
+// See www.boost.org/LICENSE_1_0.txt
+
+// Library home page is www.boost.org/libs/system
+
+//--------------------------------------------------------------------------------------//
+
+// See dynamic_link_test.cpp comments for use case.
+
+//--------------------------------------------------------------------------------------//
+
+// define BOOST_SYSTEM_SOURCE so that <boost/system/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_SYSTEM_SOURCE
+
+#include <boost/system/system_error.hpp>
+
+namespace boost
+{
+ namespace system
+ {
+ BOOST_SYSTEM_DECL void throw_test()
+ {
+ throw system_error(9999, get_system_category(), "boo boo");
+ }
+ }
+}
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