On 12/5/21 4:50 PM, Giovanni Mascellani wrote: > reassign 1000974 xfslibs-dev > severity 1000974 important > retitle 1000974 xfs/linux.h defines common word "fallthrough" breaking > unrelated headers > thanks > > Hi, > > On 04/12/21 23:36, Thomas Goirand wrote: >> On 12/4/21 5:11 PM, Giovanni Mascellani wrote: >>> Could you try running that compilation command with g++ -E, so you can >>> see what BOOST_FALLTHROUGH is 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: >> >> __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.h defines: > > #define fallthrough __attribute__((__fallthrough__)) > > So the "fallthrough" in Boost's definition is expanded again and causes > the problem. > > I think xfs/linux.h is at fault here, because it aggressively defines a > common word (while Boost namespaces all its definitions with a BOOST_ > 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; > | ^~~~~~~~~~~ > --- > > You can probably work around this problem by undefining "fallthrough" > just after the xfs/linux.h header. 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)