print: switch to stdplus print
The existing print.hpp was reported as having issues with the
latest clang. Switch to use the stdplus version.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I3584acad3dbf1a55153beb935b10b531ea63c959
diff --git a/src/cmd.cpp b/src/cmd.cpp
index 107b8a3..32c9bcb 100644
--- a/src/cmd.cpp
+++ b/src/cmd.cpp
@@ -1,13 +1,12 @@
#include "cmd.hpp"
-#include "print.hpp"
-
#include <sdbusplus/bus.hpp>
#include <sdbusplus/exception.hpp>
#include <sdbusplus/message.hpp>
#include <sdbusplus/slot.hpp>
#include <stdplus/exception.hpp>
#include <stdplus/fd/ops.hpp>
+#include <stdplus/print.hpp>
#include <array>
#include <cstdio>
@@ -59,7 +58,7 @@
}
catch (const std::exception& e)
{
- std::print(stderr, "IPMI response failure: {}\n", e.what());
+ stdplus::print(stderr, "IPMI response failure: {}\n", e.what());
buffer[0] |= 1 << 2;
buffer[2] = 0xff;
}
@@ -76,12 +75,12 @@
}
if (outstanding)
{
- std::print(stderr, "Canceling outstanding request\n");
+ stdplus::print(stderr, "Canceling outstanding request\n");
outstanding = slot_t(nullptr);
}
if (in.size() < 2)
{
- std::print(stderr, "Read too small, ignoring\n");
+ stdplus::print(stderr, "Read too small, ignoring\n");
return;
}
auto m = bus.new_method_call("xyz.openbmc_project.Ipmi.Host",
diff --git a/src/main.cpp b/src/main.cpp
index c39354d..6032de0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,5 @@
#include "args.hpp"
#include "cmd.hpp"
-#include "print.hpp"
#include "server.hpp"
#include <systemd/sd-daemon.h>
@@ -12,6 +11,7 @@
#include <sdeventplus/source/signal.hpp>
#include <stdplus/exception.hpp>
#include <stdplus/fd/create.hpp>
+#include <stdplus/print.hpp>
#include <stdplus/signal.hpp>
#include <algorithm>
@@ -38,7 +38,7 @@
// Configure basic signal handling
auto exit_handler = [&event](Signal&, const struct signalfd_siginfo*) {
- std::print(stderr, "Interrupted, Exiting\n");
+ stdplus::print(stderr, "Interrupted, Exiting\n");
event.exit(0);
};
stdplus::signal::block(SIGINT);
@@ -82,7 +82,7 @@
}
catch (const std::exception& e)
{
- std::print(stderr, "FAILED: {}\n", e.what());
+ stdplus::print(stderr, "FAILED: {}\n", e.what());
return 1;
}
}
diff --git a/src/print.hpp b/src/print.hpp
deleted file mode 100644
index 001149c..0000000
--- a/src/print.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#pragma once
-
-#include <stdio.h>
-
-#include <format>
-
-// use this until gcc c++ lib has <print>
-namespace std
-{
-inline void vprint(std::FILE* f, std::string_view format, std::format_args args)
-{
- std::string d = std::vformat(format, args);
- fwrite(d.data(), 1, d.size(), f);
-}
-template <class... Args>
-inline void print(std::FILE* f, std::format_string<Args...> format,
- Args&&... args)
-{
- vprint(f, format.get(), std::make_format_args(std::forward<Args>(args)...));
-}
-template <class... Args>
-inline void print(std::format_string<Args...> format, Args&&... args)
-{
- vprint(stdout, format.get(),
- std::make_format_args(std::forward<Args>(args)...));
-}
-} // namespace std
diff --git a/src/server.cpp b/src/server.cpp
index a3a1b47..ed67d82 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1,13 +1,12 @@
#include "server.hpp"
-#include "print.hpp"
-
#include <linux/ipmi_bmc.h>
#include <sdbusplus/exception.hpp>
#include <sdbusplus/server/interface.hpp>
#include <sdbusplus/vtable.hpp>
#include <stdplus/fd/ops.hpp>
+#include <stdplus/print.hpp>
#include <cstdio>
#include <stdexcept>
@@ -43,7 +42,7 @@
}
catch (const std::exception& e)
{
- std::print(stderr, "Method response failed: {}\n", e.what());
+ stdplus::print(stderr, "Method response failed: {}\n", e.what());
sd_bus_error_set(error,
"xyz.openbmc_project.Common.Error.InternalFailure",
"The operation failed internally.");