Skip to content

Commit 8af7a50

Browse files
ojedarostedt
authored andcommitted
rust: jump_label: skip formatting generated file
After a source tree build of the kernel, and having used the `RSCPP` rule, running `rustfmt` fails with: error: macros that expand to items must be delimited with braces or followed by a semicolon --> rust/kernel/arch_static_branch_asm.rs:1:27 | 1 | ...ls!("1: jmp " ... ".popsection \n\t") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: change the delimiters to curly braces | 1 | ::kernel::concat_literals!{"1: jmp " ... ".popsection \n\t"} | ~ ~ help: add a semicolon | 1 | ::kernel::concat_literals!("1: jmp " ... ".popsection \n\t"); | + This file is not meant to be formatted nor works on its own since it is meant to be textually included. Thus skip formatting it by prefixing its name with `generated_`. Cc: Masami Hiramatsu <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Gary Guo <[email protected]> Cc: Björn Roy Baron <[email protected]> Cc: Benno Lossin <[email protected]> Cc: Andreas Hindborg <[email protected]> Cc: Alice Ryhl <[email protected]> Cc: Trevor Gross <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: 169484a ("rust: add arch_static_branch") Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 7643155 commit 8af7a50

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

rust/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.c
3636
obj-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.o
3737
obj-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.o
3838

39-
always-$(subst y,$(CONFIG_RUST),$(CONFIG_JUMP_LABEL)) += kernel/arch_static_branch_asm.rs
39+
always-$(subst y,$(CONFIG_RUST),$(CONFIG_JUMP_LABEL)) += kernel/generated_arch_static_branch_asm.rs
4040

4141
# Avoids running `$(RUSTC)` for the sysroot when it may not be available.
4242
ifdef CONFIG_RUST
@@ -427,7 +427,7 @@ $(obj)/kernel.o: $(src)/kernel/lib.rs $(obj)/alloc.o $(obj)/build_error.o \
427427
+$(call if_changed_rule,rustc_library)
428428

429429
ifdef CONFIG_JUMP_LABEL
430-
$(obj)/kernel.o: $(obj)/kernel/arch_static_branch_asm.rs
430+
$(obj)/kernel.o: $(obj)/kernel/generated_arch_static_branch_asm.rs
431431
endif
432432

433433
endif # CONFIG_RUST

rust/kernel/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3-
/arch_static_branch_asm.rs
3+
/generated_arch_static_branch_asm.rs

rust/kernel/jump_label.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub use static_branch_unlikely;
3939
#[cfg(CONFIG_JUMP_LABEL)]
4040
const _: &str = include!(concat!(
4141
env!("OBJTREE"),
42-
"/rust/kernel/arch_static_branch_asm.rs"
42+
"/rust/kernel/generated_arch_static_branch_asm.rs"
4343
));
4444

4545
#[macro_export]
@@ -48,7 +48,7 @@ const _: &str = include!(concat!(
4848
macro_rules! arch_static_branch {
4949
($key:path, $keytyp:ty, $field:ident, $branch:expr) => {'my_label: {
5050
$crate::asm!(
51-
include!(concat!(env!("OBJTREE"), "/rust/kernel/arch_static_branch_asm.rs"));
51+
include!(concat!(env!("OBJTREE"), "/rust/kernel/generated_arch_static_branch_asm.rs"));
5252
l_yes = label {
5353
break 'my_label true;
5454
},

0 commit comments

Comments
 (0)