From patchwork Thu Feb 18 18:05:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 8353421 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7BCD49FC55 for ; Thu, 18 Feb 2016 18:26:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E21CE201C8 for ; Thu, 18 Feb 2016 18:26:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A1FC20375 for ; Thu, 18 Feb 2016 18:26:45 +0000 (UTC) Received: from localhost ([::1]:44195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWTHo-0003ck-Gp for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Feb 2016 13:26:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWTFN-0007ed-C9 for qemu-devel@nongnu.org; Thu, 18 Feb 2016 13:24:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWTFL-00071A-KO for qemu-devel@nongnu.org; Thu, 18 Feb 2016 13:24:13 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:38439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWTFL-0006yz-E5 for qemu-devel@nongnu.org; Thu, 18 Feb 2016 13:24:11 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.84) (envelope-from ) id 1aWSxC-00020C-7y; Thu, 18 Feb 2016 18:05:26 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 18 Feb 2016 18:05:22 +0000 Message-Id: <1455818725-7647-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455818725-7647-1-git-send-email-peter.maydell@linaro.org> References: <1455818725-7647-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::1 Cc: patches@linaro.org Subject: [Qemu-devel] [PATCH 5/8] scripts/clean-includes: Add --all option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a --all option which will run the script on every C source and header file in the repository (except for those in a few directories which contain standalone guest code). Signed-off-by: Peter Maydell Reviewed-by: Eric Blake --- scripts/clean-includes | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/clean-includes b/scripts/clean-includes index 737a5ce..6acf120 100755 --- a/scripts/clean-includes +++ b/scripts/clean-includes @@ -15,11 +15,17 @@ # Usage: # clean-includes [--git subjectprefix] file ... +# or +# clean-includes [--git subjectprefix] --all # # If the --git subjectprefix option is given, then after making # the changes to the files this script will create a git commit # with the subject line "subjectprefix: Clean up includes" # and a boilerplate commit message. +# +# Using --all will cause clean-includes to run on the whole source +# tree (excluding certain directories which are known not to need +# handling). # This script requires Coccinelle to be installed. @@ -40,6 +46,9 @@ GIT=no +# Regular expression defining files to ignore when using --all +XDIRREGEX='^(tests/tcg|tests/multiboot|pc-bios|disas/libvixl)' + if [ $# -ne 0 ] && [ "$1" = "--git" ]; then if [ $# -eq 1 ]; then echo "--git option requires an argument" @@ -52,11 +61,16 @@ if [ $# -ne 0 ] && [ "$1" = "--git" ]; then fi if [ $# -eq 0 ]; then - echo "Usage: clean-includes [--git subjectprefix] foo.c ..." + echo "Usage: clean-includes [--git subjectprefix] [--all | foo.c ...]" echo "(modifies the files in place)" exit 1 fi +if [ "$1" = "--all" ]; then + # We assume there are no files in the tree with spaces in their name + set -- $(git ls-files '*.[ch]' | egrep -v "$XDIRREGEX") +fi + # Annoyingly coccinelle won't read a scriptfile unless its # name ends '.cocci', so write it out to a tempfile with the # right kind of name.