Backport from mainline
2017-08-09 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/79820
PR libstdc++/81751
* config/io/basic_file_stdio.cc (sys_open(FILE*, ios_base::openmode)):
Call fflush on the stream instead of calling sync() while _M_cfile is
null. Restore original value of errno.
* testsuite/ext/stdio_filebuf/char/79820.cc: New.
* testsuite/ext/stdio_filebuf/char/81751.cc: New.
From-SVN: r251090
2017-07-26 Richard Biener <rguenther@suse.de>
Backport from mainline
2017-06-02 Richard Biener <rguenther@suse.de>
Markus Eisenmann <meisenmann.lba@fh-salzburg.ac.at>
PR libstdc++/80721
* libsupc++/eh_alloc.cc (pool::free): Keep list properly
sorted and add missing freelist item merging cases.
2017-06-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/81410
* tree-vect-stmts.c (vectorizable_load): Properly adjust for
the gap in the ! slp_perm SLP case after each group.
* gcc.dg/vect/pr81410.c: New testcase.
2017-07-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/81455
* tree-ssa-loop-unswitch.c (find_loop_guard): Make sure to
not walk in cycles when looking for guards.
* gcc.dg/pr81455.c: New testcase.
2017-07-25 Richard Biener <rguenther@suse.de>
PR middle-end/81505
* fold-const.c (fold_negate_const): TREE_OVERFLOW should be
sticky.
* gcc.dg/ubsan/pr81505.c: New testcase.
2017-07-04 Jakub Jelinek <jakub@redhat.com>
PR target/81175
* gcc.target/i386/pr69255-2.c (foo): Use the return value of the
gather.
2017-06-28 Jakub Jelinek <jakub@redhat.com>
PR target/81175
* config/i386/i386.c (ix86_init_mmx_sse_builtins): Use def_builtin
rather than def_builtin_pure for __builtin_ia32_gatherpf*.
2017-06-26 Richard Biener <rguenther@suse.de>
PR target/81175
* config/i386/i386.c (ix86_init_mmx_sse_builtins):
Use def_builtin_pure for all gather builtins.
* gfortran.dg/pr81175.f: New testcase.
2017-06-21 Marc Glisse <marc.glisse@inria.fr>
* config/i386/i386.c (struct builtin_isa): New field pure_p.
Reorder for compactness.
(def_builtin, def_builtin2, ix86_add_new_builtins): Handle pure_p.
(def_builtin_pure, def_builtin_pure2): New functions.
(ix86_init_mmx_sse_builtins) [__builtin_ia32_stmxcsr]: Mark as pure.
* gcc.dg/tree-ssa/addadd.c: Un-XFAIL.
* gcc.dg/tree-ssa/addadd-2.c: New file.
From-SVN: r250560
Backport from mainline
2017-07-06 Jonathan Wakely <jwakely@redhat.com>
* include/bits/uses_allocator.h (__use_alloc(const _Alloc&&)): Add
deleted overload to prevent dangling references to rvalues.
* include/experimental/memory_resource
(polymorphic_allocator::construct): Do not call __use_alloc with
rvalue arguments.
From-SVN: r250537
Backport from mainline
2017-07-14 Jason Merrill <jason@redhat.com>
Jonathan Wakely <jwakely@redhat.com>
* include/std/variant (variant::variant(_Tp&&)): Constrain to remove
the constructor for empty variants from the candidate functions
during class template argument deduction.
* testsuite/20_util/variant/deduction.cc: New.
From-SVN: r250534
Backport from mainline
2017-04-21 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/80316
* include/std/future (_State_baseV2::_Setter::operator()): Remove
_S_check calls that are done after the pointer to the shared state is
already dereferenced.
(_State_baseV2::_Setter<_Res, void>): Define specialization for void
as partial specialization so it can be defined within the definition
of _State_baseV2.
(_State_baseV2::__setter): Call _S_check.
(_State_baseV2::__setter(promise<void>*)): Add overload for use by
promise<void>::set_value and promise<void>::set_value_at_thread_exit.
(promise<T>, promise<T&>, promise<void>): Make _State a friend.
(_State_baseV2::_Setter<void, void>): Remove explicit specialization.
(promise<void>::set_value, promise<void>::set_value_at_thread_exit):
Use new __setter overload.
* testsuite/30_threads/promise/members/at_thread_exit2.cc: New test.
* testsuite/30_threads/promise/members/set_exception.cc: Test
promise<T&> and promise<void> specializations.
* testsuite/30_threads/promise/members/set_exception2.cc: Likewise.
Test for no_state error condition.
* testsuite/30_threads/promise/members/set_value2.cc: Likewise.
From-SVN: r250126
Backport from mainline
2017-06-21 Ville Voutilainen <ville.voutilainen@gmail.com>
PR libstdc++/80675
PR libstdc++/80940
* include/std/istream:
(__is_convertible_to_basic_istream_test(basic_istream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream): Use the new base.
(__rvalue_istream_type): New.
(operator>>(_Istream&&, _Tp&&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual extraction.
* include/std/ostream:
(__is_convertible_to_basic_ostream_test(basic_ostream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream): Use the new base.
(__rvalue_ostream_type): New.
(operator<<(_Ostream&&, const _Tp&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual insertion.
* testsuite/27_io/rvalue_streams-2.cc: Add new tests.
From-SVN: r249471
* doc/xml/manual/appendix_contributing.xml: Link to the list of bad
names, and link to the test docs and note higher DejaGnu version
requirement.
* doc/xml/manual/allocator.xml: Fix ViewCVS URLs.
* doc/xml/manual/mt_allocator.xml: Likewise.
* doc/xml/manual/test.xml: Correct instructions on running tests.
* doc/html/*: Regenerate.
From-SVN: r249250
PR libstdc++/80478
* include/std/functional (_Mem_fn_traits_base): Add specializations
for noexcept member function types.
* testsuite/20_util/function_objects/mem_fn/80478.cc: New test.
From-SVN: r248247
* doc/xml/manual/abi.xml: Rephrase one of the references to the
Itanium C++ ABI.
* doc/xml/manual/test.xml: Document DejaGnu 1.5.3 requirement.
* doc/html/*: Regenerate.
From-SVN: r247003
* include/std/functional (default_searcher, __boyer_moore_array_base)
(__is_std_equal_to, __boyer_moore_base_t, boyer_moore_searcher)
(boyer_moore_horspool_searcher): Remove redundant namespace
qualification.
(default_searcher::operator()): Construct return value early and
advance second member in-place.
(boyer_moore_horspool_searcher::operator()): Increment random access
iterator directly instead of using std::next.
(boyer_moore_searcher::operator()): Fix return value.
* testsuite/20_util/function_objects/searchers.cc: Check both parts
of return values.
From-SVN: r246964
PR libstdc++/80229
* include/bits/shared_ptr_base.h
(__shared_ptr::_M_enable_shared_from_this_with): Change parameters to
non-const and then use remove_cv to get unqualified type.
* testsuite/20_util/enable_shared_from_this/members/const.cc: Don't
cast away constness on object created const.
* testsuite/20_util/shared_ptr/cons/80229.cc: New test.
From-SVN: r246520
* testsuite/23_containers/array/tuple_interface/
tuple_element_debug_neg.cc: Adjust dg-error.
* testsuite/23_containers/list/operations/78389.cc: Fix less-than to
define a valid strict weak ordering.
* testsuite/23_containers/priority_queue/67085.cc: Disable test for
Debug Mode, due to debug checks making extra copies of predicate.
* testsuite/ext/pb_ds/regression/priority_queue_binary_heap-62045.cc:
Likewise.
From-SVN: r246426
2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com>
Implement LWG 2686, Why is std::hash specialized for error_code,
but not error_condition?
* include/std/system_error (hash<error_condition>): Define for C++17.
* testsuite/20_util/hash/operators/size_t.cc (hash<error_condition>):
Instantiate test for error_condition.
* testsuite/20_util/hash/requirements/explicit_instantiation.cc
(hash<error_condition>): Instantiate hash<error_condition>.
From-SVN: r246424
* doc/xml/manual/appendix_contributing.xml: Convert link to
ansi.org to https.
Update link to the C++ standard at ansi.org.
* doc/xml/faq.xml: Remove information redundant with the above;
instead add a reference.
From-SVN: r246259
* src/c++11/codecvt.cc (range): Add non-type template parameter and
define oerloaded operators for reading and writing code units.
(range<Elem, false>): Define partial specialization for accessing
wide characters in potentially unaligned byte ranges.
(ucs2_span(const char16_t*, const char16_t*, ...))
(ucs4_span(const char16_t*, const char16_t*, ...)): Change parameters
to range<const char16_t, false> in order to avoid unaligned reads.
(__codecvt_utf16_base<char16_t>::do_out)
(__codecvt_utf16_base<char32_t>::do_out)
(__codecvt_utf16_base<wchar_t>::do_out): Use range specialization for
unaligned data to avoid unaligned writes.
(__codecvt_utf16_base<char16_t>::do_in)
(__codecvt_utf16_base<char32_t>::do_in)
(__codecvt_utf16_base<wchar_t>::do_in): Likewise for writes. Return
error if there are unprocessable trailing bytes.
(__codecvt_utf16_base<char16_t>::do_length)
(__codecvt_utf16_base<char32_t>::do_length)
(__codecvt_utf16_base<wchar_t>::do_length): Pass arguments of type
range<const char16_t, false> to span functions.
* testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc: New test.
From-SVN: r246245
PR libstdc++/80041
* src/c++11/codecvt.cc (__codecvt_utf16_base<wchar_t>::do_out)
(__codecvt_utf16_base<wchar_t>::do_in): Convert char arguments to
char16_t to work with UTF-16 instead of UTF-8.
* testsuite/22_locale/codecvt/codecvt_utf16/80041.cc: New test.
From-SVN: r246202
PR libstdc++/79980
* include/bits/locale_conv.h (__do_str_codecvt): Set __count on
error path.
* src/c++11/codecvt.cc (operator&=, operator|=, operator~): Overloads
for manipulating codecvt_mode values.
(read_utf16_bom): Compare input to BOM constants instead of integral
constants that depend on endianness. Take mode parameter by
reference and adjust it, to distinguish between no BOM present and
UTF-16BE BOM present.
(ucs4_in, ucs2_span, ucs4_span): Adjust calls to read_utf16_bom.
(surrogates): New enumeration type.
(utf16_in, utf16_out): Add surrogates parameter to choose between
UTF-16 and UCS2 behaviour.
(utf16_span, ucs2_span): Use std::min not std::max.
(ucs2_out): Use std::min not std::max. Disallow surrogate pairs.
(ucs2_in): Likewise. Adjust calls to read_utf16_bom.
* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: New test.
* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: New test.
From-SVN: r246200
Implement LWG 2857, {variant,optional,any}::emplace should
return the constructed value.
* include/std/any (emplace(_Args&&...)): Change the return type and
return a reference to the constructed value.
(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
* include/std/optional (emplace(_Args&&...)): Likewise.
(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
* include/std/variant (emplace<_Tp>(_Args&&...)): Likewise.
(emplace<_Tp>(initializer_list<_Up>, _Args&&...)): Likewise.
(emplace<_Np>(_Args&&...)): Likewise.
(emplace<_Np>(initializer_list<_Up>, _Args&&...)): Likewise.
* testsuite/20_util/any/assign/emplace.cc: Add tests for
checking the return value of emplace.
* testsuite/20_util/any/misc/any_cast_neg.cc: Adjust.
* testsuite/20_util/optional/assignment/6.cc: Add tests for
checking the return value of emplace.
* testsuite/20_util/variant/run.cc: Likewise.
From-SVN: r246182
PR libstdc++/80034
* include/bits/list.tcc (merge(list&&)): Use const for the size_t
in the catch-block.
(merge(list&&, _StrictWeakOrdering)): Likewise.
* testsuite/23_containers/list/operations/80034.cc: New.
From-SVN: r246107
* include/bits/invoke.h (__invoke): Use __invoke_result instead of
result_of, and __is_nothrow_invocable instead of
__is_nothrow_callable.
* include/bits/shared_ptr_base.h (__shared_ptr): Use __is_invocable
instead of __is_callable.
* include/std/functional (invoke): use invoke_result_t instead of
result_of_t and is_nothrow_invocable instead of is_nothrow_callable.
(_Not_fn): Use __invoke_result instead of result_of.
* include/std/type_traits (__result_of_memobj, __result_of_memfun):
Remove partial specializations for reference_wrapper types.
(__result_of_impl): Use __inv_unwrap to strip reference_wrapper.
(__invoke_result): Define replacement for result_of and then use it to
define result_of.
(__is_callable_impl, __is_callable, __is_nothrow_callable): Replace
with __is_invocable_impl, __is_invocable, and __is_nothrow_invocable
respectively.
(invoke_result, invoke_result_t): Define for C++17.
(is_callable, is_nothrow_callable): Replace with is_invocable,
is_invocable_r, is_nothrow_invocable, and is_nothrow_invocable_r.
(is_callable_v, is_nothrow_callable_v): Replace with is_invocable_v,
is_invocable_r_v, is_nothrow_invocable_v, and is_nothrow_invocable_r_v.
* include/std/variant (hash<variant<T...>>): Use is_nothrow_invocable_v
instead of is_nothrow_callable_v.
* testsuite/20_util/function_objects/invoke/59768.cc: Remove unused
main function.
* testsuite/20_util/function_objects/not_fn/1.cc: Use is_invocable
instead of is_callable.
* testsuite/20_util/is_callable/*: Rename directory and adjust tests
to use new traits.
* testsuite/20_util/is_notjrow_callable/*: Likewise.
* testsuite/20_util/optional/hash.cc: Use is_invocable_v instead of
is_callable.
* testsuite/20_util/variant/hash.cc: Likewise.
From-SVN: r246036
libstdc++-v3 configure checks whether old glibc inline definitions
of isnan would conflict with the libstdc++-v3 definitions and
works around them if so. But if g++ 6.x build A is used to build
another g++ 6.x B, the configure step for B will pick up the math.h
installed alongside A instead of the glibc version. configure will
then assume that the workaround isn't necessary, leaving B with a
broken cmath.
isinf already worked around this. This patch extends the same fix
to isnan. (Thanks to George for the fix.)
libstdc++-v3/
2017-03-10 George Lander <george.lander@arm.com>
* acinclude.m4 (glibcxx_cv_obsolete_isnan): Define
_GLIBCXX_INCLUDE_NEXT_C_HEADERS before including math.h.
* configure: Regenerate.
From-SVN: r246025
* doc/xml/manual/debug_mode.xml: Update and simplify note
on link- and run-time coexistence.
Co-Authored-By: François Dumont <frs.dumont@gmail.com>
Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>
From-SVN: r245848
PR libstdc++/79798
* include/std/functional (bind::_Res_type_impl): Fix incorrect use of
result_of that loses top-level cv-qualifiers.
* testsuite/20_util/bind/79798.cc: New test.
From-SVN: r245827
* include/experimental/iterator: Include <iterator>.
* testsuite/experimental/iterator/requirements.cc: Check for contents
of <iterator>.
From-SVN: r245686
PR libstdc++/60936
* src/c++11/snprintf_lite.cc (__concat_size_t): Calculate length
written to buffer, not length remaining in buffer.
From-SVN: r245505