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 <firstname.lastname@example.org>
> "Kaveh R. Ghazi" <email@example.com> writes:
> > 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.
Ok will do so in a separate patch. Hmm, since setjmp is used in the
implementations of sjlj exceptions, I'm a little unsure as to whether
__builtin_setjmp "throws" in the classic sense or can we add the
"nothrow" attribute to it? (Setjmp currently doesn't have any
attributes.) What about __builtin_longjmp? (Longjmp already has
noreturn and nothrow.)
I ask because the ATTR_NONNULL_1 list in builtin-attrs.def includes
"nothrow" in it so I'd have to create a separate "nonnull"-only attr
list if __builtin_setjmp is considered to "throw".
Kaveh R. Ghazi firstname.lastname@example.org