All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [RFC] xen: Add .astylerc for automated style-formatting
@ 2019-07-18 14:43 Tamas K Lengyel
  2019-07-18 15:02 ` Julien Grall
                   ` (4 more replies)
  0 siblings, 5 replies; 58+ messages in thread
From: Tamas K Lengyel @ 2019-07-18 14:43 UTC (permalink / raw)
  To: xen-devel
  Cc: Tamas K Lengyel, Wei Liu, Konrad Rzeszutek Wilk, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall,
	Stefano Stabellini, Jan Beulich

Using astyle (http://astyle.sourceforge.net) can greatly reduce the overhead of
manually checking and applying style-fixes to source-code. The included
.astylerc is the closest approximation of the established Xen style (including
styles not formally spelled out by CODING_STYLE but commonly requested).

Checking the comment styles are not included in the automation.

Incorporating Xen's exception to the do-while style is only partially possible,
thus a change is proposed to the CODING_STYLE of moving the brace from "do {"
to the next line.

Most of Xen's code-base is non-conforming at the moment: 289 files pass
unchanged, 876 have some style issues.

Ideally we can slowly migrate the entire code-base to be conforming, thus
eliminating the need of discussing and enforcing style issues manually on the
mailinglist.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 .astylerc    | 14 ++++++++++++++
 CODING_STYLE | 18 +++++++++++++++---
 2 files changed, 29 insertions(+), 3 deletions(-)
 create mode 100644 .astylerc

diff --git a/.astylerc b/.astylerc
new file mode 100644
index 0000000000..bbd1d55ddd
--- /dev/null
+++ b/.astylerc
@@ -0,0 +1,14 @@
+style=bsd
+suffix=none
+align-pointer=name
+align-reference=name
+indent=spaces=4
+max-code-length=80
+min-conditional-indent=0
+attach-closing-while
+remove-braces
+indent-switches
+break-one-line-headers
+keep-one-line-blocks
+pad-comma
+pad-header
diff --git a/CODING_STYLE b/CODING_STYLE
index 6cc5b774cf..0b37f7ae4d 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -60,8 +60,8 @@ Bracing
 -------
 
 Braces ('{' and '}') are usually placed on a line of their own, except
-for the do/while loop.  This is unlike the Linux coding style and
-unlike K&R.  do/while loops are an exception. e.g.:
+for the while-part of do/while loops.  This is unlike the Linux coding style
+and unlike K&R.  do/while loops are an exception. e.g.:
 
 if ( condition )
 {
@@ -77,7 +77,8 @@ while ( condition )
     /* Do stuff. */
 }
 
-do {
+do
+{
     /* Do stuff. */
 } while ( condition );
 
@@ -120,3 +121,14 @@ the end of files.  It should be:
  * indent-tabs-mode: nil
  * End:
  */
+
+Automated style formatting using astyle
+---------------------------------------
+
+The .astylerc included in the Xen tree incorporates most of Xen's
+style requirements, except the formatting of comments.
+
+The steps to automatically format a file are:
+
+export ARTISTIC_STYLE_OPTIONS=".astylerc"
+astyle <source or header file>
-- 
2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-08-02 12:58 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-18 14:43 [Xen-devel] [RFC] xen: Add .astylerc for automated style-formatting Tamas K Lengyel
2019-07-18 15:02 ` Julien Grall
2019-07-18 15:14   ` Tamas K Lengyel
2019-07-18 15:42     ` Julien Grall
2019-07-18 17:18       ` Tamas K Lengyel
2019-07-19  8:26         ` Julien Grall
2019-07-18 17:22       ` Tamas K Lengyel
2019-07-19  8:35         ` Julien Grall
2019-07-26 14:58           ` Viktor Mitin
2019-07-26 15:12             ` Julien Grall
2019-07-26 15:23               ` Tamas K Lengyel
2019-07-29  7:31               ` Lars Kurth
2019-07-19  9:00         ` Jan Beulich
2019-07-19 13:10           ` Tamas K Lengyel
2019-07-26 14:52         ` Viktor Mitin
2019-07-18 17:25       ` Tamas K Lengyel
2019-07-18 17:32       ` Tamas K Lengyel
2019-07-18 17:38       ` Tamas K Lengyel
2019-07-18 17:48       ` Tamas K Lengyel
2019-07-19  8:43         ` Julien Grall
2019-07-19 13:00           ` Tamas K Lengyel
2019-07-19 13:11             ` Julien Grall
2019-07-19 13:14               ` Tamas K Lengyel
2019-07-19 13:24                 ` Julien Grall
2019-07-19 13:31                   ` Julien Grall
2019-07-19 13:50                     ` Rich Persaud
2019-07-19 14:47                       ` Julien Grall
2019-07-24 12:53                       ` Lars Kurth
2019-07-19 13:52                     ` Tamas K Lengyel
2019-07-26 14:54         ` Viktor Mitin
2019-07-26 14:49       ` Viktor Mitin
2019-07-26 14:57         ` Julien Grall
2019-07-29 12:19         ` Jan Beulich
2019-07-29 12:49           ` Julien Grall
2019-07-29 13:02             ` Jan Beulich
2019-07-31 16:20               ` Viktor Mitin
2019-08-01  7:37                 ` Jan Beulich
2019-08-01 12:16                   ` Viktor Mitin
2019-08-01 12:43                     ` Jan Beulich
2019-08-01 12:50                     ` Juergen Gross
2019-08-02  8:38                       ` Viktor Mitin
2019-08-02  9:23                         ` Juergen Gross
2019-08-02 11:44                           ` Viktor Mitin
2019-08-02 12:57                             ` Jan Beulich
2019-07-18 15:13 ` Jan Beulich
2019-07-18 15:16   ` Tamas K Lengyel
2019-07-26 14:42   ` Viktor Mitin
2019-07-26 14:50     ` Tamas K Lengyel
2019-07-18 17:58 ` Andrew Cooper
2019-07-18 18:34   ` Tamas K Lengyel
2019-07-19  9:03     ` Julien Grall
2019-07-19 13:05       ` Tamas K Lengyel
2019-07-19 13:34         ` Julien Grall
2019-07-19 13:36           ` Tamas K Lengyel
2019-07-19 13:26 ` Rich Persaud
2019-07-26 15:48 ` Viktor Mitin
2019-07-26 15:54   ` Julien Grall
2019-07-29  7:20     ` Viktor Mitin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.