diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 407076111606e7023da25dd4af79bbf254261c94..36149efdf27d8ab11e17b3db718de57c48b79930 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,79 @@
+2008-12-11  Benjamin Kosnik  <bkoz@redhat.com>
+	    Richard Henderson  <rth@redhat.com>
+
+	* include/c_global/cstdatomic: Update to N2798.
+	(atomic): Remove explicit constructors as per DR 845.
+	* include/bits/atomic_0.h: New. Switchable implementation.
+	* include/bits/atomic_2.h: New. Lock-free implementation.
+	* include/c_compatibility/stdatomic.h: Use foward headers.
+	* include/bits/atomicfwd_cxx.h: New.
+	* include/bits/atomicfwd_c.h: New.
+	* src/atomic.cc: Adjust.
+	* acinclude.m4 (GLIBCXX_CHECK_STANDARD_LAYOUT): Remove,
+	unconditionally use default/deleted syntax.
+	(GLIBCXX_ENABLE_ATOMIC_BUILTINS): Check for 2, 8.
+	* include/Makefile.am (bits_headers): Add atomicfwd_c.h,
+	atomicfwd_cxx.h, atomic_0.h, atomic_2.h.
+	* include/Makefile.in: Regenerate.
+	* configure: Regenerate.
+	* config.h.in: Regenerate.
+	* config/abi/pre/gnu.ver: Adjust exports.
+
+	* testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc: Adjust.
+	* testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc: Same.
+	* testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc: Same.
+	* testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same.
+	* testsuite/29_atomics/atomic_address/cons/explicit_value.cc: Move to..
+	* testsuite/29_atomics/atomic_address/cons/single_value.cc: ...this.
+	* testsuite/29_atomics/atomic_address/cons/copy_neg.cc
+	* testsuite/29_atomics/atomic_integral/cons/single_value.cc: New.
+	* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: New.
+	* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: New.
+	* testsuite/29_atomics/atomic_integral/cons/default.cc: New.
+	* testsuite/29_atomics/atomic_integral/cons/direct_list.cc: New.
+	* testsuite/29_atomics/atomic_integral/cons/copy_list.cc: New.
+	* testsuite/29_atomics/atomic_integral/requirements/
+	standard_layout.cc: New.
+	* testsuite/29_atomics/atomic_integral/operators/
+	integral_assignment.cc: New.
+	* testsuite/29_atomics/atomic_integral/operators/increment_neg.cc: New.
+	* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: New.
+	* testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc: New.
+	* testsuite/29_atomics/atomic_integral/operators/increment.cc: New.
+	* testsuite/29_atomics/atomic_integral/operators/decrement.cc: New.
+	* testsuite/29_atomics/atomic_integral/operators/bitwise.cc: New.
+	* testsuite/29_atomics/atomic_integral/operators/
+	integral_conversion.cc: New.
+	* testsuite/29_atomics/atomic_flag/cons/assign_neg.cc: Adjust.
+	* testsuite/29_atomics/atomic_flag/cons/copy_neg.cc: Same.
+	* testsuite/29_atomics/atomic_flag/requirements/
+	standard_layout.cc: Same.
+	* testsuite/29_atomics/atomic_flag/
+	atomic_global_fence_compatibility.cc: Kill.
+	* testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc: Adjust.
+	* testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc: Same.
+	* testsuite/29_atomics/headers/cstdatomic/macros.cc: Same.
+	* testsuite/29_atomics/headers/stdatomic.h/macros.c: Same.
+	* testsuite/29_atomics/headers/stdatomic.h/types.c: Same.
+	* testsuite/29_atomics/atomic/cons/assign_neg.cc: Same.
+	* testsuite/29_atomics/atomic/cons/explicit_value.cc: Move to...
+	* testsuite/29_atomics/atomic/cons/single_value.cc: ...this.
+	* testsuite/29_atomics/atomic/cons/copy_neg.cc
+	* testsuite/29_atomics/atomic/cons/direct_list.cc: New.
+	* testsuite/29_atomics/atomic/cons/copy_list.cc: New.
+	* testsuite/29_atomics/atomic/requirements/standard_layout.cc: New.
+	* testsuite/29_atomics/atomic/requirements/base_classes.cc: New.
+	* testsuite/29_atomics/atomic/operators/integral_assignment.cc: New.
+	* testsuite/29_atomics/atomic/operators/integral_conversion.cc: New.
+	* testsuite/util/testsuite_hooks.h (bitmask_operators): Move...
+	* testsuite/util/testsuite_common_types.h: ...here.
+	(atomic_integrals_no_bool): New.
+	(atomic_integrals): New.
+	(has_increment_operators, has_decrement_operators)
+	(direct_list_initializable, single_value_constructible)
+	(standard_layout, has_bitwise_operators, integral_convertable)
+	(integral_assignable): Add.
+
 2008-12-11  Jakub Jelinek  <jakub@redhat.com>
 
 	PR c++/37582
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index f4a83460aa9a4fd6298f1dda7517d0921b31b58f..a1356bd7b06cb33dfdd122b114cdd4ec100e28f8 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1676,41 +1676,6 @@ m4_popdef([SYSERR])dnl
 m4_popdef([n_syserr])dnl
 ])
 
