From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 6cd5678: Clarify compiler-pacifier in frame.c
Date: Sat, 24 Aug 2019 17:52:05 -0700 [thread overview]
Message-ID: <227db16b-17d1-b44b-97b3-e80211415eef@cs.ucla.edu> (raw)
In-Reply-To: <835zmnjdjm.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 575 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Clarify-Fx_parse_geometry-initialization.patch --]
[-- Type: text/x-patch; name="0001-Clarify-Fx_parse_geometry-initialization.patch", Size: 1534 bytes --]
From 84f1674ee8cbd83ea219595e9adec2d148946976 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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=UTF-8
Content-Transfer-Encoding: 8bit
* src/frame.c (Fx_parse_geometry): Clarify why local init
isn’t 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_parse_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;
CHECK_STRING (string);
@@ -5337,9 +5338,9 @@ DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,
if (strchr (SSDATA (string), ' ') != NULL)
return call1 (Qns_parse_geometry, string);
#endif
- geometry = XParseGeometry (SSDATA (string),
- &x, &y, &width, &height);
- result = Qnil;
+ int geometry = XParseGeometry (SSDATA (string),
+ &x, &y, &width, &height);
+ Lisp_Object result = Qnil;
if (geometry & XValue)
{
Lisp_Object element;
--
2.17.1
next prev parent reply other threads:[~2019-08-25 0:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-24 6:14 [Emacs-diffs] master 6cd5678: Clarify compiler-pacifier in frame.c Eli Zaretskii
2019-08-25 0:52 ` Paul Eggert [this message]
2019-08-25 7:13 ` Eli Zaretskii
2019-08-26 6:34 ` Paul Eggert
2019-08-26 7:54 ` Eli Zaretskii
2019-08-26 8:15 ` Paul Eggert
2019-08-26 9:47 ` Eli Zaretskii
2019-08-26 15:21 ` Óscar Fuentes
2019-08-26 16:13 ` Eli Zaretskii
2019-08-26 18:20 ` Óscar Fuentes
2019-08-26 18:39 ` Eli Zaretskii
2019-08-26 19:09 ` Paul Eggert
2019-08-26 19:15 ` Óscar Fuentes
2019-08-26 19:33 ` Eli Zaretskii
2019-08-26 19:49 ` Óscar Fuentes
2019-08-26 22:33 ` Paul Eggert
2019-08-27 6:12 ` Eli Zaretskii
2019-08-27 7:28 ` Paul Eggert
2019-08-27 8:02 ` Eli Zaretskii
2019-08-27 9:28 ` Paul Eggert
2019-08-27 10:15 ` Eli Zaretskii
2019-08-27 12:05 ` Paul Eggert
2019-08-27 12:43 ` Eli Zaretskii
2019-08-26 18:50 ` Paul Eggert
2019-08-26 18:56 ` Eli Zaretskii
2019-08-26 23:17 ` Richard Stallman
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=227db16b-17d1-b44b-97b3-e80211415eef@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=eliz@gnu.org \
--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.