From dfd32b91a5af61f1a9de787fd0a7f971269cd34e Mon Sep 17 00:00:00 2001 From: Trent Houliston Date: Thu, 15 Aug 2024 10:00:19 +1000 Subject: [PATCH] Make demangle noexcept --- src/util/demangle.cpp | 6 +++--- src/util/demangle.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/demangle.cpp b/src/util/demangle.cpp index 01ea83ecf..e8b0754e6 100644 --- a/src/util/demangle.cpp +++ b/src/util/demangle.cpp @@ -61,13 +61,13 @@ namespace util { sym_initialised = true; } - std::string demangle(const char* symbol) { + std::string demangle(const char* symbol) noexcept { // If the symbol is null or the empty string then just return it if (symbol == nullptr || symbol[0] == '\0') { return ""; } - std::lock_guard lock(symbol_mutex); + const std::lock_guard lock(symbol_mutex); // Initialise the symbols if we have to if (!sym_initialised) { @@ -110,7 +110,7 @@ namespace util { * * @return the demangled symbol, or the original string if it could not be demangled */ - std::string demangle(const char* symbol) { + std::string demangle(const char* symbol) noexcept { if (symbol == nullptr) { return {}; diff --git a/src/util/demangle.hpp b/src/util/demangle.hpp index e92a6035a..cb18b82a4 100644 --- a/src/util/demangle.hpp +++ b/src/util/demangle.hpp @@ -28,7 +28,7 @@ namespace NUClear { namespace util { - std::string demangle(const char* symbol); + std::string demangle(const char* symbol) noexcept; } // namespace util } // namespace NUClear