Re: [cocci] Can we match a known macro by macro name instead of expanded function name?

Julia Lawall <[email protected]>
Newsgroups fr.inria.cocci
Message-ID <[email protected]>
Sorry, I don't think it is going to work with the attribute in the short
term.

I succeeded with the following:

.cocci

@r@
symbol SYSCALL_DEFINE1;
identifier fn;
type t;
position p;
@@
fn(int SYSCALL_DEFINE1, ...) {@p ... }

// or put the corresponding python code
@script:ocaml@
p << r.p;
@@

Printf.printf "line: %d\n" (List.hd p).line

----------------------------------------------

standard.h

#define SYSCALL_DEFINE1(func, t1, a1) \
    int func(int SYSCALL_DEFINE1, t1 a1)

----------------------------------------------

.c

SYSCALL_DEFINE1(foo,int,x) { return 0; }

----------------------------------------------

Using * was a bad idea.  You can't transform macro expanded code.

julia
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.