From e3f4ca0d7141872bc86fafb45edd9773ddb38750 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 8 Jun 2015 01:13:51 -0400 Subject: [PATCH] configure/cmake/x11: Removed SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 test. This was the only thing that made SDL_config.h generate differently between 32 and 64-bit versions of Linux, so instead we force a function cast in our X11 code to match our dynamic loader version, which removes the compile error on some machines that prompted this test in the first place. Xlib never wrote to this data, so if you're on an older Xlib where this param wasn't const, your data should still be intact when we force the caller to think it was actually const after all. Fixes Bugzilla #1893. --- cmake/sdlchecks.cmake | 8 -------- configure.in | 12 ------------ include/SDL_config.h.cmake | 1 - include/SDL_config.h.in | 1 - src/video/x11/SDL_x11dyn.c | 2 +- src/video/x11/SDL_x11sym.h | 4 ---- 6 files changed, 1 insertion(+), 27 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index f390fcbd0..7ff0985fd 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -409,14 +409,6 @@ macro(CheckX11) set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1) endif() - check_c_source_compiles(" - #include - extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len); - int main(int argc, char **argv) {}" HAVE_CONST_XDATA32) - if(HAVE_CONST_XDATA32) - set(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1) - endif() - check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM) if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H) diff --git a/configure.in b/configure.in index 7aaac171e..75b2d21ab 100644 --- a/configure.in +++ b/configure.in @@ -1492,18 +1492,6 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma ]) AC_MSG_RESULT($have_const_param_XextAddDisplay) - AC_MSG_CHECKING(for const parameter to _XData32) - have_const_param_xdata32=no - AC_TRY_COMPILE([ - #include - extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len); - ],[ - ],[ - have_const_param_xdata32=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32) - ]) - AC_MSG_RESULT($have_const_param_xdata32) - dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent])) AC_MSG_CHECKING([for XGenericEvent]) have_XGenericEvent=no diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 52d9c92b8..c4324f803 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -305,7 +305,6 @@ #cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@ #cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@ #cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@ -#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32@ #cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@ #cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index d9fd62256..2c74868bd 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -308,7 +308,6 @@ #undef SDL_VIDEO_DRIVER_X11_XSHAPE #undef SDL_VIDEO_DRIVER_X11_XVIDMODE #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS -#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM #undef SDL_VIDEO_DRIVER_NACL diff --git a/src/video/x11/SDL_x11dyn.c b/src/video/x11/SDL_x11dyn.c index cea3d2bf1..58e97be7e 100644 --- a/src/video/x11/SDL_x11dyn.c +++ b/src/video/x11/SDL_x11dyn.c @@ -207,7 +207,7 @@ SDL_X11_LoadSymbols(void) #else /* no dynamic X11 */ #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ -#define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = fn; +#define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) fn; #include "SDL_x11sym.h" #undef SDL_X11_MODULE #undef SDL_X11_SYM diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h index c424b512a..d5bcdc268 100644 --- a/src/video/x11/SDL_x11sym.h +++ b/src/video/x11/SDL_x11sym.h @@ -203,11 +203,7 @@ SDL_X11_SYM(Bool,XShmQueryExtension,(Display* a),(a),return) */ #ifdef LONG64 SDL_X11_MODULE(IO_32BIT) -#if SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return) -#else -SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return) -#endif SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),) #endif