refactor: remove windows-only compat.h usage in randomenv #26826

pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:windows_randomenv_compat_usage changing 1 files +7 −7
  1. fanquake commented at 7:46 PM on January 5, 2023: member

    Similar to #26814.

    Having a windows-only include of compat.h is confusing, not-only because it's already included globally via util/time.h, but also because it's unclear why compat.h is included (neither of the required headers are included there).

    This change is related to removing the use of compat.h as a miscellaneous catch-all for unclear/platform specific includes. Somewhat prompted by IWYU-related discussion here: https://github.com/bitcoin/bitcoin/pull/26763/files#r1058861693.

  2. random: remove windows-only compat.h include in randomenv
    Note that this was probably only here to indirectly receive windows.h
    via another include in compat.h (windows.h or winreg.h aren't included
    there).
    
    Also note that compat.h is already pulled in here for everyone via
    util/time.h, so including inside a windows only ifdef is secondarily
    redundant.
    fff80cd248
  3. randomenv: consolidate WIN32 #ifdefs
    Order includes.
    Remove // for xyz comments
    b358bde020
  4. DrahtBot commented at 7:46 PM on January 5, 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, TheCharlatan

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

  5. DrahtBot added the label Refactoring on Jan 5, 2023
  6. hebasto approved
  7. hebasto commented at 9:29 AM on January 6, 2023: member

    ACK b358bde020e2b9f6249fdbc500db6cb30f500f19.

    Similar to #26814.

    Unlike #26814, windows.h includes winreg.h unconditionally. Therefore, why not include the former only?

    Replacing C-headers with C++ ones should be mentioned in the PR description and / or commit message, no?

  8. fanquake commented at 9:36 AM on January 6, 2023: member

    Therefore, why not include the former only?

    That would be the exact opposite of what we've been doing with IWYU, and just hides the actual dependency.

    Replacing C-headers with C++ ones should be mentioned in the PR description and / or commit message, no?

    I didn't think it needed calling out given it's a 7 line diff, but can add it to the PR description.

  9. TheCharlatan approved
  10. TheCharlatan commented at 10:24 AM on January 23, 2023: contributor

    ACK b358bde020e2b9f6249fdbc500db6cb30f500f19

  11. maflcko merged this on Jan 23, 2023
  12. maflcko closed this on Jan 23, 2023

  13. fanquake deleted the branch on Jan 23, 2023
  14. sidhujag referenced this in commit 18c920073b on Jan 23, 2023
  15. bitcoin locked this on Jan 23, 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-04-22 06:13 UTC

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