Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-05-03 Thread Jason Merrill
On Tue, May 2, 2017 at 9:26 AM, Bernd Edlinger wrote: > On 05/01/17 17:54, Jason Merrill wrote: >> On Fri, Apr 28, 2017 at 1:05 PM, Bernd Edlinger >> 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 f

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-05-02 Thread Bernd Edlinger
On 05/01/17 17:54, Jason Merrill wrote: > On Fri, Apr 28, 2017 at 1:05 PM, Bernd Edlinger > 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

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-05-01 Thread Jason Merrill
On Fri, Apr 28, 2017 at 1:05 PM, Bernd Edlinger 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 unquote

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-04-28 Thread Bernd Edlinger
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 w

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-04-28 Thread Martin Sebor
On 04/28/2017 08:12 AM, Bernd Edlinger wrote: On 04/28/17 00:52, Martin Sebor wrote: I suggest avoiding "element size" because the pointed-to argument need not be an array. Mentioning the types should help users better understand the problem (especially in C++ where types are often obscured by

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-04-28 Thread Bernd Edlinger
On 04/28/17 00:52, Martin Sebor wrote: >>> I suggest avoiding "element size" because the pointed-to argument >>> need not be an array. Mentioning the types should help users better >>> understand the problem (especially in C++ where types are often >>> obscured by layers of templates). It might a

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-04-27 Thread Martin Sebor
I suggest avoiding "element size" because the pointed-to argument need not be an array. Mentioning the types should help users better understand the problem (especially in C++ where types are often obscured by layers of templates). It might also be a nice touch to add a note pointing to the decl

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-04-21 Thread Bernd Edlinger
On 04/22/17 01:50, Martin Sebor wrote: > On 04/20/2017 02:35 PM, Bernd Edlinger wrote: >> Hi! >> >> >> This implements a new -Wall enabled warning for a rather common, but >> completely wrong way to compute an array size by dividing the >> sizeof(pointer) / sizeof(pointer[0]) or sizeof(*pointer). >

Re: [PATCH] Implement a warning for bogus sizeof(pointer) / sizeof(pointer[0])

2017-04-21 Thread Martin Sebor
On 04/20/2017 02:35 PM, Bernd Edlinger wrote: Hi! This implements a new -Wall enabled warning for a rather common, but completely wrong way to compute an array size by dividing the sizeof(pointer) / sizeof(pointer[0]) or sizeof(*pointer). It is often hard to find this kind of error by simple c