Hi Julia,

Sorry, It's my mistake.
I didn't notice that the original code had already match the code I wanna convert to.
I wast too focus on the screen output without checking the  output file.

These rules Does work.

I'm very Sorry for wasting your time.


Thanks.


------------------------------------------------------------------
From: Julia Lawall
Sent: Thursday, June 14, 2012 7:03 PM
To: yafo lee
Cc: [email protected]
Subject: Re: [Cocci] About sizeof() and structure type.

You need to give some information about the C file.  With the following C
file, everything is fine for me.

julia

int main () {
 adpt_type *adpt_var = NULL;
 pci_set_drvdata(foo, adpt_var);
}

static driver_t alx_driver = {
      e1, e2, e3
};

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


On Thu, 14 Jun 2012, yafo lee wrote:

Hi guys, I write the following file to change some variable's definition:

@adpt_name@
type adpt_type;
identifier  adpt_var;
@@
adpt_type *adpt_var = ...;
...
- pci_set_drvdata(..., adpt_var);

@@
type adpt_name.adpt_type;
expression e1, e2, e3;
@@
static driver_t alx_driver = {
       e1, e2,
- e3,
+ sizeof(adpt_type),
};
//"+ adpt_type aaa;"

I have to uncomment the latest statement  to make changes to "alx_driver".
But I don't want the redundant  variable "aaa";

Is there any res restrictions  on "sizeof()" ?
How can I change my rule to change "alx_driver" definition without adding
"adpt_type aaa"?

Thanks

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


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

Reply via email to