From patchwork Thu Oct 26 04:50:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 117167 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp339523qgn; Wed, 25 Oct 2017 21:54:48 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RvR73xlbYfPR8xUBX+VHmPFh/aGrKttuNcTWOYTqmJ5+2oSrV0go/t4rMAZI9AGTKb0d4N X-Received: by 10.98.233.20 with SMTP id j20mr4251849pfh.281.1508993688262; Wed, 25 Oct 2017 21:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508993688; cv=none; d=google.com; s=arc-20160816; b=NiQpcR1n0+deQZYXiUIS0diHG1p6oA8RwpNGNt52OrZyaiEpMwOdDeApaJfYQQ0j5Q BmatPFlxR43T7xZcqmmTA1XTfMf0VmvP9KT8CtkOlWrXKTbrjJrn1R2MIudwRDNGOteh RssfvFbnFclfvU2QdkMYYD30Sfr+5V4L2QMRETQgqbAUjCzYU1sGHaagE3bFBfyvX7EH mILK81CxmYUqeEHUWWYDBZx7dTTR1dL72Ql7tGYz6PvqX2YKb4yG00SBcZD7ffTnvxN9 Fn9s4UvNPoK16FLEfCn5m9e1f073r8h7X87hP1TahbouvKA/mMjK+lVGALLrjcQzi/2a 2FeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=7Abg60czMETo8Do/yt7AOWymPc9zya17DdFg72whlrE=; b=GkwuqVEoUKOzOGQgJLQRT+GoFWh9RaD8s77AvbggX2kd55Qtt5U30RpuH4jPWPZNBI Q75rxlrNA16dScEXnmSm0ODZA7TVj5JBWjUSWobNnzdHX7UtQ66gRMRhx0XoFEXdvqP8 yCglidnTmoB0VJq6QBPP0VLpBOTbZCC7ipKBjnw/YU0iGIiML9KRMn32G/2T5Bfo261C 8ZNNwIr6ptfe5NmXlD0XY60MBmueP4PFfRN5ZALut7uxSPQGr0cSZI0QMdMAP+xHYNxr SiJboBSuFhFMjEqaC6/dMoQqzCkHIj83hoPmTg6ZWz0nyLM9JgfTglWp36+e60ybPTmh 6bnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=crdq4O5R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si2493413plk.144.2017.10.25.21.54.47; Wed, 25 Oct 2017 21:54:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=crdq4O5R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752043AbdJZEyq (ORCPT + 27 others); Thu, 26 Oct 2017 00:54:46 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:28637 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbdJZEyn (ORCPT ); Thu, 26 Oct 2017 00:54:43 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id v9Q4rcx8002361; Thu, 26 Oct 2017 13:53:38 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v9Q4rcx8002361 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1508993618; bh=7Abg60czMETo8Do/yt7AOWymPc9zya17DdFg72whlrE=; h=From:To:Cc:Subject:Date:From; b=crdq4O5RUiRrwtLMZPhNBJj/A9AW8eqrz61u1x0ts3yggDkUg7tCeHoKksqcNS1j+ JDGKu1ouSSsviOMo0Vd45GYYuz8N72nYuO0a/j9cXDfvksqkv071MNjollj+kn3sR7 onz4T3rjhZNldotVjBJaBqu1DIk3A5i3zvgo7idmn3qiFtQWIL0W+0gxgBXUS1JW7e J5BMqq+NVBtfVyvwP7ui+IYzFmwPyNW11YHAtNTFBe1A3bpGjayfyYizABmaVTxV7o ibW1fpDsCrfZw7zncn8xYztKtUv6S6gNNsv2+P5eex9L+jNu82pQ55epK6yMwk8ur6 3tA6eTl6lh7Sg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: cocci@systeme.lip6.fr, linux-kbuild@vger.kernel.org, Julia Lawall Cc: Masahiro Yamada , Nicolas Palix , linux-kernel@vger.kernel.org, Gilles Muller , Michal Marek Subject: [PATCH] coccinelle: grep Options and Requires fields more precisely Date: Thu, 26 Oct 2017 13:50:38 +0900 Message-Id: <1508993438-15325-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the required version for badzero.cocci is picked up from its "Comments:" line since it contains the word "Requires". Surprisingly, ld-version.sh can extract the version number from the string "Requires Coccinelle version 1.0.0-rc20 or later", but this expectation is fragile. Fix the .cocci file. I removed "-rc20" because ld-version.sh cannot handle it. Make the coccicheck script to see exact patterns for "Options:" and "Requires:" in order to avoid accidental matching to what just happens to appear in comment lines. Signed-off-by: Masahiro Yamada --- scripts/coccicheck | 4 ++-- scripts/coccinelle/null/badzero.cocci | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 Acked-by: Julia Lawall Acked-by: Nicolas Palix diff --git a/scripts/coccicheck b/scripts/coccicheck index 3e21a1b..1bfa2d2 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -168,8 +168,8 @@ OPTIONS="$OPTIONS $SPFLAGS" coccinelle () { COCCI="$1" - OPT=`grep "Option" $COCCI | cut -d':' -f2` - REQ=`grep "Requires" $COCCI | cut -d':' -f2 | sed "s| ||"` + OPT=`grep "Options:" $COCCI | cut -d':' -f2` + REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"` REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh) if [ "$REQ_NUM" != "0" ] ; then if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then diff --git a/scripts/coccinelle/null/badzero.cocci b/scripts/coccinelle/null/badzero.cocci index 5551da2..f597c80 100644 --- a/scripts/coccinelle/null/badzero.cocci +++ b/scripts/coccinelle/null/badzero.cocci @@ -10,7 +10,7 @@ // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ -// Comments: Requires Coccinelle version 1.0.0-rc20 or later +// Requires: 1.0.0 // Options: virtual patch