I've never seen anything like this. The first case is impossible or
very hard: there are multiple versions of symbols, and the C
preprocessor can have a profound impact on the meaning a program, so
you'd have to restart the compilation. Also, I don't think there are
any hooks provided for the language front-ends. The second would, I
think. be easier, but I haven't seen such a thing.
Andrew.