All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] cocci script to add static to const declarations ?
@ 2017-08-30 10:49 Joe Perches
  2017-08-30 11:12 ` SF Markus Elfring
  2017-08-30 11:41 ` Julia Lawall
  0 siblings, 2 replies; 14+ messages in thread
From: Joe Perches @ 2017-08-30 10:49 UTC (permalink / raw)
  To: cocci

Any idea on how to write a cocci script that
looks for const array declarations and adds
static to them only when all the initializers
of the array are constants?

For instance:

    int foo(int bar)
    {
    	    const int baz[] = {1, 2, 3};
    }

could be converted to

    int foo(int bar)
    {
    	    static const int baz[] = {1, 2, 3};
    }

but

    int foo(int bar)
    {
    	    const int baz[] = {1, 2, 3, bar};
    }

would not be converted?

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

end of thread, other threads:[~2017-08-31 20:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-30 10:49 [Cocci] cocci script to add static to const declarations ? Joe Perches
2017-08-30 11:12 ` SF Markus Elfring
2017-08-30 11:41 ` Julia Lawall
2017-08-30 11:55   ` Joe Perches
2017-08-30 20:48     ` Julia Lawall
2017-08-30 21:41     ` Julia Lawall
2017-08-30 22:33       ` Joe Perches
2017-08-31  5:04         ` Julia Lawall
2017-08-31 14:22         ` Julia Lawall
2017-08-31 18:11           ` Joe Perches
2017-08-31 19:25             ` Julia Lawall
2017-08-31 20:06               ` Joe Perches
2017-08-30 12:38   ` Joe Perches
2017-08-30 13:02     ` Julia Lawall

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.