net: flag relevant Sock methods with [[nodiscard]] #21659

pull vasild wants to merge 1 commits into bitcoin:master from vasild:Sock_nodiscard changing 4 files +21 −18
  1. vasild commented at 1:51 PM on April 12, 2021: contributor

    Flag relevant Sock methods with [[nodiscard]] to avoid issues like the one fixed in #21631.

  2. vasild cross-referenced this on Apr 12, 2021 from issue fuzz: split FuzzedSock interface and implementation by vasild
  3. vasild cross-referenced this on Apr 12, 2021 from issue i2p: always check the return value of Sock::Wait() by vasild
  4. vasild commented at 1:58 PM on April 12, 2021: contributor

    Having two Wait() methods - one flagged with [[nodiscard]] with 3 arguments and one without [[nodiscard]] with 2 arguments seems like too much new lines of code.

    I am ~0 on this. Taking the dump/KISS approach for now - one [[nodiscard]] Wait() and cast to void the callers that don't check the return value.

    cc @practicalswift

  5. practicalswift commented at 2:19 PM on April 12, 2021: contributor

    Concept ACK

    Rationale: Having the [[nodiscard]] annotation on Wait would have saved us from one uninitialized read historically. That's enough empirical evidence to convince me about the need for [[nodiscard]] here.

    Thanks for addressing this!

  6. DrahtBot added the label P2P on Apr 12, 2021
  7. DrahtBot added the label Utils/log/libs on Apr 12, 2021
  8. fanquake added the label Needs rebase on Apr 13, 2021
  9. net: flag relevant Sock methods with [[nodiscard]] e286cd0d7b
  10. vasild force-pushed on Apr 13, 2021
  11. vasild commented at 3:27 PM on April 13, 2021: contributor

    51878b307...e286cd0d7: rebased, now #21631 is merged and I removed it from this PR

  12. vasild marked this as ready for review on Apr 13, 2021
  13. DrahtBot removed the label Needs rebase on Apr 13, 2021
  14. practicalswift commented at 6:29 AM on April 14, 2021: contributor

    cr ACK e286cd0d7b4e12c8efe5e7ac3066a100e0ba2c0a: the only changes made are additions of [[nodiscard]] and (void) where appropriate

  15. DrahtBot cross-referenced this on May 7, 2021 from issue Make all networking code mockable by vasild
  16. DrahtBot commented at 11:28 PM on May 7, 2021: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #21878 (Make all networking code mockable by vasild)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  17. laanwj commented at 1:08 PM on May 19, 2021: member

    Code review ACK e286cd0d7b4e12c8efe5e7ac3066a100e0ba2c0a

  18. laanwj merged this on May 19, 2021
  19. laanwj closed this on May 19, 2021

  20. vasild deleted the branch on May 19, 2021
  21. sidhujag referenced this in commit 6ae83253d2 on May 19, 2021
  22. vasild cross-referenced this on May 20, 2021 from issue refactor: wrap accept() and extend usage of Sock by vasild
  23. gwillen referenced this in commit ba0573cbe6 on Jun 1, 2022
  24. bitcoin locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:54 UTC