public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] convert comma to semicolon
@ 2013-08-08 19:32 Julia Lawall
  2013-08-08 19:32 ` [PATCH] trivial: " Julia Lawall
  2013-08-08 19:43 ` [PATCH] " Joe Perches
  0 siblings, 2 replies; 6+ messages in thread
From: Julia Lawall @ 2013-08-08 19:32 UTC (permalink / raw)
  To: trivial; +Cc: kernel-janitors, linux-kernel

These patches result from the following semantic patch
(http://coccinelle.lip6.fr/), which checks for expression statements
separated by , rather than by ;.  The rule is quite conservative in that it
only finds cases where this pattern appears after a statement that ends
with ;, to ensure that the expression statements do not form an if branch
or loop body.  Iteration is used to treat arbitrary sequences of commas.

// <smpl>
@initialize:ocaml@

let tbl = Hashtbl.create(100)

let add_if_not_present file try let _ = Hashtbl.find tbl file in ()
with Not_found ->
   Hashtbl.add tbl file ();
   let it = new iteration() in
   it#set_files [file];
   it#register()

@script:ocaml@
@@
Hashtbl.clear tbl

@r@
expression e1,e2,e;
position p1,p2;
type T;
identifier i;
@@

(
T i = ...;
|
 e;
)
 e1,@p1 e2@p2;

@script:ocaml@
p1 << r.p1;
p2 << r.p2;
@@

if (List.hd p1).line = (List.hd p2).line
then include_match false
else add_if_not_present ((List.hd p1).file)

@@
expression e1,e2;
position r.p1;
@@

 e1
- ,@p1
+ ;
  e2;
// </smpl>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-09 15:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 19:32 [PATCH] convert comma to semicolon Julia Lawall
2013-08-08 19:32 ` [PATCH] trivial: " Julia Lawall
2013-08-09  7:39   ` Richard Genoud
2013-08-09 15:16     ` Julia Lawall
2013-08-08 19:43 ` [PATCH] " Joe Perches
2013-08-08 19:45   ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox