This patch fixes false positives for such code:
#define RETURN(X) do { return; } while (0) void dostuff(void) { RETURN(1); // no-warning }
The condition "0" in the macro is unreachable but that condition is there for a good reason.
Differential D25606
alpha.core.UnreachableCode - don't warn about unreachable code inside macro danielmarjamaki on Oct 14 2016, 3:18 AM. Authored by
Details
This patch fixes false positives for such code: #define RETURN(X) do { return; } while (0) void dostuff(void) { RETURN(1); // no-warning } The condition "0" in the macro is unreachable but that condition is there for a good reason.
Diff Detail
Event TimelineComment Actions We should pattern match for this specific macro pattern (ex: do{...}while(0) ) instead of suppressing all warnings coming from macros. Maybe we could use the same heuristic as -Wunreachable-code-return compiler warning? |