[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1440869412-4899-1-git-send-email-Julia.Lawall@lip6.fr>
Date: Sat, 29 Aug 2015 19:30:04 +0200
From: Julia Lawall <Julia.Lawall@...6.fr>
To: linux-kernel@...r.kernel.org
Cc: joe@...ches.com, kernel-janitors@...r.kernel.org,
devel@...verdev.osuosl.org, HPDD-discuss@...ts.01.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andreas Dilger <andreas.dilger@...el.com>,
Oleg Drokin <oleg.drokin@...el.com>
Subject: [PATCH 0/8] put constant on the right of binary operator
Typically, constants appear to the right of binary operators. The complete
semantic patch that performs this change is as follows
(http://coccinelle.lip6.fr/). In particular, it doesn't change long
sequences of bit ors, or comparisons that are checking that some
expression has a value that is between two other values.
// <smpl>
@disable bitor_comm, neg_if_exp@
constant c,c1;
local idexpression i;
expression e,e1,e2;
binary operator b = {==,!=,&,|};
type t;
@@
(
c b (c1)
|
sizeof(t) b e1
|
sizeof e b e1
|
i b e1
|
c | e1 | e2 | ...
|
c | (e ? e1 : e2)
|
- c
+ e
b
- e
+ c
)
@disable gtr_lss, gtr_lss_eq, not_int2@
constant c,c1,c2;
expression e,e1,e2;
binary operator b;
binary operator b1 = {<,<=},b2 = {<,<=};
binary operator b3 = {>,>=},b4 = {>,>=};
local idexpression i;
type t;
@@
(
c b c1
|
sizeof(t) b e1
|
sizeof e b e1
|
(e1 b1 e) && (e b2 e2)
|
(e1 b3 e) && (e b4 e2)
|
i b e
|
- c < e
+ e > c
|
- c <= e
+ e >= c
|
- c > e
+ e < c
|
- c >= e
+ e <= c
)
// </smpl>
---
drivers/staging/lustre/include/linux/lnet/types.h | 2 +-
drivers/staging/lustre/lnet/lnet/lib-ptl.c | 4 ++--
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 8 ++++----
drivers/staging/lustre/lustre/libcfs/hash.c | 6 +++---
drivers/staging/lustre/lustre/llite/dir.c | 10 +++++-----
drivers/staging/lustre/lustre/llite/file.c | 10 +++++-----
drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +-
drivers/staging/lustre/lustre/obdclass/cl_object.c | 4 ++--
drivers/staging/lustre/lustre/osc/osc_page.c | 2 +-
drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +-
drivers/staging/lustre/lustre/ptlrpc/import.c | 10 +++++-----
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 2 +-
12 files changed, 31 insertions(+), 31 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists