So i have some code like this:
void foo (int, int);
void bar ( )
{
//Do Stuff
#if (IMPORTANT == 1)
foo (1, 2);
#endif
}
...then I started to wonder if there was a different way to suppress that warning on that function.
There might be compiler option(s) to suppress this warning. However, one trick is this:
(void)foo; //cast it to void.
It should suppress this warning.
You could write a macro:
#define SUPPRESS_WARNING(a) (void)a
void foo(int thisIsAlsoAnUnsedParameter, int usedParameter)
{
SUPPRESS_WARNING(foo); //better do this inside the definition itself :D
SUPPRESS_WARNING(thisIsAlsoAnUnsedParameter);
}
As you can see, the definition of foo itself suppresses the warning.