From b34387745afc180fd03ebca5a6ee00f3d665c657 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 7 Feb 2023 19:39:36 +0100 Subject: [PATCH] lib/defines.h: Add NORETURN attribute macro We could use the standard (C11) _Noreturn qualifier, but it will be deprecated in C23, and replaced by C++'s [[noreturn]], which is compatible with the GCC attribute, so let's directly use the attribute, and in the future we'll be able to switch to [[]]. Signed-off-by: Alejandro Colomar --- lib/defines.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/defines.h b/lib/defines.h index 5ef11c02..c285e119 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -222,10 +222,12 @@ static inline void memzero(void *ptr, size_t size) /* To be used for verified unused parameters */ #if defined(__GNUC__) && !defined(__STRICT_ANSI__) -# define unused __attribute__((unused)) +# define unused __attribute__((unused)) +# define NORETURN __attribute__((__noreturn__)) # define format_attr(type, index, check) __attribute__((format (type, index, check))) #else # define unused +# define NORETURN # define format_attr(type, index, check) #endif