[PATCH 28/44] xfree86/dri: Mark DRIDrvMsg and dri_drm_debug_print _X_ATTRIBUTE_PRINTF

Keith Packard keithp at keithp.com
Wed Dec 11 12:24:00 PST 2013


And fix resulting warnings.

Signed-off-by: Keith Packard <keithp at keithp.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
 hw/xfree86/dri/dri.c | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 6292e87..056fdfc 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -100,6 +100,11 @@ drmServerInfo DRIDRMServerInfo;
  * easily changed here.
  */
 #define DRI_MSG_VERBOSITY 1
+
+static void
+DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+    _X_ATTRIBUTE_PRINTF(3,4);
+
 static void
 DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
 {
@@ -400,7 +405,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 +419,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 +447,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 +518,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 +736,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 {
@@ -761,6 +766,10 @@ DRICloseScreen(ScreenPtr pScreen)
 
 static int
 dri_drm_debug_print(const char *format, va_list ap)
+    _X_ATTRIBUTE_PRINTF(1,0);
+
+static int
+dri_drm_debug_print(const char *format, va_list ap)
 {
     xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap);
     return 0;
@@ -2214,9 +2223,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 +2242,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)--;
     }
-- 
1.8.4.4



More information about the xorg-devel mailing list