> From: Gavin Smith <[email protected]>
> Date: Mon, 23 Oct 2023 19:52:49 +0100
> Cc: [email protected]
>
> I propose the following, more finished patch, which applies
> to Texinfo 7.1. We can also do something similar for the master branch.
Unfortunately, this change doesn't work on MS-Windows:
libtool: compile: d:/usr/bin/gcc.exe -DHAVE_CONFIG_H -I. -I. -I./gnulib/lib
-I./gnulib/lib -DDATADIR=\"d:/usr/share\" -Id:/usr/include -s -O2 -DWIN32
-DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s
-O2 -DVERSION=\"0\" -DXS_VERSION=\"0\" -ID:/usr/Perl/lib/CORE -MT xspara.lo -MD
-MP -MF .deps/xspara.Tpo -c xspara.c -DDLL_EXPORT -DPIC -o .libs/xspara.o
xspara.c: In function 'xspara__add_next':
xspara.c:757:39: warning: passing argument 1 of 'get_utf8_codepoint' from
incompatible pointer type [-Wincompatible-pointer-types]
757 | get_utf8_codepoint (&state.last_letter, p, len);
| ^~~~~~~~~~~~~~~~~~
| |
| rpl_wint_t * {aka unsigned int
*}
xspara.c:689:30: note: expected 'wchar_t *' {aka 'short unsigned int *'} but
argument is of type 'rpl_wint_t *' {aka 'unsigned int *'}
689 | get_utf8_codepoint (wchar_t *pwc, const char *mbs, size_t n)
| ~~~~~~~~~^~~
The warning is real: wchar_t is a 16-bit data type on MS-Windows,
whereas the code assumes it's of the same width as wint_t.
I changed the offending code to say this instead:
if (!strchr (end_sentence_characters
after_punctuation_characters, *p))
{
wchar_t wc;
get_utf8_codepoint (&wc, p, len);
state.last_letter = wc;
}
and then it compiled cleanly.