diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2021-06-24 14:30:40 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2021-06-25 14:36:11 +0200 |
commit | e0cab1937a05d5c9740adf10613aa183eee7d99c (patch) | |
tree | 268c30dbc0fdbae28d441e814871633d724e1e4e /include/fstream.h | |
parent | 9a67a12f797dd1d167adc75425c822d86ced364e (diff) |
libfstream: Add printf format specifier attribute
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/fstream.h')
-rw-r--r-- | include/fstream.h | 10 |
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 |