introduce "unused" warnings to detect unused variables

Even in the current master branch where unused variables will be removed by "dce" optimizer, this warning will be useful to brush the code up. d37c1e72d70beb07a4b1b17c7a9a0f724dd0f451 is an example to refactor the code.