Some time ago, Igor mentioned that there is code in SpiderMonkey that pleads to the programmer that from a certain point in a function code must flow through a label(ie a finalizer block). Treehydra made it to possible to turn that weak plea into an error message when static checking is enabled. See the bug for more details. My favourite static analyses are all about turning informal “gurantees” into angry compiler complaints.

This is my first static analysis that landed in the mozilla-central tree. It’s also the simplest one and may be a decent starting point for solving similar problems. I’d be cool to see this particular feature utilized outside of SpiderMonkey. Unlike human-powered code-inspection, it excels at finding accidental early returns covered up by macros.

1 comment

  1. Analyses of this kind are awesome! Apart from avoiding bugs, the more of these outside-of-the-compiler rules are enforced, the more likely that new contributors who might’ve overlooked the informal rules won’t be turned away by r-’s on reviews of their first patches and will instead familiarize themselves with these rules at development time.