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] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 08 Apr 2017 10:33:19 -0700
From:   Joe Perches <joe@...ches.com>
To:     Alfonso Lima <alfonsolimaastor@...il.com>, apw@...onical.com
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [bug report] checkpatch: if statement does not need to be
 enclosed in parentheses

On Sat, 2017-04-08 at 17:07 +0100, Alfonso Lima wrote:
> Hi,
> 
> In current linux-next, if you run the script on this piece of
> code:
> 
> #define FOO(a)				\
> 	if (a) {			\
> 		something();		\
> 		something_else();	\
> 	}
> 
> You should get:
> 
> ERROR: Macros with complex values should be enclosed in parentheses
> #1: FILE: foo.c:1:
> +#define FOO(a)				\
> +	if (a) {			\
> +		something();		\
> +		something_else();	\
> +	}
> 
> We could silence checkpatch.pl using "do {} while ()" around the
> if statement. However, the "if () {}" statement should be
> enough. If someone could confirm this, I'll go and fix it.

Multiple if/else use is the reason do {} while (0) is suggested.

	if (bar())
		FOO(a);
	else
		baz(b);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