Simplify ALLOW_UNUSED_LOCAL to use (void)x directly instead of conditionally.
Add ALLOW_UNUSED_LOCAL implementation for path-sensitive analyzers.
The current definition of ALLOW_UNUSED_LOCAL uses "(void)x" to suppress
warnings that "x" was never used, but places the expression in a
never-executed codepath of a ternary expression, forcing this
statement to be a no-op.
Static analyzers which are codepath sensitive, like Clang's scan-build,
will only trace along the no-op codepath and therefore will never
evaluate the voidification clause. The result is a lot of warning noise
"warning: Value stored to 'x' during its initialization is never read"
This CL removes the ternary expression from ALLOW_UNUSED_LOCAL so that the voidification statement is evaluated by path sensitive checkers. The build size was not affected by this change, therefore it's reasonable to assume that this won't have an effect on runtime behavior.
1 file changed