[Xorg-driver-geode] xf86-video-geode: one last compiler warning

Martin-Éric Racine martin-eric.racine at iki.fi
Sun Dec 25 09:48:09 PST 2011


25. joulukuuta 2011 19.24 Martin-Éric Racine
<martin-eric.racine at iki.fi> kirjoitti:
> Greetings,
>
> While making a last-minute distcheck before releasing 2.11.13, I
> noticed the following:
>
>  CC     lx_display.lo
> ../../src/lx_display.c: In function 'lx_crtc_gamma_set':
> ../../src/lx_display.c:360:9: warning: ISO C90 forbids mixed
> declarations and code [-Wdeclaration-after-statement]
>
> While it doesn't affect compilation using GNU tools, I'm sure that
> other platforms might have a fit. However, I'm not too familiar with
> the specific differences between various C standards, so I'm not sure
> what the fix would be. If anybody would have any answer for this, it
> would be most welcome.
>
> Season's greetings,
> Martin-Éric

Unless I misunderstood what's needed, the following would fix it:

diff --git a/src/lx_display.c b/src/lx_display.c
index 1f240f5..411d861 100644
--- a/src/lx_display.c
+++ b/src/lx_display.c
@@ -354,10 +354,11 @@ lx_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *
red, CARD16 * green,
      */

     for (i = 0; i < 256; i++) {
+        unsigned int val;
         (*red) &= 0xff00;
         (*green) &= 0xff00;
         (*blue) &= 0xff00;
-        unsigned int val = (*(red++) << 8) | *(green++) | (*(blue++) >> 8);
+        val = (*(red++) << 8) | *(green++) | (*(blue++) >> 8);

        df_set_video_palette_entry(i, val);
     }


Can anybody confirm my assertion or, alternately, provide a better fix?

Cheers!
Martin-Éric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lx_display_c90.patch
Type: text/x-c
Size: 555 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-driver-geode/attachments/20111225/345007cd/attachment.bin>


More information about the Xorg-driver-geode mailing list