public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: Jason Merrill <jason@redhat.com>
Cc: Martin Sebor <msebor@gmail.com>,
	"gcc-patches@gcc.gnu.org"	<gcc-patches@gcc.gnu.org>,
	Joseph Myers <joseph@codesourcery.com>, Jeff Law	<law@redhat.com>,
	Richard Biener <rguenther@suse.de>,
	Jakub Jelinek	<jakub@redhat.com>,
	Marek Polacek <polacek@redhat.com>
Subject: [PING] [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])
Date: Fri, 12 May 2017 16:56:00 -0000	[thread overview]
Message-ID: <AM4PR0701MB2162D9535A46CE2521E1E0E0E4E20@AM4PR0701MB2162.eurprd07.prod.outlook.com> (raw)
In-Reply-To: <CADzB+2k7Uy2idwkaE8nxnWX-xj_LjXdm2P3Rns_Ubwft6Dgi0g@mail.gmail.com>

Ping for the C changes.

Thanks
Bernd.

On 05/03/17 15:14, Jason Merrill wrote:
> On Tue, May 2, 2017 at 9:26 AM, Bernd Edlinger
> <bernd.edlinger@hotmail.de> wrote:
>> On 05/01/17 17:54, Jason Merrill wrote:
>>> 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.
>>>
>>
>> Done, as suggested.
>
> The pattern in that function is to treat all *_DIV_EXPR the same; I
> don't think we need to break that pattern with this patch.  So please
> move the new code after the other DIV case labels.  With that the C++
> changes are OK.
>
> Jason
>


On 05/03/17 15:14, Jason Merrill wrote:
 > On Tue, May 2, 2017 at 9:26 AM, Bernd Edlinger
 > <bernd.edlinger@hotmail.de> wrote:
 >> On 05/01/17 17:54, Jason Merrill wrote:
 >>> 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.
 >>>
 >>
 >> Done, as suggested.
 >
 > The pattern in that function is to treat all *_DIV_EXPR the same; I
 > don't think we need to break that pattern with this patch.  So please
 > move the new code after the other DIV case labels.  With that the C++
 > changes are OK.
 >
 > Jason
 >

  reply	other threads:[~2017-05-12 16:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 21:33 Bernd Edlinger
2017-04-22  6:51 ` Martin Sebor
2017-04-22 17:50   ` Bernd Edlinger
2017-04-28  3:23     ` Martin Sebor
2017-04-28 14:42       ` Bernd Edlinger
2017-04-28 16:27         ` Martin Sebor
2017-04-28 17:20           ` Bernd Edlinger
2017-05-01 15:54             ` Jason Merrill
2017-05-02 13:38               ` Bernd Edlinger
2017-05-03 13:15                 ` Jason Merrill
2017-05-12 16:56                   ` Bernd Edlinger [this message]
2017-06-01 16:03                     ` [PING**2] " Bernd Edlinger
2017-06-01 22:09                       ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM4PR0701MB2162D9535A46CE2521E1E0E0E4E20@AM4PR0701MB2162.eurprd07.prod.outlook.com \
    --to=bernd.edlinger@hotmail.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=law@redhat.com \
    --cc=msebor@gmail.com \
    --cc=polacek@redhat.com \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).