utils/magic.h: ATTR_UNREACHABLE ATTR_NORETURN

Add optional compiler support for these attribute hints.
This commit is contained in:
Darryl L. Miles 2024-10-04 20:07:03 +01:00
parent fc02f57d73
commit 31d7130833
1 changed files with 4 additions and 0 deletions

View File

@ -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