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]
Message-ID: <20240320124207.0c127947@canb.auug.org.au>
Date: Wed, 20 Mar 2024 12:42:07 +1100
From: Stephen Rothwell <sfr@...b.auug.org.au>
To: Barry Song <21cnbao@...il.com>
Cc: corbet@....net, workflows@...r.kernel.org, linux-doc@...r.kernel.org,
 linux-kernel@...r.kernel.org, Barry Song <v-songbaohua@...o.com>, Andrew
 Morton <akpm@...ux-foundation.org>, Chris Zankel <chris@...kel.net>, Huacai
 Chen <chenhuacai@...ngson.cn>, Herbert Xu <herbert@...dor.apana.org.au>,
 Guenter Roeck <linux@...ck-us.net>, Max Filippov <jcmvbkbc@...il.com>
Subject: Re: [PATCH] Documentation: coding-style: ask function-like macros
 to evaluate parameters

Hi Barry,

On Wed, 20 Mar 2024 13:16:56 +1300 Barry Song <21cnbao@...il.com> wrote:
>
> diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
> index 9c7cf7347394..8065747fddff 100644
> --- a/Documentation/process/coding-style.rst
> +++ b/Documentation/process/coding-style.rst
> @@ -827,6 +827,13 @@ Macros with multiple statements should be enclosed in a do - while block:
>  				do_this(b, c);		\
>  		} while (0)
>  
> +Function-like macros should evaluate their parameters, for unused parameters,
> +cast them to void:
> +
> +.. code-block:: c
> +
> +	#define macrofun(a) do { (void) (a); } while (0)
> +

Maybe add some comment about using a static inline function for these
simple versions instead, if at all possible, (it is suggested just
above this section) since that will still type check arguments.

-- 
Cheers,
Stephen Rothwell

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