Commit Graph

644 Commits

Author SHA1 Message Date
Alexandre Oliva c787deb012 skip Cholesky decomposition in is>>n_mv_dist
normal_mv_distribution maintains the variance-covariance matrix param
in Cholesky-decomposed form.  Existing param_type constructors, when
taking a full or lower-triangle varcov matrix, perform Cholesky
decomposition to convert it to the internal representation.  This
internal representation is visible both in the varcov() result, and in
the streamed-out representation of a normal_mv_distribution object.

The problem is that when that representation is streamed back in, the
read-back decomposed varcov matrix is used as a lower-triangle
non-decomposed varcov matrix, and it undergoes Cholesky decomposition
again.  So, each cycle of stream-out/stream-in changes the varcov
matrix to its "square root", instead of restoring the original
params.

This patch includes Corentin's changes that introduce verification in
testsuite/ext/random/normal_mv_distribution/operators/serialize.cc and
other similar tests that the object read back in compares equal to the
written-out object: the modified tests pass only if (u == v).

This patch also fixes the error exposed by his change, introducing an
alternate private constructor for param_type, used only by operator>>.


for  libstdc++-v3/ChangeLog

	* include/ext/random
	(normal_mv_distribution::param_type::param_type): New private
	ctor taking a decomposed varcov matrix, for use by...
	(operator>>): ... this, befriended.
	* include/ext/random.tcc (operator>>): Use it.
	(normal_mv_distribution::param_type::_M_init_lower): Adjust
	member function name in exception message.

for  libstdc++-v3/ChangeLog
from  Corentin Gay  <gay@adacore.com>

	* testsuite/ext/random/beta_distribution/operators/serialize.cc,
	testsuite/ext/random/hypergeometric_distribution/operators/serialize.cc,
	testsuite/ext/random/normal_mv_distribution/operators/serialize.cc,
	testsuite/ext/random/triangular_distribution/operators/serialize.cc,
	testsuite/ext/random/von_mises_distribution/operators/serialize.cc:
	Add call to `VERIFY`.

From-SVN: r274233
2019-08-09 09:20:58 +00:00
Jonathan Wakely a10b664eb7 Fix recent regression in __atomic_add_dispatch
* include/ext/atomicity.h (__exchange_and_add, __atomic_add): Replace
	throw() with _GLIBCXX_NOTHROW.
	(__atomic_add_dispatch): Return after performing atomic increment.

From-SVN: r273167
2019-07-06 22:16:38 +01:00
Jonathan Wakely 0dc7adb037 Fix ODR violations in code using <ext/atomicity.h>
Because the inline versions of __exchange_and_add and __atomic_add are
also marked static, they cannot be used from templates or other inline
functions without ODR violations. This change gives them external
linkage, but adds the always_inline attribute.

    	* include/ext/atomicity.h [_GLIBCXX_ATOMIC_BUILTINS] (__atomic_add)
    	(__exchange_and_add): Replace static specifier with always_inline
    	attribute.
    	(__exchange_and_add_single, __atomic_add_single): Likewise.
    	(__exchange_and_add_dispatch, __atomic_add_dispatch): Likewise. Also
    	combine !__gthread_active_p() and !__GTHREADS branches.

From-SVN: r273144
2019-07-05 17:10:47 +01:00
Jonathan Wakely 3263fb9c6b Remove using-declarations that add std names to __gnu_cxx
These using-declarations appear to have been added for simplicity when
moving the non-standard extensions from namespace std to namespace
__gnu_cxx. Dumping all these names into namespace __gnu_cxx allows
unportable uses like __gnu_cxx::size_t and __gnu_cxx::pair, which serve
no useful purpose.

This patch removes most of the using-declarations from namespace scope,
then either qualifies names as needed or adds using-declarations at
block scope or typedefs at class scope.

	* include/backward/hashtable.h (size_t, ptrdiff_t)
	(forward_iterator_tag, input_iterator_tag, _Construct, _Destroy)
	(distance, vector, pair, __iterator_category): Remove
	using-declarations that add these names to namespace __gnu_cxx.
	* include/ext/bitmap_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/debug_allocator.h (size_t): Likewise.
	* include/ext/functional (size_t, unary_function, binary_function)
	(mem_fun1_t, const_mem_fun1_t, mem_fun1_ref_t, const_mem_fun1_ref_t):
	Likewise.
	* include/ext/malloc_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/memory (ptrdiff_t, pair, __iterator_category): Likewise.
	* include/ext/mt_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/new_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/numeric (iota): Fix outdated comment.
	* include/ext/pool_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/rb_tree (_Rb_tree, allocator): Likewise.
	* include/ext/rope (size_t, ptrdiff_t, allocator, _Destroy): Likewise.
	* include/ext/ropeimpl.h (size_t, printf, basic_ostream)
	(__throw_length_error, _Destroy, std::__uninitialized_fill_n_a):
	Likewise.
	* include/ext/slist (size_t, ptrdiff_t, _Construct, _Destroy)
	(allocator, __true_type, __false_type): Likewise.

From-SVN: r271807
2019-05-31 11:35:07 +01:00
Pádraig Brady e5178b986a std::allocator::deallocate support sized-deallocation
Pass the size to the allocator so that it may optimize deallocation.
This was seen to significantly reduce the work required in jemalloc,
with about 40% reduction in CPU cycles in the free path.

Note jemalloc >= 5.2 is required to fix a crash with 0 sizes.

2019-05-20  Pádraig Brady  <pbrady@fb.com>

	* libstdc++-v3/include/ext/new_allocator.h (deallocate): Pass the size
	to the deallocator with -fsized-deallocation.

From-SVN: r271409
2019-05-20 12:15:03 +01:00
Jonathan Wakely 0d09ca2550 Remove array_allocator extension, deprecated since 4.9.0
This type is not a conforming allocator, because it cannot be reliably
rebound to allocate for a different type. The result of the rebind
transformation still uses the same underlying std::tr1::array<T, 1>
array, which may not be correctly aligned or even have elements the
right size for the value_type of the rebound allocator.

It has been deprecated for several years and should now be removed.

	* doc/xml/manual/allocator.xml: Remove documentation for
	array_allocator.
	* doc/xml/manual/evolution.xml: Document array_allocator removal.
	* doc/xml/manual/using.xml: Remove header from documentation.
	* include/Makefile.am: Remove <ext/array_allocator.h> header.
	* include/Makefile.in: Regenerate.
	* include/ext/array_allocator.h: Remove.
	* include/precompiled/extc++.h: Do not include removed header.
	* testsuite/ext/array_allocator/1.cc: Remove.
	* testsuite/ext/array_allocator/2.cc: Remove.
	* testsuite/ext/array_allocator/26875.cc: Remove.
	* testsuite/ext/array_allocator/3.cc: Remove.
	* testsuite/ext/array_allocator/check_deallocate_null.cc: Remove.
	* testsuite/ext/array_allocator/check_delete.cc: Remove.
	* testsuite/ext/array_allocator/check_new.cc: Remove.
	* testsuite/ext/array_allocator/variadic_construct.cc: Remove.
	* testsuite/ext/headers.cc: Do not include removed header.

From-SVN: r271119
2019-05-13 11:49:58 +01:00
Jonathan Wakely 56e5b093de Avoid -Woverflow warning in __numeric_limits_integer
This is the same fix as was done for std::numeric_limits in r183905.

	PR libstdc++/52119
	* include/ext/numeric_traits.h (__glibcxx_min): Avoid integer
	overflow warning with -Wpedantic -Wsystem-headers.

From-SVN: r270858
2019-05-03 20:13:31 +01:00
Jonathan Wakely 574dfb67be Adjust Doxygen processing of pb_ds containers
Several of the pb_ds headers are intended to be included multiple times,
within the definition of various class templates. The including files
define macros like PB_DS_CLASS_C_DEC and PB_DS_GEN_POS before including
these headers.

In some cases the types defined in the headers are actually nested types
within other classes, and so should not have been documented as though
they are declared in the global namespace, as in:
https://gcc.gnu.org/onlinedocs/gcc-8.3.0/libstdc++/api/a12028.html

In other cases the headers provide inline member function definitions,
but when processed by Doxygen the class name "PB_DS_CLASS_C_DEC" is not
recognised.

