-
Notifications
You must be signed in to change notification settings - Fork 7
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
Reduce warnings #12
Merged
Merged
Reduce warnings #12
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
gcc-11.3.0 fails to build keykit due to multiple definition of Midiinputs, Midioutputs, and Debug. Make Midiinputs/outputs extern in key.h and declare in main.c Ifdef out initialization of Debug/dval (as well as unused Debugmalloc/dmval) in misc.c
Ignore executables in bin and src directories. Ignore stdio and linux mdep copied files. Ignore protoflp generated header files.
Add .c.o rule to linux makefile. Have linux and stdio makefile .c.o rule call out $(CC) and $(CFLAGS). Add -Wall -Wextra to linux and stdio CFLAGS.
Change non-lint dummyusage definition to cast its arg to void. Add dummyusage() reference to all unused function parameters.
Replace emptry trailing else in chkrealoften definition; instead wrap defintion in 'do {' ... '} while(0)' to absorb invocation's trailing semicolon.
In linux port multiple "maybe unintialized" warnings are generated due to compiler not knowing various functions (execerror, underflow, etc) do not return. This is caused by missing function protoype attribute that informs GCC compiler the function does not return allowing its optimizer to determine variable(s) are intiailized along all code paths. Since protoflp generates all function prototype header files, modifiy it to allow a trailing "NO_RETURN_ATTRIBUTE" to be included in the function prototype, define it appropriately in the linux mdep.h header. However gcc only wants to see the attribute in the prototype, not the function declaration. This requires redefining NO_RETURN_ATTRIBUTE as empty string after inclusion of d_*.h prototype headers. For non-linux targets defined NO_RETURN_ATTRIBUTE as empty string if mdep.h does not provide a definition.
Replace explicit rules for each generated header file with a pattern matching rule. Only update d_xx.h if it either doesn't exist, is different than previously generated, or is older than source file.
GCC accepts "__attribute" used to tell compiler functions do not return, but to make usage match google, change to "__attribute__".
Instead of direclty passing fd_set value to sprintf, construct unsigned int bitmask from FD_ISSET of each potential bit in fd_set and pass resulting bitmask to sprintf.
Use cmp and rm/mv to either remove temp file, or move temp file to result if content changed.
Instead of using "lld" printf format specifier for intptr_t type args, include inttypes.h and use PRIdPTR format string. If PRIdPTR isn't defined (e.g. target environments that don't provide it) define PRIdPTR as "lld" instead.
Wrap structure initializers with braces within array initializers to suppress missing braces warning.
SCAN_BLTINCODE() where return not used to (void) to suppress computed value not used compiler warning.
Remove/ifdef out unused variables to fix unused-variable warnings.
Remove variables that are not referenced after assignment.
sizeof() (gcc-11.3.0 on Ubuntu) evaluates to a long unsigned int but is being compared agains int variables. Cast sizeof() in these cases to int to suppress the warning.
In bitmap_new, cast return from kmalloc for b->bits to (Unchar *). Would it be better to have underlying kmalloc functions (dbg/allocate) return void * instead of char *?
Initialize variables as needed to suppress gcc warning about codepaths that lead to referencing a variable when its uninitialized.
Cast buffer arg to ALSA snd_midi_event_encode/decode to be an unsigned char pointer. Declare length arg to accept/getsockopt to be socklen_t.
Fix warning when strncpy of string specifying array size of destination which may leave room for trailing null.
Cast char array subscript to unsigned char.
Clone following default case code into '\\' case in myre_subs() to suppress fallthrough warning.
Remove (or ifdef to match ifdef'd reference) unreferenced static functions.
nosuchtim
approved these changes
Mar 23, 2023
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.
Tim,
Being the first time I've collaborated on github, I hope I created this pull request correctly by using git-format-patch to generate patches of my changes from my repo and used git-am to merge them into this branch in your repo and from that this pull request...
Hopefully it looks good...