From 67bb5b25b188badb0b94f497ebb345f8c10b0ada Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 8 Jul 2024 22:32:53 +1000 Subject: [PATCH] Cleanup: add printf function attributes, quiet GCC warnings --- intern/guardedalloc/intern/mallocn_guarded_impl.cc | 3 +++ intern/guardedalloc/intern/mallocn_lockfree_impl.cc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.cc b/intern/guardedalloc/intern/mallocn_guarded_impl.cc index b8a21319de8..ef7bcd22735 100644 --- a/intern/guardedalloc/intern/mallocn_guarded_impl.cc +++ b/intern/guardedalloc/intern/mallocn_guarded_impl.cc @@ -212,6 +212,9 @@ static bool malloc_debug_memset = false; /* implementation */ /* --------------------------------------------------------------------- */ +#ifdef __GNUC__ +__attribute__((format(printf, 1, 0))) +#endif static void print_error(const char *message, va_list str_format_args) { char buf[512]; diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.cc b/intern/guardedalloc/intern/mallocn_lockfree_impl.cc index 694404d8ca1..bda9a52ddde 100644 --- a/intern/guardedalloc/intern/mallocn_lockfree_impl.cc +++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.cc @@ -74,6 +74,9 @@ enum { #define MEMHEAD_IS_FROM_CPP_NEW(memhead) ((memhead)->len & size_t(MEMHEAD_FLAG_FROM_CPP_NEW)) #define MEMHEAD_LEN(memhead) ((memhead)->len & ~size_t(MEMHEAD_FLAG_MASK)) +#ifdef __GNUC__ +__attribute__((format(printf, 1, 0))) +#endif static void print_error(const char *message, va_list str_format_args) { char buf[512];