From: Christian Storm <[email protected]> __builtin_unreachable() is available since gcc 4.5, released 2010. __attribute__((noreturn)) is avilable since gcc 2.5.0, released 1993. __attribute__((unused)) is available since gcc 2.7, released 1995.
Signed-off-by: Christian Storm <[email protected]> --- include/ebgpart.h | 4 ---- include/utils.h | 12 +----------- tools/ebgpart.c | 2 +- utils.c | 4 ++-- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/include/ebgpart.h b/include/ebgpart.h index d02cfbe..85b3ad7 100644 --- a/include/ebgpart.h +++ b/include/ebgpart.h @@ -33,10 +33,6 @@ if (verbosity) fprintf(o, __VA_ARGS__) #endif -#ifndef __unused -#define __unused __attribute__((unused)) -#endif - #include <unistd.h> #include <errno.h> #include <stdio.h> diff --git a/include/utils.h b/include/utils.h index ff8f9ef..b496031 100644 --- a/include/utils.h +++ b/include/utils.h @@ -20,16 +20,6 @@ #define MAX_INFO_SIZE 1024 -#if defined(__GNUC__) -#define __noreturn __attribute__((noreturn)) -#define unreachable() __builtin_unreachable() -#else -#define __noreturn /**/ -#define unreachable() \ - do { \ - } while (1) -#endif - typedef struct _VOLUME_DESC { EFI_DEVICE_PATH *devpath; CHAR16 *fslabel; @@ -43,7 +33,7 @@ extern UINTN volume_count; typedef enum { DOSFSLABEL, CUSTOMLABEL, NOLABEL } LABELMODE; uint32_t calc_crc32(void *data, int32_t size); -void __noreturn error_exit(CHAR16 *message, EFI_STATUS status); +void __attribute__((noreturn)) error_exit(CHAR16 *message, EFI_STATUS status); VOID *mmalloc(UINTN bytes); EFI_STATUS mfree(VOID *p); CHAR16 *get_volume_label(EFI_FILE_HANDLE fh); diff --git a/tools/ebgpart.c b/tools/ebgpart.c index fc3bf3b..7880101 100644 --- a/tools/ebgpart.c +++ b/tools/ebgpart.c @@ -553,7 +553,7 @@ PedDisk *ped_disk_new(const PedDevice *dev) return &g_ped_dummy_disk; } -PedPartition *ped_disk_next_partition(const PedDisk *__unused pd, +PedPartition *ped_disk_next_partition(const PedDisk *__attribute__((unused)) pd, const PedPartition *part) { return part->next; diff --git a/utils.c b/utils.c index cb9569d..422356f 100644 --- a/utils.c +++ b/utils.c @@ -55,12 +55,12 @@ uint32_t calc_crc32(void *data, int32_t size) return crc; } -void __noreturn error_exit(CHAR16 *message, EFI_STATUS status) +void __attribute__((noreturn)) error_exit(CHAR16 *message, EFI_STATUS status) { ERROR(L"%s ( %r )\n", message, status); uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000); uefi_call_wrapper(BS->Exit, 4, this_image, status, 0, NULL); - unreachable(); + __builtin_unreachable(); } VOID *mmalloc(UINTN bytes) -- 2.30.0 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20210108144342.24785-4-christian.storm%40siemens.com.
