From 79f7fcc92785c1bb50f1ee22f4adc9c6f3c0fee4 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sat, 11 Jan 2020 01:26:54 +0300 Subject: util/nvramtool: fix building on OpenBSD OpenBSD's gcc 4.2.1 doesn't know about _Noreturn Change-Id: Ie9e1885c483941d3d0ce8c8948af53f1ef8bb5db Signed-off-by: Evgeny Zinoviev Reviewed-on: https://review.coreboot.org/c/coreboot/+/38348 Tested-by: build bot (Jenkins) Reviewed-by: Idwer Vollering Reviewed-by: Patrick Georgi --- util/nvramtool/common.c | 2 +- util/nvramtool/common.h | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'util/nvramtool') diff --git a/util/nvramtool/common.c b/util/nvramtool/common.c index 9b0a6b95ba..5dfc3bd99c 100644 --- a/util/nvramtool/common.c +++ b/util/nvramtool/common.c @@ -56,7 +56,7 @@ int get_line_from_file(FILE * f, char line[], int line_buf_size) * * We ran out of memory. Print an error message and die. ****************************************************************************/ -_Noreturn void out_of_memory(void) +noreturn void out_of_memory(void) { fprintf(stderr, "%s: Out of memory.\n", prog_name); exit(1); diff --git a/util/nvramtool/common.h b/util/nvramtool/common.h index 19ce5666a7..f49bc33831 100644 --- a/util/nvramtool/common.h +++ b/util/nvramtool/common.h @@ -69,6 +69,12 @@ int win32_munmap(void *start, size_t length); #define MAP_SHARED 1 #endif +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#define noreturn _Noreturn +#else +#define noreturn +#endif + /* basename of this program, as reported by argv[0] */ extern const char prog_name[]; @@ -76,7 +82,7 @@ extern const char prog_name[]; extern const char prog_version[]; int get_line_from_file(FILE * f, char line[], int line_buf_size); -_Noreturn void out_of_memory(void); +noreturn void out_of_memory(void); void usage(FILE * outfile); #endif /* COMMON_H */ -- cgit v1.2.3