Subject: Re: bug#25633: porting gzip to Visual Studio 2015 failed due to redesign of CRT

From: Bruno Haible <[email-masked]>
Date: Wed, 08 Feb 2017 23:44:45 +0100

Hi Kees,

> 1.      frexp.c is not needed, as Visual Studio already provides frexp() function via system libraries.

The configure log says:
checking whether frexp works... guessing no
...
checking whether frexpl works... guessing no

Why "guessing"? Apparently AC_RUN_IFELSE refuses to run the
test program when compiling to mingw on a Cygwin host. Argh.

But it's documented in doc/posix-functions/frexp.texi
https://www.gnu.org/software/gnulib/manual/html_node/frexp.html

Do you have data that shows that MSVC14's frexp() behaves better than
the one in MSVC 9?

> 2.      memchr.c is not needed, as Visual Studio already provides memchr() function via system libraries.

The configure log says:
checking whether memchr works... guessing no
Again the AC_RUN_IFELSE problem.

> 3.      gzip.c/h, util.c: the strlwr() function conflicts with Visual Studio one. Added HAVE_STRLWR define in config.h and omit implementation + prototype.

That makes you depend on what Microsoft happens to implement in its
library. https://msdn.microsoft.com/en-us/library/ms235455.aspx

> 4.      lseek.c: need to include winsock2.h before including windows.h

I'm not observing this problem with building this gzip snapshot.

> 5.      utimens.c: need to include sys/times.c on Windows to get struct utimbuf + need to define HAVE_STRUCT_UTIMBUF in config.h +

Likewise: I'm not observing this problem.

> 7.      config.h (stored in clearcase as config_win32.h): added typedefs for uid_t and gid_t.

config.h is autogenerated with my README.windows instructions.

> 9.      util.c/xalloc-die.c: both contain a xalloc_die() function. I guess this is intentionally?

The one in util.c is meant to override the one from gnulib. This is normally
achieved by having the gnulib code linked as a library.

My build attempt aborted like this:
C:\cygwin64\home\bruno\gzip-1.8.18-00e6\gzip.c(1900): error C2146: syntax error: missing ')' before identifier 'uid'
C:\cygwin64\home\bruno\gzip-1.8.18-00e6\gzip.c(1900): error C2081: 'uid_t': name in formal parameter list illegal
C:\cygwin64\home\bruno\gzip-1.8.18-00e6\gzip.c(1900): error C2061: syntax error: identifier 'uid'
Indeed all uses of uid_t and gid_t need to be revisited when porting to native Windows.

Bruno