I was playing around a bit with -fcoverage-mcdc added in Clang 18. The docs say:
When instrumenting for Modified Condition/Decision Coverage (MC/DC) using the clang option -fcoverage-mcdc, users are limited to at most six leaf-level conditions in a boolean expression. A warning will be generated for boolean expressions that contain more than six, and they will not be instrumented for MC/DC.
If I write an expression with more than 6 conditions, I can trigger the warning However, if I want to make sure that all of the code is getting instrumented, I would need to promote this warning to an error. Is that possible out of the box? Even with -Werror, the compilation succeeds
I donāt really know much about MC/DC but I do know how to poke around in the sources⦠it looks like MC/DC doesnāt use a defined -W group/option for this warning, so I think thereās no way to control it.
@evodius96 looks like you did this work, it seems like a reasonable request to be able to error out instead of just getting a warning?
Right, presently there is no way to change the warning to error (though I initially argued this should be an error by default, but I digress). We will need to add that.
However with @chapuni 's change, clang can instrument more than six conditions, so that ought to work for you. Hopefully we can get that landed soon.
Sorry for the long delay - life things⢠were happening
I managed to try out @chapuniās branch today - and this looks awesome. It raises the limit enough so that in practice, there is none anymore, it makes -Werror behave as expected and (at least, in my tests) it is even a tiny bit faster, both in terms of build and execution time. Really nice work!
By the way: This was my first time building a compiler myself. The process for clang (and the related libs and coverage postprocessing tools) was really easy to get into - kudos to everyone involved