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
2010-11-01 Benjamin Kosnik <bkoz@redhat.com>
* 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.
2010-11-01 Jason Merrill <jason@redhat.com>
* libsupc++/initializer_list: Decorate with constexpr.
......
......@@ -1193,6 +1193,13 @@ GLIBCXX_3.4.15 {
} 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.
CXXABI_1.3 {
......
......@@ -599,6 +599,7 @@ INPUT = @srcdir@/doc/doxygen/doxygroups.cc \
include/complex \
include/condition_variable \
include/deque \
include/forward_list \
include/fstream \
include/functional \
include/future \
......@@ -1539,6 +1540,8 @@ PREDEFINED = __cplusplus \
_GLIBCXX_END_NESTED_NAMESPACE=} \
"_GLIBCXX_TEMPLATE_ARGS=... " \
_GLIBCXX_DEPRECATED \
_GLIBCXX_CONSTEXPR=constexpr \
_GLIBCXX_USE_CONSTEXPR=constexpr \
_GLIBCXX_USE_WCHAR_T \
_GLIBCXX_USE_LONG_LONG \
_GLIBCXX_USE_C99_STDINT_TR1 \
......
......@@ -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">cwctype</filename></entry>
</row>
<row>
<entry><filename class="headerfile">stdatomic.h</filename></entry>
</row>
</tbody>
</tgroup>
</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
## Free Software Foundation, Inc.
......@@ -80,8 +80,6 @@ bits_headers = \
${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \
${bits_srcdir}/atomicfwd_c.h \
${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \
${bits_srcdir}/atomic_2.h \
${bits_srcdir}/basic_ios.h \
......@@ -679,8 +677,7 @@ if GLIBCXX_C_HEADERS_C_GLOBAL
c_compatibility_headers = \
${c_compatibility_srcdir}/complex.h \
${c_compatibility_srcdir}/fenv.h \
${c_compatibility_srcdir}/tgmath.h \
${c_compatibility_srcdir}/stdatomic.h
${c_compatibility_srcdir}/tgmath.h
endif
if GLIBCXX_C_HEADERS_C
......
......@@ -14,8 +14,6 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
#o# Makefile for the include subdirectory of the GNU C++ Standard library.
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
......@@ -322,8 +320,6 @@ bits_headers = \
${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \
${bits_srcdir}/atomicfwd_c.h \
${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \
${bits_srcdir}/atomic_2.h \
${bits_srcdir}/basic_ios.h \
......@@ -914,8 +910,7 @@ c_compatibility_builddir = .
@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}/fenv.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_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h
@GLIBCXX_C_HEADERS_C_STD_TRUE@c_compatibility_headers =
@GLIBCXX_C_HEADERS_C_TRUE@c_compatibility_headers = \
......
......@@ -208,7 +208,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/// [allocator.tag]
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)
......
// -*- C++ -*- header.
// Copyright (C) 2008, 2009
// Copyright (C) 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -33,24 +33,42 @@
#pragma GCC system_header
// _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_BEGIN_NAMESPACE(std)
// 0 == __atomic0 == Never lock-free
// 0 == __atomic0 == Never lock-free
namespace __atomic0
{
struct atomic_flag;
_GLIBCXX_BEGIN_EXTERN_C
void
atomic_flag_clear_explicit(__atomic_flag_base*, memory_order)
_GLIBCXX_NOTHROW;
void
__atomic_flag_wait_explicit(__atomic_flag_base*, memory_order)
_GLIBCXX_NOTHROW;
_GLIBCXX_CONST __atomic_flag_base*
__atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW;
_GLIBCXX_END_EXTERN_C
// Implementation specific defines.
#define _ATOMIC_MEMBER_ _M_i
// Implementation specific defines.
#define _ATOMIC_LOAD_(__a, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
__i_type* __p = &_ATOMIC_MEMBER_; \
__atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
__i_type __r = *__p; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_STORE_(__a, __m, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
__i_type* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
__atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
......@@ -59,34 +77,42 @@ namespace __atomic0
__v; })
#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
__i_type* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
__atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
__i_type __r = *__p; \
*__p __o __v; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
__i_type* __p = &_ATOMIC_MEMBER_; \
__typeof__(__e) __q = (__e); \
__typeof__(__m) __v = (__m); \
bool __r; \
__atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
if (__t__ == *__q) { *__p = __v; __r = true; } \
else { *__q = __t__; __r = false; } \
__i_type __t = *__p; \
if (*__q == __t) \
{ \
*__p = const_cast<__i_type>(__v); \
__r = true; \
} \
else { *__q = __t; __r = false; } \
atomic_flag_clear_explicit(__g, __x); \
__r; })
/// atomic_flag
struct atomic_flag : public __atomic_flag_base
{
atomic_flag() = default;
~atomic_flag() = default;
atomic_flag(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) volatile = delete;
// Conversion to ATOMIC_FLAG_INIT.
......@@ -95,11 +121,18 @@ namespace __atomic0
bool
test_and_set(memory_order __m = memory_order_seq_cst);
bool
test_and_set(memory_order __m = memory_order_seq_cst) volatile;
void
clear(memory_order __m = memory_order_seq_cst);
void
clear(memory_order __m = memory_order_seq_cst) volatile;
};
/// 29.4.2, address types
/// atomic_address
struct atomic_address
{
private:
......@@ -109,13 +142,16 @@ namespace __atomic0
atomic_address() = default;
~atomic_address() = default;
atomic_address(const atomic_address&) = delete;
atomic_address& operator=(const atomic_address&) = delete;
atomic_address& operator=(const atomic_address&) volatile = delete;
atomic_address(void* __v) { _M_i = __v; }
constexpr atomic_address(void* __v): _M_i (__v) { }
bool
is_lock_free() const { return false; }
bool
is_lock_free() const
{ return false; }
is_lock_free() const volatile { return false; }
void
store(void* __v, memory_order __m = memory_order_seq_cst)
......@@ -126,6 +162,15 @@ namespace __atomic0
_ATOMIC_STORE_(this, __v, __m);
}
void
store(void* __v, memory_order __m = memory_order_seq_cst) volatile
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
__glibcxx_assert(__m != memory_order_consume);
_ATOMIC_STORE_(this, __v, __m);
}
void*
load(memory_order __m = memory_order_seq_cst) const
{
......@@ -135,9 +180,21 @@ namespace __atomic0
}
void*
load(memory_order __m = memory_order_seq_cst) const volatile
{
__glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel);
return _ATOMIC_LOAD_(this, __m);
}
void*
exchange(void* __v, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, =, __v, __m); }
void*
exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, =, __v, __m); }
bool
compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2)
......@@ -149,6 +206,16 @@ namespace __atomic0
}
bool
compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
}
bool
compare_exchange_weak(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst)
{
......@@ -157,6 +224,50 @@ namespace __atomic0
}
bool
compare_exchange_weak(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_weak(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_weak(const void*& __v1, const void* __v2,
memory_order __m1, memory_order __m2)
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
}
bool
compare_exchange_weak(const void*& __v1, const void* __v2,
memory_order __m1, memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
}
bool
compare_exchange_weak(const void*& __v1, const void* __v2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_weak(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_weak(const void*& __v1, const void* __v2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_weak(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2)
{
......@@ -167,8 +278,62 @@ namespace __atomic0
}
bool
compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
}
bool
compare_exchange_strong(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(const void*& __v1, const void* __v2,
memory_order __m1, memory_order __m2)
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
}
bool
compare_exchange_strong(const void*& __v1, const void* __v2,
memory_order __m1, memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
}
bool
compare_exchange_strong(const void*& __v1, const void* __v2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(const void*& __v1, const void* __v2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
......@@ -187,6 +352,18 @@ namespace __atomic0
}
void*
fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
{
void* volatile* __p = &(_M_i);
__atomic_flag_base* __g = __atomic_flag_for_address(__p);
__atomic_flag_wait_explicit(__g, __m);
void* __r = *__p;
*__p = (void*)((char*)(*__p) + __d);
atomic_flag_clear_explicit(__g, __m);
return __r;
}
void*
fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
{
void** __p = &(_M_i);
......@@ -198,9 +375,25 @@ namespace __atomic0
return __r;
}
void*
fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
{
void* volatile* __p = &(_M_i);
__atomic_flag_base* __g = __atomic_flag_for_address(__p);
__atomic_flag_wait_explicit(__g, __m);
void* __r = *__p;
*__p = (void*)((char*)(*__p) - __d);
atomic_flag_clear_explicit(__g, __m);
return __r;
}
operator void*() const
{ return load(); }
operator void*() const volatile
{ return load(); }
// XXX
void*
operator=(void* __v)
{
......@@ -209,16 +402,32 @@ namespace __atomic0
}
void*
operator=(void* __v) volatile
{
store(__v);
return __v;
}
void*
operator+=(ptrdiff_t __d)
{ return fetch_add(__d) + __d; }
void*
operator+=(ptrdiff_t __d) volatile
{ return fetch_add(__d) + __d; }
void*
operator-=(ptrdiff_t __d)
{ return fetch_sub(__d) - __d; }
void*
operator-=(ptrdiff_t __d) volatile
{ return fetch_sub(__d) - __d; }
};
// 29.3.1 atomic integral types
/// Base class for atomic integrals.
//
// For each of the integral types, define atomic_[integral type] struct
//
// atomic_bool bool
......@@ -244,71 +453,131 @@ namespace __atomic0
struct __atomic_base
{
private:
typedef _ITp __integral_type;
typedef _ITp __int_type;
__integral_type _M_i;
__int_type _M_i;
public:
__atomic_base() = default;
~__atomic_base() = default;
__atomic_base(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) volatile = delete;
// Requires __integral_type convertible to _M_base._M_i.
__atomic_base(__integral_type __i) { _M_i = __i; }
// Requires __int_type convertible to _M_base._M_i.
constexpr __atomic_base(__int_type __i): _M_i (__i) { }
operator __integral_type() const
operator __int_type() const
{ return load(); }
__integral_type
operator=(__integral_type __i)
operator __int_type() const volatile
{ return load(); }
__int_type
operator=(__int_type __i)
{
store(__i);
return __i;
}
__integral_type
__int_type
operator=(__int_type __i) volatile
{
store(__i);
return __i;
}
__int_type
operator++(int)
{ return fetch_add(1); }
__integral_type
__int_type
operator++(int) volatile
{ return fetch_add(1); }
__int_type
operator--(int)
{ return fetch_sub(1); }
__integral_type
__int_type
operator--(int) volatile
{ return fetch_sub(1); }
__int_type
operator++()
{ return fetch_add(1) + 1; }
__integral_type
__int_type
operator++() volatile
{ return fetch_add(1) + 1; }
__int_type
operator--()
{ return fetch_sub(1) - 1; }
__integral_type
operator+=(__integral_type __i)
__int_type
operator--() volatile
{ return fetch_sub(1) - 1; }
__int_type
operator+=(__int_type __i)
{ return fetch_add(__i) + __i; }
__integral_type
operator-=(__integral_type __i)
__int_type
operator+=(__int_type __i) volatile
{ return fetch_add(__i) + __i; }
__int_type
operator-=(__int_type __i)
{ return fetch_sub(__i) - __i; }
__integral_type
operator&=(__integral_type __i)
__int_type
operator-=(__int_type __i) volatile
{ return fetch_sub(__i) - __i; }
__int_type
operator&=(__int_type __i)
{ return fetch_and(__i) & __i; }
__int_type
operator&=(__int_type __i) volatile
{ return fetch_and(__i) & __i; }
__integral_type
operator|=(__integral_type __i)
__int_type
operator|=(__int_type __i)
{ return fetch_or(__i) | __i; }
__integral_type
operator^=(__integral_type __i)
__int_type
operator|=(__int_type __i) volatile
{ return fetch_or(__i) | __i; }
__int_type
operator^=(__int_type __i)
{ return fetch_xor(__i) ^ __i; }
__int_type
operator^=(__int_type __i) volatile
{ return fetch_xor(__i) ^ __i; }
bool
is_lock_free() const
{ return false; }
bool
is_lock_free() const volatile
{ return false; }
void
store(__int_type __i, memory_order __m = memory_order_seq_cst)
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
__glibcxx_assert(__m != memory_order_consume);
_ATOMIC_STORE_(this, __i, __m);
}
void
store(__integral_type __i, memory_order __m = memory_order_seq_cst)
store(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
......@@ -316,7 +585,7 @@ namespace __atomic0
_ATOMIC_STORE_(this, __i, __m);
}
__integral_type
__int_type
load(memory_order __m = memory_order_seq_cst) const
{
__glibcxx_assert(__m != memory_order_release);
......@@ -324,12 +593,24 @@ namespace __atomic0
return _ATOMIC_LOAD_(this, __m);
}
__integral_type
exchange(__integral_type __i, memory_order __m = memory_order_seq_cst)
__int_type
load(memory_order __m = memory_order_seq_cst) const volatile
{
__glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel);
return _ATOMIC_LOAD_(this, __m);
}
__int_type
exchange(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, =, __i, __m); }
__int_type
exchange(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, =, __i, __m); }
bool
compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2)
{
__glibcxx_assert(__m2 != memory_order_release);
......@@ -339,7 +620,17 @@ namespace __atomic0
}
bool
compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
}
bool
compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_weak(__i1, __i2, __m,
......@@ -347,7 +638,15 @@ namespace __atomic0
}
bool
compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_weak(__i1, __i2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2)
{
__glibcxx_assert(__m2 != memory_order_release);
......@@ -357,94 +656,75 @@ namespace __atomic0
}
bool
compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
}
bool
compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_strong(__i1, __i2, __m,
__calculate_memory_order(__m));
}
__integral_type
fetch_add(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, +=, __i, __m); }
__integral_type
fetch_sub(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, -=, __i, __m); }
__integral_type
fetch_and(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, &=, __i, __m); }
__integral_type
fetch_or(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, |=, __i, __m); }
__integral_type
fetch_xor(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
};
/// atomic_bool
// NB: No operators or fetch-operations for this type.
struct atomic_bool
{
private:
__atomic_base<bool> _M_base;
public:
atomic_bool() = default;
~atomic_bool() = default;
atomic_bool(const atomic_bool&) = delete;
atomic_bool& operator=(const atomic_bool&) volatile = delete;
atomic_bool(bool __i) : _M_base(__i) { }
bool
operator=(bool __i)
{ return _M_base.operator=(__i); }
bool
compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_strong(__i1, __i2, __m,
__calculate_memory_order(__m));
}
operator bool() const
{ return _M_base.load(); }
__int_type
fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, +=, __i, __m); }
bool
is_lock_free() const
{ return _M_base.is_lock_free(); }
__int_type
fetch_add(__int_type __i,
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, +=, __i, __m); }
void
store(bool __i, memory_order __m = memory_order_seq_cst)
{ _M_base.store(__i, __m); }
__int_type
fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, -=, __i, __m); }
bool
load(memory_order __m = memory_order_seq_cst) const
{ return _M_base.load(__m); }
__int_type
fetch_sub(__int_type __i,
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, -=, __i, __m); }
bool
exchange(bool __i, memory_order __m = memory_order_seq_cst)
{ return _M_base.exchange(__i, __m); }
__int_type
fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, &=, __i, __m); }
bool
compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
__int_type
fetch_and(__int_type __i,
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, &=, __i, __m); }
bool
compare_exchange_weak(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m); }
__int_type
fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, |=, __i, __m); }
bool
compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
__int_type
fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, |=, __i, __m); }
__int_type
fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
bool
compare_exchange_strong(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m); }
};
__int_type
fetch_xor(__int_type __i,
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
};
#undef _ATOMIC_LOAD_
#undef _ATOMIC_STORE_
......@@ -452,6 +732,6 @@ namespace __atomic0
#undef _ATOMIC_CMPEXCHNG_
} // namespace __atomic0
// _GLIBCXX_END_NAMESPACE
_GLIBCXX_END_NAMESPACE
#endif
// -*- C++ -*- header.
// Copyright (C) 2008, 2009
// Copyright (C) 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -33,7 +33,7 @@
#pragma GCC system_header
// _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_BEGIN_NAMESPACE(std)
// 2 == __atomic2 == Always lock-free
// Assumed:
......@@ -49,6 +49,7 @@ namespace __atomic2
atomic_flag() = default;
~atomic_flag() = default;
atomic_flag(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) volatile = delete;
// Conversion to ATOMIC_FLAG_INIT.
......@@ -63,6 +64,15 @@ namespace __atomic2
return __sync_lock_test_and_set(&_M_i, 1);
}
bool
test_and_set(memory_order __m = memory_order_seq_cst) volatile
{
// Redundant synchronize if built-in for lock is a full barrier.
if (__m != memory_order_acquire && __m != memory_order_acq_rel)
__sync_synchronize();
return __sync_lock_test_and_set(&_M_i, 1);
}
void
clear(memory_order __m = memory_order_seq_cst)
{
......@@ -74,10 +84,22 @@ namespace __atomic2
if (__m != memory_order_acquire && __m != memory_order_acq_rel)
__sync_synchronize();
}
void
clear(memory_order __m = memory_order_seq_cst) volatile
{
__glibcxx_assert(__m != memory_order_consume);
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
__sync_lock_release(&_M_i);
if (__m != memory_order_acquire && __m != memory_order_acq_rel)
__sync_synchronize();
}
};
/// 29.4.2, address types
/// atomic_address
struct atomic_address
{
private:
......@@ -87,13 +109,16 @@ namespace __atomic2
atomic_address() = default;
~atomic_address() = default;
atomic_address(const atomic_address&) = delete;
atomic_address& operator=(const atomic_address&) = delete;
atomic_address& operator=(const atomic_address&) volatile = delete;
atomic_address(void* __v) { _M_i = __v; }
constexpr atomic_address(void* __v): _M_i (__v) { }
bool
is_lock_free() const
{ return true; }
is_lock_free() const { return true; }
bool
is_lock_free() const volatile { return true; }
void
store(void* __v, memory_order __m = memory_order_seq_cst)
......@@ -113,6 +138,24 @@ namespace __atomic2
}
}
void
store(void* __v, memory_order __m = memory_order_seq_cst) volatile
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
__glibcxx_assert(__m != memory_order_consume);
if (__m == memory_order_relaxed)
_M_i = __v;
else
{
// write_mem_barrier();
_M_i = __v;
if (__m == memory_order_seq_cst)
__sync_synchronize();
}
}
void*
load(memory_order __m = memory_order_seq_cst) const
{
......@@ -126,19 +169,69 @@ namespace __atomic2
}
void*
load(memory_order __m = memory_order_seq_cst) const volatile
{
__glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel);
__sync_synchronize();
void* __ret = _M_i;
__sync_synchronize();
return __ret;
}
void*
exchange(void* __v, memory_order __m = memory_order_seq_cst)
{
// XXX built-in assumes memory_order_acquire.
return __sync_lock_test_and_set(&_M_i, __v);
}
void*
exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile
{
// XXX built-in assumes memory_order_acquire.
return __sync_lock_test_and_set(&_M_i, __v);
}
bool
compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2)
{ return compare_exchange_strong(__v1, __v2, __m1, __m2); }
bool
compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2) volatile
{ return compare_exchange_strong(__v1, __v2, __m1, __m2); }
bool
compare_exchange_weak(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_weak(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_weak(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_weak(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_weak(const void*& __v1, const void* __v2,
memory_order __m1, memory_order __m2)
{ return compare_exchange_strong(__v1, __v2, __m1, __m2); }
bool
compare_exchange_weak(const void*& __v1, const void* __v2,
memory_order __m1, memory_order __m2) volatile
{ return compare_exchange_strong(__v1, __v2, __m1, __m2); }
bool
compare_exchange_weak(const void*& __v1, const void* __v2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_weak(__v1, __v2, __m,
......@@ -146,6 +239,14 @@ namespace __atomic2
}
bool
compare_exchange_weak(const void*& __v1, const void* __v2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_weak(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2)
{
......@@ -162,8 +263,80 @@ namespace __atomic2
}
bool
compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
void* __v1o = __v1;
void* __v1n = __sync_val_compare_and_swap(&_M_i, __v1o, __v2);
// Assume extra stores (of same value) allowed in true case.
__v1 = __v1n;
return __v1o == __v1n;
}
bool
compare_exchange_strong(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(const void*& __v1, const void* __v2,
memory_order __m1, memory_order __m2)
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
const void* __v1o = __v1;
const void* __v1n = __sync_val_compare_and_swap(&_M_i, __v1o, __v2);
// Assume extra stores (of same value) allowed in true case.
__v1 = __v1n;
return __v1o == __v1n;
}
bool
compare_exchange_strong(const void*& __v1, const void* __v2,
memory_order __m1, memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
const void* __v1o = __v1;
const void* __v1n = __sync_val_compare_and_swap(&_M_i, __v1o, __v2);
// Assume extra stores (of same value) allowed in true case.
__v1 = __v1n;
return __v1o == __v1n;
}
bool
compare_exchange_strong(const void*& __v1, const void* __v2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(const void*& __v1, const void* __v2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m));
......@@ -174,14 +347,46 @@ namespace __atomic2
{ return __sync_fetch_and_add(&_M_i, __d); }
void*
fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
{ return __sync_fetch_and_add(&_M_i, __d); }
void*
fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_sub(&_M_i, __d); }
void*
fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
{ return __sync_fetch_and_sub(&_M_i, __d); }
operator void*() const
{ return load(); }
operator void*() const volatile
{ return load(); }
void*
operator=(void* __v)
#if 0
// XXX as specified but won't compile as store takes void*,
// invalid conversion from const void* to void*
// CD1 had this signature
operator=(const void* __v)
#else
operator=(void* __v)
#endif
{
store(__v);
return __v;
}
void*
#if 0
// XXX as specified but won't compile as store takes void*,
// invalid conversion from const void* to void*
// CD1 had this signature, but store and this could both be const void*?
operator=(const void* __v) volatile
#else
operator=(void* __v) volatile
#endif
{
store(__v);
return __v;
......@@ -192,11 +397,21 @@ namespace __atomic2
{ return __sync_add_and_fetch(&_M_i, __d); }
void*
operator+=(ptrdiff_t __d) volatile
{ return __sync_add_and_fetch(&_M_i, __d); }
void*
operator-=(ptrdiff_t __d)
{ return __sync_sub_and_fetch(&_M_i, __d); }
void*
operator-=(ptrdiff_t __d) volatile
{ return __sync_sub_and_fetch(&_M_i, __d); }
};
// 29.3.1 atomic integral types
/// Base class for atomic integrals.
//
// For each of the integral types, define atomic_[integral type] struct
//
// atomic_bool bool
......@@ -214,79 +429,148 @@ namespace __atomic2
// atomic_char16_t char16_t
// atomic_char32_t char32_t
// atomic_wchar_t wchar_t
// Base type.
// NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or 8 bytes,
// since that is what GCC built-in functions for atomic memory access work on.
//
// NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or
// 8 bytes, since that is what GCC built-in functions for atomic
// memory access expect.
template<typename _ITp>
struct __atomic_base
{
private:
typedef _ITp __integral_type;
typedef _ITp __int_type;
__integral_type _M_i;
__int_type _M_i;
public:
__atomic_base() = default;
~__atomic_base() = default;
__atomic_base(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) volatile = delete;
// Requires __integral_type convertible to _M_base._M_i.
__atomic_base(__integral_type __i) { _M_i = __i; }
// Requires __int_type convertible to _M_i.
constexpr __atomic_base(__int_type __i): _M_i (__i) { }
operator __integral_type() const
operator __int_type() const
{ return load(); }
__integral_type
operator=(__integral_type __i)
operator __int_type() const volatile
{ return load(); }
__int_type
operator=(__int_type __i)
{
store(__i);
return __i;
}
__int_type
operator=(__int_type __i) volatile
{
store(__i);
return __i;
}
__integral_type
__int_type
operator++(int)
{ return fetch_add(1); }
__integral_type
__int_type
operator++(int) volatile
{ return fetch_add(1); }
__int_type
operator--(int)
{ return fetch_sub(1); }
__integral_type
__int_type
operator--(int) volatile
{ return fetch_sub(1); }
__int_type
operator++()
{ return __sync_add_and_fetch(&_M_i, 1); }
__integral_type
__int_type
operator++() volatile
{ return __sync_add_and_fetch(&_M_i, 1); }
__int_type
operator--()
{ return __sync_sub_and_fetch(&_M_i, 1); }
__integral_type
operator+=(__integral_type __i)
__int_type
operator--() volatile
{ return __sync_sub_and_fetch(&_M_i, 1); }
__int_type
operator+=(__int_type __i)
{ return __sync_add_and_fetch(&_M_i, __i); }
__int_type
operator+=(__int_type __i) volatile
{ return __sync_add_and_fetch(&_M_i, __i); }
__integral_type
operator-=(__integral_type __i)
__int_type
operator-=(__int_type __i)
{ return __sync_sub_and_fetch(&_M_i, __i); }
__integral_type
operator&=(__integral_type __i)
__int_type
operator-=(__int_type __i) volatile
{ return __sync_sub_and_fetch(&_M_i, __i); }
__int_type
operator&=(__int_type __i)
{ return __sync_and_and_fetch(&_M_i, __i); }
__integral_type
operator|=(__integral_type __i)
__int_type
operator&=(__int_type __i) volatile
{ return __sync_and_and_fetch(&_M_i, __i); }
__int_type
operator|=(__int_type __i)
{ return __sync_or_and_fetch(&_M_i, __i); }
__int_type
operator|=(__int_type __i) volatile
{ return __sync_or_and_fetch(&_M_i, __i); }
__integral_type
operator^=(__integral_type __i)
__int_type
operator^=(__int_type __i)
{ return __sync_xor_and_fetch(&_M_i, __i); }
__int_type
operator^=(__int_type __i) volatile
{ return __sync_xor_and_fetch(&_M_i, __i); }
bool
is_lock_free() const
{ return true; }
bool
is_lock_free() const volatile
{ return true; }
void
store(__int_type __i, memory_order __m = memory_order_seq_cst)
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
__glibcxx_assert(__m != memory_order_consume);
if (__m == memory_order_relaxed)
_M_i = __i;
else
{
// write_mem_barrier();
_M_i = __i;
if (__m == memory_order_seq_cst)
__sync_synchronize();
}
}
void
store(__integral_type __i, memory_order __m = memory_order_seq_cst)
store(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
......@@ -303,32 +587,57 @@ namespace __atomic2
}
}
__integral_type
load(memory_order __m = memory_order_seq_cst) const
__int_type
load(memory_order __m = memory_order_seq_cst) const
{
__glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel);
__sync_synchronize();
__integral_type __ret = _M_i;
__int_type __ret = _M_i;
__sync_synchronize();
return __ret;
}
__integral_type
exchange(__integral_type __i, memory_order __m = memory_order_seq_cst)
__int_type
load(memory_order __m = memory_order_seq_cst) const volatile
{
__glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel);
__sync_synchronize();
__int_type __ret = _M_i;
__sync_synchronize();
return __ret;
}
__int_type
exchange(__int_type __i, memory_order __m = memory_order_seq_cst)
{
// XXX built-in assumes memory_order_acquire.
return __sync_lock_test_and_set(&_M_i, __i);
}
__int_type
exchange(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
{
// XXX built-in assumes memory_order_acquire.
return __sync_lock_test_and_set(&_M_i, __i);
}
bool
compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2)
{ return compare_exchange_strong(__i1, __i2, __m1, __m2); }
bool
compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2) volatile
{ return compare_exchange_strong(__i1, __i2, __m1, __m2); }
bool
compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_weak(__i1, __i2, __m,
......@@ -336,15 +645,39 @@ namespace __atomic2
}
bool
compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
memory_order __m1, memory_order __m2)
compare_exchange_weak(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_weak(__i1, __i2, __m,
__calculate_memory_order(__m));
}
bool
compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2)
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
__int_type __i1o = __i1;
__int_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
// Assume extra stores (of same value) allowed in true case.
__i1 = __i1n;
return __i1o == __i1n;
}
bool
compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m1, memory_order __m2) volatile
{
__glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel);
__glibcxx_assert(__m2 <= __m1);
__integral_type __i1o = __i1;
__integral_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
__int_type __i1o = __i1;
__int_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
// Assume extra stores (of same value) allowed in true case.
__i1 = __i1n;
......@@ -352,101 +685,68 @@ namespace __atomic2
}
bool
compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst)
{
return compare_exchange_strong(__i1, __i2, __m,
__calculate_memory_order(__m));
}
__integral_type
fetch_add(__integral_type __i,
memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_add(&_M_i, __i); }
__integral_type
fetch_sub(__integral_type __i,
memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_sub(&_M_i, __i); }
__integral_type
fetch_and(__integral_type __i,
memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_and(&_M_i, __i); }
__integral_type
fetch_or(__integral_type __i,
memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_or(&_M_i, __i); }
__integral_type
fetch_xor(__integral_type __i,
memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_xor(&_M_i, __i); }
};
/// atomic_bool
// NB: No operators or fetch-operations for this type.
struct atomic_bool
{
private:
__atomic_base<bool> _M_base;
public:
atomic_bool() = default;
~atomic_bool() = default;
atomic_bool(const atomic_bool&) = delete;
atomic_bool& operator=(const atomic_bool&) volatile = delete;
atomic_bool(bool __i) : _M_base(__i) { }
bool
operator=(bool __i)
{ return _M_base.operator=(__i); }
bool
compare_exchange_strong(__int_type& __i1, __int_type __i2,
memory_order __m = memory_order_seq_cst) volatile
{
return compare_exchange_strong(__i1, __i2, __m,
__calculate_memory_order(__m));
}
operator bool() const
{ return _M_base.load(); }
__int_type
fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_add(&_M_i, __i); }
bool
is_lock_free() const
{ return _M_base.is_lock_free(); }
__int_type
fetch_add(__int_type __i,
memory_order __m = memory_order_seq_cst) volatile
{ return __sync_fetch_and_add(&_M_i, __i); }
void
store(bool __i, memory_order __m = memory_order_seq_cst)
{ _M_base.store(__i, __m); }
__int_type
fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_sub(&_M_i, __i); }
bool
load(memory_order __m = memory_order_seq_cst) const
{ return _M_base.load(__m); }
__int_type
fetch_sub(__int_type __i,
memory_order __m = memory_order_seq_cst) volatile
{ return __sync_fetch_and_sub(&_M_i, __i); }
bool
exchange(bool __i, memory_order __m = memory_order_seq_cst)
{ return _M_base.exchange(__i, __m); }
__int_type
fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_and(&_M_i, __i); }
bool
compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
__int_type
fetch_and(__int_type __i,
memory_order __m = memory_order_seq_cst) volatile
{ return __sync_fetch_and_and(&_M_i, __i); }
bool
compare_exchange_weak(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m); }
__int_type
fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_or(&_M_i, __i); }
bool
compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
__int_type
fetch_or(__int_type __i,
memory_order __m = memory_order_seq_cst) volatile
{ return __sync_fetch_and_or(&_M_i, __i); }
__int_type
fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_xor(&_M_i, __i); }
bool
compare_exchange_strong(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m); }
};
__int_type
fetch_xor(__int_type __i,
memory_order __m = memory_order_seq_cst) volatile
{ return __sync_fetch_and_xor(&_M_i, __i); }
};
} // namespace __atomic2
// _GLIBCXX_END_NAMESPACE
_GLIBCXX_END_NAMESPACE
#endif
// -*- C++ -*- compatibility header.
// -*- C++ -*- header.
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -23,18 +23,21 @@
// <http://www.gnu.org/licenses/>.
/** @file bits/atomic_base.h
* This is a Standard C++ Library header.
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#include <bits/c++config.h>
#include <stddef.h>
#include <stdbool.h> // XXX need to define bool w/o stdbool.h in tr1/cstdbool
#ifndef _GLIBCXX_ATOMIC_BASE_H
#define _GLIBCXX_ATOMIC_BASE_H 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_BEGIN_EXTERN_C
/**
* @defgroup atomics Atomics
......@@ -54,15 +57,85 @@ _GLIBCXX_BEGIN_EXTERN_C
memory_order_seq_cst
} memory_order;
// Base for atomic_flag.
typedef struct __atomic_flag_base
inline memory_order
__calculate_memory_order(memory_order __m)
{
const bool __cond1 = __m == memory_order_release;
const bool __cond2 = __m == memory_order_acq_rel;
memory_order __mo1(__cond1 ? memory_order_relaxed : __m);
memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
return __mo2;
}
/// kill_dependency
template<typename _Tp>
inline _Tp
kill_dependency(_Tp __y)
{
_Tp ret(__y);
return ret;
}
/**
* @brief Base type for atomic_flag.
*
* Base type is POD with data, allowing atomic_flag to derive from
* it and meet the standard layout type requirement. In addition to
* compatibilty with a C interface, this allows different
* implementations of atomic_flag to use the same atomic operation
* functions, via a standard conversion to the __atomic_flag_base
* argument.
*/
_GLIBCXX_BEGIN_EXTERN_C
struct __atomic_flag_base
{
bool _M_i;
} __atomic_flag_base;
};
_GLIBCXX_END_EXTERN_C
#define ATOMIC_FLAG_INIT { false }
/// 29.2 Lock-free Property
// Base types for atomics.
//
// Three nested namespaces for atomic implementation details.
//
// The nested namespace inlined into std:: is determined by the value
// of the _GLIBCXX_ATOMIC_PROPERTY macro and the resulting
// ATOMIC_*_LOCK_FREE macros.
//
// 0 == __atomic0 == Never lock-free
// 1 == __atomic1 == Best available, sometimes lock-free
// 2 == __atomic2 == Always lock-free
namespace __atomic0
{
struct atomic_flag;
struct atomic_address;
template<typename _IntTp>
struct __atomic_base;
}
namespace __atomic2
{
struct atomic_flag;
struct atomic_address;
template<typename _IntTp>
struct __atomic_base;
}
namespace __atomic1
{
using __atomic2::atomic_flag;
using __atomic0::atomic_address;
using __atomic0::__atomic_base;
}
/// Lock-free Property
#if defined(_GLIBCXX_ATOMIC_BUILTINS_1) && defined(_GLIBCXX_ATOMIC_BUILTINS_2) \
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_ATOMIC_BUILTINS_8)
# define _GLIBCXX_ATOMIC_PROPERTY 2
......@@ -75,150 +148,143 @@ _GLIBCXX_BEGIN_EXTERN_C
# define _GLIBCXX_ATOMIC_NAMESPACE __atomic0
#endif
#define ATOMIC_INTEGRAL_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_CHAR_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_CHAR16_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_CHAR32_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_WCHAR_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_SHORT_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_INT_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_LONG_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_LLONG_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_ADDRESS_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
// Switch atomic integral base types based on C or C++. In
// addition, for "C" only provide type-generic macros for atomic
// operations. (As C++ accomplishes the same thing with sets of
// overloaded functions.
#ifdef __cplusplus
inline namespace _GLIBCXX_ATOMIC_NAMESPACE { }
# include <bits/atomicfwd_cxx.h>
#else
# include <bits/atomicfwd_c.h>
#endif
// Typedefs for other atomic integral types.
typedef atomic_schar atomic_int_least8_t;
typedef atomic_uchar atomic_uint_least8_t;
typedef atomic_short atomic_int_least16_t;
typedef atomic_ushort atomic_uint_least16_t;
typedef atomic_int atomic_int_least32_t;
typedef atomic_uint atomic_uint_least32_t;
typedef atomic_llong atomic_int_least64_t;
typedef atomic_ullong atomic_uint_least64_t;
typedef atomic_schar atomic_int_fast8_t;
typedef atomic_uchar atomic_uint_fast8_t;
typedef atomic_short atomic_int_fast16_t;
typedef atomic_ushort atomic_uint_fast16_t;
typedef atomic_int atomic_int_fast32_t;
typedef atomic_uint atomic_uint_fast32_t;
typedef atomic_llong atomic_int_fast64_t;
typedef atomic_ullong atomic_uint_fast64_t;
typedef atomic_long atomic_intptr_t;
typedef atomic_ulong atomic_uintptr_t;
typedef atomic_long atomic_ssize_t;
typedef atomic_ulong atomic_size_t;
typedef atomic_llong atomic_intmax_t;
typedef atomic_ullong atomic_uintmax_t;
typedef atomic_long atomic_ptrdiff_t;
// Accessor functions for base atomic_flag type.
bool
atomic_flag_test_and_set_explicit(__atomic_flag_base*, memory_order)
_GLIBCXX_NOTHROW;
inline bool
atomic_flag_test_and_set(__atomic_flag_base* __a)
{ return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
void
atomic_flag_clear_explicit(__atomic_flag_base*, memory_order)
_GLIBCXX_NOTHROW;
inline void
atomic_flag_clear(__atomic_flag_base* __a)
{ atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
void
__atomic_flag_wait_explicit(__atomic_flag_base*, memory_order)
_GLIBCXX_NOTHROW;
_GLIBCXX_CONST __atomic_flag_base*
__atomic_flag_for_address(const void* __z) _GLIBCXX_NOTHROW;
// Implementation specific defines.
#define _ATOMIC_LOAD_(__a, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_STORE_(__a, __m, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
*__p = __v; \
atomic_flag_clear_explicit(__g, __x); \
__v; })
#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
*__p __o __v; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__e) __q = (__e); \
__typeof__(__m) __v = (__m); \
bool __r; \
atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
if (__t__ == *__q) { *__p = __v; __r = true; } \
else { *__q = __t__; __r = false; } \
atomic_flag_clear_explicit(__g, __x); \
__r; })
/// 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;
/// atomic_char32_t
typedef __atomic_base<char32_t> atomic_char32_t;
/// atomic_int_least8_t
typedef __atomic_base<int_least8_t> atomic_int_least8_t;
/// atomic_uint_least8_t
typedef __atomic_base<uint_least8_t> atomic_uint_least8_t;
/// atomic_int_least16_t
typedef __atomic_base<int_least16_t> atomic_int_least16_t;
/// atomic_uint_least16_t
typedef __atomic_base<uint_least16_t> atomic_uint_least16_t;
/// atomic_int_least32_t
typedef __atomic_base<int_least32_t> atomic_int_least32_t;
/// atomic_uint_least32_t
typedef __atomic_base<uint_least32_t> atomic_uint_least32_t;
/// atomic_int_least64_t
typedef __atomic_base<int_least64_t> atomic_int_least64_t;
/// atomic_uint_least64_t
typedef __atomic_base<uint_least64_t> atomic_uint_least64_t;
/// atomic_int_fast8_t
typedef __atomic_base<int_fast8_t> atomic_int_fast8_t;
/// atomic_uint_fast8_t
typedef __atomic_base<uint_fast8_t> atomic_uint_fast8_t;
/// atomic_int_fast16_t
typedef __atomic_base<int_fast16_t> atomic_int_fast16_t;
/// atomic_uint_fast16_t
typedef __atomic_base<uint_fast16_t> atomic_uint_fast16_t;
/// atomic_int_fast32_t
typedef __atomic_base<int_fast32_t> atomic_int_fast32_t;
/// atomic_uint_fast32_t
typedef __atomic_base<uint_fast32_t> atomic_uint_fast32_t;
/// atomic_int_fast64_t
typedef __atomic_base<int_fast64_t> atomic_int_fast64_t;
/// atomic_uint_fast64_t
typedef __atomic_base<uint_fast64_t> atomic_uint_fast64_t;
/// atomic_intptr_t
typedef __atomic_base<intptr_t> atomic_intptr_t;
/// atomic_uintptr_t
typedef __atomic_base<uintptr_t> atomic_uintptr_t;
/// atomic_size_t
typedef __atomic_base<size_t> atomic_size_t;
/// atomic_intmax_t
typedef __atomic_base<intmax_t> atomic_intmax_t;
/// atomic_uintmax_t
typedef __atomic_base<uintmax_t> atomic_uintmax_t;
/// atomic_ptrdiff_t
typedef __atomic_base<ptrdiff_t> atomic_ptrdiff_t;
struct atomic_bool;
#define ATOMIC_VAR_INIT(_VI) { _VI }
template<typename _Tp>
struct atomic;
// @} group atomics
_GLIBCXX_END_EXTERN_C
_GLIBCXX_END_NAMESPACE
// Inject into global namespace.
#ifdef __cplusplus
#include <atomic>
using std::memory_order;
using std::memory_order_relaxed;
using std::memory_order_consume;
using std::memory_order_acquire;
using std::memory_order_release;
using std::memory_order_acq_rel;
using std::memory_order_seq_cst;
using std::atomic_flag;
using std::atomic_bool;
using std::atomic_char;
using std::atomic_schar;
using std::atomic_uchar;
using std::atomic_short;
using std::atomic_ushort;
using std::atomic_int;
using std::atomic_uint;
using std::atomic_long;
using std::atomic_ulong;
using std::atomic_llong;
using std::atomic_ullong;
using std::atomic_wchar_t;
using std::atomic_char16_t;
using std::atomic_char32_t;
using std::atomic_address;
using std::atomic;
#endif
#endif
// -*- 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 @@
// The current version of the C++ library in compressed ISO date format.
#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.
// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
// _GLIBCXX_VISIBILITY_ATTR
......@@ -60,33 +81,39 @@
# define _GLIBCXX_DEPRECATED_ATTR
#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.
#if __cplusplus
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
namespace std
{
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
typedef decltype(nullptr) nullptr_t;
#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
// Macros for activating various namespace association modes.
......@@ -106,7 +133,6 @@
namespace tr1 { }
}
*/
#if __cplusplus
#ifdef _GLIBCXX_DEBUG
# define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
......@@ -136,6 +162,7 @@
// _GLIBCXX_STD
// _GLIBCXX_STD_D
// _GLIBCXX_STD_P
// _GLIBCXX_STD_PR
//
// Macros for enclosing namespaces and possibly nested namespaces.
// _GLIBCXX_BEGIN_NAMESPACE
......@@ -283,19 +310,42 @@ namespace std
# define _GLIBCXX_END_LDBL_NAMESPACE
#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"
// linkage only when using C++.
# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
# define _GLIBCXX_END_EXTERN_C }
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
#endif
#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
#endif
#else // !__cplusplus
# define _GLIBCXX_BEGIN_EXTERN_C
# define _GLIBCXX_END_EXTERN_C
# undef _GLIBCXX_BEGIN_NAMESPACE
# undef _GLIBCXX_END_NAMESPACE
# define _GLIBCXX_BEGIN_NAMESPACE(X)
# define _GLIBCXX_END_NAMESPACE
# define _GLIBCXX_BEGIN_EXTERN_C
# define _GLIBCXX_END_EXTERN_C
#endif
// First includes.
......@@ -385,39 +435,4 @@ _GLIBCXX_END_NAMESPACE
#undef min
#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.
......@@ -92,11 +92,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
......@@ -118,23 +118,23 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
static char_type*
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)
{ return static_cast<char_type>(__c); }
static int_type
static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_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)
{ return __c1 == __c2; }
static int_type
static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
static int_type
static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }
};
......@@ -239,11 +239,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
......@@ -271,25 +271,25 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type* __s, size_t __n, char_type __a)
{ 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)
{ return static_cast<char_type>(__c); }
// To keep both the byte 0xff and the eof symbol 0xffffffff
// from ending up as 0xffffffff.
static int_type
static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __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)
{ return __c1 == __c2; }
static int_type
static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
static int_type
static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return (__c == eof()) ? 0 : __c; }
};
......@@ -310,11 +310,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
......@@ -342,23 +342,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type* __s, size_t __n, char_type __a)
{ return wmemset(__s, __a, __n); }
static char_type
static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c)
{ return char_type(__c); }
static int_type
static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c)
{ return int_type(__c); }
static bool
static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
static int_type
static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(WEOF); }
static int_type
static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; }
};
......@@ -386,11 +386,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
......@@ -445,23 +445,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return __s;
}
static char_type
static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c)
{ return char_type(__c); }
static int_type
static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c)
{ return int_type(__c); }
static bool
static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
static int_type
static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(-1); }
static int_type
static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; }
};
......@@ -479,11 +479,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
static _GLIBCXX_CONSTEXPR bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
......@@ -538,23 +538,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return __s;
}
static char_type
static _GLIBCXX_CONSTEXPR char_type
to_char_type(const int_type& __c)
{ return char_type(__c); }
static int_type
static _GLIBCXX_CONSTEXPR int_type
to_int_type(const char_type& __c)
{ return int_type(__c); }
static bool
static _GLIBCXX_CONSTEXPR bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
static int_type
static _GLIBCXX_CONSTEXPR int_type
eof()
{ return static_cast<int_type>(-1); }
static int_type
static _GLIBCXX_CONSTEXPR int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; }
};
......
......@@ -71,34 +71,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_ios_fmtflags_end = 1L << 16
};
inline _Ios_Fmtflags
inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __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)
{ 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)
{ 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)
{ return __a = __a | __b; }
inline _Ios_Fmtflags&
inline const _Ios_Fmtflags&
operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a & __b; }
inline _Ios_Fmtflags&
inline const _Ios_Fmtflags&
operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a ^ __b; }
inline _Ios_Fmtflags
operator~(_Ios_Fmtflags __a)
{ return _Ios_Fmtflags(~static_cast<int>(__a)); }
enum _Ios_Openmode
{
......@@ -111,34 +111,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_ios_openmode_end = 1L << 16
};
inline _Ios_Openmode
inline _GLIBCXX_CONSTEXPR _Ios_Openmode
operator&(_Ios_Openmode __a, _Ios_Openmode __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)
{ 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)
{ 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)
{ return __a = __a | __b; }
inline _Ios_Openmode&
inline const _Ios_Openmode&
operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a & __b; }
inline _Ios_Openmode&
inline const _Ios_Openmode&
operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a ^ __b; }
inline _Ios_Openmode
operator~(_Ios_Openmode __a)
{ return _Ios_Openmode(~static_cast<int>(__a)); }
enum _Ios_Iostate
{
......@@ -149,33 +149,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_ios_iostate_end = 1L << 16
};
inline _Ios_Iostate
inline _GLIBCXX_CONSTEXPR _Ios_Iostate
operator&(_Ios_Iostate __a, _Ios_Iostate __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)
{ 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)
{ 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)
{ return __a = __a | __b; }
inline _Ios_Iostate&
inline const _Ios_Iostate&
operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a & __b; }
inline _Ios_Iostate&
inline const _Ios_Iostate&
operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a ^ __b; }
inline _Ios_Iostate
operator~(_Ios_Iostate __a)
{ return _Ios_Iostate(~static_cast<int>(__a)); }
enum _Ios_Seekdir
{
......
......@@ -169,12 +169,12 @@ namespace std
typedef _UIntType result_type;
/** The multiplier. */
static const result_type multiplier = __a;
static constexpr result_type multiplier = __a;
/** An increment. */
static const result_type increment = __c;
static constexpr result_type increment = __c;
/** The modulus. */
static const result_type modulus = __m;
static const result_type default_seed = 1u;
static constexpr result_type modulus = __m;
static constexpr result_type default_seed = 1u;
/**
* @brief Constructs a %linear_congruential_engine random number
......@@ -225,26 +225,20 @@ namespace std
*
* The minimum depends on the @p __c parameter: if it is zero, the
* minimum generated must be > 0, otherwise 0 is allowed.
*
* @todo This should be constexpr.
*/
result_type
min() const
static constexpr result_type
min()
{ return __c == 0u ? 1u : 0u; }
/**
* @brief Gets the largest possible value in the output range.
*
* @todo This should be constexpr.
*/
result_type
max() const
static constexpr result_type
max()
{ return __m - 1u; }
/**
* @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
......@@ -402,20 +396,20 @@ namespace std
typedef _UIntType result_type;
// parameter values
static const size_t word_size = __w;
static const size_t state_size = __n;
static const size_t shift_size = __m;
static const size_t mask_bits = __r;
static const result_type xor_mask = __a;
static const size_t tempering_u = __u;
static const result_type tempering_d = __d;
static const size_t tempering_s = __s;
static const result_type tempering_b = __b;
static const size_t tempering_t = __t;
static const result_type tempering_c = __c;
static const size_t tempering_l = __l;
static const result_type initialization_multiplier = __f;
static const result_type default_seed = 5489u;
static constexpr size_t word_size = __w;
static constexpr size_t state_size = __n;
static constexpr size_t shift_size = __m;
static constexpr size_t mask_bits = __r;
static constexpr result_type xor_mask = __a;
static constexpr size_t tempering_u = __u;
static constexpr result_type tempering_d = __d;
static constexpr size_t tempering_s = __s;
static constexpr result_type tempering_b = __b;
static constexpr size_t tempering_t = __t;
static constexpr result_type tempering_c = __c;
static constexpr size_t tempering_l = __l;
static constexpr result_type initialization_multiplier = __f;
static constexpr result_type default_seed = 5489u;
// constructors and member function
explicit
......@@ -444,26 +438,20 @@ namespace std
/**
* @brief Gets the smallest possible value in the output range.
*
* @todo This should be constexpr.
*/
result_type
min() const
static constexpr result_type
min()
{ return 0; };
/**
* @brief Gets the largest possible value in the output range.
*
* @todo This should be constexpr.
*/
result_type
max() const
static constexpr result_type
max()
{ return __detail::_Shift<_UIntType, __w>::__value - 1; }
/**
* @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
......@@ -608,10 +596,10 @@ namespace std
typedef _UIntType result_type;
// parameter values
static const size_t word_size = __w;
static const size_t short_lag = __s;
static const size_t long_lag = __r;
static const result_type default_seed = 19780503u;
static constexpr size_t word_size = __w;
static constexpr size_t short_lag = __s;
static constexpr size_t long_lag = __r;
static constexpr result_type default_seed = 19780503u;
/**
* @brief Constructs an explicitly seeded % subtract_with_carry_engine
......@@ -660,27 +648,21 @@ namespace std
/**
* @brief Gets the inclusive minimum value of the range of random
* integers returned by this generator.
*
* @todo This should be constexpr.
*/
result_type
min() const
static constexpr result_type
min()
{ return 0; }
/**
* @brief Gets the inclusive maximum value of the range of random
* integers returned by this generator.
*
* @todo This should be constexpr.
*/
result_type
max() const
static constexpr result_type
max()
{ return __detail::_Shift<_UIntType, __w>::__value - 1; }
/**
* @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
......@@ -794,8 +776,8 @@ namespace std
typedef typename _RandomNumberEngine::result_type result_type;
// parameter values
static const size_t block_size = __p;
static const size_t used_block = __r;
static constexpr size_t block_size = __p;
static constexpr size_t used_block = __r;
/**
* @brief Constructs a default %discard_block_engine engine.
......@@ -894,26 +876,20 @@ namespace std
/**
* @brief Gets the minimum value in the generated random number range.
*
* @todo This should be constexpr.
*/
result_type
min() const
{ return _M_b.min(); }
static constexpr result_type
min()
{ return _RandomNumberEngine::min(); }
/**
* @brief Gets the maximum value in the generated random number range.
*
* @todo This should be constexpr.
*/
result_type
max() const
{ return _M_b.max(); }
static constexpr result_type
max()
{ return _RandomNumberEngine::max(); }
/**
* @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
......@@ -1109,26 +1085,20 @@ namespace std
/**
* @brief Gets the minimum value in the generated random number range.
*
* @todo This should be constexpr.
*/
result_type
min() const
static constexpr result_type
min()
{ return 0U; }
/**
* @brief Gets the maximum value in the generated random number range.
*
* @todo This should be constexpr.
*/
result_type
max() const
static constexpr result_type
max()
{ return __detail::_Shift<_UIntType, __w>::__value - 1; }
/**
* @brief Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
......@@ -1243,7 +1213,7 @@ namespace std
/** The type of the generated random value. */
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.
......@@ -1345,26 +1315,20 @@ namespace std
/**
* Gets the minimum value in the generated random number range.
*
* @todo This should be constexpr.
*/
result_type
min() const
{ return _M_b.min(); }
static constexpr result_type
min()
{ return _RandomNumberEngine::min(); }
/**
* Gets the maximum value in the generated random number range.
*
* @todo This should be constexpr.
*/
result_type
max() const
{ return _M_b.max(); }
static constexpr result_type
max()
{ return _RandomNumberEngine::max(); }
/**
* Discard a sequence of random numbers.
*
* @todo Look for a faster way to do discard.
*/
void
discard(unsigned long long __z)
......@@ -1617,7 +1581,7 @@ namespace std
*/
/**
* @addtogroup random_distributions_uniform Uniform
* @addtogroup random_distributions_uniform Uniform Distributions
* @ingroup random_distributions
* @{
*/
......@@ -1975,7 +1939,7 @@ namespace std
/* @} */ // group random_distributions_uniform
/**
* @addtogroup random_distributions_normal Normal
* @addtogroup random_distributions_normal Normal Distributions
* @ingroup random_distributions
* @{
*/
......@@ -3229,7 +3193,7 @@ namespace std
/* @} */ // group random_distributions_normal
/**
* @addtogroup random_distributions_bernoulli Bernoulli
* @addtogroup random_distributions_bernoulli Bernoulli Distributions
* @ingroup random_distributions
* @{
*/
......@@ -3960,7 +3924,7 @@ namespace std
/* @} */ // group random_distributions_bernoulli
/**
* @addtogroup random_distributions_poisson Poisson
* @addtogroup random_distributions_poisson Poisson Distributions
* @ingroup random_distributions
* @{
*/
......
......@@ -104,19 +104,19 @@ namespace std
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType
constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType
constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::increment;
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType
constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::modulus;
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
const _UIntType
constexpr _UIntType
linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
/**
......@@ -205,7 +205,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const size_t
constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::word_size;
......@@ -214,7 +214,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const size_t
constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::state_size;
......@@ -223,7 +223,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const size_t
constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::shift_size;
......@@ -232,7 +232,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const size_t
constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::mask_bits;
......@@ -241,7 +241,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const _UIntType
constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::xor_mask;
......@@ -250,7 +250,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const size_t
constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_u;
......@@ -259,7 +259,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const _UIntType
constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_d;
......@@ -268,7 +268,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const size_t
constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_s;
......@@ -277,7 +277,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const _UIntType
constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_b;
......@@ -286,7 +286,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const size_t
constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_t;
......@@ -295,7 +295,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const _UIntType
constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_c;
......@@ -304,7 +304,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const size_t
constexpr size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::tempering_l;
......@@ -313,7 +313,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const _UIntType
constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::
initialization_multiplier;
......@@ -323,7 +323,7 @@ namespace std
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l,
_UIntType __f>
const _UIntType
constexpr _UIntType
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
__s, __b, __t, __c, __l, __f>::default_seed;
......@@ -500,19 +500,19 @@ namespace std
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;
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;
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;
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;
template<typename _UIntType, size_t __w, size_t __s, size_t __r>
......@@ -651,11 +651,11 @@ namespace std
template<typename _RandomNumberEngine, size_t __p, size_t __r>
const size_t
constexpr size_t
discard_block_engine<_RandomNumberEngine, __p, __r>::block_size;
template<typename _RandomNumberEngine, size_t __p, size_t __r>
const size_t
constexpr size_t
discard_block_engine<_RandomNumberEngine, __p, __r>::used_block;
template<typename _RandomNumberEngine, size_t __p, size_t __r>
......@@ -761,7 +761,7 @@ namespace std
template<typename _RandomNumberEngine, size_t __k>
const size_t
constexpr size_t
shuffle_order_engine<_RandomNumberEngine, __k>::table_size;
template<typename _RandomNumberEngine, size_t __k>
......
......@@ -349,28 +349,27 @@ namespace std
/**
* @name Constants
* 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;
static const regex_constants::syntax_option_type nosubs
static constexpr regex_constants::syntax_option_type nosubs
= regex_constants::nosubs;
static const regex_constants::syntax_option_type optimize
static constexpr regex_constants::syntax_option_type optimize
= regex_constants::optimize;
static const regex_constants::syntax_option_type collate
static constexpr regex_constants::syntax_option_type collate
= regex_constants::collate;
static const regex_constants::syntax_option_type ECMAScript
static constexpr regex_constants::syntax_option_type ECMAScript
= regex_constants::ECMAScript;
static const regex_constants::syntax_option_type basic
static constexpr regex_constants::syntax_option_type basic
= regex_constants::basic;
static const regex_constants::syntax_option_type extended
static constexpr regex_constants::syntax_option_type extended
= regex_constants::extended;
static const regex_constants::syntax_option_type awk
static constexpr regex_constants::syntax_option_type awk
= regex_constants::awk;
static const regex_constants::syntax_option_type grep
static constexpr regex_constants::syntax_option_type grep
= regex_constants::grep;
static const regex_constants::syntax_option_type egrep
static constexpr regex_constants::syntax_option_type egrep
= regex_constants::egrep;
//@}
......
......@@ -709,7 +709,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef typename __traits_type::reference reference;
typedef typename __traits_type::pointer pointer;
__normal_iterator() : _M_current(_Iterator()) { }
_GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { }
explicit
__normal_iterator(const _Iterator& __i) : _M_current(__i) { }
......
......@@ -66,10 +66,11 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/// piecewise_construct_t
struct piecewise_construct_t { };
static const piecewise_construct_t piecewise_construct
= piecewise_construct_t();
/// piecewise_construct
constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
// forward declarations
template<typename...>
......@@ -93,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// 265. std::pair::pair() effects overly restrictive
/** The default constructor creates @c first and @c second using their
* respective default constructors. */
pair()
_GLIBCXX_CONSTEXPR pair()
: first(), second() { }
/** Two objects may be passed to a @c pair constructor to be copied. */
......
// 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
// software; you can redistribute it and/or modify it under the
......@@ -59,7 +59,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
public:
/// Construct end of input stream iterator.
istream_iterator()
_GLIBCXX_CONSTEXPR istream_iterator()
: _M_stream(0), _M_value(), _M_ok(false) {}
/// Construct start of input stream iterator.
......
// Streambuf iterators
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
// 2006, 2007, 2009
// 2006, 2007, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
public:
/// Construct end of input stream iterator.
istreambuf_iterator() throw()
_GLIBCXX_CONSTEXPR istreambuf_iterator() throw()
: _M_sbuf(0), _M_c(traits_type::eof()) { }
/// Construct start of input stream iterator.
......
......@@ -44,7 +44,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*/
/// Primary template, default_delete.
template<typename _Tp>
template<typename _Tp>
struct default_delete
{
default_delete() { }
......@@ -65,7 +65,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 740 - omit specialization for array objects with a compile time length
/// Specialization, default_delete.
template<typename _Tp>
template<typename _Tp>
struct default_delete<_Tp[]>
{
void
......@@ -78,11 +78,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
};
/// 20.7.12.2 unique_ptr for single objects.
template <typename _Tp, typename _Dp = default_delete<_Tp> >
template <typename _Tp, typename _Dp = default_delete<_Tp> >
class unique_ptr
{
typedef std::tuple<_Tp*, _Dp> __tuple_type;
// use SFINAE to determine whether _Del::pointer exists
class _Pointer
{
......@@ -95,19 +93,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename remove_reference<_Dp>::type _Del;
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:
typedef typename _Pointer::type pointer;
typedef _Tp element_type;
typedef _Dp deleter_type;
static_assert(!std::is_pointer<deleter_type>::value,
"constructed with null function pointer deleter");
// Constructors.
unique_ptr()
: _M_t(pointer(), deleter_type())
{ static_assert(!std::is_pointer<deleter_type>::value,
"constructed with null function pointer deleter"); }
{ }
explicit
unique_ptr(pointer __p)
......@@ -116,14 +119,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
"constructed with null function pointer deleter"); }
unique_ptr(pointer __p,
typename std::conditional<std::is_reference<deleter_type>::value,
deleter_type, const deleter_type&>::type __d)
typename std::conditional<std::is_reference<deleter_type>::value,
deleter_type, const deleter_type&>::type __d)
: _M_t(__p, __d) { }
unique_ptr(pointer __p,
typename std::remove_reference<deleter_type>::type&& __d)
typename std::remove_reference<deleter_type>::type&& __d)
: _M_t(std::move(__p), std::move(__d))
{ static_assert(!std::is_reference<deleter_type>::value,
{ static_assert(!std::is_reference<deleter_type>::value,
"rvalue deleter bound to reference"); }
unique_ptr(nullptr_t)
......@@ -131,7 +134,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ }
// Move constructors.
unique_ptr(unique_ptr&& __u)
unique_ptr(unique_ptr&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
template<typename _Up, typename _Ep, typename = typename
......@@ -143,9 +146,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
&& std::is_same<_Ep, _Dp>::value)
|| (!std::is_reference<_Dp>::value
&& std::is_convertible<_Ep, _Dp>::value))>
::type>
unique_ptr(unique_ptr<_Up, _Ep>&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
::type>
unique_ptr(unique_ptr<_Up, _Ep>&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
{ }
#if _GLIBCXX_DEPRECATED
......@@ -153,7 +156,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
std::enable_if<std::is_convertible<_Up*, _Tp*>::value
&& std::is_same<_Dp,
default_delete<_Tp>>::value>::type>
unique_ptr(auto_ptr<_Up>&& __u)
unique_ptr(auto_ptr<_Up>&& __u)
: _M_t(__u.release(), deleter_type()) { }
#endif
......@@ -163,24 +166,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Assignment.
unique_ptr&
operator=(unique_ptr&& __u)
{
reset(__u.release());
get_deleter() = std::move(__u.get_deleter());
return *this;
{
reset(__u.release());
get_deleter() = std::move(__u.get_deleter());
return *this;
}
template<typename _Up, typename _Ep, typename = typename
std::enable_if
std::enable_if
<std::is_convertible<typename unique_ptr<_Up, _Ep>::pointer,
pointer>::value
&& !std::is_array<_Up>::value>::type>
unique_ptr&
operator=(unique_ptr<_Up, _Ep>&& __u)
&& !std::is_array<_Up>::value>::type>
unique_ptr&
operator=(unique_ptr<_Up, _Ep>&& __u)
{
reset(__u.release());
get_deleter() = std::move(__u.get_deleter());
return *this;
}
reset(__u.release());
get_deleter() = std::move(__u.get_deleter());
return *this;
}
unique_ptr&
operator=(nullptr_t)
......@@ -221,7 +224,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Modifiers.
pointer
release()
release()
{
pointer __p = get();
std::get<0>(_M_t) = pointer();
......@@ -247,11 +250,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Disable copy from lvalue.
unique_ptr(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
// [unique.ptr.runtime]
// _GLIBCXX_RESOLVE_LIB_DEFECTS
......@@ -259,34 +259,36 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp, typename _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:
typedef _Tp* pointer;
typedef _Tp element_type;
typedef _Dp deleter_type;
typedef _Tp* pointer;
typedef _Tp element_type;
typedef _Dp deleter_type;
static_assert(!std::is_pointer<deleter_type>::value,
"constructed with null function pointer deleter");
// Constructors.
unique_ptr()
: _M_t(pointer(), deleter_type())
{ static_assert(!std::is_pointer<deleter_type>::value,
"constructed with null function pointer deleter"); }
{ }
explicit
unique_ptr(pointer __p)
: _M_t(__p, deleter_type())
{ static_assert(!std::is_pointer<deleter_type>::value,
"constructed with null function pointer deleter"); }
{ }
unique_ptr(pointer __p,
typename std::conditional<std::is_reference<deleter_type>::value,
deleter_type, const deleter_type&>::type __d)
typename std::conditional<std::is_reference<deleter_type>::value,
deleter_type, const deleter_type&>::type __d)
: _M_t(__p, __d) { }
unique_ptr(pointer __p,
typename std::remove_reference<deleter_type>::type && __d)
: _M_t(std::move(__p), std::move(__d))
{ static_assert(!std::is_reference<deleter_type>::value,
{ static_assert(!std::is_reference<deleter_type>::value,
"rvalue deleter bound to reference"); }
/* TODO: use delegating constructor */
......@@ -295,11 +297,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ }
// Move constructors.
unique_ptr(unique_ptr&& __u)
unique_ptr(unique_ptr&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
template<typename _Up, typename _Ep>
unique_ptr(unique_ptr<_Up, _Ep>&& __u)
template<typename _Up, typename _Ep>
unique_ptr(unique_ptr<_Up, _Ep>&& __u)
: _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
{ }
......@@ -311,18 +313,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
operator=(unique_ptr&& __u)
{
reset(__u.release());
get_deleter() = std::move(__u.get_deleter());
return *this;
get_deleter() = std::move(__u.get_deleter());
return *this;
}
template<typename _Up, typename _Ep>
unique_ptr&
operator=(unique_ptr<_Up, _Ep>&& __u)
template<typename _Up, typename _Ep>
unique_ptr&
operator=(unique_ptr<_Up, _Ep>&& __u)
{
reset(__u.release());
get_deleter() = std::move(__u.get_deleter());
return *this;
}
reset(__u.release());
get_deleter() = std::move(__u.get_deleter());
return *this;
}
unique_ptr&
operator=(nullptr_t)
......@@ -332,8 +334,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
// Observers.
typename std::add_lvalue_reference<element_type>::type
operator[](size_t __i) const
typename std::add_lvalue_reference<element_type>::type
operator[](size_t __i) const
{
_GLIBCXX_DEBUG_ASSERT(get() != pointer());
return get()[__i];
......@@ -343,20 +345,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
get() const
{ return std::get<0>(_M_t); }
deleter_type&
deleter_type&
get_deleter()
{ return std::get<1>(_M_t); }
const deleter_type&
get_deleter() const
{ return std::get<1>(_M_t); }
{ return std::get<1>(_M_t); }
explicit operator bool() const
explicit operator bool() const
{ return get() == pointer() ? false : true; }
// Modifiers.
pointer
release()
release()
{
pointer __p = get();
std::get<0>(_M_t) = pointer();
......@@ -364,7 +366,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
void
reset(pointer __p = pointer())
reset(pointer __p = pointer())
{
using std::swap;
swap(std::get<0>(_M_t), __p);
......@@ -383,7 +385,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// DR 821.
template<typename _Up>
void reset(_Up) = delete;
void reset(_Up) = delete;
void
swap(unique_ptr& __u)
......@@ -399,27 +401,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Disable construction from convertible pointer types.
// (N2315 - 20.6.5.3.1)
template<typename _Up>
unique_ptr(_Up*, typename
unique_ptr(_Up*, typename
std::conditional<std::is_reference<deleter_type>::value,
deleter_type, const deleter_type&>::type,
typename std::enable_if<std::is_convertible<_Up*,
typename std::enable_if<std::is_convertible<_Up*,
pointer>::value>::type* = 0) = delete;
template<typename _Up>
unique_ptr(_Up*, typename std::remove_reference<deleter_type>::type&&,
typename std::enable_if<std::is_convertible<_Up*,
unique_ptr(_Up*, typename std::remove_reference<deleter_type>::type&&,
typename std::enable_if<std::is_convertible<_Up*,
pointer>::value>::type* = 0) = delete;
template<typename _Up>
explicit
unique_ptr(_Up*, typename std::enable_if<std::is_convertible<_Up*,
explicit
unique_ptr(_Up*, typename std::enable_if<std::is_convertible<_Up*,
pointer>::value>::type* = 0) = delete;
private:
__tuple_type _M_t;
};
template<typename _Tp, typename _Dp>
template<typename _Tp, typename _Dp>
inline void
swap(unique_ptr<_Tp, _Dp>& __x,
unique_ptr<_Tp, _Dp>& __y)
......
// -*- 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
......@@ -38,8 +38,9 @@
# include <bits/c++0x_warning.h>
#endif
#include <bits/c++config.h>
#include <bits/atomic_base.h>
#include <bits/atomic_0.h>
#include <bits/atomic_2.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
......@@ -48,37 +49,103 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @{
*/
/// kill_dependency
template<typename _Tp>
inline _Tp
kill_dependency(_Tp __y)
{
_Tp ret(__y);
return ret;
}
inline memory_order
__calculate_memory_order(memory_order __m)
/// atomic_bool
// NB: No operators or fetch-operations for this type.
struct atomic_bool
{
const bool __cond1 = __m == memory_order_release;
const bool __cond2 = __m == memory_order_acq_rel;
memory_order __mo1(__cond1 ? memory_order_relaxed : __m);
memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
return __mo2;
}
private:
__atomic_base<bool> _M_base;
public:
atomic_bool() = default;
~atomic_bool() = default;
atomic_bool(const atomic_bool&) = delete;
atomic_bool& operator=(const atomic_bool&) = delete;
atomic_bool& operator=(const atomic_bool&) volatile = delete;
constexpr atomic_bool(bool __i) : _M_base(__i) { }
bool
operator=(bool __i)
{ return _M_base.operator=(__i); }
operator bool() const
{ return _M_base.load(); }
operator bool() const volatile
{ return _M_base.load(); }
bool
is_lock_free() const { return _M_base.is_lock_free(); }
bool
is_lock_free() const volatile { return _M_base.is_lock_free(); }
void
store(bool __i, memory_order __m = memory_order_seq_cst)
{ _M_base.store(__i, __m); }
void
store(bool __i, memory_order __m = memory_order_seq_cst) volatile
{ _M_base.store(__i, __m); }
bool
load(memory_order __m = memory_order_seq_cst) const
{ return _M_base.load(__m); }
bool
load(memory_order __m = memory_order_seq_cst) const volatile
{ return _M_base.load(__m); }
bool
exchange(bool __i, memory_order __m = memory_order_seq_cst)
{ return _M_base.exchange(__i, __m); }
bool
exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile
{ return _M_base.exchange(__i, __m); }
bool
compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
bool
compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2) volatile
{ return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
bool
compare_exchange_weak(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m); }
bool
compare_exchange_weak(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst) volatile
{ return _M_base.compare_exchange_weak(__i1, __i2, __m); }
bool
compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
bool
compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2) volatile
{ return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
bool
compare_exchange_strong(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m); }
bool
compare_exchange_strong(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst) volatile
{ return _M_base.compare_exchange_strong(__i1, __i2, __m); }
};
//
// Three nested namespaces for atomic implementation details.
//
// The nested namespace inlined into std:: is determined by the value
// of the _GLIBCXX_ATOMIC_PROPERTY macro and the resulting
// ATOMIC_*_LOCK_FREE macros. See file atomic_base.h.
//
// 0 == __atomic0 == Never lock-free
// 1 == __atomic1 == Best available, sometimes lock-free
// 2 == __atomic2 == Always lock-free
#include <bits/atomic_0.h>
#include <bits/atomic_2.h>
/// atomic
/// 29.4.3, Generic atomic type, primary class template.
......@@ -92,38 +159,68 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(_Tp __i) : _M_i(__i) { }
constexpr atomic(_Tp __i) : _M_i(__i) { }
operator _Tp() const;
operator _Tp() const volatile;
_Tp
operator=(_Tp __i) { store(__i); return __i; }
_Tp
operator=(_Tp __i) volatile { store(__i); return __i; }
bool
is_lock_free() const;
bool
is_lock_free() const volatile;
void
store(_Tp, memory_order = memory_order_seq_cst);
void
store(_Tp, memory_order = memory_order_seq_cst) volatile;
_Tp
load(memory_order = memory_order_seq_cst) const;
_Tp
load(memory_order = memory_order_seq_cst) const volatile;
_Tp
exchange(_Tp __i, memory_order = memory_order_seq_cst);
_Tp
exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile;
bool
compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order);
bool
compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile;
bool
compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile;
compare_exchange_weak(_Tp&, _Tp, memory_order = memory_order_seq_cst);
bool
compare_exchange_weak(_Tp&, _Tp,
memory_order = memory_order_seq_cst) volatile;
bool
compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order);
bool
compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile;
bool
compare_exchange_strong(_Tp&, _Tp, memory_order = memory_order_seq_cst);
bool
compare_exchange_strong(_Tp&, _Tp,
memory_order = memory_order_seq_cst) volatile;
};
......@@ -138,41 +235,70 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(_Tp* __v) : atomic_address(__v) { }
constexpr atomic(_Tp* __v) : atomic_address(__v) { }
void
store(_Tp*, memory_order = memory_order_seq_cst);
void
store(_Tp* __v, memory_order __m = memory_order_seq_cst)
{ atomic_address::store(__v, __m); }
store(_Tp*, memory_order = memory_order_seq_cst) volatile;
_Tp*
load(memory_order __m = memory_order_seq_cst) const
{ return static_cast<_Tp*>(atomic_address::load(__m)); }
load(memory_order = memory_order_seq_cst) const;
_Tp*
exchange(_Tp* __v, memory_order __m = memory_order_seq_cst)
{ return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
load(memory_order = memory_order_seq_cst) const volatile;
_Tp*
exchange(_Tp*, memory_order = memory_order_seq_cst);
_Tp*
exchange(_Tp*, memory_order = memory_order_seq_cst) volatile;
bool
compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order);
bool
compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order);
compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order) volatile;
bool
compare_exchange_weak(_Tp*&, _Tp*, memory_order = memory_order_seq_cst);
bool
compare_exchange_weak(_Tp*&, _Tp*,
memory_order = memory_order_seq_cst) volatile;
bool
compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order);
bool
compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order) volatile;
bool
compare_exchange_strong(_Tp*&, _Tp*, memory_order = memory_order_seq_cst);
bool
compare_exchange_strong(_Tp*&, _Tp*,
memory_order = memory_order_seq_cst) volatile;
_Tp*
fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst);
_Tp*
fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
_Tp*
fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst);
_Tp*
fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
operator _Tp*() const
{ return load(); }
operator _Tp*() const volatile
{ return load(); }
_Tp*
operator=(_Tp* __v)
{
......@@ -181,43 +307,51 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
_Tp*
operator=(_Tp* __v) volatile
{
store(__v);
return __v;
}
_Tp*
operator++(int) { return fetch_add(1); }
_Tp*
operator++(int) volatile { return fetch_add(1); }
_Tp*
operator--(int) { return fetch_sub(1); }
_Tp*
operator--(int) volatile { return fetch_sub(1); }
_Tp*
operator++() { return fetch_add(1) + 1; }
_Tp*
operator++() volatile { return fetch_add(1) + 1; }
_Tp*
operator--() { return fetch_sub(1) - 1; }
_Tp*
operator--() volatile { return fetch_sub(1) - 1; }
_Tp*
operator+=(ptrdiff_t __d)
{ return fetch_add(__d) + __d; }
_Tp*
operator+=(ptrdiff_t __d) volatile
{ return fetch_add(__d) + __d; }
_Tp*
operator-=(ptrdiff_t __d)
{ return fetch_sub(__d) - __d; }
};
/// Explicit specialization for void*
template<>
struct atomic<void*> : public atomic_address
{
typedef void* __integral_type;
typedef atomic_address __base_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
_Tp*
operator-=(ptrdiff_t __d) volatile
{ return fetch_sub(__d) - __d; }
};
/// Explicit specialization for bool.
......@@ -230,9 +364,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -248,9 +383,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -266,9 +402,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -284,9 +421,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -302,9 +440,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -320,9 +459,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -338,9 +478,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -356,9 +497,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -374,9 +516,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -392,9 +535,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -410,9 +554,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -428,9 +573,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -446,9 +592,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -464,9 +611,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
......@@ -482,14 +630,36 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
constexpr atomic(__integral_type __i) : __base_type(__i) { }
using __base_type::operator __integral_type;
using __base_type::operator=;
};
template<typename _Tp>
_Tp*
atomic<_Tp*>::load(memory_order __m) const
{ return static_cast<_Tp*>(atomic_address::load(__m)); }
template<typename _Tp>
_Tp*
atomic<_Tp*>::load(memory_order __m) const volatile
{ return static_cast<_Tp*>(atomic_address::load(__m)); }
template<typename _Tp>
_Tp*
atomic<_Tp*>::exchange(_Tp* __v, memory_order __m)
{ return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
template<typename _Tp>
_Tp*
atomic<_Tp*>::exchange(_Tp* __v, memory_order __m) volatile
{ return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1,
......@@ -502,6 +672,33 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1,
memory_order __m2) volatile
{
void** __vr = reinterpret_cast<void**>(&__r);
void* __vv = static_cast<void*>(__v);
return atomic_address::compare_exchange_weak(*__vr, __vv, __m1, __m2);
}
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m)
{
return compare_exchange_weak(__r, __v, __m,
__calculate_memory_order(__m));
}
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v,
memory_order __m) volatile
{
return compare_exchange_weak(__r, __v, __m,
__calculate_memory_order(__m));
}
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
memory_order __m1,
memory_order __m2)
......@@ -513,17 +710,28 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v,
memory_order __m)
atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
memory_order __m1,
memory_order __m2) volatile
{
return compare_exchange_weak(__r, __v, __m,
__calculate_memory_order(__m));
void** __vr = reinterpret_cast<void**>(&__r);
void* __vv = static_cast<void*>(__v);
return atomic_address::compare_exchange_strong(*__vr, __vv, __m1, __m2);
}
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
memory_order __m)
{
return compare_exchange_strong(__r, __v, __m,
__calculate_memory_order(__m));
}
template<typename _Tp>
bool
atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
memory_order __m)
memory_order __m) volatile
{
return compare_exchange_strong(__r, __v, __m,
__calculate_memory_order(__m));
......@@ -539,50 +747,141 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
_Tp*
atomic<_Tp*>::fetch_add(ptrdiff_t __d, memory_order __m) volatile
{
void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __d, __m);
return static_cast<_Tp*>(__p);
}
template<typename _Tp>
_Tp*
atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m)
{
void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m);
return static_cast<_Tp*>(__p);
}
// Convenience function definitions, atomic_flag.
template<typename _Tp>
_Tp*
atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m) volatile
{
void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m);
return static_cast<_Tp*>(__p);
}
// Function definitions, atomic_flag operations.
inline bool
atomic_flag_test_and_set_explicit(atomic_flag* __a, memory_order __m)
{ return __a->test_and_set(__m); }
inline bool
atomic_flag_test_and_set_explicit(volatile atomic_flag* __a,
memory_order __m)
{ return __a->test_and_set(__m); }
inline void
atomic_flag_clear_explicit(atomic_flag* __a, memory_order __m)
{ return __a->clear(__m); }
{ __a->clear(__m); }
inline void
atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m)
{ __a->clear(__m); }
inline bool
atomic_flag_test_and_set(atomic_flag* __a)
{ return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
// Convenience function definitions, atomic_address.
inline bool
atomic_flag_test_and_set(volatile atomic_flag* __a)
{ return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
inline void
atomic_flag_clear(atomic_flag* __a)
{ atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
inline void
atomic_flag_clear(volatile atomic_flag* __a)
{ atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
// Function definitions, atomic_address operations.
inline bool
atomic_is_lock_free(const atomic_address* __a)
{ return __a->is_lock_free(); }
inline bool
atomic_is_lock_free(const volatile atomic_address* __a)
{ return __a->is_lock_free(); }
inline void
atomic_init(atomic_address* __a, void* __v);
inline void
atomic_init(volatile atomic_address* __a, void* __v);
inline void
atomic_store_explicit(atomic_address* __a, void* __v, memory_order __m)
{ __a->store(__v, __m); }
inline void
atomic_store_explicit(volatile atomic_address* __a, void* __v,
memory_order __m)
{ __a->store(__v, __m); }
inline void
atomic_store(atomic_address* __a, void* __v)
{ __a->store(__v); }
inline void
atomic_store_explicit(atomic_address* __a, void* __v, memory_order __m)
{ __a->store(__v, __m); }
atomic_store(volatile atomic_address* __a, void* __v)
{ __a->store(__v); }
inline void*
atomic_load_explicit(const atomic_address* __a, memory_order __m)
{ return __a->load(__m); }
inline void*
atomic_load_explicit(const volatile atomic_address* __a, memory_order __m)
{ return __a->load(__m); }
inline void*
atomic_load(const atomic_address* __a)
{ return __a->load(); }
inline void*
atomic_load_explicit(const atomic_address* __a, memory_order __m)
{ return __a->load(__m); }
atomic_load(const volatile atomic_address* __a)
{ return __a->load(); }
inline void*
atomic_exchange_explicit(atomic_address* __a, void* __v, memory_order __m)
{ return __a->exchange(__v, __m); }
inline void*
atomic_exchange_explicit(volatile atomic_address* __a, void* __v,
memory_order __m)
{ return __a->exchange(__v, __m); }
inline void*
atomic_exchange(atomic_address* __a, void* __v)
{ return __a->exchange(__v); }
inline void*
atomic_exchange_explicit(atomic_address* __a, void* __v, memory_order __m)
{ return __a->exchange(__v, __m); }
atomic_exchange(volatile atomic_address* __a, void* __v)
{ return __a->exchange(__v); }
inline bool
atomic_compare_exchange_weak_explicit(atomic_address* __a,
void** __v1, void* __v2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
inline bool
atomic_compare_exchange_weak_explicit(volatile atomic_address* __a,
void** __v1, void* __v2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
inline bool
atomic_compare_exchange_weak(atomic_address* __a, void** __v1, void* __v2)
......@@ -592,72 +891,152 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
inline bool
atomic_compare_exchange_strong(atomic_address* __a,
void** __v1, void* __v2)
atomic_compare_exchange_weak(volatile atomic_address* __a, void** __v1,
void* __v2)
{
return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
return __a->compare_exchange_weak(*__v1, __v2, memory_order_seq_cst,
memory_order_seq_cst);
}
inline bool
atomic_compare_exchange_weak_explicit(atomic_address* __a,
void** __v1, void* __v2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
atomic_compare_exchange_strong_explicit(atomic_address* __a,
void** __v1, void* __v2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); }
inline bool
atomic_compare_exchange_strong_explicit(atomic_address* __a,
atomic_compare_exchange_strong_explicit(volatile atomic_address* __a,
void** __v1, void* __v2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); }
inline bool
atomic_compare_exchange_strong(atomic_address* __a, void** __v1, void* __v2)
{
return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
memory_order_seq_cst);
}
inline bool
atomic_compare_exchange_strong(volatile atomic_address* __a,
void** __v1, void* __v2)
{
return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
memory_order_seq_cst);
}
inline void*
atomic_fetch_add_explicit(atomic_address* __a, ptrdiff_t __d,
memory_order __m)
{ return __a->fetch_add(__d, __m); }
inline void*
atomic_fetch_add_explicit(volatile atomic_address* __a, ptrdiff_t __d,
memory_order __m)
{ return __a->fetch_add(__d, __m); }
inline void*
atomic_fetch_add(atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_add(__d); }
inline void*
atomic_fetch_add(volatile atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_add(__d); }
inline void*
atomic_fetch_sub_explicit(atomic_address* __a, ptrdiff_t __d,
memory_order __m)
{ return __a->fetch_sub(__d, __m); }
inline void*
atomic_fetch_sub_explicit(volatile atomic_address* __a, ptrdiff_t __d,
memory_order __m)
{ return __a->fetch_sub(__d, __m); }
inline void*
atomic_fetch_sub(atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_sub(__d); }
inline void*
atomic_fetch_sub(volatile atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_sub(__d); }
// Convenience function definitions, atomic_bool.
// Function definitions, atomic_bool operations.
inline bool
atomic_is_lock_free(const atomic_bool* __a)
{ return __a->is_lock_free(); }
inline bool
atomic_is_lock_free(const volatile atomic_bool* __a)
{ return __a->is_lock_free(); }
inline void
atomic_init(atomic_bool* __a, bool __b);
inline void
atomic_init(volatile atomic_bool* __a, bool __b);
inline void
atomic_store_explicit(atomic_bool* __a, bool __i, memory_order __m)
{ __a->store(__i, __m); }
inline void
atomic_store_explicit(volatile atomic_bool* __a, bool __i, memory_order __m)
{ __a->store(__i, __m); }
inline void
atomic_store(atomic_bool* __a, bool __i)
{ __a->store(__i); }
inline void
atomic_store_explicit(atomic_bool* __a, bool __i, memory_order __m)
{ __a->store(__i, __m); }
atomic_store(volatile atomic_bool* __a, bool __i)
{ __a->store(__i); }
inline bool
atomic_load_explicit(const atomic_bool* __a, memory_order __m)
{ return __a->load(__m); }
inline bool
atomic_load_explicit(const volatile atomic_bool* __a, memory_order __m)
{ return __a->load(__m); }
inline bool
atomic_load(const atomic_bool* __a)
{ return __a->load(); }
inline bool
atomic_load_explicit(const atomic_bool* __a, memory_order __m)
{ return __a->load(__m); }
atomic_load(const volatile atomic_bool* __a)
{ return __a->load(); }
inline bool
atomic_exchange_explicit(atomic_bool* __a, bool __i, memory_order __m)
{ return __a->exchange(__i, __m); }
inline bool
atomic_exchange_explicit(volatile atomic_bool* __a, bool __i,
memory_order __m)
{ return __a->exchange(__i, __m); }
inline bool
atomic_exchange(atomic_bool* __a, bool __i)
{ return __a->exchange(__i); }
inline bool
atomic_exchange_explicit(atomic_bool* __a, bool __i, memory_order __m)
{ return __a->exchange(__i, __m); }
atomic_exchange(volatile atomic_bool* __a, bool __i)
{ return __a->exchange(__i); }
inline bool
atomic_compare_exchange_weak_explicit(atomic_bool* __a, bool* __i1,
bool __i2, memory_order __m1,
memory_order __m2)
{ return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
inline bool
atomic_compare_exchange_weak_explicit(volatile atomic_bool* __a, bool* __i1,
bool __i2, memory_order __m1,
memory_order __m2)
{ return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
inline bool
atomic_compare_exchange_weak(atomic_bool* __a, bool* __i1, bool __i2)
......@@ -667,45 +1046,96 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
inline bool
atomic_compare_exchange_strong(atomic_bool* __a, bool* __i1, bool __i2)
atomic_compare_exchange_weak(volatile atomic_bool* __a, bool* __i1, bool __i2)
{
return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
memory_order_seq_cst);
return __a->compare_exchange_weak(*__i1, __i2, memory_order_seq_cst,
memory_order_seq_cst);
}
inline bool
atomic_compare_exchange_weak_explicit(atomic_bool* __a, bool* __i1,
bool __i2, memory_order __m1,
memory_order __m2)
{ return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
atomic_compare_exchange_strong_explicit(atomic_bool* __a,
bool* __i1, bool __i2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
inline bool
atomic_compare_exchange_strong_explicit(atomic_bool* __a,
atomic_compare_exchange_strong_explicit(volatile atomic_bool* __a,
bool* __i1, bool __i2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
inline bool
atomic_compare_exchange_strong(atomic_bool* __a, bool* __i1, bool __i2)
{
return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
memory_order_seq_cst);
}
inline bool
atomic_compare_exchange_strong(volatile atomic_bool* __a,
bool* __i1, bool __i2)
{
return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
memory_order_seq_cst);
}
// Function templates for atomic_integral operations, using
// __atomic_base . Template argument should be constricted to
// intergral types as specified in the standard.
template<typename _ITp>
inline bool
atomic_is_lock_free(const __atomic_base<_ITp>* __a)
{ return __a->is_lock_free(); }
template<typename _ITp>
inline bool
atomic_is_lock_free(const volatile __atomic_base<_ITp>* __a)
{ return __a->is_lock_free(); }
template<typename _ITp>
inline void
atomic_init(__atomic_base<_ITp>* __a, _ITp __i);
template<typename _ITp>
inline void
atomic_init(volatile __atomic_base<_ITp>* __a, _ITp __i);
// Free standing functions. Template argument should be constricted
// to intergral types as specified in the standard.
template<typename _ITp>
inline void
atomic_store_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m)
{ __a->store(__i, __m); }
template<typename _ITp>
inline void
atomic_store_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ __a->store(__i, __m); }
template<typename _ITp>
inline _ITp
atomic_load_explicit(const __atomic_base<_ITp>* __a, memory_order __m)
{ return __a->load(__m); }
template<typename _ITp>
inline _ITp
atomic_load_explicit(const volatile __atomic_base<_ITp>* __a,
memory_order __m)
{ return __a->load(__m); }
template<typename _ITp>
inline _ITp
atomic_exchange_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->exchange(__i, __m); }
template<typename _ITp>
inline _ITp
atomic_exchange_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->exchange(__i, __m); }
template<typename _ITp>
inline bool
atomic_compare_exchange_weak_explicit(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2,
......@@ -714,6 +1144,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _ITp>
inline bool
atomic_compare_exchange_weak_explicit(volatile __atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
template<typename _ITp>
inline bool
atomic_compare_exchange_strong_explicit(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2,
memory_order __m1,
......@@ -721,6 +1158,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
template<typename _ITp>
inline bool
atomic_compare_exchange_strong_explicit(volatile __atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2,
memory_order __m1,
memory_order __m2)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
template<typename _ITp>
inline _ITp
atomic_fetch_add_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
......@@ -728,32 +1173,57 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _ITp>
inline _ITp
atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_add(__i, __m); }
template<typename _ITp>
inline _ITp
atomic_fetch_sub_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_sub(__i, __m); }
template<typename _ITp>
inline _ITp
atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_sub(__i, __m); }
template<typename _ITp>
inline _ITp
atomic_fetch_and_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_and(__i, __m); }
template<typename _ITp>
inline _ITp
atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_and(__i, __m); }
template<typename _ITp>
inline _ITp
atomic_fetch_or_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_or(__i, __m); }
template<typename _ITp>
inline _ITp
atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_or(__i, __m); }
template<typename _ITp>
inline _ITp
atomic_fetch_xor_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_xor(__i, __m); }
template<typename _ITp>
inline bool
atomic_is_lock_free(const __atomic_base<_ITp>* __a)
{ return __a->is_lock_free(); }
inline _ITp
atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_xor(__i, __m); }
template<typename _ITp>
inline void
......@@ -761,16 +1231,31 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ atomic_store_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline void
atomic_store(volatile __atomic_base<_ITp>* __a, _ITp __i)
{ atomic_store_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_load(const __atomic_base<_ITp>* __a)
{ return atomic_load_explicit(__a, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_load(const volatile __atomic_base<_ITp>* __a)
{ return atomic_load_explicit(__a, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_exchange(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_exchange(volatile __atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline bool
atomic_compare_exchange_weak(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2)
......@@ -782,6 +1267,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _ITp>
inline bool
atomic_compare_exchange_weak(volatile __atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2)
{
return atomic_compare_exchange_weak_explicit(__a, __i1, __i2,
memory_order_seq_cst,
memory_order_seq_cst);
}
template<typename _ITp>
inline bool
atomic_compare_exchange_strong(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2)
{
......@@ -791,30 +1286,65 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
template<typename _ITp>
inline bool
atomic_compare_exchange_strong(volatile __atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2)
{
return atomic_compare_exchange_strong_explicit(__a, __i1, __i2,
memory_order_seq_cst,
memory_order_seq_cst);
}
template<typename _ITp>
inline _ITp
atomic_fetch_add(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_fetch_sub(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_fetch_and(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_fetch_or(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_fetch_xor(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
inline _ITp
atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
// @} group atomics
_GLIBCXX_END_NAMESPACE
......
......@@ -72,36 +72,39 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
/// 0 is the least significant word.
_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()
{ _M_do_reset(); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
_Base_bitset(unsigned long long __val)
#else
_Base_bitset(unsigned long __val)
#endif
{
_M_do_reset();
_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 )
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static size_t
static _GLIBCXX_CONSTEXPR size_t
_S_whichbyte(size_t __pos )
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static size_t
static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos )
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _WordT
static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos )
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
......@@ -123,7 +126,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_hiword()
{ return _M_w[_Nw - 1]; }
_WordT
_GLIBCXX_CONSTEXPR _WordT
_M_hiword() const
{ return _M_w[_Nw - 1]; }
......@@ -368,31 +371,31 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
typedef unsigned long _WordT;
_WordT _M_w;
_Base_bitset(void)
_GLIBCXX_CONSTEXPR _Base_bitset()
: _M_w(0)
{ }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
_Base_bitset(unsigned long long __val)
constexpr _Base_bitset(unsigned long long __val)
#else
_Base_bitset(unsigned long __val)
#endif
: _M_w(__val)
{ }
static size_t
static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos )
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static size_t
static _GLIBCXX_CONSTEXPR size_t
_S_whichbyte(size_t __pos )
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static size_t
static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos )
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _WordT
static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos )
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
......@@ -414,7 +417,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_M_hiword()
{ return _M_w; }
_WordT
_GLIBCXX_CONSTEXPR _WordT
_M_hiword() const
{ return _M_w; }
......@@ -511,29 +514,29 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{
typedef unsigned long _WordT;
_Base_bitset()
_GLIBCXX_CONSTEXPR _Base_bitset()
{ }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
_Base_bitset(unsigned long long)
constexpr _Base_bitset(unsigned long long)
#else
_Base_bitset(unsigned long)
#endif
{ }
static size_t
static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos )
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static size_t
static _GLIBCXX_CONSTEXPR size_t
_S_whichbyte(size_t __pos )
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static size_t
static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos )
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _WordT
static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos )
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
......@@ -545,13 +548,17 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
// make an unchecked call; all the memory ugliness is therefore
// localized to this single should-never-get-this-far function.
_WordT&
_M_getword(size_t) const
_M_getword(size_t)
{
__throw_out_of_range(__N("_Base_bitset::_M_getword"));
return *new _WordT;
}
_WordT
_M_getword(size_t __pos) const
{ return 0; }
_GLIBCXX_CONSTEXPR _WordT
_M_hiword() const
{ return 0; }
......@@ -632,13 +639,21 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
template<size_t _Extrabits>
struct _Sanitize
{
static void _S_do_sanitize(unsigned long& __val)
{ __val &= ~((~static_cast<unsigned long>(0)) << _Extrabits); }
typedef unsigned long _WordT;
static void
_S_do_sanitize(_WordT& __val)
{ __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); }
};
template<>
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.
......@@ -713,11 +728,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
typedef unsigned long _WordT;
void
_M_do_sanitize()
{
_Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD>::
_S_do_sanitize(this->_M_hiword());
}
_M_do_sanitize()
{
typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type;
__sanitize_type::_S_do_sanitize(this->_M_hiword());
}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename> friend class hash;
......@@ -740,8 +755,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{
friend class bitset;
_WordT *_M_wp;
size_t _M_bpos;
_WordT* _M_wp;
size_t _M_bpos;
// left undefined
reference();
......@@ -799,17 +814,18 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
// 23.3.5.1 constructors:
/// All bits set to zero.
bitset()
_GLIBCXX_CONSTEXPR bitset()
{ }
/// Initial bits bitwise-copied from a single word (others set to zero).
#ifdef __GXX_EXPERIMENTAL_CXX0X__
bitset(unsigned long long __val)
constexpr bitset(unsigned long long __val)
: _Base(__val) { }
#else
bitset(unsigned long __val)
#endif
: _Base(__val)
{ _M_do_sanitize(); }
#endif
/**
* @brief Use a subset of a string.
......@@ -1088,8 +1104,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
/**
* @brief Array-indexing support.
* @param position Index into the %bitset.
* @return A bool for a <em>const %bitset</em>. For non-const bitsets, an
* instance of the reference proxy class.
* @return A bool for a <em>const %bitset</em>. For non-const
* bitsets, an instance of the reference proxy class.
* @note These operators do no range checking and throw no exceptions,
* as required by DR 11 to the standard.
*
......@@ -1101,7 +1117,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
reference
operator[](size_t __position)
{ return reference(*this,__position); }
{ return reference(*this, __position); }
bool
operator[](size_t __position) const
......@@ -1236,7 +1252,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ return this->_M_do_count(); }
/// Returns the total number of bits.
size_t
_GLIBCXX_CONSTEXPR size_t
size() const
{ return _Nb; }
......
......@@ -46,7 +46,7 @@
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std
namespace std
{
/**
* @defgroup chrono Time
......@@ -71,71 +71,75 @@ namespace std
// 20.8.2.3 specialization of common_type (for duration)
template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2>
struct common_type<chrono::duration<_Rep1, _Period1>,
chrono::duration<_Rep2, _Period2>>
chrono::duration<_Rep2, _Period2>>
{
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
ratio<__static_gcd<_Period1::num, _Period2::num>::value,
(_Period1::den / __static_gcd<_Period1::den, _Period2::den>::value)
* _Period2::den>> type;
ratio<__static_gcd<_Period1::num, _Period2::num>::value,
(_Period1::den / __static_gcd<_Period1::den, _Period2::den>::value)
* _Period2::den>> type;
};
// 20.8.2.3 specialization of common_type (for time_point)
template<typename _Clock, typename _Duration1, typename _Duration2>
struct common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2>>
chrono::time_point<_Clock, _Duration2>>
{
typedef chrono::time_point<_Clock,
typename common_type<_Duration1, _Duration2>::type> type;
typedef chrono::time_point<_Clock,
typename common_type<_Duration1, _Duration2>::type> type;
};
namespace chrono
namespace chrono
{
// Primary template for duration_cast impl.
template<typename _ToDuration, typename _CF, typename _CR,
bool _NumIsOne = false, bool _DenIsOne = false>
bool _NumIsOne = false, bool _DenIsOne = false>
struct __duration_cast_impl
{
template<typename _Rep, typename _Period>
static _ToDuration __cast(const duration<_Rep, _Period>& __d)
{
return _ToDuration(static_cast<
typename _ToDuration::rep>(static_cast<_CR>(__d.count())
* static_cast<_CR>(_CF::num)
/ static_cast<_CR>(_CF::den)));
}
template<typename _Rep, typename _Period>
static constexpr _ToDuration
__cast(const duration<_Rep, _Period>& __d)
{
return _ToDuration(static_cast<
typename _ToDuration::rep>(static_cast<_CR>(__d.count())
* static_cast<_CR>(_CF::num)
/ static_cast<_CR>(_CF::den)));
}
};
template<typename _ToDuration, typename _CF, typename _CR>
struct __duration_cast_impl<_ToDuration, _CF, _CR, true, true>
{
template<typename _Rep, typename _Period>
static _ToDuration __cast(const duration<_Rep, _Period>& __d)
{
return _ToDuration(
static_cast<typename _ToDuration::rep>(__d.count()));
}
template<typename _Rep, typename _Period>
static constexpr _ToDuration
__cast(const duration<_Rep, _Period>& __d)
{
return _ToDuration(
static_cast<typename _ToDuration::rep>(__d.count()));
}
};
template<typename _ToDuration, typename _CF, typename _CR>
struct __duration_cast_impl<_ToDuration, _CF, _CR, true, false>
{
template<typename _Rep, typename _Period>
static _ToDuration __cast(const duration<_Rep, _Period>& __d)
{
return _ToDuration(static_cast<typename _ToDuration::rep>(
static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
}
template<typename _Rep, typename _Period>
static constexpr _ToDuration
__cast(const duration<_Rep, _Period>& __d)
{
return _ToDuration(static_cast<typename _ToDuration::rep>(
static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
}
};
template<typename _ToDuration, typename _CF, typename _CR>
struct __duration_cast_impl<_ToDuration, _CF, _CR, false, true>
{
template<typename _Rep, typename _Period>
static _ToDuration __cast(const duration<_Rep, _Period>& __d)
{
return _ToDuration(static_cast<typename _ToDuration::rep>(
static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
}
template<typename _Rep, typename _Period>
static constexpr _ToDuration
__cast(const duration<_Rep, _Period>& __d)
{
return _ToDuration(static_cast<typename _ToDuration::rep>(
static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
}
};
template<typename _Tp>
......@@ -150,17 +154,17 @@ namespace std
/// duration_cast
template<typename _ToDuration, typename _Rep, typename _Period>
inline typename enable_if<__is_duration<_ToDuration>::value,
inline constexpr typename enable_if<__is_duration<_ToDuration>::value,
_ToDuration>::type
duration_cast(const duration<_Rep, _Period>& __d)
{
typedef typename
ratio_divide<_Period, typename _ToDuration::period>::type __cf;
typedef typename
common_type<typename _ToDuration::rep, _Rep, intmax_t>::type __cr;
typedef typename
ratio_divide<_Period, typename _ToDuration::period>::type __cf;
typedef typename
common_type<typename _ToDuration::rep, _Rep, intmax_t>::type __cr;
return __duration_cast_impl<_ToDuration, __cf, __cr,
__cf::num == 1, __cf::den == 1>::__cast(__d);
return __duration_cast_impl<_ToDuration, __cf, __cr,
__cf::num == 1, __cf::den == 1>::__cast(__d);
}
/// treat_as_floating_point
......@@ -173,17 +177,17 @@ namespace std
template<typename _Rep>
struct duration_values
{
static const _Rep
zero()
{ return _Rep(0); }
static const _Rep
max()
{ return numeric_limits<_Rep>::max(); }
static const _Rep
min()
{ return numeric_limits<_Rep>::min(); }
static constexpr _Rep
zero()
{ return _Rep(0); }
static constexpr _Rep
max()
{ return numeric_limits<_Rep>::max(); }
static constexpr _Rep
min()
{ return numeric_limits<_Rep>::min(); }
};
template<typename T>
......@@ -200,98 +204,98 @@ namespace std
template<typename _Rep, typename _Period>
struct duration
{
typedef _Rep rep;
typedef _Period period;
static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration");
static_assert(__is_ratio<_Period>::value,
static_assert(__is_ratio<_Period>::value,
"period must be a specialization of ratio");
static_assert(_Period::num > 0, "period must be positive");
typedef _Rep rep;
typedef _Period period;
// 20.8.3.1 construction / copy / destroy
duration() = default;
template<typename _Rep2, typename = typename
static_assert(_Period::num > 0, "period must be positive");
// 20.8.3.1 construction / copy / destroy
constexpr duration() : __r() { }
template<typename _Rep2, typename = typename
enable_if<is_convertible<_Rep2, rep>::value
&& (treat_as_floating_point<rep>::value
|| !treat_as_floating_point<_Rep2>::value)>::type>
explicit duration(const _Rep2& __rep)
: __r(static_cast<rep>(__rep)) { }
constexpr explicit duration(const _Rep2& __rep)
: __r(static_cast<rep>(__rep)) { }
template<typename _Rep2, typename _Period2, typename = typename
enable_if<treat_as_floating_point<rep>::value
template<typename _Rep2, typename _Period2, typename = typename
enable_if<treat_as_floating_point<rep>::value
|| (ratio_divide<_Period2, period>::type::den == 1
&& !treat_as_floating_point<_Rep2>::value)>::type>
duration(const duration<_Rep2, _Period2>& __d)
: __r(duration_cast<duration>(__d).count()) { }
constexpr duration(const duration<_Rep2, _Period2>& __d)
: __r(duration_cast<duration>(__d).count()) { }
~duration() = default;
duration(const duration&) = default;
duration& operator=(const duration&) = default;
// 20.8.3.2 observer
rep
count() const
{ return __r; }
// 20.8.3.3 arithmetic
duration
operator+() const
{ return *this; }
duration
operator-() const
{ return duration(-__r); }
duration&
operator++()
{
++__r;
return *this;
}
duration
operator++(int)
{ return duration(__r++); }
duration&
operator--()
{
--__r;
return *this;
}
duration
operator--(int)
{ return duration(__r--); }
duration&
operator+=(const duration& __d)
{
__r += __d.count();
return *this;
}
duration&
operator-=(const duration& __d)
{
__r -= __d.count();
return *this;
}
duration&
operator*=(const rep& __rhs)
{
__r *= __rhs;
return *this;
}
duration&
operator/=(const rep& __rhs)
{
__r /= __rhs;
return *this;
}
// 20.8.3.2 observer
constexpr rep
count() const
{ return __r; }
// 20.8.3.3 arithmetic
constexpr duration
operator+() const
{ return *this; }
constexpr duration
operator-() const
{ return duration(-__r); }
duration&
operator++()
{
++__r;
return *this;
}
duration
operator++(int)
{ return duration(__r++); }
duration&
operator--()
{
--__r;
return *this;
}
duration
operator--(int)
{ return duration(__r--); }
duration&
operator+=(const duration& __d)
{
__r += __d.count();
return *this;
}
duration&
operator-=(const duration& __d)
{
__r -= __d.count();
return *this;
}
duration&
operator*=(const rep& __rhs)
{
__r *= __rhs;
return *this;
}
duration&
operator/=(const rep& __rhs)
{
__r /= __rhs;
return *this;
}
// DR 934.
template<typename _Rep2 = rep>
......@@ -312,46 +316,45 @@ namespace std
return *this;
}
// 20.8.3.4 special values
// TODO: These should be constexprs.
static const duration
zero()
{ return duration(duration_values<rep>::zero()); }
// 20.8.3.4 special values
static constexpr duration
zero()
{ return duration(duration_values<rep>::zero()); }
static constexpr duration
min()
{ return duration(duration_values<rep>::min()); }
static const duration
min()
{ return duration(duration_values<rep>::min()); }
static const duration
max()
{ return duration(duration_values<rep>::max()); }
static constexpr duration
max()
{ return duration(duration_values<rep>::max()); }
private:
rep __r;
rep __r;
};
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type
operator+(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
typename _Rep2, typename _Period2>
inline typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type
operator+(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs) += __rhs;
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs) += __rhs;
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type
operator-(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type
operator-(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs) -= __rhs;
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs) -= __rhs;
}
template<typename _Rep1, typename _Rep2, bool =
......@@ -361,21 +364,21 @@ namespace std
template<typename _Rep1, typename _Rep2>
struct __common_rep_type<_Rep1, _Rep2, true>
{ typedef typename common_type<_Rep1, _Rep2>::type type; };
{ typedef typename common_type<_Rep1, _Rep2>::type type; };
template<typename _Rep1, typename _Period, typename _Rep2>
inline duration<typename __common_rep_type<_Rep1, _Rep2>::type, _Period>
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type __cr;
return duration<__cr, _Period>(__d) *= __s;
typedef typename common_type<_Rep1, _Rep2>::type __cr;
return duration<__cr, _Period>(__d) *= __s;
}
template<typename _Rep1, typename _Period, typename _Rep2>
inline duration<typename __common_rep_type<_Rep2, _Rep1>::type, _Period>
operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
{ return __d * __s; }
template<typename _Rep1, typename _Period, typename _Rep2>
inline duration<typename __common_rep_type<_Rep1, typename
enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
......@@ -388,12 +391,12 @@ namespace std
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline typename common_type<_Rep1, _Rep2>::type
operator/(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
operator/(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs).count() / __ct(__rhs).count();
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs).count() / __ct(__rhs).count();
}
// DR 934.
......@@ -408,112 +411,112 @@ namespace std
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type
operator%(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
inline typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type
operator%(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs) %= __rhs;
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs) %= __rhs;
}
// comparisons
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline bool
operator==(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
typename _Rep2, typename _Period2>
inline constexpr bool
operator==(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs).count() == __ct(__rhs).count();
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs).count() == __ct(__rhs).count();
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline bool
operator<(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
typename _Rep2, typename _Period2>
inline constexpr bool
operator<(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs).count() < __ct(__rhs).count();
typedef typename common_type<duration<_Rep1, _Period1>,
duration<_Rep2, _Period2>>::type __ct;
return __ct(__lhs).count() < __ct(__rhs).count();
}
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline bool
operator!=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
typename _Rep2, typename _Period2>
inline constexpr bool
operator!=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline bool
operator<=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
typename _Rep2, typename _Period2>
inline constexpr bool
operator<=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline bool
operator>(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
typename _Rep2, typename _Period2>
inline constexpr bool
operator>(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{ return __rhs < __lhs; }
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline bool
operator>=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
template<typename _Rep1, typename _Period1,
typename _Rep2, typename _Period2>
inline constexpr bool
operator>=(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{ return !(__lhs < __rhs); }
/// nanoseconds
typedef duration<int64_t, nano> nanoseconds;
typedef duration<int64_t, nano> nanoseconds;
/// microseconds
typedef duration<int64_t, micro> microseconds;
typedef duration<int64_t, micro> microseconds;
/// milliseconds
typedef duration<int64_t, milli> milliseconds;
typedef duration<int64_t, milli> milliseconds;
/// seconds
typedef duration<int64_t > seconds;
typedef duration<int64_t> seconds;
/// minutes
typedef duration<int, ratio< 60>> minutes;
typedef duration<int, ratio< 60>> minutes;
/// hours
typedef duration<int, ratio<3600>> hours;
typedef duration<int, ratio<3600>> hours;
/// time_point
template<typename _Clock, typename _Duration>
struct time_point
{
typedef _Clock clock;
typedef _Duration duration;
typedef typename duration::rep rep;
typedef typename duration::period period;
typedef _Clock clock;
typedef _Duration duration;
typedef typename duration::rep rep;
typedef typename duration::period period;
time_point() : __d(duration::zero())
constexpr time_point() : __d(duration::zero())
{ }
explicit time_point(const duration& __dur)
: __d(duration::zero() + __dur)
constexpr explicit time_point(const duration& __dur)
: __d(__dur)
{ }
// conversions
template<typename _Duration2>
time_point(const time_point<clock, _Duration2>& __t)
constexpr time_point(const time_point<clock, _Duration2>& __t)
: __d(__t.time_since_epoch())
{ }
// observer
duration
constexpr duration
time_since_epoch() const
{ return __d; }
// arithmetic
time_point&
operator+=(const duration& __dur)
......@@ -521,124 +524,127 @@ namespace std
__d += __dur;
return *this;
}
time_point&
operator-=(const duration& __dur)
{
__d -= __dur;
return *this;
}
// special values
// TODO: These should be constexprs.
static const time_point
static constexpr time_point
min()
{ return time_point(duration::min()); }
static const time_point
static constexpr time_point
max()
{ return time_point(duration::max()); }
private:
duration __d;
};
/// time_point_cast
template<typename _ToDuration, typename _Clock, typename _Duration>
inline typename enable_if<__is_duration<_ToDuration>::value,
inline constexpr typename enable_if<__is_duration<_ToDuration>::value,
time_point<_Clock, _ToDuration>>::type
time_point_cast(const time_point<_Clock, _Duration>& __t)
{
return time_point<_Clock, _ToDuration>(
duration_cast<_ToDuration>(__t.time_since_epoch()));
return time_point<_Clock, _ToDuration>(
duration_cast<_ToDuration>(__t.time_since_epoch()));
}
template<typename _Clock, typename _Duration1,
typename _Rep2, typename _Period2>
inline time_point<_Clock,
typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
operator+(const time_point<_Clock, _Duration1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
typename _Rep2, typename _Period2>
inline time_point<_Clock,
typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
operator+(const time_point<_Clock, _Duration1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{
typedef time_point<_Clock,
typename common_type<_Duration1,
duration<_Rep2, _Period2>>::type> __ct;
return __ct(__lhs) += __rhs;
typedef time_point<_Clock,
typename common_type<_Duration1,
duration<_Rep2, _Period2>>::type> __ct;
return __ct(__lhs) += __rhs;
}
template<typename _Rep1, typename _Period1,
typename _Clock, typename _Duration2>
inline time_point<_Clock,
typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
operator+(const duration<_Rep1, _Period1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
typename _Clock, typename _Duration2>
inline time_point<_Clock,
typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
operator+(const duration<_Rep1, _Period1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
{ return __rhs + __lhs; }
template<typename _Clock, typename _Duration1,
typename _Rep2, typename _Period2>
inline time_point<_Clock,
typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
operator-(const time_point<_Clock, _Duration1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
typename _Rep2, typename _Period2>
inline time_point<_Clock,
typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
operator-(const time_point<_Clock, _Duration1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
{ return __lhs + (-__rhs); }
template<typename _Clock, typename _Duration1, typename _Duration2>
inline typename common_type<_Duration1, _Duration2>::type
operator-(const time_point<_Clock, _Duration1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
operator-(const time_point<_Clock, _Duration1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
{ return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
template<typename _Clock, typename _Duration1, typename _Duration2>
inline bool
inline constexpr bool
operator==(const time_point<_Clock, _Duration1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
const time_point<_Clock, _Duration2>& __rhs)
{ return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
template<typename _Clock, typename _Duration1, typename _Duration2>
inline bool
inline constexpr bool
operator!=(const time_point<_Clock, _Duration1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
const time_point<_Clock, _Duration2>& __rhs)
{ return !(__lhs == __rhs); }
template<typename _Clock, typename _Duration1, typename _Duration2>
inline bool
inline constexpr bool
operator<(const time_point<_Clock, _Duration1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
const time_point<_Clock, _Duration2>& __rhs)
{ return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
template<typename _Clock, typename _Duration1, typename _Duration2>
inline bool
inline constexpr bool
operator<=(const time_point<_Clock, _Duration1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
const time_point<_Clock, _Duration2>& __rhs)
{ return !(__rhs < __lhs); }
template<typename _Clock, typename _Duration1, typename _Duration2>
inline bool
inline constexpr bool
operator>(const time_point<_Clock, _Duration1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
const time_point<_Clock, _Duration2>& __rhs)
{ return __rhs < __lhs; }
template<typename _Clock, typename _Duration1, typename _Duration2>
inline bool
inline constexpr bool
operator>=(const time_point<_Clock, _Duration1>& __lhs,
const time_point<_Clock, _Duration2>& __rhs)
const time_point<_Clock, _Duration2>& __rhs)
{ return !(__lhs < __rhs); }
/// system_clock
struct system_clock
{
#ifdef _GLIBCXX_USE_CLOCK_REALTIME
typedef chrono::nanoseconds duration;
typedef chrono::nanoseconds duration;
#elif defined(_GLIBCXX_USE_GETTIMEOFDAY)
typedef chrono::microseconds duration;
typedef chrono::microseconds duration;
#else
typedef chrono::seconds duration;
typedef chrono::seconds duration;
#endif
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock, duration> time_point;
static_assert(system_clock::duration::min()
< system_clock::duration::zero(),
"a clock's minimum duration cannot be less than its epoch");
static const bool is_monotonic = false;
static time_point
......@@ -648,25 +654,17 @@ namespace std
static std::time_t
to_time_t(const time_point& __t)
{
return std::time_t(
duration_cast<chrono::seconds>(__t.time_since_epoch()).count());
return std::time_t(
duration_cast<chrono::seconds>(__t.time_since_epoch()).count());
}
static time_point
from_time_t(std::time_t __t)
{
return time_point_cast<system_clock::duration>(
chrono::time_point<system_clock, chrono::seconds>(
chrono::seconds(__t)));
{
return time_point_cast<system_clock::duration>(
chrono::time_point<system_clock, chrono::seconds>(
chrono::seconds(__t)));
}
// TODO: requires constexpr
/*
static_assert(
system_clock::duration::min() <
system_clock::duration::zero(),
"a clock's minimum duration cannot be less than its epoch");
*/
};
#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
......
......@@ -126,49 +126,49 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/// Default constructor. First parameter is x, second parameter is y.
/// Unspecified parameters default to 0.
complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp())
_GLIBCXX_CONSTEXPR complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp())
: _M_real(__r), _M_imag(__i) { }
// Lets the compiler synthesize the copy constructor
// complex (const complex<_Tp>&);
/// Copy constructor.
template<typename _Up>
complex(const complex<_Up>& __z)
_GLIBCXX_CONSTEXPR complex(const complex<_Up>& __z)
: _M_real(__z.real()), _M_imag(__z.imag()) { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
_Tp real() const
{ return _M_real; }
constexpr _Tp
real() const { return _M_real; }
_Tp imag() const
{ return _M_imag; }
constexpr _Tp
imag() const { return _M_imag; }
#else
/// Return real part of complex number.
_Tp& real()
{ return _M_real; }
_Tp&
real() { return _M_real; }
/// Return real part of complex number.
const _Tp& real() const
{ return _M_real; }
const _Tp&
real() const { return _M_real; }
/// Return imaginary part of complex number.
_Tp& imag()
{ return _M_imag; }
_Tp&
imag() { return _M_imag; }
/// Return imaginary part of complex number.
const _Tp& imag() const
{ return _M_imag; }
const _Tp&
imag() const { return _M_imag; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
void real(_Tp __val)
{ _M_real = __val; }
void
real(_Tp __val) { _M_real = __val; }
void imag(_Tp __val)
{ _M_imag = __val; }
void
imag(_Tp __val) { _M_imag = __val; }
/// Assign this complex number to scalar @a t.
complex<_Tp>& operator=(const _Tp&);
......@@ -215,7 +215,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Up>
complex<_Tp>& operator/=(const complex<_Up>&);
const complex& __rep() const
_GLIBCXX_USE_CONSTEXPR complex __rep() const
{ return *this; }
private:
......@@ -1041,46 +1041,43 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef float value_type;
typedef __complex__ float _ComplexT;
complex(_ComplexT __z) : _M_value(__z) { }
_GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
complex(float __r = 0.0f, float __i = 0.0f)
{
__real__ _M_value = __r;
__imag__ _M_value = __i;
}
_GLIBCXX_CONSTEXPR complex(float __r = 0.0f, float __i = 0.0f)
: _M_value(__r + __i * 1.0fi) { }
explicit complex(const complex<double>&);
explicit complex(const complex<long double>&);
explicit _GLIBCXX_CONSTEXPR complex(const complex<double>&);
explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
float real() const
{ return __real__ _M_value; }
constexpr float
real() const { return __real__ _M_value; }
float imag() const
{ return __imag__ _M_value; }
constexpr float
imag() const { return __imag__ _M_value; }
#else
float& real()
{ return __real__ _M_value; }
float&
real() { return __real__ _M_value; }
const float& real() const
{ return __real__ _M_value; }
const float&
real() const { return __real__ _M_value; }
float& imag()
{ return __imag__ _M_value; }
float&
imag() { return __imag__ _M_value; }
const float& imag() const
{ return __imag__ _M_value; }
const float&
imag() const { return __imag__ _M_value; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
void real(float __val)
{ __real__ _M_value = __val; }
void
real(float __val) { __real__ _M_value = __val; }
void imag(float __val)
{ __imag__ _M_value = __val; }
void
imag(float __val) { __imag__ _M_value = __val; }
complex&
operator=(float __f)
......@@ -1170,7 +1167,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this;
}
const _ComplexT& __rep() const { return _M_value; }
_GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; }
private:
_ComplexT _M_value;
......@@ -1184,48 +1181,45 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef double value_type;
typedef __complex__ double _ComplexT;
complex(_ComplexT __z) : _M_value(__z) { }
_GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
complex(double __r = 0.0, double __i = 0.0)
{
__real__ _M_value = __r;
__imag__ _M_value = __i;
}
_GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0)
: _M_value(__r + __i * 1.0i) { }
complex(const complex<float>& __z)
_GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
: _M_value(__z.__rep()) { }
explicit complex(const complex<long double>&);
explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
double real() const
{ return __real__ _M_value; }
constexpr double
real() const { return __real__ _M_value; }
double imag() const
{ return __imag__ _M_value; }
constexpr double
imag() const { return __imag__ _M_value; }
#else
double& real()
{ return __real__ _M_value; }
double&
real() { return __real__ _M_value; }
const double& real() const
{ return __real__ _M_value; }
const double&
real() const { return __real__ _M_value; }
double& imag()
{ return __imag__ _M_value; }
double&
imag() { return __imag__ _M_value; }
const double& imag() const
{ return __imag__ _M_value; }
const double&
imag() const { return __imag__ _M_value; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
void real(double __val)
{ __real__ _M_value = __val; }
void
real(double __val) { __real__ _M_value = __val; }
void imag(double __val)
{ __imag__ _M_value = __val; }
void
imag(double __val) { __imag__ _M_value = __val; }
complex&
operator=(double __d)
......@@ -1314,7 +1308,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this;
}
const _ComplexT& __rep() const { return _M_value; }
_GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; }
private:
_ComplexT _M_value;
......@@ -1328,49 +1322,47 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef long double value_type;
typedef __complex__ long double _ComplexT;
complex(_ComplexT __z) : _M_value(__z) { }
_GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
complex(long double __r = 0.0L, long double __i = 0.0L)
{
__real__ _M_value = __r;
__imag__ _M_value = __i;
}
_GLIBCXX_CONSTEXPR complex(long double __r = 0.0L,
long double __i = 0.0L)
: _M_value(__r + __i * 1.0Li) { }
complex(const complex<float>& __z)
_GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
: _M_value(__z.__rep()) { }
complex(const complex<double>& __z)
_GLIBCXX_CONSTEXPR complex(const complex<double>& __z)
: _M_value(__z.__rep()) { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
long double real() const
{ return __real__ _M_value; }
constexpr long double
real() const { return __real__ _M_value; }
long double imag() const
{ return __imag__ _M_value; }
constexpr long double
imag() const { return __imag__ _M_value; }
#else
long double& real()
{ return __real__ _M_value; }
long double&
real() { return __real__ _M_value; }
const long double& real() const
{ return __real__ _M_value; }
const long double&
real() const { return __real__ _M_value; }
long double& imag()
{ return __imag__ _M_value; }
long double&
imag() { return __imag__ _M_value; }
const long double& imag() const
{ return __imag__ _M_value; }
const long double&
imag() const { return __imag__ _M_value; }
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 387. std::complex over-encapsulated.
void real(long double __val)
{ __real__ _M_value = __val; }
void
real(long double __val) { __real__ _M_value = __val; }
void imag(long double __val)
{ __imag__ _M_value = __val; }
void
imag(long double __val) { __imag__ _M_value = __val; }
complex&
operator=(long double __r)
......@@ -1459,7 +1451,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return *this;
}
const _ComplexT& __rep() const { return _M_value; }
_GLIBCXX_USE_CONSTEXPR _ComplexT __rep() const { return _M_value; }
private:
_ComplexT _M_value;
......@@ -1467,15 +1459,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// These bits have to be at the end of this file, so that the
// specializations have all been defined.
inline
inline _GLIBCXX_CONSTEXPR
complex<float>::complex(const complex<double>& __z)
: _M_value(__z.__rep()) { }
inline
inline _GLIBCXX_CONSTEXPR
complex<float>::complex(const complex<long double>& __z)
: _M_value(__z.__rep()) { }
inline
inline _GLIBCXX_CONSTEXPR
complex<double>::complex(const complex<long double>& __z)
: _M_value(__z.__rep()) { }
......
......@@ -64,19 +64,23 @@ namespace std
no_state
};
/// Specialization.
template<>
struct is_error_code_enum<future_errc> : public true_type { };
/// 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
inline error_code make_error_code(future_errc __errc)
{ return error_code(static_cast<int>(__errc), *future_category); }
/// Overload for make_error_code.
inline error_code
make_error_code(future_errc __errc)
{ return error_code(static_cast<int>(__errc), future_category()); }
// TODO: requires constexpr
inline error_condition make_error_condition(future_errc __errc)
{ return error_condition(static_cast<int>(__errc), *future_category); }
/// Overload for make_error_condition.
inline error_condition
make_error_condition(future_errc __errc)
{ return error_condition(static_cast<int>(__errc), future_category()); }
/**
* @brief Exception type thrown by futures.
......@@ -116,7 +120,21 @@ namespace std
template<typename _Res>
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>
future<typename result_of<_Fn(_Args...)>::type>
......@@ -1242,6 +1260,7 @@ namespace std
}
};
/// swap
template<typename _Res, typename... _ArgTypes>
inline void
swap(packaged_task<_Res(_ArgTypes...)>& __x,
......@@ -1307,6 +1326,7 @@ namespace std
thread _M_thread;
};
/// async
template<typename _Fn, typename... _Args>
future<typename result_of<_Fn(_Args...)>::type>
async(launch __policy, _Fn&& __fn, _Args&&... __args)
......@@ -1328,6 +1348,7 @@ namespace std
return future<result_type>(__state);
}
/// async, potential overload
template<typename _Fn, typename... _Args>
inline typename
enable_if<!is_same<typename decay<_Fn>::type, launch>::value,
......
// The template and inlines for the numeric_limits classes. -*- C++ -*-
// The template and inlines for the numeric_limits classes. -*- C++ -*-
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
// 2008, 2009, 2010 Free Software Foundation, Inc.
......@@ -47,7 +47,7 @@
// of fundamental arithmetic data types (integers and floating points).
// From Standard C++ point of view, there are 14 such types:
// * integers
// bool (1)
// bool (1)
// char, signed char, unsigned char, wchar_t (4)
// short, unsigned short (2)
// int, unsigned (2)
......@@ -190,83 +190,101 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
struct __numeric_limits_base
{
/** This will be true for all fundamental types (which have
specializations), and false for everything else. */
static const bool is_specialized = false;
specializations), and false for everything else. */
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false;
/** The number of @c radix digits that be represented without change: for
integer types, the number of non-sign bits in the mantissa; for
floating types, the number of @c radix digits in the mantissa. */
static const int digits = 0;
integer types, the number of non-sign bits in the mantissa; for
floating types, the number of @c radix digits in the mantissa. */
static _GLIBCXX_USE_CONSTEXPR int digits = 0;
/** The number of base 10 digits that can be represented without change. */
static const int digits10 = 0;
static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/** The number of base 10 digits required to ensure that values which
differ are always differentiated. */
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
/** True if the type is signed. */
static const bool is_signed = false;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
/** True if the type is integer.
* Is this supposed to be <em>if the type is integral?</em> */
static const bool is_integer = false;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
/** True if the type uses an exact representation. <em>All integer types are
exact, but not all exact types are integer. For example, rational and
fixed-exponent representations are exact but not integer.</em>
[18.2.1.2]/15 */
static const bool is_exact = false;
exact, but not all exact types are integer. For example, rational and
fixed-exponent representations are exact but not integer.</em>
[18.2.1.2]/15 */
static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
/** For integer types, specifies the base of the representation. For
floating types, specifies the base of the exponent representation. */
static const int radix = 0;
floating types, specifies the base of the exponent representation. */
static _GLIBCXX_USE_CONSTEXPR int radix = 0;
/** The minimum negative integer such that @c radix raised to the power of
(one less than that integer) is a normalized floating point number. */
static const int min_exponent = 0;
(one less than that integer) is a normalized floating point number. */
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
/** The minimum negative integer such that 10 raised to that power is in
the range of normalized floating point numbers. */
static const int min_exponent10 = 0;
the range of normalized floating point numbers. */
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
/** The maximum positive integer such that @c radix raised to the power of
(one less than that integer) is a representable finite floating point
(one less than that integer) is a representable finite floating point
number. */
static const int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
/** The maximum positive integer such that 10 raised to that power is in
the range of representable finite floating point numbers. */
static const int max_exponent10 = 0;
the range of representable finite floating point numbers. */
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
/** True if the type has a representation for positive infinity. */
static const bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
/** True if the type has a representation for a quiet (non-signaling)
<em>Not a Number</em>. */
static const bool has_quiet_NaN = false;
<em>Not a Number</em>. */
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
/** True if the type has a representation for a signaling
<em>Not a Number</em>. */
static const bool has_signaling_NaN = false;
<em>Not a Number</em>. */
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
/** See std::float_denorm_style for more information. */
static const float_denorm_style has_denorm = denorm_absent;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent;
/** <em>True if loss of accuracy is detected as a denormalization loss,
rather than as an inexact result.</em> [18.2.1.2]/42 */
static const bool has_denorm_loss = false;
rather than as an inexact result.</em> [18.2.1.2]/42 */
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
/** True if-and-only-if the type adheres to the IEC 559 standard, also
known as IEEE 754. (Only makes sense for floating point types.) */
static const bool is_iec559 = false;
known as IEEE 754. (Only makes sense for floating point types.) */
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
/** <em>True if the set of values representable by the type is
finite. All built-in types are bounded, this member would be
false for arbitrary precision types.</em> [18.2.1.2]/54 */
static const bool is_bounded = false;
finite. All built-in types are bounded, this member would be
false for arbitrary precision types.</em> [18.2.1.2]/54 */
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false;
/** True if the type is @e modulo, that is, if it is possible to add two
positive numbers and have a result that wraps around to a third number
that is less. Typically false for floating types, true for unsigned
integers, and true for signed integers. */
static const bool is_modulo = false;
positive numbers and have a result that wraps around to a third number
that is less. Typically false for floating types, true for unsigned
integers, and true for signed integers. */
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
/** True if trapping is implemented for this type. */
static const bool traps = false;
static _GLIBCXX_USE_CONSTEXPR bool traps = false;
/** True if tininess is detected before rounding. (see IEC 559) */
static const bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
/** See std::float_round_style for more information. This is only
meaningful for floating types; integer types will all be
meaningful for floating types; integer types will all be
round_toward_zero. */
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
round_toward_zero;
};
/**
......@@ -284,33 +302,49 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
struct numeric_limits : public __numeric_limits_base
{
/** The minimum finite value, or for floating types with
denormalization, the minimum positive normalized value. */
static _Tp min() throw() { return static_cast<_Tp>(0); }
denormalization, the minimum positive normalized value. */
static _GLIBCXX_CONSTEXPR _Tp
min() throw() { return static_cast<_Tp>(0); }
/** The maximum finite value. */
static _Tp max() throw() { return static_cast<_Tp>(0); }
static _GLIBCXX_CONSTEXPR _Tp
max() throw() { return static_cast<_Tp>(0); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/** A finite value x such that there is no other finite value y
* where y < x. */
static _Tp lowest() throw() { return static_cast<_Tp>(0); }
static constexpr _Tp
lowest() throw() { return static_cast<_Tp>(0); }
#endif
/** The @e machine @e epsilon: the difference between 1 and the least
value greater than 1 that is representable. */
static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
value greater than 1 that is representable. */
static _GLIBCXX_CONSTEXPR _Tp
epsilon() throw() { return static_cast<_Tp>(0); }
/** The maximum rounding error measurement (see LIA-1). */
static _Tp round_error() throw() { return static_cast<_Tp>(0); }
static _GLIBCXX_CONSTEXPR _Tp
round_error() throw() { return static_cast<_Tp>(0); }
/** The representation of positive infinity, if @c has_infinity. */
static _Tp infinity() throw() { return static_cast<_Tp>(0); }
static _GLIBCXX_CONSTEXPR _Tp
infinity() throw() { return static_cast<_Tp>(0); }
/** The representation of a quiet <em>Not a Number</em>,
/** The representation of a quiet <em>Not a Number</em>,
if @c has_quiet_NaN. */
static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
static _GLIBCXX_CONSTEXPR _Tp
quiet_NaN() throw() { return static_cast<_Tp>(0); }
/** The representation of a signaling <em>Not a Number</em>, if
@c has_signaling_NaN. */
static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
@c has_signaling_NaN. */
static _GLIBCXX_CONSTEXPR _Tp
signaling_NaN() throw() { return static_cast<_Tp>(0); }
/** The minimum positive denormalized value. For types where
@c has_denorm is false, this is the minimum positive normalized
@c has_denorm is false, this is the minimum positive normalized
value. */
static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
static _GLIBCXX_CONSTEXPR _Tp
denorm_min() throw() { return static_cast<_Tp>(0); }
};
#ifdef __GXX_EXPERIMENTAL_CXX0X__
......@@ -334,292 +368,341 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<bool>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR bool
min() throw() { return false; }
static _GLIBCXX_CONSTEXPR bool
max() throw() { return true; }
static bool min() throw()
{ return false; }
static bool max() throw()
{ return true; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static bool lowest() throw()
{ return min(); }
static constexpr bool
lowest() throw() { return min(); }
#endif
static const int digits = 1;
static const int digits10 = 0;
static _GLIBCXX_USE_CONSTEXPR int digits = 1;
static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static bool epsilon() throw()
{ return false; }
static bool round_error() throw()
{ return false; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static bool infinity() throw()
{ return false; }
static bool quiet_NaN() throw()
{ return false; }
static bool signaling_NaN() throw()
{ return false; }
static bool denorm_min() throw()
{ return false; }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = false;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR bool
epsilon() throw() { return false; }
static _GLIBCXX_CONSTEXPR bool
round_error() throw() { return false; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR bool
infinity() throw() { return false; }
static _GLIBCXX_CONSTEXPR bool
quiet_NaN() throw() { return false; }
static _GLIBCXX_CONSTEXPR bool
signaling_NaN() throw() { return false; }
static _GLIBCXX_CONSTEXPR bool
denorm_min() throw() { return false; }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
// It is not clear what it means for a boolean type to trap.
// This is a DR on the LWG issue list. Here, I use integer
// promotion semantics.
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<char> specialization.
template<>
struct numeric_limits<char>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR char
min() throw() { return __glibcxx_min(char); }
static _GLIBCXX_CONSTEXPR char
max() throw() { return __glibcxx_max(char); }
static char min() throw()
{ return __glibcxx_min(char); }
static char max() throw()
{ return __glibcxx_max(char); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static char lowest() throw()
{ return min(); }
static constexpr char
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (char);
static const int digits10 = __glibcxx_digits10 (char);
static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char);
static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = __glibcxx_signed (char);
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static char epsilon() throw()
{ return 0; }
static char round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static char infinity() throw()
{ return char(); }
static char quiet_NaN() throw()
{ return char(); }
static char signaling_NaN() throw()
{ return char(); }
static char denorm_min() throw()
{ return static_cast<char>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char);
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR char
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR char
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR
char infinity() throw() { return char(); }
static _GLIBCXX_CONSTEXPR char
quiet_NaN() throw() { return char(); }
static _GLIBCXX_CONSTEXPR char
signaling_NaN() throw() { return char(); }
static _GLIBCXX_CONSTEXPR char
denorm_min() throw() { return static_cast<char>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<signed char> specialization.
template<>
struct numeric_limits<signed char>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR signed char
min() throw() { return -__SCHAR_MAX__ - 1; }
static _GLIBCXX_CONSTEXPR signed char
max() throw() { return __SCHAR_MAX__; }
static signed char min() throw()
{ return -__SCHAR_MAX__ - 1; }
static signed char max() throw()
{ return __SCHAR_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static signed char lowest() throw()
{ return min(); }
static constexpr signed char
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (signed char);
static const int digits10 = __glibcxx_digits10 (signed char);
static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (signed char);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static signed char epsilon() throw()
{ return 0; }
static signed char round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static signed char infinity() throw()
{ return static_cast<signed char>(0); }
static signed char quiet_NaN() throw()
{ return static_cast<signed char>(0); }
static signed char signaling_NaN() throw()
{ return static_cast<signed char>(0); }
static signed char denorm_min() throw()
{ return static_cast<signed char>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR signed char
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR signed char
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR signed char
infinity() throw() { return static_cast<signed char>(0); }
static _GLIBCXX_CONSTEXPR signed char
quiet_NaN() throw() { return static_cast<signed char>(0); }
static _GLIBCXX_CONSTEXPR signed char
signaling_NaN() throw() { return static_cast<signed char>(0); }
static _GLIBCXX_CONSTEXPR signed char
denorm_min() throw() { return static_cast<signed char>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<unsigned char> specialization.
template<>
struct numeric_limits<unsigned char>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR unsigned char
min() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned char
max() throw() { return __SCHAR_MAX__ * 2U + 1; }
static unsigned char min() throw()
{ return 0; }
static unsigned char max() throw()
{ return __SCHAR_MAX__ * 2U + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static unsigned char lowest() throw()
{ return min(); }
static constexpr unsigned char
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (unsigned char);
static const int digits10 = __glibcxx_digits10 (unsigned char);
static _GLIBCXX_USE_CONSTEXPR int digits
= __glibcxx_digits (unsigned char);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (unsigned char);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static unsigned char epsilon() throw()
{ return 0; }
static unsigned char round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static unsigned char infinity() throw()
{ return static_cast<unsigned char>(0); }
static unsigned char quiet_NaN() throw()
{ return static_cast<unsigned char>(0); }
static unsigned char signaling_NaN() throw()
{ return static_cast<unsigned char>(0); }
static unsigned char denorm_min() throw()
{ return static_cast<unsigned char>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR unsigned char
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned char
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR unsigned char
infinity() throw() { return static_cast<unsigned char>(0); }
static _GLIBCXX_CONSTEXPR unsigned char
quiet_NaN() throw() { return static_cast<unsigned char>(0); }
static _GLIBCXX_CONSTEXPR unsigned char
signaling_NaN() throw() { return static_cast<unsigned char>(0); }
static _GLIBCXX_CONSTEXPR unsigned char
denorm_min() throw() { return static_cast<unsigned char>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<wchar_t> specialization.
template<>
struct numeric_limits<wchar_t>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR wchar_t
min() throw() { return __glibcxx_min (wchar_t); }
static _GLIBCXX_CONSTEXPR wchar_t
max() throw() { return __glibcxx_max (wchar_t); }
static wchar_t min() throw()
{ return __glibcxx_min (wchar_t); }
static wchar_t max() throw()
{ return __glibcxx_max (wchar_t); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static wchar_t lowest() throw()
{ return min(); }
static constexpr wchar_t
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (wchar_t);
static const int digits10 = __glibcxx_digits10 (wchar_t);
static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (wchar_t);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = __glibcxx_signed (wchar_t);
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static wchar_t epsilon() throw()
{ return 0; }
static wchar_t round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static wchar_t infinity() throw()
{ return wchar_t(); }
static wchar_t quiet_NaN() throw()
{ return wchar_t(); }
static wchar_t signaling_NaN() throw()
{ return wchar_t(); }
static wchar_t denorm_min() throw()
{ return wchar_t(); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t);
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR wchar_t
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR wchar_t
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR wchar_t
infinity() throw() { return wchar_t(); }
static _GLIBCXX_CONSTEXPR wchar_t
quiet_NaN() throw() { return wchar_t(); }
static _GLIBCXX_CONSTEXPR wchar_t
signaling_NaN() throw() { return wchar_t(); }
static _GLIBCXX_CONSTEXPR wchar_t
denorm_min() throw() { return wchar_t(); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
#ifdef __GXX_EXPERIMENTAL_CXX0X__
......@@ -627,116 +710,139 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<char16_t>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR char16_t
min() throw() { return __glibcxx_min (char16_t); }
static _GLIBCXX_CONSTEXPR char16_t
max() throw() { return __glibcxx_max (char16_t); }
static char16_t min() throw()
{ return __glibcxx_min (char16_t); }
static char16_t max() throw()
{ return __glibcxx_max (char16_t); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static char16_t lowest() throw()
{ return min(); }
static constexpr char16_t
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (char16_t);
static const int digits10 = __glibcxx_digits10 (char16_t);
static _GLIBCXX_USE_CONSTEXPR int digits
= __glibcxx_digits (char16_t);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (char16_t);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = __glibcxx_signed (char16_t);
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static char16_t epsilon() throw()
{ return 0; }
static char16_t round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static char16_t infinity() throw()
{ return char16_t(); }
static char16_t quiet_NaN() throw()
{ return char16_t(); }
static char16_t signaling_NaN() throw()
{ return char16_t(); }
static char16_t denorm_min() throw()
{ return char16_t(); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed
= __glibcxx_signed (char16_t);
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR char16_t
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR char16_t
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR char16_t
infinity() throw() { return char16_t(); }
static _GLIBCXX_CONSTEXPR char16_t
quiet_NaN() throw() { return char16_t(); }
static _GLIBCXX_CONSTEXPR char16_t
signaling_NaN() throw() { return char16_t(); }
static _GLIBCXX_CONSTEXPR char16_t
denorm_min() throw() { return char16_t(); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<char32_t> specialization.
template<>
struct numeric_limits<char32_t>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR char32_t
min() throw() { return __glibcxx_min (char32_t); }
static _GLIBCXX_CONSTEXPR char32_t
max() throw() { return __glibcxx_max (char32_t); }
static char32_t min() throw()
{ return __glibcxx_min (char32_t); }
static char32_t max() throw()
{ return __glibcxx_max (char32_t); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static char32_t lowest() throw()
{ return min(); }
static constexpr char32_t
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (char32_t);
static const int digits10 = __glibcxx_digits10 (char32_t);
static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char32_t);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (char32_t);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = __glibcxx_signed (char32_t);
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static char32_t epsilon() throw()
{ return 0; }
static char32_t round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static char32_t infinity() throw()
{ return char32_t(); }
static char32_t quiet_NaN() throw()
{ return char32_t(); }
static char32_t signaling_NaN() throw()
{ return char32_t(); }
static char32_t denorm_min() throw()
{ return char32_t(); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed
= __glibcxx_signed (char32_t);
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR char32_t
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR char32_t
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR char32_t
infinity() throw() { return char32_t(); }
static _GLIBCXX_CONSTEXPR char32_t
quiet_NaN() throw() { return char32_t(); }
static _GLIBCXX_CONSTEXPR char32_t
signaling_NaN() throw() { return char32_t(); }
static _GLIBCXX_CONSTEXPR char32_t
denorm_min() throw() { return char32_t(); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
#endif
......@@ -744,525 +850,617 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<short>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR short
min() throw() { return -__SHRT_MAX__ - 1; }
static _GLIBCXX_CONSTEXPR short
max() throw() { return __SHRT_MAX__; }
static short min() throw()
{ return -__SHRT_MAX__ - 1; }
static short max() throw()
{ return __SHRT_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static short lowest() throw()
{ return min(); }
static constexpr short
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (short);
static const int digits10 = __glibcxx_digits10 (short);
static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short);
static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static short epsilon() throw()
{ return 0; }
static short round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static short infinity() throw()
{ return short(); }
static short quiet_NaN() throw()
{ return short(); }
static short signaling_NaN() throw()
{ return short(); }
static short denorm_min() throw()
{ return short(); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR short
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR short
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR short
infinity() throw() { return short(); }
static _GLIBCXX_CONSTEXPR short
quiet_NaN() throw() { return short(); }
static _GLIBCXX_CONSTEXPR short
signaling_NaN() throw() { return short(); }
static _GLIBCXX_CONSTEXPR short
denorm_min() throw() { return short(); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<unsigned short> specialization.
template<>
struct numeric_limits<unsigned short>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR unsigned short
min() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned short
max() throw() { return __SHRT_MAX__ * 2U + 1; }
static unsigned short min() throw()
{ return 0; }
static unsigned short max() throw()
{ return __SHRT_MAX__ * 2U + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static unsigned short lowest() throw()
{ return min(); }
static constexpr unsigned short
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (unsigned short);
static const int digits10 = __glibcxx_digits10 (unsigned short);
static _GLIBCXX_USE_CONSTEXPR int digits
= __glibcxx_digits (unsigned short);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (unsigned short);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static unsigned short epsilon() throw()
{ return 0; }
static unsigned short round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static unsigned short infinity() throw()
{ return static_cast<unsigned short>(0); }
static unsigned short quiet_NaN() throw()
{ return static_cast<unsigned short>(0); }
static unsigned short signaling_NaN() throw()
{ return static_cast<unsigned short>(0); }
static unsigned short denorm_min() throw()
{ return static_cast<unsigned short>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR unsigned short
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned short
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR unsigned short
infinity() throw() { return static_cast<unsigned short>(0); }
static _GLIBCXX_CONSTEXPR unsigned short
quiet_NaN() throw() { return static_cast<unsigned short>(0); }
static _GLIBCXX_CONSTEXPR unsigned short
signaling_NaN() throw() { return static_cast<unsigned short>(0); }
static _GLIBCXX_CONSTEXPR unsigned short
denorm_min() throw() { return static_cast<unsigned short>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<int> specialization.
template<>
struct numeric_limits<int>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR int
min() throw() { return -__INT_MAX__ - 1; }
static _GLIBCXX_CONSTEXPR int
max() throw() { return __INT_MAX__; }
static int min() throw()
{ return -__INT_MAX__ - 1; }
static int max() throw()
{ return __INT_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static int lowest() throw()
{ return min(); }
static constexpr int
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (int);
static const int digits10 = __glibcxx_digits10 (int);
static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int);
static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static int epsilon() throw()
{ return 0; }
static int round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static int infinity() throw()
{ return static_cast<int>(0); }
static int quiet_NaN() throw()
{ return static_cast<int>(0); }
static int signaling_NaN() throw()
{ return static_cast<int>(0); }
static int denorm_min() throw()
{ return static_cast<int>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR int
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR int
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR int
infinity() throw() { return static_cast<int>(0); }
static _GLIBCXX_CONSTEXPR int
quiet_NaN() throw() { return static_cast<int>(0); }
static _GLIBCXX_CONSTEXPR int
signaling_NaN() throw() { return static_cast<int>(0); }
static _GLIBCXX_CONSTEXPR int
denorm_min() throw() { return static_cast<int>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<unsigned int> specialization.
template<>
struct numeric_limits<unsigned int>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR unsigned int
min() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned int
max() throw() { return __INT_MAX__ * 2U + 1; }
static unsigned int min() throw()
{ return 0; }
static unsigned int max() throw()
{ return __INT_MAX__ * 2U + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static unsigned int lowest() throw()
{ return min(); }
static constexpr unsigned int
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (unsigned int);
static const int digits10 = __glibcxx_digits10 (unsigned int);
static _GLIBCXX_USE_CONSTEXPR int digits
= __glibcxx_digits (unsigned int);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (unsigned int);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static unsigned int epsilon() throw()
{ return 0; }
static unsigned int round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static unsigned int infinity() throw()
{ return static_cast<unsigned int>(0); }
static unsigned int quiet_NaN() throw()
{ return static_cast<unsigned int>(0); }
static unsigned int signaling_NaN() throw()
{ return static_cast<unsigned int>(0); }
static unsigned int denorm_min() throw()
{ return static_cast<unsigned int>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR unsigned int
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned int
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR unsigned int
infinity() throw() { return static_cast<unsigned int>(0); }
static _GLIBCXX_CONSTEXPR unsigned int
quiet_NaN() throw() { return static_cast<unsigned int>(0); }
static _GLIBCXX_CONSTEXPR unsigned int
signaling_NaN() throw() { return static_cast<unsigned int>(0); }
static _GLIBCXX_CONSTEXPR unsigned int
denorm_min() throw() { return static_cast<unsigned int>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<long> specialization.
template<>
struct numeric_limits<long>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR long
min() throw() { return -__LONG_MAX__ - 1; }
static _GLIBCXX_CONSTEXPR long
max() throw() { return __LONG_MAX__; }
static long min() throw()
{ return -__LONG_MAX__ - 1; }
static long max() throw()
{ return __LONG_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static long lowest() throw()
{ return min(); }
static constexpr long
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (long);
static const int digits10 = __glibcxx_digits10 (long);
static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long);
static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static long epsilon() throw()
{ return 0; }
static long round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static long infinity() throw()
{ return static_cast<long>(0); }
static long quiet_NaN() throw()
{ return static_cast<long>(0); }
static long signaling_NaN() throw()
{ return static_cast<long>(0); }
static long denorm_min() throw()
{ return static_cast<long>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR long
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR long
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR long
infinity() throw() { return static_cast<long>(0); }
static _GLIBCXX_CONSTEXPR long
quiet_NaN() throw() { return static_cast<long>(0); }
static _GLIBCXX_CONSTEXPR long
signaling_NaN() throw() { return static_cast<long>(0); }
static _GLIBCXX_CONSTEXPR long
denorm_min() throw() { return static_cast<long>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<unsigned long> specialization.
template<>
struct numeric_limits<unsigned long>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR unsigned long
min() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned long
max() throw() { return __LONG_MAX__ * 2UL + 1; }
static unsigned long min() throw()
{ return 0; }
static unsigned long max() throw()
{ return __LONG_MAX__ * 2UL + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static unsigned long lowest() throw()
{ return min(); }
static constexpr unsigned long
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (unsigned long);
static const int digits10 = __glibcxx_digits10 (unsigned long);
static _GLIBCXX_USE_CONSTEXPR int digits
= __glibcxx_digits (unsigned long);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (unsigned long);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static unsigned long epsilon() throw()
{ return 0; }
static unsigned long round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static unsigned long infinity() throw()
{ return static_cast<unsigned long>(0); }
static unsigned long quiet_NaN() throw()
{ return static_cast<unsigned long>(0); }
static unsigned long signaling_NaN() throw()
{ return static_cast<unsigned long>(0); }
static unsigned long denorm_min() throw()
{ return static_cast<unsigned long>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR unsigned long
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned long
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR unsigned long
infinity() throw() { return static_cast<unsigned long>(0); }
static _GLIBCXX_CONSTEXPR unsigned long
quiet_NaN() throw() { return static_cast<unsigned long>(0); }
static _GLIBCXX_CONSTEXPR unsigned long
signaling_NaN() throw() { return static_cast<unsigned long>(0); }
static _GLIBCXX_CONSTEXPR unsigned long
denorm_min() throw() { return static_cast<unsigned long>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<long long> specialization.
template<>
struct numeric_limits<long long>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR long long
min() throw() { return -__LONG_LONG_MAX__ - 1; }
static _GLIBCXX_CONSTEXPR long long
max() throw() { return __LONG_LONG_MAX__; }
static long long min() throw()
{ return -__LONG_LONG_MAX__ - 1; }
static long long max() throw()
{ return __LONG_LONG_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static long long lowest() throw()
{ return min(); }
static constexpr long long
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (long long);
static const int digits10 = __glibcxx_digits10 (long long);
static _GLIBCXX_USE_CONSTEXPR int digits
= __glibcxx_digits (long long);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (long long);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static long long epsilon() throw()
{ return 0; }
static long long round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static long long infinity() throw()
{ return static_cast<long long>(0); }
static long long quiet_NaN() throw()
{ return static_cast<long long>(0); }
static long long signaling_NaN() throw()
{ return static_cast<long long>(0); }
static long long denorm_min() throw()
{ return static_cast<long long>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR long long
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR long long
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR long long
infinity() throw() { return static_cast<long long>(0); }
static _GLIBCXX_CONSTEXPR long long
quiet_NaN() throw() { return static_cast<long long>(0); }
static _GLIBCXX_CONSTEXPR long long
signaling_NaN() throw() { return static_cast<long long>(0); }
static _GLIBCXX_CONSTEXPR long long
denorm_min() throw() { return static_cast<long long>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<unsigned long long> specialization.
template<>
struct numeric_limits<unsigned long long>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR unsigned long long
min() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned long long
max() throw() { return __LONG_LONG_MAX__ * 2ULL + 1; }
static unsigned long long min() throw()
{ return 0; }
static unsigned long long max() throw()
{ return __LONG_LONG_MAX__ * 2ULL + 1; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static unsigned long long lowest() throw()
{ return min(); }
static constexpr unsigned long long
lowest() throw() { return min(); }
#endif
static const int digits = __glibcxx_digits (unsigned long long);
static const int digits10 = __glibcxx_digits10 (unsigned long long);
static _GLIBCXX_USE_CONSTEXPR int digits
= __glibcxx_digits (unsigned long long);
static _GLIBCXX_USE_CONSTEXPR int digits10
= __glibcxx_digits10 (unsigned long long);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10 = 0;
static constexpr int max_digits10 = 0;
#endif
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static unsigned long long epsilon() throw()
{ return 0; }
static unsigned long long round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static unsigned long long infinity() throw()
{ return static_cast<unsigned long long>(0); }
static unsigned long long quiet_NaN() throw()
{ return static_cast<unsigned long long>(0); }
static unsigned long long signaling_NaN() throw()
{ return static_cast<unsigned long long>(0); }
static unsigned long long denorm_min() throw()
{ return static_cast<unsigned long long>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = __glibcxx_integral_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
static _GLIBCXX_USE_CONSTEXPR int radix = 2;
static _GLIBCXX_CONSTEXPR unsigned long long
epsilon() throw() { return 0; }
static _GLIBCXX_CONSTEXPR unsigned long long
round_error() throw() { return 0; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= denorm_absent;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
static _GLIBCXX_CONSTEXPR unsigned long long
infinity() throw() { return static_cast<unsigned long long>(0); }
static _GLIBCXX_CONSTEXPR unsigned long long
quiet_NaN() throw() { return static_cast<unsigned long long>(0); }
static _GLIBCXX_CONSTEXPR unsigned long long
signaling_NaN() throw() { return static_cast<unsigned long long>(0); }
static _GLIBCXX_CONSTEXPR unsigned long long
denorm_min() throw() { return static_cast<unsigned long long>(0); }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
};
/// numeric_limits<float> specialization.
template<>
struct numeric_limits<float>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR float
min() throw() { return __FLT_MIN__; }
static _GLIBCXX_CONSTEXPR float
max() throw() { return __FLT_MAX__; }
static float min() throw()
{ return __FLT_MIN__; }
static float max() throw()
{ return __FLT_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static float lowest() throw()
{ return -__FLT_MAX__; }
static constexpr float
lowest() throw() { return -__FLT_MAX__; }
#endif
static const int digits = __FLT_MANT_DIG__;
static const int digits10 = __FLT_DIG__;
static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__;
static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10
static constexpr int max_digits10
= __glibcxx_max_digits10 (__FLT_MANT_DIG__);
#endif
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = __FLT_RADIX__;
static float epsilon() throw()
{ return __FLT_EPSILON__; }
static float round_error() throw()
{ return 0.5F; }
static const int min_exponent = __FLT_MIN_EXP__;
static const int min_exponent10 = __FLT_MIN_10_EXP__;
static const int max_exponent = __FLT_MAX_EXP__;
static const int max_exponent10 = __FLT_MAX_10_EXP__;
static const bool has_infinity = __FLT_HAS_INFINITY__;
static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
static const bool has_signaling_NaN = has_quiet_NaN;
static const float_denorm_style has_denorm
static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
static _GLIBCXX_CONSTEXPR float
epsilon() throw() { return __FLT_EPSILON__; }
static _GLIBCXX_CONSTEXPR float
round_error() throw() { return 0.5F; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss;
static float infinity() throw()
{ return __builtin_huge_valf (); }
static float quiet_NaN() throw()
{ return __builtin_nanf (""); }
static float signaling_NaN() throw()
{ return __builtin_nansf (""); }
static float denorm_min() throw()
{ return __FLT_DENORM_MIN__; }
static const bool is_iec559
= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
static const bool is_bounded = true;
static const bool is_modulo = false;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
= __glibcxx_float_has_denorm_loss;
static _GLIBCXX_CONSTEXPR float
infinity() throw() { return __builtin_huge_valf (); }
static const bool traps = __glibcxx_float_traps;
static const bool tinyness_before = __glibcxx_float_tinyness_before;
static const float_round_style round_style = round_to_nearest;
static _GLIBCXX_CONSTEXPR float
quiet_NaN() throw() { return __builtin_nanf (""); }
static _GLIBCXX_CONSTEXPR float
signaling_NaN() throw() { return __builtin_nansf (""); }
static _GLIBCXX_CONSTEXPR float
denorm_min() throw() { return __FLT_DENORM_MIN__; }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559
= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
= __glibcxx_float_tinyness_before;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_to_nearest;
};
#undef __glibcxx_float_has_denorm_loss
......@@ -1273,61 +1471,71 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<double>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR double
min() throw() { return __DBL_MIN__; }
static _GLIBCXX_CONSTEXPR double
max() throw() { return __DBL_MAX__; }
static double min() throw()
{ return __DBL_MIN__; }
static double max() throw()
{ return __DBL_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static double lowest() throw()
{ return -__DBL_MAX__; }
static constexpr double
lowest() throw() { return -__DBL_MAX__; }
#endif
static const int digits = __DBL_MANT_DIG__;
static const int digits10 = __DBL_DIG__;
static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__;
static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10
static constexpr int max_digits10
= __glibcxx_max_digits10 (__DBL_MANT_DIG__);
#endif
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = __FLT_RADIX__;
static double epsilon() throw()
{ return __DBL_EPSILON__; }
static double round_error() throw()
{ return 0.5; }
static const int min_exponent = __DBL_MIN_EXP__;
static const int min_exponent10 = __DBL_MIN_10_EXP__;
static const int max_exponent = __DBL_MAX_EXP__;
static const int max_exponent10 = __DBL_MAX_10_EXP__;
static const bool has_infinity = __DBL_HAS_INFINITY__;
static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
static const bool has_signaling_NaN = has_quiet_NaN;
static const float_denorm_style has_denorm
static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
static _GLIBCXX_CONSTEXPR double
epsilon() throw() { return __DBL_EPSILON__; }
static _GLIBCXX_CONSTEXPR double
round_error() throw() { return 0.5; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss;
static double infinity() throw()
{ return __builtin_huge_val(); }
static double quiet_NaN() throw()
{ return __builtin_nan (""); }
static double signaling_NaN() throw()
{ return __builtin_nans (""); }
static double denorm_min() throw()
{ return __DBL_DENORM_MIN__; }
static const bool is_iec559
= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
static const bool is_bounded = true;
static const bool is_modulo = false;
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
= __glibcxx_double_has_denorm_loss;
static _GLIBCXX_CONSTEXPR double
infinity() throw() { return __builtin_huge_val(); }
static _GLIBCXX_CONSTEXPR double
quiet_NaN() throw() { return __builtin_nan (""); }
static const bool traps = __glibcxx_double_traps;
static const bool tinyness_before = __glibcxx_double_tinyness_before;
static const float_round_style round_style = round_to_nearest;
static _GLIBCXX_CONSTEXPR double
signaling_NaN() throw() { return __builtin_nans (""); }
static _GLIBCXX_CONSTEXPR double
denorm_min() throw() { return __DBL_DENORM_MIN__; }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559
= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
= __glibcxx_double_tinyness_before;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_to_nearest;
};
#undef __glibcxx_double_has_denorm_loss
......@@ -1338,62 +1546,71 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<>
struct numeric_limits<long double>
{
static const bool is_specialized = true;
static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
static _GLIBCXX_CONSTEXPR long double
min() throw() { return __LDBL_MIN__; }
static _GLIBCXX_CONSTEXPR long double
max() throw() { return __LDBL_MAX__; }
static long double min() throw()
{ return __LDBL_MIN__; }
static long double max() throw()
{ return __LDBL_MAX__; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static long double lowest() throw()
{ return -__LDBL_MAX__; }
static constexpr long double
lowest() throw() { return -__LDBL_MAX__; }
#endif
static const int digits = __LDBL_MANT_DIG__;
static const int digits10 = __LDBL_DIG__;
static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__;
static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
static const int max_digits10
static _GLIBCXX_USE_CONSTEXPR int max_digits10
= __glibcxx_max_digits10 (__LDBL_MANT_DIG__);
#endif
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = __FLT_RADIX__;
static long double epsilon() throw()
{ return __LDBL_EPSILON__; }
static long double round_error() throw()
{ return 0.5L; }
static const int min_exponent = __LDBL_MIN_EXP__;
static const int min_exponent10 = __LDBL_MIN_10_EXP__;
static const int max_exponent = __LDBL_MAX_EXP__;
static const int max_exponent10 = __LDBL_MAX_10_EXP__;
static const bool has_infinity = __LDBL_HAS_INFINITY__;
static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
static const bool has_signaling_NaN = has_quiet_NaN;
static const float_denorm_style has_denorm
static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
static _GLIBCXX_CONSTEXPR long double
epsilon() throw() { return __LDBL_EPSILON__; }
static _GLIBCXX_CONSTEXPR long double
round_error() throw() { return 0.5L; }
static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__;
static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__;
static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__;
static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__;
static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__;
static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
= bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
static const bool has_denorm_loss
static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
= __glibcxx_long_double_has_denorm_loss;
static long double infinity() throw()
{ return __builtin_huge_vall (); }
static long double quiet_NaN() throw()
{ return __builtin_nanl (""); }
static long double signaling_NaN() throw()
{ return __builtin_nansl (""); }
static long double denorm_min() throw()
{ return __LDBL_DENORM_MIN__; }
static _GLIBCXX_CONSTEXPR long double
infinity() throw() { return __builtin_huge_vall (); }
static const bool is_iec559
= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
static const bool is_bounded = true;
static const bool is_modulo = false;
static _GLIBCXX_CONSTEXPR long double
quiet_NaN() throw() { return __builtin_nanl (""); }
static const bool traps = __glibcxx_long_double_traps;
static const bool tinyness_before = __glibcxx_long_double_tinyness_before;
static const float_round_style round_style = round_to_nearest;
static _GLIBCXX_CONSTEXPR long double
signaling_NaN() throw() { return __builtin_nansl (""); }
static _GLIBCXX_CONSTEXPR long double
denorm_min() throw() { return __LDBL_DENORM_MIN__; }
static _GLIBCXX_USE_CONSTEXPR bool is_iec559
= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before =
__glibcxx_long_double_tinyness_before;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
round_to_nearest;
};
#undef __glibcxx_long_double_has_denorm_loss
......
......@@ -67,16 +67,15 @@ namespace std
public:
typedef __native_type* native_handle_type;
#ifdef __GTHREAD_MUTEX_INIT
constexpr mutex() : _M_mutex(__GTHREAD_MUTEX_INIT) { }
#else
mutex()
{
// 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);
#endif
}
#endif
mutex(const mutex&) = delete;
mutex& operator=(const mutex&) = delete;
......@@ -381,9 +380,9 @@ namespace std
/// and manage it.
struct adopt_lock_t { };
extern const defer_lock_t defer_lock;
extern const try_to_lock_t try_to_lock;
extern const adopt_lock_t adopt_lock;
constexpr defer_lock_t defer_lock { };
constexpr try_to_lock_t try_to_lock { };
constexpr adopt_lock_t adopt_lock { };
/// @brief Scoped lock idiom.
// Acquire the mutex here with a constructor call, then release with
......@@ -679,11 +678,7 @@ namespace std
__native_type _M_once;
public:
once_flag()
{
__native_type __tmp = __GTHREAD_ONCE_INIT;
_M_once = __tmp;
}
constexpr once_flag() : _M_once(__GTHREAD_ONCE_INIT) { }
once_flag(const once_flag&) = delete;
once_flag& operator=(const once_flag&) = delete;
......
......@@ -155,20 +155,20 @@ namespace std
"out of range");
// 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;
static const intmax_t den =
static constexpr intmax_t den =
__static_abs<_Den>::value / __static_gcd<_Num, _Den>::value;
typedef ratio<num, den> type;
};
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>
const intmax_t ratio<_Num, _Den>::den;
constexpr intmax_t ratio<_Num, _Den>::den;
/// ratio_add
template<typename _R1, typename _R2>
......
......@@ -225,7 +225,7 @@ namespace std
typedef _Tuple_impl<0, _Elements...> _Inherited;
public:
tuple()
_GLIBCXX_CONSTEXPR tuple()
: _Inherited() { }
explicit
......
......@@ -132,13 +132,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
#endif
// Capacity.
size_type
_GLIBCXX_CONSTEXPR size_type
size() const { return _Nm; }
size_type
_GLIBCXX_CONSTEXPR size_type
max_size() const { return _Nm; }
bool
_GLIBCXX_CONSTEXPR bool
empty() const { return size() == 0; }
// Element access.
......
// 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
// software; you can redistribute it and/or modify it under the
......@@ -66,9 +66,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
template<typename _Tp, _Tp __v>
struct integral_constant
{
static const _Tp value = __v;
static _GLIBCXX_USE_CONSTEXPR _Tp value = __v;
typedef _Tp value_type;
typedef integral_constant<_Tp, __v> type;
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
constexpr operator value_type() { return value; }
#endif
};
/// typedef for true_type
......@@ -78,7 +82,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
typedef integral_constant<bool, false> false_type;
template<typename _Tp, _Tp __v>
const _Tp integral_constant<_Tp, __v>::value;
_GLIBCXX_USE_CONSTEXPR _Tp integral_constant<_Tp, __v>::value;
/// remove_cv
template<typename>
......
......@@ -72,47 +72,49 @@ namespace std
#endif
_M_i = false;
}
_GLIBCXX_BEGIN_EXTERN_C
bool
atomic_flag_test_and_set_explicit(__atomic_flag_base* __a,
memory_order __m) _GLIBCXX_NOTHROW
{
atomic_flag* d = static_cast<atomic_flag*>(__a);
return d->test_and_set(__m);
}
extern "C"
void
atomic_flag_clear_explicit(__atomic_flag_base* __a,
memory_order __m) _GLIBCXX_NOTHROW
{
bool
atomic_flag_test_and_set_explicit(__atomic_flag_base* __a,
memory_order __m) throw()
{
atomic_flag* d = static_cast<volatile atomic_flag*>(__a);
return d->test_and_set(__m);
}
atomic_flag* d = static_cast<atomic_flag*>(__a);
return d->clear(__m);
}
void
atomic_flag_clear_explicit(__atomic_flag_base* __a,
memory_order __m) throw()
{
atomic_flag* d = static_cast<volatile atomic_flag*>(__a);
return d->clear(__m);
}
void
__atomic_flag_wait_explicit(__atomic_flag_base* __a,
memory_order __x) _GLIBCXX_NOTHROW
{
while (atomic_flag_test_and_set_explicit(__a, __x))
{ };
}
void
__atomic_flag_wait_explicit(__atomic_flag_base* __a,
memory_order __x) throw()
{
while (atomic_flag_test_and_set_explicit(__a, __x))
{ };
}
_GLIBCXX_CONST __atomic_flag_base*
__atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW
{
uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
__u += (__u >> 2) + (__u << 4);
__u += (__u >> 7) + (__u << 5);
__u += (__u >> 17) + (__u << 13);
if (sizeof(uintptr_t) > 4)
__u += (__u >> 31);
__u &= ~((~uintptr_t(0)) << LOGSIZE);
return flag_table + __u;
}
__atomic_flag_base*
__atomic_flag_for_address(const void* __z) throw()
{
uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
__u += (__u >> 2) + (__u << 4);
__u += (__u >> 7) + (__u << 5);
__u += (__u >> 17) + (__u << 13);
if (sizeof(uintptr_t) > 4)
__u += (__u >> 31);
__u &= ~((~uintptr_t(0)) << LOGSIZE);
return flag_table + __u;
}
} // extern "C"
_GLIBCXX_END_EXTERN_C
} // namespace __atomic0
} // namespace std
......
......@@ -66,7 +66,8 @@ namespace
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() { }
......
......@@ -34,6 +34,8 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
#define const _GLIBCXX_USE_CONSTEXPR
const bool __numeric_limits_base::is_specialized;
const int __numeric_limits_base::digits;
const int __numeric_limits_base::digits10;
......@@ -510,6 +512,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const bool numeric_limits<char32_t>::tinyness_before;
const float_round_style numeric_limits<char32_t>::round_style;
#undef const
_GLIBCXX_END_NAMESPACE
// XXX GLIBCXX_ABI Deprecated
......
// 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
// software; you can redistribute it and/or modify it under the
......@@ -39,10 +39,6 @@ namespace
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
__thread void* __once_callable;
__thread void (*__once_call)();
......@@ -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
......@@ -3,7 +3,7 @@
// { dg-options "-std=gnu++0x" }
// { 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
// software; you can redistribute it and/or modify it under the
......@@ -44,7 +44,6 @@
#include <math.h>
#include <setjmp.h>
#include <signal.h>
#include <stdatomic.h>
#include <stdarg.h>
#ifdef _GLIBCXX_HAVE_STDBOOL_H
#include <stdbool.h>
......
// { dg-options "-x c -shared-libgcc -lstdc++" }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -17,14 +15,12 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <stdatomic.h>
#include <limits>
#include <testsuite_common_types.h>
int main()
{
atomic_flag af = ATOMIC_FLAG_INIT;
if (!atomic_flag_test_and_set_explicit(&af, memory_order_acquire))
atomic_flag_clear_explicit(&af, memory_order_release);
__gnu_test::default_constructible test;
__gnu_cxx::typelist::apply_generator(test, __gnu_test::limits_tl());
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
// software; you can redistribute it and/or modify it under the
......@@ -17,14 +17,12 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <stdatomic.h>
#include <limits>
#include <testsuite_common_types.h>
int main()
{
atomic_flag af = ATOMIC_FLAG_INIT;
if (!atomic_flag_test_and_set(&af))
atomic_flag_clear(&af);
__gnu_test::default_constructible 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_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 @@
// { dg-require-cstdint "" }
// 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
// software; you can redistribute it and/or modify it under the
......@@ -31,5 +31,5 @@ void test01()
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 }
......@@ -32,6 +32,6 @@ void test01()
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-excess-errors "In instantiation of" }
......@@ -33,5 +33,5 @@ void test01()
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-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()
}
// { dg-warning "note" "" { target *-*-* } 347 }
// { dg-warning "note" "" { target *-*-* } 466 }
// { dg-warning "note" "" { target *-*-* } 465 }
// { dg-warning "note" "" { target *-*-* } 883 }
// { dg-warning "note" "" { target *-*-* } 580 }
// { dg-warning "note" "" { target *-*-* } 1027 }
// { dg-warning "note" "" { target *-*-* } 340 }
// { 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()
}
// { dg-error "synthesized" "" { target *-*-* } 33 }
// { dg-error "within this context" "" { target *-*-* } 26 }
// { dg-error "is private" "" { target *-*-* } 788 }
// { dg-error "is private" "" { target *-*-* } 789 }
// { dg-error "operator=" "" { target *-*-* } 0 }
......@@ -34,5 +34,5 @@ void test02()
}
// { dg-error "within this context" "" { target *-*-* } 26 }
// { dg-error "synthesized" "" { target *-*-* } 33 }
// { dg-error "is private" "" { target *-*-* } 785 }
// { dg-error "is private" "" { target *-*-* } 786 }
// { dg-error "copy constructor" "" { target *-*-* } 0 }
// { dg-options "-x c" }
// { 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
// software; you can redistribute it and/or modify it under the
......@@ -18,19 +18,11 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <stdatomic.h>
#include <ios>
#include <testsuite_common_types.h>
int main()
{
atomic_flag f;
atomic_flag* p = &f;
memory_order m = memory_order_relaxed;
// For position only.
atomic_flag_test_and_set(p);
atomic_flag_test_and_set_explicit(p, m);
atomic_flag_clear(p);
atomic_flag_clear_explicit(p, m);
__gnu_test::constexpr_bitwise_operators<std::ios_base::fmtflags>();
return 0;
}
// { dg-options "-x c -D_GLIBCXX_DEBUG" }
// { 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
// software; you can redistribute it and/or modify it under the
......@@ -18,5 +18,11 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// libstdc++/36130
#include <stdatomic.h>
#include <ios>
#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
// software; you can redistribute it and/or modify it under the
......@@ -17,18 +18,11 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <cassert>
#include <stdatomic.h>
#include <ios>
#include <testsuite_common_types.h>
// libstdc++/40826
// libstdc++/40654
int main()
{
atomic_flag f = ATOMIC_FLAG_INIT;
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
__gnu_test::constexpr_bitwise_operators<std::ios_base::openmode>();
return 0;
}
......@@ -23,29 +23,68 @@
// 28.5.1
#include <regex>
#include <testsuite_hooks.h>
void
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;
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;
void
test04_constexpr()
{
using namespace std::regex_constants;
constexpr auto a1 = icase | awk;
constexpr auto a2 = icase & awk;
constexpr auto a3 = ~grep;
}
int main()
{
test01();
test02();
test03();
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 <regex>
#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::icase);
constexpr auto v2(_Ttesttype::nosubs);
constexpr auto v3(_Ttesttype::optimize);
constexpr auto v4(_Ttesttype::collate);
constexpr auto v5(_Ttesttype::ECMAScript);
constexpr auto v6(_Ttesttype::basic);
constexpr auto v7(_Ttesttype::extended);
constexpr auto v8(_Ttesttype::awk);
constexpr auto v9(_Ttesttype::grep);
constexpr auto v10(_Ttesttype::egrep);
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_data test;
test.operator()<std::regex>();
test.operator()<std::wregex>();
return 0;
}
......@@ -28,5 +28,5 @@ int main()
return 0;
}
// { dg-error "ambiguous" "" { target *-*-* } 522 }
// { dg-error "deleted" "" { target *-*-* } 544 }
// { dg-prune-output "include" }
// { 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 <atomic>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_single_value_constructible test;
// test.operator()<std::atomic<int>, int>();
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(),
__gnu_test::integral_types::type());
return 0;
}
......@@ -28,5 +28,5 @@ int main()
return 0;
}
// { dg-error "deleted" "" { target *-*-* } 561 }
// { dg-error "deleted" "" { target *-*-* } 583 }
// { dg-prune-output "include" }
......@@ -26,6 +26,6 @@ void test01()
typedef std::atomic_address test_type;
test_type t1;
test_type t2;
t1 = t2; // { dg-error "ambiguous" }
t1 = t2; // { dg-error "deleted" }
}
// { dg-prune-output "include" }
// { 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 <atomic>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_single_value_constructible test;
test.operator()<std::atomic_address, void*>();
return 0;
}
......@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <stdatomic.h>
#include <atomic>
void test01()
{
......
......@@ -29,5 +29,5 @@ int main()
return 0;
}
// { dg-error "ambiguous" "" { target *-*-* } 522 }
// { dg-error "deleted" "" { target *-*-* } 544 }
// { dg-prune-output "include" }
// { 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 <atomic>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_single_value_constructible test;
__gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type(),
__gnu_test::integral_types::type());
return 0;
}
......@@ -29,5 +29,5 @@ int main()
return 0;
}
// { dg-error "deleted" "" { target *-*-* } 561 }
// { dg-error "deleted" "" { target *-*-* } 583 }
// { dg-prune-output "include" }
......@@ -27,7 +27,7 @@ int main()
return 0;
}
// { dg-error "operator" "" { target *-*-* } 405 }
// { dg-error "operator" "" { target *-*-* } 406 }
// { dg-error "operator" "" { target *-*-* } 407 }
// { dg-error "operator" "" { target *-*-* } 427 }
// { dg-error "operator" "" { target *-*-* } 428 }
// { dg-error "operator" "" { target *-*-* } 429 }
// { dg-excess-errors "In file included from" }
......@@ -28,6 +28,6 @@ int main()
return 0;
}
// { dg-error "operator" "" { target *-*-* } 376 }
// { dg-error "operator" "" { target *-*-* } 377 }
// { dg-error "operator" "" { target *-*-* } 378 }
// { dg-error "operator" "" { target *-*-* } 384 }
// { dg-error "operator" "" { target *-*-* } 385 }
// { dg-error "operator" "" { target *-*-* } 386 }
......@@ -28,6 +28,6 @@ int main()
return 0;
}
// { dg-error "operator" "" { target *-*-* } 354 }
// { dg-error "operator" "" { target *-*-* } 355 }
// { dg-error "operator" "" { target *-*-* } 356 }
// { dg-error "operator" "" { target *-*-* } 362 }
// { dg-error "operator" "" { target *-*-* } 363 }
// { dg-error "operator" "" { target *-*-* } 364 }
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -22,24 +22,91 @@
namespace gnu
{
#ifndef ATOMIC_INTEGRAL_LOCK_FREE
# error "ATOMIC_INTEGRAL_LOCK_FREE must be a macro"
#ifndef ATOMIC_CHAR_LOCK_FREE
# error "ATOMIC_CHAR_LOCK_FREE must be a macro"
#else
# if ATOMIC_INTEGRAL_LOCK_FREE != 0 \
&& ATOMIC_INTEGRAL_LOCK_FREE != 1 && ATOMIC_INTEGRAL_LOCK_FREE != 2
# error "ATOMIC_INTEGRAL_LOCK_FREE must be 0, 1, or 2"
# if ATOMIC_CHAR_LOCK_FREE != 0 \
&& ATOMIC_CHAR_LOCK_FREE != 1 && ATOMIC_CHAR_LOCK_FREE != 2
# error "ATOMIC_CHAR_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_CHAR16_T_LOCK_FREE
# error "ATOMIC_CHAR16_T_LOCK_FREE must be a macro"
#else
# if ATOMIC_CHAR16_T_LOCK_FREE != 0 \
&& ATOMIC_CHAR16_T_LOCK_FREE != 1 && ATOMIC_CHAR16_T_LOCK_FREE != 2
# error "ATOMIC_CHAR16_T_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_CHAR32_T_LOCK_FREE
# error "ATOMIC_CHAR32_T_LOCK_FREE must be a macro"
#else
# if ATOMIC_CHAR32_T_LOCK_FREE != 0 \
&& ATOMIC_CHAR32_T_LOCK_FREE != 1 && ATOMIC_CHAR32_T_LOCK_FREE != 2
# error "ATOMIC_CHAR32_T_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_WCHAR_T_LOCK_FREE
# error "ATOMIC_WCHAR_T_LOCK_FREE must be a macro"
#else
# if ATOMIC_WCHAR_T_LOCK_FREE != 0 \
&& ATOMIC_WCHAR_T_LOCK_FREE != 1 && ATOMIC_WCHAR_T_LOCK_FREE != 2
# error "ATOMIC_WCHAR_T_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_SHORT_LOCK_FREE
# error "ATOMIC_SHORT_LOCK_FREE must be a macro"
#else
# if ATOMIC_SHORT_LOCK_FREE != 0 \
&& ATOMIC_SHORT_LOCK_FREE != 1 && ATOMIC_SHORT_LOCK_FREE != 2
# error "ATOMIC_SHORT_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_INT_LOCK_FREE
# error "ATOMIC_INT_LOCK_FREE must be a macro"
#else
# if ATOMIC_INT_LOCK_FREE != 0 \
&& ATOMIC_INT_LOCK_FREE != 1 && ATOMIC_INT_LOCK_FREE != 2
# error "ATOMIC_INT_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_LONG_LOCK_FREE
# error "ATOMIC_LONG_LOCK_FREE must be a macro"
#else
# if ATOMIC_LONG_LOCK_FREE != 0 \
&& ATOMIC_LONG_LOCK_FREE != 1 && ATOMIC_LONG_LOCK_FREE != 2
# error "ATOMIC_LONG_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_LLONG_LOCK_FREE
# error "ATOMIC_LLONG_LOCK_FREE must be a macro"
#else
# if ATOMIC_LLONG_LOCK_FREE != 0 \
&& ATOMIC_LLONG_LOCK_FREE != 1 && ATOMIC_LLONG_LOCK_FREE != 2
# error "ATOMIC_LLONG_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_ADDRESS_LOCK_FREE
# error "ATOMIC_ADDRESS_LOCK_FREE must be a macro"
# if ATOMIC_INTEGRAL_LOCK_FREE != 0 \
&& ATOMIC_INTEGRAL_LOCK_FREE != 1 && ATOMIC_INTEGRAL_LOCK_FREE != 2
# error "ATOMIC_INTEGRAL_LOCK_FREE must be 0, 1, or 2"
# if ATOMIC_ADDRESS_LOCK_FREE != 0 \
&& ATOMIC_ADDRESS_LOCK_FREE != 1 && ATOMIC_ADDRESS_LOCK_FREE != 2
# error "ATOMIC_ADDRESS_LOCK_FREE must be 0, 1, or 2"
# endif
#endif
#ifndef ATOMIC_FLAG_INIT
#error "ATOMIC_FLAG_INIT_must_be_a_macro"
#endif
#ifndef ATOMIC_VAR_INIT
#error "ATOMIC_VAR_INIT_must_be_a_macro"
#endif
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -69,7 +69,6 @@ void test01()
using std::atomic_intptr_t;
using std::atomic_uintptr_t;
using std::atomic_size_t;
using std::atomic_ssize_t;
using std::atomic_ptrdiff_t;
using std::atomic_intmax_t;
using std::atomic_uintmax_t;
......
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -49,6 +49,29 @@ void test01()
using atomic_char16_t;
using atomic_char32_t;
using atomic_int_least8_t;
using atomic_uint_least8_t;
using atomic_int_least16_t;
using atomic_uint_least16_t;
using atomic_int_least32_t;
using atomic_uint_least32_t;
using atomic_int_least64_t;
using atomic_uint_least64_t;
using atomic_int_fast8_t;
using atomic_uint_fast8_t;
using atomic_int_fast16_t;
using atomic_uint_fast16_t;
using atomic_int_fast32_t;
using atomic_uint_fast32_t;
using atomic_int_fast64_t;
using atomic_uint_fast64_t;
using atomic_intptr_t;
using atomic_uintptr_t;
using atomic_size_t;
using atomic_ptrdiff_t;
using atomic_intmax_t;
using atomic_uintmax_t;
using atomic_address;
}
......@@ -76,3 +99,72 @@ void test01()
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 49 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 50 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 52 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 53 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 54 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 55 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 56 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 57 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 58 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 59 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 60 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 61 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 62 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 63 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 64 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 65 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 66 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 67 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 68 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 69 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 70 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 71 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 72 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 73 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 75 }
// { dg-error "declared" "" { target *-*-* } 26 }
// { dg-error "declared" "" { target *-*-* } 27 }
// { dg-error "declared" "" { target *-*-* } 28 }
// { dg-error "declared" "" { target *-*-* } 29 }
// { dg-error "declared" "" { target *-*-* } 30 }
// { dg-error "declared" "" { target *-*-* } 31 }
// { dg-error "declared" "" { target *-*-* } 32 }
// { dg-error "declared" "" { target *-*-* } 34 }
// { dg-error "declared" "" { target *-*-* } 36 }
// { dg-error "declared" "" { target *-*-* } 37 }
// { dg-error "declared" "" { target *-*-* } 38 }
// { dg-error "declared" "" { target *-*-* } 39 }
// { dg-error "declared" "" { target *-*-* } 40 }
// { dg-error "declared" "" { target *-*-* } 41 }
// { dg-error "declared" "" { target *-*-* } 42 }
// { dg-error "declared" "" { target *-*-* } 43 }
// { dg-error "declared" "" { target *-*-* } 44 }
// { dg-error "declared" "" { target *-*-* } 45 }
// { dg-error "declared" "" { target *-*-* } 46 }
// { dg-error "declared" "" { target *-*-* } 47 }
// { dg-error "declared" "" { target *-*-* } 48 }
// { dg-error "declared" "" { target *-*-* } 49 }
// { dg-error "declared" "" { target *-*-* } 50 }
// { dg-error "declared" "" { target *-*-* } 52 }
// { dg-error "declared" "" { target *-*-* } 53 }
// { dg-error "declared" "" { target *-*-* } 54 }
// { dg-error "declared" "" { target *-*-* } 55 }
// { dg-error "declared" "" { target *-*-* } 56 }
// { dg-error "declared" "" { target *-*-* } 57 }
// { dg-error "declared" "" { target *-*-* } 58 }
// { dg-error "declared" "" { target *-*-* } 59 }
// { dg-error "declared" "" { target *-*-* } 60 }
// { dg-error "declared" "" { target *-*-* } 61 }
// { dg-error "declared" "" { target *-*-* } 62 }
// { dg-error "declared" "" { target *-*-* } 63 }
// { dg-error "declared" "" { target *-*-* } 64 }
// { dg-error "declared" "" { target *-*-* } 65 }
// { dg-error "declared" "" { target *-*-* } 66 }
// { dg-error "declared" "" { target *-*-* } 67 }
// { dg-error "declared" "" { target *-*-* } 68 }
// { dg-error "declared" "" { target *-*-* } 69 }
// { dg-error "declared" "" { target *-*-* } 70 }
// { dg-error "declared" "" { target *-*-* } 71 }
// { dg-error "declared" "" { target *-*-* } 72 }
// { dg-error "declared" "" { target *-*-* } 73 }
// { dg-error "declared" "" { target *-*-* } 75 }
// { dg-options "-x c" }
// { dg-do compile }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <stdatomic.h>
int main()
{
#ifndef ATOMIC_INTEGRAL_LOCK_FREE
#error "ATOMIC_INTEGRAL_LOCK_FREE_must_be_a_macro"
#endif
#ifndef ATOMIC_ADDRESS_LOCK_FREE
#error "ATOMIC_ADDRESS_LOCK_FREE_must_be_a_macro"
#endif
#ifndef ATOMIC_FLAG_INIT
#error "ATOMIC_FLAG_INIT_must_be_a_macro"
#endif
#ifndef atomic_is_lock_free
#error "atomic_is_lock_free_must_be_a_macro"
#endif
#ifndef atomic_load
#error "atomic_load_must_be_a_macro"
#endif
#ifndef atomic_load_explicit
#error "atomic_load_explicit_must_be_a_macro"
#endif
#ifndef atomic_store_explicit
#error "atomic_store_explicit_must_be_a_macro"
#endif
#ifndef atomic_store
#error "atomic_store_must_be_a_macro"
#endif
#ifndef atomic_exchange_explicit
#error "atomic_exchange_explicit_must_be_a_macro"
#endif
#ifndef atomic_exchange
#error "atomic_exchange_must_be_a_macro"
#endif
#ifndef atomic_compare_exchange
#error "atomic_compare_exchange_must_be_a_macro"
#endif
#ifndef atomic_compare_exchange_explicit
#error "atomic_compare_exchange_explicit_must_be_a_macro"
#endif
#ifndef atomic_fetch_add_explicit
#error "atomic_fetch_add_explicit_must_be_a_macro"
#endif
#ifndef atomic_fetch_add
#error "atomic_fetch_add_must_be_a_macro"
#endif
#ifndef atomic_fetch_sub_explicit
#error "atomic_fetch_sub_explicit_must_be_a_macro"
#endif
#ifndef atomic_fetch_sub
#error "atomic_fetch_sub_must_be_a_macro"
#endif
#ifndef atomic_fetch_and_explicit
#error "atomic_fetch_and_explicit_must_be_a_macro"
#endif
#ifndef atomic_fetch_and
#error "atomic_fetch_and_must_be_a_macro"
#endif
#ifndef atomic_fetch_or_explicit
#error "atomic_fetch_or_explicit_must_be_a_macro"
#endif
#ifndef atomic_fetch_or
#error "atomic_fetch_or_must_be_a_macro"
#endif
#ifndef atomic_fetch_xor_explicit
#error "atomic_fetch_xor_explicit_must_be_a_macro"
#endif
#ifndef atomic_fetch_xor
#error "atomic_fetch_xor_must_be_a_macro"
#endif
return 0;
}
// { dg-options "-x c" }
// { dg-do compile }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <stdatomic.h>
void test01()
{
typedef memory_order t_01;
memory_order t_02 __attribute__((unused)) = memory_order_relaxed;
memory_order t_03 __attribute__((unused)) = memory_order_acquire;
memory_order t_04 __attribute__((unused)) = memory_order_release;
memory_order t_05 __attribute__((unused)) = memory_order_acq_rel;
memory_order t_06 __attribute__((unused)) = memory_order_seq_cst;
typedef atomic_flag t_07;
// atomics for builtins types
typedef atomic_bool t_08;
typedef atomic_char t_09;
typedef atomic_schar t_10;
typedef atomic_uchar t_11;
typedef atomic_short t_12;
typedef atomic_ushort t_13;
typedef atomic_int t_14;
typedef atomic_uint t_15;
typedef atomic_long t_16;
typedef atomic_ulong t_17;
typedef atomic_llong t_18;
typedef atomic_ullong t_19;
typedef atomic_wchar_t t_20;
typedef atomic_char16_t t_21;
typedef atomic_char32_t t_22;
// atomics for standard typedefs
typedef atomic_int_least8_t t_23;
typedef atomic_uint_least8_t t_24;
typedef atomic_int_least16_t t_25;
typedef atomic_uint_least16_t t_26;
typedef atomic_int_least32_t t_27;
typedef atomic_uint_least32_t t_28;
typedef atomic_int_least64_t t_29;
typedef atomic_uint_least64_t t_30;
typedef atomic_int_fast8_t t_31;
typedef atomic_uint_fast8_t t_32;
typedef atomic_int_fast16_t t_33;
typedef atomic_uint_fast16_t t_34;
typedef atomic_int_fast32_t t_35;
typedef atomic_uint_fast32_t t_36;
typedef atomic_int_fast64_t t_37;
typedef atomic_uint_fast64_t t_38;
typedef atomic_intptr_t t_39;
typedef atomic_uintptr_t t_40;
typedef atomic_size_t t_41;
typedef atomic_ssize_t t_42;
typedef atomic_ptrdiff_t t_43;
typedef atomic_intmax_t t_44;
typedef atomic_uintmax_t t_45;
typedef atomic_address t_46;
}
// { 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 <mutex>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test;
test.operator()<std::mutex>();
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 <mutex>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test;
test.operator()<std::mutex>();
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 <mutex>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::constexpr_default_constructible test;
test.operator()<std::once_flag>();
return 0;
}
......@@ -22,4 +22,4 @@
#include <vector>
// { dg-error "Cannot use -D_GLIBCXX_PROFILE with " "" { target *-*-* } 196 }
// { dg-error "Cannot use -D_GLIBCXX_PROFILE with " "" { target *-*-* } 223 }
// { 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 <type_traits>
#include <testsuite_common_types.h>
namespace __gnu_test
{
struct constexpr_member_data
{
template<typename _Ttesttype>
void
operator()()
{
struct _Concept
{
void __constraint()
{
constexpr auto v(_Ttesttype::value);
}
};
_Concept c;
c.__constraint();
}
};
}
int main()
{
__gnu_test::constexpr_member_data test;
test.operator()<std::integral_constant<unsigned short, 69>>();
test.operator()<std::integral_constant<bool, true>>();
return 0;
}
......@@ -193,6 +193,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("GLIBCXX_3.4.13");
known_versions.push_back("GLIBCXX_3.4.14");
known_versions.push_back("GLIBCXX_3.4.15");
known_versions.push_back("GLIBCXX_3.4.16");
known_versions.push_back("GLIBCXX_LDBL_3.4");
known_versions.push_back("GLIBCXX_LDBL_3.4.7");
known_versions.push_back("GLIBCXX_LDBL_3.4.10");
......
......@@ -339,6 +339,14 @@ namespace __gnu_test
typedef transform<integral_types::type, atomics>::type atomics_tl;
#endif
template<typename Tp>
struct numeric_limits
{
typedef Tp value_type;
typedef std::numeric_limits<value_type> type;
};
typedef transform<integral_types::type, numeric_limits>::type limits_tl;
struct has_increment_operators
{
......@@ -384,6 +392,20 @@ namespace __gnu_test
}
};
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Tp>
void
constexpr_bitwise_operators()
{
constexpr _Tp a = _Tp();
constexpr _Tp b = _Tp();
constexpr _Tp c1 = a | b;
constexpr _Tp c2 = a & b;
constexpr _Tp c3 = a ^ b;
constexpr _Tp c4 = ~b;
}
#endif
template<typename _Tp>
void
bitwise_operators()
......@@ -588,6 +610,53 @@ namespace __gnu_test
}
};
// Generator to test constexpr constructor
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// Generator to test default constructor.
struct constexpr_default_constructible
{
template<typename _Tp>
void
operator()()
{
struct _Concept
{
// Have to have user-defined default ctor for this to work.
void __constraint()
{ constexpr _Tp __v; }
};
void (_Concept::*__x)() __attribute__((unused))
= &_Concept::__constraint;
}
};
struct constexpr_single_value_constructible
{
template<typename _Ttesttype, typename _Tbasetype>
void
operator()()
{
struct _Concept
{
// Additional constraint on _Tbasetype needed.
// Either assume user-defined default ctor as per
// constexpr_default_constructible and provide no
// initializer, provide an initializer, or assume empty-list
// init-able. Choose the latter.
void __constraint()
{
constexpr _Tbasetype __v { };
constexpr _Ttesttype __t(__v);
}
};
_Concept c;
c.__constraint();
}
};
#endif
// Generator to test direct list initialization
#ifdef __GXX_EXPERIMENTAL_CXX0X__
struct direct_list_initializable
......
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