HomePhabricator

refactor: Remove redundant checks in compat/assumptions.h

Description

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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18861

Details

Provenance
MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>Authored on Oct 4 2023, 09:06
PiRKCommitted on Tue, Nov 4, 09:40
PiRKPushed on Tue, Nov 4, 09:40
Reviewer
Restricted Project
Differential Revision
D18861: refactor: Remove redundant checks in compat/assumptions.h
Parents
rABCba5f2d10c953: kernel: De-globalize signature cache
Branches
Unknown
Tags
Unknown