We have a design that uses function pointers and sometimes the parameters passed to a "C" routine are not used. Thus we get alot of compiler warnings. Is there any way to remove these warnings? Previous versions of the compiler did not raise these warnings.
I recommend defining a macro so that you can change implementation as needed between compiler versions or different platforms.
#define UNUSED(arg) if(arg){} void f (int a) { UNUSED(a); }
void f (int a, int /*b*/) { }
This is an eternal problem - especially in the type of situation you describe. There are various tricks, none of which is universally applicable to all compilers. :-( eg
void fn( int unused1, unused2 ) { unused1; // dummy reference to unused1 unused2 = unused2; // dummy reference to unused2 }
View all questions in Keil forum