From 745383861735f177e1267e6beb3cea794fc88795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Fri, 7 Sep 2012 21:01:46 +0200 Subject: [PATCH] Improved use of gcc __attribute__. --- ChangeLog | 9 +++++++++ examples/io.h | 6 +----- examples/nettle-benchmark.c | 2 +- tools/misc.h | 13 ++----------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 451f4b3c..cf5aa1c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-09-07 Niels Möller + + * examples/nettle-benchmark.c (die): Add NORETURN attribute. Patch + from Tim Rühsen. + * tools/misc.h (die, werror): Use PRINTF_STYLE and NORETURN macros + for attributes. Patch from Tim Rühsen. + + * examples/io.h (werror): Use PRINTF_STYLE macro. + 2012-08-22 Niels Möller From Sam Thursfield : diff --git a/examples/io.h b/examples/io.h index ff4a18dc..d95c81a3 100644 --- a/examples/io.h +++ b/examples/io.h @@ -37,11 +37,7 @@ void * xalloc(size_t size); void -werror(const char *format, ...) -#if __GNUC___ - __attribute__((__format__ (__printf__,1, 2))) -#endif - ; +werror(const char *format, ...) PRINTF_STYLE(1, 2); /* If size is > 0, read at most that many bytes. If size == 0, * read until EOF. Allocates the buffer dynamically. */ diff --git a/examples/nettle-benchmark.c b/examples/nettle-benchmark.c index b76a91cb..48e53d06 100644 --- a/examples/nettle-benchmark.c +++ b/examples/nettle-benchmark.c @@ -96,7 +96,7 @@ static double frequency = 0.0; #define BENCH_ITERATIONS 10 #endif -static void +static void NORETURN die(const char *format, ...) { va_list args; diff --git a/tools/misc.h b/tools/misc.h index 70c9eeb1..df2bed17 100644 --- a/tools/misc.h +++ b/tools/misc.h @@ -28,19 +28,10 @@ #endif void -die(const char *format, ...) -#if __GNUC___ - __attribute__((__format__ (__printf__,1, 2))) - __attribute__((__noreturn__)) -#endif - ; +die(const char *format, ...) PRINTF_STYLE (1, 2) NORETURN; void -werror(const char *format, ...) -#if __GNUC___ - __attribute__((__format__ (__printf__,1, 2))) -#endif - ; +werror(const char *format, ...) PRINTF_STYLE (1, 2); void * xalloc(size_t size); -- GitLab