Fixed/suppressed a bunch of warnings about unused variables

Most were genuinely unused, probably leftover from previous refactoring.
A few are unused but only because their use is commented out, so I commented out the declarations too.