I'm having a project that does lots of this
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
// do some legacy stuff
#else
// do current stuff
#endif
where KERNEL_VERSION
is defined as
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
I'd like to eliminate the defines that are not relevant for the current version, but tools like sunifdef
don't evaluate the KERNEL_VERSION
macro, so something like
sunifdef --replace -DKERNEL_VERSION\(a,b,c\)=\(\(\(a\)\<\<16\)+\(\(b\)\<\<8\)+\(c\)\) -DLINUX_VERSION_CODE=3.13.1 *
fails with the message
sunifdef: error 0x04200: Garbage in argument "-DKERNEL_VERSION(a,b,c)=(((a)<<16)+((b)<<8)+(c))"
How do I get around this?