all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alexander Kuleshov <kuleshovmail@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org, Alexander Kuleshov <kuleshovmail@gmail.com>
Subject: Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed
Date: Sat, 23 Jan 2016 12:28:57 +0600	[thread overview]
Message-ID: <20160123062857.GA1205@localhost> (raw)
In-Reply-To: <56A2C41C.7030401@cs.ucla.edu>

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.



  reply	other threads:[~2016-01-23  6:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 10:54 [PATCH] Fix compilation erorr when --enable-gcc-warnings passed Alexander Kuleshov
2016-01-23  0:06 ` Paul Eggert
2016-01-23  6:28   ` Alexander Kuleshov [this message]
2016-01-23  9:08     ` Paul Eggert
2016-01-23  9:23       ` Eli Zaretskii
2016-01-23  9:41         ` Paul Eggert
2016-01-23 11:57       ` Alexander Kuleshov
2016-01-23 12:04       ` Alexander Kuleshov
2016-01-23 12:37         ` Alexander Kuleshov
2016-01-24  0:49           ` Paul Eggert
2016-01-24  7:34             ` Alexander Kuleshov
2016-01-24  8:49               ` bug#22442: " Paul Eggert
2016-01-23  9:12     ` bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux Paul Eggert
2016-01-23  9:25       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160123062857.GA1205@localhost \
    --to=kuleshovmail@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.