cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: cocci@systeme.lip6.fr
Subject: [Cocci] modifying C99 initializers?
Date: Thu, 21 Mar 2019 14:15:01 +0100	[thread overview]
Message-ID: <fa68a6e4e3047058d9f0dfc572cf5fbbe7f07367.camel@sipsolutions.net> (raw)

Hi all,

I'm trying to do something like this:

@@
identifier list;
@@
struct my_struct list[] = {
<...
 {
+       .field = 27,
 },
...>
};


where "field" is a new struct member and I want it initialized
everywhere.

The above doesn't parse, but is there another way of doing it?

The expected output would be

struct my_struct xyz[] = {
	{
+		.field = 27,
		.other_field = 7,
	},
	{
+		.field = 27,
		.third_field = 8,
	},
};

Thanks,

johannes

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

             reply	other threads:[~2019-03-21 13:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 13:15 Johannes Berg [this message]
2019-03-21 13:40 ` [Cocci] modifying C99 initializers? Julia Lawall
2019-03-21 14:04   ` Johannes Berg
2019-03-21 19:33     ` Julia Lawall
2019-03-21 20:08       ` Johannes Berg
2019-03-21 20:22         ` Julia Lawall

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=fa68a6e4e3047058d9f0dfc572cf5fbbe7f07367.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --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).