-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&);
-		    };],
-		 [b tst1 = { false };],
-		 [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
@@ -2456,7 +2421,9 @@ dnl see: CHECK_SYNC_FETCH_AND_ADD
 dnl
 dnl Defines:
 dnl  _GLIBCXX_ATOMIC_BUILTINS_1 
+dnl  _GLIBCXX_ATOMIC_BUILTINS_2
 dnl  _GLIBCXX_ATOMIC_BUILTINS_4
+dnl  _GLIBCXX_ATOMIC_BUILTINS_8
 dnl
 AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
   AC_LANG_SAVE
@@ -2472,6 +2439,66 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
     cat > conftest.$ac_ext << EOF
 [#]line __oline__ "configure"
 int main()
+{
+  typedef bool atomic_type;
+  atomic_type c1;
+  atomic_type c2;
+  const atomic_type c3(0);
+  __sync_fetch_and_add(&c1, c2);
+  __sync_val_compare_and_swap(&c1, c3, c2);
+  __sync_lock_test_and_set(&c1, c3);
+  __sync_lock_release(&c1);
+  __sync_synchronize();
+  return 0;
+}
+EOF
+
+    AC_MSG_CHECKING([for atomic builtins for bool])
+    if AC_TRY_EVAL(ac_compile); then
+      if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+        enable_atomic_builtinsb=no
+      else
+      AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
+      [Define if builtin atomic operations for bool are supported on this host.])
+        enable_atomic_builtinsb=yes
+      fi
+    fi
+    AC_MSG_RESULT($enable_atomic_builtinsb)
+    rm -f conftest*
+
+    cat > conftest.$ac_ext << EOF
+[#]line __oline__ "configure"
+int main()
+{
+  typedef short atomic_type;
+  atomic_type c1;
+  atomic_type c2;
+  const atomic_type c3(0);
+  __sync_fetch_and_add(&c1, c2);
+  __sync_val_compare_and_swap(&c1, c3, c2);
+  __sync_lock_test_and_set(&c1, c3);
+  __sync_lock_release(&c1);
+  __sync_synchronize();
+  return 0;
+}
+EOF
+
+    AC_MSG_CHECKING([for atomic builtins for short])
+    if AC_TRY_EVAL(ac_compile); then
+      if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+        enable_atomic_builtinss=no
+      else
+      AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
+      [Define if builtin atomic operations for short are supported on this host.])
+        enable_atomic_builtinss=yes
+      fi
+    fi
+    AC_MSG_RESULT($enable_atomic_builtinss)
+    rm -f conftest*
+
+    cat > conftest.$ac_ext << EOF
+[#]line __oline__ "configure"
+int main()
 {
   // NB: _Atomic_word not necessarily int. 
   typedef int atomic_type;
@@ -2504,7 +2531,7 @@ EOF
 [#]line __oline__ "configure"
 int main()
 {
-  typedef bool atomic_type;
+  typedef long long atomic_type;
   atomic_type c1;
   atomic_type c2;
   const atomic_type c3(0);
@@ -2517,19 +2544,20 @@ int main()
 }
 EOF
 
-    AC_MSG_CHECKING([for atomic builtins for bool])
+    AC_MSG_CHECKING([for atomic builtins for long long])
     if AC_TRY_EVAL(ac_compile); then
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
-        enable_atomic_builtinsb=no
+        enable_atomic_builtinsll=no
       else
-      AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
-      [Define if builtin atomic operations for bool are supported on this host.])
-        enable_atomic_builtinsb=yes
+      AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
+      [Define if builtin atomic operations for long long are supported on this host.])
+        enable_atomic_builtinsll=yes
       fi
     fi
-    AC_MSG_RESULT($enable_atomic_builtinsb)
+    AC_MSG_RESULT($enable_atomic_builtinsll)
     rm -f conftest*
 
+
   CXXFLAGS="$old_CXXFLAGS"
   AC_LANG_RESTORE
 
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 0cf3518b6399d318bd46eeecb86c79437b280b90..55edd8c20b47d95dec4623b8ac6a601d911cf5ba 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -692,9 +692,17 @@
 /* Define if builtin atomic operations for bool are supported on this host. */
 #undef _GLIBCXX_ATOMIC_BUILTINS_1
 
+/* Define if builtin atomic operations for short are supported on this host.
+   */
+#undef _GLIBCXX_ATOMIC_BUILTINS_2
+
 /* Define if builtin atomic operations for int are supported on this host. */
 #undef _GLIBCXX_ATOMIC_BUILTINS_4
 
+/* Define if builtin atomic operations for long long are supported on this
+   host. */
+#undef _GLIBCXX_ATOMIC_BUILTINS_8
+
 /* Define to use concept checking code from the boost libraries. */
 #undef _GLIBCXX_CONCEPT_CHECKS
 
@@ -804,9 +812,6 @@
    of 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 04262bae32cdc64fedcfd604ac02b55d1c0009db..477604a095510100d61261650baca73565b8559c 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -866,13 +866,11 @@ 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;
-    
+    _ZNVSt9__atomic011atomic_flag12test_and_setESt12memory_order;
+    _ZNVSt9__atomic011atomic_flag5clearESt12memory_order;
+
     # mutex
     _ZSt10adopt_lock;
     _ZSt10defer_lock;
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 23b050032d557ee13366bc639147e2e8be5582f6..a90c29dae6619bf6410c6f5bb9abd26efee1304c 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -14711,6 +14711,84 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
     cat > conftest.$ac_ext << EOF
 #line 14712 "configure"
 int main()
+{
+  typedef bool atomic_type;
+  atomic_type c1;
+  atomic_type c2;
+  const atomic_type c3(0);
+  __sync_fetch_and_add(&c1, c2);
+  __sync_val_compare_and_swap(&c1, c3, c2);
+  __sync_lock_test_and_set(&c1, c3);
+  __sync_lock_release(&c1);
+  __sync_synchronize();
+  return 0;
+}
+EOF
+
+    echo "$as_me:$LINENO: checking for atomic builtins for bool" >&5
+echo $ECHO_N "checking for atomic builtins for bool... $ECHO_C" >&6
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+        enable_atomic_builtinsb=no
+      else
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_ATOMIC_BUILTINS_1 1
+_ACEOF
+
+        enable_atomic_builtinsb=yes
+      fi
+    fi
+    echo "$as_me:$LINENO: result: $enable_atomic_builtinsb" >&5
+echo "${ECHO_T}$enable_atomic_builtinsb" >&6
+    rm -f conftest*
+
+    cat > conftest.$ac_ext << EOF
+#line 14751 "configure"
+int main()
+{
+  typedef short atomic_type;
+  atomic_type c1;
+  atomic_type c2;
+  const atomic_type c3(0);
+  __sync_fetch_and_add(&c1, c2);
+  __sync_val_compare_and_swap(&c1, c3, c2);
+  __sync_lock_test_and_set(&c1, c3);
+  __sync_lock_release(&c1);
+  __sync_synchronize();
+  return 0;
+}
+EOF
+
+    echo "$as_me:$LINENO: checking for atomic builtins for short" >&5
+echo $ECHO_N "checking for atomic builtins for short... $ECHO_C" >&6
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+        enable_atomic_builtinss=no
+      else
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_ATOMIC_BUILTINS_2 1
+_ACEOF
+
+        enable_atomic_builtinss=yes
+      fi
+    fi
+    echo "$as_me:$LINENO: result: $enable_atomic_builtinss" >&5
+echo "${ECHO_T}$enable_atomic_builtinss" >&6
+    rm -f conftest*
+
+    cat > conftest.$ac_ext << EOF
+#line 14790 "configure"
+int main()
 {
   // NB: _Atomic_word not necessarily int.
   typedef int atomic_type;
@@ -14749,10 +14827,10 @@ echo "${ECHO_T}$enable_atomic_builtinsi" >&6
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 14752 "configure"
+#line 14830 "configure"
 int main()
 {
-  typedef bool atomic_type;
+  typedef long long atomic_type;
   atomic_type c1;
   atomic_type c2;
   const atomic_type c3(0);
@@ -14765,28 +14843,29 @@ int main()
 }
 EOF
 
-    echo "$as_me:$LINENO: checking for atomic builtins for bool" >&5
-echo $ECHO_N "checking for atomic builtins for bool... $ECHO_C" >&6
+    echo "$as_me:$LINENO: checking for atomic builtins for long long" >&5
+echo $ECHO_N "checking for atomic builtins for long long... $ECHO_C" >&6
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
-        enable_atomic_builtinsb=no
+        enable_atomic_builtinsll=no
       else
 
 cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_ATOMIC_BUILTINS_1 1
+#define _GLIBCXX_ATOMIC_BUILTINS_8 1
 _ACEOF
 
-        enable_atomic_builtinsb=yes
+        enable_atomic_builtinsll=yes
       fi
     fi
-    echo "$as_me:$LINENO: result: $enable_atomic_builtinsb" >&5
-echo "${ECHO_T}$enable_atomic_builtinsb" >&6
+    echo "$as_me:$LINENO: result: $enable_atomic_builtinsll" >&5
+echo "${ECHO_T}$enable_atomic_builtinsll" >&6
     rm -f conftest*
 
+
   CXXFLAGS="$old_CXXFLAGS"
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -14939,100 +15018,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-
-
-  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;
-}
-_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
-
+GLIBCXX_CHECK_STANDARD_LAYOUT
 
 # Enable all the variable C++ runtime options that don't require linking.
 
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 0a2a7a5095dbd1f83d987657f2d7b19ba8c2f92d..5205e704d92e10a86ab0bf07f2258a31a4eefc24 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -78,6 +78,10 @@ bits_builddir = ./bits
 bits_headers = \
         ${bits_srcdir}/algorithmfwd.h \
 	${bits_srcdir}/allocator.h \
+	${bits_srcdir}/atomicfwd_c.h \
+	${bits_srcdir}/atomicfwd_cxx.h \
+	${bits_srcdir}/atomic_0.h \
+	${bits_srcdir}/atomic_2.h \
 	${bits_srcdir}/basic_ios.h \
 	${bits_srcdir}/basic_ios.tcc \
 	${bits_srcdir}/basic_string.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 72404f802f7c3e960ccbb57da6150c17065d6cd6..c36ce6698f3447bd62f076007ca71a8fa2c6ae81 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -344,6 +344,10 @@ bits_builddir = ./bits
 bits_headers = \
         ${bits_srcdir}/algorithmfwd.h \
 	${bits_srcdir}/allocator.h \
+	${bits_srcdir}/atomicfwd_c.h \
+	${bits_srcdir}/atomicfwd_cxx.h \
+	${bits_srcdir}/atomic_0.h \
+	${bits_srcdir}/atomic_2.h \
 	${bits_srcdir}/basic_ios.h \
 	${bits_srcdir}/basic_ios.tcc \
 	${bits_srcdir}/basic_string.h \
diff --git a/libstdc++-v3/include/bits/atomic_0.h b/libstdc++-v3/include/bits/atomic_0.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd00b4a76d17cb90421ac6c9204e0494174330c8
--- /dev/null
+++ b/libstdc++-v3/include/bits/atomic_0.h
@@ -0,0 +1,471 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file bits/atomic_0.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_ATOMIC_0_H
+#define _GLIBCXX_ATOMIC_0_H 1
+
+#pragma GCC system_header
+
+// _GLIBCXX_BEGIN_NAMESPACE(std)
+
+  // 0 == __atomic0 == Never lock-free
+namespace __atomic0
+{
+  struct atomic_flag;
+
+  // Implementation specific defines.
+#define _ATOMIC_LOAD_(__a, __x)						   \
+  ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_;	   \
+    volatile __atomic_flag_base* __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_base* __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_base* __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_CMPEXCHNG_(__a, __e, __m, __x)				   \
+  ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_;	   \
+    __typeof__(__e) __q = (__e);			       		   \
+    __typeof__(__m) __v = (__m);			       		   \
+    bool __r;						       		   \
+    volatile __atomic_flag_base* __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; })
+
+  /// atomic_flag
+  struct atomic_flag : private __atomic_flag_base
+  {
+    atomic_flag() = default;
+    ~atomic_flag() = default;
+    atomic_flag(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) = delete;
+
+    atomic_flag(bool __i) { _M_i = __i; } // XXX deleted copy ctor != agg
+
+    bool
+    test_and_set(memory_order __m = memory_order_seq_cst) volatile;
+
+    void
+    clear(memory_order __m = memory_order_seq_cst) volatile;
+  };
+
+  /// 29.4.2, address types
+  struct atomic_address
+  {
+  private:
+    void* _M_i;
+
+  public:
+    atomic_address() = default;
+    ~atomic_address() = default;
+    atomic_address(const atomic_address&) = delete;
+    atomic_address& operator=(const atomic_address&) = delete;
+
+    atomic_address(void* __v) { _M_i = __v; }
+
+    bool
+    is_lock_free() const volatile
+    { return false; }
+
+    void
+    store(void* __v, memory_order __m = memory_order_seq_cst) volatile
+    {
+      // XXX
+      //if (__m != memory_order_acquire && __m != memory_order_acq_rel
+      // && __m != memory_order_consume)
+      _ATOMIC_STORE_(this, __v, __m);
+    }
+
+    void*
+    load(memory_order __m = memory_order_seq_cst) const volatile
+    {
+      // XXX
+      //if (__m != memory_order_release && __m != memory_order_acq_rel)
+      return _ATOMIC_LOAD_(this, __m);
+    }
+
+    void*
+    exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile
+    { return _ATOMIC_MODIFY_(this, =, __v, __m); }
+
+    bool
+    compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
+			  memory_order __m2) volatile
+    {
+      bool __ret = false;
+      if (__m2 != memory_order_release && __m2 != memory_order_acq_rel
+	  && __m2 <= __m1)
+	__ret = _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+      return __ret;
+    }
+
+    bool
+    compare_exchange_weak(void*& __v1, void* __v2,
+			  memory_order __m = memory_order_seq_cst) volatile
+    {
+      return compare_exchange_weak(__v1, __v2, __m,
+				   __calculate_memory_order(__m));
+    }
+
+    bool
+    compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
+			    memory_order __m2) volatile
+    {
+      bool __ret = false;
+      if (__m2 != memory_order_release && __m2 != memory_order_acq_rel
+	  && __m2 <= __m1)
+	__ret = _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+      return __ret;
+    }
+
+    bool
+    compare_exchange_strong(void*& __v1, void* __v2,
+			  memory_order __m = memory_order_seq_cst) volatile
+    {
+      return compare_exchange_strong(__v1, __v2, __m,
+				     __calculate_memory_order(__m));
+    }
+
+    void*
+    fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+    {
+      void* volatile* __p = &(_M_i);
+      volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p);
+      __atomic_flag_wait_explicit(__g, __m);
+      void* __r = *__p;
+      *__p = (void*)((char*)(*__p) + __d);
+      atomic_flag_clear_explicit(__g, __m);
+      return __r;
+    }
+
+    void*
+    fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+    {
+      void* volatile* __p = &(_M_i);
+      volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p);
+      __atomic_flag_wait_explicit(__g, __m);
+      void* __r = *__p;
+      *__p = (void*)((char*)(*__p) - __d);
+      atomic_flag_clear_explicit(__g, __m);
+      return __r;
+    }
+
+    operator void*() const volatile
+    { return load(); }
+
+    void*
+    operator=(void* __v) // XXX volatile
+    {
+      store(__v);
+      return __v;
+    }
+
+    void*
+    operator+=(ptrdiff_t __d) volatile
+    { return fetch_add(__d) + __d; }
+
+    void*
+    operator-=(ptrdiff_t __d) volatile
+    { return fetch_sub(__d) - __d; }
+  };
+
+
+  // 29.3.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
+
+  // Base type.
+  // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or 8 bytes,
+  // since that is what GCC built-in functions for atomic memory access work on.
+  template<typename _ITp>
+    struct __atomic_base
+    {
+    private:
+      typedef _ITp 	__integral_type;
+
+      __integral_type 	_M_i;
+
+    public:
+      __atomic_base() = default;
+      ~__atomic_base() = default;
+      __atomic_base(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) = delete;
+
+      // Requires __integral_type convertible to _M_base._M_i.
+      __atomic_base(__integral_type __i) { _M_i = __i; }
+
+      operator __integral_type() const volatile
+      { return load(); }
+
+      __integral_type
+      operator=(__integral_type __i) // XXX volatile
+      {
+	store(__i);
+	return __i;
+      }
+
+      __integral_type
+      operator++(int) volatile
+      { return fetch_add(1); }
+
+      __integral_type
+      operator--(int) volatile
+      { return fetch_sub(1); }
+
+      __integral_type
+      operator++() volatile
+      { return fetch_add(1) + 1; }
+
+      __integral_type
+      operator--() volatile
+      { return fetch_sub(1) - 1; }
+
+      __integral_type
+      operator+=(__integral_type __i) volatile
+      { return fetch_add(__i) + __i; }
+
+      __integral_type
+      operator-=(__integral_type __i) volatile
+      { return fetch_sub(__i) - __i; }
+
+      __integral_type
+      operator&=(__integral_type __i) volatile
+      { return fetch_and(__i) & __i; }
+
+      __integral_type
+      operator|=(__integral_type __i) volatile
+      { return fetch_or(__i) | __i; }
+
+      __integral_type
+      operator^=(__integral_type __i) volatile
+      { return fetch_xor(__i) ^ __i; }
+
+      bool
+      is_lock_free() const volatile
+      { return false; }
+
+      void
+      store(__integral_type __i,
+	    memory_order __m = memory_order_seq_cst) volatile
+      {
+	// XXX
+	//if (__m != memory_order_acquire && __m != memory_order_acq_rel
+	//  && __m != memory_order_consume)
+	_ATOMIC_STORE_(this, __i, __m);
+      }
+
+      __integral_type
+      load(memory_order __m = memory_order_seq_cst) const volatile
+      {
+	// if (__m != memory_order_release && __m != memory_order_acq_rel)
+	return _ATOMIC_LOAD_(this, __m);
+      }
+
+      __integral_type
+      exchange(__integral_type __i,
+	       memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, =, __i, __m); }
+
+      bool
+      compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+			    memory_order __m1, memory_order __m2) volatile
+      {
+	bool __ret = false;
+	if (__m2 != memory_order_release && __m2 != memory_order_acq_rel
+	    && __m2 <= __m1)
+	  __ret = _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
+	return __ret;
+      }
+
+      bool
+      compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+			    memory_order __m = memory_order_seq_cst) volatile
+      {
+	return compare_exchange_weak(__i1, __i2, __m,
+				     __calculate_memory_order(__m));
+      }
+
+      bool
+      compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+			      memory_order __m1, memory_order __m2) volatile
+      {
+	bool __ret = false;
+	if (__m2 != memory_order_release && __m2 != memory_order_acq_rel
+	    && __m2 <= __m1)
+	  __ret = _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
+	return __ret;
+      }
+
+      bool
+      compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+			      memory_order __m = memory_order_seq_cst) volatile
+      {
+	return compare_exchange_strong(__i1, __i2, __m,
+				       __calculate_memory_order(__m));
+      }
+
+      __integral_type
+      fetch_add(__integral_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
+
+      __integral_type
+      fetch_sub(__integral_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
+
+      __integral_type
+      fetch_and(__integral_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
+
+      __integral_type
+      fetch_or(__integral_type __i,
+	       memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
+
+      __integral_type
+      fetch_xor(__integral_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
+    };
+
+
+  /// atomic_bool
+  // NB: No operators or fetch-operations for this type.
+  struct atomic_bool
+  {
+  private:
+    __atomic_base<bool>	_M_base;
+
+  public:
+    atomic_bool() = default;
+    ~atomic_bool() = default;
+    atomic_bool(const atomic_bool&) = delete;
+    atomic_bool& operator=(const atomic_bool&) = delete;
+
+    atomic_bool(bool __i) : _M_base(__i) { }
+
+    bool
+    operator=(bool __i) // XXX volatile
+    { return _M_base.operator=(__i); }
+
+    operator bool() const volatile
+    { return _M_base.load(); }
+
+    bool
+    is_lock_free() const volatile
+    { return _M_base.is_lock_free(); }
+
+    void
+    store(bool __i, memory_order __m = memory_order_seq_cst) volatile
+    { _M_base.store(__i, __m); }
+
+    bool
+    load(memory_order __m = memory_order_seq_cst) const volatile
+    { return _M_base.load(__m); }
+
+    bool
+    exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile
+    { return _M_base.exchange(__i, __m); }
+
+    bool
+    compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
+			  memory_order __m2) volatile
+    { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
+
+    bool
+    compare_exchange_weak(bool& __i1, bool __i2,
+			  memory_order __m = memory_order_seq_cst) volatile
+    { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
+
+    bool
+    compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
+			    memory_order __m2) volatile
+    { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+
+    bool
+    compare_exchange_strong(bool& __i1, bool __i2,
+			    memory_order __m = memory_order_seq_cst) volatile
+    { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
+  };
+
+#undef _ATOMIC_LOAD_
+#undef _ATOMIC_STORE_
+#undef _ATOMIC_MODIFY_
+#undef _ATOMIC_CMPEXCHNG_
+} // namespace __atomic0
+
+// _GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/libstdc++-v3/include/bits/atomic_2.h b/libstdc++-v3/include/bits/atomic_2.h
new file mode 100644
index 0000000000000000000000000000000000000000..48eda413cde22e161fb7b4ef3b18a6d4be120805
--- /dev/null
+++ b/libstdc++-v3/include/bits/atomic_2.h
@@ -0,0 +1,456 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file bits/atomic_2.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_ATOMIC_2_H
+#define _GLIBCXX_ATOMIC_2_H 1
+
+#pragma GCC system_header
+
+#include <cassert> // XXX static_assert vs. constant-expression PR38502
+
+// _GLIBCXX_BEGIN_NAMESPACE(std)
+
+// 2 == __atomic2 == Always lock-free
+// Assumed:
+// _GLIBCXX_ATOMIC_BUILTINS_1
+// _GLIBCXX_ATOMIC_BUILTINS_2
+// _GLIBCXX_ATOMIC_BUILTINS_4
+// _GLIBCXX_ATOMIC_BUILTINS_8
+namespace __atomic2
+{
+  /// atomic_flag
+  struct atomic_flag : private __atomic_flag_base
+  {
+    atomic_flag() = default;
+    ~atomic_flag() = default;
+    atomic_flag(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) = delete;
+
+    atomic_flag(bool __i) { _M_i = __i; } // XXX deleted copy ctor != agg
+
+    bool
+    test_and_set(memory_order __m = memory_order_seq_cst) volatile
+    {
+      // Redundant synchronize if built-in for lock is a full barrier.
+      if (__m != memory_order_acquire && __m != memory_order_acq_rel)
+	__sync_synchronize();
+      return __sync_lock_test_and_set(&_M_i, 1);
+    }
+
+    void
+    clear(memory_order __m = memory_order_seq_cst) volatile
+    {
+      __sync_lock_release(&_M_i);
+      if (__m != memory_order_acquire && __m != memory_order_acq_rel)
+	__sync_synchronize();
+    }
+  };
+
+
+  /// 29.4.2, address types
+  struct atomic_address
+  {
+  private:
+    void* _M_i;
+
+  public:
+    atomic_address() = default;
+    ~atomic_address() = default;
+    atomic_address(const atomic_address&) = delete;
+    atomic_address& operator=(const atomic_address&) = delete;
+
+    atomic_address(void* __v) { _M_i = __v; }
+
+    bool
+    is_lock_free() const volatile
+    { return true; }
+
+    void
+    store(void* __v, memory_order __m = memory_order_seq_cst) volatile
+    {
+      assert(__m == memory_order_acquire);
+      assert(__m == memory_order_acq_rel);
+      assert(__m == memory_order_consume);
+
+      if (__m == memory_order_relaxed)
+	_M_i = __v;
+      else
+	{
+	  // write_mem_barrier();
+	  _M_i = __v;
+	  if (__m = memory_order_seq_cst)
+	    __sync_synchronize();
+	}
+    }
+
+    void*
+    load(memory_order __m = memory_order_seq_cst) const volatile
+    {
+      assert(__m == memory_order_release);
+      assert(__m == memory_order_acq_rel);
+
+      __sync_synchronize();
+      void* __ret = _M_i;
+      __sync_synchronize();
+      return __ret;
+    }
+
+    void*
+    exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile
+    {
+      // XXX built-in assumes memory_order_acquire.
+      return __sync_lock_test_and_set(&_M_i, __v);
+    }
+
+    bool
+    compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
+			  memory_order __m2) volatile
+    { return compare_exchange_strong(__v1, __v2, __m1, __m2); }
+
+    bool
+    compare_exchange_weak(void*& __v1, void* __v2,
+			  memory_order __m = memory_order_seq_cst) volatile
+    {
+      return compare_exchange_weak(__v1, __v2, __m,
+				   __calculate_memory_order(__m));
+    }
+
+    bool
+    compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
+			    memory_order __m2) volatile
+    {
+      assert(__m2 == memory_order_release);
+      assert(__m2 == memory_order_acq_rel);
+      assert(__m2 <= __m1);
+
+      void* __v1o = __v1;
+      void* __v1n = __sync_val_compare_and_swap(&_M_i, __v1o, __v2);
+
+      // Assume extra stores (of same value) allowed in true case.
+      __v1 = __v1n;
+      return __v1o == __v1n;
+    }
+
+    bool
+    compare_exchange_strong(void*& __v1, void* __v2,
+			  memory_order __m = memory_order_seq_cst) volatile
+    {
+      return compare_exchange_strong(__v1, __v2, __m,
+				     __calculate_memory_order(__m));
+    }
+
+    void*
+    fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+    { return __sync_fetch_and_add(&_M_i, __d); }
+
+    void*
+    fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+    { return __sync_fetch_and_sub(&_M_i, __d); }
+
+    operator void*() const volatile
+    { return load(); }
+
+    void*
+    operator=(void* __v) // XXX volatile
+    {
+      store(__v);
+      return __v;
+    }
+
+    void*
+    operator+=(ptrdiff_t __d) volatile
+    { return __sync_add_and_fetch(&_M_i, __d); }
+
+    void*
+    operator-=(ptrdiff_t __d) volatile
+    { return __sync_sub_and_fetch(&_M_i, __d); }
+  };
+
+  // 29.3.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
+
+  // Base type.
+  // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or 8 bytes,
+  // since that is what GCC built-in functions for atomic memory access work on.
+  template<typename _ITp>
+    struct __atomic_base
+    {
+    private:
+      typedef _ITp 	__integral_type;
+
+      __integral_type 	_M_i;
+
+    public:
+      __atomic_base() = default;
+      ~__atomic_base() = default;
+      __atomic_base(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) = delete;
+
+      // Requires __integral_type convertible to _M_base._M_i.
+      __atomic_base(__integral_type __i) { _M_i = __i; }
+
+      operator __integral_type() const volatile
+      { return load(); }
+
+      __integral_type
+      operator=(__integral_type __i) // XXX volatile
+      {
+	store(__i);
+	return __i;
+      }
+
+      __integral_type
+      operator++(int) volatile
+      { return fetch_add(1); }
+
+      __integral_type
+      operator--(int) volatile
+      { return fetch_sub(1); }
+
+      __integral_type
+      operator++() volatile
+      { return __sync_add_and_fetch(&_M_i, 1); }
+
+      __integral_type
+      operator--() volatile
+      { return __sync_sub_and_fetch(&_M_i, 1); }
+
+      __integral_type
+      operator+=(__integral_type __i) volatile
+      { return __sync_add_and_fetch(&_M_i, __i); }
+
+      __integral_type
+      operator-=(__integral_type __i) volatile
+      { return __sync_sub_and_fetch(&_M_i, __i); }
+
+      __integral_type
+      operator&=(__integral_type __i) volatile
+      { return __sync_and_and_fetch(&_M_i, __i); }
+
+      __integral_type
+      operator|=(__integral_type __i) volatile
+      { return __sync_or_and_fetch(&_M_i, __i); }
+
+      __integral_type
+      operator^=(__integral_type __i) volatile
+      { return __sync_xor_and_fetch(&_M_i, __i); }
+
+      bool
+      is_lock_free() const volatile
+      { return true; }
+
+      void
+      store(__integral_type __i,
+	    memory_order __m = memory_order_seq_cst) volatile
+      {
+	assert(__m == memory_order_acquire);
+	assert(__m == memory_order_acq_rel);
+	assert(__m == memory_order_consume);
+
+	if (__m == memory_order_relaxed)
+	  _M_i = __i;
+	else
+	  {
+	    // write_mem_barrier();
+	    _M_i = __i;
+	    if (__m = memory_order_seq_cst)
+	      __sync_synchronize();
+	  }
+      }
+
+      __integral_type
+      load(memory_order __m = memory_order_seq_cst) const volatile
+      {
+	assert(__m == memory_order_release);
+	assert(__m == memory_order_acq_rel);
+
+	__sync_synchronize();
+	__integral_type __ret = _M_i;
+	__sync_synchronize();
+	return __ret;
+      }
+
+      __integral_type
+      exchange(__integral_type __i,
+	       memory_order __m = memory_order_seq_cst) volatile
+      {
+	// XXX built-in assumes memory_order_acquire.
+	return __sync_lock_test_and_set(&_M_i, __i);
+      }
+
+      bool
+      compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+			    memory_order __m1, memory_order __m2) volatile
+      { return compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+      bool
+      compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+			    memory_order __m = memory_order_seq_cst) volatile
+      {
+	return compare_exchange_weak(__i1, __i2, __m,
+				     __calculate_memory_order(__m));
+      }
+
+      bool
+      compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+			      memory_order __m1, memory_order __m2) volatile
+      {
+	assert(__m2 == memory_order_release);
+	assert(__m2 == memory_order_acq_rel);
+	assert(__m2 <= __m1);
+
+	__integral_type __i1o = __i1;
+	__integral_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
+
+	// Assume extra stores (of same value) allowed in true case.
+	__i1 = __i1n;
+	return __i1o == __i1n;
+      }
+
+      bool
+      compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+			      memory_order __m = memory_order_seq_cst) volatile
+      {
+	return compare_exchange_strong(__i1, __i2, __m,
+				       __calculate_memory_order(__m));
+      }
+
+      __integral_type
+      fetch_add(__integral_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_add(&_M_i, __i); }
+
+      __integral_type
+      fetch_sub(__integral_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_sub(&_M_i, __i); }
+
+      __integral_type
+      fetch_and(__integral_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_and(&_M_i, __i); }
+
+      __integral_type
+      fetch_or(__integral_type __i,
+	       memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_or(&_M_i, __i); }
+
+      __integral_type
+      fetch_xor(__integral_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_xor(&_M_i, __i); }
+    };
+
+
+  /// atomic_bool
+  // NB: No operators or fetch-operations for this type.
+  struct atomic_bool
+  {
+  private:
+    __atomic_base<bool>	_M_base;
+
+  public:
+    atomic_bool() = default;
+    ~atomic_bool() = default;
+    atomic_bool(const atomic_bool&) = delete;
+    atomic_bool& operator=(const atomic_bool&) = delete;
+
+    atomic_bool(bool __i) : _M_base(__i) { }
+
+    bool
+    operator=(bool __i) // XXX volatile
+    { return _M_base.operator=(__i); }
+
+    operator bool() const volatile
+    { return _M_base.load(); }
+
+    bool
+    is_lock_free() const volatile
+    { return _M_base.is_lock_free(); }
+
+    void
+    store(bool __i, memory_order __m = memory_order_seq_cst) volatile
+    { _M_base.store(__i, __m); }
+
+    bool
+    load(memory_order __m = memory_order_seq_cst) const volatile
+    { return _M_base.load(__m); }
+
+    bool
+    exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile
+    { return _M_base.exchange(__i, __m); }
+
+    bool
+    compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
+			  memory_order __m2) volatile
+    { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
+
+    bool
+    compare_exchange_weak(bool& __i1, bool __i2,
+			  memory_order __m = memory_order_seq_cst) volatile
+    { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
+
+    bool
+    compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
+			    memory_order __m2) volatile
+    { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+
+    bool
+    compare_exchange_strong(bool& __i1, bool __i2,
+			    memory_order __m = memory_order_seq_cst) volatile
+    { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
+  };
+} // namespace __atomic2
+
+// _GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/libstdc++-v3/include/bits/atomicfwd_c.h b/libstdc++-v3/include/bits/atomicfwd_c.h
new file mode 100644
index 0000000000000000000000000000000000000000..41f2dfebe9a3d2492be2ad71312a77bf05a0d073
--- /dev/null
+++ b/libstdc++-v3/include/bits/atomicfwd_c.h
@@ -0,0 +1,179 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file bits/atomicfwd_c.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+// "C" only bits.
+
+#define _ATOMIC_MEMBER_ ((__a)->_M_i)
+
+  // POD base classes for atomic intgral types.
+  struct __atomic_bool_base
+  {
+    bool _M_i;
+  };
+
+  struct __atomic_char_base
+  {
+    char _M_i;
+  };
+
+  struct __atomic_schar_base
+  {
+    signed char _M_i;
+  };
+
+  struct __atomic_uchar_base
+  {
+    unsigned char _M_i;
+  };
+
+  struct __atomic_short_base
+  {
+    short _M_i;
+  };
+
+  struct __atomic_ushort_base
+  {
+    unsigned short _M_i;
+  };
+
+  struct __atomic_int_base
+  {
+    int _M_i;
+  };
+
+  struct __atomic_uint_base
+  {
+    unsigned int _M_i;
+  };
+
+  struct __atomic_long_base
+  {
+    long _M_i;
+  };
+
+  struct __atomic_ulong_base
+  {
+    unsigned long _M_i;
+  };
+
+  struct __atomic_llong_base
+  {
+    long long _M_i;
+  };
+
+  struct __atomic_ullong_base
+  {
+    unsigned long long	_M_i;
+  };
+
+  struct __atomic_wchar_t_base
+  {
+    wchar_t _M_i;
+  };
+
+  typedef struct __atomic_flag_base 		atomic_flag;
+  typedef struct __atomic_address_base 		atomic_address;
+  typedef struct __atomic_bool_base		atomic_bool;
+  typedef struct __atomic_char_base 		atomic_char;
+  typedef struct __atomic_schar_base 		atomic_schar;
+  typedef struct __atomic_uchar_base 		atomic_uchar;
+  typedef struct __atomic_short_base 		atomic_short;
+  typedef struct __atomic_ushort_base 		atomic_ushort;
+  typedef struct __atomic_int_base 		atomic_int;
+  typedef struct __atomic_uint_base 		atomic_uint;
+  typedef struct __atomic_long_base 		atomic_long;
+  typedef struct __atomic_ulong_base 		atomic_ulong;
+  typedef struct __atomic_llong_base 		atomic_llong;
+  typedef struct __atomic_ullong_base 		atomic_ullong;
+  typedef struct __atomic_wchar_t_base 		atomic_wchar_t;
+  typedef struct __atomic_short_base 		atomic_char16_t;
+  typedef struct __atomic_int_base 		atomic_char32_t;
+
+#define atomic_is_lock_free(__a)					\
+  false
+
+#define atomic_load_explicit(__a, __x)					\
+  _ATOMIC_LOAD_(__a, __x)
+
+#define atomic_load(__a)						\
+  atomic_load_explicit(__a, memory_order_seq_cst)
+
+#define atomic_store_explicit(__a, __m, __x)				\
+  _ATOMIC_STORE_(__a, __m, __x)
+
+#define atomic_store(__a, __m)						\
+  atomic_store_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_exchange_explicit(__a, __m, __x)				\
+  _ATOMIC_MODIFY_(__a, =, __m, __x)
+
+#define atomic_exchange(__a, __m)					\
+  atomic_exchange_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_compare_exchange_explicit(__a, __e, __m, __x, __y)	\
+  _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x)
+
+#define atomic_compare_exchange(__a, __e, __m)				\
+  _ATOMIC_CMPEXCHNG_(__a, __e, __m, memory_order_seq_cst)
+
+#define atomic_fetch_add_explicit(__a, __m, __x)			\
+  _ATOMIC_MODIFY_(__a, +=, __m, __x)
+
+#define atomic_fetch_add(__a, __m)					\
+  atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_fetch_sub_explicit(__a, __m, __x)			\
+  _ATOMIC_MODIFY_(__a, -=, __m, __x)
+
+#define atomic_fetch_sub(__a, __m)					\
+  atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_fetch_and_explicit(__a, __m, __x)			\
+  _ATOMIC_MODIFY_(__a, &=, __m, __x)
+
+#define atomic_fetch_and(__a, __m)					\
+  atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_fetch_or_explicit(__a, __m, __x) 			\
+  _ATOMIC_MODIFY_(__a, |=, __m, __x)
+
+#define atomic_fetch_or(__a, __m)					\
+  atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_fetch_xor_explicit(__a, __m, __x)			\
+  _ATOMIC_MODIFY_(__a, ^=, __m, __x)
+
+#define atomic_fetch_xor(__a, __m)					\
+  atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst)
diff --git a/libstdc++-v3/include/bits/atomicfwd_cxx.h b/libstdc++-v3/include/bits/atomicfwd_cxx.h
new file mode 100644
index 0000000000000000000000000000000000000000..06429316adbe633f464f251160fb8aa0c14e1762
--- /dev/null
+++ b/libstdc++-v3/include/bits/atomicfwd_cxx.h
@@ -0,0 +1,114 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file bits/atomicfwd_cxx.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+// "C++" only bits.
+
+#define _ATOMIC_MEMBER_ _M_i
+
+_GLIBCXX_END_EXTERN_C
+
+  namespace __atomic0
+  {
+    template<typename _IntTp>
+      struct __atomic_base;
+
+    struct atomic_flag;
+    struct atomic_address;
+    struct atomic_bool;
+  } 
+
+  namespace __atomic2
+  {
+    template<typename _IntTp>
+      struct __atomic_base;
+
+    struct atomic_flag;
+    struct atomic_address;
+    struct atomic_bool;
+  } 
+
+  namespace __atomic1
+  {
+    using __atomic2::atomic_flag;
+    using __atomic2::atomic_bool;
+    using __atomic0::atomic_address;
+    using __atomic0::__atomic_base;
+  } 
+
+  /// atomic_char
+  typedef __atomic_base<char>  	       		atomic_char;
+
+  /// atomic_schar
+  typedef __atomic_base<signed char>         	atomic_schar;
+
+  /// atomic_uchar
+  typedef __atomic_base<unsigned char>  	atomic_uchar;
+
+  /// atomic_short
+  typedef __atomic_base<short>  		atomic_short;
+
+  /// atomic_ushort
+  typedef __atomic_base<unsigned short>  	atomic_ushort;
+
+  /// atomic_int
+  typedef __atomic_base<int>  	       		atomic_int;
+
+  /// atomic_uint
+  typedef __atomic_base<unsigned int>        	atomic_uint;
+
+  /// atomic_long
+  typedef __atomic_base<long>  	       		atomic_long;
+
+  /// atomic_ulong
+  typedef __atomic_base<unsigned long>  	atomic_ulong;
+
+  /// atomic_llong
+  typedef __atomic_base<long long>  		atomic_llong;
+
+  /// atomic_ullong
+  typedef __atomic_base<unsigned long long> 	atomic_ullong;
+
+  /// atomic_wchar_t
+  typedef __atomic_base<wchar_t>  		atomic_wchar_t;
+
+  /// atomic_char16_t
+  typedef __atomic_base<char16_t>  		atomic_char16_t;
+
+  /// atomic_char32_t
+  typedef __atomic_base<char32_t>  		atomic_char32_t;
+
+  template<typename _Tp>
+    struct atomic;
+_GLIBCXX_BEGIN_EXTERN_C
diff --git a/libstdc++-v3/include/c_compatibility/stdatomic.h b/libstdc++-v3/include/c_compatibility/stdatomic.h
index e5f7dcfe6c120e4caac2f7c07362fd359a387d37..be66600f0859f8855fc1e53e369d980e9703f172 100644
--- a/libstdc++-v3/include/c_compatibility/stdatomic.h
+++ b/libstdc++-v3/include/c_compatibility/stdatomic.h
@@ -45,201 +45,46 @@ _GLIBCXX_BEGIN_EXTERN_C
   typedef enum memory_order 
     {
       memory_order_relaxed, 
+      memory_order_consume, 
       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
+  typedef struct __atomic_flag_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;
-  };
+  } __atomic_flag_base;
 
