summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2016-11-13 22:57:41 -0800
committerSam Lantinga <slouken@libsdl.org>2016-11-13 22:57:41 -0800
commit5e1151257d93764a306b6eaa5e6cfacfa2bf57a7 (patch)
treec4ad030a3c6d8af8dea229c6845b45a763256e76
parent34578b09f4eb34ae2f4c426e339b934c557ae9e2 (diff)
Patch from Sylvain to fix clang warnings
-rw-r--r--include/SDL_test_assert.h6
-rw-r--r--include/SDL_test_fuzzer.h28
-rw-r--r--include/SDL_test_images.h22
-rw-r--r--src/SDL.c5
-rw-r--r--src/audio/SDL_audio.c30
-rw-r--r--src/audio/SDL_sysaudio.h72
-rw-r--r--src/core/linux/SDL_ime.h8
-rw-r--r--src/core/linux/SDL_udev.c2
-rw-r--r--src/events/SDL_gesture.c8
-rw-r--r--src/events/SDL_mouse.c2
-rw-r--r--src/events/SDL_touch.c2
-rw-r--r--src/haptic/SDL_haptic.c2
-rw-r--r--src/haptic/SDL_syshaptic.h2
-rw-r--r--src/joystick/SDL_gamecontroller.c18
-rw-r--r--src/joystick/SDL_sysjoystick.h4
-rw-r--r--src/joystick/linux/SDL_sysjoystick.c7
-rw-r--r--src/power/SDL_power.c13
-rw-r--r--src/power/SDL_syspower.h68
-rw-r--r--src/power/linux/SDL_syspower.c1
-rw-r--r--src/render/opengl/SDL_shaders_gl.h2
-rw-r--r--src/render/opengles/SDL_render_gles.c2
-rw-r--r--src/render/opengles2/SDL_render_gles2.c6
-rw-r--r--src/render/software/SDL_blendfillrect.c2
-rw-r--r--src/render/software/SDL_blendline.c2
-rw-r--r--src/render/software/SDL_blendpoint.c8
-rw-r--r--src/render/software/SDL_rotate.c2
-rw-r--r--src/stdlib/SDL_string.c3
-rw-r--r--src/test/SDL_test_crc32.c3
-rw-r--r--src/test/SDL_test_fuzzer.c4
-rw-r--r--src/test/SDL_test_harness.c38
-rw-r--r--src/test/SDL_test_imageBlit.c6
-rw-r--r--src/test/SDL_test_imageBlitBlend.c10
-rw-r--r--src/test/SDL_test_imageFace.c2
-rw-r--r--src/test/SDL_test_imagePrimitives.c2
-rw-r--r--src/test/SDL_test_imagePrimitivesBlend.c2
-rw-r--r--src/test/SDL_test_log.c2
-rw-r--r--src/thread/SDL_systhread.h2
-rw-r--r--src/thread/SDL_thread_c.h2
-rw-r--r--src/thread/pthread/SDL_syscond.c2
-rw-r--r--src/thread/pthread/SDL_systls.c1
-rw-r--r--src/timer/unix/SDL_systimer.c1
-rw-r--r--src/video/SDL_RLEaccel.c2
-rw-r--r--src/video/SDL_blit_1.c14
-rw-r--r--src/video/SDL_bmp.c4
-rw-r--r--src/video/SDL_video.c8
-rw-r--r--src/video/x11/SDL_x11events.c2
-rw-r--r--src/video/x11/SDL_x11messagebox.c1
-rw-r--r--src/video/x11/SDL_x11modes.c12
-rw-r--r--src/video/x11/SDL_x11opengl.c3
-rw-r--r--src/video/x11/SDL_x11window.c2
50 files changed, 285 insertions, 167 deletions
diff --git a/include/SDL_test_assert.h b/include/SDL_test_assert.h
index 29277e1221..60288d3d25 100644
--- a/include/SDL_test_assert.h
+++ b/include/SDL_test_assert.h
@@ -80,12 +80,12 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,
/**
* \brief Resets the assert summary counters to zero.
*/
-void SDLTest_ResetAssertSummary();
+void SDLTest_ResetAssertSummary(void);
/**
* \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
*/
-void SDLTest_LogAssertSummary();
+void SDLTest_LogAssertSummary(void);
/**
@@ -93,7 +93,7 @@ void SDLTest_LogAssertSummary();
*
* \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
*/
-int SDLTest_AssertSummaryToTestResult();
+int SDLTest_AssertSummaryToTestResult(void);
#ifdef __cplusplus
}
diff --git a/include/SDL_test_fuzzer.h b/include/SDL_test_fuzzer.h
index 9603652b28..7bab25c067 100644
--- a/include/SDL_test_fuzzer.h
+++ b/include/SDL_test_fuzzer.h
@@ -68,14 +68,14 @@ void SDLTest_FuzzerInit(Uint64 execKey);
*
* \returns Generated integer
*/
-Uint8 SDLTest_RandomUint8();
+Uint8 SDLTest_RandomUint8(void);
/**
* Returns a random Sint8
*
* \returns Generated signed integer
*/
-Sint8 SDLTest_RandomSint8();
+Sint8 SDLTest_RandomSint8(void);
/**
@@ -83,14 +83,14 @@ Sint8 SDLTest_RandomSint8();
*
* \returns Generated integer
*/
-Uint16 SDLTest_RandomUint16();
+Uint16 SDLTest_RandomUint16(void);
/**
* Returns a random Sint16
*
* \returns Generated signed integer
*/
-Sint16 SDLTest_RandomSint16();
+Sint16 SDLTest_RandomSint16(void);
/**
@@ -98,7 +98,7 @@ Sint16 SDLTest_RandomSint16();
*
* \returns Generated integer
*/
-Sint32 SDLTest_RandomSint32();
+Sint32 SDLTest_RandomSint32(void);
/**
@@ -106,14 +106,14 @@ Sint32 SDLTest_RandomSint32();
*
* \returns Generated integer
*/
-Uint32 SDLTest_RandomUint32();
+Uint32 SDLTest_RandomUint32(void);
/**
* Returns random Uint64.
*
* \returns Generated integer
*/
-Uint64 SDLTest_RandomUint64();
+Uint64 SDLTest_RandomUint64(void);
/**
@@ -121,29 +121,29 @@ Uint64 SDLTest_RandomUint64();
*
* \returns Generated signed integer
*/
-Sint64 SDLTest_RandomSint64();
+Sint64 SDLTest_RandomSint64(void);
/**
* \returns random float in range [0.0 - 1.0[
*/
-float SDLTest_RandomUnitFloat();
+float SDLTest_RandomUnitFloat(void);
/**
* \returns random double in range [0.0 - 1.0[
*/
-double SDLTest_RandomUnitDouble();
+double SDLTest_RandomUnitDouble(void);
/**
* \returns random float.
*
*/
-float SDLTest_RandomFloat();
+float SDLTest_RandomFloat(void);
/**
* \returns random double.
*
*/
-double SDLTest_RandomDouble();
+double SDLTest_RandomDouble(void);
/**
* Returns a random boundary value for Uint8 within the given boundaries.
@@ -338,7 +338,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
*
* \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
*/
-char * SDLTest_RandomAsciiString();
+char * SDLTest_RandomAsciiString(void);
/**
@@ -371,7 +371,7 @@ char * SDLTest_RandomAsciiStringOfSize(int size);
/**
* Returns the invocation count for the fuzzer since last ...FuzzerInit.
*/
-int SDLTest_GetFuzzerInvocationCount();
+int SDLTest_GetFuzzerInvocationCount(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/include/SDL_test_images.h b/include/SDL_test_images.h
index 8c64b4feb4..1debaabb3e 100644
--- a/include/SDL_test_images.h
+++ b/include/SDL_test_images.h
@@ -55,17 +55,17 @@ typedef struct SDLTest_SurfaceImage_s {
} SDLTest_SurfaceImage_t;
/* Test images */
-SDL_Surface *SDLTest_ImageBlit();
-SDL_Surface *SDLTest_ImageBlitColor();
-SDL_Surface *SDLTest_ImageBlitAlpha();
-SDL_Surface *SDLTest_ImageBlitBlendAdd();
-SDL_Surface *SDLTest_ImageBlitBlend();
-SDL_Surface *SDLTest_ImageBlitBlendMod();
-SDL_Surface *SDLTest_ImageBlitBlendNone();
-SDL_Surface *SDLTest_ImageBlitBlendAll();
-SDL_Surface *SDLTest_ImageFace();
-SDL_Surface *SDLTest_ImagePrimitives();
-SDL_Surface *SDLTest_ImagePrimitivesBlend();
+SDL_Surface *SDLTest_ImageBlit(void);
+SDL_Surface *SDLTest_ImageBlitColor(void);
+SDL_Surface *SDLTest_ImageBlitAlpha(void);
+SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
+SDL_Surface *SDLTest_ImageBlitBlend(void);
+SDL_Surface *SDLTest_ImageBlitBlendMod(void);
+SDL_Surface *SDLTest_ImageBlitBlendNone(void);
+SDL_Surface *SDLTest_ImageBlitBlendAll(void);
+SDL_Surface *SDLTest_ImageFace(void);
+SDL_Surface *SDLTest_ImagePrimitives(void);
+SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/src/SDL.c b/src/SDL.c
index 9eef00cd34..ff2e938e0a 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -36,10 +36,7 @@
/* Initialization/Cleanup routines */
#if !SDL_TIMERS_DISABLED
-extern int SDL_TimerInit(void);
-extern void SDL_TimerQuit(void);
-extern void SDL_TicksInit(void);
-extern void SDL_TicksQuit(void);
+# include "timer/SDL_timer_c.h"
#endif
#if SDL_VIDEO_DRIVER_WINDOWS
extern int SDL_HelperWindowCreate(void);
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 460852d7f5..c7af699b50 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -33,36 +33,6 @@
static SDL_AudioDriver current_audio;
static SDL_AudioDevice *open_devices[16];
-/*
- * Not all of these will be compiled and linked in, but it's convenient
- * to have a complete list here and saves yet-another block of #ifdefs...
- * Please see bootstrap[], below, for the actual #ifdef mess.
- */
-extern AudioBootStrap PULSEAUDIO_bootstrap;
-extern AudioBootStrap ALSA_bootstrap;
-extern AudioBootStrap SNDIO_bootstrap;
-extern AudioBootStrap BSD_AUDIO_bootstrap;
-extern AudioBootStrap DSP_bootstrap;
-extern AudioBootStrap QSAAUDIO_bootstrap;
-extern AudioBootStrap SUNAUDIO_bootstrap;
-extern AudioBootStrap ARTS_bootstrap;
-extern AudioBootStrap ESD_bootstrap;
-extern AudioBootStrap NACLAUDIO_bootstrap;
-extern AudioBootStrap NAS_bootstrap;
-extern AudioBootStrap XAUDIO2_bootstrap;
-extern AudioBootStrap DSOUND_bootstrap;
-extern AudioBootStrap WINMM_bootstrap;
-extern AudioBootStrap PAUDIO_bootstrap;
-extern AudioBootStrap HAIKUAUDIO_bootstrap;
-extern AudioBootStrap COREAUDIO_bootstrap;
-extern AudioBootStrap DISKAUDIO_bootstrap;
-extern AudioBootStrap DUMMYAUDIO_bootstrap;
-extern AudioBootStrap FUSIONSOUND_bootstrap;
-extern AudioBootStrap ANDROIDAUDIO_bootstrap;
-extern AudioBootStrap PSPAUDIO_bootstrap;
-extern AudioBootStrap SNDIO_bootstrap;
-extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
-
/* Available audio drivers */
static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_PULSEAUDIO
diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h
index 943169bf7c..320ade0235 100644
--- a/src/audio/SDL_sysaudio.h
+++ b/src/audio/SDL_sysaudio.h
@@ -200,6 +200,78 @@ typedef struct AudioBootStrap
int demand_only; /* 1==request explicitly, or it won't be available. */
} AudioBootStrap;
+#if SDL_AUDIO_DRIVER_PULSEAUDIO
+extern AudioBootStrap PULSEAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_ALSA
+extern AudioBootStrap ALSA_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_SNDIO
+extern AudioBootStrap SNDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_BSD
+extern AudioBootStrap BSD_AUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_OSS
+extern AudioBootStrap DSP_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_QSA
+extern AudioBootStrap QSAAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_SUNAUDIO
+extern AudioBootStrap SUNAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_ARTS
+extern AudioBootStrap ARTS_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_ESD
+extern AudioBootStrap ESD_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_NACL
+extern AudioBootStrap NACLAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_NAS
+extern AudioBootStrap NAS_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_XAUDIO2
+extern AudioBootStrap XAUDIO2_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_DSOUND
+extern AudioBootStrap DSOUND_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_WINMM
+extern AudioBootStrap WINMM_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_PAUDIO
+extern AudioBootStrap PAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_HAIKU
+extern AudioBootStrap HAIKUAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_COREAUDIO
+extern AudioBootStrap COREAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_DISK
+extern AudioBootStrap DISKAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_DUMMY
+extern AudioBootStrap DUMMYAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_FUSIONSOUND
+extern AudioBootStrap FUSIONSOUND_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_ANDROID
+extern AudioBootStrap ANDROIDAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_PSP
+extern AudioBootStrap PSPAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_EMSCRIPTEN
+extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
+#endif
+
+
+
#endif /* _SDL_sysaudio_h */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/core/linux/SDL_ime.h b/src/core/linux/SDL_ime.h
index 22b31de398..35c42e2790 100644
--- a/src/core/linux/SDL_ime.h
+++ b/src/core/linux/SDL_ime.h
@@ -27,12 +27,12 @@
#include "SDL_stdinc.h"
#include "SDL_rect.h"
-extern SDL_bool SDL_IME_Init();
-extern void SDL_IME_Quit();
+extern SDL_bool SDL_IME_Init(void);
+extern void SDL_IME_Quit(void);
extern void SDL_IME_SetFocus(SDL_bool focused);
-extern void SDL_IME_Reset();
+extern void SDL_IME_Reset(void);
extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
extern void SDL_IME_UpdateTextRect(SDL_Rect *rect);
-extern void SDL_IME_PumpEvents();
+extern void SDL_IME_PumpEvents(void);
#endif /* _SDL_ime_h */
diff --git a/src/core/linux/SDL_udev.c b/src/core/linux/SDL_udev.c
index ae78ddd684..a80b34434d 100644
--- a/src/core/linux/SDL_udev.c
+++ b/src/core/linux/SDL_udev.c
@@ -280,7 +280,7 @@ SDL_UDEV_LoadLibrary(void)
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
#define OFF(x) ((x)%BITS_PER_LONG)
-#define BIT(x) (1UL<<OFF(x))
+/* #define BIT(x) (1UL<<OFF(x)) */
#define LONG(x) ((x)/BITS_PER_LONG)
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
diff --git a/src/events/SDL_gesture.c b/src/events/SDL_gesture.c
index 43914202c4..158c8d5351 100644
--- a/src/events/SDL_gesture.c
+++ b/src/events/SDL_gesture.c
@@ -71,9 +71,9 @@ typedef struct {
SDL_bool recording;
} SDL_GestureTouch;
-SDL_GestureTouch *SDL_gestureTouch;
-int SDL_numGestureTouches = 0;
-SDL_bool recordAll;
+static SDL_GestureTouch *SDL_gestureTouch;
+static int SDL_numGestureTouches = 0;
+static SDL_bool recordAll;
#if 0
static void PrintPath(SDL_FloatPoint *path)
@@ -468,7 +468,7 @@ static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id)
return NULL;
}
-int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
+static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
{
SDL_Event event;
event.mgesture.type = SDL_MULTIGESTURE;
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 4236a99011..fb4fae7472 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -82,6 +82,7 @@ SDL_GetMouseFocus(void)
return mouse->focus;
}
+#if 0
void
SDL_ResetMouse(void)
{
@@ -98,6 +99,7 @@ SDL_ResetMouse(void)
}
SDL_assert(mouse->buttonstate == 0);
}
+#endif
void
SDL_SetMouseFocus(SDL_Window * window)
diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
index c73827c964..918cf38c67 100644
--- a/src/events/SDL_touch.c
+++ b/src/events/SDL_touch.c
@@ -92,7 +92,7 @@ SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid)
return -1;
}
-SDL_Finger *
+static SDL_Finger *
SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id)
{
int index = SDL_GetFingerIndex(touch, id);
diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c
index ddce908d6b..f01a5939c6 100644
--- a/src/haptic/SDL_haptic.c
+++ b/src/haptic/SDL_haptic.c
@@ -25,7 +25,7 @@
#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
#include "SDL_assert.h"
-SDL_Haptic *SDL_haptics = NULL;
+static SDL_Haptic *SDL_haptics = NULL;
/*
diff --git a/src/haptic/SDL_syshaptic.h b/src/haptic/SDL_syshaptic.h
index 372cefacfe..a71d3a0967 100644
--- a/src/haptic/SDL_syshaptic.h
+++ b/src/haptic/SDL_syshaptic.h
@@ -62,7 +62,7 @@ struct _SDL_Haptic
extern int SDL_SYS_HapticInit(void);
/* Function to return the number of haptic devices plugged in right now */
-extern int SDL_SYS_NumHaptics();
+extern int SDL_SYS_NumHaptics(void);
/*
* Gets the device dependent name of the haptic device
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index 7b69b4ac57..2f32a32630 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -146,7 +146,7 @@ static void UpdateEventsForDeviceRemoval()
/*
* Event filter to fire controller events from joystick ones
*/
-int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
+static int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
{
switch(event->type) {
case SDL_JOYAXISMOTION:
@@ -291,7 +291,7 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
/*
* Helper function to scan the mappings database for a controller with the specified GUID
*/
-ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid)
+static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid)
{
ControllerMapping_t *pSupportedController = s_pSupportedControllers;
while (pSupportedController) {
@@ -389,7 +389,7 @@ const char* SDL_GameControllerGetStringForButton(SDL_GameControllerButton axis)
/*
* given a controller button name and a joystick name update our mapping structure with it
*/
-void SDL_PrivateGameControllerParseButton(const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping)
+static void SDL_PrivateGameControllerParseButton(const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping)
{
int iSDLButton = 0;
SDL_GameControllerButton button;
@@ -502,7 +502,7 @@ SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMappi
/*
* Make a new button mapping struct
*/
-void SDL_PrivateLoadButtonMapping(struct _SDL_ControllerMapping *pMapping, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping)
+static void SDL_PrivateLoadButtonMapping(struct _SDL_ControllerMapping *pMapping, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping)
{
int j;
@@ -538,7 +538,7 @@ void SDL_PrivateLoadButtonMapping(struct _SDL_ControllerMapping *pMapping, SDL_J
/*
* grab the guid string from a mapping string
*/
-char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
+static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
{
const char *pFirstComma = SDL_strchr(pMapping, ',');
if (pFirstComma) {
@@ -577,7 +577,7 @@ char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
/*
* grab the name string from a mapping string
*/
-char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
+static char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
{
const char *pFirstComma, *pSecondComma;
char *pchName;
@@ -604,7 +604,7 @@ char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
/*
* grab the button mapping string from a mapping string
*/
-char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping)
+static char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping)
{
const char *pFirstComma, *pSecondComma;
@@ -622,7 +622,7 @@ char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping)
/*
* Helper function to refresh a mapping
*/
-void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping)
+static void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping)
{
SDL_GameController *gamecontrollerlist = SDL_gamecontrollers;
while (gamecontrollerlist) {
@@ -699,7 +699,7 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString,
/*
* Helper function to determine pre-calculated offset to certain joystick mappings
*/
-ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
+static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
{
SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index);
ControllerMapping_t *mapping;
diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h
index f4cad05ec4..0d6d28c144 100644
--- a/src/joystick/SDL_sysjoystick.h
+++ b/src/joystick/SDL_sysjoystick.h
@@ -67,10 +67,10 @@ struct _SDL_Joystick
extern int SDL_SYS_JoystickInit(void);
/* Function to return the number of joystick devices plugged in right now */
-extern int SDL_SYS_NumJoysticks();
+extern int SDL_SYS_NumJoysticks(void);
/* Function to cause any queued joystick insertions to be processed */
-extern void SDL_SYS_JoystickDetect();
+extern void SDL_SYS_JoystickDetect(void);
/* Function to get the device-dependent name of a joystick */
extern const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index);
diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c
index 38a53e1906..e4f01a33dc 100644
--- a/src/joystick/linux/SDL_sysjoystick.c
+++ b/src/joystick/linux/SDL_sysjoystick.c
@@ -282,6 +282,7 @@ MaybeRemoveDevice(const char *path)
}
#endif
+#if ! SDL_USE_LIBUDEV
static int
JoystickInitWithoutUdev(void)
{
@@ -298,7 +299,7 @@ JoystickInitWithoutUdev(void)
return numjoysticks;
}
-
+#endif
#if SDL_USE_LIBUDEV
static int
@@ -342,9 +343,9 @@ SDL_SYS_JoystickInit(void)
#if SDL_USE_LIBUDEV
return JoystickInitWithUdev();
-#endif
-
+#else
return JoystickInitWithoutUdev();
+#endif
}
int SDL_SYS_NumJoysticks()
diff --git a/src/power/SDL_power.c b/src/power/SDL_power.c
index 016013b97c..d559ac2739 100644
--- a/src/power/SDL_power.c
+++ b/src/power/SDL_power.c
@@ -20,6 +20,7 @@
*/
#include "../SDL_internal.h"
#include "SDL_power.h"
+#include "SDL_syspower.h"
/*
* Returns SDL_TRUE if we have a definitive answer.
@@ -29,18 +30,6 @@ typedef SDL_bool
(*SDL_GetPowerInfo_Impl) (SDL_PowerState * state, int *seconds,
int *percent);
-SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *);
-SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *);
-
#ifndef SDL_POWER_DISABLED
#ifdef SDL_POWER_HARDWIRED
/* This is for things that _never_ have a battery */
diff --git a/src/power/SDL_syspower.h b/src/power/SDL_syspower.h
new file mode 100644
index 0000000000..70b883d60d
--- /dev/null
+++ b/src/power/SDL_syspower.h
@@ -0,0 +1,68 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../SDL_internal.h"
+
+/* These are functions that need to be implemented by a port of SDL */
+
+#ifndef _SDL_syspower_h
+#define _SDL_syspower_h
+
+#include "SDL_power.h"
+
+#ifndef SDL_POWER_DISABLED
+#ifdef SDL_POWER_LINUX /* in order of preference. More than could work. */
+SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *);
+SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *);
+#endif
+#ifdef SDL_POWER_WINDOWS /* handles Win32, Win64, PocketPC. */
+SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *);
+#endif
+#ifdef SDL_POWER_UIKIT /* handles iPhone/iPad/etc */
+SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *);
+#endif
+#ifdef SDL_POWER_MACOSX /* handles Mac OS X, Darwin. */
+SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *);
+#endif
+#ifdef SDL_POWER_HAIKU /* with BeOS euc.jp apm driver. Does this work on Haiku? */
+SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *);
+#endif
+#ifdef SDL_POWER_ANDROID /* handles Android. */
+SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *);
+#endif
+#ifdef SDL_POWER_PSP /* handles PSP. */
+SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *);
+#endif
+#ifdef SDL_POWER_WINRT /* handles WinRT */
+SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *);
+#endif
+#ifdef SDL_POWER_EMSCRIPTEN /* handles Emscripten */
+SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *);
+#endif
+
+#ifdef SDL_POWER_HARDWIRED
+SDL_bool SDL_GetPowerInfo_Hardwired(SDL_PowerState *, int *, int *);
+#endif
+#endif
+
+#endif /* _SDL_syspower_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c
index 793e266695..c25b449dfa 100644
--- a/src/power/linux/SDL_syspower.c
+++ b/src/power/linux/SDL_syspower.c
@@ -32,6 +32,7 @@
#include <fcntl.h>
#include "SDL_power.h"
+#include "../SDL_syspower.h"
static const char *proc_apm_path = "/proc/apm";
static const char *proc_acpi_battery_path = "/proc/acpi/battery";
diff --git a/src/render/opengl/SDL_shaders_gl.h b/src/render/opengl/SDL_shaders_gl.h
index 261627cc79..0b7d8ae483 100644
--- a/src/render/opengl/SDL_shaders_gl.h
+++ b/src/render/opengl/SDL_shaders_gl.h
@@ -34,7 +34,7 @@ typedef enum {
typedef struct GL_ShaderContext GL_ShaderContext;
-extern GL_ShaderContext * GL_CreateShaderContext();
+extern GL_ShaderContext * GL_CreateShaderContext(void);
extern void GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader);
extern void GL_DestroyShaderContext(GL_ShaderContext *ctx);
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index 71f5b3a7a0..fbed503cd5 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -214,7 +214,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data)
static SDL_GLContext SDL_CurrentContext = NULL;
-GLES_FBOList *
+static GLES_FBOList *
GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h)
{
GLES_FBOList *result = data->framebuffers;
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index c846a7b395..f956bd1422 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -307,7 +307,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data)
return 0;
}
-GLES2_FBOList *
+static GLES2_FBOList *
GLES2_GetFBO(GLES2_DriverContext *data, Uint32 w, Uint32 h)
{
GLES2_FBOList *result = data->framebuffers;
@@ -1923,7 +1923,9 @@ static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
* Renderer instantiation *
*************************************************************************************************/
+#ifdef ZUNE_HD
#define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B
+#endif
static void
GLES2_ResetState(SDL_Renderer *renderer)
@@ -1963,7 +1965,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
#ifndef ZUNE_HD
GLboolean hasCompiler;
#endif
- Uint32 window_flags;
+ Uint32 window_flags = 0; /* -Wconditional-uninitialized */
GLint window_framebuffer;
GLint value;
int profile_mask = 0, major = 0, minor = 0;
diff --git a/src/render/software/SDL_blendfillrect.c b/src/render/software/SDL_blendfillrect.c
index 7cfb274aef..74dadbd20d 100644
--- a/src/render/software/SDL_blendfillrect.c
+++ b/src/render/software/SDL_blendfillrect.c
@@ -245,7 +245,7 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect,
} else {
return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a);
}
- break;
+ /* break; -Wunreachable-code-break */
}
break;
default:
diff --git a/src/render/software/SDL_blendline.c b/src/render/software/SDL_blendline.c
index ef0d585316..d7d0f69533 100644
--- a/src/render/software/SDL_blendline.c
+++ b/src/render/software/SDL_blendline.c
@@ -685,7 +685,7 @@ SDL_CalculateBlendLineFunc(const SDL_PixelFormat * fmt)
} else {
return SDL_BlendLine_RGB2;
}
- break;
+ /* break; -Wunreachable-code-break */
case 4:
if (fmt->Rmask == 0x00FF0000) {
if (fmt->Amask) {
diff --git a/src/render/software/SDL_blendpoint.c b/src/render/software/SDL_blendpoint.c
index fc42dfe767..7c919dd8bf 100644
--- a/src/render/software/SDL_blendpoint.c
+++ b/src/render/software/SDL_blendpoint.c
@@ -235,13 +235,11 @@ SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r
switch (dst->format->Rmask) {
case 0x00FF0000:
if (!dst->format->Amask) {
- return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b,
- a);
+ return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, a);
} else {
- return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b,
- a);
+ return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, a);
}
- break;
+ /* break; -Wunreachable-code-break */
}
break;
default:
diff --git a/src/render/software/SDL_rotate.c b/src/render/software/SDL_rotate.c
index 29168a9862..5c899c346a 100644
--- a/src/render/software/SDL_rotate.c
+++ b/src/render/software/SDL_rotate.c
@@ -79,7 +79,7 @@ to a situation where the program can segfault.
/* !
\brief Lower limit of absolute zoom factor or rotation degrees.
*/
-#define VALUE_LIMIT 0.001
+/* #define VALUE_LIMIT 0.001 */
/* !
\brief Returns colorkey info for a surface
diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c
index 3e856b5f76..9198cfeafd 100644
--- a/src/stdlib/SDL_string.c
+++ b/src/stdlib/SDL_string.c
@@ -28,9 +28,10 @@
#include "SDL_stdinc.h"
-
+#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL) || !defined(HAVE_STRTOD)
#define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F'))
#define SDL_islowerhex(X) (((X) >= 'a') && ((X) <= 'f'))
+#endif
#define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4)
#define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF)
diff --git a/src/test/SDL_test_crc32.c b/src/test/SDL_test_crc32.c
index 6e1220881d..6d5715a3e1 100644
--- a/src/test/SDL_test_crc32.c
+++ b/src/test/SDL_test_crc32.c
@@ -69,7 +69,7 @@ int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
}
/* Complete CRC32 calculation on a memory block */
-
+/* un-used
int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
{
if (SDLTest_Crc32CalcStart(crcContext,crc32)) {
@@ -86,6 +86,7 @@ int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUin
return 0;
}
+*/
/* Start crc calculation */
diff --git a/src/test/SDL_test_fuzzer.c b/src/test/SDL_test_fuzzer.c
index 9ae653643b..0aeb79f05c 100644
--- a/src/test/SDL_test_fuzzer.c
+++ b/src/test/SDL_test_fuzzer.c
@@ -196,7 +196,7 @@ SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
*
* \returns Returns a random boundary value for the domain or 0 in case of error
*/
-Uint64
+static Uint64
SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
{
Uint64 b1, b2;
@@ -328,7 +328,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v
*
* \returns Returns a random boundary value for the domain or 0 in case of error
*/
-Sint64
+static Sint64
SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
{
Sint64 b1, b2;
diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c
index 4b86c7a0d1..7481582282 100644
--- a/src/test/SDL_test_harness.c
+++ b/src/test/SDL_test_harness.c
@@ -50,7 +50,7 @@ static Uint32 SDLTest_TestCaseTimeout = 3600;
*
* \returns The generated seed string
*/
-char *
+static char *
SDLTest_GenerateRunSeed(const int length)
{
char *seed = NULL;
@@ -97,8 +97,8 @@ SDLTest_GenerateRunSeed(const int length)
* \returns The generated execution key to initialize the fuzzer with.
*
*/
-Uint64
-SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration)
+static Uint64
+SDLTest_GenerateExecKey(const char *runSeed, char *suiteName, char *testName, int iteration)
{
SDLTest_Md5Context md5Context;
Uint64 *keys;
@@ -168,7 +168,7 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter
*
* \return Timer id or -1 on failure.
*/
-SDL_TimerID
+static SDL_TimerID
SDLTest_SetTestTimeout(int timeout, void (*callback)())
{
Uint32 timeoutInMilliseconds;
@@ -206,8 +206,8 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)())
/**
* \brief Timeout handler. Aborts test run and exits harness process.
*/
-void
- SDLTest_BailOut()
+static void
+SDLTest_BailOut()
{
SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");
exit(TEST_ABORTED); /* bail out from the test */
@@ -223,8 +223,8 @@ void
*
* \returns Test case result.
*/
-int
-SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun)
+static int
+SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun)
{
SDL_TimerID timer = 0;
int testCaseResult = 0;
@@ -313,7 +313,8 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference
}
/* Prints summary of all suites/tests contained in the given reference */
-void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
+#if 0
+static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
{
int suiteCounter;
int testCounter;
@@ -340,12 +341,13 @@ void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
}
}
}
+#endif
/* Gets a timer value in seconds */
-float GetClock()
+static float GetClock()
{
- float currentClock = (float)clock();
- return currentClock / (float)CLOCKS_PER_SEC;
+ float currentClock = clock() / (float) CLOCKS_PER_SEC;
+ return currentClock;
}
/**
@@ -370,7 +372,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
int testCounter;
int iterationCounter;
SDLTest_TestSuiteReference *testSuite;
- SDLTest_TestCaseReference *testCase;
+ const SDLTest_TestCaseReference *testCase;
const char *runSeed = NULL;
char *currentSuiteName;
char *currentTestName;
@@ -396,7 +398,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
Uint32 testPassedCount = 0;
Uint32 testSkippedCount = 0;
Uint32 countSum = 0;
- SDLTest_TestCaseReference **failedTests;
+ const SDLTest_TestCaseReference **failedTests;
/* Sanitize test iterations */
if (testIterations < 1) {
@@ -440,7 +442,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
}
/* Pre-allocate an array for tracking failed tests (potentially all test cases) */
- failedTests = (SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *));
+ failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *));
if (failedTests == NULL) {
SDLTest_LogError("Unable to allocate cache for failed tests");
SDL_Error(SDL_ENOMEM);
@@ -466,7 +468,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
testCounter = 0;
while (testSuite->testCases[testCounter] && testFilter == 0)
{
- testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
+ testCase = testSuite->testCases[testCounter];
testCounter++;
if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) {
/* Matched a test name */
@@ -521,7 +523,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
testCounter = 0;
while(testSuite->testCases[testCounter])
{
- testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
+ testCase = testSuite->testCases[testCounter];
currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
testCounter++;
@@ -562,7 +564,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
if (userExecKey != 0) {
execKey = userExecKey;
} else {
- execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
+ execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter);
}
SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey);
diff --git a/src/test/SDL_test_imageBlit.c b/src/test/SDL_test_imageBlit.c
index 5896ca0991..9cca2d9854 100644
--- a/src/test/SDL_test_imageBlit.c
+++ b/src/test/SDL_test_imageBlit.c
@@ -24,7 +24,7 @@
/* GIMP RGB C-Source image dump (blit.c) */
-const SDLTest_SurfaceImage_t SDLTest_imageBlit = {
+static const SDLTest_SurfaceImage_t SDLTest_imageBlit = {
80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@@ -561,7 +561,7 @@ SDL_Surface *SDLTest_ImageBlit()
return surface;
}
-const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@@ -1044,7 +1044,7 @@ SDL_Surface *SDLTest_ImageBlitColor()
return surface;
}
-const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
diff --git a/src/test/SDL_test_imageBlitBlend.c b/src/test/SDL_test_imageBlitBlend.c
index 6e8c2f1b41..3ee8445cf3 100644
--- a/src/test/SDL_test_imageBlitBlend.c
+++ b/src/test/SDL_test_imageBlitBlend.c
@@ -24,7 +24,7 @@
/* GIMP RGB C-Source image dump (alpha.c) */
-const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = {
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = {
80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@@ -601,7 +601,7 @@ SDL_Surface *SDLTest_ImageBlitBlendAdd()
return surface;
}
-const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@@ -1131,7 +1131,7 @@ SDL_Surface *SDLTest_ImageBlitBlend()
return surface;
}
-const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@@ -1561,7 +1561,7 @@ SDL_Surface *SDLTest_ImageBlitBlendMod()
return surface;
}
-const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
80, 60, 3,
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
@@ -2374,7 +2374,7 @@ SDL_Surface *SDLTest_ImageBlitBlendNone()
return surface;
}
-const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
+static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
diff --git a/src/test/SDL_test_imageFace.c b/src/test/SDL_test_imageFace.c
index 84f5037f4f..4f13cd80a4 100644
--- a/src/test/SDL_test_imageFace.c
+++ b/src/test/SDL_test_imageFace.c
@@ -24,7 +24,7 @@
/* GIMP RGBA C-Source image dump (face.c) */
-const SDLTest_SurfaceImage_t SDLTest_imageFace = {
+static const SDLTest_SurfaceImage_t SDLTest_imageFace = {
32, 32, 4,
"\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
"\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
diff --git a/src/test/SDL_test_imagePrimitives.c b/src/test/SDL_test_imagePrimitives.c
index 4ab48d2de3..8d562cc3e5 100644
--- a/src/test/SDL_test_imagePrimitives.c
+++ b/src/test/SDL_test_imagePrimitives.c
@@ -24,7 +24,7 @@
/* GIMP RGB C-Source image dump (primitives.c) */
-const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = {
+static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = {
80, 60, 3,
"\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
diff --git a/src/test/SDL_test_imagePrimitivesBlend.c b/src/test/SDL_test_imagePrimitivesBlend.c
index 5e538628e2..21974166a3 100644
--- a/src/test/SDL_test_imagePrimitivesBlend.c
+++ b/src/test/SDL_test_imagePrimitivesBlend.c
@@ -24,7 +24,7 @@
/* GIMP RGB C-Source image dump (alpha.c) */
-const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = {
+static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = {
80, 60, 3,
"\260e\15\222\356/\37\313\15\36\330\17K\3745D\3471\0\20\0D\3502D\3502<\321"
",\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0-\0\377\377"
diff --git a/src/test/SDL_test_log.c b/src/test/SDL_test_log.c
index a2f857f262..a22b10f6ba 100644
--- a/src/test/SDL_test_log.c
+++ b/src/test/SDL_test_log.c
@@ -50,7 +50,7 @@
*
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
*/
-char *SDLTest_TimestampToString(const time_t timestamp)
+static char *SDLTest_TimestampToString(const time_t timestamp)
{
time_t copy;
static char buffer[64];
diff --git a/src/thread/SDL_systhread.h b/src/thread/SDL_systhread.h
index 05a0125365..6d19427a3c 100644
--- a/src/thread/SDL_systhread.h
+++ b/src/thread/SDL_systhread.h
@@ -55,7 +55,7 @@ extern void SDL_SYS_WaitThread(SDL_Thread * thread);
extern void SDL_SYS_DetachThread(SDL_Thread * thread);
/* Get the thread local storage for this thread */
-extern SDL_TLSData *SDL_SYS_GetTLSData();
+extern SDL_TLSData *SDL_SYS_GetTLSData(void);
/* Set the thread local storage for this thread */
extern int SDL_SYS_SetTLSData(SDL_TLSData *data);
diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h
index 554325d6dc..e1eb171b27 100644
--- a/src/thread/SDL_thread_c.h
+++ b/src/thread/SDL_thread_c.h
@@ -82,7 +82,7 @@ typedef struct {
This is only intended as a fallback if getting real thread-local
storage fails or isn't supported on this platform.
*/
-extern SDL_TLSData *SDL_Generic_GetTLSData();
+extern SDL_TLSData *SDL_Generic_GetTLSData(void);
/* Set cross-platform, slow, thread local storage for this thread.
This is only intended as a fallback if getting real thread-local
diff --git a/src/thread/pthread/SDL_syscond.c b/src/thread/pthread/SDL_syscond.c
index 998ac55b3f..69790cbc1c 100644
--- a/src/thread/pthread/SDL_syscond.c
+++ b/src/thread/pthread/SDL_syscond.c
@@ -129,7 +129,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
switch (retval) {
case EINTR:
goto tryagain;
- break;
+ /* break; -Wunreachable-code-break */
case ETIMEDOUT:
retval = SDL_MUTEX_TIMEDOUT;
break;
diff --git a/src/thread/pthread/SDL_systls.c b/src/thread/pthread/SDL_systls.c
index 622ad02975..ba8503663c 100644
--- a/src/thread/pthread/SDL_systls.c
+++ b/src/thread/pthread/SDL_systls.c
@@ -20,6 +20,7 @@
*/
#include "../../SDL_internal.h"
#include "SDL_thread.h"
+#include "../SDL_systhread.h"
#include "../SDL_thread_c.h"
#include <pthread.h>
diff --git a/src/timer/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c
index 217fe327fa..b3e8933e95 100644
--- a/src/timer/unix/SDL_systimer.c
+++ b/src/timer/unix/SDL_systimer.c
@@ -29,6 +29,7 @@
#include "SDL_timer.h"
#include "SDL_assert.h"
+#include "../SDL_timer_c.h"
/* The clock_gettime provides monotonous time, so we should use it if
it's available. The clock_gettime function is behind ifdef
diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c
index 67baaf664e..4f8b0e7fc0 100644
--- a/src/video/SDL_RLEaccel.c
+++ b/src/video/SDL_RLEaccel.c
@@ -90,9 +90,11 @@
#include "SDL_blit.h"
#include "SDL_RLEaccel_c.h"
+/*
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
+*/
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
diff --git a/src/video/SDL_blit_1.c b/src/video/SDL_blit_1.c
index 69c15d08df..078d3fced2 100644
--- a/src/video/SDL_blit_1.c
+++ b/src/video/SDL_blit_1.c
@@ -70,12 +70,14 @@ Blit1to1(SDL_BlitInfo * info)
}
/* This is now endian dependent */
-#if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
-#define HI 1
-#define LO 0
-#else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */
-#define HI 0
-#define LO 1
+#ifndef USE_DUFFS_LOOP
+# if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
+# define HI 1
+# define LO 0
+# else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */
+# define HI 0
+# define LO 1
+# endif
#endif
static void
Blit1to2(SDL_BlitInfo * info)
diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c
index 2d9cf240b0..2cefcd1b59 100644
--- a/src/video/SDL_bmp.c
+++ b/src/video/SDL_bmp.c
@@ -43,8 +43,8 @@
/* Compression encodings for BMP files */
#ifndef BI_RGB
#define BI_RGB 0
-#define BI_RLE8 1
-#define BI_RLE4 2
+/* #define BI_RLE8 1 */
+/* #define BI_RLE4 2 */
#define BI_BITFIELDS 3
#endif
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 0a21ef5fc7..b8d362e043 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -46,9 +46,11 @@
#include "SDL_opengles2.h"
#endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */
+#if !SDL_VIDEO_OPENGL
#ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
#endif
+#endif
/* On Windows, windows.h defines CreateWindow */
#ifdef CreateWindow
@@ -3617,8 +3619,9 @@ SDL_IsScreenKeyboardShown(SDL_Window *window)
#include "x11/SDL_x11messagebox.h"
#endif
-// 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)
+
+#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11
+static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
{
SDL_SysWMinfo info;
SDL_Window *window = messageboxdata->window;
@@ -3634,6 +3637,7 @@ SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData
return (info.subsystem == drivertype);
}
}
+#endif
int
SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index 8d7e997856..cefd43310d 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -201,7 +201,7 @@ X11_IsWheelEvent(Display * display,XEvent * event,int * xticks,int * yticks)
On error, -1 is returned.
*/
-int X11_URIDecode(char *buf, int len) {
+static int X11_URIDecode(char *buf, int len) {
int ri, wi, di;
char decode = '\0';
if (buf == NULL || len < 0) {
diff --git a/src/video/x11/SDL_x11messagebox.c b/src/video/x11/SDL_x11messagebox.c
index fc8b1b26b5..a0a4a405e2 100644
--- a/src/video/x11/SDL_x11messagebox.c
+++ b/src/video/x11/SDL_x11messagebox.c
@@ -27,6 +27,7 @@
#include "SDL_x11video.h"
#include "SDL_x11dyn.h"
#include "SDL_assert.h"
+#include "SDL_x11messagebox.h"
#include <X11/keysym.h>
#include <locale.h>
diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c
index 29307b3a60..3749fb5943 100644
--- a/src/video/x11/SDL_x11modes.c
+++ b/src/video/x11/SDL_x11modes.c
@@ -134,14 +134,14 @@ X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo)
} else {
return SDL_PIXELFORMAT_INDEX4MSB;
}
- break;
+ /* break; -Wunreachable-code-break */
case 1:
if (BitmapBitOrder(display) == LSBFirst) {
return SDL_PIXELFORMAT_INDEX1LSB;
} else {
return SDL_PIXELFORMAT_INDEX1MSB;
}
- break;
+ /* break; -Wunreachable-code-break */
}
}
@@ -149,7 +149,7 @@ X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo)
}
/* Global for the error handler */
-int vm_event, vm_error = -1;
+static int vm_event, vm_error = -1;
#if SDL_VIDEO_DRIVER_X11_XINERAMA
static SDL_bool
@@ -349,7 +349,7 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen,
}
-int
+static int
X11_InitModes_XRandR(_THIS)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
@@ -569,7 +569,7 @@ CalculateXVidModeRefreshRate(const XF86VidModeModeInfo * info)
info->vtotal)) : 0;
}
-SDL_bool
+static SDL_bool
SetXVidModeModeInfo(const XF86VidModeModeInfo *info, SDL_DisplayMode *mode)
{
mode->w = info->hdisplay;
@@ -584,7 +584,7 @@ int
X11_InitModes(_THIS)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
- int snum, screen, screencount;
+ int snum, screen, screencount = 0;
#if SDL_VIDEO_DRIVER_X11_XINERAMA
int xinerama_major, xinerama_minor;
int use_xinerama = 0;
diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c
index 3c73f8ba5e..c29f71de8c 100644
--- a/src/video/x11/SDL_x11opengl.c
+++ b/src/video/x11/SDL_x11opengl.c
@@ -519,6 +519,7 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
return vinfo;
}
+#if 0
#ifndef GLXBadContext
#define GLXBadContext 0
#endif
@@ -528,6 +529,8 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
#ifndef GLXBadProfileARB
#define GLXBadProfileARB 13
#endif
+#endif
+
static int (*handler) (Display *, XErrorEvent *) = NULL;
static const char *errorHandlerOperation = NULL;
static int errorBase = 0;
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 668bce2257..7ed27baf81 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -44,7 +44,7 @@
#define _NET_WM_STATE_REMOVE 0l
#define _NET_WM_STATE_ADD 1l
-#define _NET_WM_STATE_TOGGLE 2l
+/* #define _NET_WM_STATE_TOGGLE 2l */
static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer win)
{