[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Xen Coding style and clang-format
Hi all, I would like to bring up a discussion about a Xen-checker tool, the development of which has been temporarily suspended. The idea of this tool is to use the clang-format approach as a base for Xen ‘checkpatch’ process. The new tool consists of modified clang-format binary and modified clang-format-diff.py python script to automate Xen patches format checking and reformatting. The tool can be used as a pre-commit hook to check and format every patch automatically. Xen checker is currently in a state of testing, but there are controversial points regarding the coding style that I would like to discuss with the community and make a unanimous decision on the correctness of the formatting. I would like to know your opinion on the following coding style cases. Which option do you think is correct? 1) Function prototype when the string length is longer than the allowed one -static int __init -acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header, - const unsigned long end) +static int __init acpi_parse_gic_cpu_interface( + struct acpi_subtable_header *header, const unsigned long end) 2) Wrapping an operator to a new line when the length of the line is longer than the allowed one - if ( table->revision > 6 - || (table->revision == 6 && fadt->minor_revision >= 0) ) + if ( table->revision > 6 || + (table->revision == 6 && fadt->minor_revision >= 0) ) 3) define code style -#define ALLREGS \ - C(r0,r0_usr); C(r1,r1_usr); C(r2,r2_usr); C(r3,r3_usr); \ - C(cpsr,cpsr) +#define ALLREGS \ + C(r0, r0_usr); \ + C(r1, r1_usr); \ + C(r2, r2_usr); \ 4) Comment style - /* PC should be always a multiple of 4, as Xen is using ARM instruction set */ + /* PC should be always a multiple of 4, as Xen is using ARM instruction set + */ Please find below the repo created by Viktor Mitin with xen clang- format under the next link (branch xen-clang-format): https://github.com/xen-troops/llvm-project/tree/xen-clang-format The next script can be used as an example of how to build clang-format: https://github.com/viktor-mitin/xen-clang-format-example/blob/master/build_clang_format.sh Regards, Anastasiia Lukianenko
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |