Commit Graph

9957 Commits

Author SHA1 Message Date
Ville Voutilainen
13545f19e0 Implement LWG 2733 and LWG 2759
* include/experimental/numeric (gcd): Reject cv-qualified bool.
(lcm): Likewise.
* include/std/numeric (gcd): Likewise.
(lcm): Likewise.
* testsuite/26_numerics/gcd/gcd_neg.cc: Add tests and adjust.
* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.

From-SVN: r254736
2017-11-14 20:11:33 +02:00
Jonathan Wakely
d2e9196e5f Fix typo in std::wbuffer_convert
* include/bits/locale_conv.h (wbuffer_convert::_M_conv_get): Fix typo.
	* testsuite/22_locale/conversions/buffer/3.cc: New test.

From-SVN: r254735
2017-11-14 18:00:53 +00:00
Jonathan Wakely
34c71b8b3a Minor tweak to libstdc++ testsuite helper type
* testsuite/util/testsuite_tr1.h (ThrowMoveConsClass): Use noexcept.

From-SVN: r254644
2017-11-11 00:10:07 +00:00
Jonathan Wakely
54df588530 PR libstdc++/82917 add missing returns in <fstream>
PR libstdc++/82917
	* include/std/fstream (basic_ifstream::open, basic_ofstream::open)
	(basic_fstream::open): Fix missing return.

From-SVN: r254638
2017-11-10 21:43:24 +00:00
Jonathan Wakely
d8dcc3a67d Check for S_ISSOCK before use
* src/filesystem/ops-common.h (make_file_type) [S_ISSOCK]: Only use
	S_ISSOCK when defined.

From-SVN: r254506
2017-11-07 19:08:06 +00:00
François Dumont
187e8ee733 tr1.cc: Compile with -O0.
2017-11-06  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/libstdc++-prettyprinters/tr1.cc:  Compile with -O0.

From-SVN: r254477
2017-11-06 21:15:48 +00:00
Martin Liska
454f8b2b0c Fix -Wreturn-type fallout.
2017-11-06  Martin Liska  <mliska@suse.cz>

	* c-c++-common/cilk-plus/AN/pr57541-2.c (foo1): Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	(foo2): Likewise.
	* c-c++-common/cilk-plus/AN/pr57541.c (foo): Likewise.
	(foo1): Likewise.
	* c-c++-common/cilk-plus/CK/errors.c: Likewise.
	* c-c++-common/cilk-plus/CK/pr60197.c: Likewise.
	* c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise.
	* c-c++-common/fold-masked-cmp-1.c (test_pic): Likewise.
	(test_exe): Likewise.
	* c-c++-common/fold-masked-cmp-2.c (test_exe): Likewise.
	* g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc (my_func): Likewise.
	* g++.dg/cilk-plus/CK/pr68997.cc (fa2): Likewise.
	* g++.dg/eh/sighandle.C (dosegv): Likewise.
	* g++.dg/ext/vector14.C (foo): Likewise.
	(main): Likewise.
	* g++.dg/graphite/pr41305.C: Likewise.
	* g++.dg/graphite/pr42930.C: Likewise.
	* g++.dg/opt/pr46640.C (struct QBasicAtomicInt): Likewise.
	(makeDir): Likewise.
	* g++.dg/other/i386-8.C (foo): Likewise.
	* g++.dg/pr45788.C: Likewise.
	* g++.dg/pr64688.C (at_c): Likewise.
	* g++.dg/pr65032.C (G::DecodeVorbis): Likewise.
	* g++.dg/pr71633.C (c3::fn2): Likewise.
	* g++.dg/stackprotectexplicit2.C (A): Likewise.
	* g++.old-deja/g++.law/weak.C (main): Likewise.
2017-11-06  Martin Liska  <mliska@suse.cz>

	* testsuite/libgomp.c++/loop-2.C: Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	* testsuite/libgomp.c++/loop-4.C: Likewise.
	* testsuite/libgomp.c++/parallel-1.C: Likewise.
	* testsuite/libgomp.c++/shared-1.C: Likewise.
	* testsuite/libgomp.c++/single-1.C: Likewise.
	* testsuite/libgomp.c++/single-2.C: Likewise.
