In fact, the #define is not used by the structure snd_device_ops,  the snd_device in the struture is be defined in some other place.

This code is a part of alsa (advanture linux sound driver, an open source project).

Now I am working on write a sound driver in linux, and I setup a ede-cpp-root-project on my code, then I use semantic-ia-fast-jump to browse my code. I find sometimes I loss the respond of emacs when I run the semantic-ia-fast-jump command, so I extract my code to find which part of code cause this problem, at last, I get the code I sent to you in test1.c. This piece of code is not written by me, I don't know why the author write the code in this from too, but if you can fix this problem, it will be very helpful for me.


2010/1/17 Eric M. Ludlam <eric@siege-engine.com>

I see the problem, but can you explain this C code?

The issue is that snd_device is #defined after it is used in the structure, and the use in the structure doesn't have enough arguments, and that's making CEDET a bit cranky.

Is it supposed to be defined in that order?  Is snd_device also a non-macro somewhere else?

I'll try to fix the hang, but I'd like to understand how the code is supposed to work too.


yupeng wrote:
this is a c program file test1.c:
struct snd_device_ops {
       int (*dev_disconnect)(struct snd_device *dev);

#define snd_device(n) list_entry(n, struct snd_device, list)

int my_variable;

void snd_power_lock( void )
   my_variable = 0;