From: "Wiles, Keith" <keith.wiles@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: "stephen@networkplumber.org" <stephen@networkplumber.org>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] devtools: add script to find duplicated includes
Date: Fri, 14 Jul 2017 18:43:19 +0000 [thread overview]
Message-ID: <C6572B54-D94D-4C2D-A02A-342BB521A39B@intel.com> (raw)
In-Reply-To: <64D029E5-9E50-4A2F-90E4-964061FEA8B3@intel.com>
> On Jul 14, 2017, at 1:39 PM, Wiles, Keith <keith.wiles@intel.com> wrote:
>
>
>> On Jul 14, 2017, at 12:07 PM, Thomas Monjalon <thomas@monjalon.net> wrote:
>>
>> Based on Stephen's idea (originally implemented in a Perl script),
>> this is a shell script to find duplicated includes in a file.
>> It looks for all the .c and .h files of the git repository.
>>
>> It is fast enough because automatically well parallelized.
>>
>> Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>> ---
>> devtools/check-dup-includes.sh | 35 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 35 insertions(+)
>> create mode 100755 devtools/check-dup-includes.sh
>>
>> diff --git a/devtools/check-dup-includes.sh b/devtools/check-dup-includes.sh
>> new file mode 100755
>> index 000000000..ba9871255
>> --- /dev/null
>> +++ b/devtools/check-dup-includes.sh
>> @@ -0,0 +1,35 @@
>> +#! /bin/sh -e
>> +
>> +# Copyright 2017 Mellanox Technologies, Ltd. All rights reserved.
>> +#
>> +# Redistribution and use in source and binary forms, with or without
>> +# modification, are permitted provided that the following conditions
>> +# are met:
>> +#
>> +# * Redistributions of source code must retain the above copyright
>> +# notice, this list of conditions and the following disclaimer.
>> +# * Redistributions in binary form must reproduce the above copyright
>> +# notice, this list of conditions and the following disclaimer in
>> +# the documentation and/or other materials provided with the
>> +# distribution.
>> +#
>> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
>> +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
>> +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
>> +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
>> +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
>> +
>> +# Check C files in the git repository for duplicated includes.
>> +
>> +cd $(dirname $(readlink -m $0))/..
>
> I tried the script it works, but I am concerned about the ‘cd’ above as it does all of the the repo. I would like to see it do just the directory and sub-directories if a path is given. If I am testing a specific PMD or library then I would not want to do all of the repo.
>
I was thinking about something like the following:
if [ "$1x" = "x" ]; then
cd $(dirname $(readlink -m $0))/..
fi
>> +
>> +# speed up by ignoring Unicode details
>> +export LC_ALL=C
>> +
>> +for file in $(git ls-files '*.[ch]') ; do
>> + sed -rn 's,^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*,\1,p' $file |
>> + sort | uniq -d |
>> + sed "s,^,$file: duplicated include: ,"
>> +done
>> --
>> 2.13.2
>>
>
> Regards,
> Keith
>
Regards,
Keith
next prev parent reply other threads:[~2017-07-14 18:43 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-11 18:55 [dpdk-dev] [PATCH 00/19] cleanup duplicate includes Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 01/19] devtools: add simple script to find " Stephen Hemminger
2017-07-11 20:33 ` Thomas Monjalon
2017-07-11 23:05 ` Stephen Hemminger
2017-07-12 6:41 ` Thomas Monjalon
2017-07-12 21:59 ` Stephen Hemminger
2017-07-13 6:56 ` Thomas Monjalon
2017-07-13 12:19 ` Wiles, Keith
2017-07-13 12:36 ` Thomas Monjalon
2017-07-14 15:39 ` Thomas Monjalon
2017-07-14 15:54 ` Thomas Monjalon
2017-07-14 16:17 ` Wiles, Keith
2017-07-14 17:07 ` [dpdk-dev] [PATCH] devtools: add script to find duplicated includes Thomas Monjalon
2017-07-14 18:39 ` Wiles, Keith
2017-07-14 18:43 ` Wiles, Keith [this message]
2017-07-15 9:44 ` Thomas Monjalon
2017-07-15 10:00 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2017-08-03 10:06 ` Thomas Monjalon
2017-07-17 11:50 ` [dpdk-dev] [PATCH] " Neil Horman
2017-07-17 13:01 ` Thomas Monjalon
2017-07-11 18:55 ` [dpdk-dev] [PATCH 02/19] eal: remove duplicate includes Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 03/19] cmdline: remove duplicate include of errno.h Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 04/19] distributor: remove duplicate include of rte_compat.h Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 05/19] lpm: remove duplicate include of errno.h Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 06/19] cuckoo_hash: remove duplicate include of rte_log.h Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 07/19] timer: remove duplicate include of rte_per_lcore.h Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 08/19] bnxt: remove duplicate include of unistd.h Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 09/19] ixgbe: remove duplicate include of rte_atomic.h Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 10/19] i40e: " Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 11/19] virtio: remove duplicated includes Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 12/19] cxgbe: " Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 13/19] vmxnet3: remove duplicated include of rte_atomic.h Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 14/19] dpaa2: remove duplicated includes Stephen Hemminger
2017-07-13 9:38 ` Hemant Agrawal
2017-07-11 18:55 ` [dpdk-dev] [PATCH 15/19] fsmlc: " Stephen Hemminger
2017-07-13 9:39 ` Hemant Agrawal
2017-07-11 18:55 ` [dpdk-dev] [PATCH 16/19] app/proc-info: remove duplicate include Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 17/19] app/test-pmd: remove duplicate includes Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 18/19] test/test-pipeline: remove duplicate include of rte_per_lcore.h Stephen Hemminger
2017-07-11 18:55 ` [dpdk-dev] [PATCH 19/19] test/test: remove duplicate includes Stephen Hemminger
2017-07-16 15:34 ` [dpdk-dev] [PATCH 00/19] cleanup " Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C6572B54-D94D-4C2D-A02A-342BB521A39B@intel.com \
--to=keith.wiles@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).