diff options
Diffstat (limited to 'libstdc++-v3/testsuite/29_atomics/headers')
7 files changed, 170 insertions, 261 deletions
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc index c0419c9b8d8..022cd90b250 100644 --- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc +++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// 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 @@ -22,24 +22,91 @@ namespace gnu { -#ifndef ATOMIC_INTEGRAL_LOCK_FREE -# error "ATOMIC_INTEGRAL_LOCK_FREE must be a macro" +#ifndef ATOMIC_CHAR_LOCK_FREE +# error "ATOMIC_CHAR_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" +# 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_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" +# if ATOMIC_ADDRESS_LOCK_FREE != 0 \ + && ATOMIC_ADDRESS_LOCK_FREE != 1 && ATOMIC_ADDRESS_LOCK_FREE != 2 +# error "ATOMIC_ADDRESS_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/types_std_c++0x.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc index ce1e04359ad..13e4949e9b1 100644 --- 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 @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// 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 @@ -69,7 +69,6 @@ void test01() 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; 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 index cbdb5e6fcb2..57907734304 100644 --- 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 @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2009 Free Software Foundation, Inc. +// 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 @@ -49,6 +49,29 @@ void test01() 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; } @@ -76,3 +99,72 @@ void test01() // { 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 } diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c deleted file mode 100644 index a8abfbe929f..00000000000 --- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c +++ /dev/null @@ -1,22 +0,0 @@ -// { 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/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c deleted file mode 100644 index d56937678e2..00000000000 --- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/functions.c +++ /dev/null @@ -1,36 +0,0 @@ -// { 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() -{ - atomic_flag f; - 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/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c deleted file mode 100644 index 7d6992e4a38..00000000000 --- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/macros.c +++ /dev/null @@ -1,114 +0,0 @@ -// { 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/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c deleted file mode 100644 index 48d6d926759..00000000000 --- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/types.c +++ /dev/null @@ -1,77 +0,0 @@ -// { 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; -} |