RE: [RFC] Missing sleep function for mingw hosts

Pierre Muller
2011-03-29T13:10:57Z

Hi Eli,
thanks for your comments.

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Eli Zaretskii
> Envoyé : mardi 29 mars 2011 14:37
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFC] Missing sleep function for mingw hosts
>
> > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> > Date: Tue, 29 Mar 2011 09:36:46 +0200
> >
> > mingw does not have a sleep function in its library.
> > This prevents currently successful compilation of
> > mingw64 with --enable-targets=all option.
>
> You say "mingw64" -- does that mean it does compile with mingw32? If
> so, how come it fails with the 64-bit build?
No, it's just the configuration that I used,
but this failure also appears for mingw32.
../../../archer/gdb/remote-mips.c: In function `mips_enter_debug':
../../../archer/gdb/remote-mips.c:1353: warning: implicit declaration of
functio
n `sleep'
make: *** [remote-mips.o] Error 1

> > I found that there is a substitute for sleep in gnulib:
> >
>
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/sleep.c;hb=d60
> > f3b0c6b0f93a601acd1cfd3923f94ca05abb0
> >
> > What is the rule to add new parts into gnulib subdirectory?
> > Would inclusion of gnulib sleep.c source code
> > be possible to fix the above problem?
>
> I'd rather we had a replacement in win32-nat.c, instead of importing
> gobs of gnulib stuff needed to provide such a trivial replacement.
> gnulib is GPL, so we can simply copy the code into our sources.

This is not really the right place:
the problem triggers due to some other target,
(remote-mips.c line 1353)
so the code should be also available if only that target is selected
(i.e. without windows-nat.c ).
The best place in my opinion would be mingw-hdep.c,
the only thing is that this would mean adding a mingw-hdep.h header
and inserting that header into remote-mips.c source...
The big difference with using gnulib code is that the same failure
would not appear again the next time someone adds a call to sleep
somewhere else inside the GDB sources.

Pierre