From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alexander Kuleshov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed Date: Sat, 23 Jan 2016 12:28:57 +0600 Message-ID: <20160123062857.GA1205@localhost> References: <1453460084-19646-1-git-send-email-kuleshovmail@gmail.com> <56A2C41C.7030401@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1453530789 20804 80.91.229.3 (23 Jan 2016 06:33:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Jan 2016 06:33:09 +0000 (UTC) Cc: emacs-devel@gnu.org, Alexander Kuleshov To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 23 07:32:59 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aMrkl-0007SL-87 for ged-emacs-devel@m.gmane.org; Sat, 23 Jan 2016 07:32:55 +0100 Original-Received: from localhost ([::1]:56387 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMrkk-000648-CG for ged-emacs-devel@m.gmane.org; Sat, 23 Jan 2016 01:32:54 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMrkY-00063q-5G for emacs-devel@gnu.org; Sat, 23 Jan 2016 01:32:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMrkT-0000ME-6K for emacs-devel@gnu.org; Sat, 23 Jan 2016 01:32:42 -0500 Original-Received: from mail-lb0-x230.google.com ([2a00:1450:4010:c04::230]:35930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMrkS-0000M6-UB for emacs-devel@gnu.org; Sat, 23 Jan 2016 01:32:37 -0500 Original-Received: by mail-lb0-x230.google.com with SMTP id oh2so51669361lbb.3 for ; Fri, 22 Jan 2016 22:32:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=N7DhH1UMDck2ZBg7kSSbHIbjxtaRyxKeDKWxs3DJn9c=; b=v2vO6J3+WxnvWnuXz+82CBHdUooLoQY0xTdNR8F5zsiVJn2MI+AOWRyDNuiE+Ol7uM zOQxEWSXoHDfF6bGFYtEGIeywlMDdgjoTxa55sQgH1+EOnC30Gatu+ChORrIo5gssdU5 vg4Pf43V6ffkLjVXKj949KiO0+n1vYpf9tcKcbDY7QXJrkncWgcUFzFYAdmbSyTbn4R6 hlTcKnNFQN8CGMLeOvxOTot3z+3oMtG/GbtvcxJuFBHftmnxH7pbD6yb6Qib4LdeOpSD 0lDMpm0V44WWjZMUZoGeQyIfA8Y+fo9X37A0+ALYd2kdU2Ugb30gTg4rKbLptd8flFRe wXZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=N7DhH1UMDck2ZBg7kSSbHIbjxtaRyxKeDKWxs3DJn9c=; b=jTJkVrfqF1UVcLEkAUOFmEv/5irGo8dvmqAVdgTCsjTUoSPpT9twbA657G4SRbM9eH sdc0NGm3uH7avk6dvTpEiOtBeCYMxlkAn9llNeS/VExzmg8OI4kX7ajUPWR55xIz2h4j g1Yv6fPxs9yn1yhyl5nILjmp/OoWuI9kDW+yCBrG6bGl22tUtYTmGBhr7ceZVWGhQI4F D7TqvKXtZYgc7aqrCUbOk1IGjETyMhxTrorXhMnWauWNzM3zALv3w/zNNj05SQ1f0CEx /8yJwp+ExZSkffed/PAXVSbUTbwiephSQEX2dnFv4+OxZmi45sHGlqk6Pu/0nGSO+6Sm XayA== X-Gm-Message-State: AG10YOQkjJXbknvfm75Yf23MCJN7x3xP+ukx7bvo+DkCgcTY8K1ltqtB8yy63UKSrVOyAQ== X-Received: by 10.112.159.233 with SMTP id xf9mr2572745lbb.21.1453530755917; Fri, 22 Jan 2016 22:32:35 -0800 (PST) Original-Received: from localhost ([37.151.238.63]) by smtp.gmail.com with ESMTPSA id mp1sm1298281lbb.22.2016.01.22.22.32.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jan 2016 22:32:35 -0800 (PST) Content-Disposition: inline In-Reply-To: <56A2C41C.7030401@cs.ucla.edu> X-Operating-System: Linux X-Date: Sat Jan 23 12:14:21 ALMT 2016 User-Agent: Mutt/1.6.0-rc0 ((null)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c04::230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198617 Archived-At: 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.