diff options
author | Jing Yu <jingyu@google.com> | 2010-07-22 14:03:48 -0700 |
---|---|---|
committer | Jing Yu <jingyu@google.com> | 2010-07-22 14:03:48 -0700 |
commit | b094d6c4bf572654a031ecc4afe675154c886dc5 (patch) | |
tree | 89394c56b05e13a5413ee60237d65b0214fd98e2 /gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers | |
parent | dc34721ac3bf7e3c406fba8cfe9d139393345ec5 (diff) | |
download | toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.gz toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.bz2 toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.zip |
commit gcc-4.4.3 which is used to build gcc-4.4.3 Android toolchain in master.
The source is based on fsf gcc-4.4.3 and contains local patches which
are recorded in gcc-4.4.3/README.google.
Change-Id: Id8c6d6927df274ae9749196a1cc24dbd9abc9887
Diffstat (limited to 'gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers')
8 files changed, 447 insertions, 0 deletions
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/functions_std_c++0x.cc new file mode 100644 index 000000000..ad43813dd --- /dev/null +++ b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/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 <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::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/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc new file mode 100644 index 000000000..1e2ae1f1b --- /dev/null +++ b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/macros.cc @@ -0,0 +1,45 @@ +// { 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 <cstdatomic> + +namespace gnu +{ +#ifndef ATOMIC_INTEGRAL_LOCK_FREE +# 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" +# 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 + #error "ATOMIC_FLAG_INIT_must_be_a_macro" +#endif +} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/std_c++0x_neg.cc new file mode 100644 index 000000000..044794c88 --- /dev/null +++ b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/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 <cstdatomic> // { dg-excess-errors "In file included from" } + +// { dg-error "upcoming ISO" "" { target *-*-* } 31 } + + + diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc new file mode 100644 index 000000000..d3c3ea470 --- /dev/null +++ b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/cstdatomic/types_std_c++0x.cc @@ -0,0 +1,78 @@ +// { 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 <cstdatomic> + +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_ssize_t; + using std::atomic_ptrdiff_t; + using std::atomic_intmax_t; + using std::atomic_uintmax_t; + + using std::atomic_address; +} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c new file mode 100644 index 000000000..a8abfbe92 --- /dev/null +++ b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c @@ -0,0 +1,22 @@ +// { dg-options "-x c -D_GLIBCXX_DEBUG" } +// { 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/>. + +// libstdc++/36130 +#include <stdatomic.h> diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c new file mode 100644 index 000000000..9c9fe7d1e --- /dev/null +++ b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c @@ -0,0 +1,36 @@ +// { dg-options "-x c" } +// { 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 <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); + + return 0; +} diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c new file mode 100644 index 000000000..7d6992e4a --- /dev/null +++ b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c @@ -0,0 +1,114 @@ +// { dg-options "-x c" } +// { 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 <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_exchange_explicit + #error "atomic_exchange_explicit_must_be_a_macro" +#endif + +#ifndef atomic_exchange + #error "atomic_exchange_must_be_a_macro" +#endif + +#ifndef atomic_compare_exchange + #error "atomic_compare_exchange_must_be_a_macro" +#endif + +#ifndef atomic_compare_exchange_explicit + #error "atomic_compare_exchange_explicit_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/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c new file mode 100644 index 000000000..48d6d9267 --- /dev/null +++ b/gcc-4.4.3/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c @@ -0,0 +1,77 @@ +// { dg-options "-x c" } +// { 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 <stdatomic.h> + +void test01() +{ + typedef memory_order t_01; + memory_order t_02 __attribute__((unused)) = memory_order_relaxed; + memory_order t_03 __attribute__((unused)) = memory_order_acquire; + memory_order t_04 __attribute__((unused)) = memory_order_release; + memory_order t_05 __attribute__((unused)) = memory_order_acq_rel; + memory_order t_06 __attribute__((unused)) = 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; +} |