Skip to content
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 24 commits into from
Mar 23, 2023
Merged

Reduce warnings #12

merged 24 commits into from
Mar 23, 2023

Conversation

pbarada
Copy link
Contributor

@pbarada pbarada commented Mar 23, 2023

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...

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.
@pbarada pbarada requested a review from nosuchtim March 23, 2023 16:24
@nosuchtim
Copy link
Owner

nosuchtim commented Mar 23, 2023 via email

@nosuchtim nosuchtim merged commit 0150ad4 into master Mar 23, 2023
@pbarada pbarada deleted the reduce-warnings branch April 5, 2023 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants