On Tue, 2015-09-15 at 14:21 +0200, Manuel López-Ibáñez wrote:
> On 15/09/15 10:32, Mark Wielaard wrote:
> > On Mon, 2015-09-14 at 21:37 -0600, Martin Sebor wrote:
> > Although I now notice they differ on the placement of the carrot.
> > Maybe the location passed into the warning is not correct/idea
On 09/15/2015 02:32 AM, Mark Wielaard wrote:
On Mon, 2015-09-14 at 21:37 -0600, Martin Sebor wrote:
+void foo(void *bar) __attribute__((nonnull(1)));
+
+void foo(void *bar) { if (!bar) abort(); } /* { dg-warning "null" "argument ‘bar’
compared to NULL" } */
This looks like a very useful enhan
On 15/09/15 10:32, Mark Wielaard wrote:
On Mon, 2015-09-14 at 21:37 -0600, Martin Sebor wrote:
Although I now notice they differ on the placement of the carrot.
Maybe the location passed into the warning is not correct/ideal?
The caret is placed at the location given by expand_location(loc), wi
On Mon, 2015-09-14 at 21:37 -0600, Martin Sebor wrote:
> > +void foo(void *bar) __attribute__((nonnull(1)));
> > +
> > +void foo(void *bar) { if (!bar) abort(); } /* { dg-warning "null"
> > "argument ‘bar’ compared to NULL" } */
>
> This looks like a very useful enhancement. Since the change is l
+void foo(void *bar) __attribute__((nonnull(1)));
+
+void foo(void *bar) { if (!bar) abort(); } /* { dg-warning "null" "argument ‘bar’
compared to NULL" } */
This looks like a very useful enhancement. Since the change is limited
to build_binary_op in the two front ends I wonder if the warning a
On 09/09/2015 04:33 PM, Mark Wielaard wrote:
On Thu, 2015-09-10 at 00:03 +0200, Jakub Jelinek wrote:
On Wed, Sep 09, 2015 at 04:01:07PM -0600, Jeff Law wrote:
* gcc.dg/nonnull-4.c: New test.
* g++.dg/warn/nonnull3.C: Likewise.
If the tests are the same, perhaps stick just one
. bootstrap/regression test still running.
Updated patch attached.
Thanks,
Mark
From d8d71393c2fde83769d00c2da766a2fa7955ecbb Mon Sep 17 00:00:00 2001
From: Mark Wielaard
Date: Wed, 9 Sep 2015 23:26:54 +0200
Subject: [PATCH] Warn when comparing nonnull arguments to NULL in a function.
MIME-Ve
On Wed, Sep 09, 2015 at 04:01:07PM -0600, Jeff Law wrote:
> >* gcc.dg/nonnull-4.c: New test.
> >* g++.dg/warn/nonnull3.C: Likewise.
If the tests are the same, perhaps stick just one test into
c-c++-common/nonnull-1.c instead? Also, all the "cp1 compared to NULL"
strings mention cp
On 09/09/2015 03:44 PM, Mark Wielaard wrote:
The following found 14 bugs in my code base. I think it is useful to
warn about such usage since they are bugsr. If the argument is marked
as nonnull then passing in a NULL argument will produce bad results
even if the code checks against NULL.
GCC mi
The following found 14 bugs in my code base. I think it is useful to
warn about such usage since they are bugsr. If the argument is marked
as nonnull then passing in a NULL argument will produce bad results
even if the code checks against NULL.
GCC might optimize such checks away so warn the user
10 matches
Mail list logo