This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Set the scalar_identity_flag for the %Id and %Iu specs


Hi:

The M$ printf type specs %Id and %Iu are for ptrdiff_t and size_t whose
widths change according to word size:
http://msdn.microsoft.com/en-us/library/tcxf1dw6(VS.71).aspx
Although msformat-c.c sets the scalar_identity_flag for %I32 and %I64,
it does not so for %I itself, so my testcase does output warnings with
i686-w64-mingw32 :

$ i686-w64-mingw32-gcc -std=iso9899:1999 -pedantic -Wformat
-Wno-pedantic-ms-format -c ms-format3.c
ms-format3.c: In function 'foo':
ms-format3.c:15: warning: format '%Id' expects type 'signed size_t',
but argument 2 has type 'LONG_PTR'
ms-format3.c:16: warning: format '%Iu' expects type 'size_t', but
argument 2 has type 'ULONG_PTR'
ms-format3.c:17: warning: format '%Iu' expects type 'size_t', but
argument 2 has type 'DWORD_PTR'
ms-format3.c:19: warning: format '%Iu' expects type 'size_t', but
argument 2 has type 'SIZE_T'

The attached one-liner patch fixes that situation. Please consider for
applying.  (Changelog at top of the patch.  I don't have write access.)

--
Ozkan

Attachment: ms-format3.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]