All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: bugzilla-daemon@bugzilla.kernel.org
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: [Bug 207959] Don't warn about the universal zero initializer for a structure with the 'designated_init' attribute.
Date: Thu, 28 May 2020 15:25:39 -0700	[thread overview]
Message-ID: <CAHk-=wiKCXoeynr6am-B-_=XP=mQxtxREjP+q_zzMfe5CaeJeQ@mail.gmail.com> (raw)
In-Reply-To: <bug-207959-200559-nznJfyeqKD@https.bugzilla.kernel.org/>

On Thu, May 28, 2020 at 2:24 PM <bugzilla-daemon@bugzilla.kernel.org> wrote:
>
> Well, that's really the point.
> The problem Sparse also gives the warnings corresponding to clang's -Wnonnull
> and my understanding is that these warnings are desired for the kernel even
> when coming from using '{ 0 }'.

In the kernel, the empty initializer is be the usual way to create a
zero initializer. So yes, { 0 } may exist, but it generally should be
used for initializing something that is known to be an integer. And if
it's a pointer, it should warn, because '0' should never have been a
valid pointer, traditional C or not.

It's not like we use pedantic and portable standard C to begin with.

So yeah, the sparse defaults may be a bit kernel-centric.

             Linus

  reply	other threads:[~2020-05-28 22:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 16:27 [Bug 207959] New: Don't warn about the universal zero initializer for a structure with the 'designated_init' attribute bugzilla-daemon
2020-05-28 19:22 ` [Bug 207959] " bugzilla-daemon
2020-05-28 19:57 ` [Bug 207959] New: " Ramsay Jones
2020-05-28 20:52 ` [Bug 207959] " bugzilla-daemon
2020-05-28 21:24 ` bugzilla-daemon
2020-05-28 22:25   ` Linus Torvalds [this message]
2020-05-28 22:26 ` bugzilla-daemon
2020-05-28 22:31 ` bugzilla-daemon
2020-05-28 22:47 ` bugzilla-daemon
2020-05-29 19:35 ` bugzilla-daemon
2020-05-29 19:47 ` bugzilla-daemon
2020-06-08  7:53 ` bugzilla-daemon

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='CAHk-=wiKCXoeynr6am-B-_=XP=mQxtxREjP+q_zzMfe5CaeJeQ@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-sparse@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.