From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B383A0A02; Thu, 14 Jan 2021 12:06:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A613141142; Thu, 14 Jan 2021 12:06:16 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 34BB0141134 for ; Thu, 14 Jan 2021 12:06:14 +0100 (CET) IronPort-SDR: 1zdZotBI4M1pkRN1DspAeb929GgLM9Y08p0ESEbLY9i/sjFTUEZ3vBO6A1Ytr2S4EuGqi6gZhq +H6qGMW5uncQ== X-IronPort-AV: E=McAfee;i="6000,8403,9863"; a="175765753" X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="175765753" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jan 2021 03:06:14 -0800 IronPort-SDR: 4y0IVrTXeYlauWK6/2vNNfbcOp0zudZNGic+tlqoLa8qWKfiZCjTEoGyfYVK/1ULBncjc3oBYF vQmLfury/y4A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="568139766" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by orsmga005.jf.intel.com with ESMTP; 14 Jan 2021 03:06:12 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Thu, 14 Jan 2021 11:05:46 +0000 Message-Id: <20210114110606.21142-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 00/20] ensure headers have correct includes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" As a general principle, each header file should include any other headers it needs to provide data type definitions or macros. For example, any header using the uintX_t types in structures or function prototypes should include "stdint.h" to provide those type definitions. In practice, while many, but not all, headers in DPDK did include all necessary headers, it was never actually checked that each header could be included in a C file and compiled without having any compiler errors about missing definitions. This patchset fixes any missing includes in public headers from the DPDK "lib" folder and then adds a "chkincs" app. to verify this on an ongoing basis. This chkincs app does nothing when run, it's for build-time checking only. Its source code consists of one C file per public DPDK header, where that C file contains nothing except an include for that header. Therefore, if any header is added to the lib folder which fails to compile when included alone, the build of chkincs will fail with a suitable error message. Since this compile checking is not needed on most builds of DPDK, the building of chkincs is disabled by default, but can be enabled by the "test_includes" meson option. To catch errors with patch submissions, the final patch of this series enables it for a single build in test-meson-builds script. Future work could involve doing similar checks on headers for C++ compatibility, for example. Bruce Richardson (20): eal: fix missing header inclusion telemetry: fix missing header include ethdev: fix missing header include ring: fix missing includes for c11 model header net: fix missing header include mbuf: fix missing header include bitratestats: fix missing header include rib: fix missing header includes vhost: fix missing header includes ipsec: fix missing header include fib: fix missing header includes table: fix missing header include pipeline: fix missing header includes metrics: fix variable declaration in header node: fix missing header include app: fix extra include paths for app builds app/chkincs: add chkincs app to verify headers eal: add missing include to mcslock eal/x86: add architecture-specific headers to chkincs test-meson-builds: add includes check to default x86 build app/chkincs/gen_c_file_for_header.py | 53 ++++++++++++++++++++ app/chkincs/main.c | 4 ++ app/chkincs/meson.build | 28 +++++++++++ app/meson.build | 2 + devtools/test-meson-builds.sh | 2 +- lib/librte_bitratestats/rte_bitrate.h | 1 + lib/librte_eal/include/generic/rte_mcslock.h | 1 + lib/librte_eal/include/rte_reciprocal.h | 1 + lib/librte_eal/x86/include/meson.build | 1 + lib/librte_ethdev/rte_eth_ctrl.h | 1 + lib/librte_fib/rte_fib.h | 1 + lib/librte_fib/rte_fib6.h | 1 + lib/librte_ipsec/rte_ipsec_sad.h | 1 + lib/librte_mbuf/rte_mbuf_core.h | 1 + lib/librte_mbuf/rte_mbuf_dyn.h | 3 ++ lib/librte_metrics/rte_metrics_telemetry.c | 2 + lib/librte_metrics/rte_metrics_telemetry.h | 2 - lib/librte_net/rte_geneve.h | 1 + lib/librte_node/rte_node_ip4_api.h | 1 + lib/librte_pipeline/rte_swx_ctl.h | 1 + lib/librte_pipeline/rte_swx_pipeline.h | 1 + lib/librte_rib/rte_rib.h | 2 + lib/librte_ring/rte_ring_c11_mem.h | 4 ++ lib/librte_table/rte_lru_x86.h | 1 + lib/librte_telemetry/rte_telemetry.h | 1 + lib/librte_vhost/rte_vdpa.h | 2 + lib/librte_vhost/rte_vdpa_dev.h | 1 + lib/librte_vhost/rte_vhost_crypto.h | 7 +++ lib/meson.build | 1 + meson.build | 1 + meson_options.txt | 2 + 31 files changed, 128 insertions(+), 3 deletions(-) create mode 100755 app/chkincs/gen_c_file_for_header.py create mode 100644 app/chkincs/main.c create mode 100644 app/chkincs/meson.build -- 2.27.0