This patch makes Doxygen ignore definitions that only make sense when
included in the right context with the right macros defined.

	* include/ext/pb_ds/detail/bin_search_tree_/*_imps.hpp: Do not define
	anything unless PB_DS_CLASS_C_DEC is defined.
	* include/ext/pb_ds/detail/binary_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/binomial_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/binomial_heap_base_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/hash_fn/*_imp.hpp: Likewise.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/*_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/list_update_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/pairing_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/pat_trie_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/rb_tree_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/rc_binomial_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/resize_policy*_imp.hpp: Likewise.
	* include/ext/pb_ds/detail/splay_tree_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/thin_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/trie_policy*_imp.hpp: Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp:
	Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/iterator.hpp: Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp:
	Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp:
	Likewise.

From-SVN: r270803
2019-05-02 16:44:46 +01:00
Tom Honermann 65bbaf3125 Disambiguate __gnu_cxx::append_ partial specialization
This patch corrects ambiguous partial specializations of
typelist::detail::append_.  Previously, neither append_<chain<Hd, Tl>,
Typelist_Chain> nor append_<Typelist_Chain, null_type> was a better
match for append_<chain<Hd, Tl>, null_type>.

2019-02-22  Tom Honermann  <tom@honermann.net>

	* include/ext/typelist.h: Constrain a partial specialization of
	typelist::detail::append_ to only match chain<T1,T2>.

From-SVN: r269088
2019-02-22 01:15:58 +00:00
Ulrich Drepper d715f55431 Fix after P0600.
gcc/testsuite/ChangeLog
2019-02-20  Ulrich Drepper  <drepper@redhat.com>

	Fix after P0600.
	* g++.dg/init/new39.C: Don't just ignore result of new.

libstdc++/ChangeLog
2019-02-20  Ulrich Drepper  <drepper@redhat.com>

	Implement C++20 P0600r1.
	* include/backward/hash_map: Add nodiscard attribute to empty.
	* include/backward/hash_set: Likewise.
	* backward/hashtable.h: Likewise.
	* include/bits/basic_string.h: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/hashtable.h: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_queue.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/stl_stack.h: Likewise.
	* include/bits/stl_tree.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/debug/array: Likewise.
	* include/experimental/any: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/string_view: Likewise.
	* include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp:
	Likewise.
	*
include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hp:
	Likewise.
	* include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp:
	Likewise.
	* include/ext/pb_ds/detail/tree_trace_base.hpp: Likewise.
	* include/ext/pb_ds/trie_policy.hpp: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/slist: Likewise.
	* include/ext/vstring.h: Likewise.
	* include/profile/array: Likewise.
	* include/std/array: Likewise.
	* include/tr1/array: Likewise.
	* include/tr1/hashtable.h: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr2/dynamic_bitset: Likewise.
	* include/bits/alloc_traits.h: Add nodiscard attribute to
	allocate.
	* include/experimental/memory_resource: Likewise.
	* include/ext/alloc_traits.h: Likewise.
	* include/ext/array_allocator.h: Likewise.
	* include/ext/bitmap_allocator.h: Likewise.
	* include/ext/debug_allocator.h: Likewise.
	* include/ext/extptr_allocator.h: Likewise.
	* include/ext/mt_allocator.h: Likewise.
	* include/ext/new_allocator.h: Likewise.
	* include/ext/pool_allocator.h: Likewise.
	* include/ext/throw_allocator.h: Likewise.
	* include/std/scoped_allocator: Likewise.
	* libsupc++/eh_alloc.cc: Likewise.
	* include/std/future: Add nodiscard attribute to async.
	* libsupc++/new: Add nodiscard attribute to new.

From-SVN: r268111
2019-01-21 11:47:30 +00:00
Sandra Loosemore 6791469314 PR other/16615 [1/5]
2019-01-09  Sandra Loosemore  <sandra@codesourcery.com>

	PR other/16615 [1/5]

	contrib/
	* mklog: Mechanically replace "can not" with "cannot".

	gcc/
	* Makefile.in: Mechanically replace "can not" with "cannot".
	* alias.c: Likewise.
	* builtins.c: Likewise.
	* calls.c: Likewise.
	* cgraph.c: Likewise.
	* cgraph.h: Likewise.
	* cgraphclones.c: Likewise.
	* cgraphunit.c: Likewise.
	* combine-stack-adj.c: Likewise.
	* combine.c: Likewise.
	* common/config/i386/i386-common.c: Likewise.
	* config/aarch64/aarch64.c: Likewise.
	* config/alpha/sync.md: Likewise.
	* config/arc/arc.c: Likewise.
	* config/arc/predicates.md: Likewise.
	* config/arm/arm-c.c: Likewise.
	* config/arm/arm.c: Likewise.
	* config/arm/arm.h: Likewise.
	* config/arm/arm.md: Likewise.
	* config/arm/cortex-r4f.md: Likewise.
	* config/csky/csky.c: Likewise.
	* config/csky/csky.h: Likewise.
	* config/darwin-f.c: Likewise.
	* config/epiphany/epiphany.md: Likewise.
	* config/i386/i386.c: Likewise.
	* config/i386/sol2.h: Likewise.
	* config/m68k/m68k.c: Likewise.
	* config/mcore/mcore.h: Likewise.
	* config/microblaze/microblaze.md: Likewise.
	* config/mips/20kc.md: Likewise.
	* config/mips/sb1.md: Likewise.
	* config/nds32/nds32.c: Likewise.
	* config/nds32/predicates.md: Likewise.
	* config/pa/pa.c: Likewise.
	* config/rs6000/e300c2c3.md: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/s390/s390.h: Likewise.
	* config/sh/sh.c: Likewise.
	* config/sh/sh.md: Likewise.
	* config/spu/vmx2spu.h: Likewise.
	* cprop.c: Likewise.
	* dbxout.c: Likewise.
	* df-scan.c: Likewise.
	* doc/cfg.texi: Likewise.
	* doc/extend.texi: Likewise.
	* doc/fragments.texi: Likewise.
	* doc/gty.texi: Likewise.
	* doc/invoke.texi: Likewise.
	* doc/lto.texi: Likewise.
	* doc/md.texi: Likewise.
	* doc/objc.texi: Likewise.
	* doc/rtl.texi: Likewise.
	* doc/tm.texi: Likewise.
	* dse.c: Likewise.
	* emit-rtl.c: Likewise.
	* emit-rtl.h: Likewise.
	* except.c: Likewise.
	* expmed.c: Likewise.
	* expr.c: Likewise.
	* fold-const.c: Likewise.
	* genautomata.c: Likewise.
	* gimple-fold.c: Likewise.
	* hard-reg-set.h: Likewise.
	* ifcvt.c: Likewise.
	* ipa-comdats.c: Likewise.
	* ipa-cp.c: Likewise.
	* ipa-devirt.c: Likewise.
	* ipa-fnsummary.c: Likewise.
	* ipa-icf.c: Likewise.
	* ipa-inline-transform.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-polymorphic-call.c: Likewise.
	* ipa-profile.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* ipa-reference.c: Likewise.
	* ipa-split.c: Likewise.
	* ipa-visibility.c: Likewise.
	* ipa.c: Likewise.
	* ira-build.c: Likewise.
	* ira-color.c: Likewise.
	* ira-conflicts.c: Likewise.
	* ira-costs.c: Likewise.
	* ira-int.h: Likewise.
	* ira-lives.c: Likewise.
	* ira.c: Likewise.
	* ira.h: Likewise.
	* loop-invariant.c: Likewise.
	* loop-unroll.c: Likewise.
	* lower-subreg.c: Likewise.
	* lra-assigns.c: Likewise.
	* lra-constraints.c: Likewise.
	* lra-eliminations.c: Likewise.
	* lra-lives.c: Likewise.
	* lra-remat.c: Likewise.
	* lra-spills.c: Likewise.
	* lra.c: Likewise.
	* lto-cgraph.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* postreload-gcse.c: Likewise.
	* predict.c: Likewise.
	* profile-count.h: Likewise.
	* profile.c: Likewise.
	* recog.c: Likewise.
	* ree.c: Likewise.
	* reload.c: Likewise.
	* reload1.c: Likewise.
	* reorg.c: Likewise.
	* resource.c: Likewise.
	* rtl.def: Likewise.
	* rtl.h: Likewise.
	* rtlanal.c: Likewise.
	* sched-deps.c: Likewise.
	* sched-ebb.c: Likewise.
	* sched-rgn.c: Likewise.
	* sel-sched-ir.c: Likewise.
	* sel-sched.c: Likewise.
	* shrink-wrap.c: Likewise.
	* simplify-rtx.c: Likewise.
	* symtab.c: Likewise.
	* target.def: Likewise.
	* toplev.c: Likewise.
	* tree-call-cdce.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-complex.c: Likewise.
	* tree-core.h: Likewise.
	* tree-eh.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-alias.c: Likewise.
	* tree-ssa-dce.c: Likewise.
	* tree-ssa-dom.c: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-phionlycprop.c: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-uninit.c: Likewise.
	* tree-ssanames.c: Likewise.
	* tree-streamer-out.c: Likewise.
	* tree.c: Likewise.
	* tree.h: Likewise.
	* vr-values.c: Likewise.

	gcc/ada/
	* exp_ch9.adb: Mechanically replace "can not" with "cannot".
	* libgnat/s-regpat.ads: Likewise.
	* par-ch4.adb: Likewise.
	* set_targ.adb: Likewise.
	* types.ads: Likewise.

	gcc/cp/
	* cp-tree.h: Mechanically replace "can not" with "cannot".
	* parser.c: Likewise.
	* pt.c: Likewise.

	gcc/fortran/
	* class.c: Mechanically replace "can not" with "cannot".
	* decl.c: Likewise.
	* expr.c: Likewise.
	* gfc-internals.texi: Likewise.
	* intrinsic.texi: Likewise.
	* invoke.texi: Likewise.
	* io.c: Likewise.
	* match.c: Likewise.
	* parse.c: Likewise.
	* primary.c: Likewise.
	* resolve.c: Likewise.
	* symbol.c: Likewise.
	* trans-array.c: Likewise.
	* trans-decl.c: Likewise.
	* trans-intrinsic.c: Likewise.
	* trans-stmt.c: Likewise.

	gcc/go/
	* go-backend.c: Mechanically replace "can not" with "cannot".
	* go-gcc.cc: Likewise.

	gcc/lto/
	* lto-partition.c: Mechanically replace "can not" with "cannot".
	* lto-symtab.c: Likewise.
	* lto.c: Likewise.

	gcc/objc/
	* objc-act.c: Mechanically replace "can not" with "cannot".

	libbacktrace/
	* backtrace.h: Mechanically replace "can not" with "cannot".

	libgcc/
	* config/c6x/libunwind.S: Mechanically replace "can not" with
	"cannot".
	* config/tilepro/atomic.h: Likewise.
	* config/vxlib-tls.c: Likewise.
	* generic-morestack-thread.c: Likewise.
	* generic-morestack.c: Likewise.
	* mkmap-symver.awk: Likewise.

	libgfortran/
	* caf/single.c: Mechanically replace "can not" with "cannot".
	* io/unit.c: Likewise.

	libobjc/
	* class.c: Mechanically replace "can not" with "cannot".
	* objc/runtime.h: Likewise.
	* sendmsg.c: Likewise.

	liboffloadmic/
	* include/coi/common/COIResult_common.h: Mechanically replace
	"can not" with "cannot".
	* include/coi/source/COIBuffer_source.h: Likewise.

	libstdc++-v3/
	* include/ext/bitmap_allocator.h: Mechanically replace "can not"
	with "cannot".

From-SVN: r267783
2019-01-09 16:37:45 -05:00
Jonathan Wakely 9f5391ee95 PR libstdc++/88066 use <> for includes not ""
Using #include "..." to include a header in the same directory fails if
the user compiles with -I-, so always use something like <bits/...> for
internal headers.

I haven't added tests for this, because dg-options adds options to the
end, and the position of -I- matters (if it's at the end then the tests
won't find any headers in the build tree, as they're specified by -I
options earlier in the flags). It's been manually tested though.

	PR libstdc++/88066
	* include/bits/locale_conv.h: Use <> for includes not "".
	* include/ext/random: Likewise.
	* include/ext/vstring.h: Likewise.

From-SVN: r267726
2019-01-08 13:25:19 +00:00
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Jonathan Wakely 8c9b385288 PR libstdc++/88119 use alignof in std::alignment_of, not __alignof__
Now that __alignof__ and alignof sometimes disagree it matters which one
we use. The standard says that std::alignment_of<T>::value equals
alignof(T), so we need to use that.

Change the only uses of alignment_of to use __alignof__ to avoid a
change in alignment.

	PR libstdc++/88119
	* include/ext/aligned_buffer.h (__aligned_membuf): Add comment.
	(__aligned_buffer): Use __alignof__ instead of std::alignment_of.
	* include/std/type_traits (alignment_of): Use alignof instead of
	__alignof__.
	* testsuite/20_util/alignment_of/value.cc: Fix test to check values
	match alignof not __alignof__, as required by the standard.

From-SVN: r266613
2018-11-29 12:32:57 +00:00
Jonathan Wakely da29d2a36e PR libstdc++/67843 set shared_ptr lock policy at build-time
This resolves a longstanding issue where the lock policy for shared_ptr
reference counting depends on compilation options when the header is
included, so that different -march options can cause ABI changes. For
example, objects compiled with -march=armv7 will use atomics to
synchronize reference counts, and objects compiled with -march=armv5t
will use a mutex. That means the shared_ptr control block will have a
different layout in different objects, causing ODR violations and
undefined behaviour. This was the root cause of PR libstdc++/42734 as
well as PR libstdc++/67843.

The solution is to decide on the lock policy at build time, when
libstdc++ is configured. The configure script checks for the
availability of the necessary atomic built-ins for the target and fixes
that choice permanently. Different -march flags used to compile user
code will not cause changes to the lock policy. This results in an ABI
change for certain compilations, but only where there was already an ABI
incompatibility between the libstdc++.so library and objects built with
an incompatible -march option. In general, this means a more stable ABI
that isn't silently altered when -march flags make addition atomic ops
available.

To force a target to use "atomic" or "mutex" the new configure option
--with-libstdcxx-lock-policy can be used.

In order to turn ODR violations into linker errors, the uses of
shared_ptr in filesystem directory iterators have been replaced
with __shared_ptr, and explicit instantiations are declared. This
ensures that object files using those types cannot link to libstdc++
libs unless they use the same lock policy.

	PR libstdc++/67843
	* acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY): Add new macro
	that defines _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_ENABLE_LOCK_POLICY.
	* doc/xml/manual/configure.xml: Document new configure option.
	* include/bits/fs_dir.h (directory_iterator): Use __shared_ptr
	instead of shared_ptr.
	(recursive_directory_iterator): Likewise.
	(__shared_ptr<_Dir>): Add explicit instantiation declaration.
	(__shared_ptr<recursive_directory_iterator::_Dir_stack>): Likewise.
	* include/bits/shared_ptr_base.h (__allocate_shared, __make_shared):
	Add default template argument for _Lock_policy template parameter.
	* include/ext/concurrence.h (__default_lock_policy): Check macro
	_GLIBCXX_HAVE_ATOMIC_LOCK_POLICY instead of checking if the current
	target supports the builtins for compare-and-swap.
	* src/filesystem/std-dir.cc (__shared_ptr<_Dir>): Add explicit
	instantiation definition.
	(__shared_ptr<recursive_directory_iterator::_Dir_stack>): Likewise.
	(directory_iterator, recursive_directory_iterator): Use __make_shared
	instead of make_shared.

From-SVN: r266533
2018-11-27 23:25:56 +00:00
François Dumont 0da4824836 2018-11-19 François Dumont <fdumont@gcc.gnu.org>
* include/ext/throw_allocator.h
	(annotate_base::insert(void*, size_t)): Use insert result to check for
	double insert attempt.
	(annotate_base::insert_construct(void*)): Likewise.
	(annotate_base::check_allocated(void*, size_t)): Return found iterator.
	(annotate_base::erase(void*, size_t)): Use latter method returned
	iterator.
	(annotate_base::check_constructed(void*, size_t)): Return found iterator.
	(annotate_base::erase_construct(void*)): Use latter method returned
	iterator.

From-SVN: r266284
2018-11-19 21:02:17 +00:00
Marc Glisse 0f317ef762 Relocation (= move+destroy)
2018-10-25  Marc Glisse  <marc.glisse@inria.fr>

	PR libstdc++/87106
	* include/bits/alloc_traits.h (_S_construct, _S_destroy, construct,
	destroy): Add noexcept specification.
	* include/bits/allocator.h (construct, destroy): Likewise.
	* include/ext/alloc_traits.h (construct, destroy): Likewise.
	* include/ext/malloc_allocator.h (construct, destroy): Likewise.
	* include/ext/new_allocator.h (construct, destroy): Likewise.
	* include/bits/stl_uninitialized.h (__relocate_object_a, __relocate_a,
	__relocate_a_1): New functions.
	(__is_trivially_relocatable): New class.
	* include/bits/stl_vector.h (__use_relocate): New static member.
	* include/bits/vector.tcc (reserve, _M_realloc_insert,
	_M_default_append): Use __relocate_a.
	(reserve, _M_assign_aux, _M_realloc_insert, _M_fill_insert,
	_M_default_append, _M_range_insert): Move _GLIBCXX_ASAN_ANNOTATE_REINIT
	after _Destroy.
	* testsuite/23_containers/vector/modifiers/push_back/49836.cc:
	Replace CopyConsOnlyType with DelAnyAssign.

From-SVN: r265485
2018-10-25 13:03:13 +00:00
Jonathan Wakely c7790bdbd9 Make ext allocators support heterogeneous equality comparison
The Allocator requirements include the ability to compare different
specializations of the same allocator class template. This did not work
for __gnu_cxx::new_allocator and other extension allocators.  This patch
replaces the equality operators for those allocators with inline friends
that support heterogeneous comparisons.  (I'm not changing all ext
allocators because some are bit-rotted already).

Additionally, the equality operators for comparing two std::allocator
objects of the same type are now defined as inline friends. Those
overloads don't need to be declared at namespace scope, because they
aren't specified in the standard (but they're needed in this
implementation to avoid ambiguities caused by the extra overloads
defined for the base allocator type).

	* include/bits/allocator.h
	(operator==(const allocator<_Tp>&, const allocator<_Tp>))
	(operator!=(const allocator<_Tp>&, const allocator<_Tp>)): Replace
	with inline friends.
	* include/ext/debug_allocator.h (operator==, operator!=): Replace
	with inline friend functions that compare to rebound allocators.
	* include/ext/malloc_allocator.h (operator==, operator!=): Likewise.
	* include/ext/new_allocator.h (operator==, operator!=): Likewise.
	* testsuite/ext/debug_allocator/eq.cc: New test.
	* testsuite/ext/ext_pointer/alloc_eq.cc: New test.
	* testsuite/ext/malloc_allocator/eq.cc: New test.
	* testsuite/ext/new_allocator/eq.cc: New test.

From-SVN: r265036
2018-10-11 12:32:29 +01:00
Jonathan Wakely 422a9f7789 PR libstdc++/87544 limit max_size() to PTRDIFF_MAX / sizeof(T)
The C++17 standard requires the default implementation for
allocator_traits::max_size to return SIZE_MAX / sizeof(value_type).
That causes GCC to warn because the value could be larger than can
sensibly be passed to malloc. This patch changes the new_allocator and
malloc_allocator max_size() members to use PTRDIFF_MAX instead of
SIZE_MAX (and because they define it, the allocator_traits default isn't
used). This also changes vector::max_size to impose a sensible limit
using PTRDIFF_MAX for cases where the value from the allocator or
allocator_traits is not sensible.

	PR libstdc++/87544
	* include/bits/stl_vector.h (vector::_S_max_size): Limit size to
	PTRDIFF_MAX / sizeof(value_type).
	* include/ext/malloc_allocator.h (malloc_allocator::max_size):
	Likewise.
	* include/ext/new_allocator.h (new_allocator::max_size): Likewise.
	* testsuite/23_containers/vector/allocator/minimal.cc: Adjust
	expected value for max_size().
	* testsuite/23_containers/vector/capacity/87544.cc: New test.

From-SVN: r265021
2018-10-10 16:39:33 +01:00
Jonathan Wakely 4a559e91b1 Fix __gnu_cxx::_Pointer_adapter for long long arithmetic
* include/ext/pointer.h (_Pointer_adapter): Define operators for
	pointer arithmetic using long long offsets.
	* testsuite/ext/ext_pointer/1.cc: Test pointer arithmetic using
	long long values.

From-SVN: r263976
2018-08-30 13:24:06 +01:00
Jeremy Sawicki 3ffa55de60 Rope iterators: don't retain pointers when copied
Rope iterators sometimes contain pointers to an internal buffer
inside the iterator itself.  When such an iterator is copied, the
copy incorrectly retains pointers to the original.

This patch takes the simple approach of not copying the cached
information when the internal buffer is being used, instead
requiring it to be recomputed when the copied iterator is
dereferenced.  An alternative would be to adjust the pointers so
they refer to the buffer in the copy.

2018-08-14  Jeremy Sawicki  <jeremy-gcc@sawicki.us>

	* include/ext/rope (_Rope_iterator_base(const _Rope_iterator_base&))
	(_Rope_const_iterator::operator=(const _Rope_const_iterator&))
	(_Rope_iterator::operator=(const _Rope_iterator&)): Ensure
	copied/assigned rope iterators don't retain pointers to the iterator
	they were copied/assigned from.
	* testsuite/ext/rope/7.cc: New.

From-SVN: r263534
2018-08-14 12:23:50 +01:00
Jonathan Wakely 77a6c969e9 Replace safe bool idiom with explicit operator bool
* include/ext/pointer.h [__cplusplus >= 201103L]
	(_Pointer_adapter::operator bool): Add explicit conversion operator
	to replace safe bool idiom.

From-SVN: r263162
2018-07-31 15:55:36 +01:00
Jonathan Wakely 54c674327f Add missing checks for _GLIBCXX_USE_C99_STDINT_TR1
The throw_allocator extension depends on <tr1/random> which depends on
_GLIBCXX_USE_C99_STDINT_TR1.

The Transactional Memory support uses fixed-width integer types from
<stdint.h>.

	* include/ext/throw_allocator.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(random_condition, throw_value_random, throw_allocator_random)
	(std::hash<throw_value_random>): Do not define when <tr1/random> is
	not usable.
	* src/c++11/cow-stdexcept.cc [!_GLIBCXX_USE_C99_STDINT_TR1]: Do not
	define transactional memory support when <stdint.h> is not usable.

From-SVN: r263004
2018-07-26 15:02:11 +01:00
Jonathan Wakely 612c9c702e Remove char16_t and char32_t dependency on <stdint.h>
The char16_t and char32_t types are automatically defined by the
compiler and do not depend on support in <stdint.h>. The char_traits
specializations depend on uint_leastNN_t but can be made to work anyway
by using the predefined macros, or as a last resort make_unsigned.

	* include/bits/basic_string.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(hash<u16string>, hash<u32string>): Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1.
	* include/bits/char_traits.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(char_traits<char16_t>, char_traits<char32_t>): Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1. Use __UINT_LEAST16_TYPE__ and
	__UINT_LEAST32_TYPE__ or make_unsigned when <stdint.h> is not usable.
	* include/bits/codecvt.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(codecvt<char16_t, char, mbstate_t>)
	(codecvt<char32_t, char, mbstate_t>)
	(codecvt_byname<char16_t, char, mbstate_t>)
	(codecvt_byname<char32_t, char, mbstate_t>): Remove dependency
	on _GLIBCXX_USE_C99_STDINT_TR1.
	* include/bits/locale_facets.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(_GLIBCXX_NUM_UNICODE_FACETS): Likewise.
	* include/bits/stringfwd.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(char_traits<char16_t>, char_traits<char32_t>)
	(basic_string<char16_t>, basic_string<char32_t>): Remove dependency
	on _GLIBCXX_USE_C99_STDINT_TR1.
	* include/experimental/string_view [!_GLIBCXX_USE_C99_STDINT_TR1]
	(u16string_view, u32string_view, hash<u16string_view>)
	(hash<u32string_view>, operator""sv(const char16_t, size_t))
	(operator""sv(const char32_t, size_t)): Likewise.
	* include/ext/vstring.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(hash<__u16vstring>, hash<__u32vstring>): Likewise.
	* include/ext/vstring_fwd.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(__u16vstring, __u16sso_string, __u16rc_string, __u32vstring)
	(__u32sso_string, __u32rc_string): Likewise.
	* include/std/codecvt [!_GLIBCXX_USE_C99_STDINT_TR1] (codecvt_mode)
	(codecvt_utf8, codecvt_utf16, codecvt_utf8_utf16): Likewise.
	* include/std/string_view [!_GLIBCXX_USE_C99_STDINT_TR1]
	(u16string_view, u32string_view, hash<u16string_view>)
	(hash<u32string_view>, operator""sv(const char16_t, size_t))
	(operator""sv(const char32_t, size_t)): Likewise.
	* src/c++11/codecvt.cc: Likewise.
	* src/c++98/locale_init.cc: Likewise.
	* src/c++98/localename.cc: Likewise.

From-SVN: r263002
2018-07-26 15:02:01 +01:00
Jonathan Wakely 3be9ded290 LWG 3035. std::allocator's constructors should be constexpr
LWG 3035. std::allocator's constructors should be constexpr
	* include/bits/allocator.h (allocator): Add constexpr to constructors
	for C++2a. Replace dynamic exception specifications with NOTHROW
	macro.
	(allocator, operator==, operator!=): Replace USE_NOEXCEPT macro with
	NOTHROW.
	* include/bits/c++config (_GLIBCXX20_CONSTEXPR): Define.
	* include/ext/malloc_allocator.h (malloc_allocator): Add constexpr
	to constructors for C++2a.
	* include/ext/new_allocator.h (new_allocator): Likewise.

From-SVN: r261703
2018-06-18 16:47:07 +01:00
Jonathan Wakely 977ac63eab P0935R0 Eradicating unnecessarily explicit default constructors
The param_type constructors of each random number distribution should
mirror the constructors of the distribution itself, so make the same
changes w.r.t explicit on default constructors.

	* include/bits/random.h (uniform_real_distribution::param_type)
	(normal_distribution::param_type, lognormal_distribution::param_type)
	(gamma_distribution::param_type, chi_squared_distribution::param_type)
	(cauchy_distribution::param_type, fisher_f_distribution::param_type)
	(student_t_distribution::param_type)
	(bernoulli_distribution::param_type)
	(binomial_distribution::param_type)
	(geometric_distribution::param_type)
	(negative_binomial_distribution::param_type)
	(poisson_distribution::param_type)
	(exponential_distribution::param_type)
	(weibull_distribution::param_type)
	(extreme_value_distribution::param_type): Add non-explicit default
	constructors. Remove default argument for first parameter of explicit
	constructors.
	* include/bits/uniform_int_dist.h
	(uniform_int_distribution::param_type): Likewise.
	* include/ext/random
	(beta_distribution::param_type, rice_distribution::param_type)
	(nakagami_distribution::param_type, pareto_distribution::param_type)
	(k_distribution::param_type, arcsine_distribution::param_type)
	(hoyt_distribution::param_type, triangular_distribution::param_type)
	(von_mises_distribution::param_type)
	(hypergeometric_distribution::param_type)
	(logistic_distribution::param_type)
	(uniform_inside_sphere_distribution::param_type): Likewise.
	(uniform_on_sphere_distribution::param_type): Make default constructor
	non-explicit.
	* testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc:
	Test param_type for non-explicit default constructor.
	* testsuite/26_numerics/random/binomial_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/cauchy_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/discrete_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/exponential_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/gamma_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/geometric_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/lognormal_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/normal_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/poisson_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/student_t_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/weibull_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/arcsine_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/beta_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/hoyt_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/hypergeometric_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/k_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/logistic_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/nakagami_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/normal_mv_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/pareto_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/rice_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/triangular_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/von_mises_distribution/cons/default.cc:
	Likewise.

From-SVN: r261592
2018-06-14 14:32:53 +01:00
Jonathan Wakely dd9db6f897 P0935R0 Eradicating unnecessarily explicit default constructors
Explicit default constructors are problematic, so this change removes
them from <random> and <ext/random>, as per P0935R0.

	* include/bits/random.h (linear_congruential_engine)
	(mersenne_twister_engine, subtract_with_carry_engine, random_device)
	(uniform_real_distribution, normal_distribution)
	(lognormal_distribution, gamma_distribution, chi_squared_distribution)
	(cauchy_distribution, fisher_f_distribution, student_t_distribution)
	(bernoulli_distribution, binomial_distribution,geometric_distribution)
	(negative_binomial_distribution, exponential_distribution)
	(weibull_distribution, extreme_value_distribution): Add non-explicit
	default constructors. Remove default argument for first parameter of
	explicit constructors.
	(piecewise_constant_distribution, piecewise_linear_distribution):
	Make default constructor non-explicit.
	* include/bits/uniform_int_dist.h (uniform_int_distribution): Add
	non-explicit default constructors. Remove default argument for first
	parameter of explicit constructor.
	(simd_fast_mersenne_twister_engine, beta_distribution)
	(rice_distribution, nakagami_distribution, pareto_distribution)
	(k_distribution, arcsine_distribution, hoyt_distribution)
	(triangular_distribution, von_mises_distribution)
	(hypergeometric_distribution, logistic_distribution)
	(uniform_inside_sphere_distribution): Likewise.
	(uniform_on_sphere_distribution): Make default constructor
	non-explicit.
	* testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc:
	Test for non-explicit default constructor. Fix references to standard.
	* testsuite/26_numerics/random/binomial_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/cauchy_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/discrete_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/exponential_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/gamma_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/geometric_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/lognormal_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/normal_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/poisson_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/student_t_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc:
	Likewise.
	* testsuite/26_numerics/random/weibull_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/arcsine_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/beta_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/hoyt_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/hypergeometric_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/k_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/logistic_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/nakagami_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/normal_mv_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/pareto_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/rice_distribution/cons/default.cc: Likewise.
	* testsuite/ext/random/triangular_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/uniform_on_sphere_distribution/cons/default.cc:
	Likewise.
	* testsuite/ext/random/von_mises_distribution/cons/default.cc:
	Likewise.
	* testsuite/util/testsuite_common_types.h
	(implicitly_default_constructible): New helper.

From-SVN: r261522
2018-06-12 20:10:55 +01:00
François Dumont d31238cfde 2018-06-05 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tempbuf.h
	(_Temporary_buffer(_FwdIte, _FwdIte)): Delete, replaced by...
	(_Temporary_buffer(_FwdIte, size_type)): ...this, new.
	* include/ext/memory (temporary_buffer<>(_FwdIte, _FwdIte)): Adapt.
	* include/bits/stl_algo.h (__stable_partition): Adapt.
	(__inplace_merge): Adapt.
	(__stable_sort): Adapt.

From-SVN: r261181
2018-06-05 05:47:44 +00:00
Jason Merrill f07c223768 Some libstdc++ fixes for -Wdeprecated-copy.
* include/bits/stl_deque.h (_Deque_iterator): Constrain constructor
	for conversion to const_iterator.  Add defaulted copy ops.
	* libsupc++/new (bad_alloc): Add defaulted copy ops.
	* libsupc++/exception.h (exception): Add defaulted copy ops.
	* include/std/system_error (system_error): Add defaulted copy ops.
	* include/std/stdexcept (domain_error, invalid_argument)
	(length_error, out_of_range, range_error, overflow_error)
	(underflow_error): Add defaulted copy ops.
	* include/bits/stl_iterator.h (reverse_iterator): Add defaulted
	copy assignment.
	* include/bits/allocator.h (allocator): Add defaulted copy assignment.
	* include/ext/throw_allocator.h (condition_base): Add defaulted
	default and copy ctor and copy assignment.

From-SVN: r260380
2018-05-18 16:02:14 -04:00
Jonathan Wakely 5a7960da41 PR libstdc++/85749 constrain seed sequences for random number engines
Constrain constructors and member functions of random number engines so
that functions taking seed sequences can only be called with types that
meet the seed sequence requirements.

	PR libstdc++/85749
	* include/bits/random.h (__detail::__is_seed_seq): New SFINAE helper.
	(linear_congruential_engine, mersenne_twister_engine)
	(subtract_with_carry_engine, discard_block_engine)
	(independent_bits_engine, shuffle_order_engine): Use __is_seed_seq to
	constrain function templates taking seed sequences.
	* include/bits/random.tcc (linear_congruential_engine::seed(_Sseq&))
	(mersenne_twister_engine::seed(_Sseq&))
	(subtract_with_carry_engine::seed(_Sseq&)): Change return types to
	match declarations.
	* include/ext/random (simd_fast_mersenne_twister_engine): Use
	__is_seed_seq to constrain function templates taking seed sequences.
	* include/ext/random.tcc (simd_fast_mersenne_twister_engine::seed):
	Change return type to match declaration.
	* testsuite/26_numerics/random/discard_block_engine/cons/seed_seq2.cc:
	New.
	* testsuite/26_numerics/random/independent_bits_engine/cons/
	seed_seq2.cc: New.
	* testsuite/26_numerics/random/linear_congruential_engine/cons/
	seed_seq2.cc: New.
	* testsuite/26_numerics/random/mersenne_twister_engine/cons/
	seed_seq2.cc: New.
	* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
	* testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq2.cc:
	New.
	* testsuite/26_numerics/random/subtract_with_carry_engine/cons/
	seed_seq2.cc: New.
	* testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/
	seed_seq2.cc: New.

From-SVN: r260263
2018-05-15 16:36:46 +01:00
François Dumont 549b1796f1 aligned_buffer.h [...] (template<> __aligned_buffer): Define as __aligned_membuf alias.
2018-02-20  François Dumont  <fdumont@gcc.gnu.org>

	* include/ext/aligned_buffer.h [_GLIBCXX_INLINE_VERSION]
	(template<> __aligned_buffer): Define as __aligned_membuf alias.

From-SVN: r257861
2018-02-20 20:51:44 +00:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Martin Sebor 5d9ae53d70 PR c/81544 - attribute noreturn and warn_unused_result on the same function accepted
PR c/81544 - attribute noreturn and warn_unused_result on the same function accepted
PR c/81566 - invalid attribute aligned accepted on functions

gcc/ada/ChangeLog:

	PR c/81544
	* gcc-interface/utils.c (gnat_internal_attribute_table): Initialize
	new member of struct attribute_spec.

gcc/c/ChangeLog:

	PR c/81544
	* c-decl.c (c_decl_attributes): Look up existing declaration and
	pass it to decl_attributes.

gcc/c-family/ChangeLog:

	PR c/81544
	PR c/81566
	* c-attribs.c (attr_aligned_exclusions): New array.
	(attr_alloc_exclusions, attr_cold_hot_exclusions): Same.
	(attr_common_exclusions, attr_const_pure_exclusions): Same.
	(attr_gnu_inline_exclusions, attr_inline_exclusions): Same.
	(attr_noreturn_exclusions, attr_returns_twice_exclusions): Same.
	(attr_warn_unused_result_exclusions): Same.
	(handle_hot_attribute, handle_cold_attribute): Simplify.
	(handle_const_attribute): Warn on function returning void.
	(handle_pure_attribute): Same.
	(handle_aligned_attribute): Diagnose conflicting attribute
	specifications.
	* c-warn.c (diagnose_mismatched_attributes): Simplify.

gcc/cp/ChangeLog:

	PR c/81544
	* cp-tree.h (decls_match): Add default argument.
	* decl.c (decls_match): Avoid calling into the target back end
	and triggering an error.
	* decl2.c (cplus_decl_attributes): Look up existing declaration and
	pass it to decl_attributes.
	* tree.c (cxx_attribute_table): Initialize new member of struct
	attribute_spec.

gcc/fortran/ChangeLog:

	PR c/81544
	* f95-lang.c (gfc_attribute_table): Initialize new member of struct
	attribute_spec.

gcc/lto/ChangeLog:

	PR c/81544
	* lto-lang.c (lto_attribute_table): Initialize new member of struct
	attribute_spec.

gcc/ChangeLog:

	PR c/81544
	* attribs.c (empty_attribute_table): Initialize new member of
	struct attribute_spec.
	(decl_attributes): Add argument.  Handle mutually exclusive
	combinations of attributes.
	(selftests::test_attribute_exclusions): New function.
	(selftests::attribute_c_tests): Ditto.
	* attribs.h (decl_attributes): Add default argument.
	* selftest.h (attribute_c_tests): Declare.
	* selftest-run-tests.c (selftest::run_tests): Call attribute_c_tests.
	* tree-core.h (attribute_spec::exclusions, exclude): New type and
	member.
	* doc/extend.texi (Common Function Attributes): Update const and pure.

gcc/testsuite/ChangeLog:

	PR c/81544
	* c-c++-common/Wattributes-2.c: New test.
	* c-c++-common/Wattributes.c: New test.
	* c-c++-common/attributes-3.c: Adjust.
	* gcc.dg/Wattributes-6.c: New test.
	* gcc.dg/Wattributes-7.c: New test.
	* gcc.dg/attr-noinline.c
	* gcc.dg/pr44964.c: Same.
	* gcc.dg/torture/pr42363.c: Same.
	* gcc.dg/tree-ssa/ssa-ccp-2.c: Same.

From-SVN: r255469
2017-12-07 09:32:03 -07:00
Jonathan Wakely f1338a2dcb Use const char* to fix -Wwrite-strings warning
* include/ext/ropeimpl.h (rope::_S_dump): Use const char*.

From-SVN: r255316
2017-12-01 15:10:16 +00:00
Jonathan Wakely 2af96386a6 Define std::__to_address helper
* include/bits/allocated_ptr.h (__allocated_ptr::get): Use
	__to_address.
	(__allocated_ptr::_S_raw_ptr): Remove.
	* include/bits/forward_list.h (_Fwd_list_base::_M_get_node): Use
	__to_address.
	* include/bits/hashtable_policy.h (_Hashtable_alloc): Likewise.
	* include/bits/ptr_traits.h (__to_address): Define new function
	template.
	* include/bits/shared_ptr_base.h (__shared_ptr): Use __to_address.
	(__shared_ptr::_S_raw_ptr): Remove.
	* include/bits/stl_vector.h [__cplusplus >= 201103L]
	(vector::_M_data_ptr): Use __to_address.
	[__cplusplus < 201103L] (vector::_M_data_ptr): Don't dereference
	possibly invalid pointers.
	* include/ext/alloc_traits.h (__alloc_traits::construct)
	(__alloc_traits::destroy): Use __to_address.

From-SVN: r252055
2017-09-13 08:27:40 +01:00
Jonathan Wakely 89c6ecfa4c PR c++/82039 suppress -Wzero-as-null-pointer-constant warning
PR c++/82039
	* include/ext/new_allocator.h (__gnu_cxx::new_allocator::allocate):
	Adjust null pointer constant to avoid warning.

From-SVN: r251570
2017-08-31 17:45:37 +01:00
Michael Collison 5bbf7664c3 Add optimized implementation of mersenne twister for aarch64
2017-07-23  Michael Collison  <michael.collison@arm.com>

	Add optimized implementation of mersenne twister for aarch64
	* config/cpu/aarch64/opt/ext/opt_random.h: New file.
	(__arch64_recursion): New function.
	(__aarch64_lsr_128): New function.
	(__aarch64_lsl_128): New function.
	(operator==): New function.
	(simd_fast_mersenne_twister_engine): Implement
	method _M_gen_rand.
	* config/cpu/aarch64/opt/bits/opt_random.h: New file.
	* include/ext/random: (simd_fast_mersenne_twister_engine):
	add _M_state private array.

From-SVN: r250464
2017-07-23 22:46:34 +00:00
François Dumont 4a15d84228 re PR libstdc++/81064 (Inline namespace regression)
2017-07-23  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/81064
	* include/bits/algorithmfwd.h: Reorganize versioned namespace.
	* include/bits/basic_string.h: Likewise.
	* include/bits/c++config: Likewise.
	* include/bits/deque.tcc: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/forward_list.tcc: Likewise.
	* include/bits/hashtable_policy.h: Likewise.
	* include/bits/list.tcc: Likewise.
	* include/bits/move.h: Likewise.
	* include/bits/quoted_string.h: Likewise.
	* include/bits/random.h: Likewise.
	* include/bits/random.tcc: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/regex.tcc: Likewise.
	* include/bits/regex_automaton.h: Likewise.
	* include/bits/regex_automaton.tcc: Likewise.
	* include/bits/regex_compiler.h: Likewise.
	* include/bits/regex_compiler.tcc: Likewise.
	* include/bits/regex_constants.h: Likewise.
	* include/bits/regex_error.h: Likewise.
	* include/bits/regex_executor.h: Likewise.
	* include/bits/regex_executor.tcc: Likewise.
	* include/bits/regex_scanner.h: Likewise.
	* include/bits/regex_scanner.tcc: Likewise.
	* include/bits/specfun.h: Likewise.
	* include/bits/stl_algo.h: Likewise.
	* include/bits/stl_algobase.h: Likewise.
	* include/bits/stl_bvector.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_iterator.h: Likewise.
	* include/bits/stl_iterator_base_funcs.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_relops.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/uniform_int_dist.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/bits/vector.tcc: Likewise.
	* include/c_global/cmath: Likewise.
	* include/c_std/cmath: Likewise.
	* include/decimal/decimal: Likewise.
	* include/decimal/decimal.h: Likewise.
	* include/experimental/algorithm: Likewise.
	* include/experimental/any: Likewise.
	* include/experimental/array: Likewise.
	* include/experimental/bits/erase_if.h: Likewise.
	* include/experimental/bits/fs_dir.h: Likewise.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/bits/lfts_config.h: Likewise.
	* include/experimental/bits/shared_ptr.h: Likewise.
	* include/experimental/bits/string_view.tcc: Likewise.
	* include/experimental/chrono: Likewise.
	* include/experimental/deque: Likewise.
	* include/experimental/filesystem: Likewise.
	* include/experimental/forward_list: Likewise.
	* include/experimental/functional: Likewise.
	* include/experimental/iterator: Likewise.
	* include/experimental/list: Likewise.
	* include/experimental/map: Likewise.
	* include/experimental/memory: Likewise.
	* include/experimental/memory_resource: Likewise.
	* include/experimental/numeric: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/random: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/regex: Likewise.
	* include/experimental/set: Likewise.
	* include/experimental/source_location: Likewise.
	* include/experimental/string: Likewise.
	* include/experimental/string_view: Likewise.
	* include/experimental/system_error: Likewise.
	* include/experimental/tuple: Likewise.
	* include/experimental/type_traits: Likewise.
	* include/experimental/unordered_map: Likewise.
	* include/experimental/unordered_set: Likewise.
	* include/experimental/utility: Likewise.
	* include/experimental/vector: Likewise.
	* include/ext/bitmap_allocator.h: Likewise.
	* include/ext/codecvt_specializations.h: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/typelist.h: Likewise.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/std/functional: Likewise.
	* include/std/numeric: Likewise.
	* include/std/string_view: Likewise.
	* include/std/thread: Likewise.
	* include/std/variant: Likewise.
	* include/tr1/array: Likewise.
	* include/tr1/bessel_function.tcc: Likewise.
	* include/tr1/beta_function.tcc: Likewise.
	* include/tr1/cmath: Likewise.
	* include/tr1/complex: Likewise.
	* include/tr1/ell_integral.tcc: Likewise.
	* include/tr1/exp_integral.tcc: Likewise.
	* include/tr1/functional: Likewise.
	* include/tr1/functional_hash.h: Likewise.
	* include/tr1/gamma.tcc: Likewise.
	* include/tr1/hashtable.h: Likewise.
	* include/tr1/hashtable_policy.h: Likewise.
	* include/tr1/hypergeometric.tcc: Likewise.
	* include/tr1/legendre_function.tcc: Likewise.
	* include/tr1/modified_bessel_func.tcc: Likewise.
	* include/tr1/poly_hermite.tcc: Likewise.
	* include/tr1/poly_laguerre.tcc: Likewise.
	* include/tr1/random.h: Likewise.
	* include/tr1/random.tcc: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr1/riemann_zeta.tcc: Likewise.
	* include/tr1/shared_ptr.h: Likewise.
	* include/tr1/special_function_util.h: Likewise.
	* include/tr1/tuple: Likewise.
	* include/tr1/type_traits: Likewise.
	* include/tr1/unordered_map.h: Likewise.
	* include/tr1/unordered_set.h: Likewise.
	* include/tr1/utility: Likewise.
	* include/tr2/bool_set: Likewise.
	* include/tr2/bool_set.tcc: Likewise.
	* include/tr2/dynamic_bitset: Likewise.
	* include/tr2/dynamic_bitset.tcc: Likewise.
	* include/tr2/ratio: Likewise.
	* include/tr2/type_traits: Likewise.
	* src/c++11/chrono.cc: Likewise.
	* src/c++11/compatibility-c++0x.cc: Likewise.
	* src/c++11/compatibility-chrono.cc: Likewise.
	* src/c++11/cxx11-shim_facets.cc: Likewise.
	* src/c++11/hashtable_c++0x.cc: Likewise.
	* src/c++11/placeholders.cc: Likewise.
	* src/c++11/thread.cc: Likewise.
	* src/c++98/bitmap_allocator.cc: Likewise.
	* src/c++98/hashtable_tr1.cc: Likewise.
	* src/c++98/list.cc: Likewise.
	* src/shared/hashtable-aux.cc: Likewise.
	* testsuite/20_util/duration/literals/range.cc: Adapt line number.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/forward/c_neg.cc: Likewise.
	* testsuite/20_util/forward/f_neg.cc: Likewise.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Likewise.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
	* testsuite/26_numerics/random/pr60037-neg.cc: Likewise.
	* python/libstdcxx/v6/printers.py: Adapt.

From-SVN: r250458
2017-07-23 08:41:35 +00:00
Volker Reichelt 57c51668ee new (bad_array_new_length): Remove redundant semicolon after in-class member function definition.
* libsupc++/new (bad_array_new_length): Remove redundant
        semicolon after in-class member function definition.
        * include/bits/locale_facets.h (ctype_byname, num_put): Likewise.
        * include/bits/locale_facets_nonio.h (time_put_byname): Likewise.
        * include/bits/random.h (mersenne_twister_engine): Likewise.
        * include/tr1/random.h (mersenne_twister): Likewise
        * include/ext/random (simd_fast_mersenne_twister_engine): Likewise.
        * include/ext/rope (char_producer, _Rope_char_consumer,
        _Rope_self_destruct_ptr, _Rope_const_iterator, _Rope_iterator):
        Likewise.
        * include/ext/ropeimpl.h (_Rope_flatten_char_consumer,
        _Rope_insert_char_consumer): Likewise.

From-SVN: r250357
2017-07-19 16:59:00 +00:00
Jonathan Wakely 6d82c56288 Add C++17 deduction guide for std::basic_string (P0433R2, partial)
* include/bits/alloc_traits.h (__is_allocator, _RequireAllocator):
	New trait and alias for detecting Allocator-like types.
	* include/bits/basic_string.h (basic_string): Add deduction guide
	from P0433.
	* include/ext/alloc_traits.h (__gnu_cxx::__alloc_traits): Add template
	parameter with default template argument that causes substitution
	failures for types that cannot be allocators.
	* testsuite/21_strings/basic_string/cons/char/deduction.cc: New.
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc: New.

From-SVN: r248967
2017-06-07 13:35:08 +01:00
Jonathan Wakely 4ca4927ac6 Remove reundant const-qualification from cast targets
* include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
	(PB_DS_CLASS_C_DEC::end()): Remove redundant const in cast type.
	* testsuite/util/testsuite_rng.h (twister_rand_gen::get_prob()):
	Likewise.

From-SVN: r247346
2017-04-27 16:17:05 +01:00
Jonathan Wakely 75d359f759 PR libstdc++/62045 fix O(N) insertion in pd_ds binary heap
2017-03-15  Xi Ruoyao  <ryxi@stu.xidian.edu.cn>

	PR libstdc++/62045
	* include/ext/pb_ds/qdetail/binary_heap_/binary_heap_.hpp
	(is_heap): Remove.
	(push_heap): Remove the wrong checking using is_heap.
	(make_heap): Remove the assertion using is_heap.
	* include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
	(modify): Ditto.
	(resize_for_insert_if_needed): Add PB_DS_ASSERT_VALID after
	calling make_heap.

2017-03-15  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/62045
	* testsuite/ext/pb_ds/regression/priority_queue_binary_heap-62045.cc:
	New test.
	* testsuite/ext/pb_ds/regression/priority_queues.cc: Fix copy&paste
	error in comment.

From-SVN: r246173
2017-03-15 20:11:48 +00:00
Jonathan Wakely 12905f106c PR69240 Define inequality operators for <random> param types
PR libstdc++/69240
	* include/bits/random.h (uniform_real_distribution::param_type)
	(normal_distribution::param_type, lognormal_distribution::param_type)
	(gamma_distribution::param_type, chi_squared_distribution::param_type)
	(cauchy_distribution::param_type, fisher_f_distribution::param_type)
	(student_t_distribution::param_type)
	(bernoulli_distribution::param_type, binomial_distribution::param_type)
	(geometric_distribution::param_type)
	(negative_binomial_distribution::param_type)
	(poisson_distribution::param_type)
	(exponential_distribution::param_type)
	(weibull_distribution::param_type)
	(extreme_value_distribution::param_type)
	(discrete_distribution::param_type)
	(piecewise_constant_distribution::param_type)
	(piecewise_linear_distribution::param_type): Define operator!=.
	* include/bits/uniform_int_dist.h
	(uniform_int_distribution::param_type): Likewise.
	* include/ext/random (beta_distribution::param_type)
	(rice_distribution::param_type, nakagami_distribution::param_type)
	(pareto_distribution::param_type, k_distribution::param_type)
	(arcsine_distribution::param_type, hoyt_distribution::param_type)
	(triangular_distribution::param_type)
	(von_mises_distribution::param_type)
	(hypergeometric_distribution::param_type)
	(logistic_distribution::param_type)
	(uniform_on_sphere_distribution::param_type)
	(uniform_inside_sphere_distribution::param_type): Likewise.
	* testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc:
	Test construction with param_type.
	* testsuite/26_numerics/random/binomial_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/exponential_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/extreme_value_distribution/cons/
	parms.cc: Likewise.
	* testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/gamma_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/geometric_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/cons/
	parms.cc: Likewise.
	* testsuite/26_numerics/random/normal_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/poisson_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/student_t_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/weibull_distribution/cons/parms.cc:
	Likewise.
	* testsuite/ext/random/arcsine_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/beta_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/hoyt_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/hypergeometric_distribution/cons/parms.cc:
	Likewise.
	* testsuite/ext/random/k_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/logistic_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/nakagami_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/normal_mv_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/pareto_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/rice_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/triangular_distribution/cons/parms.cc:
	Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/cons/
	parms.cc: Likewise.
	* testsuite/ext/random/von_mises_distribution/cons/parms.cc: Likewise.

From-SVN: r244722
2017-01-20 15:28:48 +00:00
Jonathan Wakely 2ae27b7076 PR69301 don't assume atomic<T> can default construct T
PR libstdc++/69301
	* include/std/atomic (atomic<T>::load, atomic<T>::exchange): Use
	aligned buffer instead of default-initialized variable.
	* testsuite/29_atomics/atomic/69301.cc: New test.
	* include/experimental/memory (observer_ptr::release): Use reserved
	name.
	* include/ext/pointer.h (_Pointer_adapter::operator++(int))
	(_Pointer_adapter::operator--(int)): Likewise.

From-SVN: r244588
2017-01-18 18:36:45 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
François Dumont 284a35df5d random.tcc: Fix usage of _OutputIteratorConcept.
2016-12-24  François Dumont  <fdumont@gcc.gnu.org>

	* include/ext/random.tcc: Fix usage of _OutputIteratorConcept.

From-SVN: r243915
2016-12-24 14:13:58 +00:00
Jonathan Wakely ba454dfbbe Use _GLIBCXX_THROW macro in bitmap_allocator
* include/ext/bitmap_allocator.h (bitmap_allocator::_S_refill_pool)
	(bitmap_allocator::_M_allocate_single_object)
	(bitmap_allocator::_M_get): Use _GLIBCXX_THROW macro.

From-SVN: r243352
2016-12-07 15:22:44 +00:00
Edward Smith-Rowland 10da5b7cbc Implement uniform_inside_sphere_distribution extension.
2016-10-26  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement uniform_inside_sphere_distribution extension.
	* include/ext/random: Implement uniform_inside_sphere_distribution.
	* include/ext/random.tcc: Ditto.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	cons/default.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	cons/parms.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	operators/equal.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	operators/generate.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	operators/inequal.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	operators/serialize.cc: New.

From-SVN: r241562
2016-10-26 15:34:18 +00:00
Jonathan Wakely 88b3e63150 Tweak whitespace in std::allocator files
* include/bits/allocator.h: Remove trailing whitespace, tab-indent.
	* include/ext/new_allocator.h: Likewise.

From-SVN: r241371
2016-10-20 12:37:19 +01:00
Ville Voutilainen b08c2bc7bd Make sure the return value of malloc_allocator::allocate is zero-initialized so...
Make sure the return value of malloc_allocator::allocate
	is zero-initialized so that checking it for non-zero works
	later.
	* include/ext/malloc_allocator.h (malloc_allocator::allocate):
	Initialize the return value.
	* testsuite/ext/malloc_allocator/sanity.cc: New.

From-SVN: r241212
2016-10-16 16:31:43 +03:00
Jonathan Wakely ace4c2f060 PR65122 extended alignment support in allocators
PR libstdc++/65122
	* include/ext/malloc_allocator.h (malloc_allocator::allocate): Use
	aligned_alloc for types with extended alignment if available,
	otherwise throw bad_alloc if malloc doesn't return a suitable value.
	* include/ext/bitmap_allocator.h (bitmap_allocator::allocate)
	(bitmap_allocator::deallocate): Use aligned new/delete for types with
	extended alignment.
	* include/ext/mt_allocator.h (__mt_alloc::allocate)
	(__mt_alloc::deallocate): Likewise.
	* include/ext/new_allocator.h (new_allocator::allocate)
	(new_allocator::deallocate): Likewise.
	* include/ext/pool_allocator.h (__pool_alloc::allocate)
	(__pool_alloc::deallocate): Likewise.
	* testsuite/20_util/allocator/overaligned.cc: New test.
	* testsuite/ext/bitmap_allocator/overaligned.cc: New test.
	* testsuite/ext/malloc_allocator/overaligned.cc: New test.
	* testsuite/ext/mt_allocator/overaligned.cc: New test.
	* testsuite/ext/new_allocator/overaligned.cc: New test.
	* testsuite/ext/pool_allocator/overaligned.cc: New test.

From-SVN: r241158
2016-10-14 13:03:47 +01:00
Jonathan Wakely 1319041924 Avoid reallocation for basic_string::clear()
PR libstdc++/56166
	PR libstdc++/77582
	* include/bits/basic_string.h (basic_string::clear()): Drop reference
	and use empty rep.
	* include/ext/rc_string_base.h (__rc_string_base::_M_clear()):
	Likewise.
	* testsuite/21_strings/basic_string/56166.cc: New.
	* testsuite/ext/vstring/modifiers/clear/56166.cc: New.

From-SVN: r240447
2016-09-23 18:25:34 +01:00
Georeth Chow a837417c79 Fix missing qualification in <ext/rope>
2016-07-25  Georeth Chow  <georeth2010@gmail.com>

	* include/ext/ropeimpl.h (rope<>::_S_dump(_RopeRep*, int)): Qualify
	_S_concat enumerator.
	* testsuite/ext/rope/6.cc: New test.

From-SVN: r238711
2016-07-25 13:56:12 +01:00
Jonathan Wakely 4f5f9962c8 Replace references to C++0x with C++11 in comments
* include/bits/algorithmfwd.h: Change C++0x to C++11 in comments.
	* include/bits/move.h: Likewise.
	* include/bits/postypes.h: Likewise.
	* include/debug/bitset: Likewise.
	* include/ext/pb_ds/detail/type_utils.hpp: Likewise.
	* include/ext/string_conversions.h: Change C++0x to __cxx11 in
	comment.
	* testsuite/27_io/fpos/14320-1.cc: Change C++0x to C++11 in comment.
	* testsuite/util/thread/all.h: Likewise.

From-SVN: r238402
2016-07-15 21:23:08 +01:00
Jonathan Wakely 8dc1e574ae Avoid -Wsign-compare warnings in std::to_string()
* include/ext/string_conversions.h (__stoa): Avoid -Wsign-compare
        warnings.

From-SVN: r235151
2016-04-18 16:43:50 +01:00
Jason Merrill 9f285ccb77 Revert empty class parameter passing ABI changes.
From-SVN: r234977
2016-04-14 12:23:06 -04:00
Jonathan Wakely a6297ab587 Adjust for new empty class parameter passing ABI.
* include/bits/c++config (_GLIBCXX_BEGIN_NAMESPACE_EMPTY_TYPES,
	_GLIBCXX_END_NAMESPACE_EMPTY_TYPES, _GLIBCXX_ABI_TAG_EMPTY): Define.
	* include/bits/hashtable.h (_Hashtable::_M_emplace): Change signatures
	of functions taking empty structs by value. Add a template parameter
	to overloads without hints. Rename overloads with hints to
	_M_emplace_hint.
	(_Hashtable::_M_erase(true_type, const_iterator),
	_Hashtable::_M_erase(false_type, const_iterator)): Change signatures
	by reordering parameters.
	* include/bits/hashtable_policy.h (_Insert::insert): Adjust to call
	_M_emplace_hint instead of _M_emplace.
	* include/bits/shared_ptr.h (shared_ptr(_Tp1*, _Deleter, _Alloc),
	shared_ptr(nullptr_t, _Deleter, _Alloc)): Use _GLIBCXX_ABI_TAG_EMPTY.
	* include/bits/shared_ptr_base.h (_Sp_counted_deleter, __shared_count,
	__shared_ptr): Likewise.
	* include/bits/stl_algo.h (replace_if): Likewise.
	* include/bits/stl_pair.h (piecewise_construct_t,
	piecewise_construct): Use _GLIBCXX_BEGIN_NAMESPACE_EMPTY_TYPES.
	* include/bits/uses_allocator.h (allocator_arg_t, allocator_arg,
	__uses_alloc0): Likewise.
	* include/ext/pb_ds/assoc_container.hpp (basic_hash_table): Likewise.
	* testsuite/20_util/scoped_allocator/69293_neg.cc: Adjust dg-error.
	* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/void_neg.cc: Likewise.
	* testsuite/20_util/uses_allocator/69293_neg.cc: Likewise.
	* testsuite/20_util/uses_allocator/cons_neg.cc: Likewise.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Likewise.

From-SVN: r234964
2016-04-13 23:00:50 +01:00
Jonathan Wakely ab56cbed60 libstdc++/69406 Fix test to check for supported headers
PR libstdc++/69406
	* include/bits/cpp_type_traits.h: Ensure C++ language linkage.
	* include/ext/type_traits.h: Likewise.
	* testsuite/17_intro/headers/c++2011/linkage.cc: Check autoconf macros
	for presence of C headers.
	* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Adjust
	dg-error line number.
	* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Likewise.
	* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Likewise.
	* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Likewise.

From-SVN: r232672
2016-01-21 13:33:27 +00:00
Steve Ellcey cebeb718fe random.tcc: Use __builtin_isfinite instead of std::isfinite.
2016-01-15  Steve Ellcey  <sellcey@imgtec.com>

	* include/ext/random.tcc: Use __builtin_isfinite instead of
	std::isfinite.

From-SVN: r232452
2016-01-15 22:26:02 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Jonathan Wakely 6b4f890601 Improve generated libstdc++ API docs
* doc/doxygen/user.cfg.in: Use EXTENSION_MAPPING tag. Add new headers
	to INPUT. Remove obsolete XML_SCHEMA and XML_DTD tags. Update
	PREDEFINED macros. Set BRIEF_MEMBER_DESC for man-pages.
	* include/backward/strstream: Correct @file comment.
	* include/bits/forward_list.h: Improve Doxygen comments.
	* include/bits/locale_facets_nonio.h: Likewise.
	* include/bits/mutex.h: Likewise.
	* include/bits/shared_ptr.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/debug/vector (_Safe_vector): Add @brief section to comment.
	* include/experimental/bits/fs_dir.h: Correct @file comment.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/bits/string_view.tcc: Likewise.
	* include/experimental/optional: Document experimental status.
	* include/experimental/string_view: Correct @file comment.
	* include/ext/pb_ds/detail/bin_search_tree_/traits.hpp: Reduce
	whitespace to avoid Doxygen bug.
	* include/std/bitset: Remove redundant @class Doxygen command. Add
	parentheses to avoid Doxygen bug.
	* include/std/mutex: Improve Doxygen comments.
	* include/tr2/dynamic_bitset: Add missing @param documentation.
	* scripts/run_doxygen: Rename man pages for std::experimental types.

From-SVN: r231512
2015-12-10 14:02:52 +00:00
Jonathan Wakely 356510acd9 PR libstdc++/68353 fix _GLIBCXX_USE_C99_WCHAR test
PR libstdc++/68353
	* include/bits/basic_string.h: Test value of _GLIBCXX_USE_C99_WCHAR
	not whether it is defined.
	* include/ext/vstring.h: Likewise.

From-SVN: r230395
2015-11-15 11:15:08 +00:00
Jennifer Yao 23c64853c8 More fine-grained autoconf checks for C99 library
2015-11-13  Jennifer Yao  <jenny.hyphen.fa@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/58393
	PR libstdc++/61580
	* acinclude.m4 (GLIBCXX_ENABLE_C99): Perform tests twice, with
	-std=c++11 as well as -std=c++98, and define separate macros for each.
	Cache the results of checking for complex math and wide character
	functions. Reformat for readability.
	* config.h.in: Regenerate.
	* include/bits/c++config: Define _GLIBCXX_USE_C99_XXX macros to
	either _GLIBCXX98_USE_C99_XXX or _GLIBCXX11_USE_C99_XXX according to
	language standard in use.
	* config/locale/dragonfly/c_locale.h (std::__convert_from_v): Replace
	_GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO.
	* config/locale/generic/c_locale.h (std::__convert_from_v): Likewise.
	* config/locale/gnu/c_locale.h (std::__convert_from_v): Likewise.
	* config/os/bsd/dragonfly/os_defines.h: Define _GLIBCXX_USE_C99_STDIO,
	_GLIBCXX_USE_C99_STDLIB, and _GLIBCXX_USE_C99_WCHAR.
	* configure: Regenerate.
	* include/bits/basic_string.h: Make numeric conversion functions
	depend on _GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, or
	_GLIBCXX_USE_C99_WCHAR, instead of _GLIBCXX_USE_C99.
	* include/ext/vstring.h: Likewise.
	* include/bits/locale_facets.tcc (std::num_put::_M_insert_float):
	Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO.
	* include/bits/locale_facets_nonio.tcc (std::money_put::do_put):
	Likewise.
	* include/c_compatibility/math.h: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_MATH.
	* include/c_compatibility/wchar.h: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_WCHAR.
	* include/c_global/cstdio: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_STDIO.
	* include/c_global/cstdlib: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_STDLIB.
	* include/c_global/cwchar: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_WCHAR.
	* include/c_std/cstdio: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_STDIO.
	* include/c_std/cstdlib: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_STDLIB.
	* include/c_std/cwchar: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_WCHAR.
	* include/tr1/cstdio: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_STDIO.
	* include/tr1/cstdlib: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_STDLIB.
	* include/tr1/cwchar: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_WCHAR.
	* include/tr1/stdlib.h: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_STDLIB.
	* src/c++98/locale_facets.cc (std::__num_base::_S_format_float):
	Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO.
	* testsuite/18_support/exception_ptr/60612-terminate.cc: Replace
	_GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB.
	* testsuite/18_support/exception_ptr/60612-unexpected.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc
	(test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/
	stof.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/
	stoi.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/
	stol.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/
	stold.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/
	stoll.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/
	stoul.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/
	stoull.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/
	to_wstring.cc: Likewise.
	* testsuite/26_numerics/headers/cstdlib/13943.cc: Replace
	_GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB.
	* testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc: Likewise.
	* testsuite/lib/libstdc++.exp (check_v3_target_string_conversions):
	Change preprocessor #if conditional so that it uses
	_GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, and
	_GLIBCXX_USE_C99_WCHAR, instead of _GLIBCXX_USE_C99.
	* testsuite/tr1/8_c_compatibility/cmath/templates.cc: Replace
	_GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_MATH.
	* testsuite/tr1/8_c_compatibility/cstdio/functions.cc: Replace
	_GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO.
	* testsuite/tr1/8_c_compatibility/cstdlib/functions.cc: Replace
	_GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB.
	* testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc: Likewise.
	* testsuite/tr1/8_c_compatibility/cwchar/functions.cc: Replace
	_GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR.
	* testsuite/util/testsuite_fs.h: Replace _GLIBCXX_USE_C99 with
	_GLIBCXX_USE_C99_STDIO.

Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>

From-SVN: r230324
2015-11-13 14:51:25 +00:00
Nathan Froyd 141aa58b53 opt_random.h: Include pmmintrin.h instead of x86intrin.h, and only do so when __SSE3__
* config/cpu/i486/opt/bits/opt_random.h: Include pmmintrin.h instead
	of x86intrin.h, and only do so when __SSE3__
	* include/ext/random: Include emmintrin.h instead of x86intrin.h

From-SVN: r228786
2015-10-13 20:55:44 +00:00
Jonathan Wakely 783aa06e9b Use noexcept instead of _GLIBCXX_NOEXCEPT
* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
	(basic_string::front() const, basic_string::back() const): Use
	noexcept instead of _GLIBCXX_NOEXCEPT macro.
	(__versa_string::front, __versa_string::back): Likewise.

From-SVN: r228434
2015-10-02 23:13:12 +01:00
Jonathan Wakely f14decafae Save-and-restore errno more carefully in libstdc++
* doc/xml/manual/diagnostics.xml: Document use of errno.
	* doc/html/*: Regenerate.
	* config/locale/generic/c_locale.cc (_Save_errno): New helper.
	(__convert_to_v): Use _Save_errno.
	* include/ext/string_conversions.h (__stoa): Only restore errno when
	it isn't set to non-zero.

From-SVN: r228328
2015-10-01 12:23:39 +01:00
Jonathan Wakely 6d60110654 Leave errno unchanged by successful std::stoi etc
* include/ext/string_conversions.h (__stoa): Save and restore errno.
	* testsuite/21_strings/basic_string/numeric_conversions/char/errno.cc:
	New.

From-SVN: r228249
2015-09-29 16:15:39 +01:00
Jonathan Wakely 7215aaedd6 Fix errors due to extra includes in extc++.h
* include/precompiled/extc++.h: Fix bootstrap error due to
	unconditional inclusion of <ext/enc_filebuf.h>.
	* include/ext/random: Check for definition of UINT32_C.

From-SVN: r227902
2015-09-18 12:21:05 +01:00
Jonathan Wakely 2f1e8e7c47 Enable lightweight checks with _GLIBCXX_ASSERTIONS.
* doc/xml/manual/using.xml (_GLIBCXX_ASSERTIONS): Document.
	* doc/html/manual/using_macros.html: Regenerate.
	* include/bits/c++config: Define _GLIBCXX_ASSERTIONS when
	_GLIBCXX_DEBUG is defined. Disable std::string extern templates when
	(_GLIBCXX_EXTERN_TEMPLATE, __glibcxx_assert): Depend on
	_GLIBCXX_ASSERTIONS instead of _GLIBCXX_DEBUG.
	* include/debug/debug.h [!_GLIBCXX_DEBUG]: Define
	__glibcxx_requires_non_empty_range and __glibcxx_requires_nonempty.
	* include/backward/auto_ptr.h (auto_ptr::operator*,
	auto_ptr::operator->): Replace _GLIBCXX_DEBUG_ASSERT with
	__glibcxx_assert.
	* include/bits/basic_string.h (basic_string::operator[],
	basic_string::front, basic_string::back, basic_string::pop_back):
	Likewise.
	* include/bits/random.h
	(uniform_int_distribution::param_type::param_type,
	uniform_real_distribution::param_type::param_type,
	normal_distribution::param_type::param_type,
	gamma_distribution::param_type::param_type,
	bernoulli_distribution::param_type::param_type,
	binomial_distribution::param_type::param_type,
	geometric_distribution::param_type::param_type,
	negative_binomial_distribution::param_type::param_type,
	poisson_distribution::param_type::param_type,
	exponential_distribution::param_type::param_type): Likewise.
	* include/bits/regex.h (match_results::operator[],
	match_results::prefix, match_results::suffix): Likewise.
	* include/bits/regex.tcc (format, regex_iterator::operator++):
	Likewise.
	* include/bits/regex_automaton.tcc (_StateSeq::_M_clone): Likewise.
	* include/bits/regex_compiler.tcc (_Compiler::_Compiler,
	_Compiler::_M_insert_character_class_matcher): Likewise.
	* include/bits/regex_executor.tcc (_Executor::_M_dfs): Likewise.
	* include/bits/regex_scanner.tcc (_Scanner::_M_advance,
	_Scanner::_M_scan_normal): Likewise.
	* include/bits/shared_ptr_base.h (__shared_ptr::_M_reset,
	__shared_ptr::operator*): Likewise.
	* include/bits/stl_iterator_base_funcs.h (__advance): Likewise.
	* include/bits/unique_ptr.h (unique_ptr::operator*,
	unique_ptr::operator[]): Likewise.
	* include/experimental/fs_path.h (path::path(string_type, _Type),
	path::iterator::operator++, path::iterator::operator--,
	path::iterator::operator*): Likewise.
	* include/experimental/string_view (basic_string_view::operator[],
	basic_string_view::front, basic_string_view::back,
	basic_string_view::remove_prefix): Likewise.
	* include/ext/random (beta_distribution::param_type::param_type,
	normal_mv_distribution::param_type::param_type,
	rice_distribution::param_type::param_type,
	pareto_distribution::param_type::param_type,
	k_distribution::param_type::param_type,
	arcsine_distribution::param_type::param_type,
	hoyt_distribution::param_type::param_type,
	triangular_distribution::param_type::param_type,
	von_mises_distribution::param_type::param_type,
	hypergeometric_distribution::param_type::param_type,
	logistic_distribution::param_type::param_type): Likewise.
	* include/ext/vstring.h (__versa_string::operator[]): Likewise.
	* include/std/complex (polar): Likewise.
	* include/std/mutex [!_GTHREAD_USE_MUTEX_TIMEDLOCK]
	(timed_mutex::~timed_mutex, timed_mutex::unlock,
	(recursive_timed_mutex::~timed_mutex, recursive_timed_mutex::unlock):
	Likewise.
	* include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER]
	(__shared_mutex_pthread::__shared_mutex_pthread,
	__shared_mutex_pthread::~__shared_mutex_pthread): Likewise.
	(__shared_mutex_pthread::lock, __shared_mutex_pthread::try_lock,
	__shared_mutex_pthread::unlock, __shared_mutex_pthread::lock_shared,
	__shared_mutex_pthread::try_lock_shared): Likewise.
	(__shared_mutex_cv::~__shared_mutex_cv, __shared_mutex_cv::unlock,
	__shared_mutex_cv::unlock_shared): Likewise.
	(shared_timed_mutex::try_lock_until,
	shared_timed_mutex::try_lock_shared_until): Likewise.
	* include/std/valarray (valarray::valarray(const _Tp*, size_t),
	valarray::operator=, valarray::sum, valarray::min, valarray::max,
	_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT, _DEFINE_BINARY_OPERATOR):
	Likewise.

From-SVN: r227595
2015-09-09 18:12:47 +01:00
Jonathan Wakely 4a88769c96 re PR libstdc++/65049 (Undefined behaviour with std::char_traits<char>)
PR libstdc++/65049
	* include/bits/char_traits.h (char_traits<char>::compare,
	char_traits<char>::find, char_traits<char>::move,
	char_traits<char>::copy, char_traits<char>::assign): Check for zero
	length.
	(char_traits<wchar_t>::compare, char_traits<wchar_t>::find,
	char_traits<wchar_t>::move, char_traits<wchar_t>::copy,
	char_traits<wchar_t>::assign): Likewise.
	(char_traits<char16_t>::move, char_traits<char16_t>::copy): Likewise.
	(char_traits<char32_t>::move, char_traits<char32_t>::copy): Likewise.
	* include/ext/pod_char_traits.h (char_traits<character<>>::move,
	char_traits<character<>>::copy): Likewise.
	* testsuite/21_strings/char_traits/requirements/char/65049.cc: New.
	* testsuite/21_strings/char_traits/requirements/char16_t/65049.cc:
	New.
	* testsuite/21_strings/char_traits/requirements/char32_t/65049.cc:
	New.
	* testsuite/21_strings/char_traits/requirements/wchar_t/65049.cc:
	New.

From-SVN: r227127
2015-08-24 14:43:54 +01:00
DJ Delorie 8161e0c343 functional_hash.h: Add specializations for __intN types.
* include/bits/functional_hash.h: Add specializations for __intN
types.

* include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp (__gnu_pbds):
Guard against values that might exceed size_t's precision.

From-SVN: r226117
2015-07-23 13:57:34 -04:00
Jonathan Wakely c5d9ec5670 c++config (_GLIBCXX_NOEXCEPT_IF): Define.
* include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Define.
	* include/bits/forward_list.h (forward_list::swap): Make noexcept
	unconditional.
	* include/bits/hashtable.h (_Hashtable::swap): Do not use
	_S_nothrow_swap().
	* include/bits/stl_bvector.h (vector<bool>::swap): Make noexcept
	unconditional.
	* include/bits/stl_deque.h (deque::swap): Likewise.
	(swap(deque&, deque&)): Use _GLIBCXX_NOEXCEPT_IF.
	* include/bits/stl_list.h (list::swap): Make noexcept unconditional.
	(swap(list&, list&)): Use _GLIBCXX_NOEXCEPT_IF.
	* include/bits/stl_map.h (map::swap, swap(map&, map&)): Use
	_GLIBCXX_NOEXCEPT_IF, do not depend on _S_nothrow_swap.
	* include/bits/stl_multimap.h (multimap::swap,
	swap(multimap&, multimap&)): Likewise.
	* include/bits/stl_multiset.h (multiset::swap,
	swap(multiset&, multiset&)): Likewise.
	* include/bits/stl_set.h (set::swap, swap(set&, set&)): Likewise.
	* include/bits/stl_tree.h (_Rb_tree::swap,
	swap(_Rb_tree&, _Rb_tree&)): Likewise.
	* include/bits/stl_vector.h (vector::swap): Make noexcept
	unconditional.
	(swap(vector&, vector&)): Use _GLIBCXX_NOEXCEPT_IF.
	* include/debug/deque (deque::swap, swap): Likewise.
	* include/debug/forward_list (swap): Add noexcept.
	* include/debug/list (list::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
	* include/debug/map.h (map::swap, swap): Likewise.
	* include/debug/multimap.h (multimap::swap, swap): Likewise.
	* include/debug/multiset.h (multiset::Swap, swap): Likewise.
	* include/debug/set.h (set::swap, swap): Likewise.
	* include/debug/unordered_map (unordered_map::swap,
	unordered_multimap::swap, swap): Likewise.
	* include/debug/unordered_set (unordered_set::swap,
	unordered_multiset::swap, swap): Likewise.
	* include/debug/vector (vector::swap, swap): Likewise.
	* include/ext/alloc_traits.h (__alloc_traits::_S_nothrow_swap()):
	Remove.
	* include/profile/deque (deque::swap, swap): Use _GLIBCXX_NOEXCEPT_IF.
	* include/profile/forward_list (swap): Add noexcept.
	* include/profile/list (list::swap, swap) : Use _GLIBCXX_NOEXCEPT_IF.
	* include/profile/map.h (map::swap, swap): Likewise.
	* include/profile/multimap.h (multimap::swap, swap): Likewise.
	* include/profile/multiset.h (multiset::swap, swap): Likewise.
	* include/profile/set.h (set::swap, swap): Likewise.
	* include/profile/unordered_map (swap): Likewise.
	* include/profile/unordered_set (swap): Likewise.
	* include/profile/vector (vector::swap, swap): Likewise. Remove
	overloads for swapping rvalues.
	* testsuite/23_containers/deque/allocator/noexcept.cc: Update tests
	for noexcept on swap.
	* testsuite/23_containers/forward_list/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/list/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/map/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/multimap/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/multiset/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/set/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/vector/allocator/noexcept.cc: Likewise.
	* testsuite/23_containers/vector/bool/allocator/noexcept.cc: Likewise.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error line
	number.

From-SVN: r225744
2015-07-13 18:15:48 +01:00
Jonathan Wakely a2b5fdcbdb Implement N4258 (Cleaning-up noexcept in the Library rev 3)
* doc/xml/manual/intro.xml: Document LWG 2108 status.
	* include/bits/alloc_traits.h (allocator_traits::is_always_equal):
	Define.
	* include/bits/allocator.h (allocator::is_always_equal): Likewise.
	* include/bits/forward_list.h
	(forward_list::operator=(forward_list&&)): Use __bool_constant.
	(forward_list::swap(forward_list&)): Add noexcept.
	* include/bits/hashtable.h (_Hashtable::operator=(_Hashtable&&)):
	Likewise.
	(_Hashtable::swap(_Hashtable&)): Likewise.
	* include/bits/stl_deque.h (_Deque_base::_Deque_base(_Deque_base&&)):
	Use _Alloc_traits::is_always_equal.
	(deque::operator=(deque&&)): Likewise.
	(deque::_M_move_assign1(deque&&, false_type)): Add comment and use
	__bool_constant.
	(swap(deque&, deque&)): Add noexcept.
	* include/bits/stl_list.h (list::operator=(list&&)): Use
	__bool_constant.
	(swap(list&, list&)): Add noexcept.
	* include/bits/stl_map.h (map::swap(map&)): Include _Compare in
	noexcept.
	(swap(map&, map&)): Add noexcept.
	* include/bits/stl_multimap.h (multimap::swap(multimap&)): Include
	_Compare in noexcept.
	(swap(multimap&, multimap&)): Add noexcept.
	* include/bits/stl_multiset.h (multiset::swap(multiset&)): Include
	_Compare in noexcept.
	(swap(multiset&, multiset&)): Add noexcept.
	* include/bits/stl_set.h (set::swap(set&)): Include _Compare in
	noexcept.
	(swap(set&, set&)): Add noexcept.
	* include/bits/stl_tree.h (_Rb_tree::operator=(_Rb_tree&&)): Include
	_Compare in noexcept.
	(_Rb_tree::_Rb_tree(_Rb_tree&&, _Node_alloc_type&&)): Use
	is_always_equal.
	* include/bits/stl_vector.h (vector::operator=(vector&&)): Use
	__bool_constant.
	(swap(vector&, vector&)): Add noexcept.
	* include/bits/unordered_map.h (swap(unordered_map&, unordered_map&),
	swap(unordered_multimap& unordered_multimap&)): Add noexcept.
	* include/bits/unordered_set.h (swap(unordered_set&, unordered_set&),
	swap(unordered_multiset& unordered_multiset&)): Add noexcept.
	* include/ext/alloc_traits.h (__allocator_always_compares_equal):
	Remove.
	(__alloc_traits::_S_always_equal()): Use is_always_equal instead of
	__allocator_always_compares_equal.
	* include/ext/array_allocator.h (array_allocator::is_always_equal):
	Define.
	* include/std/scoped_allocator (__any_of, __propagate_on_copy,
	__propagate_on_move, __propagate_on_swap): Remove.
	(scoped_allocator_adaptor::propagate_on_container_copy_assignment,
	scoped_allocator_adaptor::propagate_on_container_move_assignment,
	scoped_allocator_adaptor::propagate_on_container_swap): Define with
	__and_ instead of __any_of.
	(scoped_allocator_adaptor::is_always_equal): Define.
	* testsuite/20_util/allocator_traits/members/is_always_equal.cc: New.
	* testsuite/20_util/scoped_allocator/propagation.cc: Make traits
	derive from true_type or false_type.
	* testsuite/23_containers/deque/allocator/move_assign-2.cc: Add
	is_always_equal member and remove the trait specialization.
	* testsuite/23_containers/vector/52591.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
	Likewise.

From-SVN: r225081
2015-06-26 21:10:24 +01:00
Jonathan Wakely c92334d4c5 alloc_traits.h (__alloc_traits::_S_nothrow_swap()): Use __is_nothrow_swappable.
* include/ext/alloc_traits.h (__alloc_traits::_S_nothrow_swap()): Use
	__is_nothrow_swappable.

From-SVN: r224552
2015-06-17 11:51:46 +01:00
Ramana Radhakrishnan 57e6d9be77 Use atomics in guard.cc.
This provides proper definitions for _GLIBCXX_READ_MEM_BARRIER and
_GLIBCXX_WRITE_MEM_BARRIER, rewrites the guards in terms of proper
atomic extensions and removes internal uses of
_GLIBCXX_READ_MEM_BARRIER and _GLIBCXX_WRITE_MEM_BARRIER and replaces
them with equivalent atomics.

2015-06-12  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

	PR target/66200
	PR c++/66192
	* * config/cpu/generic/atomic_word.h (_GLIBCXX_READ_MEM_BARRIER): Define
        (_GLIBCXX_WRITE_MEM_BARRIER): Likewise
        * include/bits/shared_ptr_base.h: Use ACQ_REL barrier.
        * include/ext/atomicity.h: Likewise.
        * include/tr1/shared_ptr.h: Likewise.
        * libsupc++/guard.cc (__test_and_acquire): Rewrite with atomics.
        Update comment.
        (__set_and_release): Likewise.
        * testsuite/20_util/shared_ptr/cons/43820_neg.cc (test01): Adjust for
	line numbers.
        * testsuite/20_util/shared_ptr/cons/void_neg.cc: Likewise.
        * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc:
	Likewise.

From-SVN: r224411
2015-06-12 09:49:41 +00:00
Jonathan Wakely 2097b5b029 re PR libstdc++/66017 (Undefined behaviour in std::set<long long>)
PR libstdc++/66017
	* include/bits/stl_tree.h (_Rb_tree_node): Use __aligned_membuf.
	(_Rb_tree_iterator, _Rb_tree_const_iterator): Support construction
	from _Base_ptr.
	(_Rb_tree_const_iterator::_M_const_cast): Remove static_cast.
	(_Rb_tree::begin, _Rb_tree::end): Remove static_cast.
	* include/ext/aligned_buffer.h (__aligned_membuf): New type using
	alignment of _Tp as a member subobject, not as a complete object.
	* python/libstdcxx/v6/printers.py (StdRbtreeIteratorPrinter): Lookup
	_Link_type manually as it might not be in the debug info.

From-SVN: r223745
2015-05-27 12:18:37 +01:00
Jonathan Wakely df6d9c7f6a c++config (__gnu_cxx::__cxx11): Define new namespace.
* include/bits/c++config (__gnu_cxx::__cxx11): Define new namespace.
	* include/ext/codecvt_specializations.h (encoding_state,
	encoding_char_traits): Remove abi-tag and use inline namespace.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error line.

From-SVN: r221533
2015-03-20 13:26:55 +00:00
Jonathan Wakely 168ad5f5e3 re PR c++/65046 (-Wabi-tag doesn't warn about variables or function return types)
PR c++/65046
	* config/locale/gnu/messages_members.cc (Catalog_info, Catalogs,
	get_catalogs): Add abi-tag.
	* include/ext/codecvt_specializations.h (encoding_state,
	encoding_char_traits): Likewise.
	* src/c++11/cxx11-ios_failure.cc (io_error_category): Likewise.
	* src/c++11/cxx11-shim_facets.cc (__any_string::operator basic_string,
	numpunct_shim, collate_shim, time_get_shim, moneypunct_shim,
	money_get_shim, money_put_shim, messages_shim): Likewise.
	* src/c++11/future.cc (future_error_category::message): Likewise.
	* src/c++11/system_error.cc (generic_error_category::message,
	system_error_category::message): Likewise.
	(__sso_string): Disable -Wabi-tag warnings.

From-SVN: r221497
2015-03-18 18:08:29 +00:00
Jonathan Wakely 85d44192f6 atomic_base.h: Use __always_inline__ instead of always_inline.
* include/bits/atomic_base.h: Use __always_inline__ instead of
	always_inline.
	* include/bits/atomic_futex.h: Likewise.
	* include/bits/c++config: Use __abi_tag__ instead of abi_tag.
	* include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp: Use
	__packed__ instead of packed.
	* include/std/shared_mutex: Use __unused__ instead of unused.
	* testsuite/17_intro/headers/c++1998/all_attributes.cc: New.
	* testsuite/17_intro/headers/c++200x/all_attributes.cc: New.
	* testsuite/17_intro/headers/c++2014/all_attributes.cc: New.

From-SVN: r220243
2015-01-29 12:47:20 +00:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Jonathan Wakely 0f3d27f01a re PR libstdc++/64276 (would be better to use __cpp_exceptions rather than __EXCEPTIONS to determine whether exceptions are available)
PR libstdc++/64276
	* doc/doxygen/user.cfg.in: Define __cpp_exceptions and __cpp_rtti.
	* doc/html/manual/using_exceptions.html: Regenerate.
	* doc/xml/manual/using_exceptions.xml: Use SD-6 feature-testing
	macros, __cpp_exceptions and __cpp_rtti, instead of __EXCEPTIONS and
	__GXX_RTTI.
	* include/bits/c++config: Likewise.
	* include/bits/locale_classes.tcc: Likewise.
	* include/bits/shared_ptr.h: Likewise.
	* include/bits/shared_ptr_base.h: Likewise.
	* include/debug/formatter.h: Likewise.
	* include/experimental/any: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/ropeimpl.h: Likewise.
	* include/std/functional: Likewise.
	* include/tr1/functional: Likewise.
	* include/tr1/shared_ptr.h: Likewise.
	* libsupc++/eh_call.cc: Likewise.
	* libsupc++/eh_personality.cc: Likewise.
	* libsupc++/exception_defines.h: Likewise.
	* libsupc++/exception_ptr.h: Likewise.
	* libsupc++/guard.cc: Likewise.
	* libsupc++/pbase_type_info.cc: Likewise.
	* libsupc++/pointer_type_info.cc: Likewise.
	* libsupc++/vterminate.cc: Likewise.
	* src/c++11/thread.cc: Likewise.

From-SVN: r218679
2014-12-12 15:58:49 +00:00
Jason Merrill 5f7282e2cb re PR c++/33911 (attribute deprecated vs. templates)
PR c++/33911
gcc/cp/
	* call.c (build_call_a): Don't warn_deprecated_use here.
	(build_over_call): Or here.
	* decl2.c (mark_used): Do it here.
	(is_late_template_attribute): Attribute deprecated is not deferred.
	(cplus_decl_attributes): Propagate TREE_DEPRECATED out to the template.
	* parser.c (cp_parser_template_name): Warn about deprecated template.
	(cp_parser_template_argument): Likewise.
libstdc++-v3/
	* include/backward/binders.h: Suppress -Wdeprecated-declarations.
	* include/ext/array_allocator.h: Likewise.

From-SVN: r217677
2014-11-17 17:09:27 -05:00
Jonathan Wakely 9b81754858 Make streams movable and swappable.
PR libstdc++/54316
	PR libstdc++/53626
	* config/abi/pre/gnu.ver: Add new exports.
	* config/io/basic_file_stdio.h (__basic_file): Support moving and
	swapping.
	* include/bits/basic_ios.h (basic_ios::move, basic_ios::swap):
	Likewise.
	* include/bits/ios_base.h (ios_base::_M_move, ios_base::_M_swap):
	Likewise.
	* include/bits/fstream.tcc (basic_filebuf): Likewise.
	* include/bits/move.h (__exchange): Define for C++11 mode.
	* include/ext/stdio_filebuf.h (stdio_filebuf): Support moving and
	swapping.
	* include/ext/stdio_sync_filebuf.h (stdio_sync_filebuf): Likewise.
	* include/std/fstream (basic_filebuf, basic_ifstream, basic_ofstream,
	basic_fstream): Likewise.
	* include/std/ios: Remove whitespace.
	* include/std/istream (basic_istream, basic_iostream): Support moving
	and swapping.
	* include/std/ostream (basic_ostream): Likewise.
	* include/std/sstream (basic_stringbuf, basic_istringstream,
	basic_ostringstream, basic_stringstream): Likewise.
	* include/std/streambuf (basic_streambuf): Do not default copy
	constructor and assignment on first declaration.
	* include/std/utility (exchange): Forward to __exchange.
	* testsuite/27_io/basic_filebuf/cons/char/copy_neg.cc: New.
	* src/c++11/Makefile.am: Add stream-related files.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/ext11-inst.cc (stdio_filebuf, stdio_sync_filebuf):
	New file for explicit instantiation definitions.
	* src/c++11/ios.cc: Move from src/c++98 to here.
	(ios_base::_M_move, ios_base::_M_swap): Define.
	* src/c++11/ios-inst.cc: Move from src/c++98 to here.
	* src/c++11/iostream-inst.cc: Likewise.
	* src/c++11/istream-inst.cc: Likewise.
	* src/c++11/ostream-inst.cc: Likewise.
	* src/c++11/sstream-inst.cc: Likewise.
	* src/c++11/streambuf-inst.cc: Likewise.
	* src/c++98/Makefile.am: Remove stream-related files.
	* src/c++98/Makefile.in: Regenerate.
	* src/c++98/ext-inst.cc (stdio_filebuf): Remove explicit
	instantiations.
	* src/c++98/misc-inst.cc (stdio_sync_filebuf): Likewise.
	* src/c++98/ios-inst.cc: Move to src/c++11/.
	* src/c++98/ios.cc: Move to src/c++11/.
	* src/c++98/iostream-inst.cc: Likewise.
	* src/c++98/istream-inst.cc: Likewise.
	* src/c++98/ostream-inst.cc: Likewise.
	* src/c++98/sstream-inst.cc: Likewise.
	* src/c++98/streambuf-inst.cc: Likewise.
	* testsuite/27_io/basic_filebuf/cons/char/copy_neg.cc: New.
	* testsuite/27_io/basic_fstream/cons/move.cc: New.
	* testsuite/27_io/basic_fstream/assign/1.cc: New.
	* testsuite/27_io/basic_ifstream/cons/move.cc: New.
	* testsuite/27_io/basic_ifstream/assign/1.cc: New.
	* testsuite/27_io/basic_istringstream/assign/1.cc: New.
	* testsuite/27_io/basic_istringstream/cons/move.cc: New.
	* testsuite/27_io/basic_ofstream/cons/move.cc: New.
	* testsuite/27_io/basic_ofstream/assign/1.cc: New.
	* testsuite/27_io/basic_ostringstream/assign/1.cc: New.
	* testsuite/27_io/basic_ostringstream/cons/move.cc: New.
	* testsuite/27_io/basic_stringstream/assign/1.cc: New.
	* testsuite/27_io/basic_stringstream/cons/move.cc: New.

From-SVN: r215463
2014-09-22 14:34:09 +01:00
Paolo Carlini 429e4fdebf 2014-08-13 Paolo Carlini <paolo.carlini@oracle.com>
* Fix thinko in the last commit.

From-SVN: r213908
2014-08-13 11:56:45 +00:00
Paolo Carlini a3ee88517c re PR libstdc++/62118 (cases under libstdc++-v3/testsuite/ext/ failed on aarch64/arm)
2014-08-13  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/62118
	* include/ext/random.tcc (uniform_on_sphere_helper<2, _RealType>::
	operator()): Use std::hypot only when _GLIBCXX_USE_C99_MATH_TR1.

From-SVN: r213906
2014-08-13 11:24:35 +00:00
Ulrich Drepper 83a4216dd2 random.tcc (uniform_on_sphere_helper): Define.
* include/ext/random.tcc (uniform_on_sphere_helper): Define.
        (uniform_on_sphere_distribution::operator()): Use the new helper
        class for the implementation.

        * testsuite/ext/random/uniform_on_sphere_distribution/operators/
        equal.cc: Remove bogus part of comment.
        * testsuite/ext/random/uniform_on_sphere_distribution/operators/
        inequal.cc: Likewise.
        * testsuite/ext/random/uniform_on_sphere_distribution/operators/
        serialize.cc: Add check to verify result of serialzation and
        deserialization.
        * testsuite/ext/random/uniform_on_sphere_distribution/operators/
        generate.cc: New file.

From-SVN: r213779
2014-08-09 17:56:57 +00:00
Paolo Carlini 6a6bdc3d09 invoke.texi ([Wnarrowing]): Update for non-constants in C++11.
2014-08-09  Paolo Carlini  <paolo.carlini@oracle.com>

	* doc/invoke.texi ([Wnarrowing]): Update for non-constants in C++11.

gcc/cp
2014-08-09  Paolo Carlini  <paolo.carlini@oracle.com>

	* typeck2.c (check_narrowing): Add tsubst_flags_t parameter, change
	return type to bool; in C++11 for constants give errors, not pedwarns.
	* cp-tree.h (check_narrowing): Adjust declaration.
	* call.c (convert_like_real): Update calls.
	* semantics.c (finish_compound_literal): Likewise.

gcc/testsuite
2014-08-09  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp0x/Wnarrowing1.C: Adjust for errors.
	* g++.dg/cpp0x/enum29.C: Adjust.

/libstdc++-v3
2014-08-09  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/ext/pod_char_traits.h (char_traits<__gnu_cxx::
	character<_Value, _Int, _St> >::eof): Fix vs narrowing conversion.

From-SVN: r213776
2014-08-09 08:58:33 +00:00
Jonathan Wakely aec20dcf39 re PR libstdc++/61946 (rope construction, passing allocator referenct without const)
PR libstdc++/61946
	* include/ext/rope (rope::rope(char_producer<_CharT>*, size_t, bool,
	const allocator_type&)): Pass non-const allocator to
	_S_new_RopeFunction.
	* testsuite/ext/rope/61946.cc: New.

From-SVN: r213220
2014-07-29 18:30:25 +01:00
Ed Smith-Rowland 1c4ff014fe PR libstdc++/60037 - SIGFPE in std::generate_canonical<unsigned int...>
2014-07-29  Ed Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/60037 - SIGFPE in std::generate_canonical<unsigned int...>
	* include/bits/random.h (_Adaptor): static_assert for non floating-point
	result type.
	* include/bits/random.tcc (generate_canonical): Ditto.
	* include/ext/random.tcc (hypergeometric_distribution::operator()):
	Use double as a rng result type.
	* testsuite/26_numerics/random/pr60037-neg.cc: New.
	* testsuite/ext/random/hypergeometric_distribution/pr60037.cc: New.

From-SVN: r213207
2014-07-29 14:56:45 +00:00
Paolo Carlini 026ae646e7 random: Minor formatting and cosmetic tweaks.
2014-07-16  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/ext/random: Minor formatting and cosmetic tweaks.
	(uniform_on_sphere_distribution<>::operator==
	(const uniform_on_sphere_distribution&,
	const uniform_on_sphere_distribution&)): Compare the _M_nds.
	(uniform_on_sphere_distribution<>::reset): Reset _M_nd.
	(operator!=(const uniform_on_sphere_distribution&,
	const uniform_on_sphere_distribution&)): Adjust.
	* include/ext/random.tcc: Minor cosmetc tweaks.

From-SVN: r212674
2014-07-16 15:47:26 +00:00
Ulrich Drepper b40d9361f9 random.tcc: Unfortunately more fixes for operator>> and operator<< for...
* include/ext/random.tcc: Unfortunately more fixes for
	operator>> and operator<< for uniform_on_sphere_distribution.

From-SVN: r212517
2014-07-14 12:09:30 +00:00
Ulrich Drepper 5c8efaf2fb random.tcc: Fix operator>> and operator<< for uniform_on_sphere_distribution.
* include/ext/random.tcc: Fix operator>> and operator<< for
	uniform_on_sphere_distribution.

From-SVN: r212496
2014-07-13 16:43:01 +00:00
Ulrich Drepper 863a2c7ecc random: Add uniform_on_sphere_distribution definition.
2014-07-12  Ulrich Drepper  <drepper@gmail.com>

	* include/ext/random: Add uniform_on_sphere_distribution definition.
	* include/ext/random.tcc: Add out-of-band member function definitions
	for uniform_on_sphere_distribution.
	* testsuite/ext/random/uniform_on_sphere_distribution/
	cons/default.cc: New file.
	* testsuite/ext/random/uniform_on_sphere_distribution/
	operators/equal.cc: New file.
	* testsuite/ext/random/uniform_on_sphere_distribution/
	operators/inequal.cc: New file.
	* testsuite/ext/random/uniform_on_sphere_distribution/
	operators/serialize.cc: New file.

From-SVN: r212492
2014-07-13 11:07:44 +00:00
Edward Smith-Rowland 8daac7749f Add the logistic_distribution as an extension.
2014-07-11  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Add the logistic_distribution as an extension.
	* include/ext/random: Add the logistic_distribution.
	* include/ext/random.tcc: Add the logistic_distribution.
	* testsuite/ext/random/logistic_distribution/cons/parms.cc: New.
	* testsuite/ext/random/logistic_distribution/cons/default.cc: New.
	* testsuite/ext/random/logistic_distribution/requirements/typedefs.cc:
	New.
	* testsuite/ext/random/logistic_distribution/operators/inequal.cc: New.
	* testsuite/ext/random/logistic_distribution/operators/equal.cc: New.
	* testsuite/ext/random/logistic_distribution/operators/serialize.cc:
	New.

From-SVN: r212476
2014-07-12 01:32:20 +00:00
Jonathan Wakely 484dc5996f alloc_traits.h (__alloc_rebind): Define alias template.
* include/bits/alloc_traits.h (__alloc_rebind): Define alias template.
	* include/bits/forward_list.h (_Fwd_list_base): Use __alloc_rebind.
	* include/bits/hashtable_policy.h (_Insert_base, _Hashtable_alloc):
	Likewise.
	* include/ext/alloc_traits.h: Fix comment.

From-SVN: r211995
2014-06-25 21:54:34 +01:00
Jonathan Wakely 3fa591d4b4 functexcept.h (__throw_out_of_range_fmt): Change attribute to __gnu_printf__ archetype to prevent warnings for "%zu".
* include/bits/functexcept.h (__throw_out_of_range_fmt): Change
	attribute to __gnu_printf__ archetype to prevent warnings for "%zu".
	* include/bits/locale_facets_nonio.tcc (time_get::do_get_weekday):
	Remove unused typedef.
	(time_get::do_get_monthname): Likewise.
	* include/bits/stl_tree.h: Add system_header pragma.
	* include/ext/stdio_sync_filebuf.h (stdio_sync_filebuf::file): Remove
	redundant const-qualifier.
	* include/std/complex (complex::__rep): Use _GLIBCXX_CONSTEXPR macro
	instead of _GLIBCXX_USE_CONSTEXPR.

From-SVN: r211951
2014-06-24 16:44:17 +01:00
Jonathan Wakely 10d43d2fb4 api.xml: Link to more recent API docs.
* doc/xml/api.xml: Link to more recent API docs.
	* include/bits/allocator.h: Fix link in doxygen comment.
	* include/bits/char_traits.h: Likewise.
	* include/bits/ios_base.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/ext/mt_allocator.h: Likewise.
	* include/std/fstream: Likewise.
	* include/std/iosfwd: Likewise.
	* include/std/ostream: Likewise.
	* include/std/sstream: Likewise.
	* include/std/streambuf: Likewise.
	* doc/html/*: Regenerate.

From-SVN: r211671
2014-06-14 21:22:10 +01:00
Jonathan Wakely e8043fa674 status_cxx2014.xml: Update Fundamentals TS status.
* doc/xml/manual/status_cxx2014.xml: Update Fundamentals TS status.
	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/experimental/any: New.
	* include/ext/aligned_buffer.h (__aligned_buffer(nullptr_t)): New
	constructor.
	* testsuite/experimental/any/assign/1.cc: New.
	* testsuite/experimental/any/assign/2.cc: New.
	* testsuite/experimental/any/cons/1.cc: New.
	* testsuite/experimental/any/cons/2.cc: New.
	* testsuite/experimental/any/cons/3.cc: New.
	* testsuite/experimental/any/misc/any_cast.cc: New.
	* testsuite/experimental/any/misc/any_cast_neg.cc: New.
	* testsuite/experimental/any/misc/any_cast_no_rtti.cc: New.
	* testsuite/experimental/any/misc/swap.cc: New.
	* testsuite/experimental/any/modifiers/1.cc: New.
	* testsuite/experimental/any/observers/type.cc: New.

From-SVN: r211669
2014-06-14 17:00:56 +01:00
Jonathan Wakely 060269c481 re PR libstdc++/61390 (error in nested template parameter in ext/pb_ds header file)
PR libstdc++/61390
	* include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
	(bin_search_tree_traits): Do not redeclare template-parameters.
	* testsuite/util/testsuite_iterators.h (test_container): Likewise.

From-SVN: r211421
2014-06-10 19:09:18 +01:00
Jonathan Wakely d530142ddb re PR libstdc++/21609 (array_allocator vs rebind & templated constructor)
PR libstdc++/21609
	* include/ext/array_allocator.h: Add deprecated attribute.

From-SVN: r207280
2014-01-29 20:43:44 +00:00