From patchwork Mon Aug 3 13:57:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 1340320 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VSO8MnHW; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BKzx60sLBz9sTX for ; Mon, 3 Aug 2020 23:58:01 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E34AD85247; Mon, 3 Aug 2020 13:57:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S6Xkk702Ejdf; Mon, 3 Aug 2020 13:57:59 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4E5C785108; Mon, 3 Aug 2020 13:57:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3ED07C0051; Mon, 3 Aug 2020 13:57:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 69B8EC004C for ; Mon, 3 Aug 2020 13:57:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5BF7120110 for ; Mon, 3 Aug 2020 13:57:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6yXjeaBnpxPC for ; Mon, 3 Aug 2020 13:57:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by silver.osuosl.org (Postfix) with ESMTPS id 58F732010A for ; Mon, 3 Aug 2020 13:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596463074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9H7RMp3+J4hXDH0xwl4aAfz+lIxhqf+N/Gt+OU9Wr/k=; b=VSO8MnHWcqFFJGrg6tA3uVCcbx9k8jddpnBttKkxFXDbkvDMGrTyHDohmODfxFjxw6CXFx E/xH9oN2xrP/UXnO+2hj2IdKnw/M8jE0O5unOrlZVH696b3P9Rl9R6+OWrodvSHPVXWwlL DnEFvVXIeOP3matNcAKST88sapDLjNY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-96-C3TK_tgHM-WDo0dQRk1WsQ-1; Mon, 03 Aug 2020 09:57:50 -0400 X-MC-Unique: C3TK_tgHM-WDo0dQRk1WsQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49F7C101C8B4; Mon, 3 Aug 2020 13:57:49 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-117-20.rdu2.redhat.com [10.10.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C90A51001B2B; Mon, 3 Aug 2020 13:57:48 +0000 (UTC) From: Aaron Conole To: dev@openvswitch.org References: <20200731025514.1669061-5-toshiaki.makita1@gmail.com> <20200731040711.6114-1-robot@bytheb.org> <9c115f0a-b972-1cd7-8712-444a70c54e4e@gmail.com> Date: Mon, 03 Aug 2020 09:57:46 -0400 In-Reply-To: <9c115f0a-b972-1cd7-8712-444a70c54e4e@gmail.com> (Toshiaki Makita's message of "Sat, 1 Aug 2020 14:44:55 +0900") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=aconole@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Ilya Maximets Subject: [ovs-dev] [PATCH] checkpatch: Ignore macro definitions of FOR_EACH X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When defining a FOR_EACH macro, checkpatch freaks out and generates a control block whitespace error. Create an exception so that it doesn't generate errors for this case. Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2020-August/373509.html Reported-by: Toshiaki Makita Signed-off-by: Aaron Conole --- --- diff --git a/tests/checkpatch.at b/tests/checkpatch.at index 6c73947722..042090a0f6 100755 --- a/tests/checkpatch.at +++ b/tests/checkpatch.at @@ -284,6 +284,11 @@ try_checkpatch \ + for (init; condition; increment) { \\ " +try_checkpatch \ + "COMMON_PATCH_HEADER + +#define SOME_FOR_EACH(a, b, c) /* Foo. */ + " + AT_CLEANUP diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 7f1d21a40e..abe76ff3ba 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -156,6 +156,8 @@ __regex_leading_with_whitespace_at_all = re.compile(r'^\s+') __regex_leading_with_spaces = re.compile(r'^ +[\S]+') __regex_trailing_whitespace = re.compile(r'[^\S]+$') __regex_single_line_feed = re.compile(r'^\f$') +__regex_hash_define_for_each = re.compile( + r'#define [_A-Z]+FOR_*EACH[_A-Z0-9]*\(') __regex_for_if_missing_whitespace = re.compile(r' +(%s)[\(]' % __parenthesized_constructs) __regex_for_if_too_much_whitespace = re.compile(r' +(%s) +[\(]' @@ -245,6 +247,10 @@ def if_and_for_whitespace_checks(line): """ if skip_block_whitespace_check: return True + + if (__regex_hash_define_for_each.search(line) is not None): + return True + if (__regex_for_if_missing_whitespace.search(line) is not None or __regex_for_if_too_much_whitespace.search(line) is not None or __regex_for_if_parens_whitespace.search(line)):