Skip to content

Commit

Permalink
Update gnulib files, use valgrind-tests module, fix syntax-check prob…
Browse files Browse the repository at this point in the history
…lems.
  • Loading branch information
jas4711 committed May 28, 2010
1 parent 79b2b7f commit e4b0fe0
Show file tree
Hide file tree
Showing 59 changed files with 1,819 additions and 205 deletions.
1 change: 1 addition & 0 deletions .x-sc_prohibit_strings_without_use
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^src/cfg/
36 changes: 28 additions & 8 deletions build-aux/c++defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 10 additions & 2 deletions build-aux/gendocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions build-aux/gnupload
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# Sign files and upload them.

scriptversion=2010-02-08.07; # UTC
scriptversion=2010-05-23.15; # UTC

# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
# Foundation, Inc.
Expand Down Expand Up @@ -32,6 +32,8 @@ delete_files=
delete_symlinks=
collect_var=
dbg=
nl='
'

usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...]
Expand Down Expand Up @@ -109,7 +111,8 @@ Send patches to <[email protected]>."
# Read local configuration file
if test -r "$conffile"; then
echo "$0: Reading configuration file $conffile"
eval set x "`sed 's/#.*$//;/^$/d' \"$conffile\" | tr '\012\015' ' '` \"\$@\""
conf=`sed 's/#.*$//;/^$/d' "$conffile" | tr "\015$nl" ' '`
eval set x "$conf \"\$@\""
shift
fi

Expand Down Expand Up @@ -185,7 +188,7 @@ done

dprint()
{
echo "Running $*..."
echo "Running $* ..."
}

if $dry_run; then
Expand Down Expand Up @@ -249,7 +252,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
Expand Down Expand Up @@ -388,7 +391,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/[^:]*://'`
Expand Down
4 changes: 3 additions & 1 deletion build-aux/vc-list-files
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# List version-controlled file names.

# Print a version string.
scriptversion=2010-02-21.13; # UTC
scriptversion=2010-04-23.22; # UTC

# Copyright (C) 2006-2010 Free Software Foundation, Inc.

Expand Down Expand Up @@ -102,6 +102,8 @@ elif test -d CVS; then
}}'\'' \
`find "$dir" -name Entries -print` /dev/null' $postprocess
fi
elif test -d .svn; then
eval exec svn list -R '"$dir"' $postprocess
else
echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
exit 1
Expand Down
2 changes: 0 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ AC_DEFINE([HAVE_ERRNO_H], 1, [Hard-code for src/cfg/.])
AC_CHECK_FUNCS(fork,,)
AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")

sj_VALGRIND

AC_CHECK_TYPES(uint,,, [
# include <sys/types.h>
])
Expand Down
2 changes: 1 addition & 1 deletion doc/gendocs_template
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Please send broken links and other corrections or suggestions to
<a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.
</p>

<p>Copyright &copy; 2009 Free Software Foundation, Inc.</p>
<p>Copyright &copy; 2010 Free Software Foundation, Inc.</p>

<p>Verbatim copying and distribution of this entire article is
permitted in any medium, provided this notice is preserved.</p>
Expand Down
10 changes: 8 additions & 2 deletions gl/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --libtool --macro-prefix=gl --no-vc-files accept arpa_inet autobuild bind close connect error fdl-1.3 gendocs getaddrinfo getline getpass-gnu gettime gnupload gpl-3.0 inet_ntop inet_pton lgpl-2.1 listen maintainer-makefile manywarnings minmax perror pmccabe2html progname read-file readline recv select send setsockopt shutdown socket sockets sys_stat update-copyright version-etc-fsf warnings
# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --libtool --macro-prefix=gl --no-vc-files accept arpa_inet autobuild bind close connect error fdl-1.3 gendocs getaddrinfo getline getpass-gnu gettime gnupload gpl-3.0 inet_ntop inet_pton lgpl-2.1 listen maintainer-makefile manywarnings minmax perror pmccabe2html progname read-file readline recv select send setsockopt shutdown socket sockets sys_stat update-copyright valgrind-tests version-etc-fsf warnings

