[cfe-dev] Is it possible to avoid FP when there is #ifdef in the code

Daniel Marjamäki via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 26 01:35:31 PDT 2015


Hello!

Sometimes there are false positives when #ifdef is used and for instance usage of some macro/parameter is hidden.

I am running Clang in a project where we get several such FPs.

Example code:

void f(int x) {
    // ..code..
#ifdef XYZ
    dostuff(x);
#endif
    // ..code..
}

Warning:
1.c:1:12: warning: unused parameter 'x' [-Wunused-parameter]
void f(int x) {
           ^


Is there anything that can be done in the unused-parameter checker to prevent such FP?

For instance.. is it possible to see if there was a #ifdef in a function and disable the warning in that function.

Best regards,
Daniel Marjamäki


..................................................................................................................
Daniel Marjamäki Senior Engineer
Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden

Mobile:                 +46 (0)709 12 42 62
E-mail:                 Daniel.Marjamaki at evidente.se

www.evidente.se



More information about the cfe-dev mailing list