On Tue, 3 Apr 2012, Mansour Moufid wrote:

On Tue, Apr 3, 2012 at 1:28 PM, ron minnich <[email protected]> wrote:
You not only fixed my problem you anticipated my next question :-)

struct a {
       int b;
       int c;
};

struct a A {
       .b = 5,
       .c = 10,
};

I'm failing on the rule for the second case ... I think you answered
me but I must have misunderstood.
@@
expression E;
@@
struct a {
...
-.b = E;
...
};

Julia gave the answer. ;) For declarations you can use ... and for
initialization use the explicit struct layout:

@@
@@
 struct a {
 ...
- int b;
 ...
 };

@@
expression E1, E2;
identifier x;
@@
 struct a x = {
- .b = E1,
 .c = E2
 };

You don't need the .c line unless you want to be sure that the c field is initialized as well.

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

Reply via email to