AUTOMAKE_OPTIONS = 1.5 gnits

Expand Down Expand Up @@ -439,7 +439,7 @@ BUILT_SOURCES += netdb.h

# We need the following in order to create <netdb.h> when the system
# doesn't have one that works with the given compiler.
netdb.h: netdb.in.h $(ARG_NONNULL_H)
netdb.h: netdb.in.h $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
Expand All @@ -453,6 +453,7 @@ netdb.h: netdb.in.h $(ARG_NONNULL_H)
-e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
-e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/netdb.in.h; \
} > $@-t && \
mv $@-t $@
Expand Down Expand Up @@ -812,6 +813,7 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
-e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
-e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
-e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
Expand Down Expand Up @@ -1255,6 +1257,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' \
Expand Down Expand Up @@ -1289,6 +1292,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' \
Expand Down Expand Up @@ -1316,10 +1320,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' \
Expand Down
32 changes: 30 additions & 2 deletions gl/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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);
}
Expand Down
48 changes: 48 additions & 0 deletions gl/m4/asm-underscore.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# asm-underscore.m4 serial 1
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl From Bruno Haible. Based on as-underscore.m4 in GNU clisp.

# gl_ASM_SYMBOL_PREFIX
# Tests for the prefix of C symbols at the assembly language level and the
# linker level. This prefix is either an underscore or empty. Defines the
# C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to
# a stringified variant of this prefix.

AC_DEFUN([gl_ASM_SYMBOL_PREFIX],
[
dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because
dnl 1. It works only for GCC.
dnl 2. It is incorrectly defined on some platforms, in some GCC versions.
AC_CACHE_CHECK(
[whether C symbols are prefixed with underscore at the linker level],
[gl_cv_prog_as_underscore],
[cat > conftest.c <<EOF
#ifdef __cplusplus
extern "C" int foo (void);
#endif
int foo(void) { return 0; }
EOF
# Look for the assembly language name in the .s file.
AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c) >/dev/null 2>&1
if grep _foo conftest.s >/dev/null ; then
gl_cv_prog_as_underscore=yes
else
gl_cv_prog_as_underscore=no
fi
rm -f conftest*
])
if test $gl_cv_prog_as_underscore = yes; then
USER_LABEL_PREFIX=_
else
USER_LABEL_PREFIX=
fi
AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX],
[Define to the prefix of C symbols at the assembler and linker level,
either an underscore or empty.])
ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"'
AC_SUBST([ASM_SYMBOL_PREFIX])
])
3 changes: 2 additions & 1 deletion gl/m4/gnulib-cache.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


# Specification in the form of a command-line invocation:
# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --libtool --macro-prefix=gl --no-vc-files accept arpa_inet autobuild bind close connect error fdl-1.3 gendocs getaddrinfo getline getpass-gnu gettime gnupload gpl-3.0 inet_ntop inet_pton lgpl-2.1 listen maintainer-makefile manywarnings minmax perror pmccabe2html progname read-file readline recv select send setsockopt shutdown socket sockets sys_stat update-copyright version-etc-fsf warnings
# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --libtool --macro-prefix=gl --no-vc-files accept arpa_inet autobuild bind close connect error fdl-1.3 gendocs getaddrinfo getline getpass-gnu gettime gnupload gpl-3.0 inet_ntop inet_pton lgpl-2.1 listen maintainer-makefile manywarnings minmax perror pmccabe2html progname read-file readline recv select send setsockopt shutdown socket sockets sys_stat update-copyright valgrind-tests version-etc-fsf warnings

# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([gl/override])
Expand Down Expand Up @@ -56,6 +56,7 @@ gl_MODULES([
sockets
sys_stat
update-copyright
valgrind-tests
version-etc-fsf
warnings
])
Expand Down
8 changes: 7 additions & 1 deletion gl/m4/gnulib-common.m4
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit e4b0fe0

Please sign in to comment.