Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Promela syntax error: Error: incomplete structure ref 'table' saw 'operator: ='

Tags:

spin

promela

I have the following typedefs. Pub type keeps two ints, and the pub_table keeps an array of publishers and an int.

typedef pub{
    int nodeid;
    int tid
};

typedef pub_table{
    pub table[TABLE_SIZE];
    int last
};

Then on line pt.table[pt.last] = p; I'm getting an error saying

" Error: incomplete structure ref 'table' saw 'operator: ='"

if
:: node_type == publisher -> 
        pub p;
        p.nodeid = node_id;
        p.tid = topic_id;
        pt.last = pt.last + 1; 
        pt.table[pt.last] = p;
fi

Unfortunately I cannot see what's wrong on that line?

like image 653
Anton Belev Avatar asked Apr 11 '26 16:04

Anton Belev


1 Answers

The error was because you can't assign a complete typedef variable in one go. I tried to do that by defining local variable pub p; and then after initializing all fields in p, I tried to assign in one go here pt.table[pt.last] = p. I managed to solve it like that:

pt.table[pt.last].nodeid = node_id;
pt.table[pt.last].tid = topic_id;

REF:

The current Spin implementation imposes the following restrictions on the use of typedef objects. It is not possible to assign the value of a complete typedef object directly to another such object of the same type in a single assignment.

like image 112
Anton Belev Avatar answered Apr 14 '26 00:04

Anton Belev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!