From 31d71308339b9dde2134a3447807044fae73e64a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 20:07:03 +0100 Subject: [PATCH] utils/magic.h: ATTR_UNREACHABLE ATTR_NORETURN Add optional compiler support for these attribute hints. --- utils/magic.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/magic.h b/utils/magic.h index 620102ed..a0d5f1ec 100644 --- a/utils/magic.h +++ b/utils/magic.h @@ -173,10 +173,14 @@ extern char AbortMessage[]; #if defined(__GNUC__) || defined(__clang__) #define ATTR_FORMAT_PRINTF_1 __attribute__((format (printf,1,2))) #define ATTR_FORMAT_PRINTF_2 __attribute__((format (printf,2,3))) + #define ATTR_UNREACHABLE __builtin_unreachable() + #define ATTR_NORETURN __attribute__((noreturn)) #define __unused__(x) x __attribute__((unused)) #else #define ATTR_FORMAT_PRINTF_1 /* */ #define ATTR_FORMAT_PRINTF_2 /* */ + #define ATTR_UNREACHABLE /* */ + #define ATTR_NORETURN /* */ #define __unused__(x) x #endif