summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild-aux/pmccabe2html5
-rwxr-xr-xbuild-aux/useless-if-before-free5
-rw-r--r--gl/m4/fseeko.m49
-rw-r--r--gl/m4/gnulib-comp.m42
-rw-r--r--gl/m4/inet_ntop.m416
-rw-r--r--gl/m4/inet_pton.m415
-rw-r--r--gl/m4/pmccabe2html.m414
-rw-r--r--gl/m4/ungetc.m44
-rw-r--r--gl/sockets.c10
-rw-r--r--gl/stdio.in.h18
-rw-r--r--gl/sys_stat.in.h10
-rw-r--r--gl/tests/test-arpa_inet.c4
-rw-r--r--gl/tests/test-getaddrinfo.c3
-rw-r--r--gl/tests/test-getdelim.c4
-rw-r--r--gl/tests/test-getline.c4
-rw-r--r--gl/tests/test-gettimeofday.c4
-rw-r--r--gl/tests/test-memchr.c6
-rw-r--r--gl/tests/test-netinet_in.c4
-rw-r--r--gl/tests/test-select-stdin.c4
-rw-r--r--gl/tests/test-select.c4
-rw-r--r--gl/tests/test-sockets.c2
-rw-r--r--gl/tests/test-stddef.c2
-rw-r--r--gl/tests/test-stdint.c4
-rw-r--r--gl/tests/test-stdio.c2
-rw-r--r--gl/tests/test-stdlib.c2
-rw-r--r--gl/tests/test-strerror.c4
-rw-r--r--gl/tests/test-string.c2
-rw-r--r--gl/tests/test-sys_select.c2
-rw-r--r--gl/tests/test-sys_socket.c2
-rw-r--r--gl/tests/test-sys_stat.c2
-rw-r--r--gl/tests/test-sys_time.c4
-rw-r--r--gl/tests/test-time.c2
-rw-r--r--gl/tests/test-unistd.c2
-rw-r--r--gl/tests/test-version-etc.c2
-rw-r--r--gl/tests/test-wchar.c2
-rw-r--r--lib/gl/m4/fseeko.m49
-rw-r--r--lib/gl/m4/ungetc.m44
-rw-r--r--lib/gl/sockets.c10
-rw-r--r--lib/gl/stdio.in.h18
-rw-r--r--lib/gl/sys_stat.in.h10
-rw-r--r--lib/gl/tests/test-memchr.c6
-rw-r--r--lib/gl/tests/test-sockets.c2
-rw-r--r--lib/gl/tests/test-stddef.c2
-rw-r--r--lib/gl/tests/test-stdint.c4
-rw-r--r--lib/gl/tests/test-stdio.c2
-rw-r--r--lib/gl/tests/test-stdlib.c2
-rw-r--r--lib/gl/tests/test-string.c2
-rw-r--r--lib/gl/tests/test-strverscmp.c4
-rw-r--r--lib/gl/tests/test-sys_socket.c2
-rw-r--r--lib/gl/tests/test-sys_stat.c2
-rw-r--r--lib/gl/tests/test-time.c2
-rw-r--r--lib/gl/tests/test-unistd.c2
-rw-r--r--lib/gl/tests/test-wchar.c2
-rw-r--r--libextra/gl/md5.c13
-rw-r--r--maint.mk6
55 files changed, 172 insertions, 113 deletions
diff --git a/build-aux/pmccabe2html b/build-aux/pmccabe2html
index 27bb8f3539..bc0f6e80b9 100755
--- a/build-aux/pmccabe2html
+++ b/build-aux/pmccabe2html
@@ -1,7 +1,8 @@
-#!/usr/bin/awk -f
+#!/bin/sh
+exec awk -f "$0" "$@"
# pmccabe2html - pmccabe to html converter
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008, 2009 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
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index abcdef2cda..793c9753e0 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -1,4 +1,6 @@
-#!/usr/bin/perl -T
+eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
+ & eval 'exec perl -wST "$0" $argv:q'
+ if 0;
# Detect instances of "if (p) free (p);".
# Likewise for "if (p != NULL) free (p);". And with braces.
# Also detect "if (NULL != p) free (p);".
@@ -197,6 +199,7 @@ When modifying files, refuse to process anything other than a regular file.
EOF
## Local Variables:
+## mode: perl
## indent-tabs-mode: nil
## eval: (add-hook 'write-file-hooks 'time-stamp)
## time-stamp-start: "my $VERSION = '"
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4
index 3d77365688..a370648e9f 100644
--- a/gl/m4/fseeko.m4
+++ b/gl/m4/fseeko.m4
@@ -1,5 +1,5 @@
-# fseeko.m4 serial 4
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# fseeko.m4 serial 6
+dnl Copyright (C) 2007-2009 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.
@@ -15,7 +15,8 @@ AC_DEFUN([gl_FUNC_FSEEKO],
AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
[
- AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
+]], [fseeko (stdin, 0, 0);])],
[gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
if test $gl_cv_func_fseeko = no; then
@@ -31,4 +32,6 @@ AC_DEFUN([gl_REPLACE_FSEEKO],
AC_LIBOBJ([fseeko])
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
REPLACE_FSEEKO=1
+ dnl If we are also using the fseek module, then fseek needs replacing, too.
+ m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
])
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 045b826d02..669e6d8b1d 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -124,7 +124,6 @@ AC_SUBST([LTALLOCA])
AC_PROG_MKDIR_P
gl_FUNC_PERROR
gl_STRING_MODULE_INDICATOR([perror])
- gl_PMCCABE2HTML
AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
gl_FUNC_READ_FILE
@@ -481,7 +480,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/netdb_h.m4
m4/netinet_in_h.m4
m4/perror.m4
- m4/pmccabe2html.m4
m4/printf.m4
m4/read-file.m4
m4/readline.m4
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4
index 2bbdca1088..85a6bb6808 100644
--- a/gl/m4/inet_ntop.m4
+++ b/gl/m4/inet_ntop.m4
@@ -1,4 +1,4 @@
-# inet_ntop.m4 serial 9
+# inet_ntop.m4 serial 10
dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,17 +11,17 @@ AC_DEFUN([gl_INET_NTOP],
gl_REPLACE_ARPA_INET_H
- dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to
- dnl find inet_ntop.
- dnl
- dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
- dnl -lnsl if it is needed. Normally -lnsl is not needed on Solaris 8,
- dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
- dnl isn't built on Solaris 8.
+ dnl Most platforms that provide inet_ntop define it in libc.
+ dnl Solaris 8..10 provide inet_ntop in libnsl instead.
gl_save_LIBS=$LIBS
AC_SEARCH_LIBS([inet_ntop], [nsl], [],
[AC_REPLACE_FUNCS([inet_ntop])])
LIBS=$gl_save_LIBS
+ INET_NTOP_LIB=
+ if test "$ac_cv_search_inet_ntop" != "none needed"; then
+ INET_NTOP_LIB="$ac_cv_search_inet_ntop"
+ fi
+ AC_SUBST([INET_NTOP_LIB])
gl_PREREQ_INET_NTOP
])
diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4
index e0ec432bc6..f0718016a8 100644
--- a/gl/m4/inet_pton.m4
+++ b/gl/m4/inet_pton.m4
@@ -1,4 +1,4 @@
-# inet_pton.m4 serial 7
+# inet_pton.m4 serial 8
dnl Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,7 +11,18 @@ AC_DEFUN([gl_INET_PTON],
gl_REPLACE_ARPA_INET_H
- AC_REPLACE_FUNCS([inet_pton])
+ dnl Most platforms that provide inet_pton define it in libc.
+ dnl Solaris 8..10 provide inet_pton in libnsl instead.
+ gl_save_LIBS=$LIBS
+ AC_SEARCH_LIBS([inet_pton], [nsl], [],
+ [AC_REPLACE_FUNCS([inet_pton])])
+ LIBS=$gl_save_LIBS
+ INET_PTON_LIB=
+ if test "$ac_cv_search_inet_pton" != "none needed"; then
+ INET_PTON_LIB="$ac_cv_search_inet_pton"
+ fi
+ AC_SUBST([INET_PTON_LIB])
+
gl_PREREQ_INET_PTON
])
diff --git a/gl/m4/pmccabe2html.m4 b/gl/m4/pmccabe2html.m4
deleted file mode 100644
index 2985f7c6d2..0000000000
--- a/gl/m4/pmccabe2html.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-# pmccabe2html.m4 serial 2
-dnl Copyright (C) 2008, 2009 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 Simon Josefsson
-
-# Usage: gl_PMCCABE2HTML([]).
-AC_DEFUN([gl_PMCCABE2HTML],
-[
- AC_REQUIRE([AC_PROG_AWK])
- AC_PATH_PROG([PMCCABE], [pmccabe], [false])
-])
diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4
index 9236d4c836..eb652356b5 100644
--- a/gl/m4/ungetc.m4
+++ b/gl/m4/ungetc.m4
@@ -1,4 +1,4 @@
-# ungetc.m4 serial 1
+# ungetc.m4 serial 2
dnl Copyright (C) 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -12,7 +12,7 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
[gl_cv_func_ungetc_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
- ]], [FILE *f; long l;
+ ]], [FILE *f;
if (!(f = fopen ("conftest.tmp", "w+"))) return 1;
if (fputs ("abc", f) < 0) return 2;
rewind (f);
diff --git a/gl/sockets.c b/gl/sockets.c
index 7cb9981d12..cb169f8864 100644
--- a/gl/sockets.c
+++ b/gl/sockets.c
@@ -25,12 +25,12 @@
#if WINDOWS_SOCKETS
/* This includes winsock2.h on MinGW. */
-#include <sys/socket.h>
+# include <sys/socket.h>
-#include "close-hook.h"
+# include "close-hook.h"
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
+# include "w32sock.h"
static int
close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
@@ -71,10 +71,10 @@ static struct close_hook close_sockets_hook;
static int initialized_sockets_version /* = 0 */;
-#endif
+#endif /* WINDOWS_SOCKETS */
int
-gl_sockets_startup (int version)
+gl_sockets_startup (int version _UNUSED_PARAMETER_)
{
#if WINDOWS_SOCKETS
if (version > initialized_sockets_version)
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index 5002acc6d2..ee53703826 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -227,7 +227,14 @@ extern int rpl_fseek (FILE *fp, long offset, int whence);
fflush(), and which detect pipes. */
# define fseeko rpl_fseeko
extern int fseeko (FILE *fp, off_t offset, int whence);
-# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
+# if !@GNULIB_FSEEK@
+# undef fseek
+# define fseek(f,o,w) \
+ (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use fseeko function for handling of large files"), \
+ fseeko (f, o, w))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef fseeko
@@ -263,7 +270,14 @@ extern long rpl_ftell (FILE *fp);
# if @REPLACE_FTELLO@
# define ftello rpl_ftello
extern off_t ftello (FILE *fp);
-# define ftell(fp) ftello (fp)
+# if !@GNULIB_FTELL@
+# undef ftell
+# define ftell(f) \
+ (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use ftello function for handling of large files"), \
+ ftello (f))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef ftello
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h
index 875f0644de..98b3689f78 100644
--- a/gl/sys_stat.in.h
+++ b/gl/sys_stat.in.h
@@ -456,7 +456,15 @@ int mknodat (int fd, char const *file, mode_t mode, dev_t dev);
struct stat. This means that rpl_stat will not be used if the user
does (stat)(a,b). Oh well. */
# undef stat
-# define stat(name, st) rpl_stat (name, st)
+# ifdef _LARGE_FILES
+ /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
+ so we have to replace stat64() instead of stat(). */
+# define stat stat64
+# undef stat64
+# define stat64(name, st) rpl_stat (name, st)
+# else /* !_LARGE_FILES */
+# define stat(name, st) rpl_stat (name, st)
+# endif /* !_LARGE_FILES */
extern int stat (const char *name, struct stat *buf);
# endif
#elif defined GNULIB_POSIXCHECK
diff --git a/gl/tests/test-arpa_inet.c b/gl/tests/test-arpa_inet.c
index fc2d8ba448..1e2479f4f9 100644
--- a/gl/tests/test-arpa_inet.c
+++ b/gl/tests/test-arpa_inet.c
@@ -1,5 +1,5 @@
/* Test of <arpa/inet.h> substitute.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 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
@@ -21,7 +21,7 @@
#include <arpa/inet.h>
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-getaddrinfo.c b/gl/tests/test-getaddrinfo.c
index eeea3f7c43..384b98b6e8 100644
--- a/gl/tests/test-getaddrinfo.c
+++ b/gl/tests/test-getaddrinfo.c
@@ -44,7 +44,8 @@
# define EAI_SERVICE 0
#endif
-int simple (char *host, char *service)
+static int
+simple (char const *host, char const *service)
{
char buf[BUFSIZ];
static int skip = 0;
diff --git a/gl/tests/test-getdelim.c b/gl/tests/test-getdelim.c
index 0c112f6bd5..da4fe6b313 100644
--- a/gl/tests/test-getdelim.c
+++ b/gl/tests/test-getdelim.c
@@ -1,5 +1,5 @@
/* Test of getdelim() function.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -36,7 +36,7 @@
while (0)
int
-main (int argc, char **argv)
+main (void)
{
FILE *f;
char *line = NULL;
diff --git a/gl/tests/test-getline.c b/gl/tests/test-getline.c
index 51fc816866..50722cd48d 100644
--- a/gl/tests/test-getline.c
+++ b/gl/tests/test-getline.c
@@ -1,5 +1,5 @@
/* Test of getline() function.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -36,7 +36,7 @@
while (0)
int
-main (int argc, char **argv)
+main (void)
{
FILE *f;
char *line = NULL;
diff --git a/gl/tests/test-gettimeofday.c b/gl/tests/test-gettimeofday.c
index 892b18829c..3b858791a4 100644
--- a/gl/tests/test-gettimeofday.c
+++ b/gl/tests/test-gettimeofday.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2007 Free Software Foundation
+ * Copyright (C) 2005, 2007, 2009 Free Software Foundation
* Written by Jim Meyering.
*
* This program is free software: you can redistribute it and/or modify
@@ -24,7 +24,7 @@
#include <string.h>
int
-main (int argc, char *argv[])
+main (void)
{
time_t t = 0;
struct tm *lt;
diff --git a/gl/tests/test-memchr.c b/gl/tests/test-memchr.c
index 1124f8b587..d5e53e0081 100644
--- a/gl/tests/test-memchr.c
+++ b/gl/tests/test-memchr.c
@@ -41,7 +41,7 @@
#define MEMCHR (char *) memchr
int
-main ()
+main (void)
{
size_t n = 0x100000;
char *input = malloc (n);
@@ -102,8 +102,6 @@ main ()
if (page_boundary != NULL)
{
- int n;
-
for (n = 1; n <= 500; n++)
{
char *mem = page_boundary - n;
@@ -111,7 +109,7 @@ main ()
ASSERT (MEMCHR (mem, 'U', n) == NULL);
{
- int i;
+ size_t i;
for (i = 0; i < n; i++)
{
diff --git a/gl/tests/test-netinet_in.c b/gl/tests/test-netinet_in.c
index b1957197b7..5a61557c94 100644
--- a/gl/tests/test-netinet_in.c
+++ b/gl/tests/test-netinet_in.c
@@ -1,5 +1,5 @@
/* Test of <netinet/in.h> substitute.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 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
@@ -21,7 +21,7 @@
#include <netinet/in.h>
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-select-stdin.c b/gl/tests/test-select-stdin.c
index e855f92d20..079dec50e7 100644
--- a/gl/tests/test-select-stdin.c
+++ b/gl/tests/test-select-stdin.c
@@ -1,5 +1,5 @@
/* Test of select() substitute, reading from stdin.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009 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
@@ -25,7 +25,7 @@
#include <unistd.h>
int
-main ()
+main (void)
{
printf ("Applying select() from standard input. Press Ctrl-C to abort.\n");
for (;;)
diff --git a/gl/tests/test-select.c b/gl/tests/test-select.c
index ec82250149..d6d6b063ac 100644
--- a/gl/tests/test-select.c
+++ b/gl/tests/test-select.c
@@ -84,7 +84,7 @@ test (void (*fn) (void), const char *msg)
/* Funny socket code. */
static int
-open_server_socket ()
+open_server_socket (void)
{
int s, x;
struct sockaddr_in ia;
@@ -355,7 +355,7 @@ test_pipe (void)
/* Do them all. */
int
-main ()
+main (void)
{
int result;
diff --git a/gl/tests/test-sockets.c b/gl/tests/test-sockets.c
index 3c85a431c5..2d259649cd 100644
--- a/gl/tests/test-sockets.c
+++ b/gl/tests/test-sockets.c
@@ -22,7 +22,7 @@
#include "sockets.h"
int
-main (int argc, char *argv[])
+main (void)
{
int err;
diff --git a/gl/tests/test-stddef.c b/gl/tests/test-stddef.c
index f8484987cb..c0a7515ecc 100644
--- a/gl/tests/test-stddef.c
+++ b/gl/tests/test-stddef.c
@@ -32,7 +32,7 @@ size_t c = 2;
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-stdint.c b/gl/tests/test-stdint.c
index a2bf42ac89..4e9b3621ee 100644
--- a/gl/tests/test-stdint.c
+++ b/gl/tests/test-stdint.c
@@ -1,5 +1,5 @@
/* Test of <stdint.h> substitute.
- Copyright (C) 2006-2008 Free Software Foundation, Inc.
+ Copyright (C) 2006-2009 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
@@ -354,7 +354,7 @@ verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-stdio.c b/gl/tests/test-stdio.c
index dcfe38dd51..3f2f0677f0 100644
--- a/gl/tests/test-stdio.c
+++ b/gl/tests/test-stdio.c
@@ -30,7 +30,7 @@ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-stdlib.c b/gl/tests/test-stdlib.c
index ae46ba1662..fad5cf450e 100644
--- a/gl/tests/test-stdlib.c
+++ b/gl/tests/test-stdlib.c
@@ -29,7 +29,7 @@ int exitcode;
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
/* Check that some macros are defined and different integer constants. */
switch (exitcode)
diff --git a/gl/tests/test-strerror.c b/gl/tests/test-strerror.c
index 3d9814d5d4..27eb969a70 100644
--- a/gl/tests/test-strerror.c
+++ b/gl/tests/test-strerror.c
@@ -1,5 +1,5 @@
/* Test of strerror() function.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
@@ -37,7 +37,7 @@
while (0)
int
-main (int argc, char **argv)
+main (void)
{
char *str;
diff --git a/gl/tests/test-string.c b/gl/tests/test-string.c
index fe53cd9b15..69df747eb6 100644
--- a/gl/tests/test-string.c
+++ b/gl/tests/test-string.c
@@ -27,7 +27,7 @@
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-sys_select.c b/gl/tests/test-sys_select.c
index 66079529ef..aef8941071 100644
--- a/gl/tests/test-sys_select.c
+++ b/gl/tests/test-sys_select.c
@@ -24,7 +24,7 @@
struct timeval t1;
int
-main ()
+main (void)
{
/* Check that FD_ZERO can be used. This should not yield a warning
such as "warning: implicit declaration of function 'memset'". */
diff --git a/gl/tests/test-sys_socket.c b/gl/tests/test-sys_socket.c
index 3d946a83bf..ddb491b312 100644
--- a/gl/tests/test-sys_socket.c
+++ b/gl/tests/test-sys_socket.c
@@ -28,7 +28,7 @@ int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
#endif
int
-main ()
+main (void)
{
struct sockaddr_storage x;
sa_family_t i;
diff --git a/gl/tests/test-sys_stat.c b/gl/tests/test-sys_stat.c
index a73f9b81c6..4a85c9f08b 100644
--- a/gl/tests/test-sys_stat.c
+++ b/gl/tests/test-sys_stat.c
@@ -282,7 +282,7 @@ nlink_t t1;
struct timespec t2;
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-sys_time.c b/gl/tests/test-sys_time.c
index bae4108e07..74f35acfe4 100644
--- a/gl/tests/test-sys_time.c
+++ b/gl/tests/test-sys_time.c
@@ -1,5 +1,5 @@
/* Test of <sys/time.h> substitute.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 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
@@ -23,7 +23,7 @@
struct timeval a;
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-time.c b/gl/tests/test-time.c
index ea8143737f..4afa3b3988 100644
--- a/gl/tests/test-time.c
+++ b/gl/tests/test-time.c
@@ -29,7 +29,7 @@ struct timespec a;
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-unistd.c b/gl/tests/test-unistd.c
index 129367b4d7..dd907f4ebe 100644
--- a/gl/tests/test-unistd.c
+++ b/gl/tests/test-unistd.c
@@ -50,7 +50,7 @@ intptr_t t8;
#endif
int
-main ()
+main (void)
{
return 0;
}
diff --git a/gl/tests/test-version-etc.c b/gl/tests/test-version-etc.c
index 71cbc8bac4..9ff97c45a8 100644
--- a/gl/tests/test-version-etc.c
+++ b/gl/tests/test-version-etc.c
@@ -24,7 +24,7 @@
#define AUTHORS "Sergey Poznyakoff", "Eric Blake"
int
-main (int argc, char **argv)
+main (int argc _UNUSED_PARAMETER_, char **argv)
{
set_program_name (argv[0]);
version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
diff --git a/gl/tests/test-wchar.c b/gl/tests/test-wchar.c
index 28660688d2..2e60bb86db 100644
--- a/gl/tests/test-wchar.c
+++ b/gl/tests/test-wchar.c
@@ -31,7 +31,7 @@ wint_t b = 'x';
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/lib/gl/m4/fseeko.m4 b/lib/gl/m4/fseeko.m4
index 3d77365688..a370648e9f 100644
--- a/lib/gl/m4/fseeko.m4
+++ b/lib/gl/m4/fseeko.m4
@@ -1,5 +1,5 @@
-# fseeko.m4 serial 4
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# fseeko.m4 serial 6
+dnl Copyright (C) 2007-2009 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.
@@ -15,7 +15,8 @@ AC_DEFUN([gl_FUNC_FSEEKO],
AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
[
- AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
+]], [fseeko (stdin, 0, 0);])],
[gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
if test $gl_cv_func_fseeko = no; then
@@ -31,4 +32,6 @@ AC_DEFUN([gl_REPLACE_FSEEKO],
AC_LIBOBJ([fseeko])
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
REPLACE_FSEEKO=1
+ dnl If we are also using the fseek module, then fseek needs replacing, too.
+ m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
])
diff --git a/lib/gl/m4/ungetc.m4 b/lib/gl/m4/ungetc.m4
index 9236d4c836..eb652356b5 100644
--- a/lib/gl/m4/ungetc.m4
+++ b/lib/gl/m4/ungetc.m4
@@ -1,4 +1,4 @@
-# ungetc.m4 serial 1
+# ungetc.m4 serial 2
dnl Copyright (C) 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -12,7 +12,7 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
[gl_cv_func_ungetc_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
- ]], [FILE *f; long l;
+ ]], [FILE *f;
if (!(f = fopen ("conftest.tmp", "w+"))) return 1;
if (fputs ("abc", f) < 0) return 2;
rewind (f);
diff --git a/lib/gl/sockets.c b/lib/gl/sockets.c
index f0bf0acfb4..a6bbf03c9e 100644
--- a/lib/gl/sockets.c
+++ b/lib/gl/sockets.c
@@ -25,12 +25,12 @@
#if WINDOWS_SOCKETS
/* This includes winsock2.h on MinGW. */
-#include <sys/socket.h>
+# include <sys/socket.h>
-#include "close-hook.h"
+# include "close-hook.h"
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
+# include "w32sock.h"
static int
close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
@@ -71,10 +71,10 @@ static struct close_hook close_sockets_hook;
static int initialized_sockets_version /* = 0 */;
-#endif
+#endif /* WINDOWS_SOCKETS */
int
-gl_sockets_startup (int version)
+gl_sockets_startup (int version _UNUSED_PARAMETER_)
{
#if WINDOWS_SOCKETS
if (version > initialized_sockets_version)
diff --git a/lib/gl/stdio.in.h b/lib/gl/stdio.in.h
index 384010a456..cd11a52a91 100644
--- a/lib/gl/stdio.in.h
+++ b/lib/gl/stdio.in.h
@@ -227,7 +227,14 @@ extern int rpl_fseek (FILE *fp, long offset, int whence);
fflush(), and which detect pipes. */
# define fseeko rpl_fseeko
extern int fseeko (FILE *fp, off_t offset, int whence);
-# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
+# if !@GNULIB_FSEEK@
+# undef fseek
+# define fseek(f,o,w) \
+ (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use fseeko function for handling of large files"), \
+ fseeko (f, o, w))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef fseeko
@@ -263,7 +270,14 @@ extern long rpl_ftell (FILE *fp);
# if @REPLACE_FTELLO@
# define ftello rpl_ftello
extern off_t ftello (FILE *fp);
-# define ftell(fp) ftello (fp)
+# if !@GNULIB_FTELL@
+# undef ftell
+# define ftell(f) \
+ (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+ "on 32-bit platforms - " \
+ "use ftello function for handling of large files"), \
+ ftello (f))
+# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef ftello
diff --git a/lib/gl/sys_stat.in.h b/lib/gl/sys_stat.in.h
index 13cfcbf592..1afd5c9792 100644
--- a/lib/gl/sys_stat.in.h
+++ b/lib/gl/sys_stat.in.h
@@ -456,7 +456,15 @@ int mknodat (int fd, char const *file, mode_t mode, dev_t dev);
struct stat. This means that rpl_stat will not be used if the user
does (stat)(a,b). Oh well. */
# undef stat
-# define stat(name, st) rpl_stat (name, st)
+# ifdef _LARGE_FILES
+ /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
+ so we have to replace stat64() instead of stat(). */
+# define stat stat64
+# undef stat64
+# define stat64(name, st) rpl_stat (name, st)
+# else /* !_LARGE_FILES */
+# define stat(name, st) rpl_stat (name, st)
+# endif /* !_LARGE_FILES */
extern int stat (const char *name, struct stat *buf);
# endif
#elif defined GNULIB_POSIXCHECK
diff --git a/lib/gl/tests/test-memchr.c b/lib/gl/tests/test-memchr.c
index 1124f8b587..d5e53e0081 100644
--- a/lib/gl/tests/test-memchr.c
+++ b/lib/gl/tests/test-memchr.c
@@ -41,7 +41,7 @@
#define MEMCHR (char *) memchr
int
-main ()
+main (void)
{
size_t n = 0x100000;
char *input = malloc (n);
@@ -102,8 +102,6 @@ main ()
if (page_boundary != NULL)
{
- int n;
-
for (n = 1; n <= 500; n++)
{
char *mem = page_boundary - n;
@@ -111,7 +109,7 @@ main ()
ASSERT (MEMCHR (mem, 'U', n) == NULL);
{
- int i;
+ size_t i;
for (i = 0; i < n; i++)
{
diff --git a/lib/gl/tests/test-sockets.c b/lib/gl/tests/test-sockets.c
index 3c85a431c5..2d259649cd 100644
--- a/lib/gl/tests/test-sockets.c
+++ b/lib/gl/tests/test-sockets.c
@@ -22,7 +22,7 @@
#include "sockets.h"
int
-main (int argc, char *argv[])
+main (void)
{
int err;
diff --git a/lib/gl/tests/test-stddef.c b/lib/gl/tests/test-stddef.c
index f8484987cb..c0a7515ecc 100644
--- a/lib/gl/tests/test-stddef.c
+++ b/lib/gl/tests/test-stddef.c
@@ -32,7 +32,7 @@ size_t c = 2;
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/lib/gl/tests/test-stdint.c b/lib/gl/tests/test-stdint.c
index a2bf42ac89..4e9b3621ee 100644
--- a/lib/gl/tests/test-stdint.c
+++ b/lib/gl/tests/test-stdint.c
@@ -1,5 +1,5 @@
/* Test of <stdint.h> substitute.
- Copyright (C) 2006-2008 Free Software Foundation, Inc.
+ Copyright (C) 2006-2009 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
@@ -354,7 +354,7 @@ verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
int
-main ()
+main (void)
{
return 0;
}
diff --git a/lib/gl/tests/test-stdio.c b/lib/gl/tests/test-stdio.c
index dcfe38dd51..3f2f0677f0 100644
--- a/lib/gl/tests/test-stdio.c
+++ b/lib/gl/tests/test-stdio.c
@@ -30,7 +30,7 @@ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/lib/gl/tests/test-stdlib.c b/lib/gl/tests/test-stdlib.c
index ae46ba1662..fad5cf450e 100644
--- a/lib/gl/tests/test-stdlib.c
+++ b/lib/gl/tests/test-stdlib.c
@@ -29,7 +29,7 @@ int exitcode;
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
/* Check that some macros are defined and different integer constants. */
switch (exitcode)
diff --git a/lib/gl/tests/test-string.c b/lib/gl/tests/test-string.c
index fe53cd9b15..69df747eb6 100644
--- a/lib/gl/tests/test-string.c
+++ b/lib/gl/tests/test-string.c
@@ -27,7 +27,7 @@
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/lib/gl/tests/test-strverscmp.c b/lib/gl/tests/test-strverscmp.c
index 04da20c105..a98695baa0 100644
--- a/lib/gl/tests/test-strverscmp.c
+++ b/lib/gl/tests/test-strverscmp.c
@@ -1,5 +1,5 @@
/* Test of strverscmp() function.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009 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
@@ -37,7 +37,7 @@
while (0)
int
-main (int argc, char **argv)
+main (void)
{
ASSERT (strverscmp ("", "") == 0);
ASSERT (strverscmp ("a", "a") == 0);
diff --git a/lib/gl/tests/test-sys_socket.c b/lib/gl/tests/test-sys_socket.c
index 3d946a83bf..ddb491b312 100644
--- a/lib/gl/tests/test-sys_socket.c
+++ b/lib/gl/tests/test-sys_socket.c
@@ -28,7 +28,7 @@ int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
#endif
int
-main ()
+main (void)
{
struct sockaddr_storage x;
sa_family_t i;
diff --git a/lib/gl/tests/test-sys_stat.c b/lib/gl/tests/test-sys_stat.c
index a73f9b81c6..4a85c9f08b 100644
--- a/lib/gl/tests/test-sys_stat.c
+++ b/lib/gl/tests/test-sys_stat.c
@@ -282,7 +282,7 @@ nlink_t t1;
struct timespec t2;
int
-main ()
+main (void)
{
return 0;
}
diff --git a/lib/gl/tests/test-time.c b/lib/gl/tests/test-time.c
index ea8143737f..4afa3b3988 100644
--- a/lib/gl/tests/test-time.c
+++ b/lib/gl/tests/test-time.c
@@ -29,7 +29,7 @@ struct timespec a;
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/lib/gl/tests/test-unistd.c b/lib/gl/tests/test-unistd.c
index 129367b4d7..dd907f4ebe 100644
--- a/lib/gl/tests/test-unistd.c
+++ b/lib/gl/tests/test-unistd.c
@@ -50,7 +50,7 @@ intptr_t t8;
#endif
int
-main ()
+main (void)
{
return 0;
}
diff --git a/lib/gl/tests/test-wchar.c b/lib/gl/tests/test-wchar.c
index 28660688d2..2e60bb86db 100644
--- a/lib/gl/tests/test-wchar.c
+++ b/lib/gl/tests/test-wchar.c
@@ -31,7 +31,7 @@ wint_t b = 'x';
verify (sizeof NULL == sizeof (void *));
int
-main ()
+main (void)
{
return 0;
}
diff --git a/libextra/gl/md5.c b/libextra/gl/md5.c
index 07e7e927bc..0905367bdd 100644
--- a/libextra/gl/md5.c
+++ b/libextra/gl/md5.c
@@ -56,7 +56,7 @@
# define SWAP(n) (n)
#endif
-#define BLOCKSIZE 4096
+#define BLOCKSIZE 32768
#if BLOCKSIZE % 64 != 0
# error "invalid BLOCKSIZE"
#endif
@@ -138,9 +138,12 @@ int
md5_stream (FILE *stream, void *resblock)
{
struct md5_ctx ctx;
- char buffer[BLOCKSIZE + 72];
size_t sum;
+ char *buffer = malloc (BLOCKSIZE + 72);
+ if (!buffer)
+ return 1;
+
/* Initialize the computation context. */
md5_init_ctx (&ctx);
@@ -169,7 +172,10 @@ md5_stream (FILE *stream, void *resblock)
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
- return 1;
+ {
+ free (buffer);
+ return 1;
+ }
goto process_partial_block;
}
@@ -194,6 +200,7 @@ process_partial_block:
/* Construct result in desired memory. */
md5_finish_ctx (&ctx, resblock);
+ free (buffer);
return 0;
}
#endif
diff --git a/maint.mk b/maint.mk
index 68bd8f9153..996344a93d 100644
--- a/maint.mk
+++ b/maint.mk
@@ -156,6 +156,12 @@ sc_prohibit_strcmp:
{ echo '$(ME): use STREQ in place of the above uses of str''cmp' \
1>&2; exit 1; } || :
+# Pass EXIT_*, not number, to usage, exit, and error (when exiting)
+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)
+
# 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: