| Summary: | little Warning in Android_JNI_CaptureAudioBuffer | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sylvain <sylvain.becker> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | don't know | ||
| Hardware: | All | ||
| OS: | Android (All) | ||
| Attachments: | patch | ||
(In reply to Sylvain from comment #0) > A little Warning in Android_JNI_CaptureAudioBuffer. > > SDL_android.c > src/core/android/SDL_android.c:1302:5: warning: variable 'br' is used It is not that 'little', because the warning is not 'maybe used' butt 'is used' unitialized, and indeed it is. Created attachment 3375 [details] patch Here's a patch. This is in Android/JNI CaptureFromDevice. So let's make this default value be an error ! It's default behaviour, handled correctly by generic audio layer: https://hg.libsdl.org/SDL/file/43d46306c3ba/src/audio/SDL_audio.c#l835 Moreover, the patch also contains my warning suggestion to add in Android.mk : +LOCAL_CFLAGS += \ + -Wall -Wextra \ + -Wdocumentation \ + -Wdocumentation-unknown-command \ + -Wmissing-prototypes \ + -Wunreachable-code-break \ + -Wunneeded-internal-declaration \ + -Wmissing-variable-declarations \ + -Wfloat-conversion \ + -Wshorten-64-to-32 \ + -Wunreachable-code-return + +# Warnings we haven't fixed (yet) +LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare + It add a only few warnings that could be fixed in future. The build log won't get flooded. Patch added, thanks! https://hg.libsdl.org/SDL/rev/2f02c753a5dc |
A little Warning in Android_JNI_CaptureAudioBuffer. SDL_android.c src/core/android/SDL_android.c:1302:5: warning: variable 'br' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~~~~~ src/core/android/SDL_android.c:1306:12: note: uninitialized use occurs here return br; ^~ src/core/android/SDL_android.c:1270:12: note: initialize the variable 'br' to silence this warning jint br; ^ Maybe we could add some basics warning flags, not to see all warnings, but so that new warnings are caught sooner. I would go for -Wall -Wextra, and some -Wno-warning for the allowed warnings.