]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/defines.h: Add NORETURN attribute macro
authorAlejandro Colomar <alx@kernel.org>
Tue, 7 Feb 2023 18:39:36 +0000 (19:39 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 9 Feb 2023 04:01:01 +0000 (22:01 -0600)
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 <alx@kernel.org>
lib/defines.h

index 5ef11c021140c59816af8c7191bb0d8a9f66b4bc..c285e119f4731f860b737862bf7374aa509828fe 100644 (file)
@@ -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