Skip to content
  • kmarshall's avatar
    Simplify ALLOW_UNUSED_LOCAL to use (void)x directly instead of conditionally. · d10bb7f7
    kmarshall authored
    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
    like this:
    
    "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.
    
    R=pkasting@chromium.org
    CC=wez@chromium.org
    BUG=687243
    
    Review-Url: https://codereview.chromium.org/2838713002
    Cr-Commit-Position: refs/heads/master@{#467215}
    d10bb7f7