cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Checking size determinations with SmPL
@ 2019-11-17 11:47 Markus Elfring
  2019-11-17 12:21 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2019-11-17 11:47 UTC (permalink / raw)
  To: Coccinelle

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
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Cocci] Checking size determinations with SmPL
  2019-11-17 11:47 [Cocci] Checking size determinations with SmPL Markus Elfring
@ 2019-11-17 12:21 ` Julia Lawall
  2019-11-17 14:46   ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2019-11-17 12:21 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Coccinelle

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]



On Sun, 17 Nov 2019, Markus Elfring wrote:

> 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?

No.  They are quite different because the () is required on a type but
optional on an expression.

julia

>
> @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
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Cocci] Checking size determinations with SmPL
  2019-11-17 12:21 ` Julia Lawall
@ 2019-11-17 14:46   ` Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-11-17 14:46 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Coccinelle

>> *\( 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.
>> @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
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-17 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-17 11:47 [Cocci] Checking size determinations with SmPL Markus Elfring
2019-11-17 12:21 ` Julia Lawall
2019-11-17 14:46   ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).