From: Thomas Klausner <wiz@gatalith.at>
To: 73307@debbugs.gnu.org
Subject: bug#73307: Fix ctype(3) usage
Date: Mon, 16 Sep 2024 23:25:16 +0200 [thread overview]
Message-ID: <ZuiiPEivc38vMS5K@exadelic.gatalith.at> (raw)
[-- Attachment #1: Type: text/plain, Size: 1824 bytes --]
Tags: patch
When compiling emacs on NetBSD-10.99.12/amd64, I get the following
warning
In file included from /usr/include/ctype.h:100,
from fns.c:29:
fns.c: In function 'Fyes_or_no_p':
fns.c:3582:33: warning: array subscript has type 'char' [-Wchar-subscripts]
3582 | if ((len > 0) && !isspace (s[len - 1]))
| ^
The NetBSD man page for ctype(3): https://man.netbsd.org/ctype.3
is quite explicit about the problems with this - ctype(3) functions only
accept -1 and "unsigned char" and you can get very weird problems if
this is disregarded.
The attached patch adds the missing cast.
In GNU Emacs 31.0.50 (build 1, x86_64--netbsd, GTK+ Version 3.24.43,
cairo version 1.18.0) of 2024-09-16
Repository revision: f27553c30a772a0103d2e6762e4d7f588f302e4b
Repository branch: HEAD
System Description: NetBSD 10.99.12/amd64
Configured using:
'configure --srcdir=/scratch/wip/emacs-git/work/emacs
--localstatedir=/var --with-native-compilation --without-ns
--without-imagemagick --without-xaw3d --with-x-toolkit=gtk3
--prefix=/usr/pkg --build=x86_64--netbsd --host=x86_64--netbsd
--infodir=/usr/pkg/info --mandir=/usr/pkg/man
--enable-option-checking=yes 'CFLAGS=-O2 -g -g -fstack-clash-protection
-I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2
-I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0
-I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/harfbuzz
-I/usr/pkg/include/libdrm' 'CPPFLAGS=-g -I/usr/pkg/include
-I/usr/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib-2.0
-I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include
-I/usr/pkg/include/harfbuzz -I/usr/pkg/include/libdrm'
'LDFLAGS=-Wl,-R/usr/pkg/gcc14/lib -Wl,-zrelro -Wl,-znow -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib''
[-- Attachment #2: patch-src_fns.c --]
[-- Type: text/x-c, Size: 460 bytes --]
$NetBSD$
Fix ctype(3) usage.
--- src/fns.c.orig 2024-09-16 21:11:40.908684144 +0000
+++ src/fns.c
@@ -3579,7 +3579,7 @@ by a mouse, or by some window-system ges
{
char *s = SSDATA (prompt);
ptrdiff_t len = strlen (s);
- if ((len > 0) && !isspace (s[len - 1]))
+ if ((len > 0) && !isspace ((unsigned char)s[len - 1]))
prompt = CALLN (Fconcat, prompt, build_string (" "));
}
prompt = CALLN (Fconcat, prompt, Vyes_or_no_prompt);
next reply other threads:[~2024-09-16 21:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-16 21:25 Thomas Klausner [this message]
2024-09-17 11:52 ` bug#73307: Fix ctype(3) usage Eli Zaretskii
2024-09-17 11:55 ` Thomas Klausner
2024-09-18 0:05 ` Paul Eggert
2024-09-18 2:13 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-18 11:45 ` Eli Zaretskii
2024-09-18 15:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-18 15:35 ` Paul Eggert
2024-09-18 16:11 ` Eli Zaretskii
2024-09-18 16:22 ` Paul Eggert
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=ZuiiPEivc38vMS5K@exadelic.gatalith.at \
--to=wiz@gatalith.at \
--cc=73307@debbugs.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.