hello everybody!
I am trying to understand some code of linux but i am not 100% able to understand preprocessor's directives and programming conventions...
here is the code i want to understand:
Code:
#define __define_initcall(level,fn,id) \
static initcall_t __initcall_##fn##id __attribute_used__ \
__attribute__((__section__(".initcall" level ".init"))) = fn
#define device_initcall(fn) __define_initcall("6",fn,6)
#define __initcall(fn) device_initcall(fn)
#define module_init(x) __initcall(x);
I can understand almost everything besides the 1st #define (all the rest are substitutions of symbols, isn't it?):
the symbol
Code:
__define_initcall(level,fn,id)
will be replaced with
Code:
static initcall_t __initcall_##fn##id __attribute_used__ __attribute__((__section__(".initcall" level ".init"))) = fn
the ##fn## has to be replaced with fn and the symbols at the left and right have to be concatenated, eg:
Code:
__define_initcall("6",fn,6)
will become
Code:
static initcall_t __initcall_fnid __attribute_used__ __attribute__((__section__(".initcall" level ".init"))) = fn
is this a correct interpretation? what is the convention behing the double underscore (__) before the name of the macro?
thanks for your help! Bye