-  struct __atomic_long_base
-  {
-    long _M_i;
-  };
+#define ATOMIC_FLAG_INIT { false } 
 
-  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;
-  };
+  /// 29.2 Lock-free Property
+#if defined(_GLIBCXX_ATOMIC_BUILTINS_1) && defined(_GLIBCXX_ATOMIC_BUILTINS_2) \
+  && defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_ATOMIC_BUILTINS_8)
+# define _GLIBCXX_ATOMIC_PROPERTY 2
+# define _GLIBCXX_ATOMIC_NAMESPACE __atomic2
+#elif defined(_GLIBCXX_ATOMIC_BUILTINS_1)
+# define _GLIBCXX_ATOMIC_PROPERTY 1
+# define _GLIBCXX_ATOMIC_NAMESPACE __atomic1
+#else
+# define _GLIBCXX_ATOMIC_PROPERTY 0
+# define _GLIBCXX_ATOMIC_NAMESPACE __atomic0
+#endif
 
-  struct __atomic_wchar_t_base
-  {
-    wchar_t _M_i;
-  };
+#define ATOMIC_INTEGRAL_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_ADDRESS_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
 
   // 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;
-}
+  inline namespace _GLIBCXX_ATOMIC_NAMESPACE { }
+# include <bits/atomicfwd_cxx.h>
 #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)
