On Wed, Mar 05 2025, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > On Wed, 5 Mar 2025 at 05:31, Rasmus Villemoes <ravi@xxxxxxxxx> wrote: >> >> On Mon, Mar 03 2025, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: >> >> > +/* >> > + * We have to declare this outside 'struct pipe_inode_info', >> > + * but then we can't use 'union pipe_index' for an anonymous >> > + * union, so we end up having to duplicate this declaration >> > + * below. Annoying. >> > + */ >> > +union pipe_index { >> > + unsigned long head_tail; >> > + struct { >> > + pipe_index_t head; >> > + pipe_index_t tail; >> > + }; >> > +}; >> > + >> >> -fms-extensions ? Willy wanted to add that for use in mm/ some years ago >> [*], and it has come up a few other times as well. >> >> [*] https://lore.kernel.org/lkml/20180419152817.GD25406@xxxxxxxxxxxxxxxxxxxxxx/ > > Oh, I was unaware of that extension, and yes, it would have been > lovely here, avoiding that duplicate union declaration. > > But it does require clang support - I see that clang has a > '-fms-extensions' as well, so it's presumably there. Yes, it seems they do have it, but for mysterious reasons saying -fms-extensions is not quite enough to convince clang that one does intend to use that MS extension, one also has to say -Wno-microsoft-anon-tag, or it complains warning: anonymous unions are a Microsoft extension [-Wmicrosoft-anon-tag] Also, the warning text is somewhat misleading; anon unions itself have certainly been a gcc extension since forever, and nowadays a C11 thing, and clang has a separate -Wpedantic warning for that when using -std=c99: warning: anonymous unions are a C11 extension [-Wc11-extensions] The -W flag name actually suggests an improvement to the warning "_tagged_ anonymous unions are a Microsoft extension", but I really wonder why -fms-extensions isn't sufficient to silence that in the first place. Also, the warning seems to be on by default; it's not some -Wextra or -Wpedantic thing. cc += Nick Rasmus