[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU libidn branch, master, updated. libidn-1-18-35-gf6bd862
From: |
Simon Josefsson |
Subject: |
[SCM] GNU libidn branch, master, updated. libidn-1-18-35-gf6bd862 |
Date: |
Mon, 17 May 2010 12:46:42 +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=f6bd862bf6ca8ea823e87ba954883877f4d0f602
The branch, master has been updated
via f6bd862bf6ca8ea823e87ba954883877f4d0f602 (commit)
from 001cda8056a5e3d1d9f331326ba0ca9ae51d0dba (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 f6bd862bf6ca8ea823e87ba954883877f4d0f602
Author: Simon Josefsson <address@hidden>
Date: Mon May 17 14:25:30 2010 +0200
Update gnulib files.
-----------------------------------------------------------------------
Summary of changes:
build-aux/c++defs.h | 36 +++++++++---
build-aux/gendocs.sh | 12 +++-
build-aux/gnupload | 8 +-
gl/Makefile.am | 4 +
gl/error.c | 32 +++++++++-
gl/m4/gnulib-common.m4 | 8 ++-
gl/m4/gnulib-comp.m4 | 3 +
gl/m4/unistd_h.m4 | 11 +++-
gl/unistd.in.h | 51 +++++++++++++++-
gltests/Makefile.am | 9 +++
gltests/init.sh | 69 ++++++++++++++++------
gltests/test-verify.c | 68 +++++++++++++++++++++
gltests/test-verify.sh | 24 ++++++++
gltests/verify.h | 41 ++++++++++---
gltests/wchar.in.h | 2 +-
lib/gl/m4/gnulib-common.m4 | 8 ++-
lib/gl/m4/gnulib-comp.m4 | 4 +
lib/gl/m4/iconv.m4 | 7 ++-
lib/gl/wchar.in.h | 2 +-
lib/gltests/Makefile.am | 9 +++
{gltests => lib/gltests}/init.sh | 69 ++++++++++++++++------
lib/gltests/test-verify.c | 68 +++++++++++++++++++++
lib/gltests/test-verify.sh | 24 ++++++++
lib/gltests/verify.h | 41 ++++++++++---
maint.mk | 121 ++++++++++++++++++++++++++++++-------
25 files changed, 624 insertions(+), 107 deletions(-)
create mode 100644 gltests/test-verify.c
create mode 100755 gltests/test-verify.sh
copy {gltests => lib/gltests}/init.sh (81%)
create mode 100644 lib/gltests/test-verify.c
create mode 100755 lib/gltests/test-verify.sh
diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h
index 7d71089..0c2fad7 100644
--- a/build-aux/c++defs.h
+++ b/build-aux/c++defs.h
@@ -221,10 +221,20 @@
_GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
# define _GL_CXXALIASWARN_1(func,namespace) \
_GL_CXXALIASWARN_2 (func, namespace)
-# define _GL_CXXALIASWARN_2(func,namespace) \
- _GL_WARN_ON_USE (func, \
- "The symbol ::" #func " refers to the system function. " \
- "Use " #namespace "::" #func " instead.")
+/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+ we enable the warning only when not optimizing. */
+# if !__OPTIMIZE__
+# define _GL_CXXALIASWARN_2(func,namespace) \
+ _GL_WARN_ON_USE (func, \
+ "The symbol ::" #func " refers to the system function. " \
+ "Use " #namespace "::" #func " instead.")
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+# define _GL_CXXALIASWARN_2(func,namespace) \
+ extern __typeof__ (func) func
+# else
+# define _GL_CXXALIASWARN_2(func,namespace) \
+ _GL_EXTERN_C int _gl_cxxalias_dummy
+# endif
#else
# define _GL_CXXALIASWARN(func) \
_GL_EXTERN_C int _gl_cxxalias_dummy
@@ -239,10 +249,20 @@
GNULIB_NAMESPACE)
# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace)
\
_GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
-# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace)
\
- _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
- "The symbol ::" #func " refers to the system function.
" \
- "Use " #namespace "::" #func " instead.")
+/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+ we enable the warning only when not optimizing. */
+# if !__OPTIMIZE__
+# define
_GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
+ "The symbol ::" #func " refers to the system
function. " \
+ "Use " #namespace "::" #func " instead.")
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+# define
_GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+ extern __typeof__ (func) func
+# else
+# define
_GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+ _GL_EXTERN_C int _gl_cxxalias_dummy
+# endif
#else
# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
_GL_EXTERN_C int _gl_cxxalias_dummy
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
index 67d5b52..8cab8f6 100755
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -2,7 +2,7 @@
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
-scriptversion=2010-02-13.20
+scriptversion=2010-05-04.09
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
@@ -149,8 +149,16 @@ while test $# -gt 0; do
shift
done
+# For most of the following, the base name is just $PACKAGE
+base=$PACKAGE
+
if test -n "$srcfile"; then
- :
+ # but here, we use the basename of $srcfile
+ base=`basename "$srcfile"`
+ case $base in
+ *.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;;
+ esac
+ PACKAGE=$base
elif test -s "$srcdir/$PACKAGE.texinfo"; then
srcfile=$srcdir/$PACKAGE.texinfo
elif test -s "$srcdir/$PACKAGE.texi"; then
diff --git a/build-aux/gnupload b/build-aux/gnupload
index c28a5cc..a7ce5e6 100755
--- a/build-aux/gnupload
+++ b/build-aux/gnupload
@@ -1,7 +1,7 @@
#!/bin/sh
# Sign files and upload them.
-scriptversion=2010-02-08.07; # UTC
+scriptversion=2010-04-25.17; # UTC
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
# Foundation, Inc.
@@ -185,7 +185,7 @@ done
dprint()
{
- echo "Running $*..."
+ echo "Running $* ..."
}
if $dry_run; then
@@ -249,7 +249,7 @@ echo
if test $# -ne 0; then
for file
do
- echo "Signing $file..."
+ echo "Signing $file ..."
rm -f $file.sig
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 -ba -o $file.sig $file
done
@@ -388,7 +388,7 @@ for dest in $to
do
for file
do
- echo "Uploading $file to $dest..."
+ echo "Uploading $file to $dest ..."
stmt=
files="$file $file.sig"
destdir=`echo $dest | sed 's/[^:]*://'`
diff --git a/gl/Makefile.am b/gl/Makefile.am
index bff91af..4a9e7b7 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -392,6 +392,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
-e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \
-e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \
+ -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \
-e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
-e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \
-e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \
@@ -426,6 +427,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
-e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \
-e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \
+ -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
-e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
-e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
-e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
@@ -453,10 +455,12 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H)
$(WARN_ON_USE_H)
-e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
-e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
+ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \
-e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
-e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
-e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
-e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
+ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \
-e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
-e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
-e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
diff --git a/gl/error.c b/gl/error.c
index c79e8d4..ed9dba0 100644
--- a/gl/error.c
+++ b/gl/error.c
@@ -88,6 +88,15 @@ extern void __error_at_line (int status, int errnum, const
char *file_name,
# include <fcntl.h>
# include <unistd.h>
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Get declarations of the Win32 API functions. */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# endif
+
+/* The gnulib override of fcntl is not needed in this file. */
+# undef fcntl
+
# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
# ifndef HAVE_DECL_STRERROR_R
"this configure-time declaration test was not run"
@@ -104,10 +113,29 @@ extern char *program_name;
# endif /* HAVE_STRERROR_R || defined strerror_r */
#endif /* not _LIBC */
+#if !_LIBC
+/* Return non-zero if FD is open. */
+static inline int
+is_open (int fd)
+{
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ /* On Win32: The initial state of unassigned standard file descriptors is
+ that they are open but point to an INVALID_HANDLE_VALUE. There is no
+ fcntl, and the gnulib replacement fcntl does not support F_GETFL. */
+ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+# else
+# ifndef F_GETFL
+# error Please port fcntl to your platform
+# endif
+ return 0 <= fcntl (fd, F_GETFL);
+# endif
+}
+#endif
+
static inline void
flush_stdout (void)
{
-#if !_LIBC && defined F_GETFL
+#if !_LIBC
int stdout_fd;
# if GNULIB_FREOPEN_SAFER
@@ -124,7 +152,7 @@ flush_stdout (void)
/* POSIX states that fflush (stdout) after fclose is unspecified; it
is safe in glibc, but not on all other platforms. fflush (NULL)
is always defined, but too draconian. */
- if (0 <= stdout_fd && 0 <= fcntl (stdout_fd, F_GETFL))
+ if (0 <= stdout_fd && is_open (stdout_fd))
#endif
fflush (stdout);
}
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index 54b2517..4c7ac30 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 19
+# gnulib-common.m4 serial 20
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,
@@ -35,6 +35,12 @@ AC_DEFUN([gl_COMMON_BODY], [
is a misnomer outside of parameter lists. */
#define _UNUSED_PARAMETER_ _GL_UNUSED
])
+ dnl Preparation for running test programs:
+ dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
+ dnl to /dev/tty, so they can be redirected to log files. Such diagnostics
+ dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N.
+ LIBC_FATAL_STDERR_=1
+ export LIBC_FATAL_STDERR_
])
# gl_MODULE_INDICATOR_CONDITION
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 8284c00..a9b15dc 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -105,6 +105,7 @@ AC_DEFUN([gl_EARLY],
# Code from module vc-list-files:
# Code from module vc-list-files-tests:
# Code from module verify:
+ # Code from module verify-tests:
# Code from module version-etc:
# Code from module version-etc-fsf:
# Code from module version-etc-tests:
@@ -481,6 +482,8 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-update-copyright.sh
tests/test-vc-list-files-cvs.sh
tests/test-vc-list-files-git.sh
+ tests/test-verify.c
+ tests/test-verify.sh
tests/test-version-etc.c
tests/test-version-etc.sh
tests=lib/alloca.in.h
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 8c2eec6..48d06c7 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 45
+# unistd_h.m4 serial 46
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,
@@ -38,8 +38,9 @@ AC_DEFUN([gl_UNISTD_H],
]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
fsync ftruncate getcwd getdomainname getdtablesize getgroups
gethostname getlogin getlogin_r getpagesize getusershell setusershell
- endusershell lchown link linkat lseek pipe2 pread readlink readlinkat
- rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep])
+ endusershell lchown link linkat lseek pipe2 pread pwrite readlink
+ readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
+ usleep])
])
AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -79,6 +80,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2])
GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD])
+ GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE])
GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
@@ -113,6 +115,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT])
HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2])
HAVE_PREAD=1; AC_SUBST([HAVE_PREAD])
+ HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE])
HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT])
HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
@@ -140,10 +143,12 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT])
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD])
+ REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE])
REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK])
REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP])
REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK])
+ REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R])
REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK])
REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT])
REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP])
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 04d3a68..7914f22 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -86,7 +86,7 @@
#endif
#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
- || @GNULIB_PREAD@ || defined GNULIB_POSIXCHECK)
+ || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
/* Get ssize_t. */
# include <sys/types.h>
#endif
@@ -1016,6 +1016,40 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
#endif
+#if @GNULIB_PWRITE@
+/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
+ Return the number of bytes written if successful, otherwise
+ set errno and return -1. 0 indicates nothing written. See the
+ POSIX:2001 specification
+ <http://www.opengroup.org/susv3xsh/pwrite.html>. */
+# if @REPLACE_PWRITE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define pwrite rpl_pwrite
+# endif
+_GL_FUNCDECL_RPL (pwrite, ssize_t,
+ (int fd, const void *buf, size_t bufsize, off_t offset)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (pwrite, ssize_t,
+ (int fd, const void *buf, size_t bufsize, off_t offset));
+# else
+# if address@hidden@
+_GL_FUNCDECL_SYS (pwrite, ssize_t,
+ (int fd, const void *buf, size_t bufsize, off_t offset)
+ _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (pwrite, ssize_t,
+ (int fd, const void *buf, size_t bufsize, off_t offset));
+# endif
+_GL_CXXALIASWARN (pwrite);
+#elif defined GNULIB_POSIXCHECK
+# undef pwrite
+# if HAVE_RAW_DECL_PWRITE
+_GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
+ "use gnulib module pwrite for portability");
+# endif
+#endif
+
+
#if @GNULIB_READLINK@
/* Read the contents of the symbolic link FILE and place the first BUFSIZE
bytes of it into BUF. Return the number of bytes placed into BUF if
@@ -1164,12 +1198,23 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable
- "
#if @GNULIB_TTYNAME_R@
/* Store at most BUFLEN characters of the pathname of the terminal FD is
open on in BUF. Return 0 on success, otherwise an error number. */
-# if address@hidden@
+# if @REPLACE_TTYNAME_R@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ttyname_r
+# define ttyname_r rpl_ttyname_r
+# endif
+_GL_FUNCDECL_RPL (ttyname_r, int,
+ (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (ttyname_r, int,
+ (int fd, char *buf, size_t buflen));
+# else
+# if address@hidden@
_GL_FUNCDECL_SYS (ttyname_r, int,
(int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
-# endif
+# endif
_GL_CXXALIAS_SYS (ttyname_r, int,
(int fd, char *buf, size_t buflen));
+# endif
_GL_CXXALIASWARN (ttyname_r);
#elif defined GNULIB_POSIXCHECK
# undef ttyname_r
diff --git a/gltests/Makefile.am b/gltests/Makefile.am
index c2171c9..d6bac73 100644
--- a/gltests/Makefile.am
+++ b/gltests/Makefile.am
@@ -662,6 +662,15 @@ libtests_a_SOURCES += verify.h
## end gnulib module verify
+## begin gnulib module verify-tests
+
+TESTS_ENVIRONMENT += MAKE='$(MAKE)'
+TESTS += test-verify test-verify.sh
+check_PROGRAMS += test-verify
+EXTRA_DIST += test-verify.c test-verify.sh init.sh
+
+## end gnulib module verify-tests
+
## begin gnulib module version-etc-fsf
libtests_a_SOURCES += version-etc-fsf.c
diff --git a/gltests/init.sh b/gltests/init.sh
index ee9c542..e23aa54 100644
--- a/gltests/init.sh
+++ b/gltests/init.sh
@@ -21,11 +21,16 @@
# The typical skeleton of a test looks like this:
#
# #!/bin/sh
-# : ${srcdir=.}
-# . "$srcdir/init.sh"; path_prepend_ .
+# . "${srcdir=.}/init.sh"; path_prepend_ .
# Execute some commands.
# Note that these commands are executed in a subdirectory, therefore you
# need to prepend "../" to relative filenames in the build directory.
+# Note that the "path_prepend_ ." is useful only if the body of your
+# test invokes programs residing in the initial directory.
+# For example, if the programs you want to test are in src/, and this test
+# script is named tests/test-1, then you would use "path_prepend_ ../src",
+# or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"
+# to all tests via automake's TESTS_ENVIRONMENT.
# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure.
# Use the skip_ and fail_ functions to print a diagnostic and then exit
# with the corresponding exit code.
@@ -58,37 +63,61 @@
# - hyphen-containing alias names
# - we prefer to use ${var#...} substitution, rather than having
# to work around lack of support for that feature.
-# The following code attempts to find a shell with support for these features
-# and re-exec's it. If not, it skips the current test.
+# The following code attempts to find a shell with support for these features.
+# If the current shell passes the test, we're done. Otherwise, test other
+# shells until we find one that passes. If one is found, re-exec it.
+# If no acceptable shell is found, skip the current test.
+#
+# Use "9" to indicate success (rather than 0), in case some shell acts
+# like Solaris 10's /bin/sh but exits successfully instead of with status 2.
gl_shell_test_script_='
test $(echo y) = y || exit 1
-test -z "$EXEEXT" && exit 0
+test -z "$EXEEXT" && exit 9
shopt -s expand_aliases
alias a-b="echo zoo"
v=abx
test ${v%x} = ab \
&& test ${v#a} = bx \
- && test $(a-b) = zoo
+ && test $(a-b) = zoo \
+ && exit 9
'
if test "x$1" = "x--no-reexec"; then
shift
else
- for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail
- do
- test "$re_shell_" = no_shell && continue
- test "$re_shell_" = fail && skip_ failed to find an adequate shell
- if "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null; then
- exec "$re_shell_" "$0" --no-reexec "$@"
- echo "$ME_: exec failed" 1>&2
- exit 127
- fi
- done
+ # 'eval'ing the above code makes Solaris 10's /bin/sh exit with $? set to 2.
+ # It does not evaluate any of the code after the "unexpected" `('. Thus,
+ # we must run it in a subshell.
+ ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
+ if test $? = 9; then
+ : # The current shell is adequate. No re-exec required.
+ else
+ # Search for a shell that meets our requirements.
+ for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh
fail
+ do
+ test "$re_shell_" = no_shell && continue
+ test "$re_shell_" = fail && skip_ failed to find an adequate shell
+ "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
+ if test $? = 9; then
+ # Found an acceptable shell.
+ exec "$re_shell_" "$0" --no-reexec "$@"
+ echo "$ME_: exec failed" 1>&2
+ exit 127
+ fi
+ done
+ fi
fi
test -n "$EXEEXT" && shopt -s expand_aliases
+# Enable glibc's malloc-perturbing option.
+# This is cheap and useful for exposing code that depends on the fact that
+# malloc-related functions often return memory that is mostly zeroed.
+# If you have the time and cycles, use valgrind to do an even better job.
+: ${MALLOC_PERTURB_=87}
+export MALLOC_PERTURB_
+
# We use a trap below for cleanup. This requires us to go through
# hoops to get the right exit status transported through the handler.
# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
@@ -225,10 +254,12 @@ setup_()
|| fail_ "failed to create temporary directory in $initial_cwd_"
cd "$test_dir_"
- # This pair of trap statements ensures that the temporary directory,
- # $test_dir_, is removed upon exit as well as upon catchable signal.
+ # These trap statements ensure that the temporary directory, $test_dir_,
+ # is removed upon exit as well as upon receipt of any of the listed signals.
trap remove_tmp_ 0
- trap 'Exit $?' 1 2 13 15
+ for sig_ in 1 2 3 13 15; do
+ eval "trap 'Exit $(expr $sig_ + 128)' $sig_"
+ done
}
# Create a temporary directory, much like mktemp -d does.
diff --git a/gltests/test-verify.c b/gltests/test-verify.c
new file mode 100644
index 0000000..47eae2b
--- /dev/null
+++ b/gltests/test-verify.c
@@ -0,0 +1,68 @@
+/* Test the "verify" module.
+
+ Copyright (C) 2005, 2009, 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible. */
+
+#include <config.h>
+
+#include "verify.h"
+
+#ifndef EXP_FAIL
+# define EXP_FAIL 0
+#endif
+
+int x;
+enum { a, b, c };
+
+#if EXP_FAIL == 1
+verify (x >= 0); /* should give ERROR: non-constant
expression */
+#endif
+verify (c == 2); /* should be ok */
+#if EXP_FAIL == 2
+verify (1 + 1 == 3); /* should give ERROR */
+#endif
+verify (1 == 1); verify (1 == 1); /* should be ok */
+
+enum
+{
+ item = verify_true (1 == 1) * 0 + 17 /* should be ok */
+};
+
+int function (int n)
+{
+#if EXP_FAIL == 3
+ verify (n >= 0); /* should give ERROR: non-constant
expression */
+#endif
+ verify (c == 2); /* should be ok */
+#if EXP_FAIL == 4
+ verify (1 + 1 == 3); /* should give ERROR */
+#endif
+ verify (1 == 1); verify (1 == 1); /* should be ok */
+
+ if (n)
+ return ((void) verify_true (1 == 1), verify_true (1 == 1) + 7); /* should
be ok */
+#if EXP_FAIL == 5
+ return (verify_true (1 == 2), 5); /* should give ERROR */
+#endif
+ return 0;
+}
+
+int
+main (void)
+{
+ return !(function (0) == 0 && function (1) == 8);
+}
diff --git a/gltests/test-verify.sh b/gltests/test-verify.sh
new file mode 100755
index 0000000..3e76761
--- /dev/null
+++ b/gltests/test-verify.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+. "${srcdir=.}/init.sh"
+
+# We are not interested in triggering bugs in the compilers and tools
+# (such as gcc 4.3.1 on openSUSE 11.0).
+unset MALLOC_PERTURB_
+
+# Rather than figure out how to invoke the compiler with the right
+# include path ourselves, we let make do it:
+(cd "$initial_cwd_" && rm -f test-verify.o \
+ && $MAKE test-verify.o >/dev/null 2>&1) \
+ || skip_ "cannot compile error-free"
+
+# Now, prove that we encounter all expected compilation failures:
+: >out
+: >err
+for i in 1 2 3 4 5; do
+ (cd "$initial_cwd_"
+ rm -f test-verify.o
+ $MAKE CFLAGS=-DEXP_FAIL=$i test-verify.o) >>out 2>>err \
+ && { warn_ "compiler didn't detect verification failure $i"; fail=1; }
+done
+
+Exit $fail
diff --git a/gltests/verify.h b/gltests/verify.h
index bcd3f5a..4ad780c 100644
--- a/gltests/verify.h
+++ b/gltests/verify.h
@@ -69,13 +69,14 @@
if the entity names are not disambiguated. A workaround is to
attach the current line number to the entity name:
- #define GL_CONCAT0(x, y) x##y
- #define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
- extern struct {...} * GL_CONCAT(dummy,__LINE__);
+ #define _GL_CONCAT0(x, y) x##y
+ #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
+ extern struct {...} * _GL_CONCAT (dummy, __LINE__);
But this has the problem that two invocations of verify from
within the same macro would collide, since the __LINE__ value
- would be the same for both invocations.
+ would be the same for both invocations. (The GCC __COUNTER__
+ macro solves this problem, but is not portable.)
A solution is to use the sizeof operator. It yields a number,
getting rid of the identity of the type. Declarations like
@@ -103,20 +104,41 @@
extern int (*dummy (void)) [sizeof (struct {...})];
+ * GCC warns about duplicate declarations of the dummy function if
+ -Wredundant_decls is used. GCC 4.3 and later have a builtin
+ __COUNTER__ macro that can let us generate unique identifiers for
+ each dummy function, to suppress this warning.
+
* This implementation exploits the fact that GCC does not warn about
the last declaration mentioned above. If a future version of GCC
introduces a warning for this, the problem could be worked around
- by using code specialized to GCC, e.g.,:
+ by using code specialized to GCC, just as __COUNTER__ is already
+ being used if available.
#if 4 <= __GNUC__
- # define verify(R) \
- extern int (* verify_function__ (void)) \
- [__builtin_constant_p (R) && (R) ? 1 : -1]
+ # define verify(R) [another version to keep GCC happy]
#endif
* In C++, any struct definition inside sizeof is invalid.
Use a template type to work around the problem. */
+/* Concatenate two preprocessor tokens. */
+# define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
+# define _GL_CONCAT0(x, y) x##y
+
+/* _GL_COUNTER is an integer, preferably one that changes each time we
+ use it. Use __COUNTER__ if it works, falling back on __LINE__
+ otherwise. __LINE__ isn't perfect, but it's better than a
+ constant. */
+# if defined __COUNTER__ && __COUNTER__ != __COUNTER__
+# define _GL_COUNTER __COUNTER__
+# else
+# define _GL_COUNTER __LINE__
+# endif
+
+/* Generate a symbol with the given prefix, making it unique if
+ possible. */
+# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
/* Verify requirement R at compile-time, as an integer constant expression.
Return 1. */
@@ -135,6 +157,7 @@ template <int w>
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */
-# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
+# define verify(R) \
+ extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)]
#endif
diff --git a/gltests/wchar.in.h b/gltests/wchar.in.h
index dd41d35..88d47db 100644
--- a/gltests/wchar.in.h
+++ b/gltests/wchar.in.h
@@ -407,7 +407,7 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
# else
-# if !defined wcwidth && address@hidden@
+# if address@hidden@
/* wcwidth exists but is not declared. */
_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
# endif
diff --git a/lib/gl/m4/gnulib-common.m4 b/lib/gl/m4/gnulib-common.m4
index 54b2517..4c7ac30 100644
--- a/lib/gl/m4/gnulib-common.m4
+++ b/lib/gl/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 19
+# gnulib-common.m4 serial 20
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,
@@ -35,6 +35,12 @@ AC_DEFUN([gl_COMMON_BODY], [
is a misnomer outside of parameter lists. */
#define _UNUSED_PARAMETER_ _GL_UNUSED
])
+ dnl Preparation for running test programs:
+ dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
+ dnl to /dev/tty, so they can be redirected to log files. Such diagnostics
+ dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N.
+ LIBC_FATAL_STDERR_=1
+ export LIBC_FATAL_STDERR_
])
# gl_MODULE_INDICATOR_CONDITION
diff --git a/lib/gl/m4/gnulib-comp.m4 b/lib/gl/m4/gnulib-comp.m4
index 1294731..8331378 100644
--- a/lib/gl/m4/gnulib-comp.m4
+++ b/lib/gl/m4/gnulib-comp.m4
@@ -58,6 +58,7 @@ AC_DEFUN([lgl_EARLY],
# Code from module strverscmp:
# Code from module strverscmp-tests:
# Code from module verify:
+ # Code from module verify-tests:
# Code from module warn-on-use:
# Code from module wchar:
])
@@ -314,6 +315,7 @@ AC_DEFUN([lgl_FILE_LIST], [
m4/wchar_h.m4
m4/wchar_t.m4
m4/wint_t.m4
+ tests/init.sh
tests/macros.h
tests/signature.h
tests/test-c-ctype.c
@@ -326,6 +328,8 @@ AC_DEFUN([lgl_FILE_LIST], [
tests/test-stdint.c
tests/test-striconv.c
tests/test-strverscmp.c
+ tests/test-verify.c
+ tests/test-verify.sh
tests=lib/dummy.c
tests=lib/intprops.h
tests=lib/verify.h
diff --git a/lib/gl/m4/iconv.m4 b/lib/gl/m4/iconv.m4
index f46ff14..4c68472 100644
--- a/lib/gl/m4/iconv.m4
+++ b/lib/gl/m4/iconv.m4
@@ -1,4 +1,4 @@
-# iconv.m4 serial 9 (gettext-0.18)
+# iconv.m4 serial 10 (gettext-0.18.1)
dnl Copyright (C) 2000-2002, 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,
@@ -170,7 +170,10 @@ int main ()
AC_SUBST([LTLIBICONV])
])
-AC_DEFUN([AM_ICONV],
+dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
+dnl avoid warnings like
+dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
+m4_version_prereq([2.64],[AC_DEFUN_ONCE],[AC_DEFUN])([AM_ICONV],
[
AM_ICONV_LINK
if test "$am_cv_func_iconv" = yes; then
diff --git a/lib/gl/wchar.in.h b/lib/gl/wchar.in.h
index 3369efa..ed582e5 100644
--- a/lib/gl/wchar.in.h
+++ b/lib/gl/wchar.in.h
@@ -407,7 +407,7 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
# else
-# if !defined wcwidth && address@hidden@
+# if address@hidden@
/* wcwidth exists but is not declared. */
_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
# endif
diff --git a/lib/gltests/Makefile.am b/lib/gltests/Makefile.am
index 57d9e3d..f37fac4 100644
--- a/lib/gltests/Makefile.am
+++ b/lib/gltests/Makefile.am
@@ -177,6 +177,15 @@ libtests_a_SOURCES += verify.h
## end gnulib module verify
+## begin gnulib module verify-tests
+
+TESTS_ENVIRONMENT += MAKE='$(MAKE)'
+TESTS += test-verify test-verify.sh
+check_PROGRAMS += test-verify
+EXTRA_DIST += test-verify.c test-verify.sh init.sh
+
+## end gnulib module verify-tests
+
## begin gnulib module warn-on-use
BUILT_SOURCES += warn-on-use.h
diff --git a/gltests/init.sh b/lib/gltests/init.sh
similarity index 81%
copy from gltests/init.sh
copy to lib/gltests/init.sh
index ee9c542..e23aa54 100644
--- a/gltests/init.sh
+++ b/lib/gltests/init.sh
@@ -21,11 +21,16 @@
# The typical skeleton of a test looks like this:
#
# #!/bin/sh
-# : ${srcdir=.}
-# . "$srcdir/init.sh"; path_prepend_ .
+# . "${srcdir=.}/init.sh"; path_prepend_ .
# Execute some commands.
# Note that these commands are executed in a subdirectory, therefore you
# need to prepend "../" to relative filenames in the build directory.
+# Note that the "path_prepend_ ." is useful only if the body of your
+# test invokes programs residing in the initial directory.
+# For example, if the programs you want to test are in src/, and this test
+# script is named tests/test-1, then you would use "path_prepend_ ../src",
+# or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"
+# to all tests via automake's TESTS_ENVIRONMENT.
# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure.
# Use the skip_ and fail_ functions to print a diagnostic and then exit
# with the corresponding exit code.
@@ -58,37 +63,61 @@
# - hyphen-containing alias names
# - we prefer to use ${var#...} substitution, rather than having
# to work around lack of support for that feature.
-# The following code attempts to find a shell with support for these features
-# and re-exec's it. If not, it skips the current test.
+# The following code attempts to find a shell with support for these features.
+# If the current shell passes the test, we're done. Otherwise, test other
+# shells until we find one that passes. If one is found, re-exec it.
+# If no acceptable shell is found, skip the current test.
+#
+# Use "9" to indicate success (rather than 0), in case some shell acts
+# like Solaris 10's /bin/sh but exits successfully instead of with status 2.
gl_shell_test_script_='
test $(echo y) = y || exit 1
-test -z "$EXEEXT" && exit 0
+test -z "$EXEEXT" && exit 9
shopt -s expand_aliases
alias a-b="echo zoo"
v=abx
test ${v%x} = ab \
&& test ${v#a} = bx \
- && test $(a-b) = zoo
+ && test $(a-b) = zoo \
+ && exit 9
'
if test "x$1" = "x--no-reexec"; then
shift
else
- for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail
- do
- test "$re_shell_" = no_shell && continue
- test "$re_shell_" = fail && skip_ failed to find an adequate shell
- if "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null; then
- exec "$re_shell_" "$0" --no-reexec "$@"
- echo "$ME_: exec failed" 1>&2
- exit 127
- fi
- done
+ # 'eval'ing the above code makes Solaris 10's /bin/sh exit with $? set to 2.
+ # It does not evaluate any of the code after the "unexpected" `('. Thus,
+ # we must run it in a subshell.
+ ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
+ if test $? = 9; then
+ : # The current shell is adequate. No re-exec required.
+ else
+ # Search for a shell that meets our requirements.
+ for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh
fail
+ do
+ test "$re_shell_" = no_shell && continue
+ test "$re_shell_" = fail && skip_ failed to find an adequate shell
+ "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
+ if test $? = 9; then
+ # Found an acceptable shell.
+ exec "$re_shell_" "$0" --no-reexec "$@"
+ echo "$ME_: exec failed" 1>&2
+ exit 127
+ fi
+ done
+ fi
fi
test -n "$EXEEXT" && shopt -s expand_aliases
+# Enable glibc's malloc-perturbing option.
+# This is cheap and useful for exposing code that depends on the fact that
+# malloc-related functions often return memory that is mostly zeroed.
+# If you have the time and cycles, use valgrind to do an even better job.
+: ${MALLOC_PERTURB_=87}
+export MALLOC_PERTURB_
+
# We use a trap below for cleanup. This requires us to go through
# hoops to get the right exit status transported through the handler.
# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
@@ -225,10 +254,12 @@ setup_()
|| fail_ "failed to create temporary directory in $initial_cwd_"
cd "$test_dir_"
- # This pair of trap statements ensures that the temporary directory,
- # $test_dir_, is removed upon exit as well as upon catchable signal.
+ # These trap statements ensure that the temporary directory, $test_dir_,
+ # is removed upon exit as well as upon receipt of any of the listed signals.
trap remove_tmp_ 0
- trap 'Exit $?' 1 2 13 15
+ for sig_ in 1 2 3 13 15; do
+ eval "trap 'Exit $(expr $sig_ + 128)' $sig_"
+ done
}
# Create a temporary directory, much like mktemp -d does.
diff --git a/lib/gltests/test-verify.c b/lib/gltests/test-verify.c
new file mode 100644
index 0000000..47eae2b
--- /dev/null
+++ b/lib/gltests/test-verify.c
@@ -0,0 +1,68 @@
+/* Test the "verify" module.
+
+ Copyright (C) 2005, 2009, 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible. */
+
+#include <config.h>
+
+#include "verify.h"
+
+#ifndef EXP_FAIL
+# define EXP_FAIL 0
+#endif
+
+int x;
+enum { a, b, c };
+
+#if EXP_FAIL == 1
+verify (x >= 0); /* should give ERROR: non-constant
expression */
+#endif
+verify (c == 2); /* should be ok */
+#if EXP_FAIL == 2
+verify (1 + 1 == 3); /* should give ERROR */
+#endif
+verify (1 == 1); verify (1 == 1); /* should be ok */
+
+enum
+{
+ item = verify_true (1 == 1) * 0 + 17 /* should be ok */
+};
+
+int function (int n)
+{
+#if EXP_FAIL == 3
+ verify (n >= 0); /* should give ERROR: non-constant
expression */
+#endif
+ verify (c == 2); /* should be ok */
+#if EXP_FAIL == 4
+ verify (1 + 1 == 3); /* should give ERROR */
+#endif
+ verify (1 == 1); verify (1 == 1); /* should be ok */
+
+ if (n)
+ return ((void) verify_true (1 == 1), verify_true (1 == 1) + 7); /* should
be ok */
+#if EXP_FAIL == 5
+ return (verify_true (1 == 2), 5); /* should give ERROR */
+#endif
+ return 0;
+}
+
+int
+main (void)
+{
+ return !(function (0) == 0 && function (1) == 8);
+}
diff --git a/lib/gltests/test-verify.sh b/lib/gltests/test-verify.sh
new file mode 100755
index 0000000..3e76761
--- /dev/null
+++ b/lib/gltests/test-verify.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+. "${srcdir=.}/init.sh"
+
+# We are not interested in triggering bugs in the compilers and tools
+# (such as gcc 4.3.1 on openSUSE 11.0).
+unset MALLOC_PERTURB_
+
+# Rather than figure out how to invoke the compiler with the right
+# include path ourselves, we let make do it:
+(cd "$initial_cwd_" && rm -f test-verify.o \
+ && $MAKE test-verify.o >/dev/null 2>&1) \
+ || skip_ "cannot compile error-free"
+
+# Now, prove that we encounter all expected compilation failures:
+: >out
+: >err
+for i in 1 2 3 4 5; do
+ (cd "$initial_cwd_"
+ rm -f test-verify.o
+ $MAKE CFLAGS=-DEXP_FAIL=$i test-verify.o) >>out 2>>err \
+ && { warn_ "compiler didn't detect verification failure $i"; fail=1; }
+done
+
+Exit $fail
diff --git a/lib/gltests/verify.h b/lib/gltests/verify.h
index bcd3f5a..4ad780c 100644
--- a/lib/gltests/verify.h
+++ b/lib/gltests/verify.h
@@ -69,13 +69,14 @@
if the entity names are not disambiguated. A workaround is to
attach the current line number to the entity name:
- #define GL_CONCAT0(x, y) x##y
- #define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
- extern struct {...} * GL_CONCAT(dummy,__LINE__);
+ #define _GL_CONCAT0(x, y) x##y
+ #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
+ extern struct {...} * _GL_CONCAT (dummy, __LINE__);
But this has the problem that two invocations of verify from
within the same macro would collide, since the __LINE__ value
- would be the same for both invocations.
+ would be the same for both invocations. (The GCC __COUNTER__
+ macro solves this problem, but is not portable.)
A solution is to use the sizeof operator. It yields a number,
getting rid of the identity of the type. Declarations like
@@ -103,20 +104,41 @@
extern int (*dummy (void)) [sizeof (struct {...})];
+ * GCC warns about duplicate declarations of the dummy function if
+ -Wredundant_decls is used. GCC 4.3 and later have a builtin
+ __COUNTER__ macro that can let us generate unique identifiers for
+ each dummy function, to suppress this warning.
+
* This implementation exploits the fact that GCC does not warn about
the last declaration mentioned above. If a future version of GCC
introduces a warning for this, the problem could be worked around
- by using code specialized to GCC, e.g.,:
+ by using code specialized to GCC, just as __COUNTER__ is already
+ being used if available.
#if 4 <= __GNUC__
- # define verify(R) \
- extern int (* verify_function__ (void)) \
- [__builtin_constant_p (R) && (R) ? 1 : -1]
+ # define verify(R) [another version to keep GCC happy]
#endif
* In C++, any struct definition inside sizeof is invalid.
Use a template type to work around the problem. */
+/* Concatenate two preprocessor tokens. */
+# define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
+# define _GL_CONCAT0(x, y) x##y
+
+/* _GL_COUNTER is an integer, preferably one that changes each time we
+ use it. Use __COUNTER__ if it works, falling back on __LINE__
+ otherwise. __LINE__ isn't perfect, but it's better than a
+ constant. */
+# if defined __COUNTER__ && __COUNTER__ != __COUNTER__
+# define _GL_COUNTER __COUNTER__
+# else
+# define _GL_COUNTER __LINE__
+# endif
+
+/* Generate a symbol with the given prefix, making it unique if
+ possible. */
+# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
/* Verify requirement R at compile-time, as an integer constant expression.
Return 1. */
@@ -135,6 +157,7 @@ template <int w>
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */
-# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
+# define verify(R) \
+ extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)]
#endif
diff --git a/maint.mk b/maint.mk
index 33803f3..3bcab0c 100644
--- a/maint.mk
+++ b/maint.mk
@@ -148,16 +148,6 @@ local-check :=
\
$(filter-out $(local-checks-to-skip), $(local-checks-available)))
syntax-check: $(local-check)
-# @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \
-# $$(find -type f -name '*.[chly]') && \
-# { echo '$(ME): found conditional include' 1>&2; \
-# exit 1; } || :
-
-# grep -nE '^# *include <(string|stdlib)\.h>' \
-# $(srcdir)/{lib,src}/*.[chy] && \
-# { echo '$(ME): FIXME' 1>&2; \
-# exit 1; } || :
-# FIXME: don't allow `#include .strings\.h' anywhere
# _sc_search_regexp
#
@@ -554,6 +544,13 @@ sc_prohibit_signal_without_use:
re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>' \
$(_sc_header_without_use)
+# Prohibit the inclusion of strings.h without a sensible use.
+# Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible.
+sc_prohibit_strings_without_use:
+ @h='<strings.h>' \
+ re='\<(strn?casecmp|ffs(ll)?)\>' \
+ $(_sc_header_without_use)
+
# Get the list of symbol names with this:
# perl -lne '/^# *define (\w+)\(/ and print $1' lib/intprops.h|grep -v '^s'|fmt
_intprops_names = \
@@ -645,6 +642,67 @@ sc_useless_cpp_parens:
halt='found useless parentheses in cpp directive' \
$(_sc_search_regexp)
+# List headers for which HAVE_HEADER_H is always true, assuming you are
+# using the appropriate gnulib module. CAUTION: for each "unnecessary"
+# #if HAVE_HEADER_H that you remove, be sure that your project explicitly
+# requires the gnulib module that guarantees the usability of that header.
+gl_assured_headers_ = \
+ cd $(gnulib_dir)/lib && echo *.in.h|sed 's/\.in\.h//g'
+
+# Convert the list of names to upper case, and replace each space with "|".
+az_ = abcdefghijklmnopqrstuvwxyz
+AZ_ = ABCDEFGHIJKLMNOPQRSTUVWXYZ
+gl_header_upper_case_or_ = \
+ $$($(gl_assured_headers_) \
+ | tr $(az_)/.- $(AZ_)___ \
+ | tr -s ' ' '|' \
+ )
+sc_prohibit_always_true_header_tests:
+ @or=$(gl_header_upper_case_or_); \
+ re="HAVE_($$or)_H"; \
+ prohibit='\<'"$$re"'\>' \
+ halt='do not test the above HAVE_<header>_H symbol(s);\n'\
+' with the corresponding gnulib module, they are always true' \
+ $(_sc_search_regexp)
+
+# ==================================================================
+gl_other_headers_ ?= \
+ intprops.h \
+ openat.h \
+ stat-macros.h
+
+# Perl -lne code to extract "significant" cpp-defined symbols from a
+# gnulib header file, eliminating a few common false-positives.
+gl_extract_significant_defines_ = \
+ /^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/\
+ && $$2 !~ /(?:rpl_|_used_without_)/\
+ && $$1 !~ /^(?:NSIG|ATTRIBUTE_NORETURN)$$/\
+ and print $$1
+
+# Create a list of regular expressions matching the names
+# of macros that are guaranteed to be defined by parts of gnulib.
+define def_sym_regex
+ gen_h=$(gl_generated_headers_); \
+ (cd $(gnulib_dir)/lib; \
+ for f in *.in.h $(gl_other_headers_); do \
+ perl -lne '$(gl_extract_significant_defines_)' $$f; \
+ done; \
+ ) | sort -u \
+ | sed 's/^/^ *# *define /;s/$$/\\>/'
+endef
+
+# Don't define macros that we already get from gnulib header files.
+sc_prohibit_always-defined_macros:
+ @if test -d $(gnulib_dir); then \
+ case $$(echo all: | grep -l -f - Makefile) in Makefile);; *) \
+ echo '$(ME): skipping $@: you lack GNU grep' 1>&2; exit 0;; \
+ esac; \
+ $(def_sym_regex) | grep -f - $$($(VC_LIST_EXCEPT)) \
+ && { echo '$(ME): define the above via some gnulib .h file' \
+ 1>&2; exit 1; } || :; \
+ fi
+# ==================================================================
+
# Prohibit checked in backup files.
sc_prohibit_backup_files:
@$(VC_LIST) | grep '~$$' && \
@@ -915,20 +973,22 @@ sc_copyright_check:
# 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
+_hv_regex_weak ?= ^ *\. .*/init\.sh"
+_hv_regex_strong ?= ^ *\. "\$${srcdir=\.}/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)"; \
+ grep -l 'VERSION mismatch' $(_hv_file) >/dev/null \
+ || { echo "$@: skipped: no such file: $(_hv_file)" 1>&2; \
+ exit 0; }; \
+ grep -lE '$(_hv_regex_strong)' $(_hv_file) >/dev/null \
+ || { echo "$@: $(_hv_file) lacks conforming use of init.sh" 1>&2; \
+ exit 1; }; \
+ good=$$(grep -E '$(_hv_regex_strong)' $(_hv_file)); \
+ grep -LFx "$$good" \
+ $$(grep -lE '$(_hv_regex_weak)' $$($(VC_LIST_EXCEPT))) \
+ | grep . && \
+ { echo "$(ME): the above files use path_prepend_ inconsistently" \
+ 1>&2; exit 1; } || :; \
fi
# #if HAVE_... will evaluate to false for any non numeric string.
@@ -972,8 +1032,16 @@ gpg_key_ID ?= \
&& gpgv .ann-sig - < /dev/null 2>&1 \
| sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig)
+translation_project_ ?= address@hidden
+announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT)
+announcement_mail_headers_ ?= \
+To: address@hidden \
+Cc: $(announcement_Cc_)
\
+Mail-Followup-To: $(PACKAGE_BUGREPORT)
+
announcement: NEWS ChangeLog $(rel-files)
@$(build_aux)/announce-gen \
+ --mail-headers='$(announcement_mail_headers_)' \
--release-type=$(RELEASE_TYPE) \
--package=$(PACKAGE) \
--prev=$(PREV_VERSION) \
@@ -1057,12 +1125,17 @@ release-prep:
$(VC) commit -F .ci-msg -a
rm .ci-msg
+# Override this with e.g., -s $(srcdir)/some_other_name.texi
+# if the default $(PACKAGE)-derived name doesn't apply.
+gendocs_options_ ?=
+
.PHONY: web-manual
web-manual:
@test -z "$(manual_title)" \
&& { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
@cd '$(srcdir)/doc'; \
- $(SHELL) ../build-aux/gendocs.sh -o '$(abs_builddir)/doc/manual' \
+ $(SHELL) ../build-aux/gendocs.sh $(gendocs_options_) \
+ -o '$(abs_builddir)/doc/manual' \
--email $(PACKAGE_BUGREPORT) $(PACKAGE) \
"$(PACKAGE_NAME) - $(manual_title)"
@echo " *** Upload the doc/manual directory to web-cvs."
@@ -1104,10 +1177,12 @@ refresh-po:
echo 'address@hidden' >> $(PODIR)/LINGUAS && \
ls $(PODIR)/*.po | sed 's/\.po//' | sed 's,$(PODIR)/,,' | sort >>
$(PODIR)/LINGUAS
+ # Running indent once is not idempotent, but running it twice is.
INDENT_SOURCES ?= $(C_SOURCES)
.PHONY: indent
indent:
indent $(INDENT_SOURCES)
+ indent $(INDENT_SOURCES)
# If you want to set UPDATE_COPYRIGHT_* environment variables,
# put the assignments in this variable.
hooks/post-receive
--
GNU libidn
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU libidn branch, master, updated. libidn-1-18-35-gf6bd862,
Simon Josefsson <=