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]

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


On Fri, Feb 5, 2010 at 6:27 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
> 2010/2/5 Ozkan Sezer <sezeroz@gmail.com>:
>> PING.
>>
>> On Tue, Feb 2, 2010 at 4:13 PM, Ozkan Sezer <sezeroz@gmail.com> wrote:
>>> 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
>>>
>>
>
> 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
> better.
> Patch is ok for apply.
>
> Regards,
> Kai
> --
> | ?(\_/) This is Bunny. Copy and paste
> | (='.'=) Bunny into your signature to help
> | (")_(") him gain world domination
>

Feel free to apply. Thanks.

--
Ozkan


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