Fix some compiler warnings#4
Open
magical wants to merge 3 commits intoBR903:masterfrom
Open
Conversation
This suppresses a warning from gcc -Wimplicit-fallthrough, which is enabled by -Wextra. The braces around the body of the if statement are necessary here, as otherwise gcc doesn't notice the fallthrough comment. I'm guessing that without them it attributes the comment to the statement inside the if.
Fixes the following warning:
series.c:196:43: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
The argument in question is a ptrdiff_t, so the correct format specifier
is `%td`.
Fixes the following warnings:
sdlout.c:269:40: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
sdlout.c:269:43: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
This file contains hidden or 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
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.
Details on the commits.
I found the format string problems by annotating
warn,errmsg, anddiewith GCC'sformatattribute. https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-format-function-attributeI'm not sure how you feel about adding GCC-specific attributes to the code so i left that change out of the PR.