All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] White space formatting
@ 2015-09-09 10:04 Kieran Bingham
  2015-09-09 14:07 ` Julia Lawall
  0 siblings, 1 reply; 6+ messages in thread
From: Kieran Bingham @ 2015-09-09 10:04 UTC (permalink / raw)
  To: cocci

Hi Julia et al.

Working on an s-patch for a large linux change, I am removing a
function argument.
This works as expected, but seems to leave a lot of lonely dangling
brackets which would really benefit from being hugged!

Full patch on viewable here:
https://gist.github.com/kbingham/96477177dd20a72b1c2f

but the relevant segment is:

===========================================
// Convert the probe function

@ depends on driver @
identifier driver.probefunc;
identifier client;
identifier id;
@@
static int probefunc(
    struct i2c_client *client,
-    const struct i2c_device_id *id
    )
    { ... }
===========================================



This ends up creating a lot of changes that look like:
===========================================
@@ -489,8 +489,8 @@ static struct at24_platform_data eeprom_info = {
  */
 static struct i2c_client *dm6446evm_msp;

-static int dm6446evm_msp_probe(struct i2c_client *client,
-               const struct i2c_device_id *id)
+static int dm6446evm_msp_probe(struct i2c_client *client
+               )
 {
        dm6446evm_msp = client;
        return 0;
===========================================


I am using --linux-spacing - but as the help states :
  --linux-spacing               spacing of + code follows the
conventions of Linux

I suspect code is perhaps not refactored on - lines?



The lines where I make additions are also not as I desire (aligned
with the block) - but I suspect I will have to manually align these or
try running lindent:

===========================================
-
 static struct i2c_driver dm6446evm_msp_driver = {
        .driver.name    = "dm6446evm_msp",
-       .id_table       = dm6446evm_msp_ids,
-       .probe          = dm6446evm_msp_probe,
+       .probe2 = dm6446evm_msp_probe,
        .remove         = dm6446evm_msp_remove,
 };
===========================================


Are there any other ways to control the white-space adjustments made?


For reference: I'm on Ubuntu 15.04 with default coccinelle from the distro:
  spatch --version
  spatch version 1.0.0-rc22 with Python support and with PCRE support

--
Regards

Kieran

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Cocci] White space formatting
  2015-09-09 10:04 [Cocci] White space formatting Kieran Bingham
@ 2015-09-09 14:07 ` Julia Lawall
  2015-09-09 14:49   ` Kieran Bingham
  0 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2015-09-09 14:07 UTC (permalink / raw)
  To: cocci



On Wed, 9 Sep 2015, Kieran Bingham wrote:

> Hi Julia et al.
>
> Working on an s-patch for a large linux change, I am removing a
> function argument.
> This works as expected, but seems to leave a lot of lonely dangling
> brackets which would really benefit from being hugged!
>
> Full patch on viewable here:
> https://gist.github.com/kbingham/96477177dd20a72b1c2f
>
> but the relevant segment is:
>
> ===========================================
> // Convert the probe function
>
> @ depends on driver @
> identifier driver.probefunc;
> identifier client;
> identifier id;
> @@
> static int probefunc(
>     struct i2c_client *client,
> -    const struct i2c_device_id *id
>     )
>     { ... }
> ===========================================
>
>
>
> This ends up creating a lot of changes that look like:
> ===========================================
> @@ -489,8 +489,8 @@ static struct at24_platform_data eeprom_info = {
>   */
>  static struct i2c_client *dm6446evm_msp;
>
> -static int dm6446evm_msp_probe(struct i2c_client *client,
> -               const struct i2c_device_id *id)
> +static int dm6446evm_msp_probe(struct i2c_client *client
> +               )
>  {
>         dm6446evm_msp = client;
>         return 0;
> ===========================================
>
>
> I am using --linux-spacing - but as the help states :
>   --linux-spacing               spacing of + code follows the
> conventions of Linux
>
> I suspect code is perhaps not refactored on - lines?
>
>
>
> The lines where I make additions are also not as I desire (aligned
> with the block) - but I suspect I will have to manually align these or
> try running lindent:
>
> ===========================================
> -
>  static struct i2c_driver dm6446evm_msp_driver = {
>         .driver.name    = "dm6446evm_msp",
> -       .id_table       = dm6446evm_msp_ids,
> -       .probe          = dm6446evm_msp_probe,
> +       .probe2 = dm6446evm_msp_probe,

Yeah, there is nothing to address this.  It's kind of a special case, so
I'm not sure that there will be anything in the near future either.

>         .remove         = dm6446evm_msp_remove,
>  };
> ===========================================
>
>
> Are there any other ways to control the white-space adjustments made?
>
>
> For reference: I'm on Ubuntu 15.04 with default coccinelle from the distro:
>   spatch --version
>   spatch version 1.0.0-rc22 with Python support and with PCRE support

You should upgrade to 1.0.2.

julia

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Cocci] White space formatting
  2015-09-09 14:07 ` Julia Lawall
