From fc5950be006125db759b253d0a141953a7908bd3 Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Tue, 4 Jul 2017 16:29:32 +0200 Subject: util: noexcept logging and also noreturn for fatal() Signed-off-by: Marcus Fritzsch --- src/util.hpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/util.hpp') diff --git a/src/util.hpp b/src/util.hpp index a2f0dbf..0a3b8de 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -8,19 +8,21 @@ #ifdef __GNUC__ #define ATTR_FORMAT(stringindex, firsttocheck) \ __attribute__((format(printf, stringindex, firsttocheck))) +#define ATTR_NORETURN __attribute__((noreturn)) #else #define ATTR_FORMAT(stringindex, firsttocheck) +#define ATTR_NORETURN #endif -void lognotice(char const *fmt, ...) ATTR_FORMAT(1, 2); -void logerror(char const *fmt, ...) ATTR_FORMAT(1, 2); -void fatal(char const *fmt, ...) ATTR_FORMAT(1, 2); +void lognotice(char const *fmt, ...) noexcept ATTR_FORMAT(1, 2); +void logerror(char const *fmt, ...) noexcept ATTR_FORMAT(1, 2); +void fatal(char const *fmt, ...) noexcept ATTR_FORMAT(1, 2) ATTR_NORETURN; #ifdef DEBUG_OUTPUT -void logdebug(char const *fmt, ...) ATTR_FORMAT(1, 2); +void logdebug(char const *fmt, ...) noexcept ATTR_FORMAT(1, 2); #else -static inline void logdebug(char const *fmt, ...) ATTR_FORMAT(1, 2); -static inline void logdebug(char const *fmt, ...) {} +static inline void logdebug(char const *fmt, ...) noexcept ATTR_FORMAT(1, 2); +static inline void logdebug(char const *fmt, ...) noexcept {} #endif // _ _ _ __ _ -- cgit 1.2.3-korg