g++ verifies predetermined set of rules and constraints which if not met in code throws an error or warning messages. Is it possible using some tool to create a parser for custom set of rules such as "global variables need to be explicitly initialized" (I know global variables are implicitly initialized), or functions with name init has been called (I know about constructors but don't want to use them). Any pointers to something quick and simple would be useful.
Coverity lets you write custom rules like this. It's kind of expensive, so probably not a hobby kind of thing to set up just for this. It's a good tool for production code, though, and extensible.