-
Notifications
You must be signed in to change notification settings - Fork 806
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
lfs_fs_raw* functions should be static #884
Merged
Merged
Conversation
This file contains 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
Tests passed ✓, Code: 16820 B (-0.1%), Stack: 1448 B (+0.0%), Structs: 800 B (+0.0%)
|
Hi @DvdGiessen, thanks for this! Looks like quite an oversight. Will bring this in next patch release. |
geky
approved these changes
Oct 24, 2023
This warning is useful for catching the easy mistake of missing the keyword static on functions intended to be internal-only. Missing the static keyword risks symbol polution and misses potential compiler optimizations. This is an interesting warning, while useful for libraries such as littlefs, it's perfectly valid C to not predeclare all functions, and common in final application binaries. Relatedly, this warning is re-disabled for the test/bench runner. There may be a better way to organize the CFLAGS, maybe into separate LIB/RUNNER CFLAGS, but I'll leave this to future work if our CFLAGS grow more complicated. This was motivated by non-static internal-only functions leaking into a release. Found and fixed by DvdGiessen.
I've gone ahead and added -Wmissing-prototypes into our Makefile (8f3f32d), it seems like a useful warning. This should now be caught by the CI here and prevented in the future. |
Tests passed ✓, Code: 16820 B (-0.1%), Stack: 1448 B (+0.0%), Structs: 800 B (+0.0%)
|
Should be merged now, thanks again for this! |
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.
Two new functions introduced in 2.6.0 (
lfs_fs_mkconsistent
, 259535e) and 2.8.0 (lfs_fs_grow
, 23505fa) have internal "raw" functions which are missing thestatic
keyword.This was causing build failures in our builds in the MicroPython project when updating to the latest LittleFS, because we're building with
-Werror,-Wmissing-prototypes,-Wmissing-declarations
. See here and here for the build output.This PR adds the
static
keyword to these functions to fix these, similar to how all other internal functions in LittleFS are defined.