Re: [PATCH v2 1/7] remote.c: add braces in anticipation of a follow-up change

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

 



On Fri, Oct 26, 2018 at 12:27 PM Ævar Arnfjörð Bjarmason
<avarab@xxxxxxxxx> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux