Hello,

I've just started trying to use Coccinelle to rewrite code written for
Xlib to use our replacement library XCB instead.

In trying some simple test patches and learning Coccinelle, I
encountered this error:

"""
HANDLING: /tmp/bug.c

previous modification:
MINUS
  >>> xcb_disconnect(conn);

According to environment 0:


current modification:
MINUS
According to environment 0:


Fatal error: exception Failure("rule starting on line 1: already tagged token:
C code context
File "/tmp/bug.c", line 5, column 1,  charpos = 45
    around = 'XCloseDisplay', whole content =   XCloseDisplay (dpy);")
"""

I reduced the semantic patch and the source file to minimal test cases.
The semantic patch:

@@
identifier dpy;
@@
(
-if (dpy) { XCloseDisplay(dpy); }
+xcb_disconnect(conn);
|
-XCloseDisplay(dpy);
+xcb_disconnect(conn);
)

The source file:

static void
Exit(int code)
{
    if (dpy) {
        XCloseDisplay (dpy);
    }
    exit (code);
}


What does this error mean?  Does it indicate an error in Coccinelle or
in my patch?

Thanks for Coccinelle; I can already see that it will work very well for
several tasks I want to accomplish.

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

Reply via email to