@chown, I think: "If the compiler knows about the symbol ... just like when building." indicate that the compiler parses the code and fulfills all the conditions of the preprocessor. In this case, the compiler will not notice the use of the variable inside such #ifdef
, where the condition is not met.
This also explains why it "works great in #else
."
You can try to use the UNUSED macro, but you have to disable the warning for "Unused Values":
#define UNUSED(a) a ... -(void)test:(id)argument { UNUSED(argument); #ifdef AAA NSLog(@"arg:%@", argument); #endif }
Zdima source share