Convert run-time to build-time assertion

There's just one, in show_product().

Use new BUILD_ASSERT() there, because its contract is even simpler
than BUILD_ASSERT_ONE()'s.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-07-04 16:19:16 +02:00
parent 80bf4ec34b
commit d58bea5458
2 changed files with 8 additions and 1 deletions

View file

@ -82,6 +82,13 @@ extern void (*oops_handler)(void);
#define BUILD_ASSERT_ONE(cond) \
(sizeof(char[1 - 2 * !(cond)]))
/*
* Assert constant expression @cond.
* If @cond is zero, force a compilation error.
*/
#define BUILD_ASSERT(cond) \
((void)BUILD_ASSERT_ONE(cond))
void exit_nomem(void) ATTRIBUTE((noreturn));
/* return codes from command routines */