From: David Laight <David.Laight@ACULAB.COM>
To: 'Nathan Chancellor' <nathan@kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>
Cc: "linux-kbuild@vger.kernel.org" <linux-kbuild@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>,
"llvm@lists.linux.dev" <llvm@lists.linux.dev>
Subject: RE: [PATCH] kbuild: remove GCC's default -Wpacked-bitfield-compat flag
Date: Sun, 10 Mar 2024 18:37:27 +0000 [thread overview]
Message-ID: <74e770fb614c41208203732b095bd20f@AcuMS.aculab.com> (raw)
In-Reply-To: <20240306164950.GB3659677@dev-arch.thelio-3990X>
From: Nathan Chancellor
> Sent: 06 March 2024 16:50
>
> On Wed, Mar 06, 2024 at 09:47:09PM +0900, Masahiro Yamada wrote:
> > Commit 4a5838ad9d2d ("kbuild: Add extra gcc checks") added the
> > -Wpacked-bitfield-compat flag.
> >
> > GCC manual says:
> > "This warning is enabled by default. Use -Wno-packed-bitfield-compat
> > to disable this warning."
> >
> > The test code in the manual:
> >
> > struct foo
> > {
> > char a:4;
> > char b:8;
> > } __attribute__ ((packed));
> >
> > ... emits "note: offset of packed bit-field ‘b’ has changed in GCC 4.4"
> > without W=3.
> >
> > Let's remove it, as it is a default with GCC.
> >
> > Clang does not support this flag, so its removal will not affect Clang
> > builds.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
gcc generates pretty crap code for the above.
clang is ok unless you extend the structure to 3 bytes.
See:
https://godbolt.org/z/9c1csonY9
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2024-03-10 18:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 12:47 [PATCH] kbuild: remove GCC's default -Wpacked-bitfield-compat flag Masahiro Yamada
2024-03-06 16:49 ` Nathan Chancellor
2024-03-10 18:37 ` David Laight [this message]
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=74e770fb614c41208203732b095bd20f@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=justinstitt@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=masahiroy@kernel.org \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
/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).