From 9653cd77dbf379af7dd0b2ae06cc98b2bb90bc8d Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 5 Feb 2025 12:27:31 +0000 Subject: [PATCH] Stop allowing an empty loop --- agb/examples/output.rs | 5 ++++- agb/tests/test_multiboot.rs | 4 +++- agb/tests/test_save_eeprom_512b.rs | 4 +++- agb/tests/test_save_eeprom_8k.rs | 4 +++- agb/tests/test_save_flash_128k.rs | 4 +++- agb/tests/test_save_flash_64k.rs | 4 +++- agb/tests/test_save_sram.rs | 4 +++- justfile | 2 +- tracker/agb-tracker/src/lib.rs | 4 +++- 9 files changed, 26 insertions(+), 9 deletions(-) diff --git a/agb/examples/output.rs b/agb/examples/output.rs index 15ca4ee87..4a00e3ce4 100644 --- a/agb/examples/output.rs +++ b/agb/examples/output.rs @@ -1,6 +1,7 @@ #![no_std] #![no_main] +use agb::syscall; use portable_atomic::{AtomicU32, Ordering}; static COUNT: AtomicU32 = AtomicU32::new(0); @@ -14,5 +15,7 @@ fn main(_gba: agb::Gba) -> ! { COUNT.store(cur_count + 1, Ordering::SeqCst); }) }; - loop {} + loop { + syscall::halt(); + } } diff --git a/agb/tests/test_multiboot.rs b/agb/tests/test_multiboot.rs index 1ad686b40..8c826ce85 100644 --- a/agb/tests/test_multiboot.rs +++ b/agb/tests/test_multiboot.rs @@ -25,5 +25,7 @@ fn multiboot_test(_gba: &mut agb::Gba) { #[agb::entry] fn entry(_gba: agb::Gba) -> ! { - loop {} + loop { + agb::syscall::halt(); + } } diff --git a/agb/tests/test_save_eeprom_512b.rs b/agb/tests/test_save_eeprom_512b.rs index 19c3f6c90..5b13832c7 100644 --- a/agb/tests/test_save_eeprom_512b.rs +++ b/agb/tests/test_save_eeprom_512b.rs @@ -12,5 +12,7 @@ fn save_setup(gba: &mut agb::Gba) { #[agb::entry] fn entry(_gba: agb::Gba) -> ! { - loop {} + loop { + agb::syscall::halt(); + } } diff --git a/agb/tests/test_save_eeprom_8k.rs b/agb/tests/test_save_eeprom_8k.rs index 956773211..eea0c4974 100644 --- a/agb/tests/test_save_eeprom_8k.rs +++ b/agb/tests/test_save_eeprom_8k.rs @@ -12,5 +12,7 @@ fn save_setup(gba: &mut agb::Gba) { #[agb::entry] fn entry(_gba: agb::Gba) -> ! { - loop {} + loop { + agb::syscall::halt(); + } } diff --git a/agb/tests/test_save_flash_128k.rs b/agb/tests/test_save_flash_128k.rs index 7256ddfb2..41b9e7d8c 100644 --- a/agb/tests/test_save_flash_128k.rs +++ b/agb/tests/test_save_flash_128k.rs @@ -12,5 +12,7 @@ fn save_setup(gba: &mut agb::Gba) { #[agb::entry] fn entry(_gba: agb::Gba) -> ! { - loop {} + loop { + agb::syscall::halt(); + } } diff --git a/agb/tests/test_save_flash_64k.rs b/agb/tests/test_save_flash_64k.rs index 6c179ae30..281a25ede 100644 --- a/agb/tests/test_save_flash_64k.rs +++ b/agb/tests/test_save_flash_64k.rs @@ -12,5 +12,7 @@ fn save_setup(gba: &mut agb::Gba) { #[agb::entry] fn entry(_gba: agb::Gba) -> ! { - loop {} + loop { + agb::syscall::halt(); + } } diff --git a/agb/tests/test_save_sram.rs b/agb/tests/test_save_sram.rs index f3348eda7..d6028f30a 100644 --- a/agb/tests/test_save_sram.rs +++ b/agb/tests/test_save_sram.rs @@ -12,5 +12,7 @@ fn save_setup(gba: &mut agb::Gba) { #[agb::entry] fn entry(_gba: agb::Gba) -> ! { - loop {} + loop { + agb::syscall::halt(); + } } diff --git a/justfile b/justfile index 5f885e098..6913bd598 100644 --- a/justfile +++ b/justfile @@ -1,5 +1,5 @@ export CARGO_TARGET_DIR := env_var_or_default('CARGO_TARGET_DIR', justfile_directory() + "/target") -CLIPPY_ARGUMENTS := "-Dwarnings -Dclippy::all -Aclippy::empty-loop" +CLIPPY_ARGUMENTS := "-Dwarnings -Dclippy::all" podman_command := "podman" diff --git a/tracker/agb-tracker/src/lib.rs b/tracker/agb-tracker/src/lib.rs index dbcd7270f..fc9a20df2 100644 --- a/tracker/agb-tracker/src/lib.rs +++ b/tracker/agb-tracker/src/lib.rs @@ -667,7 +667,9 @@ impl TrackerChannel { #[cfg(all(test, feature = "agb"))] #[agb::entry] fn main(gba: agb::Gba) -> ! { - loop {} + loop { + agb::syscall::halt(); + } } #[cfg(feature = "agb")]