All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] position confusion?
@ 2017-01-27 23:10 Johannes Berg
  2017-01-28  6:37 ` Julia Lawall
  2017-01-28  6:40 ` Vaishali Thakkar
  0 siblings, 2 replies; 6+ messages in thread
From: Johannes Berg @ 2017-01-27 23:10 UTC (permalink / raw)
  To: cocci

This is nonsense, but I don't see why it shouldn't parse:

@a@
type T;
identifier x;
position p;
@@
T x at p = { };

@b@
type T;
identifier x;
position p;
@@
T x at p = { };

@@
position p != a.p;
position q != b.p;
type T;
identifier x;
@@
*T x at q = {};

->
148 149
Fatal error: exception Failure("meta: parse error: \n = File \"/tmp/test.spatch\", line 17, column 16,??charpos = 148\n????around = 'p', whole content = position q != b.p;\n")


if I replace 'p' by 'q' in @b@, it works fine?

johannes

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

* [Cocci] position confusion?
  2017-01-27 23:10 [Cocci] position confusion? Johannes Berg
@ 2017-01-28  6:37 ` Julia Lawall
  2017-01-28  6:40 ` Vaishali Thakkar
  1 sibling, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2017-01-28  6:37 UTC (permalink / raw)
  To: cocci



On Sat, 28 Jan 2017, Johannes Berg wrote:

> This is nonsense, but I don't see why it shouldn't parse:
>
> @a@
> type T;
> identifier x;
> position p;
> @@
> T x at p = { };
>
> @b@
> type T;
> identifier x;
> position p;
> @@
> T x at p = { };
>
> @@
> position p != a.p;
> position q != b.p;
> type T;
> identifier x;
> @@
> *T x at q = {};
>
> ->
> 148 149
> Fatal error: exception Failure("meta: parse error: \n = File \"/tmp/test.spatch\", line 17, column 16,??charpos = 148\n????around = 'p', whole content = position q != b.p;\n")
>
>
> if I replace 'p' by 'q' in @b@, it works fine?

Yes.  It's stupid, but the declaration of p on the line position p != a.p;
somehow takes over the name p.  To fix someday.

julia

>
> johannes
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>

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

* [Cocci] position confusion?
  2017-01-27 23:10 [Cocci] position confusion? Johannes Berg
  2017-01-28  6:37 ` Julia Lawall
@ 2017-01-28  6:40 ` Vaishali Thakkar
  2017-01-28  8:18   ` Johannes Berg
  1 sibling, 1 reply; 6+ messages in thread
From: Vaishali Thakkar @ 2017-01-28  6:40 UTC (permalink / raw)
  To: cocci

On Saturday 28 January 2017 04:40 AM, Johannes Berg wrote:
> This is nonsense, but I don't see why it shouldn't parse:

Hi,

> @a@
> type T;
> identifier x;
> position p;
> @@
> T x at p = { };
>
> @b@
> type T;
> identifier x;
> position p;

This should be "position p != a.p;".

> @@
> T x at p = { };
>
> @@
> position p != a.p;
> position q != b.p;

And here no need to put constraint for q.

position p != {a.p, b.p};
position q;

> type T;
> identifier x;
> @@
> *T x at q = {};
>
> ->
> 148 149
> Fatal error: exception Failure("meta: parse error: \n = File \"/tmp/test.spatch\", line 17, column 16,  charpos = 148\n    around = 'p', whole content = position q != b.p;\n")
>
>
> if I replace 'p' by 'q' in @b@, it works fine?
>
> johannes
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>

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

* [Cocci] position confusion?
  2017-01-28  6:40 ` Vaishali Thakkar
@ 2017-01-28  8:18   ` Johannes Berg
  2017-01-28  9:11     ` Vaishali Thakkar
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2017-01-28  8:18 UTC (permalink / raw)
  To: cocci

On Sat, 2017-01-28 at 12:10 +0530, Vaishali Thakkar wrote:
> On Saturday 28 January 2017 04:40 AM, Johannes Berg wrote:
> > This is nonsense, but I don't see why it shouldn't parse:
> 
> Hi,
> 
> > @a@
> > type T;
> > identifier x;
> > position p;
> > @@
> > T x at p = { };
> > 
> > @b@
> > type T;
> > identifier x;
> > position p;
> 
> This should be "position p != a.p;".

That has no effect on the point I was trying to make. I told you the
spatch was nonsense ... :)

> > @@
> > T x at p = { };
> > 
> > @@
> > position p != a.p;
> > position q != b.p;
> 
> And here no need to put constraint for q.

There was no need to put a constraint anyway, again, the whole patch
made no sense. But assume I wanted to have p and q in different
positions, or whatever. Note that I didn't even *use* @p in the rule,
so you're making wrong assumptions.

> position p != {a.p, b.p};

Nevertheless, that's something I learned.

johannes

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

* [Cocci] position confusion?
  2017-01-28  8:18   ` Johannes Berg
@ 2017-01-28  9:11     ` Vaishali Thakkar
  2017-01-28  9:16       ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Vaishali Thakkar @ 2017-01-28  9:11 UTC (permalink / raw)
  To: cocci

On Saturday 28 January 2017 01:48 PM, Johannes Berg wrote:
> On Sat, 2017-01-28 at 12:10 +0530, Vaishali Thakkar wrote:
>> On Saturday 28 January 2017 04:40 AM, Johannes Berg wrote:
>>> This is nonsense, but I don't see why it shouldn't parse:
>>
>> Hi,
>>
>>> @a@
>>> type T;
>>> identifier x;
>>> position p;
>>> @@
>>> T x at p = { };
>>>
>>> @b@
>>> type T;
>>> identifier x;
>>> position p;
>>
>> This should be "position p != a.p;".
>
> That has no effect on the point I was trying to make. I told you the
> spatch was nonsense ... :)
>
>>> @@
>>> T x at p = { };
>>>
>>> @@
>>> position p != a.p;
>>> position q != b.p;
>>
>> And here no need to put constraint for q.
>
> There was no need to put a constraint anyway, again, the whole patch
> made no sense. But assume I wanted to have p and q in different
> positions, or whatever. Note that I didn't even *use* @p in the rule,
> so you're making wrong assumptions.

Got your point now. Just tried to solve the parsing error in the 
previous mail. :)

>> position p != {a.p, b.p};
>
> Nevertheless, that's something I learned.
>
> johannes
>

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

* [Cocci] position confusion?
  2017-01-28  9:11     ` Vaishali Thakkar
@ 2017-01-28  9:16       ` Johannes Berg
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2017-01-28  9:16 UTC (permalink / raw)
  To: cocci

But assume I wanted to have p and q in different
> > positions, or whatever. Note that I didn't even *use* @p in the
> > rule,
> Got your point now. Just tried to solve the parsing error in the?
> previous mail. :)

:)
Although, had I known the "!= {a.p, b.p}" thing you pointed out to me,
then I never would've run into this parsing problem to start with :)
Thanks!

johannes

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

end of thread, other threads:[~2017-01-28  9:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27 23:10 [Cocci] position confusion? Johannes Berg
2017-01-28  6:37 ` Julia Lawall
2017-01-28  6:40 ` Vaishali Thakkar
2017-01-28  8:18   ` Johannes Berg
2017-01-28  9:11     ` Vaishali Thakkar
2017-01-28  9:16       ` Johannes Berg

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.