The following warnings apears from time to time. MEM_TST.C(41): warning C280: 'mem_DPP': unreferenced local variable Sometimes I want to suspend them, but I can't find how. suspend linker warnings, Lxxx, are possible via the project configuration screens but I didn't see any place to direct the compiler to suspend compilation warnings Cxxx. Is it possible at all ? I am using the following environment: IDE-Version: µVision2 V2.40 Tool Version Numbers: Toolchain Path: C:\Keil\C51\BIN\ C Compiler: C51.Exe V7.10 Assembler: A51.Exe V7.09 Linker/Locator: BL51.Exe V5.03 Librarian: LIB51.Exe V4.24 Hex Converter: OH51.Exe V2.6 CPU DLL: S8051.DLL V2.43 Dialog DLL: DCORE51.DLL V2.43 Target DLL: BIN\DCD_DoCD.DLL V1.06 Dialog DLL: TP51.DLL V2.43 Thanks. Amit A.
"'Suspending' warnings is almost invariably the wrong thing to do. Fix the code so there's no reason for the warning to appear, instead." Definitely! "For the warning under consideration, that means to simply remove the superfluous variable" Unfortunately, the Keil compiler also gives this warning for unused function parameters. There may be reasons why the function needs to conform to a certain set of parameters in this particular application (eg, a common API format). Therefore, it would be helpful if the message distinguished between unused parameters and unused local variables. This is a very common problem, and "workarounds" that work in one compiler may not in others; eg, as I mentioned before, the "dummy reference" works for Keil but gives another warning in some other compilers! Some compilers have a #pragma to specifically mark a parameter as "unused".
This is a very common problem, and "workarounds" that work in one compiler may not in others; In my own experience, a pretty universally applical idiom is
(void) parameter; /* Explain why... */
"I've yet to see any compiler warn me about that one." Yes, I have seen a "Code has no effect" warning for that! I forget exactly what compiler it was - something VAX-based for a Hitachi version of the Motorola HC05, or something...?