It is a common pattern to use function pointers to pass callback arguments in C APIs (and even to some C++ APIs). This also extends to uses that are not strictly speaking related to callbacks.
In that context, having unused arguments or wrongly non const arguments is not under the control of the author of the callback.
This exception can be implemented in two ways:
- in each translation unit with an heuristic on the name. Any function name having "cb" or "callback" in it for instance should be free to have unused parameters. More patterns can be added.
- at project level, collect all functions used as arguments and silent the corresponding issues