wallet: Rename RecordType::DELETE to RecordType::DELETE_FLAG #34454

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:260129-wallet-migrate changing 1 files +5 −5
  1. hebasto commented at 10:50 pm on January 29, 2026: member

    On Windows, the winnt.h header defines DELETE as a macro for a “Standard Access Right” bitmask (0x00010000L).

    This introduces a fragile dependency on header inclusion order: if Windows headers happen to be included before the RecordType enum definition, the preprocessor expands DELETE into a numeric literal, causing syntax errors.

    Rename the enumerator to DELETE_FLAG to remove this fragility and avoid the collision entirely.

    Split from #34448.

  2. hebasto added the label Refactoring on Jan 29, 2026
  3. hebasto added the label Wallet on Jan 29, 2026
  4. hebasto commented at 10:50 pm on January 29, 2026: member
  5. DrahtBot commented at 10:50 pm on January 29, 2026: 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 maflcko, achow101

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  6. maflcko commented at 9:43 am on January 30, 2026: member

    Seems fine, but I think it is annoying that we keep running into the same bug over and over again (IIRC it happened in the past at least once for Bitcoin Core). Surely this is going to happen again in the future.

    I think it may be good to enforce https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#renum-caps (Enum.5: Don’t use ALL_CAPS for enumerators)

    I have not tried this at all, but i think with something like this, we can use clang-tidy to reject ALL_CAPS:

    0  - key:             readability-identifier-naming.EnumConstantIgnoredRegexp
    1    value:           '.*[a-z].*'  # ignore if there is any lower case letter
    2  - key:             readability-identifier-naming.EnumConstantCase
    3    value:           CamelCase  # otherwise, suggest this
    4
    5  - key:             readability-identifier-naming.ScopedEnumConstantIgnoredRegexp
    6    value:           '.*[a-z].*'  # ignore if there is any lower case letter
    7  - key:             readability-identifier-naming.ScopedEnumConstantCase
    8    value:           CamelCase  # otherwise, suggest this
    9...
    
  7. hebasto commented at 1:45 pm on January 30, 2026: member

    Seems fine, but I think it is annoying that we keep running into the same bug over and over again (IIRC it happened in the past at least once for Bitcoin Core). Surely this is going to happen again in the future.

    I think it may be good to enforce https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#renum-caps (Enum.5: Don’t use ALL_CAPS for enumerators)

    I have not tried this at all, but i think with something like this, we can use clang-tidy to reject ALL_CAPS:

    0  - key:             readability-identifier-naming.EnumConstantIgnoredRegexp
    1    value:           '.*[a-z].*'  # ignore if there is any lower case letter
    2  - key:             readability-identifier-naming.EnumConstantCase
    3    value:           CamelCase  # otherwise, suggest this
    4
    5  - key:             readability-identifier-naming.ScopedEnumConstantIgnoredRegexp
    6    value:           '.*[a-z].*'  # ignore if there is any lower case letter
    7  - key:             readability-identifier-naming.ScopedEnumConstantCase
    8    value:           CamelCase  # otherwise, suggest this
    9...
    

    I considered this while working on the PR, but enforcing that rule globally would be extremely invasive. For example, it would require renaming in enum opcodetype.

  8. maflcko commented at 2:10 pm on January 30, 2026: member

    lgtm ACK e10d135a9a64e1b35faea70f84abdd3ef5dd0bd1

    Further improvements can be considered later.

  9. wallet: Rename `RecordType::DELETE` to `RecordType::DELETE_FLAG`
    On Windows, the `winnt.h` header defines `DELETE` as a macro for a
    "Standard Access Right" bitmask (0x00010000L).
    
    This introduces a fragile dependency on header inclusion order: if
    Windows headers happen to be included before this enum definition,
    the preprocessor expands `DELETE` into a numeric literal, causing
    syntax errors.
    
    Rename the enumerator to `DELETE_FLAG` to remove this fragility and
    avoid the collision entirely.
    516be10bb5
  10. in src/wallet/migrate.cpp:211 in e10d135a9a
    207@@ -208,8 +208,8 @@ class RecordHeader
    208 {
    209 public:
    210     uint16_t len;    // Key/data item length
    211-    RecordType type; // Page type (BDB has this include a DELETE FLAG that we track separately)
    212-    bool deleted;    // Whether the DELETE flag was set on type
    213+    RecordType type; // Page type (BDB has this include a DELETE_FLAG that we track separately)
    


    maflcko commented at 2:14 pm on January 30, 2026:
    0    RecordType type; // Page type (BDB has this; includes a DELETE_FLAG that we track separately)
    

    llm typo nit


    hebasto commented at 2:22 pm on January 30, 2026:
    Thanks! Amended.
  11. hebasto force-pushed on Jan 30, 2026
  12. maflcko commented at 2:23 pm on January 30, 2026: member
    re-lgtm ACK 516be10bb56db80aa95b3afbf9773ecd7f167284
  13. achow101 commented at 9:03 pm on January 30, 2026: member
    ACK 516be10bb56db80aa95b3afbf9773ecd7f167284
  14. achow101 merged this on Jan 30, 2026
  15. achow101 closed this on Jan 30, 2026

  16. hebasto deleted the branch on Jan 30, 2026

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-02-07 12:13 UTC

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