Run clang-tidy -,performance- #19675

pull Warchant wants to merge 2 commits into bitcoin:master from Warchant:master changing 67 files +173 −144
  1. Warchant commented at 9:20 pm on August 6, 2020: none

    To reproduce changes:

    1. Install, then find run-clang-tidy.py
    0$ find /usr -type f -name run-clang-tidy.py
    1/usr/share/clang/run-clang-tidy.py
    
    1. You need to create compile_commands.json file. Run autogen, configure, then
    0$ compiledb -n make
    
    1. Run clang-tidy with checks and autofix:
    0$ cd src
    1$ /usr/share/clang/run-clang-tidy.py -checks='-*,performance-*' -p .. -fix
    

    Performance improvement of this change may be small, but anyway nice to have.

  2. Run clang-tidy -*,performance-*
    To reproduce changes:
    
    1. Install, then find run-clang-tidy.py
    $ find /usr -type f -name run-clang-tidy.py
    /usr/share/clang/run-clang-tidy.py
    
    2. You need to create compile_commands.json file.
    Run autogen, configure, then
    $ compiledb -n make
    
    3. Run clang-tidy with checks:
    $ cd src
    $ /usr/share/clang/run-clang-tidy.py -checks='-*,performance-*' -p .. -fix
    49fa26e122
  3. Fix false-positives, add NOLINTNEXTLINE ef99aafe38
  4. DrahtBot added the label Mining on Aug 6, 2020
  5. DrahtBot added the label P2P on Aug 6, 2020
  6. DrahtBot added the label RPC/REST/ZMQ on Aug 6, 2020
  7. DrahtBot added the label Tests on Aug 6, 2020
  8. DrahtBot added the label Utils/log/libs on Aug 6, 2020
  9. DrahtBot added the label UTXO Db and Indexes on Aug 6, 2020
  10. DrahtBot added the label Validation on Aug 6, 2020
  11. DrahtBot added the label Wallet on Aug 6, 2020
  12. practicalswift commented at 9:57 pm on August 6, 2020: contributor

    @Warchant First: welcome as a future contributor! :)

    My guess is that a massive automated refactoring like this with many unrelated changes is unlikely to get merged.

    If you want to proceed with this type of work I suggest picking a single clang-tidy fix-it rule that results in a change set that a.) makes sense (ideally: everyone should agree on that the fix-it version is better than status quo version), b.) is trivially correct (ideally: if-it-compiles-it-is-correct), c.) makes the code more in line with what the developer notes suggest, and d.) doesn’t touch too many lines.

    Of the changes in your PR I guess the function signature transformation from T f(std::string s) to T f(const std::string& s) is scoring (relatively) highest given these criteria.

    And generally: don’t touch dependencies (src/leveldb/ in this case) and try to avoid touching consensus critical code.

    Hope that helps! :)

  13. fanquake commented at 10:01 pm on August 6, 2020: member

    There’s nothing wrong with Travis, you’ve modified a subtree, and the linter is failing as expected. Subtree modifications should always be sent to the relevant upstream repo. See: https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#subtrees .

    In general, PRs that just run some automated tooling against the repo are unlikely to be merged, especially if they come from new contributors, see: https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#refactoring.

    Also, you’ve said this is a performance improvement, but haven’t provided any benchmarks.

    On Fri, 7 Aug 2020 at 05:26, Bohdan notifications@github.com wrote:

    Something is wrong with Travis

    — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/19675#issuecomment-670200235, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGS34TSAOMEFT7AY6UW7U3R7MNZLANCNFSM4PW7VTHQ .

  14. DrahtBot commented at 1:15 am on August 7, 2020: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #19463 (Prune locks by luke-jr)
    • #19339 (validation: re-delegate absurd fee checking from mempool to clients by gzhao408)
    • #19316 ([net] Cleanup logic around connection types by amitiuttarwar)
    • #19306 (refactor: Replace RecursiveMutex with Mutex in CTxMemPool by hebasto)
    • #19136 (wallet: add parent_desc to getaddressinfo by achow101)
    • #19093 (RPC: testmempoolaccept returns transaction fee by rajarshimaitra)
    • #18354 (Use shared pointers only in validation interface by bvbfan)
    • #17479 (Return BlockValidationState from ProcessNewBlock if CheckBlock/AcceptBlock fails by jnewbery)
    • #17211 (Allow fundrawtransaction and walletcreatefundedpsbt to take external inputs by achow101)
    • #16378 (The ultimate send RPC by Sjors)
    • #16333 (test: Set BIP34Height = 2 for regtest by MarcoFalke)
    • #15606 ([experimental] UTXO snapshots by jamesob)
    • #15367 (feature: Added ability for users to add a startup command by benthecarman)
    • #14582 (wallet: always do avoid partial spends if fees are within a specified range by kallewoof)

    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.

  15. laanwj commented at 10:39 am on August 7, 2020: member
    Thanks for your first contribution. However, as @practicalswift already says, we don’t do large-scale all-over-the-place automated refactors like this. In general, code-style changes should only be done when modifying code in the vicinity. This avoids conflict with every other PR. Also, this changes the code semantically, so it would be a lot of work to review. So NACK
  16. fanquake closed this on Aug 7, 2020

  17. DrahtBot locked this on Feb 15, 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: 2024-11-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me