mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Spurious warning in checkpatch.pl?
@ 2012-10-12 18:23 Larry Finger
  2012-10-12 18:38 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Larry Finger @ 2012-10-12 18:23 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: LKML

Andy,

The checkpatch.pl version in mainline is issuing what I think are false warnings 
of the type

WARNING: networking block comments put the trailing */ on a separate line
#93: FILE: drivers/net/wireless/rtlwifi/wifi.h:208:
+       u32 rf_rb;              /* rflssi_readback */

Is a trailing comment for the member of a struct not allowed?

Thanks,

Larry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Spurious warning in checkpatch.pl?
  2012-10-12 18:23 Spurious warning in checkpatch.pl? Larry Finger
@ 2012-10-12 18:38 ` Joe Perches
  2012-10-12 19:49   ` Larry Finger
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2012-10-12 18:38 UTC (permalink / raw)
  To: Larry Finger; +Cc: Andy Whitcroft, LKML

On Fri, 2012-10-12 at 13:23 -0500, Larry Finger wrote:
> Andy,
> 
> The checkpatch.pl version in mainline is issuing what I think are false warnings 
> of the type
> 
> WARNING: networking block comments put the trailing */ on a separate line
> #93: FILE: drivers/net/wireless/rtlwifi/wifi.h:208:
> +       u32 rf_rb;              /* rflssi_readback */
> 
> Is a trailing comment for the member of a struct not allowed?

It's allowed.  Maybe even better, encouraged.

It's a change I made in commit 058806007450
("checkpatch: check networking specific block comment style")
without sufficient testing.

I'll see about fixing it.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Spurious warning in checkpatch.pl?
  2012-10-12 18:38 ` Joe Perches
@ 2012-10-12 19:49   ` Larry Finger
  2012-10-12 20:01     ` Joe Perches
  2012-10-14 19:35     ` [PATCH] checkpatch: Improve network block comment style checking Joe Perches
  0 siblings, 2 replies; 5+ messages in thread
From: Larry Finger @ 2012-10-12 19:49 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andy Whitcroft, LKML

On 10/12/2012 01:38 PM, Joe Perches wrote:
> On Fri, 2012-10-12 at 13:23 -0500, Larry Finger wrote:
>> Andy,
>>
>> The checkpatch.pl version in mainline is issuing what I think are false warnings
>> of the type
>>
>> WARNING: networking block comments put the trailing */ on a separate line
>> #93: FILE: drivers/net/wireless/rtlwifi/wifi.h:208:
>> +       u32 rf_rb;              /* rflssi_readback */
>>
>> Is a trailing comment for the member of a struct not allowed?
>
> It's allowed.  Maybe even better, encouraged.
>
> It's a change I made in commit 058806007450
> ("checkpatch: check networking specific block comment style")
> without sufficient testing.
>
> I'll see about fixing it.

Joe,

Good. I will ignore those warnings.

One more question. Was the warning below intended?

WARNING: networking block comments put the trailing */ on a separate line
#1846: FILE: drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.h:27:
+ *****************************************************************************/

To me, that line at the end of a copyright block looks better then


  ****************************************************************************
  */

Larry




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Spurious warning in checkpatch.pl?
  2012-10-12 19:49   ` Larry Finger
@ 2012-10-12 20:01     ` Joe Perches
  2012-10-14 19:35     ` [PATCH] checkpatch: Improve network block comment style checking Joe Perches
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2012-10-12 20:01 UTC (permalink / raw)
  To: Larry Finger; +Cc: Andy Whitcroft, LKML

On Fri, 2012-10-12 at 14:49 -0500, Larry Finger wrote:
> One more question. Was the warning below intended?
> 
> WARNING: networking block comments put the trailing */ on a separate line
> #1846: FILE: drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.h:27:
> + *****************************************************************************/
> 
> To me, that line at the end of a copyright block looks better then
> 
> 
>   ****************************************************************************
>   */

No, not really.  It's a side effect of the nominal block comment
style that networking uses.

Maybe it could be improved by ignoring lines that end in "**/"
(\*\*\/\s*$) too.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] checkpatch: Improve network block comment style checking
  2012-10-12 19:49   ` Larry Finger
  2012-10-12 20:01     ` Joe Perches
@ 2012-10-14 19:35     ` Joe Perches
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2012-10-14 19:35 UTC (permalink / raw)
  To: Larry Finger, Andrew Morton; +Cc: Andy Whitcroft, LKML, netdev

Some comment styles in net and drivers/net are flagged inappropriately.

Avoid proclaiming inline comments like:
	int a = b;	/* some comment */
and block comments like:
	/*********************
	 * some comment
	 ********************/
are defective.

Tested with
$ cat drivers/net/t.c
/* foo */

/*
 * foo
 */

/* foo
 */

/* foo
 * bar */

/****************************
 * some long block comment
 ***************************/

struct foo {
	int bar;	/* another test */
};
$

Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 21a9f5d..f18750e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1890,8 +1890,10 @@ sub process {
 		}
 
 		if ($realfile =~ m@^(drivers/net/|net/)@ &&
-		    $rawline !~ m@^\+[ \t]*(\/\*|\*\/)@ &&
-		    $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) {
+		    $rawline !~ m@^\+[ \t]*\*/[ \t]*$@ &&	#trailing */
+		    $rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ &&	#inline /*...*/
+		    $rawline !~ m@^\+.*\*{2,}/[ \t]*$@ &&	#trailing **/
+		    $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) {	#non blank */
 			WARN("NETWORKING_BLOCK_COMMENT_STYLE",
 			     "networking block comments put the trailing */ on a separate line\n" . $herecurr);
 		}



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-14 19:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-12 18:23 Spurious warning in checkpatch.pl? Larry Finger
2012-10-12 18:38 ` Joe Perches
2012-10-12 19:49   ` Larry Finger
2012-10-12 20:01     ` Joe Perches
2012-10-14 19:35     ` [PATCH] checkpatch: Improve network block comment style checking Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®