mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Chris Metcalf <cmetcalf@tilera.com>
Cc: Kautuk Consul <consul.kautuk@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: CodingStyle vs checkpatch for block comments
Date: Tue, 03 Apr 2012 10:41:47 -0700	[thread overview]
Message-ID: <1333474907.26079.57.camel@joe2Laptop> (raw)
In-Reply-To: <4F7B32A0.1020009@tilera.com>

On Tue, 2012-04-03 at 13:25 -0400, Chris Metcalf wrote:
> (Adding linux-kernel to the cc's and restating the question...)
> 
> I accepted a patch from Kautuk Consul and adjusted his comment style, but
> he pointed out that he had changed his comment style based on a warning

It's a check not a warning.

> from checkpatch.
> 
> The Documentation/CodingStyle file says:
> 
>     The preferred style for long (multi-line) comments is:
> 
>        /*
>         * This is the preferred style for multi-line
>         * comments in the Linux kernel source code.
>         * Please use it consistently.
>         *
>         * Description:  A column of asterisks on the left side,
>         * with beginning and ending almost-blank lines.
>         */
> 
> However, a new change to "checkpatch --strict" by Joe Perches, commit
> aad4f61498, causes this construct to be flagged as a warning

checkpatch flags it with a "check" only when --strict
is on the checkpatch command line.

>  if (and only
> if) it is preceded by a blank line.  Joe said the change was to support
> David Miller's preferred style, but that he didn't much care one way or
> another.

I think the block comment style is less important than
the actual content of the block comment.  The actual
comment content is rather difficult for checkpatch to
parse though.

> The relevant code in checkpatch.pl is:
> 
>                 if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
>                     $prevrawline =~ /^\+[ \t]*$/) {
>                         CHK("BLOCK_COMMENT_STYLE",
>                             "Don't begin block comments with only a /*
> line, use /* comment...\n" . $hereprev);
>                 }
> 
> So, my questions -
> 
> 1. I'm not sure what the regexps are really trying to avoid.  Presumably a
> blank line followed by a block comment is OK?  Certainly the kernel sources
> are full of this construct.

It emits a check message on
<blank line>
	/*

but not
<blank line>
	/* some actual comment

> 2. The actual warning message emitted seems to directly contradict the
> CodingStyle document, so presumably we should either clarify the message,
> or update CodingStyle if we're really trying to change the style.

Or just remove it or add a test for the patched file
to be in net/... or drivers/net... or something.


  reply	other threads:[~2012-04-03 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-31 12:05 [PATCH 15/19 v2] tile/mm/fault.c: Port OOM changes to handle_page_fault Kautuk Consul
2012-04-03 16:11 ` Chris Metcalf
     [not found]   ` <CAFPAmTTfYKT39gdoKT3P4G2O0xkTSS8g62kKudeLcnpdipzJqg@mail.gmail.com>
     [not found]     ` <4F7B21FB.3040609@tilera.com>
     [not found]       ` <CAFPAmTS_2H7BzGndcceBxdnJroy82u++sduCPO2+qxG6-WA=nw@mail.gmail.com>
     [not found]         ` <4F7B2766.9080208@tilera.com>
     [not found]           ` <1333471474.26079.43.camel@joe2Laptop>
     [not found]             ` <4F7B2AA7.5010906@tilera.com>
     [not found]               ` <1333472391.26079.47.camel@joe2Laptop>
2012-04-03 17:25                 ` CodingStyle vs checkpatch for block comments Chris Metcalf
2012-04-03 17:41                   ` Joe Perches [this message]
2012-04-03 18:08                     ` Chris Metcalf
2012-04-03 18:16                       ` Joe Perches
2012-04-03 18:27                         ` Chris Metcalf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1333474907.26079.57.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=cmetcalf@tilera.com \
    --cc=consul.kautuk@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome