refactor: include the proper header rather than forward-declaring RemovalReasonToString #31058

pull theuni wants to merge 1 commits into bitcoin:master from theuni:fix-pch-forward-declare changing 1 files +1 −2
  1. theuni commented at 3:30 pm on October 8, 2024: member

    Trivial no-op fixup.

    This was pointed out by #31053, which causes the include order to be shuffled around:

    0[21:49:26.130] /ci_container_base/src/validationinterface.cpp:22:13: error: redundant 'RemovalReasonToString' declaration [readability-redundant-declaration,-warnings-as-errors]
    1[21:49:26.130]    22 | std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept;
    2[21:49:26.130]       | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3[21:49:26.130] /ci_container_base/src/kernel/mempool_removal_reason.h:22:13: note: previously declared here
    4[21:49:26.130]    22 | std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept;
    5[21:49:26.130]       |             ^
    

    I don’t see any reason why the include shouldn’t just be used.

  2. refactor: include the proper header rather than forward-declaring RemovalReasonToString
    This was not in its own header when it was added, but now that it is the
    forward-declare makes no sense.
    ca2e4ba352
  3. DrahtBot commented at 3:30 pm on October 8, 2024: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, hebasto, TheCharlatan

    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 Oct 8, 2024
  5. maflcko commented at 3:37 pm on October 8, 2024: member

    lgtm ACK ca2e4ba352cb0a3b5983c002b09ce15ebbf95177

    This should be fine, because the circular dependency no longer exists since commit fad8c36aa9011c3f7b1183f8380577e16a2167a6

  6. hebasto approved
  7. hebasto commented at 5:39 pm on October 8, 2024: member

    ACK ca2e4ba352cb0a3b5983c002b09ce15ebbf95177, IWYU seems agree:

     0[16:19:43.440] The full include-list for /ci_container_base/src/validationinterface.cpp:
     1[16:19:43.440] #include <validationinterface.h>
     2[16:19:43.440] #include <chain.h>                          // for CBlockIndex
     3[16:19:43.440] #include <consensus/validation.h>           // for BlockValidationState
     4[16:19:43.440] #include <kernel/mempool_entry.h>           // for RemovedMempoolTransactionInfo, NewMempoolTransactionInfo, TransactionInfo
     5[16:19:43.440] #include <kernel/mempool_removal_reason.h>  // for RemovalReasonToString
     6[16:19:43.440] #include <logging.h>                        // for LogFlags, LogPrintFormatInternal, LogDebug
     7[16:19:43.440] #include <primitives/block.h>               // for CBlock, CBlockLocator
     8[16:19:43.440] #include <primitives/transaction.h>         // for CTransaction, CTransactionRef
     9[16:19:43.440] #include <util/check.h>                     // for inline_assertion_check, Assert
    10[16:19:43.440] #include <util/task_runner.h>               // for TaskRunnerInterface
    11[16:19:43.440] #include <future>                           // for promise, future
    12[16:19:43.440] #include <iterator>                         // for next
    13[16:19:43.440] #include <list>                             // for list, _List_iterator, operator==
    14[16:19:43.440] #include <unordered_map>                    // for unordered_map, _Node_iterator, operator==, _Node_iterator_base
    15[16:19:43.440] #include <utility>                          // for move, pair
    16[16:19:43.440] #include "kernel/cs_main.h"                 // for cs_main
    17[16:19:43.440] #include "sync.h"                           // for AnnotatedMixin, EXCLUSIVE_LOCKS_REQUIRED, UniqueLock, LOCK, GUARDED_BY, AssertLockNotHeld, Mutex, REVERSE...
    18[16:19:43.440] #include "uint256.h"                        // for uint256
    19[16:19:43.440] enum class ChainstateRole;
    20[16:19:43.440] ---
    
  8. TheCharlatan approved
  9. TheCharlatan commented at 8:10 pm on October 8, 2024: contributor
    ACK ca2e4ba352cb0a3b5983c002b09ce15ebbf95177
  10. bitcoin deleted a comment on Oct 9, 2024
  11. fanquake merged this on Oct 9, 2024
  12. fanquake closed this on Oct 9, 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-21 15:12 UTC

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