On Wed, 4 Apr 2012, ron minnich wrote:

On Wed, Apr 4, 2012 at 10:20 AM, Julia Lawall <[email protected]> wrote:

That one has an else, and there is no else in your pattern.

julia

So it looks like removing a given instance of an if involves the following:
1. if (x) {...}
2. if (x) S
3. if (x) S else
4. if (x) {...} else
5. else if (x) {...}
6. else if (x) S

is that about right? Now when I try this:

No.

If you say

-if (x) S1 else
 S2

and

-if (x) S

That should take care of everything.

The isomorpshim that I mentioned previously only applies when else and S2 have the same annotation.

julia

@@
@@
-if (IS_I865G(...)) {...}  else

[rminnich@myhost tmp]$ spatch --sp-file fixcalls.cocci intel_display.c
init_defs_builtins: /usr/local/share/coccinelle/standard.h
38 40
Fatal error: exception Failure("minus: parse error:
= File "fixcalls.cocci", line 4, column 0,  charpos = 38
   around = '@@', whole content = @@
")

I've tried a number of variations on this theme but I'm stumped on how
to manage these else functions.

thanks

ron

_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to