[Spice-devel] [PATCH] drmmode: Fix compilation warning

Christophe Fergeau cfergeau at redhat.com
Wed Oct 22 07:39:36 PDT 2014


One recent change introduced a gcc compilation warning:

  CC       qxl_drmmode.lo
qxl_drmmode.c: In function 'drmmode_set_mode_major':
qxl_drmmode.c:251:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
         CursorPtr cursor = xf86_config->cursor;

This commit moves the CursorPtr declaration to the top of the
drmmode_set_mode_major function in order to fix that warning.
---
 src/qxl_drmmode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c
index e9d6436..f8d5369 100644
--- a/src/qxl_drmmode.c
+++ b/src/qxl_drmmode.c
@@ -132,6 +132,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		     Rotation rotation, int x, int y)
 {
 	ScrnInfoPtr pScrn = crtc->scrn;
+	CursorPtr cursor;
 	xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
@@ -248,7 +249,7 @@ done:
 		crtc->active = TRUE;
 #endif
 
-        CursorPtr cursor = xf86_config->cursor;
+        cursor = xf86_config->cursor;
         if (cursor)
             drmmode_show_cursor(crtc);
 
-- 
2.1.0



More information about the Spice-devel mailing list