This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to add "nonnull" attribute to various builtins


"Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:

> This patch adds the "nonnull" attribute to most builtin functions
> taking pointer parameters.  I'm not a language guru, but I believe
> none of these should be expected to accept NULL pointers.
> 
> There were a few internal builtins of which I wasn't sure about
> whether they should accept NULL, namely __builtin_return,
> __builtin_setjmp, __builtin_longjmp and __builtin_eh_return.  If we
> decide they should also use "nonnull", I can add that in a followup
> patch.

__builtin_setjmp & __builtin_longjmp can't accept NULL, so you could
add those.

> Tested on sparc-sun-solaris2.7, no regressions and the new test
> passes.
> 
> Ok for mainline?

No, historically bzero(), bcopy(), and bcmp() do nothing at all if
their argument is zero-size, so it's legitimate to pass them NULL pointers.
(This is not true of memcpy etc.).

-- 
- Geoffrey Keating <geoffk@geoffk.org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]