mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 16:23:37 +00:00
build: Always define HAVE_SYSTEM #36023
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36023
Loading…
Reference in a new issue
No description provided.
Delete branch "2026/08/have-system"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When this feature is unavailable,
#cmakedefineleaves its macro undefined, triggering-Wundef. I noticed this while building the kernel for iOs.Use
#cmakedefine01to always generate 0 or 1.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.
Please don't make random changes for no reason.
Maybe simply revert
976b034b13?Ref: https://github.com/bitcoin/bitcoin/issues/16419
Can we not use a single style and enforce it with a linter, similar to the
lint_includes_build_configone?@fanquake I dropped
HAVE_FDATASYNC. It was deliberately made this way in #19803 for some reason.@hebasto using
#if defined(HAVE_SYSTEM)looks ugly imo, but it also risks someone using#if HAVE_SYSTEMaccidentally.Base:
a829aeaac1aff6cb786aab7d2514b49eb233334bHead:
013fffe371f566387d4d386c21e6d3f9cfd92cf1No verified findings are available from this partial review.
Review coverage was incomplete. The archaeology review had incomplete evidence. The adversarial_glm review did not complete.
Full review report
The change seems fine to me, but it would be nice to be consistent across these definitions.
Is this concern aesthetic or technical?
However, I agree that using
#if defined(...)poses a problem. We can't spot a typo in the macro name, for example#if defined(HAVE_SUSTEM). Also see https://github.com/bitcoin/bitcoin/issues/36874.In this case, it does not change behavior when
bitcoin-build-config.hcontains#define HAVE_SYSTEM 1. And it will trigger-Wundefwhen the macro is undefined.The problem of detecting misused directives in the source code remains for
#cmakedefine01as well. Perhaps this is a task for the linter.The current usage is not uniform either. For example, here are the different patterns for configuration macro definitions:
#define HAVE_FOOor undefined -- is not used.#define HAVE_FOO 1or undefined:#define HAVE_FOO 1or#define HAVE_FOO 0:This approach gives us free protection against a misspelled macro name, which will trigger the
-Wundefcompiler warning.Here are some useful external resources:
Bottom line: I agree with this PR change. I'd really like to see here a new linter check that prevents accidental misuse of
#ifdef,#ifndefordefined()for configuration macros set via#cmakedefine01.