summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/29_atomics
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-10 20:26:45 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-10 20:26:45 +0000
commit857d9b7bdf139c12a8bf7483f712f59cf047c698 (patch)
treedc0bf9fb108791fffd3d1c8bee85cb81446f702c /libstdc++-v3/testsuite/29_atomics
parent8965c2646dd063b1468e923de148bbcc90ae3a93 (diff)
downloadgcc-857d9b7bdf139c12a8bf7483f712f59cf047c698.tar.gz
2008-04-10 Benjamin Kosnik <bkoz@redhat.com>
* include/c_global/cstdatomic: C++ types only, format, doxygen markup. * include/c_compatibility/stdatomic.h: "C" only, format, doxygen markup. * src/atomic.c: Format, doxygen markup, edits. * include/Makefile.am (cstdatomic, stdatomic.h): Add. * src/Makefile.am (atomic.c): Add. * acinclude.m4 (GLIBCXX_CHECK_STANDARD_LAYOUT): New. * configure.ac: Call it. * include/Makefile.in: Regenerate. * src/Makefile.in: Same. * Makefile.in: Same. * doc/Makefile.in: Same. * po/Makefile.in: Same. * libmath/Makefile.in: Same. * include/Makefile.in: Same. * testsuite/Makefile.in: Same. * libsupc++/Makefile.in: Same. * config.h.in: Same. * configure: Same. * config/abi/pre/gnu.ver: Add atomics exports. * include/ext/typelist.h (apply_generator): New. * include/bits/c++config (_GLIBCXX_BEGIN_EXTERN_C): New. (_GLIBCXX_END_EXTERN_C): New. Deal with _GLIBCXX_BEGIN_NAMESPACE, _GLIBCXX_END_NAMESPACE when compiling as C. * testsuite/lib/libstdc++.exp (v3_target_compile_as_c): Add -L flag for libstdc++. * testsuite/util/testsuite_common_types.h (integral_types): New typelist. (atomics, atomics_tl): Same. (assignable, default_constructible, copy_constructible, explicit_value_constructible): New. * testsuite/17_intro/headers/c++200x/all.cc: Test new headers. * testsuite/29_atomics: New. * testsuite/29_atomics/atomic_address: Same. * testsuite/29_atomics/atomic_address/cons: Same. * testsuite/29_atomics/atomic_address/cons/explicit_value.cc: Same. * testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same. * testsuite/29_atomics/atomic_address/cons/copy_neg.cc: Same. * testsuite/29_atomics/atomic_address/cons/default.cc: Same. * testsuite/29_atomics/atomic_address/cons/aggregate.cc: Same. * testsuite/29_atomics/atomic_flag: Same. * testsuite/29_atomics/atomic_flag/cons: Same. * testsuite/29_atomics/atomic_flag/cons/assign_neg.cc: Same. * testsuite/29_atomics/atomic_flag/cons/copy_neg.cc: Same. * testsuite/29_atomics/atomic_flag/cons/default.cc: Same. * testsuite/29_atomics/atomic_flag/cons/aggregate.cc: Same. * testsuite/29_atomics/atomic_flag/requirements: Same. * testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc: Same. * testsuite/29_atomics/atomic_flag/ atomic_global_fence_compatibility.cc: Same. * testsuite/29_atomics/atomic_flag/test_and_set: Same. * testsuite/29_atomics/atomic_flag/test_and_set/explicit.c: Same. * testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc: Same. * testsuite/29_atomics/atomic_flag/test_and_set/implicit.c: Same. * testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc: Same. * testsuite/29_atomics/headers: Same. * testsuite/29_atomics/headers/cstdatomic: Same. * testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc: Same. * testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc: Same. * testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc: Same. * testsuite/29_atomics/headers/cstdatomic/macros.cc: Same. * testsuite/29_atomics/headers/stdatomic.h: Same. * testsuite/29_atomics/headers/stdatomic.h/macros.c: Same. * testsuite/29_atomics/headers/stdatomic.h/types.c: Same. * testsuite/29_atomics/headers/stdatomic.h/functions.c: Same. * testsuite/29_atomics/atomic: Same. * testsuite/29_atomics/atomic/cons: Same. * testsuite/29_atomics/atomic/cons/explicit_value.cc: Same. * testsuite/29_atomics/atomic/cons/assign_neg.cc: Same. * testsuite/29_atomics/atomic/cons/copy_neg.cc: Same. * testsuite/29_atomics/atomic/cons/default.cc: Same. * testsuite/29_atomics/atomic/requirements: Same. * testsuite/29_atomics/atomic/requirements/explicit_instantiation: Same. * testsuite/29_atomics/atomic/requirements/explicit_instantiation/ 1.cc: Same. 2008-04-10 Lawrence Crowl <crowl@google.com> * include/c_global/cstdatomic: New. * include/c_compatibility/stdatomic.h: New. * src/atomic.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134174 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/29_atomics')
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc55
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc55
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc38
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc39
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc37
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc37
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc42
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc41
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc37
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc38
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc39
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc38
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc42
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc41
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc37
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc43
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c40
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc41
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c40
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc41
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc50
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc37
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc27
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc80
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c38
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c119
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c80
27 files changed, 1252 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
new file mode 100644
index 00000000000..435309860a3
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
@@ -0,0 +1,55 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::assignable test;
+ __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl());
+ return 0;
+}
+
+// { dg-error "within this context" "" { target *-*-* } 310 }
+// { dg-error "is private" "" { target *-*-* } 1750 }
+// { dg-error "is private" "" { target *-*-* } 1782 }
+// { dg-error "is private" "" { target *-*-* } 1799 }
+// { dg-error "is private" "" { target *-*-* } 1816 }
+// { dg-error "is private" "" { target *-*-* } 1832 }
+// { dg-error "is private" "" { target *-*-* } 1848 }
+// { dg-error "is private" "" { target *-*-* } 1864 }
+// { dg-error "is private" "" { target *-*-* } 1880 }
+// { dg-error "is private" "" { target *-*-* } 1896 }
+// { dg-error "is private" "" { target *-*-* } 1913 }
+// { dg-error "is private" "" { target *-*-* } 1929 }
+// { dg-error "is private" "" { target *-*-* } 1945 }
+// { dg-error "is private" "" { target *-*-* } 1961 }
+// { dg-excess-errors "In member function" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
new file mode 100644
index 00000000000..011933a8eb8
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
@@ -0,0 +1,55 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::copy_constructible test;
+ __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl());
+ return 0;
+}
+
+// { dg-error "within this context" "" { target *-*-* } 333 }
+// { dg-error "is private" "" { target *-*-* } 1749 }
+// { dg-error "is private" "" { target *-*-* } 1781 }
+// { dg-error "is private" "" { target *-*-* } 1798 }
+// { dg-error "is private" "" { target *-*-* } 1814 }
+// { dg-error "is private" "" { target *-*-* } 1831 }
+// { dg-error "is private" "" { target *-*-* } 1847 }
+// { dg-error "is private" "" { target *-*-* } 1863 }
+// { dg-error "is private" "" { target *-*-* } 1879 }
+// { dg-error "is private" "" { target *-*-* } 1895 }
+// { dg-error "is private" "" { target *-*-* } 1912 }
+// { dg-error "is private" "" { target *-*-* } 1928 }
+// { dg-error "is private" "" { target *-*-* } 1944 }
+// { dg-error "is private" "" { target *-*-* } 1960 }
+// { dg-excess-errors "In member function" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc
new file mode 100644
index 00000000000..c8af19ad2ed
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/default.cc
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::default_constructible test;
+ __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl());
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc
new file mode 100644
index 00000000000..da91e26a55d
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/explicit_value.cc
@@ -0,0 +1,39 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::explicit_value_constructible test;
+ __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(),
+ __gnu_test::integral_types::type());
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc
new file mode 100644
index 00000000000..5dafd093a01
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/requirements/explicit_instantiation/1.cc
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// This file tests explicit instantiation of basic_string
+
+#include <cstdatomic>
+#include <testsuite_character.h>
+
+template class std::atomic<__gnu_test::pod_char>;
+template class std::atomic<__gnu_test::pod_char*>;
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc
new file mode 100644
index 00000000000..f6aee27ce51
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/aggregate.cc
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile { xfail *-*-* } }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+int main()
+{
+ std::atomic_address a = { { NULL } }; // { dg-excess-errors "braces around" }
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
new file mode 100644
index 00000000000..ef50b9ed38f
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/assign_neg.cc
@@ -0,0 +1,42 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+void test01()
+{
+ // Assign.
+ typedef std::atomic_address test_type;
+ test_type t1;
+ test_type t2;
+ t1 = t2;
+}
+// { dg-error "within this context" "" { target *-*-* } 39 }
+// { dg-error "is private" "" { target *-*-* } 167 }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
new file mode 100644
index 00000000000..57732d83335
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/copy_neg.cc
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+void test01()
+{
+ // Copy.
+ typedef std::atomic_address test_type;
+ test_type t1;
+ test_type t2(t1);
+}
+// { dg-error "within this context" "" { target *-*-* } 38 }
+// { dg-error "is private" "" { target *-*-* } 166 }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc
new file mode 100644
index 00000000000..1d2c6cba50b
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/default.cc
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+int main()
+{
+ // Default constructor.
+ std::atomic_address a;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc
new file mode 100644
index 00000000000..b455bf667cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_address/cons/explicit_value.cc
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+int main()
+{
+ // Explicit value constructor.
+ void* v = NULL;
+ std::atomic_address a(v);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc
new file mode 100644
index 00000000000..7ee633ebb32
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/atomic_global_fence_compatibility.cc
@@ -0,0 +1,39 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+int main()
+{
+ using namespace std;
+ atomic_flag_fence(&atomic_global_fence_compatibility, memory_order_acquire);
+ atomic_global_fence_compatibility.fence(memory_order_release);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc
new file mode 100644
index 00000000000..151d85fc050
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/aggregate.cc
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+int main()
+{
+ // Only safe usage.
+ std::atomic_flag guard = ATOMIC_FLAG_INIT;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
new file mode 100644
index 00000000000..5f8ff15dc52
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/assign_neg.cc
@@ -0,0 +1,42 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+void test01()
+{
+ // Assign.
+ typedef std::atomic_flag test_type;
+ test_type t1;
+ test_type t2;
+ t1 = t2;
+}
+// { dg-error "within this context" "" { xfail *-*-* } 39 }
+// { dg-error "is private" "" { xfail *-*-* } 89 }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
new file mode 100644
index 00000000000..3480d8c5e16
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/copy_neg.cc
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+void test01()
+{
+ // Copy.
+ typedef std::atomic_flag test_type;
+ test_type t1;
+ test_type t2(t1);
+}
+// { dg-error "within this context" "" { xfail *-*-* } 38 }
+// { dg-error "is private" "" { xfail *-*-* } 88 }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc
new file mode 100644
index 00000000000..b4fa3a755b2
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/cons/default.cc
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+int main()
+{
+ // Default constructor.
+ std::atomic_flag a;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc
new file mode 100644
index 00000000000..351df912fff
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+#include <type_traits>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::atomic_flag test_type;
+ VERIFY( std::has_trivial_default_constructor<test_type>::value );
+ VERIFY( std::has_trivial_destructor<test_type>::value );
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c
new file mode 100644
index 00000000000..9401af4d13b
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.c
@@ -0,0 +1,40 @@
+// { dg-options "-x c -lstdc++" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <stdatomic.h>
+
+int main()
+{
+ atomic_flag af = ATOMIC_FLAG_INIT;
+
+ if (!atomic_flag_test_and_set_explicit(&af, memory_order_acquire))
+ atomic_flag_clear_explicit(&af, memory_order_release);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc
new file mode 100644
index 00000000000..c81a75aa99a
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+int main()
+{
+ using namespace std;
+ atomic_flag af = ATOMIC_FLAG_INIT;
+
+ if (!af.test_and_set(memory_order_acquire))
+ af.clear(memory_order_release);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c
new file mode 100644
index 00000000000..727421bd12f
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.c
@@ -0,0 +1,40 @@
+// { dg-options "-x c -lstdc++" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <stdatomic.h>
+
+int main()
+{
+ atomic_flag af = ATOMIC_FLAG_INIT;
+
+ if (!atomic_flag_test_and_set(&af))
+ atomic_flag_clear(&af);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc
new file mode 100644
index 00000000000..82961767e86
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdatomic>
+
+int main()
+{
+ using namespace std;
+ atomic_flag af = ATOMIC_FLAG_INIT;
+
+ if (!af.test_and_set())
+ af.clear();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc
new file mode 100644
index 00000000000..5444d71f378
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc
@@ -0,0 +1,50 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <cstdatomic>
+
+namespace gnu
+{
+ using std::atomic_flag_test_and_set;
+ using std::atomic_flag_test_and_set_explicit;
+ using std::atomic_flag_clear;
+ using std::atomic_flag_clear_explicit;
+ using std::atomic_flag_fence;
+
+ using std::atomic_global_fence_compatibility;
+
+ // Sloppy testing for integral types (en masse).
+ using std::atomic_is_lock_free;
+ using std::atomic_store;
+ using std::atomic_store_explicit;
+ using std::atomic_load;
+ using std::atomic_load_explicit;
+ using std::atomic_swap;
+ using std::atomic_swap_explicit;
+ using std::atomic_compare_swap;
+ using std::atomic_compare_swap_explicit;
+ using std::atomic_fence;
+
+ using std::atomic_fetch_add;
+ using std::atomic_fetch_add_explicit;
+ using std::atomic_fetch_sub;
+ using std::atomic_fetch_sub_explicit;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc
new file mode 100644
index 00000000000..62f76ab1f0e
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <cstdatomic>
+
+namespace gnu
+{
+#ifndef ATOMIC_INTEGRAL_LOCK_FREE
+ #error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro"
+#endif
+
+#ifndef ATOMIC_ADDRESS_LOCK_FREE
+ #error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro"
+#endif
+
+#ifndef ATOMIC_FLAG_INIT
+ #error "ATOMIC_FLAG_INIT_must_be_a_macro"
+#endif
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc
new file mode 100644
index 00000000000..f72e8136a58
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++98" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <cstdatomic> // { dg-excess-errors "In file included from" }
+
+// { dg-error "upcoming ISO" "" { target *-*-* } 36 }
+
+
+
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc
new file mode 100644
index 00000000000..31b32c13813
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc
@@ -0,0 +1,80 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <cstdatomic>
+
+void test01()
+{
+ using std::memory_order;
+ using std::memory_order_relaxed;
+ using std::memory_order_acquire;
+ using std::memory_order_release;
+ using std::memory_order_acq_rel;
+ using std::memory_order_seq_cst;
+
+ using std::atomic_flag;
+
+ // atomics for builtins types
+ using std::atomic_bool;
+ using std::atomic_char;
+ using std::atomic_schar;
+ using std::atomic_uchar;
+ using std::atomic_short;
+ using std::atomic_ushort;
+ using std::atomic_int;
+ using std::atomic_uint;
+ using std::atomic_long;
+ using std::atomic_ulong;
+ using std::atomic_llong;
+ using std::atomic_ullong;
+ using std::atomic_wchar_t;
+ using std::atomic_char16_t;
+ using std::atomic_char32_t;
+
+ // atomics for standard typedefs
+ using std::atomic_int_least8_t;
+ using std::atomic_uint_least8_t;
+ using std::atomic_int_least16_t;
+ using std::atomic_uint_least16_t;
+ using std::atomic_int_least32_t;
+ using std::atomic_uint_least32_t;
+ using std::atomic_int_least64_t;
+ using std::atomic_uint_least64_t;
+ using std::atomic_int_fast8_t;
+ using std::atomic_uint_fast8_t;
+ using std::atomic_int_fast16_t;
+ using std::atomic_uint_fast16_t;
+ using std::atomic_int_fast32_t;
+ using std::atomic_uint_fast32_t;
+ using std::atomic_int_fast64_t;
+ using std::atomic_uint_fast64_t;
+ using std::atomic_intptr_t;
+ using std::atomic_uintptr_t;
+ using std::atomic_size_t;
+ using std::atomic_ssize_t;
+ using std::atomic_ptrdiff_t;
+ using std::atomic_intmax_t;
+ using std::atomic_uintmax_t;
+
+ using std::atomic_address;
+
+ &std::atomic_global_fence_compatibility;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c
new file mode 100644
index 00000000000..1282c0df906
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c
@@ -0,0 +1,38 @@
+// { dg-options "-x c" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <stdatomic.h>
+
+int main()
+{
+ volatile atomic_flag f;
+ volatile atomic_flag* p = &f;
+ memory_order m = memory_order_relaxed;
+
+ // For position only.
+ atomic_flag_test_and_set(p);
+ atomic_flag_test_and_set_explicit(p, m);
+ atomic_flag_clear(p);
+ atomic_flag_clear_explicit(p, m);
+ atomic_flag_fence(p, m);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
new file mode 100644
index 00000000000..30368a06bf4
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c
@@ -0,0 +1,119 @@
+// { dg-options "-x c" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <stdatomic.h>
+
+int main()
+{
+#ifndef ATOMIC_INTEGRAL_LOCK_FREE
+ #error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro"
+#endif
+
+#ifndef ATOMIC_ADDRESS_LOCK_FREE
+ #error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro"
+#endif
+
+#ifndef ATOMIC_FLAG_INIT
+ #error "ATOMIC_FLAG_INIT_must_be_a_macro"
+#endif
+
+#ifndef atomic_is_lock_free
+ #error "atomic_is_lock_free_must_be_a_macro"
+#endif
+
+#ifndef atomic_load
+ #error "atomic_load_must_be_a_macro"
+#endif
+
+#ifndef atomic_load_explicit
+ #error "atomic_load_explicit_must_be_a_macro"
+#endif
+
+#ifndef atomic_store_explicit
+ #error "atomic_store_explicit_must_be_a_macro"
+#endif
+
+#ifndef atomic_store
+ #error "atomic_store_must_be_a_macro"
+#endif
+
+#ifndef atomic_swap_explicit
+ #error "atomic_swap_explicit_must_be_a_macro"
+#endif
+
+#ifndef atomic_swap
+ #error "atomic_swap_must_be_a_macro"
+#endif
+
+#ifndef atomic_compare_swap
+ #error "atomic_compare_swap_must_be_a_macro"
+#endif
+
+#ifndef atomic_compare_swap_explicit
+ #error "atomic_compare_swap_explicit_must_be_a_macro"
+#endif
+
+#ifndef atomic_fence
+ #error "atomic_fence_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_add_explicit
+ #error "atomic_fetch_add_explicit_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_add
+ #error "atomic_fetch_add_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_sub_explicit
+ #error "atomic_fetch_sub_explicit_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_sub
+ #error "atomic_fetch_sub_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_and_explicit
+ #error "atomic_fetch_and_explicit_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_and
+ #error "atomic_fetch_and_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_or_explicit
+ #error "atomic_fetch_or_explicit_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_or
+ #error "atomic_fetch_or_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_xor_explicit
+ #error "atomic_fetch_xor_explicit_must_be_a_macro"
+#endif
+
+#ifndef atomic_fetch_xor
+ #error "atomic_fetch_xor_must_be_a_macro"
+#endif
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c
new file mode 100644
index 00000000000..8e9cfd56e01
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c
@@ -0,0 +1,80 @@
+// { dg-options "-x c" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <stdatomic.h>
+
+void test01()
+{
+ typedef memory_order t_01;
+ memory_order t_02 = memory_order_relaxed;
+ memory_order t_03 = memory_order_acquire;
+ memory_order t_04 = memory_order_release;
+ memory_order t_05 = memory_order_acq_rel;
+ memory_order t_06 = memory_order_seq_cst;
+
+ typedef atomic_flag t_07;
+
+ // atomics for builtins types
+ typedef atomic_bool t_08;
+ typedef atomic_char t_09;
+ typedef atomic_schar t_10;
+ typedef atomic_uchar t_11;
+ typedef atomic_short t_12;
+ typedef atomic_ushort t_13;
+ typedef atomic_int t_14;
+ typedef atomic_uint t_15;
+ typedef atomic_long t_16;
+ typedef atomic_ulong t_17;
+ typedef atomic_llong t_18;
+ typedef atomic_ullong t_19;
+ typedef atomic_wchar_t t_20;
+ typedef atomic_char16_t t_21;
+ typedef atomic_char32_t t_22;
+
+ // atomics for standard typedefs
+ typedef atomic_int_least8_t t_23;
+ typedef atomic_uint_least8_t t_24;
+ typedef atomic_int_least16_t t_25;
+ typedef atomic_uint_least16_t t_26;
+ typedef atomic_int_least32_t t_27;
+ typedef atomic_uint_least32_t t_28;
+ typedef atomic_int_least64_t t_29;
+ typedef atomic_uint_least64_t t_30;
+ typedef atomic_int_fast8_t t_31;
+ typedef atomic_uint_fast8_t t_32;
+ typedef atomic_int_fast16_t t_33;
+ typedef atomic_uint_fast16_t t_34;
+ typedef atomic_int_fast32_t t_35;
+ typedef atomic_uint_fast32_t t_36;
+ typedef atomic_int_fast64_t t_37;
+ typedef atomic_uint_fast64_t t_38;
+ typedef atomic_intptr_t t_39;
+ typedef atomic_uintptr_t t_40;
+ typedef atomic_size_t t_41;
+ typedef atomic_ssize_t t_42;
+ typedef atomic_ptrdiff_t t_43;
+ typedef atomic_intmax_t t_44;
+ typedef atomic_uintmax_t t_45;
+
+ typedef atomic_address t_46;
+
+ &atomic_global_fence_compatibility;
+}