[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed
From: |
Alexander Kuleshov |
Subject: |
Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed |
Date: |
Sat, 23 Jan 2016 12:28:57 +0600 |
User-agent: |
Mutt/1.6.0-rc0 ((null)) |
Hello Paul,
On 01-22-16, Paul Eggert wrote:
> On 01/22/2016 02:54 AM, Alexander Kuleshov wrote:
> >@@ -4615,16 +4622,15 @@ colors_in_color_table (int *n)
> > static unsigned long
> > lookup_rgb_color (struct frame *f, int r, int g, int b)
> > {
> >- unsigned long pixel;
> >-
> > #ifdef HAVE_NTGUI
> >- pixel = PALETTERGB (r >> 8, g >> 8, b >> 8);
> >+ return PALETTERGB (r >> 8, g >> 8, b >> 8);
> > #endif /* HAVE_NTGUI */
> > #ifdef HAVE_NS
> >- pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
> >+ return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
> > #endif /* HAVE_NS */
> >- return pixel;
> >+
> >+ return 0;
> > }
>
> Does this change cause lookup_rgb_color to always return 0 on platforms
> other than MS-Windows and NextStep? Is this the right thing to do? This part
> of the change isn't mentioned in the draft ChangeLog entry, so I'm a bit
> lost as to the motivation.
Some motivation: Previous version was:
static unsigned long
lookup_rgb_color (struct frame *f, int r, int g, int b)
{
unsigned long pixel;
#ifdef HAVE_NTGUI
pixel = PALETTERGB (r >> 8, g >> 8, b >> 8);
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
#endif /* HAVE_NS */
return pixel;
}
So, during compilation with enabled warnings, we will get following
error:
image.c: In function ‘lookup_rgb_color’:
image.c:4634:10: error: ‘pixel’ is used uninitialized in this function
[-Werror=uninitialized]
return pixel;
And seems that this version of the lookup_rgb_color() is only for these
platforms, because I see that the src/image.c contains yet another
implementation of the lookup_rgb_color() for platforms where
COLOR_TABLE_SUPPORT is enabled.
- [PATCH] Fix compilation erorr when --enable-gcc-warnings passed, Alexander Kuleshov, 2016/01/22
- Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed, Paul Eggert, 2016/01/22
- Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed,
Alexander Kuleshov <=
- Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed, Alexander Kuleshov, 2016/01/23
- Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed, Alexander Kuleshov, 2016/01/23
- Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed, Alexander Kuleshov, 2016/01/23
- Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed, Paul Eggert, 2016/01/23
- Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed, Alexander Kuleshov, 2016/01/24