From a64cfdbfc0dd7ad7d204ff0b9399e6d174faec67 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 19 Jan 2012 16:19:18 +0100 Subject: [PATCH] Tagged error and warning with GCC attributes. --- ChangeLog | 2 ++ src/duff.h | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c08d94b..45385b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ Maintained since version 0.3.1. 2012-01-19 Camilla Berglund + * duff.h: Tagged functions error and warning with GCC attributes. + * duff.1: Clarified default sampling limit. * duffdriver.c: Renamed cluster index variable to index. 2012-01-18 Camilla Berglund diff --git a/src/duff.h b/src/duff.h index c9015fd..1c86634 100644 --- a/src/duff.h +++ b/src/duff.h @@ -28,6 +28,11 @@ */ #define _(String) gettext(String) +/* Only use __attribute__ on GCC and compatible compilers */ +#ifndef __GNUC__ +#define __attribute__(x) +#endif + #define SAMPLE_COUNT 10 /* Status modes for entries. @@ -114,8 +119,8 @@ int compare_entries(Entry* first, Entry* second); int read_path(FILE* stream, char* path, size_t size); void kill_trailing_slashes(char* path); size_t get_digest_size(void); -void error(const char* format, ...); -void warning(const char* format, ...); +void error(const char* format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); +void warning(const char* format, ...) __attribute__((format(printf, 1, 2))); int cluster_header_uses_digest(const char* format); void print_cluster_header(const char* format, unsigned int count,