xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Xen Coding style and clang-format
@ 2020-09-30  9:18 Anastasiia Lukianenko
  2020-09-30  9:57 ` Jan Beulich
  0 siblings, 1 reply; 16+ messages in thread
From: Anastasiia Lukianenko @ 2020-09-30  9:18 UTC (permalink / raw)
  To: xen-devel
  Cc: Artem Mygaiev, committers, julien, vicooodin, viktor.mitin.19,
	Volodymyr Babchuk

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-10-23  9:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30  9:18 Xen Coding style and clang-format Anastasiia Lukianenko
2020-09-30  9:57 ` Jan Beulich
2020-09-30 10:24   ` George Dunlap
2020-10-01  9:06     ` Anastasiia Lukianenko
2020-10-01 10:06       ` George Dunlap
2020-10-07 10:19         ` Anastasiia Lukianenko
2020-10-08  1:07           ` Stefano Stabellini
2020-10-12 14:37             ` Anastasiia Lukianenko
2020-10-12 18:09           ` George Dunlap
2020-10-13 12:30             ` Jan Beulich
2020-10-16  9:42               ` Anastasiia Lukianenko
2020-10-16 10:23                 ` Julien Grall
2020-10-16 11:37                   ` Artem Mygaiev
2020-10-19 18:07                     ` Stefano Stabellini
2020-10-20 17:13                       ` Julien Grall
2020-10-23  9:39                         ` Anastasiia Lukianenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).