50ce8d3d78
2008-12-11 Benjamin Kosnik <bkoz@redhat.com> Richard Henderson <rth@redhat.com> * include/c_global/cstdatomic: Update to N2798. (atomic): Remove explicit constructors as per DR 845. * include/bits/atomic_0.h: New. Switchable implementation. * include/bits/atomic_2.h: New. Lock-free implementation. * include/c_compatibility/stdatomic.h: Use foward headers. * include/bits/atomicfwd_cxx.h: New. * include/bits/atomicfwd_c.h: New. * src/atomic.cc: Adjust. * acinclude.m4 (GLIBCXX_CHECK_STANDARD_LAYOUT): Remove, unconditionally use default/deleted syntax. (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Check for 2, 8. * include/Makefile.am (bits_headers): Add atomicfwd_c.h, atomicfwd_cxx.h, atomic_0.h, atomic_2.h. * include/Makefile.in: Regenerate. * configure: Regenerate. * config.h.in: Regenerate. * config/abi/pre/gnu.ver: Adjust exports. * testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc: Adjust. * testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc: Same. * testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc: Same. * testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same. * testsuite/29_atomics/atomic_address/cons/explicit_value.cc: Move to.. * testsuite/29_atomics/atomic_address/cons/single_value.cc: ...this. * testsuite/29_atomics/atomic_address/cons/copy_neg.cc * testsuite/29_atomics/atomic_integral/cons/single_value.cc: New. * testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: New. * testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: New. * testsuite/29_atomics/atomic_integral/cons/default.cc: New. * testsuite/29_atomics/atomic_integral/cons/direct_list.cc: New. * testsuite/29_atomics/atomic_integral/cons/copy_list.cc: New. * testsuite/29_atomics/atomic_integral/requirements/ standard_layout.cc: New. * testsuite/29_atomics/atomic_integral/operators/ integral_assignment.cc: New. * testsuite/29_atomics/atomic_integral/operators/increment_neg.cc: New. * testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: New. * testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc: New. * testsuite/29_atomics/atomic_integral/operators/increment.cc: New. * testsuite/29_atomics/atomic_integral/operators/decrement.cc: New. * testsuite/29_atomics/atomic_integral/operators/bitwise.cc: New. * testsuite/29_atomics/atomic_integral/operators/ integral_conversion.cc: New. * testsuite/29_atomics/atomic_flag/cons/assign_neg.cc: Adjust. * testsuite/29_atomics/atomic_flag/cons/copy_neg.cc: Same. * testsuite/29_atomics/atomic_flag/requirements/ standard_layout.cc: Same. * testsuite/29_atomics/atomic_flag/ atomic_global_fence_compatibility.cc: Kill. * testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc: Adjust. * testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc: Same. * testsuite/29_atomics/headers/cstdatomic/macros.cc: Same. * testsuite/29_atomics/headers/stdatomic.h/macros.c: Same. * testsuite/29_atomics/headers/stdatomic.h/types.c: Same. * testsuite/29_atomics/atomic/cons/assign_neg.cc: Same. * testsuite/29_atomics/atomic/cons/explicit_value.cc: Move to... * testsuite/29_atomics/atomic/cons/single_value.cc: ...this. * testsuite/29_atomics/atomic/cons/copy_neg.cc * testsuite/29_atomics/atomic/cons/direct_list.cc: New. * testsuite/29_atomics/atomic/cons/copy_list.cc: New. * testsuite/29_atomics/atomic/requirements/standard_layout.cc: New. * testsuite/29_atomics/atomic/requirements/base_classes.cc: New. * testsuite/29_atomics/atomic/operators/integral_assignment.cc: New. * testsuite/29_atomics/atomic/operators/integral_conversion.cc: New. * testsuite/util/testsuite_hooks.h (bitmask_operators): Move... * testsuite/util/testsuite_common_types.h: ...here. (atomic_integrals_no_bool): New. (atomic_integrals): New. (has_increment_operators, has_decrement_operators) (direct_list_initializable, single_value_constructible) (standard_layout, has_bitwise_operators, integral_convertable) (integral_assignable): Add. Co-Authored-By: Richard Henderson <rth@redhat.com> From-SVN: r142714
180 lines
5.0 KiB
C++
180 lines
5.0 KiB
C++
// -*- C++ -*- header.
|
|
|
|
// Copyright (C) 2008
|
|
// Free Software Foundation, Inc.
|
|
//
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
// software; you can redistribute it and/or modify it under the
|
|
// terms of the GNU General Public License as published by the
|
|
// Free Software Foundation; either version 2, or (at your option)
|
|
// any later version.
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this library; see the file COPYING. If not, write to
|
|
// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
// Boston, MA 02110-1301, USA.
|
|
|
|
// As a special exception, you may use this file as part of a free software
|
|
// library without restriction. Specifically, if other files instantiate
|
|
// templates or use macros or inline functions from this file, or you compile
|
|
// this file and link it with other files to produce an executable, this
|
|
// file does not by itself cause the resulting executable to be covered by
|
|
// the GNU General Public License. This exception does not however
|
|
// invalidate any other reasons why the executable file might be covered by
|
|
// the GNU General Public License.
|
|
|
|
/** @file bits/atomicfwd_c.h
|
|
* This is an internal header file, included by other library headers.
|
|
* You should not attempt to use it directly.
|
|
*/
|
|
|
|
// "C" only bits.
|
|
|
|
#define _ATOMIC_MEMBER_ ((__a)->_M_i)
|
|
|
|
// POD base classes for atomic intgral types.
|
|
struct __atomic_bool_base
|
|
{
|
|
bool _M_i;
|
|
};
|
|
|
|
struct __atomic_char_base
|
|
{
|
|
char _M_i;
|
|
};
|
|
|
|
struct __atomic_schar_base
|
|
{
|
|
signed char _M_i;
|
|
};
|
|
|
|
struct __atomic_uchar_base
|
|
{
|
|
unsigned char _M_i;
|
|
};
|
|
|
|
struct __atomic_short_base
|
|
{
|
|
short _M_i;
|
|
};
|
|
|
|
struct __atomic_ushort_base
|
|
{
|
|
unsigned short _M_i;
|
|
};
|
|
|
|
struct __atomic_int_base
|
|
{
|
|
int _M_i;
|
|
};
|
|
|
|
struct __atomic_uint_base
|
|
{
|
|
unsigned int _M_i;
|
|
};
|
|
|
|
struct __atomic_long_base
|
|
{
|
|
long _M_i;
|
|
};
|
|
|
|
struct __atomic_ulong_base
|
|
{
|
|
unsigned long _M_i;
|
|
};
|
|
|
|
struct __atomic_llong_base
|
|
{
|
|
long long _M_i;
|
|
};
|
|
|
|
struct __atomic_ullong_base
|
|
{
|
|
unsigned long long _M_i;
|
|
};
|
|
|
|
struct __atomic_wchar_t_base
|
|
{
|
|
wchar_t _M_i;
|
|
};
|
|
|
|
typedef struct __atomic_flag_base atomic_flag;
|
|
typedef struct __atomic_address_base atomic_address;
|
|
typedef struct __atomic_bool_base atomic_bool;
|
|
typedef struct __atomic_char_base atomic_char;
|
|
typedef struct __atomic_schar_base atomic_schar;
|
|
typedef struct __atomic_uchar_base atomic_uchar;
|
|
typedef struct __atomic_short_base atomic_short;
|
|
typedef struct __atomic_ushort_base atomic_ushort;
|
|
typedef struct __atomic_int_base atomic_int;
|
|
typedef struct __atomic_uint_base atomic_uint;
|
|
typedef struct __atomic_long_base atomic_long;
|
|
typedef struct __atomic_ulong_base atomic_ulong;
|
|
typedef struct __atomic_llong_base atomic_llong;
|
|
typedef struct __atomic_ullong_base atomic_ullong;
|
|
typedef struct __atomic_wchar_t_base atomic_wchar_t;
|
|
typedef struct __atomic_short_base atomic_char16_t;
|
|
typedef struct __atomic_int_base atomic_char32_t;
|
|
|
|
#define atomic_is_lock_free(__a) \
|
|
false
|
|
|
|
#define atomic_load_explicit(__a, __x) \
|
|
_ATOMIC_LOAD_(__a, __x)
|
|
|
|
#define atomic_load(__a) \
|
|
atomic_load_explicit(__a, memory_order_seq_cst)
|
|
|
|
#define atomic_store_explicit(__a, __m, __x) \
|
|
_ATOMIC_STORE_(__a, __m, __x)
|
|
|
|
#define atomic_store(__a, __m) \
|
|
atomic_store_explicit(__a, __m, memory_order_seq_cst)
|
|
|
|
#define atomic_exchange_explicit(__a, __m, __x) \
|
|
_ATOMIC_MODIFY_(__a, =, __m, __x)
|
|
|
|
#define atomic_exchange(__a, __m) \
|
|
atomic_exchange_explicit(__a, __m, memory_order_seq_cst)
|
|
|
|
#define atomic_compare_exchange_explicit(__a, __e, __m, __x, __y) \
|
|
_ATOMIC_CMPEXCHNG_(__a, __e, __m, __x)
|
|
|
|
#define atomic_compare_exchange(__a, __e, __m) \
|
|
_ATOMIC_CMPEXCHNG_(__a, __e, __m, memory_order_seq_cst)
|
|
|
|
#define atomic_fetch_add_explicit(__a, __m, __x) \
|
|
_ATOMIC_MODIFY_(__a, +=, __m, __x)
|
|
|
|
#define atomic_fetch_add(__a, __m) \
|
|
atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst)
|
|
|
|
#define atomic_fetch_sub_explicit(__a, __m, __x) \
|
|
_ATOMIC_MODIFY_(__a, -=, __m, __x)
|
|
|
|
#define atomic_fetch_sub(__a, __m) \
|
|
atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst)
|
|
|
|
#define atomic_fetch_and_explicit(__a, __m, __x) \
|
|
_ATOMIC_MODIFY_(__a, &=, __m, __x)
|
|
|
|
#define atomic_fetch_and(__a, __m) \
|
|
atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst)
|
|
|
|
#define atomic_fetch_or_explicit(__a, __m, __x) \
|
|
_ATOMIC_MODIFY_(__a, |=, __m, __x)
|
|
|
|
#define atomic_fetch_or(__a, __m) \
|
|
atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst)
|
|
|
|
#define atomic_fetch_xor_explicit(__a, __m, __x) \
|
|
_ATOMIC_MODIFY_(__a, ^=, __m, __x)
|
|
|
|
#define atomic_fetch_xor(__a, __m) \
|
|
atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst)
|