Fix some more compiler warnings on armcc.

This commit is contained in:
Ryan C. Gordon 2017-03-03 16:38:17 -05:00
parent d526b8a1e9
commit ca0bf151d5
8 changed files with 23 additions and 12 deletions

View File

@ -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.

View File

@ -1038,9 +1038,8 @@ SDL_ResampleAudioStream_si16_c2(SDL_AudioStream *stream, const void *_inbuf, con
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];

View File

@ -229,7 +229,7 @@ done:
}
#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];

View File

@ -569,7 +569,7 @@ SDL_ResetKeyboard(void)
#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_GetModState(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
return keyboard->modstate;
return (SDL_Keymod) keyboard->modstate;
}
void
@ -863,7 +863,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
{
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 @@ const char *
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 "";
}

View File

@ -382,7 +382,7 @@ SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString
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 @@ SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchSt
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 @@ static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
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)) {

View File

@ -1938,7 +1938,7 @@ SDL_DestroyRenderer(SDL_Renderer * renderer)
/* 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. */
}

View File

@ -1317,9 +1317,9 @@ SDL_CalculateBlitA(SDL_Surface * surface)
case 3:
default:
return BlitNtoNPixelAlpha;
}
break;
}
return BlitNtoNPixelAlpha;
case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
if (sf->Amask == 0) {

View File

@ -124,6 +124,9 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
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;