Commit 94a86be0 by Benjamin Kosnik Committed by Jason Merrill

libstdc++: N3126 draft support.

	* include/std/chrono: Extend constexpr application.
	* testsuite/util/testsuite_common_types.h
	(constexpr_default_constructible, constexpr_single_value_constructible)
	: Add comments about implied constraints.
	* testsuite/20_util/duration/cons/constexpr.cc: Activate all tests.
	* testsuite/20_util/time_point/cons/constexpr.cc: Same.
	* testsuite/20_util/time_point/requirements/constexpr_functions.cc:
	Same.
	* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust line
	numbers.
	* testsuite/20_util/time_point_cast/constexpr.cc: New.

	* include/std/bitset: Use __SIZEOF_* macros to re-create original
	logic instead of slipshod application of
	std::numeric_limits<T>::max() macros.
	* testsuite/util/testsuite_common_types.h
	(constexpr_default_constructible): Modify.

	* include/std/chrono: Tested constexpr.
	* testsuite/20_util/duration_cast/constexpr.cc: New.
	* testsuite/20_util/time_point/cons/constexpr.cc: New.

	* testsuite/20_util/duration/cons/constexpr.cc: Add single_value tests.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust
	line numbers.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
	* testsuite/20_util/time_point/cons/constexpr.cc: Add single_value
	tests.
	* testsuite/20_util/time_point/requirements/constexpr_functions.cc: Add.

	* testsuite/util/testsuite_common_types.h: Adjust init.

	* include/std/chrono (duration): Remove defaulted constructor,
	replace with mem-init list.
	* testsuite/20_util/duration/cons/constexpr.cc: Add single value.
	* testsuite/20_util/duration/requirements/constexpr_functions.cc:
	Add non-static member functions.

	* testsuite/20_util/default_delete/cons/constexpr.cc: New, xfail.
	* testsuite/20_util/enable_shared_from_this/cons/constexpr.cc: Same.
	* testsuite/20_util/shared_ptr/cons/constexpr.cc: Same.
	* testsuite/20_util/time_point/requirements/constexpr_functions.cc:
	Same.
	* testsuite/20_util/unique_ptr/cons/constexpr.cc: Same.
	* testsuite/20_util/weak_ptr/cons/constexpr.cc: Same.

	* include/std/bitset: Add constexpr as per N3126 draft.
	* testsuite/23_containers/bitset/cons/constexpr.cc: New.
	* testsuite/23_containers/bitset/requirements/constexpr_functions.cc:
	New.

	* testsuite/util/testsuite_common_types.h: Reset condition.

	* include/bits/random.h: Remove misleading comments.
	* include/bits/regex.h: Add constexpr.
	* testsuite/28_regex/05_constants/syntax_option_type.cc: Add tests.
	* testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc: New.

	PR libstdc++/46134
	* include/std/chrono: Use default constructor.
	* testsuite/util/testsuite_common_types.h
	(constexpr_default_constructible): Adjust condition.

	PR libstdc++/46133
	* include/std/complex: Adjust complex specialization default
	constructors for constexpr.
	* testsuite/26_numerics/complex/cons/constexpr.cc: Enable tests.

	* include/bits/random.h: Adjust for constexpr as per N3126 draft.
	* testsuite/26_numerics/random/discard_block_engine/requirements/
	constexpr_data.cc: New.
	* testsuite/26_numerics/random/discard_block_engine/requirements/
	constexpr_functions.cc: New.
	* testsuite/26_numerics/random/independent_bits_engine/requirements/
	constexpr_functions.cc: New.
	* testsuite/26_numerics/random/linear_congruential_engine/requirements/
	constexpr_data.cc: New.
	* testsuite/26_numerics/random/linear_congruential_engine/requirements/
	constexpr_functions.cc: New.
	* testsuite/26_numerics/random/mersenne_twister_engine/requirements/
	constexpr_data.cc: New.
	* testsuite/26_numerics/random/mersenne_twister_engine/requirements/
	constexpr_functions.cc: New.
	* testsuite/26_numerics/random/shuffle_order_engine/requirements/
	constexpr_data.cc: New.
	* testsuite/26_numerics/random/shuffle_order_engine/requirements/
	constexpr_functions.cc: New.
	* testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
	constexpr_data.cc: New.
	* testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
	constexpr_functions.cc: New.

	* include/bits/stream_iterator.h: Add constexpr as per N3126 draft.
	* include/bits/streambuf_iterator.h: Same.
	* include/std/complex: Same.
	* testsuite/24_iterators/istream_iterator/cons/constexpr.cc: New.
	* testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc: New.
	* testsuite/26_numerics/complex/cons/constexpr.cc: New.
	* testsuite/26_numerics/complex/requirements/constexpr_functions.cc:
	New.

	* include/bits/char_traits.h: Add constexpr as per N3126 draft.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions.cc:
	New.

	* include/tr1_impl/array: Add constexpr as per N3126 draft.
	* testsuite/23_containers/array/requirements/
	constexpr_functions.cc: New.

	* include/bits/shared_ptr.h: Revert changes.
	* include/bits/unique_ptr.h: Same.

	* include/std/chrono: Adjust.
	* include/tr1_impl/type_traits: Same.

	* testsuite/util/testsuite_common_types.h: Add test functors.
	* testsuite/20_util/duration/cons/constexpr.cc: New.
	* testsuite/20_util/duration/requirements/constexpr_functions.cc: Same.
	* testsuite/20_util/pair/cons/constexpr.cc: Same.
	* testsuite/20_util/ratio/requirements/constexpr_data.cc: Same.
	* testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc: Same.
	* testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc: Same.
	* testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc: Same.
	* testsuite/30_threads/call_once/constexpr.cc: Same.
	* testsuite/30_threads/mutex/cons/constexpr.cc: Same.
	* testsuite/30_threads/once_flag/cons/constexpr.cc: Same.
	* testsuite/tr1/4_metaprogramming/integral_constant/requirements/
	constexpr_data.cc: Same.

	* testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust line numbers.
	* testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Same.

	* include/bits/allocator.h: Add constexpr as per N3126 draft.
	* include/bits/ios_base.h: Same.
	* include/bits/shared_ptr.h: Same.
	* include/bits/unique_ptr.h: Same.
	* include/bits/stl_iterator.h: Same.
	* include/bits/stl_pair.h: Same.
	* include/std/tuple: Same.
	* include/tr1_impl/type_traits: Same.
	* include/std/chrono: Same.
	* include/std/ratio: Same.
	* include/std/mutex: Same.
	* src/mutex.cc: Same.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
	* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
	* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
	* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.

	* doc/doxygen/user.cfg.in: Replace _GLIBCXX_USE_CONSTEXPR,
	_GLIBCXX_CONSTEXPR for doxygen generation.

	* src/limits.cc: Undef.
	* testsuite/29_atomics/atomic/cons/constexpr.cc: Adjust.
	* testsuite/29_atomics/atomic_address/cons/constexpr.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/constexpr.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.c: Same.
	* testsuite/18_support/numeric_limits/constexpr.cc: To...
	* testsuite/18_support/numeric_limits/requirements/
	constexpr_data.cc, constexpr_functions.cc: ...this

	* testsuite/util/testsuite_common_types.h
	(constexpr_single_value_constructible): Add.
	* testsuite/29_atomics/atomic/cons/constexpr.cc: Adjust name.
	* testsuite/29_atomics/atomic_integral/cons/constexpr.cc: Same.
	* testsuite/29_atomics/atomic_address/cons/constexpr.cc: New.
	* testsuite/18_support/numeric_limits/constexpr.cc: New.

	* testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust line numbers.
	* testsuite/29_atomics/atomic/cons/constexpr.cc: Same.
	* testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/constexpr.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/increment_neg.cc: Same.

	* include/bits/c++config (_GLIBCXX_CONSTEXPR): Add.
	(_GLIBCXX_USE_CONSTEXPR): Add.
	* include/std/limits: Use it.
	* src/limits.cc: Adjust.
	* testsuite/ext/profile/mutex_extensions.cc: Change line number.

	* include/bits/atomic_0.h: Rework for N3126 draft, add constexpr.
	* include/bits/atomic_2.h: Same.
	* include/bits/atomic_base.h: Same.
	* include/std/atomic: Same.
	* src/atomic.cc: Same.
	* include/bits/atomicfwd_c.h: Remove.
	* include/bits/atomicfwd_cxx.h: Remove.
	* include/c_compatibility/stdatomic.h: Remove.
	* include/Makefile.am: Remove atomicfwd_c.h, atomicfwd_cxx.h,
	stdatomic.h.
	* include/Makefile.in: Regenerate.
	* doc/xml/manual/using.xml: Update list of header files for changes.
	* testsuite/util/testsuite_common_types.h
	(constexpr_constructible): Add.
	* testsuite/29_atomics/atomic/cons/constexpr.cc: New.
	* testsuite/29_atomics/atomic_integral/cons/constexpr.cc: New.
	* testsuite/17_intro/headers/c++200x/stdc++.cc: Modify.
	* testsuite/29_atomics/atomic/cons/assign_neg.cc: Same.
	* testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same.
	* testsuite/29_atomics/atomic_flag/cons/1.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
	* testsuite/29_atomics/headers/atomic/macros.cc: Same.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Same.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc: Same.
	* testsuite/29_atomics/atomic_flag/test_and_set/implicit.c: Remove.
	* testsuite/29_atomics/atomic_flag/test_and_set/explicit.c: Same.
	* testsuite/29_atomics/atomic_flag/clear/1.c: Same.
	* testsuite/29_atomics/headers/stdatomic.h/debug_mode.c: Same.
	* testsuite/29_atomics/headers/stdatomic.h/functions.c: Same.
	* testsuite/29_atomics/headers/stdatomic.h/macros.c: Same.
	* testsuite/29_atomics/headers/stdatomic.h/types.c: Same.

	* testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.16.

From-SVN: r166171
parent 900484de
...@@ -1193,6 +1193,13 @@ GLIBCXX_3.4.15 { ...@@ -1193,6 +1193,13 @@ GLIBCXX_3.4.15 {
} GLIBCXX_3.4.14; } GLIBCXX_3.4.14;
GLIBCXX_3.4.16 {
# std::future_category is now a function
_ZSt15future_categoryv;
} GLIBCXX_3.4.15;
# Symbols in the support library (libsupc++) have their own tag. # Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 { CXXABI_1.3 {
......
...@@ -599,6 +599,7 @@ INPUT = @srcdir@/doc/doxygen/doxygroups.cc \ ...@@ -599,6 +599,7 @@ INPUT = @srcdir@/doc/doxygen/doxygroups.cc \
include/complex \ include/complex \
include/condition_variable \ include/condition_variable \
include/deque \ include/deque \
include/forward_list \
include/fstream \ include/fstream \
include/functional \ include/functional \
include/future \ include/future \
...@@ -1539,6 +1540,8 @@ PREDEFINED = __cplusplus \ ...@@ -1539,6 +1540,8 @@ PREDEFINED = __cplusplus \
_GLIBCXX_END_NESTED_NAMESPACE=} \ _GLIBCXX_END_NESTED_NAMESPACE=} \
"_GLIBCXX_TEMPLATE_ARGS=... " \ "_GLIBCXX_TEMPLATE_ARGS=... " \
_GLIBCXX_DEPRECATED \ _GLIBCXX_DEPRECATED \
_GLIBCXX_CONSTEXPR=constexpr \
_GLIBCXX_USE_CONSTEXPR=constexpr \
_GLIBCXX_USE_WCHAR_T \ _GLIBCXX_USE_WCHAR_T \
_GLIBCXX_USE_LONG_LONG \ _GLIBCXX_USE_LONG_LONG \
_GLIBCXX_USE_C99_STDINT_TR1 \ _GLIBCXX_USE_C99_STDINT_TR1 \
......
...@@ -354,10 +354,6 @@ mode, i.e. <literal>-std=c++0x</literal> or <literal>-std=gnu++0x</literal>. ...@@ -354,10 +354,6 @@ mode, i.e. <literal>-std=c++0x</literal> or <literal>-std=gnu++0x</literal>.
<entry><filename class="headerfile">cwchar</filename></entry> <entry><filename class="headerfile">cwchar</filename></entry>
<entry><filename class="headerfile">cwctype</filename></entry> <entry><filename class="headerfile">cwctype</filename></entry>
</row> </row>
<row>
<entry><filename class="headerfile">stdatomic.h</filename></entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
......
#o# Makefile for the include subdirectory of the GNU C++ Standard library. ## Makefile for the include subdirectory of the GNU C++ Standard library.
## ##
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 ## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
## Free Software Foundation, Inc. ## Free Software Foundation, Inc.
...@@ -80,8 +80,6 @@ bits_headers = \ ...@@ -80,8 +80,6 @@ bits_headers = \
${bits_srcdir}/algorithmfwd.h \ ${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \ ${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \ ${bits_srcdir}/atomic_base.h \
${bits_srcdir}/atomicfwd_c.h \
${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \ ${bits_srcdir}/atomic_0.h \
${bits_srcdir}/atomic_2.h \ ${bits_srcdir}/atomic_2.h \
${bits_srcdir}/basic_ios.h \ ${bits_srcdir}/basic_ios.h \
...@@ -679,8 +677,7 @@ if GLIBCXX_C_HEADERS_C_GLOBAL ...@@ -679,8 +677,7 @@ if GLIBCXX_C_HEADERS_C_GLOBAL
c_compatibility_headers = \ c_compatibility_headers = \
${c_compatibility_srcdir}/complex.h \ ${c_compatibility_srcdir}/complex.h \
${c_compatibility_srcdir}/fenv.h \ ${c_compatibility_srcdir}/fenv.h \
${c_compatibility_srcdir}/tgmath.h \ ${c_compatibility_srcdir}/tgmath.h
${c_compatibility_srcdir}/stdatomic.h
endif endif
if GLIBCXX_C_HEADERS_C if GLIBCXX_C_HEADERS_C
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
# PARTICULAR PURPOSE. # PARTICULAR PURPOSE.
@SET_MAKE@ @SET_MAKE@
#o# Makefile for the include subdirectory of the GNU C++ Standard library.
VPATH = @srcdir@ VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
...@@ -322,8 +320,6 @@ bits_headers = \ ...@@ -322,8 +320,6 @@ bits_headers = \
${bits_srcdir}/algorithmfwd.h \ ${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \ ${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \ ${bits_srcdir}/atomic_base.h \
${bits_srcdir}/atomicfwd_c.h \
${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \ ${bits_srcdir}/atomic_0.h \
${bits_srcdir}/atomic_2.h \ ${bits_srcdir}/atomic_2.h \
${bits_srcdir}/basic_ios.h \ ${bits_srcdir}/basic_ios.h \
...@@ -914,8 +910,7 @@ c_compatibility_builddir = . ...@@ -914,8 +910,7 @@ c_compatibility_builddir = .
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@c_compatibility_headers = \ @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@c_compatibility_headers = \
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/complex.h \ @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/complex.h \
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/fenv.h \ @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/fenv.h \
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h \ @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/stdatomic.h
@GLIBCXX_C_HEADERS_C_STD_TRUE@c_compatibility_headers = @GLIBCXX_C_HEADERS_C_STD_TRUE@c_compatibility_headers =
@GLIBCXX_C_HEADERS_C_TRUE@c_compatibility_headers = \ @GLIBCXX_C_HEADERS_C_TRUE@c_compatibility_headers = \
......
...@@ -208,7 +208,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -208,7 +208,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/// [allocator.tag] /// [allocator.tag]
struct allocator_arg_t { }; struct allocator_arg_t { };
static const allocator_arg_t allocator_arg = allocator_arg_t(); constexpr allocator_arg_t allocator_arg = allocator_arg_t();
_GLIBCXX_HAS_NESTED_TYPE(allocator_type) _GLIBCXX_HAS_NESTED_TYPE(allocator_type)
......
// -*- C++ -*- header.
// 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.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/atomicfwd_c.h
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
// "C" only bits.
#define _ATOMIC_MEMBER_ ((__a)->_M_i)
// POD base classes for atomic intgral types.
struct __atomic_bool_base
{
bool _M_i;
};
struct __atomic_char_base
{
char _M_i;
};
struct __atomic_schar_base
{
signed char _M_i;
};
struct __atomic_uchar_base
{
unsigned char _M_i;
};
struct __atomic_short_base
{
short _M_i;
};
struct __atomic_ushort_base
{
unsigned short _M_i;
};
struct __atomic_int_base
{
int _M_i;
};
struct __atomic_uint_base
{
unsigned int _M_i;
};
struct __atomic_long_base
{
long _M_i;
};
struct __atomic_ulong_base
{
unsigned long _M_i;
};
struct __atomic_llong_base
{
long long _M_i;
};
struct __atomic_ullong_base
{
unsigned long long _M_i;
};
struct __atomic_wchar_t_base
{
wchar_t _M_i;
};
typedef struct __atomic_flag_base atomic_flag;
typedef struct __atomic_address_base atomic_address;
typedef struct __atomic_bool_base atomic_bool;
typedef struct __atomic_char_base atomic_char;
typedef struct __atomic_schar_base atomic_schar;
typedef struct __atomic_uchar_base atomic_uchar;
typedef struct __atomic_short_base atomic_short;
typedef struct __atomic_ushort_base atomic_ushort;
typedef struct __atomic_int_base atomic_int;
typedef struct __atomic_uint_base atomic_uint;
typedef struct __atomic_long_base atomic_long;
typedef struct __atomic_ulong_base atomic_ulong;
typedef struct __atomic_llong_base atomic_llong;
typedef struct __atomic_ullong_base atomic_ullong;
typedef struct __atomic_wchar_t_base atomic_wchar_t;
typedef struct __atomic_short_base atomic_char16_t;
typedef struct __atomic_int_base atomic_char32_t;
#define atomic_is_lock_free(__a) \
false
#define atomic_load_explicit(__a, __x) \
_ATOMIC_LOAD_(__a, __x)
#define atomic_load(__a) \
atomic_load_explicit(__a, memory_order_seq_cst)
#define atomic_store_explicit(__a, __m, __x) \
_ATOMIC_STORE_(__a, __m, __x)
#define atomic_store(__a, __m) \
atomic_store_explicit(__a, __m, memory_order_seq_cst)
#define atomic_exchange_explicit(__a, __m, __x) \
_ATOMIC_MODIFY_(__a, =, __m, __x)
#define atomic_exchange(__a, __m) \
atomic_exchange_explicit(__a, __m, memory_order_seq_cst)
#define atomic_compare_exchange_explicit(__a, __e, __m, __x, __y) \
_ATOMIC_CMPEXCHNG_(__a, __e, __m, __x)
#define atomic_compare_exchange(__a, __e, __m) \
_ATOMIC_CMPEXCHNG_(__a, __e, __m, memory_order_seq_cst)
#define atomic_fetch_add_explicit(__a, __m, __x) \
_ATOMIC_MODIFY_(__a, +=, __m, __x)
#define atomic_fetch_add(__a, __m) \
atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst)
#define atomic_fetch_sub_explicit(__a, __m, __x) \
_ATOMIC_MODIFY_(__a, -=, __m, __x)
#define atomic_fetch_sub(__a, __m) \
atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst)
#define atomic_fetch_and_explicit(__a, __m, __x) \
_ATOMIC_MODIFY_(__a, &=, __m, __x)
#define atomic_fetch_and(__a, __m) \
atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst)
#define atomic_fetch_or_explicit(__a, __m, __x) \
_ATOMIC_MODIFY_(__a, |=, __m, __x)
#define atomic_fetch_or(__a, __m) \
atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst)
#define atomic_fetch_xor_explicit(__a, __m, __x) \
_ATOMIC_MODIFY_(__a, ^=, __m, __x)
#define atomic_fetch_xor(__a, __m) \
atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst)
// -*- C++ -*- header.
// 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.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/atomicfwd_cxx.h
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
// "C++" only bits.
#define _ATOMIC_MEMBER_ _M_i
_GLIBCXX_END_EXTERN_C
namespace __atomic0
{
template<typename _IntTp>
struct __atomic_base;
struct atomic_flag;
struct atomic_address;
struct atomic_bool;
}
namespace __atomic2
{
template<typename _IntTp>
struct __atomic_base;
struct atomic_flag;
struct atomic_address;
struct atomic_bool;
}
namespace __atomic1
{
using __atomic2::atomic_flag;
using __atomic2::atomic_bool;
using __atomic0::atomic_address;
using __atomic0::__atomic_base;
}
/**
* @addtogroup atomics
* @{
*/
/// atomic_char
typedef __atomic_base<char> atomic_char;
/// atomic_schar
typedef __atomic_base<signed char> atomic_schar;
/// atomic_uchar
typedef __atomic_base<unsigned char> atomic_uchar;
/// atomic_short
typedef __atomic_base<short> atomic_short;
/// atomic_ushort
typedef __atomic_base<unsigned short> atomic_ushort;
/// atomic_int
typedef __atomic_base<int> atomic_int;
/// atomic_uint
typedef __atomic_base<unsigned int> atomic_uint;
/// atomic_long
typedef __atomic_base<long> atomic_long;
/// atomic_ulong
typedef __atomic_base<unsigned long> atomic_ulong;
/// atomic_llong
typedef __atomic_base<long long> atomic_llong;
/// atomic_ullong
typedef __atomic_base<unsigned long long> atomic_ullong;
/// atomic_wchar_t
typedef __atomic_base<wchar_t> atomic_wchar_t;
/// atomic_char16_t
typedef __atomic_base<char16_t> atomic_char16_t;
/// atomic_char32_t
typedef __atomic_base<char32_t> atomic_char32_t;
template<typename _Tp>
struct atomic;
// @} group atomics
_GLIBCXX_BEGIN_EXTERN_C
...@@ -34,6 +34,27 @@ ...@@ -34,6 +34,27 @@
// The current version of the C++ library in compressed ISO date format. // The current version of the C++ library in compressed ISO date format.
#define __GLIBCXX__ #define __GLIBCXX__
// Macros for various attributes.
#ifndef _GLIBCXX_PURE
# define _GLIBCXX_PURE __attribute__ ((__pure__))
#endif
#ifndef _GLIBCXX_CONST
# define _GLIBCXX_CONST __attribute__ ((__const__))
#endif
#ifndef _GLIBCXX_NORETURN
# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
#endif
#ifndef _GLIBCXX_NOTHROW
# ifdef __cplusplus
# define _GLIBCXX_NOTHROW throw()
# else
# define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
# endif
#endif
// Macros for visibility. // Macros for visibility.
// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
// _GLIBCXX_VISIBILITY_ATTR // _GLIBCXX_VISIBILITY_ATTR
...@@ -60,33 +81,39 @@ ...@@ -60,33 +81,39 @@
# define _GLIBCXX_DEPRECATED_ATTR # define _GLIBCXX_DEPRECATED_ATTR
#endif #endif
// Macros for race detectors. #if __cplusplus
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
// atomic (lock-free) synchronization to race detectors:
// the race detector will infer a happens-before arc from the former to the
// latter when they share the same argument pointer.
//
// The most frequent use case for these macros (and the only case in the
// current implementation of the library) is atomic reference counting:
// void _M_remove_reference()
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
// if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
// _M_destroy(__a);
// }
// }
// The annotations in this example tell the race detector that all memory
// accesses occurred when the refcount was positive do not race with
// memory accesses which occurred after the refcount became zero.
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE namespace std
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) {
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
typedef decltype(nullptr) nullptr_t;
#endif #endif
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER }
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
// Macros for C compatibility. In particular, define extern "C"
// linkage only when using C++.
# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
# define _GLIBCXX_END_EXTERN_C }
// Macro for constexpr, to support in mixed 03/0x mode.
#ifndef _GLIBCXX_CONSTEXPR
# ifdef __GXX_EXPERIMENTAL_CXX0X__
# define _GLIBCXX_CONSTEXPR constexpr
# else
# define _GLIBCXX_CONSTEXPR
# endif
#endif
#ifndef _GLIBCXX_USE_CONSTEXPR
# ifdef __GXX_EXPERIMENTAL_CXX0X__
# define _GLIBCXX_USE_CONSTEXPR constexpr
# else
# define _GLIBCXX_USE_CONSTEXPR const
# endif
#endif #endif
// Macros for activating various namespace association modes. // Macros for activating various namespace association modes.
...@@ -106,7 +133,6 @@ ...@@ -106,7 +133,6 @@
namespace tr1 { } namespace tr1 { }
} }
*/ */
#if __cplusplus
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
# define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1 # define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
...@@ -136,6 +162,7 @@ ...@@ -136,6 +162,7 @@
// _GLIBCXX_STD // _GLIBCXX_STD
// _GLIBCXX_STD_D // _GLIBCXX_STD_D
// _GLIBCXX_STD_P // _GLIBCXX_STD_P
// _GLIBCXX_STD_PR
// //
// Macros for enclosing namespaces and possibly nested namespaces. // Macros for enclosing namespaces and possibly nested namespaces.
// _GLIBCXX_BEGIN_NAMESPACE // _GLIBCXX_BEGIN_NAMESPACE
...@@ -283,19 +310,42 @@ namespace std ...@@ -283,19 +310,42 @@ namespace std
# define _GLIBCXX_END_LDBL_NAMESPACE # define _GLIBCXX_END_LDBL_NAMESPACE
#endif #endif
// Macros for race detectors.
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
// atomic (lock-free) synchronization to race detectors:
// the race detector will infer a happens-before arc from the former to the
// latter when they share the same argument pointer.
//
// The most frequent use case for these macros (and the only case in the
// current implementation of the library) is atomic reference counting:
// void _M_remove_reference()
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
// if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
// {
// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
// _M_destroy(__a);
// }
// }
// The annotations in this example tell the race detector that all memory
// accesses occurred when the refcount was positive do not race with
// memory accesses which occurred after the refcount became zero.
// Defines for C compatibility. In particular, define extern "C" #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
// linkage only when using C++. # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
# define _GLIBCXX_BEGIN_EXTERN_C extern "C" { #endif
# define _GLIBCXX_END_EXTERN_C } #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
#endif
#else // !__cplusplus #else // !__cplusplus
# define _GLIBCXX_BEGIN_EXTERN_C
# define _GLIBCXX_END_EXTERN_C
# undef _GLIBCXX_BEGIN_NAMESPACE # undef _GLIBCXX_BEGIN_NAMESPACE
# undef _GLIBCXX_END_NAMESPACE # undef _GLIBCXX_END_NAMESPACE
# define _GLIBCXX_BEGIN_NAMESPACE(X) # define _GLIBCXX_BEGIN_NAMESPACE(X)
# define _GLIBCXX_END_NAMESPACE # define _GLIBCXX_END_NAMESPACE
# define _GLIBCXX_BEGIN_EXTERN_C
# define _GLIBCXX_END_EXTERN_C
#endif #endif
// First includes. // First includes.
...@@ -385,39 +435,4 @@ _GLIBCXX_END_NAMESPACE ...@@ -385,39 +435,4 @@ _GLIBCXX_END_NAMESPACE
#undef min #undef min
#undef max #undef max
#ifndef _GLIBCXX_PURE
# define _GLIBCXX_PURE __attribute__ ((__pure__))
#endif
#ifndef _GLIBCXX_CONST
# define _GLIBCXX_CONST __attribute__ ((__const__))
#endif
#ifndef _GLIBCXX_NORETURN
# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
#endif
#ifndef _GLIBCXX_NOTHROW
# ifdef __cplusplus
# define _GLIBCXX_NOTHROW throw()
# else
# define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
# endif
#endif
#ifdef __cplusplus
_GLIBCXX_BEGIN_NAMESPACE(std)
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
typedef decltype(nullptr) nullptr_t;
#endif
_GLIBCXX_END_NAMESPACE
#endif // __cplusplus
// End of prewritten config; the discovered settings follow. // End of prewritten config; the discovered settings follow.
...@@ -92,11 +92,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -92,11 +92,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
assign(char_type& __c1, const char_type& __c2) assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; } { __c1 = __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2) eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2) lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; } { return __c1 < __c2; }
...@@ -118,23 +118,23 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -118,23 +118,23 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
static char_type* static char_type*
assign(char_type* __s, std::size_t __n, char_type __a); assign(char_type* __s, std::size_t __n, char_type __a);
static char_type static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c) to_char_type(const int_type& __c)
{ return static_cast<char_type>(__c); } { return static_cast<char_type>(__c); }
static int_type static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c) to_int_type(const char_type& __c)
{ return static_cast<int_type>(__c); } { return static_cast<int_type>(__c); }
static bool static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2) eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static int_type static _GLIBCXX_CONSTEXPR int_type
eof() eof()
{ return static_cast<int_type>(_GLIBCXX_STDIO_EOF); } { return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
static int_type static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c) not_eof(const int_type& __c)
{ return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); } { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }
}; };
...@@ -239,11 +239,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -239,11 +239,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2) assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; } { __c1 = __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2) eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2) lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; } { return __c1 < __c2; }
...@@ -271,25 +271,25 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -271,25 +271,25 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type* __s, size_t __n, char_type __a) assign(char_type* __s, size_t __n, char_type __a)
{ return static_cast<char_type*>(__builtin_memset(__s, __a, __n)); } { return static_cast<char_type*>(__builtin_memset(__s, __a, __n)); }
static char_type static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c) to_char_type(const int_type& __c)
{ return static_cast<char_type>(__c); } { return static_cast<char_type>(__c); }
// To keep both the byte 0xff and the eof symbol 0xffffffff // To keep both the byte 0xff and the eof symbol 0xffffffff
// from ending up as 0xffffffff. // from ending up as 0xffffffff.
static int_type static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c) to_int_type(const char_type& __c)
{ return static_cast<int_type>(static_cast<unsigned char>(__c)); } { return static_cast<int_type>(static_cast<unsigned char>(__c)); }
static bool static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2) eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static int_type static _GLIBCXX_CONSTEXPR int_type
eof() eof()
{ return static_cast<int_type>(_GLIBCXX_STDIO_EOF); } { return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
static int_type static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c) not_eof(const int_type& __c)
{ return (__c == eof()) ? 0 : __c; } { return (__c == eof()) ? 0 : __c; }
}; };
...@@ -310,11 +310,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -310,11 +310,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2) assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; } { __c1 = __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2) eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2) lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; } { return __c1 < __c2; }
...@@ -342,23 +342,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -342,23 +342,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type* __s, size_t __n, char_type __a) assign(char_type* __s, size_t __n, char_type __a)
{ return wmemset(__s, __a, __n); } { return wmemset(__s, __a, __n); }
static char_type static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c) to_char_type(const int_type& __c)
{ return char_type(__c); } { return char_type(__c); }
static int_type static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c) to_int_type(const char_type& __c)
{ return int_type(__c); } { return int_type(__c); }
static bool static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2) eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static int_type static _GLIBCXX_CONSTEXPR int_type
eof() eof()
{ return static_cast<int_type>(WEOF); } { return static_cast<int_type>(WEOF); }
static int_type static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c) not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; } { return eq_int_type(__c, eof()) ? 0 : __c; }
}; };
...@@ -386,11 +386,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -386,11 +386,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2) assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; } { __c1 = __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2) eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2) lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; } { return __c1 < __c2; }
...@@ -445,23 +445,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -445,23 +445,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return __s; return __s;
} }
static char_type static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c) to_char_type(const int_type& __c)
{ return char_type(__c); } { return char_type(__c); }
static int_type static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c) to_int_type(const char_type& __c)
{ return int_type(__c); } { return int_type(__c); }
static bool static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2) eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static int_type static _GLIBCXX_CONSTEXPR int_type
eof() eof()
{ return static_cast<int_type>(-1); } { return static_cast<int_type>(-1); }
static int_type static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c) not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; } { return eq_int_type(__c, eof()) ? 0 : __c; }
}; };
...@@ -479,11 +479,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -479,11 +479,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2) assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; } { __c1 = __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2) eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static bool static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2) lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; } { return __c1 < __c2; }
...@@ -538,23 +538,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -538,23 +538,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return __s; return __s;
} }
static char_type static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c) to_char_type(const int_type& __c)
{ return char_type(__c); } { return char_type(__c); }
static int_type static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c) to_int_type(const char_type& __c)
{ return int_type(__c); } { return int_type(__c); }
static bool static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2) eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static int_type static _GLIBCXX_CONSTEXPR int_type
eof() eof()
{ return static_cast<int_type>(-1); } { return static_cast<int_type>(-1); }
static int_type static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c) not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; } { return eq_int_type(__c, eof()) ? 0 : __c; }
}; };
......
...@@ -71,34 +71,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -71,34 +71,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_ios_fmtflags_end = 1L << 16 _S_ios_fmtflags_end = 1L << 16
}; };
inline _Ios_Fmtflags inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); } { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
inline _Ios_Fmtflags inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); } { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
inline _Ios_Fmtflags inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); } { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
inline _Ios_Fmtflags& inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
operator~(_Ios_Fmtflags __a)
{ return _Ios_Fmtflags(~static_cast<int>(__a)); }
inline const _Ios_Fmtflags&
operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a | __b; } { return __a = __a | __b; }
inline _Ios_Fmtflags& inline const _Ios_Fmtflags&
operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a & __b; } { return __a = __a & __b; }
inline _Ios_Fmtflags& inline const _Ios_Fmtflags&
operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a ^ __b; } { return __a = __a ^ __b; }
inline _Ios_Fmtflags
operator~(_Ios_Fmtflags __a)
{ return _Ios_Fmtflags(~static_cast<int>(__a)); }
enum _Ios_Openmode enum _Ios_Openmode
{ {
...@@ -111,34 +111,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -111,34 +111,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_ios_openmode_end = 1L << 16 _S_ios_openmode_end = 1L << 16
}; };
inline _Ios_Openmode inline _GLIBCXX_CONSTEXPR _Ios_Openmode
operator&(_Ios_Openmode __a, _Ios_Openmode __b) operator&(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); } { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
inline _Ios_Openmode inline _GLIBCXX_CONSTEXPR _Ios_Openmode
operator|(_Ios_Openmode __a, _Ios_Openmode __b) operator|(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); } { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
inline _Ios_Openmode inline _GLIBCXX_CONSTEXPR _Ios_Openmode
operator^(_Ios_Openmode __a, _Ios_Openmode __b) operator^(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); } { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
inline _Ios_Openmode& inline _GLIBCXX_CONSTEXPR _Ios_Openmode
operator~(_Ios_Openmode __a)
{ return _Ios_Openmode(~static_cast<int>(__a)); }
inline const _Ios_Openmode&
operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a | __b; } { return __a = __a | __b; }
inline _Ios_Openmode& inline const _Ios_Openmode&
operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a & __b; } { return __a = __a & __b; }
inline _Ios_Openmode& inline const _Ios_Openmode&
operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a ^ __b; } { return __a = __a ^ __b; }
inline _Ios_Openmode
operator~(_Ios_Openmode __a)
{ return _Ios_Openmode(~static_cast<int>(__a)); }
enum _Ios_Iostate enum _Ios_Iostate
{ {
...@@ -149,33 +149,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -149,33 +149,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_ios_iostate_end = 1L << 16 _S_ios_iostate_end = 1L << 16
}; };
inline _Ios_Iostate inline _GLIBCXX_CONSTEXPR _Ios_Iostate
operator&(_Ios_Iostate __a, _Ios_Iostate __b) operator&(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); } { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
inline _Ios_Iostate inline _GLIBCXX_CONSTEXPR _Ios_Iostate
operator|(_Ios_Iostate __a, _Ios_Iostate __b) operator|(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); } { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
inline _Ios_Iostate inline _GLIBCXX_CONSTEXPR _Ios_Iostate
operator^(_Ios_Iostate __a, _Ios_Iostate __b) operator^(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); } { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
inline _Ios_Iostate& inline _GLIBCXX_CONSTEXPR _Ios_Iostate
operator~(_Ios_Iostate __a)
{ return _Ios_Iostate(~static_cast<int>(__a)); }
inline const _Ios_Iostate&
operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a | __b; } { return __a = __a | __b; }
inline _Ios_Iostate& inline const _Ios_Iostate&
operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a & __b; } { return __a = __a & __b; }
inline _Ios_Iostate& inline const _Ios_Iostate&
operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a ^ __b; } { return __a = __a ^ __b; }
inline _Ios_Iostate
operator~(_Ios_Iostate __a)
{ return _Ios_Iostate(~static_cast<int>(__a)); }
enum _Ios_Seekdir enum _Ios_Seekdir
{ {
......
...@@ -169,12 +169,12 @@ namespace std ...@@ -169,12 +169,12 @@ namespace std
typedef _UIntType result_type; typedef _UIntType result_type;
/** The multiplier. */ /** The multiplier. */
static const result_type multiplier = __a; static constexpr result_type multiplier = __a;
/** An increment. */ /** An increment. */
static const result_type increment = __c; static constexpr result_type increment = __c;
/** The modulus. */ /** The modulus. */
static const result_type modulus = __m; static constexpr result_type modulus = __m;
static const result_type default_seed = 1u; static constexpr result_type default_seed = 1u;
/** /**
* @brief Constructs a %linear_congruential_engine random number * @brief Constructs a %linear_congruential_engine random number
...@@ -225,26 +225,20 @@ namespace std ...@@ -225,26 +225,20 @@ namespace std
* *
* The minimum depends on the @p __c parameter: if it is zero, the * The minimum depends on the @p __c parameter: if it is zero, the
* minimum generated must be > 0, otherwise 0 is allowed. * minimum generated must be > 0, otherwise 0 is allowed.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
min() const min()
{ return __c == 0u ? 1u : 0u; } { return __c == 0u ? 1u : 0u; }
/** /**
* @brief Gets the largest possible value in the output range. * @brief Gets the largest possible value in the output range.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
max() const max()
{ return __m - 1u; } { return __m - 1u; }
/** /**
* @brief Discard a sequence of random numbers. * @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/ */
void void
discard(unsigned long long __z) discard(unsigned long long __z)
...@@ -402,20 +396,20 @@ namespace std ...@@ -402,20 +396,20 @@ namespace std
typedef _UIntType result_type; typedef _UIntType result_type;
// parameter values // parameter values
static const size_t word_size = __w; static constexpr size_t word_size = __w;
static const size_t state_size = __n; static constexpr size_t state_size = __n;
static const size_t shift_size = __m; static constexpr size_t shift_size = __m;
static const size_t mask_bits = __r; static constexpr size_t mask_bits = __r;
static const result_type xor_mask = __a; static constexpr result_type xor_mask = __a;
static const size_t tempering_u = __u; static constexpr size_t tempering_u = __u;
static const result_type tempering_d = __d; static constexpr result_type tempering_d = __d;
static const size_t tempering_s = __s; static constexpr size_t tempering_s = __s;
static const result_type tempering_b = __b; static constexpr result_type tempering_b = __b;
static const size_t tempering_t = __t; static constexpr size_t tempering_t = __t;
static const result_type tempering_c = __c; static constexpr result_type tempering_c = __c;
static const size_t tempering_l = __l; static constexpr size_t tempering_l = __l;
static const result_type initialization_multiplier = __f; static constexpr result_type initialization_multiplier = __f;
static const result_type default_seed = 5489u; static constexpr result_type default_seed = 5489u;
// constructors and member function // constructors and member function
explicit explicit
...@@ -444,26 +438,20 @@ namespace std ...@@ -444,26 +438,20 @@ namespace std
/** /**
* @brief Gets the smallest possible value in the output range. * @brief Gets the smallest possible value in the output range.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
min() const min()
{ return 0; }; { return 0; };
/** /**
* @brief Gets the largest possible value in the output range. * @brief Gets the largest possible value in the output range.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
max() const max()
{ return __detail::_Shift<_UIntType, __w>::__value - 1; } { return __detail::_Shift<_UIntType, __w>::__value - 1; }
/** /**
* @brief Discard a sequence of random numbers. * @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/ */
void void
discard(unsigned long long __z) discard(unsigned long long __z)
...@@ -608,10 +596,10 @@ namespace std ...@@ -608,10 +596,10 @@ namespace std
typedef _UIntType result_type; typedef _UIntType result_type;
// parameter values // parameter values
static const size_t word_size = __w; static constexpr size_t word_size = __w;
static const size_t short_lag = __s; static constexpr size_t short_lag = __s;
static const size_t long_lag = __r; static constexpr size_t long_lag = __r;
static const result_type default_seed = 19780503u; static constexpr result_type default_seed = 19780503u;
/** /**
* @brief Constructs an explicitly seeded % subtract_with_carry_engine * @brief Constructs an explicitly seeded % subtract_with_carry_engine
...@@ -660,27 +648,21 @@ namespace std ...@@ -660,27 +648,21 @@ namespace std
/** /**
* @brief Gets the inclusive minimum value of the range of random * @brief Gets the inclusive minimum value of the range of random
* integers returned by this generator. * integers returned by this generator.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
min() const min()
{ return 0; } { return 0; }
/** /**
* @brief Gets the inclusive maximum value of the range of random * @brief Gets the inclusive maximum value of the range of random
* integers returned by this generator. * integers returned by this generator.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
max() const max()
{ return __detail::_Shift<_UIntType, __w>::__value - 1; } { return __detail::_Shift<_UIntType, __w>::__value - 1; }
/** /**
* @brief Discard a sequence of random numbers. * @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/ */
void void
discard(unsigned long long __z) discard(unsigned long long __z)
...@@ -794,8 +776,8 @@ namespace std ...@@ -794,8 +776,8 @@ namespace std
typedef typename _RandomNumberEngine::result_type result_type; typedef typename _RandomNumberEngine::result_type result_type;
// parameter values // parameter values
static const size_t block_size = __p; static constexpr size_t block_size = __p;
static const size_t used_block = __r; static constexpr size_t used_block = __r;
/** /**
* @brief Constructs a default %discard_block_engine engine. * @brief Constructs a default %discard_block_engine engine.
...@@ -894,26 +876,20 @@ namespace std ...@@ -894,26 +876,20 @@ namespace std
/** /**
* @brief Gets the minimum value in the generated random number range. * @brief Gets the minimum value in the generated random number range.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
min() const min()
{ return _M_b.min(); } { return _RandomNumberEngine::min(); }
/** /**
* @brief Gets the maximum value in the generated random number range. * @brief Gets the maximum value in the generated random number range.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
max() const max()
{ return _M_b.max(); } { return _RandomNumberEngine::max(); }
/** /**
* @brief Discard a sequence of random numbers. * @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/ */
void void
discard(unsigned long long __z) discard(unsigned long long __z)
...@@ -1109,26 +1085,20 @@ namespace std ...@@ -1109,26 +1085,20 @@ namespace std
/** /**
* @brief Gets the minimum value in the generated random number range. * @brief Gets the minimum value in the generated random number range.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
min() const min()
{ return 0U; } { return 0U; }
/** /**
* @brief Gets the maximum value in the generated random number range. * @brief Gets the maximum value in the generated random number range.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
max() const max()
{ return __detail::_Shift<_UIntType, __w>::__value - 1; } { return __detail::_Shift<_UIntType, __w>::__value - 1; }
/** /**
* @brief Discard a sequence of random numbers. * @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/ */
void void
discard(unsigned long long __z) discard(unsigned long long __z)
...@@ -1243,7 +1213,7 @@ namespace std ...@@ -1243,7 +1213,7 @@ namespace std
/** The type of the generated random value. */ /** The type of the generated random value. */
typedef typename _RandomNumberEngine::result_type result_type; typedef typename _RandomNumberEngine::result_type result_type;
static const size_t table_size = __k; static constexpr size_t table_size = __k;
/** /**
* @brief Constructs a default %shuffle_order_engine engine. * @brief Constructs a default %shuffle_order_engine engine.
...@@ -1345,26 +1315,20 @@ namespace std ...@@ -1345,26 +1315,20 @@ namespace std
/** /**
* Gets the minimum value in the generated random number range. * Gets the minimum value in the generated random number range.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
min() const min()
{ return _M_b.min(); } { return _RandomNumberEngine::min(); }
/** /**
* Gets the maximum value in the generated random number range. * Gets the maximum value in the generated random number range.
*
* @todo This should be constexpr.
*/ */
result_type static constexpr result_type
max() const max()
{ return _M_b.max(); } { return _RandomNumberEngine::max(); }
/** /**
* Discard a sequence of random numbers. * Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/ */
void void
discard(unsigned long long __z) discard(unsigned long long __z)
...@@ -1617,7 +1581,7 @@ namespace std ...@@ -1617,7 +1581,7 @@ namespace std
*/ */
/** /**
* @addtogroup random_distributions_uniform Uniform * @addtogroup random_distributions_uniform Uniform Distributions
* @ingroup random_distributions * @ingroup random_distributions
* @{ * @{
*/ */
...@@ -1975,7 +1939,7 @@ namespace std ...@@ -1975,7 +1939,7 @@ namespace std
/* @} */ // group random_distributions_uniform /* @} */ // group random_distributions_uniform
/** /**
* @addtogroup random_distributions_normal Normal * @addtogroup random_distributions_normal Normal Distributions
* @ingroup random_distributions * @ingroup random_distributions
* @{ * @{
*/ */
...@@ -3229,7 +3193,7 @@ namespace std ...@@ -3229,7 +3193,7 @@ namespace std
/* @} */ // group random_distributions_normal /* @} */ // group random_distributions_normal
/** /**
* @addtogroup random_distributions_bernoulli Bernoulli * @addtogroup random_distributions_bernoulli Bernoulli Distributions
* @ingroup random_distributions * @ingroup random_distributions
* @{ * @{
*/ */
...@@ -3960,7 +3924,7 @@ namespace std ...@@ -3960,7 +3924,7 @@ namespace std
/* @} */ // group random_distributions_bernoulli /* @} */ // group random_distributions_bernoulli
/** /**
* @addtogroup random_distributions_poisson Poisson * @addtogroup random_distributions_poisson Poisson Distributions
* @ingroup random_distributions * @ingroup random_distributions
* @{ * @{
*/ */
......
...@@ -104,19 +104,19 @@ namespace std ...@@ -104,19 +104,19 @@ namespace std
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier; linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::increment; linear_congruential_engine<_UIntType, __a, __c, __m>::increment;
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::modulus; linear_congruential_engine<_UIntType, __a, __c, __m>::modulus;
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed; linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
/** /**
...@@ -205,7 +205,7 @@ namespace std ...@@ -205,7 +205,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const size_t constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::word_size; __s, __b, __t, __c, __l, __f>::word_size;
...@@ -214,7 +214,7 @@ namespace std ...@@ -214,7 +214,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const size_t constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::state_size; __s, __b, __t, __c, __l, __f>::state_size;
...@@ -223,7 +223,7 @@ namespace std ...@@ -223,7 +223,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const size_t constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::shift_size; __s, __b, __t, __c, __l, __f>::shift_size;
...@@ -232,7 +232,7 @@ namespace std ...@@ -232,7 +232,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const size_t constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::mask_bits; __s, __b, __t, __c, __l, __f>::mask_bits;
...@@ -241,7 +241,7 @@ namespace std ...@@ -241,7 +241,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const _UIntType constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::xor_mask; __s, __b, __t, __c, __l, __f>::xor_mask;
...@@ -250,7 +250,7 @@ namespace std ...@@ -250,7 +250,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const size_t constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_u; __s, __b, __t, __c, __l, __f>::tempering_u;
...@@ -259,7 +259,7 @@ namespace std ...@@ -259,7 +259,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const _UIntType constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_d; __s, __b, __t, __c, __l, __f>::tempering_d;
...@@ -268,7 +268,7 @@ namespace std ...@@ -268,7 +268,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const size_t constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_s; __s, __b, __t, __c, __l, __f>::tempering_s;
...@@ -277,7 +277,7 @@ namespace std ...@@ -277,7 +277,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const _UIntType constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_b; __s, __b, __t, __c, __l, __f>::tempering_b;
...@@ -286,7 +286,7 @@ namespace std ...@@ -286,7 +286,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const size_t constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_t; __s, __b, __t, __c, __l, __f>::tempering_t;
...@@ -295,7 +295,7 @@ namespace std ...@@ -295,7 +295,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const _UIntType constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_c; __s, __b, __t, __c, __l, __f>::tempering_c;
...@@ -304,7 +304,7 @@ namespace std ...@@ -304,7 +304,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const size_t constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_l; __s, __b, __t, __c, __l, __f>::tempering_l;
...@@ -313,7 +313,7 @@ namespace std ...@@ -313,7 +313,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const _UIntType constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>:: __s, __b, __t, __c, __l, __f>::
initialization_multiplier; initialization_multiplier;
...@@ -323,7 +323,7 @@ namespace std ...@@ -323,7 +323,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f> _UIntType __f>
const _UIntType constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::default_seed; __s, __b, __t, __c, __l, __f>::default_seed;
...@@ -500,19 +500,19 @@ namespace std ...@@ -500,19 +500,19 @@ namespace std
template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType, size_t __w, size_t __s, size_t __r>
const size_t constexpr size_t
subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size; subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType, size_t __w, size_t __s, size_t __r>
const size_t constexpr size_t
subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag; subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType, size_t __w, size_t __s, size_t __r>
const size_t constexpr size_t
subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag; subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType, size_t __w, size_t __s, size_t __r>
const _UIntType constexpr _UIntType
subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed; subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType, size_t __w, size_t __s, size_t __r>
...@@ -651,11 +651,11 @@ namespace std ...@@ -651,11 +651,11 @@ namespace std
template<typename _RandomNumberEngine, size_t __p, size_t __r> template<typename _RandomNumberEngine, size_t __p, size_t __r>
const size_t constexpr size_t
discard_block_engine<_RandomNumberEngine, __p, __r>::block_size; discard_block_engine<_RandomNumberEngine, __p, __r>::block_size;
template<typename _RandomNumberEngine, size_t __p, size_t __r> template<typename _RandomNumberEngine, size_t __p, size_t __r>
const size_t constexpr size_t
discard_block_engine<_RandomNumberEngine, __p, __r>::used_block; discard_block_engine<_RandomNumberEngine, __p, __r>::used_block;
template<typename _RandomNumberEngine, size_t __p, size_t __r> template<typename _RandomNumberEngine, size_t __p, size_t __r>
...@@ -761,7 +761,7 @@ namespace std ...@@ -761,7 +761,7 @@ namespace std
template<typename _RandomNumberEngine, size_t __k> template<typename _RandomNumberEngine, size_t __k>
const size_t constexpr size_t
shuffle_order_engine<_RandomNumberEngine, __k>::table_size; shuffle_order_engine<_RandomNumberEngine, __k>::table_size;
template<typename _RandomNumberEngine, size_t __k> template<typename _RandomNumberEngine, size_t __k>
......
...@@ -349,28 +349,27 @@ namespace std ...@@ -349,28 +349,27 @@ namespace std
/** /**
* @name Constants * @name Constants
* std [28.8.1](1) * std [28.8.1](1)
* @todo These should be constexpr.
*/ */
//@{ //@{
static const regex_constants::syntax_option_type icase static constexpr regex_constants::syntax_option_type icase
= regex_constants::icase; = regex_constants::icase;
static const regex_constants::syntax_option_type nosubs static constexpr regex_constants::syntax_option_type nosubs
= regex_constants::nosubs; = regex_constants::nosubs;
static const regex_constants::syntax_option_type optimize static constexpr regex_constants::syntax_option_type optimize
= regex_constants::optimize; = regex_constants::optimize;
static const regex_constants::syntax_option_type collate static constexpr regex_constants::syntax_option_type collate
= regex_constants::collate; = regex_constants::collate;
static const regex_constants::syntax_option_type ECMAScript static constexpr regex_constants::syntax_option_type ECMAScript
= regex_constants::ECMAScript; = regex_constants::ECMAScript;
static const regex_constants::syntax_option_type basic static constexpr regex_constants::syntax_option_type basic
= regex_constants::basic; = regex_constants::basic;
static const regex_constants::syntax_option_type extended static constexpr regex_constants::syntax_option_type extended
= regex_constants::extended; = regex_constants::extended;
static const regex_constants::syntax_option_type awk static constexpr regex_constants::syntax_option_type awk
= regex_constants::awk; = regex_constants::awk;
static const regex_constants::syntax_option_type grep static constexpr regex_constants::syntax_option_type grep
= regex_constants::grep; = regex_constants::grep;
static const regex_constants::syntax_option_type egrep static constexpr regex_constants::syntax_option_type egrep
= regex_constants::egrep; = regex_constants::egrep;
//@} //@}
......
...@@ -709,7 +709,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -709,7 +709,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef typename __traits_type::reference reference; typedef typename __traits_type::reference reference;
typedef typename __traits_type::pointer pointer; typedef typename __traits_type::pointer pointer;
__normal_iterator() : _M_current(_Iterator()) { } _GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { }
explicit explicit
__normal_iterator(const _Iterator& __i) : _M_current(__i) { } __normal_iterator(const _Iterator& __i) : _M_current(__i) { }
......
...@@ -66,10 +66,11 @@ ...@@ -66,10 +66,11 @@
_GLIBCXX_BEGIN_NAMESPACE(std) _GLIBCXX_BEGIN_NAMESPACE(std)
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
/// piecewise_construct_t
struct piecewise_construct_t { }; struct piecewise_construct_t { };
static const piecewise_construct_t piecewise_construct /// piecewise_construct
= piecewise_construct_t(); constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
// forward declarations // forward declarations
template<typename...> template<typename...>
...@@ -93,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -93,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// 265. std::pair::pair() effects overly restrictive // 265. std::pair::pair() effects overly restrictive
/** The default constructor creates @c first and @c second using their /** The default constructor creates @c first and @c second using their
* respective default constructors. */ * respective default constructors. */
pair() _GLIBCXX_CONSTEXPR pair()
: first(), second() { } : first(), second() { }
/** Two objects may be passed to a @c pair constructor to be copied. */ /** Two objects may be passed to a @c pair constructor to be copied. */
......
// Stream iterators // Stream iterators
// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc. // Copyright (C) 2001, 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -59,7 +59,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -59,7 +59,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
public: public:
/// Construct end of input stream iterator. /// Construct end of input stream iterator.
istream_iterator() _GLIBCXX_CONSTEXPR istream_iterator()
: _M_stream(0), _M_value(), _M_ok(false) {} : _M_stream(0), _M_value(), _M_ok(false) {}
/// Construct start of input stream iterator. /// Construct start of input stream iterator.
......
// Streambuf iterators // Streambuf iterators
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
// 2006, 2007, 2009 // 2006, 2007, 2009, 2010
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
public: public:
/// Construct end of input stream iterator. /// Construct end of input stream iterator.
istreambuf_iterator() throw() _GLIBCXX_CONSTEXPR istreambuf_iterator() throw()
: _M_sbuf(0), _M_c(traits_type::eof()) { } : _M_sbuf(0), _M_c(traits_type::eof()) { }
/// Construct start of input stream iterator. /// Construct start of input stream iterator.
......
...@@ -81,8 +81,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -81,8 +81,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template <typename _Tp, typename _Dp = default_delete<_Tp> > template <typename _Tp, typename _Dp = default_delete<_Tp> >
class unique_ptr class unique_ptr
{ {
typedef std::tuple<_Tp*, _Dp> __tuple_type;
// use SFINAE to determine whether _Del::pointer exists // use SFINAE to determine whether _Del::pointer exists
class _Pointer class _Pointer
{ {
...@@ -95,19 +93,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -95,19 +93,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename remove_reference<_Dp>::type _Del; typedef typename remove_reference<_Dp>::type _Del;
public: public:
typedef decltype( __test<_Del>(0) ) type; typedef decltype( __test<_Del>(0)) type;
}; };
typedef std::tuple<_Tp*, _Dp> __tuple_type;
__tuple_type _M_t;
public: public:
typedef typename _Pointer::type pointer; typedef typename _Pointer::type pointer;
typedef _Tp element_type; typedef _Tp element_type;
typedef _Dp deleter_type; typedef _Dp deleter_type;
static_assert(!std::is_pointer<deleter_type>::value,
"constructed with null function pointer deleter");
// Constructors. // Constructors.
unique_ptr() unique_ptr()
: _M_t(pointer(), deleter_type()) : _M_t(pointer(), deleter_type())
{ static_assert(!std::is_pointer<deleter_type>::value, { }
"constructed with null function pointer deleter"); }
explicit explicit
unique_ptr(pointer __p) unique_ptr(pointer __p)
...@@ -247,9 +250,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -247,9 +250,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Disable copy from lvalue. // Disable copy from lvalue.
unique_ptr(const unique_ptr&) = delete; unique_ptr(const unique_ptr&) = delete;
unique_ptr& operator=(const unique_ptr&) = delete; unique_ptr& operator=(const unique_ptr&) = delete;
private:
__tuple_type _M_t;
}; };
/// 20.7.12.3 unique_ptr for array objects with a runtime length /// 20.7.12.3 unique_ptr for array objects with a runtime length
...@@ -260,23 +260,25 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -260,23 +260,25 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
class unique_ptr<_Tp[], _Dp> class unique_ptr<_Tp[], _Dp>
{ {
typedef std::tuple<_Tp*, _Dp> __tuple_type; typedef std::tuple<_Tp*, _Dp> __tuple_type;
__tuple_type _M_t;
public: public:
typedef _Tp* pointer; typedef _Tp* pointer;
typedef _Tp element_type; typedef _Tp element_type;
typedef _Dp deleter_type; typedef _Dp deleter_type;
static_assert(!std::is_pointer<deleter_type>::value,
"constructed with null function pointer deleter");
// Constructors. // Constructors.
unique_ptr() unique_ptr()
: _M_t(pointer(), deleter_type()) : _M_t(pointer(), deleter_type())
{ static_assert(!std::is_pointer<deleter_type>::value, { }
"constructed with null function pointer deleter"); }
explicit explicit
unique_ptr(pointer __p) unique_ptr(pointer __p)
: _M_t(__p, deleter_type()) : _M_t(__p, deleter_type())
{ static_assert(!std::is_pointer<deleter_type>::value, { }
"constructed with null function pointer deleter"); }
unique_ptr(pointer __p, unique_ptr(pointer __p,
typename std::conditional<std::is_reference<deleter_type>::value, typename std::conditional<std::is_reference<deleter_type>::value,
...@@ -414,9 +416,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -414,9 +416,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
explicit explicit
unique_ptr(_Up*, typename std::enable_if<std::is_convertible<_Up*, unique_ptr(_Up*, typename std::enable_if<std::is_convertible<_Up*,
pointer>::value>::type* = 0) = delete; pointer>::value>::type* = 0) = delete;
private:
__tuple_type _M_t;
}; };
template<typename _Tp, typename _Dp> template<typename _Tp, typename _Dp>
......
// -*- C++ -*- compatibility header.
// 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.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file stdatomic.h
* This is a Standard C++ Library header.
*/
#include <bits/atomic_base.h>
#ifndef _GLIBCXX_STDATOMIC_H
#define _GLIBCXX_STDATOMIC_H 1
#ifdef _GLIBCXX_NAMESPACE_C
#endif
#endif
...@@ -72,36 +72,39 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -72,36 +72,39 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
/// 0 is the least significant word. /// 0 is the least significant word.
_WordT _M_w[_Nw]; _WordT _M_w[_Nw];
#ifdef __GXX_EXPERIMENTAL_CXX0X__
constexpr _Base_bitset() : _M_w({ }) { }
constexpr _Base_bitset(unsigned long long __val)
: _M_w({ __val
#if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__
, __val >> _GLIBCXX_BITSET_BITS_PER_WORD
#endif
}) { }
#else
_Base_bitset() _Base_bitset()
{ _M_do_reset(); } { _M_do_reset(); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
_Base_bitset(unsigned long long __val)
#else
_Base_bitset(unsigned long __val) _Base_bitset(unsigned long __val)
#endif
{ {
_M_do_reset(); _M_do_reset();
_M_w[0] = __val; _M_w[0] = __val;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
if (sizeof(unsigned long long) > sizeof(unsigned long))
_M_w[1] = __val >> _GLIBCXX_BITSET_BITS_PER_WORD;
#endif
} }
#endif
static size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos ) _S_whichword(size_t __pos )
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichbyte(size_t __pos ) _S_whichbyte(size_t __pos )
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos ) _S_whichbit(size_t __pos )
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _WordT static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos ) _S_maskbit(size_t __pos )
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
...@@ -123,7 +126,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -123,7 +126,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_hiword() _M_hiword()
{ return _M_w[_Nw - 1]; } { return _M_w[_Nw - 1]; }
_WordT _GLIBCXX_CONSTEXPR _WordT
_M_hiword() const _M_hiword() const
{ return _M_w[_Nw - 1]; } { return _M_w[_Nw - 1]; }
...@@ -368,31 +371,31 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -368,31 +371,31 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
typedef unsigned long _WordT; typedef unsigned long _WordT;
_WordT _M_w; _WordT _M_w;
_Base_bitset(void) _GLIBCXX_CONSTEXPR _Base_bitset()
: _M_w(0) : _M_w(0)
{ } { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
_Base_bitset(unsigned long long __val) constexpr _Base_bitset(unsigned long long __val)
#else #else
_Base_bitset(unsigned long __val) _Base_bitset(unsigned long __val)
#endif #endif
: _M_w(__val) : _M_w(__val)
{ } { }
static size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos ) _S_whichword(size_t __pos )
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichbyte(size_t __pos ) _S_whichbyte(size_t __pos )
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos ) _S_whichbit(size_t __pos )
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _WordT static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos ) _S_maskbit(size_t __pos )
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
...@@ -414,7 +417,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -414,7 +417,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_hiword() _M_hiword()
{ return _M_w; } { return _M_w; }
_WordT _GLIBCXX_CONSTEXPR _WordT
_M_hiword() const _M_hiword() const
{ return _M_w; } { return _M_w; }
...@@ -511,29 +514,29 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -511,29 +514,29 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ {
typedef unsigned long _WordT; typedef unsigned long _WordT;
_Base_bitset() _GLIBCXX_CONSTEXPR _Base_bitset()
{ } { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
_Base_bitset(unsigned long long) constexpr _Base_bitset(unsigned long long)
#else #else
_Base_bitset(unsigned long) _Base_bitset(unsigned long)
#endif #endif
{ } { }
static size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos ) _S_whichword(size_t __pos )
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichbyte(size_t __pos ) _S_whichbyte(size_t __pos )
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos ) _S_whichbit(size_t __pos )
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _WordT static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos ) _S_maskbit(size_t __pos )
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
...@@ -545,13 +548,17 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -545,13 +548,17 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
// make an unchecked call; all the memory ugliness is therefore // make an unchecked call; all the memory ugliness is therefore
// localized to this single should-never-get-this-far function. // localized to this single should-never-get-this-far function.
_WordT& _WordT&
_M_getword(size_t) const _M_getword(size_t)
{ {
__throw_out_of_range(__N("_Base_bitset::_M_getword")); __throw_out_of_range(__N("_Base_bitset::_M_getword"));
return *new _WordT; return *new _WordT;
} }
_WordT _WordT
_M_getword(size_t __pos) const
{ return 0; }
_GLIBCXX_CONSTEXPR _WordT
_M_hiword() const _M_hiword() const
{ return 0; } { return 0; }
...@@ -632,13 +639,21 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -632,13 +639,21 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
template<size_t _Extrabits> template<size_t _Extrabits>
struct _Sanitize struct _Sanitize
{ {
static void _S_do_sanitize(unsigned long& __val) typedef unsigned long _WordT;
{ __val &= ~((~static_cast<unsigned long>(0)) << _Extrabits); }
static void
_S_do_sanitize(_WordT& __val)
{ __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); }
}; };
template<> template<>
struct _Sanitize<0> struct _Sanitize<0>
{ static void _S_do_sanitize(unsigned long) {} }; {
typedef unsigned long _WordT;
static void
_S_do_sanitize(_WordT) { }
};
/** /**
* @brief The %bitset class represents a @e fixed-size sequence of bits. * @brief The %bitset class represents a @e fixed-size sequence of bits.
...@@ -715,8 +730,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -715,8 +730,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void void
_M_do_sanitize() _M_do_sanitize()
{ {
_Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD>:: typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type;
_S_do_sanitize(this->_M_hiword()); __sanitize_type::_S_do_sanitize(this->_M_hiword());
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
...@@ -740,7 +755,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -740,7 +755,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ {
friend class bitset; friend class bitset;
_WordT *_M_wp; _WordT* _M_wp;
size_t _M_bpos; size_t _M_bpos;
// left undefined // left undefined
...@@ -799,17 +814,18 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -799,17 +814,18 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
/// All bits set to zero. /// All bits set to zero.
bitset() _GLIBCXX_CONSTEXPR bitset()
{ } { }
/// Initial bits bitwise-copied from a single word (others set to zero). /// Initial bits bitwise-copied from a single word (others set to zero).
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
bitset(unsigned long long __val) constexpr bitset(unsigned long long __val)
: _Base(__val) { }
#else #else
bitset(unsigned long __val) bitset(unsigned long __val)
#endif
: _Base(__val) : _Base(__val)
{ _M_do_sanitize(); } { _M_do_sanitize(); }
#endif
/** /**
* @brief Use a subset of a string. * @brief Use a subset of a string.
...@@ -1088,8 +1104,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -1088,8 +1104,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
/** /**
* @brief Array-indexing support. * @brief Array-indexing support.
* @param position Index into the %bitset. * @param position Index into the %bitset.
* @return A bool for a <em>const %bitset</em>. For non-const bitsets, an * @return A bool for a <em>const %bitset</em>. For non-const
* instance of the reference proxy class. * bitsets, an instance of the reference proxy class.
* @note These operators do no range checking and throw no exceptions, * @note These operators do no range checking and throw no exceptions,
* as required by DR 11 to the standard. * as required by DR 11 to the standard.
* *
...@@ -1101,7 +1117,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -1101,7 +1117,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/ */
reference reference
operator[](size_t __position) operator[](size_t __position)
{ return reference(*this,__position); } { return reference(*this, __position); }
bool bool
operator[](size_t __position) const operator[](size_t __position) const
...@@ -1236,7 +1252,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -1236,7 +1252,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ return this->_M_do_count(); } { return this->_M_do_count(); }
/// Returns the total number of bits. /// Returns the total number of bits.
size_t _GLIBCXX_CONSTEXPR size_t
size() const size() const
{ return _Nb; } { return _Nb; }
......
...@@ -64,19 +64,23 @@ namespace std ...@@ -64,19 +64,23 @@ namespace std
no_state no_state
}; };
/// Specialization.
template<> template<>
struct is_error_code_enum<future_errc> : public true_type { }; struct is_error_code_enum<future_errc> : public true_type { };
/// Points to a statically-allocated object derived from error_category. /// Points to a statically-allocated object derived from error_category.
extern const error_category* const future_category; const error_category&
future_category();
// TODO: requires constexpr /// Overload for make_error_code.
inline error_code make_error_code(future_errc __errc) inline error_code
{ return error_code(static_cast<int>(__errc), *future_category); } make_error_code(future_errc __errc)
{ return error_code(static_cast<int>(__errc), future_category()); }
// TODO: requires constexpr /// Overload for make_error_condition.
inline error_condition make_error_condition(future_errc __errc) inline error_condition
{ return error_condition(static_cast<int>(__errc), *future_category); } make_error_condition(future_errc __errc)
{ return error_condition(static_cast<int>(__errc), future_category()); }
/** /**
* @brief Exception type thrown by futures. * @brief Exception type thrown by futures.
...@@ -116,7 +120,21 @@ namespace std ...@@ -116,7 +120,21 @@ namespace std
template<typename _Res> template<typename _Res>
class promise; class promise;
enum class launch { any, async, sync }; /// Launch code for futures
enum class launch
{
any,
async,
sync
};
/// Status code for futures
enum class future_status
{
ready,
timeout,
deferred
};
template<typename _Fn, typename... _Args> template<typename _Fn, typename... _Args>
future<typename result_of<_Fn(_Args...)>::type> future<typename result_of<_Fn(_Args...)>::type>
...@@ -1242,6 +1260,7 @@ namespace std ...@@ -1242,6 +1260,7 @@ namespace std
} }
}; };
/// swap
template<typename _Res, typename... _ArgTypes> template<typename _Res, typename... _ArgTypes>
inline void inline void
swap(packaged_task<_Res(_ArgTypes...)>& __x, swap(packaged_task<_Res(_ArgTypes...)>& __x,
...@@ -1307,6 +1326,7 @@ namespace std ...@@ -1307,6 +1326,7 @@ namespace std
thread _M_thread; thread _M_thread;
}; };
/// async
template<typename _Fn, typename... _Args> template<typename _Fn, typename... _Args>
future<typename result_of<_Fn(_Args...)>::type> future<typename result_of<_Fn(_Args...)>::type>
async(launch __policy, _Fn&& __fn, _Args&&... __args) async(launch __policy, _Fn&& __fn, _Args&&... __args)
...@@ -1328,6 +1348,7 @@ namespace std ...@@ -1328,6 +1348,7 @@ namespace std
return future<result_type>(__state); return future<result_type>(__state);
} }
/// async, potential overload
template<typename _Fn, typename... _Args> template<typename _Fn, typename... _Args>
inline typename inline typename
enable_if<!is_same<typename decay<_Fn>::type, launch>::value, enable_if<!is_same<typename decay<_Fn>::type, launch>::value,
......
...@@ -67,16 +67,15 @@ namespace std ...@@ -67,16 +67,15 @@ namespace std
public: public:
typedef __native_type* native_handle_type; typedef __native_type* native_handle_type;
#ifdef __GTHREAD_MUTEX_INIT
constexpr mutex() : _M_mutex(__GTHREAD_MUTEX_INIT) { }
#else
mutex() mutex()
{ {
// XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may) // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
#ifdef __GTHREAD_MUTEX_INIT
__native_type __tmp = __GTHREAD_MUTEX_INIT;
_M_mutex = __tmp;
#else
__GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
#endif
} }
#endif
mutex(const mutex&) = delete; mutex(const mutex&) = delete;
mutex& operator=(const mutex&) = delete; mutex& operator=(const mutex&) = delete;
...@@ -381,9 +380,9 @@ namespace std ...@@ -381,9 +380,9 @@ namespace std
/// and manage it. /// and manage it.
struct adopt_lock_t { }; struct adopt_lock_t { };
extern const defer_lock_t defer_lock; constexpr defer_lock_t defer_lock { };
extern const try_to_lock_t try_to_lock; constexpr try_to_lock_t try_to_lock { };
extern const adopt_lock_t adopt_lock; constexpr adopt_lock_t adopt_lock { };
/// @brief Scoped lock idiom. /// @brief Scoped lock idiom.
// Acquire the mutex here with a constructor call, then release with // Acquire the mutex here with a constructor call, then release with
...@@ -679,11 +678,7 @@ namespace std ...@@ -679,11 +678,7 @@ namespace std
__native_type _M_once; __native_type _M_once;
public: public:
once_flag() constexpr once_flag() : _M_once(__GTHREAD_ONCE_INIT) { }
{
__native_type __tmp = __GTHREAD_ONCE_INIT;
_M_once = __tmp;
}
once_flag(const once_flag&) = delete; once_flag(const once_flag&) = delete;
once_flag& operator=(const once_flag&) = delete; once_flag& operator=(const once_flag&) = delete;
......
...@@ -155,20 +155,20 @@ namespace std ...@@ -155,20 +155,20 @@ namespace std
"out of range"); "out of range");
// Note: sign(N) * abs(N) == N // Note: sign(N) * abs(N) == N
static const intmax_t num = static constexpr intmax_t num =
_Num * __static_sign<_Den>::value / __static_gcd<_Num, _Den>::value; _Num * __static_sign<_Den>::value / __static_gcd<_Num, _Den>::value;
static const intmax_t den = static constexpr intmax_t den =
__static_abs<_Den>::value / __static_gcd<_Num, _Den>::value; __static_abs<_Den>::value / __static_gcd<_Num, _Den>::value;
typedef ratio<num, den> type; typedef ratio<num, den> type;
}; };
template<intmax_t _Num, intmax_t _Den> template<intmax_t _Num, intmax_t _Den>
const intmax_t ratio<_Num, _Den>::num; constexpr intmax_t ratio<_Num, _Den>::num;
template<intmax_t _Num, intmax_t _Den> template<intmax_t _Num, intmax_t _Den>
const intmax_t ratio<_Num, _Den>::den; constexpr intmax_t ratio<_Num, _Den>::den;
/// ratio_add /// ratio_add
template<typename _R1, typename _R2> template<typename _R1, typename _R2>
......
...@@ -225,7 +225,7 @@ namespace std ...@@ -225,7 +225,7 @@ namespace std
typedef _Tuple_impl<0, _Elements...> _Inherited; typedef _Tuple_impl<0, _Elements...> _Inherited;
public: public:
tuple() _GLIBCXX_CONSTEXPR tuple()
: _Inherited() { } : _Inherited() { }
explicit explicit
......
...@@ -132,13 +132,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 ...@@ -132,13 +132,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
#endif #endif
// Capacity. // Capacity.
size_type _GLIBCXX_CONSTEXPR size_type
size() const { return _Nm; } size() const { return _Nm; }
size_type _GLIBCXX_CONSTEXPR size_type
max_size() const { return _Nm; } max_size() const { return _Nm; }
bool _GLIBCXX_CONSTEXPR bool
empty() const { return size() == 0; } empty() const { return size() == 0; }
// Element access. // Element access.
......
// TR1 type_traits -*- C++ -*- // TR1 type_traits -*- C++ -*-
// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -66,9 +66,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 ...@@ -66,9 +66,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
template<typename _Tp, _Tp __v> template<typename _Tp, _Tp __v>
struct integral_constant struct integral_constant
{ {
static const _Tp value = __v; static _GLIBCXX_USE_CONSTEXPR _Tp value = __v;
typedef _Tp value_type; typedef _Tp value_type;
typedef integral_constant<_Tp, __v> type; typedef integral_constant<_Tp, __v> type;
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
constexpr operator value_type() { return value; }
#endif
}; };
/// typedef for true_type /// typedef for true_type
...@@ -78,7 +82,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 ...@@ -78,7 +82,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
typedef integral_constant<bool, false> false_type; typedef integral_constant<bool, false> false_type;
template<typename _Tp, _Tp __v> template<typename _Tp, _Tp __v>
const _Tp integral_constant<_Tp, __v>::value; _GLIBCXX_USE_CONSTEXPR _Tp integral_constant<_Tp, __v>::value;
/// remove_cv /// remove_cv
template<typename> template<typename>
......
...@@ -72,36 +72,35 @@ namespace std ...@@ -72,36 +72,35 @@ namespace std
#endif #endif
_M_i = false; _M_i = false;
} }
}
extern "C" _GLIBCXX_BEGIN_EXTERN_C
{
bool bool
atomic_flag_test_and_set_explicit(__atomic_flag_base* __a, atomic_flag_test_and_set_explicit(__atomic_flag_base* __a,
memory_order __m) throw() memory_order __m) _GLIBCXX_NOTHROW
{ {
atomic_flag* d = static_cast<volatile atomic_flag*>(__a); atomic_flag* d = static_cast<atomic_flag*>(__a);
return d->test_and_set(__m); return d->test_and_set(__m);
} }
void void
atomic_flag_clear_explicit(__atomic_flag_base* __a, atomic_flag_clear_explicit(__atomic_flag_base* __a,
memory_order __m) throw() memory_order __m) _GLIBCXX_NOTHROW
{ {
atomic_flag* d = static_cast<volatile atomic_flag*>(__a); atomic_flag* d = static_cast<atomic_flag*>(__a);
return d->clear(__m); return d->clear(__m);
} }
void void
__atomic_flag_wait_explicit(__atomic_flag_base* __a, __atomic_flag_wait_explicit(__atomic_flag_base* __a,
memory_order __x) throw() memory_order __x) _GLIBCXX_NOTHROW
{ {
while (atomic_flag_test_and_set_explicit(__a, __x)) while (atomic_flag_test_and_set_explicit(__a, __x))
{ }; { };
} }
__atomic_flag_base* _GLIBCXX_CONST __atomic_flag_base*
__atomic_flag_for_address(const void* __z) throw() __atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW
{ {
uintptr_t __u = reinterpret_cast<uintptr_t>(__z); uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
__u += (__u >> 2) + (__u << 4); __u += (__u >> 2) + (__u << 4);
...@@ -112,7 +111,10 @@ namespace std ...@@ -112,7 +111,10 @@ namespace std
__u &= ~((~uintptr_t(0)) << LOGSIZE); __u &= ~((~uintptr_t(0)) << LOGSIZE);
return flag_table + __u; return flag_table + __u;
} }
} // extern "C"
_GLIBCXX_END_EXTERN_C
} // namespace __atomic0
} // namespace std } // namespace std
......
...@@ -66,7 +66,8 @@ namespace ...@@ -66,7 +66,8 @@ namespace
namespace std namespace std
{ {
const error_category* const future_category = &__future_category_instance(); const error_category& future_category()
{ return __future_category_instance(); }
future_error::~future_error() throw() { } future_error::~future_error() throw() { }
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
_GLIBCXX_BEGIN_NAMESPACE(std) _GLIBCXX_BEGIN_NAMESPACE(std)
#define const _GLIBCXX_USE_CONSTEXPR
const bool __numeric_limits_base::is_specialized; const bool __numeric_limits_base::is_specialized;
const int __numeric_limits_base::digits; const int __numeric_limits_base::digits;
const int __numeric_limits_base::digits10; const int __numeric_limits_base::digits10;
...@@ -510,6 +512,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -510,6 +512,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const bool numeric_limits<char32_t>::tinyness_before; const bool numeric_limits<char32_t>::tinyness_before;
const float_round_style numeric_limits<char32_t>::round_style; const float_round_style numeric_limits<char32_t>::round_style;
#undef const
_GLIBCXX_END_NAMESPACE _GLIBCXX_END_NAMESPACE
// XXX GLIBCXX_ABI Deprecated // XXX GLIBCXX_ABI Deprecated
......
// mutex -*- C++ -*- // mutex -*- C++ -*-
// 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -39,10 +39,6 @@ namespace ...@@ -39,10 +39,6 @@ namespace
namespace std namespace std
{ {
const defer_lock_t defer_lock = defer_lock_t();
const try_to_lock_t try_to_lock = try_to_lock_t();
const adopt_lock_t adopt_lock = adopt_lock_t();
#ifdef _GLIBCXX_HAVE_TLS #ifdef _GLIBCXX_HAVE_TLS
__thread void* __once_callable; __thread void* __once_callable;
__thread void (*__once_call)(); __thread void (*__once_call)();
...@@ -94,4 +90,28 @@ namespace std ...@@ -94,4 +90,28 @@ namespace std
} }
} }
// XXX GLIBCXX_ABI Deprecated
// gcc-4.6.0
// <mutex> export changes
#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \
&& defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
&& defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
namespace __gnu_cxx
{
std::defer_lock_t defer_lock;
std::try_to_lock_t try_to_lock;
std::adopt_lock_t adopt_lock;
}
#define _GLIBCXX_ASM_SYMVER(cur, old, version) \
asm (".symver " #cur "," #old "@@" #version);
_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx10adopt_lockE, _ZSt10adopt_lock, GLIBCXX_3.4.11)
_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx10defer_lockE, _ZSt10defer_lock, GLIBCXX_3.4.11)
_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx11try_to_lockE, _ZSt11try_to_lock, GLIBCXX_3.4.11)
#endif
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-do compile } // { dg-do compile }
// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <math.h> #include <math.h>
#include <setjmp.h> #include <setjmp.h>
#include <signal.h> #include <signal.h>
#include <stdatomic.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef _GLIBCXX_HAVE_STDBOOL_H #ifdef _GLIBCXX_HAVE_STDBOOL_H
#include <stdbool.h> #include <stdbool.h>
......
// { dg-options "-x c -shared-libgcc -lstdc++" } // Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -17,14 +15,12 @@ ...@@ -17,14 +15,12 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <stdatomic.h> #include <limits>
#include <testsuite_common_types.h>
int main() int main()
{ {
atomic_flag af = ATOMIC_FLAG_INIT; __gnu_test::default_constructible test;
__gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl());
if (!atomic_flag_test_and_set_explicit(&af, memory_order_acquire))
atomic_flag_clear_explicit(&af, memory_order_release);
return 0; return 0;
} }
// { dg-options "-x c -shared-libgcc -lstdc++" } // { dg-options "-std=gnu++0x" }
// 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -17,14 +17,12 @@ ...@@ -17,14 +17,12 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <stdatomic.h> #include <limits>
#include <testsuite_common_types.h>
int main() int main()
{ {
atomic_flag af = ATOMIC_FLAG_INIT; __gnu_test::default_constructible test;
__gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl());
if (!atomic_flag_test_and_set(&af))
atomic_flag_clear(&af);
return 0; return 0;
} }
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <limits>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_data
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
using std::float_denorm_style;
using std::float_round_style;
constexpr bool v1(_Ttesttype::is_specialized);
constexpr int v2(_Ttesttype::digits);
constexpr int v3(_Ttesttype::digits10);
constexpr int v4(_Ttesttype::max_digits10);
constexpr bool v5(_Ttesttype::is_signed);
constexpr bool v6(_Ttesttype::is_integer);
constexpr bool v7(_Ttesttype::is_exact);
constexpr int v8(_Ttesttype::radix);
constexpr int v9(_Ttesttype::min_exponent);
constexpr int v10(_Ttesttype::min_exponent10);
constexpr int v11(_Ttesttype::max_exponent);
constexpr int v12(_Ttesttype::max_exponent10);
constexpr bool v13(_Ttesttype::has_infinity);
constexpr bool v14(_Ttesttype::has_quiet_NaN);
constexpr bool v15(_Ttesttype::has_signaling_NaN);
constexpr float_denorm_style v16(_Ttesttype::has_denorm);
constexpr bool v17(_Ttesttype::has_denorm_loss);
constexpr bool v18(_Ttesttype::is_iec559);
constexpr bool v19(_Ttesttype::is_bounded);
constexpr bool v20(_Ttesttype::is_modulo);
constexpr bool v21(_Ttesttype::traps);
constexpr bool v22(_Ttesttype::tinyness_before);
constexpr float_round_style v23(_Ttesttype::round_style);
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_data test;
__gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl());
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <limits>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype, typename _Tbasetype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr _Tbasetype v1(_Ttesttype::min());
constexpr _Tbasetype v2(_Ttesttype::max());
constexpr _Tbasetype v3(_Ttesttype::lowest());
constexpr _Tbasetype v4(_Ttesttype::epsilon());
constexpr _Tbasetype v5(_Ttesttype::round_error());
constexpr _Tbasetype v6(_Ttesttype::infinity());
constexpr _Tbasetype v7(_Ttesttype::quiet_NaN());
constexpr _Tbasetype v8(_Ttesttype::signaling_NaN());
constexpr _Tbasetype v9(_Ttesttype::denorm_min());
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
__gnu_cxx::typelist::apply_generator(test,
__gnu_test::limits_tl(),
__gnu_test::integral_types::type());
return 0;
}
// { dg-do compile { xfail *-*-* } }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <memory>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test;
test.operator()<std::default_delete<int>>(); // { dg-excess-errors "" }
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <chrono>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test1;
test1.operator()<std::chrono::seconds>();
__gnu_test::constexpr_single_value_constructible test2;
test2.operator()<std::chrono::seconds, std::chrono::seconds::rep>();
test2.operator()<std::chrono::minutes, std::chrono::hours>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <chrono>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::min());
constexpr auto v2(_Ttesttype::max());
constexpr auto v3(_Ttesttype::zero());
constexpr _Ttesttype obj { };
constexpr auto v4 = obj.count();
constexpr auto v5 = -obj;
constexpr auto v6 = +obj;
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
test.operator()<std::chrono::nanoseconds>();
return 0;
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// { dg-require-cstdint "" } // { dg-require-cstdint "" }
// 2008-07-31 Chris Fairles <chris.fairles@gmail.com> // 2008-07-31 Chris Fairles <chris.fairles@gmail.com>
// 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -31,5 +31,5 @@ void test01() ...@@ -31,5 +31,5 @@ void test01()
test_type d; test_type d;
} }
// { dg-error "rep cannot be a duration" "" { target *-*-* } 203 } // { dg-error "rep cannot be a duration" "" { target *-*-* } 210 }
// { dg-error "instantiated from here" "" { target *-*-* } 31 } // { dg-error "instantiated from here" "" { target *-*-* } 31 }
...@@ -32,6 +32,6 @@ void test01() ...@@ -32,6 +32,6 @@ void test01()
test_type d; test_type d;
} }
// { dg-error "must be a specialization of ratio" "" { target *-*-* } 204 } // { dg-error "must be a specialization of ratio" "" { target *-*-* } 211 }
// { dg-error "instantiated from here" "" { target *-*-* } 32 } // { dg-error "instantiated from here" "" { target *-*-* } 32 }
// { dg-excess-errors "In instantiation of" } // { dg-excess-errors "In instantiation of" }
...@@ -33,5 +33,5 @@ void test01() ...@@ -33,5 +33,5 @@ void test01()
test_type d; test_type d;
} }
// { dg-error "period must be positive" "" { target *-*-* } 206 } // { dg-error "period must be positive" "" { target *-*-* } 213 }
// { dg-error "instantiated from here" "" { target *-*-* } 33 } // { dg-error "instantiated from here" "" { target *-*-* } 33 }
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <chrono>
#include <testsuite_common_types.h>
int main()
{
using namespace std::chrono;
// non-constexpr
minutes mn1(6000);
hours hr1 = duration_cast<hours>(mn1);
// constexpr
constexpr minutes mn2(6000);
constexpr hours hr2 = duration_cast<hours>(mn2);
return 0;
}
// { dg-do compile { xfail *-*-* } }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <memory>
#include <testsuite_common_types.h>
struct derived : public std::enable_shared_from_this<int>
{
constexpr derived() { }
};
int main()
{
__gnu_test::constexpr_default_constructible test;
test.operator()<derived>(); // { dg-excess-errors "" }
derived d;
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <memory>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test;
test.operator()<std::pair<int, int>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <ratio>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_data
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr intmax_t v1(_Ttesttype::num);
constexpr intmax_t v2(_Ttesttype::den);
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_data test;
test.operator()<std::ratio<600, 900>>();
return 0;
}
// { dg-do compile { xfail *-*-* } }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <memory>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test1;
test1.operator()<std::shared_ptr<int>>(); // { dg-excess-errors "" }
__gnu_test::constexpr_single_value_constructible test2;
test2.operator()<std::shared_ptr<int>, std::nullptr_t>(); // { dg-excess-errors "" }
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <chrono>
#include <testsuite_common_types.h>
int main()
{
using namespace std::chrono;
__gnu_test::constexpr_default_constructible test1;
test1.operator()<time_point<system_clock>>();
__gnu_test::constexpr_single_value_constructible test2;
test2.operator()<time_point<system_clock>, seconds>();
test2.operator()<time_point<system_clock, seconds>,
time_point<system_clock, minutes>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <chrono>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::min());
constexpr auto v2(_Ttesttype::max());
constexpr _Ttesttype obj;
constexpr auto v3 = obj.time_since_epoch();
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
using namespace std::chrono;
__gnu_test::constexpr_member_functions test;
test.operator()<time_point<system_clock>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <chrono>
#include <testsuite_common_types.h>
int main()
{
using namespace std::chrono;
typedef time_point<system_clock, hours> to_type;
typedef time_point<system_clock, minutes> from_type;
// constexpr
constexpr minutes m(6000);
constexpr hours h(19);
constexpr to_type tpm(h); // time_point object with minutes
constexpr from_type tph(m); // time_point object with hours
constexpr auto res(time_point_cast<hours>(tpm));
return 0;
}
// { dg-do compile { xfail *-*-* } }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <memory>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test1;
test1.operator()<std::unique_ptr<int>>(); // { dg-excess-errors "" }
__gnu_test::constexpr_single_value_constructible test2;
test2.operator()<std::unique_ptr<int>, std::nullptr_t>(); // { dg-excess-errors "" }
return 0;
}
...@@ -42,10 +42,10 @@ main() ...@@ -42,10 +42,10 @@ main()
} }
// { dg-warning "note" "" { target *-*-* } 347 } // { dg-warning "note" "" { target *-*-* } 347 }
// { dg-warning "note" "" { target *-*-* } 466 } // { dg-warning "note" "" { target *-*-* } 465 }
// { dg-warning "note" "" { target *-*-* } 883 } // { dg-warning "note" "" { target *-*-* } 883 }
// { dg-warning "note" "" { target *-*-* } 580 } // { dg-warning "note" "" { target *-*-* } 580 }
// { dg-warning "note" "" { target *-*-* } 1027 } // { dg-warning "note" "" { target *-*-* } 1027 }
// { dg-warning "note" "" { target *-*-* } 340 } // { dg-warning "note" "" { target *-*-* } 340 }
// { dg-warning "note" "" { target *-*-* } 290 } // { dg-warning "note" "" { target *-*-* } 290 }
// { dg-warning "note" "" { target *-*-* } 200 } // { dg-warning "note" "" { target *-*-* } 201 }
// { dg-do compile { xfail *-*-* } }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <memory>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test;
test.operator()<std::weak_ptr<int>>(); // { dg-excess-errors "" }
// test.operator()<std::__weak_ptr<int>>();
// test.operator()<std::__weak_count<__gnu_cxx::__default_lock_policy>>();
// test.operator()<std::_Sp_counted_base<__gnu_cxx::__default_lock_policy>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <string>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
typedef typename _Ttesttype::char_type char_type;
typedef typename _Ttesttype::int_type int_type;
const char_type c1(0);
const char_type c2 = c1;
const int_type i(0);
constexpr auto v1(_Ttesttype::eq(c1, c2));
constexpr auto v2(_Ttesttype::lt(c1, c2));
constexpr auto v3(_Ttesttype::to_char_type(i));
constexpr auto v4(_Ttesttype::to_int_type(c1));
constexpr auto v5(_Ttesttype::eq_int_type(i, i));
constexpr auto v6(_Ttesttype::eof());
constexpr auto v7(_Ttesttype::not_eof(i));
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
test.operator()<std::char_traits<char>>();
#ifdef _GLIBCXX_USE_WCHAR_T
test.operator()<std::char_traits<wchar_t>>();
#endif
test.operator()<std::char_traits<char16_t>>();
test.operator()<std::char_traits<char32_t>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <array>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr _Ttesttype a = { };
constexpr auto v1 = a.size();
constexpr auto v2 = a.max_size();
constexpr auto v3 = a.empty();
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
test.operator()<std::array<long, 60>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <bitset>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test1;
test1.operator()<std::bitset<0>>();
test1.operator()<std::bitset<1>>();
test1.operator()<std::bitset<256>>();
__gnu_test::constexpr_single_value_constructible test2;
test2.operator()<std::bitset<0>, unsigned long long>();
test2.operator()<std::bitset<1>, unsigned long long>();
test2.operator()<std::bitset<256>, unsigned long long>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <bitset>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr _Ttesttype obj;
constexpr auto v1 = obj.size();
// constexpr auto v2 = obj[4];
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
test.operator()<std::bitset<0>>();
test.operator()<std::bitset<1>>();
test.operator()<std::bitset<64>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <iterator>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test;
test.operator()<std::istream_iterator<char>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <iterator>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test;
test.operator()<std::istreambuf_iterator<char, std::char_traits<char>>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <complex>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test1;
test1.operator()<std::complex<float>>();
test1.operator()<std::complex<double>>();
test1.operator()<std::complex<long double>>();
__gnu_test::constexpr_single_value_constructible test2;
test2.operator()<std::complex<float>, float>();
test2.operator()<std::complex<double>, double>();
test2.operator()<std::complex<long double>, long double>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <complex>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
typedef typename _Ttesttype::_ComplexT _ComplexT;
const _ComplexT cc = { 1.1 };
constexpr _Ttesttype a(cc);
constexpr auto v1 = a.real();
constexpr auto v2 = a.imag();
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
test.operator()<std::complex<float>>();
test.operator()<std::complex<double>>();
test.operator()<std::complex<long double>>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_data
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::block_size);
constexpr auto v2(_Ttesttype::used_block);
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_data test;
typedef std::discard_block_engine
<
std::subtract_with_carry_engine<unsigned long, 24, 10, 24>,
389, 24
> type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::min());
constexpr auto v2(_Ttesttype::max());
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
typedef std::discard_block_engine
<
std::subtract_with_carry_engine<unsigned long, 24, 10, 24>,
389, 24
> type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::min());
constexpr auto v2(_Ttesttype::max());
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
typedef std::independent_bits_engine
<
std::subtract_with_carry_engine
<
uint_fast64_t, 48, 5, 12
>,
48, uint_fast64_t
> type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_data
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::multiplier);
constexpr auto v2(_Ttesttype::increment);
constexpr auto v3(_Ttesttype::modulus);
constexpr auto v4(_Ttesttype::default_seed);
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_data test;
typedef std::linear_congruential_engine<unsigned int, 41, 0, 2147483647> type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::min());
constexpr auto v2(_Ttesttype::max());
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
typedef std::linear_congruential_engine<unsigned int, 41, 0, 2147483647> type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_data
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::word_size);
constexpr auto v2(_Ttesttype::state_size);
constexpr auto v3(_Ttesttype::shift_size);
constexpr auto v4(_Ttesttype::mask_bits);
constexpr auto v5(_Ttesttype::xor_mask);
constexpr auto v6(_Ttesttype::tempering_u);
constexpr auto v7(_Ttesttype::tempering_d);
constexpr auto v8(_Ttesttype::tempering_s);
constexpr auto v9(_Ttesttype::tempering_b);
constexpr auto v10(_Ttesttype::tempering_t);
constexpr auto v11(_Ttesttype::tempering_c);
constexpr auto v12(_Ttesttype::tempering_l);
constexpr auto v13(_Ttesttype::initialization_multiplier);
constexpr auto v14(_Ttesttype::default_seed);
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_data test;
typedef std::mt19937 type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::min());
constexpr auto v2(_Ttesttype::max());
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
typedef std::mt19937 type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_data
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::table_size);
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_data test;
typedef std::shuffle_order_engine
<
std::linear_congruential_engine
<
uint_fast32_t,16807UL, 0UL, 2147483647UL
>,
256
> type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::min());
constexpr auto v2(_Ttesttype::max());
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
typedef std::shuffle_order_engine
<
std::linear_congruential_engine
<
uint_fast32_t,16807UL, 0UL, 2147483647UL
>,
256
> type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_data
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::word_size);
constexpr auto v2(_Ttesttype::short_lag);
constexpr auto v3(_Ttesttype::long_lag);
constexpr auto v4(_Ttesttype::default_seed);
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_data test;
typedef std::ranlux24_base type;
test.operator()<type>();
return 0;
}
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 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 <random>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_functions
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v1(_Ttesttype::min());
constexpr auto v2(_Ttesttype::max());
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_functions test;
typedef std::ranlux24_base type;
test.operator()<type>();
return 0;
}
...@@ -34,5 +34,5 @@ void test01() ...@@ -34,5 +34,5 @@ void test01()
} }
// { dg-error "synthesized" "" { target *-*-* } 33 } // { dg-error "synthesized" "" { target *-*-* } 33 }
// { dg-error "within this context" "" { target *-*-* } 26 } // { dg-error "within this context" "" { target *-*-* } 26 }
// { dg-error "is private" "" { target *-*-* } 788 } // { dg-error "is private" "" { target *-*-* } 789 }
// { dg-error "operator=" "" { target *-*-* } 0 } // { dg-error "operator=" "" { target *-*-* } 0 }
...@@ -34,5 +34,5 @@ void test02() ...@@ -34,5 +34,5 @@ void test02()
} }
// { dg-error "within this context" "" { target *-*-* } 26 } // { dg-error "within this context" "" { target *-*-* } 26 }
// { dg-error "synthesized" "" { target *-*-* } 33 } // { dg-error "synthesized" "" { target *-*-* } 33 }
// { dg-error "is private" "" { target *-*-* } 785 } // { dg-error "is private" "" { target *-*-* } 786 }
// { dg-error "copy constructor" "" { target *-*-* } 0 } // { dg-error "copy constructor" "" { target *-*-* } 0 }
// { dg-options "-x c" }
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,19 +18,11 @@ ...@@ -18,19 +18,11 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <stdatomic.h> #include <ios>
#include <testsuite_common_types.h>
int main() int main()
{ {
atomic_flag f; __gnu_test::constexpr_bitwise_operators<std::ios_base::fmtflags>();
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; return 0;
} }
// { dg-options "-x c -D_GLIBCXX_DEBUG" }
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,5 +18,11 @@ ...@@ -18,5 +18,11 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// libstdc++/36130 #include <ios>
#include <stdatomic.h> #include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_bitwise_operators<std::ios_base::iostate>();
return 0;
}
// { dg-options "-x c -shared-libgcc -lstdc++" } // { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -17,18 +18,11 @@ ...@@ -17,18 +18,11 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <cassert> #include <ios>
#include <stdatomic.h> #include <testsuite_common_types.h>
// libstdc++/40826
// libstdc++/40654
int main() int main()
{ {
atomic_flag f = ATOMIC_FLAG_INIT; __gnu_test::constexpr_bitwise_operators<std::ios_base::openmode>();
atomic_flag_clear(&f); // set to false
assert( false == atomic_flag_test_and_set(&f) ); // return previous false, set to true
assert( true == atomic_flag_test_and_set(&f) ); // return true
return 0; return 0;
} }
...@@ -23,29 +23,68 @@ ...@@ -23,29 +23,68 @@
// 28.5.1 // 28.5.1
#include <regex> #include <regex>
#include <testsuite_hooks.h>
void void
test01() test01()
{ {
bool test __attribute__((unused)) = true; std::regex_constants::syntax_option_type option { };
option = option | std::regex_constants::icase;
option = option | std::regex_constants::nosubs;
option = option | std::regex_constants::optimize;
option = option | std::regex_constants::collate;
option = option | std::regex_constants::ECMAScript;
option = option | std::regex_constants::basic;
option = option | std::regex_constants::extended;
option = option | std::regex_constants::awk;
option = option | std::regex_constants::grep;
option = option | std::regex_constants::egrep;
}
void
test02()
{
std::regex_constants::syntax_option_type option { };
option = option & std::regex_constants::icase;
option = option & std::regex_constants::nosubs;
option = option & std::regex_constants::optimize;
option = option & std::regex_constants::collate;
option = option & std::regex_constants::ECMAScript;
option = option & std::regex_constants::basic;
option = option & std::regex_constants::extended;
option = option & std::regex_constants::awk;
option = option & std::regex_constants::grep;
option = option & std::regex_constants::egrep;
}
std::regex_constants::syntax_option_type option = 0; void
test03()
{
std::regex_constants::syntax_option_type option { };
option = ~std::regex_constants::icase;
option = ~std::regex_constants::nosubs;
option = ~std::regex_constants::optimize;
option = ~std::regex_constants::collate;
option = ~std::regex_constants::ECMAScript;
option = ~std::regex_constants::basic;
option = ~std::regex_constants::extended;
option = ~std::regex_constants::awk;
option = ~std::regex_constants::grep;
option = ~std::regex_constants::egrep;
}
option |= std::regex_constants::icase; void
option |= std::regex_constants::nosubs; test04_constexpr()
option |= std::regex_constants::optimize; {
option |= std::regex_constants::collate; using namespace std::regex_constants;
option |= std::regex_constants::ECMAScript; constexpr auto a1 = icase | awk;
option |= std::regex_constants::basic; constexpr auto a2 = icase & awk;
option |= std::regex_constants::extended; constexpr auto a3 = ~grep;
option |= std::regex_constants::awk;
option |= std::regex_constants::grep;
option |= std::regex_constants::egrep;
} }
int main() int main()
{ {
test01(); test01();
test02();
test03();
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment