Skip to content

Commit 3f751ad

Browse files
Makefile: add UNSAFE_BLOCKS parameter
`make clippy UNSAFE_BLOCKS=1` will enable `clippy::undocumented_unsafe_blocks` warnings. This can help the effort to reduce them. If it's set we remove `-D warnings` since `clippy` will exit after checking the first module that contains them. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
1 parent 3ed4005 commit 3f751ad

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ ifneq ($(FEATURES_TEST),)
99
SVSM_ARGS_TEST += --features ${FEATURES_TEST}
1010
endif
1111

12+
CLIPPY_ARGS ?= -D warnings
13+
ifdef UNSAFE_BLOCKS
14+
CLIPPY_ARGS = -W clippy::undocumented_unsafe_blocks
15+
endif
16+
1217
ifdef RELEASE
1318
TARGET_PATH=release
1419
CARGO_ARGS += --release
@@ -184,11 +189,11 @@ bin/svsm-test.bin: bin/svsm-test
184189
objcopy -O binary $< $@
185190

186191
clippy:
187-
cargo clippy --all-features --workspace --exclude svsm --exclude stage1 --exclude svsm-fuzz -- -D warnings
188-
RUSTFLAGS="--cfg fuzzing" cargo clippy --all-features --package svsm-fuzz -- -D warnings
189-
cargo clippy --all-features --package svsm --target x86_64-unknown-none -- -D warnings
190-
cargo clippy --all-features --package stage1 --target x86_64-unknown-none -- -D warnings ${STAGE1_RUSTC_ARGS}
191-
cargo clippy --all-features --workspace --tests --exclude packit -- -D warnings
192+
cargo clippy --all-features --workspace --exclude svsm --exclude stage1 --exclude svsm-fuzz -- ${CLIPPY_ARGS}
193+
RUSTFLAGS="--cfg fuzzing" cargo clippy --all-features --package svsm-fuzz -- ${CLIPPY_ARGS}
194+
cargo clippy --all-features --package svsm --target x86_64-unknown-none -- ${CLIPPY_ARGS}
195+
cargo clippy --all-features --package stage1 --target x86_64-unknown-none -- ${CLIPPY_ARGS} ${STAGE1_RUSTC_ARGS}
196+
cargo clippy --all-features --workspace --tests --exclude packit -- ${CLIPPY_ARGS}
192197

193198
clean:
194199
cargo clean

0 commit comments

Comments
 (0)