Fix compiler warnings

With this set of changes, the codebase is clear of the following warnings: unused-but-set-variable, unused-variable, double-promotion, reorder. Given that I've turned these warnings into errors so that we don't lose forward progress.