From e1ef945abd80f8f748b336ac06fd302892898f95 Mon Sep 17 00:00:00 2001 From: Fox <67861857+FluffyFoxUwU@users.noreply.github.com> Date: Sat, 22 Jul 2023 10:55:34 +0700 Subject: [PATCH] Allow compiler to help check Allow some compiler (GCC and Clang mainly) to check the format inputs for errors at compile time like what it does for `printf` and its family --- buffer.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buffer.h b/buffer.h index 5cecbb0..47c2f2b 100644 --- a/buffer.h +++ b/buffer.h @@ -60,6 +60,9 @@ buffer_prepend(buffer_t *self, char *str); int buffer_append(buffer_t *self, const char *str); +#ifdef __GNUC__ +__attribute__((format(printf, 2, 3))) +#endif int buffer_appendf(buffer_t *self, const char *format, ...);