From eb60febe831a60a4dd09fd959566be9857c87d06 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 24 Sep 2013 12:49:46 +0000 Subject: [PATCH 01/34] Fixed compilation problems with MinGW-w64. [SVN r85865] --- include/boost/detail/interlocked.hpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/include/boost/detail/interlocked.hpp b/include/boost/detail/interlocked.hpp index c8870d9..5130259 100644 --- a/include/boost/detail/interlocked.hpp +++ b/include/boost/detail/interlocked.hpp @@ -125,14 +125,30 @@ extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* ); # define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange # define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd +// Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets. +#elif defined(__MINGW64_VERSION_MAJOR) + +// MinGW-w64 provides intrin.h for both 32 and 64-bit targets. +#include + +# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd +# if defined(__x86_64__) || defined(__x86_64) +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer +# else +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) +# endif + #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) -#if defined(__MINGW64__) -#define BOOST_INTERLOCKED_IMPORT -#else #define BOOST_INTERLOCKED_IMPORT __declspec(dllimport) -#endif - namespace boost { From 41e2470d21ad9996507a86fe8090c78012e6f00d Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 24 Sep 2013 12:56:50 +0000 Subject: [PATCH 02/34] Enabled #pragma once for all compilers that support it, not only MSVC. [SVN r85866] --- include/boost/detail/interlocked.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/boost/detail/interlocked.hpp b/include/boost/detail/interlocked.hpp index 5130259..c2b3d2e 100644 --- a/include/boost/detail/interlocked.hpp +++ b/include/boost/detail/interlocked.hpp @@ -1,12 +1,6 @@ #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED #define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - // // boost/detail/interlocked.hpp // @@ -19,6 +13,11 @@ #include +// MS compatible compilers support #pragma once +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + #if defined( BOOST_USE_WINDOWS_H ) # include From 589631a886c48fcd1ab405919b50da593bc2796f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 26 Sep 2013 13:02:51 +0000 Subject: [PATCH 03/34] Remove obsolete MSVC check from pragma guard git grep -h -B1 "^#\s*pragma once" | grep -v pragma | sort | uniq is now clean. [SVN r85952] --- include/boost/detail/container_fwd.hpp | 2 +- include/boost/detail/lightweight_test.hpp | 2 +- include/boost/detail/lightweight_thread.hpp | 2 +- include/boost/detail/no_exceptions_support.hpp | 2 +- include/boost/detail/quick_allocator.hpp | 2 +- include/boost/detail/utf8_codecvt_facet.hpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/boost/detail/container_fwd.hpp b/include/boost/detail/container_fwd.hpp index ef17498..a90ce5f 100644 --- a/include/boost/detail/container_fwd.hpp +++ b/include/boost/detail/container_fwd.hpp @@ -8,7 +8,7 @@ #if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP) #define BOOST_DETAIL_CONTAINER_FWD_HPP -#if defined(_MSC_VER) && (_MSC_VER >= 1020) && \ +#if defined(_MSC_VER) && \ !defined(BOOST_DETAIL_TEST_CONFIG_ONLY) # pragma once #endif diff --git a/include/boost/detail/lightweight_test.hpp b/include/boost/detail/lightweight_test.hpp index 49dd5e4..8704d5c 100644 --- a/include/boost/detail/lightweight_test.hpp +++ b/include/boost/detail/lightweight_test.hpp @@ -3,7 +3,7 @@ // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/include/boost/detail/lightweight_thread.hpp b/include/boost/detail/lightweight_thread.hpp index 6fe70a6..8eba1f8 100644 --- a/include/boost/detail/lightweight_thread.hpp +++ b/include/boost/detail/lightweight_thread.hpp @@ -3,7 +3,7 @@ // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/include/boost/detail/no_exceptions_support.hpp b/include/boost/detail/no_exceptions_support.hpp index d94e358..89336f6 100644 --- a/include/boost/detail/no_exceptions_support.hpp +++ b/include/boost/detail/no_exceptions_support.hpp @@ -1,7 +1,7 @@ #ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_ #define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_ -#if (defined _MSC_VER) && (_MSC_VER >= 1200) +#if defined(_MSC_VER) # pragma once #endif diff --git a/include/boost/detail/quick_allocator.hpp b/include/boost/detail/quick_allocator.hpp index d54b3a7..ba048e0 100644 --- a/include/boost/detail/quick_allocator.hpp +++ b/include/boost/detail/quick_allocator.hpp @@ -3,7 +3,7 @@ // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/include/boost/detail/utf8_codecvt_facet.hpp b/include/boost/detail/utf8_codecvt_facet.hpp index 553cc99..eb65418 100644 --- a/include/boost/detail/utf8_codecvt_facet.hpp +++ b/include/boost/detail/utf8_codecvt_facet.hpp @@ -7,7 +7,7 @@ #define BOOST_UTF8_CODECVT_FACET_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif From 1ec40ed29ca458b0ec2156402e759b21279e5769 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 26 Sep 2013 13:04:51 +0000 Subject: [PATCH 04/34] allocator_utilities: Remove obsolete MSVC version check. [SVN r85955] --- include/boost/detail/allocator_utilities.hpp | 25 -------------------- 1 file changed, 25 deletions(-) diff --git a/include/boost/detail/allocator_utilities.hpp b/include/boost/detail/allocator_utilities.hpp index 5d6ef48..a81f386 100644 --- a/include/boost/detail/allocator_utilities.hpp +++ b/include/boost/detail/allocator_utilities.hpp @@ -11,7 +11,6 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include -#include #include #include #include @@ -116,29 +115,6 @@ struct partial_std_allocator_rebind_to /* rebind operation in all other cases */ -#if BOOST_WORKAROUND(BOOST_MSVC,<1300) -/* Workaround for a problem in MSVC with dependent template typedefs - * when doing rebinding of allocators. - * Modeled after (thanks, Aleksey!) - */ - -template -struct rebinder -{ - template struct fake_allocator:Allocator{}; - template<> struct fake_allocator - { - template struct rebind{}; - }; - - template - struct result: - fake_allocator::value>:: - template rebind - { - }; -}; -#else template struct rebinder { @@ -149,7 +125,6 @@ struct rebinder rebind::other other; }; }; -#endif template struct compliant_allocator_rebind_to From 275fe9d73bd70c897f64f537b8f259ce53497891 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 29 Sep 2013 11:04:37 +0000 Subject: [PATCH 05/34] Add BOOST_USE_INTRIN_H support; remove #pragma intrinsic, not needed and not supported on Intel. [SVN r85994] --- include/boost/detail/interlocked.hpp | 33 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/include/boost/detail/interlocked.hpp b/include/boost/detail/interlocked.hpp index c2b3d2e..1152f71 100644 --- a/include/boost/detail/interlocked.hpp +++ b/include/boost/detail/interlocked.hpp @@ -30,6 +30,30 @@ # define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer # define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer +#elif defined( BOOST_USE_INTRIN_H ) + +#include + +# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +# if defined(_M_IA64) || defined(_M_AMD64) || defined(__x86_64__) || defined(__x86_64) + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer + +# else + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) + +# endif + #elif defined(_WIN32_WCE) #if _WIN32_WCE >= 0x600 @@ -92,20 +116,11 @@ extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); #endif -# pragma intrinsic( _InterlockedIncrement ) -# pragma intrinsic( _InterlockedDecrement ) -# pragma intrinsic( _InterlockedCompareExchange ) -# pragma intrinsic( _InterlockedExchange ) -# pragma intrinsic( _InterlockedExchangeAdd ) - # if defined(_M_IA64) || defined(_M_AMD64) extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* ); extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* ); -# pragma intrinsic( _InterlockedCompareExchangePointer ) -# pragma intrinsic( _InterlockedExchangePointer ) - # define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer # define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer From 1de858a76fae20b47e21e8253111c369670929aa Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 29 Sep 2013 16:42:24 +0000 Subject: [PATCH 06/34] Finished POSIX condition_variable, working on Windows. [SVN r86007] --- include/boost/detail/winapi/handles.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/boost/detail/winapi/handles.hpp b/include/boost/detail/winapi/handles.hpp index d4cffc8..7108daa 100644 --- a/include/boost/detail/winapi/handles.hpp +++ b/include/boost/detail/winapi/handles.hpp @@ -24,14 +24,20 @@ namespace winapi #if defined( BOOST_USE_WINDOWS_H ) using ::CloseHandle; using ::DuplicateHandle; + + const DWORD_ duplicate_close_source = DUPLICATE_CLOSE_SOURCE; + const DWORD_ duplicate_same_access = DUPLICATE_SAME_ACCESS; + const HANDLE_ invalid_handle_value = INVALID_HANDLE_VALUE; #else -extern "C" { - __declspec(dllimport) int __stdcall +extern "C" { + __declspec(dllimport) int __stdcall CloseHandle(void*); - __declspec(dllimport) int __stdcall + __declspec(dllimport) int __stdcall DuplicateHandle(void*,void*,void*,void**,unsigned long,int,unsigned long); } - + const DWORD_ duplicate_close_source = 1; + const DWORD_ duplicate_same_access = 2; + const HANDLE_ invalid_handle_value = (HANDLE_)(-1); #endif } } From c8ca7d97886450bc238dd36c4e8723e3ae00e0e2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 30 Sep 2013 00:21:39 +0000 Subject: [PATCH 07/34] Detail: Remove obsolete MSVC version checks. [SVN r86039] --- include/boost/detail/identifier.hpp | 2 -- include/boost/detail/is_incrementable.hpp | 3 +-- include/boost/detail/numeric_traits.hpp | 11 +---------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/include/boost/detail/identifier.hpp b/include/boost/detail/identifier.hpp index 688a664..063d238 100644 --- a/include/boost/detail/identifier.hpp +++ b/include/boost/detail/identifier.hpp @@ -57,9 +57,7 @@ namespace boost identifier() {} explicit identifier( value_type v ) : m_value(v) {} - #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 1300 == VC++ 7.0 bug workaround private: - #endif T m_value; }; diff --git a/include/boost/detail/is_incrementable.hpp b/include/boost/detail/is_incrementable.hpp index e7ef9dc..6b36378 100644 --- a/include/boost/detail/is_incrementable.hpp +++ b/include/boost/detail/is_incrementable.hpp @@ -55,8 +55,7 @@ namespace is_incrementable_ # endif -# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ - || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) # define BOOST_comma(a,b) (a) # else // In case an operator++ is found that returns void, we'll use ++x,0 diff --git a/include/boost/detail/numeric_traits.hpp b/include/boost/detail/numeric_traits.hpp index 6325d70..2f97ebf 100644 --- a/include/boost/detail/numeric_traits.hpp +++ b/include/boost/detail/numeric_traits.hpp @@ -74,7 +74,7 @@ namespace boost { namespace detail { template struct is_signed { -#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300 +#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0))); #else BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits::is_signed); @@ -128,15 +128,6 @@ namespace boost { namespace detail { private: typedef Integer integer_type; typedef std::numeric_limits x; -# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // for some reason, MSVC asserts when it shouldn't unless we make these - // local definitions - BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer); - BOOST_STATIC_CONSTANT(bool, is_specialized = x::is_specialized); - - BOOST_STATIC_ASSERT(is_integer); - BOOST_STATIC_ASSERT(is_specialized); -# endif public: typedef typename if_true<(int(x::is_signed) From 41f09db5d629f91ab1a2d7f5396cea1d13af6507 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 30 Sep 2013 16:00:29 +0000 Subject: [PATCH 08/34] Exception: Remove obsolete GCC version check. [SVN r86073] --- include/boost/detail/catch_exceptions.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/boost/detail/catch_exceptions.hpp b/include/boost/detail/catch_exceptions.hpp index b1a3c76..823ebd1 100644 --- a/include/boost/detail/catch_exceptions.hpp +++ b/include/boost/detail/catch_exceptions.hpp @@ -24,11 +24,7 @@ #include // for exception, bad_exception #include // for std exception hierarchy #include // for exit codes -# if __GNUC__ != 2 || __GNUC_MINOR__ > 96 -# include // for ostream -# else -# include // workaround GNU missing ostream header -# endif +#include // for ostream # if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551) # define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT From 4dc7897c9faa0d78776cd931ae1b02691771ae65 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 1 Oct 2013 08:43:30 +0000 Subject: [PATCH 09/34] Container: Remove obsolete GCC version check. [SVN r86109] --- include/boost/detail/container_fwd.hpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/boost/detail/container_fwd.hpp b/include/boost/detail/container_fwd.hpp index a90ce5f..04ce972 100644 --- a/include/boost/detail/container_fwd.hpp +++ b/include/boost/detail/container_fwd.hpp @@ -119,12 +119,7 @@ namespace std template class allocator; template class basic_string; -#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) - - template struct string_char_traits; -#else template struct char_traits; -#endif #if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT) template struct complex; From 933b2c596b982137272b7efd23d999a368728175 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 6 Oct 2013 17:40:19 +0000 Subject: [PATCH 10/34] Boost.Sync: Added preliminary implementation of a waitable timer for fixed time point waits. Updated WinAPI functions to contain the required APIs. [SVN r86179] --- include/boost/detail/winapi/basic_types.hpp | 25 ++++ include/boost/detail/winapi/dll.hpp | 30 +++-- include/boost/detail/winapi/process.hpp | 7 +- .../boost/detail/winapi/synchronization.hpp | 121 +++++++++++------- include/boost/detail/winapi/thread.hpp | 18 +-- include/boost/detail/winapi/thread_pool.hpp | 102 +++++++++++++++ include/boost/detail/winapi/tls.hpp | 49 +++++++ .../boost/detail/winapi/waitable_timer.hpp | 110 ++++++++++++++++ 8 files changed, 398 insertions(+), 64 deletions(-) create mode 100644 include/boost/detail/winapi/thread_pool.hpp create mode 100644 include/boost/detail/winapi/tls.hpp create mode 100644 include/boost/detail/winapi/waitable_timer.hpp diff --git a/include/boost/detail/winapi/basic_types.hpp b/include/boost/detail/winapi/basic_types.hpp index e9ca370..ec05a38 100644 --- a/include/boost/detail/winapi/basic_types.hpp +++ b/include/boost/detail/winapi/basic_types.hpp @@ -31,6 +31,9 @@ # define WINAPI __stdcall # endif # endif +# ifndef NTAPI +# define NTAPI __stdcall +# endif #else # error "Win32 functions not available" #endif @@ -44,11 +47,19 @@ namespace detail { namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) typedef ::BOOL BOOL_; + typedef ::BOOLEAN BOOLEAN_; + typedef ::PBOOLEAN PBOOLEAN_; + typedef ::BYTE BYTE_; typedef ::WORD WORD_; typedef ::DWORD DWORD_; typedef ::HANDLE HANDLE_; + typedef ::HMODULE HMODULE_; typedef ::LONG LONG_; + typedef ::ULONG ULONG_; typedef ::LONGLONG LONGLONG_; + typedef ::INT_PTR INT_PTR_; + typedef ::UINT_PTR UINT_PTR_; + typedef ::LONG_PTR LONG_PTR_; typedef ::ULONG_PTR ULONG_PTR_; typedef ::LARGE_INTEGER LARGE_INTEGER_; typedef ::PLARGE_INTEGER PLARGE_INTEGER_; @@ -63,11 +74,16 @@ namespace winapi { #else extern "C" { typedef int BOOL_; + typedef unsigned char BYTE_; + typedef BYTE_ BOOLEAN_; + typedef BOOLEAN_* PBOOLEAN_; typedef unsigned short WORD_; typedef unsigned long DWORD_; typedef void* HANDLE_; + typedef void* HMODULE_; typedef long LONG_; + typedef unsigned long ULONG_; // @FIXME Which condition must be tested //~ #if !defined(_M_IX86) @@ -84,11 +100,20 @@ extern "C" { // @FIXME Which condition must be tested # ifdef _WIN64 #if defined(__CYGWIN__) + typedef long INT_PTR_; + typedef unsigned long INT_PTR_; + typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; #else + typedef __int64 INT_PTR_; + typedef unsigned __int64 UINT_PTR_; + typedef __int64 LONG_PTR_; typedef unsigned __int64 ULONG_PTR_; #endif # else + typedef int INT_PTR_; + typedef unsigned int INT_PTR_; + typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; # endif diff --git a/include/boost/detail/winapi/dll.hpp b/include/boost/detail/winapi/dll.hpp index ed45272..832d1e6 100644 --- a/include/boost/detail/winapi/dll.hpp +++ b/include/boost/detail/winapi/dll.hpp @@ -23,33 +23,47 @@ namespace detail namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) + typedef ::FARPROC FARPROC_; + typedef ::NEARPROC NEARPROC_; + typedef ::PROC PROC_; + using ::LoadLibrary; using ::FreeLibrary; using ::GetProcAddress; using ::GetModuleHandleA; #else -extern "C" { - __declspec(dllimport) HMODULE_ __stdcall +extern "C" { +#ifdef _WIN64 + typedef INT_PTR (WINAPI *FARPROC_)(); + typedef INT_PTR (WINAPI *NEARPROC_)(); + typedef INT_PTR (WINAPI *PROC_)(); +#else + typedef int (WINAPI *FARPROC_)(); + typedef int (WINAPI *NEARPROC_)(); + typedef int (WINAPI *PROC_)(); +#endif // _WIN64 + + __declspec(dllimport) HMODULE_ WINAPI LoadLibrary( LPCTSTR_ lpFileName ); - __declspec(dllimport) BOOL_ __stdcall + __declspec(dllimport) BOOL_ WINAPI FreeLibrary( HMODULE_ hModule ); - __declspec(dllimport) FARPROC_ __stdcall + __declspec(dllimport) FARPROC_ WINAPI GetProcAddress( HMODULE_ hModule, LPCSTR_ lpProcName ); - __declspec(dllimport) FARPROC_ __stdcall + __declspec(dllimport) HMODULE_ WINAPI GetModuleHandleA( - LPCSTR_ lpProcName + LPCSTR_ lpFileName ); -} +} #endif } } } -#endif // BOOST_DETAIL_WINAPI_THREAD_HPP +#endif // BOOST_DETAIL_WINAPI_DLL_HPP diff --git a/include/boost/detail/winapi/process.hpp b/include/boost/detail/winapi/process.hpp index 411ffaf..de287b1 100644 --- a/include/boost/detail/winapi/process.hpp +++ b/include/boost/detail/winapi/process.hpp @@ -23,10 +23,9 @@ namespace winapi { using ::GetCurrentProcessId; #else # ifndef UNDER_CE -extern "C" { - __declspec(dllimport) unsigned long __stdcall - GetCurrentProcessId(void); -} +extern "C" { + __declspec(dllimport) DWORD_ WINAPI GetCurrentProcessId(void); +} # else using ::GetCurrentProcessId; # endif diff --git a/include/boost/detail/winapi/synchronization.hpp b/include/boost/detail/winapi/synchronization.hpp index 5d3327a..88911df 100644 --- a/include/boost/detail/winapi/synchronization.hpp +++ b/include/boost/detail/winapi/synchronization.hpp @@ -74,56 +74,64 @@ extern "C" { #endif }; - __declspec(dllimport) void __stdcall + __declspec(dllimport) void WINAPI InitializeCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void __stdcall + __declspec(dllimport) void WINAPI EnterCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) bool __stdcall + __declspec(dllimport) bool WINAPI TryEnterCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void __stdcall + __declspec(dllimport) void WINAPI LeaveCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void __stdcall + __declspec(dllimport) void WINAPI DeleteCriticalSection(CRITICAL_SECTION_ *); struct _SECURITY_ATTRIBUTES; # ifdef BOOST_NO_ANSI_APIS - __declspec(dllimport) void* __stdcall - CreateMutexW(_SECURITY_ATTRIBUTES*,int,wchar_t const*); - __declspec(dllimport) void* __stdcall - CreateSemaphoreW(_SECURITY_ATTRIBUTES*,long,long,wchar_t const*); - __declspec(dllimport) void* __stdcall - CreateEventW(_SECURITY_ATTRIBUTES*,int,int,wchar_t const*); - __declspec(dllimport) void* __stdcall - OpenEventW(unsigned long,int,wchar_t const*); + __declspec(dllimport) HANDLE_ WINAPI + CreateMutexW(_SECURITY_ATTRIBUTES*, BOOL_, LPCWSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenMutexW(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateSemaphoreW(_SECURITY_ATTRIBUTES*, LONG_, LONG_, LPCWSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenSemaphoreW(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateEventW(_SECURITY_ATTRIBUTES*, BOOL_, BOOL_, LPCWSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenEventW(DWORD_, BOOL_, LPCWSTR_); # else - __declspec(dllimport) void* __stdcall - CreateMutexA(_SECURITY_ATTRIBUTES*,int,char const*); - __declspec(dllimport) void* __stdcall - CreateSemaphoreA(_SECURITY_ATTRIBUTES*,long,long,char const*); - __declspec(dllimport) void* __stdcall - CreateEventA(_SECURITY_ATTRIBUTES*,int,int,char const*); - __declspec(dllimport) void* __stdcall - OpenEventA(unsigned long,int,char const*); + __declspec(dllimport) HANDLE_ WINAPI + CreateMutexA(_SECURITY_ATTRIBUTES*, BOOL_, LPCSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenMutexA(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateSemaphoreA(_SECURITY_ATTRIBUTES*, LONG_, LONG_, LPCSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenSemaphoreA(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateEventA(_SECURITY_ATTRIBUTES*, BOOL_, BOOL_, LPCSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenEventA(DWORD_, BOOL_, LPCSTR_); # endif - __declspec(dllimport) int __stdcall - ReleaseMutex(void*); - __declspec(dllimport) unsigned long __stdcall - WaitForSingleObject(void*,unsigned long); - __declspec(dllimport) unsigned long __stdcall - WaitForMultipleObjects(unsigned long nCount, - void* const * lpHandles, - int bWaitAll, - unsigned long dwMilliseconds); - __declspec(dllimport) int __stdcall - ReleaseSemaphore(void*,long,long*); + __declspec(dllimport) BOOL_ WINAPI + ReleaseMutex(HANDLE_); + __declspec(dllimport) DWORD_ WINAPI + WaitForSingleObject(HANDLE_, DWORD_); + __declspec(dllimport) DWORD_ WINAPI + WaitForMultipleObjects(DWORD_ nCount, + HANDLE_ const * lpHandles, + BOOL_ bWaitAll, + DWORD_ dwMilliseconds); + __declspec(dllimport) BOOL_ WINAPI + ReleaseSemaphore(HANDLE_, LONG_, LONG_*); typedef void (__stdcall *PAPCFUNC8)(ULONG_PTR_); - __declspec(dllimport) unsigned long __stdcall - QueueUserAPC(PAPCFUNC8,void*,ULONG_PTR_); + __declspec(dllimport) DWORD_ WINAPI + QueueUserAPC(PAPCFUNC8, HANDLE_, ULONG_PTR_); # ifndef UNDER_CE - __declspec(dllimport) int __stdcall - SetEvent(void*); - __declspec(dllimport) int __stdcall - ResetEvent(void*); + __declspec(dllimport) BOOL_ WINAPI + SetEvent(HANDLE_); + __declspec(dllimport) BOOL_ WINAPI + ResetEvent(HANDLE_); # else using ::SetEvent; using ::ResetEvent; @@ -131,14 +139,41 @@ extern "C" { } // extern "C" - const DWORD_ infinite = (DWORD_)0xFFFFFFFF; - const DWORD_ wait_abandoned = 0x00000080L; - const DWORD_ wait_object_0 = 0x00000000L; - const DWORD_ wait_timeout = 0x00000102L; - const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF; +const DWORD_ infinite = (DWORD_)0xFFFFFFFF; +const DWORD_ wait_abandoned = 0x00000080L; +const DWORD_ wait_object_0 = 0x00000000L; +const DWORD_ wait_timeout = 0x00000102L; +const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF; #endif // defined( BOOST_USE_WINDOWS_H ) +BOOST_FORCEINLINE HANDLE_ create_anonymous_mutex(_SECURITY_ATTRIBUTES* lpAttributes, BOOL_ bInitialOwner) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateMutexW(lpAttributes, bInitialOwner, 0); +#else + return CreateMutexA(lpAttributes, bInitialOwner, 0); +#endif +} + +BOOST_FORCEINLINE HANDLE_ create_anonymous_semaphore(_SECURITY_ATTRIBUTES* lpAttributes, LONG_ lInitialCount, LONG_ lMaximumCount) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateSemaphoreW(lpAttributes, lInitialCount, lMaximumCount, 0); +#else + return CreateSemaphoreA(lpAttributes, lInitialCount, lMaximumCount, 0); +#endif +} + +BOOST_FORCEINLINE HANDLE_ create_anonymous_event(_SECURITY_ATTRIBUTES* lpAttributes, BOOL_ bManualReset, BOOL_ bInitialState) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateEventW(lpAttributes, bManualReset, bInitialState, 0); +#else + return CreateEventA(lpAttributes, bManualReset, bInitialState, 0); +#endif +} + } } } diff --git a/include/boost/detail/winapi/thread.hpp b/include/boost/detail/winapi/thread.hpp index 3c1be66..ee0dac6 100644 --- a/include/boost/detail/winapi/thread.hpp +++ b/include/boost/detail/winapi/thread.hpp @@ -26,21 +26,21 @@ namespace winapi using ::GetCurrentThreadId; using ::SleepEx; using ::Sleep; + using ::SwitchToThread; #else -extern "C" { +extern "C" { # ifndef UNDER_CE - __declspec(dllimport) unsigned long __stdcall - GetCurrentThreadId(void); - __declspec(dllimport) unsigned long __stdcall - SleepEx(unsigned long,int); - __declspec(dllimport) void __stdcall - Sleep(unsigned long); + __declspec(dllimport) DWORD_ WINAPI GetCurrentThreadId(void); + __declspec(dllimport) DWORD_ WINAPI SleepEx(DWORD_, BOOL_); + __declspec(dllimport) void WINAPI Sleep(DWORD_); + __declspec(dllimport) BOOL_ WINAPI SwitchToThread(void); #else using ::GetCurrentThreadId; using ::SleepEx; using ::Sleep; -#endif -} + using ::SwitchToThread; +#endif +} #endif } } diff --git a/include/boost/detail/winapi/thread_pool.hpp b/include/boost/detail/winapi/thread_pool.hpp new file mode 100644 index 0000000..aa56e94 --- /dev/null +++ b/include/boost/detail/winapi/thread_pool.hpp @@ -0,0 +1,102 @@ +// thread_pool.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_THREAD_POOL_HPP +#define BOOST_DETAIL_WINAPI_THREAD_POOL_HPP + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + +typedef ::WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACKFUNC_; +typedef ::WAITORTIMERCALLBACK WAITORTIMERCALLBACK_; + +using ::RegisterWaitForSingleObject; +using ::RegisterWaitForSingleObjectEx; +using ::UnregisterWait; +using ::UnregisterWaitEx; + +const ULONG_ wt_execute_default = WT_EXECUTEDEFAULT; +const ULONG_ wt_execute_in_io_thread = WT_EXECUTEINIOTHREAD; +const ULONG_ wt_execute_in_ui_thread = WT_EXECUTEINUITHREAD; +const ULONG_ wt_execute_in_wait_thread = WT_EXECUTEINWAITTHREAD; +const ULONG_ wt_execute_only_once = WT_EXECUTEONLYONCE; +const ULONG_ wt_execute_in_timer_thread = WT_EXECUTEINTIMERTHREAD; +const ULONG_ wt_execute_long_function = WT_EXECUTELONGFUNCTION; +const ULONG_ wt_execute_in_persistent_io_thread = WT_EXECUTEINPERSISTENTIOTHREAD; +const ULONG_ wt_execute_in_persistent_thread = WT_EXECUTEINPERSISTENTTHREAD; +const ULONG_ wt_transfer_impersonation = WT_TRANSFER_IMPERSONATION; + +inline ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit) +{ + return WT_SET_MAX_THREADPOOL_THREADS(flags, limit); +} + +#else + +extern "C" { + +typedef void (NTAPI* WAITORTIMERCALLBACKFUNC_) (PVOID_, BOOLEAN_); +typedef WAITORTIMERCALLBACKFUNC_ WAITORTIMERCALLBACK_; + +__declspec(dllimport) BOOL_ WINAPI RegisterWaitForSingleObject +( + HANDLE_* phNewWaitObject, + HANDLE_ hObject, + WAITORTIMERCALLBACK_ Callback, + PVOID_ Context, + ULONG_ dwMilliseconds, + ULONG_ dwFlags +); + +__declspec(dllimport) HANDLE_ WINAPI RegisterWaitForSingleObjectEx +( + HANDLE_ hObject, + WAITORTIMERCALLBACK_ Callback, + PVOID_ Context, + ULONG_ dwMilliseconds, + ULONG_ dwFlags +); + +__declspec(dllimport) BOOL_ WINAPI UnregisterWait(HANDLE_ WaitHandle); +__declspec(dllimport) BOOL_ WINAPI UnregisterWaitEx(HANDLE_ WaitHandle, HANDLE_ CompletionEvent); + +} // extern "C" + +const ULONG_ wt_execute_default = 0x00000000; +const ULONG_ wt_execute_in_io_thread = 0x00000001; +const ULONG_ wt_execute_in_ui_thread = 0x00000002; +const ULONG_ wt_execute_in_wait_thread = 0x00000004; +const ULONG_ wt_execute_only_once = 0x00000008; +const ULONG_ wt_execute_in_timer_thread = 0x00000020; +const ULONG_ wt_execute_long_function = 0x00000010; +const ULONG_ wt_execute_in_persistent_io_thread = 0x00000040; +const ULONG_ wt_execute_in_persistent_thread = 0x00000080; +const ULONG_ wt_transfer_impersonation = 0x00000100; + +inline ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit) +{ + return flags | (limit << 16); +} + +#endif +} +} +} + +#endif // BOOST_DETAIL_WINAPI_THREAD_POOL_HPP diff --git a/include/boost/detail/winapi/tls.hpp b/include/boost/detail/winapi/tls.hpp new file mode 100644 index 0000000..d948693 --- /dev/null +++ b/include/boost/detail/winapi/tls.hpp @@ -0,0 +1,49 @@ +// tls.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_TLS_HPP +#define BOOST_DETAIL_WINAPI_TLS_HPP + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + +using ::TlsAlloc; +using ::TlsGetValue; +using ::TlsSetValue; +using ::TlsFree; + +const DWORD_ tls_out_of_indexes = TLS_OUT_OF_INDEXES; + +#else + +extern "C" { +__declspec(dllimport) DWORD_ WINAPI TlsAlloc(void); +__declspec(dllimport) LPVOID_ WINAPI TlsGetValue(DWORD_ dwTlsIndex); +__declspec(dllimport) BOOL_ WINAPI TlsSetValue(DWORD_ dwTlsIndex, LPVOID_ lpTlsValue); +__declspec(dllimport) BOOL_ WINAPI TlsFree(DWORD_ dwTlsIndex); +} + +const DWORD_ tls_out_of_indexes = 0xFFFFFFFF; + +#endif +} +} +} + +#endif // BOOST_DETAIL_WINAPI_TLS_HPP diff --git a/include/boost/detail/winapi/waitable_timer.hpp b/include/boost/detail/winapi/waitable_timer.hpp new file mode 100644 index 0000000..52a7338 --- /dev/null +++ b/include/boost/detail/winapi/waitable_timer.hpp @@ -0,0 +1,110 @@ +// waitable_timer.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP +#define BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + +typedef ::PTIMERAPCROUTINE PTIMERAPCROUTINE_; + +# ifdef BOOST_NO_ANSI_APIS +using ::CreateWaitableTimerW; +using ::OpenWaitableTimerW; +# else +using ::CreateWaitableTimerA; +using ::OpenWaitableTimerA; +# endif +using ::SetWaitableTimer; +using ::CancelWaitableTimer; + +#else + +extern "C" { + +struct _SECURITY_ATTRIBUTES; + +typedef void (WINAPI* PTIMERAPCROUTINE_) +( + LPVOID_ lpArgToCompletionRoutine, + DWORD_ dwTimerLowValue, + DWORD_ dwTimerHighValue +); + +# ifdef BOOST_NO_ANSI_APIS +__declspec(dllimport) HANDLE_ WINAPI CreateWaitableTimerW +( + _SECURITY_ATTRIBUTES* lpTimerAttributes, + BOOL_ bManualReset, + LPCWSTR_ lpTimerName +); + +__declspec(dllimport) HANDLE_ WINAPI OpenWaitableTimerW +( + DWORD_ dwDesiredAccess, + BOOL_ bInheritHandle, + LPCWSTR_ lpTimerName +); +# else +__declspec(dllimport) HANDLE_ WINAPI CreateWaitableTimerA +( + _SECURITY_ATTRIBUTES* lpTimerAttributes, + BOOL_ bManualReset, + LPCSTR_ lpTimerName +); + +__declspec(dllimport) HANDLE_ WINAPI OpenWaitableTimerA +( + DWORD_ dwDesiredAccess, + BOOL_ bInheritHandle, + LPCSTR_ lpTimerName +); +# endif + +__declspec(dllimport) BOOL_ WINAPI SetWaitableTimer +( + HANDLE_ hTimer, + const LARGE_INTEGER_ *lpDueTime, + LONG_ lPeriod, + PTIMERAPCROUTINE_ pfnCompletionRoutine, + LPVOID_ lpArgToCompletionRoutine, + BOOL_ fResume +); + +__declspec(dllimport) BOOL_ WINAPI CancelWaitableTimer(HANDLE_ hTimer); + +} + +#endif + +BOOST_FORCEINLINE HANDLE_ create_anonymous_waitable_timer(_SECURITY_ATTRIBUTES* lpTimerAttributes, BOOL_ bManualReset) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateWaitableTimerW(lpTimerAttributes, bManualReset, 0); +#else + return CreateWaitableTimerA(lpTimerAttributes, bManualReset, 0); +#endif +} + +} +} +} + +#endif // BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP From 0f9b39df3fad800dd352d7df5c6f1c062edfb432 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 7 Oct 2013 17:41:43 +0000 Subject: [PATCH 11/34] Fixed WinAPI compilation. Ported timed mutex to waitable timer. Windows time points are now aligned with FILETIME to reduce conversion overhead when used with waitable timers. [SVN r86192] --- include/boost/detail/winapi/basic_types.hpp | 4 +- include/boost/detail/winapi/dll.hpp | 39 +++++++++++++------ .../boost/detail/winapi/synchronization.hpp | 2 + 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/include/boost/detail/winapi/basic_types.hpp b/include/boost/detail/winapi/basic_types.hpp index ec05a38..6692fe0 100644 --- a/include/boost/detail/winapi/basic_types.hpp +++ b/include/boost/detail/winapi/basic_types.hpp @@ -101,7 +101,7 @@ extern "C" { # ifdef _WIN64 #if defined(__CYGWIN__) typedef long INT_PTR_; - typedef unsigned long INT_PTR_; + typedef unsigned long UINT_PTR_; typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; #else @@ -112,7 +112,7 @@ extern "C" { #endif # else typedef int INT_PTR_; - typedef unsigned int INT_PTR_; + typedef unsigned int UINT_PTR_; typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; # endif diff --git a/include/boost/detail/winapi/dll.hpp b/include/boost/detail/winapi/dll.hpp index 832d1e6..fcefddf 100644 --- a/include/boost/detail/winapi/dll.hpp +++ b/include/boost/detail/winapi/dll.hpp @@ -27,26 +27,47 @@ namespace winapi typedef ::NEARPROC NEARPROC_; typedef ::PROC PROC_; - using ::LoadLibrary; +# ifdef BOOST_NO_ANSI_APIS + using ::LoadLibraryW; + using ::GetModuleHandleW; +# else + using ::LoadLibraryA; + using ::GetModuleHandleA; +# endif using ::FreeLibrary; using ::GetProcAddress; - using ::GetModuleHandleA; #else extern "C" { -#ifdef _WIN64 +# ifdef _WIN64 typedef INT_PTR (WINAPI *FARPROC_)(); typedef INT_PTR (WINAPI *NEARPROC_)(); typedef INT_PTR (WINAPI *PROC_)(); -#else +# else typedef int (WINAPI *FARPROC_)(); typedef int (WINAPI *NEARPROC_)(); typedef int (WINAPI *PROC_)(); -#endif // _WIN64 +# endif // _WIN64 +# ifdef BOOST_NO_ANSI_APIS __declspec(dllimport) HMODULE_ WINAPI - LoadLibrary( - LPCTSTR_ lpFileName + LoadLibraryW( + LPCWSTR_ lpFileName ); + __declspec(dllimport) HMODULE_ WINAPI + GetModuleHandleW( + LPCWSTR_ lpFileName + ); +# else + __declspec(dllimport) HMODULE_ WINAPI + LoadLibraryA( + LPCSTR_ lpFileName + ); + __declspec(dllimport) HMODULE_ WINAPI + GetModuleHandleA( + LPCSTR_ lpFileName + ); +# endif + __declspec(dllimport) BOOL_ WINAPI FreeLibrary( HMODULE_ hModule @@ -56,10 +77,6 @@ extern "C" { HMODULE_ hModule, LPCSTR_ lpProcName ); - __declspec(dllimport) HMODULE_ WINAPI - GetModuleHandleA( - LPCSTR_ lpFileName - ); } #endif } diff --git a/include/boost/detail/winapi/synchronization.hpp b/include/boost/detail/winapi/synchronization.hpp index 88911df..cee7a7b 100644 --- a/include/boost/detail/winapi/synchronization.hpp +++ b/include/boost/detail/winapi/synchronization.hpp @@ -147,6 +147,8 @@ const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF; #endif // defined( BOOST_USE_WINDOWS_H ) +const DWORD_ max_non_infinite_wait = (DWORD_)0xFFFFFFFE; + BOOST_FORCEINLINE HANDLE_ create_anonymous_mutex(_SECURITY_ATTRIBUTES* lpAttributes, BOOL_ bInitialOwner) { #ifdef BOOST_NO_ANSI_APIS From 2114a3d026891225145d6fe0ca6b7c71cfa1784a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 11 Oct 2013 23:11:35 +0000 Subject: [PATCH 12/34] Remove obsolete files. [SVN r86242] --- include/boost/detail/indirect_traits.hpp | 3 - .../boost/detail/is_function_ref_tester.hpp | 136 ------------------ 2 files changed, 139 deletions(-) mode change 100755 => 100644 include/boost/detail/indirect_traits.hpp delete mode 100644 include/boost/detail/is_function_ref_tester.hpp diff --git a/include/boost/detail/indirect_traits.hpp b/include/boost/detail/indirect_traits.hpp old mode 100755 new mode 100644 index f9c0cd6..b6496b4 --- a/include/boost/detail/indirect_traits.hpp +++ b/include/boost/detail/indirect_traits.hpp @@ -26,9 +26,6 @@ # include # include -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include -# endif namespace boost { namespace detail { diff --git a/include/boost/detail/is_function_ref_tester.hpp b/include/boost/detail/is_function_ref_tester.hpp deleted file mode 100644 index 8e7d1d7..0000000 --- a/include/boost/detail/is_function_ref_tester.hpp +++ /dev/null @@ -1,136 +0,0 @@ - -// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, -// Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000. -// 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) - -#if !defined(BOOST_PP_IS_ITERATING) - -///// header body - -#ifndef BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED -#define BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED - -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/config.hpp" - -#if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" -#endif - -namespace boost { -namespace detail { -namespace is_function_ref_tester_ { - -template -boost::type_traits::no_type BOOST_TT_DECL is_function_ref_tester(T& ...); - -#if !defined(BOOST_TT_PREPROCESSING_MODE) -// preprocessor-generated part, don't edit by hand! - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24), int); - -#else - -#define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, 25, "boost/detail/is_function_ref_tester.hpp")) -#include BOOST_PP_ITERATE() - -#endif // BOOST_TT_PREPROCESSING_MODE - -} // namespace detail -} // namespace python -} // namespace boost - -#endif // BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED - -///// iteration - -#else -#define i BOOST_PP_FRAME_ITERATION(1) - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(BOOST_PP_ENUM_PARAMS(i,T)), int); - -#undef i -#endif // BOOST_PP_IS_ITERATING - From 5e284011954f48e718ed4a8e124388db2bc0f667 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 11 Oct 2013 23:13:10 +0000 Subject: [PATCH 13/34] Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION Process #ifdef...#endif blocks. [SVN r86243] --- include/boost/detail/iterator.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/boost/detail/iterator.hpp b/include/boost/detail/iterator.hpp index 5bb9c62..896bb3d 100644 --- a/include/boost/detail/iterator.hpp +++ b/include/boost/detail/iterator.hpp @@ -135,10 +135,6 @@ struct iterator_traits # include # include -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include -# include -# endif # ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION # include # endif From 684ee20edb731516eccc3812b8cd9a6886582847 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 11 Oct 2013 23:15:00 +0000 Subject: [PATCH 14/34] Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION Process #ifndef...#endif conditions. [SVN r86244] --- include/boost/detail/reference_content.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/boost/detail/reference_content.hpp b/include/boost/detail/reference_content.hpp index daf56a8..b286231 100644 --- a/include/boost/detail/reference_content.hpp +++ b/include/boost/detail/reference_content.hpp @@ -124,7 +124,6 @@ struct make_reference_content< mpl::void_ > // reference_content type traits specializations // -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template struct has_nothrow_copy< @@ -134,7 +133,6 @@ struct has_nothrow_copy< { }; -#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) } // namespace boost From a747594bdd12bc140cf31ac44babf072e6c0bccc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 11 Oct 2013 23:17:48 +0000 Subject: [PATCH 15/34] Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION Process #ifndef...#else...#endif blocks. [SVN r86245] --- include/boost/detail/indirect_traits.hpp | 279 --------------------- include/boost/detail/iterator.hpp | 45 ---- include/boost/detail/reference_content.hpp | 19 -- 3 files changed, 343 deletions(-) diff --git a/include/boost/detail/indirect_traits.hpp b/include/boost/detail/indirect_traits.hpp index b6496b4..7c8f76b 100644 --- a/include/boost/detail/indirect_traits.hpp +++ b/include/boost/detail/indirect_traits.hpp @@ -31,7 +31,6 @@ namespace boost { namespace detail { namespace indirect_traits { -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template struct is_reference_to_const : mpl::false_ { @@ -196,284 +195,6 @@ struct is_pointer_to_class BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T)) }; -# else - -using namespace boost::detail::is_function_ref_tester_; - -typedef char (&inner_yes_type)[3]; -typedef char (&inner_no_type)[2]; -typedef char (&outer_no_type)[1]; - -template -struct is_const_help -{ - typedef typename mpl::if_< - is_const - , inner_yes_type - , inner_no_type - >::type type; -}; - -template -struct is_volatile_help -{ - typedef typename mpl::if_< - is_volatile - , inner_yes_type - , inner_no_type - >::type type; -}; - -template -struct is_pointer_help -{ - typedef typename mpl::if_< - is_pointer - , inner_yes_type - , inner_no_type - >::type type; -}; - -template -struct is_class_help -{ - typedef typename mpl::if_< - is_class - , inner_yes_type - , inner_no_type - >::type type; -}; - -template -struct is_reference_to_function_aux -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value = sizeof(detail::is_function_ref_tester(t,0)) == sizeof(::boost::type_traits::yes_type)); - typedef mpl::bool_ type; - }; - -template -struct is_reference_to_function - : mpl::if_, is_reference_to_function_aux, mpl::bool_ >::type -{ -}; - -template -struct is_pointer_to_function_aux -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type)); - typedef mpl::bool_ type; -}; - -template -struct is_pointer_to_function - : mpl::if_, is_pointer_to_function_aux, mpl::bool_ >::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_function,(T)) -}; - -struct false_helper1 -{ - template - struct apply : mpl::false_ - { - }; -}; - -template -typename is_const_help::type reference_to_const_helper(V&); -outer_no_type -reference_to_const_helper(...); - -struct true_helper1 -{ - template - struct apply - { - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(reference_to_const_helper(t)) == sizeof(inner_yes_type)); - typedef mpl::bool_ type; - }; -}; - -template -struct is_reference_to_const_helper1 : true_helper1 -{ -}; - -template <> -struct is_reference_to_const_helper1 : false_helper1 -{ -}; - - -template -struct is_reference_to_const - : is_reference_to_const_helper1::value>::template apply -{ -}; - - -template -struct is_reference_to_non_const_helper1 -{ - template - struct apply - { - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type)); - - typedef mpl::bool_ type; - }; -}; - -template <> -struct is_reference_to_non_const_helper1 : false_helper1 -{ -}; - - -template -struct is_reference_to_non_const - : is_reference_to_non_const_helper1::value>::template apply -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_non_const,(T)) -}; - - -template -typename is_volatile_help::type reference_to_volatile_helper(V&); -outer_no_type -reference_to_volatile_helper(...); - -template -struct is_reference_to_volatile_helper1 -{ - template - struct apply - { - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type)); - typedef mpl::bool_ type; - }; -}; - -template <> -struct is_reference_to_volatile_helper1 : false_helper1 -{ -}; - - -template -struct is_reference_to_volatile - : is_reference_to_volatile_helper1::value>::template apply -{ -}; - -template -typename is_pointer_help::type reference_to_pointer_helper(V&); -outer_no_type reference_to_pointer_helper(...); - -template -struct reference_to_pointer_impl -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type)) - ); - - typedef mpl::bool_ type; -}; - -template -struct is_reference_to_pointer - : mpl::eval_if, reference_to_pointer_impl, mpl::false_>::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T)) -}; - -template -struct is_reference_to_function_pointer - : mpl::eval_if, is_pointer_to_function_aux, mpl::false_>::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T)) -}; - - -template -struct is_member_function_pointer_help - : mpl::if_, inner_yes_type, inner_no_type> -{}; - -template -typename is_member_function_pointer_help::type member_function_pointer_helper(V&); -outer_no_type member_function_pointer_helper(...); - -template -struct is_pointer_to_member_function_aux -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof((member_function_pointer_helper)(t)) == sizeof(inner_yes_type)); - typedef mpl::bool_ type; -}; - -template -struct is_reference_to_member_function_pointer - : mpl::if_< - is_reference - , is_pointer_to_member_function_aux - , mpl::bool_ - >::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T)) -}; - -template -typename is_class_help::type reference_to_class_helper(V const volatile&); -outer_no_type reference_to_class_helper(...); - -template -struct is_reference_to_class -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = (is_reference::value - & (sizeof(reference_to_class_helper(t)) == sizeof(inner_yes_type))) - ); - typedef mpl::bool_ type; - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T)) -}; - -template -typename is_class_help::type pointer_to_class_helper(V const volatile*); -outer_no_type pointer_to_class_helper(...); - -template -struct is_pointer_to_class -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = (is_pointer::value - && sizeof(pointer_to_class_helper(t)) == sizeof(inner_yes_type)) - ); - typedef mpl::bool_ type; -}; -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } diff --git a/include/boost/detail/iterator.hpp b/include/boost/detail/iterator.hpp index 896bb3d..a43e8f9 100644 --- a/include/boost/detail/iterator.hpp +++ b/include/boost/detail/iterator.hpp @@ -258,7 +258,6 @@ struct stlport_40_debug_iterator_traits template struct pointer_iterator_traits; -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template struct pointer_iterator_traits { @@ -268,50 +267,6 @@ struct pointer_iterator_traits typedef std::random_access_iterator_tag iterator_category; typedef std::ptrdiff_t difference_type; }; -# else - -// In case of no template partial specialization, and if T is a -// pointer, iterator_traits::value_type can still be computed. For -// some basic types, remove_pointer is manually defined in -// type_traits/broken_compiler_spec.hpp. For others, do it yourself. - -template class please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee; - -template -struct pointer_value_type - : mpl::if_< - is_same::type> - , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee

