All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] gboolean -> bool conversion
@ 2013-07-11  8:17 Daniel Wagner
  2013-07-11  8:29 ` Julia Lawall
  0 siblings, 1 reply; 20+ messages in thread
From: Daniel Wagner @ 2013-07-11  8:17 UTC (permalink / raw)
  To: cocci

Hi,

I'd like to convert a bunch of gboolean decleration to stdbool in our 
ConnMan code base. I am a noob with coccinelle. I have partial success 
so far but I do not thing I am doing the right thing. So any advice is 
welcome :)


This here is my current coccinelle script for converting gboolean used 
as stack variable. I have also one for structs, which gave my good 
results. Another one is needed then for the function arguments. But 
let's first have a look on this part.

@r1@
position p;
typedef gboolean;
identifier func,x;
@@
func(...) {
<...
	gboolean@p x;
...>
}

@r2@
position r1.p;
typedef bool;
@@
- gboolean at p
+ bool

@r3@
identifier r1.x;
@@
(
- x = FALSE
+ x = false
|
- x = TRUE
+ x = true
)

int main(int argc, char *argv[])
{
	gboolean b = TRUE;

	return 0;
}

results in

int main(int argc, char *argv[])
{
-       gboolean b = TRUE;
+       bool b = true;

         return 0;
}

which is what I wanted. Now the problem is that I really have no clue to 
mach on things like

int main(int argc, char *argv[])
{
	gboolean b = TRUE, c = FALSE;

	return 0;
}

Any idea?

cheers,
daniel

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

end of thread, other threads:[~2013-07-17 15:40 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-11  8:17 [Cocci] gboolean -> bool conversion Daniel Wagner
2013-07-11  8:29 ` Julia Lawall
2013-07-11  9:07   ` Daniel Wagner
2013-07-11  9:57     ` Julia Lawall
2013-07-11  9:58     ` Daniel Wagner
2013-07-11 10:24       ` Julia Lawall
2013-07-11 11:17         ` Daniel Wagner
2013-07-11 12:17           ` Julia Lawall
2013-07-11 12:38             ` Daniel Wagner
2013-07-11 13:07               ` Julia Lawall
2013-07-12  6:55                 ` Daniel Wagner
2013-07-12  7:00                   ` Julia Lawall
2013-07-12  9:08                     ` Daniel Wagner
2013-07-16 14:21                     ` Daniel Wagner
2013-07-16 16:22                       ` Julia Lawall
2013-07-17  8:47                         ` Daniel Wagner
2013-07-17  9:01                           ` Julia Lawall
2013-07-17 14:58                             ` Daniel Wagner
2013-07-17 15:11                               ` Julia Lawall
2013-07-17 15:40                                 ` Daniel Wagner

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.