sdformat icon indicating copy to clipboard operation
sdformat copied to clipboard

Add nodiscard and example usage in Actor

Open Ryanf55 opened this issue 1 year ago • 1 comments

🎉 New feature

Relates to #1358

Summary

  • Add a macro to start using nodiscard as recommended in 1358.
  • Demonstrate usage of the macro in Actor.hh
  • If this PR is the right approach, then a future PR (or PR's) can fold this across to the rest of the repo.

In theory, clang-tidy should be able to automatically apply this across the whole repo, but clang-tidy doesn't seem to work with this repo. If anyone knows how to use it, that would be much preferable because automated code refactors are much less error-prone and quicker than me doing it manually.

Test it

  • Compilation is the only thing needed
  • If you want, try calling a getter in an application, and ignoring the return value. If you compile with C++17, it should warn.
  • Same as above, but if you compile with C++14, you should not expect a warning.

Checklist

  • [ ] Signed all commits for DCO
  • [ ] Added tests
  • [ ] Added example and/or tutorial
  • [ ] Updated documentation (as needed)
  • [ ] Updated migration guide (as needed)
  • [ ] Consider updating Python bindings (if the library has them)
  • [ ] codecheck passed (See contributing)
  • [ ] All tests passed (See test coverage)
  • [ ] While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Ryanf55 avatar Jan 30 '24 04:01 Ryanf55

@Ryanf55, @scpeters we don't have much time left before the code freeze. Is this likely to make it by next Wednesday (08/28)?

azeey avatar Aug 19 '24 17:08 azeey

I'm going to close because I don't have time to see this project through. Anyone else is welcome to continue!

Ryanf55 avatar Nov 28 '24 20:11 Ryanf55