Wextra fixes

Compiling with the -Wextra option with gcc/clang was giving a lot of warnings.

The last commit about unused variable warning was solved using compiler specific attributes as there doesn't seem to be a "standard" way of doing that.
I did not use the common approach
#define UNUSED(x) (void)(x);
because if for whatever reason we have to use the variable and forget to remove the macro, the compiler won't complain.
I tested with gcc and clang, but can't for msvc, can someone confirm that it works there as well ?

Edit: After rereading my first message, I think I've written the contrary of what I wanted to say.
So I clarified.