Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752061AbdDCIIz (ORCPT ); Mon, 3 Apr 2017 04:08:55 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:30752 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751933AbdDCIIl (ORCPT ); Mon, 3 Apr 2017 04:08:41 -0400 From: Hugues Fruchet To: Andy Whitcroft , Joe Perches CC: Subject: [PATCH v1] checkpatch: test missing initial blank line in block comment Date: Mon, 3 Apr 2017 10:08:15 +0200 Message-ID: <1491206895-24332-2-git-send-email-hugues.fruchet@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491206895-24332-1-git-send-email-hugues.fruchet@st.com> References: <1491206895-24332-1-git-send-email-hugues.fruchet@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.73] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-03_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1248 Lines: 45 Warn when block comments are not starting with blank comment: /* multiple lines * block comment, * => warning */ /* * multiple lines * block comment, * => no warning */ Exception made for networking files where rule is the exact opposite. Signed-off-by: Hugues Fruchet --- scripts/checkpatch.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index baa3c7b..8754c9d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3000,6 +3000,17 @@ sub process { "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev); } +# Block comment styles +# Missing initial /* + if ($realfile !~ m@^(drivers/net/|net/)@ && #networking exception + $prevrawline =~ /^\+[ \t]\/\**.+[ \t]/ && #start with /*... + $prevrawline !~ /^\+.*\/\*.*\*\/[ \t]*/ && #no inline /*...*/ + $rawline =~ /^\+[ \t]*\*/ && + $realline > 2) { + WARN("BLOCK_COMMENT_STYLE", + "Block comments starts with an empty /*\n" . $hereprev); + } + # Block comments use * on subsequent lines if ($prevline =~ /$;[ \t]*$/ && #ends in comment $prevrawline =~ /^\+.*?\/\*/ && #starting /* -- 1.9.1