Merge bitcoin/bitcoin#36181: ci: Upgrade IWYU to 0.27 compatible with Clang 23
What changed, and why it matters
This is a routine developer tooling update. It upgrades the Include What You Use (IWYU) static-analysis tool used in Bitcoin Core's continuous integration from version 0.22 (for Clang 22) to version 0.27 (for Clang 23), removes now-unnecessary local patches and workarounds, and adjusts many source-file #include directives to match the newer tool's recommendations. There is no change to the Bitcoin protocol, consensus logic, wallet behavior, or runtime security. It only affects how headers are checked during automated CI builds.
No security action required. Treat as a normal CI/maintenance change. Reviewers may optionally verify that the removed local patches are indeed covered by the upstream IWYU 0.27 release and that CI still passes.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The merge commit updates the CI IWYU job to Clang/IWYU 23, drops two local patch files (01_iwyu.patch and 02_iwyu_hash.patch) whose fixes are now upstream, switches the compiler-intrinsics mapping from a hardcoded bitcoin.core.imp entry to a dynamically generated clang.intrinsics.imp, and applies a broad set of IWYU-driven header cleanups across bench, consensus, crypto, index, node, rpc, script, signet, and util source files. Changes are limited to #include additions/removals/replacements and a few pragma removals; no functional code is modified.
Changed components
ci/test/00_setup_env_native_iwyu.shci/test/01_base_install.shci/test/01_iwyu.patchci/test/02_iwyu_hash.patchci/test/03_test_script.shcontrib/devtools/iwyu/bitcoin.core.impsrc/bench/*src/common/config.cppsrc/consensus/*src/crypto/*src/index/blockfilterindex.cppsrc/node/blockstorage.hsrc/rpc/mining.cppsrc/script/*src/signet.cppsrc/util/*Inspect captured patch +29 / −725
### ci/test/00_setup_env_native_iwyu.sh
@@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" # To build codegen, CMake must be 3.31 or newer.
export CONTAINER_NAME=ci_native_iwyu
-export IWYU_LLVM_V="22"
+export IWYU_LLVM_V="23"
export APT_LLVM_V="${IWYU_LLVM_V}"
export PACKAGES="clang-${IWYU_LLVM_V} clang-format-${IWYU_LLVM_V} libclang-${IWYU_LLVM_V}-dev llvm-${IWYU_LLVM_V}-dev jq libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto"
export NO_DEPENDS=1
### ci/test/01_base_install.sh
@@ -105,7 +105,6 @@ if [[ "${RUN_IWYU}" == true ]]; then
${CI_RETRY_EXE} git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_"${IWYU_LLVM_V}" /include-what-you-use
pushd /include-what-you-use
patch -p1 < "${BASE_ROOT_DIR}/ci/test/01_iwyu.patch"
- patch -p1 < "${BASE_ROOT_DIR}/ci/test/02_iwyu_hash.patch"
popd
cmake -B /iwyu-build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-"${IWYU_LLVM_V}" -S /include-what-you-use
make -C /iwyu-build/ install "$MAKEJOBS"
### ci/test/01_iwyu.patch
@@ -12,623 +12,3 @@ See: https://en.cppreference.com/w/cpp/preprocessor/include.html.
return "<" + include_name + ">";
}
return "\"" + include_name + "\"";
-
-
-Prefer C++ headers over C counterparts.
-See: https://github.com/include-what-you-use/include-what-you-use/blob/clang_22/iwyu_include_picker.cc#L645-L687.
-
---- a/iwyu_include_picker.cc
-+++ b/iwyu_include_picker.cc
-@@ -104,20 +104,20 @@ const IncludeMapEntry libc_symbol_map[] = {
- // equal. The visibility on the symbol-name is ignored; by convention
- // we always set it to kPrivate.
- { "_POSIX_VDISABLE", kPrivate, "<unistd.h>", kPublic },
-- { "abort", kPrivate, "<stdlib.h>", kPublic },
-+ { "abort", kPrivate, "<stdlib.h>", kPrivate },
- { "aiocb", kPrivate, "<aio.h>", kPublic },
- { "blkcnt_t", kPrivate, "<sys/types.h>", kPublic },
- { "blksize_t", kPrivate, "<sys/types.h>", kPublic },
- { "cc_t", kPrivate, "<termios.h>", kPublic },
-- { "clock_t", kPrivate, "<time.h>", kPublic },
-+ { "clock_t", kPrivate, "<time.h>", kPrivate },
- { "clock_t", kPrivate, "<sys/types.h>", kPublic },
- { "clockid_t", kPrivate, "<sys/types.h>", kPublic },
-- { "ctermid", kPrivate, "<stdio.h>", kPublic },
-+ { "ctermid", kPrivate, "<stdio.h>", kPrivate },
- { "daddr_t", kPrivate, "<sys/types.h>", kPublic },
- { "dev_t", kPrivate, "<sys/types.h>", kPublic },
-- { "div_t", kPrivate, "<stdlib.h>", kPublic },
-- { "double_t", kPrivate, "<math.h>", kPublic },
-- { "error_t", kPrivate, "<errno.h>", kPublic },
-+ { "div_t", kPrivate, "<stdlib.h>", kPrivate },
-+ { "double_t", kPrivate, "<math.h>", kPrivate },
-+ { "error_t", kPrivate, "<errno.h>", kPrivate },
- { "error_t", kPrivate, "<argp.h>", kPublic },
- { "error_t", kPrivate, "<argz.h>", kPublic },
- { "FD_CLR", kPrivate, "<sys/select.h>", kPublic },
-@@ -126,10 +126,10 @@ const IncludeMapEntry libc_symbol_map[] = {
- { "fd_set", kPrivate, "<sys/select.h>", kPublic },
- { "FD_SETSIZE", kPrivate, "<sys/select.h>", kPublic },
- { "FD_ZERO", kPrivate, "<sys/select.h>", kPublic },
-- { "fenv_t", kPrivate, "<fenv.h>", kPublic },
-- { "fexcept_t", kPrivate, "<fenv.h>", kPublic },
-- { "FILE", kPrivate, "<stdio.h>", kPublic },
-- { "float_t", kPrivate, "<math.h>", kPublic },
-+ { "fenv_t", kPrivate, "<fenv.h>", kPrivate },
-+ { "fexcept_t", kPrivate, "<fenv.h>", kPrivate },
-+ { "FILE", kPrivate, "<stdio.h>", kPrivate },
-+ { "float_t", kPrivate, "<math.h>", kPrivate },
- { "fsblkcnt_t", kPrivate, "<sys/types.h>", kPublic },
- { "fsfilcnt_t", kPrivate, "<sys/types.h>", kPublic },
- { "getopt", kPrivate, "<unistd.h>", kPublic },
-@@ -139,47 +139,47 @@ const IncludeMapEntry libc_symbol_map[] = {
- { "in_addr_t", kPrivate, "<netinet/in.h>", kPublic },
- { "in_port_t", kPrivate, "<netinet/in.h>", kPublic },
- { "id_t", kPrivate, "<sys/types.h>", kPublic },
-- { "imaxdiv_t", kPrivate, "<inttypes.h>", kPublic },
-- { "intmax_t", kPrivate, "<stdint.h>", kPublic },
-- { "uintmax_t", kPrivate, "<stdint.h>", kPublic },
-+ { "imaxdiv_t", kPrivate, "<inttypes.h>", kPrivate },
-+ { "intmax_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uintmax_t", kPrivate, "<stdint.h>", kPrivate },
- { "ino64_t", kPrivate, "<sys/types.h>", kPublic },
- { "ino_t", kPrivate, "<sys/types.h>", kPublic },
-- { "int8_t", kPrivate, "<stdint.h>", kPublic },
-- { "int16_t", kPrivate, "<stdint.h>", kPublic },
-- { "int32_t", kPrivate, "<stdint.h>", kPublic },
-- { "int64_t", kPrivate, "<stdint.h>", kPublic },
-- { "int_fast8_t", kPrivate, "<stdint.h>", kPublic },
-- { "int_fast16_t", kPrivate, "<stdint.h>", kPublic },
-- { "int_fast32_t", kPrivate, "<stdint.h>", kPublic },
-- { "int_fast64_t", kPrivate, "<stdint.h>", kPublic },
-- { "int_least8_t", kPrivate, "<stdint.h>", kPublic },
-- { "int_least16_t", kPrivate, "<stdint.h>", kPublic },
-- { "int_least32_t", kPrivate, "<stdint.h>", kPublic },
-- { "int_least64_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint8_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint16_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint32_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint64_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint_fast8_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint_fast16_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint_fast32_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint_fast64_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint_least8_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint_least16_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint_least32_t", kPrivate, "<stdint.h>", kPublic },
-- { "uint_least64_t", kPrivate, "<stdint.h>", kPublic },
-- { "intptr_t", kPrivate, "<stdint.h>", kPublic },
-- { "uintptr_t", kPrivate, "<stdint.h>", kPublic },
-+ { "int8_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int16_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int32_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int64_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int_fast8_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int_fast16_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int_fast32_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int_fast64_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int_least8_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int_least16_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int_least32_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "int_least64_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint8_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint16_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint32_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint64_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint_fast8_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint_fast16_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint_fast32_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint_fast64_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint_least8_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint_least16_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint_least32_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uint_least64_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "intptr_t", kPrivate, "<stdint.h>", kPrivate },
-+ { "uintptr_t", kPrivate, "<stdint.h>", kPrivate },
- { "iovec", kPrivate, "<sys/uio.h>", kPublic },
-- { "itimerspec", kPrivate, "<time.h>", kPublic },
-+ { "itimerspec", kPrivate, "<time.h>", kPrivate },
- { "key_t", kPrivate, "<sys/types.h>", kPublic },
-- { "L_ctermid", kPrivate, "<stdio.h>", kPublic },
-- { "lconv", kPrivate, "<locale.h>", kPublic },
-- { "ldiv_t", kPrivate, "<stdlib.h>", kPublic },
-- { "lldiv_t", kPrivate, "<stdlib.h>", kPublic },
-- { "locale_t", kPrivate, "<locale.h>", kPublic },
-- { "max_align_t", kPrivate, "<stddef.h>", kPublic },
-- { "mbstate_t", kPrivate, "<wchar.h>", kPublic },
-+ { "L_ctermid", kPrivate, "<stdio.h>", kPrivate },
-+ { "lconv", kPrivate, "<locale.h>", kPrivate },
-+ { "ldiv_t", kPrivate, "<stdlib.h>", kPrivate },
-+ { "lldiv_t", kPrivate, "<stdlib.h>", kPrivate },
-+ { "locale_t", kPrivate, "<locale.h>", kPrivate },
-+ { "max_align_t", kPrivate, "<stddef.h>", kPrivate },
-+ { "mbstate_t", kPrivate, "<wchar.h>", kPrivate },
- { "mcontext_t", kPrivate, "<ucontext.h>", kPublic },
- { "mode_t", kPrivate, "<sys/types.h>", kPublic },
- { "nl_item", kPrivate, "<nl_types.h>", kPublic },
-@@ -195,8 +195,8 @@ const IncludeMapEntry libc_symbol_map[] = {
- { "optind", kPrivate, "<unistd.h>", kPublic },
- { "optopt", kPrivate, "<unistd.h>", kPublic },
- { "pid_t", kPrivate, "<sys/types.h>", kPublic },
-- { "posix_memalign", kPrivate, "<stdlib.h>", kPublic },
-- { "printf", kPrivate, "<stdio.h>", kPublic },
-+ { "posix_memalign", kPrivate, "<stdlib.h>", kPrivate },
-+ { "printf", kPrivate, "<stdio.h>", kPrivate },
- { "pthread_attr_t", kPrivate, "<pthread.h>", kPublic },
- { "pthread_cond_t", kPrivate, "<pthread.h>", kPublic },
- { "pthread_condattr_t", kPrivate, "<pthread.h>", kPublic },
-@@ -207,7 +207,7 @@ const IncludeMapEntry libc_symbol_map[] = {
- { "pthread_rwlock_t", kPrivate, "<pthread.h>", kPublic },
- { "pthread_rwlockattr_t", kPrivate, "<pthread.h>", kPublic },
- { "pthread_t", kPrivate, "<pthread.h>", kPublic },
-- { "ptrdiff_t", kPrivate, "<stddef.h>", kPublic },
-+ { "ptrdiff_t", kPrivate, "<stddef.h>", kPrivate },
- { "regex_t", kPrivate, "<regex.h>", kPublic },
- { "regmatch_t", kPrivate, "<regex.h>", kPublic },
- { "regoff_t", kPrivate, "<regex.h>", kPublic },
-@@ -238,54 +238,54 @@ const IncludeMapEntry libc_symbol_map[] = {
- { "SCHED_FIFO", kPrivate, "<sched.h>", kPublic },
- { "SCHED_OTHER", kPrivate, "<sched.h>", kPublic },
- { "SCHED_RR", kPrivate, "<sched.h>", kPublic },
-- { "SEEK_CUR", kPrivate, "<stdio.h>", kPublic },
-- { "SEEK_END", kPrivate, "<stdio.h>", kPublic },
-- { "SEEK_SET", kPrivate, "<stdio.h>", kPublic },
-- { "sig_atomic_t", kPrivate, "<signal.h>", kPublic },
-- { "sigevent", kPrivate, "<signal.h>", kPublic },
-- { "siginfo_t", kPrivate, "<signal.h>", kPublic },
-- { "sigset_t", kPrivate, "<signal.h>", kPublic },
-- { "sigval", kPrivate, "<signal.h>", kPublic },
-+ { "SEEK_CUR", kPrivate, "<stdio.h>", kPrivate },
-+ { "SEEK_END", kPrivate, "<stdio.h>", kPrivate },
-+ { "SEEK_SET", kPrivate, "<stdio.h>", kPrivate },
-+ { "sig_atomic_t", kPrivate, "<signal.h>", kPrivate },
-+ { "sigevent", kPrivate, "<signal.h>", kPrivate },
-+ { "siginfo_t", kPrivate, "<signal.h>", kPrivate },
-+ { "sigset_t", kPrivate, "<signal.h>", kPrivate },
-+ { "sigval", kPrivate, "<signal.h>", kPrivate },
- { "sockaddr", kPrivate, "<sys/socket.h>", kPublic },
- { "socklen_t", kPrivate, "<sys/socket.h>", kPublic },
- { "ssize_t", kPrivate, "<sys/types.h>", kPublic },
-- { "stack_t", kPrivate, "<signal.h>", kPublic },
-+ { "stack_t", kPrivate, "<signal.h>", kPrivate },
- { "stat", kPrivate, "<sys/stat.h>", kPublic },
- { "suseconds_t", kPrivate, "<sys/types.h>", kPublic },
-- { "time_t", kPrivate, "<time.h>", kPublic },
-+ { "time_t", kPrivate, "<time.h>", kPrivate },
- { "time_t", kPrivate, "<sys/types.h>", kPublic },
- { "timer_t", kPrivate, "<sys/types.h>", kPublic },
-- { "timespec", kPrivate, "<time.h>", kPublic },
-+ { "timespec", kPrivate, "<time.h>", kPrivate },
- { "timeval", kPrivate, "<sys/time.h>", kPublic }, // 'canonical' location for timeval
- { "timeval", kPrivate, "<sys/resource.h>", kPublic },
- { "timeval", kPrivate, "<sys/select.h>", kPublic },
- { "timeval", kPrivate, "<utmpx.h>", kPublic },
-- { "tm", kPrivate, "<time.h>", kPublic },
-+ { "tm", kPrivate, "<time.h>", kPrivate },
- { "u_char", kPrivate, "<sys/types.h>", kPublic },
- { "ucontext_t", kPrivate, "<ucontext.h>", kPublic },
- { "uid_t", kPrivate, "<sys/types.h>", kPublic },
- { "useconds_t", kPrivate, "<sys/types.h>", kPublic },
-- { "wchar_t", kPrivate, "<stddef.h>", kPublic },
-- { "wctrans_t", kPrivate, "<wctype.h>", kPublic },
-- { "wctype_t", kPrivate, "<wctype.h>", kPublic },
-+ { "wchar_t", kPrivate, "<stddef.h>", kPrivate },
-+ { "wctrans_t", kPrivate, "<wctype.h>", kPrivate },
-+ { "wctype_t", kPrivate, "<wctype.h>", kPrivate },
- { "winsize", kPrivate, "<termios.h>", kPublic },
-- { "wint_t", kPrivate, "<wchar.h>", kPublic },
-+ { "wint_t", kPrivate, "<wchar.h>", kPrivate },
- // It is unspecified if the cname headers provide ::size_t.
- // <locale.h> is the one header which defines NULL but not size_t.
-- { "size_t", kPrivate, "<stddef.h>", kPublic }, // 'canonical' location for size_t
-- { "size_t", kPrivate, "<signal.h>", kPublic },
-- { "size_t", kPrivate, "<stdio.h>", kPublic },
-- { "size_t", kPrivate, "<stdlib.h>", kPublic },
-- { "size_t", kPrivate, "<string.h>", kPublic },
-- { "size_t", kPrivate, "<time.h>", kPublic },
-- { "size_t", kPrivate, "<uchar.h>", kPublic },
-- { "size_t", kPrivate, "<wchar.h>", kPublic },
-+ { "size_t", kPrivate, "<stddef.h>", kPrivate }, // 'canonical' location for size_t
-+ { "size_t", kPrivate, "<signal.h>", kPrivate },
-+ { "size_t", kPrivate, "<stdio.h>", kPrivate },
-+ { "size_t", kPrivate, "<stdlib.h>", kPrivate },
-+ { "size_t", kPrivate, "<string.h>", kPrivate },
-+ { "size_t", kPrivate, "<time.h>", kPrivate },
-+ { "size_t", kPrivate, "<uchar.h>", kPrivate },
-+ { "size_t", kPrivate, "<wchar.h>", kPrivate },
- // Macros that can be defined in more than one file, don't have the
- // same __foo_defined guard that other types do, so the grep above
- // doesn't discover them. Until I figure out a better way, I just
- // add them in by hand as I discover them.
-- { "EOF", kPrivate, "<stdio.h>", kPublic },
-- { "FILE", kPrivate, "<stdio.h>", kPublic },
-+ { "EOF", kPrivate, "<stdio.h>", kPrivate },
-+ { "FILE", kPrivate, "<stdio.h>", kPrivate },
- { "IBSHIFT", kPrivate, "<asm/termbits.h>", kPublic },
- { "MAP_POPULATE", kPrivate, "<sys/mman.h>", kPublic },
- { "MAP_POPULATE", kPrivate, "<linux/mman.h>", kPublic },
-@@ -293,22 +293,22 @@ const IncludeMapEntry libc_symbol_map[] = {
- { "MAP_STACK", kPrivate, "<linux/mman.h>", kPublic },
- { "MAXHOSTNAMELEN", kPrivate, "<sys/param.h>", kPublic },
- { "MAXHOSTNAMELEN", kPrivate, "<protocols/timed.h>", kPublic },
-- { "SIGABRT", kPrivate, "<signal.h>", kPublic },
-- { "SIGCHLD", kPrivate, "<signal.h>", kPublic },
-- { "va_arg", kPrivate, "<stdarg.h>", kPublic },
-- { "va_copy", kPrivate, "<stdarg.h>", kPublic },
-- { "va_end", kPrivate, "<stdarg.h>", kPublic },
-- { "va_list", kPrivate, "<stdarg.h>", kPublic },
-- { "va_start", kPrivate, "<stdarg.h>", kPublic },
-- { "WEOF", kPrivate, "<wchar.h>", kPublic },
-+ { "SIGABRT", kPrivate, "<signal.h>", kPrivate },
-+ { "SIGCHLD", kPrivate, "<signal.h>", kPrivate },
-+ { "va_arg", kPrivate, "<stdarg.h>", kPrivate },
-+ { "va_copy", kPrivate, "<stdarg.h>", kPrivate },
-+ { "va_end", kPrivate, "<stdarg.h>", kPrivate },
-+ { "va_list", kPrivate, "<stdarg.h>", kPrivate },
-+ { "va_start", kPrivate, "<stdarg.h>", kPrivate },
-+ { "WEOF", kPrivate, "<wchar.h>", kPrivate },
- // These are symbols that could be defined in either stdlib.h or
- // malloc.h, but we always want the stdlib location.
-- { "malloc", kPrivate, "<stdlib.h>", kPublic },
-- { "calloc", kPrivate, "<stdlib.h>", kPublic },
-- { "realloc", kPrivate, "<stdlib.h>", kPublic },
-- { "free", kPrivate, "<stdlib.h>", kPublic },
-+ { "malloc", kPrivate, "<stdlib.h>", kPrivate },
-+ { "calloc", kPrivate, "<stdlib.h>", kPrivate },
-+ { "realloc", kPrivate, "<stdlib.h>", kPrivate },
-+ { "free", kPrivate, "<stdlib.h>", kPrivate },
- // Entries for NULL
-- { "NULL", kPrivate, "<stddef.h>", kPublic }, // 'canonical' location for NULL
-+ { "NULL", kPrivate, "<stddef.h>", kPrivate }, // 'canonical' location for NULL
- { "NULL", kPrivate, "<clocale>", kPublic },
- { "NULL", kPrivate, "<cstddef>", kPublic },
- { "NULL", kPrivate, "<cstdio>", kPublic },
-@@ -316,13 +316,13 @@ const IncludeMapEntry libc_symbol_map[] = {
- { "NULL", kPrivate, "<cstring>", kPublic },
- { "NULL", kPrivate, "<ctime>", kPublic },
- { "NULL", kPrivate, "<cwchar>", kPublic },
-- { "NULL", kPrivate, "<locale.h>", kPublic },
-- { "NULL", kPrivate, "<stdio.h>", kPublic },
-- { "NULL", kPrivate, "<stdlib.h>", kPublic },
-- { "NULL", kPrivate, "<string.h>", kPublic },
-- { "NULL", kPrivate, "<time.h>", kPublic },
-- { "NULL", kPrivate, "<wchar.h>", kPublic },
-- { "offsetof", kPrivate, "<stddef.h>", kPublic },
-+ { "NULL", kPrivate, "<locale.h>", kPrivate },
-+ { "NULL", kPrivate, "<stdio.h>", kPrivate },
-+ { "NULL", kPrivate, "<stdlib.h>", kPrivate },
-+ { "NULL", kPrivate, "<string.h>", kPrivate },
-+ { "NULL", kPrivate, "<time.h>", kPrivate },
-+ { "NULL", kPrivate, "<wchar.h>", kPrivate },
-+ { "offsetof", kPrivate, "<stddef.h>", kPrivate },
- // Auxiliary vector entry types.
- { "AT_BASE", kPrivate, "<sys/auxv.h>", kPublic },
- { "AT_BASE_PLATFORM", kPrivate, "<sys/auxv.h>", kPublic },
-@@ -409,7 +409,7 @@ const IncludeMapEntry libc_include_map[] = {
- { "<bits/a.out.h>", kPrivate, "<a.out.h>", kPublic },
- { "<bits/auxv.h>", kPrivate, "<sys/auxv.h>", kPublic },
- { "<bits/byteswap.h>", kPrivate, "<byteswap.h>", kPublic },
-- { "<bits/cmathcalls.h>", kPrivate, "<complex.h>", kPublic },
-+ { "<bits/cmathcalls.h>", kPrivate, "<complex.h>", kPrivate },
- { "<bits/confname.h>", kPrivate, "<unistd.h>", kPublic },
- { "<bits/dirent.h>", kPrivate, "<dirent.h>", kPublic },
- { "<bits/dlfcn.h>", kPrivate, "<dlfcn.h>", kPublic },
-@@ -417,18 +417,18 @@ const IncludeMapEntry libc_include_map[] = {
- { "<bits/endian.h>", kPrivate, "<endian.h>", kPublic },
- { "<bits/environments.h>", kPrivate, "<unistd.h>", kPublic },
- { "<bits/epoll.h>", kPrivate, "<sys/epoll.h>", kPublic },
-- { "<bits/errno.h>", kPrivate, "<errno.h>", kPublic },
-+ { "<bits/errno.h>", kPrivate, "<errno.h>", kPrivate },
- { "<bits/error.h>", kPrivate, "<error.h>", kPublic },
- { "<bits/eventfd.h>", kPrivate, "<sys/eventfd.h>", kPublic },
- { "<bits/fcntl.h>", kPrivate, "<fcntl.h>", kPublic },
- { "<bits/fcntl2.h>", kPrivate, "<fcntl.h>", kPublic },
-- { "<bits/fenv.h>", kPrivate, "<fenv.h>", kPublic },
-- { "<bits/fenvinline.h>", kPrivate, "<fenv.h>", kPublic },
-- { "<bits/huge_val.h>", kPrivate, "<math.h>", kPublic },
-- { "<bits/huge_valf.h>", kPrivate, "<math.h>", kPublic },
-- { "<bits/huge_vall.h>", kPrivate, "<math.h>", kPublic },
-+ { "<bits/fenv.h>", kPrivate, "<fenv.h>", kPrivate },
-+ { "<bits/fenvinline.h>", kPrivate, "<fenv.h>", kPrivate },
-+ { "<bits/huge_val.h>", kPrivate, "<math.h>", kPrivate },
-+ { "<bits/huge_valf.h>", kPrivate, "<math.h>", kPrivate },
-+ { "<bits/huge_vall.h>", kPrivate, "<math.h>", kPrivate },
- { "<bits/hwcap.h>", kPrivate, "<sys/auxv.h>", kPublic },
-- { "<bits/inf.h>", kPrivate, "<math.h>", kPublic },
-+ { "<bits/inf.h>", kPrivate, "<math.h>", kPrivate },
- { "<bits/inotify.h>", kPrivate, "<sys/inotify.h>", kPublic },
- { "<bits/ioctl-types.h>", kPrivate, "<sys/ioctl.h>", kPublic },
- { "<bits/ioctls.h>", kPrivate, "<sys/ioctl.h>", kPublic },
-@@ -436,24 +436,24 @@ const IncludeMapEntry libc_include_map[] = {
- { "<bits/ipctypes.h>", kPrivate, "<sys/ipc.h>", kPublic },
- { "<bits/libio-ldbl.h>", kPrivate, "<libio.h>", kPublic },
- { "<bits/link.h>", kPrivate, "<link.h>", kPublic },
-- { "<bits/locale.h>", kPrivate, "<locale.h>", kPublic },
-- { "<bits/math-finite.h>", kPrivate, "<math.h>", kPublic },
-- { "<bits/mathcalls.h>", kPrivate, "<math.h>", kPublic },
-- { "<bits/mathdef.h>", kPrivate, "<math.h>", kPublic },
-- { "<bits/mathinline.h>", kPrivate, "<math.h>", kPublic },
-+ { "<bits/locale.h>", kPrivate, "<locale.h>", kPrivate },
-+ { "<bits/math-finite.h>", kPrivate, "<math.h>", kPrivate },
-+ { "<bits/mathcalls.h>", kPrivate, "<math.h>", kPrivate },
-+ { "<bits/mathdef.h>", kPrivate, "<math.h>", kPrivate },
-+ { "<bits/mathinline.h>", kPrivate, "<math.h>", kPrivate },
- { "<bits/mman.h>", kPrivate, "<sys/mman.h>", kPublic },
- { "<bits/mman-shared.h>", kPrivate, "<sys/mman.h>", kPublic },
- { "<bits/monetary-ldbl.h>", kPrivate, "<monetary.h>", kPublic },
- { "<bits/mqueue.h>", kPrivate, "<mqueue.h>", kPublic },
- { "<bits/mqueue2.h>", kPrivate, "<mqueue.h>", kPublic },
- { "<bits/msq.h>", kPrivate, "<sys/msg.h>", kPublic },
-- { "<bits/nan.h>", kPrivate, "<math.h>", kPublic },
-+ { "<bits/nan.h>", kPrivate, "<math.h>", kPrivate },
- { "<bits/netdb.h>", kPrivate, "<netdb.h>", kPublic },
- { "<bits/param.h>", kPrivate, "<sys/param.h>", kPublic },
- { "<bits/poll.h>", kPrivate, "<sys/poll.h>", kPrivate },
- { "<bits/poll2.h>", kPrivate, "<sys/poll.h>", kPrivate },
-- { "<bits/posix1_lim.h>", kPrivate, "<limits.h>", kPublic },
-- { "<bits/posix2_lim.h>", kPrivate, "<limits.h>", kPublic },
-+ { "<bits/posix1_lim.h>", kPrivate, "<limits.h>", kPrivate },
-+ { "<bits/posix2_lim.h>", kPrivate, "<limits.h>", kPrivate },
- { "<bits/posix_opt.h>", kPrivate, "<unistd.h>", kPublic },
- { "<bits/printf-ldbl.h>", kPrivate, "<printf.h>", kPublic },
- { "<bits/pthreadtypes.h>", kPrivate, "<pthread.h>", kPublic },
-@@ -463,17 +463,17 @@ const IncludeMapEntry libc_include_map[] = {
- { "<bits/select2.h>", kPrivate, "<sys/select.h>", kPublic },
- { "<bits/sem.h>", kPrivate, "<sys/sem.h>", kPublic },
- { "<bits/semaphore.h>", kPrivate, "<semaphore.h>", kPublic },
-- { "<bits/setjmp.h>", kPrivate, "<setjmp.h>", kPublic },
-- { "<bits/setjmp2.h>", kPrivate, "<setjmp.h>", kPublic },
-+ { "<bits/setjmp.h>", kPrivate, "<setjmp.h>", kPrivate },
-+ { "<bits/setjmp2.h>", kPrivate, "<setjmp.h>", kPrivate },
- { "<bits/shm.h>", kPrivate, "<sys/shm.h>", kPublic },
-- { "<bits/sigaction.h>", kPrivate, "<signal.h>", kPublic },
-- { "<bits/sigcontext.h>", kPrivate, "<signal.h>", kPublic },
-- { "<bits/siginfo.h>", kPrivate, "<signal.h>", kPublic },
-- { "<bits/signum.h>", kPrivate, "<signal.h>", kPublic },
-- { "<bits/signum-arch.h>", kPrivate, "<signal.h>", kPublic },
-- { "<bits/sigset.h>", kPrivate, "<signal.h>", kPublic },
-- { "<bits/sigstack.h>", kPrivate, "<signal.h>", kPublic },
-- { "<bits/sigthread.h>", kPrivate, "<signal.h>", kPublic },
-+ { "<bits/sigaction.h>", kPrivate, "<signal.h>", kPrivate },
-+ { "<bits/sigcontext.h>", kPrivate, "<signal.h>", kPrivate },
-+ { "<bits/siginfo.h>", kPrivate, "<signal.h>", kPrivate },
-+ { "<bits/signum.h>", kPrivate, "<signal.h>", kPrivate },
-+ { "<bits/signum-arch.h>", kPrivate, "<signal.h>", kPrivate },
-+ { "<bits/sigset.h>", kPrivate, "<signal.h>", kPrivate },
-+ { "<bits/sigstack.h>", kPrivate, "<signal.h>", kPrivate },
-+ { "<bits/sigthread.h>", kPrivate, "<signal.h>", kPrivate },
- { "<bits/sockaddr.h>", kPrivate, "<sys/un.h>", kPublic },
- { "<bits/socket.h>", kPrivate, "<sys/socket.h>", kPublic },
- { "<bits/socket2.h>", kPrivate, "<sys/socket.h>", kPublic },
-@@ -483,22 +483,22 @@ const IncludeMapEntry libc_include_map[] = {
- { "<bits/statfs.h>", kPrivate, "<sys/statfs.h>", kPublic },
- { "<bits/statvfs.h>", kPrivate, "<sys/statvfs.h>", kPublic },
- { "<bits/statx-generic.h>", kPrivate, "<sys/stat.h>", kPublic },
-- { "<bits/stdio-ldbl.h>", kPrivate, "<stdio.h>", kPublic },
-+ { "<bits/stdio-ldbl.h>", kPrivate, "<stdio.h>", kPrivate },
- { "<bits/stdio-lock.h>", kPrivate, "<libio.h>", kPublic },
-- { "<bits/stdio.h>", kPrivate, "<stdio.h>", kPublic },
-- { "<bits/stdio2.h>", kPrivate, "<stdio.h>", kPublic },
-- { "<bits/stdio_lim.h>", kPrivate, "<stdio.h>", kPublic },
-- { "<bits/stdlib-bsearch.h>", kPrivate, "<stdlib.h>", kPublic },
-- { "<bits/stdlib-float.h>", kPrivate, "<stdlib.h>", kPublic },
-- { "<bits/stdlib-ldbl.h>", kPrivate, "<stdlib.h>", kPublic },
-- { "<bits/stdlib.h>", kPrivate, "<stdlib.h>", kPublic },
-- { "<bits/string.h>", kPrivate, "<string.h>", kPublic },
-- { "<bits/string2.h>", kPrivate, "<string.h>", kPublic },
-- { "<bits/string3.h>", kPrivate, "<string.h>", kPublic },
-+ { "<bits/stdio.h>", kPrivate, "<stdio.h>", kPrivate },
-+ { "<bits/stdio2.h>", kPrivate, "<stdio.h>", kPrivate },
-+ { "<bits/stdio_lim.h>", kPrivate, "<stdio.h>", kPrivate },
-+ { "<bits/stdlib-bsearch.h>", kPrivate, "<stdlib.h>", kPrivate },
-+ { "<bits/stdlib-float.h>", kPrivate, "<stdlib.h>", kPrivate },
-+ { "<bits/stdlib-ldbl.h>", kPrivate, "<stdlib.h>", kPrivate },
-+ { "<bits/stdlib.h>", kPrivate, "<stdlib.h>", kPrivate },
-+ { "<bits/string.h>", kPrivate, "<string.h>", kPrivate },
-+ { "<bits/string2.h>", kPrivate, "<string.h>", kPrivate },
-+ { "<bits/string3.h>", kPrivate, "<string.h>", kPrivate },
- { "<bits/stropts.h>", kPrivate, "<stropts.h>", kPublic },
- { "<bits/struct_stat.h>", kPrivate, "<sys/stat.h>", kPublic },
- { "<bits/struct_stat.h>", kPrivate, "<ftw.h>", kPublic },
-- { "<bits/sys_errlist.h>", kPrivate, "<stdio.h>", kPublic },
-+ { "<bits/sys_errlist.h>", kPrivate, "<stdio.h>", kPrivate },
- { "<bits/syscall.h>", kPrivate, "<sys/syscall.h>", kPublic },
- { "<bits/sysctl.h>", kPrivate, "<sys/sysctl.h>", kPublic },
- { "<bits/syslog-ldbl.h>", kPrivate, "<sys/syslog.h>", kPrivate },
-@@ -515,12 +515,12 @@ const IncludeMapEntry libc_include_map[] = {
- { "<bits/termios-struct.h>", kPrivate, "<termios.h>", kPublic },
- { "<bits/termios-tcflow.h>", kPrivate, "<termios.h>", kPublic },
- { "<bits/termios.h>", kPrivate, "<termios.h>", kPublic },
-- { "<bits/time.h>", kPrivate, "<time.h>", kPublic },
-+ { "<bits/time.h>", kPrivate, "<time.h>", kPrivate },
- { "<bits/time.h>", kPrivate, "<sys/time.h>", kPublic },
- { "<bits/timerfd.h>", kPrivate, "<sys/timerfd.h>", kPublic },
- { "<bits/timex.h>", kPrivate, "<sys/timex.h>", kPublic },
- { "<bits/types.h>", kPrivate, "<sys/types.h>", kPublic },
-- { "<bits/types/siginfo_t.h>", kPrivate, "<signal.h>", kPublic },
-+ { "<bits/types/siginfo_t.h>", kPrivate, "<signal.h>", kPrivate },
- { "<bits/types/siginfo_t.h>", kPrivate, "<sys/wait.h>", kPublic },
- { "<bits/types/struct_rusage.h>", kPrivate, "<sys/resource.h>", kPublic },
- { "<bits/types/struct_sched_param.h>", kPrivate, "<sched.h>", kPublic },
-@@ -532,11 +532,11 @@ const IncludeMapEntry libc_include_map[] = {
- { "<bits/utsname.h>", kPrivate, "<sys/utsname.h>", kPublic },
- { "<bits/waitflags.h>", kPrivate, "<sys/wait.h>", kPublic },
- { "<bits/waitstatus.h>", kPrivate, "<sys/wait.h>", kPublic },
-- { "<bits/wchar-ldbl.h>", kPrivate, "<wchar.h>", kPublic },
-- { "<bits/wchar.h>", kPrivate, "<wchar.h>", kPublic },
-- { "<bits/wchar2.h>", kPrivate, "<wchar.h>", kPublic },
-- { "<bits/wordsize.h>", kPrivate, "<limits.h>", kPublic },
-- { "<bits/xopen_lim.h>", kPrivate, "<limits.h>", kPublic },
-+ { "<bits/wchar-ldbl.h>", kPrivate, "<wchar.h>", kPrivate },
-+ { "<bits/wchar.h>", kPrivate, "<wchar.h>", kPrivate },
-+ { "<bits/wchar2.h>", kPrivate, "<wchar.h>", kPrivate },
-+ { "<bits/wordsize.h>", kPrivate, "<limits.h>", kPrivate },
-+ { "<bits/xopen_lim.h>", kPrivate, "<limits.h>", kPrivate },
- { "<bits/xtitypes.h>", kPrivate, "<stropts.h>", kPublic },
- // Sometimes libc tells you what mapping to do via an '#error':
- // # error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
-@@ -546,7 +546,7 @@ const IncludeMapEntry libc_include_map[] = {
- { "<bits/a.out.h>", kPrivate, "<a.out.h>", kPublic },
- { "<bits/byteswap-16.h>", kPrivate, "<byteswap.h>", kPublic },
- { "<bits/byteswap.h>", kPrivate, "<byteswap.h>", kPublic },
-- { "<bits/cmathcalls.h>", kPrivate, "<complex.h>", kPublic },
-+ { "<bits/cmathcalls.h>", kPrivate, "<complex.h>", kPrivate },
- { "<bits/confname.h>", kPrivate, "<unistd.h>", kPublic },
- { "<bits/dirent.h>", kPrivate, "<dirent.h>", kPublic },
- { "<bits/dlfcn.h>", kPrivate, "<dlfcn.h>", kPublic },
-@@ -556,38 +556,38 @@ const IncludeMapEntry libc_include_map[] = {
- { "<bits/eventfd.h>", kPrivate, "<sys/eventfd.h>", kPublic },
- { "<bits/fcntl-linux.h>", kPrivate, "<fcntl.h>", kPublic },
- { "<bits/fcntl.h>", kPrivate, "<fcntl.h>", kPublic },
-- { "<bits/fenv.h>", kPrivate, "<fenv.h>", kPublic },
-- { "<bits/huge_val.h>", kPrivate, "<math.h>", kPublic },
-- { "<bits/huge_valf.h>", kPrivate, "<math.h>", kPublic },
-- { "<bits/huge_vall.h>", kPrivate, "<math.h>", kPublic },
-+ { "<bits/fenv.h>", kPrivate, "<fenv.h>", kPrivate },
-+ { "<bits/huge_val.h>", kPrivate, "<math.h>", kPrivate },
-+ { "<bits/huge_valf.h>", kPrivate, "<math.h>", kPrivate },
-+ { "<bits/huge_vall.h>", kPrivate, "<math.h>", kPrivate },
- { "<bits/in.h>", kPrivate, "<netinet/in.h>", kPublic },
-- { "<bits/inf.h>", kPrivate, "<math.h>", kPublic },
-+ { "<bits/inf.h>", kPrivate, "<math.h>", kPrivate },
- { "<bits/inotify.h>", kPrivate, "<sys/inotify.h>", kPublic },
- { "<bits/ioctl-types.h>", kPrivate, "<sys/ioctl.h>", kPublic },
- { "<bits/ioctls.h>", kPrivate, "<sys/ioctl.h>", kPublic },
- { "<bits/ipc.h>", kPrivate, "<sys/ipc.h>", kPublic },
- { "<bits/ipctypes.h>", kPrivate, "<sys/ipc.h>", kPublic },
-- { "<bits/locale.h>", kPrivate, "<locale.h>", kPublic },
-- { "<bits/math-finite.h>", kPrivate, "<math.h>", kPublic },
-- { "<bits/mathdef.h>", kPrivate, "<math.h>", kPublic },
-- { "<bits/mathinline.h>", kPrivate, "<math.h>", kPublic },
-+ { "<bits/locale.h>", kPrivate, "<locale.h>", kPrivate },
-+ { "<bits/math-finite.h>", kPrivate, "<math.h>", kPrivate },
-+ { "<bits/mathdef.h>", kPrivate, "<math.h>", kPrivate },
-+ { "<bits/mathinline.h>", kPrivate, "<math.h>", kPrivate },
- { "<bits/mman-linux.h>", kPrivate, "<sys/mman.h>", kPublic },
- { "<bits/mman.h>", kPrivate, "<sys/mman.h>", kPublic },
- { "<bits/mqueue.h>", kPrivate, "<mqueue.h>", kPublic },
- { "<bits/msq.h>", kPrivate, "<sys/msg.h>", kPublic },
-- { "<bits/nan.h>", kPrivate, "<math.h>", kPublic },
-+ { "<bits/nan.h>", kPrivate, "<math.h>", kPrivate },
- { "<bits/param.h>", kPrivate, "<sys/param.h>", kPublic },
- { "<bits/poll.h>", kPrivate, "<sys/poll.h>", kPrivate },
- { "<bits/predefs.h>", kPrivate, "<features.h>", kPublic },
- { "<bits/resource.h>", kPrivate, "<sys/resource.h>", kPublic },
- { "<bits/select.h>", kPrivate, "<sys/select.h>", kPublic },
- { "<bits/semaphore.h>", kPrivate, "<semaphore.h>", kPublic },
-- { "<bits/sigcontext.h>", kPrivate, "<signal.h>", kPublic },
-+ { "<bits/sigcontext.h>", kPrivate, "<signal.h>", kPrivate },
- { "<bits/signalfd.h>", kPrivate, "<sys/signalfd.h>", kPublic },
-- { "<bits/stdlib-float.h>", kPrivate, "<stdlib.h>", kPublic },
-- { "<bits/string.h>", kPrivate, "<string.h>", kPublic },
-- { "<bits/string2.h>", kPrivate, "<string.h>", kPublic },
-- { "<bits/string3.h>", kPrivate, "<string.h>", kPublic },
-+ { "<bits/stdlib-float.h>", kPrivate, "<stdlib.h>", kPrivate },
-+ { "<bits/string.h>", kPrivate, "<string.h>", kPrivate },
-+ { "<bits/string2.h>", kPrivate, "<string.h>", kPrivate },
-+ { "<bits/string3.h>", kPrivate, "<string.h>", kPrivate },
- { "<bits/timerfd.h>", kPrivate, "<sys/timerfd.h>", kPublic },
- { "<bits/typesizes.h>", kPrivate, "<sys/types.h>", kPublic },
- // Top-level #includes that just forward to another file:
-@@ -599,13 +599,13 @@ const IncludeMapEntry libc_include_map[] = {
- // on the POSIX.1-2024 list, I just choose the top-level one.
- { "<sys/aio.h>", kPrivate, "<aio.h>", kPublic },
- { "<sys/dirent.h>", kPrivate, "<dirent.h>", kPublic },
-- { "<sys/errno.h>", kPrivate, "<errno.h>", kPublic },
-+ { "<sys/errno.h>", kPrivate, "<errno.h>", kPrivate },
- { "<sys/fcntl.h>", kPrivate, "<fcntl.h>", kPublic },
- { "<sys/poll.h>", kPrivate, "<poll.h>", kPublic },
- { "<sys/semaphore.h>", kPrivate, "<semaphore.h>", kPublic },
-- { "<sys/signal.h>", kPrivate, "<signal.h>", kPublic },
-+ { "<sys/signal.h>", kPrivate, "<signal.h>", kPrivate },
- { "<sys/spawn.h>", kPrivate, "<spawn.h>", kPublic },
-- { "<sys/stdio.h>", kPrivate, "<stdio.h>", kPublic },
-+ { "<sys/stdio.h>", kPrivate, "<stdio.h>", kPrivate },
- { "<sys/syslog.h>", kPrivate, "<syslog.h>", kPublic },
- { "<sys/termios.h>", kPrivate, "<termios.h>", kPublic },
- { "<sys/unistd.h>", kPrivate, "<unistd.h>", kPublic },
-@@ -625,21 +625,21 @@ const IncludeMapEntry libc_include_map[] = {
- { "<asm/unistd_64.h>", kPrivate, "<asm/unistd.h>", kPrivate },
- // I don't know what grep would have found these. I found them
- // via user report.
-- { "<asm/errno.h>", kPrivate, "<errno.h>", kPublic },
-- { "<asm/errno-base.h>", kPrivate, "<errno.h>", kPublic },
-+ { "<asm/errno.h>", kPrivate, "<errno.h>", kPrivate },
-+ { "<asm/errno-base.h>", kPrivate, "<errno.h>", kPrivate },
- { "<asm/ptrace-abi.h>", kPrivate, "<asm/ptrace.h>", kPublic },
- { "<asm/unistd.h>", kPrivate, "<sys/syscall.h>", kPublic },
-- { "<linux/limits.h>", kPrivate, "<limits.h>", kPublic }, // PATH_MAX
-+ { "<linux/limits.h>", kPrivate, "<limits.h>", kPrivate }, // PATH_MAX
- { "<linux/prctl.h>", kPrivate, "<sys/prctl.h>", kPublic },
- { "<sys/ucontext.h>", kPrivate, "<ucontext.h>", kPublic },
- // System headers available on AIX, BSD, Solaris and other Unix systems
- { "<sys/dtrace.h>", kPrivate, "<dtrace.h>", kPublic },
- { "<sys/paths.h>", kPrivate, "<paths.h>", kPublic },
-- { "<sys/syslimits.h>", kPrivate, "<limits.h>", kPublic },
-+ { "<sys/syslimits.h>", kPrivate, "<limits.h>", kPrivate },
- { "<sys/ttycom.h>", kPrivate, "<sys/ioctl.h>", kPublic },
- { "<sys/ustat.h>", kPrivate, "<ustat.h>", kPublic },
- // Exports guaranteed by the C standard
-- { "<stdint.h>", kPublic, "<inttypes.h>", kPublic },
-+ { "<cstdint>", kPublic, "<cinttypes>", kPublic },
- };
-
- const IncludeMapEntry stdlib_c_include_map[] = {
-@@ -658,32 +658,32 @@ const IncludeMapEntry stdlib_c_include_map[] = {
- // https://github.com/cplusplus/draft/blob/c+%2B20/source/lib-intro.tex
- //
- // $ curl -s -N https://raw.githubusercontent.com/cplusplus/draft/c%2B%2B20/source/lib-intro.tex | sed -n '/begin{multicolfloattable}.*{headers.cpp.c}/,/end{multicolfloattable}/p' | grep tcode | perl -nle 'm/tcode{<c(.*)>}/ && print qq@ { "<$1.h>", kPublic, "<c$1>", kPublic },@' | sort
-- { "<assert.h>", kPublic, "<cassert>", kPublic },
-- { "<complex.h>", kPublic, "<ccomplex>", kPublic },
-- { "<ctype.h>", kPublic, "<cctype>", kPublic },
-- { "<errno.h>", kPublic, "<cerrno>", kPublic },
-- { "<fenv.h>", kPublic, "<cfenv>", kPublic },
-+ { "<assert.h>", kPrivate, "<cassert>", kPublic },
-+ { "<complex.h>", kPrivate, "<ccomplex>", kPublic },
-+ { "<ctype.h>", kPrivate, "<cctype>", kPublic },
-+ { "<errno.h>", kPrivate, "<cerrno>", kPublic },
-+ { "<fenv.h>", kPrivate, "<cfenv>", kPublic },
- { "<float.h>", kPublic, "<cfloat>", kPublic },
-- { "<inttypes.h>", kPublic, "<cinttypes>", kPublic },
-- { "<iso646.h>", kPublic, "<ciso646>", kPublic },
-- { "<limits.h>", kPublic, "<climits>", kPublic },
-- { "<locale.h>", kPublic, "<clocale>", kPublic },
-- { "<math.h>", kPublic, "<cmath>", kPublic },
-- { "<setjmp.h>", kPublic, "<csetjmp>", kPublic },
-- { "<signal.h>", kPublic, "<csignal>", kPublic },
-- { "<stdalign.h>", kPublic, "<cstdalign>", kPublic },
-- { "<stdarg.h>", kPublic, "<cstdarg>", kPublic },
-- { "<stdbool.h>", kPublic, "<cstdbool>", kPublic },
-- { "<stddef.h>", kPublic, "<cstddef>", kPublic },
-- { "<stdint.h>", kPublic, "<cstdint>", kPublic },
-- { "<stdio.h>", kPublic, "<cstdio>", kPublic },
-- { "<stdlib.h>", kPublic, "<cstdlib>", kPublic },
-- { "<string.h>", kPublic, "<cstring>", kPublic },
-- { "<tgmath.h>", kPublic, "<ctgmath>", kPublic },
-- { "<time.h>", kPublic, "<ctime>", kPublic },
-- { "<uchar.h>", kPublic, "<cuchar>", kPublic },
-- { "<wchar.h>", kPublic, "<cwchar>", kPublic },
-- { "<wctype.h>", kPublic, "<cwctype>", kPublic },
-+ { "<inttypes.h>", kPrivate, "<cinttypes>", kPublic },
-+ { "<iso646.h>", kPrivate, "<ciso646>", kPublic },
-+ { "<limits.h>", kPrivate, "<climits>", kPublic },
-+ { "<locale.h>", kPrivate, "<clocale>", kPublic },
-+ { "<math.h>", kPrivate, "<cmath>", kPublic },
-+ { "<setjmp.h>", kPrivate, "<csetjmp>", kPublic },
-+ { "<signal.h>", kPrivate, "<csignal>", kPublic },
-+ { "<stdalign.h>", kPrivate, "<cstdalign>", kPublic },
-+ { "<stdarg.h>", kPrivate, "<cstdarg>", kPublic },
-+ { "<stdbool.h>", kPrivate, "<cstdbool>", kPublic },
-+ { "<stddef.h>", kPrivate, "<cstddef>", kPublic },
-+ { "<stdint.h>", kPrivate, "<cstdint>", kPublic },
-+ { "<stdio.h>", kPrivate, "<cstdio>", kPublic },
-+ { "<stdlib.h>", kPrivate, "<cstdlib>", kPublic },
-+ { "<string.h>", kPrivate, "<cstring>", kPublic },
-+ { "<tgmath.h>", kPrivate, "<ctgmath>", kPublic },
-+ { "<time.h>", kPrivate, "<ctime>", kPublic },
-+ { "<uchar.h>", kPrivate, "<cuchar>", kPublic },
-+ { "<wchar.h>", kPrivate, "<cwchar>", kPublic },
-+ { "<wctype.h>", kPrivate, "<cwctype>", kPublic },
- };
-
- const char* stdlib_cpp_public_headers[] = {
### ci/test/02_iwyu_hash.patch
@@ -1,44 +0,0 @@
-Map std::hash to its providing standard headers.
-Backport of https://github.com/include-what-you-use/include-what-you-use/pull/2013
-(commit 52f85e1f4d990f55fc6556d543eb051d79364a16) to the clang_22 release
-branch. Drop once the upstream fix lands in the IWYU branch tracked by
-ci/test/00_setup_env_native_iwyu.sh.
-
---- a/std_symbol_map.inc
-+++ b/std_symbol_map.inc
-@@ -1054,12 +1054,27 @@
- { "std::has_unique_object_representations_v", kPrivate, "<type_traits>", kPublic },
- { "std::has_virtual_destructor", kPrivate, "<type_traits>", kPublic },
- { "std::has_virtual_destructor_v", kPrivate, "<type_traits>", kPublic },
-+{ "std::hash", kPrivate, "<functional>", kPublic },
-+{ "std::hash", kPrivate, "<bitset>", kPublic },
-+{ "std::hash", kPrivate, "<coroutine>", kPublic },
-+{ "std::hash", kPrivate, "<filesystem>", kPublic },
-+{ "std::hash", kPrivate, "<memory>", kPublic },
-+{ "std::hash", kPrivate, "<optional>", kPublic },
-+{ "std::hash", kPrivate, "<stacktrace>", kPublic },
-+{ "std::hash", kPrivate, "<string>", kPublic },
-+{ "std::hash", kPrivate, "<string_view>", kPublic },
-+{ "std::hash", kPrivate, "<system_error>", kPublic },
-+{ "std::hash", kPrivate, "<thread>", kPublic },
-+{ "std::hash", kPrivate, "<typeindex>", kPublic },
-+{ "std::hash", kPrivate, "<variant>", kPublic },
-+{ "std::hash", kPrivate, "<vector>", kPublic },
- { "std::hash<std::basic_stacktrace<:0>>", kPrivate, "<stacktrace>", kPublic },
- { "std::hash<std::basic_string<char, std::char_traits<char>, :0>>", kPrivate, "<string>", kPublic },
- { "std::hash<std::basic_string<char16_t, std::char_traits<char16_t>, :0>>", kPrivate, "<string>", kPublic },
- { "std::hash<std::basic_string<char32_t, std::char_traits<char32_t>, :0>>", kPrivate, "<string>", kPublic },
- { "std::hash<std::basic_string<char8_t, std::char_traits<char8_t>, :0>>", kPrivate, "<string>", kPublic },
- { "std::hash<std::basic_string<wchar_t, std::char_traits<wchar_t>, :0>>", kPrivate, "<string>", kPublic },
-+{ "std::hash<std::bitset<:0>>", kPrivate, "<bitset>", kPublic },
- { "std::hash<std::coroutine_handle<:0>>", kPrivate, "<coroutine>", kPublic },
- { "std::hash<std::error_code>", kPrivate, "<system_error>", kPublic },
- { "std::hash<std::error_condition>", kPrivate, "<system_error>", kPublic },
-@@ -1069,6 +1084,7 @@
- { "std::hash<std::shared_ptr<:0>>", kPrivate, "<memory>", kPublic },
- { "std::hash<std::stacktrace_entry>", kPrivate, "<stacktrace>", kPublic },
- { "std::hash<std::string_view>", kPrivate, "<string_view>", kPublic },
-+{ "std::hash<std::thread::id>", kPrivate, "<thread>", kPublic },
- { "std::hash<std::type_index>", kPrivate, "<typeindex>", kPublic },
- { "std::hash<std::u16string_view>", kPrivate, "<string_view>", kPublic },
- { "std::hash<std::u32string_view>", kPrivate, "<string_view>", kPublic },
### ci/test/03_test_script.sh
@@ -243,9 +243,12 @@ if [[ "${RUN_IWYU}" == true ]]; then
run_iwyu() {
mv "${BASE_BUILD_DIR}/$1" "${BASE_BUILD_DIR}/compile_commands.json"
{
- python3 "/include-what-you-use/iwyu_tool.py" \
- -p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \
- -- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
+ python3 /include-what-you-use/mapgen/iwyu-mapgen-clang-intrin.py --lang imp "$("clang-${IWYU_LLVM_V}" -print-resource-dir)/include" > "${BASE_BUILD_DIR}/clang.intrinsics.imp"
+ python3 /include-what-you-use/iwyu_tool.py \
+ -p "${BASE_BUILD_DIR}" "${MAKEJOBS}" -- \
+ -Xiwyu --cxx17ns \
+ -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
+ -Xiwyu --mapping_file="${BASE_BUILD_DIR}/clang.intrinsics.imp" \
-Xiwyu --max_line_length=160 \
-Xiwyu --check_also='*/common/types\.h' \
-Xiwyu --check_also='*/consensus/*\.h' \
### contrib/devtools/iwyu/bitcoin.core.imp
@@ -1,12 +1,3 @@
+# Nothing for now.
[
- # Compiler intrinsics.
- # See: https://github.com/include-what-you-use/include-what-you-use/issues/1764.
- { "include": [ "<emmintrin.h>", "private", "<immintrin.h>", "public" ] },
- { "include": [ "<mmintrin.h>", "private", "<immintrin.h>", "public" ] },
- { "include": [ "<smmintrin.h>", "private", "<immintrin.h>", "public" ] },
- { "include": [ "<tmmintrin.h>", "private", "<immintrin.h>", "public" ] },
-
- # Workaround for IWYU issue.
- # See: https://github.com/include-what-you-use/include-what-you-use/issues/2084.
- { "symbol": ["std::tuple", "private", "<tuple>", "public"] },
]
### src/bench/ccoins_caching.cpp
@@ -14,6 +14,7 @@
#include <test/util/transaction_utils.h>
#include <util/check.h>
+#include <array>
#include <span>
#include <vector>
### src/bench/chacha20.cpp
@@ -5,9 +5,7 @@
#include <bench/bench.h>
#include <crypto/chacha20.h>
#include <crypto/chacha20poly1305.h>
-// IWYU incorrectly suggests removing this header.
-// See https://github.com/include-what-you-use/include-what-you-use/issues/2014.
-#include <util/byte_units.h> // IWYU pragma: keep
+#include <util/byte_units.h>
#include <cstddef>
#include <cstdint>
### src/bench/coin_selection.cpp
@@ -14,7 +14,6 @@
#include <util/check.h>
#include <util/result.h>
#include <wallet/coinselection.h>
-#include <wallet/db.h>
#include <wallet/spend.h>
#include <wallet/sqlite.h>
#include <wallet/transaction.h>
### src/bench/index_blockfilter.cpp
@@ -19,8 +19,10 @@
#include <uint256.h>
#include <util/check.h>
#include <util/strencodings.h>
+#include <util/time.h>
#include <validation.h>
+#include <array>
#include <memory>
#include <span>
#include <vector>
### src/bench/lockedpool.cpp
@@ -4,9 +4,7 @@
#include <bench/bench.h>
#include <support/lockedpool.h>
-// IWYU incorrectly suggests removing this header.
-// See https://github.com/include-what-you-use/include-what-you-use/issues/2014.
-#include <util/byte_units.h> // IWYU pragma: keep
+#include <util/byte_units.h>
#include <cstddef>
#include <cstdint>
### src/bench/merkle_root.cpp
@@ -8,7 +8,6 @@
#include <uint256.h>
#include <util/check.h>
-#include <initializer_list>
#include <utility>
#include <vector>
### src/bench/parse_hex.cpp
@@ -10,7 +10,6 @@
#include <cstddef>
#include <optional>
#include <string>
-#include <vector>
std::string generateHexString(size_t length) {
const auto hex_digits = "0123456789ABCDEF";
### src/bench/poly1305.cpp
@@ -4,9 +4,7 @@
#include <bench/bench.h>
#include <crypto/poly1305.h>
-// IWYU incorrectly suggests removing this header.
-// See https://github.com/include-what-you-use/include-what-you-use/issues/2014.
-#include <util/byte_units.h> // IWYU pragma: keep
+#include <util/byte_units.h>
#include <cstddef>
#include <cstdint>
### src/bench/readwriteblock.cpp
@@ -12,12 +12,10 @@
#include <streams.h>
#include <sync.h>
#include <test/util/setup_common.h>
-#include <uint256.h>
#include <util/check.h>
#include <validation.h>
#include <memory>
-#include <optional>
#include <span>
static CBlock CreateTestBlock()
### src/bench/txgraph.cpp
@@ -9,10 +9,8 @@
#include <util/feefrac.h>
#include <algorithm>
-#include <compare>
#include <cstddef>
#include <cstdint>
-#include <functional>
#include <memory>
#include <utility>
#include <vector>
### src/bench/wallet_balance.cpp
@@ -15,7 +15,6 @@
#include <uint256.h>
#include <util/check.h>
#include <validation.h>
-#include <wallet/db.h>
#include <wallet/receive.h>
#include <wallet/sqlite.h>
#include <wallet/test/util.h>
### src/bench/wallet_create_tx.cpp
@@ -13,7 +13,6 @@
#include <kernel/types.h>
#include <node/blockstorage.h>
#include <outputtype.h>
-#include <policy/feerate.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <script/script.h>
@@ -27,11 +26,9 @@
#include <versionbits.h>
#include <wallet/coincontrol.h>
#include <wallet/coinselection.h>
-#include <wallet/db.h>
#include <wallet/spend.h>
#include <wallet/sqlite.h>
#include <wallet/test/util.h>
-#include <wallet/types.h>
#include <wallet/wallet.h>
#include <wallet/walletutil.h>
### src/bench/wallet_encrypt.cpp
@@ -13,6 +13,7 @@
#include <test/util/setup_common.h>
#include <test/util/time.h>
#include <util/check.h>
+#include <util/time.h>
#include <wallet/context.h>
#include <wallet/crypter.h>
#include <wallet/db.h>
@@ -22,7 +23,6 @@
#include <wallet/walletutil.h>
#include <cstdint>
-#include <functional>
#include <memory>
#include <string>
#include <utility>
### src/bench/wallet_ismine.cpp
@@ -20,7 +20,6 @@
#include <wallet/walletutil.h>
#include <cstdint>
-#include <functional>
#include <memory>
#include <string>
#include <utility>
### src/common/config.cpp
@@ -14,7 +14,7 @@
#include <util/string.h>
#include <algorithm>
-#include <cstdlib>
+#include <cstddef>
#include <fstream>
#include <iostream>
#include <list>
### src/consensus/merkle.cpp
@@ -11,7 +11,6 @@
#include <util/check.h>
#include <cstddef>
-#include <memory>
#include <utility>
/* WARNING! If you're reading this because you're learning about crypto
### src/consensus/validation.h
@@ -14,7 +14,6 @@
#include <cstddef>
#include <cstdint>
-#include <memory>
#include <string>
#include <vector>
### src/crypto/ripemd160.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_RIPEMD160_H
#define BITCOIN_CRYPTO_RIPEMD160_H
+#include <cstddef>
#include <cstdint>
-#include <cstdlib>
/** A hasher class for RIPEMD-160. */
class CRIPEMD160
### src/crypto/sha1.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA1_H
#define BITCOIN_CRYPTO_SHA1_H
+#include <cstddef>
#include <cstdint>
-#include <cstdlib>
/** A hasher class for SHA1. */
class CSHA1
### src/crypto/sha256.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA256_H
#define BITCOIN_CRYPTO_SHA256_H
+#include <cstddef>
#include <cstdint>
-#include <cstdlib>
#include <string>
/** A hasher class for SHA-256. */
### src/crypto/sha256_sse4.cpp
@@ -7,8 +7,8 @@
#if defined(__x86_64__) || defined(__amd64__)
+#include <cstddef>
#include <cstdint>
-#include <cstdlib>
namespace sha256_sse4
{
### src/crypto/sha3.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA3_H
#define BITCOIN_CRYPTO_SHA3_H
+#include <cstddef>
#include <cstdint>
-#include <cstdlib>
#include <span>
//! The Keccak-f[1600] transform.
### src/crypto/sha512.h
@@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA512_H
#define BITCOIN_CRYPTO_SHA512_H
+#include <cstddef>
#include <cstdint>
-#include <cstdlib>
/** A hasher class for SHA-512. */
class CSHA512
### src/index/blockfilterindex.cpp
@@ -19,6 +19,7 @@
#include <sync.h>
#include <uint256.h>
#include <util/check.h>
+#include <util/byte_units.h>
#include <util/fs.h>
#include <util/hasher.h>
#include <util/log.h>
### src/node/blockstorage.h
@@ -18,9 +18,7 @@
#include <streams.h>
#include <sync.h>
#include <uint256.h>
-// IWYU incorrectly suggests removing this header.
-// See https://github.com/include-what-you-use/include-what-you-use/issues/2014.
-#include <util/byte_units.h> // IWYU pragma: keep
+#include <util/byte_units.h>
#include <util/expected.h>
#include <util/fs.h>
#include <util/hasher.h>
### src/rpc/mining.cpp
@@ -65,7 +65,6 @@
#include <cstddef>
#include <cstdint>
#include <functional>
-#include <initializer_list>
#include <limits>
#include <map>
#include <memory>
### src/script/miniscript.h
@@ -19,8 +19,8 @@
#include <algorithm>
#include <concepts>
+#include <cstddef>
#include <cstdint>
-#include <cstdlib>
#include <functional>
#include <memory>
#include <optional>
### src/script/sigcache.h
@@ -11,9 +11,7 @@
#include <cuckoocache.h>
#include <script/interpreter.h>
#include <uint256.h>
-// IWYU incorrectly suggests removing this header.
-// See https://github.com/include-what-you-use/include-what-you-use/issues/2014.
-#include <util/byte_units.h> // IWYU pragma: keep
+#include <util/byte_units.h>
#include <util/hasher.h>
#include <cstddef>
### src/signet.cpp
@@ -20,7 +20,6 @@
#include <cstddef>
#include <cstdint>
#include <exception>
-#include <memory>
#include <span>
#include <utility>
#include <vector>
### src/util/feefrac.h
@@ -8,7 +8,6 @@
#include <util/check.h>
#include <util/overflow.h>
-#include <compare>
#include <concepts>
#include <cstdint>
#include <span>
### src/util/fs.h
@@ -5,9 +5,7 @@
#ifndef BITCOIN_UTIL_FS_H
#define BITCOIN_UTIL_FS_H
-// IWYU incorrectly suggests removing this header.
-// See https://github.com/include-what-you-use/include-what-you-use/issues/1931.
-#include <tinyformat.h> // IWYU pragma: keep
+#include <tinyformat.h>
#include <cstdio>
// The `util/fs.h` header is designed to be a drop-in replacement for `filesystem`.
### src/util/fs_helpers.cpp
@@ -9,7 +9,7 @@
#include <random.h>
#include <sync.h>
#include <tinyformat.h>
-#include <util/byte_units.h> // IWYU pragma: keep
+#include <util/byte_units.h>
#include <util/check.h>
#include <util/fs.h>
#include <util/log.h>
### src/util/fs_helpers.h
@@ -10,7 +10,7 @@
#include <cstdint>
#include <cstdio>
-#include <iosfwd>
+#include <ios>
#include <limits>
#include <optional>
#include <string>Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.