But yeah, I'd prefer the if(0) type of elimination.
Some parts of OpenSSL do this, and it seems to work well across a pretty wide variety of platforms/toolchains.
A really important benefit is that you get code syntax-checked as opposed to unused #ifdef branches rotting. A minor benefit is you don't have ifdef spaghetti around local variables, to avoid "xxx is not used" warnings.