Controls the recognition of unreferenced variables.
#pragma warn_unusedvar on | off | reset
If you enable this pragma, the compiler issues a warning message when it encounters a variable you declare but do not use.
This check helps you find variables that you either misspelled or did not use in your program. The following listing shows an example.
int error; void func(void) { int temp, errer; /* NOTE: errer is misspelled. */ error = do_something(); /* WARNING: temp and errer are unused. */ }
If you want to use this warning but need to declare a variable that you do not use, include the pragma unused, as in the following listing.
void func(void) { int i, temp, error; #pragma unused (i, temp) /* Do not warn that i and temp */ error = do_something(); /* are not used */ }