I have some questions about UnreachableCodeChecker. It seems that UnreachableCodeChecker suppresses some dead code warnings coming from macros.
Given the below code sippet:
I strongly believe that your heuristic would be very hard to implement. Also the analyzer's symbolic execution engine would be totally unhelpful. Recall that there is no AST constructed for macro bodies, and they don't even need to be valid code - until they're expanded. For example, in the body of your MACRO(), "cond" within "if ()" doesn't have any meaningful type assigned to it, or declared anywhere.
So you may have to compile incorrect parts of the program, probably merge them back into the old AST one way or another, and prove that after any such recompile, the code that would be produced by a certain portion of the macro body would be dead. I believe such facility would be extremely hard to construct, and not worth the effort if all we want is to find a few weird macros.