tidy: add modernize-use-default-member-init #25108

pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:modernize_use_default_Member_init changing 40 files +59 −88
  1. fanquake commented at 3:47 PM on May 11, 2022: member

    Refactor and then enable modernize-use-default-member-init in our clang-tidy job.

  2. fanquake added the label Refactoring on May 11, 2022
  3. in src/bench/prevector.cpp:14 in de22cd9835 outdated
       9 | @@ -10,8 +10,8 @@
      10 |  #include <bench/bench.h>
      11 |  
      12 |  struct nontrivial_t {
      13 | -    int x;
      14 | -    nontrivial_t() :x(-1) {}
      15 | +    int x{-1};
      16 | +    nontrivial_t() {}
    


    PastaPastaPasta commented at 6:08 PM on May 11, 2022:
        nontrivial_t() = default;
    
  4. in src/bitcoin-cli.cpp:177 in de22cd9835 outdated
     173 | @@ -174,10 +174,10 @@ static int AppInitRPC(int argc, char* argv[])
     174 |  /** Reply structure for request_done to fill in */
     175 |  struct HTTPReply
     176 |  {
     177 | -    HTTPReply(): status(0), error(-1) {}
     178 | +    HTTPReply() {}
    


    PastaPastaPasta commented at 6:09 PM on May 11, 2022:
        HTTPReply() = default;
    
  5. in src/rpc/blockchain.cpp:1974 in de22cd9835 outdated
    1968 | @@ -1969,9 +1969,9 @@ static std::atomic<bool> g_should_abort_scan;
    1969 |  class CoinsViewScanReserver
    1970 |  {
    1971 |  private:
    1972 | -    bool m_could_reserve;
    1973 | +    bool m_could_reserve{false};
    1974 |  public:
    1975 | -    explicit CoinsViewScanReserver() : m_could_reserve(false) {}
    1976 | +    explicit CoinsViewScanReserver() {}
    


    PastaPastaPasta commented at 6:09 PM on May 11, 2022:
        explicit CoinsViewScanReserver() = default;
    
  6. PastaPastaPasta commented at 6:09 PM on May 11, 2022: contributor

    while you are here, I think it'd make sense to use = default

    Otherwise, concept ACK

  7. DrahtBot commented at 7:30 AM on May 12, 2022: member

    <!--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:

    • #25110 (tidy: use modernize-use-raw-string-literal by fanquake)
    • #24914 (wallet: Load database records in a particular order by achow101)
    • #24676 ([WIP] [kernelheaders 1/n] Cleave LevelDB headers from our header tree by dongcarl)
    • #24149 (Signing support for Miniscript Descriptors by darosior)
    • #22793 (Simplify BaseSignatureChecker virtual functions and GenericTransactionSignatureChecker constructors by achow101)

    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.

  8. fanquake force-pushed on May 12, 2022
  9. fanquake force-pushed on May 13, 2022
  10. fanquake commented at 11:32 AM on May 13, 2022: member

    while you are here, I think it'd make sense to use = default

    Have done that now.

  11. PastaPastaPasta approved
  12. PastaPastaPasta commented at 3:12 PM on May 13, 2022: contributor

    utACK, I have reviewed the diff, and all changes make sense. I would recommend changing the title to refactor: clang-tidy enable/use modernize-use-default-member-init and modernize-use-equals-default

  13. fanquake force-pushed on May 13, 2022
  14. refactor: use C++11 default initializers 7aa40f5563
  15. tidy: use modernize-use-default-member-init ac6fbf2c83
  16. fanquake force-pushed on May 17, 2022
  17. MarcoFalke commented at 5:19 PM on May 18, 2022: member

    ACK modernize-use-default-member-init

    not sure if modernize-use-equals-default provides any value for us, but I guess it doesn't hurt either.

  18. MarcoFalke merged this on May 18, 2022
  19. MarcoFalke closed this on May 18, 2022

  20. fanquake deleted the branch on May 19, 2022
  21. sidhujag referenced this in commit e8b1066341 on May 28, 2022
  22. PastaPastaPasta referenced this in commit dda7a65648 on Oct 18, 2022
  23. 8498549767 commented at 10:47 AM on January 24, 2023: none

    Exelente

  24. fanquake locked this on Jan 24, 2023

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-04-22 06:14 UTC

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