This is an archive of the discontinued LLVM Phabricator instance.

Add maybe-unused attribute to a variable.
ClosedPublic

Authored by nickdesaulniers on Jul 24 2018, 1:41 PM.

Details

Summary

Mark a variable as maybe-unused to prevent a -Wunused-but-set-variable
warning in optimized builds where asserts are removed.Test/first commit
to check setup and understand patch submission process.

Diff Detail

Event Timeline

Alternatively, we can surround the definition and use of Listed with #ifndef NDEBUG blocks, but it would be ugly to have two of those IMO.

  • Prefer cast to void than variable attribute.
dblaikie accepted this revision.Aug 1 2018, 4:44 PM

Looks good - thanks! (do you need me to commit this change for you?)

This revision is now accepted and ready to land.Aug 1 2018, 4:44 PM
This revision was automatically updated to reflect the committed changes.

Thanks for the review. Should be all set.