https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39438
R. Diez <rdiez-2006 at rd10 dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rdiez-2006 at rd10 dot de --- Comment #14 from R. Diez <rdiez-2006 at rd10 dot de> --- This is another code example: -----8<-----8<-----8<----- // Compile with -Wformat -Wformat-nonliteral #include <time.h> // For strftime formats, the third parameter in "__attribute__ format" // below is required to be zero. __attribute__ ((format (strftime, 3, 0))) size_t strftime_e ( char * const buffer, const size_t buffermax, const char * const formatstr, const tm * const tm ) { // This is the work-around to suppress the warning: // #pragma GCC diagnostic push // #pragma GCC diagnostic ignored "-Wformat-nonliteral" return strftime( buffer, buffermax, formatstr, tm ); // #pragma GCC diagnostic pop } -----8<-----8<-----8<----- It shows a work-around to suppress the warning, and is available here to play with: https://godbolt.org/z/EYzE3xMYc