Skip to contentSkip to conversation

Checking the usage of a SmPL disjunction within a sizeof()

Cocci Markus Elfring 2 participants 3 messages Aug 28, 2020 – Aug 29, 2020 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,

I have tried another tiny script variant out for the semantic patch language (according to the software combination “Coccinelle 1.0.8-00159-g730dbb03”).

@display@
identifier array, instance;
type T;
@@
*sizeof( \( T \| *(instance->array) \) )

elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch --parse-cocci sizeof-test-20200828.cocci …
minus: parse error:
File "sizeof-test-20200828.cocci", line 5, column 17, charpos = 66
around = '*',
whole content = *sizeof( \( T \| *(instance->array) \) )

May I expect that such a SmPL disjunction should also work?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#1 lore raw
Quoted 11 lines · Markus Elfring

Hello,

I have tried another tiny script variant out for the semantic patch language (according to the software combination “Coccinelle 1.0.8-00159-g730dbb03”).

@display@
identifier array, instance;
type T;
@@
*sizeof( \( T \| *(instance->array) \) )

No, you can't compbine a type and an expression in a disjunction.

julia

Quoted 9 lines

elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch --parse-cocci sizeof-test-20200828.cocci …
minus: parse error:
File "sizeof-test-20200828.cocci", line 5, column 17, charpos = 66
around = '*',
whole content = *sizeof( \( T \| *(instance->array) \) )

Quoted 9 lines

May I expect that such a SmPL disjunction should also work?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Re: [Cocci] Usage of a SmPL disjunction with sizeof()

Quoted 11 lines · Markus Elfring
Quoted 1 line

No, you can't compbine a type and an expression in a disjunction.

Such an information can be reconsidered once more
because the following script variant for the semantic patch language gets accepted by the Coccinelle software.

@display@
identifier instance, member;
type T;
@@
*\( sizeof(T) \| sizeof(*(instance->member)) \)

The above is fine. Both branches of the disjunction are expressions.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci