Page MenuHomePhabricator

refactor: Remove redundant checks in compat/assumptions.h
ClosedPublic

Authored by PiRK on Mon, Nov 3, 15:57.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCb963e3656f40: refactor: Remove redundant checks in compat/assumptions.h
Summary

Generally, compile-time checks should be close to the code that use them. Especially, since compat/assumptions.h is only included in one place, where iwyu suggests to remove it.

Fix all issues:

  • The NDEBUG check is used in util/check, so it is redundant in compat/assumptions.h.
  • The __cplusplus check is redundant with doc/dependencies.md (see commit message).

Remove duplicate NDEBUG check from compat/assumptions.h

The check is already done in util/check.h, which is more widely
included.

Remove __cplusplus from compat/assumptions.h

It is unclear what the goal of this check is, given that the value may
need to be set lower for the mimimum supported version of compilers that
forgot to bump the value, see
https://github.com/bitcoin/bitcoin/pull/28349#issuecomment-1745143612 .

The minimum supported compiler versions are already documented in
doc/dependencies.md and using an older compiler will already result in a
compile failure, so this check can be removed as redundant. Especially
given that it is only included in one file, where iwyu suggests to
remove it.

Move compat/assumptions.h include to one place that actually needs it

refactor: Remove redundant checks in compat/assumptions.h

This is a backport of core#28579

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Mon, Nov 3, 15:57
PiRK edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Tue, Nov 4, 08:35