Re: nonnull, -Wnonnull, and do/while

2016-02-17 Thread Mark Wielaard
On Thu, 2016-02-18 at 00:21 +0100, Stefan Sobernig wrote: > Am I supposed to file this as a bug report then, for the records? Or > will it be taken care of ... Jakub already did all the work. Bug filed, patch written, reviewed and committed. Plus followup fixup. He is amazing: https://gcc.gnu.org/

Re: nonnull, -Wnonnull, and do/while

2016-02-17 Thread Stefan Sobernig
> On Tue, Feb 16, 2016 at 11:04:38AM +0100, Marek Polacek wrote: >> On Tue, Feb 16, 2016 at 10:43:08AM +0100, Stefan Sobernig wrote: >>> Under a recent gcc 6 [*], we run into -Wnonnull warnings using the >>> nonnull attribute: >> >> Yes, this warning has been enhanced for GCC 6. >> >>> test.c: In

Re: nonnull, -Wnonnull, and do/while

2016-02-16 Thread Marek Polacek
On Tue, Feb 16, 2016 at 11:11:21AM +0100, Jakub Jelinek wrote: > On Tue, Feb 16, 2016 at 11:04:38AM +0100, Marek Polacek wrote: > > On Tue, Feb 16, 2016 at 10:43:08AM +0100, Stefan Sobernig wrote: > > > Under a recent gcc 6 [*], we run into -Wnonnull warnings using the > > > nonnull attribute: > >

Re: nonnull, -Wnonnull, and do/while

2016-02-16 Thread Alexander Monakov
On Tue, 16 Feb 2016, Marek Polacek wrote: > Well, it's just that "s" has the nonnull attribute so the compiler thinks it > should never be null in which case comparing it to null should be redundant. > Doesn't seem like a false positive to me, but maybe someone else feels > otherwise. Please look

Re: nonnull, -Wnonnull, and do/while

2016-02-16 Thread Jakub Jelinek
On Tue, Feb 16, 2016 at 11:04:38AM +0100, Marek Polacek wrote: > On Tue, Feb 16, 2016 at 10:43:08AM +0100, Stefan Sobernig wrote: > > Under a recent gcc 6 [*], we run into -Wnonnull warnings using the > > nonnull attribute: > > Yes, this warning has been enhanced for GCC 6. > > > test.c: In func

Re: nonnull, -Wnonnull, and do/while

2016-02-16 Thread Marek Polacek
On Tue, Feb 16, 2016 at 10:43:08AM +0100, Stefan Sobernig wrote: > Under a recent gcc 6 [*], we run into -Wnonnull warnings using the > nonnull attribute: Yes, this warning has been enhanced for GCC 6. > test.c: In function 'f': > test.c:16:14: warning: nonnull argument 's' compared to NULL [-Wn

nonnull, -Wnonnull, and do/while

2016-02-16 Thread Stefan Sobernig
Hi We have a number of do/while loops with NULL checks in their exit conditions: #include static void f(const char *s) __attribute__((nonnull(1))); int main(void) { const char *p = "X"; f(p); } static void f(const char *s) { do { printf("%s\n",s); s = NULL; } while (s != NULL)