summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2023-06-23 14:57:00 +0300
committerPatrick Williams <patrick@stwcx.xyz>2023-06-23 14:59:44 +0300
commitd85418e397ffffb2446eac9799b381502518b780 (patch)
tree1002299c81d91f228f58a42d74c62ae387b1df53
parent6995c1ce42d5bc2d223af7d3b2f3cae613d3b231 (diff)
downloadbmcweb-d85418e397ffffb2446eac9799b381502518b780.tar.xz
error_messages: remove source_location indirect
clang-16 now supports std::source_location so remove the indirection that uses experimental::source_location in some cases. Tested: Compiled with `CXX=clang++`. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Id55bdf01855206c6892684e1e56cc5ff56e2b5a2
-rw-r--r--include/source_location.hpp27
-rw-r--r--redfish-core/include/error_messages.hpp6
-rw-r--r--redfish-core/src/error_messages.cpp4
3 files changed, 5 insertions, 32 deletions
diff --git a/include/source_location.hpp b/include/source_location.hpp
deleted file mode 100644
index 9880752d66..0000000000
--- a/include/source_location.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#pragma once
-
-// As of clang-12, clang still doesn't support std::source_location, which
-// means that clang-tidy also doesn't support std::source_location.
-// Inside the libstdc++ implementation of <source_location> is this check of
-// __builtin_source_location to determine if the compiler supports the
-// necessary bits for std::source_location, and if not the header ends up doing
-// nothing. Use this same builtin-check to detect when we're running under
-// an "older" clang and fallback to std::experimental::source_location instead.
-
-#if __has_builtin(__builtin_source_location)
-#include <source_location>
-
-namespace bmcweb
-{
-using source_location = std::source_location;
-}
-
-#else
-#include <experimental/source_location>
-
-namespace bmcweb
-{
-using source_location = std::experimental::source_location;
-}
-
-#endif
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index 6f1e4e8911..6c5952d727 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -16,12 +16,12 @@
#pragma once
#include "http_response.hpp"
-#include "source_location.hpp"
#include <boost/url/url_view.hpp>
#include <nlohmann/json.hpp>
#include <cstdint>
+#include <source_location>
#include <string>
#include <string_view>
@@ -121,8 +121,8 @@ void actionParameterValueNotInList(crow::Response& res, std::string_view arg1,
* @returns Message InternalError formatted to JSON */
nlohmann::json internalError();
-void internalError(crow::Response& res, bmcweb::source_location location =
- bmcweb::source_location::current());
+void internalError(crow::Response& res, std::source_location location =
+ std::source_location::current());
/**
* @brief Formats UnrecognizedRequestBody message into JSON
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index 1742d23114..7d1f3a94f9 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -19,7 +19,6 @@
#include "logging.hpp"
#include "registries.hpp"
#include "registries/base_message_registry.hpp"
-#include "source_location.hpp"
#include <boost/beast/http/field.hpp>
#include <boost/beast/http/status.hpp>
@@ -27,6 +26,7 @@
#include <array>
#include <cstddef>
+#include <source_location>
#include <span>
#include <string>
#include <utility>
@@ -280,7 +280,7 @@ nlohmann::json internalError(void)
return getLog(redfish::registries::base::Index::internalError, {});
}
-void internalError(crow::Response& res, const bmcweb::source_location location)
+void internalError(crow::Response& res, const std::source_location location)
{
BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "("
<< location.line() << ":" << location.column() << ") `"