Skip to content
Permalink
Browse files

Fix compiler warnings in Native Client and Linux builds.

  • Loading branch information
sbc100 committed Jun 20, 2014
1 parent 6c5cb54 commit 7e52722dfd03ab3fb706c983fb0d7ea1e3984e66
@@ -41,6 +41,14 @@
# endif
#endif

#ifndef SDL_UNUSED
# ifdef __GNUC__
# define SDL_UNUSED __attribute__((unused))
# else
# define SDL_UNUSED
# endif
#endif

/* Some compilers use a special export keyword */
#ifndef DECLSPEC
# if defined(__WIN32__) || defined(__WINRT__)
@@ -121,7 +121,8 @@ MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
struct MS_ADPCM_decodestate *state[2];
Uint8 *freeable, *encoded, *decoded;
Sint32 encoded_len, samplesleft;
Sint8 nybble, stereo;
Sint8 nybble;
Uint8 stereo;
Sint16 *coeff[2];
Sint32 new_sample;

@@ -278,7 +279,8 @@ IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state, Uint8 nybble)
} else if (state->index < 0) {
state->index = 0;
}
step = step_table[state->index];
/* explicit cast to avoid gcc warning about using 'char' as array index */
step = step_table[(int)state->index];
delta = step >> 3;
if (nybble & 0x04)
delta += step;
@@ -32,7 +32,8 @@
If we get this wrong, it's just a warning, so no big deal.
*/
#if defined(_XGP6) || defined(__APPLE__) || \
(defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)))
(defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \
(defined(_NEWLIB_VERSION)))
#define ICONV_INBUF_NONCONST
#endif

@@ -564,7 +564,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
}

SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, (long long unsigned)execKey);
SDLTest_Log("Test Iteration %i: execKey %" PRIu64, iterationCounter, execKey);
testResult = SDLTest_RunTest(testSuite, testCase, execKey);

if (testResult == TEST_RESULT_PASSED) {
@@ -20,7 +20,9 @@
*/
#include "../../SDL_internal.h"

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <pthread.h>
#include <errno.h>

@@ -57,11 +57,13 @@

#include "SDL_assert.h"

#ifndef __NACL__
/* List of signals to mask in the subthreads */
static const int sig_list[] = {
SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCHLD, SIGWINCH,
SIGVTALRM, SIGPROF, 0
};
#endif

static void *
RunThread(void *data)
@@ -115,8 +117,10 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
void
SDL_SYS_SetupThread(const char *name)
{
#ifndef __NACL__
int i;
sigset_t mask;
#endif

if (name != NULL) {
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
@@ -28,6 +28,7 @@
#include <errno.h>

#include "SDL_timer.h"
#include "SDL_assert.h"

/* The clock_gettime provides monotonous time, so we should use it if
it's available. The clock_gettime function is behind ifdef
@@ -106,6 +107,9 @@ SDL_GetTicks(void)
#elif defined(__APPLE__)
uint64_t now = mach_absolute_time();
ticks = (((now - start_mach) * mach_base_info.numer) / mach_base_info.denom) / 1000000;
#else
SDL_assert(SDL_FALSE);
ticks = 0;
#endif
} else {
struct timeval now;
@@ -136,6 +140,9 @@ SDL_GetPerformanceCounter(void)
ticks += now.tv_nsec;
#elif defined(__APPLE__)
ticks = mach_absolute_time();
#else
SDL_assert(SDL_FALSE);
ticks = 0;
#endif
} else {
struct timeval now;
@@ -343,7 +343,7 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info)
mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */
multmask = 0x00FF;
multmask <<= (ashift * 2);
multmask2 = 0x00FF00FF00FF00FF;
multmask2 = 0x00FF00FF00FF00FFULL;

while (height--) {
/* *INDENT-OFF* */
@@ -530,7 +530,7 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info)
mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */
multmask = 0x00FF;
multmask <<= (ashift * 2);
multmask2 = 0x00FF00FF00FF00FF;
multmask2 = 0x00FF00FF00FF00FFULL;

while (height--) {
/* *INDENT-OFF* */
@@ -3259,7 +3259,8 @@ SDL_IsScreenKeyboardShown(SDL_Window *window)
#include "x11/SDL_x11messagebox.h"
#endif

static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
// This function will be unused if none of the above video drivers are present.
SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
{
SDL_SysWMinfo info;
SDL_Window *window = messageboxdata->window;
@@ -24,6 +24,8 @@

#include "../SDL_sysvideo.h"

#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include "SDL_naclvideo.h"
#include "SDL_naclwindow.h"

0 comments on commit 7e52722

Please sign in to comment.