@ 2015-09-09 14:49   ` Kieran Bingham
  2015-09-09 15:05     ` SF Markus Elfring
  0 siblings, 1 reply; 6+ messages in thread
From: Kieran Bingham @ 2015-09-09 14:49 UTC (permalink / raw)
  To: cocci

...
>> I am using --linux-spacing - but as the help states :
>>   --linux-spacing               spacing of + code follows the
>> conventions of Linux
>>
>> I suspect code is perhaps not refactored on - lines?
>>
>>
>>
>> The lines where I make additions are also not as I desire (aligned
>> with the block) - but I suspect I will have to manually align these or
>> try running lindent:
>>
>> ===========================================
>> -
>>  static struct i2c_driver dm6446evm_msp_driver = {
>>         .driver.name    = "dm6446evm_msp",
>> -       .id_table       = dm6446evm_msp_ids,
>> -       .probe          = dm6446evm_msp_probe,
>> +       .probe2 = dm6446evm_msp_probe,
>
> Yeah, there is nothing to address this.  It's kind of a special case, so
> I'm not sure that there will be anything in the near future either.


Ok - I'm not actually convinced what the kernel style is here ... I've
found lots
of differing blocks in the code, and no mention in the CodingStyle.txt...

Ho hum ... for my patches I will hand edit so that they are the same
as surrounding
code - whatever that may be.



>
>>         .remove         = dm6446evm_msp_remove,
>>  };
>> ===========================================
>>
>>
>> Are there any other ways to control the white-space adjustments made?
>>
>>
>> For reference: I'm on Ubuntu 15.04 with default coccinelle from the distro:
>>   spatch --version
>>   spatch version 1.0.0-rc22 with Python support and with PCRE support
>
> You should upgrade to 1.0.2.
>
> julia


Hmm.. This will be a self compile then.
Ubuntu's latest package is 1.0.0-rc22
 (even on the PPA mentioned on your website:
https://launchpad.net/~npalix/+archive/ubuntu/coccinelle)

--
Regards

Kieran

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Cocci] White space formatting
  2015-09-09 14:49   ` Kieran Bingham
@ 2015-09-09 15:05     ` SF Markus Elfring
  2015-09-09 15:08       ` Kieran Bingham
  0 siblings, 1 reply; 6+ messages in thread
From: SF Markus Elfring @ 2015-09-09 15:05 UTC (permalink / raw)
  To: cocci

> Hmm.. This will be a self compile then.

How do you think about to try the OPAM interface out for this purpose then?
https://opam.ocaml.org/packages/coccinelle/coccinelle.1.0.2/

Regards,
Markus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Cocci] White space formatting
  2015-09-09 15:05     ` SF Markus Elfring
@ 2015-09-09 15:08       ` Kieran Bingham
  2015-09-09 15:18         ` Kieran Bingham
  0 siblings, 1 reply; 6+ messages in thread
From: Kieran Bingham @ 2015-09-09 15:08 UTC (permalink / raw)
  To: cocci

On 9 September 2015 at 16:05, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
>> Hmm.. This will be a self compile then.
>
> How do you think about to try the OPAM interface out for this purpose then?
> https://opam.ocaml.org/packages/coccinelle/coccinelle.1.0.2/

I'll give it a go now ...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Cocci] White space formatting
  2015-09-09 15:08       ` Kieran Bingham
@ 2015-09-09 15:18         ` Kieran Bingham
  0 siblings, 0 replies; 6+ messages in thread
From: Kieran Bingham @ 2015-09-09 15:18 UTC (permalink / raw)
  To: cocci

Hi Markus,

On 9 September 2015 at 16:08, Kieran Bingham <kieranbingham@gmail.com> wrote:
> On 9 September 2015 at 16:05, SF Markus Elfring
> <elfring@users.sourceforge.net> wrote:
>>> Hmm.. This will be a self compile then.
>>
>> How do you think about to try the OPAM interface out for this purpose then?
>> https://opam.ocaml.org/packages/coccinelle/coccinelle.1.0.2/
>
> I'll give it a go now ...

That was relatively painless, I had to install a package as suggested
by  OPAM, and then retry - but after that :

spatch --version
spatch version 1.0.2 with Python support and with PCRE support


(with a sudo apt-get remove coccinelle to get rid of the existing
installation too)


Thanks for the pointer :)
--
Regards

Kieran

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-09-09 15:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-09 10:04 [Cocci] White space formatting Kieran Bingham
2015-09-09 14:07 ` Julia Lawall
2015-09-09 14:49   ` Kieran Bingham
2015-09-09 15:05     ` SF Markus Elfring
2015-09-09 15:08       ` Kieran Bingham
2015-09-09 15:18         ` Kieran Bingham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.