From b886f9aaf7675f1f9f242a2b9dfe119ce0672d66 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 6 Jun 2008 12:21:01 +0200 Subject: [PATCH] src/plugin.h: Use __attribute__((format)) for plugin_log. All __attribute__'s will be automatically set to /**/ when not using the GNU CC via a macro in src/collectd.h. This way this should be portable. --- src/collectd.h | 5 +++++ src/plugin.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/collectd.h b/src/collectd.h index 55aac160..411048af 100644 --- a/src/collectd.h +++ b/src/collectd.h @@ -220,6 +220,11 @@ #define STATIC_ARRAY_LEN(array) (sizeof (array) / sizeof ((array)[0])) +/* Remove GNU specific __attribute__ settings when using another compiler */ +#if !__GNUC__ +# define __attribute__(x) /**/ +#endif + extern char hostname_g[]; extern int interval_g; diff --git a/src/plugin.h b/src/plugin.h index 25c745cb..91978bd9 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -205,7 +205,9 @@ int plugin_dispatch_values (const char *name, value_list_t *vl); int plugin_dispatch_notification (const notification_t *notif); -void plugin_log (int level, const char *format, ...); +void plugin_log (int level, const char *format, ...) + __attribute__ ((format(printf,2,3))); + #define ERROR(...) plugin_log (LOG_ERR, __VA_ARGS__) #define WARNING(...) plugin_log (LOG_WARNING, __VA_ARGS__) #define NOTICE(...) plugin_log (LOG_NOTICE, __VA_ARGS__) -- 2.11.0