aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-05-07 14:14:03 -0400
committerAva Chow <github@achow101.com>2024-05-07 14:14:03 -0400
commit8efd03ad04726aa34219ad83115a3d45030412c3 (patch)
treeae47c7c62b7963b5a2e4f022610591def0cb0d8e /src/util
parentef09f535b7b540d997f8c2bfa67b3386711bc8b4 (diff)
parentfa09451f8e6799682d7e7c863f25334fd1c7dce3 (diff)
downloadbitcoin-8efd03ad04726aa34219ad83115a3d45030412c3.tar.xz
Merge bitcoin/bitcoin#29494: build: Assume HAVE_CONFIG_H, Add IWYU pragma keep to bitcoin-config.h includes
fa09451f8e6799682d7e7c863f25334fd1c7dce3 Add lint check for bitcoin-config.h include IWYU pragma (MarcoFalke) dddd40ba8267dea11a3eb03d5cf8b51dbb99be5d scripted-diff: Add IWYU pragma keep to bitcoin-config.h includes (MarcoFalke) Pull request description: The `bitcoin-config.h` includes have issues: * The header is incompatible with iwyu, because symbols may be defined or not defined. So the `IWYU pragma: keep` is needed to keep the include when a symbol is not defined on a platform. Compare the previous discussion in https://github.com/bitcoin/bitcoin/pull/29408#issuecomment-1948959711 * Guarding the includes by `HAVE_CONFIG_H` is verbose and brittle. Now that all build config dependencies have been removed from low level headers, the benefits are questionable, and the guard can be removed. The linter could also be tricked by guarding the include by `#if defined(HAVE_C0NFIG_H)` (`O` replaced by `0`). Compare the previous discussion in https://github.com/bitcoin/bitcoin/pull/29404#discussion_r1483189853 . ACKs for top commit: achow101: ACK fa09451f8e6799682d7e7c863f25334fd1c7dce3 TheCharlatan: ACK fa09451f8e6799682d7e7c863f25334fd1c7dce3 hebasto: re-ACK fa09451f8e6799682d7e7c863f25334fd1c7dce3, only rebased since my recent [review](https://github.com/bitcoin/bitcoin/pull/29494#pullrequestreview-2028864535) (`timedata.cpp` removed in https://github.com/bitcoin/bitcoin/pull/29623). Tree-SHA512: 47cb973f7f24bc625acc4e78683371863675d186780236d55d886cf4130e05a78bb04f1d731aae7088313b8e963a9677cc77cf518187dbd99d776f6421ca9b52
Diffstat (limited to 'src/util')
-rw-r--r--src/util/check.cpp4
-rw-r--r--src/util/fs_helpers.cpp4
-rw-r--r--src/util/syserror.cpp4
-rw-r--r--src/util/threadnames.cpp4
-rw-r--r--src/util/tokenpipe.cpp4
-rw-r--r--src/util/trace.h4
6 files changed, 6 insertions, 18 deletions
diff --git a/src/util/check.cpp b/src/util/check.cpp
index c4d4b0cc28..eb3885832b 100644
--- a/src/util/check.cpp
+++ b/src/util/check.cpp
@@ -4,9 +4,7 @@
#include <util/check.h>
-#if defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
-#endif
+#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <clientversion.h>
#include <tinyformat.h>
diff --git a/src/util/fs_helpers.cpp b/src/util/fs_helpers.cpp
index bce5602462..8952f20f79 100644
--- a/src/util/fs_helpers.cpp
+++ b/src/util/fs_helpers.cpp
@@ -5,9 +5,7 @@
#include <util/fs_helpers.h>
-#if defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
-#endif
+#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <logging.h>
#include <sync.h>
diff --git a/src/util/syserror.cpp b/src/util/syserror.cpp
index bac498a23d..6f3a724483 100644
--- a/src/util/syserror.cpp
+++ b/src/util/syserror.cpp
@@ -2,9 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#if defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
-#endif
+#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <tinyformat.h>
#include <util/syserror.h>
diff --git a/src/util/threadnames.cpp b/src/util/threadnames.cpp
index 91883fe4ff..ea597dd05a 100644
--- a/src/util/threadnames.cpp
+++ b/src/util/threadnames.cpp
@@ -2,9 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#if defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
-#endif
+#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <string>
#include <thread>
diff --git a/src/util/tokenpipe.cpp b/src/util/tokenpipe.cpp
index 3c27d5e523..16fbb664ea 100644
--- a/src/util/tokenpipe.cpp
+++ b/src/util/tokenpipe.cpp
@@ -3,9 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <util/tokenpipe.h>
-#if defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
-#endif
+#include <config/bitcoin-config.h> // IWYU pragma: keep
#ifndef WIN32
diff --git a/src/util/trace.h b/src/util/trace.h
index b7c275f19b..d9ed65e3aa 100644
--- a/src/util/trace.h
+++ b/src/util/trace.h
@@ -5,9 +5,7 @@
#ifndef BITCOIN_UTIL_TRACE_H
#define BITCOIN_UTIL_TRACE_H
-#if defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
-#endif
+#include <config/bitcoin-config.h> // IWYU pragma: keep
#ifdef ENABLE_TRACING