Skip to content

Conversation

@jonatack
Copy link
Member

@jonatack jonatack commented Apr 28, 2022

along with those seen elsewhere in the codebase (prevector and checkqueue units/fuzz/bench).

A swap must not fail; when a class has a swap member function, it should be declared noexcept.
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c84-a-swap-function-must-not-fail

@laanwj
Copy link
Member

laanwj commented Apr 28, 2022

Concept ACK.
Do we have any other swap member functions?

@jonatack jonatack changed the title validation: make the CScriptCheck::swap() member function noexcept validation: make CScriptCheck and prevector swap members noexcept Apr 28, 2022
Copy link

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 01e223f

@jonatack
Copy link
Member Author

jonatack commented Apr 28, 2022

Concept ACK. Do we have any other swap member functions?

Added the remaining ones found with git grep "void swap" and looking through git grep -C3 "std::swap" ... critical code in one commit, and test/bench in a second one.

@pk-b2
Copy link

pk-b2 commented May 2, 2022

ACK e5485e8

Copy link
Contributor

@w0xlt w0xlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK e5485e8

These changes make the code conform to the C.85: Make swap noexcept directive.

@maflcko maflcko merged commit 5c93fc1 into bitcoin:master May 2, 2022
@jonatack jonatack deleted the swap-noexcept branch May 2, 2022 12:31
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 2, 2022
… members noexcept

e5485e8 test, bench: make prevector and checkqueue swap member functions noexcept (Jon Atack)
abc1ee5 validation: make CScriptCheck and prevector swap member functions noexcept (Jon Atack)

Pull request description:

  along with those seen elsewhere in the codebase (prevector and checkqueue units/fuzz/bench).

  A swap must not fail; when a class has a swap member function, it should be declared noexcept.
  https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c84-a-swap-function-must-not-fail

ACKs for top commit:
  pk-b2:
    ACK bitcoin@e5485e8
  w0xlt:
    ACK bitcoin@e5485e8

Tree-SHA512: c82359d5e13f9262ce45efdae9baf71e41ed26568e0aff620e2bfb0ab37a62b6d56ae9340a28a0332c902cc1fa87da3fb72d6f6d6f53a8b7e695a5011f71f7f1
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Feb 28, 2023
…functions noexcept

Summary:
Reason:
A swap must not fail; when a class has a swap member function, it should be declared noexcept.
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c84-a-swap-function-must-not-fail

This is a backport of [[bitcoin/bitcoin#25017 | core#25017]]

Test Plan: `ninja all check-all bench-bitcoin bitcoin-fuzzers`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D13188
@bitcoin bitcoin locked and limited conversation to collaborators May 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants