Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From ef170dda7fbab53682c9bc287dec93fa86130bc9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 9 Sep 2018 21:49:59 -0700 |
| 4 | Subject: [PATCH] add a formatting attribute check |
| 5 | |
| 6 | Tell Clang that parameter is a printf style format using the |
| 7 | attribute flag |
| 8 | |
| 9 | This helps in avoiding below warnings seen with clang |
| 10 | |
| 11 | unarr.c:106:22: error: format string is not a string literal |
| 12 | [-Werror,-Wformat-nonliteral] |
| 13 | | vfprintf(stderr, msg, args); |
| 14 | | ^~~ |
| 15 | |
| 16 | Upstream-Status: Pending |
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 18 | --- |
| 19 | cut-n-paste/unarr/common/unarr.c | 2 +- |
| 20 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 21 | |
| 22 | diff --git a/cut-n-paste/unarr/common/unarr.c b/cut-n-paste/unarr/common/unarr.c |
| 23 | index 97ec92a..9e6e3ad 100644 |
| 24 | --- a/cut-n-paste/unarr/common/unarr.c |
| 25 | +++ b/cut-n-paste/unarr/common/unarr.c |
| 26 | @@ -92,7 +92,7 @@ size_t ar_get_global_comment(ar_archive *ar, void *buffer, size_t count) |
| 27 | return ar->get_comment(ar, buffer, count); |
| 28 | } |
| 29 | |
| 30 | -void ar_log(const char *prefix, const char *file, int line, const char *msg, ...) |
| 31 | +void __attribute__((__format__ (__printf__, 4, 0))) ar_log(const char *prefix, const char *file, int line, const char *msg, ...) |
| 32 | { |
| 33 | va_list args; |
| 34 | va_start(args, msg); |