cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Adding a field to struct and new line issues
@ 2019-01-11 22:24 Jerome Glisse
  2019-01-12  6:14 ` Julia Lawall
  2019-01-12 16:45 ` Julia Lawall
  0 siblings, 2 replies; 4+ messages in thread
From: Jerome Glisse @ 2019-01-11 22:24 UTC (permalink / raw)
  To: cocci

Hi,

I am trying to add a field to struct however coccinelle insist on
adding it on the same line as struct name definition ie:

spatch:
@@
@@
struct foo {
+int roto;
...
}

original c code:
struct foo {
    int titi;
};

result:
struct foo {int roto;
    int titi;
};


This is kind of ugly and i am at loss trying to force a new line ie:
struct foo {
    int roto;
    int titi;
};



Funny thing, trying to out smart coccinelle with:
@@
identifier I1;
type T1;
@@
struct foo {
T1 I1;
+int roto;
...
}

Gives:
struct foo {
    int titi;int roto;
};


I am still scratching my head on how i can force a new line. There
does not seem to have \n or any escape sequence i can use to force
new line.

Thank you for any pointers toward that.
Jérôme
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] Adding a field to struct and new line issues
  2019-01-11 22:24 [Cocci] Adding a field to struct and new line issues Jerome Glisse
@ 2019-01-12  6:14 ` Julia Lawall
  2019-01-12 16:45 ` Julia Lawall
  1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2019-01-12  6:14 UTC (permalink / raw)
  To: Jerome Glisse; +Cc: cocci

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]



On Fri, 11 Jan 2019, Jerome Glisse wrote:

> Hi,
>
> I am trying to add a field to struct however coccinelle insist on
> adding it on the same line as struct name definition ie:
>
> spatch:
> @@
> @@
> struct foo {
> +int roto;
> ...
> }
>
> original c code:
> struct foo {
>     int titi;
> };
>
> result:
> struct foo {int roto;
>     int titi;
> };
>
>
> This is kind of ugly and i am at loss trying to force a new line ie:
> struct foo {
>     int roto;
>     int titi;
> };
>
>
>
> Funny thing, trying to out smart coccinelle with:
> @@
> identifier I1;
> type T1;
> @@
> struct foo {
> T1 I1;
> +int roto;
> ...
> }
>
> Gives:
> struct foo {
>     int titi;int roto;
> };
>
>
> I am still scratching my head on how i can force a new line. There
> does not seem to have \n or any escape sequence i can use to force
> new line.

Sorry, it seems to be a pretty printing problem.  I will fix it.

julia

>
> Thank you for any pointers toward that.
> Jérôme
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] Adding a field to struct and new line issues
  2019-01-11 22:24 [Cocci] Adding a field to struct and new line issues Jerome Glisse
  2019-01-12  6:14 ` Julia Lawall
@ 2019-01-12 16:45 ` Julia Lawall
  2019-01-12 17:51   ` Jerome Glisse
  1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2019-01-12 16:45 UTC (permalink / raw)
  To: Jerome Glisse; +Cc: cocci

[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]



On Fri, 11 Jan 2019, Jerome Glisse wrote:

> Hi,
>
> I am trying to add a field to struct however coccinelle insist on
> adding it on the same line as struct name definition ie:

The problem should be fixed.  Please try the version from github.  Thanks
for the report.

julia

>
> spatch:
> @@
> @@
> struct foo {
> +int roto;
> ...
> }
>
> original c code:
> struct foo {
>     int titi;
> };
>
> result:
> struct foo {int roto;
>     int titi;
> };
>
>
> This is kind of ugly and i am at loss trying to force a new line ie:
> struct foo {
>     int roto;
>     int titi;
> };
>
>
>
> Funny thing, trying to out smart coccinelle with:
> @@
> identifier I1;
> type T1;
> @@
> struct foo {
> T1 I1;
> +int roto;
> ...
> }
>
> Gives:
> struct foo {
>     int titi;int roto;
> };
>
>
> I am still scratching my head on how i can force a new line. There
> does not seem to have \n or any escape sequence i can use to force
> new line.
>
> Thank you for any pointers toward that.
> Jérôme
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] Adding a field to struct and new line issues
  2019-01-12 16:45 ` Julia Lawall
@ 2019-01-12 17:51   ` Jerome Glisse
  0 siblings, 0 replies; 4+ messages in thread
From: Jerome Glisse @ 2019-01-12 17:51 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

On Sat, Jan 12, 2019 at 05:45:47PM +0100, Julia Lawall wrote:
> 
> 
> On Fri, 11 Jan 2019, Jerome Glisse wrote:
> 
> > Hi,
> >
> > I am trying to add a field to struct however coccinelle insist on
> > adding it on the same line as struct name definition ie:
> 
> The problem should be fixed.  Please try the version from github.  Thanks
> for the report.
> 

Works for me with lastest github ! :)

Thank you so much for fixing this.

Cheers,
Jérôme
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

end of thread, other threads:[~2019-01-12 17:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-11 22:24 [Cocci] Adding a field to struct and new line issues Jerome Glisse
2019-01-12  6:14 ` Julia Lawall
2019-01-12 16:45 ` Julia Lawall
2019-01-12 17:51   ` Jerome Glisse

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).