From e66cedf4cbf24bee25cd27174e9b62a22d378d26 Mon Sep 17 00:00:00 2001 From: kongr45gpen <electrovesta@gmail.com> Date: Mon, 2 Sep 2019 01:52:43 +0300 Subject: [PATCH] Remove noexcept, as the string.append functions may throw exceptions --- inc/Logger.hpp | 5 +++-- src/Logger.cpp | 4 ++-- src/Platform/x86/Logger.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/inc/Logger.hpp b/inc/Logger.hpp index ec0e4142..96c2101f 100644 --- a/inc/Logger.hpp +++ b/inc/Logger.hpp @@ -111,16 +111,17 @@ public: * * @tparam T The type of value to append * @param value The new value to add + * @todo See if noexcept can be added here without triggering warnings * @return The current Logger::LogEntry where the value has been appended */ template <class T> - Logger::LogEntry& operator<<(const T value) noexcept { + Logger::LogEntry& operator<<(const T value) { etl::to_string(value, message, format, true); return *this; } - Logger::LogEntry& operator<<(const std::string& value) noexcept; + Logger::LogEntry& operator<<(const std::string& value); }; /** diff --git a/src/Logger.cpp b/src/Logger.cpp index 65584a94..76e36d59 100644 --- a/src/Logger.cpp +++ b/src/Logger.cpp @@ -4,14 +4,14 @@ etl::format_spec Logger::format; // Reimplementation of the function for variable C strings template <> -Logger::LogEntry& Logger::LogEntry::operator<<(char* value) noexcept { +Logger::LogEntry& Logger::LogEntry::operator<<(char* value) { message.append(value); return *this; } // Reimplementation of the function for C strings template <> -Logger::LogEntry& Logger::LogEntry::operator<<(const char* value) noexcept { +Logger::LogEntry& Logger::LogEntry::operator<<(const char* value) { message.append(value); return *this; } diff --git a/src/Platform/x86/Logger.cpp b/src/Platform/x86/Logger.cpp index f5ec73d0..85d07976 100644 --- a/src/Platform/x86/Logger.cpp +++ b/src/Platform/x86/Logger.cpp @@ -61,7 +61,7 @@ void Logger::log(Logger::LogLevel level, etl::istring & message) { // Reimplementation of the log function for C++ strings // This is kept in the Platform files, since we don't want to mess with std::strings in the microcontroller -Logger::LogEntry& Logger::LogEntry::operator<<(const std::string & value) noexcept { +Logger::LogEntry& Logger::LogEntry::operator<<(const std::string & value) { message.append(value.c_str()); return *this; -- GitLab