From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: cfe-dev@lists.llvm.org,
Arthur O'Dwyer <arthur.j.odwyer@gmail.com>,
Joerg Sonnenberger <joerg@bec.de>
Cc: gcc@gcc.gnu.org, Joseph Myers <joseph@codesourcery.com>
Subject: Ping: ISO C3X proposal: nonnull qualifier
Date: Sat, 20 Nov 2021 17:47:28 +0100 [thread overview]
Message-ID: <ab958e9c-93e6-bcc6-71e4-06628b3160a1@gmail.com> (raw)
In-Reply-To: <79b4ef92-38a9-b8ba-6259-f8ade53880ca@gmail.com>
Ping
On 11/17/21 01:06, Alejandro Colomar (man-pages) wrote:
> Hi,
>
> Sorry for Clang people,
> when I started this thread,
> I wasn't subscribed to your list,
> and some messages are not on your list.
> You can find the complete thread on the GCC list:
> <https://gcc.gnu.org/pipermail/gcc/2021-November/237743.html>
>
> I have a few questions for you.
> See below, please.
>
> On 11/16/21 13:34, Alejandro Colomar (man-pages) wrote:
>> $ cat _Nonnull.c
>> #include <stdlib.h>
>>
>> int *_Nonnull f(int *_Nullable p)
>> {
>> if (!p)
>> exit(1);
>> return p;
>> }
>>
>>
>> - I get a warning from f().
>> Ideally,
>> a programmer should not need to cast
>> (casts are dangerous),
>> to convert a nullable pointer to a _Nonnull pointer.
>> For that,
>> appropriate checks should be in the preceeding code.
>> Otherwise, a diagnostic should be issued.
>> To be on the safe side,
>> if a compiler has doubts,
>> it should diagnose.
>>
>> There's some Clang document that talks about something similar.
>> I don't know its validity,
>> or if it was a draft before _Nonnull qualifiers.
>> <https://clang.llvm.org/docs/analyzer/developer-docs/nullability.html>
>
> That document suggests that I shouldn't get a diagnostic from f().
> Why did I get a diagnostic? (I tried clang 11, 13 & 14(experimental))
>
>
> Is it talking about a different nonnull attribute/qualifier?
> Was it about a proposal prior to the current _Nonnull?
> Why is it not in use? Was it too difficult to implement?
>
>
> Do you think Clang could be improved to not warn on f()?
>
>
> Thanks,
> Alex
>
--
Alejandro Colomar
Linux man-pages comaintainer; http://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
next prev parent reply other threads:[~2021-11-20 16:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 16:01 Alejandro Colomar (man-pages)
2021-11-15 16:30 ` Alejandro Colomar (man-pages)
2021-11-15 20:18 ` Joseph Myers
2021-11-15 21:09 ` Alejandro Colomar (man-pages)
2021-11-15 22:17 ` Joseph Myers
2021-11-15 22:35 ` Alejandro Colomar (man-pages)
2021-11-15 22:47 ` Joseph Myers
2021-11-16 12:34 ` Alejandro Colomar (man-pages)
2021-11-17 0:06 ` Alejandro Colomar (man-pages)
2021-11-20 16:47 ` Alejandro Colomar (man-pages) [this message]
2021-11-23 11:32 ` [cfe-dev] " Dmitri Gribenko
2021-11-23 11:17 ` Dmitri Gribenko
2021-11-23 11:45 ` Alejandro Colomar (man-pages)
2021-11-23 12:45 ` Dmitri Gribenko
2021-12-01 22:24 ` Alejandro Colomar (man-pages)
2021-12-02 0:39 ` Dmitri Gribenko
2021-12-02 1:00 ` Alejandro Colomar (man-pages)
2021-12-02 20:24 ` Alejandro Colomar (man-pages)
2021-12-02 20:31 ` Alejandro Colomar (man-pages)
2021-12-02 20:36 ` Joseph Myers
2021-11-16 9:30 ` Jonathan Wakely
2021-11-16 17:13 ` [cfe-dev] " Arthur O'Dwyer
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=ab958e9c-93e6-bcc6-71e4-06628b3160a1@gmail.com \
--to=alx.manpages@gmail.com \
--cc=arthur.j.odwyer@gmail.com \
--cc=cfe-dev@lists.llvm.org \
--cc=gcc@gcc.gnu.org \
--cc=joerg@bec.de \
--cc=joseph@codesourcery.com \
/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).