Re: gnulib-tool: Ensure that long-running tests are executed last
Hi Bruno, * Bruno Haible wrote on Sat, Apr 03, 2010 at 12:13:12AM CEST: - I was assuming a sequential execution (since this is the default with make) and the goal of maximizing the information that is available within a short time after starting the test. Your goal is worthy but how do you know whether it's those tests you listed first that are important to the user? If you're out to maximize the amount of information available after a short time, I suggest you look into the parallel-tests test driver of Automake = 1.11 which allows you to only rerun tests whose results are out of date. That way, you minimize the total number of tests that are rerun, which is typically what helps the edit-compile-test cycle most. Of course that requires proper dependencies to be in place. Cheers, Ralf
Re: gnulib-tool: Ensure that long-running tests are executed last
Bruno Haible wrote: Hi Eric, Jim, This ensures that long-running tests are executed last. So that the user gets the maximum of information as quickly as possible. That goes counter to the idea of parallel execution, where you want the long-running tests front-loaded so that the shorter tests can fill in the gaps. If the long-running tests are last, then the entire parallel operation is stuck waiting for the last test. I have deliberately reordered some tests to put long-running ones early enough so that a parallel (often -j5 or more) build completes as quickly as possible. Hmm, it seems we are trying to optimize for different execution models and different goals: - I was assuming a sequential execution (since this is the default with make) and the goal of maximizing the information that is available within a short time after starting the test. - You are assuming a parallel execution with several processors, and No need for several processors. If a single one of your tests does a sleep 1, then make -j2 is almost guaranteed to be beneficial. Some of our tests sleep for many seconds, but we've been trying to avoid that.
Re: [wdiff-bugs] wdiff-0.6.1 build problems
Hi there! Nelson H. F. Beebe reports problems building Gnulib sources shipped with wdiff 0.6.1. Those sources should be up to date, so current git should exhibit these problems as well. On 02.04.2010 20:58, Nelson H. F. Beebe wrote: On Solaris 7 SPARC, compilation with cc fails like this: cc -DHAVE_CONFIG_H -I. -I.. -DDEFAULT_TEXT_DOMAIN=\wdiff-gnulib\ -I../intl -I/usr/local/include -I/usr/local/include -c localcharset.c ./getopt.h, line 31: empty file name cc: acomp failed for localcharset.c I did a fresh build using gcc-2.95.3 (the last gcc version that builds on that O/S), and that solved the problem. See his full report in the wdiff-bugs list archive: http://lists.gnu.org/archive/html/wdiff-bugs/2010-04/msg2.html Can you imagine what's causing this? Do you have an idea how to avoid this? Do you want to address this even if a gcc update solves the issue? I've asked Nelson for additional information, config.{log,status} in particular, so maybe we can provide more details soon. Greetings, Martin von Gagern signature.asc Description: OpenPGP digital signature
Re: Failed test-localename 64-bit OS X 10.6.2
Hello, Panu Kekäläinen wrote, in reply to http://lists.gnu.org/archive/html/bug-libunistring/2010-04/msg1.html: After applying the patch the test results are: All 320 tests passed Thank you for the fast response! Thanks to you! I very much appreciate your fast response. I will make a new libunistring release today, with this fix included. Bruno 2010-04-03 Bruno Haible br...@clisp.org localename: Port to MacOS X 10.6. * lib/localename.c (gl_locale_name_thread_unsafe): On MacOS X, try the memory layout of the locales in MacOS X 10.6 as well. Reported by Panu Kekäläinen p...@kekalainen.eu. --- lib/localename.c.orig Sat Apr 3 10:43:18 2010 +++ lib/localename.cFri Apr 2 20:14:59 2010 @@ -2625,12 +2625,24 @@ locale names of length 31, we can assume that it is NUL terminated in this buffer. But we need to make a copy of the locale name, of indefinite extent. */ -struct _xlocale +struct _xlocale_part1_v0 /* used in MacOS X 10.5 */ { int32_t __refcount; void (*__free_extra)(void *); __darwin_mbstate_t __mbs[10]; int64_t __magic; + }; +struct _xlocale_part1_v1 /* used in MacOS X = 10.6.0 */ + { +int32_t __refcount; +void (*__free_extra)(void *); +__darwin_mbstate_t __mbs[10]; +/*pthread_lock_t*/ int __lock; +int64_t __magic; + }; +struct _xlocale_part2 + { +int64_t __magic; unsigned char __collate_load_error; unsigned char __collate_substitute_nontrivial; unsigned char _messages_using_locale; @@ -2689,7 +2701,23 @@ char *_time_locale_buf; /* more */ }; -struct _xlocale *tlp = (struct _xlocale *) thread_locale; +struct _xlocale_part2 *tlp; +if (((struct _xlocale_part1_v0 *) thread_locale)-__magic +== 0x786C6F63616C6530LL) + /* MacOS X 10.5 */ + tlp = +(struct _xlocale_part2 *) +((struct _xlocale_part1_v0 *) thread_locale)-__magic; +else if (((struct _xlocale_part1_v1 *) thread_locale)-__magic + == 0x786C6F63616C6530LL) + /* MacOS X = 10.6.0 */ + tlp = +(struct _xlocale_part2 *) +((struct _xlocale_part1_v1 *) thread_locale)-__magic; +else + /* Unsupported version of MacOS X: The internals of 'struct _xlocale' + have changed again. */ + return ; switch (category) { case LC_CTYPE:
Re: duplocale cygwin failure
Hi Simon, In file included from test-locale-c++.cc:22: ../gllib/locale.h:329: error: ‘duplocale’ was not declared in this scope ../gllib/locale.h:329: error: invalid type in declaration before ‘;’ token make[3]: *** [test-locale-c++.o] Error 1 make[3]: Leaving directory `/home/Simon/gnulib/build/gltests' This error is due to the fact that we cannot provide a 'duplocale' replacement on all platforms. 2010-04-03 Bruno Haible br...@clisp.org locale: Make C++ tests work on Cygwin and mingw. * lib/locale.in.h (duplocale): Don't use _GL_CXXALIASWARN if gnulib cannot provide the function. Reported by Simon Josefsson. --- lib/locale.in.h.origSat Apr 3 11:55:29 2010 +++ lib/locale.in.h Sat Apr 3 10:58:14 2010 @@ -59,7 +59,9 @@ _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); # endif # endif +# if @HAVE_DUPLOCALE@ _GL_CXXALIASWARN (duplocale); +# endif #elif defined GNULIB_POSIXCHECK # undef duplocale # if HAVE_RAW_DECL_DUPLOCALE
c-strtold compilation failure on mingw
On mingw, I'm seeing this compilation error: gcc-3 -mno-cygwin -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\.exe\ -DEXEEXT=\.exe\ -DNO_XMALLOC -DEXEEXT=\.exe\ -I. -I.. -I../intl -I/usr/local/mingw/include -Wall -g -O2 -MT c-strtold.o -MD -MP -MF $depbase.Tpo -c -o c-strtold.o c-strtold.c \ mv -f $depbase.Tpo $depbase.Po In file included from /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/windef.h:253, from /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/windows.h:48, from /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/winsock2.h:22, from ./unistd.h:50, from ./stdlib.h:75, from c-strtod.c:26, from c-strtold.c:2: /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/winnt.h:79: error: parse error before numeric constant /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/winnt.h:146: error: parse error before numeric constant ... The reason is a 'typedef long LONG;' line in winnt.h:79, which collides with the use of 'LONG' in lib/c-strtold.c. This fixes it. 2010-04-03 Bruno Haible br...@clisp.org stdlib: Avoid compilation failure of c-strtold on mingw. * lib/stdlib.in.h: Don't include unistd.h on native Windows systems. --- lib/stdlib.in.h.origSat Apr 3 12:04:00 2010 +++ lib/stdlib.in.h Sat Apr 3 12:03:43 2010 @@ -67,10 +67,10 @@ }; #endif -#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) ! defined __GLIBC__ +#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) ! defined __GLIBC__ !((defined _WIN32 || defined __WIN32__) ! defined __CYGWIN__) /* On MacOS X 10.3, only unistd.h declares mkstemp. */ /* On Cygwin 1.7.1, only unistd.h declares getsubopt. */ -/* But avoid namespace pollution on glibc systems. */ +/* But avoid namespace pollution on glibc systems and native Windows. */ # include unistd.h #endif
openpty and mingw
The pty/tty functions are not yet ported to mingw. (Native Windows does not have ttys, not even a termios.h.) This fixes the doc: 2010-04-03 Bruno Haible br...@clisp.org * doc/glibc-functions/openpty.texi: Update regarding mingw. * doc/glibc-functions/login_tty.texi: Likewise. * doc/glibc-functions/forkpty.texi: Likewise. --- doc/glibc-functions/forkpty.texi.orig Sat Apr 3 12:11:07 2010 +++ doc/glibc-functions/forkpty.texiSat Apr 3 12:10:52 2010 @@ -8,7 +8,7 @@ @itemize @item This function is missing on some platforms: -AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, mingw. +AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10. @item One some systems (at least including Cygwin, Interix, OSF/1 4 and 5, and Mac OS X) linking with @code{-lutil} is not required. @@ -27,4 +27,7 @@ Portability problems not fixed by Gnulib: @itemize +...@item +This function is missing on some platforms: +mingw. @end itemize --- doc/glibc-functions/login_tty.texi.orig Sat Apr 3 12:11:07 2010 +++ doc/glibc-functions/login_tty.texi Sat Apr 3 12:10:51 2010 @@ -8,7 +8,7 @@ @itemize @item This function is missing on some platforms: -AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, mingw. +AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10. @item This function requires linking with @code{-lutil} on some platforms: glibc 2.3.6, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8. @@ -19,6 +19,9 @@ Portability problems not fixed by Gnulib: @itemize @item +This function is missing on some platforms: +mingw. +...@item This function is declared in @code{utmp.h} on glibc, Cygwin, in @code{util.h} on MacOS X 10.3, NetBSD 3.0, OpenBSD 3.8, in @code{libutil.h} on FreeBSD 6.0, Haiku, and not declared at all --- doc/glibc-functions/openpty.texi.orig Sat Apr 3 12:11:07 2010 +++ doc/glibc-functions/openpty.texiSat Apr 3 12:10:51 2010 @@ -8,7 +8,7 @@ @itemize @item This function is missing on some platforms: -AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, mingw. +AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10. @item One some systems (at least including Cygwin, Interix, OSF/1 4 and 5, and Mac OS X) linking with @code{-lutil} is not required. @@ -27,4 +27,7 @@ Portability problems not fixed by Gnulib: @itemize +...@item +This function is missing on some platforms: +mingw. @end itemize
getcwd on mingw
On mingw, I'm seeing this error in the C++ namespace tests: ../gllib/unistd.h:794: error: invalid conversion from `char*(*)(char*, int)' to `char*(*)(char*, size_t)' This should fix it: 2010-04-03 Bruno Haible br...@clisp.org unistd: Fix C++ test error on mingw. * lib/unistd.in.h (getcwd): Use _GL_CXXALIAS_SYS_CAST. --- lib/unistd.in.h.origSat Apr 3 12:28:38 2010 +++ lib/unistd.in.h Sat Apr 3 12:28:19 2010 @@ -525,7 +525,9 @@ _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); # else -_GL_CXXALIAS_SYS (getcwd, char *, (char *buf, size_t size)); +/* Need to cast, because on mingw, the second parameter is + int size. */ +_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); # endif _GL_CXXALIASWARN (getcwd); #elif defined GNULIB_POSIXCHECK
Re: openpty and mingw
And a related doc update is this one: 2010-04-03 Bruno Haible br...@clisp.org pty: Update doc. * doc/glibc-headers/pty.texi: Mention changes done since 2010-03-18. --- doc/glibc-headers/pty.texi.orig Sat Apr 3 12:37:37 2010 +++ doc/glibc-headers/pty.texi Sat Apr 3 12:36:26 2010 @@ -25,11 +25,14 @@ @code{forkpty} and @code{openpty} functions in @code{util.h} or @code{libutil.h} instead: MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8. +...@item +This header file is missing on some platforms: +AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, BeOS. @end itemize Portability problems not fixed by Gnulib: @itemize @item This header file is missing on some platforms: -AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, mingw, BeOS. +mingw. @end itemize
lchmod on mingw
On mingw, the C++ tests give this error: ../gllib/sys/stat.h:659: error: invalid conversion from `int (*)(const char*, int)' to `int (*)(const char*, mode_t)' The reason is that the 'chmod' function in mingw has an 'int' as second argument type. This fixes it: 2010-04-03 Bruno Haible br...@clisp.org sys_stat: Fix C++ test error on mingw. * build-aux/c++defs.h (_GL_CXXALIAS_RPL_CAST_1): New macro. * lib/sys_stat.in.h (lchmod): Use it instead of _GL_CXXALIAS_RPL_1. --- build-aux/c++defs.h.origSat Apr 3 12:51:48 2010 +++ build-aux/c++defs.h Sat Apr 3 12:50:14 2010 @@ -126,6 +126,24 @@ _GL_EXTERN_C int _gl_cxxalias_dummy #endif +/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); + is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); + except that the C function rpl_func may have a slightly different + declaration. A cast is used to silence the invalid conversion error + that would otherwise occur. */ +#if defined __cplusplus defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ +namespace GNULIB_NAMESPACE \ +{ \ + rettype (*const func) parameters = \ +reinterpret_castrettype(*)parameters(::rpl_func);\ +} \ +_GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ +_GL_EXTERN_C int _gl_cxxalias_dummy +#endif + /* _GL_CXXALIAS_SYS (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to the system provided function func, if GNULIB_NAMESPACE --- lib/sys_stat.in.h.orig Sat Apr 3 12:51:48 2010 +++ lib/sys_stat.in.h Sat Apr 3 12:51:42 2010 @@ -390,7 +390,10 @@ # if !(defined __cplusplus defined GNULIB_NAMESPACE) # define lchmod chmod # endif -_GL_CXXALIAS_RPL_1 (lchmod, chmod, int, (const char *filename, mode_t mode)); +/* Need to cast, because on mingw, the second parameter of chmod is +int mode. */ +_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int, + (const char *filename, mode_t mode)); # else # if 0 /* assume already declared */ _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
stpncpy on mingw
On mingw, with warn-on-use.h modified to simulate a gcc = 4.3, I'm seeing this error: In file included from test-string-c++.cc:22: ../gllib/string.h:525: error: `stpncpy' was not declared in this scope The reason is that the 'stpncpy' module uses #define stpncpy rpl_stpncpy both in the case when the function is missing (like on mingw) and in the case where the system provide a broken one (like on AIX). Here it becomes necessary to distinguish the two cases, like we do for many other functions. 2010-04-03 Bruno Haible br...@clisp.org stpncpy: Fix C++ test error on mingw. * lib/string.in.h (stpncpy): Use modern idiom. * m4/stpncpy.m4 (gl_FUNC_STPNCPY): Distinguish the case that the function is missing and that it needs to be replaced. * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Initialize REPLACE_STPNCPY. * modules/string (Makefile.am): Replace REPLACE_STPNCPY. --- lib/string.in.h.origSat Apr 3 13:13:03 2010 +++ lib/string.in.h Sat Apr 3 13:08:01 2010 @@ -222,7 +222,7 @@ /* Copy no more than N bytes of SRC to DST, returning a pointer past the last non-NUL byte written into DST. */ #if @GNULIB_STPNCPY@ -# if ! @HAVE_STPNCPY@ +# if @REPLACE_STPNCPY@ # if !(defined __cplusplus defined GNULIB_NAMESPACE) # define stpncpy rpl_stpncpy # endif @@ -234,6 +234,12 @@ (char *restrict __dst, char const *restrict __src, size_t __n)); # else +# if ! @HAVE_STPNCPY@ +_GL_FUNCDECL_SYS (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); +# endif _GL_CXXALIAS_SYS (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n)); --- m4/stpncpy.m4.orig Sat Apr 3 13:13:03 2010 +++ m4/stpncpy.m4 Sat Apr 3 13:12:27 2010 @@ -1,4 +1,4 @@ -# stpncpy.m4 serial 10 +# stpncpy.m4 serial 11 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -25,8 +25,10 @@ dnl in AIX: dest + max(0,n-1) dnl Only the glibc return value is useful in practice. - AC_CACHE_CHECK([for working stpncpy], [gl_cv_func_stpncpy], [ -AC_TRY_RUN([ + AC_CHECK_FUNCS_ONCE([stpncpy]) + if test $ac_cv_func_stpncpy = yes; then +AC_CACHE_CHECK([for working stpncpy], [gl_cv_func_stpncpy], [ + AC_TRY_RUN([ #include stdlib.h #include string.h /* for strcpy */ /* The stpncpy prototype is missing in string.h on AIX 4. */ @@ -45,17 +47,23 @@ if (stpncpy (dest, src, 7) != dest + 5) exit(1); exit(0); } -], gl_cv_func_stpncpy=yes, gl_cv_func_stpncpy=no, - [AC_EGREP_CPP([Thanks for using GNU], [ +], [gl_cv_func_stpncpy=yes], [gl_cv_func_stpncpy=no], +[AC_EGREP_CPP([Thanks for using GNU], [ #include features.h #ifdef __GNU_LIBRARY__ Thanks for using GNU #endif -], gl_cv_func_stpncpy=yes, gl_cv_func_stpncpy=no)])]) - - if test $gl_cv_func_stpncpy = yes; then -AC_DEFINE([HAVE_STPNCPY], [1], - [Define if you have the stpncpy() function and it works.]) +], [gl_cv_func_stpncpy=yes], [gl_cv_func_stpncpy=no]) +]) +]) +if test $gl_cv_func_stpncpy = yes; then + AC_DEFINE([HAVE_STPNCPY], [1], +[Define if you have the stpncpy() function and it works.]) +else + REPLACE_STPNCPY=1 + AC_LIBOBJ([stpncpy]) + gl_PREREQ_STPNCPY +fi else HAVE_STPNCPY=0 AC_LIBOBJ([stpncpy]) --- m4/string_h.m4.orig Sat Apr 3 13:13:03 2010 +++ m4/string_h.m4 Sat Apr 3 13:08:32 2010 @@ -5,7 +5,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 13 +# serial 14 # Written by Paul Eggert. @@ -95,6 +95,7 @@ HAVE_STRVERSCMP=1;AC_SUBST([HAVE_STRVERSCMP]) REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) + REPLACE_STPNCPY=0;AC_SUBST([REPLACE_STPNCPY]) REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) --- modules/string.orig Sat Apr 3 13:13:03 2010 +++ modules/string Sat Apr 3 13:08:51 2010 @@ -79,6 +79,7 @@ -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
Re: wdiff-0.6.1 build problems
Hi Martin, On Solaris 7 SPARC, compilation with cc fails like this: cc -DHAVE_CONFIG_H -I. -I.. -DDEFAULT_TEXT_DOMAIN=\wdiff-gnulib\ -I../intl -I/usr/local/include -I/usr/local/include -c localcharset.c ./getopt.h, line 31: empty file name cc: acomp failed for localcharset.c I did a fresh build using gcc-2.95.3 (the last gcc version that builds on that O/S), and that solved the problem. See his full report in the wdiff-bugs list archive: http://lists.gnu.org/archive/html/wdiff-bugs/2010-04/msg2.html Thanks for the forward, this problem is in gnulib's area. Can you imagine what's causing this? It relates to the use of include_next. m4/include_next.m4 contains a number of compiler dependent workarounds. Maybe one more such workaround is needed? Bruno
mkstemp on mingw
Similarly for the mkstemp function: I'm seeing this error: ../gllib/stdlib.h:600: error: `mkstemp' was not declared in this scope Here it becomes necessary to distinguish the two cases, like we do for many other functions. Likewise here. This fixes it. 2010-04-03 Bruno Haible br...@clisp.org mkstemp: Fix C++ test error on mingw. * lib/stdlib.in.h (mkstemp): Use modern idiom. * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Distinguish the case that the function is missing and that it needs to be replaced. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_MKSTEMP. * modules/stdlib (Makefile.am): Substitute HAVE_MKSTEMP. --- lib/stdlib.in.h.origSat Apr 3 13:42:15 2010 +++ lib/stdlib.in.h Sat Apr 3 13:32:01 2010 @@ -329,6 +329,9 @@ _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); # else +# if ! @HAVE_MKSTEMP@ +_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); +# endif _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); # endif _GL_CXXALIASWARN (mkstemp); --- m4/mkstemp.m4.orig Sat Apr 3 13:42:15 2010 +++ m4/mkstemp.m4 Sat Apr 3 13:34:10 2010 @@ -1,4 +1,4 @@ -#serial 17 +#serial 18 # Copyright (C) 2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -16,35 +16,41 @@ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([AC_SYS_LARGEFILE]) - AC_CACHE_CHECK([for working mkstemp], -[gl_cv_func_working_mkstemp], -[ - mkdir conftest.mkstemp - AC_RUN_IFELSE( -[AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT], - [[int i; -off_t large = (off_t) 4294967295u; -if (large 0) - large = 2147483647; -for (i = 0; i 70; i++) - { -char templ[] = conftest.mkstemp/coXX; -int (*mkstemp_function) (char *) = mkstemp; -int fd = mkstemp_function (templ); -if (fd 0 || lseek (fd, large, SEEK_SET) != large) - return 1; -close (fd); - } -return 0;]])], -[gl_cv_func_working_mkstemp=yes], -[gl_cv_func_working_mkstemp=no], -[gl_cv_func_working_mkstemp=no]) - rm -rf conftest.mkstemp -]) - - if test $gl_cv_func_working_mkstemp != yes; then -REPLACE_MKSTEMP=1 + AC_CHECK_FUNCS_ONCE([mkstemp]) + if test $ac_cv_func_mkstemp = yes; then +AC_CACHE_CHECK([for working mkstemp], + [gl_cv_func_working_mkstemp], + [ +mkdir conftest.mkstemp +AC_RUN_IFELSE( + [AC_LANG_PROGRAM( +[AC_INCLUDES_DEFAULT], +[[int i; + off_t large = (off_t) 4294967295u; + if (large 0) +large = 2147483647; + for (i = 0; i 70; i++) +{ + char templ[] = conftest.mkstemp/coXX; + int (*mkstemp_function) (char *) = mkstemp; + int fd = mkstemp_function (templ); + if (fd 0 || lseek (fd, large, SEEK_SET) != large) +return 1; + close (fd); +} + return 0;]])], + [gl_cv_func_working_mkstemp=yes], + [gl_cv_func_working_mkstemp=no], + [gl_cv_func_working_mkstemp=no]) +rm -rf conftest.mkstemp + ]) +if test $gl_cv_func_working_mkstemp != yes; then + REPLACE_MKSTEMP=1 + AC_LIBOBJ([mkstemp]) + gl_PREREQ_MKSTEMP +fi + else +HAVE_MKSTEMP=0 AC_LIBOBJ([mkstemp]) gl_PREREQ_MKSTEMP fi --- m4/stdlib_h.m4.orig Sat Apr 3 13:42:15 2010 +++ m4/stdlib_h.m4 Sat Apr 3 13:32:26 2010 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 27 +# stdlib_h.m4 serial 28 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -85,6 +85,7 @@ HAVE_MKDTEMP=1;AC_SUBST([HAVE_MKDTEMP]) HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) + HAVE_MKSTEMP=1;AC_SUBST([HAVE_MKSTEMP]) HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) HAVE_PTSNAME=1;AC_SUBST([HAVE_PTSNAME]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) --- modules/stdlib.orig Sat Apr 3 13:42:15 2010 +++ modules/stdlib Sat Apr 3 13:32:36 2010 @@ -62,6 +62,7 @@ -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ + -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ -e
fseeko on mingw
Similarly for the fseeko function on mingw. I'm seeing this error: ../gllib/stdio.h:632: error: `fseeko' was not declared in this scope This should fix it. 2010-04-03 Bruno Haible br...@clisp.org fseeko: Fix C++ test error on mingw. * lib/stdio.in.h (fseeko): Use modern idiom. * m4/fseeko.m4 (gl_FUNC_FSEEKO): Distinguish the case that the function is missing and that it needs to be replaced. (gl_REPLACE_FSEEKO): Don't set REPLACE_FSEEKO here. * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize HAVE_FSEEKO. * modules/stdio (Makefile.am): Substitute HAVE_FSEEKO. --- lib/stdio.in.h.orig Sat Apr 3 14:03:46 2010 +++ lib/stdio.in.h Sat Apr 3 14:02:20 2010 @@ -322,30 +322,35 @@ # undef fseek # endif # if @REPLACE_FSEEKO@ -/* Provide fseek, fseeko functions that are aware of a preceding - fflush(), and which detect pipes. */ +/* Provide an fseeko function that is aware of a preceding fflush(), and which + detects pipes. */ # if !(defined __cplusplus defined GNULIB_NAMESPACE) # undef fseeko # define fseeko rpl_fseeko # endif _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1))); -# if !...@gnulib_fseek@ -/* In order to avoid that fseek gets defined as a macro here, the - developer can request the 'fseek' module. */ -# undef fseek -# define fseek rpl_fseek +_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); +# else +# if ! @HAVE_FSEEKO@ +_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); +# endif +_GL_CXXALIASWARN (fseeko); +# if (@REPLACE_FSEEKO@ || !...@have_fseeko@) !...@gnulib_fseek@ + /* Provide an fseek function that is consistent with fseeko. */ + /* In order to avoid that fseek gets defined as a macro here, the + developer can request the 'fseek' module. */ +# undef fseek +# define fseek rpl_fseek static inline int _GL_ARG_NONNULL ((1)) rpl_fseek (FILE *fp, long offset, int whence) { return fseeko (fp, offset, whence); } -# endif -_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); -# else -_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); # endif -_GL_CXXALIASWARN (fseeko); #elif defined GNULIB_POSIXCHECK # define _GL_FSEEK_WARN /* Category 1, above. */ # undef fseek --- m4/fseeko.m4.orig Sat Apr 3 14:03:46 2010 +++ m4/fseeko.m4Sat Apr 3 13:55:55 2010 @@ -1,4 +1,4 @@ -# fseeko.m4 serial 7 +# fseeko.m4 serial 8 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,8 +19,14 @@ ]], [fseeko (stdin, 0, 0);])], [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no]) ]) - if test $gl_cv_func_fseeko = no \ - || test $gl_cv_var_stdin_large_offset = no; then + if test $gl_cv_func_fseeko = no; then +HAVE_FSEEKO=0 + else +if test $gl_cv_var_stdin_large_offset = no; then + REPLACE_FSEEKO=1 +fi + fi + if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then gl_REPLACE_FSEEKO fi ]) @@ -28,8 +34,6 @@ AC_DEFUN([gl_REPLACE_FSEEKO], [ AC_LIBOBJ([fseeko]) - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - REPLACE_FSEEKO=1 dnl If we are also using the fseek module, then fseek needs replacing, too. m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK]) ]) --- m4/stdio_h.m4.orig Sat Apr 3 14:03:46 2010 +++ m4/stdio_h.m4 Sat Apr 3 14:03:10 2010 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 27 +# stdio_h.m4 serial 28 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -99,6 +99,7 @@ HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) HAVE_DPRINTF=1;AC_SUBST([HAVE_DPRINTF]) + HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) --- modules/stdio.orig Sat Apr 3 14:03:46 2010 +++ modules/stdio Sat Apr 3 14:02:46 2010 @@ -76,6 +76,7 @@ -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ + -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \
ftello on mingw
Likewise for the function: ../gllib/stdio.h:699: error: `ftello' was not declared in this scope This should fix it: 2010-04-03 Bruno Haible br...@clisp.org ftello: Fix C++ test error on mingw. * lib/stdio.in.h (ftello): Use modern idiom. * m4/ftello.m4 (gl_FUNC_FTELLO): Distinguish the case that the function is missing and that it needs to be replaced. (gl_REPLACE_FTELLO): Don't set REPLACE_FTELLO here. * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize HAVE_FTELLO. * modules/stdio (Makefile.am): Substitute HAVE_FTELLO. --- lib/stdio.in.h.orig Sat Apr 3 14:23:54 2010 +++ lib/stdio.in.h Sat Apr 3 14:21:18 2010 @@ -402,22 +402,26 @@ # define ftello rpl_ftello # endif _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); -# if !...@gnulib_ftell@ -/* In order to avoid that ftell gets defined as a macro here, the - developer can request the 'ftell' module. */ -# undef ftell -# define ftell rpl_ftell +_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); +# else +# if ! @HAVE_FTELLO@ +_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); +# endif +_GL_CXXALIASWARN (ftello); +# if (@REPLACE_FTELLO@ || !...@have_ftello@) !...@gnulib_ftell@ + /* Provide an ftell function that is consistent with ftello. */ + /* In order to avoid that ftell gets defined as a macro here, the + developer can request the 'ftell' module. */ +# undef ftell +# define ftell rpl_ftell static inline long _GL_ARG_NONNULL ((1)) rpl_ftell (FILE *f) { return ftello (f); } -# endif -_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); -# else -_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); # endif -_GL_CXXALIASWARN (ftello); #elif defined GNULIB_POSIXCHECK # define _GL_FTELL_WARN /* Category 1, above. */ # undef ftell --- m4/ftello.m4.orig Sat Apr 3 14:23:54 2010 +++ m4/ftello.m4Sat Apr 3 14:22:34 2010 @@ -1,4 +1,4 @@ -# ftello.m4 serial 5 +# ftello.m4 serial 6 dnl Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,8 +18,14 @@ AC_TRY_LINK([#include stdio.h], [ftello (stdin);], [gl_cv_func_ftello=yes], [gl_cv_func_ftello=no]) ]) - if test $gl_cv_func_ftello = no \ - || test $gl_cv_var_stdin_large_offset = no; then + if test $gl_cv_func_ftello = no; then +HAVE_FTELLO=0 + else +if test $gl_cv_var_stdin_large_offset = no; then + REPLACE_FTELLO=1 +fi + fi + if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then gl_REPLACE_FTELLO fi ]) @@ -27,6 +33,4 @@ AC_DEFUN([gl_REPLACE_FTELLO], [ AC_LIBOBJ([ftello]) - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - REPLACE_FTELLO=1 ]) --- m4/stdio_h.m4.orig Sat Apr 3 14:23:54 2010 +++ m4/stdio_h.m4 Sat Apr 3 14:23:15 2010 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 28 +# stdio_h.m4 serial 29 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -100,6 +100,7 @@ HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) HAVE_DPRINTF=1;AC_SUBST([HAVE_DPRINTF]) HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) + HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) --- modules/stdio.orig Sat Apr 3 14:23:54 2010 +++ modules/stdio Sat Apr 3 14:22:57 2010 @@ -77,6 +77,7 @@ -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ + -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \
getline on mingw
A different case is this error: ../gllib/stdio.h:803: error: `getline' was not declared in this scope Here we really want to do #define getline rpl_getline even if the system does not declare the function, for the reason mentioned in the documentation: Some platforms provide a function by this name but with the wrong signature, for example in -linet. So the fix is this: 2010-04-03 Bruno Haible br...@clisp.org stdio: Make C++ tests work on mingw. * lib/stdio.in.h (getline): Don't use _GL_CXXALIASWARN if the system does not declare the function. --- lib/stdio.in.h.orig Sat Apr 3 14:33:08 2010 +++ lib/stdio.in.h Sat Apr 3 14:31:26 2010 @@ -525,7 +525,9 @@ _GL_CXXALIAS_SYS (getline, ssize_t, (char **lineptr, size_t *linesize, FILE *stream)); # endif +# if @HAVE_DECL_GETLINE@ _GL_CXXALIASWARN (getline); +# endif #elif defined GNULIB_POSIXCHECK # undef getline # if HAVE_RAW_DECL_GETLINE
getpagesize on mingw
Similarly, I'm seeing this error in C++ mode on mingw: ../gllib/unistd.h:1042: error: `getpagesize' was not declared in this scope This fixes it: 2010-04-03 Bruno Haible br...@clisp.org getpagesize: Fix C++ test error on mingw. * lib/unistd.in.h (getpagesize): Don't use _GL_CXXALIASWARN if the system does not declare the function. * m4/getpagesize.m4 (gl_FUNC_GETPAGESIZE): Also check whether it's declared. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize HAVE_DECL_GETPAGESIZE. * modules/unistd (Makefile.am): Substitute HAVE_DECL_GETPAGESIZE. --- lib/unistd.in.h.origSat Apr 3 15:36:15 2010 +++ lib/unistd.in.h Sat Apr 3 15:06:27 2010 @@ -775,7 +775,9 @@ /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); # endif +# if @HAVE_DECL_GETPAGESIZE@ _GL_CXXALIASWARN (getpagesize); +# endif #elif defined GNULIB_POSIXCHECK # undef getpagesize # if HAVE_RAW_DECL_GETPAGESIZE --- m4/getpagesize.m4.orig Sat Apr 3 15:36:15 2010 +++ m4/getpagesize.m4 Sat Apr 3 15:35:52 2010 @@ -1,4 +1,4 @@ -# getpagesize.m4 serial 7 +# getpagesize.m4 serial 8 dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -27,4 +27,7 @@ AC_LIBOBJ([getpagesize]) ;; esac + dnl Also check whether it's declared. + dnl mingw has getpagesize() in libgcc.a but doesn't declare it. + AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0]) ]) --- m4/unistd_h.m4.orig Sat Apr 3 15:36:15 2010 +++ m4/unistd_h.m4 Sat Apr 3 15:07:45 2010 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 43 +# unistd_h.m4 serial 44 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -122,6 +122,7 @@ HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) HAVE_DECL_ENVIRON=1;AC_SUBST([HAVE_DECL_ENVIRON]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) + HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) HAVE_OS_H=0;AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) --- modules/unistd.orig Sat Apr 3 15:36:15 2010 +++ modules/unistd Sat Apr 3 15:07:24 2010 @@ -96,6 +96,7 @@ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
fchdir on mingw
On mingw still, I'm seeing these errors: test-fchdir.c:24: error: `fchdir' undeclared here (not in a function) make[4]: *** [test-fchdir.o] Error 1 and in C++ mode: ../gllib/unistd.h:698: error: `fchdir' was not declared in this scope The reason is a regression from 2010-03-08: I was confused by the macro REPLACE_FCHDIR, when the common idiom is to use !...@have_fchdir@ instead. This fixes it: 2010-04-03 Bruno Haible br...@clisp.org fchdir: Fix regression introduced on 2010-03-08. * lib/unistd.in.h (fchdir): Fix declaration. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Set HAVE_FCHDIR, not REPLACE_FCHDIR. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize HAVE_FCHDIR, not REPLACE_FCHDIR. * modules/unistd (Makefile.am): Substitute HAVE_FCHDIR, not REPLACE_FCHDIR. --- lib/unistd.in.h.origSat Apr 3 15:53:45 2010 +++ lib/unistd.in.h Sat Apr 3 15:51:28 2010 @@ -415,9 +415,8 @@ Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification http://www.opengroup.org/susv3xsh/fchdir.html. */ -# if @REPLACE_FCHDIR@ -_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/)); -_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/)); +# if ! @HAVE_FCHDIR@ +_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); /* Gnulib internal hooks needed to maintain the fchdir metadata. */ _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) @@ -426,9 +425,8 @@ _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); _GL_EXTERN_C const char *_gl_directory_name (int fd); -# else -_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); # endif +_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); _GL_CXXALIASWARN (fchdir); #elif defined GNULIB_POSIXCHECK # undef fchdir --- m4/fchdir.m4.orig Sat Apr 3 15:53:45 2010 +++ m4/fchdir.m4Sat Apr 3 15:49:56 2010 @@ -1,4 +1,4 @@ -# fchdir.m4 serial 13 +# fchdir.m4 serial 14 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,7 @@ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([fchdir]) if test $ac_cv_func_fchdir = no; then -REPLACE_FCHDIR=1 +HAVE_FCHDIR=0 AC_LIBOBJ([fchdir]) gl_PREREQ_FCHDIR AC_DEFINE([REPLACE_FCHDIR], [1], --- m4/unistd_h.m4.orig Sat Apr 3 15:53:45 2010 +++ m4/unistd_h.m4 Sat Apr 3 15:51:58 2010 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 44 +# unistd_h.m4 serial 45 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -98,6 +98,7 @@ HAVE_DUP3=1;AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) + HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) HAVE_FCHOWNAT=1;AC_SUBST([HAVE_FCHOWNAT]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) @@ -130,7 +131,6 @@ REPLACE_CLOSE=0;AC_SUBST([REPLACE_CLOSE]) REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) - REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETGROUPS=0;AC_SUBST([REPLACE_GETGROUPS]) --- modules/unistd.orig Sat Apr 3 15:53:45 2010 +++ modules/unistd Sat Apr 3 15:52:24 2010 @@ -72,6 +72,7 @@ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ + -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ @@ -104,7 +105,6 @@ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ - -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
nanosleep on mingw
Similarly, on mingw with warn-on-use.h modified to work like if g++ = 4.3 were present, I'm seeing this error: ../gllib/time.h:359: error: `nanosleep' was not declared in this scope It would also be an error on the other platforms lacking nanosleep, with g++ 4.3. Again, to fix this, one needs to distinguish the case where the function is missing and the case where the function is being replaced (overridden). Jim, here is a proposed patch. It fixes the error. The big change to m4/nanosleep.m4 is mostly an indentation change. OK to commit? 2010-04-03 Bruno Haible br...@clisp.org nanosleep: Fix C++ test error on mingw. * lib/nanosleep.c (nanosleep): Renamed from rpl_nanosleep. * lib/time.in.h (nanosleep): Use modern idiom. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): When the system does not have a nanosleep function, set HAVE_NANOSLEEP to 0, instead of setting REPLACE_NANOSLEEP to 1. * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize HAVE_NANOSLEEP. * modules/time (Makefile.am): Substitute HAVE_NANOSLEEP. --- lib/nanosleep.c.origSat Apr 3 17:46:42 2010 +++ lib/nanosleep.c Sat Apr 3 17:20:06 2010 @@ -36,15 +36,15 @@ #include unistd.h -#undef nanosleep enum { BILLION = 1000 * 1000 * 1000 }; #if HAVE_BUG_BIG_NANOSLEEP int -rpl_nanosleep (const struct timespec *requested_delay, - struct timespec *remaining_delay) +nanosleep (const struct timespec *requested_delay, + struct timespec *remaining_delay) +#undef nanosleep { /* nanosleep mishandles large sleeps due to internal overflow problems. The worst known case of this is cygwin 1.5.x, which @@ -128,8 +128,8 @@ *REMAINING_DELAY part isn't implemented yet. */ int -rpl_nanosleep (const struct timespec *requested_delay, - struct timespec *remaining_delay) +nanosleep (const struct timespec *requested_delay, + struct timespec *remaining_delay) { static bool initialized; --- lib/time.in.h.orig Sat Apr 3 17:46:42 2010 +++ lib/time.in.h Sat Apr 3 17:24:27 2010 @@ -87,6 +87,11 @@ _GL_CXXALIAS_RPL (nanosleep, int, (struct timespec const *__rqtp, struct timespec *__rmtp)); # else +# if ! @HAVE_NANOSLEEP@ +_GL_FUNCDECL_SYS (nanosleep, int, + (struct timespec const *__rqtp, struct timespec *__rmtp) + _GL_ARG_NONNULL ((1))); +# endif _GL_CXXALIAS_SYS (nanosleep, int, (struct timespec const *__rqtp, struct timespec *__rmtp)); # endif --- m4/nanosleep.m4.origSat Apr 3 17:46:42 2010 +++ m4/nanosleep.m4 Sat Apr 3 17:35:42 2010 @@ -1,4 +1,4 @@ -# serial 30 +# serial 31 dnl From Jim Meyering. dnl Check for the nanosleep function. @@ -29,93 +29,99 @@ AC_SEARCH_LIBS([nanosleep], [rt posix4], [test $ac_cv_search_nanosleep = none required || LIB_NANOSLEEP=$ac_cv_search_nanosleep]) + if test x$ac_cv_search_nanosleep != xno; then + dnl The system has a nanosleep function. - AC_REQUIRE([gl_MULTIARCH]) - if test $APPLE_UNIVERSAL_BUILD = 1; then - # A universal build on Apple MacOS X platforms. - # The test result would be 'no (mishandles large arguments)' in 64-bit mode - # but 'yes' in 32-bit mode. But we need a configuration result that is - # valid in both modes. - gl_cv_func_nanosleep='no (mishandles large arguments)' + AC_REQUIRE([gl_MULTIARCH]) + if test $APPLE_UNIVERSAL_BUILD = 1; then + # A universal build on Apple MacOS X platforms. + # The test result would be 'no (mishandles large arguments)' in 64-bit + # mode but 'yes' in 32-bit mode. But we need a configuration result that + # is valid in both modes. + gl_cv_func_nanosleep='no (mishandles large arguments)' + fi + + AC_CACHE_CHECK([for working nanosleep], +[gl_cv_func_nanosleep], +[ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include errno.h + #include limits.h + #include signal.h + #if HAVE_SYS_TIME_H + #include sys/time.h + #endif + #include time.h + #include unistd.h + #define TYPE_SIGNED(t) (! ((t) 0 (t) -1)) + #define TYPE_MAXIMUM(t) \ +((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ~ (~ (t) 0 (sizeof (t) * CHAR_BIT - 1 + + static void + check_for_SIGALRM (int sig) + { +if (sig != SIGALRM) + _exit (1); + } + + int + main () + { +static struct timespec ts_sleep; +static struct timespec ts_remaining; +static struct sigaction act; +if (! nanosleep) + return 1; +act.sa_handler = check_for_SIGALRM; +sigemptyset (act.sa_mask); +sigaction (SIGALRM, act, NULL); +ts_sleep.tv_sec = 0; +ts_sleep.tv_nsec = 1; +
[PATCH] maint.mk: don't silently disable project-specific syntax-check rules
I realized that the recent variable name change was actually rather insidious. It would silently disable project-specific syntax-check rules that used the old name. That made it very likely that someone would not notice, and would never upgrade to use the new name, _sc_search_regexp. This new definition prevents that. From 219c504b3178a07389eef1cd411bde3864f3f54c Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Sat, 3 Apr 2010 18:03:16 +0200 Subject: [PATCH] maint.mk: don't silently disable project-specific syntax-check rules * top/maint.mk (_prohibit_regexp): Define, to help people realize that they need to convert their project-specific syntax-check rules to use the new _sc_search_regexp. --- ChangeLog|7 +++ top/maint.mk |9 + 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f33302..36443a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-04-03 Jim Meyering meyer...@redhat.com + + maint.mk: don't silently disable project-specific syntax-check rules + * top/maint.mk (_prohibit_regexp): Define, to help people realize + that they need to convert their project-specific syntax-check rules + to use the new _sc_search_regexp. + 2010-04-03 Bruno Haible br...@clisp.org fchdir: Fix regression introduced on 2010-03-08. diff --git a/top/maint.mk b/top/maint.mk index 13a0438..3038680 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -189,6 +189,15 @@ define _sc_say_and_exit { echo -e $(ME): $$msg 12; exit 1; }; endef +# _sc_search_regexp used to be named _prohibit_regexp. However, +# upgrading to the new definition and leaving the old name undefined +# would usually convert each custom rule using $(_prohibit_regexp) +# (usually defined in cfg.mk) into a no-op. This definition ensures +# that people know right away if they're still using the old name. +# FIXME: remove in 2012. +_prohibit_regexp = \ + $(error '*** you need to s/_prohibit_regexp/_sc_search_regexp/, and adapt') + define _sc_search_regexp dummy=; : so we do not need a semicolon before each use;\ \ -- 1.7.0.4.529.g78fb
time: fix regression
This fixes a bad copypaste mistake I did three weeks ago: 2010-04-03 Bruno Haible br...@clisp.org time: Fix regression introduced on 2010-03-08. * m4/time_h.m4 (gl_TIME_MODULE_INDICATOR): Require gl_HEADER_TIME_H_DEFAULTS, not gl_HEADER_STRING_H_DEFAULTS. --- m4/time_h.m4.orig Sat Apr 3 18:22:25 2010 +++ m4/time_h.m4Sat Apr 3 18:21:03 2010 @@ -64,7 +64,7 @@ AC_DEFUN([gl_TIME_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1])
time_r: small updates
This fixes minor issues with the time_r module: not mentioned in the documentation, imprecise module description, unnecessary include. 2010-04-03 Bruno Haible br...@clisp.org time_r: Minor updates. * modules/time_r (Description): Mention the provided functions. * lib/time_r.c: Don't include string.h. * doc/posix-functions/gmtime_r.texi: Mention the 'time_r' module. * doc/posix-functions/localtime_r.texi: Likewise. --- modules/time_r.orig Sat Apr 3 18:46:53 2010 +++ modules/time_r Sat Apr 3 18:45:56 2010 @@ -1,5 +1,5 @@ Description: -Reentrant time functions like localtime_r. +Reentrant time functions: localtime_r, gmtime_r. Files: lib/time_r.c --- lib/time_r.c.orig Sat Apr 3 18:46:53 2010 +++ lib/time_r.cSat Apr 3 18:45:56 2010 @@ -1,6 +1,6 @@ /* Reentrant time functions like localtime_r. - Copyright (C) 2003, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,8 +22,6 @@ #include time.h -#include string.h - static struct tm * copy_tm_result (struct tm *dest, struct tm const *src) { --- doc/posix-functions/gmtime_r.texi.orig Sat Apr 3 18:46:53 2010 +++ doc/posix-functions/gmtime_r.texi Sat Apr 3 18:45:56 2010 @@ -4,14 +4,10 @@ POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/gmtime_r.html} -Gnulib module: --- +Gnulib module: time_r Portability problems fixed by Gnulib: @itemize -...@end itemize - -Portability problems not fixed by Gnulib: -...@itemize @item This function is missing on some platforms: mingw. @@ -19,3 +15,7 @@ Some platforms define a function of this name that is incompatible to POSIX: HP-UX 10. @end itemize + +Portability problems not fixed by Gnulib: +...@itemize +...@end itemize --- doc/posix-functions/localtime_r.texi.orig Sat Apr 3 18:46:53 2010 +++ doc/posix-functions/localtime_r.texiSat Apr 3 18:45:56 2010 @@ -4,14 +4,10 @@ POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/localtime_r.html} -Gnulib module: --- +Gnulib module: time_r Portability problems fixed by Gnulib: @itemize -...@end itemize - -Portability problems not fixed by Gnulib: -...@itemize @item This function is missing on some platforms: mingw. @@ -19,3 +15,7 @@ Some platforms define a function of this name that is incompatible to POSIX: HP-UX 10. @end itemize + +Portability problems not fixed by Gnulib: +...@itemize +...@end itemize --- m4/time_r.m4.orig Sat Apr 3 18:46:53 2010 +++ m4/time_r.m4Sat Apr 3 18:45:56 2010 @@ -1,7 +1,6 @@ -dnl Reentrant time functions like localtime_r. +dnl Reentrant time functions: localtime_r, gmtime_r. -dnl Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -dnl Inc. +dnl Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved.
localtime_r on mingw
Still on mingw, I'm seeing these errors: ../gllib/time.h:394: error: `localtime_r' was not declared in this scope ../gllib/time.h:409: error: `gmtime_r' was not declared in this scope Same problem: The m4 macros don't distinguish a missing function from a broken system function. This fixes it. 2010-04-03 Bruno Haible br...@clisp.org time_r: Fix C++ test error on mingw. * lib/time.in.h (localtime_r, gmtime_r): Use modern idiom. * m4/time_r.m4 (gl_TIME_R): When localtime_r does not exist, set HAVE_LOCALTIME_R to 0, not REPLACE_LOCALTIME_R to 1. * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize HAVE_LOCALTIME_R. * modules/time (Makefile.am): Substitute HAVE_LOCALTIME_R. --- lib/time.in.h.orig Sat Apr 3 18:50:43 2010 +++ lib/time.in.h Sat Apr 3 18:50:11 2010 @@ -122,6 +122,11 @@ _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # else +# if ! @HAVE_LOCALTIME_R@ +_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result) +_GL_ARG_NONNULL ((1, 2))); +# endif _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # endif @@ -137,6 +142,11 @@ _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # else +# if ! @HAVE_LOCALTIME_R@ +_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result) + _GL_ARG_NONNULL ((1, 2))); +# endif _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # endif --- m4/time_h.m4.orig Sat Apr 3 18:50:43 2010 +++ m4/time_h.m4Sat Apr 3 18:50:11 2010 @@ -77,6 +77,8 @@ GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_LOCALTIME_R=0;AC_SUBST([HAVE_LOCALTIME_R]) dnl If another module says to replace or to not replace, do that. dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; dnl this lets maintainers check for portability. --- m4/time_r.m4.orig Sat Apr 3 18:50:43 2010 +++ m4/time_r.m4Sat Apr 3 18:50:11 2010 @@ -9,29 +9,40 @@ AC_DEFUN([gl_TIME_R], [ - dnl Persuade glibc and Solaris time.h to declare localtime_r. + dnl Persuade glibc and Solaris time.h to declare localtime_r. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) - AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], -[gl_cv_time_r_posix], -[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include time.h]], - [[/* We don't need to append 'restrict's to the argument types, - even though the POSIX signature has the 'restrict's, - since C99 says they can't affect type compatibility. */ - struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; - if (ptr) return 0; - /* Check the return type is a pointer. On HP-UX 10 it is 'int'. */ - *localtime_r (0, 0);]])], - [gl_cv_time_r_posix=yes], - [gl_cv_time_r_posix=no])]) - if test $gl_cv_time_r_posix = yes; then -REPLACE_LOCALTIME_R=0 + AC_CHECK_FUNCS_ONCE([localtime_r]) + if test $ac_cv_func_localtime_r = yes; then +AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], + [gl_cv_time_r_posix], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[[#include time.h]], +[[/* We don't need to append 'restrict's to the argument types, + even though the POSIX signature has the 'restrict's, + since C99 says they can't affect type compatibility. */ + struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; + if (ptr) return 0; + /* Check the return type is a pointer. + On HP-UX 10 it is 'int'. */ + *localtime_r (0, 0);]]) + ], + [gl_cv_time_r_posix=yes], + [gl_cv_time_r_posix=no]) + ]) +if test $gl_cv_time_r_posix = yes; then + REPLACE_LOCALTIME_R=0 +else + REPLACE_LOCALTIME_R=1 +fi else -REPLACE_LOCALTIME_R=1 +HAVE_LOCALTIME_R=0 + fi + if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
timegm on mingw
A similar error for timegm, in the C++ tests on mingw: ../gllib/time.h:448: error: `timegm' was not declared in this scope Again, we need to distinguish the case of a missing function from the case of a broken function. m4/time_h.m4 contains some dubious code: If timegm exists and mktime works fine, but timegm is not declared, it sets REPLACE_TIMEGM to 1, and checks for the prerequisites of lib/timegm.c, but without doing a AC_LIBOBJ([timegm]). This makes no sense to me. Since we don't know of any platform that has timegm but does not declare it, I'm removing this code. 2010-04-03 Bruno Haible br...@clisp.org timegm: Assume declaration if function exists. * m4/timegm.m4 (gl_FUNC_TIMEGM): Assume timegm is declared if and only if it exists. Don't clobber ac_cv_func_timegm. *** m4/timegm.m4.orig Sat Apr 3 19:32:07 2010 --- m4/timegm.m4Sat Apr 3 19:29:55 2010 *** *** 1,4 ! # timegm.m4 serial 6 dnl Copyright (C) 2003, 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ! # timegm.m4 serial 7 dnl Copyright (C) 2003, 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *** *** 8,25 [ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MKTIME]) if test $ac_cv_func_working_mktime = no; then # Assume that timegm is buggy if mktime is. ! AC_LIBOBJ([timegm]) ! ac_cv_func_timegm=no else ! AC_REPLACE_FUNCS([timegm]) ! fi ! REPLACE_TIMEGM=1 ! if test $ac_cv_func_timegm = yes; then ! AC_CHECK_DECLS([timegm], [REPLACE_TIMEGM=0], [], [#include time.h]) fi if test $REPLACE_TIMEGM = 1; then gl_PREREQ_TIMEGM fi ]) --- 8,25 [ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MKTIME]) + REPLACE_TIMEGM=0 if test $ac_cv_func_working_mktime = no; then # Assume that timegm is buggy if mktime is. ! REPLACE_TIMEGM=1 else ! AC_CHECK_FUNCS([timegm]) ! if test $ac_cv_func_timegm != yes; then ! REPLACE_TIMEGM=1 ! fi fi if test $REPLACE_TIMEGM = 1; then + AC_LIBOBJ([timegm]) gl_PREREQ_TIMEGM fi ]) 2010-04-03 Bruno Haible br...@clisp.org timegm: Fix C++ test error on mingw. * lib/time.in.h (timegm): Use modern idiom. * m4/timegm.m4 (gl_FUNC_TIMEGM): When timegm does not exist, set HAVE_TIMEGM to 0, not REPLACE_TIMEGM to 1. * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize HAVE_TIMEGM. * modules/time (Makefile.am): Substitute HAVE_TIMEGM. diff --git a/lib/time.in.h b/lib/time.in.h index 3561016..aeea0b2 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -187,6 +187,9 @@ _GL_CXXALIASWARN (strptime); _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); # else +# if ! @HAVE_TIMEGM@ +_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); +# endif _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); # endif _GL_CXXALIASWARN (timegm); diff --git a/m4/time_h.m4 b/m4/time_h.m4 index ecab807..f69038a 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -79,6 +79,7 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_LOCALTIME_R=0;AC_SUBST([HAVE_LOCALTIME_R]) + HAVE_TIMEGM=0; AC_SUBST([HAVE_TIMEGM]) dnl If another module says to replace or to not replace, do that. dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; dnl this lets maintainers check for portability. diff --git a/m4/timegm.m4 b/m4/timegm.m4 index 010a6f2..bdaafbf 100644 --- a/m4/timegm.m4 +++ b/m4/timegm.m4 @@ -1,4 +1,4 @@ -# timegm.m4 serial 7 +# timegm.m4 serial 8 dnl Copyright (C) 2003, 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,16 +9,16 @@ AC_DEFUN([gl_FUNC_TIMEGM], AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MKTIME]) REPLACE_TIMEGM=0 - if test $ac_cv_func_working_mktime = no; then -# Assume that timegm is buggy if mktime is. -REPLACE_TIMEGM=1 - else -AC_CHECK_FUNCS([timegm]) -if test $ac_cv_func_timegm != yes; then + AC_CHECK_FUNCS_ONCE([timegm]) + if test $ac_cv_func_timegm = yes; then +if test $ac_cv_func_working_mktime = no; then + # Assume that timegm is buggy if mktime is. REPLACE_TIMEGM=1 fi + else +HAVE_TIMEGM=0 fi - if test $REPLACE_TIMEGM = 1; then + if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1;
strptime on mingw
Another error in C++ mode on mingw: ../gllib/time.h:433: error: `strptime' was not declared in this scope The reason is a mistake that I made on 2010-03-08, because the macro name REPLACE_STRPTIME and the #define strptime rpl_strptime made me think an existing function was being replaced. This fixes it: 2010-04-03 Bruno Haible br...@clisp.org strptime: Fix C++ test error on mingw. * lib/time.in.h (strptime): Use HAVE_STRPTIME, not REPLACE_STRPTIME. * m4/strptime.m4 (gl_FUNC_STRPTIME): Set HAVE_STRPTIME, not REPLACE_STRPTIME. Invoke gl_PREREQ_STRPTIME. (gl_PREREQ_STRPTIME): New macro, extracted from gl_FUNC_STRPTIME. * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize HAVE_STRPTIME, not REPLACE_STRPTIME. * modules/time (Makefile.am): Substitute HAVE_STRPTIME, not REPLACE_STRPTIME. --- lib/time.in.h.orig Sat Apr 3 19:56:03 2010 +++ lib/time.in.h Sat Apr 3 19:55:37 2010 @@ -157,23 +157,15 @@ the resulting broken-down time into TM. See http://www.opengroup.org/susv3xsh/strptime.html. */ # if @GNULIB_STRPTIME@ -# if @REPLACE_STRPTIME@ -# if !(defined __cplusplus defined GNULIB_NAMESPACE) -#undef strptime -#define strptime rpl_strptime -# endif -_GL_FUNCDECL_RPL (strptime, char *, (char const *restrict __buf, +# if ! @HAVE_STRPTIME@ +_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, char const *restrict __format, struct tm *restrict __tm) _GL_ARG_NONNULL ((1, 2, 3))); -_GL_CXXALIAS_RPL (strptime, char *, (char const *restrict __buf, - char const *restrict __format, - struct tm *restrict __tm)); -# else +# endif _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, char const *restrict __format, struct tm *restrict __tm)); -# endif _GL_CXXALIASWARN (strptime); # endif --- m4/strptime.m4.orig Sat Apr 3 19:56:03 2010 +++ m4/strptime.m4 Sat Apr 3 19:55:37 2010 @@ -1,4 +1,4 @@ -# strptime.m4 serial 5 +# strptime.m4 serial 6 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,11 +8,17 @@ [ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) - AC_REPLACE_FUNCS([strptime]) - AC_REQUIRE([gl_TM_GMTOFF]) - if test $ac_cv_func_strptime = yes; then -REPLACE_STRPTIME=0 - else -REPLACE_STRPTIME=1 + AC_CHECK_FUNCS_ONCE([strptime]) + if test $ac_cv_func_strptime != yes; then +HAVE_STRPTIME=0 +AC_LIBOBJ([strptime]) +gl_PREREQ_STRPTIME fi ]) + +# Prerequisites of lib/strptime.c. +AC_DEFUN([gl_PREREQ_STRPTIME], +[ + AC_REQUIRE([gl_TM_GMTOFF]) + : +]) --- m4/time_h.m4.orig Sat Apr 3 19:56:03 2010 +++ m4/time_h.m4Sat Apr 3 19:55:49 2010 @@ -79,6 +79,7 @@ GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_LOCALTIME_R=1;AC_SUBST([HAVE_LOCALTIME_R]) + HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) dnl If another module says to replace or to not replace, do that. dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; @@ -86,6 +87,5 @@ REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) REPLACE_NANOSLEEP=GNULIB_PORTCHECK;AC_SUBST([REPLACE_NANOSLEEP]) - REPLACE_STRPTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRPTIME]) REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) ]) --- modules/time.orig Sat Apr 3 19:56:03 2010 +++ modules/timeSat Apr 3 19:55:37 2010 @@ -33,11 +33,11 @@ -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \ -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \ -e 's|@''HAVE_LOCALTIME_R''@|$(HAVE_LOCALTIME_R)|g' \ + -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ - -e 's|@''REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \ -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
Re: nanosleep on mingw
Bruno Haible wrote: Similarly, on mingw with warn-on-use.h modified to work like if g++ = 4.3 were present, I'm seeing this error: ../gllib/time.h:359: error: `nanosleep' was not declared in this scope It would also be an error on the other platforms lacking nanosleep, with g++ 4.3. Again, to fix this, one needs to distinguish the case where the function is missing and the case where the function is being replaced (overridden). Jim, here is a proposed patch. It fixes the error. The big change to m4/nanosleep.m4 is mostly an indentation change. OK to commit? 2010-04-03 Bruno Haible br...@clisp.org nanosleep: Fix C++ test error on mingw. * lib/nanosleep.c (nanosleep): Renamed from rpl_nanosleep. * lib/time.in.h (nanosleep): Use modern idiom. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): When the system does not have a nanosleep function, set HAVE_NANOSLEEP to 0, instead of setting REPLACE_NANOSLEEP to 1. * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize HAVE_NANOSLEEP. * modules/time (Makefile.am): Substitute HAVE_NANOSLEEP. This looks right, and passed a basic sanity test (coreutils on F12). Though note that the patches to modules/time and m4/time_h.m4 did not apply and I did them manually. Please apply. Thanks for all the fixes.
Re: timegm on mingw
Bruno Haible wrote: A similar error for timegm, in the C++ tests on mingw: ../gllib/time.h:448: error: `timegm' was not declared in this scope Again, we need to distinguish the case of a missing function from the case of a broken function. m4/time_h.m4 contains some dubious code: If timegm exists and mktime works fine, but timegm is not declared, it sets REPLACE_TIMEGM to 1, and checks for the prerequisites of lib/timegm.c, but without doing a AC_LIBOBJ([timegm]). This makes no sense to me. Since we don't know of any platform that has timegm but does not declare it, I'm removing this code. 2010-04-03 Bruno Haible br...@clisp.org timegm: Assume declaration if function exists. * m4/timegm.m4 (gl_FUNC_TIMEGM): Assume timegm is declared if and only if it exists. Don't clobber ac_cv_func_timegm. That sounds sensible and the patch looks fine. Thanks!
Re: nanosleep on mingw
Hi Jim, Though note that the patches to modules/time and m4/time_h.m4 did not apply and I did them manually. Yes, I was constantly changing the same parts of these two files. Please apply. Applied. Bruno
wcwidth on mingw
Similarly for wcwidth, I'm seeing this error: ../gllib/wchar.h:678: error: `wcwidth' was not declared in this scope Here too the problem is that gnulib defines a function rpl_wcwidth, although wcwidth does not exist on mingw. gnulib could just define wcwidth instead. This fixes it: 2010-04-03 Bruno Haible br...@clisp.org wcwidth: Fix C++ test error on mingw. * lib/wcwidth.c (wcwidth): Renamed from rpl_wcwidth. * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): If the wcwidth function does not exist, don't set REPLACE_WCWIDTH. Instead, rely on HAVE_DECL_WCWIDTH. --- ChangeLog.orig Sun Apr 4 02:41:12 2010 +++ ChangeLog Sun Apr 4 02:40:53 2010 @@ -1,5 +1,12 @@ 2010-04-03 Bruno Haible br...@clisp.org + wcwidth: Fix C++ test error on mingw. + * lib/wcwidth.c (wcwidth): Renamed from rpl_wcwidth. + * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): If the wcwidth function does not + exist, don't set REPLACE_WCWIDTH. Instead, rely on HAVE_DECL_WCWIDTH. + +2010-04-03 Bruno Haible br...@clisp.org + nanosleep: Fix C++ test error on mingw. * lib/nanosleep.c (nanosleep): Renamed from rpl_nanosleep. * lib/time.in.h (nanosleep): Use modern idiom. --- lib/wcwidth.c.orig Sun Apr 4 02:41:12 2010 +++ lib/wcwidth.c Sun Apr 4 02:24:44 2010 @@ -1,5 +1,5 @@ /* Determine the number of screen columns needed for a character. - Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,10 +26,9 @@ #include streq.h #include uniwidth.h -#undef wcwidth - int -rpl_wcwidth (wchar_t wc) +wcwidth (wchar_t wc) +#undef wcwidth { /* In UTF-8 locales, use a Unicode aware width function. */ const char *encoding = locale_charset (); --- m4/wcwidth.m4.orig Sun Apr 4 02:41:12 2010 +++ m4/wcwidth.m4 Sun Apr 4 02:41:06 2010 @@ -1,4 +1,4 @@ -# wcwidth.m4 serial 15 +# wcwidth.m4 serial 16 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,9 +34,7 @@ HAVE_DECL_WCWIDTH=0 fi - if test $ac_cv_func_wcwidth = no; then -REPLACE_WCWIDTH=1 - else + if test $ac_cv_func_wcwidth = yes; then dnl On MacOS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. dnl On OSF/1 5.1, wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. dnl This leads to bugs in 'ls' (coreutils). @@ -84,11 +82,13 @@ *no) REPLACE_WCWIDTH=1 ;; esac fi - if test $REPLACE_WCWIDTH = 1; then + if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1; then AC_LIBOBJ([wcwidth]) fi - - if test $REPLACE_WCWIDTH = 1 || test $HAVE_DECL_WCWIDTH = 0; then + if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1 \ + || test $HAVE_DECL_WCWIDTH = 0; then gl_REPLACE_WCHAR_H fi + dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not + dnl have the wcwidth function, then it does not declare it. ])