Re: Overriding the MS-Windows wint_t type considered harmful

2017-04-30 Thread Bruno Haible
Eli Zaretskii wrote: > I'm asking why get into such situations in the first place. What do > we gain? In general, by using gnulib, you gain higher compliance to the POSIX and C standard. In other words, code that was written with these standards in mind has higher chances of working correctly wit

Re: rename strftime module

2017-04-30 Thread Jim Meyering
On Sun, Apr 30, 2017 at 11:53 PM, Bruno Haible wrote: > I'd suggest to rename 'strftime' to 'strftime-gnu' or 'nstrftime', and mark > the 'strftime' module obsolete for two years, then after two years remove it. > So that all users of this module have enough time to notice the change. Good plan.

Re: rename strftime module

2017-04-30 Thread Paul Eggert
Bruno Haible wrote: I'd suggest to rename 'strftime' to 'strftime-gnu' or 'nstrftime', and mark the 'strftime' module obsolete for two years, then after two years remove it. So that all users of this module have enough time to notice the change. Makes sense to me.

Re: Overriding the MS-Windows wint_t type considered harmful

2017-04-30 Thread Eli Zaretskii
> From: Bruno Haible > Date: Sun, 30 Apr 2017 17:27:50 +0200 > > > One scenario where this gets in the way is when the application > > includes some other header, e.g. ctype.h, which declares the same isw* > > functions as wchar.h and wctype.h -- if the inclusion of ctype.h is > > _after_ wchar.h

new module 'wcsftime'

2017-04-30 Thread Bruno Haible
> * Some which should obey TZ, just that they should ignore the values set by > Cygwin (instead of exhibiting garbage behaviour): > > wcsftime, _wcsftime_l > https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx > http://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html Fi

new module 'strftime-fixes'

2017-04-30 Thread Bruno Haible
> * Some which should obey TZ, just that they should ignore the values set by > Cygwin (instead of exhibiting garbage behaviour): > > strftime, _strftime_l > https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx > http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html Th

mktime: add native Windows workaround

2017-04-30 Thread Bruno Haible
> * Some which should obey TZ, just that they should ignore the values set by > Cygwin (instead of exhibiting garbage behaviour): > > mktime, _mktime* > https://msdn.microsoft.com/en-us/library/d1y53h2a.aspx > http://pubs.opengroup.org/onlinepubs/9699919799/functions/mktime.html This patc

new module 'localtime'

2017-04-30 Thread Bruno Haible
> * Some which should obey TZ, just that they should ignore the values set by > Cygwin (instead of exhibiting garbage behaviour): > > localtime, _localtime* > https://msdn.microsoft.com/en-us/library/bf12f0hc.aspx > https://msdn.microsoft.com/en-us/library/a442x3ye.aspx > http://pubs.ope

new module 'ctime'

2017-04-30 Thread Bruno Haible
> * Some which should obey TZ, just that they should ignore the values set by > Cygwin (instead of exhibiting garbage behaviour): > > ctime, _ctime*, _wctime* > https://msdn.microsoft.com/en-us/library/59w5xcdy.aspx > http://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html Th

gettimeofday: improve for native Windows

2017-04-30 Thread Bruno Haible
gettimeofday should provide the same time resolution as utime. 2017-04-30 Bruno Haible gettimeofday: Provide higher resolution on native Windows. * lib/gettimeofday.c: Don't include . (GetSystemTimePreciseAsFileTimeFuncType): New variable. (initialize): Initial

Re: what shall we do with the drunken time_t ?

2017-04-30 Thread Bruno Haible
As a first step, let me document this for the POSIX functions. 2017-04-30 Bruno Haible Document the problem with the Cygwin environment variable TZ. * doc/posix-functions/tzset.texi: Add note about TZ. * doc/posix-functions/ctime.texi: Likewise. * doc/posix-fun

new module 'utime-tests'

2017-04-30 Thread Bruno Haible
And this adds tests for 'utime'. 2017-04-30 Bruno Haible utime-tests: New module. * tests/test-utime.c: New file, based on tests/test-utimens.h. * tests/test-utimens-common.h: Include . * modules/utime-tests: New file. diff --git a/modules/utime-tests b/module

