cocci.systeme.lip6.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] moving variable declarations up
@ 2020-06-17 20:54 Johannes Berg
  2020-06-17 21:15 ` Julia Lawall
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Berg @ 2020-06-17 20:54 UTC (permalink / raw)
  To: cocci

Hi spatchers,

I've been working on an old code base, and toying with something like
this:

@@
type T;
identifier x;
expression E, F;
@@
{
+T x;
+
 E;
...
-T x;
...
}

(and also a variant with "T x = F;" where F is an expression).


That works OK if there's only a single variable, but...

First, it only moves a single variable up, even if I run it multiple
times (I think)?

Secondly, sometimes it says something like:

previous modification:

  <<< T x;
      
CONTEXT
According to environment 2:
   rule starting on line 15.x -> id var1
   rule starting on line 15.T -> u32

current modification:

  <<< T x;
      
CONTEXT
According to environment 2:
   rule starting on line 15.x -> id var2
   rule starting on line 15.T -> u32

EXN:Failure("rule starting on line 15: already tagged token:\nC code context\nFile \"/tmp/cocci_small_output-170001-6edb7c.c\", line 150, column 4,  charpos = 8969\n    around = 'DEBUG_PRINT', whole content =     DEBUG_PRINT(...omitted...);")


That's basically what I saw, something like

DEBUG_PRINT(...);
u32 var1 = ...;
u32 var2 = ...;


Any ideas how I can make it move more variable declarations up?

Thanks,
johannes

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

^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <50990ed6-f5b7-c031-a5df-bdaa6863baa8@web.de>]

end of thread, other threads:[~2020-06-18 15:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-17 20:54 [Cocci] moving variable declarations up Johannes Berg
2020-06-17 21:15 ` Julia Lawall
2020-06-17 21:19   ` Johannes Berg
2020-06-17 21:47     ` Johannes Berg
2020-06-18 15:25       ` Julia Lawall
2020-06-18 15:49       ` Julia Lawall
2020-06-18  5:59     ` Julia Lawall
2020-06-18  7:37       ` Johannes Berg
     [not found] <50990ed6-f5b7-c031-a5df-bdaa6863baa8@web.de>
2020-06-18  7:20 ` Johannes Berg
     [not found]   ` <b6ded75b-c4fe-dab6-b50a-d8ce55793b97@web.de>
2020-06-18  7:34     ` Johannes Berg

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).