From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org, Po Lu <luangruo@yahoo.com>
Subject: Re: MinGW build on master broken by Gnulib update
Date: Thu, 5 Sep 2024 09:28:15 -0700 [thread overview]
Message-ID: <1b42ff1a-1e11-4d09-a4e2-0b51ceef5b85@cs.ucla.edu> (raw)
In-Reply-To: <86y1464pvo.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]
On 2024-09-04 22:43, Eli Zaretskii wrote:
> Gnulib moved the prototypes of sig2str and str2sig from sig2str.h to
> Gnulib's signal.h, evidently assuming that a build which uses the
> Gnulib sig2str will also use the Gnulib signal.h header, but that
> assumption is false for the MinGW build of Emacs, which omits
> lib/signal.h (because it clashes with some w32 code in Emacs).
>
> I fixed that temporarily by modifying lib/sig2str.h to include the
> missing stuff for MinGW, but this is really a Gnulib issue, and should
> be fixed in Gnulib, IMO.
The change to Gnulib was to align with POSIX.1-2024, which declares
sig2str and str2sig in <signal.h>; see:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/sig2str.html
We don't want sig2str callers to depart from the POSIX API, any more
than we'd want to require (say) fdopen callers to include a
Gnulib-specific fdopen.h rather than including <stdio.h>.
Instead, how about adjusting Emacs's MinGW shims to supply the missing
declarations? Something like the attached patch, say. (I don't use MinGW
so can't easily test this.)
[-- Attachment #2: 0001-Move-MinGW-sig2str-workaround-into-ms-w32.h.patch --]
[-- Type: text/x-patch, Size: 2001 bytes --]
From 0c17a34cdfbab86b4b44ea2b123f6d072e00ab79 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 5 Sep 2024 09:22:41 -0700
Subject: [PATCH] Move MinGW sig2str workaround into ms-w32.h
* lib/sig2str.h: Go back to syncing exactly with Gnulib.
* nt/inc/ms-w32.h (SIG2STR_MAX): New macro.
(sig2str, str2sig): New decls.
---
lib/sig2str.h | 20 --------------------
nt/inc/ms-w32.h | 7 +++++++
2 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/lib/sig2str.h b/lib/sig2str.h
index 62b6d628f12..1abdb140e5a 100644
--- a/lib/sig2str.h
+++ b/lib/sig2str.h
@@ -17,28 +17,8 @@
/* Written by Paul Eggert. */
-/* This file uses HAVE_* macros. */
-# if !_GL_CONFIG_H_INCLUDED
-# error "Please include config.h first."
-# endif
-
#include <signal.h>
-/* Maximum size of a signal name returned by sig2str(), including the
- terminating NUL byte. */
-#ifndef SIG2STR_MAX
-/* The longest one: "RTMAX", then "+" or "-", then up to 10 digits, then NUL.
- Add + 2 as a reserve for the future. */
-# define SIG2STR_MAX (5 + 1 + 10 + 1 + 2)
-#endif
-
-#ifdef __MINGW32__
-int sig2str (int, char *);
-#endif
-#ifdef __MINGW32__
-int str2sig (char const *, int *);
-#endif
-
/* An upper bound on signal numbers allowed by the system. */
#if defined _sys_nsig
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 7212e4d2984..55273cbce79 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -427,6 +427,13 @@ #define SIG_BLOCK 1
#define SIG_SETMASK 2
#define SIG_UNBLOCK 3
+/* Maximum size of a signal name returned by sig2str(), including the
+ terminating NUL byte. The longest one: "RTMAX", then "+" or "-",
+ then up to 10 digits, then NUL. Add + 2 as a reserve for the future. */
+#define SIG2STR_MAX (5 + 1 + 10 + 1 + 2)
+
+extern int sig2str (int, char *);
+extern int str2sig (char const *, int *);
extern int sigemptyset (sigset_t *);
extern int sigaddset (sigset_t *, int);
extern int sigfillset (sigset_t *);
--
2.43.0
next prev parent reply other threads:[~2024-09-05 16:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 5:43 MinGW build on master broken by Gnulib update Eli Zaretskii
2024-09-05 16:28 ` Paul Eggert [this message]
2024-09-05 18:02 ` Eli Zaretskii
2024-09-05 18:49 ` Paul Eggert
2024-09-06 6:48 ` Eli Zaretskii
2024-09-06 9:52 ` Bruno Haible
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=1b42ff1a-1e11-4d09-a4e2-0b51ceef5b85@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=luangruo@yahoo.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 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.