Suppose we have and original source file which includes code blocks inside #ifdef conditionals and another file which has been manually "preprocessed", so some of the code blocks have been included an others have been removed. How can I see only modifications that don't come from an #ifdef
?
As an example, the original file could be:
#ifdef X
blabla1
#else
blabla2
#endif
and the modified file is:
blabla2
new line
I only want to detect that new line
has been added.
Is there a tool or a short way to do this? If I knew in advance if X
was defined or not, I could strip the irrelevant code with unifdef
, but in this case I don't know it and once there are many variables, trying all possible combinations is infeasible.
I think a way to do it would be through a diff
to identify the differences and then check if the differences are inside an ifdef, but this doesn't seem straightforward to implement.