|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86307 - in trunk/boost: detail/winapi sync/detail
From: andrey.semashev_at_[hidden]
Date: 2013-10-14 17:06:06
Author: andysem
Date: 2013-10-14 17:06:05 EDT (Mon, 14 Oct 2013)
New Revision: 86307
URL: http://svn.boost.org/trac/boost/changeset/86307
Log:
Added support for WinAPI version specification.
Added:
trunk/boost/detail/winapi/config.hpp (contents, props changed)
Text files modified:
trunk/boost/detail/winapi/basic_types.hpp | 17 +---
trunk/boost/detail/winapi/config.hpp | 52 ++++++++++++++
trunk/boost/detail/winapi/synchronization.hpp | 142 ++++++++++++++++++++++++++++++++++-----
trunk/boost/detail/winapi/time.hpp | 11 +++
trunk/boost/sync/detail/config.hpp | 15 +--
5 files changed, 199 insertions(+), 38 deletions(-)
Modified: trunk/boost/detail/winapi/basic_types.hpp
==============================================================================
--- trunk/boost/detail/winapi/basic_types.hpp Mon Oct 14 16:36:40 2013 (r86306)
+++ trunk/boost/detail/winapi/basic_types.hpp 2013-10-14 17:06:05 EDT (Mon, 14 Oct 2013) (r86307)
@@ -9,9 +9,9 @@
#ifndef BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP
#define BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP
-#include <boost/config.hpp>
#include <cstdarg>
#include <boost/cstdint.hpp>
+#include <boost/detail/winapi/config.hpp>
#if defined( BOOST_USE_WINDOWS_H )
# include <windows.h>
@@ -57,6 +57,7 @@
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 @@
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 @@
}
}
}
-#endif // BOOST_DETAIL_WINAPI_TIME_HPP
+
+#endif // BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP
Added: trunk/boost/detail/winapi/config.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/detail/winapi/config.hpp 2013-10-14 17:06:05 EDT (Mon, 14 Oct 2013) (r86307)
@@ -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 <boost/config.hpp>
+
+#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_
Modified: trunk/boost/detail/winapi/synchronization.hpp
==============================================================================
--- trunk/boost/detail/winapi/synchronization.hpp Mon Oct 14 16:36:40 2013 (r86306)
+++ trunk/boost/detail/winapi/synchronization.hpp 2013-10-14 17:06:05 EDT (Mon, 14 Oct 2013) (r86307)
@@ -25,7 +25,26 @@
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 @@
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 @@
#else
unsigned long SpinCount;
#endif
- };
+ }
+ *PCRITICAL_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);
+
+ 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(CRITICAL_SECTION_ *);
__declspec(dllimport) void WINAPI
- EnterCriticalSection(CRITICAL_SECTION_ *);
- __declspec(dllimport) bool WINAPI
- TryEnterCriticalSection(CRITICAL_SECTION_ *);
+ 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(CRITICAL_SECTION_ *);
+ LeaveCriticalSection(PCRITICAL_SECTION_);
__declspec(dllimport) void WINAPI
- DeleteCriticalSection(CRITICAL_SECTION_ *);
+ DeleteCriticalSection(PCRITICAL_SECTION_);
- struct _SECURITY_ATTRIBUTES;
+ struct _SECURITY_ATTRIBUTES;
# ifdef BOOST_NO_ANSI_APIS
__declspec(dllimport) HANDLE_ WINAPI
CreateMutexW(_SECURITY_ATTRIBUTES*, BOOL_, LPCWSTR_);
@@ -124,18 +203,36 @@
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_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;
Modified: trunk/boost/detail/winapi/time.hpp
==============================================================================
--- trunk/boost/detail/winapi/time.hpp Mon Oct 14 16:36:40 2013 (r86306)
+++ trunk/boost/detail/winapi/time.hpp 2013-10-14 17:06:05 EDT (Mon, 14 Oct 2013) (r86307)
@@ -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 @@
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 @@
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
Modified: trunk/boost/sync/detail/config.hpp
==============================================================================
--- trunk/boost/sync/detail/config.hpp Mon Oct 14 16:36:40 2013 (r86306)
+++ trunk/boost/sync/detail/config.hpp 2013-10-14 17:06:05 EDT (Mon, 14 Oct 2013) (r86307)
@@ -18,18 +18,17 @@
#include <boost/config.hpp>
+#if defined(BOOST_WINDOWS)
+#include <boost/detail/winapi/config.hpp>
+#endif
+
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
// BOOST_SYNC_USE_PTHREAD and BOOST_SYNC_USE_WINAPI_VERSION are user-configurable macros
#if defined(BOOST_WINDOWS) && !defined(BOOST_SYNC_USE_WINAPI_VERSION)
-#if defined(_WIN32_WINNT)
-#define BOOST_SYNC_USE_WINAPI_VERSION _WIN32_WINNT
-#else
-// By default use Windows 2000 API: _WIN32_WINNT_WIN2K
-#define BOOST_SYNC_USE_WINAPI_VERSION 0x0500
-#endif
+#define BOOST_SYNC_USE_WINAPI_VERSION BOOST_USE_WINAPI_VERSION
#endif
#if defined(BOOST_SYNC_USE_WINAPI_VERSION) && !defined(BOOST_SYNC_USE_PTHREAD)
@@ -41,7 +40,7 @@
#if defined(BOOST_SYNC_DETAIL_PLATFORM_PTHREAD)
#define BOOST_SYNC_DETAIL_ABI_NAMESPACE posix
#elif defined(BOOST_SYNC_DETAIL_PLATFORM_WINAPI)
-#if BOOST_SYNC_USE_WINAPI_VERSION >= 0x0600
+#if BOOST_SYNC_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
#define BOOST_SYNC_DETAIL_ABI_NAMESPACE winnt6
#else
#define BOOST_SYNC_DETAIL_ABI_NAMESPACE winnt5
@@ -61,7 +60,7 @@
BOOST_SYNC_DETAIL_OPEN_ABI_NAMESPACE {}
using namespace BOOST_SYNC_DETAIL_ABI_NAMESPACE
-#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && !defined(__clang__)
__attribute__((__strong__))
#endif
;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk