Fixes for -Wdeclaration-after-statement
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index 64d3e8c..7f7d61a 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -864,6 +864,8 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
GLfloat minx, miny, maxx, maxy;
GLfloat minu, maxu, minv, maxv;
+ GLfloat vertices[8];
+ GLfloat texCoords[8];
GLES_ActivateRenderer(renderer);
@@ -924,9 +926,6 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
maxv *= texturedata->texh;
- GLfloat vertices[8];
- GLfloat texCoords[8];
-
vertices[0] = minx;
vertices[1] = miny;
vertices[2] = maxx;
@@ -965,6 +964,9 @@ GLES_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
GLfloat minx, miny, maxx, maxy;
GLfloat minu, maxu, minv, maxv;
GLfloat centerx, centery;
+ GLfloat vertices[8];
+ GLfloat texCoords[8];
+
GLES_ActivateRenderer(renderer);
@@ -1015,9 +1017,6 @@ GLES_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
maxv *= texturedata->texh;
- GLfloat vertices[8];
- GLfloat texCoords[8];
-
vertices[0] = minx;
vertices[1] = miny;
vertices[2] = maxx;
diff --git a/src/timer/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c
index 7934032..134c12a 100644
--- a/src/timer/unix/SDL_systimer.c
+++ b/src/timer/unix/SDL_systimer.c
@@ -86,11 +86,11 @@ SDL_InitTicks(void)
Uint32
SDL_GetTicks(void)
{
+ Uint32 ticks;
if (!ticks_started) {
SDL_InitTicks();
}
- Uint32 ticks;
if (has_monotonic_time) {
#if HAVE_CLOCK_GETTIME
struct timespec now;
@@ -115,11 +115,11 @@ SDL_GetTicks(void)
Uint64
SDL_GetPerformanceCounter(void)
{
+ Uint64 ticks;
if (!ticks_started) {
SDL_InitTicks();
}
- Uint64 ticks;
if (has_monotonic_time) {
#if HAVE_CLOCK_GETTIME
struct timespec now;
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index da29374..2fbbc79 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -305,12 +305,12 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
int
SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
{
+ EGLContext egl_context = (EGLContext) context;
+
if (!_this->egl_data) {
return SDL_SetError("OpenGL not initialized");
}
- EGLContext egl_context = (EGLContext) context;
-
/* The android emulator crashes badly if you try to eglMakeCurrent
* with a valid context and invalid surface, so we have to check for both here.
*/
@@ -330,11 +330,12 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
int
SDL_EGL_SetSwapInterval(_THIS, int interval)
{
+ EGLBoolean status;
+
if (_this->egl_data) {
return SDL_SetError("OpenGL ES context not active");
}
- EGLBoolean status;
status = _this->egl_data->eglSwapInterval(_this->egl_data->egl_display, interval);
if (status == EGL_TRUE) {
_this->egl_data->egl_swapinterval = interval;
@@ -363,13 +364,13 @@ SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface)
void
SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
{
+ EGLContext egl_context = (EGLContext) context;
+
/* Clean up GLES and EGL */
if (!_this->egl_data) {
return;
}
- EGLContext egl_context = (EGLContext) context;
-
if (!egl_context && egl_context != EGL_NO_CONTEXT) {
SDL_EGL_MakeCurrent(_this, NULL, NULL);
_this->egl_data->eglDestroyContext(_this->egl_data->egl_display, egl_context);
diff --git a/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c
index 13236a4..630c248 100644
--- a/src/video/SDL_fillrect.c
+++ b/src/video/SDL_fillrect.c
@@ -36,12 +36,13 @@
c128.m128_u32[3] = color;
#else
#define SSE_BEGIN \
+ __m128 c128; \
DECLARE_ALIGNED(Uint32, cccc[4], 16); \
cccc[0] = color; \
cccc[1] = color; \
cccc[2] = color; \
cccc[3] = color; \
- __m128 c128 = *(__m128 *)cccc;
+ c128 = *(__m128 *)cccc;
#endif
#define SSE_WORK \
@@ -59,11 +60,14 @@
static void \
SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
{ \
+ int i, n; \
+ Uint8 *p = NULL; \
+ \
SSE_BEGIN; \
\
while (h--) { \
- int i, n = w * bpp; \
- Uint8 *p = pixels; \
+ n = w * bpp; \
+ p = pixels; \
\
if (n > 63) { \
int adjust = 16 - ((uintptr_t)p & 15); \
@@ -94,11 +98,13 @@ SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
static void
SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
{
+ int i, n;
+ Uint8 *p = NULL;
+
SSE_BEGIN;
-
while (h--) {
- int i, n = w;
- Uint8 *p = pixels;
+ n = w;
+ p = pixels;
if (n > 63) {
int adjust = 16 - ((uintptr_t)p & 15);
@@ -152,11 +158,14 @@ DEFINE_SSE_FILLRECT(4, Uint32)
static void \
SDL_FillRect##bpp##MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
{ \
+ int i, n; \
+ Uint8 *p = NULL; \
+ \
MMX_BEGIN; \
\
while (h--) { \
- int i, n = w * bpp; \
- Uint8 *p = pixels; \
+ n = w * bpp; \
+ p = pixels; \
\
if (n > 63) { \
int adjust = 8 - ((uintptr_t)p & 7); \
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index 6919e77..0b577ec 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -173,11 +173,12 @@ static SDL_bool X11_IsWheelEvent(Display * display,XEvent * event,int * ticks)
*/
static char* X11_URIToLocal(char* uri) {
char *file = NULL;
+ SDL_bool local;
if (memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */
else if (strstr(uri,":/") != NULL) return file; /* wrong scheme */
- SDL_bool local = uri[0] != '/' || ( uri[0] != '\0' && uri[1] == '/' );
+ local = uri[0] != '/' || ( uri[0] != '\0' && uri[1] == '/' );
/* got a hostname? */
if ( !local && uri[0] == '/' && uri[2] != '/' ) {
@@ -267,6 +268,7 @@ X11_DispatchEvent(_THIS)
SDL_WindowData *data;
XEvent xevent;
int i;
+ XClientMessageEvent m;
SDL_zero(xevent); /* valgrind fix. --ryan. */
XNextEvent(display, &xevent);
@@ -549,7 +551,6 @@ X11_DispatchEvent(_THIS)
else if (xevent.xclient.message_type == videodata->XdndPosition) {
/* reply with status */
- XClientMessageEvent m;
memset(&m, 0, sizeof(XClientMessageEvent));
m.type = ClientMessage;
m.display = xevent.xclient.display;
@@ -568,7 +569,6 @@ X11_DispatchEvent(_THIS)
else if(xevent.xclient.message_type == videodata->XdndDrop) {
if (data->xdnd_req == None) {
/* say again - not interested! */
- XClientMessageEvent m;
memset(&m, 0, sizeof(XClientMessageEvent));
m.type = ClientMessage;
m.display = xevent.xclient.display;
@@ -841,7 +841,6 @@ X11_DispatchEvent(_THIS)
XFree(p.data);
/* send reply */
- XClientMessageEvent m;
SDL_memset(&m, 0, sizeof(XClientMessageEvent));
m.type = ClientMessage;
m.display = display;
diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c
index 6ddc0de..6796b7d 100644
--- a/src/video/x11/SDL_x11opengl.c
+++ b/src/video/x11/SDL_x11opengl.c
@@ -564,6 +564,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
XVisualInfo v, *vinfo;
int n;
GLXContext context = NULL, share_context;
+ PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = NULL;
if (_this->gl_config.share_with_current_context) {
share_context = (GLXContext)SDL_GL_GetCurrentContext();
@@ -617,7 +618,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
attribs[iattr++] = 0;
/* Get a pointer to the context creation function for GL 3.0 */
- PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs =
+ glXCreateContextAttribs =
(PFNGLXCREATECONTEXTATTRIBSARBPROC) _this->gl_data->
glXGetProcAddress((GLubyte *)
"glXCreateContextAttribsARB");
diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c
index cea2807..d8ab18e 100644
--- a/src/video/x11/SDL_x11shape.c
+++ b/src/video/x11/SDL_x11shape.c
@@ -36,6 +36,8 @@ X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned
SDL_WindowShaper*
X11_CreateShaper(SDL_Window* window) {
SDL_WindowShaper* result = NULL;
+ SDL_ShapeData* data = NULL;
+ int resized_properly;
#if SDL_VIDEO_DRIVER_X11_XSHAPE
if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */
@@ -44,12 +46,12 @@ X11_CreateShaper(SDL_Window* window) {
result->mode.mode = ShapeModeDefault;
result->mode.parameters.binarizationCutoff = 1;
result->userx = result->usery = 0;
- SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData));
+ data = SDL_malloc(sizeof(SDL_ShapeData));
result->driverdata = data;
data->bitmapsize = 0;
data->bitmap = NULL;
window->shaper = result;
- int resized_properly = X11_ResizeWindowShape(window);
+ resized_properly = X11_ResizeWindowShape(window);
SDL_assert(resized_properly == 0);
}
#endif
@@ -60,9 +62,9 @@ X11_CreateShaper(SDL_Window* window) {
int
X11_ResizeWindowShape(SDL_Window* window) {
SDL_ShapeData* data = window->shaper->driverdata;
+ unsigned int bitmapsize = window->w / 8;
SDL_assert(data != NULL);
- unsigned int bitmapsize = window->w / 8;
if(window->w % 8 > 0)
bitmapsize += 1;
bitmapsize *= window->h;
@@ -86,6 +88,10 @@ X11_ResizeWindowShape(SDL_Window* window) {
int
X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
+ SDL_ShapeData *data = NULL;
+ SDL_WindowData *windowdata = NULL;
+ Pixmap shapemask = NULL;
+
if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
return -1;
@@ -94,13 +100,13 @@ X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMo
return -2;
if(shape->w != shaper->window->w || shape->h != shaper->window->h)
return -3;
- SDL_ShapeData *data = shaper->driverdata;
+ data = shaper->driverdata;
/* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
SDL_CalculateShapeBitmap(shaper->mode,shape,data->bitmap,8);
- SDL_WindowData *windowdata = (SDL_WindowData*)(shaper->window->driverdata);
- Pixmap shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);
+ windowdata = (SDL_WindowData*)(shaper->window->driverdata);
+ shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);
XShapeCombineMask(windowdata->videodata->display,windowdata->xwindow, ShapeBounding, 0, 0,shapemask, ShapeSet);
XSync(windowdata->videodata->display,False);
diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c
index 83224bc..200e577 100644
--- a/src/video/x11/SDL_x11video.c
+++ b/src/video/x11/SDL_x11video.c
@@ -259,10 +259,11 @@ static int (*orig_x11_errhandler) (Display *, XErrorEvent *) = NULL;
static int
X11_SafetyNetErrHandler(Display * d, XErrorEvent * e)
{
+ SDL_VideoDevice *device = NULL;
/* if we trigger an error in our error handler, don't try again. */
if (!safety_net_triggered) {
safety_net_triggered = SDL_TRUE;
- SDL_VideoDevice *device = SDL_GetVideoDevice();
+ device = SDL_GetVideoDevice();
if (device != NULL) {
int i;
for (i = 0; i < device->num_displays; i++) {
diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
index 6d4b6aa..10b4228 100644
--- a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -206,14 +206,17 @@ void
X11_Xinput2SelectTouch(_THIS, SDL_Window *window)
{
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
+ SDL_VideoData *data = NULL;
+ XIEventMask eventmask;
+ unsigned char mask[3] = { 0,0,0 };
+ SDL_WindowData *window_data = NULL;
+
if (!X11_Xinput2IsMultitouchSupported()) {
return;
}
- SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
- XIEventMask eventmask;
- unsigned char mask[3] = { 0,0,0 };
- SDL_WindowData *window_data = (SDL_WindowData*)window->driverdata;
+ data = (SDL_VideoData *) _this->driverdata;
+ window_data = (SDL_WindowData*)window->driverdata;
eventmask.deviceid = XIAllMasterDevices;
eventmask.mask_len = sizeof(mask);