-
+# include <bits/atomicfwd_c.h>
 #endif
   
   // Typedefs for other atomic integral types.
@@ -272,42 +117,31 @@ extern "C++"
 
   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 base atomic_flag type.
+  bool 
+  atomic_flag_test_and_set_explicit(volatile __atomic_flag_base*, memory_order);
 
-  // Accessor functions for atomic_flag.
-  extern bool 
-  atomic_flag_test_and_set(volatile atomic_flag*);
+  inline bool 
+  atomic_flag_test_and_set(volatile __atomic_flag_base* __a)
+  { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
   
-  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);
+  void 
+  atomic_flag_clear_explicit(volatile __atomic_flag_base*, memory_order);
+
+  inline void 
+  atomic_flag_clear(volatile __atomic_flag_base* __a)
+  { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
+
+  void 
+  __atomic_flag_wait_explicit(volatile __atomic_flag_base*, memory_order);
   
-  extern volatile atomic_flag* 
+  volatile __atomic_flag_base* 
   __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); 	\
+     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);		       		\
@@ -332,7 +166,7 @@ extern "C++"
     atomic_flag_clear_explicit(__g, __x);		       		\
     __r; })
 
-#define _ATOMIC_CMPSWP_(__a, __e, __m, __x)				\
+#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x)				\
   ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_;	\
     __typeof__(__e) __q = (__e);			       		\
     __typeof__(__m) __v = (__m);			       		\
@@ -345,26 +179,19 @@ extern "C++"
     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++.
+// Inject into global namespace. XXX
+#if defined(__cplusplus) && !defined(_GLIBCXX_STDATOMIC)
 using std::memory_order;
 using std::memory_order_relaxed;
+using std::memory_order_consume;
 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;
@@ -378,10 +205,10 @@ 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;
 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
index 22fde89603b5d7d7d9b77390482719df7aff1b2d..82d699b8e8109d82f29e4e1845155694c12f3edd 100644
--- a/libstdc++-v3/include/c_global/cstdatomic
+++ b/libstdc++-v3/include/c_global/cstdatomic
@@ -55,4043 +55,789 @@
 
 _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); }
+  /// kill_dependency
+  template<typename _Tp>
+    inline _Tp 
+    kill_dependency(_Tp __y)
+    {
+      _Tp ret(__y);
+      return ret;
+    }
 
-  inline bool 
-  atomic_ullong::compare_swap(unsigned long long& __e, unsigned long long __m, 
-			      memory_order __x) volatile
+  inline memory_order
+  __calculate_memory_order(memory_order __m)
   {
-    const bool __cond1 = __x == memory_order_release;
-    const bool __cond2 = __x == memory_order_acq_rel;
-    memory_order __mo1(__cond1 ? memory_order_relaxed : __x);
+    const bool __cond1 = __m == memory_order_release;
+    const bool __cond2 = __m == memory_order_acq_rel;
+    memory_order __mo1(__cond1 ? memory_order_relaxed : __m);
     memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
-    return atomic_compare_swap_explicit(this, &__e, __m, __x, __mo2);
+    return __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); }
+  //
+  // Three nested namespaces for atomic implementation details.
+  // 
+  // The nested namespace inlined into std:: is determined by the value
+  // of the _GLIBCXX_ATOMIC_PROPERTY macro and the resulting
+  // ATOMIC_*_LOCK_FREE macros. See file stdatomic.h.
+  //
+  // 0 == __atomic0 == Never lock-free
+  // 1 == __atomic1 == Best available, sometimes lock-free
+  // 2 == __atomic2 == Always lock-free
+#include <bits/atomic_0.h>
+#include <bits/atomic_2.h>
 
-  inline wchar_t 
-  atomic_wchar_t::load(memory_order __x) volatile
-  { return atomic_load_explicit(this, __x); }
+  /// atomic
+  /// 29.4.3, Generic atomic type, primary class template.
+  template<typename _Tp>
+    struct atomic
+    {
+    private:
+      _Tp _M_i;
 
-  inline wchar_t 
-  atomic_wchar_t::swap(wchar_t __m, memory_order __x) volatile
-  { return atomic_swap_explicit(this, __m, __x); }
+    public:
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
-  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); }
+      atomic(_Tp __i) : _M_i(__i) { }
 
-  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);
-  }
+      operator _Tp() const volatile;
 
-  inline void 
-  atomic_wchar_t::fence(memory_order __x) const volatile
-  { return atomic_fence(this, __x); }
+      _Tp 
+      operator=(_Tp __i) volatile { store(__i); return __i; }
 
+      bool 
+      is_lock_free() const volatile;
 
