cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: cocci@systeme.lip6.fr
Subject: [Cocci] ormatting problems when introducing a function with coccinelle
Date: Sun, 7 Apr 2019 11:49:11 -0700	[thread overview]
Message-ID: <4a22aba7-4983-3f17-a51e-7ad6d4f3eac2@roeck-us.net> (raw)

Hi Coccinelle experts,

I am trying to introduce a new function with coccinelle.

The semantic patch is something like

@devm depends on prb@
identifier r.initfn;
identifier fname.clkfunc;
@@
+ static void clkfunc(void *data) { clk_disable_unprepare(data); }
   initfn(...) { ... }

This works, but the resulting output is always

+static void armada_clk_disable_unprepare(void *data) {
+       clk_disable_unprepare(data);
+}
+
  static int armada_37xx_wdt_probe(struct platform_device *pdev)

meaning the opening '{' is in the same line as the function declaration.
It doesn't matter if I provide the function in a single line or
in multiple lines. It also doesn't matter if I try to manipulate
the function afterwards. The output looks always the same.

Is there a way to tell coccinelle that it should generate

+static void armada_clk_disable_unprepare(void *data)
+{
+       clk_disable_unprepare(data);
+}
+
  static int armada_37xx_wdt_probe(struct platform_device *pdev)

instead ?

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

             reply	other threads:[~2019-04-07 18:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-07 18:49 Guenter Roeck [this message]
2019-04-07 19:09 ` [Cocci] ormatting problems when introducing a function with coccinelle Julia Lawall
2019-04-07 20:03   ` Guenter Roeck
2019-04-07 20:05     ` Julia Lawall
2019-04-07 20:17       ` Guenter Roeck
2019-04-07 19:18 ` Julia Lawall
2019-04-07 20:14   ` Guenter Roeck

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=4a22aba7-4983-3f17-a51e-7ad6d4f3eac2@roeck-us.net \
    --to=linux@roeck-us.net \
    --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).