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: <CANiq72mbTqu8KuKn1uKM8czesrg+or-S3K9e_ohJz1b6kzdffw@mail.gmail.com>
Date: Thu, 14 Aug 2025 20:49:00 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Areej Hamid <areejhamid8560@...il.com>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org, 
	ojeda@...nel.org, alex.gaynor@...il.com, boqun.feng@...il.com, 
	gary@...yguo.net, bjorn3_gh@...tonmail.com, lossin@...nel.org, 
	a.hindborg@...aro.org, aliceryhl@...gle.com, tmgross@...ch.edu, 
	dakr@...nel.org, viresh.kumar@...aro.org, tamird@...il.com, 
	dingxiangfei2009@...il.com, gregkh@...uxfoundation.org, 
	thomas.weissschuh@...ain.com
Subject: Re: [PATCH v2] rust: lib: add if_cfg! macro for conditional compilation

On Thu, Aug 14, 2025 at 6:25 PM Areej Hamid <areejhamid8560@...il.com> wrote:
>
> +/// # Key difference from `cfg!()`

Please add an empty docs line after headers. Also before opening examples below.

> +/// - `cfg!()` evaluates a configuration flag at compile time, but both branches must be valid Rust code

Please use intra-doc links wherever they may work. Also please end
sentences with a period in docs and comments.

> +/// - `if_cfg!()` compiles only the active branch, so the inactive branch can reference
> +///   functions, types, or constants that may not exist under certain configurations

Perhaps we could say "... branch can, for instance, reference ...", or
that it is not type checked in general, i.e. more things than
undefined items are allowed.

> +/// // FOR CONFIG_64BIT

I would skip this line.

By the way, Tamir suggested in the linked Rust for Linux issue to
match the name of the upstream one in case we want to migrate to the
standard library one eventually. In the commit message, I would also
mention this and link to the tracking issue that Trevor mentioned:
https://github.com/rust-lang/rust/issues/115585.

Finally, we may want to consider putting this into somewhere else,
rather than the root file of the crate.

Cheers,
Miguel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