All of lore.kernel.org
 help / color / mirror / Atom feed
From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] modifying initializers with spatch?
Date: Fri, 27 Jan 2017 14:11:15 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1701271408210.3117@hadrien> (raw)
In-Reply-To: <1485507305.5851.1.camel@sipsolutions.net>



On Fri, 27 Jan 2017, Johannes Berg wrote:

> On Fri, 2017-01-27 at 08:09 +0100, Julia Lawall wrote:
> > Partial progress:??The github version will no longer match {} against
> > { 0, 1, 2 }, but it persists in matching {} against { .a = 1, .b = 2
> > },
> > and will still remove the outer braces without removing the rest.
>
> Out of curiosity: will it require some form of "..." to match something
> inside now?

No.

>
> We have a few things like this:
>
> @@
> identifier x;
> identifer fn;
> @@
> my_time x = {
> +#ifdef XYZ
>  .this_method_needs_xyz = fn,
> +#endif
>  ...
>  };
>
> in backports etc. and I've always wondered why it didn't need (or even
> accept, IIRC) ... before the +#ifdef line.

It considers that the rule writer has no knowledge or control of the field
names that are provided or the order in which they appear, so you can
specify any subset of them.  You only need ... when you want to add a new
one at the beginning or at the end of the structure.  The ... lets you
specify beginning or end.

I want to allow you to remove the {} only when all of the field
initializations are also removed.  Some work though is required.

julia

  reply	other threads:[~2017-01-27 13:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 12:28 [Cocci] modifying initializers with spatch? Johannes Berg
2017-01-26 13:17 ` Julia Lawall
2017-01-26 13:32   ` Johannes Berg
2017-01-26 14:20     ` Julia Lawall
2017-01-26 14:28       ` Johannes Berg
2017-01-26 15:47         ` Julia Lawall
2017-01-26 15:52           ` Johannes Berg
2017-01-26 15:57             ` Julia Lawall
2017-01-27 21:43               ` Johannes Berg
2017-01-27 21:52                 ` Julia Lawall
2017-01-27 22:03                   ` Johannes Berg
2017-01-27 22:09                     ` Julia Lawall
2017-01-27 22:23                       ` Johannes Berg
2017-01-27 23:02                       ` Johannes Berg
2017-01-27 23:20                         ` Johannes Berg
2017-01-28  6:47                           ` Julia Lawall
2017-01-28  8:20                             ` Johannes Berg
2017-01-27  7:09             ` Julia Lawall
2017-01-27  8:55               ` Johannes Berg
2017-01-27 13:11                 ` Julia Lawall [this message]
2017-01-27 16:13                   ` Johannes Berg

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=alpine.DEB.2.20.1701271408210.3117@hadrien \
    --to=julia.lawall@lip6.fr \
    --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 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.