From 5602bcb89c7c29e843a93a9ac45b384098df5a9e Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Tue, 21 Jun 2016 22:32:33 +0200 Subject: [PATCH 05/10] INI: Enable string format check for ini_errobj_add_msg --- ini/ini_configobj.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ini/ini_configobj.h b/ini/ini_configobj.h index 974ddf3100ae4cec691b48fdfc999e72f39deaa4..4f47e7839ec9b7d82ea1e24fcfa07ac4e76ec890 100644 --- a/ini/ini_configobj.h +++ b/ini/ini_configobj.h @@ -32,6 +32,14 @@ #include "simplebuffer.h" #include "ini_valueobj.h" +#ifndef DING_ATTR_FORMAT +# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) +# define DING_ATTR_FORMAT(fmt, args) __attribute__((__format__(__printf__, fmt, args))) +# else +# define DING_ATTR_FORMAT(fmt, args) +# endif +#endif + /** @mainpage The INI configuration interface * * The goal of the this interface is to allow applications @@ -2089,7 +2097,9 @@ void ini_errobj_destroy(struct ini_errobj **errobj); * * @return Zero on success, nonzero value in case of error. */ -int ini_errobj_add_msg(struct ini_errobj *errobj, const char *format, ...); +int ini_errobj_add_msg(struct ini_errobj *errobj, + const char *format, ...) + DING_ATTR_FORMAT(2, 3); /** * @brief Reset iterator in errobj. -- 2.7.4