[cfe-dev] Configure `clang-format` to pass Linux's `checkpatch.pl` checks

Miguel Sánchez de León Peque via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 1 11:28:07 PDT 2018


Hi,

I am using `clang-format` to automatically format all the C code I 
produce. Then, in my CI pipelines, I am executing Linux's 
`checkpatch.pl`[0] script to verify the style matches the one expected 
by the Linux kernel style guide[1].

Until very recently, that worked just fine, but I have now found a case 
were it does not.

The question I have is better explained (and includes the required C 
source code) in Stack Overflow:

https://stackoverflow.com/questions/53094436/

Basically, I am initializing an array of structs and `clang-format` is 
breaking braces "{", but that is something `chekcpatch.pl` would not 
allow. I am unable to find a `clang-format` configuration that prevents 
those breaks before the braces.

Thanks in advance for your help,

Miguel

[0]: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl
[1]: https://www.kernel.org/doc/html/v4.10/process/coding-style.html



More information about the cfe-dev mailing list