All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] SmPL patch against C macro
@ 2019-02-19  2:01 thomas pedersen
  2019-02-19  6:55 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: thomas pedersen @ 2019-02-19  2:01 UTC (permalink / raw)
  To: cocci

Hello,

I'm trying to write an SmPL patch which will modify C macro. The test files are:

# test_macro.c
#define MYMACRO(adsf) { \
        .foo = (asdf),\
}

# test_macro.cocci
@@
expression E;
@@

{
.foo = E
+ * 1000
}

Running with:
$ spatch --debug --sp-file test_macro.cocci test_macro.c

Gives the output:
Unsupported form of #define: File "test_macro.c", line 1

What's the correct syntax to match against a similar macro?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Cocci] SmPL patch against C macro
  2019-02-19  2:01 [Cocci] SmPL patch against C macro thomas pedersen
@ 2019-02-19  6:55 ` Julia Lawall
  2019-02-20  6:25   ` thomas pedersen
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2019-02-19  6:55 UTC (permalink / raw)
  To: thomas pedersen; +Cc: cocci



On Mon, 18 Feb 2019, thomas pedersen wrote:

> Hello,
>
> I'm trying to write an SmPL patch which will modify C macro. The test files are:
>
> # test_macro.c
> #define MYMACRO(adsf) { \
>         .foo = (asdf),\
> }
>
> # test_macro.cocci
> @@
> expression E;
> @@
>
> {
> .foo = E
> + * 1000
> }
>
> Running with:
> $ spatch --debug --sp-file test_macro.cocci test_macro.c
>
> Gives the output:
> Unsupported form of #define: File "test_macro.c", line 1
>
> What's the correct syntax to match against a similar macro?

It was the macro definition itself that was not supported.  The problem
should be fixed now.  You can get the latest version from Github.

julia

>
> Thanks,
> Thomas
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Cocci] SmPL patch against C macro
  2019-02-19  6:55 ` Julia Lawall
@ 2019-02-20  6:25   ` thomas pedersen
  0 siblings, 0 replies; 3+ messages in thread
From: thomas pedersen @ 2019-02-20  6:25 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

On Mon, Feb 18, 2019 at 10:56 PM Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
>
> On Mon, 18 Feb 2019, thomas pedersen wrote:
>
> > Hello,
> >
> > I'm trying to write an SmPL patch which will modify C macro. The test files are:
> >
> > # test_macro.c
> > #define MYMACRO(adsf) { \
> >         .foo = (asdf),\
> > }
> >
> > # test_macro.cocci
> > @@
> > expression E;
> > @@
> >
> > {
> > .foo = E
> > + * 1000
> > }
> >
> > Running with:
> > $ spatch --debug --sp-file test_macro.cocci test_macro.c
> >
> > Gives the output:
> > Unsupported form of #define: File "test_macro.c", line 1
> >
> > What's the correct syntax to match against a similar macro?
>
> It was the macro definition itself that was not supported.  The problem
> should be fixed now.  You can get the latest version from Github.

It works! Thanks.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-20  9:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19  2:01 [Cocci] SmPL patch against C macro thomas pedersen
2019-02-19  6:55 ` Julia Lawall
2019-02-20  6:25   ` thomas pedersen

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.