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:

     0  CXX      support/libbitcoin_util_a-lockedpool.o
     1support/lockedpool.cpp: In member function ‘void Arena::free(void*)’:
     2support/lockedpool.cpp:99:20: error: ‘runtime_error’ is not a member of ‘std’
     3   99 |         throw std::runtime_error("Arena: invalid or double free");
     4      |                    ^~~~~~~~~~~~~
     5support/lockedpool.cpp:22:1: note: ‘std::runtime_error’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?
     6   21 | #include <algorithm>
     7  +++ |+#include <stdexcept>
     8   22 | #ifdef ARENA_DEBUG
     9support/lockedpool.cpp: In member function ‘void LockedPool::free(void*)’:
    10support/lockedpool.cpp:320:16: error: ‘runtime_error’ is not a member of ‘std’
    11  320 |     throw std::runtime_error("LockedPool: invalid address not pointing to any arena");
    12      |                ^~~~~~~~~~~~~
    13support/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

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

    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 commented at 10:28 am on January 20, 2023: member
    Added to #26878 for backporting to 24.x.
  18. fanquake referenced this in commit 398768769f on Jan 20, 2023
  19. fanquake removed the label Needs backport (23.x) on Jan 20, 2023
  20. fanquake commented at 10:30 am on January 20, 2023: member
    Added to #26921 for 23.x.
  21. fanquake referenced this in commit c21e6a9ce2 on Jan 20, 2023
  22. fanquake removed the label Needs backport (22.x) on Jan 20, 2023
  23. fanquake commented at 10:33 am on January 20, 2023: member
    Opened #26927 for 22.x.
  24. sidhujag referenced this in commit da9a3799fe on Jan 20, 2023
  25. 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:

    0#include <config/bitcoin-config.h> // for FEATURE_FOO
    
  26. maflcko deleted the branch on Jan 25, 2023
  27. fanquake referenced this in commit a896f61290 on Feb 16, 2023
  28. fanquake referenced this in commit 0567787f5e on Feb 16, 2023
  29. fanquake referenced this in commit 7cf73dfed5 on Feb 22, 2023
  30. glozow referenced this in commit c8c85ca16e on Feb 27, 2023
  31. Fabcien referenced this in commit b2d05c54b6 on May 4, 2023
  32. ComputerCraftr referenced this in commit 3353f19d3b on Oct 29, 2023
  33. ComputerCraftr referenced this in commit 9ec3f7eb16 on Oct 29, 2023
  34. 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: 2024-11-23 09:12 UTC

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