Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [omr-dev] our coding standard

Matthew Gaudet <magaudet@xxxxxxxxxxxxxxxxxx> writes:
> On 8/22/2016 1:47 PM, Mark Stoodley wrote:
>
>     I would like to propose we move to a completely different coding
>     standard that can be automatically applied by a tool like
>     clang-format: maybe something like LLVM or WebKit. With a tool
>     automatically applying the formatting, the risk of new bugs being
>     introduced is low whereas the benefit of a unified, consistent,
>     and automatically enforced coding standard is high
>
> Just a +1 to the idea of adopting an existing style.

+1. Adopting an existing standard can only help OMR's accessiblity.

You can take a look at the built in clang-format configs with:

    clang-format -style=<STYLE> -dump-config

build in styles are: LLVM, Google, Chromium, Mozilla, WebKit.

I'm just going to list a few thoughts about the LLVM style:

* #include ordering should match the OMR guidelines, ie system headers
   first, then OMR headers, all alphabetized. This might need tweaking.

* Our style is to indent using tabs. All built in styles use only
  spaces. Maybe this is something we want to adopt?

* Our style is to wrap braces in function/class/enum/etc definitions.
  Most (save Mozilla) leave braces on the same line.

* Are we willing to give up our punctuation-first initializer-list
  style? (vote for yes)

As well, are we talking about running the formatter on the entire
codebase and committing the result? Are we interested in just running
the formatter on new contributions? If we wanted to run clang-format
only on new commits, it looks relatively easy to set up. Check out the
bottom of http://clang.llvm.org/docs/ClangFormat.html

-  Robert


Back to the top