From d466a7e21c61360550e04a66dcd2cacd5172d672 Mon Sep 17 00:00:00 2001
From: Benjamin Kosnik <bkoz@gcc.gnu.org>
Date: Thu, 10 Apr 2008 20:26:45 +0000
Subject: [PATCH] [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
---
 libstdc++-v3/ChangeLog                        |   89 +
 libstdc++-v3/Makefile.in                      |    1 +
 libstdc++-v3/acinclude.m4                     |   40 +
 libstdc++-v3/config.h.in                      |    3 +
 libstdc++-v3/config/abi/pre/gnu.ver           |   88 +-
 libstdc++-v3/configure                        |  102 +-
 libstdc++-v3/configure.ac                     |    1 +
 libstdc++-v3/doc/Makefile.in                  |    1 +
 libstdc++-v3/include/Makefile.am              |    4 +-
 libstdc++-v3/include/Makefile.in              |    5 +-
 libstdc++-v3/include/bits/c++config           |   16 +-
 .../include/c_compatibility/stdatomic.h       |  387 ++
 libstdc++-v3/include/c_global/cstdatomic      | 4100 +++++++++++++++++
 libstdc++-v3/include/ext/typelist.h           |  109 +-
 libstdc++-v3/libmath/Makefile.in              |    1 +
 libstdc++-v3/libsupc++/Makefile.in            |    1 +
 libstdc++-v3/po/Makefile.in                   |    1 +
 libstdc++-v3/src/Makefile.am                  |    6 +
 libstdc++-v3/src/Makefile.in                  |   57 +-
 libstdc++-v3/src/atomic.cc                    |  116 +
 .../testsuite/17_intro/headers/c++200x/all.cc |    2 +
 .../29_atomics/atomic/cons/assign_neg.cc      |   55 +
 .../29_atomics/atomic/cons/copy_neg.cc        |   55 +
 .../29_atomics/atomic/cons/default.cc         |   38 +
 .../29_atomics/atomic/cons/explicit_value.cc  |   39 +
 .../requirements/explicit_instantiation/1.cc  |   37 +
 .../atomic_address/cons/aggregate.cc          |   37 +
 .../atomic_address/cons/assign_neg.cc         |   42 +
 .../atomic_address/cons/copy_neg.cc           |   41 +
 .../29_atomics/atomic_address/cons/default.cc |   37 +
 .../atomic_address/cons/explicit_value.cc     |   38 +
 .../atomic_global_fence_compatibility.cc      |   39 +
 .../29_atomics/atomic_flag/cons/aggregate.cc  |   38 +
 .../29_atomics/atomic_flag/cons/assign_neg.cc |   42 +
 .../29_atomics/atomic_flag/cons/copy_neg.cc   |   41 +
 .../29_atomics/atomic_flag/cons/default.cc    |   37 +
 .../requirements/standard_layout.cc           |   43 +
 .../atomic_flag/test_and_set/explicit.c       |   40 +
 .../atomic_flag/test_and_set/explicit.cc      |   41 +
 .../atomic_flag/test_and_set/implicit.c       |   40 +
 .../atomic_flag/test_and_set/implicit.cc      |   41 +
 .../headers/cstdatomic/functions_std_c++0x.cc |   50 +
 .../29_atomics/headers/cstdatomic/macros.cc   |   37 +
 .../headers/cstdatomic/std_c++0x_neg.cc       |   27 +
 .../headers/cstdatomic/types_std_c++0x.cc     |   80 +
 .../headers/stdatomic.h/functions.c           |   38 +
 .../29_atomics/headers/stdatomic.h/macros.c   |  119 +
 .../29_atomics/headers/stdatomic.h/types.c    |   80 +
 libstdc++-v3/testsuite/Makefile.in            |    1 +
 libstdc++-v3/testsuite/lib/libstdc++.exp      |    7 +-
 .../testsuite/util/testsuite_common_types.h   |   86 +
 51 files changed, 6402 insertions(+), 74 deletions(-)
 create mode 100644 libstdc++-v3/include/c_compatibility/stdatomic.h
 create mode 100644 libstdc++-v3/include/c_global/cstdatomic
 create mode 100644 libstdc++-v3/src/atomic.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c
 create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
 create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 27bf89d22fc9..3877bc30ac12 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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.
diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
index 76397b3b914f..146704405ff9 100644
--- a/libstdc++-v3/Makefile.in
+++ b/libstdc++-v3/Makefile.in
@@ -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 \
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 92c70b290795..e1712b77d804 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.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
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 39ce4a9305c1..52acd2c2f0d6 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -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
 
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 1d35bfbbd37d..3e5a9240513d 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -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;
 
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 9a6ec5256bba..6e6e1996e62d 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -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.
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 1760aebdf0db..1930189ab5d8 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -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
diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in
index b40e51059af1..da58aa6abf07 100644
--- a/libstdc++-v3/doc/Makefile.in
+++ b/libstdc++-v3/doc/Makefile.in
@@ -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 \
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 68e8e35b3ded..0d002273c57c 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -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
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 94038f8435f5..9bd5091f132a 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -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 = \
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index d42cb9feb471..e38cfe051843 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -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
 
diff --git a/libstdc++-v3/include/c_compatibility/stdatomic.h b/libstdc++-v3/include/c_compatibility/stdatomic.h
new file mode 100644
index 000000000000..e5f7dcfe6c12
--- /dev/null
+++ b/libstdc++-v3/include/c_compatibility/stdatomic.h
@@ -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
diff --git a/libstdc++-v3/include/c_global/cstdatomic b/libstdc++-v3/include/c_global/cstdatomic
new file mode 100644
index 000000000000..22fde89603b5
--- /dev/null
+++ b/libstdc++-v3/include/c_global/cstdatomic
@@ -0,0 +1,4100 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file cstdatomic
+ *  This is a Standard C++ Library file.  You should @c #include this file
+ *  in your programs, rather than any of the "*.h" implementation files.
+ *
+ *  This is the C++ version of the Standard C Library header @c stdatomic.h,
+ *  and its contents are (mostly) the same as that header, but are all
+ *  contained in the namespace @c std (except for names which are defined
+ *  as macros in C).
+ */
+
+// Based on "C++ Atomic Types and Operations" by Hans Boehm and Lawrence Crowl.
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html
+
+#ifndef _GLIBCXX_STDATOMIC
+#define _GLIBCXX_STDATOMIC 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#include <stdatomic.h>
+#include <cstddef>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+  // Can either subclass or encapsulate "C" functionality, and here
+  // encapsulating works with C++2003's version of POD and so is
+  // portable across C++2003/200x. 
+  // Both end up being sub-optimal in terms of a constructor
+  // initialization list, but oh well.
+
+  /// atomic_flag
+  struct atomic_flag 
+  {
+    __atomic_flag_base _M_base;
+
+    bool 
+    test_and_set(memory_order __x = memory_order_seq_cst) volatile
+    { return atomic_flag_test_and_set_explicit(this, __x); }
+
+    void 
+    clear(memory_order __x = memory_order_seq_cst) volatile
+    { atomic_flag_clear_explicit(this, __x); }
+
+    void 
+    fence(memory_order __x) const volatile
+    { atomic_flag_fence(this, __x); }
+
+#if _GLIBCXX_USE_STANDARD_LAYOUT
+    // Add in non-trivial default constructor that correctly
+    // initializes member "as if" by ATOMIC_FLAG_INIT.
+    atomic_flag() { _M_base._M_b = false; }
+
+  private:
+    atomic_flag(const atomic_flag&);
+    atomic_flag& operator=(const atomic_flag&);
+#endif
+  };
+
+  /// 29.4.2, address types
+  typedef struct atomic_address
+  {
+    __atomic_address_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(void*, memory_order = memory_order_seq_cst) volatile;
+
+    void* 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    void* 
+    swap(void*, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(void*&, void*, memory_order, memory_order) volatile;
+
+    bool 
+    compare_swap(void*&, void*, memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    void* 
+    fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+
+    void* 
+    fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+
+    void* 
+    operator=(void* __v) volatile
+    { store(__v); return __v; }
+
+    void* 
+    operator+=(ptrdiff_t __v) volatile
+    { return fetch_add(__v); }
+
+    void* 
+    operator-=(ptrdiff_t __v) volatile
+    { return fetch_sub(__v); }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_address*, void*, memory_order);
+
+    friend void* 
+    atomic_load_explicit(volatile atomic_address*, memory_order);
+
+    friend void* 
+    atomic_swap_explicit(volatile atomic_address*, void*, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_address*, void**, void*, 
+				 memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_address*, memory_order);
+
+    friend void* 
+    atomic_fetch_add_explicit(volatile atomic_address*, ptrdiff_t, 
+			      memory_order);
+
+    friend void* 
+    atomic_fetch_sub_explicit(volatile atomic_address*, ptrdiff_t, 
+			      memory_order);
+
+    atomic_address() { }
+
+    explicit atomic_address(void* __v)
+    { _M_base._M_i = __v; }
+
+  private:
+    atomic_address(const atomic_address&);
+    atomic_address& operator=(const atomic_address &);
+  };
+
+
+  // 29.4.1 atomic integral types
+  // For each of the integral types, define atomic_[integral type] struct
+  // 
+  // atomic_bool     bool
+  // atomic_char     char
+  // atomic_schar    signed char
+  // atomic_uchar    unsigned char
+  // atomic_short    short
+  // atomic_ushort   unsigned short
+  // atomic_int      int
+  // atomic_uint     unsigned int
+  // atomic_long     long
+  // atomic_ulong    unsigned long
+  // atomic_llong    long long
+  // atomic_ullong   unsigned long long
+  // atomic_char16_t char16_t
+  // atomic_char32_t char32_t
+  // atomic_wchar_t  wchar_t
+
+  /// atomic_bool
+  struct atomic_bool
+  {
+    __atomic_bool_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(bool, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    swap(bool, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(bool&, bool, memory_order, memory_order) volatile;
+
+    bool 
+    compare_swap(bool&, bool, memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    bool
+    operator=(bool __v) volatile { store(__v); return __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_bool*, bool, memory_order);
+
+    friend bool 
+    atomic_load_explicit(volatile atomic_bool*, memory_order);
+
+    friend bool 
+    atomic_swap_explicit(volatile atomic_bool*, bool, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_bool*, bool*, bool,
+				 memory_order, memory_order);
+    friend void 
+    atomic_fence(const volatile atomic_bool*, memory_order);
+
+    atomic_bool() { }
+
+    explicit atomic_bool(bool __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_bool(const atomic_bool&);
+    atomic_bool& operator=(const atomic_bool&);
+  };
+
+  /// atomic_char
+  struct atomic_char
+  {
+    __atomic_char_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(char, memory_order = memory_order_seq_cst) volatile;
+
+    char 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    char 
+    swap(char, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(char&, char, memory_order, memory_order) volatile;
+
+    bool 
+    compare_swap(char&, char, memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    char 
+    fetch_add(char, memory_order = memory_order_seq_cst) volatile;
+
+    char 
+    fetch_sub(char, memory_order = memory_order_seq_cst) volatile;
+
+    char 
+    fetch_and(char, memory_order = memory_order_seq_cst) volatile;
+
+    char 
+    fetch_or(char, memory_order = memory_order_seq_cst) volatile;
+
+    char 
+    fetch_xor(char, memory_order = memory_order_seq_cst) volatile;
+
+    char 
+    operator=(char __v) volatile { store(__v); return __v; }
+
+    char 
+    operator++(int) volatile { return fetch_add(1); }
+
+    char 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    char 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    char 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    char 
+    operator+=(char __v) volatile { return fetch_add(__v) + __v; }
+
+    char 
+    operator-=(char __v) volatile { return fetch_sub(__v) - __v; }
+
+    char 
+    operator&=(char __v) volatile { return fetch_and(__v) & __v; }
+
+    char 
+    operator|=(char __v) volatile { return fetch_or(__v) | __v; }
+
+    char 
+    operator^=(char __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_char*, char, memory_order);
+
+    friend char 
+    atomic_load_explicit(volatile atomic_char*, memory_order);
+
+    friend char 
+    atomic_swap_explicit(volatile atomic_char*, char, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_char*, char*, char, 
+				 memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_char*, memory_order);
+
+    friend char 
+    atomic_fetch_add_explicit(volatile atomic_char*, char, memory_order);
+
+    friend char 
+    atomic_fetch_sub_explicit(volatile atomic_char*, char, memory_order);
+
+    friend char 
+    atomic_fetch_and_explicit(volatile atomic_char*, char, memory_order);
+
+    friend char 
+    atomic_fetch_or_explicit( volatile atomic_char*, char, memory_order);
+
+    friend char 
+    atomic_fetch_xor_explicit(volatile atomic_char*, char, memory_order);
+
+    atomic_char() { }
+
+    atomic_char(char __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_char(const atomic_char&);
+    atomic_char& operator=(const atomic_char&);
+  };
+
+  /// atomic_schar
+  struct atomic_schar
+  {
+    __atomic_schar_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(signed char, memory_order = memory_order_seq_cst) volatile;
+
+    signed char 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    signed char 
+    swap(signed char, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(signed char&, signed char, memory_order, 
+		 memory_order) volatile;
+
+    bool 
+    compare_swap(signed char&, signed char, 
+		 memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    signed char 
+    fetch_add(signed char, memory_order = memory_order_seq_cst) volatile;
+
+    signed char 
+    fetch_sub(signed char, memory_order = memory_order_seq_cst) volatile;
+
+    signed char 
+    fetch_and(signed char, memory_order = memory_order_seq_cst) volatile;
+
+    signed char 
+    fetch_or(signed char, memory_order = memory_order_seq_cst) volatile;
+
+    signed char 
+    fetch_xor(signed char, memory_order = memory_order_seq_cst) volatile;
+
+    signed char 
+    operator=(signed char __v) volatile { store(__v); return __v; }
+
+    signed char 
+    operator++(int) volatile { return fetch_add(1); }
+
+    signed char 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    signed char 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    signed char 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    signed char 
+    operator+=(signed char __v) volatile { return fetch_add(__v) + __v; }
+
+    signed char 
+    operator-=(signed char __v) volatile { return fetch_sub(__v) - __v; }
+
+    signed char 
+    operator&=(signed char __v) volatile { return fetch_and(__v) & __v; }
+
+    signed char 
+    operator|=(signed char __v) volatile { return fetch_or(__v) | __v; }
+
+    signed char 
+    operator^=(signed char __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_schar*, signed char, memory_order);
+
+    friend signed char 
+    atomic_load_explicit(volatile atomic_schar*, memory_order);
+
+    friend signed char 
+    atomic_swap_explicit(volatile atomic_schar*, signed char, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_schar*, signed char*, 
+				 signed char, memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_schar*, memory_order);
+
+    friend signed char 
+    atomic_fetch_add_explicit(volatile atomic_schar*, 
+			      signed char, memory_order);
+
+    friend signed char 
+    atomic_fetch_sub_explicit(volatile atomic_schar*, signed char, 
+			      memory_order);
+
+    friend signed char 
+    atomic_fetch_and_explicit(volatile atomic_schar*, signed char, 
+			      memory_order);
+
+    friend signed char 
+    atomic_fetch_or_explicit(volatile atomic_schar*, signed char, 
+			      memory_order);
+
+    friend signed char 
+    atomic_fetch_xor_explicit(volatile atomic_schar*, signed char, 
+			      memory_order);
+
+    atomic_schar() { }
+
+    atomic_schar(signed char __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_schar(const atomic_schar&);
+    atomic_schar& operator=(const atomic_schar&);
+  };
+
+  /// atomic_uchar
+  struct atomic_uchar
+  {
+    __atomic_uchar_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(unsigned char, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned char 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    unsigned char 
+    swap(unsigned char, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(unsigned char&, unsigned char, memory_order, 
+		 memory_order) volatile;
+
+    bool 
+    compare_swap(unsigned char&, unsigned char, 
+		 memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    unsigned char 
+    fetch_add(unsigned char, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned char 
+    fetch_sub(unsigned char, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned char 
+    fetch_and(unsigned char, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned char 
+    fetch_or(unsigned char, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned char 
+    fetch_xor(unsigned char, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned char 
+    operator=(unsigned char __v) volatile { store(__v); return __v; }
+
+    unsigned char 
+    operator++(int) volatile { return fetch_add(1); }
+
+    unsigned char 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    unsigned char 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    unsigned char 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    unsigned char 
+    operator+=(unsigned char __v) volatile { return fetch_add(__v) + __v; }
+
+    unsigned char 
+    operator-=(unsigned char __v) volatile { return fetch_sub(__v) - __v; }
+
+    unsigned char 
+    operator&=(unsigned char __v) volatile { return fetch_and(__v) & __v; }
+
+    unsigned char 
+    operator|=(unsigned char __v) volatile { return fetch_or(__v) | __v; }
+
+    unsigned char 
+    operator^=(unsigned char __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_uchar*, unsigned char, memory_order);
+
+    friend unsigned char 
+    atomic_load_explicit(volatile atomic_uchar*, memory_order);
+
+    friend unsigned char 
+    atomic_swap_explicit(volatile atomic_uchar*, unsigned char, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_uchar*, unsigned char*, 
+				 unsigned char, memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_uchar*, memory_order);
+
+    friend unsigned char 
+    atomic_fetch_add_explicit(volatile atomic_uchar*, unsigned char, 
+			      memory_order);
+
+    friend unsigned char 
+    atomic_fetch_sub_explicit(volatile atomic_uchar*, unsigned char, 
+			      memory_order);
+
+    friend unsigned char 
+    atomic_fetch_and_explicit(volatile atomic_uchar*, 
+			      unsigned char, memory_order);
+
+    friend unsigned char 
+    atomic_fetch_or_explicit( volatile atomic_uchar*, unsigned char, 
+			      memory_order);
+
+    friend unsigned char 
+    atomic_fetch_xor_explicit(volatile atomic_uchar*, unsigned char, 
+			      memory_order);
+
+    atomic_uchar() { }
+
+    atomic_uchar(unsigned char __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_uchar(const atomic_uchar&);
+    atomic_uchar& operator=(const atomic_uchar&);
+  };
+
+
+  /// atomic_short
+  struct atomic_short
+  {
+    __atomic_short_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(short, memory_order = memory_order_seq_cst) volatile;
+
+    short 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    short 
+    swap(short, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(short&, short, memory_order, memory_order) volatile;
+
+    bool 
+    compare_swap(short&, short, memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+    
+    short 
+    fetch_add(short, memory_order = memory_order_seq_cst) volatile;
+
+    short 
+    fetch_sub(short, memory_order = memory_order_seq_cst) volatile;
+
+    short 
+    fetch_and(short, memory_order = memory_order_seq_cst) volatile;
+
+    short 
+    fetch_or(short, memory_order = memory_order_seq_cst) volatile;
+
+    short 
+    fetch_xor(short, memory_order = memory_order_seq_cst) volatile;
+
+    short 
+    operator=(short __v) volatile { store(__v); return __v; }
+
+    short 
+    operator++(int) volatile { return fetch_add(1); }
+
+    short 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    short 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    short 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    short 
+    operator+=(short __v) volatile { return fetch_add(__v) + __v; }
+
+    short 
+    operator-=(short __v) volatile { return fetch_sub(__v) - __v; }
+
+    short 
+    operator&=(short __v) volatile { return fetch_and(__v) & __v; }
+
+    short 
+    operator|=(short __v) volatile { return fetch_or(__v) | __v; }
+
+    short 
+    operator^=(short __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_short*, short, memory_order);
+
+    friend short 
+    atomic_load_explicit(volatile atomic_short*, memory_order);
+
+    friend short 
+    atomic_swap_explicit(volatile atomic_short*, short, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_short*, short*, short, 
+				 memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_short*, memory_order);
+
+    friend short 
+    atomic_fetch_add_explicit(volatile atomic_short*, short, memory_order);
+
+    friend short 
+    atomic_fetch_sub_explicit(volatile atomic_short*, short, memory_order);
+
+    friend short 
+    atomic_fetch_and_explicit(volatile atomic_short*, short, memory_order);
+
+    friend short 
+    atomic_fetch_or_explicit( volatile atomic_short*, short, memory_order);
+
+    friend short 
+    atomic_fetch_xor_explicit(volatile atomic_short*, short, memory_order);
+
+    atomic_short() { }
+
+    atomic_short(short __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_short(const atomic_short&);
+    atomic_short& operator=(const atomic_short&);
+  };
+
+  /// atomic_ushort
+  struct atomic_ushort
+  {
+    __atomic_ushort_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(unsigned short, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned short 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    unsigned short 
+    swap(unsigned short, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(unsigned short&, unsigned short, memory_order, 
+		 memory_order) volatile;
+
+    bool 
+    compare_swap(unsigned short&, unsigned short, 
+		 memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    unsigned short 
+    fetch_add(unsigned short, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned short 
+    fetch_sub(unsigned short, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned short 
+    fetch_and(unsigned short, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned short 
+    fetch_or(unsigned short, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned short 
+    fetch_xor(unsigned short, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned short 
+    operator=(unsigned short __v) volatile { store(__v); return __v; }
+
+    unsigned short 
+    operator++(int) volatile { return fetch_add(1); }
+
+    unsigned short 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    unsigned short 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    unsigned short 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    unsigned short 
+    operator+=(unsigned short __v) volatile { return fetch_add(__v) + __v; }
+
+    unsigned short 
+    operator-=(unsigned short __v) volatile { return fetch_sub(__v) - __v; }
+
+    unsigned short 
+    operator&=(unsigned short __v) volatile { return fetch_and(__v) & __v; }
+
+    unsigned short 
+    operator|=(unsigned short __v) volatile { return fetch_or(__v) | __v; }
+
+    unsigned short 
+    operator^=(unsigned short __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_ushort*, unsigned short, 
+			  memory_order);
+
+    friend unsigned short 
+    atomic_load_explicit(volatile atomic_ushort*, memory_order);
+
+    friend unsigned short 
+    atomic_swap_explicit(volatile atomic_ushort*, unsigned short, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_ushort*, unsigned short*, 
+				 unsigned short, memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_ushort*, memory_order);
+
+    friend unsigned short 
+    atomic_fetch_add_explicit(volatile atomic_ushort*, unsigned short, 
+			      memory_order);
+
+    friend unsigned short 
+    atomic_fetch_sub_explicit(volatile atomic_ushort*, unsigned short, 
+			      memory_order);
+
+    friend unsigned short 
+    atomic_fetch_and_explicit(volatile atomic_ushort*, unsigned short, 
+			      memory_order);
+
+    friend unsigned short 
+    atomic_fetch_or_explicit( volatile atomic_ushort*, unsigned short, 
+			      memory_order);
+
+    friend unsigned short 
+    atomic_fetch_xor_explicit(volatile atomic_ushort*, unsigned short, 
+			      memory_order);
+
+    atomic_ushort() { }
+
+    atomic_ushort(unsigned short __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_ushort(const atomic_ushort&);
+    atomic_ushort& operator=(const atomic_ushort&);
+  };
+
+  /// atomic_int
+  struct atomic_int
+  {
+    __atomic_int_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(int, memory_order = memory_order_seq_cst) volatile;
+
+    int 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    int 
+    swap(int, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(int&, int, memory_order, memory_order) volatile;
+
+    bool 
+    compare_swap(int&, int, memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    int 
+    fetch_add(int, memory_order = memory_order_seq_cst) volatile;
+
+    int 
+    fetch_sub(int, memory_order = memory_order_seq_cst) volatile;
+
+    int 
+    fetch_and(int, memory_order = memory_order_seq_cst) volatile;
+
+    int 
+    fetch_or(int, memory_order = memory_order_seq_cst) volatile;
+
+    int 
+    fetch_xor(int, memory_order = memory_order_seq_cst) volatile;
+
+    int 
+    operator=(int __v) volatile { store(__v); return __v; }
+
+    int 
+    operator++(int) volatile { return fetch_add(1); }
+
+    int 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    int 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    int 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    int 
+    operator+=(int __v) volatile { return fetch_add(__v) + __v; }
+
+    int 
+    operator-=(int __v) volatile { return fetch_sub(__v) - __v; }
+
+    int 
+    operator&=(int __v) volatile { return fetch_and(__v) & __v; }
+
+    int 
+    operator|=(int __v) volatile { return fetch_or(__v) | __v; }
+
+    int 
+    operator^=(int __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_int*, int, memory_order);
+
+    friend int 
+    atomic_load_explicit(volatile atomic_int*, memory_order);
+
+    friend int 
+    atomic_swap_explicit(volatile atomic_int*, int, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_int*, int*, int, 
+				 memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_int*, memory_order);
+
+    friend int 
+    atomic_fetch_add_explicit(volatile atomic_int*, int, memory_order);
+
+    friend int 
+    atomic_fetch_sub_explicit(volatile atomic_int*, int, memory_order);
+
+    friend int 
+    atomic_fetch_and_explicit(volatile atomic_int*, int, memory_order);
+
+    friend int 
+    atomic_fetch_or_explicit( volatile atomic_int*, int, memory_order);
+
+    friend int 
+    atomic_fetch_xor_explicit(volatile atomic_int*, int, memory_order);
+
+    atomic_int() { }
+
+    atomic_int(int __v) { _M_base._M_i = __v; }
+    
+  private:
+    atomic_int(const atomic_int&);
+    atomic_int& operator=(const atomic_int&);
+  };
+
+  /// atomic_uint
+  struct atomic_uint
+  {
+    __atomic_uint_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(unsigned int, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned int 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    unsigned int 
+    swap(unsigned int, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(unsigned int&, unsigned int, memory_order, 
+		 memory_order) volatile;
+
+    bool 
+    compare_swap(unsigned int&, unsigned int, 
+		 memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    unsigned int 
+    fetch_add(unsigned int, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned int 
+    fetch_sub(unsigned int, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned int 
+    fetch_and(unsigned int, memory_order = memory_order_seq_cst) volatile;
+ 
+    unsigned int 
+    fetch_or(unsigned int, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned int 
+    fetch_xor(unsigned int, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned int 
+    operator=(unsigned int __v) volatile { store(__v); return __v; }
+
+    unsigned int 
+    operator++(int) volatile { return fetch_add(1); }
+
+    unsigned int 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    unsigned int 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    unsigned int 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    unsigned int 
+    operator+=(unsigned int __v) volatile { return fetch_add(__v) + __v; }
+
+    unsigned int 
+    operator-=(unsigned int __v) volatile { return fetch_sub(__v) - __v; }
+
+    unsigned int 
+    operator&=(unsigned int __v) volatile { return fetch_and(__v) & __v; }
+
+    unsigned int 
+    operator|=(unsigned int __v) volatile { return fetch_or(__v) | __v; }
+
+    unsigned int 
+    operator^=(unsigned int __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_uint*, unsigned int, memory_order);
+
+    friend unsigned int 
+    atomic_load_explicit(volatile atomic_uint*, memory_order);
+
+    friend unsigned int 
+    atomic_swap_explicit(volatile atomic_uint*, unsigned int, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_uint*, unsigned int*, 
+				 unsigned int, memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_uint*, memory_order);
+
+    friend unsigned int 
+    atomic_fetch_add_explicit(volatile atomic_uint*, unsigned int, 
+			      memory_order);
+
+    friend unsigned int 
+    atomic_fetch_sub_explicit(volatile atomic_uint*, unsigned int, 
+			      memory_order);
+
+    friend unsigned int 
+    atomic_fetch_and_explicit(volatile atomic_uint*, unsigned int, 
+			      memory_order);
+
+    friend unsigned int 
+    atomic_fetch_or_explicit( volatile atomic_uint*, unsigned int, 
+			      memory_order);
+
+    friend unsigned int 
+    atomic_fetch_xor_explicit(volatile atomic_uint*, unsigned int, 
+			      memory_order);
+
+    atomic_uint() { }
+
+    atomic_uint(unsigned int __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_uint(const atomic_uint&);
+    atomic_uint& operator=(const atomic_uint&);
+  };
+
+  /// atomic_long
+  struct atomic_long
+  {
+    __atomic_long_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(long, memory_order = memory_order_seq_cst) volatile;
+
+    long 
+    load(memory_order = memory_order_seq_cst) volatile;
+    
+    long 
+    swap(long, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(long&, long, memory_order, memory_order) volatile;
+
+    bool 
+    compare_swap(long&, long, memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    long 
+    fetch_add(long, memory_order = memory_order_seq_cst) volatile;
+
+    long 
+    fetch_sub(long, memory_order = memory_order_seq_cst) volatile;
+
+    long 
+    fetch_and(long, memory_order = memory_order_seq_cst) volatile;
+
+    long 
+    fetch_or(long, memory_order = memory_order_seq_cst) volatile;
+
+    long 
+    fetch_xor(long, memory_order = memory_order_seq_cst) volatile;
+
+    long 
+    operator=(long __v) volatile { store(__v); return __v; }
+
+    long 
+    operator++(int) volatile { return fetch_add(1); }
+
+    long 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    long 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    long 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    long 
+    operator+=(long __v) volatile { return fetch_add(__v) + __v; }
+
+    long 
+    operator-=(long __v) volatile { return fetch_sub(__v) - __v; }
+
+    long 
+    operator&=(long __v) volatile { return fetch_and(__v) & __v; }
+
+    long 
+    operator|=(long __v) volatile { return fetch_or(__v) | __v; }
+
+    long 
+    operator^=(long __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_long*, long, memory_order);
+
+    friend long 
+    atomic_load_explicit(volatile atomic_long*, memory_order);
+
+    friend long 
+    atomic_swap_explicit(volatile atomic_long*, long, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_long*, long*, long, 
+				 memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_long*, memory_order);
+
+    friend long 
+    atomic_fetch_add_explicit(volatile atomic_long*, long, memory_order);
+
+    friend long 
+    atomic_fetch_sub_explicit(volatile atomic_long*, long, memory_order);
+
+    friend long 
+    atomic_fetch_and_explicit(volatile atomic_long*, long, memory_order);
+
+    friend long 
+    atomic_fetch_or_explicit( volatile atomic_long*, long, memory_order);
+
+    friend long 
+    atomic_fetch_xor_explicit(volatile atomic_long*, long, memory_order);
+
+    atomic_long() { }
+
+    atomic_long(long __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_long(const atomic_long&);
+    atomic_long& operator=(const atomic_long&);
+  };
+
+  /// atomic_ulong
+  struct atomic_ulong
+  {
+    __atomic_ulong_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(unsigned long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long 
+    swap(unsigned long, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(unsigned long&, unsigned long, memory_order, 
+		 memory_order) volatile;
+
+    bool 
+    compare_swap(unsigned long&, unsigned long, 
+		 memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    unsigned long 
+    fetch_add(unsigned long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long 
+    fetch_sub(unsigned long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long 
+    fetch_and(unsigned long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long 
+    fetch_or(unsigned long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long 
+    fetch_xor(unsigned long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long 
+    operator=(unsigned long __v) volatile { store(__v); return __v; }
+
+    unsigned long 
+    operator++(int) volatile { return fetch_add(1); }
+
+    unsigned long 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    unsigned long 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    unsigned long 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    unsigned long 
+    operator+=(unsigned long __v) volatile { return fetch_add(__v) + __v; }
+
+    unsigned long 
+    operator-=(unsigned long __v) volatile { return fetch_sub(__v) - __v; }
+
+    unsigned long 
+    operator&=(unsigned long __v) volatile { return fetch_and(__v) & __v; }
+
+    unsigned long 
+    operator|=(unsigned long __v) volatile { return fetch_or(__v) | __v; }
+
+    unsigned long 
+    operator^=(unsigned long __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_ulong*, unsigned long, memory_order);
+
+    friend unsigned long 
+    atomic_load_explicit(volatile atomic_ulong*, memory_order);
+
+    friend unsigned long 
+    atomic_swap_explicit(volatile atomic_ulong*, unsigned long, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_ulong*, unsigned long*, 
+				 unsigned long, memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_ulong*, memory_order);
+
+    friend unsigned long 
+    atomic_fetch_add_explicit(volatile atomic_ulong*, unsigned long, 
+			      memory_order);
+
+    friend unsigned long 
+    atomic_fetch_sub_explicit(volatile atomic_ulong*, unsigned long, 
+			      memory_order);
+
+    friend unsigned long 
+    atomic_fetch_and_explicit(volatile atomic_ulong*, unsigned long, 
+			      memory_order);
+    friend unsigned long 
+    atomic_fetch_or_explicit(volatile atomic_ulong*, unsigned long, 
+			     memory_order);
+
+    friend unsigned long 
+    atomic_fetch_xor_explicit(volatile atomic_ulong*, unsigned long, 
+			      memory_order);
+
+    atomic_ulong() { }
+
+    atomic_ulong(unsigned long __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_ulong(const atomic_ulong&);
+    atomic_ulong& operator=(const atomic_ulong&);
+  };
+
+  /// atomic_llong
+  struct atomic_llong
+  {
+    __atomic_llong_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(long long, memory_order = memory_order_seq_cst) volatile;
+
+    long long 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    long long 
+    swap(long long, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(long long&, long long, memory_order, memory_order) volatile;
+
+    bool 
+    compare_swap(long long&, long long, 
+		 memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    long long 
+    fetch_add(long long, memory_order = memory_order_seq_cst) volatile;
+
+    long long 
+    fetch_sub(long long, memory_order = memory_order_seq_cst) volatile;
+
+    long long 
+    fetch_and(long long, memory_order = memory_order_seq_cst) volatile;
+
+    long long 
+    fetch_or(long long, memory_order = memory_order_seq_cst) volatile;
+
+    long long 
+    fetch_xor(long long, memory_order = memory_order_seq_cst) volatile;
+
+    long long 
+    operator=(long long __v) volatile { store(__v); return __v; }
+
+    long long 
+    operator++(int) volatile { return fetch_add(1); }
+
+    long long 
+    operator--(int) volatile { return fetch_sub(1); }
+
+    long long 
+    operator++() volatile { return fetch_add(1) + 1; }
+
+    long long 
+    operator--() volatile { return fetch_sub(1) - 1; }
+
+    long long 
+    operator+=(long long __v) volatile { return fetch_add(__v) + __v; }
+
+    long long 
+    operator-=(long long __v) volatile { return fetch_sub(__v) - __v; }
+
+    long long 
+    operator&=(long long __v) volatile { return fetch_and(__v) & __v; }
+
+    long long 
+    operator|=(long long __v) volatile { return fetch_or(__v) | __v; }
+
+    long long 
+    operator^=(long long __v) volatile { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_llong*, long long, memory_order);
+
+    friend long long 
+    atomic_load_explicit(volatile atomic_llong*, memory_order);
+
+    friend long long 
+    atomic_swap_explicit(volatile atomic_llong*, long long, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_llong*, long long*, 
+				 long long, memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_llong*, memory_order);
+
+    friend long long 
+    atomic_fetch_add_explicit(volatile atomic_llong*, long long, memory_order);
+
+    friend long long 
+    atomic_fetch_sub_explicit(volatile atomic_llong*, long long, memory_order);
+
+    friend long long 
+    atomic_fetch_and_explicit(volatile atomic_llong*, long long, memory_order);
+
+    friend long long 
+    atomic_fetch_or_explicit(volatile atomic_llong*, long long, memory_order);
+
+    friend long long 
+    atomic_fetch_xor_explicit(volatile atomic_llong*, long long, memory_order);
+
+    atomic_llong() { }
+
+    atomic_llong(long long __v) { _M_base._M_i = __v; }
+
+  private:    
+    atomic_llong(const atomic_llong&);
+    atomic_llong& operator=(const atomic_llong&);
+  };
+
+  /// atomic_ullong
+  struct atomic_ullong
+  {
+    __atomic_ullong_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(unsigned long long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long long 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long long 
+    swap(unsigned long long, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(unsigned long long&, unsigned long long, memory_order, 
+		 memory_order) volatile;
+
+    bool 
+    compare_swap(unsigned long long&, unsigned long long, 
+		 memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    unsigned long long 
+    fetch_add(unsigned long long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long long 
+    fetch_sub(unsigned long long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long long 
+    fetch_and(unsigned long long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long long 
+    fetch_or(unsigned long long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long long 
+    fetch_xor(unsigned long long, memory_order = memory_order_seq_cst) volatile;
+
+    unsigned long long 
+    operator=(unsigned long long __v) volatile
+    { store(__v); return __v; }
+
+    unsigned long long 
+    operator++(int) volatile
+    { return fetch_add(1); }
+
+    unsigned long long 
+    operator--(int) volatile
+    { return fetch_sub(1); }
+
+    unsigned long long 
+    operator++() volatile
+    { return fetch_add(1) + 1; }
+
+    unsigned long long 
+    operator--() volatile
+    { return fetch_sub(1) - 1; }
+
+    unsigned long long 
+    operator+=(unsigned long long __v) volatile
+    { return fetch_add(__v) + __v; }
+
+    unsigned long long 
+    operator-=(unsigned long long __v) volatile
+    { return fetch_sub(__v) - __v; }
+
+    unsigned long long 
+    operator&=(unsigned long long __v) volatile
+    { return fetch_and(__v) & __v; }
+
+    unsigned long long 
+    operator|=(unsigned long long __v) volatile
+    { return fetch_or(__v) | __v; }
+
+    unsigned long long 
+    operator^=(unsigned long long __v) volatile
+    { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_ullong*, unsigned long long,
+                                       memory_order);
+    friend unsigned long long 
+    atomic_load_explicit(volatile atomic_ullong*, memory_order);
+
+    friend unsigned long long 
+    atomic_swap_explicit(volatile atomic_ullong*, unsigned long long, 
+			 memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_ullong*, unsigned long long*, 
+				 unsigned long long, memory_order, 
+				 memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_ullong*, memory_order);
+
+    friend unsigned long long 
+    atomic_fetch_add_explicit(volatile atomic_ullong*, unsigned long long, 
+			      memory_order);
+
+    friend unsigned long long 
+    atomic_fetch_sub_explicit(volatile atomic_ullong*, unsigned long long, 
+			      memory_order);
+
+    friend unsigned long long 
+    atomic_fetch_and_explicit(volatile atomic_ullong*, unsigned long long, 
+			      memory_order);
+
+    friend unsigned long long 
+    atomic_fetch_or_explicit(volatile atomic_ullong*, unsigned long long, 
+			     memory_order);
+
+    friend unsigned long long 
+    atomic_fetch_xor_explicit(volatile atomic_ullong*, unsigned long long, 
+			      memory_order);
+
+    atomic_ullong() { }
+
+    atomic_ullong(unsigned long long __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_ullong(const atomic_ullong&);
+    atomic_ullong& operator=(const atomic_ullong&);
+  };
+
+  /// atomic_wchar_t
+  struct atomic_wchar_t
+  {
+    __atomic_wchar_t_base _M_base;
+
+    bool 
+    is_lock_free() const volatile;
+
+    void 
+    store(wchar_t, memory_order = memory_order_seq_cst) volatile;
+
+    wchar_t 
+    load(memory_order = memory_order_seq_cst) volatile;
+
+    wchar_t 
+    swap(wchar_t, memory_order = memory_order_seq_cst) volatile;
+
+    bool 
+    compare_swap(wchar_t&, wchar_t, memory_order, memory_order) volatile;
+
+    bool 
+    compare_swap(wchar_t&, wchar_t, 
+		 memory_order = memory_order_seq_cst) volatile;
+
+    void 
+    fence(memory_order) const volatile;
+
+    wchar_t 
+    fetch_add(wchar_t, memory_order = memory_order_seq_cst) volatile;
+
+    wchar_t 
+    fetch_sub(wchar_t, memory_order = memory_order_seq_cst) volatile;
+
+    wchar_t 
+    fetch_and(wchar_t, memory_order = memory_order_seq_cst) volatile;
+
+    wchar_t 
+    fetch_or(wchar_t, memory_order = memory_order_seq_cst) volatile;
+
+    wchar_t 
+    fetch_xor(wchar_t, memory_order = memory_order_seq_cst) volatile;
+
+    wchar_t 
+    operator=(wchar_t __v) volatile
+    { store(__v); return __v; }
+
+    wchar_t 
+    operator++(int) volatile
+    { return fetch_add(1); }
+
+    wchar_t 
+    operator--(int) volatile
+    { return fetch_sub(1); }
+
+    wchar_t 
+    operator++() volatile
+    { return fetch_add(1) + 1; }
+
+    wchar_t 
+    operator--() volatile
+    { return fetch_sub(1) - 1; }
+
+    wchar_t 
+    operator+=(wchar_t __v) volatile
+    { return fetch_add(__v) + __v; }
+
+    wchar_t 
+    operator-=(wchar_t __v) volatile
+    { return fetch_sub(__v) - __v; }
+
+    wchar_t 
+    operator&=(wchar_t __v) volatile
+    { return fetch_and(__v) & __v; }
+
+    wchar_t 
+    operator|=(wchar_t __v) volatile
+    { return fetch_or(__v) | __v; }
+
+    wchar_t 
+    operator^=(wchar_t __v) volatile
+    { return fetch_xor(__v) ^ __v; }
+
+    friend void 
+    atomic_store_explicit(volatile atomic_wchar_t*, wchar_t, memory_order);
+
+    friend wchar_t 
+    atomic_load_explicit(volatile atomic_wchar_t*, memory_order);
+
+    friend wchar_t 
+    atomic_swap_explicit(volatile atomic_wchar_t*, wchar_t, memory_order);
+
+    friend bool 
+    atomic_compare_swap_explicit(volatile atomic_wchar_t*,
+				 wchar_t*, wchar_t, memory_order, memory_order);
+
+    friend void 
+    atomic_fence(const volatile atomic_wchar_t*, memory_order);
+
+    friend wchar_t 
+    atomic_fetch_add_explicit(volatile atomic_wchar_t*, wchar_t, memory_order);
+
+    friend wchar_t 
+    atomic_fetch_sub_explicit(volatile atomic_wchar_t*, wchar_t, memory_order);
+
+    friend wchar_t 
+    atomic_fetch_and_explicit(volatile atomic_wchar_t*, wchar_t, memory_order);
+
+    friend wchar_t 
+    atomic_fetch_or_explicit(volatile atomic_wchar_t*, wchar_t, memory_order);
+
+    friend wchar_t 
+    atomic_fetch_xor_explicit(volatile atomic_wchar_t*, wchar_t, memory_order);
+
+    atomic_wchar_t() { }
+
+    atomic_wchar_t(wchar_t __v) { _M_base._M_i = __v; }
+
+  private:
+    atomic_wchar_t(const atomic_wchar_t&);
+    atomic_wchar_t& operator=(const atomic_wchar_t&);
+  };
+
+
+  /// atomic
+  /// 29.4.3, Generic atomic type, primary class template.
+  template<typename _Tp>
+    struct atomic
+    {
+      bool 
+      is_lock_free() const volatile;
+
+      void 
+      store(_Tp, memory_order = memory_order_seq_cst) volatile;
+
+      _Tp 
+      load(memory_order = memory_order_seq_cst) volatile;
+
+      _Tp 
+      swap(_Tp __v, memory_order = memory_order_seq_cst) volatile;
+
+      bool 
+      compare_swap(_Tp&, _Tp, memory_order, memory_order) volatile;
+
+      bool 
+      compare_swap(_Tp&, _Tp, memory_order = memory_order_seq_cst) volatile;
+
+      void 
+      fence(memory_order) const volatile;
+
+      _Tp 
+      operator=(_Tp __v) volatile { store(__v); return __v; }
+
+      atomic() { }
+
+      explicit atomic(_Tp __v) : __f(__v) { }
+
+    private:
+      atomic(const atomic&);
+      atomic& operator=(const atomic&);
+
+      _Tp __f;
+    };
+
+  /// Partial specialization for pointer types.
+  template<typename _Tp> 
+    struct atomic<_Tp*> : atomic_address
+    {
+      _Tp* 
+      load(memory_order = memory_order_seq_cst) volatile;
+
+      _Tp* 
+      swap(_Tp*, memory_order = memory_order_seq_cst) volatile;
+
+      bool 
+      compare_swap(_Tp*&, _Tp*, memory_order, memory_order) volatile;
+
+      bool 
+      compare_swap(_Tp*&, _Tp*, memory_order = memory_order_seq_cst) volatile;
+
+      _Tp* 
+      fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+
+      _Tp* 
+      fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+
+      _Tp* 
+      operator=(_Tp* __v) volatile { store(__v); return __v; }
+
+      _Tp* 
+      operator++(int) volatile { return fetch_add(1); }
+
+      _Tp* 
+      operator--(int) volatile { return fetch_sub(1); }
+
+      _Tp* 
+      operator++() volatile { return fetch_add(1) + 1; }
+
+      _Tp* 
+      operator--() volatile { return fetch_sub(1) - 1; }
+
+      _Tp* 
+      operator+=(ptrdiff_t __v) volatile 
+      { return fetch_add(__v) + __v; }
+
+      _Tp* 
+      operator-=(ptrdiff_t __v) volatile 
+      { return fetch_sub(__v) - __v; }
+
+      atomic() { }
+
+      explicit atomic(_Tp* __v) : atomic_address(__v) { }
+
+    private:
+      atomic(const atomic&);
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for bool.
+  template<> 
+    struct atomic<bool> : atomic_bool
+    {
+      atomic() { }
+
+      explicit atomic(bool __v) : atomic_bool(__v) { }
+      
+      bool 
+      operator=(bool __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for void*
+  template<> 
+    struct atomic<void*> : atomic_address
+    {
+      atomic() { }
+
+      explicit atomic(void* __v) : atomic_address(__v) { }
+      
+      void* 
+      operator=(void* __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);      
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for char.
+  template<> 
+    struct atomic<char> : atomic_char
+    {
+      atomic() { }
+
+      explicit atomic(char __v) : atomic_char(__v) { }
+      
+      char 
+      operator=(char __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);
+      atomic& operator=(const atomic&);
+    };
+
+
+  /// Explicit specialization for signed char.
+  template<> 
+    struct atomic<signed char> : atomic_schar
+    { 
+      atomic() { }
+
+      explicit atomic(signed char __v) : atomic_schar(__v) { }
+      
+      signed char 
+      operator=(signed char __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);      
+      atomic& operator=(const atomic&);
+  };
+
+  /// Explicit specialization for unsigned char.
+  template<> 
+    struct atomic<unsigned char> : atomic_uchar
+    {
+      atomic() { }
+
+      explicit atomic(unsigned char __v) : atomic_uchar(__v) { }
+      
+      unsigned char 
+      operator=(unsigned char __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);
+      atomic& 
+      operator=(const atomic&);
+    };
+
+  /// Explicit specialization for short.
+  template<> 
+    struct atomic<short> : atomic_short
+    {
+      atomic() { }
+
+      explicit atomic(short __v) : atomic_short(__v) { }
+      
+      short 
+      operator=(short __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);
+      atomic& operator=(const atomic&);
+  };
+
+  /// Explicit specialization for unsigned short.
+  template<> 
+    struct atomic<unsigned short> : atomic_ushort
+    {
+      atomic() { }
+
+      explicit atomic(unsigned short __v) : atomic_ushort(__v) { }
+      
+      unsigned short 
+      operator=(unsigned short __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);      
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for int.
+  template<> 
+    struct atomic<int> : atomic_int
+    {
+      atomic() { }
+
+      explicit atomic(int __v) : atomic_int(__v) { }
+      
+      int 
+      operator=(int __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for unsigned int.
+  template<> 
+    struct atomic<unsigned int> : atomic_uint
+    {
+      atomic() { }
+
+      explicit atomic(unsigned int __v) : atomic_uint(__v) { }
+      
+      unsigned int 
+      operator=(unsigned int __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);      
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for long.
+  template<> 
+    struct atomic<long> : atomic_long
+    {
+      atomic() { }
+
+      explicit atomic(long __v) : atomic_long(__v) { }
+      
+      long 
+      operator=(long __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);      
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for unsigned long.
+  template<> 
+    struct atomic<unsigned long> : atomic_ulong
+    {
+      atomic() { }
+
+      explicit atomic(unsigned long __v) : atomic_ulong(__v) { }
+      
+      unsigned long 
+      operator=(unsigned long __v) volatile
+      { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for long long.
+  template<> 
+    struct atomic<long long> : atomic_llong
+    {
+      atomic() { }
+
+      explicit atomic(long long __v) : atomic_llong(__v) { }
+      
+      long long 
+      operator=(long long __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);      
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for unsigned long long.
+  template<> 
+    struct atomic<unsigned long long> : atomic_ullong
+    {
+      atomic() { }
+
+      explicit atomic(unsigned long long __v) : atomic_ullong(__v) { }
+      
+      unsigned long long 
+      operator=(unsigned long long __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);
+      atomic& operator=(const atomic&);
+    };
+
+  /// Explicit specialization for wchar_t.
+  template<> 
+    struct atomic<wchar_t> : atomic_wchar_t
+    {
+      atomic() { }
+
+      explicit atomic(wchar_t __v) : atomic_wchar_t(__v) { }
+      
+      wchar_t 
+      operator=(wchar_t __v) volatile { store(__v); return __v; }
+      
+    private:
+      atomic(const atomic&);
+      atomic& operator=(const atomic&);
+    };
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_bool* __a)
+  { return false; }
+
+  inline bool 
+  atomic_load_explicit(volatile atomic_bool* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline bool 
+  atomic_load(volatile atomic_bool* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_bool* __a, bool __m, memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_bool* __a, bool __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_swap_explicit(volatile atomic_bool* __a, bool __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline bool 
+  atomic_swap(volatile atomic_bool* __a, bool __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_bool* __a, bool* __e, bool __m,
+			       memory_order __x, memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_bool* __a, bool* __e, bool __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_bool* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_address* __a)
+  { return false; }
+
+  inline void* 
+  atomic_load_explicit(volatile atomic_address* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline void* 
+  atomic_load(volatile atomic_address* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_address* __a, void* __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_address* __a, void* __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline void* 
+  atomic_swap_explicit(volatile atomic_address* __a, void* __m, 
+		       memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline void* 
+  atomic_swap(volatile atomic_address* __a, void* __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_address* __a, void** __e, 
+			       void* __m, memory_order __x, memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_address* __a, void** __e, void* __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_address* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_char* __a)
+  { return false; }
+
+  inline char 
+  atomic_load_explicit(volatile atomic_char* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline char 
+  atomic_load(volatile atomic_char* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_char* __a, char __m, memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_char* __a, char __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline char 
+  atomic_swap_explicit(volatile atomic_char* __a, char __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline char 
+  atomic_swap(volatile atomic_char* __a, char __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_char* __a, char* __e, char __m,
+			       memory_order __x, memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_char* __a, char* __e, char __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_char* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_schar* __a)
+  { return false; }
+
+  inline signed char 
+  atomic_load_explicit(volatile atomic_schar* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline signed char 
+  atomic_load(volatile atomic_schar* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_schar* __a, signed char __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_schar* __a, signed char __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline signed char 
+  atomic_swap_explicit(volatile atomic_schar* __a, signed char __m, 
+		       memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline signed char 
+  atomic_swap(volatile atomic_schar* __a, signed char __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_schar* __a, signed char* __e, 
+			       signed char __m, memory_order __x, 
+			       memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_schar* __a, signed char* __e, 
+		      signed char __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_schar* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_uchar* __a)
+  { return false; }
+
+  inline unsigned char 
+  atomic_load_explicit(volatile atomic_uchar* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline unsigned char 
+  atomic_load(volatile atomic_uchar* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_uchar* __a, unsigned char __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_uchar* __a, unsigned char __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned char 
+  atomic_swap_explicit(volatile atomic_uchar* __a, unsigned char __m, 
+		       memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline unsigned char 
+  atomic_swap(volatile atomic_uchar* __a, unsigned char __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_uchar* __a, unsigned char* __e,
+			       unsigned char __m, memory_order __x, 
+			       memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_uchar* __a, unsigned char* __e, 
+		      unsigned char __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_uchar* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_short* __a)
+  { return false; }
+
+  inline short 
+  atomic_load_explicit(volatile atomic_short* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline short 
+  atomic_load(volatile atomic_short* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_short* __a, short __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_short* __a, short __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline short 
+  atomic_swap_explicit(volatile atomic_short* __a, short __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline short 
+  atomic_swap(volatile atomic_short* __a, short __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_short* __a, short* __e, 
+			       short __m, memory_order __x, memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_short* __a, short* __e, short __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_short* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_ushort* __a)
+  { return false; }
+
+  inline unsigned short 
+  atomic_load_explicit(volatile atomic_ushort* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline unsigned short 
+  atomic_load(volatile atomic_ushort* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_ushort* __a, unsigned short __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_ushort* __a, unsigned short __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned short 
+  atomic_swap_explicit(volatile atomic_ushort* __a, unsigned short __m, 
+		       memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline unsigned short 
+  atomic_swap(volatile atomic_ushort* __a, unsigned short __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_ushort* __a, 
+			       unsigned short* __e, unsigned short __m,
+			       memory_order __x, memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_ushort* __a, unsigned short* __e, 
+		      unsigned short __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_ushort* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_int* __a)
+  { return false; }
+
+  inline int 
+  atomic_load_explicit(volatile atomic_int* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline int 
+  atomic_load(volatile atomic_int* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_int* __a, int __m, memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_int* __a, int __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline int 
+  atomic_swap_explicit(volatile atomic_int* __a, int __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline int 
+  atomic_swap(volatile atomic_int* __a, int __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_int* __a, int* __e, int __m,
+			       memory_order __x, memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_int* __a, int* __e, int __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_int* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_uint* __a)
+  { return false; }
+
+  inline unsigned int 
+  atomic_load_explicit(volatile atomic_uint* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline unsigned int 
+  atomic_load(volatile atomic_uint* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_uint* __a, unsigned int __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_uint* __a, unsigned int __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned int 
+  atomic_swap_explicit(volatile atomic_uint* __a, unsigned int __m, 
+		       memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline unsigned int 
+  atomic_swap(volatile atomic_uint* __a, unsigned int __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_uint* __a, unsigned int* __e, 
+			       unsigned int __m, memory_order __x, 
+			       memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_uint* __a, unsigned int* __e, 
+		      unsigned int __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_uint* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_long* __a)
+  { return false; }
+
+  inline long 
+  atomic_load_explicit(volatile atomic_long* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline long 
+  atomic_load(volatile atomic_long* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_long* __a, long __m, memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_long* __a, long __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long 
+  atomic_swap_explicit(volatile atomic_long* __a, long __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline long 
+  atomic_swap(volatile atomic_long* __a, long __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_long* __a, long* __e, long __m,
+			       memory_order __x, memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_long* __a, long* __e, long __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_long* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_ulong* __a)
+  { return false; }
+
+  inline unsigned long 
+  atomic_load_explicit(volatile atomic_ulong* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline unsigned long 
+  atomic_load(volatile atomic_ulong* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_ulong* __a, unsigned long __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_ulong* __a, unsigned long __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long 
+  atomic_swap_explicit(volatile atomic_ulong* __a, unsigned long __m, 
+		       memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline unsigned long 
+  atomic_swap(volatile atomic_ulong* __a, unsigned long __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_ulong* __a, unsigned long* __e,
+			       unsigned long __m, memory_order __x, 
+			       memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_ulong* __a, unsigned long* __e, 
+		      unsigned long __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_ulong* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_llong* __a)
+  { return false; }
+
+  inline long long 
+  atomic_load_explicit(volatile atomic_llong* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline long long 
+  atomic_load(volatile atomic_llong* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_llong* __a, long long __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_llong* __a, long long __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long long 
+  atomic_swap_explicit(volatile atomic_llong* __a, long long __m, 
+		       memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline long long 
+  atomic_swap(volatile atomic_llong* __a, long long __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_llong* __a, long long* __e, 
+			       long long __m, memory_order __x, 
+			       memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_llong* __a, long long* __e, 
+		      long long __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_llong* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_ullong* __a)
+  { return false; }
+
+  inline unsigned long long 
+  atomic_load_explicit(volatile atomic_ullong* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline unsigned long long 
+  atomic_load(volatile atomic_ullong* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  inline void 
+  atomic_store_explicit(volatile atomic_ullong* __a, unsigned long long __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_ullong* __a, unsigned long long __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long long 
+  atomic_swap_explicit(volatile atomic_ullong* __a, unsigned long long __m, 
+		       memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline unsigned long long 
+  atomic_swap(volatile atomic_ullong* __a, unsigned long long __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_ullong* __a, 
+			       unsigned long long* __e, unsigned long long __m,
+			       memory_order __x, memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_ullong* __a, unsigned long long* __e, 
+		      unsigned long long __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_ullong* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_wchar_t* __a)
+  { return false; }
+
+  inline wchar_t 
+  atomic_load_explicit(volatile atomic_wchar_t* __a, memory_order __x)
+  { return _ATOMIC_LOAD_(__a, __x); }
+
+  inline wchar_t 
+  atomic_load(volatile atomic_wchar_t* __a)
+  { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+
+  inline void 
+  atomic_store_explicit(volatile atomic_wchar_t* __a, wchar_t __m, 
+			memory_order __x)
+  { _ATOMIC_STORE_(__a, __m, __x); }
+
+  inline void 
+  atomic_store(volatile atomic_wchar_t* __a, wchar_t __m)
+  { atomic_store_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline wchar_t 
+  atomic_swap_explicit(volatile atomic_wchar_t* __a, wchar_t __m, 
+		       memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, =, __m, __x); }
+
+  inline wchar_t 
+  atomic_swap(volatile atomic_wchar_t* __a, wchar_t __m)
+  { return atomic_swap_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_compare_swap_explicit(volatile atomic_wchar_t* __a, wchar_t* __e, 
+			       wchar_t __m, memory_order __x, memory_order __y)
+  { return _ATOMIC_CMPSWP_(__a, __e, __m, __x); }
+
+  inline bool 
+  atomic_compare_swap(volatile atomic_wchar_t* __a, wchar_t* __e, wchar_t __m)
+  { return atomic_compare_swap_explicit(__a, __e, __m, memory_order_seq_cst, 
+					memory_order_seq_cst); }
+
+  inline void 
+  atomic_fence(const volatile atomic_wchar_t* __a, memory_order __x)
+  { _ATOMIC_FENCE_(__a, __x); }
+
+  inline void* 
+  atomic_fetch_add_explicit(volatile atomic_address* __a, ptrdiff_t __m, 
+			    memory_order __x)
+  { 
+    void* volatile* __p = &((__a)->_M_base._M_i);
+    volatile atomic_flag* __g = __atomic_flag_for_address(__p);
+    __atomic_flag_wait_explicit(__g, __x);
+    void* __r = *__p;
+    *__p = (void*)((char*)(*__p) + __m);
+    atomic_flag_clear_explicit(__g, __x);
+    return __r; 
+  }
+
+  inline void* 
+  atomic_fetch_add(volatile atomic_address* __a, ptrdiff_t __m)
+  { return atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline void* 
+  atomic_fetch_sub_explicit(volatile atomic_address* __a, ptrdiff_t __m, 
+			    memory_order __x)
+  { 
+    void* volatile* __p = &((__a)->_M_base._M_i);
+    volatile atomic_flag* __g = __atomic_flag_for_address(__p);
+    __atomic_flag_wait_explicit(__g, __x);
+    void* __r = *__p;
+    *__p = (void*)((char*)(*__p) - __m);
+    atomic_flag_clear_explicit(__g, __x);
+    return __r; 
+  }
+
+  inline void* 
+  atomic_fetch_sub(volatile atomic_address* __a, ptrdiff_t __m)
+  { return atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline char 
+  atomic_fetch_add_explicit(volatile atomic_char* __a, char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline char 
+  atomic_fetch_add(volatile atomic_char* __a, char __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline char 
+  atomic_fetch_sub_explicit(volatile atomic_char* __a, char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline char 
+  atomic_fetch_sub(volatile atomic_char* __a, char __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline char 
+  atomic_fetch_and_explicit(volatile atomic_char* __a, char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline char 
+  atomic_fetch_and(volatile atomic_char* __a, char __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline char 
+  atomic_fetch_or_explicit(volatile atomic_char* __a, char __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline char 
+  atomic_fetch_or(volatile atomic_char* __a, char __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline char 
+  atomic_fetch_xor_explicit(volatile atomic_char* __a, char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline char 
+  atomic_fetch_xor(volatile atomic_char* __a, char __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline signed char 
+  atomic_fetch_add_explicit(volatile atomic_schar* __a, signed char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline signed char 
+  atomic_fetch_add(volatile atomic_schar* __a, signed char __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline signed char 
+  atomic_fetch_sub_explicit(volatile atomic_schar* __a, signed char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline signed char 
+  atomic_fetch_sub(volatile atomic_schar* __a, signed char __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline signed char 
+  atomic_fetch_and_explicit(volatile atomic_schar* __a, signed char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline signed char 
+  atomic_fetch_and(volatile atomic_schar* __a, signed char __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline signed char 
+  atomic_fetch_or_explicit(volatile atomic_schar* __a, signed char __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline signed char 
+  atomic_fetch_or(volatile atomic_schar* __a, signed char __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline signed char 
+  atomic_fetch_xor_explicit(volatile atomic_schar* __a, signed char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline signed char 
+  atomic_fetch_xor(volatile atomic_schar* __a, signed char __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline unsigned char 
+  atomic_fetch_add_explicit(volatile atomic_uchar* __a, unsigned char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline unsigned char 
+  atomic_fetch_add(volatile atomic_uchar* __a, unsigned char __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned char 
+  atomic_fetch_sub_explicit(volatile atomic_uchar* __a, unsigned char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline unsigned char 
+  atomic_fetch_sub(volatile atomic_uchar* __a, unsigned char __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline unsigned char 
+  atomic_fetch_and_explicit(volatile atomic_uchar* __a, unsigned char __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline unsigned char 
+  atomic_fetch_and(volatile atomic_uchar* __a, unsigned char __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned char 
+  atomic_fetch_or_explicit(volatile atomic_uchar* __a, unsigned char __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline unsigned char 
+  atomic_fetch_or(volatile atomic_uchar* __a, unsigned char __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned char 
+  atomic_fetch_xor_explicit(volatile atomic_uchar* __a, 
+			    unsigned char __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline unsigned char 
+  atomic_fetch_xor(volatile atomic_uchar* __a, unsigned char __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline short 
+  atomic_fetch_add_explicit(volatile atomic_short* __a, short __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline short 
+  atomic_fetch_add(volatile atomic_short* __a, short __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline short 
+  atomic_fetch_sub_explicit(volatile atomic_short* __a, short __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline short 
+  atomic_fetch_sub(volatile atomic_short* __a, short __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline short 
+  atomic_fetch_and_explicit(volatile atomic_short* __a, short __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline short 
+  atomic_fetch_and(volatile atomic_short* __a, short __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline short 
+  atomic_fetch_or_explicit(volatile atomic_short* __a, short __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline short 
+  atomic_fetch_or(volatile atomic_short* __a, short __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline short 
+  atomic_fetch_xor_explicit(volatile atomic_short* __a, short __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline short 
+  atomic_fetch_xor(volatile atomic_short* __a, short __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline unsigned short 
+  atomic_fetch_add_explicit(volatile atomic_ushort* __a, unsigned short __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline unsigned short 
+  atomic_fetch_add(volatile atomic_ushort* __a, unsigned short __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned short 
+  atomic_fetch_sub_explicit(volatile atomic_ushort* __a, unsigned short __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline unsigned short 
+  atomic_fetch_sub(volatile atomic_ushort* __a, unsigned short __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned short 
+  atomic_fetch_and_explicit(volatile atomic_ushort* __a, unsigned short __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline unsigned short 
+  atomic_fetch_and(volatile atomic_ushort* __a, unsigned short __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned short 
+  atomic_fetch_or_explicit(volatile atomic_ushort* __a, unsigned short __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline unsigned short 
+  atomic_fetch_or(volatile atomic_ushort* __a, unsigned short __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned short 
+  atomic_fetch_xor_explicit(volatile atomic_ushort* __a, unsigned short __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline unsigned short 
+  atomic_fetch_xor(volatile atomic_ushort* __a, unsigned short __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline int 
+  atomic_fetch_add_explicit(volatile atomic_int* __a, int __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline int 
+  atomic_fetch_add(volatile atomic_int* __a, int __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline int 
+  atomic_fetch_sub_explicit(volatile atomic_int* __a, int __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline int 
+  atomic_fetch_sub(volatile atomic_int* __a, int __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline int 
+  atomic_fetch_and_explicit(volatile atomic_int* __a, int __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline int 
+  atomic_fetch_and(volatile atomic_int* __a, int __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline int 
+  atomic_fetch_or_explicit(volatile atomic_int* __a, int __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline int 
+  atomic_fetch_or(volatile atomic_int* __a, int __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline int 
+  atomic_fetch_xor_explicit(volatile atomic_int* __a, int __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline int 
+  atomic_fetch_xor(volatile atomic_int* __a, int __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline unsigned int 
+  atomic_fetch_add_explicit(volatile atomic_uint* __a, unsigned int __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline unsigned int 
+  atomic_fetch_add(volatile atomic_uint* __a, unsigned int __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned int 
+  atomic_fetch_sub_explicit(volatile atomic_uint* __a, unsigned int __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline unsigned int 
+  atomic_fetch_sub(volatile atomic_uint* __a, unsigned int __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned int 
+  atomic_fetch_and_explicit(volatile atomic_uint* __a, unsigned int __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline unsigned int 
+  atomic_fetch_and(volatile atomic_uint* __a, unsigned int __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned int 
+  atomic_fetch_or_explicit(volatile atomic_uint* __a, unsigned int __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline unsigned int 
+  atomic_fetch_or(volatile atomic_uint* __a, unsigned int __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned int 
+  atomic_fetch_xor_explicit(volatile atomic_uint* __a, unsigned int __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline unsigned int 
+  atomic_fetch_xor(volatile atomic_uint* __a, unsigned int __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline long 
+  atomic_fetch_add_explicit(volatile atomic_long* __a, long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline long 
+  atomic_fetch_add(volatile atomic_long* __a, long __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long 
+  atomic_fetch_sub_explicit(volatile atomic_long* __a, long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline long 
+  atomic_fetch_sub(volatile atomic_long* __a, long __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long 
+  atomic_fetch_and_explicit(volatile atomic_long* __a, long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline long 
+  atomic_fetch_and(volatile atomic_long* __a, long __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long 
+  atomic_fetch_or_explicit(volatile atomic_long* __a, long __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline long 
+  atomic_fetch_or(volatile atomic_long* __a, long __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long 
+  atomic_fetch_xor_explicit(volatile atomic_long* __a, long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline long 
+  atomic_fetch_xor(volatile atomic_long* __a, long __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline unsigned long 
+  atomic_fetch_add_explicit(volatile atomic_ulong* __a, unsigned long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline unsigned long 
+  atomic_fetch_add(volatile atomic_ulong* __a, unsigned long __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long 
+  atomic_fetch_sub_explicit(volatile atomic_ulong* __a, unsigned long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline unsigned long 
+  atomic_fetch_sub(volatile atomic_ulong* __a, unsigned long __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long 
+  atomic_fetch_and_explicit(volatile atomic_ulong* __a, unsigned long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline unsigned long 
+  atomic_fetch_and(volatile atomic_ulong* __a, unsigned long __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long 
+  atomic_fetch_or_explicit(volatile atomic_ulong* __a, unsigned long __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline unsigned long 
+  atomic_fetch_or(volatile atomic_ulong* __a, unsigned long __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long 
+  atomic_fetch_xor_explicit(volatile atomic_ulong* __a, unsigned long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline unsigned long 
+  atomic_fetch_xor(volatile atomic_ulong* __a, unsigned long __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline long long 
+  atomic_fetch_add_explicit(volatile atomic_llong* __a, long long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline long long 
+  atomic_fetch_add(volatile atomic_llong* __a, long long __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long long 
+  atomic_fetch_sub_explicit(volatile atomic_llong* __a, long long __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline long long 
+  atomic_fetch_sub(volatile atomic_llong* __a, long long __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long long 
+  atomic_fetch_and_explicit(volatile atomic_llong* __a, 
+			    long long __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline long long 
+  atomic_fetch_and(volatile atomic_llong* __a, long long __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long long 
+  atomic_fetch_or_explicit(volatile atomic_llong* __a, 
+			   long long __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline long long 
+  atomic_fetch_or(volatile atomic_llong* __a, long long __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline long long 
+  atomic_fetch_xor_explicit(volatile atomic_llong* __a, 
+			    long long __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline long long 
+  atomic_fetch_xor(volatile atomic_llong* __a, long long __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline unsigned long long 
+  atomic_fetch_add_explicit(volatile atomic_ullong* __a, 
+			    unsigned long long __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline unsigned long long 
+  atomic_fetch_add(volatile atomic_ullong* __a, unsigned long long __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long long 
+  atomic_fetch_sub_explicit(volatile atomic_ullong* __a, 
+			    unsigned long long __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline unsigned long long 
+  atomic_fetch_sub(volatile atomic_ullong* __a, unsigned long long __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long long 
+  atomic_fetch_and_explicit(volatile atomic_ullong* __a, 
+			    unsigned long long __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline unsigned long long 
+  atomic_fetch_and(volatile atomic_ullong* __a, unsigned long long __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long long 
+  atomic_fetch_or_explicit(volatile atomic_ullong* __a, 
+			   unsigned long long __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline unsigned long long 
+  atomic_fetch_or(volatile atomic_ullong* __a, unsigned long long __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline unsigned long long 
+  atomic_fetch_xor_explicit(volatile atomic_ullong* __a, 
+			    unsigned long long __m, memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline unsigned long long 
+  atomic_fetch_xor(volatile atomic_ullong* __a, unsigned long long __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+
+  inline wchar_t 
+  atomic_fetch_add_explicit(volatile atomic_wchar_t* __a, wchar_t __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, +=, __m, __x); }
+
+  inline wchar_t 
+  atomic_fetch_add(volatile atomic_wchar_t* __a, wchar_t __m)
+  { atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline wchar_t 
+  atomic_fetch_sub_explicit(volatile atomic_wchar_t* __a, wchar_t __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, -=, __m, __x); }
+
+  inline wchar_t 
+  atomic_fetch_sub(volatile atomic_wchar_t* __a, wchar_t __m)
+  { atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline wchar_t 
+  atomic_fetch_and_explicit(volatile atomic_wchar_t* __a, wchar_t __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, &=, __m, __x); }
+
+  inline wchar_t 
+  atomic_fetch_and(volatile atomic_wchar_t* __a, wchar_t __m)
+  { atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline wchar_t 
+  atomic_fetch_or_explicit(volatile atomic_wchar_t* __a, wchar_t __m, 
+			   memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, |=, __m, __x); }
+
+  inline wchar_t 
+  atomic_fetch_or(volatile atomic_wchar_t* __a, wchar_t __m)
+  { atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline wchar_t 
+  atomic_fetch_xor_explicit(volatile atomic_wchar_t* __a, wchar_t __m, 
+			    memory_order __x)
+  { return _ATOMIC_MODIFY_(__a, ^=, __m, __x); }
+
+  inline wchar_t 
+  atomic_fetch_xor(volatile atomic_wchar_t* __a, wchar_t __m)
+  { atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst); }
+
+  inline bool 
+  atomic_bool::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_bool::store(bool __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_bool::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline bool 
+  atomic_bool::swap(bool __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_bool::compare_swap(bool& __e, bool __m, memory_order __x, 
+			    memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_bool::compare_swap(bool& __e, bool __m, memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_bool::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_char::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_char::store(char __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline char 
+  atomic_char::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline char 
+  atomic_char::swap(char __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_char::compare_swap(char& __e, char __m,
+			    memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_char::compare_swap(char& __e, char __m, memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_char::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_schar::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_schar::store(signed char __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline signed char 
+  atomic_schar::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline signed char 
+  atomic_schar::swap(signed char __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_schar::compare_swap(signed char& __e, signed char __m,
+			     memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_schar::compare_swap(signed char& __e, signed char __m, 
+			     memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_schar::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+  inline bool 
+  atomic_uchar::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_uchar::store(unsigned char __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline unsigned char 
+  atomic_uchar::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline unsigned char 
+  atomic_uchar::swap(unsigned char __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_uchar::compare_swap(unsigned char& __e, unsigned char __m,
+			     memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_uchar::compare_swap(unsigned char& __e, unsigned char __m, 
+			     memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_uchar::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_short::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_short::store(short __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline short 
+  atomic_short::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline short 
+  atomic_short::swap(short __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_short::compare_swap(short& __e, short __m,
+			     memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_short::compare_swap(short& __e, short __m, memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_short::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_ushort::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_ushort::store(unsigned short __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline unsigned short 
+  atomic_ushort::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline unsigned short 
+  atomic_ushort::swap(unsigned short __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_ushort::compare_swap(unsigned short& __e, unsigned short __m,
+			      memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_ushort::compare_swap(unsigned short& __e, unsigned short __m, 
+			      memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_ushort::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_int::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_int::store(int __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline int 
+  atomic_int::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline int 
+  atomic_int::swap(int __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_int::compare_swap(int& __e, int __m, memory_order __x, 
+			   memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_int::compare_swap(int& __e, int __m, memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_int::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_uint::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_uint::store(unsigned int __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline unsigned int 
+  atomic_uint::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline unsigned int 
+  atomic_uint::swap(unsigned int __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_uint::compare_swap(unsigned int& __e, unsigned int __m,
+			    memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_uint::compare_swap(unsigned int& __e, unsigned int __m, 
+			    memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_uint::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_long::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_long::store(long __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline long 
+  atomic_long::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline long 
+  atomic_long::swap(long __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_long::compare_swap(long& __e, long __m,
+			    memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_long::compare_swap(long& __e, long __m, memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_long::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_ulong::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_ulong::store(unsigned long __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline unsigned long 
+  atomic_ulong::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline unsigned long 
+  atomic_ulong::swap(unsigned long __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_ulong::compare_swap(unsigned long& __e, unsigned long __m,
+			     memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_ulong::compare_swap(unsigned long& __e, unsigned long __m, 
+			     memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_ulong::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_llong::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_llong::store(long long __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline long long 
+  atomic_llong::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline long long 
+  atomic_llong::swap(long long __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_llong::compare_swap(long long& __e, long long __m,
+			     memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_llong::compare_swap(long long& __e, long long __m, 
+			     memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_llong::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_ullong::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_ullong::store(unsigned long long __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline unsigned long long 
+  atomic_ullong::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline unsigned long long 
+  atomic_ullong::swap(unsigned long long __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_ullong::compare_swap(unsigned long long& __e, unsigned long long __m,
+			      memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_ullong::compare_swap(unsigned long long& __e, unsigned long long __m, 
+			      memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_ullong::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline bool 
+  atomic_wchar_t::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_wchar_t::store(wchar_t __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline wchar_t 
+  atomic_wchar_t::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline wchar_t 
+  atomic_wchar_t::swap(wchar_t __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_wchar_t::compare_swap(wchar_t& __e, wchar_t __m,
+			       memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_wchar_t::compare_swap(wchar_t& __e, wchar_t __m, 
+			       memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_wchar_t::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  inline void* 
+  atomic_address::fetch_add(ptrdiff_t __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+  inline void* 
+  atomic_address::fetch_sub(ptrdiff_t __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline char 
+  atomic_char::fetch_add(char __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline char 
+  atomic_char::fetch_sub(char __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline char 
+  atomic_char::fetch_and(char __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline char 
+  atomic_char::fetch_or(char __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline char 
+  atomic_char::fetch_xor(char __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline signed char 
+  atomic_schar::fetch_add(signed char __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline signed char 
+  atomic_schar::fetch_sub(signed char __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline signed char 
+  atomic_schar::fetch_and(signed char __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline signed char 
+  atomic_schar::fetch_or(signed char __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline signed char 
+  atomic_schar::fetch_xor(signed char __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline unsigned char 
+  atomic_uchar::fetch_add(unsigned char __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline unsigned char 
+  atomic_uchar::fetch_sub(unsigned char __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline unsigned char 
+  atomic_uchar::fetch_and(unsigned char __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline unsigned char 
+  atomic_uchar::fetch_or(unsigned char __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline unsigned char 
+  atomic_uchar::fetch_xor(unsigned char __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline short 
+  atomic_short::fetch_add(short __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline short 
+  atomic_short::fetch_sub(short __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline short 
+  atomic_short::fetch_and(short __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline short 
+  atomic_short::fetch_or(short __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline short 
+  atomic_short::fetch_xor(short __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline unsigned short 
+  atomic_ushort::fetch_add(unsigned short __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline unsigned short 
+  atomic_ushort::fetch_sub(unsigned short __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline unsigned short 
+  atomic_ushort::fetch_and(unsigned short __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline unsigned short 
+  atomic_ushort::fetch_or(unsigned short __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline unsigned short 
+  atomic_ushort::fetch_xor(unsigned short __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline int 
+  atomic_int::fetch_add(int __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline int 
+  atomic_int::fetch_sub(int __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline int 
+  atomic_int::fetch_and(int __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline int 
+  atomic_int::fetch_or(int __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline int 
+  atomic_int::fetch_xor(int __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline unsigned int 
+  atomic_uint::fetch_add(unsigned int __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline unsigned int 
+  atomic_uint::fetch_sub(unsigned int __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline unsigned int 
+  atomic_uint::fetch_and(unsigned int __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline unsigned int 
+  atomic_uint::fetch_or(unsigned int __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline unsigned int 
+  atomic_uint::fetch_xor(unsigned int __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline long 
+  atomic_long::fetch_add(long __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline long 
+  atomic_long::fetch_sub(long __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline long 
+  atomic_long::fetch_and(long __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline long 
+  atomic_long::fetch_or(long __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline long 
+  atomic_long::fetch_xor(long __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline unsigned long 
+  atomic_ulong::fetch_add(unsigned long __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline unsigned long 
+  atomic_ulong::fetch_sub(unsigned long __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline unsigned long 
+  atomic_ulong::fetch_and(unsigned long __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline unsigned long 
+  atomic_ulong::fetch_or(unsigned long __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline unsigned long 
+  atomic_ulong::fetch_xor(unsigned long __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline long long 
+  atomic_llong::fetch_add(long long __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline long long 
+  atomic_llong::fetch_sub(long long __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline long long 
+  atomic_llong::fetch_and(long long __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline long long 
+  atomic_llong::fetch_or(long long __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline long long 
+  atomic_llong::fetch_xor(long long __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline unsigned long long 
+  atomic_ullong::fetch_add(unsigned long long __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline unsigned long long 
+  atomic_ullong::fetch_sub(unsigned long long __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline unsigned long long 
+  atomic_ullong::fetch_and(unsigned long long __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline unsigned long long 
+  atomic_ullong::fetch_or(unsigned long long __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline unsigned long long
+  atomic_ullong::fetch_xor(unsigned long long __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline wchar_t 
+  atomic_wchar_t::fetch_add(wchar_t __m, memory_order __x) volatile
+  { return atomic_fetch_add_explicit(this, __m, __x); }
+
+
+  inline wchar_t 
+  atomic_wchar_t::fetch_sub(wchar_t __m, memory_order __x) volatile
+  { return atomic_fetch_sub_explicit(this, __m, __x); }
+
+
+  inline wchar_t 
+  atomic_wchar_t::fetch_and(wchar_t __m, memory_order __x) volatile
+  { return atomic_fetch_and_explicit(this, __m, __x); }
+
+
+  inline wchar_t 
+  atomic_wchar_t::fetch_or(wchar_t __m, memory_order __x) volatile
+  { return atomic_fetch_or_explicit(this, __m, __x); }
+
+
+  inline wchar_t 
+  atomic_wchar_t::fetch_xor(wchar_t __m, memory_order __x) volatile
+  { return atomic_fetch_xor_explicit(this, __m, __x); }
+
+
+  inline bool 
+  atomic_address::is_lock_free() const volatile
+  { return false; }
+
+  inline void 
+  atomic_address::store(void* __m, memory_order __x) volatile
+  { atomic_store_explicit(this, __m, __x); }
+
+  inline void* 
+  atomic_address::load(memory_order __x) volatile
+  { return atomic_load_explicit(this, __x); }
+
+  inline void* 
+  atomic_address::swap(void* __m, memory_order __x) volatile
+  { return atomic_swap_explicit(this, __m, __x); }
+
+  inline bool 
+  atomic_address::compare_swap(void*& __e, void* __m,
+			       memory_order __x, memory_order __y) volatile
+  { return atomic_compare_swap_explicit(this, &__e, __m, __x, __y); }
+
+  inline bool 
+  atomic_address::compare_swap(void*& __e, void* __m, 
+			       memory_order __x) volatile
+  {
+    const bool __cond1 = __x == memory_order_release;
+    const bool __cond2 = __x == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+  }
+
+  inline void 
+  atomic_address::fence(memory_order __x) const volatile
+  { return atomic_fence(this, __x); }
+
+
+  template<typename _Tp>
+    inline bool 
+    atomic<_Tp>::is_lock_free() const volatile
+    { return false; }
+
+  template<typename _Tp>
+    inline void 
+    atomic<_Tp>::store(_Tp __v, memory_order __x) volatile
+    // XXX
+    //  { _ATOMIC_STORE_(this, __v, __x); }
+    { }
+
+  template<typename _Tp>
+    inline _Tp 
+    atomic<_Tp>::load(memory_order __x) volatile
+    // XXX
+    //  { return _ATOMIC_LOAD_(this, __x); }
+    { }
+
+  template<typename _Tp>
+    inline _Tp 
+    atomic<_Tp>::swap(_Tp __v, memory_order __x) volatile
+    // XXX
+    //  { return _ATOMIC_MODIFY_(this, =, __v, __x); }
+    { }
+
+  template<typename _Tp>
+    inline bool 
+    atomic<_Tp>::compare_swap(_Tp& __r, _Tp __v, memory_order __x, 
+			      memory_order __y) volatile
+    // XXX
+    // { return _ATOMIC_CMPSWP_(this, &__r, __v, __x); }
+    { }
+
+  template<typename _Tp>
+    inline bool 
+    atomic<_Tp>::compare_swap(_Tp& __r, _Tp __v, memory_order __x) volatile
+    { 
+      const bool __cond1 = __x == memory_order_release;
+      const bool __cond2 = __x == memory_order_acq_rel;
+      memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+      memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+      return compare_swap(__r, __v, __x, __mo2);
+    }
+
+  template<typename _Tp>
+    _Tp* 
+    atomic<_Tp*>::load(memory_order __x) volatile
+    { return static_cast<_Tp*>(atomic_address::load(__x)); }
+
+  template<typename _Tp>
+    _Tp* 
+    atomic<_Tp*>::swap(_Tp* __v, memory_order __x) volatile
+    { return static_cast<_Tp*>(atomic_address::swap(__v, __x)); }
+
+  template<typename _Tp>
+    bool 
+    atomic<_Tp*>::compare_swap(_Tp*& __r, _Tp* __v, memory_order __x, 
+			       memory_order __y) volatile
+    { return atomic_address::compare_swap(*reinterpret_cast<void**>(&__r),
+					  static_cast<void*>(__v), __x, __y); }
+
+  template<typename _Tp>
+    bool 
+    atomic<_Tp*>::compare_swap(_Tp*& __r, _Tp* __v, memory_order __x) volatile
+    { 
+      const bool __cond1 = __x == memory_order_release;
+      const bool __cond2 = __x == memory_order_acq_rel;
+      memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+      memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+      return compare_swap(__r, __v, __x, __mo2);
+    }
+
+  template<typename _Tp>
+    _Tp* 
+    atomic<_Tp*>::fetch_add(ptrdiff_t __v, memory_order __x) volatile
+    { 
+      void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __v, __x);
+      return static_cast<_Tp*>(__p);
+    }
+
+  template<typename _Tp>
+    _Tp* 
+    atomic<_Tp*>::fetch_sub(ptrdiff_t __v, memory_order __x) volatile
+    { 
+      void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __v, __x); 
+      return static_cast<_Tp*>(__p);    
+    }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+
diff --git a/libstdc++-v3/include/ext/typelist.h b/libstdc++-v3/include/ext/typelist.h
index b7cd95434e6c..03f28a783234 100644
--- a/libstdc++-v3/include/ext/typelist.h
+++ b/libstdc++-v3/include/ext/typelist.h
@@ -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
     {
diff --git a/libstdc++-v3/libmath/Makefile.in b/libstdc++-v3/libmath/Makefile.in
index f423f83e53e0..c2302be25a7f 100644
--- a/libstdc++-v3/libmath/Makefile.in
+++ b/libstdc++-v3/libmath/Makefile.in
@@ -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 \
diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in
index 7453d3da8f18..631a3f3fa0dc 100644
--- a/libstdc++-v3/libsupc++/Makefile.in
+++ b/libstdc++-v3/libsupc++/Makefile.in
@@ -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 \
diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in
index e6a32044d1f9..c7ce1cafb327 100644
--- a/libstdc++-v3/po/Makefile.in
+++ b/libstdc++-v3/po/Makefile.in
@@ -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 \
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 7bd12aa1f609..e6c0aad184a8 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -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.
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index 450e97f95386..744833f75c28 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -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
diff --git a/libstdc++-v3/src/atomic.cc b/libstdc++-v3/src/atomic.cc
new file mode 100644
index 000000000000..e43733332db3
--- /dev/null
+++ b/libstdc++-v3/src/atomic.cc
@@ -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
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc
index 1bc1e6acd7af..6c30410bb6f7 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
new file mode 100644
index 000000000000..435309860a33
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
@@ -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" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
new file mode 100644
index 000000000000..011933a8eb8b
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
@@ -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" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc
new file mode 100644
index 000000000000..c8af19ad2ed8
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc
new file mode 100644
index 000000000000..da91e26a55da
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc
new file mode 100644
index 000000000000..5dafd093a016
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc
@@ -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*>;
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc
new file mode 100644
index 000000000000..f6aee27ce51b
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
new file mode 100644
index 000000000000..ef50b9ed38fe
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
@@ -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 } 
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
new file mode 100644
index 000000000000..57732d833355
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
@@ -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 } 
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc
new file mode 100644
index 000000000000..1d2c6cba50b5
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc
new file mode 100644
index 000000000000..b455bf667cdc
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc
new file mode 100644
index 000000000000..7ee633ebb32a
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc
new file mode 100644
index 000000000000..151d85fc0506
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
new file mode 100644
index 000000000000..5f8ff15dc522
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
@@ -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 } 
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
new file mode 100644
index 000000000000..3480d8c5e16e
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
@@ -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 } 
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc
new file mode 100644
index 000000000000..b4fa3a755b2c
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc
new file mode 100644
index 000000000000..351df912fff5
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c
new file mode 100644
index 000000000000..9401af4d13b6
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc
new file mode 100644
index 000000000000..c81a75aa99a6
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c
new file mode 100644
index 000000000000..727421bd12f3
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc
new file mode 100644
index 000000000000..82961767e86a
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc
new file mode 100644
index 000000000000..5444d71f378e
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc
new file mode 100644
index 000000000000..62f76ab1f0e3
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc
@@ -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
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc
new file mode 100644
index 000000000000..f72e8136a58a
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc
@@ -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 } 
+
+
+
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc
new file mode 100644
index 000000000000..31b32c138136
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c
new file mode 100644
index 000000000000..1282c0df9064
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
new file mode 100644
index 000000000000..30368a06bf4b
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c
new file mode 100644
index 000000000000..8e9cfd56e017
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in
index 44749597aef8..63d92370dcb0 100644
--- a/libstdc++-v3/testsuite/Makefile.in
+++ b/libstdc++-v3/testsuite/Makefile.in
@@ -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 \
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index b482bf58d205..5f68d789d6da 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -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"
diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h
index 78fe1fe7fcaa..bd9e76d4e2e4 100644
--- a/libstdc++-v3/testsuite/util/testsuite_common_types.h
+++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h
@@ -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
 
 
-- 
GitLab