lkml.org 
[lkml]   [2012]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] scripts/coccinelle/misc/semicolon.cocci: Add unneeded semicolon test
From
Date
On Sat, 2012-12-08 at 15:34 -0200, Peter Senna Tschudin wrote:
> This semantic patch looks for semicolons that can be removed without
> changing the semantics of the code. The confidence is moderate
> because there are some false positives on cases like:
>
> b/drivers/mmc/host/cb710-mmc.c:589
> break;
> case MMC_POWER_UP:
> default:
> - /* ignore */;
> }
[]
> diff --git a/scripts/coccinelle/misc/semicolon.cocci b/scripts/coccinelle/misc/semicolon.cocci
[]
> +@r1@
> +statement S;
> +position p1;
> +position p != {r_default.p, r_case.p};
> +identifier label;
> +@@
> +(
> +label:;
> +|
> +S@p1;@p
> +)
> +

I believe this also fails on this case:

void some_func(...)
{
...
if (foo)
goto exit;
...

exit:
;
}

where gcc needs a semicolon after a label before a function exit.



\
 
 \ /
  Last update: 2012-12-08 19:01    [W:0.141 / U:0.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site