Patch from Sylvain to fix clang warnings

This commit is contained in:
Sam Lantinga
2016-11-13 22:57:41 -08:00
parent c13a077d15
commit 57d01d7d67
50 changed files with 285 additions and 167 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -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) {

View File

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

View File

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

View File

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

View File

@@ -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)
{