diff --git a/build_msvc/libsecp256k1_config.h b/build_msvc/libsecp256k1_config.h index 5978b9a0d96f0..57f2f144ff6ee 100644 --- a/build_msvc/libsecp256k1_config.h +++ b/build_msvc/libsecp256k1_config.h @@ -29,4 +29,4 @@ #define ECMULT_GEN_PREC_BITS 4 #define ECMULT_WINDOW_SIZE 15 -#endif /* BITCOIN_LIBSECP256K1_CONFIG_H */ +#endif // BITCOIN_LIBSECP256K1_CONFIG_H diff --git a/src/banman.h b/src/banman.h index f495dab49dbcb..6cb63047442cf 100644 --- a/src/banman.h +++ b/src/banman.h @@ -95,4 +95,4 @@ class BanMan CRollingBloomFilter m_discouraged GUARDED_BY(m_cs_banned) {50000, 0.000001}; }; -#endif +#endif // BITCOIN_BANMAN_H diff --git a/src/consensus/amount.h b/src/consensus/amount.h index 96566ea13fc93..59b8e3417a877 100644 --- a/src/consensus/amount.h +++ b/src/consensus/amount.h @@ -26,4 +26,4 @@ static constexpr CAmount COIN = 100000000; static constexpr CAmount MAX_MONEY = 21000000 * COIN; inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } -#endif // BITCOIN_CONSENSUS_AMOUNT_H +#endif // BITCOIN_CONSENSUS_AMOUNT_H diff --git a/src/httprpc.h b/src/httprpc.h index 5a3b99064669a..6daf7d28f598f 100644 --- a/src/httprpc.h +++ b/src/httprpc.h @@ -31,4 +31,4 @@ void InterruptREST(); */ void StopREST(); -#endif +#endif // BITCOIN_HTTPRPC_H diff --git a/src/i2p.h b/src/i2p.h index cb2efedba8b24..86643de637edc 100644 --- a/src/i2p.h +++ b/src/i2p.h @@ -267,4 +267,4 @@ class Session } // namespace sam } // namespace i2p -#endif /* BITCOIN_I2P_H */ +#endif // BITCOIN_I2P_H diff --git a/src/policy/feerate.h b/src/policy/feerate.h index 8ba896bb01fed..13c7ec200243c 100644 --- a/src/policy/feerate.h +++ b/src/policy/feerate.h @@ -67,4 +67,4 @@ class CFeeRate SERIALIZE_METHODS(CFeeRate, obj) { READWRITE(obj.nSatoshisPerK); } }; -#endif // BITCOIN_POLICY_FEERATE_H +#endif // BITCOIN_POLICY_FEERATE_H diff --git a/src/randomenv.h b/src/randomenv.h index 46cea6f6f281b..746516b79be01 100644 --- a/src/randomenv.h +++ b/src/randomenv.h @@ -14,4 +14,4 @@ void RandAddDynamicEnv(CSHA512& hasher); /** Gather non-cryptographic environment data that does not change over time. */ void RandAddStaticEnv(CSHA512& hasher); -#endif +#endif // BITCOIN_RANDOMENV_H diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h index d9c6761f47041..65f6b1429eb18 100644 --- a/src/rpc/blockchain.h +++ b/src/rpc/blockchain.h @@ -67,4 +67,4 @@ CBlockPolicyEstimator& EnsureAnyFeeEstimator(const std::any& context); */ UniValue CreateUTXOSnapshot(NodeContext& node, CChainState& chainstate, CAutoFile& afile); -#endif +#endif // BITCOIN_RPC_BLOCKCHAIN_H diff --git a/src/scheduler.h b/src/scheduler.h index 9eec8c0fa0595..be878661db07b 100644 --- a/src/scheduler.h +++ b/src/scheduler.h @@ -146,4 +146,4 @@ class SingleThreadedSchedulerClient size_t CallbacksPending(); }; -#endif +#endif // BITCOIN_SCHEDULER_H diff --git a/src/shutdown.h b/src/shutdown.h index ff56c6bd87230..9df601d478228 100644 --- a/src/shutdown.h +++ b/src/shutdown.h @@ -32,4 +32,4 @@ bool ShutdownRequested(); */ void WaitForShutdown(); -#endif +#endif // BITCOIN_SHUTDOWN_H diff --git a/src/span.h b/src/span.h index 830164514b9bb..168162e3095eb 100644 --- a/src/span.h +++ b/src/span.h @@ -248,4 +248,4 @@ template constexpr auto UCharSpanCast(Span s) -> Span constexpr auto MakeUCharSpan(V&& v) -> decltype(UCharSpanCast(MakeSpan(std::forward(v)))) { return UCharSpanCast(MakeSpan(std::forward(v))); } -#endif +#endif // BITCOIN_SPAN_H diff --git a/src/test/scriptnum10.h b/src/test/scriptnum10.h index 352797f18dad4..3937366f01e72 100644 --- a/src/test/scriptnum10.h +++ b/src/test/scriptnum10.h @@ -179,4 +179,4 @@ class CScriptNum10 }; -#endif // BITCOIN_TEST_BIGNUM_H +#endif // BITCOIN_TEST_SCRIPTNUM10_H diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h index 7518cdb042c4f..eb7bc071e5b66 100644 --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -227,4 +227,4 @@ class HasReason const std::string m_reason; }; -#endif +#endif // BITCOIN_TEST_UTIL_SETUP_COMMON_H diff --git a/src/threadinterrupt.h b/src/threadinterrupt.h index 2665f8a5bee85..42470c70ee181 100644 --- a/src/threadinterrupt.h +++ b/src/threadinterrupt.h @@ -33,4 +33,4 @@ class CThreadInterrupt std::atomic flag; }; -#endif //BITCOIN_THREADINTERRUPT_H +#endif // BITCOIN_THREADINTERRUPT_H diff --git a/src/torcontrol.h b/src/torcontrol.h index 7258f27cb69ce..8fc852f84332c 100644 --- a/src/torcontrol.h +++ b/src/torcontrol.h @@ -157,4 +157,4 @@ class TorController static void reconnect_cb(evutil_socket_t fd, short what, void *arg); }; -#endif /* BITCOIN_TORCONTROL_H */ +#endif // BITCOIN_TORCONTROL_H diff --git a/src/util/readwritefile.h b/src/util/readwritefile.h index 1dab874b38ce3..a59d0be1315f8 100644 --- a/src/util/readwritefile.h +++ b/src/util/readwritefile.h @@ -25,4 +25,4 @@ std::pair ReadBinaryFile(const fs::path &filename, size_t maxs */ bool WriteBinaryFile(const fs::path &filename, const std::string &data); -#endif /* BITCOIN_UTIL_READWRITEFILE_H */ +#endif // BITCOIN_UTIL_READWRITEFILE_H diff --git a/src/util/string.h b/src/util/string.h index 5617e4acc1bb4..07c87cfcdaf3e 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -103,4 +103,4 @@ template std::equal(std::begin(prefix), std::end(prefix), std::begin(obj)); } -#endif // BITCOIN_UTIL_STRENCODINGS_H +#endif // BITCOIN_UTIL_STRING_H diff --git a/src/util/trace.h b/src/util/trace.h index 9c92cb10e7d7f..bb901e05daf2f 100644 --- a/src/util/trace.h +++ b/src/util/trace.h @@ -42,4 +42,4 @@ #endif -#endif /* BITCOIN_UTIL_TRACE_H */ +#endif // BITCOIN_UTIL_TRACE_H diff --git a/src/wallet/rpcwallet.h b/src/wallet/rpcwallet.h index 3a85fc0c64a67..40eb49cf87cf0 100644 --- a/src/wallet/rpcwallet.h +++ b/src/wallet/rpcwallet.h @@ -38,4 +38,4 @@ const LegacyScriptPubKeyMan& EnsureConstLegacyScriptPubKeyMan(const CWallet& wal RPCHelpMan getaddressinfo(); RPCHelpMan signrawtransactionwithwallet(); -#endif //BITCOIN_WALLET_RPCWALLET_H +#endif // BITCOIN_WALLET_RPCWALLET_H diff --git a/src/warnings.h b/src/warnings.h index c38edb4570053..7ab0a93e3f7ee 100644 --- a/src/warnings.h +++ b/src/warnings.h @@ -20,4 +20,4 @@ void SetfLargeWorkInvalidChainFound(bool flag); */ bilingual_str GetWarnings(bool verbose); -#endif // BITCOIN_WARNINGS_H +#endif // BITCOIN_WARNINGS_H diff --git a/src/zmq/zmqrpc.h b/src/zmq/zmqrpc.h index 5a810a16fb23a..8538adf9d3d6f 100644 --- a/src/zmq/zmqrpc.h +++ b/src/zmq/zmqrpc.h @@ -9,4 +9,4 @@ class CRPCTable; void RegisterZMQRPCCommands(CRPCTable& t); -#endif // BITCOIN_ZMQ_ZMRRPC_H +#endif // BITCOIN_ZMQ_ZMQRPC_H diff --git a/test/lint/lint-include-guards.sh b/test/lint/lint-include-guards.sh index ac2177bbe3b2a..23f53f027eb44 100755 --- a/test/lint/lint-include-guards.sh +++ b/test/lint/lint-include-guards.sh @@ -17,7 +17,7 @@ for HEADER_FILE in $(git ls-files -- "*.h" | grep -vE "^${REGEXP_EXCLUDE_FILES_W do HEADER_ID_BASE=$(cut -f2- -d/ <<< "${HEADER_FILE}" | sed "s/\.h$//g" | tr / _ | tr - _ | tr "[:lower:]" "[:upper:]") HEADER_ID="${HEADER_ID_PREFIX}${HEADER_ID_BASE}${HEADER_ID_SUFFIX}" - if [[ $(grep -cE "^#(ifndef|define) ${HEADER_ID}" "${HEADER_FILE}") != 2 ]]; then + if [[ $(grep --count --extended-regexp "^#(ifndef|define|endif //) ${HEADER_ID}" "${HEADER_FILE}") != 3 ]]; then echo "${HEADER_FILE} seems to be missing the expected include guard:" echo " #ifndef ${HEADER_ID}" echo " #define ${HEADER_ID}"