Linus rejects kernel workaround for sparse bitwise warnings
Torvalds NAK'd a _Generic rewrite of is_signed_type() and told developers to fix sparse instead of stripping __bitwise from trace fields.
Bart Van Assche proposed rewriting the kernel's is_signed_type() macro with C11 _Generic so that sparse would stop warning when tracing macros expand __field() entries that use __bitwise types.
The warnings appear for trace events that record types such as blk_opf_t and enum req_op, including block-related events in f2fs, jbd2, and nilfs2. The long-standing macro judges signedness by comparing cast constants; sparse objects when the type is a restricted bitwise integer. Van Assche's change listed the signed scalar cases explicitly and treated everything else as unsigned.
Linus Torvalds rejected the approach. He had already NAK'd the _Generic version and insisted the defect is in the checker, not the kernel. "WE DO NOT MAKE THE KERNEL WORSE BECAUSE OF TOOLING BUGS, WHEN THE TOOLING CAN BE FIXED," he wrote.
Tracing maintainer Steven Rostedt briefly suggested dropping __bitwise from the ring-buffer field types and assigning with __force, on the grounds that userspace format parsers do not need the qualifier. Torvalds shut that down as well: __field() takes a type on purpose, and bitwise qualification is part of that type the same way size and signedness are. Preserving the original type is correct; working around sparse by weakening it is not.
Rostedt later said he had misread the failure as a compiler error and, once it was clear the issue was sparse-only, agreed the kernel should stay unchanged. Separate clarification established that each __bitwise typedef is a distinct restricted type under sparse, so the qualifier is not a single shared tag.
The macro remains as it is. The expected fix is on the sparse side.