2017-11-06  Martin Liska  <mliska@suse.cz>

	* testsuite/27_io/basic_fstream/cons/char/path.cc (main):
	  Return a value for functions with non-void return type,
	  or change type to void, or add -Wno-return-type for test.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc (main):
	Likewise.
	* testsuite/27_io/basic_ofstream/open/char/path.cc (main):
	Likewise.

From-SVN: r254451
2017-11-06 13:41:35 +00:00
Paolo Carlini
98910bc2b9 deduction.cc: Avoid -Wreturn-type warnings.
2017-11-06  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/20_util/optional/cons/deduction.cc: Avoid -Wreturn-type
	warnings.
	* testsuite/20_util/pair/cons/deduction.cc: Likewise.
	* testsuite/20_util/pair/traits.cc: Likewise.
	* testsuite/20_util/tuple/cons/deduction.cc: Likewise.
	* testsuite/20_util/variant/compile.cc: Likewise.
	* testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise.
	* testsuite/23_containers/unordered_map/modifiers/try_emplace.cc:
	Likewise.

From-SVN: r254450
2017-11-06 12:55:35 +00:00
Gerald Pfeifer
ba89e5d5a7 * doc/xml/manual/abi.xml: Move docs.oracle.com references to https.
From-SVN: r254426
2017-11-05 11:14:38 +00:00
Jonathan Wakely
e641ee437f Define std::endian for C++2a (P0463R1)
* include/std/type_traits (endian): Define new enumeration type.
	* testsuite/20_util/endian/1.cc: New test.

From-SVN: r254381
2017-11-03 15:45:49 +00:00
Jonathan Wakely
97695d99b0 Remove _Node_insert_return::get() member functions (P0508R0)
* include/bits/node_handle.h (_Node_insert_return::get): Remove, as
	per P0508R0.

From-SVN: r254368
2017-11-03 11:04:45 +00:00
François Dumont
86397ed17c printers.py (StdExpAnyPrinter.__init__): Strip typename versioned namespace before the substitution.
2017-11-01  François Dumont  <fdumont@gcc.gnu.org>

	* python/libstdcxx/v6/printers.py (StdExpAnyPrinter.__init__): Strip
	typename versioned namespace before the substitution.
	(StdExpOptionalPrinter.__init__): Likewise.
	(StdVariantPrinter.__init__): Likewise.
	(Printer.add_version): Inject versioned namespace after std or
	__gnu_cxx.
	(build_libstdcxx_dictionary): Adapt add_version usages, always pass
	namespace first and symbol second.

From-SVN: r254320
2017-11-01 17:52:05 +00:00
Jonathan Wakely
50e248f0c8 PR libstdc++/82777 fix path normalization for dot-dot
PR libstdc++/82777
	* src/filesystem/std-path.cc (path::lexically_normal): Remove dot-dot
	elements correctly.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Add testcase.
	* testsuite/util/testsuite_fs.h (compare_paths): Improve exception
	text.

From-SVN: r254317
2017-11-01 17:09:14 +00:00
Jonathan Wakely
97b99f9c77 Don't create broken symlink in libstdc++-v3/include/bits
* include/Makefile.am (stamp-bits-sup): Do not create broken symlink
	to stamp-bits.
	* include/Makefile.in: Regenerate.

From-SVN: r254229
2017-10-30 16:28:13 +00:00
Jonathan Wakely
0a6e98b78b Remove ios_mode::trunc from basic_ofstream openmode arguments
* include/std/fstream (basic_ifstream, basic_ofstream, basic_fstream):
	Remove outdated comments about calling c_str() to create a file stream
	from a std::string.
	(basic_ofstream::basic_ofstream, basic_ofstream::open): Remove
	redundant ios_mode::trunc bits from default arguments and comments.

From-SVN: r254226
2017-10-30 15:35:02 +00:00
Jonathan Wakely
932bfa9bc7 Minor tweak to libstdc++ FAQ
* doc/xml/faq.xml: Adjust "What is libstdc++?" answer slightly.

From-SVN: r254224
2017-10-30 14:56:23 +00:00
Jonathan Wakely
02a2c6303f Minor header reorganization for unordered containers
* include/bits/hashtable_policy.h: Include <tuple>.
	* include/std/unordered_map: Only include <bits/stl_pair.h> instead
	of <utility> and <tuple>.
	* include/std/unordered_set: Likewise.

From-SVN: r254223
2017-10-30 14:54:28 +00:00
Ville Voutilainen
ccbbf8df05 Implement LWG 2485
* include/debug/array (get(const array<_Tp, _Nm>&&)): New.
* include/std/array (get(const array<_Tp, _Nm>&&)): Likewise.
* include/std/tuple (get(const tuple<_Elements...>&&)): Likewise.
(get(const tuple<_Types...>&&)): Likewise.
* include/std/utility
(__pair_get::__const_move_get(const std::pair<_Tp1, _Tp2>&&)):
Likewise.
(get(const std::pair<_Tp1, _Tp2>&&)): Likewise.
(get(const pair<_Tp, _Up>&&)): Likewise.
(get(const pair<_Up, _Tp>&&)): Likewise.
* testsuite/20_util/pair/astuple/get.cc: Add tests for
new overloads.
* testsuite/20_util/pair/astuple/get_by_type.cc: Likewise.
* testsuite/20_util/tuple/element_access/get2.cc: Likewise.
* testsuite/20_util/tuple/element_access/get2_by_type.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/get.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc:
Adjust.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Likewise.

From-SVN: r254222
2017-10-30 16:31:04 +02:00
Jonathan Wakely
6c6705a904 Simplify _Node_insert_return to avoid including <tuple>
* include/bits/node_handle.h (_Node_insert_return::get): Avoid
	use of std::tie and std::get.

From-SVN: r254162
2017-10-27 18:49:36 +01:00
Jonathan Wakely
5880ce184a List headers in Makefile in alphabetical order
* include/Makefile.am: Put headers in alphabetical order.
	* include/Makefile.in: Regenerate.

From-SVN: r254161
2017-10-27 18:49:32 +01:00
Jonathan Wakely
29453a9ffd Remove noexcept from filesystem iterators and operations (LWG 3013, 3014)
* include/bits/fs_dir.h (directory_iterator): Remove noexcept from
	constructors and increment member (LWG 3013).
	(recursive_directory_iterator): Likewise.
	* include/bits/fs_ops.h (copy, copy_file, create_directories)
	(is_empty, remove_all): Remove noexcept (LWG 3013 and LWG 3014).
	* src/filesystem/std-dir.cc (directory_iterator::increment)
	(recursive_directory_iterator::increment): Remove noexcept.
	* src/filesystem/std-ops.cc (copy, copy_file, create_directories)
	(is_empty, remove_all): Remove noexcept

From-SVN: r254160
2017-10-27 18:49:29 +01:00
Jonathan Wakely
9a3effa411 Make filesystem::file_status default constructor non-explicit (LWG 2787)
* include/bits/fs_dir.h (file_status): Make default constructor
	non-explicit (LWG 2787).
	* testsuite/27_io/filesystem/file_status/1.cc: New test.
	* testsuite/experimental/filesystem/file_status/1.cc: New test.

From-SVN: r254159
2017-10-27 18:49:21 +01:00
Jonathan Wakely
d49f254a6c Provide filesystem::path overloads for file streams (LWG 2676, partial)
* include/std/fstream (basic_filebuf::_If_path): New SFINAE helper.
	(basic_filebuf::open<Path>(const Path&, const ios_base::openmode&))
	(basic_ifstream<Path>(const Path&, const ios_base::openmode&))
	(basic_ifstream::open<Path>(const Path&, const ios_base::openmode&))
	(basic_ofstream<Path>(const Path&, const ios_base::openmode&))
	(basic_ofstream::open<Path>(const Path&, const ios_base::openmode&))
	(basic_fstream<Path>(const Path&, const ios_base::openmode&))
	(basic_fstream::open<Path>(const Path&, const ios_base::openmode&)):
	New constructors and member functions.
	* testsuite/27_io/basic_filebuf/open/char/path.cc: New test.
	* testsuite/27_io/basic_fstream/cons/char/path.cc: New test.
	* testsuite/27_io/basic_fstream/open/char/path.cc: New test.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc: New test.
	* testsuite/27_io/basic_ifstream/open/char/path.cc: New test.
	* testsuite/27_io/basic_ofstream/cons/char/path.cc: New test.
	* testsuite/27_io/basic_ofstream/open/char/path.cc: New test.

