Compile on Android with more warnings

This commit is contained in:
Aaron Culliney 2019-10-27 13:09:46 -07:00
parent 1491d3f88d
commit 00984b7ab9
9 changed files with 33 additions and 10 deletions

View File

@ -442,7 +442,7 @@ void Java_org_deadc0de_apple2ix_Apple2DisksMenu_nativeEjectDisk(JNIEnv *env, jcl
disk6_eject(driveA ? 0 : 1);
}
static int _openFdFromJson(OUTPARM int *fdOut, JSON_ref jsonData, const char * const fdKey, const char * const pathKey, int flags, int mode) {
static void _openFdFromJson(OUTPARM int *fdOut, JSON_ref jsonData, const char * const fdKey, const char * const pathKey, int flags, int mode) {
long fd = -1;
char *path = NULL;

View File

@ -64,7 +64,7 @@ APPLE2_MAIN_SRC = \
$(APPLE2_SRC_PATH)/../externals/jsmn/jsmn.c
APPLE2_OPTIM_CFLAGS := -O2 # match the same optimization level as BUILD_MODE=release for ndk-build
APPLE2_BASE_CFLAGS := -DAPPLE2IX=1 -DINTERFACE_TOUCH=1 -DMOBILE_DEVICE=1 -DVIDEO_OPENGL=1 -std=gnu11 -fPIC $(APPLE2_OPTIM_CFLAGS) -I$(APPLE2_SRC_PATH)
APPLE2_BASE_CFLAGS := -Wall -DAPPLE2IX=1 -DINTERFACE_TOUCH=1 -DMOBILE_DEVICE=1 -DVIDEO_OPENGL=1 -std=gnu11 -fPIC $(APPLE2_OPTIM_CFLAGS) -I$(APPLE2_SRC_PATH)
APPLE2_BASE_LDLIBS := -Wl,-z,text -Wl,-z,noexecstack -llog -landroid -lGLESv2 -lz -lOpenSLES -latomic
LOCAL_WHOLE_STATIC_LIBRARIES += cpufeatures

View File

@ -63,7 +63,7 @@ typedef struct EngineContext_s {
} EngineContext_s;
static AudioBackend_s opensles_audio_backend = { 0 };
static AudioBackend_s opensles_audio_backend = { { 0 } };
// ----------------------------------------------------------------------------
// AudioBuffer_s internal processing routines
@ -230,6 +230,8 @@ static long SLGetPosition(AudioBuffer_s *_this, OUTPARM unsigned long *bytes_que
assert(workingBytes <= voice->bufferSize);
*bytes_queued = workingBytes;
(void)queuedBytes;
} while (0);
return err;
@ -729,6 +731,7 @@ static long opensles_systemPause(AudioContext_s *audio_context) {
EngineContext_s *ctx = (EngineContext_s *)(audio_context->_internal);
SLresult result = (*(ctx->bqPlayerPlay))->SetPlayState(ctx->bqPlayerPlay, SL_PLAYSTATE_PAUSED);
(void)result;
return 0;
}
@ -751,7 +754,7 @@ static long opensles_systemResume(AudioContext_s *audio_context) {
if (state == SL_PLAYSTATE_PAUSED) {
// Balanced resume OK here
SLresult result = (*(ctx->bqPlayerPlay))->SetPlayState(ctx->bqPlayerPlay, SL_PLAYSTATE_PLAYING);
result = (*(ctx->bqPlayerPlay))->SetPlayState(ctx->bqPlayerPlay, SL_PLAYSTATE_PLAYING);
} else if (state == SL_PLAYSTATE_STOPPED) {
// Do not resume for stopped state, let this get forced from CPU/speaker thread otherwise we starve. (The
// stopped state happens if user dynamically changed buffer parameters in menu settings which triggered an

View File

@ -173,5 +173,26 @@
_rc; })
#endif
#define _STRINGIFY(x) #x
// diagnostic suppression
#if defined(__clang__)
// NOTE: check for Clang first, since it also defines __GNUC__
# define DIAGNOSTIC_SUPPRESS_PUSH(clang_diag, gcc_diag) \
_Pragma("clang diagnostic push") \
_Pragma(_STRINGIFY(clang diagnostic ignored clang_diag))
# define DIAGNOSTIC_SUPPRESS_POP() \
_Pragma("clang diagnostic pop")
#elif defined(__GNUC__)
# define DIAGNOSTIC_SUPPRESS_PUSH(clang_diag, gcc_diag) \
_Pragma("GCC diagnostic push") \
_Pragma(_STRINGIFY(GCC diagnostic ignored gcc_diag))
# define DIAGNOSTIC_SUPPRESS_POP() \
_Pragma("GCC diagnostic pop")
#else
# error "unknown possibly unsupported compiler!"
#endif
#endif // whole file

View File

@ -269,6 +269,7 @@ void c_calibrate_joystick()
}
#endif // INTERFACE_CLASSIC
#if !TESTING
// HACK : avoid resetting joystick button values too quickly. This should allow for ClosedApple-Reset. (This is still a
// race, but hopefully much less likely to trigger).
static void *_joystick_resetDelayed(void *ctx) {
@ -283,6 +284,7 @@ static void *_joystick_resetDelayed(void *ctx) {
return NULL;
}
#endif
void c_joystick_reset(void)
{

View File

@ -642,10 +642,6 @@ static void gltouchjoy_reshape(int w, int h, bool landscape) {
}
}
static void gltouchjoy_resetJoystick(void) {
// no-op
}
static inline bool _is_point_on_axis_side(int x, int y) {
return (x >= touchport.axisX && x <= touchport.axisXMax && y >= touchport.axisY && y <= touchport.axisYMax);
}

View File

@ -251,7 +251,6 @@ static void touchjoy_buttonUp(int dx, int dy) {
SPIN_LOCK_FULL(&joys.spinlock);
TOUCH_JOY_LOG("\t\tjoy buttonUp acquire");
bool ignored = false;
_touchjoy_buttonMove(dx, dy);
_fire_current_buttons();

View File

@ -618,7 +618,6 @@ static void _subvariant_prefsChanged(subvariant_s *subvariant, const char *domai
static void touchkpad_prefsChanged(const char *domain) {
assert(video_isRenderThread());
long lVal = 0;
bool bVal = false;
kpad.autostrobeDelay = !(prefs_parseBoolValue(domain, PREF_KPAD_FAST_AUTOREPEAT, &bVal) ? bVal : true);

View File

@ -254,6 +254,7 @@ static void glvideo_init(void) {
// Check for errors to make sure all of our setup went ok
GL_MAYBELOG("finished initialization");
DIAGNOSTIC_SUPPRESS_PUSH("-Waddress", "-Waddress")
#if __APPLE__
if (1) {
#else
@ -264,6 +265,7 @@ static void glvideo_init(void) {
ERRQUIT("framebuffer status: %04X", status);
}
}
DIAGNOSTIC_SUPPRESS_POP()
}
static void glvideo_shutdown(void) {
@ -358,6 +360,7 @@ static void glvideo_render(void) {
#if !FB_PIXELS_PASS_THRU
memcpy(/*dest:*/crtModel->texPixels, /*src:*/fb, (SCANWIDTH*SCANHEIGHT*sizeof(PIXEL_TYPE)));
#endif
(void)fb;
glTexImage2D(GL_TEXTURE_2D, /*level*/0, TEX_FORMAT_INTERNAL, SCANWIDTH, SCANHEIGHT, /*border*/0, TEX_FORMAT, TEX_TYPE, crtModel->texPixels);
}