On Fri, 3 Aug 2012, Michael Stefaniuc wrote: > Hello! > > On 08/03/2012 04:50 PM, Peter Senna Tschudin wrote: > > There is a patch that removes a semicolon after a switch: > > http://patchwork.linuxtv.org/patch/12987/ > > > > It can be described as: > > > > @@ > > @@ > > switch (...) { } > > -; > > > > There are 230 hits of this on recent Kernel. But I was wondering that > > every semicolon after curly braces may be style error. So I'm thinking > > on a semantic patch for removing semicolon after curly braces. The > > semantic patch: > > > > @@ > > statement S; > > @@ > > S > > -; > > > > works but there are many false positives for empty statements like: > > for (...) > > ; /* <-- I do not want to remove this */ > It's a matter of taste, you could replace it with the empty block {}. > > > How can I avoid empty statements ending on ';'? Any ideas? > > > > My first attempt, that do not work, was: > > @@ > > @@ > > { > > - }; > > + } > > @@ @@ > {...} > - ; > > Legal SmPL but it seems to kill in Wine also ";" after macro calls: > - expect_eq(r.bottom - r.top, height + 8, int, "%d"); > + expect_eq(r.bottom - r.top, height + 8, int, "%d")
This is because it "passes" on parsing the call to expect_eq, because of the int argument. So it thinks there is only a comment before the ; julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
