Skip to content

Commit

Permalink
mingw: fix format string warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjulien committed Nov 4, 2020
1 parent 606750f commit 0eb692e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/detect-engine-analyzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,7 @@ typedef struct RuleAnalyzer {
JsonBuilder *js_notes;
} RuleAnalyzer;

static void __attribute__ ((format (printf, 2, 3)))
AnalyzerNote(RuleAnalyzer *ctx, char *fmt, ...)
static void ATTR_FMT_PRINTF(2, 3) AnalyzerNote(RuleAnalyzer *ctx, char *fmt, ...)
{
va_list ap;
char str[1024];
Expand All @@ -576,8 +575,7 @@ AnalyzerNote(RuleAnalyzer *ctx, char *fmt, ...)
jb_append_string(ctx->js_notes, str);
}

static void __attribute__ ((format (printf, 2, 3)))
AnalyzerWarning(RuleAnalyzer *ctx, char *fmt, ...)
static void ATTR_FMT_PRINTF(2, 3) AnalyzerWarning(RuleAnalyzer *ctx, char *fmt, ...)
{
va_list ap;
char str[1024];
Expand Down
4 changes: 3 additions & 1 deletion src/suricata-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ typedef unsigned char u_char

#define WARN_UNUSED __attribute__((warn_unused_result))

#if defined(__GNUC__)
#if defined(__MINGW32__)
#define ATTR_FMT_PRINTF(x, y) __attribute__((format(__MINGW_PRINTF_FORMAT, (x), (y))))
#elif defined(__GNUC__)
#define ATTR_FMT_PRINTF(x, y) __attribute__((format(printf, (x), (y))))
#else
#define ATTR_FMT_PRINTF(x, y)
Expand Down

0 comments on commit 0eb692e

Please sign in to comment.