i found this macro in one kernel code..
http://lxr.free-electrons.com/source/arch/alpha/include/asm/io.h?v=3.0;a=arm#L140
#define IO_CONCAT(a,b) _IO_CONCAT(a,b)
#define _IO_CONCAT(a,b) a ## _ ## b
i am unable to understand the meaning of this.Does anybody know this?
Edit :
Then here what it will return
return IO_CONCAT(__IO_PREFIX,readl)(addr);
Double hash is used to concatenate two tokens together:
However, such naive implementation doesn’t work in case when one of the arguments being passed is a macro itself:
That is why macro indirection is used in your question:
UPD.
Now consider the concrete example you’re asking about:
Here
__IO_PREFIXis obviously a macro (uppercase identifiers in Linux kernel are often macros). It is defined in several places, one of them is:Now let’s see which steps are taken to expand the original statement:
__IO_PREFIX:IO_CONCAT(...):_IO_CONCAT(...):