mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
ci, iwyu: Enforce warning-free src/common
Fix all IWYU warnings in `src/common` and treat them as errors in CI. Additionally, ensure that our drop-in header replacements are used instead of system headers: - `<util/check.h>` instead of `<cassert>` - `<util/time.h>` instead of `<chrono>`
This commit is contained in:
@@ -234,7 +234,7 @@ fi
|
||||
|
||||
if [[ "${RUN_IWYU}" == true ]]; then
|
||||
# TODO: Consider enforcing IWYU across the entire codebase.
|
||||
FILES_WITH_ENFORCED_IWYU="/src/(((bench|crypto|index|kernel|primitives|script|univalue/(lib|test)|util|zmq)/.*|common/license_info|node/(blockstorage|interfaces|miner|mining_args|utxo_snapshot)|rpc/mining|clientversion|core_io|signet|init)\\.cpp)"
|
||||
FILES_WITH_ENFORCED_IWYU='/src/((bench|common|crypto|index|kernel|primitives|script|univalue/(lib|test)|util|zmq)/.*|node/(blockstorage|interfaces|miner|mining_args|utxo_snapshot)|rpc/mining|clientversion|core_io|signet|init)\.cpp'
|
||||
jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns)))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_errors.json"
|
||||
jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns) | not))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_warnings.json"
|
||||
|
||||
@@ -247,7 +247,8 @@ if [[ "${RUN_IWYU}" == true ]]; then
|
||||
-p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \
|
||||
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
|
||||
-Xiwyu --max_line_length=160 \
|
||||
-Xiwyu --check_also="*/primitives/*.h" \
|
||||
-Xiwyu --check_also='*/common/types\.h' \
|
||||
-Xiwyu --check_also='*/primitives/transaction_identifier\.h' \
|
||||
2>&1 || true
|
||||
} | tee /tmp/iwyu_ci.out
|
||||
python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out
|
||||
|
||||
Reference in New Issue
Block a user