From 3031d571ef8751d45161e50ba35331c91d4a8284 Mon Sep 17 00:00:00 2001 From: Daniel Foster Date: Sat, 23 Nov 2024 17:58:58 +1000 Subject: [PATCH] lib: use __attribute__((format)) see HEAD~2 for details --- lib/status.c | 1 + lib/vanilla.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/status.c b/lib/status.c index f63bc07..e2efdc9 100644 --- a/lib/status.c +++ b/lib/status.c @@ -19,6 +19,7 @@ void print_status(int errno) vanilla_log("%s", VANILLA_STATUS_STRINGS[-errno]); } +__attribute__((format(printf, 1, 2))) void print_info(const char *errstr, ...) { va_list args; diff --git a/lib/vanilla.c b/lib/vanilla.c index d0d676a..159a5dd 100644 --- a/lib/vanilla.c +++ b/lib/vanilla.c @@ -113,12 +113,15 @@ void vanilla_set_touch(int x, int y) set_touch_state(x, y); } +__attribute__((format(printf, 1, 0))) void default_logger(const char *format, va_list args) { vprintf(format, args); } void (*custom_logger)(const char *, va_list) = default_logger; + +__attribute__((format(printf, 1, 2))) void vanilla_log(const char *format, ...) { va_list va; @@ -132,6 +135,7 @@ void vanilla_log(const char *format, ...) va_end(va); } +__attribute__((format(printf, 1, 2))) void vanilla_log_no_newline(const char *format, ...) { va_list va; @@ -142,6 +146,7 @@ void vanilla_log_no_newline(const char *format, ...) va_end(va); } +__attribute__((format(printf, 1, 0))) void vanilla_log_no_newline_va(const char *format, va_list args) { if (custom_logger) {