- , typename remove_const< - typename remove_pointer

::type - >::type - > -{ -}; - - -template -struct pointer_reference - : mpl::if_< - is_same::type> - , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee

- , typename remove_pointer

::type& - > -{ -}; - -template -struct pointer_iterator_traits -{ - typedef T pointer; - typedef std::random_access_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - - typedef typename pointer_value_type::type value_type; - typedef typename pointer_reference::type reference; -}; - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // We'll sort iterator types into one of these classifications, from which we // can determine the difference_type, pointer, reference, and value_type diff --git a/include/boost/detail/reference_content.hpp b/include/boost/detail/reference_content.hpp index b286231..36b80d2 100644 --- a/include/boost/detail/reference_content.hpp +++ b/include/boost/detail/reference_content.hpp @@ -15,13 +15,8 @@ #include "boost/config.hpp" -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) # include "boost/mpl/bool.hpp" # include "boost/type_traits/has_nothrow_copy.hpp" -#else -# include "boost/mpl/if.hpp" -# include "boost/type_traits/is_reference.hpp" -#endif #include "boost/mpl/void.hpp" @@ -78,7 +73,6 @@ public: // queries template struct make_reference_content; -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template struct make_reference_content @@ -92,19 +86,6 @@ struct make_reference_content< T& > typedef reference_content type; }; -#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - -template -struct make_reference_content - : mpl::if_< - is_reference - , reference_content - , T - > -{ -}; - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround template <> struct make_reference_content< mpl::void_ > From 6395ed2f253a223ebcecc3d8c1a8636a34fc2902 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 11 Oct 2013 23:19:17 +0000 Subject: [PATCH 16/34] Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION Process #ifdef...#else...#endif blocks. [SVN r86246] --- include/boost/detail/is_xxx.hpp | 34 --------------------------------- 1 file changed, 34 deletions(-) mode change 100755 => 100644 include/boost/detail/is_xxx.hpp diff --git a/include/boost/detail/is_xxx.hpp b/include/boost/detail/is_xxx.hpp old mode 100755 new mode 100644 index cb64fb3..3f9a126 --- a/include/boost/detail/is_xxx.hpp +++ b/include/boost/detail/is_xxx.hpp @@ -8,39 +8,6 @@ # include # include -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -# include -# include - -# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ -template \ -struct is_##name \ -{ \ - typedef char yes; \ - typedef char (&no)[2]; \ - \ - static typename add_reference::type dummy; \ - \ - struct helpers \ - { \ - template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \ - static yes test( \ - qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \ - ); \ - \ - template \ - static no test(U&, ...); \ - }; \ - \ - BOOST_STATIC_CONSTANT( \ - bool, value \ - = !is_reference::value \ - & (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \ - \ - typedef mpl::bool_ type; \ -}; - -# else # define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ template \ @@ -56,6 +23,5 @@ struct is_##name< \ { \ }; -# endif #endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP From d32882cc084b1404c4c168c0d50cd86af53cd376 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 11 Oct 2013 23:20:59 +0000 Subject: [PATCH 17/34] Simplify multi-component ifdefs containing BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION [SVN r86248] --- include/boost/detail/iterator.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/boost/detail/iterator.hpp b/include/boost/detail/iterator.hpp index a43e8f9..9260c0b 100644 --- a/include/boost/detail/iterator.hpp +++ b/include/boost/detail/iterator.hpp @@ -71,7 +71,6 @@ # endif // STLPort <= 4.1b4 && no partial specialization # if !defined(BOOST_NO_STD_ITERATOR_TRAITS) \ - && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_MSVC_STD_ITERATOR) namespace boost { namespace detail { From 0e75aca4dda628190d47a98689f3ece912b13625 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 11 Oct 2013 23:22:36 +0000 Subject: [PATCH 18/34] Remove remaining occurances of BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION These evaded scripting. [SVN r86249] --- include/boost/detail/iterator.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/boost/detail/iterator.hpp b/include/boost/detail/iterator.hpp index 9260c0b..abaee26 100644 --- a/include/boost/detail/iterator.hpp +++ b/include/boost/detail/iterator.hpp @@ -86,8 +86,7 @@ using std::distance; # else -# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_MSVC_STD_ITERATOR) +# if !defined(BOOST_MSVC_STD_ITERATOR) // This is the case where everything conforms except BOOST_NO_STD_ITERATOR_TRAITS From 3dafb197cce67670b8579a942c96edc1887c4e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20M=20L=C3=B3pez=20Mu=C3=B1oz?= Date: Sat, 12 Oct 2013 15:30:35 +0000 Subject: [PATCH 19/34] * Reformatted and completed legacy code removal patches from Stephen Kelly (note: this patch treads on changesets [86244] and [82545], will restore later) * Changed hashed indices internal data structure * Changed hashed index iterator serialization * Added reserve to hashed indices * noexcept specification * Lazy node allocation in insertion * Doc typos [SVN r86264] --- include/boost/detail/allocator_utilities.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/detail/allocator_utilities.hpp b/include/boost/detail/allocator_utilities.hpp index a81f386..ed3de84 100644 --- a/include/boost/detail/allocator_utilities.hpp +++ b/include/boost/detail/allocator_utilities.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2009 Joaquin M Lopez Munoz. +/* Copyright 2003-2013 Joaquin M Lopez Munoz. * 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) From 3319b4ac54b2d8532ddcf49cac40c8bae17a4878 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 14 Oct 2013 21:06:05 +0000 Subject: [PATCH 20/34] Added support for WinAPI version specification. [SVN r86307] --- include/boost/detail/winapi/basic_types.hpp | 17 +- include/boost/detail/winapi/config.hpp | 52 ++++++ .../boost/detail/winapi/synchronization.hpp | 148 +++++++++++++++--- include/boost/detail/winapi/time.hpp | 11 ++ 4 files changed, 195 insertions(+), 33 deletions(-) create mode 100644 include/boost/detail/winapi/config.hpp diff --git a/include/boost/detail/winapi/basic_types.hpp b/include/boost/detail/winapi/basic_types.hpp index 6692fe0..09d907b 100644 --- a/include/boost/detail/winapi/basic_types.hpp +++ b/include/boost/detail/winapi/basic_types.hpp @@ -9,9 +9,9 @@ #ifndef BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP #define BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP -#include #include #include +#include #if defined( BOOST_USE_WINDOWS_H ) # include @@ -57,6 +57,7 @@ namespace winapi { typedef ::LONG LONG_; typedef ::ULONG ULONG_; typedef ::LONGLONG LONGLONG_; + typedef ::ULONGLONG ULONGLONG_; typedef ::INT_PTR INT_PTR_; typedef ::UINT_PTR UINT_PTR_; typedef ::LONG_PTR LONG_PTR_; @@ -85,17 +86,8 @@ extern "C" { typedef long LONG_; typedef unsigned long ULONG_; -// @FIXME Which condition must be tested -//~ #if !defined(_M_IX86) -//~ #if defined(BOOST_NO_INT64_T) - //~ typedef double LONGLONG_; -//~ #else - //~ typedef __int64 LONGLONG_; -//~ #endif -//~ #else - //~ typedef double LONGLONG_; -//~ #endif typedef boost::int64_t LONGLONG_; + typedef boost::uint64_t ULONGLONG_; // @FIXME Which condition must be tested # ifdef _WIN64 @@ -138,4 +130,5 @@ extern "C" { } } } -#endif // BOOST_DETAIL_WINAPI_TIME_HPP + +#endif // BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP diff --git a/include/boost/detail/winapi/config.hpp b/include/boost/detail/winapi/config.hpp new file mode 100644 index 0000000..a21e552 --- /dev/null +++ b/include/boost/detail/winapi/config.hpp @@ -0,0 +1,52 @@ +// config.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_CONFIG_HPP_INCLUDED_ +#define BOOST_DETAIL_WINAPI_CONFIG_HPP_INCLUDED_ + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +// These constants reflect _WIN32_WINNT_* macros from sdkddkver.h +// See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx#setting_winver_or__win32_winnt +#define BOOST_WINAPI_VERSION_NT4 0x0400 +#define BOOST_WINAPI_VERSION_WIN2K 0x0500 +#define BOOST_WINAPI_VERSION_WINXP 0x0501 +#define BOOST_WINAPI_VERSION_WS03 0x0502 +#define BOOST_WINAPI_VERSION_WIN6 0x0600 +#define BOOST_WINAPI_VERSION_VISTA 0x0600 +#define BOOST_WINAPI_VERSION_WS08 0x0600 +#define BOOST_WINAPI_VERSION_LONGHORN 0x0600 +#define BOOST_WINAPI_VERSION_WIN7 0x0601 +#define BOOST_WINAPI_VERSION_WIN8 0x0602 + +#if !defined(BOOST_USE_WINAPI_VERSION) +#if defined(_WIN32_WINNT) +#define BOOST_USE_WINAPI_VERSION _WIN32_WINNT +#elif defined(WINVER) +#define BOOST_USE_WINAPI_VERSION WINVER +#else +// By default use Windows XP API +#define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WINXP +#endif +#endif + +#if defined(BOOST_USE_WINDOWS_H) +// We have to define the version macros so that windows.h provides the necessary symbols +#if !defined(_WIN32_WINNT) +#define _WIN32_WINNT BOOST_USE_WINAPI_VERSION +#endif +#if !defined(WINVER) +#define WINVER BOOST_USE_WINAPI_VERSION +#endif +#endif + +#endif // BOOST_DETAIL_WINAPI_CONFIG_HPP_INCLUDED_ diff --git a/include/boost/detail/winapi/synchronization.hpp b/include/boost/detail/winapi/synchronization.hpp index cee7a7b..2cf6cb4 100644 --- a/include/boost/detail/winapi/synchronization.hpp +++ b/include/boost/detail/winapi/synchronization.hpp @@ -25,7 +25,26 @@ namespace winapi typedef ::CRITICAL_SECTION CRITICAL_SECTION_; typedef ::PAPCFUNC PAPCFUNC_; +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + typedef ::INIT_ONCE INIT_ONCE_; + typedef ::PINIT_ONCE PINIT_ONCE_; + typedef ::LPINIT_ONCE LPINIT_ONCE_; + #define BOOST_DETAIL_WINAPI_INIT_ONCE_STATIC_INIT INIT_ONCE_STATIC_INIT + typedef ::PINIT_ONCE_FN PINIT_ONCE_FN_; + + typedef ::SRWLOCK SRWLOCK_; + typedef ::PSRWLOCK PSRWLOCK_; + #define BOOST_DETAIL_WINAPI_SRWLOCK_INIT SRWLOCK_INIT + + typedef ::CONDITION_VARIABLE CONDITION_VARIABLE_; + typedef ::PCONDITION_VARIABLE PCONDITION_VARIABLE_; + #define BOOST_DETAIL_WINAPI_CONDITION_VARIABLE_INIT CONDITION_VARIABLE_INIT +#endif + using ::InitializeCriticalSection; +#if BOOST_USE_WINAPI_VERSION >= 0x0403 + using ::InitializeCriticalSectionAndSpinCount; +#endif using ::EnterCriticalSection; using ::TryEnterCriticalSection; using ::LeaveCriticalSection; @@ -50,17 +69,47 @@ namespace winapi using ::WaitForSingleObject; using ::QueueUserAPC; +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + using ::InitOnceInitialize; + using ::InitOnceExecuteOnce; + using ::InitOnceBeginInitialize; + using ::InitOnceComplete; + + using ::InitializeSRWLock; + using ::AcquireSRWLockExclusive; + using ::TryAcquireSRWLockExclusive; + using ::ReleaseSRWLockExclusive; + using ::AcquireSRWLockShared; + using ::TryAcquireSRWLockShared; + using ::ReleaseSRWLockShared; + + using ::InitializeConditionVariable; + using ::WakeConditionVariable; + using ::WakeAllConditionVariable; + using ::SleepConditionVariableCS; + using ::SleepConditionVariableSRW; +#endif + const DWORD_ infinite = INFINITE; const DWORD_ wait_abandoned = WAIT_ABANDONED; const DWORD_ wait_object_0 = WAIT_OBJECT_0; const DWORD_ wait_timeout = WAIT_TIMEOUT; const DWORD_ wait_failed = WAIT_FAILED; +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + const DWORD_ init_once_async = INIT_ONCE_ASYNC; + const DWORD_ init_once_check_only = INIT_ONCE_CHECK_ONLY; + const DWORD_ init_once_init_failed = INIT_ONCE_INIT_FAILED; + const DWORD_ init_once_ctx_reserved_bits = INIT_ONCE_CTX_RESERVED_BITS; + + const ULONG_ condition_variable_lockmode_shared = CONDITION_VARIABLE_LOCKMODE_SHARED; +#endif + #else // defined( BOOST_USE_WINDOWS_H ) extern "C" { - struct CRITICAL_SECTION_ + typedef struct CRITICAL_SECTION_ { struct critical_section_debug * DebugInfo; long LockCount; @@ -72,20 +121,50 @@ extern "C" { #else unsigned long SpinCount; #endif - }; + } + *PCRITICAL_SECTION_; - __declspec(dllimport) void WINAPI - InitializeCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void WINAPI - EnterCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) bool WINAPI - TryEnterCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void WINAPI - LeaveCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void WINAPI - DeleteCriticalSection(CRITICAL_SECTION_ *); +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + typedef union INIT_ONCE_ + { + PVOID_ Ptr; + } + *PINIT_ONCE_, *LPINIT_ONCE_; + #define BOOST_DETAIL_WINAPI_INIT_ONCE_STATIC_INIT {0} + typedef BOOL_ (WINAPI *PINIT_ONCE_FN_)(PINIT_ONCE_ InitOnce, PVOID_ Parameter, PVOID_ *Context); - struct _SECURITY_ATTRIBUTES; + typedef struct SRWLOCK_ + { + PVOID_ Ptr; + } + * PSRWLOCK_; + #define BOOST_DETAIL_WINAPI_SRWLOCK_INIT {0} + + typedef struct CONDITION_VARIABLE_ + { + PVOID_ Ptr; + } + * PCONDITION_VARIABLE_; + #define BOOST_DETAIL_WINAPI_CONDITION_VARIABLE_INIT {0} + +#endif + + __declspec(dllimport) void WINAPI + InitializeCriticalSection(PCRITICAL_SECTION_); +#if BOOST_USE_WINAPI_VERSION >= 0x0403 + __declspec(dllimport) BOOL_ WINAPI + InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION_* lpCS, DWORD_ dwSpinCount); +#endif + __declspec(dllimport) void WINAPI + EnterCriticalSection(PCRITICAL_SECTION_); + __declspec(dllimport) BOOL_ WINAPI + TryEnterCriticalSection(PCRITICAL_SECTION_); + __declspec(dllimport) void WINAPI + LeaveCriticalSection(PCRITICAL_SECTION_); + __declspec(dllimport) void WINAPI + DeleteCriticalSection(PCRITICAL_SECTION_); + + struct _SECURITY_ATTRIBUTES; # ifdef BOOST_NO_ANSI_APIS __declspec(dllimport) HANDLE_ WINAPI CreateMutexW(_SECURITY_ATTRIBUTES*, BOOL_, LPCWSTR_); @@ -124,18 +203,36 @@ extern "C" { DWORD_ dwMilliseconds); __declspec(dllimport) BOOL_ WINAPI ReleaseSemaphore(HANDLE_, LONG_, LONG_*); - typedef void (__stdcall *PAPCFUNC8)(ULONG_PTR_); - __declspec(dllimport) DWORD_ WINAPI - QueueUserAPC(PAPCFUNC8, HANDLE_, ULONG_PTR_); -# ifndef UNDER_CE __declspec(dllimport) BOOL_ WINAPI SetEvent(HANDLE_); __declspec(dllimport) BOOL_ WINAPI ResetEvent(HANDLE_); -# else - using ::SetEvent; - using ::ResetEvent; -# endif + + typedef void (__stdcall *PAPCFUNC_)(ULONG_PTR_); + __declspec(dllimport) DWORD_ WINAPI + QueueUserAPC(PAPCFUNC_, HANDLE_, ULONG_PTR_); + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + __declspec(dllimport) void WINAPI InitOnceInitialize(PINIT_ONCE_); + __declspec(dllimport) BOOL_ WINAPI InitOnceExecuteOnce(PINIT_ONCE_ InitOnce, PINIT_ONCE_FN_ InitFn, PVOID_ Parameter, LPVOID_* Context); + __declspec(dllimport) BOOL_ WINAPI InitOnceBeginInitialize(LPINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, BOOL_* fPending, LPVOID_* lpContext); + __declspec(dllimport) BOOL_ WINAPI InitOnceComplete(LPINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, LPVOID_* lpContext); + + + __declspec(dllimport) void WINAPI InitializeSRWLock(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI AcquireSRWLockExclusive(PSRWLOCK_ SRWLock); + __declspec(dllimport) BOOLEAN_ WINAPI TryAcquireSRWLockExclusive(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI ReleaseSRWLockExclusive(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI AcquireSRWLockShared(PSRWLOCK_ SRWLock); + __declspec(dllimport) BOOLEAN_ WINAPI TryAcquireSRWLockShared(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI ReleaseSRWLockShared(PSRWLOCK_ SRWLock); + + __declspec(dllimport) void WINAPI InitializeConditionVariable(PCONDITION_VARIABLE_ ConditionVariable); + __declspec(dllimport) void WINAPI WakeConditionVariable(PCONDITION_VARIABLE_ ConditionVariable); + __declspec(dllimport) void WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE_ ConditionVariable); + __declspec(dllimport) BOOL_ WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE_ ConditionVariable, PCRITICAL_SECTION_ CriticalSection, DWORD_ dwMilliseconds); + __declspec(dllimport) BOOL_ WINAPI SleepConditionVariableSRW(PCONDITION_VARIABLE_ ConditionVariable, PSRWLOCK_ SRWLock, DWORD_ dwMilliseconds, ULONG_ Flags); +#endif } // extern "C" @@ -145,6 +242,15 @@ const DWORD_ wait_object_0 = 0x00000000L; const DWORD_ wait_timeout = 0x00000102L; const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF; +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 +const DWORD_ init_once_async = 0x00000002UL; +const DWORD_ init_once_check_only = 0x00000001UL; +const DWORD_ init_once_init_failed = 0x00000004UL; +const DWORD_ init_once_ctx_reserved_bits = 2; + +const ULONG_ condition_variable_lockmode_shared = 0x00000001; +#endif + #endif // defined( BOOST_USE_WINDOWS_H ) const DWORD_ max_non_infinite_wait = (DWORD_)0xFFFFFFFE; diff --git a/include/boost/detail/winapi/time.hpp b/include/boost/detail/winapi/time.hpp index b3e4c44..b58df63 100644 --- a/include/boost/detail/winapi/time.hpp +++ b/include/boost/detail/winapi/time.hpp @@ -18,7 +18,9 @@ namespace boost { namespace detail { namespace winapi { + #if defined( BOOST_USE_WINDOWS_H ) + typedef FILETIME FILETIME_; typedef PFILETIME PFILETIME_; typedef LPFILETIME LPFILETIME_; @@ -33,8 +35,12 @@ namespace winapi { using ::GetSystemTime; using ::SystemTimeToFileTime; using ::GetTickCount; + #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + using ::GetTickCount64; + #endif #else + extern "C" { typedef struct _FILETIME { DWORD_ dwLowDateTime; @@ -66,7 +72,12 @@ extern "C" { FILETIME_* lpFileTime); __declspec(dllimport) DWORD_ WINAPI GetTickCount(); + #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + __declspec(dllimport) ULONGLONG_ WINAPI + GetTickCount64(); + #endif } + #endif #ifndef BOOST_HAS_GETSYSTEMTIMEASFILETIME From 8e3280c8ee4456bfa89e1341d6cd39a945593448 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 22 Oct 2013 13:28:27 +0000 Subject: [PATCH 21/34] Changed the default WinAPI version to Vista. [SVN r86389] --- include/boost/detail/winapi/config.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/detail/winapi/config.hpp b/include/boost/detail/winapi/config.hpp index a21e552..ae721a0 100644 --- a/include/boost/detail/winapi/config.hpp +++ b/include/boost/detail/winapi/config.hpp @@ -34,8 +34,8 @@ #elif defined(WINVER) #define BOOST_USE_WINAPI_VERSION WINVER #else -// By default use Windows XP API -#define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WINXP +// By default use Windows Vista API +#define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WIN6 #endif #endif From 59ce745040c192c8d5736b51061b96973a9465e7 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 23 Oct 2013 13:11:31 +0000 Subject: [PATCH 22/34] According to the discussion on the ML, changed the default WinAPI back to XP. [SVN r86403] --- include/boost/detail/winapi/config.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/detail/winapi/config.hpp b/include/boost/detail/winapi/config.hpp index ae721a0..a21e552 100644 --- a/include/boost/detail/winapi/config.hpp +++ b/include/boost/detail/winapi/config.hpp @@ -34,8 +34,8 @@ #elif defined(WINVER) #define BOOST_USE_WINAPI_VERSION WINVER #else -// By default use Windows Vista API -#define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WIN6 +// By default use Windows XP API +#define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WINXP #endif #endif From bae1bebd28c62cb09d59bf52a02ede6b5e4ceb0b Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 23 Oct 2013 21:09:40 +0000 Subject: [PATCH 23/34] Added Windows 8.1 (aka Blue) version constant. [SVN r86409] --- include/boost/detail/winapi/config.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/detail/winapi/config.hpp b/include/boost/detail/winapi/config.hpp index a21e552..2b0cdfb 100644 --- a/include/boost/detail/winapi/config.hpp +++ b/include/boost/detail/winapi/config.hpp @@ -27,6 +27,7 @@ #define BOOST_WINAPI_VERSION_LONGHORN 0x0600 #define BOOST_WINAPI_VERSION_WIN7 0x0601 #define BOOST_WINAPI_VERSION_WIN8 0x0602 +#define BOOST_WINAPI_VERSION_WINBLUE 0x0603 #if !defined(BOOST_USE_WINAPI_VERSION) #if defined(_WIN32_WINNT) From 84da532b397e41667e53e4785e9fd401f6a184a0 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 26 Oct 2013 15:18:21 +0000 Subject: [PATCH 24/34] Added missing using declarations. [SVN r86454] --- include/boost/detail/winapi/synchronization.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/detail/winapi/synchronization.hpp b/include/boost/detail/winapi/synchronization.hpp index 2cf6cb4..46af3aa 100644 --- a/include/boost/detail/winapi/synchronization.hpp +++ b/include/boost/detail/winapi/synchronization.hpp @@ -55,11 +55,13 @@ namespace winapi using ::CreateEventW; using ::OpenEventW; using ::CreateSemaphoreW; + using ::OpenSemaphoreW; # else using ::CreateMutexA; using ::CreateEventA; using ::OpenEventA; using ::CreateSemaphoreA; + using ::OpenSemaphoreA; # endif using ::ReleaseMutex; using ::ReleaseSemaphore; From 1e84644646f25f937b9e4ffb66fc9b6465783b8b Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 26 Oct 2013 15:21:25 +0000 Subject: [PATCH 25/34] Added missing using declarations. [SVN r86455] --- include/boost/detail/winapi/synchronization.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/detail/winapi/synchronization.hpp b/include/boost/detail/winapi/synchronization.hpp index 46af3aa..b9497cb 100644 --- a/include/boost/detail/winapi/synchronization.hpp +++ b/include/boost/detail/winapi/synchronization.hpp @@ -52,12 +52,14 @@ namespace winapi # ifdef BOOST_NO_ANSI_APIS using ::CreateMutexW; + using ::OpenMutexW; using ::CreateEventW; using ::OpenEventW; using ::CreateSemaphoreW; using ::OpenSemaphoreW; # else using ::CreateMutexA; + using ::OpenMutexA; using ::CreateEventA; using ::OpenEventA; using ::CreateSemaphoreA; From 322017753648ae6211113324fac542184e40302b Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 27 Oct 2013 11:56:12 +0000 Subject: [PATCH 26/34] Removed RegisterWaitForSingleObjectEx as it is not present in all Windows SDK versions. [SVN r86474] --- include/boost/detail/winapi/thread_pool.hpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/include/boost/detail/winapi/thread_pool.hpp b/include/boost/detail/winapi/thread_pool.hpp index aa56e94..57059dc 100644 --- a/include/boost/detail/winapi/thread_pool.hpp +++ b/include/boost/detail/winapi/thread_pool.hpp @@ -15,6 +15,8 @@ #pragma once #endif +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K + namespace boost { namespace detail @@ -27,7 +29,6 @@ typedef ::WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACKFUNC_; typedef ::WAITORTIMERCALLBACK WAITORTIMERCALLBACK_; using ::RegisterWaitForSingleObject; -using ::RegisterWaitForSingleObjectEx; using ::UnregisterWait; using ::UnregisterWaitEx; @@ -64,15 +65,6 @@ __declspec(dllimport) BOOL_ WINAPI RegisterWaitForSingleObject ULONG_ dwFlags ); -__declspec(dllimport) HANDLE_ WINAPI RegisterWaitForSingleObjectEx -( - HANDLE_ hObject, - WAITORTIMERCALLBACK_ Callback, - PVOID_ Context, - ULONG_ dwMilliseconds, - ULONG_ dwFlags -); - __declspec(dllimport) BOOL_ WINAPI UnregisterWait(HANDLE_ WaitHandle); __declspec(dllimport) BOOL_ WINAPI UnregisterWaitEx(HANDLE_ WaitHandle, HANDLE_ CompletionEvent); @@ -99,4 +91,6 @@ inline ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit) } } +#endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K + #endif // BOOST_DETAIL_WINAPI_THREAD_POOL_HPP From 4a5de13017889d4318876c996a770d6a962960b9 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 1 Nov 2013 15:27:08 +0000 Subject: [PATCH 27/34] Fixed INT_PTR_ spelling. [SVN r86536] --- include/boost/detail/winapi/dll.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/detail/winapi/dll.hpp b/include/boost/detail/winapi/dll.hpp index fcefddf..2ec5a73 100644 --- a/include/boost/detail/winapi/dll.hpp +++ b/include/boost/detail/winapi/dll.hpp @@ -39,9 +39,9 @@ namespace winapi #else extern "C" { # ifdef _WIN64 - typedef INT_PTR (WINAPI *FARPROC_)(); - typedef INT_PTR (WINAPI *NEARPROC_)(); - typedef INT_PTR (WINAPI *PROC_)(); + typedef INT_PTR_ (WINAPI *FARPROC_)(); + typedef INT_PTR_ (WINAPI *NEARPROC_)(); + typedef INT_PTR_ (WINAPI *PROC_)(); # else typedef int (WINAPI *FARPROC_)(); typedef int (WINAPI *NEARPROC_)(); From f362e5e72fc92969bbed161fe24276d2e45b2035 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Mon, 11 Nov 2013 02:18:51 +0000 Subject: [PATCH 28/34] changed codecvt_utf8 so that serialization uses the standard one if available. If there is no standard one available, it uses the one in boost/utility. [SVN r86612] --- include/boost/detail/utf8_codecvt_facet.ipp | 285 -------------------- 1 file changed, 285 deletions(-) delete mode 100644 include/boost/detail/utf8_codecvt_facet.ipp diff --git a/include/boost/detail/utf8_codecvt_facet.ipp b/include/boost/detail/utf8_codecvt_facet.ipp deleted file mode 100644 index 064fdaf..0000000 --- a/include/boost/detail/utf8_codecvt_facet.ipp +++ /dev/null @@ -1,285 +0,0 @@ -/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// utf8_codecvt_facet.ipp - -// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) -// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). -// Use, modification and distribution is 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) - -// Please see the comments in to -// learn how this file should be used. - -#include - -#include // for multi-byte converson routines -#include - -#include -#include - -// If we don't have wstring, then Unicode support -// is not available anyway, so we don't need to even -// compiler this file. This also fixes the problem -// with mingw, which can compile this file, but will -// generate link error when building DLL. -#ifndef BOOST_NO_STD_WSTRING - -BOOST_UTF8_BEGIN_NAMESPACE - -/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// implementation for wchar_t - -// Translate incoming UTF-8 into UCS-4 -std::codecvt_base::result utf8_codecvt_facet::do_in( - std::mbstate_t& /*state*/, - const char * from, - const char * from_end, - const char * & from_next, - wchar_t * to, - wchar_t * to_end, - wchar_t * & to_next -) const { - // Basic algorithm: The first octet determines how many - // octets total make up the UCS-4 character. The remaining - // "continuing octets" all begin with "10". To convert, subtract - // the amount that specifies the number of octets from the first - // octet. Subtract 0x80 (1000 0000) from each continuing octet, - // then mash the whole lot together. Note that each continuing - // octet only uses 6 bits as unique values, so only shift by - // multiples of 6 to combine. - while (from != from_end && to != to_end) { - - // Error checking on the first octet - if (invalid_leading_octet(*from)){ - from_next = from; - to_next = to; - return std::codecvt_base::error; - } - - // The first octet is adjusted by a value dependent upon - // the number of "continuing octets" encoding the character - const int cont_octet_count = get_cont_octet_count(*from); - const wchar_t octet1_modifier_table[] = { - 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc - }; - - // The unsigned char conversion is necessary in case char is - // signed (I learned this the hard way) - wchar_t ucs_result = - (unsigned char)(*from++) - octet1_modifier_table[cont_octet_count]; - - // Invariants : - // 1) At the start of the loop, 'i' continuing characters have been - // processed - // 2) *from points to the next continuing character to be processed. - int i = 0; - while(i != cont_octet_count && from != from_end) { - - // Error checking on continuing characters - if (invalid_continuing_octet(*from)) { - from_next = from; - to_next = to; - return std::codecvt_base::error; - } - - ucs_result *= (1 << 6); - - // each continuing character has an extra (10xxxxxx)b attached to - // it that must be removed. - ucs_result += (unsigned char)(*from++) - 0x80; - ++i; - } - - // If the buffer ends with an incomplete unicode character... - if (from == from_end && i != cont_octet_count) { - // rewind "from" to before the current character translation - from_next = from - (i+1); - to_next = to; - return std::codecvt_base::partial; - } - *to++ = ucs_result; - } - from_next = from; - to_next = to; - - // Were we done converting or did we run out of destination space? - if(from == from_end) return std::codecvt_base::ok; - else return std::codecvt_base::partial; -} - -std::codecvt_base::result utf8_codecvt_facet::do_out( - std::mbstate_t& /*state*/, - const wchar_t * from, - const wchar_t * from_end, - const wchar_t * & from_next, - char * to, - char * to_end, - char * & to_next -) const -{ - // RG - consider merging this table with the other one - const wchar_t octet1_modifier_table[] = { - 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc - }; - - wchar_t max_wchar = (std::numeric_limits::max)(); - while (from != from_end && to != to_end) { - - // Check for invalid UCS-4 character - if (*from > max_wchar) { - from_next = from; - to_next = to; - return std::codecvt_base::error; - } - - int cont_octet_count = get_cont_octet_out_count(*from); - - // RG - comment this formula better - int shift_exponent = (cont_octet_count) * 6; - - // Process the first character - *to++ = static_cast(octet1_modifier_table[cont_octet_count] + - (unsigned char)(*from / (1 << shift_exponent))); - - // Process the continuation characters - // Invariants: At the start of the loop: - // 1) 'i' continuing octets have been generated - // 2) '*to' points to the next location to place an octet - // 3) shift_exponent is 6 more than needed for the next octet - int i = 0; - while (i != cont_octet_count && to != to_end) { - shift_exponent -= 6; - *to++ = static_cast(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6))); - ++i; - } - // If we filled up the out buffer before encoding the character - if(to == to_end && i != cont_octet_count) { - from_next = from; - to_next = to - (i+1); - return std::codecvt_base::partial; - } - ++from; - } - from_next = from; - to_next = to; - // Were we done or did we run out of destination space - if(from == from_end) return std::codecvt_base::ok; - else return std::codecvt_base::partial; -} - -// How many char objects can I process to get <= max_limit -// wchar_t objects? -int utf8_codecvt_facet::do_length( - BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &, - const char * from, - const char * from_end, - std::size_t max_limit -#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) -) const throw() -#else -) const -#endif -{ - // RG - this code is confusing! I need a better way to express it. - // and test cases. - - // Invariants: - // 1) last_octet_count has the size of the last measured character - // 2) char_count holds the number of characters shown to fit - // within the bounds so far (no greater than max_limit) - // 3) from_next points to the octet 'last_octet_count' before the - // last measured character. - int last_octet_count=0; - std::size_t char_count = 0; - const char* from_next = from; - // Use "<" because the buffer may represent incomplete characters - while (from_next+last_octet_count <= from_end && char_count <= max_limit) { - from_next += last_octet_count; - last_octet_count = (get_octet_count(*from_next)); - ++char_count; - } - return static_cast(from_next-from_end); -} - -unsigned int utf8_codecvt_facet::get_octet_count( - unsigned char lead_octet -){ - // if the 0-bit (MSB) is 0, then 1 character - if (lead_octet <= 0x7f) return 1; - - // Otherwise the count number of consecutive 1 bits starting at MSB -// assert(0xc0 <= lead_octet && lead_octet <= 0xfd); - - if (0xc0 <= lead_octet && lead_octet <= 0xdf) return 2; - else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3; - else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4; - else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5; - else return 6; -} -BOOST_UTF8_END_NAMESPACE - -namespace { -template -int get_cont_octet_out_count_impl(wchar_t word){ - if (word < 0x80) { - return 0; - } - if (word < 0x800) { - return 1; - } - return 2; -} - -template<> -int get_cont_octet_out_count_impl<4>(wchar_t word){ - if (word < 0x80) { - return 0; - } - if (word < 0x800) { - return 1; - } - - // Note that the following code will generate warnings on some platforms - // where wchar_t is defined as UCS2. The warnings are superfluous as the - // specialization is never instantitiated with such compilers, but this - // can cause problems if warnings are being treated as errors, so we guard - // against that. Including as we do - // should be enough to get WCHAR_MAX defined. -#if !defined(WCHAR_MAX) -# error WCHAR_MAX not defined! -#endif - // cope with VC++ 7.1 or earlier having invalid WCHAR_MAX -#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier - return 2; -#elif WCHAR_MAX > 0x10000 - - if (word < 0x10000) { - return 2; - } - if (word < 0x200000) { - return 3; - } - if (word < 0x4000000) { - return 4; - } - return 5; - -#else - return 2; -#endif -} - -} // namespace anonymous - -BOOST_UTF8_BEGIN_NAMESPACE -// How many "continuing octets" will be needed for this word -// == total octets - 1. -int utf8_codecvt_facet::get_cont_octet_out_count( - wchar_t word -) const { - return get_cont_octet_out_count_impl(word); -} -BOOST_UTF8_END_NAMESPACE - -#endif From 8c689a15336d4d014ccc542432449bd497caafd4 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Mon, 11 Nov 2013 02:19:46 +0000 Subject: [PATCH 29/34] changed codecvt_utf8 so that serialization uses the standard one if available. If there is no standard one available, it uses the one in boost/utility. [SVN r86613] --- include/boost/detail/utf8_codecvt_facet.ipp | 284 ++++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 include/boost/detail/utf8_codecvt_facet.ipp diff --git a/include/boost/detail/utf8_codecvt_facet.ipp b/include/boost/detail/utf8_codecvt_facet.ipp new file mode 100644 index 0000000..8a13124 --- /dev/null +++ b/include/boost/detail/utf8_codecvt_facet.ipp @@ -0,0 +1,284 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// utf8_codecvt_facet.ipp + +// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) +// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). +// Use, modification and distribution is 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) + +// Please see the comments in to +// learn how this file should be used. + +#include + +#include // for multi-byte converson routines +#include + +#include +#include + +// If we don't have wstring, then Unicode support +// is not available anyway, so we don't need to even +// compiler this file. This also fixes the problem +// with mingw, which can compile this file, but will +// generate link error when building DLL. +#ifndef BOOST_NO_STD_WSTRING + +BOOST_UTF8_BEGIN_NAMESPACE + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation for wchar_t + +// Translate incoming UTF-8 into UCS-4 +std::codecvt_base::result utf8_codecvt_facet::do_in( + std::mbstate_t& /*state*/, + const char * from, + const char * from_end, + const char * & from_next, + wchar_t * to, + wchar_t * to_end, + wchar_t * & to_next +) const { + // Basic algorithm: The first octet determines how many + // octets total make up the UCS-4 character. The remaining + // "continuing octets" all begin with "10". To convert, subtract + // the amount that specifies the number of octets from the first + // octet. Subtract 0x80 (1000 0000) from each continuing octet, + // then mash the whole lot together. Note that each continuing + // octet only uses 6 bits as unique values, so only shift by + // multiples of 6 to combine. + while (from != from_end && to != to_end) { + + // Error checking on the first octet + if (invalid_leading_octet(*from)){ + from_next = from; + to_next = to; + return std::codecvt_base::error; + } + + // The first octet is adjusted by a value dependent upon + // the number of "continuing octets" encoding the character + const int cont_octet_count = get_cont_octet_count(*from); + const wchar_t octet1_modifier_table[] = { + 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc + }; + + // The unsigned char conversion is necessary in case char is + // signed (I learned this the hard way) + wchar_t ucs_result = + (unsigned char)(*from++) - octet1_modifier_table[cont_octet_count]; + + // Invariants : + // 1) At the start of the loop, 'i' continuing characters have been + // processed + // 2) *from points to the next continuing character to be processed. + int i = 0; + while(i != cont_octet_count && from != from_end) { + + // Error checking on continuing characters + if (invalid_continuing_octet(*from)) { + from_next = from; + to_next = to; + return std::codecvt_base::error; + } + + ucs_result *= (1 << 6); + + // each continuing character has an extra (10xxxxxx)b attached to + // it that must be removed. + ucs_result += (unsigned char)(*from++) - 0x80; + ++i; + } + + // If the buffer ends with an incomplete unicode character... + if (from == from_end && i != cont_octet_count) { + // rewind "from" to before the current character translation + from_next = from - (i+1); + to_next = to; + return std::codecvt_base::partial; + } + *to++ = ucs_result; + } + from_next = from; + to_next = to; + + // Were we done converting or did we run out of destination space? + if(from == from_end) return std::codecvt_base::ok; + else return std::codecvt_base::partial; +} + +std::codecvt_base::result utf8_codecvt_facet::do_out( + std::mbstate_t& /*state*/, + const wchar_t * from, + const wchar_t * from_end, + const wchar_t * & from_next, + char * to, + char * to_end, + char * & to_next +) const +{ + // RG - consider merging this table with the other one + const wchar_t octet1_modifier_table[] = { + 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc + }; + + wchar_t max_wchar = (std::numeric_limits::max)(); + while (from != from_end && to != to_end) { + + // Check for invalid UCS-4 character + if (*from > max_wchar) { + from_next = from; + to_next = to; + return std::codecvt_base::error; + } + + int cont_octet_count = get_cont_octet_out_count(*from); + + // RG - comment this formula better + int shift_exponent = (cont_octet_count) * 6; + + // Process the first character + *to++ = static_cast(octet1_modifier_table[cont_octet_count] + + (unsigned char)(*from / (1 << shift_exponent))); + + // Process the continuation characters + // Invariants: At the start of the loop: + // 1) 'i' continuing octets have been generated + // 2) '*to' points to the next location to place an octet + // 3) shift_exponent is 6 more than needed for the next octet + int i = 0; + while (i != cont_octet_count && to != to_end) { + shift_exponent -= 6; + *to++ = static_cast(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6))); + ++i; + } + // If we filled up the out buffer before encoding the character + if(to == to_end && i != cont_octet_count) { + from_next = from; + to_next = to - (i+1); + return std::codecvt_base::partial; + } + ++from; + } + from_next = from; + to_next = to; + // Were we done or did we run out of destination space + if(from == from_end) return std::codecvt_base::ok; + else return std::codecvt_base::partial; +} + +// How many char objects can I process to get <= max_limit +// wchar_t objects? +int utf8_codecvt_facet::do_length( + const std::mbstate_t &, + const char * from, + const char * from_end, + std::size_t max_limit +) const +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) + throw() +#endif +{ + // RG - this code is confusing! I need a better way to express it. + // and test cases. + + // Invariants: + // 1) last_octet_count has the size of the last measured character + // 2) char_count holds the number of characters shown to fit + // within the bounds so far (no greater than max_limit) + // 3) from_next points to the octet 'last_octet_count' before the + // last measured character. + int last_octet_count=0; + std::size_t char_count = 0; + const char* from_next = from; + // Use "<" because the buffer may represent incomplete characters + while (from_next+last_octet_count <= from_end && char_count <= max_limit) { + from_next += last_octet_count; + last_octet_count = (get_octet_count(*from_next)); + ++char_count; + } + return static_cast(from_next-from_end); +} + +unsigned int utf8_codecvt_facet::get_octet_count( + unsigned char lead_octet +){ + // if the 0-bit (MSB) is 0, then 1 character + if (lead_octet <= 0x7f) return 1; + + // Otherwise the count number of consecutive 1 bits starting at MSB +// assert(0xc0 <= lead_octet && lead_octet <= 0xfd); + + if (0xc0 <= lead_octet && lead_octet <= 0xdf) return 2; + else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3; + else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4; + else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5; + else return 6; +} +BOOST_UTF8_END_NAMESPACE + +namespace { +template +int get_cont_octet_out_count_impl(wchar_t word){ + if (word < 0x80) { + return 0; + } + if (word < 0x800) { + return 1; + } + return 2; +} + +template<> +int get_cont_octet_out_count_impl<4>(wchar_t word){ + if (word < 0x80) { + return 0; + } + if (word < 0x800) { + return 1; + } + + // Note that the following code will generate warnings on some platforms + // where wchar_t is defined as UCS2. The warnings are superfluous as the + // specialization is never instantitiated with such compilers, but this + // can cause problems if warnings are being treated as errors, so we guard + // against that. Including as we do + // should be enough to get WCHAR_MAX defined. +#if !defined(WCHAR_MAX) +# error WCHAR_MAX not defined! +#endif + // cope with VC++ 7.1 or earlier having invalid WCHAR_MAX +#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier + return 2; +#elif WCHAR_MAX > 0x10000 + + if (word < 0x10000) { + return 2; + } + if (word < 0x200000) { + return 3; + } + if (word < 0x4000000) { + return 4; + } + return 5; + +#else + return 2; +#endif +} + +} // namespace anonymous + +BOOST_UTF8_BEGIN_NAMESPACE +// How many "continuing octets" will be needed for this word +// == total octets - 1. +int utf8_codecvt_facet::get_cont_octet_out_count( + wchar_t word +) const { + return get_cont_octet_out_count_impl(word); +} +BOOST_UTF8_END_NAMESPACE + +#endif From 55f85a4d1f8e649441225620bc1043bdddc6f20a Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Mon, 11 Nov 2013 02:25:58 +0000 Subject: [PATCH 30/34] changed codecvt_utf8 so that serialization uses the standard one if available. If there is no standard one available, it uses the one in boost/utility. [SVN r86614] --- include/boost/detail/utf8_codecvt_facet.hpp | 39 +++++++++++++-------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/include/boost/detail/utf8_codecvt_facet.hpp b/include/boost/detail/utf8_codecvt_facet.hpp index eb65418..8344384 100644 --- a/include/boost/detail/utf8_codecvt_facet.hpp +++ b/include/boost/detail/utf8_codecvt_facet.hpp @@ -85,6 +85,10 @@ #include #include +#ifndef BOOST_NO_CXX11_HDR_CODECVT +#include +#endif + #if defined(BOOST_NO_STDC_NAMESPACE) namespace std { using ::mbstate_t; @@ -92,13 +96,6 @@ namespace std { } #endif -#if defined(_CPPLIB_VER) && (_CPPLIB_VER < 540) - #define BOOST_CODECVT_DO_LENGTH_CONST const -#else - #define BOOST_CODECVT_DO_LENGTH_CONST -#endif - -// maximum lenght of a multibyte string #define MB_LENGTH_MAX 8 BOOST_UTF8_BEGIN_NAMESPACE @@ -167,17 +164,30 @@ protected: } // How many char objects can I process to get <= max_limit - // wchar_t objects? + // wchar_t objects? + // This is the "official version which implements the standar + // library interface virtual int do_length( - BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &, + std::mbstate_t & state, const char * from, const char * from_end, std::size_t max_limit -#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) - ) const throw(); -#else - ) const; -#endif + ) const + #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) + throw() + #endif + { + return do_length(const_cast(state), from, from_end, max_limit); + } + + // this version handles versions of the standard library which pass + // the state with a "const". This means early dinkumware standard library + virtual int do_length( + const std::mbstate_t & state, + const char * from, + const char * from_end, + std::size_t max_limit + ) const; // Largest possible value do_length(state,from,from_end,1) could return. virtual int do_max_length() const throw () { @@ -185,6 +195,7 @@ protected: } }; + BOOST_UTF8_END_NAMESPACE #endif // BOOST_UTF8_CODECVT_FACET_HPP From 3dd2674052dc80ff9ac700c00725e1eac29fbad1 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 12 Feb 2014 17:05:13 +0200 Subject: [PATCH 31/34] Moved lightweight_thread.hpp, quick_allocator.hpp into smart_ptr --- include/boost/detail/lightweight_thread.hpp | 135 -------------------- include/boost/detail/quick_allocator.hpp | 23 ---- 2 files changed, 158 deletions(-) delete mode 100644 include/boost/detail/lightweight_thread.hpp delete mode 100644 include/boost/detail/quick_allocator.hpp diff --git a/include/boost/detail/lightweight_thread.hpp b/include/boost/detail/lightweight_thread.hpp deleted file mode 100644 index 8eba1f8..0000000 --- a/include/boost/detail/lightweight_thread.hpp +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED -#define BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) -# pragma once -#endif - -// boost/detail/lightweight_thread.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2008 Peter Dimov -// -// 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 - -#include -#include -#include - -// pthread_create, pthread_join - -#if defined( BOOST_HAS_PTHREADS ) - -#include - -#else - -#include -#include - -typedef HANDLE pthread_t; - -int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg ) -{ - HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 ); - - if( h != 0 ) - { - *thread = h; - return 0; - } - else - { - return EAGAIN; - } -} - -int pthread_join( pthread_t thread, void ** /*value_ptr*/ ) -{ - ::WaitForSingleObject( thread, INFINITE ); - ::CloseHandle( thread ); - return 0; -} - -#endif - -// template int lw_thread_create( pthread_t & pt, F f ); - -namespace boost -{ - -namespace detail -{ - -class lw_abstract_thread -{ -public: - - virtual ~lw_abstract_thread() {} - virtual void run() = 0; -}; - -#if defined( BOOST_HAS_PTHREADS ) - -extern "C" void * lw_thread_routine( void * pv ) -{ - std::auto_ptr pt( static_cast( pv ) ); - - pt->run(); - - return 0; -} - -#else - -unsigned __stdcall lw_thread_routine( void * pv ) -{ - std::auto_ptr pt( static_cast( pv ) ); - - pt->run(); - - return 0; -} - -#endif - -template class lw_thread_impl: public lw_abstract_thread -{ -public: - - explicit lw_thread_impl( F f ): f_( f ) - { - } - - void run() - { - f_(); - } - -private: - - F f_; -}; - -template int lw_thread_create( pthread_t & pt, F f ) -{ - std::auto_ptr p( new lw_thread_impl( f ) ); - - int r = pthread_create( &pt, 0, lw_thread_routine, p.get() ); - - if( r == 0 ) - { - p.release(); - } - - return r; -} - -} // namespace detail -} // namespace boost - -#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED diff --git a/include/boost/detail/quick_allocator.hpp b/include/boost/detail/quick_allocator.hpp deleted file mode 100644 index ba048e0..0000000 --- a/include/boost/detail/quick_allocator.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED -#define BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) -# pragma once -#endif - -// -// detail/quick_allocator.hpp -// -// Copyright (c) 2003 David Abrahams -// Copyright (c) 2003 Peter Dimov -// -// 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 -// - -#include - -#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED From 094070e5e45186384a3062ee91af4d40700ee3cd Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Thu, 27 Feb 2014 08:02:01 -0800 Subject: [PATCH 32/34] verified alignment of our custom utf8_codecvt_facet against the base class from which it is derived - std::codecvt. --- include/boost/detail/utf8_codecvt_facet.hpp | 62 ++++++++++----------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/include/boost/detail/utf8_codecvt_facet.hpp b/include/boost/detail/utf8_codecvt_facet.hpp index 8344384..b71ffdc 100644 --- a/include/boost/detail/utf8_codecvt_facet.hpp +++ b/include/boost/detail/utf8_codecvt_facet.hpp @@ -7,7 +7,7 @@ #define BOOST_UTF8_CODECVT_FACET_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) +#if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif @@ -85,10 +85,6 @@ #include #include -#ifndef BOOST_NO_CXX11_HDR_CODECVT -#include -#endif - #if defined(BOOST_NO_STDC_NAMESPACE) namespace std { using ::mbstate_t; @@ -96,6 +92,19 @@ namespace std { } #endif +#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) + #define BOOST_CODECVT_DO_LENGTH_CONST const +#else + #define BOOST_CODECVT_DO_LENGTH_CONST +#endif + +#if ! defined(BOOST_NO_CXX11_NOEXCEPT) + #define BOOST_CODECVT_NOEXCEPT noexcept +#else + #define BOOST_CODECVT_NOEXCEPT throw() +#endif + +// maximum lenght of a multibyte string #define MB_LENGTH_MAX 8 BOOST_UTF8_BEGIN_NAMESPACE @@ -119,9 +128,13 @@ protected: ) const; virtual std::codecvt_base::result do_out( - std::mbstate_t & state, const wchar_t * from, - const wchar_t * from_end, const wchar_t* & from_next, - char * to, char * to_end, char * & to_next + std::mbstate_t & state, + const wchar_t * from, + const wchar_t * from_end, + const wchar_t* & from_next, + char * to, + char * to_end, + char * & to_next ) const; bool invalid_continuing_octet(unsigned char octet_1) const { @@ -144,7 +157,9 @@ protected: // == total octets - 1. int get_cont_octet_out_count(wchar_t word) const ; - virtual bool do_always_noconv() const throw() { return false; } + virtual bool do_always_noconv() const BOOST_CODECVT_NOEXCEPT { + return false; + } // UTF-8 isn't really stateful since we rewind on partial conversions virtual std::codecvt_base::result do_unshift( @@ -152,50 +167,31 @@ protected: char * from, char * /*to*/, char * & next - ) const - { + ) const { next = from; return ok; } - virtual int do_encoding() const throw() { + virtual int do_encoding() const BOOST_CODECVT_NOEXCEPT { const int variable_byte_external_encoding=0; return variable_byte_external_encoding; } // How many char objects can I process to get <= max_limit - // wchar_t objects? - // This is the "official version which implements the standar - // library interface + // wchar_t objects? virtual int do_length( - std::mbstate_t & state, - const char * from, - const char * from_end, - std::size_t max_limit - ) const - #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) - throw() - #endif - { - return do_length(const_cast(state), from, from_end, max_limit); - } - - // this version handles versions of the standard library which pass - // the state with a "const". This means early dinkumware standard library - virtual int do_length( - const std::mbstate_t & state, + BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &, const char * from, const char * from_end, std::size_t max_limit ) const; // Largest possible value do_length(state,from,from_end,1) could return. - virtual int do_max_length() const throw () { + virtual int do_max_length() const BOOST_CODECVT_NOEXCEPT { return 6; // largest UTF-8 encoding of a UCS-4 character } }; - BOOST_UTF8_END_NAMESPACE #endif // BOOST_UTF8_CODECVT_FACET_HPP From 345b3a3b50c8f95bc898db84b81c1e47dd09c409 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Fri, 28 Feb 2014 10:48:19 -0800 Subject: [PATCH 33/34] Modify to use BOOST_NOEXCEPT --- include/boost/detail/utf8_codecvt_facet.hpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/include/boost/detail/utf8_codecvt_facet.hpp b/include/boost/detail/utf8_codecvt_facet.hpp index b71ffdc..e5e5a3e 100644 --- a/include/boost/detail/utf8_codecvt_facet.hpp +++ b/include/boost/detail/utf8_codecvt_facet.hpp @@ -98,12 +98,6 @@ namespace std { #define BOOST_CODECVT_DO_LENGTH_CONST #endif -#if ! defined(BOOST_NO_CXX11_NOEXCEPT) - #define BOOST_CODECVT_NOEXCEPT noexcept -#else - #define BOOST_CODECVT_NOEXCEPT throw() -#endif - // maximum lenght of a multibyte string #define MB_LENGTH_MAX 8 @@ -157,7 +151,7 @@ protected: // == total octets - 1. int get_cont_octet_out_count(wchar_t word) const ; - virtual bool do_always_noconv() const BOOST_CODECVT_NOEXCEPT { + virtual bool do_always_noconv() const BOOST_NOEXCEPT { return false; } @@ -172,7 +166,7 @@ protected: return ok; } - virtual int do_encoding() const BOOST_CODECVT_NOEXCEPT { + virtual int do_encoding() const BOOST_NOEXCEPT { const int variable_byte_external_encoding=0; return variable_byte_external_encoding; } @@ -187,7 +181,7 @@ protected: ) const; // Largest possible value do_length(state,from,from_end,1) could return. - virtual int do_max_length() const BOOST_CODECVT_NOEXCEPT { + virtual int do_max_length() const BOOST_NOEXCEPT { return 6; // largest UTF-8 encoding of a UCS-4 character } }; From 3d6fdcfda429f6ee2f2b2571f45388f2adebd9ca Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Sat, 1 Mar 2014 10:27:44 -0800 Subject: [PATCH 34/34] changed BOOST_NOEXCEPT to BOOST_NOEXCEPT_OR_NOTHROW --- include/boost/detail/utf8_codecvt_facet.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/detail/utf8_codecvt_facet.hpp b/include/boost/detail/utf8_codecvt_facet.hpp index e5e5a3e..753b339 100644 --- a/include/boost/detail/utf8_codecvt_facet.hpp +++ b/include/boost/detail/utf8_codecvt_facet.hpp @@ -141,17 +141,17 @@ protected: } // continuing octets = octets except for the leading octet - static unsigned int get_cont_octet_count(unsigned char lead_octet) { + static unsigned int get_cont_octet_count(unsigned char lead_octet) { return get_octet_count(lead_octet) - 1; } - static unsigned int get_octet_count(unsigned char lead_octet); + static unsigned int get_octet_count(unsigned char lead_octet); // How many "continuing octets" will be needed for this word // == total octets - 1. int get_cont_octet_out_count(wchar_t word) const ; - virtual bool do_always_noconv() const BOOST_NOEXCEPT { + virtual bool do_always_noconv() const BOOST_NOEXCEPT_OR_NOTHROW { return false; } @@ -166,7 +166,7 @@ protected: return ok; } - virtual int do_encoding() const BOOST_NOEXCEPT { + virtual int do_encoding() const BOOST_NOEXCEPT_OR_NOTHROW { const int variable_byte_external_encoding=0; return variable_byte_external_encoding; } @@ -181,7 +181,7 @@ protected: ) const; // Largest possible value do_length(state,from,from_end,1) could return. - virtual int do_max_length() const BOOST_NOEXCEPT { + virtual int do_max_length() const BOOST_NOEXCEPT_OR_NOTHROW { return 6; // largest UTF-8 encoding of a UCS-4 character } };