For a peripheral requirement in an embedded system, I have to declare a variable to read a register, but won't use the value later. Hence, I get compiler warning about my unused variable naturally. How can I suppress the warning? I have 2 ways in mind:
- using compiler directives, I hesitate because they are compiler-dependent
adding a dummy read from variable, like:
volatile int var; var = peripheral_register; var = var;
Do you have a better idea?