cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Challenges around asterisk usage in SmPL code
Date: Sun, 25 Aug 2019 12:22:07 +0200	[thread overview]
Message-ID: <3d06c34b-ad1b-2d5b-f36a-0de6429ad361@web.de> (raw)
In-Reply-To: <alpine.DEB.2.21.1908251741460.2366@hadrien>

>> @check@
>> expression x;
>> statement es;
>> @@
>> *if ( \( !(x) \| x == NULL \) )
>> *   <+... *(x) ...+>;
>>  else
>>     es
>>
>>
>> Can it be avoided to express assignment variations explicitly?
>
> I don't know what you are trying to do.

Can you get the impression that I am trying also to achieve something
around the detection of null pointer usage?


> Previously, you had the beginning of an assignment before the ...
> I suggested to replace the ... before and after the *(x) by <+... ...+>.

This variant gets accepted by the Coccinelle software.


> Strangely you have deleted the assignment part as well.

I became curious if such an approach should also work.


> Your code line with the <+... ...+> ends with a ;.

Yes - for this test.


> So the <+... ...+> must match an expression (which could be an assignment).

This can be appropriate.


> But due to parsing priorities, <+... ...+> that is unknown is parsed as a statement.
> So the ; causes a parse error.  To force the <+... ...+> to be parsed as
> an expression, you have to surround it with ().  An isomorphism will
> normally cause the case without the parentheses to be considered as well.

Thanks for this explanation.


> None of this has anything to do with unary operators.

This view is reasonable.

I just put a search pattern with an asterisk into this SmPL construct.

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

  reply	other threads:[~2019-08-25 10:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-24 17:33 [Cocci] Challenges around asterisk usage in SmPL code Markus Elfring
     [not found] ` <2AE15A09-F219-43DC-81A9-73C13CFC0753@lip6.fr>
2019-08-25  7:40   ` Markus Elfring
2019-08-25  7:48     ` Julia Lawall
2019-08-25  8:13       ` Markus Elfring
2019-08-25  8:30       ` [Cocci] Searching for unary operations with SmPL Markus Elfring
2019-08-25  9:11       ` [Cocci] Challenges around asterisk usage in SmPL code Markus Elfring
2019-08-25  9:45         ` Julia Lawall
2019-08-25 10:22           ` Markus Elfring [this message]
2019-08-25 13:13             ` [Cocci] Checking information from “--parse-cocci” Markus Elfring
     [not found]               ` <alpine.DEB.2.21.1908252118210.2801@hadrien>
2019-08-25 13:45                 ` Markus Elfring
     [not found]                   ` <alpine.DEB.2.21.1908252209170.3506@hadrien>
2019-08-25 14:19                     ` Markus Elfring
2019-08-25 17:34           ` [Cocci] Challenges around asterisk usage in SmPL code Markus Elfring
2019-08-26 17:26           ` [Cocci] Checking null pointer handling with SmPL Markus Elfring
2019-08-27  0:58             ` Julia Lawall
2019-08-28 11:50               ` Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d06c34b-ad1b-2d5b-f36a-0de6429ad361@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).