From patchwork Tue Jan 26 14:18:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 87338 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EAE0AA052A; Tue, 26 Jan 2021 15:19:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDCB6140DE7; Tue, 26 Jan 2021 15:19:17 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 4F335140D29; Tue, 26 Jan 2021 15:19:14 +0100 (CET) IronPort-SDR: xgDZSV+ahgutNQsrZ8M4DGswbLHhgg2GdrC3ZnGi+MdTjMczjxHQmLLjOrKJXCAAuHpleRIU3i B6nesCdEgpGg== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="179986221" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="179986221" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 06:19:13 -0800 IronPort-SDR: tqrrHZ7UNm+hP1BWdkPROeb8xoj2o9o6SJ43Ilgy4vDSZCRmdpmMAzZ7ZML10yXyGfuVcXAweu 64M7Aam+0yWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="361995424" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2021 06:19:12 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , stable@dpdk.org, Honnappa Nagarahalli , Gavin Hu , Steve Capper , Phil Yang Date: Tue, 26 Jan 2021 14:18:50 +0000 Message-Id: <20210126141857.1029916-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210126141857.1029916-1-bruce.richardson@intel.com> References: <20210114110606.21142-1-bruce.richardson@intel.com> <20210126141857.1029916-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 1/7] eal: add missing include to mcslock 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" Include 'rte_branch_prediction.h' to get the likely/unlikely macro definitions. Fixes: 2173f3333b61 ("mcslock: add MCS queued lock implementation") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- lib/librte_eal/include/generic/rte_mcslock.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_eal/include/generic/rte_mcslock.h b/lib/librte_eal/include/generic/rte_mcslock.h index d370bef17a..9f323bd2a2 100644 --- a/lib/librte_eal/include/generic/rte_mcslock.h +++ b/lib/librte_eal/include/generic/rte_mcslock.h @@ -22,6 +22,7 @@ #include #include #include +#include /** * The rte_mcslock_t type. From patchwork Tue Jan 26 14:18:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 87339 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96525A052A; Tue, 26 Jan 2021 15:19:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 707CF140E59; Tue, 26 Jan 2021 15:19:23 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id E7273140CD6 for ; Tue, 26 Jan 2021 15:19:21 +0100 (CET) IronPort-SDR: NOqYMXD5CM/Qa/JPWeapQTzChAvDbjeEmYioDzcAz3ClmRfmZWaodN5ljZ1u53WnZeCTPJym/y GRMDJPuHri3Q== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="264729152" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="264729152" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 06:19:19 -0800 IronPort-SDR: dzqfBHBUbubLtiQjNGG2S7B6BEnp3TTT26WQO1bvGs+gReJtU8Z7XHsnifHmqqhLYeREJbKeAz x90EKIFbRChQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="361995459" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2021 06:19:18 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , haiyue.wang@intel.com, Ray Kinsella , Neil Horman Date: Tue, 26 Jan 2021 14:18:51 +0000 Message-Id: <20210126141857.1029916-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210126141857.1029916-1-bruce.richardson@intel.com> References: <20210114110606.21142-1-bruce.richardson@intel.com> <20210126141857.1029916-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 2/7] eal: fix error attribute use for clang 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" Clang does not have an "error" attribute for functions, so for marking internal functions we need to check for the error attribute, and provide a fallback if it is not present. For clang, we can use "diagnose_if" attribute, similarly checking for its presence before use. Fixes: fba5af82adc8 ("eal: add internal ABI tag definition") Cc: haiyue.wang@intel.com Signed-off-by: Bruce Richardson --- lib/librte_eal/include/rte_compat.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/include/rte_compat.h b/lib/librte_eal/include/rte_compat.h index 4cd8f68d68..c30f072aa3 100644 --- a/lib/librte_eal/include/rte_compat.h +++ b/lib/librte_eal/include/rte_compat.h @@ -19,12 +19,18 @@ __attribute__((section(".text.experimental"))) #endif -#ifndef ALLOW_INTERNAL_API +#if !defined ALLOW_INTERNAL_API && __has_attribute(error) /* For GCC */ #define __rte_internal \ __attribute__((error("Symbol is not public ABI"), \ section(".text.internal"))) +#elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* For clang */ + +#define __rte_internal \ +__attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \ +section(".text.internal"))) + #else #define __rte_internal \ From patchwork Tue Jan 26 14:18:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 87340 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B129DA052A; Tue, 26 Jan 2021 15:19:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8965140E72; Tue, 26 Jan 2021 15:19:27 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id A6378140E6C for ; Tue, 26 Jan 2021 15:19:23 +0100 (CET) IronPort-SDR: QZTd4Ukw3XkVM2eRSxEq786CKr9dt+NbYO86Z07DPxA4RqQaXBMIZy1yoI9ejivS+QxN/OqKUP eibcs/P81Ynw== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="264729159" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="264729159" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 06:19:23 -0800 IronPort-SDR: KpbbmZ8hAnok/95gSgB9/Ys9QdJLar7vHhJZLEETMlzCv3R6sPdkkCh/I/Nor6wMmzG23oqD7V AyX+S9ZqiVyQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="361995472" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2021 06:19:22 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , vladimir.medvedkin@intel.com Date: Tue, 26 Jan 2021 14:18:52 +0000 Message-Id: <20210126141857.1029916-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210126141857.1029916-1-bruce.richardson@intel.com> References: <20210114110606.21142-1-bruce.richardson@intel.com> <20210126141857.1029916-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 3/7] rib: fix missing header include 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" The rte_rib6 header was using RTE_MIN macro from rte_common.h but not including the header file. Fixes: f7e861e21c46 ("rib: support IPv6") Cc: vladimir.medvedkin@intel.com Signed-off-by: Bruce Richardson Acked-by: Vladimir Medvedkin --- lib/librte_rib/rte_rib6.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_rib/rte_rib6.h b/lib/librte_rib/rte_rib6.h index b5e10569b9..dbd52928a2 100644 --- a/lib/librte_rib/rte_rib6.h +++ b/lib/librte_rib/rte_rib6.h @@ -20,6 +20,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { From patchwork Tue Jan 26 14:18:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 87341 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BAD60A052A; Tue, 26 Jan 2021 15:19:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24C7D140E62; Tue, 26 Jan 2021 15:19:36 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 550F7140E84 for ; Tue, 26 Jan 2021 15:19:34 +0100 (CET) IronPort-SDR: FPrn0Cg2dAZjOZc35S+4aCFndeqZPLHhYVwcraLikdKOzqvyj8/JgVvdmN8FAbUL+H7Jumkw8b PTJBmZ4NWLrQ== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="167577346" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="167577346" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 06:19:31 -0800 IronPort-SDR: FvRDSA8UKXMmymYoXs2PY4N1EKiRvWeCI5cvspyFPfWYVDjr93kilGn4/8GxnNRvwDM12pMInD WHP26j1neNhw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="361995500" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2021 06:19:25 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Konstantin Ananyev , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Yipeng Wang , Sameh Gobriel , Bernard Iremonger , Vladimir Medvedkin , Ori Kam , Honnappa Nagarahalli , Olivier Matz , Cristian Dumitrescu Date: Tue, 26 Jan 2021 14:18:53 +0000 Message-Id: <20210126141857.1029916-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210126141857.1029916-1-bruce.richardson@intel.com> References: <20210114110606.21142-1-bruce.richardson@intel.com> <20210126141857.1029916-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 4/7] build: separate out headers for include checking 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" For some libraries, there may be some header files which are not for direct inclusion, but rather are to be included via other header files. To allow later checking of these files for missing includes, we separate out the indirect include files from the direct ones. Signed-off-by: Bruce Richardson --- doc/guides/contributing/coding_style.rst | 12 ++++++++++++ lib/librte_eal/include/meson.build | 2 +- lib/librte_eal/x86/include/meson.build | 14 +++++++++----- lib/librte_ethdev/meson.build | 4 ++-- lib/librte_hash/meson.build | 4 ++-- lib/librte_ipsec/meson.build | 3 ++- lib/librte_lpm/meson.build | 2 +- lib/librte_regexdev/meson.build | 2 +- lib/librte_ring/meson.build | 4 +++- lib/librte_stack/meson.build | 4 +++- lib/librte_table/meson.build | 7 +++---- lib/meson.build | 3 +++ meson.build | 1 + meson_options.txt | 2 ++ 14 files changed, 45 insertions(+), 19 deletions(-) diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst index bb3f3efcbc..dba4145228 100644 --- a/doc/guides/contributing/coding_style.rst +++ b/doc/guides/contributing/coding_style.rst @@ -891,6 +891,18 @@ headers installed to $PREFIX/include when ``ninja install`` is run. As with source files, these should be specified using the meson ``files()`` function. + When ``check_includes`` build option is set to ``true``, each header file + has additional checks performed on it, for example to ensure that it is + not missing any include statements for dependent headers. + For header files which are public, but only included indirectly in + applications, these checks can be skipped by using the ``headers_no_chkincs`` + variable rather than ``headers``. + +headers_no_chkincs + **Default Value = []**. + As with ``headers`` option above, except that the files are not checked + for all needed include files as part of a DPDK build when + ``check_includes`` is set to ``true``. includes: **Default Value = []**. diff --git a/lib/librte_eal/include/meson.build b/lib/librte_eal/include/meson.build index 0dea342e1d..449740e510 100644 --- a/lib/librte_eal/include/meson.build +++ b/lib/librte_eal/include/meson.build @@ -16,7 +16,6 @@ headers += files( 'rte_dev.h', 'rte_devargs.h', 'rte_eal.h', - 'rte_eal_interrupts.h', 'rte_eal_memconfig.h', 'rte_eal_trace.h', 'rte_errno.h', @@ -49,6 +48,7 @@ headers += files( 'rte_version.h', 'rte_vfio.h', ) +headers_no_chkincs += files('rte_eal_interrupts.h') # special case install the generic headers, since they go in a subdir generic_headers = files( diff --git a/lib/librte_eal/x86/include/meson.build b/lib/librte_eal/x86/include/meson.build index 549cc21a42..835ea22947 100644 --- a/lib/librte_eal/x86/include/meson.build +++ b/lib/librte_eal/x86/include/meson.build @@ -2,11 +2,7 @@ # Copyright(c) 2017 Intel Corporation arch_headers = files( - 'rte_atomic_32.h', - 'rte_atomic_64.h', 'rte_atomic.h', - 'rte_byteorder_32.h', - 'rte_byteorder_64.h', 'rte_byteorder.h', 'rte_cpuflags.h', 'rte_cycles.h', @@ -22,4 +18,12 @@ arch_headers = files( 'rte_ticketlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch')) +arch_headers_no_chkincs = files( + 'rte_atomic_32.h', + 'rte_atomic_64.h', + 'rte_byteorder_32.h', + 'rte_byteorder_64.h', +) +install_headers(arch_headers + arch_headers_no_chkincs, + subdir: get_option('include_subdir_arch')) +dpdk_chkinc_headers += arch_headers diff --git a/lib/librte_ethdev/meson.build b/lib/librte_ethdev/meson.build index e4b610246f..ab84869ea8 100644 --- a/lib/librte_ethdev/meson.build +++ b/lib/librte_ethdev/meson.build @@ -12,12 +12,10 @@ sources = files('ethdev_private.c', headers = files('rte_ethdev.h', 'rte_ethdev_driver.h', - 'rte_ethdev_core.h', 'rte_ethdev_pci.h', 'rte_ethdev_trace.h', 'rte_ethdev_trace_fp.h', 'rte_ethdev_vdev.h', - 'rte_eth_ctrl.h', 'rte_dev_info.h', 'rte_flow.h', 'rte_flow_driver.h', @@ -25,5 +23,7 @@ headers = files('rte_ethdev.h', 'rte_mtr_driver.h', 'rte_tm.h', 'rte_tm_driver.h') +headers_no_chkincs += files('rte_eth_ctrl.h', + 'rte_ethdev_core.h') deps += ['net', 'kvargs', 'meter', 'telemetry'] diff --git a/lib/librte_hash/meson.build b/lib/librte_hash/meson.build index 0977a63fd2..b3ebc8b078 100644 --- a/lib/librte_hash/meson.build +++ b/lib/librte_hash/meson.build @@ -1,12 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -headers = files('rte_crc_arm64.h', - 'rte_fbk_hash.h', +headers = files('rte_fbk_hash.h', 'rte_hash_crc.h', 'rte_hash.h', 'rte_jhash.h', 'rte_thash.h') +headers_no_chkincs += files('rte_crc_arm64.h') sources = files('rte_cuckoo_hash.c', 'rte_fbk_hash.c') deps += ['ring'] diff --git a/lib/librte_ipsec/meson.build b/lib/librte_ipsec/meson.build index fc69970ec5..e24e6ed22b 100644 --- a/lib/librte_ipsec/meson.build +++ b/lib/librte_ipsec/meson.build @@ -3,6 +3,7 @@ sources = files('esp_inb.c', 'esp_outb.c', 'sa.c', 'ses.c', 'ipsec_sad.c') -headers = files('rte_ipsec.h', 'rte_ipsec_group.h', 'rte_ipsec_sa.h', 'rte_ipsec_sad.h') +headers = files('rte_ipsec.h', 'rte_ipsec_sa.h', 'rte_ipsec_sad.h') +headers_no_chkincs += files('rte_ipsec_group.h') deps += ['mbuf', 'net', 'cryptodev', 'security', 'hash'] diff --git a/lib/librte_lpm/meson.build b/lib/librte_lpm/meson.build index f93c866409..3d3d515a4d 100644 --- a/lib/librte_lpm/meson.build +++ b/lib/librte_lpm/meson.build @@ -5,6 +5,6 @@ sources = files('rte_lpm.c', 'rte_lpm6.c') headers = files('rte_lpm.h', 'rte_lpm6.h') # since header files have different names, we can install all vector headers # without worrying about which architecture we actually need -headers += files('rte_lpm_altivec.h', 'rte_lpm_neon.h', 'rte_lpm_sse.h', 'rte_lpm_sve.h') +headers_no_chkincs += files('rte_lpm_altivec.h', 'rte_lpm_neon.h', 'rte_lpm_sse.h', 'rte_lpm_sve.h') deps += ['hash'] deps += ['rcu'] diff --git a/lib/librte_regexdev/meson.build b/lib/librte_regexdev/meson.build index c417b9caf0..1ab21bd4d8 100644 --- a/lib/librte_regexdev/meson.build +++ b/lib/librte_regexdev/meson.build @@ -3,6 +3,6 @@ sources = files('rte_regexdev.c') headers = files('rte_regexdev.h', - 'rte_regexdev_core.h', 'rte_regexdev_driver.h') +headers_no_chkincs += files('rte_regexdev_core.h') deps += ['mbuf'] diff --git a/lib/librte_ring/meson.build b/lib/librte_ring/meson.build index 36fdcb6a57..1a95dae9e5 100644 --- a/lib/librte_ring/meson.build +++ b/lib/librte_ring/meson.build @@ -2,7 +2,9 @@ # Copyright(c) 2017 Intel Corporation sources = files('rte_ring.c') -headers = files('rte_ring.h', +headers = files('rte_ring.h') +# most sub-headers are not for direct inclusion +headers_no_chkincs += files ( 'rte_ring_core.h', 'rte_ring_elem.h', 'rte_ring_c11_mem.h', diff --git a/lib/librte_stack/meson.build b/lib/librte_stack/meson.build index 8f82a40ec2..5d9b3601b3 100644 --- a/lib/librte_stack/meson.build +++ b/lib/librte_stack/meson.build @@ -2,7 +2,9 @@ # Copyright(c) 2019 Intel Corporation sources = files('rte_stack.c', 'rte_stack_std.c', 'rte_stack_lf.c') -headers = files('rte_stack.h', +headers = files('rte_stack.h') +# subheaders, not for direct inclusion by apps +headers_no_chkincs += files( 'rte_stack_std.h', 'rte_stack_lf.h', 'rte_stack_lf_generic.h', diff --git a/lib/librte_table/meson.build b/lib/librte_table/meson.build index d69678386e..a8b1c9a254 100644 --- a/lib/librte_table/meson.build +++ b/lib/librte_table/meson.build @@ -20,7 +20,6 @@ headers = files('rte_table.h', 'rte_table_hash.h', 'rte_table_hash_cuckoo.h', 'rte_table_hash_func.h', - 'rte_table_hash_func_arm64.h', 'rte_lru.h', 'rte_table_array.h', 'rte_table_stub.h', @@ -28,6 +27,6 @@ headers = files('rte_table.h', 'rte_swx_table_em.h',) deps += ['mbuf', 'port', 'lpm', 'hash', 'acl'] -if arch_subdir == 'x86' - headers += files('rte_lru_x86.h') -endif +headers_no_chkincs += files('rte_lru_x86.h', + 'rte_lru_arm64.h', + 'rte_table_hash_func_arm64.h') diff --git a/lib/meson.build b/lib/meson.build index 44f0a62142..aa0a5ac8fc 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -66,6 +66,7 @@ foreach l:libraries use_function_versioning = false sources = [] headers = [] + headers_no_chkincs = [] # public headers not directly included by apps includes = [] cflags = default_cflags objs = [] # other object files to link against, used e.g. for @@ -103,6 +104,8 @@ foreach l:libraries enabled_libs += name dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) install_headers(headers) + install_headers(headers_no_chkincs) + dpdk_chkinc_headers += headers libname = 'rte_' + name includes += include_directories(dir_name) diff --git a/meson.build b/meson.build index 2b9c37eb42..e6e34d0a98 100644 --- a/meson.build +++ b/meson.build @@ -16,6 +16,7 @@ cc = meson.get_compiler('c') dpdk_conf = configuration_data() dpdk_libraries = [] dpdk_static_libraries = [] +dpdk_chkinc_headers = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = [] diff --git a/meson_options.txt b/meson_options.txt index 4604328224..5c382487da 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,7 @@ # Please keep these options sorted alphabetically. +option('check_includes', type: 'boolean', value: false, + description: 'build "chkincs" to verify each header file can compile alone') option('disable_drivers', type: 'string', value: '', description: 'Comma-separated list of drivers to explicitly disable.') option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-', From patchwork Tue Jan 26 14:18:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 87342 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B9F84A052A; Tue, 26 Jan 2021 15:19:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65CAF140EE6; Tue, 26 Jan 2021 15:19:38 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 34E80140E84 for ; Tue, 26 Jan 2021 15:19:35 +0100 (CET) IronPort-SDR: dgGrrUJXpX3Eh8Q00o36Y++uxS8jkhSRIDwyz118kWevEIWhGX2Bc4WlCBGD442AcqW5LM7xY7 FWaNicgrwGCA== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="167577351" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="167577351" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 06:19:34 -0800 IronPort-SDR: MkxC48kKNZRevgsQ20gkCZB7BlCARaJ9J0vnnZOJ00Iq1omGa3dXaFyPOypUpXgYQQZ/vUAeid lH1PU2waKm7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="361995528" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2021 06:19:33 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Thomas Monjalon Date: Tue, 26 Jan 2021 14:18:54 +0000 Message-Id: <20210126141857.1029916-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210126141857.1029916-1-bruce.richardson@intel.com> References: <20210114110606.21142-1-bruce.richardson@intel.com> <20210126141857.1029916-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 5/7] buildtools/chkincs: add app to verify header 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" To verify that all DPDK headers are ok for inclusion directly in a C file, and are not missing any other pre-requisite headers, we can auto-generate for each header an empty C file that includes that header. Compiling these files will throw errors if any header has unmet dependencies. To ensure ongoing compliance, we enable this build test as part of the default x86 build in "test-meson-builds.sh". Signed-off-by: Bruce Richardson --- MAINTAINERS | 4 ++ buildtools/chkincs/gen_c_file_for_header.py | 12 ++++++ buildtools/chkincs/main.c | 4 ++ buildtools/chkincs/meson.build | 41 +++++++++++++++++++++ devtools/test-meson-builds.sh | 2 +- meson.build | 5 +++ 6 files changed, 67 insertions(+), 1 deletion(-) create mode 100755 buildtools/chkincs/gen_c_file_for_header.py create mode 100644 buildtools/chkincs/main.c create mode 100644 buildtools/chkincs/meson.build diff --git a/MAINTAINERS b/MAINTAINERS index 1a12916f56..d4f9ebe46d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1562,6 +1562,10 @@ F: app/test/test_resource.c F: app/test/virtual_pmd.c F: app/test/virtual_pmd.h +Header build sanity checking +M: Bruce Richardson +F: buildtools/chkincs/ + Sample packet helper functions for unit test M: Reshma Pattan F: app/test/sample_packet_forward.c diff --git a/buildtools/chkincs/gen_c_file_for_header.py b/buildtools/chkincs/gen_c_file_for_header.py new file mode 100755 index 0000000000..ed46948aea --- /dev/null +++ b/buildtools/chkincs/gen_c_file_for_header.py @@ -0,0 +1,12 @@ +#! /usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2021 Intel Corporation + +from sys import argv +from os.path import abspath + +(h_file, c_file) = argv[1:] + +contents = '#include "' + abspath(h_file) + '"' +with open(c_file, 'w') as cf: + cf.write(contents) diff --git a/buildtools/chkincs/main.c b/buildtools/chkincs/main.c new file mode 100644 index 0000000000..d25bb8852a --- /dev/null +++ b/buildtools/chkincs/main.c @@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2021 Intel Corporation + */ +int main(void) { return 0; } diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build new file mode 100644 index 0000000000..97f9ad13b3 --- /dev/null +++ b/buildtools/chkincs/meson.build @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2021 Intel Corporation + +if not get_option('check_includes') + build = false + subdir_done() +endif + +if is_windows + # for windows, the shebang line in the script won't work. + error('option "check_includes" is not supported on windows') +endif + +gen_c_file_for_header = find_program('gen_c_file_for_header.py') +gen_c_files = generator(gen_c_file_for_header, + output: '@BASENAME@.c', + arguments: ['@INPUT@', '@OUTPUT@']) + +cflags = machine_args +cflags += '-Wno-unused-function' # needed if we include generic headers +cflags += '-DALLOW_EXPERIMENTAL_API' +cflags += '-DALLOW_INTERNAL_API' + +# some ethdev headers depend on bus headers +includes = include_directories('../../drivers/bus/pci', + '../../drivers/bus/vdev') + +sources = files('main.c') +sources += gen_c_files.process(dpdk_chkinc_headers) + +deps = [] +foreach l:enabled_libs + deps += get_variable('static_rte_' + l) +endforeach + +executable('chkincs', sources, + c_args: cflags, + include_directories: includes, + dependencies: deps, + link_whole: dpdk_static_libraries + dpdk_drivers, + install: false) diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh index efa91e0e40..07b5e6aeca 100755 --- a/devtools/test-meson-builds.sh +++ b/devtools/test-meson-builds.sh @@ -227,7 +227,7 @@ default_machine='nehalem' if ! check_cc_flags "-march=$default_machine" ; then default_machine='corei7' fi -build build-x86-default cc skipABI \ +build build-x86-default cc skipABI -Dcheck_includes=true\ -Dlibdir=lib -Dmachine=$default_machine $use_shared # 32-bit with default compiler diff --git a/meson.build b/meson.build index e6e34d0a98..fcc4d4c900 100644 --- a/meson.build +++ b/meson.build @@ -68,6 +68,11 @@ if get_option('enable_kmods') subdir('kernel') endif +# check header includes if requested +if get_option('check_includes') + subdir('buildtools/chkincs') +endif + # write the build config build_cfg = 'rte_build_config.h' configure_file(output: build_cfg, From patchwork Tue Jan 26 14:18:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 87343 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 209A5A052A; Tue, 26 Jan 2021 15:20:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E58FA140F55; Tue, 26 Jan 2021 15:19:42 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 8B259140EE9 for ; Tue, 26 Jan 2021 15:19:38 +0100 (CET) IronPort-SDR: sIjHpTMR5VAf+fSgrVCqwEKLhi73owHMxdOsdqm8puvhEZ0OusqaN+QhA7vwAiSJc+kP8KfAzo SnwrSmQ4J3Qw== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="167577359" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="167577359" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 06:19:38 -0800 IronPort-SDR: hYgJL4cnYVU6XT7EAvAMnFO2p0y/INh/w0YdV+Ic+ES4GvStZn2iRiO/ZIH1ebVh3B1BljXeqk 1pPa21rSdlmA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="361995541" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2021 06:19:36 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Thomas Monjalon Date: Tue, 26 Jan 2021 14:18:55 +0000 Message-Id: <20210126141857.1029916-7-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210126141857.1029916-1-bruce.richardson@intel.com> References: <20210114110606.21142-1-bruce.richardson@intel.com> <20210126141857.1029916-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 6/7] devtools: remove check-includes script 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" The check-includes script allowed checking header files in a given directory to ensure that each header compiled alone without requiring any other header inclusions. With header checking now being done by the chkincs app in the build system this script can be removed. Signed-off-by: Bruce Richardson --- MAINTAINERS | 1 - devtools/check-includes.sh | 259 ------------------------------------- 2 files changed, 260 deletions(-) delete mode 100755 devtools/check-includes.sh diff --git a/MAINTAINERS b/MAINTAINERS index d4f9ebe46d..8498b402db 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -81,7 +81,6 @@ F: devtools/check-dup-includes.sh F: devtools/check-maintainers.sh F: devtools/check-forbidden-tokens.awk F: devtools/check-git-log.sh -F: devtools/check-includes.sh F: devtools/check-spdx-tag.sh F: devtools/check-symbol-maps.sh F: devtools/checkpatches.sh diff --git a/devtools/check-includes.sh b/devtools/check-includes.sh deleted file mode 100755 index 940cf0eb2a..0000000000 --- a/devtools/check-includes.sh +++ /dev/null @@ -1,259 +0,0 @@ -#!/bin/sh -e -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2016 6WIND S.A. - -# This script checks that header files in a given directory do not miss -# dependencies when included on their own, do not conflict and accept being -# compiled with the strictest possible flags. -# -# Files are looked up in the directory provided as the first argument, -# otherwise build/include by default. -# -# Recognized environment variables: -# -# VERBOSE=1 is the same as -v. -# -# QUIET=1 is the same as -q. -# -# SUMMARY=1 is the same as -s. -# -# CC, CPPFLAGS, CFLAGS, CXX, CXXFLAGS are taken into account. -# -# PEDANTIC_CFLAGS, PEDANTIC_CXXFLAGS and PEDANTIC_CPPFLAGS provide strict -# C/C++ compilation flags. -# -# IGNORE contains a list of globbing patterns matching files (relative to the -# include directory) to avoid. It is set by default to known DPDK headers -# which must not be included on their own. -# -# IGNORE_CXX provides additional files for C++. - -while getopts hqvs arg; do - case $arg in - h) - cat < /dev/null - -[ "$VERBOSE" = 1 ] && -output () -{ - local CCV - local CXXV - - shift - CCV=$CC - CXXV=$CXX - CC="echo $CC" CXX="echo $CXX" "$@" - CC=$CCV - CXX=$CXXV - - "$@" -} || -output () -{ - - printf ' %s\n' "$1" - shift - "$@" -} - -trap 'rm -f "$temp_cc" "$temp_cxx"' EXIT - -compile_cc () -{ - ${CC} -I"$include_dir" \ - ${PEDANTIC_CPPFLAGS} ${CPPFLAGS} \ - ${PEDANTIC_CFLAGS} ${CFLAGS} \ - -c -o /dev/null "${temp_cc}" -} - -compile_cxx () -{ - ${CXX} -I"$include_dir" \ - ${PEDANTIC_CPPFLAGS} ${CPPFLAGS} \ - ${PEDANTIC_CXXFLAGS} ${CXXFLAGS} \ - -c -o /dev/null "${temp_cxx}" -} - -ignore () -{ - file="$1" - shift - while [ $# -ne 0 ]; do - case "$file" in - $1) - return 0 - ;; - esac - shift - done - return 1 -} - -# Check C/C++ compilation for each header file. - -while read -r path -do - file=${path#$include_dir} - file=${file##/} - if ignore "$file" $IGNORE; then - output "SKIP $file" : - continue - fi - if printf "\ -#include <%s> - -int main(void) -{ - return 0; -} -" "$file" > "$temp_cc" && - output "CC $file" compile_cc - then - pass_cc="$pass_cc $file" - else - failures_cc=$(($failures_cc + 1)) - fi - if ignore "$file" $IGNORE_CXX; then - output "SKIP CXX $file" : - continue - fi - if printf "\ -#include <%s> - -int main() -{ -} -" "$file" > "$temp_cxx" && - output "CXX $file" compile_cxx - then - pass_cxx="$pass_cxx $file" - else - failures_cxx=$(($failures_cxx + 1)) - fi -done < "$temp_cc" && -for file in $pass_cc; do - printf "\ -#include <%s> -" "$file" >> $temp_cc -done -if printf "\ -int main(void) -{ - return 0; -} -" >> "$temp_cc" && - output "CC (all includes that did not fail)" compile_cc -then - : -else - failures_cc=$(($failures_cc + 1)) -fi - -# Check C++ compilation with all includes. - -: > "$temp_cxx" && -for file in $pass_cxx; do - printf "\ -#include <%s> -" "$file" >> $temp_cxx -done -if printf "\ -int main() -{ -} -" >> "$temp_cxx" && - output "CXX (all includes that did not fail)" compile_cxx -then - : -else - failures_cxx=$(($failures_cxx + 1)) -fi - -# Report results. - -if [ "$SUMMARY" = 1 ]; then - printf "\ -Summary: - %u failure(s) for C using '%s'. - %u failure(s) for C++ using '%s'. -" $failures_cc "$CC" $failures_cxx "$CXX" 1>&2 -fi - -# Exit with nonzero status if there are failures. - -[ $failures_cc -eq 0 ] && -[ $failures_cxx -eq 0 ] From patchwork Tue Jan 26 14:18:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 87344 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0B981A052A; Tue, 26 Jan 2021 15:20:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB43C140F5F; Tue, 26 Jan 2021 15:19:44 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id B6F21140EE9 for ; Tue, 26 Jan 2021 15:19:41 +0100 (CET) IronPort-SDR: ZuhJCsszFXJ9qkm2UiKs2BVqRcQVzuLwpZ8s0NtT/MB32d/5Wbi2vvCgp9oiyuUps2y3jLkDu2 xUFPG/igm9ew== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="167577368" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="167577368" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 06:19:41 -0800 IronPort-SDR: /HDbGnT6cqnnin6JL3CwxLgpd+9vBFzAyMZOSjvADWnOboAD1UpWERp+cg8yZ1y/a8Jb6xncur lF50tdUBMV2w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="361995557" Received: from silpixa00399126.ir.intel.com ([10.237.222.4]) by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2021 06:19:40 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Aaron Conole , Michael Santana Date: Tue, 26 Jan 2021 14:18:56 +0000 Message-Id: <20210126141857.1029916-8-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210126141857.1029916-1-bruce.richardson@intel.com> References: <20210114110606.21142-1-bruce.richardson@intel.com> <20210126141857.1029916-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 7/7] ci: add checking of includes to CI builds 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" For CI builds, turn on the checking of includes. Signed-off-by: Bruce Richardson --- For simplicity, this patch just enables the header includes checks globally, rather than just limiting it to certain builds. Since the C files generated are all just a single #include line , the extra compilation time is fairly short compared to the overall existing build time in the CI. --- .ci/linux-build.sh | 1 + 1 file changed, 1 insertion(+) -- 2.27.0 diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index afa3689a09..fdbeb5a616 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -57,6 +57,7 @@ fi OPTS="$OPTS -Dmachine=default" OPTS="$OPTS --default-library=$DEF_LIB" OPTS="$OPTS --buildtype=debugoptimized" +OPTS="$OPTS -Dcheck_includes=true" meson build --werror $OPTS ninja -C build