mirror of git://gcc.gnu.org/git/gcc.git
libstdc++/71037 Add base path to filesystem::canonical exceptions
Backport from mainline 2016-05-10 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/71037 * src/filesystem/ops.cc (canonical(const path&, const path&)): Add base path to exception. * testsuite/experimental/filesystem/operations/canonical.cc: Test paths contained in exception. From-SVN: r236714
This commit is contained in:
parent
47cc02ad78
commit
aecaeabf8d
|
|
@ -1,3 +1,14 @@
|
||||||
|
2016-05-25 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
Backport from mainline
|
||||||
|
2016-05-10 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/71037
|
||||||
|
* src/filesystem/ops.cc (canonical(const path&, const path&)): Add
|
||||||
|
base path to exception.
|
||||||
|
* testsuite/experimental/filesystem/operations/canonical.cc: Test
|
||||||
|
paths contained in exception.
|
||||||
|
|
||||||
2016-05-25 Jonathan Wakely <jwakely@redhat.com>
|
2016-05-25 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
Backport from mainline
|
Backport from mainline
|
||||||
|
|
|
||||||
|
|
@ -220,8 +220,9 @@ fs::canonical(const path& p, const path& base)
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
path can = canonical(p, base, ec);
|
path can = canonical(p, base, ec);
|
||||||
if (ec.value())
|
if (ec)
|
||||||
_GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot canonicalize", p, ec));
|
_GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot canonicalize", p, base,
|
||||||
|
ec));
|
||||||
return can;
|
return can;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,28 @@ test01()
|
||||||
VERIFY( !ec );
|
VERIFY( !ec );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test02()
|
||||||
|
{
|
||||||
|
#if __cpp_exceptions
|
||||||
|
bool test __attribute__((unused)) = false;
|
||||||
|
|
||||||
|
fs::path p = "rel", base = __gnu_test::nonexistent_path();
|
||||||
|
fs::path e1, e2;
|
||||||
|
try {
|
||||||
|
canonical(p, base);
|
||||||
|
} catch (const fs::filesystem_error& e) {
|
||||||
|
e1 = e.path1();
|
||||||
|
e2 = e.path2();
|
||||||
|
}
|
||||||
|
VERIFY( e1 == p );
|
||||||
|
VERIFY( e2 == base );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
test01();
|
test01();
|
||||||
|
test02();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue