-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile without warnings #347
Conversation
Here's the simple PowerShell script I wrote to validate the logic changes: The first function references the line numbers as they exist now. Running the script will output the actions that would be taken for various inputs.
Anyways, just wanted to show that work was done to validate the equivalence of the larger code change. Really, it's just a slight organizational change to allow the use of unsigned variables. |
Add verbose comments to show that the values changed from signed to unsigned, for the current code, would always be positive values. Add verbose comments to clarify the meaning of local variables. Add verbose comments to show all three possible states at all key computation points, for the higher cyclomatic complexity code block.
a function that uses the fields (two lines later).
After all, a uint8_t is alwasy <= 0xFF.
rebase'd to latest master (8dbe7d9) |
Here, LFS uses an int for return value, which is 16-bit. The VERIFY_MESS expects a 32-bit value, so cast here at the boundary between the two sets of files.
Updating to remove additional compiler warnings at debug level 2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much, fixing lots of terrible warnings. And putting lots of effort into explaining how the read cache work. I actually intended to write a little more for it, but then hmmm, I guess I forgot :D. That is indeed very useful write-up :) . Great works!!!
Thank you very much, this is very thoughtful of yours. Lots of effort to verify this, I should have done a better job of documenting :). Brilliant works and superb PR :) |
This PR allows v0.14.0 to compile cleanly (no warnings), allowing end-users to focus on issues within their own code.
Note: I am not sure how to fully test these. I ran the bleuart example, and verified UART capability.
Of particular note is the changes to the InternalFileSystem library's flash_cache.c, function flash_cache_read(). Significant comments were added to help understand the implicit guarantees provided by the various code paths. A PowerShell function mirroring the original code flow was written to generate results from various parameters. A second PowerShell function mirroring the new code flow was written to validate those parameters ended up with the same actions occurring in the final code, including on all edge cases. Manual code review validated how the old code avoided some additional edge cases, and comments now explicitly document the implicit assumptions that the old code relied heavily upon for proper operation.