From eccf108c763da99625bbe6bf221a13508798ce1a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 2 Apr 2011 09:22:13 -0700 Subject: autoupdate --- build-aux/config.sub | 2 ++ build-aux/texinfo.tex | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/build-aux/config.sub b/build-aux/config.sub index 18b17aa463..30fdca8121 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -286,6 +286,7 @@ case $basic_machine in | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ + | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ @@ -394,6 +395,7 @@ case $basic_machine in | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ diff --git a/build-aux/texinfo.tex b/build-aux/texinfo.tex index 7b943897de..9f64511ea2 100644 --- a/build-aux/texinfo.tex +++ b/build-aux/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2011-02-24.09} +\def\texinfoversion{2011-03-25.11} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -7053,12 +7053,14 @@ end % ... and for \example: \spaceisspace % - % The \empty here causes a following catcode 5 newline to be eaten - % as part of reading whitespace after a control sequence. It does - % not eat a catcode 13 newline. There's no good way to handle the - % two cases. See the Macro Details node in the manual for the - % workaround we currently have to recommend for macros and + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and % line-oriented commands. + % \scantokens{#1\empty}% \endgroup} -- cgit v1.2.1 From 4266051ac3a82f0a3bdfcf73c7f566e007676a0c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 5 Apr 2011 09:52:32 -0700 Subject: areadlink, areadlinkat: rewrite in terms of careadlinkat * lib/areadlink.c, lib/areadlinkat.c: Include careadlinkat.h instead of errno.h, limits.h, stdint.h, stdlib.h, string.h, unistd.h. (SSIZE_MAX, INITIAL_BUF_SIZE): Remove. (malloc, realloc): Remove #undefs. (areadlink, areadlinkat): Rewrite in terms of careadlinkat. * modules/areadlink (Depends-on): Add careadlinkat. Remove readlink, ssize_t, stdint, unistd. * modules/areadlinkat (Depends-on): Add careadlinkat. Remove areadlink, stdint. careadlinkat: new module * lib/allocator.h, lib/careadlinkat.h, lib/careadlinkat.c: * modules/careadlinkat: New files, written by me with a review and feedback from Ben Pfaff in . --- ChangeLog | 19 ++++++ lib/allocator.h | 53 ++++++++++++++++ lib/areadlink.c | 98 +---------------------------- lib/areadlinkat.c | 86 +------------------------ lib/careadlinkat.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/careadlinkat.h | 67 ++++++++++++++++++++ modules/areadlink | 5 +- modules/areadlinkat | 3 +- modules/careadlinkat | 27 ++++++++ 9 files changed, 349 insertions(+), 184 deletions(-) create mode 100644 lib/allocator.h create mode 100644 lib/careadlinkat.c create mode 100644 lib/careadlinkat.h create mode 100644 modules/careadlinkat diff --git a/ChangeLog b/ChangeLog index db0800c37a..96804fa44b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2011-04-05 Paul Eggert + + areadlink, areadlinkat: rewrite in terms of careadlinkat + * lib/areadlink.c, lib/areadlinkat.c: Include careadlinkat.h + instead of errno.h, limits.h, stdint.h, stdlib.h, string.h, unistd.h. + (SSIZE_MAX, INITIAL_BUF_SIZE): Remove. + (malloc, realloc): Remove #undefs. + (areadlink, areadlinkat): Rewrite in terms of careadlinkat. + * modules/areadlink (Depends-on): Add careadlinkat. Remove + readlink, ssize_t, stdint, unistd. + * modules/areadlinkat (Depends-on): Add careadlinkat. Remove + areadlink, stdint. + + careadlinkat: new module + * lib/allocator.h, lib/careadlinkat.h, lib/careadlinkat.c: + * modules/careadlinkat: New files, written by me with + a review and feedback from Ben Pfaff in + . + 2011-04-01 Bruno Haible wmemchr, wcschr, wcsrchr, wcspbrk, wcsstr: Avoid errors in C++ mode. diff --git a/lib/allocator.h b/lib/allocator.h new file mode 100644 index 0000000000..4ac863b224 --- /dev/null +++ b/lib/allocator.h @@ -0,0 +1,53 @@ +/* Memory allocators such as malloc+free. + + Copyright (C) 2011 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 . */ + +/* Written by Paul Eggert. */ + +#ifndef _GL_ALLOCATOR_H + +#include + +/* An object describing a memory allocator family. */ + +struct allocator +{ + /* Do not use GCC attributes such as __attribute__ ((malloc)) with + the function types pointed at by these members, because these + attributes do not work with pointers to functions. See + . */ + + /* Call MALLOC to allocate memory, like 'malloc'. On failure MALLOC + should return NULL, though not necessarily set errno. When given + a zero size it may return NULL even if successful. */ + void *(*malloc) (size_t); + + /* If nonnull, call REALLOC to reallocate memory, like 'realloc'. + On failure REALLOC should return NULL, though not necessarily set + errno. When given a zero size it may return NULL even if + successful. */ + void *(*realloc) (void *, size_t); + + /* Call FREE to free memory, like 'free'. */ + void (*free) (void *); + + /* If nonnull, call DIE if MALLOC or REALLOC fails. DIE should not + return. DIE can be used by code that detects memory overflow + while calculating sizes to be passed to MALLOC or REALLOC. */ + void (*die) (void); +}; + +#endif diff --git a/lib/areadlink.c b/lib/areadlink.c index bc6104f7e8..6bf9a0c415 100644 --- a/lib/areadlink.c +++ b/lib/areadlink.c @@ -24,108 +24,16 @@ /* Specification. */ #include "areadlink.h" -#include -#include -#include -#include -#include -#include - -#ifndef SSIZE_MAX -# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) -#endif - -/* Use the system functions, not the gnulib overrides in this file. */ -#undef malloc -#undef realloc - -/* The initial buffer size for the link value. A power of 2 - detects arithmetic overflow earlier, but is not required. */ -enum { - INITIAL_BUF_SIZE = 1024 -}; +#include "careadlinkat.h" /* Call readlink to get the symbolic link value of FILENAME. Return a pointer to that NUL-terminated string in malloc'd storage. If readlink fails, return NULL and set errno. - If realloc fails, or if the link value is longer than SIZE_MAX :-), + If allocation fails, or if the link value is longer than SIZE_MAX :-), return NULL and set errno to ENOMEM. */ char * areadlink (char const *filename) { - /* Allocate the initial buffer on the stack. This way, in the common - case of a symlink of small size, we get away with a single small malloc() - instead of a big malloc() followed by a shrinking realloc(). */ - char initial_buf[INITIAL_BUF_SIZE]; - - char *buffer = initial_buf; - size_t buf_size = sizeof initial_buf; - - while (1) - { - /* Attempt to read the link into the current buffer. */ - ssize_t link_length = readlink (filename, buffer, buf_size); - - /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1 - with errno == ERANGE if the buffer is too small. */ - if (link_length < 0 && errno != ERANGE) - { - if (buffer != initial_buf) - { - int saved_errno = errno; - free (buffer); - errno = saved_errno; - } - return NULL; - } - - if ((size_t) link_length < buf_size) - { - buffer[link_length++] = '\0'; - - /* Return it in a chunk of memory as small as possible. */ - if (buffer == initial_buf) - { - buffer = (char *) malloc (link_length); - if (buffer == NULL) - { - /* It's easier to set errno to ENOMEM than to rely on the - 'malloc-posix' gnulib module. */ - errno = ENOMEM; - return NULL; - } - memcpy (buffer, initial_buf, link_length); - } - else - { - /* Shrink buffer before returning it. */ - if ((size_t) link_length < buf_size) - { - char *smaller_buffer = (char *) realloc (buffer, link_length); - - if (smaller_buffer != NULL) - buffer = smaller_buffer; - } - } - return buffer; - } - - if (buffer != initial_buf) - free (buffer); - buf_size *= 2; - if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0)) - { - errno = ENOMEM; - return NULL; - } - buffer = (char *) malloc (buf_size); - if (buffer == NULL) - { - /* It's easier to set errno to ENOMEM than to rely on the - 'malloc-posix' gnulib module. */ - errno = ENOMEM; - return NULL; - } - } + return careadlinkat (AT_FDCWD, filename, NULL, 0, NULL, careadlinkatcwd); } diff --git a/lib/areadlinkat.c b/lib/areadlinkat.c index a13c0e506d..2c227f36d9 100644 --- a/lib/areadlinkat.c +++ b/lib/areadlinkat.c @@ -25,101 +25,21 @@ /* Specification. */ #include "areadlink.h" -#include -#include -#include -#include -#include -#include - -#ifndef SSIZE_MAX -# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) -#endif +#include "careadlinkat.h" #if HAVE_READLINKAT -/* The initial buffer size for the link value. A power of 2 - detects arithmetic overflow earlier, but is not required. */ -enum { - INITIAL_BUF_SIZE = 1024 -}; - /* Call readlinkat to get the symbolic link value of FILENAME relative to FD. Return a pointer to that NUL-terminated string in malloc'd storage. If readlinkat fails, return NULL and set errno (although failure to change directory will issue a diagnostic and exit). - If realloc fails, or if the link value is longer than SIZE_MAX :-), + If allocation fails, or if the link value is longer than SIZE_MAX :-), return NULL and set errno to ENOMEM. */ char * areadlinkat (int fd, char const *filename) { - /* Allocate the initial buffer on the stack. This way, in the common - case of a symlink of small size, we get away with a single small malloc() - instead of a big malloc() followed by a shrinking realloc(). */ - char initial_buf[INITIAL_BUF_SIZE]; - - char *buffer = initial_buf; - size_t buf_size = sizeof initial_buf; - - while (1) - { - /* Attempt to read the link into the current buffer. */ - ssize_t link_length = readlinkat (fd, filename, buffer, buf_size); - - /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1 - with errno == ERANGE if the buffer is too small. */ - if (link_length < 0 && errno != ERANGE) - { - if (buffer != initial_buf) - { - int saved_errno = errno; - free (buffer); - errno = saved_errno; - } - return NULL; - } - - if ((size_t) link_length < buf_size) - { - buffer[link_length++] = '\0'; - - /* Return it in a chunk of memory as small as possible. */ - if (buffer == initial_buf) - { - buffer = (char *) malloc (link_length); - if (buffer == NULL) - /* errno is ENOMEM. */ - return NULL; - memcpy (buffer, initial_buf, link_length); - } - else - { - /* Shrink buffer before returning it. */ - if ((size_t) link_length < buf_size) - { - char *smaller_buffer = (char *) realloc (buffer, link_length); - - if (smaller_buffer != NULL) - buffer = smaller_buffer; - } - } - return buffer; - } - - if (buffer != initial_buf) - free (buffer); - buf_size *= 2; - if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0)) - { - errno = ENOMEM; - return NULL; - } - buffer = (char *) malloc (buf_size); - if (buffer == NULL) - /* errno is ENOMEM. */ - return NULL; - } + return careadlinkat (fd, filename, NULL, 0, NULL, readlinkat); } #else /* !HAVE_READLINKAT */ diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c new file mode 100644 index 0000000000..15ffe24c0f --- /dev/null +++ b/lib/careadlinkat.c @@ -0,0 +1,175 @@ +/* Read symbolic links into a buffer without size limitation, relative to fd. + + Copyright (C) 2001, 2003-2004, 2007, 2009-2011 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 . */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#include + +#include "careadlinkat.h" + +#include "allocator.h" + +#include +#include +#include +#include +#include + +/* Use the system functions, not the gnulib overrides, because this + module does not depend on GNU or POSIX semantics. */ +#undef malloc +#undef realloc + +/* Define this independently so that stdint.h is not a prerequisite. */ +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif + +#ifndef SSIZE_MAX +# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) +#endif + +#if ! HAVE_READLINKAT +/* Ignore FD. Get the symbolic link value of FILENAME and put it into + BUFFER, with size BUFFER_SIZE. This function acts like readlink + but has readlinkat's signature. */ +ssize_t +careadlinkatcwd (int fd, char const *filename, char *buffer, + size_t buffer_size) +{ + (void) fd; + return readlink (filename, buffer, buffer_size); +} +#endif + +/* A standard allocator. For now, only careadlinkat needs this, but + perhaps it should be moved to the allocator module. */ +static struct allocator const standard_allocator = + { malloc, realloc, free, NULL }; + +/* Assuming the current directory is FD, get the symbolic link value + of FILENAME as a null-terminated string and put it into a buffer. + If FD is AT_FDCWD, FILENAME is interpreted relative to the current + working directory, as in openat. + + If the link is small enough to fit into BUFFER put it there. + BUFFER's size is BUFFER_SIZE, and BUFFER can be null + if BUFFER_SIZE is zero. + + If the link is not small, put it into a dynamically allocated + buffer managed by ALLOC. It is the caller's responsibility to free + the returned value if it is nonnull and is not BUFFER. A null + ALLOC stands for the standard allocator. + + The PREADLINKAT function specifies how to read links. + + If successful, return the buffer address; otherwise return NULL and + set errno. */ + +char * +careadlinkat (int fd, char const *filename, + char *buffer, size_t buffer_size, + struct allocator const *alloc, + ssize_t (*preadlinkat) (int, char const *, char *, size_t)) +{ + char *buf; + size_t buf_size; + size_t buf_size_max = + SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX; + char stack_buf[1024]; + + if (! alloc) + alloc = &standard_allocator; + + if (! buffer_size) + { + /* Allocate the initial buffer on the stack. This way, in the + common case of a symlink of small size, we get away with a + single small malloc() instead of a big malloc() followed by a + shrinking realloc(). */ + buffer = stack_buf; + buffer_size = sizeof stack_buf; + } + + buf = buffer; + buf_size = buffer_size; + + do + { + /* Attempt to read the link into the current buffer. */ + ssize_t link_length = preadlinkat (fd, filename, buf, buf_size); + size_t link_size; + if (link_length < 0) + { + /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1 + with errno == ERANGE if the buffer is too small. */ + int readlinkat_errno = errno; + if (readlinkat_errno != ERANGE) + { + if (buf != buffer) + { + alloc->free (buf); + errno = readlinkat_errno; + } + return NULL; + } + } + + link_size = link_length; + + if (link_size < buf_size) + { + buf[link_size++] = '\0'; + + if (buf == stack_buf) + { + char *b = (char *) alloc->malloc (link_size); + if (! b) + break; + memcpy (b, buf, link_size); + buf = b; + } + else if (link_size < buf_size && buf != buffer && alloc->realloc) + { + /* Shrink BUF before returning it. */ + char *b = (char *) alloc->realloc (buf, link_size); + if (b) + buf = b; + } + + return buf; + } + + if (buf != buffer) + alloc->free (buf); + + if (buf_size <= buf_size_max / 2) + buf_size *= 2; + else if (buf_size < buf_size_max) + buf_size = buf_size_max; + else + break; + buf = (char *) alloc->malloc (buf_size); + } + while (buf); + + if (alloc->die) + alloc->die (); + errno = ENOMEM; + return NULL; +} diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h new file mode 100644 index 0000000000..c5e4bcfc15 --- /dev/null +++ b/lib/careadlinkat.h @@ -0,0 +1,67 @@ +/* Read symbolic links into a buffer without size limitation, relative to fd. + + Copyright (C) 2011 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 . */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#ifndef _GL_CAREADLINKAT_H + +#include +#include + +struct allocator; + +/* Assuming the current directory is FD, get the symbolic link value + of FILENAME as a null-terminated string and put it into a buffer. + If FD is AT_FDCWD, FILENAME is interpreted relative to the current + working directory, as in openat. + + If the link is small enough to fit into BUFFER put it there. + BUFFER's size is BUFFER_SIZE, and BUFFER can be null + if BUFFER_SIZE is zero. + + If the link is not small, put it into a dynamically allocated + buffer managed by ALLOC. It is the caller's responsibility to free + the returned value if it is nonnull and is not BUFFER. + + The PREADLINKAT function specifies how to read links. + + If successful, return the buffer address; otherwise return NULL and + set errno. */ + +char *careadlinkat (int fd, char const *filename, + char *buffer, size_t buffer_size, + struct allocator const *alloc, + ssize_t (*preadlinkat) (int, char const *, + char *, size_t)); + +/* Suitable values for careadlinkat's FD and PREADLINKAT arguments, + when doing a plain readlink. */ +#if HAVE_READLINKAT +# define careadlinkatcwd readlinkat +#else +/* Define AT_FDCWD independently, so that the careadlinkat module does + not depend on the fcntl-h module. The value does not matter, since + careadlinkatcwd ignores it, but we might as well use the same value + as fcntl-h. */ +# ifndef AT_FDCWD +# define AT_FDCWD (-3041965) +# endif +ssize_t careadlinkatcwd (int fd, char const *filename, + char *buffer, size_t buffer_size); +#endif + +#endif /* _GL_CAREADLINKAT_H */ diff --git a/modules/areadlink b/modules/areadlink index 316626994f..daf02325a7 100644 --- a/modules/areadlink +++ b/modules/areadlink @@ -6,10 +6,7 @@ lib/areadlink.h lib/areadlink.c Depends-on: -readlink -ssize_t -stdint -unistd +careadlinkat configure.ac: diff --git a/modules/areadlinkat b/modules/areadlinkat index 072f823bef..0fa753928c 100644 --- a/modules/areadlinkat +++ b/modules/areadlinkat @@ -6,8 +6,7 @@ lib/areadlink.h lib/areadlinkat.c Depends-on: -areadlink -stdint +careadlinkat readlinkat configure.ac: diff --git a/modules/careadlinkat b/modules/careadlinkat new file mode 100644 index 0000000000..670fde08f7 --- /dev/null +++ b/modules/careadlinkat @@ -0,0 +1,27 @@ +Description: +Read symbolic links into a buffer without size limitation, relative to fd. + +Files: +lib/careadlinkat.c +lib/careadlinkat.h +lib/allocator.h + +Depends-on: +readlink +ssize_t +unistd + +configure.ac: +AC_CHECK_FUNCS_ONCE([readlinkat]) + +Makefile.am: +lib_SOURCES += careadlinkat.c + +Include: +"careadlinkat.h" + +License: +LGPLv2+ + +Maintainer: +Paul Eggert, Bruno Haible, Jim Meyering -- cgit v1.2.1 From a2c7be5a2a578bc0b97bcf14e709c458d5f59d7f Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Tue, 5 Apr 2011 22:32:17 +0200 Subject: maint.mk: Don't trigger sc_space_tab check. * top/maint.mk (sc_prohibit_empty_lines_at_EOF): Don't trigger sc_space_tab check. --- ChangeLog | 5 +++++ top/maint.mk | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 96804fa44b..6fc0ef34d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-05 Simon Josefsson + + * top/maint.mk (sc_prohibit_empty_lines_at_EOF): Don't trigger + sc_space_tab check. + 2011-04-05 Paul Eggert areadlink, areadlinkat: rewrite in terms of careadlinkat diff --git a/top/maint.mk b/top/maint.mk index 524b69f470..693e5ab042 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -823,7 +823,7 @@ require_exactly_one_NL_at_EOF_ = \ END { exit defined $$fail } sc_prohibit_empty_lines_at_EOF: @perl -le '$(require_exactly_one_NL_at_EOF_)' $$($(VC_LIST_EXCEPT)) \ - || { echo '$(ME): empty line(s) or no newline at EOF' \ + || { echo '$(ME): empty line(s) or no newline at EOF' \ 1>&2; exit 1; } || :; \ # Make sure we don't use st_blocks. Use ST_NBLOCKS instead. -- cgit v1.2.1 From ffc66485c39214e3aaf41defe27516c7d063d167 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 5 Apr 2011 13:53:20 -0600 Subject: bootstrap: preserve git whitelist item sorting In .gitignore, it is handy to do: /m4/* !/m4/file.m4 to whitelist just file.m4 while ignoring all other files. But ! sorts too early. * build-aux/bootstrap (sort_patterns): New function. (insert_sorted_if_absent): Use it to sink ! lines to the bottom. --- ChangeLog | 6 ++++++ build-aux/bootstrap | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6fc0ef34d7..f932690401 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-05 Eric Blake + + bootstrap: preserve git whitelist item sorting + * build-aux/bootstrap (sort_patterns): New function. + (insert_sorted_if_absent): Use it to sink ! lines to the bottom. + 2011-04-05 Simon Josefsson * top/maint.mk (sc_prohibit_empty_lines_at_EOF): Don't trigger diff --git a/build-aux/bootstrap b/build-aux/bootstrap index f004ad3260..707b491412 100755 --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2011-03-03.12; # UTC +scriptversion=2011-04-05.18; # UTC # Bootstrap this package from checked-out sources. @@ -278,14 +278,29 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then exit 1 fi +# Ensure that lines starting with ! sort last, per gitignore conventions +# for whitelisting exceptions after a more generic blacklist pattern. +sort_patterns() { + sort -u "$@" | sed '/^!/ { + H + d + } + $ { + P + x + s/^\n// + }' +} + # If $STR is not already on a line by itself in $FILE, insert it, # sorting the new contents of the file and replacing $FILE with the result. insert_sorted_if_absent() { file=$1 str=$2 test -f $file || touch $file - echo "$str" | sort -u - $file | cmp - $file > /dev/null \ - || echo "$str" | sort -u - $file -o $file \ + echo "$str" | sort_patterns - $file | cmp - $file > /dev/null \ + || { echo "$str" | sort_patterns - $file > $file.bak \ + && mv $file.bak $file; } \ || exit 1 } -- cgit v1.2.1 From f79652003534e496bca1e49922ca521f12ca8051 Mon Sep 17 00:00:00 2001 From: Bruce Korb Date: Tue, 5 Apr 2011 15:19:13 -0700 Subject: bootstrap: compute gnulib_extra_files after updating build_aux * build-aux/bootstrap (gnulib_extra_files): bootstrap.conf may change build_aux or also supply gnulib_extra_files. Handle correctly. --- ChangeLog | 6 ++++++ build-aux/bootstrap | 25 +++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index f932690401..9fd51161f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-05 Bruce Korb + + bootstrap: compute gnulib_extra_files after updating build_aux + * build-aux/bootstrap (gnulib_extra_files): bootstrap.conf may + change build_aux or also supply gnulib_extra_files. Handle correctly. + 2011-04-05 Eric Blake bootstrap: preserve git whitelist item sorting diff --git a/build-aux/bootstrap b/build-aux/bootstrap index 707b491412..7cbb5dc433 100755 --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -130,18 +130,7 @@ source_base=lib m4_base=m4 doc_base=doc tests_base=tests - -# Extra files from gnulib, which override files from other sources. -gnulib_extra_files=" - $build_aux/install-sh - $build_aux/missing - $build_aux/mdate-sh - $build_aux/texinfo.tex - $build_aux/depcomp - $build_aux/config.guess - $build_aux/config.sub - doc/INSTALL -" +gnulib_extra_files='' # Additional gnulib-tool options to use. Use "\newline" to break lines. gnulib_tool_option_extras= @@ -229,6 +218,18 @@ case "$0" in *) test -r "$0.conf" && . ./"$0.conf" ;; esac +# Extra files from gnulib, which override files from other sources. +test -z "${gnulib_extra_files}" && \ + gnulib_extra_files=" + $build_aux/install-sh + $build_aux/missing + $build_aux/mdate-sh + $build_aux/texinfo.tex + $build_aux/depcomp + $build_aux/config.guess + $build_aux/config.sub + doc/INSTALL +" if test "$vc_ignore" = auto; then vc_ignore= -- cgit v1.2.1 From 31c389096adc4023ecde0c80ac189f9ebb83140e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 6 Apr 2011 01:46:12 +0200 Subject: pipe2: Relicense under LGPLv2+. * modules/pipe2 (License): Change to LGPLv2+. Requested by Eric Blake, for libvirt. --- ChangeLog | 6 ++++++ modules/pipe2 | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9fd51161f7..b8dcd36780 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-05 Bruno Haible + + pipe2: Relicense under LGPLv2+. + * modules/pipe2 (License): Change to LGPLv2+. + Requested by Eric Blake, for libvirt. + 2011-04-05 Bruce Korb bootstrap: compute gnulib_extra_files after updating build_aux diff --git a/modules/pipe2 b/modules/pipe2 index 45813962cb..1183657659 100644 --- a/modules/pipe2 +++ b/modules/pipe2 @@ -22,7 +22,7 @@ Include: License: -LGPL +LGPLv2+ Maintainer: Bruno Haible, Eric Blake -- cgit v1.2.1 From b4b6391081d1173278396afdf098be68b1768752 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 3 Apr 2011 23:07:25 +0200 Subject: Ensure to rebuild generated .h files when config.status has changed. * modules/arpa_inet (Makefile.am): Add dependency from .h file to config.status. * modules/ctype (Makefile.am): Likewise. * modules/dirent (Makefile.am): Likewise. * modules/errno (Makefile.am): Likewise. * modules/fcntl-h (Makefile.am): Likewise. * modules/float (Makefile.am): Likewise. * modules/getopt-posix (Makefile.am): Likewise. * modules/glob (Makefile.am): Likewise. * modules/iconv-h (Makefile.am): Likewise. * modules/inttypes (Makefile.am): Likewise. * modules/langinfo (Makefile.am): Likewise. * modules/locale (Makefile.am): Likewise. * modules/math (Makefile.am): Likewise. * modules/netdb (Makefile.am): Likewise. * modules/netinet_in (Makefile.am): Likewise. * modules/poll-h (Makefile.am): Likewise. * modules/pthread (Makefile.am): Likewise. * modules/pty (Makefile.am): Likewise. * modules/sched (Makefile.am): Likewise. * modules/search (Makefile.am): Likewise. * modules/selinux-h (Makefile.am): Likewise. * modules/signal (Makefile.am): Likewise. * modules/spawn (Makefile.am): Likewise. * modules/stdarg (Makefile.am): Likewise. * modules/stdbool (Makefile.am): Likewise. * modules/stddef (Makefile.am): Likewise. * modules/stdint (Makefile.am): Likewise. * modules/stdio (Makefile.am): Likewise. * modules/stdlib (Makefile.am): Likewise. * modules/string (Makefile.am): Likewise. * modules/strings (Makefile.am): Likewise. * modules/sys_file (Makefile.am): Likewise. * modules/sys_ioctl (Makefile.am): Likewise. * modules/sys_select (Makefile.am): Likewise. * modules/sys_socket (Makefile.am): Likewise. * modules/sys_stat (Makefile.am): Likewise. * modules/sys_time (Makefile.am): Likewise. * modules/sys_times (Makefile.am): Likewise. * modules/sys_utsname (Makefile.am): Likewise. * modules/sys_wait (Makefile.am): Likewise. * modules/sysexits (Makefile.am): Likewise. * modules/termios (Makefile.am): Likewise. * modules/time (Makefile.am): Likewise. * modules/unistd (Makefile.am): Likewise. * modules/wchar (Makefile.am): Likewise. * modules/wctype-h (Makefile.am): Likewise. Reported by Karl Berry, Eric Blake, and Ralf Wildenhues. --- ChangeLog | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ modules/arpa_inet | 2 +- modules/ctype | 2 +- modules/dirent | 2 +- modules/errno | 2 +- modules/fcntl-h | 2 +- modules/float | 2 +- modules/getopt-posix | 2 +- modules/glob | 2 +- modules/iconv-h | 2 +- modules/inttypes | 2 +- modules/langinfo | 2 +- modules/locale | 2 +- modules/math | 2 +- modules/netdb | 2 +- modules/netinet_in | 2 +- modules/poll-h | 2 +- modules/pthread | 2 +- modules/pty | 2 +- modules/sched | 2 +- modules/search | 2 +- modules/selinux-h | 4 ++-- modules/signal | 2 +- modules/spawn | 2 +- modules/stdarg | 2 +- modules/stdbool | 2 +- modules/stddef | 2 +- modules/stdint | 2 +- modules/stdio | 2 +- modules/stdlib | 2 +- modules/string | 2 +- modules/strings | 2 +- modules/sys_file | 2 +- modules/sys_ioctl | 2 +- modules/sys_select | 2 +- modules/sys_socket | 2 +- modules/sys_stat | 2 +- modules/sys_time | 2 +- modules/sys_times | 2 +- modules/sys_utsname | 2 +- modules/sys_wait | 2 +- modules/sysexits | 2 +- modules/termios | 2 +- modules/time | 2 +- modules/unistd | 2 +- modules/wchar | 2 +- modules/wctype-h | 2 +- 47 files changed, 99 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8dcd36780..3dc209bdbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,55 @@ +2011-04-05 Bruno Haible + + Ensure to rebuild generated .h files when config.status has changed. + * modules/arpa_inet (Makefile.am): Add dependency from .h file to + config.status. + * modules/ctype (Makefile.am): Likewise. + * modules/dirent (Makefile.am): Likewise. + * modules/errno (Makefile.am): Likewise. + * modules/fcntl-h (Makefile.am): Likewise. + * modules/float (Makefile.am): Likewise. + * modules/getopt-posix (Makefile.am): Likewise. + * modules/glob (Makefile.am): Likewise. + * modules/iconv-h (Makefile.am): Likewise. + * modules/inttypes (Makefile.am): Likewise. + * modules/langinfo (Makefile.am): Likewise. + * modules/locale (Makefile.am): Likewise. + * modules/math (Makefile.am): Likewise. + * modules/netdb (Makefile.am): Likewise. + * modules/netinet_in (Makefile.am): Likewise. + * modules/poll-h (Makefile.am): Likewise. + * modules/pthread (Makefile.am): Likewise. + * modules/pty (Makefile.am): Likewise. + * modules/sched (Makefile.am): Likewise. + * modules/search (Makefile.am): Likewise. + * modules/selinux-h (Makefile.am): Likewise. + * modules/signal (Makefile.am): Likewise. + * modules/spawn (Makefile.am): Likewise. + * modules/stdarg (Makefile.am): Likewise. + * modules/stdbool (Makefile.am): Likewise. + * modules/stddef (Makefile.am): Likewise. + * modules/stdint (Makefile.am): Likewise. + * modules/stdio (Makefile.am): Likewise. + * modules/stdlib (Makefile.am): Likewise. + * modules/string (Makefile.am): Likewise. + * modules/strings (Makefile.am): Likewise. + * modules/sys_file (Makefile.am): Likewise. + * modules/sys_ioctl (Makefile.am): Likewise. + * modules/sys_select (Makefile.am): Likewise. + * modules/sys_socket (Makefile.am): Likewise. + * modules/sys_stat (Makefile.am): Likewise. + * modules/sys_time (Makefile.am): Likewise. + * modules/sys_times (Makefile.am): Likewise. + * modules/sys_utsname (Makefile.am): Likewise. + * modules/sys_wait (Makefile.am): Likewise. + * modules/sysexits (Makefile.am): Likewise. + * modules/termios (Makefile.am): Likewise. + * modules/time (Makefile.am): Likewise. + * modules/unistd (Makefile.am): Likewise. + * modules/wchar (Makefile.am): Likewise. + * modules/wctype-h (Makefile.am): Likewise. + Reported by Karl Berry, Eric Blake, and Ralf Wildenhues. + 2011-04-05 Bruno Haible pipe2: Relicense under LGPLv2+. diff --git a/modules/arpa_inet b/modules/arpa_inet index 34b988161c..365f36dbb6 100644 --- a/modules/arpa_inet +++ b/modules/arpa_inet @@ -21,7 +21,7 @@ BUILT_SOURCES += arpa/inet.h # We need the following in order to create when the system # doesn't have one. -arpa/inet.h: arpa_inet.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) +arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) arpa $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/ctype b/modules/ctype index f0ec9111b9..8285218784 100644 --- a/modules/ctype +++ b/modules/ctype @@ -18,7 +18,7 @@ BUILT_SOURCES += ctype.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -ctype.h: ctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +ctype.h: ctype.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/dirent b/modules/dirent index 3029d73afc..94f53a9703 100644 --- a/modules/dirent +++ b/modules/dirent @@ -20,7 +20,7 @@ BUILT_SOURCES += dirent.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -dirent.h: dirent.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/errno b/modules/errno index b730071ea7..cae6bbbdc8 100644 --- a/modules/errno +++ b/modules/errno @@ -16,7 +16,7 @@ BUILT_SOURCES += $(ERRNO_H) # We need the following in order to create when the system # doesn't have one that is POSIX compliant. -errno.h: errno.in.h +errno.h: errno.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ diff --git a/modules/fcntl-h b/modules/fcntl-h index c275a4e041..054d15fd88 100644 --- a/modules/fcntl-h +++ b/modules/fcntl-h @@ -22,7 +22,7 @@ BUILT_SOURCES += fcntl.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -fcntl.h: fcntl.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/float b/modules/float index c98853b704..7f56d6c6b8 100644 --- a/modules/float +++ b/modules/float @@ -16,7 +16,7 @@ BUILT_SOURCES += $(FLOAT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -float.h: float.in.h +float.h: float.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ diff --git a/modules/getopt-posix b/modules/getopt-posix index 39b10a40ad..18bad69dac 100644 --- a/modules/getopt-posix +++ b/modules/getopt-posix @@ -23,7 +23,7 @@ BUILT_SOURCES += $(GETOPT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -getopt.h: getopt.in.h $(ARG_NONNULL_H) +getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ diff --git a/modules/glob b/modules/glob index 0caaeefcd7..15f2022076 100644 --- a/modules/glob +++ b/modules/glob @@ -34,7 +34,7 @@ BUILT_SOURCES += $(GLOB_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -glob.h: glob.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +glob.h: glob.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ diff --git a/modules/iconv-h b/modules/iconv-h index df0e070861..7cca5c5ccc 100644 --- a/modules/iconv-h +++ b/modules/iconv-h @@ -19,7 +19,7 @@ BUILT_SOURCES += $(ICONV_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +iconv.h: iconv.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/inttypes b/modules/inttypes index 674d83ebcb..f85939c8f2 100644 --- a/modules/inttypes +++ b/modules/inttypes @@ -21,7 +21,7 @@ BUILT_SOURCES += inttypes.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -inttypes.h: inttypes.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) +inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ diff --git a/modules/langinfo b/modules/langinfo index fd23db9f2a..c2b239a21c 100644 --- a/modules/langinfo +++ b/modules/langinfo @@ -19,7 +19,7 @@ BUILT_SOURCES += langinfo.h # We need the following in order to create an empty placeholder for # when the system doesn't have one. -langinfo.h: langinfo.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \ diff --git a/modules/locale b/modules/locale index 9c350cf817..a565c03b13 100644 --- a/modules/locale +++ b/modules/locale @@ -21,7 +21,7 @@ BUILT_SOURCES += locale.h # We need the following in order to create when the system # doesn't have one that provides all definitions. -locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/math b/modules/math index bcf08c7cdf..6bc0d9ff68 100644 --- a/modules/math +++ b/modules/math @@ -19,7 +19,7 @@ BUILT_SOURCES += math.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_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_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \ diff --git a/modules/netdb b/modules/netdb index 9b95a6ecf4..97c40bcce3 100644 --- a/modules/netdb +++ b/modules/netdb @@ -19,7 +19,7 @@ BUILT_SOURCES += netdb.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -netdb.h: netdb.in.h $(ARG_NONNULL_H) $(WARN_ON_USE_H) +netdb.h: netdb.in.h $(top_builddir)/config.status $(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' \ diff --git a/modules/netinet_in b/modules/netinet_in index 06df756a81..b52aa4d9c1 100644 --- a/modules/netinet_in +++ b/modules/netinet_in @@ -18,7 +18,7 @@ BUILT_SOURCES += $(NETINET_IN_H) # We need the following in order to create when the system # doesn't have one. -netinet/in.h: netinet_in.in.h +netinet/in.h: netinet_in.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) netinet $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/poll-h b/modules/poll-h index 347fc607f0..8673fe412a 100644 --- a/modules/poll-h +++ b/modules/poll-h @@ -19,7 +19,7 @@ BUILT_SOURCES += poll.h # We need the following in order to create when the system # doesn't have one. -poll.h: poll.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +poll.h: poll.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_POLL_H''@|$(HAVE_POLL_H)|g' \ diff --git a/modules/pthread b/modules/pthread index e29016a447..2a729397aa 100644 --- a/modules/pthread +++ b/modules/pthread @@ -17,7 +17,7 @@ BUILT_SOURCES += $(PTHREAD_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -pthread.h: pthread.in.h +pthread.h: pthread.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \ diff --git a/modules/pty b/modules/pty index 93f280ca9f..8be8e02e52 100644 --- a/modules/pty +++ b/modules/pty @@ -18,7 +18,7 @@ BUILT_SOURCES += pty.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -pty.h: pty.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +pty.h: pty.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_PTY_H''@|$(HAVE_PTY_H)|g' \ diff --git a/modules/sched b/modules/sched index d126fc7616..ac17479a0d 100644 --- a/modules/sched +++ b/modules/sched @@ -16,7 +16,7 @@ BUILT_SOURCES += $(SCHED_H) # We need the following in order to create a replacement for when # the system doesn't have one. -sched.h: sched.in.h +sched.h: sched.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SCHED_H''@|$(HAVE_SCHED_H)|g' \ diff --git a/modules/search b/modules/search index ceed3ffedb..4650d3191a 100644 --- a/modules/search +++ b/modules/search @@ -19,7 +19,7 @@ BUILT_SOURCES += search.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -search.h: search.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +search.h: search.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''HAVE_SEARCH_H''@|$(HAVE_SEARCH_H)|g' \ diff --git a/modules/selinux-h b/modules/selinux-h index 745ea4950d..7df7c5a0fc 100644 --- a/modules/selinux-h +++ b/modules/selinux-h @@ -21,7 +21,7 @@ Makefile.am: lib_SOURCES += se-context.in.h se-selinux.in.h BUILT_SOURCES += selinux/selinux.h -selinux/selinux.h: se-selinux.in.h $(UNUSED_PARAMETER_H) +selinux/selinux.h: se-selinux.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H) $(AM_V_at)$(MKDIR_P) selinux $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @@ -37,7 +37,7 @@ selinux/selinux.h: se-selinux.in.h $(UNUSED_PARAMETER_H) MOSTLYCLEANFILES += selinux/selinux.h selinux/selinux.h-t BUILT_SOURCES += $(SELINUX_CONTEXT_H) -selinux/context.h: se-context.in.h $(UNUSED_PARAMETER_H) +selinux/context.h: se-context.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H) $(AM_V_at)$(MKDIR_P) selinux $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ diff --git a/modules/signal b/modules/signal index c9ff197bbe..29b7af3cf1 100644 --- a/modules/signal +++ b/modules/signal @@ -19,7 +19,7 @@ BUILT_SOURCES += signal.h # We need the following in order to create when the system # doesn't have a complete one. -signal.h: signal.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/spawn b/modules/spawn index 61e5e073ed..f133422cbc 100644 --- a/modules/spawn +++ b/modules/spawn @@ -20,7 +20,7 @@ BUILT_SOURCES += spawn.h # We need the following in order to create a replacement for when # the system doesn't have one. -spawn.h: spawn.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +spawn.h: spawn.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SPAWN_H''@|$(HAVE_SPAWN_H)|g' \ diff --git a/modules/stdarg b/modules/stdarg index 05a01db69b..10ac474106 100644 --- a/modules/stdarg +++ b/modules/stdarg @@ -23,7 +23,7 @@ BUILT_SOURCES += $(STDARG_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdarg.h: stdarg.in.h +stdarg.h: stdarg.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ diff --git a/modules/stdbool b/modules/stdbool index 80fe2db8d5..7df3cc5217 100644 --- a/modules/stdbool +++ b/modules/stdbool @@ -16,7 +16,7 @@ BUILT_SOURCES += $(STDBOOL_H) # We need the following in order to create when the system # doesn't have one that works. -stdbool.h: stdbool.in.h +stdbool.h: stdbool.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ diff --git a/modules/stddef b/modules/stddef index 4836bc7a8f..23a6fb56af 100644 --- a/modules/stddef +++ b/modules/stddef @@ -17,7 +17,7 @@ BUILT_SOURCES += $(STDDEF_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stddef.h: stddef.in.h +stddef.h: stddef.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ diff --git a/modules/stdint b/modules/stdint index 45b02d453e..2878da6d32 100644 --- a/modules/stdint +++ b/modules/stdint @@ -23,7 +23,7 @@ BUILT_SOURCES += $(STDINT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdint.h: stdint.in.h +stdint.h: stdint.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ diff --git a/modules/stdio b/modules/stdio index 2e6c7268d5..db0790ff00 100644 --- a/modules/stdio +++ b/modules/stdio @@ -20,7 +20,7 @@ BUILT_SOURCES += stdio.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/stdlib b/modules/stdlib index d666be7f89..a24a593039 100644 --- a/modules/stdlib +++ b/modules/stdlib @@ -21,7 +21,7 @@ BUILT_SOURCES += stdlib.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/string b/modules/string index 78ad32448b..9b3e9f0fb8 100644 --- a/modules/string +++ b/modules/string @@ -21,7 +21,7 @@ BUILT_SOURCES += string.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/strings b/modules/strings index 9b7a48e0f2..6019f5dc9d 100644 --- a/modules/strings +++ b/modules/strings @@ -18,7 +18,7 @@ BUILT_SOURCES += strings.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -strings.h: strings.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) +strings.h: strings.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ diff --git a/modules/sys_file b/modules/sys_file index 1da1655b45..fdfba45ddb 100644 --- a/modules/sys_file +++ b/modules/sys_file @@ -18,7 +18,7 @@ BUILT_SOURCES += sys/file.h # We need the following in order to create when the system # has one that is incomplete. -sys/file.h: sys_file.in.h $(WARN_ON_USE_H) +sys/file.h: sys_file.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/sys_ioctl b/modules/sys_ioctl index 669f70b084..d0130dafa6 100644 --- a/modules/sys_ioctl +++ b/modules/sys_ioctl @@ -20,7 +20,7 @@ BUILT_SOURCES += sys/ioctl.h # We need the following in order to create when the system # does not have a complete one. -sys/ioctl.h: sys_ioctl.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +sys/ioctl.h: sys_ioctl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/sys_select b/modules/sys_select index 3fbbd57f4d..79a8581105 100644 --- a/modules/sys_select +++ b/modules/sys_select @@ -21,7 +21,7 @@ BUILT_SOURCES += sys/select.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -sys/select.h: sys_select.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/sys_socket b/modules/sys_socket index 775996fc94..0e9fb4e3f6 100644 --- a/modules/sys_socket +++ b/modules/sys_socket @@ -24,7 +24,7 @@ BUILT_SOURCES += sys/socket.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -sys/socket.h: sys_socket.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) +sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/sys_stat b/modules/sys_stat index 40bcf6d6d2..7971617570 100644 --- a/modules/sys_stat +++ b/modules/sys_stat @@ -22,7 +22,7 @@ BUILT_SOURCES += sys/stat.h # We need the following in order to create when the system # has one that is incomplete. -sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/sys_time b/modules/sys_time index 92f2ebbf35..b2c3914231 100644 --- a/modules/sys_time +++ b/modules/sys_time @@ -20,7 +20,7 @@ BUILT_SOURCES += sys/time.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -sys/time.h: sys_time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/sys_times b/modules/sys_times index 7a543b420d..5905285b3f 100644 --- a/modules/sys_times +++ b/modules/sys_times @@ -19,7 +19,7 @@ BUILT_SOURCES += sys/times.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -sys/times.h: sys_times.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) +sys/times.h: sys_times.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/sys_utsname b/modules/sys_utsname index 4dec661ec8..0bfafd4042 100644 --- a/modules/sys_utsname +++ b/modules/sys_utsname @@ -19,7 +19,7 @@ BUILT_SOURCES += sys/utsname.h # We need the following in order to create when the system # does not have one. -sys/utsname.h: sys_utsname.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) +sys/utsname.h: sys_utsname.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/sys_wait b/modules/sys_wait index 0299f9e2de..a6395e4e47 100644 --- a/modules/sys_wait +++ b/modules/sys_wait @@ -19,7 +19,7 @@ BUILT_SOURCES += sys/wait.h # We need the following in order to create when the system # has one that is incomplete. -sys/wait.h: sys_wait.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +sys/wait.h: sys_wait.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/modules/sysexits b/modules/sysexits index fc47260f98..616ddb9dae 100644 --- a/modules/sysexits +++ b/modules/sysexits @@ -16,7 +16,7 @@ BUILT_SOURCES += $(SYSEXITS_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -sysexits.h: sysexits.in.h +sysexits.h: sysexits.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SYSEXITS_H''@|$(HAVE_SYSEXITS_H)|g' \ diff --git a/modules/termios b/modules/termios index 09539f6118..ec3f6fc5d3 100644 --- a/modules/termios +++ b/modules/termios @@ -18,7 +18,7 @@ BUILT_SOURCES += termios.h # We need the following in order to create when the system # version does not have all declarations. -termios.h: termios.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +termios.h: termios.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/time b/modules/time index ab5efe913f..9660144fb4 100644 --- a/modules/time +++ b/modules/time @@ -21,7 +21,7 @@ BUILT_SOURCES += time.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/unistd b/modules/unistd index fbff1001ac..f6774ce96f 100644 --- a/modules/unistd +++ b/modules/unistd @@ -20,7 +20,7 @@ BUILT_SOURCES += unistd.h # We need the following in order to create an empty placeholder for # when the system doesn't have one. -unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ diff --git a/modules/wchar b/modules/wchar index 06ee6abd2c..855d18db38 100644 --- a/modules/wchar +++ b/modules/wchar @@ -21,7 +21,7 @@ BUILT_SOURCES += wchar.h # We need the following in order to create when the system # version does not work standalone. -wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ diff --git a/modules/wctype-h b/modules/wctype-h index f0d7989fd5..30c5ceaeed 100644 --- a/modules/wctype-h +++ b/modules/wctype-h @@ -19,7 +19,7 @@ BUILT_SOURCES += wctype.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -wctype.h: wctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ -- cgit v1.2.1 From 76d82d2d7f5ba1a69da6aaa71ff170f5a90a6c94 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 6 Apr 2011 01:55:16 +0200 Subject: Remove leftover generated .h files after config.status changed. * m4/alloca.m4 (gl_FUNC_ALLOCA): New automake conditional GL_GENERATE_ALLOCA_H. * modules/alloca-opt (Makefile.am): Remove alloca.h if GL_GENERATE_ALLOCA_H evaluates to false. * m4/argz.m4 (gl_FUNC_ARGZ): New automake conditional GL_GENERATE_ARGZ_H. * modules/argz (Makefile.am): Remove argz.h if GL_GENERATE_ARGZ_H evaluates to false. * m4/byteswap.m4 (gl_BYTESWAP): New automake conditional GL_GENERATE_BYTESWAP_H. * modules/byteswap (Makefile.am): Remove byteswap.h if GL_GENERATE_BYTESWAP_H evaluates to false. * m4/errno_h.m4 (gl_HEADER_ERRNO_H): New automake conditional GL_GENERATE_ERRNO_H. * modules/errno (Makefile.am): Remove errno.h if GL_GENERATE_ERRNO_H evaluates to false. * m4/float_h.m4 (gl_FLOAT_H): New automake conditional GL_GENERATE_FLOAT_H. * modules/float (Makefile.am): Remove float.h if GL_GENERATE_FLOAT_H evaluates to false. * m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): New automake conditional GL_GENERATE_FNMATCH_H. * modules/fnmatch (Makefile.am): Remove fnmatch.h if GL_GENERATE_FNMATCH_H evaluates to false. * m4/glob.m4 (gl_GLOB_SUBSTITUTE, gl_GLOB): New automake conditional GL_GENERATE_GLOB_H. * modules/glob (Makefile.am): Remove glob.h if GL_GENERATE_GLOB_H evaluates to false. * m4/iconv_h.m4 (gl_REPLACE_ICONV_H, gl_ICONV_H_DEFAULTS): New automake conditional GL_GENERATE_ICONV_H. * modules/iconv-h (Makefile.am): Remove iconv.h if GL_GENERATE_ICONV_H evaluates to false. * m4/netinet_in_h.m4 (gl_HEADER_NETINET_IN): New automake conditional GL_GENERATE_NETINET_IN_H. * modules/netinet_in (Makefile.am): Remove netinet/in.h if GL_GENERATE_NETINET_IN_H evaluates to false. * m4/pthread.m4 (gl_PTHREAD_CHECK): Set PTHREAD_H here. New automake conditional GL_GENERATE_PTHREAD_H. (gl_PTHREAD_DEFAULTS): Don't set PTHREAD_H here. * modules/pthread (Makefile.am): Remove pthread.h if GL_GENERATE_PTHREAD_H evaluates to false. * m4/sched_h.m4 (gl_SCHED_H): New automake conditional GL_GENERATE_SCHED_H. * modules/sched (Makefile.am): Remove sched.h if GL_GENERATE_SCHED_H evaluates to false. * m4/selinux-context-h.m4 (gl_HEADERS_SELINUX_CONTEXT_H): New automake conditional GL_GENERATE_SELINUX_CONTEXT_H. * modules/selinux-h (Makefile.am): Remove selinux/context.h if GL_GENERATE_SELINUX_CONTEXT_H evaluates to false. * m4/stdarg.m4 (gl_STDARG_H): New automake conditional GL_GENERATE_STDARG_H. * modules/stdarg (Makefile.am): Remove stdarg.h if GL_GENERATE_STDARG_H evaluates to false. * m4/stdbool.m4 (AM_STDBOOL_H): New automake conditional GL_GENERATE_STDBOOL_H. * modules/stdbool (Makefile.am): Remove stdbool.h if GL_GENERATE_STDBOOL_H evaluates to false. * m4/stddef_h.m4 (gl_STDDEF_H): Set STDDEF_H here. New automake conditional GL_GENERATE_STDDEF_H. (gl_STDDEF_H_DEFAULTS): Don't set STDDEF_H here. * modules/stddef (Makefile.am): Remove stddef.h if GL_GENERATE_STDDEF_H evaluates to false. * m4/stdint.m4 (gl_STDINT_H): New automake conditional GL_GENERATE_STDINT_H. * modules/stdint (Makefile.am): Remove stdint.h if GL_GENERATE_STDINT_H evaluates to false. * m4/sysexits.m4 (gl_SYSEXITS): New automake conditional GL_GENERATE_SYSEXITS_H. * modules/sysexits (Makefile.am): Remove sysexits.h if GL_GENERATE_SYSEXITS_H evaluates to false. Reported by Karl Berry and Ralf Wildenhues. --- ChangeLog | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ m4/alloca.m4 | 3 +- m4/argz.m4 | 3 +- m4/byteswap.m4 | 3 +- m4/errno_h.m4 | 3 +- m4/float_h.m4 | 3 +- m4/fnmatch.m4 | 3 +- m4/glob.m4 | 10 ++++-- m4/iconv_h.m4 | 4 ++- m4/netinet_in_h.m4 | 3 +- m4/pthread.m4 | 5 ++- m4/sched_h.m4 | 3 +- m4/selinux-context-h.m4 | 3 +- m4/stdarg.m4 | 9 +++-- m4/stdbool.m4 | 3 +- m4/stddef_h.m4 | 6 ++-- m4/stdint.m4 | 3 +- m4/sysexits.m4 | 3 +- modules/alloca-opt | 7 +++- modules/argz | 7 +++- modules/byteswap | 7 +++- modules/errno | 5 +++ modules/float | 5 +++ modules/fnmatch | 7 +++- modules/glob | 5 +++ modules/iconv-h | 5 +++ modules/netinet_in | 5 +++ modules/pthread | 5 +++ modules/sched | 5 +++ modules/selinux-h | 5 +++ modules/stdarg | 5 +++ modules/stdbool | 5 +++ modules/stddef | 5 +++ modules/stdint | 5 +++ modules/sysexits | 5 +++ 35 files changed, 230 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3dc209bdbb..7ac5798026 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,96 @@ +2011-04-05 Bruno Haible + + Remove leftover generated .h files after config.status changed. + + * m4/alloca.m4 (gl_FUNC_ALLOCA): New automake conditional + GL_GENERATE_ALLOCA_H. + * modules/alloca-opt (Makefile.am): Remove alloca.h if + GL_GENERATE_ALLOCA_H evaluates to false. + + * m4/argz.m4 (gl_FUNC_ARGZ): New automake conditional + GL_GENERATE_ARGZ_H. + * modules/argz (Makefile.am): Remove argz.h if GL_GENERATE_ARGZ_H + evaluates to false. + + * m4/byteswap.m4 (gl_BYTESWAP): New automake conditional + GL_GENERATE_BYTESWAP_H. + * modules/byteswap (Makefile.am): Remove byteswap.h if + GL_GENERATE_BYTESWAP_H evaluates to false. + + * m4/errno_h.m4 (gl_HEADER_ERRNO_H): New automake conditional + GL_GENERATE_ERRNO_H. + * modules/errno (Makefile.am): Remove errno.h if GL_GENERATE_ERRNO_H + evaluates to false. + + * m4/float_h.m4 (gl_FLOAT_H): New automake conditional + GL_GENERATE_FLOAT_H. + * modules/float (Makefile.am): Remove float.h if GL_GENERATE_FLOAT_H + evaluates to false. + + * m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): New automake conditional + GL_GENERATE_FNMATCH_H. + * modules/fnmatch (Makefile.am): Remove fnmatch.h if + GL_GENERATE_FNMATCH_H evaluates to false. + + * m4/glob.m4 (gl_GLOB_SUBSTITUTE, gl_GLOB): New automake conditional + GL_GENERATE_GLOB_H. + * modules/glob (Makefile.am): Remove glob.h if GL_GENERATE_GLOB_H + evaluates to false. + + * m4/iconv_h.m4 (gl_REPLACE_ICONV_H, gl_ICONV_H_DEFAULTS): New + automake conditional GL_GENERATE_ICONV_H. + * modules/iconv-h (Makefile.am): Remove iconv.h if GL_GENERATE_ICONV_H + evaluates to false. + + * m4/netinet_in_h.m4 (gl_HEADER_NETINET_IN): New automake conditional + GL_GENERATE_NETINET_IN_H. + * modules/netinet_in (Makefile.am): Remove netinet/in.h if + GL_GENERATE_NETINET_IN_H evaluates to false. + + * m4/pthread.m4 (gl_PTHREAD_CHECK): Set PTHREAD_H here. New automake + conditional GL_GENERATE_PTHREAD_H. + (gl_PTHREAD_DEFAULTS): Don't set PTHREAD_H here. + * modules/pthread (Makefile.am): Remove pthread.h if + GL_GENERATE_PTHREAD_H evaluates to false. + + * m4/sched_h.m4 (gl_SCHED_H): New automake conditional + GL_GENERATE_SCHED_H. + * modules/sched (Makefile.am): Remove sched.h if GL_GENERATE_SCHED_H + evaluates to false. + + * m4/selinux-context-h.m4 (gl_HEADERS_SELINUX_CONTEXT_H): New automake + conditional GL_GENERATE_SELINUX_CONTEXT_H. + * modules/selinux-h (Makefile.am): Remove selinux/context.h if + GL_GENERATE_SELINUX_CONTEXT_H evaluates to false. + + * m4/stdarg.m4 (gl_STDARG_H): New automake conditional + GL_GENERATE_STDARG_H. + * modules/stdarg (Makefile.am): Remove stdarg.h if + GL_GENERATE_STDARG_H evaluates to false. + + * m4/stdbool.m4 (AM_STDBOOL_H): New automake conditional + GL_GENERATE_STDBOOL_H. + * modules/stdbool (Makefile.am): Remove stdbool.h if + GL_GENERATE_STDBOOL_H evaluates to false. + + * m4/stddef_h.m4 (gl_STDDEF_H): Set STDDEF_H here. New automake + conditional GL_GENERATE_STDDEF_H. + (gl_STDDEF_H_DEFAULTS): Don't set STDDEF_H here. + * modules/stddef (Makefile.am): Remove stddef.h if + GL_GENERATE_STDDEF_H evaluates to false. + + * m4/stdint.m4 (gl_STDINT_H): New automake conditional + GL_GENERATE_STDINT_H. + * modules/stdint (Makefile.am): Remove stdint.h if + GL_GENERATE_STDINT_H evaluates to false. + + * m4/sysexits.m4 (gl_SYSEXITS): New automake conditional + GL_GENERATE_SYSEXITS_H. + * modules/sysexits (Makefile.am): Remove sysexits.h if + GL_GENERATE_SYSEXITS_H evaluates to false. + + Reported by Karl Berry and Ralf Wildenhues. + 2011-04-05 Bruno Haible Ensure to rebuild generated .h files when config.status has changed. diff --git a/m4/alloca.m4 b/m4/alloca.m4 index e2e8a05a6e..689da75a2a 100644 --- a/m4/alloca.m4 +++ b/m4/alloca.m4 @@ -1,4 +1,4 @@ -# alloca.m4 serial 10 +# alloca.m4 serial 11 dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -36,6 +36,7 @@ AC_DEFUN([gl_FUNC_ALLOCA], ALLOCA_H=alloca.h fi AC_SUBST([ALLOCA_H]) + AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) ]) # Prerequisites of lib/alloca.c. diff --git a/m4/argz.m4 b/m4/argz.m4 index f4fa3a0da0..0248a453da 100644 --- a/m4/argz.m4 +++ b/m4/argz.m4 @@ -7,7 +7,7 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 8 argz.m4 +# serial 9 argz.m4 AC_DEFUN([gl_FUNC_ARGZ], [gl_PREREQ_ARGZ @@ -74,6 +74,7 @@ AS_IF([test -z "$ARGZ_H"], AC_LIBOBJ([argz])])]) AC_SUBST([ARGZ_H]) +AM_CONDITIONAL([GL_GENERATE_ARGZ_H], [test -n "$ARGZ_H"]) ]) # Prerequisites of lib/argz.c. diff --git a/m4/byteswap.m4 b/m4/byteswap.m4 index a033acd8da..2d4de4659f 100644 --- a/m4/byteswap.m4 +++ b/m4/byteswap.m4 @@ -1,4 +1,4 @@ -# byteswap.m4 serial 3 +# byteswap.m4 serial 4 dnl Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,4 +15,5 @@ AC_DEFUN([gl_BYTESWAP], BYTESWAP_H='byteswap.h' ]) AC_SUBST([BYTESWAP_H]) + AM_CONDITIONAL([GL_GENERATE_BYTESWAP_H], [test -n "$BYTESWAP_H"]) ]) diff --git a/m4/errno_h.m4 b/m4/errno_h.m4 index 687bafff2d..a6d37f3b32 100644 --- a/m4/errno_h.m4 +++ b/m4/errno_h.m4 @@ -1,4 +1,4 @@ -# errno_h.m4 serial 8 +# errno_h.m4 serial 9 dnl Copyright (C) 2004, 2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -54,6 +54,7 @@ booboo ERRNO_H='errno.h' fi AC_SUBST([ERRNO_H]) + AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"]) gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) gl_REPLACE_ERRNO_VALUE([ENOLINK]) gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) diff --git a/m4/float_h.m4 b/m4/float_h.m4 index 265a4c1a6e..21a7529fe0 100644 --- a/m4/float_h.m4 +++ b/m4/float_h.m4 @@ -1,4 +1,4 @@ -# float_h.m4 serial 5 +# float_h.m4 serial 6 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -16,4 +16,5 @@ AC_DEFUN([gl_FLOAT_H], ;; esac AC_SUBST([FLOAT_H]) + AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"]) ]) diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4 index 9b537a7e0c..c8ed9e74e7 100644 --- a/m4/fnmatch.m4 +++ b/m4/fnmatch.m4 @@ -1,4 +1,4 @@ -# Check for fnmatch - serial 5. +# Check for fnmatch - serial 6. # Copyright (C) 2000-2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -139,6 +139,7 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX], AC_CHECK_HEADERS_ONCE([wctype.h]) fi AC_SUBST([FNMATCH_H]) + AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"]) ]) # Request a POSIX compliant fnmatch function with GNU extensions. diff --git a/m4/glob.m4 b/m4/glob.m4 index 759c6f84f7..4b79148d32 100644 --- a/m4/glob.m4 +++ b/m4/glob.m4 @@ -1,4 +1,4 @@ -# glob.m4 serial 11 +# glob.m4 serial 12 dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,11 +10,12 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_GLOB_SUBSTITUTE], [ + AC_LIBOBJ([glob]) gl_PREREQ_GLOB GLOB_H=glob.h - AC_LIBOBJ([glob]) AC_SUBST([GLOB_H]) + AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"]) ]) AC_DEFUN([gl_GLOB], @@ -65,8 +66,11 @@ if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) return 1;]])], rm -f conf$$-globtest if test -n "$GLOB_H"; then - gl_GLOB_SUBSTITUTE + AC_LIBOBJ([glob]) + gl_PREREQ_GLOB fi + AC_SUBST([GLOB_H]) + AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"]) ]) # Prerequisites of lib/glob.*. diff --git a/m4/iconv_h.m4 b/m4/iconv_h.m4 index abfacffb49..8cca7fd802 100644 --- a/m4/iconv_h.m4 +++ b/m4/iconv_h.m4 @@ -1,4 +1,4 @@ -# iconv_h.m4 serial 7 +# iconv_h.m4 serial 8 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,6 +18,7 @@ AC_DEFUN([gl_REPLACE_ICONV_H], [ AC_REQUIRE([gl_ICONV_H_DEFAULTS]) ICONV_H='iconv.h' + AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"]) ]) AC_DEFUN([gl_ICONV_MODULE_INDICATOR], @@ -36,4 +37,5 @@ AC_DEFUN([gl_ICONV_H_DEFAULTS], REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN]) REPLACE_ICONV_UTF=0; AC_SUBST([REPLACE_ICONV_UTF]) ICONV_H=''; AC_SUBST([ICONV_H]) + AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"]) ]) diff --git a/m4/netinet_in_h.m4 b/m4/netinet_in_h.m4 index e2d022df7a..87235b73bc 100644 --- a/m4/netinet_in_h.m4 +++ b/m4/netinet_in_h.m4 @@ -1,4 +1,4 @@ -# netinet_in_h.m4 serial 4 +# netinet_in_h.m4 serial 5 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -27,4 +27,5 @@ AC_DEFUN([gl_HEADER_NETINET_IN], AC_SUBST([HAVE_NETINET_IN_H]) fi AC_SUBST([NETINET_IN_H]) + AM_CONDITIONAL([GL_GENERATE_NETINET_IN_H], [test -n "$NETINET_IN_H"]) ]) diff --git a/m4/pthread.m4 b/m4/pthread.m4 index 9f77cde093..6111185fb0 100644 --- a/m4/pthread.m4 +++ b/m4/pthread.m4 @@ -30,7 +30,11 @@ AC_DEFUN([gl_PTHREAD_CHECK], test $ac_cv_type_pthread_t != yes || test $ac_cv_type_pthread_spinlock_t != yes; then PTHREAD_H='pthread.h' + else + PTHREAD_H= fi + AC_SUBST([PTHREAD_H]) + AM_CONDITIONAL([GL_GENERATE_PTHREAD_H], [test -n "$PTHREAD_H"]) LIB_PTHREAD= if test $ac_cv_header_pthread_h = yes; then @@ -53,5 +57,4 @@ AC_DEFUN([gl_PTHREAD_DEFAULTS], HAVE_PTHREAD_H=1; AC_SUBST([HAVE_PTHREAD_H]) HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T]) HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T]) - PTHREAD_H=''; AC_SUBST([PTHREAD_H]) ]) diff --git a/m4/sched_h.m4 b/m4/sched_h.m4 index 6a46e4745f..9cff891950 100644 --- a/m4/sched_h.m4 +++ b/m4/sched_h.m4 @@ -1,4 +1,4 @@ -# sched_h.m4 serial 3 +# sched_h.m4 serial 4 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,4 +32,5 @@ AC_DEFUN([gl_SCHED_H], AC_SUBST([HAVE_STRUCT_SCHED_PARAM]) ]) AC_SUBST([SCHED_H]) + AM_CONDITIONAL([GL_GENERATE_SCHED_H], [test -n "$SCHED_H"]) ]) diff --git a/m4/selinux-context-h.m4 b/m4/selinux-context-h.m4 index 227ab6bfc7..54a388db75 100644 --- a/m4/selinux-context-h.m4 +++ b/m4/selinux-context-h.m4 @@ -1,4 +1,4 @@ -# serial 2 -*- Autoconf -*- +# serial 3 -*- Autoconf -*- # Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -18,4 +18,5 @@ AC_DEFUN([gl_HEADERS_SELINUX_CONTEXT_H], SELINUX_CONTEXT_H=selinux/context.h fi AC_SUBST([SELINUX_CONTEXT_H]) + AM_CONDITIONAL([GL_GENERATE_SELINUX_CONTEXT_H], [test -n "$SELINUX_CONTEXT_H"]) ]) diff --git a/m4/stdarg.m4 b/m4/stdarg.m4 index a1ef178c55..5705de9eca 100644 --- a/m4/stdarg.m4 +++ b/m4/stdarg.m4 @@ -1,4 +1,4 @@ -# stdarg.m4 serial 5 +# stdarg.m4 serial 6 dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,8 +9,8 @@ dnl Provide a working va_copy in combination with . AC_DEFUN([gl_STDARG_H], [ - STDARG_H=''; AC_SUBST([STDARG_H]) - NEXT_STDARG_H=''; AC_SUBST([NEXT_STDARG_H]) + STDARG_H='' + NEXT_STDARG_H='' AC_MSG_CHECKING([for va_copy]) AC_CACHE_VAL([gl_cv_func_va_copy], [ AC_COMPILE_IFELSE( @@ -72,4 +72,7 @@ error, bail out fi fi fi + AC_SUBST([STDARG_H]) + AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"]) + AC_SUBST([NEXT_STDARG_H]) ]) diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 index 838cf0f467..1ebf3e6808 100644 --- a/m4/stdbool.m4 +++ b/m4/stdbool.m4 @@ -5,7 +5,7 @@ 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. -#serial 4 +#serial 5 # Prepare for substituting if it is not supported. @@ -21,6 +21,7 @@ AC_DEFUN([AM_STDBOOL_H], STDBOOL_H='stdbool.h' fi AC_SUBST([STDBOOL_H]) + AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) if test "$ac_cv_type__Bool" = yes; then HAVE__BOOL=1 diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4 index 1942b6aa0d..1ae2344318 100644 --- a/m4/stddef_h.m4 +++ b/m4/stddef_h.m4 @@ -1,5 +1,5 @@ dnl A placeholder for POSIX 2008 , for platforms that have issues. -# stddef_h.m4 serial 3 +# stddef_h.m4 serial 4 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,6 +9,7 @@ AC_DEFUN([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) + STDDEF_H= if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h @@ -24,6 +25,8 @@ AC_DEFUN([gl_STDDEF_H], REPLACE_NULL=1 STDDEF_H=stddef.h fi + AC_SUBST([STDDEF_H]) + AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) if test -n "$STDDEF_H"; then gl_NEXT_HEADERS([stddef.h]) fi @@ -41,5 +44,4 @@ AC_DEFUN([gl_STDDEF_H_DEFAULTS], dnl Assume proper GNU behavior unless another module says otherwise. REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) - STDDEF_H=''; AC_SUBST([STDDEF_H]) ]) diff --git a/m4/stdint.m4 b/m4/stdint.m4 index e7d0d0765a..dff37fe1bf 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 39 +# stdint.m4 serial 40 dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -305,6 +305,7 @@ static const char *macro_values[] = STDINT_H=stdint.h fi AC_SUBST([STDINT_H]) + AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) ]) dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) diff --git a/m4/sysexits.m4 b/m4/sysexits.m4 index 4d14572278..cff6606c6e 100644 --- a/m4/sysexits.m4 +++ b/m4/sysexits.m4 @@ -1,4 +1,4 @@ -# sysexits.m4 serial 5 +# sysexits.m4 serial 6 dnl Copyright (C) 2003, 2005, 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -40,4 +40,5 @@ AC_DEFUN([gl_SYSEXITS], fi AC_SUBST([HAVE_SYSEXITS_H]) AC_SUBST([SYSEXITS_H]) + AM_CONDITIONAL([GL_GENERATE_SYSEXITS_H], [test -n "$SYSEXITS_H"]) ]) diff --git a/modules/alloca-opt b/modules/alloca-opt index 9ced93b293..d4468de5cf 100644 --- a/modules/alloca-opt +++ b/modules/alloca-opt @@ -17,12 +17,17 @@ BUILT_SOURCES += $(ALLOCA_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -alloca.h: alloca.in.h +if GL_GENERATE_ALLOCA_H +alloca.h: alloca.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/alloca.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +alloca.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += alloca.h alloca.h-t Include: diff --git a/modules/argz b/modules/argz index 5f9c7499d1..0c56ac7685 100644 --- a/modules/argz +++ b/modules/argz @@ -22,12 +22,17 @@ BUILT_SOURCES += $(ARGZ_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -argz.h: argz.in.h +if GL_GENERATE_ARGZ_H +argz.h: argz.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/argz.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +argz.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += argz.h argz.h-t Include: diff --git a/modules/byteswap b/modules/byteswap index 6a3ce1525c..c1da40074c 100644 --- a/modules/byteswap +++ b/modules/byteswap @@ -15,12 +15,17 @@ BUILT_SOURCES += $(BYTESWAP_H) # We need the following in order to create when the system # doesn't have one. -byteswap.h: byteswap.in.h +if GL_GENERATE_BYTESWAP_H +byteswap.h: byteswap.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/byteswap.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +byteswap.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += byteswap.h byteswap.h-t Include: diff --git a/modules/errno b/modules/errno index cae6bbbdc8..9516901553 100644 --- a/modules/errno +++ b/modules/errno @@ -16,6 +16,7 @@ BUILT_SOURCES += $(ERRNO_H) # We need the following in order to create when the system # doesn't have one that is POSIX compliant. +if GL_GENERATE_ERRNO_H errno.h: errno.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @@ -32,6 +33,10 @@ errno.h: errno.in.h $(top_builddir)/config.status < $(srcdir)/errno.in.h; \ } > $@-t && \ mv $@-t $@ +else +errno.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += errno.h errno.h-t Include: diff --git a/modules/float b/modules/float index 7f56d6c6b8..4a1c16a538 100644 --- a/modules/float +++ b/modules/float @@ -16,6 +16,7 @@ BUILT_SOURCES += $(FLOAT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. +if GL_GENERATE_FLOAT_H float.h: float.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @@ -26,6 +27,10 @@ float.h: float.in.h $(top_builddir)/config.status < $(srcdir)/float.in.h; \ } > $@-t && \ mv $@-t $@ +else +float.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += float.h float.h-t Include: diff --git a/modules/fnmatch b/modules/fnmatch index bf7158fb9b..fde25a1733 100644 --- a/modules/fnmatch +++ b/modules/fnmatch @@ -28,13 +28,18 @@ BUILT_SOURCES += $(FNMATCH_H) # We need the following in order to create when the system # doesn't have one that supports the required API. -fnmatch.h: fnmatch.in.h $(ARG_NONNULL_H) +if GL_GENERATE_FNMATCH_H +fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/fnmatch.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +fnmatch.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t Include: diff --git a/modules/glob b/modules/glob index 15f2022076..114cb6d121 100644 --- a/modules/glob +++ b/modules/glob @@ -34,6 +34,7 @@ BUILT_SOURCES += $(GLOB_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. +if GL_GENERATE_GLOB_H glob.h: glob.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -44,6 +45,10 @@ glob.h: glob.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( < $(srcdir)/glob.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +glob.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += glob.h glob.h-t Include: diff --git a/modules/iconv-h b/modules/iconv-h index 7cca5c5ccc..82330f6d00 100644 --- a/modules/iconv-h +++ b/modules/iconv-h @@ -19,6 +19,7 @@ BUILT_SOURCES += $(ICONV_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. +if GL_GENERATE_ICONV_H iconv.h: iconv.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @@ -37,6 +38,10 @@ iconv.h: iconv.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) < $(srcdir)/iconv.in.h; \ } > $@-t && \ mv $@-t $@ +else +iconv.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += iconv.h iconv.h-t Include: diff --git a/modules/netinet_in b/modules/netinet_in index b52aa4d9c1..da680810bc 100644 --- a/modules/netinet_in +++ b/modules/netinet_in @@ -18,6 +18,7 @@ BUILT_SOURCES += $(NETINET_IN_H) # We need the following in order to create when the system # doesn't have one. +if GL_GENERATE_NETINET_IN_H netinet/in.h: netinet_in.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) netinet $(AM_V_GEN)rm -f $@-t $@ && \ @@ -30,6 +31,10 @@ netinet/in.h: netinet_in.in.h $(top_builddir)/config.status < $(srcdir)/netinet_in.in.h; \ } > $@-t && \ mv $@-t $@ +else +netinet/in.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t MOSTLYCLEANDIRS += netinet diff --git a/modules/pthread b/modules/pthread index 2a729397aa..3a00c77214 100644 --- a/modules/pthread +++ b/modules/pthread @@ -17,6 +17,7 @@ BUILT_SOURCES += $(PTHREAD_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. +if GL_GENERATE_PTHREAD_H pthread.h: pthread.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -30,6 +31,10 @@ pthread.h: pthread.in.h $(top_builddir)/config.status < $(srcdir)/pthread.in.h; \ } > $@-t && \ mv $@-t $@ +else +pthread.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += pthread.h pthread.h-t Include: diff --git a/modules/sched b/modules/sched index ac17479a0d..e0a3936b2e 100644 --- a/modules/sched +++ b/modules/sched @@ -16,6 +16,7 @@ BUILT_SOURCES += $(SCHED_H) # We need the following in order to create a replacement for when # the system doesn't have one. +if GL_GENERATE_SCHED_H sched.h: sched.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -28,6 +29,10 @@ sched.h: sched.in.h $(top_builddir)/config.status < $(srcdir)/sched.in.h; \ } > $@-t && \ mv $@-t $@ +else +sched.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += sched.h sched.h-t Include: diff --git a/modules/selinux-h b/modules/selinux-h index 7df7c5a0fc..66429f7b50 100644 --- a/modules/selinux-h +++ b/modules/selinux-h @@ -37,6 +37,7 @@ selinux/selinux.h: se-selinux.in.h $(top_builddir)/config.status $(UNUSED_PARAME MOSTLYCLEANFILES += selinux/selinux.h selinux/selinux.h-t BUILT_SOURCES += $(SELINUX_CONTEXT_H) +if GL_GENERATE_SELINUX_CONTEXT_H selinux/context.h: se-context.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H) $(AM_V_at)$(MKDIR_P) selinux $(AM_V_GEN)rm -f $@-t $@ && \ @@ -46,6 +47,10 @@ selinux/context.h: se-context.in.h $(top_builddir)/config.status $(UNUSED_PARAME } > $@-t && \ chmod a-x $@-t && \ mv $@-t $@ +else +selinux/context.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += selinux/context.h selinux/context.h-t MOSTLYCLEANDIRS += selinux diff --git a/modules/stdarg b/modules/stdarg index 10ac474106..6cb1db8644 100644 --- a/modules/stdarg +++ b/modules/stdarg @@ -23,6 +23,7 @@ BUILT_SOURCES += $(STDARG_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. +if GL_GENERATE_STDARG_H stdarg.h: stdarg.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @@ -33,6 +34,10 @@ stdarg.h: stdarg.in.h $(top_builddir)/config.status < $(srcdir)/stdarg.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdarg.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdarg.h stdarg.h-t Include: diff --git a/modules/stdbool b/modules/stdbool index 7df3cc5217..cfb9aac84c 100644 --- a/modules/stdbool +++ b/modules/stdbool @@ -16,12 +16,17 @@ BUILT_SOURCES += $(STDBOOL_H) # We need the following in order to create when the system # doesn't have one that works. +if GL_GENERATE_STDBOOL_H stdbool.h: stdbool.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdbool.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdbool.h stdbool.h-t Include: diff --git a/modules/stddef b/modules/stddef index 23a6fb56af..94b57da9b0 100644 --- a/modules/stddef +++ b/modules/stddef @@ -17,6 +17,7 @@ BUILT_SOURCES += $(STDDEF_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. +if GL_GENERATE_STDDEF_H stddef.h: stddef.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @@ -29,6 +30,10 @@ stddef.h: stddef.in.h $(top_builddir)/config.status < $(srcdir)/stddef.in.h; \ } > $@-t && \ mv $@-t $@ +else +stddef.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stddef.h stddef.h-t Include: diff --git a/modules/stdint b/modules/stdint index 2878da6d32..c11825a12e 100644 --- a/modules/stdint +++ b/modules/stdint @@ -23,6 +23,7 @@ BUILT_SOURCES += $(STDINT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. +if GL_GENERATE_STDINT_H stdint.h: stdint.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -55,6 +56,10 @@ stdint.h: stdint.in.h $(top_builddir)/config.status < $(srcdir)/stdint.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdint.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdint.h stdint.h-t Include: diff --git a/modules/sysexits b/modules/sysexits index 616ddb9dae..ed0d488666 100644 --- a/modules/sysexits +++ b/modules/sysexits @@ -16,6 +16,7 @@ BUILT_SOURCES += $(SYSEXITS_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. +if GL_GENERATE_SYSEXITS_H sysexits.h: sysexits.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -27,6 +28,10 @@ sysexits.h: sysexits.in.h $(top_builddir)/config.status < $(srcdir)/sysexits.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +sysexits.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += sysexits.h sysexits.h-t Include: -- cgit v1.2.1 From 2255b865130df1feadea60779babd6889285186e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 5 Apr 2011 23:45:10 -0700 Subject: verify: use _Static_assert if available * lib/verify.h (HAVE__STATIC_ASSERT): New macro. (verify_true, verify): Use it if available. This generates better diagnostics with GCC 4.6.0 and later. --- ChangeLog | 7 +++++++ lib/verify.h | 43 ++++++++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ac5798026..eee95090a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-06 Paul Eggert + + verify: use _Static_assert if available + * lib/verify.h (HAVE__STATIC_ASSERT): New macro. + (verify_true, verify): Use it if available. This generates better + diagnostics with GCC 4.6.0 and later. + 2011-04-05 Bruno Haible Remove leftover generated .h files after config.status changed. diff --git a/lib/verify.h b/lib/verify.h index 5e91abdbec..6c1f8c9e80 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -20,6 +20,17 @@ #ifndef VERIFY_H # define VERIFY_H 1 +/* Define HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the + C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and + later, and its use here generates easier-to-read diagnostics when + verify (R) fails. + + For now, use this only with GCC. Eventually whether _Static_assert + works should be determined by 'configure'. */ +# if 4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) +# define HAVE__STATIC_ASSERT 1 +# endif + /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. @@ -31,7 +42,12 @@ Symbols ending in "__" are private to this header. - The code below uses several ideas. + If _Static_assert works, verify (R) uses it directly. Similarly, + verify_true (R) works by packaging a _Static_assert inside a struct + that is an operand of sizeof. + + The code below uses several ideas for C++ compilers, and for C + compilers that do not support _Static_assert: * The first step is ((R) ? 1 : -1). Given an expression R, of integral or boolean or floating-point type, this yields an @@ -109,15 +125,9 @@ __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, just as __COUNTER__ is already - being used if available. - - #if 4 <= __GNUC__ - # define verify(R) [another version to keep GCC happy] - #endif + * This implementation exploits the fact that older versions of GCC, + which do not support _Static_assert, also do not warn about the + last declaration mentioned above. * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */ @@ -148,6 +158,13 @@ template struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; # define verify_true(R) \ (!!sizeof (verify_type__<(R) ? 1 : -1>)) +# elif HAVE__STATIC_ASSERT +# define verify_true(R) \ + (!!sizeof \ + (struct { \ + _Static_assert (R, "verify_true (" #R ")"); \ + int verify_dummy__; \ + })) # else # define verify_true(R) \ (!!sizeof \ @@ -157,7 +174,11 @@ template /* Verify requirement R at compile-time, as a declaration without a trailing ';'. */ -# define verify(R) \ +# if HAVE__STATIC_ASSERT +# define verify(R) _Static_assert (R, "verify (" #R ")") +# else +# define verify(R) \ extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)] +# endif #endif -- cgit v1.2.1 From bd5d1e621103ea3f7fbae09010348ce2df563808 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 6 Apr 2011 14:33:24 -0600 Subject: binary-io: relicense under LGPLv2+ * modules/binary-io (License): Relax to LGPLv2+. Requested for libvirt, and required by pipe2. Signed-off-by: Eric Blake --- ChangeLog | 6 ++++++ modules/binary-io | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eee95090a3..922d2116c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-06 Eric Blake + + binary-io: relicense under LGPLv2+ + * modules/binary-io (License): Relax to LGPLv2+. + Requested for libvirt, and required by pipe2. + 2011-04-06 Paul Eggert verify: use _Static_assert if available diff --git a/modules/binary-io b/modules/binary-io index eb41ec0a3c..4386ec924d 100644 --- a/modules/binary-io +++ b/modules/binary-io @@ -16,7 +16,7 @@ Include: "binary-io.h" License: -LGPL +LGPLv2+ Maintainer: Bruno Haible -- cgit v1.2.1 From 9cc991025d6139a3a8f3e0f1570bf39a66f3aafa Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 8 Apr 2011 08:51:56 -0600 Subject: careadlink: fix compilation error on mingw Mingw compilation failed: lib/careadlinkat.c: In function 'careadlinkat': lib/careadlinkat.c:143:39: error: 'const struct allocator' has no member named 'malloc' lib/careadlinkat.c:149:66: error: 'const struct allocator' has no member named 'realloc' lib/careadlinkat.c:152:39: error: 'const struct allocator' has no member named 'realloc' lib/careadlinkat.c:169:27: error: 'const struct allocator' has no member named 'malloc' make[4]: *** [careadlinkat.lo] Error 1 because "careadlinkat.h" includes enough system headers to get replacement names defined for malloc, then "allocator.h" defines fields with those replacement names, then undefining the macros tries to reference missing fields. I figured this patch is less invasive than changing the field names in allocator.h, and possibly requiring clients to change. * lib/careadlinkat.c (standard_allocator): Avoid renaming fields within struct allocator. Signed-off-by: Eric Blake --- ChangeLog | 6 ++++++ lib/careadlinkat.c | 24 +++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 922d2116c4..2c887a61b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-08 Eric Blake + + careadlink: fix compilation error on mingw + * lib/careadlinkat.c (standard_allocator): Avoid renaming fields + within struct allocator. + 2011-04-06 Eric Blake binary-io: relicense under LGPLv2+ diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 15ffe24c0f..eb2e009e99 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -30,11 +30,6 @@ #include #include -/* Use the system functions, not the gnulib overrides, because this - module does not depend on GNU or POSIX semantics. */ -#undef malloc -#undef realloc - /* Define this independently so that stdint.h is not a prerequisite. */ #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) @@ -57,10 +52,10 @@ careadlinkatcwd (int fd, char const *filename, char *buffer, } #endif -/* A standard allocator. For now, only careadlinkat needs this, but - perhaps it should be moved to the allocator module. */ -static struct allocator const standard_allocator = - { malloc, realloc, free, NULL }; +/* Forward declaration. We want to #undef malloc before initializing + this struct, but cannot do so until after all code that uses named + fields from "allocator.h" has been compiled. */ +static struct allocator const standard_allocator; /* Assuming the current directory is FD, get the symbolic link value of FILENAME as a null-terminated string and put it into a buffer. @@ -173,3 +168,14 @@ careadlinkat (int fd, char const *filename, errno = ENOMEM; return NULL; } + +/* Use the system functions, not the gnulib overrides, because this + module does not depend on GNU or POSIX semantics. See comments + above why this must occur here. */ +#undef malloc +#undef realloc + +/* A standard allocator. For now, only careadlinkat needs this, but + perhaps it should be moved to the allocator module. */ +static struct allocator const standard_allocator = + { malloc, realloc, free, NULL }; -- cgit v1.2.1 From 70a72e0f50411ccc776379a761725d8c8bec58a3 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 8 Apr 2011 10:15:54 -0600 Subject: nonblocking: provide O_NONBLOCK for mingw Mingw is the only known platform that lacks O_NONBLOCK (possibly via the alternate spelling O_NDELAY). But mingw also lacks any files where open() needs to enforce non-blocking behavior, and lacks openat(), so it is relatively simple to provide a non-zero flag. A future patches will make use of O_NONBLOCK for pipe2. * modules/nonblocking (Depends-on): Add open. (configure.ac): Set new witness macro. * m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Provide default for it. * modules/fcntl-h (Makefile.am): Substitute it. * lib/fcntl.in.h (O_NONBLOCK): Guarantee non-zero definition when nonblocking module is in use. * lib/nonblocking.c: Adjust portability test. * lib/open.c (open): Don't let native open see gnulib flag. * tests/test-fcntl-h.c (main): Enhance test. * tests/test-open.h (test_open): Likewise. * doc/posix-headers/fcntl.texi (fcntl.h): Document the replacement. Signed-off-by: Eric Blake --- ChangeLog | 13 +++++++ doc/posix-headers/fcntl.texi | 9 +++-- lib/fcntl.in.h | 13 +++++-- lib/nonblocking.c | 2 +- lib/open.c | 9 +++++ m4/fcntl_h.m4 | 17 ++++----- modules/fcntl-h | 1 + modules/nonblocking | 2 ++ tests/test-fcntl-h.c | 82 ++++++++++++++++++++++++++++++++++++++++++-- tests/test-open.h | 6 ++++ 10 files changed, 139 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c887a61b3..1af3b71985 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2011-04-08 Eric Blake + nonblocking: provide O_NONBLOCK for mingw + * modules/nonblocking (Depends-on): Add open. + (configure.ac): Set new witness macro. + * m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Provide default for it. + * modules/fcntl-h (Makefile.am): Substitute it. + * lib/fcntl.in.h (O_NONBLOCK): Guarantee non-zero definition when + nonblocking module is in use. + * lib/nonblocking.c: Adjust portability test. + * lib/open.c (open): Don't let native open see gnulib flag. + * tests/test-fcntl-h.c (main): Enhance test. + * tests/test-open.h (test_open): Likewise. + * doc/posix-headers/fcntl.texi (fcntl.h): Document the replacement. + careadlink: fix compilation error on mingw * lib/careadlinkat.c (standard_allocator): Avoid renaming fields within struct allocator. diff --git a/doc/posix-headers/fcntl.texi b/doc/posix-headers/fcntl.texi index 1b64195180..29b61ecb47 100644 --- a/doc/posix-headers/fcntl.texi +++ b/doc/posix-headers/fcntl.texi @@ -9,9 +9,14 @@ Portability problems fixed by Gnulib: @itemize @item @samp{O_CLOEXEC}, @samp{O_DIRECTORY}, @samp{O_DSYNC}, @samp{O_NOCTTY}, -@samp{O_NOFOLLOW}, @samp{O_NONBLOCK}, @samp{O_RSYNC}, @samp{O_SYNC}, +@samp{O_NOFOLLOW}, @samp{O_RSYNC}, @samp{O_SYNC}, and @samp{O_TTY_INIT} are not defined on some platforms. Gnulib defines -these macros to 0. +these macros to 0, which is generally safe. + +@item +@samp{O_NONBLOCK} is not defined on some platforms. If the +@samp{nonblocking} module is in use, gnulib guarantees a working +non-zero value; otherwise, the gnulib replacement is 0. @item @samp{O_EXEC} and @samp{O_SEARCH} are not defined on some platforms. diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 18cac454ab..b6521d6719 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -182,8 +182,7 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " #endif #if !defined O_CLOEXEC && defined O_NOINHERIT -/* Mingw spells it `O_NOINHERIT'. Intentionally leave it - undefined if not available. */ +/* Mingw spells it `O_NOINHERIT'. */ # define O_CLOEXEC O_NOINHERIT #endif @@ -219,6 +218,16 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " # define O_NONBLOCK O_NDELAY #endif +#if @GNULIB_NONBLOCKING@ +# if O_NONBLOCK +# define GNULIB_defined_O_NONBLOCK 0 +# else +# define GNULIB_defined_O_NONBLOCK 1 +# undef O_NONBLOCK +# define O_NONBLOCK 0x40000000 +# endif +#endif + #ifndef O_NOCTTY # define O_NOCTTY 0 #endif diff --git a/lib/nonblocking.c b/lib/nonblocking.c index f28e4231b0..9f7bce916f 100644 --- a/lib/nonblocking.c +++ b/lib/nonblocking.c @@ -113,7 +113,7 @@ set_nonblocking_flag (int desc, bool value) # include -# if !O_NONBLOCK +# if GNULIB_defined_O_NONBLOCK # error Please port nonblocking to your platform # endif diff --git a/lib/open.c b/lib/open.c index 2e2cc74dc6..e60b619949 100644 --- a/lib/open.c +++ b/lib/open.c @@ -63,6 +63,15 @@ open (const char *filename, int flags, ...) va_end (arg); } +#if GNULIB_defined_O_NONBLOCK + /* The only known platform that lacks O_NONBLOCK is mingw, but it + also lacks named pipes and Unix sockets, which are the only two + file types that require non-blocking handling in open(). + Therefore, it is safe to ignore O_NONBLOCK here. It is handy + that mingw also lacks openat(), so that is also covered here. */ + flags &= ~O_NONBLOCK; +#endif + #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ if (strcmp (filename, "/dev/null") == 0) filename = "NUL"; diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index 1ef4f455b7..c466da4df5 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -31,13 +31,14 @@ AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], AC_DEFUN([gl_FCNTL_H_DEFAULTS], [ - GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) - GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) - GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) + GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) + GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING]) + GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) + GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) - HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) - REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) - REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) - REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) + HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) + HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) + REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) + REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) + REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) ]) diff --git a/modules/fcntl-h b/modules/fcntl-h index 054d15fd88..45593f6ef3 100644 --- a/modules/fcntl-h +++ b/modules/fcntl-h @@ -30,6 +30,7 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ -e 's|@''GNULIB_FCNTL''@|$(GNULIB_FCNTL)|g' \ + -e 's|@''GNULIB_NONBLOCKING''@|$(GNULIB_NONBLOCKING)|g' \ -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \ -e 's|@''GNULIB_OPENAT''@|$(GNULIB_OPENAT)|g' \ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ diff --git a/modules/nonblocking b/modules/nonblocking index 9528405fab..604cc47c79 100644 --- a/modules/nonblocking +++ b/modules/nonblocking @@ -8,10 +8,12 @@ lib/nonblocking.h Depends-on: fcntl-h ioctl +open stdbool sys_socket configure.ac: +gl_FCNTL_MODULE_INDICATOR([nonblocking]) Makefile.am: lib_SOURCES += nonblocking.c diff --git a/tests/test-fcntl-h.c b/tests/test-fcntl-h.c index dd20fbb406..648701ef4b 100644 --- a/tests/test-fcntl-h.c +++ b/tests/test-fcntl-h.c @@ -29,10 +29,88 @@ int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; /* Check that the FD_* macros are defined. */ -int fd = FD_CLOEXEC; +int i = FD_CLOEXEC; int main (void) { - return 0; + /* Ensure no overlap in SEEK_*. */ + switch (0) + { + case SEEK_CUR: + case SEEK_END: + case SEEK_SET: + ; + } + + /* Ensure no dangerous overlap in non-zero gnulib-defined replacements. */ + switch (O_RDONLY) + { + /* Access modes */ + case O_RDONLY: + case O_WRONLY: + case O_RDWR: +#if O_EXEC && O_EXEC != O_RDONLY + case O_EXEC: +#endif +#if O_SEARCH && O_EXEC != O_SEARCH && O_SEARCH != O_RDONLY + case O_SEARCH: +#endif + i = O_ACCMODE == (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH); + break; + + /* Everyone should have these */ + case O_CREAT: + case O_EXCL: + case O_TRUNC: + case O_APPEND: + break; + + /* These might be 0 or O_RDONLY, only test non-zero versions. */ +#if O_CLOEXEC + case O_CLOEXEC: +#endif +#if O_DIRECT + case O_DIRECT: +#endif +#if O_DIRECTORY + case O_DIRECTORY: +#endif +#if O_DSYNC + case O_DSYNC: +#endif +#if O_NOATIME + case O_NOATIME: +#endif +#if O_NONBLOCK + case O_NONBLOCK: +#endif +#if O_NOCTTY + case O_NOCTTY: +#endif +#if O_NOFOLLOW + case O_NOFOLLOW: +#endif +#if O_NOLINKS + case O_NOLINKS: +#endif +#if O_RSYNC && O_RSYNC != O_DSYNC + case O_RSYNC: +#endif +#if O_SYNC && O_SYNC != O_RSYNC + case O_SYNC: +#endif +#if O_TTY_INIT + case O_TTY_INIT: +#endif +#if O_BINARY + case O_BINARY: +#endif +#if O_TEXT + case O_TEXT: +#endif + ; + } + + return !i; } diff --git a/tests/test-open.h b/tests/test-open.h index 3e5c5e1726..2ba5d137bf 100644 --- a/tests/test-open.h +++ b/tests/test-open.h @@ -63,6 +63,12 @@ test_open (int (*func) (char const *, int, ...), bool print) ASSERT (write (fd, "c", 1) == 1); ASSERT (close (fd) == 0); + /* Although O_NONBLOCK on regular files can be ignored, it must not + cause a failure. */ + fd = func (BASE "file", O_NONBLOCK | O_RDONLY); + ASSERT (0 <= fd); + ASSERT (close (fd) == 0); + /* Symlink handling, where supported. */ if (symlink (BASE "file", BASE "link") != 0) { -- cgit v1.2.1 From e7f37a2118b1a1384951d8ac8c58fe3ae1a7fd71 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 8 Apr 2011 10:44:53 -0600 Subject: pipe-filter: drop O_NONBLOCK workarounds * modules/pipe-filter-gi (Depends-on): Add fcntl-h. * modules/pipe-filter-ii (Depends-on): Likewise. * lib/pipe-filter-aux.h (O_NONBLOCK): Delete workaround. Signed-off-by: Eric Blake --- ChangeLog | 5 +++++ lib/pipe-filter-aux.h | 3 --- modules/pipe-filter-gi | 1 + modules/pipe-filter-ii | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1af3b71985..fe0a886391 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-04-08 Eric Blake + pipe-filter: drop O_NONBLOCK workarounds + * modules/pipe-filter-gi (Depends-on): Add fcntl-h. + * modules/pipe-filter-ii (Depends-on): Likewise. + * lib/pipe-filter-aux.h (O_NONBLOCK): Delete workaround. + nonblocking: provide O_NONBLOCK for mingw * modules/nonblocking (Depends-on): Add open. (configure.ac): Set new witness macro. diff --git a/lib/pipe-filter-aux.h b/lib/pipe-filter-aux.h index 118970b850..8c6cb747aa 100644 --- a/lib/pipe-filter-aux.h +++ b/lib/pipe-filter-aux.h @@ -102,9 +102,6 @@ nonintr_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, #endif /* Non-blocking I/O. */ -#ifndef O_NONBLOCK -# define O_NONBLOCK O_NDELAY -#endif #if HAVE_SELECT # define IS_EAGAIN(errcode) 0 #else diff --git a/modules/pipe-filter-gi b/modules/pipe-filter-gi index 7122c1ad49..f2e6fc032c 100644 --- a/modules/pipe-filter-gi +++ b/modules/pipe-filter-gi @@ -11,6 +11,7 @@ spawn-pipe wait-process error exit +fcntl-h gettext-h stdbool stdint diff --git a/modules/pipe-filter-ii b/modules/pipe-filter-ii index f845a8f5ac..5f7d05b9de 100644 --- a/modules/pipe-filter-ii +++ b/modules/pipe-filter-ii @@ -11,6 +11,7 @@ spawn-pipe wait-process error exit +fcntl-h gettext-h stdbool stdint -- cgit v1.2.1 From b277764ab1e0a68b1db0bf254ea4dbe8e16c0603 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 8 Apr 2011 10:22:00 -0600 Subject: fcntl-h: fix O_ACCMODE on cygwin * doc/posix-headers/fcntl.texi (fcntl.h): Document the bug. * lib/fcntl.in.h (O_ACCMODE): Fix it. Signed-off-by: Eric Blake --- ChangeLog | 4 ++++ doc/posix-headers/fcntl.texi | 5 +++++ lib/fcntl.in.h | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index fe0a886391..58f0c53cad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-04-08 Eric Blake + fcntl-h: fix O_ACCMODE on cygwin + * doc/posix-headers/fcntl.texi (fcntl.h): Document the bug. + * lib/fcntl.in.h (O_ACCMODE): Fix it. + pipe-filter: drop O_NONBLOCK workarounds * modules/pipe-filter-gi (Depends-on): Add fcntl-h. * modules/pipe-filter-ii (Depends-on): Likewise. diff --git a/doc/posix-headers/fcntl.texi b/doc/posix-headers/fcntl.texi index 29b61ecb47..c87e8726d4 100644 --- a/doc/posix-headers/fcntl.texi +++ b/doc/posix-headers/fcntl.texi @@ -22,6 +22,11 @@ non-zero value; otherwise, the gnulib replacement is 0. @samp{O_EXEC} and @samp{O_SEARCH} are not defined on some platforms. Gnulib defines these macros to @samp{O_RDONLY}, which is typically 0. +@item +The @samp{O_ACCMODE} mask mistakenly omits @samp{O_SEARCH} and +@samp{O_EXEC} on some platforms: +Cygwin. + @item @samp{O_BINARY}, @samp{O_TEXT} (not specified by POSIX, but essential for portability to Woe32 platforms) are defined on some platforms but not on diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index b6521d6719..971316fc05 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -256,6 +256,11 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " # define O_TTY_INIT 0 #endif +#if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) +# undef O_ACCMODE +# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) +#endif + /* For systems that distinguish between text and binary I/O. O_BINARY is usually declared in fcntl.h */ #if !defined O_BINARY && defined _O_BINARY -- cgit v1.2.1 From 0568a6e8985cc2ae9c57cb03fc81f5305458b7d2 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 8 Apr 2011 10:52:55 -0600 Subject: pipe2: fix O_NONBLOCK support on mingw * modules/pipe2 (Depends-on): Add nonblocking. * lib/pipe2.c (pipe2) [WIN32]: Add O_NONBLOCK support. * tests/test-pipe2.c (is_nonblocking): Adjust test accordingly. * tests/test-nonblocking.c (main): Likewise. * modules/pipe2-tests (Makefile.am): Avoid link failure. Signed-off-by: Eric Blake --- ChangeLog | 7 +++++++ lib/pipe2.c | 34 ++++++++++++++++++++++------------ modules/pipe2 | 1 + modules/pipe2-tests | 1 + tests/test-pipe2.c | 40 +++++++++------------------------------- 5 files changed, 40 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58f0c53cad..a8d45212ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-04-08 Eric Blake + pipe2: fix O_NONBLOCK support on mingw + * modules/pipe2 (Depends-on): Add nonblocking. + * lib/pipe2.c (pipe2) [WIN32]: Add O_NONBLOCK support. + * tests/test-pipe2.c (is_nonblocking): Adjust test accordingly. + * tests/test-nonblocking.c (main): Likewise. + * modules/pipe2-tests (Makefile.am): Avoid link failure. + fcntl-h: fix O_ACCMODE on cygwin * doc/posix-headers/fcntl.texi (fcntl.h): Document the bug. * lib/fcntl.in.h (O_ACCMODE): Fix it. diff --git a/lib/pipe2.c b/lib/pipe2.c index 4fa014f82b..6ffb101f3d 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -24,6 +24,7 @@ #include #include "binary-io.h" +#include "nonblocking.h" #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Native Woe32 API. */ @@ -55,34 +56,43 @@ pipe2 (int fd[2], int flags) } #endif -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Native Woe32 API. */ - /* Check the supported flags. */ - if ((flags & ~(O_CLOEXEC | O_BINARY | O_TEXT)) != 0) + if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_BINARY | O_TEXT)) != 0) { errno = EINVAL; return -1; } +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* Native Woe32 API. */ + + if (flags & O_NONBLOCK) + { + int result = _pipe (fd, 4096, flags & ~O_NONBLOCK); + if (result != 0) + return result; + if (set_nonblocking_flag (fd[0], true) != 0 + || set_nonblocking_flag (fd[1], true) != 0) + { + int saved_errno = errno; + close (fd[0]); + close (fd[1]); + result = -1; + errno = saved_errno; + } + return result; + } return _pipe (fd, 4096, flags); #else /* Unix API. */ - /* Check the supported flags. */ - if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_TEXT | O_BINARY)) != 0) - { - errno = EINVAL; - return -1; - } - if (pipe (fd) < 0) return -1; /* POSIX says that initially, the O_NONBLOCK and FD_CLOEXEC flags are cleared on - both fd[0] amd fd[1]. */ + both fd[0] and fd[1]. */ if (flags & O_NONBLOCK) { diff --git a/modules/pipe2 b/modules/pipe2 index 1183657659..ca722168a7 100644 --- a/modules/pipe2 +++ b/modules/pipe2 @@ -10,6 +10,7 @@ unistd fcntl-h binary-io extensions +nonblocking configure.ac: gl_FUNC_PIPE2 diff --git a/modules/pipe2-tests b/modules/pipe2-tests index 5d24bd747c..9e751dc327 100644 --- a/modules/pipe2-tests +++ b/modules/pipe2-tests @@ -11,3 +11,4 @@ configure.ac: Makefile.am: TESTS += test-pipe2 check_PROGRAMS += test-pipe2 +test_pipe2_LDADD = $(LDADD) @LIBSOCKET@ diff --git a/tests/test-pipe2.c b/tests/test-pipe2.c index ddfb819abb..8ca8e01363 100644 --- a/tests/test-pipe2.c +++ b/tests/test-pipe2.c @@ -33,6 +33,7 @@ SIGNATURE_CHECK (pipe2, int, (int[2], int)); #include "binary-io.h" #include "macros.h" +#include "nonblocking.h" /* Return true if FD is open. */ static bool @@ -67,49 +68,23 @@ is_cloexec (int fd) #endif } -/* Return true if FD is in non-blocking mode. */ -static bool -is_nonblocking (int fd) -{ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* We don't use the non-blocking mode for sockets here. */ - return 0; -#else - int flags; - ASSERT ((flags = fcntl (fd, F_GETFL)) >= 0); - return (flags & O_NONBLOCK) != 0; -#endif -} - int main () { int use_nonblocking; int use_cloexec; -#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) for (use_nonblocking = 0; use_nonblocking <= 1; use_nonblocking++) -#else - use_nonblocking = 0; -#endif -#if O_CLOEXEC - for (use_cloexec = 0; use_cloexec <= 1; use_cloexec++) -#else - use_cloexec = 0; -#endif + for (use_cloexec = 0; use_cloexec <= !!O_CLOEXEC; use_cloexec++) { int o_flags; int fd[2]; o_flags = 0; -#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) if (use_nonblocking) o_flags |= O_NONBLOCK; -#endif -#if O_CLOEXEC if (use_cloexec) o_flags |= O_CLOEXEC; -#endif fd[0] = -1; fd[1] = -1; @@ -131,14 +106,17 @@ main () } if (use_nonblocking) { - ASSERT (is_nonblocking (fd[0])); - ASSERT (is_nonblocking (fd[1])); + ASSERT (get_nonblocking_flag (fd[0]) == 1); + ASSERT (get_nonblocking_flag (fd[1]) == 1); } else { - ASSERT (!is_nonblocking (fd[0])); - ASSERT (!is_nonblocking (fd[1])); + ASSERT (get_nonblocking_flag (fd[0]) == 0); + ASSERT (get_nonblocking_flag (fd[1]) == 0); } + + ASSERT (close (fd[0]) == 0); + ASSERT (close (fd[1]) == 0); } return 0; -- cgit v1.2.1 From 4a1579d7560659ef5723325726eda14490a967f6 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 8 Apr 2011 11:51:45 -0600 Subject: nonblocking: reduce dependency No need to make nonblocking drag in sockets just for a test; test them if they are present and skip them otherwise. * tests/test-nonblocking.c: Only test sockets when in use. * modules/nonblocking-tests (Depends-on): Drop socket. (Makefile.am): Link even if sockets are not present. * modules/pipe2-tests (Makefile.am): Likewise. * lib/ioctl.c (ioctl) [WIN32]: Fail if sockets are not also in use. Signed-off-by: Eric Blake --- ChangeLog | 7 +++++++ lib/ioctl.c | 6 ++++++ modules/nonblocking-tests | 3 +-- modules/pipe2-tests | 2 +- tests/test-nonblocking.c | 52 +++++++++++++++++++++++++---------------------- 5 files changed, 43 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8d45212ff..099dbd7abf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-04-08 Eric Blake + nonblocking: reduce dependency + * tests/test-nonblocking.c: Only test sockets when in use. + * modules/nonblocking-tests (Depends-on): Drop socket. + (Makefile.am): Link even if sockets are not present. + * modules/pipe2-tests (Makefile.am): Likewise. + * lib/ioctl.c (ioctl) [WIN32]: Fail if sockets are not also in use. + pipe2: fix O_NONBLOCK support on mingw * modules/pipe2 (Depends-on): Add nonblocking. * lib/pipe2.c (pipe2) [WIN32]: Add O_NONBLOCK support. diff --git a/lib/ioctl.c b/lib/ioctl.c index 4bbed7653d..00caf3b187 100644 --- a/lib/ioctl.c +++ b/lib/ioctl.c @@ -54,6 +54,7 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */) int ioctl (int fd, int req, ...) { +# if GNULIB_SOCKET void *buf; va_list args; SOCKET sock; @@ -73,6 +74,11 @@ ioctl (int fd, int req, ...) set_winsock_errno (); return r; + +# else + errno = ENOSYS; + return -1; +# endif } #endif diff --git a/modules/nonblocking-tests b/modules/nonblocking-tests index 34d206d779..a1e5e7c03c 100644 --- a/modules/nonblocking-tests +++ b/modules/nonblocking-tests @@ -5,11 +5,10 @@ tests/macros.h Depends-on: close pipe-posix -socket configure.ac: Makefile.am: TESTS += test-nonblocking check_PROGRAMS += test-nonblocking -test_nonblocking_LDADD = $(LDADD) @LIBSOCKET@ +test_nonblocking_LDADD = $(LDADD) $(LIBSOCKET) diff --git a/modules/pipe2-tests b/modules/pipe2-tests index 9e751dc327..2e6c3f78a7 100644 --- a/modules/pipe2-tests +++ b/modules/pipe2-tests @@ -11,4 +11,4 @@ configure.ac: Makefile.am: TESTS += test-pipe2 check_PROGRAMS += test-pipe2 -test_pipe2_LDADD = $(LDADD) @LIBSOCKET@ +test_pipe2_LDADD = $(LDADD) $(LIBSOCKET) diff --git a/tests/test-nonblocking.c b/tests/test-nonblocking.c index f1b7610543..bfeef7bf71 100644 --- a/tests/test-nonblocking.c +++ b/tests/test-nonblocking.c @@ -33,13 +33,6 @@ main (void) const char *file = "test-nonblock.tmp"; int fd_file; int fd_pipe[2]; - int fd_sock; - bool sock_works = true; - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* For now, we can't get nonblocking status of windows sockets. */ - sock_works = false; -#endif fd_file = creat (file, 0600); @@ -79,28 +72,39 @@ main (void) ASSERT (close (fd_pipe[1]) == 0); #if GNULIB_TEST_PIPE2 - /* mingw still lacks O_NONBLOCK replacement. */ ASSERT (pipe2 (fd_pipe, O_NONBLOCK) == 0); - ASSERT (get_nonblocking_flag (fd_pipe[0]) == !!O_NONBLOCK); - ASSERT (get_nonblocking_flag (fd_pipe[1]) == !!O_NONBLOCK); + ASSERT (get_nonblocking_flag (fd_pipe[0]) == 1); + ASSERT (get_nonblocking_flag (fd_pipe[1]) == 1); ASSERT (close (fd_pipe[0]) == 0); ASSERT (close (fd_pipe[1]) == 0); #endif /* GNULIB_TEST_PIPE2 */ - /* Test sockets. */ - fd_sock = socket (AF_INET, SOCK_STREAM, 0); - ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1)); - ASSERT (set_nonblocking_flag (fd_sock, true) == 0); - ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1)); - ASSERT (set_nonblocking_flag (fd_sock, false) == 0); - ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1)); - ASSERT (close (fd_sock) == 0); - -#if SOCK_NONBLOCK - fd_sock = socket (AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); - ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1)); - ASSERT (close (fd_sock) == 0); -#endif /* SOCK_NONBLOCK */ +#if GNULIB_SOCKET + { + /* Test sockets. */ + bool sock_works = true; + int fd_sock; + +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + /* For now, we can't get nonblocking status of windows sockets. */ + sock_works = false; +# endif + + fd_sock = socket (AF_INET, SOCK_STREAM, 0); + ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1)); + ASSERT (set_nonblocking_flag (fd_sock, true) == 0); + ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1)); + ASSERT (set_nonblocking_flag (fd_sock, false) == 0); + ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1)); + ASSERT (close (fd_sock) == 0); + +# if SOCK_NONBLOCK + fd_sock = socket (AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); + ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1)); + ASSERT (close (fd_sock) == 0); +# endif /* SOCK_NONBLOCK */ + } +#endif /* GNULIB_SOCKET */ /* Test error handling. */ { -- cgit v1.2.1 From 7a6955f7b5a90dbd30cb88217406c49c23ead9d1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 10:41:30 -0700 Subject: careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from malloc/realloc to allocate/reallocate, to avoid problems if malloc and realloc are #define'd. Reported by Eric Blake in . * lib/careadlinkat.c (careadlinkat): Adjust to renaming. careadlinkat: fix compilation error on mingw --- ChangeLog | 9 +++++++++ lib/allocator.h | 10 +++++----- lib/careadlinkat.c | 8 ++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 099dbd7abf..c7e4c92804 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-04-08 Paul Eggert + + careadlinkat: rename members to avoid problem + * lib/allocator.h (struct allocator): Rename members from + malloc/realloc to allocate/reallocate, to avoid problems if malloc + and realloc are #define'd. Reported by Eric Blake in + . + * lib/careadlinkat.c (careadlinkat): Adjust to renaming. + 2011-04-08 Eric Blake nonblocking: reduce dependency diff --git a/lib/allocator.h b/lib/allocator.h index 4ac863b224..e30732b605 100644 --- a/lib/allocator.h +++ b/lib/allocator.h @@ -30,16 +30,16 @@ struct allocator attributes do not work with pointers to functions. See . */ - /* Call MALLOC to allocate memory, like 'malloc'. On failure MALLOC + /* Call ALLOCATE to allocate memory, like 'malloc'. On failure ALLOCATE should return NULL, though not necessarily set errno. When given a zero size it may return NULL even if successful. */ - void *(*malloc) (size_t); + void *(*allocate) (size_t); - /* If nonnull, call REALLOC to reallocate memory, like 'realloc'. - On failure REALLOC should return NULL, though not necessarily set + /* If nonnull, call REALLOCATE to reallocate memory, like 'realloc'. + On failure REALLOCATE should return NULL, though not necessarily set errno. When given a zero size it may return NULL even if successful. */ - void *(*realloc) (void *, size_t); + void *(*reallocate) (void *, size_t); /* Call FREE to free memory, like 'free'. */ void (*free) (void *); diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index eb2e009e99..0b54b1dfd7 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -133,16 +133,16 @@ careadlinkat (int fd, char const *filename, if (buf == stack_buf) { - char *b = (char *) alloc->malloc (link_size); + char *b = (char *) alloc->allocate (link_size); if (! b) break; memcpy (b, buf, link_size); buf = b; } - else if (link_size < buf_size && buf != buffer && alloc->realloc) + else if (link_size < buf_size && buf != buffer && alloc->reallocate) { /* Shrink BUF before returning it. */ - char *b = (char *) alloc->realloc (buf, link_size); + char *b = (char *) alloc->reallocate (buf, link_size); if (b) buf = b; } @@ -159,7 +159,7 @@ careadlinkat (int fd, char const *filename, buf_size = buf_size_max; else break; - buf = (char *) alloc->malloc (buf_size); + buf = (char *) alloc->allocate (buf_size); } while (buf); -- cgit v1.2.1 From c93727f23f91b83309c331bef094f22c0fe989d4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:06:03 -0700 Subject: stdlib: let modules use system malloc, realloc * lib/stdlib.in.h (malloc, realloc): Don't #define or add warnings if !_GL_USE_STDLIB_ALLOC. --- ChangeLog | 4 ++++ lib/stdlib.in.h | 48 ++++++++++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7e4c92804..6c9c17e728 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-04-08 Paul Eggert + stdlib: let modules use system malloc, realloc + * lib/stdlib.in.h (malloc, realloc): Don't #define or add warnings + if !_GL_USE_STDLIB_ALLOC. + careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from malloc/realloc to allocate/reallocate, to avoid problems if malloc diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 2697a4bd1d..c857de497b 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -255,23 +255,29 @@ _GL_WARN_ON_USE (ptsname, "grantpt is not portable - " # endif #endif -#if @GNULIB_MALLOC_POSIX@ -# if @REPLACE_MALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef malloc -# define malloc rpl_malloc -# endif +/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not + rely on GNU or POSIX semantics for malloc and realloc (for example, + by never specifying a zero size), so it does not need malloc or + realloc to be redefined. */ +#if !_GL_USE_STDLIB_ALLOC +# if @GNULIB_MALLOC_POSIX@ +# if @REPLACE_MALLOC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef malloc +# define malloc rpl_malloc +# endif _GL_FUNCDECL_RPL (malloc, void *, (size_t size)); _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); -# else +# else _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); -# endif +# endif _GL_CXXALIASWARN (malloc); -#elif defined GNULIB_POSIXCHECK -# undef malloc +# elif defined GNULIB_POSIXCHECK +# undef malloc /* Assume malloc is always declared. */ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " "use gnulib module malloc-posix for portability"); +# endif #endif /* Convert a multibyte character to a wide character. */ @@ -529,23 +535,25 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " #endif -#if @GNULIB_REALLOC_POSIX@ -# if @REPLACE_REALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef realloc -# define realloc rpl_realloc -# endif +#if !_GL_USE_STDLIB_ALLOC +# if @GNULIB_REALLOC_POSIX@ +# if @REPLACE_REALLOC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef realloc +# define realloc rpl_realloc +# endif _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); -# else +# else _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); -# endif +# endif _GL_CXXALIASWARN (realloc); -#elif defined GNULIB_POSIXCHECK -# undef realloc +# elif defined GNULIB_POSIXCHECK +# undef realloc /* Assume realloc is always declared. */ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " "use gnulib module realloc-posix for portability"); +# endif #endif #if @GNULIB_REALPATH@ -- cgit v1.2.1 From 0f6ac7dc9db3359b624ff31ad563426b437b965e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:11:49 -0700 Subject: * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define. (malloc, realloc): Don't #undef; no longer needed. --- ChangeLog | 2 ++ lib/careadlinkat.c | 20 +++++--------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c9c17e728..bf38cd7bd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ stdlib: let modules use system malloc, realloc * lib/stdlib.in.h (malloc, realloc): Don't #define or add warnings if !_GL_USE_STDLIB_ALLOC. + * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define. + (malloc, realloc): Don't #undef; no longer needed. careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 0b54b1dfd7..5f0d43c2e7 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -18,6 +18,7 @@ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ +#define _GL_USE_STDLIB_ALLOC 1 #include #include "careadlinkat.h" @@ -52,10 +53,10 @@ careadlinkatcwd (int fd, char const *filename, char *buffer, } #endif -/* Forward declaration. We want to #undef malloc before initializing - this struct, but cannot do so until after all code that uses named - fields from "allocator.h" has been compiled. */ -static struct allocator const standard_allocator; +/* A standard allocator. For now, only careadlinkat needs this, but + perhaps it should be moved to the allocator module. */ +static struct allocator const standard_allocator = + { malloc, realloc, free, NULL }; /* Assuming the current directory is FD, get the symbolic link value of FILENAME as a null-terminated string and put it into a buffer. @@ -168,14 +169,3 @@ careadlinkat (int fd, char const *filename, errno = ENOMEM; return NULL; } - -/* Use the system functions, not the gnulib overrides, because this - module does not depend on GNU or POSIX semantics. See comments - above why this must occur here. */ -#undef malloc -#undef realloc - -/* A standard allocator. For now, only careadlinkat needs this, but - perhaps it should be moved to the allocator module. */ -static struct allocator const standard_allocator = - { malloc, realloc, free, NULL }; -- cgit v1.2.1 From 9df573c1d54ff52f4448e1ed09f8b22d9208605e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:14:38 -0700 Subject: * lib/malloca.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. --- ChangeLog | 1 + lib/malloca.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf38cd7bd2..deb8c12932 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ if !_GL_USE_STDLIB_ALLOC. * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define. (malloc, realloc): Don't #undef; no longer needed. + * lib/malloca.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from diff --git a/lib/malloca.c b/lib/malloca.c index be3783e9d3..45d3075b9a 100644 --- a/lib/malloca.c +++ b/lib/malloca.c @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Specification. */ @@ -23,9 +24,6 @@ #include "verify.h" -/* Use the system functions, not the gnulib overrides in this file. */ -#undef malloc - /* The speed critical point in this file is freea() applied to an alloca() result: it must be fast, to match the speed of alloca(). The speed of mmalloca() and freea() in the other case are not critical, because they -- cgit v1.2.1 From 10d90c830f45ec144359c5ddfee57fc8724b7fb9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:30:47 -0700 Subject: * lib/progreloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. --- ChangeLog | 1 + lib/progreloc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index deb8c12932..34f6133422 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define. (malloc, realloc): Don't #undef; no longer needed. * lib/malloca.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/progreloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from diff --git a/lib/progreloc.c b/lib/progreloc.c index 0769c5e1cb..4a3fa48be4 100644 --- a/lib/progreloc.c +++ b/lib/progreloc.c @@ -16,6 +16,7 @@ along with this program. If not, see . */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Specification. */ @@ -94,7 +95,6 @@ extern char * canonicalize_file_name (const char *name); #undef close /* Use the system functions, not the gnulib overrides in this file. */ -#undef malloc #undef sprintf #undef set_program_name -- cgit v1.2.1 From 8cce8985192467efefcc4f3fbed7e5385aa84154 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:31:54 -0700 Subject: * lib/setenv.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise. --- ChangeLog | 1 + lib/setenv.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34f6133422..cc2541cd65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ (malloc, realloc): Don't #undef; no longer needed. * lib/malloca.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. * lib/progreloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/setenv.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise. careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from diff --git a/lib/setenv.c b/lib/setenv.c index 7c061925dd..173d95f28b 100644 --- a/lib/setenv.c +++ b/lib/setenv.c @@ -15,6 +15,7 @@ along with this program. If not, see . */ #if !_LIBC +# define _GL_USE_STDLIB_ALLOC 1 # include #endif @@ -64,10 +65,6 @@ __libc_lock_define_initialized (static, envlock) # define clearenv __clearenv # define tfind __tfind # define tsearch __tsearch -#else -/* Use the system functions, not the gnulib overrides in this file. */ -# undef malloc -# undef realloc #endif /* In the GNU C library implementation we try to be more clever and -- cgit v1.2.1 From bb9960c4d5c6829389dc8e4d484310a07f34ac78 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:34:08 -0700 Subject: * lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. --- ChangeLog | 1 + lib/canonicalize-lgpl.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc2541cd65..1a413bc06e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ * lib/malloca.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. * lib/progreloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. * lib/setenv.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise. + * lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c index 9bfb44f982..1574ec108c 100644 --- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -16,6 +16,7 @@ along with this program. If not, see . */ #ifndef _LIBC +# define _GL_USE_STDLIB_ALLOC 1 # include #endif @@ -68,8 +69,6 @@ # endif # define __readlink readlink # define __set_errno(e) errno = (e) -/* Use the system functions, not the gnulib overrides in this file. */ -# undef malloc # ifndef MAXSYMLINKS # ifdef SYMLOOP_MAX # define MAXSYMLINKS SYMLOOP_MAX -- cgit v1.2.1 From ef11bf40fdc66a337b26c40f02d0aa02faf63e38 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:35:40 -0700 Subject: * lib/relocatable.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. --- ChangeLog | 1 + lib/relocatable.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a413bc06e..753536ee48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ * lib/progreloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. * lib/setenv.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise. * lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/relocatable.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from diff --git a/lib/relocatable.c b/lib/relocatable.c index cbff85fa62..a7bbd99dca 100644 --- a/lib/relocatable.c +++ b/lib/relocatable.c @@ -25,6 +25,7 @@ # define _GNU_SOURCE 1 #endif +#define _GL_USE_STDLIB_ALLOC 1 #include /* Specification. */ @@ -86,9 +87,6 @@ # define FILE_SYSTEM_PREFIX_LEN(P) 0 #endif -/* Use the system functions, not the gnulib overrides in this file. */ -#undef malloc - /* Original installation prefix. */ static char *orig_prefix; static size_t orig_prefix_len; -- cgit v1.2.1 From 69c99f3a9936a85640b1e917282512384fc5acad Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:37:24 -0700 Subject: * lib/relocwrapper.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. --- ChangeLog | 1 + lib/relocwrapper.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 753536ee48..3f31057276 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ * lib/setenv.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise. * lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. * lib/relocatable.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/relocwrapper.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from diff --git a/lib/relocwrapper.c b/lib/relocwrapper.c index 2f4e8456b6..737ac94bb7 100644 --- a/lib/relocwrapper.c +++ b/lib/relocwrapper.c @@ -43,6 +43,7 @@ libc functions, no gettext(), no error(), no xmalloc(), no xsetenv(). */ +#define _GL_USE_STDLIB_ALLOC 1 #include #include @@ -58,7 +59,6 @@ /* Use the system functions, not the gnulib overrides in this file. */ #undef fprintf -#undef malloc /* Return a copy of the filename, with an extra ".bin" at the end. More generally, it replaces "${EXEEXT}" at the end with ".bin${EXEEXT}". */ -- cgit v1.2.1 From 0c3b4815cbce7a83b85473f1718cab6049cbffb4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:38:38 -0700 Subject: * lib/malloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. --- ChangeLog | 1 + lib/malloc.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f31057276..a14bb328c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ * lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. * lib/relocatable.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. * lib/relocwrapper.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/malloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from diff --git a/lib/malloc.c b/lib/malloc.c index 73c503fac7..ef07f6c427 100644 --- a/lib/malloc.c +++ b/lib/malloc.c @@ -18,6 +18,7 @@ /* written by Jim Meyering and Bruno Haible */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ #ifdef malloc @@ -28,14 +29,10 @@ # define NEED_MALLOC_GNU 1 #endif -/* Specification. */ #include #include -/* Call the system's malloc below. */ -#undef malloc - /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ -- cgit v1.2.1 From 003d30375c85c07eb8fc0ad805cf0a0cb146265e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 11:39:01 -0700 Subject: * lib/realloc.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise. --- ChangeLog | 1 + lib/realloc.c | 14 +------------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index a14bb328c9..38777e072b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ * lib/relocatable.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. * lib/relocwrapper.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. * lib/malloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/realloc.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise. careadlinkat: rename members to avoid problem * lib/allocator.h (struct allocator): Rename members from diff --git a/lib/realloc.c b/lib/realloc.c index 6ef37e794f..0c96ffacba 100644 --- a/lib/realloc.c +++ b/lib/realloc.c @@ -18,6 +18,7 @@ /* written by Jim Meyering and Bruno Haible */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */ @@ -34,23 +35,10 @@ # define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1 #endif -/* Below we want to call the system's malloc and realloc. - Undefine the symbols here so that including provides a - declaration of malloc(), not of rpl_malloc(), and likewise for realloc. */ -#undef malloc -#undef realloc - -/* Specification. */ #include #include -/* Below we want to call the system's malloc and realloc. - Undefine the symbols, if they were defined by gnulib's - replacement. */ -#undef malloc -#undef realloc - /* Change the size of an allocated block of memory P to N bytes, with error checking. If N is zero, change it to 1. If P is NULL, use malloc. */ -- cgit v1.2.1 From 71d4cd453160b7a26f4ee705452191d52b229782 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 13:05:39 -0700 Subject: * lib/stdlib.in.h (malloc, realloc): Limit this change to a smaller scope. --- ChangeLog | 2 ++ lib/stdlib.in.h | 46 ++++++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38777e072b..619bf67f45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ stdlib: let modules use system malloc, realloc * lib/stdlib.in.h (malloc, realloc): Don't #define or add warnings if !_GL_USE_STDLIB_ALLOC. + (malloc, realloc): Limit this change to a smaller scope. + * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define. (malloc, realloc): Don't #undef; no longer needed. * lib/malloca.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index c857de497b..b9ada2cd1a 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -259,25 +259,24 @@ _GL_WARN_ON_USE (ptsname, "grantpt is not portable - " rely on GNU or POSIX semantics for malloc and realloc (for example, by never specifying a zero size), so it does not need malloc or realloc to be redefined. */ -#if !_GL_USE_STDLIB_ALLOC -# if @GNULIB_MALLOC_POSIX@ -# if @REPLACE_MALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef malloc -# define malloc rpl_malloc -# endif +#if @GNULIB_MALLOC_POSIX@ +# if @REPLACE_MALLOC@ +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) +# undef malloc +# define malloc rpl_malloc +# endif _GL_FUNCDECL_RPL (malloc, void *, (size_t size)); _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); -# else +# else _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); -# endif +# endif _GL_CXXALIASWARN (malloc); -# elif defined GNULIB_POSIXCHECK -# undef malloc +#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC +# undef malloc /* Assume malloc is always declared. */ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " "use gnulib module malloc-posix for portability"); -# endif #endif /* Convert a multibyte character to a wide character. */ @@ -535,25 +534,24 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " #endif -#if !_GL_USE_STDLIB_ALLOC -# if @GNULIB_REALLOC_POSIX@ -# if @REPLACE_REALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef realloc -# define realloc rpl_realloc -# endif +#if @GNULIB_REALLOC_POSIX@ +# if @REPLACE_REALLOC@ +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) +# undef realloc +# define realloc rpl_realloc +# endif _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); -# else +# else _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); -# endif +# endif _GL_CXXALIASWARN (realloc); -# elif defined GNULIB_POSIXCHECK -# undef realloc +#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC +# undef realloc /* Assume realloc is always declared. */ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " "use gnulib module realloc-posix for portability"); -# endif #endif #if @GNULIB_REALPATH@ -- cgit v1.2.1 From cb4ce86374195eccbc3591f74a0c7b8168273667 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Apr 2011 13:22:51 -0700 Subject: allocator: New module. * modules/allocator, lib/allocator.c: New files. * lib/allocator.h (stdlib_allocator): New decl. * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC, standard_allocator): Remove. Do not include . (careadlinkat): Use stdlib_allocator instead of rolling our own. * modules/careadlinkat (Files): Remove lib/allocator.h. (Depends-on): Add allocator. --- ChangeLog | 9 +++++++++ lib/allocator.c | 5 +++++ lib/allocator.h | 3 +++ lib/careadlinkat.c | 9 +-------- modules/allocator | 22 ++++++++++++++++++++++ modules/careadlinkat | 2 +- 6 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 lib/allocator.c create mode 100644 modules/allocator diff --git a/ChangeLog b/ChangeLog index 619bf67f45..121c22a318 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2011-04-08 Paul Eggert + allocator: New module. + * modules/allocator, lib/allocator.c: New files. + * lib/allocator.h (stdlib_allocator): New decl. + * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC, standard_allocator): + Remove. Do not include . + (careadlinkat): Use stdlib_allocator instead of rolling our own. + * modules/careadlinkat (Files): Remove lib/allocator.h. + (Depends-on): Add allocator. + stdlib: let modules use system malloc, realloc * lib/stdlib.in.h (malloc, realloc): Don't #define or add warnings if !_GL_USE_STDLIB_ALLOC. diff --git a/lib/allocator.c b/lib/allocator.c new file mode 100644 index 0000000000..2c1a3da03a --- /dev/null +++ b/lib/allocator.c @@ -0,0 +1,5 @@ +#define _GL_USE_STDLIB_ALLOC 1 +#include +#include "allocator.h" +#include +struct allocator const stdlib_allocator = { malloc, realloc, free, NULL }; diff --git a/lib/allocator.h b/lib/allocator.h index e30732b605..a89ba32b09 100644 --- a/lib/allocator.h +++ b/lib/allocator.h @@ -50,4 +50,7 @@ struct allocator void (*die) (void); }; +/* An allocator using the stdlib functions and a null DIE function. */ +extern struct allocator const stdlib_allocator; + #endif diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 5f0d43c2e7..7a7806d121 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -18,7 +18,6 @@ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ -#define _GL_USE_STDLIB_ALLOC 1 #include #include "careadlinkat.h" @@ -27,7 +26,6 @@ #include #include -#include #include #include @@ -53,11 +51,6 @@ careadlinkatcwd (int fd, char const *filename, char *buffer, } #endif -/* A standard allocator. For now, only careadlinkat needs this, but - perhaps it should be moved to the allocator module. */ -static struct allocator const standard_allocator = - { malloc, realloc, free, NULL }; - /* Assuming the current directory is FD, get the symbolic link value of FILENAME as a null-terminated string and put it into a buffer. If FD is AT_FDCWD, FILENAME is interpreted relative to the current @@ -90,7 +83,7 @@ careadlinkat (int fd, char const *filename, char stack_buf[1024]; if (! alloc) - alloc = &standard_allocator; + alloc = &stdlib_allocator; if (! buffer_size) { diff --git a/modules/allocator b/modules/allocator new file mode 100644 index 0000000000..6ff55526c4 --- /dev/null +++ b/modules/allocator @@ -0,0 +1,22 @@ +Description: +Storage allocators. + +Files: +lib/allocator.h +lib/allocator.c + +Depends-on: + +configure.ac: + +Makefile.am: +lib_SOURCES += allocator.c + +Include: +"allocator.h" + +License: +LGPLv2+ + +Maintainer: +all diff --git a/modules/careadlinkat b/modules/careadlinkat index 670fde08f7..b4bc4a4dfb 100644 --- a/modules/careadlinkat +++ b/modules/careadlinkat @@ -4,9 +4,9 @@ Read symbolic links into a buffer without size limitation, relative to fd. Files: lib/careadlinkat.c lib/careadlinkat.h -lib/allocator.h Depends-on: +allocator readlink ssize_t unistd -- cgit v1.2.1 From 306bd09ac7e6d8cb9983da12613f680c933d15dd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 8 Apr 2011 15:02:14 -0700 Subject: autoupdate --- build-aux/gendocs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh index 34ef112e35..c8abd55fb3 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-11-29.11 +scriptversion=2011-04-08.14 # Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. @@ -305,10 +305,10 @@ if test -n "$docbook"; then docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"` mv $PACKAGE-db.xml "$outdir/" + split_html_db_dir=html_node_db cmd="${DOCBOOK2HTML} -o $split_html_db_dir \"${outdir}/$PACKAGE-db.xml\"" echo "Generating docbook HTML... ($cmd)" eval "$cmd" - split_html_db_dir=html_node_db ( cd ${split_html_db_dir} || exit 1 tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html -- cgit v1.2.1 From ef127178789143d8a9817b81bc5c3c86fe744b50 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 Apr 2011 02:12:11 +0200 Subject: verify: Fix syntax error with GCC 4.6 in C++ mode. * lib/verify.h (HAVE__STATIC_ASSERT): Don't define in C++ mode. (HAVE_STATIC_ASSERT): New macro. (verify_true, verify): Use 'static_assert' if it is supported and '_Static_assert' is not supported. --- ChangeLog | 8 ++++++++ lib/verify.h | 26 ++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 121c22a318..fd8f0973db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-04-08 Bruno Haible + + verify: Fix syntax error with GCC 4.6 in C++ mode. + * lib/verify.h (HAVE__STATIC_ASSERT): Don't define in C++ mode. + (HAVE_STATIC_ASSERT): New macro. + (verify_true, verify): Use 'static_assert' if it is supported and + '_Static_assert' is not supported. + 2011-04-08 Paul Eggert allocator: New module. diff --git a/lib/verify.h b/lib/verify.h index 6c1f8c9e80..6bca43f6a9 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -22,14 +22,23 @@ /* Define HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and - later, and its use here generates easier-to-read diagnostics when - verify (R) fails. + later, in C mode, and its use here generates easier-to-read diagnostics + when verify (R) fails. + + Define HAVE_STATIC_ASSERT to 1 if static_assert works as per the + C1X draft N1548 section 7.2 or the C++0X draft N3242 section 7.(4). + This will likely be supported by future GCC versions, in C++ mode. For now, use this only with GCC. Eventually whether _Static_assert - works should be determined by 'configure'. */ -# if 4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) + and static_assert works should be determined by 'configure'. */ +# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus # define HAVE__STATIC_ASSERT 1 # endif +/* The condition (99 < __GNUC__) is temporary, until we know about the + first G++ release that supports static_assert. */ +# if (99 < __GNUC__) && defined __cplusplus +# define HAVE_STATIC_ASSERT 1 +# endif /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike @@ -165,6 +174,13 @@ template _Static_assert (R, "verify_true (" #R ")"); \ int verify_dummy__; \ })) +# elif HAVE_STATIC_ASSERT +# define verify_true(R) \ + (!!sizeof \ + (struct { \ + static_assert (R, "verify_true (" #R ")"); \ + int verify_dummy__; \ + })) # else # define verify_true(R) \ (!!sizeof \ @@ -176,6 +192,8 @@ template # if HAVE__STATIC_ASSERT # define verify(R) _Static_assert (R, "verify (" #R ")") +# elif HAVE_STATIC_ASSERT +# define verify(R) static_assert (R, "verify (" #R ")") # else # define verify(R) \ extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)] -- cgit v1.2.1 From ea9ff45fb8fe7c24394d907988e402626752de11 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 8 Apr 2011 20:10:13 -0600 Subject: strftime: silence gnulib-tool warning gnulib-tool: warning: module strftime-tests has duplicated dependencies: strftime * modules/strftime-tests (Depends-on): Drop automatic dependency. Signed-off-by: Eric Blake --- ChangeLog | 5 +++++ modules/strftime-tests | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fd8f0973db..d82f2d16ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-08 Eric Blake + + strftime: silence gnulib-tool warning + * modules/strftime-tests (Depends-on): Drop automatic dependency. + 2011-04-08 Bruno Haible verify: Fix syntax error with GCC 4.6 in C++ mode. diff --git a/modules/strftime-tests b/modules/strftime-tests index 96ad21334a..20bc7cd1e3 100644 --- a/modules/strftime-tests +++ b/modules/strftime-tests @@ -3,7 +3,6 @@ tests/test-strftime.c tests/macros.h Depends-on: -strftime configure.ac: -- cgit v1.2.1 From d14f18bdda4f560660fe6418248f46b88237459e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 Apr 2011 18:05:54 +0200 Subject: relocatable-prog-wrapper: Update after module 'areadlink' changed. * lib/relocwrapper.c: Update dependencies hierarchy. * modules/relocatable-prog-wrapper (Files): Add lib/careadlinkat.[hc], lib/allocator.[hc]. --- ChangeLog | 7 +++++++ lib/relocwrapper.c | 4 +++- modules/relocatable-prog-wrapper | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d82f2d16ab..eeb8b8b2ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-09 Bruno Haible + + relocatable-prog-wrapper: Update after module 'areadlink' changed. + * lib/relocwrapper.c: Update dependencies hierarchy. + * modules/relocatable-prog-wrapper (Files): Add lib/careadlinkat.[hc], + lib/allocator.[hc]. + 2011-04-08 Eric Blake strftime: silence gnulib-tool warning diff --git a/lib/relocwrapper.c b/lib/relocwrapper.c index 737ac94bb7..a64b54d5f8 100644 --- a/lib/relocwrapper.c +++ b/lib/relocwrapper.c @@ -20,7 +20,9 @@ -> progname -> progreloc -> areadlink - -> readlink + -> careadlinkat + -> allocator + -> readlink -> canonicalize-lgpl -> malloca -> readlink diff --git a/modules/relocatable-prog-wrapper b/modules/relocatable-prog-wrapper index b96892952e..8246e56baa 100644 --- a/modules/relocatable-prog-wrapper +++ b/modules/relocatable-prog-wrapper @@ -10,6 +10,10 @@ lib/progname.c lib/progreloc.c lib/areadlink.h lib/areadlink.c +lib/careadlinkat.h +lib/careadlinkat.c +lib/allocator.h +lib/allocator.c lib/readlink.c lib/canonicalize-lgpl.c lib/malloca.h -- cgit v1.2.1 From 02d4f861750ad024bb985fece6a046cb5657fb3d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 Apr 2011 18:12:40 +0200 Subject: relocatable-prog-wrapper: Update after module 'areadlink' changed. * build-aux/install-reloc: Update list of files to be compiled. --- ChangeLog | 1 + build-aux/install-reloc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index eeb8b8b2ed..3aba07467f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ relocatable-prog-wrapper: Update after module 'areadlink' changed. * lib/relocwrapper.c: Update dependencies hierarchy. + * build-aux/install-reloc: Update list of files to be compiled. * modules/relocatable-prog-wrapper (Files): Add lib/careadlinkat.[hc], lib/allocator.[hc]. diff --git a/build-aux/install-reloc b/build-aux/install-reloc index 4ca4bedfa7..bc07e67cc0 100755 --- a/build-aux/install-reloc +++ b/build-aux/install-reloc @@ -156,6 +156,8 @@ func_verbose $compile_command \ "$srcdir"/progname.c \ "$srcdir"/progreloc.c \ "$srcdir"/areadlink.c \ + "$srcdir"/careadlinkat.c \ + "$srcdir"/allocator.c \ "$srcdir"/readlink.c \ "$srcdir"/canonicalize-lgpl.c \ "$srcdir"/malloca.c \ @@ -172,6 +174,8 @@ rm -f relocwrapper.o \ progreloc.o \ xreadlink.o \ areadlink.o \ + careadlinkat.o \ + allocator.o \ canonicalize-lgpl.o \ malloca.o \ relocatable.o \ -- cgit v1.2.1 From 18ce6fa97033a8f8a9a50750adbd1ce45401cd61 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 Apr 2011 18:18:18 +0200 Subject: allocator, careadlinkat: Fix double-inclusion guard. * lib/allocator.h: Fix double-inclusion guard. * lib/careadlinkat.h: Likewise. --- ChangeLog | 6 ++++++ lib/allocator.h | 3 ++- lib/careadlinkat.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3aba07467f..9edd796afa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-09 Bruno Haible + + allocator, careadlinkat: Fix double-inclusion guard. + * lib/allocator.h: Fix double-inclusion guard. + * lib/careadlinkat.h: Likewise. + 2011-04-09 Bruno Haible relocatable-prog-wrapper: Update after module 'areadlink' changed. diff --git a/lib/allocator.h b/lib/allocator.h index a89ba32b09..953117da83 100644 --- a/lib/allocator.h +++ b/lib/allocator.h @@ -18,6 +18,7 @@ /* Written by Paul Eggert. */ #ifndef _GL_ALLOCATOR_H +#define _GL_ALLOCATOR_H #include @@ -53,4 +54,4 @@ struct allocator /* An allocator using the stdlib functions and a null DIE function. */ extern struct allocator const stdlib_allocator; -#endif +#endif /* _GL_ALLOCATOR_H */ diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index c5e4bcfc15..be8670f2c9 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -18,6 +18,7 @@ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ #ifndef _GL_CAREADLINKAT_H +#define _GL_CAREADLINKAT_H #include #include -- cgit v1.2.1 From de128af79887d5dd55b5f0f693a53228122c2b98 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 Apr 2011 18:28:09 +0200 Subject: areadlinkat: Avoid link error on many platforms. * modules/areadlinkat (Depends-on): Add areadlink. --- ChangeLog | 5 +++++ modules/areadlinkat | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9edd796afa..af612efa96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-09 Bruno Haible + + areadlinkat: Avoid link error on many platforms. + * modules/areadlinkat (Depends-on): Add areadlink. + 2011-04-09 Bruno Haible allocator, careadlinkat: Fix double-inclusion guard. diff --git a/modules/areadlinkat b/modules/areadlinkat index 0fa753928c..8c621d5757 100644 --- a/modules/areadlinkat +++ b/modules/areadlinkat @@ -6,6 +6,7 @@ lib/areadlink.h lib/areadlinkat.c Depends-on: +areadlink careadlinkat readlinkat -- cgit v1.2.1 From 66a236773eb7d9706db907339c65791355083a3d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 Apr 2011 18:38:04 +0200 Subject: careadlinkat: Clarify specification. * lib/careadlinkat.h (careadlinkat): Clarify preadlinkat argument. (careadlinkatcwd): Add comment. * lib/careadlinkat.c (careadlinkat): Clarify preadlinkat argument. --- ChangeLog | 7 +++++++ lib/careadlinkat.c | 5 ++++- lib/careadlinkat.h | 9 +++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index af612efa96..589f7ee0a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-09 Bruno Haible + + careadlinkat: Clarify specification. + * lib/careadlinkat.h (careadlinkat): Clarify preadlinkat argument. + (careadlinkatcwd): Add comment. + * lib/careadlinkat.c (careadlinkat): Clarify preadlinkat argument. + 2011-04-09 Bruno Haible areadlinkat: Avoid link error on many platforms. diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 7a7806d121..01883db9ce 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -65,7 +65,10 @@ careadlinkatcwd (int fd, char const *filename, char *buffer, the returned value if it is nonnull and is not BUFFER. A null ALLOC stands for the standard allocator. - The PREADLINKAT function specifies how to read links. + The PREADLINKAT function specifies how to read links. It operates + like POSIX readlinkat() + + but can assume that its first argument is the same as FD. If successful, return the buffer address; otherwise return NULL and set errno. */ diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index be8670f2c9..4f0184bbc3 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -38,7 +38,10 @@ struct allocator; buffer managed by ALLOC. It is the caller's responsibility to free the returned value if it is nonnull and is not BUFFER. - The PREADLINKAT function specifies how to read links. + The PREADLINKAT function specifies how to read links. It operates + like POSIX readlinkat() + + but can assume that its first argument is the same as FD. If successful, return the buffer address; otherwise return NULL and set errno. */ @@ -50,8 +53,10 @@ char *careadlinkat (int fd, char const *filename, char *, size_t)); /* Suitable values for careadlinkat's FD and PREADLINKAT arguments, - when doing a plain readlink. */ + when doing a plain readlink: + Pass FD = AT_FDCWD and PREADLINKAT = careadlinkatcwd. */ #if HAVE_READLINKAT +/* AT_FDCWD is declared in , readlinkat in . */ # define careadlinkatcwd readlinkat #else /* Define AT_FDCWD independently, so that the careadlinkat module does -- cgit v1.2.1 From 6dce4dba9e10423045b81def590df4e6d3c540c6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 Apr 2011 20:57:21 +0200 Subject: careadlinkat: Use common coding style. * lib/careadlinkat.c: Move gnulib includes after system includes. --- ChangeLog | 5 +++++ lib/careadlinkat.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 589f7ee0a8..493144a7c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-09 Bruno Haible + + careadlinkat: Use common coding style. + * lib/careadlinkat.c: Move gnulib includes after system includes. + 2011-04-09 Bruno Haible careadlinkat: Clarify specification. diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 01883db9ce..95611f876c 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -22,8 +22,6 @@ #include "careadlinkat.h" -#include "allocator.h" - #include #include #include @@ -38,6 +36,8 @@ # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif +#include "allocator.h" + #if ! HAVE_READLINKAT /* Ignore FD. Get the symbolic link value of FILENAME and put it into BUFFER, with size BUFFER_SIZE. This function acts like readlink -- cgit v1.2.1 From bdfd8afae05965555600eb43d661d4c7686ebd68 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 Apr 2011 20:59:16 +0200 Subject: careadlinkat: Guard against misuse of careadlinkatcwd. * lib/careadlinkat.c: Include . (careadlinkatcwd): Check that the fd argument is as expected. --- ChangeLog | 6 ++++++ lib/careadlinkat.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 493144a7c7..8ea526d8da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-09 Bruno Haible + + careadlinkat: Guard against misuse of careadlinkatcwd. + * lib/careadlinkat.c: Include . + (careadlinkatcwd): Check that the fd argument is as expected. + 2011-04-09 Bruno Haible careadlinkat: Use common coding style. diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 95611f876c..e2909c766d 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -39,14 +40,17 @@ #include "allocator.h" #if ! HAVE_READLINKAT -/* Ignore FD. Get the symbolic link value of FILENAME and put it into - BUFFER, with size BUFFER_SIZE. This function acts like readlink - but has readlinkat's signature. */ +/* Get the symbolic link value of FILENAME and put it into BUFFER, with + size BUFFER_SIZE. This function acts like readlink but has + readlinkat's signature. */ ssize_t careadlinkatcwd (int fd, char const *filename, char *buffer, size_t buffer_size) { - (void) fd; + /* FD must be AT_FDCWD here, otherwise the caller is using this + function in contexts for which it was not meant for. */ + if (fd != AT_FDCWD) + abort (); return readlink (filename, buffer, buffer_size); } #endif -- cgit v1.2.1 From 2ba828d7b521d831648a4d0926d7885705cf1d59 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 9 Apr 2011 22:58:06 +0200 Subject: maint.mk: prohibit use of "can not" * top/maint.mk (sc_prohibit_can_not): New rule. Writing "can not" (rather than "cannot") is too common. Prohibit it. --- ChangeLog | 6 ++++++ top/maint.mk | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8ea526d8da..003ebede51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-09 Jim Meyering + + maint.mk: prohibit use of "can not" + * top/maint.mk (sc_prohibit_can_not): New rule. + Writing "can not" (rather than "cannot") is too common. Prohibit it. + 2011-04-09 Bruno Haible careadlinkat: Guard against misuse of careadlinkatcwd. diff --git a/top/maint.mk b/top/maint.mk index 693e5ab042..823e46c93b 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -841,6 +841,11 @@ sc_prohibit_S_IS_definition: halt='do not define S_IS* macros; include ' \ $(_sc_search_regexp) +sc_prohibit_can_not: + @prohibit='\' \ + halt='use "cannot", not "can'' not"' \ + $(_sc_search_regexp) + _ptm1 = use "test C1 && test C2", not "test C1 -''a C2" _ptm2 = use "test C1 || test C2", not "test C1 -''o C2" # Using test's -a and -o operators is not portable. -- cgit v1.2.1 From 52feca2cda2edd985d76117836e2a522178e9ab3 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 9 Apr 2011 23:05:22 +0200 Subject: maint: change "can not" to "cannot" But do not change the occurrences in maintain.texi or in build-aux/po/Makefile.in.in, which I presume comes from gettext. * doc/gnulib-tool.texi: s/can not/cannot/ * doc/posix-functions/accept.texi (accept): Likewise. * doc/posix-functions/socket.texi (socket): Likewise. * lib/mbrtowc.c: Likewise. --- ChangeLog | 8 ++++++++ doc/gnulib-tool.texi | 2 +- doc/posix-functions/accept.texi | 4 ++-- doc/posix-functions/socket.texi | 4 ++-- lib/mbrtowc.c | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 003ebede51..e01dd6b58d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2011-04-09 Jim Meyering + maint: change "can not" to "cannot" + But do not change the occurrences in maintain.texi or in + build-aux/po/Makefile.in.in, which I presume comes from gettext. + * doc/gnulib-tool.texi: s/can not/cannot/ + * doc/posix-functions/accept.texi (accept): Likewise. + * doc/posix-functions/socket.texi (socket): Likewise. + * lib/mbrtowc.c: Likewise. + maint.mk: prohibit use of "can not" * top/maint.mk (sc_prohibit_can_not): New rule. Writing "can not" (rather than "cannot") is too common. Prohibit it. diff --git a/doc/gnulib-tool.texi b/doc/gnulib-tool.texi index 8e38c38e99..443cbc216e 100644 --- a/doc/gnulib-tool.texi +++ b/doc/gnulib-tool.texi @@ -287,7 +287,7 @@ Also, on some platforms macros like @samp{_FILE_OFFSET_BITS} and @samp{_GNU_SOURCE} may be ineffective, or may have only a limited effect, if defined after the first system header file is included. -Finally, note that you can not use @code{AC_LIBOBJ} or +Finally, note that you cannot use @code{AC_LIBOBJ} or @code{AC_REPLACE_FUNCS} in your @file{configure.ac} and expect the resulting object files to be automatically added to @file{lib/libgnu.a}. This is because your @code{AC_LIBOBJ} and @code{AC_REPLACE_FUNCS} invocations diff --git a/doc/posix-functions/accept.texi b/doc/posix-functions/accept.texi index 61b009345c..b937e15f00 100644 --- a/doc/posix-functions/accept.texi +++ b/doc/posix-functions/accept.texi @@ -10,7 +10,7 @@ Portability problems fixed by Gnulib: @itemize @item On Windows platforms (excluding Cygwin), the descriptors returned by -the @code{accept} function can not be used in calls to @code{read}, +the @code{accept} function cannot be used in calls to @code{read}, @code{write}, and @code{close}; you have to use @code{recv}, @code{send}, @code{closesocket} in these cases instead. @item @@ -22,7 +22,7 @@ used instead. Portability problems not fixed by Gnulib: @itemize @item -On BeOS, the descriptors returned by the @code{accept} function can not be used +On BeOS, the descriptors returned by the @code{accept} function cannot be used in calls to @code{read}, @code{write}, and @code{close}; you have to use @code{recv}, @code{send}, @code{closesocket} in these cases instead. @item diff --git a/doc/posix-functions/socket.texi b/doc/posix-functions/socket.texi index bc3ee0f719..a91ebd6d76 100644 --- a/doc/posix-functions/socket.texi +++ b/doc/posix-functions/socket.texi @@ -10,7 +10,7 @@ Portability problems fixed by Gnulib: @itemize @item On Windows platforms (excluding Cygwin), the descriptors returned by -the @code{socket} function can not be used in calls to @code{read}, +the @code{socket} function cannot be used in calls to @code{read}, @code{write}, and @code{close}; you have to use @code{recv}, @code{send}, @code{closesocket} in these cases instead. @item @@ -22,7 +22,7 @@ used instead. Portability problems not fixed by Gnulib: @itemize @item -On BeOS, the descriptors returned by the @code{socket} function can not be used +On BeOS, the descriptors returned by the @code{socket} function cannot be used in calls to @code{read}, @code{write}, and @code{close}; you have to use @code{recv}, @code{send}, @code{closesocket} in these cases instead. @end itemize diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c index d9c25cced6..7a8e5996d0 100644 --- a/lib/mbrtowc.c +++ b/lib/mbrtowc.c @@ -335,7 +335,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { static mbstate_t internal_state; - /* Override mbrtowc's internal state. We can not call mbsinit() on the + /* Override mbrtowc's internal state. We cannot call mbsinit() on the hidden internal state, but we can call it on our variable. */ if (ps == NULL) ps = &internal_state; -- cgit v1.2.1 From bd71117029b364e6aae441d20d9f941b9b8537cd Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 9 Apr 2011 23:15:02 +0200 Subject: maint: fix "the the" in comment * lib/count-one-bits.h: s/the the/the/ --- ChangeLog | 3 +++ lib/count-one-bits.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e01dd6b58d..f523592e9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-04-09 Jim Meyering + maint: fix "the the" in comment + * lib/count-one-bits.h: s/the the/the/ + maint: change "can not" to "cannot" But do not change the occurrences in maintain.texi or in build-aux/po/Makefile.in.in, which I presume comes from gettext. diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h index 930e861e64..093165c154 100644 --- a/lib/count-one-bits.h +++ b/lib/count-one-bits.h @@ -38,7 +38,7 @@ count += count_one_bits_32 (x >> 31 >> 1); \ return count; -/* Compute and return the the number of 1-bits set in the least +/* Compute and return the number of 1-bits set in the least significant 32 bits of X. */ static inline int count_one_bits_32 (unsigned int x) -- cgit v1.2.1 From e9c8923d36e608241c829a06e1dc4a0931d961fa Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 9 Apr 2011 23:18:14 +0200 Subject: maint.mk: prohibit \ * top/maint.mk (sc_prohibit_the_the): New rule. --- ChangeLog | 3 +++ top/maint.mk | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index f523592e9c..521aefa851 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-04-09 Jim Meyering + maint.mk: prohibit \ + * top/maint.mk (sc_prohibit_the_the): New rule. + maint: fix "the the" in comment * lib/count-one-bits.h: s/the the/the/ diff --git a/top/maint.mk b/top/maint.mk index 823e46c93b..427dff3ece 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -841,6 +841,11 @@ sc_prohibit_S_IS_definition: halt='do not define S_IS* macros; include ' \ $(_sc_search_regexp) +sc_prohibit_the_the: + @prohibit='\' \ + halt='avoid double "the"' \ + $(_sc_search_regexp) + sc_prohibit_can_not: @prohibit='\' \ halt='use "cannot", not "can'' not"' \ -- cgit v1.2.1 From 135351c549050196b5c1322b3ab1e956565ab3d8 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 9 Apr 2011 23:18:59 +0200 Subject: maint: change "a a" to "a" * tests/test-lchown.h (test_lchown): s/a a/a/ --- ChangeLog | 3 +++ tests/test-lchown.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 521aefa851..f1c5c3afd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-04-09 Jim Meyering + maint: change "a a" to "a" + * tests/test-lchown.h (test_lchown): s/a a/a/ + maint.mk: prohibit \ * top/maint.mk (sc_prohibit_the_the): New rule. diff --git a/tests/test-lchown.h b/tests/test-lchown.h index aa10674187..229ed6b01b 100644 --- a/tests/test-lchown.h +++ b/tests/test-lchown.h @@ -46,7 +46,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print) int result; /* Solaris 8 is interesting - if the current process belongs to - multiple groups, the current directory is owned by a a group that + multiple groups, the current directory is owned by a group that the current process belongs to but different than getegid(), and the current directory does not have the S_ISGID bit, then regular files created in the directory belong to the directory's group, -- cgit v1.2.1 From f2b86e893c842eee27fc92c15945eb2ba0094d01 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 9 Apr 2011 14:44:53 -0700 Subject: maint: change "can not" to "cannot" * doc/posix-functions/iconv.texi (iconv): This one crossed line boundaries. --- ChangeLog | 6 ++++++ doc/posix-functions/iconv.texi | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1c5c3afd7..22d0ce7e73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-09 Paul Eggert + + maint: change "can not" to "cannot" + * doc/posix-functions/iconv.texi (iconv): This one crossed line + boundaries. + 2011-04-09 Jim Meyering maint: change "a a" to "a" diff --git a/doc/posix-functions/iconv.texi b/doc/posix-functions/iconv.texi index 3f984b5940..7ba2cfcc49 100644 --- a/doc/posix-functions/iconv.texi +++ b/doc/posix-functions/iconv.texi @@ -27,8 +27,8 @@ when GNU libiconv is not installed. @item This function was not correctly implemented in glibc versions before 2.2. @item -When @code{iconv} encounters an input character that is valid but that can -not be converted to the output character set, glibc's and GNU libiconv's +When @code{iconv} encounters an input character that is valid but that +cannot be converted to the output character set, glibc's and GNU libiconv's @code{iconv} stop the conversion. Some other implementations put an implementation-defined character into the output buffer. --- Gnulib provides higher-level facilities @code{striconv} and @code{striconveh} -- cgit v1.2.1 From 62f3b86f62d54b61c03a12b9b1674cfb996d9976 Mon Sep 17 00:00:00 2001 From: Mats Erik Andersson Date: Sun, 10 Apr 2011 02:47:51 +0200 Subject: getaddrinfo: Fix test for sa_len member. * m4/getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): When testing for sa_len, include before . --- ChangeLog | 6 ++++++ m4/getaddrinfo.m4 | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22d0ce7e73..5bdd6b299b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-09 Mats Erik Andersson (tiny change) + + getaddrinfo: Fix test for sa_len member. + * m4/getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): When testing for sa_len, + include before . + 2011-04-09 Paul Eggert maint: change "can not" to "cannot" diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4 index 94c276f836..e57623694c 100644 --- a/m4/getaddrinfo.m4 +++ b/m4/getaddrinfo.m4 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 23 +# getaddrinfo.m4 serial 24 dnl Copyright (C) 2004-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -105,7 +105,10 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ dnl Including sys/socket.h is wrong for Windows, but Windows does not dnl have sa_len so the result is correct anyway. - AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include ]) + AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [ +#include +#include +]) AC_CHECK_HEADERS_ONCE([netinet/in.h]) -- cgit v1.2.1 From 79e567ff014d17dbeaff94735457096657b2ea53 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 9 Apr 2011 20:29:43 -0700 Subject: fix typo in ChangeLog entry --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5bdd6b299b..3d8a1f72ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -155,7 +155,7 @@ * tests/test-open.h (test_open): Likewise. * doc/posix-headers/fcntl.texi (fcntl.h): Document the replacement. - careadlink: fix compilation error on mingw + careadlinkat: fix compilation error on mingw * lib/careadlinkat.c (standard_allocator): Avoid renaming fields within struct allocator. -- cgit v1.2.1 From 5e29a7a095a6c960115cf48f5b28278194a0b2ca Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 10 Apr 2011 09:30:22 +0200 Subject: test-chown.h: correct a cast * tests/test-chown.h (test_chown): Cast -1 to gid_t (not uid_t) when the destination is a stat.st_gid. --- ChangeLog | 6 ++++++ tests/test-chown.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3d8a1f72ac..c1eede5507 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-10 Jim Meyering + + test-chown.h: correct a cast + * tests/test-chown.h (test_chown): Cast -1 to gid_t (not uid_t) + when the destination is a stat.st_gid. + 2011-04-09 Mats Erik Andersson (tiny change) getaddrinfo: Fix test for sa_len member. diff --git a/tests/test-chown.h b/tests/test-chown.h index 7630de48da..c99ffc1d05 100644 --- a/tests/test-chown.h +++ b/tests/test-chown.h @@ -71,7 +71,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print) ASSERT (close (creat (BASE "dir/file", 0600)) == 0); ASSERT (stat (BASE "dir/file", &st1) == 0); ASSERT (st1.st_uid != (uid_t) -1); - ASSERT (st1.st_gid != (uid_t) -1); + ASSERT (st1.st_gid != (gid_t) -1); ASSERT (st1.st_gid == getegid ()); /* Sanity check of error cases. */ -- cgit v1.2.1 From f9e83fd48cb5c5a0b5a65751710138d42c814402 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 10 Apr 2011 09:56:02 +0200 Subject: maint: remove doubled words in comments, e.g., s/a a/a/ * lib/strptime.c (day_of_the_week): s/the the/the/ * tests/test-chown.h (test_chown): s/a a/a/ --- ChangeLog | 4 ++++ lib/strptime.c | 2 +- tests/test-chown.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1eede5507..9bf2029e2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-04-10 Jim Meyering + maint: remove doubled words in comments, e.g., s/a a/a/ + * lib/strptime.c (day_of_the_week): s/the the/the/ + * tests/test-chown.h (test_chown): s/a a/a/ + test-chown.h: correct a cast * tests/test-chown.h (test_chown): Cast -1 to gid_t (not uid_t) when the destination is a stat.st_gid. diff --git a/lib/strptime.c b/lib/strptime.c index 9e4394b883..6cf44bce42 100644 --- a/lib/strptime.c +++ b/lib/strptime.c @@ -200,7 +200,7 @@ static void day_of_the_week (struct tm *tm) { /* We know that January 1st 1970 was a Thursday (= 4). Compute the - the difference between this data in the one on TM and so determine + difference between this data in the one on TM and so determine the weekday. */ int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2); int wday = (-473 diff --git a/tests/test-chown.h b/tests/test-chown.h index c99ffc1d05..85cbb5afc9 100644 --- a/tests/test-chown.h +++ b/tests/test-chown.h @@ -38,7 +38,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print) int result; /* Solaris 8 is interesting - if the current process belongs to - multiple groups, the current directory is owned by a a group that + multiple groups, the current directory is owned by a group that the current process belongs to but different than getegid(), and the current directory does not have the S_ISGID bit, then regular files created in the directory belong to the directory's group, -- cgit v1.2.1 From 272e856de01e47a4c1385369931d9e88a32f1cd7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 10 Apr 2011 06:04:59 -0700 Subject: autoupdate --- build-aux/depcomp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build-aux/depcomp b/build-aux/depcomp index c3163befc3..43bd0f9bc1 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -1,10 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2010-10-07.20; # UTC +scriptversion=2011-04-09-11; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010 -# Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, +# 2011 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 @@ -557,7 +557,9 @@ makedepend) touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation -- cgit v1.2.1 From eff4c0360a0de49d22629d3bdbd15460c0615cee Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 11 Apr 2011 02:27:15 +0200 Subject: stdint test: Fix compilation failure on OSF/1 with DTK compiler. * modules/stdint-tests (Depends-on): Add wchar. --- ChangeLog | 5 +++++ modules/stdint-tests | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9bf2029e2b..45f5d0469d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-10 Bruno Haible + + stdint test: Fix compilation failure on OSF/1 with DTK compiler. + * modules/stdint-tests (Depends-on): Add wchar. + 2011-04-10 Jim Meyering maint: remove doubled words in comments, e.g., s/a a/a/ diff --git a/modules/stdint-tests b/modules/stdint-tests index ad320b2296..d83cd4c06d 100644 --- a/modules/stdint-tests +++ b/modules/stdint-tests @@ -6,6 +6,7 @@ m4/wint_t.m4 Depends-on: verify intprops +wchar configure.ac: gt_TYPE_WCHAR_T -- cgit v1.2.1 From 7dd6551404efff84abc69c3795dbe125cd13ebbd Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 10 Apr 2011 10:24:12 +0200 Subject: maint.mk: remove useless semicolon and backslash * top/maint.mk (sc_prohibit_empty_lines_at_EOF): Remove stray semicolon and backslash. --- ChangeLog | 6 ++++++ top/maint.mk | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 45f5d0469d..00e9df202c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-10 Jim Meyering + + maint.mk: remove useless semicolon and backslash + * top/maint.mk (sc_prohibit_empty_lines_at_EOF): Remove stray + semicolon and backslash. + 2011-04-10 Bruno Haible stdint test: Fix compilation failure on OSF/1 with DTK compiler. diff --git a/top/maint.mk b/top/maint.mk index 427dff3ece..ada00be4dc 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -824,7 +824,7 @@ require_exactly_one_NL_at_EOF_ = \ sc_prohibit_empty_lines_at_EOF: @perl -le '$(require_exactly_one_NL_at_EOF_)' $$($(VC_LIST_EXCEPT)) \ || { echo '$(ME): empty line(s) or no newline at EOF' \ - 1>&2; exit 1; } || :; \ + 1>&2; exit 1; } || : # Make sure we don't use st_blocks. Use ST_NBLOCKS instead. # This is a bit of a kludge, since it prevents use of the string -- cgit v1.2.1 From 8e7e846fcb3e7356be7e361ec2b12052baf56f0e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 10 Apr 2011 23:11:43 +0200 Subject: maint: remove doubled word: s/it it/it/ * lib/stat-time.h (get_stat_birthtime): s/it it/it/ --- ChangeLog | 5 +++++ lib/stat-time.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 00e9df202c..15ef031ba0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-10 Jim Meyering + + maint: remove doubled word: s/it it/it/ + * lib/stat-time.h (get_stat_birthtime): s/it it/it/ + 2011-04-10 Jim Meyering maint.mk: remove useless semicolon and backslash diff --git a/lib/stat-time.h b/lib/stat-time.h index 8a119788b8..d36a78ec54 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -175,7 +175,7 @@ get_stat_birthtime (struct stat const *st) using zero. Attempt to work around this problem. Alas, this can report failure even for valid time stamps. Also, NetBSD sometimes returns junk in the birth time fields; work around this - bug if it it is detected. There's no need to detect negative + bug if it is detected. There's no need to detect negative tv_nsec junk as negative tv_nsec already indicates an error. */ if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec) t.tv_nsec = -1; -- cgit v1.2.1 From ab426d01279fa5cb18891d4f088dc13683f86659 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 10 Apr 2011 23:52:02 +0200 Subject: maint: fix doubled-word typo in comments * m4/gethostname.m4: s/is is/it is/ * m4/getdomainname.m4: Likewise. --- ChangeLog | 6 ++++++ m4/getdomainname.m4 | 4 ++-- m4/gethostname.m4 | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15ef031ba0..110cee574d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-10 Jim Meyering + + maint: fix doubled-word typo in comment + * m4/gethostname.m4: s/is is/it is/ + * m4/getdomainname.m4: Likewise. + 2011-04-10 Jim Meyering maint: remove doubled word: s/it it/it/ diff --git a/m4/getdomainname.m4 b/m4/getdomainname.m4 index b4bf05251d..db7d480ed1 100644 --- a/m4/getdomainname.m4 +++ b/m4/getdomainname.m4 @@ -1,4 +1,4 @@ -# getdomainname.m4 serial 5 +# getdomainname.m4 serial 6 dnl Copyright (C) 2002-2003, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,7 +18,7 @@ AC_DEFUN([gl_FUNC_GETDOMAINNAME], dnl is discouraged, see dnl . dnl We need to avoid a collision with this function. - dnl - Otherwise is is in libc. + dnl - Otherwise it is in libc. AC_CHECK_FUNCS([getdomainname], , [ AC_CACHE_CHECK([for getdomainname in -lnsl], [gl_cv_func_getdomainname_in_libnsl], diff --git a/m4/gethostname.m4 b/m4/gethostname.m4 index 9bdfb7c70d..b813c36fb6 100644 --- a/m4/gethostname.m4 +++ b/m4/gethostname.m4 @@ -1,4 +1,4 @@ -# gethostname.m4 serial 10 +# gethostname.m4 serial 11 dnl Copyright (C) 2002, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,7 +14,7 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME], dnl Where is gethostname() defined? dnl - On native Windows, it is in ws2_32.dll. - dnl - Otherwise is is in libc. + dnl - Otherwise it is in libc. GETHOSTNAME_LIB= AC_CHECK_FUNCS([gethostname], , [ AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], -- cgit v1.2.1 From a81348d2e136b0f2de110b49a5d0dfa5d7d76f71 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 10 Apr 2011 10:26:46 +0200 Subject: maint.mk: prohibit doubled words Detect them also when they're separated by a newline. There are 3 ways to customize it: - disable the test on a per file basis, as usual with rules using $(VC_LIST_EXCEPT) - replace the default doubled-word-selecting regexp (affects all files) - ignore a particular file-vs-doubled-word match I nearly used that last one to ignore the "is is" match in coreutils' NEWS file, since the text was "ls -is is ..." To do that, I would have added this line to cfg.mk: ignore_doubled_word_match_RE_ = ^NEWS:[0-9]+:is[ ]is$ but it would have ignored any "is is" match in NEWS. Low probability, but still... Instead, I changed the text, slightly: - ls -is is now consistent with ls -lis in ignoring values returned + "ls -is" is now consistent with ls -lis in ignoring values returned * top/maint.mk (prohibit_double_word_RE_): Provide default. (prohibit_doubled_word_): Define. (sc_prohibit_doubled_word): New rule. (sc_prohibit_the_the): Remove. Subsumed by the above. --- ChangeLog | 23 +++++++++++++++++++++++ top/maint.mk | 23 +++++++++++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 110cee574d..365dd2f658 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2011-04-10 Jim Meyering + + maint.mk: prohibit doubled words + Detect them also when they're separated by a newline. + There are 3 ways to customize it: + - disable the test on a per file basis, as usual with rules using + $(VC_LIST_EXCEPT) + - replace the default doubled-word-selecting regexp (affects all files) + - ignore a particular file-vs-doubled-word match + I nearly used that last one to ignore the "is is" match in + coreutils' NEWS file, since the text was "ls -is is ..." + To do that, I would have added this line to cfg.mk: + ignore_doubled_word_match_RE_ = ^NEWS:[0-9]+:is[ ]is$ + but it would have ignored any "is is" match in NEWS. + Low probability, but still... + Instead, I changed the text, slightly: + - ls -is is now consistent with ls -lis in ignoring values returned + + "ls -is" is now consistent with ls -lis in ignoring values returned + * top/maint.mk (prohibit_double_word_RE_): Provide default. + (prohibit_doubled_word_): Define. + (sc_prohibit_doubled_word): New rule. + (sc_prohibit_the_the): Remove. Subsumed by the above. + 2011-04-10 Jim Meyering maint: fix doubled-word typo in comment diff --git a/top/maint.mk b/top/maint.mk index ada00be4dc..07a7773b9f 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -841,10 +841,25 @@ sc_prohibit_S_IS_definition: halt='do not define S_IS* macros; include ' \ $(_sc_search_regexp) -sc_prohibit_the_the: - @prohibit='\' \ - halt='avoid double "the"' \ - $(_sc_search_regexp) +prohibit_doubled_word_RE_ ?= \ + /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims +prohibit_doubled_word_ = \ + -e 'while ($(prohibit_doubled_word_RE_))' \ + -e ' {' \ + -e ' $$n = ($$` =~ tr/\n/\n/ + 1);' \ + -e ' ($$v = $$&) =~ s/\n/\\n/g;' \ + -e ' print "$$ARGV:$$n:$$v\n";' \ + -e ' }' + +# Define this to a regular expression that matches +# any filename:dd:match lines you want to ignore. +# The default is to ignore no matches. +ignore_doubled_word_match_RE_ ?= ^$$ + +sc_prohibit_doubled_word: + @perl -n -0777 $(prohibit_doubled_word_) $$($(VC_LIST_EXCEPT)) \ + | grep -vE '$(ignore_doubled_word_match_RE_)' \ + | grep . && { echo '$(ME): doubled words' 1>&2; exit 1; } || : sc_prohibit_can_not: @prohibit='\' \ -- cgit v1.2.1 From ca6143b425589c3a64bd28efd7af14463f96d576 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 11 Apr 2011 08:13:53 -0700 Subject: autoupdate --- build-aux/depcomp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build-aux/depcomp b/build-aux/depcomp index 43bd0f9bc1..53bee03e9c 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2011-04-09-11; # UTC +scriptversion=2011-04-11-05; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011 Free Software Foundation, Inc. @@ -166,10 +166,12 @@ gcc) ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as -## well. +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + sed -e 's/^\\$//' -e '/^$/d' -e -e "s|.*$object$||" '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; -- cgit v1.2.1 From fb799692f5bb43310424977e0ca15599fc68d776 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 12 Apr 2011 06:47:56 -0700 Subject: autoupdate --- build-aux/depcomp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-aux/depcomp b/build-aux/depcomp index 53bee03e9c..6149451aa9 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2011-04-11-05; # UTC +scriptversion=2011-04-11-10; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011 Free Software Foundation, Inc. @@ -170,7 +170,7 @@ gcc) ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e -e "s|.*$object$||" '/:$/d' \ + sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; -- cgit v1.2.1 From 836e0457064eb3b0b21bd2d4954cbc428a6b6277 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 13 Apr 2011 12:15:43 +0200 Subject: Support non-blocking pipe I/O in write() on native Windows. * lib/unistd.in.h (write): Enable replacement also if GNULIB_UNISTD_H_NONBLOCKING is 1. * lib/write.c: Enable replacement also if GNULIB_NONBLOCKING. (rpl_write): When failing to write on a non-blocking pipe, change errno from ENOSPC to EAGAIN. * lib/stdio.in.h (fprintf, fputc, fputs, fwrite, printf, putc, putchar, puts, vfprintf, vprintf): Enable replacement also if GNULIB_STDIO_H_NONBLOCKING is 1. * lib/stdio-write.c: Enable replacements also if GNULIB_NONBLOCKING. (CLEAR_ERRNO, HANDLE_ENOSPC): New macros. (CLEAR_LastError, HANDLE_ERROR_NO_DATA): New macros, extracted from CALL_WITH_SIGPIPE_EMULATION. (CALL_WITH_SIGPIPE_EMULATION): Use them. * m4/nonblocking.m4: New file. * m4/write.m4 (gl_FUNC_WRITE): Enable REPLACE_WRITE also if required for non-blocking I/O support. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_UNISTD_H_NONBLOCKING. * m4/stdio_h.m4 (gl_STDIO_H): Enable REPLACE_STDIO_WRITE_FUNCS also if required for non-blocking I/O support. (gl_STDIO_H_DEFAULTS): Initialize GNULIB_STDIO_H_NONBLOCKING. * modules/nonblocking (Files): Add m4/nonblocking.m4, lib/stdio-write.c, m4/asm-underscore.m4. (Depends-on): Add stdio, unistd. (configure.ac): Invoke gl_NONBLOCKING_IO. Define GNULIB_NONBLOCKING. Set GNULIB_STDIO_H_NONBLOCKING, GNULIB_UNISTD_H_NONBLOCKING. * modules/unistd (Makefile.am): Substitute GNULIB_UNISTD_H_NONBLOCKING. * modules/stdio (Makefile.am): Substitute GNULIB_STDIO_H_NONBLOCKING. * doc/posix-functions/fprintf.texi: Mention 'nonblocking' module and problem with non-blocking pipes. * doc/posix-functions/fputc.texi: Likewise. * doc/posix-functions/fputs.texi: Likewise. * doc/posix-functions/fwrite.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/putc.texi: Likewise. * doc/posix-functions/putchar.texi: Likewise. * doc/posix-functions/puts.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/write.texi: Likewise. --- ChangeLog | 44 ++++++++++++++++++++ doc/posix-functions/fprintf.texi | 11 ++++- doc/posix-functions/fputc.texi | 13 +++++- doc/posix-functions/fputs.texi | 13 +++++- doc/posix-functions/fwrite.texi | 13 +++++- doc/posix-functions/printf.texi | 11 ++++- doc/posix-functions/putc.texi | 13 +++++- doc/posix-functions/putchar.texi | 13 +++++- doc/posix-functions/puts.texi | 13 +++++- doc/posix-functions/vfprintf.texi | 11 ++++- doc/posix-functions/vprintf.texi | 11 ++++- doc/posix-functions/write.texi | 13 +++++- lib/stdio-write.c | 76 +++++++++++++++++++++++++++------- lib/stdio.in.h | 20 ++++----- lib/unistd.in.h | 2 +- lib/write.c | 40 +++++++++++++----- m4/nonblocking.m4 | 23 +++++++++++ m4/stdio_h.m4 | 13 +++++- m4/unistd_h.m4 | 85 ++++++++++++++++++++------------------- m4/write.m4 | 12 +++++- modules/nonblocking | 17 +++++++- modules/stdio | 1 + modules/unistd | 1 + 23 files changed, 370 insertions(+), 99 deletions(-) create mode 100644 m4/nonblocking.m4 diff --git a/ChangeLog b/ChangeLog index 365dd2f658..d01c6652c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ +2011-04-13 Bruno Haible + + Support non-blocking pipe I/O in write() on native Windows. + * lib/unistd.in.h (write): Enable replacement also if + GNULIB_UNISTD_H_NONBLOCKING is 1. + * lib/write.c: Enable replacement also if GNULIB_NONBLOCKING. + (rpl_write): When failing to write on a non-blocking pipe, change + errno from ENOSPC to EAGAIN. + * lib/stdio.in.h (fprintf, fputc, fputs, fwrite, printf, putc, + putchar, puts, vfprintf, vprintf): Enable replacement also if + GNULIB_STDIO_H_NONBLOCKING is 1. + * lib/stdio-write.c: Enable replacements also if GNULIB_NONBLOCKING. + (CLEAR_ERRNO, HANDLE_ENOSPC): New macros. + (CLEAR_LastError, HANDLE_ERROR_NO_DATA): New macros, extracted from + CALL_WITH_SIGPIPE_EMULATION. + (CALL_WITH_SIGPIPE_EMULATION): Use them. + * m4/nonblocking.m4: New file. + * m4/write.m4 (gl_FUNC_WRITE): Enable REPLACE_WRITE also if required + for non-blocking I/O support. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize + GNULIB_UNISTD_H_NONBLOCKING. + * m4/stdio_h.m4 (gl_STDIO_H): Enable REPLACE_STDIO_WRITE_FUNCS also if + required for non-blocking I/O support. + (gl_STDIO_H_DEFAULTS): Initialize GNULIB_STDIO_H_NONBLOCKING. + * modules/nonblocking (Files): Add m4/nonblocking.m4, + lib/stdio-write.c, m4/asm-underscore.m4. + (Depends-on): Add stdio, unistd. + (configure.ac): Invoke gl_NONBLOCKING_IO. Define GNULIB_NONBLOCKING. + Set GNULIB_STDIO_H_NONBLOCKING, GNULIB_UNISTD_H_NONBLOCKING. + * modules/unistd (Makefile.am): Substitute GNULIB_UNISTD_H_NONBLOCKING. + * modules/stdio (Makefile.am): Substitute GNULIB_STDIO_H_NONBLOCKING. + * doc/posix-functions/fprintf.texi: Mention 'nonblocking' module and + problem with non-blocking pipes. + * doc/posix-functions/fputc.texi: Likewise. + * doc/posix-functions/fputs.texi: Likewise. + * doc/posix-functions/fwrite.texi: Likewise. + * doc/posix-functions/printf.texi: Likewise. + * doc/posix-functions/putc.texi: Likewise. + * doc/posix-functions/putchar.texi: Likewise. + * doc/posix-functions/puts.texi: Likewise. + * doc/posix-functions/vfprintf.texi: Likewise. + * doc/posix-functions/vprintf.texi: Likewise. + * doc/posix-functions/write.texi: Likewise. + 2011-04-10 Jim Meyering maint.mk: prohibit doubled words diff --git a/doc/posix-functions/fprintf.texi b/doc/posix-functions/fprintf.texi index e922e85e08..04c4c72cae 100644 --- a/doc/posix-functions/fprintf.texi +++ b/doc/posix-functions/fprintf.texi @@ -4,7 +4,7 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fprintf.html} -Gnulib module: fprintf-posix or stdio, sigpipe +Gnulib module: fprintf-posix or stdio, nonblocking, sigpipe Portability problems fixed by Gnulib module @code{fprintf-posix}: @itemize @@ -64,6 +64,15 @@ This function can crash in out-of-memory conditions on some platforms: MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0. @end itemize +Portability problems fixed by Gnulib module @code{stdio} or @code{fprintf-posix}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + Portability problems fixed by Gnulib module @code{stdio} or @code{fprintf-posix}, together with module @code{sigpipe}: @itemize @item diff --git a/doc/posix-functions/fputc.texi b/doc/posix-functions/fputc.texi index 2f09a8a98f..9d6c9fd29c 100644 --- a/doc/posix-functions/fputc.texi +++ b/doc/posix-functions/fputc.texi @@ -4,9 +4,18 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fputc.html} -Gnulib module: stdio, sigpipe +Gnulib module: stdio, nonblocking, sigpipe -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}: @itemize @item When writing to a pipe with no readers, this function fails, instead of diff --git a/doc/posix-functions/fputs.texi b/doc/posix-functions/fputs.texi index d2c46ef8bd..7fc4bf5311 100644 --- a/doc/posix-functions/fputs.texi +++ b/doc/posix-functions/fputs.texi @@ -4,9 +4,18 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fputs.html} -Gnulib module: stdio, sigpipe +Gnulib module: stdio, nonblocking, sigpipe -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}: @itemize @item When writing to a pipe with no readers, this function fails, instead of diff --git a/doc/posix-functions/fwrite.texi b/doc/posix-functions/fwrite.texi index d9defec9c8..20f7fb8100 100644 --- a/doc/posix-functions/fwrite.texi +++ b/doc/posix-functions/fwrite.texi @@ -4,9 +4,18 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fwrite.html} -Gnulib module: stdio, sigpipe +Gnulib module: stdio, nonblocking, sigpipe -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}: @itemize @item When writing to a pipe with no readers, this function fails, instead of diff --git a/doc/posix-functions/printf.texi b/doc/posix-functions/printf.texi index eaee96a753..df7813f6a4 100644 --- a/doc/posix-functions/printf.texi +++ b/doc/posix-functions/printf.texi @@ -4,7 +4,7 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/printf.html} -Gnulib module: printf-posix or stdio, sigpipe +Gnulib module: printf-posix or stdio, nonblocking, sigpipe Portability problems fixed by Gnulib module @code{printf-posix}: @itemize @@ -64,6 +64,15 @@ This function can crash in out-of-memory conditions on some platforms: MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0. @end itemize +Portability problems fixed by Gnulib module @code{stdio} or @code{printf-posix}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + Portability problems fixed by Gnulib module @code{stdio} or @code{printf-posix}, together with module @code{sigpipe}: @itemize @item diff --git a/doc/posix-functions/putc.texi b/doc/posix-functions/putc.texi index b7011a01be..d156461ace 100644 --- a/doc/posix-functions/putc.texi +++ b/doc/posix-functions/putc.texi @@ -4,9 +4,18 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/putc.html} -Gnulib module: stdio, sigpipe +Gnulib module: stdio, nonblocking, sigpipe -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}: @itemize @item When writing to a pipe with no readers, this function fails, instead of diff --git a/doc/posix-functions/putchar.texi b/doc/posix-functions/putchar.texi index d89ab7189f..aeb6b4307c 100644 --- a/doc/posix-functions/putchar.texi +++ b/doc/posix-functions/putchar.texi @@ -4,9 +4,18 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/putchar.html} -Gnulib module: stdio, sigpipe +Gnulib module: stdio, nonblocking, sigpipe -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}: @itemize @item When writing to a pipe with no readers, this function fails, instead of diff --git a/doc/posix-functions/puts.texi b/doc/posix-functions/puts.texi index 69ee72e3de..ef350ac1b1 100644 --- a/doc/posix-functions/puts.texi +++ b/doc/posix-functions/puts.texi @@ -4,9 +4,18 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/puts.html} -Gnulib module: stdio, sigpipe +Gnulib module: stdio, nonblocking, sigpipe -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}: @itemize @item When writing to a pipe with no readers, this function fails, instead of diff --git a/doc/posix-functions/vfprintf.texi b/doc/posix-functions/vfprintf.texi index 7e502347de..b40a334167 100644 --- a/doc/posix-functions/vfprintf.texi +++ b/doc/posix-functions/vfprintf.texi @@ -4,7 +4,7 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vfprintf.html} -Gnulib module: vfprintf-posix or stdio, sigpipe +Gnulib module: vfprintf-posix or stdio, nonblocking, sigpipe Portability problems fixed by Gnulib module @code{vfprintf-posix}: @itemize @@ -64,6 +64,15 @@ This function can crash in out-of-memory conditions on some platforms: MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0. @end itemize +Portability problems fixed by Gnulib module @code{stdio} or @code{vfprintf-posix}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + Portability problems fixed by Gnulib module @code{stdio} or @code{vfprintf-posix}, together with module @code{sigpipe}: @itemize @item diff --git a/doc/posix-functions/vprintf.texi b/doc/posix-functions/vprintf.texi index 526070e22d..342d182c64 100644 --- a/doc/posix-functions/vprintf.texi +++ b/doc/posix-functions/vprintf.texi @@ -4,7 +4,7 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vprintf.html} -Gnulib module: vprintf-posix or stdio, sigpipe +Gnulib module: vprintf-posix or stdio, nonblocking, sigpipe Portability problems fixed by Gnulib module @code{vprintf-posix}: @itemize @@ -64,6 +64,15 @@ This function can crash in out-of-memory conditions on some platforms: MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0. @end itemize +Portability problems fixed by Gnulib module @code{stdio} or @code{vprintf-posix}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + Portability problems fixed by Gnulib module @code{stdio} or @code{vprintf-posix}, together with module @code{sigpipe}: @itemize @item diff --git a/doc/posix-functions/write.texi b/doc/posix-functions/write.texi index 826151c9ee..7587fbb9d9 100644 --- a/doc/posix-functions/write.texi +++ b/doc/posix-functions/write.texi @@ -4,9 +4,18 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/write.html} -Gnulib module: write, sigpipe +Gnulib module: write, nonblocking, sigpipe -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: +@itemize +@item +When writing to a non-blocking pipe whose buffer is full, this function fails +with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some +platforms: +mingw. +@end itemize + +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}: @itemize @item When writing to a pipe with no readers, this function fails with error diff --git a/lib/stdio-write.c b/lib/stdio-write.c index 10fcfba9e3..a586c35120 100644 --- a/lib/stdio-write.c +++ b/lib/stdio-write.c @@ -20,8 +20,9 @@ /* Specification. */ #include -/* Replace these functions only if module 'sigpipe' is requested. */ -#if GNULIB_SIGPIPE +/* Replace these functions only if module 'nonblocking' or module 'sigpipe' is + requested. */ +#if GNULIB_NONBLOCKING || GNULIB_SIGPIPE /* On native Windows platforms, SIGPIPE does not exist. When write() is called on a pipe with no readers, WriteFile() fails with error @@ -38,26 +39,73 @@ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include +# if GNULIB_NONBLOCKING +# define CLEAR_ERRNO \ + errno = 0; +# define HANDLE_ENOSPC \ + if (errno == ENOSPC && ferror (stream)) \ + { \ + int fd = fileno (stream); \ + if (fd >= 0) \ + { \ + HANDLE h = (HANDLE) _get_osfhandle (fd); \ + if (GetFileType (h) == FILE_TYPE_PIPE) \ + { \ + /* h is a pipe or socket. */ \ + DWORD state; \ + if (GetNamedPipeHandleState (h, &state, NULL, NULL, \ + NULL, NULL, 0) \ + && (state & PIPE_NOWAIT) != 0) \ + /* h is a pipe in non-blocking mode. \ + Change errno from ENOSPC to EAGAIN. */ \ + errno = EAGAIN; \ + } \ + } \ + } \ + else +# else +# define CLEAR_ERRNO +# define HANDLE_ENOSPC +# endif + +# if GNULIB_SIGPIPE +# define CLEAR_LastError \ + SetLastError (0); +# define HANDLE_ERROR_NO_DATA \ + if (GetLastError () == ERROR_NO_DATA && ferror (stream)) \ + { \ + int fd = fileno (stream); \ + if (fd >= 0 \ + && GetFileType ((HANDLE) _get_osfhandle (fd)) \ + == FILE_TYPE_PIPE) \ + { \ + /* Try to raise signal SIGPIPE. */ \ + raise (SIGPIPE); \ + /* If it is currently blocked or ignored, change errno from \ + EINVAL to EPIPE. */ \ + errno = EPIPE; \ + } \ + } \ + else +# else +# define CLEAR_LastError +# define HANDLE_ERROR_NO_DATA +# endif + # define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \ if (ferror (stream)) \ return (EXPRESSION); \ else \ { \ RETTYPE ret; \ - SetLastError (0); \ + CLEAR_ERRNO \ + CLEAR_LastError \ ret = (EXPRESSION); \ - if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \ + if (FAILED) \ { \ - int fd = fileno (stream); \ - if (fd >= 0 \ - && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\ - { \ - /* Try to raise signal SIGPIPE. */ \ - raise (SIGPIPE); \ - /* If it is currently blocked or ignored, change errno from \ - EINVAL to EPIPE. */ \ - errno = EPIPE; \ - } \ + HANDLE_ENOSPC \ + HANDLE_ERROR_NO_DATA \ + ; \ } \ return ret; \ } diff --git a/lib/stdio.in.h b/lib/stdio.in.h index f12d3be8e8..c209d6f904 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -203,7 +203,7 @@ _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - " #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ - || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) + || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fprintf rpl_fprintf # endif @@ -262,7 +262,7 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " #endif #if @GNULIB_FPUTC@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fputc # define fputc rpl_fputc @@ -276,7 +276,7 @@ _GL_CXXALIASWARN (fputc); #endif #if @GNULIB_FPUTS@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fputs # define fputs rpl_fputs @@ -506,7 +506,7 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " #if @GNULIB_FWRITE@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fwrite # define fwrite rpl_fwrite @@ -711,7 +711,7 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ - || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) + || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if defined __GNUC__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) /* Don't break __attribute__((format(printf,M,N))). */ @@ -760,7 +760,7 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " #endif #if @GNULIB_PUTC@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putc # define putc rpl_fputc @@ -774,7 +774,7 @@ _GL_CXXALIASWARN (putc); #endif #if @GNULIB_PUTCHAR@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putchar # define putchar rpl_putchar @@ -788,7 +788,7 @@ _GL_CXXALIASWARN (putchar); #endif #if @GNULIB_PUTS@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef puts # define puts rpl_puts @@ -1031,7 +1031,7 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ - || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) + || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vfprintf rpl_vfprintf # endif @@ -1067,7 +1067,7 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ - || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) + || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vprintf rpl_vprintf # endif diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 156e864f3c..10245c42eb 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1359,7 +1359,7 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - " /* Write up to COUNT bytes starting at BUF to file descriptor FD. See the POSIX:2001 specification . */ -# if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ +# if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef write # define write rpl_write diff --git a/lib/write.c b/lib/write.c index 4cf296255f..4b40cd31d1 100644 --- a/lib/write.c +++ b/lib/write.c @@ -20,8 +20,9 @@ /* Specification. */ #include -/* Replace this function only if module 'sigpipe' is requested. */ -#if GNULIB_SIGPIPE +/* Replace this function only if module 'nonblocking' or module 'sigpipe' is + requested. */ +#if GNULIB_NONBLOCKING || GNULIB_SIGPIPE /* On native Windows platforms, SIGPIPE does not exist. When write() is called on a pipe with no readers, WriteFile() fails with error @@ -45,14 +46,35 @@ rpl_write (int fd, const void *buf, size_t count) if (ret < 0) { - if (GetLastError () == ERROR_NO_DATA - && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE) +# if GNULIB_NONBLOCKING + if (errno == ENOSPC) { - /* Try to raise signal SIGPIPE. */ - raise (SIGPIPE); - /* If it is currently blocked or ignored, change errno from EINVAL - to EPIPE. */ - errno = EPIPE; + HANDLE h = (HANDLE) _get_osfhandle (fd); + if (GetFileType (h) == FILE_TYPE_PIPE) + { + /* h is a pipe or socket. */ + DWORD state; + if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0) + && (state & PIPE_NOWAIT) != 0) + /* h is a pipe in non-blocking mode. + Change errno from ENOSPC to EAGAIN. */ + errno = EAGAIN; + } + } + else +# endif + { +# if GNULIB_SIGPIPE + if (GetLastError () == ERROR_NO_DATA + && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE) + { + /* Try to raise signal SIGPIPE. */ + raise (SIGPIPE); + /* If it is currently blocked or ignored, change errno from + EINVAL to EPIPE. */ + errno = EPIPE; + } +# endif } } return ret; diff --git a/m4/nonblocking.m4 b/m4/nonblocking.m4 new file mode 100644 index 0000000000..8224626bef --- /dev/null +++ b/m4/nonblocking.m4 @@ -0,0 +1,23 @@ +# nonblocking.m4 serial 1 +dnl Copyright (C) 2011 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 Tests whether non-blocking I/O is natively supported by read(), write(). +dnl Sets gl_cv_have_nonblocking. +AC_DEFUN([gl_NONBLOCKING_IO], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_NONBLOCKING_IO_BODY]) +]) + +AC_DEFUN([gl_NONBLOCKING_IO_BODY], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) gl_cv_have_nonblocking=no ;; + *) gl_cv_have_nonblocking=yes ;; + esac +]) diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 7f3ae56295..a513689ab4 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 33 +# stdio_h.m4 serial 34 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,9 +28,17 @@ AC_DEFUN([gl_STDIO_H], gl_SIGNAL_SIGPIPE if test $gl_cv_header_signal_h_SIGPIPE != yes; then REPLACE_STDIO_WRITE_FUNCS=1 - AC_LIBOBJ([stdio-write]) fi ]) + m4_ifdef([gl_NONBLOCKING_IO], [ + gl_NONBLOCKING_IO + if test $gl_cv_have_nonblocking != yes; then + REPLACE_STDIO_WRITE_FUNCS=1 + fi + ]) + if test $REPLACE_STDIO_WRITE_FUNCS = 1; then + AC_LIBOBJ([stdio-write]) + fi dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not @@ -82,6 +90,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) + GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING]) GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index c81a1138e9..90feccbb49 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 53 +# unistd_h.m4 serial 54 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -52,47 +52,48 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ - GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) - GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) - GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) - GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) - GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) - GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) - GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) - GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) - GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) - GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) - GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) - GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) - GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) - GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) - GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) - GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) - GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) - GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) - GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) - GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) - GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) - GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) - GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) - GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) - GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) - 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]) - GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) - GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) - GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) - GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) - GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) - GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) - GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) - GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) - GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) - GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) + GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) + GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) + GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) + GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) + GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) + GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) + GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) + GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) + GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) + GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) + GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) + GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) + GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) + GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) + GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) + GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) + GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) + GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) + GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) + GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) + GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) + GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) + GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) + GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) + GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) + 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]) + GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) + GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) + GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) + GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) + GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) + GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING]) + GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) + GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) + GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) + GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) + GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) diff --git a/m4/write.m4 b/m4/write.m4 index 8695c89623..63ab5e4c08 100644 --- a/m4/write.m4 +++ b/m4/write.m4 @@ -1,4 +1,4 @@ -# write.m4 serial 1 +# write.m4 serial 2 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,7 +14,15 @@ AC_DEFUN([gl_FUNC_WRITE], gl_SIGNAL_SIGPIPE if test $gl_cv_header_signal_h_SIGPIPE != yes; then REPLACE_WRITE=1 - AC_LIBOBJ([write]) fi ]) + m4_ifdef([gl_NONBLOCKING_IO], [ + gl_NONBLOCKING_IO + if test $gl_cv_have_nonblocking != yes; then + REPLACE_WRITE=1 + fi + ]) + if test $REPLACE_WRITE = 1; then + AC_LIBOBJ([write]) + fi ]) diff --git a/modules/nonblocking b/modules/nonblocking index 604cc47c79..86816f314f 100644 --- a/modules/nonblocking +++ b/modules/nonblocking @@ -2,18 +2,33 @@ Description: Read, set or clear the non-blocking file descriptor flag. Files: -lib/nonblocking.c lib/nonblocking.h +lib/nonblocking.c +m4/nonblocking.m4 +lib/stdio-write.c +m4/asm-underscore.m4 Depends-on: fcntl-h ioctl open stdbool +stdio sys_socket +unistd configure.ac: +gl_NONBLOCKING_IO gl_FCNTL_MODULE_INDICATOR([nonblocking]) +dnl Define the C macro GNULIB_NONBLOCKING to 1. +gl_MODULE_INDICATOR([nonblocking]) +dnl Define the substituted variable GNULIB_STDIO_H_NONBLOCKING to 1. +AC_REQUIRE([gl_STDIO_H_DEFAULTS]) +AC_REQUIRE([gl_ASM_SYMBOL_PREFIX]) +GNULIB_STDIO_H_NONBLOCKING=1 +dnl Define the substituted variable GNULIB_UNISTD_H_NONBLOCKING to 1. +AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) +GNULIB_UNISTD_H_NONBLOCKING=1 Makefile.am: lib_SOURCES += nonblocking.c diff --git a/modules/stdio b/modules/stdio index db0790ff00..049ad7bf33 100644 --- a/modules/stdio +++ b/modules/stdio @@ -58,6 +58,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \ -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_STDIO_H_NONBLOCKING''@|$(GNULIB_STDIO_H_NONBLOCKING)|g' \ -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \ -e 's|@''GNULIB_TMPFILE''@|$(GNULIB_TMPFILE)|g' \ -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ diff --git a/modules/unistd b/modules/unistd index f6774ce96f..fde9f7d033 100644 --- a/modules/unistd +++ b/modules/unistd @@ -64,6 +64,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ + -e 's|@''GNULIB_UNISTD_H_NONBLOCKING''@|$(GNULIB_UNISTD_H_NONBLOCKING)|g' \ -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ -- cgit v1.2.1 From bedd70b830fb6947197b4718d3e7472a81d3ba41 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 14 Apr 2011 02:14:45 +0200 Subject: Support non-blocking pipe I/O and SIGPIPE in pwrite(). * modules/pwrite (Depends-on): Add 'write'. --- ChangeLog | 5 +++++ modules/pwrite | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index d01c6652c2..9d3809de03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-13 Bruno Haible + + Support non-blocking pipe I/O and SIGPIPE in pwrite(). + * modules/pwrite (Depends-on): Add 'write'. + 2011-04-13 Bruno Haible Support non-blocking pipe I/O in write() on native Windows. diff --git a/modules/pwrite b/modules/pwrite index b6511a2099..077036474d 100644 --- a/modules/pwrite +++ b/modules/pwrite @@ -9,6 +9,7 @@ Depends-on: extensions lseek unistd +write configure.ac: gl_FUNC_PWRITE -- cgit v1.2.1 From 3586d4e58a7a6f3df3e11b77990fa117cd8e8f51 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 14 Apr 2011 02:25:28 +0200 Subject: safe-write, full-read: Avoid unnecessary compilation units. * modules/safe-write (Files): Add lib/safe-read.c, m4/safe-read.m4. (Depends-on): Remove safe-read. Add ssize_t. * modules/full-read (Files): Add lib/full-write.c. (Depends-on): Add full-write. --- ChangeLog | 8 ++++++++ modules/full-read | 2 +- modules/safe-write | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d3809de03..09f68af287 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-04-13 Bruno Haible + + safe-write, full-read: Avoid unnecessary compilation units. + * modules/safe-write (Files): Add lib/safe-read.c, m4/safe-read.m4. + (Depends-on): Remove safe-read. Add ssize_t. + * modules/full-read (Files): Add lib/full-write.c. + (Depends-on): Add full-write. + 2011-04-13 Bruno Haible Support non-blocking pipe I/O and SIGPIPE in pwrite(). diff --git a/modules/full-read b/modules/full-read index d559911c07..5bae3ae5e2 100644 --- a/modules/full-read +++ b/modules/full-read @@ -4,10 +4,10 @@ An interface to the read() function that reads all it is asked to read. Files: lib/full-read.h lib/full-read.c +lib/full-write.c Depends-on: safe-read -full-write configure.ac: diff --git a/modules/safe-write b/modules/safe-write index 137c94a63e..cdc80d21f5 100644 --- a/modules/safe-write +++ b/modules/safe-write @@ -4,10 +4,12 @@ An interface to the write() function that retries after interrupts. Files: lib/safe-write.h lib/safe-write.c +lib/safe-read.c m4/safe-write.m4 +m4/safe-read.m4 Depends-on: -safe-read +ssize_t write configure.ac: -- cgit v1.2.1 From 93dca9da5d488fcf40c38f63d9762a9f54b1a8b0 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 14 Apr 2011 22:29:41 +0200 Subject: wchar: Ensure that wchar_t gets defined on uClibc. * lib/wchar.in.h: On uClibc, include . Reported by Giuseppe Scrivano . --- ChangeLog | 6 ++++++ lib/wchar.in.h | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 09f68af287..349e5fc77d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-14 Bruno Haible + + wchar: Ensure that wchar_t gets defined on uClibc. + * lib/wchar.in.h: On uClibc, include . + Reported by Giuseppe Scrivano . + 2011-04-13 Bruno Haible safe-write, full-read: Avoid unnecessary compilation units. diff --git a/lib/wchar.in.h b/lib/wchar.in.h index d2bf17d6eb..c7f306a9c0 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -61,9 +61,13 @@ . BSD/OS 4.0.1 has a bug: , and must be included before . + In some builds of uClibc, is nonexistent and wchar_t is defined + by . But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include +#endif +#ifndef __GLIBC__ # include # include #endif -- cgit v1.2.1 From 73899ad375e2b795e1caaac9a75b99bc87cd9aea Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 14 Apr 2011 23:42:01 +0200 Subject: Support non-blocking pipe I/O in write() on native Windows. * lib/write.c (rpl_write): Split a write request that failed merely because the byte count was larger than the pipe buffer's size. * doc/posix-functions/write.texi: Mention the problem with large byte counts. --- ChangeLog | 8 ++++ doc/posix-functions/write.texi | 6 +++ lib/write.c | 93 ++++++++++++++++++++++++++++++------------ 3 files changed, 80 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 349e5fc77d..1657a34662 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-04-14 Bruno Haible + + Support non-blocking pipe I/O in write() on native Windows. + * lib/write.c (rpl_write): Split a write request that failed merely + because the byte count was larger than the pipe buffer's size. + * doc/posix-functions/write.texi: Mention the problem with large byte + counts. + 2011-04-14 Bruno Haible wchar: Ensure that wchar_t gets defined on uClibc. diff --git a/doc/posix-functions/write.texi b/doc/posix-functions/write.texi index 7587fbb9d9..604507d30c 100644 --- a/doc/posix-functions/write.texi +++ b/doc/posix-functions/write.texi @@ -13,6 +13,12 @@ When writing to a non-blocking pipe whose buffer is full, this function fails with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some platforms: mingw. +@item +When writing to a non-blocking pipe on which no reader is currently waiting +an amount of bytes that exceeds the pipe buffer's size, then -- even if the +pipe's buffer is empty -- this function fails, instead of performing a partial +write into the pipe buffer, on some platforms: +mingw. @end itemize Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}: diff --git a/lib/write.c b/lib/write.c index 4b40cd31d1..b0ffa94e93 100644 --- a/lib/write.c +++ b/lib/write.c @@ -42,42 +42,81 @@ ssize_t rpl_write (int fd, const void *buf, size_t count) #undef write { - ssize_t ret = write (fd, buf, count); - - if (ret < 0) + for (;;) { -# if GNULIB_NONBLOCKING - if (errno == ENOSPC) + ssize_t ret = write (fd, buf, count); + + if (ret < 0) { - HANDLE h = (HANDLE) _get_osfhandle (fd); - if (GetFileType (h) == FILE_TYPE_PIPE) +# if GNULIB_NONBLOCKING + if (errno == ENOSPC) { - /* h is a pipe or socket. */ - DWORD state; - if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0) - && (state & PIPE_NOWAIT) != 0) - /* h is a pipe in non-blocking mode. - Change errno from ENOSPC to EAGAIN. */ - errno = EAGAIN; + HANDLE h = (HANDLE) _get_osfhandle (fd); + if (GetFileType (h) == FILE_TYPE_PIPE) + { + /* h is a pipe or socket. */ + DWORD state; + if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, + NULL, 0) + && (state & PIPE_NOWAIT) != 0) + { + /* h is a pipe in non-blocking mode. + We can get here in four situations: + 1. When the pipe buffer is full. + 2. When count <= pipe_buf_size and the number of + free bytes in the pipe buffer is < count. + 3. When count > pipe_buf_size and the number of free + bytes in the pipe buffer is > 0, < pipe_buf_size. + 4. When count > pipe_buf_size and the pipe buffer is + entirely empty. + The cases 1 and 2 are POSIX compliant. In cases 3 and + 4 POSIX specifies that write() must split the request + and succeed with a partial write. We fix case 4. + We don't fix case 3 because it is not essential for + programs. */ + DWORD out_size; /* size of the buffer for outgoing data */ + DWORD in_size; /* size of the buffer for incoming data */ + if (GetNamedPipeInfo (h, NULL, &out_size, &in_size, NULL)) + { + size_t reduced_count = count; + /* In theory we need only one of out_size, in_size. + But I don't know which of the two. The description + is ambiguous. */ + if (out_size != 0 && out_size < reduced_count) + reduced_count = out_size; + if (in_size != 0 && in_size < reduced_count) + reduced_count = in_size; + if (reduced_count < count) + { + /* Attempt to write only the first part. */ + count = reduced_count; + continue; + } + } + /* Change errno from ENOSPC to EAGAIN. */ + errno = EAGAIN; + } + } } - } - else + else # endif - { -# if GNULIB_SIGPIPE - if (GetLastError () == ERROR_NO_DATA - && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE) { - /* Try to raise signal SIGPIPE. */ - raise (SIGPIPE); - /* If it is currently blocked or ignored, change errno from - EINVAL to EPIPE. */ - errno = EPIPE; - } +# if GNULIB_SIGPIPE + if (GetLastError () == ERROR_NO_DATA + && GetFileType ((HANDLE) _get_osfhandle (fd)) + == FILE_TYPE_PIPE) + { + /* Try to raise signal SIGPIPE. */ + raise (SIGPIPE); + /* If it is currently blocked or ignored, change errno from + EINVAL to EPIPE. */ + errno = EPIPE; + } # endif + } } + return ret; } - return ret; } # endif -- cgit v1.2.1 From acc203f3da092e2ee94eff8f9c85e1fdc61315cf Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 15 Apr 2011 01:02:13 +0200 Subject: Support non-blocking pipe I/O in read() on native Windows. * lib/unistd.in.h: Include also for 'read'. (read): New declaration. * lib/read.c: New file. * lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT_SCANF, _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM): New macros. (fgetc, fgets, fread, fscanf, getc, getchar, gets, scanf, vfscanf, vscanf): New declarations. * lib/stdio-read.c: New file. * m4/read.m4: New file. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_READ, REPLACE_READ. * m4/stdio_h.m4 (gl_STDIO_H): Set GNULIB_FGETC, GNULIB_FGETS, GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF. In non-blocking I/O is desired and needs workarounds, set REPLACE_STDIO_READ_FUNCS. (gl_STDIO_H_DEFAULTS): Initialize GNULIB_FGETC, GNULIB_FGETS, GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS. * modules/read: New file. * modules/nonblocking (Files): Add lib/stdio-read.c. * modules/unistd (Makefile.am): Substitute GNULIB_READ, REPLACE_READ. * modules/stdio (Makefile.am): Substitute GNULIB_FGETC, GNULIB_FGETS, GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS. * modules/pread (Depends-on): Add read. * modules/safe-read (Depends-on): Likewise. * tests/test-stdio-c++.cc (fgetc, fgets, fread, fscanf, getc, getchar, gets, scanf, vfscanf, vscanf): Verify signatures. * doc/posix-functions/read.texi: Mention 'nonblocking' module and problem with non-blocking pipes. * doc/posix-functions/fgetc.texi: Likewise. * doc/posix-functions/fgets.texi: Likewise. * doc/posix-functions/fread.texi: Likewise. * doc/posix-functions/fscanf.texi: Likewise. * doc/posix-functions/getc.texi: Likewise. * doc/posix-functions/getchar.texi: Likewise. * doc/posix-functions/gets.texi: Likewise. * doc/posix-functions/scanf.texi: Likewise. * doc/posix-functions/vfscanf.texi: Likewise. * doc/posix-functions/vscanf.texi: Likewise. --- ChangeLog | 44 +++++++++ doc/posix-functions/fgetc.texi | 9 +- doc/posix-functions/fgets.texi | 9 +- doc/posix-functions/fread.texi | 9 +- doc/posix-functions/fscanf.texi | 9 +- doc/posix-functions/getc.texi | 9 +- doc/posix-functions/getchar.texi | 9 +- doc/posix-functions/gets.texi | 9 +- doc/posix-functions/read.texi | 9 +- doc/posix-functions/scanf.texi | 9 +- doc/posix-functions/vfscanf.texi | 9 +- doc/posix-functions/vscanf.texi | 9 +- lib/read.c | 59 ++++++++++++ lib/stdio-read.c | 148 +++++++++++++++++++++++++++++ lib/stdio.in.h | 197 ++++++++++++++++++++++++++++++++++++++- lib/unistd.in.h | 25 ++++- m4/read.m4 | 20 ++++ m4/stdio_h.m4 | 37 +++++++- m4/unistd_h.m4 | 4 +- modules/nonblocking | 1 + modules/pread | 1 + modules/read | 24 +++++ modules/safe-read | 1 + modules/stdio | 11 +++ modules/unistd | 2 + tests/test-stdio-c++.cc | 42 +++++++++ 26 files changed, 685 insertions(+), 30 deletions(-) create mode 100644 lib/read.c create mode 100644 lib/stdio-read.c create mode 100644 m4/read.m4 create mode 100644 modules/read diff --git a/ChangeLog b/ChangeLog index 1657a34662..b6fdfddb1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ +2011-04-14 Bruno Haible + + Support non-blocking pipe I/O in read() on native Windows. + * lib/unistd.in.h: Include also for 'read'. + (read): New declaration. + * lib/read.c: New file. + * lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT_SCANF, + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM): New macros. + (fgetc, fgets, fread, fscanf, getc, getchar, gets, scanf, vfscanf, + vscanf): New declarations. + * lib/stdio-read.c: New file. + * m4/read.m4: New file. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_READ, + REPLACE_READ. + * m4/stdio_h.m4 (gl_STDIO_H): Set GNULIB_FGETC, GNULIB_FGETS, + GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, + GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF. In non-blocking I/O is + desired and needs workarounds, set REPLACE_STDIO_READ_FUNCS. + (gl_STDIO_H_DEFAULTS): Initialize GNULIB_FGETC, GNULIB_FGETS, + GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, + GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS. + * modules/read: New file. + * modules/nonblocking (Files): Add lib/stdio-read.c. + * modules/unistd (Makefile.am): Substitute GNULIB_READ, REPLACE_READ. + * modules/stdio (Makefile.am): Substitute GNULIB_FGETC, GNULIB_FGETS, + GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, + GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS. + * modules/pread (Depends-on): Add read. + * modules/safe-read (Depends-on): Likewise. + * tests/test-stdio-c++.cc (fgetc, fgets, fread, fscanf, getc, getchar, + gets, scanf, vfscanf, vscanf): Verify signatures. + * doc/posix-functions/read.texi: Mention 'nonblocking' module and + problem with non-blocking pipes. + * doc/posix-functions/fgetc.texi: Likewise. + * doc/posix-functions/fgets.texi: Likewise. + * doc/posix-functions/fread.texi: Likewise. + * doc/posix-functions/fscanf.texi: Likewise. + * doc/posix-functions/getc.texi: Likewise. + * doc/posix-functions/getchar.texi: Likewise. + * doc/posix-functions/gets.texi: Likewise. + * doc/posix-functions/scanf.texi: Likewise. + * doc/posix-functions/vfscanf.texi: Likewise. + * doc/posix-functions/vscanf.texi: Likewise. + 2011-04-14 Bruno Haible Support non-blocking pipe I/O in write() on native Windows. diff --git a/doc/posix-functions/fgetc.texi b/doc/posix-functions/fgetc.texi index 057efe78ab..4cbe30eb6a 100644 --- a/doc/posix-functions/fgetc.texi +++ b/doc/posix-functions/fgetc.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fgetc.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/fgets.texi b/doc/posix-functions/fgets.texi index fd0744e106..2d840b168b 100644 --- a/doc/posix-functions/fgets.texi +++ b/doc/posix-functions/fgets.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fgets.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/fread.texi b/doc/posix-functions/fread.texi index 6f02f51f55..57155c22f2 100644 --- a/doc/posix-functions/fread.texi +++ b/doc/posix-functions/fread.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fread.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/fscanf.texi b/doc/posix-functions/fscanf.texi index 49d528a5f4..1c47ec2cce 100644 --- a/doc/posix-functions/fscanf.texi +++ b/doc/posix-functions/fscanf.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fscanf.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/getc.texi b/doc/posix-functions/getc.texi index 7c92ab4d16..fea05113af 100644 --- a/doc/posix-functions/getc.texi +++ b/doc/posix-functions/getc.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getc.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/getchar.texi b/doc/posix-functions/getchar.texi index d365f8d3ac..3b11d99343 100644 --- a/doc/posix-functions/getchar.texi +++ b/doc/posix-functions/getchar.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getchar.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/gets.texi b/doc/posix-functions/gets.texi index af29450a8c..1a3b277439 100644 --- a/doc/posix-functions/gets.texi +++ b/doc/posix-functions/gets.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/gets.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/read.texi b/doc/posix-functions/read.texi index 385fb77b0f..2f5312de84 100644 --- a/doc/posix-functions/read.texi +++ b/doc/posix-functions/read.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/read.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/scanf.texi b/doc/posix-functions/scanf.texi index fbca16749a..f29378c097 100644 --- a/doc/posix-functions/scanf.texi +++ b/doc/posix-functions/scanf.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/scanf.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/vfscanf.texi b/doc/posix-functions/vfscanf.texi index 9f3da4da28..bbdfe06e41 100644 --- a/doc/posix-functions/vfscanf.texi +++ b/doc/posix-functions/vfscanf.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vfscanf.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/vscanf.texi b/doc/posix-functions/vscanf.texi index 980f1a8a92..0568ab45c4 100644 --- a/doc/posix-functions/vscanf.texi +++ b/doc/posix-functions/vscanf.texi @@ -4,10 +4,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vscanf.html} -Gnulib module: --- +Gnulib module: stdio, nonblocking -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: @itemize +@item +When reading from a non-blocking pipe whose buffer is empty, this function +fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on +some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/read.c b/lib/read.c new file mode 100644 index 0000000000..21b90db675 --- /dev/null +++ b/lib/read.c @@ -0,0 +1,59 @@ +/* POSIX compatible read() function. + Copyright (C) 2008-2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. + + 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 . */ + +#include + +/* Specification. */ +#include + +/* Replace this function only if module 'nonblocking' is requested. */ +#if GNULIB_NONBLOCKING + +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +# include +# include + +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ +# include + +ssize_t +rpl_read (int fd, void *buf, size_t count) +#undef read +{ + ssize_t ret = read (fd, buf, count); + + if (ret < 0 + && GetLastError () == ERROR_NO_DATA) + { + HANDLE h = (HANDLE) _get_osfhandle (fd); + if (GetFileType (h) == FILE_TYPE_PIPE) + { + /* h is a pipe or socket. */ + DWORD state; + if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0) + && (state & PIPE_NOWAIT) != 0) + /* h is a pipe in non-blocking mode. + Change errno from EINVAL to EAGAIN. */ + errno = EAGAIN; + } + } + return ret; +} + +# endif +#endif diff --git a/lib/stdio-read.c b/lib/stdio-read.c new file mode 100644 index 0000000000..d7901dd676 --- /dev/null +++ b/lib/stdio-read.c @@ -0,0 +1,148 @@ +/* POSIX compatible FILE stream read function. + Copyright (C) 2008-2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. + + 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 . */ + +#include + +/* Specification. */ +#include + +/* Replace these functions only if module 'nonblocking' is requested. */ +#if GNULIB_NONBLOCKING + +/* On native Windows platforms, when read() is called on a non-blocking pipe + with an empty buffer, ReadFile() fails with error GetLastError() = + ERROR_NO_DATA, and read() in consequence fails with error EINVAL. This + read() function is at the basis of the function which fills the buffer of + a FILE stream. */ + +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +# include +# include + +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ +# include + +# define CALL_WITH_ERRNO_FIX(RETTYPE, EXPRESSION, FAILED) \ + if (ferror (stream)) \ + return (EXPRESSION); \ + else \ + { \ + RETTYPE ret; \ + SetLastError (0); \ + ret = (EXPRESSION); \ + if (FAILED) \ + { \ + if (GetLastError () == ERROR_NO_DATA && ferror (stream)) \ + { \ + int fd = fileno (stream); \ + if (fd >= 0) \ + { \ + HANDLE h = (HANDLE) _get_osfhandle (fd); \ + if (GetFileType (h) == FILE_TYPE_PIPE) \ + { \ + /* h is a pipe or socket. */ \ + DWORD state; \ + if (GetNamedPipeHandleState (h, &state, NULL, NULL, \ + NULL, NULL, 0) \ + && (state & PIPE_NOWAIT) != 0) \ + /* h is a pipe in non-blocking mode. \ + Change errno from EINVAL to EAGAIN. */ \ + errno = EAGAIN; \ + } \ + } \ + } \ + } \ + return ret; \ + } + +int +scanf (const char *format, ...) +{ + int retval; + va_list args; + + va_start (args, format); + retval = vfscanf (stdin, format, args); + va_end (args); + + return retval; +} + +int +fscanf (FILE *stream, const char *format, ...) +{ + int retval; + va_list args; + + va_start (args, format); + retval = vfscanf (stream, format, args); + va_end (args); + + return retval; +} + +int +vscanf (const char *format, va_list args) +{ + return vfscanf (stdin, format, args); +} + +int +vfscanf (FILE *stream, const char *format, va_list args) +#undef vfscanf +{ + CALL_WITH_ERRNO_FIX (int, vfscanf (stream, format, args), ret == EOF) +} + +int +getchar (void) +{ + return fgetc (stdin); +} + +int +fgetc (FILE *stream) +#undef fgetc +{ + CALL_WITH_ERRNO_FIX (int, fgetc (stream), ret == EOF) +} + +char * +fgets (char *s, int n, FILE *stream) +#undef fgets +{ + CALL_WITH_ERRNO_FIX (char *, fgets (s, n, stream), ret == NULL) +} + +char * +gets (char *s) +#undef gets +{ + FILE *stream = stdin; + CALL_WITH_ERRNO_FIX (char *, gets (s), ret == NULL) +} + +size_t +fread (void *ptr, size_t s, size_t n, FILE *stream) +#undef fread +{ + CALL_WITH_ERRNO_FIX (size_t, fread (ptr, s, n, stream), ret < n) +} + +# endif +#endif diff --git a/lib/stdio.in.h b/lib/stdio.in.h index c209d6f904..79e7f7d8aa 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -87,6 +87,25 @@ #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) +/* _GL_ATTRIBUTE_FORMAT_SCANF + indicates to GCC that the function takes a format string and arguments, + where the format string directives are the ones standardized by ISO C99 + and POSIX. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) +#else +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) +#endif + +/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, + except that it indicates to GCC that the supported format string directives + are the ones of the system scanf(), rather than the ones standardized by + ISO C99 and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) + /* Solaris 10 declares renameat in , not in . */ /* But in any case avoid namespace pollution on glibc systems. */ #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ @@ -175,11 +194,34 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " "use gnulib module fflush for portable POSIX compliance"); #endif -/* It is very rare that the developer ever has full control of stdin, - so any use of gets warrants an unconditional warning. Assume it is - always declared, since it is required by C89. */ -#undef gets -_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); +#if @GNULIB_FGETC@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fgetc +# define fgetc rpl_fgetc +# endif +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); +# endif +_GL_CXXALIASWARN (fgetc); +#endif + +#if @GNULIB_FGETS@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fgets +# define fgets rpl_fgets +# endif +_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream) + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream)); +# else +_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); +# endif +_GL_CXXALIASWARN (fgets); +#endif #if @GNULIB_FOPEN@ # if @REPLACE_FOPEN@ @@ -290,6 +332,21 @@ _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); _GL_CXXALIASWARN (fputs); #endif +#if @GNULIB_FREAD@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fread +# define fread rpl_fread +# endif +_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream) + _GL_ARG_NONNULL ((4))); +_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); +# else +_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); +# endif +_GL_CXXALIASWARN (fread); +#endif + #if @GNULIB_FREOPEN@ # if @REPLACE_FREOPEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -314,6 +371,22 @@ _GL_WARN_ON_USE (freopen, "use gnulib module freopen for portability"); #endif +#if @GNULIB_FSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fscanf +# define fscanf rpl_fscanf +# endif +_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...)); +# else +_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); +# endif +_GL_CXXALIASWARN (fscanf); +#endif + /* Set up the following warnings, based on which modules are in use. GNU Coding Standards discourage the use of fseek, since it imposes @@ -540,6 +613,34 @@ rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream) _GL_CXXALIASWARN (fwrite); #endif +#if @GNULIB_GETC@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getc +# define getc rpl_fgetc +# endif +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); +# endif +_GL_CXXALIASWARN (getc); +#endif + +#if @GNULIB_GETCHAR@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getchar +# define getchar rpl_getchar +# endif +_GL_FUNCDECL_RPL (getchar, int, (void)); +_GL_CXXALIAS_RPL (getchar, int, (void)); +# else +_GL_CXXALIAS_SYS (getchar, int, (void)); +# endif +_GL_CXXALIASWARN (getchar); +#endif + #if @GNULIB_GETDELIM@ /* Read input, up to (and including) the next occurrence of DELIMITER, from STREAM, store it in *LINEPTR (and NUL-terminate it). @@ -616,6 +717,26 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " # endif #endif +#if @GNULIB_GETS@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gets +# define gets rpl_gets +# endif +_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (gets, char *, (char *s)); +# else +_GL_CXXALIAS_SYS (gets, char *, (char *s)); +# undef gets +# endif +_GL_CXXALIASWARN (gets); +/* It is very rare that the developer ever has full control of stdin, + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ +_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); +#endif + + #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ struct obstack; /* Grow an obstack with formatted output. Return the number of @@ -872,6 +993,37 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - " # endif #endif +#if @GNULIB_SCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if defined __GNUC__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef scanf +/* Don't break __attribute__((format(scanf,M,N))). */ +# define scanf __scanf__ +# endif +_GL_FUNCDECL_RPL_1 (__scanf__, int, + (const char *format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...)); +# else +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef scanf +# define scanf rpl_scanf +# endif +_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...)); +# endif +# else +_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); +# endif +_GL_CXXALIASWARN (scanf); +#endif + #if @GNULIB_SNPRINTF@ # if @REPLACE_SNPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1065,6 +1217,25 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " "POSIX compliance"); #endif +#if @GNULIB_VFSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vfscanf +# define vfscanf rpl_vfscanf +# endif +_GL_FUNCDECL_RPL (vfscanf, int, + (FILE *stream, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (vfscanf, int, + (FILE *stream, const char *format, va_list args)); +# else +_GL_CXXALIAS_SYS (vfscanf, int, + (FILE *stream, const char *format, va_list args)); +# endif +_GL_CXXALIASWARN (vfscanf); +#endif + #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) @@ -1100,6 +1271,22 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " "POSIX compliance"); #endif +#if @GNULIB_VSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vscanf +# define vscanf rpl_vscanf +# endif +_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args)); +# else +_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args)); +# endif +_GL_CXXALIASWARN (vscanf); +#endif + #if @GNULIB_VSNPRINTF@ # if @REPLACE_VSNPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 10245c42eb..d216e38515 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -97,7 +97,8 @@ # include #endif -#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ +#if (@GNULIB_READ@ || @GNULIB_WRITE@ \ + || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) /* Get ssize_t. */ # include @@ -1105,6 +1106,28 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " #endif +#if @GNULIB_READ@ +/* Read up to COUNT bytes from file descriptor FD into the buffer starting + at BUF. See the POSIX:2001 specification + . */ +# if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef read +# define read rpl_read +# endif +_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); +# else +/* Need to cast, because on mingw, the third parameter is + unsigned int count + and the return type is 'int'. */ +_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count)); +# endif +_GL_CXXALIASWARN (read); +#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 diff --git a/m4/read.m4 b/m4/read.m4 new file mode 100644 index 0000000000..032761f1ba --- /dev/null +++ b/m4/read.m4 @@ -0,0 +1,20 @@ +# read.m4 serial 1 +dnl Copyright (C) 2011 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. + +AC_DEFUN([gl_FUNC_READ], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + dnl This ifdef is just an optimization, to avoid performing a configure + dnl check whose result is not used. It does not make the test of + dnl GNULIB_UNISTD_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. + m4_ifdef([gl_NONBLOCKING_IO], [ + gl_NONBLOCKING_IO + if test $gl_cv_have_nonblocking != yes; then + REPLACE_READ=1 + AC_LIBOBJ([read]) + fi + ]) +]) diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index a513689ab4..8a351363e6 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 34 +# stdio_h.m4 serial 35 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,6 +9,30 @@ AC_DEFUN([gl_STDIO_H], AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([AC_C_INLINE]) gl_NEXT_HEADERS([stdio.h]) + + dnl No need to create extra modules for these functions. Everyone who uses + dnl likely needs them. + GNULIB_FSCANF=1 + GNULIB_SCANF=1 + GNULIB_VFSCANF=1 + GNULIB_VSCANF=1 + GNULIB_FGETC=1 + GNULIB_GETC=1 + GNULIB_GETCHAR=1 + GNULIB_FGETS=1 + GNULIB_GETS=1 + GNULIB_FREAD=1 + dnl This ifdef is just an optimization, to avoid performing a configure + dnl check whose result is not used. It does not make the test of + dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. + m4_ifdef([gl_NONBLOCKING_IO], [ + gl_NONBLOCKING_IO + if test $gl_cv_have_nonblocking != yes; then + REPLACE_STDIO_READ_FUNCS=1 + AC_LIBOBJ([stdio-read]) + fi + ]) + dnl No need to create extra modules for these functions. Everyone who uses dnl likely needs them. GNULIB_FPRINTF=1 @@ -62,20 +86,27 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) + GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC]) + GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS]) GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) + GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD]) GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) + GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF]) GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) + GNULIB_GETC=0; AC_SUBST([GNULIB_GETC]) + GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR]) GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) + GNULIB_GETS=0; AC_SUBST([GNULIB_GETS]) GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) @@ -88,12 +119,15 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) + GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF]) GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING]) GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) + GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF]) + GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF]) GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) @@ -138,6 +172,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT]) REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) + REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS]) REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE]) REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 90feccbb49..eeb3360b05 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 54 +# unistd_h.m4 serial 55 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -80,6 +80,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) + GNULIB_READ=0; AC_SUBST([GNULIB_READ]) GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) @@ -148,6 +149,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) + REPLACE_READ=0; AC_SUBST([REPLACE_READ]) REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) diff --git a/modules/nonblocking b/modules/nonblocking index 86816f314f..cce41db972 100644 --- a/modules/nonblocking +++ b/modules/nonblocking @@ -5,6 +5,7 @@ Files: lib/nonblocking.h lib/nonblocking.c m4/nonblocking.m4 +lib/stdio-read.c lib/stdio-write.c m4/asm-underscore.m4 diff --git a/modules/pread b/modules/pread index 4c6e6ecda5..0ae6e741f5 100644 --- a/modules/pread +++ b/modules/pread @@ -8,6 +8,7 @@ m4/pread.m4 Depends-on: extensions lseek +read unistd configure.ac: diff --git a/modules/read b/modules/read new file mode 100644 index 0000000000..85a9e02bbf --- /dev/null +++ b/modules/read @@ -0,0 +1,24 @@ +Description: +POSIX compatible read() function: read data from a file descriptor + +Files: +lib/read.c +m4/read.m4 + +Depends-on: +unistd + +configure.ac: +gl_FUNC_READ +gl_UNISTD_MODULE_INDICATOR([read]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Bruno Haible diff --git a/modules/safe-read b/modules/safe-read index 533d83bbf7..89e79a9b67 100644 --- a/modules/safe-read +++ b/modules/safe-read @@ -7,6 +7,7 @@ lib/safe-read.c m4/safe-read.m4 Depends-on: +read ssize_t configure.ac: diff --git a/modules/stdio b/modules/stdio index 049ad7bf33..376e75f1f5 100644 --- a/modules/stdio +++ b/modules/stdio @@ -30,20 +30,27 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \ -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \ -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ + -e 's|@''GNULIB_FGETC''@|$(GNULIB_FGETC)|g' \ + -e 's|@''GNULIB_FGETS''@|$(GNULIB_FGETS)|g' \ -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \ -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \ -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \ + -e 's|@''GNULIB_FREAD''@|$(GNULIB_FREAD)|g' \ -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ + -e 's|@''GNULIB_FSCANF''@|$(GNULIB_FSCANF)|g' \ -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \ + -e 's|@''GNULIB_GETC''@|$(GNULIB_GETC)|g' \ + -e 's|@''GNULIB_GETCHAR''@|$(GNULIB_GETCHAR)|g' \ -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ + -e 's|@''GNULIB_GETS''@|$(GNULIB_GETS)|g' \ -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \ @@ -56,6 +63,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \ -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \ -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \ + -e 's|@''GNULIB_SCANF''@|$(GNULIB_SCANF)|g' \ -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ -e 's|@''GNULIB_STDIO_H_NONBLOCKING''@|$(GNULIB_STDIO_H_NONBLOCKING)|g' \ @@ -65,6 +73,8 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \ -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \ -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VFSCANF''@|$(GNULIB_VFSCANF)|g' \ + -e 's|@''GNULIB_VSCANF''@|$(GNULIB_VSCANF)|g' \ -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \ -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ @@ -106,6 +116,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ + -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \ -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ diff --git a/modules/unistd b/modules/unistd index fde9f7d033..0636a1bf1b 100644 --- a/modules/unistd +++ b/modules/unistd @@ -56,6 +56,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \ + -e 's|@''GNULIB_READ''@|$(GNULIB_READ)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ @@ -125,6 +126,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ + -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ diff --git a/tests/test-stdio-c++.cc b/tests/test-stdio-c++.cc index a9d00a39f8..07faf0fa02 100644 --- a/tests/test-stdio-c++.cc +++ b/tests/test-stdio-c++.cc @@ -36,6 +36,14 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::fclose, int, (FILE *)); SIGNATURE_CHECK (GNULIB_NAMESPACE::fflush, int, (FILE *)); #endif +#if GNULIB_TEST_FGETC +SIGNATURE_CHECK (GNULIB_NAMESPACE::fgetc, int, (FILE *)); +#endif + +#if GNULIB_TEST_FGETS +SIGNATURE_CHECK (GNULIB_NAMESPACE::fgets, char *, (char *, int, FILE *)); +#endif + #if GNULIB_TEST_FOPEN SIGNATURE_CHECK (GNULIB_NAMESPACE::fopen, FILE *, (const char *, const char *)); @@ -57,11 +65,20 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::fputc, int, (int, FILE *)); SIGNATURE_CHECK (GNULIB_NAMESPACE::fputs, int, (const char *, FILE *)); #endif +#if GNULIB_TEST_FREAD +SIGNATURE_CHECK (GNULIB_NAMESPACE::fread, size_t, + (void *, size_t, size_t, FILE *)); +#endif + #if GNULIB_TEST_FREOPEN SIGNATURE_CHECK (GNULIB_NAMESPACE::freopen, FILE *, (const char *, const char *, FILE *)); #endif +#if GNULIB_TEST_FSCANF +SIGNATURE_CHECK (GNULIB_NAMESPACE::fscanf, int, (FILE *, const char *, ...)); +#endif + #if GNULIB_TEST_FSEEK SIGNATURE_CHECK (GNULIB_NAMESPACE::fseek, int, (FILE *, long, int)); #endif @@ -83,6 +100,14 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::fwrite, size_t, (const void *, size_t, size_t, FILE *)); #endif +#if GNULIB_TEST_GETC +SIGNATURE_CHECK (GNULIB_NAMESPACE::getc, int, (FILE *)); +#endif + +#if GNULIB_TEST_GETCHAR +SIGNATURE_CHECK (GNULIB_NAMESPACE::getchar, int, (void)); +#endif + #if GNULIB_TEST_GETDELIM SIGNATURE_CHECK (GNULIB_NAMESPACE::getdelim, ssize_t, (char **, size_t *, int, FILE *)); @@ -93,6 +118,10 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::getline, ssize_t, (char **, size_t *, FILE *)); #endif +#if GNULIB_TEST_GETS +SIGNATURE_CHECK (GNULIB_NAMESPACE::gets, char *, (char *)); +#endif + #if GNULIB_TEST_OBSTACK_PRINTF || GNULIB_TEST_OBSTACK_PRINTF_POSIX SIGNATURE_CHECK (GNULIB_NAMESPACE::obstack_printf, int, (struct obstack *, const char *, ...)); @@ -140,6 +169,10 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::renameat, int, (int, char const *, int, char const *)); #endif +#if GNULIB_TEST_SCANF +SIGNATURE_CHECK (GNULIB_NAMESPACE::scanf, int, (const char *, ...)); +#endif + #if GNULIB_TEST_SNPRINTF SIGNATURE_CHECK (GNULIB_NAMESPACE::snprintf, int, (char *, size_t, const char *, ...)); @@ -170,10 +203,19 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::vfprintf, int, (FILE *, const char *, va_list)); #endif +#if GNULIB_TEST_VFSCANF +SIGNATURE_CHECK (GNULIB_NAMESPACE::vfscanf, int, + (FILE *, const char *, va_list)); +#endif + #if GNULIB_TEST_VPRINTF_POSIX || GNULIB_TEST_VPRINTF SIGNATURE_CHECK (GNULIB_NAMESPACE::vprintf, int, (const char *, va_list)); #endif +#if GNULIB_TEST_VSCANF +SIGNATURE_CHECK (GNULIB_NAMESPACE::vscanf, int, (const char *, va_list)); +#endif + #if GNULIB_TEST_VSNPRINTF SIGNATURE_CHECK (GNULIB_NAMESPACE::vsnprintf, int, (char *, size_t, const char *, va_list)); -- cgit v1.2.1 From 61a6a26974843b935539a6fb0098d802195a7383 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 15 Apr 2011 10:46:01 +0200 Subject: Don't require lib/stdio-write.c when only module 'stdio' is used. * m4/stdio_h.m4 (gl_STDIO_H): Move the AC_LIBOBJ back into the m4_ifdef invocation. Reported by Rob Vermaas . --- ChangeLog | 7 +++++++ m4/stdio_h.m4 | 28 ++++++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6fdfddb1c..580cfa34e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-15 Bruno Haible + + Don't require lib/stdio-write.c when only module 'stdio' is used. + * m4/stdio_h.m4 (gl_STDIO_H): Move the AC_LIBOBJ back into the m4_ifdef + invocation. + Reported by Rob Vermaas . + 2011-04-14 Bruno Haible Support non-blocking pipe I/O in read() on native Windows. diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 8a351363e6..8b013c2f35 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 35 +# stdio_h.m4 serial 36 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -22,9 +22,11 @@ AC_DEFUN([gl_STDIO_H], GNULIB_FGETS=1 GNULIB_GETS=1 GNULIB_FREAD=1 - dnl This ifdef is just an optimization, to avoid performing a configure - dnl check whose result is not used. It does not make the test of - dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is + dnl also an optimization, to avoid performing a configure check whose result + dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING + dnl or GNULIB_NONBLOCKING redundant. m4_ifdef([gl_NONBLOCKING_IO], [ gl_NONBLOCKING_IO if test $gl_cv_have_nonblocking != yes; then @@ -45,24 +47,30 @@ AC_DEFUN([gl_STDIO_H], GNULIB_FPUTS=1 GNULIB_PUTS=1 GNULIB_FWRITE=1 - dnl This ifdef is just an optimization, to avoid performing a configure - dnl check whose result is not used. It does not make the test of - dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant. + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is + dnl also an optimization, to avoid performing a configure check whose result + dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or + dnl GNULIB_SIGPIPE redundant. m4_ifdef([gl_SIGNAL_SIGPIPE], [ gl_SIGNAL_SIGPIPE if test $gl_cv_header_signal_h_SIGPIPE != yes; then REPLACE_STDIO_WRITE_FUNCS=1 + AC_LIBOBJ([stdio-write]) fi ]) + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is + dnl also an optimization, to avoid performing a configure check whose result + dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING + dnl or GNULIB_NONBLOCKING redundant. m4_ifdef([gl_NONBLOCKING_IO], [ gl_NONBLOCKING_IO if test $gl_cv_have_nonblocking != yes; then REPLACE_STDIO_WRITE_FUNCS=1 + AC_LIBOBJ([stdio-write]) fi ]) - if test $REPLACE_STDIO_WRITE_FUNCS = 1; then - AC_LIBOBJ([stdio-write]) - fi dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not -- cgit v1.2.1 From 2aa729ac6af316bc30111144684a51c4650d5c44 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 15 Apr 2011 13:53:50 -0600 Subject: strchrnul: work around cygwin bug A misplaced * means that cygwin 1.7.9 dereferences NULL rather than returning the location of the trailing NUL byte. * doc/glibc-functions/strchrnul.texi (strchrnul): Document bug. * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Detect it. * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): New witness. * modules/string (Makefile.am): Substitute it. * lib/string.in.h (strchrnul): Use it. Signed-off-by: Eric Blake --- ChangeLog | 9 +++++++++ doc/glibc-functions/strchrnul.texi | 9 +++++++-- lib/string.in.h | 16 ++++++++++++++-- m4/strchrnul.m4 | 32 +++++++++++++++++++++++++++++++- m4/string_h.m4 | 3 ++- modules/string | 1 + 6 files changed, 64 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 580cfa34e3..5a70916e23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-04-15 Eric Blake + + strchrnul: work around cygwin bug + * doc/glibc-functions/strchrnul.texi (strchrnul): Document bug. + * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Detect it. + * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): New witness. + * modules/string (Makefile.am): Substitute it. + * lib/string.in.h (strchrnul): Use it. + 2011-04-15 Bruno Haible Don't require lib/stdio-write.c when only module 'stdio' is used. diff --git a/doc/glibc-functions/strchrnul.texi b/doc/glibc-functions/strchrnul.texi index fcb461ea8a..610e935cdc 100644 --- a/doc/glibc-functions/strchrnul.texi +++ b/doc/glibc-functions/strchrnul.texi @@ -7,8 +7,13 @@ Gnulib module: strchrnul Portability problems fixed by Gnulib: @itemize @item -This function is missing on all non-glibc platforms: -MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, Interix 3.5, BeOS. +This function is missing on many non-glibc platforms: +MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, +IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.8, mingw, Interix 3.5, +BeOS. +@item +This function is broken on some platforms: +Cygwin 1.7.9. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/string.in.h b/lib/string.in.h index 652c9407bc..7f156aa453 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -277,17 +277,29 @@ _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings " /* Find the first occurrence of C in S or the final NUL byte. */ #if @GNULIB_STRCHRNUL@ -# if ! @HAVE_STRCHRNUL@ +# if @REPLACE_STRCHRNUL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strchrnul rpl_strchrnul +# endif +_GL_FUNCDECL_RPL (strchrnul, char *, + (const char *str, int ch) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strchrnul, char *, + (const char *str, int ch)); +# else +# if ! @HAVE_STRCHRNUL@ _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); -# endif +# endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const char * std::strchrnul (const char *, int); } extern "C++" { char * std::strchrnul (char *, int); } */ _GL_CXXALIAS_SYS_CAST2 (strchrnul, char *, (char const *__s, int __c_in), char const *, (char const *__s, int __c_in)); +# endif # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); diff --git a/m4/strchrnul.m4 b/m4/strchrnul.m4 index a64e805bd4..52e50a121f 100644 --- a/m4/strchrnul.m4 +++ b/m4/strchrnul.m4 @@ -1,4 +1,4 @@ -# strchrnul.m4 serial 7 +# strchrnul.m4 serial 8 dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,6 +14,36 @@ AC_DEFUN([gl_FUNC_STRCHRNUL], if test $ac_cv_func_strchrnul = no; then HAVE_STRCHRNUL=0 gl_PREREQ_STRCHRNUL + else + AC_CACHE_CHECK([whether strchrnul works], + [gl_cv_func_strchrnul_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include /* for strchrnul */ +]], [[const char *buf = "a"; + return strchrnul(buf, 'b') != buf + 1; + ]])], + [gl_cv_func_strchrnul_works=yes], + [gl_cv_func_strchrnul_works=no], + [dnl Cygwin 1.7.9 introduced strchrnul, but it was broken until 1.7.10 + AC_EGREP_CPP([Lucky user], + [ +#if defined __CYGWIN__ + #include + #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 9) + Lucky user + #endif +#else + Lucky user +#endif + ], + [gl_cv_func_strchrnul_works=yes], + [gl_cv_func_strchrnul_works="guessing no"]) + ]) + ]) + if test "$gl_cv_func_strchrnul_works" != yes; then + REPLACE_STRCHRNUL=1 + AC_LIBOBJ([strchrnul]) + fi fi ]) diff --git a/m4/string_h.m4 b/m4/string_h.m4 index 30ddfbc3a4..df8c40353b 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -5,7 +5,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 19 +# serial 20 # Written by Paul Eggert. @@ -104,6 +104,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) + REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) diff --git a/modules/string b/modules/string index 9b3e9f0fb8..a88bdce00a 100644 --- a/modules/string +++ b/modules/string @@ -87,6 +87,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -- cgit v1.2.1 From d8fb6162b94aa556e0e150cc27d797d688a9e767 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 16 Apr 2011 12:10:16 +0200 Subject: strchrnul: Tweak last commit. * doc/glibc-functions/strchrnul.texi: Add more details about Cygwin bug. * lib/string.in.h (strchrnul): Use same arguments in _GL_FUNCDECL_RPL as in _GL_FUNCDECL_SYS. * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Invoke gl_PREREQ_STRCHRNUL after AC_LIBOBJ. When cross-compiling, say "guessing yes" not "yes". --- ChangeLog | 10 ++++++++++ doc/glibc-functions/strchrnul.texi | 2 +- lib/string.in.h | 7 +++---- m4/strchrnul.m4 | 19 +++++++++++-------- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a70916e23..7739d23d72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-04-16 Bruno Haible + + strchrnul: Tweak last commit. + * doc/glibc-functions/strchrnul.texi: Add more details about Cygwin + bug. + * lib/string.in.h (strchrnul): Use same arguments in _GL_FUNCDECL_RPL + as in _GL_FUNCDECL_SYS. + * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Invoke gl_PREREQ_STRCHRNUL after + AC_LIBOBJ. When cross-compiling, say "guessing yes" not "yes". + 2011-04-15 Eric Blake strchrnul: work around cygwin bug diff --git a/doc/glibc-functions/strchrnul.texi b/doc/glibc-functions/strchrnul.texi index 610e935cdc..f108c54063 100644 --- a/doc/glibc-functions/strchrnul.texi +++ b/doc/glibc-functions/strchrnul.texi @@ -12,7 +12,7 @@ MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.8, mingw, Interix 3.5, BeOS. @item -This function is broken on some platforms: +This function crashes when no occurrence is found on some platforms: Cygwin 1.7.9. @end itemize diff --git a/lib/string.in.h b/lib/string.in.h index 7f156aa453..f120a1b094 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -281,10 +281,9 @@ _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strchrnul rpl_strchrnul # endif -_GL_FUNCDECL_RPL (strchrnul, char *, - (const char *str, int ch) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strchrnul, char *, (const char *str, int ch)); # else diff --git a/m4/strchrnul.m4 b/m4/strchrnul.m4 index 52e50a121f..fbfd5aebd5 100644 --- a/m4/strchrnul.m4 +++ b/m4/strchrnul.m4 @@ -10,17 +10,16 @@ AC_DEFUN([gl_FUNC_STRCHRNUL], AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS([strchrnul]) + AC_CHECK_FUNCS([strchrnul]) if test $ac_cv_func_strchrnul = no; then HAVE_STRCHRNUL=0 - gl_PREREQ_STRCHRNUL else AC_CACHE_CHECK([whether strchrnul works], [gl_cv_func_strchrnul_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include /* for strchrnul */ ]], [[const char *buf = "a"; - return strchrnul(buf, 'b') != buf + 1; + return strchrnul (buf, 'b') != buf + 1; ]])], [gl_cv_func_strchrnul_works=yes], [gl_cv_func_strchrnul_works=no], @@ -36,14 +35,18 @@ AC_DEFUN([gl_FUNC_STRCHRNUL], Lucky user #endif ], - [gl_cv_func_strchrnul_works=yes], + [gl_cv_func_strchrnul_works="guessing yes"], [gl_cv_func_strchrnul_works="guessing no"]) ]) ]) - if test "$gl_cv_func_strchrnul_works" != yes; then - REPLACE_STRCHRNUL=1 - AC_LIBOBJ([strchrnul]) - fi + case "$gl_cv_func_strchrnul_works" in + *yes) ;; + *) REPLACE_STRCHRNUL=1 ;; + esac + fi + if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then + AC_LIBOBJ([strchrnul]) + gl_PREREQ_STRCHRNUL fi ]) -- cgit v1.2.1 From 93479f73d772730a3104b0bc1fcfe89e9e7e56fd Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 16 Apr 2011 12:14:42 +0200 Subject: gettext: Clarify the needed programmer actions. * modules/gettext (Notice): New field. Suggested by Ben Pfaff . --- ChangeLog | 6 ++++++ modules/gettext | 3 +++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7739d23d72..c81be0cff8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-16 Bruno Haible + + gettext: Clarify the needed programmer actions. + * modules/gettext (Notice): New field. + Suggested by Ben Pfaff . + 2011-04-16 Bruno Haible strchrnul: Tweak last commit. diff --git a/modules/gettext b/modules/gettext index cab538e3c0..ca0b6841dc 100644 --- a/modules/gettext +++ b/modules/gettext @@ -1,6 +1,9 @@ Description: Translate messages to user's native language. +Notice: +You must add an invocation of AM_GNU_GETTEXT([external]) to configure.ac. + Files: m4/codeset.m4 m4/fcntl-o.m4 -- cgit v1.2.1 From 5f65840b727428949c8dc56727a6313d7186cecc Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 17 Apr 2011 06:27:17 -0700 Subject: autoupdate --- build-aux/depcomp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-aux/depcomp b/build-aux/depcomp index 6149451aa9..9825d56d74 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2011-04-11-10; # UTC +scriptversion=2011-04-16.09; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011 Free Software Foundation, Inc. @@ -170,7 +170,7 @@ gcc) ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" '/:$/d' \ + sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; -- cgit v1.2.1 From 8a0661a8db248b45ced989b23e165fda6d69b3b4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 17 Apr 2011 19:27:28 +0200 Subject: nonblocking: Add tests for pipes. * tests/test-nonblocking-pipe.sh: New file. * tests/test-nonblocking-pipe-main.c: New file. * tests/test-nonblocking-pipe-child.c: New file. * tests/test-nonblocking-pipe.h: New file. * tests/test-nonblocking-writer.h: New file. * tests/test-nonblocking-reader.h: New file. * tests/test-nonblocking-misc.h: New file. * modules/nonblocking-pipe-tests: New file. * modules/nonblocking-tests (Depends-on): Add nonblocking-pipe-tests. --- ChangeLog | 13 +++ modules/nonblocking-pipe-tests | 34 ++++++ modules/nonblocking-tests | 1 + tests/test-nonblocking-misc.h | 108 +++++++++++++++++++ tests/test-nonblocking-pipe-child.c | 50 +++++++++ tests/test-nonblocking-pipe-main.c | 110 ++++++++++++++++++++ tests/test-nonblocking-pipe.h | 38 +++++++ tests/test-nonblocking-pipe.sh | 17 +++ tests/test-nonblocking-reader.h | 200 ++++++++++++++++++++++++++++++++++++ tests/test-nonblocking-writer.h | 186 +++++++++++++++++++++++++++++++++ 10 files changed, 757 insertions(+) create mode 100644 modules/nonblocking-pipe-tests create mode 100644 tests/test-nonblocking-misc.h create mode 100644 tests/test-nonblocking-pipe-child.c create mode 100644 tests/test-nonblocking-pipe-main.c create mode 100644 tests/test-nonblocking-pipe.h create mode 100755 tests/test-nonblocking-pipe.sh create mode 100644 tests/test-nonblocking-reader.h create mode 100644 tests/test-nonblocking-writer.h diff --git a/ChangeLog b/ChangeLog index c81be0cff8..d86f4c9d2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2011-04-17 Bruno Haible + + nonblocking: Add tests for pipes. + * tests/test-nonblocking-pipe.sh: New file. + * tests/test-nonblocking-pipe-main.c: New file. + * tests/test-nonblocking-pipe-child.c: New file. + * tests/test-nonblocking-pipe.h: New file. + * tests/test-nonblocking-writer.h: New file. + * tests/test-nonblocking-reader.h: New file. + * tests/test-nonblocking-misc.h: New file. + * modules/nonblocking-pipe-tests: New file. + * modules/nonblocking-tests (Depends-on): Add nonblocking-pipe-tests. + 2011-04-16 Bruno Haible gettext: Clarify the needed programmer actions. diff --git a/modules/nonblocking-pipe-tests b/modules/nonblocking-pipe-tests new file mode 100644 index 0000000000..428452f78e --- /dev/null +++ b/modules/nonblocking-pipe-tests @@ -0,0 +1,34 @@ +Files: +tests/test-nonblocking-pipe.sh +tests/test-nonblocking-pipe-main.c +tests/test-nonblocking-pipe-child.c +tests/test-nonblocking-pipe.h +tests/test-nonblocking-writer.h +tests/test-nonblocking-reader.h +tests/test-nonblocking-misc.h +tests/macros.h + +Depends-on: +stdbool +unistd +nonblocking +wait-process +pipe-posix +dup2 +environ +posix_spawnp +binary-io +gettimeofday +snprintf +vsnprintf +strerror +ssize_t +usleep +read +write + +configure.ac: + +Makefile.am: +TESTS += test-nonblocking-pipe.sh +check_PROGRAMS += test-nonblocking-pipe-main test-nonblocking-pipe-child diff --git a/modules/nonblocking-tests b/modules/nonblocking-tests index a1e5e7c03c..bd6cc134bd 100644 --- a/modules/nonblocking-tests +++ b/modules/nonblocking-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: close pipe-posix +nonblocking-pipe-tests configure.ac: diff --git a/tests/test-nonblocking-misc.h b/tests/test-nonblocking-misc.h new file mode 100644 index 0000000000..66a13e47e4 --- /dev/null +++ b/tests/test-nonblocking-misc.h @@ -0,0 +1,108 @@ +/* Test for nonblocking read and write. + + Copyright (C) 2011 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 . */ + +/* Whether to print debugging messages. */ +#define ENABLE_DEBUGGING 0 + +/* Delay (in microseconds) to sleep when write() or read() returned -1 with + errno = EAGAIN. */ +#define SMALL_DELAY 10000 + +/* Return a memory area, filled with the data to be transferred. */ +static unsigned char * +init_data (size_t data_block_size) +{ + unsigned char *data; + unsigned int i; + + data = (unsigned char *) malloc (2 * data_block_size); + ASSERT (data != NULL); + + for (i = 0; i < 2 * data_block_size; i++) + data[i] = (unsigned char) (i * i + (7 * i) % 61 + 4); + + return data; +} + +#if ENABLE_DEBUGGING +# include +static int dbgfprintf (FILE *fp, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3); +static int +dbgfprintf (FILE *fp, const char *format, ...) +{ + /* Accumulate the entire line in a buffer, so that the output on fp + is done atomically. */ + char line[1024]; + size_t line_len; + struct timeval current_time; + va_list args; + int ret; + + line_len = 0; + gettimeofday (¤t_time, NULL); + ret = snprintf (line, sizeof (line), "%.6f ", + current_time.tv_sec + (double) current_time.tv_usec * 1e-6); + if (ret < 0) + return -1; + line_len = strlen (line); + + va_start (args, format); + ret = vsnprintf (line + line_len, sizeof (line) - line_len, format, args); + va_end (args); + if (ret < 0) + return -1; + line_len += strlen (line + line_len); + + ret = fwrite (line, 1, line_len, fp); + + /* Make sure the debugging information is output, so that the order of the + messages reflects the timeline of events, and so that the output is not + lost if the program crashes afterwards (relevant on mingw). */ + fflush (fp); + return ret; +} +#else +# define dbgfprintf if (1) ; else fprintf +#endif + +/* Return a textual description of the error code ERR, if FAILED is true. + Return an empty string if FAILED is false. */ +static const char * +dbgstrerror (bool failed, int err) +{ + static char buf[256]; + if (failed) + { + sprintf (buf, " %d %s", err, strerror (err)); + return buf; + } + else + return ""; +} + +#define TIMING_DECLS \ + struct timeval before_time; \ + struct timeval after_time; \ + double spent_time; +#define START_TIMING \ + gettimeofday (&before_time, NULL); +#define END_TIMING \ + gettimeofday (&after_time, NULL); \ + spent_time = \ + (after_time.tv_sec - before_time.tv_sec) \ + + ((double) after_time.tv_usec - (double) before_time.tv_usec) * 1e-6; diff --git a/tests/test-nonblocking-pipe-child.c b/tests/test-nonblocking-pipe-child.c new file mode 100644 index 0000000000..d12a6e0ce5 --- /dev/null +++ b/tests/test-nonblocking-pipe-child.c @@ -0,0 +1,50 @@ +/* Child program invoked by test-nonblocking-pipe-main. + + Copyright (C) 2011 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 . */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "binary-io.h" + +#include "macros.h" +#include "test-nonblocking-pipe.h" +#define PROG_ROLE "child" +#include "test-nonblocking-reader.h" + +int +main (int argc, char *argv[]) +{ + int test = atoi (argv[1]); + + /* Close unused file descriptors. */ + close (STDOUT_FILENO); + + /* STDIN_FILENO was created as binary in the parent process. But since an + fd's mode is stored in the process, not in the kernel, on native Windows + we need to set it as binary in the child process again. */ + SET_BINARY (STDIN_FILENO); + + main_reader_loop (test, PIPE_DATA_BLOCK_SIZE, STDIN_FILENO); + + return 0; +} diff --git a/tests/test-nonblocking-pipe-main.c b/tests/test-nonblocking-pipe-main.c new file mode 100644 index 0000000000..e61269ce5d --- /dev/null +++ b/tests/test-nonblocking-pipe-main.c @@ -0,0 +1,110 @@ +/* Test for nonblocking read and write on pipes. + + Copyright (C) 2011 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 . */ + +#include + +#include +#include +#include +#include +#include +#include + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# include +#else +# include +#endif + +#include "nonblocking.h" +#include "wait-process.h" + +#include "macros.h" +#include "test-nonblocking-pipe.h" +#define PROG_ROLE "main" +#include "test-nonblocking-writer.h" + +int +main (int argc, char *argv[]) +{ + const char *child_path = argv[1]; + int test = atoi (argv[2]); + int fd[2]; + int child; + int exitcode; + + /* Create a pipe. */ + ASSERT (pipe (fd) >= 0); + + /* Map fd[0] to STDIN_FILENO and fd[1] to STDOUT_FILENO, because on Windows, + the only three file descriptors that are inherited by child processes are + STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO. */ + if (fd[0] != STDIN_FILENO) + { + ASSERT (dup2 (fd[0], STDIN_FILENO) >= 0); + close (fd[0]); + } + if (fd[1] != STDOUT_FILENO) + { + ASSERT (dup2 (fd[1], STDOUT_FILENO) >= 0); + close (fd[1]); + } + + /* Prepare the file descriptors. */ + if (test & 1) + ASSERT (set_nonblocking_flag (STDOUT_FILENO, true) >= 0); + if (test & 2) + ASSERT (set_nonblocking_flag (STDIN_FILENO, true) >= 0); + + /* Spawn the child process. */ + { + const char *child_argv[3]; + + child_argv[0] = child_path; + child_argv[1] = argv[2]; + child_argv[2] = NULL; + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + child = spawnvpe (P_NOWAIT, child_path, child_argv, + (const char **) environ); + ASSERT (child >= 0); +#else + { + pid_t child_pid; + int err = + posix_spawnp (&child_pid, child_path, NULL, NULL, (char **) child_argv, + environ); + ASSERT (err == 0); + child = child_pid; + } +#endif + } + + /* Close unused file descriptors. */ + close (STDIN_FILENO); + + exitcode = + main_writer_loop (test, PIPE_DATA_BLOCK_SIZE, STDOUT_FILENO, false); + + { + int err = + wait_subprocess (child, child_path, false, false, false, false, NULL); + ASSERT (err == 0); + } + + return exitcode; +} diff --git a/tests/test-nonblocking-pipe.h b/tests/test-nonblocking-pipe.h new file mode 100644 index 0000000000..c4e65616a4 --- /dev/null +++ b/tests/test-nonblocking-pipe.h @@ -0,0 +1,38 @@ +/* Test for nonblocking read and write. + + Copyright (C) 2011 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 . */ + +/* A data block ought to be larger than the size of the in-kernel buffer. + Working values of PIPE_DATA_BLOCK_SIZE, depending on kernel: + + Platform PIPE_DATA_BLOCK_SIZE + + Linux >= 63489 + FreeBSD, OpenBSD, MacOS X >= 65537 + AIX >= 32769 + HP-UX >= 8193 + IRIX >= 10241 + OSF/1 >= 262145 + Solaris <= 7 >= 10241 + Solaris >= 8 >= 20481 + Cygwin >= 65537 + native Win32 >= 4097 (depends on the _pipe argument) + */ +#if defined __osf__ +# define PIPE_DATA_BLOCK_SIZE 270000 +#else +# define PIPE_DATA_BLOCK_SIZE 70000 +#endif diff --git a/tests/test-nonblocking-pipe.sh b/tests/test-nonblocking-pipe.sh new file mode 100755 index 0000000000..dd692be7ee --- /dev/null +++ b/tests/test-nonblocking-pipe.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Note: This test fails on Cygwin 1.5.x, because the non-blocking flag has +# apparently no effect on STDOUT_FILENO. It is fixed in Cygwin 1.7. + +# Test blocking write() with blocking read(). +# Commented out because this test succeeds on all platforms anyway. +#./test-nonblocking-pipe-main${EXEEXT} ./test-nonblocking-pipe-child${EXEEXT} 0 || exit 1 + +# Test non-blocking write() with blocking read(). +./test-nonblocking-pipe-main${EXEEXT} ./test-nonblocking-pipe-child${EXEEXT} 1 || exit 1 + +# Test blocking write() with non-blocking read(). +./test-nonblocking-pipe-main${EXEEXT} ./test-nonblocking-pipe-child${EXEEXT} 2 || exit 1 + +# Test non-blocking write() with non-blocking read(). +./test-nonblocking-pipe-main${EXEEXT} ./test-nonblocking-pipe-child${EXEEXT} 3 || exit 1 diff --git a/tests/test-nonblocking-reader.h b/tests/test-nonblocking-reader.h new file mode 100644 index 0000000000..2099b69b25 --- /dev/null +++ b/tests/test-nonblocking-reader.h @@ -0,0 +1,200 @@ +/* The reader part of a test program for non-blocking communication. + + Copyright (C) 2011 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 . */ + +/* This program implements 4 tests: + + test == 0: + Test blocking write() with blocking read(). + + Timeline Main process Child process + 0 s Start Start, read(10000) + 1 s write(20000) Return from read(10000) + 2 s Next read(10000) + 2 s Return from write(20000) Return from read(10000) + + test == 1: + Test non-blocking write() with blocking read(). + + Timeline Main process Child process + 0 s Start Start, read(10000) + 1 s write(20000) Return from read(10000) + Return with at least 10000, + Repeatedly continue + write() of the rest + 2 s Next read(10000) + 2 s Return from write(10000) Return from read(10000) + + test == 2: + Test blocking write() with non-blocking read(). + + Timeline Main process Child process + 0 s Start Start, read(10000) + repeatedly polling + 1 s write(20000) Return from read(10000) + 2 s Next read(10000) + 2 s Return from write(20000) Return from read(10000) + + test == 3: + Test non-blocking write() with non-blocking read(). + */ + +#include "test-nonblocking-misc.h" + +static ssize_t +full_read (size_t fd, void *buf, size_t count) +{ + size_t bytes_read; + + bytes_read = 0; + while (bytes_read < count) + { + TIMING_DECLS + ssize_t ret; + int saved_errno; + + dbgfprintf (stderr, "%s: >> read (%lu)\n", PROG_ROLE, + (unsigned long) (count - bytes_read)); + START_TIMING + ret = read (fd, (char *) buf + bytes_read, count - bytes_read); + saved_errno = errno; + END_TIMING + dbgfprintf (stderr, "%s: << read -> %ld%s\n", PROG_ROLE, + (long) ret, dbgstrerror (ret < 0, saved_errno)); + if (ret < 0) + return -1; + else + { + ASSERT (ret > 0); + bytes_read += ret; + } + } + return bytes_read; +} + +static ssize_t +full_read_from_nonblocking_fd (size_t fd, void *buf, size_t count) +{ + size_t bytes_read; + + bytes_read = 0; + while (bytes_read < count) + { + TIMING_DECLS + ssize_t ret; + int saved_errno; + + dbgfprintf (stderr, "%s: >> read (%lu)\n", PROG_ROLE, + (unsigned long) (count - bytes_read)); + START_TIMING + ret = read (fd, (char *) buf + bytes_read, count - bytes_read); + saved_errno = errno; + END_TIMING + dbgfprintf (stderr, "%s: << read -> %ld%s\n", PROG_ROLE, + (long) ret, dbgstrerror (ret < 0, saved_errno)); + /* This assertion fails if the non-blocking flag is effectively not set + on fd = STDIN_FILENO. */ + ASSERT (spent_time < 0.5); + if (ret < 0) + { + ASSERT (saved_errno == EAGAIN); + usleep (SMALL_DELAY); + } + else + { + ASSERT (ret > 0); + bytes_read += ret; + } + } + return bytes_read; +} + +/* Execute the reader loop. */ +static void +main_reader_loop (int test, size_t data_block_size, int fd) +{ + unsigned char *expected; + unsigned char *data; + + /* Set up the expected data. */ + expected = init_data (data_block_size); + + data = (unsigned char *) malloc (2 * data_block_size); + ASSERT (data != NULL); + + switch (test) + { + TIMING_DECLS + ssize_t ret; + + case 0: /* Test blocking write() with blocking read(). */ + case 1: /* Test non-blocking write() with blocking read(). */ + START_TIMING + ret = full_read (fd, data, data_block_size); + END_TIMING + ASSERT (ret == data_block_size); + ASSERT (memcmp (data, expected, data_block_size) == 0); + ASSERT (spent_time > 0.5); + /* This assertion fails if data_block_size is very large and + ENABLE_DEBUGGING is 1. */ + ASSERT (spent_time < 1.5); + + usleep (1000000); + + START_TIMING + ret = full_read (fd, data, data_block_size); + END_TIMING + ASSERT (ret == data_block_size); + ASSERT (memcmp (data, expected + data_block_size, data_block_size) == 0); + /* This assertion fails if data_block_size is much larger than needed + and SMALL_DELAY is too large. */ + ASSERT (spent_time < 0.5); + + break; + + case 2: /* Test blocking write() with non-blocking read(). */ + case 3: /* Test non-blocking write() with non-blocking read(). */ + START_TIMING + ret = full_read_from_nonblocking_fd (fd, data, data_block_size); + END_TIMING + ASSERT (ret == data_block_size); + ASSERT (memcmp (data, expected, data_block_size) == 0); + ASSERT (spent_time > 0.5); + /* This assertion fails if data_block_size is much larger than needed + and SMALL_DELAY is too large, or if data_block_size is very large and + ENABLE_DEBUGGING is 1. */ + ASSERT (spent_time < 1.5); + + usleep (1000000); + + START_TIMING + ret = full_read_from_nonblocking_fd (fd, data, data_block_size); + END_TIMING + ASSERT (ret == data_block_size); + ASSERT (memcmp (data, expected + data_block_size, data_block_size) == 0); + /* This assertion fails if data_block_size is much larger than needed + and SMALL_DELAY is too large. */ + ASSERT (spent_time < 0.5); + + break; + + default: + abort (); + } + + free (data); + free (expected); +} diff --git a/tests/test-nonblocking-writer.h b/tests/test-nonblocking-writer.h new file mode 100644 index 0000000000..6db53f6dab --- /dev/null +++ b/tests/test-nonblocking-writer.h @@ -0,0 +1,186 @@ +/* The writer part of a test program for non-blocking communication. + + Copyright (C) 2011 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 . */ + +/* This program implements 4 tests: + + test == 0: + Test blocking write() with blocking read(). + + Timeline Main process Child process + 0 s Start Start, read(10000) + 1 s write(20000) Return from read(10000) + 2 s Next read(10000) + 2 s Return from write(20000) Return from read(10000) + + test == 1: + Test non-blocking write() with blocking read(). + + Timeline Main process Child process + 0 s Start Start, read(10000) + 1 s write(20000) Return from read(10000) + Return with at least 10000, + Repeatedly continue + write() of the rest + 2 s Next read(10000) + 2 s Return from write(10000) Return from read(10000) + + test == 2: + Test blocking write() with non-blocking read(). + + Timeline Main process Child process + 0 s Start Start, read(10000) + repeatedly polling + 1 s write(20000) Return from read(10000) + 2 s Next read(10000) + 2 s Return from write(20000) Return from read(10000) + + test == 3: + Test non-blocking write() with non-blocking read(). + */ + +#include "test-nonblocking-misc.h" + +/* Execute the writer loop. + Returns 0 if successful, 1 if data_block_size is too small. */ +static int +main_writer_loop (int test, size_t data_block_size, int fd, + bool has_large_buffer) +{ + int too_small = 0; + unsigned char *data; + + /* Set up the data to transfer. */ + data = init_data (data_block_size); + + switch (test) + { + TIMING_DECLS + ssize_t ret; + + case 0: /* Test blocking write() with blocking read(). */ + case 2: /* Test blocking write() with non-blocking read(). */ + { + int saved_errno; + + usleep (1000000); + + dbgfprintf (stderr, "%s:1: >> write (%lu)\n", PROG_ROLE, + (unsigned long) 2 * data_block_size); + START_TIMING + ret = write (fd, data, 2 * data_block_size); + saved_errno = errno; + END_TIMING + dbgfprintf (stderr, "%s:1: << write -> %ld%s\n", PROG_ROLE, + (long) ret, dbgstrerror (ret < 0, saved_errno)); + ASSERT (ret == 2 * data_block_size); + if (!has_large_buffer) + { + /* This assertion fails if data_block_size is too small. */ + if (!(spent_time > 0.5)) + { + fprintf (stderr, + "%s:1: spent_time = %g, data_block_size too small\n", + PROG_ROLE, spent_time); + too_small = 1; + } + } + ASSERT (spent_time < 1.5); + } + break; + + case 1: /* Test non-blocking write() with blocking read(). */ + case 3: /* Test non-blocking write() with non-blocking read(). */ + { + size_t bytes_written; + int saved_errno; + + usleep (1000000); + + bytes_written = 0; + while (bytes_written < 2 * data_block_size) + { + dbgfprintf (stderr, "%s:2: >> write (%lu)\n", PROG_ROLE, + (unsigned long) (2 * data_block_size - bytes_written)); + START_TIMING + ret = write (fd, data + bytes_written, + 2 * data_block_size - bytes_written); + saved_errno = errno; + END_TIMING + dbgfprintf (stderr, "%s:2: << write -> %ld%s\n", PROG_ROLE, + (long) ret, dbgstrerror (ret < 0, saved_errno)); + if (ret < 0 && bytes_written >= data_block_size) + { + ASSERT (saved_errno == EAGAIN); + ASSERT (spent_time < 0.5); + break; + } + /* This assertion fails if the non-blocking flag is effectively not + set on fd. */ + ASSERT (spent_time < 0.5); + if (ret < 0) + { + ASSERT (saved_errno == EAGAIN); + usleep (SMALL_DELAY); + } + else + { + /* This assertion fails if data_block_size is too small. */ + if (!(ret > 0)) + { + fprintf (stderr, + "%s:1: spent_time = %g, data_block_size too small\n", + PROG_ROLE, spent_time); + too_small = 1; + } + bytes_written += ret; + } + } + ASSERT (bytes_written >= data_block_size); + + while (bytes_written < 2 * data_block_size) + { + dbgfprintf (stderr, "%s:3: >> write (%lu)\n", PROG_ROLE, + (unsigned long) (2 * data_block_size - bytes_written)); + START_TIMING + ret = write (fd, data + bytes_written, + 2 * data_block_size - bytes_written); + saved_errno = errno; + END_TIMING + dbgfprintf (stderr, "%s:3: << write -> %ld%s\n", PROG_ROLE, + (long) ret, dbgstrerror (ret < 0, saved_errno)); + ASSERT (spent_time < 0.5); + if (ret < 0) + { + ASSERT (saved_errno == EAGAIN); + usleep (SMALL_DELAY); + } + else + { + ASSERT (ret > 0); + bytes_written += ret; + } + } + } + break; + + default: + abort (); + } + + free (data); + return too_small; +} -- cgit v1.2.1 From bce9d2f253449c62e05c030307e4d298ef914df9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 17 Apr 2011 19:50:10 +0200 Subject: nonblocking: Add tests for sockets. * tests/test-nonblocking-socket.sh: New file. * tests/test-nonblocking-socket-main.c: New file. * tests/test-nonblocking-socket-child.c: New file. * tests/test-nonblocking-socket.h: New file. * tests/socket-server.h: New file. * tests/socket-client.h: New file. * modules/nonblocking-socket-tests: New file. * modules/nonblocking-tests (Depends-on): Add nonblocking-socket-tests. --- ChangeLog | 12 ++++ modules/nonblocking-socket-tests | 46 +++++++++++++ modules/nonblocking-tests | 1 + tests/socket-client.h | 57 ++++++++++++++++ tests/socket-server.h | 117 ++++++++++++++++++++++++++++++++ tests/test-nonblocking-socket-child.c | 52 +++++++++++++++ tests/test-nonblocking-socket-main.c | 121 ++++++++++++++++++++++++++++++++++ tests/test-nonblocking-socket.h | 51 ++++++++++++++ tests/test-nonblocking-socket.sh | 13 ++++ 9 files changed, 470 insertions(+) create mode 100644 modules/nonblocking-socket-tests create mode 100644 tests/socket-client.h create mode 100644 tests/socket-server.h create mode 100644 tests/test-nonblocking-socket-child.c create mode 100644 tests/test-nonblocking-socket-main.c create mode 100644 tests/test-nonblocking-socket.h create mode 100755 tests/test-nonblocking-socket.sh diff --git a/ChangeLog b/ChangeLog index d86f4c9d2e..d0923da0e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-04-17 Bruno Haible + + nonblocking: Add tests for sockets. + * tests/test-nonblocking-socket.sh: New file. + * tests/test-nonblocking-socket-main.c: New file. + * tests/test-nonblocking-socket-child.c: New file. + * tests/test-nonblocking-socket.h: New file. + * tests/socket-server.h: New file. + * tests/socket-client.h: New file. + * modules/nonblocking-socket-tests: New file. + * modules/nonblocking-tests (Depends-on): Add nonblocking-socket-tests. + 2011-04-17 Bruno Haible nonblocking: Add tests for pipes. diff --git a/modules/nonblocking-socket-tests b/modules/nonblocking-socket-tests new file mode 100644 index 0000000000..368bed8828 --- /dev/null +++ b/modules/nonblocking-socket-tests @@ -0,0 +1,46 @@ +Files: +tests/test-nonblocking-socket.sh +tests/test-nonblocking-socket-main.c +tests/test-nonblocking-socket-child.c +tests/test-nonblocking-socket.h +tests/test-nonblocking-writer.h +tests/test-nonblocking-reader.h +tests/test-nonblocking-misc.h +tests/socket-server.h +tests/socket-client.h +tests/macros.h + +Depends-on: +stdbool +unistd +sys_socket +nonblocking +wait-process +environ +posix_spawnp +netinet_in +arpa_inet +socket +setsockopt +bind +getsockname +listen +accept +getsockopt +connect +gettimeofday +snprintf +vsnprintf +strerror +ssize_t +usleep +read +write + +configure.ac: + +Makefile.am: +TESTS += test-nonblocking-socket.sh +check_PROGRAMS += test-nonblocking-socket-main test-nonblocking-socket-child +test_nonblocking_socket_main_LDADD = $(LDADD) $(LIBSOCKET) +test_nonblocking_socket_child_LDADD = $(LDADD) $(LIBSOCKET) diff --git a/modules/nonblocking-tests b/modules/nonblocking-tests index bd6cc134bd..b84a32713f 100644 --- a/modules/nonblocking-tests +++ b/modules/nonblocking-tests @@ -6,6 +6,7 @@ Depends-on: close pipe-posix nonblocking-pipe-tests +nonblocking-socket-tests configure.ac: diff --git a/tests/socket-client.h b/tests/socket-client.h new file mode 100644 index 0000000000..ac82463ce1 --- /dev/null +++ b/tests/socket-client.h @@ -0,0 +1,57 @@ +/* Create sockets for use in tests (client side). + Copyright (C) 2011 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 . */ + +/* Written by Bruno Haible , 2011. */ + +#include +#include +#include +#include + +/* Creates a client socket, by connecting to a server on the given port. */ +static int +create_client_socket (int port) +{ + int client_socket; + + /* Create a client socket. */ + client_socket = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP); + ASSERT (client_socket >= 0); + /* Connect to the server process at the specified port. */ + { + struct sockaddr_in addr; + + memset (&addr, 0, sizeof (addr)); /* needed on AIX and OSF/1 */ + addr.sin_family = AF_INET; + #if 0 /* Unoptimized */ + inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr); + #elif 0 /* Nearly optimized */ + addr.sin_addr.s_addr = htonl (0x7F000001); /* 127.0.0.1 */ + #else /* Fully optimized */ + { + unsigned char dotted[4] = { 127, 0, 0, 1 }; /* 127.0.0.1 */ + memcpy (&addr.sin_addr.s_addr, dotted, 4); + } + #endif + addr.sin_port = htons (port); + + ASSERT (connect (client_socket, + (const struct sockaddr *) &addr, sizeof (addr)) + == 0); + } + + return client_socket; +} diff --git a/tests/socket-server.h b/tests/socket-server.h new file mode 100644 index 0000000000..283ef2fc2a --- /dev/null +++ b/tests/socket-server.h @@ -0,0 +1,117 @@ +/* Create sockets for use in tests (server side). + Copyright (C) 2011 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 . */ + +/* Written by Bruno Haible , 2011. */ + +#include +#include +#include +#include + +/* Creates a server that can be used to listen on incoming + connections. It uses the IPv4 protocol. + If PORT is 0, a port is assigned by the kernel. + Returns the server. Returns the chosen port in *PPORT. */ +static int +create_server (int port, unsigned int max_backlog, int *pport) +{ + int server; + + /* Create a server socket. */ + server = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP); + if (server < 0) + { + fputs ("Skipping test: cannot create server socket: socket() failed\n", + stderr); + exit (77); + } + /* Bind it to a local IPv4 address. */ + if (port != 0) + { + /* Set an option for the next bind() call: Avoid an EADDRINUSE error + in case there are TIME_WAIT or CLOSE_WAIT sockets hanging around on + the port. (Sockets in LISTEN or ESTABLISHED state on the same port + will still yield an error.) */ + unsigned int flag = 1; + if (setsockopt (server, SOL_SOCKET, SO_REUSEADDR, &flag, + sizeof (flag)) + < 0) + { + fputs ("Skipping test: cannot create server socket: setsockopt() failed\n", + stderr); + exit (77); + } + } + { + struct sockaddr_in addr; + + memset (&addr, 0, sizeof (addr)); /* needed on AIX and OSF/1 */ + addr.sin_family = AF_INET; + #if 0 /* Unoptimized */ + inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr); + #elif 0 /* Nearly optimized */ + addr.sin_addr.s_addr = htonl (0x7F000001); /* 127.0.0.1 */ + #else /* Fully optimized */ + { + unsigned char dotted[4] = { 127, 0, 0, 1 }; /* 127.0.0.1 */ + memcpy (&addr.sin_addr.s_addr, dotted, 4); + } + #endif + addr.sin_port = htons (port); + + if (bind (server, (const struct sockaddr *) &addr, sizeof (addr)) < 0) + { + fputs ("Skipping test: cannot create server socket: bind() failed\n", + stderr); + exit (77); + } + } + if (port == 0) + { + /* Get the port that was assigned by bind(). */ + struct sockaddr_in addr; + socklen_t addrlen = sizeof (addr); + + if (getsockname (server, (struct sockaddr *) &addr, &addrlen) < 0) + { + fputs ("Skipping test: cannot create server socket: getsockname() failed\n", + stderr); + exit (77); + } + port = ntohs (addr.sin_port); + } + /* Start listening for a connection from the child process. */ + if (listen (server, max_backlog) < 0) + { + fputs ("Skipping test: cannot create server socket: listen() failed\n", + stderr); + exit (77); + } + + *pport = port; + return server; +} + +/* Creates a server socket, by accepting a connection to a server. */ +static int +create_server_socket (int server) +{ + struct sockaddr_storage addr; + socklen_t addrlen = sizeof (addr); + int connected_socket = accept (server, (struct sockaddr *) &addr, &addrlen); + ASSERT (connected_socket >= 0); + return connected_socket; +} diff --git a/tests/test-nonblocking-socket-child.c b/tests/test-nonblocking-socket-child.c new file mode 100644 index 0000000000..17545cf644 --- /dev/null +++ b/tests/test-nonblocking-socket-child.c @@ -0,0 +1,52 @@ +/* Child program invoked by test-nonblocking-socket-main. + + Copyright (C) 2011 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 . */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "nonblocking.h" + +#include "macros.h" +#include "socket-client.h" +#include "test-nonblocking-socket.h" +#define PROG_ROLE "child" +#include "test-nonblocking-reader.h" + +int +main (int argc, char *argv[]) +{ + int test = atoi (argv[1]); + int port = atoi (argv[2]); + int client_socket; + + /* Create a client socket. */ + client_socket = create_client_socket (port); + + /* Prepare the file descriptor. */ + if (test & 2) + ASSERT (set_nonblocking_flag (client_socket, true) >= 0); + + main_reader_loop (test, SOCKET_DATA_BLOCK_SIZE, client_socket); + + return 0; +} diff --git a/tests/test-nonblocking-socket-main.c b/tests/test-nonblocking-socket-main.c new file mode 100644 index 0000000000..034873d5d2 --- /dev/null +++ b/tests/test-nonblocking-socket-main.c @@ -0,0 +1,121 @@ +/* Test for nonblocking read and write on sockets. + + Copyright (C) 2011 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 . */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# include +#else +# include +#endif + +#include "nonblocking.h" +#include "wait-process.h" + +#include "macros.h" +#include "socket-server.h" +#include "test-nonblocking-socket.h" +#define PROG_ROLE "main" +#include "test-nonblocking-writer.h" + +int +main (int argc, char *argv[]) +{ + const char *child_path = argv[1]; + int test = atoi (argv[2]); + int server; + int port; + int child; + int server_socket; + int exitcode; + + /* Create a server socket. */ + server = create_server (0, 1, &port); + + /* Spawn the child process. */ + { + char port_arg[10+1]; + const char *child_argv[4]; + + sprintf (port_arg, "%u", port); + child_argv[0] = child_path; + child_argv[1] = argv[2]; + child_argv[2] = port_arg; + child_argv[3] = NULL; + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + child = spawnvpe (P_NOWAIT, child_path, child_argv, + (const char **) environ); + ASSERT (child >= 0); +#else + { + pid_t child_pid; + int err = + posix_spawnp (&child_pid, child_path, NULL, NULL, (char **) child_argv, + environ); + ASSERT (err == 0); + child = child_pid; + } +#endif + } + + /* Accept a connection from the child process. */ + server_socket = create_server_socket (server); + + /* Prepare the file descriptor. */ + if (test & 1) + ASSERT (set_nonblocking_flag (server_socket, true) >= 0); + +#if ENABLE_DEBUGGING +# ifdef SO_SNDBUF + { + int value; + socklen_t value_len = sizeof (value); + if (getsockopt (server_socket, SOL_SOCKET, SO_SNDBUF, &value, &value_len) >= 0) + fprintf (stderr, "SO_SNDBUF = %d\n", value); + } +# endif +# ifdef SO_RCVBUF + { + int value; + socklen_t value_len = sizeof (value); + if (getsockopt (server_socket, SOL_SOCKET, SO_RCVBUF, &value, &value_len) >= 0) + fprintf (stderr, "SO_RCVBUF = %d\n", value); + } +# endif +#endif + + exitcode = + main_writer_loop (test, SOCKET_DATA_BLOCK_SIZE, server_socket, + SOCKET_HAS_LARGE_BUFFER); + + { + int err = + wait_subprocess (child, child_path, false, false, false, false, NULL); + ASSERT (err == 0); + } + + return exitcode; +} diff --git a/tests/test-nonblocking-socket.h b/tests/test-nonblocking-socket.h new file mode 100644 index 0000000000..5f2268d9c3 --- /dev/null +++ b/tests/test-nonblocking-socket.h @@ -0,0 +1,51 @@ +/* Test for nonblocking read and write. + + Copyright (C) 2011 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 . */ + +/* A data block ought to be larger than the size of the in-kernel buffer. + Working values of SOCKET_DATA_BLOCK_SIZE, depending on kernel: + + Platform SOCKET_DATA_BLOCK_SIZE + + Linux >= 7350000 (depends on circumstances) + FreeBSD >= 107521 + OpenBSD >= 28673 + MacOS X >= 680000 (depends on circumstances) + AIX 5.1 >= 125713 + AIX 7.1 >= 200000 (depends on circumstances) + HP-UX >= 114689 + IRIX >= 61089 + OSF/1 >= 122881 + Solaris 7 >= 63000 (depends on circumstances) + Solaris 8 >= 49153 + Solaris 9 >= 73729 + Solaris 10 >= 98305 + Solaris 11 2010-11 >= 73729 + Cygwin 1.5.x >= 66294401 but then write() fails with ENOBUFS + Cygwin 1.7.x >= 163838 (depends on circumstances) + native Win32 >= 66294401 + */ +#define SOCKET_DATA_BLOCK_SIZE 1000000 + +/* On Linux, MacOS X, Cygwin 1.5.x, native Win32, + sockets have very large buffers in the kernel, so that write() calls + succeed before the reader has started reading, even if fd is blocking + and the amount of data is larger than 1 MB. */ +#if defined __linux__ || (defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __WIN32__) || defined __CYGWIN__ +# define SOCKET_HAS_LARGE_BUFFER 1 +#else +# define SOCKET_HAS_LARGE_BUFFER 0 +#endif diff --git a/tests/test-nonblocking-socket.sh b/tests/test-nonblocking-socket.sh new file mode 100755 index 0000000000..3818c93d3a --- /dev/null +++ b/tests/test-nonblocking-socket.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Test blocking write() with blocking read(). +./test-nonblocking-socket-main${EXEEXT} ./test-nonblocking-socket-child${EXEEXT} 0 || exit 1 + +# Test non-blocking write() with blocking read(). +./test-nonblocking-socket-main${EXEEXT} ./test-nonblocking-socket-child${EXEEXT} 1 || exit 1 + +# Test blocking write() with non-blocking read(). +./test-nonblocking-socket-main${EXEEXT} ./test-nonblocking-socket-child${EXEEXT} 2 || exit 1 + +# Test non-blocking write() with non-blocking read(). +./test-nonblocking-socket-main${EXEEXT} ./test-nonblocking-socket-child${EXEEXT} 3 || exit 1 -- cgit v1.2.1 From e9da144137c07d2ec6f94745a347f771d14d2a10 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 17 Apr 2011 23:16:13 +0200 Subject: nonblocking: Add comment. * lib/fcntl.in.h (O_NONBLOCK): Add comment. --- ChangeLog | 5 +++++ lib/fcntl.in.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index d0923da0e9..1f09ff8458 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-17 Bruno Haible + + nonblocking: Add comment. + * lib/fcntl.in.h (O_NONBLOCK): Add comment. + 2011-04-17 Bruno Haible nonblocking: Add tests for sockets. diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 971316fc05..ce7c8c016c 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -218,6 +218,9 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " # define O_NONBLOCK O_NDELAY #endif +/* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero + value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY + or to 0 as fallback. */ #if @GNULIB_NONBLOCKING@ # if O_NONBLOCK # define GNULIB_defined_O_NONBLOCK 0 -- cgit v1.2.1 From de3622c2af51046d476a9daf6b8f77df0ae20c9f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 17 Apr 2011 23:36:27 +0200 Subject: pipe2: Simplify code. * lib/pipe2.c (pipe2): Reduce code duplication. --- ChangeLog | 5 +++++ lib/pipe2.c | 22 ++++++++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f09ff8458..c5e07aa078 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-17 Bruno Haible + + pipe2: Simplify code. + * lib/pipe2.c (pipe2): Reduce code duplication. + 2011-04-17 Bruno Haible nonblocking: Add comment. diff --git a/lib/pipe2.c b/lib/pipe2.c index 6ffb101f3d..18098c4b4e 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -66,23 +66,17 @@ pipe2 (int fd[2], int flags) #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Native Woe32 API. */ + if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0) + return -1; + if (flags & O_NONBLOCK) { - int result = _pipe (fd, 4096, flags & ~O_NONBLOCK); - if (result != 0) - return result; if (set_nonblocking_flag (fd[0], true) != 0 || set_nonblocking_flag (fd[1], true) != 0) - { - int saved_errno = errno; - close (fd[0]); - close (fd[1]); - result = -1; - errno = saved_errno; - } - return result; + goto fail; } - return _pipe (fd, 4096, flags); + + return 0; #else /* Unix API. */ @@ -131,6 +125,8 @@ pipe2 (int fd[2], int flags) return 0; +#endif + fail: { int saved_errno = errno; @@ -139,6 +135,4 @@ pipe2 (int fd[2], int flags) errno = saved_errno; return -1; } - -#endif } -- cgit v1.2.1 From 05414bd22e5c18afd876aa481fb6648458bad6b5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 18 Apr 2011 10:46:53 +0200 Subject: nonblocking tests: Tweak comment. --- tests/test-nonblocking-reader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-nonblocking-reader.h b/tests/test-nonblocking-reader.h index 2099b69b25..220862ff2d 100644 --- a/tests/test-nonblocking-reader.h +++ b/tests/test-nonblocking-reader.h @@ -106,7 +106,7 @@ full_read_from_nonblocking_fd (size_t fd, void *buf, size_t count) dbgfprintf (stderr, "%s: << read -> %ld%s\n", PROG_ROLE, (long) ret, dbgstrerror (ret < 0, saved_errno)); /* This assertion fails if the non-blocking flag is effectively not set - on fd = STDIN_FILENO. */ + on fd. */ ASSERT (spent_time < 0.5); if (ret < 0) { -- cgit v1.2.1 From 12856373f8fd28a9d4453d6df97b2fdd17ced398 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 19 Apr 2011 10:38:30 +0200 Subject: Move the support of O_NONBLOCK in open() to the 'open' module. * modules/nonblocking (Depends-on): Remove 'open'. * m4/nonblocking.m4 (gl_NONBLOCKING_IO_BODY): Set gl_cv_have_open_O_NONBLOCK. * m4/open.m4 (gl_FUNC_OPEN): Replace open() also when required for O_NONBLOCK support. * doc/posix-functions/open.texi: Document support for O_NONBLOCK. --- ChangeLog | 10 ++++++++++ doc/posix-functions/open.texi | 4 ++++ m4/nonblocking.m4 | 8 +++++++- m4/open.m4 | 11 ++++++++++- modules/nonblocking | 1 - 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5e07aa078..48a12610ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-04-19 Bruno Haible + + Move the support of O_NONBLOCK in open() to the 'open' module. + * modules/nonblocking (Depends-on): Remove 'open'. + * m4/nonblocking.m4 (gl_NONBLOCKING_IO_BODY): Set + gl_cv_have_open_O_NONBLOCK. + * m4/open.m4 (gl_FUNC_OPEN): Replace open() also when required for + O_NONBLOCK support. + * doc/posix-functions/open.texi: Document support for O_NONBLOCK. + 2011-04-17 Bruno Haible pipe2: Simplify code. diff --git a/doc/posix-functions/open.texi b/doc/posix-functions/open.texi index 223126f61e..7ccb4861e4 100644 --- a/doc/posix-functions/open.texi +++ b/doc/posix-functions/open.texi @@ -14,6 +14,10 @@ and (without the slash) names a nonexistent file or a file that is not a directory, on some platforms: FreeBSD 7.2, AIX 7.1, HP-UX 11.00, Solaris 9, Irix 5.3. @item +This function does not support the @code{O_NONBLOCK} flag when it is defined +by the gnulib module @code{nonblock} on some platforms: +mingw. +@item On Windows platforms (excluding Cygwin), this function does usually not recognize the @file{/dev/null} filename. @end itemize diff --git a/m4/nonblocking.m4 b/m4/nonblocking.m4 index 8224626bef..fd6faeea63 100644 --- a/m4/nonblocking.m4 +++ b/m4/nonblocking.m4 @@ -1,4 +1,4 @@ -# nonblocking.m4 serial 1 +# nonblocking.m4 serial 2 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,6 +6,8 @@ dnl with or without modifications, as long as this notice is preserved. dnl Tests whether non-blocking I/O is natively supported by read(), write(). dnl Sets gl_cv_have_nonblocking. +dnl Also tests whether open() supports O_NONBLOCK. +dnl Sets gl_cv_have_open_O_NONBLOCK. AC_DEFUN([gl_NONBLOCKING_IO], [ dnl Use AC_REQUIRE here, so that the default behavior below is expanded @@ -20,4 +22,8 @@ AC_DEFUN([gl_NONBLOCKING_IO_BODY], mingw*) gl_cv_have_nonblocking=no ;; *) gl_cv_have_nonblocking=yes ;; esac + case "$host_os" in + mingw*) gl_cv_have_open_O_NONBLOCK=no ;; + *) gl_cv_have_open_O_NONBLOCK=yes ;; + esac ]) diff --git a/m4/open.m4 b/m4/open.m4 index bfebdab7b6..690cc648d0 100644 --- a/m4/open.m4 +++ b/m4/open.m4 @@ -1,4 +1,4 @@ -# open.m4 serial 11 +# open.m4 serial 12 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -62,6 +62,15 @@ changequote([,])dnl esac ;; esac + dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag. + m4_ifdef([gl_NONBLOCKING_IO], [ + if test $REPLACE_OPEN = 0; then + gl_NONBLOCKING_IO + if test $gl_cv_have_open_O_NONBLOCK != yes; then + gl_REPLACE_OPEN + fi + fi + ]) ]) AC_DEFUN([gl_REPLACE_OPEN], diff --git a/modules/nonblocking b/modules/nonblocking index cce41db972..2d469ebaa4 100644 --- a/modules/nonblocking +++ b/modules/nonblocking @@ -12,7 +12,6 @@ m4/asm-underscore.m4 Depends-on: fcntl-h ioctl -open stdbool stdio sys_socket -- cgit v1.2.1 From 6110d07dee40692d43f2ef8884230e0d53c56548 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 18 Apr 2011 02:34:47 +0200 Subject: ioctl: Remove link dependency on native Windows. * lib/fd-hook.h: Renamed from lib/close-hook.h. (gl_close_fn, gl_ioctl_fn): New types. (struct fd_hook): Renamed from struct close_hook. Change type of private_close_fn field. Add private_ioctl_fn field. (close_hook_fn): Add parameter for primary close method. (execute_close_hooks, execute_all_close_hooks): Likewise. (ioctl_hook_fn): New type. (execute_ioctl_hooks, execute_all_ioctl_hooks): New declarations. (register_fd_hook): Renamed from register_close_hook. Add ioctl_hook argument. (unregister_fd_hook): Renamed from unregister_close_hook. * lib/fd-hook.c: Renamed from lib/close-hook.c. Don't include . (close): Remove undef. (anchor): Update. (execute_close_hooks): Add argument for primary close method. (execute_all_close_hooks): Likewise. (execute_ioctl_hooks, execute_all_ioctl_hooks): New functions. (register_fd_hook): Renamed from register_close_hook. Add ioctl_hook argument. Allow each argument to be NULL. (unregister_fd_hook): Renamed from unregister_close_hook. * lib/close.c (rpl_close): Pass 'close' function pointer to execute_all_close_hooks. * lib/ioctl.c: Include , fd-hook.h. (primary_ioctl): New function. (ioctl): Don't call ioctlsocket here. Instead, call execute_all_ioctl_hooks. * lib/sockets.c (close_fd_maybe_socket): Add argument for primary close method. (ioctl_fd_maybe_socket): New function, with code from lib/ioctl.c. (fd_sockets_hook): Renamed from close_sockets_hook. (gl_sockets_startup, gl_sockets_cleanup): Update. * modules/fd-hook: Renamed from modules/close-hook. Update. * modules/close (Depends-on): Add fd-hook, remove close-hook. * modules/sockets (Depends-on): Likewise. * modules/ioctl (Depends-on): Add fd-hook. * tests/test-nonblocking.c (main): Use GNULIB_TEST_SOCKET, not GNULIB_SOCKET. --- ChangeLog | 42 +++++++++++++++++ NEWS | 3 ++ lib/close-hook.c | 91 ------------------------------------ lib/close-hook.h | 72 ---------------------------- lib/close.c | 4 +- lib/fd-hook.c | 116 +++++++++++++++++++++++++++++++++++++++++++++ lib/fd-hook.h | 119 +++++++++++++++++++++++++++++++++++++++++++++++ lib/ioctl.c | 43 ++++++++--------- lib/sockets.c | 43 ++++++++++++++--- modules/close | 2 +- modules/close-hook | 23 --------- modules/fd-hook | 23 +++++++++ modules/ioctl | 1 + modules/sockets | 2 +- tests/test-nonblocking.c | 4 +- 15 files changed, 366 insertions(+), 222 deletions(-) delete mode 100644 lib/close-hook.c delete mode 100644 lib/close-hook.h create mode 100644 lib/fd-hook.c create mode 100644 lib/fd-hook.h delete mode 100644 modules/close-hook create mode 100644 modules/fd-hook diff --git a/ChangeLog b/ChangeLog index 48a12610ef..8a267bf7b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +2011-04-19 Bruno Haible + + ioctl: Remove link dependency on native Windows. + * lib/fd-hook.h: Renamed from lib/close-hook.h. + (gl_close_fn, gl_ioctl_fn): New types. + (struct fd_hook): Renamed from struct close_hook. Change type of + private_close_fn field. Add private_ioctl_fn field. + (close_hook_fn): Add parameter for primary close method. + (execute_close_hooks, execute_all_close_hooks): Likewise. + (ioctl_hook_fn): New type. + (execute_ioctl_hooks, execute_all_ioctl_hooks): New declarations. + (register_fd_hook): Renamed from register_close_hook. Add ioctl_hook + argument. + (unregister_fd_hook): Renamed from unregister_close_hook. + * lib/fd-hook.c: Renamed from lib/close-hook.c. + Don't include . + (close): Remove undef. + (anchor): Update. + (execute_close_hooks): Add argument for primary close method. + (execute_all_close_hooks): Likewise. + (execute_ioctl_hooks, execute_all_ioctl_hooks): New functions. + (register_fd_hook): Renamed from register_close_hook. Add ioctl_hook + argument. Allow each argument to be NULL. + (unregister_fd_hook): Renamed from unregister_close_hook. + * lib/close.c (rpl_close): Pass 'close' function pointer to + execute_all_close_hooks. + * lib/ioctl.c: Include , fd-hook.h. + (primary_ioctl): New function. + (ioctl): Don't call ioctlsocket here. Instead, call + execute_all_ioctl_hooks. + * lib/sockets.c (close_fd_maybe_socket): Add argument for primary + close method. + (ioctl_fd_maybe_socket): New function, with code from lib/ioctl.c. + (fd_sockets_hook): Renamed from close_sockets_hook. + (gl_sockets_startup, gl_sockets_cleanup): Update. + * modules/fd-hook: Renamed from modules/close-hook. Update. + * modules/close (Depends-on): Add fd-hook, remove close-hook. + * modules/sockets (Depends-on): Likewise. + * modules/ioctl (Depends-on): Add fd-hook. + * tests/test-nonblocking.c (main): Use GNULIB_TEST_SOCKET, not + GNULIB_SOCKET. + 2011-04-19 Bruno Haible Move the support of O_NONBLOCK in open() to the 'open' module. diff --git a/NEWS b/NEWS index 767d0ab01b..7dd126dac6 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ User visible incompatible changes Date Modules Changes +2011-04-19 close-hook This module has been renamed to 'fd-hook' and + generalized. + 2011-03-08 regex-quote The last argument is no longer an 'int cflags' but instead a pointer to a previously constructed 'struct regex_quote_spec'. diff --git a/lib/close-hook.c b/lib/close-hook.c deleted file mode 100644 index 0fdf323588..0000000000 --- a/lib/close-hook.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Hook for making the close() function extensible. - Copyright (C) 2009-2011 Free Software Foundation, Inc. - Written by Bruno Haible , 2009. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU Lesser 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - -#include - -/* Specification. */ -#include "close-hook.h" - -#include -#include - -#undef close - - -/* Currently, this entire code is only needed for the handling of sockets - on native Windows platforms. */ -#if WINDOWS_SOCKETS - -/* The first and last link in the doubly linked list. - Initially the list is empty. */ -static struct close_hook anchor = { &anchor, &anchor, NULL }; - -int -execute_close_hooks (int fd, const struct close_hook *remaining_list) -{ - if (remaining_list == &anchor) - /* End of list reached. */ - return close (fd); - else - return remaining_list->private_fn (fd, remaining_list->private_next); -} - -int -execute_all_close_hooks (int fd) -{ - return execute_close_hooks (fd, anchor.private_next); -} - -void -register_close_hook (close_hook_fn hook, struct close_hook *link) -{ - if (link->private_next == NULL && link->private_prev == NULL) - { - /* Add the link to the doubly linked list. */ - link->private_next = anchor.private_next; - link->private_prev = &anchor; - link->private_fn = hook; - anchor.private_next->private_prev = link; - anchor.private_next = link; - } - else - { - /* The link is already in use. */ - if (link->private_fn != hook) - abort (); - } -} - -void -unregister_close_hook (struct close_hook *link) -{ - struct close_hook *next = link->private_next; - struct close_hook *prev = link->private_prev; - - if (next != NULL && prev != NULL) - { - /* The link is in use. Remove it from the doubly linked list. */ - prev->private_next = next; - next->private_prev = prev; - /* Clear the link, to mark it unused. */ - link->private_next = NULL; - link->private_prev = NULL; - link->private_fn = NULL; - } -} - -#endif diff --git a/lib/close-hook.h b/lib/close-hook.h deleted file mode 100644 index adcf11c22a..0000000000 --- a/lib/close-hook.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Hook for making the close() function extensible. - Copyright (C) 2009-2011 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU Lesser 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - -#ifndef CLOSE_HOOK_H -#define CLOSE_HOOK_H - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Currently, this entire code is only needed for the handling of sockets - on native Windows platforms. */ -#if WINDOWS_SOCKETS - - -/* An element of the list of close hooks. - The fields of this structure are considered private. */ -struct close_hook -{ - /* Doubly linked list. */ - struct close_hook *private_next; - struct close_hook *private_prev; - /* Function that treats the types of FD that it knows about and calls - execute_close_hooks (FD, REMAINING_LIST) as a fallback. */ - int (*private_fn) (int fd, const struct close_hook *remaining_list); -}; - -/* This type of function closes FD, applying special knowledge for the FD - types it knows about, and calls execute_close_hooks (FD, REMAINING_LIST) - for the other FD types. */ -typedef int (*close_hook_fn) (int fd, const struct close_hook *remaining_list); - -/* Execute the close hooks in REMAINING_LIST. - Return 0 or -1, like close() would do. */ -extern int execute_close_hooks (int fd, const struct close_hook *remaining_list); - -/* Execute all close hooks. - Return 0 or -1, like close() would do. */ -extern int execute_all_close_hooks (int fd); - -/* Add a function to the list of close hooks. - The LINK variable points to a piece of memory which is guaranteed to be - accessible until the corresponding call to unregister_close_hook. */ -extern void register_close_hook (close_hook_fn hook, struct close_hook *link); - -/* Removes a function from the list of close hooks. */ -extern void unregister_close_hook (struct close_hook *link); - - -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /* CLOSE_HOOK_H */ diff --git a/lib/close.c b/lib/close.c index 1c06c166f7..2c41c75b8b 100644 --- a/lib/close.c +++ b/lib/close.c @@ -19,7 +19,7 @@ /* Specification. */ #include -#include "close-hook.h" +#include "fd-hook.h" /* Override close() to call into other gnulib modules. */ @@ -28,7 +28,7 @@ rpl_close (int fd) #undef close { #if WINDOWS_SOCKETS - int retval = execute_all_close_hooks (fd); + int retval = execute_all_close_hooks (close, fd); #else int retval = close (fd); #endif diff --git a/lib/fd-hook.c b/lib/fd-hook.c new file mode 100644 index 0000000000..40fbeeb345 --- /dev/null +++ b/lib/fd-hook.c @@ -0,0 +1,116 @@ +/* Hook for making making file descriptor functions close(), ioctl() extensible. + Copyright (C) 2009-2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2009. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "fd-hook.h" + +#include + +/* Currently, this entire code is only needed for the handling of sockets + on native Windows platforms. */ +#if WINDOWS_SOCKETS + +/* The first and last link in the doubly linked list. + Initially the list is empty. */ +static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL }; + +int +execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary, + int fd) +{ + if (remaining_list == &anchor) + /* End of list reached. */ + return primary (fd); + else + return remaining_list->private_close_fn (remaining_list->private_next, + primary, fd); +} + +int +execute_all_close_hooks (gl_close_fn primary, int fd) +{ + return execute_close_hooks (anchor.private_next, primary, fd); +} + +int +execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary, + int fd, int request, void *arg) +{ + if (remaining_list == &anchor) + /* End of list reached. */ + return primary (fd, request, arg); + else + return remaining_list->private_ioctl_fn (remaining_list->private_next, + primary, fd, request, arg); +} + +int +execute_all_ioctl_hooks (gl_ioctl_fn primary, + int fd, int request, void *arg) +{ + return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg); +} + +void +register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link) +{ + if (close_hook == NULL) + close_hook = execute_close_hooks; + if (ioctl_hook == NULL) + ioctl_hook = execute_ioctl_hooks; + + if (link->private_next == NULL && link->private_prev == NULL) + { + /* Add the link to the doubly linked list. */ + link->private_next = anchor.private_next; + link->private_prev = &anchor; + link->private_close_fn = close_hook; + link->private_ioctl_fn = ioctl_hook; + anchor.private_next->private_prev = link; + anchor.private_next = link; + } + else + { + /* The link is already in use. */ + if (link->private_close_fn != close_hook + || link->private_ioctl_fn != ioctl_hook) + abort (); + } +} + +void +unregister_fd_hook (struct fd_hook *link) +{ + struct fd_hook *next = link->private_next; + struct fd_hook *prev = link->private_prev; + + if (next != NULL && prev != NULL) + { + /* The link is in use. Remove it from the doubly linked list. */ + prev->private_next = next; + next->private_prev = prev; + /* Clear the link, to mark it unused. */ + link->private_next = NULL; + link->private_prev = NULL; + link->private_close_fn = NULL; + link->private_ioctl_fn = NULL; + } +} + +#endif diff --git a/lib/fd-hook.h b/lib/fd-hook.h new file mode 100644 index 0000000000..aab4d913c1 --- /dev/null +++ b/lib/fd-hook.h @@ -0,0 +1,119 @@ +/* Hook for making making file descriptor functions close(), ioctl() extensible. + Copyright (C) 2009-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + + +#ifndef FD_HOOK_H +#define FD_HOOK_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Currently, this entire code is only needed for the handling of sockets + on native Windows platforms. */ +#if WINDOWS_SOCKETS + + +/* Type of function that closes FD. */ +typedef int (*gl_close_fn) (int fd); + +/* Type of function that applies a control request to FD. */ +typedef int (*gl_ioctl_fn) (int fd, int request, void *arg); + +/* An element of the list of file descriptor hooks. + In CLOS (Common Lisp Object System) speak, it consists of an "around" + method for the close() function and an "around" method for the ioctl() + function. + The fields of this structure are considered private. */ +struct fd_hook +{ + /* Doubly linked list. */ + struct fd_hook *private_next; + struct fd_hook *private_prev; + /* Function that treats the types of FD that it knows about and calls + execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback. */ + int (*private_close_fn) (const struct fd_hook *remaining_list, + gl_close_fn primary, + int fd); + /* Function that treats the types of FD that it knows about and calls + execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a + fallback. */ + int (*private_ioctl_fn) (const struct fd_hook *remaining_list, + gl_ioctl_fn primary, + int fd, int request, void *arg); +}; + +/* This type of function closes FD, applying special knowledge for the FD + types it knows about, and calls + execute_close_hooks (REMAINING_LIST, PRIMARY, FD) + for the other FD types. + In CLOS speak, REMAINING_LIST is the remaining list of "around" methods, + and PRIMARY is the "primary" method for close(). */ +typedef int (*close_hook_fn) (const struct fd_hook *remaining_list, + gl_close_fn primary, + int fd); + +/* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method. + Return 0 or -1, like close() would do. */ +extern int execute_close_hooks (const struct fd_hook *remaining_list, + gl_close_fn primary, + int fd); + +/* Execute all close hooks, with PRIMARY as "primary" method. + Return 0 or -1, like close() would do. */ +extern int execute_all_close_hooks (gl_close_fn primary, int fd); + +/* This type of function applies a control request to FD, applying special + knowledge for the FD types it knows about, and calls + execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) + for the other FD types. + In CLOS speak, REMAINING_LIST is the remaining list of "around" methods, + and PRIMARY is the "primary" method for ioctl(). */ +typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list, + gl_ioctl_fn primary, + int fd, int request, void *arg); + +/* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method. + Return 0 or -1, like ioctl() would do. */ +extern int execute_ioctl_hooks (const struct fd_hook *remaining_list, + gl_ioctl_fn primary, + int fd, int request, void *arg); + +/* Execute all ioctl hooks, with PRIMARY as "primary" method. + Return 0 or -1, like ioctl() would do. */ +extern int execute_all_ioctl_hooks (gl_ioctl_fn primary, + int fd, int request, void *arg); + +/* Add a function pair to the list of file descriptor hooks. + CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change. + The LINK variable points to a piece of memory which is guaranteed to be + accessible until the corresponding call to unregister_fd_hook. */ +extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, + struct fd_hook *link); + +/* Removes a hook from the list of file descriptor hooks. */ +extern void unregister_fd_hook (struct fd_hook *link); + + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* FD_HOOK_H */ diff --git a/lib/ioctl.c b/lib/ioctl.c index 00caf3b187..c6ba989ee5 100644 --- a/lib/ioctl.c +++ b/lib/ioctl.c @@ -44,40 +44,35 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */) #else /* mingw */ -# define WIN32_LEAN_AND_MEAN -/* Get winsock2.h. */ -# include +# include -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -# include "w32sock.h" +# include "fd-hook.h" -int -ioctl (int fd, int req, ...) +static int +primary_ioctl (int fd, int request, void *arg) { -# if GNULIB_SOCKET - void *buf; - va_list args; - SOCKET sock; - int r; - - va_start (args, req); - buf = va_arg (args, void *); - va_end (args); - /* We don't support FIONBIO on pipes here. If you want to make pipe fds non-blocking, use the gnulib 'nonblocking' module, until gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK. */ - sock = FD_TO_SOCKET (fd); - r = ioctlsocket (sock, req, buf); - if (r < 0) - set_winsock_errno (); + errno = ENOSYS; + return -1; +} + +int +ioctl (int fd, int request, ... /* {void *,char *} arg */) +{ + void *arg; + va_list args; - return r; + va_start (args, request); + arg = va_arg (args, void *); + va_end (args); +# if WINDOWS_SOCKETS + return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg); # else - errno = ENOSYS; - return -1; + return primary_ioctl (fd, request, arg); # endif } diff --git a/lib/sockets.c b/lib/sockets.c index 4e905e1ddd..42b8f9ea58 100644 --- a/lib/sockets.c +++ b/lib/sockets.c @@ -27,13 +27,15 @@ /* This includes winsock2.h on MinGW. */ # include -# include "close-hook.h" +# include "fd-hook.h" /* Get set_winsock_errno, FD_TO_SOCKET etc. */ # include "w32sock.h" static int -close_fd_maybe_socket (int fd, const struct close_hook *remaining_list) +close_fd_maybe_socket (const struct fd_hook *remaining_list, + gl_close_fn primary, + int fd) { SOCKET sock; WSANETWORKEVENTS ev; @@ -64,10 +66,38 @@ close_fd_maybe_socket (int fd, const struct close_hook *remaining_list) } else /* Some other type of file descriptor. */ - return execute_close_hooks (fd, remaining_list); + return execute_close_hooks (remaining_list, primary, fd); } -static struct close_hook close_sockets_hook; +static int +ioctl_fd_maybe_socket (const struct fd_hook *remaining_list, + gl_ioctl_fn primary, + int fd, int request, void *arg) +{ + SOCKET sock; + WSANETWORKEVENTS ev; + + /* Test whether fd refers to a socket. */ + sock = FD_TO_SOCKET (fd); + ev.lNetworkEvents = 0xDEADBEEF; + WSAEnumNetworkEvents (sock, NULL, &ev); + if (ev.lNetworkEvents != 0xDEADBEEF) + { + /* fd refers to a socket. */ + if (ioctlsocket (sock, request, arg) < 0) + { + set_winsock_errno (); + return -1; + } + else + return 0; + } + else + /* Some other type of file descriptor. */ + return execute_ioctl_hooks (remaining_list, primary, fd, request, arg); +} + +static struct fd_hook fd_sockets_hook; static int initialized_sockets_version /* = 0 */; @@ -90,7 +120,8 @@ gl_sockets_startup (int version _GL_UNUSED) return 2; if (initialized_sockets_version == 0) - register_close_hook (close_fd_maybe_socket, &close_sockets_hook); + register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket, + &fd_sockets_hook); initialized_sockets_version = version; } @@ -107,7 +138,7 @@ gl_sockets_cleanup (void) initialized_sockets_version = 0; - unregister_close_hook (&close_sockets_hook); + unregister_fd_hook (&fd_sockets_hook); err = WSACleanup (); if (err != 0) diff --git a/modules/close b/modules/close index e294292b02..88e1608726 100644 --- a/modules/close +++ b/modules/close @@ -7,7 +7,7 @@ m4/close.m4 Depends-on: unistd -close-hook +fd-hook fclose configure.ac: diff --git a/modules/close-hook b/modules/close-hook deleted file mode 100644 index ae32ad0530..0000000000 --- a/modules/close-hook +++ /dev/null @@ -1,23 +0,0 @@ -Description: -Hook for making close() extensible. - -Files: -lib/close-hook.h -lib/close-hook.c - -Depends-on: -unistd - -configure.ac: - -Makefile.am: -lib_SOURCES += close-hook.c - -Include: -"close-hook.h" - -License: -LGPLv2+ - -Maintainer: -Bruno Haible diff --git a/modules/fd-hook b/modules/fd-hook new file mode 100644 index 0000000000..7127083763 --- /dev/null +++ b/modules/fd-hook @@ -0,0 +1,23 @@ +Description: +Hook for making file descriptor functions (close(), ioctl()) extensible. + +Files: +lib/fd-hook.h +lib/fd-hook.c + +Depends-on: +unistd + +configure.ac: + +Makefile.am: +lib_SOURCES += fd-hook.c + +Include: +"fd-hook.h" + +License: +LGPLv2+ + +Maintainer: +Bruno Haible diff --git a/modules/ioctl b/modules/ioctl index 5ba70ed98c..6a54f0318b 100644 --- a/modules/ioctl +++ b/modules/ioctl @@ -10,6 +10,7 @@ Depends-on: sys_ioctl sys_socket errno +fd-hook configure.ac: gl_FUNC_IOCTL diff --git a/modules/sockets b/modules/sockets index b79a02fb7c..fe9292631c 100644 --- a/modules/sockets +++ b/modules/sockets @@ -10,7 +10,7 @@ m4/sockets.m4 Depends-on: socketlib sys_socket -close-hook +fd-hook configure.ac: gl_SOCKETS diff --git a/tests/test-nonblocking.c b/tests/test-nonblocking.c index bfeef7bf71..f3f1f1355b 100644 --- a/tests/test-nonblocking.c +++ b/tests/test-nonblocking.c @@ -79,7 +79,7 @@ main (void) ASSERT (close (fd_pipe[1]) == 0); #endif /* GNULIB_TEST_PIPE2 */ -#if GNULIB_SOCKET +#if GNULIB_TEST_SOCKET { /* Test sockets. */ bool sock_works = true; @@ -104,7 +104,7 @@ main (void) ASSERT (close (fd_sock) == 0); # endif /* SOCK_NONBLOCK */ } -#endif /* GNULIB_SOCKET */ +#endif /* GNULIB_TEST_SOCKET */ /* Test error handling. */ { -- cgit v1.2.1 From fc013226bfab5c68c85325e35f6a5fa1facb371e Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 20 Apr 2011 00:49:54 +0200 Subject: doc: update users.txt. * users.txt: Add barcode. --- ChangeLog | 5 +++++ users.txt | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8a267bf7b8..1787060263 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-20 Giuseppe Scrivano + + doc: update users.txt. + * users.txt: Add barcode. + 2011-04-19 Bruno Haible ioctl: Remove link dependency on native Windows. diff --git a/users.txt b/users.txt index 7151184ffb..b56239fc71 100644 --- a/users.txt +++ b/users.txt @@ -7,6 +7,7 @@ The following packages appear to be using gnulib and gnulib-tool: anubis http://cvs.sv.gnu.org/viewcvs/anubis/anubis/ augeas http://augeas.net/ autobuild http://josefsson.org/autobuild/ + barcode http://git.sv.gnu.org/cgit/barcode.git/ bison http://git.sv.gnu.org/gitweb/?p=bison.git clisp http://clisp.cvs.sourceforge.net/clisp/clisp/ coreutils http://git.sv.gnu.org/gitweb/?p=coreutils.git -- cgit v1.2.1 From 67ce653056298965788199437efe1e0f6c06eec5 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 20 Apr 2011 15:44:54 +0200 Subject: useless-if-before-free: avoid false-positive * build-aux/useless-if-before-free: Adjust regexp for the non-brace disjunct so that it too requires a terminating ";". Without that, this script would identify as useless one statement from gcc that was not: if (aligned_ptr) free (((void **) aligned_ptr) [-1]); --- ChangeLog | 10 ++++++++++ build-aux/useless-if-before-free | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1787060263..5081b45943 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-04-20 Jim Meyering + + useless-if-before-free: avoid false-positive + * build-aux/useless-if-before-free: Adjust regexp for the non-brace + disjunct so that it too requires a terminating ";". Without that, + this script would identify as useless one statement from gcc that + was not: + if (aligned_ptr) + free (((void **) aligned_ptr) [-1]); + 2011-04-20 Giuseppe Scrivano doc: update users.txt. diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free index a6c228bcf4..b8f5a2635e 100755 --- a/build-aux/useless-if-before-free +++ b/build-aux/useless-if-before-free @@ -4,7 +4,7 @@ eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}' # Detect instances of "if (p) free (p);". # Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces. -my $VERSION = '2011-01-09 01:39'; # UTC +my $VERSION = '2011-04-20 13:43'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -132,7 +132,7 @@ sub is_NULL ($) while ($line =~ /\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\) # 1 2 3 - (?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)| + (?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;| \s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg) { my $all = $1; @@ -179,7 +179,7 @@ free=xfree git grep -l -z "$free *(" \ | xargs -0 useless-if-before-free -l --name="$free" \ | xargs -0 perl -0x3b -pi -e \ - 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s' + 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s' # Use the following to remove redundant uses of kfree inside braces. # Note that -0777 puts perl in slurp-whole-file mode; -- cgit v1.2.1 From 753425d56eedab92c361cae9d6baa701d893fbc9 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 21 Apr 2011 08:51:12 -0600 Subject: sys_uio: new module For now, just provide the types used by sys/socket. We could add readv() and writev() later, if desired. * modules/sys_uio: New module. * modules/sys_uio-tests: Likewise. * lib/sys_uio.in.h: New file. * m4/sys_uio_h.m4: Likewise. * tests/test-sys_uio.c: Likewise. * doc/posix-headers/sys_uio.texi (sys/uio.h): Document it. * MODULES.html.sh (systems lacking POSIX:2008): Likewise. Signed-off-by: Eric Blake --- ChangeLog | 11 ++++++++++ MODULES.html.sh | 1 + doc/posix-headers/sys_uio.texi | 8 +++---- lib/sys_uio.in.h | 49 ++++++++++++++++++++++++++++++++++++++++++ m4/sys_uio_h.m4 | 31 ++++++++++++++++++++++++++ modules/sys_uio | 42 ++++++++++++++++++++++++++++++++++++ modules/sys_uio-tests | 10 +++++++++ tests/test-sys_uio.c | 32 +++++++++++++++++++++++++++ 8 files changed, 180 insertions(+), 4 deletions(-) create mode 100644 lib/sys_uio.in.h create mode 100644 m4/sys_uio_h.m4 create mode 100644 modules/sys_uio create mode 100644 modules/sys_uio-tests create mode 100644 tests/test-sys_uio.c diff --git a/ChangeLog b/ChangeLog index 5081b45943..4f8321a1e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-04-21 Eric Blake + + sys_uio: new module + * modules/sys_uio: New module. + * modules/sys_uio-tests: Likewise. + * lib/sys_uio.in.h: New file. + * m4/sys_uio_h.m4: Likewise. + * tests/test-sys_uio.c: Likewise. + * doc/posix-headers/sys_uio.texi (sys/uio.h): Document it. + * MODULES.html.sh (systems lacking POSIX:2008): Likewise. + 2011-04-20 Jim Meyering useless-if-before-free: avoid false-positive diff --git a/MODULES.html.sh b/MODULES.html.sh index 708f3cccfc..8d32a21258 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2464,6 +2464,7 @@ func_all_modules () func_module sys_stat func_module sys_time func_module sys_times + func_module sys_uio func_module sys_utsname func_module sys_wait func_module tsearch diff --git a/doc/posix-headers/sys_uio.texi b/doc/posix-headers/sys_uio.texi index 44282f22f6..bc4825400d 100644 --- a/doc/posix-headers/sys_uio.texi +++ b/doc/posix-headers/sys_uio.texi @@ -3,15 +3,15 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html} -Gnulib module: --- +Gnulib module: sys_uio Portability problems fixed by Gnulib: @itemize +@item +This header file is missing on some platforms: +mingw. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This header file is missing on some platforms: -mingw. @end itemize diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h new file mode 100644 index 0000000000..175ee0fb6d --- /dev/null +++ b/lib/sys_uio.in.h @@ -0,0 +1,49 @@ +/* Substitute for . + Copyright (C) 2011 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 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +# if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +# endif +@PRAGMA_COLUMNS@ + +#ifndef _GL_SYS_UIO_H + +#if @HAVE_SYS_UIO_H@ + +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@ + +#endif + +#ifndef _GL_SYS_UIO_H +#define _GL_SYS_UIO_H + +#if !@HAVE_SYS_UIO_H@ +/* A platform that lacks . */ +/* Get 'ssize_t'. */ +# include + +/* All known platforms that lack also lack any declaration + of struct iovec in any other header. */ +struct iovec { + void *iov_base; + size_t iov_len; +}; +#endif + +#endif /* _GL_SYS_UIO_H */ +#endif /* _GL_SYS_UIO_H */ diff --git a/m4/sys_uio_h.m4 b/m4/sys_uio_h.m4 new file mode 100644 index 0000000000..bafa0ac457 --- /dev/null +++ b/m4/sys_uio_h.m4 @@ -0,0 +1,31 @@ +# sys_uio_h.m4 serial 1 +dnl Copyright (C) 2011 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. + +AC_DEFUN([gl_HEADER_SYS_UIO], +[ + AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) + dnl is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([sys/uio.h]) + if test $ac_cv_header_sys_uio_h = yes; then + HAVE_SYS_UIO_H=1 + else + HAVE_SYS_UIO_H=0 + fi + AC_SUBST([HAVE_SYS_UIO_H]) +]) + +AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_SYS_UIO_H_DEFAULTS], +[ +]) diff --git a/modules/sys_uio b/modules/sys_uio new file mode 100644 index 0000000000..2152718cca --- /dev/null +++ b/modules/sys_uio @@ -0,0 +1,42 @@ +Description: +A POSIX-like . + +Files: +lib/sys_uio.in.h +m4/sys_uio_h.m4 + +Depends-on: +include_next + +configure.ac: +gl_HEADER_SYS_UIO +AC_PROG_MKDIR_P + +Makefile.am: +BUILT_SOURCES += sys/uio.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +sys/uio.h: sys_uio.in.h $(top_builddir)/config.status + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_UIO_H''@|$(NEXT_SYS_UIO_H)|g' \ + -e 's|@''HAVE_SYS_UIO_H''@|$(HAVE_SYS_UIO_H)|g' \ + < $(srcdir)/sys_uio.in.h; \ + } > $@-t && \ + mv -f $@-t $@ +MOSTLYCLEANFILES += sys/uio.h sys/uio.h-t +MOSTLYCLEANDIRS += sys + +Include: + + +License: +LGPLv2+ + +Maintainer: +Eric Blake diff --git a/modules/sys_uio-tests b/modules/sys_uio-tests new file mode 100644 index 0000000000..0258579530 --- /dev/null +++ b/modules/sys_uio-tests @@ -0,0 +1,10 @@ +Files: +tests/test-sys_uio.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-sys_uio +check_PROGRAMS += test-sys_uio diff --git a/tests/test-sys_uio.c b/tests/test-sys_uio.c new file mode 100644 index 0000000000..7855a6bc43 --- /dev/null +++ b/tests/test-sys_uio.c @@ -0,0 +1,32 @@ +/* Test of substitute. + Copyright (C) 2011 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 . */ + +/* Written by Eric Blake , 2011. */ + +#include + +#include + +/* Check that necessary types are defined. */ +size_t a; +ssize_t b; +struct iovec c; + +int +main (void) +{ + return a + b + !!c.iov_base + c.iov_len; +} -- cgit v1.2.1 From 06d76f63c628cb1653f3c27a1f60a46cf44665ba Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 21 Apr 2011 07:16:20 -0600 Subject: passfd: allow compilation on mingw The passfd module now skips on mingw, rather than failing to compile. It may be nice to add a sendmsg and recvmsg module in the future, but for now passfd is the only client that cares. * modules/sys_socket (Depends-on): Add sys_uio. * lib/sys_socket.in.h [!@HAVE_SYS_SOCKET_H@]: Use it for struct iovec and a minimal struct msghdr. * tests/test-sys_socket.c (main): Enhance test. * m4/afunix.m4 (gl_SOCKET_AFUNIX): Detect recvmsg/sendmsg. * lib/passfd.c (include): Drop ; is guaranteed to provide what we need. (sendmsg, recvmsg): Declare fallbacks if we lack sendmsg. * modules/passfd-tests (Depends-on): Add sys_wait. * tests/test-passfd.c (main): Skip test on mingw, for now. * doc/posix-headers/sys_socket.texi (sys/socket.h): Document the partial 'struct msghdr' implementation. Signed-off-by: Eric Blake --- ChangeLog | 14 +++++++++++++ doc/posix-headers/sys_socket.texi | 6 ++++++ lib/passfd.c | 44 +++++++++++++++++++++++++++------------ lib/sys_socket.in.h | 14 ++++++++++++- m4/afunix.m4 | 3 ++- modules/passfd-tests | 3 ++- modules/sys_socket | 1 + tests/test-passfd.c | 19 +++++++++++++++-- tests/test-sys_socket.c | 14 ++++++++----- 9 files changed, 95 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f8321a1e7..95fee4897f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2011-04-21 Eric Blake + passfd: allow compilation on mingw + * modules/sys_socket (Depends-on): Add sys_uio. + * lib/sys_socket.in.h [!@HAVE_SYS_SOCKET_H@]: Use it for struct + iovec and a minimal struct msghdr. + * m4/afunix.m4 (gl_SOCKET_AFUNIX): Detect recvmsg/sendmsg. + * tests/test-sys_socket.c (main): Enhance test. + * lib/passfd.c (include): Drop ; is + guaranteed to provide what we need. + (sendmsg, recvmsg): Declare fallbacks if we lack sendmsg. + * modules/passfd-tests (Depends-on): Add sys_wait. + * tests/test-passfd.c (main): Skip test on mingw, for now. + * doc/posix-headers/sys_socket.texi (sys/socket.h): Document the + partial 'struct msghdr' implementation. + sys_uio: new module * modules/sys_uio: New module. * modules/sys_uio-tests: Likewise. diff --git a/doc/posix-headers/sys_socket.texi b/doc/posix-headers/sys_socket.texi index c8e42280f1..f80e542544 100644 --- a/doc/posix-headers/sys_socket.texi +++ b/doc/posix-headers/sys_socket.texi @@ -29,4 +29,10 @@ AIX 7.1. Portability problems not fixed by Gnulib: @itemize +@item +This header file does not declare the @code{msg_control} and +@code{msg_controllen} members of @code{struct msghdr} on some +platforms. This can be detected by the absence of the +@code{CMSG_FIRSTHDR} macro: +gnulib replacement header, old BSD @end itemize diff --git a/lib/passfd.c b/lib/passfd.c index 1ab94b48b3..5d4c6a7621 100644 --- a/lib/passfd.c +++ b/lib/passfd.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -38,6 +37,7 @@ # define MSG_CMSG_CLOEXEC 0 #endif +#if HAVE_SENDMSG /* sendfd sends the file descriptor fd along the socket to a process calling recvfd on the other end. @@ -49,10 +49,10 @@ sendfd (int sock, int fd) char send = 0; struct iovec iov; struct msghdr msg; -#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY struct cmsghdr *cmsg; char buf[CMSG_SPACE (sizeof fd)]; -#endif +# endif /* send at least one char */ memset (&msg, 0, sizeof msg); @@ -63,7 +63,7 @@ sendfd (int sock, int fd) msg.msg_name = NULL; msg.msg_namelen = 0; -#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY msg.msg_control = buf; msg.msg_controllen = sizeof buf; cmsg = CMSG_FIRSTHDR (&msg); @@ -72,19 +72,29 @@ sendfd (int sock, int fd) cmsg->cmsg_len = CMSG_LEN (sizeof fd); /* Initialize the payload: */ memcpy (CMSG_DATA (cmsg), &fd, sizeof fd); -#elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY +# elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY msg.msg_accrights = &fd; msg.msg_accrightslen = sizeof fd; -#else +# else errno = ENOSYS; return -1; -#endif +# endif if (sendmsg (sock, &msg, 0) != iov.iov_len) return -1; return 0; } +#else +int +sendfd (int sock _GL_UNUSED, int fd _GL_UNUSED) +{ + errno = ENOSYS; + return -1; +} +#endif + +#if HAVE_RECVMSG /* recvfd receives a file descriptor through the socket. The flags are a bitmask, possibly including O_CLOEXEC (defined in ). @@ -97,11 +107,11 @@ recvfd (int sock, int flags) struct iovec iov; struct msghdr msg; int fd = -1; -#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY struct cmsghdr *cmsg; char buf[CMSG_SPACE (sizeof fd)]; int flags_recvmsg = flags & O_CLOEXEC ? MSG_CMSG_CLOEXEC : 0; -#endif +# endif if ((flags & ~O_CLOEXEC) != 0) { @@ -118,7 +128,7 @@ recvfd (int sock, int flags) msg.msg_name = NULL; msg.msg_namelen = 0; -#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY msg.msg_control = buf; msg.msg_controllen = sizeof buf; cmsg = CMSG_FIRSTHDR (&msg); @@ -156,7 +166,7 @@ recvfd (int sock, int flags) } } -#elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY +# elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY msg.msg_accrights = &fd; msg.msg_accrightslen = sizeof fd; if (recvmsg (sock, &msg, 0) < 0) @@ -173,9 +183,17 @@ recvfd (int sock, int flags) return -1; } } -#else +# else errno = ENOSYS; -#endif +# endif return fd; } +#else +int +recvfd (int sock _GL_UNUSED, int flags _GL_UNUSED) +{ + errno = ENOSYS; + return -1; +} +#endif diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index b60789f2a1..f9e368b6ca 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -146,7 +146,6 @@ struct sockaddr_storage suggests that getaddrinfo should be available on all Windows releases. */ - # if @HAVE_WINSOCK2_H@ # include # endif @@ -177,6 +176,19 @@ typedef int socklen_t; # endif +/* For struct iovec */ +# include + +/* Rudimentary 'struct msghdr'; this works as long as you don't try to + access msg_control or msg_controllen. */ +struct msghdr { + void *msg_name; + socklen_t msg_namelen; + struct iovec *msg_iov; + int msg_iovlen; + int msg_flags; +}; + #endif #if @HAVE_WINSOCK2_H@ diff --git a/m4/afunix.m4 b/m4/afunix.m4 index 13f758316d..3f5eb447d6 100644 --- a/m4/afunix.m4 +++ b/m4/afunix.m4 @@ -1,4 +1,4 @@ -# afunix.m4 serial 6 +# afunix.m4 serial 7 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,6 +8,7 @@ AC_DEFUN([gl_SOCKET_AFUNIX], [ AC_REQUIRE([gl_HEADER_SYS_SOCKET]) AC_REQUIRE([gl_SOCKET_FAMILY_UNIX]) + AC_CHECK_FUNCS_ONCE([recvmsg sendmsg]) AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS]) AC_CACHE_VAL([gl_cv_socket_unix_scm_rights], diff --git a/modules/passfd-tests b/modules/passfd-tests index 477754b2ba..29e3ad9323 100644 --- a/modules/passfd-tests +++ b/modules/passfd-tests @@ -3,9 +3,10 @@ tests/test-passfd.c tests/macros.h Depends-on: +sys_wait configure.ac: -AC_CHECK_DECLS_ONCE([alarm]) +AC_CHECK_DECLS_ONCE([alarm socketpair]) Makefile.am: TESTS += test-passfd diff --git a/modules/sys_socket b/modules/sys_socket index 0e9fb4e3f6..f5cd1f7d0c 100644 --- a/modules/sys_socket +++ b/modules/sys_socket @@ -13,6 +13,7 @@ c++defs errno include_next socklen +sys_uio warn-on-use configure.ac: diff --git a/tests/test-passfd.c b/tests/test-passfd.c index d657ad9d66..315e6c21ba 100644 --- a/tests/test-passfd.c +++ b/tests/test-passfd.c @@ -18,6 +18,7 @@ #include "passfd.h" +#include #include #include #include @@ -33,6 +34,7 @@ int main () { +#if HAVE_SOCKETPAIR int pair[2]; int ret; pid_t pid; @@ -41,11 +43,11 @@ main () int fd; struct stat st; -#if HAVE_DECL_ALARM +# if HAVE_DECL_ALARM /* Avoid hanging on failure. */ signal (SIGALRM, SIG_DFL); alarm (5); -#endif +# endif fdnull = open ("/dev/null", O_RDWR); if (fdnull < 0) @@ -115,4 +117,17 @@ main () } return 0; } +#else + errno = 0; + ASSERT(sendfd (0, 0) == -1); + ASSERT(errno == ENOSYS); + + errno = 0; + ASSERT(recvfd (0, 0) == -1); + ASSERT(errno == ENOSYS); + + fputs ("skipping test: socketpair not supported on this system\n", + stderr); + return 77; +#endif } diff --git a/tests/test-sys_socket.c b/tests/test-sys_socket.c index 8f323ca1d9..a6e99d6008 100644 --- a/tests/test-sys_socket.c +++ b/tests/test-sys_socket.c @@ -30,6 +30,12 @@ int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; /* Check that the 'socklen_t' type is defined. */ socklen_t t1; +/* Check that 'struct iovec' is defined. */ +struct iovec io; + +/* Check that a minimal set of 'struct msghdr' is defined. */ +struct msghdr msg; + int main (void) { @@ -51,10 +57,8 @@ main (void) x.ss_family = 42; i = 42; + msg.msg_iov = &io; - /* Tell the compiler that these variables are used. */ - (void) x; - (void) i; - - return 0; + return (x.ss_family - i + msg.msg_namelen + msg.msg_iov->iov_len + + msg.msg_iovlen); } -- cgit v1.2.1 From e55355319eb5409871be533d7b9713328a8283db Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 21 Apr 2011 11:48:22 -0600 Subject: passfd: speed up configure and drop unused code Ultimately, it would be nice to provide a sendmsg and recvmsg module, and have those provide a replacement struct msghdr and silently convert msg_accrights into the replacement struct's msg_control, when targeting older BSD. But until that point in time, this is a nice cleanup. SCM_RIGHTS really only works on Unix sockets; however, there is nothing in passfd.c that needs to be hard-coded to this (rather, the hard-coding of the address family is done externally when the socket or socketpair is created). * m4/afunix.m4 (gl_SOCKET_AFUNIX): Rename... * m4/passfd.m4 (gl_PASSFD): ...to something more fitting of its use. Drop test for setting unused HAVE_UNIXSOCKET_SCM_RIGHTS. Instead of probing at configure for unix_scm_rights_bsd44_way, instead probe for CMSG_FIRSTHDR at compile time. Simplify BSD 4.3 check to a struct member probe. * lib/passfd.c (includes): Nothing here requires . (sendfd, recvfd): Update preprocessor checks. * modules/passfd (Files): Reflect rename, and drop unused file. (Depends-on): Drop unused dependency. Signed-off-by: Eric Blake --- ChangeLog | 12 ++++++ lib/passfd.c | 15 +++----- m4/afunix.m4 | 117 --------------------------------------------------------- m4/passfd.m4 | 23 ++++++++++++ modules/passfd | 6 +-- 5 files changed, 43 insertions(+), 130 deletions(-) delete mode 100644 m4/afunix.m4 create mode 100644 m4/passfd.m4 diff --git a/ChangeLog b/ChangeLog index 95fee4897f..be6470a8fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2011-04-21 Eric Blake + passfd: speed up configure and drop unused code + * m4/afunix.m4 (gl_SOCKET_AFUNIX): Rename... + * m4/passfd.m4 (gl_PASSFD): ...to something more fitting of + its use. Drop test for setting unused HAVE_UNIXSOCKET_SCM_RIGHTS. + Instead of probing at configure for unix_scm_rights_bsd44_way, + instead probe for CMSG_FIRSTHDR at compile time. Simplify BSD 4.3 + check to a struct member probe. + * lib/passfd.c (includes): Nothing here requires . + (sendfd, recvfd): Update preprocessor checks. + * modules/passfd (Files): Reflect rename, and drop unused file. + (Depends-on): Drop unused dependency. + passfd: allow compilation on mingw * modules/sys_socket (Depends-on): Add sys_uio. * lib/sys_socket.in.h [!@HAVE_SYS_SOCKET_H@]: Use it for struct diff --git a/lib/passfd.c b/lib/passfd.c index 5d4c6a7621..a4d8841070 100644 --- a/lib/passfd.c +++ b/lib/passfd.c @@ -27,9 +27,6 @@ #include #include -#if HAVE_SYS_UN_H -# include -#endif #include "cloexec.h" @@ -49,7 +46,7 @@ sendfd (int sock, int fd) char send = 0; struct iovec iov; struct msghdr msg; -# if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# ifdef CMSG_FIRSTHDR struct cmsghdr *cmsg; char buf[CMSG_SPACE (sizeof fd)]; # endif @@ -63,7 +60,7 @@ sendfd (int sock, int fd) msg.msg_name = NULL; msg.msg_namelen = 0; -# if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# ifdef CMSG_FIRSTHDR msg.msg_control = buf; msg.msg_controllen = sizeof buf; cmsg = CMSG_FIRSTHDR (&msg); @@ -72,7 +69,7 @@ sendfd (int sock, int fd) cmsg->cmsg_len = CMSG_LEN (sizeof fd); /* Initialize the payload: */ memcpy (CMSG_DATA (cmsg), &fd, sizeof fd); -# elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY +# elif HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS msg.msg_accrights = &fd; msg.msg_accrightslen = sizeof fd; # else @@ -107,7 +104,7 @@ recvfd (int sock, int flags) struct iovec iov; struct msghdr msg; int fd = -1; -# if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# ifdef CMSG_FIRSTHDR struct cmsghdr *cmsg; char buf[CMSG_SPACE (sizeof fd)]; int flags_recvmsg = flags & O_CLOEXEC ? MSG_CMSG_CLOEXEC : 0; @@ -128,7 +125,7 @@ recvfd (int sock, int flags) msg.msg_name = NULL; msg.msg_namelen = 0; -# if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# ifdef CMSG_FIRSTHDR msg.msg_control = buf; msg.msg_controllen = sizeof buf; cmsg = CMSG_FIRSTHDR (&msg); @@ -166,7 +163,7 @@ recvfd (int sock, int flags) } } -# elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY +# elif HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS msg.msg_accrights = &fd; msg.msg_accrightslen = sizeof fd; if (recvmsg (sock, &msg, 0) < 0) diff --git a/m4/afunix.m4 b/m4/afunix.m4 deleted file mode 100644 index 3f5eb447d6..0000000000 --- a/m4/afunix.m4 +++ /dev/null @@ -1,117 +0,0 @@ -# afunix.m4 serial 7 -dnl Copyright (C) 2011 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. - -AC_DEFUN([gl_SOCKET_AFUNIX], -[ - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - AC_REQUIRE([gl_SOCKET_FAMILY_UNIX]) - AC_CHECK_FUNCS_ONCE([recvmsg sendmsg]) - - AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS]) - AC_CACHE_VAL([gl_cv_socket_unix_scm_rights], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - #ifdef HAVE_SYS_UN_H - #include - #endif - #ifdef HAVE_WINSOCK2_H - #include - #endif - ]], - [[struct cmsghdr cmh; - cmh.cmsg_level = SOL_SOCKET; - cmh.cmsg_type = SCM_RIGHTS; - if (&cmh) return 0; - ]])], - [gl_cv_socket_unix_scm_rights=yes], - [gl_cv_socket_unix_scm_rights=no]) - ]) - AC_MSG_RESULT([$gl_cv_socket_unix_scm_rights]) - if test $gl_cv_socket_unix_scm_rights = yes; then - AC_DEFINE([HAVE_UNIXSOCKET_SCM_RIGHTS], [1], - [Define to 1 if defines SCM_RIGHTS.]) - fi - - dnl Persuade AIX 5.2 to declare CMSG_SPACE, CMSG_LEN. - AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], - [Define in order to get some macros on AIX systems.]) - - AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS that behave in BSD4.4 way]) - AC_CACHE_VAL([gl_cv_socket_unix_scm_rights_bsd44_way], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - #include - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - #ifdef HAVE_SYS_UN_H - #include - #endif - #ifdef HAVE_WINSOCK2_H - #include - #endif - ]], - [[struct msghdr msg = {0}; - struct cmsghdr *cmsg; - int myfds[1] = {0}; - char buf[CMSG_SPACE (sizeof (myfds))]; - - msg.msg_control = buf; - msg.msg_controllen = sizeof buf; - cmsg = CMSG_FIRSTHDR (&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN (sizeof (int)); - /* fake Initialize the payload: */ - (void) CMSG_DATA (cmsg); - /* Sum of the length of all control messages in the buffer: */ - msg.msg_controllen = cmsg->cmsg_len; - return 0; - ]])], - [gl_cv_socket_unix_scm_rights_bsd44_way=yes], - [gl_cv_socket_unix_scm_rights_bsd44_way=no]) - ]) - AC_MSG_RESULT([$gl_cv_socket_unix_scm_rights_bsd44_way]) - if test $gl_cv_socket_unix_scm_rights_bsd44_way = yes; then - AC_DEFINE([HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY], [1], - [Define to 1 if fd can be sent/received in the BSD4.4 way.]) - fi - - AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS that behave in BSD4.3 way]) - AC_CACHE_VAL([gl_cv_socket_unix_scm_rights_bsd43_way], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - #ifdef HAVE_SYS_UN_H - #include - #endif - #ifdef HAVE_WINSOCK2_H - #include - #endif - ]], - [[struct msghdr msg; - int fd = 0; - msg.msg_accrights = &fd; - msg.msg_accrightslen = sizeof (fd); - if (&msg) return 0; - ]])], - [gl_cv_socket_unix_scm_rights_bsd43_way=yes], - [gl_cv_socket_unix_scm_rights_bsd43_way=no]) - ]) - AC_MSG_RESULT([$gl_cv_socket_unix_scm_rights_bsd43_way]) - if test $gl_cv_socket_unix_scm_rights_bsd43_way = yes; then - AC_DEFINE([HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY], [1], - [Define to 1 if fd can be sent/received in the BSD4.3 way.]) - fi -]) diff --git a/m4/passfd.m4 b/m4/passfd.m4 new file mode 100644 index 0000000000..2028f7f559 --- /dev/null +++ b/m4/passfd.m4 @@ -0,0 +1,23 @@ +# passfd.m4 serial 8 +dnl Copyright (C) 2011 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. + +AC_DEFUN([gl_PASSFD], +[ + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_CHECK_FUNCS_ONCE([recvmsg sendmsg]) + + dnl Persuade AIX 5.2 to declare CMSG_SPACE, CMSG_LEN. + dnl CMSG_FIRSTHDR is POSIX 2008, but CMSG_SPACE is only in RFC 3542. + AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], + [Define in order to get some macros on AIX systems.]) + + dnl Passfd prefers the POSIX use of msg.msg_control if the CMSG_* macros + dnl are present, but can fall back to BSD 4.3 style of msg.msg_accrights. + AC_CHECK_MEMBERS([struct msghdr.msg_accrights], [], [], [[ + #include + #include + ]]) +]) diff --git a/modules/passfd b/modules/passfd index 74ef4102c4..b3d8a3c022 100644 --- a/modules/passfd +++ b/modules/passfd @@ -4,17 +4,15 @@ Pass file descriptors along Unix domain sockets Files: lib/passfd.h lib/passfd.c -m4/afunix.m4 -m4/sockpfaf.m4 +m4/passfd.m4 Depends-on: cloexec sys_socket socketlib -extensions configure.ac: -gl_SOCKET_AFUNIX +gl_PASSFD Makefile.am: lib_SOURCES += passfd.c -- cgit v1.2.1 From 5a9e46ab46042f007426c1e06b836cf5608d8d4a Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 21 Apr 2011 14:53:49 -0600 Subject: passfd: fix test regression on Linux * modules/passfd-tests (configure.ac): Correct socketpair check. Signed-off-by: Eric Blake --- ChangeLog | 3 +++ modules/passfd-tests | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index be6470a8fa..c9f717e1da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-04-21 Eric Blake + passfd: fix test regression on Linux + * modules/passfd-tests (configure.ac): Correct socketpair check. + passfd: speed up configure and drop unused code * m4/afunix.m4 (gl_SOCKET_AFUNIX): Rename... * m4/passfd.m4 (gl_PASSFD): ...to something more fitting of diff --git a/modules/passfd-tests b/modules/passfd-tests index 29e3ad9323..9bb1c5c1be 100644 --- a/modules/passfd-tests +++ b/modules/passfd-tests @@ -6,7 +6,8 @@ Depends-on: sys_wait configure.ac: -AC_CHECK_DECLS_ONCE([alarm socketpair]) +AC_CHECK_DECLS_ONCE([alarm]) +AC_CHECK_FUNCS_ONCE([socketpair]) Makefile.am: TESTS += test-passfd -- cgit v1.2.1 From 46380c372f75d7a8609c6646e48099a9b84f7ec2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 22 Apr 2011 00:45:04 -0700 Subject: strtol: remove dependency on wchar * lib/strtol.c: Include only if USE_WIDE_CHAR is defined. * modules/strtol (Depends-on): Remove wchar. --- ChangeLog | 6 ++++++ lib/strtol.c | 3 +-- modules/strtol | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9f717e1da..6df0d4e879 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-22 Paul Eggert + + strtol: remove dependency on wchar + * lib/strtol.c: Include only if USE_WIDE_CHAR is defined. + * modules/strtol (Depends-on): Remove wchar. + 2011-04-21 Eric Blake passfd: fix test regression on Linux diff --git a/lib/strtol.c b/lib/strtol.c index b6a761ecb9..6c15d11e8f 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -186,9 +186,8 @@ # define LOCALE_PARAM_PROTO #endif -#include - #ifdef USE_WIDE_CHAR +# include # include # define L_(Ch) L##Ch # define UCHAR_TYPE wint_t diff --git a/modules/strtol b/modules/strtol index 8a313a4029..d06a55b14b 100644 --- a/modules/strtol +++ b/modules/strtol @@ -6,7 +6,6 @@ lib/strtol.c m4/strtol.m4 Depends-on: -wchar configure.ac: gl_FUNC_STRTOL @@ -21,4 +20,3 @@ LGPL Maintainer: glibc - -- cgit v1.2.1 From fadc2ed456378e2dc6545e633d0cdea5d922edf7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 22 Apr 2011 02:57:43 -0700 Subject: * modules/strnlen (Depends-on): Remove memchr. The strnlen implementation doesn't need the memchr module's fixes; see . --- ChangeLog | 4 ++++ modules/strnlen | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6df0d4e879..82c846869f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-04-22 Paul Eggert + * modules/strnlen (Depends-on): Remove memchr. + The strnlen implementation doesn't need the memchr module's fixes; see + . + strtol: remove dependency on wchar * lib/strtol.c: Include only if USE_WIDE_CHAR is defined. * modules/strtol (Depends-on): Remove wchar. diff --git a/modules/strnlen b/modules/strnlen index 9f9f2ca22f..627e6948fe 100644 --- a/modules/strnlen +++ b/modules/strnlen @@ -8,7 +8,6 @@ m4/strnlen.m4 Depends-on: extensions string -memchr configure.ac: gl_FUNC_STRNLEN -- cgit v1.2.1 From e23c10166fbeec60ed7e051ef0ef518cfa1f27b2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 24 Apr 2011 16:41:37 +0200 Subject: inttypes: Remove configure tests that are not needed since 2009-12-31. * m4/inttypes.m4 (gl_INTTYPES_H): Remove determination of gl_cv_header_working_inttypes_h. --- ChangeLog | 6 +++ m4/inttypes.m4 | 121 +-------------------------------------------------------- 2 files changed, 7 insertions(+), 120 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82c846869f..c221500709 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-22 Paul Eggert + + inttypes: Remove configure tests that are not needed since 2009-12-31. + * m4/inttypes.m4 (gl_INTTYPES_H): Remove determination of + gl_cv_header_working_inttypes_h. + 2011-04-22 Paul Eggert * modules/strnlen (Depends-on): Remove memchr. diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index 92a4ac019f..42120e72c6 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 18 +# inttypes.m4 serial 19 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,125 +17,6 @@ AC_DEFUN([gl_INTTYPES_H], AC_CHECK_DECLS_ONCE([strtoimax]) AC_CHECK_DECLS_ONCE([strtoumax]) - dnl Now see if we need a substitute . - dnl A complete requires - dnl - a complete , - dnl - the existence of an , - dnl - that imaxabs, imaxdiv, strtoimax, strtoumax are declared, - dnl - some additional tests. - AC_CACHE_CHECK([whether inttypes.h conforms to C99], - [gl_cv_header_working_inttypes_h], - [gl_cv_header_working_inttypes_h=no - if test "$gl_cv_header_working_stdint_h" = yes \ - && test $ac_cv_header_inttypes_h = yes \ - && test "$ac_cv_have_decl_imaxabs" = yes \ - && test "$ac_cv_have_decl_imaxdiv" = yes \ - && test "$ac_cv_have_decl_strtoimax" = yes \ - && test "$ac_cv_have_decl_strtoumax" = yes; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */ -#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* work if build isn't clean */ -#include - -/* No need to duplicate the tests of stdint.m4; they are subsumed by - $gl_cv_header_working_stdint_h = yes. */ - -/* Tests for macros supposed to be defined in inttypes.h. */ - -const char *k = /* implicit string concatenation */ -#ifdef INT8_MAX - PRId8 PRIi8 -#endif -#ifdef UINT8_MAX - PRIo8 PRIu8 PRIx8 PRIX8 -#endif -#ifdef INT16_MAX - PRId16 PRIi16 -#endif -#ifdef UINT16_MAX - PRIo16 PRIu16 PRIx16 PRIX16 -#endif -#ifdef INT32_MAX - PRId32 PRIi32 -#endif -#ifdef UINT32_MAX - PRIo32 PRIu32 PRIx32 PRIX32 -#endif -#ifdef INT64_MAX - PRId64 PRIi64 -#endif -#ifdef UINT64_MAX - PRIo64 PRIu64 PRIx64 PRIX64 -#endif - PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8 - PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16 - PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32 - PRIdLEAST64 PRIiLEAST64 - PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64 - PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8 - PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16 - PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32 - PRIdFAST64 PRIiFAST64 - PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64 - PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX -#ifdef INTPTR_MAX - PRIdPTR PRIiPTR -#endif -#ifdef UINTPTR_MAX - PRIoPTR PRIuPTR PRIxPTR PRIXPTR -#endif - ; -const char *l = /* implicit string concatenation */ -#ifdef INT8_MAX - SCNd8 SCNi8 -#endif -#ifdef UINT8_MAX - SCNo8 SCNu8 SCNx8 -#endif -#ifdef INT16_MAX - SCNd16 SCNi16 -#endif -#ifdef UINT16_MAX - SCNo16 SCNu16 SCNx16 -#endif -#ifdef INT32_MAX - SCNd32 SCNi32 -#endif -#ifdef UINT32_MAX - SCNo32 SCNu32 SCNx32 -#endif -#ifdef INT64_MAX - SCNd64 SCNi64 -#endif -#ifdef UINT64_MAX - SCNo64 SCNu64 SCNx64 -#endif - SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8 - SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16 - SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32 - SCNdLEAST64 SCNiLEAST64 - SCNoLEAST64 SCNuLEAST64 SCNxLEAST64 - SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8 - SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16 - SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32 - SCNdFAST64 SCNiFAST64 - SCNoFAST64 SCNuFAST64 SCNxFAST64 - SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX -#ifdef INTPTR_MAX - SCNdPTR SCNiPTR -#endif -#ifdef UINTPTR_MAX - SCNoPTR SCNuPTR SCNxPTR -#endif - ; - ]])], - [gl_cv_header_working_inttypes_h=yes]) - fi]) - dnl Override always, so that the portability warnings work. AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([inttypes.h]) -- cgit v1.2.1 From b2346264de7b3b73945a1a9a84af82f5bc2960d3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 24 Apr 2011 16:48:26 +0200 Subject: inttypes: Move some configure check to module 'imaxabs'. * m4/imaxabs.m4 (gl_FUNC_IMAXABS): Require gl_INTTYPES_H_DEFAULTS instead of gl_INTTYPES_H. Check for imaxabs decl here. * m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxabs decl here. --- ChangeLog | 7 +++++++ m4/imaxabs.m4 | 6 ++++-- m4/inttypes.m4 | 9 +-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index c221500709..6d23f709d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-22 Paul Eggert + + inttypes: Move some configure check to module 'imaxabs'. + * m4/imaxabs.m4 (gl_FUNC_IMAXABS): Require gl_INTTYPES_H_DEFAULTS + instead of gl_INTTYPES_H. Check for imaxabs decl here. + * m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxabs decl here. + 2011-04-22 Paul Eggert inttypes: Remove configure tests that are not needed since 2009-12-31. diff --git a/m4/imaxabs.m4 b/m4/imaxabs.m4 index 535a26f141..2450353822 100644 --- a/m4/imaxabs.m4 +++ b/m4/imaxabs.m4 @@ -1,4 +1,4 @@ -# imaxabs.m4 serial 1 +# imaxabs.m4 serial 2 dnl Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,8 +6,10 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_IMAXABS], [ - AC_REQUIRE([gl_INTTYPES_H]) + AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) + AC_CHECK_DECLS_ONCE([imaxabs]) if test "$ac_cv_have_decl_imaxabs" != yes; then + HAVE_DECL_IMAXABS=0 AC_LIBOBJ([imaxabs]) gl_PREREQ_IMAXABS fi diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index 42120e72c6..5cc042a704 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 19 +# inttypes.m4 serial 20 dnl Copyright (C) 2006-2011 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,6 @@ AC_DEFUN([gl_INTTYPES_H], AC_REQUIRE([gl_STDINT_H]) AC_REQUIRE([gt_INTTYPES_PRI]) AC_CHECK_HEADERS_ONCE([inttypes.h]) - AC_CHECK_DECLS_ONCE([imaxabs]) AC_CHECK_DECLS_ONCE([imaxdiv]) AC_CHECK_DECLS_ONCE([strtoimax]) AC_CHECK_DECLS_ONCE([strtoumax]) @@ -62,12 +61,6 @@ AC_DEFUN([gl_INTTYPES_H], fi AC_SUBST([PRIPTR_PREFIX]) - if test "$ac_cv_have_decl_imaxabs" = yes; then - HAVE_DECL_IMAXABS=1 - else - HAVE_DECL_IMAXABS=0 - fi - if test "$ac_cv_have_decl_imaxdiv" = yes; then HAVE_DECL_IMAXDIV=1 else -- cgit v1.2.1 From c140b280d2ce855161817b9a79cfe821b05312b8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 24 Apr 2011 16:52:26 +0200 Subject: inttypes: Move some configure check to module 'imaxdiv'. * m4/imaxdiv.m4 (gl_FUNC_IMAXDIV): Require gl_INTTYPES_H_DEFAULTS instead of gl_INTTYPES_H. Check for imaxdiv decl here. * m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxdiv decl here. --- ChangeLog | 7 +++++++ m4/imaxdiv.m4 | 6 ++++-- m4/inttypes.m4 | 9 +-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d23f709d2..8abcf2d513 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-22 Paul Eggert + + inttypes: Move some configure check to module 'imaxdiv'. + * m4/imaxdiv.m4 (gl_FUNC_IMAXDIV): Require gl_INTTYPES_H_DEFAULTS + instead of gl_INTTYPES_H. Check for imaxdiv decl here. + * m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxdiv decl here. + 2011-04-22 Paul Eggert inttypes: Move some configure check to module 'imaxabs'. diff --git a/m4/imaxdiv.m4 b/m4/imaxdiv.m4 index b23f636c80..4939912c5a 100644 --- a/m4/imaxdiv.m4 +++ b/m4/imaxdiv.m4 @@ -1,4 +1,4 @@ -# imaxdiv.m4 serial 1 +# imaxdiv.m4 serial 2 dnl Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,8 +6,10 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_IMAXDIV], [ - AC_REQUIRE([gl_INTTYPES_H]) + AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) + AC_CHECK_DECLS_ONCE([imaxdiv]) if test "$ac_cv_have_decl_imaxdiv" != yes; then + HAVE_DECL_IMAXDIV=0 AC_LIBOBJ([imaxdiv]) gl_PREREQ_IMAXDIV fi diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index 5cc042a704..1b76c691df 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 20 +# inttypes.m4 serial 21 dnl Copyright (C) 2006-2011 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,6 @@ AC_DEFUN([gl_INTTYPES_H], AC_REQUIRE([gl_STDINT_H]) AC_REQUIRE([gt_INTTYPES_PRI]) AC_CHECK_HEADERS_ONCE([inttypes.h]) - AC_CHECK_DECLS_ONCE([imaxdiv]) AC_CHECK_DECLS_ONCE([strtoimax]) AC_CHECK_DECLS_ONCE([strtoumax]) @@ -61,12 +60,6 @@ AC_DEFUN([gl_INTTYPES_H], fi AC_SUBST([PRIPTR_PREFIX]) - if test "$ac_cv_have_decl_imaxdiv" = yes; then - HAVE_DECL_IMAXDIV=1 - else - HAVE_DECL_IMAXDIV=0 - fi - if test "$ac_cv_have_decl_strtoimax" = yes; then HAVE_DECL_STRTOIMAX=1 else -- cgit v1.2.1 From e8764024e68e11f153ba409bef4376129c20c073 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 24 Apr 2011 23:27:44 -0700 Subject: strtoll: remove dependency on strtol This is so that 'configure' need not check for strtol merely because the application needs strtoll. * modules/strtoll (Files): Add lib/strtol.c. (Depends-on): Remove strtol. --- ChangeLog | 8 ++++++++ modules/strtoll | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8abcf2d513..ae96221713 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-04-24 Paul Eggert + + strtoll: remove dependency on strtol + This is so that 'configure' need not check for strtol merely because + the application needs strtoll. + * modules/strtoll (Files): Add lib/strtol.c. + (Depends-on): Remove strtol. + 2011-04-22 Paul Eggert inttypes: Move some configure check to module 'imaxdiv'. diff --git a/modules/strtoll b/modules/strtoll index 738c9efe05..8295e83c2a 100644 --- a/modules/strtoll +++ b/modules/strtoll @@ -2,13 +2,13 @@ Description: strtoll() function: convert string to 'long long'. Files: +lib/strtol.c lib/strtoll.c m4/longlong.m4 m4/strtoll.m4 Depends-on: stdlib -strtol configure.ac: gl_FUNC_STRTOLL @@ -24,4 +24,3 @@ LGPL Maintainer: glibc - -- cgit v1.2.1 From e1cbfb6b2aee287a925901f3e0466d2e5b65c8b7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 24 Apr 2011 23:28:39 -0700 Subject: strtoull: remove dependency on strtoul This is like the strtoll change. * modules/strtoull (Files): Add lib/strtol.c, lib/strtoul.c. (Depends-on): Remove strtoul. --- ChangeLog | 5 +++++ modules/strtoull | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae96221713..36540b0881 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-04-24 Paul Eggert + strtoull: remove dependency on strtoul + This is like the strtoll change. + * modules/strtoull (Files): Add lib/strtol.c, lib/strtoul.c. + (Depends-on): Remove strtoul. + strtoll: remove dependency on strtol This is so that 'configure' need not check for strtol merely because the application needs strtoll. diff --git a/modules/strtoull b/modules/strtoull index f02e9b0f53..97ce1fd850 100644 --- a/modules/strtoull +++ b/modules/strtoull @@ -2,13 +2,14 @@ Description: strtoull() function: convert string to 'unsigned long long'. Files: +lib/strtol.c +lib/strtoul.c lib/strtoull.c m4/longlong.m4 m4/strtoull.m4 Depends-on: stdlib -strtoul configure.ac: gl_FUNC_STRTOULL @@ -24,4 +25,3 @@ LGPL Maintainer: glibc - -- cgit v1.2.1 From d35ef05dc0564cf696408eae985444879a399e29 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 24 Apr 2011 23:29:28 -0700 Subject: strtoul: remove dependency on strtol This is so that 'configure' need not check for strtol merely because the application needs strtoul. * modules/strtoul (Files): Add lib/strtol.c. (Depends-on): Remove strtol. --- ChangeLog | 6 ++++++ modules/strtoul | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36540b0881..c9aa54d86f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-04-24 Paul Eggert + strtoul: remove dependency on strtol + This is so that 'configure' need not check for strtol merely because + the application needs strtoul. + * modules/strtoul (Files): Add lib/strtol.c. + (Depends-on): Remove strtol. + strtoull: remove dependency on strtoul This is like the strtoll change. * modules/strtoull (Files): Add lib/strtol.c, lib/strtoul.c. diff --git a/modules/strtoul b/modules/strtoul index 8cb6d66c48..9c6ca993a8 100644 --- a/modules/strtoul +++ b/modules/strtoul @@ -2,11 +2,11 @@ Description: strtoul() function: convert string to 'unsigned long'. Files: +lib/strtol.c lib/strtoul.c m4/strtoul.m4 Depends-on: -strtol configure.ac: gl_FUNC_STRTOUL @@ -21,4 +21,3 @@ LGPL Maintainer: glibc - -- cgit v1.2.1 From 349d7fe0e307d59d508b3579317ee8d4eacfeb9c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 24 Apr 2011 19:02:10 +0200 Subject: use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE --- lib/argmatch.c | 10 +++++++++- lib/argv-iter.c | 10 +++++++++- lib/base64.c | 10 +++++++++- lib/basename-lgpl.c | 10 +++++++++- lib/c-ctype.c | 10 +++++++++- lib/c-strncasecmp.c | 10 +++++++++- lib/chdir-long.c | 10 +++++++++- lib/exclude.c | 10 +++++++++- lib/file-type.c | 10 +++++++++- lib/filenamecat-lgpl.c | 10 +++++++++- lib/filevercmp.c | 10 +++++++++- lib/freadahead.c | 10 +++++++++- lib/fts.c | 10 +++++++++- lib/hash-pjw.c | 10 +++++++++- lib/hash-triple.c | 10 +++++++++- lib/hash.c | 28 ++++++++++++++++++---------- lib/i-ring.c | 10 +++++++++- lib/isnan.c | 10 +++++++++- lib/memcasecmp.c | 10 +++++++++- lib/memchr2.c | 10 +++++++++- lib/memcmp2.c | 10 +++++++++- lib/parse-datetime.y | 10 +++++++++- lib/propername.c | 10 +++++++++- lib/quotearg.c | 10 +++++++++- lib/sockets.c | 10 +++++++++- lib/strnlen1.c | 10 +++++++++- lib/uniwidth/width.c | 10 +++++++++- 27 files changed, 252 insertions(+), 36 deletions(-) diff --git a/lib/argmatch.c b/lib/argmatch.c index 9a3eca4d4c..45fc4c35c9 100644 --- a/lib/argmatch.c +++ b/lib/argmatch.c @@ -57,6 +57,14 @@ ARGMATCH_DIE_DECL; #endif +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + static void __argmatch_die (void) { @@ -79,7 +87,7 @@ argmatch_exit_fn argmatch_die = __argmatch_die; "no", "nope" -> 1 "y" is a valid argument, for `0', and "n" for `1'. */ -ptrdiff_t +ptrdiff_t _GL_ATTRIBUTE_PURE argmatch (const char *arg, const char *const *arglist, const char *vallist, size_t valsize) { diff --git a/lib/argv-iter.c b/lib/argv-iter.c index 340e588905..b77f70c861 100644 --- a/lib/argv-iter.c +++ b/lib/argv-iter.c @@ -22,6 +22,14 @@ #include #include +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + struct argv_iterator { /* Test FP to determine whether in read-mode or argv-mode. */ @@ -96,7 +104,7 @@ argv_iter (struct argv_iterator *ai, enum argv_iter_err *err) } } -size_t +size_t _GL_ATTRIBUTE_PURE argv_iter_n_args (struct argv_iterator const *ai) { return ai->fp ? ai->item_idx : ai->p - ai->arg_list; diff --git a/lib/base64.c b/lib/base64.c index 99fcc57c3c..89e83e6499 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -53,6 +53,14 @@ #include +/* The attribute __const__ was added in gcc 2.95. */ +#undef _GL_ATTRIBUTE_CONST +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif + /* C89 compliant way to cast 'char' to 'unsigned char'. */ static inline unsigned char to_uchar (char ch) @@ -295,7 +303,7 @@ static const signed char b64[0x100] = { /* Return true if CH is a character from the Base64 alphabet, and false otherwise. Note that '=' is padding and not considered to be part of the alphabet. */ -bool +bool _GL_ATTRIBUTE_CONST isbase64 (char ch) { return uchar_in_range (to_uchar (ch)) && 0 <= b64[to_uchar (ch)]; diff --git a/lib/basename-lgpl.c b/lib/basename-lgpl.c index 529bc35d72..f2738cd407 100644 --- a/lib/basename-lgpl.c +++ b/lib/basename-lgpl.c @@ -22,11 +22,19 @@ #include +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* Return the address of the last file name component of NAME. If NAME has no relative file name components because it is a file system root, return the empty string. */ -char * +char * _GL_ATTRIBUTE_PURE last_component (char const *name) { char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); diff --git a/lib/c-ctype.c b/lib/c-ctype.c index 335cde5d08..fc15642916 100644 --- a/lib/c-ctype.c +++ b/lib/c-ctype.c @@ -22,9 +22,17 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #define NO_C_CTYPE_MACROS #include "c-ctype.h" +/* The attribute __const__ was added in gcc 2.95. */ +#undef _GL_ATTRIBUTE_CONST +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif + /* The function isascii is not locale dependent. Its use in EBCDIC is questionable. */ -bool +bool _GL_ATTRIBUTE_CONST c_isascii (int c) { return (c >= 0x00 && c <= 0x7f); diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c index 0085185ab2..280f09b5ab 100644 --- a/lib/c-strncasecmp.c +++ b/lib/c-strncasecmp.c @@ -24,7 +24,15 @@ #include "c-ctype.h" -int +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +int _GL_ATTRIBUTE_PURE c_strncasecmp (const char *s1, const char *s2, size_t n) { register const unsigned char *p1 = (const unsigned char *) s1; diff --git a/lib/chdir-long.c b/lib/chdir-long.c index 96b750cb46..d042abfdab 100644 --- a/lib/chdir-long.c +++ b/lib/chdir-long.c @@ -32,6 +32,14 @@ # error "compile this file only if your system defines PATH_MAX" #endif +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* The results of openat() in this file are not leaked to any single-threaded code that could use stdio. FIXME - if the kernel ever adds support for multi-thread safety for @@ -83,7 +91,7 @@ cdb_advance_fd (struct cd_buf *cdb, char const *dir) } /* Return a pointer to the first non-slash in S. */ -static inline char * +static inline char * _GL_ATTRIBUTE_PURE find_non_slash (char const *s) { size_t n_slash = strspn (s, "/"); diff --git a/lib/exclude.c b/lib/exclude.c index df49714a6b..fe74f361c6 100644 --- a/lib/exclude.c +++ b/lib/exclude.c @@ -60,6 +60,14 @@ verify (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS) | FNM_CASEFOLD | FNM_EXTMATCH)) == 0); +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* Exclusion patterns are grouped into a singly-linked list of "exclusion segments". Each segment represents a set of patterns @@ -111,7 +119,7 @@ struct exclude }; /* Return true if str has wildcard characters */ -bool +bool _GL_ATTRIBUTE_PURE fnmatch_pattern_has_wildcards (const char *str, int options) { const char *cset = "\\?*[]"; diff --git a/lib/file-type.c b/lib/file-type.c index 109db44024..f7090cdd1d 100644 --- a/lib/file-type.c +++ b/lib/file-type.c @@ -25,7 +25,15 @@ #include #define _(text) gettext (text) -char const * +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +char const * _GL_ATTRIBUTE_PURE file_type (struct stat const *st) { /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107 for some of diff --git a/lib/filenamecat-lgpl.c b/lib/filenamecat-lgpl.c index 8cb2da43d1..1e3e63a24b 100644 --- a/lib/filenamecat-lgpl.c +++ b/lib/filenamecat-lgpl.c @@ -31,10 +31,18 @@ # define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N))) #endif +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* Return the longest suffix of F that is a relative file name. If it has no such suffix, return the empty string. */ -static char const * +static char const * _GL_ATTRIBUTE_PURE longest_relative_suffix (char const *f) { for (f += FILE_SYSTEM_PREFIX_LEN (f); ISSLASH (*f); f++) diff --git a/lib/filevercmp.c b/lib/filevercmp.c index f6ed2481f6..b2f309b3a9 100644 --- a/lib/filevercmp.c +++ b/lib/filevercmp.c @@ -26,6 +26,14 @@ #include #include +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* Match a file suffix defined by this regular expression: /(\.[A-Za-z~][A-Za-z0-9~]*)*$/ Scan the string *STR and return a pointer to the matching suffix, or @@ -80,7 +88,7 @@ order (unsigned char c) section on the `Version' control field. This version of the code implements that from s5.6.12 of Debian Policy v3.8.0.1 http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version */ -static int +static int _GL_ATTRIBUTE_PURE verrevcmp (const char *s1, size_t s1_len, const char *s2, size_t s2_len) { size_t s1_pos = 0; diff --git a/lib/freadahead.c b/lib/freadahead.c index 27f5c9579f..ecc0ed569b 100644 --- a/lib/freadahead.c +++ b/lib/freadahead.c @@ -22,7 +22,15 @@ #include #include "stdio-impl.h" -size_t +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +size_t _GL_ATTRIBUTE_PURE freadahead (FILE *fp) { #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ diff --git a/lib/fts.c b/lib/fts.c index ad762dd779..1b06f82efa 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -261,6 +261,14 @@ bool fts_debug = false; } \ while (false) +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + static void fd_ring_clear (I_ring *fd_ring) { @@ -1906,7 +1914,7 @@ fts_padjust (FTS *sp, FTSENT *head) } static size_t -internal_function +internal_function _GL_ATTRIBUTE_PURE fts_maxarglen (char * const *argv) { size_t len, max; diff --git a/lib/hash-pjw.c b/lib/hash-pjw.c index 743bb576cc..7df27ae1fc 100644 --- a/lib/hash-pjw.c +++ b/lib/hash-pjw.c @@ -23,11 +23,19 @@ #define SIZE_BITS (sizeof (size_t) * CHAR_BIT) +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* A hash function for NUL-terminated char* strings using the method described by Bruno Haible. See http://www.haible.de/bruno/hashfunc.html. */ -size_t +size_t _GL_ATTRIBUTE_PURE hash_pjw (const void *x, size_t tablesize) { const char *s; diff --git a/lib/hash-triple.c b/lib/hash-triple.c index 1649377894..56cbe7c3e9 100644 --- a/lib/hash-triple.c +++ b/lib/hash-triple.c @@ -29,6 +29,14 @@ #define STREQ(a, b) (strcmp (a, b) == 0) +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* Hash an F_triple, and *do* consider the file name. */ size_t triple_hash (void const *x, size_t table_size) @@ -41,7 +49,7 @@ triple_hash (void const *x, size_t table_size) } /* Hash an F_triple, without considering the file name. */ -size_t +size_t _GL_ATTRIBUTE_PURE triple_hash_no_name (void const *x, size_t table_size) { struct F_triple const *p = x; diff --git a/lib/hash.c b/lib/hash.c index f3de2aaaac..9a969ac318 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -43,6 +43,14 @@ # endif #endif +/* The attribute __const__ was added in gcc 2.95. */ +#undef _GL_ATTRIBUTE_CONST +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif + struct hash_entry { void *data; @@ -146,7 +154,7 @@ static const Hash_tuning default_tuning = number of buckets (used plus unused), or the maximum number of slots, are the same quantity. */ -size_t +size_t _GL_ATTRIBUTE_PURE hash_get_n_buckets (const Hash_table *table) { return table->n_buckets; @@ -154,7 +162,7 @@ hash_get_n_buckets (const Hash_table *table) /* Return the number of slots in use (non-empty buckets). */ -size_t +size_t _GL_ATTRIBUTE_PURE hash_get_n_buckets_used (const Hash_table *table) { return table->n_buckets_used; @@ -162,7 +170,7 @@ hash_get_n_buckets_used (const Hash_table *table) /* Return the number of active entries. */ -size_t +size_t _GL_ATTRIBUTE_PURE hash_get_n_entries (const Hash_table *table) { return table->n_entries; @@ -170,7 +178,7 @@ hash_get_n_entries (const Hash_table *table) /* Return the length of the longest chain (bucket). */ -size_t +size_t _GL_ATTRIBUTE_PURE hash_get_max_bucket_length (const Hash_table *table) { struct hash_entry const *bucket; @@ -197,7 +205,7 @@ hash_get_max_bucket_length (const Hash_table *table) /* Do a mild validation of a hash table, by traversing it and checking two statistics. */ -bool +bool _GL_ATTRIBUTE_PURE hash_table_ok (const Hash_table *table) { struct hash_entry const *bucket; @@ -284,7 +292,7 @@ hash_lookup (const Hash_table *table, const void *entry) /* Return the first data in the table, or NULL if the table is empty. */ -void * +void * _GL_ATTRIBUTE_PURE hash_get_first (const Hash_table *table) { struct hash_entry const *bucket; @@ -401,7 +409,7 @@ hash_do_for_each (const Hash_table *table, Hash_processor processor, algorithms tend to be domain-specific, so what's good for [diffutils'] io.c may not be good for your application." */ -size_t +size_t _GL_ATTRIBUTE_PURE hash_string (const char *string, size_t n_buckets) { # define HASH_ONE_CHAR(Value, Byte) \ @@ -440,7 +448,7 @@ hash_string (const char *string, size_t n_buckets) /* Return true if CANDIDATE is a prime number. CANDIDATE should be an odd number at least equal to 11. */ -static bool +static bool _GL_ATTRIBUTE_CONST is_prime (size_t candidate) { size_t divisor = 3; @@ -459,7 +467,7 @@ is_prime (size_t candidate) /* Round a given CANDIDATE number up to the nearest prime, and return that prime. Primes lower than 10 are merely skipped. */ -static size_t +static size_t _GL_ATTRIBUTE_CONST next_prime (size_t candidate) { /* Skip small primes. */ @@ -540,7 +548,7 @@ check_tuning (Hash_table *table) TUNING, or return 0 if there is no possible way to allocate that many entries. */ -static size_t +static size_t _GL_ATTRIBUTE_PURE compute_bucket_size (size_t candidate, const Hash_tuning *tuning) { if (!tuning->is_n_buckets) diff --git a/lib/i-ring.c b/lib/i-ring.c index b603b0b0e8..8beef688aa 100644 --- a/lib/i-ring.c +++ b/lib/i-ring.c @@ -21,6 +21,14 @@ #include +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + void i_ring_init (I_ring *ir, int default_val) { @@ -33,7 +41,7 @@ i_ring_init (I_ring *ir, int default_val) ir->ir_default_val = default_val; } -bool +bool _GL_ATTRIBUTE_PURE i_ring_empty (I_ring const *ir) { return ir->ir_empty; diff --git a/lib/isnan.c b/lib/isnan.c index d9c653dea8..92fc250667 100644 --- a/lib/isnan.c +++ b/lib/isnan.c @@ -79,7 +79,15 @@ extern int rpl_isnanf (float x); ((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double; -int +/* The attribute __const__ was added in gcc 2.95. */ +#undef _GL_ATTRIBUTE_CONST +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif + +int _GL_ATTRIBUTE_CONST FUNC (DOUBLE x) { #ifdef KNOWN_EXPBIT0_LOCATION diff --git a/lib/memcasecmp.c b/lib/memcasecmp.c index 6ae7c4f65d..b5c93fb4e6 100644 --- a/lib/memcasecmp.c +++ b/lib/memcasecmp.c @@ -24,11 +24,19 @@ #include #include +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* Like memcmp, but ignore differences in case. Convert to upper case (not lower) before comparing so that join -i works with sort -f. */ -int +int _GL_ATTRIBUTE_PURE memcasecmp (const void *vs1, const void *vs2, size_t n) { size_t i; diff --git a/lib/memchr2.c b/lib/memchr2.c index 2e3c7cda62..b830b9d0b2 100644 --- a/lib/memchr2.c +++ b/lib/memchr2.c @@ -29,10 +29,18 @@ along with this program. If not, see . */ #include #include +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* Return the first address of either C1 or C2 (treated as unsigned char) that occurs within N bytes of the memory region S. If neither byte appears, return NULL. */ -void * +void * _GL_ATTRIBUTE_PURE memchr2 (void const *s, int c1_in, int c2_in, size_t n) { /* On 32-bit hardware, choosing longword to be a 32-bit unsigned diff --git a/lib/memcmp2.c b/lib/memcmp2.c index 14ab666ded..9b22bbac03 100644 --- a/lib/memcmp2.c +++ b/lib/memcmp2.c @@ -21,7 +21,15 @@ #include -int +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +int _GL_ATTRIBUTE_PURE memcmp2 (const char *s1, size_t n1, const char *s2, size_t n2) { int cmp = memcmp (s1, s2, n1 <= n2 ? n1 : n2); diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y index d77955f40d..07008524eb 100644 --- a/lib/parse-datetime.y +++ b/lib/parse-datetime.y @@ -113,6 +113,14 @@ typedef long int long_time_t; typedef time_t long_time_t; #endif +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* Lots of this code assumes time_t and time_t-like values fit into long_time_t. */ verify (TYPE_MINIMUM (long_time_t) <= TYPE_MINIMUM (time_t) @@ -868,7 +876,7 @@ to_year (textint textyear) return year; } -static table const * +static table const * _GL_ATTRIBUTE_PURE lookup_zone (parser_control const *pc, char const *name) { table const *tp; diff --git a/lib/propername.c b/lib/propername.c index b74923de95..f2e80d15a7 100644 --- a/lib/propername.c +++ b/lib/propername.c @@ -38,6 +38,14 @@ #include "xalloc.h" #include "gettext.h" +/* The attribute __const__ was added in gcc 2.95. */ +#undef _GL_ATTRIBUTE_CONST +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif + /* Tests whether STRING contains trim (SUB), starting and ending at word boundaries. @@ -148,7 +156,7 @@ mbsstr_trimmed_wordbounded (const char *string, const char *sub) /* Return the localization of NAME. NAME is written in ASCII. */ -const char * +const char * _GL_ATTRIBUTE_CONST proper_name (const char *name) { /* See whether there is a translation. */ diff --git a/lib/quotearg.c b/lib/quotearg.c index fb4955993e..18b788adee 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -42,6 +42,14 @@ #define INT_BITS (sizeof (int) * CHAR_BIT) +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + struct quoting_options { /* Basic quoting style. */ @@ -105,7 +113,7 @@ clone_quoting_options (struct quoting_options *o) } /* Get the value of O's quoting style. If O is null, use the default. */ -enum quoting_style +enum quoting_style _GL_ATTRIBUTE_PURE get_quoting_style (struct quoting_options *o) { return (o ? o : &default_quoting_options)->style; diff --git a/lib/sockets.c b/lib/sockets.c index 42b8f9ea58..9a448097c4 100644 --- a/lib/sockets.c +++ b/lib/sockets.c @@ -22,6 +22,14 @@ /* Specification. */ #include "sockets.h" +/* The attribute __const__ was added in gcc 2.95. */ +#undef _GL_ATTRIBUTE_CONST +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif + #if WINDOWS_SOCKETS /* This includes winsock2.h on MinGW. */ @@ -103,7 +111,7 @@ static int initialized_sockets_version /* = 0 */; #endif /* WINDOWS_SOCKETS */ -int +int _GL_ATTRIBUTE_CONST gl_sockets_startup (int version _GL_UNUSED) { #if WINDOWS_SOCKETS diff --git a/lib/strnlen1.c b/lib/strnlen1.c index f64ce104a3..f735bffe5c 100644 --- a/lib/strnlen1.c +++ b/lib/strnlen1.c @@ -21,10 +21,18 @@ #include +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* Find the length of STRING + 1, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many characters, return MAXLEN. */ /* This is the same as strnlen (string, maxlen - 1) + 1. */ -size_t +size_t _GL_ATTRIBUTE_PURE strnlen1 (const char *string, size_t maxlen) { const char *end = (const char *) memchr (string, '\0', maxlen); diff --git a/lib/uniwidth/width.c b/lib/uniwidth/width.c index a314e71bf0..f882257e87 100644 --- a/lib/uniwidth/width.c +++ b/lib/uniwidth/width.c @@ -22,6 +22,14 @@ #include "cjk.h" +/* The attribute __pure__ was added in gcc 2.96. */ +#undef _GL_ATTRIBUTE_PURE +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + /* * Non-spacing attribute table. * Consists of: @@ -311,7 +319,7 @@ static const signed char nonspacing_table_ind[240] = { }; /* Determine number of column positions required for UC. */ -int +int _GL_ATTRIBUTE_PURE uc_width (ucs4_t uc, const char *encoding) { /* Test for non-spacing or control character. */ -- cgit v1.2.1 From ea868d4a150963fafb230c888dc093a2e06a3613 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 25 Apr 2011 10:24:20 +0200 Subject: maint.mk: makefile_at_at_check extend and clean up * top/maint.mk (sc_makefile_at_at_check): Check *.mk files in addition to */Makefile.am. Exempt legitimate uses of @VAR@ notation, e.g., MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@ Remove obsolete coreutils-specific comment. Prompted by discussion here: http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/26074 --- ChangeLog | 11 +++++++++++ top/maint.mk | 15 +++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9aa54d86f..65ed4a015f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-04-25 Jim Meyering + + maint.mk: makefile_at_at_check extend and clean up + * top/maint.mk (sc_makefile_at_at_check): Check *.mk files + in addition to */Makefile.am. + Exempt legitimate uses of @VAR@ notation, e.g., + MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@ + Remove obsolete coreutils-specific comment. + Prompted by discussion here: + http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/26074 + 2011-04-24 Paul Eggert strtoul: remove dependency on strtol diff --git a/top/maint.mk b/top/maint.mk index 07a7773b9f..47cb44ee26 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -942,16 +942,23 @@ update-NEWS-hash: NEWS # Ensure that we use only the standard $(VAR) notation, # not @...@ in Makefile.am, now that we can rely on automake # to emit a definition for each substituted variable. -# We use perl rather than "grep -nE ..." to exempt a single -# use of an @...@-delimited variable name in src/Makefile.am. +# However, there is still one case in which @VAR@ use is not just +# legitimate, but actually required: when augmenting an automake-defined +# variable with a prefix. For example, gettext uses this: +# MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@ +# otherwise, makeinfo would put German or French (current locale) +# navigation hints in the otherwise-English documentation. +# # Allow the package to add exceptions via a hook in cfg.mk; # for example, @PRAGMA_SYSTEM_HEADER@ can be permitted by # setting this to ' && !/PRAGMA_SYSTEM_HEADER/'. _makefile_at_at_check_exceptions ?= sc_makefile_at_at_check: - @perl -ne '/\@[A-Z_0-9]+\@/'$(_makefile_at_at_check_exceptions) \ + @perl -ne '/\@[A-Z_0-9]+\@/' \ + -e ' && !/([A-Z_0-9]+)\s+=.*\@\1\@$$/' \ + -e ''$(_makefile_at_at_check_exceptions) \ -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}' \ - $$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$') \ + $$($(VC_LIST_EXCEPT) | grep -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \ && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || : news-check: NEWS -- cgit v1.2.1 From 6829a6c0c428c91768aa4314752ba92b1340e11b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 25 Apr 2011 10:38:33 +0200 Subject: Revert "use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE" This reverts commit 349d7fe0e307d59d508b3579317ee8d4eacfeb9c. Revert accidentally-pushed patch. Not yet ready. --- lib/argmatch.c | 10 +--------- lib/argv-iter.c | 10 +--------- lib/base64.c | 10 +--------- lib/basename-lgpl.c | 10 +--------- lib/c-ctype.c | 10 +--------- lib/c-strncasecmp.c | 10 +--------- lib/chdir-long.c | 10 +--------- lib/exclude.c | 10 +--------- lib/file-type.c | 10 +--------- lib/filenamecat-lgpl.c | 10 +--------- lib/filevercmp.c | 10 +--------- lib/freadahead.c | 10 +--------- lib/fts.c | 10 +--------- lib/hash-pjw.c | 10 +--------- lib/hash-triple.c | 10 +--------- lib/hash.c | 28 ++++++++++------------------ lib/i-ring.c | 10 +--------- lib/isnan.c | 10 +--------- lib/memcasecmp.c | 10 +--------- lib/memchr2.c | 10 +--------- lib/memcmp2.c | 10 +--------- lib/parse-datetime.y | 10 +--------- lib/propername.c | 10 +--------- lib/quotearg.c | 10 +--------- lib/sockets.c | 10 +--------- lib/strnlen1.c | 10 +--------- lib/uniwidth/width.c | 10 +--------- 27 files changed, 36 insertions(+), 252 deletions(-) diff --git a/lib/argmatch.c b/lib/argmatch.c index 45fc4c35c9..9a3eca4d4c 100644 --- a/lib/argmatch.c +++ b/lib/argmatch.c @@ -57,14 +57,6 @@ ARGMATCH_DIE_DECL; #endif -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - static void __argmatch_die (void) { @@ -87,7 +79,7 @@ argmatch_exit_fn argmatch_die = __argmatch_die; "no", "nope" -> 1 "y" is a valid argument, for `0', and "n" for `1'. */ -ptrdiff_t _GL_ATTRIBUTE_PURE +ptrdiff_t argmatch (const char *arg, const char *const *arglist, const char *vallist, size_t valsize) { diff --git a/lib/argv-iter.c b/lib/argv-iter.c index b77f70c861..340e588905 100644 --- a/lib/argv-iter.c +++ b/lib/argv-iter.c @@ -22,14 +22,6 @@ #include #include -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - struct argv_iterator { /* Test FP to determine whether in read-mode or argv-mode. */ @@ -104,7 +96,7 @@ argv_iter (struct argv_iterator *ai, enum argv_iter_err *err) } } -size_t _GL_ATTRIBUTE_PURE +size_t argv_iter_n_args (struct argv_iterator const *ai) { return ai->fp ? ai->item_idx : ai->p - ai->arg_list; diff --git a/lib/base64.c b/lib/base64.c index 89e83e6499..99fcc57c3c 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -53,14 +53,6 @@ #include -/* The attribute __const__ was added in gcc 2.95. */ -#undef _GL_ATTRIBUTE_CONST -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) -#else -# define _GL_ATTRIBUTE_CONST /* empty */ -#endif - /* C89 compliant way to cast 'char' to 'unsigned char'. */ static inline unsigned char to_uchar (char ch) @@ -303,7 +295,7 @@ static const signed char b64[0x100] = { /* Return true if CH is a character from the Base64 alphabet, and false otherwise. Note that '=' is padding and not considered to be part of the alphabet. */ -bool _GL_ATTRIBUTE_CONST +bool isbase64 (char ch) { return uchar_in_range (to_uchar (ch)) && 0 <= b64[to_uchar (ch)]; diff --git a/lib/basename-lgpl.c b/lib/basename-lgpl.c index f2738cd407..529bc35d72 100644 --- a/lib/basename-lgpl.c +++ b/lib/basename-lgpl.c @@ -22,19 +22,11 @@ #include -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* Return the address of the last file name component of NAME. If NAME has no relative file name components because it is a file system root, return the empty string. */ -char * _GL_ATTRIBUTE_PURE +char * last_component (char const *name) { char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); diff --git a/lib/c-ctype.c b/lib/c-ctype.c index fc15642916..335cde5d08 100644 --- a/lib/c-ctype.c +++ b/lib/c-ctype.c @@ -22,17 +22,9 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #define NO_C_CTYPE_MACROS #include "c-ctype.h" -/* The attribute __const__ was added in gcc 2.95. */ -#undef _GL_ATTRIBUTE_CONST -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) -#else -# define _GL_ATTRIBUTE_CONST /* empty */ -#endif - /* The function isascii is not locale dependent. Its use in EBCDIC is questionable. */ -bool _GL_ATTRIBUTE_CONST +bool c_isascii (int c) { return (c >= 0x00 && c <= 0x7f); diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c index 280f09b5ab..0085185ab2 100644 --- a/lib/c-strncasecmp.c +++ b/lib/c-strncasecmp.c @@ -24,15 +24,7 @@ #include "c-ctype.h" -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - -int _GL_ATTRIBUTE_PURE +int c_strncasecmp (const char *s1, const char *s2, size_t n) { register const unsigned char *p1 = (const unsigned char *) s1; diff --git a/lib/chdir-long.c b/lib/chdir-long.c index d042abfdab..96b750cb46 100644 --- a/lib/chdir-long.c +++ b/lib/chdir-long.c @@ -32,14 +32,6 @@ # error "compile this file only if your system defines PATH_MAX" #endif -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* The results of openat() in this file are not leaked to any single-threaded code that could use stdio. FIXME - if the kernel ever adds support for multi-thread safety for @@ -91,7 +83,7 @@ cdb_advance_fd (struct cd_buf *cdb, char const *dir) } /* Return a pointer to the first non-slash in S. */ -static inline char * _GL_ATTRIBUTE_PURE +static inline char * find_non_slash (char const *s) { size_t n_slash = strspn (s, "/"); diff --git a/lib/exclude.c b/lib/exclude.c index fe74f361c6..df49714a6b 100644 --- a/lib/exclude.c +++ b/lib/exclude.c @@ -60,14 +60,6 @@ verify (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS) | FNM_CASEFOLD | FNM_EXTMATCH)) == 0); -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* Exclusion patterns are grouped into a singly-linked list of "exclusion segments". Each segment represents a set of patterns @@ -119,7 +111,7 @@ struct exclude }; /* Return true if str has wildcard characters */ -bool _GL_ATTRIBUTE_PURE +bool fnmatch_pattern_has_wildcards (const char *str, int options) { const char *cset = "\\?*[]"; diff --git a/lib/file-type.c b/lib/file-type.c index f7090cdd1d..109db44024 100644 --- a/lib/file-type.c +++ b/lib/file-type.c @@ -25,15 +25,7 @@ #include #define _(text) gettext (text) -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - -char const * _GL_ATTRIBUTE_PURE +char const * file_type (struct stat const *st) { /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107 for some of diff --git a/lib/filenamecat-lgpl.c b/lib/filenamecat-lgpl.c index 1e3e63a24b..8cb2da43d1 100644 --- a/lib/filenamecat-lgpl.c +++ b/lib/filenamecat-lgpl.c @@ -31,18 +31,10 @@ # define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N))) #endif -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* Return the longest suffix of F that is a relative file name. If it has no such suffix, return the empty string. */ -static char const * _GL_ATTRIBUTE_PURE +static char const * longest_relative_suffix (char const *f) { for (f += FILE_SYSTEM_PREFIX_LEN (f); ISSLASH (*f); f++) diff --git a/lib/filevercmp.c b/lib/filevercmp.c index b2f309b3a9..f6ed2481f6 100644 --- a/lib/filevercmp.c +++ b/lib/filevercmp.c @@ -26,14 +26,6 @@ #include #include -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* Match a file suffix defined by this regular expression: /(\.[A-Za-z~][A-Za-z0-9~]*)*$/ Scan the string *STR and return a pointer to the matching suffix, or @@ -88,7 +80,7 @@ order (unsigned char c) section on the `Version' control field. This version of the code implements that from s5.6.12 of Debian Policy v3.8.0.1 http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version */ -static int _GL_ATTRIBUTE_PURE +static int verrevcmp (const char *s1, size_t s1_len, const char *s2, size_t s2_len) { size_t s1_pos = 0; diff --git a/lib/freadahead.c b/lib/freadahead.c index ecc0ed569b..27f5c9579f 100644 --- a/lib/freadahead.c +++ b/lib/freadahead.c @@ -22,15 +22,7 @@ #include #include "stdio-impl.h" -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - -size_t _GL_ATTRIBUTE_PURE +size_t freadahead (FILE *fp) { #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ diff --git a/lib/fts.c b/lib/fts.c index 1b06f82efa..ad762dd779 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -261,14 +261,6 @@ bool fts_debug = false; } \ while (false) -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - static void fd_ring_clear (I_ring *fd_ring) { @@ -1914,7 +1906,7 @@ fts_padjust (FTS *sp, FTSENT *head) } static size_t -internal_function _GL_ATTRIBUTE_PURE +internal_function fts_maxarglen (char * const *argv) { size_t len, max; diff --git a/lib/hash-pjw.c b/lib/hash-pjw.c index 7df27ae1fc..743bb576cc 100644 --- a/lib/hash-pjw.c +++ b/lib/hash-pjw.c @@ -23,19 +23,11 @@ #define SIZE_BITS (sizeof (size_t) * CHAR_BIT) -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* A hash function for NUL-terminated char* strings using the method described by Bruno Haible. See http://www.haible.de/bruno/hashfunc.html. */ -size_t _GL_ATTRIBUTE_PURE +size_t hash_pjw (const void *x, size_t tablesize) { const char *s; diff --git a/lib/hash-triple.c b/lib/hash-triple.c index 56cbe7c3e9..1649377894 100644 --- a/lib/hash-triple.c +++ b/lib/hash-triple.c @@ -29,14 +29,6 @@ #define STREQ(a, b) (strcmp (a, b) == 0) -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* Hash an F_triple, and *do* consider the file name. */ size_t triple_hash (void const *x, size_t table_size) @@ -49,7 +41,7 @@ triple_hash (void const *x, size_t table_size) } /* Hash an F_triple, without considering the file name. */ -size_t _GL_ATTRIBUTE_PURE +size_t triple_hash_no_name (void const *x, size_t table_size) { struct F_triple const *p = x; diff --git a/lib/hash.c b/lib/hash.c index 9a969ac318..f3de2aaaac 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -43,14 +43,6 @@ # endif #endif -/* The attribute __const__ was added in gcc 2.95. */ -#undef _GL_ATTRIBUTE_CONST -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) -#else -# define _GL_ATTRIBUTE_CONST /* empty */ -#endif - struct hash_entry { void *data; @@ -154,7 +146,7 @@ static const Hash_tuning default_tuning = number of buckets (used plus unused), or the maximum number of slots, are the same quantity. */ -size_t _GL_ATTRIBUTE_PURE +size_t hash_get_n_buckets (const Hash_table *table) { return table->n_buckets; @@ -162,7 +154,7 @@ hash_get_n_buckets (const Hash_table *table) /* Return the number of slots in use (non-empty buckets). */ -size_t _GL_ATTRIBUTE_PURE +size_t hash_get_n_buckets_used (const Hash_table *table) { return table->n_buckets_used; @@ -170,7 +162,7 @@ hash_get_n_buckets_used (const Hash_table *table) /* Return the number of active entries. */ -size_t _GL_ATTRIBUTE_PURE +size_t hash_get_n_entries (const Hash_table *table) { return table->n_entries; @@ -178,7 +170,7 @@ hash_get_n_entries (const Hash_table *table) /* Return the length of the longest chain (bucket). */ -size_t _GL_ATTRIBUTE_PURE +size_t hash_get_max_bucket_length (const Hash_table *table) { struct hash_entry const *bucket; @@ -205,7 +197,7 @@ hash_get_max_bucket_length (const Hash_table *table) /* Do a mild validation of a hash table, by traversing it and checking two statistics. */ -bool _GL_ATTRIBUTE_PURE +bool hash_table_ok (const Hash_table *table) { struct hash_entry const *bucket; @@ -292,7 +284,7 @@ hash_lookup (const Hash_table *table, const void *entry) /* Return the first data in the table, or NULL if the table is empty. */ -void * _GL_ATTRIBUTE_PURE +void * hash_get_first (const Hash_table *table) { struct hash_entry const *bucket; @@ -409,7 +401,7 @@ hash_do_for_each (const Hash_table *table, Hash_processor processor, algorithms tend to be domain-specific, so what's good for [diffutils'] io.c may not be good for your application." */ -size_t _GL_ATTRIBUTE_PURE +size_t hash_string (const char *string, size_t n_buckets) { # define HASH_ONE_CHAR(Value, Byte) \ @@ -448,7 +440,7 @@ hash_string (const char *string, size_t n_buckets) /* Return true if CANDIDATE is a prime number. CANDIDATE should be an odd number at least equal to 11. */ -static bool _GL_ATTRIBUTE_CONST +static bool is_prime (size_t candidate) { size_t divisor = 3; @@ -467,7 +459,7 @@ is_prime (size_t candidate) /* Round a given CANDIDATE number up to the nearest prime, and return that prime. Primes lower than 10 are merely skipped. */ -static size_t _GL_ATTRIBUTE_CONST +static size_t next_prime (size_t candidate) { /* Skip small primes. */ @@ -548,7 +540,7 @@ check_tuning (Hash_table *table) TUNING, or return 0 if there is no possible way to allocate that many entries. */ -static size_t _GL_ATTRIBUTE_PURE +static size_t compute_bucket_size (size_t candidate, const Hash_tuning *tuning) { if (!tuning->is_n_buckets) diff --git a/lib/i-ring.c b/lib/i-ring.c index 8beef688aa..b603b0b0e8 100644 --- a/lib/i-ring.c +++ b/lib/i-ring.c @@ -21,14 +21,6 @@ #include -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - void i_ring_init (I_ring *ir, int default_val) { @@ -41,7 +33,7 @@ i_ring_init (I_ring *ir, int default_val) ir->ir_default_val = default_val; } -bool _GL_ATTRIBUTE_PURE +bool i_ring_empty (I_ring const *ir) { return ir->ir_empty; diff --git a/lib/isnan.c b/lib/isnan.c index 92fc250667..d9c653dea8 100644 --- a/lib/isnan.c +++ b/lib/isnan.c @@ -79,15 +79,7 @@ extern int rpl_isnanf (float x); ((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double; -/* The attribute __const__ was added in gcc 2.95. */ -#undef _GL_ATTRIBUTE_CONST -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) -#else -# define _GL_ATTRIBUTE_CONST /* empty */ -#endif - -int _GL_ATTRIBUTE_CONST +int FUNC (DOUBLE x) { #ifdef KNOWN_EXPBIT0_LOCATION diff --git a/lib/memcasecmp.c b/lib/memcasecmp.c index b5c93fb4e6..6ae7c4f65d 100644 --- a/lib/memcasecmp.c +++ b/lib/memcasecmp.c @@ -24,19 +24,11 @@ #include #include -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* Like memcmp, but ignore differences in case. Convert to upper case (not lower) before comparing so that join -i works with sort -f. */ -int _GL_ATTRIBUTE_PURE +int memcasecmp (const void *vs1, const void *vs2, size_t n) { size_t i; diff --git a/lib/memchr2.c b/lib/memchr2.c index b830b9d0b2..2e3c7cda62 100644 --- a/lib/memchr2.c +++ b/lib/memchr2.c @@ -29,18 +29,10 @@ along with this program. If not, see . */ #include #include -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* Return the first address of either C1 or C2 (treated as unsigned char) that occurs within N bytes of the memory region S. If neither byte appears, return NULL. */ -void * _GL_ATTRIBUTE_PURE +void * memchr2 (void const *s, int c1_in, int c2_in, size_t n) { /* On 32-bit hardware, choosing longword to be a 32-bit unsigned diff --git a/lib/memcmp2.c b/lib/memcmp2.c index 9b22bbac03..14ab666ded 100644 --- a/lib/memcmp2.c +++ b/lib/memcmp2.c @@ -21,15 +21,7 @@ #include -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - -int _GL_ATTRIBUTE_PURE +int memcmp2 (const char *s1, size_t n1, const char *s2, size_t n2) { int cmp = memcmp (s1, s2, n1 <= n2 ? n1 : n2); diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y index 07008524eb..d77955f40d 100644 --- a/lib/parse-datetime.y +++ b/lib/parse-datetime.y @@ -113,14 +113,6 @@ typedef long int long_time_t; typedef time_t long_time_t; #endif -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* Lots of this code assumes time_t and time_t-like values fit into long_time_t. */ verify (TYPE_MINIMUM (long_time_t) <= TYPE_MINIMUM (time_t) @@ -876,7 +868,7 @@ to_year (textint textyear) return year; } -static table const * _GL_ATTRIBUTE_PURE +static table const * lookup_zone (parser_control const *pc, char const *name) { table const *tp; diff --git a/lib/propername.c b/lib/propername.c index f2e80d15a7..b74923de95 100644 --- a/lib/propername.c +++ b/lib/propername.c @@ -38,14 +38,6 @@ #include "xalloc.h" #include "gettext.h" -/* The attribute __const__ was added in gcc 2.95. */ -#undef _GL_ATTRIBUTE_CONST -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) -#else -# define _GL_ATTRIBUTE_CONST /* empty */ -#endif - /* Tests whether STRING contains trim (SUB), starting and ending at word boundaries. @@ -156,7 +148,7 @@ mbsstr_trimmed_wordbounded (const char *string, const char *sub) /* Return the localization of NAME. NAME is written in ASCII. */ -const char * _GL_ATTRIBUTE_CONST +const char * proper_name (const char *name) { /* See whether there is a translation. */ diff --git a/lib/quotearg.c b/lib/quotearg.c index 18b788adee..fb4955993e 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -42,14 +42,6 @@ #define INT_BITS (sizeof (int) * CHAR_BIT) -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - struct quoting_options { /* Basic quoting style. */ @@ -113,7 +105,7 @@ clone_quoting_options (struct quoting_options *o) } /* Get the value of O's quoting style. If O is null, use the default. */ -enum quoting_style _GL_ATTRIBUTE_PURE +enum quoting_style get_quoting_style (struct quoting_options *o) { return (o ? o : &default_quoting_options)->style; diff --git a/lib/sockets.c b/lib/sockets.c index 9a448097c4..42b8f9ea58 100644 --- a/lib/sockets.c +++ b/lib/sockets.c @@ -22,14 +22,6 @@ /* Specification. */ #include "sockets.h" -/* The attribute __const__ was added in gcc 2.95. */ -#undef _GL_ATTRIBUTE_CONST -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) -#else -# define _GL_ATTRIBUTE_CONST /* empty */ -#endif - #if WINDOWS_SOCKETS /* This includes winsock2.h on MinGW. */ @@ -111,7 +103,7 @@ static int initialized_sockets_version /* = 0 */; #endif /* WINDOWS_SOCKETS */ -int _GL_ATTRIBUTE_CONST +int gl_sockets_startup (int version _GL_UNUSED) { #if WINDOWS_SOCKETS diff --git a/lib/strnlen1.c b/lib/strnlen1.c index f735bffe5c..f64ce104a3 100644 --- a/lib/strnlen1.c +++ b/lib/strnlen1.c @@ -21,18 +21,10 @@ #include -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* Find the length of STRING + 1, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many characters, return MAXLEN. */ /* This is the same as strnlen (string, maxlen - 1) + 1. */ -size_t _GL_ATTRIBUTE_PURE +size_t strnlen1 (const char *string, size_t maxlen) { const char *end = (const char *) memchr (string, '\0', maxlen); diff --git a/lib/uniwidth/width.c b/lib/uniwidth/width.c index f882257e87..a314e71bf0 100644 --- a/lib/uniwidth/width.c +++ b/lib/uniwidth/width.c @@ -22,14 +22,6 @@ #include "cjk.h" -/* The attribute __pure__ was added in gcc 2.96. */ -#undef _GL_ATTRIBUTE_PURE -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ -#endif - /* * Non-spacing attribute table. * Consists of: @@ -319,7 +311,7 @@ static const signed char nonspacing_table_ind[240] = { }; /* Determine number of column positions required for UC. */ -int _GL_ATTRIBUTE_PURE +int uc_width (ucs4_t uc, const char *encoding) { /* Test for non-spacing or control character. */ -- cgit v1.2.1 From e3a7a9fd96b0ae812052466af59b55fa1c37bd98 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 25 Apr 2011 19:43:59 +0200 Subject: strnlen: Avoid memchr related link error on old obsolete platforms. * modules/memchr-obsolete: New file. * m4/memchr-obsolete.m4: New file. * m4/memchr.m4 (gl_FUNC_MEMCHR): Don't check whether memchr exists if gl_FUNC_MEMCHR_OBSOLETE is not also defined. * modules/memchr (Depends-on): Add memchr-obsolete. * modules/strnlen (Depends-on): Likewise. * doc/posix-functions/memchr.texi: Mention module memchr-obsolete. --- ChangeLog | 11 +++++++++++ doc/posix-functions/memchr.texi | 13 ++++++++----- m4/memchr-obsolete.m4 | 11 +++++++++++ m4/memchr.m4 | 16 ++++++++++------ modules/memchr | 1 + modules/memchr-obsolete | 28 ++++++++++++++++++++++++++++ modules/strnlen | 1 + 7 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 m4/memchr-obsolete.m4 create mode 100644 modules/memchr-obsolete diff --git a/ChangeLog b/ChangeLog index 65ed4a015f..2a4d9fedfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-04-25 Bruno Haible + + strnlen: Avoid memchr related link error on old obsolete platforms. + * modules/memchr-obsolete: New file. + * m4/memchr-obsolete.m4: New file. + * m4/memchr.m4 (gl_FUNC_MEMCHR): Don't check whether memchr exists if + gl_FUNC_MEMCHR_OBSOLETE is not also defined. + * modules/memchr (Depends-on): Add memchr-obsolete. + * modules/strnlen (Depends-on): Likewise. + * doc/posix-functions/memchr.texi: Mention module memchr-obsolete. + 2011-04-25 Jim Meyering maint.mk: makefile_at_at_check extend and clean up diff --git a/doc/posix-functions/memchr.texi b/doc/posix-functions/memchr.texi index 3c9cfcb9d2..68a15a23f6 100644 --- a/doc/posix-functions/memchr.texi +++ b/doc/posix-functions/memchr.texi @@ -4,18 +4,21 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/memchr.html} -Gnulib module: memchr +Gnulib module: memchr or memchr-obsolete -Portability problems fixed by Gnulib: +Portability problems fixed by either Gnulib module @code{memchr} or @code{memchr-obsolete}: @itemize -@item -This function is missing on some older platforms. - @item This function dereferences too much memory on some platforms: glibc 2.10 on x86_64, IA-64; glibc 2.11 on Alpha. @end itemize +Portability problems fixed by Gnulib module @code{memchr-obsolete}: +@itemize +@item +This function is missing on some older platforms. +@end itemize + Portability problems not fixed by Gnulib: @itemize @end itemize diff --git a/m4/memchr-obsolete.m4 b/m4/memchr-obsolete.m4 new file mode 100644 index 0000000000..c65f651e13 --- /dev/null +++ b/m4/memchr-obsolete.m4 @@ -0,0 +1,11 @@ +# memchr-obsolete.m4 serial 1 +dnl Copyright (C) 2011 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. + +AC_DEFUN([gl_FUNC_MEMCHR_OBSOLETE], +[ + dnl The real code is in memchr.m4. + : +]) diff --git a/m4/memchr.m4 b/m4/memchr.m4 index 3c2b313916..a544e2b4e7 100644 --- a/m4/memchr.m4 +++ b/m4/memchr.m4 @@ -1,4 +1,4 @@ -# memchr.m4 serial 10 +# memchr.m4 serial 11 dnl Copyright (C) 2002-2004, 2009-2011 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,10 +11,16 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) - dnl These days, we assume memchr is present. But just in case... AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_CHECK_FUNCS_ONCE([memchr]) - if test $ac_cv_func_memchr = yes; then + m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [ + dnl These days, we assume memchr is present. But if support for old + dnl platforms is desired: + AC_CHECK_FUNCS_ONCE([memchr]) + if test $ac_cv_func_memchr = no; then + HAVE_MEMCHR=0 + fi + ]) + if test $HAVE_MEMCHR = 1; then # Detect platform-specific bugs in some versions of glibc: # memchr should not dereference anything with length 0 # http://bugzilla.redhat.com/499689 @@ -73,8 +79,6 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], if test "$gl_cv_func_memchr_works" != yes; then REPLACE_MEMCHR=1 fi - else - HAVE_MEMCHR=0 fi if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then AC_LIBOBJ([memchr]) diff --git a/modules/memchr b/modules/memchr index 495f2e26bd..229b3a5bfe 100644 --- a/modules/memchr +++ b/modules/memchr @@ -10,6 +10,7 @@ m4/mmap-anon.m4 Depends-on: extensions string +memchr-obsolete configure.ac: gl_FUNC_MEMCHR diff --git a/modules/memchr-obsolete b/modules/memchr-obsolete new file mode 100644 index 0000000000..c1033b6605 --- /dev/null +++ b/modules/memchr-obsolete @@ -0,0 +1,28 @@ +Description: +memchr() function for old platforms. + +Status: +obsolete + +Notice: +This module is obsolete. + +Files: +m4/memchr-obsolete.m4 + +Depends-on: +memchr + +configure.ac: +gl_FUNC_MEMCHR_OBSOLETE + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Bruno Haible diff --git a/modules/strnlen b/modules/strnlen index 627e6948fe..2f50c9b537 100644 --- a/modules/strnlen +++ b/modules/strnlen @@ -8,6 +8,7 @@ m4/strnlen.m4 Depends-on: extensions string +memchr-obsolete configure.ac: gl_FUNC_STRNLEN -- cgit v1.2.1 From 4a2a66e4454be259d3c6c29a34e625dc1b70bd7f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 25 Apr 2011 19:45:09 +0200 Subject: dup2: Remove check for dup2, unless supporting old obsolete platforms. * modules/dup2-obsolete: New file. * m4/dup2-obsolete.m4: New file. * m4/dup2.m4 (gl_FUNC_DUP2): Don't check whether dup2 exists if gl_FUNC_DUP2_OBSOLETE is not also defined. * modules/dup2 (Depends-on): Add dup2-obsolete. * doc/posix-functions/dup2.texi: Mention module dup2-obsolete. --- ChangeLog | 10 ++++++++++ doc/posix-functions/dup2.texi | 7 +++++-- m4/dup2-obsolete.m4 | 11 +++++++++++ m4/dup2.m4 | 16 +++++++++++----- modules/dup2 | 1 + modules/dup2-obsolete | 28 ++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 m4/dup2-obsolete.m4 create mode 100644 modules/dup2-obsolete diff --git a/ChangeLog b/ChangeLog index 2a4d9fedfd..d35d077b8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-04-25 Bruno Haible + + dup2: Remove check for dup2, unless supporting old obsolete platforms. + * modules/dup2-obsolete: New file. + * m4/dup2-obsolete.m4: New file. + * m4/dup2.m4 (gl_FUNC_DUP2): Don't check whether dup2 exists if + gl_FUNC_DUP2_OBSOLETE is not also defined. + * modules/dup2 (Depends-on): Add dup2-obsolete. + * doc/posix-functions/dup2.texi: Mention module dup2-obsolete. + 2011-04-25 Bruno Haible strnlen: Avoid memchr related link error on old obsolete platforms. diff --git a/doc/posix-functions/dup2.texi b/doc/posix-functions/dup2.texi index fc1e3595a9..6054c303ba 100644 --- a/doc/posix-functions/dup2.texi +++ b/doc/posix-functions/dup2.texi @@ -4,9 +4,9 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/dup2.html} -Gnulib module: dup2 +Gnulib module: dup2 or dup2-obsolete -Portability problems fixed by Gnulib: +Portability problems fixed by either Gnulib module @code{dup2} or @code{dup2-obsolete}: @itemize @item This function always returns 0 for success on some platforms: @@ -34,7 +34,10 @@ This function returns @code{EMFILE} instead of @code{EBADF} for extremely large targets, which interferes with using @code{dup2(fd,fd)==fd)} as the minimal @code{EBADF} filter: FreeBSD 6.1, Cygwin 1.5. +@end itemize +Portability problems fixed by Gnulib module @code{dup2-obsolete}: +@itemize @item This function is missing on some older platforms. @end itemize diff --git a/m4/dup2-obsolete.m4 b/m4/dup2-obsolete.m4 new file mode 100644 index 0000000000..881649882c --- /dev/null +++ b/m4/dup2-obsolete.m4 @@ -0,0 +1,11 @@ +# dup2-obsolete.m4 serial 1 +dnl Copyright (C) 2011 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. + +AC_DEFUN([gl_FUNC_DUP2_OBSOLETE], +[ + dnl The real code is in dup2.m4. + : +]) diff --git a/m4/dup2.m4 b/m4/dup2.m4 index def263b87a..b8794c27b0 100644 --- a/m4/dup2.m4 +++ b/m4/dup2.m4 @@ -8,11 +8,17 @@ AC_DEFUN([gl_FUNC_DUP2], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_FUNCS_ONCE([dup2 fcntl]) - if test $ac_cv_func_dup2 = no; then - HAVE_DUP2=0 - AC_LIBOBJ([dup2]) - else + m4_ifdef([gl_FUNC_DUP2_OBSOLETE], [ + AC_CHECK_FUNCS_ONCE([dup2]) + if test $ac_cv_func_dup2 = no; then + HAVE_DUP2=0 + AC_LIBOBJ([dup2]) + fi + ], [ + AC_DEFINE([HAVE_DUP2], [1], [Define to 1 if you have the 'dup2' function.]) + ]) + AC_CHECK_FUNCS_ONCE([fcntl]) + if test $HAVE_DUP2 = 1; then AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], [AC_RUN_IFELSE([ AC_LANG_PROGRAM([[#include diff --git a/modules/dup2 b/modules/dup2 index cea1a974b5..17cafd1c6a 100644 --- a/modules/dup2 +++ b/modules/dup2 @@ -7,6 +7,7 @@ m4/dup2.m4 Depends-on: unistd +dup2-obsolete configure.ac: gl_FUNC_DUP2 diff --git a/modules/dup2-obsolete b/modules/dup2-obsolete new file mode 100644 index 0000000000..ba71bb97cf --- /dev/null +++ b/modules/dup2-obsolete @@ -0,0 +1,28 @@ +Description: +dup2() function for old platforms. + +Status: +obsolete + +Notice: +This module is obsolete. + +Files: +m4/dup2-obsolete.m4 + +Depends-on: +dup2 + +configure.ac: +gl_FUNC_DUP2_OBSOLETE + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Bruno Haible -- cgit v1.2.1 From fca1c5cc2d6b7e48f0638f99e78625e21b89ead6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 25 Apr 2011 19:46:27 +0200 Subject: strcase: Make module obsolete. * modules/strcase (Status, Notice): New sections. --- ChangeLog | 5 +++++ modules/strcase | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index d35d077b8e..6891569450 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-25 Bruno Haible + + strcase: Make module obsolete. + * modules/strcase (Status, Notice): New sections. + 2011-04-25 Bruno Haible dup2: Remove check for dup2, unless supporting old obsolete platforms. diff --git a/modules/strcase b/modules/strcase index 0023f46794..0c91e06c4f 100644 --- a/modules/strcase +++ b/modules/strcase @@ -1,6 +1,12 @@ Description: Case-insensitive string comparison functions. +Status: +obsolete + +Notice: +This module is obsolete. + Files: lib/strcasecmp.c lib/strncasecmp.c -- cgit v1.2.1 From b9453f8ce1c5d8bfeb7c110e4c73ba35ac711023 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 25 Apr 2011 20:53:41 +0200 Subject: strtod: Remove check for strtod, unless supporting old platforms. * modules/strtod-obsolete: New file. * m4/strtod-obsolete.m4: New file. * m4/strtod.m4 (gl_FUNC_STRTOD): Don't check whether strtod is declared if gl_FUNC_STRTOD_OBSOLETE is not also defined. * modules/strtod (Depends-on): Add strtod-obsolete. * doc/posix-functions/strtod.texi: Mention module strtod-obsolete. --- ChangeLog | 10 ++++++++++ doc/posix-functions/strtod.texi | 13 ++++++++----- m4/strtod-obsolete.m4 | 11 +++++++++++ m4/strtod.m4 | 23 +++++++++++++---------- modules/strtod | 1 + modules/strtod-obsolete | 28 ++++++++++++++++++++++++++++ 6 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 m4/strtod-obsolete.m4 create mode 100644 modules/strtod-obsolete diff --git a/ChangeLog b/ChangeLog index 6891569450..ef14fb595d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-04-25 Bruno Haible + + strtod: Remove check for strtod, unless supporting old platforms. + * modules/strtod-obsolete: New file. + * m4/strtod-obsolete.m4: New file. + * m4/strtod.m4 (gl_FUNC_STRTOD): Don't check whether strtod is declared + if gl_FUNC_STRTOD_OBSOLETE is not also defined. + * modules/strtod (Depends-on): Add strtod-obsolete. + * doc/posix-functions/strtod.texi: Mention module strtod-obsolete. + 2011-04-25 Bruno Haible strcase: Make module obsolete. diff --git a/doc/posix-functions/strtod.texi b/doc/posix-functions/strtod.texi index 222f584a79..4f8f08bdb7 100644 --- a/doc/posix-functions/strtod.texi +++ b/doc/posix-functions/strtod.texi @@ -4,13 +4,10 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/strtod.html} -Gnulib module: strtod +Gnulib module: strtod or strtod-obsolete -Portability problems fixed by Gnulib: +Portability problems fixed by either Gnulib module @code{strtod} or @code{strtod-obsolete}: @itemize -@item -This function is missing on some old platforms. - @item This function mis-parses strings with leading @samp{+} on some old platforms: Old versions of Linux. @@ -67,6 +64,12 @@ platforms: AIX 7.1. @end itemize +Portability problems fixed by Gnulib module @code{strtod-obsolete}: +@itemize +@item +This function is missing on some old platforms. +@end itemize + Portability problems not fixed by Gnulib: @itemize @item diff --git a/m4/strtod-obsolete.m4 b/m4/strtod-obsolete.m4 new file mode 100644 index 0000000000..baeb898032 --- /dev/null +++ b/m4/strtod-obsolete.m4 @@ -0,0 +1,11 @@ +# strtod-obsolete.m4 serial 1 +dnl Copyright (C) 2011 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. + +AC_DEFUN([gl_FUNC_STRTOD_OBSOLETE], +[ + dnl The real code is in strtod.m4. + : +]) diff --git a/m4/strtod.m4 b/m4/strtod.m4 index 4619c3357f..f40e342f43 100644 --- a/m4/strtod.m4 +++ b/m4/strtod.m4 @@ -1,4 +1,4 @@ -# strtod.m4 serial 19 +# strtod.m4 serial 20 dnl Copyright (C) 2002-2003, 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,15 +7,18 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOD], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - dnl Test whether strtod is declared. - dnl Don't call AC_FUNC_STRTOD, because it does not have the right guess - dnl when cross-compiling. - dnl Don't call AC_CHECK_FUNCS([strtod]) because it would collide with the - dnl ac_cv_func_strtod variable set by the AC_FUNC_STRTOD macro. - AC_CHECK_DECLS_ONCE([strtod]) - if test $ac_cv_have_decl_strtod != yes; then - HAVE_STRTOD=0 - else + m4_ifdef([gl_FUNC_STRTOD_OBSOLETE], [ + dnl Test whether strtod is declared. + dnl Don't call AC_FUNC_STRTOD, because it does not have the right guess + dnl when cross-compiling. + dnl Don't call AC_CHECK_FUNCS([strtod]) because it would collide with the + dnl ac_cv_func_strtod variable set by the AC_FUNC_STRTOD macro. + AC_CHECK_DECLS_ONCE([strtod]) + if test $ac_cv_have_decl_strtod != yes; then + HAVE_STRTOD=0 + fi + ]) + if test $HAVE_STRTOD = 1; then AC_CACHE_CHECK([whether strtod obeys C99], [gl_cv_func_strtod_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include diff --git a/modules/strtod b/modules/strtod index 056ff4263d..935e5f8d6c 100644 --- a/modules/strtod +++ b/modules/strtod @@ -10,6 +10,7 @@ Depends-on: c-ctype stdbool stdlib +strtod-obsolete configure.ac: gl_FUNC_STRTOD diff --git a/modules/strtod-obsolete b/modules/strtod-obsolete new file mode 100644 index 0000000000..323df8aac1 --- /dev/null +++ b/modules/strtod-obsolete @@ -0,0 +1,28 @@ +Description: +strtod() function for old platforms. + +Status: +obsolete + +Notice: +This module is obsolete. + +Files: +m4/strtod-obsolete.m4 + +Depends-on: +strtod + +configure.ac: +gl_FUNC_STRTOD_OBSOLETE + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Bruno Haible -- cgit v1.2.1 From 7ff135374d85bfcdd22488b49dfc8bffe64be738 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 25 Apr 2011 20:55:15 +0200 Subject: strtol, strtoul: Mark modules as obsolete. * modules/strtol (Status, Notice): New sections. * modules/strtoul (Status, Notice): New sections. --- ChangeLog | 6 ++++++ modules/strtol | 6 ++++++ modules/strtoul | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index ef14fb595d..428047785c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-25 Bruno Haible + + strtol, strtoul: Mark modules as obsolete. + * modules/strtol (Status, Notice): New sections. + * modules/strtoul (Status, Notice): New sections. + 2011-04-25 Bruno Haible strtod: Remove check for strtod, unless supporting old platforms. diff --git a/modules/strtol b/modules/strtol index d06a55b14b..654b2f77f3 100644 --- a/modules/strtol +++ b/modules/strtol @@ -1,6 +1,12 @@ Description: strtol() function: convert string to 'long'. +Status: +obsolete + +Notice: +This module is obsolete. + Files: lib/strtol.c m4/strtol.m4 diff --git a/modules/strtoul b/modules/strtoul index 9c6ca993a8..dc2b50b12f 100644 --- a/modules/strtoul +++ b/modules/strtoul @@ -1,6 +1,12 @@ Description: strtoul() function: convert string to 'unsigned long'. +Status: +obsolete + +Notice: +This module is obsolete. + Files: lib/strtol.c lib/strtoul.c -- cgit v1.2.1 From 7d06b32684363a39fae65c616b84bc7589768106 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Mon, 25 Apr 2011 21:03:02 +0200 Subject: gnumakefile: Replace TAB with SPCs. * modules/gnumakefile (configure.ac): Replace TAB with SPCs. --- ChangeLog | 4 ++++ modules/gnumakefile | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 428047785c..4fcc308e64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-04-25 Simon Josefsson + + * modules/gnumakefile (configure.ac): Replace TAB with SPCs. + 2011-04-25 Bruno Haible strtol, strtoul: Mark modules as obsolete. diff --git a/modules/gnumakefile b/modules/gnumakefile index 483ff74dd3..a86475a3ff 100644 --- a/modules/gnumakefile +++ b/modules/gnumakefile @@ -14,9 +14,9 @@ configure.ac: # builds, so use a shell variable to bypass this. GNUmakefile=GNUmakefile m4_if(m4_version_compare([2.61a.100], - m4_defn([m4_PACKAGE_VERSION])), [1], [], + m4_defn([m4_PACKAGE_VERSION])), [1], [], [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [], - [GNUmakefile=$GNUmakefile])]) + [GNUmakefile=$GNUmakefile])]) Makefile.am: distclean-local: clean-GNUmakefile -- cgit v1.2.1 From 6950d658b76d6144c837b1a832eb062253e15ed7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 25 Apr 2011 17:33:42 -0700 Subject: strtoimax, strtoumax: simplify, port to HP-UX 11.00 64-bit This supports apps that need pointers to strtoimax and strtoumax, and ports to HP-UX 11.00 64.bit, which has macros that expand to nonexistent functions. See et seq. * lib/inttypes.in.h (strtoimax, strtoumax): #undef before declaring. * m4/strtoimax.m4 (gl_FUNC_STRTOIMAX): Don't check whether it's a macro. * m4/strtoumax.m4 (gl_FUNC_STRTOUMAX): Likewise. --- ChangeLog | 13 +++++++++++++ lib/inttypes.in.h | 2 ++ m4/strtoimax.m4 | 16 ++++++---------- m4/strtoumax.m4 | 16 ++++++---------- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4fcc308e64..791cf675c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2011-04-25 Paul Eggert + + strtoimax, strtoumax: simplify, port to HP-UX 11.00 64-bit + This supports apps that need pointers to strtoimax and strtoumax, + and ports to HP-UX 11.00 64.bit, which has macros that expand to + nonexistent functions. See + + et seq. + * lib/inttypes.in.h (strtoimax, strtoumax): #undef before declaring. + * m4/strtoimax.m4 (gl_FUNC_STRTOIMAX): Don't check whether it's + a macro. + * m4/strtoumax.m4 (gl_FUNC_STRTOUMAX): Likewise. + 2011-04-25 Simon Josefsson * modules/gnumakefile (configure.ac): Replace TAB with SPCs. diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index 6a8f46dddc..7abf39403f 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -1076,6 +1076,7 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " #if @GNULIB_STRTOIMAX@ # if !@HAVE_DECL_STRTOIMAX@ +# undef strtoimax extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1)); # endif #elif defined GNULIB_POSIXCHECK @@ -1088,6 +1089,7 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " #if @GNULIB_STRTOUMAX@ # if !@HAVE_DECL_STRTOUMAX@ +# undef strtoumax extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1)); # endif #elif defined GNULIB_POSIXCHECK diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4 index e82e7cd08f..d46673b2a8 100644 --- a/m4/strtoimax.m4 +++ b/m4/strtoimax.m4 @@ -1,4 +1,4 @@ -# strtoimax.m4 serial 8 +# strtoimax.m4 serial 9 dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,16 +6,12 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOIMAX], [ - AC_CACHE_CHECK([whether defines strtoimax as a macro], - gl_cv_func_strtoimax_macro, - [AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include -#ifdef strtoimax - inttypes_h_defines_strtoimax -#endif], - gl_cv_func_strtoimax_macro=yes, - gl_cv_func_strtoimax_macro=no)]) + AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) + + AC_CHECK_DECLS_ONCE([strtoimax]) + if test "$ac_cv_have_decl_strtoimax" != yes; then + HAVE_DECL_STRTOIMAX=0 - if test "$gl_cv_func_strtoimax_macro" != yes; then AC_REPLACE_FUNCS([strtoimax]) if test $ac_cv_func_strtoimax = no; then gl_PREREQ_STRTOIMAX diff --git a/m4/strtoumax.m4 b/m4/strtoumax.m4 index 448c4d9b77..7fa563642a 100644 --- a/m4/strtoumax.m4 +++ b/m4/strtoumax.m4 @@ -1,4 +1,4 @@ -# strtoumax.m4 serial 8 +# strtoumax.m4 serial 9 dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,16 +6,12 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRTOUMAX], [ - AC_CACHE_CHECK([whether defines strtoumax as a macro], - gl_cv_func_strtoumax_macro, - [AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include -#ifdef strtoumax - inttypes_h_defines_strtoumax -#endif], - gl_cv_func_strtoumax_macro=yes, - gl_cv_func_strtoumax_macro=no)]) + AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) + + AC_CHECK_DECLS_ONCE([strtoumax]) + if test "$ac_cv_have_decl_strtoumax" != yes; then + HAVE_DECL_STRTOUMAX=0 - if test "$gl_cv_func_strtoumax_macro" != yes; then AC_REPLACE_FUNCS([strtoumax]) if test $ac_cv_func_strtoumax = no; then gl_PREREQ_STRTOUMAX -- cgit v1.2.1 From 537168321f3784bb33330f5df6b9b169075ba833 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 25 Apr 2011 18:00:33 -0700 Subject: inttypes: omit now-redundant strtoimax and strtoumax work * m4/inttypes.m4 (gl_INTTYPES_H): Do not check for strtoimax and strtoumax decls; gl_FUNC_STRTOIMAX and gl_FUNC_STRTOUMAX now do this. --- ChangeLog | 4 ++++ m4/inttypes.m4 | 16 +--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 791cf675c0..d37667be03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-04-25 Paul Eggert + inttypes: omit now-redundant strtoimax and strtoumax work + * m4/inttypes.m4 (gl_INTTYPES_H): Do not check for strtoimax and + strtoumax decls; gl_FUNC_STRTOIMAX and gl_FUNC_STRTOUMAX now do this. + strtoimax, strtoumax: simplify, port to HP-UX 11.00 64-bit This supports apps that need pointers to strtoimax and strtoumax, and ports to HP-UX 11.00 64.bit, which has macros that expand to diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index 1b76c691df..99a60710d0 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 21 +# inttypes.m4 serial 22 dnl Copyright (C) 2006-2011 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,8 +12,6 @@ AC_DEFUN([gl_INTTYPES_H], AC_REQUIRE([gl_STDINT_H]) AC_REQUIRE([gt_INTTYPES_PRI]) AC_CHECK_HEADERS_ONCE([inttypes.h]) - AC_CHECK_DECLS_ONCE([strtoimax]) - AC_CHECK_DECLS_ONCE([strtoumax]) dnl Override always, so that the portability warnings work. AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) @@ -60,18 +58,6 @@ AC_DEFUN([gl_INTTYPES_H], fi AC_SUBST([PRIPTR_PREFIX]) - if test "$ac_cv_have_decl_strtoimax" = yes; then - HAVE_DECL_STRTOIMAX=1 - else - HAVE_DECL_STRTOIMAX=0 - fi - - if test "$ac_cv_have_decl_strtoumax" = yes; then - HAVE_DECL_STRTOUMAX=1 - else - HAVE_DECL_STRTOUMAX=0 - fi - gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( [INT32_MAX_LT_INTMAX_MAX], [defined INT32_MAX && defined INTMAX_MAX], -- cgit v1.2.1 From 23e09df46ae150007e6208af1be628fd2d63d986 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 25 Apr 2011 19:33:14 -0700 Subject: inttypes-incomplete: new module * m4/inttypes.m4 (gl_INTTYPES_INCOMPLETE): New macro, containing all but the PRI* and SCN* parts of gl_INTTYPES_H. (gl_INTTYPES_PRI_SCN): New macro, containing the PRI* and SCN* parts of gl_INTTYPES_H. (gl_INTTYPES_H): Rewrite in terms of these new macros. (gl_INTTYPES_H_DEFAULTS): Provide defaults for the PRI* and SCN* parts, in case gl_INTTYPE_PRI_SCN is not invoked. * modules/imaxabs, modules/imaxdiv, modules/strtoimax (Depends-on): * modules/strtoumax, modules/xstrtol (Depends-on): Depend on inttypes-incomplete, not inttypes. * modules/inttypes-incomplete: New module, containing the contents of the old modules/inttypes module, except that the Files: section omits m4/inttypes-pri.m4, and the configure.ac section invokes gl_INTTYPES_INCOMPLETE rather than gl_INTTYPES_H. * modules/inttypes (Files): Remove lib/inttypes.in.h, m4/inttypes.m4. (Depends-on): Depend only on inttypes-incomplete. (Makefile.am): Remove everything; this is now in inttypes-incomplete. --- ChangeLog | 19 ++++++++++++++ m4/inttypes.m4 | 29 ++++++++++++++++----- modules/imaxabs | 2 +- modules/imaxdiv | 2 +- modules/inttypes | 43 +------------------------------ modules/inttypes-incomplete | 62 +++++++++++++++++++++++++++++++++++++++++++++ modules/strtoimax | 2 +- modules/strtoumax | 2 +- modules/xstrtol | 2 +- 9 files changed, 109 insertions(+), 54 deletions(-) create mode 100644 modules/inttypes-incomplete diff --git a/ChangeLog b/ChangeLog index d37667be03..4fef3ae162 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2011-04-25 Paul Eggert + inttypes-incomplete: new module + * m4/inttypes.m4 (gl_INTTYPES_INCOMPLETE): New macro, containing + all but the PRI* and SCN* parts of gl_INTTYPES_H. + (gl_INTTYPES_PRI_SCN): New macro, containing the PRI* and SCN* parts + of gl_INTTYPES_H. + (gl_INTTYPES_H): Rewrite in terms of these new macros. + (gl_INTTYPES_H_DEFAULTS): Provide defaults for the PRI* and SCN* + parts, in case gl_INTTYPE_PRI_SCN is not invoked. + * modules/imaxabs, modules/imaxdiv, modules/strtoimax (Depends-on): + * modules/strtoumax, modules/xstrtol (Depends-on): + Depend on inttypes-incomplete, not inttypes. + * modules/inttypes-incomplete: New module, containing the contents + of the old modules/inttypes module, except that the Files: section + omits m4/inttypes-pri.m4, and the configure.ac section invokes + gl_INTTYPES_INCOMPLETE rather than gl_INTTYPES_H. + * modules/inttypes (Files): Remove lib/inttypes.in.h, m4/inttypes.m4. + (Depends-on): Depend only on inttypes-incomplete. + (Makefile.am): Remove everything; this is now in inttypes-incomplete. + inttypes: omit now-redundant strtoimax and strtoumax work * m4/inttypes.m4 (gl_INTTYPES_H): Do not check for strtoimax and strtoumax decls; gl_FUNC_STRTOIMAX and gl_FUNC_STRTOUMAX now do this. diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index 99a60710d0..ee5bc1c723 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 22 +# inttypes.m4 serial 23 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,9 +8,14 @@ dnl From Derek Price, Bruno Haible. dnl Test whether is supported or must be substituted. AC_DEFUN([gl_INTTYPES_H], +[ + AC_REQUIRE([gl_INTTYPES_INCOMPLETE]) + gl_INTTYPES_PRI_SCN +]) + +AC_DEFUN([gl_INTTYPES_INCOMPLETE], [ AC_REQUIRE([gl_STDINT_H]) - AC_REQUIRE([gt_INTTYPES_PRI]) AC_CHECK_HEADERS_ONCE([inttypes.h]) dnl Override always, so that the portability warnings work. @@ -35,6 +40,17 @@ AC_DEFUN([gl_INTTYPES_H], #endif ]) + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include + ]], [imaxabs imaxdiv strtoimax strtoumax]) +]) + +# Ensure that the PRI* and SCN* macros are defined appropriately. +AC_DEFUN([gl_INTTYPES_PRI_SCN], +[ + AC_REQUIRE([gt_INTTYPES_PRI]) + PRIPTR_PREFIX= if test -n "$STDINT_H"; then dnl Using the gnulib . It always defines intptr_t to 'long'. @@ -86,11 +102,6 @@ AC_DEFUN([gl_INTTYPES_H], else UINT64_MAX_EQ_ULONG_MAX=-1 fi - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include - ]], [imaxabs imaxdiv strtoimax strtoumax]) ]) # Define the symbol $1 to be 1 if the condition is true, 0 otherwise. @@ -152,4 +163,8 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS], HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) + INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX]) + PRI_MACROS_BROKEN=0; AC_SUBST([PRI_MACROS_BROKEN]) + PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX]) + UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX]) ]) diff --git a/modules/imaxabs b/modules/imaxabs index 481486d145..8da390f736 100644 --- a/modules/imaxabs +++ b/modules/imaxabs @@ -6,7 +6,7 @@ lib/imaxabs.c m4/imaxabs.m4 Depends-on: -inttypes +inttypes-incomplete configure.ac: gl_FUNC_IMAXABS diff --git a/modules/imaxdiv b/modules/imaxdiv index 7eacbc750d..7589024c07 100644 --- a/modules/imaxdiv +++ b/modules/imaxdiv @@ -6,7 +6,7 @@ lib/imaxdiv.c m4/imaxdiv.m4 Depends-on: -inttypes +inttypes-incomplete configure.ac: gl_FUNC_IMAXDIV diff --git a/modules/inttypes b/modules/inttypes index f85939c8f2..157b59791a 100644 --- a/modules/inttypes +++ b/modules/inttypes @@ -2,56 +2,15 @@ Description: An that nearly conforms to C99. Files: -lib/inttypes.in.h m4/inttypes-pri.m4 -m4/inttypes.m4 Depends-on: -arg-nonnull -include_next -multiarch -stdint -warn-on-use +inttypes-incomplete configure.ac: gl_INTTYPES_H Makefile.am: -BUILT_SOURCES += inttypes.h - -# We need the following in order to create when the system -# doesn't have one that works with the given compiler. -inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ - -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \ - -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ - -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ - -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ - -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \ - -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \ - -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \ - -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \ - -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \ - -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \ - -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ - -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ - -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ - -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ - -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \ - -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \ - -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/inttypes.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += inttypes.h inttypes.h-t Include: diff --git a/modules/inttypes-incomplete b/modules/inttypes-incomplete new file mode 100644 index 0000000000..ef743dd604 --- /dev/null +++ b/modules/inttypes-incomplete @@ -0,0 +1,62 @@ +Description: +An that conforms to C99 except for PRI* and SCN* macros. + +Files: +lib/inttypes.in.h +m4/inttypes.m4 + +Depends-on: +arg-nonnull +include_next +multiarch +stdint +warn-on-use + +configure.ac: +gl_INTTYPES_INCOMPLETE + +Makefile.am: +BUILT_SOURCES += inttypes.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ + -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \ + -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ + -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \ + -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \ + -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \ + -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \ + -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \ + -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \ + -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ + -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ + -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ + -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ + -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \ + -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \ + -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/inttypes.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += inttypes.h inttypes.h-t + +Include: + + +License: +LGPLv2+ + +Maintainer: +all diff --git a/modules/strtoimax b/modules/strtoimax index 9f82af4536..c4e8982f1f 100644 --- a/modules/strtoimax +++ b/modules/strtoimax @@ -9,7 +9,7 @@ m4/strtoimax.m4 Depends-on: strtoll verify -inttypes +inttypes-incomplete stdint configure.ac: diff --git a/modules/strtoumax b/modules/strtoumax index e88628526f..a1a84f5b81 100644 --- a/modules/strtoumax +++ b/modules/strtoumax @@ -9,7 +9,7 @@ m4/strtoumax.m4 Depends-on: strtoimax strtoull -inttypes +inttypes-incomplete stdint configure.ac: diff --git a/modules/xstrtol b/modules/xstrtol index 3ce76a8802..b48a4bb1b6 100644 --- a/modules/xstrtol +++ b/modules/xstrtol @@ -14,7 +14,7 @@ error getopt-gnu gettext-h intprops -inttypes +inttypes-incomplete configure.ac: gl_XSTRTOL -- cgit v1.2.1 From 0d1cca61cd72b6e3d0dc5f927334b7d085da3133 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 25 Apr 2011 19:47:18 -0700 Subject: strtoumax: remove dependency on strtoimax This is like the strtoull change of yesterday. * modules/strtoumax (Files): Add lib/strtoimax.c. (Depends-on): Remove strtoimax and add verify. --- ChangeLog | 5 +++++ modules/strtoumax | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4fef3ae162..7948faf6ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-04-25 Paul Eggert + strtoumax: remove dependency on strtoimax + This is like the strtoull change of yesterday. + * modules/strtoumax (Files): Add lib/strtoimax.c. + (Depends-on): Remove strtoimax and add verify. + inttypes-incomplete: new module * m4/inttypes.m4 (gl_INTTYPES_INCOMPLETE): New macro, containing all but the PRI* and SCN* parts of gl_INTTYPES_H. diff --git a/modules/strtoumax b/modules/strtoumax index a1a84f5b81..c2d615ec5b 100644 --- a/modules/strtoumax +++ b/modules/strtoumax @@ -2,13 +2,14 @@ Description: strtoumax() function: convert string to 'uintmax_t'. Files: +lib/strtoimax.c lib/strtoumax.c m4/longlong.m4 m4/strtoumax.m4 Depends-on: -strtoimax strtoull +verify inttypes-incomplete stdint -- cgit v1.2.1 From 599fce2bd8c4d3b229d64761c730535a0d13ecff Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 26 Apr 2011 00:43:46 -0700 Subject: inttypes: also provide default values for 32-bit tests * m4/inttypes.m4 (gl_INTTYPES_H_DEFAULTS): Also provide default values for INT32_MAX_LT_INTMAX_MAX and for UINT32_MAX_LT_UINTMAX_MAX. --- ChangeLog | 6 ++++++ m4/inttypes.m4 | 2 ++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7948faf6ee..248d0f399a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-26 Paul Eggert + + inttypes: also provide default values for 32-bit tests + * m4/inttypes.m4 (gl_INTTYPES_H_DEFAULTS): Also provide default values + for INT32_MAX_LT_INTMAX_MAX and for UINT32_MAX_LT_UINTMAX_MAX. + 2011-04-25 Paul Eggert strtoumax: remove dependency on strtoimax diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index ee5bc1c723..1e81990bda 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -163,8 +163,10 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS], HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) + INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX]) INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX]) PRI_MACROS_BROKEN=0; AC_SUBST([PRI_MACROS_BROKEN]) PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX]) + UINT32_MAX_LT_UINTMAX_MAX=1; AC_SUBST([UINT32_MAX_LT_UINTMAX_MAX]) UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX]) ]) -- cgit v1.2.1 From ca1502f78a51c83c3443b3f3cdffdca39cdedf40 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Wed, 27 Apr 2011 14:30:31 +0100 Subject: mkstemp: mention clean-temp module * lib/mkstemp.c: Add comment. * doc/posix-functions/mkstemp.texi (mkstemp): Likewise. Signed-off-by: Eric Blake --- ChangeLog | 7 +++++++ doc/posix-functions/mkstemp.texi | 3 +++ lib/mkstemp.c | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 248d0f399a..247d541df0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-27 Reuben Thomas + and Eric Blake + + mkstemp: mention clean-temp module + * lib/mkstemp.c: Add comment. + * doc/posix-functions/mkstemp.texi (mkstemp): Likewise. + 2011-04-26 Paul Eggert inttypes: also provide default values for 32-bit tests diff --git a/doc/posix-functions/mkstemp.texi b/doc/posix-functions/mkstemp.texi index 55b42a9feb..5a1e145600 100644 --- a/doc/posix-functions/mkstemp.texi +++ b/doc/posix-functions/mkstemp.texi @@ -24,3 +24,6 @@ On platforms other than glibc 2.0.7 or newer, @code{mkstemp} can create a world or group writable or readable file, if you haven't set the process umask to 077. This is a security risk. @end itemize + +The gnulib module clean-temp can create temporary files that are less +likely to be left behind on signals such as SIGINT. diff --git a/lib/mkstemp.c b/lib/mkstemp.c index b0a8df306a..3c8437e5a4 100644 --- a/lib/mkstemp.c +++ b/lib/mkstemp.c @@ -38,7 +38,11 @@ /* Generate a unique temporary file name from XTEMPLATE. The last six characters of XTEMPLATE must be "XXXXXX"; they are replaced with a string that makes the file name unique. - Then open the file and return a fd. */ + Then open the file and return a fd. + + If you are creating temporary files which will later be removed, + consider using the clean-temp module, which avoids several pitfalls + of using mkstemp directly. */ int mkstemp (char *xtemplate) { -- cgit v1.2.1 From 6fbe9796bd7c04163a5fc1c24ce6dd5bd3036bb1 Mon Sep 17 00:00:00 2001 From: "J.T. Conklin" Date: Wed, 27 Apr 2011 08:23:53 -0700 Subject: Change gnulib-tool to support NetBSD's join For backwards compatibility, the 4.4BSD join used by NetBSD supports a "-a" option as if it was "-a 1 -a 2". Unfortunately, this was done in such a way that "-a 1" and "-a 2" need to be passed as "-a1" or "-a2". --- ChangeLog | 5 +++++ gnulib-tool | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 247d541df0..21ce7d7fd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-27 J.T. Conklin (tiny change) + + * gnulib-tool: change "join -a 2" to "join -a2", the latter is + required by the NetBSD (and perhaps other 4.4BSD derived) join. + 2011-04-27 Reuben Thomas and Eric Blake diff --git a/gnulib-tool b/gnulib-tool index 9461027fe7..49221f022a 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -2522,7 +2522,7 @@ func_show_module_list () echo "Module list with included dependencies (indented):" echo "$specified_modules" | sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules echo "$modules" | sed -e '/^$/d' \ - | LC_ALL=C join -t '|' -a 2 "$tmp"/specified-modules - \ + | LC_ALL=C join -t '|' -a2 "$tmp"/specified-modules - \ | sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/' } -- cgit v1.2.1 From 722fc0acd0be939543544f6eaa66a9750a69d4a0 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 27 Apr 2011 09:52:00 -0600 Subject: passfd: avoid compiler warning Detected on Fedora 13 with -Wshadow. * lib/passfd.c (sendfd, recvfd): Avoid shadowing names. Reported by Laine Stump. Signed-off-by: Eric Blake --- ChangeLog | 6 ++++++ lib/passfd.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21ce7d7fd6..f1006b5f9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-27 Eric Blake + + passfd: avoid compiler warning + * lib/passfd.c (sendfd, recvfd): Avoid shadowing names. + Reported by Laine Stump. + 2011-04-27 J.T. Conklin (tiny change) * gnulib-tool: change "join -a 2" to "join -a2", the latter is diff --git a/lib/passfd.c b/lib/passfd.c index a4d8841070..86c73760b5 100644 --- a/lib/passfd.c +++ b/lib/passfd.c @@ -43,7 +43,7 @@ int sendfd (int sock, int fd) { - char send = 0; + char byte = 0; struct iovec iov; struct msghdr msg; # ifdef CMSG_FIRSTHDR @@ -53,7 +53,7 @@ sendfd (int sock, int fd) /* send at least one char */ memset (&msg, 0, sizeof msg); - iov.iov_base = &send; + iov.iov_base = &byte; iov.iov_len = 1; msg.msg_iov = &iov; msg.msg_iovlen = 1; @@ -100,7 +100,7 @@ sendfd (int sock _GL_UNUSED, int fd _GL_UNUSED) int recvfd (int sock, int flags) { - char recv = 0; + char byte = 0; struct iovec iov; struct msghdr msg; int fd = -1; @@ -118,7 +118,7 @@ recvfd (int sock, int flags) /* send at least one char */ memset (&msg, 0, sizeof msg); - iov.iov_base = &recv; + iov.iov_base = &byte; iov.iov_len = 1; msg.msg_iov = &iov; msg.msg_iovlen = 1; -- cgit v1.2.1 From 7338e602a26fa145af0f4e815ba098e7913aa7e3 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Wed, 27 Apr 2011 14:51:22 +0100 Subject: mkstemp: replace if system version uses wrong permissions * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Add test for non-owner read/write mode bits set in file created by mkstemp. * doc/posix-functions/mkstemp.texi (mkstemp): Document the fix. Signed-off-by: Eric Blake --- ChangeLog | 8 ++++++++ doc/posix-functions/mkstemp.texi | 8 ++++---- m4/mkstemp.m4 | 13 +++++++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1006b5f9a..377f326d62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-04-27 Reuben Thomas + and Eric Blake + + mkstemp: replace if system version uses wrong permissions + * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Add test for non-owner + read/write mode bits set in file created by mkstemp. + * doc/posix-functions/mkstemp.texi (mkstemp): Document the fix. + 2011-04-27 Eric Blake passfd: avoid compiler warning diff --git a/doc/posix-functions/mkstemp.texi b/doc/posix-functions/mkstemp.texi index 5a1e145600..5f62b44bc3 100644 --- a/doc/posix-functions/mkstemp.texi +++ b/doc/posix-functions/mkstemp.texi @@ -15,14 +15,14 @@ mingw. On some platforms (HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a silly limit that it can create no more than 26 files from a given template. On OSF/1 4.0f, it can create only 32 files per process. +@item +On some older platforms, @code{mkstemp} can create a world or group +writable or readable file, if you haven't set the process umask to +077. This is a security risk. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -On platforms other than glibc 2.0.7 or newer, @code{mkstemp} can create a -world or group writable or readable file, if you haven't set the process -umask to 077. This is a security risk. @end itemize The gnulib module clean-temp can create temporary files that are less diff --git a/m4/mkstemp.m4 b/m4/mkstemp.m4 index c5cd2820d1..06187c6c51 100644 --- a/m4/mkstemp.m4 +++ b/m4/mkstemp.m4 @@ -1,4 +1,4 @@ -#serial 19 +#serial 20 # Copyright (C) 2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -10,6 +10,8 @@ # Other systems lack mkstemp altogether. # On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create # only 32 files per process. +# On some hosts, mkstemp creates files with mode 0666, which is a security +# problem and a violation of POSIX 2008. # On systems like the above, arrange to use the replacement function. AC_DEFUN([gl_FUNC_MKSTEMP], [ @@ -30,6 +32,7 @@ AC_DEFUN([gl_FUNC_MKSTEMP], off_t large = (off_t) 4294967295u; if (large < 0) large = 2147483647; + umask (0); for (i = 0; i < 70; i++) { char templ[] = "conftest.mkstemp/coXXXXXX"; @@ -39,9 +42,15 @@ AC_DEFUN([gl_FUNC_MKSTEMP], result |= 1; else { + struct stat st; if (lseek (fd, large, SEEK_SET) != large) result |= 2; - close (fd); + if (fstat (fd, &st) < 0) + result |= 4; + else if (st.st_mode & 0077) + result |= 8; + if (close (fd)) + result |= 16; } } return result;]])], -- cgit v1.2.1 From 68af114f89e20660ddde4e03cbdc81396828fd23 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 26 Apr 2011 11:27:15 -0600 Subject: getcwd: tweak comments * m4/getcwd-abort-bug.m4: Fix comments. * m4/getcwd-path-max.m4: Likewise. * m4/getcwd.m4: Likewise. Signed-off-by: Eric Blake --- ChangeLog | 7 +++++++ m4/getcwd-abort-bug.m4 | 4 ++-- m4/getcwd-path-max.m4 | 4 ++-- m4/getcwd.m4 | 4 +++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 377f326d62..4760fedcb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-27 Eric Blake + + getcwd: tweak comments + * m4/getcwd-abort-bug.m4: Fix comments. + * m4/getcwd-path-max.m4: Likewise. + * m4/getcwd.m4: Likewise. + 2011-04-27 Reuben Thomas and Eric Blake diff --git a/m4/getcwd-abort-bug.m4 b/m4/getcwd-abort-bug.m4 index 21be828b62..f15181f089 100644 --- a/m4/getcwd-abort-bug.m4 +++ b/m4/getcwd-abort-bug.m4 @@ -1,4 +1,4 @@ -# serial 2 +# serial 3 # Determine whether getcwd aborts when the length of the working directory # name is unusually large. Any length between 4k and 16k trigger the bug # when using glibc-2.4.90-9 or older. @@ -58,7 +58,7 @@ main () size_t d; /* The bug is triggered when PATH_MAX < getpagesize (), so skip - this relative expensive and invasive test if that's not true. */ + this relatively expensive and invasive test if that's not true. */ if (getpagesize () <= PATH_MAX) return 0; diff --git a/m4/getcwd-path-max.m4 b/m4/getcwd-path-max.m4 index 2ab264501c..feb0d4dbf2 100644 --- a/m4/getcwd-path-max.m4 +++ b/m4/getcwd-path-max.m4 @@ -1,10 +1,10 @@ -# serial 15 +# serial 16 # Check for several getcwd bugs with long file names. # If so, arrange to compile the wrapper function. # This is necessary for at least GNU libc on linux-2.4.19 and 2.4.20. # I've heard that this is due to a Linux kernel bug, and that it has -# been fixed between 2.4.21-pre3 and 2.4.21-pre4. */ +# been fixed between 2.4.21-pre3 and 2.4.21-pre4. # Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation diff --git a/m4/getcwd.m4 b/m4/getcwd.m4 index 70980567d7..0c7e20c2e0 100644 --- a/m4/getcwd.m4 +++ b/m4/getcwd.m4 @@ -6,7 +6,7 @@ # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. -# serial 3 +# serial 4 AC_DEFUN([gl_FUNC_GETCWD_NULL], [ @@ -52,6 +52,8 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], ]])]) ]) +dnl Check for all known getcwd bugs; useful for a program likely to be +dnl executed from an arbitrary location. AC_DEFUN([gl_FUNC_GETCWD], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) -- cgit v1.2.1 From 043be67acb94a724f96e3b18c3a09aefffd463af Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 26 Apr 2011 14:40:58 -0600 Subject: getcwd-lgpl: new module For programs that aren't worried about being invoked from an current working directory longer than PATH_MAX (perhaps because the program always does chdir to a sane location first), the getcwd module is overkill, given that all modern portability targets have a getcwd that works on short names. * modules/getcwd-lgpl: New module. * lib/getcwd-lgpl.c: New file. * doc/posix-functions/getcwd.texi (getcwd): Document it. * MODULES.html.sh (lacking POSIX:2008): Likewise. * modules/getcwd (configure.ac): Set C witness. * m4/getcwd.m4 (gl_FUNC_GETCWD_LGPL): New macro. Signed-off-by: Eric Blake --- ChangeLog | 8 +++ MODULES.html.sh | 1 + doc/posix-functions/getcwd.texi | 13 +++-- lib/getcwd-lgpl.c | 118 ++++++++++++++++++++++++++++++++++++++++ m4/getcwd.m4 | 29 +++++++++- modules/getcwd | 1 + modules/getcwd-lgpl | 25 +++++++++ 7 files changed, 189 insertions(+), 6 deletions(-) create mode 100644 lib/getcwd-lgpl.c create mode 100644 modules/getcwd-lgpl diff --git a/ChangeLog b/ChangeLog index 4760fedcb1..b3d036ec35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2011-04-27 Eric Blake + getcwd-lgpl: new module + * modules/getcwd-lgpl: New module. + * lib/getcwd-lgpl.c: New file. + * doc/posix-functions/getcwd.texi (getcwd): Document it. + * MODULES.html.sh (lacking POSIX:2008): Likewise. + * modules/getcwd (configure.ac): Set C witness. + * m4/getcwd.m4 (gl_FUNC_GETCWD_LGPL): New macro. + getcwd: tweak comments * m4/getcwd-abort-bug.m4: Fix comments. * m4/getcwd-path-max.m4: Likewise. diff --git a/MODULES.html.sh b/MODULES.html.sh index 8d32a21258..a584c4ece5 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2353,6 +2353,7 @@ func_all_modules () func_module futimens func_module getaddrinfo func_module getcwd + func_module getcwd-lgpl func_module getgroups func_module gethostname func_module getlogin diff --git a/doc/posix-functions/getcwd.texi b/doc/posix-functions/getcwd.texi index 4d00af8955..a8dba967ec 100644 --- a/doc/posix-functions/getcwd.texi +++ b/doc/posix-functions/getcwd.texi @@ -4,15 +4,20 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getcwd.html} -Gnulib module: getcwd +Gnulib module: getcwd or getcwd-lgpl -Portability problems fixed by Gnulib: +Portability problems fixed by either Gnulib module @code{getcwd} or +@code{getcwd-lgpl}: @itemize @item -This function is missing on some older platforms. -@item On glibc platforms, @code{getcwd (NULL, n)} allocates memory for the result. On other platforms, this call is not allowed. +@end itemize + +Portability problems fixed by Gnulib module @code{getcwd}: +@itemize +@item +This function is missing on some older platforms. @item This function does not handle long file names (greater than @code{PATH_MAX}) correctly on some platforms. diff --git a/lib/getcwd-lgpl.c b/lib/getcwd-lgpl.c new file mode 100644 index 0000000000..a5596f8869 --- /dev/null +++ b/lib/getcwd-lgpl.c @@ -0,0 +1,118 @@ +/* Copyright (C) 2011 Free Software Foundation, Inc. + This file is part of gnulib. + + 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 . */ + +#include + +/* Specification */ +#include + +#include +#include + +#if GNULIB_GETCWD +/* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use. */ +typedef int dummy; +#else + +/* Get the name of the current working directory, and put it in SIZE + bytes of BUF. Returns NULL if the directory couldn't be determined + (perhaps because the absolute name was longer than PATH_MAX, or + because of missing read/search permissions on parent directories) + or SIZE was too small. If successful, returns BUF. If BUF is + NULL, an array is allocated with `malloc'; the array is SIZE bytes + long, unless SIZE == 0, in which case it is as big as + necessary. */ + +# undef getcwd +char * +rpl_getcwd (char *buf, size_t size) +{ + char *ptr; + char *result; + + /* Handle single size operations. */ + if (buf) + return getcwd (buf, size); + + if (size) + { + buf = malloc (size); + if (!buf) + { + errno = ENOMEM; + return -1; + } + result = getcwd (buf, size); + if (!result) + { + int saved_errno = errno; + free (buf); + errno = saved_errno; + } + return result; + } + + /* Flexible sizing requested. Avoid over-allocation for the common + case of a name that fits within a 4k page, minus some space for + local variables, to be sure we don't skip over a guard page. */ + { + char tmp[4032]; + size = sizeof tmp; + ptr = getcwd (tmp, size); + if (ptr) + { + result = strdup (ptr); + if (!result) + errno = ENOMEM; + return result; + } + if (errno != ERANGE) + return NULL; + } + + /* My what a large directory name we have. */ + do + { + size <<= 1; + ptr = realloc (buf, size); + if (ptr == NULL) + { + free (buf); + errno = ENOMEM; + return NULL; + } + buf = ptr; + result = getcwd (buf, size); + } + while (!result && errno == ERANGE); + + if (!result) + { + int saved_errno = errno; + free (buf); + errno = saved_errno; + } + else + { + /* Trim to fit, if possible. */ + result = realloc (buf, strlen (buf) + 1); + if (!result) + result = buf; + } + return result; +} + +#endif diff --git a/m4/getcwd.m4 b/m4/getcwd.m4 index 0c7e20c2e0..55f937222b 100644 --- a/m4/getcwd.m4 +++ b/m4/getcwd.m4 @@ -6,10 +6,11 @@ # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. -# serial 4 +# serial 5 AC_DEFUN([gl_FUNC_GETCWD_NULL], [ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result], [gl_cv_func_getcwd_null], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ @@ -52,6 +53,29 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], ]])]) ]) + +dnl Guarantee that getcwd will malloc with a NULL first argument. Assumes +dnl that either the system getcwd is robust, or that calling code is okay +dnl with spurious failures when run from a directory with an absolute name +dnl larger than 4k bytes. +dnl +dnl Assumes that getcwd exists; if you are worried about obsolete +dnl platforms that lacked getcwd(), then you need to use the GPL module. +AC_DEFUN([gl_FUNC_GETCWD_LGPL], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_GETCWD_NULL]) + + case $gl_cv_func_getcwd_null in + *yes) ;; + *) + dnl Minimal replacement + REPLACE_GETCWD=1 + AC_LIBOBJ([getcwd-lgpl]) + ;; + esac +]) + dnl Check for all known getcwd bugs; useful for a program likely to be dnl executed from an arbitrary location. AC_DEFUN([gl_FUNC_GETCWD], @@ -72,13 +96,14 @@ AC_DEFUN([gl_FUNC_GETCWD], case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max,$gl_abort_bug in *yes,yes,no) ;; *) + dnl Full replacement, overrides LGPL replacement. REPLACE_GETCWD=1 AC_LIBOBJ([getcwd]) gl_PREREQ_GETCWD;; esac ]) -# Prerequisites of lib/getcwd.c. +# Prerequisites of lib/getcwd.c, when full replacement is in effect. AC_DEFUN([gl_PREREQ_GETCWD], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) diff --git a/modules/getcwd b/modules/getcwd index 108f14b28a..27ec25a458 100644 --- a/modules/getcwd +++ b/modules/getcwd @@ -20,6 +20,7 @@ strdup-posix configure.ac: gl_FUNC_GETCWD +gl_MODULE_INDICATOR([getcwd]) gl_UNISTD_MODULE_INDICATOR([getcwd]) Makefile.am: diff --git a/modules/getcwd-lgpl b/modules/getcwd-lgpl new file mode 100644 index 0000000000..1b9c87bf50 --- /dev/null +++ b/modules/getcwd-lgpl @@ -0,0 +1,25 @@ +Description: +Ensure getcwd(NULL, 0) returns a buffer allocated by malloc(). + +Files: +lib/getcwd-lgpl.c +m4/getcwd.m4 + +Depends-on: +strdup +unistd + +configure.ac: +gl_FUNC_GETCWD_LGPL +gl_UNISTD_MODULE_INDICATOR([getcwd]) + +Makefile.am: + +Include: + + +License: +LGPLv2+ + +Maintainer: +Eric Blake -- cgit v1.2.1 From 02923aada23a2fa2122b415f313730f2e5e266ec Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 26 Apr 2011 14:51:24 -0600 Subject: getcwd: enhance tests The existing getcwd was weak, and only tested things guaranteed by the new getcwd-lgpl. Move those tests into a new file and strengthen them slightly (such as guaranteeing the ERANGE error for a non-zero but too-small size). Then copy the m4 tests for PATH_MAX failures into the GPL getcwd tests, to prove that our replacement really is fixing the things that cause us to reject the system getcwd as non-robust. * tests/test-getcwd-lgpl.c: New file, taken from... * tests/test-getcwd.c: ...old contents. Rewrite this file to repeat long path stress tests from m4 probe. * modules/getcwd-lgpl-tests: New module. * modules/getcwd-tests (Depends-on): Depend on lgpl tests. * m4/getcwd-abort-bug.m4: Update comment. * m4/getcwd-path-max.m4: Likewise. Signed-off-by: Eric Blake --- ChangeLog | 11 +++ m4/getcwd-abort-bug.m4 | 1 + m4/getcwd-path-max.m4 | 1 + modules/getcwd-lgpl-tests | 12 +++ modules/getcwd-tests | 6 +- tests/test-getcwd-lgpl.c | 87 ++++++++++++++++++ tests/test-getcwd.c | 222 ++++++++++++++++++++++++++++++++++++++-------- 7 files changed, 299 insertions(+), 41 deletions(-) create mode 100644 modules/getcwd-lgpl-tests create mode 100644 tests/test-getcwd-lgpl.c diff --git a/ChangeLog b/ChangeLog index b3d036ec35..8cef5ecf43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-04-26 Eric Blake + + getcwd: enhance tests + * tests/test-getcwd-lgpl.c: New file, taken from... + * tests/test-getcwd.c: ...old contents. Rewrite this file to + repeat long path stress tests from m4 probe. + * modules/getcwd-lgpl-tests: New module. + * modules/getcwd-tests (Depends-on): Depend on lgpl tests. + * m4/getcwd-abort-bug.m4: Update comment. + * m4/getcwd-path-max.m4: Likewise. + 2011-04-27 Eric Blake getcwd-lgpl: new module diff --git a/m4/getcwd-abort-bug.m4 b/m4/getcwd-abort-bug.m4 index f15181f089..0b59a6bf21 100644 --- a/m4/getcwd-abort-bug.m4 +++ b/m4/getcwd-abort-bug.m4 @@ -21,6 +21,7 @@ AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG], rm -rf confdir-14B--- # Arrange for deletion of the temporary directory this test creates. ac_clean_files="$ac_clean_files confdir-14B---" + dnl Please keep this in sync with tests/test-getcwd.c. AC_RUN_IFELSE( [AC_LANG_SOURCE( [[ diff --git a/m4/getcwd-path-max.m4 b/m4/getcwd-path-max.m4 index feb0d4dbf2..475ae96d16 100644 --- a/m4/getcwd-path-max.m4 +++ b/m4/getcwd-path-max.m4 @@ -21,6 +21,7 @@ AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX], gl_cv_func_getcwd_path_max, [# Arrange for deletion of the temporary directory this test creates. ac_clean_files="$ac_clean_files confdir3" + dnl Please keep this in sync with tests/test-getcwd.c. AC_RUN_IFELSE( [AC_LANG_SOURCE( [[ diff --git a/modules/getcwd-lgpl-tests b/modules/getcwd-lgpl-tests new file mode 100644 index 0000000000..07fdf73d5c --- /dev/null +++ b/modules/getcwd-lgpl-tests @@ -0,0 +1,12 @@ +Files: +tests/test-getcwd-lgpl.c +tests/signature.h +tests/macros.h + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-getcwd-lgpl +check_PROGRAMS += test-getcwd-lgpl diff --git a/modules/getcwd-tests b/modules/getcwd-tests index 016961fc71..2187acc75f 100644 --- a/modules/getcwd-tests +++ b/modules/getcwd-tests @@ -1,9 +1,11 @@ Files: tests/test-getcwd.c -tests/signature.h -tests/macros.h Depends-on: +errno +fcntl-h +getcwd-lgpl +sys_stat configure.ac: diff --git a/tests/test-getcwd-lgpl.c b/tests/test-getcwd-lgpl.c new file mode 100644 index 0000000000..67ee66d539 --- /dev/null +++ b/tests/test-getcwd-lgpl.c @@ -0,0 +1,87 @@ +/* Test of getcwd() function. + Copyright (C) 2009-2011 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 . */ + +#include + +#include + +#include "signature.h" +SIGNATURE_CHECK (getcwd, char *, (char *, size_t)); + +#include +#include +#include +#include + +#include "macros.h" + +int +main (int argc, char **argv) +{ + char *pwd1; + char *pwd2; + /* If the user provides an argument, attempt to chdir there first. */ + if (1 < argc) + { + if (chdir (argv[1]) == 0) + printf ("changed to directory %s\n", argv[1]); + } + + pwd1 = getcwd (NULL, 0); + ASSERT (pwd1 && *pwd1); + if (1 < argc) + printf ("cwd=%s\n", pwd1); + + /* Make sure the result is usable. */ + ASSERT (chdir (pwd1) == 0); + ASSERT (chdir (".//./.") == 0); + + /* Make sure that result is normalized. */ + pwd2 = getcwd (NULL, 0); + ASSERT (pwd2); + ASSERT (strcmp (pwd1, pwd2) == 0); + free (pwd2); + { + size_t len = strlen (pwd1); + ssize_t i = len - 10; + if (i < 1) + i = 1; + pwd2 = getcwd (NULL, len + 1); + ASSERT (pwd2); + free (pwd2); + pwd2 = malloc (len + 2); + for ( ; i <= len; i++) + { + errno = 0; + ASSERT (getcwd (pwd2, i) == NULL); + ASSERT (errno == ERANGE); + errno = 0; + ASSERT (getcwd (NULL, i) == NULL); + ASSERT (errno == ERANGE); + } + ASSERT (getcwd (pwd2, len + 1) == pwd2); + pwd2[len] = '/'; + pwd2[len + 1] = '\0'; + } + ASSERT (strstr (pwd2, "/./") == NULL); + ASSERT (strstr (pwd2, "/../") == NULL); + ASSERT (strstr (pwd2 + 1 + (pwd2[1] == '/'), "//") == NULL); + + free (pwd1); + free (pwd2); + + return 0; +} diff --git a/tests/test-getcwd.c b/tests/test-getcwd.c index 18fc74f94b..0e0f90f241 100644 --- a/tests/test-getcwd.c +++ b/tests/test-getcwd.c @@ -18,59 +18,203 @@ #include -#include "signature.h" -SIGNATURE_CHECK (getcwd, char *, (char *, size_t)); - +#include +#include +#include #include #include #include +#include #include "macros.h" -int -main (int argc, char **argv) +#if ! HAVE_GETPAGESIZE +# define getpagesize() 0 +#endif + +/* This size is chosen to be larger than PATH_MAX (4k), yet smaller than + the 16kB pagesize on ia64 linux. Those conditions make the code below + trigger a bug in glibc's getcwd implementation before 2.4.90-10. */ +#define TARGET_LEN (5 * 1024) + +/* Keep this test in sync with m4/getcwd-abort-bug.m4. */ +static int +test_abort_bug (void) { - char *pwd1; - char *pwd2; - /* If the user provides an argument, attempt to chdir there first. */ - if (1 < argc) + char const *dir_name = "confdir-14B---"; + char *cwd; + size_t initial_cwd_len; + int fail = 0; + size_t desired_depth; + size_t d; + + /* The bug is triggered when PATH_MAX < getpagesize (), so skip + this relatively expensive and invasive test if that's not true. */ + if (getpagesize () <= PATH_MAX) + return 0; + + cwd = getcwd (NULL, 0); + if (cwd == NULL) + return 0; + + initial_cwd_len = strlen (cwd); + free (cwd); + desired_depth = ((TARGET_LEN - 1 - initial_cwd_len) + / (1 + strlen (dir_name))); + for (d = 0; d < desired_depth; d++) + { + if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0) + { + fail = 3; /* Unable to construct deep hierarchy. */ + break; + } + } + + /* If libc has the bug in question, this invocation of getcwd + results in a failed assertion. */ + cwd = getcwd (NULL, 0); + if (cwd == NULL) + fail = 4; /* getcwd failed. This is ok, and expected. */ + free (cwd); + + /* Call rmdir first, in case the above chdir failed. */ + rmdir (dir_name); + while (0 < d--) { - if (chdir (argv[1]) == 0) - printf ("changed to directory %s\n", argv[1]); + if (chdir ("..") < 0) + break; + rmdir (dir_name); } - pwd1 = getcwd (NULL, 0); - ASSERT (pwd1 && *pwd1); - if (1 < argc) - printf ("cwd=%s\n", pwd1); + return 0; +} - /* Make sure the result is usable. */ - ASSERT (chdir (pwd1) == 0); - ASSERT (chdir ("././.") == 0); +/* The length of this name must be 8. */ +#define DIR_NAME "confdir3" +#define DIR_NAME_LEN 8 +#define DIR_NAME_SIZE (DIR_NAME_LEN + 1) - /* Make sure that result is normalized. */ - pwd2 = getcwd (NULL, 0); - ASSERT (pwd2); - ASSERT (strcmp (pwd1, pwd2) == 0); - free (pwd2); +/* The length of "../". */ +#define DOTDOTSLASH_LEN 3 + +/* Leftover bytes in the buffer, to work around library or OS bugs. */ +#define BUF_SLOP 20 + +/* Keep this test in sync with m4/getcwd-path-max.m4. */ +static int +test_long_name (void) +{ +#ifndef PATH_MAX + /* The Hurd doesn't define this, so getcwd can't exhibit the bug -- + at least not on a local file system. And if we were to start worrying + about remote file systems, we'd have to enable the wrapper function + all of the time, just to be safe. That's not worth the cost. */ + return 0; +#elif ((INT_MAX / (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) \ + - DIR_NAME_SIZE - BUF_SLOP) \ + <= PATH_MAX) + /* FIXME: Assuming there's a system for which this is true, + this should be done in a compile test. */ + return 0; +#else + char buf[PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) + + DIR_NAME_SIZE + BUF_SLOP]; + char *cwd = getcwd (buf, PATH_MAX); + size_t initial_cwd_len; + size_t cwd_len; + int fail = 0; + size_t n_chdirs = 0; + + if (cwd == NULL) + return 10; + + cwd_len = initial_cwd_len = strlen (cwd); + + while (1) + { + size_t dotdot_max = PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN); + char *c = NULL; + + cwd_len += DIR_NAME_SIZE; + /* If mkdir or chdir fails, it could be that this system cannot create + any file with an absolute name longer than PATH_MAX, such as cygwin. + If so, leave fail as 0, because the current working directory can't + be too long for getcwd if it can't even be created. For other + errors, be pessimistic and consider that as a failure, too. */ + if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0) + { + if (! (errno == ERANGE || errno == ENAMETOOLONG)) + fail = 20; + break; + } + + if (PATH_MAX <= cwd_len && cwd_len < PATH_MAX + DIR_NAME_SIZE) + { + c = getcwd (buf, PATH_MAX); + if (!c && errno == ENOENT) + { + fail = 11; + break; + } + if (c || ! (errno == ERANGE || errno == ENAMETOOLONG)) + { + fail = 21; + break; + } + } + + if (dotdot_max <= cwd_len - initial_cwd_len) + { + if (dotdot_max + DIR_NAME_SIZE < cwd_len - initial_cwd_len) + break; + c = getcwd (buf, cwd_len + 1); + if (!c) + { + if (! (errno == ERANGE || errno == ENOENT + || errno == ENAMETOOLONG)) + { + fail = 22; + break; + } + if (AT_FDCWD || errno == ERANGE || errno == ENOENT) + { + fail = 12; + break; + } + } + } + + if (c && strlen (c) != cwd_len) + { + fail = 23; + break; + } + ++n_chdirs; + } + + /* Leaving behind such a deep directory is not polite. + So clean up here, right away, even though the driving + shell script would also clean up. */ { - size_t len = strlen (pwd1); - ssize_t i = len - 10; - if (i < 0) - i = 0; - pwd2 = malloc (len + 2); - for ( ; i < len; i++) - ASSERT (getcwd (pwd2, i) == NULL); - pwd2 = getcwd (pwd2, len + 1); - ASSERT (pwd2); - pwd2[len] = '/'; - pwd2[len + 1] = '\0'; + size_t i; + + /* Try rmdir first, in case the chdir failed. */ + rmdir (DIR_NAME); + for (i = 0; i <= n_chdirs; i++) + { + if (chdir ("..") < 0) + break; + if (rmdir (DIR_NAME) != 0) + break; + } } - ASSERT (strstr (pwd2, "/./") == NULL); - ASSERT (strstr (pwd2, "/../") == NULL); - free (pwd1); - free (pwd2); + return fail; +#endif +} - return 0; +int +main (int argc, char **argv) +{ + return test_abort_bug () + test_long_name (); } -- cgit v1.2.1 From 0c631b51b5f5908decfb7c0da1f94715d6b66c33 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 26 Apr 2011 15:07:07 -0600 Subject: save-cwd: reduce default dependency save-cwd generally needs only a working fchdir or a working getcwd(NULL,0). If you are not worried about directories whose absolute name is longer than PATH_MAX, then reducing the default dependencies reduces the bulk for this module. However, there are cases where neither function works on Linux (an unreadable but searchable directory can be opened by O_SEARCH, except that Linux doesn't implement that yet; and Linux getcwd() has issues with long absolute names which glibc does not work around but which the full-blown getcwd module does). So someone desiring a truly robust solution needs to import the 'getcwd' module at the same time as 'save-cwd'. * modules/save-cwd (Depends-on): Use getcwd-lgpl. * lib/save-cwd.c: Update comments. * NEWS: Document the semantic change. Signed-off-by: Eric Blake --- ChangeLog | 9 ++++++--- NEWS | 5 +++++ lib/save-cwd.c | 3 ++- modules/save-cwd | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cef5ecf43..2b6b0639cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2011-04-26 Eric Blake +2011-04-27 Eric Blake + + save-cwd: reduce default dependency + * modules/save-cwd (Depends-on): Use getcwd-lgpl. + * lib/save-cwd.c: Update comments. + * NEWS: Document the semantic change. getcwd: enhance tests * tests/test-getcwd-lgpl.c: New file, taken from... @@ -9,8 +14,6 @@ * m4/getcwd-abort-bug.m4: Update comment. * m4/getcwd-path-max.m4: Likewise. -2011-04-27 Eric Blake - getcwd-lgpl: new module * modules/getcwd-lgpl: New module. * lib/getcwd-lgpl.c: New file. diff --git a/NEWS b/NEWS index 7dd126dac6..5081dbaa82 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,11 @@ User visible incompatible changes Date Modules Changes +2011-04-27 save-cwd This module pulls in fewer dependencies by + default; to retain robust handling of directories + with an absolute name longer than PATH_MAX, you + must now explicitly include the 'getcwd' module. + 2011-04-19 close-hook This module has been renamed to 'fd-hook' and generalized. diff --git a/lib/save-cwd.c b/lib/save-cwd.c index 16ffa2c490..5f8eb7ca53 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -50,7 +50,8 @@ The `raison d'etre' for this interface is that the working directory is sometimes inaccessible, and getcwd is not robust or as efficient. So, we prefer to use the open/fchdir approach, but fall back on - getcwd if necessary. + getcwd if necessary. This module works for most cases with just + the getcwd-lgpl module, but to be truly robust, use the getcwd module. Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin, SCO Xenix. Also, SunOS 4 and Irix 5.3 provide the function, yet it diff --git a/modules/save-cwd b/modules/save-cwd index 02a0723391..974b5962c1 100644 --- a/modules/save-cwd +++ b/modules/save-cwd @@ -9,7 +9,7 @@ m4/save-cwd.m4 Depends-on: chdir-long cloexec -getcwd +getcwd-lgpl fchdir stdbool unistd-safer -- cgit v1.2.1 From a2772ebc9c45666f0e61508bbc564373bf0fe7e0 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 26 Apr 2011 15:23:23 -0600 Subject: tests: reduce dependencies We can assume that tests won't be run from a directory with an absolute name longer than native getcwd limits. * tests/test-linkat.c (main): Use lighter-weight getcwd. * tests/test-renameat.c (main): Likewise. * modules/linkat-tests (Depends-on): Relax dependency. * modules/renameat-tests (Depends-on): Likewise. * modules/fchdir-tests (Depends-on): Likewise. Also make cloexec dependency explicit. Signed-off-by: Eric Blake --- ChangeLog | 8 ++++++++ modules/fchdir-tests | 3 ++- modules/linkat-tests | 2 +- modules/renameat-tests | 2 +- tests/test-linkat.c | 4 ++-- tests/test-renameat.c | 4 ++-- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b6b0639cf..ada7e9813f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2011-04-27 Eric Blake + tests: reduce dependencies + * tests/test-linkat.c (main): Use lighter-weight getcwd. + * tests/test-renameat.c (main): Likewise. + * modules/linkat-tests (Depends-on): Relax dependency. + * modules/renameat-tests (Depends-on): Likewise. + * modules/fchdir-tests (Depends-on): Likewise. Also make cloexec + dependency explicit. + save-cwd: reduce default dependency * modules/save-cwd (Depends-on): Use getcwd-lgpl. * lib/save-cwd.c: Update comments. diff --git a/modules/fchdir-tests b/modules/fchdir-tests index 462e709211..8f82dcee43 100644 --- a/modules/fchdir-tests +++ b/modules/fchdir-tests @@ -4,7 +4,8 @@ tests/signature.h tests/macros.h Depends-on: -getcwd +cloexec +getcwd-lgpl configure.ac: diff --git a/modules/linkat-tests b/modules/linkat-tests index 6df4781973..c49c1b324a 100644 --- a/modules/linkat-tests +++ b/modules/linkat-tests @@ -8,9 +8,9 @@ Depends-on: ignore-value areadlink-with-size filenamecat +getcwd-lgpl progname same-inode -xgetcwd configure.ac: diff --git a/modules/renameat-tests b/modules/renameat-tests index dcef7c19d0..9e7b337d79 100644 --- a/modules/renameat-tests +++ b/modules/renameat-tests @@ -7,8 +7,8 @@ tests/macros.h Depends-on: ignore-value filenamecat +getcwd-lgpl progname -xgetcwd configure.ac: diff --git a/tests/test-linkat.c b/tests/test-linkat.c index 8d179e2faf..e3c8a5e1d4 100644 --- a/tests/test-linkat.c +++ b/tests/test-linkat.c @@ -34,7 +34,6 @@ SIGNATURE_CHECK (linkat, int, (int, char const *, int, char const *, int)); #include "areadlink.h" #include "filenamecat.h" #include "same-inode.h" -#include "xgetcwd.h" #include "ignore-value.h" #include "macros.h" @@ -119,7 +118,8 @@ main (void) ASSERT (mkdir (BASE "sub1", 0700) == 0); ASSERT (mkdir (BASE "sub2", 0700) == 0); ASSERT (close (creat (BASE "00", 0600)) == 0); - cwd = xgetcwd (); + cwd = getcwd (NULL, 0); + ASSERT (cwd); dfd = open (BASE "sub1", O_RDONLY); ASSERT (0 <= dfd); diff --git a/tests/test-renameat.c b/tests/test-renameat.c index 1849a24413..96fe3a7555 100644 --- a/tests/test-renameat.c +++ b/tests/test-renameat.c @@ -33,7 +33,6 @@ SIGNATURE_CHECK (renameat, int, (int, char const *, int, char const *)); #include #include "filenamecat.h" -#include "xgetcwd.h" #include "ignore-value.h" #include "macros.h" @@ -79,7 +78,8 @@ main (void) dfd = creat (BASE "00", 0600); ASSERT (0 <= dfd); ASSERT (close (dfd) == 0); - cwd = xgetcwd (); + cwd = getcwd (NULL, 0); + ASSERT (cwd); dfd = open (BASE "sub1", O_RDONLY); ASSERT (0 <= dfd); -- cgit v1.2.1 From cb6acd4a71b0ffbde09d0a8f05d5615488024f58 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 26 Apr 2011 15:31:21 -0600 Subject: linkat, renameat: add missing dependency * modules/linkat (Depends-on): Require getcwd-lgpl. * modules/renameat (Depends-on): Likewise. Signed-off-by: Eric Blake --- ChangeLog | 4 ++++ modules/linkat | 1 + modules/renameat | 1 + 3 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index ada7e9813f..f6e7fa4f21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-04-27 Eric Blake + linkat, renameat: add missing dependency + * modules/linkat (Depends-on): Require getcwd-lgpl. + * modules/renameat (Depends-on): Likewise. + tests: reduce dependencies * tests/test-linkat.c (main): Use lighter-weight getcwd. * tests/test-renameat.c (main): Likewise. diff --git a/modules/linkat b/modules/linkat index 53e2a071e2..2d7a2dfed5 100644 --- a/modules/linkat +++ b/modules/linkat @@ -14,6 +14,7 @@ errno extensions fcntl-h filenamecat-lgpl +getcwd-lgpl openat link link-follow diff --git a/modules/renameat b/modules/renameat index 14de04a021..22bb6505b8 100644 --- a/modules/renameat +++ b/modules/renameat @@ -10,6 +10,7 @@ Depends-on: extensions fcntl-h filenamecat-lgpl +getcwd-lgpl openat rename same-inode -- cgit v1.2.1 From 59680ace35de01c8c3df5299b78ab14f15e3712a Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 26 Apr 2011 15:53:35 -0600 Subject: filenamecat-lgpl: fix licence http://lists.gnu.org/archive/html/bug-gnulib/2009-10/msg00299.html talked about splitting out LGPLv2+ portions of existing modules. * modules/filenamecat-lgpl (License): Mark as LGPLv2+, as intended when it was first created. Signed-off-by: Eric Blake --- ChangeLog | 4 ++++ modules/filenamecat-lgpl | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f6e7fa4f21..4e1839b28f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-04-27 Eric Blake + filenamecat-lgpl: fix licence + * modules/filenamecat-lgpl (License): Mark as LGPLv2+, as intended + when it was first created. + linkat, renameat: add missing dependency * modules/linkat (Depends-on): Require getcwd-lgpl. * modules/renameat (Depends-on): Likewise. diff --git a/modules/filenamecat-lgpl b/modules/filenamecat-lgpl index a7449334d2..4dd39933b1 100644 --- a/modules/filenamecat-lgpl +++ b/modules/filenamecat-lgpl @@ -18,7 +18,7 @@ Include: "filenamecat.h" License: -GPL +LGPLv2+ Maintainer: Jim Meyering -- cgit v1.2.1 From 825499de077435754651ff49b3f3dba576a2ebc6 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 26 Apr 2011 15:58:03 -0600 Subject: fchdir: avoid extra chdir and fix test On Linux, with a forced ac_cv_func_fchdir=no, the test failed because dup2 was not replaced, all because the shell variable ac_cv_func_dup2 had not been set yet. Meanwhile, computing the canonical pathname of a directory on mingw was rather expensive -- multiple chdir()! -- but nothing cared whether the name was canonical, just that it was absolute. * modules/fchdir (Depends-on): Add dosname, filenamecat-lgpl, getcwd-lgpl. * lib/fchdir.c (get_name): Any absolute name will do; it does not have to be canonical. * m4/dup2.m4 (gl_REPLACE_DUP2): Ensure dup2 is replaced. Signed-off-by: Eric Blake --- ChangeLog | 8 ++++++++ lib/fchdir.c | 54 +++++++++++++++++++----------------------------------- m4/dup2.m4 | 1 + modules/fchdir | 3 +++ 4 files changed, 31 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e1839b28f..2dbf3cfa8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2011-04-27 Eric Blake + fchdir: avoid extra chdir and fix test + * modules/fchdir (Depends-on): Add dosname, filenamecat-lgpl, + getcwd-lgpl. + * lib/fchdir.c (get_name): Any absolute name will do; it does not + have to be canonical. + (canonicalize_file_name): Drop unused macro. + * m4/dup2.m4 (gl_REPLACE_DUP2): Ensure dup2 is replaced. + filenamecat-lgpl: fix licence * modules/filenamecat-lgpl (License): Mark as LGPLv2+, as intended when it was first created. diff --git a/lib/fchdir.c b/lib/fchdir.c index 94c4e71871..6dd704f625 100644 --- a/lib/fchdir.c +++ b/lib/fchdir.c @@ -29,19 +29,13 @@ #include #include +#include "dosname.h" +#include "filenamecat.h" + #ifndef REPLACE_OPEN_DIRECTORY # define REPLACE_OPEN_DIRECTORY 0 #endif -#ifndef HAVE_CANONICALIZE_FILE_NAME -# if GNULIB_CANONICALIZE || GNULIB_CANONICALIZE_LGPL -# define HAVE_CANONICALIZE_FILE_NAME 1 -# else -# define HAVE_CANONICALIZE_FILE_NAME 0 -# define canonicalize_file_name(name) NULL -# endif -#endif - /* This replacement assumes that a directory is not renamed while opened through a file descriptor. @@ -90,36 +84,26 @@ ensure_dirs_slot (size_t fd) return true; } -/* Return the canonical name of DIR in malloc'd storage. */ +/* Return an absolute name of DIR in malloc'd storage. */ static char * get_name (char const *dir) { + char *cwd; char *result; - if (REPLACE_OPEN_DIRECTORY || !HAVE_CANONICALIZE_FILE_NAME) - { - /* The function canonicalize_file_name has not yet been ported - to mingw, with all its drive letter and backslash quirks. - Fortunately, getcwd is reliable in this case, but we ensure - we can get back to where we started before using it. Treat - "." as a special case, as it is frequently encountered. */ - char *cwd = getcwd (NULL, 0); - int saved_errno; - if (dir[0] == '.' && dir[1] == '\0') - return cwd; - if (chdir (cwd)) - return NULL; - result = chdir (dir) ? NULL : getcwd (NULL, 0); - saved_errno = errno; - if (chdir (cwd)) - abort (); - free (cwd); - errno = saved_errno; - } - else - { - /* Avoid changing the directory. */ - result = canonicalize_file_name (dir); - } + int saved_errno; + + if (IS_ABSOLUTE_FILE_NAME (dir)) + return strdup (dir); + + /* We often encounter "."; treat it as a special case. */ + cwd = getcwd (NULL, 0); + if (!cwd || (dir[0] == '.' && dir[1] == '\0')) + return cwd; + + result = mfile_name_concat (cwd, dir, NULL); + saved_errno = errno; + free (cwd); + errno = saved_errno; return result; } diff --git a/m4/dup2.m4 b/m4/dup2.m4 index b8794c27b0..62e31a88d5 100644 --- a/m4/dup2.m4 +++ b/m4/dup2.m4 @@ -69,6 +69,7 @@ AC_DEFUN([gl_FUNC_DUP2], AC_DEFUN([gl_REPLACE_DUP2], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([dup2]) if test $ac_cv_func_dup2 = yes; then REPLACE_DUP2=1 fi diff --git a/modules/fchdir b/modules/fchdir index 46b481fd14..0a3ab9926b 100644 --- a/modules/fchdir +++ b/modules/fchdir @@ -9,9 +9,12 @@ Depends-on: close dirent dirfd +dosname dup2 fcntl fcntl-h +filenamecat-lgpl +getcwd-lgpl include_next malloc-posix open -- cgit v1.2.1 From 5ea8bedd0c6a7a8f29dcff301d126b58cc123ea8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 27 Apr 2011 23:28:48 +0200 Subject: clean-temp: Clarify what it does. * lib/clean-temp.h: Add more comments. * doc/posix-functions/mkstemp.texi: Tweak reference to 'clean-temp' module. * doc/glibc-functions/mkostemp.texi: Mention 'clean-temp' here too. * doc/glibc-functions/mkstemps.texi: Likewise. * doc/glibc-functions/mkostemps.texi: Likewise. --- ChangeLog | 10 ++++++++++ doc/glibc-functions/mkostemp.texi | 3 +++ doc/glibc-functions/mkostemps.texi | 3 +++ doc/glibc-functions/mkstemps.texi | 3 +++ doc/posix-functions/mkstemp.texi | 4 ++-- lib/clean-temp.h | 8 ++++++-- 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2dbf3cfa8d..6dcaa38f89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-04-27 Bruno Haible + + clean-temp: Clarify what it does. + * lib/clean-temp.h: Add more comments. + * doc/posix-functions/mkstemp.texi: Tweak reference to 'clean-temp' + module. + * doc/glibc-functions/mkostemp.texi: Mention 'clean-temp' here too. + * doc/glibc-functions/mkstemps.texi: Likewise. + * doc/glibc-functions/mkostemps.texi: Likewise. + 2011-04-27 Eric Blake fchdir: avoid extra chdir and fix test diff --git a/doc/glibc-functions/mkostemp.texi b/doc/glibc-functions/mkostemp.texi index ff1db30817..44e3ab3138 100644 --- a/doc/glibc-functions/mkostemp.texi +++ b/doc/glibc-functions/mkostemp.texi @@ -15,3 +15,6 @@ IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11, Cygwin 1.7.5, mingw, Interix 3.5, BeOS. Portability problems not fixed by Gnulib: @itemize @end itemize + +The gnulib module @code{clean-temp} can create temporary files that will not +be left behind after signals such as SIGINT. diff --git a/doc/glibc-functions/mkostemps.texi b/doc/glibc-functions/mkostemps.texi index b847fae925..033d462c77 100644 --- a/doc/glibc-functions/mkostemps.texi +++ b/doc/glibc-functions/mkostemps.texi @@ -15,3 +15,6 @@ glibc 2.10, MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX Portability problems not fixed by Gnulib: @itemize @end itemize + +The gnulib module @code{clean-temp} can create temporary files that will not +be left behind after signals such as SIGINT. diff --git a/doc/glibc-functions/mkstemps.texi b/doc/glibc-functions/mkstemps.texi index a321a49800..2c49d410c0 100644 --- a/doc/glibc-functions/mkstemps.texi +++ b/doc/glibc-functions/mkstemps.texi @@ -15,3 +15,6 @@ glibc 2.10, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin Portability problems not fixed by Gnulib: @itemize @end itemize + +The gnulib module @code{clean-temp} can create temporary files that will not +be left behind after signals such as SIGINT. diff --git a/doc/posix-functions/mkstemp.texi b/doc/posix-functions/mkstemp.texi index 5f62b44bc3..60e83e99f7 100644 --- a/doc/posix-functions/mkstemp.texi +++ b/doc/posix-functions/mkstemp.texi @@ -25,5 +25,5 @@ Portability problems not fixed by Gnulib: @itemize @end itemize -The gnulib module clean-temp can create temporary files that are less -likely to be left behind on signals such as SIGINT. +The gnulib module @code{clean-temp} can create temporary files that will not +be left behind after signals such as SIGINT. diff --git a/lib/clean-temp.h b/lib/clean-temp.h index 07c45ab22d..cac0702065 100644 --- a/lib/clean-temp.h +++ b/lib/clean-temp.h @@ -1,5 +1,5 @@ /* Temporary directories and temporary files with automatic cleanup. - Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2006, 2011 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify @@ -39,7 +39,11 @@ extern "C" { This module provides support for temporary directories and temporary files inside these temporary directories. Temporary files without temporary - directories are not supported here. */ + directories are not supported here. The temporary directories and files + are automatically cleaned up (at the latest) when the program exits or + dies from a fatal signal such as SIGINT, SIGTERM, SIGHUP, but not if it + dies from a fatal signal such as SIGQUIT, SIGKILL, or SIGABRT, SIGSEGV, + SIGBUS, SIGILL, SIGFPE, */ struct temp_dir { -- cgit v1.2.1 From 339c0f63b95d5064e47612a5b5fbba93f262b40e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 27 Apr 2011 23:42:27 +0200 Subject: mkstemp: Tweak configure message when cross-compiling. * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): When cross-compiling, qualify the result as a guess. --- ChangeLog | 6 ++++++ m4/mkstemp.m4 | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6dcaa38f89..a57d1dae82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-27 Bruno Haible + + mkstemp: Tweak configure message when cross-compiling. + * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): When cross-compiling, qualify the + result as a guess. + 2011-04-27 Bruno Haible clean-temp: Clarify what it does. diff --git a/m4/mkstemp.m4 b/m4/mkstemp.m4 index 06187c6c51..0437f14e31 100644 --- a/m4/mkstemp.m4 +++ b/m4/mkstemp.m4 @@ -56,10 +56,10 @@ AC_DEFUN([gl_FUNC_MKSTEMP], return result;]])], [gl_cv_func_working_mkstemp=yes], [gl_cv_func_working_mkstemp=no], - [gl_cv_func_working_mkstemp=no]) + [gl_cv_func_working_mkstemp="guessing no"]) rm -rf conftest.mkstemp ]) - if test $gl_cv_func_working_mkstemp != yes; then + if test "$gl_cv_func_working_mkstemp" != yes; then REPLACE_MKSTEMP=1 AC_LIBOBJ([mkstemp]) gl_PREREQ_MKSTEMP -- cgit v1.2.1 From e57376fc224a9a5d9a30938cb9b53231d4eeaafc Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 28 Apr 2011 00:05:08 +0200 Subject: mkstemp: More documentation. * doc/posix-functions/mkstemp.texi: Document header file problem on MacOS X. --- ChangeLog | 6 ++++++ doc/posix-functions/mkstemp.texi | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index a57d1dae82..da9c637ec1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-27 Bruno Haible + + mkstemp: More documentation. + * doc/posix-functions/mkstemp.texi: Document header file problem on + MacOS X. + 2011-04-27 Bruno Haible mkstemp: Tweak configure message when cross-compiling. diff --git a/doc/posix-functions/mkstemp.texi b/doc/posix-functions/mkstemp.texi index 60e83e99f7..ebe8c50c8b 100644 --- a/doc/posix-functions/mkstemp.texi +++ b/doc/posix-functions/mkstemp.texi @@ -12,6 +12,10 @@ Portability problems fixed by Gnulib: This function is missing on some platforms: mingw. @item +This function is declared in @code{} instead of @code{} +on some platforms: +MacOS X 10.3. +@item On some platforms (HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a silly limit that it can create no more than 26 files from a given template. On OSF/1 4.0f, it can create only 32 files per process. -- cgit v1.2.1 From a4e3a1d306ab700ca9c4ec3566d922eca77582e5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 28 Apr 2011 00:06:48 +0200 Subject: mkstemps: Ensure declaration on MacOS X 10.5. * lib/stdlib.in.h: Include when mkstemps is requested. * doc/glibc-functions/mkstemps.texi: Document header file problem on MacOS X. --- ChangeLog | 7 +++++++ doc/glibc-functions/mkstemps.texi | 4 ++++ lib/stdlib.in.h | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index da9c637ec1..f20299f0f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-27 Bruno Haible + + mkstemps: Ensure declaration on MacOS X 10.5. + * lib/stdlib.in.h: Include when mkstemps is requested. + * doc/glibc-functions/mkstemps.texi: Document header file problem on + MacOS X. + 2011-04-27 Bruno Haible mkstemp: More documentation. diff --git a/doc/glibc-functions/mkstemps.texi b/doc/glibc-functions/mkstemps.texi index 2c49d410c0..845d5dcf36 100644 --- a/doc/glibc-functions/mkstemps.texi +++ b/doc/glibc-functions/mkstemps.texi @@ -10,6 +10,10 @@ Portability problems fixed by Gnulib: This function is missing on many non-glibc platforms: glibc 2.10, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS. +@item +This function is declared in @code{} instead of @code{} +on some platforms: +MacOS X 10.5. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index b9ada2cd1a..7513553b67 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -81,8 +81,9 @@ struct random_data # endif #endif -#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) /* On MacOS X 10.3, only declares mkstemp. */ +/* On MacOS X 10.5, only declares mkstemps. */ /* On Cygwin 1.7.1, only declares getsubopt. */ /* But avoid namespace pollution on glibc systems and native Windows. */ # include -- cgit v1.2.1 From 2cd4d6d9023e923d6e5da19e8ced3e03290efa78 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 28 Apr 2011 01:26:12 +0200 Subject: Typo in comment. --- lib/clean-temp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clean-temp.h b/lib/clean-temp.h index cac0702065..8a0774dcac 100644 --- a/lib/clean-temp.h +++ b/lib/clean-temp.h @@ -43,7 +43,7 @@ extern "C" { are automatically cleaned up (at the latest) when the program exits or dies from a fatal signal such as SIGINT, SIGTERM, SIGHUP, but not if it dies from a fatal signal such as SIGQUIT, SIGKILL, or SIGABRT, SIGSEGV, - SIGBUS, SIGILL, SIGFPE, */ + SIGBUS, SIGILL, SIGFPE. */ struct temp_dir { -- cgit v1.2.1 From 8585ce2ff5698c650ba5d5e3bb99763654ad62e8 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 27 Apr 2011 20:40:21 -0600 Subject: getcwd: fix mingw bugs On mingw, getcwd(NULL,1) succeeds, even though glibc documents that with a non-zero size, the allocation will not exceed that many bytes. On mingw, getcwd has the wrong signature. However, we don't have to check for this if anything else triggers the replacement. Also, fix a type bug that crept into the original getcwd-lgpl commit. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Detect one mingw bug. * doc/posix-functions/getcwd.texi (getcwd): Document the problems. * lib/getcwd-lgpl.c (rpl_getcwd): Fix return type. Signed-off-by: Eric Blake --- ChangeLog | 7 +++++++ doc/posix-functions/getcwd.texi | 7 ++++++- lib/getcwd-lgpl.c | 2 +- m4/getcwd.m4 | 10 ++++++---- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f20299f0f7..8dae3ab1f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-27 Eric Blake + + getcwd: fix mingw bugs + * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Detect one mingw bug. + * doc/posix-functions/getcwd.texi (getcwd): Document the problems. + * lib/getcwd-lgpl.c (rpl_getcwd): Fix return type. + 2011-04-27 Bruno Haible mkstemps: Ensure declaration on MacOS X 10.5. diff --git a/doc/posix-functions/getcwd.texi b/doc/posix-functions/getcwd.texi index a8dba967ec..1f6dd187d2 100644 --- a/doc/posix-functions/getcwd.texi +++ b/doc/posix-functions/getcwd.texi @@ -11,7 +11,12 @@ Portability problems fixed by either Gnulib module @code{getcwd} or @itemize @item On glibc platforms, @code{getcwd (NULL, n)} allocates memory for the result. -On other platforms, this call is not allowed. +On some other platforms, this call is not allowed. Conversely, mingw fails +to honor non-zero @code{n}. +@item +On some platforms, the prototype for @code{getcwd} uses @code{int} +instead of @code{size_t} for the size argument: +mingw. @end itemize Portability problems fixed by Gnulib module @code{getcwd}: diff --git a/lib/getcwd-lgpl.c b/lib/getcwd-lgpl.c index a5596f8869..53c5562357 100644 --- a/lib/getcwd-lgpl.c +++ b/lib/getcwd-lgpl.c @@ -53,7 +53,7 @@ rpl_getcwd (char *buf, size_t size) if (!buf) { errno = ENOMEM; - return -1; + return NULL; } result = getcwd (buf, size); if (!result) diff --git a/m4/getcwd.m4 b/m4/getcwd.m4 index 55f937222b..eb2c9d9375 100644 --- a/m4/getcwd.m4 +++ b/m4/getcwd.m4 @@ -6,7 +6,7 @@ # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. -# serial 5 +# serial 6 AC_DEFUN([gl_FUNC_GETCWD_NULL], [ @@ -20,7 +20,8 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], # endif ]], [[ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* mingw cwd does not start with '/', but getcwd does allocate. */ +/* mingw cwd does not start with '/', but getcwd does allocate. + However, mingw fails to honor non-zero size. */ #else if (chdir ("/") != 0) return 1; @@ -36,6 +37,9 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], return 0; } #endif + /* If size is non-zero, allocation must fail if size is too small */ + if (getcwd (NULL, 1)) + return 5; ]])], [gl_cv_func_getcwd_null=yes], [gl_cv_func_getcwd_null=no], @@ -45,8 +49,6 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], *-gnu*) gl_cv_func_getcwd_null="guessing yes";; # Guess yes on Cygwin. cygwin*) gl_cv_func_getcwd_null="guessing yes";; - # Guess yes on mingw. - mingw*) gl_cv_func_getcwd_null="guessing yes";; # If we don't know, assume the worst. *) gl_cv_func_getcwd_null="guessing no";; esac -- cgit v1.2.1 From 7cbc494f7cc150886b741e2af5051685d818f89c Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 27 Apr 2011 15:41:54 -0600 Subject: utimecmp: drop dependency on xmalloc utimecmp's only use of malloc was for a cache; we can always bypass the cache in low memory, and thus avoid dragging in xalloc-die. * lib/utimecmp.c (utimecmp): Work even if hash table cache fails due to memory pressure. * modules/utimecmp (Depends-on): Drop xalloc. Signed-off-by: Eric Blake --- ChangeLog | 7 +++++++ lib/utimecmp.c | 58 +++++++++++++++++++++++++++++++++++++++----------------- modules/utimecmp | 1 - 3 files changed, 48 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8dae3ab1f4..090b3f7c41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-28 Eric Blake + + utimecmp: drop dependency on xmalloc + * lib/utimecmp.c (utimecmp): Work even if hash table cache fails + due to memory pressure. + * modules/utimecmp (Depends-on): Drop xalloc. + 2011-04-27 Eric Blake getcwd: fix mingw bugs diff --git a/lib/utimecmp.c b/lib/utimecmp.c index 356763ff61..c0f6713e3b 100644 --- a/lib/utimecmp.c +++ b/lib/utimecmp.c @@ -33,7 +33,6 @@ #include "stat-time.h" #include "utimens.h" #include "verify.h" -#include "xalloc.h" #ifndef MAX # define MAX(a, b) ((a) > (b) ? (a) : (b)) @@ -122,7 +121,9 @@ utimecmp (char const *dst_name, /* Things to watch out for: The code uses a static hash table internally and is not safe in the - presence of signals, multiple threads, etc. + presence of signals, multiple threads, etc. However, memory pressure + that prevents use of the hash table is not fatal - we just fall back + to redoing the computations on every call in that case. int and long int might be 32 bits. Many of the calculations store numbers up to 2 billion, and multiply by 10; they have to avoid @@ -143,12 +144,13 @@ utimecmp (char const *dst_name, { /* Look up the time stamp resolution for the destination device. */ - /* Hash table for devices. */ + /* Hash table for caching information learned about devices. */ static Hash_table *ht; /* Information about the destination file system. */ static struct fs_res *new_dst_res; - struct fs_res *dst_res; + struct fs_res *dst_res = NULL; + struct fs_res tmp_dst_res; /* Time stamp resolution in nanoseconds. */ int res; @@ -163,24 +165,46 @@ utimecmp (char const *dst_name, if (src_s <= dst_s - 2) return 1; + /* Try to do a hash lookup, but fall back to stack variables and + recomputation on low memory situations. */ if (! ht) ht = hash_initialize (16, NULL, dev_info_hash, dev_info_compare, free); - if (! new_dst_res) + if (ht) { - new_dst_res = xmalloc (sizeof *new_dst_res); - new_dst_res->resolution = 2 * BILLION; - new_dst_res->exact = false; - } - new_dst_res->dev = dst_stat->st_dev; - dst_res = hash_insert (ht, new_dst_res); - if (! dst_res) - xalloc_die (); + if (! new_dst_res) + { + new_dst_res = malloc (sizeof *new_dst_res); + if (!new_dst_res) + goto low_memory; + new_dst_res->resolution = 2 * BILLION; + new_dst_res->exact = false; + } + new_dst_res->dev = dst_stat->st_dev; + dst_res = hash_insert (ht, new_dst_res); + if (! dst_res) + goto low_memory; - if (dst_res == new_dst_res) + if (dst_res == new_dst_res) + { + /* NEW_DST_RES is now in use in the hash table, so allocate a + new entry next time. */ + new_dst_res = NULL; + } + } + else { - /* NEW_DST_RES is now in use in the hash table, so allocate a - new entry next time. */ - new_dst_res = NULL; + low_memory: + if (ht) + { + tmp_dst_res.dev = dst_stat->st_dev; + dst_res = hash_lookup (ht, &tmp_dst_res); + } + if (!dst_res) + { + dst_res = &tmp_dst_res; + dst_res->resolution = 2 * BILLION; + dst_res->exact = false; + } } res = dst_res->resolution; diff --git a/modules/utimecmp b/modules/utimecmp index 7be906b219..a3160c8d54 100644 --- a/modules/utimecmp +++ b/modules/utimecmp @@ -11,7 +11,6 @@ hash stat-time time utimens -xalloc intprops lstat stdbool -- cgit v1.2.1 From bf18c9b4d8ab7f7e8db272594b5d2c8a8dd06b64 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 27 Apr 2011 15:54:30 -0600 Subject: xalloc-oversized: new module Due to inline functions, mere inclusion of xalloc.h can result in a link dependency on xalloc_die() on some platforms. However, there are several modules that want to use just xalloc_oversized in order to short-circuit the potential to call xalloc_die. Splitting the macro into a new header and module makes this easy. * modules/xalloc-oversized: New module. * modules/xalloc (Depends-on): Add it. * lib/xalloc.h (xalloc_oversized): Move... * lib/xalloc-oversized.h: ...into new file. Signed-off-by: Eric Blake --- ChangeLog | 6 ++++++ lib/xalloc-oversized.h | 38 ++++++++++++++++++++++++++++++++++++++ lib/xalloc.h | 17 +---------------- modules/xalloc | 1 + modules/xalloc-oversized | 20 ++++++++++++++++++++ 5 files changed, 66 insertions(+), 16 deletions(-) create mode 100644 lib/xalloc-oversized.h create mode 100644 modules/xalloc-oversized diff --git a/ChangeLog b/ChangeLog index 090b3f7c41..039d3c55b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-04-28 Eric Blake + xalloc-oversized: new module + * modules/xalloc-oversized: New module. + * modules/xalloc (Depends-on): Add it. + * lib/xalloc.h (xalloc_oversized): Move... + * lib/xalloc-oversized.h: ...into new file. + utimecmp: drop dependency on xmalloc * lib/utimecmp.c (utimecmp): Work even if hash table cache fails due to memory pressure. diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h new file mode 100644 index 0000000000..ab19bcf2f9 --- /dev/null +++ b/lib/xalloc-oversized.h @@ -0,0 +1,38 @@ +/* xalloc-oversized.h -- memory allocation size checking + + Copyright (C) 1990-2000, 2003-2004, 2006-2011 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 . */ + +#ifndef XALLOC_OVERSIZED_H_ +# define XALLOC_OVERSIZED_H_ + +# include + +/* Return 1 if an array of N objects, each of size S, cannot exist due + to size arithmetic overflow. S must be positive and N must be + nonnegative. This is a macro, not an inline function, so that it + works correctly even when SIZE_MAX < N. + + By gnulib convention, SIZE_MAX represents overflow in size + calculations, so the conservative dividend to use here is + SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. + However, malloc (SIZE_MAX) fails on all known hosts where + sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for + exactly-SIZE_MAX allocations on such hosts; this avoids a test and + branch when S is known to be 1. */ +# define xalloc_oversized(n, s) \ + ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) + +#endif /* !XALLOC_OVERSIZED_H_ */ diff --git a/lib/xalloc.h b/lib/xalloc.h index 86b9b3e6e0..c1bbe7e5b6 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -20,6 +20,7 @@ # include +# include "xalloc-oversized.h" # ifdef __cplusplus extern "C" { @@ -65,22 +66,6 @@ void *xmemdup (void const *p, size_t s) char *xstrdup (char const *str) _GL_ATTRIBUTE_MALLOC; -/* Return 1 if an array of N objects, each of size S, cannot exist due - to size arithmetic overflow. S must be positive and N must be - nonnegative. This is a macro, not an inline function, so that it - works correctly even when SIZE_MAX < N. - - By gnulib convention, SIZE_MAX represents overflow in size - calculations, so the conservative dividend to use here is - SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. - However, malloc (SIZE_MAX) fails on all known hosts where - sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for - exactly-SIZE_MAX allocations on such hosts; this avoids a test and - branch when S is known to be 1. */ -# define xalloc_oversized(n, s) \ - ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) - - /* In the following macros, T must be an elementary or structure/union or typedef'ed type, or a pointer to such a type. To apply one of the following macros to a function pointer or array type, you need to typedef diff --git a/modules/xalloc b/modules/xalloc index 43ee94205c..0edcfc6eac 100644 --- a/modules/xalloc +++ b/modules/xalloc @@ -9,6 +9,7 @@ m4/xalloc.m4 Depends-on: inline xalloc-die +xalloc-oversized configure.ac: gl_XALLOC diff --git a/modules/xalloc-oversized b/modules/xalloc-oversized new file mode 100644 index 0000000000..708c621f30 --- /dev/null +++ b/modules/xalloc-oversized @@ -0,0 +1,20 @@ +Description: +Check for memory allocation overflow. Also see xalloc. + +Files: +lib/xalloc-oversized.h + +Depends-on: + +configure.ac: + +Makefile.am: + +Include: +"xalloc-oversized.h" + +License: +GPL + +Maintainer: +all -- cgit v1.2.1 From 83b1d6414af952ac03022bf956d84a21f6132d0e Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 27 Apr 2011 16:23:45 -0600 Subject: hash, mgetgroups: drop xalloc dependency Rely on the new xalloc-oversized module to avoid requiring xalloc-die for functions documented as returning NULL on potential allocation overflow. * lib/hash.c (includes): Adjust includes. * lib/mgetgroups.c (includes): Likewise. (xgetgroups): Move... * lib/xgetgroups.c: ...to new file. * modules/xgetgroups: New file, split from... * modules/mgetgroups: ...here. (Depends-on): Add xalloc-oversized. * modules/hash (Depends-on): Likewise. * modules/hash-tests (Depends-on): Drop xalloc. (test_hash_LDADD): Drop unused library. * tests/test-hash.c (main): Break xalloc dependency. (includes): Drop unused include. Signed-off-by: Eric Blake --- ChangeLog | 15 +++++++++++++++ NEWS | 3 +++ lib/hash.c | 2 +- lib/mgetgroups.c | 13 +------------ lib/mgetgroups.h | 2 ++ lib/xgetgroups.c | 37 +++++++++++++++++++++++++++++++++++++ modules/hash | 4 ++-- modules/hash-tests | 2 -- modules/mgetgroups | 2 +- modules/xgetgroups | 25 +++++++++++++++++++++++++ tests/test-hash.c | 14 +++++++++----- 11 files changed, 96 insertions(+), 23 deletions(-) create mode 100644 lib/xgetgroups.c create mode 100644 modules/xgetgroups diff --git a/ChangeLog b/ChangeLog index 039d3c55b6..df91f2583d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2011-04-28 Eric Blake + hash, mgetgroups: drop xalloc dependency + * lib/hash.c (includes): Adjust includes. + * lib/mgetgroups.c (includes): Likewise. + (xgetgroups): Move... + * lib/xgetgroups.c: ...to new file. + * lib/mgetgroups.h (xgetgroups): Make declaration conditional. + * modules/xgetgroups: New file, split from... + * modules/mgetgroups: ...here. + (Depends-on): Add xalloc-oversized. + * modules/hash (Depends-on): Likewise. + * modules/hash-tests (Depends-on): Drop xalloc. + (test_hash_LDADD): Drop unused library. + * tests/test-hash.c (main): Break xalloc dependency. + (includes): Drop unused include. + xalloc-oversized: new module * modules/xalloc-oversized: New module. * modules/xalloc (Depends-on): Add it. diff --git a/NEWS b/NEWS index 5081dbaa82..b693a33596 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ User visible incompatible changes Date Modules Changes +2011-04-27 mgetgroups The 'xgetgroups' function has been split into + a new 'xgetgroups' module. + 2011-04-27 save-cwd This module pulls in fewer dependencies by default; to retain robust handling of directories with an absolute name longer than PATH_MAX, you diff --git a/lib/hash.c b/lib/hash.c index f3de2aaaac..4d76f765e9 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -27,7 +27,7 @@ #include "hash.h" #include "bitrotate.h" -#include "xalloc.h" +#include "xalloc-oversized.h" #include #include diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c index 5c79915bcc..e0aa250ca4 100644 --- a/lib/mgetgroups.c +++ b/lib/mgetgroups.c @@ -31,7 +31,7 @@ #endif #include "getugroups.h" -#include "xalloc.h" +#include "xalloc-oversized.h" static gid_t * realloc_groupbuf (gid_t *g, size_t num) @@ -193,14 +193,3 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups) return ng; } - -/* Like mgetgroups, but call xalloc_die on allocation failure. */ - -int -xgetgroups (char const *username, gid_t gid, gid_t **groups) -{ - int result = mgetgroups (username, gid, groups); - if (result == -1 && errno == ENOMEM) - xalloc_die (); - return result; -} diff --git a/lib/mgetgroups.h b/lib/mgetgroups.h index a1fd040e73..7a572bc2f7 100644 --- a/lib/mgetgroups.h +++ b/lib/mgetgroups.h @@ -17,4 +17,6 @@ #include int mgetgroups (const char *username, gid_t gid, gid_t **groups); +#if GNULIB_XGETGROUPS int xgetgroups (const char *username, gid_t gid, gid_t **groups); +#endif diff --git a/lib/xgetgroups.c b/lib/xgetgroups.c new file mode 100644 index 0000000000..41886c9122 --- /dev/null +++ b/lib/xgetgroups.c @@ -0,0 +1,37 @@ +/* xgetgroups.c -- return a list of the groups a user or current process is in + + Copyright (C) 2007-2011 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 . */ + +/* Extracted from coreutils' src/id.c. */ + +#include + +#include "mgetgroups.h" + +#include + +#include "xalloc.h" + +/* Like mgetgroups, but call xalloc_die on allocation failure. */ + +int +xgetgroups (char const *username, gid_t gid, gid_t **groups) +{ + int result = mgetgroups (username, gid, groups); + if (result == -1 && errno == ENOMEM) + xalloc_die (); + return result; +} diff --git a/modules/hash b/modules/hash index 75a99da373..72afda6cf1 100644 --- a/modules/hash +++ b/modules/hash @@ -1,5 +1,5 @@ Description: -Parametrizable hash table. +Parameterizable hash table. Files: lib/hash.c @@ -10,7 +10,7 @@ Depends-on: bitrotate stdbool stdint -xalloc +xalloc-oversized configure.ac: gl_HASH diff --git a/modules/hash-tests b/modules/hash-tests index a77bfe7d68..b3f814b6ec 100644 --- a/modules/hash-tests +++ b/modules/hash-tests @@ -7,11 +7,9 @@ hash-pjw inttostr progname stdbool -xalloc configure.ac: Makefile.am: TESTS += test-hash check_PROGRAMS += test-hash -test_hash_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/mgetgroups b/modules/mgetgroups index c404d01435..1aa1c79ae6 100644 --- a/modules/mgetgroups +++ b/modules/mgetgroups @@ -10,7 +10,7 @@ Depends-on: getgroups getugroups realloc-gnu -xalloc +xalloc-oversized configure.ac: gl_MGETGROUPS diff --git a/modules/xgetgroups b/modules/xgetgroups new file mode 100644 index 0000000000..6ae3614342 --- /dev/null +++ b/modules/xgetgroups @@ -0,0 +1,25 @@ +Description: +Return the group IDs of a user or current process in malloc'd storage, with +out-of-memory checking. + +Files: +lib/xgetgroups.c + +Depends-on: +mgetgroups +xalloc + +configure.ac: +gl_MODULE_INDICATOR([xgetgroups]) + +Makefile.am: +lib_SOURCES += xgetgroups.c + +Include: +"mgetgroups.h" + +License: +GPL + +Maintainer: +Jim Meyering, Eric Blake diff --git a/tests/test-hash.c b/tests/test-hash.c index 108daefdf4..ecfe357ccd 100644 --- a/tests/test-hash.c +++ b/tests/test-hash.c @@ -20,7 +20,6 @@ #include "hash.h" #include "hash-pjw.h" #include "inttostr.h" -#include "xalloc.h" #include #include @@ -114,8 +113,10 @@ main (int argc, char **argv) ASSERT (ht); insert_new (ht, "a"); { - char *str1 = xstrdup ("a"); - char *str2 = hash_insert (ht, str1); + char *str1 = strdup ("a"); + char *str2; + ASSERT (str1); + str2 = hash_insert (ht, str1); ASSERT (str1 != str2); ASSERT (STREQ (str1, str2)); free (str1); @@ -161,7 +162,8 @@ main (int argc, char **argv) ht = hash_initialize (sz, NULL, NULL, NULL, NULL); ASSERT (ht); { - char *str = xstrdup ("a"); + char *str = strdup ("a"); + ASSERT (str); insert_new (ht, "a"); insert_new (ht, str); ASSERT (hash_lookup (ht, str) == str); @@ -206,7 +208,9 @@ main (int argc, char **argv) { char buf[50]; char const *p = uinttostr (i, buf); - insert_new (ht, xstrdup (p)); + char *dup = strdup (p); + ASSERT (dup); + insert_new (ht, dup); } break; -- cgit v1.2.1 From d6d01fdde58da00d0d839711097e3acb83f61754 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 27 Apr 2011 16:38:05 -0600 Subject: tests: drop unused link dependency Ever since commit 2392b18099, openat and fdopendir no longer drag in xalloc-die through indirect dependencies, so these tests no longer need $(LIBINTL). * modules/areadlinkat-tests (Makefile.am): Drop stale LDADD. * modules/dirent-safer-tests (Makefile.am): Likewise. * modules/fdopendir-tests (Makefile.am): Likewise. * modules/mkfifoat-tests (Makefile.am): Likewise. * modules/openat-safer-tests (Makefile.am): Likewise. * modules/openat-tests (Makefile.am): Likewise. * modules/readlinkat-tests (Makefile.am): Likewise. * modules/symlinkat-tests (Makefile.am): Likewise. * modules/linkat-tests (Makefile.am): Likewise. (Depends-on): Switch to filenamecat-lgpl. * modules/fdutimensat-tests (test_fdutimensat_LDADD): Drop unused LIBINTL. * modules/utimensat-tests (test_utimensat_LDADD): Likewise. * tests/test-linkat.c (main): Don't require xalloc. Signed-off-by: Eric Blake --- ChangeLog | 16 ++++++++++++++++ modules/areadlinkat-tests | 1 - modules/dirent-safer-tests | 3 --- modules/fdopendir-tests | 1 - modules/fdutimensat-tests | 2 +- modules/linkat-tests | 3 +-- modules/mkfifoat-tests | 1 - modules/openat-safer-tests | 1 - modules/openat-tests | 5 ----- modules/readlinkat-tests | 1 - modules/symlinkat-tests | 1 - modules/utimensat-tests | 2 +- tests/test-linkat.c | 6 ++++-- 13 files changed, 23 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index df91f2583d..654d5c0594 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2011-04-28 Eric Blake + tests: drop unused link dependency + * modules/areadlinkat-tests (Makefile.am): Drop stale LDADD. + * modules/dirent-safer-tests (Makefile.am): Likewise. + * modules/fdopendir-tests (Makefile.am): Likewise. + * modules/mkfifoat-tests (Makefile.am): Likewise. + * modules/openat-safer-tests (Makefile.am): Likewise. + * modules/openat-tests (Makefile.am): Likewise. + * modules/readlinkat-tests (Makefile.am): Likewise. + * modules/symlinkat-tests (Makefile.am): Likewise. + * modules/linkat-tests (Makefile.am): Likewise. + (Depends-on): Switch to filenamecat-lgpl. + * modules/fdutimensat-tests (test_fdutimensat_LDADD): Drop unused + LIBINTL. + * modules/utimensat-tests (test_utimensat_LDADD): Likewise. + * tests/test-linkat.c (main): Don't require xalloc. + hash, mgetgroups: drop xalloc dependency * lib/hash.c (includes): Adjust includes. * lib/mgetgroups.c (includes): Likewise. diff --git a/modules/areadlinkat-tests b/modules/areadlinkat-tests index 422ac61412..23e5278486 100644 --- a/modules/areadlinkat-tests +++ b/modules/areadlinkat-tests @@ -13,4 +13,3 @@ configure.ac: Makefile.am: TESTS += test-areadlinkat check_PROGRAMS += test-areadlinkat -test_areadlinkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/dirent-safer-tests b/modules/dirent-safer-tests index 172c662de4..2bc95933fd 100644 --- a/modules/dirent-safer-tests +++ b/modules/dirent-safer-tests @@ -10,6 +10,3 @@ configure.ac: Makefile.am: TESTS += test-dirent-safer check_PROGRAMS += test-dirent-safer -# Link with libintl when needed. dirent-safer uses fdopendir if it is present, -# and fdopendir indirectly depends on xgetcwd -> xalloc-die -> gettext-h. -test_dirent_safer_LDADD = $(LDADD) $(LIBINTL) diff --git a/modules/fdopendir-tests b/modules/fdopendir-tests index bee2df7df5..39575ba3f0 100644 --- a/modules/fdopendir-tests +++ b/modules/fdopendir-tests @@ -12,4 +12,3 @@ configure.ac: Makefile.am: TESTS += test-fdopendir check_PROGRAMS += test-fdopendir -test_fdopendir_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/fdutimensat-tests b/modules/fdutimensat-tests index 48ea78d233..1d107ce5c1 100644 --- a/modules/fdutimensat-tests +++ b/modules/fdutimensat-tests @@ -19,4 +19,4 @@ configure.ac: Makefile.am: TESTS += test-fdutimensat check_PROGRAMS += test-fdutimensat -test_fdutimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBINTL@ +test_fdutimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) diff --git a/modules/linkat-tests b/modules/linkat-tests index c49c1b324a..3f2d3f090c 100644 --- a/modules/linkat-tests +++ b/modules/linkat-tests @@ -7,7 +7,7 @@ tests/macros.h Depends-on: ignore-value areadlink-with-size -filenamecat +filenamecat-lgpl getcwd-lgpl progname same-inode @@ -17,4 +17,3 @@ configure.ac: Makefile.am: TESTS += test-linkat check_PROGRAMS += test-linkat -test_linkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/mkfifoat-tests b/modules/mkfifoat-tests index 8be33df05d..a1e33c9812 100644 --- a/modules/mkfifoat-tests +++ b/modules/mkfifoat-tests @@ -13,4 +13,3 @@ configure.ac: Makefile.am: TESTS += test-mkfifoat check_PROGRAMS += test-mkfifoat -test_mkfifoat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/openat-safer-tests b/modules/openat-safer-tests index 1f0b158fc0..a33d2c6b68 100644 --- a/modules/openat-safer-tests +++ b/modules/openat-safer-tests @@ -9,4 +9,3 @@ configure.ac: Makefile.am: TESTS += test-openat-safer check_PROGRAMS += test-openat-safer -test_openat_safer_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/openat-tests b/modules/openat-tests index 250a574593..959d882333 100644 --- a/modules/openat-tests +++ b/modules/openat-tests @@ -31,8 +31,3 @@ Makefile.am: TESTS += test-fchownat test-fstatat test-mkdirat test-openat test-unlinkat check_PROGRAMS += test-fchownat test-fstatat test-mkdirat test-openat \ test-unlinkat -test_fchownat_LDADD = $(LDADD) @LIBINTL@ -test_fstatat_LDADD = $(LDADD) @LIBINTL@ -test_mkdirat_LDADD = $(LDADD) @LIBINTL@ -test_openat_LDADD = $(LDADD) @LIBINTL@ -test_unlinkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/readlinkat-tests b/modules/readlinkat-tests index de23df8dde..96faa5699b 100644 --- a/modules/readlinkat-tests +++ b/modules/readlinkat-tests @@ -13,4 +13,3 @@ configure.ac: Makefile.am: TESTS += test-readlinkat check_PROGRAMS += test-readlinkat -test_readlinkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/symlinkat-tests b/modules/symlinkat-tests index 90331494a4..13ae9bd8a1 100644 --- a/modules/symlinkat-tests +++ b/modules/symlinkat-tests @@ -12,4 +12,3 @@ configure.ac: Makefile.am: TESTS += test-symlinkat check_PROGRAMS += test-symlinkat -test_symlinkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/utimensat-tests b/modules/utimensat-tests index 26dbac6762..987a86abc5 100644 --- a/modules/utimensat-tests +++ b/modules/utimensat-tests @@ -19,4 +19,4 @@ configure.ac: Makefile.am: TESTS += test-utimensat check_PROGRAMS += test-utimensat -test_utimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBINTL@ +test_utimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) diff --git a/tests/test-linkat.c b/tests/test-linkat.c index e3c8a5e1d4..2bf1790524 100644 --- a/tests/test-linkat.c +++ b/tests/test-linkat.c @@ -140,9 +140,11 @@ main (void) for (i = 0; i < 32; i++) { int fd1 = (i & 8) ? dfd : AT_FDCWD; - char *file1 = file_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL); + char *file1 = mfile_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL); int fd2 = (i & 2) ? dfd : AT_FDCWD; - char *file2 = file_name_concat ((i & 1) ? ".." : cwd, BASE "xx", NULL); + char *file2 = mfile_name_concat ((i & 1) ? ".." : cwd, BASE "xx", NULL); + ASSERT (file1); + ASSERT (file2); flag = (i & 0x10 ? AT_SYMLINK_FOLLOW : 0); ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2); -- cgit v1.2.1 From 7aa5e8dd3a8431c2354197961b3f2cd76864091f Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 28 Apr 2011 15:24:46 -0600 Subject: getsockopt: avoid compiler warning getsockopt.c: In function 'rpl_getsockopt': getsockopt.c:51:7: warning: passing argument 4 of 'getsockopt' from incompatible pointer type c:\dev\msys_setup\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/winsock2.h:543:32: note: expected 'char *' but argument is of type 'int *' A simple cast works around the mingw signature lameness. If only they had picked void* instead of char*, like POSIX says... * lib/getsockopt.c (rpl_getsockopt): Add a cast for mingw. Reported by Matthias Bolte. Signed-off-by: Eric Blake --- ChangeLog | 4 ++++ lib/getsockopt.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 654d5c0594..6b755c1470 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-04-28 Eric Blake + getsockopt: avoid compiler warning + * lib/getsockopt.c (rpl_getsockopt): Add a cast for mingw. + Reported by Matthias Bolte. + tests: drop unused link dependency * modules/areadlinkat-tests (Makefile.am): Drop stale LDADD. * modules/dirent-safer-tests (Makefile.am): Likewise. diff --git a/lib/getsockopt.c b/lib/getsockopt.c index c136772a85..d82ea5ff21 100644 --- a/lib/getsockopt.c +++ b/lib/getsockopt.c @@ -46,7 +46,8 @@ rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen) int milliseconds_len = sizeof (int); struct timeval tv; size_t n; - r = getsockopt (sock, level, optname, &milliseconds, &milliseconds_len); + r = getsockopt (sock, level, optname, (char *) &milliseconds, + &milliseconds_len); tv.tv_sec = milliseconds / 1000; tv.tv_usec = (milliseconds - 1000 * tv.tv_sec) * 1000; n = sizeof (struct timeval); -- cgit v1.2.1 From 74175b903b1716c1677658e45fa69ef1fbc99015 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 28 Apr 2011 16:46:16 -0600 Subject: getaddrinfo: fix gai_strerror signature Several platforms declare gai_strerror to return char* rather than const char*. Worse, on mingw, if UNICODE is defined, it is defined to return WCHAR*, which means the result is in unicode but an application expecting bytes for characters will only see a one-byte answer. * m4/getaddrinfo.m4 (gl_GETADDRINFO): Detect broken signatures, and work around mingw with UNICODE defined. (gl_PREREQ_GETADDRINFO): Drop redundant decl check. * m4/netdb_h.m4 (gl_NETDB_H_DEFAULTS): Add witness. * modules/netdb (Makefile.am): Substitute it. * lib/netdb.in.h (gai_strerror): Declare replacement. * lib/gai_strerror.c (rpl_gai_strerror): Fix signature. * doc/posix-functions/gai_strerror.texi (gai_strerror): Document the fix. Signed-off-by: Eric Blake --- ChangeLog | 11 +++++++++++ doc/posix-functions/gai_strerror.texi | 15 +++++++++----- lib/gai_strerror.c | 21 ++++++++++++++++++-- lib/netdb.in.h | 15 ++++++++++++-- m4/getaddrinfo.m4 | 37 ++++++++++++++++++++++++++--------- m4/netdb_h.m4 | 1 + modules/netdb | 1 + 7 files changed, 83 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b755c1470..9e5aa41558 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-04-28 Eric Blake + getaddrinfo: fix gai_strerror signature + * m4/getaddrinfo.m4 (gl_GETADDRINFO): Detect broken signatures, + and work around mingw with UNICODE defined. + (gl_PREREQ_GETADDRINFO): Drop redundant decl check. + * m4/netdb_h.m4 (gl_NETDB_H_DEFAULTS): Add witness. + * modules/netdb (Makefile.am): Substitute it. + * lib/netdb.in.h (gai_strerror): Declare replacement. + * lib/gai_strerror.c (rpl_gai_strerror): Fix signature. + * doc/posix-functions/gai_strerror.texi (gai_strerror): Document + the fix. + getsockopt: avoid compiler warning * lib/getsockopt.c (rpl_getsockopt): Add a cast for mingw. Reported by Matthias Bolte. diff --git a/doc/posix-functions/gai_strerror.texi b/doc/posix-functions/gai_strerror.texi index ece2bdc991..d94a6ed9bd 100644 --- a/doc/posix-functions/gai_strerror.texi +++ b/doc/posix-functions/gai_strerror.texi @@ -10,13 +10,18 @@ Portability problems fixed by Gnulib: @itemize @item This function is missing on some platforms: -HP-UX 11.11, IRIX 6.5, OSF/1 4.0, Solaris 7, Cygwin 1.5.x, mingw, Interix 3.5, BeOS. +HP-UX 11.11, IRIX 6.5, OSF/1 4.0, Solaris 7, Cygwin 1.5.x, Interix +3.5, BeOS. +@item +This function is only available in @code{} on some +platforms: +mingw. +@item +This function's return type is @code{char *} instead of @code{const char *} +on some platforms: +AIX 7.1, HP-UX 11, OSF/1 5.1, Solaris 9, mingw. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This function's return type is @code{char *} instead of @code{const char *} -on some platforms: -AIX 7.1, HP-UX 11, OSF/1 5.1, Solaris 9. @end itemize diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c index ee595e1a7e..f758f8e909 100644 --- a/lib/gai_strerror.c +++ b/lib/gai_strerror.c @@ -32,6 +32,22 @@ # define N_(String) String #endif +#if HAVE_DECL_GAI_STRERROR + +# include +# undef gai_strerror +# if HAVE_DECL_GAI_STRERRORA +# define gai_strerror gai_strerrorA +# endif + +const char * +rpl_gai_strerror (int code) +{ + return gai_strerror (code); +} + +#else /* !HAVE_DECL_GAI_STRERROR */ + static struct { int code; @@ -71,6 +87,7 @@ gai_strerror (int code) return _("Unknown error"); } -#ifdef _LIBC +# ifdef _LIBC libc_hidden_def (gai_strerror) -#endif +# endif +#endif /* !HAVE_DECL_GAI_STRERROR */ diff --git a/lib/netdb.in.h b/lib/netdb.in.h index d789e34224..64cd9ac53b 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -167,12 +167,23 @@ extern int getaddrinfo (const char *restrict nodename, extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1)); # endif -# if !@HAVE_DECL_GAI_STRERROR@ +# if @REPLACE_GAI_STRERROR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gai_strerror +# define gai_strerror rpl_gai_strerror +# endif +_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode)); +_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode)); +# else +# if !@HAVE_DECL_GAI_STRERROR@ /* Convert error return from getaddrinfo() to a string. For more details, see the POSIX:2001 specification . */ -extern const char *gai_strerror (int ecode); +_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode)); +# endif +_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode)); # endif +_GL_CXXALIASWARN (gai_strerror); # if !@HAVE_DECL_GETNAMEINFO@ /* Convert socket address to printable node and service names. diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4 index e57623694c..f29e903987 100644 --- a/m4/getaddrinfo.m4 +++ b/m4/getaddrinfo.m4 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 24 +# getaddrinfo.m4 serial 25 dnl Copyright (C) 2004-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -62,9 +62,7 @@ AC_DEFUN([gl_GETADDRINFO], # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an # inline function declared in ws2tcpip.h, so we need to get that # header included somehow. - AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], - gl_cv_func_gai_strerror, [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + AC_CHECK_DECLS([gai_strerror, gai_strerrorA], [], [break], [[ #include #ifdef HAVE_SYS_SOCKET_H #include @@ -76,11 +74,32 @@ AC_DEFUN([gl_GETADDRINFO], #include #endif #include -]], [[gai_strerror (NULL);]])], - [gl_cv_func_gai_strerror=yes], - [gl_cv_func_gai_strerror=no])]) - if test $gl_cv_func_gai_strerror = no; then +]]) + if test $ac_cv_have_decl_gai_strerror = no; then AC_LIBOBJ([gai_strerror]) + else + dnl check for correct signature + AC_CACHE_CHECK([for gai_strerror with POSIX signature], + [gl_cv_func_gai_strerror_posix_signature], [ + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#include +extern const char *gai_strerror(int);]])], + [gl_cv_func_gai_strerror_posix_signature=yes], + [gl_cv_func_gai_strerror_posix_signature=no])]) + if test $gl_cv_func_gai_strerror_posix_signature = no; then + REPLACE_GAI_STRERROR=1 + AC_LIBOBJ([gai_strerror]) + fi fi LIBS="$gai_saved_LIBS" @@ -112,7 +131,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ AC_CHECK_HEADERS_ONCE([netinet/in.h]) - AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ + AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[ /* sys/types.h is not needed according to POSIX, but the sys/socket.h in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ diff --git a/m4/netdb_h.m4 b/m4/netdb_h.m4 index 9a01cd6a76..259c7a3181 100644 --- a/m4/netdb_h.m4 +++ b/m4/netdb_h.m4 @@ -37,4 +37,5 @@ AC_DEFUN([gl_NETDB_H_DEFAULTS], HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR]) HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO]) HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO]) + REPLACE_GAI_STRERROR=0; AC_SUBST([REPLACE_GAI_STRERROR]) ]) diff --git a/modules/netdb b/modules/netdb index 97c40bcce3..8d210c949e 100644 --- a/modules/netdb +++ b/modules/netdb @@ -33,6 +33,7 @@ netdb.h: netdb.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(WARN_ON_USE -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \ -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \ -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \ + -e 's|@''REPLACE_GAI_STRERROR''@|$(REPLACE_GAI_STRERROR)|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; \ -- cgit v1.2.1 From 20abe9a92c71d7ccb46484543e874f8b357d5f4f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 29 Apr 2011 09:38:14 +0200 Subject: test-hash.c: avoid a new shadowing warning * tests/test-hash.c (main): Don't shadow "dup". --- ChangeLog | 5 +++++ tests/test-hash.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e5aa41558..3cc245ed3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-29 Jim Meyering + + test-hash.c: avoid a new shadowing warning + * tests/test-hash.c (main): Don't shadow "dup". + 2011-04-28 Eric Blake getaddrinfo: fix gai_strerror signature diff --git a/tests/test-hash.c b/tests/test-hash.c index ecfe357ccd..4a8a3bef37 100644 --- a/tests/test-hash.c +++ b/tests/test-hash.c @@ -208,9 +208,9 @@ main (int argc, char **argv) { char buf[50]; char const *p = uinttostr (i, buf); - char *dup = strdup (p); - ASSERT (dup); - insert_new (ht, dup); + char *p_dup = strdup (p); + ASSERT (p_dup); + insert_new (ht, p_dup); } break; -- cgit v1.2.1 From c1bb7ba6ba9e685da05f48da5368d9342ba272c1 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 29 Apr 2011 09:53:25 +0200 Subject: test-getcwd.c: avoid new set-but-not-used warning * tests/test-getcwd.c (test_abort_bug): Exit nonzero for any problem, not just the glibc/abort one that getcwd-abort-bug.m4 detects. This also adds an additional test for an unlikely chdir("..") failure. * m4/getcwd-abort-bug.m4: Update this now-duplicated code to match, and adjust the code that sets gl_cv_func_getcwd_abort_bug accordingly. --- ChangeLog | 6 ++++++ m4/getcwd-abort-bug.m4 | 17 ++++++++++++----- tests/test-getcwd.c | 9 ++++++--- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3cc245ed3c..dc01efd6c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-04-29 Jim Meyering + test-getcwd.c: avoid new set-but-not-used warning + * tests/test-getcwd.c (test_abort_bug): Exit nonzero for any problem, + not just the glibc/abort one that getcwd-abort-bug.m4 detects. + * m4/getcwd-abort-bug.m4: Update this now-duplicated code to match, + and adjust the code that sets gl_cv_func_getcwd_abort_bug accordingly. + test-hash.c: avoid a new shadowing warning * tests/test-hash.c (main): Don't shadow "dup". diff --git a/m4/getcwd-abort-bug.m4 b/m4/getcwd-abort-bug.m4 index 0b59a6bf21..fd6820dc60 100644 --- a/m4/getcwd-abort-bug.m4 +++ b/m4/getcwd-abort-bug.m4 @@ -1,4 +1,4 @@ -# serial 3 +# serial 4 # Determine whether getcwd aborts when the length of the working directory # name is unusually large. Any length between 4k and 16k trigger the bug # when using glibc-2.4.90-9 or older. @@ -65,7 +65,7 @@ main () cwd = getcwd (NULL, 0); if (cwd == NULL) - return 0; + return 2; initial_cwd_len = strlen (cwd); free (cwd); @@ -92,15 +92,22 @@ main () while (0 < d--) { if (chdir ("..") < 0) - break; + { + fail = 5; + break; + } rmdir (dir_name); } - return 0; + return fail; } ]])], [gl_cv_func_getcwd_abort_bug=no], - [gl_cv_func_getcwd_abort_bug=yes], + dnl A "regular" nonzero return does not indicate this bug. + dnl An abort will provoke an exit code of something like 134 (128 + 6). + [test $? -gt 128 \ + && gl_cv_func_getcwd_abort_bug=yes \ + || gl_cv_func_getcwd_abort_bug=no], [gl_cv_func_getcwd_abort_bug=yes]) ]) AS_IF([test $gl_cv_func_getcwd_abort_bug = yes], [$1], [$2]) diff --git a/tests/test-getcwd.c b/tests/test-getcwd.c index 0e0f90f241..14a526f65e 100644 --- a/tests/test-getcwd.c +++ b/tests/test-getcwd.c @@ -55,7 +55,7 @@ test_abort_bug (void) cwd = getcwd (NULL, 0); if (cwd == NULL) - return 0; + return 2; initial_cwd_len = strlen (cwd); free (cwd); @@ -82,11 +82,14 @@ test_abort_bug (void) while (0 < d--) { if (chdir ("..") < 0) - break; + { + fail = 5; + break; + } rmdir (dir_name); } - return 0; + return fail; } /* The length of this name must be 8. */ -- cgit v1.2.1 From 3864a29763baff1d01895a57f73729fd53cc5fbf Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 29 Apr 2011 14:09:15 +0200 Subject: netdb: fix gai_strerror replacements * lib/netdb.in.h: Add _GL_FUNCDECL_RPL definitions. * modules/netdb: Substitute it. --- ChangeLog | 6 ++++++ lib/netdb.in.h | 2 ++ modules/netdb | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dc01efd6c1..874a093e3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-29 Bruno Haible + + netdb: fix gai_strerror replacements + * lib/netdb.in.h: Add _GL_FUNCDECL_RPL definitions. + * modules/netdb: Substitute it. + 2011-04-29 Jim Meyering test-getcwd.c: avoid new set-but-not-used warning diff --git a/lib/netdb.in.h b/lib/netdb.in.h index 64cd9ac53b..c1cf671d59 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -41,6 +41,8 @@ 'struct hostent' on MinGW. */ #include +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ diff --git a/modules/netdb b/modules/netdb index 8d210c949e..59f26891d4 100644 --- a/modules/netdb +++ b/modules/netdb @@ -6,6 +6,7 @@ lib/netdb.in.h m4/netdb_h.m4 Depends-on: +c++defs include_next arg-nonnull warn-on-use @@ -19,7 +20,7 @@ BUILT_SOURCES += netdb.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -netdb.h: netdb.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(WARN_ON_USE_H) +netdb.h: netdb.in.h $(top_builddir)/config.status $(CXXDEFS_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' \ @@ -34,6 +35,7 @@ netdb.h: netdb.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(WARN_ON_USE -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \ -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \ -e 's|@''REPLACE_GAI_STRERROR''@|$(REPLACE_GAI_STRERROR)|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)' \ < $(srcdir)/netdb.in.h; \ -- cgit v1.2.1 From e82aa5d1a3c12cf3bbc7148182a2d1af33aa209d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 29 Apr 2011 18:58:43 +0200 Subject: maint.mk: remove unused VC-tag variable * top/maint.mk (VC-tag): Remove unused variable. --- ChangeLog | 5 +++++ top/maint.mk | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 874a093e3a..6dc12448d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-29 Jim Meyering + + maint.mk: remove unused VC-tag variable + * top/maint.mk (VC-tag): Remove unused variable. + 2011-04-29 Bruno Haible netdb: fix gai_strerror replacements diff --git a/top/maint.mk b/top/maint.mk index 47cb44ee26..8727b3f4c8 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -33,7 +33,6 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)' GIT = git VC = $(GIT) -VC-tag = git tag -s -m '$(VERSION)' 'v$(VERSION)' -u '$(gpg_key_ID)' VC_LIST = $(build_aux)/vc-list-files -C $(srcdir) -- cgit v1.2.1 From aaf62c6aa8069d9a79fae845e1cab86755e5c763 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 28 Apr 2011 17:25:49 -0600 Subject: quotearg: avoid uninitialized variable use Coverity correctly deduced: Error: UNINIT: m4-1.4.16/lib/quotearg.c:171: var_decl: Declaring variable "o" without initializer. m4-1.4.16/lib/quotearg.c:175: uninit_use: Using uninitialized value "o": field "o".right_quote is uninitialized. When custom_quoting_style was introduced in commit 12247f77, this method was not updated, and any caller that passed the new enum value to any of the existing quotearg_*style functions could trigger a crash from the uninitialized memory. That was already documented as unspecified behavior, though, so changing to an abort makes it easier to spot bad code that passes the wrong enum value, rather than waiting for the eventual bad memory dereference later on. Most callers of quotearg_*style were using quoting_style_args and quoting_style_vals to map strings to particular enum values, and custom_quoting_style is (intentionally) not covered by these arrays, so the pre-patch bug/post-patch abort are not possible with those callers. * lib/quotearg.c (quoting_options_from_style): Initialize remaining fields, and ensure that custom styles are only used via quoting_options rather than quoting_style. Signed-off-by: Eric Blake --- ChangeLog | 7 +++++++ lib/quotearg.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6dc12448d0..4c5aa5b92b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-29 Eric Blake + + quotearg: avoid uninitialized variable use + * lib/quotearg.c (quoting_options_from_style): Initialize + remaining fields, and ensure that custom styles are only used via + quoting_options rather than quoting_style. + 2011-04-29 Jim Meyering maint.mk: remove unused VC-tag variable diff --git a/lib/quotearg.c b/lib/quotearg.c index fb4955993e..da8ba1eac6 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -168,10 +168,10 @@ set_custom_quoting (struct quoting_options *o, static struct quoting_options quoting_options_from_style (enum quoting_style style) { - struct quoting_options o; + struct quoting_options o = { 0 }; + if (style == custom_quoting_style) + abort (); o.style = style; - o.flags = 0; - memset (o.quote_these_too, 0, sizeof o.quote_these_too); return o; } -- cgit v1.2.1 From 30ec6bd4ff3f1d8a71f922b1eacc9d4f8f9c4b55 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 29 Apr 2011 21:59:21 +0200 Subject: announce-gen: indent with spaces, not TABs * build-aux/announce-gen: Convert all TABs to spaces, to match the style of most other files in gnulib. --- ChangeLog | 6 +++ build-aux/announce-gen | 142 ++++++++++++++++++++++++------------------------- 2 files changed, 77 insertions(+), 71 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c5aa5b92b..bda120435e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-29 Jim Meyering + + announce-gen: indent with spaces, not TABs + * build-aux/announce-gen: Convert all TABs to spaces, to match + the style of most other files in gnulib. + 2011-04-29 Eric Blake quotearg: avoid uninitialized variable use diff --git a/build-aux/announce-gen b/build-aux/announce-gen index 488692681e..7adfef2188 100755 --- a/build-aux/announce-gen +++ b/build-aux/announce-gen @@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' if 0; # Generate a release announcement message. -my $VERSION = '2010-05-03 20:17'; # UTC +my $VERSION = '2011-04-29 19:58'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -106,7 +106,7 @@ sub sizes (@) my $t = `$cmd`; # FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS $@ - and (warn "$ME: command failed: `$cmd'\n"), $fail = 1; + and (warn "$ME: command failed: `$cmd'\n"), $fail = 1; chomp $t; $t =~ s/^([\d.]+[MkK]).*/${1}B/; $res{$f} = $t; @@ -128,12 +128,12 @@ sub print_locations ($\@\%@) foreach my $url (@{$url}) { for my $file (@file) - { - print " $url/$file"; - print " (", $$size{$file}, ")" - if exists $$size{$file}; - print "\n"; - } + { + print " $url/$file"; + print " (", $$size{$file}, ")" + if exists $$size{$file}; + print "\n"; + } } print "\n"; } @@ -154,17 +154,17 @@ sub print_checksums (@) foreach my $meth (qw (md5 sha1)) { foreach my $f (@file) - { - open IN, '<', $f - or die "$ME: $f: cannot open for reading: $!\n"; - binmode IN; - my $dig = - ($meth eq 'md5' - ? Digest::MD5->new->addfile(*IN)->hexdigest - : Digest::SHA1->new->addfile(*IN)->hexdigest); - close IN; - print "$dig $f\n"; - } + { + open IN, '<', $f + or die "$ME: $f: cannot open for reading: $!\n"; + binmode IN; + my $dig = + ($meth eq 'md5' + ? Digest::MD5->new->addfile(*IN)->hexdigest + : Digest::SHA1->new->addfile(*IN)->hexdigest); + close IN; + print "$dig $f\n"; + } } print "\n"; } @@ -194,24 +194,24 @@ sub print_news_deltas ($$$) while (defined (my $line = )) { if ( ! $in_items) - { - # Match lines like these: - # * Major changes in release 5.0.1: - # * Noteworthy changes in release 6.6 (2006-11-22) [stable] - $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o - or next; - $in_items = 1; - print $line; - } + { + # Match lines like these: + # * Major changes in release 5.0.1: + # * Noteworthy changes in release 6.6 (2006-11-22) [stable] + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o + or next; + $in_items = 1; + print $line; + } else - { - # This regexp must not match version numbers in NEWS items. - # For example, they might well say `introduced in 4.5.5', - # and we don't want that to match. - $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o - and last; - print $line; - } + { + # This regexp must not match version numbers in NEWS items. + # For example, they might well say `introduced in 4.5.5', + # and we don't want that to match. + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o + and last; + print $line; + } } close NEWS; @@ -229,8 +229,8 @@ sub print_changelog_deltas ($$) use File::Find; my @changelog; find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS' - and push @changelog, $File::Find::name}}, - '.'); + and push @changelog, $File::Find::name}}, + '.'); # If there are no ChangeLog files, we're done. @changelog @@ -255,7 +255,7 @@ sub print_changelog_deltas ($$) my $dot_slash = $d eq '.' ? $d : "./$d"; my $target = "$dot_slash/ChangeLog"; delete $changelog{$target} - and push @reordered, $target; + and push @reordered, $target; } # Append any remaining ChangeLog files. @@ -282,20 +282,20 @@ sub print_changelog_deltas ($$) while (defined (my $line = )) { if ($line =~ /^\+\+\+ /) - { - my $separator = "*"x70 ."\n"; - $line =~ s///; - $line =~ s/\s.*//; - $prev_printed_line_empty - or print "\n"; - print $separator, $line, $separator; - } + { + my $separator = "*"x70 ."\n"; + $line =~ s///; + $line =~ s/\s.*//; + $prev_printed_line_empty + or print "\n"; + print $separator, $line, $separator; + } elsif ($line =~ /^\+/) - { - $line =~ s///; - print $line; - $prev_printed_line_empty = ($line =~ /^$/); - } + { + $line =~ s///; + print $line; + $prev_printed_line_empty = ($line =~ /^$/); + } } close DIFF; @@ -316,25 +316,25 @@ sub get_tool_versions ($$) foreach my $t (@$tool_list) { if ($t eq 'gnulib') - { - push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version; - next; - } + { + push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version; + next; + } # Assume that the last "word" on the first line of # `tool --version` output is the version string. my ($first_line, undef) = split ("\n", `$t --version`); if ($first_line =~ /.* (\d[\w.-]+)$/) - { - $t = ucfirst $t; - push @tool_version_pair, "$t $1"; - } + { + $t = ucfirst $t; + push @tool_version_pair, "$t $1"; + } else - { - defined $first_line - and $first_line = ''; - warn "$ME: $t: unexpected --version output\n:$first_line"; - $fail = 1; - } + { + defined $first_line + and $first_line = ''; + warn "$ME: $t: unexpected --version output\n:$first_line"; + $fail = 1; + } } $fail @@ -398,8 +398,8 @@ sub get_tool_versions ($$) grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version and (warn "$ME: when specifying gnulib as a tool, you must also specify\n" - . "--gnulib-version=V, where V is the result of running git describe\n" - . "in the gnulib source directory.\n"), $fail = 1; + . "--gnulib-version=V, where V is the result of running git describe\n" + . "in the gnulib source directory.\n"), $fail = 1; exists $valid_release_types{$release_type} or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1; @@ -448,11 +448,11 @@ EOF print_locations ("compressed sources", @url_dir_list, %size, @tarballs); -f $xd and print_locations ("xdelta diffs (useful? if so, " - . "please tell bug-gnulib\@gnu.org)", - @url_dir_list, %size, $xd); + . "please tell bug-gnulib\@gnu.org)", + @url_dir_list, %size, $xd); my @sig_files = map { "$_.sig" } @tarballs; print_locations ("GPG detached signatures[*]", @url_dir_list, %size, - @sig_files); + @sig_files); if ($url_dir_list[0] =~ "gnu\.org") { print "To reduce load on the main server, use a mirror listed at:\n"; -- cgit v1.2.1 From 86e6a68e249fd4e4af6cebbfddfc52b33d3f8b37 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 29 Apr 2011 22:04:07 +0200 Subject: vc-list-files: indent with spaces, not TABs * build-aux/vc-list-files: Convert leading TABs to spaces, to match the style of most other files in gnulib. --- ChangeLog | 4 ++++ build-aux/vc-list-files | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index bda120435e..cbd314e4b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-04-29 Jim Meyering + vc-list-files: indent with spaces, not TABs + * build-aux/vc-list-files: Convert leading TABs to spaces, + to match the style of most other files in gnulib. + announce-gen: indent with spaces, not TABs * build-aux/announce-gen: Convert all TABs to spaces, to match the style of most other files in gnulib. diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files index 9bb6fe6d3d..2fced256bf 100755 --- a/build-aux/vc-list-files +++ b/build-aux/vc-list-files @@ -2,7 +2,7 @@ # List version-controlled file names. # Print a version string. -scriptversion=2010-04-23.22; # UTC +scriptversion=2011-04-29.20; # UTC # Copyright (C) 2006-2011 Free Software Foundation, Inc. @@ -94,12 +94,12 @@ elif test -d CVS; then eval cvsu --find --types=AFGM '"$dir"' $postprocess else eval awk -F/ \''{ \ - if (!$1 && $3 !~ /^-/) { \ - f=FILENAME; \ - if (f ~ /CVS\/Entries$/) \ - f = substr(f, 1, length(f)-11); \ - print f $2; \ - }}'\'' \ + if (!$1 && $3 !~ /^-/) { \ + f=FILENAME; \ + if (f ~ /CVS\/Entries$/) \ + f = substr(f, 1, length(f)-11); \ + print f $2; \ + }}'\'' \ `find "$dir" -name Entries -print` /dev/null' $postprocess fi elif test -d .svn; then -- cgit v1.2.1 From 361a1a46831e3df5f8fce02c4805a3501da410f7 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Fri, 29 Apr 2011 22:04:46 +0100 Subject: announce-gen: cosmetic improvement * build-aux/announce-gen: Strip any leading ./ from the NEWS file name. --- ChangeLog | 5 +++++ build-aux/announce-gen | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cbd314e4b9..b4b6696704 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-29 Reuben Thomas + + announce-gen: cosmetic improvement + * build-aux/announce-gen: Strip any leading ./ from the NEWS file name. + 2011-04-29 Jim Meyering vc-list-files: indent with spaces, not TABs diff --git a/build-aux/announce-gen b/build-aux/announce-gen index 7adfef2188..233ee9b959 100755 --- a/build-aux/announce-gen +++ b/build-aux/announce-gen @@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' if 0; # Generate a release announcement message. -my $VERSION = '2011-04-29 19:58'; # UTC +my $VERSION = '2011-04-29 21:01'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -180,7 +180,10 @@ sub print_news_deltas ($$$) { my ($news_file, $prev_version, $curr_version) = @_; - print "\n$news_file\n\n"; + my $news_name = $news_file; + $news_name =~ s|^\./||; + + print "\n$news_name\n\n"; # Print all lines from $news_file, starting with the first one # that mentions $curr_version up to but not including -- cgit v1.2.1 From 73cd9199c38be25395d59a839f753929c50a54c7 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 30 Apr 2011 08:00:47 +0200 Subject: maint: indent ChangeLog with TAB consistently --- ChangeLog | 64 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4b6696704..9b56d719e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1682,7 +1682,7 @@ Reported by Tom G. Christensen . 2011-03-20 Paul Eggert - Bruno Haible + Bruno Haible socklen: do not depend on sys_socket While trying to modify Emacs to use gnulib's socklen module, @@ -1719,7 +1719,7 @@ * m4/socklen.m4: Update comment about platforms. 2011-03-19 Paul Eggert - Bruno Haible + Bruno Haible inet_ntop, inet_pton: Simplify. * modules/inet_ntop (Depends-on): Remove socklen, since sys_socket is @@ -1728,7 +1728,7 @@ * lib/arpa_inet.in.h: Adjust comment. 2011-03-19 Paul Eggert - Bruno Haible + Bruno Haible netdb: Simplify. * modules/netdb (Depends-on): Remove socklen, since sys_socket is @@ -1817,7 +1817,7 @@ (check): Depend on the new variable, not the hard-coded list. 2011-03-13 Bastien Roucariès - Bruno Haible + Bruno Haible passfd module, part 3. * lib/passfd.h (recvfd): Add a flags argument. @@ -1993,8 +1993,8 @@ Suggested by Simon Josefsson . 2011-02-28 Corinna Vinschen (tiny change) - Charles Wilson (tiny change) - Bruno Haible (tiny change) + Charles Wilson (tiny change) + Bruno Haible (tiny change) On Cygwin, use /proc file system instead of win32 API. * lib/relocatable.c: On Cygwin, use file names from /proc, rather than @@ -3841,7 +3841,7 @@ * lib/strerror_r.c (strerror_r): Fix return type. 2011-01-21 Pádraig Brady - Bruno Haible + Bruno Haible uN_strstr: New unit tests. * modules/unistr/u8-strstr-tests: New file. @@ -3853,7 +3853,7 @@ * tests/unistr/test-u32-strstr.c: New file. 2011-01-21 Pádraig Brady - Bruno Haible + Bruno Haible Make uN_strstr functions O(n) worst-case. * lib/unistr/u-strstr.h (FUNC): In the 8-bit case, use strstr. In the @@ -3877,7 +3877,7 @@ (configure.ac): Update required libunistring version. 2011-01-21 Pádraig Brady - Bruno Haible + Bruno Haible Prepare for faster uN_strstr functions. * lib/str-kmp.h: Support definable UNITs. @@ -5402,7 +5402,7 @@ http://sourceware.org/bugzilla/show_bug.cgi?id=12348 2010-12-28 Bruno Haible - Paul Eggert + Paul Eggert linkat: Make implementation robust against system behaviour variations. * m4/link-follow.m4 (gl_FUNC_LINK_FOLLOWS_SYMLINK): Define @@ -6435,7 +6435,7 @@ relate to each other. 2010-12-15 Pádraig Brady - Bruno Haible + Bruno Haible Improve cross-compilation guesses for uClibc. * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE): When cross-compiling, assume @@ -6645,7 +6645,7 @@ * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Fix typo. 2010-11-28 Bruno Haible - Paul Eggert + Paul Eggert Tests for module 'getdomainname'. * modules/getdomainname-tests: New file. @@ -6653,7 +6653,7 @@ tests/test-gethostname.c. 2010-11-28 Bruno Haible - Paul Eggert + Paul Eggert getdomainname: Use the system function when possible. * lib/unistd.in.h: Include , for getdomainname's declaration. @@ -8075,7 +8075,7 @@ styles, and some unnecessary blank lines. 2010-10-03 Bruno Haible - Joachim Schmitz (tiny change) + Joachim Schmitz (tiny change) acl: Add support for ACLs on NonStop Kernel. * m4/acl.m4 (gl_FUNC_ACL): For Solaris, test for facl(), not for acl(). @@ -8347,7 +8347,7 @@ Reported by Paul Eggert. 2010-09-22 Pádraig Brady - Bruno Haible + Bruno Haible Fix endless loop in mbmemcasecoll. * lib/mbmemcasecoll.c (apply_towlower): When mbrtowc returns 0, copy 1 @@ -9123,7 +9123,7 @@ Reported by Johan Hattne . 2010-08-29 Ralf Wildenhues - Bruno Haible + Bruno Haible Make the module 'realloc-gnu' work again on AIX and OSF/1. * m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Define HAVE_REALLOC_GNU instead @@ -9134,7 +9134,7 @@ * modules/realloc-gnu (configure.ac): Use gl_MODULE_INDICATOR. 2010-08-29 Ralf Wildenhues - Bruno Haible + Bruno Haible Make the module 'calloc-gnu' work again on AIX and OSF/1. * m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Define HAVE_CALLOC_GNU instead of @@ -9145,7 +9145,7 @@ * modules/calloc-gnu (configure.ac): Invoke gl_MODULE_INDICATOR. 2010-08-29 Ralf Wildenhues - Bruno Haible + Bruno Haible Make the module 'malloc-gnu' work again on AIX and OSF/1. * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Define HAVE_MALLOC_GNU instead of @@ -9221,8 +9221,8 @@ * lib/read-file.c (fread_file): Shrink the buffer at the end. 2010-08-28 Giuseppe Scrivano - Eric Blake - Bruno Haible + Eric Blake + Bruno Haible read-file: Avoid memory reallocations with regular files. * lib/read-file.c: Include , , . @@ -9560,7 +9560,7 @@ (Match-end-of-line Operator): Mention 'not_eol'. 2010-08-14 Brian Gough - Bruno Haible + Bruno Haible git-merge-changelog: add doc relating to use with bzr and hg. * lib/git-merge-changelog.c: Add comments regarding bzr, hg, diff3. @@ -10251,7 +10251,7 @@ * modules/strtod-tests (Makefile.am): Likewise. 2010-07-11 Pádraig Brady - Bruno Haible + Bruno Haible unistr/u8-strchr: Optimize ASCII argument case. * lib/unistr/u8-strchr.c (u8_strchr): For ASCII arguments, use strchr. @@ -10609,7 +10609,7 @@ * tests/test-inttostr.c: New file. Test these functions. 2010-06-09 Ben Pfaff - Bruno Haible + Bruno Haible Add "Extending Gnulib" chapter to manual. * doc/gnulib.texi (Writing Modules): Add cross-reference to new @@ -10649,7 +10649,7 @@ Suggested by Eric Blake. 2010-06-04 Martin Lambers - Bruno Haible + Bruno Haible havelib: Allow library names with '+' characters. * m4/lib-link.m4 (AC_LIB_LINKFLAGS, AC_LIB_HAVE_LINKFLAGS, @@ -10905,7 +10905,7 @@ * modules/libunistring-optional (Files): Likewise. 2010-05-18 Paolo Bonzini - Bruno Haible + Bruno Haible New module 'libunistring-optional'. * modules/libunistring-optional: New file. @@ -12457,7 +12457,7 @@ (func_import): Set the excl_*_tests variables to empty. 2010-04-25 Simon Josefsson - Bruno Haible + Bruno Haible Work around a MacOS X 10.4 bug with openpty. * doc/glibc-functions/openpty.texi: Mention the MacOS X 10.4 bug. @@ -12526,7 +12526,7 @@ EPIPE. 2010-04-20 Simon Josefsson - Bruno Haible + Bruno Haible visibility: Don't use -fvisibility if it leads to a warning. * m4/visibility.m4 (gl_VISIBILITY): Check whether -Werror is usable. If @@ -12562,7 +12562,7 @@ Reported by Ian Beckwith . 2010-04-18 Andreas Gruenbacher - Bruno Haible + Bruno Haible diffseq: Accommodate use-case with abstract arrays. * lib/diffseq.h (struct context): Remove xvec, yvec fields if ELEMENT @@ -12713,7 +12713,7 @@ declared. 2010-04-11 Paolo Bonzini - Bruno Haible + Bruno Haible libunistring: Improve configure output. * m4/libunistring.m4 (gl_LIBUNISTRING): Check for libiconv first. @@ -13136,14 +13136,14 @@ Reported by Hauke Fath . 2010-04-04 Hauke Fath (tiny change) - Bruno Haible + Bruno Haible wchar: Port to NetBSD 1.5. * lib/wchar.in.h (WEOF): Provide fallback also when wint_t exists. * lib/wctype.in.h (WEOF): Likewise. 2010-04-04 Hauke Fath (tiny change) - Bruno Haible + Bruno Haible Port extended stdio to NetBSD 1.5. * lib/stdio-impl.h [NetBSD]: Include . @@ -13924,7 +13924,7 @@ $(LIBSOCKET). 2010-03-28 Bruno Haible - Ralf Wildenhues + Ralf Wildenhues lib-ignore: Determine different options for different compilers. * m4/lib-ignore.m4 (gl_IGNORE_UNUSED_LIBRARIES): Set a variable which -- cgit v1.2.1 From 2953da14ede8686f2ab85440a0b7cc928953f625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Sat, 30 Apr 2011 00:16:01 +0100 Subject: manywarnings: add -Wno-missing-field-initializers if needed * m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Add the above option if it's needed to allow initialization with { 0, }, which is the case with GCC before version 4.7 --- ChangeLog | 6 ++++++ m4/manywarnings.m4 | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9b56d719e0..1ee541c83e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-30 Pádraig Brady + + manywarnings: add -Wno-missing-field-initializers if needed. + * m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Add the above + option if it's needed to allow initialization with { 0, } + 2011-04-29 Reuben Thomas announce-gen: cosmetic improvement diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index e928821952..88af0a6923 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 @@ -35,6 +35,49 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT], # using gl_WARN_ADD if you want to make sure your gcc understands it. AC_DEFUN([gl_MANYWARN_ALL_GCC], [ + dnl First, check if -Wno-missing-field-initializers is needed. + dnl -Wmissing-field-initializers is implied by -W, but that issues + dnl warnings with GCC version before 4.7, for the common idiom + dnl of initializing types on the stack to zero, using { 0, } + AC_REQUIRE([AC_PROG_CC]) + if test -n "$GCC"; then + + dnl First, check -W -Werror -Wno-missing-field-initializers is supported + dnl with the current $CC $CFLAGS $CPPFLAGS. + AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) + AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [gl_cv_cc_nomfi_supported=yes], + [gl_cv_cc_nomfi_supported=no]) + CFLAGS="$gl_save_CFLAGS"]) + AC_MSG_RESULT([$gl_cv_cc_nomfi_supported]) + + if test "$gl_cv_cc_nomfi_supported" = yes; then + dnl Now check whether -Wno-missing-field-initializers is needed + dnl for the { 0, } construct. + AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed]) + AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[void f (void) + { + typedef struct { int a; int b; } s_t; + s_t s1 = { 0, }; + } + ]], + [[]])], + [gl_cv_cc_nomfi_needed=no], + [gl_cv_cc_nomfi_needed=yes]) + CFLAGS="$gl_save_CFLAGS"]) + AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) + fi + fi + gl_manywarn_set= for gl_manywarn_item in \ -Wall \ @@ -104,5 +147,11 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], ; do gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" done - $1=$gl_manywarn_set + + # Disable the missing-field-initializers warning if needed + if test "$gl_cv_cc_nomfi_needed" = yes; then + gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" + fi + + $1=$gl_manywarn_set ]) -- cgit v1.2.1 From 12a4891e3156b704219f19fe21e922fc22b242e4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 Apr 2011 11:54:12 +0200 Subject: netdb: Fix invalid C syntax. * lib/netdb.in.h (AI_ADDRCONFIG): Fix comment syntax. --- ChangeLog | 5 +++++ lib/netdb.in.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1ee541c83e..079206e1cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-30 Bruno Haible + + netdb: Fix invalid C syntax. + * lib/netdb.in.h (AI_ADDRCONFIG): Fix comment syntax. + 2011-04-30 Pádraig Brady manywarnings: add -Wno-missing-field-initializers if needed. diff --git a/lib/netdb.in.h b/lib/netdb.in.h index c1cf671d59..8d575c489c 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -98,7 +98,7 @@ struct addrinfo # define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */ # endif # ifndef AI_ADDRCONFIG -# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose +# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose \ returned address type. */ # endif -- cgit v1.2.1 From a3e446b9d246628dd4145535e101aa541db2ffae Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 Apr 2011 13:10:33 +0200 Subject: manywarnings: fix indentation * m4/manywarnings.m4: Indent by 2 spaces consistently. --- ChangeLog | 5 ++ m4/manywarnings.m4 | 221 +++++++++++++++++++++++++++-------------------------- 2 files changed, 116 insertions(+), 110 deletions(-) diff --git a/ChangeLog b/ChangeLog index 079206e1cf..6a9857e767 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-30 Bruno Haible + + manywarnings: fix indentation + * m4/manywarnings.m4: Indent by 2 spaces consistently. + 2011-04-30 Bruno Haible netdb: Fix invalid C syntax. diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index 88af0a6923..67db064a9f 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 @@ -35,123 +35,124 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT], # using gl_WARN_ADD if you want to make sure your gcc understands it. AC_DEFUN([gl_MANYWARN_ALL_GCC], [ - dnl First, check if -Wno-missing-field-initializers is needed. - dnl -Wmissing-field-initializers is implied by -W, but that issues - dnl warnings with GCC version before 4.7, for the common idiom - dnl of initializing types on the stack to zero, using { 0, } - AC_REQUIRE([AC_PROG_CC]) - if test -n "$GCC"; then + dnl First, check if -Wno-missing-field-initializers is needed. + dnl -Wmissing-field-initializers is implied by -W, but that issues + dnl warnings with GCC version before 4.7, for the common idiom + dnl of initializing types on the stack to zero, using { 0, } + AC_REQUIRE([AC_PROG_CC]) + if test -n "$GCC"; then - dnl First, check -W -Werror -Wno-missing-field-initializers is supported - dnl with the current $CC $CFLAGS $CPPFLAGS. - AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) - AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], [[]])], - [gl_cv_cc_nomfi_supported=yes], - [gl_cv_cc_nomfi_supported=no]) - CFLAGS="$gl_save_CFLAGS"]) - AC_MSG_RESULT([$gl_cv_cc_nomfi_supported]) + dnl First, check -W -Werror -Wno-missing-field-initializers is supported + dnl with the current $CC $CFLAGS $CPPFLAGS. + AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) + AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [gl_cv_cc_nomfi_supported=yes], + [gl_cv_cc_nomfi_supported=no]) + CFLAGS="$gl_save_CFLAGS"]) + AC_MSG_RESULT([$gl_cv_cc_nomfi_supported]) - if test "$gl_cv_cc_nomfi_supported" = yes; then - dnl Now check whether -Wno-missing-field-initializers is needed - dnl for the { 0, } construct. - AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed]) - AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [ - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -W -Werror" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[void f (void) - { - typedef struct { int a; int b; } s_t; - s_t s1 = { 0, }; - } - ]], - [[]])], - [gl_cv_cc_nomfi_needed=no], - [gl_cv_cc_nomfi_needed=yes]) - CFLAGS="$gl_save_CFLAGS"]) - AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) - fi - fi + if test "$gl_cv_cc_nomfi_supported" = yes; then + dnl Now check whether -Wno-missing-field-initializers is needed + dnl for the { 0, } construct. + AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed]) + AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[void f (void) + { + typedef struct { int a; int b; } s_t; + s_t s1 = { 0, }; + } + ]], + [[]])], + [gl_cv_cc_nomfi_needed=no], + [gl_cv_cc_nomfi_needed=yes]) + CFLAGS="$gl_save_CFLAGS" + ]) + AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) + fi + fi - gl_manywarn_set= - for gl_manywarn_item in \ - -Wall \ - -W \ - -Wformat-y2k \ - -Wformat-nonliteral \ - -Wformat-security \ - -Winit-self \ - -Wmissing-include-dirs \ - -Wswitch-default \ - -Wswitch-enum \ - -Wunused \ - -Wunknown-pragmas \ - -Wstrict-aliasing \ - -Wstrict-overflow \ - -Wsystem-headers \ - -Wfloat-equal \ - -Wtraditional \ - -Wtraditional-conversion \ - -Wdeclaration-after-statement \ - -Wundef \ - -Wshadow \ - -Wunsafe-loop-optimizations \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wc++-compat \ - -Wcast-qual \ - -Wcast-align \ - -Wwrite-strings \ - -Wconversion \ - -Wsign-conversion \ - -Wlogical-op \ - -Waggregate-return \ - -Wstrict-prototypes \ - -Wold-style-definition \ - -Wmissing-prototypes \ - -Wmissing-declarations \ - -Wmissing-noreturn \ - -Wmissing-format-attribute \ - -Wpacked \ - -Wpadded \ - -Wredundant-decls \ - -Wnested-externs \ - -Wunreachable-code \ - -Winline \ - -Winvalid-pch \ - -Wlong-long \ - -Wvla \ - -Wvolatile-register-var \ - -Wdisabled-optimization \ - -Wstack-protector \ - -Woverlength-strings \ - -Wbuiltin-macro-redefined \ - -Wmudflap \ - -Wpacked-bitfield-compat \ - -Wsync-nand \ - ; do + gl_manywarn_set= + for gl_manywarn_item in \ + -Wall \ + -W \ + -Wformat-y2k \ + -Wformat-nonliteral \ + -Wformat-security \ + -Winit-self \ + -Wmissing-include-dirs \ + -Wswitch-default \ + -Wswitch-enum \ + -Wunused \ + -Wunknown-pragmas \ + -Wstrict-aliasing \ + -Wstrict-overflow \ + -Wsystem-headers \ + -Wfloat-equal \ + -Wtraditional \ + -Wtraditional-conversion \ + -Wdeclaration-after-statement \ + -Wundef \ + -Wshadow \ + -Wunsafe-loop-optimizations \ + -Wpointer-arith \ + -Wbad-function-cast \ + -Wc++-compat \ + -Wcast-qual \ + -Wcast-align \ + -Wwrite-strings \ + -Wconversion \ + -Wsign-conversion \ + -Wlogical-op \ + -Waggregate-return \ + -Wstrict-prototypes \ + -Wold-style-definition \ + -Wmissing-prototypes \ + -Wmissing-declarations \ + -Wmissing-noreturn \ + -Wmissing-format-attribute \ + -Wpacked \ + -Wpadded \ + -Wredundant-decls \ + -Wnested-externs \ + -Wunreachable-code \ + -Winline \ + -Winvalid-pch \ + -Wlong-long \ + -Wvla \ + -Wvolatile-register-var \ + -Wdisabled-optimization \ + -Wstack-protector \ + -Woverlength-strings \ + -Wbuiltin-macro-redefined \ + -Wmudflap \ + -Wpacked-bitfield-compat \ + -Wsync-nand \ + ; do gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" done - # The following are not documented in the manual but are included in - # output from gcc --help=warnings. - for gl_manywarn_item in \ - -Wattributes \ - -Wcoverage-mismatch \ - -Wmultichar \ - -Wunused-macros \ - ; do + # The following are not documented in the manual but are included in + # output from gcc --help=warnings. + for gl_manywarn_item in \ + -Wattributes \ + -Wcoverage-mismatch \ + -Wmultichar \ + -Wunused-macros \ + ; do gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" done - # Disable the missing-field-initializers warning if needed - if test "$gl_cv_cc_nomfi_needed" = yes; then - gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" - fi + # Disable the missing-field-initializers warning if needed + if test "$gl_cv_cc_nomfi_needed" = yes; then + gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" + fi - $1=$gl_manywarn_set + $1=$gl_manywarn_set ]) -- cgit v1.2.1 From c9b4d37004240533b0aab80806cc8539140e4fd1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 Apr 2011 13:19:55 +0200 Subject: sys_uio: Protect definition of 'struct iovec'. * lib/sys_uio.in.h (struct iovec): Avoid redefinition. In C++, define it as a C struct. --- ChangeLog | 6 ++++++ lib/sys_uio.in.h | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6a9857e767..b567940fb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-30 Bruno Haible + + sys_uio: Protect definition of 'struct iovec'. + * lib/sys_uio.in.h (struct iovec): Avoid redefinition. In C++, define + it as a C struct. + 2011-04-30 Bruno Haible manywarnings: fix indentation diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h index 175ee0fb6d..faad3de206 100644 --- a/lib/sys_uio.in.h +++ b/lib/sys_uio.in.h @@ -37,12 +37,24 @@ /* Get 'ssize_t'. */ # include +# ifdef __cplusplus +extern "C" { +# endif + +# if !GNULIB_defined_struct_iovec /* All known platforms that lack also lack any declaration of struct iovec in any other header. */ struct iovec { void *iov_base; size_t iov_len; }; +# define GNULIB_defined_struct_iovec 1 +# endif + +# ifdef __cplusplus +} +# endif + #endif #endif /* _GL_SYS_UIO_H */ -- cgit v1.2.1 From 95bbafdb715dcfdbe7f629e2411b300ccaa84db4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 Apr 2011 13:38:43 +0200 Subject: sys_socket: Ensure 'struct iovec' definition. * lib/sys_socket.in.h: Include also on platforms that have . * doc/posix-headers/sys_socket.texi: Mention the OpenBSD problem. --- ChangeLog | 7 +++++++ doc/posix-headers/sys_socket.texi | 3 +++ lib/sys_socket.in.h | 9 ++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b567940fb7..987b46e681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-30 Bruno Haible + + sys_socket: Ensure 'struct iovec' definition. + * lib/sys_socket.in.h: Include also on platforms that have + . + * doc/posix-headers/sys_socket.texi: Mention the OpenBSD problem. + 2011-04-30 Bruno Haible sys_uio: Protect definition of 'struct iovec'. diff --git a/doc/posix-headers/sys_socket.texi b/doc/posix-headers/sys_socket.texi index f80e542544..72fd688705 100644 --- a/doc/posix-headers/sys_socket.texi +++ b/doc/posix-headers/sys_socket.texi @@ -17,6 +17,9 @@ This header file is not self-contained on some platforms: it requires This header file does not define the type @code{socklen_t} on some platforms: HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS. @item +This header file does not define the type @code{struct iovec} on some platforms: +OpenBSD 4.4. +@item This header file is lacking the @code{SHUT_RD}, @code{SHUT_WR}, @code{SHUT_RDWR} macros on some platforms, despite having the @code{shutdown} functions: diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index f9e368b6ca..78026697bd 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -108,6 +108,12 @@ struct sockaddr_storage #endif +/* Get struct iovec. */ +/* But avoid namespace pollution on glibc systems. */ +#if ! defined __GLIBC__ +# include +#endif + #if @HAVE_SYS_SOCKET_H@ /* A platform that has . */ @@ -176,9 +182,6 @@ typedef int socklen_t; # endif -/* For struct iovec */ -# include - /* Rudimentary 'struct msghdr'; this works as long as you don't try to access msg_control or msg_controllen. */ struct msghdr { -- cgit v1.2.1 From 241bef9820b13a430987f9be926c7dc056aa7f38 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 Apr 2011 13:54:47 +0200 Subject: sys_uio: Make self-contained. * lib/sys_uio.in.h: Include before . * doc/posix-headers/sys_uio.texi: Mention the OpenBSD problem. --- ChangeLog | 6 ++++++ doc/posix-headers/sys_uio.texi | 4 ++++ lib/sys_uio.in.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 987b46e681..796a2ba10c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-30 Bruno Haible + + sys_uio: Make self-contained. + * lib/sys_uio.in.h: Include before . + * doc/posix-headers/sys_uio.texi: Mention the OpenBSD problem. + 2011-04-30 Bruno Haible sys_socket: Ensure 'struct iovec' definition. diff --git a/doc/posix-headers/sys_uio.texi b/doc/posix-headers/sys_uio.texi index bc4825400d..1f8c8a2c86 100644 --- a/doc/posix-headers/sys_uio.texi +++ b/doc/posix-headers/sys_uio.texi @@ -10,6 +10,10 @@ Portability problems fixed by Gnulib: @item This header file is missing on some platforms: mingw. +@item +This header file is not self-contained (it requires @code{} to be +included first) on some platforms: +OpenBSD 4.4. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h index faad3de206..0eaff612a3 100644 --- a/lib/sys_uio.in.h +++ b/lib/sys_uio.in.h @@ -24,6 +24,9 @@ #if @HAVE_SYS_UIO_H@ +/* On OpenBSD 4.4, assumes prior inclusion of . */ +# include + /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@ -- cgit v1.2.1 From 89d109384c64e703e2507b6ada5efc68bf651393 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 Apr 2011 14:05:52 +0200 Subject: passfd: Add comments. * lib/passfd.c: Add comments about platforms. --- ChangeLog | 5 +++++ lib/passfd.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 796a2ba10c..1c39c25664 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-30 Bruno Haible + + passfd: Add comments. + * lib/passfd.c: Add comments about platforms. + 2011-04-30 Bruno Haible sys_uio: Make self-contained. diff --git a/lib/passfd.c b/lib/passfd.c index 86c73760b5..945882045e 100644 --- a/lib/passfd.c +++ b/lib/passfd.c @@ -30,6 +30,12 @@ #include "cloexec.h" +/* The code that uses CMSG_FIRSTHDR is enabled on + Linux, MacOS X, FreeBSD, OpenBSD, NetBSD, AIX, OSF/1, Cygwin. + The code that uses HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS is enabled on + HP-UX, IRIX, Solaris. */ + +/* MSG_CMSG_CLOEXEC is defined only on Linux, as of 2011. */ #ifndef MSG_CMSG_CLOEXEC # define MSG_CMSG_CLOEXEC 0 #endif -- cgit v1.2.1 From 9d916bc07af4177e545d1a13aa3aadeaee03f6f6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 Apr 2011 14:53:35 +0200 Subject: New modules 'vfscanf', 'vscanf'. * modules/vfscanf: New file. * modules/vscanf: New file. * m4/stdio_h.m4 (gl_STDIO_H): Don't set GNULIB_VFSCANF, GNULIB_VSCANF here. * doc/posix-functions/vfscanf.texi: Mention module 'vfscanf'. * doc/posix-functions/vscanf.texi: Mention module 'vscanf'. --- ChangeLog | 10 ++++++++++ doc/posix-functions/vfscanf.texi | 4 ++-- doc/posix-functions/vscanf.texi | 4 ++-- m4/stdio_h.m4 | 4 +--- modules/vfscanf | 21 +++++++++++++++++++++ modules/vscanf | 21 +++++++++++++++++++++ 6 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 modules/vfscanf create mode 100644 modules/vscanf diff --git a/ChangeLog b/ChangeLog index 1c39c25664..70a9b828f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-04-30 Bruno Haible + + New modules 'vfscanf', 'vscanf'. + * modules/vfscanf: New file. + * modules/vscanf: New file. + * m4/stdio_h.m4 (gl_STDIO_H): Don't set GNULIB_VFSCANF, GNULIB_VSCANF + here. + * doc/posix-functions/vfscanf.texi: Mention module 'vfscanf'. + * doc/posix-functions/vscanf.texi: Mention module 'vscanf'. + 2011-04-30 Bruno Haible passfd: Add comments. diff --git a/doc/posix-functions/vfscanf.texi b/doc/posix-functions/vfscanf.texi index bbdfe06e41..d051e6d0c7 100644 --- a/doc/posix-functions/vfscanf.texi +++ b/doc/posix-functions/vfscanf.texi @@ -4,9 +4,9 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vfscanf.html} -Gnulib module: stdio, nonblocking +Gnulib module: vfscanf, nonblocking -Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: +Portability problems fixed by Gnulib module @code{vfscanf}, together with module @code{nonblocking}: @itemize @item When reading from a non-blocking pipe whose buffer is empty, this function diff --git a/doc/posix-functions/vscanf.texi b/doc/posix-functions/vscanf.texi index 0568ab45c4..feff03ac5c 100644 --- a/doc/posix-functions/vscanf.texi +++ b/doc/posix-functions/vscanf.texi @@ -4,9 +4,9 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vscanf.html} -Gnulib module: stdio, nonblocking +Gnulib module: vscanf, nonblocking -Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}: +Portability problems fixed by Gnulib module @code{vscanf}, together with module @code{nonblocking}: @itemize @item When reading from a non-blocking pipe whose buffer is empty, this function diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 8b013c2f35..a8326f3c34 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 36 +# stdio_h.m4 serial 37 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,8 +14,6 @@ AC_DEFUN([gl_STDIO_H], dnl likely needs them. GNULIB_FSCANF=1 GNULIB_SCANF=1 - GNULIB_VFSCANF=1 - GNULIB_VSCANF=1 GNULIB_FGETC=1 GNULIB_GETC=1 GNULIB_GETCHAR=1 diff --git a/modules/vfscanf b/modules/vfscanf new file mode 100644 index 0000000000..c2d6a8d35d --- /dev/null +++ b/modules/vfscanf @@ -0,0 +1,21 @@ +Description: +vfscanf() function: parse formatted text from a stream + +Files: + +Depends-on: +stdio + +configure.ac: +gl_STDIO_MODULE_INDICATOR([vfscanf]) + +Makefile.am: + +Include: + + +License: +LGPL + +Maintainer: +Bruno Haible diff --git a/modules/vscanf b/modules/vscanf new file mode 100644 index 0000000000..cf1d8c2405 --- /dev/null +++ b/modules/vscanf @@ -0,0 +1,21 @@ +Description: +vscanf() function: parse formatted text from standard input + +Files: + +Depends-on: +stdio + +configure.ac: +gl_STDIO_MODULE_INDICATOR([vscanf]) + +Makefile.am: + +Include: + + +License: +LGPL + +Maintainer: +Bruno Haible -- cgit v1.2.1 From 0576d58775046f35e81c47b29fecad1daf516336 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 Apr 2011 15:00:45 +0200 Subject: netdb: Make it work in C++ mode. * lib/netdb.in.h (struct addrinfo): In C++, define as a C struct. (getaddrinfo, freeaddrinfo, getnameinfo): Use macros from c++defs module. * m4/netdb_h.m4 (gl_NETDB_MODULE_INDICATOR): Invoke gl_MODULE_INDICATOR_FOR_TESTS. * modules/netdb-tests (Depends-on): Add netdb-c++-tests. * modules/netdb-c++-tests: New file. * tests/test-netdb-c++.cc: New file. --- ChangeLog | 12 ++++++++++++ lib/netdb.in.h | 48 ++++++++++++++++++++++++++++++++++++++---------- m4/netdb_h.m4 | 4 +++- modules/netdb-c++-tests | 19 +++++++++++++++++++ modules/netdb-tests | 1 + tests/test-netdb-c++.cc | 42 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 115 insertions(+), 11 deletions(-) create mode 100644 modules/netdb-c++-tests create mode 100644 tests/test-netdb-c++.cc diff --git a/ChangeLog b/ChangeLog index 70a9b828f1..14b02e18d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-04-30 Bruno Haible + + netdb: Make it work in C++ mode. + * lib/netdb.in.h (struct addrinfo): In C++, define as a C struct. + (getaddrinfo, freeaddrinfo, getnameinfo): Use macros from c++defs + module. + * m4/netdb_h.m4 (gl_NETDB_MODULE_INDICATOR): Invoke + gl_MODULE_INDICATOR_FOR_TESTS. + * modules/netdb-tests (Depends-on): Add netdb-c++-tests. + * modules/netdb-c++-tests: New file. + * tests/test-netdb-c++.cc: New file. + 2011-04-30 Bruno Haible New modules 'vfscanf', 'vscanf'. diff --git a/lib/netdb.in.h b/lib/netdb.in.h index 8d575c489c..028dfbed36 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -54,6 +54,10 @@ # if !@HAVE_STRUCT_ADDRINFO@ +# ifdef __cplusplus +extern "C" { +# endif + # if !GNULIB_defined_struct_addrinfo /* Structure to contain information about address of a service provider. */ struct addrinfo @@ -69,6 +73,11 @@ struct addrinfo }; # define GNULIB_defined_struct_addrinfo 1 # endif + +# ifdef __cplusplus +} +# endif + # endif /* Possible values for `ai_flags' field in `addrinfo' structure. */ @@ -155,19 +164,29 @@ struct addrinfo socket addresses. For more details, see the POSIX:2001 specification . */ -extern int getaddrinfo (const char *restrict nodename, - const char *restrict servname, - const struct addrinfo *restrict hints, - struct addrinfo **restrict res) - _GL_ARG_NONNULL ((4)); +_GL_FUNCDECL_SYS (getaddrinfo, int, + (const char *restrict nodename, + const char *restrict servname, + const struct addrinfo *restrict hints, + struct addrinfo **restrict res) + _GL_ARG_NONNULL ((4))); # endif +_GL_CXXALIAS_SYS (getaddrinfo, int, + (const char *restrict nodename, + const char *restrict servname, + const struct addrinfo *restrict hints, + struct addrinfo **restrict res)); +_GL_CXXALIASWARN (getaddrinfo); # if !@HAVE_DECL_FREEADDRINFO@ /* Free `addrinfo' structure AI including associated storage. For more details, see the POSIX:2001 specification . */ -extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1)); +_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai) + _GL_ARG_NONNULL ((1))); # endif +_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai)); +_GL_CXXALIASWARN (freeaddrinfo); # if @REPLACE_GAI_STRERROR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -191,12 +210,21 @@ _GL_CXXALIASWARN (gai_strerror); /* Convert socket address to printable node and service names. For more details, see the POSIX:2001 specification . */ -extern int getnameinfo (const struct sockaddr *restrict sa, socklen_t salen, +_GL_FUNCDECL_SYS (getnameinfo, int, + (const struct sockaddr *restrict sa, socklen_t salen, + char *restrict node, socklen_t nodelen, + char *restrict service, socklen_t servicelen, + int flags) + _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on glibc systems, the seventh parameter is + unsigned int flags. */ +_GL_CXXALIAS_SYS_CAST (getnameinfo, int, + (const struct sockaddr *restrict sa, socklen_t salen, char *restrict node, socklen_t nodelen, char *restrict service, socklen_t servicelen, - int flags) - _GL_ARG_NONNULL ((1)); -# endif + int flags)); +_GL_CXXALIASWARN (getnameinfo); /* Possible flags for getnameinfo. */ # ifndef NI_NUMERICHOST diff --git a/m4/netdb_h.m4 b/m4/netdb_h.m4 index 259c7a3181..a54d6701b7 100644 --- a/m4/netdb_h.m4 +++ b/m4/netdb_h.m4 @@ -1,4 +1,4 @@ -# netdb_h.m4 serial 10 +# netdb_h.m4 serial 11 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -26,6 +26,8 @@ AC_DEFUN([gl_NETDB_MODULE_INDICATOR], dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_NETDB_H_DEFAULTS]) gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_NETDB_H_DEFAULTS], diff --git a/modules/netdb-c++-tests b/modules/netdb-c++-tests new file mode 100644 index 0000000000..af07dee341 --- /dev/null +++ b/modules/netdb-c++-tests @@ -0,0 +1,19 @@ +Files: +tests/test-netdb-c++.cc +tests/signature.h + +Status: +c++-test + +Depends-on: +ansi-c++-opt + +configure.ac: + +Makefile.am: +if ANSICXX +TESTS += test-netdb-c++ +check_PROGRAMS += test-netdb-c++ +test_netdb_c___SOURCES = test-netdb-c++.cc +test_netdb_c___LDADD = $(LDADD) $(GETADDRINFO_LIB) +endif diff --git a/modules/netdb-tests b/modules/netdb-tests index 1c3ae0b3e3..3590c94aaa 100644 --- a/modules/netdb-tests +++ b/modules/netdb-tests @@ -2,6 +2,7 @@ Files: tests/test-netdb.c Depends-on: +netdb-c++-tests configure.ac: diff --git a/tests/test-netdb-c++.cc b/tests/test-netdb-c++.cc new file mode 100644 index 0000000000..0dc47b9ae7 --- /dev/null +++ b/tests/test-netdb-c++.cc @@ -0,0 +1,42 @@ +/* Test of substitute in C++ mode. + Copyright (C) 2011 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 . */ + +/* Written by Bruno Haible , 2011. */ + +#define GNULIB_NAMESPACE gnulib +#include + +#include + +#include "signature.h" + + +#if GNULIB_TEST_GETADDRINFO +SIGNATURE_CHECK (GNULIB_NAMESPACE::getaddrinfo, int, + (const char *, const char *, const struct addrinfo *, + struct addrinfo **)); +SIGNATURE_CHECK (GNULIB_NAMESPACE::freeaddrinfo, void, (struct addrinfo *)); +SIGNATURE_CHECK (GNULIB_NAMESPACE::gai_strerror, const char *, (int)); +SIGNATURE_CHECK (GNULIB_NAMESPACE::getnameinfo, int, + (const struct sockaddr *, socklen_t, char *, socklen_t, + char *, socklen_t, int)); +#endif + + +int +main () +{ +} -- cgit v1.2.1 From a7982f61a1c485f7ea7dd6660b9c87d505ac9c47 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 Apr 2011 17:22:37 +0200 Subject: dup3: cleanup * lib/dup3.c: Remove old code, leftover from 2009-12-16. --- ChangeLog | 5 +++++ lib/dup3.c | 14 -------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 14b02e18d8..eb233f6061 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-30 Bruno Haible + + dup3: cleanup + * lib/dup3.c: Remove old code, leftover from 2009-12-16. + 2011-04-30 Bruno Haible netdb: Make it work in C++ mode. diff --git a/lib/dup3.c b/lib/dup3.c index 2f87da6167..7525142d7f 100644 --- a/lib/dup3.c +++ b/lib/dup3.c @@ -26,20 +26,6 @@ #include "binary-io.h" -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Native Woe32 API. */ - -# include - -/* Get declarations of the Win32 API functions. */ -# define WIN32_LEAN_AND_MEAN -# include - -/* Upper bound on getdtablesize(). See lib/getdtablesize.c. */ -# define OPEN_MAX_MAX 0x10000 - -#endif - int dup3 (int oldfd, int newfd, int flags) { -- cgit v1.2.1 From 096d7e1c450cff94143fd0681439ab42a3a63079 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sat, 30 Apr 2011 15:40:00 -0600 Subject: fclose: don't fail on non-seekable input stream On mingw, for a project that uses both sockets and streams, then fclose(stdin) when getting input from a terminal or pipe was spuriously failing. * modules/fclose (Depends-on): Add freading, fflush, fseeko. * lib/fclose.c (rpl_fclose): Skip fflush for non-seekable input, since fflush is allowed to fail in that case. Signed-off-by: Eric Blake --- ChangeLog | 7 +++++++ lib/fclose.c | 6 +++++- modules/fclose | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eb233f6061..3b5331c632 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-30 Eric Blake + + fclose: don't fail on non-seekable input stream + * modules/fclose (Depends-on): Add freading, fflush, fseeko. + * lib/fclose.c (rpl_fclose): Skip fflush for non-seekable input, + since fflush is allowed to fail in that case. + 2011-04-30 Bruno Haible dup3: cleanup diff --git a/lib/fclose.c b/lib/fclose.c index 1d7e85b668..bce409c960 100644 --- a/lib/fclose.c +++ b/lib/fclose.c @@ -22,6 +22,8 @@ #include #include +#include "freading.h" + /* Override fclose() to call the overridden close(). */ int @@ -30,7 +32,9 @@ rpl_fclose (FILE *fp) { int saved_errno = 0; - if (fflush (fp)) + /* We only need to flush the file if it is not reading or if it is + seekable. */ + if ((!freading (fp) || fseeko (fp, 0, SEEK_CUR) == 0) && fflush (fp)) saved_errno = errno; if (close (fileno (fp)) < 0 && saved_errno == 0) diff --git a/modules/fclose b/modules/fclose index 4f6f786910..d8727c3075 100644 --- a/modules/fclose +++ b/modules/fclose @@ -8,6 +8,9 @@ m4/fclose.m4 Depends-on: stdio close +fflush +freading +fseeko configure.ac: gl_FUNC_FCLOSE -- cgit v1.2.1 From 380f4f7ac5c8b293596e702368db2baa58754c52 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 1 May 2011 11:58:53 +0200 Subject: Revert "netdb: Fix invalid C syntax." commit from 2011-04-30. --- ChangeLog | 5 ----- lib/netdb.in.h | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b5331c632..324093710a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,11 +61,6 @@ manywarnings: fix indentation * m4/manywarnings.m4: Indent by 2 spaces consistently. -2011-04-30 Bruno Haible - - netdb: Fix invalid C syntax. - * lib/netdb.in.h (AI_ADDRCONFIG): Fix comment syntax. - 2011-04-30 Pádraig Brady manywarnings: add -Wno-missing-field-initializers if needed. diff --git a/lib/netdb.in.h b/lib/netdb.in.h index 028dfbed36..6951d3da49 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -107,7 +107,7 @@ struct addrinfo # define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */ # endif # ifndef AI_ADDRCONFIG -# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose \ +# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose returned address type. */ # endif -- cgit v1.2.1 From 7ec62f743ec2625caac6825edc04cd4b1c69bfe6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 1 May 2011 15:43:46 +0200 Subject: gnulib-tool: Reduce code duplication. * gnulib-tool (func_emit_autoconf_snippets): New function. (func_import, func_create_testdir): Use it. --- ChangeLog | 6 +++ gnulib-tool | 132 +++++++++++++++++++++++++++++------------------------------- 2 files changed, 70 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index 324093710a..9371ac406a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-05-01 Bruno Haible + + gnulib-tool: Reduce code duplication. + * gnulib-tool (func_emit_autoconf_snippets): New function. + (func_import, func_create_testdir): Use it. + 2011-04-30 Eric Blake fclose: don't fail on non-seekable input stream diff --git a/gnulib-tool b/gnulib-tool index 49221f022a..da8543555b 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -3360,6 +3360,65 @@ func_emit_initmacro_done () echo "])" } +# func_emit_autoconf_snippets modules verifier toplevel disable_libtool disable_gettext +# collects and emit the autoconf snippets of a set of modules. +# - modules is the list of modules. +# - verifier is one of func_verify_module, func_verify_nontests_module, +# func_verify_tests_module. It selects the subset of $modules to consider. +# - toplevel is true or false. 'false' means a subordinate use of gnulib-tool. +# - disable_libtool is true or false. It tells whether to disable libtool +# handling even if it has been specified through the command line options. +# - disable_gettext is true or false. It tells whether to disable AM_GNU_GETTEXT +# invocations. +# Input: +# - local_gnulib_dir from --local-dir +# - modcache true or false, from --cache-modules/--no-cache-modules +# - sed_replace_build_aux sed expression that replaces reference to build-aux +func_emit_autoconf_snippets () +{ + verifier="$2" + toplevel="$3" + disable_libtool="$4" + disable_gettext="$5" + for module in $1; do + eval $verifier # one of func_verify_module, func_verify_nontests_module, func_verify_tests_module. + if test -n "$module"; then + if { case $module in + gnumakefile | maintainer-makefile) + # These modules are meant to be used only in the top-level directory. + $toplevel ;; + *) + true ;; + esac + }; then + func_get_autoconf_snippet "$module" \ + | sed -e '/^$/d;' -e 's/^/ /' \ + -e "$sed_replace_build_aux" \ + | { if $disable_libtool; then + sed -e 's/\$gl_cond_libtool/false/g' \ + -e 's/gl_libdeps/gltests_libdeps/g' \ + -e 's/gl_ltlibdeps/gltests_ltlibdeps/g' + else + cat + fi + } \ + | { if $disable_gettext; then + sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' + else + cat + fi + } + if test "$module" = 'alloca' && test "$libtool" = true && ! $disable_libtool; then + echo 'changequote(,)dnl' + echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`' + echo 'changequote([, ])dnl' + echo 'AC_SUBST([LTALLOCA])' + fi + fi + fi + done +} + # func_import modules # Uses also the variables # - mode import or add-import or remove-import or update @@ -4541,22 +4600,7 @@ s,//*$,/,' echo " gl_m4_base='$m4base'" func_emit_initmacro_start $macro_prefix echo " gl_source_base='$sourcebase'" - for module in $main_modules; do - func_verify_module - if test -n "$module"; then - echo " # Code from module $module:" - func_get_autoconf_snippet "$module" \ - | sed -e '/^$/d;' -e 's/^/ /' \ - -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \ - -e "$sed_replace_build_aux" - if test "$module" = 'alloca' && test "$libtool" = true; then - echo 'changequote(,)dnl' - echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`' - echo 'changequote([, ])dnl' - echo 'AC_SUBST([LTALLOCA])' - fi - fi - done + func_emit_autoconf_snippets "$main_modules" func_verify_module true false true echo " # End of code from modules" func_emit_initmacro_end $macro_prefix echo " gltests_libdeps=" @@ -4572,18 +4616,7 @@ s,//*$,/,' echo " AC_SUBST([${macro_prefix}tests_WITNESS])" echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS" echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])" - for module in $testsrelated_modules; do - func_verify_module - if test -n "$module"; then - func_get_autoconf_snippet "$module" \ - | sed -e '/^$/d;' -e 's/^/ /' \ - -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \ - -e "$sed_replace_build_aux" \ - -e 's/\$gl_cond_libtool/false/g' \ - -e 's/gl_libdeps/gltests_libdeps/g' \ - -e 's/gl_ltlibdeps/gltests_ltlibdeps/g' - fi - done + func_emit_autoconf_snippets "$testsrelated_modules" func_verify_module true true true echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])" func_emit_initmacro_end ${macro_prefix}tests # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is @@ -5136,34 +5169,9 @@ func_create_testdir () # autoconf snippets. It's cleanest to put those of the library before # those of the tests. echo "gl_source_base='../$sourcebase'" - for module in $modules; do - func_verify_nontests_module - if test -n "$module"; then - case $module in - gnumakefile | maintainer-makefile) - # These modules are meant to be used only in the top-level directory. - ;; - *) - func_get_autoconf_snippet "$module" \ - | sed -e "$sed_replace_build_aux" - if test "$module" = 'alloca' && test "$libtool" = true; then - echo 'changequote(,)dnl' - echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`' - echo 'changequote([, ])dnl' - echo 'AC_SUBST([LTALLOCA])' - fi - ;; - esac - fi - done + func_emit_autoconf_snippets "$modules" func_verify_nontests_module false false false echo "gl_source_base='.'" - for module in $modules; do - func_verify_tests_module - if test -n "$module"; then - func_get_autoconf_snippet "$module" \ - | sed -e "$sed_replace_build_aux" - fi - done + func_emit_autoconf_snippets "$modules" func_verify_tests_module false false false func_emit_initmacro_end $macro_prefix # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is # created using libtool, because libtool already handles the dependencies. @@ -5269,19 +5277,7 @@ func_create_testdir () echo "gl_m4_base='$m4base'" func_emit_initmacro_start $macro_prefix echo "gl_source_base='$sourcebase'" - for module in $modules; do - func_verify_nontests_module - if test -n "$module"; then - func_get_autoconf_snippet "$module" \ - | sed -e "$sed_replace_build_aux" - if test "$module" = 'alloca' && test "$libtool" = true; then - echo 'changequote(,)dnl' - echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`' - echo 'changequote([, ])dnl' - echo 'AC_SUBST([LTALLOCA])' - fi - fi - done + func_emit_autoconf_snippets "$modules" func_verify_nontests_module true false false func_emit_initmacro_end $macro_prefix # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is # created using libtool, because libtool already handles the dependencies. -- cgit v1.2.1 From 41137d99dcb3d06767e90c3c5b2270772cc5f8ce Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 1 May 2011 23:10:44 +0200 Subject: Update DEPENDENCIES. * DEPENDENCIES (gettext): Recommend the newest release. Reported by Simon Josefsson. --- ChangeLog | 6 ++++++ DEPENDENCIES | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9371ac406a..fba5f008bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-05-01 Bruno Haible + + Update DEPENDENCIES. + * DEPENDENCIES (gettext): Recommend the newest release. + Reported by Simon Josefsson. + 2011-05-01 Bruno Haible gnulib-tool: Reduce code duplication. diff --git a/DEPENDENCIES b/DEPENDENCIES index 2117e7dbce..f025ab2d5c 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -90,7 +90,9 @@ at any time. http://ftp.gnu.org/gnu/grep/ ftp://ftp.gnu.org/gnu/grep/ -* GNU gettext 0.16.1. +* GNU gettext. + + Always use the newest available gettext release, see + . + Recommended. Needed if you use modules that use internationalization (many do). + Homepage: -- cgit v1.2.1 From dffb59b475060aa67de0b661a4839f2984477529 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Mon, 2 May 2011 08:45:02 +0200 Subject: exit: Remove module. * NEWS: Document removal of 'exit'. * modules/exit: Remove file. --- ChangeLog | 5 +++++ NEWS | 3 +++ modules/exit | 26 -------------------------- 3 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 modules/exit diff --git a/ChangeLog b/ChangeLog index fba5f008bd..58b9dd0d99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-05-02 Simon Josefsson + + * NEWS: Document removal of 'exit'. + * modules/exit: Remove file. + 2011-05-01 Bruno Haible Update DEPENDENCIES. diff --git a/NEWS b/NEWS index b693a33596..8674ed8827 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ User visible incompatible changes Date Modules Changes +2011-05-02 exit The module is removed. It was deprecated + on 2010-03-05. Use 'stdlib' directly instead. + 2011-04-27 mgetgroups The 'xgetgroups' function has been split into a new 'xgetgroups' module. diff --git a/modules/exit b/modules/exit deleted file mode 100644 index 18899f28c3..0000000000 --- a/modules/exit +++ /dev/null @@ -1,26 +0,0 @@ -Description: -exit() function: program termination. - -Status: -obsolete - -Notice: -This module is obsolete. It will be removed on 2011-01-01. Use 'stdlib'. - -Files: - -Depends-on: -stdlib - -configure.ac: - -Makefile.am: - -Include: - - -License: -LGPLv2+ - -Maintainer: -Bruno Haible -- cgit v1.2.1 From 58f1943477fe5514408486cc31814a8cf6507e6d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 2 May 2011 13:44:41 +0200 Subject: gnulib-tool: Refactor. * gnulib-tool (func_emit_autoconf_snippet): New function, extracted from func_emit_autoconf_snippets. (func_emit_autoconf_snippets): Use it. --- ChangeLog | 7 +++++ gnulib-tool | 103 +++++++++++++++++++++++++++++++++++++----------------------- 2 files changed, 70 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58b9dd0d99..a625b00ae6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-05-02 Bruno Haible + + gnulib-tool: Refactor. + * gnulib-tool (func_emit_autoconf_snippet): New function, extracted + from func_emit_autoconf_snippets. + (func_emit_autoconf_snippets): Use it. + 2011-05-02 Simon Josefsson * NEWS: Document removal of 'exit'. diff --git a/gnulib-tool b/gnulib-tool index da8543555b..65ecefd6b4 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -3360,20 +3360,74 @@ func_emit_initmacro_done () echo "])" } +# func_emit_autoconf_snippet indentation +# emits the autoconf snippet of a module. +# Input: +# - local_gnulib_dir from --local-dir +# - modcache true or false, from --cache-modules/--no-cache-modules +# - sed_replace_build_aux sed expression that replaces reference to build-aux +# - module the module name +# - toplevel true or false. 'false' means a subordinate use of +# gnulib-tool. +# - disable_libtool true or false. It tells whether to disable libtool +# handling even if it has been specified through the +# command line options. +# - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT +# invocations. +# - indentation spaces to prepend on each line +func_emit_autoconf_snippet () +{ + if { case $module in + gnumakefile | maintainer-makefile) + # These modules are meant to be used only in the top-level directory. + $toplevel ;; + *) + true ;; + esac + }; then + func_get_autoconf_snippet "$module" \ + | sed -e '/^$/d;' -e "s/^/$indentation/" \ + -e "$sed_replace_build_aux" \ + | { if $disable_libtool; then + sed -e 's/\$gl_cond_libtool/false/g' \ + -e 's/gl_libdeps/gltests_libdeps/g' \ + -e 's/gl_ltlibdeps/gltests_ltlibdeps/g' + else + cat + fi + } \ + | { if $disable_gettext; then + sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' + else + cat + fi + } + if test "$module" = 'alloca' && test "$libtool" = true && ! $disable_libtool; then + echo 'changequote(,)dnl' + echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`' + echo 'changequote([, ])dnl' + echo 'AC_SUBST([LTALLOCA])' + fi + fi +} + # func_emit_autoconf_snippets modules verifier toplevel disable_libtool disable_gettext # collects and emit the autoconf snippets of a set of modules. -# - modules is the list of modules. -# - verifier is one of func_verify_module, func_verify_nontests_module, -# func_verify_tests_module. It selects the subset of $modules to consider. -# - toplevel is true or false. 'false' means a subordinate use of gnulib-tool. -# - disable_libtool is true or false. It tells whether to disable libtool -# handling even if it has been specified through the command line options. -# - disable_gettext is true or false. It tells whether to disable AM_GNU_GETTEXT -# invocations. # Input: # - local_gnulib_dir from --local-dir # - modcache true or false, from --cache-modules/--no-cache-modules # - sed_replace_build_aux sed expression that replaces reference to build-aux +# - modules the list of modules. +# - verifier one of func_verify_module, func_verify_nontests_module, +# func_verify_tests_module. It selects the subset of +# $modules to consider. +# - toplevel true or false. 'false' means a subordinate use of +# gnulib-tool. +# - disable_libtool true or false. It tells whether to disable libtool +# handling even if it has been specified through the +# command line options. +# - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT +# invocations. func_emit_autoconf_snippets () { verifier="$2" @@ -3383,38 +3437,7 @@ func_emit_autoconf_snippets () for module in $1; do eval $verifier # one of func_verify_module, func_verify_nontests_module, func_verify_tests_module. if test -n "$module"; then - if { case $module in - gnumakefile | maintainer-makefile) - # These modules are meant to be used only in the top-level directory. - $toplevel ;; - *) - true ;; - esac - }; then - func_get_autoconf_snippet "$module" \ - | sed -e '/^$/d;' -e 's/^/ /' \ - -e "$sed_replace_build_aux" \ - | { if $disable_libtool; then - sed -e 's/\$gl_cond_libtool/false/g' \ - -e 's/gl_libdeps/gltests_libdeps/g' \ - -e 's/gl_ltlibdeps/gltests_ltlibdeps/g' - else - cat - fi - } \ - | { if $disable_gettext; then - sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' - else - cat - fi - } - if test "$module" = 'alloca' && test "$libtool" = true && ! $disable_libtool; then - echo 'changequote(,)dnl' - echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`' - echo 'changequote([, ])dnl' - echo 'AC_SUBST([LTALLOCA])' - fi - fi + func_emit_autoconf_snippet " " fi done } -- cgit v1.2.1 From a73baf110e6e174035eb946934615ce33209b04e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 2 May 2011 18:59:21 +0200 Subject: fchdir: Remove unused dependencies. * modules/fchdir (Depends-on): Remove include_next. --- ChangeLog | 5 +++++ modules/fchdir | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a625b00ae6..71d0421240 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-05-02 Bruno Haible + + fchdir: Remove unused dependencies. + * modules/fchdir (Depends-on): Remove include_next. + 2011-05-02 Bruno Haible gnulib-tool: Refactor. diff --git a/modules/fchdir b/modules/fchdir index 0a3ab9926b..8589193ec0 100644 --- a/modules/fchdir +++ b/modules/fchdir @@ -15,7 +15,6 @@ fcntl fcntl-h filenamecat-lgpl getcwd-lgpl -include_next malloc-posix open realloc-posix -- cgit v1.2.1 From 575476d912d26b75d3ec784dea43d8cbde1b2bbf Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 2 May 2011 11:23:11 -0600 Subject: freading: relax license from LGPLv3+ to LGPLv2+ Agreed to in http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00055.html * modules/freading (License): Relax LGPL version. Signed-off-by: Eric Blake --- ChangeLog | 5 +++++ modules/freading | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71d0421240..4999be22b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-05-02 Eric Blake + + freading: relax license from LGPLv3+ to LGPLv2+ + * modules/freading (License): Relax LGPL version. + 2011-05-02 Bruno Haible fchdir: Remove unused dependencies. diff --git a/modules/freading b/modules/freading index d2a027801e..b5c00c65d2 100644 --- a/modules/freading +++ b/modules/freading @@ -20,8 +20,7 @@ Include: "freading.h" License: -LGPL +LGPLv2+ Maintainer: Eric Blake - -- cgit v1.2.1 From 0fc0aa38149cc8d1b35537c56ea5d0b83eadcf56 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 2 May 2011 11:59:00 -0600 Subject: exit: drop remaining clients Anyone using EXIT_FAILURE needs to depend on stdlib, now that the exit module is gone. * modules/argmatch (Depends-on): Replace exit with stdlib. * modules/copy-file (Depends-on): Likewise. * modules/execute (Depends-on): Likewise. * modules/exitfail (Depends-on): Likewise. * modules/obstack (Depends-on): Likewise. * modules/pagealign_alloc (Depends-on): Likewise. * modules/pipe-filter-gi (Depends-on): Likewise. * modules/pipe-filter-ii (Depends-on): Likewise. * modules/savewd (Depends-on): Likewise. * modules/spawn-pipe (Depends-on): Likewise. * modules/wait-process (Depends-on): Likewise. * modules/xsetenv (Depends-on): Likewise. * modules/chdir-long (Depends-on): Add stdlib, for EXIT_FAILURE. * modules/git-merge-changelog (Depends-on): Likewise. * modules/long-options (Depends-on): Likewise. * modules/pt_chown (Depends-on): Likewise. * modules/sysexits (Depends-on): Likewise. Signed-off-by: Eric Blake --- ChangeLog | 19 +++++++++++++++++++ modules/argmatch | 2 +- modules/chdir-long | 1 + modules/copy-file | 2 +- modules/execute | 2 +- modules/exitfail | 2 +- modules/git-merge-changelog | 1 + modules/long-options | 1 + modules/obstack | 2 +- modules/pagealign_alloc | 2 +- modules/pipe-filter-gi | 2 +- modules/pipe-filter-ii | 2 +- modules/pt_chown | 1 + modules/savewd | 2 +- modules/spawn-pipe | 2 +- modules/sysexits | 1 + modules/wait-process | 2 +- modules/xsetenv | 2 +- 18 files changed, 36 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4999be22b8..d6ac179d9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2011-05-02 Eric Blake + exit: drop remaining clients + * modules/argmatch (Depends-on): Replace exit with stdlib. + * modules/copy-file (Depends-on): Likewise. + * modules/execute (Depends-on): Likewise. + * modules/exitfail (Depends-on): Likewise. + * modules/obstack (Depends-on): Likewise. + * modules/pagealign_alloc (Depends-on): Likewise. + * modules/pipe-filter-gi (Depends-on): Likewise. + * modules/pipe-filter-ii (Depends-on): Likewise. + * modules/savewd (Depends-on): Likewise. + * modules/spawn-pipe (Depends-on): Likewise. + * modules/wait-process (Depends-on): Likewise. + * modules/xsetenv (Depends-on): Likewise. + * modules/chdir-long (Depends-on): Add stdlib, for EXIT_FAILURE. + * modules/git-merge-changelog (Depends-on): Likewise. + * modules/long-options (Depends-on): Likewise. + * modules/pt_chown (Depends-on): Likewise. + * modules/sysexits (Depends-on): Likewise. + freading: relax license from LGPLv3+ to LGPLv2+ * modules/freading (License): Relax LGPL version. diff --git a/modules/argmatch b/modules/argmatch index 0dd643cdfb..c3225976d6 100644 --- a/modules/argmatch +++ b/modules/argmatch @@ -11,10 +11,10 @@ gettext-h error quotearg quote -exit exitfail verify stdbool +stdlib memcmp configure.ac: diff --git a/modules/chdir-long b/modules/chdir-long index 4025b45afc..eb08151d63 100644 --- a/modules/chdir-long +++ b/modules/chdir-long @@ -15,6 +15,7 @@ memchr mempcpy memrchr stdbool +stdlib configure.ac: gl_FUNC_CHDIR_LONG diff --git a/modules/copy-file b/modules/copy-file index 6941e5a8e4..4ca553e302 100644 --- a/modules/copy-file +++ b/modules/copy-file @@ -10,11 +10,11 @@ Depends-on: acl binary-io error -exit full-write gettext-h open safe-read +stdlib unistd xalloc diff --git a/modules/execute b/modules/execute index 755e3e5b6d..a65696bb53 100644 --- a/modules/execute +++ b/modules/execute @@ -11,7 +11,6 @@ Depends-on: cloexec dup2 error -exit fatal-signal wait-process gettext-h @@ -25,6 +24,7 @@ posix_spawnattr_setsigmask posix_spawnattr_setflags posix_spawnattr_destroy stdbool +stdlib strpbrk unistd environ diff --git a/modules/exitfail b/modules/exitfail index 641f99d1be..0dd3ec6897 100644 --- a/modules/exitfail +++ b/modules/exitfail @@ -6,7 +6,7 @@ lib/exitfail.h lib/exitfail.c Depends-on: -exit +stdlib configure.ac: diff --git a/modules/git-merge-changelog b/modules/git-merge-changelog index d0e2ad02f2..857a8bc5b2 100644 --- a/modules/git-merge-changelog +++ b/modules/git-merge-changelog @@ -7,6 +7,7 @@ lib/git-merge-changelog.c Depends-on: getopt-gnu stdbool +stdlib progname error read-file diff --git a/modules/long-options b/modules/long-options index 29bf734dc0..207610c63d 100644 --- a/modules/long-options +++ b/modules/long-options @@ -8,6 +8,7 @@ m4/long-options.m4 Depends-on: getopt-gnu +stdlib version-etc configure.ac: diff --git a/modules/obstack b/modules/obstack index af12846b95..bceecdc64c 100644 --- a/modules/obstack +++ b/modules/obstack @@ -7,9 +7,9 @@ lib/obstack.c Depends-on: gettext-h -exit exitfail stdint +stdlib configure.ac: AC_FUNC_OBSTACK diff --git a/modules/pagealign_alloc b/modules/pagealign_alloc index 5972aa152d..357a335197 100644 --- a/modules/pagealign_alloc +++ b/modules/pagealign_alloc @@ -9,10 +9,10 @@ m4/pagealign_alloc.m4 Depends-on: error -exit extensions getpagesize gettext-h +stdlib xalloc unistd diff --git a/modules/pipe-filter-gi b/modules/pipe-filter-gi index f2e6fc032c..ac56c60f3d 100644 --- a/modules/pipe-filter-gi +++ b/modules/pipe-filter-gi @@ -10,11 +10,11 @@ Depends-on: spawn-pipe wait-process error -exit fcntl-h gettext-h stdbool stdint +stdlib sys_select unistd diff --git a/modules/pipe-filter-ii b/modules/pipe-filter-ii index 5f7d05b9de..faa4e1a6fb 100644 --- a/modules/pipe-filter-ii +++ b/modules/pipe-filter-ii @@ -10,11 +10,11 @@ Depends-on: spawn-pipe wait-process error -exit fcntl-h gettext-h stdbool stdint +stdlib sys_select unistd diff --git a/modules/pt_chown b/modules/pt_chown index b861331d2a..0002ab79a8 100644 --- a/modules/pt_chown +++ b/modules/pt_chown @@ -7,6 +7,7 @@ lib/pty-private.h Depends-on: ptsname +stdlib configure.ac: diff --git a/modules/savewd b/modules/savewd index 1f32372849..1e95b4127d 100644 --- a/modules/savewd +++ b/modules/savewd @@ -9,12 +9,12 @@ m4/savewd.m4 Depends-on: dosname errno -exit fchdir fcntl-safer fcntl-h raise stdbool +stdlib xalloc configure.ac: diff --git a/modules/spawn-pipe b/modules/spawn-pipe index 04441b1a4e..9898b37598 100644 --- a/modules/spawn-pipe +++ b/modules/spawn-pipe @@ -12,7 +12,6 @@ cloexec dup2 environ error -exit fatal-signal gettext-h open @@ -30,6 +29,7 @@ posix_spawnattr_setsigmask posix_spawnattr_setflags posix_spawnattr_destroy stdbool +stdlib strpbrk unistd unistd-safer diff --git a/modules/sysexits b/modules/sysexits index ed0d488666..5f6896a586 100644 --- a/modules/sysexits +++ b/modules/sysexits @@ -7,6 +7,7 @@ m4/sysexits.m4 Depends-on: include_next +stdlib configure.ac: gl_SYSEXITS diff --git a/modules/wait-process b/modules/wait-process index 9120bbcf0a..afc8854220 100644 --- a/modules/wait-process +++ b/modules/wait-process @@ -10,10 +10,10 @@ m4/sig_atomic_t.m4 Depends-on: fatal-signal error -exit xalloc gettext-h stdbool +stdlib sys_wait unistd atexit diff --git a/modules/xsetenv b/modules/xsetenv index 29319f1223..66c1c4c373 100644 --- a/modules/xsetenv +++ b/modules/xsetenv @@ -10,8 +10,8 @@ Depends-on: setenv unsetenv error -exit gettext-h +stdlib configure.ac: -- cgit v1.2.1 From 001e7d63dfe613e249e9f4ab53170b401532afd3 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 2 May 2011 11:41:12 -0600 Subject: fclose: reduce dependencies In an LGPLv2+ project, the last change to fclose dragged in inappropriate modules. * modules/fclose (Depends-on): Switch from fflush/fseeko to simpler lseek. * lib/fclose.c (rpl_fclose): Likewise. Reported by Simon Josefsson. Signed-off-by: Eric Blake --- ChangeLog | 6 ++++++ lib/fclose.c | 6 ++++-- modules/fclose | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6ac179d9a..57288d83be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-05-02 Eric Blake + fclose: reduced dependencies + * modules/fclose (Depends-on): Switch from fflush/fseeko to + simpler lseek. + * lib/fclose.c (rpl_fclose): Likewise. + Reported by Simon Josefsson. + exit: drop remaining clients * modules/argmatch (Depends-on): Replace exit with stdlib. * modules/copy-file (Depends-on): Likewise. diff --git a/lib/fclose.c b/lib/fclose.c index bce409c960..c8c2fd8e4c 100644 --- a/lib/fclose.c +++ b/lib/fclose.c @@ -33,8 +33,10 @@ rpl_fclose (FILE *fp) int saved_errno = 0; /* We only need to flush the file if it is not reading or if it is - seekable. */ - if ((!freading (fp) || fseeko (fp, 0, SEEK_CUR) == 0) && fflush (fp)) + seekable. This only guarantees the file position of input files + if the fflush module is also in use. */ + if ((!freading (fp) || lseek (fileno (fp), 0, SEEK_CUR) != -1) + && fflush (fp)) saved_errno = errno; if (close (fileno (fp)) < 0 && saved_errno == 0) diff --git a/modules/fclose b/modules/fclose index d8727c3075..434dd737dc 100644 --- a/modules/fclose +++ b/modules/fclose @@ -8,9 +8,8 @@ m4/fclose.m4 Depends-on: stdio close -fflush freading -fseeko +lseek configure.ac: gl_FUNC_FCLOSE -- cgit v1.2.1 From 1fc3525d1fd7dafbc946dab4c754c593f448c21c Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 2 May 2011 13:38:23 -0600 Subject: fclose: add some tests POSIX requires that fclose() on seekable input streams rewind back to the next byte not actually given to the application. Glibc fails this test. See: http://sourceware.org/bugzilla/show_bug.cgi?id=3746 http://sourceware.org/bugzilla/show_bug.cgi?id=12724 Likewise for FreeBSD. Cygwin 1.7.9 and Solaris 10 pass, however. * modules/fclose-tests: New test module. * tests/test-fclose.c: New file. Signed-off-by: Eric Blake --- ChangeLog | 5 +++ doc/posix-functions/fclose.texi | 4 ++ modules/fclose-tests | 10 +++++ tests/test-fclose.c | 90 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 modules/fclose-tests create mode 100644 tests/test-fclose.c diff --git a/ChangeLog b/ChangeLog index 57288d83be..c9575a1bad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-05-02 Eric Blake + fclose: add some tests + * modules/fclose-tests: New test module. + * tests/test-fclose.c: New file. + * doc/posix-functions/fclose.texi (fclose): Document the bug. + fclose: reduced dependencies * modules/fclose (Depends-on): Switch from fflush/fseeko to simpler lseek. diff --git a/doc/posix-functions/fclose.texi b/doc/posix-functions/fclose.texi index da26c87e89..ad3aca343e 100644 --- a/doc/posix-functions/fclose.texi +++ b/doc/posix-functions/fclose.texi @@ -17,6 +17,10 @@ followed by @code{fdopen} do not return streams that can be closed by Portability problems not fixed by Gnulib: @itemize @item +On some platforms, this function fails to set the file position of a +seekable input stream to the byte after the last one actually read: +glibc 2.13, FreeBSD. +@item On Windows platforms (excluding Cygwin), this function does not set @code{errno} upon failure. @end itemize diff --git a/modules/fclose-tests b/modules/fclose-tests new file mode 100644 index 0000000000..6334f6594a --- /dev/null +++ b/modules/fclose-tests @@ -0,0 +1,10 @@ +Files: +tests/test-fclose.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-fclose +check_PROGRAMS += test-fclose diff --git a/tests/test-fclose.c b/tests/test-fclose.c new file mode 100644 index 0000000000..a11eca96e3 --- /dev/null +++ b/tests/test-fclose.c @@ -0,0 +1,90 @@ +/* Test of fclose module. + Copyright (C) 2011 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake. */ + +#include + +#include + +#include "signature.h" +SIGNATURE_CHECK (fclose, int, (FILE *)); + +#include +#include +#include +#include +#include + +#include "macros.h" + +#define BASE "test-fclose.t" + +int +main (int argc, char **argv) +{ + const char buf[] = "hello world"; + int fd; + int fd2; + FILE *f; + + /* Prepare a seekable file. */ + fd = open (BASE, O_RDWR | O_CREAT | O_TRUNC, 0600); + ASSERT (0 <= fd); + ASSERT (write (fd, buf, sizeof buf) == sizeof buf); + ASSERT (lseek (fd, 1, SEEK_SET) == 1); + + /* Create an output stream visiting the file; when it is closed, all + other file descriptors visiting the file must see the new file + position. */ + fd2 = dup (fd); + ASSERT (0 <= fd2); + f = fdopen (fd2, "w"); + ASSERT (f); + ASSERT (fputc (buf[1], f) == buf[1]); + ASSERT (fclose (f) == 0); + errno = 0; + ASSERT (lseek (fd2, 0, SEEK_CUR) == -1); + ASSERT (errno == EBADF); + ASSERT (lseek (fd, 0, SEEK_CUR) == 2); + + /* Likewise for an input stream. */ + fd2 = dup (fd); + ASSERT (0 <= fd2); + f = fdopen (fd2, "r"); + ASSERT (f); + ASSERT (fgetc (f) == buf[2]); + ASSERT (fclose (f) == 0); + errno = 0; + ASSERT (lseek (fd2, 0, SEEK_CUR) == -1); + ASSERT (errno == EBADF); + ASSERT (lseek (fd, 0, SEEK_CUR) == 3); + + /* Test that fclose() sets errno if someone else closes the stream + fd behind the back of stdio. */ + f = fdopen (fd, "w+"); + ASSERT (f); + ASSERT (close (fd) == 0); + errno = 0; + ASSERT (fclose (f) == EOF); + ASSERT (errno == EBADF); + + /* Clean up. */ + ASSERT (remove (BASE) == 0); + + return 0; +} -- cgit v1.2.1 From bcbcf0c59cec0e91db318eccdc564852bafa3c67 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 2 May 2011 15:00:50 -0600 Subject: fflush: also replace fclose when fixing fflush This fixes the fclose failures detected in the previous patch, but only when the GPL fflush module is also in use. That is because the need for behavior of resetting seekable input streams is much less common, and the fix more complex. The LGPLv2+ test for fclose() in isolation is relaxed to pass if fflush is not being replaced to cater to input streams. * modules/fflush (Depends-on): Add fclose. * m4/fflush.m4 (gl_FUNC_FFLUSH): Also replace fclose. * lib/fclose.c (rpl_fclose): Don't cause spurious failures on memstreams with no backing fd. * doc/posix-functions/fclose.texi (fclose): Document the use of fflush module to fix the bug. * tests/test-fclose.c (main): Relax test when fclose is used in isolation. Signed-off-by: Eric Blake --- ChangeLog | 10 ++++++++++ doc/posix-functions/fclose.texi | 16 ++++++++++------ lib/fclose.c | 10 ++++++++-- m4/fflush.m4 | 3 ++- modules/fflush | 2 ++ tests/test-fclose.c | 5 ++++- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9575a1bad..708fc8f161 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2011-05-02 Eric Blake + fflush: also replace fclose when fixing fflush + * modules/fflush (Depends-on): Add fclose. + * m4/fflush.m4 (gl_FUNC_FFLUSH): Also replace fclose. + * lib/fclose.c (rpl_fclose): Don't cause spurious failures on + memstreams with no backing fd. + * doc/posix-functions/fclose.texi (fclose): Document the use of + fflush module to fix the bug. + * tests/test-fclose.c (main): Relax test when fclose is used in + isolation. + fclose: add some tests * modules/fclose-tests: New test module. * tests/test-fclose.c: New file. diff --git a/doc/posix-functions/fclose.texi b/doc/posix-functions/fclose.texi index ad3aca343e..45aac4c7e9 100644 --- a/doc/posix-functions/fclose.texi +++ b/doc/posix-functions/fclose.texi @@ -4,9 +4,17 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fclose.html} -Gnulib module: fclose +Gnulib module: fclose, fflush -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{fflush}: +@itemize +@item +On some platforms, this function fails to set the file position of a +seekable input stream to the byte after the last one actually read: +glibc 2.13, FreeBSD. +@end itemize + +Portability problems fixed by Gnulib module @code{fclose}: @itemize @item On Windows platforms (excluding Cygwin), @code{socket} and @code{accept} @@ -17,10 +25,6 @@ followed by @code{fdopen} do not return streams that can be closed by Portability problems not fixed by Gnulib: @itemize @item -On some platforms, this function fails to set the file position of a -seekable input stream to the byte after the last one actually read: -glibc 2.13, FreeBSD. -@item On Windows platforms (excluding Cygwin), this function does not set @code{errno} upon failure. @end itemize diff --git a/lib/fclose.c b/lib/fclose.c index c8c2fd8e4c..bed561bdb1 100644 --- a/lib/fclose.c +++ b/lib/fclose.c @@ -24,13 +24,19 @@ #include "freading.h" -/* Override fclose() to call the overridden close(). */ +/* Override fclose() to call the overridden fflush() or close(). */ int rpl_fclose (FILE *fp) #undef fclose { int saved_errno = 0; + int fd; + + /* Don't change behavior on memstreams. */ + fd = fileno (fp); + if (fd < 0) + return fclose (fp); /* We only need to flush the file if it is not reading or if it is seekable. This only guarantees the file position of input files @@ -39,7 +45,7 @@ rpl_fclose (FILE *fp) && fflush (fp)) saved_errno = errno; - if (close (fileno (fp)) < 0 && saved_errno == 0) + if (close (fd) < 0 && saved_errno == 0) saved_errno = errno; fclose (fp); /* will fail with errno = EBADF */ diff --git a/m4/fflush.m4 b/m4/fflush.m4 index f7645deff6..08b9f17d30 100644 --- a/m4/fflush.m4 +++ b/m4/fflush.m4 @@ -1,4 +1,4 @@ -# fflush.m4 serial 8 +# fflush.m4 serial 9 # Copyright (C) 2007-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -61,6 +61,7 @@ AC_DEFUN([gl_FUNC_FFLUSH], ]) if test $gl_cv_func_fflush_stdin = no; then gl_REPLACE_FFLUSH + gl_REPLACE_FCLOSE fi ]) diff --git a/modules/fflush b/modules/fflush index a8a151e93a..2d5839db4c 100644 --- a/modules/fflush +++ b/modules/fflush @@ -7,6 +7,7 @@ lib/stdio-impl.h m4/fflush.m4 Depends-on: +fclose fpurge ftello freading @@ -20,6 +21,7 @@ AC_REQUIRE([AC_FUNC_FSEEKO]) configure.ac: gl_FUNC_FFLUSH +gl_MODULE_INDICATOR([fflush]) gl_STDIO_MODULE_INDICATOR([fflush]) Makefile.am: diff --git a/tests/test-fclose.c b/tests/test-fclose.c index a11eca96e3..d9b940619b 100644 --- a/tests/test-fclose.c +++ b/tests/test-fclose.c @@ -62,7 +62,9 @@ main (int argc, char **argv) ASSERT (errno == EBADF); ASSERT (lseek (fd, 0, SEEK_CUR) == 2); - /* Likewise for an input stream. */ +#if GNULIB_FFLUSH + /* Likewise for an input stream, but only when we know fflush works + on input streams. */ fd2 = dup (fd); ASSERT (0 <= fd2); f = fdopen (fd2, "r"); @@ -73,6 +75,7 @@ main (int argc, char **argv) ASSERT (lseek (fd2, 0, SEEK_CUR) == -1); ASSERT (errno == EBADF); ASSERT (lseek (fd, 0, SEEK_CUR) == 3); +#endif /* Test that fclose() sets errno if someone else closes the stream fd behind the back of stdio. */ -- cgit v1.2.1 From 850e984b06bf8e0445e50a36cce1b3b42f1a3de2 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Tue, 3 May 2011 07:58:45 +0200 Subject: readme-release: new module with release instructions * modules/readme-release: New module. * top/README-release: New file, from coreutils, grep, diffutils. * MODULES.html.sh (Support for maintaining and releasing): Add it. --- ChangeLog | 7 ++++ MODULES.html.sh | 1 + modules/readme-release | 31 ++++++++++++++++++ top/README-release | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 modules/readme-release create mode 100644 top/README-release diff --git a/ChangeLog b/ChangeLog index 708fc8f161..2f3edc41fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-05-03 Reuben Thomas + + readme-release: new module with release instructions + * modules/readme-release: New module. + * top/README-release: New file, from coreutils, grep, diffutils. + * MODULES.html.sh (Support for maintaining and releasing): Add it. + 2011-05-02 Eric Blake fflush: also replace fclose when fixing fflush diff --git a/MODULES.html.sh b/MODULES.html.sh index a584c4ece5..c9f1f9e188 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -3476,6 +3476,7 @@ func_all_modules () func_module gnupload func_module maintainer-makefile func_module mktempd + func_module readme-release func_module update-copyright func_module useless-if-before-free func_module vc-list-files diff --git a/modules/readme-release b/modules/readme-release new file mode 100644 index 0000000000..a2128bf49d --- /dev/null +++ b/modules/readme-release @@ -0,0 +1,31 @@ +Description: +Add release instructions customized for the package. + +You should add a line like + +perl -pi -e "s/\@PACKAGE\@/$package/g" README-release + +to autogen.sh or bootstrap.conf's epilogue function to patch the +package name in. This is particularly handy for making various URLs +copy-and-pastable. + +Note that, as with any gnulib-tool supplied file, README-release can +be customized via a .diff file. This is an easy way to add +package-specific instructions. + +Files: +top/README-release + +Depends-on: + +configure.ac: + +Makefile.am: + +Include: + +License: +GPLed build tool + +Maintainer: +bug-gnulib@gnu.org diff --git a/top/README-release b/top/README-release new file mode 100644 index 0000000000..69841d20eb --- /dev/null +++ b/top/README-release @@ -0,0 +1,89 @@ +Here are most of the steps we (maintainers) follow when making a release. + +* start from a clean, up-to-date git directory. + + git checkout master; git pull + +* Run ./configure && make maintainer-clean + +* Ensure that the desired versions of autoconf, automake, etc. + are in your PATH. See the buildreq list in bootstrap.conf for + the complete list. + +* Ensure that you're on "master" with no uncommitted diffs. + This should produce no output: git checkout master; git diff + +* Ensure that you've pushed all changes that belong in the release + and that the NixOS/Hydra autobuilder is reporting all is well: + + http://hydra.nixos.org/jobset/gnu/@PACKAGE@-master + +* Run bootstrap one last time. This downloads any new translations: + + ./bootstrap + +* Pre-release testing: + Ensure that make check syntax-check succeeds. + +* Run "make distcheck" + +* Set the date, version number, and release type [stable/alpha/beta] on + line 3 of NEWS, commit that, and tag the release by running e.g., + + build-aux/do-release-commit-and-tag X.Y stable + +* Run the following to create release tarballs. Your choice selects the + corresponding upload-to destination in the emitted gnupload command. + The different destinations are specified in cfg.mk. See the definitions + of gnu_ftp_host-{alpha,beta,stable}. + + # "TYPE" must be stable, beta or alpha + make TYPE + +* Test the tarball. copy it to a few odd-ball systems and ensure that + it builds and passes all tests. + +* While that's happening, write the release announcement that you will + soon post. Start with the template, $HOME/announce-@PACKAGE@-X.Y + that was just created by that "make" command. + +Once all the builds and tests have passed, + +* Run the gnupload command that was suggested by your "make stable" run above. + +* Wait a few minutes (maybe up to 30?) and then use the release URLs to + download all tarball/signature pairs and use gpg --verify to ensure + that they're all valid. + +* Push the NEWS-updating changes and the new tag: + + v=$(cat .prev-version) + git push origin master tag v$v + +* Announce it on Savannah first, so you can include the preferable + savannah.org announcement link in the email message. + + From here: + https://savannah.gnu.org/projects/@PACKAGE@/ + click on the "submit news", then write something like the following: + (If there is no such button, then enable "News" for the project via + the Main -> "Select Features" menu item, or via this link: + https://savannah.gnu.org/project/admin/editgroupfeatures.php?group=@PACKAGE@) + + Subject: @PACKAGE@-X.Y released [stable] + +verbatim+ + ...paste the announcement here... + -verbatim- + + Then go here to approve it: + https://savannah.gnu.org/news/approve.php?group=@PACKAGE@ + +* Send the announcement email message. + +* After each non-alpha release, update the on-line manual accessible via + + http://www.gnu.org/software/@PACKAGE@/manual/ + + by running this: + + build-aux/gnu-web-doc-update -- cgit v1.2.1 From 669d4ed58418b5dbffbd988a2c414c051673db04 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 3 May 2011 10:31:16 +0200 Subject: bootstrap: avoid build failure when $GZIP is set * build-aux/bootstrap (check_versions): Do not treat $GZIP as a program name. If defined at all, it is supposed to list gzip options. Reported by Alan Curry in http://debbugs.gnu.org/8609 --- ChangeLog | 7 +++++++ build-aux/bootstrap | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f3edc41fc..8f96680f74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-05-03 Jim Meyering + + bootstrap: avoid build failure when $GZIP is set + * build-aux/bootstrap (check_versions): Do not treat $GZIP as a + program name. If defined at all, it is supposed to list gzip options. + Reported by Alan Curry in http://debbugs.gnu.org/8609 + 2011-05-03 Reuben Thomas readme-release: new module with release instructions diff --git a/build-aux/bootstrap b/build-aux/bootstrap index 7cbb5dc433..d91611b4a4 100755 --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2011-04-05.18; # UTC +scriptversion=2011-05-03.08; # UTC # Bootstrap this package from checked-out sources. @@ -421,7 +421,10 @@ check_versions() { # Honor $APP variables ($TAR, $AUTOCONF, etc.) appvar=`echo $app | tr '[a-z]-' '[A-Z]_'` test "$appvar" = TAR && appvar=AMTAR - eval "app=\${$appvar-$app}" + case $appvar in + GZIP) ;; # Do not use $GZIP: it contains gzip options. + *) eval "app=\${$appvar-$app}" ;; + esac inst_ver=$(get_version $app) if [ ! "$inst_ver" ]; then echo "$me: Error: '$app' not found" >&2 -- cgit v1.2.1 From cc9b4bafbc4d712a483ce5b5b336ad80183edce3 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 3 May 2011 15:27:11 -0600 Subject: test-getaddrinfo: report error information Clang deduced that if ENABLE_DEBUGGING is undefined, then err was a dead assignment. But in the EAI_SYSTEM case, we fail the test, so the output should be unconditional. * tests/test-getaddrinfo.c (simple): Use err outside of dbprintf. Signed-off-by: Eric Blake --- ChangeLog | 5 +++++ tests/test-getaddrinfo.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8f96680f74..5df08520c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-05-03 Eric Blake + + test-getaddrinfo: report error information + * tests/test-getaddrinfo.c (simple): Use err outside of dbprintf. + 2011-05-03 Jim Meyering bootstrap: avoid build failure when $GZIP is set diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c index 482698937a..d2984e226b 100644 --- a/tests/test-getaddrinfo.c +++ b/tests/test-getaddrinfo.c @@ -107,7 +107,7 @@ simple (char const *host, char const *service) #endif /* Provide details if errno was set. */ if (res == EAI_SYSTEM) - dbgprintf ("system error: %s\n", strerror (err)); + fprintf (stderr, "system error: %s\n", strerror (err)); return 1; } -- cgit v1.2.1 From 99659bac7ac6b63b4f2d422df157aa4f582428d7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 3 May 2011 23:32:50 +0200 Subject: Support for conditional dependencies. * doc/gnulib.texi (Module description): Document the syntax of conditional dependencies. * gnulib-tool: New option --conditional-dependencies. (func_usage): Document it. (cond_dependencies): New variable. (func_get_automake_snippet_conditional, func_get_automake_snippet_unconditional): New functions, extracted from func_get_automake_snippet. (func_get_automake_snippet): Use them. (sed_first_32_chars): New variable. (func_module_shellfunc_name): New function. (func_module_shellvar_name): New function. (func_module_conditional_name): New function. (func_uncond_add_module, func_conddep_add_module, func_cond_module_p, func_cond_module_condition): New functions. (func_modules_transitive_closure): Add support for conditional dependencies. (func_emit_lib_Makefile_am): For a conditional module, enclose the conditional automake snippet in an automake conditional. (func_emit_autoconf_snippets): Emit shell functions that contain the code for conditional modules. (func_import, func_create_testdir): Update specification. --- ChangeLog | 26 ++++ doc/gnulib.texi | 9 ++ gnulib-tool | 376 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 396 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5df08520c3..a9e21cfbde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2011-05-03 Bruno Haible + + Support for conditional dependencies. + * doc/gnulib.texi (Module description): Document the syntax of + conditional dependencies. + * gnulib-tool: New option --conditional-dependencies. + (func_usage): Document it. + (cond_dependencies): New variable. + (func_get_automake_snippet_conditional, + func_get_automake_snippet_unconditional): New functions, extracted from + func_get_automake_snippet. + (func_get_automake_snippet): Use them. + (sed_first_32_chars): New variable. + (func_module_shellfunc_name): New function. + (func_module_shellvar_name): New function. + (func_module_conditional_name): New function. + (func_uncond_add_module, func_conddep_add_module, func_cond_module_p, + func_cond_module_condition): New functions. + (func_modules_transitive_closure): Add support for conditional + dependencies. + (func_emit_lib_Makefile_am): For a conditional module, enclose the + conditional automake snippet in an automake conditional. + (func_emit_autoconf_snippets): Emit shell functions that contain the + code for conditional modules. + (func_import, func_create_testdir): Update specification. + 2011-05-03 Eric Blake test-getaddrinfo: report error information diff --git a/doc/gnulib.texi b/doc/gnulib.texi index 966560d595..b59306ff7b 100644 --- a/doc/gnulib.texi +++ b/doc/gnulib.texi @@ -396,6 +396,15 @@ Tests modules can depend on non-tests modules. Non-tests modules should not depend on tests modules. (Recall that tests modules are built in a separate directory.) +Each listed required module may be declared a conditional dependency. This +is indicated by placing the condition for the dependency on the same line, +enclosed in brackets, after the name of the required module. The condition +is a shell expression that is run after the module's @code{configure.ac} +statements. For example: +@smallexample +strtoull [test $ac_cv_func_strtoumax = no] +@end smallexample + @item configure.ac-early This field contains @file{configure.ac} stuff (Autoconf macro invocations and shell statements) that are logically placed early in the @file{configure.ac} diff --git a/gnulib-tool b/gnulib-tool index 65ecefd6b4..f6c29f27e9 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -223,6 +223,10 @@ Options for --import, --add/remove-import, --avoid=MODULE Avoid including the given MODULE. Useful if you have code that provides equivalent functionality. This option can be repeated. + --conditional-dependencies + Support conditional dependencies (experimental, + may save configure time and object code, not + compatible with --with-tests). --libtool Use libtool rules. --no-libtool Don't use libtool rules. @@ -912,6 +916,8 @@ fi # - excl_unportable_tests true if --without-unportable-tests was given, blank # otherwise # - avoidlist list of modules to avoid, from --avoid +# - cond_dependencies true if --conditional-dependencies was given, blank +# otherwise # - lgpl yes or a number if --lgpl was given, blank otherwise # - makefile_name from --makefile-name # - libtool true if --libtool was given, false if --no-libtool was @@ -953,6 +959,7 @@ fi excl_privileged_tests= excl_unportable_tests= avoidlist= + cond_dependencies= lgpl= makefile_name= libtool= @@ -1002,7 +1009,7 @@ fi --extract-* ) mode=`echo "X$1" | sed -e 's/^X--//'` shift ;; - --copy-file | --copy-fil | --copy-fi | --copy-f | --copy- | --copy | --cop | --co ) + --copy-file | --copy-fil | --copy-fi | --copy-f | --copy- | --copy | --cop ) mode=copy-file shift ;; --dir ) @@ -1153,6 +1160,9 @@ fi arg=`echo "X$1" | sed -e 's/^X--avoid=//'` func_append avoidlist " $arg" shift ;; + --conditional-dependencies | --conditional-dependencie | --conditional-dependenci | --conditional-dependenc | --conditional-dependen | --conditional-depende | --conditional-depend | --conditional-depen | --conditional-depe | --conditional-dep | --conditional-de | --conditional-d | --conditional- | --conditional | --conditiona | --condition | --conditio | --conditi | --condit | --condi | --cond | --con) + cond_dependencies=true + shift ;; --lgpl ) lgpl=yes shift ;; @@ -1298,6 +1308,10 @@ fi if test -z "$pobase" && test -n "$po_domain"; then func_warning "--po-domain has no effect without a --po-base option" fi + if test -n "$cond_dependencies" && test -n "$inctests"; then + echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2 + func_exit 1 + fi # Determine the minimum supported autoconf version from the project's # configure.ac. @@ -2128,11 +2142,13 @@ func_get_autoconf_snippet () fi } -# func_get_automake_snippet module +# func_get_automake_snippet_conditional module +# returns the part of the Makefile.am snippet that can be put inside Automake +# conditionals. # Input: # - local_gnulib_dir from --local-dir # - modcache true or false, from --cache-modules/--no-cache-modules -func_get_automake_snippet () +func_get_automake_snippet_conditional () { if ! $modcache; then func_lookup_file "modules/$1" @@ -2152,6 +2168,16 @@ func_get_automake_snippet () fi fi fi +} + +# func_get_automake_snippet_unconditional module +# returns the part of the Makefile.am snippet that must stay outside of +# Automake conditionals. +# Input: +# - local_gnulib_dir from --local-dir +# - modcache true or false, from --cache-modules/--no-cache-modules +func_get_automake_snippet_unconditional () +{ case "$1" in *-tests) # *-tests module live in tests/, not lib/. @@ -2176,8 +2202,10 @@ func_get_automake_snippet () sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p' already_mentioned_files=` \ { if ! $modcache; then + func_lookup_file "modules/$1" sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file" else + func_cache_lookup_module "$1" if $have_associative; then if eval 'test -n "${modcache_makefile[$1]+set}"'; then eval 'echo "${modcache_makefile[$1]}"' @@ -2243,6 +2271,16 @@ func_get_automake_snippet () esac } +# func_get_automake_snippet module +# Input: +# - local_gnulib_dir from --local-dir +# - modcache true or false, from --cache-modules/--no-cache-modules +func_get_automake_snippet () +{ + func_get_automake_snippet_conditional "$1" + func_get_automake_snippet_unconditional "$1" +} + # func_get_include_directive module # Input: # - local_gnulib_dir from --local-dir @@ -2380,6 +2418,143 @@ func_acceptable () return 0 } +# sed expression to keep the first 32 characters of each line. +sed_first_32_chars='s/^\(................................\).*/\1/' + +# func_module_shellfunc_name module +# computes the shell function name that will contain the m4 macros for the module. +# Input: +# - macro_prefix prefix to use +# Output: +# - shellfunc shell function name +func_module_shellfunc_name () +{ + case $1 in + *[!a-zA-Z0-9_]*) + shellfunc=func_${macro_prefix}_gnulib_m4code_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;; + *) + shellfunc=func_${macro_prefix}_gnulib_m4code_$1 ;; + esac +} + +# func_module_shellvar_name module +# computes the shell variable name the will be set to true once the m4 macros +# for the module have been executed. +# Output: +# - shellvar shell variable name +func_module_shellvar_name () +{ + case $1 in + *[!a-zA-Z0-9_]*) + shellvar=${macro_prefix}_gnulib_enabled_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;; + *) + shellvar=${macro_prefix}_gnulib_enabled_$1 ;; + esac +} + +# func_module_conditional_name module +# computes the automake conditional name for the module. +# Output: +# - conditional name of automake conditional +func_module_conditional_name () +{ + case $1 in + *[!a-zA-Z0-9_]*) + conditional=${macro_prefix}_GNULIB_ENABLED_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;; + *) + conditional=${macro_prefix}_GNULIB_ENABLED_$1 ;; + esac +} + +# func_uncond_add_module B +# notes the presence of B as an unconditional module. +# +# func_conddep_add_module A B cond +# notes the presence of a conditional dependency from module A to module B, +# subject to the condition that A is enabled and cond is true. +# +# func_cond_module_p B +# tests whether module B is conditional. +# +# func_cond_module_condition A B +# returns the condition when B should be enabled as a dependency of A, once the +# m4 code for A has been executed. +# Output: - condition +# +if $have_associative; then + declare -A conddep_isuncond + declare -A conddep_dependers + declare -A conddep_condition + func_uncond_add_module () + { + eval 'conddep_isuncond[$1]=true' + eval 'unset conddep_dependers[$1]' + } + func_conddep_add_module () + { + eval 'isuncond="${conddep_isuncond[$2]}"' + if test -z "$isuncond"; then + # No unconditional dependency to B known at this point. + eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"' + eval 'conddep_condition[$1---$2]="$3"' + fi + } + func_cond_module_p () + { + eval 'previous_dependers="${conddep_dependers[$1]}"' + test -n "$previous_dependers" + } + func_cond_module_condition () + { + eval 'condition="${conddep_condition[$1---$2]}"' + } +else + func_uncond_add_module () + { + case $1 in + *[!a-zA-Z0-9_]*) + suffix=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;; + *) + suffix=$1 ;; + esac + eval 'conddep_isuncond_'"$suffix"'=true' + eval 'unset conddep_dependers_'"$suffix" + } + func_conddep_add_module () + { + case $2 in + *[!a-zA-Z0-9_]*) + suffix=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;; + *) + suffix=$2 ;; + esac + eval 'isuncond="${conddep_isuncond_'"$suffix"'}"' + if test -z "$isuncond"; then + eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"' + suffix=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` + eval 'conddep_condition_'"$suffix"'="$3"' + fi + } + func_cond_module_p () + { + case $1 in + *[!a-zA-Z0-9_]*) + suffix=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;; + *) + suffix=$1 ;; + esac + eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"' + test -n "$previous_dependers" + } + func_cond_module_condition () + { + suffix=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` + eval 'condition="${conddep_condition_'"$suffix"'}"' + } +fi + +sed_dependencies_without_conditions='s/ *\[.*//' + # func_modules_transitive_closure # Input: # - local_gnulib_dir from --local-dir @@ -2411,11 +2586,16 @@ func_acceptable () # - excl_unportable_tests true if tests that fail on some platforms should be # excluded, blank otherwise # - avoidlist list of modules to avoid +# - cond_dependencies true if conditional dependencies shall be supported, +# blank otherwise # - tmp pathname of a temporary directory # Output: # - modules list of modules, including dependencies +# - conddep_dependers, conddep_condition information about conditionally +# enabled modules func_modules_transitive_closure () { + sed_escape_dependency='s|\([/.]\)|\\\1|g' # In order to process every module only once (for speed), process an "input # list" of modules, producing an "output list" of modules. During each round, # more modules can be queued in the input list. Once a module on the input @@ -2425,6 +2605,16 @@ func_modules_transitive_closure () inmodules="$modules" outmodules= fmtc_inc_all_tests="$inc_all_direct_tests" + if test -n "$cond_dependencies"; then + for module in $inmodules; do + func_verify_module + if test -n "$module"; then + if func_acceptable $module; then + func_uncond_add_module $module + fi + fi + done + fi while test -n "$inmodules"; do inmodules_this_round="$inmodules" inmodules= # Accumulator, queue for next round @@ -2433,7 +2623,23 @@ func_modules_transitive_closure () if test -n "$module"; then if func_acceptable $module; then func_append outmodules " $module" - deps=`func_get_dependencies $module` + if test -n "$cond_dependencies"; then + if func_get_automake_snippet_conditional $module | grep '^if ' > /dev/null; then + # A module whose Makefile.am snippet contains a reference to an + # automake conditional. If we were to use it conditionally, we + # would get an error + # configure: error: conditional "..." was never defined. + # because automake 1.11.1 does not handle nested conditionals + # correctly. As a workaround, make the module unconditional. + func_uncond_add_module $module + fi + if func_cond_module_p $module; then + conditional=true + else + conditional=false + fi + fi + deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"` # Duplicate dependencies are harmless, but Jim wants a warning. duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d` if test -n "$duplicated_deps"; then @@ -2486,6 +2692,24 @@ func_modules_transitive_closure () done if $inc; then func_append inmodules " $dep" + if test -n "$cond_dependencies"; then + escaped_dep=`echo "$dep" | sed -e "$sed_escape_dependency"` + sed_extract_condition1='/^ *'"$escaped_dep"' *$/{s/^.*$/true/p}' + sed_extract_condition2='/^ *'"$escaped_dep"' *\[.*\] *$/{s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p}' + condition=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"` + if test "$condition" = true; then + condition= + fi + if test -n "$condition"; then + func_conddep_add_module "$module" "$dep" "$condition" + else + if $conditional; then + func_conddep_add_module "$module" "$dep" true + else + func_uncond_add_module "$dep" + fi + fi + fi fi done fi @@ -2807,7 +3031,7 @@ func_emit_lib_Makefile_am () func_verify_nontests_module if test -n "$module"; then { - func_get_automake_snippet "$module" | + func_get_automake_snippet_conditional "$module" | LC_ALL=C \ sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \ -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \ @@ -2820,16 +3044,32 @@ func_emit_lib_Makefile_am () echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@" echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@" fi - } > "$tmp"/amsnippet + } > "$tmp"/amsnippet1 + { + func_get_automake_snippet_unconditional "$module" | + LC_ALL=C sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' + } > "$tmp"/amsnippet2 # Skip the contents if it's entirely empty. - if grep '[^ ]' "$tmp"/amsnippet > /dev/null ; then + if grep '[^ ]' "$tmp"/amsnippet1 "$tmp"/amsnippet2 > /dev/null ; then echo "## begin gnulib module $module" echo - cat "$tmp"/amsnippet + if test -n "$cond_dependencies"; then + if func_cond_module_p "$module"; then + func_module_conditional_name "$module" + echo "if $conditional" + fi + fi + cat "$tmp"/amsnippet1 + if test -n "$cond_dependencies"; then + if func_cond_module_p "$module"; then + echo "endif" + fi + fi + cat "$tmp"/amsnippet2 echo "## end gnulib module $module" echo fi - rm -f "$tmp"/amsnippet + rm -f "$tmp"/amsnippet1 "$tmp"/amsnippet2 # Test whether there are some source files in subdirectories. for f in `func_get_filelist "$module"`; do case $f in @@ -3434,12 +3674,114 @@ func_emit_autoconf_snippets () toplevel="$3" disable_libtool="$4" disable_gettext="$5" - for module in $1; do - eval $verifier # one of func_verify_module, func_verify_nontests_module, func_verify_tests_module. - if test -n "$module"; then - func_emit_autoconf_snippet " " - fi - done + if test -n "$cond_dependencies"; then + # Emit the autoconf code for the unconditional modules. + for module in $1; do + eval $verifier + if test -n "$module"; then + if func_cond_module_p "$module"; then + : + else + func_emit_autoconf_snippet " " + fi + fi + done + # Initialize the shell variables indicating that the modules are enabled. + for module in $1; do + eval $verifier + if test -n "$module"; then + if func_cond_module_p "$module"; then + func_module_shellvar_name "$module" + echo " $shellvar=false" + fi + fi + done + # Emit the autoconf code for the conditional modules, each in a separate + # function. This makes it possible to support cycles among conditional + # modules. + for module in $1; do + eval $verifier + if test -n "$module"; then + if func_cond_module_p "$module"; then + func_module_shellfunc_name "$module" + func_module_shellvar_name "$module" + echo " $shellfunc ()" + echo ' {' + echo " if ! \$$shellvar; then" + func_emit_autoconf_snippet " " + echo " $shellvar=true" + deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"` + for dep in $deps; do + if func_cond_module_p "$dep"; then + func_module_shellfunc_name "$dep" + func_cond_module_condition "$module" "$dep" + if test "$condition" != true; then + echo ' if $condition; then' + echo " $shellfunc" + echo ' fi' + else + echo " $shellfunc" + fi + else + # The autoconf code for $dep has already been emitted above and + # therefore is already executed when this function is run. + : + fi + done + echo ' fi' + echo ' }' + fi + fi + done + # Emit the dependencies from the unconditional to the conditional modules. + for module in $1; do + eval $verifier + if test -n "$module"; then + if func_cond_module_p "$module"; then + : + else + deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"` + for dep in $deps; do + if func_cond_module_p "$dep"; then + func_module_shellfunc_name "$dep" + func_cond_module_condition "$module" "$dep" + if test "$condition" != true; then + echo " if $condition; then" + echo " $shellfunc" + echo ' fi' + else + echo " $shellfunc" + fi + else + # The autoconf code for $dep has already been emitted above and + # therefore is already executed when this code is run. + : + fi + done + fi + fi + done + # Define the Automake conditionals. + echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])" + for module in $1; do + eval $verifier + if test -n "$module"; then + if func_cond_module_p "$module"; then + func_module_conditional_name "$module" + func_module_shellvar_name "$module" + echo " AM_CONDITIONAL([$conditional], [\$$shellvar])" + fi + fi + done + else + # Ignore the conditions, and enable all modules unconditionally. + for module in $1; do + eval $verifier + if test -n "$module"; then + func_emit_autoconf_snippet " " + fi + done + fi } # func_import modules @@ -3468,6 +3810,8 @@ func_emit_autoconf_snippets () # otherwise # - inc_all_tests true if --with-all-tests was given, blank otherwise # - avoidlist list of modules to avoid, from --avoid +# - cond_dependencies true if conditional dependencies shall be supported, +# blank otherwise # - lgpl yes or a number if library's license shall be LGPL, # blank otherwise # - makefile_name from --makefile-name @@ -4920,6 +5264,8 @@ s,//*$,/,' # - excl_unportable_tests true if tests that fail on some platforms should be # excluded, blank otherwise # - avoidlist list of modules to avoid +# - cond_dependencies true if conditional dependencies shall be supported, +# blank otherwise # - libtool true if --libtool was given, false if --no-libtool was # given, blank otherwise # - symbolic true if files should be symlinked, copied otherwise -- cgit v1.2.1 From 7cbbd8a31a3be111f26d87fb8e55f4438f9c885f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 3 May 2011 23:36:43 +0200 Subject: Avoid unnecessary compilation units, through conditional dependencies. * modules/accept (Depends-on): Add conditions to the dependencies. * modules/acosl (Depends-on): Likewise. * modules/argz (Depends-on): Likewise. * modules/asinl (Depends-on): Likewise. * modules/atanl (Depends-on): Likewise. * modules/atoll (Depends-on): Likewise. * modules/bind (Depends-on): Likewise. * modules/btowc (Depends-on): Likewise. * modules/canonicalize-lgpl (Depends-on): Likewise. * modules/ceil (Depends-on): Likewise. * modules/ceilf (Depends-on): Likewise. * modules/ceill (Depends-on): Likewise. * modules/chdir-long (Depends-on): Likewise. * modules/chown (Depends-on): Likewise. * modules/close (Depends-on): Likewise. * modules/connect (Depends-on): Likewise. * modules/cosl (Depends-on): Likewise. * modules/dirfd (Depends-on): Likewise. * modules/dprintf (Depends-on): Likewise. * modules/dprintf-posix (Depends-on): Likewise. * modules/error (Depends-on): Likewise. * modules/euidaccess (Depends-on): Likewise. * modules/expl (Depends-on): Likewise. * modules/faccessat (Depends-on): Likewise. * modules/fchdir (Depends-on): Likewise. * modules/fclose (Depends-on): Likewise. * modules/fcntl (Depends-on): Likewise. * modules/fdopendir (Depends-on): Likewise. * modules/fflush (Depends-on): Likewise. * modules/floor (Depends-on): Likewise. * modules/floorf (Depends-on): Likewise. * modules/floorl (Depends-on): Likewise. * modules/fnmatch (Depends-on): Likewise. * modules/fopen (Depends-on): Likewise. * modules/fprintf-posix (Depends-on): Likewise. * modules/frexp (Depends-on): Likewise. * modules/frexp-nolibm (Depends-on): Likewise. * modules/frexpl (Depends-on): Likewise. * modules/frexpl-nolibm (Depends-on): Likewise. * modules/fseek (Depends-on): Likewise. * modules/fsusage (Depends-on): Likewise. * modules/ftell (Depends-on): Likewise. * modules/ftello (Depends-on): Likewise. * modules/futimens (Depends-on): Likewise. * modules/getcwd (Depends-on): Likewise. * modules/getcwd-lgpl (Depends-on): Likewise. * modules/getdelim (Depends-on): Likewise. * modules/getdomainname (Depends-on): Likewise. * modules/getgroups (Depends-on): Likewise. * modules/gethostname (Depends-on): Likewise. * modules/getline (Depends-on): Likewise. * modules/getlogin_r (Depends-on): Likewise. * modules/getopt-posix (Depends-on): Likewise. * modules/getpeername (Depends-on): Likewise. * modules/getsockname (Depends-on): Likewise. * modules/getsockopt (Depends-on): Likewise. * modules/getsubopt (Depends-on): Likewise. * modules/getusershell (Depends-on): Likewise. * modules/glob (Depends-on): Likewise. * modules/grantpt (Depends-on): Likewise. * modules/iconv_open (Depends-on): Likewise. * modules/iconv_open-utf (Depends-on): Likewise. * modules/inet_ntop (Depends-on): Likewise. * modules/inet_pton (Depends-on): Likewise. * modules/ioctl (Depends-on): Likewise. * modules/isapipe (Depends-on): Likewise. * modules/isfinite (Depends-on): Likewise. * modules/isinf (Depends-on): Likewise. * modules/lchown (Depends-on): Likewise. * modules/ldexpl (Depends-on): Likewise. * modules/link (Depends-on): Likewise. * modules/linkat (Depends-on): Likewise. * modules/listen (Depends-on): Likewise. * modules/logl (Depends-on): Likewise. * modules/lstat (Depends-on): Likewise. * modules/mbrlen (Depends-on): Likewise. * modules/mbrtowc (Depends-on): Likewise. * modules/mbsinit (Depends-on): Likewise. * modules/mbsnrtowcs (Depends-on): Likewise. * modules/mbsrtowcs (Depends-on): Likewise. * modules/mbtowc (Depends-on): Likewise. * modules/memcmp (Depends-on): Likewise. * modules/mkdir (Depends-on): Likewise. * modules/mkdtemp (Depends-on): Likewise. * modules/mkfifo (Depends-on): Likewise. * modules/mkfifoat (Depends-on): Likewise. * modules/mknod (Depends-on): Likewise. * modules/mkostemp (Depends-on): Likewise. * modules/mkostemps (Depends-on): Likewise. * modules/mkstemp (Depends-on): Likewise. * modules/mkstemps (Depends-on): Likewise. * modules/mktime (Depends-on): Likewise. * modules/nanosleep (Depends-on): Likewise. * modules/open (Depends-on): Likewise. * modules/openat (Depends-on): Likewise. * modules/perror (Depends-on): Likewise. * modules/poll (Depends-on): Likewise. * modules/popen (Depends-on): Likewise. * modules/posix_spawn (Depends-on): Likewise. * modules/posix_spawn_file_actions_addclose (Depends-on): Likewise. * modules/posix_spawn_file_actions_adddup2 (Depends-on): Likewise. * modules/posix_spawn_file_actions_addopen (Depends-on): Likewise. * modules/posix_spawnp (Depends-on): Likewise. * modules/pread (Depends-on): Likewise. * modules/printf-posix (Depends-on): Likewise. * modules/ptsname (Depends-on): Likewise. * modules/putenv (Depends-on): Likewise. * modules/pwrite (Depends-on): Likewise. * modules/readline (Depends-on): Likewise. * modules/readlink (Depends-on): Likewise. * modules/readlinkat (Depends-on): Likewise. * modules/recv (Depends-on): Likewise. * modules/recvfrom (Depends-on): Likewise. * modules/regex (Depends-on): Likewise. * modules/remove (Depends-on): Likewise. * modules/rename (Depends-on): Likewise. * modules/renameat (Depends-on): Likewise. * modules/rmdir (Depends-on): Likewise. * modules/round (Depends-on): Likewise. * modules/roundf (Depends-on): Likewise. * modules/roundl (Depends-on): Likewise. * modules/rpmatch (Depends-on): Likewise. * modules/select (Depends-on): Likewise. * modules/send (Depends-on): Likewise. * modules/sendto (Depends-on): Likewise. * modules/setenv (Depends-on): Likewise. * modules/setlocale (Depends-on): Likewise. * modules/setsockopt (Depends-on): Likewise. * modules/shutdown (Depends-on): Likewise. * modules/sigaction (Depends-on): Likewise. * modules/signbit (Depends-on): Likewise. * modules/sigprocmask (Depends-on): Likewise. * modules/sinl (Depends-on): Likewise. * modules/sleep (Depends-on): Likewise. * modules/snprintf (Depends-on): Likewise. * modules/snprintf-posix (Depends-on): Likewise. * modules/socket (Depends-on): Likewise. * modules/sprintf-posix (Depends-on): Likewise. * modules/sqrtl (Depends-on): Likewise. * modules/stat (Depends-on): Likewise. * modules/strchrnul (Depends-on): Likewise. * modules/strdup-posix (Depends-on): Likewise. * modules/strerror (Depends-on): Likewise. * modules/strerror_r-posix (Depends-on): Likewise. * modules/strndup (Depends-on): Likewise. * modules/strnlen (Depends-on): Likewise. * modules/strptime (Depends-on): Likewise. * modules/strsep (Depends-on): Likewise. * modules/strsignal (Depends-on): Likewise. * modules/strstr-simple (Depends-on): Likewise. * modules/strtod (Depends-on): Likewise. * modules/strtoimax (Depends-on): Likewise. * modules/strtok_r (Depends-on): Likewise. * modules/strtoumax (Depends-on): Likewise. * modules/symlink (Depends-on): Likewise. * modules/symlinkat (Depends-on): Likewise. * modules/tanl (Depends-on): Likewise. * modules/tcgetsid (Depends-on): Likewise. * modules/tmpfile (Depends-on): Likewise. * modules/trunc (Depends-on): Likewise. * modules/truncf (Depends-on): Likewise. * modules/truncl (Depends-on): Likewise. * modules/uname (Depends-on): Likewise. * modules/unlink (Depends-on): Likewise. * modules/unlockpt (Depends-on): Likewise. * modules/unsetenv (Depends-on): Likewise. * modules/usleep (Depends-on): Likewise. * modules/utimensat (Depends-on): Likewise. * modules/vasprintf (Depends-on): Likewise. * modules/vdprintf (Depends-on): Likewise. * modules/vdprintf-posix (Depends-on): Likewise. * modules/vfprintf-posix (Depends-on): Likewise. * modules/vprintf-posix (Depends-on): Likewise. * modules/vsnprintf (Depends-on): Likewise. * modules/vsnprintf-posix (Depends-on): Likewise. * modules/vsprintf-posix (Depends-on): Likewise. * modules/wcrtomb (Depends-on): Likewise. * modules/wcscasecmp (Depends-on): Likewise. * modules/wcscspn (Depends-on): Likewise. * modules/wcsdup (Depends-on): Likewise. * modules/wcsncasecmp (Depends-on): Likewise. * modules/wcsnrtombs (Depends-on): Likewise. * modules/wcspbrk (Depends-on): Likewise. * modules/wcsrtombs (Depends-on): Likewise. * modules/wcsspn (Depends-on): Likewise. * modules/wcsstr (Depends-on): Likewise. * modules/wcstok (Depends-on): Likewise. * modules/wcswidth (Depends-on): Likewise. * modules/wctob (Depends-on): Likewise. * modules/wctomb (Depends-on): Likewise. * modules/wctype (Depends-on): Likewise. * modules/wcwidth (Depends-on): Likewise. * modules/write (Depends-on): Likewise. --- ChangeLog | 197 ++++++++++++++++++++++++++++++ modules/accept | 2 +- modules/acosl | 4 +- modules/argz | 12 +- modules/asinl | 2 +- modules/atanl | 2 +- modules/atoll | 2 +- modules/bind | 2 +- modules/btowc | 2 +- modules/canonicalize-lgpl | 16 +-- modules/ceil | 2 +- modules/ceilf | 2 +- modules/ceill | 2 +- modules/chdir-long | 19 +-- modules/chown | 8 +- modules/close | 2 +- modules/connect | 2 +- modules/cosl | 8 +- modules/dirfd | 2 +- modules/dprintf | 6 +- modules/dprintf-posix | 18 +-- modules/error | 4 +- modules/euidaccess | 6 +- modules/expl | 4 +- modules/faccessat | 6 +- modules/fchdir | 32 ++--- modules/fclose | 6 +- modules/fcntl | 4 +- modules/fdopendir | 8 +- modules/fflush | 14 +-- modules/floor | 2 +- modules/floorf | 2 +- modules/floorl | 2 +- modules/fnmatch | 16 +-- modules/fopen | 2 +- modules/fprintf-posix | 20 +-- modules/frexp | 2 +- modules/frexp-nolibm | 2 +- modules/frexpl | 4 +- modules/frexpl-nolibm | 4 +- modules/fseek | 2 +- modules/fsusage | 2 +- modules/ftell | 2 +- modules/ftello | 4 +- modules/futimens | 2 +- modules/getcwd | 16 +-- modules/getcwd-lgpl | 2 +- modules/getdelim | 8 +- modules/getdomainname | 4 +- modules/getgroups | 4 +- modules/gethostname | 6 +- modules/getline | 4 +- modules/getlogin_r | 4 +- modules/getopt-posix | 2 +- modules/getpeername | 2 +- modules/getsockname | 2 +- modules/getsockopt | 4 +- modules/getsubopt | 6 +- modules/getusershell | 4 +- modules/glob | 24 ++-- modules/grantpt | 6 +- modules/iconv_open | 4 +- modules/iconv_open-utf | 6 +- modules/inet_ntop | 6 +- modules/inet_pton | 8 +- modules/ioctl | 6 +- modules/isapipe | 6 +- modules/isfinite | 6 +- modules/isinf | 2 +- modules/lchown | 10 +- modules/ldexpl | 4 +- modules/link | 6 +- modules/linkat | 34 +++--- modules/listen | 2 +- modules/logl | 6 +- modules/lstat | 4 +- modules/mbrlen | 2 +- modules/mbrtowc | 8 +- modules/mbsinit | 4 +- modules/mbsnrtowcs | 8 +- modules/mbsrtowcs | 4 +- modules/mbtowc | 4 +- modules/memcmp | 2 +- modules/mkdir | 2 +- modules/mkdtemp | 4 +- modules/mkfifo | 2 +- modules/mkfifoat | 8 +- modules/mknod | 4 +- modules/mkostemp | 4 +- modules/mkostemps | 4 +- modules/mkstemp | 4 +- modules/mkstemps | 4 +- modules/mktime | 2 +- modules/nanosleep | 16 +-- modules/open | 2 +- modules/openat | 8 +- modules/perror | 4 +- modules/poll | 10 +- modules/popen | 2 +- modules/posix_spawn | 2 +- modules/posix_spawn_file_actions_addclose | 2 +- modules/posix_spawn_file_actions_adddup2 | 2 +- modules/posix_spawn_file_actions_addopen | 2 +- modules/posix_spawnp | 2 +- modules/pread | 6 +- modules/printf-posix | 2 +- modules/ptsname | 2 +- modules/putenv | 2 +- modules/pwrite | 6 +- modules/readline | 2 +- modules/readlink | 2 +- modules/readlinkat | 6 +- modules/recv | 2 +- modules/recvfrom | 4 +- modules/regex | 30 ++--- modules/remove | 4 +- modules/rename | 14 +-- modules/renameat | 14 +-- modules/rmdir | 4 +- modules/round | 4 +- modules/roundf | 2 +- modules/roundl | 2 +- modules/rpmatch | 8 +- modules/select | 4 +- modules/send | 2 +- modules/sendto | 2 +- modules/setenv | 8 +- modules/setlocale | 2 +- modules/setsockopt | 4 +- modules/shutdown | 2 +- modules/sigaction | 2 +- modules/signbit | 12 +- modules/sigprocmask | 4 +- modules/sinl | 8 +- modules/sleep | 4 +- modules/snprintf | 4 +- modules/snprintf-posix | 18 +-- modules/socket | 4 +- modules/sprintf-posix | 22 ++-- modules/sqrtl | 10 +- modules/stat | 4 +- modules/strchrnul | 4 +- modules/strdup-posix | 2 +- modules/strerror | 4 +- modules/strerror_r-posix | 6 +- modules/strndup | 4 +- modules/strnlen | 4 +- modules/strptime | 12 +- modules/strsep | 4 +- modules/strsignal | 10 +- modules/strstr-simple | 6 +- modules/strtod | 4 +- modules/strtoimax | 6 +- modules/strtok_r | 2 +- modules/strtoumax | 6 +- modules/symlink | 2 +- modules/symlinkat | 6 +- modules/tanl | 8 +- modules/tcgetsid | 2 +- modules/tmpfile | 6 +- modules/trunc | 2 +- modules/truncf | 2 +- modules/truncl | 2 +- modules/uname | 2 +- modules/unlink | 4 +- modules/unlockpt | 2 +- modules/unsetenv | 4 +- modules/usleep | 4 +- modules/utimensat | 4 +- modules/vasprintf | 6 +- modules/vdprintf | 6 +- modules/vdprintf-posix | 18 +-- modules/vfprintf-posix | 22 ++-- modules/vprintf-posix | 2 +- modules/vsnprintf | 4 +- modules/vsnprintf-posix | 18 +-- modules/vsprintf-posix | 22 ++-- modules/wcrtomb | 4 +- modules/wcscasecmp | 2 +- modules/wcscspn | 4 +- modules/wcsdup | 4 +- modules/wcsncasecmp | 2 +- modules/wcsnrtombs | 4 +- modules/wcspbrk | 2 +- modules/wcsrtombs | 4 +- modules/wcsspn | 2 +- modules/wcsstr | 2 +- modules/wcstok | 4 +- modules/wcswidth | 2 +- modules/wctob | 2 +- modules/wctomb | 4 +- modules/wctype | 2 +- modules/wcwidth | 10 +- modules/write | 2 +- 194 files changed, 751 insertions(+), 553 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9e21cfbde..88875b8ed7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,200 @@ +2011-05-03 Bruno Haible + + Avoid unnecessary compilation units, through conditional dependencies. + * modules/accept (Depends-on): Add conditions to the dependencies. + * modules/acosl (Depends-on): Likewise. + * modules/argz (Depends-on): Likewise. + * modules/asinl (Depends-on): Likewise. + * modules/atanl (Depends-on): Likewise. + * modules/atoll (Depends-on): Likewise. + * modules/bind (Depends-on): Likewise. + * modules/btowc (Depends-on): Likewise. + * modules/canonicalize-lgpl (Depends-on): Likewise. + * modules/ceil (Depends-on): Likewise. + * modules/ceilf (Depends-on): Likewise. + * modules/ceill (Depends-on): Likewise. + * modules/chdir-long (Depends-on): Likewise. + * modules/chown (Depends-on): Likewise. + * modules/close (Depends-on): Likewise. + * modules/connect (Depends-on): Likewise. + * modules/cosl (Depends-on): Likewise. + * modules/dirfd (Depends-on): Likewise. + * modules/dprintf (Depends-on): Likewise. + * modules/dprintf-posix (Depends-on): Likewise. + * modules/error (Depends-on): Likewise. + * modules/euidaccess (Depends-on): Likewise. + * modules/expl (Depends-on): Likewise. + * modules/faccessat (Depends-on): Likewise. + * modules/fchdir (Depends-on): Likewise. + * modules/fclose (Depends-on): Likewise. + * modules/fcntl (Depends-on): Likewise. + * modules/fdopendir (Depends-on): Likewise. + * modules/fflush (Depends-on): Likewise. + * modules/floor (Depends-on): Likewise. + * modules/floorf (Depends-on): Likewise. + * modules/floorl (Depends-on): Likewise. + * modules/fnmatch (Depends-on): Likewise. + * modules/fopen (Depends-on): Likewise. + * modules/fprintf-posix (Depends-on): Likewise. + * modules/frexp (Depends-on): Likewise. + * modules/frexp-nolibm (Depends-on): Likewise. + * modules/frexpl (Depends-on): Likewise. + * modules/frexpl-nolibm (Depends-on): Likewise. + * modules/fseek (Depends-on): Likewise. + * modules/fsusage (Depends-on): Likewise. + * modules/ftell (Depends-on): Likewise. + * modules/ftello (Depends-on): Likewise. + * modules/futimens (Depends-on): Likewise. + * modules/getcwd (Depends-on): Likewise. + * modules/getcwd-lgpl (Depends-on): Likewise. + * modules/getdelim (Depends-on): Likewise. + * modules/getdomainname (Depends-on): Likewise. + * modules/getgroups (Depends-on): Likewise. + * modules/gethostname (Depends-on): Likewise. + * modules/getline (Depends-on): Likewise. + * modules/getlogin_r (Depends-on): Likewise. + * modules/getopt-posix (Depends-on): Likewise. + * modules/getpeername (Depends-on): Likewise. + * modules/getsockname (Depends-on): Likewise. + * modules/getsockopt (Depends-on): Likewise. + * modules/getsubopt (Depends-on): Likewise. + * modules/getusershell (Depends-on): Likewise. + * modules/glob (Depends-on): Likewise. + * modules/grantpt (Depends-on): Likewise. + * modules/iconv_open (Depends-on): Likewise. + * modules/iconv_open-utf (Depends-on): Likewise. + * modules/inet_ntop (Depends-on): Likewise. + * modules/inet_pton (Depends-on): Likewise. + * modules/ioctl (Depends-on): Likewise. + * modules/isapipe (Depends-on): Likewise. + * modules/isfinite (Depends-on): Likewise. + * modules/isinf (Depends-on): Likewise. + * modules/lchown (Depends-on): Likewise. + * modules/ldexpl (Depends-on): Likewise. + * modules/link (Depends-on): Likewise. + * modules/linkat (Depends-on): Likewise. + * modules/listen (Depends-on): Likewise. + * modules/logl (Depends-on): Likewise. + * modules/lstat (Depends-on): Likewise. + * modules/mbrlen (Depends-on): Likewise. + * modules/mbrtowc (Depends-on): Likewise. + * modules/mbsinit (Depends-on): Likewise. + * modules/mbsnrtowcs (Depends-on): Likewise. + * modules/mbsrtowcs (Depends-on): Likewise. + * modules/mbtowc (Depends-on): Likewise. + * modules/memcmp (Depends-on): Likewise. + * modules/mkdir (Depends-on): Likewise. + * modules/mkdtemp (Depends-on): Likewise. + * modules/mkfifo (Depends-on): Likewise. + * modules/mkfifoat (Depends-on): Likewise. + * modules/mknod (Depends-on): Likewise. + * modules/mkostemp (Depends-on): Likewise. + * modules/mkostemps (Depends-on): Likewise. + * modules/mkstemp (Depends-on): Likewise. + * modules/mkstemps (Depends-on): Likewise. + * modules/mktime (Depends-on): Likewise. + * modules/nanosleep (Depends-on): Likewise. + * modules/open (Depends-on): Likewise. + * modules/openat (Depends-on): Likewise. + * modules/perror (Depends-on): Likewise. + * modules/poll (Depends-on): Likewise. + * modules/popen (Depends-on): Likewise. + * modules/posix_spawn (Depends-on): Likewise. + * modules/posix_spawn_file_actions_addclose (Depends-on): Likewise. + * modules/posix_spawn_file_actions_adddup2 (Depends-on): Likewise. + * modules/posix_spawn_file_actions_addopen (Depends-on): Likewise. + * modules/posix_spawnp (Depends-on): Likewise. + * modules/pread (Depends-on): Likewise. + * modules/printf-posix (Depends-on): Likewise. + * modules/ptsname (Depends-on): Likewise. + * modules/putenv (Depends-on): Likewise. + * modules/pwrite (Depends-on): Likewise. + * modules/readline (Depends-on): Likewise. + * modules/readlink (Depends-on): Likewise. + * modules/readlinkat (Depends-on): Likewise. + * modules/recv (Depends-on): Likewise. + * modules/recvfrom (Depends-on): Likewise. + * modules/regex (Depends-on): Likewise. + * modules/remove (Depends-on): Likewise. + * modules/rename (Depends-on): Likewise. + * modules/renameat (Depends-on): Likewise. + * modules/rmdir (Depends-on): Likewise. + * modules/round (Depends-on): Likewise. + * modules/roundf (Depends-on): Likewise. + * modules/roundl (Depends-on): Likewise. + * modules/rpmatch (Depends-on): Likewise. + * modules/select (Depends-on): Likewise. + * modules/send (Depends-on): Likewise. + * modules/sendto (Depends-on): Likewise. + * modules/setenv (Depends-on): Likewise. + * modules/setlocale (Depends-on): Likewise. + * modules/setsockopt (Depends-on): Likewise. + * modules/shutdown (Depends-on): Likewise. + * modules/sigaction (Depends-on): Likewise. + * modules/signbit (Depends-on): Likewise. + * modules/sigprocmask (Depends-on): Likewise. + * modules/sinl (Depends-on): Likewise. + * modules/sleep (Depends-on): Likewise. + * modules/snprintf (Depends-on): Likewise. + * modules/snprintf-posix (Depends-on): Likewise. + * modules/socket (Depends-on): Likewise. + * modules/sprintf-posix (Depends-on): Likewise. + * modules/sqrtl (Depends-on): Likewise. + * modules/stat (Depends-on): Likewise. + * modules/strchrnul (Depends-on): Likewise. + * modules/strdup-posix (Depends-on): Likewise. + * modules/strerror (Depends-on): Likewise. + * modules/strerror_r-posix (Depends-on): Likewise. + * modules/strndup (Depends-on): Likewise. + * modules/strnlen (Depends-on): Likewise. + * modules/strptime (Depends-on): Likewise. + * modules/strsep (Depends-on): Likewise. + * modules/strsignal (Depends-on): Likewise. + * modules/strstr-simple (Depends-on): Likewise. + * modules/strtod (Depends-on): Likewise. + * modules/strtoimax (Depends-on): Likewise. + * modules/strtok_r (Depends-on): Likewise. + * modules/strtoumax (Depends-on): Likewise. + * modules/symlink (Depends-on): Likewise. + * modules/symlinkat (Depends-on): Likewise. + * modules/tanl (Depends-on): Likewise. + * modules/tcgetsid (Depends-on): Likewise. + * modules/tmpfile (Depends-on): Likewise. + * modules/trunc (Depends-on): Likewise. + * modules/truncf (Depends-on): Likewise. + * modules/truncl (Depends-on): Likewise. + * modules/uname (Depends-on): Likewise. + * modules/unlink (Depends-on): Likewise. + * modules/unlockpt (Depends-on): Likewise. + * modules/unsetenv (Depends-on): Likewise. + * modules/usleep (Depends-on): Likewise. + * modules/utimensat (Depends-on): Likewise. + * modules/vasprintf (Depends-on): Likewise. + * modules/vdprintf (Depends-on): Likewise. + * modules/vdprintf-posix (Depends-on): Likewise. + * modules/vfprintf-posix (Depends-on): Likewise. + * modules/vprintf-posix (Depends-on): Likewise. + * modules/vsnprintf (Depends-on): Likewise. + * modules/vsnprintf-posix (Depends-on): Likewise. + * modules/vsprintf-posix (Depends-on): Likewise. + * modules/wcrtomb (Depends-on): Likewise. + * modules/wcscasecmp (Depends-on): Likewise. + * modules/wcscspn (Depends-on): Likewise. + * modules/wcsdup (Depends-on): Likewise. + * modules/wcsncasecmp (Depends-on): Likewise. + * modules/wcsnrtombs (Depends-on): Likewise. + * modules/wcspbrk (Depends-on): Likewise. + * modules/wcsrtombs (Depends-on): Likewise. + * modules/wcsspn (Depends-on): Likewise. + * modules/wcsstr (Depends-on): Likewise. + * modules/wcstok (Depends-on): Likewise. + * modules/wcswidth (Depends-on): Likewise. + * modules/wctob (Depends-on): Likewise. + * modules/wctomb (Depends-on): Likewise. + * modules/wctype (Depends-on): Likewise. + * modules/wcwidth (Depends-on): Likewise. + * modules/write (Depends-on): Likewise. + 2011-05-03 Bruno Haible Support for conditional dependencies. diff --git a/modules/accept b/modules/accept index d1c954edbf..fb46f98a89 100644 --- a/modules/accept +++ b/modules/accept @@ -7,7 +7,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/acosl b/modules/acosl index 3c49196f35..ed3a26d74f 100644 --- a/modules/acosl +++ b/modules/acosl @@ -8,8 +8,8 @@ m4/acosl.m4 Depends-on: math extensions -asinl -sqrtl +asinl [test $HAVE_ACOSL = 0] +sqrtl [test $HAVE_ACOSL = 0] configure.ac: gl_FUNC_ACOSL diff --git a/modules/argz b/modules/argz index 0c56ac7685..2cbb2123e3 100644 --- a/modules/argz +++ b/modules/argz @@ -7,12 +7,12 @@ lib/argz.c m4/argz.m4 Depends-on: -memmove -mempcpy -stpcpy -strndup -strnlen -strstr +memmove [test -n "$ARGZ_H"] +mempcpy [test -n "$ARGZ_H"] +stpcpy [test -n "$ARGZ_H"] +strndup [test -n "$ARGZ_H"] +strnlen [test -n "$ARGZ_H"] +strstr [test -n "$ARGZ_H"] configure.ac: gl_FUNC_ARGZ diff --git a/modules/asinl b/modules/asinl index 7f254ab461..df6ab281e5 100644 --- a/modules/asinl +++ b/modules/asinl @@ -8,7 +8,7 @@ m4/asinl.m4 Depends-on: math extensions -sqrtl +sqrtl [test $HAVE_ASINL = 0] configure.ac: gl_FUNC_ASINL diff --git a/modules/atanl b/modules/atanl index f6ba1b85a9..7c512e5c59 100644 --- a/modules/atanl +++ b/modules/atanl @@ -8,7 +8,7 @@ m4/atanl.m4 Depends-on: math extensions -isnanl +isnanl [test $HAVE_ATANL = 0] configure.ac: gl_FUNC_ATANL diff --git a/modules/atoll b/modules/atoll index 5f0571293e..d979a008f2 100644 --- a/modules/atoll +++ b/modules/atoll @@ -7,7 +7,7 @@ m4/atoll.m4 m4/longlong.m4 Depends-on: -strtoll +strtoll [test $HAVE_ATOLL = 0] configure.ac: gl_FUNC_ATOLL diff --git a/modules/bind b/modules/bind index 050f0e65c7..5c4595ffda 100644 --- a/modules/bind +++ b/modules/bind @@ -7,7 +7,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/btowc b/modules/btowc index 10c5f3f9a5..1566a2fa71 100644 --- a/modules/btowc +++ b/modules/btowc @@ -8,7 +8,7 @@ m4/locale-fr.m4 Depends-on: wchar -mbtowc +mbtowc [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1] configure.ac: gl_FUNC_BTOWC diff --git a/modules/canonicalize-lgpl b/modules/canonicalize-lgpl index 6a748f3000..1fb23c29f3 100644 --- a/modules/canonicalize-lgpl +++ b/modules/canonicalize-lgpl @@ -7,16 +7,16 @@ m4/canonicalize.m4 m4/double-slash-root.m4 Depends-on: -alloca-opt -errno extensions -lstat -malloca -memmove -pathmax -readlink stdlib -sys_stat +alloca-opt [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +errno [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +lstat [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +malloca [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +memmove [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +pathmax [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +readlink [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +sys_stat [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] configure.ac: gl_CANONICALIZE_LGPL diff --git a/modules/ceil b/modules/ceil index 90e03fce2c..1a3a5de496 100644 --- a/modules/ceil +++ b/modules/ceil @@ -7,7 +7,7 @@ m4/ceil.m4 Depends-on: math -float +float [test $REPLACE_CEIL = 1] configure.ac: gl_FUNC_CEIL diff --git a/modules/ceilf b/modules/ceilf index 3c0082c783..beba067aea 100644 --- a/modules/ceilf +++ b/modules/ceilf @@ -9,7 +9,7 @@ m4/ceilf.m4 Depends-on: math extensions -float +float [test $HAVE_DECL_CEILF = 0 || test $REPLACE_CEILF = 1] configure.ac: gl_FUNC_CEILF diff --git a/modules/ceill b/modules/ceill index a2365c272b..51d5b92bc5 100644 --- a/modules/ceill +++ b/modules/ceill @@ -9,7 +9,7 @@ m4/ceill.m4 Depends-on: math extensions -float +float [test $HAVE_DECL_CEILL = 0 || test $REPLACE_CEILL = 1] configure.ac: gl_FUNC_CEILL diff --git a/modules/chdir-long b/modules/chdir-long index eb08151d63..0c8e7926ef 100644 --- a/modules/chdir-long +++ b/modules/chdir-long @@ -7,15 +7,16 @@ lib/chdir-long.c m4/chdir-long.m4 Depends-on: -atexit -fchdir -fcntl-h -openat -memchr -mempcpy -memrchr -stdbool -stdlib +unistd +atexit [test $gl_cv_have_arbitrary_file_name_length_limit = yes] +fchdir [test $gl_cv_have_arbitrary_file_name_length_limit = yes] +fcntl-h [test $gl_cv_have_arbitrary_file_name_length_limit = yes] +openat [test $gl_cv_have_arbitrary_file_name_length_limit = yes] +memchr [test $gl_cv_have_arbitrary_file_name_length_limit = yes] +mempcpy [test $gl_cv_have_arbitrary_file_name_length_limit = yes] +memrchr [test $gl_cv_have_arbitrary_file_name_length_limit = yes] +stdbool [test $gl_cv_have_arbitrary_file_name_length_limit = yes] +stdlib [test $gl_cv_have_arbitrary_file_name_length_limit = yes] configure.ac: gl_FUNC_CHDIR_LONG diff --git a/modules/chown b/modules/chown index 94bff841c7..ccfeb3bcdd 100644 --- a/modules/chown +++ b/modules/chown @@ -7,11 +7,11 @@ lib/fchown-stub.c m4/chown.m4 Depends-on: -open -stat -stdbool -sys_stat unistd +open [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1] +stat [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1] +stdbool [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1] +sys_stat [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1] configure.ac: gl_FUNC_CHOWN diff --git a/modules/close b/modules/close index 88e1608726..cbfa08059f 100644 --- a/modules/close +++ b/modules/close @@ -7,7 +7,7 @@ m4/close.m4 Depends-on: unistd -fd-hook +fd-hook [test $REPLACE_CLOSE = 1] fclose configure.ac: diff --git a/modules/connect b/modules/connect index 1381ffaf91..c90f094382 100644 --- a/modules/connect +++ b/modules/connect @@ -7,7 +7,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/cosl b/modules/cosl index 88ebf9c40e..33f2e68a8f 100644 --- a/modules/cosl +++ b/modules/cosl @@ -11,10 +11,10 @@ m4/cosl.m4 Depends-on: math extensions -float -isnanl -floor -floorl +float [test $HAVE_COSL = 0] +isnanl [test $HAVE_COSL = 0] +floor [test $HAVE_COSL = 0] +floorl [test $HAVE_COSL = 0] configure.ac: gl_FUNC_COSL diff --git a/modules/dirfd b/modules/dirfd index 42ff4d7a0f..8410f38d72 100644 --- a/modules/dirfd +++ b/modules/dirfd @@ -7,8 +7,8 @@ m4/dirfd.m4 Depends-on: dirent -errno extensions +errno [test $ac_cv_have_decl_dirfd = no || test $REPLACE_DIRFD = 1] configure.ac: gl_FUNC_DIRFD diff --git a/modules/dprintf b/modules/dprintf index 6ebbde4c0a..8c08def360 100644 --- a/modules/dprintf +++ b/modules/dprintf @@ -7,9 +7,9 @@ m4/dprintf.m4 Depends-on: stdio -vasnprintf -full-write -errno +vasnprintf [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +full-write [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +errno [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] configure.ac: gl_FUNC_DPRINTF diff --git a/modules/dprintf-posix b/modules/dprintf-posix index 19a471807e..2423d61628 100644 --- a/modules/dprintf-posix +++ b/modules/dprintf-posix @@ -14,18 +14,18 @@ m4/printf.m4 Depends-on: dprintf -vasnprintf -isnand-nolibm -isnanl-nolibm -frexp-nolibm -frexpl-nolibm -printf-frexp -printf-frexpl -signbit -fpucw nocrash printf-safe multiarch +vasnprintf [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +isnand-nolibm [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +isnanl-nolibm [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +frexp-nolibm [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +frexpl-nolibm [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +printf-frexp [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +printf-frexpl [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +signbit [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] +fpucw [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1] configure.ac: gl_FUNC_DPRINTF_POSIX diff --git a/modules/error b/modules/error index 7d43aba1cc..a1ec1e953f 100644 --- a/modules/error +++ b/modules/error @@ -12,8 +12,8 @@ lib/error.c m4/error.m4 Depends-on: -strerror -unistd +strerror [test $ac_cv_lib_error_at_line = no] +unistd [test $ac_cv_lib_error_at_line = no] configure.ac: gl_ERROR diff --git a/modules/euidaccess b/modules/euidaccess index 93333f5e8e..56bcf28f1b 100644 --- a/modules/euidaccess +++ b/modules/euidaccess @@ -8,9 +8,9 @@ m4/euidaccess.m4 Depends-on: unistd extensions -group-member -stat -sys_stat +group-member [test $HAVE_EUIDACCESS = 0] +stat [test $HAVE_EUIDACCESS = 0] +sys_stat [test $HAVE_EUIDACCESS = 0] configure.ac: gl_FUNC_EUIDACCESS diff --git a/modules/expl b/modules/expl index 3870440e75..7681b3522a 100644 --- a/modules/expl +++ b/modules/expl @@ -8,8 +8,8 @@ m4/expl.m4 Depends-on: math extensions -float -floorl +float [test $HAVE_EXPL = 0] +floorl [test $HAVE_EXPL = 0] configure.ac: gl_FUNC_EXPL diff --git a/modules/faccessat b/modules/faccessat index 92d818556b..ce8fa0d892 100644 --- a/modules/faccessat +++ b/modules/faccessat @@ -6,11 +6,11 @@ lib/faccessat.c m4/faccessat.m4 Depends-on: -euidaccess +unistd extensions fcntl-h -openat -unistd +euidaccess [test $HAVE_FACCESSAT = 0] +openat [test $HAVE_FACCESSAT = 0] configure.ac: gl_FUNC_FACCESSAT diff --git a/modules/fchdir b/modules/fchdir index 8589193ec0..7b7cb043b5 100644 --- a/modules/fchdir +++ b/modules/fchdir @@ -6,23 +6,23 @@ lib/fchdir.c m4/fchdir.m4 Depends-on: -close -dirent -dirfd -dosname -dup2 -fcntl -fcntl-h -filenamecat-lgpl -getcwd-lgpl -malloc-posix -open -realloc-posix -stat -stdbool -strdup-posix -sys_stat unistd +close [test $HAVE_FCHDIR = 0] +dirent [test $HAVE_FCHDIR = 0] +dirfd [test $HAVE_FCHDIR = 0] +dosname [test $HAVE_FCHDIR = 0] +dup2 [test $HAVE_FCHDIR = 0] +fcntl [test $HAVE_FCHDIR = 0] +fcntl-h [test $HAVE_FCHDIR = 0] +filenamecat-lgpl [test $HAVE_FCHDIR = 0] +getcwd-lgpl [test $HAVE_FCHDIR = 0] +malloc-posix [test $HAVE_FCHDIR = 0] +open [test $HAVE_FCHDIR = 0] +realloc-posix [test $HAVE_FCHDIR = 0] +stat [test $HAVE_FCHDIR = 0] +stdbool [test $HAVE_FCHDIR = 0] +strdup-posix [test $HAVE_FCHDIR = 0] +sys_stat [test $HAVE_FCHDIR = 0] configure.ac: gl_FUNC_FCHDIR diff --git a/modules/fclose b/modules/fclose index 434dd737dc..ac383aa24b 100644 --- a/modules/fclose +++ b/modules/fclose @@ -7,9 +7,9 @@ m4/fclose.m4 Depends-on: stdio -close -freading -lseek +close [test $REPLACE_FCLOSE = 1] +freading [test $REPLACE_FCLOSE = 1] +lseek [test $REPLACE_FCLOSE = 1] configure.ac: gl_FUNC_FCLOSE diff --git a/modules/fcntl b/modules/fcntl index 67630f9f01..855ee9f974 100644 --- a/modules/fcntl +++ b/modules/fcntl @@ -6,10 +6,10 @@ m4/fcntl.m4 lib/fcntl.c Depends-on: -dup2 fcntl-h -getdtablesize extensions +dup2 [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1] +getdtablesize [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1] configure.ac: gl_FUNC_FCNTL diff --git a/modules/fdopendir b/modules/fdopendir index 203f6c72d1..0612b74d68 100644 --- a/modules/fdopendir +++ b/modules/fdopendir @@ -9,11 +9,11 @@ m4/fdopendir.m4 Depends-on: dirent -errno extensions -fchdir -openat-die -save-cwd +errno [test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1] +fchdir [test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1] +openat-die [test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1] +save-cwd [test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1] configure.ac: gl_FUNC_FDOPENDIR diff --git a/modules/fflush b/modules/fflush index 2d5839db4c..e9649e09c8 100644 --- a/modules/fflush +++ b/modules/fflush @@ -7,14 +7,14 @@ lib/stdio-impl.h m4/fflush.m4 Depends-on: -fclose -fpurge -ftello -freading -lseek stdio -unistd -fseeko +fclose +fpurge [test $REPLACE_FFLUSH = 1] +ftello [test $REPLACE_FFLUSH = 1] +freading [test $REPLACE_FFLUSH = 1] +lseek [test $REPLACE_FFLUSH = 1] +unistd [test $REPLACE_FFLUSH = 1] +fseeko [test $REPLACE_FFLUSH = 1] configure.ac-early: AC_REQUIRE([AC_FUNC_FSEEKO]) diff --git a/modules/floor b/modules/floor index ee898d3cd6..1393dadad4 100644 --- a/modules/floor +++ b/modules/floor @@ -7,7 +7,7 @@ m4/floor.m4 Depends-on: math -float +float [test $REPLACE_FLOOR = 1] configure.ac: gl_FUNC_FLOOR diff --git a/modules/floorf b/modules/floorf index 47b9d5ca24..1f9d9da595 100644 --- a/modules/floorf +++ b/modules/floorf @@ -9,7 +9,7 @@ m4/floorf.m4 Depends-on: math extensions -float +float [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1] configure.ac: gl_FUNC_FLOORF diff --git a/modules/floorl b/modules/floorl index 66c13621ad..e21199335e 100644 --- a/modules/floorl +++ b/modules/floorl @@ -9,7 +9,7 @@ m4/floorl.m4 Depends-on: math extensions -float +float [test $HAVE_DECL_FLOORL = 0 || test $REPLACE_FLOORL = 1] configure.ac: gl_FUNC_FLOORL diff --git a/modules/fnmatch b/modules/fnmatch index fde25a1733..12e5906afd 100644 --- a/modules/fnmatch +++ b/modules/fnmatch @@ -11,14 +11,14 @@ m4/fnmatch.m4 Depends-on: arg-nonnull extensions -alloca -stdbool -wchar -wctype-h -memchr -memcmp -mbsrtowcs -mbsinit +alloca [test -n "$FNMATCH_H"] +stdbool [test -n "$FNMATCH_H"] +wchar [test -n "$FNMATCH_H"] +wctype-h [test -n "$FNMATCH_H"] +memchr [test -n "$FNMATCH_H"] +memcmp [test -n "$FNMATCH_H"] +mbsrtowcs [test -n "$FNMATCH_H"] +mbsinit [test -n "$FNMATCH_H"] configure.ac: gl_FUNC_FNMATCH_POSIX diff --git a/modules/fopen b/modules/fopen index eddd7f650c..2177a3bf95 100644 --- a/modules/fopen +++ b/modules/fopen @@ -7,7 +7,7 @@ m4/fopen.m4 Depends-on: stdio -unistd +unistd [test $REPLACE_FOPEN = 1] configure.ac: gl_FUNC_FOPEN diff --git a/modules/fprintf-posix b/modules/fprintf-posix index be2b010dd8..47e76c5c50 100644 --- a/modules/fprintf-posix +++ b/modules/fprintf-posix @@ -14,20 +14,20 @@ m4/printf.m4 Depends-on: stdio -fseterr -vasnprintf -isnand-nolibm -isnanl-nolibm -frexp-nolibm -frexpl-nolibm -printf-frexp -printf-frexpl -signbit -fpucw nocrash printf-safe errno multiarch +fseterr [test $REPLACE_FPRINTF = 1] +vasnprintf [test $REPLACE_FPRINTF = 1] +isnand-nolibm [test $REPLACE_FPRINTF = 1] +isnanl-nolibm [test $REPLACE_FPRINTF = 1] +frexp-nolibm [test $REPLACE_FPRINTF = 1] +frexpl-nolibm [test $REPLACE_FPRINTF = 1] +printf-frexp [test $REPLACE_FPRINTF = 1] +printf-frexpl [test $REPLACE_FPRINTF = 1] +signbit [test $REPLACE_FPRINTF = 1] +fpucw [test $REPLACE_FPRINTF = 1] configure.ac: gl_FUNC_FPRINTF_POSIX diff --git a/modules/frexp b/modules/frexp index 7fae366dbe..3ada9b2f29 100644 --- a/modules/frexp +++ b/modules/frexp @@ -7,7 +7,7 @@ m4/frexp.m4 Depends-on: math -isnand-nolibm +isnand-nolibm [test $gl_func_frexp != yes] configure.ac: gl_FUNC_FREXP diff --git a/modules/frexp-nolibm b/modules/frexp-nolibm index 6a909e972f..34eb958a99 100644 --- a/modules/frexp-nolibm +++ b/modules/frexp-nolibm @@ -7,7 +7,7 @@ m4/frexp.m4 Depends-on: math -isnand-nolibm +isnand-nolibm [test $gl_func_frexp_no_libm != yes] configure.ac: gl_FUNC_FREXP_NO_LIBM diff --git a/modules/frexpl b/modules/frexpl index 185d54dde2..d1f0159b63 100644 --- a/modules/frexpl +++ b/modules/frexpl @@ -8,8 +8,8 @@ m4/frexpl.m4 Depends-on: math -isnanl-nolibm -fpucw +isnanl-nolibm [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no] +fpucw [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no] configure.ac: gl_FUNC_FREXPL diff --git a/modules/frexpl-nolibm b/modules/frexpl-nolibm index 80ce8fb701..dbe1a82820 100644 --- a/modules/frexpl-nolibm +++ b/modules/frexpl-nolibm @@ -9,8 +9,8 @@ m4/frexpl.m4 Depends-on: math -isnanl-nolibm -fpucw +isnanl-nolibm [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no] +fpucw [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no] configure.ac: gl_FUNC_FREXPL_NO_LIBM diff --git a/modules/fseek b/modules/fseek index 07f948e8e1..98c6d3f57f 100644 --- a/modules/fseek +++ b/modules/fseek @@ -6,8 +6,8 @@ lib/fseek.c m4/fseek.m4 Depends-on: -fseeko stdio +fseeko [test $REPLACE_FSEEK = 1] configure.ac: gl_FUNC_FSEEK diff --git a/modules/fsusage b/modules/fsusage index c8496880bd..cdefb60cf2 100644 --- a/modules/fsusage +++ b/modules/fsusage @@ -7,9 +7,9 @@ lib/fsusage.c m4/fsusage.m4 Depends-on: -full-read stdbool stdint +full-read [test $gl_cv_fs_space = yes] configure.ac: gl_FSUSAGE diff --git a/modules/ftell b/modules/ftell index 6e9dc25965..cc95d169f0 100644 --- a/modules/ftell +++ b/modules/ftell @@ -6,9 +6,9 @@ lib/ftell.c m4/ftell.m4 Depends-on: -ftello stdio errno +ftello [test $REPLACE_FTELL = 1] configure.ac: gl_FUNC_FTELL diff --git a/modules/ftello b/modules/ftello index 0cf160c981..b042e84808 100644 --- a/modules/ftello +++ b/modules/ftello @@ -8,9 +8,9 @@ m4/fseeko.m4 m4/ftello.m4 Depends-on: -extensions -lseek stdio +extensions +lseek [test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1] configure.ac-early: AC_REQUIRE([AC_FUNC_FSEEKO]) diff --git a/modules/futimens b/modules/futimens index 17bff44a0a..2e6ecf8749 100644 --- a/modules/futimens +++ b/modules/futimens @@ -7,8 +7,8 @@ m4/futimens.m4 Depends-on: sys_stat -utimens extensions +utimens [test $HAVE_FUTIMENS = 0 || test $REPLACE_FUTIMENS = 1] configure.ac: gl_FUNC_FUTIMENS diff --git a/modules/getcwd b/modules/getcwd index 27ec25a458..cc80bfe882 100644 --- a/modules/getcwd +++ b/modules/getcwd @@ -8,15 +8,15 @@ m4/getcwd-path-max.m4 m4/getcwd.m4 Depends-on: -mempcpy -d-ino -extensions -memmove -openat -stdbool unistd -malloc-posix -strdup-posix +extensions +mempcpy [test $REPLACE_GETCWD = 1] +d-ino [test $REPLACE_GETCWD = 1] +memmove [test $REPLACE_GETCWD = 1] +openat [test $REPLACE_GETCWD = 1] +stdbool [test $REPLACE_GETCWD = 1] +malloc-posix [test $REPLACE_GETCWD = 1] +strdup-posix [test $REPLACE_GETCWD = 1] configure.ac: gl_FUNC_GETCWD diff --git a/modules/getcwd-lgpl b/modules/getcwd-lgpl index 1b9c87bf50..72e6a7fc08 100644 --- a/modules/getcwd-lgpl +++ b/modules/getcwd-lgpl @@ -6,8 +6,8 @@ lib/getcwd-lgpl.c m4/getcwd.m4 Depends-on: -strdup unistd +strdup [test $REPLACE_GETCWD = 1] configure.ac: gl_FUNC_GETCWD_LGPL diff --git a/modules/getdelim b/modules/getdelim index 0f17b608fa..c3ef317a11 100644 --- a/modules/getdelim +++ b/modules/getdelim @@ -6,11 +6,11 @@ lib/getdelim.c m4/getdelim.m4 Depends-on: -extensions stdio -stdint -realloc-posix -errno +extensions +stdint [test $HAVE_DECL_GETDELIM = 0 || test $REPLACE_GETDELIM = 1] +realloc-posix [test $HAVE_DECL_GETDELIM = 0 || test $REPLACE_GETDELIM = 1] +errno [test $HAVE_DECL_GETDELIM = 0 || test $REPLACE_GETDELIM = 1] configure.ac: gl_FUNC_GETDELIM diff --git a/modules/getdomainname b/modules/getdomainname index 5a9d23f585..c7f77b0ec0 100644 --- a/modules/getdomainname +++ b/modules/getdomainname @@ -8,8 +8,8 @@ m4/getdomainname.m4 Depends-on: unistd extensions -netdb -sys_socket +netdb [test $HAVE_DECL_GETDOMAINNAME = 0 || test $REPLACE_GETDOMAINNAME = 1] +sys_socket [test $HAVE_DECL_GETDOMAINNAME = 0 || test $REPLACE_GETDOMAINNAME = 1] configure.ac: gl_FUNC_GETDOMAINNAME diff --git a/modules/getgroups b/modules/getgroups index aabcefc5cc..438236befa 100644 --- a/modules/getgroups +++ b/modules/getgroups @@ -6,9 +6,9 @@ lib/getgroups.c m4/getgroups.m4 Depends-on: -malloc-posix -stdint unistd +malloc-posix [test $HAVE_GETGROUPS = 0 || test $REPLACE_GETGROUPS = 1] +stdint [test $HAVE_GETGROUPS = 0 || test $REPLACE_GETGROUPS = 1] configure.ac: gl_FUNC_GETGROUPS diff --git a/modules/gethostname b/modules/gethostname index 8c24571276..359434ab37 100644 --- a/modules/gethostname +++ b/modules/gethostname @@ -8,9 +8,9 @@ lib/w32sock.h Depends-on: unistd -sys_socket -errno -sockets +sys_socket [test $HAVE_GETHOSTNAME = 0] +errno [test $HAVE_GETHOSTNAME = 0] +sockets [test $HAVE_GETHOSTNAME = 0] configure.ac: gl_FUNC_GETHOSTNAME diff --git a/modules/getline b/modules/getline index 1fb9b9c22e..b565f6620b 100644 --- a/modules/getline +++ b/modules/getline @@ -6,9 +6,9 @@ lib/getline.c m4/getline.m4 Depends-on: -extensions -getdelim stdio +extensions +getdelim [test $REPLACE_GETLINE = 1] configure.ac: gl_FUNC_GETLINE diff --git a/modules/getlogin_r b/modules/getlogin_r index 1d5c20b836..c0fb4a691f 100644 --- a/modules/getlogin_r +++ b/modules/getlogin_r @@ -6,9 +6,9 @@ lib/getlogin_r.c m4/getlogin_r.m4 Depends-on: -extensions unistd -memchr +extensions +memchr [test $HAVE_GETLOGIN_R = 0 || test $REPLACE_GETLOGIN_R = 1] configure.ac: gl_FUNC_GETLOGIN_R diff --git a/modules/getopt-posix b/modules/getopt-posix index 18bad69dac..6be0cbce89 100644 --- a/modules/getopt-posix +++ b/modules/getopt-posix @@ -9,11 +9,11 @@ lib/getopt_int.h m4/getopt.m4 Depends-on: -gettext-h unistd extensions include_next arg-nonnull +gettext-h [test $GNULIB_UNISTD_H_GETOPT = 1] configure.ac: gl_FUNC_GETOPT_POSIX diff --git a/modules/getpeername b/modules/getpeername index a8a4fcaff2..4cdae38e2e 100644 --- a/modules/getpeername +++ b/modules/getpeername @@ -8,7 +8,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/getsockname b/modules/getsockname index a7f8881c74..223479e406 100644 --- a/modules/getsockname +++ b/modules/getsockname @@ -8,7 +8,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/getsockopt b/modules/getsockopt index 40ff649817..5b8c18d854 100644 --- a/modules/getsockopt +++ b/modules/getsockopt @@ -7,8 +7,8 @@ lib/w32sock.h Depends-on: sys_socket -sys_time -errno +sys_time [test "$ac_cv_header_winsock2_h" = yes] +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/getsubopt b/modules/getsubopt index a28e2a0a2c..eaf8e87b38 100644 --- a/modules/getsubopt +++ b/modules/getsubopt @@ -6,10 +6,10 @@ lib/getsubopt.c m4/getsubopt.m4 Depends-on: -extensions -strchrnul stdlib -memchr +extensions +strchrnul [test $HAVE_GETSUBOPT = 0] +memchr [test $HAVE_GETSUBOPT = 0] configure.ac: gl_FUNC_GETSUBOPT diff --git a/modules/getusershell b/modules/getusershell index 9ae7dcae1e..56e8b5f0e0 100644 --- a/modules/getusershell +++ b/modules/getusershell @@ -8,8 +8,8 @@ m4/getusershell.m4 Depends-on: unistd extensions -fopen-safer -xalloc +fopen-safer [test $ac_cv_func_getusershell = no] +xalloc [test $ac_cv_func_getusershell = no] configure.ac: gl_FUNC_GETUSERSHELL diff --git a/modules/glob b/modules/glob index 114cb6d121..db5410b51b 100644 --- a/modules/glob +++ b/modules/glob @@ -9,22 +9,22 @@ lib/glob.c m4/glob.m4 Depends-on: -alloca arg-nonnull c++defs -d-type -dirfd extensions -fnmatch -getlogin_r -memchr -mempcpy -stdbool -strdup -sys_stat -unistd warn-on-use -malloc-posix +alloca [test -n "$GLOB_H"] +d-type [test -n "$GLOB_H"] +dirfd [test -n "$GLOB_H"] +fnmatch [test -n "$GLOB_H"] +getlogin_r [test -n "$GLOB_H"] +memchr [test -n "$GLOB_H"] +mempcpy [test -n "$GLOB_H"] +stdbool [test -n "$GLOB_H"] +strdup [test -n "$GLOB_H"] +sys_stat [test -n "$GLOB_H"] +unistd [test -n "$GLOB_H"] +malloc-posix [test -n "$GLOB_H"] configure.ac: gl_GLOB diff --git a/modules/grantpt b/modules/grantpt index a5d9eb4034..589360d175 100644 --- a/modules/grantpt +++ b/modules/grantpt @@ -8,9 +8,9 @@ m4/grantpt.m4 Depends-on: stdlib extensions -pt_chown -waitpid -configmake +pt_chown [test $HAVE_GRANTPT = 0] +waitpid [test $HAVE_GRANTPT = 0] +configmake [test $HAVE_GRANTPT = 0] configure.ac: gl_FUNC_GRANTPT diff --git a/modules/iconv_open b/modules/iconv_open index 7b8190fe74..ee7de0eaf4 100644 --- a/modules/iconv_open +++ b/modules/iconv_open @@ -14,8 +14,8 @@ Depends-on: gperf iconv-h iconv -c-ctype -c-strcase +c-ctype [test $REPLACE_ICONV_OPEN = 1] +c-strcase [test $REPLACE_ICONV_OPEN = 1] configure.ac: gl_FUNC_ICONV_OPEN diff --git a/modules/iconv_open-utf b/modules/iconv_open-utf index be6ff9f4ee..b29b3092d9 100644 --- a/modules/iconv_open-utf +++ b/modules/iconv_open-utf @@ -8,9 +8,9 @@ m4/iconv_open.m4 Depends-on: iconv_open -stdint -unistr/u8-mbtoucr -unistr/u8-uctomb +stdint [test $REPLACE_ICONV_UTF = 1] +unistr/u8-mbtoucr [test $REPLACE_ICONV_UTF = 1] +unistr/u8-uctomb [test $REPLACE_ICONV_UTF = 1] configure.ac: gl_FUNC_ICONV_OPEN_UTF diff --git a/modules/inet_ntop b/modules/inet_ntop index 3b00b62a08..7e9c7f4198 100644 --- a/modules/inet_ntop +++ b/modules/inet_ntop @@ -6,11 +6,11 @@ lib/inet_ntop.c m4/inet_ntop.m4 Depends-on: -sys_socket arpa_inet -errno -netinet_in extensions +sys_socket [test "$ac_cv_search_inet_ntop" = no && test $ac_cv_func_inet_ntop = no] +errno [test "$ac_cv_search_inet_ntop" = no && test $ac_cv_func_inet_ntop = no] +netinet_in [test "$ac_cv_search_inet_ntop" = no && test $ac_cv_func_inet_ntop = no] configure.ac: gl_FUNC_INET_NTOP diff --git a/modules/inet_pton b/modules/inet_pton index 44c50b892e..18fe07ec5f 100644 --- a/modules/inet_pton +++ b/modules/inet_pton @@ -6,12 +6,12 @@ lib/inet_pton.c m4/inet_pton.m4 Depends-on: -c-ctype -sys_socket arpa_inet -errno -netinet_in extensions +c-ctype [test "$ac_cv_search_inet_pton" = no && test $ac_cv_func_inet_pton = no] +sys_socket [test "$ac_cv_search_inet_pton" = no && test $ac_cv_func_inet_pton = no] +errno [test "$ac_cv_search_inet_pton" = no && test $ac_cv_func_inet_pton = no] +netinet_in [test "$ac_cv_search_inet_pton" = no && test $ac_cv_func_inet_pton = no] configure.ac: gl_FUNC_INET_PTON diff --git a/modules/ioctl b/modules/ioctl index 6a54f0318b..57328f3efb 100644 --- a/modules/ioctl +++ b/modules/ioctl @@ -8,9 +8,9 @@ m4/ioctl.m4 Depends-on: sys_ioctl -sys_socket -errno -fd-hook +sys_socket [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_IOCTL = 1] +errno [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_IOCTL = 1] +fd-hook [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_IOCTL = 1] configure.ac: gl_FUNC_IOCTL diff --git a/modules/isapipe b/modules/isapipe index 6352af4519..ee1c2202d6 100644 --- a/modules/isapipe +++ b/modules/isapipe @@ -7,9 +7,9 @@ lib/isapipe.h m4/isapipe.m4 Depends-on: -stdbool -sys_stat -unistd +stdbool [test $ac_cv_func_isapipe = no] +sys_stat [test $ac_cv_func_isapipe = no] +unistd [test $ac_cv_func_isapipe = no] configure.ac: gl_ISAPIPE diff --git a/modules/isfinite b/modules/isfinite index f122c5ad70..00f3e87224 100644 --- a/modules/isfinite +++ b/modules/isfinite @@ -7,11 +7,11 @@ m4/isfinite.m4 m4/check-math-lib.m4 Depends-on: -isnanf-nolibm -isnand-nolibm -isnanl-nolibm math extensions +isnanf-nolibm [test $REPLACE_ISFINITE = 1] +isnand-nolibm [test $REPLACE_ISFINITE = 1] +isnanl-nolibm [test $REPLACE_ISFINITE = 1] configure.ac: gl_ISFINITE diff --git a/modules/isinf b/modules/isinf index 2c6851c060..1a8399fe7b 100644 --- a/modules/isinf +++ b/modules/isinf @@ -7,9 +7,9 @@ m4/isinf.m4 m4/check-math-lib.m4 Depends-on: -float math extensions +float [test $REPLACE_ISINF = 1] configure.ac: gl_ISINF diff --git a/modules/lchown b/modules/lchown index 9fea1b3375..d9d140e3c4 100644 --- a/modules/lchown +++ b/modules/lchown @@ -6,12 +6,12 @@ lib/lchown.c m4/lchown.m4 Depends-on: -chown -errno -lstat -stdbool -sys_stat unistd +chown [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1] +errno [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1] +lstat [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1] +stdbool [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1] +sys_stat [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1] configure.ac: gl_FUNC_LCHOWN diff --git a/modules/ldexpl b/modules/ldexpl index 7dd82ccb38..517a40a8dd 100644 --- a/modules/ldexpl +++ b/modules/ldexpl @@ -7,8 +7,8 @@ m4/ldexpl.m4 Depends-on: math -isnanl -fpucw +isnanl [test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no] +fpucw [test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no] configure.ac: gl_FUNC_LDEXPL diff --git a/modules/link b/modules/link index 6a006c31e0..38cf5ec9f0 100644 --- a/modules/link +++ b/modules/link @@ -6,10 +6,10 @@ lib/link.c m4/link.m4 Depends-on: -stat -strdup-posix -sys_stat unistd +stat [test $HAVE_LINK = 0 || test $REPLACE_LINK = 1] +strdup-posix [test $HAVE_LINK = 0 || test $REPLACE_LINK = 1] +sys_stat [test $HAVE_LINK = 0 || test $REPLACE_LINK = 1] configure.ac: gl_FUNC_LINK diff --git a/modules/linkat b/modules/linkat index 2d7a2dfed5..2cb717776f 100644 --- a/modules/linkat +++ b/modules/linkat @@ -7,24 +7,24 @@ lib/linkat.c m4/linkat.m4 Depends-on: -areadlink -areadlinkat -dirname-lgpl -errno -extensions -fcntl-h -filenamecat-lgpl -getcwd-lgpl -openat -link -link-follow -lstat -readlink -same-inode -stpcpy -symlink -symlinkat unistd +extensions +areadlink [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +areadlinkat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +dirname-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +errno [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +fcntl-h [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +filenamecat-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +getcwd-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +openat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +link [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +link-follow [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +lstat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +readlink [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +same-inode [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +stpcpy [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +symlink [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +symlinkat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] configure.ac: gl_FUNC_LINKAT diff --git a/modules/listen b/modules/listen index 6912f5d695..7c77557d5c 100644 --- a/modules/listen +++ b/modules/listen @@ -7,7 +7,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/logl b/modules/logl index c9b7237dc2..7883f444e0 100644 --- a/modules/logl +++ b/modules/logl @@ -8,9 +8,9 @@ m4/logl.m4 Depends-on: math extensions -frexpl -isnanl -floorl +frexpl [test $HAVE_LOGL = 0] +isnanl [test $HAVE_LOGL = 0] +floorl [test $HAVE_LOGL = 0] configure.ac: gl_FUNC_LOGL diff --git a/modules/lstat b/modules/lstat index e53ac7ed70..a945a11636 100644 --- a/modules/lstat +++ b/modules/lstat @@ -6,9 +6,9 @@ lib/lstat.c m4/lstat.m4 Depends-on: -dosname -stat sys_stat +dosname [test $REPLACE_LSTAT = 1] +stat [test $REPLACE_LSTAT = 1] configure.ac: gl_FUNC_LSTAT diff --git a/modules/mbrlen b/modules/mbrlen index e7f36734eb..5bc9f297ca 100644 --- a/modules/mbrlen +++ b/modules/mbrlen @@ -8,8 +8,8 @@ m4/mbstate_t.m4 Depends-on: wchar -mbrtowc extensions +mbrtowc [test $HAVE_MBRLEN = 0 || test $REPLACE_MBRLEN = 1] configure.ac: gl_FUNC_MBRLEN diff --git a/modules/mbrtowc b/modules/mbrtowc index 5981633e60..85cde1e394 100644 --- a/modules/mbrtowc +++ b/modules/mbrtowc @@ -12,11 +12,11 @@ m4/codeset.m4 Depends-on: wchar -mbsinit -localcharset -streq -verify extensions +mbsinit [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1] +localcharset [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1] +streq [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1] +verify [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1] configure.ac: gl_FUNC_MBRTOWC diff --git a/modules/mbsinit b/modules/mbsinit index 4e673c7742..a8ee058a0e 100644 --- a/modules/mbsinit +++ b/modules/mbsinit @@ -8,9 +8,9 @@ m4/mbstate_t.m4 Depends-on: wchar -mbrtowc -verify extensions +mbrtowc [test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1] +verify [test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1] configure.ac: gl_FUNC_MBSINIT diff --git a/modules/mbsnrtowcs b/modules/mbsnrtowcs index e8975b8545..a179296810 100644 --- a/modules/mbsnrtowcs +++ b/modules/mbsnrtowcs @@ -9,11 +9,11 @@ m4/mbsnrtowcs.m4 m4/mbstate_t.m4 Depends-on: -extensions wchar -mbrtowc -minmax -strnlen1 +extensions +mbrtowc [test $HAVE_MBSNRTOWCS = 0 || test $REPLACE_MBSNRTOWCS = 1] +minmax [test $HAVE_MBSNRTOWCS = 0 || test $REPLACE_MBSNRTOWCS = 1] +strnlen1 [test $HAVE_MBSNRTOWCS = 0 || test $REPLACE_MBSNRTOWCS = 1] configure.ac: gl_FUNC_MBSNRTOWCS diff --git a/modules/mbsrtowcs b/modules/mbsrtowcs index 973b69538d..66dd78f67b 100644 --- a/modules/mbsrtowcs +++ b/modules/mbsrtowcs @@ -14,9 +14,9 @@ m4/codeset.m4 Depends-on: wchar -mbrtowc -strnlen1 extensions +mbrtowc [test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1] +strnlen1 [test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1] configure.ac: gl_FUNC_MBSRTOWCS diff --git a/modules/mbtowc b/modules/mbtowc index f41d508385..02b0c88dcf 100644 --- a/modules/mbtowc +++ b/modules/mbtowc @@ -8,8 +8,8 @@ m4/mbtowc.m4 Depends-on: stdlib -mbrtowc -wchar +mbrtowc [test $REPLACE_MBTOWC = 1] +wchar [test $REPLACE_MBTOWC = 1] configure.ac: gl_FUNC_MBTOWC diff --git a/modules/memcmp b/modules/memcmp index c6bc26200a..dda4324882 100644 --- a/modules/memcmp +++ b/modules/memcmp @@ -12,7 +12,7 @@ lib/memcmp.c m4/memcmp.m4 Depends-on: -stdint +stdint [test $ac_cv_func_memcmp_working = no] configure.ac: gl_FUNC_MEMCMP diff --git a/modules/mkdir b/modules/mkdir index 08089d008f..44b9057fc8 100644 --- a/modules/mkdir +++ b/modules/mkdir @@ -6,8 +6,8 @@ lib/mkdir.c m4/mkdir.m4 Depends-on: -dirname-lgpl sys_stat +dirname-lgpl [test $REPLACE_MKDIR = 1] configure.ac: gl_FUNC_MKDIR diff --git a/modules/mkdtemp b/modules/mkdtemp index 3c5aeee29b..4ca30c49ac 100644 --- a/modules/mkdtemp +++ b/modules/mkdtemp @@ -6,9 +6,9 @@ lib/mkdtemp.c m4/mkdtemp.m4 Depends-on: -stdint stdlib -tempname +stdint [test $HAVE_MKDTEMP = 0] +tempname [test $HAVE_MKDTEMP = 0] configure.ac: gt_FUNC_MKDTEMP diff --git a/modules/mkfifo b/modules/mkfifo index 3eaaad6c69..dae3755f73 100644 --- a/modules/mkfifo +++ b/modules/mkfifo @@ -6,8 +6,8 @@ lib/mkfifo.c m4/mkfifo.m4 Depends-on: -stat sys_stat +stat [test $HAVE_MKFIFO = 0 || test $REPLACE_MKFIFO = 1] configure.ac: gl_FUNC_MKFIFO diff --git a/modules/mkfifoat b/modules/mkfifoat index 2bc7e65573..705fb4f9cf 100644 --- a/modules/mkfifoat +++ b/modules/mkfifoat @@ -7,12 +7,12 @@ lib/mknodat.c m4/mkfifoat.m4 Depends-on: +sys_stat extensions fcntl-h -mkfifo -mknod -openat -sys_stat +mkfifo [test $HAVE_MKFIFOAT = 0] +mknod [test $HAVE_MKNODAT = 0] +openat [test $HAVE_MKFIFOAT = 0 || test $HAVE_MKNODAT = 0] configure.ac: gl_FUNC_MKFIFOAT diff --git a/modules/mknod b/modules/mknod index c965606e7f..6db2d5e08c 100644 --- a/modules/mknod +++ b/modules/mknod @@ -6,10 +6,10 @@ lib/mknod.c m4/mknod.m4 Depends-on: -mkfifo -stat sys_stat extensions +mkfifo [test $HAVE_MKNOD = 0 || test $REPLACE_MKNOD = 1] +stat [test $HAVE_MKNOD = 0 || test $REPLACE_MKNOD = 1] configure.ac: gl_FUNC_MKNOD diff --git a/modules/mkostemp b/modules/mkostemp index 8a61dbeb07..85b01b7e26 100644 --- a/modules/mkostemp +++ b/modules/mkostemp @@ -7,9 +7,9 @@ lib/mkostemp.c m4/mkostemp.m4 Depends-on: -extensions stdlib -tempname +extensions +tempname [test $HAVE_MKOSTEMP = 0] configure.ac: gl_FUNC_MKOSTEMP diff --git a/modules/mkostemps b/modules/mkostemps index a4175bdb50..ff3c97acee 100644 --- a/modules/mkostemps +++ b/modules/mkostemps @@ -7,9 +7,9 @@ lib/mkostemps.c m4/mkostemps.m4 Depends-on: -extensions stdlib -tempname +extensions +tempname [test $HAVE_MKOSTEMPS = 0] configure.ac: gl_FUNC_MKOSTEMPS diff --git a/modules/mkstemp b/modules/mkstemp index 265144b942..0f4fef6665 100644 --- a/modules/mkstemp +++ b/modules/mkstemp @@ -6,9 +6,9 @@ lib/mkstemp.c m4/mkstemp.m4 Depends-on: -extensions stdlib -tempname +extensions +tempname [test $HAVE_MKSTEMP = 0 || test $REPLACE_MKSTEMP = 1] configure.ac: gl_FUNC_MKSTEMP diff --git a/modules/mkstemps b/modules/mkstemps index 2a49777674..56718a9b42 100644 --- a/modules/mkstemps +++ b/modules/mkstemps @@ -6,9 +6,9 @@ lib/mkstemps.c m4/mkstemps.m4 Depends-on: -extensions stdlib -tempname +extensions +tempname [test $HAVE_MKSTEMPS = 0] configure.ac: gl_FUNC_MKSTEMPS diff --git a/modules/mktime b/modules/mktime index d5b0ee7954..81aa7148d0 100644 --- a/modules/mktime +++ b/modules/mktime @@ -8,7 +8,7 @@ m4/mktime.m4 Depends-on: multiarch -time_r +time_r [test $REPLACE_MKTIME = 1] configure.ac: gl_FUNC_MKTIME diff --git a/modules/nanosleep b/modules/nanosleep index dfe1c7acbe..36d92be6cb 100644 --- a/modules/nanosleep +++ b/modules/nanosleep @@ -6,16 +6,16 @@ lib/nanosleep.c m4/nanosleep.m4 Depends-on: +time extensions -intprops multiarch -select -sigaction -stdbool -sys_select -sys_time -time -verify +intprops [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1] +select [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1] +sigaction [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1] +stdbool [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1] +sys_select [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1] +sys_time [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1] +verify [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1] configure.ac: gl_FUNC_NANOSLEEP diff --git a/modules/open b/modules/open index 29829084eb..ea0f5ae57c 100644 --- a/modules/open +++ b/modules/open @@ -8,7 +8,7 @@ m4/mode_t.m4 Depends-on: fcntl-h -stat +stat [test $REPLACE_OPEN = 1] configure.ac: gl_FUNC_OPEN diff --git a/modules/openat b/modules/openat index 35917c59d7..abd3b63b95 100644 --- a/modules/openat +++ b/modules/openat @@ -24,18 +24,18 @@ fcntl-h fdopendir gettext-h intprops -lchown +lchown [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1] lstat -mkdir +mkdir [test $HAVE_MKDIRAT = 0] open openat-die -rmdir +rmdir [test $REPLACE_UNLINKAT = 1] same-inode save-cwd stdbool sys_stat unistd -unlink +unlink [test $REPLACE_UNLINKAT = 1] configure.ac: gl_FUNC_OPENAT diff --git a/modules/perror b/modules/perror index c01902959b..d2147b6b66 100644 --- a/modules/perror +++ b/modules/perror @@ -7,8 +7,8 @@ m4/perror.m4 Depends-on: stdio -errno -strerror +errno [test $REPLACE_PERROR = 1] +strerror [test $REPLACE_PERROR = 1] configure.ac: gl_FUNC_PERROR diff --git a/modules/poll b/modules/poll index 8690271e0d..478e99ba74 100644 --- a/modules/poll +++ b/modules/poll @@ -7,11 +7,11 @@ m4/poll.m4 Depends-on: poll-h -alloca -select -sys_select -sys_time -errno +alloca [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] +select [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] +sys_select [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] +sys_time [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] +errno [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] configure.ac: gl_FUNC_POLL diff --git a/modules/popen b/modules/popen index 75e278d8ec..d4ba0ab062 100644 --- a/modules/popen +++ b/modules/popen @@ -6,8 +6,8 @@ lib/popen.c m4/popen.m4 Depends-on: -open stdio +open [test $REPLACE_POPEN = 1] configure.ac: gl_FUNC_POPEN diff --git a/modules/posix_spawn b/modules/posix_spawn index a4967b9c28..2d4ddf3865 100644 --- a/modules/posix_spawn +++ b/modules/posix_spawn @@ -7,7 +7,7 @@ m4/posix_spawn.m4 Depends-on: spawn -posix_spawn-internal +posix_spawn-internal [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1] configure.ac: gl_POSIX_SPAWN diff --git a/modules/posix_spawn_file_actions_addclose b/modules/posix_spawn_file_actions_addclose index 80b1c91536..d24a0c9cc6 100644 --- a/modules/posix_spawn_file_actions_addclose +++ b/modules/posix_spawn_file_actions_addclose @@ -9,7 +9,7 @@ m4/posix_spawn.m4 Depends-on: spawn -getdtablesize +getdtablesize [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1] configure.ac: gl_POSIX_SPAWN diff --git a/modules/posix_spawn_file_actions_adddup2 b/modules/posix_spawn_file_actions_adddup2 index 173dc64344..59c828e9b2 100644 --- a/modules/posix_spawn_file_actions_adddup2 +++ b/modules/posix_spawn_file_actions_adddup2 @@ -9,7 +9,7 @@ m4/posix_spawn.m4 Depends-on: spawn -getdtablesize +getdtablesize [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1] configure.ac: gl_POSIX_SPAWN diff --git a/modules/posix_spawn_file_actions_addopen b/modules/posix_spawn_file_actions_addopen index d621d2df8c..f828976ea6 100644 --- a/modules/posix_spawn_file_actions_addopen +++ b/modules/posix_spawn_file_actions_addopen @@ -9,7 +9,7 @@ m4/posix_spawn.m4 Depends-on: spawn -getdtablesize +getdtablesize [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1] configure.ac: gl_POSIX_SPAWN diff --git a/modules/posix_spawnp b/modules/posix_spawnp index 1cac784a42..7e2464780d 100644 --- a/modules/posix_spawnp +++ b/modules/posix_spawnp @@ -7,7 +7,7 @@ m4/posix_spawn.m4 Depends-on: spawn -posix_spawn-internal +posix_spawn-internal [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1] configure.ac: gl_POSIX_SPAWN diff --git a/modules/pread b/modules/pread index 0ae6e741f5..5fcb47ca24 100644 --- a/modules/pread +++ b/modules/pread @@ -6,10 +6,10 @@ lib/pread.c m4/pread.m4 Depends-on: -extensions -lseek -read unistd +extensions +lseek [test $HAVE_PREAD = 0 || test $REPLACE_PREAD = 1] +read [test $HAVE_PREAD = 0 || test $REPLACE_PREAD = 1] configure.ac: gl_FUNC_PREAD diff --git a/modules/printf-posix b/modules/printf-posix index 0597ef9c6f..1c763a0c12 100644 --- a/modules/printf-posix +++ b/modules/printf-posix @@ -15,8 +15,8 @@ m4/asm-underscore.m4 Depends-on: stdio -vfprintf-posix printf-safe +vfprintf-posix [test $REPLACE_PRINTF = 1] configure.ac: gl_FUNC_PRINTF_POSIX diff --git a/modules/ptsname b/modules/ptsname index d6ae046830..ab14894d3b 100644 --- a/modules/ptsname +++ b/modules/ptsname @@ -8,7 +8,7 @@ m4/ptsname.m4 Depends-on: stdlib extensions -ttyname_r +ttyname_r [test $HAVE_PTSNAME = 0] configure.ac: gl_FUNC_PTSNAME diff --git a/modules/putenv b/modules/putenv index 3874b541b8..ce28e4c6e9 100644 --- a/modules/putenv +++ b/modules/putenv @@ -7,7 +7,7 @@ m4/putenv.m4 Depends-on: stdlib -malloc-posix +malloc-posix [test $REPLACE_PUTENV = 1] configure.ac: gl_FUNC_PUTENV diff --git a/modules/pwrite b/modules/pwrite index 077036474d..f2dd02fb23 100644 --- a/modules/pwrite +++ b/modules/pwrite @@ -6,10 +6,10 @@ lib/pwrite.c m4/pwrite.m4 Depends-on: -extensions -lseek unistd -write +extensions +lseek [test $HAVE_PWRITE = 0 || test $REPLACE_PWRITE = 1] +write [test $HAVE_PWRITE = 0 || test $REPLACE_PWRITE = 1] configure.ac: gl_FUNC_PWRITE diff --git a/modules/readline b/modules/readline index 933ae5b629..7f2af8f061 100644 --- a/modules/readline +++ b/modules/readline @@ -7,8 +7,8 @@ lib/readline.c m4/readline.m4 Depends-on: -getline havelib +getline [test "$gl_cv_lib_readline" = no] configure.ac: gl_FUNC_READLINE diff --git a/modules/readlink b/modules/readlink index eb32ef53ee..37c03a78af 100644 --- a/modules/readlink +++ b/modules/readlink @@ -6,8 +6,8 @@ lib/readlink.c m4/readlink.m4 Depends-on: -stat unistd +stat [test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1] configure.ac: gl_FUNC_READLINK diff --git a/modules/readlinkat b/modules/readlinkat index 593f2c2573..18f2f959a4 100644 --- a/modules/readlinkat +++ b/modules/readlinkat @@ -6,11 +6,11 @@ lib/readlinkat.c m4/readlinkat.m4 Depends-on: +unistd extensions fcntl-h -openat -readlink -unistd +openat [test $HAVE_READLINKAT = 0] +readlink [test $HAVE_READLINKAT = 0] configure.ac: gl_FUNC_READLINKAT diff --git a/modules/recv b/modules/recv index 04602f9801..c225917b17 100644 --- a/modules/recv +++ b/modules/recv @@ -7,7 +7,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/recvfrom b/modules/recvfrom index 8237565b9d..9a6d833ccb 100644 --- a/modules/recvfrom +++ b/modules/recvfrom @@ -7,8 +7,8 @@ lib/w32sock.h Depends-on: sys_socket -errno -getpeername +errno [test "$ac_cv_header_winsock2_h" = yes] +getpeername [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/regex b/modules/regex index 6a8f4c25fd..730076c2b3 100644 --- a/modules/regex +++ b/modules/regex @@ -12,23 +12,23 @@ m4/regex.m4 m4/mbstate_t.m4 Depends-on: -alloca-opt -btowc extensions -gettext-h -localcharset -malloc-gnu -memcmp -memmove -mbrtowc -mbsinit -nl_langinfo -stdbool -stdint ssize_t -wchar -wcrtomb -wctype-h +alloca-opt [test $ac_use_included_regex = yes] +btowc [test $ac_use_included_regex = yes] +gettext-h [test $ac_use_included_regex = yes] +localcharset [test $ac_use_included_regex = yes] +malloc-gnu [test $ac_use_included_regex = yes] +memcmp [test $ac_use_included_regex = yes] +memmove [test $ac_use_included_regex = yes] +mbrtowc [test $ac_use_included_regex = yes] +mbsinit [test $ac_use_included_regex = yes] +nl_langinfo [test $ac_use_included_regex = yes] +stdbool [test $ac_use_included_regex = yes] +stdint [test $ac_use_included_regex = yes] +wchar [test $ac_use_included_regex = yes] +wcrtomb [test $ac_use_included_regex = yes] +wctype-h [test $ac_use_included_regex = yes] configure.ac: gl_REGEX diff --git a/modules/remove b/modules/remove index 886a03937f..4723801893 100644 --- a/modules/remove +++ b/modules/remove @@ -6,9 +6,9 @@ lib/remove.c m4/remove.m4 Depends-on: -rmdir stdio -unlink +rmdir [test $REPLACE_REMOVE = 1] +unlink [test $REPLACE_REMOVE = 1] configure.ac: gl_FUNC_REMOVE diff --git a/modules/rename b/modules/rename index ae8390a3ec..449d9beeab 100644 --- a/modules/rename +++ b/modules/rename @@ -6,14 +6,14 @@ lib/rename.c m4/rename.m4 Depends-on: -canonicalize-lgpl -dirname-lgpl -lstat -rmdir -same-inode -stdbool stdio -strdup +canonicalize-lgpl [test $REPLACE_RENAME = 1] +dirname-lgpl [test $REPLACE_RENAME = 1] +lstat [test $REPLACE_RENAME = 1] +rmdir [test $REPLACE_RENAME = 1] +same-inode [test $REPLACE_RENAME = 1] +stdbool [test $REPLACE_RENAME = 1] +strdup [test $REPLACE_RENAME = 1] configure.ac: gl_FUNC_RENAME diff --git a/modules/renameat b/modules/renameat index 22bb6505b8..15bc1ecd97 100644 --- a/modules/renameat +++ b/modules/renameat @@ -7,15 +7,15 @@ lib/renameat.c m4/renameat.m4 Depends-on: +stdio extensions fcntl-h -filenamecat-lgpl -getcwd-lgpl -openat -rename -same-inode -stdio -stpcpy +filenamecat-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +getcwd-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +openat [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +rename [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +same-inode [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +stpcpy [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] configure.ac: gl_FUNC_RENAMEAT diff --git a/modules/rmdir b/modules/rmdir index eaa5a68542..95e7b1df6a 100644 --- a/modules/rmdir +++ b/modules/rmdir @@ -6,9 +6,9 @@ lib/rmdir.c m4/rmdir.m4 Depends-on: -dosname -sys_stat unistd +dosname [test $REPLACE_RMDIR = 1] +sys_stat [test $REPLACE_RMDIR = 1] configure.ac: gl_FUNC_RMDIR diff --git a/modules/round b/modules/round index c4acba133f..07dcd880b7 100644 --- a/modules/round +++ b/modules/round @@ -9,10 +9,10 @@ m4/floor.m4 m4/ceil.m4 Depends-on: -float -floor math extensions +float [test $HAVE_DECL_ROUND = 0 || test $REPLACE_ROUND = 1] +floor [test $HAVE_DECL_ROUND = 0 || test $REPLACE_ROUND = 1] configure.ac: gl_FUNC_ROUND diff --git a/modules/roundf b/modules/roundf index d77b2a198d..d9c283eb33 100644 --- a/modules/roundf +++ b/modules/roundf @@ -10,9 +10,9 @@ m4/floorf.m4 m4/ceilf.m4 Depends-on: -float math extensions +float [test $HAVE_DECL_ROUNDF = 0 || test $REPLACE_ROUNDF = 1] configure.ac: gl_FUNC_ROUNDF diff --git a/modules/roundl b/modules/roundl index 9eb9f1de54..516ee0b5df 100644 --- a/modules/roundl +++ b/modules/roundl @@ -10,9 +10,9 @@ m4/floorl.m4 m4/ceill.m4 Depends-on: -float math extensions +float [test $HAVE_DECL_ROUNDL = 0 || test $REPLACE_ROUNDL = 1] configure.ac: gl_FUNC_ROUNDL diff --git a/modules/rpmatch b/modules/rpmatch index 17a6c2083a..bfa5380da1 100644 --- a/modules/rpmatch +++ b/modules/rpmatch @@ -8,10 +8,10 @@ m4/rpmatch.m4 Depends-on: stdlib extensions -stdbool -gettext-h -regex -strdup +stdbool [test $HAVE_RPMATCH = 0] +gettext-h [test $HAVE_RPMATCH = 0] +regex [test $HAVE_RPMATCH = 0] +strdup [test $HAVE_RPMATCH = 0] configure.ac: gl_FUNC_RPMATCH diff --git a/modules/select b/modules/select index 18865f1423..ab4af6e7cb 100644 --- a/modules/select +++ b/modules/select @@ -6,9 +6,9 @@ lib/select.c m4/select.m4 Depends-on: -alloca -sockets sys_select +alloca [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_SELECT = 1] +sockets [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_SELECT = 1] configure.ac: gl_FUNC_SELECT diff --git a/modules/send b/modules/send index 4317d6fb91..8a07da9d46 100644 --- a/modules/send +++ b/modules/send @@ -7,7 +7,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/sendto b/modules/sendto index d9a292c857..b28a7ea354 100644 --- a/modules/sendto +++ b/modules/sendto @@ -7,7 +7,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/setenv b/modules/setenv index 8112616221..95ff0a0e3d 100644 --- a/modules/setenv +++ b/modules/setenv @@ -7,10 +7,10 @@ m4/setenv.m4 Depends-on: stdlib -malloca -alloca-opt -unistd -environ +malloca [test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1] +alloca-opt [test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1] +unistd [test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1] +environ [test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1] configure.ac: gl_FUNC_SETENV diff --git a/modules/setlocale b/modules/setlocale index 5d3e58b208..918a037da3 100644 --- a/modules/setlocale +++ b/modules/setlocale @@ -7,7 +7,7 @@ m4/setlocale.m4 Depends-on: locale -localename +localename [test $REPLACE_SETLOCALE = 1] configure.ac: gl_FUNC_SETLOCALE diff --git a/modules/setsockopt b/modules/setsockopt index b429510a01..33726b11b9 100644 --- a/modules/setsockopt +++ b/modules/setsockopt @@ -7,8 +7,8 @@ lib/w32sock.h Depends-on: sys_socket -sys_time -errno +sys_time [test "$ac_cv_header_winsock2_h" = yes] +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/shutdown b/modules/shutdown index c1e062104d..322ff8d891 100644 --- a/modules/shutdown +++ b/modules/shutdown @@ -7,7 +7,7 @@ lib/w32sock.h Depends-on: sys_socket -errno +errno [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/sigaction b/modules/sigaction index 0e42e94487..93b848aca7 100644 --- a/modules/sigaction +++ b/modules/sigaction @@ -8,7 +8,7 @@ m4/sigaction.m4 Depends-on: signal -sigprocmask +sigprocmask [test $HAVE_SIGACTION = 0] configure.ac: gl_SIGACTION diff --git a/modules/signbit b/modules/signbit index 14a5754539..b3ad38836b 100644 --- a/modules/signbit +++ b/modules/signbit @@ -9,13 +9,13 @@ lib/float+.h m4/signbit.m4 Depends-on: -float math -isnanf-nolibm -isnand-nolibm -isnanl-nolibm -fpieee -memcmp +float [test $REPLACE_SIGNBIT = 1] +isnanf-nolibm [test $REPLACE_SIGNBIT = 1] +isnand-nolibm [test $REPLACE_SIGNBIT = 1] +isnanl-nolibm [test $REPLACE_SIGNBIT = 1] +fpieee [test $REPLACE_SIGNBIT = 1] +memcmp [test $REPLACE_SIGNBIT = 1] configure.ac: gl_SIGNBIT diff --git a/modules/sigprocmask b/modules/sigprocmask index e46abc97ac..fee745fa68 100644 --- a/modules/sigprocmask +++ b/modules/sigprocmask @@ -7,8 +7,8 @@ m4/signalblocking.m4 Depends-on: signal -stdint -raise +stdint [test $HAVE_POSIX_SIGNALBLOCKING = 0] +raise [test $HAVE_POSIX_SIGNALBLOCKING = 0] configure.ac: gl_SIGNALBLOCKING diff --git a/modules/sinl b/modules/sinl index 67621ed316..4bb4222002 100644 --- a/modules/sinl +++ b/modules/sinl @@ -11,10 +11,10 @@ m4/sinl.m4 Depends-on: math extensions -float -isnanl -floor -floorl +float [test $HAVE_SINL = 0] +isnanl [test $HAVE_SINL = 0] +floor [test $HAVE_SINL = 0] +floorl [test $HAVE_SINL = 0] configure.ac: gl_FUNC_SINL diff --git a/modules/sleep b/modules/sleep index e859e59e52..c9b6c40809 100644 --- a/modules/sleep +++ b/modules/sleep @@ -6,9 +6,9 @@ lib/sleep.c m4/sleep.m4 Depends-on: -stdint unistd -verify +stdint [test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1] +verify [test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1] configure.ac: gl_FUNC_SLEEP diff --git a/modules/snprintf b/modules/snprintf index e8b5dfb47b..cd048aa646 100644 --- a/modules/snprintf +++ b/modules/snprintf @@ -8,8 +8,8 @@ m4/printf.m4 Depends-on: stdio -vasnprintf -errno +vasnprintf [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] +errno [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] configure.ac: gl_FUNC_SNPRINTF diff --git a/modules/snprintf-posix b/modules/snprintf-posix index 16b38b7dde..874ba5a46f 100644 --- a/modules/snprintf-posix +++ b/modules/snprintf-posix @@ -14,18 +14,18 @@ m4/printf.m4 Depends-on: snprintf -vasnprintf -isnand-nolibm -isnanl-nolibm -frexp-nolibm -frexpl-nolibm -printf-frexp -printf-frexpl -signbit -fpucw nocrash printf-safe multiarch +vasnprintf [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] +isnand-nolibm [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] +isnanl-nolibm [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] +frexp-nolibm [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] +frexpl-nolibm [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] +printf-frexp [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] +printf-frexpl [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] +signbit [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] +fpucw [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1] configure.ac: gl_FUNC_SNPRINTF_POSIX diff --git a/modules/socket b/modules/socket index f5daa4919b..92df980466 100644 --- a/modules/socket +++ b/modules/socket @@ -7,8 +7,8 @@ lib/w32sock.h Depends-on: sys_socket -errno -sockets +errno [test "$ac_cv_header_winsock2_h" = yes] +sockets [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/modules/sprintf-posix b/modules/sprintf-posix index b5f02f6aaf..cdcc8aa510 100644 --- a/modules/sprintf-posix +++ b/modules/sprintf-posix @@ -14,20 +14,20 @@ m4/printf.m4 Depends-on: stdio -vasnprintf -isnand-nolibm -isnanl-nolibm -frexp-nolibm -frexpl-nolibm -printf-frexp -printf-frexpl -signbit -fpucw nocrash printf-safe -stdint -errno multiarch +vasnprintf [test $REPLACE_SPRINTF = 1] +isnand-nolibm [test $REPLACE_SPRINTF = 1] +isnanl-nolibm [test $REPLACE_SPRINTF = 1] +frexp-nolibm [test $REPLACE_SPRINTF = 1] +frexpl-nolibm [test $REPLACE_SPRINTF = 1] +printf-frexp [test $REPLACE_SPRINTF = 1] +printf-frexpl [test $REPLACE_SPRINTF = 1] +signbit [test $REPLACE_SPRINTF = 1] +fpucw [test $REPLACE_SPRINTF = 1] +stdint [test $REPLACE_SPRINTF = 1] +errno [test $REPLACE_SPRINTF = 1] configure.ac: gl_FUNC_SPRINTF_POSIX diff --git a/modules/sqrtl b/modules/sqrtl index d4886665af..dec1db3ffa 100644 --- a/modules/sqrtl +++ b/modules/sqrtl @@ -8,11 +8,11 @@ m4/sqrtl.m4 Depends-on: math extensions -float -isnanl -frexpl -ldexpl -sqrt +float [test $HAVE_SQRTL = 0] +isnanl [test $HAVE_SQRTL = 0] +frexpl [test $HAVE_SQRTL = 0] +ldexpl [test $HAVE_SQRTL = 0] +sqrt [test $HAVE_SQRTL = 0] configure.ac: gl_FUNC_SQRTL diff --git a/modules/stat b/modules/stat index 744aa7a0cb..db179aa38f 100644 --- a/modules/stat +++ b/modules/stat @@ -6,9 +6,9 @@ lib/stat.c m4/stat.m4 Depends-on: -dosname -stdbool sys_stat +dosname [test $REPLACE_STAT = 1] +stdbool [test $REPLACE_STAT = 1] configure.ac: gl_FUNC_STAT diff --git a/modules/strchrnul b/modules/strchrnul index 8ae3ea6fb2..59c4cc68ab 100644 --- a/modules/strchrnul +++ b/modules/strchrnul @@ -8,9 +8,9 @@ lib/strchrnul.valgrind m4/strchrnul.m4 Depends-on: -extensions string -rawmemchr +extensions +rawmemchr [test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1] configure.ac: gl_FUNC_STRCHRNUL diff --git a/modules/strdup-posix b/modules/strdup-posix index 4a474881b3..d158873fbe 100644 --- a/modules/strdup-posix +++ b/modules/strdup-posix @@ -7,7 +7,7 @@ m4/strdup.m4 Depends-on: string -malloc-posix +malloc-posix [test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1] configure.ac: gl_FUNC_STRDUP_POSIX diff --git a/modules/strerror b/modules/strerror index 1a204fa09e..cd14d12576 100644 --- a/modules/strerror +++ b/modules/strerror @@ -6,9 +6,9 @@ lib/strerror.c m4/strerror.m4 Depends-on: -errno -intprops string +errno [test $REPLACE_STRERROR = 1] +intprops [test $REPLACE_STRERROR = 1] configure.ac: gl_FUNC_STRERROR diff --git a/modules/strerror_r-posix b/modules/strerror_r-posix index 1a1d8c6dd8..75345ed123 100644 --- a/modules/strerror_r-posix +++ b/modules/strerror_r-posix @@ -7,10 +7,10 @@ m4/strerror_r.m4 Depends-on: string -errno extensions -lock -strerror +errno [test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1] +lock [test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1] +strerror [test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1] configure.ac: gl_FUNC_STRERROR_R diff --git a/modules/strndup b/modules/strndup index 80f143bee5..c76e966a57 100644 --- a/modules/strndup +++ b/modules/strndup @@ -6,9 +6,9 @@ lib/strndup.c m4/strndup.m4 Depends-on: -extensions string -strnlen +extensions +strnlen [test $ac_cv_func_strndup = no || test $REPLACE_STRNDUP = 1] configure.ac: gl_FUNC_STRNDUP diff --git a/modules/strnlen b/modules/strnlen index 2f50c9b537..97fdd667f1 100644 --- a/modules/strnlen +++ b/modules/strnlen @@ -6,9 +6,9 @@ lib/strnlen.c m4/strnlen.m4 Depends-on: -extensions string -memchr-obsolete +extensions +memchr-obsolete [test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1] configure.ac: gl_FUNC_STRNLEN diff --git a/modules/strptime b/modules/strptime index 667d55245c..763dca5031 100644 --- a/modules/strptime +++ b/modules/strptime @@ -7,13 +7,13 @@ m4/strptime.m4 m4/tm_gmtoff.m4 Depends-on: -extensions -sys_time -string -strcase -stdbool time -time_r +extensions +sys_time [test $HAVE_STRPTIME = 0] +string [test $HAVE_STRPTIME = 0] +strcase [test $HAVE_STRPTIME = 0] +stdbool [test $HAVE_STRPTIME = 0] +time_r [test $HAVE_STRPTIME = 0] configure.ac: gl_FUNC_STRPTIME diff --git a/modules/strsep b/modules/strsep index 10ca817a82..eaa30329de 100644 --- a/modules/strsep +++ b/modules/strsep @@ -6,9 +6,9 @@ lib/strsep.c m4/strsep.m4 Depends-on: -extensions string -strpbrk +extensions +strpbrk [test $HAVE_STRSEP = 0] configure.ac: gl_FUNC_STRSEP diff --git a/modules/strsignal b/modules/strsignal index 41dda4ec1b..c8e3bfab74 100644 --- a/modules/strsignal +++ b/modules/strsignal @@ -8,12 +8,12 @@ m4/strsignal.m4 Depends-on: string -gettext-h -lock -tls -snprintf -memset extensions +gettext-h [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1] +lock [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1] +tls [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1] +snprintf [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1] +memset [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1] configure.ac: gl_FUNC_STRSIGNAL diff --git a/modules/strstr-simple b/modules/strstr-simple index 9ebf5dac89..5f66b279c2 100644 --- a/modules/strstr-simple +++ b/modules/strstr-simple @@ -8,9 +8,9 @@ m4/strstr.m4 Depends-on: string -stdbool -memchr -memcmp +stdbool [test $REPLACE_STRSTR = 1] +memchr [test $REPLACE_STRSTR = 1] +memcmp [test $REPLACE_STRSTR = 1] configure.ac: gl_FUNC_STRSTR_SIMPLE diff --git a/modules/strtod b/modules/strtod index 935e5f8d6c..4c2151962a 100644 --- a/modules/strtod +++ b/modules/strtod @@ -7,10 +7,10 @@ m4/strtod.m4 m4/ldexp.m4 Depends-on: -c-ctype -stdbool stdlib strtod-obsolete +c-ctype [test $HAVE_STRTOD = 0 || test $REPLACE_STRTOD = 1] +stdbool [test $HAVE_STRTOD = 0 || test $REPLACE_STRTOD = 1] configure.ac: gl_FUNC_STRTOD diff --git a/modules/strtoimax b/modules/strtoimax index c4e8982f1f..155affe53b 100644 --- a/modules/strtoimax +++ b/modules/strtoimax @@ -7,10 +7,10 @@ m4/longlong.m4 m4/strtoimax.m4 Depends-on: -strtoll -verify inttypes-incomplete -stdint +verify [test "$ac_cv_have_decl_strtoimax" != yes && test $ac_cv_func_strtoimax = no] +stdint [test "$ac_cv_have_decl_strtoimax" != yes && test $ac_cv_func_strtoimax = no] +strtoll [test "$ac_cv_have_decl_strtoimax" != yes && test $ac_cv_func_strtoimax = no && test $ac_cv_type_long_long_int = yes] configure.ac: gl_FUNC_STRTOIMAX diff --git a/modules/strtok_r b/modules/strtok_r index 08afb439e3..bbfef2b68f 100644 --- a/modules/strtok_r +++ b/modules/strtok_r @@ -7,7 +7,7 @@ m4/strtok_r.m4 Depends-on: string -strpbrk +strpbrk [test $ac_cv_func_strtok_r = no] configure.ac: gl_FUNC_STRTOK_R diff --git a/modules/strtoumax b/modules/strtoumax index c2d615ec5b..e2ef86c3bb 100644 --- a/modules/strtoumax +++ b/modules/strtoumax @@ -8,10 +8,10 @@ m4/longlong.m4 m4/strtoumax.m4 Depends-on: -strtoull -verify inttypes-incomplete -stdint +verify [test "$ac_cv_have_decl_strtoumax" != yes && test $ac_cv_func_strtoumax = no] +stdint [test "$ac_cv_have_decl_strtoumax" != yes && test $ac_cv_func_strtoumax = no] +strtoull [test "$ac_cv_have_decl_strtoumax" != yes && test $ac_cv_func_strtoumax = no && test $ac_cv_type_unsigned_long_long_int = yes] configure.ac: gl_FUNC_STRTOUMAX diff --git a/modules/symlink b/modules/symlink index 313a6a0d28..729f01cbeb 100644 --- a/modules/symlink +++ b/modules/symlink @@ -6,8 +6,8 @@ lib/symlink.c m4/symlink.m4 Depends-on: -lstat unistd +lstat [test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1] configure.ac: gl_FUNC_SYMLINK diff --git a/modules/symlinkat b/modules/symlinkat index 16646be699..f2666afff2 100644 --- a/modules/symlinkat +++ b/modules/symlinkat @@ -6,11 +6,11 @@ lib/symlinkat.c m4/symlinkat.m4 Depends-on: +unistd extensions fcntl-h -openat -symlink -unistd +openat [test $HAVE_SYMLINKAT = 0] +symlink [test $HAVE_SYMLINKAT = 0] configure.ac: gl_FUNC_SYMLINKAT diff --git a/modules/tanl b/modules/tanl index b00fd1bd51..520df45e8c 100644 --- a/modules/tanl +++ b/modules/tanl @@ -10,10 +10,10 @@ m4/tanl.m4 Depends-on: math extensions -float -isnanl -floor -floorl +float [test $HAVE_TANL = 0] +isnanl [test $HAVE_TANL = 0] +floor [test $HAVE_TANL = 0] +floorl [test $HAVE_TANL = 0] configure.ac: gl_FUNC_TANL diff --git a/modules/tcgetsid b/modules/tcgetsid index 1b72c8d43a..6dddb6eb33 100644 --- a/modules/tcgetsid +++ b/modules/tcgetsid @@ -9,7 +9,7 @@ m4/tcgetsid.m4 Depends-on: termios extensions -sys_ioctl +sys_ioctl [test $ac_cv_func_tcgetsid = no] configure.ac: gl_FUNC_TCGETSID diff --git a/modules/tmpfile b/modules/tmpfile index 0fa61e8e3c..e65beb8a02 100644 --- a/modules/tmpfile +++ b/modules/tmpfile @@ -7,9 +7,9 @@ m4/tmpfile.m4 Depends-on: stdio -pathmax -tempname -tmpdir +pathmax [test $REPLACE_TMPFILE = 1] +tempname [test $REPLACE_TMPFILE = 1] +tmpdir [test $REPLACE_TMPFILE = 1] configure.ac: gl_FUNC_TMPFILE diff --git a/modules/trunc b/modules/trunc index 1c6f706276..71863a54a6 100644 --- a/modules/trunc +++ b/modules/trunc @@ -8,7 +8,7 @@ m4/trunc.m4 Depends-on: math extensions -float +float [test $HAVE_DECL_TRUNC = 0 || test $REPLACE_TRUNC = 1] configure.ac: gl_FUNC_TRUNC diff --git a/modules/truncf b/modules/truncf index 6c4c46f12a..15e35e8acf 100644 --- a/modules/truncf +++ b/modules/truncf @@ -9,7 +9,7 @@ m4/truncf.m4 Depends-on: math extensions -float +float [test $HAVE_DECL_TRUNCF = 0 || test $REPLACE_TRUNCF = 1] configure.ac: gl_FUNC_TRUNCF diff --git a/modules/truncl b/modules/truncl index d3d88847ae..808c63ed84 100644 --- a/modules/truncl +++ b/modules/truncl @@ -9,7 +9,7 @@ m4/truncl.m4 Depends-on: math extensions -float +float [test $HAVE_DECL_TRUNCL = 0 || test $REPLACE_TRUNCL = 1] configure.ac: gl_FUNC_TRUNCL diff --git a/modules/uname b/modules/uname index ac5ad88fa7..e7364ad3c3 100644 --- a/modules/uname +++ b/modules/uname @@ -7,7 +7,7 @@ m4/uname.m4 Depends-on: sys_utsname -gethostname +gethostname [test $HAVE_UNAME = 0] configure.ac: gl_FUNC_UNAME diff --git a/modules/unlink b/modules/unlink index a27a308dce..26af43ddcc 100644 --- a/modules/unlink +++ b/modules/unlink @@ -6,9 +6,9 @@ lib/unlink.c m4/unlink.m4 Depends-on: -dosname -lstat unistd +dosname [test $REPLACE_UNLINK = 1] +lstat [test $REPLACE_UNLINK = 1] configure.ac: gl_FUNC_UNLINK diff --git a/modules/unlockpt b/modules/unlockpt index 4eadff8521..3a5c7b86fd 100644 --- a/modules/unlockpt +++ b/modules/unlockpt @@ -9,7 +9,7 @@ m4/unlockpt.m4 Depends-on: stdlib extensions -ptsname +ptsname [test $HAVE_UNLOCKPT = 0] configure.ac: gl_FUNC_UNLOCKPT diff --git a/modules/unsetenv b/modules/unsetenv index 6dff883c71..26662b349b 100644 --- a/modules/unsetenv +++ b/modules/unsetenv @@ -7,8 +7,8 @@ m4/setenv.m4 Depends-on: stdlib -unistd -environ +unistd [test $ac_cv_func_unsetenv = no || test $REPLACE_UNSETENV = 1] +environ [test $ac_cv_func_unsetenv = no || test $REPLACE_UNSETENV = 1] configure.ac: gl_FUNC_UNSETENV diff --git a/modules/usleep b/modules/usleep index c77826bbd7..0bee1cc8b0 100644 --- a/modules/usleep +++ b/modules/usleep @@ -6,9 +6,9 @@ lib/usleep.c m4/usleep.m4 Depends-on: -extensions -sleep unistd +extensions +sleep [test $HAVE_USLEEP = 0 || test $REPLACE_USLEEP = 1] configure.ac: gl_FUNC_USLEEP diff --git a/modules/utimensat b/modules/utimensat index 2377080999..858fee18b7 100644 --- a/modules/utimensat +++ b/modules/utimensat @@ -6,10 +6,10 @@ lib/utimensat.c m4/utimensat.m4 Depends-on: -openat sys_stat -utimens extensions +openat [test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1] +utimens [test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1] configure.ac: gl_FUNC_UTIMENSAT diff --git a/modules/vasprintf b/modules/vasprintf index e0eed16b24..0b8e1419aa 100644 --- a/modules/vasprintf +++ b/modules/vasprintf @@ -12,10 +12,10 @@ lib/asprintf.c m4/vasprintf.m4 Depends-on: -extensions -vasnprintf stdio -errno +extensions +vasnprintf [test $HAVE_VASPRINTF = 0 || test $REPLACE_VASPRINTF = 1] +errno [test $HAVE_VASPRINTF = 0 || test $REPLACE_VASPRINTF = 1] configure.ac: gl_FUNC_VASPRINTF diff --git a/modules/vdprintf b/modules/vdprintf index 3ddda20d13..eba447167c 100644 --- a/modules/vdprintf +++ b/modules/vdprintf @@ -7,9 +7,9 @@ m4/vdprintf.m4 Depends-on: stdio -vasnprintf -full-write -errno +vasnprintf [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +full-write [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +errno [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] configure.ac: gl_FUNC_VDPRINTF diff --git a/modules/vdprintf-posix b/modules/vdprintf-posix index 649eacfce4..518ecde526 100644 --- a/modules/vdprintf-posix +++ b/modules/vdprintf-posix @@ -14,18 +14,18 @@ m4/printf.m4 Depends-on: vdprintf -vasnprintf -isnand-nolibm -isnanl-nolibm -frexp-nolibm -frexpl-nolibm -printf-frexp -printf-frexpl -signbit -fpucw nocrash printf-safe multiarch +vasnprintf [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +isnand-nolibm [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +isnanl-nolibm [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +frexp-nolibm [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +frexpl-nolibm [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +printf-frexp [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +printf-frexpl [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +signbit [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] +fpucw [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1] configure.ac: gl_FUNC_VDPRINTF_POSIX diff --git a/modules/vfprintf-posix b/modules/vfprintf-posix index 45af3638f5..69b6608e09 100644 --- a/modules/vfprintf-posix +++ b/modules/vfprintf-posix @@ -14,20 +14,20 @@ m4/printf.m4 Depends-on: stdio -fseterr -vasnprintf -isnand-nolibm -isnanl-nolibm -frexp-nolibm -frexpl-nolibm -printf-frexp -printf-frexpl -signbit -fpucw nocrash printf-safe -errno multiarch +fseterr [test $REPLACE_VFPRINTF = 1] +vasnprintf [test $REPLACE_VFPRINTF = 1] +isnand-nolibm [test $REPLACE_VFPRINTF = 1] +isnanl-nolibm [test $REPLACE_VFPRINTF = 1] +frexp-nolibm [test $REPLACE_VFPRINTF = 1] +frexpl-nolibm [test $REPLACE_VFPRINTF = 1] +printf-frexp [test $REPLACE_VFPRINTF = 1] +printf-frexpl [test $REPLACE_VFPRINTF = 1] +signbit [test $REPLACE_VFPRINTF = 1] +fpucw [test $REPLACE_VFPRINTF = 1] +errno [test $REPLACE_VFPRINTF = 1] configure.ac: gl_FUNC_VFPRINTF_POSIX diff --git a/modules/vprintf-posix b/modules/vprintf-posix index 319d83d6bc..b861d10552 100644 --- a/modules/vprintf-posix +++ b/modules/vprintf-posix @@ -14,8 +14,8 @@ m4/printf.m4 Depends-on: stdio -vfprintf-posix printf-safe +vfprintf-posix [test $REPLACE_VPRINTF = 1] configure.ac: gl_FUNC_VPRINTF_POSIX diff --git a/modules/vsnprintf b/modules/vsnprintf index ce44cf1536..053b10c32a 100644 --- a/modules/vsnprintf +++ b/modules/vsnprintf @@ -9,8 +9,8 @@ m4/printf.m4 Depends-on: stdio -vasnprintf -errno +vasnprintf [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] +errno [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] configure.ac: gl_FUNC_VSNPRINTF diff --git a/modules/vsnprintf-posix b/modules/vsnprintf-posix index 0f36cd9909..198beeb58a 100644 --- a/modules/vsnprintf-posix +++ b/modules/vsnprintf-posix @@ -14,18 +14,18 @@ m4/printf.m4 Depends-on: vsnprintf -vasnprintf -isnand-nolibm -isnanl-nolibm -frexp-nolibm -frexpl-nolibm -printf-frexp -printf-frexpl -signbit -fpucw nocrash printf-safe multiarch +vasnprintf [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] +isnand-nolibm [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] +isnanl-nolibm [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] +frexp-nolibm [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] +frexpl-nolibm [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] +printf-frexp [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] +printf-frexpl [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] +signbit [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] +fpucw [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1] configure.ac: gl_FUNC_VSNPRINTF_POSIX diff --git a/modules/vsprintf-posix b/modules/vsprintf-posix index 44d89f5407..10e5385612 100644 --- a/modules/vsprintf-posix +++ b/modules/vsprintf-posix @@ -14,20 +14,20 @@ m4/printf.m4 Depends-on: stdio -vasnprintf -isnand-nolibm -isnanl-nolibm -frexp-nolibm -frexpl-nolibm -printf-frexp -printf-frexpl -signbit -fpucw nocrash printf-safe -stdint -errno multiarch +vasnprintf [test $REPLACE_VSPRINTF = 1] +isnand-nolibm [test $REPLACE_VSPRINTF = 1] +isnanl-nolibm [test $REPLACE_VSPRINTF = 1] +frexp-nolibm [test $REPLACE_VSPRINTF = 1] +frexpl-nolibm [test $REPLACE_VSPRINTF = 1] +printf-frexp [test $REPLACE_VSPRINTF = 1] +printf-frexpl [test $REPLACE_VSPRINTF = 1] +signbit [test $REPLACE_VSPRINTF = 1] +fpucw [test $REPLACE_VSPRINTF = 1] +stdint [test $REPLACE_VSPRINTF = 1] +errno [test $REPLACE_VSPRINTF = 1] configure.ac: gl_FUNC_VSPRINTF_POSIX diff --git a/modules/wcrtomb b/modules/wcrtomb index cdafa555ac..f9fea15ff1 100644 --- a/modules/wcrtomb +++ b/modules/wcrtomb @@ -12,9 +12,9 @@ m4/locale-zh.m4 m4/codeset.m4 Depends-on: -extensions wchar -mbsinit +extensions +mbsinit [test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1] configure.ac: gl_FUNC_WCRTOMB diff --git a/modules/wcscasecmp b/modules/wcscasecmp index 18c549c2f6..4639354bf5 100644 --- a/modules/wcscasecmp +++ b/modules/wcscasecmp @@ -8,7 +8,7 @@ m4/wcscasecmp.m4 Depends-on: wchar -wctype-h +wctype-h [test $HAVE_WCSCASECMP = 0] configure.ac: gl_FUNC_WCSCASECMP diff --git a/modules/wcscspn b/modules/wcscspn index 2034b81b17..14b9a24e85 100644 --- a/modules/wcscspn +++ b/modules/wcscspn @@ -14,8 +14,8 @@ m4/wcscspn.m4 Depends-on: wchar -wcslen -wcschr +wcslen [test $HAVE_WCSCSPN = 0] +wcschr [test $HAVE_WCSCSPN = 0] configure.ac: gl_FUNC_WCSCSPN diff --git a/modules/wcsdup b/modules/wcsdup index 7e3cd66172..49a512e607 100644 --- a/modules/wcsdup +++ b/modules/wcsdup @@ -8,8 +8,8 @@ m4/wcsdup.m4 Depends-on: wchar -wcslen -wmemcpy +wcslen [test $HAVE_WCSDUP = 0] +wmemcpy [test $HAVE_WCSDUP = 0] configure.ac: gl_FUNC_WCSDUP diff --git a/modules/wcsncasecmp b/modules/wcsncasecmp index 88f36198da..3a1f84a1cd 100644 --- a/modules/wcsncasecmp +++ b/modules/wcsncasecmp @@ -8,7 +8,7 @@ m4/wcsncasecmp.m4 Depends-on: wchar -wctype-h +wctype-h [test $HAVE_WCSNCASECMP = 0] configure.ac: gl_FUNC_WCSNCASECMP diff --git a/modules/wcsnrtombs b/modules/wcsnrtombs index e8e975a73f..3582ae57fc 100644 --- a/modules/wcsnrtombs +++ b/modules/wcsnrtombs @@ -13,9 +13,9 @@ m4/locale-zh.m4 m4/codeset.m4 Depends-on: -extensions wchar -wcrtomb +extensions +wcrtomb [test $HAVE_WCSNRTOMBS = 0 || test $REPLACE_WCSNRTOMBS = 1] configure.ac: gl_FUNC_WCSNRTOMBS diff --git a/modules/wcspbrk b/modules/wcspbrk index a5b34f538b..b7aefa47c4 100644 --- a/modules/wcspbrk +++ b/modules/wcspbrk @@ -14,7 +14,7 @@ m4/wcspbrk.m4 Depends-on: wchar -wcschr +wcschr [test $HAVE_WCSPBRK = 0] configure.ac: gl_FUNC_WCSPBRK diff --git a/modules/wcsrtombs b/modules/wcsrtombs index 235b06b043..49c0503953 100644 --- a/modules/wcsrtombs +++ b/modules/wcsrtombs @@ -14,9 +14,9 @@ m4/locale-zh.m4 m4/codeset.m4 Depends-on: -extensions wchar -wcrtomb +extensions +wcrtomb [test $HAVE_WCSRTOMBS = 0 || test $REPLACE_WCSRTOMBS = 1] configure.ac: gl_FUNC_WCSRTOMBS diff --git a/modules/wcsspn b/modules/wcsspn index 3ecd53b979..035398d9bc 100644 --- a/modules/wcsspn +++ b/modules/wcsspn @@ -14,7 +14,7 @@ m4/wcsspn.m4 Depends-on: wchar -wcschr +wcschr [test $HAVE_WCSSPN = 0] configure.ac: gl_FUNC_WCSSPN diff --git a/modules/wcsstr b/modules/wcsstr index 22a2fb763c..d4f22f8509 100644 --- a/modules/wcsstr +++ b/modules/wcsstr @@ -8,7 +8,7 @@ m4/wcsstr.m4 Depends-on: wchar -wcschr +wcschr [test $HAVE_WCSSTR = 0] configure.ac: gl_FUNC_WCSSTR diff --git a/modules/wcstok b/modules/wcstok index 6f92b050b9..dc78e135bc 100644 --- a/modules/wcstok +++ b/modules/wcstok @@ -8,8 +8,8 @@ m4/wcstok.m4 Depends-on: wchar -wcsspn -wcspbrk +wcsspn [test $HAVE_WCSTOK = 0] +wcspbrk [test $HAVE_WCSTOK = 0] configure.ac: gl_FUNC_WCSTOK diff --git a/modules/wcswidth b/modules/wcswidth index 2b748eb7a6..629f21db80 100644 --- a/modules/wcswidth +++ b/modules/wcswidth @@ -9,7 +9,7 @@ m4/wcswidth.m4 Depends-on: wchar -wcwidth +wcwidth [test $HAVE_WCSWIDTH = 0 || test $REPLACE_WCSWIDTH = 1] configure.ac: gl_FUNC_WCSWIDTH diff --git a/modules/wctob b/modules/wctob index eba2ebf293..be430ebf41 100644 --- a/modules/wctob +++ b/modules/wctob @@ -9,7 +9,7 @@ m4/codeset.m4 Depends-on: wchar -wctomb +wctomb [test $ac_cv_func_wctob = no || test $REPLACE_WCTOB = 1] configure.ac: gl_FUNC_WCTOB diff --git a/modules/wctomb b/modules/wctomb index 81d41c4b90..5077005487 100644 --- a/modules/wctomb +++ b/modules/wctomb @@ -8,8 +8,8 @@ m4/wctomb.m4 Depends-on: stdlib -wcrtomb -wchar +wcrtomb [test $REPLACE_WCTOMB = 1] +wchar [test $REPLACE_WCTOMB = 1] configure.ac: gl_FUNC_WCTOMB diff --git a/modules/wctype b/modules/wctype index d2481640a1..ffc76a863e 100644 --- a/modules/wctype +++ b/modules/wctype @@ -14,7 +14,7 @@ m4/wctype.m4 Depends-on: wctype-h -iswblank +iswblank [test $HAVE_WCTYPE_T = 0] configure.ac: gl_FUNC_WCTYPE diff --git a/modules/wcwidth b/modules/wcwidth index e4a9460e94..27327a15c9 100644 --- a/modules/wcwidth +++ b/modules/wcwidth @@ -8,12 +8,12 @@ m4/wchar_t.m4 m4/wint_t.m4 Depends-on: -extensions wchar -wctype-h -localcharset -streq -uniwidth/width +extensions +wctype-h [test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1] +localcharset [test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1] +streq [test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1] +uniwidth/width [test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1] configure.ac: gl_FUNC_WCWIDTH diff --git a/modules/write b/modules/write index 0f0fc5f234..736e40b091 100644 --- a/modules/write +++ b/modules/write @@ -7,7 +7,7 @@ m4/write.m4 Depends-on: unistd -raise +raise [test $REPLACE_WRITE = 1] configure.ac: gl_FUNC_WRITE -- cgit v1.2.1 From 5c3f93c1d666bfbf19ef459743c3c2256aed1800 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Wed, 4 May 2011 12:22:12 +0100 Subject: do-release-commit-and-tag: add option to specify branch * build-aux/do-release-commit-and-tag: Add --branch. --- ChangeLog | 5 +++++ build-aux/do-release-commit-and-tag | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88875b8ed7..8e9dd2ba45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-05-04 Reuben Thomas + + Add option to do-release-commit-and-tag to specify branch. + * build-aux/do-release-commit-and-tag: Add --branch. + 2011-05-03 Bruno Haible Avoid unnecessary compilation units, through conditional dependencies. diff --git a/build-aux/do-release-commit-and-tag b/build-aux/do-release-commit-and-tag index ca89bdc9db..b1eaf8800e 100755 --- a/build-aux/do-release-commit-and-tag +++ b/build-aux/do-release-commit-and-tag @@ -3,7 +3,7 @@ # controlled .prev-version file, automate the procedure by which we record # the date, release-type and version string in the NEWS file. That commit # will serve to identify the release, so apply a signed tag to it as well. -VERSION=2010-06-07.07 # UTC +VERSION=2011-05-04.11 # UTC # Note: this is a bash script (could be zsh or dash) @@ -32,7 +32,7 @@ help_version() { case $1 in --help) cat < Date: Wed, 4 May 2011 14:26:56 -0600 Subject: maint: remove useless REPLACE_*_H macros There are still a few modules, like iconv_h.m4, that still use older paradigms where GNULIB_POSIXCHECK is unsupported and where gl_REPLACE_
_H is still essential. But since we are moving away from that style, I see no reason to keep the idiom for the modules that don't need it. * m4/arpa_inet_h.m4 (gl_REPLACE_ARPA_INET_H): Delete. * m4/dirent_h.m4 (gl_REPLACE_DIRENT_H): Likewise. * m4/locale_h.m4 (gl_REPLACE_LOCALE_H): Likewise. * m4/poll_h.m4 (gl_REPLACE_POLL_H): Likewise. * m4/spawn_h.m4 (gl_REPLACE_SPAWN_H): Likewise. * m4/sys_ioctl_h.m4 (gl_REPLACE_SYS_IOCTL_H): Likewise. * m4/wchar_h.m4 (gl_REPLACE_WCHAR_H): Likewise. * m4/btowc.m4: Update callers. * m4/dirfd.m4: Likewise. * m4/duplocale.m4: Likewise. * m4/fchdir.m4: Likewise. * m4/fdopendir.m4: Likewise. * m4/inet_ntop.m4: Likewise. * m4/inet_pton.m4: Likewise. * m4/ioctl.m4: Likewise. * m4/mbrlen.m4: Likewise. * m4/mbrtowc.m4: Likewise. * m4/mbsinit.m4: Likewise. * m4/mbsnrtowcs.m4: Likewise. * m4/mbsrtowcs.m4: Likewise. * m4/poll.m4: Likewise. * m4/setlocale.m4: Likewise. * m4/wcrtomb.m4: Likewise. * m4/wcsnrtombs.m4: Likewise. * m4/wcsrtombs.m4: Likewise. * m4/wctob.m4: Likewise. * m4/wcwidth.m4: Likewise. * modules/posix_spawn: Likewise. * modules/posix_spawn_file_actions_addclose: Likewise. * modules/posix_spawn_file_actions_adddup2: Likewise. * modules/posix_spawn_file_actions_addopen: Likewise. * modules/posix_spawn_file_actions_destroy: Likewise. * modules/posix_spawn_file_actions_init: Likewise. * modules/posix_spawnattr_destroy: Likewise. * modules/posix_spawnattr_getflags: Likewise. * modules/posix_spawnattr_getpgroup: Likewise. * modules/posix_spawnattr_getschedparam: Likewise. * modules/posix_spawnattr_getschedpolicy: Likewise. * modules/posix_spawnattr_getsigdefault: Likewise. * modules/posix_spawnattr_getsigmask: Likewise. * modules/posix_spawnattr_init: Likewise. * modules/posix_spawnattr_setflags: Likewise. * modules/posix_spawnattr_setpgroup: Likewise. * modules/posix_spawnattr_setschedparam: Likewise. * modules/posix_spawnattr_setschedpolicy: Likewise. * modules/posix_spawnattr_setsigdefault: Likewise. * modules/posix_spawnattr_setsigmask: Likewise. * modules/posix_spawnp: Likewise. Signed-off-by: Eric Blake --- ChangeLog | 52 +++++++++++++++++++++++++++++++ m4/arpa_inet_h.m4 | 9 +----- m4/btowc.m4 | 3 +- m4/dirent_h.m4 | 9 +----- m4/dirfd.m4 | 3 +- m4/duplocale.m4 | 3 +- m4/fchdir.m4 | 3 +- m4/fdopendir.m4 | 4 +-- m4/inet_ntop.m4 | 4 +-- m4/inet_pton.m4 | 4 +-- m4/ioctl.m4 | 4 +-- m4/locale_h.m4 | 15 +-------- m4/mbrlen.m4 | 3 +- m4/mbrtowc.m4 | 6 +--- m4/mbsinit.m4 | 3 +- m4/mbsnrtowcs.m4 | 3 +- m4/mbsrtowcs.m4 | 3 +- m4/poll.m4 | 3 +- m4/poll_h.m4 | 10 +----- m4/setlocale.m4 | 3 +- m4/spawn_h.m4 | 10 +----- m4/sys_ioctl_h.m4 | 9 +----- m4/wchar_h.m4 | 9 +----- m4/wcrtomb.m4 | 3 +- m4/wcsnrtombs.m4 | 3 +- m4/wcsrtombs.m4 | 3 +- m4/wctob.m4 | 5 +-- m4/wcwidth.m4 | 6 +--- modules/posix_spawn | 1 - modules/posix_spawn_file_actions_addclose | 1 - modules/posix_spawn_file_actions_adddup2 | 1 - modules/posix_spawn_file_actions_addopen | 1 - modules/posix_spawn_file_actions_destroy | 1 - modules/posix_spawn_file_actions_init | 1 - modules/posix_spawnattr_destroy | 1 - modules/posix_spawnattr_getflags | 1 - modules/posix_spawnattr_getpgroup | 1 - modules/posix_spawnattr_getschedparam | 1 - modules/posix_spawnattr_getschedpolicy | 1 - modules/posix_spawnattr_getsigdefault | 1 - modules/posix_spawnattr_getsigmask | 1 - modules/posix_spawnattr_init | 1 - modules/posix_spawnattr_setflags | 1 - modules/posix_spawnattr_setpgroup | 1 - modules/posix_spawnattr_setschedparam | 1 - modules/posix_spawnattr_setschedpolicy | 1 - modules/posix_spawnattr_setsigdefault | 1 - modules/posix_spawnattr_setsigmask | 1 - modules/posix_spawnp | 1 - 49 files changed, 79 insertions(+), 137 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e9dd2ba45..55c709fc25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,55 @@ +2011-05-05 Eric Blake + + maint: remove useless REPLACE_*_H macros + * m4/arpa_inet_h.m4 (gl_REPLACE_ARPA_INET_H): Delete. + * m4/dirent_h.m4 (gl_REPLACE_DIRENT_H): Likewise. + * m4/locale_h.m4 (gl_REPLACE_LOCALE_H): Likewise. + * m4/poll_h.m4 (gl_REPLACE_POLL_H): Likewise. + * m4/spawn_h.m4 (gl_REPLACE_SPAWN_H): Likewise. + * m4/sys_ioctl_h.m4 (gl_REPLACE_SYS_IOCTL_H): Likewise. + * m4/wchar_h.m4 (gl_REPLACE_WCHAR_H): Likewise. + * m4/btowc.m4: Update callers. + * m4/dirfd.m4: Likewise. + * m4/duplocale.m4: Likewise. + * m4/fchdir.m4: Likewise. + * m4/fdopendir.m4: Likewise. + * m4/inet_ntop.m4: Likewise. + * m4/inet_pton.m4: Likewise. + * m4/ioctl.m4: Likewise. + * m4/mbrlen.m4: Likewise. + * m4/mbrtowc.m4: Likewise. + * m4/mbsinit.m4: Likewise. + * m4/mbsnrtowcs.m4: Likewise. + * m4/mbsrtowcs.m4: Likewise. + * m4/poll.m4: Likewise. + * m4/setlocale.m4: Likewise. + * m4/wcrtomb.m4: Likewise. + * m4/wcsnrtombs.m4: Likewise. + * m4/wcsrtombs.m4: Likewise. + * m4/wctob.m4: Likewise. + * m4/wcwidth.m4: Likewise. + * modules/posix_spawn: Likewise. + * modules/posix_spawn_file_actions_addclose: Likewise. + * modules/posix_spawn_file_actions_adddup2: Likewise. + * modules/posix_spawn_file_actions_addopen: Likewise. + * modules/posix_spawn_file_actions_destroy: Likewise. + * modules/posix_spawn_file_actions_init: Likewise. + * modules/posix_spawnattr_destroy: Likewise. + * modules/posix_spawnattr_getflags: Likewise. + * modules/posix_spawnattr_getpgroup: Likewise. + * modules/posix_spawnattr_getschedparam: Likewise. + * modules/posix_spawnattr_getschedpolicy: Likewise. + * modules/posix_spawnattr_getsigdefault: Likewise. + * modules/posix_spawnattr_getsigmask: Likewise. + * modules/posix_spawnattr_init: Likewise. + * modules/posix_spawnattr_setflags: Likewise. + * modules/posix_spawnattr_setpgroup: Likewise. + * modules/posix_spawnattr_setschedparam: Likewise. + * modules/posix_spawnattr_setschedpolicy: Likewise. + * modules/posix_spawnattr_setsigdefault: Likewise. + * modules/posix_spawnattr_setsigmask: Likewise. + * modules/posix_spawnp: Likewise. + 2011-05-04 Reuben Thomas Add option to do-release-commit-and-tag to specify branch. diff --git a/m4/arpa_inet_h.m4 b/m4/arpa_inet_h.m4 index d21b162fc7..6dc0fdb58b 100644 --- a/m4/arpa_inet_h.m4 +++ b/m4/arpa_inet_h.m4 @@ -1,4 +1,4 @@ -# arpa_inet_h.m4 serial 11 +# arpa_inet_h.m4 serial 12 dnl Copyright (C) 2006, 2008-2011 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,13 +38,6 @@ AC_DEFUN([gl_HEADER_ARPA_INET], ]], [inet_ntop inet_pton]) ]) -dnl Unconditionally enables the replacement of . -AC_DEFUN([gl_REPLACE_ARPA_INET_H], -[ - dnl This is a no-op, because is always overridden. - : -]) - AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. diff --git a/m4/btowc.m4 b/m4/btowc.m4 index 603298f43f..32bf0cfca0 100644 --- a/m4/btowc.m4 +++ b/m4/btowc.m4 @@ -1,4 +1,4 @@ -# btowc.m4 serial 8 +# btowc.m4 serial 9 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -109,7 +109,6 @@ int main () esac fi if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([btowc]) gl_PREREQ_BTOWC fi diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4 index 853ac7dad4..fdc2c440d6 100644 --- a/m4/dirent_h.m4 +++ b/m4/dirent_h.m4 @@ -1,4 +1,4 @@ -# dirent_h.m4 serial 13 +# dirent_h.m4 serial 14 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,13 +21,6 @@ AC_DEFUN([gl_DIRENT_H], ]], [alphasort dirfd fdopendir scandir]) ]) -dnl Unconditionally enables the replacement of . -AC_DEFUN([gl_REPLACE_DIRENT_H], -[ - dnl This is a no-op, because is always overridden. - : -]) - AC_DEFUN([gl_DIRENT_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. diff --git a/m4/dirfd.m4 b/m4/dirfd.m4 index b8789c2e75..f401f6ced4 100644 --- a/m4/dirfd.m4 +++ b/m4/dirfd.m4 @@ -1,4 +1,4 @@ -# serial 19 -*- Autoconf -*- +# serial 20 -*- Autoconf -*- dnl Find out how to get the file descriptor associated with an open DIR*. @@ -12,7 +12,6 @@ dnl From Jim Meyering AC_DEFUN([gl_FUNC_DIRFD], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) - gl_REPLACE_DIRENT_H dnl Persuade glibc to declare dirfd(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) diff --git a/m4/duplocale.m4 b/m4/duplocale.m4 index 4393d82dfb..d61a8d2c56 100644 --- a/m4/duplocale.m4 +++ b/m4/duplocale.m4 @@ -1,4 +1,4 @@ -# duplocale.m4 serial 5 +# duplocale.m4 serial 6 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -60,7 +60,6 @@ int main () HAVE_DUPLOCALE=0 fi if test $REPLACE_DUPLOCALE = 1; then - gl_REPLACE_LOCALE_H AC_LIBOBJ([duplocale]) gl_PREREQ_DUPLOCALE fi diff --git a/m4/fchdir.m4 b/m4/fchdir.m4 index 49d89d1840..829373a707 100644 --- a/m4/fchdir.m4 +++ b/m4/fchdir.m4 @@ -1,4 +1,4 @@ -# fchdir.m4 serial 15 +# fchdir.m4 serial 16 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,7 +33,6 @@ AC_DEFUN([gl_FUNC_FCHDIR], gl_REPLACE_DUP2 dnl dup3 is already unconditionally replaced gl_REPLACE_FCNTL - gl_REPLACE_DIRENT_H AC_CACHE_CHECK([whether open can visit directories], [gl_cv_func_open_directory_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4 index f192a62830..05aa77213f 100644 --- a/m4/fdopendir.m4 +++ b/m4/fdopendir.m4 @@ -1,4 +1,4 @@ -# serial 5 +# serial 6 # See if we need to provide fdopendir. dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. @@ -19,7 +19,6 @@ AC_DEFUN([gl_FUNC_FDOPENDIR], if test $ac_cv_func_fdopendir = no; then AC_LIBOBJ([openat-proc]) AC_LIBOBJ([fdopendir]) - gl_REPLACE_DIRENT_H HAVE_FDOPENDIR=0 else AC_CACHE_CHECK([whether fdopendir works], @@ -42,7 +41,6 @@ extern DIR *fdopendir (int); [gl_cv_func_fdopendir_works="guessing no"])]) if test "$gl_cv_func_fdopendir_works" != yes; then REPLACE_FDOPENDIR=1 - gl_REPLACE_DIRENT_H AC_LIBOBJ([fdopendir]) fi fi diff --git a/m4/inet_ntop.m4 b/m4/inet_ntop.m4 index 57580b8a4a..0167dd2b48 100644 --- a/m4/inet_ntop.m4 +++ b/m4/inet_ntop.m4 @@ -1,4 +1,4 @@ -# inet_ntop.m4 serial 13 +# inet_ntop.m4 serial 14 dnl Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,8 +9,6 @@ AC_DEFUN([gl_FUNC_INET_NTOP], dnl Persuade Solaris to declare inet_ntop. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - gl_REPLACE_ARPA_INET_H - 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 diff --git a/m4/inet_pton.m4 b/m4/inet_pton.m4 index 9a7ad3b384..073df21a93 100644 --- a/m4/inet_pton.m4 +++ b/m4/inet_pton.m4 @@ -1,4 +1,4 @@ -# inet_pton.m4 serial 11 +# inet_pton.m4 serial 12 dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,8 +9,6 @@ AC_DEFUN([gl_FUNC_INET_PTON], dnl Persuade Solaris to declare inet_pton. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - gl_REPLACE_ARPA_INET_H - 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 diff --git a/m4/ioctl.m4 b/m4/ioctl.m4 index 8cb36d88fe..3c17a2ed47 100644 --- a/m4/ioctl.m4 +++ b/m4/ioctl.m4 @@ -1,4 +1,4 @@ -# ioctl.m4 serial 1 +# ioctl.m4 serial 2 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -13,7 +13,6 @@ AC_DEFUN([gl_FUNC_IOCTL], dnl application may use it and pass file descriptors that refer to dnl sockets to the ioctl() function. So enable the support for sockets. AC_LIBOBJ([ioctl]) - gl_REPLACE_SYS_IOCTL_H else AC_CHECK_FUNCS([ioctl]) dnl On glibc systems, the second parameter is 'unsigned long int request', @@ -32,7 +31,6 @@ AC_DEFUN([gl_FUNC_IOCTL], if test $gl_cv_func_ioctl_posix_signature != yes; then REPLACE_IOCTL=1 AC_LIBOBJ([ioctl]) - gl_REPLACE_SYS_IOCTL_H fi fi ]) diff --git a/m4/locale_h.m4 b/m4/locale_h.m4 index 4d0f894261..e77a3032eb 100644 --- a/m4/locale_h.m4 +++ b/m4/locale_h.m4 @@ -1,4 +1,4 @@ -# locale_h.m4 serial 13 +# locale_h.m4 serial 14 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -57,12 +57,6 @@ AC_DEFUN([gl_LOCALE_H], dnl is always overridden, because of GNULIB_POSIXCHECK. gl_NEXT_HEADERS([locale.h]) - if test -n "$STDDEF_H" \ - || test $gl_cv_header_locale_h_posix2001 = no \ - || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then - gl_REPLACE_LOCALE_H - fi - dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include @@ -74,13 +68,6 @@ AC_DEFUN([gl_LOCALE_H], [setlocale duplocale]) ]) -dnl Unconditionally enables the replacement of . -AC_DEFUN([gl_REPLACE_LOCALE_H], -[ - dnl This is a no-op, because is always overridden. - : -]) - AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. diff --git a/m4/mbrlen.m4 b/m4/mbrlen.m4 index b056895b39..8f55e3627d 100644 --- a/m4/mbrlen.m4 +++ b/m4/mbrlen.m4 @@ -1,4 +1,4 @@ -# mbrlen.m4 serial 5 +# mbrlen.m4 serial 6 dnl Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -23,7 +23,6 @@ AC_DEFUN([gl_FUNC_MBRLEN], fi fi if test $HAVE_MBRLEN = 0 || test $REPLACE_MBRLEN = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([mbrlen]) gl_PREREQ_MBRLEN fi diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4 index c353862973..b5b6aaa031 100644 --- a/m4/mbrtowc.m4 +++ b/m4/mbrtowc.m4 @@ -1,4 +1,4 @@ -# mbrtowc.m4 serial 22 +# mbrtowc.m4 serial 23 dnl Copyright (C) 2001-2002, 2004-2005, 2008-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -54,7 +54,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC], fi fi if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([mbrtowc]) gl_PREREQ_MBRTOWC fi @@ -88,9 +87,6 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN], else REPLACE_MBSTATE_T=1 fi - if test $REPLACE_MBSTATE_T = 1; then - gl_REPLACE_WCHAR_H - fi ]) dnl Test whether mbrtowc puts the state into non-initial state when parsing an diff --git a/m4/mbsinit.m4 b/m4/mbsinit.m4 index 47e2d14a73..b42a49ab49 100644 --- a/m4/mbsinit.m4 +++ b/m4/mbsinit.m4 @@ -1,4 +1,4 @@ -# mbsinit.m4 serial 5 +# mbsinit.m4 serial 6 dnl Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,7 +28,6 @@ AC_DEFUN([gl_FUNC_MBSINIT], fi fi if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([mbsinit]) gl_PREREQ_MBSINIT fi diff --git a/m4/mbsnrtowcs.m4 b/m4/mbsnrtowcs.m4 index 1ba443e5ad..d72942f033 100644 --- a/m4/mbsnrtowcs.m4 +++ b/m4/mbsnrtowcs.m4 @@ -1,4 +1,4 @@ -# mbsnrtowcs.m4 serial 2 +# mbsnrtowcs.m4 serial 3 dnl Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -23,7 +23,6 @@ AC_DEFUN([gl_FUNC_MBSNRTOWCS], fi fi if test $HAVE_MBSNRTOWCS = 0 || test $REPLACE_MBSNRTOWCS = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([mbsnrtowcs]) AC_LIBOBJ([mbsrtowcs-state]) gl_PREREQ_MBSNRTOWCS diff --git a/m4/mbsrtowcs.m4 b/m4/mbsrtowcs.m4 index 1fe8dcf27d..4410741d78 100644 --- a/m4/mbsrtowcs.m4 +++ b/m4/mbsrtowcs.m4 @@ -1,4 +1,4 @@ -# mbsrtowcs.m4 serial 10 +# mbsrtowcs.m4 serial 11 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -26,7 +26,6 @@ AC_DEFUN([gl_FUNC_MBSRTOWCS], fi fi if test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([mbsrtowcs]) AC_LIBOBJ([mbsrtowcs-state]) gl_PREREQ_MBSRTOWCS diff --git a/m4/poll.m4 b/m4/poll.m4 index 4f8df1e04a..d226e1c011 100644 --- a/m4/poll.m4 +++ b/m4/poll.m4 @@ -1,4 +1,4 @@ -# poll.m4 serial 12 +# poll.m4 serial 13 dnl Copyright (c) 2003, 2005-2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -63,7 +63,6 @@ This is MacOSX or AIX fi fi if test $HAVE_POLL = 0 || test $REPLACE_POLL = 1; then - gl_REPLACE_POLL_H AC_LIBOBJ([poll]) gl_PREREQ_POLL else diff --git a/m4/poll_h.m4 b/m4/poll_h.m4 index 758f29b0bf..3f2abf4974 100644 --- a/m4/poll_h.m4 +++ b/m4/poll_h.m4 @@ -1,4 +1,4 @@ -# poll_h.m4 serial 1 +# poll_h.m4 serial 2 dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,6 @@ AC_DEFUN([gl_POLL_H], HAVE_POLL_H=1 else HAVE_POLL_H=0 - gl_REPLACE_POLL_H fi AC_SUBST([HAVE_POLL_H]) @@ -30,13 +29,6 @@ AC_DEFUN([gl_POLL_H], [poll]) ]) -dnl Unconditionally enables the replacement of . -AC_DEFUN([gl_REPLACE_POLL_H], -[ - dnl This is a no-op, because is always overridden. - : -]) - AC_DEFUN([gl_POLL_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. diff --git a/m4/setlocale.m4 b/m4/setlocale.m4 index 6672c34133..cc3ab776f2 100644 --- a/m4/setlocale.m4 +++ b/m4/setlocale.m4 @@ -1,4 +1,4 @@ -# setlocale.m4 serial 1 +# setlocale.m4 serial 2 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,7 +14,6 @@ AC_DEFUN([gl_FUNC_SETLOCALE], mingw*) REPLACE_SETLOCALE=1 ;; esac if test $REPLACE_SETLOCALE = 1; then - gl_REPLACE_LOCALE_H AC_LIBOBJ([setlocale]) gl_PREREQ_SETLOCALE fi diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4 index a044e372f0..4903b6a4a1 100644 --- a/m4/spawn_h.m4 +++ b/m4/spawn_h.m4 @@ -1,4 +1,4 @@ -# spawn_h.m4 serial 12 +# spawn_h.m4 serial 13 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,7 +28,6 @@ AC_DEFUN([gl_SPAWN_H], HAVE_SPAWN_H=0 HAVE_POSIX_SPAWNATTR_T=0 HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0 - gl_REPLACE_SPAWN_H fi AC_SUBST([HAVE_SPAWN_H]) @@ -65,13 +64,6 @@ AC_DEFUN([gl_HAVE_POSIX_SPAWN], fi ]) -dnl Unconditionally enables the replacement of . -AC_DEFUN([gl_REPLACE_SPAWN_H], -[ - dnl This is a no-op, because is always overridden. - : -]) - AC_DEFUN([gl_SPAWN_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. diff --git a/m4/sys_ioctl_h.m4 b/m4/sys_ioctl_h.m4 index 97cab84b06..8c7d112cf9 100644 --- a/m4/sys_ioctl_h.m4 +++ b/m4/sys_ioctl_h.m4 @@ -1,4 +1,4 @@ -# sys_ioctl_h.m4 serial 9 +# sys_ioctl_h.m4 serial 10 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -44,13 +44,6 @@ AC_DEFUN([gl_SYS_IOCTL_H], ]], [ioctl]) ]) -dnl Unconditionally enables the replacement of . -AC_DEFUN([gl_REPLACE_SYS_IOCTL_H], -[ - dnl This is a no-op, because is always overridden. - : -]) - AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 index 6255ff352d..977491fe8d 100644 --- a/m4/wchar_h.m4 +++ b/m4/wchar_h.m4 @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar_h.m4 serial 38 +# wchar_h.m4 serial 39 AC_DEFUN([gl_WCHAR_H], [ @@ -119,13 +119,6 @@ Configuration aborted.]) fi ]) -dnl Unconditionally enables the replacement of . -AC_DEFUN([gl_REPLACE_WCHAR_H], -[ - dnl This is a no-op, because is always overridden. - : -]) - AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. diff --git a/m4/wcrtomb.m4 b/m4/wcrtomb.m4 index 2905d9ba4d..4f58e3f5de 100644 --- a/m4/wcrtomb.m4 +++ b/m4/wcrtomb.m4 @@ -1,4 +1,4 @@ -# wcrtomb.m4 serial 8 +# wcrtomb.m4 serial 9 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -89,7 +89,6 @@ int main () fi fi if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([wcrtomb]) gl_PREREQ_WCRTOMB fi diff --git a/m4/wcsnrtombs.m4 b/m4/wcsnrtombs.m4 index 5607807bfd..ba61129a5b 100644 --- a/m4/wcsnrtombs.m4 +++ b/m4/wcsnrtombs.m4 @@ -1,4 +1,4 @@ -# wcsnrtombs.m4 serial 3 +# wcsnrtombs.m4 serial 4 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,6 @@ AC_DEFUN([gl_FUNC_WCSNRTOMBS], fi fi if test $HAVE_WCSNRTOMBS = 0 || test $REPLACE_WCSNRTOMBS = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([wcsnrtombs]) AC_LIBOBJ([wcsrtombs-state]) gl_PREREQ_WCSNRTOMBS diff --git a/m4/wcsrtombs.m4 b/m4/wcsrtombs.m4 index 19f0c78a9e..cd51506a2b 100644 --- a/m4/wcsrtombs.m4 +++ b/m4/wcsrtombs.m4 @@ -1,4 +1,4 @@ -# wcsrtombs.m4 serial 8 +# wcsrtombs.m4 serial 9 dnl Copyright (C) 2008-2011 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,7 +35,6 @@ AC_DEFUN([gl_FUNC_WCSRTOMBS], fi fi if test $HAVE_WCSRTOMBS = 0 || test $REPLACE_WCSRTOMBS = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([wcsrtombs]) AC_LIBOBJ([wcsrtombs-state]) gl_PREREQ_WCSRTOMBS diff --git a/m4/wctob.m4 b/m4/wctob.m4 index 3b4633c42f..b66e755d4d 100644 --- a/m4/wctob.m4 +++ b/m4/wctob.m4 @@ -1,4 +1,4 @@ -# wctob.m4 serial 7 +# wctob.m4 serial 8 dnl Copyright (C) 2008-2011 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,6 @@ AC_DEFUN([gl_FUNC_WCTOB], AC_CHECK_FUNCS_ONCE([wctob]) if test $ac_cv_func_wctob = no; then HAVE_DECL_WCTOB=0 - gl_REPLACE_WCHAR_H AC_LIBOBJ([wctob]) gl_PREREQ_WCTOB else @@ -103,7 +102,6 @@ int main () *) REPLACE_WCTOB=1 ;; esac if test $REPLACE_WCTOB = 1; then - gl_REPLACE_WCHAR_H AC_LIBOBJ([wctob]) gl_PREREQ_WCTOB else @@ -121,7 +119,6 @@ int main () ]) if test $ac_cv_have_decl_wctob != yes; then HAVE_DECL_WCTOB=0 - gl_REPLACE_WCHAR_H fi fi fi diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4 index bf39d1d238..dbcc231be4 100644 --- a/m4/wcwidth.m4 +++ b/m4/wcwidth.m4 @@ -1,4 +1,4 @@ -# wcwidth.m4 serial 18 +# wcwidth.m4 serial 19 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -93,10 +93,6 @@ changequote([,])dnl if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1; then AC_LIBOBJ([wcwidth]) fi - if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1 \ - || test $HAVE_DECL_WCWIDTH = 0; then - gl_REPLACE_WCHAR_H - fi dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not dnl have the wcwidth function, then it does not declare it. ]) diff --git a/modules/posix_spawn b/modules/posix_spawn index 2d4ddf3865..54e08d8413 100644 --- a/modules/posix_spawn +++ b/modules/posix_spawn @@ -12,7 +12,6 @@ posix_spawn-internal [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawn]) gl_POSIX_SPAWN_INTERNAL fi diff --git a/modules/posix_spawn_file_actions_addclose b/modules/posix_spawn_file_actions_addclose index d24a0c9cc6..eef7b63c55 100644 --- a/modules/posix_spawn_file_actions_addclose +++ b/modules/posix_spawn_file_actions_addclose @@ -14,7 +14,6 @@ getdtablesize [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1] configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawn_faction_addclose]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_addclose]) diff --git a/modules/posix_spawn_file_actions_adddup2 b/modules/posix_spawn_file_actions_adddup2 index 59c828e9b2..1cab62fb9c 100644 --- a/modules/posix_spawn_file_actions_adddup2 +++ b/modules/posix_spawn_file_actions_adddup2 @@ -14,7 +14,6 @@ getdtablesize [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1] configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawn_faction_adddup2]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_adddup2]) diff --git a/modules/posix_spawn_file_actions_addopen b/modules/posix_spawn_file_actions_addopen index f828976ea6..464e6491e8 100644 --- a/modules/posix_spawn_file_actions_addopen +++ b/modules/posix_spawn_file_actions_addopen @@ -14,7 +14,6 @@ getdtablesize [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1] configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawn_faction_addopen]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_addopen]) diff --git a/modules/posix_spawn_file_actions_destroy b/modules/posix_spawn_file_actions_destroy index 8ca5aa2f11..ae1ea0d886 100644 --- a/modules/posix_spawn_file_actions_destroy +++ b/modules/posix_spawn_file_actions_destroy @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawn_faction_destroy]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_destroy]) diff --git a/modules/posix_spawn_file_actions_init b/modules/posix_spawn_file_actions_init index 7431aabcc8..7afc5bef77 100644 --- a/modules/posix_spawn_file_actions_init +++ b/modules/posix_spawn_file_actions_init @@ -13,7 +13,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawn_faction_init]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_init]) diff --git a/modules/posix_spawnattr_destroy b/modules/posix_spawnattr_destroy index 426b382aba..59fd22bded 100644 --- a/modules/posix_spawnattr_destroy +++ b/modules/posix_spawnattr_destroy @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_destroy]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_destroy]) diff --git a/modules/posix_spawnattr_getflags b/modules/posix_spawnattr_getflags index 47a70dd2b0..ffade0c3d0 100644 --- a/modules/posix_spawnattr_getflags +++ b/modules/posix_spawnattr_getflags @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_getflags]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getflags]) diff --git a/modules/posix_spawnattr_getpgroup b/modules/posix_spawnattr_getpgroup index 60d62ccae7..58e59d31c1 100644 --- a/modules/posix_spawnattr_getpgroup +++ b/modules/posix_spawnattr_getpgroup @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_getpgroup]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getpgroup]) diff --git a/modules/posix_spawnattr_getschedparam b/modules/posix_spawnattr_getschedparam index c8cd1e4c71..6767db665c 100644 --- a/modules/posix_spawnattr_getschedparam +++ b/modules/posix_spawnattr_getschedparam @@ -14,7 +14,6 @@ gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 \ || test $REPLACE_POSIX_SPAWN = 1 \ || test $gl_cv_func_spawnattr_setschedparam = no; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_getschedparam]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getschedparam]) diff --git a/modules/posix_spawnattr_getschedpolicy b/modules/posix_spawnattr_getschedpolicy index a3be8cc239..19188c9cb5 100644 --- a/modules/posix_spawnattr_getschedpolicy +++ b/modules/posix_spawnattr_getschedpolicy @@ -14,7 +14,6 @@ gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 \ || test $REPLACE_POSIX_SPAWN = 1 \ || test $gl_cv_func_spawnattr_setschedpolicy = no; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_getschedpolicy]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getschedpolicy]) diff --git a/modules/posix_spawnattr_getsigdefault b/modules/posix_spawnattr_getsigdefault index 6a93722eff..980a59acf0 100644 --- a/modules/posix_spawnattr_getsigdefault +++ b/modules/posix_spawnattr_getsigdefault @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_getdefault]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getsigdefault]) diff --git a/modules/posix_spawnattr_getsigmask b/modules/posix_spawnattr_getsigmask index a984e96ec2..3435de2f25 100644 --- a/modules/posix_spawnattr_getsigmask +++ b/modules/posix_spawnattr_getsigmask @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_getsigmask]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getsigmask]) diff --git a/modules/posix_spawnattr_init b/modules/posix_spawnattr_init index 796f264208..fd8a11677a 100644 --- a/modules/posix_spawnattr_init +++ b/modules/posix_spawnattr_init @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_init]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_init]) diff --git a/modules/posix_spawnattr_setflags b/modules/posix_spawnattr_setflags index 54cbc991c6..2fad14506d 100644 --- a/modules/posix_spawnattr_setflags +++ b/modules/posix_spawnattr_setflags @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_setflags]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setflags]) diff --git a/modules/posix_spawnattr_setpgroup b/modules/posix_spawnattr_setpgroup index 6affe367c6..4f00f63a79 100644 --- a/modules/posix_spawnattr_setpgroup +++ b/modules/posix_spawnattr_setpgroup @@ -11,7 +11,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_setpgroup]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setpgroup]) diff --git a/modules/posix_spawnattr_setschedparam b/modules/posix_spawnattr_setschedparam index eb448f80f6..6827501a63 100644 --- a/modules/posix_spawnattr_setschedparam +++ b/modules/posix_spawnattr_setschedparam @@ -14,7 +14,6 @@ gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 \ || test $REPLACE_POSIX_SPAWN = 1 \ || test $gl_cv_func_spawnattr_setschedparam = no; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_setschedparam]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setschedparam]) diff --git a/modules/posix_spawnattr_setschedpolicy b/modules/posix_spawnattr_setschedpolicy index 44b487b13f..2de648dd24 100644 --- a/modules/posix_spawnattr_setschedpolicy +++ b/modules/posix_spawnattr_setschedpolicy @@ -14,7 +14,6 @@ gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 \ || test $REPLACE_POSIX_SPAWN = 1 \ || test $gl_cv_func_spawnattr_setschedpolicy = no; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_setschedpolicy]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setschedpolicy]) diff --git a/modules/posix_spawnattr_setsigdefault b/modules/posix_spawnattr_setsigdefault index e9f5bb134a..3d8ec56d0c 100644 --- a/modules/posix_spawnattr_setsigdefault +++ b/modules/posix_spawnattr_setsigdefault @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_setdefault]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setsigdefault]) diff --git a/modules/posix_spawnattr_setsigmask b/modules/posix_spawnattr_setsigmask index d73840b6a1..5e2bf44964 100644 --- a/modules/posix_spawnattr_setsigmask +++ b/modules/posix_spawnattr_setsigmask @@ -12,7 +12,6 @@ spawn configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnattr_setsigmask]) fi gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setsigmask]) diff --git a/modules/posix_spawnp b/modules/posix_spawnp index 7e2464780d..ec6accb82d 100644 --- a/modules/posix_spawnp +++ b/modules/posix_spawnp @@ -12,7 +12,6 @@ posix_spawn-internal [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = configure.ac: gl_POSIX_SPAWN if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then - gl_REPLACE_SPAWN_H AC_LIBOBJ([spawnp]) gl_POSIX_SPAWN_INTERNAL fi -- cgit v1.2.1 From fa6f00004c5ea9f4b341a7c60db177a7419f06aa Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:03:57 +0200 Subject: signal: Define sighandler_t. * lib/signal.in.h (sighandler_t): New type. * m4/signal_h.m4 (gl_SIGNAL_H): Require AC_USE_SYSTEM_EXTENSIONS. Test whether sighandler_t is defined. (gl_SIGNAL_H_DEFAULTS): Initialize HAVE_SIGHANDLER_T. * modules/signal (Depends-on): Add extensions. (Makefile.am): Substitute HAVE_SIGHANDLER_T. * doc/posix-headers/signal.texi: Mention the problem with sighandler_t. Suggested by Markus Steinborn . --- ChangeLog | 12 ++++++++++++ doc/posix-headers/signal.texi | 5 +++++ lib/signal.in.h | 14 ++++++++++++++ m4/signal_h.m4 | 11 ++++++++++- modules/signal | 2 ++ 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 55c709fc25..75a0b571d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-05-05 Bruno Haible + + signal: Define sighandler_t. + * lib/signal.in.h (sighandler_t): New type. + * m4/signal_h.m4 (gl_SIGNAL_H): Require AC_USE_SYSTEM_EXTENSIONS. Test + whether sighandler_t is defined. + (gl_SIGNAL_H_DEFAULTS): Initialize HAVE_SIGHANDLER_T. + * modules/signal (Depends-on): Add extensions. + (Makefile.am): Substitute HAVE_SIGHANDLER_T. + * doc/posix-headers/signal.texi: Mention the problem with sighandler_t. + Suggested by Markus Steinborn . + 2011-05-05 Eric Blake maint: remove useless REPLACE_*_H macros diff --git a/doc/posix-headers/signal.texi b/doc/posix-headers/signal.texi index 77a54323c3..7e953ce1ff 100644 --- a/doc/posix-headers/signal.texi +++ b/doc/posix-headers/signal.texi @@ -28,6 +28,11 @@ mingw. @item The macro @code{SA_NODEFER} is not defined on some platforms: Interix 3.5. +@item +The type @code{sighandler_t} (a GNU extension) is not defined on most non-glibc +platforms: +MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, +IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11, Cygwin, mingw, Interix 3.5, BeOS. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/signal.in.h b/lib/signal.in.h index 7a6d6ee856..036e4f2deb 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -66,6 +66,20 @@ typedef unsigned int sigset_t; # endif #endif +/* Define sighandler_t, the type of signal handlers. A GNU extension. */ +#if !@HAVE_SIGHANDLER_T@ +# ifdef __cplusplus +extern "C" { +# endif +# if !GNULIB_defined_sighandler_t +typedef void (*sighandler_t) (int); +# define GNULIB_defined_sighandler_t 1 +# endif +# ifdef __cplusplus +} +# endif +#endif + #if @GNULIB_SIGNAL_H_SIGPIPE@ # ifndef SIGPIPE diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 77eb125710..459ec007f3 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,4 +1,4 @@ -# signal_h.m4 serial 11 +# signal_h.m4 serial 12 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,14 +8,22 @@ AC_DEFUN([gl_SIGNAL_H], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) gl_NEXT_HEADERS([signal.h]) + # AIX declares sig_atomic_t to already include volatile, and C89 compilers # then choke on 'volatile sig_atomic_t'. C99 requires that it compile. AC_CHECK_TYPE([volatile sig_atomic_t], [], [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[ #include ]]) + AC_REQUIRE([AC_TYPE_UID_T]) + dnl Persuade glibc to define sighandler_t. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[ +#include + ]]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include @@ -46,4 +54,5 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS], AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION]) HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T]) + HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T]) ]) diff --git a/modules/signal b/modules/signal index 29b7af3cf1..c8d93a1dc0 100644 --- a/modules/signal +++ b/modules/signal @@ -10,6 +10,7 @@ arg-nonnull c++defs include_next warn-on-use +extensions configure.ac: gl_SIGNAL_H @@ -35,6 +36,7 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \ -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ + -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|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)' \ -- cgit v1.2.1 From 622614060bdf3f9d66a61a8789eecbf29d6b2a36 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:20:07 +0200 Subject: acosl..tanl: Relicense under LGPL. * modules/acosl (License): Change to LGPL. * modules/asinl (License): Likewise. * modules/atanl (License): Likewise. * modules/cosl (License): Likewise. * modules/expl (License): Likewise. * modules/logl (License): Likewise. * modules/sinl (License): Likewise. * modules/sqrtl (License): Likewise. * modules/tanl (License): Likewise. Source code originally from glibc and Paolo Bonzini. Agreements: --- ChangeLog | 16 ++++++++++++++++ modules/acosl | 2 +- modules/asinl | 2 +- modules/atanl | 2 +- modules/cosl | 2 +- modules/expl | 2 +- modules/logl | 2 +- modules/sinl | 2 +- modules/sqrtl | 2 +- modules/tanl | 2 +- 10 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75a0b571d9..7248c72fd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2011-05-05 Bruno Haible + + acosl..tanl: Relicense under LGPL. + * modules/acosl (License): Change to LGPL. + * modules/asinl (License): Likewise. + * modules/atanl (License): Likewise. + * modules/cosl (License): Likewise. + * modules/expl (License): Likewise. + * modules/logl (License): Likewise. + * modules/sinl (License): Likewise. + * modules/sqrtl (License): Likewise. + * modules/tanl (License): Likewise. + Source code originally from glibc and Paolo Bonzini. Agreements: + + + 2011-05-05 Bruno Haible signal: Define sighandler_t. diff --git a/modules/acosl b/modules/acosl index ed3a26d74f..0726070617 100644 --- a/modules/acosl +++ b/modules/acosl @@ -24,7 +24,7 @@ Link: $(ACOSL_LIBM) License: -GPL +LGPL Maintainer: Paolo Bonzini diff --git a/modules/asinl b/modules/asinl index df6ab281e5..19e049c2ac 100644 --- a/modules/asinl +++ b/modules/asinl @@ -23,7 +23,7 @@ Link: $(ASINL_LIBM) License: -GPL +LGPL Maintainer: Paolo Bonzini diff --git a/modules/atanl b/modules/atanl index 7c512e5c59..4f3f9eab64 100644 --- a/modules/atanl +++ b/modules/atanl @@ -23,7 +23,7 @@ Link: $(ATANL_LIBM) License: -GPL +LGPL Maintainer: Paolo Bonzini diff --git a/modules/cosl b/modules/cosl index 33f2e68a8f..391a841837 100644 --- a/modules/cosl +++ b/modules/cosl @@ -29,7 +29,7 @@ Link: $(ACOSL_LIBM) License: -GPL +LGPL Maintainer: Paolo Bonzini diff --git a/modules/expl b/modules/expl index 7681b3522a..a0ccf88448 100644 --- a/modules/expl +++ b/modules/expl @@ -24,7 +24,7 @@ Link: $(EXPL_LIBM) License: -GPL +LGPL Maintainer: Paolo Bonzini diff --git a/modules/logl b/modules/logl index 7883f444e0..95fd1a0371 100644 --- a/modules/logl +++ b/modules/logl @@ -25,7 +25,7 @@ Link: $(LOGL_LIBM) License: -GPL +LGPL Maintainer: Paolo Bonzini diff --git a/modules/sinl b/modules/sinl index 4bb4222002..7f2007a948 100644 --- a/modules/sinl +++ b/modules/sinl @@ -29,7 +29,7 @@ Link: $(SINL_LIBM) License: -GPL +LGPL Maintainer: Paolo Bonzini diff --git a/modules/sqrtl b/modules/sqrtl index dec1db3ffa..d7f73cac92 100644 --- a/modules/sqrtl +++ b/modules/sqrtl @@ -27,7 +27,7 @@ Link: $(SQRTL_LIBM) License: -GPL +LGPL Maintainer: Paolo Bonzini diff --git a/modules/tanl b/modules/tanl index 520df45e8c..7840dc18b9 100644 --- a/modules/tanl +++ b/modules/tanl @@ -28,7 +28,7 @@ Link: $(TANL_LIBM) License: -GPL +LGPL Maintainer: Paolo Bonzini -- cgit v1.2.1 From 0593b1a54f3cf788d93b5cc649255ecfae2cb19e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:22:52 +0200 Subject: isfinite: Relicense under LGPL. * modules/isfinite (License): Change to LGPL. With permission from Ben Pfaff, Bruno Haible: --- ChangeLog | 6 ++++++ modules/isfinite | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7248c72fd2..0b53776977 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-05-05 Bruno Haible + isfinite: Relicense under LGPL. + * modules/isfinite (License): Change to LGPL. + With permission from Ben Pfaff, Bruno Haible: + + + acosl..tanl: Relicense under LGPL. * modules/acosl (License): Change to LGPL. * modules/asinl (License): Likewise. diff --git a/modules/isfinite b/modules/isfinite index 00f3e87224..259da35f5a 100644 --- a/modules/isfinite +++ b/modules/isfinite @@ -23,7 +23,7 @@ Include: License: -GPL +LGPL Maintainer: Ben Pfaff -- cgit v1.2.1 From 6fec409920ea73abf9f594dbc0192deeee92d388 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:23:54 +0200 Subject: tmpfile: Relicense under LGPL. * modules/tmpfile (License): Change to LGPL. With permission from Ben Pfaff: --- ChangeLog | 5 +++++ modules/tmpfile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0b53776977..93bdfefb73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-05-05 Bruno Haible + tmpfile: Relicense under LGPL. + * modules/tmpfile (License): Change to LGPL. + With permission from Ben Pfaff: + + isfinite: Relicense under LGPL. * modules/isfinite (License): Change to LGPL. With permission from Ben Pfaff, Bruno Haible: diff --git a/modules/tmpfile b/modules/tmpfile index e65beb8a02..6adf22a9de 100644 --- a/modules/tmpfile +++ b/modules/tmpfile @@ -21,7 +21,7 @@ Include: License: -GPL +LGPL Maintainer: Ben Pfaff -- cgit v1.2.1 From 80acb7736ba887569269f0a19b4fb19713859846 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:25:17 +0200 Subject: fflush: Relicense under LGPL. * modules/fflush (License): Change to LGPL. With permission from Eric Blake, Bruno Haible, Jim Meyering: --- ChangeLog | 7 +++++++ modules/fflush | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 93bdfefb73..c24810e253 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-05-05 Bruno Haible + fflush: Relicense under LGPL. + * modules/fflush (License): Change to LGPL. + With permission from Eric Blake, Bruno Haible, Jim Meyering: + + + + tmpfile: Relicense under LGPL. * modules/tmpfile (License): Change to LGPL. With permission from Ben Pfaff: diff --git a/modules/fflush b/modules/fflush index e9649e09c8..501431f9d7 100644 --- a/modules/fflush +++ b/modules/fflush @@ -30,7 +30,7 @@ Include: License: -GPL +LGPL Maintainer: Eric Blake -- cgit v1.2.1 From dc3b334025f869427bac1db1a47b6f40635c13ef Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:26:25 +0200 Subject: futimens: Relicense under LGPL. * modules/futimens (License): Change to LGPL. With permission from Eric Blake: --- ChangeLog | 5 +++++ modules/futimens | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c24810e253..cc3b8072fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-05-05 Bruno Haible + futimens: Relicense under LGPL. + * modules/futimens (License): Change to LGPL. + With permission from Eric Blake: + + fflush: Relicense under LGPL. * modules/fflush (License): Change to LGPL. With permission from Eric Blake, Bruno Haible, Jim Meyering: diff --git a/modules/futimens b/modules/futimens index 2e6ecf8749..4ed403e946 100644 --- a/modules/futimens +++ b/modules/futimens @@ -23,7 +23,7 @@ Link: $(LIB_CLOCK_GETTIME) License: -GPL +LGPL Maintainer: Eric Blake -- cgit v1.2.1 From fba50604716b355a02d023ef5c2f7a7897b07536 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:28:21 +0200 Subject: nanosleep: Relicense under LGPL. * modules/nanosleep (License): Change to LGPL. With permission from Jim Meyering, Paul Eggert, Eric Blake, Bruno Haible: --- ChangeLog | 9 +++++++++ modules/nanosleep | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cc3b8072fa..b8d64df9f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2011-05-05 Bruno Haible + nanosleep: Relicense under LGPL. + * modules/nanosleep (License): Change to LGPL. + With permission from Jim Meyering, Paul Eggert, Eric Blake, Bruno + Haible: + + + + + futimens: Relicense under LGPL. * modules/futimens (License): Change to LGPL. With permission from Eric Blake: diff --git a/modules/nanosleep b/modules/nanosleep index 36d92be6cb..32af74b9fb 100644 --- a/modules/nanosleep +++ b/modules/nanosleep @@ -30,7 +30,7 @@ Link: $(LIB_NANOSLEEP) License: -GPL +LGPL Maintainer: Jim Meyering -- cgit v1.2.1 From a31967658bfb7892e2babaefab1c97fec4467281 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:29:48 +0200 Subject: getgroups: Relicense under LGPL. * modules/getgroups (License): Change to LGPL. With permission from Jim Meyering, Paul Eggert, Eric Blake: --- ChangeLog | 7 +++++++ modules/getgroups | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b8d64df9f6..2c5a571971 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-05-05 Bruno Haible + getgroups: Relicense under LGPL. + * modules/getgroups (License): Change to LGPL. + With permission from Jim Meyering, Paul Eggert, Eric Blake: + + + + nanosleep: Relicense under LGPL. * modules/nanosleep (License): Change to LGPL. With permission from Jim Meyering, Paul Eggert, Eric Blake, Bruno diff --git a/modules/getgroups b/modules/getgroups index 438236befa..4903123eb5 100644 --- a/modules/getgroups +++ b/modules/getgroups @@ -20,7 +20,7 @@ Include: License: -GPL +LGPL Maintainer: Jim Meyering, Eric Blake -- cgit v1.2.1 From bddbd5db0c2c5dfba61e63c6fcf551e881db2bc3 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:31:30 +0200 Subject: strtoimax, strtoumax: Relicense under LGPL. * modules/strtoimax (License): Change to LGPL. * modules/strtoumax (License): Likewise. With permission from Jim Meyering, Paul Eggert: --- ChangeLog | 7 +++++++ modules/strtoimax | 2 +- modules/strtoumax | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c5a571971..0c2caae161 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-05-05 Bruno Haible + strtoimax, strtoumax: Relicense under LGPL. + * modules/strtoimax (License): Change to LGPL. + * modules/strtoumax (License): Likewise. + With permission from Jim Meyering, Paul Eggert: + + + getgroups: Relicense under LGPL. * modules/getgroups (License): Change to LGPL. With permission from Jim Meyering, Paul Eggert, Eric Blake: diff --git a/modules/strtoimax b/modules/strtoimax index 155affe53b..5c8d5e3790 100644 --- a/modules/strtoimax +++ b/modules/strtoimax @@ -22,7 +22,7 @@ Include: License: -GPL +LGPL Maintainer: Paul Eggert diff --git a/modules/strtoumax b/modules/strtoumax index e2ef86c3bb..7ad6846913 100644 --- a/modules/strtoumax +++ b/modules/strtoumax @@ -23,7 +23,7 @@ Include: License: -GPL +LGPL Maintainer: Paul Eggert -- cgit v1.2.1 From 9dba31e113c15a07103d04980a8f39bcba5f7795 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 5 May 2011 19:37:01 +0200 Subject: tzset: Relicense under LGPL. * modules/tzset (License): Change to LGPL. No agreement needed; it's a no-op. --- ChangeLog | 4 ++++ modules/tzset | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0c2caae161..3ec1af5360 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-05-05 Bruno Haible + tzset: Relicense under LGPL. + * modules/tzset (License): Change to LGPL. + No agreement needed; it's a no-op. + strtoimax, strtoumax: Relicense under LGPL. * modules/strtoimax (License): Change to LGPL. * modules/strtoumax (License): Likewise. diff --git a/modules/tzset b/modules/tzset index 54f13e3801..608f7756d7 100644 --- a/modules/tzset +++ b/modules/tzset @@ -16,7 +16,7 @@ Include: License: -GPL +LGPL Maintainer: Jim Meyering -- cgit v1.2.1 From 5d9f4218b61b9c279b32a6572f21f260b38a05e8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 6 May 2011 00:23:55 +0200 Subject: fflush, fseeko: Respect rules for use of AC_LIBOBJ. * m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): New macro, extracted from gl_FUNC_FFLUSH. (gl_FUNC_FFLUSH): Use it. (gl_REPLACE_FFLUSH): Don't invoke gl_REPLACE_FSEEKO. * m4/fseeko.m4 (gl_FUNC_FSEEKO): Invoke gl_FUNC_FFLUSH_STDIN and gl_REPLACE_FSEEKO here. --- ChangeLog | 10 ++++++++++ m4/fflush.m4 | 19 +++++++++++++------ m4/fseeko.m4 | 8 +++++++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ec1af5360..40261c27e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-05-05 Bruno Haible + + fflush, fseeko: Respect rules for use of AC_LIBOBJ. + * m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): New macro, extracted from + gl_FUNC_FFLUSH. + (gl_FUNC_FFLUSH): Use it. + (gl_REPLACE_FFLUSH): Don't invoke gl_REPLACE_FSEEKO. + * m4/fseeko.m4 (gl_FUNC_FSEEKO): Invoke gl_FUNC_FFLUSH_STDIN and + gl_REPLACE_FSEEKO here. + 2011-05-05 Bruno Haible tzset: Relicense under LGPL. diff --git a/m4/fflush.m4 b/m4/fflush.m4 index 08b9f17d30..29ef61394d 100644 --- a/m4/fflush.m4 +++ b/m4/fflush.m4 @@ -1,4 +1,4 @@ -# fflush.m4 serial 9 +# fflush.m4 serial 10 # Copyright (C) 2007-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -11,6 +11,18 @@ dnl Find out how to obey POSIX semantics of fflush(stdin) discarding dnl unread input on seekable streams, rather than C99 undefined semantics. AC_DEFUN([gl_FUNC_FFLUSH], +[ + gl_FUNC_FFLUSH_STDIN + if test $gl_cv_func_fflush_stdin = no; then + gl_REPLACE_FFLUSH + gl_REPLACE_FCLOSE + fi +]) + +dnl Determine whether fflush works on input streams. +dnl Sets gl_cv_func_fflush_stdin. + +AC_DEFUN([gl_FUNC_FFLUSH_STDIN], [ AC_CACHE_CHECK([whether fflush works on input streams], [gl_cv_func_fflush_stdin], @@ -59,10 +71,6 @@ AC_DEFUN([gl_FUNC_FFLUSH], gl_cv_func_fflush_stdin=no]) rm conftest.txt ]) - if test $gl_cv_func_fflush_stdin = no; then - gl_REPLACE_FFLUSH - gl_REPLACE_FCLOSE - fi ]) AC_DEFUN([gl_REPLACE_FFLUSH], @@ -71,7 +79,6 @@ AC_DEFUN([gl_REPLACE_FFLUSH], AC_REQUIRE([gl_STDIO_H_DEFAULTS]) REPLACE_FFLUSH=1 gl_PREREQ_FFLUSH - gl_REPLACE_FSEEKO ]) # Prerequisites of lib/fflush.c. diff --git a/m4/fseeko.m4 b/m4/fseeko.m4 index 76507d128f..28da81b1cc 100644 --- a/m4/fseeko.m4 +++ b/m4/fseeko.m4 @@ -1,4 +1,4 @@ -# fseeko.m4 serial 11 +# fseeko.m4 serial 12 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -23,6 +23,12 @@ AC_DEFUN([gl_FUNC_FSEEKO], gl_REPLACE_FSEEKO fi fi + m4_ifdef([gl_FUNC_FFLUSH_STDIN], [ + gl_FUNC_FFLUSH_STDIN + if test $gl_cv_func_fflush_stdin = no; then + gl_REPLACE_FSEEKO + fi + ]) ]) dnl Tests whether fseeko is available. -- cgit v1.2.1 From 864eeee51daf303bb48df9fcd64b59ea96b51c0e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 6 May 2011 00:34:34 +0200 Subject: fclose, fflush: Respect rules for use of AC_LIBOBJ. * m4/fflush.m4 (gl_FUNC_FFLUSH): Don't invoke gl_REPLACE_FCLOSE. * m4/fclose.m4 (gl_FUNC_FCLOSE): Invoke gl_FUNC_FFLUSH_STDIN and gl_REPLACE_FCLOSE here. * modules/fflush (Depends-on): Remove fclose. * doc/posix-functions/fclose.texi: Mention module 'fflush' only in combination with module 'fclose'. --- ChangeLog | 10 ++++++++++ doc/posix-functions/fclose.texi | 2 +- m4/fclose.m4 | 8 +++++++- m4/fflush.m4 | 3 +-- modules/fflush | 1 - 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40261c27e2..3c60a4e8ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-05-05 Bruno Haible + + fclose, fflush: Respect rules for use of AC_LIBOBJ. + * m4/fflush.m4 (gl_FUNC_FFLUSH): Don't invoke gl_REPLACE_FCLOSE. + * m4/fclose.m4 (gl_FUNC_FCLOSE): Invoke gl_FUNC_FFLUSH_STDIN and + gl_REPLACE_FCLOSE here. + * modules/fflush (Depends-on): Remove fclose. + * doc/posix-functions/fclose.texi: Mention module 'fflush' only in + combination with module 'fclose'. + 2011-05-05 Bruno Haible fflush, fseeko: Respect rules for use of AC_LIBOBJ. diff --git a/doc/posix-functions/fclose.texi b/doc/posix-functions/fclose.texi index 45aac4c7e9..a7b576088e 100644 --- a/doc/posix-functions/fclose.texi +++ b/doc/posix-functions/fclose.texi @@ -6,7 +6,7 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/funct Gnulib module: fclose, fflush -Portability problems fixed by Gnulib module @code{fflush}: +Portability problems fixed by Gnulib module @code{fclose} together with module @code{fflush}: @itemize @item On some platforms, this function fails to set the file position of a diff --git a/m4/fclose.m4 b/m4/fclose.m4 index 278859c6c2..17acf1547a 100644 --- a/m4/fclose.m4 +++ b/m4/fclose.m4 @@ -1,4 +1,4 @@ -# fclose.m4 serial 2 +# fclose.m4 serial 3 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,6 +6,12 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FCLOSE], [ + m4_ifdef([gl_FUNC_FFLUSH_STDIN], [ + gl_FUNC_FFLUSH_STDIN + if test $gl_cv_func_fflush_stdin = no; then + gl_REPLACE_FCLOSE + fi + ]) ]) AC_DEFUN([gl_REPLACE_FCLOSE], diff --git a/m4/fflush.m4 b/m4/fflush.m4 index 29ef61394d..69eb86efe1 100644 --- a/m4/fflush.m4 +++ b/m4/fflush.m4 @@ -1,4 +1,4 @@ -# fflush.m4 serial 10 +# fflush.m4 serial 11 # Copyright (C) 2007-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -15,7 +15,6 @@ AC_DEFUN([gl_FUNC_FFLUSH], gl_FUNC_FFLUSH_STDIN if test $gl_cv_func_fflush_stdin = no; then gl_REPLACE_FFLUSH - gl_REPLACE_FCLOSE fi ]) diff --git a/modules/fflush b/modules/fflush index 501431f9d7..f1d696bd3d 100644 --- a/modules/fflush +++ b/modules/fflush @@ -8,7 +8,6 @@ m4/fflush.m4 Depends-on: stdio -fclose fpurge [test $REPLACE_FFLUSH = 1] ftello [test $REPLACE_FFLUSH = 1] freading [test $REPLACE_FFLUSH = 1] -- cgit v1.2.1 From 8b401988f8558104b56c0ee36a4e75b1230ad371 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 5 May 2011 22:43:18 -0700 Subject: assert-h: new module, which supports C1X-style static_assert * lib/assert.in.h, m4/assert_h.m4, modules/assert-h: New files. * lib/verify.h: Revamp so that this can be copied into assert.h, while retaining the ability to use it standalone as before. Rename private identifiers so as not to encroach on the standard C namespace, since this is now used by assert.h. (_GL_VERIFY_TYPE): New macro, factoring out differing parts of the old verify_true. (_GL_VERIFY_TRUE): New macro, with much of the contents of the old verify_true. Use _GL_VERIFY_TYPE. (_GL_VERIFY): New macro, with much of the contents of the old verify. (static_assert): New macro, if _GL_STATIC_ASSERT_H is defined and static_assert is not; _GL_STATIC_ASSERT_H is defined when this file is copied into the replacement assert.h. (_Static_assert): New macro, if _GL_STATIC_ASSERT_H is defined and _Static_assert is not built in. (verify_true, verify): Define only if _GL_STATIC_ASSERT_H is not defined, and use the new macros mentioned above. * doc/posix-headers/assert.texi: Document this. --- ChangeLog | 22 +++++++ doc/posix-headers/assert.texi | 21 ++++++- lib/assert.in.h | 28 +++++++++ lib/verify.h | 130 +++++++++++++++++++++++++----------------- m4/assert_h.m4 | 29 ++++++++++ modules/assert-h | 47 +++++++++++++++ 6 files changed, 225 insertions(+), 52 deletions(-) create mode 100644 lib/assert.in.h create mode 100644 m4/assert_h.m4 create mode 100644 modules/assert-h diff --git a/ChangeLog b/ChangeLog index 3c60a4e8ee..b57e17beac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2011-05-05 Paul Eggert + + assert-h: new module, which supports C1X-style static_assert + * lib/assert.in.h, m4/assert_h.m4, modules/assert-h: New files. + * lib/verify.h: Revamp so that this can be copied into assert.h, + while retaining the ability to use it standalone as before. + Rename private identifiers so as not to encroach on the + standard C namespace, since this is now used by assert.h. + (_GL_VERIFY_TYPE): New macro, factoring out differing parts of + the old verify_true. + (_GL_VERIFY_TRUE): New macro, with much of the contents of + the old verify_true. Use _GL_VERIFY_TYPE. + (_GL_VERIFY): New macro, with much of the contents of the old verify. + (static_assert): New macro, if _GL_STATIC_ASSERT_H + is defined and static_assert is not; _GL_STATIC_ASSERT_H is + defined when this file is copied into the replacement assert.h. + (_Static_assert): New macro, if _GL_STATIC_ASSERT_H is defined + and _Static_assert is not built in. + (verify_true, verify): Define only if _GL_STATIC_ASSERT_H is not + defined, and use the new macros mentioned above. + * doc/posix-headers/assert.texi: Document this. + 2011-05-05 Bruno Haible fclose, fflush: Respect rules for use of AC_LIBOBJ. diff --git a/doc/posix-headers/assert.texi b/doc/posix-headers/assert.texi index 02a1c3b547..aa78ee7bc5 100644 --- a/doc/posix-headers/assert.texi +++ b/doc/posix-headers/assert.texi @@ -3,12 +3,31 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html} -Gnulib module: --- +Gnulib module: assert-h + +See also the Gnulib module @code{assert}. Portability problems fixed by Gnulib: @itemize +@item +The draft C1X and C++0X @code{static_assert}, and the draft C1X +@code{_Static_assert}, are not supported by many platforms. +For example, GCC versions before 4.6.0 do not support @code{_Static_assert}, +and G++ versions through at least 4.6.0 do not support @code{static_assert}. @end itemize Portability problems not fixed by Gnulib: @itemize +@item +Draft C1X @code{_Static_assert} and draft C++0X @code{static_assert} +are keywords that can be used without including @code{}. +The Gnulib substitutes are macros that require including @code{}. +@item +The draft C1X @code{static_assert} and @code{_Static_assert} can also +be used within a @code{struct} or @code{union} specifier, in place of +an ordinary declaration of a member of the struct or union. The +Gnulib substitute can be used only as an ordinary declaration. +@item +In C99, @code{assert} can be applied to any scalar expression. +In C89, the argument to @code{assert} is of type @code{int}. @end itemize diff --git a/lib/assert.in.h b/lib/assert.in.h new file mode 100644 index 0000000000..1857cebbbb --- /dev/null +++ b/lib/assert.in.h @@ -0,0 +1,28 @@ +/* Substitute for and wrapper around + Copyright (C) 2011 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, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Do not guard the include, since is supposed to define + the assert macro each time it is included. */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#@INCLUDE_NEXT@ @NEXT_ASSERT_H@ + +/* The definition of static_assert is copied here. */ diff --git a/lib/verify.h b/lib/verify.h index 6bca43f6a9..e5065ffa00 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -17,42 +17,37 @@ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ -#ifndef VERIFY_H -# define VERIFY_H 1 +#ifndef _GL_VERIFY_H +# define _GL_VERIFY_H -/* Define HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the + +/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and later, in C mode, and its use here generates easier-to-read diagnostics when verify (R) fails. - Define HAVE_STATIC_ASSERT to 1 if static_assert works as per the - C1X draft N1548 section 7.2 or the C++0X draft N3242 section 7.(4). + Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the + C++0X draft N3242 section 7.(4). This will likely be supported by future GCC versions, in C++ mode. - For now, use this only with GCC. Eventually whether _Static_assert - and static_assert works should be determined by 'configure'. */ + Use this only with GCC. If we were willing to slow 'configure' + down we could also use it with other compilers, but since this + affects only the quality of diagnostics, why bother? */ # if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus -# define HAVE__STATIC_ASSERT 1 +# define _GL_HAVE__STATIC_ASSERT 1 # endif /* The condition (99 < __GNUC__) is temporary, until we know about the first G++ release that supports static_assert. */ # if (99 < __GNUC__) && defined __cplusplus -# define HAVE_STATIC_ASSERT 1 +# define _GL_HAVE_STATIC_ASSERT 1 # endif /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. - There are two macros, since no single macro can be used in all - contexts in C. verify_true (R) is for scalar contexts, including - integer constant expression contexts. verify (R) is for declaration - contexts, e.g., the top level. - - Symbols ending in "__" are private to this header. - If _Static_assert works, verify (R) uses it directly. Similarly, - verify_true (R) works by packaging a _Static_assert inside a struct + _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct that is an operand of sizeof. The code below uses several ideas for C++ compilers, and for C @@ -64,7 +59,9 @@ constant and nonnegative. * Next this expression W is wrapped in a type - struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: W; + }. If W is negative, this yields a compile-time error. No compiler can deal with a bit-field of negative size. @@ -78,7 +75,7 @@ void function (int n) { verify (n < 0); } - * For the verify macro, the struct verify_type__ will need to + * For the verify macro, the struct _gl_verify_type will need to somehow be embedded into a declaration. To be portable, this declaration must declare an object, a constant, a function, or a typedef name. If the declared entity uses the type directly, @@ -116,11 +113,11 @@ Which of the following alternatives can be used? extern int dummy [sizeof (struct {...})]; - extern int dummy [sizeof (struct verify_type__ {...})]; + extern int dummy [sizeof (struct _gl_verify_type {...})]; extern void dummy (int [sizeof (struct {...})]); - extern void dummy (int [sizeof (struct verify_type__ {...})]); + extern void dummy (int [sizeof (struct _gl_verify_type {...})]); extern int (*dummy (void)) [sizeof (struct {...})]; - extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; + extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})]; In the second and sixth case, the struct type is exported to the outer scope; two such declarations therefore collide. GCC warns @@ -159,44 +156,75 @@ possible. */ # define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) -/* Verify requirement R at compile-time, as an integer constant expression. - Return 1. */ +/* Verify requirement R at compile-time, as an integer constant expression + that returns 1. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. */ + +# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ + (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) # ifdef __cplusplus template - struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; -# define verify_true(R) \ - (!!sizeof (verify_type__<(R) ? 1 : -1>)) -# elif HAVE__STATIC_ASSERT -# define verify_true(R) \ - (!!sizeof \ - (struct { \ - _Static_assert (R, "verify_true (" #R ")"); \ - int verify_dummy__; \ - })) -# elif HAVE_STATIC_ASSERT -# define verify_true(R) \ - (!!sizeof \ - (struct { \ - static_assert (R, "verify_true (" #R ")"); \ - int verify_dummy__; \ - })) + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: w; + }; +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + _gl_verify_type<(R) ? 1 : -1> +# elif defined _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { \ + _Static_assert (R, DIAGNOSTIC); \ + int _gl_dummy; \ + } # else -# define verify_true(R) \ - (!!sizeof \ - (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } # endif /* Verify requirement R at compile-time, as a declaration without a - trailing ';'. */ + trailing ';'. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. + + Unfortunately, unlike C1X, this implementation must appear as an + ordinary declaration, and cannot appear inside struct { ... }. */ + +# ifdef _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY _Static_assert +# else +# define _GL_VERIFY(R, DIAGNOSTIC) \ + extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ + [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] +# endif -# if HAVE__STATIC_ASSERT -# define verify(R) _Static_assert (R, "verify (" #R ")") -# elif HAVE_STATIC_ASSERT -# define verify(R) static_assert (R, "verify (" #R ")") +/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ +# ifdef _GL_STATIC_ASSERT_H +# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert +# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC) +# endif +# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert +# define static_assert _Static_assert /* Draft C1X requires this #define. */ +# endif # else -# define verify(R) \ - extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)] + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_true (R) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. */ + +/* Verify requirement R at compile-time, as an integer constant expression. + Return 1. */ + +# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")") + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. */ + +# define verify(R) _GL_VERIFY (R, "verify (" #R ")") + # endif #endif diff --git a/m4/assert_h.m4 b/m4/assert_h.m4 new file mode 100644 index 0000000000..30ca248949 --- /dev/null +++ b/m4/assert_h.m4 @@ -0,0 +1,29 @@ +# assert-h.m4 +dnl Copyright (C) 2011 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 Paul Eggert. + +AC_DEFUN([gl_ASSERT_H], +[ + ASSERT_H= + AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + static_assert (2 + 2 == 4, "arithmetic doesn't work"); + ]], + [[ + static_assert (sizeof (char) == 1, "sizeof doesn't work"); + ]])], + [gl_cv_static_assert=yes], + [gl_cv_static_assert=no])]) + if test $gl_cv_static_assert = no; then + ASSERT_H=assert.h + gl_NEXT_HEADERS([assert.h]) + fi + AC_SUBST([ASSERT_H]) + AM_CONDITIONAL([GL_GENERATE_ASSERT_H], [test -n "$ASSERT_H"]) +]) diff --git a/modules/assert-h b/modules/assert-h new file mode 100644 index 0000000000..50bd9f83e1 --- /dev/null +++ b/modules/assert-h @@ -0,0 +1,47 @@ +Description: +An that conforms to C1X. + +Files: +lib/assert.in.h +lib/verify.h +m4/assert_h.m4 + +Depends-on: +include_next + +configure.ac: +gl_ASSERT_H + +Makefile.am: +BUILT_SOURCES += $(ASSERT_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +if GL_GENERATE_ASSERT_H +assert.h: assert.in.h verify.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_ASSERT_H''@|$(NEXT_ASSERT_H)|g' \ + < $(srcdir)/assert.in.h && \ + sed -e 's|_gl_verify|_gl_static_assert|g' \ + -e 's|_GL_VERIFY|_GL_STATIC_ASSERT|g' \ + < $(srcdir)/verify.h; \ + } > $@-t && \ + mv $@-t $@ +else +assert.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += assert.h assert.h-t + +Include: + + +License: +LGPLv2+ + +Maintainer: +Paul Eggert -- cgit v1.2.1 From d801cb77b966678e21af7a106b15a3fe598d5ec4 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 6 May 2011 08:09:21 +0200 Subject: maint.mk: use info-gnu@ as the default only for a stable release * top/maint.mk: Don't default to info-gnu for alpha or beta releases. For those, just use $(PACKAGE_BUGREPORT), in which case we don't have to set the Mail-Followup-To header. Prompted by Reuben Thomas in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/26488 --- ChangeLog | 8 ++++++++ top/maint.mk | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b57e17beac..e314196150 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-05-06 Jim Meyering + + maint.mk: use info-gnu@ as the default only for a stable release + * top/maint.mk: Don't default to info-gnu for alpha or beta releases. + For those, just use $(PACKAGE_BUGREPORT), in which case we don't have + to set the Mail-Followup-To header. Prompted by Reuben Thomas in + http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/26488 + 2011-05-05 Paul Eggert assert-h: new module, which supports C1X-style static_assert diff --git a/top/maint.mk b/top/maint.mk index 8727b3f4c8..07efceca13 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -1123,11 +1123,20 @@ gpg_key_ID ?= \ | sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig) translation_project_ ?= coordinator@translationproject.org -announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT) -announcement_mail_headers_ ?= \ -To: info-gnu@gnu.org \ -Cc: $(announcement_Cc_) \ -Mail-Followup-To: $(PACKAGE_BUGREPORT) + +# Make info-gnu the default only for a stable release. +ifeq ($(RELEASE_TYPE),stable) + announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT) + announcement_mail_headers_ ?= \ + To: info-gnu@gnu.org \ + Cc: $(announcement_Cc_) \ + Mail-Followup-To: $(PACKAGE_BUGREPORT) +else + announcement_Cc_ ?= $(translation_project_) + announcement_mail_headers_ ?= \ + To: $(PACKAGE_BUGREPORT) \ + Cc: $(announcement_Cc_) +endif announcement: NEWS ChangeLog $(rel-files) @$(build_aux)/announce-gen \ -- cgit v1.2.1