On Fri, Oct 26, 2018 at 12:27 PM Ævar Arnfjörð Bjarmason
<ava...@gmail.com> wrote:
>
> The CodingGuidelines say "When there are multiple arms to a
> conditional and some of them require braces, enclose even a single
> line block in braces for consistency.". Fix the code in
> match_explicit() to conform.

A tangent from a bystander:

This sounds like a lovely transformation that we'd want to
apply to the whole tree (Who wouldn't want to conform to
our self-imposed coding guidelines?),
so I tried coming up with a coccinelle patch to do that,
but I did not manage to produce such a patch, yet.
So far I am at

@@
expression E1;
statement S1, S2;
@@
 {<...
 if (E1) {
   S1;
-} else
+} else {
  S2;
+}
 ...>}

but this doesn't transform the simple test program that I wrote.

> While I'm at it change the if/else if/else in guess_ref() to use
> braces. This is not currently needed, but a follow-up change will add
> a new multi-line condition to that logic.

The patch looks good.

Stefan

Reply via email to