From 0f03cc378e6ce48f17a20e409f93bfc11345a6ed Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 16 May 2017 20:14:22 +0200 Subject: Fix errors and warnings and make the code cleaner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/util.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/util.h') diff --git a/src/util.h b/src/util.h index 4f94a88..c51dbc9 100644 --- a/src/util.h +++ b/src/util.h @@ -1,6 +1,12 @@ /* See LICENSE file for copyright and license details. */ #include "arg.h" +#if defined(__GNUC__) || defined(__clang__) +# define ATTRIBUTE_NORETURN __attribute__((noreturn)) +#else +# define ATTRIBUTE_NORETURN +#endif + #define ELEMENTSOF(ARRAY) (sizeof(ARRAY) / sizeof(*(ARRAY))) #define MIN(A, B) ((A) < (B) ? (A) : (B)) #define MAX(A, B) ((A) > (B) ? (A) : (B)) @@ -9,8 +15,9 @@ #define INTSTRLEN(TYPE) ((sizeof(TYPE) == 1 ? 3 : (5 * sizeof(TYPE) / 2)) + ((TYPE)-1 < 1)) #define USAGE(SYNOPSIS)\ + ATTRIBUTE_NORETURN\ static void usage(void)\ - { eprintf("usage: %s%s%s\n", argv0, SYNOPSIS ? " " : "", SYNOPSIS); } + { eprintf("usage: %s%s%s\n", argv0, *SYNOPSIS ? " " : "", SYNOPSIS); } #include "util/eprintf.h" #include "util/efflush.h" -- cgit v1.2.3-70-g09d2