Fix some more compiler warnings on armcc.
diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h
index ff42cf7..0a2e067 100644
--- a/include/SDL_stdinc.h
+++ b/include/SDL_stdinc.h
@@ -127,11 +127,18 @@
*/
/* @{ */
+#ifdef __CC_ARM
+/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
+#define SDL_FALSE 0
+#define SDL_TRUE 1
+typedef int SDL_bool;
+#else
typedef enum
{
SDL_FALSE = 0,
SDL_TRUE = 1
} SDL_bool;
+#endif
/**
* \brief A signed 8-bit integer type.
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index 41ad345..aa4501f 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -1038,9 +1038,8 @@
const Sint16 *inbuf = (const Sint16 *) _inbuf;
Sint16 *outbuf = (Sint16 *) _outbuf;
SDL_AudioStreamResamplerState *state = (SDL_AudioStreamResamplerState*)stream->resampler_state;
- const int chans = (int)stream->pre_resample_channels;
- SDL_assert(chans <= SDL_arraysize(state->resampler_state.si16));
+ SDL_assert(((int)stream->pre_resample_channels) <= SDL_arraysize(state->resampler_state.si16));
if (!state->resampler_seeded) {
state->resampler_state.si16[0] = inbuf[0];
diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c
index f2e263f..5d1b13f 100644
--- a/src/cpuinfo/SDL_cpuinfo.c
+++ b/src/cpuinfo/SDL_cpuinfo.c
@@ -229,7 +229,7 @@
}
#else
#define cpuid(func, a, b, c, d) \
- a = b = c = d = 0
+ do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0)
#endif
static int CPU_CPUIDFeatures[4];
diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c
index f7e9ddf..3aaee13 100644
--- a/src/events/SDL_keyboard.c
+++ b/src/events/SDL_keyboard.c
@@ -569,7 +569,7 @@
#ifdef DEBUG_KEYBOARD
printf("Resetting keyboard\n");
#endif
- for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
+ for (scancode = (SDL_Scancode) 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
if (keyboard->keystate[scancode] == SDL_PRESSED) {
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
}
@@ -834,7 +834,7 @@
{
SDL_Keyboard *keyboard = &SDL_keyboard;
- return keyboard->modstate;
+ return (SDL_Keymod) keyboard->modstate;
}
void
@@ -863,7 +863,7 @@
{
SDL_Keyboard *keyboard = &SDL_keyboard;
- if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
+ if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
return 0;
}
@@ -890,7 +890,7 @@
SDL_GetScancodeName(SDL_Scancode scancode)
{
const char *name;
- if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
+ if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
return "";
}
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index 80baa05..172f3d0 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -382,7 +382,7 @@
for (entry = 0; map_StringForControllerAxis[entry]; ++entry) {
if (!SDL_strcasecmp(pchString, map_StringForControllerAxis[entry]))
- return entry;
+ return (SDL_GameControllerAxis) entry;
}
return SDL_CONTROLLER_AXIS_INVALID;
}
@@ -428,7 +428,7 @@
for (entry = 0; map_StringForControllerButton[entry]; ++entry) {
if (SDL_strcasecmp(pchString, map_StringForControllerButton[entry]) == 0)
- return entry;
+ return (SDL_GameControllerButton) entry;
}
return SDL_CONTROLLER_BUTTON_INVALID;
}
@@ -804,6 +804,8 @@
SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index);
ControllerMapping_t *mapping;
+ (void) s_pEmscriptenMapping; /* pacify ARMCC */
+
mapping = SDL_PrivateGetControllerMappingForGUID(&jGUID);
#if SDL_JOYSTICK_XINPUT
if (!mapping && SDL_SYS_IsXInputGamepad_DeviceIndex(device_index)) {
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index d31f729..7cc1324 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -1938,7 +1938,7 @@
/* Free existing textures for this renderer */
while (renderer->textures) {
- SDL_Texture *tex = renderer->textures;
+ SDL_Texture *tex = renderer->textures; (void) tex;
SDL_DestroyTexture(renderer->textures);
SDL_assert(tex != renderer->textures); /* satisfy static analysis. */
}
diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c
index 5e6f930..e90604e 100644
--- a/src/video/SDL_blit_A.c
+++ b/src/video/SDL_blit_A.c
@@ -1317,9 +1317,9 @@
case 3:
default:
- return BlitNtoNPixelAlpha;
+ break;
}
- break;
+ return BlitNtoNPixelAlpha;
case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
if (sf->Amask == 0) {
diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c
index 14f57d3..1e77b98 100644
--- a/src/video/SDL_bmp.c
+++ b/src/video/SDL_bmp.c
@@ -124,6 +124,9 @@
Uint32 biClrUsed = 0;
/* Uint32 biClrImportant = 0; */
+ (void) haveRGBMasks;
+ (void) haveAlphaMask;
+
/* Make sure we are passed a valid data source */
surface = NULL;
was_error = SDL_FALSE;