public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Siddhesh Poyarekar <siddhesh@gotplt.org>
Cc: Xi Ruoyao <xry111@xry111.site>,
	 libc-alpha@sourceware.org,
	 Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	 Carlos O'Donell <carlos@redhat.com>,
	 Alex Colomar <alx.manpages@gmail.com>,
	 Andreas Schwab <schwab@suse.de>,
	 Zack Weinberg <zack@owlfolio.org>,
	 Jeff Law <jeffreyalaw@gmail.com>
Subject: Re: [PATCH] Revert "libio: Add __nonnull for FILE * arguments of fclose and freopen"
Date: Tue, 11 Jul 2023 10:57:09 +0200	[thread overview]
Message-ID: <87ilaqesgq.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <874jmbf2pl.fsf@oldenburg.str.redhat.com> (Florian Weimer's message of "Tue, 11 Jul 2023 07:15:50 +0200")

* Florian Weimer:

> * Siddhesh Poyarekar:
>
>> On 2023-07-10 18:07, Xi Ruoyao wrote:
>>> This reverts commit 71d9e0fe766a3c22a730995b9d024960970670af.
>>> Apparantly the maintainers do not like __nonnull.  And I'm too
>>> pissed
>>> off to work on this anymore.  Anyway I don't care about the analyzer so
>>> they can just add these as ugly special analyzer patterns.  And I'm not
>>> so stupid to pass NULL to these things myself, so lacking a warning is
>>> not a problem to me.
>>
>> Sorry you feel this way, but this is still unresolved as we don't have
>> a consensus yet.  However I understand if you're frustrated and don't
>> want to work on this for now; I do hope you return though.
>>
>> In any case, if the consensus does steer towards never using
>> __nonnull__, it'll likely be better to do it by hacking cdefs.h to
>> expand __nonnull to nothing.
>
> We can do this under #ifdef _LIBC.  This way, analyzers can still
> benefit from the annotations, but the attribute does not affect the
> glibc build.
>
> It doesn't make sense to maintain the nonnull-ness of glibc function
> arguments outside glibc, so we should add these annotations to the
> installed headers.

While trying to implement that, I found this in include/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)

So the whole thing is really a non-issue, and I don't think we need to
revert anything.

We can stop doing that #undef dance if there's an -f flag to get the GCC
behavior we want, so that we benefit from GCC diagnostics during the
glibc build.

Thanks,
Florian


  reply	other threads:[~2023-07-11  8:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 22:07 Xi Ruoyao
2023-07-10 22:34 ` Siddhesh Poyarekar
2023-07-11  0:31   ` Sam James
2023-07-11  5:15   ` Florian Weimer
2023-07-11  8:57     ` Florian Weimer [this message]
2023-07-11 11:20       ` Siddhesh Poyarekar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilaqesgq.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=alx.manpages@gmail.com \
    --cc=carlos@redhat.com \
    --cc=jeffreyalaw@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    --cc=siddhesh@gotplt.org \
    --cc=xry111@xry111.site \
    --cc=zack@owlfolio.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).