Skip to main content

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

Thanks, Matthew, for showing us the whole code base with WebKit format.

I guess I still have a concern that the tool prefers to put
conditional statements all on one line and that can (arguably, I
suppose) make those statements a lot harder to read.

For example:

https://github.com/mgaudet/omr/blob/clang-format-webkit-all/compiler/z/codegen/CompareAnalyser.cpp#L129

or, say:

https://github.com/mgaudet/omr/blob/clang-format-webkit-all/compiler/optimizer/PartialRedundancy.cpp#L1112


We could take the position that this reformatting will encourage us to
reformat our conditional nests to make them easier to read, and that
would be an excellent long term goal. I'm worried, however, that such
reformatting could be a rich source of latent bugs as I don't believe
we have particularly strong conditional path coverage in the tests we
typically run on commits. There are also quite a large number of such
cases and that code will be much harder to read in the meantime.

clang-format doesn't appear to have configuration options to break up
the conditionals in a more readable way. The only way I see around it
would be to annotate every single such complex conditional instance with
"don't format" directives. That's unpleasant, and it would be a LOT of
manual work, but at least it would box the problem in a way that leaves
the code virtually as readable as it currently is and give us a way to
measure progress towards "betterness".

Any other suggestions for how we might resolve this challenge we've
got? I would love to hear other options.

Although I'd very much like to put this topic to bed, I won't put that
desire ahead of having code the community can actually work with. So
I think we need to work this out before we can pull the trigger on
reformatting the code.

What do you think?

--mark






From:        Matthew Gaudet <magaudet@xxxxxxxxxxxxxxxxxx>
To:        omr developer discussions <omr-dev@xxxxxxxxxxx>
Date:        2016/10/14 01:37 PM
Subject:        Re: [omr-dev] our coding standard
Sent by:        omr-dev-bounces@xxxxxxxxxxx




On 10/5/2016 11:52 AM, Mark Stoodley wrote:
> +1 and thanks Charlie.
>
> One of the things I'd like to see in that issue is to preview the entire
> code base with WebKit and then look at some specific areas to see how well
> it deals with deep conditional statements.
>
>

Sorry, this got dropped by accident. I've prepared that branch today:

https://github.com/mgaudet/omr/tree/clang-format-webkit-all:

commit 374f7c9caa71d26f92d2ae64380f37fa8d1e1021
Author: Matthew Gaudet <magaudet@xxxxxxxxxx>
Date:   Fri Oct 14 13:03:37 2016 -0400

    Reformat *.h, *.c, *.cpp, *.hpp to Webkit style.



$ cat .clang-format
BasedOnStyle: webkit
SortIncludes: false


_______________________________________________
omr-dev mailing list
omr-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/omr-dev





Back to the top