From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxDr2-0002Cf-1t for qemu-devel@nongnu.org; Thu, 20 Oct 2016 09:57:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxDqz-0008W5-1T for qemu-devel@nongnu.org; Thu, 20 Oct 2016 09:57:56 -0400 References: <1476957133-24382-1-git-send-email-anand.indukala@gmail.com> From: Eric Blake Message-ID: Date: Thu, 20 Oct 2016 08:57:50 -0500 MIME-Version: 1.0 In-Reply-To: <1476957133-24382-1-git-send-email-anand.indukala@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0sHh7VR10DnJ8Ivhd2mPtTd2nihpi5eGN" Subject: Re: [Qemu-devel] [PATCH 1/2] script/clean-includes: added duplicate #include check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anand J , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, thuth@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0sHh7VR10DnJ8Ivhd2mPtTd2nihpi5eGN From: Eric Blake To: Anand J , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, thuth@redhat.com Message-ID: Subject: Re: [Qemu-devel] [PATCH 1/2] script/clean-includes: added duplicate #include check References: <1476957133-24382-1-git-send-email-anand.indukala@gmail.com> In-Reply-To: <1476957133-24382-1-git-send-email-anand.indukala@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/20/2016 04:52 AM, Anand J wrote: > Added script to check duplicate #include entries. This check will scan > and print the files in which duplicate #include entries are present. Subject line typo: s,script/,scripts/, >=20 > Script might output false positive entries as well. Such entries should= > not be removed. So if it finds any duplicate entries script will > terminate with an exit status 1. Then each and every file should be > checked manually and corrected if necessary. >=20 > In order to enable the check use --check-duphead option with > script/clean-includes. Bike-shedding, but if you are going to put a dash between words, put it between ALL words, as in --check-dup-head. Or spell it out: --check-duplicate-headers. If that feels to long, and you want to abbreviate, then abbreviate further, as in --duphead. >=20 > Reviewed-by: Thomas Huth > Signed-off-by: Anand J > --- > # > +# If --check-duphead option is used, then check for duplicate > +# header files will be enabled. Grammar; I suggest: If --check-duphead is specified, additionally check for duplicate header includes. > +while true > +do > + case $1 in > + "--git") > + if [ $# -eq 1 ]; then > + echo "--git option requires an argument" > + exit 1 > + fi > + GITSUBJ=3D"$2" > + GIT=3Dyes > + shift > + shift > + ;; > + "--check-duphead") > + DUPHEAD=3Dyes > + shift > + ;; > + *) Your option-parsing loop is missing a special case for --; for consistency with POSIX recommendations, you should have: --) shift break ;; *) as a way to end option parsing early (and force the next argument to be treated as a filename, even if it starts with -). > =20 > +if [ "$DUPHEAD" =3D "yes" ]; then > + grep "^#include" $@ | sort | uniq -c | awk '{if ($1 > 1) print $0}= ' Missing quotes around $@. Looking forward to v3. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --0sHh7VR10DnJ8Ivhd2mPtTd2nihpi5eGN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYCM1eAAoJEKeha0olJ0Nq30EH/1EBkRQbQoU6RemZYyeVBA9t kJBcG3ZSPRUip9+mh4oTZDSclEYuyEORU9/MxS9jpAcSaX8lKrgYXYu9KlkUwgwE nW7qPz1/ULaDD1yJfsxwN4PdJrr9HCg/aE0zmQlxYIyuAASdEfkN+Cpa7Q+5U81O 7UQtabL3iBErs91YMdi5q0L4WoFz+oGPNnG+E5qyNh8vzsYF63JfBzz41wmhtMiU ay4a3VvuN10T9+P0zJHlrLdOjNC3RDh8k8IkSDKxr3LvSdptbggeKCl7rORQ5KVt /OjS73XnhEG5QlRjWfW8CJzfYyIShjOFQTsbo/5ESwbBRL5r7Wk0IFw45NFflhE= =JY6g -----END PGP SIGNATURE----- --0sHh7VR10DnJ8Ivhd2mPtTd2nihpi5eGN--