[multiple changes]
2008-04-10 Benjamin Kosnik <bkoz@redhat.com> * include/c_global/cstdatomic: C++ types only, format, doxygen markup. * include/c_compatibility/stdatomic.h: "C" only, format, doxygen markup. * src/atomic.c: Format, doxygen markup, edits. * include/Makefile.am (cstdatomic, stdatomic.h): Add. * src/Makefile.am (atomic.c): Add. * acinclude.m4 (GLIBCXX_CHECK_STANDARD_LAYOUT): New. * configure.ac: Call it. * include/Makefile.in: Regenerate. * src/Makefile.in: Same. * Makefile.in: Same. * doc/Makefile.in: Same. * po/Makefile.in: Same. * libmath/Makefile.in: Same. * include/Makefile.in: Same. * testsuite/Makefile.in: Same. * libsupc++/Makefile.in: Same. * config.h.in: Same. * configure: Same. * config/abi/pre/gnu.ver: Add atomics exports. * include/ext/typelist.h (apply_generator): New. * include/bits/c++config (_GLIBCXX_BEGIN_EXTERN_C): New. (_GLIBCXX_END_EXTERN_C): New. Deal with _GLIBCXX_BEGIN_NAMESPACE, _GLIBCXX_END_NAMESPACE when compiling as C. * testsuite/lib/libstdc++.exp (v3_target_compile_as_c): Add -L flag for libstdc++. * testsuite/util/testsuite_common_types.h (integral_types): New typelist. (atomics, atomics_tl): Same. (assignable, default_constructible, copy_constructible, explicit_value_constructible): New. * testsuite/17_intro/headers/c++200x/all.cc: Test new headers. * testsuite/29_atomics: New. * testsuite/29_atomics/atomic_address: Same. * testsuite/29_atomics/atomic_address/cons: Same. * testsuite/29_atomics/atomic_address/cons/explicit_value.cc: Same. * testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same. * testsuite/29_atomics/atomic_address/cons/copy_neg.cc: Same. * testsuite/29_atomics/atomic_address/cons/default.cc: Same. * testsuite/29_atomics/atomic_address/cons/aggregate.cc: Same. * testsuite/29_atomics/atomic_flag: Same. * testsuite/29_atomics/atomic_flag/cons: Same. * testsuite/29_atomics/atomic_flag/cons/assign_neg.cc: Same. * testsuite/29_atomics/atomic_flag/cons/copy_neg.cc: Same. * testsuite/29_atomics/atomic_flag/cons/default.cc: Same. * testsuite/29_atomics/atomic_flag/cons/aggregate.cc: Same. * testsuite/29_atomics/atomic_flag/requirements: Same. * testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc: Same. * testsuite/29_atomics/atomic_flag/ atomic_global_fence_compatibility.cc: Same. * testsuite/29_atomics/atomic_flag/test_and_set: Same. * testsuite/29_atomics/atomic_flag/test_and_set/explicit.c: Same. * testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc: Same. * testsuite/29_atomics/atomic_flag/test_and_set/implicit.c: Same. * testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc: Same. * testsuite/29_atomics/headers: Same. * testsuite/29_atomics/headers/cstdatomic: Same. * testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc: Same. * testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc: Same. * testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc: Same. * testsuite/29_atomics/headers/cstdatomic/macros.cc: Same. * testsuite/29_atomics/headers/stdatomic.h: Same. * testsuite/29_atomics/headers/stdatomic.h/macros.c: Same. * testsuite/29_atomics/headers/stdatomic.h/types.c: Same. * testsuite/29_atomics/headers/stdatomic.h/functions.c: Same. * testsuite/29_atomics/atomic: Same. * testsuite/29_atomics/atomic/cons: Same. * testsuite/29_atomics/atomic/cons/explicit_value.cc: Same. * testsuite/29_atomics/atomic/cons/assign_neg.cc: Same. * testsuite/29_atomics/atomic/cons/copy_neg.cc: Same. * testsuite/29_atomics/atomic/cons/default.cc: Same. * testsuite/29_atomics/atomic/requirements: Same. * testsuite/29_atomics/atomic/requirements/explicit_instantiation: Same. * testsuite/29_atomics/atomic/requirements/explicit_instantiation/ 1.cc: Same. 2008-04-10 Lawrence Crowl <crowl@google.com> * include/c_global/cstdatomic: New. * include/c_compatibility/stdatomic.h: New. * src/atomic.c: New. From-SVN: r134174
This commit is contained in:
parent
4514bed67d
commit
d466a7e21c
@ -1,3 +1,91 @@
|
||||
2008-04-10 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/c_global/cstdatomic: C++ types only, format, doxygen markup.
|
||||
* include/c_compatibility/stdatomic.h: "C" only, format, doxygen markup.
|
||||
* src/atomic.c: Format, doxygen markup, edits.
|
||||
|
||||
* include/Makefile.am (cstdatomic, stdatomic.h): Add.
|
||||
* src/Makefile.am (atomic.c): Add.
|
||||
* acinclude.m4 (GLIBCXX_CHECK_STANDARD_LAYOUT): New.
|
||||
* configure.ac: Call it.
|
||||
* include/Makefile.in: Regenerate.
|
||||
* src/Makefile.in: Same.
|
||||
* Makefile.in: Same.
|
||||
* doc/Makefile.in: Same.
|
||||
* po/Makefile.in: Same.
|
||||
* libmath/Makefile.in: Same.
|
||||
* include/Makefile.in: Same.
|
||||
* testsuite/Makefile.in: Same.
|
||||
* libsupc++/Makefile.in: Same.
|
||||
* config.h.in: Same.
|
||||
* configure: Same.
|
||||
|
||||
* config/abi/pre/gnu.ver: Add atomics exports.
|
||||
|
||||
* include/ext/typelist.h (apply_generator): New.
|
||||
* include/bits/c++config (_GLIBCXX_BEGIN_EXTERN_C): New.
|
||||
(_GLIBCXX_END_EXTERN_C): New.
|
||||
Deal with _GLIBCXX_BEGIN_NAMESPACE, _GLIBCXX_END_NAMESPACE when
|
||||
compiling as C.
|
||||
* testsuite/lib/libstdc++.exp (v3_target_compile_as_c): Add -L
|
||||
flag for libstdc++.
|
||||
* testsuite/util/testsuite_common_types.h (integral_types): New
|
||||
typelist.
|
||||
(atomics, atomics_tl): Same.
|
||||
(assignable, default_constructible, copy_constructible,
|
||||
explicit_value_constructible): New.
|
||||
* testsuite/17_intro/headers/c++200x/all.cc: Test new headers.
|
||||
* testsuite/29_atomics: New.
|
||||
* testsuite/29_atomics/atomic_address: Same.
|
||||
* testsuite/29_atomics/atomic_address/cons: Same.
|
||||
* testsuite/29_atomics/atomic_address/cons/explicit_value.cc: Same.
|
||||
* testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same.
|
||||
* testsuite/29_atomics/atomic_address/cons/copy_neg.cc: Same.
|
||||
* testsuite/29_atomics/atomic_address/cons/default.cc: Same.
|
||||
* testsuite/29_atomics/atomic_address/cons/aggregate.cc: Same.
|
||||
* testsuite/29_atomics/atomic_flag: Same.
|
||||
* testsuite/29_atomics/atomic_flag/cons: Same.
|
||||
* testsuite/29_atomics/atomic_flag/cons/assign_neg.cc: Same.
|
||||
* testsuite/29_atomics/atomic_flag/cons/copy_neg.cc: Same.
|
||||
* testsuite/29_atomics/atomic_flag/cons/default.cc: Same.
|
||||
* testsuite/29_atomics/atomic_flag/cons/aggregate.cc: Same.
|
||||
* testsuite/29_atomics/atomic_flag/requirements: Same.
|
||||
* testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc:
|
||||
Same.
|
||||
* testsuite/29_atomics/atomic_flag/
|
||||
atomic_global_fence_compatibility.cc: Same.
|
||||
* testsuite/29_atomics/atomic_flag/test_and_set: Same.
|
||||
* testsuite/29_atomics/atomic_flag/test_and_set/explicit.c: Same.
|
||||
* testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc: Same.
|
||||
* testsuite/29_atomics/atomic_flag/test_and_set/implicit.c: Same.
|
||||
* testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc: Same.
|
||||
* testsuite/29_atomics/headers: Same.
|
||||
* testsuite/29_atomics/headers/cstdatomic: Same.
|
||||
* testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc: Same.
|
||||
* testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc: Same.
|
||||
* testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc: Same.
|
||||
* testsuite/29_atomics/headers/cstdatomic/macros.cc: Same.
|
||||
* testsuite/29_atomics/headers/stdatomic.h: Same.
|
||||
* testsuite/29_atomics/headers/stdatomic.h/macros.c: Same.
|
||||
* testsuite/29_atomics/headers/stdatomic.h/types.c: Same.
|
||||
* testsuite/29_atomics/headers/stdatomic.h/functions.c: Same.
|
||||
* testsuite/29_atomics/atomic: Same.
|
||||
* testsuite/29_atomics/atomic/cons: Same.
|
||||
* testsuite/29_atomics/atomic/cons/explicit_value.cc: Same.
|
||||
* testsuite/29_atomics/atomic/cons/assign_neg.cc: Same.
|
||||
* testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
|
||||
* testsuite/29_atomics/atomic/cons/default.cc: Same.
|
||||
* testsuite/29_atomics/atomic/requirements: Same.
|
||||
* testsuite/29_atomics/atomic/requirements/explicit_instantiation: Same.
|
||||
* testsuite/29_atomics/atomic/requirements/explicit_instantiation/
|
||||
1.cc: Same.
|
||||
|
||||
2008-04-10 Lawrence Crowl <crowl@google.com>
|
||||
|
||||
* include/c_global/cstdatomic: New.
|
||||
* include/c_compatibility/stdatomic.h: New.
|
||||
* src/atomic.c: New.
|
||||
|
||||
2008-04-10 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/std/tuple: Consistency check for include guard, doxygen
|
||||
@ -165,6 +253,7 @@
|
||||
* doc/xml/manual/parallel_mode.xml: Correct configuration documentation.
|
||||
* doc/html/manual/bk01pt12ch31s04.html: Regenerate.
|
||||
|
||||
>>>>>>> .r133664
|
||||
2008-03-18 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* configure.ac (libtool_VERSION): To 6:11:0.
|
||||
|
@ -54,6 +54,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
|
||||
$(top_srcdir)/../config/lib-prefix.m4 \
|
||||
$(top_srcdir)/../config/multi.m4 \
|
||||
$(top_srcdir)/../config/no-executables.m4 \
|
||||
$(top_srcdir)/../config/proginstall.m4 \
|
||||
$(top_srcdir)/../config/unwind_ipinfo.m4 \
|
||||
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
|
||||
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
|
||||
|
@ -1476,6 +1476,46 @@ AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check whether C++200x's standard layout types are supported.
|
||||
dnl
|
||||
AC_DEFUN([GLIBCXX_CHECK_STANDARD_LAYOUT], [
|
||||
|
||||
AC_MSG_CHECKING([for ISO C++200x standard layout type support])
|
||||
AC_CACHE_VAL(ac_standard_layout, [
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
ac_test_CXXFLAGS="${CXXFLAGS+set}"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS='-std=gnu++0x'
|
||||
|
||||
AC_TRY_COMPILE([struct b
|
||||
{
|
||||
bool t;
|
||||
|
||||
// Need standard layout relaxation from POD
|
||||
private:
|
||||
b& operator=(const b&);
|
||||
b(const b&);
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
b tst1 = { false };
|
||||
return 0;
|
||||
}],,
|
||||
[ac_standard_layout=yes], [ac_standard_layout=no])
|
||||
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
AC_MSG_RESULT($ac_standard_layout)
|
||||
if test x"$ac_standard_layout" = x"yes"; then
|
||||
AC_DEFINE(_GLIBCXX_USE_STANDARD_LAYOUT, 1,
|
||||
[Define if standard layout types are supported in C++200x.])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check for what type of C headers to use.
|
||||
dnl
|
||||
|
@ -815,6 +815,9 @@
|
||||
TR1 (Chapter 5.1). */
|
||||
#undef _GLIBCXX_USE_RANDOM_TR1
|
||||
|
||||
/* Define if standard layout types are supported in C++200x. */
|
||||
#undef _GLIBCXX_USE_STANDARD_LAYOUT
|
||||
|
||||
/* Define if code specialized for wchar_t should be used. */
|
||||
#undef _GLIBCXX_USE_WCHAR_T
|
||||
|
||||
|
@ -26,7 +26,11 @@ GLIBCXX_3.4 {
|
||||
# Names inside the 'extern' block are demangled names.
|
||||
extern "C++"
|
||||
{
|
||||
std::[A-Za]*;
|
||||
std::[A-Z]*;
|
||||
std::a[a-c]*;
|
||||
std::ad[a-n]*;
|
||||
std::ad[p-z]*;
|
||||
std::a[e-z]*;
|
||||
# std::ba[a-r]*;
|
||||
std::basic_[a-e]*;
|
||||
std::basic_f[a-r]*;
|
||||
@ -61,7 +65,9 @@ GLIBCXX_3.4 {
|
||||
std::c[i-s]*;
|
||||
std::c[u-z]*;
|
||||
# std::[d-g]*;
|
||||
std::[d-e]*;
|
||||
std::d[a-d]*;
|
||||
std::d[f-z]*;
|
||||
std::e*;
|
||||
std::gslice*;
|
||||
std::h[^a]*;
|
||||
std::i[a-n]*;
|
||||
@ -120,7 +126,6 @@ GLIBCXX_3.4 {
|
||||
std::_List_node_base::unhook*;
|
||||
std::_List_node_base::reverse*;
|
||||
std::_List_node_base::transfer*;
|
||||
std::__throw_*;
|
||||
std::__timepunct*;
|
||||
std::__numeric_limits_base*;
|
||||
std::__num_base::_S_format_float*;
|
||||
@ -135,23 +140,6 @@ GLIBCXX_3.4 {
|
||||
|
||||
# Names not in an 'extern' block are mangled names.
|
||||
|
||||
# __gnu_debug::_Safe_sequence_base and _Safe_iterator_base
|
||||
_ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv;
|
||||
_ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv;
|
||||
_ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv;
|
||||
_ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_;
|
||||
_ZN11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb;
|
||||
_ZN11__gnu_debug19_Safe_iterator_base9_M_detachEv;
|
||||
_ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv;
|
||||
_ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_;
|
||||
|
||||
# __gnu_debug::_Error_formatter
|
||||
_ZNK11__gnu_debug16_Error_formatter10_M_message*;
|
||||
_ZNK11__gnu_debug16_Error_formatter10_Parameter*;
|
||||
_ZNK11__gnu_debug16_Error_formatter13_M_print_word*;
|
||||
_ZNK11__gnu_debug16_Error_formatter15_M_print_string*;
|
||||
_ZNK11__gnu_debug16_Error_formatter8_M_error*;
|
||||
|
||||
# std::string
|
||||
_ZNSsC*;
|
||||
_ZNSsD*;
|
||||
@ -436,6 +424,39 @@ GLIBCXX_3.4 {
|
||||
_ZN10__gnu_norm15_List_node_base7reverseEv;
|
||||
_ZN10__gnu_norm15_List_node_base8transfer*;
|
||||
|
||||
# __gnu_debug::_Safe_sequence_base and _Safe_iterator_base
|
||||
_ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv;
|
||||
_ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv;
|
||||
_ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv;
|
||||
_ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_;
|
||||
_ZN11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb;
|
||||
_ZN11__gnu_debug19_Safe_iterator_base9_M_detachEv;
|
||||
_ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv;
|
||||
_ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_;
|
||||
|
||||
# __gnu_debug::_Error_formatter
|
||||
_ZNK11__gnu_debug16_Error_formatter10_M_message*;
|
||||
_ZNK11__gnu_debug16_Error_formatter10_Parameter*;
|
||||
_ZNK11__gnu_debug16_Error_formatter13_M_print_word*;
|
||||
_ZNK11__gnu_debug16_Error_formatter15_M_print_string*;
|
||||
_ZNK11__gnu_debug16_Error_formatter8_M_error*;
|
||||
|
||||
# exceptions as functions
|
||||
_ZSt16__throw_bad_castv;
|
||||
_ZSt17__throw_bad_allocv;
|
||||
_ZSt18__throw_bad_typeidv;
|
||||
_ZSt19__throw_ios_failurePKc;
|
||||
_ZSt19__throw_logic_errorPKc;
|
||||
_ZSt19__throw_range_errorPKc;
|
||||
_ZSt20__throw_domain_errorPKc;
|
||||
_ZSt20__throw_length_errorPKc;
|
||||
_ZSt20__throw_out_of_rangePKc;
|
||||
_ZSt21__throw_bad_exceptionv;
|
||||
_ZSt21__throw_runtime_errorPKc;
|
||||
_ZSt22__throw_overflow_errorPKc;
|
||||
_ZSt23__throw_underflow_errorPKc;
|
||||
_ZSt24__throw_invalid_argumentPKc;
|
||||
|
||||
# operator new(size_t)
|
||||
_Znw[jm];
|
||||
# operator new(size_t, std::nothrow_t const&)
|
||||
@ -464,7 +485,10 @@ GLIBCXX_3.4 {
|
||||
# _ZTVSt[0-9][0-9][A-Za-z]*;
|
||||
_ZTVSt[0-9][0-9][A-Z]*;
|
||||
_ZTVSt[0-9][0-9][a-d]*;
|
||||
_ZTVSt[0-9][0-9][f-r]*;
|
||||
_ZTVSt[0-9][0-9][f-k]*;
|
||||
_ZTVSt11logic_error;
|
||||
_ZTVSt12length_error;
|
||||
_ZTVSt[0-9][0-9][m-r]*;
|
||||
_ZTVSt[0-9][0-9][t-z]*;
|
||||
_ZTVSt[0-9][0-9]e[^r]*;
|
||||
_ZTVSt[0-9][0-9]s[^y]*;
|
||||
@ -484,7 +508,10 @@ GLIBCXX_3.4 {
|
||||
# _ZTISt[0-9][0-9][A-Za-z]*;
|
||||
_ZTISt[0-9][0-9][A-Z]*;
|
||||
_ZTISt[0-9][0-9][a-d]*;
|
||||
_ZTISt[0-9][0-9][f-r]*;
|
||||
_ZTISt[0-9][0-9][f-k]*;
|
||||
_ZTISt11logic_error;
|
||||
_ZTISt12length_error;
|
||||
_ZTISt[0-9][0-9][m-r]*;
|
||||
_ZTISt[0-9][0-9][t-z]*;
|
||||
_ZTISt[0-9][0-9]e[^r]*;
|
||||
_ZTISt[0-9][0-9]s[^y]*;
|
||||
@ -508,7 +535,10 @@ GLIBCXX_3.4 {
|
||||
# _ZTSSt[0-9][0-9][A-Za-z]*;
|
||||
_ZTSSt[0-9][0-9][A-Z]*;
|
||||
_ZTSSt[0-9][0-9][a-d]*;
|
||||
_ZTSSt[0-9][0-9][f-r]*;
|
||||
_ZTSSt[0-9][0-9][f-k]*;
|
||||
_ZTSSt11logic_error;
|
||||
_ZTSSt12length_error;
|
||||
_ZTSSt[0-9][0-9][m-r]*;
|
||||
_ZTSSt[0-9][0-9][t-z]*;
|
||||
_ZTSSt[0-9][0-9]e[^r]*;
|
||||
_ZTSSt[0-9][0-9]s[^y]*;
|
||||
@ -785,13 +815,23 @@ GLIBCXX_3.4.10 {
|
||||
|
||||
_ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE6stosscEv;
|
||||
|
||||
|
||||
_ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4syncEv;
|
||||
_ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE[5-9CD]*;
|
||||
|
||||
} GLIBCXX_3.4.9;
|
||||
|
||||
GLIBCXX_3.4.11 {
|
||||
|
||||
# atomic
|
||||
__atomic_flag_for_address;
|
||||
__atomic_flag_wait_explicit;
|
||||
atomic_flag_clear;
|
||||
atomic_flag_clear_explicit;
|
||||
atomic_flag_fence;
|
||||
atomic_flag_test_and_set;
|
||||
atomic_flag_test_and_set_explicit;
|
||||
atomic_global_fence_compatibility;
|
||||
|
||||
# system_error
|
||||
_ZSt15system_category;
|
||||
|
||||
|
102
libstdc++-v3/configure
vendored
102
libstdc++-v3/configure
vendored
@ -17947,6 +17947,106 @@ _ACEOF
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking for ISO C++200x standard layout type support" >&5
|
||||
echo $ECHO_N "checking for ISO C++200x standard layout type support... $ECHO_C" >&6
|
||||
if test "${ac_standard_layout+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
|
||||
|
||||
|
||||
ac_ext=cc
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
ac_test_CXXFLAGS="${CXXFLAGS+set}"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS='-std=gnu++0x'
|
||||
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
struct b
|
||||
{
|
||||
bool t;
|
||||
|
||||
// Need standard layout relaxation from POD
|
||||
private:
|
||||
b& operator=(const b&);
|
||||
b(const b&);
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
b tst1 = { false };
|
||||
return 0;
|
||||
}
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_cxx_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_standard_layout=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_standard_layout=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: result: $ac_standard_layout" >&5
|
||||
echo "${ECHO_T}$ac_standard_layout" >&6
|
||||
if test x"$ac_standard_layout" = x"yes"; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define _GLIBCXX_USE_STANDARD_LAYOUT 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# No surprises, no surprises...
|
||||
|
||||
echo "$as_me:$LINENO: checking for thread model used by GCC" >&5
|
||||
@ -17988,7 +18088,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
# Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
|
||||
cat > conftest.$ac_ext << EOF
|
||||
#line 17991 "configure"
|
||||
#line 18091 "configure"
|
||||
int main()
|
||||
{
|
||||
// NB: _Atomic_word not necessarily int.
|
||||
|
@ -113,6 +113,7 @@ GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
|
||||
|
||||
# Checks for operating systems support that don't require linking.
|
||||
GLIBCXX_CHECK_SYSTEM_ERROR
|
||||
GLIBCXX_CHECK_STANDARD_LAYOUT
|
||||
|
||||
# No surprises, no surprises...
|
||||
GLIBCXX_ENABLE_THREADS
|
||||
|
@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
|
||||
$(top_srcdir)/../config/lib-prefix.m4 \
|
||||
$(top_srcdir)/../config/multi.m4 \
|
||||
$(top_srcdir)/../config/no-executables.m4 \
|
||||
$(top_srcdir)/../config/proginstall.m4 \
|
||||
$(top_srcdir)/../config/unwind_ipinfo.m4 \
|
||||
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
|
||||
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
|
||||
|
@ -620,6 +620,7 @@ c_base_headers = \
|
||||
${c_base_srcdir}/csetjmp \
|
||||
${c_base_srcdir}/csignal \
|
||||
${c_base_srcdir}/cstdarg \
|
||||
${c_base_srcdir}/cstdatomic \
|
||||
${c_base_srcdir}/cstdbool \
|
||||
${c_base_srcdir}/cstddef \
|
||||
${c_base_srcdir}/cstdint \
|
||||
@ -643,7 +644,8 @@ if GLIBCXX_C_HEADERS_C_GLOBAL
|
||||
c_compatibility_headers = \
|
||||
${c_compatibility_srcdir}/complex.h \
|
||||
${c_compatibility_srcdir}/fenv.h \
|
||||
${c_compatibility_srcdir}/tgmath.h
|
||||
${c_compatibility_srcdir}/tgmath.h \
|
||||
${c_compatibility_srcdir}/stdatomic.h
|
||||
endif
|
||||
|
||||
if GLIBCXX_C_HEADERS_C
|
||||
|
@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
|
||||
$(top_srcdir)/../config/lib-prefix.m4 \
|
||||
$(top_srcdir)/../config/multi.m4 \
|
||||
$(top_srcdir)/../config/no-executables.m4 \
|
||||
$(top_srcdir)/../config/proginstall.m4 \
|
||||
$(top_srcdir)/../config/unwind_ipinfo.m4 \
|
||||
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
|
||||
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
|
||||
@ -867,6 +868,7 @@ c_base_headers = \
|
||||
${c_base_srcdir}/csetjmp \
|
||||
${c_base_srcdir}/csignal \
|
||||
${c_base_srcdir}/cstdarg \
|
||||
${c_base_srcdir}/cstdatomic \
|
||||
${c_base_srcdir}/cstdbool \
|
||||
${c_base_srcdir}/cstddef \
|
||||
${c_base_srcdir}/cstdint \
|
||||
@ -885,7 +887,8 @@ c_compatibility_builddir = .
|
||||
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@c_compatibility_headers = \
|
||||
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/complex.h \
|
||||
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/fenv.h \
|
||||
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h
|
||||
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h \
|
||||
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/stdatomic.h
|
||||
|
||||
@GLIBCXX_C_HEADERS_C_STD_TRUE@c_compatibility_headers =
|
||||
@GLIBCXX_C_HEADERS_C_TRUE@c_compatibility_headers = \
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Predefined symbols and macros -*- C++ -*-
|
||||
|
||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
// 2006, 2007 Free Software Foundation, Inc.
|
||||
// 2006, 2007, 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
|
||||
@ -216,6 +216,20 @@ namespace std
|
||||
}
|
||||
#endif
|
||||
|
||||
// Defines for C compatibility. In particular, define extern "C"
|
||||
// linkage only when using C++, same with namespaces.
|
||||
#if __cplusplus
|
||||
# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
|
||||
# define _GLIBCXX_END_EXTERN_C }
|
||||
#else
|
||||
# define _GLIBCXX_BEGIN_EXTERN_C
|
||||
# define _GLIBCXX_END_EXTERN_C
|
||||
# undef _GLIBCXX_BEGIN_NAMESPACE
|
||||
# undef _GLIBCXX_END_NAMESPACE
|
||||
# define _GLIBCXX_BEGIN_NAMESPACE(X)
|
||||
# define _GLIBCXX_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
// Define if compatibility should be provided for -mlong-double-64.
|
||||
#undef _GLIBCXX_LONG_DOUBLE_COMPAT
|
||||
|
||||
|
387
libstdc++-v3/include/c_compatibility/stdatomic.h
Normal file
387
libstdc++-v3/include/c_compatibility/stdatomic.h
Normal file
@ -0,0 +1,387 @@
|
||||
// -*- C++ -*- compatibility 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 stdatomic.h
|
||||
* This is a Standard C++ Library header.
|
||||
*/
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h> // XXX need to define bool w/o stdbool.h in tr1/cstdbool
|
||||
|
||||
#ifndef _GLIBCXX_STDATOMIC_H
|
||||
#define _GLIBCXX_STDATOMIC_H 1
|
||||
|
||||
_GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
_GLIBCXX_BEGIN_EXTERN_C
|
||||
|
||||
/// Enumeration for memory_order
|
||||
typedef enum memory_order
|
||||
{
|
||||
memory_order_relaxed,
|
||||
memory_order_acquire,
|
||||
memory_order_release,
|
||||
memory_order_acq_rel,
|
||||
memory_order_seq_cst
|
||||
} memory_order;
|
||||
|
||||
|
||||
// Base for atomic_flag.
|
||||
struct __atomic_flag_base
|
||||
{
|
||||
bool _M_b;
|
||||
};
|
||||
|
||||
// Base for atomic_address
|
||||
struct __atomic_address_base
|
||||
{
|
||||
void* _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;
|
||||
};
|
||||
|
||||
// Switch atomic integral base types based on C or C++. In
|
||||
// addition, for "C" only provide type-generic macros for atomic
|
||||
// operations. (As C++ accomplishes the same thing with sets of
|
||||
// overloaded functions.
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define ATOMIC_FLAG_INIT { { false } }
|
||||
#define _ATOMIC_MEMBER_ ((__a)->_M_base._M_i)
|
||||
|
||||
extern "C++"
|
||||
{
|
||||
struct atomic_flag;
|
||||
struct atomic_address;
|
||||
struct atomic_bool;
|
||||
struct atomic_char;
|
||||
struct atomic_schar;
|
||||
struct atomic_uchar;
|
||||
struct atomic_short;
|
||||
struct atomic_ushort;
|
||||
struct atomic_int;
|
||||
struct atomic_uint;
|
||||
struct atomic_long;
|
||||
struct atomic_ulong;
|
||||
struct atomic_llong;
|
||||
struct atomic_ullong;
|
||||
struct atomic_wchar_t;
|
||||
template<typename _Tp>
|
||||
struct atomic;
|
||||
}
|
||||
#else
|
||||
|
||||
#define ATOMIC_FLAG_INIT { false }
|
||||
#define _ATOMIC_MEMBER_ ((__a)->_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;
|
||||
|
||||
#define atomic_is_lock_free(__a) \
|
||||
false
|
||||
|
||||
#define atomic_load(__a) \
|
||||
_ATOMIC_LOAD_(__a, memory_order_seq_cst)
|
||||
|
||||
#define atomic_load_explicit(__a, __x) \
|
||||
_ATOMIC_LOAD_(__a, __x)
|
||||
|
||||
#define atomic_store(__a, __m) \
|
||||
_ATOMIC_STORE_(__a, __m, memory_order_seq_cst)
|
||||
|
||||
#define atomic_store_explicit(__a, __m, __x) \
|
||||
_ATOMIC_STORE_(__a, __m, __x)
|
||||
|
||||
#define atomic_swap(__a, __m) \
|
||||
_ATOMIC_MODIFY_(__a, =, __m, memory_order_seq_cst)
|
||||
|
||||
#define atomic_swap_explicit(__a, __m, __x) \
|
||||
_ATOMIC_MODIFY_(__a, =, __m, __x)
|
||||
|
||||
#define atomic_compare_swap(__a, __e, __m) \
|
||||
_ATOMIC_CMPSWP_(__a, __e, __m, memory_order_seq_cst)
|
||||
|
||||
#define atomic_compare_swap_explicit(__a, __e, __m, __x, __y) \
|
||||
_ATOMIC_CMPSWP_(__a, __e, __m, __x)
|
||||
|
||||
#define atomic_fence(__a, __x) \
|
||||
({ _ATOMIC_FENCE_(__a, __x); })
|
||||
|
||||
#define atomic_fetch_add_explicit(__a, __m, __x) \
|
||||
_ATOMIC_MODIFY_(__a, +=, __m, __x)
|
||||
|
||||
#define atomic_fetch_add(__a, __m) \
|
||||
_ATOMIC_MODIFY_(__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_MODIFY_(__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_MODIFY_(__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_MODIFY_(__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_MODIFY_(__a, ^=, __m, memory_order_seq_cst)
|
||||
|
||||
#endif
|
||||
|
||||
// Typedefs for other atomic integral types.
|
||||
typedef atomic_schar atomic_int_least8_t;
|
||||
typedef atomic_uchar atomic_uint_least8_t;
|
||||
typedef atomic_short atomic_int_least16_t;
|
||||
typedef atomic_ushort atomic_uint_least16_t;
|
||||
typedef atomic_int atomic_int_least32_t;
|
||||
typedef atomic_uint atomic_uint_least32_t;
|
||||
typedef atomic_llong atomic_int_least64_t;
|
||||
typedef atomic_ullong atomic_uint_least64_t;
|
||||
|
||||
typedef atomic_schar atomic_int_fast8_t;
|
||||
typedef atomic_uchar atomic_uint_fast8_t;
|
||||
typedef atomic_short atomic_int_fast16_t;
|
||||
typedef atomic_ushort atomic_uint_fast16_t;
|
||||
typedef atomic_int atomic_int_fast32_t;
|
||||
typedef atomic_uint atomic_uint_fast32_t;
|
||||
typedef atomic_llong atomic_int_fast64_t;
|
||||
typedef atomic_ullong atomic_uint_fast64_t;
|
||||
|
||||
typedef atomic_long atomic_intptr_t;
|
||||
typedef atomic_ulong atomic_uintptr_t;
|
||||
|
||||
typedef atomic_long atomic_ssize_t;
|
||||
typedef atomic_ulong atomic_size_t;
|
||||
|
||||
typedef atomic_llong atomic_intmax_t;
|
||||
typedef atomic_ullong atomic_uintmax_t;
|
||||
|
||||
typedef atomic_long atomic_ptrdiff_t;
|
||||
|
||||
typedef atomic_int_least16_t atomic_char16_t;
|
||||
typedef atomic_int_least32_t atomic_char32_t;
|
||||
|
||||
// Accessor functions for atomic_flag.
|
||||
extern bool
|
||||
atomic_flag_test_and_set(volatile atomic_flag*);
|
||||
|
||||
extern bool
|
||||
atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order);
|
||||
|
||||
extern void
|
||||
atomic_flag_clear(volatile atomic_flag*);
|
||||
|
||||
extern void
|
||||
atomic_flag_clear_explicit(volatile atomic_flag*, memory_order);
|
||||
|
||||
extern void
|
||||
atomic_flag_fence(const volatile atomic_flag*, memory_order);
|
||||
|
||||
extern void
|
||||
__atomic_flag_wait_explicit(volatile atomic_flag*, memory_order);
|
||||
|
||||
extern volatile atomic_flag*
|
||||
__atomic_flag_for_address(const volatile void* __z) __attribute__((const));
|
||||
|
||||
// External object.
|
||||
extern const atomic_flag atomic_global_fence_compatibility;
|
||||
|
||||
/// 29.2 Lock-free Property
|
||||
#define ATOMIC_INTEGRAL_LOCK_FREE 0
|
||||
#define ATOMIC_ADDRESS_LOCK_FREE 0
|
||||
|
||||
// Implementation specific defines.
|
||||
#define _ATOMIC_LOAD_(__a, __x) \
|
||||
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
|
||||
volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
|
||||
__atomic_flag_wait_explicit(__g, __x); \
|
||||
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
|
||||
atomic_flag_clear_explicit(__g, __x); \
|
||||
__r; })
|
||||
|
||||
#define _ATOMIC_STORE_(__a, __m, __x) \
|
||||
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
|
||||
__typeof__(__m) __v = (__m); \
|
||||
volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
|
||||
__atomic_flag_wait_explicit(__g, __x); \
|
||||
*__p = __v; \
|
||||
atomic_flag_clear_explicit(__g, __x); \
|
||||
__v; })
|
||||
|
||||
#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
|
||||
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
|
||||
__typeof__(__m) __v = (__m); \
|
||||
volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
|
||||
__atomic_flag_wait_explicit(__g, __x); \
|
||||
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
|
||||
*__p __o __v; \
|
||||
atomic_flag_clear_explicit(__g, __x); \
|
||||
__r; })
|
||||
|
||||
#define _ATOMIC_CMPSWP_(__a, __e, __m, __x) \
|
||||
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
|
||||
__typeof__(__e) __q = (__e); \
|
||||
__typeof__(__m) __v = (__m); \
|
||||
bool __r; \
|
||||
volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
|
||||
__atomic_flag_wait_explicit(__g, __x); \
|
||||
__typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
|
||||
if (__t__ == *__q) { *__p = __v; __r = true; } \
|
||||
else { *__q = __t__; __r = false; } \
|
||||
atomic_flag_clear_explicit(__g, __x); \
|
||||
__r; })
|
||||
|
||||
#define _ATOMIC_FENCE_(__a, __x) \
|
||||
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
|
||||
volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
|
||||
atomic_flag_fence(__g, __x); \
|
||||
})
|
||||
|
||||
_GLIBCXX_END_EXTERN_C
|
||||
_GLIBCXX_END_NAMESPACE
|
||||
|
||||
#ifdef __cplusplus
|
||||
// Inject into global namespace iff C++.
|
||||
using std::memory_order;
|
||||
using std::memory_order_relaxed;
|
||||
using std::memory_order_acquire;
|
||||
using std::memory_order_release;
|
||||
using std::memory_order_acq_rel;
|
||||
using std::memory_order_seq_cst;
|
||||
|
||||
using std::atomic_flag;
|
||||
|
||||
using std::atomic_bool;
|
||||
using std::atomic_char;
|
||||
using std::atomic_schar;
|
||||
using std::atomic_uchar;
|
||||
using std::atomic_short;
|
||||
using std::atomic_ushort;
|
||||
using std::atomic_int;
|
||||
using std::atomic_uint;
|
||||
using std::atomic_long;
|
||||
using std::atomic_ulong;
|
||||
using std::atomic_llong;
|
||||
using std::atomic_ullong;
|
||||
using std::atomic_wchar_t;
|
||||
|
||||
using std::atomic_address;
|
||||
using std::atomic;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
4100
libstdc++-v3/include/c_global/cstdatomic
Normal file
4100
libstdc++-v3/include/c_global/cstdatomic
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2005, 2006, 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
|
||||
@ -71,10 +71,21 @@ namespace typelist
|
||||
typedef Typelist tail;
|
||||
};
|
||||
|
||||
template<typename Fn, class Typelist>
|
||||
// Apply all typelist types to unary functor.
|
||||
template<typename Fn, typename Typelist>
|
||||
void
|
||||
apply(Fn&, Typelist);
|
||||
|
||||
/// Apply all typelist types to generator functor.
|
||||
template<typename Gn, typename Typelist>
|
||||
void
|
||||
apply_generator(Gn&, Typelist);
|
||||
|
||||
// Apply all typelist types and values to generator functor.
|
||||
template<typename Gn, typename TypelistT, typename TypelistV>
|
||||
void
|
||||
apply_generator(Gn&, TypelistT, TypelistV);
|
||||
|
||||
template<typename Typelist0, typename Typelist1>
|
||||
struct append;
|
||||
|
||||
@ -135,20 +146,64 @@ namespace detail
|
||||
struct apply_<Fn, chain<Hd, Tl> >
|
||||
{
|
||||
void
|
||||
operator() (Fn& f)
|
||||
operator()(Fn& f)
|
||||
{
|
||||
f.operator()(Hd());
|
||||
apply_<Fn, Tl> next;
|
||||
next(f);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Fn>
|
||||
struct apply_<Fn, null_type>
|
||||
{
|
||||
void
|
||||
operator()(Fn&) { }
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Gn, typename Typelist_Chain>
|
||||
struct apply_generator1_;
|
||||
|
||||
template<typename Gn, typename Hd, typename Tl>
|
||||
struct apply_generator1_<Gn, chain<Hd, Tl> >
|
||||
{
|
||||
void
|
||||
operator()(Gn& g)
|
||||
{
|
||||
g.template operator()<Hd>();
|
||||
apply_generator1_<Gn, Tl> next;
|
||||
next(g);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Gn>
|
||||
struct apply_generator1_<Gn, null_type>
|
||||
{
|
||||
void
|
||||
operator()(Gn&) { }
|
||||
};
|
||||
|
||||
template<typename Gn, typename TypelistT_Chain, typename TypelistV_Chain>
|
||||
struct apply_generator2_;
|
||||
|
||||
template<typename Gn, typename Hd1, typename TlT, typename Hd2, typename TlV>
|
||||
struct apply_generator2_<Gn, chain<Hd1, TlT>, chain<Hd2, TlV> >
|
||||
{
|
||||
void
|
||||
operator()(Gn& g)
|
||||
{
|
||||
g.template operator()<Hd1, Hd2>();
|
||||
apply_generator2_<Gn, TlT, TlV> next;
|
||||
next(g);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Gn>
|
||||
struct apply_generator2_<Gn, null_type, null_type>
|
||||
{
|
||||
void
|
||||
operator()(Gn&) { }
|
||||
};
|
||||
|
||||
template<typename Typelist_Chain0, typename Typelist_Chain1>
|
||||
struct append_;
|
||||
@ -294,20 +349,20 @@ namespace detail
|
||||
struct chain_flatten_;
|
||||
|
||||
template<typename Hd_Tl>
|
||||
struct chain_flatten_<chain<Hd_Tl, null_type> >
|
||||
{
|
||||
typedef typename Hd_Tl::root type;
|
||||
};
|
||||
struct chain_flatten_<chain<Hd_Tl, null_type> >
|
||||
{
|
||||
typedef typename Hd_Tl::root type;
|
||||
};
|
||||
|
||||
template<typename Hd_Typelist, class Tl_Typelist>
|
||||
struct chain_flatten_<chain<Hd_Typelist, Tl_Typelist> >
|
||||
{
|
||||
private:
|
||||
typedef typename chain_flatten_<Tl_Typelist>::type rest_type;
|
||||
typedef append<Hd_Typelist, node<rest_type> > append_type;
|
||||
public:
|
||||
typedef typename append_type::type::root type;
|
||||
};
|
||||
struct chain_flatten_<chain<Hd_Typelist, Tl_Typelist> >
|
||||
{
|
||||
private:
|
||||
typedef typename chain_flatten_<Tl_Typelist>::type rest_type;
|
||||
typedef append<Hd_Typelist, node<rest_type> > append_type;
|
||||
public:
|
||||
typedef typename append_type::type::root type;
|
||||
};
|
||||
} // namespace detail
|
||||
} // namespace typelist
|
||||
|
||||
@ -333,7 +388,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
||||
|
||||
namespace typelist
|
||||
{
|
||||
template<typename Fn, class Typelist>
|
||||
template<typename Fn, typename Typelist>
|
||||
void
|
||||
apply(Fn& fn, Typelist)
|
||||
{
|
||||
@ -341,6 +396,24 @@ namespace typelist
|
||||
a(fn);
|
||||
}
|
||||
|
||||
template<typename Fn, typename Typelist>
|
||||
void
|
||||
apply_generator(Fn& fn, Typelist)
|
||||
{
|
||||
detail::apply_generator1_<Fn, typename Typelist::root> a;
|
||||
a(fn);
|
||||
}
|
||||
|
||||
template<typename Fn, typename TypelistT, typename TypelistV>
|
||||
void
|
||||
apply_generator(Fn& fn, TypelistT, TypelistV)
|
||||
{
|
||||
typedef typename TypelistT::root rootT;
|
||||
typedef typename TypelistV::root rootV;
|
||||
detail::apply_generator2_<Fn, rootT, rootV> a;
|
||||
a(fn);
|
||||
}
|
||||
|
||||
template<typename Typelist0, typename Typelist1>
|
||||
struct append
|
||||
{
|
||||
|
@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
|
||||
$(top_srcdir)/../config/lib-prefix.m4 \
|
||||
$(top_srcdir)/../config/multi.m4 \
|
||||
$(top_srcdir)/../config/no-executables.m4 \
|
||||
$(top_srcdir)/../config/proginstall.m4 \
|
||||
$(top_srcdir)/../config/unwind_ipinfo.m4 \
|
||||
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
|
||||
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
|
||||
|
@ -51,6 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
|
||||
$(top_srcdir)/../config/lib-prefix.m4 \
|
||||
$(top_srcdir)/../config/multi.m4 \
|
||||
$(top_srcdir)/../config/no-executables.m4 \
|
||||
$(top_srcdir)/../config/proginstall.m4 \
|
||||
$(top_srcdir)/../config/unwind_ipinfo.m4 \
|
||||
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
|
||||
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
|
||||
|
@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
|
||||
$(top_srcdir)/../config/lib-prefix.m4 \
|
||||
$(top_srcdir)/../config/multi.m4 \
|
||||
$(top_srcdir)/../config/no-executables.m4 \
|
||||
$(top_srcdir)/../config/proginstall.m4 \
|
||||
$(top_srcdir)/../config/unwind_ipinfo.m4 \
|
||||
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
|
||||
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
|
||||
|
@ -134,6 +134,7 @@ endif
|
||||
|
||||
# Sources present in the src directory.
|
||||
sources = \
|
||||
atomic.cc \
|
||||
bitmap_allocator.cc \
|
||||
pool_allocator.cc \
|
||||
mt_allocator.cc \
|
||||
@ -248,6 +249,11 @@ date_time.lo: date_time.cc
|
||||
date_time.o: date_time.cc
|
||||
$(CXXCOMPILE) -std=gnu++0x -c $<
|
||||
|
||||
atomic.lo: atomic.cc
|
||||
$(LTCXXCOMPILE) -x c++ -std=gnu++0x -c $<
|
||||
atomic.o: atomic.cc
|
||||
$(CXXCOMPILE) -x c++ -std=gnu++0x -c $<
|
||||
|
||||
if GLIBCXX_LDBL_COMPAT
|
||||
# Use special rules for compatibility-ldbl.cc compilation, as we need to
|
||||
# pass -mlong-double-64.
|
||||
|
@ -50,6 +50,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
|
||||
$(top_srcdir)/../config/lib-prefix.m4 \
|
||||
$(top_srcdir)/../config/multi.m4 \
|
||||
$(top_srcdir)/../config/no-executables.m4 \
|
||||
$(top_srcdir)/../config/proginstall.m4 \
|
||||
$(top_srcdir)/../config/unwind_ipinfo.m4 \
|
||||
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
|
||||
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
|
||||
@ -69,18 +70,18 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
|
||||
am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
|
||||
toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
|
||||
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
|
||||
am__libstdc___la_SOURCES_DIST = bitmap_allocator.cc pool_allocator.cc \
|
||||
mt_allocator.cc codecvt.cc compatibility.cc complex_io.cc \
|
||||
ctype.cc date_time.cc debug.cc functexcept.cc hash.cc \
|
||||
hash_c++0x.cc globals_io.cc hashtable.cc hashtable_c++0x.cc \
|
||||
ios.cc ios_failure.cc ios_init.cc ios_locale.cc limits.cc \
|
||||
list.cc debug_list.cc locale.cc locale_init.cc \
|
||||
locale_facets.cc localename.cc stdexcept.cc strstream.cc \
|
||||
system_error.cc tree.cc allocator-inst.cc concept-inst.cc \
|
||||
fstream-inst.cc ext-inst.cc ios-inst.cc iostream-inst.cc \
|
||||
istream-inst.cc istream.cc locale-inst.cc misc-inst.cc \
|
||||
ostream-inst.cc sstream-inst.cc streambuf-inst.cc streambuf.cc \
|
||||
string-inst.cc valarray-inst.cc wlocale-inst.cc \
|
||||
am__libstdc___la_SOURCES_DIST = atomic.cc bitmap_allocator.cc \
|
||||
pool_allocator.cc mt_allocator.cc codecvt.cc compatibility.cc \
|
||||
complex_io.cc ctype.cc date_time.cc debug.cc functexcept.cc \
|
||||
hash.cc hash_c++0x.cc globals_io.cc hashtable.cc \
|
||||
hashtable_c++0x.cc ios.cc ios_failure.cc ios_init.cc \
|
||||
ios_locale.cc limits.cc list.cc debug_list.cc locale.cc \
|
||||
locale_init.cc locale_facets.cc localename.cc stdexcept.cc \
|
||||
strstream.cc system_error.cc tree.cc allocator-inst.cc \
|
||||
concept-inst.cc fstream-inst.cc ext-inst.cc ios-inst.cc \
|
||||
iostream-inst.cc istream-inst.cc istream.cc locale-inst.cc \
|
||||
misc-inst.cc ostream-inst.cc sstream-inst.cc streambuf-inst.cc \
|
||||
streambuf.cc string-inst.cc valarray-inst.cc wlocale-inst.cc \
|
||||
wstring-inst.cc atomicity.cc codecvt_members.cc \
|
||||
collate_members.cc ctype_members.cc messages_members.cc \
|
||||
monetary_members.cc numeric_members.cc time_members.cc \
|
||||
@ -94,19 +95,19 @@ am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
|
||||
@ENABLE_PARALLEL_TRUE@ parallel_settings.lo
|
||||
am__objects_4 = basic_file.lo c++locale.lo $(am__objects_2) \
|
||||
$(am__objects_3)
|
||||
am__objects_5 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
|
||||
codecvt.lo compatibility.lo complex_io.lo ctype.lo \
|
||||
date_time.lo debug.lo functexcept.lo hash.lo hash_c++0x.lo \
|
||||
globals_io.lo hashtable.lo hashtable_c++0x.lo ios.lo \
|
||||
ios_failure.lo ios_init.lo ios_locale.lo limits.lo list.lo \
|
||||
debug_list.lo locale.lo locale_init.lo locale_facets.lo \
|
||||
localename.lo stdexcept.lo strstream.lo system_error.lo \
|
||||
tree.lo allocator-inst.lo concept-inst.lo fstream-inst.lo \
|
||||
ext-inst.lo ios-inst.lo iostream-inst.lo istream-inst.lo \
|
||||
istream.lo locale-inst.lo misc-inst.lo ostream-inst.lo \
|
||||
sstream-inst.lo streambuf-inst.lo streambuf.lo string-inst.lo \
|
||||
valarray-inst.lo wlocale-inst.lo wstring-inst.lo \
|
||||
$(am__objects_1) $(am__objects_4)
|
||||
am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \
|
||||
mt_allocator.lo codecvt.lo compatibility.lo complex_io.lo \
|
||||
ctype.lo date_time.lo debug.lo functexcept.lo hash.lo \
|
||||
hash_c++0x.lo globals_io.lo hashtable.lo hashtable_c++0x.lo \
|
||||
ios.lo ios_failure.lo ios_init.lo ios_locale.lo limits.lo \
|
||||
list.lo debug_list.lo locale.lo locale_init.lo \
|
||||
locale_facets.lo localename.lo stdexcept.lo strstream.lo \
|
||||
system_error.lo tree.lo allocator-inst.lo concept-inst.lo \
|
||||
fstream-inst.lo ext-inst.lo ios-inst.lo iostream-inst.lo \
|
||||
istream-inst.lo istream.lo locale-inst.lo misc-inst.lo \
|
||||
ostream-inst.lo sstream-inst.lo streambuf-inst.lo streambuf.lo \
|
||||
string-inst.lo valarray-inst.lo wlocale-inst.lo \
|
||||
wstring-inst.lo $(am__objects_1) $(am__objects_4)
|
||||
am_libstdc___la_OBJECTS = $(am__objects_5)
|
||||
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
@ -367,6 +368,7 @@ host_sources_extra = \
|
||||
|
||||
# Sources present in the src directory.
|
||||
sources = \
|
||||
atomic.cc \
|
||||
bitmap_allocator.cc \
|
||||
pool_allocator.cc \
|
||||
mt_allocator.cc \
|
||||
@ -839,6 +841,11 @@ date_time.lo: date_time.cc
|
||||
date_time.o: date_time.cc
|
||||
$(CXXCOMPILE) -std=gnu++0x -c $<
|
||||
|
||||
atomic.lo: atomic.cc
|
||||
$(LTCXXCOMPILE) -x c++ -std=gnu++0x -c $<
|
||||
atomic.o: atomic.cc
|
||||
$(CXXCOMPILE) -x c++ -std=gnu++0x -c $<
|
||||
|
||||
# Use special rules for compatibility-ldbl.cc compilation, as we need to
|
||||
# pass -mlong-double-64.
|
||||
@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.lo: compatibility-ldbl.cc
|
||||
|
116
libstdc++-v3/src/atomic.cc
Normal file
116
libstdc++-v3/src/atomic.cc
Normal file
@ -0,0 +1,116 @@
|
||||
// Support for atomic operations -*- C++ -*-
|
||||
|
||||
// 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.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdatomic>
|
||||
|
||||
#define LOGSIZE 4
|
||||
|
||||
namespace
|
||||
{
|
||||
atomic_flag volatile __atomic_flag_anon_table__[ 1 << LOGSIZE ] =
|
||||
{
|
||||
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
|
||||
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
|
||||
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
|
||||
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
namespace std
|
||||
{
|
||||
extern "C" {
|
||||
|
||||
const atomic_flag atomic_global_fence_compatibility = ATOMIC_FLAG_INIT;
|
||||
|
||||
bool
|
||||
atomic_flag_test_and_set_explicit(volatile atomic_flag* __a,
|
||||
memory_order __x)
|
||||
{
|
||||
#ifdef _GLIBCXX_ATOMIC_BUILTINS
|
||||
if (__x >= memory_order_acq_rel)
|
||||
__sync_synchronize();
|
||||
return __sync_lock_test_and_set(&(__a->_M_base._M_b), 1);
|
||||
#else
|
||||
bool result = __a->_M_base._M_b;
|
||||
__a->_M_base._M_b = true;
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
atomic_flag_test_and_set(volatile atomic_flag* __a)
|
||||
{ return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
|
||||
|
||||
void
|
||||
atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __x)
|
||||
{
|
||||
#ifdef _GLIBCXX_ATOMIC_BUILTINS
|
||||
__sync_lock_release(&(__a->_M_base._M_b));
|
||||
if (__x >= memory_order_acq_rel)
|
||||
__sync_synchronize();
|
||||
#else
|
||||
__a->_M_base._M_b = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
atomic_flag_clear(volatile atomic_flag* __a)
|
||||
{ atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
|
||||
|
||||
void
|
||||
atomic_flag_fence(const volatile atomic_flag*, memory_order)
|
||||
{
|
||||
#ifdef _GLIBCXX_ATOMIC_BUILTINS
|
||||
__sync_synchronize();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
__atomic_flag_wait_explicit(volatile atomic_flag* __a, memory_order __x)
|
||||
{
|
||||
while (atomic_flag_test_and_set_explicit(__a, __x))
|
||||
{ };
|
||||
}
|
||||
|
||||
volatile atomic_flag*
|
||||
__atomic_flag_for_address(const volatile void* __z)
|
||||
{
|
||||
uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
|
||||
__u += (__u >> 2) + (__u << 4);
|
||||
__u += (__u >> 7) + (__u << 5);
|
||||
__u += (__u >> 17) + (__u << 13);
|
||||
if (sizeof(uintptr_t) > 4) __u += (__u >> 31);
|
||||
__u &= ~((~uintptr_t(0)) << LOGSIZE);
|
||||
return __atomic_flag_anon_table__ + __u;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
} // namespace std
|
@ -36,6 +36,7 @@
|
||||
#include <csetjmp>
|
||||
#include <csignal>
|
||||
#include <cstdarg>
|
||||
#include <cstdatomic>
|
||||
#include <cstdbool>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@ -67,6 +68,7 @@
|
||||
#include <math.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef _GLIBCXX_HAVE_STDBOOL_H
|
||||
#include <stdbool.h>
|
||||
|
55
libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
Normal file
55
libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
Normal file
@ -0,0 +1,55 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
#include <testsuite_common_types.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__gnu_test::assignable test;
|
||||
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// { dg-error "within this context" "" { target *-*-* } 310 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1750 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1782 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1799 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1816 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1832 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1848 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1864 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1880 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1896 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1913 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1929 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1945 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1961 }
|
||||
// { dg-excess-errors "In member function" }
|
55
libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
Normal file
55
libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
Normal file
@ -0,0 +1,55 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
#include <testsuite_common_types.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__gnu_test::copy_constructible test;
|
||||
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// { dg-error "within this context" "" { target *-*-* } 333 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1749 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1781 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1798 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1814 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1831 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1847 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1863 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1879 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1895 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1912 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1928 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1944 }
|
||||
// { dg-error "is private" "" { target *-*-* } 1960 }
|
||||
// { dg-excess-errors "In member function" }
|
38
libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc
Normal file
38
libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc
Normal file
@ -0,0 +1,38 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
#include <testsuite_common_types.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__gnu_test::default_constructible test;
|
||||
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl());
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
#include <testsuite_common_types.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__gnu_test::explicit_value_constructible test;
|
||||
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(),
|
||||
__gnu_test::integral_types::type());
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
// This file tests explicit instantiation of basic_string
|
||||
|
||||
#include <cstdatomic>
|
||||
#include <testsuite_character.h>
|
||||
|
||||
template class std::atomic<__gnu_test::pod_char>;
|
||||
template class std::atomic<__gnu_test::pod_char*>;
|
@ -0,0 +1,37 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile { xfail *-*-* } }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::atomic_address a = { { NULL } }; // { dg-excess-errors "braces around" }
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Assign.
|
||||
typedef std::atomic_address test_type;
|
||||
test_type t1;
|
||||
test_type t2;
|
||||
t1 = t2;
|
||||
}
|
||||
// { dg-error "within this context" "" { target *-*-* } 39 }
|
||||
// { dg-error "is private" "" { target *-*-* } 167 }
|
@ -0,0 +1,41 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Copy.
|
||||
typedef std::atomic_address test_type;
|
||||
test_type t1;
|
||||
test_type t2(t1);
|
||||
}
|
||||
// { dg-error "within this context" "" { target *-*-* } 38 }
|
||||
// { dg-error "is private" "" { target *-*-* } 166 }
|
@ -0,0 +1,37 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Default constructor.
|
||||
std::atomic_address a;
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Explicit value constructor.
|
||||
void* v = NULL;
|
||||
std::atomic_address a(v);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace std;
|
||||
atomic_flag_fence(&atomic_global_fence_compatibility, memory_order_acquire);
|
||||
atomic_global_fence_compatibility.fence(memory_order_release);
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Only safe usage.
|
||||
std::atomic_flag guard = ATOMIC_FLAG_INIT;
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Assign.
|
||||
typedef std::atomic_flag test_type;
|
||||
test_type t1;
|
||||
test_type t2;
|
||||
t1 = t2;
|
||||
}
|
||||
// { dg-error "within this context" "" { xfail *-*-* } 39 }
|
||||
// { dg-error "is private" "" { xfail *-*-* } 89 }
|
@ -0,0 +1,41 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Copy.
|
||||
typedef std::atomic_flag test_type;
|
||||
test_type t1;
|
||||
test_type t2(t1);
|
||||
}
|
||||
// { dg-error "within this context" "" { xfail *-*-* } 38 }
|
||||
// { dg-error "is private" "" { xfail *-*-* } 88 }
|
@ -0,0 +1,37 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Default constructor.
|
||||
std::atomic_flag a;
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
#include <type_traits>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef std::atomic_flag test_type;
|
||||
VERIFY( std::has_trivial_default_constructor<test_type>::value );
|
||||
VERIFY( std::has_trivial_destructor<test_type>::value );
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
// { dg-options "-x c -lstdc++" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
atomic_flag af = ATOMIC_FLAG_INIT;
|
||||
|
||||
if (!atomic_flag_test_and_set_explicit(&af, memory_order_acquire))
|
||||
atomic_flag_clear_explicit(&af, memory_order_release);
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace std;
|
||||
atomic_flag af = ATOMIC_FLAG_INIT;
|
||||
|
||||
if (!af.test_and_set(memory_order_acquire))
|
||||
af.clear(memory_order_release);
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
// { dg-options "-x c -lstdc++" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
atomic_flag af = ATOMIC_FLAG_INIT;
|
||||
|
||||
if (!atomic_flag_test_and_set(&af))
|
||||
atomic_flag_clear(&af);
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace std;
|
||||
atomic_flag af = ATOMIC_FLAG_INIT;
|
||||
|
||||
if (!af.test_and_set())
|
||||
af.clear();
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
namespace gnu
|
||||
{
|
||||
using std::atomic_flag_test_and_set;
|
||||
using std::atomic_flag_test_and_set_explicit;
|
||||
using std::atomic_flag_clear;
|
||||
using std::atomic_flag_clear_explicit;
|
||||
using std::atomic_flag_fence;
|
||||
|
||||
using std::atomic_global_fence_compatibility;
|
||||
|
||||
// Sloppy testing for integral types (en masse).
|
||||
using std::atomic_is_lock_free;
|
||||
using std::atomic_store;
|
||||
using std::atomic_store_explicit;
|
||||
using std::atomic_load;
|
||||
using std::atomic_load_explicit;
|
||||
using std::atomic_swap;
|
||||
using std::atomic_swap_explicit;
|
||||
using std::atomic_compare_swap;
|
||||
using std::atomic_compare_swap_explicit;
|
||||
using std::atomic_fence;
|
||||
|
||||
using std::atomic_fetch_add;
|
||||
using std::atomic_fetch_add_explicit;
|
||||
using std::atomic_fetch_sub;
|
||||
using std::atomic_fetch_sub_explicit;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
namespace gnu
|
||||
{
|
||||
#ifndef ATOMIC_INTEGRAL_LOCK_FREE
|
||||
#error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef ATOMIC_ADDRESS_LOCK_FREE
|
||||
#error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef ATOMIC_FLAG_INIT
|
||||
#error "ATOMIC_FLAG_INIT_must_be_a_macro"
|
||||
#endif
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++98" }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic> // { dg-excess-errors "In file included from" }
|
||||
|
||||
// { dg-error "upcoming ISO" "" { target *-*-* } 36 }
|
||||
|
||||
|
||||
|
@ -0,0 +1,80 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <cstdatomic>
|
||||
|
||||
void test01()
|
||||
{
|
||||
using std::memory_order;
|
||||
using std::memory_order_relaxed;
|
||||
using std::memory_order_acquire;
|
||||
using std::memory_order_release;
|
||||
using std::memory_order_acq_rel;
|
||||
using std::memory_order_seq_cst;
|
||||
|
||||
using std::atomic_flag;
|
||||
|
||||
// atomics for builtins types
|
||||
using std::atomic_bool;
|
||||
using std::atomic_char;
|
||||
using std::atomic_schar;
|
||||
using std::atomic_uchar;
|
||||
using std::atomic_short;
|
||||
using std::atomic_ushort;
|
||||
using std::atomic_int;
|
||||
using std::atomic_uint;
|
||||
using std::atomic_long;
|
||||
using std::atomic_ulong;
|
||||
using std::atomic_llong;
|
||||
using std::atomic_ullong;
|
||||
using std::atomic_wchar_t;
|
||||
using std::atomic_char16_t;
|
||||
using std::atomic_char32_t;
|
||||
|
||||
// atomics for standard typedefs
|
||||
using std::atomic_int_least8_t;
|
||||
using std::atomic_uint_least8_t;
|
||||
using std::atomic_int_least16_t;
|
||||
using std::atomic_uint_least16_t;
|
||||
using std::atomic_int_least32_t;
|
||||
using std::atomic_uint_least32_t;
|
||||
using std::atomic_int_least64_t;
|
||||
using std::atomic_uint_least64_t;
|
||||
using std::atomic_int_fast8_t;
|
||||
using std::atomic_uint_fast8_t;
|
||||
using std::atomic_int_fast16_t;
|
||||
using std::atomic_uint_fast16_t;
|
||||
using std::atomic_int_fast32_t;
|
||||
using std::atomic_uint_fast32_t;
|
||||
using std::atomic_int_fast64_t;
|
||||
using std::atomic_uint_fast64_t;
|
||||
using std::atomic_intptr_t;
|
||||
using std::atomic_uintptr_t;
|
||||
using std::atomic_size_t;
|
||||
using std::atomic_ssize_t;
|
||||
using std::atomic_ptrdiff_t;
|
||||
using std::atomic_intmax_t;
|
||||
using std::atomic_uintmax_t;
|
||||
|
||||
using std::atomic_address;
|
||||
|
||||
&std::atomic_global_fence_compatibility;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
// { dg-options "-x c" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
volatile atomic_flag f;
|
||||
volatile atomic_flag* p = &f;
|
||||
memory_order m = memory_order_relaxed;
|
||||
|
||||
// For position only.
|
||||
atomic_flag_test_and_set(p);
|
||||
atomic_flag_test_and_set_explicit(p, m);
|
||||
atomic_flag_clear(p);
|
||||
atomic_flag_clear_explicit(p, m);
|
||||
atomic_flag_fence(p, m);
|
||||
|
||||
return 0;
|
||||
}
|
119
libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
Normal file
119
libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
Normal file
@ -0,0 +1,119 @@
|
||||
// { dg-options "-x c" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef ATOMIC_INTEGRAL_LOCK_FREE
|
||||
#error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef ATOMIC_ADDRESS_LOCK_FREE
|
||||
#error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef ATOMIC_FLAG_INIT
|
||||
#error "ATOMIC_FLAG_INIT_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_is_lock_free
|
||||
#error "atomic_is_lock_free_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_load
|
||||
#error "atomic_load_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_load_explicit
|
||||
#error "atomic_load_explicit_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_store_explicit
|
||||
#error "atomic_store_explicit_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_store
|
||||
#error "atomic_store_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_swap_explicit
|
||||
#error "atomic_swap_explicit_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_swap
|
||||
#error "atomic_swap_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_compare_swap
|
||||
#error "atomic_compare_swap_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_compare_swap_explicit
|
||||
#error "atomic_compare_swap_explicit_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fence
|
||||
#error "atomic_fence_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_add_explicit
|
||||
#error "atomic_fetch_add_explicit_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_add
|
||||
#error "atomic_fetch_add_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_sub_explicit
|
||||
#error "atomic_fetch_sub_explicit_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_sub
|
||||
#error "atomic_fetch_sub_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_and_explicit
|
||||
#error "atomic_fetch_and_explicit_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_and
|
||||
#error "atomic_fetch_and_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_or_explicit
|
||||
#error "atomic_fetch_or_explicit_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_or
|
||||
#error "atomic_fetch_or_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_xor_explicit
|
||||
#error "atomic_fetch_xor_explicit_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_xor
|
||||
#error "atomic_fetch_xor_must_be_a_macro"
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
// { dg-options "-x c" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 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.
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
void test01()
|
||||
{
|
||||
typedef memory_order t_01;
|
||||
memory_order t_02 = memory_order_relaxed;
|
||||
memory_order t_03 = memory_order_acquire;
|
||||
memory_order t_04 = memory_order_release;
|
||||
memory_order t_05 = memory_order_acq_rel;
|
||||
memory_order t_06 = memory_order_seq_cst;
|
||||
|
||||
typedef atomic_flag t_07;
|
||||
|
||||
// atomics for builtins types
|
||||
typedef atomic_bool t_08;
|
||||
typedef atomic_char t_09;
|
||||
typedef atomic_schar t_10;
|
||||
typedef atomic_uchar t_11;
|
||||
typedef atomic_short t_12;
|
||||
typedef atomic_ushort t_13;
|
||||
typedef atomic_int t_14;
|
||||
typedef atomic_uint t_15;
|
||||
typedef atomic_long t_16;
|
||||
typedef atomic_ulong t_17;
|
||||
typedef atomic_llong t_18;
|
||||
typedef atomic_ullong t_19;
|
||||
typedef atomic_wchar_t t_20;
|
||||
typedef atomic_char16_t t_21;
|
||||
typedef atomic_char32_t t_22;
|
||||
|
||||
// atomics for standard typedefs
|
||||
typedef atomic_int_least8_t t_23;
|
||||
typedef atomic_uint_least8_t t_24;
|
||||
typedef atomic_int_least16_t t_25;
|
||||
typedef atomic_uint_least16_t t_26;
|
||||
typedef atomic_int_least32_t t_27;
|
||||
typedef atomic_uint_least32_t t_28;
|
||||
typedef atomic_int_least64_t t_29;
|
||||
typedef atomic_uint_least64_t t_30;
|
||||
typedef atomic_int_fast8_t t_31;
|
||||
typedef atomic_uint_fast8_t t_32;
|
||||
typedef atomic_int_fast16_t t_33;
|
||||
typedef atomic_uint_fast16_t t_34;
|
||||
typedef atomic_int_fast32_t t_35;
|
||||
typedef atomic_uint_fast32_t t_36;
|
||||
typedef atomic_int_fast64_t t_37;
|
||||
typedef atomic_uint_fast64_t t_38;
|
||||
typedef atomic_intptr_t t_39;
|
||||
typedef atomic_uintptr_t t_40;
|
||||
typedef atomic_size_t t_41;
|
||||
typedef atomic_ssize_t t_42;
|
||||
typedef atomic_ptrdiff_t t_43;
|
||||
typedef atomic_intmax_t t_44;
|
||||
typedef atomic_uintmax_t t_45;
|
||||
|
||||
typedef atomic_address t_46;
|
||||
|
||||
&atomic_global_fence_compatibility;
|
||||
}
|
@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
|
||||
$(top_srcdir)/../config/lib-prefix.m4 \
|
||||
$(top_srcdir)/../config/multi.m4 \
|
||||
$(top_srcdir)/../config/no-executables.m4 \
|
||||
$(top_srcdir)/../config/proginstall.m4 \
|
||||
$(top_srcdir)/../config/unwind_ipinfo.m4 \
|
||||
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
|
||||
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
|
||||
|
@ -443,12 +443,13 @@ proc v3_target_compile_as_c { source dest type options } {
|
||||
set includestarget "${includesbase}/${machine}"
|
||||
set cc_final [concat $cc_final "-I$includesbase -I$includestarget"]
|
||||
|
||||
set libsup "${comp_base_dir}/lib"
|
||||
set libdir "-L${comp_base_dir}/lib"
|
||||
} else {
|
||||
set libsup "${blddir}/libsupc++/.libs"
|
||||
set libdir "-L${blddir}/libsupc++/.libs"
|
||||
set libdir [concat $libdir "-L${blddir}/src/.libs"]
|
||||
}
|
||||
|
||||
set cc_final [concat $cc_final "-L$libsup"]
|
||||
set cc_final [concat $cc_final "$libdir"]
|
||||
|
||||
lappend options "compiler=$cc_final"
|
||||
lappend options "timeout=600"
|
||||
|
@ -53,6 +53,10 @@
|
||||
#include <tr1/unordered_map>
|
||||
#include <tr1/unordered_set>
|
||||
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
#include <cstdatomic>
|
||||
#endif
|
||||
|
||||
namespace __gnu_test
|
||||
{
|
||||
using __gnu_cxx::typelist::node;
|
||||
@ -260,6 +264,88 @@ namespace __gnu_test
|
||||
typedef typename append<a1, a2>::type type;
|
||||
};
|
||||
|
||||
// A typelist of all integral types.
|
||||
struct integral_types
|
||||
{
|
||||
typedef bool a1;
|
||||
typedef char a2;
|
||||
typedef signed char a3;
|
||||
typedef unsigned char a4;
|
||||
typedef short a5;
|
||||
typedef unsigned short a6;
|
||||
typedef int a7;
|
||||
typedef unsigned int a8;
|
||||
typedef long a9;
|
||||
typedef unsigned long a10;
|
||||
typedef long long a11;
|
||||
typedef unsigned long long a12;
|
||||
typedef wchar_t a13;
|
||||
// typedef char16_t a14;
|
||||
// typedef char16_t a15;
|
||||
|
||||
typedef node<_GLIBCXX_TYPELIST_CHAIN13(a1, a2, a3, a4, a5, a6, a7, a8, a9,
|
||||
a10, a11, a12, a13)> type;
|
||||
};
|
||||
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
template<typename Tp>
|
||||
struct atomics
|
||||
{
|
||||
typedef Tp value_type;
|
||||
typedef std::atomic<value_type> type;
|
||||
};
|
||||
|
||||
typedef transform<integral_types::type, atomics>::type atomics_tl;
|
||||
#endif
|
||||
|
||||
// Generator to test assignment operator.
|
||||
struct assignable
|
||||
{
|
||||
template<typename _T>
|
||||
void
|
||||
operator()()
|
||||
{
|
||||
_T v1;
|
||||
_T v2;
|
||||
v1 = v2;
|
||||
}
|
||||
};
|
||||
|
||||
// Generator to test default constructor.
|
||||
struct default_constructible
|
||||
{
|
||||
template<typename _T>
|
||||
void
|
||||
operator()()
|
||||
{
|
||||
_T v;
|
||||
}
|
||||
};
|
||||
|
||||
// Generator to test copy constructor.
|
||||
struct copy_constructible
|
||||
{
|
||||
template<typename _T>
|
||||
void
|
||||
operator()()
|
||||
{
|
||||
_T v1;
|
||||
_T v2(v1);
|
||||
}
|
||||
};
|
||||
|
||||
// Generator to test explicit value constructor.
|
||||
struct explicit_value_constructible
|
||||
{
|
||||
template<typename _Ttype, typename _Tvalue>
|
||||
void
|
||||
operator()()
|
||||
{
|
||||
_Tvalue a;
|
||||
_Ttype v(a);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace __gnu_test
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user