Suppress cppcheck unusedFunction warnings for CMHG entry points
Just about every C module in the source tree uses CMHG to interface with the kernel. However, cppcheck doesn't understand CMHG files, and so it will incorrectly identify any C entry points from the CMHG object file as unused functions.
The main command-line suppression options for cppcheck are:
- --suppress=unusedFunction : blanket suppression of the warning for all files. This is undesirable because it would mean we miss many examples of dead code, and ironically, since modules commonly feature in ROMs which are space-constrained, it's particularly valuable to identify dead code in these cases.
- --suppress=unusedFunction:[filename] : better, but a pain to implement the CI job for (we'd need to pass it the relevant filename(s) somehow), a pain to maintain (for every module, we'd need to identify the relevant file(s)) and could still miss some dead code.
- --suppress=unusedFunction:[filename]:[line] : solves the dead code problem but at the cost of being even more hassle to maintain, due to having to keep line numbers up-to-date.
Compared to these options, inline suppression markers look very attractive. However, objections have been raised to these also, so here we use a new feature of cppcheck 1.84 (available now that we have upgraded the GitLab runner machine to Ubuntu 20.04): the more verbose but more flexible option of passing a suppression specification to cppcheck in XML format. The XML file itself is generated during the "make standalone" command that is performed as part of the CI job. For non-module components, the XML file is not generated, and the option to cppcheck is silently removed.
Also, to avoid merge conflicts, this MR is not based on master: you should merge !10 (merged) first.