Fixed bug 4315 - little Warning in Android_JNI_CaptureAudioBuffer

Sylvain

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.
This commit is contained in:
Sam Lantinga 2018-11-02 17:18:03 -07:00
parent 6a9f45f2de
commit 47fb450beb
2 changed files with 17 additions and 1 deletions

View File

@ -53,6 +53,22 @@ LOCAL_SRC_FILES := \
LOCAL_SHARED_LIBRARIES := hidapi LOCAL_SHARED_LIBRARIES := hidapi
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
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
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
ifeq ($(NDK_DEBUG),1) ifeq ($(NDK_DEBUG),1)

View File

@ -1261,7 +1261,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen)
{ {
JNIEnv *env = Android_JNI_GetEnv(); JNIEnv *env = Android_JNI_GetEnv();
jboolean isCopy = JNI_FALSE; jboolean isCopy = JNI_FALSE;
jint br; jint br = -1;
switch (captureBufferFormat) { switch (captureBufferFormat) {
case ENCODING_PCM_8BIT: case ENCODING_PCM_8BIT: