From: Julia Lawall <julia.lawall@inria.fr>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Luis Chamberlain <mcgrof@kernel.org>, cocci@inria.fr
Subject: Re: [cocci] Need some help with spatch
Date: Mon, 8 Nov 2021 15:45:12 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2111081542290.2988@hadrien> (raw)
In-Reply-To: <b7aea196-c9d9-6d8d-8ba0-ab2a361ba1ad@suse.cz>
On Mon, 8 Nov 2021, Vlastimil Babka wrote:
> On 11/8/21 00:08, Vlastimil Babka wrote:
> > On 11/5/21 17:20, Luis Chamberlain wrote:
> >> On Fri, Nov 05, 2021 at 05:12:09PM +0100, Vlastimil Babka wrote:
> >>> 1) patching complex variable declarations;
> >>>
> >>> I need to perform changes such as:
> >>> -struct page *page;
> >>> +struct slab *slab;
> >>>
> >>> This I was able to somehow specify in the .cocci, but not for situations
> >>> where the original declarations looks like this:
> >>>
> >>> struct page *page, *page2;
> >>>
> >>> or
> >>>
> >>> struct page *page = NULL;
> >>
> >> For this, this seems to work well:
> >>
> >> @@
> >> @@
> >>
> >> -struct page
> >> +struct slab
> >
> > Written exactly like above it works, but then it affects code in all
> > functions, and I need some exceptions.
>
> Still not full success, but I was able to make work at least some
> combinations of declaration and initial assignement, such as
>
> struct page *page = NULL;
>
> by a rule like this:
>
> @@
> expression E;
> @@
> - struct page *page = E;
> + struct slab *slab = E;
>
> But still not luck for e.g.
> struct page *page, *page2;
>
> where rules such as
>
> - struct page *page, *page2;
> + struct slab *slab, *slab2;
>
> don't work. Also no luck for this case:
>
> struct page *page, *discard_page = NULL;
>
> And thanks to the hints from Julia I was able to split up the rules so that
> I no longer have unconverted expressions at places where two changes apply
> to a single line.
>
> I'll now try to build 1.1.1 to deal with the whitespace issues.
Sorry, I got interrupted on this.
@initialize:ocaml@
@@
let ok_function p =
not (List.mem (List.hd p).current_element ["functions";"to";"ignore"])
@@
position p : script:ocaml() { ok_function p };
@@
- struct page@p
+ struct slub
julia
next prev parent reply other threads:[~2021-11-08 14:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 16:12 [cocci] Need some help with spatch Vlastimil Babka
2021-11-05 16:20 ` Luis Chamberlain
2021-11-06 6:44 ` Julia Lawall
2021-11-07 23:08 ` Vlastimil Babka
2021-11-08 14:35 ` Vlastimil Babka
2021-11-08 14:45 ` Julia Lawall [this message]
2021-11-08 16:53 ` Vlastimil Babka
2021-11-08 17:01 ` Julia Lawall
2021-11-05 20:56 ` Julia Lawall
2021-11-05 21:13 ` Julia Lawall
2021-11-05 21:24 ` Vlastimil Babka
2021-11-05 21:27 ` Julia Lawall
2021-11-05 21:31 ` Julia Lawall
2021-11-05 21:32 ` Vlastimil Babka
2021-11-05 21:43 ` Julia Lawall
2021-11-05 21:59 ` Julia Lawall
2021-11-06 15:36 ` [cocci] mm/slab: mass conversion of struct page to struct slab by spatch Markus Elfring
2021-11-07 12:10 ` [cocci] mm/slab: prepare for struct patch conversion " Markus Elfring
2021-11-07 12:22 ` Julia Lawall
2021-11-07 12:50 ` [cocci] mm/slab: prepare for struct page " Markus Elfring
2021-11-07 13:18 ` Julia Lawall
2021-11-07 13:40 ` Markus Elfring
2021-11-07 17:50 ` Vlastimil Babka
2021-11-07 18:09 ` Julia Lawall
2021-11-08 17:35 ` Markus Elfring
2021-11-08 17:40 ` Julia Lawall
2021-11-08 23:35 ` Vlastimil Babka
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.22.394.2111081542290.2988@hadrien \
--to=julia.lawall@inria.fr \
--cc=cocci@inria.fr \
--cc=mcgrof@kernel.org \
--cc=vbabka@suse.cz \
/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).