0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-09 10:43:19 -05:00
bitcoin-bitcoin-core/ci/test
MacroFake 9446de160f
Merge bitcoin/bitcoin#24831: tidy: add include-what-you-use
9b0a13a289 tidy: Add include-what-you-use (fanquake)
74cd038e30 refactor: fix includes in src/init (fanquake)
c79ad935f0 refactor: fix includes in src/compat (fanquake)

Pull request description:

  We recently added a [`clang-tidy` job](https://github.com/bitcoin/bitcoin/blob/master/ci/test/00_setup_env_native_tidy.sh) to the CI, which generates a compilation database. We can leverage that now existing database to begin running [include-what-you-use](https://include-what-you-use.org/) over the codebase.

  This PR demonstrates using a mapping_file to indicate fixups / includes that may differ from IWYU suggestions. In this case, I've added some fixups for glibc includes that I've [upstreamed changes for](https://github.com/include-what-you-use/include-what-you-use/pull/1026):
  ```bash
  # Fixups / upstreamed changes
  [
    { include: [ "<bits/termios-c_lflag.h>", private, "<termios.h>", public ] },
    { include: [ "<bits/termios-struct.h>", private, "<termios.h>", public ] },
    { include: [ "<bits/termios-tcflow.h>", private, "<termios.h>", public ] },
  ]
  ```

  The include "fixing" commits of this PR:
  * Adds missing includes.
  * Swaps C headers for their C++ counterparts.
  * Removes the pointless / unmaintainable `//for abc, xyz` comments. When using IWYU, if anyone wants to see / generate those comments, to see why something is included, it is trivial to do so (IWYU outputs them by default). i.e:
  ```cpp
  // The full include-list for compat/stdin.cpp:
  #include <compat/stdin.h>
  #include <poll.h>                  // for poll, pollfd, POLLIN
  #include <termios.h>               // for tcgetattr, tcsetattr
  #include <unistd.h>                // for isatty, STDIN_FILENO
  ```

  TODO:
  - [ ] Qt mapping_file. There is one in the IWYU repo, but it's for Qt 5.11. Needs testing.
  - [ ] Boost mapping_file. There is one in the IWYU repo, but it's for Boost 1.75. Needs testing.

  I'm not suggesting we turn this on the for entire codebase, or immediately go-nuts refactoring all includes. However I think our dependency includes are now slim enough, and our CI infrastructure in place such that we can start doing this in some capacity, and just automate away include fixups / refactorings etc.

ACKs for top commit:
  MarcoFalke:
    review ACK 9b0a13a289
  jonatack:
    ACK 9b0a13a289 reviewed changes and run CI output in https://cirrus-ci.com/task/4750910332076032

Tree-SHA512: 00beab5a5f2a6fc179abf08321a15391ecccaa91ab56f3c50c511e7b29a0d7c95d8bb43eac2c31489711086f6f77319d43d803cf8ea458e7cd234a780d9ae69e
2022-04-28 10:06:26 +02:00
..
00_setup_env.sh ci: Add clang-tidy task 2022-04-04 11:57:06 +02:00
00_setup_env_android.sh scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
00_setup_env_arm.sh scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
00_setup_env_i686_centos.sh ci: Bump CentOS 8 image 2022-02-01 10:13:25 +01:00
00_setup_env_i686_multiprocess.sh test: remove lief install from multiprocess job 2022-03-28 10:35:37 +01:00
00_setup_env_mac.sh build: use macOS 11 SDK (Xcode 12.2) 2022-01-26 17:28:16 +08:00
00_setup_env_mac_host.sh scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
00_setup_env_native_asan.sh build: Add --enable-c++20 option 2022-03-24 11:37:42 +01:00
00_setup_env_native_fuzz.sh Merge bitcoin/bitcoin#24292: Revert "ci: Run fuzzer task for the master branch only" 2022-02-21 13:12:36 +00:00
00_setup_env_native_fuzz_with_msan.sh ci: Use clang-12 and libcxx-12 for msan 2022-03-30 11:56:06 +02:00
00_setup_env_native_fuzz_with_valgrind.sh ci: use DWARF-4 for Valgrind CI job 2022-04-04 10:39:55 +01:00
00_setup_env_native_msan.sh ci: Use clang-12 and libcxx-12 for msan 2022-03-30 11:56:06 +02:00
00_setup_env_native_nowallet_libbitcoinkernel.sh ci/doc: Set minimum required clang/libc++ version to 8.0 2022-03-04 14:13:21 +00:00
00_setup_env_native_qt5.sh Merge bitcoin/bitcoin#24236: Remove utxo db upgrade code 2022-04-05 15:38:14 +02:00
00_setup_env_native_tidy.sh tidy: Add include-what-you-use 2022-04-20 14:14:52 +01:00
00_setup_env_native_tsan.sh ci: Temporarily use clang-13 to work around clang-14 TSan bug 2022-03-15 18:24:16 +01:00
00_setup_env_native_valgrind.sh ci: use DWARF-4 for Valgrind CI job 2022-04-04 10:39:55 +01:00
00_setup_env_s390x.sh test: Exclude broken feature_init for now 2022-02-04 16:33:36 +01:00
00_setup_env_win64.sh Merge bitcoin/bitcoin#24397: build: Fix Boost.Process check for Boost 1.73 and older 2022-02-28 14:06:16 +01:00
04_install.sh tidy: Add include-what-you-use 2022-04-20 14:14:52 +01:00
05_before_script.sh ci: Make log verbose in error case only 2022-04-14 13:44:29 +02:00
06_script_a.sh tidy: enable modernize-use-nullptr 2022-04-26 10:43:33 +01:00
06_script_b.sh tidy: Add include-what-you-use 2022-04-20 14:14:52 +01:00
wrap-qemu.sh scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
wrap-valgrind.sh scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
wrap-wine.sh scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
wrapped-cl.bat ci: Integrate ccache into MSVC build 2022-03-12 03:20:33 +01:00