Hi checkpatch maintainers, On Tue, 03 Dec 2024 at 10:19:34, Patchwork <patchwork@xxxxxxxxxxxxxxxxxxxxxx> wrote: > == Series Details == > > Series: compiler.h: refactor __is_constexpr() into is_const{,_true,_false}() > URL : https://patchwork.freedesktop.org/series/142040/ > State : warning > > == Summary == > > Error: dim checkpatch failed > 65c5a73cbdd2 compiler.h: add statically_false() > 25d8e6973c58 compiler.h: add is_const() as a replacement of __is_constexpr() > -:75: CHECK:SPACING: spaces preferred around that '*' (ctx:WxO) > #75: FILE: include/linux/compiler.h:349: > + _Generic(0 ? (void *)(long)(x) : (char *)0, char *: 1, void *: 0) > ^ > > -:75: ERROR:SPACING: spaces required around that ':' (ctx:OxW) > #75: FILE: include/linux/compiler.h:349: > + _Generic(0 ? (void *)(long)(x) : (char *)0, char *: 1, void *: 0) > ^ > > -:75: CHECK:SPACING: spaces preferred around that '*' (ctx:WxO) > #75: FILE: include/linux/compiler.h:349: > + _Generic(0 ? (void *)(long)(x) : (char *)0, char *: 1, void *: 0) > ^ > > -:75: ERROR:SPACING: spaces required around that ':' (ctx:OxW) > #75: FILE: include/linux/compiler.h:349: > + _Generic(0 ? (void *)(long)(x) : (char *)0, char *: 1, void *: 0) > ^ > > -:75: CHECK:CAMELCASE: Avoid CamelCase: <_Generic> > #75: FILE: include/linux/compiler.h:349: > + _Generic(0 ? (void *)(long)(x) : (char *)0, char *: 1, void *: 0) I submitted a patch which contained a _Generic() selection [1] and got above checkpatch warnings and errors. Before blindly fixing those, I wanted to discuss this with you because it looks like a false positive to me. I think that the _Generic() selection should follow the switch case or the goto label style, that is to say, no space before the colon. For example: _Generic(foo, char: 0, short: 1, char *: 2, short *: 3, default: 4); instead of: _Generic(foo, char : 0, short : 1, char * : 2, short * : 3, default : 4); The fact is that the introduction of _Generic in the kernel is fairly recent (can be used since July 2020 following the bump to GCC 4.9 in [2]). So I guess that it is just that the _Generic()s where never considered in checkpatch.pl. I would have liked to send a fix, but I am not fluent in perl, so the best I have to offer is this report. Let me know if it is acceptable to ignore those checkpatch errors :) [1] compiler.h: add is_const() as a replacement of __is_constexpr() Link: https://lore.kernel.org/intel-gfx/20241203-is_constexpr-refactor-v1-2-4e4cbaecc216@xxxxxxxxxx/ [2] commit 6ec4476ac825 ("Raise gcc version requirement to 4.9") Link: https://git.kernel.org/torvalds/c/6ec4476ac825 Yours sincerely, Vincent Mailhol