mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
bringing boost_1_63_0 into the wsjtx branch
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7584 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
bdf4ffa7ba
commit
124f5863ac
312
boost/Jamroot
Normal file
312
boost/Jamroot
Normal file
@ -0,0 +1,312 @@
|
||||
# Copyright Vladimir Prus 2002-2006.
|
||||
# Copyright Dave Abrahams 2005-2006.
|
||||
# Copyright Rene Rivera 2005-2007.
|
||||
# Copyright Douglas Gregor 2005.
|
||||
#
|
||||
# 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)
|
||||
|
||||
# Usage:
|
||||
#
|
||||
# b2 [options] [properties] [install|stage]
|
||||
#
|
||||
# Builds and installs Boost.
|
||||
#
|
||||
# Targets and Related Options:
|
||||
#
|
||||
# install Install headers and compiled library files to the
|
||||
# ======= configured locations (below).
|
||||
#
|
||||
# --prefix=<PREFIX> Install architecture independent files here.
|
||||
# Default; C:\Boost on Win32
|
||||
# Default; /usr/local on Unix. Linux, etc.
|
||||
#
|
||||
# --exec-prefix=<EPREFIX> Install architecture dependent files here.
|
||||
# Default; <PREFIX>
|
||||
#
|
||||
# --libdir=<DIR> Install library files here.
|
||||
# Default; <EPREFIX>/lib
|
||||
#
|
||||
# --includedir=<HDRDIR> Install header files here.
|
||||
# Default; <PREFIX>/include
|
||||
#
|
||||
# stage Build and install only compiled library files to the
|
||||
# ===== stage directory.
|
||||
#
|
||||
# --stagedir=<STAGEDIR> Install library files here
|
||||
# Default; ./stage
|
||||
#
|
||||
# Other Options:
|
||||
#
|
||||
# --build-type=<type> Build the specified pre-defined set of variations of
|
||||
# the libraries. Note, that which variants get built
|
||||
# depends on what each library supports.
|
||||
#
|
||||
# -- minimal -- (default) Builds a minimal set of
|
||||
# variants. On Windows, these are static
|
||||
# multithreaded libraries in debug and release
|
||||
# modes, using shared runtime. On Linux, these are
|
||||
# static and shared multithreaded libraries in
|
||||
# release mode.
|
||||
#
|
||||
# -- complete -- Build all possible variations.
|
||||
#
|
||||
# --build-dir=DIR Build in this location instead of building within
|
||||
# the distribution tree. Recommended!
|
||||
#
|
||||
# --show-libraries Display the list of Boost libraries that require
|
||||
# build and installation steps, and then exit.
|
||||
#
|
||||
# --layout=<layout> Determine whether to choose library names and header
|
||||
# locations such that multiple versions of Boost or
|
||||
# multiple compilers can be used on the same system.
|
||||
#
|
||||
# -- versioned -- Names of boost binaries include
|
||||
# the Boost version number, name and version of
|
||||
# the compiler and encoded build properties. Boost
|
||||
# headers are installed in a subdirectory of
|
||||
# <HDRDIR> whose name contains the Boost version
|
||||
# number.
|
||||
#
|
||||
# -- tagged -- Names of boost binaries include the
|
||||
# encoded build properties such as variant and
|
||||
# threading, but do not including compiler name
|
||||
# and version, or Boost version. This option is
|
||||
# useful if you build several variants of Boost,
|
||||
# using the same compiler.
|
||||
#
|
||||
# -- system -- Binaries names do not include the
|
||||
# Boost version number or the name and version
|
||||
# number of the compiler. Boost headers are
|
||||
# installed directly into <HDRDIR>. This option is
|
||||
# intended for system integrators building
|
||||
# distribution packages.
|
||||
#
|
||||
# The default value is 'versioned' on Windows, and
|
||||
# 'system' on Unix.
|
||||
#
|
||||
# --buildid=ID Add the specified ID to the name of built libraries.
|
||||
# The default is to not add anything.
|
||||
#
|
||||
# --python-buildid=ID Add the specified ID to the name of built libraries
|
||||
# that depend on Python. The default is to not add
|
||||
# anything. This ID is added in addition to --buildid.
|
||||
#
|
||||
# --help This message.
|
||||
#
|
||||
# --with-<library> Build and install the specified <library>. If this
|
||||
# option is used, only libraries specified using this
|
||||
# option will be built.
|
||||
#
|
||||
# --without-<library> Do not build, stage, or install the specified
|
||||
# <library>. By default, all libraries are built.
|
||||
#
|
||||
# Properties:
|
||||
#
|
||||
# toolset=toolset Indicate the toolset to build with.
|
||||
#
|
||||
# variant=debug|release Select the build variant
|
||||
#
|
||||
# link=static|shared Whether to build static or shared libraries
|
||||
#
|
||||
# threading=single|multi Whether to build single or multithreaded binaries
|
||||
#
|
||||
# runtime-link=static|shared
|
||||
# Whether to link to static or shared C and C++
|
||||
# runtime.
|
||||
#
|
||||
|
||||
# TODO:
|
||||
# - handle boost version
|
||||
# - handle python options such as pydebug
|
||||
|
||||
import boostcpp ;
|
||||
import package ;
|
||||
|
||||
import sequence ;
|
||||
import xsltproc ;
|
||||
import set ;
|
||||
import path ;
|
||||
import link ;
|
||||
|
||||
path-constant BOOST_ROOT : . ;
|
||||
constant BOOST_VERSION : 1.63.0 ;
|
||||
constant BOOST_JAMROOT_MODULE : $(__name__) ;
|
||||
|
||||
boostcpp.set-version $(BOOST_VERSION) ;
|
||||
|
||||
use-project /boost/architecture : libs/config/checks/architecture ;
|
||||
|
||||
local all-headers =
|
||||
[ MATCH .*libs/(.*)/include/boost : [ glob libs/*/include/boost libs/*/*/include/boost ] ] ;
|
||||
|
||||
for dir in $(all-headers)
|
||||
{
|
||||
link-directory $(dir)-headers : libs/$(dir)/include/boost : <location>. ;
|
||||
explicit $(dir)-headers ;
|
||||
}
|
||||
|
||||
if $(all-headers)
|
||||
{
|
||||
constant BOOST_MODULARLAYOUT : $(all-headers) ;
|
||||
}
|
||||
|
||||
project boost
|
||||
: requirements <include>.
|
||||
|
||||
[ boostcpp.architecture ]
|
||||
[ boostcpp.address-model ]
|
||||
|
||||
# Disable auto-linking for all targets here, primarily because it caused
|
||||
# troubles with V2.
|
||||
<define>BOOST_ALL_NO_LIB=1
|
||||
# Used to encode variant in target name. See the 'tag' rule below.
|
||||
<tag>@$(__name__).tag
|
||||
<conditional>@handle-static-runtime
|
||||
# Comeau does not support shared lib
|
||||
<toolset>como:<link>static
|
||||
<toolset>como-linux:<define>_GNU_SOURCE=1
|
||||
# When building docs within Boost, we want the standard Boost style
|
||||
<xsl:param>boost.defaults=Boost
|
||||
: usage-requirements <include>.
|
||||
: build-dir bin.v2
|
||||
;
|
||||
|
||||
# This rule is called by Boost.Build to determine the name of target. We use it
|
||||
# to encode the build variant, compiler name and boost version in the target
|
||||
# name.
|
||||
#
|
||||
rule tag ( name : type ? : property-set )
|
||||
{
|
||||
return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ;
|
||||
}
|
||||
|
||||
rule python-tag ( name : type ? : property-set )
|
||||
{
|
||||
return [ boostcpp.python-tag $(name) : $(type) : $(property-set) ] ;
|
||||
}
|
||||
|
||||
rule handle-static-runtime ( properties * )
|
||||
{
|
||||
# Using static runtime with shared libraries is impossible on Linux, and
|
||||
# dangerous on Windows. Therefore, we disallow it. This might be drastic,
|
||||
# but it was disabled for a while without anybody complaining.
|
||||
|
||||
# For CW, static runtime is needed so that std::locale works.
|
||||
if <link>shared in $(properties) && <runtime-link>static in $(properties) &&
|
||||
! ( <toolset>cw in $(properties) )
|
||||
{
|
||||
ECHO "error: link=shared together with runtime-link=static is not allowed" ;
|
||||
ECHO "error: such property combination is either impossible " ;
|
||||
ECHO "error: or too dangerious to be of any use" ;
|
||||
EXIT ;
|
||||
}
|
||||
}
|
||||
|
||||
all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
|
||||
[ glob libs/*/build/Jamfile ] ] ;
|
||||
|
||||
all-libraries = [ sequence.unique $(all-libraries) ] ;
|
||||
# The function_types library has a Jamfile, but it's used for maintenance
|
||||
# purposes, there's no library to build and install.
|
||||
all-libraries = [ set.difference $(all-libraries) : function_types ] ;
|
||||
|
||||
# Setup convenient aliases for all libraries.
|
||||
|
||||
local rule explicit-alias ( id : targets + )
|
||||
{
|
||||
alias $(id) : $(targets) ;
|
||||
explicit $(id) ;
|
||||
}
|
||||
|
||||
# First, the complicated libraries: where the target name in Jamfile is
|
||||
# different from its directory name.
|
||||
explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
|
||||
explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
|
||||
explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
|
||||
explicit-alias bgl-vis : libs/graps/build//bgl-vis ;
|
||||
explicit-alias serialization : libs/serialization/build//boost_serialization ;
|
||||
explicit-alias wserialization : libs/serialization/build//boost_wserialization ;
|
||||
for local l in $(all-libraries)
|
||||
{
|
||||
if ! $(l) in test graph serialization
|
||||
{
|
||||
explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
|
||||
}
|
||||
}
|
||||
|
||||
# Log has an additional target
|
||||
explicit-alias log_setup : libs/log/build//boost_log_setup ;
|
||||
|
||||
alias headers : $(all-headers)-headers : : : <include>. ;
|
||||
explicit headers ;
|
||||
|
||||
# Make project ids of all libraries known.
|
||||
for local l in $(all-libraries)
|
||||
{
|
||||
use-project /boost/$(l) : libs/$(l)/build ;
|
||||
}
|
||||
|
||||
if [ path.exists $(BOOST_ROOT)/tools/inspect ]
|
||||
{
|
||||
use-project /boost/tools/inspect : tools/inspect/build ;
|
||||
}
|
||||
|
||||
if [ path.exists $(BOOST_ROOT)/libs/wave/tool ]
|
||||
{
|
||||
use-project /boost/libs/wave/tool : libs/wave/tool/build ;
|
||||
}
|
||||
|
||||
# This rule should be called from libraries' Jamfiles and will create two
|
||||
# targets, "install" and "stage", that will install or stage that library. The
|
||||
# --prefix option is respected, but --with and --without options, naturally, are
|
||||
# ignored.
|
||||
#
|
||||
# - libraries -- list of library targets to install.
|
||||
#
|
||||
rule boost-install ( libraries * )
|
||||
{
|
||||
package.install install
|
||||
: <dependency>/boost//install-proper-headers $(install-requirements)
|
||||
: # No binaries
|
||||
: $(libraries)
|
||||
: # No headers, it is handled by the dependency.
|
||||
;
|
||||
|
||||
install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
|
||||
|
||||
module [ CALLER_MODULE ]
|
||||
{
|
||||
explicit stage ;
|
||||
explicit install ;
|
||||
}
|
||||
}
|
||||
|
||||
# Creates a library target, adding autolink support and also creates
|
||||
# stage and install targets via boost-install, above.
|
||||
rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * )
|
||||
{
|
||||
name = boost_$(name) ;
|
||||
autolink = <link>shared:<define>BOOST_$(name:U)_DYN_LINK=1 ;
|
||||
lib $(name)
|
||||
: $(sources)
|
||||
: $(requirements) $(autolink)
|
||||
: $(default-build)
|
||||
: $(usage-requirements) $(autolink)
|
||||
;
|
||||
boost-install $(name) ;
|
||||
}
|
||||
|
||||
|
||||
headers =
|
||||
# The .SUNWCCh files are present in tr1 include directory and have to be
|
||||
# installed (see http://lists.boost.org/Archives/boost/2007/05/121430.php).
|
||||
[ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc *.SUNWCCh : CVS .svn ]
|
||||
[ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* : CVS .svn ]
|
||||
[ path.glob boost/tr1/tr1 : * : bcc32 sun CVS .svn ]
|
||||
;
|
||||
|
||||
# Declare special top-level targets that build and install the desired variants
|
||||
# of the libraries.
|
||||
boostcpp.declare-targets $(all-libraries) : $(headers) ;
|
446
boost/boost/array.hpp
Normal file
446
boost/boost/array.hpp
Normal file
@ -0,0 +1,446 @@
|
||||
/* The following code declares class array,
|
||||
* an STL container (as wrapper) for arrays of constant size.
|
||||
*
|
||||
* See
|
||||
* http://www.boost.org/libs/array/
|
||||
* for documentation.
|
||||
*
|
||||
* The original author site is at: http://www.josuttis.com/
|
||||
*
|
||||
* (C) Copyright Nicolai M. Josuttis 2001.
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* 14 Apr 2012 - (mtc) Added support for boost::hash
|
||||
* 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility.
|
||||
* 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group.
|
||||
* See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168
|
||||
* Eventually, we should remove "assign" which is now a synonym for "fill" (Marshall Clow)
|
||||
* 10 Mar 2010 - added workaround for SUNCC and !STLPort [trac #3893] (Marshall Clow)
|
||||
* 29 Jan 2004 - c_array() added, BOOST_NO_PRIVATE_IN_AGGREGATE removed (Nico Josuttis)
|
||||
* 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries.
|
||||
* 05 Aug 2001 - minor update (Nico Josuttis)
|
||||
* 20 Jan 2001 - STLport fix (Beman Dawes)
|
||||
* 29 Sep 2000 - Initial Revision (Nico Josuttis)
|
||||
*
|
||||
* Jan 29, 2004
|
||||
*/
|
||||
#ifndef BOOST_ARRAY_HPP
|
||||
#define BOOST_ARRAY_HPP
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe
|
||||
# pragma warning(disable:4510) // boost::array<T,N>' : default constructor could not be generated
|
||||
# pragma warning(disable:4610) // warning C4610: class 'boost::array<T,N>' can never be instantiated - user defined constructor required
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
|
||||
// Handles broken standard libraries better than <iterator>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/functional/hash_fwd.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
// FIXES for broken compilers
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T, std::size_t N>
|
||||
class array {
|
||||
public:
|
||||
T elems[N]; // fixed-size array of elements of type T
|
||||
|
||||
public:
|
||||
// type definitions
|
||||
typedef T value_type;
|
||||
typedef T* iterator;
|
||||
typedef const T* const_iterator;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
// iterator support
|
||||
iterator begin() { return elems; }
|
||||
const_iterator begin() const { return elems; }
|
||||
const_iterator cbegin() const { return elems; }
|
||||
|
||||
iterator end() { return elems+N; }
|
||||
const_iterator end() const { return elems+N; }
|
||||
const_iterator cend() const { return elems+N; }
|
||||
|
||||
// reverse iterator support
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310)
|
||||
// workaround for broken reverse_iterator in VC7
|
||||
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator,
|
||||
reference, iterator, reference> > reverse_iterator;
|
||||
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
|
||||
const_reference, iterator, reference> > const_reverse_iterator;
|
||||
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
|
||||
value_type, reference, iterator, difference_type> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
|
||||
value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
|
||||
#else
|
||||
// workaround for broken reverse_iterator implementations
|
||||
typedef std::reverse_iterator<iterator,T> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
|
||||
#endif
|
||||
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
const_reverse_iterator crbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
const_reverse_iterator crend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
// operator[]
|
||||
reference operator[](size_type i)
|
||||
{
|
||||
BOOST_ASSERT_MSG( i < N, "out of range" );
|
||||
return elems[i];
|
||||
}
|
||||
|
||||
const_reference operator[](size_type i) const
|
||||
{
|
||||
BOOST_ASSERT_MSG( i < N, "out of range" );
|
||||
return elems[i];
|
||||
}
|
||||
|
||||
// at() with range check
|
||||
reference at(size_type i) { rangecheck(i); return elems[i]; }
|
||||
const_reference at(size_type i) const { rangecheck(i); return elems[i]; }
|
||||
|
||||
// front() and back()
|
||||
reference front()
|
||||
{
|
||||
return elems[0];
|
||||
}
|
||||
|
||||
const_reference front() const
|
||||
{
|
||||
return elems[0];
|
||||
}
|
||||
|
||||
reference back()
|
||||
{
|
||||
return elems[N-1];
|
||||
}
|
||||
|
||||
const_reference back() const
|
||||
{
|
||||
return elems[N-1];
|
||||
}
|
||||
|
||||
// size is constant
|
||||
static size_type size() { return N; }
|
||||
static bool empty() { return false; }
|
||||
static size_type max_size() { return N; }
|
||||
enum { static_size = N };
|
||||
|
||||
// swap (note: linear complexity)
|
||||
void swap (array<T,N>& y) {
|
||||
for (size_type i = 0; i < N; ++i)
|
||||
boost::swap(elems[i],y.elems[i]);
|
||||
}
|
||||
|
||||
// direct access to data (read-only)
|
||||
const T* data() const { return elems; }
|
||||
T* data() { return elems; }
|
||||
|
||||
// use array as C array (direct read/write access to data)
|
||||
T* c_array() { return elems; }
|
||||
|
||||
// assignment with type conversion
|
||||
template <typename T2>
|
||||
array<T,N>& operator= (const array<T2,N>& rhs) {
|
||||
std::copy(rhs.begin(),rhs.end(), begin());
|
||||
return *this;
|
||||
}
|
||||
|
||||
// assign one value to all elements
|
||||
void assign (const T& value) { fill ( value ); } // A synonym for fill
|
||||
void fill (const T& value)
|
||||
{
|
||||
std::fill_n(begin(),size(),value);
|
||||
}
|
||||
|
||||
// check range (may be private because it is static)
|
||||
static void rangecheck (size_type i) {
|
||||
if (i >= size()) {
|
||||
std::out_of_range e("array<>: index out of range");
|
||||
boost::throw_exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
template< class T >
|
||||
class array< T, 0 > {
|
||||
|
||||
public:
|
||||
// type definitions
|
||||
typedef T value_type;
|
||||
typedef T* iterator;
|
||||
typedef const T* const_iterator;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
// iterator support
|
||||
iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); }
|
||||
const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
|
||||
const_iterator cbegin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
|
||||
|
||||
iterator end() { return begin(); }
|
||||
const_iterator end() const { return begin(); }
|
||||
const_iterator cend() const { return cbegin(); }
|
||||
|
||||
// reverse iterator support
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310)
|
||||
// workaround for broken reverse_iterator in VC7
|
||||
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator,
|
||||
reference, iterator, reference> > reverse_iterator;
|
||||
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
|
||||
const_reference, iterator, reference> > const_reverse_iterator;
|
||||
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
|
||||
value_type, reference, iterator, difference_type> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
|
||||
value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
|
||||
#else
|
||||
// workaround for broken reverse_iterator implementations
|
||||
typedef std::reverse_iterator<iterator,T> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
|
||||
#endif
|
||||
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
const_reverse_iterator crbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
const_reverse_iterator crend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
// operator[]
|
||||
reference operator[](size_type /*i*/)
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
const_reference operator[](size_type /*i*/) const
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
// at() with range check
|
||||
reference at(size_type /*i*/) { return failed_rangecheck(); }
|
||||
const_reference at(size_type /*i*/) const { return failed_rangecheck(); }
|
||||
|
||||
// front() and back()
|
||||
reference front()
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
const_reference front() const
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
reference back()
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
const_reference back() const
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
// size is constant
|
||||
static size_type size() { return 0; }
|
||||
static bool empty() { return true; }
|
||||
static size_type max_size() { return 0; }
|
||||
enum { static_size = 0 };
|
||||
|
||||
void swap (array<T,0>& /*y*/) {
|
||||
}
|
||||
|
||||
// direct access to data (read-only)
|
||||
const T* data() const { return 0; }
|
||||
T* data() { return 0; }
|
||||
|
||||
// use array as C array (direct read/write access to data)
|
||||
T* c_array() { return 0; }
|
||||
|
||||
// assignment with type conversion
|
||||
template <typename T2>
|
||||
array<T,0>& operator= (const array<T2,0>& ) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
// assign one value to all elements
|
||||
void assign (const T& value) { fill ( value ); }
|
||||
void fill (const T& ) {}
|
||||
|
||||
// check range (may be private because it is static)
|
||||
static reference failed_rangecheck () {
|
||||
std::out_of_range e("attempt to access element of an empty array");
|
||||
boost::throw_exception(e);
|
||||
#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__))
|
||||
//
|
||||
// We need to return something here to keep
|
||||
// some compilers happy: however we will never
|
||||
// actually get here....
|
||||
//
|
||||
static T placeholder;
|
||||
return placeholder;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// comparisons
|
||||
template<class T, std::size_t N>
|
||||
bool operator== (const array<T,N>& x, const array<T,N>& y) {
|
||||
return std::equal(x.begin(), x.end(), y.begin());
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator< (const array<T,N>& x, const array<T,N>& y) {
|
||||
return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator!= (const array<T,N>& x, const array<T,N>& y) {
|
||||
return !(x==y);
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator> (const array<T,N>& x, const array<T,N>& y) {
|
||||
return y<x;
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator<= (const array<T,N>& x, const array<T,N>& y) {
|
||||
return !(y<x);
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator>= (const array<T,N>& x, const array<T,N>& y) {
|
||||
return !(x<y);
|
||||
}
|
||||
|
||||
// global swap()
|
||||
template<class T, std::size_t N>
|
||||
inline void swap (array<T,N>& x, array<T,N>& y) {
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
// Trac ticket #4757; the Sun Solaris compiler can't handle
|
||||
// syntax like 'T(&get_c_array(boost::array<T,N>& arg))[N]'
|
||||
//
|
||||
// We can't just use this for all compilers, because the
|
||||
// borland compilers can't handle this form.
|
||||
namespace detail {
|
||||
template <typename T, std::size_t N> struct c_array
|
||||
{
|
||||
typedef T type[N];
|
||||
};
|
||||
}
|
||||
|
||||
// Specific for boost::array: simply returns its elems data member.
|
||||
template <typename T, std::size_t N>
|
||||
typename detail::c_array<T,N>::type& get_c_array(boost::array<T,N>& arg)
|
||||
{
|
||||
return arg.elems;
|
||||
}
|
||||
|
||||
// Specific for boost::array: simply returns its elems data member.
|
||||
template <typename T, std::size_t N>
|
||||
typename const detail::c_array<T,N>::type& get_c_array(const boost::array<T,N>& arg)
|
||||
{
|
||||
return arg.elems;
|
||||
}
|
||||
#else
|
||||
// Specific for boost::array: simply returns its elems data member.
|
||||
template <typename T, std::size_t N>
|
||||
T(&get_c_array(boost::array<T,N>& arg))[N]
|
||||
{
|
||||
return arg.elems;
|
||||
}
|
||||
|
||||
// Const version.
|
||||
template <typename T, std::size_t N>
|
||||
const T(&get_c_array(const boost::array<T,N>& arg))[N]
|
||||
{
|
||||
return arg.elems;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// Overload for std::array, assuming that std::array will have
|
||||
// explicit conversion functions as discussed at the WG21 meeting
|
||||
// in Summit, March 2009.
|
||||
template <typename T, std::size_t N>
|
||||
T(&get_c_array(std::array<T,N>& arg))[N]
|
||||
{
|
||||
return static_cast<T(&)[N]>(arg);
|
||||
}
|
||||
|
||||
// Const version.
|
||||
template <typename T, std::size_t N>
|
||||
const T(&get_c_array(const std::array<T,N>& arg))[N]
|
||||
{
|
||||
return static_cast<T(&)[N]>(arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
template<class T, std::size_t N>
|
||||
std::size_t hash_value(const array<T,N>& arr)
|
||||
{
|
||||
return boost::hash_range(arr.begin(), arr.end());
|
||||
}
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif /*BOOST_ARRAY_HPP*/
|
85
boost/boost/assert.hpp
Normal file
85
boost/boost/assert.hpp
Normal file
@ -0,0 +1,85 @@
|
||||
//
|
||||
// boost/assert.hpp - BOOST_ASSERT(expr)
|
||||
// BOOST_ASSERT_MSG(expr, msg)
|
||||
// BOOST_VERIFY(expr)
|
||||
// BOOST_VERIFY_MSG(expr, msg)
|
||||
// BOOST_ASSERT_IS_VOID
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2007, 2014 Peter Dimov
|
||||
// Copyright (c) Beman Dawes 2011
|
||||
// Copyright (c) 2015 Ion Gaztanaga
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Note: There are no include guards. This is intentional.
|
||||
//
|
||||
// See http://www.boost.org/libs/assert/assert.html for documentation.
|
||||
//
|
||||
|
||||
//
|
||||
// Stop inspect complaining about use of 'assert':
|
||||
//
|
||||
// boostinspect:naassert_macro
|
||||
//
|
||||
|
||||
//
|
||||
// BOOST_ASSERT, BOOST_ASSERT_MSG, BOOST_ASSERT_IS_VOID
|
||||
//
|
||||
|
||||
#undef BOOST_ASSERT
|
||||
#undef BOOST_ASSERT_MSG
|
||||
#undef BOOST_ASSERT_IS_VOID
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) )
|
||||
|
||||
# define BOOST_ASSERT(expr) ((void)0)
|
||||
# define BOOST_ASSERT_MSG(expr, msg) ((void)0)
|
||||
# define BOOST_ASSERT_IS_VOID
|
||||
|
||||
#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_LIKELY
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
|
||||
void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
#define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
|
||||
#else
|
||||
|
||||
# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
|
||||
|
||||
# define BOOST_ASSERT(expr) assert(expr)
|
||||
# define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))
|
||||
#if defined(NDEBUG)
|
||||
# define BOOST_ASSERT_IS_VOID
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// BOOST_VERIFY, BOOST_VERIFY_MSG
|
||||
//
|
||||
|
||||
#undef BOOST_VERIFY
|
||||
#undef BOOST_VERIFY_MSG
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
|
||||
|
||||
# define BOOST_VERIFY(expr) ((void)(expr))
|
||||
# define BOOST_VERIFY_MSG(expr, msg) ((void)(expr))
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_VERIFY(expr) BOOST_ASSERT(expr)
|
||||
# define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg)
|
||||
|
||||
#endif
|
18
boost/boost/atomic.hpp
Normal file
18
boost/boost/atomic.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef BOOST_ATOMIC_HPP
|
||||
#define BOOST_ATOMIC_HPP
|
||||
|
||||
// Copyright (c) 2011 Helge Bahmann
|
||||
//
|
||||
// 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)
|
||||
|
||||
// This header includes all Boost.Atomic public headers
|
||||
|
||||
#include <boost/atomic/atomic.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#endif
|
93
boost/boost/atomic/atomic.hpp
Normal file
93
boost/boost/atomic/atomic.hpp
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2011 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/atomic.hpp
|
||||
*
|
||||
* This header contains definition of \c atomic template and \c atomic_flag.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_ATOMIC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_ATOMIC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#include <boost/atomic/fences.hpp>
|
||||
#include <boost/atomic/atomic_flag.hpp>
|
||||
#include <boost/atomic/detail/atomic_template.hpp>
|
||||
#include <boost/atomic/detail/operations.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
using atomics::atomic;
|
||||
|
||||
using atomics::atomic_char;
|
||||
using atomics::atomic_uchar;
|
||||
using atomics::atomic_schar;
|
||||
using atomics::atomic_uint8_t;
|
||||
using atomics::atomic_int8_t;
|
||||
using atomics::atomic_ushort;
|
||||
using atomics::atomic_short;
|
||||
using atomics::atomic_uint16_t;
|
||||
using atomics::atomic_int16_t;
|
||||
using atomics::atomic_uint;
|
||||
using atomics::atomic_int;
|
||||
using atomics::atomic_uint32_t;
|
||||
using atomics::atomic_int32_t;
|
||||
using atomics::atomic_ulong;
|
||||
using atomics::atomic_long;
|
||||
using atomics::atomic_uint64_t;
|
||||
using atomics::atomic_int64_t;
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
using atomics::atomic_ullong;
|
||||
using atomics::atomic_llong;
|
||||
#endif
|
||||
using atomics::atomic_address;
|
||||
using atomics::atomic_bool;
|
||||
using atomics::atomic_wchar_t;
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
using atomics::atomic_char16_t;
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_CHAR32_T)
|
||||
using atomics::atomic_char32_t;
|
||||
#endif
|
||||
|
||||
using atomics::atomic_int_least8_t;
|
||||
using atomics::atomic_uint_least8_t;
|
||||
using atomics::atomic_int_least16_t;
|
||||
using atomics::atomic_uint_least16_t;
|
||||
using atomics::atomic_int_least32_t;
|
||||
using atomics::atomic_uint_least32_t;
|
||||
using atomics::atomic_int_least64_t;
|
||||
using atomics::atomic_uint_least64_t;
|
||||
using atomics::atomic_int_fast8_t;
|
||||
using atomics::atomic_uint_fast8_t;
|
||||
using atomics::atomic_int_fast16_t;
|
||||
using atomics::atomic_uint_fast16_t;
|
||||
using atomics::atomic_int_fast32_t;
|
||||
using atomics::atomic_uint_fast32_t;
|
||||
using atomics::atomic_int_fast64_t;
|
||||
using atomics::atomic_uint_fast64_t;
|
||||
using atomics::atomic_intmax_t;
|
||||
using atomics::atomic_uintmax_t;
|
||||
|
||||
using atomics::atomic_size_t;
|
||||
using atomics::atomic_ptrdiff_t;
|
||||
|
||||
#if defined(BOOST_HAS_INTPTR_T)
|
||||
using atomics::atomic_intptr_t;
|
||||
using atomics::atomic_uintptr_t;
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_ATOMIC_HPP_INCLUDED_
|
33
boost/boost/atomic/atomic_flag.hpp
Normal file
33
boost/boost/atomic/atomic_flag.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2011 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/atomic_flag.hpp
|
||||
*
|
||||
* This header contains definition of \c atomic_flag.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_ATOMIC_FLAG_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_ATOMIC_FLAG_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#include <boost/atomic/detail/operations.hpp>
|
||||
#include <boost/atomic/detail/atomic_flag.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
using atomics::atomic_flag;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_ATOMIC_FLAG_HPP_INCLUDED_
|
161
boost/boost/atomic/capabilities.hpp
Normal file
161
boost/boost/atomic/capabilities.hpp
Normal file
@ -0,0 +1,161 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/capabilities.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_CAPABILITIES_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_CAPABILITIES_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/platform.hpp>
|
||||
#include <boost/atomic/detail/int_sizes.hpp>
|
||||
|
||||
#if !defined(BOOST_ATOMIC_EMULATED)
|
||||
#include BOOST_ATOMIC_DETAIL_HEADER(boost/atomic/detail/caps_)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_INT8_LOCK_FREE
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_INT16_LOCK_FREE
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_INT64_LOCK_FREE
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_INT128_LOCK_FREE
|
||||
#define BOOST_ATOMIC_INT128_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef BOOST_ATOMIC_CHAR_LOCK_FREE
|
||||
#define BOOST_ATOMIC_CHAR_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
#if BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 1
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 2
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 4
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 8
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_SHORT_LOCK_FREE
|
||||
#if BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 1
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 2
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 4
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 8
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_INT_LOCK_FREE
|
||||
#if BOOST_ATOMIC_DETAIL_SIZEOF_INT == 1
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_INT == 2
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_INT == 4
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_INT == 8
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_LONG_LOCK_FREE
|
||||
#if BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 1
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 2
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 4
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 8
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_LLONG_LOCK_FREE
|
||||
#if BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 1
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 2
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 4
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 8
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_POINTER_LOCK_FREE
|
||||
#if (BOOST_ATOMIC_DETAIL_SIZEOF_POINTER + 0) == 8
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE
|
||||
#elif (BOOST_ATOMIC_DETAIL_SIZEOF_POINTER + 0) == 4
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_ADDRESS_LOCK_FREE BOOST_ATOMIC_POINTER_LOCK_FREE
|
||||
|
||||
#ifndef BOOST_ATOMIC_BOOL_LOCK_FREE
|
||||
// We store bools in 1-byte storage in all backends
|
||||
#define BOOST_ATOMIC_BOOL_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE
|
||||
#define BOOST_ATOMIC_FLAG_LOCK_FREE BOOST_ATOMIC_BOOL_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_THREAD_FENCE
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_SIGNAL_FENCE
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 0
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ATOMIC_CAPABILITIES_HPP_INCLUDED_
|
70
boost/boost/atomic/detail/atomic_flag.hpp
Normal file
70
boost/boost/atomic/detail/atomic_flag.hpp
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/atomic_flag.hpp
|
||||
*
|
||||
* This header contains interface definition of \c atomic_flag.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_ATOMIC_FLAG_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_ATOMIC_FLAG_HPP_INCLUDED_
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/operations_lockfree.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE,
|
||||
* see comment for convert_memory_order_to_gcc in ops_gcc_atomic.hpp.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
|
||||
#if defined(BOOST_NO_CXX11_CONSTEXPR) || defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
|
||||
#define BOOST_ATOMIC_NO_ATOMIC_FLAG_INIT
|
||||
#else
|
||||
#define BOOST_ATOMIC_FLAG_INIT {}
|
||||
#endif
|
||||
|
||||
struct atomic_flag
|
||||
{
|
||||
typedef atomics::detail::operations< 1u, false > operations;
|
||||
typedef operations::storage_type storage_type;
|
||||
|
||||
operations::aligned_storage_type m_storage;
|
||||
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR atomic_flag() BOOST_NOEXCEPT : m_storage(0)
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return operations::test_and_set(m_storage.value, order);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_acquire);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
operations::clear(m_storage.value, order);
|
||||
}
|
||||
|
||||
BOOST_DELETED_FUNCTION(atomic_flag(atomic_flag const&))
|
||||
BOOST_DELETED_FUNCTION(atomic_flag& operator= (atomic_flag const&))
|
||||
};
|
||||
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_ATOMIC_FLAG_HPP_INCLUDED_
|
780
boost/boost/atomic/detail/atomic_template.hpp
Normal file
780
boost/boost/atomic/detail/atomic_template.hpp
Normal file
@ -0,0 +1,780 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2011 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/atomic_template.hpp
|
||||
*
|
||||
* This header contains interface definition of \c atomic template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_ATOMIC_TEMPLATE_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_ATOMIC_TEMPLATE_HPP_INCLUDED_
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/type_traits/is_signed.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/bitwise_cast.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
// 'boost::atomics::atomic<T>' : multiple assignment operators specified
|
||||
#pragma warning(disable: 4522)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE,
|
||||
* see comment for convert_memory_order_to_gcc in ops_gcc_atomic.hpp.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR memory_order deduce_failure_order(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return order == memory_order_acq_rel ? memory_order_acquire : (order == memory_order_release ? memory_order_relaxed : order);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR bool cas_failure_order_must_not_be_stronger_than_success_order(memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
// 15 == (memory_order_seq_cst | memory_order_consume), see memory_order.hpp
|
||||
// Given the enum values we can test the strength of memory order requirements with this single condition.
|
||||
return (failure_order & 15u) <= (success_order & 15u);
|
||||
}
|
||||
|
||||
template< typename T, bool IsInt = boost::is_integral< T >::value >
|
||||
struct classify
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
struct classify< T, true > { typedef int type; };
|
||||
|
||||
template< typename T >
|
||||
struct classify< T*, false > { typedef void* type; };
|
||||
|
||||
template< typename T, typename Kind >
|
||||
class base_atomic;
|
||||
|
||||
//! Implementation for integers
|
||||
template< typename T >
|
||||
class base_atomic< T, int >
|
||||
{
|
||||
private:
|
||||
typedef T value_type;
|
||||
typedef T difference_type;
|
||||
|
||||
protected:
|
||||
typedef atomics::detail::operations< storage_size_of< value_type >::value, boost::is_signed< T >::value > operations;
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
typedef typename operations::storage_type storage_type;
|
||||
|
||||
protected:
|
||||
typename operations::aligned_storage_type m_storage;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : m_storage(v) {}
|
||||
|
||||
BOOST_FORCEINLINE void store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_consume);
|
||||
BOOST_ASSERT(order != memory_order_acquire);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
operations::store(m_storage.value, static_cast< storage_type >(v), order);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_release);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
return static_cast< value_type >(operations::load(m_storage.value, order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< value_type >(operations::fetch_add(m_storage.value, static_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< value_type >(operations::fetch_sub(m_storage.value, static_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< value_type >(operations::exchange(m_storage.value, static_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = static_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_strong(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = static_cast< value_type >(old_value);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = static_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_weak(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = static_cast< value_type >(old_value);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_weak(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< value_type >(operations::fetch_and(m_storage.value, static_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< value_type >(operations::fetch_or(m_storage.value, static_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< value_type >(operations::fetch_xor(m_storage.value, static_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return operations::is_lock_free(m_storage.value);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator++(int) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_add(1);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator++() volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_add(1) + 1;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator--(int) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_sub(1);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator--() volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_sub(1) - 1;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator+=(difference_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_add(v) + v;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator-=(difference_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_sub(v) - v;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator&=(value_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_and(v) & v;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator|=(value_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_or(v) | v;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator^=(value_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_xor(v) ^ v;
|
||||
}
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
};
|
||||
|
||||
//! Implementation for bool
|
||||
template< >
|
||||
class base_atomic< bool, int >
|
||||
{
|
||||
private:
|
||||
typedef bool value_type;
|
||||
|
||||
protected:
|
||||
typedef atomics::detail::operations< 1u, false > operations;
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
typedef operations::storage_type storage_type;
|
||||
|
||||
protected:
|
||||
operations::aligned_storage_type m_storage;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : m_storage(v) {}
|
||||
|
||||
BOOST_FORCEINLINE void store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_consume);
|
||||
BOOST_ASSERT(order != memory_order_acquire);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
operations::store(m_storage.value, static_cast< storage_type >(v), order);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_release);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
return !!operations::load(m_storage.value, order);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return !!operations::exchange(m_storage.value, static_cast< storage_type >(v), order);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = static_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_strong(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = !!old_value;
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = static_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_weak(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = !!old_value;
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_weak(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return operations::is_lock_free(m_storage.value);
|
||||
}
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
};
|
||||
|
||||
|
||||
//! Implementation for user-defined types, such as structs and enums
|
||||
template< typename T >
|
||||
class base_atomic< T, void >
|
||||
{
|
||||
private:
|
||||
typedef T value_type;
|
||||
|
||||
protected:
|
||||
typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations;
|
||||
typedef value_type const& value_arg_type;
|
||||
|
||||
public:
|
||||
typedef typename operations::storage_type storage_type;
|
||||
|
||||
protected:
|
||||
typename operations::aligned_storage_type m_storage;
|
||||
|
||||
public:
|
||||
BOOST_FORCEINLINE explicit base_atomic(value_type const& v = value_type()) BOOST_NOEXCEPT : m_storage(atomics::detail::bitwise_cast< storage_type >(v))
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_consume);
|
||||
BOOST_ASSERT(order != memory_order_acquire);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
operations::store(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_release);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::load(m_storage.value, order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::exchange(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_strong(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = atomics::detail::bitwise_cast< value_type >(old_value);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_weak(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = atomics::detail::bitwise_cast< value_type >(old_value);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_weak(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return operations::is_lock_free(m_storage.value);
|
||||
}
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
};
|
||||
|
||||
|
||||
//! Implementation for pointers
|
||||
template< typename T >
|
||||
class base_atomic< T*, void* >
|
||||
{
|
||||
private:
|
||||
typedef T* value_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
protected:
|
||||
typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations;
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
typedef typename operations::storage_type storage_type;
|
||||
|
||||
protected:
|
||||
typename operations::aligned_storage_type m_storage;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(), {})
|
||||
BOOST_FORCEINLINE explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : m_storage(atomics::detail::bitwise_cast< storage_type >(v))
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_consume);
|
||||
BOOST_ASSERT(order != memory_order_acquire);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
operations::store(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_release);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::load(m_storage.value, order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::fetch_add(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::fetch_sub(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::exchange(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_strong(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = atomics::detail::bitwise_cast< value_type >(old_value);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_weak(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = atomics::detail::bitwise_cast< value_type >(old_value);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_weak(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return operations::is_lock_free(m_storage.value);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator++(int) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_add(1);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator++() volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_add(1) + 1;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator--(int) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_sub(1);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator--() volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_sub(1) - 1;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator+=(difference_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_add(v) + v;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator-=(difference_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_sub(v) - v;
|
||||
}
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
};
|
||||
|
||||
|
||||
//! Implementation for void pointers
|
||||
template< >
|
||||
class base_atomic< void*, void* >
|
||||
{
|
||||
private:
|
||||
typedef void* value_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
protected:
|
||||
typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations;
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
typedef operations::storage_type storage_type;
|
||||
|
||||
protected:
|
||||
operations::aligned_storage_type m_storage;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(), {})
|
||||
BOOST_FORCEINLINE explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : m_storage(atomics::detail::bitwise_cast< storage_type >(v))
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_consume);
|
||||
BOOST_ASSERT(order != memory_order_acquire);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
operations::store(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(order != memory_order_release);
|
||||
BOOST_ASSERT(order != memory_order_acq_rel);
|
||||
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::load(m_storage.value, order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::fetch_add(m_storage.value, static_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::fetch_sub(m_storage.value, static_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return atomics::detail::bitwise_cast< value_type >(operations::exchange(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_strong(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = atomics::detail::bitwise_cast< value_type >(old_value);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(failure_order != memory_order_release);
|
||||
BOOST_ASSERT(failure_order != memory_order_acq_rel);
|
||||
BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order));
|
||||
|
||||
storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected);
|
||||
const bool res = operations::compare_exchange_weak(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order);
|
||||
expected = atomics::detail::bitwise_cast< value_type >(old_value);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool compare_exchange_weak(value_type& expected, value_type desired, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_weak(expected, desired, order, atomics::detail::deduce_failure_order(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return operations::is_lock_free(m_storage.value);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator++(int) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_add(1);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator++() volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return (char*)fetch_add(1) + 1;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator--(int) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return fetch_sub(1);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator--() volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return (char*)fetch_sub(1) - 1;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator+=(difference_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return (char*)fetch_add(v) + v;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator-=(difference_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return (char*)fetch_sub(v) - v;
|
||||
}
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template< typename T >
|
||||
class atomic :
|
||||
public atomics::detail::base_atomic< T, typename atomics::detail::classify< T >::type >
|
||||
{
|
||||
private:
|
||||
typedef T value_type;
|
||||
typedef atomics::detail::base_atomic< T, typename atomics::detail::classify< T >::type > base_type;
|
||||
typedef typename base_type::value_arg_type value_arg_type;
|
||||
|
||||
public:
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
|
||||
public:
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = base_type::operations::is_always_lock_free;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(atomic(), BOOST_NOEXCEPT {})
|
||||
|
||||
// NOTE: The constructor is made explicit because gcc 4.7 complains that
|
||||
// operator=(value_arg_type) is considered ambiguous with operator=(atomic const&)
|
||||
// in assignment expressions, even though conversion to atomic<> is less preferred
|
||||
// than conversion to value_arg_type.
|
||||
BOOST_FORCEINLINE explicit BOOST_CONSTEXPR atomic(value_arg_type v) BOOST_NOEXCEPT : base_type(v) {}
|
||||
|
||||
BOOST_FORCEINLINE value_type operator= (value_arg_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
this->store(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE operator value_type() volatile const BOOST_NOEXCEPT
|
||||
{
|
||||
return this->load();
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE storage_type& storage() BOOST_NOEXCEPT { return this->m_storage.value; }
|
||||
BOOST_FORCEINLINE storage_type volatile& storage() volatile BOOST_NOEXCEPT { return this->m_storage.value; }
|
||||
BOOST_FORCEINLINE storage_type const& storage() const BOOST_NOEXCEPT { return this->m_storage.value; }
|
||||
BOOST_FORCEINLINE storage_type const volatile& storage() const volatile BOOST_NOEXCEPT { return this->m_storage.value; }
|
||||
|
||||
BOOST_DELETED_FUNCTION(atomic(atomic const&))
|
||||
BOOST_DELETED_FUNCTION(atomic& operator= (atomic const&))
|
||||
BOOST_DELETED_FUNCTION(atomic& operator= (atomic const&) volatile)
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
BOOST_CONSTEXPR_OR_CONST bool atomic< T >::is_always_lock_free;
|
||||
|
||||
typedef atomic< char > atomic_char;
|
||||
typedef atomic< unsigned char > atomic_uchar;
|
||||
typedef atomic< signed char > atomic_schar;
|
||||
typedef atomic< uint8_t > atomic_uint8_t;
|
||||
typedef atomic< int8_t > atomic_int8_t;
|
||||
typedef atomic< unsigned short > atomic_ushort;
|
||||
typedef atomic< short > atomic_short;
|
||||
typedef atomic< uint16_t > atomic_uint16_t;
|
||||
typedef atomic< int16_t > atomic_int16_t;
|
||||
typedef atomic< unsigned int > atomic_uint;
|
||||
typedef atomic< int > atomic_int;
|
||||
typedef atomic< uint32_t > atomic_uint32_t;
|
||||
typedef atomic< int32_t > atomic_int32_t;
|
||||
typedef atomic< unsigned long > atomic_ulong;
|
||||
typedef atomic< long > atomic_long;
|
||||
typedef atomic< uint64_t > atomic_uint64_t;
|
||||
typedef atomic< int64_t > atomic_int64_t;
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef atomic< boost::ulong_long_type > atomic_ullong;
|
||||
typedef atomic< boost::long_long_type > atomic_llong;
|
||||
#endif
|
||||
typedef atomic< void* > atomic_address;
|
||||
typedef atomic< bool > atomic_bool;
|
||||
typedef atomic< wchar_t > atomic_wchar_t;
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
typedef atomic< char16_t > atomic_char16_t;
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_CHAR32_T)
|
||||
typedef atomic< char32_t > atomic_char32_t;
|
||||
#endif
|
||||
|
||||
typedef atomic< int_least8_t > atomic_int_least8_t;
|
||||
typedef atomic< uint_least8_t > atomic_uint_least8_t;
|
||||
typedef atomic< int_least16_t > atomic_int_least16_t;
|
||||
typedef atomic< uint_least16_t > atomic_uint_least16_t;
|
||||
typedef atomic< int_least32_t > atomic_int_least32_t;
|
||||
typedef atomic< uint_least32_t > atomic_uint_least32_t;
|
||||
typedef atomic< int_least64_t > atomic_int_least64_t;
|
||||
typedef atomic< uint_least64_t > atomic_uint_least64_t;
|
||||
typedef atomic< int_fast8_t > atomic_int_fast8_t;
|
||||
typedef atomic< uint_fast8_t > atomic_uint_fast8_t;
|
||||
typedef atomic< int_fast16_t > atomic_int_fast16_t;
|
||||
typedef atomic< uint_fast16_t > atomic_uint_fast16_t;
|
||||
typedef atomic< int_fast32_t > atomic_int_fast32_t;
|
||||
typedef atomic< uint_fast32_t > atomic_uint_fast32_t;
|
||||
typedef atomic< int_fast64_t > atomic_int_fast64_t;
|
||||
typedef atomic< uint_fast64_t > atomic_uint_fast64_t;
|
||||
typedef atomic< intmax_t > atomic_intmax_t;
|
||||
typedef atomic< uintmax_t > atomic_uintmax_t;
|
||||
|
||||
typedef atomic< std::size_t > atomic_size_t;
|
||||
typedef atomic< std::ptrdiff_t > atomic_ptrdiff_t;
|
||||
|
||||
#if defined(BOOST_HAS_INTPTR_T)
|
||||
typedef atomic< intptr_t > atomic_intptr_t;
|
||||
typedef atomic< uintptr_t > atomic_uintptr_t;
|
||||
#endif
|
||||
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_ATOMIC_TEMPLATE_HPP_INCLUDED_
|
53
boost/boost/atomic/detail/bitwise_cast.hpp
Normal file
53
boost/boost/atomic/detail/bitwise_cast.hpp
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2012 Tim Blechmann
|
||||
* Copyright (c) 2013 - 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/bitwise_cast.hpp
|
||||
*
|
||||
* This header defines \c bitwise_cast used to convert between storage and value types
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_BITWISE_CAST_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_BITWISE_CAST_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY)
|
||||
#include <cstring>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
template< typename To, typename From >
|
||||
BOOST_FORCEINLINE To bitwise_cast(From const& from) BOOST_NOEXCEPT
|
||||
{
|
||||
struct
|
||||
{
|
||||
To to;
|
||||
}
|
||||
value = {};
|
||||
BOOST_ATOMIC_DETAIL_MEMCPY
|
||||
(
|
||||
&reinterpret_cast< char& >(value.to),
|
||||
&reinterpret_cast< const char& >(from),
|
||||
(sizeof(From) < sizeof(To) ? sizeof(From) : sizeof(To))
|
||||
);
|
||||
return value.to;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_BITWISE_CAST_HPP_INCLUDED_
|
34
boost/boost/atomic/detail/caps_gcc_alpha.hpp
Normal file
34
boost/boost/atomic/detail/caps_gcc_alpha.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_gcc_alpha.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_ALPHA_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_ALPHA_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_ALPHA_HPP_INCLUDED_
|
56
boost/boost/atomic/detail/caps_gcc_arm.hpp
Normal file
56
boost/boost/atomic/detail/caps_gcc_arm.hpp
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2009 Phil Endecott
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* ARM Code by Phil Endecott, based on other architectures.
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_gcc_arm.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_ARM_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_ARM_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if !(defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__))
|
||||
// ARMv7 and later have dmb instruction
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_HAS_DMB 1
|
||||
#endif
|
||||
|
||||
#if !(defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6Z__))
|
||||
// ARMv6k and ARMv7 have 8 and 16 ldrex/strex variants
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXB_STREXB 1
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXH_STREXH 1
|
||||
#if !(((defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__)) && defined(__thumb__)) || defined(__ARM_ARCH_7M__))
|
||||
// ARMv6k and ARMv7 except ARMv7-M have 64-bit ldrex/strex variants.
|
||||
// Unfortunately, GCC (at least 4.7.3 on Ubuntu) does not allocate register pairs properly when targeting ARMv6k Thumb,
|
||||
// which is required for ldrexd/strexd instructions, so we disable 64-bit support. When targeting ARMv6k ARM
|
||||
// or ARMv7 (both ARM and Thumb 2) it works as expected.
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXD_STREXD 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#if defined(BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXD_STREXD)
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#endif
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_ARM_HPP_INCLUDED_
|
134
boost/boost/atomic/detail/caps_gcc_atomic.hpp
Normal file
134
boost/boost/atomic/detail/caps_gcc_atomic.hpp
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_gcc_atomic.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_ATOMIC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_ATOMIC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/int_sizes.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B 1
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B) && (defined(BOOST_HAS_INT128) || !defined(BOOST_NO_ALIGNMENT))
|
||||
#define BOOST_ATOMIC_INT128_LOCK_FREE 2
|
||||
#else
|
||||
#define BOOST_ATOMIC_INT128_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#if __GCC_ATOMIC_LLONG_LOCK_FREE == 2
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE 2
|
||||
#else
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE BOOST_ATOMIC_INT128_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#if __GCC_ATOMIC_LONG_LOCK_FREE == 2
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE 2
|
||||
#else
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE BOOST_ATOMIC_LLONG_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#if __GCC_ATOMIC_INT_LOCK_FREE == 2
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE 2
|
||||
#else
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE BOOST_ATOMIC_LONG_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#if __GCC_ATOMIC_SHORT_LOCK_FREE == 2
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE 2
|
||||
#else
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE BOOST_ATOMIC_INT_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#if __GCC_ATOMIC_CHAR_LOCK_FREE == 2
|
||||
#define BOOST_ATOMIC_CHAR_LOCK_FREE 2
|
||||
#else
|
||||
#define BOOST_ATOMIC_CHAR_LOCK_FREE BOOST_ATOMIC_SHORT_LOCK_FREE
|
||||
#endif
|
||||
|
||||
#if __GCC_ATOMIC_POINTER_LOCK_FREE == 2
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
#else
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE BOOST_ATOMIC_CHAR_LOCK_FREE
|
||||
|
||||
#if BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE BOOST_ATOMIC_SHORT_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_INT == 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE BOOST_ATOMIC_INT_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE BOOST_ATOMIC_LONG_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE BOOST_ATOMIC_LLONG_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 4
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE BOOST_ATOMIC_SHORT_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_INT == 4
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE BOOST_ATOMIC_INT_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 4
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE BOOST_ATOMIC_LONG_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 4
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE BOOST_ATOMIC_LLONG_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 8
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE BOOST_ATOMIC_SHORT_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_INT == 8
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE BOOST_ATOMIC_INT_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 8
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE BOOST_ATOMIC_LONG_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 8
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE BOOST_ATOMIC_LLONG_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
|
||||
#if __GCC_ATOMIC_WCHAR_T_LOCK_FREE == 2
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 8
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 4
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 2
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE
|
||||
#elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 1
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE
|
||||
#else
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE
|
||||
#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_ATOMIC_HPP_INCLUDED_
|
36
boost/boost/atomic/detail/caps_gcc_ppc.hpp
Normal file
36
boost/boost/atomic/detail/caps_gcc_ppc.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_gcc_ppc.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_PPC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_PPC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#if defined(__powerpc64__) || defined(__PPC64__)
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#endif
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_PPC_HPP_INCLUDED_
|
34
boost/boost/atomic/detail/caps_gcc_sparc.hpp
Normal file
34
boost/boost/atomic/detail/caps_gcc_sparc.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2010 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_gcc_sparc.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_SPARC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_SPARC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_SPARC_HPP_INCLUDED_
|
62
boost/boost/atomic/detail/caps_gcc_sync.hpp
Normal file
62
boost/boost/atomic/detail/caps_gcc_sync.hpp
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2011 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_gcc_sync.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_SYNC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_SYNC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B 1
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1
|
||||
#endif
|
||||
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#endif
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#endif
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#endif
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)\
|
||||
|| defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#endif
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
|
||||
#define BOOST_ATOMIC_INT128_LOCK_FREE 2
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_SYNC_HPP_INCLUDED_
|
75
boost/boost/atomic/detail/caps_gcc_x86.hpp
Normal file
75
boost/boost/atomic/detail/caps_gcc_x86.hpp
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2012 Tim Blechmann
|
||||
* Copyright (c) 2013 - 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_gcc_x86.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_X86_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_X86_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#if defined(__i386__) &&\
|
||||
(\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) ||\
|
||||
defined(__i586__) || defined(__i686__) || defined(__pentium4__) || defined(__nocona__) || defined(__core2__) || defined(__corei7__) ||\
|
||||
defined(__k6__) || defined(__athlon__) || defined(__k8__) || defined(__amdfam10__) || defined(__bdver1__) || defined(__bdver2__) || defined(__bdver3__) || defined(__btver1__) || defined(__btver2__)\
|
||||
)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B 1
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(__SSE2__)
|
||||
// Use mfence only if SSE2 is available
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE 1
|
||||
#endif
|
||||
|
||||
#else // defined(__GNUC__)
|
||||
|
||||
#if defined(__i386__) && !defined(BOOST_ATOMIC_NO_CMPXCHG8B)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B 1
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) && !defined(BOOST_ATOMIC_NO_CMPXCHG16B)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_ATOMIC_NO_MFENCE)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE 1
|
||||
#endif
|
||||
|
||||
#endif // defined(__GNUC__)
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#if defined(__x86_64__) || defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#endif
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B) && (defined(BOOST_HAS_INT128) || !defined(BOOST_NO_ALIGNMENT))
|
||||
#define BOOST_ATOMIC_INT128_LOCK_FREE 2
|
||||
#endif
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_X86_HPP_INCLUDED_
|
35
boost/boost/atomic/detail/caps_linux_arm.hpp
Normal file
35
boost/boost/atomic/detail/caps_linux_arm.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009, 2011 Helge Bahmann
|
||||
* Copyright (c) 2009 Phil Endecott
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Linux-specific code by Phil Endecott
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_linux_arm.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_LINUX_ARM_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_LINUX_ARM_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_LINUX_ARM_HPP_INCLUDED_
|
34
boost/boost/atomic/detail/caps_msvc_arm.hpp
Normal file
34
boost/boost/atomic/detail/caps_msvc_arm.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2012 - 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_msvc_arm.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_MSVC_ARM_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_MSVC_ARM_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_MSVC_ARM_HPP_INCLUDED_
|
55
boost/boost/atomic/detail/caps_msvc_x86.hpp
Normal file
55
boost/boost/atomic/detail/caps_msvc_x86.hpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2012 - 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_msvc_x86.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_MSVC_X86_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_MSVC_X86_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(_M_IX86) && _M_IX86 >= 500
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B 1
|
||||
#endif
|
||||
|
||||
#if _MSC_VER >= 1500 && defined(_M_AMD64) && !defined(BOOST_ATOMIC_NO_CMPXCHG16B)
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2))
|
||||
// Use mfence only if SSE2 is available
|
||||
#define BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE 1
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
|
||||
#if defined(_M_AMD64) || defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B) && (defined(BOOST_HAS_INT128) || !defined(BOOST_NO_ALIGNMENT))
|
||||
#define BOOST_ATOMIC_INT128_LOCK_FREE 2
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_MSVC_X86_HPP_INCLUDED_
|
33
boost/boost/atomic/detail/caps_windows.hpp
Normal file
33
boost/boost/atomic/detail/caps_windows.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2012 - 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_windows.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_WINDOWS_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_WINDOWS_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_WINDOWS_HPP_INCLUDED_
|
76
boost/boost/atomic/detail/config.hpp
Normal file
76
boost/boost/atomic/detail/config.hpp
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2012 Hartmut Kaiser
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/config.hpp
|
||||
*
|
||||
* This header defines configuraion macros for Boost.Atomic
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(__has_builtin)
|
||||
#if __has_builtin(__builtin_memcpy)
|
||||
#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
|
||||
#endif
|
||||
#if __has_builtin(__builtin_memcmp)
|
||||
#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
|
||||
#endif
|
||||
#elif defined(BOOST_GCC)
|
||||
#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
|
||||
#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY)
|
||||
#define BOOST_ATOMIC_DETAIL_MEMCPY __builtin_memcpy
|
||||
#else
|
||||
#define BOOST_ATOMIC_DETAIL_MEMCPY std::memcpy
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP)
|
||||
#define BOOST_ATOMIC_DETAIL_MEMCMP __builtin_memcmp
|
||||
#else
|
||||
#define BOOST_ATOMIC_DETAIL_MEMCMP std::memcmp
|
||||
#endif
|
||||
|
||||
#if defined(__CUDACC__)
|
||||
// nvcc does not support alternatives in asm statement constraints
|
||||
#define BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES
|
||||
// nvcc does not support condition code register ("cc") clobber in asm statements
|
||||
#define BOOST_ATOMIC_DETAIL_NO_ASM_CLOBBER_CC
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CLOBBER_CC)
|
||||
#define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC "cc"
|
||||
#define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "cc",
|
||||
#else
|
||||
#define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
#define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA
|
||||
#endif
|
||||
|
||||
#if ((defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 403)) ||\
|
||||
defined(__SUNPRO_CC)
|
||||
// This macro indicates we're using older binutils that don't support implied zero displacements for memory opereands,
|
||||
// making code like this invalid:
|
||||
// movl 4+(%%edx), %%eax
|
||||
#define BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) || (defined(BOOST_GCC) && (BOOST_GCC+0) < 40500) || defined(__SUNPRO_CC)
|
||||
// This macro indicates that the compiler does not support allocating rax:rdx register pairs ("A") in asm blocks
|
||||
#define BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_
|
140
boost/boost/atomic/detail/int_sizes.hpp
Normal file
140
boost/boost/atomic/detail/int_sizes.hpp
Normal file
@ -0,0 +1,140 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/int_sizes.hpp
|
||||
*
|
||||
* This header defines macros for testing buitin integer type sizes
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_INT_SIZES_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_INT_SIZES_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// GCC and compatible compilers define internal macros with builtin type traits
|
||||
#if defined(__SIZEOF_SHORT__)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT __SIZEOF_SHORT__
|
||||
#endif
|
||||
#if defined(__SIZEOF_INT__)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_INT __SIZEOF_INT__
|
||||
#endif
|
||||
#if defined(__SIZEOF_LONG__)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LONG __SIZEOF_LONG__
|
||||
#endif
|
||||
#if defined(__SIZEOF_LONG_LONG__)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG __SIZEOF_LONG_LONG__
|
||||
#endif
|
||||
#if defined(__SIZEOF_WCHAR_T__)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T __SIZEOF_WCHAR_T__
|
||||
#endif
|
||||
#if defined(__SIZEOF_POINTER__)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_POINTER __SIZEOF_POINTER__
|
||||
#elif defined(_MSC_VER)
|
||||
#if defined(_M_AMD64) || defined(_M_IA64)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_POINTER 8
|
||||
#else
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_POINTER 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_SHORT) || !defined(BOOST_ATOMIC_DETAIL_SIZEOF_INT) ||\
|
||||
!defined(BOOST_ATOMIC_DETAIL_SIZEOF_LONG) || !defined(BOOST_ATOMIC_DETAIL_SIZEOF_LLONG)
|
||||
|
||||
// Try to deduce sizes from limits
|
||||
#include <limits.h>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#if (USHRT_MAX + 0) == 0xff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT 1
|
||||
#elif (USHRT_MAX + 0) == 0xffff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT 2
|
||||
#elif (USHRT_MAX + 0) == 0xffffffff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT 4
|
||||
#elif (USHRT_MAX + 0) == UINT64_C(0xffffffffffffffff)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_SHORT 8
|
||||
#endif
|
||||
|
||||
#if (UINT_MAX + 0) == 0xff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_INT 1
|
||||
#elif (UINT_MAX + 0) == 0xffff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_INT 2
|
||||
#elif (UINT_MAX + 0) == 0xffffffff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_INT 4
|
||||
#elif (UINT_MAX + 0) == UINT64_C(0xffffffffffffffff)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_INT 8
|
||||
#endif
|
||||
|
||||
#if (ULONG_MAX + 0) == 0xff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LONG 1
|
||||
#elif (ULONG_MAX + 0) == 0xffff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LONG 2
|
||||
#elif (ULONG_MAX + 0) == 0xffffffff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LONG 4
|
||||
#elif (ULONG_MAX + 0) == UINT64_C(0xffffffffffffffff)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LONG 8
|
||||
#endif
|
||||
|
||||
#if defined(__hpux) // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 8
|
||||
#else
|
||||
|
||||
// The list of the non-standard macros (the ones except ULLONG_MAX) is taken from cstdint.hpp
|
||||
#if defined(ULLONG_MAX)
|
||||
#define BOOST_ATOMIC_DETAIL_ULLONG_MAX ULLONG_MAX
|
||||
#elif defined(ULONG_LONG_MAX)
|
||||
#define BOOST_ATOMIC_DETAIL_ULLONG_MAX ULONG_LONG_MAX
|
||||
#elif defined(ULONGLONG_MAX)
|
||||
#define BOOST_ATOMIC_DETAIL_ULLONG_MAX ULONGLONG_MAX
|
||||
#elif defined(_LLONG_MAX) // strangely enough, this one seems to be holding the limit for the unsigned integer
|
||||
#define BOOST_ATOMIC_DETAIL_ULLONG_MAX _LLONG_MAX
|
||||
#endif
|
||||
|
||||
#if (BOOST_ATOMIC_DETAIL_ULLONG_MAX + 0) == 0xff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 1
|
||||
#elif (BOOST_ATOMIC_DETAIL_ULLONG_MAX + 0) == 0xffff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 2
|
||||
#elif (BOOST_ATOMIC_DETAIL_ULLONG_MAX + 0) == 0xffffffff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 4
|
||||
#elif (BOOST_ATOMIC_DETAIL_ULLONG_MAX + 0) == UINT64_C(0xffffffffffffffff)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_LLONG 8
|
||||
#endif
|
||||
|
||||
#endif // defined(__hpux)
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T)
|
||||
|
||||
#include <wchar.h>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && ( _MSC_VER <= 1310 || defined(UNDER_CE) && _MSC_VER <= 1500 )
|
||||
// MSVC 7.1 and MSVC 8 (arm) define WCHAR_MAX to a value not suitable for constant expressions
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 2
|
||||
#elif (WCHAR_MAX + 0) == 0xff || (WCHAR_MAX + 0) == 0x7f
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 1
|
||||
#elif (WCHAR_MAX + 0) == 0xffff || (WCHAR_MAX + 0) == 0x7fff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 2
|
||||
#elif (WCHAR_MAX + 0) == 0xffffffff || (WCHAR_MAX + 0) == 0x7fffffff
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 4
|
||||
#elif (WCHAR_MAX + 0) == UINT64_C(0xffffffffffffffff) || (WCHAR_MAX + 0) == INT64_C(0x7fffffffffffffff)
|
||||
#define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_SIZEOF_SHORT) || !defined(BOOST_ATOMIC_DETAIL_SIZEOF_INT) ||\
|
||||
!defined(BOOST_ATOMIC_DETAIL_SIZEOF_LONG) || !defined(BOOST_ATOMIC_DETAIL_SIZEOF_LLONG) ||\
|
||||
!defined(BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T)
|
||||
#error Boost.Atomic: Failed to determine builtin integer sizes, the target platform is not supported. Please, report to the developers.
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_INT_SIZES_HPP_INCLUDED_
|
481
boost/boost/atomic/detail/interlocked.hpp
Normal file
481
boost/boost/atomic/detail/interlocked.hpp
Normal file
@ -0,0 +1,481 @@
|
||||
#ifndef BOOST_ATOMIC_DETAIL_INTERLOCKED_HPP
|
||||
#define BOOST_ATOMIC_DETAIL_INTERLOCKED_HPP
|
||||
|
||||
// Copyright (c) 2009 Helge Bahmann
|
||||
// Copyright (c) 2012 - 2014 Andrey Semashev
|
||||
//
|
||||
// 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 <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
|
||||
#if _WIN32_WCE >= 0x600
|
||||
|
||||
extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
|
||||
extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
|
||||
extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) _InterlockedCompareExchange((long*)(dest), exchange, compare)
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) _InterlockedExchangeAdd((long*)(dest), (long)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) _InterlockedExchange((long*)(dest), (long)(newval))
|
||||
|
||||
#else // _WIN32_WCE >= 0x600
|
||||
|
||||
extern "C" long __cdecl InterlockedCompareExchange( long*, long, long );
|
||||
extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
|
||||
extern "C" long __cdecl InterlockedExchange( long*, long );
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) InterlockedCompareExchange((long*)(dest), exchange, compare)
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) InterlockedExchangeAdd((long*)(dest), (long)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) InterlockedExchange((long*)(dest), (long)(newval))
|
||||
|
||||
#endif // _WIN32_WCE >= 0x600
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest), (long)(exchange), (long)(compare)))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, exchange) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE((long*)(dest), (long)(exchange)))
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1310
|
||||
|
||||
#if _MSC_VER < 1400
|
||||
|
||||
extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
|
||||
extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
|
||||
extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedCompareExchange)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd)
|
||||
#pragma intrinsic(_InterlockedExchange)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) _InterlockedCompareExchange((long*)(dest), exchange, compare)
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) _InterlockedExchangeAdd((long*)(dest), (long)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) _InterlockedExchange((long*)(dest), (long)(newval))
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest), (long)(exchange), (long)(compare)))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, exchange) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE((long*)(dest), (long)(exchange)))
|
||||
|
||||
#else // _MSC_VER < 1400
|
||||
|
||||
#include <intrin.h>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedCompareExchange)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd)
|
||||
#pragma intrinsic(_InterlockedExchange)
|
||||
#pragma intrinsic(_InterlockedAnd)
|
||||
#pragma intrinsic(_InterlockedOr)
|
||||
#pragma intrinsic(_InterlockedXor)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) _InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) _InterlockedExchangeAdd((long*)(dest), (long)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) _InterlockedExchange((long*)(dest), (long)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND(dest, arg) _InterlockedAnd((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR(dest, arg) _InterlockedOr((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR(dest, arg) _InterlockedXor((long*)(dest), (long)(arg))
|
||||
|
||||
#if (defined(_M_IX86) && _M_IX86 >= 500) || defined(_M_AMD64) || defined(_M_IA64)
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedCompareExchange64)
|
||||
#endif
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) _InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare))
|
||||
#endif
|
||||
|
||||
#if _MSC_VER >= 1500 && defined(_M_AMD64)
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedCompareExchange128)
|
||||
#endif
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE128(dest, exchange, compare) _InterlockedCompareExchange128((__int64*)(dest), ((const __int64*)(&exchange))[1], ((const __int64*)(&exchange))[0], (__int64*)(compare))
|
||||
#endif
|
||||
|
||||
#if _MSC_VER >= 1600
|
||||
|
||||
// MSVC 2010 and later provide intrinsics for 8 and 16 bit integers.
|
||||
// Note that for each bit count these macros must be either all defined or all not defined.
|
||||
// Otherwise atomic<> operations will be implemented inconsistently.
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedCompareExchange8)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd8)
|
||||
#pragma intrinsic(_InterlockedExchange8)
|
||||
#pragma intrinsic(_InterlockedAnd8)
|
||||
#pragma intrinsic(_InterlockedOr8)
|
||||
#pragma intrinsic(_InterlockedXor8)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8(dest, exchange, compare) _InterlockedCompareExchange8((char*)(dest), (char)(exchange), (char)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8(dest, addend) _InterlockedExchangeAdd8((char*)(dest), (char)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(dest, newval) _InterlockedExchange8((char*)(dest), (char)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND8(dest, arg) _InterlockedAnd8((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR8(dest, arg) _InterlockedOr8((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR8(dest, arg) _InterlockedXor8((char*)(dest), (char)(arg))
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedCompareExchange16)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd16)
|
||||
#pragma intrinsic(_InterlockedExchange16)
|
||||
#pragma intrinsic(_InterlockedAnd16)
|
||||
#pragma intrinsic(_InterlockedOr16)
|
||||
#pragma intrinsic(_InterlockedXor16)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16(dest, exchange, compare) _InterlockedCompareExchange16((short*)(dest), (short)(exchange), (short)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16(dest, addend) _InterlockedExchangeAdd16((short*)(dest), (short)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(dest, newval) _InterlockedExchange16((short*)(dest), (short)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND16(dest, arg) _InterlockedAnd16((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR16(dest, arg) _InterlockedOr16((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR16(dest, arg) _InterlockedXor16((short*)(dest), (short)(arg))
|
||||
|
||||
#endif // _MSC_VER >= 1600
|
||||
|
||||
#if defined(_M_AMD64) || defined(_M_IA64)
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd64)
|
||||
#pragma intrinsic(_InterlockedExchange64)
|
||||
#pragma intrinsic(_InterlockedAnd64)
|
||||
#pragma intrinsic(_InterlockedOr64)
|
||||
#pragma intrinsic(_InterlockedXor64)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) _InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) _InterlockedExchange64((__int64*)(dest), (__int64)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND64(dest, arg) _InterlockedAnd64((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR64(dest, arg) _InterlockedOr64((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR64(dest, arg) _InterlockedXor64((__int64*)(dest), (__int64)(arg))
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedCompareExchangePointer)
|
||||
#pragma intrinsic(_InterlockedExchangePointer)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) _InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) _InterlockedExchangePointer((void**)(dest), (void*)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64((long*)(dest), byte_offset))
|
||||
|
||||
#elif defined(_M_IX86)
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)_InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare)))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)_InterlockedExchange((long*)(dest), (long)(newval)))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD((long*)(dest), byte_offset))
|
||||
|
||||
#endif
|
||||
|
||||
#if _MSC_VER >= 1700 && defined(_M_ARM)
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd64)
|
||||
#pragma intrinsic(_InterlockedExchange64)
|
||||
#pragma intrinsic(_InterlockedAnd64)
|
||||
#pragma intrinsic(_InterlockedOr64)
|
||||
#pragma intrinsic(_InterlockedXor64)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) _InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) _InterlockedExchange64((__int64*)(dest), (__int64)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND64(dest, arg) _InterlockedAnd64((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR64(dest, arg) _InterlockedOr64((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR64(dest, arg) _InterlockedXor64((__int64*)(dest), (__int64)(arg))
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedCompareExchange8_nf)
|
||||
#pragma intrinsic(_InterlockedCompareExchange8_acq)
|
||||
#pragma intrinsic(_InterlockedCompareExchange8_rel)
|
||||
#pragma intrinsic(_InterlockedCompareExchange16_nf)
|
||||
#pragma intrinsic(_InterlockedCompareExchange16_acq)
|
||||
#pragma intrinsic(_InterlockedCompareExchange16_rel)
|
||||
#pragma intrinsic(_InterlockedCompareExchange_nf)
|
||||
#pragma intrinsic(_InterlockedCompareExchange_acq)
|
||||
#pragma intrinsic(_InterlockedCompareExchange_rel)
|
||||
#pragma intrinsic(_InterlockedCompareExchange64)
|
||||
#pragma intrinsic(_InterlockedCompareExchange64_nf)
|
||||
#pragma intrinsic(_InterlockedCompareExchange64_acq)
|
||||
#pragma intrinsic(_InterlockedCompareExchange64_rel)
|
||||
#pragma intrinsic(_InterlockedCompareExchangePointer)
|
||||
#pragma intrinsic(_InterlockedCompareExchangePointer_nf)
|
||||
#pragma intrinsic(_InterlockedCompareExchangePointer_acq)
|
||||
#pragma intrinsic(_InterlockedCompareExchangePointer_rel)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8_RELAXED(dest, exchange, compare) _InterlockedCompareExchange8_nf((char*)(dest), (char)(exchange), (char)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8_ACQUIRE(dest, exchange, compare) _InterlockedCompareExchange8_acq((char*)(dest), (char)(exchange), (char)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8_RELEASE(dest, exchange, compare) _InterlockedCompareExchange8_rel((char*)(dest), (char)(exchange), (char)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16_RELAXED(dest, exchange, compare) _InterlockedCompareExchange16_nf((short*)(dest), (short)(exchange), (short)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16_ACQUIRE(dest, exchange, compare) _InterlockedCompareExchange16_acq((short*)(dest), (short)(exchange), (short)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16_RELEASE(dest, exchange, compare) _InterlockedCompareExchange16_rel((short*)(dest), (short)(exchange), (short)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_RELAXED(dest, exchange, compare) _InterlockedCompareExchange_nf((long*)(dest), (long)(exchange), (long)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_ACQUIRE(dest, exchange, compare) _InterlockedCompareExchange_acq((long*)(dest), (long)(exchange), (long)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_RELEASE(dest, exchange, compare) _InterlockedCompareExchange_rel((long*)(dest), (long)(exchange), (long)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) _InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64_RELAXED(dest, exchange, compare) _InterlockedCompareExchange64_nf((__int64*)(dest), (__int64)(exchange), (__int64)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64_ACQUIRE(dest, exchange, compare) _InterlockedCompareExchange64_acq((__int64*)(dest), (__int64)(exchange), (__int64)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64_RELEASE(dest, exchange, compare) _InterlockedCompareExchange64_rel((__int64*)(dest), (__int64)(exchange), (__int64)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) _InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER_RELAXED(dest, exchange, compare) _InterlockedCompareExchangePointer_nf((void**)(dest), (void*)(exchange), (void*)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER_ACQUIRE(dest, exchange, compare) _InterlockedCompareExchangePointer_acq((void**)(dest), (void*)(exchange), (void*)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER_RELEASE(dest, exchange, compare) _InterlockedCompareExchangePointer_rel((void**)(dest), (void*)(exchange), (void*)(compare))
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd8_nf)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd8_acq)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd8_rel)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd16_nf)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd16_acq)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd16_rel)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd_nf)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd_acq)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd_rel)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd64_nf)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd64_acq)
|
||||
#pragma intrinsic(_InterlockedExchangeAdd64_rel)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8_RELAXED(dest, addend) _InterlockedExchangeAdd8_nf((char*)(dest), (char)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8_ACQUIRE(dest, addend) _InterlockedExchangeAdd8_acq((char*)(dest), (char)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8_RELEASE(dest, addend) _InterlockedExchangeAdd8_rel((char*)(dest), (char)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16_RELAXED(dest, addend) _InterlockedExchangeAdd16_nf((short*)(dest), (short)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16_ACQUIRE(dest, addend) _InterlockedExchangeAdd16_acq((short*)(dest), (short)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16_RELEASE(dest, addend) _InterlockedExchangeAdd16_rel((short*)(dest), (short)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_RELAXED(dest, addend) _InterlockedExchangeAdd_nf((long*)(dest), (long)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_ACQUIRE(dest, addend) _InterlockedExchangeAdd_acq((long*)(dest), (long)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_RELEASE(dest, addend) _InterlockedExchangeAdd_rel((long*)(dest), (long)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_RELAXED(dest, addend) _InterlockedExchangeAdd64_nf((__int64*)(dest), (__int64)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_ACQUIRE(dest, addend) _InterlockedExchangeAdd64_acq((__int64*)(dest), (__int64)(addend))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_RELEASE(dest, addend) _InterlockedExchangeAdd64_rel((__int64*)(dest), (__int64)(addend))
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD((long*)(dest), byte_offset))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER_RELAXED(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_RELAXED((long*)(dest), byte_offset))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER_ACQUIRE(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_ACQUIRE((long*)(dest), byte_offset))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER_RELEASE(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_RELEASE((long*)(dest), byte_offset))
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedExchange8_nf)
|
||||
#pragma intrinsic(_InterlockedExchange8_acq)
|
||||
#pragma intrinsic(_InterlockedExchange16_nf)
|
||||
#pragma intrinsic(_InterlockedExchange16_acq)
|
||||
#pragma intrinsic(_InterlockedExchange_nf)
|
||||
#pragma intrinsic(_InterlockedExchange_acq)
|
||||
#pragma intrinsic(_InterlockedExchange64_nf)
|
||||
#pragma intrinsic(_InterlockedExchange64_acq)
|
||||
#pragma intrinsic(_InterlockedExchangePointer)
|
||||
#pragma intrinsic(_InterlockedExchangePointer_nf)
|
||||
#pragma intrinsic(_InterlockedExchangePointer_acq)
|
||||
#if _MSC_VER >= 1800
|
||||
#pragma intrinsic(_InterlockedExchange8_rel)
|
||||
#pragma intrinsic(_InterlockedExchange16_rel)
|
||||
#pragma intrinsic(_InterlockedExchange_rel)
|
||||
#pragma intrinsic(_InterlockedExchange64_rel)
|
||||
#pragma intrinsic(_InterlockedExchangePointer_rel)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE8_RELAXED(dest, newval) _InterlockedExchange8_nf((char*)(dest), (char)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE8_ACQUIRE(dest, newval) _InterlockedExchange8_acq((char*)(dest), (char)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE16_RELAXED(dest, newval) _InterlockedExchange16_nf((short*)(dest), (short)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE16_ACQUIRE(dest, newval) _InterlockedExchange16_acq((short*)(dest), (short)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_RELAXED(dest, newval) _InterlockedExchange_nf((long*)(dest), (long)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ACQUIRE(dest, newval) _InterlockedExchange_acq((long*)(dest), (long)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64_RELAXED(dest, newval) _InterlockedExchange64_nf((__int64*)(dest), (__int64)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64_ACQUIRE(dest, newval) _InterlockedExchange64_acq((__int64*)(dest), (__int64)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) _InterlockedExchangePointer((void**)(dest), (void*)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER_RELAXED(dest, newval) _InterlockedExchangePointer_nf((void**)(dest), (void*)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER_ACQUIRE(dest, newval) _InterlockedExchangePointer_acq((void**)(dest), (void*)(newval))
|
||||
|
||||
#if _MSC_VER >= 1800
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE8_RELEASE(dest, newval) _InterlockedExchange8_rel((char*)(dest), (char)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE16_RELEASE(dest, newval) _InterlockedExchange16_rel((short*)(dest), (short)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_RELEASE(dest, newval) _InterlockedExchange_rel((long*)(dest), (long)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64_RELEASE(dest, newval) _InterlockedExchange64_rel((__int64*)(dest), (__int64)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER_RELEASE(dest, newval) _InterlockedExchangePointer_rel((void**)(dest), (void*)(newval))
|
||||
#else
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE8_RELEASE(dest, newval) BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(dest, newval)
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE16_RELEASE(dest, newval) BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(dest, newval)
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_RELEASE(dest, newval) BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval)
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64_RELEASE(dest, newval) BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval)
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER_RELEASE(dest, newval) BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval)
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedAnd8_nf)
|
||||
#pragma intrinsic(_InterlockedAnd8_acq)
|
||||
#pragma intrinsic(_InterlockedAnd8_rel)
|
||||
#pragma intrinsic(_InterlockedAnd16_nf)
|
||||
#pragma intrinsic(_InterlockedAnd16_acq)
|
||||
#pragma intrinsic(_InterlockedAnd16_rel)
|
||||
#pragma intrinsic(_InterlockedAnd_nf)
|
||||
#pragma intrinsic(_InterlockedAnd_acq)
|
||||
#pragma intrinsic(_InterlockedAnd_rel)
|
||||
#pragma intrinsic(_InterlockedAnd64_nf)
|
||||
#pragma intrinsic(_InterlockedAnd64_acq)
|
||||
#pragma intrinsic(_InterlockedAnd64_rel)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND8_RELAXED(dest, arg) _InterlockedAnd8_nf((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND8_ACQUIRE(dest, arg) _InterlockedAnd8_acq((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND8_RELEASE(dest, arg) _InterlockedAnd8_rel((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND16_RELAXED(dest, arg) _InterlockedAnd16_nf((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND16_ACQUIRE(dest, arg) _InterlockedAnd16_acq((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND16_RELEASE(dest, arg) _InterlockedAnd16_rel((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND_RELAXED(dest, arg) _InterlockedAnd_nf((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND_ACQUIRE(dest, arg) _InterlockedAnd_acq((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND_RELEASE(dest, arg) _InterlockedAnd_rel((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND64_RELAXED(dest, arg) _InterlockedAnd64_nf((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND64_ACQUIRE(dest, arg) _InterlockedAnd64_acq((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_AND64_RELEASE(dest, arg) _InterlockedAnd64_rel((__int64*)(dest), (__int64)(arg))
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedOr8_nf)
|
||||
#pragma intrinsic(_InterlockedOr8_acq)
|
||||
#pragma intrinsic(_InterlockedOr8_rel)
|
||||
#pragma intrinsic(_InterlockedOr16_nf)
|
||||
#pragma intrinsic(_InterlockedOr16_acq)
|
||||
#pragma intrinsic(_InterlockedOr16_rel)
|
||||
#pragma intrinsic(_InterlockedOr_nf)
|
||||
#pragma intrinsic(_InterlockedOr_acq)
|
||||
#pragma intrinsic(_InterlockedOr_rel)
|
||||
#pragma intrinsic(_InterlockedOr64_nf)
|
||||
#pragma intrinsic(_InterlockedOr64_acq)
|
||||
#pragma intrinsic(_InterlockedOr64_rel)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR8_RELAXED(dest, arg) _InterlockedOr8_nf((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR8_ACQUIRE(dest, arg) _InterlockedOr8_acq((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR8_RELEASE(dest, arg) _InterlockedOr8_rel((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR16_RELAXED(dest, arg) _InterlockedOr16_nf((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR16_ACQUIRE(dest, arg) _InterlockedOr16_acq((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR16_RELEASE(dest, arg) _InterlockedOr16_rel((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR_RELAXED(dest, arg) _InterlockedOr_nf((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR_ACQUIRE(dest, arg) _InterlockedOr_acq((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR_RELEASE(dest, arg) _InterlockedOr_rel((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR64_RELAXED(dest, arg) _InterlockedOr64_nf((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR64_ACQUIRE(dest, arg) _InterlockedOr64_acq((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_OR64_RELEASE(dest, arg) _InterlockedOr64_rel((__int64*)(dest), (__int64)(arg))
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_InterlockedXor8_nf)
|
||||
#pragma intrinsic(_InterlockedXor8_acq)
|
||||
#pragma intrinsic(_InterlockedXor8_rel)
|
||||
#pragma intrinsic(_InterlockedXor16_nf)
|
||||
#pragma intrinsic(_InterlockedXor16_acq)
|
||||
#pragma intrinsic(_InterlockedXor16_rel)
|
||||
#pragma intrinsic(_InterlockedXor_nf)
|
||||
#pragma intrinsic(_InterlockedXor_acq)
|
||||
#pragma intrinsic(_InterlockedXor_rel)
|
||||
#pragma intrinsic(_InterlockedXor64_nf)
|
||||
#pragma intrinsic(_InterlockedXor64_acq)
|
||||
#pragma intrinsic(_InterlockedXor64_rel)
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR8_RELAXED(dest, arg) _InterlockedXor8_nf((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR8_ACQUIRE(dest, arg) _InterlockedXor8_acq((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR8_RELEASE(dest, arg) _InterlockedXor8_rel((char*)(dest), (char)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR16_RELAXED(dest, arg) _InterlockedXor16_nf((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR16_ACQUIRE(dest, arg) _InterlockedXor16_acq((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR16_RELEASE(dest, arg) _InterlockedXor16_rel((short*)(dest), (short)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR_RELAXED(dest, arg) _InterlockedXor_nf((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR_ACQUIRE(dest, arg) _InterlockedXor_acq((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR_RELEASE(dest, arg) _InterlockedXor_rel((long*)(dest), (long)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR64_RELAXED(dest, arg) _InterlockedXor64_nf((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR64_ACQUIRE(dest, arg) _InterlockedXor64_acq((__int64*)(dest), (__int64)(arg))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_XOR64_RELEASE(dest, arg) _InterlockedXor64_rel((__int64*)(dest), (__int64)(arg))
|
||||
|
||||
#endif // _MSC_VER >= 1700 && defined(_M_ARM)
|
||||
|
||||
#endif // _MSC_VER < 1400
|
||||
|
||||
#else // defined(_MSC_VER) && _MSC_VER >= 1310
|
||||
|
||||
#if defined(BOOST_USE_WINDOWS_H)
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) InterlockedExchange((long*)(dest), (long)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) InterlockedExchangeAdd((long*)(dest), (long)(addend))
|
||||
|
||||
#if defined(_WIN64)
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) InterlockedExchange64((__int64*)(dest), (__int64)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend))
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) InterlockedExchangePointer((void**)(dest), (void*)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, byte_offset))
|
||||
|
||||
#else // defined(_WIN64)
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, byte_offset))
|
||||
|
||||
#endif // defined(_WIN64)
|
||||
|
||||
#else // defined(BOOST_USE_WINDOWS_H)
|
||||
|
||||
#if defined(__MINGW64__)
|
||||
#define BOOST_ATOMIC_INTERLOCKED_IMPORT
|
||||
#else
|
||||
#define BOOST_ATOMIC_INTERLOCKED_IMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
extern "C" {
|
||||
|
||||
BOOST_ATOMIC_INTERLOCKED_IMPORT long __stdcall InterlockedCompareExchange(long volatile*, long, long);
|
||||
BOOST_ATOMIC_INTERLOCKED_IMPORT long __stdcall InterlockedExchange(long volatile*, long);
|
||||
BOOST_ATOMIC_INTERLOCKED_IMPORT long __stdcall InterlockedExchangeAdd(long volatile*, long);
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) boost::atomics::detail::InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) boost::atomics::detail::InterlockedExchange((long*)(dest), (long)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) boost::atomics::detail::InterlockedExchangeAdd((long*)(dest), (long)(addend))
|
||||
|
||||
#if defined(_WIN64)
|
||||
|
||||
BOOST_ATOMIC_INTERLOCKED_IMPORT __int64 __stdcall InterlockedCompareExchange64(__int64 volatile*, __int64, __int64);
|
||||
BOOST_ATOMIC_INTERLOCKED_IMPORT __int64 __stdcall InterlockedExchange64(__int64 volatile*, __int64);
|
||||
BOOST_ATOMIC_INTERLOCKED_IMPORT __int64 __stdcall InterlockedExchangeAdd64(__int64 volatile*, __int64);
|
||||
|
||||
BOOST_ATOMIC_INTERLOCKED_IMPORT void* __stdcall InterlockedCompareExchangePointer(void* volatile *, void*, void*);
|
||||
BOOST_ATOMIC_INTERLOCKED_IMPORT void* __stdcall InterlockedExchangePointer(void* volatile *, void*);
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(dest, exchange, compare) boost::atomics::detail::InterlockedCompareExchange64((__int64*)(dest), (__int64)(exchange), (__int64)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(dest, newval) boost::atomics::detail::InterlockedExchange64((__int64*)(dest), (__int64)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, addend) boost::atomics::detail::InterlockedExchangeAdd64((__int64*)(dest), (__int64)(addend))
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) boost::atomics::detail::InterlockedCompareExchangePointer((void**)(dest), (void*)(exchange), (void*)(compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) boost::atomics::detail::InterlockedExchangePointer((void**)(dest), (void*)(newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(dest, byte_offset))
|
||||
|
||||
#else // defined(_WIN64)
|
||||
|
||||
#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval))
|
||||
#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, byte_offset))
|
||||
|
||||
#endif // defined(_WIN64)
|
||||
|
||||
} // extern "C"
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_ATOMIC_INTERLOCKED_IMPORT
|
||||
|
||||
#endif // defined(BOOST_USE_WINDOWS_H)
|
||||
|
||||
#endif // defined(_MSC_VER)
|
||||
|
||||
#endif
|
58
boost/boost/atomic/detail/link.hpp
Normal file
58
boost/boost/atomic/detail/link.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2012 Hartmut Kaiser
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/config.hpp
|
||||
*
|
||||
* This header defines macros for linking with compiled library of Boost.Atomic
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_LINK_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_LINK_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Set up dll import/export options
|
||||
#if (defined(BOOST_ATOMIC_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && \
|
||||
!defined(BOOST_ATOMIC_STATIC_LINK)
|
||||
|
||||
#if defined(BOOST_ATOMIC_SOURCE)
|
||||
#define BOOST_ATOMIC_DECL BOOST_SYMBOL_EXPORT
|
||||
#define BOOST_ATOMIC_BUILD_DLL
|
||||
#else
|
||||
#define BOOST_ATOMIC_DECL BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // building a shared library
|
||||
|
||||
#ifndef BOOST_ATOMIC_DECL
|
||||
#define BOOST_ATOMIC_DECL
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Auto library naming
|
||||
#if !defined(BOOST_ATOMIC_SOURCE) && !defined(BOOST_ALL_NO_LIB) && \
|
||||
!defined(BOOST_ATOMIC_NO_LIB)
|
||||
|
||||
#define BOOST_LIB_NAME boost_atomic
|
||||
|
||||
// tell the auto-link code to select a dll when required:
|
||||
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_ATOMIC_DYN_LINK)
|
||||
#define BOOST_DYN_LINK
|
||||
#endif
|
||||
|
||||
#include <boost/config/auto_link.hpp>
|
||||
|
||||
#endif // auto-linking disabled
|
||||
|
||||
#endif
|
51
boost/boost/atomic/detail/lockpool.hpp
Normal file
51
boost/boost/atomic/detail/lockpool.hpp
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2011 Helge Bahmann
|
||||
* Copyright (c) 2013-2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/lockpool.hpp
|
||||
*
|
||||
* This header contains declaration of the lockpool used to emulate atomic ops.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/link.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
struct lockpool
|
||||
{
|
||||
class scoped_lock
|
||||
{
|
||||
void* m_lock;
|
||||
|
||||
public:
|
||||
explicit BOOST_ATOMIC_DECL scoped_lock(const volatile void* addr) BOOST_NOEXCEPT;
|
||||
BOOST_ATOMIC_DECL ~scoped_lock() BOOST_NOEXCEPT;
|
||||
|
||||
BOOST_DELETED_FUNCTION(scoped_lock(scoped_lock const&))
|
||||
BOOST_DELETED_FUNCTION(scoped_lock& operator=(scoped_lock const&))
|
||||
};
|
||||
|
||||
static BOOST_ATOMIC_DECL void thread_fence() BOOST_NOEXCEPT;
|
||||
static BOOST_ATOMIC_DECL void signal_fence() BOOST_NOEXCEPT;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_LOCKPOOL_HPP_INCLUDED_
|
24
boost/boost/atomic/detail/operations.hpp
Normal file
24
boost/boost/atomic/detail/operations.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/operations.hpp
|
||||
*
|
||||
* This header defines atomic operations, including the emulated version.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPERATIONS_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPERATIONS_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/operations_lockfree.hpp>
|
||||
#include <boost/atomic/detail/ops_emulated.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPERATIONS_HPP_INCLUDED_
|
35
boost/boost/atomic/detail/operations_fwd.hpp
Normal file
35
boost/boost/atomic/detail/operations_fwd.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/operations_fwd.hpp
|
||||
*
|
||||
* This header contains forward declaration of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPERATIONS_FWD_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPERATIONS_FWD_HPP_INCLUDED_
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
template< std::size_t Size, bool Signed >
|
||||
struct operations;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPERATIONS_FWD_HPP_INCLUDED_
|
30
boost/boost/atomic/detail/operations_lockfree.hpp
Normal file
30
boost/boost/atomic/detail/operations_lockfree.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/operations_lockfree.hpp
|
||||
*
|
||||
* This header defines lockfree atomic operations.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPERATIONS_LOCKFREE_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPERATIONS_LOCKFREE_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/platform.hpp>
|
||||
|
||||
#if !defined(BOOST_ATOMIC_EMULATED)
|
||||
#include BOOST_ATOMIC_DETAIL_HEADER(boost/atomic/detail/ops_)
|
||||
#else
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPERATIONS_LOCKFREE_HPP_INCLUDED_
|
105
boost/boost/atomic/detail/ops_cas_based.hpp
Normal file
105
boost/boost/atomic/detail/ops_cas_based.hpp
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_cas_based.hpp
|
||||
*
|
||||
* This header contains CAS-based implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_CAS_BASED_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_CAS_BASED_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
template< typename Base >
|
||||
struct cas_based_exchange :
|
||||
public Base
|
||||
{
|
||||
typedef typename Base::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type old_val;
|
||||
atomics::detail::non_atomic_load(storage, old_val);
|
||||
while (!Base::compare_exchange_weak(storage, old_val, v, order, memory_order_relaxed)) {}
|
||||
return old_val;
|
||||
}
|
||||
};
|
||||
|
||||
template< typename Base >
|
||||
struct cas_based_operations :
|
||||
public Base
|
||||
{
|
||||
typedef typename Base::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type old_val;
|
||||
atomics::detail::non_atomic_load(storage, old_val);
|
||||
while (!Base::compare_exchange_weak(storage, old_val, old_val + v, order, memory_order_relaxed)) {}
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type old_val;
|
||||
atomics::detail::non_atomic_load(storage, old_val);
|
||||
while (!Base::compare_exchange_weak(storage, old_val, old_val - v, order, memory_order_relaxed)) {}
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type old_val;
|
||||
atomics::detail::non_atomic_load(storage, old_val);
|
||||
while (!Base::compare_exchange_weak(storage, old_val, old_val & v, order, memory_order_relaxed)) {}
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type old_val;
|
||||
atomics::detail::non_atomic_load(storage, old_val);
|
||||
while (!Base::compare_exchange_weak(storage, old_val, old_val | v, order, memory_order_relaxed)) {}
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type old_val;
|
||||
atomics::detail::non_atomic_load(storage, old_val);
|
||||
while (!Base::compare_exchange_weak(storage, old_val, old_val ^ v, order, memory_order_relaxed)) {}
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!Base::exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
Base::store(storage, (storage_type)0, order);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_CAS_BASED_HPP_INCLUDED_
|
163
boost/boost/atomic/detail/ops_emulated.hpp
Normal file
163
boost/boost/atomic/detail/ops_emulated.hpp
Normal file
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_emulated.hpp
|
||||
*
|
||||
* This header contains lockpool-based implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_EMULATED_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_EMULATED_HPP_INCLUDED_
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/detail/lockpool.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
template< typename T >
|
||||
struct emulated_operations
|
||||
{
|
||||
typedef T storage_type;
|
||||
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = false;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
const_cast< storage_type& >(storage) = v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
return const_cast< storage_type const& >(storage);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type& s = const_cast< storage_type& >(storage);
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
storage_type old_val = s;
|
||||
s += v;
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type& s = const_cast< storage_type& >(storage);
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
storage_type old_val = s;
|
||||
s -= v;
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type& s = const_cast< storage_type& >(storage);
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
storage_type old_val = s;
|
||||
s = v;
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type& s = const_cast< storage_type& >(storage);
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
storage_type old_val = s;
|
||||
const bool res = old_val == expected;
|
||||
if (res)
|
||||
s = desired;
|
||||
expected = old_val;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
// Note: This function is the exact copy of compare_exchange_strong. The reason we're not just forwarding the call
|
||||
// is that MSVC-12 ICEs in this case.
|
||||
storage_type& s = const_cast< storage_type& >(storage);
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
storage_type old_val = s;
|
||||
const bool res = old_val == expected;
|
||||
if (res)
|
||||
s = desired;
|
||||
expected = old_val;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type& s = const_cast< storage_type& >(storage);
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
storage_type old_val = s;
|
||||
s &= v;
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type& s = const_cast< storage_type& >(storage);
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
storage_type old_val = s;
|
||||
s |= v;
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type& s = const_cast< storage_type& >(storage);
|
||||
lockpool::scoped_lock lock(&storage);
|
||||
storage_type old_val = s;
|
||||
s ^= v;
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, (storage_type)0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template< std::size_t Size, bool Signed >
|
||||
struct operations :
|
||||
public emulated_operations< typename make_storage_type< Size, Signed >::type >
|
||||
{
|
||||
typedef typename make_storage_type< Size, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_EMULATED_HPP_INCLUDED_
|
68
boost/boost/atomic/detail/ops_extending_cas_based.hpp
Normal file
68
boost/boost/atomic/detail/ops_extending_cas_based.hpp
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_extending_cas_based.hpp
|
||||
*
|
||||
* This header contains a boilerplate of the \c operations template implementation that requires sign/zero extension in arithmetic operations.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_EXTENDING_CAS_BASED_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_EXTENDING_CAS_BASED_HPP_INCLUDED_
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
template< typename Base, std::size_t Size, bool Signed >
|
||||
struct extending_cas_based_operations :
|
||||
public Base
|
||||
{
|
||||
typedef typename Base::storage_type storage_type;
|
||||
typedef typename make_storage_type< Size, Signed >::type emulated_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type old_val;
|
||||
atomics::detail::non_atomic_load(storage, old_val);
|
||||
emulated_storage_type new_val;
|
||||
do
|
||||
{
|
||||
new_val = static_cast< emulated_storage_type >(old_val) + static_cast< emulated_storage_type >(v);
|
||||
}
|
||||
while (!Base::compare_exchange_weak(storage, old_val, static_cast< storage_type >(new_val), order, memory_order_relaxed));
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type old_val;
|
||||
atomics::detail::non_atomic_load(storage, old_val);
|
||||
emulated_storage_type new_val;
|
||||
do
|
||||
{
|
||||
new_val = static_cast< emulated_storage_type >(old_val) - static_cast< emulated_storage_type >(v);
|
||||
}
|
||||
while (!Base::compare_exchange_weak(storage, old_val, static_cast< storage_type >(new_val), order, memory_order_relaxed));
|
||||
return old_val;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_EXTENDING_CAS_BASED_HPP_INCLUDED_
|
878
boost/boost/atomic/detail/ops_gcc_alpha.hpp
Normal file
878
boost/boost/atomic/detail/ops_gcc_alpha.hpp
Normal file
@ -0,0 +1,878 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_gcc_alpha.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_ALPHA_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_GCC_ALPHA_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
/*
|
||||
Refer to http://h71000.www7.hp.com/doc/82final/5601/5601pro_004.html
|
||||
(HP OpenVMS systems documentation) and the Alpha Architecture Reference Manual.
|
||||
*/
|
||||
|
||||
/*
|
||||
NB: The most natural thing would be to write the increment/decrement
|
||||
operators along the following lines:
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1: ldl_l %0,%1 \n"
|
||||
"addl %0,1,%0 \n"
|
||||
"stl_c %0,%1 \n"
|
||||
"beq %0,1b\n"
|
||||
: "=&b" (tmp)
|
||||
: "m" (value)
|
||||
: "cc"
|
||||
);
|
||||
|
||||
However according to the comments on the HP website and matching
|
||||
comments in the Linux kernel sources this defies branch prediction,
|
||||
as the cpu assumes that backward branches are always taken; so
|
||||
instead copy the trick from the Linux kernel, introduce a forward
|
||||
branch and back again.
|
||||
|
||||
I have, however, had a hard time measuring the difference between
|
||||
the two versions in microbenchmarks -- I am leaving it in nevertheless
|
||||
as it apparently does not hurt either.
|
||||
*/
|
||||
|
||||
struct gcc_alpha_operations_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & memory_order_release) != 0)
|
||||
__asm__ __volatile__ ("mb" ::: "memory");
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & (memory_order_consume | memory_order_acquire)) != 0)
|
||||
__asm__ __volatile__ ("mb" ::: "memory");
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
__asm__ __volatile__ ("mb" ::: "memory");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public gcc_alpha_operations_base
|
||||
{
|
||||
typedef typename make_storage_type< 4u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage = v;
|
||||
fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = storage;
|
||||
fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"mov %3, %1\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (tmp) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
int success;
|
||||
storage_type current;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %2, %4\n" // current = *(&storage)
|
||||
"cmpeq %2, %0, %3\n" // success = current == expected
|
||||
"mov %2, %0\n" // expected = current
|
||||
"beq %3, 2f\n" // if (success == 0) goto end
|
||||
"stl_c %1, %4\n" // storage = desired; desired = store succeeded
|
||||
"mov %1, %3\n" // success = desired
|
||||
"2:\n"
|
||||
: "+&r" (expected), // %0
|
||||
"+&r" (desired), // %1
|
||||
"=&r" (current), // %2
|
||||
"=&r" (success) // %3
|
||||
: "m" (storage) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
int success;
|
||||
storage_type current, tmp;
|
||||
fence_before(success_order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"mov %5, %1\n" // tmp = desired
|
||||
"ldl_l %2, %4\n" // current = *(&storage)
|
||||
"cmpeq %2, %0, %3\n" // success = current == expected
|
||||
"mov %2, %0\n" // expected = current
|
||||
"beq %3, 2f\n" // if (success == 0) goto end
|
||||
"stl_c %1, %4\n" // storage = tmp; tmp = store succeeded
|
||||
"beq %1, 3f\n" // if (tmp == 0) goto retry
|
||||
"mov %1, %3\n" // success = tmp
|
||||
"2:\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"3: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "+&r" (expected), // %0
|
||||
"=&r" (tmp), // %1
|
||||
"=&r" (current), // %2
|
||||
"=&r" (success) // %3
|
||||
: "m" (storage), // %4
|
||||
"r" (desired) // %5
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"addl %0, %3, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"subl %0, %3, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"and %0, %3, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"bis %0, %3, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"xor %0, %3, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, 0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< >
|
||||
struct operations< 1u, false > :
|
||||
public operations< 4u, false >
|
||||
{
|
||||
typedef operations< 4u, false > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"addl %0, %3, %1\n"
|
||||
"zapnot %1, #1, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"subl %0, %3, %1\n"
|
||||
"zapnot %1, #1, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct operations< 1u, true > :
|
||||
public operations< 4u, true >
|
||||
{
|
||||
typedef operations< 4u, true > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"addl %0, %3, %1\n"
|
||||
"sextb %1, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"subl %0, %3, %1\n"
|
||||
"sextb %1, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< >
|
||||
struct operations< 2u, false > :
|
||||
public operations< 4u, false >
|
||||
{
|
||||
typedef operations< 4u, false > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"addl %0, %3, %1\n"
|
||||
"zapnot %1, #3, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"subl %0, %3, %1\n"
|
||||
"zapnot %1, #3, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct operations< 2u, true > :
|
||||
public operations< 4u, true >
|
||||
{
|
||||
typedef operations< 4u, true > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"addl %0, %3, %1\n"
|
||||
"sextw %1, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldl_l %0, %2\n"
|
||||
"subl %0, %3, %1\n"
|
||||
"sextw %1, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public gcc_alpha_operations_base
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage = v;
|
||||
fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = storage;
|
||||
fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"mov %3, %1\n"
|
||||
"ldq_l %0, %2\n"
|
||||
"stq_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (tmp) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
int success;
|
||||
storage_type current;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldq_l %2, %4\n" // current = *(&storage)
|
||||
"cmpeq %2, %0, %3\n" // success = current == expected
|
||||
"mov %2, %0\n" // expected = current
|
||||
"beq %3, 2f\n" // if (success == 0) goto end
|
||||
"stq_c %1, %4\n" // storage = desired; desired = store succeeded
|
||||
"mov %1, %3\n" // success = desired
|
||||
"2:\n"
|
||||
: "+&r" (expected), // %0
|
||||
"+&r" (desired), // %1
|
||||
"=&r" (current), // %2
|
||||
"=&r" (success) // %3
|
||||
: "m" (storage) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
int success;
|
||||
storage_type current, tmp;
|
||||
fence_before(success_order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"mov %5, %1\n" // tmp = desired
|
||||
"ldq_l %2, %4\n" // current = *(&storage)
|
||||
"cmpeq %2, %0, %3\n" // success = current == expected
|
||||
"mov %2, %0\n" // expected = current
|
||||
"beq %3, 2f\n" // if (success == 0) goto end
|
||||
"stq_c %1, %4\n" // storage = tmp; tmp = store succeeded
|
||||
"beq %1, 3f\n" // if (tmp == 0) goto retry
|
||||
"mov %1, %3\n" // success = tmp
|
||||
"2:\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"3: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "+&r" (expected), // %0
|
||||
"=&r" (tmp), // %1
|
||||
"=&r" (current), // %2
|
||||
"=&r" (success) // %3
|
||||
: "m" (storage), // %4
|
||||
"r" (desired) // %5
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldq_l %0, %2\n"
|
||||
"addq %0, %3, %1\n"
|
||||
"stq_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldq_l %0, %2\n"
|
||||
"subq %0, %3, %1\n"
|
||||
"stq_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldq_l %0, %2\n"
|
||||
"and %0, %3, %1\n"
|
||||
"stq_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldq_l %0, %2\n"
|
||||
"bis %0, %3, %1\n"
|
||||
"stq_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, modified;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n"
|
||||
"ldq_l %0, %2\n"
|
||||
"xor %0, %3, %1\n"
|
||||
"stq_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), // %0
|
||||
"=&r" (modified) // %1
|
||||
: "m" (storage), // %2
|
||||
"r" (v) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, 0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
__asm__ __volatile__ ("mb" ::: "memory");
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_ALPHA_HPP_INCLUDED_
|
975
boost/boost/atomic/detail/ops_gcc_arm.hpp
Normal file
975
boost/boost/atomic/detail/ops_gcc_arm.hpp
Normal file
@ -0,0 +1,975 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_gcc_arm.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_ARM_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_GCC_ARM_HPP_INCLUDED_
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/detail/ops_extending_cas_based.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
// From the ARM Architecture Reference Manual for architecture v6:
|
||||
//
|
||||
// LDREX{<cond>} <Rd>, [<Rn>]
|
||||
// <Rd> Specifies the destination register for the memory word addressed by <Rd>
|
||||
// <Rn> Specifies the register containing the address.
|
||||
//
|
||||
// STREX{<cond>} <Rd>, <Rm>, [<Rn>]
|
||||
// <Rd> Specifies the destination register for the returned status value.
|
||||
// 0 if the operation updates memory
|
||||
// 1 if the operation fails to update memory
|
||||
// <Rm> Specifies the register containing the word to be stored to memory.
|
||||
// <Rn> Specifies the register containing the address.
|
||||
// Rd must not be the same register as Rm or Rn.
|
||||
//
|
||||
// ARM v7 is like ARM v6 plus:
|
||||
// There are half-word and byte versions of the LDREX and STREX instructions,
|
||||
// LDREXH, LDREXB, STREXH and STREXB.
|
||||
// There are also double-word versions, LDREXD and STREXD.
|
||||
// (Actually it looks like these are available from version 6k onwards.)
|
||||
// FIXME these are not yet used; should be mostly a matter of copy-and-paste.
|
||||
// I think you can supply an immediate offset to the address.
|
||||
//
|
||||
// A memory barrier is effected using a "co-processor 15" instruction,
|
||||
// though a separate assembler mnemonic is available for it in v7.
|
||||
//
|
||||
// "Thumb 1" is a subset of the ARM instruction set that uses a 16-bit encoding. It
|
||||
// doesn't include all instructions and in particular it doesn't include the co-processor
|
||||
// instruction used for the memory barrier or the load-locked/store-conditional
|
||||
// instructions. So, if we're compiling in "Thumb 1" mode, we need to wrap all of our
|
||||
// asm blocks with code to temporarily change to ARM mode.
|
||||
//
|
||||
// You can only change between ARM and Thumb modes when branching using the bx instruction.
|
||||
// bx takes an address specified in a register. The least significant bit of the address
|
||||
// indicates the mode, so 1 is added to indicate that the destination code is Thumb.
|
||||
// A temporary register is needed for the address and is passed as an argument to these
|
||||
// macros. It must be one of the "low" registers accessible to Thumb code, specified
|
||||
// using the "l" attribute in the asm statement.
|
||||
//
|
||||
// Architecture v7 introduces "Thumb 2", which does include (almost?) all of the ARM
|
||||
// instruction set. (Actually, there was an extension of v6 called v6T2 which supported
|
||||
// "Thumb 2" mode, but its architecture manual is no longer available, referring to v7.)
|
||||
// So in v7 we don't need to change to ARM mode; we can write "universal
|
||||
// assembler" which will assemble to Thumb 2 or ARM code as appropriate. The only thing
|
||||
// we need to do to make this "universal" assembler mode work is to insert "IT" instructions
|
||||
// to annotate the conditional instructions. These are ignored in other modes (e.g. v6),
|
||||
// so they can always be present.
|
||||
|
||||
// A note about memory_order_consume. Technically, this architecture allows to avoid
|
||||
// unnecessary memory barrier after consume load since it supports data dependency ordering.
|
||||
// However, some compiler optimizations may break a seemingly valid code relying on data
|
||||
// dependency tracking by injecting bogus branches to aid out of order execution.
|
||||
// This may happen not only in Boost.Atomic code but also in user's code, which we have no
|
||||
// control of. See this thread: http://lists.boost.org/Archives/boost/2014/06/213890.php.
|
||||
// For this reason we promote memory_order_consume to memory_order_acquire.
|
||||
|
||||
#if defined(__thumb__) && !defined(__thumb2__)
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_ASM_START(TMPREG) "adr " #TMPREG ", 8f\n" "bx " #TMPREG "\n" ".arm\n" ".align 4\n" "8:\n"
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_ASM_END(TMPREG) "adr " #TMPREG ", 9f + 1\n" "bx " #TMPREG "\n" ".thumb\n" ".align 2\n" "9:\n"
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(var) "=&l" (var)
|
||||
#else
|
||||
// The tmpreg may be wasted in this case, which is non-optimal.
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_ASM_START(TMPREG)
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_ASM_END(TMPREG)
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(var) "=&r" (var)
|
||||
#endif
|
||||
|
||||
struct gcc_arm_operations_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & memory_order_release) != 0)
|
||||
hardware_full_fence();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & (memory_order_consume | memory_order_acquire)) != 0)
|
||||
hardware_full_fence();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
hardware_full_fence();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(BOOST_ATOMIC_DETAIL_ARM_HAS_DMB)
|
||||
// Older binutils (supposedly, older than 2.21.1) didn't support symbolic or numeric arguments of the "dmb" instruction such as "ish" or "#11".
|
||||
// As a workaround we have to inject encoded bytes of the instruction. There are two encodings for the instruction: ARM and Thumb. See ARM Architecture Reference Manual, A8.8.43.
|
||||
// Since we cannot detect binutils version at compile time, we'll have to always use this hack.
|
||||
__asm__ __volatile__
|
||||
(
|
||||
#if defined(__thumb2__)
|
||||
".short 0xF3BF, 0x8F5B\n" // dmb ish
|
||||
#else
|
||||
".word 0xF57FF05B\n" // dmb ish
|
||||
#endif
|
||||
:
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
#else
|
||||
int tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"mcr\tp15, 0, r0, c7, c10, 5\n"
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: "=&l" (tmp)
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public gcc_arm_operations_base
|
||||
{
|
||||
typedef typename make_storage_type< 4u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage = v;
|
||||
fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = storage;
|
||||
fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original;
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // load the original value
|
||||
"strex %[tmp], %[value], %[storage]\n" // store the replacement, tmp = store failed
|
||||
"teq %[tmp], #0\n" // check if store succeeded
|
||||
"bne 1b\n"
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [tmp] "=&l" (tmp), [original] "=&r" (original), [storage] "+Q" (storage)
|
||||
: [value] "r" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
uint32_t success;
|
||||
uint32_t tmp;
|
||||
storage_type original;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"mov %[success], #0\n" // success = 0
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"cmp %[original], %[expected]\n" // flags = original==expected
|
||||
"itt eq\n" // [hint that the following 2 instructions are conditional on flags.equal]
|
||||
"strexeq %[success], %[desired], %[storage]\n" // if (flags.equal) *(&storage) = desired, success = store failed
|
||||
"eoreq %[success], %[success], #1\n" // if (flags.equal) success ^= 1 (i.e. make it 1 if store succeeded)
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[success] "=&r" (success), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [expected] "r" (expected), // %4
|
||||
[desired] "r" (desired) // %5
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
expected = original;
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
uint32_t success;
|
||||
uint32_t tmp;
|
||||
storage_type original;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"mov %[success], #0\n" // success = 0
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"cmp %[original], %[expected]\n" // flags = original==expected
|
||||
"bne 2f\n" // if (!flags.equal) goto end
|
||||
"strex %[success], %[desired], %[storage]\n" // *(&storage) = desired, success = store failed
|
||||
"eors %[success], %[success], #1\n" // success ^= 1 (i.e. make it 1 if store succeeded); flags.equal = success == 0
|
||||
"beq 1b\n" // if (flags.equal) goto retry
|
||||
"2:\n"
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[success] "=&r" (success), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [expected] "r" (expected), // %4
|
||||
[desired] "r" (desired) // %5
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
expected = original;
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"add %[result], %[original], %[value]\n" // result = original + value
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"sub %[result], %[original], %[value]\n" // result = original - value
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"and %[result], %[original], %[value]\n" // result = original & value
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"orr %[result], %[original], %[value]\n" // result = original | value
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"eor %[result], %[original], %[value]\n" // result = original ^ value
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, 0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< >
|
||||
struct operations< 1u, false > :
|
||||
public operations< 4u, false >
|
||||
{
|
||||
typedef operations< 4u, false > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"add %[result], %[original], %[value]\n" // result = original + value
|
||||
"uxtb %[result], %[result]\n" // zero extend result from 8 to 32 bits
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"sub %[result], %[original], %[value]\n" // result = original - value
|
||||
"uxtb %[result], %[result]\n" // zero extend result from 8 to 32 bits
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct operations< 1u, true > :
|
||||
public operations< 4u, true >
|
||||
{
|
||||
typedef operations< 4u, true > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"add %[result], %[original], %[value]\n" // result = original + value
|
||||
"sxtb %[result], %[result]\n" // sign extend result from 8 to 32 bits
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"sub %[result], %[original], %[value]\n" // result = original - value
|
||||
"sxtb %[result], %[result]\n" // sign extend result from 8 to 32 bits
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< >
|
||||
struct operations< 2u, false > :
|
||||
public operations< 4u, false >
|
||||
{
|
||||
typedef operations< 4u, false > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"add %[result], %[original], %[value]\n" // result = original + value
|
||||
"uxth %[result], %[result]\n" // zero extend result from 16 to 32 bits
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"sub %[result], %[original], %[value]\n" // result = original - value
|
||||
"uxth %[result], %[result]\n" // zero extend result from 16 to 32 bits
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct operations< 2u, true > :
|
||||
public operations< 4u, true >
|
||||
{
|
||||
typedef operations< 4u, true > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"add %[result], %[original], %[value]\n" // result = original + value
|
||||
"sxth %[result], %[result]\n" // sign extend result from 16 to 32 bits
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
storage_type original, result;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%[tmp])
|
||||
"1:\n"
|
||||
"ldrex %[original], %[storage]\n" // original = *(&storage)
|
||||
"sub %[result], %[original], %[value]\n" // result = original - value
|
||||
"sxth %[result], %[result]\n" // sign extend result from 16 to 32 bits
|
||||
"strex %[tmp], %[result], %[storage]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %[tmp], #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%[tmp])
|
||||
: [original] "=&r" (original), // %0
|
||||
[result] "=&r" (result), // %1
|
||||
[tmp] "=&l" (tmp), // %2
|
||||
[storage] "+Q" (storage) // %3
|
||||
: [value] "r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXD_STREXD)
|
||||
|
||||
// Unlike 32-bit operations, for 64-bit loads and stores we must use ldrexd/strexd.
|
||||
// Any other instructions result in a non-atomic sequence of 32-bit accesses.
|
||||
// See "ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition",
|
||||
// Section A3.5.3 "Atomicity in the ARM architecture".
|
||||
|
||||
// In the asm blocks below we have to use 32-bit register pairs to compose 64-bit values.
|
||||
// In order to pass the 64-bit operands to/from asm blocks, we use undocumented gcc feature:
|
||||
// the lower half (Rt) of the operand is accessible normally, via the numbered placeholder (e.g. %0),
|
||||
// and the upper half (Rt2) - via the same placeholder with an 'H' after the '%' sign (e.g. %H0).
|
||||
// See: http://hardwarebug.org/2010/07/06/arm-inline-asm-secrets/
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public gcc_arm_operations_base
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
exchange(storage, v, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original;
|
||||
uint32_t tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"ldrexd %1, %H1, [%2]\n"
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(tmp), // %0
|
||||
"=&r" (original) // %1
|
||||
: "r" (&storage) // %2
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original;
|
||||
fence_before(order);
|
||||
uint32_t tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"1:\n"
|
||||
"ldrexd %1, %H1, [%3]\n" // load the original value
|
||||
"strexd %0, %2, %H2, [%3]\n" // store the replacement, tmp = store failed
|
||||
"teq %0, #0\n" // check if store succeeded
|
||||
"bne 1b\n"
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(tmp), // %0
|
||||
"=&r" (original) // %1
|
||||
: "r" (v), // %2
|
||||
"r" (&storage) // %3
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
uint32_t tmp;
|
||||
storage_type original, old_val = expected;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"ldrexd %1, %H1, [%3]\n" // original = *(&storage)
|
||||
"cmp %1, %2\n" // flags = original.lo==old_val.lo
|
||||
"ittt eq\n" // [hint that the following 3 instructions are conditional on flags.equal]
|
||||
"cmpeq %H1, %H2\n" // if (flags.equal) flags = original.hi==old_val.hi
|
||||
"strexdeq %0, %4, %H4, [%3]\n" // if (flags.equal) *(&storage) = desired, tmp = store failed
|
||||
"teqeq %0, #0\n" // if (flags.equal) flags = tmp==0
|
||||
"ite eq\n" // [hint that the following 2 instructions are conditional on flags.equal]
|
||||
"moveq %2, #1\n" // if (flags.equal) old_val.lo = 1
|
||||
"movne %2, #0\n" // if (!flags.equal) old_val.lo = 0
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(tmp), // %0
|
||||
"=&r" (original), // %1
|
||||
"+r" (old_val) // %2
|
||||
: "r" (&storage), // %3
|
||||
"r" (desired) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
const uint32_t success = (uint32_t)old_val;
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
expected = original;
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
uint32_t tmp;
|
||||
storage_type original, old_val = expected;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"1:\n"
|
||||
"ldrexd %1, %H1, [%3]\n" // original = *(&storage)
|
||||
"cmp %1, %2\n" // flags = original.lo==old_val.lo
|
||||
"it eq\n" // [hint that the following instruction is conditional on flags.equal]
|
||||
"cmpeq %H1, %H2\n" // if (flags.equal) flags = original.hi==old_val.hi
|
||||
"bne 2f\n" // if (!flags.equal) goto end
|
||||
"strexd %0, %4, %H4, [%3]\n" // *(&storage) = desired, tmp = store failed
|
||||
"teq %0, #0\n" // flags.equal = tmp == 0
|
||||
"bne 1b\n" // if (flags.equal) goto retry
|
||||
"2:\n"
|
||||
"ite eq\n" // [hint that the following 2 instructions are conditional on flags.equal]
|
||||
"moveq %2, #1\n" // if (flags.equal) old_val.lo = 1
|
||||
"movne %2, #0\n" // if (!flags.equal) old_val.lo = 0
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(tmp), // %0
|
||||
"=&r" (original), // %1
|
||||
"+r" (old_val) // %2
|
||||
: "r" (&storage), // %3
|
||||
"r" (desired) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
const uint32_t success = (uint32_t)old_val;
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
expected = original;
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage_type original, result;
|
||||
uint32_t tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"1:\n"
|
||||
"ldrexd %1, %H1, [%3]\n" // original = *(&storage)
|
||||
"adds %2, %1, %4\n" // result = original + value
|
||||
"adc %H2, %H1, %H4\n"
|
||||
"strexd %0, %2, %H2, [%3]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %0, #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(tmp), // %0
|
||||
"=&r" (original), // %1
|
||||
"=&r" (result) // %2
|
||||
: "r" (&storage), // %3
|
||||
"r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage_type original, result;
|
||||
uint32_t tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"1:\n"
|
||||
"ldrexd %1, %H1, [%3]\n" // original = *(&storage)
|
||||
"subs %2, %1, %4\n" // result = original - value
|
||||
"sbc %H2, %H1, %H4\n"
|
||||
"strexd %0, %2, %H2, [%3]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %0, #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(tmp), // %0
|
||||
"=&r" (original), // %1
|
||||
"=&r" (result) // %2
|
||||
: "r" (&storage), // %3
|
||||
"r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage_type original, result;
|
||||
uint32_t tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"1:\n"
|
||||
"ldrexd %1, %H1, [%3]\n" // original = *(&storage)
|
||||
"and %2, %1, %4\n" // result = original & value
|
||||
"and %H2, %H1, %H4\n"
|
||||
"strexd %0, %2, %H2, [%3]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %0, #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(tmp), // %0
|
||||
"=&r" (original), // %1
|
||||
"=&r" (result) // %2
|
||||
: "r" (&storage), // %3
|
||||
"r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage_type original, result;
|
||||
uint32_t tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"1:\n"
|
||||
"ldrexd %1, %H1, [%3]\n" // original = *(&storage)
|
||||
"orr %2, %1, %4\n" // result = original | value
|
||||
"orr %H2, %H1, %H4\n"
|
||||
"strexd %0, %2, %H2, [%3]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %0, #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(tmp), // %0
|
||||
"=&r" (original), // %1
|
||||
"=&r" (result) // %2
|
||||
: "r" (&storage), // %3
|
||||
"r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage_type original, result;
|
||||
uint32_t tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_START(%0)
|
||||
"1:\n"
|
||||
"ldrexd %1, %H1, [%3]\n" // original = *(&storage)
|
||||
"eor %2, %1, %4\n" // result = original ^ value
|
||||
"eor %H2, %H1, %H4\n"
|
||||
"strexd %0, %2, %H2, [%3]\n" // *(&storage) = result, tmp = store failed
|
||||
"teq %0, #0\n" // flags = tmp==0
|
||||
"bne 1b\n" // if (!flags.equal) goto retry
|
||||
BOOST_ATOMIC_DETAIL_ARM_ASM_END(%0)
|
||||
: BOOST_ATOMIC_DETAIL_ARM_ASM_TMPREG_CONSTRAINT(tmp), // %0
|
||||
"=&r" (original), // %1
|
||||
"=&r" (result) // %2
|
||||
: "r" (&storage), // %3
|
||||
"r" (v) // %4
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, 0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // defined(BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXD_STREXD)
|
||||
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
gcc_arm_operations_base::hardware_full_fence();
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_ARM_HPP_INCLUDED_
|
400
boost/boost/atomic/detail/ops_gcc_atomic.hpp
Normal file
400
boost/boost/atomic/detail/ops_gcc_atomic.hpp
Normal file
@ -0,0 +1,400 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_gcc_atomic.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_ATOMIC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_GCC_ATOMIC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#if defined(__clang__) && (defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B) || defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B))
|
||||
#include <boost/atomic/detail/ops_gcc_x86_dcas.hpp>
|
||||
#include <boost/atomic/detail/ops_cas_based.hpp>
|
||||
#endif
|
||||
|
||||
#if __GCC_ATOMIC_LLONG_LOCK_FREE != BOOST_ATOMIC_LLONG_LOCK_FREE || __GCC_ATOMIC_LONG_LOCK_FREE != BOOST_ATOMIC_LONG_LOCK_FREE ||\
|
||||
__GCC_ATOMIC_INT_LOCK_FREE != BOOST_ATOMIC_INT_LOCK_FREE || __GCC_ATOMIC_SHORT_LOCK_FREE != BOOST_ATOMIC_SHORT_LOCK_FREE ||\
|
||||
__GCC_ATOMIC_CHAR_LOCK_FREE != BOOST_ATOMIC_CHAR_LOCK_FREE || __GCC_ATOMIC_BOOL_LOCK_FREE != BOOST_ATOMIC_BOOL_LOCK_FREE ||\
|
||||
__GCC_ATOMIC_WCHAR_T_LOCK_FREE != BOOST_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
// There are platforms where we need to use larger storage types
|
||||
#include <boost/atomic/detail/int_sizes.hpp>
|
||||
#include <boost/atomic/detail/ops_extending_cas_based.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(__INTEL_COMPILER)
|
||||
// This is used to suppress warning #32013 described below for Intel Compiler.
|
||||
// In debug builds the compiler does not inline any functions, so basically
|
||||
// every atomic function call results in this warning. I don't know any other
|
||||
// way to selectively disable just this one warning.
|
||||
#pragma system_header
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
/*!
|
||||
* The function converts \c boost::memory_order values to the compiler-specific constants.
|
||||
*
|
||||
* NOTE: The intention is that the function is optimized away by the compiler, and the
|
||||
* compiler-specific constants are passed to the intrinsics. I know constexpr doesn't
|
||||
* work in this case because the standard atomics interface require memory ordering
|
||||
* constants to be passed as function arguments, at which point they stop being constexpr.
|
||||
* However it is crucial that the compiler sees constants and not runtime values,
|
||||
* because otherwise it just ignores the ordering value and always uses seq_cst.
|
||||
* This is the case with Intel C++ Compiler 14.0.3 (Composer XE 2013 SP1, update 3) and
|
||||
* gcc 4.8.2. Intel Compiler issues a warning in this case:
|
||||
*
|
||||
* warning #32013: Invalid memory order specified. Defaulting to seq_cst memory order.
|
||||
*
|
||||
* while gcc acts silently.
|
||||
*
|
||||
* To mitigate the problem ALL functions, including the atomic<> members must be
|
||||
* declared with BOOST_FORCEINLINE. In this case the compilers are able to see that
|
||||
* all functions are called with constant orderings and call intrinstcts properly.
|
||||
*
|
||||
* Unfortunately, this still doesn't work in debug mode as the compiler doesn't
|
||||
* inline functions even when marked with BOOST_FORCEINLINE. In this case all atomic
|
||||
* operaions will be executed with seq_cst semantics.
|
||||
*/
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR int convert_memory_order_to_gcc(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return (order == memory_order_relaxed ? __ATOMIC_RELAXED : (order == memory_order_consume ? __ATOMIC_CONSUME :
|
||||
(order == memory_order_acquire ? __ATOMIC_ACQUIRE : (order == memory_order_release ? __ATOMIC_RELEASE :
|
||||
(order == memory_order_acq_rel ? __ATOMIC_ACQ_REL : __ATOMIC_SEQ_CST)))));
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
struct gcc_atomic_operations
|
||||
{
|
||||
typedef T storage_type;
|
||||
|
||||
// Note: In the current implementation, gcc_atomic_operations are used onlu when the particularly sized __atomic
|
||||
// intrinsics are always lock-free (i.e. the corresponding LOCK_FREE macro is 2). Therefore it is safe to
|
||||
// always set is_always_lock_free to true here.
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
__atomic_store_n(&storage, v, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_load_n(&storage, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_fetch_add(&storage, v, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_fetch_sub(&storage, v, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_exchange_n(&storage, v, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_compare_exchange_n
|
||||
(
|
||||
&storage, &expected, desired, false,
|
||||
atomics::detail::convert_memory_order_to_gcc(success_order),
|
||||
atomics::detail::convert_memory_order_to_gcc(failure_order)
|
||||
);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_compare_exchange_n
|
||||
(
|
||||
&storage, &expected, desired, true,
|
||||
atomics::detail::convert_memory_order_to_gcc(success_order),
|
||||
atomics::detail::convert_memory_order_to_gcc(failure_order)
|
||||
);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_fetch_and(&storage, v, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_fetch_or(&storage, v, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_fetch_xor(&storage, v, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_test_and_set(&storage, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
__atomic_clear(const_cast< storage_type* >(&storage), atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile& storage) BOOST_NOEXCEPT
|
||||
{
|
||||
return __atomic_is_lock_free(sizeof(storage_type), &storage);
|
||||
}
|
||||
};
|
||||
|
||||
#if BOOST_ATOMIC_INT128_LOCK_FREE > 0
|
||||
#if defined(__clang__) && defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
|
||||
|
||||
// Workaround for clang bug: http://llvm.org/bugs/show_bug.cgi?id=19149
|
||||
// Clang 3.4 does not implement 128-bit __atomic* intrinsics even though it defines __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
||||
template< bool Signed >
|
||||
struct operations< 16u, Signed > :
|
||||
public cas_based_operations< gcc_dcas_x86_64< Signed > >
|
||||
{
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 16u, Signed > :
|
||||
public gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >
|
||||
{
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if BOOST_ATOMIC_INT64_LOCK_FREE > 0
|
||||
#if defined(__clang__) && defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
|
||||
|
||||
// Workaround for clang bug http://llvm.org/bugs/show_bug.cgi?id=19355
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public cas_based_operations< gcc_dcas_x86< Signed > >
|
||||
{
|
||||
};
|
||||
|
||||
#elif (BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 8 && __GCC_ATOMIC_LLONG_LOCK_FREE != BOOST_ATOMIC_LLONG_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 8 && __GCC_ATOMIC_LONG_LOCK_FREE != BOOST_ATOMIC_LONG_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_INT == 8 && __GCC_ATOMIC_INT_LOCK_FREE != BOOST_ATOMIC_INT_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 8 && __GCC_ATOMIC_SHORT_LOCK_FREE != BOOST_ATOMIC_SHORT_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 8 && __GCC_ATOMIC_WCHAR_T_LOCK_FREE != BOOST_ATOMIC_WCHAR_T_LOCK_FREE)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_INT64_EXTENDED
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 8u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_INT32_LOCK_FREE > 0
|
||||
#if (BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 4 && __GCC_ATOMIC_LLONG_LOCK_FREE != BOOST_ATOMIC_LLONG_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 4 && __GCC_ATOMIC_LONG_LOCK_FREE != BOOST_ATOMIC_LONG_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_INT == 4 && __GCC_ATOMIC_INT_LOCK_FREE != BOOST_ATOMIC_INT_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 4 && __GCC_ATOMIC_SHORT_LOCK_FREE != BOOST_ATOMIC_SHORT_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 4 && __GCC_ATOMIC_WCHAR_T_LOCK_FREE != BOOST_ATOMIC_WCHAR_T_LOCK_FREE)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_INT32_EXTENDED
|
||||
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >, 4u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#else // !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 4u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#endif // !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED)
|
||||
|
||||
#else
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public gcc_atomic_operations< typename make_storage_type< 4u, Signed >::type >
|
||||
{
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_INT16_LOCK_FREE > 0
|
||||
#if (BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 2 && __GCC_ATOMIC_LLONG_LOCK_FREE != BOOST_ATOMIC_LLONG_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 2 && __GCC_ATOMIC_LONG_LOCK_FREE != BOOST_ATOMIC_LONG_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_INT == 2 && __GCC_ATOMIC_INT_LOCK_FREE != BOOST_ATOMIC_INT_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 2 && __GCC_ATOMIC_SHORT_LOCK_FREE != BOOST_ATOMIC_SHORT_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 2 && __GCC_ATOMIC_WCHAR_T_LOCK_FREE != BOOST_ATOMIC_WCHAR_T_LOCK_FREE)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_INT16_EXTENDED
|
||||
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_INT32_EXTENDED)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 4u, Signed >::type >, 2u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#elif !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >, 2u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 2u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public gcc_atomic_operations< typename make_storage_type< 2u, Signed >::type >
|
||||
{
|
||||
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_INT8_LOCK_FREE > 0
|
||||
#if (BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 1 && __GCC_ATOMIC_LLONG_LOCK_FREE != BOOST_ATOMIC_LLONG_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 1 && __GCC_ATOMIC_LONG_LOCK_FREE != BOOST_ATOMIC_LONG_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_INT == 1 && __GCC_ATOMIC_INT_LOCK_FREE != BOOST_ATOMIC_INT_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 1 && __GCC_ATOMIC_SHORT_LOCK_FREE != BOOST_ATOMIC_SHORT_LOCK_FREE) ||\
|
||||
(BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 1 && __GCC_ATOMIC_WCHAR_T_LOCK_FREE != BOOST_ATOMIC_WCHAR_T_LOCK_FREE) ||\
|
||||
(__GCC_ATOMIC_CHAR_LOCK_FREE != BOOST_ATOMIC_CHAR_LOCK_FREE) ||\
|
||||
(__GCC_ATOMIC_BOOL_LOCK_FREE != BOOST_ATOMIC_BOOL_LOCK_FREE)
|
||||
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_INT16_EXTENDED)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 2u, Signed >::type >, 1u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#elif !defined(BOOST_ATOMIC_DETAIL_INT32_EXTENDED)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 4u, Signed >::type >, 1u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#elif !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >, 1u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 1u, Signed >
|
||||
{
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public gcc_atomic_operations< typename make_storage_type< 1u, Signed >::type >
|
||||
{
|
||||
typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef BOOST_ATOMIC_DETAIL_INT16_EXTENDED
|
||||
#undef BOOST_ATOMIC_DETAIL_INT32_EXTENDED
|
||||
#undef BOOST_ATOMIC_DETAIL_INT64_EXTENDED
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
__atomic_thread_fence(atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
__atomic_signal_fence(atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_ATOMIC_HPP_INCLUDED_
|
804
boost/boost/atomic/detail/ops_gcc_ppc.hpp
Normal file
804
boost/boost/atomic/detail/ops_gcc_ppc.hpp
Normal file
@ -0,0 +1,804 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_gcc_ppc.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_PPC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_GCC_PPC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
// The implementation below uses information from this document:
|
||||
// http://www.rdrop.com/users/paulmck/scalability/paper/N2745r.2010.02.19a.html
|
||||
|
||||
/*
|
||||
Refer to: Motorola: "Programming Environments Manual for 32-Bit
|
||||
Implementations of the PowerPC Architecture", Appendix E:
|
||||
"Synchronization Programming Examples" for an explanation of what is
|
||||
going on here (can be found on the web at various places by the
|
||||
name "MPCFPE32B.pdf", Google is your friend...)
|
||||
|
||||
Most of the atomic operations map to instructions in a relatively
|
||||
straight-forward fashion, but "load"s may at first glance appear
|
||||
a bit strange as they map to:
|
||||
|
||||
lwz %rX, addr
|
||||
cmpw %rX, %rX
|
||||
bne- 1f
|
||||
1:
|
||||
|
||||
That is, the CPU is forced to perform a branch that "formally" depends
|
||||
on the value retrieved from memory. This scheme has an overhead of
|
||||
about 1-2 clock cycles per load, but it allows to map "acquire" to
|
||||
the "isync" instruction instead of "sync" uniformly and for all type
|
||||
of atomic operations. Since "isync" has a cost of about 15 clock
|
||||
cycles, while "sync" hast a cost of about 50 clock cycles, the small
|
||||
penalty to atomic loads more than compensates for this.
|
||||
|
||||
Byte- and halfword-sized atomic values are realized by encoding the
|
||||
value to be represented into a word, performing sign/zero extension
|
||||
as appropriate. This means that after add/sub operations the value
|
||||
needs fixing up to accurately preserve the wrap-around semantic of
|
||||
the smaller type. (Nothing special needs to be done for the bit-wise
|
||||
and the "exchange type" operators as the compiler already sees to
|
||||
it that values carried in registers are extended appropriately and
|
||||
everything falls into place naturally).
|
||||
|
||||
The register constraint "b" instructs gcc to use any register
|
||||
except r0; this is sometimes required because the encoding for
|
||||
r0 is used to signify "constant zero" in a number of instructions,
|
||||
making r0 unusable in this place. For simplicity this constraint
|
||||
is used everywhere since I am to lazy to look this up on a
|
||||
per-instruction basis, and ppc has enough registers for this not
|
||||
to pose a problem.
|
||||
*/
|
||||
|
||||
// A note about memory_order_consume. Technically, this architecture allows to avoid
|
||||
// unnecessary memory barrier after consume load since it supports data dependency ordering.
|
||||
// However, some compiler optimizations may break a seemingly valid code relying on data
|
||||
// dependency tracking by injecting bogus branches to aid out of order execution.
|
||||
// This may happen not only in Boost.Atomic code but also in user's code, which we have no
|
||||
// control of. See this thread: http://lists.boost.org/Archives/boost/2014/06/213890.php.
|
||||
// For this reason we promote memory_order_consume to memory_order_acquire.
|
||||
|
||||
struct gcc_ppc_operations_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(__powerpc64__) || defined(__PPC64__)
|
||||
if (order == memory_order_seq_cst)
|
||||
__asm__ __volatile__ ("sync" ::: "memory");
|
||||
else if ((order & memory_order_release) != 0)
|
||||
__asm__ __volatile__ ("lwsync" ::: "memory");
|
||||
#else
|
||||
if ((order & memory_order_release) != 0)
|
||||
__asm__ __volatile__ ("sync" ::: "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & (memory_order_consume | memory_order_acquire)) != 0)
|
||||
__asm__ __volatile__ ("isync" ::: "memory");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public gcc_ppc_operations_base
|
||||
{
|
||||
typedef typename make_storage_type< 4u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"stw %1, %0\n\t"
|
||||
: "+m" (storage)
|
||||
: "r" (v)
|
||||
);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v;
|
||||
if (order == memory_order_seq_cst)
|
||||
__asm__ __volatile__ ("sync" ::: "memory");
|
||||
if ((order & (memory_order_consume | memory_order_acquire)) != 0)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lwz %0, %1\n\t"
|
||||
"cmpw %0, %0\n\t"
|
||||
"bne- 1f\n\t"
|
||||
"1:\n\t"
|
||||
"isync\n\t"
|
||||
: "=&r" (v)
|
||||
: "m" (storage)
|
||||
: "cr0", "memory"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lwz %0, %1\n\t"
|
||||
: "=&r" (v)
|
||||
: "m" (storage)
|
||||
);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y1\n\t"
|
||||
"stwcx. %2,%y1\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: "cr0"
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
int success;
|
||||
fence_before(success_order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"li %1, 0\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"cmpw %0, %3\n\t"
|
||||
"bne- 1f\n\t"
|
||||
"stwcx. %4,%y2\n\t"
|
||||
"bne- 1f\n\t"
|
||||
"li %1, 1\n\t"
|
||||
"1:\n\t"
|
||||
: "=&b" (expected), "=&b" (success), "+Z" (storage)
|
||||
: "b" (expected), "b" (desired)
|
||||
: "cr0"
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
int success;
|
||||
fence_before(success_order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"li %1, 0\n\t"
|
||||
"0: lwarx %0,%y2\n\t"
|
||||
"cmpw %0, %3\n\t"
|
||||
"bne- 1f\n\t"
|
||||
"stwcx. %4,%y2\n\t"
|
||||
"bne- 0b\n\t"
|
||||
"li %1, 1\n\t"
|
||||
"1:\n\t"
|
||||
: "=&b" (expected), "=&b" (success), "+Z" (storage)
|
||||
: "b" (expected), "b" (desired)
|
||||
: "cr0"
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"add %1,%0,%3\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"sub %1,%0,%3\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"and %1,%0,%3\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"or %1,%0,%3\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"xor %1,%0,%3\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, 0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< >
|
||||
struct operations< 1u, false > :
|
||||
public operations< 4u, false >
|
||||
{
|
||||
typedef operations< 4u, false > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"add %1,%0,%3\n\t"
|
||||
"rlwinm %1, %1, 0, 0xff\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"sub %1,%0,%3\n\t"
|
||||
"rlwinm %1, %1, 0, 0xff\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct operations< 1u, true > :
|
||||
public operations< 4u, true >
|
||||
{
|
||||
typedef operations< 4u, true > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"add %1,%0,%3\n\t"
|
||||
"extsb %1, %1\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"sub %1,%0,%3\n\t"
|
||||
"extsb %1, %1\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template< >
|
||||
struct operations< 2u, false > :
|
||||
public operations< 4u, false >
|
||||
{
|
||||
typedef operations< 4u, false > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"add %1,%0,%3\n\t"
|
||||
"rlwinm %1, %1, 0, 0xffff\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"sub %1,%0,%3\n\t"
|
||||
"rlwinm %1, %1, 0, 0xffff\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct operations< 2u, true > :
|
||||
public operations< 4u, true >
|
||||
{
|
||||
typedef operations< 4u, true > base_type;
|
||||
typedef base_type::storage_type storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"add %1,%0,%3\n\t"
|
||||
"extsh %1, %1\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"lwarx %0,%y2\n\t"
|
||||
"sub %1,%0,%3\n\t"
|
||||
"extsh %1, %1\n\t"
|
||||
"stwcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#if defined(__powerpc64__) || defined(__PPC64__)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public gcc_ppc_operations_base
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"std %1, %0\n\t"
|
||||
: "+m" (storage)
|
||||
: "r" (v)
|
||||
);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v;
|
||||
if (order == memory_order_seq_cst)
|
||||
__asm__ __volatile__ ("sync" ::: "memory");
|
||||
if ((order & (memory_order_consume | memory_order_acquire)) != 0)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"ld %0, %1\n\t"
|
||||
"cmpd %0, %0\n\t"
|
||||
"bne- 1f\n\t"
|
||||
"1:\n\t"
|
||||
"isync\n\t"
|
||||
: "=&b" (v)
|
||||
: "m" (storage)
|
||||
: "cr0", "memory"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"ld %0, %1\n\t"
|
||||
: "=&b" (v)
|
||||
: "m" (storage)
|
||||
);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"ldarx %0,%y1\n\t"
|
||||
"stdcx. %2,%y1\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: "cr0"
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
int success;
|
||||
fence_before(success_order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"li %1, 0\n\t"
|
||||
"ldarx %0,%y2\n\t"
|
||||
"cmpd %0, %3\n\t"
|
||||
"bne- 1f\n\t"
|
||||
"stdcx. %4,%y2\n\t"
|
||||
"bne- 1f\n\t"
|
||||
"li %1, 1\n\t"
|
||||
"1:"
|
||||
: "=&b" (expected), "=&b" (success), "+Z" (storage)
|
||||
: "b" (expected), "b" (desired)
|
||||
: "cr0"
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
int success;
|
||||
fence_before(success_order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"li %1, 0\n\t"
|
||||
"0: ldarx %0,%y2\n\t"
|
||||
"cmpd %0, %3\n\t"
|
||||
"bne- 1f\n\t"
|
||||
"stdcx. %4,%y2\n\t"
|
||||
"bne- 0b\n\t"
|
||||
"li %1, 1\n\t"
|
||||
"1:\n\t"
|
||||
: "=&b" (expected), "=&b" (success), "+Z" (storage)
|
||||
: "b" (expected), "b" (desired)
|
||||
: "cr0"
|
||||
);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
return !!success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"ldarx %0,%y2\n\t"
|
||||
"add %1,%0,%3\n\t"
|
||||
"stdcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"ldarx %0,%y2\n\t"
|
||||
"sub %1,%0,%3\n\t"
|
||||
"stdcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"ldarx %0,%y2\n\t"
|
||||
"and %1,%0,%3\n\t"
|
||||
"stdcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"ldarx %0,%y2\n\t"
|
||||
"or %1,%0,%3\n\t"
|
||||
"stdcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type original, tmp;
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"1:\n\t"
|
||||
"ldarx %0,%y2\n\t"
|
||||
"xor %1,%0,%3\n\t"
|
||||
"stdcx. %1,%y2\n\t"
|
||||
"bne- 1b\n\t"
|
||||
: "=&b" (original), "=&b" (tmp), "+Z" (storage)
|
||||
: "b" (v)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, 0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // defined(__powerpc64__) || defined(__PPC64__)
|
||||
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
case memory_order_release:
|
||||
case memory_order_acq_rel:
|
||||
#if defined(__powerpc64__) || defined(__PPC64__)
|
||||
__asm__ __volatile__ ("lwsync" ::: "memory");
|
||||
break;
|
||||
#endif
|
||||
case memory_order_seq_cst:
|
||||
__asm__ __volatile__ ("sync" ::: "memory");
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
#if defined(__ibmxl__) || defined(__IBMCPP__)
|
||||
__fence();
|
||||
#else
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_PPC_HPP_INCLUDED_
|
242
boost/boost/atomic/detail/ops_gcc_sparc.hpp
Normal file
242
boost/boost/atomic/detail/ops_gcc_sparc.hpp
Normal file
@ -0,0 +1,242 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2010 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_gcc_sparc.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_SPARC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_GCC_SPARC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#include <boost/atomic/detail/ops_cas_based.hpp>
|
||||
#include <boost/atomic/detail/ops_extending_cas_based.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
struct gcc_sparc_cas_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
__asm__ __volatile__ ("membar #Sync" ::: "memory");
|
||||
else if ((order & memory_order_release) != 0)
|
||||
__asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory");
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
__asm__ __volatile__ ("membar #Sync" ::: "memory");
|
||||
else if ((order & (memory_order_consume | memory_order_acquire)) != 0)
|
||||
__asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory");
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
__asm__ __volatile__ ("membar #Sync" ::: "memory");
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct gcc_sparc_cas32 :
|
||||
public gcc_sparc_cas_base
|
||||
{
|
||||
typedef typename make_storage_type< 4u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage = v;
|
||||
fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = storage;
|
||||
fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
storage_type previous = expected;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"cas [%1], %2, %0"
|
||||
: "+r" (desired)
|
||||
: "r" (&storage), "r" (previous)
|
||||
: "memory"
|
||||
);
|
||||
const bool success = (desired == previous);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
expected = desired;
|
||||
return success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"swap [%1], %0"
|
||||
: "+r" (v)
|
||||
: "r" (&storage)
|
||||
: "memory"
|
||||
);
|
||||
fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public cas_based_operations< gcc_sparc_cas32< Signed > >
|
||||
{
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public extending_cas_based_operations< operations< 4u, Signed >, 1u, Signed >
|
||||
{
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public extending_cas_based_operations< operations< 4u, Signed >, 2u, Signed >
|
||||
{
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct gcc_sparc_cas64 :
|
||||
public gcc_sparc_cas_base
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
storage = v;
|
||||
fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = storage;
|
||||
fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
storage_type previous = expected;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"casx [%1], %2, %0"
|
||||
: "+r" (desired)
|
||||
: "r" (&storage), "r" (previous)
|
||||
: "memory"
|
||||
);
|
||||
const bool success = (desired == previous);
|
||||
if (success)
|
||||
fence_after(success_order);
|
||||
else
|
||||
fence_after(failure_order);
|
||||
expected = desired;
|
||||
return success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public cas_based_operations< cas_based_exchange< gcc_sparc_cas64< Signed > > >
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_release:
|
||||
__asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory");
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
__asm__ __volatile__ ("membar #LoadLoad | #LoadStore" ::: "memory");
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
__asm__ __volatile__ ("membar #LoadLoad | #LoadStore | #StoreStore" ::: "memory");
|
||||
break;
|
||||
case memory_order_seq_cst:
|
||||
__asm__ __volatile__ ("membar #Sync" ::: "memory");
|
||||
break;
|
||||
case memory_order_relaxed:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_SPARC_HPP_INCLUDED_
|
272
boost/boost/atomic/detail/ops_gcc_sync.hpp
Normal file
272
boost/boost/atomic/detail/ops_gcc_sync.hpp
Normal file
@ -0,0 +1,272 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2011 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_gcc_sync.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_SYNC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_GCC_SYNC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/detail/ops_extending_cas_based.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
struct gcc_sync_operations_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & memory_order_release) != 0)
|
||||
__sync_synchronize();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
__sync_synchronize();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_load(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & (memory_order_acquire | memory_order_consume)) != 0)
|
||||
__sync_synchronize();
|
||||
}
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
struct gcc_sync_operations :
|
||||
public gcc_sync_operations_base
|
||||
{
|
||||
typedef T storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before_store(order);
|
||||
storage = v;
|
||||
fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = storage;
|
||||
fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&storage, v);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_sub(&storage, v);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
// GCC docs mention that not all architectures may support full exchange semantics for this intrinsic. However, GCC's implementation of
|
||||
// std::atomic<> uses this intrinsic unconditionally. We do so as well. In case if some architectures actually don't support this, we can always
|
||||
// add a check here and fall back to a CAS loop.
|
||||
if ((order & memory_order_release) != 0)
|
||||
__sync_synchronize();
|
||||
return __sync_lock_test_and_set(&storage, v);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type expected2 = expected;
|
||||
storage_type old_val = __sync_val_compare_and_swap(&storage, expected2, desired);
|
||||
|
||||
if (old_val == expected2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
expected = old_val;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_and(&storage, v);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_or(&storage, v);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_xor(&storage, v);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & memory_order_release) != 0)
|
||||
__sync_synchronize();
|
||||
return !!__sync_lock_test_and_set(&storage, 1);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
__sync_lock_release(&storage);
|
||||
if (order == memory_order_seq_cst)
|
||||
__sync_synchronize();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#if BOOST_ATOMIC_INT8_LOCK_FREE > 0
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1)
|
||||
public gcc_sync_operations< typename make_storage_type< 1u, Signed >::type >
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2)
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 2u, Signed >::type >, 1u, Signed >
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 4u, Signed >::type >, 1u, Signed >
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 8u, Signed >::type >, 1u, Signed >
|
||||
#else
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >, 1u, Signed >
|
||||
#endif
|
||||
{
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1)
|
||||
typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type;
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2)
|
||||
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
#else
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_INT16_LOCK_FREE > 0
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2)
|
||||
public gcc_sync_operations< typename make_storage_type< 2u, Signed >::type >
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 4u, Signed >::type >, 2u, Signed >
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 8u, Signed >::type >, 2u, Signed >
|
||||
#else
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >, 2u, Signed >
|
||||
#endif
|
||||
{
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2)
|
||||
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
#else
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_INT32_LOCK_FREE > 0
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
public gcc_sync_operations< typename make_storage_type< 4u, Signed >::type >
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 8u, Signed >::type >, 4u, Signed >
|
||||
#else
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >, 4u, Signed >
|
||||
#endif
|
||||
{
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
#else
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_INT64_LOCK_FREE > 0
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
public gcc_sync_operations< typename make_storage_type< 8u, Signed >::type >
|
||||
#else
|
||||
public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >, 8u, Signed >
|
||||
#endif
|
||||
{
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
#else
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_INT128_LOCK_FREE > 0
|
||||
template< bool Signed >
|
||||
struct operations< 16u, Signed > :
|
||||
public gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >
|
||||
{
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
};
|
||||
#endif
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
__sync_synchronize();
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_SYNC_HPP_INCLUDED_
|
516
boost/boost/atomic/detail/ops_gcc_x86.hpp
Normal file
516
boost/boost/atomic/detail/ops_gcc_x86.hpp
Normal file
@ -0,0 +1,516 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2012 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_gcc_x86.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_X86_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_GCC_X86_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B) || defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
|
||||
#include <boost/atomic/detail/ops_gcc_x86_dcas.hpp>
|
||||
#include <boost/atomic/detail/ops_cas_based.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#define BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER "rdx"
|
||||
#else
|
||||
#define BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER "edx"
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
struct gcc_x86_operations_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & memory_order_release) != 0)
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & memory_order_acquire) != 0)
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
};
|
||||
|
||||
template< typename T, typename Derived >
|
||||
struct gcc_x86_operations :
|
||||
public gcc_x86_operations_base
|
||||
{
|
||||
typedef T storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_seq_cst)
|
||||
{
|
||||
fence_before(order);
|
||||
storage = v;
|
||||
fence_after(order);
|
||||
}
|
||||
else
|
||||
{
|
||||
Derived::exchange(storage, v, order);
|
||||
}
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = storage;
|
||||
fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return Derived::fetch_add(storage, -v, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return Derived::compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!Derived::exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, (storage_type)0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public gcc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > >
|
||||
{
|
||||
typedef gcc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; xaddb %0, %1"
|
||||
: "+q" (v), "+m" (storage)
|
||||
:
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"xchgb %0, %1"
|
||||
: "+q" (v), "+m" (storage)
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected;
|
||||
bool success;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; cmpxchgb %3, %1\n\t"
|
||||
"sete %2"
|
||||
: "+a" (previous), "+m" (storage), "=q" (success)
|
||||
: "q" (desired)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
expected = previous;
|
||||
return success;
|
||||
}
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_CAS_LOOP(op, argument, result)\
|
||||
__asm__ __volatile__\
|
||||
(\
|
||||
"xor %%" BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER ", %%" BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER "\n\t"\
|
||||
".align 16\n\t"\
|
||||
"1: movb %[arg], %%dl\n\t"\
|
||||
op " %%al, %%dl\n\t"\
|
||||
"lock; cmpxchgb %%dl, %[storage]\n\t"\
|
||||
"jne 1b"\
|
||||
: [res] "+a" (result), [storage] "+m" (storage)\
|
||||
: [arg] "q" (argument)\
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER, "memory"\
|
||||
)
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("andb", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("orb", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("xorb", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
#undef BOOST_ATOMIC_DETAIL_CAS_LOOP
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public gcc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > >
|
||||
{
|
||||
typedef gcc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; xaddw %0, %1"
|
||||
: "+q" (v), "+m" (storage)
|
||||
:
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"xchgw %0, %1"
|
||||
: "+q" (v), "+m" (storage)
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected;
|
||||
bool success;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; cmpxchgw %3, %1\n\t"
|
||||
"sete %2"
|
||||
: "+a" (previous), "+m" (storage), "=q" (success)
|
||||
: "q" (desired)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
expected = previous;
|
||||
return success;
|
||||
}
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_CAS_LOOP(op, argument, result)\
|
||||
__asm__ __volatile__\
|
||||
(\
|
||||
"xor %%" BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER ", %%" BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER "\n\t"\
|
||||
".align 16\n\t"\
|
||||
"1: movw %[arg], %%dx\n\t"\
|
||||
op " %%ax, %%dx\n\t"\
|
||||
"lock; cmpxchgw %%dx, %[storage]\n\t"\
|
||||
"jne 1b"\
|
||||
: [res] "+a" (result), [storage] "+m" (storage)\
|
||||
: [arg] "q" (argument)\
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER, "memory"\
|
||||
)
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("andw", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("orw", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("xorw", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
#undef BOOST_ATOMIC_DETAIL_CAS_LOOP
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public gcc_x86_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > >
|
||||
{
|
||||
typedef gcc_x86_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; xaddl %0, %1"
|
||||
: "+r" (v), "+m" (storage)
|
||||
:
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"xchgl %0, %1"
|
||||
: "+r" (v), "+m" (storage)
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected;
|
||||
bool success;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; cmpxchgl %3, %1\n\t"
|
||||
"sete %2"
|
||||
: "+a" (previous), "+m" (storage), "=q" (success)
|
||||
: "r" (desired)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
expected = previous;
|
||||
return success;
|
||||
}
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_CAS_LOOP(op, argument, result)\
|
||||
__asm__ __volatile__\
|
||||
(\
|
||||
"xor %%" BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER ", %%" BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER "\n\t"\
|
||||
".align 16\n\t"\
|
||||
"1: movl %[arg], %%edx\n\t"\
|
||||
op " %%eax, %%edx\n\t"\
|
||||
"lock; cmpxchgl %%edx, %[storage]\n\t"\
|
||||
"jne 1b"\
|
||||
: [res] "+a" (result), [storage] "+m" (storage)\
|
||||
: [arg] "r" (argument)\
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER, "memory"\
|
||||
)
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("andl", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("orl", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("xorl", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
#undef BOOST_ATOMIC_DETAIL_CAS_LOOP
|
||||
};
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public cas_based_operations< gcc_dcas_x86< Signed > >
|
||||
{
|
||||
};
|
||||
|
||||
#elif defined(__x86_64__)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public gcc_x86_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > >
|
||||
{
|
||||
typedef gcc_x86_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; xaddq %0, %1"
|
||||
: "+r" (v), "+m" (storage)
|
||||
:
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"xchgq %0, %1"
|
||||
: "+r" (v), "+m" (storage)
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected;
|
||||
bool success;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; cmpxchgq %3, %1\n\t"
|
||||
"sete %2"
|
||||
: "+a" (previous), "+m" (storage), "=q" (success)
|
||||
: "r" (desired)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
expected = previous;
|
||||
return success;
|
||||
}
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_CAS_LOOP(op, argument, result)\
|
||||
__asm__ __volatile__\
|
||||
(\
|
||||
"xor %%" BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER ", %%" BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER "\n\t"\
|
||||
".align 16\n\t"\
|
||||
"1: movq %[arg], %%rdx\n\t"\
|
||||
op " %%rax, %%rdx\n\t"\
|
||||
"lock; cmpxchgq %%rdx, %[storage]\n\t"\
|
||||
"jne 1b"\
|
||||
: [res] "+a" (result), [storage] "+m" (storage)\
|
||||
: [arg] "r" (argument)\
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER, "memory"\
|
||||
)
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("andq", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("orq", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
BOOST_ATOMIC_DETAIL_CAS_LOOP("xorq", v, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
#undef BOOST_ATOMIC_DETAIL_CAS_LOOP
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 16u, Signed > :
|
||||
public cas_based_operations< gcc_dcas_x86_64< Signed > >
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE)
|
||||
"mfence\n"
|
||||
#else
|
||||
"lock; addl $0, (%%esp)\n"
|
||||
#endif
|
||||
::: "memory"
|
||||
);
|
||||
}
|
||||
else if ((order & (memory_order_acquire | memory_order_release)) != 0)
|
||||
{
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_ATOMIC_DETAIL_TEMP_CAS_REGISTER
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_X86_HPP_INCLUDED_
|
625
boost/boost/atomic/detail/ops_gcc_x86_dcas.hpp
Normal file
625
boost/boost/atomic/detail/ops_gcc_x86_dcas.hpp
Normal file
@ -0,0 +1,625 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2012 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_gcc_x86_dcas.hpp
|
||||
*
|
||||
* This header contains implementation of the double-width CAS primitive for x86.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_X86_DCAS_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_GCC_X86_DCAS_HPP_INCLUDED_
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
|
||||
|
||||
template< bool Signed >
|
||||
struct gcc_dcas_x86
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((((uint32_t)&storage) & 0x00000007) == 0)
|
||||
{
|
||||
#if defined(__SSE2__)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
#if defined(__AVX__)
|
||||
"vmovq %1, %%xmm4\n\t"
|
||||
"vmovq %%xmm4, %0\n\t"
|
||||
#else
|
||||
"movq %1, %%xmm4\n\t"
|
||||
"movq %%xmm4, %0\n\t"
|
||||
#endif
|
||||
: "=m" (storage)
|
||||
: "m" (v)
|
||||
: "memory", "xmm4"
|
||||
);
|
||||
#else
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"fildll %1\n\t"
|
||||
"fistpll %0\n\t"
|
||||
: "=m" (storage)
|
||||
: "m" (v)
|
||||
: "memory"
|
||||
);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
#if defined(__PIC__)
|
||||
uint32_t scratch;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %%ebx, %[scratch]\n\t"
|
||||
"movl %[value_lo], %%ebx\n\t"
|
||||
"movl %[dest], %%eax\n\t"
|
||||
"movl 4+%[dest], %%edx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg8b %[dest]\n\t"
|
||||
"jne 1b\n\t"
|
||||
"movl %[scratch], %%ebx\n\t"
|
||||
: [scratch] "=m" (scratch), [dest] "=o" (storage)
|
||||
: [value_lo] "a" ((uint32_t)v), "c" ((uint32_t)(v >> 32))
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "edx", "memory"
|
||||
);
|
||||
#else // defined(__PIC__)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %[dest], %%eax\n\t"
|
||||
"movl 4+%[dest], %%edx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg8b %[dest]\n\t"
|
||||
"jne 1b\n\t"
|
||||
: [dest] "=o" (storage)
|
||||
: [value_lo] "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32))
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "eax", "edx", "memory"
|
||||
);
|
||||
#endif // defined(__PIC__)
|
||||
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
#if defined(__PIC__)
|
||||
uint32_t scratch;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %%ebx, %[scratch]\n\t"
|
||||
"movl %[value_lo], %%ebx\n\t"
|
||||
"movl 0(%[dest]), %%eax\n\t"
|
||||
"movl 4(%[dest]), %%edx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg8b 0(%[dest])\n\t"
|
||||
"jne 1b\n\t"
|
||||
"movl %[scratch], %%ebx\n\t"
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
|
||||
: [scratch] "=m,m" (scratch)
|
||||
: [value_lo] "a,a" ((uint32_t)v), "c,c" ((uint32_t)(v >> 32)), [dest] "D,S" (&storage)
|
||||
#else
|
||||
: [scratch] "=m" (scratch)
|
||||
: [value_lo] "a" ((uint32_t)v), "c" ((uint32_t)(v >> 32)), [dest] "D" (&storage)
|
||||
#endif
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "edx", "memory"
|
||||
);
|
||||
#else // defined(__PIC__)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl 0(%[dest]), %%eax\n\t"
|
||||
"movl 4(%[dest]), %%edx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg8b 0(%[dest])\n\t"
|
||||
"jne 1b\n\t"
|
||||
:
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
|
||||
: [value_lo] "b,b" ((uint32_t)v), "c,c" ((uint32_t)(v >> 32)), [dest] "D,S" (&storage)
|
||||
#else
|
||||
: [value_lo] "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32)), [dest] "D" (&storage)
|
||||
#endif
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "eax", "edx", "memory"
|
||||
);
|
||||
#endif // defined(__PIC__)
|
||||
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
}
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type value;
|
||||
|
||||
if ((((uint32_t)&storage) & 0x00000007) == 0)
|
||||
{
|
||||
#if defined(__SSE2__)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
#if defined(__AVX__)
|
||||
"vmovq %1, %%xmm4\n\t"
|
||||
"vmovq %%xmm4, %0\n\t"
|
||||
#else
|
||||
"movq %1, %%xmm4\n\t"
|
||||
"movq %%xmm4, %0\n\t"
|
||||
#endif
|
||||
: "=m" (value)
|
||||
: "m" (storage)
|
||||
: "memory", "xmm4"
|
||||
);
|
||||
#else
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"fildll %1\n\t"
|
||||
"fistpll %0\n\t"
|
||||
: "=m" (value)
|
||||
: "m" (storage)
|
||||
: "memory"
|
||||
);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(__clang__)
|
||||
// Clang cannot allocate eax:edx register pairs but it has sync intrinsics
|
||||
value = __sync_val_compare_and_swap(&storage, (storage_type)0, (storage_type)0);
|
||||
#else
|
||||
// We don't care for comparison result here; the previous value will be stored into value anyway.
|
||||
// Also we don't care for ebx and ecx values, they just have to be equal to eax and edx before cmpxchg8b.
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %%ebx, %%eax\n\t"
|
||||
"movl %%ecx, %%edx\n\t"
|
||||
"lock; cmpxchg8b %[storage]\n\t"
|
||||
: "=&A" (value)
|
||||
: [storage] "m" (storage)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
// Clang cannot allocate eax:edx register pairs but it has sync intrinsics
|
||||
storage_type old_expected = expected;
|
||||
expected = __sync_val_compare_and_swap(&storage, old_expected, desired);
|
||||
return expected == old_expected;
|
||||
#elif defined(__PIC__)
|
||||
// Make sure ebx is saved and restored properly in case
|
||||
// of position independent code. To make this work
|
||||
// setup register constraints such that ebx can not be
|
||||
// used by accident e.g. as base address for the variable
|
||||
// to be modified. Accessing "scratch" should always be okay,
|
||||
// as it can only be placed on the stack (and therefore
|
||||
// accessed through ebp or esp only).
|
||||
//
|
||||
// In theory, could push/pop ebx onto/off the stack, but movs
|
||||
// to a prepared stack slot turn out to be faster.
|
||||
|
||||
uint32_t scratch;
|
||||
bool success;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %%ebx, %[scratch]\n\t"
|
||||
"movl %[desired_lo], %%ebx\n\t"
|
||||
"lock; cmpxchg8b %[dest]\n\t"
|
||||
"movl %[scratch], %%ebx\n\t"
|
||||
"sete %[success]\n\t"
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
|
||||
: "+A,A,A,A,A,A" (expected), [dest] "+m,m,m,m,m,m" (storage), [scratch] "=m,m,m,m,m,m" (scratch), [success] "=q,m,q,m,q,m" (success)
|
||||
: [desired_lo] "S,S,D,D,m,m" ((uint32_t)desired), "c,c,c,c,c,c" ((uint32_t)(desired >> 32))
|
||||
#else
|
||||
: "+A" (expected), [dest] "+m" (storage), [scratch] "=m" (scratch), [success] "=q" (success)
|
||||
: [desired_lo] "S" ((uint32_t)desired), "c" ((uint32_t)(desired >> 32))
|
||||
#endif
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
return success;
|
||||
#else
|
||||
bool success;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; cmpxchg8b %[dest]\n\t"
|
||||
"sete %[success]\n\t"
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
|
||||
: "+A,A" (expected), [dest] "+m,m" (storage), [success] "=q,m" (success)
|
||||
: "b,b" ((uint32_t)desired), "c,c" ((uint32_t)(desired >> 32))
|
||||
#else
|
||||
: "+A" (expected), [dest] "+m" (storage), [success] "=q" (success)
|
||||
: "b" ((uint32_t)desired), "c" ((uint32_t)(desired >> 32))
|
||||
#endif
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
return success;
|
||||
#endif
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
// Clang cannot allocate eax:edx register pairs but it has sync intrinsics
|
||||
storage_type old_val = storage;
|
||||
while (true)
|
||||
{
|
||||
storage_type val = __sync_val_compare_and_swap(&storage, old_val, v);
|
||||
if (val == old_val)
|
||||
return val;
|
||||
old_val = val;
|
||||
}
|
||||
#elif !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
#if defined(__PIC__)
|
||||
uint32_t scratch;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %%ebx, %[scratch]\n\t"
|
||||
"movl %%eax, %%ebx\n\t"
|
||||
"movl %%edx, %%ecx\n\t"
|
||||
"movl %[dest], %%eax\n\t"
|
||||
"movl 4+%[dest], %%edx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg8b %[dest]\n\t"
|
||||
"jne 1b\n\t"
|
||||
"movl %[scratch], %%ebx\n\t"
|
||||
: "+A" (v), [scratch] "=m" (scratch), [dest] "+o" (storage)
|
||||
:
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "ecx", "memory"
|
||||
);
|
||||
return v;
|
||||
#else // defined(__PIC__)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %[dest], %%eax\n\t"
|
||||
"movl 4+%[dest], %%edx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg8b %[dest]\n\t"
|
||||
"jne 1b\n\t"
|
||||
: "=A" (v), [dest] "+o" (storage)
|
||||
: "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32))
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
return v;
|
||||
#endif // defined(__PIC__)
|
||||
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
#if defined(__PIC__)
|
||||
uint32_t scratch;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %%ebx, %[scratch]\n\t"
|
||||
"movl %%eax, %%ebx\n\t"
|
||||
"movl %%edx, %%ecx\n\t"
|
||||
"movl 0(%[dest]), %%eax\n\t"
|
||||
"movl 4(%[dest]), %%edx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg8b 0(%[dest])\n\t"
|
||||
"jne 1b\n\t"
|
||||
"movl %[scratch], %%ebx\n\t"
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
|
||||
: "+A,A" (v), [scratch] "=m,m" (scratch)
|
||||
: [dest] "D,S" (&storage)
|
||||
#else
|
||||
: "+A" (v), [scratch] "=m" (scratch)
|
||||
: [dest] "D" (&storage)
|
||||
#endif
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "ecx", "memory"
|
||||
);
|
||||
return v;
|
||||
#else // defined(__PIC__)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl 0(%[dest]), %%eax\n\t"
|
||||
"movl 4(%[dest]), %%edx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg8b 0(%[dest])\n\t"
|
||||
"jne 1b\n\t"
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
|
||||
: "=A,A" (v)
|
||||
: "b,b" ((uint32_t)v), "c,c" ((uint32_t)(v >> 32)), [dest] "D,S" (&storage)
|
||||
#else
|
||||
: "=A" (v)
|
||||
: "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32)), [dest] "D" (&storage)
|
||||
#endif
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
return v;
|
||||
#endif // defined(__PIC__)
|
||||
#endif
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
|
||||
|
||||
template< bool Signed >
|
||||
struct gcc_dcas_x86_64
|
||||
{
|
||||
typedef typename make_storage_type< 16u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
uint64_t const* p_value = (uint64_t const*)&v;
|
||||
const uint64_t v_lo = p_value[0], v_hi = p_value[1];
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq %[dest], %%rax\n\t"
|
||||
"movq 8+%[dest], %%rdx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg16b %[dest]\n\t"
|
||||
"jne 1b\n\t"
|
||||
: [dest] "=o" (storage)
|
||||
: "b" (v_lo), "c" (v_hi)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "rax", "rdx", "memory"
|
||||
);
|
||||
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq 0(%[dest]), %%rax\n\t"
|
||||
"movq 8(%[dest]), %%rdx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg16b 0(%[dest])\n\t"
|
||||
"jne 1b\n\t"
|
||||
:
|
||||
: "b" (v_lo), "c" (v_hi), [dest] "r" (&storage)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "rax", "rdx", "memory"
|
||||
);
|
||||
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
// Clang cannot allocate rax:rdx register pairs but it has sync intrinsics
|
||||
storage_type value = storage_type();
|
||||
return __sync_val_compare_and_swap(&storage, value, value);
|
||||
#elif defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
|
||||
// GCC 4.4 can't allocate rax:rdx register pair either but it also doesn't support 128-bit __sync_val_compare_and_swap
|
||||
storage_type value;
|
||||
|
||||
// We don't care for comparison result here; the previous value will be stored into value anyway.
|
||||
// Also we don't care for rbx and rcx values, they just have to be equal to rax and rdx before cmpxchg16b.
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq %%rbx, %%rax\n\t"
|
||||
"movq %%rcx, %%rdx\n\t"
|
||||
"lock; cmpxchg16b %[storage]\n\t"
|
||||
"movq %%rax, %[value]\n\t"
|
||||
"movq %%rdx, 8+%[value]\n\t"
|
||||
: [value] "=o" (value)
|
||||
: [storage] "m" (storage)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
|
||||
);
|
||||
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq %%rbx, %%rax\n\t"
|
||||
"movq %%rcx, %%rdx\n\t"
|
||||
"lock; cmpxchg16b %[storage]\n\t"
|
||||
"movq %%rax, 0(%[value])\n\t"
|
||||
"movq %%rdx, 8(%[value])\n\t"
|
||||
:
|
||||
: [storage] "m" (storage), [value] "r" (&value)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
|
||||
);
|
||||
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
|
||||
return value;
|
||||
#else // defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
|
||||
storage_type value;
|
||||
|
||||
// We don't care for comparison result here; the previous value will be stored into value anyway.
|
||||
// Also we don't care for rbx and rcx values, they just have to be equal to rax and rdx before cmpxchg16b.
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq %%rbx, %%rax\n\t"
|
||||
"movq %%rcx, %%rdx\n\t"
|
||||
"lock; cmpxchg16b %[storage]\n\t"
|
||||
: "=&A" (value)
|
||||
: [storage] "m" (storage)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
|
||||
return value;
|
||||
#endif
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
// Clang cannot allocate rax:rdx register pairs but it has sync intrinsics
|
||||
storage_type old_expected = expected;
|
||||
expected = __sync_val_compare_and_swap(&storage, old_expected, desired);
|
||||
return expected == old_expected;
|
||||
#elif defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
|
||||
// GCC 4.4 can't allocate rax:rdx register pair either but it also doesn't support 128-bit __sync_val_compare_and_swap
|
||||
uint64_t const* p_desired = (uint64_t const*)&desired;
|
||||
const uint64_t desired_lo = p_desired[0], desired_hi = p_desired[1];
|
||||
bool success;
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq %[expected], %%rax\n\t"
|
||||
"movq 8+%[expected], %%rdx\n\t"
|
||||
"lock; cmpxchg16b %[dest]\n\t"
|
||||
"sete %[success]\n\t"
|
||||
"movq %%rax, %[expected]\n\t"
|
||||
"movq %%rdx, 8+%[expected]\n\t"
|
||||
: [dest] "+m" (storage), [expected] "+o" (expected), [success] "=q" (success)
|
||||
: "b" (desired_lo), "c" (desired_hi)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
|
||||
);
|
||||
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq 0(%[expected]), %%rax\n\t"
|
||||
"movq 8(%[expected]), %%rdx\n\t"
|
||||
"lock; cmpxchg16b %[dest]\n\t"
|
||||
"sete %[success]\n\t"
|
||||
"movq %%rax, 0(%[expected])\n\t"
|
||||
"movq %%rdx, 8(%[expected])\n\t"
|
||||
: [dest] "+m" (storage), [success] "=q" (success)
|
||||
: "b" (desired_lo), "c" (desired_hi), [expected] "r" (&expected)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
|
||||
);
|
||||
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
|
||||
return success;
|
||||
#else // defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
|
||||
uint64_t const* p_desired = (uint64_t const*)&desired;
|
||||
const uint64_t desired_lo = p_desired[0], desired_hi = p_desired[1];
|
||||
bool success;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock; cmpxchg16b %[dest]\n\t"
|
||||
"sete %[success]\n\t"
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
|
||||
: "+A,A" (expected), [dest] "+m,m" (storage), [success] "=q,m" (success)
|
||||
: "b,b" (desired_lo), "c,c" (desired_hi)
|
||||
#else
|
||||
: "+A" (expected), [dest] "+m" (storage), [success] "=q" (success)
|
||||
: "b" (desired_lo), "c" (desired_hi)
|
||||
#endif
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
return success;
|
||||
#endif
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
// Clang cannot allocate eax:edx register pairs but it has sync intrinsics
|
||||
storage_type old_val = storage;
|
||||
while (true)
|
||||
{
|
||||
storage_type val = __sync_val_compare_and_swap(&storage, old_val, v);
|
||||
if (val == old_val)
|
||||
return val;
|
||||
old_val = val;
|
||||
}
|
||||
#elif defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
|
||||
// GCC 4.4 can't allocate rax:rdx register pair either but it also doesn't support 128-bit __sync_val_compare_and_swap
|
||||
storage_type old_value;
|
||||
uint64_t const* p_value = (uint64_t const*)&v;
|
||||
const uint64_t v_lo = p_value[0], v_hi = p_value[1];
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq %[dest], %%rax\n\t"
|
||||
"movq 8+%[dest], %%rdx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg16b %[dest]\n\t"
|
||||
"jne 1b\n\t"
|
||||
"movq %%rax, %[old_value]\n\t"
|
||||
"movq %%rdx, 8+%[old_value]\n\t"
|
||||
: [dest] "+o" (storage), [old_value] "=o" (old_value)
|
||||
: "b" (v_lo), "c" (v_hi)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
|
||||
);
|
||||
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq 0(%[dest]), %%rax\n\t"
|
||||
"movq 8(%[dest]), %%rdx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg16b 0(%[dest])\n\t"
|
||||
"jne 1b\n\t"
|
||||
"movq %%rax, 0(%[old_value])\n\t"
|
||||
"movq %%rdx, 8(%[old_value])\n\t"
|
||||
:
|
||||
: "b" (v_lo), "c" (v_hi), [dest] "r" (&storage), [old_value] "r" (&old_value)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx"
|
||||
);
|
||||
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
|
||||
return old_value;
|
||||
#else // defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS)
|
||||
uint64_t const* p_value = (uint64_t const*)&v;
|
||||
const uint64_t v_lo = p_value[0], v_hi = p_value[1];
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq %[dest], %%rax\n\t"
|
||||
"movq 8+%[dest], %%rdx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg16b %[dest]\n\t"
|
||||
"jne 1b\n\t"
|
||||
: "=&A" (v), [dest] "+o" (storage)
|
||||
: "b" (v_lo), "c" (v_hi)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movq 0(%[dest]), %%rax\n\t"
|
||||
"movq 8(%[dest]), %%rdx\n\t"
|
||||
".align 16\n\t"
|
||||
"1: lock; cmpxchg16b 0(%[dest])\n\t"
|
||||
"jne 1b\n\t"
|
||||
: "=&A" (v)
|
||||
: "b" (v_lo), "c" (v_hi), [dest] "r" (&storage)
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS)
|
||||
|
||||
return v;
|
||||
#endif
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_X86_DCAS_HPP_INCLUDED_
|
180
boost/boost/atomic/detail/ops_linux_arm.hpp
Normal file
180
boost/boost/atomic/detail/ops_linux_arm.hpp
Normal file
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009, 2011 Helge Bahmann
|
||||
* Copyright (c) 2009 Phil Endecott
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Linux-specific code by Phil Endecott
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_linux_arm.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_LINUX_ARM_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_LINUX_ARM_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#include <boost/atomic/detail/ops_cas_based.hpp>
|
||||
#include <boost/atomic/detail/ops_extending_cas_based.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
// Different ARM processors have different atomic instructions. In particular,
|
||||
// architecture versions before v6 (which are still in widespread use, e.g. the
|
||||
// Intel/Marvell XScale chips like the one in the NSLU2) have only atomic swap.
|
||||
// On Linux the kernel provides some support that lets us abstract away from
|
||||
// these differences: it provides emulated CAS and barrier functions at special
|
||||
// addresses that are guaranteed not to be interrupted by the kernel. Using
|
||||
// this facility is slightly slower than inline assembler would be, but much
|
||||
// faster than a system call.
|
||||
//
|
||||
// While this emulated CAS is "strong" in the sense that it does not fail
|
||||
// "spuriously" (i.e.: it never fails to perform the exchange when the value
|
||||
// found equals the value expected), it does not return the found value on
|
||||
// failure. To satisfy the atomic API, compare_exchange_{weak|strong} must
|
||||
// return the found value on failure, and we have to manually load this value
|
||||
// after the emulated CAS reports failure. This in turn introduces a race
|
||||
// between the CAS failing (due to the "wrong" value being found) and subsequently
|
||||
// loading (which might turn up the "right" value). From an application's
|
||||
// point of view this looks like "spurious failure", and therefore the
|
||||
// emulated CAS is only good enough to provide compare_exchange_weak
|
||||
// semantics.
|
||||
|
||||
struct linux_arm_cas_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & memory_order_release) != 0)
|
||||
hardware_full_fence();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
hardware_full_fence();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_load(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if ((order & (memory_order_consume | memory_order_acquire)) != 0)
|
||||
hardware_full_fence();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT
|
||||
{
|
||||
typedef void (*kernel_dmb_t)(void);
|
||||
((kernel_dmb_t)0xffff0fa0)();
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct linux_arm_cas :
|
||||
public linux_arm_cas_base
|
||||
{
|
||||
typedef typename make_storage_type< 4u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before_store(order);
|
||||
storage = v;
|
||||
fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = storage;
|
||||
fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
storage_type tmp = expected;
|
||||
if (compare_exchange_weak(storage, tmp, desired, success_order, failure_order))
|
||||
return true;
|
||||
if (tmp != expected)
|
||||
{
|
||||
expected = tmp;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
typedef storage_type (*kernel_cmpxchg32_t)(storage_type oldval, storage_type newval, volatile storage_type* ptr);
|
||||
|
||||
if (((kernel_cmpxchg32_t)0xffff0fc0)(expected, desired, &storage) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
expected = storage;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public extending_cas_based_operations< cas_based_operations< cas_based_exchange< linux_arm_cas< Signed > > >, 1u, Signed >
|
||||
{
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public extending_cas_based_operations< cas_based_operations< cas_based_exchange< linux_arm_cas< Signed > > >, 2u, Signed >
|
||||
{
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public cas_based_operations< cas_based_exchange< linux_arm_cas< Signed > > >
|
||||
{
|
||||
};
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
linux_arm_cas_base::hardware_full_fence();
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_LINUX_ARM_HPP_INCLUDED_
|
826
boost/boost/atomic/detail/ops_msvc_arm.hpp
Normal file
826
boost/boost/atomic/detail/ops_msvc_arm.hpp
Normal file
@ -0,0 +1,826 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2012 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_msvc_arm.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_MSVC_ARM_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_MSVC_ARM_HPP_INCLUDED_
|
||||
|
||||
#include <intrin.h>
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/type_traits/make_signed.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/interlocked.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#include <boost/atomic/detail/ops_msvc_common.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_LOAD8(p) __iso_volatile_load8((const volatile __int8*)(p))
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_LOAD16(p) __iso_volatile_load16((const volatile __int16*)(p))
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_LOAD32(p) __iso_volatile_load32((const volatile __int32*)(p))
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_LOAD64(p) __iso_volatile_load64((const volatile __int64*)(p))
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_STORE8(p, v) __iso_volatile_store8((volatile __int8*)(p), (__int8)(v))
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_STORE16(p, v) __iso_volatile_store16((volatile __int16*)(p), (__int16)(v))
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_STORE32(p, v) __iso_volatile_store32((volatile __int32*)(p), (__int32)(v))
|
||||
#define BOOST_ATOMIC_DETAIL_ARM_STORE64(p, v) __iso_volatile_store64((volatile __int64*)(p), (__int64)(v))
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
// A note about memory_order_consume. Technically, this architecture allows to avoid
|
||||
// unnecessary memory barrier after consume load since it supports data dependency ordering.
|
||||
// However, some compiler optimizations may break a seemingly valid code relying on data
|
||||
// dependency tracking by injecting bogus branches to aid out of order execution.
|
||||
// This may happen not only in Boost.Atomic code but also in user's code, which we have no
|
||||
// control of. See this thread: http://lists.boost.org/Archives/boost/2014/06/213890.php.
|
||||
// For this reason we promote memory_order_consume to memory_order_acquire.
|
||||
|
||||
struct msvc_arm_operations_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT
|
||||
{
|
||||
__dmb(0xB); // _ARM_BARRIER_ISH, see armintr.h from MSVC 11 and later
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
if ((order & memory_order_release) != 0)
|
||||
hardware_full_fence();
|
||||
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
if (order == memory_order_seq_cst)
|
||||
hardware_full_fence();
|
||||
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_load(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
if ((order & (memory_order_consume | memory_order_acquire)) != 0)
|
||||
hardware_full_fence();
|
||||
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE BOOST_CONSTEXPR memory_order cas_common_order(memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
// Combine order flags together and promote memory_order_consume to memory_order_acquire
|
||||
return static_cast< memory_order >(((failure_order | success_order) & ~memory_order_consume) | (((failure_order | success_order) & memory_order_consume) << 1u));
|
||||
}
|
||||
};
|
||||
|
||||
template< typename T, typename Derived >
|
||||
struct msvc_arm_operations :
|
||||
public msvc_arm_operations_base
|
||||
{
|
||||
typedef T storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
typedef typename make_signed< storage_type >::type signed_storage_type;
|
||||
return Derived::fetch_add(storage, static_cast< storage_type >(-static_cast< signed_storage_type >(v)), order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return Derived::compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!Derived::exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
Derived::store(storage, (storage_type)0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public msvc_arm_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > >
|
||||
{
|
||||
typedef msvc_arm_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before_store(order);
|
||||
BOOST_ATOMIC_DETAIL_ARM_STORE8(&storage, v);
|
||||
base_type::fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = BOOST_ATOMIC_DETAIL_ARM_LOAD8(&storage);
|
||||
base_type::fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE8_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE8_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE8_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected, old_val;
|
||||
|
||||
switch (cas_common_order(success_order, failure_order))
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8_RELAXED(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8_ACQUIRE(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_release:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8_RELEASE(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8(&storage, desired, previous));
|
||||
break;
|
||||
}
|
||||
expected = old_val;
|
||||
|
||||
return (previous == old_val);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND8_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND8_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND8_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND8(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR8_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR8_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR8_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR8(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR8_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR8_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR8_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR8(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public msvc_arm_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > >
|
||||
{
|
||||
typedef msvc_arm_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before_store(order);
|
||||
BOOST_ATOMIC_DETAIL_ARM_STORE16(&storage, v);
|
||||
base_type::fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = BOOST_ATOMIC_DETAIL_ARM_LOAD16(&storage);
|
||||
base_type::fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE16_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE16_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE16_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected, old_val;
|
||||
|
||||
switch (cas_common_order(success_order, failure_order))
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16_RELAXED(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16_ACQUIRE(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_release:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16_RELEASE(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16(&storage, desired, previous));
|
||||
break;
|
||||
}
|
||||
expected = old_val;
|
||||
|
||||
return (previous == old_val);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND16_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND16_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND16_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND16(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR16_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR16_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR16_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR16(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR16_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR16_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR16_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR16(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public msvc_arm_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > >
|
||||
{
|
||||
typedef msvc_arm_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before_store(order);
|
||||
BOOST_ATOMIC_DETAIL_ARM_STORE32(&storage, v);
|
||||
base_type::fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = BOOST_ATOMIC_DETAIL_ARM_LOAD32(&storage);
|
||||
base_type::fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected, old_val;
|
||||
|
||||
switch (cas_common_order(success_order, failure_order))
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_RELAXED(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_ACQUIRE(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_release:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_RELEASE(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&storage, desired, previous));
|
||||
break;
|
||||
}
|
||||
expected = old_val;
|
||||
|
||||
return (previous == old_val);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public msvc_arm_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > >
|
||||
{
|
||||
typedef msvc_arm_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before_store(order);
|
||||
BOOST_ATOMIC_DETAIL_ARM_STORE64(&storage, v);
|
||||
base_type::fence_after_store(order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = BOOST_ATOMIC_DETAIL_ARM_LOAD64(&storage);
|
||||
base_type::fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE64_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE64_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE64_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected, old_val;
|
||||
|
||||
switch (cas_common_order(success_order, failure_order))
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64_RELAXED(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64_ACQUIRE(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_release:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64_RELEASE(&storage, desired, previous));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(&storage, desired, previous));
|
||||
break;
|
||||
}
|
||||
expected = old_val;
|
||||
|
||||
return (previous == old_val);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND64_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND64_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND64_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND64(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR64_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR64_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR64_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR64(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR64_RELAXED(&storage, v));
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR64_ACQUIRE(&storage, v));
|
||||
break;
|
||||
case memory_order_release:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR64_RELEASE(&storage, v));
|
||||
break;
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
default:
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR64(&storage, v));
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
if (order != memory_order_relaxed)
|
||||
msvc_arm_operations_base::hardware_full_fence();
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_ATOMIC_DETAIL_ARM_LOAD8
|
||||
#undef BOOST_ATOMIC_DETAIL_ARM_LOAD16
|
||||
#undef BOOST_ATOMIC_DETAIL_ARM_LOAD32
|
||||
#undef BOOST_ATOMIC_DETAIL_ARM_LOAD64
|
||||
#undef BOOST_ATOMIC_DETAIL_ARM_STORE8
|
||||
#undef BOOST_ATOMIC_DETAIL_ARM_STORE16
|
||||
#undef BOOST_ATOMIC_DETAIL_ARM_STORE32
|
||||
#undef BOOST_ATOMIC_DETAIL_ARM_STORE64
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_MSVC_ARM_HPP_INCLUDED_
|
38
boost/boost/atomic/detail/ops_msvc_common.hpp
Normal file
38
boost/boost/atomic/detail/ops_msvc_common.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2012 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_msvc_common.hpp
|
||||
*
|
||||
* This header contains common tools for MSVC implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_MSVC_COMMON_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_MSVC_COMMON_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// Define compiler barriers
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#define BOOST_ATOMIC_DETAIL_COMPILER_BARRIER() __memory_barrier()
|
||||
#elif defined(_MSC_VER) && !defined(_WIN32_WCE)
|
||||
extern "C" void _ReadWriteBarrier(void);
|
||||
#pragma intrinsic(_ReadWriteBarrier)
|
||||
#define BOOST_ATOMIC_DETAIL_COMPILER_BARRIER() _ReadWriteBarrier()
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_COMPILER_BARRIER
|
||||
#define BOOST_ATOMIC_DETAIL_COMPILER_BARRIER()
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_MSVC_COMMON_HPP_INCLUDED_
|
933
boost/boost/atomic/detail/ops_msvc_x86.hpp
Normal file
933
boost/boost/atomic/detail/ops_msvc_x86.hpp
Normal file
@ -0,0 +1,933 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2012 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_msvc_x86.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_MSVC_X86_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_MSVC_X86_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/type_traits/make_signed.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/interlocked.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B) || defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/atomic/detail/ops_cas_based.hpp>
|
||||
#endif
|
||||
#include <boost/atomic/detail/ops_msvc_common.hpp>
|
||||
#if !defined(_M_IX86) && !(defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8) && defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16))
|
||||
#include <boost/atomic/detail/ops_extending_cas_based.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
// frame pointer register 'ebx' modified by inline assembly code. See the note below.
|
||||
#pragma warning(disable: 4731)
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE)
|
||||
extern "C" void _mm_mfence(void);
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_mm_mfence)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
/*
|
||||
* Implementation note for asm blocks.
|
||||
*
|
||||
* http://msdn.microsoft.com/en-us/data/k1a8ss06%28v=vs.105%29
|
||||
*
|
||||
* Some SSE types require eight-byte stack alignment, forcing the compiler to emit dynamic stack-alignment code.
|
||||
* To be able to access both the local variables and the function parameters after the alignment, the compiler
|
||||
* maintains two frame pointers. If the compiler performs frame pointer omission (FPO), it will use EBP and ESP.
|
||||
* If the compiler does not perform FPO, it will use EBX and EBP. To ensure code runs correctly, do not modify EBX
|
||||
* in asm code if the function requires dynamic stack alignment as it could modify the frame pointer.
|
||||
* Either move the eight-byte aligned types out of the function, or avoid using EBX.
|
||||
*
|
||||
* Since we have no way of knowing that the compiler uses FPO, we have to always save and restore ebx
|
||||
* whenever we have to clobber it. Additionally, we disable warning C4731 above so that the compiler
|
||||
* doesn't spam about ebx use.
|
||||
*/
|
||||
|
||||
struct msvc_x86_operations_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE)
|
||||
_mm_mfence();
|
||||
#else
|
||||
long tmp;
|
||||
BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&tmp, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before(memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after(memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after_load(memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
// On x86 and x86_64 there is no need for a hardware barrier,
|
||||
// even if seq_cst memory order is requested, because all
|
||||
// seq_cst writes are implemented with lock-prefixed operations
|
||||
// or xchg which has implied lock prefix. Therefore normal loads
|
||||
// are already ordered with seq_cst stores on these architectures.
|
||||
}
|
||||
};
|
||||
|
||||
template< typename T, typename Derived >
|
||||
struct msvc_x86_operations :
|
||||
public msvc_x86_operations_base
|
||||
{
|
||||
typedef T storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_seq_cst)
|
||||
{
|
||||
fence_before(order);
|
||||
storage = v;
|
||||
fence_after(order);
|
||||
}
|
||||
else
|
||||
{
|
||||
Derived::exchange(storage, v, order);
|
||||
}
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type v = storage;
|
||||
fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
typedef typename make_signed< storage_type >::type signed_storage_type;
|
||||
return Derived::fetch_add(storage, static_cast< storage_type >(-static_cast< signed_storage_type >(v)), order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return Derived::compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!Derived::exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, (storage_type)0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public msvc_x86_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > >
|
||||
{
|
||||
typedef msvc_x86_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected;
|
||||
storage_type old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&storage, desired, previous));
|
||||
expected = old_val;
|
||||
return (previous == old_val);
|
||||
}
|
||||
|
||||
#if defined(BOOST_ATOMIC_INTERLOCKED_AND)
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND(&storage, v));
|
||||
}
|
||||
#else
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
while (!compare_exchange_strong(storage, res, res & v, order, memory_order_relaxed)) {}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_INTERLOCKED_OR)
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR(&storage, v));
|
||||
}
|
||||
#else
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
while (!compare_exchange_strong(storage, res, res | v, order, memory_order_relaxed)) {}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_INTERLOCKED_XOR)
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR(&storage, v));
|
||||
}
|
||||
#else
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type res = storage;
|
||||
while (!compare_exchange_strong(storage, res, res ^ v, order, memory_order_relaxed)) {}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > >
|
||||
{
|
||||
typedef msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD8(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE8(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected;
|
||||
storage_type old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8(&storage, desired, previous));
|
||||
expected = old_val;
|
||||
return (previous == old_val);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND8(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR8(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR8(&storage, v));
|
||||
}
|
||||
};
|
||||
|
||||
#elif defined(_M_IX86)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > >
|
||||
{
|
||||
typedef msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
__asm
|
||||
{
|
||||
mov edx, storage
|
||||
movzx eax, v
|
||||
lock xadd byte ptr [edx], al
|
||||
mov v, al
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
__asm
|
||||
{
|
||||
mov edx, storage
|
||||
movzx eax, v
|
||||
xchg byte ptr [edx], al
|
||||
mov v, al
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(success_order);
|
||||
bool success;
|
||||
__asm
|
||||
{
|
||||
mov esi, expected
|
||||
mov edi, storage
|
||||
movzx eax, byte ptr [esi]
|
||||
movzx edx, desired
|
||||
lock cmpxchg byte ptr [edi], dl
|
||||
mov byte ptr [esi], al
|
||||
sete success
|
||||
};
|
||||
// The success and failure fences are equivalent anyway
|
||||
base_type::fence_after(success_order);
|
||||
return success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
int backup;
|
||||
__asm
|
||||
{
|
||||
mov backup, ebx
|
||||
xor edx, edx
|
||||
mov edi, storage
|
||||
movzx ebx, v
|
||||
movzx eax, byte ptr [edi]
|
||||
align 16
|
||||
again:
|
||||
mov dl, al
|
||||
and dl, bl
|
||||
lock cmpxchg byte ptr [edi], dl
|
||||
jne again
|
||||
mov v, al
|
||||
mov ebx, backup
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
int backup;
|
||||
__asm
|
||||
{
|
||||
mov backup, ebx
|
||||
xor edx, edx
|
||||
mov edi, storage
|
||||
movzx ebx, v
|
||||
movzx eax, byte ptr [edi]
|
||||
align 16
|
||||
again:
|
||||
mov dl, al
|
||||
or dl, bl
|
||||
lock cmpxchg byte ptr [edi], dl
|
||||
jne again
|
||||
mov v, al
|
||||
mov ebx, backup
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
int backup;
|
||||
__asm
|
||||
{
|
||||
mov backup, ebx
|
||||
xor edx, edx
|
||||
mov edi, storage
|
||||
movzx ebx, v
|
||||
movzx eax, byte ptr [edi]
|
||||
align 16
|
||||
again:
|
||||
mov dl, al
|
||||
xor dl, bl
|
||||
lock cmpxchg byte ptr [edi], dl
|
||||
jne again
|
||||
mov v, al
|
||||
mov ebx, backup
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public extending_cas_based_operations< operations< 4u, Signed >, 1u, Signed >
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > >
|
||||
{
|
||||
typedef msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD16(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE16(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected;
|
||||
storage_type old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16(&storage, desired, previous));
|
||||
expected = old_val;
|
||||
return (previous == old_val);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND16(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR16(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR16(&storage, v));
|
||||
}
|
||||
};
|
||||
|
||||
#elif defined(_M_IX86)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > >
|
||||
{
|
||||
typedef msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
__asm
|
||||
{
|
||||
mov edx, storage
|
||||
movzx eax, v
|
||||
lock xadd word ptr [edx], ax
|
||||
mov v, ax
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
__asm
|
||||
{
|
||||
mov edx, storage
|
||||
movzx eax, v
|
||||
xchg word ptr [edx], ax
|
||||
mov v, ax
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(success_order);
|
||||
bool success;
|
||||
__asm
|
||||
{
|
||||
mov esi, expected
|
||||
mov edi, storage
|
||||
movzx eax, word ptr [esi]
|
||||
movzx edx, desired
|
||||
lock cmpxchg word ptr [edi], dx
|
||||
mov word ptr [esi], ax
|
||||
sete success
|
||||
};
|
||||
// The success and failure fences are equivalent anyway
|
||||
base_type::fence_after(success_order);
|
||||
return success;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
int backup;
|
||||
__asm
|
||||
{
|
||||
mov backup, ebx
|
||||
xor edx, edx
|
||||
mov edi, storage
|
||||
movzx ebx, v
|
||||
movzx eax, word ptr [edi]
|
||||
align 16
|
||||
again:
|
||||
mov dx, ax
|
||||
and dx, bx
|
||||
lock cmpxchg word ptr [edi], dx
|
||||
jne again
|
||||
mov v, ax
|
||||
mov ebx, backup
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
int backup;
|
||||
__asm
|
||||
{
|
||||
mov backup, ebx
|
||||
xor edx, edx
|
||||
mov edi, storage
|
||||
movzx ebx, v
|
||||
movzx eax, word ptr [edi]
|
||||
align 16
|
||||
again:
|
||||
mov dx, ax
|
||||
or dx, bx
|
||||
lock cmpxchg word ptr [edi], dx
|
||||
jne again
|
||||
mov v, ax
|
||||
mov ebx, backup
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
int backup;
|
||||
__asm
|
||||
{
|
||||
mov backup, ebx
|
||||
xor edx, edx
|
||||
mov edi, storage
|
||||
movzx ebx, v
|
||||
movzx eax, word ptr [edi]
|
||||
align 16
|
||||
again:
|
||||
mov dx, ax
|
||||
xor dx, bx
|
||||
lock cmpxchg word ptr [edi], dx
|
||||
jne again
|
||||
mov v, ax
|
||||
mov ebx, backup
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public extending_cas_based_operations< operations< 4u, Signed >, 2u, Signed >
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B)
|
||||
|
||||
template< bool Signed >
|
||||
struct msvc_dcas_x86
|
||||
{
|
||||
typedef typename make_storage_type< 8u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
// Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, 8.1.1. Guaranteed Atomic Operations:
|
||||
//
|
||||
// The Pentium processor (and newer processors since) guarantees that the following additional memory operations will always be carried out atomically:
|
||||
// * Reading or writing a quadword aligned on a 64-bit boundary
|
||||
//
|
||||
// Luckily, the memory is almost always 8-byte aligned in our case because atomic<> uses 64 bit native types for storage and dynamic memory allocations
|
||||
// have at least 8 byte alignment. The only unfortunate case is when atomic is placed on the stack and it is not 8-byte aligned (like on 32 bit Windows).
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
storage_type volatile* p = &storage;
|
||||
if (((uint32_t)p & 0x00000007) == 0)
|
||||
{
|
||||
#if defined(_M_IX86_FP) && _M_IX86_FP >= 2
|
||||
#if defined(__AVX__)
|
||||
__asm
|
||||
{
|
||||
mov edx, p
|
||||
vmovq xmm4, v
|
||||
vmovq qword ptr [edx], xmm4
|
||||
};
|
||||
#else
|
||||
__asm
|
||||
{
|
||||
mov edx, p
|
||||
movq xmm4, v
|
||||
movq qword ptr [edx], xmm4
|
||||
};
|
||||
#endif
|
||||
#else
|
||||
__asm
|
||||
{
|
||||
mov edx, p
|
||||
fild v
|
||||
fistp qword ptr [edx]
|
||||
};
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
int backup;
|
||||
__asm
|
||||
{
|
||||
mov backup, ebx
|
||||
mov edi, p
|
||||
mov ebx, dword ptr [v]
|
||||
mov ecx, dword ptr [v + 4]
|
||||
mov eax, dword ptr [edi]
|
||||
mov edx, dword ptr [edi + 4]
|
||||
align 16
|
||||
again:
|
||||
lock cmpxchg8b qword ptr [edi]
|
||||
jne again
|
||||
mov ebx, backup
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
storage_type const volatile* p = &storage;
|
||||
storage_type value;
|
||||
|
||||
if (((uint32_t)p & 0x00000007) == 0)
|
||||
{
|
||||
#if defined(_M_IX86_FP) && _M_IX86_FP >= 2
|
||||
#if defined(__AVX__)
|
||||
__asm
|
||||
{
|
||||
mov edx, p
|
||||
vmovq xmm4, qword ptr [edx]
|
||||
vmovq value, xmm4
|
||||
};
|
||||
#else
|
||||
__asm
|
||||
{
|
||||
mov edx, p
|
||||
movq xmm4, qword ptr [edx]
|
||||
movq value, xmm4
|
||||
};
|
||||
#endif
|
||||
#else
|
||||
__asm
|
||||
{
|
||||
mov edx, p
|
||||
fild qword ptr [edx]
|
||||
fistp value
|
||||
};
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// We don't care for comparison result here; the previous value will be stored into value anyway.
|
||||
// Also we don't care for ebx and ecx values, they just have to be equal to eax and edx before cmpxchg8b.
|
||||
__asm
|
||||
{
|
||||
mov edi, p
|
||||
mov eax, ebx
|
||||
mov edx, ecx
|
||||
lock cmpxchg8b qword ptr [edi]
|
||||
mov dword ptr [value], eax
|
||||
mov dword ptr [value + 4], edx
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
// MSVC-11 in 32-bit mode sometimes generates messed up code without compiler barriers,
|
||||
// even though the _InterlockedCompareExchange64 intrinsic already provides one.
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
storage_type volatile* p = &storage;
|
||||
#if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64)
|
||||
const storage_type old_val = (storage_type)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(p, desired, expected);
|
||||
const bool result = (old_val == expected);
|
||||
expected = old_val;
|
||||
#else
|
||||
bool result;
|
||||
int backup;
|
||||
__asm
|
||||
{
|
||||
mov backup, ebx
|
||||
mov edi, p
|
||||
mov esi, expected
|
||||
mov ebx, dword ptr [desired]
|
||||
mov ecx, dword ptr [desired + 4]
|
||||
mov eax, dword ptr [esi]
|
||||
mov edx, dword ptr [esi + 4]
|
||||
lock cmpxchg8b qword ptr [edi]
|
||||
mov dword ptr [esi], eax
|
||||
mov dword ptr [esi + 4], edx
|
||||
mov ebx, backup
|
||||
sete result
|
||||
};
|
||||
#endif
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
storage_type volatile* p = &storage;
|
||||
int backup;
|
||||
__asm
|
||||
{
|
||||
mov backup, ebx
|
||||
mov edi, p
|
||||
mov ebx, dword ptr [v]
|
||||
mov ecx, dword ptr [v + 4]
|
||||
mov eax, dword ptr [edi]
|
||||
mov edx, dword ptr [edi + 4]
|
||||
align 16
|
||||
again:
|
||||
lock cmpxchg8b qword ptr [edi]
|
||||
jne again
|
||||
mov ebx, backup
|
||||
mov dword ptr [v], eax
|
||||
mov dword ptr [v + 4], edx
|
||||
};
|
||||
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public cas_based_operations< msvc_dcas_x86< Signed > >
|
||||
{
|
||||
};
|
||||
|
||||
#elif defined(_M_AMD64)
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 8u, Signed > :
|
||||
public msvc_x86_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > >
|
||||
{
|
||||
typedef msvc_x86_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE64(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected;
|
||||
storage_type old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(&storage, desired, previous));
|
||||
expected = old_val;
|
||||
return (previous == old_val);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND64(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR64(&storage, v));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR64(&storage, v));
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
|
||||
|
||||
template< bool Signed >
|
||||
struct msvc_dcas_x86_64
|
||||
{
|
||||
typedef typename make_storage_type< 16u, Signed >::type storage_type;
|
||||
typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type value = const_cast< storage_type& >(storage);
|
||||
while (!BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE128(&storage, v, &value)) {}
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type value = storage_type();
|
||||
BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE128(&storage, value, &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE128(&storage, desired, &expected);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 16u, Signed > :
|
||||
public cas_based_operations< cas_based_exchange< msvc_dcas_x86_64< Signed > > >
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B)
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
if (order == memory_order_seq_cst)
|
||||
msvc_x86_operations_base::hardware_full_fence();
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_MSVC_X86_HPP_INCLUDED_
|
218
boost/boost/atomic/detail/ops_windows.hpp
Normal file
218
boost/boost/atomic/detail/ops_windows.hpp
Normal file
@ -0,0 +1,218 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2012 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/ops_windows.hpp
|
||||
*
|
||||
* This header contains implementation of the \c operations template.
|
||||
*
|
||||
* This implementation is the most basic version for Windows. It should
|
||||
* work for any non-MSVC-like compilers as long as there are Interlocked WinAPI
|
||||
* functions available. This version is also used for WinCE.
|
||||
*
|
||||
* Notably, this implementation is not as efficient as other
|
||||
* versions based on compiler intrinsics.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_OPS_WINDOWS_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_OPS_WINDOWS_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/type_traits/make_signed.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/interlocked.hpp>
|
||||
#include <boost/atomic/detail/storage_type.hpp>
|
||||
#include <boost/atomic/detail/operations_fwd.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#include <boost/atomic/detail/ops_msvc_common.hpp>
|
||||
#include <boost/atomic/detail/ops_extending_cas_based.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
struct windows_operations_base
|
||||
{
|
||||
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
|
||||
|
||||
static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT
|
||||
{
|
||||
long tmp;
|
||||
BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&tmp, 0);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_before(memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void fence_after(memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
};
|
||||
|
||||
template< typename T, typename Derived >
|
||||
struct windows_operations :
|
||||
public windows_operations_base
|
||||
{
|
||||
typedef T storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
Derived::exchange(storage, v, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return Derived::fetch_add(const_cast< storage_type volatile& >(storage), (storage_type)0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
typedef typename make_signed< storage_type >::type signed_storage_type;
|
||||
return Derived::fetch_add(storage, static_cast< storage_type >(-static_cast< signed_storage_type >(v)), order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_weak(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
return Derived::compare_exchange_strong(storage, expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
return !!Derived::exchange(storage, (storage_type)1, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
store(storage, (storage_type)0, order);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 4u, Signed > :
|
||||
public windows_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > >
|
||||
{
|
||||
typedef windows_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type;
|
||||
typedef typename base_type::storage_type storage_type;
|
||||
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(&storage, v));
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_EXCHANGE(&storage, v));
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool compare_exchange_strong(
|
||||
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type previous = expected;
|
||||
base_type::fence_before(success_order);
|
||||
storage_type old_val = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(&storage, desired, previous));
|
||||
expected = old_val;
|
||||
// The success and failure fences are the same anyway
|
||||
base_type::fence_after(success_order);
|
||||
return (previous == old_val);
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(BOOST_ATOMIC_INTERLOCKED_AND)
|
||||
base_type::fence_before(order);
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_AND(&storage, v));
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
#else
|
||||
storage_type res = storage;
|
||||
while (!compare_exchange_strong(storage, res, res & v, order, memory_order_relaxed)) {}
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(BOOST_ATOMIC_INTERLOCKED_OR)
|
||||
base_type::fence_before(order);
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_OR(&storage, v));
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
#else
|
||||
storage_type res = storage;
|
||||
while (!compare_exchange_strong(storage, res, res | v, order, memory_order_relaxed)) {}
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(BOOST_ATOMIC_INTERLOCKED_XOR)
|
||||
base_type::fence_before(order);
|
||||
v = static_cast< storage_type >(BOOST_ATOMIC_INTERLOCKED_XOR(&storage, v));
|
||||
base_type::fence_after(order);
|
||||
return v;
|
||||
#else
|
||||
storage_type res = storage;
|
||||
while (!compare_exchange_strong(storage, res, res ^ v, order, memory_order_relaxed)) {}
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 1u, Signed > :
|
||||
public extending_cas_based_operations< operations< 4u, Signed >, 1u, Signed >
|
||||
{
|
||||
};
|
||||
|
||||
template< bool Signed >
|
||||
struct operations< 2u, Signed > :
|
||||
public extending_cas_based_operations< operations< 4u, Signed >, 2u, Signed >
|
||||
{
|
||||
};
|
||||
|
||||
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
if (order == memory_order_seq_cst)
|
||||
windows_operations_base::hardware_full_fence();
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order != memory_order_relaxed)
|
||||
BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_OPS_WINDOWS_HPP_INCLUDED_
|
43
boost/boost/atomic/detail/pause.hpp
Normal file
43
boost/boost/atomic/detail/pause.hpp
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* (C) Copyright 2013 Tim Blechmann
|
||||
* (C) Copyright 2013 Andrey Semashev
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_PAUSE_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_PAUSE_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86))
|
||||
extern "C" void _mm_pause(void);
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma intrinsic(_mm_pause)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
BOOST_FORCEINLINE void pause() BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86))
|
||||
_mm_pause();
|
||||
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
__asm__ __volatile__("pause;");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_PAUSE_HPP_INCLUDED_
|
121
boost/boost/atomic/detail/platform.hpp
Normal file
121
boost/boost/atomic/detail/platform.hpp
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/platform.hpp
|
||||
*
|
||||
* This header defines macros for the target platform detection
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_PLATFORM_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_ATOMIC_FORCE_FALLBACK)
|
||||
|
||||
// Compiler-based backends
|
||||
#if (defined(__ibmxl__) || defined(__IBMCPP__)) && defined(__PPC__)
|
||||
|
||||
// IBM XL C++ Compiler has to be checked before GCC/Clang as it pretends to be one but does not support __atomic* intrinsics.
|
||||
// It does support GCC inline assembler though.
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_ppc
|
||||
|
||||
#elif ((defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 407)) ||\
|
||||
(defined(BOOST_CLANG) && ((__clang_major__ * 100 + __clang_minor__) >= 302))) &&\
|
||||
(\
|
||||
(__GCC_ATOMIC_BOOL_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_CHAR_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_SHORT_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_INT_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_LONG_LOCK_FREE + 0) == 2 ||\
|
||||
(__GCC_ATOMIC_LLONG_LOCK_FREE + 0) == 2\
|
||||
)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_atomic
|
||||
|
||||
#elif (defined(__GNUC__) || defined(__SUNPRO_CC)) && (defined(__i386__) || defined(__x86_64__))
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_x86
|
||||
|
||||
#elif defined(__GNUC__) && (defined(__POWERPC__) || defined(__PPC__))
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_ppc
|
||||
|
||||
// This list of ARM architecture versions comes from Apple's arm/arch.h header.
|
||||
// I don't know how complete it is.
|
||||
#elif defined(__GNUC__) &&\
|
||||
(\
|
||||
defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) ||\
|
||||
defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) ||\
|
||||
defined(__ARM_ARCH_6ZK__) ||\
|
||||
defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) ||\
|
||||
defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) ||\
|
||||
defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__)\
|
||||
)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_arm
|
||||
|
||||
#elif (defined(__GNUC__) || defined(__SUNPRO_CC)) && (defined(__sparcv8plus) || defined(__sparc_v9__))
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_sparc
|
||||
|
||||
#elif defined(__GNUC__) && defined(__alpha__)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_alpha
|
||||
|
||||
#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 401) &&\
|
||||
(\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) ||\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) ||\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) ||\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) ||\
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)\
|
||||
)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_sync
|
||||
|
||||
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM msvc_x86
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM msvc_arm
|
||||
|
||||
#endif
|
||||
|
||||
// OS-based backends
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_PLATFORM)
|
||||
|
||||
#if defined(__linux__) && defined(__arm__)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM linux_arm
|
||||
|
||||
#elif defined(BOOST_WINDOWS) || defined(_WIN32_CE)
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM windows
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !defined(BOOST_ATOMIC_DETAIL_PLATFORM)
|
||||
|
||||
#endif // !defined(BOOST_ATOMIC_FORCE_FALLBACK)
|
||||
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_PLATFORM)
|
||||
#define BOOST_ATOMIC_DETAIL_PLATFORM emulated
|
||||
#define BOOST_ATOMIC_EMULATED
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_DETAIL_HEADER(prefix) <BOOST_JOIN(prefix, BOOST_ATOMIC_DETAIL_PLATFORM).hpp>
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_PLATFORM_HPP_INCLUDED_
|
280
boost/boost/atomic/detail/storage_type.hpp
Normal file
280
boost/boost/atomic/detail/storage_type.hpp
Normal file
@ -0,0 +1,280 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2012 Tim Blechmann
|
||||
* Copyright (c) 2013 - 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/storage_type.hpp
|
||||
*
|
||||
* This header defines underlying types used as storage
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_STORAGE_TYPE_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_STORAGE_TYPE_HPP_INCLUDED_
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP) || !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY)
|
||||
#include <cstring>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
template< typename T >
|
||||
BOOST_FORCEINLINE void non_atomic_load(T const volatile& from, T& to) BOOST_NOEXCEPT
|
||||
{
|
||||
to = from;
|
||||
}
|
||||
|
||||
template< std::size_t Size >
|
||||
struct buffer_storage
|
||||
{
|
||||
BOOST_ALIGNMENT(16) unsigned char data[Size];
|
||||
|
||||
BOOST_FORCEINLINE bool operator! () const BOOST_NOEXCEPT
|
||||
{
|
||||
return (data[0] == 0u && BOOST_ATOMIC_DETAIL_MEMCMP(data, data + 1, Size - 1) == 0);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool operator== (buffer_storage const& that) const BOOST_NOEXCEPT
|
||||
{
|
||||
return BOOST_ATOMIC_DETAIL_MEMCMP(data, that.data, Size) == 0;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE bool operator!= (buffer_storage const& that) const BOOST_NOEXCEPT
|
||||
{
|
||||
return BOOST_ATOMIC_DETAIL_MEMCMP(data, that.data, Size) != 0;
|
||||
}
|
||||
};
|
||||
|
||||
template< std::size_t Size >
|
||||
BOOST_FORCEINLINE void non_atomic_load(buffer_storage< Size > const volatile& from, buffer_storage< Size >& to) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ATOMIC_DETAIL_MEMCPY(to.data, const_cast< unsigned char const* >(from.data), Size);
|
||||
}
|
||||
|
||||
template< std::size_t Size, bool Signed >
|
||||
struct make_storage_type
|
||||
{
|
||||
typedef buffer_storage< Size > type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type const& v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 1u, false >
|
||||
{
|
||||
typedef boost::uint8_t type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 1u, true >
|
||||
{
|
||||
typedef boost::int8_t type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 2u, false >
|
||||
{
|
||||
typedef boost::uint16_t type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
BOOST_ALIGNMENT(2) type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 2u, true >
|
||||
{
|
||||
typedef boost::int16_t type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
BOOST_ALIGNMENT(2) type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 4u, false >
|
||||
{
|
||||
typedef boost::uint32_t type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
BOOST_ALIGNMENT(4) type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 4u, true >
|
||||
{
|
||||
typedef boost::int32_t type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
BOOST_ALIGNMENT(4) type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 8u, false >
|
||||
{
|
||||
typedef boost::uint64_t type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
BOOST_ALIGNMENT(8) type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 8u, true >
|
||||
{
|
||||
typedef boost::int64_t type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
BOOST_ALIGNMENT(8) type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
#if defined(BOOST_HAS_INT128)
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 16u, false >
|
||||
{
|
||||
typedef boost::uint128_type type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
BOOST_ALIGNMENT(16) type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
template< >
|
||||
struct make_storage_type< 16u, true >
|
||||
{
|
||||
typedef boost::int128_type type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
BOOST_ALIGNMENT(16) type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
#elif !defined(BOOST_NO_ALIGNMENT)
|
||||
|
||||
struct storage128_t
|
||||
{
|
||||
boost::uint64_t data[2];
|
||||
|
||||
BOOST_FORCEINLINE bool operator! () const BOOST_NOEXCEPT
|
||||
{
|
||||
return data[0] == 0 && data[1] == 0;
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_FORCEINLINE bool operator== (storage128_t const& left, storage128_t const& right) BOOST_NOEXCEPT
|
||||
{
|
||||
return left.data[0] == right.data[0] && left.data[1] == right.data[1];
|
||||
}
|
||||
BOOST_FORCEINLINE bool operator!= (storage128_t const& left, storage128_t const& right) BOOST_NOEXCEPT
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE void non_atomic_load(storage128_t const volatile& from, storage128_t& to) BOOST_NOEXCEPT
|
||||
{
|
||||
to.data[0] = from.data[0];
|
||||
to.data[1] = from.data[1];
|
||||
}
|
||||
|
||||
template< bool Signed >
|
||||
struct make_storage_type< 16u, Signed >
|
||||
{
|
||||
typedef storage128_t type;
|
||||
|
||||
struct aligned
|
||||
{
|
||||
BOOST_ALIGNMENT(16) type value;
|
||||
|
||||
BOOST_DEFAULTED_FUNCTION(aligned(), {})
|
||||
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type const& v) BOOST_NOEXCEPT : value(v) {}
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template< typename T >
|
||||
struct storage_size_of
|
||||
{
|
||||
enum _
|
||||
{
|
||||
size = sizeof(T),
|
||||
value = (size == 3 ? 4 : (size >= 5 && size <= 7 ? 8 : (size >= 9 && size <= 15 ? 16 : size)))
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace atomics
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_STORAGE_TYPE_HPP_INCLUDED_
|
67
boost/boost/atomic/fences.hpp
Normal file
67
boost/boost/atomic/fences.hpp
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2011 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/fences.hpp
|
||||
*
|
||||
* This header contains definition of \c atomic_thread_fence and \c atomic_signal_fence functions.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_FENCES_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_FENCES_HPP_INCLUDED_
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/capabilities.hpp>
|
||||
#include <boost/atomic/detail/operations.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE,
|
||||
* see comment for convert_memory_order_to_gcc in ops_gcc_atomic.hpp.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace atomics {
|
||||
|
||||
#if BOOST_ATOMIC_THREAD_FENCE > 0
|
||||
BOOST_FORCEINLINE void atomic_thread_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
detail::thread_fence(order);
|
||||
}
|
||||
#else
|
||||
BOOST_FORCEINLINE void atomic_thread_fence(memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
detail::lockpool::thread_fence();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BOOST_ATOMIC_SIGNAL_FENCE > 0
|
||||
BOOST_FORCEINLINE void atomic_signal_fence(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
detail::signal_fence(order);
|
||||
}
|
||||
#else
|
||||
BOOST_FORCEINLINE void atomic_signal_fence(memory_order) BOOST_NOEXCEPT
|
||||
{
|
||||
detail::lockpool::signal_fence();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace atomics
|
||||
|
||||
using atomics::atomic_thread_fence;
|
||||
using atomics::atomic_signal_fence;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ATOMIC_FENCES_HPP_INCLUDED_
|
389
boost/boost/bind/mem_fn.hpp
Normal file
389
boost/boost/bind/mem_fn.hpp
Normal file
@ -0,0 +1,389 @@
|
||||
#ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED
|
||||
#define BOOST_BIND_MEM_FN_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// mem_fn.hpp - a generalization of std::mem_fun[_ref]
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2001 David Abrahams
|
||||
// Copyright (c) 2003-2005 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/get_pointer.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#if defined(BOOST_NO_VOID_RETURNS)
|
||||
|
||||
#define BOOST_MEM_FN_CLASS_F , class F
|
||||
#define BOOST_MEM_FN_TYPEDEF(X)
|
||||
|
||||
namespace _mfi // mem_fun_impl
|
||||
{
|
||||
|
||||
template<class V> struct mf
|
||||
{
|
||||
|
||||
#define BOOST_MEM_FN_RETURN return
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X
|
||||
#define BOOST_MEM_FN_CC
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_CDECL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
|
||||
#define BOOST_MEM_FN_CC __cdecl
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
|
||||
#define BOOST_MEM_FN_CC __stdcall
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#undef BOOST_MEM_FN_RETURN
|
||||
|
||||
}; // struct mf<V>
|
||||
|
||||
template<> struct mf<void>
|
||||
{
|
||||
|
||||
#define BOOST_MEM_FN_RETURN
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X
|
||||
#define BOOST_MEM_FN_CC
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_CDECL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
|
||||
#define BOOST_MEM_FN_CC __cdecl
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
|
||||
#define BOOST_MEM_FN_CC __stdcall
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#undef BOOST_MEM_FN_RETURN
|
||||
|
||||
}; // struct mf<void>
|
||||
|
||||
#undef BOOST_MEM_FN_CLASS_F
|
||||
#undef BOOST_MEM_FN_TYPEDEF_F
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X
|
||||
#define BOOST_MEM_FN_NAME2(X) inner_##X
|
||||
#define BOOST_MEM_FN_CC
|
||||
|
||||
#include <boost/bind/mem_fn_vw.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_NAME2
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_CDECL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_cdecl
|
||||
#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl
|
||||
#define BOOST_MEM_FN_CC __cdecl
|
||||
|
||||
#include <boost/bind/mem_fn_vw.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_NAME2
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
||||
#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall
|
||||
#define BOOST_MEM_FN_CC __stdcall
|
||||
|
||||
#include <boost/bind/mem_fn_vw.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_NAME2
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_fastcall
|
||||
#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#include <boost/bind/mem_fn_vw.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_NAME2
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace _mfi
|
||||
|
||||
#else // #ifdef BOOST_NO_VOID_RETURNS
|
||||
|
||||
#define BOOST_MEM_FN_CLASS_F
|
||||
#define BOOST_MEM_FN_TYPEDEF(X) typedef X;
|
||||
|
||||
namespace _mfi
|
||||
{
|
||||
|
||||
#define BOOST_MEM_FN_RETURN return
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X
|
||||
#define BOOST_MEM_FN_CC
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_CDECL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_cdecl
|
||||
#define BOOST_MEM_FN_CC __cdecl
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
||||
#define BOOST_MEM_FN_CC __stdcall
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#undef BOOST_MEM_FN_RETURN
|
||||
|
||||
} // namespace _mfi
|
||||
|
||||
#undef BOOST_MEM_FN_CLASS_F
|
||||
#undef BOOST_MEM_FN_TYPEDEF
|
||||
|
||||
#endif // #ifdef BOOST_NO_VOID_RETURNS
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X
|
||||
#define BOOST_MEM_FN_CC
|
||||
|
||||
#include <boost/bind/mem_fn_cc.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_CDECL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_cdecl
|
||||
#define BOOST_MEM_FN_CC __cdecl
|
||||
|
||||
#include <boost/bind/mem_fn_cc.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
||||
#define BOOST_MEM_FN_CC __stdcall
|
||||
|
||||
#include <boost/bind/mem_fn_cc.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#include <boost/bind/mem_fn_cc.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#endif
|
||||
|
||||
// data member support
|
||||
|
||||
namespace _mfi
|
||||
{
|
||||
|
||||
template<class R, class T> class dm
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R const & result_type;
|
||||
typedef T const * argument_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F);
|
||||
F f_;
|
||||
|
||||
template<class U> R const & call(U & u, T const *) const
|
||||
{
|
||||
return (u.*f_);
|
||||
}
|
||||
|
||||
template<class U> R const & call(U & u, void const *) const
|
||||
{
|
||||
return (get_pointer(u)->*f_);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit dm(F f): f_(f) {}
|
||||
|
||||
R & operator()(T * p) const
|
||||
{
|
||||
return (p->*f_);
|
||||
}
|
||||
|
||||
R const & operator()(T const * p) const
|
||||
{
|
||||
return (p->*f_);
|
||||
}
|
||||
|
||||
template<class U> R const & operator()(U const & u) const
|
||||
{
|
||||
return call(u, &u);
|
||||
}
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200)
|
||||
|
||||
R & operator()(T & t) const
|
||||
{
|
||||
return (t.*f_);
|
||||
}
|
||||
|
||||
R const & operator()(T const & t) const
|
||||
{
|
||||
return (t.*f_);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool operator==(dm const & rhs) const
|
||||
{
|
||||
return f_ == rhs.f_;
|
||||
}
|
||||
|
||||
bool operator!=(dm const & rhs) const
|
||||
{
|
||||
return f_ != rhs.f_;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace _mfi
|
||||
|
||||
template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f)
|
||||
{
|
||||
return _mfi::dm<R, T>(f);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED
|
103
boost/boost/bind/mem_fn_cc.hpp
Normal file
103
boost/boost/bind/mem_fn_cc.hpp
Normal file
@ -0,0 +1,103 @@
|
||||
//
|
||||
// bind/mem_fn_cc.hpp - support for different calling conventions
|
||||
//
|
||||
// Do not include this header directly.
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
||||
//
|
||||
|
||||
template<class R, class T> _mfi::BOOST_MEM_FN_NAME(mf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) ())
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf0)<R, T>(f);
|
||||
}
|
||||
|
||||
template<class R, class T> _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) () const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f);
|
||||
}
|
1047
boost/boost/bind/mem_fn_template.hpp
Normal file
1047
boost/boost/bind/mem_fn_template.hpp
Normal file
File diff suppressed because it is too large
Load Diff
130
boost/boost/bind/mem_fn_vw.hpp
Normal file
130
boost/boost/bind/mem_fn_vw.hpp
Normal file
@ -0,0 +1,130 @@
|
||||
//
|
||||
// bind/mem_fn_vw.hpp - void return helper wrappers
|
||||
//
|
||||
// Do not include this header directly
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
||||
//
|
||||
|
||||
template<class R, class T> struct BOOST_MEM_FN_NAME(mf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, R (BOOST_MEM_FN_CC T::*) ()>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) ();
|
||||
explicit BOOST_MEM_FN_NAME(mf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T> struct BOOST_MEM_FN_NAME(cmf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, R (BOOST_MEM_FN_CC T::*) () const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) () const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(mf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1);
|
||||
explicit BOOST_MEM_FN_NAME(mf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(cmf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(mf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2);
|
||||
explicit BOOST_MEM_FN_NAME(mf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(cmf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(mf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3);
|
||||
explicit BOOST_MEM_FN_NAME(mf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(cmf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(mf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4);
|
||||
explicit BOOST_MEM_FN_NAME(mf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(cmf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(mf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5);
|
||||
explicit BOOST_MEM_FN_NAME(mf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(cmf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(mf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6);
|
||||
explicit BOOST_MEM_FN_NAME(mf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(cmf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(mf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7);
|
||||
explicit BOOST_MEM_FN_NAME(mf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(cmf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(mf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8);
|
||||
explicit BOOST_MEM_FN_NAME(mf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(cmf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {}
|
||||
};
|
||||
|
17
boost/boost/checked_delete.hpp
Normal file
17
boost/boost/checked_delete.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Glen Fernandes
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_CHECKED_DELETE_HPP
|
||||
#define BOOST_CHECKED_DELETE_HPP
|
||||
|
||||
// The header file at this path is deprecated;
|
||||
// use boost/core/checked_delete.hpp instead.
|
||||
|
||||
#include <boost/core/checked_delete.hpp>
|
||||
|
||||
#endif
|
45
boost/boost/concept/assert.hpp
Normal file
45
boost/boost/concept/assert.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright David Abrahams 2006. 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)
|
||||
#ifndef BOOST_CONCEPT_ASSERT_DWA2006430_HPP
|
||||
# define BOOST_CONCEPT_ASSERT_DWA2006430_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
|
||||
// The old protocol used a constraints() member function in concept
|
||||
// checking classes. If the compiler supports SFINAE, we can detect
|
||||
// that function and seamlessly support the old concept checking
|
||||
// classes. In this release, backward compatibility with the old
|
||||
// concept checking classes is enabled by default, where available.
|
||||
// The old protocol is deprecated, though, and backward compatibility
|
||||
// will no longer be the default in the next release.
|
||||
|
||||
# if !defined(BOOST_NO_OLD_CONCEPT_SUPPORT) \
|
||||
&& !defined(BOOST_NO_SFINAE) \
|
||||
\
|
||||
&& !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4))
|
||||
|
||||
// Note: gcc-2.96 through 3.3.x have some SFINAE, but no ability to
|
||||
// check for the presence of particularmember functions.
|
||||
|
||||
# define BOOST_OLD_CONCEPT_SUPPORT
|
||||
|
||||
# endif
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# include <boost/concept/detail/msvc.hpp>
|
||||
# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
# include <boost/concept/detail/borland.hpp>
|
||||
# else
|
||||
# include <boost/concept/detail/general.hpp>
|
||||
# endif
|
||||
|
||||
// Usage, in class or function context:
|
||||
//
|
||||
// BOOST_CONCEPT_ASSERT((UnaryFunctionConcept<F,bool,int>));
|
||||
//
|
||||
# define BOOST_CONCEPT_ASSERT(ModelInParens) \
|
||||
BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
|
||||
|
||||
#endif // BOOST_CONCEPT_ASSERT_DWA2006430_HPP
|
16
boost/boost/concept/detail/backward_compatibility.hpp
Normal file
16
boost/boost/concept/detail/backward_compatibility.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright David Abrahams 2009. 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)
|
||||
#ifndef BOOST_CONCEPT_BACKWARD_COMPATIBILITY_DWA200968_HPP
|
||||
# define BOOST_CONCEPT_BACKWARD_COMPATIBILITY_DWA200968_HPP
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace concepts {}
|
||||
|
||||
# if defined(BOOST_HAS_CONCEPTS) && !defined(BOOST_CONCEPT_NO_BACKWARD_KEYWORD)
|
||||
namespace concept = concepts;
|
||||
# endif
|
||||
} // namespace boost::concept
|
||||
|
||||
#endif // BOOST_CONCEPT_BACKWARD_COMPATIBILITY_DWA200968_HPP
|
30
boost/boost/concept/detail/borland.hpp
Normal file
30
boost/boost/concept/detail/borland.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright David Abrahams 2006. 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)
|
||||
#ifndef BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP
|
||||
# define BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP
|
||||
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/concept/detail/backward_compatibility.hpp>
|
||||
|
||||
namespace boost { namespace concepts {
|
||||
|
||||
template <class ModelFnPtr>
|
||||
struct require;
|
||||
|
||||
template <class Model>
|
||||
struct require<void(*)(Model)>
|
||||
{
|
||||
enum { instantiate = sizeof((((Model*)0)->~Model()), 3) };
|
||||
};
|
||||
|
||||
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
|
||||
enum \
|
||||
{ \
|
||||
BOOST_PP_CAT(boost_concept_check,__LINE__) = \
|
||||
boost::concepts::require<ModelFnPtr>::instantiate \
|
||||
}
|
||||
|
||||
}} // namespace boost::concept
|
||||
|
||||
#endif // BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP
|
34
boost/boost/concept/detail/concept_def.hpp
Normal file
34
boost/boost/concept/detail/concept_def.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright David Abrahams 2006. 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)
|
||||
#ifndef BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP
|
||||
# define BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP
|
||||
# include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
# include <boost/preprocessor/seq/enum.hpp>
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
#endif // BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP
|
||||
|
||||
// BOOST_concept(SomeName, (p1)(p2)...(pN))
|
||||
//
|
||||
// Expands to "template <class p1, class p2, ...class pN> struct SomeName"
|
||||
//
|
||||
// Also defines an equivalent SomeNameConcept for backward compatibility.
|
||||
// Maybe in the next release we can kill off the "Concept" suffix for good.
|
||||
# define BOOST_concept(name, params) \
|
||||
template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \
|
||||
struct name; /* forward declaration */ \
|
||||
\
|
||||
template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \
|
||||
struct BOOST_PP_CAT(name,Concept) \
|
||||
: name< BOOST_PP_SEQ_ENUM(params) > \
|
||||
{ \
|
||||
}; \
|
||||
\
|
||||
template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \
|
||||
struct name
|
||||
|
||||
// Helper for BOOST_concept, above.
|
||||
# define BOOST_CONCEPT_typename(r, ignored, index, t) \
|
||||
BOOST_PP_COMMA_IF(index) typename t
|
||||
|
5
boost/boost/concept/detail/concept_undef.hpp
Normal file
5
boost/boost/concept/detail/concept_undef.hpp
Normal file
@ -0,0 +1,5 @@
|
||||
// Copyright David Abrahams 2006. 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)
|
||||
# undef BOOST_concept_typename
|
||||
# undef BOOST_concept
|
77
boost/boost/concept/detail/general.hpp
Normal file
77
boost/boost/concept/detail/general.hpp
Normal file
@ -0,0 +1,77 @@
|
||||
// Copyright David Abrahams 2006. 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)
|
||||
#ifndef BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
|
||||
# define BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/concept/detail/backward_compatibility.hpp>
|
||||
|
||||
# ifdef BOOST_OLD_CONCEPT_SUPPORT
|
||||
# include <boost/concept/detail/has_constraints.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# endif
|
||||
|
||||
// This implementation works on Comeau and GCC, all the way back to
|
||||
// 2.95
|
||||
namespace boost { namespace concepts {
|
||||
|
||||
template <class ModelFn>
|
||||
struct requirement_;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <void(*)()> struct instantiate {};
|
||||
}
|
||||
|
||||
template <class Model>
|
||||
struct requirement
|
||||
{
|
||||
static void failed() { ((Model*)0)->~Model(); }
|
||||
};
|
||||
|
||||
struct failed {};
|
||||
|
||||
template <class Model>
|
||||
struct requirement<failed ************ Model::************>
|
||||
{
|
||||
static void failed() { ((Model*)0)->~Model(); }
|
||||
};
|
||||
|
||||
# ifdef BOOST_OLD_CONCEPT_SUPPORT
|
||||
|
||||
template <class Model>
|
||||
struct constraint
|
||||
{
|
||||
static void failed() { ((Model*)0)->constraints(); }
|
||||
};
|
||||
|
||||
template <class Model>
|
||||
struct requirement_<void(*)(Model)>
|
||||
: mpl::if_<
|
||||
concepts::not_satisfied<Model>
|
||||
, constraint<Model>
|
||||
, requirement<failed ************ Model::************>
|
||||
>::type
|
||||
{};
|
||||
|
||||
# else
|
||||
|
||||
// For GCC-2.x, these can't have exactly the same name
|
||||
template <class Model>
|
||||
struct requirement_<void(*)(Model)>
|
||||
: requirement<failed ************ Model::************>
|
||||
{};
|
||||
|
||||
# endif
|
||||
|
||||
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
|
||||
typedef ::boost::concepts::detail::instantiate< \
|
||||
&::boost::concepts::requirement_<ModelFnPtr>::failed> \
|
||||
BOOST_PP_CAT(boost_concept_check,__LINE__) \
|
||||
BOOST_ATTRIBUTE_UNUSED
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
|
50
boost/boost/concept/detail/has_constraints.hpp
Normal file
50
boost/boost/concept/detail/has_constraints.hpp
Normal file
@ -0,0 +1,50 @@
|
||||
// Copyright David Abrahams 2006. 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)
|
||||
#ifndef BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP
|
||||
# define BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP
|
||||
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
# include <boost/concept/detail/backward_compatibility.hpp>
|
||||
|
||||
namespace boost { namespace concepts {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Here we implement the metafunction that detects whether a
|
||||
// constraints metafunction exists
|
||||
typedef char yes;
|
||||
typedef char (&no)[2];
|
||||
|
||||
template <class Model, void (Model::*)()>
|
||||
struct wrap_constraints {};
|
||||
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580) || defined(__CUDACC__)
|
||||
// Work around the following bogus error in Sun Studio 11, by
|
||||
// turning off the has_constraints function entirely:
|
||||
// Error: complex expression not allowed in dependent template
|
||||
// argument expression
|
||||
inline no has_constraints_(...);
|
||||
#else
|
||||
template <class Model>
|
||||
inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
|
||||
inline no has_constraints_(...);
|
||||
#endif
|
||||
}
|
||||
|
||||
// This would be called "detail::has_constraints," but it has a strong
|
||||
// tendency to show up in error messages.
|
||||
template <class Model>
|
||||
struct not_satisfied
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool
|
||||
, value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) );
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
}} // namespace boost::concepts::detail
|
||||
|
||||
#endif // BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP
|
123
boost/boost/concept/detail/msvc.hpp
Normal file
123
boost/boost/concept/detail/msvc.hpp
Normal file
@ -0,0 +1,123 @@
|
||||
// Copyright David Abrahams 2006. 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)
|
||||
#ifndef BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
|
||||
# define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
|
||||
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/concept/detail/backward_compatibility.hpp>
|
||||
# include <boost/config.hpp>
|
||||
|
||||
# ifdef BOOST_OLD_CONCEPT_SUPPORT
|
||||
# include <boost/concept/detail/has_constraints.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# endif
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4100)
|
||||
# endif
|
||||
|
||||
namespace boost { namespace concepts {
|
||||
|
||||
|
||||
template <class Model>
|
||||
struct check
|
||||
{
|
||||
virtual void failed(Model* x)
|
||||
{
|
||||
x->~Model();
|
||||
}
|
||||
};
|
||||
|
||||
# ifndef BOOST_NO_PARTIAL_SPECIALIZATION
|
||||
struct failed {};
|
||||
template <class Model>
|
||||
struct check<failed ************ Model::************>
|
||||
{
|
||||
virtual void failed(Model* x)
|
||||
{
|
||||
x->~Model();
|
||||
}
|
||||
};
|
||||
# endif
|
||||
|
||||
# ifdef BOOST_OLD_CONCEPT_SUPPORT
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// No need for a virtual function here, since evaluating
|
||||
// not_satisfied below will have already instantiated the
|
||||
// constraints() member.
|
||||
struct constraint {};
|
||||
}
|
||||
|
||||
template <class Model>
|
||||
struct require
|
||||
: mpl::if_c<
|
||||
not_satisfied<Model>::value
|
||||
, detail::constraint
|
||||
# ifndef BOOST_NO_PARTIAL_SPECIALIZATION
|
||||
, check<Model>
|
||||
# else
|
||||
, check<failed ************ Model::************>
|
||||
# endif
|
||||
>::type
|
||||
{};
|
||||
|
||||
# else
|
||||
|
||||
template <class Model>
|
||||
struct require
|
||||
# ifndef BOOST_NO_PARTIAL_SPECIALIZATION
|
||||
: check<Model>
|
||||
# else
|
||||
: check<failed ************ Model::************>
|
||||
# endif
|
||||
{};
|
||||
|
||||
# endif
|
||||
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
|
||||
//
|
||||
// The iterator library sees some really strange errors unless we
|
||||
// do things this way.
|
||||
//
|
||||
template <class Model>
|
||||
struct require<void(*)(Model)>
|
||||
{
|
||||
virtual void failed(Model*)
|
||||
{
|
||||
require<Model>();
|
||||
}
|
||||
};
|
||||
|
||||
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
|
||||
enum \
|
||||
{ \
|
||||
BOOST_PP_CAT(boost_concept_check,__LINE__) = \
|
||||
sizeof(::boost::concepts::require<ModelFnPtr>) \
|
||||
}
|
||||
|
||||
# else // Not vc-7.1
|
||||
|
||||
template <class Model>
|
||||
require<Model>
|
||||
require_(void(*)(Model));
|
||||
|
||||
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
|
||||
enum \
|
||||
{ \
|
||||
BOOST_PP_CAT(boost_concept_check,__LINE__) = \
|
||||
sizeof(::boost::concepts::require_((ModelFnPtr)0)) \
|
||||
}
|
||||
|
||||
# endif
|
||||
}}
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
# endif
|
||||
|
||||
#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
|
36
boost/boost/concept/usage.hpp
Normal file
36
boost/boost/concept/usage.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright David Abrahams 2006. 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)
|
||||
#ifndef BOOST_CONCEPT_USAGE_DWA2006919_HPP
|
||||
# define BOOST_CONCEPT_USAGE_DWA2006919_HPP
|
||||
|
||||
# include <boost/concept/assert.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
# include <boost/concept/detail/backward_compatibility.hpp>
|
||||
|
||||
namespace boost { namespace concepts {
|
||||
|
||||
template <class Model>
|
||||
struct usage_requirements
|
||||
{
|
||||
~usage_requirements() { ((Model*)0)->~Model(); }
|
||||
};
|
||||
|
||||
# if BOOST_WORKAROUND(__GNUC__, <= 3)
|
||||
|
||||
# define BOOST_CONCEPT_USAGE(model) \
|
||||
model(); /* at least 2.96 and 3.4.3 both need this :( */ \
|
||||
BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
|
||||
~model()
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_CONCEPT_USAGE(model) \
|
||||
BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
|
||||
~model()
|
||||
|
||||
# endif
|
||||
|
||||
}} // namespace boost::concepts
|
||||
|
||||
#endif // BOOST_CONCEPT_USAGE_DWA2006919_HPP
|
1082
boost/boost/concept_check.hpp
Normal file
1082
boost/boost/concept_check.hpp
Normal file
File diff suppressed because it is too large
Load Diff
67
boost/boost/config.hpp
Normal file
67
boost/boost/config.hpp
Normal file
@ -0,0 +1,67 @@
|
||||
// Boost config.hpp configuration header file ------------------------------//
|
||||
|
||||
// (C) Copyright John Maddock 2002.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/config for most recent version.
|
||||
|
||||
// Boost config.hpp policy and rationale documentation has been moved to
|
||||
// http://www.boost.org/libs/config
|
||||
//
|
||||
// CAUTION: This file is intended to be completely stable -
|
||||
// DO NOT MODIFY THIS FILE!
|
||||
//
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#define BOOST_CONFIG_HPP
|
||||
|
||||
// if we don't have a user config, then use the default location:
|
||||
#if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG)
|
||||
# define BOOST_USER_CONFIG <boost/config/user.hpp>
|
||||
#if 0
|
||||
// For dependency trackers:
|
||||
# include <boost/config/user.hpp>
|
||||
#endif
|
||||
#endif
|
||||
// include it first:
|
||||
#ifdef BOOST_USER_CONFIG
|
||||
# include BOOST_USER_CONFIG
|
||||
#endif
|
||||
|
||||
// if we don't have a compiler config set, try and find one:
|
||||
#if !defined(BOOST_COMPILER_CONFIG) && !defined(BOOST_NO_COMPILER_CONFIG) && !defined(BOOST_NO_CONFIG)
|
||||
# include <boost/config/select_compiler_config.hpp>
|
||||
#endif
|
||||
// if we have a compiler config, include it now:
|
||||
#ifdef BOOST_COMPILER_CONFIG
|
||||
# include BOOST_COMPILER_CONFIG
|
||||
#endif
|
||||
|
||||
// if we don't have a std library config set, try and find one:
|
||||
#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) && defined(__cplusplus)
|
||||
# include <boost/config/select_stdlib_config.hpp>
|
||||
#endif
|
||||
// if we have a std library config, include it now:
|
||||
#ifdef BOOST_STDLIB_CONFIG
|
||||
# include BOOST_STDLIB_CONFIG
|
||||
#endif
|
||||
|
||||
// if we don't have a platform config set, try and find one:
|
||||
#if !defined(BOOST_PLATFORM_CONFIG) && !defined(BOOST_NO_PLATFORM_CONFIG) && !defined(BOOST_NO_CONFIG)
|
||||
# include <boost/config/select_platform_config.hpp>
|
||||
#endif
|
||||
// if we have a platform config, include it now:
|
||||
#ifdef BOOST_PLATFORM_CONFIG
|
||||
# include BOOST_PLATFORM_CONFIG
|
||||
#endif
|
||||
|
||||
// get config suffix code:
|
||||
#include <boost/config/suffix.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CONFIG_HPP
|
27
boost/boost/config/abi/borland_prefix.hpp
Normal file
27
boost/boost/config/abi/borland_prefix.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
// (C) Copyright John Maddock 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// for C++ Builder the following options effect the ABI:
|
||||
//
|
||||
// -b (on or off - effect emum sizes)
|
||||
// -Vx (on or off - empty members)
|
||||
// -Ve (on or off - empty base classes)
|
||||
// -aX (alignment - 5 options).
|
||||
// -pX (Calling convention - 4 options)
|
||||
// -VmX (member pointer size and layout - 5 options)
|
||||
// -VC (on or off, changes name mangling)
|
||||
// -Vl (on or off, changes struct layout).
|
||||
|
||||
// In addition the following warnings are sufficiently annoying (and
|
||||
// unfixable) to have them turned off by default:
|
||||
//
|
||||
// 8027 - functions containing [for|while] loops are not expanded inline
|
||||
// 8026 - functions taking class by value arguments are not expanded inline
|
||||
|
||||
#pragma nopushoptwarn
|
||||
# pragma option push -a8 -Vx- -Ve- -b- -pc -Vmv -VC- -Vl- -w-8027 -w-8026
|
||||
|
||||
|
||||
|
12
boost/boost/config/abi/borland_suffix.hpp
Normal file
12
boost/boost/config/abi/borland_suffix.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
// (C) Copyright John Maddock 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# pragma option pop
|
||||
#pragma nopushoptwarn
|
||||
|
||||
|
||||
|
||||
|
||||
|
22
boost/boost/config/abi/msvc_prefix.hpp
Normal file
22
boost/boost/config/abi/msvc_prefix.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
// (C) Copyright John Maddock 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
//
|
||||
// Boost binaries are built with the compiler's default ABI settings,
|
||||
// if the user changes their default alignment in the VS IDE then their
|
||||
// code will no longer be binary compatible with the bjam built binaries
|
||||
// unless this header is included to force Boost code into a consistent ABI.
|
||||
//
|
||||
// Note that inclusion of this header is only necessary for libraries with
|
||||
// separate source, header only libraries DO NOT need this as long as all
|
||||
// translation units are built with the same options.
|
||||
//
|
||||
#if defined(_M_X64)
|
||||
# pragma pack(push,16)
|
||||
#else
|
||||
# pragma pack(push,8)
|
||||
#endif
|
||||
|
||||
|
8
boost/boost/config/abi/msvc_suffix.hpp
Normal file
8
boost/boost/config/abi/msvc_suffix.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
// (C) Copyright John Maddock 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
25
boost/boost/config/abi_prefix.hpp
Normal file
25
boost/boost/config/abi_prefix.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
// abi_prefix header -------------------------------------------------------//
|
||||
|
||||
// (c) Copyright John Maddock 2003
|
||||
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
#ifndef BOOST_CONFIG_ABI_PREFIX_HPP
|
||||
# define BOOST_CONFIG_ABI_PREFIX_HPP
|
||||
#else
|
||||
# error double inclusion of header boost/config/abi_prefix.hpp is an error
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
// this must occur after all other includes and before any code appears:
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
#if defined( __BORLANDC__ )
|
||||
#pragma nopushoptwarn
|
||||
#endif
|
||||
|
27
boost/boost/config/abi_suffix.hpp
Normal file
27
boost/boost/config/abi_suffix.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
// abi_sufffix header -------------------------------------------------------//
|
||||
|
||||
// (c) Copyright John Maddock 2003
|
||||
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
// This header should be #included AFTER code that was preceded by a #include
|
||||
// <boost/config/abi_prefix.hpp>.
|
||||
|
||||
#ifndef BOOST_CONFIG_ABI_PREFIX_HPP
|
||||
# error Header boost/config/abi_suffix.hpp must only be used after boost/config/abi_prefix.hpp
|
||||
#else
|
||||
# undef BOOST_CONFIG_ABI_PREFIX_HPP
|
||||
#endif
|
||||
|
||||
// the suffix header occurs after all of our code:
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#if defined( __BORLANDC__ )
|
||||
#pragma nopushoptwarn
|
||||
#endif
|
||||
|
||||
|
439
boost/boost/config/auto_link.hpp
Normal file
439
boost/boost/config/auto_link.hpp
Normal file
@ -0,0 +1,439 @@
|
||||
// (C) Copyright John Maddock 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE auto_link.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
|
||||
*/
|
||||
|
||||
/*************************************************************************
|
||||
|
||||
USAGE:
|
||||
~~~~~~
|
||||
|
||||
Before including this header you must define one or more of define the following macros:
|
||||
|
||||
BOOST_LIB_NAME: Required: A string containing the basename of the library,
|
||||
for example boost_regex.
|
||||
BOOST_LIB_TOOLSET: Optional: the base name of the toolset.
|
||||
BOOST_DYN_LINK: Optional: when set link to dll rather than static library.
|
||||
BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name
|
||||
of the library selected (useful for debugging).
|
||||
BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib,
|
||||
rather than a mangled-name version.
|
||||
BOOST_AUTO_LINK_TAGGED: Specifies that we link to libraries built with the --layout=tagged option.
|
||||
This is essentially the same as the default name-mangled version, but without
|
||||
the compiler name and version, or the Boost version. Just the build options.
|
||||
|
||||
These macros will be undef'ed at the end of the header, further this header
|
||||
has no include guards - so be sure to include it only once from your library!
|
||||
|
||||
Algorithm:
|
||||
~~~~~~~~~~
|
||||
|
||||
Libraries for Borland and Microsoft compilers are automatically
|
||||
selected here, the name of the lib is selected according to the following
|
||||
formula:
|
||||
|
||||
BOOST_LIB_PREFIX
|
||||
+ BOOST_LIB_NAME
|
||||
+ "_"
|
||||
+ BOOST_LIB_TOOLSET
|
||||
+ BOOST_LIB_THREAD_OPT
|
||||
+ BOOST_LIB_RT_OPT
|
||||
"-"
|
||||
+ BOOST_LIB_VERSION
|
||||
|
||||
These are defined as:
|
||||
|
||||
BOOST_LIB_PREFIX: "lib" for static libraries otherwise "".
|
||||
|
||||
BOOST_LIB_NAME: The base name of the lib ( for example boost_regex).
|
||||
|
||||
BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc).
|
||||
|
||||
BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
|
||||
|
||||
BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used,
|
||||
contains one or more of the following letters after
|
||||
a hyphen:
|
||||
|
||||
s static runtime (dynamic if not present).
|
||||
g debug/diagnostic runtime (release if not present).
|
||||
y Python debug/diagnostic runtime (release if not present).
|
||||
d debug build (release if not present).
|
||||
p STLport build.
|
||||
n STLport build without its IOStreams.
|
||||
|
||||
BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
# endif
|
||||
#elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
|
||||
//
|
||||
// C language compatability (no, honestly)
|
||||
//
|
||||
# define BOOST_MSVC _MSC_VER
|
||||
# define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
|
||||
# define BOOST_DO_STRINGIZE(X) #X
|
||||
#endif
|
||||
//
|
||||
// Only include what follows for known and supported compilers:
|
||||
//
|
||||
#if defined(BOOST_MSVC) \
|
||||
|| defined(__BORLANDC__) \
|
||||
|| (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
|
||||
|| (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
|
||||
|
||||
#ifndef BOOST_VERSION_HPP
|
||||
# include <boost/version.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_LIB_NAME
|
||||
# error "Macro BOOST_LIB_NAME not set (internal error)"
|
||||
#endif
|
||||
|
||||
//
|
||||
// error check:
|
||||
//
|
||||
#if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG)
|
||||
# pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors")
|
||||
# pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes")
|
||||
# error "Incompatible build options"
|
||||
#endif
|
||||
//
|
||||
// select toolset if not defined already:
|
||||
//
|
||||
#ifndef BOOST_LIB_TOOLSET
|
||||
# if defined(BOOST_MSVC) && (BOOST_MSVC < 1200)
|
||||
// Note: no compilers before 1200 are supported
|
||||
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
|
||||
# ifdef UNDER_CE
|
||||
// eVC4:
|
||||
# define BOOST_LIB_TOOLSET "evc4"
|
||||
# else
|
||||
// vc6:
|
||||
# define BOOST_LIB_TOOLSET "vc6"
|
||||
# endif
|
||||
|
||||
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1310)
|
||||
|
||||
// vc7:
|
||||
# define BOOST_LIB_TOOLSET "vc7"
|
||||
|
||||
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1400)
|
||||
|
||||
// vc71:
|
||||
# define BOOST_LIB_TOOLSET "vc71"
|
||||
|
||||
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1500)
|
||||
|
||||
// vc80:
|
||||
# define BOOST_LIB_TOOLSET "vc80"
|
||||
|
||||
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
|
||||
|
||||
// vc90:
|
||||
# define BOOST_LIB_TOOLSET "vc90"
|
||||
|
||||
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1700)
|
||||
|
||||
// vc10:
|
||||
# define BOOST_LIB_TOOLSET "vc100"
|
||||
|
||||
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1800)
|
||||
|
||||
// vc11:
|
||||
# define BOOST_LIB_TOOLSET "vc110"
|
||||
|
||||
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1900)
|
||||
|
||||
// vc12:
|
||||
# define BOOST_LIB_TOOLSET "vc120"
|
||||
|
||||
# elif defined(BOOST_MSVC)
|
||||
|
||||
// vc14:
|
||||
# define BOOST_LIB_TOOLSET "vc140"
|
||||
|
||||
# elif defined(__BORLANDC__)
|
||||
|
||||
// CBuilder 6:
|
||||
# define BOOST_LIB_TOOLSET "bcb"
|
||||
|
||||
# elif defined(__ICL)
|
||||
|
||||
// Intel C++, no version number:
|
||||
# define BOOST_LIB_TOOLSET "iw"
|
||||
|
||||
# elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
|
||||
|
||||
// Metrowerks CodeWarrior 8.x
|
||||
# define BOOST_LIB_TOOLSET "cw8"
|
||||
|
||||
# elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
|
||||
|
||||
// Metrowerks CodeWarrior 9.x
|
||||
# define BOOST_LIB_TOOLSET "cw9"
|
||||
|
||||
# endif
|
||||
#endif // BOOST_LIB_TOOLSET
|
||||
|
||||
//
|
||||
// select thread opt:
|
||||
//
|
||||
#if defined(_MT) || defined(__MT__)
|
||||
# define BOOST_LIB_THREAD_OPT "-mt"
|
||||
#else
|
||||
# define BOOST_LIB_THREAD_OPT
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MWERKS__)
|
||||
|
||||
# ifdef _DLL
|
||||
|
||||
# if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
|
||||
|
||||
# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-gydp"
|
||||
# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
|
||||
# define BOOST_LIB_RT_OPT "-gdp"
|
||||
# elif defined(_DEBUG)\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-gydp"
|
||||
# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
|
||||
# error "Build options aren't compatible with pre-built libraries"
|
||||
# elif defined(_DEBUG)
|
||||
# define BOOST_LIB_RT_OPT "-gdp"
|
||||
# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
|
||||
# error "Build options aren't compatible with pre-built libraries"
|
||||
# else
|
||||
# define BOOST_LIB_RT_OPT "-p"
|
||||
# endif
|
||||
|
||||
# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
|
||||
# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-gydpn"
|
||||
# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
|
||||
# define BOOST_LIB_RT_OPT "-gdpn"
|
||||
# elif defined(_DEBUG)\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-gydpn"
|
||||
# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
|
||||
# error "Build options aren't compatible with pre-built libraries"
|
||||
# elif defined(_DEBUG)
|
||||
# define BOOST_LIB_RT_OPT "-gdpn"
|
||||
# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
|
||||
# error "Build options aren't compatible with pre-built libraries"
|
||||
# else
|
||||
# define BOOST_LIB_RT_OPT "-pn"
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
# if defined(_DEBUG) && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-gyd"
|
||||
# elif defined(_DEBUG)
|
||||
# define BOOST_LIB_RT_OPT "-gd"
|
||||
# else
|
||||
# define BOOST_LIB_RT_OPT
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
# if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS))
|
||||
|
||||
# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-sgydp"
|
||||
# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
|
||||
# define BOOST_LIB_RT_OPT "-sgdp"
|
||||
# elif defined(_DEBUG)\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-sgydp"
|
||||
# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
|
||||
# error "Build options aren't compatible with pre-built libraries"
|
||||
# elif defined(_DEBUG)
|
||||
# define BOOST_LIB_RT_OPT "-sgdp"
|
||||
# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
|
||||
# error "Build options aren't compatible with pre-built libraries"
|
||||
# else
|
||||
# define BOOST_LIB_RT_OPT "-sp"
|
||||
# endif
|
||||
|
||||
# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
|
||||
# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-sgydpn"
|
||||
# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))
|
||||
# define BOOST_LIB_RT_OPT "-sgdpn"
|
||||
# elif defined(_DEBUG)\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-sgydpn"
|
||||
# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
|
||||
# error "Build options aren't compatible with pre-built libraries"
|
||||
# elif defined(_DEBUG)
|
||||
# define BOOST_LIB_RT_OPT "-sgdpn"
|
||||
# pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
|
||||
# error "Build options aren't compatible with pre-built libraries"
|
||||
# else
|
||||
# define BOOST_LIB_RT_OPT "-spn"
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
# if defined(_DEBUG)\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-sgyd"
|
||||
# elif defined(_DEBUG)
|
||||
# define BOOST_LIB_RT_OPT "-sgd"
|
||||
# else
|
||||
# define BOOST_LIB_RT_OPT "-s"
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
|
||||
//
|
||||
// figure out whether we want the debug builds or not:
|
||||
//
|
||||
#if __BORLANDC__ > 0x561
|
||||
#pragma defineonoption BOOST_BORLAND_DEBUG -v
|
||||
#endif
|
||||
//
|
||||
// sanity check:
|
||||
//
|
||||
#if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
|
||||
#error "Pre-built versions of the Boost libraries are not provided in STLport-debug form"
|
||||
#endif
|
||||
|
||||
# ifdef _RTLDLL
|
||||
|
||||
# if defined(BOOST_BORLAND_DEBUG)\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-yd"
|
||||
# elif defined(BOOST_BORLAND_DEBUG)
|
||||
# define BOOST_LIB_RT_OPT "-d"
|
||||
# elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT -y
|
||||
# else
|
||||
# define BOOST_LIB_RT_OPT
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
# if defined(BOOST_BORLAND_DEBUG)\
|
||||
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-syd"
|
||||
# elif defined(BOOST_BORLAND_DEBUG)
|
||||
# define BOOST_LIB_RT_OPT "-sd"
|
||||
# elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
|
||||
# define BOOST_LIB_RT_OPT "-sy"
|
||||
# else
|
||||
# define BOOST_LIB_RT_OPT "-s"
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// select linkage opt:
|
||||
//
|
||||
#if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
|
||||
# define BOOST_LIB_PREFIX
|
||||
#elif defined(BOOST_DYN_LINK)
|
||||
# error "Mixing a dll boost library with a static runtime is a really bad idea..."
|
||||
#else
|
||||
# define BOOST_LIB_PREFIX "lib"
|
||||
#endif
|
||||
|
||||
//
|
||||
// now include the lib:
|
||||
//
|
||||
#if defined(BOOST_LIB_NAME) \
|
||||
&& defined(BOOST_LIB_PREFIX) \
|
||||
&& defined(BOOST_LIB_TOOLSET) \
|
||||
&& defined(BOOST_LIB_THREAD_OPT) \
|
||||
&& defined(BOOST_LIB_RT_OPT) \
|
||||
&& defined(BOOST_LIB_VERSION)
|
||||
|
||||
#ifdef BOOST_AUTO_LINK_TAGGED
|
||||
# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib")
|
||||
# ifdef BOOST_LIB_DIAGNOSTIC
|
||||
# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib")
|
||||
# endif
|
||||
#elif defined(BOOST_AUTO_LINK_NOMANGLE)
|
||||
# pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
|
||||
# ifdef BOOST_LIB_DIAGNOSTIC
|
||||
# pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
|
||||
# endif
|
||||
#elif defined(BOOST_LIB_BUILDID)
|
||||
# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION "-" BOOST_STRINGIZE(BOOST_LIB_BUILDID) ".lib")
|
||||
# ifdef BOOST_LIB_DIAGNOSTIC
|
||||
# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION "-" BOOST_STRINGIZE(BOOST_LIB_BUILDID) ".lib")
|
||||
# endif
|
||||
#else
|
||||
# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib")
|
||||
# ifdef BOOST_LIB_DIAGNOSTIC
|
||||
# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
# error "some required macros where not defined (internal logic error)."
|
||||
#endif
|
||||
|
||||
|
||||
#endif // _MSC_VER || __BORLANDC__
|
||||
|
||||
//
|
||||
// finally undef any macros we may have set:
|
||||
//
|
||||
#ifdef BOOST_LIB_PREFIX
|
||||
# undef BOOST_LIB_PREFIX
|
||||
#endif
|
||||
#if defined(BOOST_LIB_NAME)
|
||||
# undef BOOST_LIB_NAME
|
||||
#endif
|
||||
// Don't undef this one: it can be set by the user and should be the
|
||||
// same for all libraries:
|
||||
//#if defined(BOOST_LIB_TOOLSET)
|
||||
//# undef BOOST_LIB_TOOLSET
|
||||
//#endif
|
||||
#if defined(BOOST_LIB_THREAD_OPT)
|
||||
# undef BOOST_LIB_THREAD_OPT
|
||||
#endif
|
||||
#if defined(BOOST_LIB_RT_OPT)
|
||||
# undef BOOST_LIB_RT_OPT
|
||||
#endif
|
||||
#if defined(BOOST_LIB_LINK_OPT)
|
||||
# undef BOOST_LIB_LINK_OPT
|
||||
#endif
|
||||
#if defined(BOOST_LIB_DEBUG_OPT)
|
||||
# undef BOOST_LIB_DEBUG_OPT
|
||||
#endif
|
||||
#if defined(BOOST_DYN_LINK)
|
||||
# undef BOOST_DYN_LINK
|
||||
#endif
|
||||
|
||||
|
319
boost/boost/config/compiler/borland.hpp
Normal file
319
boost/boost/config/compiler/borland.hpp
Normal file
@ -0,0 +1,319 @@
|
||||
// (C) Copyright John Maddock 2001 - 2003.
|
||||
// (C) Copyright David Abrahams 2002 - 2003.
|
||||
// (C) Copyright Aleksey Gurtovoy 2002.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Borland C++ compiler setup:
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support Borland prior to version 5.4:
|
||||
#if __BORLANDC__ < 0x540
|
||||
# error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
|
||||
// last known compiler version:
|
||||
#if (__BORLANDC__ > 0x613)
|
||||
//# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
//# else
|
||||
//# pragma message( "Unknown compiler version - please run the configure tests and report the results")
|
||||
//# endif
|
||||
#elif (__BORLANDC__ == 0x600)
|
||||
# error "CBuilderX preview compiler is no longer supported"
|
||||
#endif
|
||||
|
||||
//
|
||||
// Support macros to help with standard library detection
|
||||
#if (__BORLANDC__ < 0x560) || defined(_USE_OLD_RW_STL)
|
||||
# define BOOST_BCB_WITH_ROGUE_WAVE
|
||||
#elif __BORLANDC__ < 0x570
|
||||
# define BOOST_BCB_WITH_STLPORT
|
||||
#else
|
||||
# define BOOST_BCB_WITH_DINKUMWARE
|
||||
#endif
|
||||
|
||||
//
|
||||
// Version 5.0 and below:
|
||||
# if __BORLANDC__ <= 0x0550
|
||||
// Borland C++Builder 4 and 5:
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# if __BORLANDC__ == 0x0550
|
||||
// Borland C++Builder 5, command-line compiler 5.5:
|
||||
# define BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
# endif
|
||||
// Variadic macros do not exist for C++ Builder versions 5 and below
|
||||
#define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
# endif
|
||||
|
||||
// Version 5.51 and below:
|
||||
#if (__BORLANDC__ <= 0x551)
|
||||
# define BOOST_NO_CV_SPECIALIZATIONS
|
||||
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
# define BOOST_NO_DEDUCED_TYPENAME
|
||||
// workaround for missing WCHAR_MAX/WCHAR_MIN:
|
||||
#ifdef __cplusplus
|
||||
#include <climits>
|
||||
#include <cwchar>
|
||||
#else
|
||||
#include <limits.h>
|
||||
#include <wchar.h>
|
||||
#endif // __cplusplus
|
||||
#ifndef WCHAR_MAX
|
||||
# define WCHAR_MAX 0xffff
|
||||
#endif
|
||||
#ifndef WCHAR_MIN
|
||||
# define WCHAR_MIN 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Borland C++ Builder 6 and below:
|
||||
#if (__BORLANDC__ <= 0x564)
|
||||
|
||||
# if defined(NDEBUG) && defined(__cplusplus)
|
||||
// fix broken <cstring> so that Boost.test works:
|
||||
# include <cstring>
|
||||
# undef strcmp
|
||||
# endif
|
||||
// fix broken errno declaration:
|
||||
# include <errno.h>
|
||||
# ifndef errno
|
||||
# define errno errno
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// new bug in 5.61:
|
||||
#if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x580)
|
||||
// this seems to be needed by the command line compiler, but not the IDE:
|
||||
# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
|
||||
#endif
|
||||
|
||||
// Borland C++ Builder 2006 Update 2 and below:
|
||||
#if (__BORLANDC__ <= 0x582)
|
||||
# define BOOST_NO_SFINAE
|
||||
# define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
|
||||
# define BOOST_NO_TEMPLATE_TEMPLATES
|
||||
|
||||
# define BOOST_NO_PRIVATE_IN_AGGREGATE
|
||||
|
||||
# ifdef _WIN32
|
||||
# define BOOST_NO_SWPRINTF
|
||||
# elif defined(linux) || defined(__linux__) || defined(__linux)
|
||||
// we should really be able to do without this
|
||||
// but the wcs* functions aren't imported into std::
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
// _CPPUNWIND doesn't get automatically set for some reason:
|
||||
# pragma defineonoption BOOST_CPPUNWIND -x
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (__BORLANDC__ <= 0x613) // Beman has asked Alisdair for more info
|
||||
// we shouldn't really need this - but too many things choke
|
||||
// without it, this needs more investigation:
|
||||
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
# define BOOST_NO_IS_ABSTRACT
|
||||
# define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS
|
||||
# define BOOST_NO_USING_TEMPLATE
|
||||
# define BOOST_SP_NO_SP_CONVERTIBLE
|
||||
|
||||
// Temporary workaround
|
||||
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
#endif
|
||||
|
||||
// Borland C++ Builder 2008 and below:
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
|
||||
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
|
||||
# define BOOST_NO_NESTED_FRIENDSHIP
|
||||
# define BOOST_NO_TYPENAME_WITH_CTOR
|
||||
#if (__BORLANDC__ < 0x600)
|
||||
# define BOOST_ILLEGAL_CV_REFERENCES
|
||||
#endif
|
||||
|
||||
//
|
||||
// Positive Feature detection
|
||||
//
|
||||
// Borland C++ Builder 2008 and below:
|
||||
#if (__BORLANDC__ >= 0x599)
|
||||
# pragma defineonoption BOOST_CODEGEAR_0X_SUPPORT -Ax
|
||||
#endif
|
||||
//
|
||||
// C++0x Macros:
|
||||
//
|
||||
#if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610)
|
||||
# define BOOST_NO_CXX11_CHAR16_T
|
||||
# define BOOST_NO_CXX11_CHAR32_T
|
||||
# define BOOST_NO_CXX11_DECLTYPE
|
||||
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
# define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
# define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#else
|
||||
# define BOOST_HAS_ALIGNOF
|
||||
# define BOOST_HAS_CHAR16_T
|
||||
# define BOOST_HAS_CHAR32_T
|
||||
# define BOOST_HAS_DECLTYPE
|
||||
# define BOOST_HAS_EXPLICIT_CONVERSION_OPS
|
||||
# define BOOST_HAS_REF_QUALIFIER
|
||||
# define BOOST_HAS_RVALUE_REFS
|
||||
# define BOOST_HAS_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS // UTF-8 still not supported
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
#if __BORLANDC__ >= 0x590
|
||||
# define BOOST_HAS_TR1_HASH
|
||||
|
||||
# define BOOST_HAS_MACRO_USE_FACET
|
||||
#endif
|
||||
|
||||
//
|
||||
// Post 0x561 we have long long and stdint.h:
|
||||
#if __BORLANDC__ >= 0x561
|
||||
# ifndef __NO_LONG_LONG
|
||||
# define BOOST_HAS_LONG_LONG
|
||||
# else
|
||||
# define BOOST_NO_LONG_LONG
|
||||
# endif
|
||||
// On non-Win32 platforms let the platform config figure this out:
|
||||
# ifdef _WIN32
|
||||
# define BOOST_HAS_STDINT_H
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Borland C++Builder 6 defaults to using STLPort. If _USE_OLD_RW_STL is
|
||||
// defined, then we have 0x560 or greater with the Rogue Wave implementation
|
||||
// which presumably has the std::DBL_MAX bug.
|
||||
#if defined( BOOST_BCB_WITH_ROGUE_WAVE )
|
||||
// <climits> is partly broken, some macros define symbols that are really in
|
||||
// namespace std, so you end up having to use illegal constructs like
|
||||
// std::DBL_MAX, as a fix we'll just include float.h and have done with:
|
||||
#include <float.h>
|
||||
#endif
|
||||
//
|
||||
// __int64:
|
||||
//
|
||||
#if (__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__)
|
||||
# define BOOST_HAS_MS_INT64
|
||||
#endif
|
||||
//
|
||||
// check for exception handling support:
|
||||
//
|
||||
#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
#endif
|
||||
//
|
||||
// all versions have a <dirent.h>:
|
||||
//
|
||||
#ifndef __STRICT_ANSI__
|
||||
# define BOOST_HAS_DIRENT_H
|
||||
#endif
|
||||
//
|
||||
// all versions support __declspec:
|
||||
//
|
||||
#if defined(__STRICT_ANSI__)
|
||||
// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
|
||||
# define BOOST_SYMBOL_EXPORT
|
||||
#endif
|
||||
//
|
||||
// ABI fixing headers:
|
||||
//
|
||||
#if __BORLANDC__ != 0x600 // not implemented for version 6 compiler yet
|
||||
#ifndef BOOST_ABI_PREFIX
|
||||
# define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp"
|
||||
#endif
|
||||
#ifndef BOOST_ABI_SUFFIX
|
||||
# define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp"
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
// Disable Win32 support in ANSI mode:
|
||||
//
|
||||
#if __BORLANDC__ < 0x600
|
||||
# pragma defineonoption BOOST_DISABLE_WIN32 -A
|
||||
#elif defined(__STRICT_ANSI__)
|
||||
# define BOOST_DISABLE_WIN32
|
||||
#endif
|
||||
//
|
||||
// MSVC compatibility mode does some nasty things:
|
||||
// TODO: look up if this doesn't apply to the whole 12xx range
|
||||
//
|
||||
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
|
||||
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
# define BOOST_NO_VOID_RETURNS
|
||||
#endif
|
||||
|
||||
// Borland did not implement value-initialization completely, as I reported
|
||||
// in 2007, Borland Report 51854, "Value-initialization: POD struct should be
|
||||
// zero-initialized", http://qc.embarcadero.com/wc/qcmain.aspx?d=51854
|
||||
// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
|
||||
// (Niels Dekker, LKEB, April 2010)
|
||||
#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
|
||||
#define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__)
|
304
boost/boost/config/compiler/clang.hpp
Normal file
304
boost/boost/config/compiler/clang.hpp
Normal file
@ -0,0 +1,304 @@
|
||||
// (C) Copyright Douglas Gregor 2010
|
||||
//
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Clang compiler setup.
|
||||
|
||||
#define BOOST_HAS_PRAGMA_ONCE
|
||||
|
||||
// Detecting `-fms-extension` compiler flag assuming that _MSC_VER defined when that flag is used.
|
||||
#if defined (_MSC_VER) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
|
||||
# define BOOST_HAS_PRAGMA_DETECT_MISMATCH
|
||||
#endif
|
||||
|
||||
// When compiling with clang before __has_extension was defined,
|
||||
// even if one writes 'defined(__has_extension) && __has_extension(xxx)',
|
||||
// clang reports a compiler error. So the only workaround found is:
|
||||
|
||||
#ifndef __has_extension
|
||||
#define __has_extension __has_feature
|
||||
#endif
|
||||
|
||||
#ifndef __has_attribute
|
||||
#define __has_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI)
|
||||
# define BOOST_NO_RTTI
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID)
|
||||
# define BOOST_NO_TYPEID
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_thread_local)
|
||||
# define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
#endif
|
||||
|
||||
#ifdef __is_identifier
|
||||
#if !__is_identifier(__int64) && !defined(__GNUC__)
|
||||
# define BOOST_HAS_MS_INT64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __has_include(<stdint.h>)
|
||||
# define BOOST_HAS_STDINT_H
|
||||
#endif
|
||||
|
||||
|
||||
#define BOOST_HAS_NRVO
|
||||
|
||||
// Branch prediction hints
|
||||
#if defined(__has_builtin)
|
||||
#if __has_builtin(__builtin_expect)
|
||||
#define BOOST_LIKELY(x) __builtin_expect(x, 1)
|
||||
#define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Clang supports "long long" in all compilation modes.
|
||||
#define BOOST_HAS_LONG_LONG
|
||||
|
||||
//
|
||||
// We disable this if the compiler is really nvcc with C++03 as it
|
||||
// doesn't actually support __int128 as of CUDA_VERSION=7500
|
||||
// even though it defines __SIZEOF_INT128__.
|
||||
// See https://svn.boost.org/trac/boost/ticket/10418
|
||||
// https://svn.boost.org/trac/boost/ticket/11852
|
||||
// Only re-enable this for nvcc if you're absolutely sure
|
||||
// of the circumstances under which it's supported.
|
||||
// Similarly __SIZEOF_INT128__ is defined when targetting msvc
|
||||
// compatibility even though the required support functions are absent.
|
||||
//
|
||||
#if defined(__CUDACC__)
|
||||
# if defined(BOOST_GCC_CXX11)
|
||||
# define BOOST_NVCC_CXX11
|
||||
# else
|
||||
# define BOOST_NVCC_CXX03
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__SIZEOF_INT128__) && !defined(BOOST_NVCC_CXX03) && !defined(_MSC_VER)
|
||||
# define BOOST_HAS_INT128
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
|
||||
//
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
|
||||
# define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
|
||||
# define BOOST_SYMBOL_IMPORT
|
||||
# define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
|
||||
#endif
|
||||
|
||||
//
|
||||
// The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through
|
||||
// between switch labels.
|
||||
//
|
||||
#if __cplusplus >= 201103L && defined(__has_warning)
|
||||
# if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
|
||||
# define BOOST_FALLTHROUGH [[clang::fallthrough]]
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_auto_type)
|
||||
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#endif
|
||||
|
||||
//
|
||||
// Currently clang on Windows using VC++ RTL does not support C++11's char16_t or char32_t
|
||||
//
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
|
||||
# define BOOST_NO_CXX11_CHAR16_T
|
||||
# define BOOST_NO_CXX11_CHAR32_T
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1800) && !defined(__GNUC__)
|
||||
#define BOOST_HAS_EXPM1
|
||||
#define BOOST_HAS_LOG1P
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_constexpr)
|
||||
# define BOOST_NO_CXX11_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_decltype)
|
||||
# define BOOST_NO_CXX11_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_decltype_incomplete_return_types)
|
||||
# define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_defaulted_functions)
|
||||
# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_deleted_functions)
|
||||
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_explicit_conversions)
|
||||
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_default_function_template_args)
|
||||
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_generalized_initializers)
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_lambdas)
|
||||
# define BOOST_NO_CXX11_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_local_type_template_args)
|
||||
# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
# define BOOST_NO_CXX11_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_nullptr)
|
||||
# define BOOST_NO_CXX11_NULLPTR
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_range_for)
|
||||
# define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_raw_string_literals)
|
||||
# define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_reference_qualified_functions)
|
||||
# define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_generalized_initializers)
|
||||
# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_rvalue_references)
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_strong_enums)
|
||||
# define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_static_assert)
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_alias_templates)
|
||||
# define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_unicode_literals)
|
||||
# define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_variadic_templates)
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_user_literals)
|
||||
# define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_alignas)
|
||||
# define BOOST_NO_CXX11_ALIGNAS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_trailing_return)
|
||||
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_inline_namespaces)
|
||||
# define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_override_control)
|
||||
# define BOOST_NO_CXX11_FINAL
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__))
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_decltype_auto__)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_aggregate_nsdmi__)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_init_captures__)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_generic_lambdas__)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
|
||||
// clang < 3.5 has a defect with dependent type, like following.
|
||||
//
|
||||
// template <class T>
|
||||
// constexpr typename enable_if<pred<T> >::type foo(T &)
|
||||
// { } // error: no return statement in constexpr function
|
||||
//
|
||||
// This issue also affects C++11 mode, but C++11 constexpr requires return stmt.
|
||||
// Therefore we don't care such case.
|
||||
//
|
||||
// Note that we can't check Clang version directly as the numbering system changes depending who's
|
||||
// creating the Clang release (see https://github.com/boostorg/config/pull/39#issuecomment-59927873)
|
||||
// so instead verify that we have a feature that was introduced at the same time as working C++14
|
||||
// constexpr (generic lambda's in this case):
|
||||
//
|
||||
#if !__has_feature(__cxx_generic_lambdas__) || !__has_feature(__cxx_relaxed_constexpr__)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_return_type_deduction__)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_variable_templates__)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
#if __cplusplus < 201400
|
||||
// All versions with __cplusplus above this value seem to support this:
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
//
|
||||
// __builtin_unreachable:
|
||||
#if defined(__has_builtin) && __has_builtin(__builtin_unreachable)
|
||||
#define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable();
|
||||
#endif
|
||||
|
||||
// Clang has supported the 'unused' attribute since the first release.
|
||||
#define BOOST_ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
# define BOOST_COMPILER "Clang version " __clang_version__
|
||||
#endif
|
||||
|
||||
// Macro used to identify the Clang compiler.
|
||||
#define BOOST_CLANG 1
|
||||
|
221
boost/boost/config/compiler/codegear.hpp
Normal file
221
boost/boost/config/compiler/codegear.hpp
Normal file
@ -0,0 +1,221 @@
|
||||
// (C) Copyright John Maddock 2001 - 2003.
|
||||
// (C) Copyright David Abrahams 2002 - 2003.
|
||||
// (C) Copyright Aleksey Gurtovoy 2002.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// CodeGear C++ compiler setup:
|
||||
|
||||
#if !defined( BOOST_WITH_CODEGEAR_WARNINGS )
|
||||
// these warnings occur frequently in optimized template code
|
||||
# pragma warn -8004 // var assigned value, but never used
|
||||
# pragma warn -8008 // condition always true/false
|
||||
# pragma warn -8066 // dead code can never execute
|
||||
# pragma warn -8104 // static members with ctors not threadsafe
|
||||
# pragma warn -8105 // reference member in class without ctors
|
||||
#endif
|
||||
//
|
||||
// versions check:
|
||||
// last known and checked version is 0x621
|
||||
#if (__CODEGEARC__ > 0x621)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# else
|
||||
# pragma message( "Unknown compiler version - please run the configure tests and report the results")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// CodeGear C++ Builder 2009
|
||||
#if (__CODEGEARC__ <= 0x613)
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
|
||||
# define BOOST_NO_PRIVATE_IN_AGGREGATE
|
||||
# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
|
||||
// we shouldn't really need this - but too many things choke
|
||||
// without it, this needs more investigation:
|
||||
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
# define BOOST_SP_NO_SP_CONVERTIBLE
|
||||
#endif
|
||||
|
||||
// CodeGear C++ Builder 2010
|
||||
#if (__CODEGEARC__ <= 0x621)
|
||||
# define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type
|
||||
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member
|
||||
# define BOOST_NO_USING_TEMPLATE
|
||||
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
// Temporary hack, until specific MPL preprocessed headers are generated
|
||||
# define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
|
||||
// CodeGear has not yet completely implemented value-initialization, for
|
||||
// example for array types, as I reported in 2010: Embarcadero Report 83751,
|
||||
// "Value-initialization: arrays should have each element value-initialized",
|
||||
// http://qc.embarcadero.com/wc/qcmain.aspx?d=83751
|
||||
// Last checked version: Embarcadero C++ 6.21
|
||||
// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
|
||||
// (Niels Dekker, LKEB, April 2010)
|
||||
# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
|
||||
# if defined(NDEBUG) && defined(__cplusplus)
|
||||
// fix broken <cstring> so that Boost.test works:
|
||||
# include <cstring>
|
||||
# undef strcmp
|
||||
# endif
|
||||
// fix broken errno declaration:
|
||||
# include <errno.h>
|
||||
# ifndef errno
|
||||
# define errno errno
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
// Reportedly, #pragma once is supported since C++ Builder 2010
|
||||
#if (__CODEGEARC__ >= 0x620)
|
||||
# define BOOST_HAS_PRAGMA_ONCE
|
||||
#endif
|
||||
|
||||
//
|
||||
// C++0x macros:
|
||||
//
|
||||
#if (__CODEGEARC__ <= 0x620)
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#else
|
||||
#define BOOST_HAS_STATIC_ASSERT
|
||||
#endif
|
||||
#define BOOST_HAS_CHAR16_T
|
||||
#define BOOST_HAS_CHAR32_T
|
||||
#define BOOST_HAS_LONG_LONG
|
||||
// #define BOOST_HAS_ALIGNOF
|
||||
#define BOOST_HAS_DECLTYPE
|
||||
#define BOOST_HAS_EXPLICIT_CONVERSION_OPS
|
||||
// #define BOOST_HAS_RVALUE_REFS
|
||||
#define BOOST_HAS_SCOPED_ENUM
|
||||
// #define BOOST_HAS_STATIC_ASSERT
|
||||
#define BOOST_HAS_STD_TYPE_TRAITS
|
||||
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
//
|
||||
// TR1 macros:
|
||||
//
|
||||
#define BOOST_HAS_TR1_HASH
|
||||
#define BOOST_HAS_TR1_TYPE_TRAITS
|
||||
#define BOOST_HAS_TR1_UNORDERED_MAP
|
||||
#define BOOST_HAS_TR1_UNORDERED_SET
|
||||
|
||||
#define BOOST_HAS_MACRO_USE_FACET
|
||||
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
|
||||
// On non-Win32 platforms let the platform config figure this out:
|
||||
#ifdef _WIN32
|
||||
# define BOOST_HAS_STDINT_H
|
||||
#endif
|
||||
|
||||
//
|
||||
// __int64:
|
||||
//
|
||||
#if !defined(__STRICT_ANSI__)
|
||||
# define BOOST_HAS_MS_INT64
|
||||
#endif
|
||||
//
|
||||
// check for exception handling support:
|
||||
//
|
||||
#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
#endif
|
||||
//
|
||||
// all versions have a <dirent.h>:
|
||||
//
|
||||
#if !defined(__STRICT_ANSI__)
|
||||
# define BOOST_HAS_DIRENT_H
|
||||
#endif
|
||||
//
|
||||
// all versions support __declspec:
|
||||
//
|
||||
#if defined(__STRICT_ANSI__)
|
||||
// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
|
||||
# define BOOST_SYMBOL_EXPORT
|
||||
#endif
|
||||
//
|
||||
// ABI fixing headers:
|
||||
//
|
||||
#ifndef BOOST_ABI_PREFIX
|
||||
# define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp"
|
||||
#endif
|
||||
#ifndef BOOST_ABI_SUFFIX
|
||||
# define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp"
|
||||
#endif
|
||||
//
|
||||
// Disable Win32 support in ANSI mode:
|
||||
//
|
||||
# pragma defineonoption BOOST_DISABLE_WIN32 -A
|
||||
//
|
||||
// MSVC compatibility mode does some nasty things:
|
||||
// TODO: look up if this doesn't apply to the whole 12xx range
|
||||
//
|
||||
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
|
||||
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
# define BOOST_NO_VOID_RETURNS
|
||||
#endif
|
||||
|
||||
#define BOOST_COMPILER "CodeGear C++ version " BOOST_STRINGIZE(__CODEGEARC__)
|
||||
|
59
boost/boost/config/compiler/comeau.hpp
Normal file
59
boost/boost/config/compiler/comeau.hpp
Normal file
@ -0,0 +1,59 @@
|
||||
// (C) Copyright John Maddock 2001.
|
||||
// (C) Copyright Douglas Gregor 2001.
|
||||
// (C) Copyright Peter Dimov 2001.
|
||||
// (C) Copyright Aleksey Gurtovoy 2003.
|
||||
// (C) Copyright Beman Dawes 2003.
|
||||
// (C) Copyright Jens Maurer 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Comeau C++ compiler setup:
|
||||
|
||||
#include <boost/config/compiler/common_edg.hpp>
|
||||
|
||||
#if (__COMO_VERSION__ <= 4245)
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER <= 1300
|
||||
# if _MSC_VER > 100
|
||||
// only set this in non-strict mode:
|
||||
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
# endif
|
||||
# endif
|
||||
|
||||
// Void returns don't work when emulating VC 6 (Peter Dimov)
|
||||
// TODO: look up if this doesn't apply to the whole 12xx range
|
||||
# if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||
# define BOOST_NO_VOID_RETURNS
|
||||
# endif
|
||||
|
||||
#endif // version 4245
|
||||
|
||||
//
|
||||
// enable __int64 support in VC emulation mode
|
||||
//
|
||||
# if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# define BOOST_HAS_MS_INT64
|
||||
# endif
|
||||
|
||||
#define BOOST_COMPILER "Comeau compiler version " BOOST_STRINGIZE(__COMO_VERSION__)
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't know Comeau prior to version 4245:
|
||||
#if __COMO_VERSION__ < 4245
|
||||
# error "Compiler not configured - please reconfigure"
|
||||
#endif
|
||||
//
|
||||
// last known and checked version is 4245:
|
||||
#if (__COMO_VERSION__ > 4245)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
144
boost/boost/config/compiler/common_edg.hpp
Normal file
144
boost/boost/config/compiler/common_edg.hpp
Normal file
@ -0,0 +1,144 @@
|
||||
// (C) Copyright John Maddock 2001 - 2002.
|
||||
// (C) Copyright Jens Maurer 2001.
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Aleksey Gurtovoy 2002.
|
||||
// (C) Copyright Markus Schoepflin 2005.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
//
|
||||
// Options common to all edg based compilers.
|
||||
//
|
||||
// This is included from within the individual compiler mini-configs.
|
||||
|
||||
#ifndef __EDG_VERSION__
|
||||
# error This file requires that __EDG_VERSION__ be defined.
|
||||
#endif
|
||||
|
||||
#if (__EDG_VERSION__ <= 238)
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_NO_SFINAE
|
||||
#endif
|
||||
|
||||
#if (__EDG_VERSION__ <= 240)
|
||||
# define BOOST_NO_VOID_RETURNS
|
||||
#endif
|
||||
|
||||
#if (__EDG_VERSION__ <= 241) && !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
|
||||
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
#endif
|
||||
|
||||
#if (__EDG_VERSION__ <= 244) && !defined(BOOST_NO_TEMPLATE_TEMPLATES)
|
||||
# define BOOST_NO_TEMPLATE_TEMPLATES
|
||||
#endif
|
||||
|
||||
#if (__EDG_VERSION__ < 300) && !defined(BOOST_NO_IS_ABSTRACT)
|
||||
# define BOOST_NO_IS_ABSTRACT
|
||||
#endif
|
||||
|
||||
#if (__EDG_VERSION__ <= 303) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
|
||||
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
|
||||
#endif
|
||||
|
||||
// See also kai.hpp which checks a Kai-specific symbol for EH
|
||||
# if !defined(__KCC) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
# endif
|
||||
|
||||
# if !defined(__NO_LONG_LONG)
|
||||
# define BOOST_HAS_LONG_LONG
|
||||
# else
|
||||
# define BOOST_NO_LONG_LONG
|
||||
# endif
|
||||
|
||||
// Not sure what version was the first to support #pragma once, but
|
||||
// different EDG-based compilers (e.g. Intel) supported it for ages.
|
||||
// Add a proper version check if it causes problems.
|
||||
#define BOOST_HAS_PRAGMA_ONCE
|
||||
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
// See above for BOOST_NO_LONG_LONG
|
||||
//
|
||||
#if (__EDG_VERSION__ < 310)
|
||||
# define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#endif
|
||||
#if (__EDG_VERSION__ <= 310)
|
||||
// No support for initializer lists
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#endif
|
||||
#if (__EDG_VERSION__ < 400)
|
||||
# define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#endif
|
||||
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_CHAR16_T
|
||||
#define BOOST_NO_CXX11_CHAR32_T
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_DECLTYPE
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
#ifdef c_plusplus
|
||||
// EDG has "long long" in non-strict mode
|
||||
// However, some libraries have insufficient "long long" support
|
||||
// #define BOOST_HAS_LONG_LONG
|
||||
#endif
|
19
boost/boost/config/compiler/compaq_cxx.hpp
Normal file
19
boost/boost/config/compiler/compaq_cxx.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
// (C) Copyright John Maddock 2001 - 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Tru64 C++ compiler setup (now HP):
|
||||
|
||||
#define BOOST_COMPILER "HP Tru64 C++ " BOOST_STRINGIZE(__DECCXX_VER)
|
||||
|
||||
#include <boost/config/compiler/common_edg.hpp>
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// Nothing to do here?
|
||||
|
||||
|
||||
|
93
boost/boost/config/compiler/cray.hpp
Normal file
93
boost/boost/config/compiler/cray.hpp
Normal file
@ -0,0 +1,93 @@
|
||||
// (C) Copyright John Maddock 2011.
|
||||
// (C) Copyright Cray, Inc. 2013
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Greenhills C compiler setup:
|
||||
|
||||
#define BOOST_COMPILER "Cray C version " BOOST_STRINGIZE(_RELEASE)
|
||||
|
||||
#if _RELEASE < 8
|
||||
# error "Boost is not configured for Cray compilers prior to version 8, please try the configure script."
|
||||
#endif
|
||||
|
||||
//
|
||||
// Check this is a recent EDG based compiler, otherwise we don't support it here:
|
||||
//
|
||||
#ifndef __EDG_VERSION__
|
||||
# error "Unsupported Cray compiler, please try running the configure script."
|
||||
#endif
|
||||
|
||||
#include <boost/config/compiler/common_edg.hpp>
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_HAS_NRVO
|
||||
#define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#define BOOST_HAS_NRVO
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DECLTYPE
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
#define BOOST_NO_CXX11_CHAR32_T
|
||||
#define BOOST_NO_CXX11_CHAR16_T
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
|
||||
//#define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
|
||||
#define BOOST_MATH_DISABLE_STD_FPCLASSIFY
|
||||
//#define BOOST_HAS_FPCLASSIFY
|
||||
|
||||
#define BOOST_SP_USE_PTHREADS
|
||||
#define BOOST_AC_USE_PTHREADS
|
||||
|
||||
/* everything that follows is working around what are thought to be
|
||||
* compiler shortcomings. Revist all of these regularly.
|
||||
*/
|
||||
|
||||
//#define BOOST_USE_ENUM_STATIC_ASSERT
|
||||
//#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS //(this may be implied by the previous #define
|
||||
|
||||
// These constants should be provided by the
|
||||
// compiler, at least when -hgnu is asserted on the command line.
|
||||
|
||||
#ifndef __ATOMIC_RELAXED
|
||||
#define __ATOMIC_RELAXED 0
|
||||
#define __ATOMIC_CONSUME 1
|
||||
#define __ATOMIC_ACQUIRE 2
|
||||
#define __ATOMIC_RELEASE 3
|
||||
#define __ATOMIC_ACQ_REL 4
|
||||
#define __ATOMIC_SEQ_CST 5
|
||||
#endif
|
||||
|
||||
|
||||
|
125
boost/boost/config/compiler/digitalmars.hpp
Normal file
125
boost/boost/config/compiler/digitalmars.hpp
Normal file
@ -0,0 +1,125 @@
|
||||
// Copyright (C) Christof Meerwald 2003
|
||||
// Copyright (C) Dan Watkins 2003
|
||||
//
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Digital Mars C++ compiler setup:
|
||||
#define BOOST_COMPILER __DMC_VERSION_STRING__
|
||||
|
||||
#define BOOST_HAS_LONG_LONG
|
||||
#define BOOST_HAS_PRAGMA_ONCE
|
||||
|
||||
#if !defined(BOOST_STRICT_CONFIG)
|
||||
#define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
#define BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
#define BOOST_NO_UNREACHABLE_RETURN_DETECTION
|
||||
#define BOOST_NO_SFINAE
|
||||
#define BOOST_NO_USING_TEMPLATE
|
||||
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
|
||||
#endif
|
||||
|
||||
//
|
||||
// has macros:
|
||||
#define BOOST_HAS_DIRENT_H
|
||||
#define BOOST_HAS_STDINT_H
|
||||
#define BOOST_HAS_WINTHREADS
|
||||
|
||||
#if (__DMC__ >= 0x847)
|
||||
#define BOOST_HAS_EXPM1
|
||||
#define BOOST_HAS_LOG1P
|
||||
#endif
|
||||
|
||||
//
|
||||
// Is this really the best way to detect whether the std lib is in namespace std?
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#endif
|
||||
#if !defined(__STL_IMPORT_VENDOR_CSTD) && !defined(_STLP_IMPORT_VENDOR_CSTD)
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
#endif
|
||||
|
||||
|
||||
// check for exception handling support:
|
||||
#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_CHAR16_T
|
||||
#define BOOST_NO_CXX11_CHAR32_T
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_DECLTYPE
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
#if (__DMC__ <= 0x840)
|
||||
#error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
//
|
||||
// last known and checked version is ...:
|
||||
#if (__DMC__ > 0x848)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
328
boost/boost/config/compiler/gcc.hpp
Normal file
328
boost/boost/config/compiler/gcc.hpp
Normal file
@ -0,0 +1,328 @@
|
||||
// (C) Copyright John Maddock 2001 - 2003.
|
||||
// (C) Copyright Darin Adler 2001 - 2002.
|
||||
// (C) Copyright Jens Maurer 2001 - 2002.
|
||||
// (C) Copyright Beman Dawes 2001 - 2003.
|
||||
// (C) Copyright Douglas Gregor 2002.
|
||||
// (C) Copyright David Abrahams 2002 - 2003.
|
||||
// (C) Copyright Synge Todo 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// GNU C++ compiler setup.
|
||||
|
||||
//
|
||||
// Define BOOST_GCC so we know this is "real" GCC and not some pretender:
|
||||
//
|
||||
#define BOOST_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#if !defined(__CUDACC__)
|
||||
#define BOOST_GCC BOOST_GCC_VERSION
|
||||
#endif
|
||||
|
||||
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
|
||||
# define BOOST_GCC_CXX11
|
||||
#endif
|
||||
|
||||
#if __GNUC__ == 3
|
||||
# if defined (__PATHSCALE__)
|
||||
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
# define BOOST_NO_IS_ABSTRACT
|
||||
# endif
|
||||
|
||||
# if __GNUC_MINOR__ < 4
|
||||
# define BOOST_NO_IS_ABSTRACT
|
||||
# endif
|
||||
# define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#endif
|
||||
#if __GNUC__ < 4
|
||||
//
|
||||
// All problems to gcc-3.x and earlier here:
|
||||
//
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
# ifdef __OPEN64__
|
||||
# define BOOST_NO_IS_ABSTRACT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// GCC prior to 3.4 had #pragma once too but it didn't work well with filesystem links
|
||||
#if BOOST_GCC_VERSION >= 30400
|
||||
#define BOOST_HAS_PRAGMA_ONCE
|
||||
#endif
|
||||
|
||||
#if BOOST_GCC_VERSION < 40400
|
||||
// Previous versions of GCC did not completely implement value-initialization:
|
||||
// GCC Bug 30111, "Value-initialization of POD base class doesn't initialize
|
||||
// members", reported by Jonathan Wakely in 2006,
|
||||
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 (fixed for GCC 4.4)
|
||||
// GCC Bug 33916, "Default constructor fails to initialize array members",
|
||||
// reported by Michael Elizabeth Chastain in 2007,
|
||||
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 (fixed for GCC 4.2.4)
|
||||
// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
|
||||
#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
#endif
|
||||
|
||||
#if !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Threading support: Turn this on unconditionally here (except for
|
||||
// those platforms where we can know for sure). It will get turned off again
|
||||
// later if no threading API is detected.
|
||||
//
|
||||
#if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__)
|
||||
# define BOOST_HAS_THREADS
|
||||
#endif
|
||||
|
||||
//
|
||||
// gcc has "long long"
|
||||
// Except on Darwin with standard compliance enabled (-pedantic)
|
||||
// Apple gcc helpfully defines this macro we can query
|
||||
//
|
||||
#if !defined(__DARWIN_NO_LONG_LONG)
|
||||
# define BOOST_HAS_LONG_LONG
|
||||
#endif
|
||||
|
||||
//
|
||||
// gcc implements the named return value optimization since version 3.1
|
||||
//
|
||||
#define BOOST_HAS_NRVO
|
||||
|
||||
// Branch prediction hints
|
||||
#define BOOST_LIKELY(x) __builtin_expect(x, 1)
|
||||
#define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
|
||||
|
||||
//
|
||||
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
|
||||
//
|
||||
#if __GNUC__ >= 4
|
||||
# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__)
|
||||
// All Win32 development environments, including 64-bit Windows and MinGW, define
|
||||
// _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment,
|
||||
// so does not define _WIN32 or its variants.
|
||||
# define BOOST_HAS_DECLSPEC
|
||||
# define BOOST_SYMBOL_EXPORT __attribute__((__dllexport__))
|
||||
# define BOOST_SYMBOL_IMPORT __attribute__((__dllimport__))
|
||||
# else
|
||||
# define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
|
||||
# define BOOST_SYMBOL_IMPORT
|
||||
# endif
|
||||
# define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
|
||||
#else
|
||||
// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
|
||||
# define BOOST_SYMBOL_EXPORT
|
||||
#endif
|
||||
|
||||
//
|
||||
// RTTI and typeinfo detection is possible post gcc-4.3:
|
||||
//
|
||||
#if BOOST_GCC_VERSION > 40300
|
||||
# ifndef __GXX_RTTI
|
||||
# ifndef BOOST_NO_TYPEID
|
||||
# define BOOST_NO_TYPEID
|
||||
# endif
|
||||
# ifndef BOOST_NO_RTTI
|
||||
# define BOOST_NO_RTTI
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Recent GCC versions have __int128 when in 64-bit mode.
|
||||
//
|
||||
// We disable this if the compiler is really nvcc with C++03 as it
|
||||
// doesn't actually support __int128 as of CUDA_VERSION=7500
|
||||
// even though it defines __SIZEOF_INT128__.
|
||||
// See https://svn.boost.org/trac/boost/ticket/8048
|
||||
// https://svn.boost.org/trac/boost/ticket/11852
|
||||
// Only re-enable this for nvcc if you're absolutely sure
|
||||
// of the circumstances under which it's supported:
|
||||
//
|
||||
#if defined(__CUDACC__)
|
||||
# if defined(BOOST_GCC_CXX11)
|
||||
# define BOOST_NVCC_CXX11
|
||||
# else
|
||||
# define BOOST_NVCC_CXX03
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__SIZEOF_INT128__) && !defined(BOOST_NVCC_CXX03)
|
||||
# define BOOST_HAS_INT128
|
||||
#endif
|
||||
//
|
||||
// Recent GCC versions have a __float128 native type, we need to
|
||||
// include a std lib header to detect this - not ideal, but we'll
|
||||
// be including <cstddef> later anyway when we select the std lib.
|
||||
//
|
||||
// Nevertheless, as of CUDA 7.5, using __float128 with the host
|
||||
// compiler in pre-C++11 mode is still not supported.
|
||||
// See https://svn.boost.org/trac/boost/ticket/11852
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#else
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(BOOST_NVCC_CXX03)
|
||||
# define BOOST_HAS_FLOAT128
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.3.n and later
|
||||
//
|
||||
#if (BOOST_GCC_VERSION >= 40300) && defined(BOOST_GCC_CXX11)
|
||||
// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
|
||||
// passed on the command line, which in turn defines
|
||||
// __GXX_EXPERIMENTAL_CXX0X__.
|
||||
# define BOOST_HAS_DECLTYPE
|
||||
# define BOOST_HAS_RVALUE_REFS
|
||||
# define BOOST_HAS_STATIC_ASSERT
|
||||
# define BOOST_HAS_VARIADIC_TMPL
|
||||
#else
|
||||
# define BOOST_NO_CXX11_DECLTYPE
|
||||
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.4.n and later
|
||||
//
|
||||
#if (BOOST_GCC_VERSION < 40400) || !defined(BOOST_GCC_CXX11)
|
||||
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
# define BOOST_NO_CXX11_CHAR16_T
|
||||
# define BOOST_NO_CXX11_CHAR32_T
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
# define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
|
||||
#if BOOST_GCC_VERSION < 40500
|
||||
# define BOOST_NO_SFINAE_EXPR
|
||||
#endif
|
||||
|
||||
// GCC 4.5 forbids declaration of defaulted functions in private or protected sections
|
||||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 5) || !defined(BOOST_GCC_CXX11)
|
||||
# define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.5.0 and later
|
||||
//
|
||||
#if (BOOST_GCC_VERSION < 40500) || !defined(BOOST_GCC_CXX11)
|
||||
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
# define BOOST_NO_CXX11_LAMBDAS
|
||||
# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
# define BOOST_NO_CXX11_RAW_LITERALS
|
||||
# define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.5.1 and later
|
||||
//
|
||||
#if (BOOST_GCC_VERSION < 40501) || !defined(BOOST_GCC_CXX11)
|
||||
// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_CXX11_SCOPED_ENUMS before 4.5.1
|
||||
// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064
|
||||
# define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.6.n and later
|
||||
//
|
||||
#if (BOOST_GCC_VERSION < 40600) || !defined(BOOST_GCC_CXX11)
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.7.n and later
|
||||
//
|
||||
#if (BOOST_GCC_VERSION < 40700) || !defined(BOOST_GCC_CXX11)
|
||||
# define BOOST_NO_CXX11_FINAL
|
||||
# define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
# define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
# define BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.8.n and later
|
||||
//
|
||||
#if (BOOST_GCC_VERSION < 40800) || !defined(BOOST_GCC_CXX11)
|
||||
# define BOOST_NO_CXX11_ALIGNAS
|
||||
# define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.8.1 and later
|
||||
//
|
||||
#if (BOOST_GCC_VERSION < 40801) || !defined(BOOST_GCC_CXX11)
|
||||
# define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
# define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
|
||||
// C++14 features in 4.9.0 and later
|
||||
//
|
||||
#if (BOOST_GCC_VERSION < 40900) || (__cplusplus < 201300)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
# if !((BOOST_GCC_VERSION >= 40801) && (BOOST_GCC_VERSION < 40900) && defined(BOOST_GCC_CXX11))
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
//
|
||||
// Unused attribute:
|
||||
#if __GNUC__ >= 4
|
||||
# define BOOST_ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
#endif
|
||||
//
|
||||
// __builtin_unreachable:
|
||||
#if BOOST_GCC_VERSION >= 40800
|
||||
#define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable();
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
# define BOOST_COMPILER "GNU C++ version " __VERSION__
|
||||
#endif
|
||||
|
||||
// ConceptGCC compiler:
|
||||
// http://www.generic-programming.org/software/ConceptGCC/
|
||||
#ifdef __GXX_CONCEPTS__
|
||||
# define BOOST_HAS_CONCEPTS
|
||||
# define BOOST_COMPILER "ConceptGCC version " __VERSION__
|
||||
#endif
|
||||
|
||||
// versions check:
|
||||
// we don't know gcc prior to version 3.30:
|
||||
#if (BOOST_GCC_VERSION< 30300)
|
||||
# error "Compiler not configured - please reconfigure"
|
||||
#endif
|
||||
//
|
||||
// last known and checked version is 4.9:
|
||||
#if (BOOST_GCC_VERSION > 40900)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# else
|
||||
// we don't emit warnings here anymore since there are no defect macros defined for
|
||||
// gcc post 3.4, so any failures are gcc regressions...
|
||||
//# warning "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
||||
|
96
boost/boost/config/compiler/gcc_xml.hpp
Normal file
96
boost/boost/config/compiler/gcc_xml.hpp
Normal file
@ -0,0 +1,96 @@
|
||||
// (C) Copyright John Maddock 2006.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// GCC-XML C++ compiler setup:
|
||||
|
||||
# if !defined(__GCCXML_GNUC__) || ((__GCCXML_GNUC__ <= 3) && (__GCCXML_GNUC_MINOR__ <= 3))
|
||||
# define BOOST_NO_IS_ABSTRACT
|
||||
# endif
|
||||
|
||||
//
|
||||
// Threading support: Turn this on unconditionally here (except for
|
||||
// those platforms where we can know for sure). It will get turned off again
|
||||
// later if no threading API is detected.
|
||||
//
|
||||
#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(linux) && !defined(__linux) && !defined(__linux__)
|
||||
# define BOOST_HAS_THREADS
|
||||
#endif
|
||||
|
||||
//
|
||||
// gcc has "long long"
|
||||
//
|
||||
#define BOOST_HAS_LONG_LONG
|
||||
|
||||
// C++0x features:
|
||||
//
|
||||
# define BOOST_NO_CXX11_CONSTEXPR
|
||||
# define BOOST_NO_CXX11_NULLPTR
|
||||
# define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
# define BOOST_NO_CXX11_DECLTYPE
|
||||
# define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
# define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
# define BOOST_NO_CXX11_CHAR16_T
|
||||
# define BOOST_NO_CXX11_CHAR32_T
|
||||
# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
# define BOOST_NO_SFINAE_EXPR
|
||||
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
# define BOOST_NO_CXX11_LAMBDAS
|
||||
# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
# define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
# define BOOST_NO_CXX11_RAW_LITERALS
|
||||
# define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
# define BOOST_NO_CXX11_NOEXCEPT
|
||||
# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
# define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
# define BOOST_NO_CXX11_ALIGNAS
|
||||
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
# define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
# define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
# define BOOST_NO_CXX11_FINAL
|
||||
# define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
#define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__
|
||||
|
||||
|
28
boost/boost/config/compiler/greenhills.hpp
Normal file
28
boost/boost/config/compiler/greenhills.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// (C) Copyright John Maddock 2001.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Greenhills C++ compiler setup:
|
||||
|
||||
#define BOOST_COMPILER "Greenhills C++ version " BOOST_STRINGIZE(__ghs)
|
||||
|
||||
#include <boost/config/compiler/common_edg.hpp>
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support Greenhills prior to version 0:
|
||||
#if __ghs < 0
|
||||
# error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
//
|
||||
// last known and checked version is 0:
|
||||
#if (__ghs > 0)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
146
boost/boost/config/compiler/hp_acc.hpp
Normal file
146
boost/boost/config/compiler/hp_acc.hpp
Normal file
@ -0,0 +1,146 @@
|
||||
// (C) Copyright John Maddock 2001 - 2003.
|
||||
// (C) Copyright Jens Maurer 2001 - 2003.
|
||||
// (C) Copyright Aleksey Gurtovoy 2002.
|
||||
// (C) Copyright David Abrahams 2002 - 2003.
|
||||
// (C) Copyright Toon Knapen 2003.
|
||||
// (C) Copyright Boris Gubenko 2006 - 2007.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// HP aCC C++ compiler setup:
|
||||
|
||||
#if defined(__EDG__)
|
||||
#include <boost/config/compiler/common_edg.hpp>
|
||||
#endif
|
||||
|
||||
#if (__HP_aCC <= 33100)
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
# if !defined(_NAMESPACE_STD)
|
||||
# define BOOST_NO_STD_LOCALE
|
||||
# define BOOST_NO_STRINGSTREAM
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (__HP_aCC <= 33300)
|
||||
// member templates are sufficiently broken that we disable them for now
|
||||
# define BOOST_NO_MEMBER_TEMPLATES
|
||||
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
|
||||
# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
|
||||
#endif
|
||||
|
||||
#if (__HP_aCC <= 38000)
|
||||
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#endif
|
||||
|
||||
#if (__HP_aCC > 50000) && (__HP_aCC < 60000)
|
||||
# define BOOST_NO_UNREACHABLE_RETURN_DETECTION
|
||||
# define BOOST_NO_TEMPLATE_TEMPLATES
|
||||
# define BOOST_NO_SWPRINTF
|
||||
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
|
||||
# define BOOST_NO_IS_ABSTRACT
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
#endif
|
||||
|
||||
// optional features rather than defects:
|
||||
#if (__HP_aCC >= 33900)
|
||||
# define BOOST_HAS_LONG_LONG
|
||||
# define BOOST_HAS_PARTIAL_STD_ALLOCATOR
|
||||
#endif
|
||||
|
||||
#if (__HP_aCC >= 50000 ) && (__HP_aCC <= 53800 ) || (__HP_aCC < 31300 )
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD
|
||||
#endif
|
||||
|
||||
// This macro should not be defined when compiling in strict ansi
|
||||
// mode, but, currently, we don't have the ability to determine
|
||||
// what standard mode we are compiling with. Some future version
|
||||
// of aCC6 compiler will provide predefined macros reflecting the
|
||||
// compilation options, including the standard mode.
|
||||
#if (__HP_aCC >= 60000) || ((__HP_aCC > 38000) && defined(__hpxstd98))
|
||||
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#endif
|
||||
|
||||
#define BOOST_COMPILER "HP aCC version " BOOST_STRINGIZE(__HP_aCC)
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support HP aCC prior to version 33000:
|
||||
#if __HP_aCC < 33000
|
||||
# error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
|
||||
//
|
||||
// Extended checks for supporting aCC on PA-RISC
|
||||
#if __HP_aCC > 30000 && __HP_aCC < 50000
|
||||
# if __HP_aCC < 38000
|
||||
// versions prior to version A.03.80 not supported
|
||||
# error "Compiler version not supported - version A.03.80 or higher is required"
|
||||
# elif !defined(__hpxstd98)
|
||||
// must compile using the option +hpxstd98 with version A.03.80 and above
|
||||
# error "Compiler option '+hpxstd98' is required for proper support"
|
||||
# endif //PA-RISC
|
||||
#endif
|
||||
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
|
||||
//
|
||||
#if !defined(__EDG__)
|
||||
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_CHAR16_T
|
||||
#define BOOST_NO_CXX11_CHAR32_T
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_DECLTYPE
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
/*
|
||||
See https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443331 and
|
||||
https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443436
|
||||
*/
|
||||
|
||||
#if (__HP_aCC < 62500) || !defined(HP_CXX0x_SOURCE)
|
||||
#define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// last known and checked version for HP-UX/ia64 is 61300
|
||||
// last known and checked version for PA-RISC is 38000
|
||||
#if ((__HP_aCC > 61300) || ((__HP_aCC > 38000) && defined(__hpxstd98)))
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
552
boost/boost/config/compiler/intel.hpp
Normal file
552
boost/boost/config/compiler/intel.hpp
Normal file
@ -0,0 +1,552 @@
|
||||
// (C) Copyright John Maddock 2001-8.
|
||||
// (C) Copyright Peter Dimov 2001.
|
||||
// (C) Copyright Jens Maurer 2001.
|
||||
// (C) Copyright David Abrahams 2002 - 2003.
|
||||
// (C) Copyright Aleksey Gurtovoy 2002 - 2003.
|
||||
// (C) Copyright Guillaume Melquiond 2002 - 2003.
|
||||
// (C) Copyright Beman Dawes 2003.
|
||||
// (C) Copyright Martin Wille 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Intel compiler setup:
|
||||
|
||||
#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) && (defined(_MSC_VER) || defined(__GNUC__))
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <boost/config/compiler/visualc.hpp>
|
||||
|
||||
#undef BOOST_MSVC
|
||||
#undef BOOST_MSVC_FULL_VER
|
||||
|
||||
#if (__INTEL_COMPILER >= 1500) && (_MSC_VER >= 1900)
|
||||
//
|
||||
// These appear to be supported, even though VC++ may not support them:
|
||||
//
|
||||
#define BOOST_HAS_EXPM1
|
||||
#define BOOST_HAS_LOG1P
|
||||
#undef BOOST_NO_CXX14_BINARY_LITERALS
|
||||
// This one may be a little risky to enable??
|
||||
#undef BOOST_NO_SFINAE_EXPR
|
||||
|
||||
#endif
|
||||
|
||||
#if (__INTEL_COMPILER <= 1600) && !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/config/compiler/gcc.hpp>
|
||||
|
||||
#undef BOOST_GCC_VERSION
|
||||
#undef BOOST_GCC_CXX11
|
||||
|
||||
#endif
|
||||
|
||||
#undef BOOST_COMPILER
|
||||
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#if __INTEL_COMPILER == 9999
|
||||
# define BOOST_INTEL_CXX_VERSION 1200 // Intel bug in 12.1.
|
||||
#else
|
||||
# define BOOST_INTEL_CXX_VERSION __INTEL_COMPILER
|
||||
#endif
|
||||
#elif defined(__ICL)
|
||||
# define BOOST_INTEL_CXX_VERSION __ICL
|
||||
#elif defined(__ICC)
|
||||
# define BOOST_INTEL_CXX_VERSION __ICC
|
||||
#elif defined(__ECC)
|
||||
# define BOOST_INTEL_CXX_VERSION __ECC
|
||||
#endif
|
||||
|
||||
// Flags determined by comparing output of 'icpc -dM -E' with and without '-std=c++0x'
|
||||
#if (!(defined(_WIN32) || defined(_WIN64)) && defined(__STDC_HOSTED__) && (__STDC_HOSTED__ && (BOOST_INTEL_CXX_VERSION <= 1200))) || defined(__GXX_EXPERIMENTAL_CPP0X__) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define BOOST_INTEL_STDCXX0X
|
||||
#endif
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
|
||||
# define BOOST_INTEL_STDCXX0X
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define BOOST_INTEL_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_COMPILER)
|
||||
# if defined(BOOST_INTEL_STDCXX0X)
|
||||
# define BOOST_COMPILER "Intel C++ C++0x mode version " BOOST_STRINGIZE(BOOST_INTEL_CXX_VERSION)
|
||||
# else
|
||||
# define BOOST_COMPILER "Intel C++ version " BOOST_STRINGIZE(BOOST_INTEL_CXX_VERSION)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define BOOST_INTEL BOOST_INTEL_CXX_VERSION
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
# define BOOST_INTEL_WIN BOOST_INTEL
|
||||
#else
|
||||
# define BOOST_INTEL_LINUX BOOST_INTEL
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/config/compiler/common_edg.hpp>
|
||||
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#if __INTEL_COMPILER == 9999
|
||||
# define BOOST_INTEL_CXX_VERSION 1200 // Intel bug in 12.1.
|
||||
#else
|
||||
# define BOOST_INTEL_CXX_VERSION __INTEL_COMPILER
|
||||
#endif
|
||||
#elif defined(__ICL)
|
||||
# define BOOST_INTEL_CXX_VERSION __ICL
|
||||
#elif defined(__ICC)
|
||||
# define BOOST_INTEL_CXX_VERSION __ICC
|
||||
#elif defined(__ECC)
|
||||
# define BOOST_INTEL_CXX_VERSION __ECC
|
||||
#endif
|
||||
|
||||
// Flags determined by comparing output of 'icpc -dM -E' with and without '-std=c++0x'
|
||||
#if (!(defined(_WIN32) || defined(_WIN64)) && defined(__STDC_HOSTED__) && (__STDC_HOSTED__ && (BOOST_INTEL_CXX_VERSION <= 1200))) || defined(__GXX_EXPERIMENTAL_CPP0X__) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define BOOST_INTEL_STDCXX0X
|
||||
#endif
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
|
||||
# define BOOST_INTEL_STDCXX0X
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define BOOST_INTEL_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_COMPILER)
|
||||
# if defined(BOOST_INTEL_STDCXX0X)
|
||||
# define BOOST_COMPILER "Intel C++ C++0x mode version " BOOST_STRINGIZE(BOOST_INTEL_CXX_VERSION)
|
||||
# else
|
||||
# define BOOST_COMPILER "Intel C++ version " BOOST_STRINGIZE(BOOST_INTEL_CXX_VERSION)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define BOOST_INTEL BOOST_INTEL_CXX_VERSION
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
# define BOOST_INTEL_WIN BOOST_INTEL
|
||||
#else
|
||||
# define BOOST_INTEL_LINUX BOOST_INTEL
|
||||
#endif
|
||||
|
||||
#if (BOOST_INTEL_CXX_VERSION <= 600)
|
||||
|
||||
# if defined(_MSC_VER) && (_MSC_VER <= 1300) // added check for <= VC 7 (Peter Dimov)
|
||||
|
||||
// Boost libraries assume strong standard conformance unless otherwise
|
||||
// indicated by a config macro. As configured by Intel, the EDG front-end
|
||||
// requires certain compiler options be set to achieve that strong conformance.
|
||||
// Particularly /Qoption,c,--arg_dep_lookup (reported by Kirk Klobe & Thomas Witt)
|
||||
// and /Zc:wchar_t,forScope. See boost-root/tools/build/intel-win32-tools.jam for
|
||||
// details as they apply to particular versions of the compiler. When the
|
||||
// compiler does not predefine a macro indicating if an option has been set,
|
||||
// this config file simply assumes the option has been set.
|
||||
// Thus BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP will not be defined, even if
|
||||
// the compiler option is not enabled.
|
||||
|
||||
# define BOOST_NO_SWPRINTF
|
||||
# endif
|
||||
|
||||
// Void returns, 64 bit integrals don't work when emulating VC 6 (Peter Dimov)
|
||||
|
||||
# if defined(_MSC_VER) && (_MSC_VER <= 1200)
|
||||
# define BOOST_NO_VOID_RETURNS
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (BOOST_INTEL_CXX_VERSION <= 710) && defined(_WIN32)
|
||||
# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS
|
||||
#endif
|
||||
|
||||
// See http://aspn.activestate.com/ASPN/Mail/Message/boost/1614864
|
||||
#if BOOST_INTEL_CXX_VERSION < 600
|
||||
# define BOOST_NO_INTRINSIC_WCHAR_T
|
||||
#else
|
||||
// We should test the macro _WCHAR_T_DEFINED to check if the compiler
|
||||
// supports wchar_t natively. *BUT* there is a problem here: the standard
|
||||
// headers define this macro if they typedef wchar_t. Anyway, we're lucky
|
||||
// because they define it without a value, while Intel C++ defines it
|
||||
// to 1. So we can check its value to see if the macro was defined natively
|
||||
// or not.
|
||||
// Under UNIX, the situation is exactly the same, but the macro _WCHAR_T
|
||||
// is used instead.
|
||||
# if ((_WCHAR_T_DEFINED + 0) == 0) && ((_WCHAR_T + 0) == 0)
|
||||
# define BOOST_NO_INTRINSIC_WCHAR_T
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
|
||||
//
|
||||
// Figure out when Intel is emulating this gcc bug
|
||||
// (All Intel versions prior to 9.0.26, and versions
|
||||
// later than that if they are set up to emulate gcc 3.2
|
||||
// or earlier):
|
||||
//
|
||||
# if ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) || (BOOST_INTEL < 900) || (__INTEL_COMPILER_BUILD_DATE < 20050912)
|
||||
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
|
||||
# endif
|
||||
#endif
|
||||
#if (defined(__GNUC__) && (__GNUC__ < 4)) || (defined(_WIN32) && (BOOST_INTEL_CXX_VERSION <= 1200)) || (BOOST_INTEL_CXX_VERSION <= 1200)
|
||||
// GCC or VC emulation:
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#endif
|
||||
//
|
||||
// Verify that we have actually got BOOST_NO_INTRINSIC_WCHAR_T
|
||||
// set correctly, if we don't do this now, we will get errors later
|
||||
// in type_traits code among other things, getting this correct
|
||||
// for the Intel compiler is actually remarkably fragile and tricky:
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#if defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
#include <cwchar>
|
||||
template< typename T > struct assert_no_intrinsic_wchar_t;
|
||||
template<> struct assert_no_intrinsic_wchar_t<wchar_t> { typedef void type; };
|
||||
// if you see an error here then you need to unset BOOST_NO_INTRINSIC_WCHAR_T
|
||||
// where it is defined above:
|
||||
typedef assert_no_intrinsic_wchar_t<unsigned short>::type assert_no_intrinsic_wchar_t_;
|
||||
#else
|
||||
template< typename T > struct assert_intrinsic_wchar_t;
|
||||
template<> struct assert_intrinsic_wchar_t<wchar_t> {};
|
||||
// if you see an error here then define BOOST_NO_INTRINSIC_WCHAR_T on the command line:
|
||||
template<> struct assert_intrinsic_wchar_t<unsigned short> {};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER+0 >= 1000)
|
||||
# if _MSC_VER >= 1200
|
||||
# define BOOST_HAS_MS_INT64
|
||||
# endif
|
||||
# define BOOST_NO_SWPRINTF
|
||||
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#elif defined(_WIN32)
|
||||
# define BOOST_DISABLE_WIN32
|
||||
#endif
|
||||
|
||||
// I checked version 6.0 build 020312Z, it implements the NRVO.
|
||||
// Correct this as you find out which version of the compiler
|
||||
// implemented the NRVO first. (Daniel Frey)
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 600)
|
||||
# define BOOST_HAS_NRVO
|
||||
#endif
|
||||
|
||||
// Branch prediction hints
|
||||
// I'm not sure 8.0 was the first version to support these builtins,
|
||||
// update the condition if the version is not accurate. (Andrey Semashev)
|
||||
#if defined(__GNUC__) && BOOST_INTEL_CXX_VERSION >= 800
|
||||
#define BOOST_LIKELY(x) __builtin_expect(x, 1)
|
||||
#define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
|
||||
#endif
|
||||
|
||||
// RTTI
|
||||
// __RTTI is the EDG macro
|
||||
// __INTEL_RTTI__ is the Intel macro
|
||||
// __GXX_RTTI is the g++ macro
|
||||
// _CPPRTTI is the MSVC++ macro
|
||||
#if !defined(__RTTI) && !defined(__INTEL_RTTI__) && !defined(__GXX_RTTI) && !defined(_CPPRTTI)
|
||||
|
||||
#if !defined(BOOST_NO_RTTI)
|
||||
# define BOOST_NO_RTTI
|
||||
#endif
|
||||
|
||||
// in MS mode, static typeid works even when RTTI is off
|
||||
#if !defined(_MSC_VER) && !defined(BOOST_NO_TYPEID)
|
||||
# define BOOST_NO_TYPEID
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support Intel prior to version 6.0:
|
||||
#if BOOST_INTEL_CXX_VERSION < 600
|
||||
# error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
|
||||
// Intel on MacOS requires
|
||||
#if defined(__APPLE__) && defined(__INTEL_COMPILER)
|
||||
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#endif
|
||||
|
||||
// Intel on Altix Itanium
|
||||
#if defined(__itanium__) && defined(__INTEL_COMPILER)
|
||||
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#endif
|
||||
|
||||
//
|
||||
// An attempt to value-initialize a pointer-to-member may trigger an
|
||||
// internal error on Intel <= 11.1 (last checked version), as was
|
||||
// reported by John Maddock, Intel support issue 589832, May 2010.
|
||||
// Moreover, according to test results from Huang-Vista-x86_32_intel,
|
||||
// intel-vc9-win-11.1 may leave a non-POD array uninitialized, in some
|
||||
// cases when it should be value-initialized.
|
||||
// (Niels Dekker, LKEB, May 2010)
|
||||
// Apparently Intel 12.1 (compiler version number 9999 !!) has the same issue (compiler regression).
|
||||
#if defined(__INTEL_COMPILER)
|
||||
# if (__INTEL_COMPILER <= 1110) || (__INTEL_COMPILER == 9999) || (defined(_WIN32) && (__INTEL_COMPILER < 1600))
|
||||
# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
|
||||
//
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
# define BOOST_SYMBOL_EXPORT __attribute__((visibility("default")))
|
||||
# define BOOST_SYMBOL_IMPORT
|
||||
# define BOOST_SYMBOL_VISIBLE __attribute__((visibility("default")))
|
||||
#endif
|
||||
//
|
||||
// C++0x features
|
||||
// For each feature we need to check both the Intel compiler version,
|
||||
// and the version of MSVC or GCC that we are emulating.
|
||||
// See http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/
|
||||
// for a list of which features were implemented in which Intel releases.
|
||||
//
|
||||
#if defined(BOOST_INTEL_STDCXX0X)
|
||||
// BOOST_NO_CXX11_CONSTEXPR:
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40600)) && !defined(_MSC_VER)
|
||||
// Available in earlier Intel versions, but fail our tests:
|
||||
# undef BOOST_NO_CXX11_CONSTEXPR
|
||||
#endif
|
||||
// BOOST_NO_CXX11_NULLPTR:
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1210) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40600)) && (!defined(_MSC_VER) || (_MSC_VER >= 1600))
|
||||
# undef BOOST_NO_CXX11_NULLPTR
|
||||
#endif
|
||||
// BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1210) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40700)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827))
|
||||
# undef BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_DECLTYPE
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40300)) && (!defined(_MSC_VER) || (_MSC_VER >= 1600))
|
||||
# undef BOOST_NO_CXX11_DECLTYPE
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40800)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827))
|
||||
# undef BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40300)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827))
|
||||
# undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1300) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40300)) && (!defined(_MSC_VER) || (_MSC_VER >= 1600))
|
||||
// This is available from earlier Intel versions, but breaks Filesystem and other libraries:
|
||||
# undef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1110) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40300)) && (!defined(_MSC_VER) || (_MSC_VER >= 1600))
|
||||
# undef BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827))
|
||||
# undef BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40200)) && (!defined(_MSC_VER) || (_MSC_VER >= 1400))
|
||||
# undef BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_VER >= 1600))
|
||||
# undef BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_VER >= 1600))
|
||||
# undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_CHAR16_T
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_VER >= 9999))
|
||||
# undef BOOST_NO_CXX11_CHAR16_T
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_CHAR32_T
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_VER >= 9999))
|
||||
# undef BOOST_NO_CXX11_CHAR32_T
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827))
|
||||
# undef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827))
|
||||
# undef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_VER >= 1700))
|
||||
# undef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40501)) && (!defined(_MSC_VER) || (_MSC_VER >= 1700))
|
||||
// This is available but broken in earlier Intel releases.
|
||||
# undef BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_SFINAE_EXPR
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40500)) && (!defined(_MSC_VER) || (_MSC_VER >= 9999))
|
||||
# undef BOOST_NO_SFINAE_EXPR
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40500)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827))
|
||||
// This is available in earlier Intel releases, but breaks Multiprecision:
|
||||
# undef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_LAMBDAS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40500)) && (!defined(_MSC_VER) || (_MSC_VER >= 1600))
|
||||
# undef BOOST_NO_CXX11_LAMBDAS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40500))
|
||||
# undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40600)) && (!defined(_MSC_VER) || (_MSC_VER >= 1700))
|
||||
# undef BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_RAW_LITERALS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40500)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827))
|
||||
# undef BOOST_NO_CXX11_RAW_LITERALS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40500)) && (!defined(_MSC_VER) || (_MSC_VER >= 9999))
|
||||
# undef BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_NOEXCEPT
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40600)) && (!defined(_MSC_VER) || (_MSC_VER >= 9999))
|
||||
// Available in earlier Intel release, but generates errors when used with
|
||||
// conditional exception specifications, for example in multiprecision:
|
||||
# undef BOOST_NO_CXX11_NOEXCEPT
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40600)) && (!defined(_MSC_VER) || (_MSC_VER >= 9999))
|
||||
# undef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40700)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 190021730))
|
||||
# undef BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_ALIGNAS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40800)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 190021730))
|
||||
# undef BOOST_NO_CXX11_ALIGNAS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1200) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827))
|
||||
# undef BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40400)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 190021730))
|
||||
# undef BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40800)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 190021730))
|
||||
# undef BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#endif
|
||||
|
||||
// BOOST_NO_CXX11_FINAL
|
||||
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40700)) && (!defined(_MSC_VER) || (_MSC_VER >= 1700))
|
||||
# undef BOOST_NO_CXX11_FINAL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Broken in all versions up to 15:
|
||||
#define BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
|
||||
|
||||
#if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION <= 1310)
|
||||
# define BOOST_NO_CXX11_HDR_FUTURE
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION == 1400)
|
||||
// A regression in Intel's compiler means that <tuple> seems to be broken in this release as well as <future> :
|
||||
# define BOOST_NO_CXX11_HDR_FUTURE
|
||||
# define BOOST_NO_CXX11_HDR_TUPLE
|
||||
#endif
|
||||
|
||||
// Broken in all versions up to 17:
|
||||
#if !defined(BOOST_NO_CXX14_CONSTEXPR)
|
||||
#define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if (BOOST_INTEL_CXX_VERSION < 1200)
|
||||
//
|
||||
// fenv.h appears not to work with Intel prior to 12.0:
|
||||
//
|
||||
# define BOOST_NO_FENV_H
|
||||
#endif
|
||||
|
||||
// Intel 13.10 fails to access defaulted functions of a base class declared in private or protected sections,
|
||||
// producing the following errors:
|
||||
// error #453: protected function "..." (declared at ...") is not accessible through a "..." pointer or object
|
||||
#if (BOOST_INTEL_CXX_VERSION <= 1310)
|
||||
# define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
|
||||
# define BOOST_HAS_STDINT_H
|
||||
#endif
|
||||
|
||||
#if defined(__CUDACC__)
|
||||
# if defined(BOOST_GCC_CXX11)
|
||||
# define BOOST_NVCC_CXX11
|
||||
# else
|
||||
# define BOOST_NVCC_CXX03
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__) && defined(__GNUC__) && (BOOST_INTEL_CXX_VERSION >= 1310) && !defined(BOOST_NVCC_CXX03)
|
||||
# define BOOST_HAS_INT128
|
||||
#endif
|
||||
|
||||
#endif
|
||||
//
|
||||
// last known and checked version:
|
||||
#if (BOOST_INTEL_CXX_VERSION > 1500)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# elif defined(_MSC_VER)
|
||||
//
|
||||
// We don't emit this warning any more, since we have so few
|
||||
// defect macros set anyway (just the one).
|
||||
//
|
||||
//# pragma message("Unknown compiler version - please run the configure tests and report the results")
|
||||
# endif
|
||||
#endif
|
||||
|
33
boost/boost/config/compiler/kai.hpp
Normal file
33
boost/boost/config/compiler/kai.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
// (C) Copyright John Maddock 2001.
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Aleksey Gurtovoy 2002.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Kai C++ compiler setup:
|
||||
|
||||
#include <boost/config/compiler/common_edg.hpp>
|
||||
|
||||
# if (__KCC_VERSION <= 4001) || !defined(BOOST_STRICT_CONFIG)
|
||||
// at least on Sun, the contents of <cwchar> is not in namespace std
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
# endif
|
||||
|
||||
// see also common_edg.hpp which needs a special check for __KCC
|
||||
# if !defined(_EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
# endif
|
||||
|
||||
//
|
||||
// last known and checked version is 4001:
|
||||
#if (__KCC_VERSION > 4001)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
180
boost/boost/config/compiler/metrowerks.hpp
Normal file
180
boost/boost/config/compiler/metrowerks.hpp
Normal file
@ -0,0 +1,180 @@
|
||||
// (C) Copyright John Maddock 2001.
|
||||
// (C) Copyright Darin Adler 2001.
|
||||
// (C) Copyright Peter Dimov 2001.
|
||||
// (C) Copyright David Abrahams 2001 - 2002.
|
||||
// (C) Copyright Beman Dawes 2001 - 2003.
|
||||
// (C) Copyright Stefan Slapeta 2004.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Metrowerks C++ compiler setup:
|
||||
|
||||
// locale support is disabled when linking with the dynamic runtime
|
||||
# ifdef _MSL_NO_LOCALE
|
||||
# define BOOST_NO_STD_LOCALE
|
||||
# endif
|
||||
|
||||
# if __MWERKS__ <= 0x2301 // 5.3
|
||||
# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
# define BOOST_NO_POINTER_TO_MEMBER_CONST
|
||||
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD
|
||||
# endif
|
||||
|
||||
# if __MWERKS__ <= 0x2401 // 6.2
|
||||
//# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
# endif
|
||||
|
||||
# if(__MWERKS__ <= 0x2407) // 7.x
|
||||
# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
|
||||
# define BOOST_NO_UNREACHABLE_RETURN_DETECTION
|
||||
# endif
|
||||
|
||||
# if(__MWERKS__ <= 0x3003) // 8.x
|
||||
# define BOOST_NO_SFINAE
|
||||
# endif
|
||||
|
||||
// the "|| !defined(BOOST_STRICT_CONFIG)" part should apply to the last
|
||||
// tested version *only*:
|
||||
# if(__MWERKS__ <= 0x3207) || !defined(BOOST_STRICT_CONFIG) // 9.6
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_IS_ABSTRACT
|
||||
# endif
|
||||
|
||||
#if !__option(wchar_type)
|
||||
# define BOOST_NO_INTRINSIC_WCHAR_T
|
||||
#endif
|
||||
|
||||
#if !__option(exceptions) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if (__INTEL__ && _WIN32) || (__POWERPC__ && macintosh)
|
||||
# if __MWERKS__ == 0x3000
|
||||
# define BOOST_COMPILER_VERSION 8.0
|
||||
# elif __MWERKS__ == 0x3001
|
||||
# define BOOST_COMPILER_VERSION 8.1
|
||||
# elif __MWERKS__ == 0x3002
|
||||
# define BOOST_COMPILER_VERSION 8.2
|
||||
# elif __MWERKS__ == 0x3003
|
||||
# define BOOST_COMPILER_VERSION 8.3
|
||||
# elif __MWERKS__ == 0x3200
|
||||
# define BOOST_COMPILER_VERSION 9.0
|
||||
# elif __MWERKS__ == 0x3201
|
||||
# define BOOST_COMPILER_VERSION 9.1
|
||||
# elif __MWERKS__ == 0x3202
|
||||
# define BOOST_COMPILER_VERSION 9.2
|
||||
# elif __MWERKS__ == 0x3204
|
||||
# define BOOST_COMPILER_VERSION 9.3
|
||||
# elif __MWERKS__ == 0x3205
|
||||
# define BOOST_COMPILER_VERSION 9.4
|
||||
# elif __MWERKS__ == 0x3206
|
||||
# define BOOST_COMPILER_VERSION 9.5
|
||||
# elif __MWERKS__ == 0x3207
|
||||
# define BOOST_COMPILER_VERSION 9.6
|
||||
# else
|
||||
# define BOOST_COMPILER_VERSION __MWERKS__
|
||||
# endif
|
||||
#else
|
||||
# define BOOST_COMPILER_VERSION __MWERKS__
|
||||
#endif
|
||||
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
|
||||
//
|
||||
#if __MWERKS__ > 0x3206 && __option(rvalue_refs)
|
||||
# define BOOST_HAS_RVALUE_REFS
|
||||
#else
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#endif
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_CHAR16_T
|
||||
#define BOOST_NO_CXX11_CHAR32_T
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_DECLTYPE
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
#define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support Metrowerks prior to version 5.3:
|
||||
#if __MWERKS__ < 0x2301
|
||||
# error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
//
|
||||
// last known and checked version:
|
||||
#if (__MWERKS__ > 0x3205)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
122
boost/boost/config/compiler/mpw.hpp
Normal file
122
boost/boost/config/compiler/mpw.hpp
Normal file
@ -0,0 +1,122 @@
|
||||
// (C) Copyright John Maddock 2001 - 2002.
|
||||
// (C) Copyright Aleksey Gurtovoy 2002.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// MPW C++ compilers setup:
|
||||
|
||||
# if defined(__SC__)
|
||||
# define BOOST_COMPILER "MPW SCpp version " BOOST_STRINGIZE(__SC__)
|
||||
# elif defined(__MRC__)
|
||||
# define BOOST_COMPILER "MPW MrCpp version " BOOST_STRINGIZE(__MRC__)
|
||||
# else
|
||||
# error "Using MPW compiler configuration by mistake. Please update."
|
||||
# endif
|
||||
|
||||
//
|
||||
// MPW 8.90:
|
||||
//
|
||||
#if (MPW_CPLUS <= 0x890) || !defined(BOOST_STRICT_CONFIG)
|
||||
# define BOOST_NO_CV_SPECIALIZATIONS
|
||||
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
|
||||
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
|
||||
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
# define BOOST_NO_INTRINSIC_WCHAR_T
|
||||
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# define BOOST_NO_USING_TEMPLATE
|
||||
|
||||
# define BOOST_NO_CWCHAR
|
||||
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
|
||||
# define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
|
||||
//
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_CHAR16_T
|
||||
#define BOOST_NO_CXX11_CHAR32_T
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_DECLTYPE
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support MPW prior to version 8.9:
|
||||
#if MPW_CPLUS < 0x890
|
||||
# error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
//
|
||||
// last known and checked version is 0x890:
|
||||
#if (MPW_CPLUS > 0x890)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
32
boost/boost/config/compiler/nvcc.hpp
Normal file
32
boost/boost/config/compiler/nvcc.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
// (C) Copyright Eric Jourdanneau, Joel Falcou 2010
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// NVIDIA CUDA C++ compiler setup
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
# define BOOST_COMPILER "NVIDIA CUDA C++ Compiler"
|
||||
#endif
|
||||
|
||||
// NVIDIA Specific support
|
||||
// BOOST_GPU_ENABLED : Flag a function or a method as being enabled on the host and device
|
||||
#define BOOST_GPU_ENABLED __host__ __device__
|
||||
|
||||
// A bug in version 7.0 of CUDA prevents use of variadic templates in some occasions
|
||||
// https://svn.boost.org/trac/boost/ticket/11897
|
||||
// This is fixed in 7.5. As the following version macro was introduced in 7.5 an existance
|
||||
// check is enough to detect versions < 7.5
|
||||
#if !defined(__CUDACC_VER__) || (__CUDACC_VER__ < 70500)
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
// The same bug is back again in 8.0:
|
||||
#if (__CUDACC_VER__ > 80000) && (__CUDACC_VER__ < 80100)
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
// Most recent CUDA (8.0) has no constexpr support in msvc mode:
|
||||
#if defined(_MSC_VER)
|
||||
# define BOOST_NO_CXX11_CONSTEXPR
|
||||
#endif
|
115
boost/boost/config/compiler/pathscale.hpp
Normal file
115
boost/boost/config/compiler/pathscale.hpp
Normal file
@ -0,0 +1,115 @@
|
||||
// (C) Copyright Bryce Lelbach 2011
|
||||
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// PathScale EKOPath C++ Compiler
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
# define BOOST_COMPILER "PathScale EKOPath C++ Compiler version " __PATHSCALE__
|
||||
#endif
|
||||
|
||||
#if __PATHCC__ >= 4
|
||||
# define BOOST_MSVC6_MEMBER_TEMPLATES
|
||||
# define BOOST_HAS_UNISTD_H
|
||||
# define BOOST_HAS_STDINT_H
|
||||
# define BOOST_HAS_SIGACTION
|
||||
# define BOOST_HAS_SCHED_YIELD
|
||||
# define BOOST_HAS_THREADS
|
||||
# define BOOST_HAS_PTHREADS
|
||||
# define BOOST_HAS_PTHREAD_YIELD
|
||||
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
|
||||
# define BOOST_HAS_PARTIAL_STD_ALLOCATOR
|
||||
# define BOOST_HAS_NRVO
|
||||
# define BOOST_HAS_NL_TYPES_H
|
||||
# define BOOST_HAS_NANOSLEEP
|
||||
# define BOOST_HAS_LONG_LONG
|
||||
# define BOOST_HAS_LOG1P
|
||||
# define BOOST_HAS_GETTIMEOFDAY
|
||||
# define BOOST_HAS_EXPM1
|
||||
# define BOOST_HAS_DIRENT_H
|
||||
# define BOOST_HAS_CLOCK_GETTIME
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
# define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
# define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
# define BOOST_NO_SFINAE_EXPR
|
||||
# define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
# define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
# define BOOST_NO_CXX11_RAW_LITERALS
|
||||
# define BOOST_NO_CXX11_NULLPTR
|
||||
# define BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
# define BOOST_NO_CXX11_NOEXCEPT
|
||||
# define BOOST_NO_CXX11_LAMBDAS
|
||||
# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
# define BOOST_NO_MS_INT64_NUMERIC_LIMITS
|
||||
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
# define BOOST_NO_CXX11_DECLTYPE
|
||||
# define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
# define BOOST_NO_CXX11_CONSTEXPR
|
||||
# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
# define BOOST_NO_CXX11_CHAR32_T
|
||||
# define BOOST_NO_CXX11_CHAR16_T
|
||||
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
|
||||
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
|
||||
# define BOOST_NO_CXX11_HDR_TYPEINDEX
|
||||
# define BOOST_NO_CXX11_HDR_TUPLE
|
||||
# define BOOST_NO_CXX11_HDR_THREAD
|
||||
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
|
||||
# define BOOST_NO_CXX11_HDR_REGEX
|
||||
# define BOOST_NO_CXX11_HDR_RATIO
|
||||
# define BOOST_NO_CXX11_HDR_RANDOM
|
||||
# define BOOST_NO_CXX11_HDR_MUTEX
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_CXX11_HDR_FUTURE
|
||||
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_CXX11_HDR_CODECVT
|
||||
# define BOOST_NO_CXX11_HDR_CHRONO
|
||||
# define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
# define BOOST_NO_CXX11_ALIGNAS
|
||||
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
# define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
# define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
# define BOOST_NO_CXX11_FINAL
|
||||
# define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
#endif
|
156
boost/boost/config/compiler/pgi.hpp
Normal file
156
boost/boost/config/compiler/pgi.hpp
Normal file
@ -0,0 +1,156 @@
|
||||
// (C) Copyright Noel Belcourt 2007.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// PGI C++ compiler setup:
|
||||
|
||||
#define BOOST_COMPILER_VERSION __PGIC__##__PGIC_MINOR__
|
||||
#define BOOST_COMPILER "PGI compiler version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
|
||||
|
||||
//
|
||||
// Threading support:
|
||||
// Turn this on unconditionally here, it will get turned off again later
|
||||
// if no threading API is detected.
|
||||
//
|
||||
|
||||
#if __PGIC__ >= 11
|
||||
|
||||
// options requested by configure --enable-test
|
||||
#define BOOST_HAS_PTHREADS
|
||||
#define BOOST_HAS_THREADS
|
||||
#define BOOST_HAS_PTHREAD_YIELD
|
||||
#define BOOST_HAS_NRVO
|
||||
#define BOOST_HAS_LONG_LONG
|
||||
|
||||
// options --enable-test wants undefined
|
||||
#undef BOOST_NO_STDC_NAMESPACE
|
||||
#undef BOOST_NO_EXCEPTION_STD_NAMESPACE
|
||||
#undef BOOST_DEDUCED_TYPENAME
|
||||
|
||||
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
|
||||
#elif __PGIC__ >= 10
|
||||
|
||||
// options requested by configure --enable-test
|
||||
#define BOOST_HAS_THREADS
|
||||
#define BOOST_HAS_NRVO
|
||||
#define BOOST_HAS_LONG_LONG
|
||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
||||
# define BOOST_HAS_STDINT_H
|
||||
#endif
|
||||
|
||||
// options --enable-test wants undefined
|
||||
#undef BOOST_NO_STDC_NAMESPACE
|
||||
#undef BOOST_NO_EXCEPTION_STD_NAMESPACE
|
||||
#undef BOOST_DEDUCED_TYPENAME
|
||||
|
||||
#elif __PGIC__ >= 7
|
||||
|
||||
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#define BOOST_NO_SWPRINTF
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
|
||||
#else
|
||||
|
||||
# error "Pgi compiler not configured - please reconfigure"
|
||||
|
||||
#endif
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
|
||||
//
|
||||
#define BOOST_NO_CXX11_CHAR16_T
|
||||
#define BOOST_NO_CXX11_CHAR32_T
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_DECLTYPE
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_NO_SWPRINTF
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
#define BOOST_NO_CXX11_HDR_UNORDERED_SET
|
||||
#define BOOST_NO_CXX11_HDR_UNORDERED_MAP
|
||||
#define BOOST_NO_CXX11_HDR_TYPEINDEX
|
||||
#define BOOST_NO_CXX11_HDR_TYPE_TRAITS
|
||||
#define BOOST_NO_CXX11_HDR_TUPLE
|
||||
#define BOOST_NO_CXX11_HDR_THREAD
|
||||
#define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
|
||||
#define BOOST_NO_CXX11_HDR_REGEX
|
||||
#define BOOST_NO_CXX11_HDR_RATIO
|
||||
#define BOOST_NO_CXX11_HDR_RANDOM
|
||||
#define BOOST_NO_CXX11_HDR_MUTEX
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#define BOOST_NO_CXX11_HDR_FUTURE
|
||||
#define BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
#define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
|
||||
#define BOOST_NO_CXX11_HDR_CODECVT
|
||||
#define BOOST_NO_CXX11_HDR_CHRONO
|
||||
#define BOOST_NO_CXX11_HDR_ARRAY
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
//
|
||||
// version check:
|
||||
// probably nothing to do here?
|
||||
|
29
boost/boost/config/compiler/sgi_mipspro.hpp
Normal file
29
boost/boost/config/compiler/sgi_mipspro.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
// (C) Copyright John Maddock 2001 - 2002.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// SGI C++ compiler setup:
|
||||
|
||||
#define BOOST_COMPILER "SGI Irix compiler version " BOOST_STRINGIZE(_COMPILER_VERSION)
|
||||
|
||||
#include <boost/config/compiler/common_edg.hpp>
|
||||
|
||||
//
|
||||
// Threading support:
|
||||
// Turn this on unconditionally here, it will get turned off again later
|
||||
// if no threading API is detected.
|
||||
//
|
||||
#define BOOST_HAS_THREADS
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
|
||||
#undef BOOST_NO_SWPRINTF
|
||||
#undef BOOST_DEDUCED_TYPENAME
|
||||
|
||||
//
|
||||
// version check:
|
||||
// probably nothing to do here?
|
||||
|
||||
|
198
boost/boost/config/compiler/sunpro_cc.hpp
Normal file
198
boost/boost/config/compiler/sunpro_cc.hpp
Normal file
@ -0,0 +1,198 @@
|
||||
// (C) Copyright John Maddock 2001.
|
||||
// (C) Copyright Jens Maurer 2001 - 2003.
|
||||
// (C) Copyright Peter Dimov 2002.
|
||||
// (C) Copyright Aleksey Gurtovoy 2002 - 2003.
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Sun C++ compiler setup:
|
||||
|
||||
# if __SUNPRO_CC <= 0x500
|
||||
# define BOOST_NO_MEMBER_TEMPLATES
|
||||
# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
# endif
|
||||
|
||||
# if (__SUNPRO_CC <= 0x520)
|
||||
//
|
||||
// Sunpro 5.2 and earler:
|
||||
//
|
||||
// although sunpro 5.2 supports the syntax for
|
||||
// inline initialization it often gets the value
|
||||
// wrong, especially where the value is computed
|
||||
// from other constants (J Maddock 6th May 2001)
|
||||
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
|
||||
// Although sunpro 5.2 supports the syntax for
|
||||
// partial specialization, it often seems to
|
||||
// bind to the wrong specialization. Better
|
||||
// to disable it until suppport becomes more stable
|
||||
// (J Maddock 6th May 2001).
|
||||
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# endif
|
||||
|
||||
# if (__SUNPRO_CC <= 0x530)
|
||||
// Requesting debug info (-g) with Boost.Python results
|
||||
// in an internal compiler error for "static const"
|
||||
// initialized in-class.
|
||||
// >> Assertion: (../links/dbg_cstabs.cc, line 611)
|
||||
// while processing ../test.cpp at line 0.
|
||||
// (Jens Maurer according to Gottfried Ganssauge 04 Mar 2002)
|
||||
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
|
||||
// SunPro 5.3 has better support for partial specialization,
|
||||
// but breaks when compiling std::less<shared_ptr<T> >
|
||||
// (Jens Maurer 4 Nov 2001).
|
||||
|
||||
// std::less specialization fixed as reported by George
|
||||
// Heintzelman; partial specialization re-enabled
|
||||
// (Peter Dimov 17 Jan 2002)
|
||||
|
||||
//# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
// integral constant expressions with 64 bit numbers fail
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# endif
|
||||
|
||||
# if (__SUNPRO_CC < 0x570)
|
||||
# define BOOST_NO_TEMPLATE_TEMPLATES
|
||||
// see http://lists.boost.org/MailArchives/boost/msg47184.php
|
||||
// and http://lists.boost.org/MailArchives/boost/msg47220.php
|
||||
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
# define BOOST_NO_SFINAE
|
||||
# define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS
|
||||
# endif
|
||||
# if (__SUNPRO_CC <= 0x580)
|
||||
# define BOOST_NO_IS_ABSTRACT
|
||||
# endif
|
||||
|
||||
# if (__SUNPRO_CC <= 0x5100)
|
||||
// Sun 5.10 may not correctly value-initialize objects of
|
||||
// some user defined types, as was reported in April 2010
|
||||
// (CR 6947016), and confirmed by Steve Clamage.
|
||||
// (Niels Dekker, LKEB, May 2010).
|
||||
# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
# endif
|
||||
|
||||
//
|
||||
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
|
||||
//
|
||||
#if __SUNPRO_CC > 0x500
|
||||
# define BOOST_SYMBOL_EXPORT __global
|
||||
# define BOOST_SYMBOL_IMPORT __global
|
||||
# define BOOST_SYMBOL_VISIBLE __global
|
||||
#endif
|
||||
|
||||
#if (__SUNPRO_CC < 0x5130)
|
||||
// C++03 features in 12.4:
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_ADL_BARRIER
|
||||
#define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#endif
|
||||
|
||||
#if (__SUNPRO_CC < 0x5130) || (__cplusplus < 201100)
|
||||
// C++11 only featuires in 12.4:
|
||||
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CXX11_CHAR16_T
|
||||
#define BOOST_NO_CXX11_CHAR32_T
|
||||
#define BOOST_NO_CXX11_CONSTEXPR
|
||||
#define BOOST_NO_CXX11_DECLTYPE
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#endif
|
||||
|
||||
#if (__SUNPRO_CC < 0x5140) || (__cplusplus < 201103)
|
||||
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#define BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
#endif
|
||||
|
||||
#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
# define BOOST_HAS_LONG_LONG
|
||||
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304) || (__cplusplus < 201402L)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
// Turn on threading support for Solaris 12.
|
||||
// Ticket #11972
|
||||
#if (__SUNPRO_CC >= 0x5140) && defined(__SunOS_5_12) && !defined(BOOST_HAS_THREADS)
|
||||
# define BOOST_HAS_THREADS
|
||||
#endif
|
||||
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
#define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC)
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support sunpro prior to version 4:
|
||||
#if __SUNPRO_CC < 0x400
|
||||
#error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
//
|
||||
// last known and checked version is 0x590:
|
||||
#if (__SUNPRO_CC > 0x590)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
163
boost/boost/config/compiler/vacpp.hpp
Normal file
163
boost/boost/config/compiler/vacpp.hpp
Normal file
@ -0,0 +1,163 @@
|
||||
// (C) Copyright John Maddock 2001 - 2003.
|
||||
// (C) Copyright Toon Knapen 2001 - 2003.
|
||||
// (C) Copyright Lie-Quan Lee 2001.
|
||||
// (C) Copyright Markus Schoepflin 2002 - 2003.
|
||||
// (C) Copyright Beman Dawes 2002 - 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// Visual Age (IBM) C++ compiler setup:
|
||||
|
||||
#if __IBMCPP__ <= 501
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
|
||||
#endif
|
||||
|
||||
#if (__IBMCPP__ <= 502)
|
||||
// Actually the compiler supports inclass member initialization but it
|
||||
// requires a definition for the class member and it doesn't recognize
|
||||
// it as an integral constant expression when used as a template argument.
|
||||
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD
|
||||
#endif
|
||||
|
||||
#if (__IBMCPP__ <= 600) || !defined(BOOST_STRICT_CONFIG)
|
||||
# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS
|
||||
#endif
|
||||
|
||||
#if (__IBMCPP__ <= 1110)
|
||||
// XL C++ V11.1 and earlier versions may not always value-initialize
|
||||
// a temporary object T(), when T is a non-POD aggregate class type.
|
||||
// Michael Wong (IBM Canada Ltd) has confirmed this issue and gave it
|
||||
// high priority. -- Niels Dekker (LKEB), May 2010.
|
||||
# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
#endif
|
||||
|
||||
//
|
||||
// On AIX thread support seems to be indicated by _THREAD_SAFE:
|
||||
//
|
||||
#ifdef _THREAD_SAFE
|
||||
# define BOOST_HAS_THREADS
|
||||
#endif
|
||||
|
||||
#define BOOST_COMPILER "IBM Visual Age version " BOOST_STRINGIZE(__IBMCPP__)
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support Visual age prior to version 5:
|
||||
#if __IBMCPP__ < 500
|
||||
#error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
//
|
||||
// last known and checked version is 1210:
|
||||
#if (__IBMCPP__ > 1210)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Some versions of the compiler have issues with default arguments on partial specializations
|
||||
#if __IBMCPP__ <= 1010
|
||||
#define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
|
||||
#endif
|
||||
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
|
||||
//
|
||||
#if ! __IBMCPP_AUTO_TYPEDEDUCTION
|
||||
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#endif
|
||||
#if ! __IBMCPP_UTF_LITERAL__
|
||||
# define BOOST_NO_CXX11_CHAR16_T
|
||||
# define BOOST_NO_CXX11_CHAR32_T
|
||||
#endif
|
||||
#if ! __IBMCPP_CONSTEXPR
|
||||
# define BOOST_NO_CXX11_CONSTEXPR
|
||||
#endif
|
||||
#if ! __IBMCPP_DECLTYPE
|
||||
# define BOOST_NO_CXX11_DECLTYPE
|
||||
#else
|
||||
# define BOOST_HAS_DECLTYPE
|
||||
#endif
|
||||
#define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#if ! __IBMCPP_EXPLICIT_CONVERSION_OPERATORS
|
||||
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#endif
|
||||
#if ! __IBMCPP_EXTERN_TEMPLATE
|
||||
# define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
#endif
|
||||
#if ! __IBMCPP_VARIADIC_TEMPLATES
|
||||
// not enabled separately at this time
|
||||
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#endif
|
||||
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#define BOOST_NO_CXX11_LAMBDAS
|
||||
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#define BOOST_NO_CXX11_NOEXCEPT
|
||||
#define BOOST_NO_CXX11_NULLPTR
|
||||
#define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#if ! __IBMCPP_RVALUE_REFERENCES
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#endif
|
||||
#if ! __IBMCPP_SCOPED_ENUM
|
||||
# define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#endif
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#if ! __IBMCPP_STATIC_ASSERT
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#endif
|
||||
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#if ! __IBMCPP_VARIADIC_TEMPLATES
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
#if ! __C99_MACRO_WITH_VA_ARGS
|
||||
# define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
#endif
|
||||
#define BOOST_NO_CXX11_ALIGNAS
|
||||
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#define BOOST_NO_CXX11_FINAL
|
||||
#define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
|
||||
// C++ 14:
|
||||
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
#if (__cplusplus < 201304) // There's no SD6 check for this....
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
303
boost/boost/config/compiler/visualc.hpp
Normal file
303
boost/boost/config/compiler/visualc.hpp
Normal file
@ -0,0 +1,303 @@
|
||||
// (C) Copyright John Maddock 2001 - 2003.
|
||||
// (C) Copyright Darin Adler 2001 - 2002.
|
||||
// (C) Copyright Peter Dimov 2001.
|
||||
// (C) Copyright Aleksey Gurtovoy 2002.
|
||||
// (C) Copyright David Abrahams 2002 - 2003.
|
||||
// (C) Copyright Beman Dawes 2002 - 2003.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
//
|
||||
// Microsoft Visual C++ compiler setup:
|
||||
//
|
||||
// We need to be careful with the checks in this file, as contrary
|
||||
// to popular belief there are versions with _MSC_VER with the final
|
||||
// digit non-zero (mainly the MIPS cross compiler).
|
||||
//
|
||||
// So we either test _MSC_VER >= XXXX or else _MSC_VER < XXXX.
|
||||
// No other comparisons (==, >, or <=) are safe.
|
||||
//
|
||||
|
||||
#define BOOST_MSVC _MSC_VER
|
||||
|
||||
//
|
||||
// Helper macro BOOST_MSVC_FULL_VER for use in Boost code:
|
||||
//
|
||||
#if _MSC_FULL_VER > 100000000
|
||||
# define BOOST_MSVC_FULL_VER _MSC_FULL_VER
|
||||
#else
|
||||
# define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10)
|
||||
#endif
|
||||
|
||||
// Attempt to suppress VC6 warnings about the length of decorated names (obsolete):
|
||||
#pragma warning( disable : 4503 ) // warning: decorated name length exceeded
|
||||
|
||||
#define BOOST_HAS_PRAGMA_ONCE
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't support Visual C++ prior to version 7.1:
|
||||
#if _MSC_VER < 1310
|
||||
# error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
|
||||
#if _MSC_FULL_VER < 180020827
|
||||
# define BOOST_NO_FENV_H
|
||||
#endif
|
||||
|
||||
#if _MSC_VER < 1400
|
||||
// although a conforming signature for swprint exists in VC7.1
|
||||
// it appears not to actually work:
|
||||
# define BOOST_NO_SWPRINTF
|
||||
// Our extern template tests also fail for this compiler:
|
||||
# define BOOST_NO_CXX11_EXTERN_TEMPLATE
|
||||
// Variadic macros do not exist for VC7.1 and lower
|
||||
# define BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#endif
|
||||
|
||||
#if _MSC_VER < 1500 // 140X == VC++ 8.0
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
#endif
|
||||
|
||||
#if _MSC_VER < 1600 // 150X == VC++ 9.0
|
||||
// A bug in VC9:
|
||||
# define BOOST_NO_ADL_BARRIER
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _NATIVE_WCHAR_T_DEFINED
|
||||
# define BOOST_NO_INTRINSIC_WCHAR_T
|
||||
#endif
|
||||
|
||||
//
|
||||
// check for exception handling support:
|
||||
#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
//
|
||||
// __int64 support:
|
||||
//
|
||||
#define BOOST_HAS_MS_INT64
|
||||
#if defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1400)
|
||||
# define BOOST_HAS_LONG_LONG
|
||||
#else
|
||||
# define BOOST_NO_LONG_LONG
|
||||
#endif
|
||||
#if (_MSC_VER >= 1400) && !defined(_DEBUG)
|
||||
# define BOOST_HAS_NRVO
|
||||
#endif
|
||||
#if _MSC_VER >= 1600 // 160X == VC++ 10.0
|
||||
# define BOOST_HAS_PRAGMA_DETECT_MISMATCH
|
||||
#endif
|
||||
//
|
||||
// disable Win32 API's if compiler extensions are
|
||||
// turned off:
|
||||
//
|
||||
#if !defined(_MSC_EXTENSIONS) && !defined(BOOST_DISABLE_WIN32)
|
||||
# define BOOST_DISABLE_WIN32
|
||||
#endif
|
||||
#if !defined(_CPPRTTI) && !defined(BOOST_NO_RTTI)
|
||||
# define BOOST_NO_RTTI
|
||||
#endif
|
||||
|
||||
//
|
||||
// TR1 features:
|
||||
//
|
||||
#if _MSC_VER >= 1700
|
||||
// # define BOOST_HAS_TR1_HASH // don't know if this is true yet.
|
||||
// # define BOOST_HAS_TR1_TYPE_TRAITS // don't know if this is true yet.
|
||||
# define BOOST_HAS_TR1_UNORDERED_MAP
|
||||
# define BOOST_HAS_TR1_UNORDERED_SET
|
||||
#endif
|
||||
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
// See above for BOOST_NO_LONG_LONG
|
||||
|
||||
// C++ features supported by VC++ 10 (aka 2010)
|
||||
//
|
||||
#if _MSC_VER < 1600
|
||||
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
# define BOOST_NO_CXX11_LAMBDAS
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
# define BOOST_NO_CXX11_NULLPTR
|
||||
# define BOOST_NO_CXX11_DECLTYPE
|
||||
#endif // _MSC_VER < 1600
|
||||
|
||||
#if _MSC_VER >= 1600
|
||||
# define BOOST_HAS_STDINT_H
|
||||
#endif
|
||||
|
||||
// C++11 features supported by VC++ 11 (aka 2012)
|
||||
//
|
||||
#if _MSC_VER < 1700
|
||||
# define BOOST_NO_CXX11_FINAL
|
||||
# define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
# define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#endif // _MSC_VER < 1700
|
||||
|
||||
// C++11 features supported by VC++ 12 (aka 2013).
|
||||
//
|
||||
#if _MSC_FULL_VER < 180020827
|
||||
# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
# define BOOST_NO_CXX11_RAW_LITERALS
|
||||
# define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
# define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#endif
|
||||
|
||||
#if _MSC_FULL_VER >= 180020827
|
||||
#define BOOST_HAS_EXPM1
|
||||
#define BOOST_HAS_LOG1P
|
||||
#endif
|
||||
|
||||
// C++11 features supported by VC++ 14 (aka 2015)
|
||||
//
|
||||
#if (_MSC_FULL_VER < 190023026)
|
||||
# define BOOST_NO_CXX11_NOEXCEPT
|
||||
# define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
# define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
# define BOOST_NO_CXX11_ALIGNAS
|
||||
# define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
# define BOOST_NO_CXX11_CHAR16_T
|
||||
# define BOOST_NO_CXX11_CHAR32_T
|
||||
# define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
# define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
#endif
|
||||
// C++11 features supported by VC++ 14 update 3 (aka 2015)
|
||||
//
|
||||
#if (_MSC_FULL_VER < 190024210)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
# define BOOST_NO_SFINAE_EXPR
|
||||
# define BOOST_NO_CXX11_CONSTEXPR
|
||||
#endif
|
||||
|
||||
// C++14 features supported by VC++ 15 Preview 5
|
||||
//
|
||||
#if (_MSC_VER < 1910)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
|
||||
// MSVC including version 14 has not yet completely
|
||||
// implemented value-initialization, as is reported:
|
||||
// "VC++ does not value-initialize members of derived classes without
|
||||
// user-declared constructor", reported in 2009 by Sylvester Hesp:
|
||||
// https://connect.microsoft.com/VisualStudio/feedback/details/484295
|
||||
// "Presence of copy constructor breaks member class initialization",
|
||||
// reported in 2009 by Alex Vakulenko:
|
||||
// https://connect.microsoft.com/VisualStudio/feedback/details/499606
|
||||
// "Value-initialization in new-expression", reported in 2005 by
|
||||
// Pavel Kuznetsov (MetaCommunications Engineering):
|
||||
// https://connect.microsoft.com/VisualStudio/feedback/details/100744
|
||||
// Reported again by John Maddock in 2015 for VC14:
|
||||
// https://connect.microsoft.com/VisualStudio/feedback/details/1582233/c-subobjects-still-not-value-initialized-correctly
|
||||
// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
|
||||
// (Niels Dekker, LKEB, May 2010)
|
||||
#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
//
|
||||
// C++ 11:
|
||||
//
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
|
||||
//
|
||||
// prefix and suffix headers:
|
||||
//
|
||||
#ifndef BOOST_ABI_PREFIX
|
||||
# define BOOST_ABI_PREFIX "boost/config/abi/msvc_prefix.hpp"
|
||||
#endif
|
||||
#ifndef BOOST_ABI_SUFFIX
|
||||
# define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp"
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
// TODO:
|
||||
// these things are mostly bogus. 1200 means version 12.0 of the compiler. The
|
||||
// artificial versions assigned to them only refer to the versions of some IDE
|
||||
// these compilers have been shipped with, and even that is not all of it. Some
|
||||
// were shipped with freely downloadable SDKs, others as crosscompilers in eVC.
|
||||
// IOW, you can't use these 'versions' in any sensible way. Sorry.
|
||||
# if defined(UNDER_CE)
|
||||
# if _MSC_VER < 1400
|
||||
// Note: I'm not aware of any CE compiler with version 13xx
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown EVC++ compiler version - please run the configure tests and report the results"
|
||||
# else
|
||||
# pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results")
|
||||
# endif
|
||||
# elif _MSC_VER < 1500
|
||||
# define BOOST_COMPILER_VERSION evc8
|
||||
# elif _MSC_VER < 1600
|
||||
# define BOOST_COMPILER_VERSION evc9
|
||||
# elif _MSC_VER < 1700
|
||||
# define BOOST_COMPILER_VERSION evc10
|
||||
# elif _MSC_VER < 1800
|
||||
# define BOOST_COMPILER_VERSION evc11
|
||||
# elif _MSC_VER < 1900
|
||||
# define BOOST_COMPILER_VERSION evc12
|
||||
# elif _MSC_VER < 2000
|
||||
# define BOOST_COMPILER_VERSION evc14
|
||||
# else
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown EVC++ compiler version - please run the configure tests and report the results"
|
||||
# else
|
||||
# pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results")
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
# if _MSC_VER < 1310
|
||||
// Note: Versions up to 7.0 aren't supported.
|
||||
# define BOOST_COMPILER_VERSION 5.0
|
||||
# elif _MSC_VER < 1300
|
||||
# define BOOST_COMPILER_VERSION 6.0
|
||||
# elif _MSC_VER < 1310
|
||||
# define BOOST_COMPILER_VERSION 7.0
|
||||
# elif _MSC_VER < 1400
|
||||
# define BOOST_COMPILER_VERSION 7.1
|
||||
# elif _MSC_VER < 1500
|
||||
# define BOOST_COMPILER_VERSION 8.0
|
||||
# elif _MSC_VER < 1600
|
||||
# define BOOST_COMPILER_VERSION 9.0
|
||||
# elif _MSC_VER < 1700
|
||||
# define BOOST_COMPILER_VERSION 10.0
|
||||
# elif _MSC_VER < 1800
|
||||
# define BOOST_COMPILER_VERSION 11.0
|
||||
# elif _MSC_VER < 1900
|
||||
# define BOOST_COMPILER_VERSION 12.0
|
||||
# elif _MSC_VER < 2000
|
||||
# define BOOST_COMPILER_VERSION 14.0
|
||||
# else
|
||||
# define BOOST_COMPILER_VERSION _MSC_VER
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
|
||||
#endif
|
||||
|
||||
//
|
||||
// last known and checked version is 19.10.24629 (VC++ 2017 RC):
|
||||
#if (_MSC_VER > 1910)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# else
|
||||
# pragma message("Unknown compiler version - please run the configure tests and report the results")
|
||||
# endif
|
||||
#endif
|
262
boost/boost/config/compiler/xlcpp.hpp
Normal file
262
boost/boost/config/compiler/xlcpp.hpp
Normal file
@ -0,0 +1,262 @@
|
||||
// (C) Copyright Douglas Gregor 2010
|
||||
//
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// compiler setup for IBM XL C/C++ for Linux (Little Endian) based on clang.
|
||||
|
||||
#define BOOST_HAS_PRAGMA_ONCE
|
||||
|
||||
// Detecting `-fms-extension` compiler flag assuming that _MSC_VER defined when that flag is used.
|
||||
#if defined (_MSC_VER) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
|
||||
# define BOOST_HAS_PRAGMA_DETECT_MISMATCH
|
||||
#endif
|
||||
|
||||
// When compiling with clang before __has_extension was defined,
|
||||
// even if one writes 'defined(__has_extension) && __has_extension(xxx)',
|
||||
// clang reports a compiler error. So the only workaround found is:
|
||||
|
||||
#ifndef __has_extension
|
||||
#define __has_extension __has_feature
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI)
|
||||
# define BOOST_NO_RTTI
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID)
|
||||
# define BOOST_NO_TYPEID
|
||||
#endif
|
||||
|
||||
#if defined(__int64) && !defined(__GNUC__)
|
||||
# define BOOST_HAS_MS_INT64
|
||||
#endif
|
||||
|
||||
#define BOOST_HAS_NRVO
|
||||
|
||||
// Branch prediction hints
|
||||
#if defined(__has_builtin)
|
||||
#if __has_builtin(__builtin_expect)
|
||||
#define BOOST_LIKELY(x) __builtin_expect(x, 1)
|
||||
#define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Clang supports "long long" in all compilation modes.
|
||||
#define BOOST_HAS_LONG_LONG
|
||||
|
||||
//
|
||||
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
|
||||
//
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
|
||||
# define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
|
||||
# define BOOST_SYMBOL_IMPORT
|
||||
# define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
|
||||
#endif
|
||||
|
||||
//
|
||||
// The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through
|
||||
// between switch labels.
|
||||
//
|
||||
#if __cplusplus >= 201103L && defined(__has_warning)
|
||||
# if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
|
||||
# define BOOST_FALLTHROUGH [[clang::fallthrough]]
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_auto_type)
|
||||
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
|
||||
#endif
|
||||
|
||||
//
|
||||
// Currently clang on Windows using VC++ RTL does not support C++11's char16_t or char32_t
|
||||
//
|
||||
#if defined(_MSC_VER) || !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
|
||||
# define BOOST_NO_CXX11_CHAR16_T
|
||||
# define BOOST_NO_CXX11_CHAR32_T
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_constexpr)
|
||||
# define BOOST_NO_CXX11_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_decltype)
|
||||
# define BOOST_NO_CXX11_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_decltype_incomplete_return_types)
|
||||
# define BOOST_NO_CXX11_DECLTYPE_N3276
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_defaulted_functions)
|
||||
# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_deleted_functions)
|
||||
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_explicit_conversions)
|
||||
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_default_function_template_args)
|
||||
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_generalized_initializers)
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_lambdas)
|
||||
# define BOOST_NO_CXX11_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_local_type_template_args)
|
||||
# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
# define BOOST_NO_CXX11_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_nullptr)
|
||||
# define BOOST_NO_CXX11_NULLPTR
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_range_for)
|
||||
# define BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_raw_string_literals)
|
||||
# define BOOST_NO_CXX11_RAW_LITERALS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_reference_qualified_functions)
|
||||
# define BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_generalized_initializers)
|
||||
# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_rvalue_references)
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_strong_enums)
|
||||
# define BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_static_assert)
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_alias_templates)
|
||||
# define BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_unicode_literals)
|
||||
# define BOOST_NO_CXX11_UNICODE_LITERALS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_variadic_templates)
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_user_literals)
|
||||
# define BOOST_NO_CXX11_USER_DEFINED_LITERALS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_alignas)
|
||||
# define BOOST_NO_CXX11_ALIGNAS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_trailing_return)
|
||||
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_inline_namespaces)
|
||||
# define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_override_control)
|
||||
# define BOOST_NO_CXX11_FINAL
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__))
|
||||
# define BOOST_NO_CXX14_BINARY_LITERALS
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_decltype_auto__)
|
||||
# define BOOST_NO_CXX14_DECLTYPE_AUTO
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_aggregate_nsdmi__)
|
||||
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_init_captures__)
|
||||
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_generic_lambdas__)
|
||||
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
|
||||
#endif
|
||||
|
||||
// clang < 3.5 has a defect with dependent type, like following.
|
||||
//
|
||||
// template <class T>
|
||||
// constexpr typename enable_if<pred<T> >::type foo(T &)
|
||||
// { } // error: no return statement in constexpr function
|
||||
//
|
||||
// This issue also affects C++11 mode, but C++11 constexpr requires return stmt.
|
||||
// Therefore we don't care such case.
|
||||
//
|
||||
// Note that we can't check Clang version directly as the numbering system changes depending who's
|
||||
// creating the Clang release (see https://github.com/boostorg/config/pull/39#issuecomment-59927873)
|
||||
// so instead verify that we have a feature that was introduced at the same time as working C++14
|
||||
// constexpr (generic lambda's in this case):
|
||||
//
|
||||
#if !__has_feature(__cxx_generic_lambdas__) || !__has_feature(__cxx_relaxed_constexpr__)
|
||||
# define BOOST_NO_CXX14_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_return_type_deduction__)
|
||||
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
|
||||
#endif
|
||||
|
||||
#if !__has_feature(__cxx_variable_templates__)
|
||||
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_thread_local)
|
||||
# define BOOST_NO_CXX11_THREAD_LOCAL
|
||||
#endif
|
||||
|
||||
#if __cplusplus < 201400
|
||||
// All versions with __cplusplus above this value seem to support this:
|
||||
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
|
||||
#endif
|
||||
|
||||
|
||||
// Unused attribute:
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
# define BOOST_ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
# define BOOST_COMPILER "Clang version " __clang_version__
|
||||
#endif
|
||||
|
||||
// Macro used to identify the Clang compiler.
|
||||
#define BOOST_CLANG 1
|
||||
|
28
boost/boost/config/no_tr1/cmath.hpp
Normal file
28
boost/boost/config/no_tr1/cmath.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// (C) Copyright John Maddock 2008.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// The aim of this header is just to include <cmath> but to do
|
||||
// so in a way that does not result in recursive inclusion of
|
||||
// the Boost TR1 components if boost/tr1/tr1/cmath is in the
|
||||
// include search path. We have to do this to avoid circular
|
||||
// dependencies:
|
||||
//
|
||||
|
||||
#ifndef BOOST_CONFIG_CMATH
|
||||
# define BOOST_CONFIG_CMATH
|
||||
|
||||
# ifndef BOOST_TR1_NO_RECURSION
|
||||
# define BOOST_TR1_NO_RECURSION
|
||||
# define BOOST_CONFIG_NO_CMATH_RECURSION
|
||||
# endif
|
||||
|
||||
# include <cmath>
|
||||
|
||||
# ifdef BOOST_CONFIG_NO_CMATH_RECURSION
|
||||
# undef BOOST_TR1_NO_RECURSION
|
||||
# undef BOOST_CONFIG_NO_CMATH_RECURSION
|
||||
# endif
|
||||
|
||||
#endif
|
28
boost/boost/config/no_tr1/complex.hpp
Normal file
28
boost/boost/config/no_tr1/complex.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// The aim of this header is just to include <complex> but to do
|
||||
// so in a way that does not result in recursive inclusion of
|
||||
// the Boost TR1 components if boost/tr1/tr1/complex is in the
|
||||
// include search path. We have to do this to avoid circular
|
||||
// dependencies:
|
||||
//
|
||||
|
||||
#ifndef BOOST_CONFIG_COMPLEX
|
||||
# define BOOST_CONFIG_COMPLEX
|
||||
|
||||
# ifndef BOOST_TR1_NO_RECURSION
|
||||
# define BOOST_TR1_NO_RECURSION
|
||||
# define BOOST_CONFIG_NO_COMPLEX_RECURSION
|
||||
# endif
|
||||
|
||||
# include <complex>
|
||||
|
||||
# ifdef BOOST_CONFIG_NO_COMPLEX_RECURSION
|
||||
# undef BOOST_TR1_NO_RECURSION
|
||||
# undef BOOST_CONFIG_NO_COMPLEX_RECURSION
|
||||
# endif
|
||||
|
||||
#endif
|
28
boost/boost/config/no_tr1/functional.hpp
Normal file
28
boost/boost/config/no_tr1/functional.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// The aim of this header is just to include <functional> but to do
|
||||
// so in a way that does not result in recursive inclusion of
|
||||
// the Boost TR1 components if boost/tr1/tr1/functional is in the
|
||||
// include search path. We have to do this to avoid circular
|
||||
// dependencies:
|
||||
//
|
||||
|
||||
#ifndef BOOST_CONFIG_FUNCTIONAL
|
||||
# define BOOST_CONFIG_FUNCTIONAL
|
||||
|
||||
# ifndef BOOST_TR1_NO_RECURSION
|
||||
# define BOOST_TR1_NO_RECURSION
|
||||
# define BOOST_CONFIG_NO_FUNCTIONAL_RECURSION
|
||||
# endif
|
||||
|
||||
# include <functional>
|
||||
|
||||
# ifdef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION
|
||||
# undef BOOST_TR1_NO_RECURSION
|
||||
# undef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION
|
||||
# endif
|
||||
|
||||
#endif
|
28
boost/boost/config/no_tr1/memory.hpp
Normal file
28
boost/boost/config/no_tr1/memory.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// (C) Copyright John Maddock 2005.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// The aim of this header is just to include <memory> but to do
|
||||
// so in a way that does not result in recursive inclusion of
|
||||
// the Boost TR1 components if boost/tr1/tr1/memory is in the
|
||||
// include search path. We have to do this to avoid circular
|
||||
// dependencies:
|
||||
//
|
||||
|
||||
#ifndef BOOST_CONFIG_MEMORY
|
||||
# define BOOST_CONFIG_MEMORY
|
||||
|
||||
# ifndef BOOST_TR1_NO_RECURSION
|
||||
# define BOOST_TR1_NO_RECURSION
|
||||
# define BOOST_CONFIG_NO_MEMORY_RECURSION
|
||||
# endif
|
||||
|
||||
# include <memory>
|
||||
|
||||
# ifdef BOOST_CONFIG_NO_MEMORY_RECURSION
|
||||
# undef BOOST_TR1_NO_RECURSION
|
||||
# undef BOOST_CONFIG_NO_MEMORY_RECURSION
|
||||
# endif
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user