I have search the solutions for C/C+ unused variable warning, and none fits my need. Here's the situation:
I am developing algorithms on PC, and will then port it to the real embedded platform. The PC version will have debug codes showing images on a monitor of a PC. The embedded platform, unfortunately, does not have a monitor. Of course the embedded platform does not need those debug code at all.
To distinguish the code, we can do this:
#ifndef EMBEDED
   MyDebugCode(parameter1, parameter2, parameter3);
#endif
However, I decide that this is too lousy, since there are so many calls of those debug functions.  Those EMBEDED conditionals will pollute the code. Instead, I try to write the conditional compile flag inside the debug function like below:
inline void MyDebugCode(type1 p1, type2 p2, type3 p3)
{
#ifndef EMBEDED
     DisplaySomethingOnMonitor(p1, p2, p3);
     ...
     ...
     ...
#endif
}
So that I can write the #ifndef/#ifdef once, in the function, and call it many times without those #ifndef/#ifdef.
Now when EMBEDED is defined, we will get unused varaible p1, p2, and p3.  This is the problem.
In addition, I am hoping the inline can be totally optimized out the whole debug function, as if it does not exist, when EMBEDDED is defined. This is secondary though.
Anyone has better solutions/practices?
Please note that those parameters can be references to class instances.
The compiler is g++
 
     
    