MT#57281 Mark medredis_command() with printf attribute

Add macros to handle attributes transparently and make their usage
easier.

Change-Id: I0e1025bf827736e5a09e477d8fb03dee8e33460c
mr11.5
Guillem Jover 2 years ago
parent 5f6139aace
commit 7b310f25fc

@ -13,6 +13,20 @@
#include <inttypes.h>
#include <json.h>
/* Compiler support. */
/* Supported since gcc 5.1.0 and clang 2.9.0. */
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
#if __has_attribute(__format__)
#define MEDIATOR_ATTR_FORMAT(type, fmt, args) __attribute__((__format__(type, fmt, args)))
#define MEDIATOR_ATTR_PRINTF(fmt, args) MEDIATOR_ATTR_FORMAT(__printf__, fmt, args)
#else
#define MEDIATOR_ATTR_FORMAT(type, fmt, args)
#define MEDIATOR_ATTR_PRINTF(fmt, args)
#endif
#define MEDIATOR_DEFAULT_INTERVAL 10

@ -136,6 +136,7 @@ err:
}
/**********************************************************************/
MEDIATOR_ATTR_PRINTF(1, 2)
static redisReply *medredis_command(const char* cmd, ...) {
va_list args;

Loading…
Cancel
Save