cpp: do not register headers for forward decls

- fix formatter factory for exceptions and enums