diff --git a/doc/html/boost_config/boost_macro_reference.html b/doc/html/boost_config/boost_macro_reference.html index 5c737bc1..ecf1cccc 100644 --- a/doc/html/boost_config/boost_macro_reference.html +++ b/doc/html/boost_config/boost_macro_reference.html @@ -172,6 +172,25 @@ + +

+ BOOST_NO_COMPLETE_VALUE_INITIALIZATION +

+ + +

+ Compiler +

+ + +

+ Compiler has not completely implemented value-initialization. See + also The + Utility/Value Init docs +

+ + +

BOOST_NO_CTYPE_FUNCTIONS @@ -1341,23 +1360,6 @@ - -

- BOOST_HAS_DECLSPEC -

- - -

- Compiler -

- - -

- The compiler uses __declspec(dllexport) and __declspec(dllimport) to export/import symbols from dll's. -

- - -

BOOST_HAS_DIRENT_H @@ -2634,7 +2636,7 @@

- BOOST_NO_EXPLICIT_CONVERSION_OPERATIONS + BOOST_NO_EXPLICIT_CONVERSION_OPERATORS

@@ -2652,8 +2654,8 @@

- The compiler does not support explicit instantiation declarations - for templates (explicit template). + The compiler does not support explicit instantiation forward declarations + for templates (extern template ...).

@@ -3311,6 +3313,23 @@ + +

+ BOOST_CLANG +

+ + +

+ <boost/config.hpp> +

+ + +

+ Defined to 1 if the compiler is the Clang compiler. +

+ + +

BOOST_WINDOWS @@ -3427,6 +3446,8 @@ for libraries with separate source code

+
Macros + controlling shared library symbol visibility
ABI Fixing
Automatic @@ -3434,10 +3455,178 @@

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:

+
+

+ See Guidelines + for Authors of Boost Libraries Containing Separate Source +

+
+

+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. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +
+

+ 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()
+{
+  ...
+}
+...
+
+

ABI diff --git a/doc/html/index.html b/doc/html/index.html index 21dda5c7..045eaa57 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -28,7 +28,7 @@

-

+

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

@@ -960,7 +960,7 @@
- +

Last revised: March 02, 2010 at 17:08:14 GMT

Last revised: May 27, 2010 at 08:46:14 GMT


diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index c32ea618..3acadc68 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -49,6 +49,10 @@ Koenig lookup); see std::3.4.2 \[basic.koenig.lookup\] [[`BOOST_NO_AUTO_PTR`][Standard library][ If the compiler / library supplies non-standard or broken `std::auto_ptr`. ]] +[[`BOOST_NO_COMPLETE_VALUE_INITIALIZATION`][Compiler][ +Compiler has not completely implemented value-initialization. +See also [@../../../utility/value_init.htm#compiler_issues The Utility\/Value Init docs] +]] [[`BOOST_NO_CTYPE_FUNCTIONS`][Platform][ The Platform does not provide functions for the character-classifying operations `` and ``, only macros. @@ -313,6 +317,7 @@ void g() { return f(); } [#config_features] + [section Macros that describe optional features] The following macros describe features that are not required by the C++ @@ -328,10 +333,6 @@ The platform supports BeOS style threads. [[`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 ``. ]] @@ -577,11 +578,11 @@ defaulted (`= default`) functions. [[`BOOST_NO_DELETED_FUNCTIONS`][The compiler does not support deleted (`= delete`) functions. ]] -[[`BOOST_NO_EXPLICIT_CONVERSION_OPERATIONS`][The compiler does not support +[[`BOOST_NO_EXPLICIT_CONVERSION_OPERATORS`][The compiler does not support explicit conversion operators (`explicit operator T()`). ]] [[`BOOST_NO_EXTERN_TEMPLATE`][The compiler does not support -explicit instantiation declarations for templates (`explicit template`). +explicit instantiation forward declarations for templates (`extern template ...`). ]] [[`BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS`][The compiler does not support default template arguments for function templates. @@ -864,9 +865,98 @@ the configuration. [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 + ... + class BOOST_FOO_DECL bar { ... }; + ... + void BOOST_FOO_DECL f(); + ... + +[*boost/libs/foo/src/foo.cpp] + + #define BOOST_FOO_SOURCE + #include + ... + void BOOST_FOO_DECL f() + { + ... + } + ... + +[endsect] [section ABI Fixing] @@ -988,3 +1078,6 @@ match that used to create the libraries via bjam 's install rules. [endsect] [endsect] + + + diff --git a/include/boost/config/abi/borland_prefix.hpp b/include/boost/config/abi/borland_prefix.hpp index 49f42494..3a0e5ae2 100644 --- a/include/boost/config/abi/borland_prefix.hpp +++ b/include/boost/config/abi/borland_prefix.hpp @@ -21,7 +21,7 @@ // 8026 - functions taking class by value arguments are not expanded inline #pragma nopushoptwarn -# pragma option push -Vx -Ve -a8 -b -pc -Vmv -VC- -Vl- -w-8027 -w-8026 +# pragma option push -a8 -Vx- -Ve- -b- -pc -Vmv -VC- -Vl- -w-8027 -w-8026 diff --git a/include/boost/config/auto_link.hpp b/include/boost/config/auto_link.hpp index f2eb583f..0d17eb8f 100644 --- a/include/boost/config/auto_link.hpp +++ b/include/boost/config/auto_link.hpp @@ -25,6 +25,9 @@ BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name of the library selected (useful for debugging). BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib, rather than a mangled-name version. +BOOST_AUTO_LINK_TAGGED: Specifies that we link to libraries built with the --layout=tagged option. + This is essentially the same as the default name-mangled version, but without + the compiler name and version, or the Boost version. Just the build options. These macros will be undef'ed at the end of the header, further this header has no include guards - so be sure to include it only once from your library! @@ -60,6 +63,8 @@ BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used, a hiphen: s static runtime (dynamic if not present). + g debug/diagnostic runtime (release if not present). + y Python debug/diagnostic runtime (release if not present). d debug build (release if not present). g debug/diagnostic runtime (release if not present). p STLPort Build. @@ -183,8 +188,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) -# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gydp" +# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-gdp" +# elif defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gydp" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdp" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") @@ -195,8 +208,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gydpn" +# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-gdpn" +# elif defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gydpn" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdpn" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") @@ -207,7 +228,9 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # else -# if defined(_DEBUG) +# if defined(_DEBUG) && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gyd" +# elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gd" # else # define BOOST_LIB_RT_OPT @@ -219,8 +242,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) -# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgydp" +# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-sgdp" +# elif defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgydp" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdp" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") @@ -231,8 +262,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgydpn" +# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-sgdpn" +# elif defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgydpn" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdpn" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") @@ -243,7 +282,10 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # else -# if defined(_DEBUG) +# if defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgyd" +# elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgd" # else # define BOOST_LIB_RT_OPT "-s" @@ -270,16 +312,26 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # ifdef _RTLDLL -# ifdef BOOST_BORLAND_DEBUG +# if defined(BOOST_BORLAND_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-yd" +# elif defined(BOOST_BORLAND_DEBUG) # define BOOST_LIB_RT_OPT "-d" +# elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT -y # else # define BOOST_LIB_RT_OPT # endif # else -# ifdef BOOST_BORLAND_DEBUG +# if defined(BOOST_BORLAND_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-syd" +# elif defined(BOOST_BORLAND_DEBUG) # define BOOST_LIB_RT_OPT "-sd" +# elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sy" # else # define BOOST_LIB_RT_OPT "-s" # endif @@ -309,16 +361,21 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. && defined(BOOST_LIB_RT_OPT) \ && defined(BOOST_LIB_VERSION) -#ifndef BOOST_AUTO_LINK_NOMANGLE -# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") +#ifdef BOOST_AUTO_LINK_TAGGED +# pragma commentcomment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") # endif -#else +#elif defined(BOOST_AUTO_LINK_NOMANGLE) # pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # endif +#else +# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") +# ifdef BOOST_LIB_DIAGNOSTIC +# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") +# endif #endif #else @@ -361,13 +418,3 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # undef BOOST_AUTO_LINK_NOMANGLE #endif - - - - - - - - - - diff --git a/include/boost/config/compiler/borland.hpp b/include/boost/config/compiler/borland.hpp index 6a7b988d..bd3a8c3f 100644 --- a/include/boost/config/compiler/borland.hpp +++ b/include/boost/config/compiler/borland.hpp @@ -218,7 +218,7 @@ // // check for exception handling support: // -#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) +#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // @@ -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: @@ -261,6 +262,13 @@ # define BOOST_NO_VOID_RETURNS #endif +// Borland did not implement value-initialization completely, as I reported +// in 2007, Borland Report 51854, "Value-initialization: POD struct should be +// zero-initialized", http://qc.embarcadero.com/wc/qcmain.aspx?d=51854 +// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues +// (Niels Dekker, LKEB, April 2010) +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION + #define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) diff --git a/include/boost/config/compiler/clang.hpp b/include/boost/config/compiler/clang.hpp index 90cc6aa6..7aac8c35 100644 --- a/include/boost/config/compiler/clang.hpp +++ b/include/boost/config/compiler/clang.hpp @@ -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 @@ -59,6 +53,13 @@ // them is wrong. #define BOOST_NO_EXTERN_TEMPLATE +// Clang version 2.0 (trunk 103769) does not yet properly +// value-initialize objects of a pointer-to-member type, +// as was reported by Christopher Jefferson in May 2010, Bug 7139, +// "ptr to member not zeroed", http://llvm.org/bugs/show_bug.cgi?id=7139 +// (Niels Dekker, LKEB, May 2010) +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION + #ifndef BOOST_COMPILER # define BOOST_COMPILER "Clang version " __clang_version__ #endif diff --git a/include/boost/config/compiler/codegear.hpp b/include/boost/config/compiler/codegear.hpp index 698624ec..f6dc4c02 100644 --- a/include/boost/config/compiler/codegear.hpp +++ b/include/boost/config/compiler/codegear.hpp @@ -19,8 +19,8 @@ #endif // // versions check: -// last known and checked version is 0x620 -#if (__CODEGEARC__ > 0x620) +// last known and checked version is 0x621 +#if (__CODEGEARC__ > 0x621) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else @@ -41,7 +41,7 @@ #endif // CodeGear C++ Builder 2010 -#if (__CODEGEARC__ <= 0x620) +#if (__CODEGEARC__ <= 0x621) # define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS @@ -51,6 +51,15 @@ // Temporary hack, until specific MPL preprocessed headers are generated # define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +// CodeGear has not yet completely implemented value-initialization, for +// example for array types, as I reported in 2010: Embarcadero Report 83751, +// "Value-initialization: arrays should have each element value-initialized", +// http://qc.embarcadero.com/wc/qcmain.aspx?d=83751 +// Last checked version: Embarcadero C++ 6.21 +// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues +// (Niels Dekker, LKEB, April 2010) +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION + # ifdef NDEBUG // fix broken so that Boost.test works: # include @@ -66,6 +75,11 @@ // // C++0x macros: // +#if (__CODEGEARC__ <= 0x620) +#define BOOST_NO_STATIC_ASSERT +#else +#define BOOST_HAS_STATIC_ASSERT +#endif #define BOOST_HAS_CHAR16_T #define BOOST_HAS_CHAR32_T #define BOOST_HAS_LONG_LONG @@ -91,7 +105,6 @@ #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES @@ -122,7 +135,7 @@ // // check for exception handling support: // -#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) +#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // @@ -134,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: diff --git a/include/boost/config/compiler/common_edg.hpp b/include/boost/config/compiler/common_edg.hpp index 9dc4cef8..cb283376 100644 --- a/include/boost/config/compiler/common_edg.hpp +++ b/include/boost/config/compiler/common_edg.hpp @@ -44,7 +44,7 @@ #endif // See also kai.hpp which checks a Kai-specific symbol for EH -# if !defined(__KCC) && !defined(__EXCEPTIONS) +# if !defined(__KCC) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS # endif @@ -59,6 +59,9 @@ // // See above for BOOST_NO_LONG_LONG // +#if (__EDG_VERSION__ < 310) +# define BOOST_NO_EXTERN_TEMPLATE +#endif #if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG) // No support for initializer lists # define BOOST_NO_INITIALIZER_LISTS @@ -74,7 +77,6 @@ #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR diff --git a/include/boost/config/compiler/digitalmars.hpp b/include/boost/config/compiler/digitalmars.hpp index a01b4c28..bd37d2f1 100644 --- a/include/boost/config/compiler/digitalmars.hpp +++ b/include/boost/config/compiler/digitalmars.hpp @@ -51,7 +51,7 @@ // check for exception handling support: -#ifndef _CPPUNWIND +#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index fe2c52ea..3ba45ddd 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -42,6 +42,7 @@ # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT +# define BOOST_NO_EXTERN_TEMPLATE #elif __GNUC__ == 3 # if defined (__PATHSCALE__) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP @@ -58,6 +59,7 @@ # if __GNUC_MINOR__ < 4 # define BOOST_NO_IS_ABSTRACT # endif +# define BOOST_NO_EXTERN_TEMPLATE #endif #if __GNUC__ < 4 // @@ -69,7 +71,19 @@ # endif #endif -#ifndef __EXCEPTIONS +#if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 ) +// Previous versions of GCC did not completely implement value-initialization: +// GCC Bug 30111, "Value-initialization of POD base class doesn't initialize +// members", reported by Jonathan Wakely in 2006, +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 (fixed for GCC 4.4) +// GCC Bug 33916, "Default constructor fails to initialize array members", +// reported by Michael Elizabeth Chastain in 2007, +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 (fixed for GCC 4.2.4) +// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#endif + +#if !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif @@ -94,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: // @@ -107,7 +143,6 @@ // C++0x features not implemented in any GCC version // #define BOOST_NO_CONSTEXPR -#define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_NULLPTR #define BOOST_NO_TEMPLATE_ALIASES diff --git a/include/boost/config/compiler/intel.hpp b/include/boost/config/compiler/intel.hpp index 531242e9..e7bc95ba 100644 --- a/include/boost/config/compiler/intel.hpp +++ b/include/boost/config/compiler/intel.hpp @@ -157,6 +157,29 @@ template<> struct assert_intrinsic_wchar_t {}; # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif +// +// An attempt to value-initialize a pointer-to-member may trigger an +// internal error on Intel <= 11.1 (last checked version), as was +// reported by John Maddock, Intel support issue 589832, May 2010. +// Moreover, according to test results from Huang-Vista-x86_32_intel, +// intel-vc9-win-11.1 may leave a non-POD array uninitialized, in some +// cases when it should be value-initialized. +// (Niels Dekker, LKEB, May 2010) +#if defined(__INTEL_COMPILER) +# if __INTEL_COMPILER <= 1110 +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +# endif +#endif + +// +// Dynamic shared object (DSO) and dynamic-link library (DLL) support +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +# define BOOST_SYMBOL_EXPORT __attribute__((visibility("default"))) +# define BOOST_SYMBOL_IMPORT +# define BOOST_SYMBOL_VISIBLE __attribute__((visibility("default"))) +#endif + // // last known and checked version: #if (BOOST_INTEL_CXX_VERSION > 1110) diff --git a/include/boost/config/compiler/kai.hpp b/include/boost/config/compiler/kai.hpp index ea06f9f4..2337e6a8 100644 --- a/include/boost/config/compiler/kai.hpp +++ b/include/boost/config/compiler/kai.hpp @@ -17,7 +17,7 @@ # endif // see also common_edg.hpp which needs a special check for __KCC -# if !defined(_EXCEPTIONS) +# if !defined(_EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS # endif diff --git a/include/boost/config/compiler/metrowerks.hpp b/include/boost/config/compiler/metrowerks.hpp index aeba7f80..3bc9d975 100644 --- a/include/boost/config/compiler/metrowerks.hpp +++ b/include/boost/config/compiler/metrowerks.hpp @@ -48,7 +48,7 @@ # define BOOST_NO_INTRINSIC_WCHAR_T #endif -#if !__option(exceptions) +#if !__option(exceptions) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif diff --git a/include/boost/config/compiler/sunpro_cc.hpp b/include/boost/config/compiler/sunpro_cc.hpp index f5184887..aca49fa0 100644 --- a/include/boost/config/compiler/sunpro_cc.hpp +++ b/include/boost/config/compiler/sunpro_cc.hpp @@ -69,6 +69,25 @@ # define BOOST_NO_IS_ABSTRACT # endif +# if (__SUNPRO_CC <= 0x5100) + // Sun 5.10 may not correctly value-initialize objects of + // some user defined types, as was reported in April 2010 + // (CR 6947016), and confirmed by Steve Clamage. + // (Niels Dekker, LKEB, May 2010). +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +# endif + +// +// Dynamic shared object (DSO) and dynamic-link library (DLL) support +// +#if __SUNPRO_CC > 0x500 +# define BOOST_SYMBOL_EXPORT __global +# define BOOST_SYMBOL_IMPORT __global +# define BOOST_SYMBOL_VISIBLE __global +#endif + + + // // Issues that effect all known versions: // @@ -78,12 +97,7 @@ // // C++0x features // - -#if(__SUNPRO_CC >= 0x590) # define BOOST_HAS_LONG_LONG -#else -# define BOOST_NO_LONG_LONG -#endif #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS diff --git a/include/boost/config/compiler/vacpp.hpp b/include/boost/config/compiler/vacpp.hpp index 01956d3a..e5b69711 100644 --- a/include/boost/config/compiler/vacpp.hpp +++ b/include/boost/config/compiler/vacpp.hpp @@ -30,6 +30,14 @@ # define BOOST_NO_INITIALIZER_LISTS #endif +#if (__IBMCPP__ <= 1110) +// XL C++ V11.1 and earlier versions may not always value-initialize +// a temporary object T(), when T is a non-POD aggregate class type. +// Michael Wong (IBM Canada Ltd) has confirmed this issue and gave it +// high priority. -- Niels Dekker (LKEB), May 2010. +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#endif + // // On AIX thread support seems to be indicated by _THREAD_SAFE: // diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index f8cc1096..2f89519e 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -68,6 +68,7 @@ # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS +# define BOOST_NO_EXTERN_TEMPLATE // TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? # if (_MSC_VER > 1200) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS @@ -99,6 +100,24 @@ # define BOOST_NO_ADL_BARRIER #endif + +#if (_MSC_VER <= 1600) +// MSVC (including the latest checked version) has not yet completely +// implemented value-initialization, as is reported: +// "VC++ does not value-initialize members of derived classes without +// user-declared constructor", reported in 2009 by Sylvester Hesp: +// https://connect.microsoft.com/VisualStudio/feedback/details/484295 +// "Presence of copy constructor breaks member class initialization", +// reported in 2009 by Alex Vakulenko: +// https://connect.microsoft.com/VisualStudio/feedback/details/499606 +// "Value-initialization in new-expression", reported in 2005 by +// Pavel Kuznetsov (MetaCommunications Engineering): +// https://connect.microsoft.com/VisualStudio/feedback/details/100744 +// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues +// (Niels Dekker, LKEB, May 2010) +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#endif + #if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 # define BOOST_NO_INITIALIZER_LISTS #endif @@ -115,7 +134,7 @@ // // check for exception handling support: -#ifndef _CPPUNWIND +#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif @@ -144,11 +163,6 @@ # define BOOST_NO_RTTI #endif -// -// all versions support __declspec: -// -#define BOOST_HAS_DECLSPEC - // // C++0x features // @@ -159,11 +173,14 @@ #if _MSC_VER < 1600 #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_DECLTYPE #define BOOST_NO_LAMBDAS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_NULLPTR #endif // _MSC_VER < 1600 +#if _MSC_VER >= 1600 +#define BOOST_HAS_STDINT_H +#endif // C++0x features not supported by any versions #define BOOST_NO_CHAR16_T @@ -171,19 +188,17 @@ #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DECLTYPE #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES - // // prefix and suffix headers: // diff --git a/include/boost/config/platform/win32.hpp b/include/boost/config/platform/win32.hpp index 9344818f..f59c4ea7 100644 --- a/include/boost/config/platform/win32.hpp +++ b/include/boost/config/platform/win32.hpp @@ -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 diff --git a/include/boost/config/stdlib/dinkumware.hpp b/include/boost/config/stdlib/dinkumware.hpp index ab770599..5d044363 100644 --- a/include/boost/config/stdlib/dinkumware.hpp +++ b/include/boost/config/stdlib/dinkumware.hpp @@ -86,6 +86,11 @@ # define BOOST_NO_STD_LOCALE #endif +#include +#if !_HAS_EXCEPTIONS +# define BOOST_NO_STD_TYPEINFO +#endif + // C++0x headers implemented in 520 (as shipped by Microsoft) // #if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 @@ -100,6 +105,11 @@ # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_0X_HDR_TUPLE +#endif + +#if !defined(_HAS_TR1_IMPORTS) && !defined(BOOST_NO_0X_HDR_TUPLE) +# define BOOST_NO_0X_HDR_TUPLE #endif // C++0x headers not yet implemented @@ -114,7 +124,6 @@ # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER diff --git a/include/boost/config/suffix.hpp b/include/boost/config/suffix.hpp index 9e4d0788..3408d225 100644 --- a/include/boost/config/suffix.hpp +++ b/include/boost/config/suffix.hpp @@ -25,6 +25,19 @@ #ifndef BOOST_CONFIG_SUFFIX_HPP #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 . // Note that we use limits.h rather than climits for maximal portability, @@ -82,6 +95,13 @@ # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS #endif +// +// Normalize BOOST_NO_STATIC_ASSERT and (depricated) BOOST_HAS_STATIC_ASSERT: +// +#if !defined(BOOST_NO_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT) +# define BOOST_HAS_STATIC_ASSERT +#endif + // // if there is no __int64 then there is no specialisation // for numeric_limits<__int64> either: @@ -314,6 +334,13 @@ # define BOOST_NO_INITIALIZER_LISTS #endif +// +// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined +// +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) +#define BOOST_HAS_RVALUE_REFS +#endif + // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: @@ -554,6 +581,12 @@ namespace boost{ #endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +// When BOOST_NO_STD_TYPEINFO is defined, we can just import +// the global definition into std namespace: +#ifdef BOOST_NO_STD_TYPEINFO +#include +namespace std{ using ::typeinfo; } +#endif // ---------------------------------------------------------------------------// diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2 index 4b510a83..e33f87a0 100644 --- a/test/all/Jamfile.v2 +++ b/test/all/Jamfile.v2 @@ -1,7 +1,7 @@ # # Regression test Jamfile for boost configuration setup. # *** DO NOT EDIT THIS FILE BY HAND *** -# This file was automatically generated on Sun Oct 11 13:04:18 2009 +# This file was automatically generated on Fri Apr 09 12:24:54 2010 # by libs/config/tools/generate.cpp # Copyright John Maddock. # Use, modification and distribution are subject to the @@ -265,6 +265,9 @@ test-suite "BOOST_NO_CHAR16_T" : test-suite "BOOST_NO_CHAR32_T" : [ run ../no_char32_t_pass.cpp ] [ compile-fail ../no_char32_t_fail.cpp ] ; +test-suite "BOOST_NO_COMPLETE_VALUE_INITIALIZATION" : +[ run ../no_com_value_init_pass.cpp ] +[ compile-fail ../no_com_value_init_fail.cpp ] ; test-suite "BOOST_NO_CONCEPTS" : [ run ../no_concepts_pass.cpp ] [ compile-fail ../no_concepts_fail.cpp ] ; diff --git a/test/boost_no_0x_hdr_tuple.ipp b/test/boost_no_0x_hdr_tuple.ipp index ba311d32..1a3ff456 100644 --- a/test/boost_no_0x_hdr_tuple.ipp +++ b/test/boost_no_0x_hdr_tuple.ipp @@ -16,6 +16,7 @@ namespace boost_no_0x_hdr_tuple { int test() { + std::tuple t(0, 1, 2); return 0; } diff --git a/test/boost_no_auto_declarations.ipp b/test/boost_no_auto_declarations.ipp index be48ed3e..65410827 100644 --- a/test/boost_no_auto_declarations.ipp +++ b/test/boost_no_auto_declarations.ipp @@ -11,14 +11,14 @@ namespace boost_no_auto_declarations { -void check(int& x) +void check_f(int& x) { } int test() { auto x = 10; - check(x); + check_f(x); return 0; } diff --git a/test/boost_no_auto_multidecl.ipp b/test/boost_no_auto_multidecl.ipp index 976d445a..ea976612 100644 --- a/test/boost_no_auto_multidecl.ipp +++ b/test/boost_no_auto_multidecl.ipp @@ -11,14 +11,14 @@ namespace boost_no_auto_multideclarations { -void check(int& x, int*& y) +void check_f(int& x, int*& y) { } int test() { auto x = 10, *y = &x; - check(x, y); + check_f(x, y); return 0; } diff --git a/test/boost_no_char16_t.ipp b/test/boost_no_char16_t.ipp index b519b825..6b8956da 100644 --- a/test/boost_no_char16_t.ipp +++ b/test/boost_no_char16_t.ipp @@ -1,3 +1,4 @@ + // (C) Copyright Beman Dawes 2008 // Use, modification and distribution are subject to the @@ -14,7 +15,7 @@ namespace boost_no_char16_t { int test() { - char16_t c; + const char16_t* p = u"abc"; return 0; } diff --git a/test/boost_no_char32_t.ipp b/test/boost_no_char32_t.ipp index 4bd05407..cee99a64 100644 --- a/test/boost_no_char32_t.ipp +++ b/test/boost_no_char32_t.ipp @@ -14,7 +14,7 @@ namespace boost_no_char32_t { int test() { - char32_t c; + const char32_t* p = U"abc"; return 0; } diff --git a/test/boost_no_com_value_init.ipp b/test/boost_no_com_value_init.ipp new file mode 100644 index 00000000..a10cf8fe --- /dev/null +++ b/test/boost_no_com_value_init.ipp @@ -0,0 +1,1024 @@ +// (C) Copyright Niels Dekker 2010. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for most recent version. + +// MACRO: BOOST_NO_COMPLETE_VALUE_INITIALIZATION +// TITLE: No complete value-initialization +// DESCRIPTION: The C++ compiler does not to have implemented value-initialization completely. +// See also boost/libs/utility/value_init.htm#compiler_issues + +#include + +// This test checks various forms of value-initialization: +// - doing subobject initialization inside a constructor +// - creating a temporary object by T() +// - creating a heap object by doing new T() +// It checks various DefaultConstructible types, including fundamental types, +// enum, union, pointer types, array types, POD and non-POD class types. For +// each type of object, a helper function is_value_initialized(const T&) tells +// whether the object is value-initialized. +// +// Note: It appeared insufficient to just check a single POD and a single +// non-POD class type, because some compilers correctly value-initialize some +// POD and some non-POD objects, while failing to value-initialize others. +// +// The test returns the number of encountered value-initialization failures. + +namespace boost_no_complete_value_initialization +{ + enum enum_type { negative_number = -1, magic_number = 42 }; + + class incomplete_class; + + typedef int (*function_ptr_type)(int); + typedef int (incomplete_class::*member_function_ptr_type)(int); + + // A POD struct. + struct pod_struct + { + enum_type e; + bool b; + char c; + unsigned char uc; + short s; + int i; + unsigned u; + long l; + float f; + double d; + long double ld; + void* p; + }; + + bool is_value_initialized(const pod_struct& arg) + { + return + arg.b == 0 && + arg.e == 0 && + arg.c == 0 && + arg.uc == 0 && + arg.s == 0 && + arg.i == 0 && + arg.u == 0 && + arg.l == 0 && + arg.f == 0 && + arg.d == 0 && + arg.p == 0; + } + + // A POD struct derived from another POD struct. + struct derived_pod_struct: pod_struct + { + int derived_data; + }; + + bool is_value_initialized(const derived_pod_struct& arg) + { + const pod_struct& base_subobject = arg; + return arg.derived_data == 0 && is_value_initialized(base_subobject); + } + + + struct empty_struct + { + }; + + + // A POD aggregate struct derived from an empty struct. + // Similar to struct Foo1 from Microsoft Visual C++ bug report 484295, + // "VC++ does not value-initialize members of derived classes without + // user-declared constructor", reported in 2009 by Sylvester Hesp: + // https://connect.microsoft.com/VisualStudio/feedback/details/484295 + struct derived_struct: empty_struct + { + int data; + }; + + bool is_value_initialized(const derived_struct& arg) + { + return arg.data == 0; + } + + + // A struct, having a bit-field. + struct bit_field_struct + { + bool b : 1; + char c : 7; + unsigned u: 8 * sizeof(unsigned) - 1; + }; + + bool is_value_initialized(const bit_field_struct& arg) + { + return arg.b == false && arg.c == '\0'&& arg.u == 0U; + } + + // A struct, having a function pointer. + struct function_ptr_struct + { + function_ptr_type data; + }; + + bool is_value_initialized(const function_ptr_struct& arg) + { + return arg.data == 0; + } + + // A struct, having a member function pointer. + struct member_function_ptr_struct + { + member_function_ptr_type data; + }; + + bool is_value_initialized(const member_function_ptr_struct& arg) + { + return arg.data == 0; + } + + struct int_pair_struct + { + int first; + int second; + }; + + typedef int int_pair_struct::*ptr_to_member_type; + + struct ptr_to_member_struct + { + ptr_to_member_type data; + }; + + bool is_value_initialized(const ptr_to_member_struct& arg) + { + return arg.data == 0; + } + + // A struct, having an int. Equivalent to the struct TData, from CodeGear bug + // report 51854, "Value-initialization: POD struct should be zero-initialized", + // reported by me (Niels Dekker, LKEB) in 2007: + // http://qc.embarcadero.com/wc/qcmain.aspx?d=51854 + struct int_struct + { + int data; + }; + + bool is_value_initialized(const int_struct& arg) + { + return arg.data == 0; + } + + + // A struct, having an int_struct. + struct int_struct_holder + { + int_struct data; + }; + + bool is_value_initialized(const int_struct_holder& arg) + { + return is_value_initialized(arg.data); + } + + + // A struct derived from int_struct. + struct derived_int_struct: int_struct + { + }; + + bool is_value_initialized(const derived_int_struct& arg) + { + return arg.data == 0; + } + + + struct char_array_struct + { + char data[42]; + }; + + bool is_value_initialized(const char_array_struct& arg) + { + for ( unsigned i = 0; i < sizeof(arg.data); ++i) + { + if ( arg.data[i] != 0 ) + { + return false; + } + } + return true; + } + + + class private_int_holder + { + private: + int m_data; + + friend bool is_value_initialized(const private_int_holder& arg) + { + return arg.m_data == 0; + } + }; + + + // Equivalent to the Stats class from GCC Bug 33916, + // "Default constructor fails to initialize array members", reported in 2007 by + // Michael Elizabeth Chastain: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 + class private_int_array_pair + { + friend bool is_value_initialized(const private_int_array_pair& arg); + private: + int first[12]; + int second[12]; + }; + + bool is_value_initialized(const private_int_array_pair& arg) + { + for ( unsigned i = 0; i < 12; ++i) + { + if ( (arg.first[i] != 0) || (arg.second[i] != 0) ) + { + return false; + } + } + return true; + } + + + union pod_struct_and_int_union + { + pod_struct first; + int second; + }; + + bool is_value_initialized(const pod_struct_and_int_union& arg) + { + // When a union is zero-initialized, its first non-static + // named data member is zero-initialized ([dcl.init]). + return is_value_initialized(arg.first); + } + + + union int_and_pod_struct_union + { + int first; + pod_struct second; + }; + + bool is_value_initialized(const int_and_pod_struct_union& arg) + { + return arg.first == 0; + } + + + // A class that holds a "magic" enum value. + // Note: This is not a POD class, because it has a user-defined + // default constructor. + class enum_holder + { + enum_type m_enum; + public: + + enum_holder() + : + m_enum(magic_number) + { + } + + bool is_value_initialized() const + { + return m_enum == magic_number; + } + }; + + bool is_value_initialized(const enum_holder& arg) + { + return arg.is_value_initialized(); + } + + + // An aggregate struct of a non-POD class and an int. + // Similar to struct A from Microsoft Visual C++ bug report 100744, + // "Value-initialization in new-expression", reported in 2005 by + // Pavel Kuznetsov (MetaCommunications Engineering): + // https://connect.microsoft.com/VisualStudio/feedback/details/100744 + struct enum_holder_and_int + { + enum_holder e; + int i; + }; + + bool is_value_initialized(const enum_holder_and_int& arg) + { + return arg.e.is_value_initialized() && arg.i == 0; + } + + class user_defined_copy_constructor_holder + { + public: + int data; + + user_defined_copy_constructor_holder() + : + data(0) + { + } + + user_defined_copy_constructor_holder(const user_defined_copy_constructor_holder& arg) + : + data(arg.data) + { + } + }; + + // An aggregate struct that has a data member which has a user-defined + // copy constructor and a data member of a scalar type. + // Similar to struct B from Microsoft Visual C++ bug report 499606, + // "Presence of copy constructor breaks member class initialization", + // reported in 2009 by Alex Vakulenko: + // https://connect.microsoft.com/VisualStudio/feedback/details/499606 + struct user_defined_copy_constructor_holder_and_int + { + user_defined_copy_constructor_holder first; + int second; + }; + + bool is_value_initialized(const user_defined_copy_constructor_holder_and_int& arg) + { + return arg.first.data == 0 && arg.second == 0; + } + + + // An class that has a private and a protected int data member. + class private_and_protected_int + { + private: + int private_int; + protected: + int protected_int; + public: + friend bool is_value_initialized(const private_and_protected_int& arg) + { + return arg.private_int == 0 && arg.protected_int == 0; + } + }; + + + class user_defined_destructor_holder + { + public: + int i; + ~user_defined_destructor_holder() + { + } + }; + + bool is_value_initialized(const user_defined_destructor_holder& arg) + { + return arg.i == 0; + } + + + class virtual_destructor_holder + { + public: + int i; + virtual ~virtual_destructor_holder() + { + } + }; + + bool is_value_initialized(const virtual_destructor_holder& arg) + { + return arg.i == 0; + } + + + // A class that is not a POD type. + class non_pod_class + { + private: + enum_holder m_enum_holder; + + public: + int i; + + virtual bool is_value_initialized() const + { + return m_enum_holder.is_value_initialized() && i == 0; + } + + virtual ~non_pod_class() {} + }; + + bool is_value_initialized(const non_pod_class& arg) + { + return arg.is_value_initialized(); + } + + + typedef char _2d_char_array_type[3][4]; + + bool is_value_initialized(const _2d_char_array_type& arg) + { + for(unsigned i = 0; i < sizeof(_2d_char_array_type); ++i) + { + if ((*arg)[i] != 0) + { + return false; + } + } + return true; + } + + typedef char _3d_char_array_type[5][6][7]; + + bool is_value_initialized(const _3d_char_array_type& arg) + { + for(unsigned i = 0; i < sizeof(_3d_char_array_type); ++i) + { + if ((**arg)[i] != 0) + { + return false; + } + } + return true; + } + + + + // Tells whether an object of a scalar type T is value-initialized. + template + bool is_value_initialized(const T& arg) + { + return arg == 0; + } + + + // Wraps a heap object that it has allocated by doing new T(). + template + class heap_object_wrapper + { + private: + T* const m_ptr; + + // The following function is intentionally left unimplemented + // (as if deleted, "= delete", in C++0x): + void operator=(heap_object_wrapper); + + public: + heap_object_wrapper() + : + m_ptr(new T()) + { + } + + ~heap_object_wrapper() + { + delete m_ptr; + } + + // The copy-constructor is intentionally left unimplemented. + heap_object_wrapper(const heap_object_wrapper&); + + bool is_wrapped_object_value_initialized() const + { + return (m_ptr != 0) && is_value_initialized(*m_ptr); + } + }; + + template + bool is_value_initialized(const heap_object_wrapper& arg) + { + return arg.is_wrapped_object_value_initialized(); + } + + + // Returns zero when the specified object is value-initializated, and one otherwise. + // Prints a message to standard output if the value-initialization has failed. + template + unsigned failed_to_value_initialized(const T& object, const char *const object_name) + { + if ( is_value_initialized(object) ) + { + return 0u; + } + else + { + std::cout << "Note: Failed to value-initialize " << object_name << '.' << std::endl; + return 1u; + } + } + +// A macro that passed both the name and the value of the specified object to +// the function above here. +#define FAILED_TO_VALUE_INITIALIZE(value) failed_to_value_initialized(value, #value) + + + // value_initializer initializes each of its data members by means + // of an empty set of parentheses, and allows checking whether + // each of them is indeed value-initialized, as specified by + // the C++ Standard ([dcl.init]). + // + // Note: its base class, int_struct, is there to try to reproduce GCC Bug 30111, + // "Value-initialization of POD base class doesn't initialize members", reported + // by Jonathan Wakely in 2006: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 + class value_initializer: private int_struct + { + private: + enum_holder m_enum_holder; + enum_holder m_enum_holder_array[2]; + enum_type m_enum; + enum_type m_enum_array[2]; + bool m_bool; + bool m_bool_array[2]; + char m_char; + char m_char_array[2]; + _2d_char_array_type m_2d_char_array; + _3d_char_array_type m_3d_char_array; + unsigned char m_unsigned_char; + unsigned char m_unsigned_char_array[2]; + short m_short; + short m_short_array[2]; + int m_int; + int m_int_array[2]; + unsigned m_unsigned; + unsigned m_unsigned_array[2]; + long m_long; + long m_long_array[2]; + float m_float; + float m_float_array[2]; + double m_double; + double m_double_array[2]; + long double m_long_double; + long double m_long_double_array[2]; + void* m_void_ptr; + void* m_void_ptr_array[2]; + function_ptr_type m_function_ptr; + function_ptr_type m_function_ptr_array[2]; + function_ptr_struct m_function_ptr_struct; + function_ptr_struct m_function_ptr_struct_array[2]; + member_function_ptr_type m_member_function_ptr; + member_function_ptr_type m_member_function_ptr_array[2]; + member_function_ptr_struct m_member_function_ptr_struct; + member_function_ptr_struct m_member_function_ptr_struct_array[2]; + ptr_to_member_type m_ptr_to_member; + ptr_to_member_type m_ptr_to_member_array[2]; + ptr_to_member_struct m_ptr_to_member_struct; + ptr_to_member_struct m_ptr_to_member_struct_array[2]; + bit_field_struct m_bit_field_struct; + bit_field_struct m_bit_field_struct_array[2]; + int_struct m_int_struct; + int_struct m_int_struct_array[2]; + int_struct m_int_struct_holder; + int_struct m_int_struct_holder_array[2]; + pod_struct m_pod_struct; + pod_struct m_pod_struct_array[2]; + derived_pod_struct m_derived_pod_struct; + derived_pod_struct m_derived_pod_struct_array[2]; + derived_struct m_derived_struct; + derived_struct m_derived_struct_array[2]; + derived_int_struct m_derived_int_struct; + derived_int_struct m_derived_int_struct_array[2]; + private_int_holder m_private_int_holder; + private_int_holder m_private_int_holder_array[2]; + char_array_struct m_char_array_struct; + char_array_struct m_char_array_struct_array[2]; + private_int_array_pair m_private_int_array_pair; + private_int_array_pair m_private_int_array_pair_array[2]; + enum_holder_and_int m_enum_holder_and_int; + enum_holder_and_int m_enum_holder_and_int_array[2]; + private_and_protected_int m_private_and_protected_int; + private_and_protected_int m_private_and_protected_int_array[2]; + user_defined_copy_constructor_holder_and_int m_user_defined_copy_constructor_holder_and_int; + user_defined_copy_constructor_holder_and_int m_user_defined_copy_constructor_holder_and_int_array[2]; + user_defined_destructor_holder m_user_defined_destructor_holder; + user_defined_destructor_holder m_user_defined_destructor_holder_array[2]; + virtual_destructor_holder m_virtual_destructor_holder; + virtual_destructor_holder m_virtual_destructor_holder_array[2]; + non_pod_class m_non_pod; + non_pod_class m_non_pod_array[2]; + pod_struct_and_int_union m_pod_struct_and_int_union; + pod_struct_and_int_union m_pod_struct_and_int_union_array[2]; + int_and_pod_struct_union m_int_and_pod_struct_union; + int_and_pod_struct_union m_int_and_pod_struct_union_array[2]; + + public: + // Default constructor. Tries to value-initialize its base subobject and all + // of its data.members. + value_initializer() + : + // Note: CodeGear/Borland may produce a warning, W8039, for each data member + // whose type is an array type, saying "Constructor initializer list ignored". + // If it does, it probably won't value-initialize those arrays, as reported + // by me (Niels Dekker, LKEB) in 2010, report 83751, "Value-initialization: + // arrays should have each element value-initialized", + // http://qc.embarcadero.com/wc/qcmain.aspx?d=83751 + // On the other hand, Microsoft Visual C++ may produce warnings of type C4351, + // saying "new behavior: elements of array '...' will be default initialized", + // which is actually the right behavior! + int_struct(), + m_enum_holder(), + m_enum_holder_array(), + m_enum(), + m_enum_array(), + m_bool(), + m_bool_array(), + m_char(), + m_char_array(), + m_2d_char_array(), + m_3d_char_array(), + m_unsigned_char(), + m_unsigned_char_array(), + m_short(), + m_short_array(), + m_int(), + m_int_array(), + m_unsigned(), + m_unsigned_array(), + m_long(), + m_long_array(), + m_float(), + m_float_array(), + m_double(), + m_double_array(), + m_long_double(), + m_long_double_array(), + m_void_ptr(), + m_void_ptr_array(), + m_function_ptr(), + m_function_ptr_array(), + m_function_ptr_struct(), + m_function_ptr_struct_array(), + m_member_function_ptr(), + m_member_function_ptr_array(), + m_member_function_ptr_struct(), + m_member_function_ptr_struct_array(), +#ifndef BOOST_DETAIL_NO_COMPLETE_VALUE_INITIALIZATION_SKIP_PTR_TO_MEMBER + m_ptr_to_member(), + m_ptr_to_member_array(), + m_ptr_to_member_struct(), + m_ptr_to_member_struct_array(), +#endif + m_bit_field_struct(), + m_bit_field_struct_array(), + m_int_struct(), + m_int_struct_array(), + m_int_struct_holder(), + m_int_struct_holder_array(), + m_pod_struct(), + m_pod_struct_array(), + m_derived_pod_struct(), + m_derived_pod_struct_array(), + m_derived_struct(), + m_derived_struct_array(), + m_derived_int_struct(), + m_derived_int_struct_array(), + m_private_int_holder(), + m_private_int_holder_array(), + m_char_array_struct(), + m_char_array_struct_array(), + m_private_int_array_pair(), + m_private_int_array_pair_array(), + m_enum_holder_and_int(), + m_enum_holder_and_int_array(), + m_private_and_protected_int(), + m_private_and_protected_int_array(), + m_user_defined_copy_constructor_holder_and_int(), + m_user_defined_copy_constructor_holder_and_int_array(), + m_user_defined_destructor_holder(), + m_user_defined_destructor_holder_array(), + m_virtual_destructor_holder(), + m_virtual_destructor_holder_array(), + m_non_pod(), + m_non_pod_array(), + m_pod_struct_and_int_union(), + m_pod_struct_and_int_union_array(), + m_int_and_pod_struct_union(), + m_int_and_pod_struct_union_array() + { + } + + // Returns the number of failures. + unsigned check_value_initialization_of_subobjects() const + { + const unsigned num_failures = + FAILED_TO_VALUE_INITIALIZE(int_struct::data) + + FAILED_TO_VALUE_INITIALIZE(m_enum_holder) + + FAILED_TO_VALUE_INITIALIZE(m_enum_holder_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_enum_holder_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_enum) + + FAILED_TO_VALUE_INITIALIZE(m_enum_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_enum_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_bool) + + FAILED_TO_VALUE_INITIALIZE(m_bool_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_bool_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_char) + + FAILED_TO_VALUE_INITIALIZE(m_char_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_char_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_2d_char_array) + + FAILED_TO_VALUE_INITIALIZE(m_3d_char_array) + + FAILED_TO_VALUE_INITIALIZE(m_unsigned_char) + + FAILED_TO_VALUE_INITIALIZE(m_unsigned_char_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_unsigned_char_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_short) + + FAILED_TO_VALUE_INITIALIZE(m_short_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_short_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_int) + + FAILED_TO_VALUE_INITIALIZE(m_int_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_int_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_unsigned) + + FAILED_TO_VALUE_INITIALIZE(m_unsigned_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_unsigned_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_long) + + FAILED_TO_VALUE_INITIALIZE(m_long_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_long_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_float) + + FAILED_TO_VALUE_INITIALIZE(m_float_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_float_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_double) + + FAILED_TO_VALUE_INITIALIZE(m_double_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_double_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_long_double) + + FAILED_TO_VALUE_INITIALIZE(m_long_double_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_long_double_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_void_ptr) + + FAILED_TO_VALUE_INITIALIZE(m_void_ptr_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_void_ptr_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_function_ptr) + + FAILED_TO_VALUE_INITIALIZE(m_function_ptr_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_function_ptr_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_function_ptr_struct) + + FAILED_TO_VALUE_INITIALIZE(m_function_ptr_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_function_ptr_struct_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_member_function_ptr) + + FAILED_TO_VALUE_INITIALIZE(m_member_function_ptr_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_member_function_ptr_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_member_function_ptr_struct) + + FAILED_TO_VALUE_INITIALIZE(m_member_function_ptr_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_member_function_ptr_struct_array[1]) + +#ifndef BOOST_DETAIL_NO_COMPLETE_VALUE_INITIALIZATION_SKIP_PTR_TO_MEMBER + FAILED_TO_VALUE_INITIALIZE(m_ptr_to_member) + + FAILED_TO_VALUE_INITIALIZE(m_ptr_to_member_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_ptr_to_member_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_ptr_to_member_struct) + + FAILED_TO_VALUE_INITIALIZE(m_ptr_to_member_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_ptr_to_member_struct_array[1]) + +#endif + FAILED_TO_VALUE_INITIALIZE(m_bit_field_struct) + + FAILED_TO_VALUE_INITIALIZE(m_bit_field_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_bit_field_struct_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_int_struct) + + FAILED_TO_VALUE_INITIALIZE(m_int_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_int_struct_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_int_struct_holder) + + FAILED_TO_VALUE_INITIALIZE(m_int_struct_holder_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_int_struct_holder_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_pod_struct) + + FAILED_TO_VALUE_INITIALIZE(m_pod_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_pod_struct_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_derived_pod_struct) + + FAILED_TO_VALUE_INITIALIZE(m_derived_pod_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_derived_pod_struct_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_derived_struct) + + FAILED_TO_VALUE_INITIALIZE(m_derived_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_derived_struct_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_derived_int_struct) + + FAILED_TO_VALUE_INITIALIZE(m_derived_int_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_derived_int_struct_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_private_int_holder) + + FAILED_TO_VALUE_INITIALIZE(m_private_int_holder_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_private_int_holder_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_char_array_struct) + + FAILED_TO_VALUE_INITIALIZE(m_char_array_struct_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_char_array_struct_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_private_int_array_pair) + + FAILED_TO_VALUE_INITIALIZE(m_private_int_array_pair_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_private_int_array_pair_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_enum_holder_and_int) + + FAILED_TO_VALUE_INITIALIZE(m_enum_holder_and_int_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_enum_holder_and_int_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_private_and_protected_int) + + FAILED_TO_VALUE_INITIALIZE(m_private_and_protected_int_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_private_and_protected_int_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_user_defined_copy_constructor_holder_and_int) + + FAILED_TO_VALUE_INITIALIZE(m_user_defined_copy_constructor_holder_and_int_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_user_defined_copy_constructor_holder_and_int_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_user_defined_destructor_holder) + + FAILED_TO_VALUE_INITIALIZE(m_user_defined_destructor_holder_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_user_defined_destructor_holder_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_virtual_destructor_holder) + + FAILED_TO_VALUE_INITIALIZE(m_virtual_destructor_holder_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_virtual_destructor_holder_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_non_pod) + + FAILED_TO_VALUE_INITIALIZE(m_non_pod_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_non_pod_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_pod_struct_and_int_union) + + FAILED_TO_VALUE_INITIALIZE(m_pod_struct_and_int_union_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_pod_struct_and_int_union_array[1]) + + FAILED_TO_VALUE_INITIALIZE(m_int_and_pod_struct_union) + + FAILED_TO_VALUE_INITIALIZE(m_int_and_pod_struct_union_array[0]) + + FAILED_TO_VALUE_INITIALIZE(m_int_and_pod_struct_union_array[1]); + return num_failures; + } + }; + + // Checks value-initialization of a number of small temporary objects. + // Returns the number of failures. + unsigned check_value_initialization_of_temporaries() + { + typedef long double long_double_type; + typedef unsigned char unsigned_char_type; + typedef void* void_ptr_type; + + const unsigned num_failures = + FAILED_TO_VALUE_INITIALIZE(enum_holder()) + + FAILED_TO_VALUE_INITIALIZE(enum_type()) + + FAILED_TO_VALUE_INITIALIZE(bool()) + + FAILED_TO_VALUE_INITIALIZE(char()) + + FAILED_TO_VALUE_INITIALIZE(unsigned_char_type()) + + FAILED_TO_VALUE_INITIALIZE(short()) + + FAILED_TO_VALUE_INITIALIZE(int()) + + FAILED_TO_VALUE_INITIALIZE(unsigned()) + + FAILED_TO_VALUE_INITIALIZE(long()) + + FAILED_TO_VALUE_INITIALIZE(float()) + + FAILED_TO_VALUE_INITIALIZE(double()) + + FAILED_TO_VALUE_INITIALIZE(long_double_type()) + + FAILED_TO_VALUE_INITIALIZE(void_ptr_type()) + + FAILED_TO_VALUE_INITIALIZE(bit_field_struct()) + + FAILED_TO_VALUE_INITIALIZE(function_ptr_type()) + + FAILED_TO_VALUE_INITIALIZE(function_ptr_struct()) + + FAILED_TO_VALUE_INITIALIZE(member_function_ptr_type()) + + FAILED_TO_VALUE_INITIALIZE(member_function_ptr_struct()) + +#ifndef BOOST_DETAIL_NO_COMPLETE_VALUE_INITIALIZATION_SKIP_PTR_TO_MEMBER + FAILED_TO_VALUE_INITIALIZE(ptr_to_member_type()) + + FAILED_TO_VALUE_INITIALIZE(ptr_to_member_struct()) + +#endif + FAILED_TO_VALUE_INITIALIZE(int_struct()) + + FAILED_TO_VALUE_INITIALIZE(int_struct_holder()) + + FAILED_TO_VALUE_INITIALIZE(pod_struct()) + + FAILED_TO_VALUE_INITIALIZE(derived_pod_struct()) + + FAILED_TO_VALUE_INITIALIZE(derived_struct()) + + FAILED_TO_VALUE_INITIALIZE(derived_int_struct()) + + FAILED_TO_VALUE_INITIALIZE(private_int_holder()) + + FAILED_TO_VALUE_INITIALIZE(char_array_struct()) + + FAILED_TO_VALUE_INITIALIZE(private_int_array_pair()) + + // IBM's XL V10.1.0.0 may fail to value-initialize a temporary of a non-POD + // type like enum_holder_and_int, virtual_destructor_holder, or non_pod_class, + // as appeared at the Boost Config/trunk regression page in April 2010. + // Michael Wong (IBM Canada Ltd) confirmed the issue to me (Niels Dekker, LKEB), + // and gave it high priority. + FAILED_TO_VALUE_INITIALIZE(enum_holder_and_int()) + + FAILED_TO_VALUE_INITIALIZE(private_and_protected_int()) + + FAILED_TO_VALUE_INITIALIZE(user_defined_copy_constructor_holder_and_int()) + + // The following line, doing user_defined_destructor_holder(), causes + // a compilation error on Embarcadero 2010 (Borland/CodeGear 6.21), + // as reported by me (Niels Dekker, LKEB) in 2010, bug report 83851, + // "Value-initialized temporary triggers internal backend error C1798", + // http://qc.embarcadero.com/wc/qcmain.aspx?d=83851 + FAILED_TO_VALUE_INITIALIZE(user_defined_destructor_holder()) + + FAILED_TO_VALUE_INITIALIZE(virtual_destructor_holder()) + + FAILED_TO_VALUE_INITIALIZE(non_pod_class()) + + FAILED_TO_VALUE_INITIALIZE(pod_struct_and_int_union()) + + FAILED_TO_VALUE_INITIALIZE(int_and_pod_struct_union()); + return num_failures; + } + + // Checks value-initialization of small heap objects. + // Returns the number of failures. + unsigned check_value_initialization_of_heap_objects() + { + const unsigned num_failures = + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + +#ifndef BOOST_DETAIL_NO_COMPLETE_VALUE_INITIALIZATION_SKIP_PTR_TO_MEMBER + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + +#endif + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ) + + FAILED_TO_VALUE_INITIALIZE( heap_object_wrapper() ); + return num_failures; + } + + // Equivalent to the dirty_stack() function from GCC Bug 33916, + // "Default constructor fails to initialize array members", reported in 2007 by + // Michael Elizabeth Chastain: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 + void dirty_stack() + { + unsigned char array_on_stack[sizeof(value_initializer) + 256]; + for (unsigned i = 0; i < sizeof(array_on_stack); ++i) + { + array_on_stack[i] = 0x11; + } + } + + + // Checks value-initialization of the subobjects of a temporary object, + // an object on the stack, an object on the heap; furthermore it checks + // value-initialization of a number of smaller temporary objects and + // heap objects. + int test() + { + unsigned total_num_failures = 0; + + dirty_stack(); + const unsigned num_failures_of_subobjects_of_a_temporary = + value_initializer().check_value_initialization_of_subobjects(); + + total_num_failures += num_failures_of_subobjects_of_a_temporary; + if ( total_num_failures > 0 ) + { + std::cout << "- Number of subobject initialization failures of a temporary: " + << num_failures_of_subobjects_of_a_temporary << std::endl; + } + dirty_stack(); + value_initializer object_on_stack; + const unsigned num_failures_of_subobjects_on_stack = + object_on_stack.check_value_initialization_of_subobjects(); + + total_num_failures += num_failures_of_subobjects_on_stack; + if ( total_num_failures > 0 ) + { + std::cout << "- Number of subobject initialization failures on the stack: " + << num_failures_of_subobjects_on_stack << std::endl; + } + const value_initializer* const ptr = new value_initializer(); + const unsigned num_failures_of_subobjects_on_heap = ptr->check_value_initialization_of_subobjects(); + delete ptr; + + total_num_failures += num_failures_of_subobjects_on_heap; + if ( total_num_failures > 0 ) + { + std::cout << "- Number of subobject initialization failures on the heap: " + << num_failures_of_subobjects_on_heap << std::endl; + } + + dirty_stack(); + const unsigned num_failures_of_temporaries = check_value_initialization_of_temporaries(); + + total_num_failures += num_failures_of_temporaries; + if ( total_num_failures > 0 ) + { + std::cout << "- Number of initialization failures of temporary objects: " + << num_failures_of_temporaries << std::endl; + } + + const unsigned num_failures_of_heap_objects = check_value_initialization_of_heap_objects(); + + total_num_failures += num_failures_of_heap_objects; + if ( total_num_failures > 0 ) + { + std::cout << "- Number of failures of heap objects: " + << num_failures_of_heap_objects << std::endl; + } + + if ( total_num_failures > 0 ) + { + std::cout << "-- Total number of initialization failures (" + << num_failures_of_subobjects_of_a_temporary << '+' + << num_failures_of_subobjects_on_stack << '+' + << num_failures_of_subobjects_on_heap << '+' + << num_failures_of_temporaries << '+' + << num_failures_of_heap_objects << "): " + << total_num_failures + << "\nDetected by boost_no_complete_value_initialization::test() revision 31." + << std::endl; + } + return static_cast(total_num_failures); + } + +} // End of namespace. diff --git a/test/boost_no_decltype.ipp b/test/boost_no_decltype.ipp index c712e892..f76db77e 100644 --- a/test/boost_no_decltype.ipp +++ b/test/boost_no_decltype.ipp @@ -1,3 +1,4 @@ + // (C) Copyright Beman Dawes 2008 // Use, modification and distribution are subject to the @@ -12,10 +13,34 @@ namespace boost_no_decltype { +struct test_class +{ + test_class() {} +}; + +test_class get_test_class() +{ + return test_class(); +} + +template +void baz(F f) +{ + // + // Strangely VC-10 deduces the return type of F + // to be "test_class&". Remove the constructor + // from test_class and then decltype does work OK!! + // + typedef decltype(f()) res; + res r; +} + int test() { int i; decltype(i) j; + decltype(get_test_class()) k; + baz(get_test_class); return 0; } diff --git a/test/boost_no_extern_template.ipp b/test/boost_no_extern_template.ipp index 732eedc6..0965470b 100644 --- a/test/boost_no_extern_template.ipp +++ b/test/boost_no_extern_template.ipp @@ -12,7 +12,26 @@ namespace boost_no_extern_template { -extern template void f(T); +template void f(T const* p, U const* q) +{ + p = q; +} + +template +class must_not_compile +{ +public: + void f(T const* p, int const* q); +}; + +template +void must_not_compile::f(T const* p, int const* q) +{ + p = q; +} + +extern template void f<>(int const*, float const*); +extern template class must_not_compile; int test() { diff --git a/test/boost_no_initializer_lists.ipp b/test/boost_no_initializer_lists.ipp index 31f03bd0..4bc96a28 100644 --- a/test/boost_no_initializer_lists.ipp +++ b/test/boost_no_initializer_lists.ipp @@ -11,11 +11,18 @@ // DESCRIPTION: If the compiler does not support C++0x initializer lists #include +#include namespace boost_no_initializer_lists { +void f(std::initializer_list) +{ +} + int test() { + std::vector v{"once", "upon", "a", "time"}; // See C++ std 8.5.4 + f( { 1, 2, 3, 4 } ); std::initializer_list x = { 1, 2 }; return 0; } diff --git a/test/boost_no_raw_literals.ipp b/test/boost_no_raw_literals.ipp index 54d22042..83aa3bc7 100644 --- a/test/boost_no_raw_literals.ipp +++ b/test/boost_no_raw_literals.ipp @@ -14,8 +14,8 @@ namespace boost_no_raw_literals { int test() { - const char* s = R"[abc]"; - const wchar_t* ws = LR"[abc]"; + const char* s = R"(abc)"; + const wchar_t* ws = LR"(abc)"; return 0; } diff --git a/test/boost_no_rtti.ipp b/test/boost_no_rtti.ipp index 69594722..dd8992bc 100644 --- a/test/boost_no_rtti.ipp +++ b/test/boost_no_rtti.ipp @@ -36,7 +36,7 @@ void B::t() namespace boost_no_rtti { -int check(const A& a) +int check_f(const A& a) { return typeid(a) == typeid(B) ? 0 : 1; } @@ -45,7 +45,7 @@ int test() { try{ B b; - return check(b); + return check_f(b); } catch(...) { diff --git a/test/config_info.cpp b/test/config_info.cpp index 3b781432..62f906b1 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -985,6 +985,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_AUTO_PTR); PRINT_MACRO(BOOST_NO_CHAR16_T); PRINT_MACRO(BOOST_NO_CHAR32_T); + PRINT_MACRO(BOOST_NO_COMPLETE_VALUE_INITIALIZATION); PRINT_MACRO(BOOST_NO_CONCEPTS); PRINT_MACRO(BOOST_NO_CONSTEXPR); PRINT_MACRO(BOOST_NO_CTYPE_FUNCTIONS); @@ -1080,6 +1081,7 @@ void print_boost_macros() + // END GENERATED BLOCK PRINT_MACRO(BOOST_INTEL); diff --git a/test/config_test.cpp b/test/config_test.cpp index 81aee7c4..30c295d5 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Oct 11 13:04:18 2009 +// This file was automatically generated on Fri Apr 09 12:24:54 2010 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-4. // Use, modification and distribution are subject to the @@ -172,6 +172,11 @@ namespace boost_no_char16_t = empty_boost; #else namespace boost_no_char32_t = empty_boost; #endif +#ifndef BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#include "boost_no_com_value_init.ipp" +#else +namespace boost_no_complete_value_initialization = empty_boost; +#endif #ifndef BOOST_NO_CONCEPTS #include "boost_no_concepts.ipp" #else @@ -1251,6 +1256,11 @@ int main( int, char *[] ) std::cerr << "Failed test for BOOST_NO_CHAR32_T at: " << __FILE__ << ":" << __LINE__ << std::endl; ++error_count; } + if(0 != boost_no_complete_value_initialization::test()) + { + std::cerr << "Failed test for BOOST_NO_COMPLETE_VALUE_INITIALIZATION at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } if(0 != boost_no_concepts::test()) { std::cerr << "Failed test for BOOST_NO_CONCEPTS at: " << __FILE__ << ":" << __LINE__ << std::endl; diff --git a/test/link/Jamfile.v2 b/test/link/Jamfile.v2 index 9e676e8e..c5da6c29 100644 --- a/test/link/Jamfile.v2 +++ b/test/link/Jamfile.v2 @@ -14,3 +14,6 @@ lib link_test : link_test.cpp debug release ; +run main.cpp link_test : : : BOOST_DYN_LINK=1 BOOST_CONFIG_NO_LIB shared shared single : link_test_test ; + + diff --git a/test/link/link_test.cpp b/test/link/link_test.cpp index f0a66263..be80bfcd 100644 --- a/test/link/link_test.cpp +++ b/test/link/link_test.cpp @@ -9,6 +9,8 @@ #define BOOST_CONFIG_SOURCE #include "link_test.hpp" +#include +#include bool BOOST_CONFIG_DECL check_options( bool m_dyn_link, @@ -17,10 +19,36 @@ bool BOOST_CONFIG_DECL check_options( bool m_debug, bool m_stlp_debug) { - return (m_dyn_link == dyn_link) - && (m_dyn_rtl == dyn_rtl) - && (m_has_threads == has_threads) - && (m_debug == debug) - && (m_stlp_debug == stl_debug); + if(m_dyn_link != dyn_link) + { + std::cout << "Dynamic link options do not match" << std::endl; + std::cout << "Application setting = " << m_dyn_link << " Library setting = " << dyn_link << std::endl; + return false; + } + if(m_dyn_rtl != dyn_rtl) + { + std::cout << "Runtime library options do not match" << std::endl; + std::cout << "Application setting = " << m_dyn_rtl << " Library setting = " << dyn_rtl << std::endl; + return false; + } + if(m_has_threads != has_threads) + { + std::cout << "Threading options do not match" << std::endl; + std::cout << "Application setting = " << m_has_threads << " Library setting = " << has_threads << std::endl; + return false; + } + if(m_debug != debug) + { + std::cout << "Debug options do not match" << std::endl; + std::cout << "Application setting = " << m_debug << " Library setting = " << debug << std::endl; + return false; + } + if(m_stlp_debug != stl_debug) + { + std::cout << "STLPort debug options do not match" << std::endl; + std::cout << "Application setting = " << m_stlp_debug << " Library setting = " << stl_debug << std::endl; + return false; + } + return true; } diff --git a/test/link/link_test.hpp b/test/link/link_test.hpp index 16f91bf2..8d6333bb 100644 --- a/test/link/link_test.hpp +++ b/test/link/link_test.hpp @@ -44,11 +44,11 @@ static const bool stl_debug = false; // // set up import and export options: // -#if defined(BOOST_HAS_DECLSPEC) && defined(BOOST_DYN_LINK) +#if defined(BOOST_DYN_LINK) # ifdef BOOST_CONFIG_SOURCE -# define BOOST_CONFIG_DECL __declspec(dllexport) +# define BOOST_CONFIG_DECL BOOST_SYMBOL_EXPORT # else -# define BOOST_CONFIG_DECL __declspec(dllimport) +# define BOOST_CONFIG_DECL BOOST_SYMBOL_IMPORT # endif #endif #ifndef BOOST_CONFIG_DECL @@ -73,5 +73,36 @@ bool BOOST_CONFIG_DECL check_options( # include #endif +#ifndef BOOST_NO_EXTERN_TEMPLATE + +template +T test_free_proc(T v) +{ + return v; +} + +template +struct tester +{ + static int test(); +}; + +template +int tester::test() +{ + return 0; +} + +#ifdef BOOST_CONFIG_SOURCE +template BOOST_SYMBOL_EXPORT int test_free_proc(int); +template BOOST_SYMBOL_EXPORT int tester::test(); +#else +extern template BOOST_SYMBOL_IMPORT int test_free_proc(int); +extern template BOOST_SYMBOL_IMPORT int tester::test(); +#endif + +#endif // BOOST_NO_EXTERN_TEMPLATE + #endif // BOOST_LINK_TEST_HPP + diff --git a/test/link/main.cpp b/test/link/main.cpp index 06643eb5..3926684a 100644 --- a/test/link/main.cpp +++ b/test/link/main.cpp @@ -9,6 +9,10 @@ int main() { +#ifndef BOOST_NO_EXTERN_TEMPLATE + test_free_proc(0); + tester::test(); +#endif return check_options(dyn_link, dyn_rtl, has_threads, debug, stl_debug) ? 0 : -1; } diff --git a/test/link/test/Jamfile.v2 b/test/link/test/Jamfile.v2 index 234da7cc..22668af2 100644 --- a/test/link/test/Jamfile.v2 +++ b/test/link/test/Jamfile.v2 @@ -69,13 +69,14 @@ autolink-lib link_test : ../link_test.cpp : ; + explicit link_test ; run ../main.cpp link_test - : : : msvc-8.0:no static static single debug : link_test_ssd ; + : : : msvc-8.0:no msvc-9.0:no msvc-10.0:no static static single debug : link_test_ssd ; run ../main.cpp link_test - : : : msvc-8.0:no static static single release : link_test_ssr ; + : : : msvc-8.0:no msvc-9.0:no msvc-10.0:no static static single release : link_test_ssr ; run ../main.cpp link_test : : : static static multi debug : link_test_smd ; @@ -113,3 +114,4 @@ run ../main.cpp link_test + diff --git a/test/no_com_value_init_fail.cpp b/test/no_com_value_init_fail.cpp new file mode 100644 index 00000000..ec89a858 --- /dev/null +++ b/test/no_com_value_init_fail.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Fri Apr 09 12:24:53 2010 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id: generate.cpp 49281 2008-10-11 15:40:44Z johnmaddock $ +// + + +// Test file for macro BOOST_NO_COMPLETE_VALUE_INITIALIZATION +// This file should not compile, if it does then +// BOOST_NO_COMPLETE_VALUE_INITIALIZATION should not be defined. +// See file boost_no_com_value_init.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifdef BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#include "boost_no_com_value_init.ipp" +#else +#error "this file should not compile" +#endif + +int main( int, char *[] ) +{ + return boost_no_complete_value_initialization::test(); +} + diff --git a/test/no_com_value_init_pass.cpp b/test/no_com_value_init_pass.cpp new file mode 100644 index 00000000..cfe00a22 --- /dev/null +++ b/test/no_com_value_init_pass.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Fri Apr 09 12:24:53 2010 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id: generate.cpp 49281 2008-10-11 15:40:44Z johnmaddock $ +// + + +// Test file for macro BOOST_NO_COMPLETE_VALUE_INITIALIZATION +// This file should compile, if it does not then +// BOOST_NO_COMPLETE_VALUE_INITIALIZATION should be defined. +// See file boost_no_com_value_init.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifndef BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#include "boost_no_com_value_init.ipp" +#else +namespace boost_no_complete_value_initialization = empty_boost; +#endif + +int main( int, char *[] ) +{ + return boost_no_complete_value_initialization::test(); +} +