Evgeny Zinoviev has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38348 )
Change subject: util/nvramtool: fix building on OpenBSD ......................................................................
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 me@ch1p.io --- M util/nvramtool/common.c M util/nvramtool/common.h 2 files changed, 8 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/38348/1
diff --git a/util/nvramtool/common.c b/util/nvramtool/common.c index 9b0a6b9..5dfc3bd 100644 --- a/util/nvramtool/common.c +++ b/util/nvramtool/common.c @@ -56,7 +56,7 @@ * * 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 19ce566..f49bc33 100644 --- a/util/nvramtool/common.h +++ b/util/nvramtool/common.h @@ -69,6 +69,12 @@ #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_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 */
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38348 )
Change subject: util/nvramtool: fix building on OpenBSD ......................................................................
Patch Set 1:
Question: which clang version does OpenBSD ship? Perhaps we should instead change the default compiler from gcc to clang. CC=clang with LLVM 9.0.1 works for me on FreeBSD.
Tested with 'nvramtool -d'.
Evgeny Zinoviev has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38348 )
Change subject: util/nvramtool: fix building on OpenBSD ......................................................................
Patch Set 1:
Patch Set 1:
Question: which clang version does OpenBSD ship? Perhaps we should instead change the default compiler from gcc to clang. CC=clang with LLVM 9.0.1 works for me on FreeBSD.
Tested with 'nvramtool -d'.
clang -v tells 8.0.1.
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38348 )
Change subject: util/nvramtool: fix building on OpenBSD ......................................................................
Patch Set 1: Code-Review+1
Elsewhere (FreeBSD) include/stdreturn.h exists.
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38348 )
Change subject: util/nvramtool: fix building on OpenBSD ......................................................................
Patch Set 1: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/38348 )
Change subject: util/nvramtool: fix building on OpenBSD ......................................................................
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 me@ch1p.io Reviewed-on: https://review.coreboot.org/c/coreboot/+/38348 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Idwer Vollering vidwer@gmail.com Reviewed-by: Patrick Georgi pgeorgi@google.com --- M util/nvramtool/common.c M util/nvramtool/common.h 2 files changed, 8 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved Idwer Vollering: Looks good to me, but someone else must approve
diff --git a/util/nvramtool/common.c b/util/nvramtool/common.c index 9b0a6b9..5dfc3bd 100644 --- a/util/nvramtool/common.c +++ b/util/nvramtool/common.c @@ -56,7 +56,7 @@ * * 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 19ce566..f49bc33 100644 --- a/util/nvramtool/common.h +++ b/util/nvramtool/common.h @@ -69,6 +69,12 @@ #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_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 */