Xcode does not have this feature built-in. It may be possible to write an Xcode plugin to accomplish this, but you will face the following problems.
- The Xcode plugin API is unsupported and undocumented.
- Xcode plugins have to be rewritten for new versions of Xcode
- It is actually difficult to determine if code is active or not.
That last point takes some explaining. Let's say you have the following code
#ifndef SOME_UNUSED_DEFINE
// Some code
#else
// Some other code
#endif
Usually, the else code will be inactive. However, if the compiler is passed -DSOME_UNUSED_DEFINE, then it is reversed. The ifndef code block is inactive, and the else code is active.