summaryrefslogtreecommitdiffstats
path: root/vespalog
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-02-15 07:45:24 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-02-15 07:45:24 +0000
commitfc14ad27155e0bdd0e0c20be31bad7dfdf0a3122 (patch)
tree035efa3d847dcfcd5ca5d749fc302f54c82a18cf /vespalog
parentc5fe5b6be07e57115cd72738a5afd928b0df60ef (diff)
- [[noreturn]] is standard.
- gnu printf format specification is defacto standard.
Diffstat (limited to 'vespalog')
-rw-r--r--vespalog/src/vespa/log/internal.h12
-rw-r--r--vespalog/src/vespa/log/log.h12
2 files changed, 5 insertions, 19 deletions
diff --git a/vespalog/src/vespa/log/internal.h b/vespalog/src/vespa/log/internal.h
index 4411d9fa6e6..c25c7cc44b6 100644
--- a/vespalog/src/vespa/log/internal.h
+++ b/vespalog/src/vespa/log/internal.h
@@ -4,14 +4,9 @@
#include <string>
#include <cstdlib>
-#if !__GNUC__ && !defined(__attribute__)
-#define __attribute__(x)
-#endif
-
namespace ns_log {
-void throwInvalid(const char *fmt, ...)
- __attribute__((format(printf, 1, 2))) __attribute__((noreturn));
+[[noreturn]] void throwInvalid(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
class InvalidLogException {
private:
@@ -20,10 +15,9 @@ private:
public:
InvalidLogException& operator = (const InvalidLogException&) = delete;
InvalidLogException(const InvalidLogException &x) = default;
- InvalidLogException(const char *s) : _what(s) {}
+ explicit InvalidLogException(const char *s) : _what(s) {}
~InvalidLogException() = default;
- const char *what() const { return _what.c_str(); }
+ [[nodiscard]] const char *what() const { return _what.c_str(); }
};
} // end namespace ns_log
-
diff --git a/vespalog/src/vespa/log/log.h b/vespalog/src/vespa/log/log.h
index 22b6a720bd2..888e24a0f28 100644
--- a/vespalog/src/vespa/log/log.h
+++ b/vespalog/src/vespa/log/log.h
@@ -252,17 +252,9 @@ inline bool Logger::wants(LogLevel level)
return _logLevels[level] == CHARS_TO_UINT(' ', ' ', 'O', 'N');
}
-#define LOG_noreturn __attribute__((__noreturn__))
+[[noreturn]] extern void log_assert_fail(const char *assertion, const char *file, uint32_t line);
-extern void log_assert_fail(const char *assertion,
- const char *file,
- uint32_t line) LOG_noreturn;
-
-extern void log_abort(const char *message,
- const char *file,
- uint32_t line) LOG_noreturn;
-
-#undef LOG_noreturn
+[[noreturn]] extern void log_abort(const char *message, const char *file, uint32_t line);
} // end namespace log