4

I am new to coccinelle and trying to find how can I change argument types in function signatures.

I have a function that takes a pointer of type T1 as an argument

int fn(T1* p)

I would like to change the function to take an argument of type T2 as follows

int fn(T2* p)

Can someone point me to an example that changes argument type . I am able to find examples to changer order and number of args.

Thanks in advance.

pk-sk
  • 41
  • 1

1 Answers1

1

I recently had to do something similar.

@ change_arg_type @
identifier func;
identifier arg;
type T = int;
@@

func(...,
- T arg
+ float arg
, ...) { ... }

Something like that should do the trick.

japk
  • 619
  • 6
  • 10