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

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



On Fri, Jul 26, 2019 at 6:54 PM Julien Grall <julien.grall@xxxxxxx> wrote:
>
>
>
> On 26/07/2019 16:48, Viktor Mitin wrote:
> > Hi All,
> >
> > On Thu, Jul 18, 2019 at 5:45 PM Tamas K Lengyel <tamas@xxxxxxxxxxxxx> wrote:
> >
> >> Checking the comment styles are not included in the automation.
> >
> > The same about clang-format. Checking the comment styles is not supported.
> > It seems this is not code format checker task to parse and modify the
> > code comments...
>
> Are you sure about your statement? Looking at the diff you provided [1],
> clang-format is clearly trying to alter the comments.
>
> But comments flow are equally important as the code. This is part of the 
> coding
> style afterall.
>
> [1]
> https://raw.githubusercontent.com/viktor-mitin/xen-clang-format-example/master/0001-clang-format-checkpatch-output-example.patch

Clang-format supports only basic indentation of C89 comments.

--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -51,15 +51,15 @@ void arch_livepatch_apply(struct livepatch_func *func)
         *(new_ptr + i) = insn;

     /*
-    * When we upload the payload, it will go through the data cache
-    * (the region is cacheable). Until the data cache is cleaned, the data
-    * may not reach the memory. And in the case the data and instruction cache
-    * are separated, we may read invalid instruction from the memory because
-    * the data cache have not yet synced with the memory. Hence sync it.
-    */
+     * When we upload the payload, it will go through the data cache
+     * (the region is cacheable). Until the data cache is cleaned, the data
+     * may not reach the memory. And in the case the data and instruction cache
+     * are separated, we may read invalid instruction from the memory because
+     * the data cache have not yet synced with the memory. Hence sync it.
+     */

So it addresses Xen Coding Style requirements partially:

From CODING_STYLE:
"
Multi-line comment blocks should start and end with comment markers on
separate lines and each line should begin with a leading '*'.

/*
 * Example, multi-line comment block.
 *
 * Note beginning and end markers on separate lines and leading '*'.
 */
"

However, the next comments rules are not supported for now and can be
added into implementation later.

From CODING_STYLE:
"
Only C style /* ... */ comments are to be used.  C++ style // comments
should not be used.  Multi-word comments should begin with a capital
letter.  Comments containing a single sentence may end with a full
stop; comments containing several sentences must have a full stop
after each sentence.
"

BTW, is there an actual reason not to support C99 comments ( // ) ?

Thanks

>
> >
> > Thanks
> >
>
> --
> 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®.