I want to customize cc-mode to execute a function before saving. One solution would be to modify cc-mode keymap to bind C-x C-s to a function which performs the work I need and then saves it.
My question is whether there is a hook I could customize for this? The CC Hooks docs don't mention a before-save-hook specifically for cc-mode. How should this be done through a hook?
Alternatively, how do I do this through defadvice? From reading the manual, the only way I could see was to enable the advice before saving and then disable after the work is done. This sounds cumbersome. What would be the idiomatic way of using advices?