[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <74e770fb614c41208203732b095bd20f@AcuMS.aculab.com>
Date: Sun, 10 Mar 2024 18:37:27 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Nathan Chancellor' <nathan@...nel.org>, Masahiro Yamada
<masahiroy@...nel.org>
CC: "linux-kbuild@...r.kernel.org" <linux-kbuild@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Bill Wendling
<morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>, Nick Desaulniers
<ndesaulniers@...gle.com>, Nicolas Schier <nicolas@...sle.eu>,
"llvm@...ts.linux.dev" <llvm@...ts.linux.dev>
Subject: RE: [PATCH] kbuild: remove GCC's default -Wpacked-bitfield-compat
flag
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@...nel.org>
>
> Reviewed-by: Nathan Chancellor <nathan@...nel.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)
Powered by blists - more mailing lists