latest checkpatch

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andy Whitcroft <apw@...>
Cc: <linux-kernel@...>, Andrew Morton <akpm@...>
Date: Thursday, October 18, 2007 - 7:13 am

latest checkpatch.pl works really well on sched.c.

there's only one problem left, this bogus false positive warning 
reappeared:

  WARNING: braces {} are not necessary for single statement blocks
  #5710: FILE: sched.c:5710:
  +       if (parent->groups == parent->groups->next) {
  +               pflags &= ~(SD_LOAD_BALANCE |
  +                               SD_BALANCE_NEWIDLE |
  +                               SD_BALANCE_FORK |
  +                               SD_BALANCE_EXEC |
  +                               SD_SHARE_CPUPOWER |
  +                               SD_SHARE_PKG_RESOURCES);
  +       }

(there's another place in sched.c that trips this up too.)

i think it has been pointed out numerous times that it is perfectly fine 
to use curly braces for multi-line single-statement blocks. That 
includes simple cases like this too:

	if (x) {
		/* do y() */
		y();
	}

it's perfectly legitimate, in fact more robust. So if checkpatch.pl 
wants to make any noise about such constructs it should warn about the 
_lack_ of curly braces in every multi-line condition block _except_ the 
only safe single-line statement:

	if (x)
		y();

thanks,

	Ingo
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] checkpatch: Fix line number reporting, Mike D. Day, (Fri Oct 12, 3:26 pm)
Re: [PATCH] checkpatch: Fix line number reporting, Andy Whitcroft, (Fri Oct 12, 3:37 pm)
Re: [PATCH] checkpatch: Fix line number reporting , Erez Zadok, (Sat Oct 13, 2:35 pm)
Re: [PATCH] checkpatch: Fix line number reporting, Andy Whitcroft, (Mon Oct 15, 2:21 pm)
Re: [PATCH] checkpatch: Fix line number reporting , Erez Zadok, (Tue Oct 16, 1:59 pm)
Re: [PATCH] checkpatch: Fix line number reporting, Andy Whitcroft, (Wed Oct 17, 12:39 pm)
latest checkpatch, Ingo Molnar, (Thu Oct 18, 7:13 am)
Re: latest checkpatch, Andy Whitcroft, (Thu Oct 18, 3:25 pm)
Re: latest checkpatch, Andy Whitcroft, (Thu Oct 18, 3:43 pm)
Re: latest checkpatch, Ingo Molnar, (Thu Oct 18, 4:00 pm)
Re: latest checkpatch, Ingo Molnar, (Thu Oct 18, 3:39 pm)
Re: latest checkpatch, Ilpo Järvinen, (Fri Oct 19, 5:12 am)
Re: latest checkpatch, Avi Kivity, (Thu Oct 18, 4:02 pm)
Re: latest checkpatch, Andi Kleen, (Thu Oct 18, 7:16 pm)
Re: latest checkpatch, Ingo Molnar, (Thu Oct 18, 4:51 pm)
Re: latest checkpatch, Andy Whitcroft, (Fri Oct 19, 5:01 am)
Re: latest checkpatch, Jeff Garzik, (Thu Oct 18, 4:57 pm)
Re: latest checkpatch, Randy Dunlap, (Thu Oct 18, 6:25 pm)