On Mon, 15 Mar 2021, Mansour Moufid wrote:

> On Sun, Mar 14, 2021, 20:43 Thomas Adam <tho...@xteddy.org> wrote:
>       Hello,
>
>       I can see I was as clear as mud with my explanation -- apologies
>       for
>       that, so let me try again.
>
>       In my original example:
>
>       struct monitor {
>           struct {
>               int width;
>               int height
>           } virtual;
>       };
>
>       ... the members width and height aren't required any more, as
>       they're
>       actually computable generically, and don't belong in that
>       struct.
>       Instead, I have separate functions which can provide those
>       values.
>
>       So where I have in code, statements such as:
>
>       struct monitor *m = this_monitor();
>       int foo = m->virutal.width;
>
>       I want to be able to substitute "m->virtual.width" with a
>       function
>       call "get_width()" -- which does not involve "struct monitor" at
>       all.
>       Indeed, the semantic patch I'm trying to apply now looks like
>       this:
>
>       @@
>       struct monitor *m;
>       @@
>
>       - m->virtual.width;
>       + get_width();
>
>       ... and although spatch doesn't tell me of any errors, when I
>       run it
>       over my codebase, no modifications are made.  So clearly I'm
>       still
>       doing something wrong.
>
>
> Remove the semi-colons. ;)

Good catch :)

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

Reply via email to