[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU libidn branch, master, updated. libidn-1-18-26-g93a59fb
From: |
Simon Josefsson |
Subject: |
[SCM] GNU libidn branch, master, updated. libidn-1-18-26-g93a59fb |
Date: |
Mon, 12 Apr 2010 18:46:24 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU libidn".
http://git.savannah.gnu.org/cgit/libidn.git/commit/?id=93a59fbf75f43fabcd3d2bf4ff50712900a3860a
The branch, master has been updated
via 93a59fbf75f43fabcd3d2bf4ff50712900a3860a (commit)
from 8d8e77ceac2214db9ce661249bf4fe4100a0940e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 93a59fbf75f43fabcd3d2bf4ff50712900a3860a
Author: Simon Josefsson <address@hidden>
Date: Mon Apr 12 20:38:38 2010 +0200
Update gnulib files.
-----------------------------------------------------------------------
Summary of changes:
GNUmakefile | 6 +-
build-aux/c++defs.h | 18 ++
build-aux/warn-on-use.h | 9 +-
gl/Makefile.am | 9 +-
gl/m4/gnulib-common.m4 | 4 +-
gl/m4/gnulib-comp.m4 | 1 +
gl/m4/stdlib_h.m4 | 3 +-
gl/m4/string_h.m4 | 14 +-
gl/m4/time_h.m4 | 8 +-
gl/m4/unistd_h.m4 | 5 +-
gl/string.in.h | 50 +++++-
gl/unistd.in.h | 19 ++-
gltests/Makefile.am | 8 +-
gltests/stdlib.in.h | 7 +-
gltests/sys_stat.in.h | 11 +-
gltests/time.in.h | 32 ++-
gltests/wchar.in.h | 6 +-
lib/gl/Makefile.am | 6 +-
lib/gl/m4/gnulib-common.m4 | 4 +-
lib/gl/m4/gnulib-comp.m4 | 1 +
lib/gl/m4/lib-link.m4 | 14 ++-
lib/gl/m4/string_h.m4 | 14 +-
lib/gl/string.in.h | 50 +++++-
lib/gl/wchar.in.h | 6 +-
lib/gltests/Makefile.am | 2 +-
maint.mk | 445 +++++++++++++++++++++++++++++---------------
26 files changed, 545 insertions(+), 207 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index 40ccc06..daba47a 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -49,7 +49,7 @@ include $(srcdir)/maint.mk
# Allow cfg.mk to override these.
_build-aux ?= build-aux
-_autoreconf ?= autoreconf
+_autoreconf ?= autoreconf -v
# Ensure that $(VERSION) is up to date for dist-related targets, but not
# for others: rerunning autoreconf and recompiling everything isn't cheap.
@@ -78,7 +78,8 @@ ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
$(info run '$(MAKE) _version' to fix it)
else
$(info INFO: running autoreconf for new version string: $(_curr-ver))
- _dummy := $(shell $(MAKE) $(AM_MAKEFLAGS) _version)
+GNUmakefile: _version
+ touch GNUmakefile
endif
endif
endif
@@ -88,6 +89,7 @@ endif
.PHONY: _version
_version:
cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
+ $(MAKE) $(AM_MAKEFLAGS) Makefile
else
diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h
index 31b29c2..7d71089 100644
--- a/build-aux/c++defs.h
+++ b/build-aux/c++defs.h
@@ -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_cast<rettype(*)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
diff --git a/build-aux/warn-on-use.h b/build-aux/warn-on-use.h
index 1cd5062..171e599 100644
--- a/build-aux/warn-on-use.h
+++ b/build-aux/warn-on-use.h
@@ -67,7 +67,10 @@
/* A compiler attribute is available in gcc versions 4.3.0 and later. */
# define _GL_WARN_ON_USE(function, message) \
extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
-
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+/* Verify the existence of the function. */
+# define _GL_WARN_ON_USE(function, message) \
+extern __typeof__ (function) function
# else /* Unsupported. */
# define _GL_WARN_ON_USE(function, message) \
_GL_WARN_EXTERN_C int _gl_warn_on_use
@@ -85,6 +88,10 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use
# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
extern rettype function parameters_and_attributes \
__attribute__ ((__warning__ (msg)))
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+/* Verify the existence of the function. */
+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
+extern rettype function parameters_and_attributes
# else /* Unsupported. */
# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
_GL_WARN_EXTERN_C int _gl_warn_on_use
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 665a793..bff91af 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -298,6 +298,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \
-e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \
-e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \
+ -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \
-e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \
-e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
-e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
@@ -310,6 +311,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
< $(srcdir)/string.in.h | \
sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
+ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -324,16 +326,18 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
-e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
- -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' \
-e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
-e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
+ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
-e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
+ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
-e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
-e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
-e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
@@ -407,6 +411,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-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' \
@@ -431,6 +436,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-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' \
@@ -438,7 +444,6 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-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' \
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index 9cc519e..54b2517 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 18
+# gnulib-common.m4 serial 19
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,
@@ -132,6 +132,7 @@ m4_ifdef([AC_PROG_MKDIR_P], [
# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
# works.
# This definition can be removed once autoconf >= 2.62 can be assumed.
+m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[
AC_DEFUN([AC_C_RESTRICT],
[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
[ac_cv_c_restrict=no
@@ -169,6 +170,7 @@ AC_DEFUN([AC_C_RESTRICT],
*) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
esac
])
+])
# gl_BIGENDIAN
# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 263dd32..41bd87a 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -119,6 +119,7 @@ AC_DEFUN([gl_INIT],
[
AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
gl_cond_libtool=true
+ gl_m4_base='gl/m4'
m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index 4c5cca8..dd84796 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -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 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
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])
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4
index 9ceeea9..1977aec 100644
--- a/gl/m4/string_h.m4
+++ b/gl/m4/string_h.m4
@@ -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 17
# Written by Paul Eggert.
@@ -26,8 +26,10 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
dnl corresponding gnulib module is not in use, and which is not
dnl guaranteed by C89.
gl_WARN_ON_USE_PREPARE([[#include <string.h>
- ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
- strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp])
+ ]],
+ [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
+ strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal
+ strverscmp])
])
AC_DEFUN([gl_STRING_MODULE_INDICATOR],
@@ -50,6 +52,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
+ GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT])
GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
@@ -76,6 +79,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
@@ -90,16 +94,18 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
- HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR])
HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
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])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
+ REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
+ REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R])
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index f2e54f2..b88ba94 100644
--- a/gl/m4/time_h.m4
+++ b/gl/m4/time_h.m4
@@ -64,7 +64,7 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
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])
@@ -77,12 +77,16 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
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=1; AC_SUBST([HAVE_LOCALTIME_R])
+ HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
+ 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;
dnl this lets maintainers check for portability.
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])
])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 789739d..8c2eec6 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 43
+# 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 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
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])
@@ -122,6 +123,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
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])
@@ -129,7 +131,6 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
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])
diff --git a/gl/string.in.h b/gl/string.in.h
index de4e6d3..13c0f09 100644
--- a/gl/string.in.h
+++ b/gl/string.in.h
@@ -66,6 +66,11 @@ _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c,
size_t __n)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
# else
+# if ! @HAVE_MEMCHR@
+_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
+ __attribute__ ((__pure__))
+ _GL_ARG_NONNULL ((1)));
+# endif
/* On some systems, this function is defined as an overloaded function:
extern "C" { const void * std::memchr (const void *, int, size_t); }
extern "C++" { void * std::memchr (void *, int, size_t); } */
@@ -222,7 +227,7 @@ _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
/* 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 +239,12 @@ _GL_CXXALIAS_RPL (stpncpy, char *,
(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));
@@ -309,6 +320,28 @@ _GL_WARN_ON_USE (strdup, "strdup is unportable - "
# endif
#endif
+/* Append no more than N characters from SRC onto DEST. */
+#if @GNULIB_STRNCAT@
+# if @REPLACE_STRNCAT@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef strncat
+# define strncat rpl_strncat
+# endif
+_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
+# else
+_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
+# endif
+_GL_CXXALIASWARN (strncat);
+#elif defined GNULIB_POSIXCHECK
+# undef strncat
+# if HAVE_RAW_DECL_STRNCAT
+_GL_WARN_ON_USE (strncat, "strncat is unportable - "
+ "use gnulib module strncat for portability");
+# endif
+#endif
+
/* Return a newly allocated copy of at most N bytes of STRING. */
#if @GNULIB_STRNDUP@
# if @REPLACE_STRNDUP@
@@ -339,12 +372,23 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - "
MAXLEN bytes. If no '\0' terminator is found in that many bytes,
return MAXLEN. */
#if @GNULIB_STRNLEN@
-# if ! @HAVE_DECL_STRNLEN@
+# if @REPLACE_STRNLEN@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef strnlen
+# define strnlen rpl_strnlen
+# endif
+_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
+ __attribute__ ((__pure__))
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
+# else
+# if ! @HAVE_DECL_STRNLEN@
_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
__attribute__ ((__pure__))
_GL_ARG_NONNULL ((1)));
-# endif
+# endif
_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
+# endif
_GL_CXXALIASWARN (strnlen);
#elif defined GNULIB_POSIXCHECK
# undef strnlen
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 0c5c616..04d3a68 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -415,9 +415,8 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
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 void _gl_unregister_fd (int fd);
_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
@@ -525,7 +523,9 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
_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
@@ -773,7 +773,9 @@ getpagesize ()
/* 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
@@ -1266,7 +1268,10 @@ _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void
*buf, size_t count)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
# else
-_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
+/* Need to cast, because on mingw, the third parameter is
+ unsigned int count
+ and the return type is 'int'. */
+_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t
count));
# endif
_GL_CXXALIASWARN (write);
#endif
diff --git a/gltests/Makefile.am b/gltests/Makefile.am
index a398bf9..62d4d5a 100644
--- a/gltests/Makefile.am
+++ b/gltests/Makefile.am
@@ -12,7 +12,7 @@
AUTOMAKE_OPTIONS = 1.5 foreign
-SUBDIRS =
+SUBDIRS = .
TESTS =
XFAIL_TESTS =
TESTS_ENVIRONMENT =
@@ -465,6 +465,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-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 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
@@ -599,10 +600,13 @@ time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \
-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_NANOSLEEP''@|$(HAVE_NANOSLEEP)|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' \
diff --git a/gltests/stdlib.in.h b/gltests/stdlib.in.h
index 3a87245..d74c251 100644
--- a/gltests/stdlib.in.h
+++ b/gltests/stdlib.in.h
@@ -67,10 +67,10 @@ struct random_data
};
#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
@@ -329,6 +329,9 @@ _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
_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);
diff --git a/gltests/sys_stat.in.h b/gltests/sys_stat.in.h
index 568358a..dc7ef51 100644
--- a/gltests/sys_stat.in.h
+++ b/gltests/sys_stat.in.h
@@ -56,7 +56,8 @@
/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
headers that may declare mkdir(). */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# include <io.h>
+# include <io.h> /* mingw32, mingw64 */
+# include <direct.h> /* mingw64 */
#endif
#ifndef S_IFMT
@@ -390,7 +391,10 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - "
# 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)
@@ -452,7 +456,8 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t
mode));
#else
/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
Additionally, it declares _mkdir (and depending on compile flags, an
- alias mkdir), only in the nonstandard <io.h>, which is included above. */
+ alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
+ which are included above. */
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
static inline int
diff --git a/gltests/time.in.h b/gltests/time.in.h
index bdae149..8e364fe 100644
--- a/gltests/time.in.h
+++ b/gltests/time.in.h
@@ -87,6 +87,11 @@ _GL_FUNCDECL_RPL (nanosleep, int,
_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
@@ -122,6 +127,11 @@ _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const
*restrict __timer,
_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 +147,11 @@ _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const
*restrict __timer,
_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
@@ -147,23 +162,15 @@ _GL_CXXALIASWARN (gmtime_r);
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
@@ -177,6 +184,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/gltests/wchar.in.h b/gltests/wchar.in.h
index 287204f..dd41d35 100644
--- a/gltests/wchar.in.h
+++ b/gltests/wchar.in.h
@@ -82,12 +82,16 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
-/* Define wint_t. (Also done in wctype.in.h.) */
+/* Define wint_t and WEOF. (Also done in wctype.in.h.) */
#if address@hidden@ && !defined wint_t
# define wint_t int
# ifndef WEOF
# define WEOF -1
# endif
+#else
+# ifndef WEOF
+# define WEOF ((wint_t) -1)
+# endif
#endif
diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am
index b452113..671427a 100644
--- a/lib/gl/Makefile.am
+++ b/lib/gl/Makefile.am
@@ -310,6 +310,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \
-e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \
-e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \
+ -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \
-e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \
-e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
-e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
@@ -322,6 +323,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
< $(srcdir)/string.in.h | \
sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
+ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -336,16 +338,18 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
-e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
- -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' \
-e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
-e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
+ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
-e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
+ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
-e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
-e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
-e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
diff --git a/lib/gl/m4/gnulib-common.m4 b/lib/gl/m4/gnulib-common.m4
index 9cc519e..54b2517 100644
--- a/lib/gl/m4/gnulib-common.m4
+++ b/lib/gl/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 18
+# gnulib-common.m4 serial 19
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,
@@ -132,6 +132,7 @@ m4_ifdef([AC_PROG_MKDIR_P], [
# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
# works.
# This definition can be removed once autoconf >= 2.62 can be assumed.
+m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[
AC_DEFUN([AC_C_RESTRICT],
[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
[ac_cv_c_restrict=no
@@ -169,6 +170,7 @@ AC_DEFUN([AC_C_RESTRICT],
*) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
esac
])
+])
# gl_BIGENDIAN
# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
diff --git a/lib/gl/m4/gnulib-comp.m4 b/lib/gl/m4/gnulib-comp.m4
index cb9611d..1294731 100644
--- a/lib/gl/m4/gnulib-comp.m4
+++ b/lib/gl/m4/gnulib-comp.m4
@@ -68,6 +68,7 @@ AC_DEFUN([lgl_INIT],
[
AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
gl_cond_libtool=true
+ gl_m4_base='lib/gl/m4'
m4_pushdef([AC_LIBOBJ], m4_defn([lgl_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([lgl_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([lgl_LIBSOURCES]))
diff --git a/lib/gl/m4/lib-link.m4 b/lib/gl/m4/lib-link.m4
index 90e1ac9..c73bd8e 100644
--- a/lib/gl/m4/lib-link.m4
+++ b/lib/gl/m4/lib-link.m4
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 20 (gettext-0.18)
+# lib-link.m4 serial 21 (gettext-0.18)
dnl Copyright (C) 2001-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,
@@ -74,7 +74,17 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
ac_save_LIBS="$LIBS"
- LIBS="$LIBS $LIB[]NAME"
+ dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
+ dnl because these -l options might require -L options that are present in
+ dnl LIBS. -l options benefit only from the -L options listed before it.
+ dnl Otherwise, add it to the front of LIBS, because it may be a static
+ dnl library that depends on another static library that is present in LIBS.
+ dnl Static libraries benefit only from the static libraries listed after
+ dnl it.
+ case " $LIB[]NAME" in
+ *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
+ *) LIBS="$LIB[]NAME $LIBS" ;;
+ esac
AC_TRY_LINK([$3], [$4],
[ac_cv_lib[]Name=yes],
[ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
diff --git a/lib/gl/m4/string_h.m4 b/lib/gl/m4/string_h.m4
index 9ceeea9..1977aec 100644
--- a/lib/gl/m4/string_h.m4
+++ b/lib/gl/m4/string_h.m4
@@ -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 17
# Written by Paul Eggert.
@@ -26,8 +26,10 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
dnl corresponding gnulib module is not in use, and which is not
dnl guaranteed by C89.
gl_WARN_ON_USE_PREPARE([[#include <string.h>
- ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
- strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp])
+ ]],
+ [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
+ strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal
+ strverscmp])
])
AC_DEFUN([gl_STRING_MODULE_INDICATOR],
@@ -50,6 +52,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
+ GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT])
GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
@@ -76,6 +79,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
@@ -90,16 +94,18 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
- HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR])
HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
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])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
+ REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
+ REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R])
diff --git a/lib/gl/string.in.h b/lib/gl/string.in.h
index 46d609d..2ebe17f 100644
--- a/lib/gl/string.in.h
+++ b/lib/gl/string.in.h
@@ -66,6 +66,11 @@ _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c,
size_t __n)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
# else
+# if ! @HAVE_MEMCHR@
+_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
+ __attribute__ ((__pure__))
+ _GL_ARG_NONNULL ((1)));
+# endif
/* On some systems, this function is defined as an overloaded function:
extern "C" { const void * std::memchr (const void *, int, size_t); }
extern "C++" { void * std::memchr (void *, int, size_t); } */
@@ -222,7 +227,7 @@ _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
/* 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 +239,12 @@ _GL_CXXALIAS_RPL (stpncpy, char *,
(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));
@@ -309,6 +320,28 @@ _GL_WARN_ON_USE (strdup, "strdup is unportable - "
# endif
#endif
+/* Append no more than N characters from SRC onto DEST. */
+#if @GNULIB_STRNCAT@
+# if @REPLACE_STRNCAT@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef strncat
+# define strncat rpl_strncat
+# endif
+_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
+# else
+_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
+# endif
+_GL_CXXALIASWARN (strncat);
+#elif defined GNULIB_POSIXCHECK
+# undef strncat
+# if HAVE_RAW_DECL_STRNCAT
+_GL_WARN_ON_USE (strncat, "strncat is unportable - "
+ "use gnulib module strncat for portability");
+# endif
+#endif
+
/* Return a newly allocated copy of at most N bytes of STRING. */
#if @GNULIB_STRNDUP@
# if @REPLACE_STRNDUP@
@@ -339,12 +372,23 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - "
MAXLEN bytes. If no '\0' terminator is found in that many bytes,
return MAXLEN. */
#if @GNULIB_STRNLEN@
-# if ! @HAVE_DECL_STRNLEN@
+# if @REPLACE_STRNLEN@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef strnlen
+# define strnlen rpl_strnlen
+# endif
+_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
+ __attribute__ ((__pure__))
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
+# else
+# if ! @HAVE_DECL_STRNLEN@
_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
__attribute__ ((__pure__))
_GL_ARG_NONNULL ((1)));
-# endif
+# endif
_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
+# endif
_GL_CXXALIASWARN (strnlen);
#elif defined GNULIB_POSIXCHECK
# undef strnlen
diff --git a/lib/gl/wchar.in.h b/lib/gl/wchar.in.h
index 3eeafd1..3369efa 100644
--- a/lib/gl/wchar.in.h
+++ b/lib/gl/wchar.in.h
@@ -82,12 +82,16 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
-/* Define wint_t. (Also done in wctype.in.h.) */
+/* Define wint_t and WEOF. (Also done in wctype.in.h.) */
#if address@hidden@ && !defined wint_t
# define wint_t int
# ifndef WEOF
# define WEOF -1
# endif
+#else
+# ifndef WEOF
+# define WEOF ((wint_t) -1)
+# endif
#endif
diff --git a/lib/gltests/Makefile.am b/lib/gltests/Makefile.am
index 8645343..57d9e3d 100644
--- a/lib/gltests/Makefile.am
+++ b/lib/gltests/Makefile.am
@@ -12,7 +12,7 @@
AUTOMAKE_OPTIONS = 1.5 foreign
-SUBDIRS =
+SUBDIRS = .
TESTS =
XFAIL_TESTS =
TESTS_ENVIRONMENT =
diff --git a/maint.mk b/maint.mk
index e121eb8..c663bce 100644
--- a/maint.mk
+++ b/maint.mk
@@ -129,8 +129,23 @@ sc_m_rules_ = $(patsubst %, %.m, $(syntax-check-rules))
.PHONY: $(sc_m_rules_)
$(sc_m_rules_):
@echo $(patsubst sc_%.m, %, $@)
-
-local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
+ @date +%s.%N > .sc-start-$(basename $@)
+
+# Compute and print the elapsed time for each syntax-check rule.
+sc_z_rules_ = $(patsubst %, %.z, $(syntax-check-rules))
+.PHONY: $(sc_z_rules_)
+$(sc_z_rules_): %.z: %
+ @end=$$(date +%s.%N); \
+ start=$$(cat .sc-start-$*); \
+ rm -f .sc-start-$*; \
+ awk -v s=$$start -v e=$$end \
+ 'END {printf "%.2f: $* done\n", e - s}' < /dev/null
+
+# The patsubst here is to replace each sc_% rule with its sc_%.z wrapper
+# that computes and prints elapsed time.
+local-check := \
+ $(patsubst sc_%, sc_%.z, \
+ $(filter-out $(local-checks-to-skip), $(local-checks-available)))
syntax-check: $(local-check)
# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
@@ -144,19 +159,104 @@ syntax-check: $(local-check)
# exit 1; } || :
# FIXME: don't allow `#include .strings\.h' anywhere
-# By default, _prohibit_regexp does not ignore case.
+# _sc_search_regexp
+#
+# This macro searches for a given construct in the selected files and
+# then takes some action.
+#
+# Parameters (shell variables):
+#
+# prohibit | require
+#
+# Regular expression (ERE) denoting either a forbidden construct
+# or a required construct. Those arguments are exclusive.
+#
+# in_vc_files | in_files
+#
+# grep-E-style regexp denoting the files to check. If no files
+# are specified the default are all the files that are under
+# version control.
+#
+# containing | non_containing
+#
+# Select the files (non) containing strings matching this regexp.
+# If both arguments are specified then CONTAINING takes
+# precedence.
+#
+# with_grep_options
+#
+# Extra options for grep.
+#
+# ignore_case
+#
+# Ignore case.
+#
+# halt
+#
+# Message to display before to halting execution.
+
+# By default, _sc_search_regexp does not ignore case.
export ignore_case =
_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
-# There are many rules below that prohibit constructs in this package.
-# If the offending construct can be matched with a grep-E-style regexp,
-# use this macro. The shell variables "re" and "msg" must be defined.
-define _prohibit_regexp
- dummy=; : so we do not need a semicolon before each use; \
- test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
- test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
- grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
+define _sc_say_and_exit
+ dummy=; : so we do not need a semicolon before each use; \
+ { echo -e "$(ME): $$msg" 1>&2; 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; \
+ \
+ : Check arguments; \
+ test -n "$$prohibit" && test -n "$$require" \
+ && { msg='Cannot specify both prohibit and require' \
+ $(_sc_say_and_exit) } || :; \
+ test -z "$$prohibit" && test -z "$$require" \
+ && { msg='Should specify either prohibit or require' \
+ $(_sc_say_and_exit) } || :; \
+ test -n "$$in_vc_files" && test -n "$$in_files" \
+ && { msg='Cannot specify both in_vc_files and in_files' \
+ $(_sc_say_and_exit) } || :; \
+ test "x$$halt" != x \
+ || { msg='halt not defined' $(_sc_say_and_exit) };
\
+ \
+ : Filter by file name; \
+ if test -n "$$in_files"; then \
+ files=$$(find $(srcdir) | grep -E "$$in_files"); \
+ else
\
+ files=$$($(VC_LIST_EXCEPT)); \
+ if test -n "$$in_vc_files"; then \
+ files=$$(echo "$$files" | grep -E "$$in_vc_files"); \
+ fi; \
+ fi; \
+ \
+ : Filter by content;
\
+ test -n "$$files" && test -n "$$containing" \
+ && { files=$$(grep -l "$$containing" $$files); } || :; \
+ test -n "$$files" && test -n "$$non_containing" \
+ && { files=$$(grep -vl "$$non_containing" $$files); } || :; \
+ \
+ : Check for the construct; \
+ if test -n "$$files"; then \
+ if test -n "$$prohibit"; then \
+ grep $$with_grep_options $(_ignore_case) -nE "$$prohibit" $$files \
+ && { msg="$$halt" $(_sc_say_and_exit) } || :; \
+ else \
+ grep $$with_grep_options $(_ignore_case) -LE "$$require" $$files \
+ | grep . \
+ && { msg="$$halt" $(_sc_say_and_exit) } || :; \
+ fi
\
+ else :; \
+ fi || :;
endef
sc_avoid_if_before_free:
@@ -167,29 +267,31 @@ sc_avoid_if_before_free:
exit 1; } || :
sc_cast_of_argument_to_free:
- @re='\<free *\( *\(' msg='don'\''t cast free argument' \
- $(_prohibit_regexp)
+ @prohibit='\<free *\( *\(' halt='don'\''t cast free argument' \
+ $(_sc_search_regexp)
sc_cast_of_x_alloc_return_value:
- @re='\*\) *x(m|c|re)alloc\>' \
- msg='don'\''t cast x*alloc return value' \
- $(_prohibit_regexp)
+ @prohibit='\*\) *x(m|c|re)alloc\>' \
+ halt='don'\''t cast x*alloc return value' \
+ $(_sc_search_regexp)
sc_cast_of_alloca_return_value:
- @re='\*\) *alloca\>' msg='don'\''t cast alloca return value' \
- $(_prohibit_regexp)
+ @prohibit='\*\) *alloca\>' \
+ halt='don'\''t cast alloca return value' \
+ $(_sc_search_regexp)
sc_space_tab:
- @re='[ ] ' msg='found SPACE-TAB sequence; remove the SPACE' \
- $(_prohibit_regexp)
+ @prohibit='[ ] ' \
+ halt='found SPACE-TAB sequence; remove the SPACE' \
+ $(_sc_search_regexp)
# Don't use *scanf or the old ato* functions in `real' code.
# They provide no error checking mechanism.
# Instead, use strto* functions.
sc_prohibit_atoi_atof:
- @re='\<([fs]?scanf|ato([filq]|ll)) *\(' \
- msg='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
- $(_prohibit_regexp)
+ @prohibit='\<([fs]?scanf|ato([filq]|ll)) *\('
\
+ halt='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q'
\
+ $(_sc_search_regexp)
# Use STREQ rather than comparing strcmp == 0, or != 0.
sc_prohibit_strcmp:
@@ -210,28 +312,29 @@ sc_prohibit_strcmp:
# | xargs --no-run-if-empty \
# perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/'
sc_prohibit_magic_number_exit:
- @re='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,' \
- msg='use EXIT_* values rather than magic number' \
- $(_prohibit_regexp)
+ @prohibit='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'
\
+ halt='use EXIT_* values rather than magic number'
\
+ $(_sc_search_regexp)
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success:
- @grep -nE 'error \(EXIT_SUCCESS,' \
- $$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$') && \
- { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :
+ @prohibit='error *\(EXIT_SUCCESS,' \
+ in_vc_files='\.[chly]$$' \
+ halt='found error (EXIT_SUCCESS' \
+ $(_sc_search_regexp)
# `FATAL:' should be fully upper-cased in error messages
# `WARNING:' should be fully upper-cased, or fully lower-cased
sc_error_message_warn_fatal:
- @grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
+ @grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"Warning|"Fatal|"fatal' && \
{ echo '$(ME): use FATAL, WARNING or warning' 1>&2; \
exit 1; } || :
# Error messages should not start with a capital letter
sc_error_message_uppercase:
- @grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
+ @grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"[A-Z]' \
| grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \
{ echo '$(ME): found capitalized error message' 1>&2; \
@@ -239,35 +342,32 @@ sc_error_message_uppercase:
# Error messages should not end with a period
sc_error_message_period:
- @grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
+ @grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT)) \
| grep -E '[^."]\."' && \
{ echo '$(ME): found error message ending in period' 1>&2; \
exit 1; } || :
sc_file_system:
- @re=file''system ignore_case=1 \
- msg='found use of "file''system"; spell it "file system"' \
- $(_prohibit_regexp)
+ @prohibit=file''system \
+ ignore_case=1 \
+ halt='found use of "file''system"; spell it "file system"' \
+ $(_sc_search_regexp)
# Don't use cpp tests of this symbol. All code assumes config.h is included.
sc_prohibit_have_config_h:
- @grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
- 1>&2; exit 1; } || :
+ @prohibit='^# *if.*HAVE''_CONFIG_H' \
+ halt='found use of HAVE''_CONFIG_H; remove' \
+ $(_sc_search_regexp)
# Nearly all .c files must include <config.h>. However, we also permit this
# via inclusion of a package-specific header, if cfg.mk specified one.
# config_h_header must be suitable for grep -E.
config_h_header ?= <config\.h>
sc_require_config_h:
- @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \
- grep -EL '^# *include $(config_h_header)' \
- $$($(VC_LIST_EXCEPT) | grep '\.c$$') \
- | grep . && \
- { echo '$(ME): the above files do not include <config.h>' \
- 1>&2; exit 1; } || :; \
- else :; \
- fi
+ @require='^# *include $(config_h_header)' \
+ in_vc_files='\.c$$' \
+ halt='the above files do not include <config.h>' \
+ $(_sc_search_regexp)
# You must include <config.h> before including any other header file.
# This can possibly be via a package-specific header, if given by cfg.mk.
@@ -286,8 +386,9 @@ sc_require_config_h_first:
fi
sc_prohibit_HAVE_MBRTOWC:
- @re='\bHAVE_MBRTOWC\b' msg="do not use $$re; it is always defined" \
- $(_prohibit_regexp)
+ @prohibit='\bHAVE_MBRTOWC\b' \
+ halt="do not use $$prohibit; it is always defined" \
+ $(_sc_search_regexp)
# To use this "command" macro, you must first define two shell variables:
# h: the header, enclosed in <> or ""
@@ -349,7 +450,7 @@ sc_prohibit_error_without_use:
# Don't include xalloc.h unless you use one of its functions.
# Consider these symbols:
# perl -lne '/^# *define (\w+)\(/ and print $1' lib/xalloc.h|grep -v '^__';
-# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1'
lib/xalloc.h
+# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) *\(/ and print $1'
lib/xalloc.h
# Divide into two sets on case, and filter each through this:
# | sort | perl -MRegexp::Assemble -le \
# 'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed
's/\?://g'
@@ -370,7 +471,7 @@ sc_prohibit_xalloc_without_use:
$(_sc_header_without_use)
# Extract function names:
-# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1' lib/hash.h
+# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) *\(/ and print $1' lib/hash.h
_hash_re = \
clear|delete|free|get_(first|next)|insert|lookup|print_statistics|reset_tuning
_hash_fn = \<($(_hash_re)) *\(
@@ -467,32 +568,27 @@ sc_prohibit_intprops_without_use:
$(_sc_header_without_use)
sc_obsolete_symbols:
- @re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
- msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
- $(_prohibit_regexp)
+ @prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
+ halt='do not use HAVE''_FCNTL_H or O'_NDELAY \
+ $(_sc_search_regexp)
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
# Each nonempty ChangeLog line must start with a year number, or a TAB.
sc_changelog:
- @if $(VC_LIST_EXCEPT) | grep -l '^ChangeLog$$' >/dev/null; then \
- grep -n '^[^12 ]' \
- $$($(VC_LIST_EXCEPT) | grep '^ChangeLog$$') && \
- { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
- exit 1; } || :; \
- fi
+ @prohibit='^[^12 ]' \
+ in_vc_files='^ChangeLog$$' \
+ halt='found unexpected prefix in a ChangeLog' \
+ $(_sc_search_regexp)
# Ensure that each .c file containing a "main" function also
# calls set_program_name.
sc_program_name:
- @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \
- files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
- grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files \
- | grep . && \
- { echo '$(ME): the above files do not call set_program_name' \
- 1>&2; exit 1; } || :; \
- else :; \
- fi
+ @require='set_program_name *\(m?argv\[0\]\);' \
+ in_vc_files='\.c$$' \
+ containing='^main *(' \
+ halt='the above files do not call set_program_name' \
+ $(_sc_search_regexp)
# Require that the final line of each test-lib.sh-using test be this one:
# Exit $fail
@@ -514,31 +610,30 @@ sc_require_test_exit_idiom:
fi
sc_the_the:
- @re='\<the ''the\>' \
- ignore_case=1 msg='found use of "the ''the";' \
- $(_prohibit_regexp)
+ @prohibit='\<the ''the\>' \
+ ignore_case=1 \
+ halt='found use of "the ''the";' \
+ $(_sc_search_regexp)
sc_trailing_blank:
- @re='[ ]$$' \
- msg='found trailing blank(s)' \
- $(_prohibit_regexp)
+ @prohibit='[ ]$$' \
+ halt='found trailing blank(s)' \
+ $(_sc_search_regexp)
# Match lines like the following, but where there is only one space
# between the options and the description:
# -D, --all-repeated[=delimit-method] print all duplicate lines\n
longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
sc_two_space_separator_in_usage:
- @grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
- $$($(VC_LIST_EXCEPT)) && \
- { echo "$(ME): help2man requires at least two spaces between"; \
- echo "$(ME): an option and its description"; \
- 1>&2; exit 1; } || :
+ @prohibit='^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
+ halt='help2man requires at least two spaces between an option and its
description'\
+ $(_sc_search_regexp)
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
sc_unmarked_diagnostics:
@grep -nE \
- '\<error \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
+ '\<error *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
@@ -546,61 +641,96 @@ sc_unmarked_diagnostics:
# Avoid useless parentheses like those in this example:
# #if defined (SYMBOL) || defined (SYM2)
sc_useless_cpp_parens:
- @grep -n '^# *if .*defined *(' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): found useless parentheses in cpp directive' \
- 1>&2; exit 1; } || :
+ @prohibit='^# *if .*defined *\(' \
+ halt='found useless parentheses in cpp directive' \
+ $(_sc_search_regexp)
# Require the latest GPL.
sc_GPL_version:
- @re='either ''version [^3]' msg='GPL vN, N!=3' \
- $(_prohibit_regexp)
+ @prohibit='either ''version [^3]' \
+ halt='GPL vN, N!=3' \
+ $(_sc_search_regexp)
# Require the latest GFDL. Two regexp, since some .texi files end up
# line wrapping between 'Free Documentation License,' and 'Version'.
_GFDL_regexp = (Free ''Documentation.*Version 1\.[^3]|Version 1\.[^3] or any)
sc_GFDL_version:
- @re='$(_GFDL_regexp)' msg='GFDL vN, N!=3' \
- $(_prohibit_regexp)
+ @prohibit='$(_GFDL_regexp)' \
+ halt='GFDL vN, N!=3' \
+ $(_sc_search_regexp)
# Don't use Texinfo @acronym{} as it is not a good idea.
sc_texinfo_acronym:
- @if $(VC_LIST_EXCEPT) | grep -lE '\.texi$$' >/dev/null; then \
- grep -nE '@acronym{' \
- $$($(VC_LIST_EXCEPT) | grep -E '\.texi$$') && \
- { echo '$(ME): found use of Texinfo @acronym{}' 1>&2; \
- exit 1; } || :; \
- else :; \
- fi
+ @prohibit='@acronym{' \
+ in_vc_files='\.texi$$' \
+ halt='found use of Texinfo @acronym{}' \
+ $(_sc_search_regexp)
cvs_keywords = \
Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
sc_prohibit_cvs_keyword:
- @re='\$$($(cvs_keywords))\$$' \
- msg='do not use CVS keyword expansion' \
- $(_prohibit_regexp)
+ @prohibit='\$$($(cvs_keywords))\$$' \
+ halt='do not use CVS keyword expansion' \
+ $(_sc_search_regexp)
+
+# This Perl code is slightly obfuscated. Not only is each "$" doubled
+# because it's in a Makefile, but the $$c's are comments; we cannot
+# use "#" due to the way the script ends up concatenated onto one line.
+# It would be much more concise, and would produce better output (including
+# counts) if written as:
+# perl -ln -0777 -e '/\n(\n+)$/ and print "$ARGV: ".length $1' ...
+# but that would be far less efficient, reading the entire contents
+# of each file, rather than just the last two bytes of each.
+#
+# This is a perl script that is expected to be the single-quoted argument
+# to a command-line "-le". The remaining arguments are file names.
+# Print the name of each file that ends in two or more newline bytes.
+# Exit nonzero if at least one such file is found, otherwise, exit 0.
+# Warn about, but otherwise ignore open failure. Ignore seek/read failure.
+#
+# Use this if you want to remove trailing empty lines from selected files:
+# perl -pi -0777 -e 's/\n\n+$/\n/' files...
+#
+detect_empty_lines_at_EOF_ = \
+ foreach my $$f (@ARGV) { \
+ open F, "<", $$f or (warn "failed to open $$f: $$!\n"), next; \
+ my $$p = sysseek (F, -2, 2); \
+ my $$c = "seek failure probably means file has < 2 bytes; ignore"; \
+ my $$two; \
+ defined $$p and $$p = sysread F, $$two, 2; \
+ close F; \
+ $$c = "ignore read failure"; \
+ $$p && $$two eq "\n\n" and (print $$f), $$fail=1; \
+ } END { exit defined $$fail }
+sc_prohibit_empty_lines_at_EOF:
+ @perl -le '$(detect_empty_lines_at_EOF_)' $$($(VC_LIST_EXCEPT)) \
+ || { echo '$(ME): the above files end with empty line(s)' \
+ 1>&2; exit 1; } || :; \
# Make sure we don't use st_blocks. Use ST_NBLOCKS instead.
# This is a bit of a kludge, since it prevents use of the string
# even in comments, but for now it does the job with no false positives.
sc_prohibit_stat_st_blocks:
- @re='[.>]st_blocks' msg='do not use st_blocks; use ST_NBLOCKS' \
- $(_prohibit_regexp)
+ @prohibit='[.>]st_blocks' \
+ halt='do not use st_blocks; use ST_NBLOCKS' \
+ $(_sc_search_regexp)
# Make sure we don't define any S_IS* macros in src/*.c files.
# They're already defined via gnulib's sys/stat.h replacement.
sc_prohibit_S_IS_definition:
- @re='^ *# *define *S_IS' \
- msg='do not define S_IS* macros; include <sys/stat.h>' \
- $(_prohibit_regexp)
+ @prohibit='^ *# *define *S_IS' \
+ halt='do not define S_IS* macros; include <sys/stat.h>' \
+ $(_sc_search_regexp)
_ptm1 = use "test C1 && test C2", not "test C1 -''a C2"
_ptm2 = use "test C1 || test C2", not "test C1 -''o C2"
# Using test's -a and -o operators is not portable.
+# We prefer test over [, since the latter is spelled [[ in configure.ac.
sc_prohibit_test_minus_ao:
- @re='\<test .+ -[ao] ' \
- msg='$(_ptm1); $(_ptm2)'
\
- $(_prohibit_regexp)
+ @prohibit='(\<test| \[+) .+ -[ao] ' \
+ halt='$(_ptm1); $(_ptm2)' \
+ $(_sc_search_regexp)
# Each program that uses proper_name_utf8 must link with one of the
# ICONV libraries. Otherwise, some ICONV library must appear in LDADD.
@@ -628,9 +758,9 @@ sc_proper_name_utf8_requires_ICONV:
# Warn about "c0nst struct Foo const foo[]",
# but not about "char const *const foo" or "#define const const".
sc_redundant_const:
- @re='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
- msg='redundant "const" in declarations' \
- $(_prohibit_regexp)
+ @prohibit='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
+ halt='redundant "const" in declarations' \
+ $(_sc_search_regexp)
sc_const_long_option:
@grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \
@@ -684,16 +814,16 @@ news-check: NEWS
fi
sc_makefile_TAB_only_indentation:
- @grep -nE '^ [ ]{8}' \
- $$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
- && { echo '$(ME): found TAB-8-space indentation' 1>&2; \
- exit 1; } || :
+ @prohibit='^ [ ]{8}' \
+ in_vc_files='akefile|\.mk$$' \
+ halt='found TAB-8-space indentation' \
+ $(_sc_search_regexp)
sc_m4_quote_check:
- @grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \
- $$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$') \
- && { echo '$(ME): quote the first arg to AC_DEF*' 1>&2; \
- exit 1; } || :
+ @prohibit='(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \
+ in_vc_files='(^configure\.ac|\.m4)$$' \
+ halt='quote the first arg to AC_DEF*' \
+ $(_sc_search_regexp)
fix_po_file_diag = \
'you have changed the set of files with translatable diagnostics;\n\
@@ -732,9 +862,10 @@ sc_po_check:
# path separator of `:', but rather the automake-provided `$(PATH_SEPARATOR)'.
msg = '$(ME): Do not use `:'\'' above; use $$(PATH_SEPARATOR) instead'
sc_makefile_path_separator_check:
- @grep -nE 'PATH[=].*:' \
- $$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
- && { echo $(msg) 1>&2; exit 1; } || :
+ @prohibit='PATH[=].*:' \
+ in_vc_files='akefile|\.mk$$' \
+ halt=$(msg) \
+ $(_sc_search_regexp)
# Check that `make alpha' will not fail at the end of the process.
writable-files:
@@ -754,23 +885,41 @@ texi = doc/$(PACKAGE).texi
# Make sure that the copyright date in $(v_etc_file) is up to date.
# Do the same for the $(sample-test) and the main doc/.texi file.
sc_copyright_check:
- @if test -f $(v_etc_file); then \
- grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
- >/dev/null \
- || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
- exit 1; }; \
- fi
- @if test -f $(sample-test); then \
- grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
- >/dev/null \
- || { echo 'out of date copyright in $(sample-test); update it' 1>&2; \
- exit 1; }; \
- fi
- @if test -f $(texi); then \
- grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
- >/dev/null \
- || { echo 'out of date copyright in $(texi); update it' 1>&2; \
- exit 1; }; \
+ @require='enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' \
+ in_files=$(v_etc_file) \
+ halt='out of date copyright in $(v_etc_file); update it' \
+ $(_sc_search_regexp)
+ @require='# Copyright \(C\) '$$(date +%Y)' Free' \
+ in_vc_files=$(sample-test) \
+ halt='out of date copyright in $(sample-test); update it' \
+ $(_sc_search_regexp)
+ @require='Copyright @copyright\{\} .*'$$(date +%Y)' Free' \
+ in_vc_files=$(texi) \
+ halt='out of date copyright in $(texi); update it' \
+ $(_sc_search_regexp)
+
+# If tests/help-version exists and seems to be new enough, assume that its
+# use of init.sh and path_prepend_ is correct, and ensure that every other
+# use of init.sh is identical.
+# This is useful because help-version cross-checks prog --version
+# with $(VERSION), which verifies that its path_prepend_ invocation
+# sets PATH correctly. This is an inexpensive way to ensure that
+# the other init.sh-using tests also get it right.
+_hv_file ?= $(srcdir)/tests/help-version
+_hv_regex ?= ^ *\. [^ ]*/init\.sh
+sc_cross_check_PATH_usage_in_tests:
+ @if test -f $(_hv_file); then \
+ if grep -l 'VERSION mismatch' $(_hv_file) >/dev/null \
+ && grep -lE '$(_hv_regex)' $(_hv_file) >/dev/null; then \
+ good=$$(grep -E '$(_hv_regex)' < $(_hv_file)); \
+ grep -LFx "$$good" \
+ $$(grep -lE '$(_hv_regex)' $$($(VC_LIST_EXCEPT))) \
+ | grep . && \
+ { echo "$(ME): the above files use path_prepend_ inconsistently" \
+ 1>&2; exit 1; } || :; \
+ fi; \
+ else \
+ echo "$@: skipped: no such file: $(_hv_file)"; \
fi
# #if HAVE_... will evaluate to false for any non numeric string.
@@ -778,22 +927,18 @@ sc_copyright_check:
# tests many undefined macros, and so we can't enable that option.
# So at least preclude common boolean strings as macro values.
sc_Wundef_boolean:
- @test -e '$(CONFIG_INCLUDE)' && \
- grep -Ei '^#define.*(yes|no|true|false)$$' '$(CONFIG_INCLUDE)' && \
- { echo 'Use 0 or 1 for macro values' 1>&2; exit 1; } || :
+ @prohibit='^#define.*(yes|no|true|false)$$' \
+ in_files='$(CONFIG_INCLUDE)' \
+ halt='Use 0 or 1 for macro values' \
+ $(_sc_search_regexp)
sc_vulnerable_makefile_CVE-2009-4029:
- @files=$$(find $(srcdir) -name Makefile.in); \
- if test -n "$$files"; then \
- grep -E \
- 'perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \
- $$files && \
- { echo '$(ME): the above files are vulnerable; beware of' \
- 'running "make dist*" rules, and upgrade to fixed automake' \
- 'see http://bugzilla.redhat.com/542609 for details' \
- 1>&2; exit 1; } || :; \
- else :; \
- fi
+ @prohibit='perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \
+ in_files=$$(find $(srcdir) -name Makefile.in) \
+ halt='the above files are vulnerable; beware of running\n'\
+'"make dist*" rules, and upgrade to fixed automake\n'\
+'see http://bugzilla.redhat.com/542609 for details' \
+ $(_sc_search_regexp)
vc-diff-check:
(unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :
hooks/post-receive
--
GNU libidn
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU libidn branch, master, updated. libidn-1-18-26-g93a59fb,
Simon Josefsson <=