summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/29_atomics/headers
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/29_atomics/headers
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/29_atomics/headers')
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/atomic/functions_std_c++0x.cc49
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc104
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc26
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc75
-rw-r--r--libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc170
5 files changed, 424 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/functions_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/functions_std_c++0x.cc
new file mode 100644
index 000000000..7af4369aa
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/functions_std_c++0x.cc
@@ -0,0 +1,49 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <atomic>
+
+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::kill_dependency;
+
+ // 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_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;
+ using std::atomic_fetch_sub;
+ using std::atomic_fetch_sub_explicit;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
new file mode 100644
index 000000000..e2461a111
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc
@@ -0,0 +1,104 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008, 2009, 2010 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <atomic>
+
+namespace gnu
+{
+#ifndef ATOMIC_CHAR_LOCK_FREE
+# error "ATOMIC_CHAR_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_CHAR_LOCK_FREE != 0 \
+ && ATOMIC_CHAR_LOCK_FREE != 1 && ATOMIC_CHAR_LOCK_FREE != 2
+# error "ATOMIC_CHAR_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_CHAR16_T_LOCK_FREE
+# error "ATOMIC_CHAR16_T_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_CHAR16_T_LOCK_FREE != 0 \
+ && ATOMIC_CHAR16_T_LOCK_FREE != 1 && ATOMIC_CHAR16_T_LOCK_FREE != 2
+# error "ATOMIC_CHAR16_T_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_CHAR32_T_LOCK_FREE
+# error "ATOMIC_CHAR32_T_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_CHAR32_T_LOCK_FREE != 0 \
+ && ATOMIC_CHAR32_T_LOCK_FREE != 1 && ATOMIC_CHAR32_T_LOCK_FREE != 2
+# error "ATOMIC_CHAR32_T_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_WCHAR_T_LOCK_FREE
+# error "ATOMIC_WCHAR_T_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_WCHAR_T_LOCK_FREE != 0 \
+ && ATOMIC_WCHAR_T_LOCK_FREE != 1 && ATOMIC_WCHAR_T_LOCK_FREE != 2
+# error "ATOMIC_WCHAR_T_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_SHORT_LOCK_FREE
+# error "ATOMIC_SHORT_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_SHORT_LOCK_FREE != 0 \
+ && ATOMIC_SHORT_LOCK_FREE != 1 && ATOMIC_SHORT_LOCK_FREE != 2
+# error "ATOMIC_SHORT_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_INT_LOCK_FREE
+# error "ATOMIC_INT_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_INT_LOCK_FREE != 0 \
+ && ATOMIC_INT_LOCK_FREE != 1 && ATOMIC_INT_LOCK_FREE != 2
+# error "ATOMIC_INT_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_LONG_LOCK_FREE
+# error "ATOMIC_LONG_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_LONG_LOCK_FREE != 0 \
+ && ATOMIC_LONG_LOCK_FREE != 1 && ATOMIC_LONG_LOCK_FREE != 2
+# error "ATOMIC_LONG_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_LLONG_LOCK_FREE
+# error "ATOMIC_LLONG_LOCK_FREE must be a macro"
+#else
+# if ATOMIC_LLONG_LOCK_FREE != 0 \
+ && ATOMIC_LLONG_LOCK_FREE != 1 && ATOMIC_LLONG_LOCK_FREE != 2
+# error "ATOMIC_LLONG_LOCK_FREE must be 0, 1, or 2"
+# endif
+#endif
+
+#ifndef ATOMIC_FLAG_INIT
+ #error "ATOMIC_FLAG_INIT_must_be_a_macro"
+#endif
+
+#ifndef ATOMIC_VAR_INIT
+ #error "ATOMIC_VAR_INIT_must_be_a_macro"
+#endif
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc
new file mode 100644
index 000000000..be390b0f7
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++98" }
+
+// Copyright (C) 2008, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <atomic> // { dg-excess-errors "In file included from" }
+
+// { dg-error "upcoming ISO" "" { target *-*-* } 32 }
+
+
+
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
new file mode 100644
index 000000000..772bc338e
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
@@ -0,0 +1,75 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008, 2009, 2010, 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <atomic>
+
+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;
+ 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_ptrdiff_t;
+ using std::atomic_intmax_t;
+ using std::atomic_uintmax_t;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc
new file mode 100644
index 000000000..579077343
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc
@@ -0,0 +1,170 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2009, 2010 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <atomic>
+
+void test01()
+{
+ // Not global scoped, only namespace std.
+ using memory_order;
+ using memory_order_relaxed;
+ using memory_order_consume;
+ using memory_order_acquire;
+ using memory_order_release;
+ using memory_order_acq_rel;
+ using memory_order_seq_cst;
+
+ using atomic_flag;
+
+ using atomic_bool;
+ using atomic_char;
+ using atomic_schar;
+ using atomic_uchar;
+ using atomic_short;
+ using atomic_ushort;
+ using atomic_int;
+ using atomic_uint;
+ using atomic_long;
+ using atomic_ulong;
+ using atomic_llong;
+ using atomic_ullong;
+ using atomic_wchar_t;
+ using atomic_char16_t;
+ using atomic_char32_t;
+
+ using atomic_int_least8_t;
+ using atomic_uint_least8_t;
+ using atomic_int_least16_t;
+ using atomic_uint_least16_t;
+ using atomic_int_least32_t;
+ using atomic_uint_least32_t;
+ using atomic_int_least64_t;
+ using atomic_uint_least64_t;
+ using atomic_int_fast8_t;
+ using atomic_uint_fast8_t;
+ using atomic_int_fast16_t;
+ using atomic_uint_fast16_t;
+ using atomic_int_fast32_t;
+ using atomic_uint_fast32_t;
+ using atomic_int_fast64_t;
+ using atomic_uint_fast64_t;
+ using atomic_intptr_t;
+ using atomic_uintptr_t;
+ using atomic_size_t;
+ using atomic_ptrdiff_t;
+ using atomic_intmax_t;
+ using atomic_uintmax_t;
+
+ using atomic_address;
+}
+
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 26 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 27 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 28 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 29 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 30 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 31 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 32 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 34 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 36 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 37 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 38 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 39 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 40 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 41 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 42 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 43 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 44 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 45 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 46 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 47 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 48 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 49 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 50 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 52 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 53 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 54 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 55 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 56 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 57 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 58 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 59 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 60 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 61 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 62 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 63 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 64 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 65 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 66 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 67 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 68 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 69 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 70 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 71 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 72 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 73 }
+// { dg-error "expected nested-name-specifier" "" { target *-*-* } 75 }
+
+// { dg-error "declared" "" { target *-*-* } 26 }
+// { dg-error "declared" "" { target *-*-* } 27 }
+// { dg-error "declared" "" { target *-*-* } 28 }
+// { dg-error "declared" "" { target *-*-* } 29 }
+// { dg-error "declared" "" { target *-*-* } 30 }
+// { dg-error "declared" "" { target *-*-* } 31 }
+// { dg-error "declared" "" { target *-*-* } 32 }
+// { dg-error "declared" "" { target *-*-* } 34 }
+// { dg-error "declared" "" { target *-*-* } 36 }
+// { dg-error "declared" "" { target *-*-* } 37 }
+// { dg-error "declared" "" { target *-*-* } 38 }
+// { dg-error "declared" "" { target *-*-* } 39 }
+// { dg-error "declared" "" { target *-*-* } 40 }
+// { dg-error "declared" "" { target *-*-* } 41 }
+// { dg-error "declared" "" { target *-*-* } 42 }
+// { dg-error "declared" "" { target *-*-* } 43 }
+// { dg-error "declared" "" { target *-*-* } 44 }
+// { dg-error "declared" "" { target *-*-* } 45 }
+// { dg-error "declared" "" { target *-*-* } 46 }
+// { dg-error "declared" "" { target *-*-* } 47 }
+// { dg-error "declared" "" { target *-*-* } 48 }
+// { dg-error "declared" "" { target *-*-* } 49 }
+// { dg-error "declared" "" { target *-*-* } 50 }
+// { dg-error "declared" "" { target *-*-* } 52 }
+// { dg-error "declared" "" { target *-*-* } 53 }
+// { dg-error "declared" "" { target *-*-* } 54 }
+// { dg-error "declared" "" { target *-*-* } 55 }
+// { dg-error "declared" "" { target *-*-* } 56 }
+// { dg-error "declared" "" { target *-*-* } 57 }
+// { dg-error "declared" "" { target *-*-* } 58 }
+// { dg-error "declared" "" { target *-*-* } 59 }
+// { dg-error "declared" "" { target *-*-* } 60 }
+// { dg-error "declared" "" { target *-*-* } 61 }
+// { dg-error "declared" "" { target *-*-* } 62 }
+// { dg-error "declared" "" { target *-*-* } 63 }
+// { dg-error "declared" "" { target *-*-* } 64 }
+// { dg-error "declared" "" { target *-*-* } 65 }
+// { dg-error "declared" "" { target *-*-* } 66 }
+// { dg-error "declared" "" { target *-*-* } 67 }
+// { dg-error "declared" "" { target *-*-* } 68 }
+// { dg-error "declared" "" { target *-*-* } 69 }
+// { dg-error "declared" "" { target *-*-* } 70 }
+// { dg-error "declared" "" { target *-*-* } 71 }
+// { dg-error "declared" "" { target *-*-* } 72 }
+// { dg-error "declared" "" { target *-*-* } 73 }
+// { dg-error "declared" "" { target *-*-* } 75 }