mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Merge pull request #216 from gwilymk/deny-warnings
Deny warnings and try to make the build a bit faster
This commit is contained in:
commit
fba087f2ee
|
@ -6,5 +6,5 @@ build-std-features = ["compiler-builtins-mem"]
|
|||
target = "thumbv4t-none-eabi"
|
||||
|
||||
[target.thumbv4t-none-eabi]
|
||||
rustflags = ["-Clink-arg=-Tgba.ld", "-Ctarget-cpu=arm7tdmi"]
|
||||
rustflags = ["-Clink-arg=-Tgba.ld", "-Ctarget-cpu=arm7tdmi", "-Dwarnings", "-Dclippy::all"]
|
||||
runner = "mgba-test-runner"
|
||||
|
|
|
@ -19,10 +19,6 @@ use crate::agb_alloc::bump_allocator::StartEnd;
|
|||
use crate::dma;
|
||||
use crate::fixnum::Vector2D;
|
||||
use crate::hash_map::HashMap;
|
||||
use crate::interrupt::free;
|
||||
|
||||
use bare_metal::Mutex;
|
||||
use core::cell::RefCell;
|
||||
|
||||
use attributes::*;
|
||||
|
||||
|
@ -52,13 +48,14 @@ impl DerefMut for ObjectControllerRef {
|
|||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
static OBJECT_REFS_CURRENT: Mutex<RefCell<i32>> = Mutex::new(RefCell::new(0));
|
||||
static OBJECT_REFS_CURRENT: bare_metal::Mutex<core::cell::RefCell<i32>> =
|
||||
bare_metal::Mutex::new(core::cell::RefCell::new(0));
|
||||
|
||||
impl ObjectControllerRef {
|
||||
fn new() -> Self {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
let a = free(|c| {
|
||||
let a = crate::interrupt::free(|c| {
|
||||
let mut b = OBJECT_REFS_CURRENT.borrow(*c).borrow_mut();
|
||||
let a = *b;
|
||||
*b += 1;
|
||||
|
@ -78,7 +75,7 @@ impl ObjectControllerRef {
|
|||
#[cfg(debug_assertions)]
|
||||
impl Drop for ObjectControllerRef {
|
||||
fn drop(&mut self) {
|
||||
free(|c| {
|
||||
crate::interrupt::free(|c| {
|
||||
let mut b = OBJECT_REFS_CURRENT.borrow(*c).borrow_mut();
|
||||
*b -= 1;
|
||||
})
|
||||
|
@ -444,7 +441,7 @@ struct ObjectInner {
|
|||
}
|
||||
|
||||
struct ObjectControllerStatic {
|
||||
free_affine_matricies: Vec<u8>,
|
||||
_free_affine_matricies: Vec<u8>,
|
||||
free_object: Vec<u8>,
|
||||
shadow_oam: Vec<Option<ObjectInner>>,
|
||||
z_order: Vec<u8>,
|
||||
|
@ -457,7 +454,7 @@ impl ObjectControllerStatic {
|
|||
shadow_oam: (0..128).map(|_| None).collect(),
|
||||
z_order: (0..128).collect(),
|
||||
free_object: (0..128).collect(),
|
||||
free_affine_matricies: (0..32).collect(),
|
||||
_free_affine_matricies: (0..32).collect(),
|
||||
sprite_controller: SpriteControllerInner::new(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#![cfg_attr(test, feature(custom_test_frameworks))]
|
||||
#![cfg_attr(test, test_runner(crate::test_runner::test_runner))]
|
||||
#![cfg_attr(test, reexport_test_harness_main = "test_main")]
|
||||
#![deny(clippy::all)]
|
||||
#![feature(alloc_error_handler)]
|
||||
|
||||
//! # agb
|
||||
|
|
35
justfile
35
justfile
|
@ -2,8 +2,19 @@ export CARGO_TARGET_DIR := env_var_or_default('CARGO_TARGET_DIR', justfile_direc
|
|||
|
||||
build: build-roms
|
||||
|
||||
build-debug:
|
||||
just _build-debug agb
|
||||
build-release:
|
||||
just _build-release agb
|
||||
clippy:
|
||||
just _all-crates _clippy
|
||||
|
||||
test:
|
||||
just _all-crates _test-debug
|
||||
just _test-debug agb
|
||||
just _test-debug agb-fixnum
|
||||
|
||||
test-release:
|
||||
just _test-release agb
|
||||
|
||||
clean:
|
||||
just _all-crates _clean
|
||||
|
@ -22,11 +33,7 @@ run-game game:
|
|||
run-game-debug game:
|
||||
(cd "examples/{{game}}" && cargo run)
|
||||
|
||||
ci: && build-roms build-book
|
||||
just _all-crates _build
|
||||
just _all-crates _test-debug
|
||||
just _all-crates _test-release
|
||||
just _all-crates _clippy
|
||||
ci: build-debug clippy test build-release test-release build-roms build-book
|
||||
|
||||
build-roms:
|
||||
just _build-rom "examples/the-purple-night" "PURPLENIGHT"
|
||||
|
@ -54,7 +61,7 @@ _build-rom folder name:
|
|||
TARGET_FOLDER="${CARGO_TARGET_DIR:-$GAME_FOLDER/target}"
|
||||
GBA_FILE="$TARGET_FOLDER/$GAME_NAME.gba"
|
||||
|
||||
(cd "$GAME_FOLDER" && cargo build --release --target thumbv4t-none-eabi)
|
||||
(cd "$GAME_FOLDER" && cargo build --release --target thumbv4t-none-eabi && cargo clippy --release --target thumbv4t-none-eabi)
|
||||
|
||||
mkdir -p examples/target/examples
|
||||
|
||||
|
@ -64,17 +71,21 @@ _build-rom folder name:
|
|||
cp -v "$GBA_FILE" "examples/target/examples/$GAME_NAME.gba"
|
||||
|
||||
_all-crates target:
|
||||
for CARGO_PROJECT_FILE in agb-*/Cargo.toml agb/Cargo.toml examples/*/Cargo.toml book/games/*/Cargo.toml; do \
|
||||
for CARGO_PROJECT_FILE in agb-*/Cargo.toml agb/Cargo.toml; do \
|
||||
PROJECT_DIR=$(dirname "$CARGO_PROJECT_FILE"); \
|
||||
just "{{target}}" "$PROJECT_DIR" || exit $?; \
|
||||
done
|
||||
|
||||
_build crate:
|
||||
(cd "{{crate}}" && cargo build)
|
||||
_build-debug crate:
|
||||
(cd "{{crate}}" && cargo build --examples --tests)
|
||||
_build-release crate:
|
||||
(cd "{{crate}}" && cargo build --release --examples --tests)
|
||||
_test-release crate:
|
||||
{{ if crate =~ 'agb.*' { "cd " + crate + " && cargo test --release" } else { "" } }}
|
||||
just _build-release {{crate}}
|
||||
(cd "{{crate}}" && cargo test --release)
|
||||
_test-debug crate:
|
||||
{{ if crate =~ 'agb.*' { "cd " + crate + " && cargo test" } else { "" } }}
|
||||
just _build-debug {{crate}}
|
||||
(cd "{{crate}}" && cargo test)
|
||||
_clippy crate:
|
||||
{{ if crate =~ 'agb.*' { "cd " + crate + " && cargo clippy" } else { "" } }}
|
||||
_clean crate:
|
||||
|
|
Loading…
Reference in a new issue