From: Florian Forster Date: Fri, 6 Jun 2008 10:21:01 +0000 (+0200) Subject: src/plugin.h: Use __attribute__((format)) for plugin_log. X-Git-Tag: collectd-4.4.2~11^2~4 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=b886f9aaf7675f1f9f242a2b9dfe119ce0672d66;p=collectd.git 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. --- 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__)