Repository navigation
Conversation
Both `stb__addints_valid` and `stb__mul2shorts_valid` are only used
by the JPEG decoder and generate unused function warnings when not
compiling with JPEG support:
```c
// unused.c
```
```
$ cc -Wunused-function -c unused.c -o unused.o
In file included from unused.c:3:
./stb_image.h:1070:12: warning: unused function 'stbi__addints_valid' [-Wunused-function]
1070 | static int stbi__addints_valid(int a, int b)
| ^~~~~~~~~~~~~~~~~~~
./stb_image.h:1078:12: warning: unused function 'stbi__mul2shorts_valid' [-Wunused-function]
1078 | static int stbi__mul2shorts_valid(int a, int b)
| ^~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
```
Just `#if` them out if not building with JPEG support. I used two
separate `#if` blocks, one for each function, as that appeared to
be the generally preferred pattern.
Author
|
Note that I did not add myself to the "Bug & warning fixes" contributor list, to avoid unnecessary merge conflicts. I generally don't mind being left out, especially for such a tiny contribution like this one. |
Collaborator
|
This is fixed in the dev branch, although other changes have since made this exact set of conditions incorrect - GIF now also depends on |
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.
Both
stb__addints_validandstb__mul2shorts_validare only used by the JPEG decoder and generate unused function warnings when not compiling with JPEG support:Just
#ifthem out if not building with JPEG support. I used two separate#ifblocks, one for each function, as that appeared to be the generally preferred pattern.