[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC] xen: Add .astylerc for automated style-formatting



Hi Tamas,

On 19/07/2019 14:05, Tamas K Lengyel wrote:
On Fri, Jul 19, 2019 at 3:03 AM Julien Grall <julien.grall@xxxxxxx> wrote:

Hi,

On 18/07/2019 19:34, Tamas K Lengyel wrote:
On Thu, Jul 18, 2019 at 11:59 AM Andrew Cooper
<andrew.cooper3@xxxxxxxxxx> wrote:

On 18/07/2019 15:43, Tamas K Lengyel wrote:
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
+{

I'd happily take this adjustment to Xen's style if it helps us end up
with auto-formatter.

Yay!


Also, there are a number of files which are technically Linux style, but
have totally diverged from Linux, and would be easier to move to Xen style.

Do you have an updated .astylerc based on Julien's observations?

Yes, this is it:

style=bsd
suffix=none
align-pointer=name
align-reference=name
indent=spaces=4
max-code-length=80
min-conditional-indent=0
max-continuation-indent=78
attach-closing-while
remove-braces
break-one-line-headers
pad-comma
pad-header

Unfortunately this style does not work with the astyle provided by Debian 
Stretch:

42sh> astyle xen/arch/arm/setup.c
Invalid option file options:
max-continuation-indent=78
attach-closing-while
remove-braces
For help on options type 'astyle -h'

Artistic Style has terminated

I'm already on buster and it works fine. Perhaps we'll need to specify
a minimum version of astyle.

That would be good.



Also, I needed to copy the .astylerc in $(HOME) in order to use the style. It is
probably worth considering implementing a wrapper that set
ARTISTIC_STYLE_OPTIONS and call astyle to keep everthing in Xen internals.

You don't have to copy to to $(HOME), as I point out by the addition
to the CODING_STYLE this works from the Xen root folder:

export ARTISTIC_STYLE_OPTIONS=".astylerc"
astyle <source or header file>

I misread your first e-mail. Sorry for the noise.




With this it's down to 860 files that are formatted.

Do you mind providing the new diff?

I've updated the same gist with the new diff, the url is the same:
https://gist.github.com/tklengyel/c5cac14a0d57f119dd7747a1be6fb260

Do you mind to create a new gist everytime? This would help to see the difference before and after at least until I build a new version of astyle :).

Cheers,

--
Julien Grall

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.