-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Checks using 'splint' #2638
Comments
Very interesting checks, thanks. Some quick notes: There is still older code with irregular style. We'll maybe normalize that someday, but for now keep it because the authors intended to convey meaning with the style. We switched to relaxed c99 variable definitions to make reasoning and refactoring easier. We don't want to change that. And esp. widening the scope in e.g. loops is not acceptable, a local loop var will scope to the inner block and should not be visible outside (e.g. after the loop is done). The "function redefined" (e.g. nexus.c) warning is odd. I assume it's about the declaration of |
Defining the function using "extern" keeps splint happy. Relaxed C99 variable definition support is a long pending "issue" as there is no real codeowner for splint. |
For non-inline functions, |
I've update the script - 55 C files can be parsed and hence be checked for recommendations. |
What's the scope/intent of this issue? What's the path to closing it? It feels like a discussion of things noticed from the PR. We've resolved, I think, that splint expects stricter c99 than rtl_433's style guide, but I'm not sure what else. |
Given that splint does not support C99 and that RTL433 is in favor of using this feature, there is no real reason to push for it. I was under the impression that RTL_433 treis to keep (somewhat) compatible with older cversions. One of the main things that I learn from this splint analysis is that typing can be improved - IMHO the use of uint16_t and similar should be more widely applied. Also, currently int16_t may be assigned to ints and vice-versa without any casts - while cast are not required by the language, they indicate the developer's intention, which allows detecting unwanted conversions. There are some other lessons as well, but the above are the main ones. This is the log for the parsable files with "no" exclusions: analysis.log |
Certainly if you want to file PRs or issues for specific cleanups that seems reasonable; I can't of course tell you how they will go over though. As far as this issue goes, it seems it has run it course, we learned some things, and it's time to close it. If you agree, please do. |
#2639 adds splint as a workflow.
Without arguments it checks "all" files (a lot of files were excluded).
Most of the time parsing fails because variables are not defined at the start of a block.
I adjusted some files for that and in 'include/abuf.h' I added a '#ifndef S_SPLINT_S' to work around the elipsis limitation of splint.
The text was updated successfully, but these errors were encountered: