Skip to contentSkip to conversation

standard.h: Add Z_SYSCALL_HANDLER macro

PATCH In review Himanshu Jha 1 participant 2 messages Jan 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 standard.h: Add Z_SYSCALL_HANDLER macro

This patch allows coccinelle to parse the Z_SYSCALL_HANDLER macro for transformation.

Cc Patrik Flykt <[email protected]>
Cc Flavio Ceolin <[email protected]>

---

Results:

himanshu@himanshu-Vostro-3559:~/zephyr$ cat test.cocci; spatch --sp-file test.cocci drivers/dma/dma_handlers.c
@r@
identifier fn =~ "^_.*";
@@

fn (...)

@script:python@
f << r.fn;
@@

print f
init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
HANDLING: drivers/dma/dma_handlers.c
_impl_dma_start
_impl_dma_stop

 standard.h | 2 ++
 1 file changed, 2 insertions(+)
standard.h +2 -0
index d9200643..032d75c5 100644
@@ -777,4 +777,6 @@ do {									\
 #define SYSCALL_DEFINE6(func, t1, a1, t2, a2, t3, a3, t4, a4, t5, a5, t6, a6) \
     asmlinkage unsigned long func(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6)
 
+#define Z_SYSCALL_HANDLER int xxx
+
 #define KBUILD_MODNAME YACFE_STRING
Signature · 6 lines
2.17.1

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
#1 lore raw
Quoted 7 lines · Himanshu Jha

This patch allows coccinelle to parse the Z_SYSCALL_HANDLER macro for transformation.

Cc Patrik Flykt <[email protected]>
Cc Flavio Ceolin <[email protected]>

---

Please drop this patch Julia.

I misunderstood what you suggested and it works fine using --macro-file flag:

himanshu@himanshu-Vostro-3559:~/zephyr$ cat mymacros.h; spatch --sp-file test.cocci drivers/dma/dma_handlers.c --macro-file mymacros.h
#define Z_SYSCALL_HANDLER int xxx
init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
init_defs: mymacros.h
HANDLING: drivers/dma/dma_handlers.c
_impl_dma_start
_impl_dma_stop

Sorry for the noise.

Signature · 8 lines
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci