diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-12-22 16:36:06 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-12-23 19:41:41 +0100 |
| commit | e28459d8836810a1ea057ff2d47f223fb4f110e5 (patch) | |
| tree | fe8587ee43f6e23793457a529416b779e578bc4c | |
| parent | 58001e979af57701e36c58e0b36ea5f79246b012 (diff) | |
| download | vis-e28459d8836810a1ea057ff2d47f223fb4f110e5.tar.gz vis-e28459d8836810a1ea057ff2d47f223fb4f110e5.tar.xz | |
Apply format string attribute to printf style functions
Not strictly C99 conform, but widely supported and easy enough to NOP
for compilers which do not support it. Besides it was already used to
mark certain functions as noreturn.
| -rw-r--r-- | buffer.h | 4 | ||||
| -rw-r--r-- | text.h | 4 | ||||
| -rw-r--r-- | vis.h | 4 |
3 files changed, 6 insertions, 6 deletions
@@ -43,9 +43,9 @@ bool buffer_prepend(Buffer*, const void *data, size_t len); /* prepend NUL-terminated data */ bool buffer_prepend0(Buffer*, const char *data); /* set formatted buffer content, ensures NUL termination on success */ -bool buffer_printf(Buffer*, const char *fmt, ...); +bool buffer_printf(Buffer*, const char *fmt, ...) __attribute__((format(printf, 2, 3))); /* append formatted buffer content, ensures NUL termination on success */ -bool buffer_appendf(Buffer*, const char *fmt, ...); +bool buffer_appendf(Buffer*, const char *fmt, ...) __attribute__((format(printf, 2, 3))); /* return length of a buffer without trailing NUL byte */ size_t buffer_length0(Buffer*); /* return length of a buffer including possible NUL byte */ @@ -40,8 +40,8 @@ typedef struct { Text *text_load(const char *filename); /* file information at time of load or last save */ struct stat text_stat(Text*); -bool text_appendf(Text*, const char *format, ...); -bool text_printf(Text*, size_t pos, const char *format, ...); +bool text_appendf(Text*, const char *format, ...) __attribute__((format(printf, 2, 3))); +bool text_printf(Text*, size_t pos, const char *format, ...) __attribute__((format(printf, 3, 4))); /* inserts a line ending character (depending on file type) */ size_t text_insert_newline(Text*, size_t pos); /* insert `len' bytes starting from `data' at `pos' which has to be @@ -122,7 +122,7 @@ int vis_window_height_get(const Win*); void vis_prompt_show(Vis*, const char *title); /* display a one line message to the user, will be hidden upon keypress */ -void vis_info_show(Vis*, const char *msg, ...); +void vis_info_show(Vis*, const char *msg, ...) __attribute__((format(printf, 2, 3))); void vis_info_hide(Vis*); /* display an arbitrary long message in a special window/file */ @@ -150,7 +150,7 @@ int vis_run(Vis*, int argc, char *argv[]); /* terminate editing session, given status will be the return value of vis_run */ void vis_exit(Vis*, int status); /* emergency exit, print given message, perform minimal ui cleanup and exit process */ -void vis_die(Vis*, const char *msg, ...) __attribute__((noreturn)); +void vis_die(Vis*, const char *msg, ...) __attribute__((noreturn,format(printf, 2, 3))); enum VisMode { VIS_MODE_NORMAL, |
