#39224: GCC-7.3 and later apply wrong -Wformat attributes for snprintf() and vsnprintf() functions Open Date: 2019-05-06 15:51 Last Update: 2019-05-06 15:51 URL for this Ticket: https://osdn.net//projects/mingw/ticket/39224 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39224 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2019-05-06 15:51 Updated by: keith * New Ticket "GCC-7.3 and later apply wrong -Wformat attributes for snprintf() and vsnprintf() functions" created --------------------------------------------------------------------- Ticket Status: Reporter: keith Owner: keith Type: Issues Status: Open [Owner assigned] Priority: 5 - Medium MileStone: (None) Component: WSL Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: As originally reported by Eli Zaretskii, in this mingw-users mail posting, use of ISO-C99 standard format specifications, such as "%02hhx", (which is not understood by Microsoft's MSVCRT.DLL family of printf() functions), in calls to snprintf() may result in unexpected compile-time warning diagnostics, when compiled with any warning option, such as -Wall, which implicitly (or even explicitly) enables -Wformat. The issue appears to be caused by GCC's use of an internal prototype, for snprintf(), which seems to arbitrarily assume Microsoft's -Wformat semantics, (even though Microsoft have never provided a snprintf() implementation, in any version of the system-supplied MSVCRT.DLL runtime library, on which every MinGW-GCC compiler build is dependent). The issue does not arise when calls to snprintf() are replaced by its equivalent __mingw_snprintf(), (which is explicitly declared as exhibiting MinGW's -Wformat semantics); nor does it arise when GCC's internal prototype is overridden, (by use of the -fno-builtin-snprintf option), and thus the <stdio.h> prototype, (which also explicitly exhibits MinGW's -Wformat semantics), becomes applicable. It is anticipated that the vsnprintf() implementation will be similarly affected. -- Ticket information of MinGW - Minimalist GNU for Windows project MinGW - Minimalist GNU for Windows Project is hosted on OSDN Project URL: https://osdn.net/projects/mingw/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/mingw/ticket/39224 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39224