Compiling with -Wsuggest-attribute=format shows that these functions
could use a format attribute, which helps the compiler validate format
strings. This patch adds them.
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Change-Id: I2884d13b08d9ea67680289e59fb40ebdfecdc3d4
#define ARGPAR_ASSERT(_cond) assert(_cond)
#define ARGPAR_ASSERT(_cond) assert(_cond)
+#ifdef __MINGW_PRINTF_FORMAT
+# define ARGPAR_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
+#else
+# define ARGPAR_PRINTF_FORMAT printf
+#endif
+
+static __attribute__((format(ARGPAR_PRINTF_FORMAT, 1, 0)))
char *argpar_vasprintf(const char *fmt, va_list args)
{
int len1, len2;
char *argpar_vasprintf(const char *fmt, va_list args)
{
int len1, len2;
+static __attribute__((format(ARGPAR_PRINTF_FORMAT, 1, 2)))
char *argpar_asprintf(const char *fmt, ...)
{
va_list args;
char *argpar_asprintf(const char *fmt, ...)
{
va_list args;
+static __attribute__((format(ARGPAR_PRINTF_FORMAT, 2, 3)))
bool argpar_string_append_printf(char **str, const char *fmt, ...)
{
char *new_str = NULL;
bool argpar_string_append_printf(char **str, const char *fmt, ...)
{
char *new_str = NULL;