nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1From 2e3ea5ab32ed356c45e0a7a8db37924a77a1c949 Mon Sep 17 00:00:00 2001
2From: Marcin Serwin <marcin@serwin.dev>
3Date: Sat, 20 Dec 2025 12:51:13 +0100
4Subject: [PATCH] Fix wcwidth declaration
5
6The wcwidth function is declared in `wchar.h` on POSIX systems which
7is not included in the default Autoconf includes. Because of this
8HAVE_DECL_WCWIDTH would be configured to 0.
9
10Since C23 functions with no arguments in prototypes are treated as
11taking no arguments. This results in mismatched declaration since in
12wchar.h the functions is declared as taking wchar_t.
13
14Signed-off-by: Marcin Serwin <marcin@serwin.dev>
15---
16 configure.ac | 2 +-
17 mbswidth.c | 2 +-
18 2 files changed, 2 insertions(+), 2 deletions(-)
19
20diff --git a/configure.ac b/configure.ac
21index 7d756ee..a1ecbe2 100644
22--- a/configure.ac
23+++ b/configure.ac
24@@ -61,7 +61,7 @@ AC_CHECK_HEADER(wchar.h,[
25 AC_DEFINE(HAVE_WCHAR_H, 1, [Define if you have the <wchar.h> header file.])],
26 [ac_have_wchar_h=no])
27 AC_CHECK_FUNCS(mbtowc wcwidth mbrtowc mbsinit,,ac_widec_funcs=no)
28-AC_CHECK_DECLS(wcwidth)
29+AC_CHECK_DECLS(wcwidth, [], [], [#include <wchar.h>])
30 AC_CHECK_TYPE(wchar_t,,ac_widec_funcs=no)
31
32 if test x$ac_widec_funcs = xyes -a x$ac_have_wchar_h = xyes; then
33diff --git a/mbswidth.c b/mbswidth.c
34index 031e6b7..54a2cb5 100644
35--- a/mbswidth.c
36+++ b/mbswidth.c
37@@ -63,7 +63,7 @@
38 # warn "this configure-time declaration test was not run"
39 #endif
40 #if !HAVE_DECL_WCWIDTH
41-int wcwidth ();
42+int wcwidth (wchar_t);
43 #endif
44
45 #ifndef wcwidth
46--
472.51.2
48