-  inline void* 
-  atomic_address::fetch_add(ptrdiff_t __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      void 
+      store(_Tp, memory_order = memory_order_seq_cst) volatile;
 
-  inline void* 
-  atomic_address::fetch_sub(ptrdiff_t __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      _Tp 
+      load(memory_order = memory_order_seq_cst) const volatile;
 
+      _Tp 
+      exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile;
 
-  inline char 
-  atomic_char::fetch_add(char __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      bool 
+      compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile;
 
+      bool 
+      compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile;
 
-  inline char 
-  atomic_char::fetch_sub(char __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      bool 
+      compare_exchange_weak(_Tp&, _Tp, 
+			    memory_order = memory_order_seq_cst) volatile;
 
+      bool 
+      compare_exchange_strong(_Tp&, _Tp, 
+			      memory_order = memory_order_seq_cst) volatile;
+    };
 
-  inline char 
-  atomic_char::fetch_and(char __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
 
+  /// Partial specialization for pointer types.
+  template<typename _Tp> 
+    struct atomic<_Tp*> : atomic_address
+    {
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
-  inline char 
-  atomic_char::fetch_or(char __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+      atomic(_Tp* __v) : atomic_address(__v) { }
 
+      void 
+      store(_Tp*, memory_order = memory_order_seq_cst) volatile;
 
-  inline char 
-  atomic_char::fetch_xor(char __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+      _Tp* 
+      load(memory_order = memory_order_seq_cst) const volatile;
 
+      _Tp* 
+      exchange(_Tp*, memory_order = memory_order_seq_cst) volatile;
 
-  inline signed char 
-  atomic_schar::fetch_add(signed char __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      bool 
+      compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order) volatile;
 
+      bool 
+      compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order) volatile;
 
-  inline signed char 
-  atomic_schar::fetch_sub(signed char __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      bool 
+      compare_exchange_weak(_Tp*&, _Tp*, 
+			    memory_order = memory_order_seq_cst) volatile;
 
+      bool 
+      compare_exchange_strong(_Tp*&, _Tp*, 
+			      memory_order = memory_order_seq_cst) volatile;
 
-  inline signed char 
-  atomic_schar::fetch_and(signed char __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
+      _Tp* 
+      fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
 
+      _Tp* 
+      fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
 
-  inline signed char 
-  atomic_schar::fetch_or(signed char __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+      operator _Tp*() const volatile
+      { return load(); }
 
+      _Tp* 
+      operator=(_Tp* __v) volatile 
+      { 
+	store(__v); 
+	return __v; 
+      }
 
-  inline signed char 
-  atomic_schar::fetch_xor(signed char __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+      _Tp* 
+      operator++(int) volatile { return fetch_add(1); }
 
+      _Tp* 
+      operator--(int) volatile { return fetch_sub(1); }
 
-  inline unsigned char 
-  atomic_uchar::fetch_add(unsigned char __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      _Tp* 
+      operator++() volatile { return fetch_add(1) + 1; }
 
+      _Tp* 
+      operator--() volatile { return fetch_sub(1) - 1; }
 
-  inline unsigned char 
-  atomic_uchar::fetch_sub(unsigned char __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      _Tp* 
+      operator+=(ptrdiff_t __d) volatile 
+      { return fetch_add(__d) + __d; }
 
+      _Tp* 
+      operator-=(ptrdiff_t __d) volatile 
+      { return fetch_sub(__d) - __d; }
+    };
 
-  inline unsigned char 
-  atomic_uchar::fetch_and(unsigned char __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
 
+  /// Explicit specialization for void*
+  template<> 
+    struct atomic<void*> : public atomic_address
+    {
+      typedef void* 			__integral_type;
+      typedef atomic_address 		__base_type;
 
-  inline unsigned char 
-  atomic_uchar::fetch_or(unsigned char __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned char 
-  atomic_uchar::fetch_xor(unsigned char __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for bool.
+  template<> 
+    struct atomic<bool> : public atomic_bool
+    {
+      typedef bool 			__integral_type;
+      typedef atomic_bool 		__base_type;
 
-  inline short 
-  atomic_short::fetch_add(short __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline short 
-  atomic_short::fetch_sub(short __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for char.
+  template<> 
+    struct atomic<char> : public atomic_char
+    {
+      typedef char 			__integral_type;
+      typedef atomic_char 		__base_type;
 
-  inline short 
-  atomic_short::fetch_and(short __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline short 
-  atomic_short::fetch_or(short __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for signed char.
+  template<> 
+    struct atomic<signed char> : public atomic_schar
+    { 
+      typedef signed char 		__integral_type;
+      typedef atomic_schar 		__base_type;
 
-  inline short 
-  atomic_short::fetch_xor(short __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned short 
-  atomic_ushort::fetch_add(unsigned short __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for unsigned char.
+  template<> 
+    struct atomic<unsigned char> : public atomic_uchar
+    {
+      typedef unsigned char 		__integral_type;
+      typedef atomic_uchar 		__base_type;
 
-  inline unsigned short 
-  atomic_ushort::fetch_sub(unsigned short __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned short 
-  atomic_ushort::fetch_and(unsigned short __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for short.
+  template<> 
+    struct atomic<short> : public atomic_short
+    {
+      typedef short 			__integral_type;
+      typedef atomic_short 		__base_type;
 
-  inline unsigned short 
-  atomic_ushort::fetch_or(unsigned short __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned short 
-  atomic_ushort::fetch_xor(unsigned short __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for unsigned short.
+  template<> 
+    struct atomic<unsigned short> : public atomic_ushort
+    {
+      typedef unsigned short 	      	__integral_type;
+      typedef atomic_ushort 		__base_type;
 
-  inline int 
-  atomic_int::fetch_add(int __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline int 
-  atomic_int::fetch_sub(int __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for int.
+  template<> 
+    struct atomic<int> : atomic_int
+    {
+      typedef int 			__integral_type;
+      typedef atomic_int 		__base_type;
 
-  inline int 
-  atomic_int::fetch_and(int __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline int 
-  atomic_int::fetch_or(int __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for unsigned int.
+  template<> 
+    struct atomic<unsigned int> : public atomic_uint
+    {
+      typedef unsigned int		__integral_type;
+      typedef atomic_uint 		__base_type;
 
-  inline int 
-  atomic_int::fetch_xor(int __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned int 
-  atomic_uint::fetch_add(unsigned int __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for long.
+  template<> 
+    struct atomic<long> : public atomic_long
+    {
+      typedef long 			__integral_type;
+      typedef atomic_long 		__base_type;
 
-  inline unsigned int 
-  atomic_uint::fetch_sub(unsigned int __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned int 
-  atomic_uint::fetch_and(unsigned int __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for unsigned long.
+  template<> 
+    struct atomic<unsigned long> : public atomic_ulong
+    {
+      typedef unsigned long 		__integral_type;
+      typedef atomic_ulong 		__base_type;
 
-  inline unsigned int 
-  atomic_uint::fetch_or(unsigned int __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned int 
-  atomic_uint::fetch_xor(unsigned int __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for long long.
+  template<> 
+    struct atomic<long long> : public atomic_llong
+    {
+      typedef long long 		__integral_type;
+      typedef atomic_llong 		__base_type;
 
-  inline long 
-  atomic_long::fetch_add(long __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline long 
-  atomic_long::fetch_sub(long __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for unsigned long long.
+  template<> 
+    struct atomic<unsigned long long> : public atomic_ullong
+    {
+      typedef unsigned long long       	__integral_type;
+      typedef atomic_ullong 		__base_type;
 
-  inline long 
-  atomic_long::fetch_and(long __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline long 
-  atomic_long::fetch_or(long __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for wchar_t.
+  template<> 
+    struct atomic<wchar_t> : public atomic_wchar_t
+    {
+      typedef wchar_t 			__integral_type;
+      typedef atomic_wchar_t 		__base_type;
 
-  inline long 
-  atomic_long::fetch_xor(long __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned long 
-  atomic_ulong::fetch_add(unsigned long __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for char16_t.
+  template<> 
+    struct atomic<char16_t> : public atomic_char16_t
+    {
+      typedef char16_t 			__integral_type;
+      typedef atomic_char16_t 		__base_type;
 
-  inline unsigned long 
-  atomic_ulong::fetch_sub(unsigned long __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned long 
-  atomic_ulong::fetch_and(unsigned long __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
+  /// Explicit specialization for char32_t.
+  template<> 
+    struct atomic<char32_t> : public atomic_char32_t
+    {
+      typedef char32_t 			__integral_type;
+      typedef atomic_char32_t 		__base_type;
 
-  inline unsigned long 
-  atomic_ulong::fetch_or(unsigned long __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
 
+      atomic(__integral_type __i) : __base_type(__i) { }
 
-  inline unsigned long 
-  atomic_ulong::fetch_xor(unsigned long __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
 
 
-  inline long long 
-  atomic_llong::fetch_add(long long __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+  template<typename _Tp>
+    _Tp* 
+    atomic<_Tp*>::load(memory_order __m) const volatile
+    { return static_cast<_Tp*>(atomic_address::load(__m)); }
 
+  template<typename _Tp>
+    _Tp* 
+    atomic<_Tp*>::exchange(_Tp* __v, memory_order __m) volatile
+    { return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
 
-  inline long long 
-  atomic_llong::fetch_sub(long long __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+  template<typename _Tp>
+    bool 
+    atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1, 
+					memory_order __m2) volatile
+    { 
+      void** __vr = reinterpret_cast<void**>(&__r);
+      void* __vv = static_cast<void*>(__v);
+      return atomic_address::compare_exchange_weak(*__vr, __vv, __m1, __m2); 
+    }
 
+  template<typename _Tp>
+    bool 
+    atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v, 
+					  memory_order __m1,
+					  memory_order __m2) volatile
+    { 
+      void** __vr = reinterpret_cast<void**>(&__r);
+      void* __vv = static_cast<void*>(__v);
+      return atomic_address::compare_exchange_strong(*__vr, __vv, __m1, __m2); 
+    }
 
-  inline long long 
-  atomic_llong::fetch_and(long long __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
+  template<typename _Tp>
+    bool 
+    atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v,
+					memory_order __m) volatile
+    { 
+      return compare_exchange_weak(__r, __v, __m, 
+				   __calculate_memory_order(__m));
+    }
 
+  template<typename _Tp>
+    bool 
+    atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
+					memory_order __m) volatile
+    { 
+      return compare_exchange_strong(__r, __v, __m,
+				     __calculate_memory_order(__m));
+    }
 
-  inline long long 
-  atomic_llong::fetch_or(long long __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
+  template<typename _Tp>
+    _Tp* 
+    atomic<_Tp*>::fetch_add(ptrdiff_t __d, memory_order __m) volatile
+    { 
+      void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __d, __m);
+      return static_cast<_Tp*>(__p);
+    }
 
+  template<typename _Tp>
+    _Tp* 
+    atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m) volatile
+    { 
+      void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m); 
+      return static_cast<_Tp*>(__p);    
+    }
 
-  inline long long 
-  atomic_llong::fetch_xor(long long __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+  // Convenience function definitions, atomic_flag.
+  inline bool 
+  atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, memory_order __m)
+  { return __a->test_and_set(__m); }
 
+  inline void 
+  atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m)
+  { return __a->clear(__m); }
 
-  inline unsigned long long 
-  atomic_ullong::fetch_add(unsigned long long __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
 
+  // Convenience function definitions, atomic_address.
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_address* __a)
+  { return __a->is_lock_free(); }
 
-  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 void 
+  atomic_store(volatile atomic_address* __a, void* __v)
+  { __a->store(__v); }
 
+  inline void 
+  atomic_store_explicit(volatile atomic_address* __a, void* __v, 
+			memory_order __m)
+  { __a->store(__v, __m); }
 
-  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 void* 
+  atomic_load(const volatile atomic_address* __a)
+  { return __a->load(); }
 
+  inline void* 
+  atomic_load_explicit(const volatile atomic_address* __a, memory_order __m)
+  { return __a->load(__m); }
 
-  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 void* 
+  atomic_exchange(volatile atomic_address* __a, void* __v)
+  { return __a->exchange(__v); }
 
+  inline void* 
+  atomic_exchange_explicit(volatile atomic_address* __a, void* __v, 
+			   memory_order __m)
+  { return __a->exchange(__v, __m); }
 
-  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 bool 
+  atomic_compare_exchange_weak(volatile atomic_address* __a, 
+			       void** __v1, void* __v2)
+  { 
+    return __a->compare_exchange_weak(*__v1, __v2, memory_order_seq_cst, 
+				      memory_order_seq_cst); 
+  }
 
+  inline bool 
+  atomic_compare_exchange_strong(volatile atomic_address* __a, 
+			       void** __v1, void* __v2)
+  { 
+    return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst, 
+				      memory_order_seq_cst); 
+  }
 
-  inline wchar_t 
-  atomic_wchar_t::fetch_add(wchar_t __m, memory_order __x) volatile
-  { return atomic_fetch_add_explicit(this, __m, __x); }
+  inline bool 
+  atomic_compare_exchange_weak_explicit(volatile atomic_address* __a, 
+					void** __v1, void* __v2, 
+					memory_order __m1, memory_order __m2)
+  { return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
 
+  inline bool 
+  atomic_compare_exchange_strong_explicit(volatile atomic_address* __a, 
+					void** __v1, void* __v2, 
+					memory_order __m1, memory_order __m2)
+  { return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); }
 
-  inline wchar_t 
-  atomic_wchar_t::fetch_sub(wchar_t __m, memory_order __x) volatile
-  { return atomic_fetch_sub_explicit(this, __m, __x); }
+  inline void* 
+  atomic_fetch_add_explicit(volatile atomic_address* __a, ptrdiff_t __d, 
+			    memory_order __m)
+  { return __a->fetch_add(__d, __m); }
 
+  inline void* 
+  atomic_fetch_add(volatile atomic_address* __a, ptrdiff_t __d)
+  { return __a->fetch_add(__d); }
 
-  inline wchar_t 
-  atomic_wchar_t::fetch_and(wchar_t __m, memory_order __x) volatile
-  { return atomic_fetch_and_explicit(this, __m, __x); }
+  inline void* 
+  atomic_fetch_sub_explicit(volatile atomic_address* __a, ptrdiff_t __d, 
+			    memory_order __m)
+  { return __a->fetch_sub(__d, __m); }
 
+  inline void* 
+  atomic_fetch_sub(volatile atomic_address* __a, ptrdiff_t __d)
+  { return __a->fetch_sub(__d); }
 
-  inline wchar_t 
-  atomic_wchar_t::fetch_or(wchar_t __m, memory_order __x) volatile
-  { return atomic_fetch_or_explicit(this, __m, __x); }
 
+  // Convenience function definitions, atomic_bool.
+  inline bool 
+  atomic_is_lock_free(const volatile atomic_bool* __a)
+  { return __a->is_lock_free(); }
 
-  inline wchar_t 
-  atomic_wchar_t::fetch_xor(wchar_t __m, memory_order __x) volatile
-  { return atomic_fetch_xor_explicit(this, __m, __x); }
+  inline void 
+  atomic_store(volatile atomic_bool* __a, bool __i)
+  { __a->store(__i); }
 
+  inline void 
+  atomic_store_explicit(volatile atomic_bool* __a, bool __i, memory_order __m)
+  { __a->store(__i, __m); }
 
   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); }
+  atomic_load(const volatile atomic_bool* __a)
+  { return __a->load(); }
 
-  inline void* 
-  atomic_address::load(memory_order __x) volatile
-  { return atomic_load_explicit(this, __x); }
+  inline bool 
+  atomic_load_explicit(const volatile atomic_bool* __a, memory_order __m)
+  { return __a->load(__m); }
 
-  inline void* 
-  atomic_address::swap(void* __m, memory_order __x) volatile
-  { return atomic_swap_explicit(this, __m, __x); }
+  inline bool 
+  atomic_exchange(volatile atomic_bool* __a, bool __i)
+  { return __a->exchange(__i); }
 
   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); }
+  atomic_exchange_explicit(volatile atomic_bool* __a, bool __i, 
+			   memory_order __m)
+  { return __a->exchange(__i, __m); }
 
   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);
+  atomic_compare_exchange_weak(volatile atomic_bool* __a, bool* __i1, bool __i2)
+  { 
+    return __a->compare_exchange_weak(*__i1, __i2, memory_order_seq_cst, 
+				      memory_order_seq_cst); 
   }
 
-  inline void 
-  atomic_address::fence(memory_order __x) const volatile
-  { return atomic_fence(this, __x); }
-
+  inline bool 
+  atomic_compare_exchange_strong(volatile atomic_bool* __a, 
+				 bool* __i1, bool __i2)
+  { 
+    return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst, 
+					memory_order_seq_cst); 
+  }
 
-  template<typename _Tp>
-    inline bool 
-    atomic<_Tp>::is_lock_free() const volatile
-    { return false; }
+  inline bool 
+  atomic_compare_exchange_weak_explicit(volatile atomic_bool* __a, bool* __i1, 
+					bool __i2, memory_order __m1, 
+					memory_order __m2)
+  { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
 
-  template<typename _Tp>
-    inline void 
-    atomic<_Tp>::store(_Tp __v, memory_order __x) volatile
-    // XXX
-    //  { _ATOMIC_STORE_(this, __v, __x); }
-    { }
+  inline bool 
+  atomic_compare_exchange_strong_explicit(volatile atomic_bool* __a, 
+					  bool* __i1, bool __i2, 
+					  memory_order __m1, memory_order __m2)
+  { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
 
-  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>
+  // Free standing functions. Template argument should be constricted
+  // to intergral types as specified in the standard.
+  template<typename _ITp>
+    inline void 
+    atomic_store_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, 
+			  memory_order __m)
+    { __a->store(__i, __m); }
+
+  template<typename _ITp>
+    inline _ITp
+    atomic_load_explicit(const volatile __atomic_base<_ITp>* __a, 
+			 memory_order __m)
+    { return __a->load(__m); } 
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_exchange_explicit(volatile __atomic_base<_ITp>* __a, 
+			     _ITp __i, memory_order __m)
+    { return __a->exchange(__i, __m); } 
+
+  template<typename _ITp>
     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); }
-    { }
+    atomic_compare_exchange_weak_explicit(volatile __atomic_base<_ITp>* __a, 
+					  _ITp* __i1, _ITp __i2, 
+					  memory_order __m1, memory_order __m2)
+    { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
 
-  template<typename _Tp>
+  template<typename _ITp>
     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);
-    }
+    atomic_compare_exchange_strong_explicit(volatile __atomic_base<_ITp>* __a, 
+					    _ITp* __i1, _ITp __i2, 
+					    memory_order __m1, 
+					    memory_order __m2)
+    { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, 
+			      memory_order __m)
+    { return __a->fetch_add(__i, __m); }
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, 
+			      memory_order __m)
+    { return __a->fetch_sub(__i, __m); }
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, 
+			      memory_order __m)
+    { return __a->fetch_and(__i, __m); }
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+			     memory_order __m)
+    { return __a->fetch_or(__i, __m); }
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, 
+			      memory_order __m)
+    { return __a->fetch_xor(__i, __m); }
+
+  template<typename _ITp>
+    inline bool 
+    atomic_is_lock_free(const volatile __atomic_base<_ITp>* __a)
+    { return __a->is_lock_free(); }
 
-  template<typename _Tp>
-    _Tp* 
-    atomic<_Tp*>::load(memory_order __x) volatile
-    { return static_cast<_Tp*>(atomic_address::load(__x)); }
+  template<typename _ITp>
+    inline void 
+    atomic_store(volatile __atomic_base<_ITp>* __a, _ITp __i)
+    { atomic_store_explicit(__a, __i, memory_order_seq_cst); }
 
-  template<typename _Tp>
-    _Tp* 
-    atomic<_Tp*>::swap(_Tp* __v, memory_order __x) volatile
-    { return static_cast<_Tp*>(atomic_address::swap(__v, __x)); }
+  template<typename _ITp>
+    inline _ITp 
+    atomic_load(const volatile __atomic_base<_ITp>* __a)
+    { return atomic_load_explicit(__a, memory_order_seq_cst); }
 
-  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 _ITp>
+    inline _ITp 
+    atomic_exchange(volatile __atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
 
-  template<typename _Tp>
-    bool 
-    atomic<_Tp*>::compare_swap(_Tp*& __r, _Tp* __v, memory_order __x) volatile
+  template<typename _ITp>
+    inline bool 
+    atomic_compare_exchange_weak(volatile __atomic_base<_ITp>* __a,
+				 _ITp* __i1, _ITp __i2)
     { 
-      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);
+      return atomic_compare_exchange_weak_explicit(__a, __i1, __i2, 
+						   memory_order_seq_cst,
+						   memory_order_seq_cst); 
     }
 
-  template<typename _Tp>
-    _Tp* 
-    atomic<_Tp*>::fetch_add(ptrdiff_t __v, memory_order __x) volatile
+  template<typename _ITp>
+    inline bool 
+    atomic_compare_exchange_strong(volatile __atomic_base<_ITp>* __a, 
+				   _ITp* __i1, _ITp __i2)
     { 
-      void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __v, __x);
-      return static_cast<_Tp*>(__p);
+      return atomic_compare_exchange_strong_explicit(__a, __i1, __i2, 
+						     memory_order_seq_cst,
+						     memory_order_seq_cst); 
     }
 
-  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);    
-    }
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline _ITp 
+    atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
 
 _GLIBCXX_END_NAMESPACE
 
diff --git a/libstdc++-v3/src/atomic.cc b/libstdc++-v3/src/atomic.cc
index 228f92f91d0f6d88f29ee1a599a40d3af96c53ff..e2fe68f09bc44b99e483f249b00ed4aa66b173f1 100644
--- a/libstdc++-v3/src/atomic.cc
+++ b/libstdc++-v3/src/atomic.cc
@@ -30,12 +30,17 @@
 
 #include "gstdint.h"
 #include <cstdatomic>
+#include <mutex>
 
 #define LOGSIZE 4
 
 namespace
 {
-  atomic_flag volatile __atomic_flag_anon_table__[ 1 << LOGSIZE ] =
+#ifdef _GLIBCXX_HAS_GTHREADS
+  std::mutex atomic_mutex;
+#endif
+
+  std::__atomic_flag_base volatile flag_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,
@@ -46,73 +51,66 @@ 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
-				    __attribute__ ((__unused__)))
+  namespace __atomic0
   {
-#ifdef _GLIBCXX_ATOMIC_BUILTINS_1
-    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;
+    bool
+    atomic_flag::test_and_set(memory_order) volatile
+    {
+#ifdef _GLIBCXX_HAS_GTHREADS
+      lock_guard<mutex> __lock(atomic_mutex);
 #endif
-  }
+      bool result = _M_i;
+      _M_i = true;
+      return result;
+    }
 
-  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 __attribute__ ((__unused__)))
-  {
-#ifdef _GLIBCXX_ATOMIC_BUILTINS_1
-    __sync_lock_release(&(__a->_M_base._M_b));
-    if (__x >= memory_order_acq_rel)
-      __sync_synchronize();
-#else
-     __a->_M_base._M_b = false;
+    void
+    atomic_flag::clear(memory_order) volatile
+    {
+#ifdef _GLIBCXX_HAS_GTHREADS
+      lock_guard<mutex> __lock(atomic_mutex);
 #endif
-  } 
+      _M_i = false;
+    }
+  }
 
-  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)
+  extern "C"
   {
-#ifdef _GLIBCXX_ATOMIC_BUILTINS_1
-    __sync_synchronize(); 
-#endif
-  } 
+    bool
+    atomic_flag_test_and_set_explicit(volatile __atomic_flag_base* __a,
+				      memory_order __m)
+    {
+      volatile atomic_flag d(__a->_M_i);
+      return d.test_and_set(__m);
+    }
 
-  void 
-  __atomic_flag_wait_explicit(volatile atomic_flag* __a, memory_order __x)
-  { 
-    while (atomic_flag_test_and_set_explicit(__a, __x))
-      { }; 
-  }
+    void
+    atomic_flag_clear_explicit(volatile __atomic_flag_base* __a,
+			       memory_order __m)
+    {
+      volatile atomic_flag d(__a->_M_i);
+      return d.clear(__m);
+    }
 
-  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;
-  }
+    void
+    __atomic_flag_wait_explicit(volatile __atomic_flag_base* __a,
+				memory_order __x)
+    {
+      while (atomic_flag_test_and_set_explicit(__a, __x))
+	{ };
+    }
 
+    volatile __atomic_flag_base*
+    __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 flag_table + __u;
+    }
   } // extern "C"
 } // namespace std
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc
index 58bc34ec2a6ba57a9928bf9574b05cd604e16a54..4644f32920232b157fb09d391c055ab3b0fcbfdb 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc
@@ -1,7 +1,7 @@
 // { dg-do compile }
 // -*- C++ -*-
  
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2008 Free Software Foundation, Inc.
  
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -31,7 +31,7 @@
 // Benjamin Kosnik  <bkoz@redhat.com>
 
 #include <ios>
-#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
 
 int main()
 {
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc
index 837065213d390109f07fc66db7d8388aaf3e12e8..348261f083011b8d9d139922fb70b33856f0cb85 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc
@@ -1,7 +1,7 @@
 // { dg-do compile }
 // -*- C++ -*-
  
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2008 Free Software Foundation, Inc.
  
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -31,7 +31,7 @@
 // Benjamin Kosnik  <bkoz@redhat.com>
 
 #include <ios>
-#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
 
 int main()
 {
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc
index 544a68e2d7e7456ab8c040b3c80d000cd13000fa..bd71de62adcd38aedd5c9ce803799e5d3df3c20a 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc
@@ -1,7 +1,7 @@
 // { dg-do compile }
 // -*- C++ -*-
  
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2008 Free Software Foundation, Inc.
  
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -31,7 +31,7 @@
 // Benjamin Kosnik  <bkoz@redhat.com>
 
 #include <ios>
-#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
 
 int main()
 {
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
index 2ad480a0fa7fb2a8c5ddb559ee9197919701f937..834d68c33f9c4d05f3618e07598001961d449a56 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
@@ -38,18 +38,20 @@ int main()
   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-error "used here" "" { target *-*-* } 510 }
+// { dg-error "deleted function" "" { target *-*-* } 257 }
+// { dg-error "deleted function" "" { target *-*-* } 275 } 
+// { dg-error "deleted function" "" { target *-*-* } 293 }
+// { dg-error "deleted function" "" { target *-*-* } 311 }
+// { dg-error "deleted function" "" { target *-*-* } 329 }
+// { dg-error "deleted function" "" { target *-*-* } 347 }
+// { dg-error "deleted function" "" { target *-*-* } 365 }
+// { dg-error "deleted function" "" { target *-*-* } 383 }
+// { dg-error "deleted function" "" { target *-*-* } 401 }
+// { dg-error "deleted function" "" { target *-*-* } 419 }
+// { dg-error "deleted function" "" { target *-*-* } 437 }
+// { dg-error "deleted function" "" { target *-*-* } 455 }
+// { dg-error "deleted function" "" { target *-*-* } 473 }
+// { dg-error "deleted function" "" { target *-*-* } 491 }
+// { dg-error "deleted function" "" { target *-*-* } 239 }
 // { dg-excess-errors "In member function" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_list.cc
similarity index 97%
rename from libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc
rename to libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_list.cc
index da91e26a55dad31ad59f72fcab865b7c9cbead46..c7ad3b73fb43764ebe3667e4cc8482ff803e78aa 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_list.cc
@@ -32,7 +32,7 @@
 
 int main()
 {
-  __gnu_test::explicit_value_constructible test;
+  __gnu_test::copy_list_initializable 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/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
index a78177eee56f4d81b46b01f2af8f2a0999dd41c6..94022289152193830c44804012a5d86985ff4be2 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
@@ -38,18 +38,20 @@ int main()
   return 0;
 }
 
-// { dg-error "within this context" "" { target *-*-* } 349 } 
-// { 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-error "used here" "" { target *-*-* } 549 } 
+// { dg-error "deleted function" "" { target *-*-* } 238 }
+// { dg-error "deleted function" "" { target *-*-* } 256 }
+// { dg-error "deleted function" "" { target *-*-* } 274 }
+// { dg-error "deleted function" "" { target *-*-* } 292 }
+// { dg-error "deleted function" "" { target *-*-* } 310 }
+// { dg-error "deleted function" "" { target *-*-* } 328 }
+// { dg-error "deleted function" "" { target *-*-* } 346 }
+// { dg-error "deleted function" "" { target *-*-* } 364 }
+// { dg-error "deleted function" "" { target *-*-* } 382 }
+// { dg-error "deleted function" "" { target *-*-* } 400 }
+// { dg-error "deleted function" "" { target *-*-* } 418 }
+// { dg-error "deleted function" "" { target *-*-* } 436 }
+// { dg-error "deleted function" "" { target *-*-* } 454 }
+// { dg-error "deleted function" "" { target *-*-* } 472 }
+// { dg-error "deleted function" "" { target *-*-* } 490 }
 // { dg-excess-errors "In member function" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/direct_list.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/direct_list.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a9ef8a91867a3a1fe2e415db7798b6d072c60cbe
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/direct_list.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::direct_list_initializable 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/cons/single_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/single_value.cc
new file mode 100644
index 0000000000000000000000000000000000000000..79e5e4b83821f678a8e2a4e1e6b277d0f8f23a50
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/single_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::single_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/operators/integral_assignment.cc b/libstdc++-v3/testsuite/29_atomics/atomic/operators/integral_assignment.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3fcc15c99d799744ac9b2d2af5fe75d4c0a388aa
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/operators/integral_assignment.cc
@@ -0,0 +1,40 @@
+// { 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_hooks.h>
+#include <testsuite_common_types.h>
+
+int main()
+{
+  __gnu_test::integral_assignable 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/operators/integral_conversion.cc b/libstdc++-v3/testsuite/29_atomics/atomic/operators/integral_conversion.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5586d2ecbe6bbca2938bb4e257e2aca1deeab769
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/operators/integral_conversion.cc
@@ -0,0 +1,40 @@
+// { 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_hooks.h>
+#include <testsuite_common_types.h>
+
+int main()
+{
+  __gnu_test::integral_convertable 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/base_classes.cc b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/base_classes.cc
new file mode 100644
index 0000000000000000000000000000000000000000..44dc4fe89737a336f94aaea36c9e590d58f1ecfa
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/base_classes.cc
@@ -0,0 +1,32 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation
+//
+// 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>
+#include <testsuite_common_types.h>
+
+void test01()
+{
+  // Check for required base class.
+  __gnu_test::has_required_base_class test;
+  __gnu_cxx::typelist::apply_generator(test, 
+				       __gnu_test::atomic_integrals::type(), 
+                                       __gnu_test::atomics_tl());
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/requirements/standard_layout.cc b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/standard_layout.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e51e8e4454f9666448bf985540b949812b5702dd
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/standard_layout.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2008-10-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// 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>
+#include <testsuite_common_types.h>
+
+void test01()
+{
+  // Check for standard layout requirements
+  __gnu_test::standard_layout test;
+  __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl());
+}
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
index ef50b9ed38fed070825086086c7eb21e524baa9a..3d7986ac190a38354bf02f088bdf9e4c218c7342 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
@@ -38,5 +38,5 @@ void test01()
   test_type t2;
   t1 = t2;
 }
-// { dg-error "within this context" "" { target *-*-* } 39 } 
-// { dg-error "is private" "" { target *-*-* } 167 } 
+// { dg-error "used here" "" { target *-*-* } 39 } 
+// { dg-excess-errors "deleted function" } 
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
index 57732d8333551a112bafbb98915139dd95883938..fe0155f0e2cb3ed2a0a0eee878285869a147620b 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
@@ -37,5 +37,5 @@ void test01()
   test_type t1;
   test_type t2(t1);
 }
-// { dg-error "within this context" "" { target *-*-* } 38 } 
-// { dg-error "is private" "" { target *-*-* } 166 } 
+// { dg-error "used here" "" { target *-*-* } 38 } 
+// { dg-excess-errors "deleted function" } 
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/single_value.cc
similarity index 97%
rename from libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc
rename to libstdc++-v3/testsuite/29_atomics/atomic_address/cons/single_value.cc
index b455bf667cdc6147d9277ccd9da5f2e78ee95142..bdae37bf8fed6ab1e622970d0b666f802853d2fc 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/single_value.cc
@@ -31,7 +31,7 @@
 
 int main()
 {
-  // Explicit value constructor.
+  // Single value constructor.
   void* v = NULL;
   std::atomic_address a(v);
   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
index 5f8ff15dc522872d7de53e14a4ac6f483d95fcea..21616bb7af1aeefdce2b378dc4f655c964415a21 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
@@ -38,5 +38,5 @@ void test01()
   test_type t2;
   t1 = t2;
 }
-// { dg-error "within this context" "" { xfail *-*-* } 39 } 
-// { dg-error "is private" "" { xfail *-*-* } 89 } 
+// { dg-error "used here" "" { target *-*-* } 39 } 
+// { dg-excess-errors "deleted function" } 
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
index 3480d8c5e16e563f37eeb451d6056bc5db6cb828..4dcd0500f90da665bf8c4ac066cde1b7c612aa6e 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
@@ -37,5 +37,5 @@ void test01()
   test_type t1;
   test_type t2(t1);
 }
-// { dg-error "within this context" "" { xfail *-*-* } 38 } 
-// { dg-error "is private" "" { xfail *-*-* } 88 } 
+// { dg-error "used here" "" { target *-*-* } 38 } 
+// { dg-excess-errors "deleted function" } 
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
index 351df912fff51b296ca4fadca1efa39a64ec14fe..c7489014334054b447b99469be6cedff781f4c7e 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc
@@ -36,6 +36,10 @@ int main()
   bool test __attribute__((unused)) = true;
 
   typedef std::atomic_flag test_type;
+  
+  // libstdc++/37907
+  // VERIFY( std::is_standard_layout<test_type>::value );
+
   VERIFY( std::has_trivial_default_constructor<test_type>::value );
   VERIFY( std::has_trivial_destructor<test_type>::value );
 
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..724714ed819cecab5bf540602988d856fad238cb
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.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.
+
+// 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::atomic_integrals::type());
+  return 0;
+}
+
+// { dg-error "used here" "" { target *-*-* } 510 }
+// { dg-excess-errors "deleted function" } 
+// { dg-excess-errors "deleted function" } 
+// { dg-error "instantiated from" "" { target *-*-* } 38 } 
+// { dg-error "instantiated from" "" { target *-*-* } 517 } 
+// { dg-error "instantiated from" "" { target *-*-* } 173 } 
+// { dg-error "instantiated from" "" { target *-*-* } 404 }
+// { dg-error "instantiated from" "" { target *-*-* } 175 }  
+// { dg-excess-errors "In member function" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_list.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_list.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b5bc8d0c07852e06b403d1b54b6b6d04d21a041e
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_list.cc
@@ -0,0 +1,40 @@
+// { 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::copy_list_initializable test;
+  __gnu_cxx::typelist::apply_generator(test,
+				       __gnu_test::atomic_integrals::type(),
+				       __gnu_test::integral_types::type());
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f03ceced11b869cfe51fc46083f6f150c09ff7aa
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.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.
+
+// 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::atomic_integrals::type());
+  return 0;
+}
+
+// { dg-error "used here" "" { target *-*-* } 549 }
+// { dg-excess-errors "deleted function" } 
+// { dg-excess-errors "deleted function" } 
+// { dg-error "instantiated from" "" { target *-*-* } 38 } 
+// { dg-error "instantiated from" "" { target *-*-* } 555 } 
+// { dg-error "instantiated from" "" { target *-*-* } 173 } 
+// { dg-error "instantiated from" "" { target *-*-* } 404 }
+// { dg-error "instantiated from" "" { target *-*-* } 175 }  
+// { dg-excess-errors "In member function" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/default.cc
similarity index 89%
rename from libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc
rename to libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/default.cc
index 7ee633ebb32aad74c1976853d47a41ac093a5efd..3894fd4c343f47192c36284d5b35191fbf5bc381 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/default.cc
@@ -28,12 +28,12 @@
 // the GNU General Public License.
 
 #include <cstdatomic>
+#include <testsuite_common_types.h>
 
 int main()
 {
-  using namespace std;
-  atomic_flag_fence(&atomic_global_fence_compatibility, memory_order_acquire);
-  atomic_global_fence_compatibility.fence(memory_order_release);
-
+  __gnu_test::default_constructible test;
+  __gnu_cxx::typelist::apply_generator(test,
+				       __gnu_test::atomic_integrals::type());
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/direct_list.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/direct_list.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ac53f318f35ac90a0141dd8b3faaaa98857ca94f
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/direct_list.cc
@@ -0,0 +1,40 @@
+// { 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::direct_list_initializable test;
+  __gnu_cxx::typelist::apply_generator(test, 
+				       __gnu_test::atomic_integrals::type(), 
+				       __gnu_test::integral_types::type());
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/single_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/single_value.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6572de7cf68a5e5d2998a45274a247772de9b133
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/single_value.cc
@@ -0,0 +1,40 @@
+// { 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::single_value_constructible test;
+  __gnu_cxx::typelist::apply_generator(test, 
+				       __gnu_test::atomic_integrals::type(), 
+				       __gnu_test::integral_types::type());
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise.cc
new file mode 100644
index 0000000000000000000000000000000000000000..649c34000bf209ef3f5d3f2270b110f35bbad6e3
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// -*- C++ -*-
+ 
+// Copyright (C) 2008 Free Software Foundation, Inc.
+ 
+// 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::has_bitwise_operators test;
+  using __gnu_test::atomic_integrals_no_bool;
+  __gnu_cxx::typelist::apply_generator(test, atomic_integrals_no_bool::type());
+};
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0d36bbcd77af62994f16a6cbb9eed15f384918d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// -*- C++ -*-
+ 
+// Copyright (C) 2008 Free Software Foundation, Inc.
+ 
+// 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::bitwise_assignment_operators<std::atomic_bool>();
+  return 0;
+}
+
+// { dg-error "operator" "" { target *-*-* } 413 }
+// { dg-error "operator" "" { target *-*-* } 414 }
+// { dg-error "operator" "" { target *-*-* } 415 }
+// { dg-excess-errors "In file included from" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f487b6553af94135a7d4542a1a5fe6a8aeee1618
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// -*- C++ -*-
+ 
+// Copyright (C) 2008 Free Software Foundation, Inc.
+ 
+// 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::has_decrement_operators test;
+  using __gnu_test::atomic_integrals_no_bool;
+  __gnu_cxx::typelist::apply_generator(test, atomic_integrals_no_bool::type());
+};
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9480af5a23621acab14cd3e66dd0fccc80490aa5
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// -*- C++ -*-
+ 
+// Copyright (C) 2008 Free Software Foundation, Inc.
+ 
+// 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::has_decrement_operators test;
+  test.operator()<std::atomic_bool>();
+  return 0;
+}
+
+// { dg-error "operator" "" { target *-*-* } 384 }
+// { dg-error "operator" "" { target *-*-* } 385 }
+// { dg-error "operator" "" { target *-*-* } 386 }
+// { dg-excess-errors "In file included from" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment.cc
new file mode 100644
index 0000000000000000000000000000000000000000..608ddefbb4c44b6db6bd18712bca92b7212fff14
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// -*- C++ -*-
+ 
+// Copyright (C) 2008 Free Software Foundation, Inc.
+ 
+// 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::has_increment_operators test;
+  using __gnu_test::atomic_integrals_no_bool;
+  __gnu_cxx::typelist::apply_generator(test, atomic_integrals_no_bool::type());
+};
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fc2f76b35e060e1f571dd002f13eeb384fe0a77f
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// -*- C++ -*-
+ 
+// Copyright (C) 2008 Free Software Foundation, Inc.
+ 
+// 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::has_increment_operators test;
+  test.operator()<std::atomic_bool>();
+  return 0;
+}
+
+// { dg-error "operator" "" { target *-*-* } 362 }
+// { dg-error "operator" "" { target *-*-* } 363 }
+// { dg-error "operator" "" { target *-*-* } 364 }
+// { dg-excess-errors "In file included from" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/integral_assignment.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/integral_assignment.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4e8a42383b842f03e16d5d83c857f961805c2de4
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/integral_assignment.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>
+#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
+
+int main()
+{
+  __gnu_test::integral_assignable test;
+  __gnu_cxx::typelist::apply_generator(test,
+				       __gnu_test::atomic_integrals::type(), 
+				       __gnu_test::integral_types::type());
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/integral_conversion.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/integral_conversion.cc
new file mode 100644
index 0000000000000000000000000000000000000000..527dc77691da76640d3a3b4e1057db5de208c148
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/integral_conversion.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>
+#include <testsuite_hooks.h>
+#include <testsuite_common_types.h>
+
+int main()
+{
+  __gnu_test::integral_convertable test;
+  __gnu_cxx::typelist::apply_generator(test,
+				       __gnu_test::atomic_integrals::type(), 
+				       __gnu_test::integral_types::type());
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/requirements/standard_layout.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/requirements/standard_layout.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1b6836fb54c845eaffce73cb6d8a9e504b46cd93
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/requirements/standard_layout.cc
@@ -0,0 +1,32 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2008-10-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// 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>
+#include <testsuite_common_types.h>
+
+void test01()
+{
+  // Check for standard layout requirements
+  __gnu_test::standard_layout test;
+  __gnu_cxx::typelist::apply_generator(test, 
+				       __gnu_test::atomic_integrals::type());
+}
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
index 5444d71f378e47bcc81512f8f1cbd25a598619b1..c7ea8bc74f8b3e0171ab326002a800d032b194f4 100644
--- 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
@@ -27,9 +27,8 @@ namespace gnu
   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;
+  using std::kill_dependency;
 
   // Sloppy testing for integral types (en masse).
   using std::atomic_is_lock_free;
@@ -37,11 +36,12 @@ namespace gnu
   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_exchange;
+  using std::atomic_exchange_explicit;
+  using std::atomic_compare_exchange_weak;
+  using std::atomic_compare_exchange_strong;
+  using std::atomic_compare_exchange_weak_explicit;
+  using std::atomic_compare_exchange_strong_explicit;
 
   using std::atomic_fetch_add;
   using std::atomic_fetch_add_explicit;
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc
index 62f76ab1f0e37d6f84bfca93919c4c6a5e728678..d285a7e276719a3f182af98dd19a342c59eb24fb 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc
@@ -24,11 +24,20 @@
 namespace gnu
 {
 #ifndef ATOMIC_INTEGRAL_LOCK_FREE
-    #error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro"
+# error "ATOMIC_INTEGRAL_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_INTEGRAL_LOCK_FREE != 0 \
+    && ATOMIC_INTEGRAL_LOCK_FREE != 1 && ATOMIC_INTEGRAL_LOCK_FREE != 2
+# error "ATOMIC_INTEGRAL_LOCK_FREE must be 0, 1, or 2"
+# endif
 #endif
 
 #ifndef ATOMIC_ADDRESS_LOCK_FREE
-    #error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro"
+# error "ATOMIC_ADDRESS_LOCK_FREE must be a macro"
+# if ATOMIC_INTEGRAL_LOCK_FREE != 0 \
+    && ATOMIC_INTEGRAL_LOCK_FREE != 1 && ATOMIC_INTEGRAL_LOCK_FREE != 2
+# error "ATOMIC_INTEGRAL_LOCK_FREE must be 0, 1, or 2"
+# endif
 #endif
 
 #ifndef ATOMIC_FLAG_INIT
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
index 9a3ab5e636f6e0c5f9b74fffd665778615df9fc8..182c2d91866b20756cef8e86f1e6c63dd18ec326 100644
--- 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
@@ -25,6 +25,7 @@ void test01()
 {
   using std::memory_order;
   using std::memory_order_relaxed;
+  using std::memory_order_consume;
   using std::memory_order_acquire;
   using std::memory_order_release;
   using std::memory_order_acq_rel;
@@ -75,7 +76,4 @@ void test01()
   using std::atomic_uintmax_t;
 
   using std::atomic_address;
-
-  const std::atomic_flag* p __attribute__((unused))
-    = &std::atomic_global_fence_compatibility;
 }
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
index 30368a06bf4b39ddcef09ca4430715c4ba0e445c..1e65e940dc9c0c0856749450aa60371ee084de0a 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
@@ -55,24 +55,20 @@ int main()
     #error "atomic_store_must_be_a_macro"
 #endif
 
-#ifndef atomic_swap_explicit
-    #error "atomic_swap_explicit_must_be_a_macro"
+#ifndef atomic_exchange_explicit
+    #error "atomic_exchange_explicit_must_be_a_macro"
 #endif
 
-#ifndef atomic_swap
-    #error "atomic_swap_must_be_a_macro"
+#ifndef atomic_exchange
+    #error "atomic_exchange_must_be_a_macro"
 #endif
 
-#ifndef atomic_compare_swap
-    #error "atomic_compare_swap_must_be_a_macro"
+#ifndef atomic_compare_exchange
+    #error "atomic_compare_exchange_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"
+#ifndef atomic_compare_exchange_explicit
+    #error "atomic_compare_exchange_explicit_must_be_a_macro"
 #endif
 
 #ifndef atomic_fetch_add_explicit
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c
index 88bc740c3d7879accf8cb9a17e01afa2b9b519bb..478fdd8283aa5dfeb716399edd41bf5b45cd0a82 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c
@@ -75,7 +75,4 @@ void test01()
   typedef atomic_uintmax_t t_45;
 
   typedef atomic_address t_46;
-
-  const atomic_flag* p __attribute__((unused))
-    = &atomic_global_fence_compatibility;
 }
diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h
index a746d787e7ce44103658a7a0a66a8bb436839b47..6dc0dfa7ebff0751423479e2834f38adfd8bed03 100644
--- a/libstdc++-v3/testsuite/util/testsuite_common_types.h
+++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h
@@ -54,6 +54,7 @@
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
 #include <cstdatomic>
+#include <type_traits>
 #endif
 
 namespace __gnu_test
@@ -279,14 +280,63 @@ namespace __gnu_test
     typedef long long 		a11;
     typedef unsigned long long 	a12;
     typedef wchar_t 		a13;
-    // typedef char16_t 		a14;
-    // typedef char16_t 		a15;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    typedef char16_t 		a14;
+    typedef char32_t 		a15;
 
+    typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9, 
+					   a10, a11, a12, a13, a14, a15)> type;
+#else
     typedef node<_GLIBCXX_TYPELIST_CHAIN13(a1, a2, a3, a4, a5, a6, a7, a8, a9, 
 					   a10, a11, a12, a13)> type;
+#endif
   };
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
+  struct atomic_integrals_no_bool
+  {
+    typedef std::atomic_char        	a2;
+    typedef std::atomic_schar 		a3;
+    typedef std::atomic_uchar 		a4;
+    typedef std::atomic_short       	a5;
+    typedef std::atomic_ushort 		a6;
+    typedef std::atomic_int 		a7;
+    typedef std::atomic_uint 		a8;
+    typedef std::atomic_long        	a9;
+    typedef std::atomic_ulong 		a10;
+    typedef std::atomic_llong       	a11;
+    typedef std::atomic_ullong 		a12;
+    typedef std::atomic_wchar_t     	a13;
+    typedef std::atomic_char16_t    	a14;
+    typedef std::atomic_char32_t    	a15;
+    
+    typedef node<_GLIBCXX_TYPELIST_CHAIN14(a2, a3, a4, a5, a6, a7, a8, a9, 
+					   a10, a11, a12, a13, a14, a15)> type;
+  };
+
+  struct atomic_integrals
+  {
+    typedef std::atomic_bool        	a1;
+    typedef std::atomic_char        	a2;
+    typedef std::atomic_schar 		a3;
+    typedef std::atomic_uchar 		a4;
+    typedef std::atomic_short       	a5;
+    typedef std::atomic_ushort 		a6;
+    typedef std::atomic_int 		a7;
+    typedef std::atomic_uint 		a8;
+    typedef std::atomic_long        	a9;
+    typedef std::atomic_ulong 		a10;
+    typedef std::atomic_llong       	a11;
+    typedef std::atomic_ullong 		a12;
+    typedef std::atomic_wchar_t     	a13;
+    typedef std::atomic_char16_t    	a14;
+    typedef std::atomic_char32_t    	a15;
+    
+    typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9, 
+					   a10, a11, a12, a13, a14, a15)> type;
+  };
+
+
   template<typename Tp>
     struct atomics
     {
@@ -297,6 +347,156 @@ namespace __gnu_test
   typedef transform<integral_types::type, atomics>::type atomics_tl;
 #endif
 
+
+  struct has_increment_operators
+  {
+    template<typename _Tp>
+      void 
+      operator()()
+      {
+	struct _Concept
+	{
+	  void __constraint()
+	  {
+	    _Tp a; 
+	    ++a; // prefix
+	    a++; // postfix
+	    a += a;
+	  }
+	};
+
+	void (_Concept::*__x)() __attribute__((unused))
+	  = &_Concept::__constraint;
+      }
+  };
+
+  struct has_decrement_operators
+  {
+    template<typename _Tp>
+      void 
+      operator()()
+      {
+	struct _Concept
+	{
+	  void __constraint()
+	  {
+	    _Tp a; 
+	    --a; // prefix
+	    a--; // postfix
+	    a -= a;
+	  }
+	};
+
+	void (_Concept::*__x)() __attribute__((unused))
+	  = &_Concept::__constraint;
+      }
+  };
+
+  template<typename _Tp>
+    void
+    bitwise_operators()
+    {
+      _Tp a; 
+      _Tp b;
+      a | b;
+      a & b;
+      a ^ b;
+      ~b;
+    }
+
+  template<typename _Tp>
+    void
+    bitwise_assignment_operators()
+    {
+      _Tp a; 
+      _Tp b;
+      a |= b; // set
+      a &= ~b; // clear
+      a ^= b;
+    }
+
+  // 17.3.2.1.2 - Bitmask types [lib.bitmask.types]
+  // bitmask_operators
+  template<typename _BitmTp>
+    void
+    bitmask_operators()
+    {
+      bitwise_operators<_BitmTp>();
+      bitwise_assignment_operators<_BitmTp>();
+    }
+
+  struct has_bitwise_operators
+  {
+    template<typename _Tp>
+      void 
+      operator()()
+      {
+	struct _Concept
+	{
+	  void __constraint()
+	  {
+	    bitwise_assignment_operators<_Tp>();
+	  }
+	};
+
+	void (_Concept::*__x)() __attribute__((unused))
+	  = &_Concept::__constraint;
+      }
+  };
+
+  // Generator to test standard layout
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  struct standard_layout
+  {
+    template<typename _Tp>
+      void 
+      operator()()
+      {
+	struct _Concept
+	{
+	  void __constraint()
+	  {
+	    // libstdc++/37907
+	    // typedef std::is_standard_layout<_Tp> standard_layout_p;
+	    // static_assert(standard_layout_p::value, "not standard_layout");
+	    
+	    typedef std::has_trivial_default_constructor<_Tp> ctor_p;
+	    static_assert(ctor_p::value, "default ctor not trivial");
+
+	    typedef std::has_trivial_destructor<_Tp> dtor_p;
+	    static_assert(dtor_p::value, "dtor not trivial");
+	  }
+	};
+
+	void (_Concept::*__x)() __attribute__((unused))
+	  = &_Concept::__constraint;
+      }
+  };
+#endif
+
+  // Generator to test base class
+  struct has_required_base_class
+  {
+    template<typename _TBase, typename _TDerived>
+      void 
+      operator()()
+      {
+	struct _Concept
+	{
+	  void __constraint()
+	  {
+	    const _TDerived& obj = __a;
+	    const _TBase* base __attribute__((unused)) = &obj;
+	  }
+	  
+	  _TDerived __a;
+	};
+
+	void (_Concept::*__x)() __attribute__((unused))
+	  = &_Concept::__constraint;
+      }
+  };
+
   // Generator to test assignment operator.
   struct assignable
   {
@@ -356,8 +556,8 @@ namespace __gnu_test
       }
   };
 
-  // Generator to test explicit value constructor.
-  struct explicit_value_constructible
+  // Generator to test direct initialization, single value constructor.
+  struct single_value_constructible
   {
     template<typename _Ttype, typename _Tvalue>
       void 
@@ -376,5 +576,102 @@ namespace __gnu_test
       }
   };
 
+  // Generator to test direct list initialization
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  struct direct_list_initializable
+  {
+    template<typename _Ttype, typename _Tvalue>
+      void 
+      operator()()
+      {
+	struct _Concept
+	{
+	  void __constraint()
+	  { 
+	    _Ttype __v1 { }; // default ctor
+	    _Ttype __v2 { __a };  // single-argument ctor
+	  }
+	  
+	  _Tvalue __a;
+	};
+
+	void (_Concept::*__x)() __attribute__((unused))
+	  = &_Concept::__constraint;
+      }
+  };
+#endif
+
+  // Generator to test copy list initialization, aggregate initialization
+  struct copy_list_initializable
+  {
+    template<typename _Ttype, typename _Tvalue>
+      void 
+      operator()()
+      {
+	struct _Concept
+	{
+	  void __constraint()
+	  { _Ttype __v = {__a}; }
+	  
+	  _Tvalue __a;
+	};
+
+	void (_Concept::*__x)() __attribute__((unused))
+	  = &_Concept::__constraint;
+      }
+  };
+
+  // Generator to test integral conversion operator
+  struct integral_convertable
+  {
+    template<typename _Ttype, typename _Tvalue>
+      void 
+      operator()()
+      {
+	struct _Concept
+	{
+	  void __constraint()
+	  {
+	    _Tvalue __v0(0);
+	    _Tvalue __v1(1);
+	    _Ttype __a(__v1);
+	    __v0 = __a;
+
+	    bool test __attribute__((unused)) = true;
+	    VERIFY( __v1 == __v0 );
+	  }
+	};
+
+	void (_Concept::*__x)() __attribute__((unused))
+	  = &_Concept::__constraint;
+      }
+  };
+
+  // Generator to test integral assignment operator 
+  struct integral_assignable
+  {
+    template<typename _Ttype, typename _Tvalue>
+      void 
+      operator()()
+      {
+	struct _Concept
+	{
+	  void __constraint()
+	  {
+	    _Tvalue __v0(0);
+	    _Tvalue __v1(1);
+	    _Ttype __a(__v0);
+	    __a = __v1;
+	    _Tvalue __vr = __a;
+
+	    bool test __attribute__((unused)) = true;
+	    VERIFY( __v1 == __vr );
+	  }
+	};
+
+	void (_Concept::*__x)() __attribute__((unused))
+	  = &_Concept::__constraint;
+      }
+  };
 } // namespace __gnu_test
 #endif
diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.h b/libstdc++-v3/testsuite/util/testsuite_hooks.h
index cbd876d61fe1f6c8920e7fd6e60953a9096eb190..0f870f84cd197afd9e86e204cd78f54f150dac12 100644
--- a/libstdc++-v3/testsuite/util/testsuite_hooks.h
+++ b/libstdc++-v3/testsuite/util/testsuite_hooks.h
@@ -1,7 +1,7 @@
 // -*- C++ -*-
 // Utility subroutines for the C++ library testsuite. 
 //
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -100,22 +100,6 @@ namespace __gnu_test
   void
   verify_demangle(const char* mangled, const char* wanted);
 
-  // 17.3.2.1.2 - Bitmask types [lib.bitmask.types]
-  // bitmask_operators
-  template<typename bitmask_type>
-    void
-    bitmask_operators(bitmask_type a = bitmask_type(),
-		      bitmask_type b = bitmask_type())
-    {
-      a | b;
-      a & b;
-      a ^ b;
-      ~b;
-      a |= b; // set
-      a &= ~b; // clear
-      a ^= b;
-    }
-
   // Simple callback structure for variable numbers of tests (all with
   // same signature).  Assume all unit tests are of the signature
   // void test01();