This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Set the scalar_identity_flag for the %Id and %Iu specs
2010/2/5 Ozkan Sezer <email@example.com>:
> On Fri, Feb 5, 2010 at 6:27 PM, Kai Tietz <firstname.lastname@example.org> wrote:
>> 2010/2/5 Ozkan Sezer <email@example.com>:
>>> On Tue, Feb 2, 2010 at 4:13 PM, Ozkan Sezer <firstname.lastname@example.org> wrote:
>>>> The M$ printf type specs %Id and %Iu are for ptrdiff_t and size_t whose
>>>> widths change according to word size:
>>>> 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.)
>> I agree that it is indeed more consistent too make all win32 I (big-i)
>> formatters dependent to scalar-width. The only issue I see here is,
>> that the I format width specifier has indeed an different behavior
>> from the gnu 'z' one. But as in win32 32-bit world the type of size_t
>> varies (between 'unsigned long int' and 'unsigned int'), it makes here
>> sense to depend only on scalar-width. It also mimics VC behavior
>> Patch is ok for apply.
>> | ?(\_/) This is Bunny. Copy and paste
>> | (='.'=) Bunny into your signature to help
>> | (")_(") him gain world domination
> Feel free to apply. Thanks.
Applied at revision 156523 & 156524.
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination