CHECK_C_COMPILER_FLAG(-pedantic SUPPORT_PEDANTIC_FLAG)
CHECK_C_COMPILER_FLAG(-Wno-unused-const-variable SUPPORT_WNO_UNUSED_CONST)
CHECK_C_COMPILER_FLAG(-Wmissing-noreturn SUPPORT_WMISSING_NORETURN)
+CHECK_C_COMPILER_FLAG(-Wmissing-format-attribute SUPPORT_WMISSING_FORMAT_ATTRIBUTE)
# GCC 6 specific
CHECK_C_COMPILER_FLAG(-Wnull-dereference SUPPORT_WNULL_DEREFERENCE)
CHECK_C_COMPILER_FLAG(-Wduplicated-cond SUPPORT_WDUPLICATED_COND)
IF(SUPPORT_WMISSING_NORETURN)
ADD_COMPILE_OPTIONS("-Wmissing-noreturn")
ENDIF(SUPPORT_WMISSING_NORETURN)
+IF(SUPPORT_WMISSING_FORMAT_ATTRIBUTE)
+ ADD_COMPILE_OPTIONS("-Wmissing-format-attribute")
+ENDIF(SUPPORT_WMISSING_FORMAT_ATTRIBUTE)
CHECK_C_COMPILER_FLAG(-fPIC SUPPORT_FPIC)
IF(SUPPORT_FPIC)
/* Command functions for an async context. Write the command to the
* output buffer and register the provided callback. */
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 0)))
+#endif
int redisvAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, va_list ap);
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 5)))
+#endif
int redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, ...);
int redisAsyncCommandArgv(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, int argc, const char **argv, const size_t *argvlen);
int redisAsyncFormattedCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *cmd, size_t len);
void freeReplyObject(void *reply);
/* Functions to format a command according to the protocol. */
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
int redisvFormatCommand(char **target, const char *format, va_list ap);
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 3)))
+#endif
int redisFormatCommand(char **target, const char *format, ...);
int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen);
int redisFormatSdsCommandArgv(sds *target, int argc, const char ** argv, const size_t *argvlen);
/* Write a command to the output buffer. Use these functions in blocking mode
* to get a pipeline of commands. */
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
int redisvAppendCommand(redisContext *c, const char *format, va_list ap);
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 3)))
+#endif
int redisAppendCommand(redisContext *c, const char *format, ...);
int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
* NULL if there was an error in performing the request, otherwise it will
* return the reply. In a non-blocking context, it is identical to calling
* only redisAppendCommand and will always return NULL. */
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
void *redisvCommand(redisContext *c, const char *format, va_list ap);
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 3)))
+#endif
void *redisCommand(redisContext *c, const char *format, ...);
void *redisCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
sds sdscpylen(sds s, const char *t, size_t len);
sds sdscpy(sds s, const char *t);
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
sds sdscatvprintf(sds s, const char *fmt, va_list ap);
#ifdef __GNUC__
sds sdscatprintf(sds s, const char *fmt, ...)
struct rdns_plugin *curve_plugin;
struct rdns_fake_reply *fake_elts;
+#ifdef __GNUC__
+ __attribute__((format(printf, 4, 0)))
+#endif
rdns_log_function logger;
void *log_data;
enum rdns_log_level log_level;
#include <stdarg.h>
#include "dns_private.h"
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 0)))
+#endif
void rdns_logger_internal (void *log_data, enum rdns_log_level level,
const char *function, const char *format,
va_list args);
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 5)))
+#endif
void rdns_logger_helper (struct rdns_resolver *resolver,
enum rdns_log_level level,
const char *function, const char *format, ...);
type = req->requested_names[i].type;
if (queries > 1) {
if (!rdns_add_rr (req, cur_name, clen, type, &comp)) {
- rdns_err ("cannot add rr", cur_name);
+ rdns_err ("cannot add rr");
REF_RELEASE (req);
rnds_compression_free (comp);
return NULL;
}
} else {
if (!rdns_add_rr (req, cur_name, clen, type, NULL)) {
- rdns_err ("cannot add rr", cur_name);
+ rdns_err ("cannot add rr");
REF_RELEASE (req);
rnds_compression_free (comp);
return NULL;
HASH_ADD (hh, resolver->fake_elts, key, sizeof (*srch) + len, fake_rep);
}
-}
\ No newline at end of file
+}
*
* \param fmt - printf style format.
*/
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 3)))
+#endif
REPLXX_IMPEXP int replxx_print( Replxx*, char const* fmt, ... );
/*! \brief Schedule an emulated key press event.
*
* \param fmt - printf style format.
*/
+#ifdef __GNUC__
+ __attribute__((format(printf, 2, 3)))
+#endif
void print( char const* fmt, ... );
/*! \brief Schedule an emulated key press event.
#define utstring_body(s) ((s)->d)
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
_UNUSED_ static void utstring_printf_va(UT_string *s, const char *fmt, va_list ap) {
int n;
va_list cp;
}
}
+// the `b` conversion type character is unknown to gcc
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat"
+#pragma GCC diagnostic ignored "-Wformat-extra-args"
+#endif
static rspamd_fstring_t *
rspamd_redis_tokens_to_query (struct rspamd_task *task,
struct redis_stat_runtime *rt,
return out;
}
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
static void
rspamd_redis_store_stat_signature (struct rspamd_task *task,