I am currently investigating tools for C instrumentation for the purpose of
The tricky aspect of it definitely seems to be how to deal with the
There is mostly one question that comes to my mind, and after a bit of
research (on this mailing list) I did not find a satisfying answer.
Let’s say I want to support multiple compilers.
I don’t think I can preprocess the sources with the other compiler, then
parse them with clang, and even
if this would be possible, I think I would be losing too much information
about macro expansion for example. So I will probably need to configure the
Clang preprocessor to modify where it looks for the include files, to use
the one of the compiler in use. Though, I fear having parsing problem with
this approach (the included code might be compiler-specific or might call
some built-ins that clang does not provide, as they mention here
I also fear that running a different preprocessor (clang’s) than the one of
the compiler in use may result in altering the program semantics (does every
preprocessor implements macro expansion the same way?).
By any chance, do you have any idea how existing coverage tools may deal
with this matter? Are there corner cases where instrumentation may be
slightly off because of that?
Thank you if you took the time to read / answer