Related to rhbz#951520.
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
lib/strbuf.h | 5 +++--
lib/utils.h | 4 +++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/strbuf.h b/lib/strbuf.h
index 9a5091f..feba3b0 100644
--- a/lib/strbuf.h
+++ b/lib/strbuf.h
@@ -21,6 +21,7 @@
#define BTPARSER_STRBUF_H
#include <stdarg.h>
+#include "utils.h"
#ifdef __cplusplus
extern "C" {
@@ -116,7 +117,7 @@ btp_strbuf_prepend_str(struct btp_strbuf *strbuf,
*/
struct btp_strbuf *
btp_strbuf_append_strf(struct btp_strbuf *strbuf,
- const char *format, ...);
+ const char *format, ...) __btp_printf(2, 3);
/**
* Same as btp_strbuf_append_strf except that va_list is used instead of
@@ -133,7 +134,7 @@ btp_strbuf_append_strfv(struct btp_strbuf *strbuf,
*/
struct btp_strbuf *
btp_strbuf_prepend_strf(struct btp_strbuf *strbuf,
- const char *format, ...);
+ const char *format, ...) __btp_printf(2, 3);
/**
* Same as btp_strbuf_prepend_strf except that va_list is used instead of
diff --git a/lib/utils.h b/lib/utils.h
index 5c9b6a5..98a1d6f 100644
--- a/lib/utils.h
+++ b/lib/utils.h
@@ -37,6 +37,8 @@ extern "C" {
#define BTP_digit "0123456789"
#define BTP_alnum BTP_alpha BTP_digit
+#define __btp_printf(x, y) __attribute__((format(printf, (x), (y))))
+
/**
* Debugging output to stdout while parsing.
* Default value is false.
@@ -72,7 +74,7 @@ btp_vasprintf(const char *format, va_list p);
* Never returns NULL.
*/
char *
-btp_asprintf(const char *format, ...);
+btp_asprintf(const char *format, ...) __btp_printf(1, 2);
/**
* Never returns NULL.
--
1.7.11.7