cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Guenter Roeck <linux@roeck-us.net>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] ormatting problems when introducing a function with coccinelle
Date: Sun, 7 Apr 2019 21:09:51 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1904072108260.18180@hadrien> (raw)
In-Reply-To: <4a22aba7-4983-3f17-a51e-7ad6d4f3eac2@roeck-us.net>



On Sun, 7 Apr 2019, Guenter Roeck wrote:

> 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(...) { ... }

You can do:

+ static void clkfunc(void *data)
+{ clk_disable_unprepare(data); }
  initfn(...) { ... }

and then use the command line argument --smpl-spacing.

But I will check whether it can be easily fixed.

julia


>
> 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
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-07 18:49 [Cocci] ormatting problems when introducing a function with coccinelle Guenter Roeck
2019-04-07 19:09 ` Julia Lawall [this message]
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=alpine.DEB.2.21.1904072108260.18180@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=linux@roeck-us.net \
    /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).