on 21/10/2010 17:16 Andriy Gapon said the following:
> on 21/10/2010 17:12 Julia Lawall said the following:
>>> @r@
>>> type S;
>>> identifier x;
>>> typedef cpumask_t;
>>> @@
>>> S { ...
>>> * cpumask_t x;
>>> ...
>>> };
>>
>> If you just want to consider the structure declaration, then there should
>> not be a ; afterwards.
>>
>> The problem with the * generating parse errors and giving a - for the
>> SLIST_ENTRY line and the PCPU_MD_FIELDS line is a bug in Coccinelle.
>> Perhaps you can just ignore them for the moment? If you try to perform a
>> transformation, it will work properly.
>
> Oh, good to know!
> Thank you very much again!
Yes, the following more realistic script works fine modulo some whitespace
issues :)
@r@
type S;
identifier x;
typedef cpumask_t;
typedef cpuset_t;
@@
S { ...
- cpumask_t x;
+ cpuset_t x;
...
}
$ spatch -macro_file cocci_macros.h -sp_file ~/tmp/cpumask_t.2.cocci
/usr/src/sys/sys/pcpu.h
init_defs_builtins: /usr/local/share/coccinelle/standard.h
init_defs: cocci_macros.h
HANDLING: /usr/src/sys/sys/pcpu.h
diff =
--- /usr/src/sys/sys/pcpu.h 2010-10-21 17:04:39.500315390 +0300
+++ /tmp/cocci-output-74288-58e59e-pcpu.h 2010-10-21 17:19:49.963310591
+0300
@@ -153,8 +153,7 @@ struct pcpu {
uint64_t pc_switchtime; /* cpu_ticks() at last csw */
int pc_switchticks; /* `ticks' at last csw */
u_int pc_cpuid; /* This cpu number */
- cpumask_t pc_cpumask; /* This cpu mask */
- cpumask_t pc_other_cpus; /* Mask of all other cpus */
+ cpuset_t pc_cpumask;cpuset_t pc_other_cpus; /* Mask of all
other cpus */
SLIST_ENTRY(pcpu) pc_allcpu;
struct lock_list_entry *pc_spinlocks;
#ifdef KTR
Perhaps my mistake again?
But I can live with this anyways.
--
Andriy Gapon
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)