From: "Theodore Ts'o" <tytso@mit.edu>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Nathan Chancellor <nathan@kernel.org>,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [GIT PULL] ext4 changes for the 6.4 merge window
Date: Wed, 26 Apr 2023 19:16:16 -0400 [thread overview]
Message-ID: <ZEmwwJ9c3ube00Ug@mit.edu> (raw)
In-Reply-To: <CAKwvOdn3Unm94UCiXygWTM_KyhATNsy68b_CFbqBDFXshd+34Q@mail.gmail.com>
On Wed, Apr 26, 2023 at 03:07:48PM -0700, Nick Desaulniers wrote:
> Is this what you had in mind?
> ```
> $ cat linus.c
> #define NULL ((void*)0)
>
> void * _Nonnull foo (void) {
> return &foo;
> }
>
> void bar (void) {
> if (foo() == NULL) // maybe should warn that foo() returns _Nonnull?
> bar();
> }
>
> $ clang linus.c -fsyntax-only
> linus.c:8:15: warning: comparison of _Nonnull function call 'foo'
> equal to a null pointer is always false
Ideally, the warning should also fire in this case:
if (!foo()) {
bar();
}
And of course, what if the code does this:
p = foo();
if (p) {
quux();
}
Would these also be considered implicit comparisons to a NULL pointer?
- Ted
next prev parent reply other threads:[~2023-04-26 23:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 4:18 Theodore Ts'o
2023-04-26 17:03 ` Linus Torvalds
2023-04-26 17:34 ` Nick Desaulniers
2023-04-26 17:36 ` Nick Desaulniers
2023-04-26 17:43 ` Nick Desaulniers
2023-04-26 18:11 ` Linus Torvalds
2023-04-26 18:22 ` Nick Desaulniers
2023-04-26 18:32 ` Linus Torvalds
2023-04-26 22:07 ` Nick Desaulniers
2023-04-26 22:31 ` Linus Torvalds
2023-04-28 21:02 ` Nick Desaulniers
2023-04-28 21:18 ` Linus Torvalds
2023-04-26 23:16 ` Theodore Ts'o [this message]
2023-04-26 19:10 ` Matthew Wilcox
2023-04-26 19:38 ` Linus Torvalds
2023-04-26 23:12 ` Theodore Ts'o
2023-05-03 8:03 ` Dan Carpenter
2023-04-26 17:06 ` pr-tracker-bot
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=ZEmwwJ9c3ube00Ug@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=torvalds@linux-foundation.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