Coccinelle archive on lore.kernel.org
 help / color / 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, back to index

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

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git