summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-09-12 18:01:37 -0700
committerWilliam A. Kennington III <wak@google.com>2018-09-13 18:21:33 -0700
commit73c2cfb97b1070c75db2c9cbf0b46de914883495 (patch)
treee366818c6f8bee5391d0f9ad97a89fc01076bea7
parent8f6c51564d634eb26f1ca8aa599fbbda19e06dec (diff)
downloadphosphor-watchdog-73c2cfb97b1070c75db2c9cbf0b46de914883495.tar.gz
phosphor-watchdog-73c2cfb97b1070c75db2c9cbf0b46de914883495.zip
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>
-rw-r--r--configure.ac2
-rw-r--r--mainapp.cpp4
-rw-r--r--watchdog.hpp13
3 files changed, 10 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index a911296..6c5ac70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@ AC_PROG_CXX
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 @@ int main(int argc, char** argv)
{
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 @@ class Watchdog : public WatchdogInherits
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 @@ class Watchdog : public WatchdogInherits
std::map<Action, TargetName> actionTargets;
/** @brief Fallback timer options */
- std::experimental::optional<Fallback> fallback;
+ std::optional<Fallback> fallback;
/** @brief Contained timer object */
Timer timer;
OpenPOWER on IntegriCloud