From 9b0d73504066ee83188fb5174573c52b639863c0 Mon Sep 17 00:00:00 2001 From: Ed Catmur Date: Fri, 29 Oct 2021 11:59:03 +0100 Subject: [PATCH] Add __attribute__((__format__)) to snprintf This attribute will check format string bugs and is required for clean compile if -Wformat-nonliteral is enabled. --- include/boost/system/detail/snprintf.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/boost/system/detail/snprintf.hpp b/include/boost/system/detail/snprintf.hpp index d077102..a8b9c97 100644 --- a/include/boost/system/detail/snprintf.hpp +++ b/include/boost/system/detail/snprintf.hpp @@ -49,6 +49,9 @@ inline void snprintf( char * buffer, std::size_t len, char const * format, ... ) #else +#if __GNUC__ >= 3 +__attribute__((__format__ (__printf__, 3, 4))) +#endif inline void snprintf( char * buffer, std::size_t len, char const * format, ... ) { va_list args;