[MinGW-Notify] [mingw] #39224: GCC-7.3 and later apply wrong -Wformat attributes for snprintf() and vsnprintf() functions

アーカイブの一覧に戻る
MinGW Notification List mingw****@lists*****
Fri Jul 5 19:18:09 JST 2019


#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-07-05 11:18

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-07-05 11:18 Updated by: keith
 * Status Update from Open to Closed

 * Resolution Update from None to Fixed


Comment:

The -Wformat mishandling of "%hhn" is corrected from release 4-mingw32 of
GCC-8.2.0 onwards; at present, I do not plan to back-port to GCC-7.3.0 .

The inappropriate effect of interaction with GCC's built-in snprintf() and
vsnprintf() prototypes is corrected by commit #21718ad; this will be included
in the next mingwrt/w32api release.



---------------------------------------------------------------------
Ticket Status:

      Reporter: keith
         Owner: keith
          Type: Issues
        Status: Closed
      Priority: 5 - Medium
     MileStone: (None)
     Component: WSL
      Severity: 5 - Medium
    Resolution: Fixed
---------------------------------------------------------------------

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



More information about the MinGW-Notify mailing list
アーカイブの一覧に戻る