Processed (with 1 error): Re: Bug#1000974: copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’?
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 163839370805.58768.6385074074873965943.reportbug@zbuz.infomaniak.ch
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Processing commands for [email protected]:
Quoted 1 line
reassign 1000974 xfslibs-dev
Bug #1000974 [libboost1.74-dev] copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’? Bug reassigned from package 'libboost1.74-dev' to 'xfslibs-dev'.
No longer marked as found in versions boost1.74/1.74.0-13.
Ignoring request to alter fixed versions of bug #1000974 to the same values previously set
Quoted 1 line
severity 1000974 important
Bug #1000974 [xfslibs-dev] copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’? Ignoring request to change severity of Bug 1000974 to the same value.
Quoted 1 line
retitle 1000974
xfs/linux.hdefines common word "fallthrough" breaking
Bug #1000974 [xfslibs-dev] copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’?
Changed Bug title to 'xfs/linux.h defines common word "fallthrough" breaking' from 'copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’?'.
Quoted 1 line
unrelated headers
Unknown command or malformed arguments to command.
Quoted 1 line
thanks
Stopping processing here.
Please contact me if you need assistance.
Signature · 3 lines
1000974: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000974 Debian Bug Tracking System Contact [email protected] with problems
Bug#1000974: copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’?
In reply to a message not in the archiveQuoted 70 lines · Giovanni Mascellani
reassign 1000974 xfslibs-dev
severity 1000974 important
retitle 1000974xfs/linux.hdefines common word "fallthrough" breaking unrelated headers
thanksHi,
Quoted 8 lines · Thomas Goirand
Quoted 2 lines · Giovanni Mascellani
Could you try running that compilation command with g++ -E, so you can see what
BOOST_FALLTHROUGHis actually begin replaced with?Oh, sorry, now I get what you meant (did a c++ --help to understand what -E was doing). Here's the result in
CMakeFiles/seastar.dir/src/core/file.cc.o:Quoted 7 lines
__attribute__((__attribute__((__fallthrough__))));
Probably, there's a mistake, and it should really be:
__attribute__((__fallthrough__));
instead, which is the source of the trouble?
It seems that the problem goes this way:
* Boost defines in
/usr/include/boost/config/compiler/gcc.hpp:#define
BOOST_FALLTHROUGH__attribute__((fallthrough))* But
/usr/include/xfs/linux.hdefines:#define fallthrough __attribute__((__fallthrough__))
So the "fallthrough" in Boost's definition is expanded again and causes the problem.
I think
xfs/linux.his at fault here, because it aggressively defines a common word (while Boost namespaces all its definitions with aBOOST_prefix). Unfortunately the C/C++ preprocessor makes it easy to break other headers if you define stuff too liberally. This wold also, for example, break any program that use the name "fallthrough" for a variable, which is a completely reasonable name to use. A simple example could be:
---
#include <xfs/linux.h>int
main(){
int fallthrough = 0;
return fallthrough;
}
---
which fails compilation with:
---$ LANG=C gcc test.c test.c: In function 'main': test.c:4:5: warning: 'fallthrough' attribute not followed by ';' [-Wattributes] 4 | int fallthrough = 0; | ^~~ test.c:4:21: error: expected identifier or '(' before '=' token 4 | int fallthrough = 0; | ^ In file included from test.c:1: test.c:5:12: error: expected expression before '__attribute__' 5 | return fallthrough; | ^~~~~~~~~~~ ---
Quoted 5 lines
You can probably work around this problem by undefining "fallthrough" just after the
xfs/linux.hheader. In the meantime I am reassigning this bug to xfslibs-dev.Giovanni.
Hi,
I can confirm that commenting away line 373 to 381 of xfs/linux.h solve the troubles when building Ceph. Downgrading to 5.13.0-1 (using snapshot.d.o) also solved the trouble, showing that 5.14.0 really is the trouble here.
Thanks Giovanni for finding this out.
Cheers,
Thomas Goirand (zigo)
Bug#1000974: copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’?
Quoted 71 lines · Thomas Goirand
Quoted 70 lines · Giovanni Mascellani
reassign 1000974 xfslibs-dev
severity 1000974 important
retitle 1000974xfs/linux.hdefines common word "fallthrough" breaking unrelated headers
thanksHi,
Quoted 8 lines · Thomas Goirand
Quoted 2 lines · Giovanni Mascellani
Could you try running that compilation command with g++ -E, so you can see what
BOOST_FALLTHROUGHis actually begin replaced with?Oh, sorry, now I get what you meant (did a c++ --help to understand what -E was doing). Here's the result in
CMakeFiles/seastar.dir/src/core/file.cc.o:Quoted 7 lines
__attribute__((__attribute__((__fallthrough__))));
Probably, there's a mistake, and it should really be:
__attribute__((__fallthrough__));
instead, which is the source of the trouble?
It seems that the problem goes this way:
* Boost defines in
/usr/include/boost/config/compiler/gcc.hpp:#define
BOOST_FALLTHROUGH__attribute__((fallthrough))* But
/usr/include/xfs/linux.hdefines:#define fallthrough __attribute__((__fallthrough__))
So the "fallthrough" in Boost's definition is expanded again and causes the problem.
I think
xfs/linux.his at fault here, because it aggressively defines a common word (while Boost namespaces all its definitions with aBOOST_prefix). Unfortunately the C/C++ preprocessor makes it easy to break other headers if you define stuff too liberally. This wold also, for example, break any program that use the name "fallthrough" for a variable, which is a completely reasonable name to use. A simple example could be:
---
#include <xfs/linux.h>int
main(){
int fallthrough = 0;
return fallthrough;
}
---
which fails compilation with:
---$ LANG=C gcc test.c test.c: In function 'main': test.c:4:5: warning: 'fallthrough' attribute not followed by ';' [-Wattributes] 4 | int fallthrough = 0; | ^~~ test.c:4:21: error: expected identifier or '(' before '=' token 4 | int fallthrough = 0; | ^ In file included from test.c:1: test.c:5:12: error: expected expression before '__attribute__' 5 | return fallthrough; | ^~~~~~~~~~~ ---
Quoted 3 lines
Quoted 3 lines
You can probably work around this problem by undefining "fallthrough" just after the
xfs/linux.hheader. In the meantime I am reassigning this bug to xfslibs-dev.
Yeah, sorry. This is braindamage from the Linux kernel (because hey, we share libxfs between kernel and userspace) that I mistakenly let escape because the authors of the kernel patch didn't try to help us when they forced this stupid mess on us. All this BS because some compiler writers didn't like their static checkers to have to use regular expressions for compatibility with existing codebases, and the language standard people decided to introduce a breaking change to "standardize" it.
Will fix ASAP.
--D
Quoted 16 lines
Quoted 2 lines
Giovanni.
Hi,
I can confirm that commenting away line 373 to 381 of
xfs/linux.hsolve the troubles when building Ceph. Downgrading to 5.13.0-1 (using snapshot.d.o) also solved the trouble, showing that 5.14.0 really is the trouble here.Thanks Giovanni for finding this out.
Cheers,
Thomas Goirand (zigo)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Bug#1000974: Info received (Bug#1000974: copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’? )
Please find attached to this message a debdiff fixing the problem.
Cheers,
Thomas Goirand (zigo)
debian/changelog +8 -0
@@ -1,3 +1,11 @@ +xfsprogs (5.14.0-release-2.1) unstable; urgency=medium + + * Non-maintainer upload. + * Add 0001-Revert-xfs-Fix-fall-through-warnings-for-Clang.patch so that + xfslibs-dev doesn't define fallthrough globally anymore (Closes: #1000974). + + -- Thomas Goirand <[email protected]> Sun, 05 Dec 2021 18:47:33 +0100 + xfsprogs (5.14.0-release-2) unstable; urgency=medium * Replace the Debian-only #999879 fix by upstream patch
debian/patches/0001-Revert-xfs-Fix-fall-through-warnings-for-Clang.patch +343 -0
343 lines not on this page · raw message
debian/patches/series +1 -0
@@ -1,2 +1,3 @@ libfrog-fix-crc32c-self-test-code-on-cross-builds.patch libxfs-fix-atomic64_t-poorly-for-32-bit-architectures.patch +0001-Revert-xfs-Fix-fall-through-warnings-for-Clang.patch
Bug#1000974: marked as done (xfs/linux.h defines common word "fallthrough" breaking unrelated headers)
In reply to a message not in the archiveYour message dated Tue, 7 Dec 2021 13:32:48 +0100
with message-id <[email protected]>
and subject line fixed upstream
has caused the Debian Bug report #1000974,
regarding xfs/linux.h defines common word "fallthrough" breaking unrelated headers to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.)
Signature · 3 lines
1000974: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000974 Debian Bug Tracking System Contact [email protected] with problems
Package: libboost1.74-dev
Version: 1.74.0-13
Severity: important
Hi there!
When building Ceph (current version in Experimental), since a few days/weeks, I get this:
In file included from /root/ceph/ceph/src/seastar/src/core/file.cc:28:/usr/include/boost/container/detail/copy_move_algo.hpp: In function ‘typename boost::move_detail::enable_if_c<(boost::container::dtl::is_memtransfer_copy_assignable<F, G>::value && true), void>::type boost::container::deep_swap_alloc_n(A llocator&, F, typename boost::container::allocator_traits<Allocator>::size_type, G, typename boost::container::allocator_traits<Allocator>::size_type)’:/usr/include/boost/container/detail/copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’?
1083 | BOOST_FALLTHROUGH;
| ^~~~~~~~~~~~~~~~~To me, it looks like a bug in Boost itself, as this is where the BOOST_FALLTHROUGH macro is defined.
Note that in Ceph, I had the same issue, until I redefined the macro like this directly:
#define FMT_FALLTHROUGH [[gnu::fallthrough]]
removing the conditional:
#if __cplusplus == 201103L || __cplusplus == 201402L
which doesn't seem to get some matching, and then the error in the subject of this bug report went away, at least for the Ceph part (well, fmt which Ceph embedds...).
Is this still a problem in Ceph, or am I right that it probably is an issue in Boost?
I can't get my head around this issue which has been blocking me for weeks. What's annoying is that it used to build fine, and I don't know what changed in unstable to make it fail to way. If the issue is in Ceph's code, then I would happily recieve advices.
Your thoughts?
Cheers,
Thomas Goirand (zigo)
Version: 5.14.2-1
This was fixed by commit 135ce1ed0a99 (libxfs: hide the drainbamaged fallthrough macro from xfslibs)
Bug#1000974: marked as done (xfs/linux.h defines common word "fallthrough" breaking unrelated headers)
In reply to a message not in the archiveYour message dated Tue, 07 Dec 2021 12:50:53 +0000
with message-id <[email protected]>
and subject line Bug#1000974: fixed in xfsprogs 5.14.2-1
has caused the Debian Bug report #1000974,
regarding xfs/linux.h defines common word "fallthrough" breaking unrelated headers to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.)
Signature · 3 lines
1000974: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000974 Debian Bug Tracking System Contact [email protected] with problems
Package: libboost1.74-dev
Version: 1.74.0-13
Severity: important
Hi there!
When building Ceph (current version in Experimental), since a few days/weeks, I get this:
In file included from /root/ceph/ceph/src/seastar/src/core/file.cc:28:/usr/include/boost/container/detail/copy_move_algo.hpp: In function ‘typename boost::move_detail::enable_if_c<(boost::container::dtl::is_memtransfer_copy_assignable<F, G>::value && true), void>::type boost::container::deep_swap_alloc_n(A llocator&, F, typename boost::container::allocator_traits<Allocator>::size_type, G, typename boost::container::allocator_traits<Allocator>::size_type)’:/usr/include/boost/container/detail/copy_move_algo.hpp:1083:10: error: ‘__fallthrough__’ was not declared in this scope; did you mean ‘fallthrough’?
1083 | BOOST_FALLTHROUGH;
| ^~~~~~~~~~~~~~~~~To me, it looks like a bug in Boost itself, as this is where the BOOST_FALLTHROUGH macro is defined.
Note that in Ceph, I had the same issue, until I redefined the macro like this directly:
#define FMT_FALLTHROUGH [[gnu::fallthrough]]
removing the conditional:
#if __cplusplus == 201103L || __cplusplus == 201402L
which doesn't seem to get some matching, and then the error in the subject of this bug report went away, at least for the Ceph part (well, fmt which Ceph embedds...).
Is this still a problem in Ceph, or am I right that it probably is an issue in Boost?
I can't get my head around this issue which has been blocking me for weeks. What's annoying is that it used to build fine, and I don't know what changed in unstable to make it fail to way. If the issue is in Ceph's code, then I would happily recieve advices.
Your thoughts?
Cheers,
Thomas Goirand (zigo)
Source: xfsprogs
Source-Version: 5.14.2-1
Done: Nathan Scott <[email protected]>
We believe that the bug you reported is fixed in the latest version of xfsprogs, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is attached.
Thank you for reporting the bug, which will now be closed. If you have further comments please address them to [email protected], and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Nathan Scott <[email protected]> (supplier of updated xfsprogs package)
(This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Mon, 06 Dec 2021 14:26:57 -0500
Source: xfsprogs
Architecture: source
Version: 5.14.2-1
Distribution: unstable
Urgency: medium
Maintainer: XFS Development Team <[email protected]>
Changes:
xfsprogs (5.14.2-1) unstable; urgency=medium
.
* New upstream release
- Move rogue fallthrough macro out of linux.h (Closes: #1000974)
Checksums-Sha1:
7d58d8887618f090bfc2b5c0d9c309da788ba960 2017 xfsprogs_5.14.2-1.dsc 035e552cf4a08d5dbe1330ec1e3e6ceeb21b6bc9 1308912 xfsprogs_5.14.2.orig.tar.xz ef951cda194275eee5c3975cfd46544cf0f70a67 14316 xfsprogs_5.14.2-1.debian.tar.xz 2d71d75e23c654180f1c794e4d5c8c569f62873f 6141 xfsprogs_5.14.2-1_source.buildinfo
Checksums-Sha256:
6fcd3408e1c1edc0d776f54323424dd36eeaffc148191911c464d5a02b2bad6b 2017 xfsprogs_5.14.2-1.dsc 01ccd3ef9df2837753a5d876b8da84ea957d13d7a461b8c46e8afa4eb09aabc8 1308912 xfsprogs_5.14.2.orig.tar.xz 9581848bd59128cdd38ccaa4c92d82d5ddd66c74baa9dc2fc76fb5146497af4a 14316 xfsprogs_5.14.2-1.debian.tar.xz 4d20924cfc79905a769dbff0aca10eab696536aab5f591e36e9e35001f63a5f6 6141 xfsprogs_5.14.2-1_source.buildinfo
Files:
14d5f362b8d4ea4bee80edb78a36ad9e 2017 admin optional xfsprogs_5.14.2-1.dsc 597e7067b8aa24d440bc87c29e987377 1308912 admin optional xfsprogs_5.14.2.orig.tar.xz 89ea7c8a994352dcecd267a0ec13136c 14316 admin optional xfsprogs_5.14.2-1.debian.tar.xz 4e41a97053eeb8ec0c6547e293683776 6141 admin optional xfsprogs_5.14.2-1_source.buildinfo
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEEQGIgyLhVKAI3jM5BH1x6i0VWQxQFAmGvU4sACgkQH1x6i0VW QxS0egv9HwfcbxyRn43bj+CxNKMCdKtgIPfV0SZxejKwarbdDg3d8f4/1i7gNVpJ +isPdnKvVULyxEhQxdoYfsjWaTCCX3YMlyrd6i5+2nrn6J9cwXrrJJdjPWvMgXR2 o2u+brvm9cPYllAbbEVUYe6dtHY+/cH1c16W1SYK3yln7MWWWCTvAT0a7YrnrZQj 7FVdd0qcbM+PU/m2qwpUxz2KmtVjJ8RfiF+a/X7P1zeAxAoODFx3GRRY9cTyvgnV tDwAdlSu4W6UgiKwgTpDFUT6EPRigEEqjTk3k0BgvYeFEidX57TsknQXwWKn3dI/ Dxfo5wxGVlDIywj4iN9EugsYCBwW8ggm60St/BiJhuNpgup339yUBGtszm/x97RM XLKTOgb642bqTVu1Otee+Bdd5VSMwlmkyUnDDvuh52EPF3uFNf55sgiYsv02ATrB jb8rcN1zeqUZ9r+9m6w65pp2wQX6HAWqZSUEl2HToPITse3OPwwCPUKZja+BYpT5 bGdytpiC
=ORx6
-----END PGP SIGNATURE-----
PATCH 1/1 libxfs: hide the drainbamaged fallthrough macro from xfslibs
From: Darrick J. Wong <[email protected]>
Back in mid-2021, Kees and Gustavo rammed into the kernel a bunch of static checker "improvements" that redefined '/* fallthrough */' comments for switch statements as a macro that virtualizes either that same comment, a do-while loop, or a compiler __attribute__. This was necessary to work around the poor decision-making of the clang, gcc, and C language standard authors, who collectively came up with four mutually incompatible ways to document a lack of branching in a code flow.
Having received ZERO HELP porting this to userspace, Eric and I foolishly dumped that crap into linux.h, which was a poor decision because we keep forgetting that linux.h is exported as a userspace header. This has now caused downstream regressions in Debian[1] and will probably cause more problems in the other distros.
Move it to platform_defs.h since that's not shipped publicly and leave a warning to anyone else who dare modify linux.h.
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000974
--- include/linux.h | 20 ++------------------ include/platform_defs.h.in | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-)
include/linux.h +2 -18
@@ -360,24 +360,8 @@ fsmap_advance(#endif /* HAVE_MAP_SYNC */ /* -* Add the pseudo keyword 'fallthrough' so case statement blocks -* must end with any of these keywords: -* break; -* fallthrough; -* continue; -* goto <label>; -* return [expression]; -* -* gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes +* Reminder: anything added to this file will be compiled into downstream +* userspace projects! */ -#if defined __has_attribute -# if __has_attribute (__fallthrough__) -# define fallthrough __attribute__((__fallthrough__)) -# else -# define fallthrough do {} while (0)/* fallthrough */ -# endif -#else -# define fallthrough do {} while (0)/* fallthrough */ -#endif #endif /* __XFS_LINUX_H__ */
include/platform_defs.h.in +21 -0
@@ -113,4 +113,25 @@ static inline size_t __ab_c_size(size_t a, size_t b, size_t c) sizeof(*(p)->member) + __must_be_array((p)->member), \ sizeof(*(p))) +/* + * Add the pseudo keyword 'fallthrough' so case statement blocks + * must end with any of these keywords: + * break; + * fallthrough; + * continue; + * goto <label>; + * return [expression]; + * + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes + */ +#if defined __has_attribute +# if __has_attribute(__fallthrough__) +# define fallthrough __attribute__((__fallthrough__)) +# else +# define fallthrough do {} while (0) /* fallthrough */ +# endif +#else +# define fallthrough do {} while (0) /* fallthrough */ +#endif + #endif /* __XFS_PLATFORM_DEFS_H__ */
Re: Bug#1000974: [PATCH xfsprogs-5.14.2 URGENT] libxfs: hide the drainbamaged fallthrough macro from xfslibs
Quoted 38 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Back in mid-2021, Kees and Gustavo rammed into the kernel a bunch of static checker "improvements" that redefined '/* fallthrough */' comments for switch statements as a macro that virtualizes either that same comment, a do-while loop, or a compiler
__attribute__. This was necessary to work around the poor decision-making of the clang, gcc, and C language standard authors, who collectively came up with four mutually incompatible ways to document a lack of branching in a code flow.Having received ZERO HELP porting this to userspace, Eric and I foolishly dumped that crap into
linux.h, which was a poor decision because we keep forgetting thatlinux.his exported as a userspace header. This has now caused downstream regressions in Debian[1] and will probably cause more problems in the other distros.Move it to
platform_defs.hsince that's not shipped publicly and leave a warning to anyone else who dare modifylinux.h.[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000974
Fixes df9c7d8d ("xfs: Fix fall-through warnings for Clang")Signed-off-by Darrick J. Wong <[email protected]>--- include/linux.h | 20 ++------------------ include/platform_defs.h.in | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-)include/linux.h +0
-1@@ -360,24 +360,8 @@ fsmap_advance(#endif /* HAVE_MAP_SYNC */ /* -* Add the pseudo keyword 'fallthrough' so case statement blocks
include/linux.h fsmap_advance( · line 364
Quoted 10 lines
include/linux.h +2
-8-* must end with any of these keywords: -* break; -* fallthrough; -* continue; -* goto <label>; -* return [expression]; -* -* gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes +* Reminder: anything added to this file will be compiled into downstream +* userspace projects!
This comment belongs at the top of the file before all the includes, not at the end of it. Otherwise looks ok for a quick fix.
But I have to wonder - why is this file even exported to userspace? It's mostly the xfsprogs source build wrapper stuff for linux - there's no public API in it except for xfsctl()....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Re: [PATCH xfsprogs-5.14.2 URGENT] libxfs: hide the drainbamaged fallthrough macro from xfslibs
In reply to Darrick J. WongQuoted 16 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Back in mid-2021, Kees and Gustavo rammed into the kernel a bunch of static checker "improvements" that redefined '/* fallthrough */' comments for switch statements as a macro that virtualizes either that same comment, a do-while loop, or a compiler
__attribute__. This was necessary to work around the poor decision-making of the clang, gcc, and C language standard authors, who collectively came up with four mutually incompatible ways to document a lack of branching in a code flow.Having received ZERO HELP porting this to userspace, Eric and I foolishly dumped that crap into
linux.h, which was a poor decision because we keep forgetting thatlinux.his exported as a userspace header. This has now caused downstream regressions in Debian[1] and will probably cause more problems in the other distros.
Quoted 8 lines
Move it to
platform_defs.hsince that's not shipped publicly and leave a warning to anyone else who dare modifylinux.h.[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000974
Fixes df9c7d8d ("xfs: Fix fall-through warnings for Clang")Signed-off-by Darrick J. Wong <[email protected]>
Thanks Darrick, I'll get a 5.14.2 pushed out today. Not sure if it was you or I who stuffed it into this header originally, but apologies for not thinking that through before merging it in any case.
-Eric
Quoted 67 lines
--- include/linux.h | 20 ++------------------ include/platform_defs.h.in | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-)include/linux.h +2
-18@@ -360,24 +360,8 @@ fsmap_advance(#endif /* HAVE_MAP_SYNC */ /* -* Add the pseudo keyword 'fallthrough' so case statement blocks -* must end with any of these keywords: -* break; -* fallthrough; -* continue; -* goto <label>; -* return [expression]; -* -* gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes +* Reminder: anything added to this file will be compiled into downstream +* userspace projects! */ -#if defined __has_attribute -# if __has_attribute (__fallthrough__) -# define fallthrough __attribute__((__fallthrough__)) -# else -# define fallthrough do {} while (0)/* fallthrough */ -# endif -#else -# define fallthrough do {} while (0)/* fallthrough */ -#endif #endif /* __XFS_LINUX_H__ */ include/platform_defs.h.in +21
-0@@ -113,4 +113,25 @@ static inline size_t __ab_c_size(size_t a, size_t b, size_t c) sizeof(*(p)->member) + __must_be_array((p)->member), \ sizeof(*(p))) +/* + * Add the pseudo keyword 'fallthrough' so case statement blocks + * must end with any of these keywords: + * break; + * fallthrough; + * continue; + * goto <label>; + * return [expression]; + * + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes + */ +#if defined __has_attribute +# if __has_attribute(__fallthrough__) +# define fallthrough __attribute__((__fallthrough__)) +# else +# define fallthrough do {} while (0) /* fallthrough */ +# endif +#else +# define fallthrough do {} while (0) /* fallthrough */ +#endif + #endif /* __XFS_PLATFORM_DEFS_H__ */
Re: [PATCH xfsprogs-5.14.2 URGENT] libxfs: hide the drainbamaged fallthrough macro from xfslibs
In reply to Darrick J. WongQuoted 11 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Back in mid-2021, Kees and Gustavo rammed into the kernel a bunch of static checker "improvements" that redefined '/* fallthrough */' comments for switch statements as a macro that virtualizes either that same comment, a do-while loop, or a compiler
__attribute__. This was necessary to work around the poor decision-making of the clang, gcc, and C language standard authors, who collectively came up with four mutually incompatible ways to document a lack of branching in a code flow.Having received ZERO HELP porting this to userspace, Eric and I
Look, I know you don't like this feature, but claiming that you received no help with it is just false. I explicitly offered to help with xfsprogs, and even sent a first-attempt at a patch to do so[1], which looks very similar to what you've got here, almost 6 months later. I even went through and changed all the comments to an explicitly XFS-specific macro when you made it clear you hated the statement-like "fallthrough" macro name.
I continue to be baffled about this whole saga. We're all trying to help make Linux better, and I went out of my way to help with xfsprogs too to minimize the impact on you (since you said you wanted to have nothing to do with it), yet Gustavo and I got continually flamed by yourself and Dave, including even now in this very misleading commit log.
What is going on here?
-Kees
[1] https://lore.kernel.org/lkml/202105280915.9117D7C@keescook/
Signature · 1 line
Kees Cook