From c5466a6db697a9270c29c697193acca904afbe09 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Tue, 21 Jun 2016 22:32:33 +0200 Subject: [PATCH 5/8] 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 48811ac8e34ecb08c77877a84ead034a7d268175..50d6d93c6fe644e5f1f444711cfab53bb2944b4c 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 @@ -2087,7 +2095,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