All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Chuhong Yuan <hslester96@gmail.com>, cocci@systeme.lip6.fr
Subject: Re: [Cocci] How to match function calls in macros?
Date: Mon, 18 May 2020 12:50:19 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2005181248310.2467@hadrien> (raw)
In-Reply-To: <e3d5a92f-0c78-c1ca-47ab-d2bb2864efaa@web.de>



On Mon, 18 May 2020, Markus Elfring wrote:

> >>> If the developer forgets the \ there would likely be a parsing problem.
> >>
> >> I find it helpful to clarify parsing challenges around such an use case.
> >> It might occasionally be relevant if a line continuation indication
> >> was accidentally forgotten or was intentionally omitted.
> >>
> >> * Source code review should point such questionable places out, shouldn't it?
> >>
> >> * How much does this implementation detail matter for the safe application
> >>   of the semantic patch language?
> >
> > This is not Coccinelle's problem.
>
> This software is also involved then.
>
>
> > A developer can run a compiler to check for parsing errors.
>
> I imagine that a missing line continuation can be hard to detect
> and report as a possible programming error because the corresponding
> code parts can still be valid on their own according to special circumstances.

If they are valid, then what is the problem.  Neither a compiler nor
Coccinelle can know what the developer intended.

> Can the semantic patch language help to insist for a search that a bit
> of source code belongs to the implementation of a function-like macro?

That's what the search that was written does.  The pattern that comes
after #define has to be in the definition of the macro.  Coccinelle never
matches things in more than one top-level term in the C file.

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

  reply	other threads:[~2020-05-18 10:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18  8:26 [Cocci] How to match function calls in macros? Markus Elfring
2020-05-18  9:19 ` Julia Lawall
2020-05-18 10:13   ` Markus Elfring
2020-05-18 10:18     ` Julia Lawall
2020-05-18 10:30       ` Markus Elfring
2020-05-18 10:34         ` Julia Lawall
2020-05-18 10:46           ` Markus Elfring
2020-05-18 10:50             ` Julia Lawall [this message]
2020-05-18 11:07               ` Markus Elfring
2020-05-19 11:15               ` Markus Elfring
2020-05-19 11:23                 ` Julia Lawall
2020-05-19 11:43                   ` Markus Elfring
2020-05-19 11:55                     ` Julia Lawall
2020-05-19 12:04                       ` Markus Elfring
2020-05-18 12:07       ` Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-05-16 11:42 Markus Elfring
2020-05-16  8:16 Chuhong Yuan
2020-05-16  8:49 ` Julia Lawall
2020-05-16 12:26   ` Chuhong Yuan
2020-05-16 12:45     ` Julia Lawall
2020-05-16 14:17       ` Chuhong Yuan

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=alpine.DEB.2.21.2005181248310.2467@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=hslester96@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.