From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 0C37AA0A02;
	Thu, 14 Jan 2021 13:28:48 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 1E3F1140CFC;
	Thu, 14 Jan 2021 13:28:47 +0100 (CET)
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by mails.dpdk.org (Postfix) with ESMTP id 431E21411F9
 for <dev@dpdk.org>; Thu, 14 Jan 2021 13:28:44 +0100 (CET)
IronPort-SDR: BZZzkSrVJUJ8wGILYX97f+tilc/hUYMVtcZmPY0gPZt7C88cFYdv4e5MqoUf8pm2KduAT7FaRz
 vecSBY+O+M1g==
X-IronPort-AV: E=McAfee;i="6000,8403,9863"; a="165444156"
X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="165444156"
Received: from orsmga008.jf.intel.com ([10.7.209.65])
 by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 14 Jan 2021 04:28:44 -0800
IronPort-SDR: Rks4nJlfwP8CZzRIqs1XVYNGV4mAwFrqEXHxlCdbMGYMUUMty9cGbYS4bkwDsAbuXKvneRBjVi
 OZ15noZDbt8w==
X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="382252123"
Received: from bricha3-mobl.ger.corp.intel.com ([10.252.16.206])
 by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA;
 14 Jan 2021 04:28:43 -0800
Date: Thu, 14 Jan 2021 12:28:39 +0000
From: Bruce Richardson <bruce.richardson@intel.com>
To: David Marchand <david.marchand@redhat.com>
Cc: dev <dev@dpdk.org>
Message-ID: <20210114122839.GB1959@bricha3-MOBL.ger.corp.intel.com>
References: <20210114110606.21142-1-bruce.richardson@intel.com>
 <20210114110606.21142-18-bruce.richardson@intel.com>
 <CAJFAV8xgrHQDk0jzwbcN178Uwxkc9vmW-hNCto=KP+FNBMY48Q@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAJFAV8xgrHQDk0jzwbcN178Uwxkc9vmW-hNCto=KP+FNBMY48Q@mail.gmail.com>
Subject: Re: [dpdk-dev] [PATCH 17/20] app/chkincs: add chkincs app to verify
 headers
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Thu, Jan 14, 2021 at 01:16:58PM +0100, David Marchand wrote:
> On Thu, Jan 14, 2021 at 12:09 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > 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.
> 
> Some drivers expose APIs to applications, their headers would need checks too.
> 

Yes, that is something that should be checked too, but I've left it as
"further work" for now, and I'm not planning it in this set, as I view it
as less important and this set is big-enough as it is for now. :-)

> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> >  app/chkincs/gen_c_file_for_header.py | 49 ++++++++++++++++++++++++++++
> >  app/chkincs/main.c                   |  4 +++
> >  app/chkincs/meson.build              | 28 ++++++++++++++++
> >  app/meson.build                      |  1 +
> >  lib/meson.build                      |  1 +
> >  meson.build                          |  1 +
> >  meson_options.txt                    |  2 ++
> >  7 files changed, 86 insertions(+)
> >  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
> >
> > diff --git a/app/chkincs/gen_c_file_for_header.py b/app/chkincs/gen_c_file_for_header.py
> > new file mode 100755
> > index 0000000000..f92f2b412c
> > --- /dev/null
> > +++ b/app/chkincs/gen_c_file_for_header.py
> > @@ -0,0 +1,49 @@
> > +#! /usr/bin/env python3
> > +# SPDX-License-Identifier: BSD-3-Clause
> > +# Copyright(c) 2020 Intel Corporation
> 
> 2021*
> 

Code actually was written in 2020 hence the date there.

> 
> > +
> > +from sys import argv
> > +from os.path import abspath
> > +
> > +empty_contents = 'static const char *empty __attribute__((unused)) = "empty";'
> > +# files which are not used directly, but included via others
> > +exceptions = [
> > +    'rte_cmp_arm64.h',
> > +    'rte_cmp_x86.h',
> > +    'rte_crc_arm64.h',
> > +    'rte_eal_interrupts.h',
> > +    'rte_eth_ctrl.h',
> > +    'rte_ethdev_core.h',
> > +    'rte_ipsec_group.h',
> > +    'rte_lpm_altivec.h',
> > +    'rte_lpm_neon.h',
> > +    'rte_lpm_sse.h',
> > +    'rte_lpm_x86.h',
> > +    'rte_lru_arm64.h',
> > +    'rte_lru_x86.h',
> > +    'rte_regexdev_core.h',
> > +    'rte_ring_core.h',
> > +    'rte_ring_generic.h',
> > +    'rte_ring_hts_c11_mem.h',
> > +    'rte_ring_hts.h',
> > +    'rte_ring_peek_c11_mem.h',
> > +    'rte_ring_peek.h',
> > +    'rte_ring_peek_zc.h',
> > +    'rte_ring_rts_c11_mem.h',
> > +    'rte_ring_rts.h',
> > +    'rte_stack_lf_c11.h',
> > +    'rte_stack_lf_generic.h',
> > +    'rte_stack_lf.h',
> > +    'rte_stack_std.h',
> > +    'rte_table_hash_func_arm64.h',
> > +    ]
> 
> Can we instead flag those headers from the libraries themselves?
> In addition of the headers current variable, something like a
> internal_headers or private_headers variable?
> 

Yes, we could do that, though we need a suitable name, since they aren't
internal only or private. :-) Maybe just have it literally called
"skip_chkincs_headers"? Open to more ideas...

Thanks for the review!

/Bruce