From: Julia Lawall <julia.lawall@lip6.fr>
To: Timur Tabi <timur@kernel.org>
Cc: cocci <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Controlling where braces are located?
Date: Tue, 28 May 2019 18:12:03 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.2.21.1905281811270.2487@hadrien> (raw)
In-Reply-To: <CAOZdJXVuNYEkFOiUWYq0GbqRUfuTNV35FGt7EViSSq6AqAY2-A@mail.gmail.com>
On Tue, 28 May 2019, Timur Tabi wrote:
> I'm using coccinelle on some C source code that does not follow Linux
> kernel coding conventions. In particular, the first left brace is on
> its own line:
>
> if (x == 0)
> {
> // ...
> }
>
> I have this rule, but spatch puts the left brace on the same line as
> if-statement:
>
> x = BOARDOBJGRP_OBJ_GET(...);
> +if (x == NULL)
> +{
> + status = ERROR;
> + goto label;
> +}
>
> This results in:
>
> + if (p == NULL) {
> + status = ERROR;
> + goto func_exit;
> + }
>
> How can I fix this?
Try --smpl-spacing. You will need to make all the spacing in the semantic
patch in the way that you want it to appear in the generated code.
julia
> _______________________________________________
> 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
next prev parent reply other threads:[~2019-05-28 22:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 22:05 [Cocci] Controlling where braces are located? Timur Tabi
2019-05-28 22:12 ` Julia Lawall [this message]
2019-05-28 23:07 ` Timur Tabi
2019-05-29 12:28 ` Markus Elfring
2019-05-29 14:54 ` Timur Tabi
2019-05-29 15:07 ` 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=alpine.DEB.2.21.1905281811270.2487@hadrien \
--to=julia.lawall@lip6.fr \
--cc=cocci@systeme.lip6.fr \
--cc=timur@kernel.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).