[PATCH 29/37] xfree86/dri: Mark DRIDrvMsg and dri_drm_debug_print as gnu_printf. Fix resulting warnings.

Ian Romanick idr at freedesktop.org
Mon Nov 18 13:40:39 PST 2013


On 11/17/2013 12:01 AM, Keith Packard wrote:
> Signed-off-by: Keith Packard <keithp at keithp.com>

With Alan's suggestion, this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>  hw/xfree86/dri/dri.c | 30 ++++++++++++++++++------------
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
> index 6292e87..959288d 100644
> --- a/hw/xfree86/dri/dri.c
> +++ b/hw/xfree86/dri/dri.c
> @@ -100,6 +100,9 @@ drmServerInfo DRIDRMServerInfo;
>   * easily changed here.
>   */
>  #define DRI_MSG_VERBOSITY 1
> +#if defined(__GNUC__) && (__GNUC__ > 3)
> +__attribute__((format(gnu_printf, 3, 4)))
> +#endif
>  static void
>  DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
>  {
> @@ -400,7 +403,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
>          }
>          DRIDrvMsg(pScreen->myNum, X_INFO,
>                    "[drm] added %d byte SAREA at %p\n",
> -                  pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
> +                  (int) pDRIPriv->pDriverInfo->SAREASize, (void *) pDRIPriv->hSAREA);
>  
>          /* Backwards compat. */
>          if (drmMap(pDRIPriv->drmFD,
> @@ -414,7 +417,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
>              return FALSE;
>          }
>          DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
> -                  pDRIPriv->hSAREA, pDRIPriv->pSAREA);
> +                  (void *) pDRIPriv->hSAREA, pDRIPriv->pSAREA);
>          memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
>      }
>      else {
> @@ -442,7 +445,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
>              return FALSE;
>          }
>          DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
> -                  pDRIPriv->pDriverInfo->hFrameBuffer);
> +                  (void *) pDRIPriv->pDriverInfo->hFrameBuffer);
>      }
>      else {
>          DRIDrvMsg(pScreen->myNum, X_INFO,
> @@ -513,7 +516,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
>      pDRIPriv->myContextPriv = pDRIContextPriv;
>  
>      DRIDrvMsg(pScreen->myNum, X_INFO,
> -              "X context handle = %p\n", pDRIPriv->myContext);
> +              "X context handle = %p\n", (void *) pDRIPriv->myContext);
>  
>      /* Now that we have created the X server's context, we can grab the
>       * hardware lock for the X server.
> @@ -731,13 +734,13 @@ DRICloseScreen(ScreenPtr pScreen)
>          if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) {
>              DRIDrvMsg(pScreen->myNum, X_INFO,
>                        "[drm] unmapping %d bytes of SAREA %p at %p\n",
> -                      pDRIInfo->SAREASize, pDRIPriv->hSAREA, pDRIPriv->pSAREA);
> +                      (int) pDRIInfo->SAREASize, (void *) pDRIPriv->hSAREA, pDRIPriv->pSAREA);
>              if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
>                  DRIDrvMsg(pScreen->myNum, X_ERROR,
>                            "[drm] unable to unmap %d bytes"
>                            " of SAREA %p at %p\n",
> -                          pDRIInfo->SAREASize,
> -                          pDRIPriv->hSAREA, pDRIPriv->pSAREA);
> +                          (int) pDRIInfo->SAREASize,
> +                          (void *) pDRIPriv->hSAREA, pDRIPriv->pSAREA);
>              }
>          }
>          else {
> @@ -759,6 +762,9 @@ DRICloseScreen(ScreenPtr pScreen)
>  
>  #define DRM_MSG_VERBOSITY 3
>  
> +#if defined(__GNUC__) && (__GNUC__ > 3)
> +__attribute__((format(gnu_printf, 1, 0)))
> +#endif
>  static int
>  dri_drm_debug_print(const char *format, va_list ap)
>  {
> @@ -2214,9 +2220,9 @@ DRILock(ScreenPtr pScreen, int flags)
>      else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) {
>          DRIDrvMsg(pScreen->myNum, X_ERROR,
>                    "[DRI] Locking deadlock.\n"
> -                  "\tAlready locked with context %d,\n"
> -                  "\ttrying to lock with context %d.\n",
> -                  pDRIPriv->pLockingContext, pDRIPriv->myContext);
> +                  "\tAlready locked with context %p,\n"
> +                  "\ttrying to lock with context %p.\n",
> +                  pDRIPriv->pLockingContext, (void *) pDRIPriv->myContext);
>      }
>      (*pDRIPriv->pLockRefCount)++;
>  }
> @@ -2233,8 +2239,8 @@ DRIUnlock(ScreenPtr pScreen)
>          if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) {
>              DRIDrvMsg(pScreen->myNum, X_ERROR,
>                        "[DRI] Unlocking inconsistency:\n"
> -                      "\tContext %d trying to unlock lock held by context %d\n",
> -                      pDRIPriv->pLockingContext, pDRIPriv->myContext);
> +                      "\tContext %p trying to unlock lock held by context %p\n",
> +                      pDRIPriv->pLockingContext, (void *) pDRIPriv->myContext);
>          }
>          (*pDRIPriv->pLockRefCount)--;
>      }
> 



More information about the xorg-devel mailing list