From 3decf54dbc9e7898a980086dc34a1bfbb52b16ac Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 27 Sep 2021 20:49:09 -0700 Subject: [PATCH] Mark all vlog functions with printf attributes This ensures that compiler warnings about format strings will apply to all calls of these functions as well. --- desktop_version/src/Vlogging.c | 8 ++++---- desktop_version/src/Vlogging.h | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/desktop_version/src/Vlogging.c b/desktop_version/src/Vlogging.c index 33f37977..d0f6ed63 100644 --- a/desktop_version/src/Vlogging.c +++ b/desktop_version/src/Vlogging.c @@ -83,7 +83,7 @@ void vlog_toggle_error(const int enable_error) error_enabled = enable_error; } -int vlog_debug(const char* text, ...) +SDL_PRINTF_VARARG_FUNC(1) int vlog_debug(const char* text, ...) { va_list list; int retval; @@ -107,7 +107,7 @@ int vlog_debug(const char* text, ...) return retval; } -int vlog_info(const char* text, ...) +SDL_PRINTF_VARARG_FUNC(1) int vlog_info(const char* text, ...) { va_list list; int retval; @@ -131,7 +131,7 @@ int vlog_info(const char* text, ...) return retval; } -int vlog_warn(const char* text, ...) +SDL_PRINTF_VARARG_FUNC(1) int vlog_warn(const char* text, ...) { va_list list; int retval; @@ -155,7 +155,7 @@ int vlog_warn(const char* text, ...) return retval; } -int vlog_error(const char* text, ...) +SDL_PRINTF_VARARG_FUNC(1) int vlog_error(const char* text, ...) { va_list list; int retval; diff --git a/desktop_version/src/Vlogging.h b/desktop_version/src/Vlogging.h index 7d8cbef2..6135d598 100644 --- a/desktop_version/src/Vlogging.h +++ b/desktop_version/src/Vlogging.h @@ -6,6 +6,8 @@ extern "C" { #endif +#include + void vlog_init(void); void vlog_toggle_output(int enable_output); @@ -20,13 +22,13 @@ void vlog_toggle_warn(int enable_warn); void vlog_toggle_error(int enable_error); -int vlog_debug(const char* text, ...); +SDL_PRINTF_VARARG_FUNC(1) int vlog_debug(const char* text, ...); -int vlog_info(const char* text, ...); +SDL_PRINTF_VARARG_FUNC(1) int vlog_info(const char* text, ...); -int vlog_warn(const char* text, ...); +SDL_PRINTF_VARARG_FUNC(1) int vlog_warn(const char* text, ...); -int vlog_error(const char* text, ...); +SDL_PRINTF_VARARG_FUNC(1) int vlog_error(const char* text, ...); #ifdef __cplusplus } /* extern "C" */