From patchwork Fri Mar 11 15:26:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 8566391 Return-Path: X-Original-To: patchwork-intel-gfx@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 0B7019F38C for ; Fri, 11 Mar 2016 15:27:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 258922034C for ; Fri, 11 Mar 2016 15:27:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 16CD42026D for ; Fri, 11 Mar 2016 15:27:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C0F686E2C0; Fri, 11 Mar 2016 15:26:58 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D6E46E2C0 for ; Fri, 11 Mar 2016 15:26:56 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 11 Mar 2016 07:26:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,321,1455004800"; d="scan'208";a="762394054" Received: from tursulin-linux.isw.intel.com ([10.102.226.196]) by orsmga003.jf.intel.com with ESMTP; 11 Mar 2016 07:26:54 -0800 From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Fri, 11 Mar 2016 15:26:52 +0000 Message-Id: <1457710012-12589-1-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Intel-gfx] [PATCH] dim: Avoid false positives with BUG detection X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,HK_RANDOM_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 From: Tvrtko Ursulin Makes sure that the diff line adding the BUG is not immediately preceded by the diff line removing the BUG. Or in other words, avoids false positives when existing BUG is edited. Signed-off-by: Tvrtko Ursulin --- dim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dim b/dim index 1e7622a1e902..e32b24988571 100755 --- a/dim +++ b/dim @@ -691,7 +691,8 @@ function shell_checkpatch local cmd=$1 $cmd | scripts/checkpatch.pl -q --strict - || true - if $cmd | grep '^\+.*\WBUG' > /dev/null; then + local bug_lines=$("$cmd" | grep -m 1 -B 1 '^\+.*\WBUG' | grep -c '^[+-]') + if test "$bug_lines" -eq 1; then warn_or_fail "New BUG macro added" fi $cmd | grep '^\+.*drm_i915_private_t' > /dev/null && echo "WARNING: New drm_i915_private_t added" || true