From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 6cd5678: Clarify compiler-pacifier in frame.c Date: Sat, 24 Aug 2019 17:52:05 -0700 Organization: UCLA Computer Science Department Message-ID: <227db16b-17d1-b44b-97b3-e80211415eef@cs.ucla.edu> References: <835zmnjdjm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------D70D3798CDFE0D83D9F7EE89" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="259684"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 25 02:52:20 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i1glX-0015S9-LS for ged-emacs-devel@m.gmane.org; Sun, 25 Aug 2019 02:52:19 +0200 Original-Received: from localhost ([::1]:39992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1glW-0007oe-Jr for ged-emacs-devel@m.gmane.org; Sat, 24 Aug 2019 20:52:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56970) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1glP-0007oY-T1 for emacs-devel@gnu.org; Sat, 24 Aug 2019 20:52:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i1glO-00026c-RI for emacs-devel@gnu.org; Sat, 24 Aug 2019 20:52:11 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:35812) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i1glN-00024Q-5e; Sat, 24 Aug 2019 20:52:09 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 32BBE160057; Sat, 24 Aug 2019 17:52:07 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id MLI6aeBzwN5W; Sat, 24 Aug 2019 17:52:06 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 52FFB160079; Sat, 24 Aug 2019 17:52:06 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id E9GBDBmfOYAy; Sat, 24 Aug 2019 17:52:06 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 24FF3160057; Sat, 24 Aug 2019 17:52:06 -0700 (PDT) In-Reply-To: <835zmnjdjm.fsf@gnu.org> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.org gmane.emacs.devel:239540 Archived-At: This is a multi-part message in MIME format. --------------D70D3798CDFE0D83D9F7EE89 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Eli Zaretskii wrote: > when geometry is non-zero, x and y are > initialized. And that means the initializations "x = 0, y = 0" were indeed unnecessary. The code works just fine without those initializations, because the values of x and y are not examined unless XParseGeometry has successfully set them. Newer GCC is smart enough to figure this out, at least with the default optimizations. Other platforms evidently aren't smart enough. > If we > want this to be abundantly clear, we should have a comment there to > the above effect. Sure, I installed the attached. --------------D70D3798CDFE0D83D9F7EE89 Content-Type: text/x-patch; name="0001-Clarify-Fx_parse_geometry-initialization.patch" Content-Disposition: attachment; filename="0001-Clarify-Fx_parse_geometry-initialization.patch" Content-Transfer-Encoding: quoted-printable >From 84f1674ee8cbd83ea219595e9adec2d148946976 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 24 Aug 2019 17:46:21 -0700 Subject: [PATCH] Clarify Fx_parse_geometry initialization MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * src/frame.c (Fx_parse_geometry): Clarify why local init isn=E2=80=99t needed. --- src/frame.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/frame.c b/src/frame.c index 330f98aee1..cf38c85f09 100644 --- a/src/frame.c +++ b/src/frame.c @@ -5327,9 +5327,10 @@ DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_p= arse_geometry, 1, 1, 0, On Nextstep, this just calls `ns-parse-geometry'. */) (Lisp_Object string) { - int geometry, x UNINIT, y UNINIT; + /* x and y don't need initialization, as they are not accessed + unless XParseGeometry sets them. */ + int x UNINIT, y UNINIT; unsigned int width, height; - Lisp_Object result; =20 CHECK_STRING (string); =20 @@ -5337,9 +5338,9 @@ DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_pa= rse_geometry, 1, 1, 0, if (strchr (SSDATA (string), ' ') !=3D NULL) return call1 (Qns_parse_geometry, string); #endif - geometry =3D XParseGeometry (SSDATA (string), - &x, &y, &width, &height); - result =3D Qnil; + int geometry =3D XParseGeometry (SSDATA (string), + &x, &y, &width, &height); + Lisp_Object result =3D Qnil; if (geometry & XValue) { Lisp_Object element; --=20 2.17.1 --------------D70D3798CDFE0D83D9F7EE89--