linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Matthew Wilcox <willy@infradead.org>,
	Nathan Chancellor <nathan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Linux Memory Management List <linux-mm@kvack.org>,
	Mike Rapoport <rppt@linux.ibm.com>,
	 clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH] mm/gfp: Add kernel-doc for gfp_t
Date: Fri, 19 Feb 2021 13:45:38 -0800	[thread overview]
Message-ID: <CAKwvOdmNz7PEZGJW5=FaQiWcShYUBMeo--_JS6JU94bUN9HagQ@mail.gmail.com> (raw)
In-Reply-To: <20210219205403.GX2858050@casper.infradead.org>

On Fri, Feb 19, 2021 at 12:55 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Fri, Feb 19, 2021 at 12:55:09PM -0700, Nathan Chancellor wrote:
> > On Mon, Feb 15, 2021 at 08:49:09PM +0000, Matthew Wilcox (Oracle) wrote:
> > > The generated html will link to the definition of the gfp_t automatically
> > > once we define it.  Move the one-paragraph overview of GFP flags from the
> > > documentation directory into gfp.h and pull gfp.h into the documentation.
> > >
> > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> >
> > This patch causes a clang warning in basically every file on linux-next
> > now:
> >
> > include/linux/gfp.h:20:32: warning: redefinition of typedef 'gfp_t' is a C11 feature [-Wtypedef-redefinition]
>
> Seems like it's also a gnu89 feature.

I'm not sure a lack of a warning is an intentional feature, and would
bet that behavior is not documented.

That said, I'm fine disabling this warning; there's a separate error
for redefining a typedef to a different underlying type.  That's
what's useful IMO, this one really is not.

This warning doesn't really provide any value to us in the kernel; I
would guess the intent was to be helpful to code expected to be
portable across different -std=*, but that's not the case for the
Linux kernel.  (It's also trivial to change this in Clang, but we'd
have to disable this warning for older supported of clang anyways).

diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index cee107096947..63529a43e797 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2381,7 +2381,7 @@ void Sema::MergeTypedefNameDecl(Scope *S,
TypedefNameDecl *New,
   }

   // Modules always permit redefinition of typedefs, as does C11.
-  if (getLangOpts().Modules || getLangOpts().C11)
+  if (getLangOpts().Modules || getLangOpts().C11 || getLangOpts().GNUMode)
     return;

   // If we have a redefinition of a typedef in C, emit a warning.  This warning
-- 
Thanks,
~Nick Desaulniers


  reply	other threads:[~2021-02-19 21:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 20:49 [PATCH] mm/gfp: Add kernel-doc for gfp_t Matthew Wilcox (Oracle)
2021-02-15 21:07 ` Mike Rapoport
2021-02-19 19:55 ` Nathan Chancellor
2021-02-19 20:54   ` Matthew Wilcox
2021-02-19 21:45     ` Nick Desaulniers [this message]
2021-02-19 22:15       ` Miguel Ojeda
2021-02-19 22:49         ` Nick Desaulniers
2021-02-20  9:43           ` Miguel Ojeda
2021-02-22 17:04     ` Nick Desaulniers
2021-02-22 17:16       ` Matthew Wilcox
2021-02-22 17:34         ` Nick Desaulniers

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='CAKwvOdmNz7PEZGJW5=FaQiWcShYUBMeo--_JS6JU94bUN9HagQ@mail.gmail.com' \
    --to=ndesaulniers@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-mm@kvack.org \
    --cc=nathan@kernel.org \
    --cc=rppt@linux.ibm.com \
    --cc=willy@infradead.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 NNTP newsgroup(s).