From 81850164260b6ae52016bf3bdc439e398f31c230 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 26 Dec 2024 07:54:41 +0100 Subject: [PATCH] docs: relax target cfg's to show all architectures in docs --- oro-arch-aarch64/src/lib.rs | 2 +- oro-arch-x86_64/src/lib.rs | 2 +- oro-boot/src/target/mod.rs | 5 +++++ oro-dbgutil/src/lib.rs | 2 +- oro-debug-uart16550/src/lib.rs | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/oro-arch-aarch64/src/lib.rs b/oro-arch-aarch64/src/lib.rs index f8c0fef..813f683 100644 --- a/oro-arch-aarch64/src/lib.rs +++ b/oro-arch-aarch64/src/lib.rs @@ -22,7 +22,7 @@ //! preboot environment, as the preboot environment MUST NOT rely on TTBR0 for any resource //! allocation or mapping. #![no_std] -#![cfg(not(all(doc, not(target_arch = "aarch64"))))] +#![cfg(any(doc, target_arch = "aarch64"))] #![expect(internal_features)] #![feature(core_intrinsics)] // SAFETY(qix-): It's probably accepted, and I want to refactor the diff --git a/oro-arch-x86_64/src/lib.rs b/oro-arch-x86_64/src/lib.rs index c2fc009..9591c0e 100644 --- a/oro-arch-x86_64/src/lib.rs +++ b/oro-arch-x86_64/src/lib.rs @@ -48,7 +48,7 @@ //! once it has booted. #![no_std] #![expect(internal_features)] -#![cfg(not(all(doc, not(target_arch = "x86_64"))))] +#![cfg(any(doc, target_arch = "x86_64"))] #![feature(naked_functions, core_intrinsics)] // SAFETY(qix-): This is accepted, but moving slowly (in fact, probably the slowest // SAFETY(qix-): I've seen - predates Rust 1.0). It simplifies the amount of `#[allow]` diff --git a/oro-boot/src/target/mod.rs b/oro-boot/src/target/mod.rs index f9d54cd..d0c86cf 100644 --- a/oro-boot/src/target/mod.rs +++ b/oro-boot/src/target/mod.rs @@ -8,6 +8,11 @@ // NOTE(qix-): on archs instead of the current method, but this is the // NOTE(qix-): simplest way to do it for now. +// NOTE(qix-): Documenting this with `#[cfg(any(doc, ...))]` doesn't work +// NOTE(qix-): since 1) --cfg doc isn't passed to dependencies, and +// NOTE(qix-): 2) we're exporting the same symbol names based on the arch, +// NOTE(qix-): which causes naming conflicts when generating multi-arch docs. + #[cfg(target_arch = "aarch64")] mod aarch64; #[cfg(target_arch = "x86_64")] diff --git a/oro-dbgutil/src/lib.rs b/oro-dbgutil/src/lib.rs index b9bf611..f0b24ab 100644 --- a/oro-dbgutil/src/lib.rs +++ b/oro-dbgutil/src/lib.rs @@ -31,7 +31,7 @@ pub extern "C" fn __oro_dbgutil_kernel_will_transfer() { /// `PAR_EL1`. /// /// Pass the virtual address to translate in `x0`. -#[cfg(target_arch = "aarch64")] +#[cfg(any(doc, target_arch = "aarch64"))] #[link_section = ".text.force_keep"] #[no_mangle] #[naked] diff --git a/oro-debug-uart16550/src/lib.rs b/oro-debug-uart16550/src/lib.rs index 2ce1a68..ce73cc1 100644 --- a/oro-debug-uart16550/src/lib.rs +++ b/oro-debug-uart16550/src/lib.rs @@ -1,6 +1,6 @@ //! Early-stage debugging support for the 16550 UART on x86_64 #![cfg_attr(not(test), no_std)] -#![cfg(target_arch = "x86_64")] +#![cfg(any(doc, target_arch = "x86_64"))] #![cfg_attr(doc, feature(doc_cfg, doc_auto_cfg))] use core::fmt::{self, Write};