[cfe-dev] [StaticAnalyser] hiding unwanted unreachable code warning in macro
Daniel Marjamäki via cfe-dev
cfe-dev at lists.llvm.org
Tue Oct 11 08:18:56 PDT 2016
Hello!
I would like to somehow hide an unwanted unreachable code warning in a macro.
Example code:
#define MACRO(A,B) do{return;}while(0)
void asd() {
MACRO(1,2);
}
Clang says that condition "0" is never executed. This is true but well that while(0) is there for a good reason.
I guessed that a workaround would be to write:
#define MACRO(A,B) ({return;})
but clang warns about this too. and anyway this syntax is also less familiar than "do {} while (0)".
What should I do? Can I write a fix that hide "unreachable code" warnings in macros? To me it seems that in general such warnings should be hidden.
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