> From: Gavin Smith <gavinsmith0...@gmail.com> > Date: Sun, 15 Oct 2023 12:57:46 +0100 > Cc: bug-texinfo@gnu.org > > On Sun, Oct 15, 2023 at 12:00:47PM +0300, Eli Zaretskii wrote: > > Thanks. > > > > This doesn't compile with MinGW, because some of the dTHX additions I > > needed for the previous pretest were not installed(?), and are still > > missing. The patch I needed is below. > > I hadn't installed those changes because I hadn't understood why they > were necessary. Looking at the code, I expect that it was due to the > use of fprintf in those functions which the Perl headers must be doing > something funny with. Presumably you got an error message when compiling > indicating this?
I show two such error messages below, I hope it will help you understand the reason. > The fprintf calls were added since the Texinfo 7.0 branch so will not > have broken previously. > > Although adding dTHX should be harmless, the paragraph formatting > functions are very frequently called functions and adding the dTHX in > there has a potential performance impact, especially in xspara__add_next. > > However, I could not detect any performance difference in the testing I > did so I have added them anyway. Here are the error messages I promised. Error #1: libtool: compile: d:/usr/bin/gcc.exe -DHAVE_CONFIG_H -I. -I./parsetexi -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 parsetexi/Parsetexi_la-api.lo -MD -MP -MF parsetexi/.deps/Parsetexi_la-api.Tpo -c parsetexi/api.c -DDLL_EXPORT -DPIC -o parsetexi/.libs/Parsetexi_la-api.o In file included from parsetexi/api.c:23: parsetexi/api.c: In function 'reset_parser': D:/usr/Perl/lib/CORE/perl.h:155:16: error: 'my_perl' undeclared (first use in this function) 155 | # define aTHX my_perl | ^~~~~~~ D:/usr/Perl/lib/CORE/embedvar.h:38:18: note: in expansion of macro 'aTHX' 38 | # define vTHX aTHX | ^~~~ D:/usr/Perl/lib/CORE/embedvar.h:65:20: note: in expansion of macro 'vTHX' 65 | #define PL_StdIO (vTHX->IStdIO) | ^~~~ D:/usr/Perl/lib/CORE/iperlsys.h:207:4: note: in expansion of macro 'PL_StdIO' 207 | (*PL_StdIO->pStderr)(PL_StdIO) | ^~~~~~~~ D:/usr/Perl/lib/CORE/XSUB.h:511:21: note: in expansion of macro 'PerlSIO_stderr' 511 | # define stderr PerlSIO_stderr | ^~~~~~~~~~~~~~ parsetexi/api.c:174:14: note: in expansion of macro 'stderr' 174 | fprintf (stderr, | ^~~~~~ D:/usr/Perl/lib/CORE/perl.h:155:16: note: each undeclared identifier is reported only once for each function it appears in 155 | # define aTHX my_perl | ^~~~~~~ D:/usr/Perl/lib/CORE/embedvar.h:38:18: note: in expansion of macro 'aTHX' 38 | # define vTHX aTHX | ^~~~ D:/usr/Perl/lib/CORE/embedvar.h:65:20: note: in expansion of macro 'vTHX' 65 | #define PL_StdIO (vTHX->IStdIO) | ^~~~ D:/usr/Perl/lib/CORE/iperlsys.h:207:4: note: in expansion of macro 'PL_StdIO' 207 | (*PL_StdIO->pStderr)(PL_StdIO) | ^~~~~~~~ D:/usr/Perl/lib/CORE/XSUB.h:511:21: note: in expansion of macro 'PerlSIO_stderr' 511 | # define stderr PerlSIO_stderr | ^~~~~~~~~~~~~~ parsetexi/api.c:174:14: note: in expansion of macro 'stderr' 174 | fprintf (stderr, | ^~~~~~ Error #2: 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 In file included from xspara.c:39: xspara.c: In function 'xspara__print_escaped_spaces': D:/usr/Perl/lib/CORE/perl.h:155:16: error: 'my_perl' undeclared (first use in this function) 155 | # define aTHX my_perl | ^~~~~~~ D:/usr/Perl/lib/CORE/embedvar.h:38:18: note: in expansion of macro 'aTHX' 38 | # define vTHX aTHX | ^~~~ D:/usr/Perl/lib/CORE/embedvar.h:58:19: note: in expansion of macro 'vTHX' 58 | #define PL_Mem (vTHX->IMem) | ^~~~ D:/usr/Perl/lib/CORE/iperlsys.h:809:4: note: in expansion of macro 'PL_Mem' 809 | (*PL_Mem->pMalloc)(PL_Mem, (size)) | ^~~~~~ D:/usr/Perl/lib/CORE/XSUB.h:563:21: note: in expansion of macro 'PerlMem_malloc' 563 | # define malloc PerlMem_malloc | ^~~~~~~~~~~~~~ xspara.c:256:36: note: in expansion of macro 'malloc' 256 | char *protected_string = malloc (7 * sizeof (char)); | ^~~~~~ D:/usr/Perl/lib/CORE/perl.h:155:16: note: each undeclared identifier is reported only once for each function it appears in 155 | # define aTHX my_perl | ^~~~~~~ D:/usr/Perl/lib/CORE/embedvar.h:38:18: note: in expansion of macro 'aTHX' 38 | # define vTHX aTHX | ^~~~ D:/usr/Perl/lib/CORE/embedvar.h:58:19: note: in expansion of macro 'vTHX' 58 | #define PL_Mem (vTHX->IMem) | ^~~~ D:/usr/Perl/lib/CORE/iperlsys.h:809:4: note: in expansion of macro 'PL_Mem' 809 | (*PL_Mem->pMalloc)(PL_Mem, (size)) | ^~~~~~ D:/usr/Perl/lib/CORE/XSUB.h:563:21: note: in expansion of macro 'PerlMem_malloc' 563 | # define malloc PerlMem_malloc | ^~~~~~~~~~~~~~ xspara.c:256:36: note: in expansion of macro 'malloc' 256 | char *protected_string = malloc (7 * sizeof (char)); | ^~~~~~ xspara.c: In function 'xspara__add_pending_word': D:/usr/Perl/lib/CORE/perl.h:155:16: error: 'my_perl' undeclared (first use in this function) 155 | # define aTHX my_perl | ^~~~~~~ D:/usr/Perl/lib/CORE/embedvar.h:38:18: note: in expansion of macro 'aTHX' 38 | # define vTHX aTHX | ^~~~ D:/usr/Perl/lib/CORE/embedvar.h:65:20: note: in expansion of macro 'vTHX' 65 | #define PL_StdIO (vTHX->IStdIO) | ^~~~ D:/usr/Perl/lib/CORE/iperlsys.h:207:4: note: in expansion of macro 'PL_StdIO' 207 | (*PL_StdIO->pStderr)(PL_StdIO) | ^~~~~~~~ D:/usr/Perl/lib/CORE/XSUB.h:511:21: note: in expansion of macro 'PerlSIO_stderr' 511 | # define stderr PerlSIO_stderr | ^~~~~~~~~~~~~~ xspara.c:584:18: note: in expansion of macro 'stderr' 584 | fprintf (stderr, "INDENT(%d+%d)\n", state.counter, state.word_counter); | ^~~~~~ xspara.c: In function 'xspara_end': D:/usr/Perl/lib/CORE/perl.h:155:16: error: 'my_perl' undeclared (first use in this function) 155 | # define aTHX my_perl | ^~~~~~~ D:/usr/Perl/lib/CORE/embedvar.h:38:18: note: in expansion of macro 'aTHX' 38 | # define vTHX aTHX | ^~~~ D:/usr/Perl/lib/CORE/embedvar.h:65:20: note: in expansion of macro 'vTHX' 65 | #define PL_StdIO (vTHX->IStdIO) | ^~~~ D:/usr/Perl/lib/CORE/iperlsys.h:207:4: note: in expansion of macro 'PL_StdIO' 207 | (*PL_StdIO->pStderr)(PL_StdIO) | ^~~~~~~~ D:/usr/Perl/lib/CORE/XSUB.h:511:21: note: in expansion of macro 'PerlSIO_stderr' 511 | # define stderr PerlSIO_stderr | ^~~~~~~~~~~~~~ xspara.c:648:14: note: in expansion of macro 'stderr' 648 | fprintf (stderr, "PARA END\n"); | ^~~~~~ xspara.c: In function 'xspara__add_next': D:/usr/Perl/lib/CORE/perl.h:155:16: error: 'my_perl' undeclared (first use in this function) 155 | # define aTHX my_perl | ^~~~~~~ D:/usr/Perl/lib/CORE/embedvar.h:38:18: note: in expansion of macro 'aTHX' 38 | # define vTHX aTHX | ^~~~ D:/usr/Perl/lib/CORE/embedvar.h:65:20: note: in expansion of macro 'vTHX' 65 | #define PL_StdIO (vTHX->IStdIO) | ^~~~ D:/usr/Perl/lib/CORE/iperlsys.h:207:4: note: in expansion of macro 'PL_StdIO' 207 | (*PL_StdIO->pStderr)(PL_StdIO) | ^~~~~~~~ D:/usr/Perl/lib/CORE/XSUB.h:511:21: note: in expansion of macro 'PerlSIO_stderr' 511 | # define stderr PerlSIO_stderr | ^~~~~~~~~~~~~~ xspara.c:801:14: note: in expansion of macro 'stderr' 801 | fprintf (stderr, "WORD+ %s -> %s\n", word, state.word.space == 0 ? | ^~~~~~