lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8ee5b1f0eaec9c71066027e4e130d473fe6532d7.camel@perches.com>
Date:   Thu, 10 Dec 2020 05:40:35 -0800
From:   Joe Perches <joe@...ches.com>
To:     David Laight <David.Laight@...LAB.COM>,
        Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>
Subject: Re: checkpatch

On Thu, 2020-12-10 at 09:34 +0000, David Laight wrote:
> From: Joe Perches
> > Sent: 10 December 2020 05:26
> > 
> > On Wed, 2020-12-09 at 19:13 +0100, Thomas Gleixner wrote:
> > > Joe,
> > 
> > Hi Thomas.
> > 
> > > the below made it through my filters for some reason so I actually
> > > looked and immediately wondered why checkpatch.pl did not identify this
> > > as pure garbage.
> > > 
> > >  Original mail is here: lore.kernel.org/r/69cb540a-09d5-4956-b062-071ccded7090@....de
> > > 
> > > Can you have a look please? Adding brackets in the middle of the code
> > > for absolutely no reason is wrong to begin with and then not indenting
> > > the enclosed code makes it even worse.
> > 
> > Well, maybe something like this, but there are probably some
> > drawbacks with initializations.
> 
> Isn't the other likely problem where an extra code block
> is being squeezed in after a case label without generating
> a double-indent.

Probably not.

A common form for a case label with a brace is like the below
where the code is indented.  There aren't many uses where the
code for the case is at the same indent level as the case.

	case foo:
	{
		definitions;
		code;
		break;
	}

Another puts the break at the same indent as the case.

	case foo:
	{
		definitions;
		code;
	}
	break;

The other form that's used with case statements have the brace
on the line with the case:

	case foo: {
		definitions;
		code;
		break;
	}

There are some uses where the open brace is on a separate
line like the below, but checkpatch already emits a message
like "open brace should be on the previous line" for it.
Now another message will be emitted for the open brace.

	switch (foo)
	{
	case bar:



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