* [committed] libstdc++: Fix -Wrange-loop-construct warnings in filesystem tests
@ 2020-11-27 13:35 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-11-27 13:35 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
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.
Tested powerpc64le-linux and x86_64-w64-mingw32, pushed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 36336 bytes --]
commit 4a7c7999086756b9d630ed6036eb7fdce69bb5cd
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Nov 27 12:15:44 2020
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.
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc
index 96ccd777af41..712d131dfaa8 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 dc7331945fe9..4468a24efe73 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 0f912a5f74d7..c0fd2aa3d9dc 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 6f4166b641db..fd310fb827b4 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 54b3510b9dee..a61c7c4f6095 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 032af98d9dd1..94989706d1bb 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 52dc3899cc7e..2ab60144f73f 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 cf3724025f75..f198a4c8197d 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 3d14829e0d76..d514951649ea 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 b89dd47bef94..6e24cc874c25 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 10ed3144fa26..aa0516f8aa3c 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 43cb43b373da..b65f99758d36 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 f47227a47e02..7848abd3f20b 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 a7b61f0b9f24..6cb23008a438 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 48572ac8917b..c8e39e255320 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 03da11f03604..b05f5f2d42c3 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 d9adfad0a3e6..ff3741c33824 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 34e8bf841c23..786634decb36 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 d665bcb74a24..0164fa1bd0cb 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 707e7acb6053..201406fc5af5 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 b1848d7761d6..f6287cbcf4de 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 7f34be268ca1..3013dbf303a1 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 ef606b3a7642..3d44874a83f8 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 5a35dedf1658..741b409b1eed 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 0459873f76cb..079f9c9314fc 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 99c6951ebb6c..19f1c8f0d291 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 c5318990f154..7893baf23bc6 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 ba6fe3cbb0c6..0ee4d9449743 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() );
}
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/absolute.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/absolute.cc
index 5c9627f63b64..8b9fb7366570 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/absolute.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/absolute.cc
@@ -30,7 +30,7 @@ using std::experimental::filesystem::path;
void
test01()
{
- for (const path& p : __gnu_test::test_paths)
+ for (const path p : __gnu_test::test_paths)
{
#if defined(__MINGW32__) || defined(__MINGW64__)
if (p.empty())
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/assign/copy.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/assign/copy.cc
index 2f7936003242..09e2fd6e5e60 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/assign/copy.cc
+++ b/libstdc++-v3/testsuite/experimental/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/experimental/filesystem/path/compare/path.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/compare/path.cc
index 5228d0a8ca84..66606f7dca07 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/compare/path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/compare/path.cc
@@ -31,7 +31,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/experimental/filesystem/path/construct/copy.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/copy.cc
index f075ba65e8a3..50a00c55d5a9 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/copy.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/copy.cc
@@ -29,7 +29,7 @@ using std::experimental::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);
@@ -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 = std::move(copy);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/extension.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/extension.cc
index 2d0b08829604..0c5b5f4fe78c 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/extension.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/extension.cc
@@ -44,7 +44,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/experimental/filesystem/path/decompose/filename.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/filename.cc
index 066d7dcaba71..a6a7b8d2c79d 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/filename.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/filename.cc
@@ -39,7 +39,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/experimental/filesystem/path/decompose/parent_path.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/parent_path.cc
index 3f12fad0bcd6..bd3961a70caf 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/parent_path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/parent_path.cc
@@ -43,7 +43,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/experimental/filesystem/path/decompose/relative_path.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/relative_path.cc
index 43b5091bb65f..14221de33899 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/relative_path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/relative_path.cc
@@ -41,7 +41,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/experimental/filesystem/path/decompose/root_directory.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_directory.cc
index bbb500916e21..ffc483957473 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_directory.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_directory.cc
@@ -43,7 +43,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();
// If root-directory is composed of 'slash name',
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_path.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_path.cc
index dfd2cb0da247..7ffd526f02ac 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_path.cc
@@ -39,7 +39,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/experimental/filesystem/path/itr/traversal.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/itr/traversal.cc
index 83ee78b10aea..c1481777ed68 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/itr/traversal.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/itr/traversal.cc
@@ -69,7 +69,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/experimental/filesystem/path/modifiers/remove_filename.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/remove_filename.cc
index 0537bf45461b..5186c3d3105a 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/remove_filename.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/remove_filename.cc
@@ -37,7 +37,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/experimental/filesystem/path/modifiers/replace_extension.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_extension.cc
index 5053c72724f3..b09845447312 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_extension.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_extension.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;
VERIFY(p2.replace_extension(p2.extension()) == p);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_filename.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_filename.cc
index 1d063b6e23f4..858ecd983035 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_filename.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/modifiers/replace_filename.cc
@@ -37,7 +37,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/experimental/filesystem/path/nonmember/hash_value.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/nonmember/hash_value.cc
index 68534912ff00..931727fce9ad 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/nonmember/hash_value.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/nonmember/hash_value.cc
@@ -37,7 +37,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/experimental/filesystem/path/query/has_extension.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_extension.cc
index 3041e106f4d1..031bc828120e 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_extension.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_extension.cc
@@ -30,7 +30,7 @@ using std::experimental::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/experimental/filesystem/path/query/has_filename.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_filename.cc
index 5fa4c6e4e58a..5ad1e3d910f8 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_filename.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_filename.cc
@@ -30,7 +30,7 @@ using std::experimental::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/experimental/filesystem/path/query/has_parent_path.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_parent_path.cc
index 5a16cf21b029..99d0b775f710 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_parent_path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_parent_path.cc
@@ -30,7 +30,7 @@ using std::experimental::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/experimental/filesystem/path/query/has_relative_path.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_relative_path.cc
index 8674bda74b2c..fa58a8150929 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_relative_path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_relative_path.cc
@@ -30,7 +30,7 @@ using std::experimental::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/experimental/filesystem/path/query/has_root_directory.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_directory.cc
index 262d7a4a2af1..930c9cb31dce 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_directory.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_directory.cc
@@ -30,7 +30,7 @@ using std::experimental::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/experimental/filesystem/path/query/has_root_name.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_name.cc
index 05cc30679f04..951a746fc3be 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_name.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_name.cc
@@ -30,7 +30,7 @@ using std::experimental::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/experimental/filesystem/path/query/has_root_path.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_path.cc
index bd771932f8a6..501fc8285822 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_root_path.cc
@@ -30,7 +30,7 @@ using std::experimental::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/experimental/filesystem/path/query/has_stem.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_stem.cc
index acb70d955f1d..103aff0e28f9 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_stem.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/query/has_stem.cc
@@ -30,7 +30,7 @@ using std::experimental::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/experimental/filesystem/path/query/is_relative.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/query/is_relative.cc
index 6071400cb64b..86a60c6b8c8c 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/query/is_relative.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/query/is_relative.cc
@@ -30,7 +30,7 @@ using std::experimental::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() );
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-27 13:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 13:35 [committed] libstdc++: Fix -Wrange-loop-construct warnings in filesystem tests Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).