From: Julia Lawall <Julia.Lawall@inria.fr>
To: linux-security-module@vger.kernel.org
Cc: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>,
"Joe Perches" <joe@perches.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
kernel-janitors@vger.kernel.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
linux-afs@lists.infradead.org
Subject: [PATCH 0/5] net: use semicolons rather than commas to separate statements
Date: Sun, 11 Oct 2020 12:34:53 +0200 [thread overview]
Message-ID: <1602412498-32025-1-git-send-email-Julia.Lawall@inria.fr> (raw)
These patches replace commas by semicolons. Commas introduce
unnecessary variability in the code structure and are hard to see.
This was done using the Coccinelle semantic patch
(http://coccinelle.lip6.fr/) shown below.
This semantic patch ensures that commas inside for loop headers will
not be transformed. It also doesn't touch macro definitions.
Coccinelle ensures that braces are added as needed when a
single-statement branch turns into a multi-statement one.
This semantic patch has a few false positives, for variable
delcarations such as:
LIST_HEAD(x), *y;
The semantic patch could be improved to avoid these, but for the
moment they have been removed manually (2 occurrences).
// <smpl>
@initialize:ocaml@
@@
let infunction p =
(* avoid macros *)
(List.hd p).current_element <> "something_else"
let combined p1 p2 =
(List.hd p1).line_end = (List.hd p2).line ||
(((List.hd p1).line_end < (List.hd p2).line) &&
((List.hd p1).col < (List.hd p2).col))
@bad@
statement S;
declaration d;
position p;
@@
S@p
d
// special cases where newlines are needed (hope for no more than 5)
@@
expression e1,e2;
statement S;
position p != bad.p;
position p1;
position p2 :
script:ocaml(p1) { infunction p1 && combined p1 p2 };
@@
- e1@p1,@S@p e2@p2;
+ e1; e2;
@@
expression e1,e2;
statement S;
position p != bad.p;
position p1;
position p2 :
script:ocaml(p1) { infunction p1 && combined p1 p2 };
@@
- e1@p1,@S@p e2@p2;
+ e1; e2;
@@
expression e1,e2;
statement S;
position p != bad.p;
position p1;
position p2 :
script:ocaml(p1) { infunction p1 && combined p1 p2 };
@@
- e1@p1,@S@p e2@p2;
+ e1; e2;
@@
expression e1,e2;
statement S;
position p != bad.p;
position p1;
position p2 :
script:ocaml(p1) { infunction p1 && combined p1 p2 };
@@
- e1@p1,@S@p e2@p2;
+ e1; e2;
@@
expression e1,e2;
statement S;
position p != bad.p;
position p1;
position p2 :
script:ocaml(p1) { infunction p1 && combined p1 p2 };
@@
- e1@p1,@S@p e2@p2;
+ e1; e2;
@r@
expression e1,e2;
statement S;
position p != bad.p;
@@
e1 ,@S@p e2;
@@
expression e1,e2;
position p1;
position p2 :
script:ocaml(p1) { infunction p1 && not(combined p1 p2) };
statement S;
position r.p;
@@
e1@p1
-,@S@p
+;
e2@p2
... when any
// </smpl>
---
net/ipv4/tcp_input.c | 3 ++-
net/ipv4/tcp_vegas.c | 8 ++++----
net/ipv6/calipso.c | 2 +-
net/mac80211/debugfs_sta.c | 2 +-
net/rxrpc/recvmsg.c | 2 +-
net/tls/tls_main.c | 2 +-
6 files changed, 10 insertions(+), 9 deletions(-)
next reply other threads:[~2020-10-11 11:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-11 10:34 Julia Lawall [this message]
2020-10-11 10:34 ` [PATCH 1/5] rxrpc: use semicolons rather than commas to separate statements Julia Lawall
2020-10-12 7:00 ` David Howells
2020-10-12 7:03 ` Julia Lawall
2020-10-11 10:34 ` [PATCH 2/5] mac80211: " Julia Lawall
2020-10-11 10:34 ` [PATCH 3/5] tcp: " Julia Lawall
2020-10-11 10:34 ` [PATCH 4/5] net/ipv6: " Julia Lawall
2020-10-11 20:05 ` Paul Moore
2020-10-11 10:34 ` [PATCH 5/5] net/tls: " Julia Lawall
2020-10-14 0:15 ` [PATCH 0/5] net: " Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1602412498-32025-1-git-send-email-Julia.Lawall@inria.fr \
--to=julia.lawall@inria.fr \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=valdis.kletnieks@vt.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox