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

Re: [Xen-devel] Xen Coding style and clang-format

On Wed, Jul 31, 2019 at 8:05 PM Viktor Mitin <viktor.mitin.19@xxxxxxxxx> wrote:
> On Wed, Jul 31, 2019 at 7:27 PM Lars Kurth <lars.kurth.xen@xxxxxxxxx> wrote:
> > Viktor: thank you for spending time on this
> >
> > I added an item to community call tomorrow and CC'ed you in the invite. So 
> > I think what we need to do is figure out a way on how to make the coding 
> > standard enforceable by a coding standard checker such as proposed here. 
> > * It seems there are some undocumented coding standard rules, which are 
> > essentially causing problems with the tool
> > * In addition, the fact that the LLVM coding style is the baseline for the 
> > checks may also create some problems with false standard violations
> >
> > My instinct would be to try and document any undocumented rules on a 
> > scratch space (e.g. google doc), look at differences between Xen and LLVM 
> > formatting style and then make decisions using a voting mechanism to avoid 
> > bike-shedding. In some cases discussion may be necessary though
> >
> > It would be good if you could attend, but I think we can do without you, if 
> > needed
> >
> Lars, thank you for the invitation. I will try to join the call.
> Seems the topic is not a simple one, there are a lot of things to discuss it.

Please be aware that the repo with xen clang-format has been created
under the next link (branch xen-clang-format):

The next script can be used as an example of how to build clang-format:

I've added a couple more updates discussed these days:
- Max line length from 80 to 79 chars;
- Set BreakStringLiterals to false.

Please see the updated xen-clang-format summary below:

Summary of the changes:
- Added 3 new formatting styles to cover all the cases mentioned in
Xen coding style document: Xen, Libxl, Linux;
- Added list of the files and corresponding style name mappings;
- Added indentation according to Xen coding style;
- Added white space formatting according to Xen coding style;
- Added bracing support exception for do/while loops;

Added to clang-format, however, probably this logic should be moved to
python part (see known clang-format limitations above):
- Braces should be omitted for blocks with a single statement. Note:
these braces will be required by MISRA, for example, so it is probably
worth adding such a requirement to the coding style.
- Comments format requirements. Note: //-style comments are defined in
C99 as well, and not just in the case of C++. C99 standard is 20-years

To be added:
- Emacs local variables. Open points: Why to keep emacs local
variables in Xen code? What about other editors' comments (vim)?
- Warning to stderr in the case when ‘unfixable’ line/s detected.

To be fixed:
- Disable // comments;


Xen-devel mailing list



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