Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: jean-sebastien.pedron@dumbbell.fr (Jean-Sébastien Pédron)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Parsing errors in several headers
Date: Tue, 28 Oct 2014 20:23:23 +0100	[thread overview]
Message-ID: <544FED2B.2030305@dumbbell.fr> (raw)
In-Reply-To: <544FEA20.4030400@users.sourceforge.net>

On 28.10.2014 20:10, SF Markus Elfring wrote:
>> Ok, then I must have a problem with my semantic patch, because it
>> doesn't change anything :) I thought it was because of the parsing error.
> 
> Would you like to show your SmPL approach here so that we could help you more
> eventually?

Sure! I wanted to add a #define just above a function prototype or the
function itself.

Example #1:
  int foo();

should become:
  #define foo BAR(foo)
  int foo();

Example #2:
  int foo() { /* ... */ }

should become:
  #define foo BAR(foo)
  int foo() { /* ... */ }

Here's the script I used, which worked with example #1:

---8<---
@rule1@
identifier func;
@@

-#define        func    BAR(func)

@rule2@
identifier func;
type ret;
@@

+#define        func    BAR(func)
ret func(...);
---8<---

I can handle example #2 with this one:

---8<---
@rule1@
identifier func;
@@

-#define        func    BAR(func)

@rule2@
identifier func;
type ret;
@@

+#define        func    BAR(func)
ret func(...) { ... }
---8<---

However, I fail to assemble those two patches in a single concise one.

Thank you for offering your help :)

-- 
Jean-S?bastien P?dron

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20141028/09605fdc/attachment.asc>

  reply	other threads:[~2014-10-28 19:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 18:24 [Cocci] Parsing errors in several headers Jean-Sébastien Pédron
2014-10-28 18:33 ` Julia Lawall
2014-10-28 18:51   ` Jean-Sébastien Pédron
2014-10-28 19:10     ` SF Markus Elfring
2014-10-28 19:23       ` Jean-Sébastien Pédron [this message]
2014-10-28 20:19         ` Julia Lawall
2014-10-29  8:29         ` SF Markus Elfring
2014-10-29  8:35           ` Jean-Sébastien Pédron
2014-10-29  8:45             ` [Cocci] Addition of preprocessor statements with SmPL SF Markus Elfring
2014-10-29 10:26             ` [Cocci] Parsing errors in several headers Julia Lawall
2014-10-29 10:57               ` [Cocci] Addition of preprocessor statements with SmPL Jean-Sébastien Pédron
2014-10-29 11:01                 ` Julia Lawall
2014-10-29 11:07                 ` Julia Lawall
2014-10-29 11:25                   ` Jean-Sébastien Pédron
2014-10-29 12:26                     ` Jean-Sébastien Pédron
2014-10-29 12:05               ` [Cocci] Parsing errors in several headers SF Markus Elfring
2014-10-29  9:45         ` [Cocci] Addition of preprocessor statements with SmPL SF Markus Elfring
2014-10-29 10:02           ` Julia Lawall
2014-10-29 10:07             ` SF Markus Elfring
2014-10-29 10:23               ` Julia Lawall

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=544FED2B.2030305@dumbbell.fr \
    --to=jean-sebastien.pedron@dumbbell.fr \
    --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