new module 'utime'

2017-04-30 Thread Bruno Haible
This patch add a module 'utime'. The original _utime function on native Windows has a behaviour that depends on the time zone, which is nonsense (see https://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00164.html ). 2017-04-29 Bruno Haible utime: New module. * lib/utime.i

modernize handling of 'struct utimbuf'

2017-04-30 Thread Bruno Haible
On Unix systems, there is no problem any more nowadays with 'struct utimbuf': A web search for "checking for struct utimbuf... no" does not find any relevant hits in the last 11 years. On the other hand, there is a problem on native Windows (both mingw and MSVC): The header file defines 'struct _u

make use of module 'utime-h'

2017-04-30 Thread Bruno Haible
A simple patch to make use of the new module 'utime-h'. 2017-04-29 Bruno Haible Make use of module 'utime-h'. * modules/copy-file (Depends-on): Add utime-h. * lib/copy-file.c: Assume that exists. * m4/copy-file.m4 (gl_COPY_FILE): Don't test for . * mo

new module 'utime-h'

2017-04-30 Thread Bruno Haible
Before implementing an override for the utime() function, we need the header file. This patch provides it. 2017-04-29 Bruno Haible utime-h: New module. * m4/utime_h.m4: New file. * lib/utime.in.h: New file. * modules/utime-h: New file. * doc/posix-head

Re: rename strftime module

2017-04-30 Thread Pádraig Brady
On 30/04/17 07:53, Bruno Haible wrote: > Hi, > > The name of the strftime module is misleading: > 1) It suggests that it defines the function 'strftime', but in fact it > defines 'nstrftime'. GNU findutils fell into this pit: their > bootstrap.conf > requests the gnulib 'strftime' mod

Re: Overriding the MS-Windows wint_t type considered harmful

2017-04-30 Thread Bruno Haible
Hi Eli, > One scenario where this gets in the way is when the application > includes some other header, e.g. ctype.h, which declares the same isw* > functions as wchar.h and wctype.h -- if the inclusion of ctype.h is > _after_ wchar.h/wctype.h are included, this produces compilation > errors, beca

Overriding the MS-Windows wint_t type considered harmful

2017-04-30 Thread Eli Zaretskii
Two Gnulib header files, wctype.h and wchar.h, override the wint_t data type as defined in the MS-Windows header files, like this: /* mingw and MSVC define wint_t as 'unsigned short' in or . This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be "unchanged by default

rename strftime module

2017-04-30 Thread Bruno Haible
Hi, The name of the strftime module is misleading: 1) It suggests that it defines the function 'strftime', but in fact it defines 'nstrftime'. GNU findutils fell into this pit: their bootstrap.conf requests the gnulib 'strftime' module but the coded doesn't use nstrftime. 2) When we

Re: Gnulib's wctype.h fails to compile with MinGW

2017-04-30 Thread Eli Zaretskii
> Date: Thu, 27 Apr 2017 20:50:25 +0300 > From: Eli Zaretskii > CC: bug-gnulib@gnu.org > > > From: Bruno Haible > > Date: Thu, 27 Apr 2017 19:03:35 +0200 > > > > Thanks for the report and suggested fix. > > > > The #ifdefology here seems a bit fragile to me (will likely break in other > > fork

Re: stat: fix time_t values and other problems on native Windows

2017-04-30 Thread Bruno Haible
A followup patch, that fixes a few typos. 2017-04-30 Bruno Haible Fix a few typos. * m4/fstat.m4 (gl_FUNC_FSTAT): Require AC_CANONICAL_HOST. * m4/stat.m4 (gl_FUNC_STAT): Fix comment. * doc/posix-functions/fstat.texi: Fix a plural typo. * doc/posix-funct

Re: what shall we do with the drunken time_t ?

2017-04-30 Thread Bruno Haible
> - the Microsoft CRT interprets TZ, but with a different expected syntax > [2][3], > which led to tzname[0] = "Eur", tzname[1] = "ope". The TZ environment variable affects a lot of C library functions: * Some which should not be exhibiting locale dependent behaviour at all: fstat, _fst