summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/fstream.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/fstream.h b/include/fstream.h
index 07ee5a7..0e8905e 100644
--- a/include/fstream.h
+++ b/include/fstream.h
@@ -9,6 +9,13 @@
#include "sqfs/predef.h"
+#if defined(__GNUC__) || defined(__clang__)
+# define PRINTF_ATTRIB(fmt, elipsis) \
+ __attribute__ ((format (printf, fmt, elipsis)))
+#else
+# define PRINTF_ATTRIB(fmt, elipsis)
+#endif
+
/**
* @struct ostream_t
*
@@ -261,7 +268,8 @@ SQFS_INTERNAL const char *ostream_get_filename(ostream_t *strm);
*
* @return The number of characters written on success, -1 on failure.
*/
-SQFS_INTERNAL int ostream_printf(ostream_t *strm, const char *fmt, ...);
+SQFS_INTERNAL int ostream_printf(ostream_t *strm, const char *fmt, ...)
+ PRINTF_ATTRIB(2, 3);
/**
* @brief Read a line of text from an input stream