Repository navigation
build: remove dead NOWARNINGS env var, restore deny-warnings for board builds - #5076
Merged
Merged
Conversation
…d builds NOWARNINGS was set in ~25 places in the Makefile but nothing has read it since RUSTFLAGS moved to `.cargo/config.toml` in 01b36bb (2024-07-15), which dropped its only two consumers in boards/Makefile.common. This silently regressed CI: `allcheck`/`allboards` stopped denying warnings on board builds at all. Restore deny-on-warnings for CI everywhere it's checked, using a single mechanism: `cargo --config boards/cargo/deny_warnings.toml`. This merges its `rustflags` with whatever a crate already sets via `.cargo/config.toml` (if anything), unlike the `RUSTFLAGS` environment variable, which replaces it outright and would have dropped required board linker flags. Board builds thread this through a new `TOCK_CARGO_FLAGS` Makefile variable (top-level `allcheck`/`allboards` and `boards/Makefile.common`'s check/rustc/build invocations, named with a `TOCK_` prefix since it's not a variable cargo itself recognizes); crate-level `cargo test` jobs pass `--config` directly. `boards/opentitan/earlgrey-cw310/Makefile` already used this variable (then named `CARGO_FLAGS`) for its `BOARD_CONFIGURATION` feature-selection option, predating this change. Renamed it to match, and switched its `CARGO_FLAGS = ...` to `+=` so it extends rather than clobbers any value already inherited from the environment, e.g. the new deny-warnings flag. Drop the remaining `NOWARNINGS=true` occurrences elsewhere (miri, qemu-runner, rustdoc, toc.sh); none of them ever read it, and they don't deny warnings at all. Co-Authored-By: Claude Sonnet 5 <[email protected]>
cortex-m7's switch_to_user (an unsafe fn) called the unsafe
cortexv7m::switch_to_user_arm_v7m without an explicit `unsafe {}` block.
Under the crate's Rust 2024 edition, unsafe_op_in_unsafe_fn is
warn-by-default, which becomes a hard error (E0133) under `-D warnings`.
Sibling arch crates (cortex-m4, cortex-m4f, cortex-m33) already wrap the
identical call; cortex-m7 was the one outlier.
This was invisible to CI: it only reproduces in a real cross-compiled
per-board build (the target-gated `#[cfg(all(target_arch = "arm",
target_os = "none"))]` branch never compiles under a host-target
`cargo check`), and of the two affected boards (teensy40,
imxrt1050-evkb), neither is one of the four boards ci-job-clippy checks.
Found while restoring board-build warnings-as-errors enforcement in CI
(see the prior commit on this branch) and confirming the fix against a
full real build of all boards.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
3 tasks done
bradjc
approved these changes
Aug 13, 2026
brghena
approved these changes
Aug 13, 2026
2 of 3 tasks
3 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Overview
Our Makefile was full of vestigial references to
NOWARNINGS, but nothing's actually used that environment variable since 01b36bb (in 2024...).As as consequence,
ci-job-syntax,ci-job-compilation, andci-job-debug-support-targetsstopped denying warnings on board builds at all.This PR removes the dead variable and restores deny-on-warnings for those jobs.
One of the reasons we didn't do this before is that using the
RUSTFLAGSenvironment variable replaces other rustflags, and several of our builds rely on.cargo/config.tomlrustflags for linker flags. It turns out the right way to handle this is just adding a second cargo config since cargo will merge multiple configs.There was one latent warning that we'd been silently allowing that is also now fixed in this PR (a missing
unsafein a newly-2024 edition crate).Testing Strategy
Verified with real injected warnings, not just inspection: confirmed
ci-job-syntax/ci-job-compilationfail on a deliberately introduced warning while a plain localmake check/releasedoesn't (and doesn't lose any board-specific flags); reverted and ran the full realci-job-syntaxandci-job-compilation(all 61 boards) clean.make prepushpasses.TODO or Help Wanted
N/A
Checklist
make prepush.PR Contents
Documentation
AI Use
disclosed my AI use below.
This PR was produced by an extended Claude Code session covering investigation, implementation, and verification.
Prompts that drove the content of this PR
"investigate NOWARNINGS env variable"
"The Makefile sets an environment variable, NOWARNINGS, in lots of places, but it's not obvious if anything actually reads this any more?
Is this an environment variable that possibly some subtools are sensitive to? Or is it actually not used any more?
Investigate git history to see how the variable used to be used to inform whether it is still relevant / useful.
Is this something we should just remove, or should we add back some logic that got lost to do something different based on the environment variable?"
(I chose the option "Delete NOWARNINGS, restore deny-warnings for board builds" from a set of choices Claude presented.)
"is CARGO_FLAGS just an arbitrary name, or a special environment variable that cargo normally pays attention to?"
"I see you got the name from history, does anything in-tree use CARGO_FLAGS prior to our work here? Does our use of this variable conflict?"
"yes, fix it and fold into the same commit" (in response to Claude finding the
boards/opentitan/earlgrey-cw310/Makefileclobber bug)"since this environment variable is really more about how Tock wants to drive cargo rather than invoking standard cargo things, would it make sense to rename it to TOCK_CARGO_FLAGS ?"
"it seems like we now have two paths that deny warnings—some things that use DENY_WARNINGS_CARGO_CONFIG and some things that manually specify RUSTFLAGS="-D warnings"
why do we have two different ways to enable warnings?
do we need both, can we harmonize to one?"
(I chose "Yes, switch everything to --config" from Claude's presented options.)
"Does CI still pass with these changes, or were there latent warnings slipping through that now need to be fixed" (this is what led to finding and fixing the
arch/cortex-m7bug)I have manually reviewed the diff before opening this PR.