From-SVN: r254148
2017-10-27 13:39:01 +01:00
Jonathan Wakely
0348dd008a Define std::filesystem::path::format enum (P0430R2)
* include/bits/fs_path.h (path::format): Define new enumeration type.
	(path(string_type&&), path<Source>(const Source&))
	(path<InputIterator>(InputIterator, InputIterator))
	(path<Source>(const Source&, const locale&))
	(path<InputIterator>(InputIterator, InputIterator, const locale&)):
	Add format parameter.
	* testsuite/27_io/filesystem/path/construct/format.cc: New test.

From-SVN: r254144
2017-10-27 13:01:49 +01:00
Jonathan Wakely
d67be4437a Protect more algorithms from overloaded comma operators
* include/bits/stl_algo.h (__find_if_not_n, generate_n): Cast to void
	to ensure overloaded comma not used.
	* include/bits/stl_algobase.h (__fill_n_a, equal): Likewise.
	* include/bits/stl_uninitialized.h (__uninitialized_fill_n)
	(__uninitialized_fill_n_a, __uninitialized_default_n_1)
	(__uninitialized_default_n_a, __uninitialized_copy_n)
	(__uninitialized_copy_n_pair): Likewise
	* testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc:
	Use test iterator wrappers with overloaded comma operator.
	* testsuite/25_algorithms/fill_n/1.cc: Likewise.
	* testsuite/25_algorithms/generate_n/1.cc: New test.
	* testsuite/25_algorithms/stable_partition/1.cc: New test.
	* testsuite/util/testsuite_iterators.h (operator,): Add deleted
	non-member comma operator with iterator wrappers as right operand.

From-SVN: r254128
2017-10-27 00:50:40 +01:00
Ville Voutilainen
957f5feacf Deduction guides for associative containers, debug mode deduction guide fixes.
* include/bits/stl_iterator.h (__iter_key_t)
(__iter_val_t, __iter_to_alloc_t): New.
* include/bits/stl_map.h: Add deduction guides.
* 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/debug/deque: Likewise.
* include/debug/forward_list: Likewise.
* include/debug/list: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/set.h: Likewise.
* include/debug/unordered_map: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/vector: Likewise.
* testsuite/23_containers/map/cons/deduction.cc: New.
* testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
* testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
* testsuite/23_containers/set/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_multimap/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.

