From: Mansour Moufid <mansourmoufid@gmail.com>
To: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Adjusting replacement lists with SmPL?
Date: Sat, 24 Oct 2020 22:04:36 -0400 [thread overview]
Message-ID: <CALogXGX3Xq-H_q6GvZYvubu-sR94sxjJ-f3xVmYbUNCOpAb+sw@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2010231710010.2707@hadrien>
On Fri, Oct 23, 2020 at 11:00 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> > I'd like to add a statement after another within a preprocessor expression,
>
> How do you think about to refer to a “#define directive”?
I mean, not specifically in the #define, but anywhere.
(I don't try to patch preprocessor directives with spatch, I use sed for that.)
> > #define X(a) x(a);
> >
> > (I know the above is not technically correct but it's super common.)
>
> I stumble on understanding difficulties for this information.
> Would you like to clarify the knowledge about correctness a bit more?
A trailing colon in a #define leads to code like this:
{
X(1)
X(2)
...
}
... which of course does not parse. It would be better to use a do {
... } while (0), or better yet an inline function. But unfortunately
the above style is very common.
On Fri, Oct 23, 2020 at 11:11 AM Julia Lawall <julia.lawall@inria.fr> wrote:
> I don't think he is asking that. He means, if the call to x happens to be
> in a macro definition, how can he ensure that the transformed code treats
> newlines in the right way.
Yes, exactly. :)
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
prev parent reply other threads:[~2020-10-25 2:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-23 3:33 [Cocci] Newline escape in preprocessor Mansour Moufid
2020-10-23 6:05 ` Julia Lawall
2020-10-23 15:00 ` [Cocci] Adjusting replacement lists with SmPL? Markus Elfring
2020-10-23 15:11 ` Julia Lawall
2020-10-25 2:04 ` Mansour Moufid [this message]
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=CALogXGX3Xq-H_q6GvZYvubu-sR94sxjJ-f3xVmYbUNCOpAb+sw@mail.gmail.com \
--to=mansourmoufid@gmail.com \
--cc=cocci@systeme.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).