[Mesa-dev] [PATCH] mesa: silence some compilation warnings.

Ian Romanick idr at freedesktop.org
Thu May 12 10:48:35 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/12/2011 01:49 AM, zhigang gong wrote:
> glu.h: typedef void (GLAPIENTRYP _GLUfuncptr)(); causes the following
>        warning: function declaration isn't a prototype.
> egl:   When convert a (void *) to a int type, it's better to
>        convert to long firstly, otherwise in 64 bit envirnonment, it
>        causes compilation warning.

I would suggest using either uintptr_t / intptr_t (preferable) or
ptrdiff_t for this purpose.

> ---
>  include/GL/glu.h                    |    2 +-
>  src/egl/drivers/dri2/egl_dri2.c     |    4 ++--
>  src/egl/drivers/dri2/platform_drm.c |    4 ++--
>  src/egl/drivers/dri2/platform_x11.c |    2 +-
>  src/egl/main/eglapi.c               |    2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/GL/glu.h b/include/GL/glu.h
> index cd967ac..ba2228d 100644
> --- a/include/GL/glu.h
> +++ b/include/GL/glu.h
> @@ -284,7 +284,7 @@ typedef GLUtesselator GLUtriangulatorObj;
>  #define GLU_TESS_MAX_COORD 1.0e150
> 
>  /* Internal convenience typedefs */
> -typedef void (GLAPIENTRYP _GLUfuncptr)();
> +typedef void (GLAPIENTRYP _GLUfuncptr)(void);
> 
>  GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
>  GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index afab679..f5f5ac3 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -835,7 +835,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay
> *disp, _EGLContext *ctx,
>     struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
>     struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
>     struct dri2_egl_image *dri2_img;
> -   GLuint renderbuffer = (GLuint) buffer;
> +   GLuint renderbuffer =  (unsigned long) buffer;
> 
>     if (renderbuffer == 0) {
>        _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
> @@ -870,7 +870,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay
> *disp, _EGLContext *ctx,
> 
>     (void) ctx;
> 
> -   name = (EGLint) buffer;
> +   name = (unsigned long) buffer;
> 
>     err = _eglParseImageAttribList(&attrs, disp, attr_list);
>     if (err != EGL_SUCCESS)
> diff --git a/src/egl/drivers/dri2/platform_drm.c
> b/src/egl/drivers/dri2/platform_drm.c
> index 68912e3..cea8418 100644
> --- a/src/egl/drivers/dri2/platform_drm.c
> +++ b/src/egl/drivers/dri2/platform_drm.c
> @@ -596,7 +596,7 @@ dri2_get_device_name(int fd)
>        goto out;
>     }
> 
> -   device_name = udev_device_get_devnode(device);
> +   device_name = (char*)udev_device_get_devnode(device);
>     if (!device_name)
>            goto out;
>     device_name = strdup(device_name);
> @@ -690,7 +690,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
>     memset(dri2_dpy, 0, sizeof *dri2_dpy);
> 
>     disp->DriverData = (void *) dri2_dpy;
> -   dri2_dpy->fd = (int) disp->PlatformDisplay;
> +   dri2_dpy->fd = (long) disp->PlatformDisplay;
> 
>     dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
>     if (dri2_dpy->driver_name == NULL)
> diff --git a/src/egl/drivers/dri2/platform_x11.c
> b/src/egl/drivers/dri2/platform_x11.c
> index 5d4ac6a..90136f4 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -784,7 +784,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp,
> _EGLContext *ctx,
> 
>     (void) ctx;
> 
> -   drawable = (xcb_drawable_t) buffer;
> +   drawable = (xcb_drawable_t) (long)buffer;
>     xcb_dri2_create_drawable (dri2_dpy->conn, drawable);
>     attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;
>     buffers_cookie =
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 336ec23..9063752 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -1168,7 +1168,7 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
>  EGLDisplay EGLAPIENTRY
>  eglGetDRMDisplayMESA(int fd)
>  {
> -   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);
> +   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) (long)fd);
>     return _eglGetDisplayHandle(dpy);
>  }
> 
> --
> 1.7.3.1
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk3MHWwACgkQX1gOwKyEAw8WEwCfeHYZetkzmlLd17uN88sB2mej
pj0AnjJeNbAZ0c0Yu9zmAsA0a5W2+1Aq
=snFW
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list