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: <2e62c38c-cd2e-4aa6-af43-2b8e77c09b78@intel.com>
Date: Thu, 29 May 2025 19:29:42 -0700
From: Sohil Mehta <sohil.mehta@...el.com>
To: Ingo Molnar <mingo@...nel.org>
CC: Dietmar Eggemann <dietmar.eggemann@....com>, Linus Torvalds
	<torvalds@...ux-foundation.org>, Peter Zijlstra <peterz@...radead.org>,
	Shrikanth Hegde <sshegde@...ux.ibm.com>, Thomas Gleixner
	<tglx@...utronix.de>, Valentin Schneider <vschneid@...hat.com>, "Steven
 Rostedt" <rostedt@...dmis.org>, Mel Gorman <mgorman@...e.de>, Vincent Guittot
	<vincent.guittot@...aro.org>, Sebastian Andrzej Siewior
	<bigeasy@...utronix.de>, Juri Lelli <juri.lelli@...hat.com>, "LKML Mailing
 List" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 01/43] sched: Clean up and standardize #if/#else/#endif
 markers in sched/autogroup.[ch]

On 5/28/2025 1:08 AM, Ingo Molnar wrote:
>  - Use the standard #ifdef marker format for larger blocks,
>    where appropriate:
> 
>         #if CONFIG_FOO
>         ...
>         #else /* !CONFIG_FOO: */

I am trying to understand if this #else comment style is a standard in
the kernel? Any documentation link?

The comment next to the #else could relate to ending of the previous
section or related to beginning of the next section. I see 3 formats
commonly used:

1) #else /* CONFIG_FOO */

  $ grep -Pr '^(?=.*#else)(?=.*\/\*)(?=.*CONFIG_)(?!.*!)(?!.*:).*$' .

  Count: 1122

2) #else /* !CONFIG_FOO */

  $ grep -Pr '^(?=.*#else)(?=.*\/\*)(?=.*CONFIG_)(?=.*!)(?!.*:).*$' .

  Count: 642

3) #else /* !CONFIG_FOO: */

  $ grep -Pr '^(?=.*#else)(?=.*\/\*)(?=.*CONFIG_)(?=.*!)(?=.*:).*$'

  Count: 43

Even though the counts do not account for the #ifndef cases, they
provide a rough approximation of the kernel usage. #1 and #2 already
conflict with each other. I feel adding more to the 3rd type would
probably make it more confusing for readers and developers.

I am assuming that the ':' at the end is to signify that the comment
pertains to the beginning of the following section. If we want to
standardize #3 wouldn't it be better to first converge between #1 and #2?


>         ...
>         #endif /* !CONFIG_FOO */
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