Commit Graph

8413 Commits

Author SHA1 Message Date
Jonathan Wakely b0e0168246 Remove unused headers from tests
* testsuite/27_io/filesystem/path/decompose/extension.cc: Remove
	unused <vector> header.
	* testsuite/27_io/filesystem/path/query/empty.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_extension.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_filename.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_parent_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_relative_path.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/query/has_root_directory.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/query/has_root_name.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_root_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_stem.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/is_relative.cc: Likewise.
	* testsuite/experimental/filesystem/path/decompose/extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/empty.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/has_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_name.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/is_relative.cc:
	Likewise.

From-SVN: r260256
2018-05-15 13:43:44 +01:00
Jonathan Wakely 6cda876da2 PR libstdc++/84159 fix appending strings to paths
The path::operator/=(const Source&) and path::append overloads were
still following the semantics of the Filesystem TS not C++17. Only
the path::operator/=(const path&) overload was correct.

This change adds more tests for path::operator/=(const path&) and adds
new tests to verify that the other append operations have equivalent
behaviour.

	PR libstdc++/84159
	* include/bits/fs_path.h (path::operator/=, path::append): Construct
	temporary path before calling _M_append.
	(path::_M_append): Change parameter to path and implement C++17
	semantics.
	* testsuite/27_io/filesystem/path/append/path.cc: Add helper function
	and more examples from the standard.
	* testsuite/27_io/filesystem/path/append/source.cc: New.
	* testsuite/27_io/filesystem/path/decompose/filename.cc: Add comment.
	* testsuite/27_io/filesystem/path/nonmember/append.cc: New.

From-SVN: r260255
2018-05-15 13:07:09 +01:00
Jonathan Wakely e4a5135fe3 Qualify std::__invoke in <variant> to prevent ADL
* include/std/variant (__gen_vtable_impl::__visit_invoke): Qualify
	__invoke to prevent ADL.

From-SVN: r260254
2018-05-15 13:06:57 +01:00
Jonathan Wakely e77497ab77 PR libstdc++/81256 fix exception handling in basic_filebuf::close
PR libstdc++/81256
	* include/bits/fstream.tcc (basic_filebuf::close): Do not swallow
	exceptions from _M_terminate_output().
	* include/std/fstream (basic_filebuf::~basic_filebuf): Swallow any
	exceptions from close().
	* testsuite/27_io/basic_filebuf/close/81256.cc: New.

