Skip to contentSkip to conversation

Checking the handling of spaces before opening parentheses for source code transformations

Cocci Markus Elfring 2 participants 4 messages Nov 5, 2020

lore
Share & tools
lore
#0 lore raw

Hello,

The coding style specification for C programs in GNOME contains also the following information.
https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en#whitespace

“…
Always put a space before an opening parenthesis but never after:
…”

How good can the semantic patch language support such a requirement (also for function declarations and corresponding calls) directly?

See also a related feature request once more:
Make change influence configurable for coding style rules
https://github.com/coccinelle/coccinelle/issues/37

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#1 lore raw
Quoted 11 lines · Markus Elfring

Hello,

The coding style specification for C programs in GNOME contains also the following information.
https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en#whitespace

“…
Always put a space before an opening parenthesis but never after:
…”

Quoted 6 lines

How good can the semantic patch language support such a requirement (also for function declarations and corresponding calls) directly?

See also a related feature request once more:
Make change influence configurable for coding style rules
https://github.com/coccinelle/coccinelle/issues/37

If you want to check for such properties, you can use position variables. If you want to ensure that your generated code has such properties, you can use the argument --smpl-spacing. If you want something more, you are welcome to implement it. We only focus on the coding style of the Linux kernel.

julia

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#2 lore raw
Quoted 2 lines

If you want to ensure that your generated code has such properties, you can use the argument --smpl-spacing.

It is nice that code additions can be influenced by such a parameter.

Quoted 1 line

If you want something more, you are welcome to implement it.

I imagine that adjustments for matched metavariables might need further development considerations.
Would there be a need to reformat any expression code (for example)?

Which software places would become interesting for extensions of source code layout algorithms?

Quoted 1 line

We only focus on the coding style of the Linux kernel.

How are the chances that interests will grow also for source files of GNOME components?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci