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] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])


On Fri, Apr 28, 2017 at 1:05 PM, Bernd Edlinger
<bernd.edlinger@hotmail.de> wrote:
> On 04/28/17 17:29, Martin Sebor wrote:
>> On 04/28/2017 08:12 AM, Bernd Edlinger wrote:
>>>
>>> Do you want me to change the %qT format strings to %T ?
>>
>> Yes, with the surrounding %< and %> the nested directives should
>> use the unquoted forms, otherwise the printer would end up quoting
>> both the whole expression and the type operand.
>>
>> FWIW, to help avoid this mistake, I think this might be something
>> for GCC -Wformat to warn on and the pretty-printer to detect (and
>> ICE on).
>>
>
> Ah, now I understand.  That's pretty advanced.
>
> Here is the modified patch with correct quoting of the expression.
>
> Bootstrap and reg-testing on x86_64-pc-linux-gnu.

> * cp-gimplify.c (cp_fold): Implement the -Wsizeof_pointer_div warning.

I think this warning belongs in cp_build_binary_op rather than cp_fold.

Jason


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