diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-11-27 12:15:44 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-11-27 13:34:22 +0000 |
commit | 4a7c7999086756b9d630ed6036eb7fdce69bb5cd (patch) | |
tree | f6e0d65f77b1f5d5f81ebcf9964660968ba7bee3 /libstdc++-v3/testsuite/27_io/filesystem | |
parent | b8ae0812ee567fa380f0a8c7f30c7a660a5069c3 (diff) |
libstdc++: Fix -Wrange-loop-construct warnings in filesystem tests
Many tests do `for (const path& p : test_paths)` where test_paths is an
array of strings. To avoid -Wrange-loop-construct warnings the loop
variable should be an object, not a reference bound to a temporary.
libstdc++-v3/ChangeLog:
* testsuite/27_io/filesystem/operations/absolute.cc: Avoid
-Wrange-loop-construct warning.
* testsuite/27_io/filesystem/path/append/source.cc: Likewise.
* testsuite/27_io/filesystem/path/assign/copy.cc: Likewise.
* testsuite/27_io/filesystem/path/compare/path.cc: Likewise.
* testsuite/27_io/filesystem/path/construct/copy.cc: Likewise.
* testsuite/27_io/filesystem/path/decompose/extension.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/filename.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/parent_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/relative_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/root_directory.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/root_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/itr/traversal.cc: Likewise.
* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc:
Likewise.
* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc:
Likewise.
* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc:
Likewise.
* testsuite/27_io/filesystem/path/nonmember/append.cc: Likewise.
* testsuite/27_io/filesystem/path/nonmember/cmp.cc: Likewise.
* testsuite/27_io/filesystem/path/nonmember/cmp_c++20.cc:
Likewise.
* testsuite/27_io/filesystem/path/nonmember/hash_value.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/operations/absolute.cc:
Likewise.
* testsuite/experimental/filesystem/path/assign/copy.cc: Likewise.
* testsuite/experimental/filesystem/path/compare/path.cc:
Likewise.
* testsuite/experimental/filesystem/path/construct/copy.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_path.cc:
Likewise.
* testsuite/experimental/filesystem/path/itr/traversal.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/nonmember/hash_value.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.
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/filesystem')
28 files changed, 32 insertions, 32 deletions
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc index 96ccd777af4..712d131dfaa 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc @@ -30,7 +30,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { std::error_code ec; path abs = absolute(p, ec); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc index dc7331945fe..4468a24efe7 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc @@ -92,8 +92,8 @@ test02() void test03() { - for (const path& p : __gnu_test::test_paths) - for (const path& q : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) + for (const path q : __gnu_test::test_paths) { test(p, q.c_str()); if constexpr (!std::is_same_v<path::value_type, char>) diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc index 0f912a5f74d..c0fd2aa3d9d 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc @@ -28,7 +28,7 @@ using __gnu_test::compare_paths; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path copy; copy = p; @@ -39,7 +39,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path copy = p; path move; diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/compare/path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/compare/path.cc index 6f4166b641d..fd310fb827b 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/compare/path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/compare/path.cc @@ -30,7 +30,7 @@ void test01() { const path p0 = "/a/a/b/b"; - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.compare(p) == 0 ); int cmp = p.compare(p0); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/copy.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/copy.cc index 54b3510b9de..a61c7c4f609 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/copy.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/copy.cc @@ -28,7 +28,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path copy = p; __gnu_test::compare_paths(p, copy); @@ -38,7 +38,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path copy = p; path move = std::move(copy); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/extension.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/extension.cc index 032af98d9dd..94989706d1b 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/extension.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/extension.cc @@ -51,7 +51,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { auto stem = p.stem(); auto ext = p.extension(); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/filename.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/filename.cc index 52dc3899cc7..2ab60144f73 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/filename.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/filename.cc @@ -46,7 +46,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path f = p.filename(); if (p.empty()) diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/parent_path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/parent_path.cc index cf3724025f7..f198a4c8197 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/parent_path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/parent_path.cc @@ -46,7 +46,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { if (p.begin() == p.end()) continue; diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/relative_path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/relative_path.cc index 3d14829e0d7..d514951649e 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/relative_path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/relative_path.cc @@ -42,7 +42,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { bool after_root = false; const path prel = p.relative_path(); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_directory.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_directory.cc index b89dd47bef9..6e24cc874c2 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_directory.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_directory.cc @@ -46,7 +46,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path rootdir = p.root_directory(); VERIFY( !rootdir.has_relative_path() ); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc index 10ed3144fa2..aa0516f8aa3 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc @@ -38,7 +38,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path rootp = p.root_path(); path rootn = p.root_name(); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/itr/traversal.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/itr/traversal.cc index 43cb43b373d..b65f99758d3 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/itr/traversal.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/itr/traversal.cc @@ -108,7 +108,7 @@ test02() using reverse_iterator = std::reverse_iterator<path::iterator>; std::vector<path> fwd, rev; - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { const auto begin = p.begin(), end = p.end(); fwd.assign(begin, end); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/remove_filename.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/remove_filename.cc index f47227a47e0..7848abd3f20 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/remove_filename.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/remove_filename.cc @@ -40,7 +40,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path p2(p); p2.remove_filename(); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/replace_extension.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/replace_extension.cc index a7b61f0b9f2..6cb23008a43 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/replace_extension.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/replace_extension.cc @@ -47,7 +47,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path p2 = p; compare_paths( p2.replace_extension(p2.extension()), p ); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/replace_filename.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/replace_filename.cc index 48572ac8917..c8e39e25532 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/replace_filename.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/modifiers/replace_filename.cc @@ -38,7 +38,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path p2(p); p2.replace_filename(p.filename()); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/append.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/append.cc index 03da11f0360..b05f5f2d42c 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/append.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/append.cc @@ -69,8 +69,8 @@ test02() void test03() { - for (const path& p : __gnu_test::test_paths) - for (const path& q : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) + for (const path q : __gnu_test::test_paths) test(p, q); } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/cmp.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/cmp.cc index d9adfad0a3e..ff3741c3382 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/cmp.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/cmp.cc @@ -47,7 +47,7 @@ void test02() { const path p0 = "/a/a/b/b"; - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.compare(p) == 0 ); int cmp = p.compare(p0); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/cmp_c++20.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/cmp_c++20.cc index 34e8bf841c2..786634decb3 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/cmp_c++20.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/cmp_c++20.cc @@ -53,7 +53,7 @@ void test02() { const path p0 = "/a/a/b/b"; - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( std::is_eq(p <=> p) ); VERIFY( (p <=> p0) == (p.compare(p0) <=> 0) ); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/hash_value.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/hash_value.cc index d665bcb74a2..0164fa1bd0c 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/hash_value.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/nonmember/hash_value.cc @@ -36,7 +36,7 @@ test01() void test02() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { path pp = p.native(); VERIFY( hash_value(p) == hash_value(pp) ); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_extension.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_extension.cc index 707e7acb605..201406fc5af 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_extension.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_extension.cc @@ -29,7 +29,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.has_extension() == !p.extension().empty() ); } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_filename.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_filename.cc index b1848d7761d..f6287cbcf4d 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_filename.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_filename.cc @@ -29,7 +29,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.has_filename() == !p.filename().empty() ); } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_parent_path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_parent_path.cc index 7f34be268ca..3013dbf303a 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_parent_path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_parent_path.cc @@ -29,7 +29,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.has_parent_path() == !p.parent_path().empty() ); } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_relative_path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_relative_path.cc index ef606b3a764..3d44874a83f 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_relative_path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_relative_path.cc @@ -29,7 +29,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.has_relative_path() == !p.relative_path().empty() ); } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_directory.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_directory.cc index 5a35dedf165..741b409b1ee 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_directory.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_directory.cc @@ -29,7 +29,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.has_root_directory() == !p.root_directory().empty() ); } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_name.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_name.cc index 0459873f76c..079f9c9314f 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_name.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_name.cc @@ -29,7 +29,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.has_root_name() == !p.root_name().empty() ); } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_path.cc index 99c6951ebb6..19f1c8f0d29 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_root_path.cc @@ -29,7 +29,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.has_root_path() == !p.root_path().empty() ); } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_stem.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_stem.cc index c5318990f15..7893baf23bc 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_stem.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/query/has_stem.cc @@ -29,7 +29,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.has_stem() == !p.stem().empty() ); } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/query/is_relative.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/query/is_relative.cc index ba6fe3cbb0c..0ee4d944974 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/query/is_relative.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/query/is_relative.cc @@ -29,7 +29,7 @@ using std::filesystem::path; void test01() { - for (const path& p : __gnu_test::test_paths) + for (const path p : __gnu_test::test_paths) { VERIFY( p.is_relative() == !p.is_absolute() ); } |