Switch to C++17
There is no harm in doing this since we are not a client library and all
environments using this project should have c++17 compliant compilers at
this point.
Tested:
Run through unit test suite.
Change-Id: Iceae5375fd69b1929e1c4e2c6c297d131c61de68
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/configure.ac b/configure.ac
index a911296..6c5ac70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@
AC_PROG_INSTALL
# Checks for typedefs, structures, and compiler characteristics.
-AX_CXX_COMPILE_STDCXX_14([noext])
+AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
# For linking
diff --git a/mainapp.cpp b/mainapp.cpp
index 889e241..72277d1 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -17,8 +17,8 @@
#include "argument.hpp"
#include "watchdog.hpp"
-#include <experimental/optional>
#include <iostream>
+#include <optional>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/log.hpp>
@@ -149,7 +149,7 @@
{
exitWithError("Multiple fallbacks specified.", argv);
}
- std::experimental::optional<Watchdog::Fallback> fallback;
+ std::optional<Watchdog::Fallback> fallback;
if (!fallbackActionParam.empty())
{
Watchdog::Action action;
diff --git a/watchdog.hpp b/watchdog.hpp
index ea419e7..efa413a 100644
--- a/watchdog.hpp
+++ b/watchdog.hpp
@@ -2,12 +2,14 @@
#include "timer.hpp"
-#include <systemd/sd-event.h>
-
-#include <experimental/optional>
+#include <functional>
+#include <map>
+#include <optional>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>
+#include <utility>
#include <xyz/openbmc_project/State/Watchdog/server.hpp>
+
namespace phosphor
{
namespace watchdog
@@ -54,8 +56,7 @@
Watchdog(sdbusplus::bus::bus& bus, const char* objPath, EventPtr& event,
std::map<Action, TargetName>&& actionTargets =
std::map<Action, TargetName>(),
- std::experimental::optional<Fallback>&& fallback =
- std::experimental::nullopt) :
+ std::optional<Fallback>&& fallback = std::nullopt) :
WatchdogInherits(bus, objPath),
bus(bus), actionTargets(std::move(actionTargets)),
fallback(std::move(fallback)),
@@ -129,7 +130,7 @@
std::map<Action, TargetName> actionTargets;
/** @brief Fallback timer options */
- std::experimental::optional<Fallback> fallback;
+ std::optional<Fallback> fallback;
/** @brief Contained timer object */
Timer timer;