On Mon, 2 Jul 2012, yafo lee wrote:

Hi guys,
I know there must be a variable of type "struct alx_adapter*" in a function.
  sometimes it is in the funcion's argument list such as:
       int bar(struct alx_adapter  *adpt) {
         ...
     }
  sometimes it is in the function's body:
      int foo(int a{
         ...
          struct alx_adapter  *adpt= NULL;
          ...
     }

I want to write a single rule to find the name of that pointer, and using it, such as:

  @@
  statement S1;
  statement S2;
  @@
  f(...) {
     ... when != S1
     + printf("%s: hello world\n", adpt->name);
    S2
    ... when any
  }

  Is that possible? how to achieve that?

I don't think it can be done in a single rule.

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

Reply via email to