Re: New attribute: returns_nonnull

2013-10-11 Thread Marc Glisse
On Mon, 7 Oct 2013, Marc Glisse wrote: 2013-10-08 Marc Glisse [...] gcc/ * doc/extend.texi (returns_nonnull): New function attribute. By the way, I'll commit this obvious doc fix next chance I get: 2013-10-12 Marc Glisse * doc/extend.texi (returns_nonnull): Remove arg

Re: New attribute: returns_nonnull

2013-10-10 Thread Jeff Law
On 10/10/13 08:17, Tom Tromey wrote: In addition, other optimization passes in GCC use this flag to control global dataflow analyses that eliminate useless checks for null pointers; these assume that if a pointer is checked after it has already been dereferenced, i

Re: New attribute: returns_nonnull

2013-10-10 Thread Richard Biener
On Thu, Oct 10, 2013 at 4:17 PM, Tom Tromey wrote: > Marc> + if (flag_delete_null_pointer_checks > Marc> + && lookup_attribute ("returns_nonnull", > Marc> + TYPE_ATTRIBUTES (TREE_TYPE (fndecl > Marc> + return true; > > I wired all this up to gcj, but it tripped over the > flag_d

Re: New attribute: returns_nonnull

2013-10-10 Thread Tom Tromey
Marc> + if (flag_delete_null_pointer_checks Marc> + && lookup_attribute ("returns_nonnull", Marc> + TYPE_ATTRIBUTES (TREE_TYPE (fndecl Marc> + return true; I wired all this up to gcj, but it tripped over the flag_delete_null_pointer_checks test, because java/lang.c sets it: /

Re: New attribute: returns_nonnull

2013-10-08 Thread Jeff Law
On 10/08/13 13:41, Marc Glisse wrote: Glad to see you checked this and have a test for it. I am slowly starting to understand how reviewers think ;-) That's a huge part of the submission process. Once you know what folks are looking for the path to approval gets appropriately short :-)

Re: New attribute: returns_nonnull

2013-10-08 Thread Marc Glisse
On Tue, 8 Oct 2013, Jeff Law wrote: On 10/07/13 08:17, Marc Glisse wrote: Hello, this patch adds an attribute to let the compiler know that a function never returns NULL. I saw some ECF_* flags, but the attribute seems sufficient. I considered using nonnull(0), but then it would have been conf

Re: New attribute: returns_nonnull

2013-10-08 Thread Jeff Law
On 10/07/13 08:17, Marc Glisse wrote: Hello, this patch adds an attribute to let the compiler know that a function never returns NULL. I saw some ECF_* flags, but the attribute seems sufficient. I considered using nonnull(0), but then it would have been confusing that the version of nonnull with

Re: New attribute: returns_nonnull

2013-10-07 Thread David Malcolm
On Mon, 2013-10-07 at 16:17 +0200, Marc Glisse wrote: > Hello, > > this patch adds an attribute to let the compiler know that a function > never returns NULL. I saw some ECF_* flags, but the attribute seems > sufficient. I considered using nonnull(0), but then it would have been > confusing tha