On Thu, Jan 14, 2021 at 12:09 PM Bruce Richardson <bruce.richard...@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. > > Signed-off-by: Bruce Richardson <bruce.richard...@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* > + > +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? > + > +(h_file, c_file) = argv[1:] > + > +contents = '#include "' + abspath(h_file) + '"' > +for ex in exceptions: > + if h_file.endswith(ex): > + contents = empty_contents > + > +with open(c_file, 'w') as cf: > + cf.write(contents) -- David Marchand