[Cocci] Change function invocations argument

Michael Stefaniuc mstefani at redhat.com
Mon Dec 22 14:33:49 CET 2014


On 12/21/2014 03:01 PM, Julia Lawall wrote:
> 
> 
> On Sun, 21 Dec 2014, Eliseo Martínez wrote:
> 
>> That’s right. I wanted to remove external parentheses, which
>> wasn’t done if employing only e2/e3. I hadn’t realized using
>> (e2)/(e3) would take care of both cases (with/without
>> parentheses), though.
>> 
>> BTW, is there an easy way to remove **all** unneeded parentheses,
>> project wide?
> 
> Probably not.  You could remove all parentheses, but that might
> risk removing some needed ones.  On the other hand, Coccinelle does
> know something about precedednce, so you could try:
> 
> -( e1 -)
> 
> and see what happens.  Probably it will do more than you expect,
> though.
Though it is easy to validate that the generated patch is truly a
no-op. I use a sha1sum on the generated object files without and with
the patch and compare those. Of course there is the danger that the
code touched was ifdef'ed out so some developer discretion is still
needed.

bye
	michael


More information about the Cocci mailing list