alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] use semicolons rather than commas to separate statements
@ 2020-10-11  9:19 Julia Lawall
  2020-10-11  9:19 ` [PATCH 1/8] ASoC: wm8350: " Julia Lawall
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: Julia Lawall @ 2020-10-11  9:19 UTC (permalink / raw)
  To: sound-open-firmware
  Cc: alsa-devel, Valdis Klētnieks, patches, kernel-janitors,
	Takashi Iwai, Joe Perches, Thomas Gleixner, linux-kernel

These patches replace commas by semicolons.  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>

---

 sound/firewire/fireworks/fireworks_pcm.c |    2 +-
 sound/pci/hda/patch_ca0132.c             |    2 +-
 sound/pci/hda/patch_hdmi.c               |    2 +-
 sound/soc/codecs/madera.c                |    4 ++--
 sound/soc/codecs/wm8350.c                |    3 ++-
 sound/soc/intel/boards/bytcr_rt5651.c    |    2 +-
 sound/soc/samsung/snow.c                 |    2 +-
 sound/soc/soc-dapm.c                     |    2 +-
 sound/soc/sof/intel/hda-dsp.c            |    2 +-
 9 files changed, 11 insertions(+), 10 deletions(-)

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

end of thread, other threads:[~2020-10-26 23:48 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-11  9:19 [PATCH 0/8] use semicolons rather than commas to separate statements Julia Lawall
2020-10-11  9:19 ` [PATCH 1/8] ASoC: wm8350: " Julia Lawall
2020-10-12  9:26   ` Charles Keepax
2020-10-11  9:19 ` [PATCH 2/8] ALSA: hda: " Julia Lawall
2020-10-12  6:52   ` Takashi Iwai
2020-10-11  9:19 ` [PATCH 3/8] ASoC: Intel: bytcr_rt5651: " Julia Lawall
2020-10-12  7:14   ` Rojewski, Cezary
2020-10-11  9:19 ` [PATCH 4/8] ALSA: fireworks: " Julia Lawall
2020-10-11 11:32   ` Takashi Sakamoto
2020-10-12  6:53   ` Takashi Iwai
2020-10-11  9:19 ` [PATCH 5/8] ASoC: SOF: Intel: hda: " Julia Lawall
2020-10-11  9:19 ` [PATCH 6/8] ASoC: samsung: snow: " Julia Lawall
2020-10-12  7:12   ` Krzysztof Kozlowski
2020-10-11  9:19 ` [PATCH 7/8] ASoC: madera: " Julia Lawall
2020-10-12  9:26   ` Charles Keepax
2020-10-11  9:19 ` [PATCH 8/8] ASoC: dapm: " Julia Lawall
2020-10-26 23:45 ` [PATCH 0/8] " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).