All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] remove typedefs from struct
@ 2015-02-14 18:29 Sören Brinkmann
  2015-02-14 18:56 ` Julia Lawall
  2015-02-15 17:13 ` [Cocci] remove typedefs from struct SF Markus Elfring
  0 siblings, 2 replies; 31+ messages in thread
From: Sören Brinkmann @ 2015-02-14 18:29 UTC (permalink / raw)
  To: cocci

Hi,

I'm just getting my feet wet with coccinelle, so I'm probably missing
something really obvious in my problem.

I have a codebase that uses plenty of
  typedef struct foo {
  	...
  } bar;

I want to remove all these typedefs and simply use struct foo instead. I
came up with this patch:

  /// Convert typdefed structs to structs
  
  @ rule1 @
  identifier i;
  type t;
  @@
  -typedef struct i {
  +struct i {
  	...
  - }t;
  + };
  
  @@
  identifier rule1.i;
  type rule1.t;
  @@
  -t
  +struct i
  // end of patch

This seems to work for most occurrences, but there are a couple of
variables defined like this:

  static const t *const baz[MAX] = {
  	...
  };

And also function declarations like: 
  u32 fn(const t* const baz);

In such cases, t isn't replaces as I would expect, but those lines
aren't changed at all.

Other variables and non-const function parameters seem to be replaced as
expected.
Does anybody have an idea what I'm missing?

	Thanks,
	Soren

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

end of thread, other threads:[~2015-02-19 18:55 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-14 18:29 [Cocci] remove typedefs from struct Sören Brinkmann
2015-02-14 18:56 ` Julia Lawall
2015-02-15  1:22   ` Sören Brinkmann
2015-02-15  5:54     ` Julia Lawall
2015-02-15  9:38     ` Julia Lawall
2015-02-15 21:05       ` Sören Brinkmann
2015-02-15 21:16         ` Julia Lawall
2015-02-15 21:31           ` Sören Brinkmann
2015-02-15 21:41             ` Julia Lawall
2015-02-15 21:53               ` Sören Brinkmann
2015-02-15 21:56                 ` Julia Lawall
2015-02-16  9:00                   ` Sören Brinkmann
2015-02-16  9:10                     ` Julia Lawall
2015-02-16 15:59                       ` Sören Brinkmann
2015-02-17  6:56                     ` Julia Lawall
2015-02-17 19:42                       ` Sören Brinkmann
2015-02-17 20:31                         ` Julia Lawall
2015-02-18  0:50                           ` Sören Brinkmann
2015-02-18 21:44                             ` Julia Lawall
2015-02-19  9:08                               ` [Cocci] Finding several type qualifiers with SmPL? SF Markus Elfring
2015-02-19 16:47                                 ` Sören Brinkmann
2015-02-19 16:54                                   ` Julia Lawall
2015-02-19 18:55                                     ` SF Markus Elfring
2015-02-19 18:30                                   ` SF Markus Elfring
2015-02-15 17:13 ` [Cocci] remove typedefs from struct SF Markus Elfring
2015-02-15 17:32   ` Julia Lawall
2015-02-15 20:15     ` Sören Brinkmann
2015-02-16  4:31     ` Sören Brinkmann
2015-02-16  6:19       ` Julia Lawall
2015-02-16  7:51         ` Sören Brinkmann
2015-02-16  8:10           ` 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.