Checking size determinations with SmPL
Hello,
The following code example gets accepted by the Coccinelle software.
@display1@
expression* e;
type t;
@@
*\( sizeof(t) \| sizeof(*e) \)
Would it be nice if another script variant can work together with such a SmPL disjunction also in this way?
@display2@
expression* e;
type t;
@@
*sizeof( \( t \| *e \) )
elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch --parse-cocci check_sizeof2.cocci …
minus: parse error:
File "check_sizeof2.cocci", line 5, column 17, charpos = 54
around = '*',
whole content = *sizeof( \( t \| *e \) )
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 11 lines · Markus Elfring
Hello,
The following code example gets accepted by the Coccinelle software.
@display1@
expression* e;
type t;
@@
*\( sizeof(t) \|sizeof(*e)\)
Quoted 2 lines
Would it be nice if another script variant can work together with such a SmPL disjunction also in this way?
No. They are quite different because the () is required on a type but optional on an expression.
julia
Quoted 16 lines
@display2@
expression* e;
type t;
@@
*sizeof( \( t \| *e \) )elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch --parse-cocci
check_sizeof2.cocci…
minus: parse error:
File "check_sizeof2.cocci", line 5, column 17, charpos = 54
around = '*',
whole content = *sizeof( \( t \| *e \) )
Quoted 7 lines
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
Quoted 8 lines
Quoted 5 lines
*\( sizeof(t) \|
sizeof(*e)\)Would it be nice if another script variant can work together with such a SmPL disjunction also in this way?
No. They are quite different because the () is required on a type but optional on an expression.
…
Quoted 5 lines
Quoted 5 lines
@display2@
expression* e;
type t;
@@
*sizeof( \( t \| *e \) )
Would such a search pattern be acceptable if both items would be handled as non-optional selections in this case?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci