c++17: drop experimental::filesystem
Use std::filesystem, and drop support for building with experimental
under c++14.
Change-Id: I32755f0d1b119c041978c2f8b988a16a14ba88d4
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/Makefile.am b/Makefile.am
index cded7eb..895e28c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,7 +35,6 @@
openpower_proc_control_LDFLAGS = $(PHOSPHOR_LOGGING_LIBS) \
$(PHOSPHOR_DBUS_INTERFACES_LIBS) \
$(SDBUSPLUS_LIBS) \
- -lstdc++fs \
-lgpiodcxx \
-lpthread
diff --git a/procedures/openfsi/scan.cpp b/procedures/openfsi/scan.cpp
index 51f173f..e6bdd89 100644
--- a/procedures/openfsi/scan.cpp
+++ b/procedures/openfsi/scan.cpp
@@ -15,7 +15,7 @@
*/
#include "registration.hpp"
-#include <experimental/filesystem>
+#include <filesystem>
#include <fstream>
#include <org/open_power/Proc/FSI/error.hpp>
#include <phosphor-logging/elog-errors.hpp>
@@ -27,7 +27,6 @@
{
using namespace phosphor::logging;
-namespace fs = std::experimental::filesystem;
namespace fsi_error = sdbusplus::org::open_power::Proc::FSI::Error;
constexpr auto masterScanPath = "/sys/class/fsi-master/fsi0/rescan";
@@ -89,7 +88,7 @@
metadata::CALLOUT_DEVICE_PATH(masterCalloutPath));
}
- if (!fs::exists(hubScanPath))
+ if (!std::filesystem::exists(hubScanPath))
{
log<level::ERR>("The FSI master scan did not create a hub scan file");
diff --git a/targeting.cpp b/targeting.cpp
index a24031b..37bed58 100644
--- a/targeting.cpp
+++ b/targeting.cpp
@@ -18,7 +18,7 @@
#include <endian.h>
-#include <experimental/filesystem>
+#include <filesystem>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
@@ -31,7 +31,6 @@
{
using namespace phosphor::logging;
-namespace fs = std::experimental::filesystem;
namespace file_error = sdbusplus::xyz::openbmc_project::Common::File::Error;
int Target::getCFAMFD()
@@ -72,7 +71,7 @@
try
{
// Find the the remaining P9s dynamically based on which files show up
- for (auto& file : fs::directory_iterator(fsiSlaveBasePath))
+ for (auto& file : std::filesystem::directory_iterator(fsiSlaveBasePath))
{
std::smatch match;
std::string path = file.path();
@@ -92,7 +91,7 @@
}
}
}
- catch (fs::filesystem_error& e)
+ catch (std::filesystem::filesystem_error& e)
{
using metadata = xyz::openbmc_project::Common::File::Open;
diff --git a/test/utest.cpp b/test/utest.cpp
index 1d1f431..ca95db2 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -18,14 +18,13 @@
#include <stdlib.h>
-#include <experimental/filesystem>
+#include <filesystem>
#include <fstream>
#include <gtest/gtest.h>
using namespace openpower::util;
using namespace openpower::targeting;
-namespace fs = std::experimental::filesystem;
ProcedureMap Registration::procedures;
@@ -46,17 +45,17 @@
_slaveBaseDir = path;
_slaveDir = _slaveBaseDir / "fsi1";
- fs::create_directory(_slaveDir);
+ std::filesystem::create_directory(_slaveDir);
}
virtual void TearDown()
{
- fs::remove_all(_slaveDir);
- fs::remove_all(_slaveBaseDir);
+ std::filesystem::remove_all(_slaveDir);
+ std::filesystem::remove_all(_slaveBaseDir);
}
- fs::path _slaveBaseDir;
- fs::path _slaveDir;
+ std::filesystem::path _slaveBaseDir;
+ std::filesystem::path _slaveDir;
};
TEST_F(TargetingTest, CreateTargets)
@@ -89,7 +88,7 @@
for (const auto& t : targets)
{
- fs::path path;
+ std::filesystem::path path;
ASSERT_EQ(t->getPos(), i);