fix all the compiler warnings - #43
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Ready to approve
The changes are narrow, consistent with the stated goal (warning cleanup), and appear behavior-preserving with no new correctness risks identified in the modified regions.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR focuses on eliminating noisy compiler warnings in the NUSense firmware so warning output is more actionable during development, without changing CI behavior or materially altering runtime logic.
Changes:
- Removes an unused/duplicate
MX_GPIO_Initstub fromi2c.c(the real GPIO init lives ingpio.c). - Adds explicit
uint8_tcasts around IMU register address bitwise-OR operations to avoid narrowing warnings in brace-initialization. - Rewrites compound updates on
volatilering-buffersizefields as plain assignments to avoid C++20 deprecation warnings.
File summaries
| File | Description |
|---|---|
| NUSense/Core/Src/usb/PacketHandler.hpp | Replaces volatile compound decrements with explicit assignments when consuming bytes from the USB RX ring buffer. |
| NUSense/Core/Src/uart/Port.hpp | Rewrites volatile size++/size-- in the UART ring buffer helpers to avoid deprecated volatile compound operations. |
| NUSense/Core/Src/uart/Port.cpp | Replaces rx_buffer.size += delta with rx_buffer.size = rx_buffer.size + delta in the DMA RX handling path. |
| NUSense/Core/Src/imu.cpp | Wraps register-address ORs with an explicit uint8_t cast to prevent narrowing warnings when forming SPI command packets. |
| NUSense/Core/Src/i2c.c | Deletes the redundant MX_GPIO_Init stub to remove dead code and associated warnings. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Contributor
Author
|
clanker says yes clanka please |
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.
the compiler warnings irritate me because they mean I have no clue whether the code i'm working on is the thing emitting all the warnings. in theory i'd love to put warnings-as-errors in the CI/CD pipeline but honestly who cares that much. may as well just keep the CI/CD as is. Thanks.
silence narrowing conversion warnings
assignments in Port.hpp/cpp and PacketHandler.hpp; these compound
forms are deprecated on volatile in C++20