* conflicting types in windows-spawn
@ 2021-05-06 12:28 Markus Mützel
2021-05-06 13:25 ` Markus Mützel
0 siblings, 1 reply; 4+ messages in thread
From: Markus Mützel @ 2021-05-06 12:28 UTC (permalink / raw)
To: bug-gnulib
I tried to use the windows-spawn module in a project that defines UNICODE.
Compilation of gnulib failed with the following error:
libtool: compile: x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I/home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu -I.. -I/home/osboxes/Octave/mxe-octave/usr/x86_64-w64-mingw32/include -fvisibility=hidden -g -O2 -MT windows-spawn.lo -MD -MP -MF .deps/windows-spawn.Tpo -c /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.c -DDLL_EXPORT -DPIC -o .libs/windows-spawn.o
/home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.c:415:1: error: conflicting types for 'compose_handles_block'
415 | compose_handles_block (const struct inheritable_handles *inh_handles,
| ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.c:21:
/home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.h:118:12: note: previous declaration of 'compose_handles_block' was here
118 | extern int compose_handles_block (const struct inheritable_handles *inh_handles,
| ^~~~~~~~~~~~~~~~~~~~~
make[5]: *** [Makefile:3299: windows-spawn.lo] Error 1
The following change fixes it for me:
* lib/windows-spawn.h: Use ANSI structure STARTUPINFOA.
---
lib/windows-spawn.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/windows-spawn.h b/lib/windows-spawn.h
index 1c29d1b17..78f11893c 100644
--- a/lib/windows-spawn.h
+++ b/lib/windows-spawn.h
@@ -25,6 +25,9 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+/* Don't assume that UNICODE is not defined. */
+#undef STARTUPINFO
+#define STARTUPINFO STARTUPINFOA
/* Prepares an argument vector before calling spawn().
Markus
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: conflicting types in windows-spawn
2021-05-06 12:28 conflicting types in windows-spawn Markus Mützel
@ 2021-05-06 13:25 ` Markus Mützel
2021-05-14 10:39 ` Bruno Haible
0 siblings, 1 reply; 4+ messages in thread
From: Markus Mützel @ 2021-05-06 13:25 UTC (permalink / raw)
To: Markus Mützel; +Cc: bug-gnulib
Am 06. Mai 2021 um 14:28 Uhr schrieb "Markus Mützel":
> I tried to use the windows-spawn module in a project that defines UNICODE.
>
> Compilation of gnulib failed with the following error:
>
> libtool: compile: x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I/home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu -I.. -I/home/osboxes/Octave/mxe-octave/usr/x86_64-w64-mingw32/include -fvisibility=hidden -g -O2 -MT windows-spawn.lo -MD -MP -MF .deps/windows-spawn.Tpo -c /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.c -DDLL_EXPORT -DPIC -o .libs/windows-spawn.o
> /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.c:415:1: error: conflicting types for 'compose_handles_block'
> 415 | compose_handles_block (const struct inheritable_handles *inh_handles,
> | ^~~~~~~~~~~~~~~~~~~~~
> In file included from /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.c:21:
> /home/osboxes/Octave/mxe-octave/tmp-default-octave/octave-7.0.0/libgnu/windows-spawn.h:118:12: note: previous declaration of 'compose_handles_block' was here
> 118 | extern int compose_handles_block (const struct inheritable_handles *inh_handles,
> | ^~~~~~~~~~~~~~~~~~~~~
> make[5]: *** [Makefile:3299: windows-spawn.lo] Error 1
>
>
> The following change fixes it for me:
>
> * lib/windows-spawn.h: Use ANSI structure STARTUPINFOA.
> ---
> lib/windows-spawn.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/windows-spawn.h b/lib/windows-spawn.h
> index 1c29d1b17..78f11893c 100644
> --- a/lib/windows-spawn.h
> +++ b/lib/windows-spawn.h
> @@ -25,6 +25,9 @@
> #define WIN32_LEAN_AND_MEAN
> #include <windows.h>
>
> +/* Don't assume that UNICODE is not defined. */
> +#undef STARTUPINFO
> +#define STARTUPINFO STARTUPINFOA
>
> /* Prepares an argument vector before calling spawn().
>
On second thought, the header should probably better not re-define STARTUPINFO.
The following alternative change might be saver:
From 84df3e82f88799d211bd4f5147473b238937d458 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <markus.muetzel@gmx.de>
Date: Thu, 6 May 2021 15:20:30 +0200
Subject: [PATCH] windows-spawn: Don't assume that UNICODE is not defined
* lib/windows-spawn.h: Use ANSI structure STARTUPINFOA.
---
lib/windows-spawn.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/windows-spawn.h b/lib/windows-spawn.h
index 1c29d1b17..9bcfb1c82 100644
--- a/lib/windows-spawn.h
+++ b/lib/windows-spawn.h
@@ -116,7 +116,7 @@ extern int init_inheritable_handles (struct inheritable_handles *inh_handles,
Returns 0 upon success. In case of failure, -1 is returned, with errno set.
*/
extern int compose_handles_block (const struct inheritable_handles *inh_handles,
- STARTUPINFO *sinfo);
+ STARTUPINFOA *sinfo);
/* Frees the memory held by a set of inheritable handles. */
extern void free_inheritable_handles (struct inheritable_handles *inh_handles);
--
2.31.1.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: conflicting types in windows-spawn
2021-05-06 13:25 ` Markus Mützel
@ 2021-05-14 10:39 ` Bruno Haible
2021-05-14 15:38 ` Markus Mützel
0 siblings, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2021-05-14 10:39 UTC (permalink / raw)
To: bug-gnulib; +Cc: Markus Mützel
Hi,
Markus Mützel wrote:
> On second thought, the header should probably better not re-define STARTUPINFO.
> The following alternative change might be saver:
>
> From 84df3e82f88799d211bd4f5147473b238937d458 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <markus.muetzel@gmx.de>
> Date: Thu, 6 May 2021 15:20:30 +0200
> Subject: [PATCH] windows-spawn: Don't assume that UNICODE is not defined
>
> * lib/windows-spawn.h: Use ANSI structure STARTUPINFOA.
> ---
> lib/windows-spawn.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/windows-spawn.h b/lib/windows-spawn.h
> index 1c29d1b17..9bcfb1c82 100644
> --- a/lib/windows-spawn.h
> +++ b/lib/windows-spawn.h
> @@ -116,7 +116,7 @@ extern int init_inheritable_handles (struct inheritable_handles *inh_handles,
> Returns 0 upon success. In case of failure, -1 is returned, with errno set.
> */
> extern int compose_handles_block (const struct inheritable_handles *inh_handles,
> - STARTUPINFO *sinfo);
> + STARTUPINFOA *sinfo);
>
> /* Frees the memory held by a set of inheritable handles. */
> extern void free_inheritable_handles (struct inheritable_handles *inh_handles);
>
Yes, I agree. That's the proper way to fix it. I applied and pushed your change.
Thanks!
Bruno
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-14 15:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 12:28 conflicting types in windows-spawn Markus Mützel
2021-05-06 13:25 ` Markus Mützel
2021-05-14 10:39 ` Bruno Haible
2021-05-14 15:38 ` Markus Mützel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).