summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-04-11 17:36:33 -0700
committerWilliam A. Kennington III <wak@google.com>2019-04-11 17:36:41 -0700
commitf59854e94b077630200117b390c4e943d588be31 (patch)
tree2071f0cbae549b224c6b9d478d7169574dbd4e61
parente731044c79968eb867368ef9064c34c98c50872f (diff)
downloadphosphor-logging-f59854e94b077630200117b390c4e943d588be31.tar.gz
phosphor-logging-f59854e94b077630200117b390c4e943d588be31.zip
elog: Add noreturn attribute
We need to signal to the compiler that elog() always throws. This allows the compiler to deduce that we have unreachable code after the elog() statement, instead of a assuming that it might be reachable. Change-Id: If6c41773d3a0dde94d44481ad6ecd719365c515a Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--phosphor-logging/elog.hpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/phosphor-logging/elog.hpp b/phosphor-logging/elog.hpp
index 5aace07..045e99d 100644
--- a/phosphor-logging/elog.hpp
+++ b/phosphor-logging/elog.hpp
@@ -147,8 +147,7 @@ void commit(Entry::Level level)
* @param[in] i_args - Metadata fields to be added to the journal entry
*/
template <typename T, typename... Args>
-void elog(Args... i_args)
-{
+[[noreturn]] void elog(Args... i_args) {
// Validate if the exception is derived from sdbusplus::exception.
static_assert(std::is_base_of<sdbusplus::exception::exception, T>::value,
"T must be a descendant of sdbusplus::exception::exception");
OpenPOWER on IntegriCloud