Skip to contentSkip to conversation

Adding a field to struct and new line issues

Cocci Jerome Glisse 2 participants 4 messages Jan 11, 2019 – Jan 12, 2019

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 44 lines · Jerome Glisse

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:

Quoted 8 lines
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

Quoted 8 lines

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

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

#2 lore raw
In reply to Jerome Glisse
Quoted 4 lines · Jerome Glisse

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

Quoted 49 lines

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.

Quoted 7 lines

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

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

#3 lore raw
Quoted 4 lines · Julia Lawall

On Fri, 11 Jan 2019, Jerome Glisse wrote:

Quoted 8 lines
Quoted 4 lines

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