I was coding the printk routine for which i needed the varargs. As mentioned in one of the printing tutorials on this website it uses gcc's in built version.
Code: Select all
#define va_start(v,l) __builtin_va_start(v,l)
#define va_arg(v,l) __builtin_va_arg(v,l)
#define va_end(v) __builtin_va_end(v)
#define va_copy(d,s) __builtin_va_copy(d,s)
typedef __builtin_va_list va_list
Code: Select all
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘extern’
Code: Select all
typedef char* va_list;
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
#define va_arg(argp,type) (*(type *)(((argp) +=_INTSIZEOF(type))-_INTSIZEOF(type)))
#define va_end(x) (x=(void*)0)
I've gcc version 4.4.1 OpenSuse11.2 for developing the kernel.