From 148864cb8c972b4c87e2e6a3183a83047666edcb Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 22 Feb 2019 01:16:15 +0000 Subject: [PATCH] Add tests for C++2a content of header * testsuite/29_atomics/headers/atomic/types_std_c++20.cc: New test. * testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc: New test. From-SVN: r269091 --- libstdc++-v3/ChangeLog | 6 ++ .../headers/atomic/types_std_c++20.cc | 96 +++++++++++++++++++ .../headers/atomic/types_std_c++20_neg.cc | 83 ++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20.cc create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3980774df93..eb68aba953b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2019-02-21 Jonathan Wakely + + * testsuite/29_atomics/headers/atomic/types_std_c++20.cc: New test. + * testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc: New + test. + 2019-02-22 Tom Honermann * python/libstdcxx/v6/printers.py (register_type_printers): Add type diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20.cc new file mode 100644 index 00000000000..e8a76204f55 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20.cc @@ -0,0 +1,96 @@ +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } +// { dg-require-cstdint "" } + +// Copyright (C) 2008-2019 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 +// . + +#include + +void test01() +{ + using std::memory_order; + // TODO add checks for new enumerators memory_order::relaxed etc. + // 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::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; +#ifdef _GLIBCXX_USE_CHAR8_T + using std::atomic_char8_t; +#endif + 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; + + // DR 2441 + using std::atomic_int8_t; + using std::atomic_uint8_t; + using std::atomic_int16_t; + using std::atomic_uint16_t; + using std::atomic_int32_t; + using std::atomic_uint32_t; + using std::atomic_int64_t; + using std::atomic_uint64_t; +} diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc new file mode 100644 index 00000000000..7f57e16461c --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc @@ -0,0 +1,83 @@ +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } +// { dg-require-cstdint "" } + +// Copyright (C) 2009-2019 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 +// . + +#include + +void test01() +{ + // Not global scoped, only namespace std. + using memory_order; // { dg-error "expected nested-name-specifier" } + // TODO add checks for new enumerators memory_order::relaxed etc. + using memory_order_relaxed; // { dg-error "expected nested-name-specifier" } + using memory_order_consume; // { dg-error "expected nested-name-specifier" } + using memory_order_acquire; // { dg-error "expected nested-name-specifier" } + using memory_order_release; // { dg-error "expected nested-name-specifier" } + using memory_order_acq_rel; // { dg-error "expected nested-name-specifier" } + using memory_order_seq_cst; // { dg-error "expected nested-name-specifier" } + + using atomic_flag; // { dg-error "expected nested-name-specifier" } + + using atomic_bool; // { dg-error "expected nested-name-specifier" } + using atomic_char; // { dg-error "expected nested-name-specifier" } + using atomic_schar; // { dg-error "expected nested-name-specifier" } + using atomic_uchar; // { dg-error "expected nested-name-specifier" } + using atomic_short; // { dg-error "expected nested-name-specifier" } + using atomic_ushort; // { dg-error "expected nested-name-specifier" } + using atomic_int; // { dg-error "expected nested-name-specifier" } + using atomic_uint; // { dg-error "expected nested-name-specifier" } + using atomic_long; // { dg-error "expected nested-name-specifier" } + using atomic_ulong; // { dg-error "expected nested-name-specifier" } + using atomic_llong; // { dg-error "expected nested-name-specifier" } + using atomic_ullong; // { dg-error "expected nested-name-specifier" } + using atomic_wchar_t; // { dg-error "expected nested-name-specifier" } +#ifdef _GLIBCXX_USE_CHAR8_T + using atomic_char8_t; // { dg-error "expected nested-name-specifier" } +#endif + using atomic_char16_t; // { dg-error "expected nested-name-specifier" } + using atomic_char32_t; // { dg-error "expected nested-name-specifier" } + + using atomic_int_least8_t; // { dg-error "expected nested-name-specifier" } + using atomic_uint_least8_t; // { dg-error "expected nested-name-specifier" } + using atomic_int_least16_t; // { dg-error "expected nested-name-specifier" } + using atomic_uint_least16_t; // { dg-error "expected nested-name-specifier" } + using atomic_int_least32_t; // { dg-error "expected nested-name-specifier" } + using atomic_uint_least32_t; // { dg-error "expected nested-name-specifier" } + using atomic_int_least64_t; // { dg-error "expected nested-name-specifier" } + using atomic_uint_least64_t; // { dg-error "expected nested-name-specifier" } + using atomic_int_fast8_t; // { dg-error "expected nested-name-specifier" } + using atomic_uint_fast8_t; // { dg-error "expected nested-name-specifier" } + using atomic_int_fast16_t; // { dg-error "expected nested-name-specifier" } + using atomic_uint_fast16_t; // { dg-error "expected nested-name-specifier" } + using atomic_int_fast32_t; // { dg-error "expected nested-name-specifier" } + using atomic_uint_fast32_t; // { dg-error "expected nested-name-specifier" } + using atomic_int_fast64_t; // { dg-error "expected nested-name-specifier" } + using atomic_uint_fast64_t; // { dg-error "expected nested-name-specifier" } + using atomic_intptr_t; // { dg-error "expected nested-name-specifier" } + using atomic_uintptr_t; // { dg-error "expected nested-name-specifier" } + using atomic_size_t; // { dg-error "expected nested-name-specifier" } + using atomic_ptrdiff_t; // { dg-error "expected nested-name-specifier" } + using atomic_intmax_t; // { dg-error "expected nested-name-specifier" } + using atomic_uintmax_t; // { dg-error "expected nested-name-specifier" } + + using atomic_address; // { dg-error "expected nested-name-specifier" } + // Present in C++0x drafts but not final C++11 standard: + using std::atomic_address; // { dg-error "has not been declared" } +} -- 2.30.2