unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 32276@debbugs.gnu.org, Keith David Bershatsky <esq@lawlist.com>
Subject: bug#32276: char-width of a space is 0 when display-table entry has a face.
Date: Sat, 28 Jul 2018 15:37:50 -0700	[thread overview]
Message-ID: <b07c86f5-ebad-cc56-5e5a-04d71b27f087@cs.ucla.edu> (raw)
In-Reply-To: <m236w66582.wl%esq@lawlist.com>

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]

Unfortunately that change causes the emacs-26 build to fail for me:

make[1]: Entering directory '/home/eggert/src/gnu/emacs/emacs-26-sc/src'
   CC       character.o
In file included from character.c:34:0:
character.c: In function ‘char_width’:
lisp.h:1682:11: error: ‘c’ may be used uninitialized in this function 
[-Werror=maybe-uninitialized]
     ? ((a) + (unsigned) 0) op ((b) + (unsigned) 0)   \
            ^
character.c:292:10: note: ‘c’ was declared here
       int c;
           ^
cc1: all warnings being treated as errors
Makefile:376: recipe for target 'character.o' failed


Although the attached patch fixes this and presumably speeds up the code a bit 
when optimized, is this the right thing to do? I have not looked into the code 
carefully.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Adjust-recent-Bug-32276-fix.patch --]
[-- Type: text/x-patch; name="0001-Adjust-recent-Bug-32276-fix.patch", Size: 989 bytes --]

From 4c321dc8d6b059ddaf5aab137aadbae18a3cb5af Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 28 Jul 2018 15:36:04 -0700
Subject: [PATCH] Adjust recent Bug#32276 fix

* src/character.c (char_width): Make explicit the assumption that
a display character vector element is a character if is not a
glyph code.
---
 src/character.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/character.c b/src/character.c
index 48268e0..6af9825 100644
--- a/src/character.c
+++ b/src/character.c
@@ -293,8 +293,11 @@ char_width (int c, struct Lisp_Char_Table *dp)
 	    ch = AREF (disp, i);
 	    if (GLYPH_CODE_P (ch))
 	      c = GLYPH_CODE_CHAR (ch);
-	    else if (CHARACTERP (ch))
-	      c = XFASTINT (ch);
+	    else
+	      {
+		eassert (CHARACTERP (ch));
+		c = XFASTINT (ch);
+	      }
 	    int w = CHARACTER_WIDTH (c);
 	    if (INT_ADD_WRAPV (width, w, &width))
 	      string_overflow ();
-- 
2.7.4


  parent reply	other threads:[~2018-07-28 22:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-26  3:33 bug#32276: char-width of a space is 0 when display-table entry has a face Keith David Bershatsky
2018-07-27  9:34 ` Eli Zaretskii
2018-07-28 22:37 ` Paul Eggert [this message]
2018-07-29 14:45   ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=b07c86f5-ebad-cc56-5e5a-04d71b27f087@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=32276@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=esq@lawlist.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).