From bd6c92926e60df2db594e9c9f1437253c81ead98 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 28 Mar 2016 05:15:32 +0000 Subject: [PATCH] Fix Android warnings missed due to Android.mk misconfiguration. git-svn-id: https://svn.eduke32.com/eduke32@5679 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/sdlayer.c | 8 ++++++-- polymer/eduke32/source/android/android-jni.cpp | 17 +++++++++++++++-- polymer/eduke32/source/android/in_android.c | 11 +++++++++-- polymer/eduke32/source/android/in_android.h | 2 +- polymer/eduke32/source/jmact/control.c | 10 ++++++++++ 5 files changed, 41 insertions(+), 7 deletions(-) diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 0f16d1b83..d273d8419 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -296,8 +296,6 @@ void wm_setapptitle(const char *name) // // -static void attach_debugger_here(void) {} - /* XXX: libexecinfo could be used on systems without gnu libc. */ #if !defined _WIN32 && defined __GNUC__ && !defined __OpenBSD__ && !(defined __APPLE__ && defined __BIG_ENDIAN__) && !defined GEKKO && !defined EDUKE32_TOUCH_DEVICES && !defined __OPENDINGUX__ # define PRINTSTACKONSEGV 1 @@ -306,6 +304,9 @@ static void attach_debugger_here(void) {} static inline char grabmouse_low(char a); +#ifndef __ANDROID__ +static void attach_debugger_here(void) {} + static void sighandler(int signum) { UNREFERENCED_PARAMETER(signum); @@ -329,6 +330,7 @@ static void sighandler(int signum) Bexit(8); } } +#endif #ifdef __ANDROID__ int mobile_halted = 0; @@ -371,6 +373,8 @@ int sdlayer_mobilefilter(void *userdata, SDL_Event *event) default: return 1;//!halt; } + + UNREFERENCED_PARAMETER(userdata); } #endif diff --git a/polymer/eduke32/source/android/android-jni.cpp b/polymer/eduke32/source/android/android-jni.cpp index c5e5faa06..e6e0cc8b8 100644 --- a/polymer/eduke32/source/android/android-jni.cpp +++ b/polymer/eduke32/source/android/android-jni.cpp @@ -39,6 +39,11 @@ extern "C" { #include "in_android.h" #include "function.h" +#if defined __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + #define DEFAULT_FADE_FRAMES 10 #ifndef LOGI @@ -624,7 +629,7 @@ jint EXPORT_ME Java_com_voidpoint_duke3d_NativeLib_i(JNIEnv *env, jobject thiz, for (int i = 0; i < argCount; i++) { jstring string = (jstring)(env)->GetObjectArrayElement(argsArray, i); - argv[argc] = (char *)(env)->GetStringUTFChars(string, 0); + argv[argc] = (char const *)(env)->GetStringUTFChars(string, 0); LOGI("arg = %s", argv[argc]); argc++; } @@ -641,7 +646,9 @@ jint EXPORT_ME Java_com_voidpoint_duke3d_NativeLib_i(JNIEnv *env, jobject thiz, AndroidTouchInit(droidinfo.screen_width, droidinfo.screen_height, "/assets/"); else LOGI("skipping touch input"); - main(argc, (char **)argv); + extern int SDL_main(int argc, char const *argv[]); + + SDL_main(argc, (char const **)argv); return 0; } @@ -737,6 +744,8 @@ jint EXPORT_ME Java_com_voidpoint_duke3d_NativeLib_qc(JNIEnv *env, jobject obj, quickCommandString = std::string(p) + "\n"; env->ReleaseStringUTFChars(command, p); AndroidOSD(quickCommandString.c_str()); + + return 0; } void EXPORT_ME Java_com_voidpoint_duke3d_NativeLib_sss(JNIEnv *env, jobject thiz, jint width, jint height) @@ -755,4 +764,8 @@ void EXPORT_ME Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv *env, jclass cl // SDL_EventState(SDL_TEXTINPUT,SDL_ENABLE); } +#if defined __GNUC__ +# pragma GCC diagnostic pop +#endif + } diff --git a/polymer/eduke32/source/android/in_android.c b/polymer/eduke32/source/android/in_android.c index 9e7e80029..ecee68699 100644 --- a/polymer/eduke32/source/android/in_android.c +++ b/polymer/eduke32/source/android/in_android.c @@ -55,13 +55,18 @@ extern int SDL_SendMouseButton(SDL_Window * window, Uint32 mouseID, Uint8 state, #include "in_android.h" #include +#if defined __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO,"DUKE", __VA_ARGS__)) static char sdl_text[2]; droidinput_t droidinput; -int AndroidTimer(int tics) { G_InitTimer(tics); } +void AndroidTimer(int tics) { G_InitTimer(tics); } int AndroidKeyEvent(int state, int code,int unicode) { @@ -344,4 +349,6 @@ void CONTROL_Android_PollDevices(ControlInfo *info) //LOGI("poll state = 0x%016llX",CONTROL_ButtonState); } - +#if defined __GNUC__ +# pragma GCC diagnostic pop +#endif diff --git a/polymer/eduke32/source/android/in_android.h b/polymer/eduke32/source/android/in_android.h index 513bca8dd..dc927d8bf 100644 --- a/polymer/eduke32/source/android/in_android.h +++ b/polymer/eduke32/source/android/in_android.h @@ -97,7 +97,7 @@ typedef struct extern droidinput_t droidinput; extern droidsysinfo_t droidinfo; -int AndroidTimer(int tics); +void AndroidTimer(int tics); int AndroidKeyEvent(int state, int code, int unicode); int AndroidRead(portableread_t r); diff --git a/polymer/eduke32/source/jmact/control.c b/polymer/eduke32/source/jmact/control.c index bc21f4cc1..5247a3cbd 100644 --- a/polymer/eduke32/source/jmact/control.c +++ b/polymer/eduke32/source/jmact/control.c @@ -46,11 +46,13 @@ CONTROL_JoyAxes[MAXJOYAXES]; static controlaxistype CONTROL_LastMouseAxes[MAXMOUSEAXES], CONTROL_LastJoyAxes[MAXJOYAXES]; static int32_t CONTROL_MouseAxesScale[MAXMOUSEAXES], CONTROL_JoyAxesScale[MAXJOYAXES]; +#ifndef __ANDROID__ static int32_t CONTROL_MouseButtonState[MAXMOUSEBUTTONS], CONTROL_JoyButtonState[MAXJOYBUTTONS]; static int32_t CONTROL_MouseButtonClickedTime[MAXMOUSEBUTTONS], CONTROL_JoyButtonClickedTime[MAXJOYBUTTONS]; static int32_t CONTROL_MouseButtonClickedState[MAXMOUSEBUTTONS], CONTROL_JoyButtonClickedState[MAXJOYBUTTONS]; static int32_t CONTROL_MouseButtonClicked[MAXMOUSEBUTTONS], CONTROL_JoyButtonClicked[MAXJOYBUTTONS]; static uint8_t CONTROL_MouseButtonClickedCount[MAXMOUSEBUTTONS], CONTROL_JoyButtonClickedCount[MAXJOYBUTTONS]; +#endif static int32_t(*ExtGetTime)(void); int32_t CONTROL_Started = FALSE; //static int32_t ticrate; @@ -94,6 +96,7 @@ void CONTROL_FreeMouseBind(int32_t i) BIND(CONTROL_MouseBinds[i], NULL, 0, NULL); } +#ifndef __ANDROID__ static void CONTROL_GetMouseDelta(void) { int32_t x,y; @@ -114,6 +117,7 @@ static void CONTROL_GetMouseDelta(void) CONTROL_MouseAxes[0].analog = (int32_t)(x * 4.0f * CONTROL_MouseSensitivity); CONTROL_MouseAxes[1].analog = (int32_t)((y * 4.0f * CONTROL_MouseSensitivity) * 2.0f); } +#endif static int32_t CONTROL_GetTime(void) { @@ -122,6 +126,7 @@ static int32_t CONTROL_GetTime(void) return t; } +#ifndef __ANDROID__ static void CONTROL_SetFlag(int32_t which, int32_t active) { if (CONTROL_CheckRange(which)) return; @@ -141,6 +146,7 @@ static void CONTROL_SetFlag(int32_t which, int32_t active) CONTROL_Flags[which].active = (CONTROL_Flags[which].active ? FALSE : TRUE); } } +#endif #if 0 int32_t CONTROL_KeyboardFunctionPressed(int32_t which) @@ -429,6 +435,7 @@ void CONTROL_ClearAssignments(void) CONTROL_JoyAxesScale[i] = NORMALAXISSCALE; } +#ifndef __ANDROID__ static void DoGetDeviceButtons( int32_t buttons, int32_t tm, int32_t NumButtons, @@ -742,6 +749,7 @@ static void CONTROL_ButtonFunctionState(int32_t *p1) while (i--); } } +#endif void CONTROL_ClearButton(int32_t whichbutton) { @@ -775,6 +783,7 @@ void CONTROL_ProcessBinds(void) while (i--); } +#ifndef __ANDROID__ static void CONTROL_GetFunctionInput(void) { int32_t periphs[CONTROL_NUM_FLAGS]; @@ -798,6 +807,7 @@ static void CONTROL_GetFunctionInput(void) memset(CONTROL_OSDInput, 0, sizeof(CONTROL_OSDInput)); } +#endif void CONTROL_GetInput(ControlInfo *info) {