It seems spatch will transform uses but not initialized declarations.
Is this a known defect or limitation or a bad spatch input file?

$ spatch -version
spatch version 1.0.0-rc7 with Python support and with PCRE support
$ cat bool.cocci
@@
bool b;
@@
-b = 0;
+b = false;
@@
bool b;
@@
-b = 1;
+b = true;
$ cat test.c
static int main(int argc, char** argv)
{
        bool a = 1;
        bool b = 0;
        a = 0;
        b = 1;
        return 0;
}
$ spatch -sp_file bool.cocci test.c
init_defs_builtins: /usr/local/share/coccinelle/standard.h
HANDLING: test.c
diff = 
--- test.c
+++ /tmp/cocci-output-27341-10b631-test.c
@@ -2,7 +2,7 @@ static int main(int argc, char** argv)
 {
        bool a = 1;
        bool b = 0;
-       a = 0;
-       b = 1;
+       a = false;
+       b = true;
        return 0;
 }
$ 


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

Reply via email to