Re: timespec_get: Fix compilation error with MSVC 14

2022-09-04 Thread Paul Eggert
On 9/4/22 17:00, Bruno Haible wrote: But I am lazy here, as 'timespec_get' is usually not the kind of function that people will call from an extern inline function. timespec_get is so new that I wouldn't expect it to be called from anywhere. Still, this business of "static inline" for standard

Fix various test link errors on MSVC

2022-09-04 Thread Bruno Haible
In MSVC builds, I get some link errors. Such as in 32-bit mode: /home/bruno/msvc/compile cl -nologo -MD -L/usr/local/msvc32/lib -o test-gc-des.exe test-gc-des.obj libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a libgnu.a(getrandom.obj) : error LNK2019: unresolved extern

count-leading-zeros: Fix a link error on 32-bit MSVC and a test failure

2022-09-04 Thread Bruno Haible
On 32-bit MSVC, I see a compilation error: /home/bruno/msvc/compile cl -nologo -MD -L/usr/local/msvc32/lib -o test-count-leading-zeros.exe test-count-leading-zeros.obj libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a test-count-leading-zeros.obj : error LNK2019: unresolve

count-trailing-zeros: Fix a link error on 32-bit MSVC

2022-09-04 Thread Bruno Haible
On 32-bit MSVC, I'm seeing this link error: /home/bruno/msvc/compile cl -nologo -MD -L/usr/local/msvc32/lib -o test-count-trailing-zeros.exe test-count-trailing-zeros.obj libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a test-count-trailing-zeros.obj : error LNK2019: unres

unictype/category-none tests: Fix a link error on MSVC

2022-09-04 Thread Bruno Haible
On MSVC, with libunistring installed as a shared library, I get this link error: /home/bruno/msvc/compile cl -nologo -MD -L/usr/local/msvc64/lib -o test-categ_none.exe unictype/test-categ_none.obj libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -lunistring test-categ_non

oset-c++: Fix compilation error with MSVC 14

2022-09-04 Thread Bruno Haible
With MSVC 14, I see this compilation error: source='../../gltests/test-oset-c++.cc' object='test-oset-c++.obj' libtool=no \ DEPDIR=.deps depmode=msvc7 /bin/sh ../../build-aux/depcomp \ /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -I. -I../../gltests -I.. -DGNULIB_STRICT_

glob tests: Fix link error on mingw

2022-09-04 Thread Bruno Haible
On mingw, on a system where I have GNU gettext installed, I get this link error: i686-w64-mingw32-gcc -Wno-error -g -O2 -L/usr/local/mingw32/lib -o test-glob.exe test-glob.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a(openat-die.o): In function `op

Re: timespec_get: Fix compilation error with MSVC 14

2022-09-04 Thread Bruno Haible
Paul Eggert wrote: > > this platform's contains a 'static inline' > > definition of timespec_get > > That violates the C standard, as it means an extern inline function > cannot call timespec_get. Oh, indeed. > Shouldn't we instead fix Gnulib's timespec_get module to work around > this MSVC 1

Re: stdbool: Fix compilation error in C++ mode with MSVC 14

2022-09-04 Thread Bruno Haible
Paul Eggert wrote: > > +# if !defined _MSC_VER > > +# define false false > > +# define true true > > +# endif > > How about using "#ifndef true" instead? This will not work, as 'true' and 'false' are keywords, not macros, in C++ mode, with this compiler. > That will be more portable in > the

Re: stdbool: Fix compilation error in C++ mode with MSVC 14

2022-09-04 Thread Paul Eggert
On 9/4/22 09:25, Bruno Haible wrote: +# if !defined _MSC_VER +# define false false +# define true true +# endif How about using "#ifndef true" instead? That will be more portable in the presence of other platforms with this portability issue.

Re: timespec_get: Fix compilation error with MSVC 14

2022-09-04 Thread Paul Eggert
On 9/4/22 10:15, Bruno Haible wrote: this platform's contains a 'static inline' definition of timespec_get That violates the C standard, as it means an extern inline function cannot call timespec_get. Shouldn't we instead fix Gnulib's timespec_get module to work around this MSVC 14 bug? Th

timespec_get: Fix compilation error with MSVC 14

2022-09-04 Thread Bruno Haible
A testdir fails to compile on MSVC 14, because of this error: source='../../gllib/timespec_get.c' object='timespec_get.obj' libtool=no \ DEPDIR=.deps depmode=msvc7 /bin/sh ../../build-aux/depcomp \ /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -DEXEEXT=\".exe\" -DNO_XMALLO

stdbool: Fix compilation error in C++ mode with MSVC 14

2022-09-04 Thread Bruno Haible
A testdir fails to compile on MSVC 14, because of this error: source='../../gltests/test-list-c++.cc' object='test-list-c++.obj' libtool=no \ DEPDIR=.deps depmode=msvc7 /bin/sh ../../build-aux/depcomp \ /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -I. -I../../gltests -I..

fts: Fix compilation error with MSVC 14

2022-09-04 Thread Bruno Haible
A testdir fails to compile on MSVC 14, because of this error: source='../../gllib/fts.c' object='fts.obj' libtool=no \ DEPDIR=.deps depmode=msvc7 /bin/sh ../../build-aux/depcomp \ /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -DEXEEXT=\".exe\" -DNO_XMALLOC -DEXEEXT=\".exe\

lstat: Fix compilation error in C++ mode on mingw

2022-09-04 Thread Bruno Haible
In a testdir build on mingw, I get this compilation error: depbase=`echo test-sys_stat-c++.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-g++ -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../gl

pselect: Fix compilation error in C++ mode on mingw

2022-09-04 Thread Bruno Haible
In a testdir build on mingw, I get this compilation error: depbase=`echo test-sys_select-c++.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-g++ -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../

nanosleep: Work around bug on newer 32-bit mingw

2022-09-04 Thread Bruno Haible
On mingw, there is a 'nanosleep' function in libwinpthread. On 32-bit mingw, it does not fail when the tv_nsec argument is negative. This is currently not being caught at configure time, and causes the 'test-nanosleep' test to hang (more precisely, to hang for 1000 seconds). This patch - adds a