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

Reply via email to