]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/compile: Use std::filesystem::remove_all in cleanup
authorLancelot SIX <lancelot.six@amd.com>
Sun, 3 Mar 2024 16:47:56 +0000 (16:47 +0000)
committerLancelot SIX <lancelot.six@amd.com>
Wed, 3 Apr 2024 12:53:32 +0000 (13:53 +0100)
commit7bba0ad08576309763e3f41193eaa93025e10b8b
tree3a249f6b216f88896644ebbfa4515891a212cd28
parente73b04d26504214f52a3b87f51917d26aba8e82c
gdb/compile: Use std::filesystem::remove_all in cleanup

In a previous review, I noticed that some code in gdb/compile/compile.c
could use c++17's `std::filesystem::remove_all` instead of using some
`system ("rm -rf ...");`.

This patch implements this.

Note that I use the noexcept overload of std::filesystem::remove_all and
explicitly check for an error code.  This means that this code called
during the cleanup procedure cannot throw, and does not risk preventing
other cleanup functions to be called.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31420
Change-Id: If5668bf3e15e66c020e5c3b4fa999f861690e4cf
Approved-By: Tom Tromey <tom@tromey.com>
gdb/compile/compile.c