From-SVN: r260236
2018-05-14 19:57:45 +01:00
Jonathan Wakely cd2f262b2f Add __attribute__((malloc) to allocator and remove unused code
* include/bits/valarray_array.h (__valarray_get_memory): Remove.
	(__valarray_get_storage): Call operator new directly. Remove ignored
	top-level restrict qualifier and add malloc attribute instead.
	(_Array<_Tp>::_Array(size_t)): Remove unused constructor.

From-SVN: r260230
2018-05-14 16:35:12 +01:00
Jonathan Wakely 6bfbebb063 PR libstdc++/67554 Do not pass null pointers to memcpy
PR libstdc++/67554
	* include/bits/valarray_array.h (_Array_copy_ctor<_Tp, true>)
	(_Array_copier<_Tp, true>): Do not pass null pointers to memcpy.

From-SVN: r260229
2018-05-14 16:35:06 +01:00
Jonathan Wakely 3846b8e4b3 PR libstdc++/82966 fix swapping of node handles
PR libstdc++/82966
	* include/bits/node_handle.h (_Node_handle_common::_M_swap): Use value
	instead of type.
	* testsuite/23_containers/set/modifiers/node_swap.cc: New.

From-SVN: r260226
2018-05-14 15:27:54 +01:00
Ville Voutilainen 456dbc7275 re PR libstdc++/80165 (Constexpr tuple of variant doesn't work)
PR libstdc++/80165
* testsuite/20_util/variant/80165.cc: New.

From-SVN: r260209
2018-05-13 13:36:12 +03:00
Edward Smith-Rowland 3a2e98ce72 correct changelog!
2018-05-10  Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/83140 - assoc_legendre returns negated value when m is odd
	* include/tr1/legendre_function.tcc (__assoc_legendre_p): Add __phase
	argument defaulted to +1.  Doxy comments on same.
	* testsuite/special_functions/02_assoc_legendre/
	check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	02_assoc_legendre/check_value.cc: Regen.

From-SVN: r260149
2018-05-11 01:44:05 +00:00
Jonathan Wakely 0f8a1c150e Document Dual ABI for std::ios_base::failure
* doc/xml/faq.xml: Link to C++17 status. Add note to outdated answer.
	* doc/xml/manual/debug_mode.xml: Add array and forward_list to list
	of C++11 containers with Debug Mode support.
	* doc/xml/manual/using.xml: Document Dual ABI for ios_base::failure.
	* doc/html/*: Regenerate.

From-SVN: r260129
2018-05-10 20:13:42 +01:00
Jason Merrill a6e1cfddc4 regex_compiler.h (_S_cache_size): Change from function to variable.
* include/bits/regex_compiler.h (_S_cache_size): Change from
	function to variable.

From-SVN: r260128
2018-05-10 15:12:23 -04:00
Edward Smith-Rowland 88bf4c34e3 PR libstdc++/83140 - assoc_legendre returns negated value when m is odd
2018-05-10  Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/83140 - assoc_legendre returns negated value when m is odd
	* include/tr1/legendre_function.tcc (__assoc_legendre_p): Add __phase
	argument defaulted to +1.  Doxy comments on same.
	* testsuite/special_functions/02_assoc_legendre/
	check_assoc_legendre.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	02_assoc_legendre/check_tr1_assoc_legendre.cc: Regen.

From-SVN: r260115
2018-05-10 13:59:52 +00:00
Jonathan Wakely daf6948991 PR libstdc++/85729 add linkage specifications to headers
PR libstdc++/85729
	* include/bits/c++config.h (__replacement_assert): Add linkage
	specification.
	* include/bits/std_abs.h: Add comment to closing brace of block.
	* include/c_global/cstddef: Add linkage specification.
	* include/c_global/cstring: Likewise.
	* include/c_global/cwchar: Likewise.

From-SVN: r260114
2018-05-10 13:35:45 +01:00
François Dumont 6c882d0fdc safe_iterator.h (_Safe_iterator<>::_M_constant()): Rename in...
2018-05-09  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/safe_iterator.h (_Safe_iterator<>::_M_constant()):
	Rename in...
	(_Safe_iterator<>::_S_constant()): ...that.
	* include/debug/safe_local_iterator.h
	(_Safe_local_iterator<>::_M_constant()): Rename in...
	(_Safe_local_iterator<>::_S_constant()): ...that.
	* include/debug/formatter.h: Remove bits/cpp_type_traits.h include.
	(_Iterator_state::__rbegin): New.
	(_Iterator_state::__rmiddle): New.
	(_Iterator_state::__rend): New.
	(_Parameter::_Parameter(const _Safe_iterator<>&, const char*,
	_Is_iterator)): Use _Safe_iterator<>::_S_constant. Grab normal underlying
	iterator type.
	(_Parameter::_Parameter(const _Safe_local_iterator<>&, const char*,
	_Is_iterator)): Likewise.
	(_Parameter::_S_reverse_state(_Iterator_state)): New.
        (_Parameter(__gnu_cxx::__normal_iterator<> const&, const char*,
	_Is_iterator)): New.
	(_Parameter(std::reverse_iterator<> const&, const char*,
	_Is_iterator)): New.
	(_Parameter(std::reverse_iterator<_Safe_iterator<>> const&,
	const char*, _Is_iterator)): New.
	(_Parameter(std::move_iterator<> const&, const char*, _Is_iterator):
	New.
	(_Parameter(std::move_iterator<_Safe_iterator<>> const&, const char*,
	_Is_iterator)): New.
	* testsuite/24_iterators/move_iterator/debug_neg.cc: New.
	* testsuite/24_iterators/normal_iterator/debug_neg.cc: New.
	* testsuite/24_iterators/reverse_iterator/debug_neg.cc: New.

From-SVN: r260093
2018-05-09 20:04:46 +00:00
Jonathan Wakely 88b1e41c2d Make std::function tolerate semantically non-CopyConstructible objects
To satisfy the CopyConstructible requirement a callable object stored in
a std::function must behave the same when copied from a const or
non-const source. If copying a non-const object doesn't produce an
equivalent copy then the behaviour is undefined. But we can make our
std::function more tolerant of such objects by ensuring we always copy
from a const lvalue.

Additionally use an if constexpr statement in the _M_get_pointer
function to avoid unnecessary instantiations in the discarded branch.

	* include/bits/std_function.h (_Base_manager::_M_get_pointer):
	Use constexpr if in C++17 mode.
	(_Base_manager::_M_clone(_Any_data&, const _Any_data&, true_type)):
	Copy from const object.
	* testsuite/20_util/function/cons/non_copyconstructible.cc: New.

From-SVN: r260080
2018-05-09 14:28:11 +01:00
François Dumont e95a74fda2 debug.cc [...]: Include execinfo.h.
2018-05-08  François Dumont  <fdumont@gcc.gnu.org>

	* src/c++11/debug.cc [_GLIBCXX_HAVE_EXECINFO_H]: Include execinfo.h.
	[_GLIBCXX_HAVE_EXECINFO_H](_Error_formatter::_M_error): Render
	backtrace.

From-SVN: r260054
2018-05-08 20:00:52 +00:00
François Dumont 90aabc7e9b macros.h (__glibcxx_check_valid_range_at): New.
2018-05-08  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/macros.h (__glibcxx_check_valid_range_at): New.
	* include/debug/functions.h (__check_valid_range): Use latter.
	* include/debug/macros.h (__glibcxx_check_valid_constructor_range): New,
	use latter.
	* include/debug/deque
	(deque::deque<_Iter>(_Iter, _Iter, const _Alloc&)): Use latter.
	* include/debug/forward_list
	(forward_list::forward_list<_Iter>(_Iter, _Iter, const _Alloc&)):
	Likewise.
	* include/debug/list
	(list::list<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
	* include/debug/list
	(list::list<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
	* include/debug/map.h
	(map::map<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
	(map::map<_Iter>(_Iter, _Iter, const _Compare&, const _Alloc&)):
	Likewise.
	* include/debug/multimap.h
	(multimap::multimap<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
	(multimap::multimap<_Iter>(_Iter, _Iter, const _Compare&,
	const _Alloc&)): Likewise.
	* include/debug/set.h
	(set::set<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
	(set::set<_Iter>(_Iter, _Iter, const _Compare&, const _Alloc&)):
	Likewise.
	* include/debug/multiset.h
	(multiset::multiset<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
	(multiset::multiset<_Iter>(_Iter, _Iter, const _Compare&,
	const _Alloc&)): Likewise.
	* include/debug/string
	(basic_string::basic_string<_Iter>(_Iter, _Iter, const _Alloc&)):
	Likewise.
	* include/debug/unordered_map
	(unordered_map::unordered_map<_Iter>(_Iter, _Iter, const _Alloc&)):
	Likewise.
	(unordered_multimap::unordered_multimap<_Iter>(_Iter, _Iter,
	const _Alloc&)): Likewise.
	* include/debug/unordered_set
	(unordered_set::unordered_set<_Iter>(_Iter, _Iter, const _Alloc&)):
	Likewise.
	(unordered_multiset::unordered_multiset<_Iter>(_Iter, _Iter,
	const _Alloc&)): Likewise.
	* include/debug/vector
	(vector::vector<_Iter>(_Iter, _Iter, const _Alloc&)): Use latter.

From-SVN: r260053
2018-05-08 19:46:59 +00:00
François Dumont a5277405c8 formatter.h (_Error_formatter::_M_function): New.
2018-05-08  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/formatter.h (_Error_formatter::_M_function): New.
	(_Error_formatter(const char*, unsigned int)): Adapt.
	(_Error_formatter::_M_at): Rename in...
	(_Error_formatter::_S_at): ...that and adapt.
	* include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_AT_F): New.
	(_GLIBCXX_DEBUG_VERIFY_AT, _GLIBCXX_DEBUG_VERIFY): Adapt.
	* src/c++11/debug.cc (_Error_formatter::_M_error): Render _M_function
	when available.

From-SVN: r260052
2018-05-08 19:41:02 +00:00
Jonathan Wakely ec332f1b44 Make std::regex automata use non-debug vector in Debug Mode
* include/bits/regex_automaton.h (_NFA_base::_M_paren_stack, _NFA):
	Use normal std::vector even in Debug Mode.

From-SVN: r260046
2018-05-08 17:21:35 +01:00
Jonathan Wakely 41c3db9f28 PR libstdc++/85672 #undef _GLIBCXX_USE_FLOAT128 when not supported
Restore the behaviour in GCC 8 and earlier where _GLIBCXX_USE_FLOAT128
is not defined when configure detects support is missing. This avoids
having three states where the macro is either 1, 0, or undefined.

	PR libstdc++/85672
	* include/Makefile.am [!ENABLE_FLOAT128]: Change c++config.h entry
	to #undef _GLIBCXX_USE_FLOAT128 instead of defining it to zero.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config (_GLIBCXX_USE_FLOAT128): Move definition
	within conditional block.

From-SVN: r260043
2018-05-08 14:05:04 +01:00
Jonathan Wakely b83f5981c1 Document -lstdc++fs requirement for std::filesystem
* doc/xml/manual/using.xml (table.cmd_options): Document that the
	C++17 Filesystem implementation also needs -lstdc++fs.

From-SVN: r260011
2018-05-07 20:17:16 +01:00
Jonathan Wakely a989f6378b PR libstdc++/85671 allow copy elision in path concatenation
By performing the /= operation on a named local variable instead of a
temporary the copy made for the return value can be elided.

	PR libstdc++/85671
	* include/bits/fs_path.h (operator/): Permit copy elision.
	* include/experimental/bits/fs_path.h (operator/): Likewise.

From-SVN: r260009
2018-05-07 18:26:28 +01:00
Edward Smith-Rowland 228aa0ec8d Moar PR libstdc++/80506
2018-05-07  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Moar PR libstdc++/80506
	* include/bits/random.tcc (gamma_distribution::__generate_impl()):
	Fix magic number used in loop condition.

From-SVN: r260004
2018-05-07 16:17:32 +00:00
Edward Smith-Rowland b118dfdb6d Revert 20001.
From-SVN: r260002
2018-05-07 16:02:46 +00:00
Edward Smith-Rowland c69c7d0381 Moar PR libstdc++/80506
2018-05-07  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Moar PR libstdc++/80506
	* include/bits/random.tcc (gamma_distribution::__generate_impl()):
	Fix magic number used in loop condition.

From-SVN: r260001
2018-05-07 15:55:11 +00:00
Jonathan Wakely d6ed6b074f PR libstdc++/85642 fix is_nothrow_default_constructible<optional<T>>
Add missing noexcept keyword to default constructor of each
_Optional_payload specialization.

	PR libstdc++/85642 fix is_nothrow_default_constructible<optional<T>>
	* include/std/optional (_Optional_payload): Add noexcept to default
	constructor. Re-indent.
	(_Optional_payload<_Tp, true, true, true>): Likewise. Add noexcept to
	constructor for copying disengaged payloads.
	(_Optional_payload<_Tp, true, false, true>): Likewise.
	(_Optional_payload<_Tp, true, true, false>): Likewise.
	(_Optional_payload<_Tp, true, false, false>): Likewise.
	* testsuite/20_util/optional/cons/85642.cc: New.
	* testsuite/20_util/optional/cons/value_neg.cc: Adjust dg-error lines.

From-SVN: r259928
2018-05-04 09:57:23 +01:00
Jonathan Wakely 86f66562b7 PR libstdc++/82644 define TR1 hypergeometric functions in strict modes
Following a recent change for PR 82644 the non-standard hypergeomtric
functions are not defined by <cmath> when __STRICT_ANSI__ is defined
(e.g. for -std=c++17, or -std=c++14 -D__STDCPP_WANT_MATH_SPEC_FUNCS__).
That caused errors in <tr1/cmath> because the using-declarations for
tr1::hyperg et al are invalid in strict modes.

The solution is to define the TR1 hypergeometric functions inline in
<tr1/cmath> if __STRICT_ANSI__ is defined.

	PR libstdc++/82644
	* include/tr1/cmath [__STRICT_ANSI__] (hypergf, hypergl, hyperg): Use
	inline definitions instead of using-declarations.
	[__STRICT_ANSI__] (conf_hypergf, conf_hypergl, conf_hyperg): Likewise.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	07_conf_hyperg/compile_cxx17.cc: New.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	17_hyperg/compile_cxx17.cc: New.

From-SVN: r259912
2018-05-03 23:58:43 +01:00
Jonathan Wakely 1ee021f2f3 PR libstdc++/84769 qualify call to std::get<0>
PR libstdc++/84769
	* include/std/variant (visit): Qualify std::get call.

From-SVN: r259902
2018-05-03 19:58:04 +01:00
Jonathan Wakely 2e023647c8 PR libstdc++/85632 fix wraparound in filesystem::space
On 32-bit targets any values over 4GB would wrap and produce the wrong
result.

	PR libstdc++/85632 use uintmax_t for arithmetic
	* src/filesystem/ops.cc (experimental::filesystem::space): Perform
	arithmetic in result type.
	* src/filesystem/std-ops.cc (filesystem::space): Likewise.
	* testsuite/27_io/filesystem/operations/space.cc: Check total capacity
	is greater than free space.
	* testsuite/experimental/filesystem/operations/space.cc: New.

From-SVN: r259901
2018-05-03 19:58:00 +01:00
Jonathan Wakely adba76a391 Add tests for std::remove_cvref
* testsuite/20_util/remove_cvref/requirements/alias_decl.cc: New.
	* testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc:
	New.
	* testsuite/20_util/remove_cvref/value.cc: New.
	* testsuite/20_util/remove_cvref/value_ext.cc: New.

From-SVN: r259896
2018-05-03 16:12:19 +01:00
Jonathan Wakely 852ee53c27 PR libstdc++/84087 add default arguments to basic_string members (LWG 2268)
This change was a DR against C++11 and so should have been implemented
years ago.

	PR libstdc++/84087 LWG DR 2268 basic_string default arguments
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI=1]
	(append(const basic_string&, size_type, size_type)
	(assign(const basic_string&, size_type, size_type)
	(insert(size_type, const basic_string&, size_type, size_type)
	(replace(size_type,size_type,const basic_string&,size_type,size_type)
	(compare(size_type,size_type,constbasic_string&,size_type,size_type)):
	Add default arguments (LWG 2268).
	[_GLIBCXX_USE_CXX11_ABI=0]
	(append(const basic_string&, size_type, size_type)
	(assign(const basic_string&, size_type, size_type)
	(insert(size_type, const basic_string&, size_type, size_type)
	(replace(size_type,size_type,const basic_string&,size_type,size_type)
	(compare(size_type,size_type,constbasic_string&,size_type,size_type)):
	Likewise.
	* testsuite/21_strings/basic_string/dr2268.cc: New test.

From-SVN: r259895
2018-05-03 16:01:20 +01:00
Jonathan Wakely d49b342694 PR libstdc++/84535 constrain std::thread constructor
The standard requires that the std::thread constructor is constrained so
it can't be called with a first argument of type std::thread. The
current implementation only meets that requirement if the constructor is
called with one argument, by using deleted overloads. This uses an
enable_if constraint to enforce the requirement for any number of
arguments.

Also add a static assertion to give a more readable error for invalid
arguments that cannot be invoked. Also simplify _Invoker to reduce the
error cascade for ill-formed instantiations with non-invocable
arguments.

	PR libstdc++/84535
	* include/std/thread (thread::__not_same): New SFINAE helper.
	(thread::thread(_Callable&&, _Args&&...)): Add SFINAE constraint that
	first argument is not a std::thread. Add static assertion to check
	INVOKE expression is valid.
	(thread::thread(thread&), thread::thread(const thread&&)): Remove.
	(thread::_Invoke::_M_invoke, thread::_Invoke::operator()): Use
	__invoke_result for return types and remove exception specifications.
	* testsuite/30_threads/thread/cons/84535.cc: New.

From-SVN: r259893
2018-05-03 15:08:36 +01:00
Jonathan Wakely 9e3ef54287 Use std::invoke_result in std::async instead of std::result_of
* include/std/future (__async_result_of): Use __invoke_result instead
	of result_of.

From-SVN: r259888
2018-05-03 13:40:15 +01:00
Jonathan Wakely 6791489ee5 Define std::remove_cvref and std::remove_cvref_t for C++2a
Also define __remove_cvref_t for internal use before C++2a.

	* include/std/any (any_cast): Use __remove_cvref_t.
	* include/std/tuple (__make_tuple): Likewise.
	* include/std/type_traits (__remove_cvref_t): Define.
	(__result_of_memobj, __result_of_memfun): Use __remove_cvref_t.
	[__cplusplus > 201703L] (remove_cvref, remove_cvref_t): Define.
	* include/std/variant (__erased_hash): Use __remove_cvref_t.

From-SVN: r259887
2018-05-03 13:40:10 +01:00
François Dumont 27db01d803 deque.tcc (deque<>::_M_assign_aux): Cast to void to ensure overloaded comma not used.
2018-05-02  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/deque.tcc (deque<>::_M_assign_aux): Cast to void to
	ensure overloaded comma not used.
	* include/bits/list.tcc (list<>::_M_assign_dispatch): Likewise.
	* include/bits/vector.tcc (vector<>::_M_assign_aux): Likewise.
	* include/bits/stl_bvector.h (vector<bool>::_M_assign_aux): Likewise.
	* testsuite/23_containers/deque/modifiers/assign/1.cc: New.
	* testsuite/23_containers/list/modifiers/assign/1.cc: New.
	* testsuite/23_containers/vector/bool/modifiers/assign/1.cc: New.
	* testsuite/23_containers/vector/modifiers/assign/1.cc: New.

From-SVN: r259856
2018-05-02 19:51:33 +00:00
Jonathan Wakely 85d0fad469 PR libstdc++/68197 fail on negative iword/pword indices
The suggested resolution of LWG 3083 is to make invalid indices
undefined, but we can fairly easily check for them and treat them as
errors in the same way as allocation failure. This avoids a segfault or
worse, setting an error flag on the stream instead.

	PR libstdc++/68197
	* include/bits/ios_base.h (ios_base::iword, ios_base::pword): Cast
	indices to unsigned.
	* src/c++11/ios.cc (ios_base::_M_grow_words): Treat negative indices
	as failure. Refactor error handling.
	* testsuite/27_io/ios_base/storage/68197.cc: New.

From-SVN: r259854
2018-05-02 20:04:55 +01:00
Jonathan Wakely 1b749ae95e PR libstdc++/83860 avoid dangling references in valarray closure types
Store nested closures by value not by reference, to prevent holding
invalid references to temporaries that have been destroyed. This
changes the layout of the closure types, so change their linkage names,
but moving them to a different namespace.

	PR libstdc++/57997
	PR libstdc++/83860
	* include/bits/gslice_array.h (gslice_array): Define default
	constructor as deleted, as per C++11 standard.
	* include/bits/mask_array.h (mask_array): Likewise.
	* include/bits/slice_array.h (slice_array): Likewise.
	* include/bits/valarray_after.h (_GBase, _GClos, _IBase, _IClos): Move
	to namespace __detail.
	(_GBase::_M_expr, _IBase::_M_expr): Use _ValArrayRef for type of data
	members.
	* include/bits/valarray_before.h (_ValArrayRef): New helper for type
	of data members in closure objects.
	(_FunBase, _ValFunClos, _RefFunClos, _UnBase, _UnClos, _BinBase)
	(_BinBase2, _BinBase1, _BinClos, _SBase, _SClos): Move to namespace
	__detail.
	(_FunBase::_M_expr, _UnBase::_M_expr, _BinBase::_M_expr1)
	(_BinBase::_M_expr2, _BinBase2::_M_expr1, _BinBase1::_M_expr2)
	(_SBase::_M_expr): Use _ValArrayRef for type of data members.
	* include/std/valarray (_UnClos, _BinClos, _SClos, _GClos, _IClos)
	(_ValFunClos, _RefFunClos): Move to namespace __detail and add
	using-declarations to namespace std.
	* testsuite/26_numerics/valarray/83860.cc: New.

From-SVN: r259844
2018-05-02 17:41:46 +01:00
Jonathan Wakely 59bcf90013 Remove duplicate function call in test
* testsuite/backward/strstream_move.cc: Remove duplicate function
	call.

From-SVN: r259843
2018-05-02 17:27:01 +01:00
Jonathan Wakely c6d4257972 PR libstdc++/69608 Move semantics for strstreambuf
In libstdc++ the deprecated char* streams are non-copyable, as was
required pre-C++11.

Since C++11 the standard implies that those streams should be copyable,
but doesn't specify the effects of copying them. This is surely a
defect, so for consistency with other implementations this change makes
them movable, but not copyable.

	PR libstdc++/69608
	* include/backward/strstream (strstreambuf): Define move constructor
	and move assignment operator.
	(istrstream, ostrstream, strstream): Likewise.
	* testsuite/backward/strstream_move.cc: New.

From-SVN: r259842
2018-05-02 17:25:44 +01:00
Tulio Magno Quites Machado Filho f421e442c6 PR libstdc++/84654 Disable __float128 specializations for -mno-float128
2018-05-01  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	PR libstdc++/84654
	* acinclude.m4: Set ENABLE_FLOAT128 instead of _GLIBCXX_USE_FLOAT128.
	* config.h.in: Remove references to _GLIBCXX_USE_FLOAT128.
	* configure: Regenerate.
	* include/Makefile.am: Replace the value of _GLIBCXX_USE_FLOAT128
	based on ENABLE_FLOAT128.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config: Define _GLIBCXX_USE_FLOAT128.
	[!defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)]: Undefine
	_GLIBCXX_USE_FLOAT128.

From-SVN: r259813
2018-05-01 23:47:33 +01:00
H.J. Lu 7b47ecf2f7 Regenerate configure of target libraries
* configure: Regenerated.

From-SVN: r259610
2018-04-24 09:45:26 -07:00
Jakub Jelinek a0e1df888d cet.m4 (GCC_CET_FLAGS): Default to --disable-cet, replace --enable-cet=default with --enable-cet=auto.
* config/cet.m4 (GCC_CET_FLAGS): Default to --disable-cet, replace
	--enable-cet=default with --enable-cet=auto.

	* doc/install.texi: Document --disable-cet being the default and
	--enable-cet=auto.

	* configure: Regenerated.

From-SVN: r259487
2018-04-19 09:45:51 +02:00
Jonathan Wakely 05b1448061 PR libstdc++/85442 fix duplicate debuginfo for cxx11-ios_failure.cc
2018-04-18  Jonathan Wakely  <jwakely@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/85442
	* src/c++11/Makefile.am: Don't generate debuginfo again for
	cxx11-ios_failure-lt.s and cxx11-ios_failure.s files.
	* src/c++11/Makefile.in: Regenerate.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r259467
2018-04-18 13:14:58 +01:00
Jonathan Wakely 8cc8789fb4 PR libstdc++/84442 if _Exit isn't declared then use _exit instead
PR libstdc++/84442
	* testsuite/30_threads/thread/cons/terminate.cc
	[!_GLIBCXX_USE_C99_STDLIB] : Use _exit or std::exit instead of _Exit.

From-SVN: r259463
2018-04-18 12:15:38 +01:00
David Malcolm 001ddaa852 re PR jit/85384 (libgccjit does not work if --with-gcc-major-version is used)
PR jit/85384
	* acx.m4 (GCC_BASE_VER): Remove \$\$ from sed expression.

	* configure.ac (gcc-driver-name.h): Honor --with-gcc-major-version
	by using gcc_base_ver to generate a gcc_driver_version, and use
	it when generating GCC_DRIVER_NAME.
	* configure: Regenerate.

	* configure: Regenerate.

From-SVN: r259462
2018-04-18 11:46:58 +02:00
Jonathan Wakely ef0e80d23c Make Filesystem TS tests pass in C++17 mode
The <testsuite_fs.h> header defaults to using std::filesystem in C++17
mode. The Filesystem TS tests need to define the macro that causes
std::experimental::filesystem to be used instead.

	* testsuite/experimental/filesystem/file_status/1.cc: Add
	-DUSE_FILESYSTEM_TS to dg-options.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Likewise.
	* testsuite/experimental/filesystem/iterators/pop.cc: Likewise.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.
	* testsuite/experimental/filesystem/operations/absolute.cc: Likewise.
	* testsuite/experimental/filesystem/operations/canonical.cc: Likewise.
	* testsuite/experimental/filesystem/operations/copy.cc: Likewise.
	* testsuite/experimental/filesystem/operations/copy_file.cc: Likewise.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/create_symlink.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/current_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/equivalent.cc: Likewise.
	* testsuite/experimental/filesystem/operations/exists.cc: Likewise.
	* testsuite/experimental/filesystem/operations/file_size.cc: Likewise.
	* testsuite/experimental/filesystem/operations/is_empty.cc: Likewise.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/permissions.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/read_symlink.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/remove.cc: Likewise.
	* testsuite/experimental/filesystem/operations/remove_all.cc: Likewise.
	* testsuite/experimental/filesystem/operations/status.cc: Likewise.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/append/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/assign/assign.cc: Likewise.
	* testsuite/experimental/filesystem/path/assign/copy.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/compare.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/strings.cc: Likewise.
	* testsuite/experimental/filesystem/path/concat/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/concat/strings.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/copy.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/default.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/construct/locale.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/range.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_name.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/generic/generic_string.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/itr/traversal.cc: Likewise.
	* testsuite/experimental/filesystem/path/modifiers/clear.cc: Likewise.
	* testsuite/experimental/filesystem/path/modifiers/make_preferred.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/remove_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/replace_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/replace_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/swap.cc: Likewise.
	* testsuite/experimental/filesystem/path/native/string.cc: Likewise.
	* testsuite/experimental/filesystem/path/nonmember/hash_value.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/empty.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/has_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_name.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/is_relative.cc:
	Likewise.

From-SVN: r259396
2018-04-16 09:24:40 +01:00
Jonathan Wakely 272277dc55 Fix broken sed command from previous commit
* src/c++11/Makefile.am: Fix sed command.
	* src/c++11/Makefile.in: Regenerate.

From-SVN: r259374
2018-04-13 11:55:29 +01:00
Jonathan Wakely 06258a7f10 Fix __iosfail_type_info hack to work on darwin
* src/c++11/Makefile.am: Rewrite sed rule to be less fragile and to
	handle mangled names starting with double underscores on darwin.
	* src/c++11/Makefile.in: Regenerate.

From-SVN: r259371
2018-04-13 11:06:21 +01:00
Jonathan Wakely 741346a2af Fix comments that misspell names of files and classes
* src/c++11/Makefile.am: Fix comment.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/cxx11-ios_failure.cc: Fix comment.
	* src/c++98/ios_failure.cc: Likewise.

From-SVN: r259357
2018-04-12 21:55:02 +01:00
Jonathan Wakely ee3e8f4347 Remove #define made redundant by r259281
The definition of __throw_ios_failure is no longer in this file, so
setting the macro here is unnecessary.

	* src/c++11/ios.cc: Remove redundant macro definition.

From-SVN: r259349
2018-04-12 17:06:03 +01:00