I tried running iwyu on DPDK source and discovered lots of extra includes (not surprising). https://github.com/include-what-you-use/include-what-you-use/blob/master/README.md
Some example output: /home/shemminger/dpdk/base/lib/librte_eal/linuxapp/eal/eal.c should remove these lines: - #include <getopt.h> // lines 43-43 - #include <malloc_heap.h> // lines 79-79 - #include <rte_cpuflags.h> // lines 71-71 - #include <rte_dev.h> // lines 75-75 - #include <rte_devargs.h> // lines 76-76 - #include <rte_interrupts.h> // lines 72-72 - #include <rte_memzone.h> // lines 59-59 - #include <rte_pci.h> // lines 74-74 - #include <rte_per_lcore.h> // lines 64-64 - #include <rte_version.h> // lines 77-77 - #include <sys/queue.h> // lines 50-50 - #include <syslog.h> // lines 42-42 The full include-list for /home/shemminger/dpdk/base/lib/librte_eal/linuxapp/eal/eal.c: #include <ctype.h> // for ::_ISdigit, ::_ISprint, isdigit #include <errno.h> // for __errno_location, errno, ENOTSUP #include <fcntl.h> // for open, fcntl, O_RDWR, F_SETLK #include <limits.h> // for PATH_MAX #include <pthread.h> // for pthread_create, pthread_self #include <rte_atomic.h> // for rte_atomic32_test_and_set #include <rte_bus.h> // for rte_bus_probe, rte_bus_scan #include <rte_common.h> // for rte_exit, RTE_ALIGN_FLOOR, RTE... #include <rte_cycles.h> // for rte_rdtsc #include <rte_debug.h> // for rte_panic #include <rte_eal.h> // for rte_config, rte_proc_type_t::R... #include <rte_eal_memconfig.h> // for rte_mem_config, rte_eal_mcfg_w... #include <rte_errno.h> // for per_lcore__rte_errno, rte_errno #include <rte_launch.h> // for rte_eal_mp_remote_launch, rte_... #include <rte_lcore.h> // for lcore_config, rte_lcore_to_soc... #include <rte_log.h> // for RTE_LOG, RTE_LOGTYPE_EAL, RTE_... #include <rte_memory.h> // for rte_eal_get_physmem_layout #include <rte_random.h> // for rte_srand #include <rte_service_component.h> // for rte_service_init, rte_service_... #include <rte_string_fns.h> // for rte_strsplit #include <stdint.h> // for uint64_t, uintptr_t #include <stdio.h> // for NULL, fclose, printf, snprintf #include <stdlib.h> // for strtoull, exit, strtoul, EXIT_... #include <string.h> // for strerror, memcpy, strrchr, strcmp #include <sys/file.h> // for flock, LOCK_UN #include <sys/io.h> // for iopl #include <sys/mman.h> // for MAP_FAILED, MAP_SHARED, PROT_READ #include <sys/stat.h> // for stat #include <unistd.h> // for optarg, optind, close, getopt_... #include "eal_filesystem.h" // for eal_runtime_config_path #include "eal_hugepages.h" // for eal_hugepage_info_init #include "eal_internal_cfg.h" // for internal_config, hugepage_info #include "eal_options.h" // for eal_parse_common_option, OPT_S... #include "eal_private.h" // for rte_eal_alarm_init, rte_eal_cp... #include "eal_thread.h" // for RTE_CPU_AFFINITY_STR_LEN, eal_... #include "eal_vfio.h" // for VFIO_PRESENT, pci_vfio_enable #include "generic/rte_atomic.h" // for rte_atomic32_clear, RTE_ATOMIC... #include "generic/rte_cpuflags.h" // for rte_cpu_is_supported #include "rte_config.h" // for RTE_MAX_NUMA_NODES, RTE_ARCH_X86 #include "rte_pci_dev_feature_defs.h" // for rte_intr_mode::RTE_INTR_MODE_L... It would good someone did a full scan and send patches to do the cleanup. P.S: I am okay with C++ style comments on the includes. PPS: But prefer order of standard includes, sys/ rte_... then local include files