cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Jerome Glisse <jglisse@redhat.com>
To: cocci@systeme.lip6.fr
Subject: [Cocci] Adding a field to struct and new line issues
Date: Fri, 11 Jan 2019 17:24:17 -0500	[thread overview]
Message-ID: <20190111222417.GE3190@redhat.com> (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
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

             reply	other threads:[~2019-01-11 22:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 22:24 Jerome Glisse [this message]
2019-01-12  6:14 ` [Cocci] Adding a field to struct and new line issues Julia Lawall
2019-01-12 16:45 ` Julia Lawall
2019-01-12 17:51   ` Jerome Glisse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190111222417.GE3190@redhat.com \
    --to=jglisse@redhat.com \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).