refactor: Add missing includes to fix gcc-13 compile error #26924

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2301-iwyu-gcc-13-📔 changing 2 files +5 −2
  1. maflcko commented at 6:31 PM on January 19, 2023: member

    On current master:

      CXX      support/libbitcoin_util_a-lockedpool.o
    support/lockedpool.cpp: In member function ‘void Arena::free(void*)’:
    support/lockedpool.cpp:99:20: error: ‘runtime_error’ is not a member of ‘std’
       99 |         throw std::runtime_error("Arena: invalid or double free");
          |                    ^~~~~~~~~~~~~
    support/lockedpool.cpp:22:1: note: ‘std::runtime_error’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?
       21 | #include <algorithm>
      +++ |+#include <stdexcept>
       22 | #ifdef ARENA_DEBUG
    support/lockedpool.cpp: In member function ‘void LockedPool::free(void*)’:
    support/lockedpool.cpp:320:16: error: ‘runtime_error’ is not a member of ‘std’
      320 |     throw std::runtime_error("LockedPool: invalid address not pointing to any arena");
          |                ^~~~~~~~~~~~~
    support/lockedpool.cpp:320:16: note: ‘std::runtime_error’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?
    
  2. Add missing includes to fix gcc-13 compile error fadeb6b103
  3. DrahtBot commented at 6:31 PM on January 19, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK hebasto, fanquake

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label Refactoring on Jan 19, 2023
  5. maflcko added the label Needs backport (23.x) on Jan 19, 2023
  6. maflcko added the label Needs backport (24.x) on Jan 19, 2023
  7. maflcko added this to the milestone 24.1 on Jan 19, 2023
  8. maflcko added the label Needs backport (22.x) on Jan 19, 2023
  9. hebasto approved
  10. hebasto commented at 8:23 PM on January 19, 2023: member

    ACK fadeb6b103cb441e0e91ef506ef29febabb10715.

    While touching headers, the unused #include <config/bitcoin-config.h> can be removed as well.

    And IWYU suggests to drop #include <limits.h>. But there could be some platform-specific pitfalls. FWIW, on my machine, the limits.h does not contain #define PAGESIZE.

  11. fanquake approved
  12. fanquake commented at 10:23 AM on January 20, 2023: member

    ACK fadeb6b103cb441e0e91ef506ef29febabb10715 - tested this fixes compilation with GCC 13. I don't think theres a need to do anything else here, and that'd also just potentially complicate backporting.

  13. fanquake merged this on Jan 20, 2023
  14. fanquake closed this on Jan 20, 2023

  15. fanquake referenced this in commit cb181da170 on Jan 20, 2023
  16. fanquake removed the label Needs backport (24.x) on Jan 20, 2023
  17. fanquake cross-referenced this on Jan 20, 2023 from issue [24.x] Backports by fanquake
  18. fanquake commented at 10:28 AM on January 20, 2023: member

    Added to #26878 for backporting to 24.x.

  19. fanquake referenced this in commit 398768769f on Jan 20, 2023
  20. fanquake cross-referenced this on Jan 20, 2023 from issue [23.x] Backports by fanquake
  21. fanquake removed the label Needs backport (23.x) on Jan 20, 2023
  22. fanquake commented at 10:30 AM on January 20, 2023: member

    Added to #26921 for 23.x.

  23. fanquake referenced this in commit c21e6a9ce2 on Jan 20, 2023
  24. fanquake cross-referenced this on Jan 20, 2023 from issue [22.x] Backports by fanquake
  25. fanquake removed the label Needs backport (22.x) on Jan 20, 2023
  26. fanquake commented at 10:33 AM on January 20, 2023: member

    Opened #26927 for 22.x.

  27. sidhujag referenced this in commit da9a3799fe on Jan 20, 2023
  28. maflcko commented at 11:14 AM on January 25, 2023: member

    While touching headers, the unused #include <config/bitcoin-config.h> can be removed as well.

    sgtm.

    However, I wonder if we should require for preprocessor stuff that is used in #ifdef or #if to be mentioned in after the include. Otherwise, removing an include can result in a passing but broken build.

    For example:

    #include <config/bitcoin-config.h> // for FEATURE_FOO
    
  29. maflcko deleted the branch on Jan 25, 2023
  30. maflcko cross-referenced this on Jan 26, 2023 from issue doc: List identifiers used from header in #if(def) by maflcko
  31. fanquake referenced this in commit a896f61290 on Feb 16, 2023
  32. fanquake referenced this in commit 0567787f5e on Feb 16, 2023
  33. fanquake referenced this in commit 7cf73dfed5 on Feb 22, 2023
  34. glozow referenced this in commit c8c85ca16e on Feb 27, 2023
  35. Fabcien referenced this in commit b2d05c54b6 on May 4, 2023
  36. vertiond cross-referenced this on May 25, 2023 from issue Add missing includes to fix gcc-13 compile error by vertiond
  37. ComputerCraftr referenced this in commit 3353f19d3b on Oct 29, 2023
  38. ComputerCraftr referenced this in commit 9ec3f7eb16 on Oct 29, 2023
  39. grubles cross-referenced this on Nov 15, 2023 from issue Build error in master by grubles
  40. bitcoin locked this on Jan 25, 2024

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:53 UTC