cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Thomas Adam <thomas@xteddy.org>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Using SmPL scripts to mangle function arguments
Date: Tue, 26 May 2020 08:00:55 +0200	[thread overview]
Message-ID: <6e21d3ff-0c5f-dc63-1058-e73aab052bda@web.de> (raw)
In-Reply-To: <CAOhcEPY8r2fjJmJP4A6ZzFdhTGJB=RYVcVt8k6KV9EaMzc_oSQ@mail.gmail.com>

> func_old(__func__,  "%s: hello: %d, %d", myvar, x, y);
>
> I'm having trouble expressing my smPL to understand the ellipses correctly.

This can be usual.


> Here's what I have so far:
>
> @@
> expression L, F;
> @@
>
> - func_old(L, F, ...);
> + func_old(__func_, ...);
>
> ... but here, things fall apart:
>
> init_defs_builtins: /usr/bin/../lib/coccinelle/standard.h
> File "contrib/coccinelle/remove_debug.cocci", line 6, column 21, charpos = 68
>   around = '...',
>   whole content = + func_old(__func__, ...);
>
> Any ideas on what I'm doing wrong?

Yes.

I hope also that some error messages from the Coccinelle software can become
more helpful.


> If there's appropriate documentation on this, please feel free to point me toward it.

How do you find the available descriptions in the section “4.1  Basic dots”?
http://coccinelle.lip6.fr/docs/main_grammar004.html#sec6


> I feel as though I'm missing something obvious here, so thanks for your time
> and for any help you can give.

The SmPL ellipsis refers to variable and unknown source code.
You tried a simple change specification out which expresses that a specific
function call should be adjusted in the same line.
But how can anything be readded when the content is unknown?

I suggest to increase the precision for the known change aspects like the following.

@replacement@
expression L, F;
@@
-func_old
+current_func
         (
-         L, F
+         __func__
          , ...
         )


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

  reply	other threads:[~2020-05-26  6:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17  9:22 [Cocci] Using SmPL scripts to mangle function arguments Markus Elfring
2020-05-17  9:45 ` Julia Lawall
2020-05-26  1:21 ` Thomas Adam
2020-05-26  6:00   ` Markus Elfring [this message]
2020-05-26  6:41   ` Julia Lawall
2020-05-27 14:21   ` Markus Elfring
2020-05-26 11:23 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=6e21d3ff-0c5f-dc63-1058-e73aab052bda@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=thomas@xteddy.org \
    /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).