Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Sep 2019 21:49:43 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352341 - head/contrib/libedit
Message-ID:  <201909142149.x8ELnhqE035300@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sat Sep 14 21:49:42 2019
New Revision: 352341
URL: https://svnweb.freebsd.org/changeset/base/352341

Log:
  Fix arm and aarch64 builds of libedit after r352275
  
  On arm and arm64, where chars are unsigned by default, buildworld dies
  with:
  
  --- terminal.o ---
  /usr/src/contrib/libedit/terminal.c:569:41: error: comparison of
  integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
  'unsigned int') [-Werror,-Wsign-compare]
                                       el->el_cursor.v][where & 0370] !=
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
  /usr/src/contrib/libedit/terminal.c:659:28: error: comparison of
  integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
  'unsigned int') [-Werror,-Wsign-compare]
                                       [el->el_cursor.h] == MB_FILL_CHAR)
                                       ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
  
  Fix this by making MB_FILL_CHAR a wint_t, so no casting is needed.
  
  Note that in https://reviews.freebsd.org/D21584 this was also proposed
  by Yuichiro Naito <naito.yuichiro_gmail.com>.
  
  Reviewed by:	bapt
  Subscribers:	naito.yuichiro_gmail.com, ml_vishwin.info
  MFC after:	3 weeks
  X-MFC-With:	r352275
  Differential Revision: https://reviews.freebsd.org/D21657

Modified:
  head/contrib/libedit/chartype.h
  head/contrib/libedit/terminal.c

Modified: head/contrib/libedit/chartype.h
==============================================================================
--- head/contrib/libedit/chartype.h	Sat Sep 14 21:18:10 2019	(r352340)
+++ head/contrib/libedit/chartype.h	Sat Sep 14 21:49:42 2019	(r352341)
@@ -87,7 +87,7 @@ libedit_private size_t ct_enc_width(wchar_t);
 /* The terminal is thought of in terms of X columns by Y lines. In the cases
  * where a wide character takes up more than one column, the adjacent
  * occupied column entries will contain this faux character. */
-#define MB_FILL_CHAR ((wchar_t)-1)
+#define MB_FILL_CHAR ((wint_t)-1)
 
 /* Visual width of character c, taking into account ^? , \0177 and \U+nnnnn
  * style visual expansions. */

Modified: head/contrib/libedit/terminal.c
==============================================================================
--- head/contrib/libedit/terminal.c	Sat Sep 14 21:18:10 2019	(r352340)
+++ head/contrib/libedit/terminal.c	Sat Sep 14 21:49:42 2019	(r352341)
@@ -1224,7 +1224,7 @@ terminal__putc(EditLine *el, wint_t c)
 {
 	char buf[MB_LEN_MAX +1];
 	ssize_t i;
-	if (c == (wint_t)MB_FILL_CHAR)
+	if (c == MB_FILL_CHAR)
 		return 0;
 	if (c & EL_LITERAL)
 		return fputs(literal_get(el, c), el->el_outfile);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909142149.x8ELnhqE035300>