Gcc warnings

This will fix all -Wreorder, -Wunused-variable and several -Wunused-parameter warnings when building with gcc/g++.
There are remaining -Wunused-parameter warnings that I'm unable to solve without breaking things.