https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110617

--- Comment #9 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #6)
> (In reply to Richard Biener from comment #5)
> > I think a -f... option to disable the code generation effects would make
> > more sense than adding another attribute kind.
> 
> Then maybe we'd just add a -D_GLIBC_NONNULL={0,1} (?) into Glibc cdefs.h
> instead.  Anyway I'm already too frustrated about this so I'll not continue
> working on nonnull within Glibc headers.  If you don't like this just close
> it as WONTFIX.

For those who are not following libc-alpha, glibc already disables __nonnull
during its build, so it should be totally fine to use __nonnull in installed
headers to improve diagnostics.

We have this in include/sys/cdefs.h (which augments <sys/cdefs.h>):

/* The compiler will optimize based on the knowledge the parameter is
   not NULL.  This will omit tests.  A robust implementation cannot allow
   this so when compiling glibc itself we ignore this attribute.  */
# undef __nonnull
# define __nonnull(params)

We'd like the diagnostics for building glibc itself, and a new -f option would
help with that.

Reply via email to