From-SVN: r254113
2017-10-26 19:42:31 +03:00
Jonathan Wakely
5fdbeb16d7 Update C++17 library status documentation
* doc/xml/manual/status_cxx2017.xml: Update C++17 status, and
	information on feature-test macros.
	* doc/html/*: Regenerate.

From-SVN: r254078
2017-10-25 15:06:12 +01:00
Jonathan Wakely
30e0aed183 PR libstdc++/82716 avoid stupid -Wmismatched-tags warnings
PR libstdc++/82716
	* include/std/array (tuple_size, tuple_element): Change class-key
	from class to struct, to avoid annoying Clang warnings.

From-SVN: r254077
2017-10-25 14:55:56 +01:00
Jonathan Wakely
220645d019 PR libstdc++/79283 fix filesystem::read_symlink for /proc
PR libstdc++/79283
	* src/filesystem/ops.cc (read_symlink): Handle st_size being zero.
	* src/filesystem/std-ops.cc (read_symlink): Likewise.
	(do_copy_file) [!NEED_DO_COPY_FILE]: Avoid multiple definitions.

From-SVN: r254076
2017-10-25 13:42:58 +01:00
Jonathan Wakely
eeb517d3e7 Fix filesystem::path::lexically_normal algorithm
* src/filesystem/std-path.cc (path::lexically_normal): Add missing
	step to algorithm, for removing dot-dot elements after root-directory.
	* testsuite/27_io/filesystem/operations/canonical.cc: Use
	compare_paths for more exhaustive checks.
	* testsuite/27_io/filesystem/operations/proximate.cc: Likewise.
	* testsuite/27_io/filesystem/path/append/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/concat/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/concat/strings.cc: Fix comment.
	* testsuite/27_io/filesystem/path/construct/locale.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Use
	compare_paths for more exhaustive checks. Add extra testcases.
	* testsuite/27_io/filesystem/path/generation/proximate.cc: Use
	compare_paths for more exhaustive checks.
	* testsuite/27_io/filesystem/path/generation/relative.cc: Likewise.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: Remove
	unused header.
	* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: Fix
	comment.
	* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc: Use
	compare_paths for more exhaustive checks.
	* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc:
	Likewise.
	* testsuite/util/testsuite_fs.h (compare_paths): Also compare native
	strings.

From-SVN: r254075
2017-10-25 13:42:53 +01:00
Jonathan Wakely
e921c7e5a6 PR libstdc++/82706 fix test for case where operations succeed
PR libstdc++/82706
	* testsuite/27_io/filesystem/operations/permissions.cc: Fix test.

From-SVN: r254067
2017-10-25 01:27:10 +01:00
François Dumont
8468bfe8cb libstdc++.exp (check_v3_target_normal_mode): Add c++config.h include.
2017-10-24  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/lib/libstdc++.exp (check_v3_target_normal_mode): Add
	c++config.h include.
	(check_v3_target_normal_namespace): New.
	* testsuite/lib/dg-options.exp (dg-require-normal-namespace): New.
	* testsuite/18_support/headers/limits/synopsis.cc: Add latter.
	* testsuite/20_util/from_chars/requirements.cc: Likewise.
	* testsuite/20_util/headers/functional/synopsis.cc: Likewise.
	* testsuite/20_util/headers/memory/synopsis.cc: Likewise.
	* testsuite/20_util/headers/utility/synopsis.cc: Likewise.
	* testsuite/20_util/to_chars/requirements.cc: Likewise.
	* testsuite/21_strings/headers/string/synopsis.cc: Likewise.
	* testsuite/22_locale/headers/locale/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/bitset/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/deque/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/forward_list/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/list/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/map/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/queue/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/set/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/stack/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/vector/synopsis.cc: Likewise.
	* testsuite/23_containers/map/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/set/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++11.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++14.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++17.cc: Likewise.
	* testsuite/26_numerics/complex/abi_tag.cc: Likewise.
	* testsuite/26_numerics/headers/complex/synopsis.cc: Likewise.
	* testsuite/26_numerics/headers/valarray/synopsis.cc: Likewise.
	* testsuite/27_io/headers/fstream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/ios/synopsis.cc: Likewise.
	* testsuite/27_io/headers/istream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/ostream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/sstream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/streambuf/synopsis.cc: Likewise.

From-SVN: r254060
2017-10-24 20:20:12 +00:00
Jonathan Wakely
d56a36834f Avoid -Wattribute-alias warnings for long double compat symbols
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Ignore
	-Wattribute-alias warnings.
	* src/c++11/istream-inst.cc: Likewise.
	* src/c++11/locale-inst.cc: Likewise.
	* src/c++11/ostream-inst.cc: Likewise.
	* src/c++11/wlocale-inst.cc: Likewise.
	* src/c++98/hash-long-double-tr1-aux.cc: Likewise.

From-SVN: r254045
2017-10-24 14:18:59 +01:00
Jonathan Wakely
02e2a7d8ef Refactor std::basic_string_view members and add noexcept
* include/bits/string_view.tcc (find_first_of, find_last_of)
	(find_first_not_of, find_last_not_of): Add noexcept.
	* include/std/string_view (basic_string_view(const _CharT*))
	(basic_string_view(const _CharT*, size_type))
	(front, back, remove_prefix, remove_suffix, find, rfind)
	(find_first_of, find_first_not_of): Add noexcept.
	(at(size_type), _S_compare(size_type, size_type)): Replace conditional
	expressions with if statements.
	(copy(_CharT*, size_type, size_type), substr(size_type, size_type)):
	Use _M_check for length checks.
	(compare(basic_string_view)): Reformat.
	(_M_check(size_type, const char)): Add noexcept(false).
	(_M_limit(size_type, size_type)): Use noexcept not _GLIBCXX_NOEXCEPT.

From-SVN: r254044
2017-10-24 14:18:52 +01:00
Jonathan Wakely
6a19d2a2ee PR libstdc++/82685 add 'noexcept' to string_view literals
PR libstdc++/82685
	* include/experimental/string_view (operator""sv): Add noexcept.
	* include/std/string_view (operator""sv): Likewise.

From-SVN: r254041
2017-10-24 12:28:40 +01:00
Jonathan Wakely
641cb5a675 Implement C++17 Filesystem library
Based on Filesystem TS implementation, with the changes applied by:

- P0219R1 Relative Paths for Filesystem
- P0317R1 Directory Entry Caching for Filesystem
- P0492R2 Resolution of C++17 National Body Comments

Where appropriate code is shared between the TS and C++17
implementations.

	* include/Makefile.am: Add new headers for C++17 filesystem library.
	* include/Makefile.in: Regenerate.
	* include/bits/fs_dir.h: New header, based on Filesystem TS code in
	include/experimental/bits directory.
	* include/bits/fs_fwd.h: Likewise.
	* include/bits/fs_ops.h: Likewise.
	* include/bits/fs_path.h: Likewise.
	* include/experimental/bits/fs_dir.h: Rename Doxygen group.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/filesystem (filesystem_error::_M_gen_what):
	Remove inline definition.
	* include/precompiled/stdc++.h: Add <filesystem> to precompiled
	header.
	* include/std/filesystem: New header.
	* python/libstdcxx/v6/printers.py: Enable printer for std::filesystem
	paths.
	* src/filesystem/Makefile.am: Add new files. Compile as C++17.
	* src/filesystem/Makefile.in: Regenerate.
	* src/filesystem/cow-dir.cc: Update comment.
	* src/filesystem/cow-ops.cc: Likewise.
	* src/filesystem/cow-path.cc: Likewise.
	* src/filesystem/cow-std-dir.cc: New file.
	* src/filesystem/cow-std-ops.cc: New file.
	* src/filesystem/cow-std-path.cc: New file.
	* src/filesystem/dir-common.h (_Dir_base, get_file_type): New header
	for common code.
	* src/filesystem/dir.cc (_Dir): Derive from _Dir_base.
	(open_dir): Move to _Dir_base constructor.
	(get_file_type): Move to dir-common.h.
	(recurse): Move to _Dir_base::should_recurse.
	* src/filesystem/ops-common.h: New header for common code.
	* src/filesystem/ops.cc (is_set, make_file_type, make_file_status)
	(is_not_found_errno, file_time, do_copy_file): Move to ops-common.h.
	* src/filesystem/path.cc (filesystem_error::_M_gen_what): Define.
	* src/filesystem/std-dir.cc: New file, based on Filesystem TS code.
	* src/filesystem/std-ops.cc: Likewise.
	* src/filesystem/std-dir.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc: New
	test.
	* testsuite/27_io/filesystem/iterators/pop.cc: New test.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	New test.
	* testsuite/27_io/filesystem/operations/absolute.cc: New test.
	* testsuite/27_io/filesystem/operations/canonical.cc: New test.
	* testsuite/27_io/filesystem/operations/copy.cc: New test.
	* testsuite/27_io/filesystem/operations/copy_file.cc: New test.
	* testsuite/27_io/filesystem/operations/create_directories.cc: New
	test.
	* testsuite/27_io/filesystem/operations/create_directory.cc: New test.
	* testsuite/27_io/filesystem/operations/create_symlink.cc: New test.
	* testsuite/27_io/filesystem/operations/current_path.cc: New test.
	* testsuite/27_io/filesystem/operations/equivalent.cc: New test.
	* testsuite/27_io/filesystem/operations/exists.cc: New test.
	* testsuite/27_io/filesystem/operations/file_size.cc: New test.
	* testsuite/27_io/filesystem/operations/is_empty.cc: New test.
	* testsuite/27_io/filesystem/operations/last_write_time.cc: New test.
	* testsuite/27_io/filesystem/operations/permissions.cc: New test.
	* testsuite/27_io/filesystem/operations/proximate.cc: New test.
	* testsuite/27_io/filesystem/operations/read_symlink.cc: New test.
	* testsuite/27_io/filesystem/operations/relative.cc: New test.
	* testsuite/27_io/filesystem/operations/remove_all.cc: New test.
	* testsuite/27_io/filesystem/operations/space.cc: New test.
	* testsuite/27_io/filesystem/operations/status.cc: New test.
	* testsuite/27_io/filesystem/operations/symlink_status.cc: New test.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc: New
	test.
	* testsuite/27_io/filesystem/operations/weakly_canonical.cc: New test.
	* testsuite/27_io/filesystem/path/append/path.cc: New test.
	* testsuite/27_io/filesystem/path/assign/assign.cc: New test.
	* testsuite/27_io/filesystem/path/assign/copy.cc: New test.
	* testsuite/27_io/filesystem/path/compare/compare.cc: New test.
	* testsuite/27_io/filesystem/path/compare/path.cc: New test.
	* testsuite/27_io/filesystem/path/compare/strings.cc: New test.
	* testsuite/27_io/filesystem/path/concat/path.cc: New test.
	* testsuite/27_io/filesystem/path/concat/strings.cc: New test.
	* testsuite/27_io/filesystem/path/construct/copy.cc: New test.
	* testsuite/27_io/filesystem/path/construct/default.cc: New test.
	* testsuite/27_io/filesystem/path/construct/locale.cc: New test.
	* testsuite/27_io/filesystem/path/construct/range.cc: New test.
	* testsuite/27_io/filesystem/path/construct/string_view.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/extension.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/filename.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/parent_path.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/relative_path.cc: New
	test.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc: New
	test.
	* testsuite/27_io/filesystem/path/decompose/root_name.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/root_path.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/stem.cc: New test.
	* testsuite/27_io/filesystem/path/generation/normal.cc: New test.
	* testsuite/27_io/filesystem/path/generation/proximate.cc: New test.
	* testsuite/27_io/filesystem/path/generation/relative.cc: New test.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: New test.
	* testsuite/27_io/filesystem/path/itr/traversal.cc: New test.
	* testsuite/27_io/filesystem/path/modifiers/clear.cc: New test.
	* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/swap.cc: New test.
	* testsuite/27_io/filesystem/path/native/string.cc: New test.
	* testsuite/27_io/filesystem/path/nonmember/hash_value.cc: New test.
	* testsuite/27_io/filesystem/path/query/empty.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_extension.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_filename.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_parent_path.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_relative_path.cc: New
	test.
	* testsuite/27_io/filesystem/path/query/has_root_directory.cc: New
	test.
	* testsuite/27_io/filesystem/path/query/has_root_name.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_root_path.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_stem.cc: New test.
	* testsuite/27_io/filesystem/path/query/is_relative.cc: New test.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Define USE_FILESYSTEM_TS.
	* testsuite/util/testsuite_fs.h: Allow use with C++17 paths as well
	as Filesystem TS.

From-SVN: r254008
2017-10-23 13:11:22 +01:00
Jonathan Wakely
908d1d3aea PR libstdc++/82644 document IS 29124 support
Also fix declarations of special functions in C++17, to import them into
the global namespace in <math.h>, and to prevent defining the
non-standard hypergeometric functions in strict mode.

	PR libstdc++/82644
	* doc/xml/manual/intro.xml: Include new section.
	* doc/xml/manual/status_cxxis29124.xml: New section on IS 29124
	status.
	* include/bits/specfun.h [__STRICT_ANSI__] (hyperg, hypergf, hypergl)
	(conf_hyperg, conf_hypergf, conf_hypergl): Don't declare.
	* include/c_compatibility/math.h: Import special functions into
	global namespace for C++17.
	* testsuite/26_numerics/headers/cmath/82644.cc: New test.
	* testsuite/26_numerics/headers/cmath/functions_global_c++17.cc: New
	test.

From-SVN: r254004
2017-10-23 12:10:28 +01:00
Jonathan Wakely
dfdf2839b5 Fix invalid path::iterator test
* testsuite/experimental/filesystem/path/itr/traversal.cc: Do not
	increment past-the-end iterators.

From-SVN: r253967
2017-10-21 02:16:43 +01:00
Jonathan Wakely
233fa165ad Update value of __cpp_lib_chrono feature-test macro
* include/std/chrono (__cpp_lib_chrono): Update macro value to
	indicate support for P0505R0.
	* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Check
	for updated macro.

From-SVN: r253959
2017-10-20 22:05:11 +01:00
Jonathan Wakely
253e8d2150 Define __cpp_lib_byte feature-test macro
* include/c_global/cstddef: Define __cpp_lib_byte feature-test macro.
	* testsuite/18_support/byte/requirements.cc: Check macro.

From-SVN: r253952
2017-10-20 19:02:19 +01:00
Jonathan Wakely
db62ad7c66 Improve tests for error reporting in Filesystem TS
* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Ensure that error_code arguments are
	cleared when required.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Remove redundant check.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Ensure that error_code argument is cleared when required.

From-SVN: r253897
2017-10-19 14:57:10 +01:00
Jonathan Wakely
551124d561 Fix path::iterator post-increment and post-decrement
* include/experimental/bits/fs_path.h (path::iterator++(int))
	(path::iterator--(int)): Fix for paths with only one component.
	* testsuite/experimental/filesystem/path/itr/traversal.cc: Test
	post-increment and post-decrement.

From-SVN: r253896
2017-10-19 14:57:06 +01:00
Jonathan Wakely
89b1e16136 Update references to C++17 in libstdc++ manual
* doc/xml/manual/status_cxx2017.xml: Update references to C++17
	section numbers.

From-SVN: r253895
2017-10-19 14:57:02 +01:00
Jonathan Wakely
af23b26ab0 Use __LONG_LONG_MAX__ instead of LONG_LONG_MAX in test
* testsuite/decimal/conversion-to-integral.cc: Use predefined macro
	instead of non-standard glibc one.

From-SVN: r253894
2017-10-19 14:56:55 +01:00
François Dumont
1be043a140 re PR libstdc++/82558 (V8 JavaScript engine segfaults since r249235)
2017-10-16  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/82558
	* include/bits/stl_bvector.h (fill): Add iterator offset check.
	* testsuite/23_containers/vector/bool/82558.cc: New.

From-SVN: r253776
2017-10-16 05:44:03 +00:00
Jonathan Wakely
3b0dd4fea2 PR libstdc++/82522 overload map insert functions for rvalues (LWG 2354)
PR libstdc++/82522
	* doc/xml/manual/intro.xml: Document LWG 2354 changes.
	* include/bits/stl_map.h (map::insert(value_type&&))
	(map::insert(const_iterator, value_type&&)): Add overload for rvalues.
	* include/bits/stl_multimap.h (multimap::insert(value_type&&))
	(multimap::insert(const_iterator, value_type&&)): Likewise.
	* include/bits/unordered_map.h (unordered_map::insert(value_type&&))
	(unordered_map::insert(const_iterator, value_type&&))
	(unordered_multimap::insert(value_type&&))
	(unordered_multimap::insert(const_iterator, value_type&&)): Likewise.
	* testsuite/23_containers/map/modifiers/insert/dr2354.cc: New test.
	* testsuite/23_containers/multimap/modifiers/insert/dr2354.cc: New
	test.
	* testsuite/23_containers/unordered_map/insert/dr2354.cc: New test.
	* testsuite/23_containers/unordered_multimap/insert/dr2354.cc: New
	test.

From-SVN: r253725
2017-10-13 13:39:32 +01:00
Jonathan Wakely
d1e85aa999 PR libstdc++/82481 Suppress clang-tidy warnings
PR libstdc++/82481
	* include/std/mutex (call_once): Suppress clang-tidy warnings about
	dangling references.

From-SVN: r253724
2017-10-13 13:39:24 +01:00
Jonathan Wakely
0e7300bb80 Update comment referring to status of LWG issue 111
* include/bits/streambuf_iterator.h (istreambuf_iterator::equal):
	Update comment about NAD issue.

From-SVN: r253582
2017-10-10 12:26:10 +01:00
Jonathan Wakely
5d2b807526 PR libstdc++/82417 do not include C99 <complex.h> in strict modes
As an extension the C++ version of <complex.h> includes the C version,
but that defines macros with non-reserved names that should not be
defined in ISO C++. Only include the C header for non-strict modes, or
for pre-C++11 (because C++98 doesn't mention <complex.h> at all).

	PR libstdc++/59087
	PR libstdc++/82417
	* include/c_compatibility/complex.h [!C++98 && __STRICT_ANSI__]: Do
	not include C library's <complex.h>.
	* testsuite/26_numerics/complex/c99.cc: Depend on __STRICT_ANSI__.
	* testsuite/26_numerics/headers/complex.h/std_c++11.h: New test.
	* testsuite/26_numerics/headers/complex.h/std_gnu++11.h: New test.
	* testsuite/26_numerics/headers/complex.h/std_c++98.h: New test.

From-SVN: r253581
2017-10-10 12:25:45 +01:00
Jonathan Wakely
e58683fb9f Fix new testsuite failure on newlib targets
* testsuite/20_util/to_chars/1.cc: Add dg-require-string-conversions.

From-SVN: r253463
2017-10-05 21:26:08 +01:00