Fix compiler warnings in Native Client and Linux builds.
--- a/include/begin_code.h Fri Jun 20 11:01:05 2014 -0300
+++ b/include/begin_code.h Fri Jun 20 11:10:16 2014 -0300
@@ -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__)
--- a/src/audio/SDL_wave.c Fri Jun 20 11:01:05 2014 -0300
+++ b/src/audio/SDL_wave.c Fri Jun 20 11:10:16 2014 -0300
@@ -121,7 +121,8 @@
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 @@
} 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;
--- a/src/stdlib/SDL_iconv.c Fri Jun 20 11:01:05 2014 -0300
+++ b/src/stdlib/SDL_iconv.c Fri Jun 20 11:10:16 2014 -0300
@@ -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
--- a/src/test/SDL_test_harness.c Fri Jun 20 11:01:05 2014 -0300
+++ b/src/test/SDL_test_harness.c Fri Jun 20 11:10:16 2014 -0300
@@ -564,7 +564,7 @@
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) {
--- a/src/thread/pthread/SDL_sysmutex.c Fri Jun 20 11:01:05 2014 -0300
+++ b/src/thread/pthread/SDL_sysmutex.c Fri Jun 20 11:10:16 2014 -0300
@@ -20,7 +20,9 @@
*/
#include "../../SDL_internal.h"
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <pthread.h>
#include <errno.h>
--- a/src/thread/pthread/SDL_systhread.c Fri Jun 20 11:01:05 2014 -0300
+++ b/src/thread/pthread/SDL_systhread.c Fri Jun 20 11:10:16 2014 -0300
@@ -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 @@
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__)
--- a/src/timer/unix/SDL_systimer.c Fri Jun 20 11:01:05 2014 -0300
+++ b/src/timer/unix/SDL_systimer.c Fri Jun 20 11:10:16 2014 -0300
@@ -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 @@
#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 @@
ticks += now.tv_nsec;
#elif defined(__APPLE__)
ticks = mach_absolute_time();
+#else
+ SDL_assert(SDL_FALSE);
+ ticks = 0;
#endif
} else {
struct timeval now;
--- a/src/video/SDL_blit_A.c Fri Jun 20 11:01:05 2014 -0300
+++ b/src/video/SDL_blit_A.c Fri Jun 20 11:10:16 2014 -0300
@@ -343,7 +343,7 @@
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 @@
mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */
multmask = 0x00FF;
multmask <<= (ashift * 2);
- multmask2 = 0x00FF00FF00FF00FF;
+ multmask2 = 0x00FF00FF00FF00FFULL;
while (height--) {
/* *INDENT-OFF* */
--- a/src/video/SDL_video.c Fri Jun 20 11:01:05 2014 -0300
+++ b/src/video/SDL_video.c Fri Jun 20 11:10:16 2014 -0300
@@ -3259,7 +3259,8 @@
#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;
--- a/src/video/nacl/SDL_naclwindow.c Fri Jun 20 11:01:05 2014 -0300
+++ b/src/video/nacl/SDL_naclwindow.c Fri Jun 20 11:10:16 2014 -0300
@@ -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"