This is a directory of semantic patches to apply with coccinelle, like the collection in systemd: https://github.com/systemd/systemd/tree/29f32655842a0712e8db482bcefc4da8908460c8/coccinelle See also the tests/coccinelle directory which has spatches which detect errors.