The new BL51 option to disable specific warning messages is very nice! I would also like to have this capability in the C51 compiler (finer-grained control than WARNINGLEVEL). Specifically, there are times when I want to disable warning C280 (unreferenced local variable) when I know that I will not reference a parameter to the subroutine, and then re-enable that warning for subsequent functions in that module. For example: #pragma DISABLEWARNING(280) void funct1( char p1, char p2 ) { // this function does not need p1 do something with p2, ignore p1 } #pragma ENABLEWARNING(280) void funct2( char p1, char p2 ) { //this function SHOULD use both params // so I want the warning if I mess up }
I second that! Or maybe something like
#pragma unused p1
void funct1( char p1, char p2 ) { p1 = p1; // dummy - does nothing, stops warning. do something with p2... }
When you don't use a parameter, I confirm that instruction "p1=p1;" don't gererate any code if parameter p1 is a register. But if a parameter p1 is in memory, you must use instruction "if(p1);" for do not generate any code and suppress warning.