This is the mail archive of the
mailing list for the GCC project.
Re: Patch to add "nonnull" attribute to various builtins
- From: Geoff Keating <geoffk at geoffk dot org>
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 03 May 2003 11:12:19 -0700
- Subject: Re: Patch to add "nonnull" attribute to various builtins
- References: <200305022126.RAA12158@caip.rutgers.edu>
"Kaveh R. Ghazi" <email@example.com> 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
__builtin_setjmp & __builtin_longjmp can't accept NULL, so you could
> Tested on sparc-sun-solaris2.7, no regressions and the new test
> 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 <firstname.lastname@example.org>