Merge branch 'stable'
authorIan Beckwith <ianb@erislabs.net>
Mon, 8 Mar 2010 06:09:19 +0000 (06:09 +0000)
committerIan Beckwith <ianb@erislabs.net>
Mon, 8 Mar 2010 06:09:19 +0000 (06:09 +0000)
810 files changed:
ChangeLog
MODULES.html.sh
NEWS
NEWS.stable
build-aux/bootstrap
build-aux/config.sub
build-aux/elisp-comp
build-aux/gendocs.sh
build-aux/git-version-gen
build-aux/gnupload
build-aux/install-sh
build-aux/mdate-sh
build-aux/ncftpput-ftp
build-aux/texinfo.tex
build-aux/vc-list-files
build-aux/warn-on-use.h [new file with mode: 0644]
doc/glibc-functions/euidaccess.texi
doc/gnulib-tool.texi
doc/gnulib.texi
doc/maintain.texi
doc/make-stds.texi
doc/posix-functions/access.texi
doc/posix-functions/acos.texi
doc/posix-functions/acosl.texi
doc/posix-functions/asin.texi
doc/posix-functions/asinl.texi
doc/posix-functions/atan.texi
doc/posix-functions/atan2.texi
doc/posix-functions/atanl.texi
doc/posix-functions/cbrt.texi
doc/posix-functions/copysign.texi
doc/posix-functions/cos.texi
doc/posix-functions/cosh.texi
doc/posix-functions/cosl.texi
doc/posix-functions/erf.texi
doc/posix-functions/erfc.texi
doc/posix-functions/exit.texi
doc/posix-functions/exp.texi
doc/posix-functions/expl.texi
doc/posix-functions/fabs.texi
doc/posix-functions/faccessat.texi
doc/posix-functions/fmod.texi
doc/posix-functions/getdelim.texi
doc/posix-functions/getline.texi
doc/posix-functions/getlogin.texi
doc/posix-functions/gettimeofday.texi
doc/posix-functions/hypot.texi
doc/posix-functions/j0.texi
doc/posix-functions/j1.texi
doc/posix-functions/jn.texi
doc/posix-functions/ldexp.texi
doc/posix-functions/lgamma.texi
doc/posix-functions/log.texi
doc/posix-functions/log10.texi
doc/posix-functions/log1p.texi
doc/posix-functions/logb.texi
doc/posix-functions/logl.texi
doc/posix-functions/modf.texi
doc/posix-functions/nextafter.texi
doc/posix-functions/pow.texi
doc/posix-functions/remainder.texi
doc/posix-functions/rint.texi
doc/posix-functions/sin.texi
doc/posix-functions/sinh.texi
doc/posix-functions/sinl.texi
doc/posix-functions/sqrt.texi
doc/posix-functions/sqrtl.texi
doc/posix-functions/tan.texi
doc/posix-functions/tanh.texi
doc/posix-functions/tanl.texi
doc/posix-functions/y0.texi
doc/posix-functions/y1.texi
doc/posix-functions/yn.texi
doc/posix-headers/netdb.texi
doc/standards.texi
gnulib-tool
lib/argp-fmtstream.h
lib/argp-parse.c
lib/argp.h
lib/arpa_inet.in.h
lib/copy-acl.c
lib/cosl.c
lib/ctype.in.h
lib/dirent.in.h
lib/error.h
lib/euidaccess.c
lib/fcntl.in.h
lib/fnmatch_loop.c
lib/fts.c
lib/getdate.y
lib/getlogin.c [new file with mode: 0644]
lib/gettimeofday.c
lib/getugroups.c
lib/hash-triple.c
lib/inttypes.in.h
lib/langinfo.in.h
lib/locale.in.h
lib/math.in.h
lib/memcmp.c
lib/mountlist.c
lib/netdb.in.h
lib/nproc.c
lib/readtokens.c
lib/regcomp.c
lib/regex_internal.c
lib/regex_internal.h
lib/regexec.c
lib/search.in.h
lib/set-mode-acl.c
lib/signal.in.h
lib/sincosl.c
lib/sinl.c
lib/spawn.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/striconv.c
lib/string.in.h
lib/strings.in.h
lib/sys_file.in.h
lib/sys_ioctl.in.h
lib/sys_select.in.h
lib/sys_socket.in.h
lib/sys_stat.in.h
lib/sys_time.in.h
lib/sys_times.in.h
lib/sys_utsname.in.h
lib/tanl.c
lib/trigl.c
lib/trim.h
lib/unistd.in.h
lib/unistr.h
lib/unistr/u-stpncpy.h
lib/unistr/u-strcoll.h
lib/unistr/u16-mbsnlen.c
lib/unistr/u8-mbsnlen.c
lib/utimecmp.c
lib/vasnprintf.h
lib/wchar.in.h
lib/xprintf.h
lib/xstrtol.h
lib/xstrtoll.c [new file with mode: 0644]
lib/xstrtoull.c [new file with mode: 0644]
lib/xvasprintf.h
m4/acosl.m4 [new file with mode: 0644]
m4/arpa_inet_h.m4
m4/asinl.m4 [new file with mode: 0644]
m4/atanl.m4 [new file with mode: 0644]
m4/cosl.m4 [new file with mode: 0644]
m4/ctype.m4
m4/dirent_h.m4
m4/exitfail.m4 [deleted file]
m4/expl.m4 [new file with mode: 0644]
m4/fcntl_h.m4
m4/gc.m4
m4/getdelim.m4
m4/getline.m4
m4/getlogin.m4 [new file with mode: 0644]
m4/gettimeofday.m4
m4/gnulib-common.m4
m4/inttypes.m4
m4/isnan.m4
m4/langinfo_h.m4
m4/locale_h.m4
m4/logl.m4 [new file with mode: 0644]
m4/lseek.m4
m4/math_h.m4
m4/mathfunc.m4 [new file with mode: 0644]
m4/mathl.m4 [deleted file]
m4/obstack-printf-posix.m4
m4/obstack-printf.m4
m4/regex.m4
m4/round.m4
m4/roundf.m4
m4/roundl.m4
m4/search_h.m4
m4/signal_h.m4
m4/sinl.m4 [new file with mode: 0644]
m4/spawn_h.m4
m4/sqrt.m4 [new file with mode: 0644]
m4/sqrtl.m4 [new file with mode: 0644]
m4/stdio_h.m4
m4/stdlib_h.m4
m4/string_h.m4
m4/strings_h.m4
m4/sys_file_h.m4
m4/sys_ioctl_h.m4
m4/sys_select_h.m4
m4/sys_socket_h.m4
m4/sys_stat_h.m4
m4/sys_time_h.m4
m4/sys_times_h.m4
m4/sys_utsname_h.m4
m4/tanl.m4 [new file with mode: 0644]
m4/unistd_h.m4
m4/warn-on-use.m4 [new file with mode: 0644]
m4/warnings.m4
m4/wchar.m4
modules/acl-tests
modules/acos [new file with mode: 0644]
modules/acos-tests [new file with mode: 0644]
modules/acosl [new file with mode: 0644]
modules/acosl-tests [new file with mode: 0644]
modules/areadlink-tests
modules/areadlink-with-size-tests
modules/areadlinkat-tests
modules/areadlinkat-with-size-tests
modules/argp-tests
modules/argp-version-etc-tests
modules/arpa_inet
modules/asin [new file with mode: 0644]
modules/asin-tests [new file with mode: 0644]
modules/asinl [new file with mode: 0644]
modules/asinl-tests [new file with mode: 0644]
modules/atan [new file with mode: 0644]
modules/atan-tests [new file with mode: 0644]
modules/atan2 [new file with mode: 0644]
modules/atan2-tests [new file with mode: 0644]
modules/atanl [new file with mode: 0644]
modules/atanl-tests [new file with mode: 0644]
modules/atexit-tests
modules/binary-io-tests
modules/btowc-tests
modules/c-stack-tests
modules/c-strcase-tests
modules/canonicalize-lgpl-tests
modules/canonicalize-tests
modules/cbrt [new file with mode: 0644]
modules/cbrt-tests [new file with mode: 0644]
modules/chown-tests
modules/closein-tests
modules/copy-file-tests
modules/copysign [new file with mode: 0644]
modules/copysign-tests [new file with mode: 0644]
modules/cos [new file with mode: 0644]
modules/cos-tests [new file with mode: 0644]
modules/cosh [new file with mode: 0644]
modules/cosh-tests [new file with mode: 0644]
modules/cosl [new file with mode: 0644]
modules/cosl-tests [new file with mode: 0644]
modules/ctype
modules/dirent
modules/dirent-safer-tests
modules/dprintf-posix-tests
modules/erf [new file with mode: 0644]
modules/erf-tests [new file with mode: 0644]
modules/erfc [new file with mode: 0644]
modules/erfc-tests [new file with mode: 0644]
modules/euidaccess
modules/exclude-tests
modules/exit
modules/exitfail
modules/exp [new file with mode: 0644]
modules/exp-tests [new file with mode: 0644]
modules/expl [new file with mode: 0644]
modules/expl-tests [new file with mode: 0644]
modules/fabs [new file with mode: 0644]
modules/fabs-tests [new file with mode: 0644]
modules/fcntl
modules/fcntl-h
modules/fdutimensat-tests
modules/fflush-tests
modules/fmod [new file with mode: 0644]
modules/fmod-tests [new file with mode: 0644]
modules/fpending-tests
modules/fprintf-posix-tests
modules/freadahead-tests
modules/freadptr-tests
modules/freadseek-tests
modules/fseek-tests
modules/fseeko-tests
modules/ftell-tests
modules/ftello-tests
modules/futimens-tests
modules/getlogin [new file with mode: 0644]
modules/getlogin-tests [new file with mode: 0644]
modules/gettimeofday
modules/git-merge-changelog
modules/hypot [new file with mode: 0644]
modules/hypot-tests [new file with mode: 0644]
modules/idpriv-drop-tests
modules/idpriv-droptemp-tests
modules/ignore-value
modules/inttypes
modules/j0 [new file with mode: 0644]
modules/j0-tests [new file with mode: 0644]
modules/j1 [new file with mode: 0644]
modules/j1-tests [new file with mode: 0644]
modules/jn [new file with mode: 0644]
modules/jn-tests [new file with mode: 0644]
modules/langinfo
modules/lchown-tests
modules/ldexp [new file with mode: 0644]
modules/ldexp-tests [new file with mode: 0644]
modules/lgamma [new file with mode: 0644]
modules/lgamma-tests [new file with mode: 0644]
modules/lib-ignore
modules/link-tests
modules/linkat-tests
modules/locale
modules/log [new file with mode: 0644]
modules/log-tests [new file with mode: 0644]
modules/log10 [new file with mode: 0644]
modules/log10-tests [new file with mode: 0644]
modules/log1p [new file with mode: 0644]
modules/log1p-tests [new file with mode: 0644]
modules/logb [new file with mode: 0644]
modules/logb-tests [new file with mode: 0644]
modules/logl [new file with mode: 0644]
modules/logl-tests [new file with mode: 0644]
modules/lseek-tests
modules/lstat-tests
modules/maintainer-makefile
modules/math
modules/mathl
modules/mbmemcasecmp-tests
modules/mbmemcasecoll-tests
modules/mbrtowc-tests
modules/mbscasecmp-tests
modules/mbscasestr-tests
modules/mbschr-tests
modules/mbscspn-tests
modules/mbsinit-tests
modules/mbsncasecmp-tests
modules/mbsnrtowcs-tests
modules/mbspbrk-tests
modules/mbspcasecmp-tests
modules/mbsrchr-tests
modules/mbsrtowcs-tests
modules/mbsspn-tests
modules/mbsstr-tests
modules/mkdir-tests
modules/mkfifo-tests
modules/mkfifoat-tests
modules/mknod-tests
modules/modf [new file with mode: 0644]
modules/modf-tests [new file with mode: 0644]
modules/nextafter [new file with mode: 0644]
modules/nextafter-tests [new file with mode: 0644]
modules/nl_langinfo
modules/nl_langinfo-tests
modules/openat-tests
modules/parse-duration-tests
modules/perror-tests
modules/pipe-filter-gi-tests
modules/pipe-filter-ii-tests
modules/pipe-tests
modules/poll-tests
modules/pow [new file with mode: 0644]
modules/pow-tests [new file with mode: 0644]
modules/pread-tests
modules/printf-posix-tests
modules/quotearg-tests
modules/readlink-tests
modules/regex
modules/remainder [new file with mode: 0644]
modules/remainder-tests [new file with mode: 0644]
modules/remove-tests
modules/rename-tests
modules/renameat-tests
modules/rint [new file with mode: 0644]
modules/rint-tests [new file with mode: 0644]
modules/rmdir-tests
modules/search
modules/select-tests
modules/signal
modules/sigpipe-tests
modules/sin [new file with mode: 0644]
modules/sin-tests [new file with mode: 0644]
modules/sinh [new file with mode: 0644]
modules/sinh-tests [new file with mode: 0644]
modules/sinl [new file with mode: 0644]
modules/sinl-tests [new file with mode: 0644]
modules/spawn
modules/sqrt [new file with mode: 0644]
modules/sqrt-tests [new file with mode: 0644]
modules/sqrtl [new file with mode: 0644]
modules/sqrtl-tests [new file with mode: 0644]
modules/stdio
modules/stdlib
modules/string
modules/strings
modules/strsignal-tests
modules/symlink-tests
modules/symlinkat-tests
modules/sys_file
modules/sys_ioctl
modules/sys_select
modules/sys_socket
modules/sys_stat
modules/sys_time
modules/sys_times
modules/sys_utsname
modules/tan [new file with mode: 0644]
modules/tan-tests [new file with mode: 0644]
modules/tanh [new file with mode: 0644]
modules/tanh-tests [new file with mode: 0644]
modules/tanl [new file with mode: 0644]
modules/tanl-tests [new file with mode: 0644]
modules/tsearch-tests
modules/unicase/locale-language-tests
modules/unicase/ulc-casecmp-tests
modules/unicase/ulc-casecoll-tests
modules/unictype/category-byname-tests
modules/uniname/uniname-tests
modules/unistd
modules/unistdio/u16-sprintf
modules/unistdio/u16-u16-sprintf
modules/unistdio/u16-vasnprintf-tests
modules/unistdio/u32-sprintf
modules/unistdio/u32-u32-sprintf
modules/unistdio/u32-vasnprintf-tests
modules/unistdio/u8-sprintf
modules/unistdio/u8-u8-sprintf
modules/unistdio/u8-vasnprintf-tests
modules/unistdio/ulc-sprintf
modules/unistdio/ulc-vasnprintf-tests
modules/unistr/u16-check-tests [new file with mode: 0644]
modules/unistr/u16-chr-tests [new file with mode: 0644]
modules/unistr/u16-cmp-tests [new file with mode: 0644]
modules/unistr/u16-cmp2-tests [new file with mode: 0644]
modules/unistr/u16-cpy-alloc-tests [new file with mode: 0644]
modules/unistr/u16-cpy-tests [new file with mode: 0644]
modules/unistr/u16-mblen-tests [new file with mode: 0644]
modules/unistr/u16-mbsnlen
modules/unistr/u16-mbsnlen-tests [new file with mode: 0644]
modules/unistr/u16-mbtouc-tests [new file with mode: 0644]
modules/unistr/u16-mbtouc-unsafe-tests [new file with mode: 0644]
modules/unistr/u16-mbtoucr-tests [new file with mode: 0644]
modules/unistr/u16-move-tests [new file with mode: 0644]
modules/unistr/u16-next
modules/unistr/u16-next-tests [new file with mode: 0644]
modules/unistr/u16-prev-tests [new file with mode: 0644]
modules/unistr/u16-set-tests [new file with mode: 0644]
modules/unistr/u16-stpcpy-tests [new file with mode: 0644]
modules/unistr/u16-stpncpy-tests [new file with mode: 0644]
modules/unistr/u16-strcat-tests [new file with mode: 0644]
modules/unistr/u16-strcmp-tests [new file with mode: 0644]
modules/unistr/u16-strcoll-tests [new file with mode: 0644]
modules/unistr/u16-strcpy-tests [new file with mode: 0644]
modules/unistr/u16-strdup-tests [new file with mode: 0644]
modules/unistr/u16-strlen-tests [new file with mode: 0644]
modules/unistr/u16-strmblen-tests [new file with mode: 0644]
modules/unistr/u16-strmbtouc-tests [new file with mode: 0644]
modules/unistr/u16-strncat-tests [new file with mode: 0644]
modules/unistr/u16-strncmp-tests [new file with mode: 0644]
modules/unistr/u16-strncpy-tests [new file with mode: 0644]
modules/unistr/u16-strnlen-tests [new file with mode: 0644]
modules/unistr/u16-to-u32-tests [new file with mode: 0644]
modules/unistr/u16-to-u8-tests [new file with mode: 0644]
modules/unistr/u16-uctomb-tests [new file with mode: 0644]
modules/unistr/u32-check-tests [new file with mode: 0644]
modules/unistr/u32-chr-tests [new file with mode: 0644]
modules/unistr/u32-cmp-tests [new file with mode: 0644]
modules/unistr/u32-cmp2-tests [new file with mode: 0644]
modules/unistr/u32-cpy-alloc-tests [new file with mode: 0644]
modules/unistr/u32-cpy-tests [new file with mode: 0644]
modules/unistr/u32-mblen-tests [new file with mode: 0644]
modules/unistr/u32-mbsnlen-tests [new file with mode: 0644]
modules/unistr/u32-mbtouc-tests [new file with mode: 0644]
modules/unistr/u32-mbtouc-unsafe-tests [new file with mode: 0644]
modules/unistr/u32-mbtoucr-tests [new file with mode: 0644]
modules/unistr/u32-move-tests [new file with mode: 0644]
modules/unistr/u32-next
modules/unistr/u32-next-tests [new file with mode: 0644]
modules/unistr/u32-prev-tests [new file with mode: 0644]
modules/unistr/u32-set-tests [new file with mode: 0644]
modules/unistr/u32-stpcpy-tests [new file with mode: 0644]
modules/unistr/u32-stpncpy-tests [new file with mode: 0644]
modules/unistr/u32-strcat-tests [new file with mode: 0644]
modules/unistr/u32-strcmp-tests [new file with mode: 0644]
modules/unistr/u32-strcoll-tests [new file with mode: 0644]
modules/unistr/u32-strcpy-tests [new file with mode: 0644]
modules/unistr/u32-strdup-tests [new file with mode: 0644]
modules/unistr/u32-strlen-tests [new file with mode: 0644]
modules/unistr/u32-strmblen-tests [new file with mode: 0644]
modules/unistr/u32-strmbtouc-tests [new file with mode: 0644]
modules/unistr/u32-strncat-tests [new file with mode: 0644]
modules/unistr/u32-strncmp-tests [new file with mode: 0644]
modules/unistr/u32-strncpy-tests [new file with mode: 0644]
modules/unistr/u32-strnlen-tests [new file with mode: 0644]
modules/unistr/u32-to-u16-tests [new file with mode: 0644]
modules/unistr/u32-to-u8-tests [new file with mode: 0644]
modules/unistr/u32-uctomb-tests [new file with mode: 0644]
modules/unistr/u8-check-tests [new file with mode: 0644]
modules/unistr/u8-chr-tests [new file with mode: 0644]
modules/unistr/u8-cmp-tests [new file with mode: 0644]
modules/unistr/u8-cmp2-tests [new file with mode: 0644]
modules/unistr/u8-cpy-alloc-tests [new file with mode: 0644]
modules/unistr/u8-cpy-tests [new file with mode: 0644]
modules/unistr/u8-mblen-tests [new file with mode: 0644]
modules/unistr/u8-mbsnlen
modules/unistr/u8-mbsnlen-tests [new file with mode: 0644]
modules/unistr/u8-mbtouc-tests [new file with mode: 0644]
modules/unistr/u8-mbtouc-unsafe-tests [new file with mode: 0644]
modules/unistr/u8-mbtoucr-tests [new file with mode: 0644]
modules/unistr/u8-move-tests [new file with mode: 0644]
modules/unistr/u8-next
modules/unistr/u8-next-tests [new file with mode: 0644]
modules/unistr/u8-prev-tests [new file with mode: 0644]
modules/unistr/u8-set-tests [new file with mode: 0644]
modules/unistr/u8-stpcpy-tests [new file with mode: 0644]
modules/unistr/u8-stpncpy-tests [new file with mode: 0644]
modules/unistr/u8-strcat-tests [new file with mode: 0644]
modules/unistr/u8-strcmp-tests [new file with mode: 0644]
modules/unistr/u8-strcoll-tests [new file with mode: 0644]
modules/unistr/u8-strcpy-tests [new file with mode: 0644]
modules/unistr/u8-strdup-tests [new file with mode: 0644]
modules/unistr/u8-strlen-tests [new file with mode: 0644]
modules/unistr/u8-strmblen-tests [new file with mode: 0644]
modules/unistr/u8-strmbtouc-tests [new file with mode: 0644]
modules/unistr/u8-strncat-tests [new file with mode: 0644]
modules/unistr/u8-strncmp-tests [new file with mode: 0644]
modules/unistr/u8-strncpy-tests [new file with mode: 0644]
modules/unistr/u8-strnlen-tests [new file with mode: 0644]
modules/unistr/u8-to-u16-tests [new file with mode: 0644]
modules/unistr/u8-to-u32-tests [new file with mode: 0644]
modules/unistr/u8-uctomb-tests [new file with mode: 0644]
modules/uniwbrk/ulc-wordbreaks-tests
modules/uniwidth/width-tests
modules/unlink-tests
modules/userspec-tests [new file with mode: 0644]
modules/utimens-tests
modules/utimensat-tests
modules/vasnprintf-posix-tests
modules/vdprintf-posix-tests
modules/version-etc-tests
modules/vfprintf-posix-tests
modules/vprintf-posix-tests
modules/warn-on-use [new file with mode: 0644]
modules/wchar
modules/wcrtomb-tests
modules/wcsnrtombs-tests
modules/wcsrtombs-tests
modules/xalloc-die-tests
modules/xprintf-posix-tests
modules/xstrtoimax-tests
modules/xstrtol-tests
modules/xstrtoll [new file with mode: 0644]
modules/xstrtoll-tests [new file with mode: 0644]
modules/xstrtoumax-tests
modules/y0 [new file with mode: 0644]
modules/y0-tests [new file with mode: 0644]
modules/y1 [new file with mode: 0644]
modules/y1-tests [new file with mode: 0644]
modules/yesno-tests
modules/yn [new file with mode: 0644]
modules/yn-tests [new file with mode: 0644]
tests/init.sh
tests/test-acos.c [new file with mode: 0644]
tests/test-acosl.c [new file with mode: 0644]
tests/test-arcfour.c
tests/test-arctwo.c
tests/test-areadlink-with-size.c
tests/test-areadlink.c
tests/test-areadlinkat-with-size.c
tests/test-areadlinkat.c
tests/test-argp-2.sh
tests/test-argp.c
tests/test-argv-iter.c
tests/test-asin.c [new file with mode: 0644]
tests/test-asinl.c [new file with mode: 0644]
tests/test-atan.c [new file with mode: 0644]
tests/test-atan2.c [new file with mode: 0644]
tests/test-atanl.c [new file with mode: 0644]
tests/test-canonicalize-lgpl.c
tests/test-canonicalize.c
tests/test-cbrt.c [new file with mode: 0644]
tests/test-chown.c
tests/test-closein.c
tests/test-cond.c
tests/test-copysign.c [new file with mode: 0644]
tests/test-cos.c [new file with mode: 0644]
tests/test-cosh.c [new file with mode: 0644]
tests/test-cosl.c [new file with mode: 0644]
tests/test-count-one-bits.c
tests/test-crc.c
tests/test-des.c
tests/test-erf.c [new file with mode: 0644]
tests/test-erfc.c [new file with mode: 0644]
tests/test-exp.c [new file with mode: 0644]
tests/test-expl.c [new file with mode: 0644]
tests/test-fabs.c [new file with mode: 0644]
tests/test-fchownat.c
tests/test-fdutimensat.c
tests/test-fflush.c
tests/test-fmod.c [new file with mode: 0644]
tests/test-fpurge.c
tests/test-freadable.c
tests/test-freading.c
tests/test-fseek.c
tests/test-fseeko.c
tests/test-fstatat.c
tests/test-ftell.c
tests/test-ftello.c
tests/test-futimens.c
tests/test-fwritable.c
tests/test-fwriting.c
tests/test-gc-arcfour.c
tests/test-gc-arctwo.c
tests/test-gc-des.c
tests/test-gc-hmac-md5.c
tests/test-gc-hmac-sha1.c
tests/test-gc-md2.c
tests/test-gc-md4.c
tests/test-gc-md5.c
tests/test-gc-pbkdf2-sha1.c
tests/test-gc-rijndael.c
tests/test-gc-sha1.c
tests/test-gc.c
tests/test-getdelim.c
tests/test-gethostname.c
tests/test-getline.c
tests/test-getlogin.c [new file with mode: 0644]
tests/test-getlogin_r.c
tests/test-getopt.c
tests/test-gettimeofday.c
tests/test-hash.c
tests/test-hmac-md5.c
tests/test-hmac-sha1.c
tests/test-hypot.c [new file with mode: 0644]
tests/test-j0.c [new file with mode: 0644]
tests/test-j1.c [new file with mode: 0644]
tests/test-jn.c [new file with mode: 0644]
tests/test-lchown.c
tests/test-ldexp.c [new file with mode: 0644]
tests/test-lgamma.c [new file with mode: 0644]
tests/test-link.c
tests/test-linkat.c
tests/test-log.c [new file with mode: 0644]
tests/test-log10.c [new file with mode: 0644]
tests/test-log1p.c [new file with mode: 0644]
tests/test-logb.c [new file with mode: 0644]
tests/test-logl.c [new file with mode: 0644]
tests/test-lstat.c
tests/test-md2.c
tests/test-md4.c
tests/test-md5.c
tests/test-memchr.c
tests/test-memchr2.c
tests/test-memcmp.c
tests/test-memmem.c
tests/test-memrchr.c
tests/test-mkdir.c
tests/test-mkdirat.c
tests/test-mkfifo.c
tests/test-mkfifoat.c
tests/test-mknod.c
tests/test-modf.c [new file with mode: 0644]
tests/test-nextafter.c [new file with mode: 0644]
tests/test-posix_spawn3.c
tests/test-pow.c [new file with mode: 0644]
tests/test-rawmemchr.c
tests/test-read-file.c
tests/test-readlink.c
tests/test-remainder.c [new file with mode: 0644]
tests/test-remove.c
tests/test-rename.c
tests/test-renameat.c
tests/test-rijndael.c
tests/test-rint.c [new file with mode: 0644]
tests/test-rmdir.c
tests/test-sin.c [new file with mode: 0644]
tests/test-sinh.c [new file with mode: 0644]
tests/test-sinl.c [new file with mode: 0644]
tests/test-sockets.c
tests/test-sqrt.c [new file with mode: 0644]
tests/test-sqrtl.c [new file with mode: 0644]
tests/test-strchrnul.c
tests/test-strstr.c
tests/test-strtod.c
tests/test-symlink.c
tests/test-symlinkat.c
tests/test-tan.c [new file with mode: 0644]
tests/test-tanh.c [new file with mode: 0644]
tests/test-tanl.c [new file with mode: 0644]
tests/test-unlink.c
tests/test-unlinkat.c
tests/test-userspec.c [new file with mode: 0644]
tests/test-utimens.c
tests/test-utimensat.c
tests/test-xalloc-die.sh
tests/test-xstrtoll.c [new file with mode: 0644]
tests/test-xstrtoll.sh [new file with mode: 0755]
tests/test-xstrtoull.c [new file with mode: 0644]
tests/test-y0.c [new file with mode: 0644]
tests/test-y1.c [new file with mode: 0644]
tests/test-yn.c [new file with mode: 0644]
tests/unictype/test-bidi_byname.c
tests/unictype/test-categ_byname.c
tests/unistr/test-chr.h [new file with mode: 0644]
tests/unistr/test-cmp.h [new file with mode: 0644]
tests/unistr/test-cmp2.h [new file with mode: 0644]
tests/unistr/test-cpy-alloc.h [new file with mode: 0644]
tests/unistr/test-cpy.h [new file with mode: 0644]
tests/unistr/test-move.h [new file with mode: 0644]
tests/unistr/test-set.h [new file with mode: 0644]
tests/unistr/test-stpcpy.h [new file with mode: 0644]
tests/unistr/test-stpncpy.h [new file with mode: 0644]
tests/unistr/test-strcat.h [new file with mode: 0644]
tests/unistr/test-strcmp.h [new file with mode: 0644]
tests/unistr/test-strcpy.h [new file with mode: 0644]
tests/unistr/test-strdup.h [new file with mode: 0644]
tests/unistr/test-strncat.h [new file with mode: 0644]
tests/unistr/test-strncmp.h [new file with mode: 0644]
tests/unistr/test-strncpy.h [new file with mode: 0644]
tests/unistr/test-strnlen.h [new file with mode: 0644]
tests/unistr/test-u16-check.c [new file with mode: 0644]
tests/unistr/test-u16-chr.c [new file with mode: 0644]
tests/unistr/test-u16-cmp.c [new file with mode: 0644]
tests/unistr/test-u16-cmp2.c [new file with mode: 0644]
tests/unistr/test-u16-cpy-alloc.c [new file with mode: 0644]
tests/unistr/test-u16-cpy.c [new file with mode: 0644]
tests/unistr/test-u16-mblen.c [new file with mode: 0644]
tests/unistr/test-u16-mbsnlen.c [new file with mode: 0644]
tests/unistr/test-u16-mbtouc-unsafe.c [new file with mode: 0644]
tests/unistr/test-u16-mbtouc.c [new file with mode: 0644]
tests/unistr/test-u16-mbtouc.h [new file with mode: 0644]
tests/unistr/test-u16-mbtoucr.c [new file with mode: 0644]
tests/unistr/test-u16-move.c [new file with mode: 0644]
tests/unistr/test-u16-next.c [new file with mode: 0644]
tests/unistr/test-u16-prev.c [new file with mode: 0644]
tests/unistr/test-u16-set.c [new file with mode: 0644]
tests/unistr/test-u16-stpcpy.c [new file with mode: 0644]
tests/unistr/test-u16-stpncpy.c [new file with mode: 0644]
tests/unistr/test-u16-strcat.c [new file with mode: 0644]
tests/unistr/test-u16-strcmp.c [new file with mode: 0644]
tests/unistr/test-u16-strcmp.h [new file with mode: 0644]
tests/unistr/test-u16-strcoll.c [new file with mode: 0644]
tests/unistr/test-u16-strcpy.c [new file with mode: 0644]
tests/unistr/test-u16-strdup.c [new file with mode: 0644]
tests/unistr/test-u16-strlen.c [new file with mode: 0644]
tests/unistr/test-u16-strmblen.c [new file with mode: 0644]
tests/unistr/test-u16-strmbtouc.c [new file with mode: 0644]
tests/unistr/test-u16-strncat.c [new file with mode: 0644]
tests/unistr/test-u16-strncmp.c [new file with mode: 0644]
tests/unistr/test-u16-strncpy.c [new file with mode: 0644]
tests/unistr/test-u16-strnlen.c [new file with mode: 0644]
tests/unistr/test-u16-to-u32.c [new file with mode: 0644]
tests/unistr/test-u16-to-u8.c [new file with mode: 0644]
tests/unistr/test-u16-uctomb.c [new file with mode: 0644]
tests/unistr/test-u32-check.c [new file with mode: 0644]
tests/unistr/test-u32-chr.c [new file with mode: 0644]
tests/unistr/test-u32-cmp.c [new file with mode: 0644]
tests/unistr/test-u32-cmp2.c [new file with mode: 0644]
tests/unistr/test-u32-cpy-alloc.c [new file with mode: 0644]
tests/unistr/test-u32-cpy.c [new file with mode: 0644]
tests/unistr/test-u32-mblen.c [new file with mode: 0644]
tests/unistr/test-u32-mbsnlen.c [new file with mode: 0644]
tests/unistr/test-u32-mbtouc-unsafe.c [new file with mode: 0644]
tests/unistr/test-u32-mbtouc.c [new file with mode: 0644]
tests/unistr/test-u32-mbtouc.h [new file with mode: 0644]
tests/unistr/test-u32-mbtoucr.c [new file with mode: 0644]
tests/unistr/test-u32-move.c [new file with mode: 0644]
tests/unistr/test-u32-next.c [new file with mode: 0644]
tests/unistr/test-u32-prev.c [new file with mode: 0644]
tests/unistr/test-u32-set.c [new file with mode: 0644]
tests/unistr/test-u32-stpcpy.c [new file with mode: 0644]
tests/unistr/test-u32-stpncpy.c [new file with mode: 0644]
tests/unistr/test-u32-strcat.c [new file with mode: 0644]
tests/unistr/test-u32-strcmp.c [new file with mode: 0644]
tests/unistr/test-u32-strcmp.h [new file with mode: 0644]
tests/unistr/test-u32-strcoll.c [new file with mode: 0644]
tests/unistr/test-u32-strcpy.c [new file with mode: 0644]
tests/unistr/test-u32-strdup.c [new file with mode: 0644]
tests/unistr/test-u32-strlen.c [new file with mode: 0644]
tests/unistr/test-u32-strmblen.c [new file with mode: 0644]
tests/unistr/test-u32-strmbtouc.c [new file with mode: 0644]
tests/unistr/test-u32-strncat.c [new file with mode: 0644]
tests/unistr/test-u32-strncmp.c [new file with mode: 0644]
tests/unistr/test-u32-strncpy.c [new file with mode: 0644]
tests/unistr/test-u32-strnlen.c [new file with mode: 0644]
tests/unistr/test-u32-to-u16.c [new file with mode: 0644]
tests/unistr/test-u32-to-u8.c [new file with mode: 0644]
tests/unistr/test-u32-uctomb.c [new file with mode: 0644]
tests/unistr/test-u8-check.c [new file with mode: 0644]
tests/unistr/test-u8-chr.c [new file with mode: 0644]
tests/unistr/test-u8-cmp.c [new file with mode: 0644]
tests/unistr/test-u8-cmp2.c [new file with mode: 0644]
tests/unistr/test-u8-cpy-alloc.c [new file with mode: 0644]
tests/unistr/test-u8-cpy.c [new file with mode: 0644]
tests/unistr/test-u8-mblen.c [new file with mode: 0644]
tests/unistr/test-u8-mbsnlen.c [new file with mode: 0644]
tests/unistr/test-u8-mbtouc-unsafe.c [new file with mode: 0644]
tests/unistr/test-u8-mbtouc.c [new file with mode: 0644]
tests/unistr/test-u8-mbtouc.h [new file with mode: 0644]
tests/unistr/test-u8-mbtoucr.c [new file with mode: 0644]
tests/unistr/test-u8-move.c [new file with mode: 0644]
tests/unistr/test-u8-next.c [new file with mode: 0644]
tests/unistr/test-u8-prev.c [new file with mode: 0644]
tests/unistr/test-u8-set.c [new file with mode: 0644]
tests/unistr/test-u8-stpcpy.c [new file with mode: 0644]
tests/unistr/test-u8-stpncpy.c [new file with mode: 0644]
tests/unistr/test-u8-strcat.c [new file with mode: 0644]
tests/unistr/test-u8-strcmp.c [new file with mode: 0644]
tests/unistr/test-u8-strcmp.h [new file with mode: 0644]
tests/unistr/test-u8-strcoll.c [new file with mode: 0644]
tests/unistr/test-u8-strcpy.c [new file with mode: 0644]
tests/unistr/test-u8-strdup.c [new file with mode: 0644]
tests/unistr/test-u8-strlen.c [new file with mode: 0644]
tests/unistr/test-u8-strmblen.c [new file with mode: 0644]
tests/unistr/test-u8-strmbtouc.c [new file with mode: 0644]
tests/unistr/test-u8-strncat.c [new file with mode: 0644]
tests/unistr/test-u8-strncmp.c [new file with mode: 0644]
tests/unistr/test-u8-strncpy.c [new file with mode: 0644]
tests/unistr/test-u8-strnlen.c [new file with mode: 0644]
tests/unistr/test-u8-to-u16.c [new file with mode: 0644]
tests/unistr/test-u8-to-u32.c [new file with mode: 0644]
tests/unistr/test-u8-uctomb.c [new file with mode: 0644]
top/maint.mk
users.txt

index 895d955..481be4c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2010-03-07  Bruno Haible  <bruno@clisp.org>
+
+       Fix test-cond link error.
+       * tests/test-cond.c: Include <stdio.h>.
+
+2010-03-07  Bruno Haible  <bruno@clisp.org>
+
+       Fix test-dirent-safer link error.
+       * modules/dirent-safer-tests (Makefile.am): Define
+       test_dirent_safer_LDADD.
+
+2010-03-07  Bruno Haible  <bruno@clisp.org>
+
+       * gnulib-tool (func_create_testdir): Don't use 'lib-ignore' module
+       among default module list.
+
+2010-03-07  Bruno Haible  <bruno@clisp.org>
+
+       Fix link error on platforms with GNU libiconv.
+       * modules/unistr/u8-strcoll-tests (Makefile): Define
+       test_u8_strcoll_LDADD.
+       * modules/unistr/u16-strcoll-tests (Makefile): Define
+       test_u16_strcoll_LDADD.
+       * modules/unistr/u32-strcoll-tests (Makefile): Define
+       test_u32_strcoll_LDADD.
+
+2010-03-06  Bruno Haible  <bruno@clisp.org>
+
+       Clarify access, euidaccess, faccessat.
+       * doc/posix-functions/faccessat.texi: Mention security problem under
+       "Other problems", not "Portability problems".
+       * doc/posix-functions/access.texi: Likewise. Mention a related security
+       problem.
+       * doc/glibc-functions/euidaccess.texi: Mention security problems.
+       * lib/euidaccess.c: Add comments about platforms.
+       * lib/unistd.in.h (access, euidaccess): Add warnings.
+
+2010-03-07  Bruno Haible  <bruno@clisp.org>
+
+       Fix incorrect Makefile.am generation in German locale.
+       * gnulib-tool (func_emit_lib_Makefile_am, func_emit_tests_Makefile_am):
+       Execute sed command with character range in C locale.
+
+2010-03-06  Jim Meyering  <meyering@redhat.com>
+
+       euidaccess: relax license to LGPLv2+
+       * modules/euidaccess (License): Relax to LGPLv2+.
+
+2010-03-06  Bruno Haible  <bruno@clisp.org>
+
+       Prefer lib_SOURCES over unconditional AC_LIBOBJ.
+       * modules/exitfail (configure.ac): Remove AC_LIBOBJ invocation.
+       (Makefile.am): Augment lib_SOURCES instead.
+
+2010-03-05  Simon Josefsson  <simon@josefsson.org>
+
+       * modules/exit (License): Relax license to LGPLv2+.
+       (Status): Mark as obsolete.
+       * NEWS: Mention deprecated 'exit' module.
+       * doc/posix-functions/exit.texi: Recommend 'stdlib' module instead
+       of now obsolete 'exit'.
+
+2010-03-02  Ben Walton  <bwalton@artsci.utoronto.ca>  (tiny change)
+
+       copy-acl: enhance Solaris ACL error handling
+       * lib/copy-acl.c (qcopy_acl): Also ignore EOPNOTSUPP.
+       * lib/set-mode-acl.c (qset_acl): Likewise.
+
+2010-03-02  Bruno Haible  <bruno@clisp.org>
+
+       spawn: Don't override the system defined values on FreeBSD 8.
+       * lib/spawn.in.h (POSIX_SPAWN_RESETIDS, POSIX_SPAWN_SETPGROUP,
+       POSIX_SPAWN_SETSIGDEF, POSIX_SPAWN_SETSIGMASK,
+       POSIX_SPAWN_SETSCHEDPARAM, POSIX_SPAWN_SETSCHEDULER): Don't redefine
+       if HAVE_POSIX_SPAWN is 1.
+       Reported by Johan van Selst <johans@stack.nl> via Eric Blake.
+
+2010-03-01  Bruno Haible  <bruno@clisp.org>
+
+       * doc/gnulib-tool.texi (Initial import): Clarify the requirements
+       regarding Automake.
+
+2010-02-25  Bruno Haible  <bruno@clisp.org>
+
+       Fix breakage of gnulib-tool with ksh, introduced on 2010-02-21.
+       * gnulib-tool: Define 'echo' as a function only before the ksh alias
+       setting, not afterwards.
+       Reported by Ben Walton <bwalton@artsci.utoronto.ca>.
+
+2010-02-24  Eric Blake  <eblake@redhat.com>
+
+       bootstrap, git-version-gen: use timestamp
+       * build-aux/git-version-gen (scriptversion): Force UTC.
+       * build-aux/bootstrap (scriptversion): New variable.
+
+       bootstrap: allow older git
+       * build-aux/bootstrap (GNULIB_SRCDIR): Add fallback if git is
+       older than 1.6.4.  Requested by the libvirt project.
+
+2010-02-23  Eric Blake  <eblake@redhat.com>
+
+       warn-on-use: work with old autoconf
+       * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Accomodate older
+       AS_VAR semantics of autoconf 2.60.
+       Reported by Bruno Haible.
+
+       bootstrap: improve some comments
+       * build-aux/bootstrap: Drop unneeded emacs hint.  Add some
+       clarification comments.
+
+       gettimeofday: provide correct function
+       * lib/gettimeofday.c (gettimeofday): Provide rpl_gettimeofday only
+       when replacement is declared, otherwise provide gettimeofday.
+       Reported by Michael Goffioul.
+
+2010-02-23  Jim Meyering  <meyering@redhat.com>
+
+       lib-ignore: relax license to "unlimited", not LGPLv2+
+       * modules/lib-ignore (License): Relax to "unlimited".
+
+2010-02-23  Jim Meyering  <meyering@redhat.com>
+
+       lib-ignore: relax license to LGPLv2+
+       * modules/lib-ignore (License): Relax to LGPLv2+.
+
+2010-02-22  Eric Blake  <eblake@redhat.com>
+
+       lseek: avoid bash 3.2 broken pipe bug
+       * m4/lseek.m4 (gl_FUNC_LSEEK): Drain pipe, to avoid spurious
+       warning from bash 3.2.
+       Reported by Ben Pfaff, with analysis from Bruno Haible.
+
+       bootstrap: support non-FSF copyright holder
+       * build-aux/bootstrap (COPYRIGHT_HOLDER, with_gettext): Allow
+       bootstrap.conf override of COPYRIGHT_HOLDER.
+       (MSGID_BUGS_ADDRESS): Allow URL rather than email.
+
+       bootstrap: interoperate with gettext 0.14.1
+       * build-aux/bootstrap (slurp): Fix typo when using older gettext.
+
+       bootstrap: allow for alternate submodule location
+       * build-aux/bootstrap (gnulib_path): New variable; use instead of
+       hardcoding submodule location.
+       (gnulib_mk): Allow direct use of Makefile.am.
+
+       bootstrap: use GNULIB_SRCDIR to reduce disk usage
+       * build-aux/bootstrap (GNULIB_SRCDIR): If set, use as a reference,
+       rather than reconfiguring where the submodule points.
+
+       gettimeofday: restore support for platforms that lack function
+       * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Also compile
+       replacement if function is missing.
+       * m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_DEFAULTS): New witness.
+       * modules/sys_time (Makefile.am): Substitute it.
+       * lib/sys_time.in.h (gettimeofday): Check it.
+       Reported by Michael Goffioul.
+
+2010-02-21  Bruno Haible  <bruno@clisp.org>
+
+       * lib/stdio.in.h (obstack_printf): Fix typo.
+
+2010-02-21  Jose E. Marchesi  <jemarch@gnu.org>
+
+       vc-list-files: use bzr ls's -R option
+       * build-aux/vc-list-files: Invoke bazaar to generate a recursive
+       list of versioned files based on 'dir' (usage of -R in 'bzr ls').
+
+2010-02-21  Jim Meyering  <meyering@redhat.com>
+
+       init.sh: fix EXEEXT shims to work also for names like test-prog
+       * tests/init.sh: Re-exec a better shell, when needed.
+       If the current shell lacks support for posix $(...), an init.sh-using
+       test will now try to find a shell that supports that.  If EXEEXT is
+       nonempty, we also require support for hyphen-in-alias-name and shell
+       substitutions like ${var#glob}.  Failure to find such a shell results
+       in a skipped test.
+
+2010-02-21  Bruno Haible  <bruno@clisp.org>
+
+       Really work around around "broken pipe" error message from bash 3.2.
+       * gnulib-tool (func_reset_sigpipe): Remove function.
+       (echo): In bash 3.2, define to a function that uses printf.
+       Analyzed by Ralf Wildenhues, Chet Ramey, Ben Pfaff.
+
+2010-02-20  Bruno Haible  <bruno@clisp.org>
+
+       Restore support for automake 1.9.6 with autoconf 2.61.
+       * m4/gnulib-common.m4 (AC_PROG_MKDIR_P): Ensure MKDIR_P is AC_SUBSTed.
+       Reported by James Youngman <jay@gnu.org>.
+
+2010-02-20  Bruno Haible  <bruno@clisp.org>
+
+       Improve *printf warning condition.
+       * lib/stdio.in.h (fprintf, printf, vfprintf, vprintf): Emit warning
+       also if GNULIB_POSIXCHECK is defined, the *-posix module is not used,
+       and the function is overridden due to SIGPIPE emulation.
+
+2010-02-20  Bruno Haible  <bruno@clisp.org>
+
+       * lib/stdio.in.h: Tweak comments.
+
+2010-02-19  Bruno Haible  <bruno@clisp.org>
+
+       Make it easier to find modules. New gnulib-tool option '--find'.
+       * gnulib-tool: New option --find.
+       (func_usage): Document it.
+       (func_sanitize_modulelist): New function, extracted from
+       func_all_modules.
+       (func_all_modules): Invoke it.
+       * doc/gnulib-tool.texi (Which modules?): New node.
+
+2010-02-18  Markus Duft <mduft@gentoo.org>  (tiny change)
+
+       * lib/sys_select.in.h: Provide select replacement even if
+       sys/select.h exists on a system, for Interix.
+
+2010-02-18  Jim Meyering  <meyering@redhat.com>
+
+       init.sh: don't use $(...) just yet
+       * tests/init.sh (create_exe_shim_functions_): Use `...`, not $(...),
+       to accommodate e.g., Solaris' /bin/sh.
+
+2010-02-17  Bruno Haible  <bruno@clisp.org>
+
+       * doc/posix-headers/netdb.texi: Mention NetBSD 5.0 problem.
+       Reported by Ludovic Courtès <ludo@gnu.org>.
+
+2010-02-16  Simon Josefsson  <simon@josefsson.org>
+
+       * modules/userspec-tests (test_userspec_LDADD): Add variable, for
+       linking with -lintl.
+
+2010-02-17  Simon Josefsson  <simon@josefsson.org>
+
+       * lib/netdb.in.h (AI_V4MAPPED, AI_ALL, AI_ADDRCONFIG): Define to 0
+       if not provided by the system's netdb.h.  Reported by
+       ludo@gnu.org (Ludovic Courtès).
+
+2010-02-15  Jim Meyering  <meyering@redhat.com>
+
+       init.sh: improve portability and efficiency
+       * tests/init.sh (find_exe_basenames_): Remove unnecessary use of
+       "dummy" in a for loop.
+       Use '!', not '^' to select the complement of a character set used
+       in a "case" statement.
+       Use shell variable manipulation, a la ${...%.exe}, rather than sed.
+       Suggestions from Eric Blake.
+
+       init.sh: automatically accommodate programs with the .exe suffix
+       Automatically arrange for an invocation of "prog" to execute the
+       program named "prog$EXEEXT" (usually prog.exe).  Thus, all invocations
+       may use the simpler "prog", yet still work when built on a system
+       that requires specifying the added suffix.
+       Do this by constructing a function named "prog" that invokes
+       "prog.exe" for each .exe file in selected directories.
+       * tests/init.sh (find_exe_basenames_): New function.
+       (create_exe_shim_functions_): New function.
+       (path_prepend_): Use it.
+
+       maint.mk: mark syntax-check sc_*.m rules as .PHONY
+       * top/maint.mk ($(syntax-check-rules)): Add .PHONY, so that
+       "make -t syntax-check" doesn't create a ton of sc_*.m files.
+
+2010-02-14  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: prohibit inclusion of "hash-pjw.h" without_use
+       * top/maint.mk (sc_prohibit_hash_without_use): Re-add "@".
+       (sc_prohibit_hash_pjw_without_use): New rule.
+
+       maint.mk: allow the default upload destination dir to be overridden
+       * top/maint.mk (upload_dest_dir_): Define with a default that
+       preserves the status quo.
+       (emit_upload_commands): Use it, rather than hard-coding $(PACKAGE).
+       Reported by Peter Simons.
+
+       maint.mk: prohibit inclusion of "hash.h" without_use
+       * top/maint.mk (sc_prohibit_hash_without_use): New rule.
+
+2010-02-10  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: prohibit inclusion of "ignore-value.h" without_use
+       * top/maint.mk (sc_prohibit_ignore_value_without_use): New rule.
+
+2010-02-09  Eric Blake  <ebb9@byu.net>
+       and Bruno Haible  <bruno@clisp.org>
+
+       obstack-printf-posix: ensure declaration
+       * m4/obstack-printf.m4 (gl_DECL_OBSTACK_PRINTF): New macro,
+       extracted from gl_FUNC_OBSTACK_PRINTF.
+       (gl_FUNC_OBSTACK_PRINTF): Invoke it.
+       * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX):
+       Likewise.
+       * lib/stdio.in.h (obstack_printf, obstack_vprintf): Declare also
+       if GNULIB_OBSTACK_PRINTF_POSIX is 1 and GNULIB_OBSTACK_PRINTF is
+       0.
+
+2010-02-08  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool: Fix typo in 2010-02-07 commit.
+       * gnulib-tool (func_get_dependencies): Fix typo in last commit.
+       Reported by Eric Blake.
+
+2010-02-07  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool: Fix up caching patches.
+       * gnulib-tool: New options --cache-modules, --no-cache-modules. Remove
+       option --no-cache. Use associative arrays when supported by the shell.
+       (sed_comments): New variable.
+       (modcache): Renamed from do_cache.
+       (sed_extract_field_header): Renamed from sed_extract_cache_prog. Don't
+       abbreviate unnecessarily.
+       (have_associative): New variable.
+       (func_cache_var): Define correctly for bash 1.x. Define in an optimized
+       way also for ksh and zsh.
+       (func_init_sed_convert_to_cache_statements): New function, extracted
+       from func_cache_lookup_module. Add support for associative arrays.
+       Don't set the c_MODULE_cached variable here. Ignore all lines before
+       the first field header. Remove only the final newline, not all trailing
+       newlines. Support empty fields correctly. Limit the use of 'eval' to
+       assignments.
+       (func_get_description, func_get_status, func_get_notice,
+       func_get_applicability, func_get_filelist, func_get_dependencies,
+       func_get_autoconf_early_snippet, func_get_autoconf_snippet,
+       func_get_automake_snippet, func_get_include_directive,
+       func_get_link_directive, func_get_license, func_get_maintainer):
+       Update documentation. List the unoptimized code first. Add support for
+       associative arrays. Limit the use of 'eval' to assignments.
+       (func_get_applicability): Undo stylistic pessimisations.
+       (func_get_automake_snippet, func_get_include_directive): Reduce code
+       duplication.
+       (func_modules_transitive_closure, func_modules_add_dummy,
+       func_modules_notice, func_modules_to_filelist, func_add_file,
+       func_update_file, func_emit_lib_Makefile_am, func_emit_po_Makevars,
+       func_emit_po_POTFILES_in, func_emit_tests_Makefile_am, func_import,
+       func_create_testdir, func_create_megatestdir): Update documentation.
+
+2010-01-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * gnulib-tool (func_cache_lookup_module): Store the module name
+       belonging to the cache variable; error out if two different
+       module names map to the same cache variable name.
+
+2010-01-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       gnulib-tool: Make caching optional.
+       * gnulib-tool: Accept option --no-cache, turning off $do_cache.
+       Update matching short versions of --no-changelog.
+       (func_usage): Update.
+       (sed_extract_cache_prog): Renamed from ...
+       (sed_extract_prog): ... this; revert to old extraction script.
+       (func_get_description, func_get_status)
+       (func_get_notice, func_get_applicability, func_get_filelist)
+       (func_get_dependencies, func_get_autoconf_early_snippet)
+       (func_get_autoconf_snippet, func_get_automake_snippet)
+       (func_get_include_directive, func_get_link_directive)
+       (func_get_license, func_get_maintainer): If $do_cache is false,
+       use old, non-caching extraction scripts.
+       Suggestion by Bruno Haible.
+
+2010-01-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       gnulib-tool: cache module metainformation.
+       * gnulib-tool (sed_extract_prog): Match newline before each
+       header, and rewrite header to a shell variable suffix.
+       (func_cache_var, func_cache_lookup_module): New functions,
+       to turn a module name into a cache variable prefix, and to
+       look up and cache module metainformation.
+       (func_get_description, func_get_status)
+       (func_get_notice, func_get_applicability, func_get_filelist)
+       (func_get_dependencies, func_get_autoconf_early_snippet)
+       (func_get_autoconf_snippet, func_get_automake_snippet)
+       (func_get_include_directive, func_get_link_directive)
+       (func_get_license, func_get_maintainer): Use
+       func_cache_lookup_module.
+
+2010-02-07  Bruno Haible  <bruno@clisp.org>
+
+       fnctl: Fix missing dependency.
+       * modules/fcntl (Depends-on): Add getdtablesize.
+       Reported by John W. Eaton <jwe@gnu.org>.
+
+2010-02-05  Sergey Poznyakoff  <gray@gnu.org.ua>
+
+       Argp: fix recognition of short alias options.
+
+       * lib/argp-parse.c (convert_options): Fix improper use of
+       `|' between character values.
+       * tests/test-argp.c (group1_option): New alias option
+       --read (-r).
+       (group1_parser): Special handling for 'r'.
+       (test15): New test case.
+       (test_fun): Add test15.
+       * tests/test-argp-2.sh: Update expected --help and --usage
+       outputs.
+
+2010-02-05  Sergey Poznyakoff  <gray@gnu.org.ua>
+
+       * tests/test-argp.c: Fix indentation.
+
+2010-02-04  Eric Blake  <ebb9@byu.net>
+
+       gettimeofday: expose type of second argument
+       * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Do better detection
+       of glibc extension signature, and define GETTIMEOFDAY_TIMEZONE.
+       * tests/test-gettimeofday.c: Use it to silence warning.
+       * doc/posix-functions/gettimeofday.texi (gettimeofday): Document
+       the issue.
+
+2010-02-03  Jim Meyering  <meyering@redhat.com>
+
+       regcomp.c: avoid the sole warning from gcc's -Wtype-limits
+       * lib/regcomp.c (TYPE_SIGNED): Define.
+       (parse_dup_op): Use it to avoid the sole warning from -Wtype-limits.
+
+       regcomp.c: avoid a new -Wshadow warning
+       * lib/regcomp.c (create_initial_state): Do not shadow local "err".
+
+2010-02-01  Jim Meyering  <meyering@redhat.com>
+
+       removing useless parentheses in cpp #define directives
+       For motivation, see commit c0221df4, "define STREQ(a,b)
+       consistently, removing useless parentheses"
+       * lib/memcmp.c (CMP_LT_OR_GT): Remove useless parentheses.
+       * lib/mountlist.c (MNT_IGNORE): Likewise.
+       * lib/trim.h (trim, trim_trailing, trim_leading): Likewise.
+
+2010-02-01  Eric Blake  <ebb9@byu.net>
+
+       sys_time: use link-warning
+       * m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Split defaults...
+       (gl_HEADER_SYS_TIME_H_DEFAULTS): ...into new macro.
+       (gl_SYS_TIME_MODULE_INDICATOR): New macro.
+       * modules/sys_time (Depends-on): Add warn-on-use.
+       (Makefile.am): Always build replacement.
+       (configure.ac): Update substitutions.
+       * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY)
+       (gl_FUNC_GETTIMEOFDAY_CLOBBER): Include defaults, and no longer
+       bother with SYS_TIME_H.
+       * modules/gettimeofday (configure.ac): Declare indicator.
+       * lib/sys_time.in.h (gettimeofday): Warn if gnulib module is not
+       in use.
+
+       closein-tests: silence compiler warning
+       * tests/test-closein.c (main): Ignore fread result.
+       * modules/closein-tests (Depends-on): Add ignore-value.
+
+       tests: silence warning about system return
+       * tests/test-areadlink-with-size.c (main): Ignore system result.
+       * tests/test-areadlink.c (main): Likewise.
+       * tests/test-areadlinkat-with-size.c (main): Likewise.
+       * tests/test-areadlinkat.c (main): Likewise.
+       * tests/test-canonicalize-lgpl.c (main): Likewise.
+       * tests/test-canonicalize.c (main): Likewise.
+       * tests/test-chown.c (main): Likewise.
+       * tests/test-fchownat.c (main): Likewise.
+       * tests/test-fdutimensat.c (main): Likewise.
+       * tests/test-fstatat.c (main): Likewise.
+       * tests/test-futimens.c (main): Likewise.
+       * tests/test-lchown.c (main): Likewise.
+       * tests/test-link.c (main): Likewise.
+       * tests/test-linkat.c (main): Likewise.
+       * tests/test-lstat.c (main): Likewise.
+       * tests/test-mkdir.c (main): Likewise.
+       * tests/test-mkdirat.c (main): Likewise.
+       * tests/test-mkfifo.c (main): Likewise.
+       * tests/test-mkfifoat.c (main): Likewise.
+       * tests/test-mknod.c (main): Likewise.
+       * tests/test-readlink.c (main): Likewise.
+       * tests/test-remove.c (main): Likewise.
+       * tests/test-rename.c (main): Likewise.
+       * tests/test-renameat.c (main): Likewise.
+       * tests/test-rmdir.c (main): Likewise.
+       * tests/test-symlink.c (main): Likewise.
+       * tests/test-symlinkat.c (main): Likewise.
+       * tests/test-unlink.c (main): Likewise.
+       * tests/test-unlinkat.c (main): Likewise.
+       * tests/test-utimens.c (main): Likewise.
+       * tests/test-utimensat.c (main): Likewise.
+       * modules/areadlink-tests (Depends-on): Add ignore-value.
+       * modules/areadlink-with-size-tests (Depends-on): Likewise.
+       * modules/areadlinkat-tests (Depends-on): Likewise.
+       * modules/areadlinkat-with-size-tests (Depends-on): Likewise.
+       * modules/canonicalize-lgpl-tests (Depends-on): Likewise.
+       * modules/canonicalize-tests (Depends-on): Likewise.
+       * modules/chown-tests (Depends-on): Likewise.
+       * modules/fdutimensat-tests (Depends-on): Likewise.
+       * modules/futimens-tests (Depends-on): Likewise.
+       * modules/lchown-tests (Depends-on): Likewise.
+       * modules/link-tests (Depends-on): Likewise.
+       * modules/linkat-tests (Depends-on): Likewise.
+       * modules/lstat-tests (Depends-on): Likewise.
+       * modules/mkdir-tests (Depends-on): Likewise.
+       * modules/mkfifo-tests (Depends-on): Likewise.
+       * modules/mkfifoat-tests (Depends-on): Likewise.
+       * modules/mknod-tests (Depends-on): Likewise.
+       * modules/openat-tests (Depends-on): Likewise.
+       * modules/readlink-tests (Depends-on): Likewise.
+       * modules/remove-tests (Depends-on): Likewise.
+       * modules/rename-tests (Depends-on): Likewise.
+       * modules/renameat-tests (Depends-on): Likewise.
+       * modules/rmdir-tests (Depends-on): Likewise.
+       * modules/symlink-tests (Depends-on): Likewise.
+       * modules/symlinkat-tests (Depends-on): Likewise.
+       * modules/unlink-tests (Depends-on): Likewise.
+       * modules/utimens-tests (Depends-on): Likewise.
+       * modules/utimensat-tests (Depends-on): Likewise.
+
+2010-01-31  Bruno Haible  <bruno@clisp.org>
+
+       Perform the same test for many <math.h> functions.
+       * m4/mathfunc.m4 (gl_COMMON_DOUBLE_MATHFUNC,
+       gl_COMMON_DOUBLE_MATHFUNC_TEST): New macros.
+       * m4/sqrt.m4 (gl_FUNC_SQRT): Invoke gl_COMMON_DOUBLE_MATHFUNC instead
+       of gl_MATHFUNC.
+       * modules/acos (configure.ac): Likewise.
+       * modules/asin (configure.ac): Likewise.
+       * modules/atan (configure.ac): Likewise.
+       * modules/atan2 (configure.ac): Likewise.
+       * modules/cbrt (configure.ac): Likewise.
+       * modules/copysign (configure.ac): Likewise.
+       * modules/cos (configure.ac): Likewise.
+       * modules/cosh (configure.ac): Likewise.
+       * modules/erf (configure.ac): Likewise.
+       * modules/erfc (configure.ac): Likewise.
+       * modules/exp (configure.ac): Likewise.
+       * modules/fmod (configure.ac): Likewise.
+       * modules/hypot (configure.ac): Likewise.
+       * modules/j0 (configure.ac): Likewise.
+       * modules/j1 (configure.ac): Likewise.
+       * modules/jn (configure.ac): Likewise.
+       * modules/lgamma (configure.ac): Likewise.
+       * modules/log (configure.ac): Likewise.
+       * modules/log10 (configure.ac): Likewise.
+       * modules/log1p (configure.ac): Likewise.
+       * modules/pow (configure.ac): Likewise.
+       * modules/remainder (configure.ac): Likewise.
+       * modules/sin (configure.ac): Likewise.
+       * modules/sinh (configure.ac): Likewise.
+       * modules/tan (configure.ac): Likewise.
+       * modules/tanh (configure.ac): Likewise.
+       * modules/y0 (configure.ac): Likewise.
+       * modules/y1 (configure.ac): Likewise.
+       * modules/yn (configure.ac): Likewise.
+       Suggested by Paolo Bonzini.
+
+2010-01-31  Bruno Haible  <bruno@clisp.org>
+
+       * m4/getline.m4 (gl_FUNC_GETLINE): Add comment about REPLACE_GETLINE.
+
+2010-01-31  Bruno Haible  <bruno@clisp.org>
+
+       Work around getdelim() bug on FreeBSD 8.0.
+       * m4/getdelim.m4 (gl_FUNC_GETDELIM): Test whether getdelim supports an
+       initially NULL line. Set REPLACE_GETDELIM if getdelim exists but does
+       not work.
+       * lib/stdio.in.h (getdelim): Define as an alias if REPLACE_GETDELIM
+       is 1.
+       * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize REPLACE_GETDELIM.
+       * modules/stdio (Makefile.am): Also substitute REPLACE_GETDELIM.
+       * tests/test-getdelim.c (main): Also test result for a NULL buffer and
+       a non-zero size.
+       * doc/posix-functions/getdelim.texi: Mention the FreeBSD bug.
+
+2010-01-31  Bruno Haible  <bruno@clisp.org>
+
+       Work around getline() bug on FreeBSD 8.0.
+       * m4/getline.m4 (gl_FUNC_GETLINE): Also test result for a NULL buffer
+       and a non-zero size.
+       * tests/test-getline.c (main): Likewise.
+       * doc/posix-functions/getline.texi: Mention the FreeBSD bug.
+       Reported by Dennis <noordsij@cs.helsinki.fi> via Eric Blake.
+
+2010-01-28  Eric Blake  <ebb9@byu.net>
+
+       regex: fix build failure
+       * lib/regex_internal.h (__GNUC_PREREQ): Define for non-glibc
+       platforms.
+
+2010-01-28  Jim Meyering  <meyering@redhat.com>
+
+       regex: do not ignore memory allocation failure
+       * lib/regex_internal.c (create_cd_newstate): Detect
+       re_node_set_init_copy failure.   Extracted from glibc commit
+       2da42bc06566bc89785e580fa1ac89b4c9f2a63c.
+
+       regex: sync more white-space changes from libc
+       * lib/regex_internal.c: White-space only changes.
+       * lib/regexec.c: Likewise.
+
+       regex: add many uses of __attribute_warn_unused_result__
+       * lib/regex_internal.c: Use __attribute_warn_unused_result__.
+       * lib/regexec.c: Likewise.
+       Extracted from a messy glibc commit.
+
+       regcomp.c: spelling and merge-artifact from glibc
+       * lib/regcomp.c: Merge remainder of glibc's
+       2da42bc06566bc89785e580fa1ac89b4c9f2a63c.
+
+       regcomp.c: sync white-space changes from glibc
+       * lib/regcomp.c: Merge to accommodate white space
+       changes from glibc's 2da42bc06566bc89785e580fa1ac89b4c9f2a63c.
+
+       regcomp.c: do not ignore internal return values
+       * lib/regcomp.c: Do not ignore internal return values.
+       This is from glibc's 2da42bc06566bc89785e580fa1ac89b4c9f2a63c,
+       but without its white-space changes and spelling fixes.
+
+       regex_internal.h: define __attribute_warn_unused_result__
+       * lib/regex_internal.h (__attribute_warn_unused_result__): Define.
+
+       maint: add a syntax-check rule to check for vulnerable Makefile.in
+       * top/maint.mk (sc_vulnerable_makefile_CVE-2009-4029): New rule.
+
+2010-01-27  Jim Meyering  <meyering@redhat.com>
+
+       ncftpput-ftp: clean up spaces
+       * build-aux/ncftpput-ftp: Make Copyright line consistent.
+       Remove trailing blanks.
+
+2010-01-27  Simon Josefsson  <simon@josefsson.org>
+
+       * build-aux/git-version-gen: Fix copyright statement.
+       * build-aux/gnupload: Likewise.
+       * tests/test-arcfour.c: Likewise.
+       * tests/test-arctwo.c: Likewise.
+       * tests/test-count-one-bits.c: Likewise.
+       * tests/test-crc.c: Likewise.
+       * tests/test-des.c: Likewise.
+       * tests/test-gc-arcfour.c: Likewise.
+       * tests/test-gc-arctwo.c: Likewise.
+       * tests/test-gc-des.c: Likewise.
+       * tests/test-gc-hmac-md5.c: Likewise.
+       * tests/test-gc-hmac-sha1.c: Likewise.
+       * tests/test-gc-md2.c: Likewise.
+       * tests/test-gc-md4.c: Likewise.
+       * tests/test-gc-md5.c: Likewise.
+       * tests/test-gc-pbkdf2-sha1.c: Likewise.
+       * tests/test-gc-rijndael.c: Likewise.
+       * tests/test-gc-sha1.c: Likewise.
+       * tests/test-gc.c: Likewise.
+       * tests/test-gethostname.c: Likewise.
+       * tests/test-gettimeofday.c: Likewise.
+       * tests/test-hash.c: Likewise.
+       * tests/test-hmac-md5.c: Likewise.
+       * tests/test-hmac-sha1.c: Likewise.
+       * tests/test-md2.c: Likewise.
+       * tests/test-md4.c: Likewise.
+       * tests/test-md5.c: Likewise.
+       * tests/test-memchr.c: Likewise.
+       * tests/test-memchr2.c: Likewise.
+       * tests/test-memcmp.c: Likewise.
+       * tests/test-memmem.c: Likewise.
+       * tests/test-memrchr.c: Likewise.
+       * tests/test-rawmemchr.c: Likewise.
+       * tests/test-read-file.c: Likewise.
+       * tests/test-rijndael.c: Likewise.
+       * tests/test-sockets.c: Likewise.
+       * tests/test-strchrnul.c: Likewise.
+       * tests/test-strstr.c: Likewise.
+       * tests/test-strtod.c: Likewise.
+       * build-aux/ncftpput-ftp: Likewise.
+
+2010-01-26  Eric Blake  <ebb9@byu.net>
+
+       ignore-value: update recommended header name
+       * modules/ignore-value (Include): Only use <> for headers that
+       exist in glibc.
+
+2010-01-26  Jim Meyering  <meyering@redhat.com>
+
+       test-userspec.c: avoid compiler warnings
+       * tests/test-userspec.c (main): Avoid shadowing ("uid"),
+       and "initialization discards qualifiers..." warnings.
+       Put the first "uid" in its own scope, and make char* members "const".
+
+2010-01-25  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool: Make warning diagnostics consistent.
+       * gnulib-tool (func_warning): New function.
+       Use it everywhere where gnulib-tool produces output to stderr and it is
+       not a fatal error.
+
+2010-01-25  Bruno Haible  <bruno@clisp.org>
+
+       Fix test dependencies.
+       * modules/xstrtol-tests (Depends-on): Add inttypes.
+       * modules/xstrtoll-tests (Depends-on): Likewise. Remove xstrtoll.
+
+2010-01-25 Pádraig Brady <P@draigBrady.com>
+
+       syntax-check: detect incorrect boolean macro values in config.h
+       * modules/maintainer-makefile (configure.ac): Parameterize the location
+       of config.h which will be available to makefiles as $(CONFIG_INCLUDE).
+       The logic is from Eric Blake and the location indicated by Jim Meyering.
+       Note the more natural CONFIG_HEADER name is prohibited by automake
+       for backwards compatibility reasons.
+       * top/maint.mk (sc_Wundef_boolean): New rule.
+
+2010-01-25  Jim Meyering  <meyering@redhat.com>
+
+       bootstrap: detect MacOS 10.6's shasum, too
+       * build-aux/bootstrap: Also recognize MacOS 10.6's shasum.
+       Suggested by Thomas Treichl <Thomas.Treichl@gmx.net>.
+
+2010-01-23  Jim Meyering  <meyering@redhat.com>
+
+       xstrtoll: new module
+       * modules/xstrtoll: New file.
+       * MODULES.html.sh (Numeric conversion functions): Add xstrtoll.
+       * lib/xstrtol.h [HAVE_LONG_LONG_INT]: Declare xstrtoll and xstrtoull.
+       * lib/xstrtoll.c, lib/xstrtoull.c: New files.
+       ./configure fails if you use this module and lack "long long".
+       * modules/xstrtoll-tests: New module.
+       * tests/test-xstrtoll.c, tests/test-xstrtoull.c: New files.
+       * tests/test-xstrtoll.sh: Like test-xstrtol.c, but use the
+       new init.sh-based test framework.
+
+2010-01-24  Bruno Haible  <bruno@clisp.org>
+
+       Tests for module 'yn'.
+       * modules/yn-tests: New file.
+       * tests/test-yn.c: New file.
+
+       Tests for module 'y1'.
+       * modules/y1-tests: New file.
+       * tests/test-y1.c: New file.
+
+       Tests for module 'y0'.
+       * modules/y0-tests: New file.
+       * tests/test-y0.c: New file.
+
+       Tests for module 'tanh'.
+       * modules/tanh-tests: New file.
+       * tests/test-tanh.c: New file.
+
+       Tests for module 'tan'.
+       * modules/tan-tests: New file.
+       * tests/test-tan.c: New file.
+
+       Tests for module 'sqrt'.
+       * modules/sqrt-tests: New file.
+       * tests/test-sqrt.c: New file.
+
+       Tests for module 'sinh'.
+       * modules/sinh-tests: New file.
+       * tests/test-sinh.c: New file.
+
+       Tests for module 'sin'.
+       * modules/sin-tests: New file.
+       * tests/test-sin.c: New file.
+
+       Tests for module 'rint'.
+       * modules/rint-tests: New file.
+       * tests/test-rint.c: New file.
+
+       Tests for module 'remainder'.
+       * modules/remainder-tests: New file.
+       * tests/test-remainder.c: New file.
+
+       Tests for module 'pow'.
+       * modules/pow-tests: New file.
+       * tests/test-pow.c: New file.
+
+       Tests for module 'nextafter'.
+       * modules/nextafter-tests: New file.
+       * tests/test-nextafter.c: New file.
+
+       Tests for module 'modf'.
+       * modules/modf-tests: New file.
+       * tests/test-modf.c: New file.
+
+       Tests for module 'logb'.
+       * modules/logb-tests: New file.
+       * tests/test-logb.c: New file.
+
+       Tests for module 'log1p'.
+       * modules/log1p-tests: New file.
+       * tests/test-log1p.c: New file.
+
+       Tests for module 'log10'.
+       * modules/log10-tests: New file.
+       * tests/test-log10.c: New file.
+
+       Tests for module 'log'.
+       * modules/log-tests: New file.
+       * tests/test-log.c: New file.
+
+       Tests for module 'lgamma'.
+       * modules/lgamma-tests: New file.
+       * tests/test-lgamma.c: New file.
+
+       Tests for module 'ldexp'.
+       * modules/ldexp-tests: New file.
+       * tests/test-ldexp.c: New file.
+
+       Tests for module 'jn'.
+       * modules/jn-tests: New file.
+       * tests/test-jn.c: New file.
+
+       Tests for module 'j1'.
+       * modules/j1-tests: New file.
+       * tests/test-j1.c: New file.
+
+       Tests for module 'j0'.
+       * modules/j0-tests: New file.
+       * tests/test-j0.c: New file.
+
+       Tests for module 'hypot'.
+       * modules/hypot-tests: New file.
+       * tests/test-hypot.c: New file.
+
+       Tests for module 'fmod'.
+       * modules/fmod-tests: New file.
+       * tests/test-fmod.c: New file.
+
+       Tests for module 'fabs'.
+       * modules/fabs-tests: New file.
+       * tests/test-fabs.c: New file.
+
+       Tests for module 'exp'.
+       * modules/exp-tests: New file.
+       * tests/test-exp.c: New file.
+
+       Tests for module 'erfc'.
+       * modules/erfc-tests: New file.
+       * tests/test-erfc.c: New file.
+
+       Tests for module 'erf'.
+       * modules/erf-tests: New file.
+       * tests/test-erf.c: New file.
+
+       Tests for module 'cosh'.
+       * modules/cosh-tests: New file.
+       * tests/test-cosh.c: New file.
+
+       Tests for module 'cos'.
+       * modules/cos-tests: New file.
+       * tests/test-cos.c: New file.
+
+       Tests for module 'copysign'.
+       * modules/copysign-tests: New file.
+       * tests/test-copysign.c: New file.
+
+       Tests for module 'cbrt'.
+       * modules/cbrt-tests: New file.
+       * tests/test-cbrt.c: New file.
+
+       Tests for module 'atan2'.
+       * modules/atan2-tests: New file.
+       * tests/test-atan2.c: New file.
+
+       Tests for module 'atan'.
+       * modules/atan-tests: New file.
+       * tests/test-atan.c: New file.
+
+       Tests for module 'asin'.
+       * modules/asin-tests: New file.
+       * tests/test-asin.c: New file.
+
+       Tests for module 'acos'.
+       * modules/acos-tests: New file.
+       * tests/test-acos.c: New file.
+
+2010-01-24  Bruno Haible  <bruno@clisp.org>
+
+       Fix tests for common <math.h> functions.
+       * m4/mathfunc.m4 (gl_MATHFUNC): Take two additional parameters. Use a
+       code snippet that references the function pointer, rather than merely
+       calling the function. Substitute the FUNC_LIBM variable.
+       * m4/sqrt.m4 (gl_FUNC_SQRT): Update gl_MATHFUNC invocation.
+       * modules/acos (configure.ac): Likewise.
+       * modules/asin (configure.ac): Likewise.
+       * modules/atan (configure.ac): Likewise.
+       * modules/atan2 (configure.ac): Likewise.
+       * modules/cbrt (configure.ac): Likewise.
+       * modules/copysign (configure.ac): Likewise.
+       * modules/cos (configure.ac): Likewise.
+       * modules/cosh (configure.ac): Likewise.
+       * modules/erf (configure.ac): Likewise.
+       * modules/erfc (configure.ac): Likewise.
+       * modules/exp (configure.ac): Likewise.
+       * modules/fabs (configure.ac): Likewise.
+       * modules/fmod (configure.ac): Likewise.
+       * modules/hypot (configure.ac): Likewise.
+       * modules/j0 (configure.ac): Likewise.
+       * modules/j1 (configure.ac): Likewise.
+       * modules/jn (configure.ac): Likewise.
+       * modules/ldexp (configure.ac): Likewise.
+       * modules/lgamma (configure.ac): Likewise.
+       * modules/log (configure.ac): Likewise.
+       * modules/log10 (configure.ac): Likewise.
+       * modules/log1p (configure.ac): Likewise.
+       * modules/logb (configure.ac): Likewise.
+       * modules/modf (configure.ac): Likewise.
+       * modules/nextafter (configure.ac): Likewise.
+       * modules/pow (configure.ac): Likewise.
+       * modules/remainder (configure.ac): Likewise.
+       * modules/rint (configure.ac): Likewise.
+       * modules/sin (configure.ac): Likewise.
+       * modules/sinh (configure.ac): Likewise.
+       * modules/tan (configure.ac): Likewise.
+       * modules/tanh (configure.ac): Likewise.
+       * modules/y0 (configure.ac): Likewise.
+       * modules/y1 (configure.ac): Likewise.
+       * modules/yn (configure.ac): Likewise.
+
+2010-01-24  Bruno Haible  <bruno@clisp.org>
+
+       Tests: Defeat inlining of math functions by GCC >= 4.3.0.
+       * tests/test-acosl.c (x): New variable.
+       (main): Store argument in x and fetch it from x.
+       * tests/test-asinl.c (x): New variable.
+       (main): Store argument in x and fetch it from x.
+       * tests/test-atanl.c (x): New variable.
+       (main): Store argument in x and fetch it from x.
+       * tests/test-cosl.c (x): New variable.
+       (main): Store argument in x and fetch it from x.
+       * tests/test-expl.c (x): New variable.
+       (main): Store argument in x and fetch it from x.
+       * tests/test-logl.c (x): New variable.
+       (main): Store argument in x and fetch it from x.
+       * tests/test-sinl.c (x): New variable.
+       (main): Store argument in x and fetch it from x.
+       * tests/test-sqrtl.c (x): New variable.
+       (main): Store argument in x and fetch it from x.
+       * tests/test-tanl.c (x): New variable.
+       (main): Store argument in x and fetch it from x.
+
+2010-01-24  Bruno Haible  <bruno@clisp.org>
+
+       Provide EXEEXT and srcdir in TESTS_ENVIRONMENT by default.
+       * gnulib-tool (func_emit_tests_Makefile_am): Add EXEEXT and srcdir
+       assignments to the initial TESTS_ENVIRONMENT.
+       * doc/gnulib.texi (Unit test modules): Document it.
+       * modules/acl-tests (Makefile.am): Drop EXEEXT assignment from
+       TESTS_ENVIRONMENT.
+       * modules/btowc-tests (Makefile.am): Likewise.
+       * modules/c-stack-tests (Makefile.am): Likewise.
+       * modules/c-strcase-tests (Makefile.am): Likewise.
+       * modules/copy-file-tests (Makefile.am): Likewise.
+       * modules/mbmemcasecmp-tests (Makefile.am): Likewise.
+       * modules/mbmemcasecoll-tests (Makefile.am): Likewise.
+       * modules/mbrtowc-tests (Makefile.am): Likewise.
+       * modules/mbscasecmp-tests (Makefile.am): Likewise.
+       * modules/mbscasestr-tests (Makefile.am): Likewise.
+       * modules/mbschr-tests (Makefile.am): Likewise.
+       * modules/mbscspn-tests (Makefile.am): Likewise.
+       * modules/mbsinit-tests (Makefile.am): Likewise.
+       * modules/mbsncasecmp-tests (Makefile.am): Likewise.
+       * modules/mbsnrtowcs-tests (Makefile.am): Likewise.
+       * modules/mbspbrk-tests (Makefile.am): Likewise.
+       * modules/mbspcasecmp-tests (Makefile.am): Likewise.
+       * modules/mbsrchr-tests (Makefile.am): Likewise.
+       * modules/mbsrtowcs-tests (Makefile.am): Likewise.
+       * modules/mbsspn-tests (Makefile.am): Likewise.
+       * modules/mbsstr-tests (Makefile.am): Likewise.
+       * modules/nl_langinfo-tests (Makefile.am): Likewise.
+       * modules/unicase/locale-language-tests (Makefile.am): Likewise.
+       * modules/unistdio/u16-vasnprintf-tests (Makefile.am): Likewise.
+       * modules/unistdio/u32-vasnprintf-tests (Makefile.am): Likewise.
+       * modules/unistdio/u8-vasnprintf-tests (Makefile.am): Likewise.
+       * modules/unistdio/ulc-vasnprintf-tests (Makefile.am): Likewise.
+       * modules/uniwbrk/ulc-wordbreaks-tests (Makefile.am): Likewise.
+       * modules/vasnprintf-posix-tests (Makefile.am): Likewise.
+       * modules/wcrtomb-tests (Makefile.am): Likewise.
+       * modules/wcsnrtombs-tests (Makefile.am): Likewise.
+       * modules/wcsrtombs-tests (Makefile.am): Likewise.
+       * modules/quotearg-tests (Makefile.am): Drop EXEEXT and srcdir
+       assignments from TESTS_ENVIRONMENT.
+       * modules/argp-tests (Makefile.am): Drop TESTS_ENVIRONMENT
+       augmentation.
+       * modules/argp-version-etc-tests (Makefile.am): Likewise.
+       * modules/atexit-tests (Makefile.am): Likewise.
+       * modules/binary-io-tests (Makefile.am): Likewise.
+       * modules/closein-tests (Makefile.am): Likewise.
+       * modules/dprintf-posix-tests (Makefile.am): Likewise.
+       * modules/exclude-tests (Makefile.am): Likewise.
+       * modules/fflush-tests (Makefile.am): Likewise.
+       * modules/fpending-tests (Makefile.am): Likewise.
+       * modules/fprintf-posix-tests (Makefile.am): Likewise.
+       * modules/freadahead-tests (Makefile.am): Likewise.
+       * modules/freadptr-tests (Makefile.am): Likewise.
+       * modules/freadseek-tests (Makefile.am): Likewise.
+       * modules/fseek-tests (Makefile.am): Likewise.
+       * modules/fseeko-tests (Makefile.am): Likewise.
+       * modules/ftell-tests (Makefile.am): Likewise.
+       * modules/ftello-tests (Makefile.am): Likewise.
+       * modules/idpriv-drop-tests (Makefile.am): Likewise.
+       * modules/idpriv-droptemp-tests (Makefile.am): Likewise.
+       * modules/lseek-tests (Makefile.am): Likewise.
+       * modules/parse-duration-tests (Makefile.am): Likewise.
+       * modules/perror-tests (Makefile.am): Likewise.
+       * modules/pipe-filter-gi-tests (Makefile.am): Likewise.
+       * modules/pipe-filter-ii-tests (Makefile.am): Likewise.
+       * modules/pipe-tests (Makefile.am): Likewise.
+       * modules/pread-tests (Makefile.am): Likewise.
+       * modules/printf-posix-tests (Makefile.am): Likewise.
+       * modules/select-tests (Makefile.am): Likewise.
+       * modules/sigpipe-tests (Makefile.am): Likewise.
+       * modules/tsearch-tests (Makefile.am): Likewise.
+       * modules/unicase/ulc-casecmp-tests (Makefile.am): Likewise.
+       * modules/unicase/ulc-casecoll-tests (Makefile.am): Likewise.
+       * modules/uniname/uniname-tests (Makefile.am): Likewise.
+       * modules/uniwidth/width-tests (Makefile.am): Likewise.
+       * modules/vdprintf-posix-tests (Makefile.am): Likewise.
+       * modules/version-etc-tests (Makefile.am): Likewise.
+       * modules/vfprintf-posix-tests (Makefile.am): Likewise.
+       * modules/vprintf-posix-tests (Makefile.am): Likewise.
+       * modules/xalloc-die-tests (Makefile.am): Likewise.
+       * modules/xprintf-posix-tests (Makefile.am): Likewise.
+       * modules/xstrtoimax-tests (Makefile.am): Likewise.
+       * modules/xstrtol-tests (Makefile.am): Likewise.
+       * modules/xstrtoumax-tests (Makefile.am): Likewise.
+       * modules/yesno-tests (Makefile.am): Likewise.
+       Suggested by Jim Meyering.
+
+2010-01-24  Bruno Haible  <bruno@clisp.org>
+
+       More documentation.
+       * doc/gnulib.texi (Writing modules): New chapter.
+       (Miscellaneous Notes): Move sections "Comments" and "Header files" to
+       the new chapter.
+
+2010-01-24  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: do not prepend "./" after filtering
+       * top/maint.mk (_prepend_srcdir_prefix): New variable
+       (VC_LIST_EXCEPT): Use it to avoid prepending (post-filter)
+       "./" when $(srcdir) is ".".
+
+       define STREQ(a,b) consistently, removing useless parentheses
+       #define STREQ(a, b) (strcmp ((a), (b)) == 0) is over-parenthesized,
+       since the only risk is that "a" or "b" contains an unparenthesized
+       comma, but if either did that, STREQ would have 3 or more arguments.
+       Hence, #define STREQ(a, b) (strcmp (a, b) == 0) is better.
+       * lib/fts.c (STREQ): Remove unnecessary parentheses.
+       * lib/hash-triple.c (STREQ): Likewise.
+       * tests/test-argv-iter.c (STREQ): Use a and b, not s1 and s2.
+       * lib/getugroups.c (STREQ): Likewise.
+
+2010-01-23  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: fix syntax-check in a non-srcdir build directory
+       * top/maint.mk (_dot_escaped_srcdir): Remove erroneous backslash,
+       introduced in my 2010-01-21 commit, a6da6c45.  Reported by Eric Blake.
+
+2010-01-22  Jim Meyering  <meyering@redhat.com>
+
+       userspec: add unit tests
+       * tests/test-userspec.c: New file.
+       * modules/userspec-tests: Likewise.
+
+2010-01-21  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: handle source file names containing "." robustly
+       * top/maint.mk (_dot_escaped_srcdir): Define.
+       (VC_LIST): Use it in LHS of sed substitution.
+
+2010-01-21  Jiri Denemark  <jdenemar@redhat.com>
+
+       maint.mk: fix VC_LIST_EXCEPT for srcdir != builddir
+       * top/maint.mk (VC_LIST_EXCEPT): Preprocess the output of
+       $(VC_LIST) to remove a prefix of '$(srcdir)/', so that it works
+       from a non-srcdir build.
+
+2010-01-20  Eric Blake  <ebb9@byu.net>
+
+       warn-on-use: use instead of link-warning
+       * modules/stdio (Depends-on, Makefile.am): Drop link-warning.
+       * modules/unistd (Depends-on, Makefile.am): Likewise.
+       * modules/arpa_inet (Depends-on): Replace link-warning with
+       warn-on-use.
+       (Makefile.am): Update rules accordingly.
+       * modules/ctype (Depends-on, Makefile.am): Likewise.
+       * modules/dirent (Depends-on, Makefile.am): Likewise.
+       * modules/fcntl-h (Depends-on, Makefile.am): Likewise.
+       * modules/inttypes (Depends-on, Makefile.am): Likewise.
+       * modules/langinfo (Depends-on, Makefile.am): Likewise.
+       * modules/locale (Depends-on, Makefile.am): Likewise.
+       * modules/math (Depends-on, Makefile.am): Likewise.
+       * modules/search (Depends-on, Makefile.am): Likewise.
+       * modules/signal (Depends-on, Makefile.am): Likewise.
+       * modules/spawn (Depends-on, Makefile.am): Likewise.
+       * modules/stdlib (Depends-on, Makefile.am): Likewise.
+       * modules/string (Depends-on, Makefile.am): Likewise.
+       * modules/strings (Depends-on, Makefile.am): Likewise.
+       * modules/sys_file (Depends-on, Makefile.am): Likewise.
+       * modules/sys_ioctl (Depends-on, Makefile.am): Likewise.
+       * modules/sys_select (Depends-on, Makefile.am): Likewise.
+       * modules/sys_socket (Depends-on, Makefile.am): Likewise.
+       * modules/sys_stat (Depends-on, Makefile.am): Likewise.
+       * modules/sys_times (Depends-on, Makefile.am): Likewise.
+       * modules/sys_utsname (Depends-on, Makefile.am): Likewise.
+       * modules/wchar (Depends-on, Makefile.am): Likewise.
+       * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Check which functions
+       should be poisoned.
+       * m4/ctype.m4 (gl_CTYPE_H): Likewise.
+       * m4/dirent_h.m4 (gl_DIRENT_H): Likewise.
+       * m4/fcntl_h.m4 (gl_FCNTL_H): Likewise.
+       * m4/inttypes.m4 (gl_INTTYPES_H): Likewise.
+       * m4/langinfo_h.m4 (gl_LANGINFO_H): Likewise.
+       * m4/locale_h.m4 (gl_LOCALE_H): Likewise.
+       * m4/math_h.m4 (gl_MATH_H): Likewise.
+       * m4/search_h.m4 (gl_SEARCH_H): Likewise.
+       * m4/signal_h.m4 (gl_SIGNAL_H): Likewise.
+       * m4/spawn_h.m4 (gl_SPAWN_H): Likewise.
+       * m4/stdio_h.m4 (gl_STDIO_H): Likewise.
+       * m4/stdlib_h.m4 (gl_STDLIB_H): Likewise.
+       * m4/string_h.m4 (gl_HEADER_STRING_H_BODY): Likewise.
+       * m4/strings_h.m4 (gl_HEADER_STRINGS_H_BODY): Likewise.
+       * m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H_DEFAULTS): Likewise.
+       * m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise.
+       * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
+       * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise.
+       * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Likewise.
+       * m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise.
+       * m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H): Likewise.
+       * m4/unistd_h.m4 (gl_UNISTD_H): Likewise.
+       * m4/wchar.m4 (gl_WCHAR_H): Likewise.
+       * lib/arpa_inet.in.h: Use _GL_WARN_ON_USE instead of
+       GL_LINK_WARNING.
+       * lib/ctype.in.h: Likewise.
+       * lib/dirent.in.h: Likewise.
+       * lib/fcntl.in.h: Likewise.
+       * lib/inttypes.in.h: Likewise.
+       * lib/langinfo.in.h: Likewise.
+       * lib/locale.in.h: Likewise.
+       * lib/math.in.h: Likewise.
+       * lib/search.in.h: Likewise.
+       * lib/signal.in.h: Likewise.
+       * lib/spawn.in.h: Likewise.
+       * lib/stdio.in.h: Likewise.
+       * lib/stdlib.in.h: Likewise.
+       * lib/string.in.h: Likewise.
+       * lib/strings.in.h: Likewise.
+       * lib/sys_file.in.h: Likewise.
+       * lib/sys_ioctl.in.h: Likewise.
+       * lib/sys_select.in.h: Likewise.
+       * lib/sys_socket.in.h: Likewise.
+       * lib/sys_stat.in.h: Likewise.
+       * lib/sys_times.in.h: Likewise.
+       * lib/sys_utsname.in.h: Likewise.
+       * lib/unistd.in.h: Likewise.
+       * lib/wchar.in.h: Likewise.
+
+2010-01-20  Bruno Haible  <bruno@clisp.org>
+
+       Avoid duplicate -lm.
+       * m4/isnan.m4 (gl_ISNAN): Avoid duplicate -lm in $ISNAN_LIBM.
+       * m4/round.m4 (gl_FUNC_ROUND): Avoid duplicate -lm in $ROUND_LIBM.
+       * m4/roundf.m4 (gl_FUNC_ROUNDF): Avoid duplicate -lm in $ROUNDF_LIBM.
+       * m4/roundl.m4 (gl_FUNC_ROUNDL): Avoid duplicate -lm in $ROUNDL_LIBM.
+       * m4/acosl.m4 (gl_FUNC_ACOSL): Avoid duplicate -lm in $ACOSL_LIBM.
+       * m4/cosl.m4 (gl_FUNC_COSL): Avoid duplicate -lm in $COSL_LIBM.
+       * m4/logl.m4 (gl_FUNC_LOGL): Avoid duplicate -lm in $LOGL_LIBM.
+       * m4/sinl.m4 (gl_FUNC_SINL): Avoid duplicate -lm in $SINL_LIBM.
+       * m4/sqrtl.m4 (gl_FUNC_SQRTL): Avoid duplicate -lm in $SQRTL_LIBM.
+       * m4/tanl.m4 (gl_FUNC_TANL): Avoid duplicate -lm in $TANL_LIBM.
+       * m4/asinl.m4 (gl_FUNC_ASINL): Same change, for consistency.
+       * m4/atanl.m4 (gl_FUNC_ATANL): Likewise.
+       Reported by Paolo Bonzini.
+
+2010-01-19  Bruno Haible  <bruno@clisp.org>
+
+       langinfo, nl_langinfo: Relicense under LGPLv2+.
+       * modules/langinfo (License): Change to LGPLv2+.
+       * modules/nl_langinfo (License): Likewise.
+       Patch by David Lutterkort <lutter@redhat.com>.
+
+2010-01-19  Bruno Haible  <bruno@clisp.org>
+
+       Avoid compilation error with cc on OSF/1 5.1.
+       * lib/fcntl.in.h: Include <unistd.h> after the #include_next <fcntl.h>
+       statement, not before.
+       Reported by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
+
+2010-01-18  Bruno Haible  <bruno@clisp.org>
+
+       Avoid a link error due to the __printf__ symbol.
+       * lib/stdio.in.h (__attribute__): Define to empty also for gcc 2.5.x
+       and 2.6.x.
+       (__format__, __printf__): Remove definitions.
+       * lib/argp-fmtstream.h: Likewise.
+       * lib/argp.h: Likewise.
+       * lib/error.h: Likewise.
+       * lib/vasnprintf.h: Likewise.
+       * lib/xprintf.h: Likewise.
+       * lib/xvasprintf.h: Likewise.
+       Reported by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
+
+2010-01-18  Bruno Haible  <bruno@clisp.org>
+
+       Tests for module 'tanl'.
+       * modules/tanl-tests: New file.
+       * tests/test-tanl.c: New file.
+
+       Tests for module 'sqrtl'.
+       * modules/sqrtl-tests: New file.
+       * tests/test-sqrtl.c: New file.
+
+       Tests for module 'sinl'.
+       * modules/sinl-tests: New file.
+       * tests/test-sinl.c: New file.
+
+       Tests for module 'logl'.
+       * modules/logl-tests: New file.
+       * tests/test-logl.c: New file.
+
+       Tests for module 'expl'.
+       * modules/expl-tests: New file.
+       * tests/test-expl.c: New file.
+
+       Tests for module 'cosl'.
+       * modules/cosl-tests: New file.
+       * tests/test-cosl.c: New file.
+
+       Tests for module 'atanl'.
+       * modules/atanl-tests: New file.
+       * tests/test-atanl.c: New file.
+
+       Tests for module 'asinl'.
+       * modules/asinl-tests: New file.
+       * tests/test-asinl.c: New file.
+
+       Tests for module 'acosl'.
+       * modules/acosl-tests: New file.
+       * tests/test-acosl.c: New file.
+
+       New modules acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl, tanl.
+       * lib/math.in.h (acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl,
+       tanl): Use the standard gnulib idiom.
+       * lib/cosl.c: Don't include trigl.c and sincosl.c.
+       * lib/sinl.c: Likewise.
+       * lib/tanl.c: Don't include trigl.c.
+       (kernel_tanl): Make static.
+       * lib/sincosl.c: Include trigl.h first.
+       * lib/trigl.c: Likewise.
+       * m4/acosl.m4: New file.
+       * m4/asinl.m4: New file.
+       * m4/atanl.m4: New file.
+       * m4/cosl.m4: New file.
+       * m4/expl.m4: New file.
+       * m4/logl.m4: New file.
+       * m4/sinl.m4: New file.
+       * m4/sqrtl.m4: New file.
+       * m4/tanl.m4: New file.
+       * m4/mathl.m4: Remove file.
+       * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize GNULIB_* and HAVE_*
+       variables for acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl, tanl.
+       Don't initialize GNULIB_MATHL.
+       * modules/acosl: New file.
+       * modules/asinl: New file.
+       * modules/atanl: New file.
+       * modules/cosl: New file.
+       * modules/expl: New file.
+       * modules/logl: New file.
+       * modules/sinl: New file.
+       * modules/sqrtl: New file.
+       * modules/tanl: New file.
+       * modules/math (Makefile.am): Substitute GNULIB_* and HAVE_* variables
+       for acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl, tanl. Don't
+       substitute GNULIB_MATHL.
+       * modules/mathl: Rewritten.
+       * doc/posix-functions/acosl.texi: Mention the 'acosl' module.
+       * doc/posix-functions/asinl.texi: Mention the 'asinl' module.
+       * doc/posix-functions/atanl.texi: Mention the 'atanl' module.
+       * doc/posix-functions/cosl.texi: Mention the 'cosl' module.
+       * doc/posix-functions/expl.texi: Mention the 'expl' module.
+       * doc/posix-functions/logl.texi: Mention the 'logl' module.
+       * doc/posix-functions/sinl.texi: Mention the 'sinl' module.
+       * doc/posix-functions/sqrtl.texi: Mention the 'sqrtl' module.
+       * doc/posix-functions/tanl.texi: Mention the 'tanl' module.
+
+2010-01-18  Bruno Haible  <bruno@clisp.org>
+
+       sqrt: Make gl_FUNC_SQRT requirable.
+       * m4/sqrt.m4: New file.
+       * modules/sqrt (Files): Add it.
+       (configure.ac): Invoke gl_FUNC_SQRT.
+
+2010-01-18  Bruno Haible  <bruno@clisp.org>
+
+       New modules for common <math.h> functions.
+       * m4/mathfunc.m4: New file.
+       * modules/acos: New file.
+       * modules/asin: New file.
+       * modules/atan: New file.
+       * modules/atan2: New file.
+       * modules/cbrt: New file.
+       * modules/copysign: New file.
+       * modules/cos: New file.
+       * modules/cosh: New file.
+       * modules/erf: New file.
+       * modules/erfc: New file.
+       * modules/exp: New file.
+       * modules/fabs: New file.
+       * modules/fmod: New file.
+       * modules/hypot: New file.
+       * modules/j0: New file.
+       * modules/j1: New file.
+       * modules/jn: New file.
+       * modules/ldexp: New file.
+       * modules/lgamma: New file.
+       * modules/log: New file.
+       * modules/log10: New file.
+       * modules/log1p: New file.
+       * modules/logb: New file.
+       * modules/modf: New file.
+       * modules/nextafter: New file.
+       * modules/pow: New file.
+       * modules/remainder: New file.
+       * modules/rint: New file.
+       * modules/sin: New file.
+       * modules/sinh: New file.
+       * modules/sqrt: New file.
+       * modules/tan: New file.
+       * modules/tanh: New file.
+       * modules/y0: New file.
+       * modules/y1: New file.
+       * modules/yn: New file.
+       * doc/posix-functions/acos.texi: Mention the 'acos' module.
+       * doc/posix-functions/asin.texi: Mention the 'asin' module.
+       * doc/posix-functions/atan.texi: Mention the 'atan' module.
+       * doc/posix-functions/atan2.texi: Mention the 'atan2' module.
+       * doc/posix-functions/cbrt.texi: Mention the 'cbrt' module.
+       * doc/posix-functions/copysign.texi: Mention the 'copysign' module.
+       * doc/posix-functions/cos.texi: Mention the 'cos' module.
+       * doc/posix-functions/cosh.texi: Mention the 'cosh' module.
+       * doc/posix-functions/erf.texi: Mention the 'erf' module.
+       * doc/posix-functions/erfc.texi: Mention the 'erfc' module.
+       * doc/posix-functions/exp.texi: Mention the 'exp' module.
+       * doc/posix-functions/fabs.texi: Mention the 'fabs' module.
+       * doc/posix-functions/fmod.texi: Mention the 'fmod' module.
+       * doc/posix-functions/hypot.texi: Mention the 'hypot' module.
+       * doc/posix-functions/j0.texi: Mention the 'j0' module.
+       * doc/posix-functions/j1.texi: Mention the 'j1' module.
+       * doc/posix-functions/jn.texi: Mention the 'jn' module.
+       * doc/posix-functions/ldexp.texi: Mention the 'ldexp' module.
+       * doc/posix-functions/lgamma.texi: Mention the 'lgamma' module.
+       * doc/posix-functions/log.texi: Mention the 'log' module.
+       * doc/posix-functions/log10.texi: Mention the 'log10' module.
+       * doc/posix-functions/log1p.texi: Mention the 'log1p' module.
+       * doc/posix-functions/logb.texi: Mention the 'logb' module.
+       * doc/posix-functions/modf.texi: Mention the 'modf' module.
+       * doc/posix-functions/nextafter.texi: Mention the 'nextafter' module.
+       * doc/posix-functions/pow.texi: Mention the 'pow' module.
+       * doc/posix-functions/remainder.texi: Mention the 'remainder' module.
+       * doc/posix-functions/rint.texi: Mention the 'rint' module.
+       * doc/posix-functions/sin.texi: Mention the 'sin' module.
+       * doc/posix-functions/sinh.texi: Mention the 'sinh' module.
+       * doc/posix-functions/sqrt.texi: Mention the 'sqrt' module.
+       * doc/posix-functions/tan.texi: Mention the 'tan' module.
+       * doc/posix-functions/tanh.texi: Mention the 'tanh' module.
+       * doc/posix-functions/y0.texi: Mention the 'y0' module.
+       * doc/posix-functions/y1.texi: Mention the 'y1' module.
+       * doc/posix-functions/yn.texi: Mention the 'yn' module.
+
+2010-01-18  Jim Meyering  <meyering@redhat.com>
+
+       ignore-value: relax license to LGPLv2+
+       * modules/ignore-value (License): Relax to LGPLv2+.
+
+       getdate: don't leak when TZ contains two or more '"'s
+       * lib/getdate.y (get_date): Don't leak a copy of TZ for each
+       double quote in TZ after the first one.
+
+       readtokens: do not leak internal token_lengths buffer
+       * lib/readtokens.c (readtokens): Free the local, lengths,
+       when the supplied "token_lengths" parameter is NULL.
+
+2010-01-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix a couple of missing LIBTHREAD link failures on AIX.
+       * modules/git-merge-changelog (git_merge_changelog_LDADD): Add
+       $(LIBTHREAD).
+       * modules/strsignal-tests (test_strsignal_LDADD): Likewise.
+
+       Link test-poll against INET_PTON_LIB.
+       * modules/poll-tests (test_poll_LDADD): Add $(INET_PTON_LIB),
+       for inet_pton on Solaris 10.
+
+2010-01-17  Bruno Haible  <bruno@clisp.org>
+
+       unistdio/*-sprintf: Fix typo in module description.
+       * modules/unistdio/u8-sprintf (Depends-on): Fix typo.
+       * modules/unistdio/u8-u8-sprintf (Depends-on): Likewise.
+       * modules/unistdio/u16-sprintf (Depends-on): Likewise.
+       * modules/unistdio/u16-u16-sprintf (Depends-on): Likewise.
+       * modules/unistdio/u32-sprintf (Depends-on): Likewise.
+       * modules/unistdio/u32-u32-sprintf (Depends-on): Likewise.
+       * modules/unistdio/ulc-sprintf (Depends-on): Likewise.
+       Reported by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
+
+2010-01-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       gnulib-tool: fix filelist for AIX, HP-UX ksh.
+       * gnulib-tool (func_filter_filelist): Do not quote possibly-empty
+       variables in shell case patterns, for AIX and HP-UX ksh.
+
+       Split large sed scripts, for HP-UX sed.
+       * modules/stdio: Split sed scripts around 50 sed commands,
+       to avoid HP-UX limit of 99 commands, in the near future.
+       * modules/string: Likewise.
+       * modules/unistd: Likewise.
+
+       gnulib-tool: avoid writing in the current directory.
+       * gnulib-tool (func_emit_lib_Makefile_am)
+       (func_emit_tests_Makefile_am): Put temporary files in $tmp,
+       not in the current directory, so concurrent gnulib-tool
+       instances do not interfere.
+
+2010-01-16  Jim Meyering  <meyering@redhat.com>
+
+       doc: update users.txt
+       * users.txt: Add grep.
+       (diffutils, gzip): Update URLs.
+
+2010-01-12  Bruno Haible  <bruno@clisp.org>
+
+       posix_spawn: Avoid test failure on Cygwin.
+       * tests/test-posix_spawn3.c (DATA_FILENAME) [CYGWIN]: Use less risky
+       characters.
+       Reported by Simon Josefsson.
+
+2010-01-12  Bruno Haible  <bruno@clisp.org>
+
+       * tests/test-cond.c (main): When skipping the test, show the reason.
+
+2010-01-12  Simon Josefsson  <simon@josefsson.org>
+
+       * lib/striconv.c (str_cd_iconv): Avoid if before free.
+
+2010-01-12  Simon Josefsson  <simon@josefsson.org>
+
+       * top/maint.mk (VC_LIST_EXCEPT): Filter list through
+       VC_LIST_ALWAYS_EXCLUDE_REGEX.
+
+2010-01-12  Eric Blake  <ebb9@byu.net>
+
+       build: guarantee AS_VAR_IF
+       * m4/warnings.m4 (gl_WARN_ADD): Use autoconf name.
+       (gl_AS_VAR_IF): Move...
+       * m4/gnulib-common.m4 (AS_VAR_IF): ...here.
+       Reported by Simon Josefsson.
+
+2010-01-12  Simon Josefsson  <simon@josefsson.org>
+
+       * lib/stdio.in.h: Fix typo.
+
+2010-01-12  Simon Josefsson  <simon@josefsson.org>
+
+       * m4/gc.m4: Check if linking to libgcrypt also needs linking to
+       libgpg-error.
+
+2010-01-12  Simon Josefsson  <simon@josefsson.org>
+
+       * tests/test-xalloc-die.sh: Use $EXEEXT.
+
+2010-01-12  Simon Josefsson  <simon@josefsson.org>
+           Bruno Haible  <bruno@clisp.org>
+
+       getlogin, getlogin_r: Avoid test failure.
+       * tests/test-getlogin.c: Include <stdio.h>.
+       (main): Skip the test when the function fails because stdin is not a
+       tty.
+       * tests/test-getlogin_r.c: Include <stdio.h>.
+       (main): Skip the test when the function fails because stdin is not a
+       tty.
+
+2010-01-11  Eric Blake  <ebb9@byu.net>
+
+       tests: avoid more large file warnings
+       * tests/test-fflush.c: Avoid warning about ftell use.
+       * tests/test-fseek.c: Avoid warning about fseek use.
+
+2010-01-10  Bruno Haible  <bruno@clisp.org>
+
+       nproc: Work better on Linux when /proc and /sys are not mounted.
+       * lib/nproc.c (num_processors): Use num_processors_via_affinity_mask ()
+       as lower bound when, on glibc/Linux systems,
+       sysconf (_SC_NPROCESSORS_CONF) returns 1.
+       Suggested by Pádraig Brady <P@draigbrady.com>.
+       Reported by Dmitry V. Levin <ldv@altlinux.org>.
+
+       nproc: Refactor.
+       * lib/nproc.c (num_processors_via_affinity_mask): New function,
+       extracted from num_processors.
+       (num_processors): Call it.
+
+2010-01-11  Jim Meyering  <meyering@redhat.com>
+
+       utimecmp: avoid new warning from upcoming gcc-4.5.0
+       * lib/utimecmp.c (BILLION): Define using #define rather than an
+       anonymous enum, to placate upcoming gcc-4.5.0's -Wenum-compare.
+
+2010-01-11  Eric Blake  <ebb9@byu.net>
+
+       math: add portability warnings for classification macros
+       * modules/math (Depends-on): Add warn-on-use.
+       (Makefile.am): Provide new substitutions.
+       * m4/math_h.m4 (gl_MATH_H): Require inline.
+       * lib/math.in.h (_GL_WARN_REAL_FLOATING_DECL)
+       (_GL_WARN_REAL_FLOATING_IMPL): New helper macros.
+       (isfinite, isinf, isnan, signbit) [GNULIB_POSIXCHECK]: Use them to
+       implement warnings.
+
+       unistd: warn on use of environ without module
+       * modules/unistd (Depends-on): Add warn-on-use.
+       (Makefile.am): Provide new substitutions.
+       * m4/unistd_h.m4 (gl_UNISTD_H): Check for inline and environ.
+       * lib/unistd.in.h (environ): Wrap with a warning helper function.
+
+       stdio: warn on suspicious uses
+       * modules/stdio (Depends-on): Add warn-on-use.
+       (Makefile.am): Provide new substitutions.
+       * m4/stdio_h.m4 (gl_STDIO_H): Check for inline, ftello, and
+       fseeko.
+       * lib/stdio.in.h (gets): Always warn on use.
+       (fseek, ftell): Adjust when warnings are issued, and honor
+       _GL_NO_LARGE_FILES as a way to silence the warning.
+       * tests/test-fpurge.c [!GNULIB_FSEEK]: Use new means to squelch
+       any warning about large file offsets.
+       * tests/test-freadable.c [!GNULIB_FSEEK]: Likewise.
+       * tests/test-freading.c [!GNULIB_FSEEK]: Likewise.
+       * tests/test-fseeko.c [!GNULIB_FSEEK]: Likewise.
+       * tests/test-ftell.c [!GNULIB_FSEEK]: Likewise.
+       * tests/test-ftello.c [!GNULIB_FSEEK]: Likewise.
+       * tests/test-fwritable.c [!GNULIB_FSEEK]: Likewise.
+       * tests/test-fwriting.c [!GNULIB_FSEEK]: Likewise.
+       * tests/test-getopt.c [!GNULIB_FTELL]: Likewise.
+
+       warn-on-use: new module
+       * modules/warn-on-use: New file.
+       * build-aux/warn-on-use.h: Likewise.
+       * m4/warn-on-use.m4: Likewise.
+       * MODULES.html.sh (Support for building): Mention it.
+
+2010-01-10  Bruno Haible  <bruno@clisp.org>
+
+       Tests for module 'unistr/u32-strdup'.
+       * modules/unistr/u32-strdup-tests: New file.
+       * tests/unistr/test-u32-strdup.c: New file.
+
+       Tests for module 'unistr/u16-strdup'.
+       * modules/unistr/u16-strdup-tests: New file.
+       * tests/unistr/test-u16-strdup.c: New file.
+
+       Tests for module 'unistr/u8-strdup'.
+       * modules/unistr/u8-strdup-tests: New file.
+       * tests/unistr/test-u8-strdup.c: New file.
+       * tests/unistr/test-strdup.h: New file.
+
+       Tests for module 'unistr/u32-strncmp'.
+       * modules/unistr/u32-strncmp-tests: New file.
+       * tests/unistr/test-u32-strncmp.c: New file.
+
+       Tests for module 'unistr/u16-strncmp'.
+       * modules/unistr/u16-strncmp-tests: New file.
+       * tests/unistr/test-u16-strncmp.c: New file.
+
+       Tests for module 'unistr/u8-strncmp'.
+       * modules/unistr/u8-strncmp-tests: New file.
+       * tests/unistr/test-u8-strncmp.c: New file.
+       * tests/unistr/test-strncmp.h: New file.
+
+       Tests for module 'unistr/u32-strcoll'.
+       * modules/unistr/u32-strcoll-tests: New file.
+       * tests/unistr/test-u32-strcoll.c: New file.
+
+       Tests for module 'unistr/u16-strcoll'.
+       * modules/unistr/u16-strcoll-tests: New file.
+       * tests/unistr/test-u16-strcoll.c: New file.
+
+       Tests for module 'unistr/u8-strcoll'.
+       * modules/unistr/u8-strcoll-tests: New file.
+       * tests/unistr/test-u8-strcoll.c: New file.
+
+       Tests for module 'unistr/u32-strcmp'.
+       * modules/unistr/u32-strcmp-tests: New file.
+       * tests/unistr/test-u32-strcmp.c: New file.
+       * tests/unistr/test-u32-strcmp.h: New file.
+
+       Tests for module 'unistr/u16-strcmp'.
+       * modules/unistr/u16-strcmp-tests: New file.
+       * tests/unistr/test-u16-strcmp.c: New file.
+       * tests/unistr/test-u16-strcmp.h: New file.
+
+       Tests for module 'unistr/u8-strcmp'.
+       * modules/unistr/u8-strcmp-tests: New file.
+       * tests/unistr/test-u8-strcmp.c: New file.
+       * tests/unistr/test-u8-strcmp.h: New file.
+       * tests/unistr/test-strcmp.h: New file.
+
+       Tests for module 'unistr/u32-strncat'.
+       * modules/unistr/u32-strncat-tests: New file.
+       * tests/unistr/test-u32-strncat.c: New file.
+
+       Tests for module 'unistr/u16-strncat'.
+       * modules/unistr/u16-strncat-tests: New file.
+       * tests/unistr/test-u16-strncat.c: New file.
+
+       Tests for module 'unistr/u8-strncat'.
+       * modules/unistr/u8-strncat-tests: New file.
+       * tests/unistr/test-u8-strncat.c: New file.
+       * tests/unistr/test-strncat.h: New file.
+
+       Tests for module 'unistr/u32-strcat'.
+       * modules/unistr/u32-strcat-tests: New file.
+       * tests/unistr/test-u32-strcat.c: New file.
+
+       Tests for module 'unistr/u16-strcat'.
+       * modules/unistr/u16-strcat-tests: New file.
+       * tests/unistr/test-u16-strcat.c: New file.
+
+       Tests for module 'unistr/u8-strcat'.
+       * modules/unistr/u8-strcat-tests: New file.
+       * tests/unistr/test-u8-strcat.c: New file.
+       * tests/unistr/test-strcat.h: New file.
+
+       Tests for module 'unistr/u32-stpncpy'.
+       * modules/unistr/u32-stpncpy-tests: New file.
+       * tests/unistr/test-u32-stpncpy.c: New file.
+
+       Tests for module 'unistr/u16-stpncpy'.
+       * modules/unistr/u16-stpncpy-tests: New file.
+       * tests/unistr/test-u16-stpncpy.c: New file.
+
+       Tests for module 'unistr/u8-stpncpy'.
+       * modules/unistr/u8-stpncpy-tests: New file.
+       * tests/unistr/test-u8-stpncpy.c: New file.
+       * tests/unistr/test-stpncpy.h: New file.
+
+       Tests for module 'unistr/u32-strncpy'.
+       * modules/unistr/u32-strncpy-tests: New file.
+       * tests/unistr/test-u32-strncpy.c: New file.
+
+       Tests for module 'unistr/u16-strncpy'.
+       * modules/unistr/u16-strncpy-tests: New file.
+       * tests/unistr/test-u16-strncpy.c: New file.
+
+       Tests for module 'unistr/u8-strncpy'.
+       * modules/unistr/u8-strncpy-tests: New file.
+       * tests/unistr/test-u8-strncpy.c: New file.
+       * tests/unistr/test-strncpy.h: New file.
+
+       Tests for module 'unistr/u32-stpcpy'.
+       * modules/unistr/u32-stpcpy-tests: New file.
+       * tests/unistr/test-u32-stpcpy.c: New file.
+
+       Tests for module 'unistr/u16-stpcpy'.
+       * modules/unistr/u16-stpcpy-tests: New file.
+       * tests/unistr/test-u16-stpcpy.c: New file.
+
+       Tests for module 'unistr/u8-stpcpy'.
+       * modules/unistr/u8-stpcpy-tests: New file.
+       * tests/unistr/test-u8-stpcpy.c: New file.
+       * tests/unistr/test-stpcpy.h: New file.
+
+       Tests for module 'unistr/u32-strcpy'.
+       * modules/unistr/u32-strcpy-tests: New file.
+       * tests/unistr/test-u32-strcpy.c: New file.
+
+       Tests for module 'unistr/u16-strcpy'.
+       * modules/unistr/u16-strcpy-tests: New file.
+       * tests/unistr/test-u16-strcpy.c: New file.
+
+       Tests for module 'unistr/u8-strcpy'.
+       * modules/unistr/u8-strcpy-tests: New file.
+       * tests/unistr/test-u8-strcpy.c: New file.
+       * tests/unistr/test-strcpy.h: New file.
+
+       Tests for module 'unistr/u32-strnlen'.
+       * modules/unistr/u32-strnlen-tests: New file.
+       * tests/unistr/test-u32-strnlen.c: New file.
+
+       Tests for module 'unistr/u16-strnlen'.
+       * modules/unistr/u16-strnlen-tests: New file.
+       * tests/unistr/test-u16-strnlen.c: New file.
+
+       Tests for module 'unistr/u8-strnlen'.
+       * modules/unistr/u8-strnlen-tests: New file.
+       * tests/unistr/test-u8-strnlen.c: New file.
+       * tests/unistr/test-strnlen.h: New file.
+
+       Tests for module 'unistr/u32-strlen'.
+       * modules/unistr/u32-strlen-tests: New file.
+       * tests/unistr/test-u32-strlen.c: New file.
+
+       Tests for module 'unistr/u16-strlen'.
+       * modules/unistr/u16-strlen-tests: New file.
+       * tests/unistr/test-u16-strlen.c: New file.
+
+       Tests for module 'unistr/u8-strlen'.
+       * modules/unistr/u8-strlen-tests: New file.
+       * tests/unistr/test-u8-strlen.c: New file.
+
+       Tests for module 'unistr/u32-prev'.
+       * modules/unistr/u32-prev-tests: New file.
+       * tests/unistr/test-u32-prev.c: New file.
+
+       Tests for module 'unistr/u16-prev'.
+       * modules/unistr/u16-prev-tests: New file.
+       * tests/unistr/test-u16-prev.c: New file.
+
+       Tests for module 'unistr/u8-prev'.
+       * modules/unistr/u8-prev-tests: New file.
+       * tests/unistr/test-u8-prev.c: New file.
+
+       Tests for module 'unistr/u32-next'.
+       * modules/unistr/u32-next-tests: New file.
+       * tests/unistr/test-u32-next.c: New file.
+
+       Tests for module 'unistr/u16-next'.
+       * modules/unistr/u16-next-tests: New file.
+       * tests/unistr/test-u16-next.c: New file.
+
+       Tests for module 'unistr/u8-next'.
+       * modules/unistr/u8-next-tests: New file.
+       * tests/unistr/test-u8-next.c: New file.
+
+       Tests for module 'unistr/u32-strmbtouc'.
+       * modules/unistr/u32-strmbtouc-tests: New file.
+       * tests/unistr/test-u32-strmbtouc.c: New file.
+
+       Tests for module 'unistr/u16-strmbtouc'.
+       * modules/unistr/u16-strmbtouc-tests: New file.
+       * tests/unistr/test-u16-strmbtouc.c: New file.
+
+       Tests for module 'unistr/u8-strmbtouc'.
+       * modules/unistr/u8-strmbtouc-tests: New file.
+       * tests/unistr/test-u8-strmbtouc.c: New file.
+
+       Tests for module 'unistr/u32-strmblen'.
+       * modules/unistr/u32-strmblen-tests: New file.
+       * tests/unistr/test-u32-strmblen.c: New file.
+
+       Tests for module 'unistr/u16-strmblen'.
+       * modules/unistr/u16-strmblen-tests: New file.
+       * tests/unistr/test-u16-strmblen.c: New file.
+
+       Tests for module 'unistr/u8-strmblen'.
+       * modules/unistr/u8-strmblen-tests: New file.
+       * tests/unistr/test-u8-strmblen.c: New file.
+
+       Tests for module 'unistr/u32-cpy-alloc'.
+       * modules/unistr/u32-cpy-alloc-tests: New file.
+       * tests/unistr/test-u32-cpy-alloc.c: New file.
+
+       Tests for module 'unistr/u16-cpy-alloc'.
+       * modules/unistr/u16-cpy-alloc-tests: New file.
+       * tests/unistr/test-u16-cpy-alloc.c: New file.
+
+       Tests for module 'unistr/u8-cpy-alloc'.
+       * modules/unistr/u8-cpy-alloc-tests: New file.
+       * tests/unistr/test-u8-cpy-alloc.c: New file.
+       * tests/unistr/test-cpy-alloc.h: New file.
+
+       Tests for module 'unistr/u32-mbsnlen'.
+       * modules/unistr/u32-mbsnlen-tests: New file.
+       * tests/unistr/test-u32-mbsnlen.c: New file.
+
+       Tests for module 'unistr/u16-mbsnlen'.
+       * modules/unistr/u16-mbsnlen-tests: New file.
+       * tests/unistr/test-u16-mbsnlen.c: New file.
+
+       Tests for module 'unistr/u8-mbsnlen'.
+       * modules/unistr/u8-mbsnlen-tests: New file.
+       * tests/unistr/test-u8-mbsnlen.c: New file.
+
+       Tests for module 'unistr/u32-chr'.
+       * modules/unistr/u32-chr-tests: New file.
+       * tests/unistr/test-u32-chr.c: New file.
+
+       Tests for module 'unistr/u16-chr'.
+       * modules/unistr/u16-chr-tests: New file.
+       * tests/unistr/test-u16-chr.c: New file.
+
+       Tests for module 'unistr/u8-chr'.
+       * modules/unistr/u8-chr-tests: New file.
+       * tests/unistr/test-u8-chr.c: New file.
+       * tests/unistr/test-chr.h: New file, based on tests/test-memchr.c.
+
+       Tests for module 'unistr/u32-cmp2'.
+       * modules/unistr/u32-cmp2-tests: New file.
+       * tests/unistr/test-u32-cmp2.c: New file.
+
+       Tests for module 'unistr/u16-cmp2'.
+       * modules/unistr/u16-cmp2-tests: New file.
+       * tests/unistr/test-u16-cmp2.c: New file.
+
+       Tests for module 'unistr/u8-cmp2'.
+       * modules/unistr/u8-cmp2-tests: New file.
+       * tests/unistr/test-u8-cmp2.c: New file.
+       * tests/unistr/test-cmp2.h: New file, based on tests/unistr/test-cmp.h.
+
+       Tests for module 'unistr/u32-cmp'.
+       * modules/unistr/u32-cmp-tests: New file.
+       * tests/unistr/test-u32-cmp.c: New file.
+
+       Tests for module 'unistr/u16-cmp'.
+       * modules/unistr/u16-cmp-tests: New file.
+       * tests/unistr/test-u16-cmp.c: New file.
+
+       Tests for module 'unistr/u8-cmp'.
+       * modules/unistr/u8-cmp-tests: New file.
+       * tests/unistr/test-u8-cmp.c: New file.
+       * tests/unistr/test-cmp.h: New file, based on tests/test-memcmp.c.
+
+       Tests for module 'unistr/u32-set'.
+       * modules/unistr/u32-set-tests: New file.
+       * tests/unistr/test-u32-set.c: New file.
+
+       Tests for module 'unistr/u16-set'.
+       * modules/unistr/u16-set-tests: New file.
+       * tests/unistr/test-u16-set.c: New file.
+
+       Tests for module 'unistr/u8-set'.
+       * modules/unistr/u8-set-tests: New file.
+       * tests/unistr/test-u8-set.c: New file.
+       * tests/unistr/test-set.h: New file.
+
+       Tests for module 'unistr/u32-move'.
+       * modules/unistr/u32-move-tests: New file.
+       * tests/unistr/test-u32-move.c: New file.
+
+       Tests for module 'unistr/u16-move'.
+       * modules/unistr/u16-move-tests: New file.
+       * tests/unistr/test-u16-move.c: New file.
+
+       Tests for module 'unistr/u8-move'.
+       * modules/unistr/u8-move-tests: New file.
+       * tests/unistr/test-u8-move.c: New file.
+       * tests/unistr/test-move.h: New file.
+
+       Tests for module 'unistr/u32-cpy'.
+       * modules/unistr/u32-cpy-tests: New file.
+       * tests/unistr/test-u32-cpy.c: New file.
+
+       Tests for module 'unistr/u16-cpy'.
+       * modules/unistr/u16-cpy-tests: New file.
+       * tests/unistr/test-u16-cpy.c: New file.
+
+       Tests for module 'unistr/u8-cpy'.
+       * modules/unistr/u8-cpy-tests: New file.
+       * tests/unistr/test-u8-cpy.c: New file.
+       * tests/unistr/test-cpy.h: New file.
+
+2010-01-09  Bruno Haible  <bruno@clisp.org>
+
+       Tests for module 'unistr/u32-uctomb'.
+       * modules/unistr/u32-uctomb-tests: New file.
+       * tests/unistr/test-u32-uctomb.c: New file.
+
+       Tests for module 'unistr/u16-uctomb'.
+       * modules/unistr/u16-uctomb-tests: New file.
+       * tests/unistr/test-u16-uctomb.c: New file.
+
+       Tests for module 'unistr/u8-uctomb'.
+       * modules/unistr/u8-uctomb-tests: New file.
+       * tests/unistr/test-u8-uctomb.c: New file.
+
+       Tests for module 'unistr/u32-mbtoucr'.
+       * modules/unistr/u32-mbtoucr-tests: New file.
+       * tests/unistr/test-u32-mbtoucr.c: New file.
+
+       Tests for module 'unistr/u16-mbtoucr'.
+       * modules/unistr/u16-mbtoucr-tests: New file.
+       * tests/unistr/test-u16-mbtoucr.c: New file.
+
+       Tests for module 'unistr/u8-mbtoucr'.
+       * modules/unistr/u8-mbtoucr-tests: New file.
+       * tests/unistr/test-u8-mbtoucr.c: New file.
+
+       Tests for module 'unistr/u32-mbtouc'.
+       * modules/unistr/u32-mbtouc-tests: New file.
+       * tests/unistr/test-u32-mbtouc.c: New file.
+
+       Tests for module 'unistr/u16-mbtouc'.
+       * modules/unistr/u16-mbtouc-tests: New file.
+       * tests/unistr/test-u16-mbtouc.c: New file.
+
+       Tests for module 'unistr/u8-mbtouc'.
+       * modules/unistr/u8-mbtouc-tests: New file.
+       * tests/unistr/test-u8-mbtouc.c: New file.
+
+       Tests for module 'unistr/u32-mbtouc-unsafe'.
+       * modules/unistr/u32-mbtouc-unsafe-tests: New file.
+       * tests/unistr/test-u32-mbtouc-unsafe.c: New file.
+       * tests/unistr/test-u32-mbtouc.h: New file.
+
+       Tests for module 'unistr/u16-mbtouc-unsafe'.
+       * modules/unistr/u16-mbtouc-unsafe-tests: New file.
+       * tests/unistr/test-u16-mbtouc-unsafe.c: New file.
+       * tests/unistr/test-u16-mbtouc.h: New file.
+
+       Tests for module 'unistr/u8-mbtouc-unsafe'.
+       * modules/unistr/u8-mbtouc-unsafe-tests: New file.
+       * tests/unistr/test-u8-mbtouc-unsafe.c: New file.
+       * tests/unistr/test-u8-mbtouc.h: New file.
+
+       Tests for module 'unistr/u32-mblen'.
+       * modules/unistr/u32-mblen-tests: New file.
+       * tests/unistr/test-u32-mblen.c: New file.
+
+       Tests for module 'unistr/u16-mblen'.
+       * modules/unistr/u16-mblen-tests: New file.
+       * tests/unistr/test-u16-mblen.c: New file.
+
+       Tests for module 'unistr/u8-mblen'.
+       * modules/unistr/u8-mblen-tests: New file.
+       * tests/unistr/test-u8-mblen.c: New file.
+
+       Tests for module 'unistr/u32-to-u16'.
+       * modules/unistr/u32-to-u16-tests: New file.
+       * tests/unistr/test-u32-to-u16.c: New file.
+
+       Tests for module 'unistr/u32-to-u8'.
+       * modules/unistr/u32-to-u8-tests: New file.
+       * tests/unistr/test-u32-to-u8.c: New file.
+
+       Tests for module 'unistr/u16-to-u32'.
+       * modules/unistr/u16-to-u32-tests: New file.
+       * tests/unistr/test-u16-to-u32.c: New file.
+
+       Tests for module 'unistr/u16-to-u8'.
+       * modules/unistr/u16-to-u8-tests: New file.
+       * tests/unistr/test-u16-to-u8.c: New file.
+
+       Tests for module 'unistr/u8-to-u32'.
+       * modules/unistr/u8-to-u32-tests: New file.
+       * tests/unistr/test-u8-to-u32.c: New file.
+
+       Tests for module 'unistr/u8-to-u16'.
+       * modules/unistr/u8-to-u16-tests: New file.
+       * tests/unistr/test-u8-to-u16.c: New file.
+
+       Tests for module 'unistr/u32-check'.
+       * modules/unistr/u32-check-tests: New file.
+       * tests/unistr/test-u32-check.c: New file.
+
+       Tests for module 'unistr/u16-check'.
+       * modules/unistr/u16-check-tests: New file.
+       * tests/unistr/test-u16-check.c: New file.
+
+       Tests for module 'unistr/u8-check'.
+       * modules/unistr/u8-check-tests: New file.
+       * tests/unistr/test-u8-check.c: New file.
+
+       * tests/unictype/test-categ_byname.c: Include <stdbool.h>.
+       (category_equals): New function.
+       (main): Add more tests.
+       * modules/unictype/category-byname-tests (Depends-on): Add stdbool.
+
+       * tests/unictype/test-bidi_byname.c (main): Add more tests.
+
+2010-01-10  Bruno Haible  <bruno@clisp.org>
+
+       unistr/u*-strcoll: Try harder to distinguish different strings.
+       * lib/unistr/u-strcoll.h (FUNC): When sl1 and sl2 are the same,
+       compare s1 and s2 to see if they are different.
+
+2010-01-10  Bruno Haible  <bruno@clisp.org>
+
+       unistr/u*-stpncpy: Fix the return value.
+       * lib/unistr.h (u8_stpncpy, u16_stpncpy, u32_stpncpy): Make the
+       description of the return value consistent with stpncpy in glibc.
+       * lib/unistr/u-stpncpy.h (FUNC): Return the pointer past the last
+       written non-NUL unit.
+
+2010-01-10  Bruno Haible  <bruno@clisp.org>
+
+       unistr/u*-next: Add missing dependencies.
+       * modules/unistr/u8-next (Depends-on): Add unistr/u8-strmbtouc.
+       * modules/unistr/u16-next (Depends-on): Add unistr/u16-strmbtouc.
+       * modules/unistr/u32-next (Depends-on): Add unistr/u32-strmbtouc.
+
+2010-01-10  Bruno Haible  <bruno@clisp.org>
+
+       unistr/u8-mbsnlen: Fix return value for incomplete character.
+       * lib/unistr/u8-mbsnlen.c (u8_mbsnlen): Use u8_mbtoucr instead of
+       u8_mblen.
+       * modules/unistr/u8-mbsnlen (Depends-on): Add unistr/u8-mbtoucr.
+       Remove unistr/u8-mblen.
+       * lib/unistr/u16-mbsnlen.c (u16_mbsnlen): Use u16_mbtoucr instead of
+       u16_mblen.
+       * modules/unistr/u16-mbsnlen (Depends-on): Add unistr/u16-mbtoucr.
+       Remove unistr/u16-mblen.
+
+2010-01-10  Bruno Haible  <bruno@clisp.org>
+
+       wchar: Fix compilation error when <wchar.h> is used from coreutils.
+       * lib/wchar.in.h: Treat __need_wint_t like __need_mbstate_t.
+       Reported by Brian Gough <bjg@gnu.org> and
+       Chris Clayton <chris2553@googlemail.com> via
+       Mike Frysinger <vapier@gentoo.org> and Jim Meyering <jim@meyering.net>.
+
 2010-01-09  Bruno Haible  <bruno@clisp.org>
 
        unistr/u16-to-u32: Reject invalid input.
 
 2010-01-09  Bruno Haible  <bruno@clisp.org>
 
+       Tests for module 'getlogin'.
+       * modules/getlogin-tests: New file.
+       * tests/test-getlogin.c: New file.
+
+       New module 'getlogin'.
+       * lib/unistd.in.h (getlogin): New declaration.
+       * lib/getlogin.c: New file.
+       * m4/getlogin.m4: New file.
+       * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_GETLOGIN,
+       HAVE_GETLOGIN.
+       * modules/unistd (Makefile.am): Substitute GNULIB_GETLOGIN,
+       HAVE_GETLOGIN.
+       * modules/getlogin: New file.
+       * doc/posix-functions/getlogin.texi: Mention the new module.
+       Reported by John W. Eaton <jwe@gnu.org>.
+
+2010-01-09  Bruno Haible  <bruno@clisp.org>
+
        getlogin_r: Support for native Windows.
        * lib/getlogin_r.c: Include <windows.h>
        (getlogin_r): Implement for native Windows.
        * tests/test-getlogin_r.c (main): Also test with a huge buffer.
-       Reported by <tmacchant5@yahoo.co.jp> via John W. Eaton <jwe@gnu.org>.
+       Reported by Tatsuro MATSUOKA <tmacchant5@yahoo.co.jp>
+       via John W. Eaton <jwe@gnu.org>.
 
 2010-01-09  Bruno Haible  <bruno@clisp.org>
 
        * modules/getlogin_r-tests: New file.
        * tests/test-getlogin_r.c: New file.
 
+2010-01-09  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: extend proper_name_utf8-vs-LIBICONV-checking rule
+       * top/maint.mk (sc_proper_name_utf8_requires_ICONV): Adapt to work
+       also when $(LIBICONV) is part of LDADD, rather than ${prog}_LDADD.
+
 2010-01-08  Simon Josefsson  <simon@josefsson.org>
 
        * lib/dup2.c (rpl_dup2): Improve comment.
 
 2010-01-08  Eric Blake  <ebb9@byu.net>
 
+       maint.mk: allow packages to add makefile @@ exceptions
+       * top/maint.mk (_makefile_at_at_check_exceptions): New hook.
+       (sc_makefile_check): Rename...
+       (sc_makefile_at_at_check): ...to this, and use hook.
+
        dup2: work around mingw bug
        * lib/dup2.c (rpl_dup2): Sanitize return value on mingw.
        Reported by Simon Josefsson.
index 5bbb18c..4c8cefa 100755 (executable)
@@ -1820,6 +1820,7 @@ func_all_modules ()
   func_module c-strtold
   func_module xstrtod
   func_module xstrtol
+  func_module xstrtoll
   func_module xstrtold
   func_end_table
 
@@ -3172,6 +3173,7 @@ func_all_modules ()
 
   func_begin_table
   func_module absolute-header
+  func_module arg-nonnull
   func_module config-h
   func_module configmake
   func_module dummy
@@ -3184,14 +3186,15 @@ func_all_modules ()
   func_module lib-msvc-compat
   func_module lib-symbol-versions
   func_module link-warning
+  func_module manywarnings
   func_module no-c++
   func_module relocatable-lib
   func_module relocatable-lib-lgpl
   func_module relocatable-prog
   func_module relocatable-prog-wrapper
   func_module relocatable-script
+  func_module warn-on-use
   func_module warnings
-  func_module manywarnings
   func_end_table
 
   element="Support for building documentation"
diff --git a/NEWS b/NEWS
index 72b2b58..ad639dd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2010-03-05  exit            This module is deprecated, use 'stdlib' directly
+                            instead.  It will be removed 2011-01-01.
+
 2009-12-13  sublist         The module does not define functions any more that
                             call xalloc_die() in out-of-memory situations. Use
                             module 'xsublist' and include file "gl_xsublist.h"
index 73de863..7bf79cc 100644 (file)
@@ -1,5 +1,30 @@
                        Gnulib stable snapshot
                        ----------------------
+  * 20100308-stable
+
+Snapshot taken based on:
+
+commit  4fc10daa05477586fea99b6b3ca02a87d1102fa1
+Date:   Mon Mar 1 22:09:44 2010 +0100
+
+with the following additional commits:
+
+    * [88baa1e]->[6681664] spawn: Don't override the system defined values on FreeBSD 8.
+    * [ca156dd]->[12e638f] copy-acl: enhance Solaris ACL error handling
+    * [fa93cea]->[fbe6ced] exit: Obsolete module, use stdlib instead.
+    * [eb6dce1]->[529ebff] exitfail: Relax license to LGPLv2.1+.  Drop exitfail.m4.
+    * [434627d]->[3dfb904] Prefer lib_SOURCES over unconditional AC_LIBOBJ.
+    * [032088a]->[99e99ca] euidaccess: relax license to LGPLv2+
+    * [3753983]->[51c9c87] Fix incorrect Makefile.am generation in German locale.
+    * [89e5b6b]->[6fde090] Clarify access, euidaccess, faccessat.
+    * [798f5bd]->[661fa69] Fix link error on platforms with GNU libiconv.
+    * [94a90dc]->[a62a0db] Exclude lib-ignore module.
+    * [fc980d5]->[9f46144] Fix test-dirent link error.
+    * [f19a2e5]->[2e4b5be] Fix test-dirent-safer link error. Correct last commit.
+    * [7d09cc8]->[c896764] Fix test-cond link error.
+
+----------------------------------------------------------------------
+
   * 20100109-stable
 
 Snapshot taken based on:
index 7781446..365a3d9 100755 (executable)
@@ -1,4 +1,6 @@
 #! /bin/sh
+# Print a version string.
+scriptversion=2010-02-24.17; # UTC
 
 # Bootstrap this package from checked-out sources.
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Written by Paul Eggert.
+# Originally written by Paul Eggert.  The canonical version of this
+# script is maintained as build-aux/bootstrap in gnulib, however, to
+# be useful to your project, you should place a copy of it under
+# version control in the top-level directory of your project.  The
+# intent is that all customization can be done with a bootstrap.conf
+# file also maintained in your version control; gnulib comes with a
+# template build-aux/bootstrap.conf to get you started.
+
+# Please report bugs or propose patches to bug-gnulib@gnu.org.
 
 nl='
 '
@@ -43,7 +53,7 @@ Options:
                           sources reside.  Use this if you already
                           have gnulib sources on your machine, and
                           do not want to waste your bandwidth downloading
-                          them again.
+                          them again.  Defaults to \$GNULIB_SRCDIR.
  --copy                   Copy files instead of creating symbolic links.
  --force                  Attempt to bootstrap even if the sources seem
                           not to have been checked out.
@@ -133,7 +143,8 @@ XGETTEXT_OPTIONS='\\\
  --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
 '
 
-# Package bug report address for gettext files
+# Package bug report address and copyright holder for gettext files
+COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
 MSGID_BUGS_ADDRESS=bug-$package@gnu.org
 
 # Files we don't want to import.
@@ -160,7 +171,6 @@ vc_ignore=auto
 # die otherwise.
 find_tool ()
 {
-  # Find sha1sum, named gsha1sum on MacPorts.
   find_tool_envvar=$1
   shift
   find_tool_names=$@
@@ -188,8 +198,8 @@ find_tool ()
   eval "export $find_tool_envvar"
 }
 
-# Find sha1sum, named gsha1sum on MacPorts.
-find_tool SHA1SUM sha1sum gsha1sum
+# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
+find_tool SHA1SUM sha1sum gsha1sum shasum
 
 # Override the default configuration, if necessary.
 # Make sure that bootstrap.conf is sourced from the current directory
@@ -390,7 +400,7 @@ fi
 
 cleanup_gnulib() {
   status=$?
-  rm -fr gnulib
+  rm -fr "$gnulib_path"
   exit $status
 }
 
@@ -398,6 +408,8 @@ git_modules_config () {
   test -f .gitmodules && git config --file .gitmodules "$@"
 }
 
+gnulib_path=`git_modules_config submodule.gnulib.path`
+
 # Get gnulib files.
 
 case ${GNULIB_SRCDIR--} in
@@ -407,30 +419,43 @@ case ${GNULIB_SRCDIR--} in
     git submodule init || exit $?
     git submodule update || exit $?
 
-  elif [ ! -d gnulib ]; then
+  elif [ ! -d "$gnulib_path" ]; then
     echo "$0: getting gnulib files..."
 
     trap cleanup_gnulib 1 2 13 15
 
     git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
-    git clone $shallow git://git.sv.gnu.org/gnulib ||
+    git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
       cleanup_gnulib
 
     trap - 1 2 13 15
   fi
-  GNULIB_SRCDIR=gnulib
+  GNULIB_SRCDIR=$gnulib_path
   ;;
 *)
-  # Redirect the gnulib submodule to the directory on the command line
-  # if possible.
+  # Use GNULIB_SRCDIR as a reference.
   if test -d "$GNULIB_SRCDIR"/.git && \
         git_modules_config submodule.gnulib.url >/dev/null; then
-    git submodule init
-    GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
-    git_modules_config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
     echo "$0: getting gnulib files..."
-    git submodule update || exit $?
-    GNULIB_SRCDIR=gnulib
+    if git submodule --help|grep reference > /dev/null; then
+      # Prefer the one-liner available in git 1.6.4 or newer.
+      git submodule update --init --reference "$GNULIB_SRCDIR" \
+        "$gnulib_path" || exit $?
+    else
+      # This fallback allows at least git 1.5.5.
+      if test -f "$gnulib_path"/gnulib-tool; then
+        # Since file already exists, assume submodule init already complete.
+        git submodule update || exit $?
+      else
+        # Older git can't clone into an empty directory.
+        rmdir "$gnulib_path" 2>/dev/null
+        git clone --reference "$GNULIB_SRCDIR" \
+          "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
+          && git submodule init && git submodule update \
+          || exit $?
+      fi
+    fi
+    GNULIB_SRCDIR=$gnulib_path
   fi
   ;;
 esac
@@ -636,7 +661,7 @@ slurp() {
       for excluded_file in $excluded_files; do
         test "$dir/$file" = "$excluded_file" && continue 2
       done
-      if test $file = Makefile.am; then
+      if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
         copied=$copied${sep}$gnulib_mk; sep=$nl
         remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
         sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
@@ -654,7 +679,7 @@ slurp() {
           rm -f $dir/$file
           sed '
             /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
-              AC_DEFUN([AM_INTL_SUBDIR], [
+              AC_DEFUN([AM_INTL_SUBDIR], [])
             /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
               AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
             $a\
@@ -787,7 +812,8 @@ if test $with_gettext = yes; then
   rm -f po/Makevars
   sed '
     /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
-    /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
+    /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
+    /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
     /^XGETTEXT_OPTIONS *=/{
       s/$/ \\/
       a\
@@ -818,6 +844,10 @@ bootstrap_epilogue
 
 echo "$0: done.  Now you can run './configure'."
 
-# Local Variables:
-# indent-tabs-mode: nil
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
index 8518609..c2d1257 100755 (executable)
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 #   Free Software Foundation, Inc.
 
-timestamp='2009-12-31'
+timestamp='2010-01-22'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -381,7 +381,8 @@ case $basic_machine in
        | sparclite-* \
        | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
        | tahoe-* | thumb-* \
-       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tile-* | tilegx-* \
        | tron-* \
        | ubicom32-* \
        | v850-* | v850e-* | vax-* \
@@ -1086,6 +1087,11 @@ case $basic_machine in
                basic_machine=tic6x-unknown
                os=-coff
                ;;
+        # This must be matched before tile*.
+        tilegx*)
+               basic_machine=tilegx-unknown
+               os=-linux-gnu
+               ;;
        tile*)
                basic_machine=tile-unknown
                os=-linux-gnu
index ce8c82c..ecc6b15 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
-# Copyright (C) 1995, 2000, 2003, 2004, 2005, 2009 Free Software
+# Copyright (C) 1995, 2000, 2003, 2004, 2005, 2009, 2010 Free Software
 # Foundation, Inc.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2010-02-06.18; # UTC
 
 # Franc,ois Pinard <pinard@iro.umontreal.ca>, 1995.
 #
@@ -65,7 +65,11 @@ tempdir=elc.$$
 
 # Cleanup the temporary directory on exit.
 trap 'ret=$?; rm -rf "$tempdir" && exit $ret' 0
-trap '(exit $?); exit' 1 2 13 15
+do_exit='(exit $ret); exit $ret'
+trap "ret=129; $do_exit" 1
+trap "ret=130; $do_exit" 2
+trap "ret=141; $do_exit" 13
+trap "ret=143; $do_exit" 15
 
 mkdir $tempdir
 cp "$@" $tempdir
index b50a6c7..67d5b52 100755 (executable)
@@ -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-01-02.16
+scriptversion=2010-02-13.20
 
 # Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 # Free Software Foundation, Inc.
@@ -56,6 +56,7 @@ See the GNU Maintainers document for a more extensive discussion:
   http://www.gnu.org/prep/maintain_toc.html
 
 Options:
+  -s SRCFILE  read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
   -o OUTDIR   write files into OUTDIR, instead of manual/.
   --email ADR use ADR as contact in generated web pages.
   --docbook   convert to DocBook too (xml, txt, html, pdf and ps).
@@ -119,12 +120,14 @@ PACKAGE=
 EMAIL=webmasters@gnu.org  # please override with --email
 htmlarg=
 outdir=manual
+srcfile=
 
 while test $# -gt 0; do
   case $1 in
     --email) shift; EMAIL=$1;;
     --help) echo "$usage"; exit 0;;
     --version) echo "$version"; exit 0;;
+    -s) shift; srcfile=$1;;
     -o) shift; outdir=$1;;
     --docbook) docbook=yes;;
     --html) shift; htmlarg=$1;;
@@ -146,7 +149,9 @@ while test $# -gt 0; do
   shift
 done
 
-if test -s "$srcdir/$PACKAGE.texinfo"; then
+if test -n "$srcfile"; then
+  :
+elif test -s "$srcdir/$PACKAGE.texinfo"; then
   srcfile=$srcdir/$PACKAGE.texinfo
 elif test -s "$srcdir/$PACKAGE.texi"; then
   srcfile=$srcdir/$PACKAGE.texi
@@ -268,13 +273,14 @@ else
 fi
 
 echo Making .tar.gz for sources...
-srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` || true
+d=`dirname $srcfile`
+srcfiles=`ls $d/*.texinfo $d/*.texi $d/*.txi $d/*.eps 2>/dev/null` || true
 tar cvzfh $outdir/$PACKAGE.texi.tar.gz $srcfiles
 texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz`
 
 if test -n "$docbook"; then
   cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml"
-  echo "Generating docbook XML... $(cmd)"
+  echo "Generating docbook XML... ($cmd)"
   eval "$cmd"
   docbook_xml_size=`calcsize $PACKAGE-db.xml`
   gzip -f -9 -c $PACKAGE-db.xml >$outdir/$PACKAGE-db.xml.gz
@@ -302,7 +308,7 @@ if test -n "$docbook"; then
   mv $PACKAGE-db.txt $outdir/
 
   cmd="${DOCBOOK2PS} ${outdir}/$PACKAGE-db.xml"
-  echo "Generating docbook PS... $(cmd)"
+  echo "Generating docbook PS... ($cmd)"
   eval "$cmd"
   gzip -f -9 -c $PACKAGE-db.ps >$outdir/$PACKAGE-db.ps.gz
   docbook_ps_gz_size=`calcsize $outdir/$PACKAGE-db.ps.gz`
index 8317604..16da2a8 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2009-09-09.22
+scriptversion=2010-02-24.17; # UTC
 
-# Copyright (C) 2007-2009 Free Software Foundation
+# Copyright (C) 2007-2010 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -146,5 +146,6 @@ echo "$v" | tr -d '\012'
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
index bd120e8..d445075 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/sh
 # Sign files and upload them.
 
-scriptversion=2009-12-21.21; # UTC
+scriptversion=2010-02-08.07; # UTC
 
-# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation
+# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -32,10 +33,11 @@ delete_symlinks=
 collect_var=
 dbg=
 
-usage="Usage: $0 [OPTIONS]... [COMMAND] FILES... [[COMMAND] FILES...]
+usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...]
 
-Sign all FILES, and upload them to selected destinations, according to
-<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>.
+Sign all FILES, and process them at selected destinations according to CMD.
+<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>
+explains further.
 
 Commands:
   --delete                 delete FILES from destination
index 6781b98..3f83ce9 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2010-02-06.18; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -200,7 +200,11 @@ if test $# -eq 0; then
 fi
 
 if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
 
   # Set umask so as not to create temps with too-generous modes.
   # However, 'strip' requires both read and write access to temps.
index e631b22..c477512 100755 (executable)
@@ -1,10 +1,10 @@
 #!/bin/sh
 # Get modification time of a file or directory and pretty-print it.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2010-02-22.21; # UTC
 
-# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009 Free
-# Software Foundation, Inc.
+# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009, 2010
+# Free Software Foundation, Inc.
 # written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
 #
 # This program is free software; you can redistribute it and/or modify
@@ -38,7 +38,8 @@ case $1 in
     cat <<\EOF
 Usage: mdate-sh [--help] [--version] FILE
 
-Pretty-print the modification time of FILE.
+Pretty-print the modification day of FILE, in the format:
+1 January 1970
 
 Report bugs to <bug-automake@gnu.org>.
 EOF
index f3605cb..263c9c3 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
-# 
-# Copyright 2008, 2009 Free Software Foundation.
-# 
+#
+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+#
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
 #
 # Original author: Karl Berry.
 # Bug reports and correspondence to bug-gnulib@gnu.org.
-# 
+#
 # This is a minimal replacement for ncftpput using standard ftp.
 # It was written for use with the Automake gnupload script for machines
 # without ncftpput, e.g., rename it to ncftpput and put it in your PATH.
-# 
+#
 # The arguments are:
 # host dir file1 file2 ...
 
index 9140826..b6cc6d8 100644 (file)
@@ -3,11 +3,11 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2009-08-14.15}
+\def\texinfoversion{2010-02-13.09}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008, 2009 Free Software Foundation, Inc.
+% 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 %
 % This texinfo.tex file is free software: you can redistribute it and/or
 % modify it under the terms of the GNU General Public License as
 \let\ptexnewwrite\newwrite
 \let\ptexnoindent=\noindent
 \let\ptexplus=+
+\let\ptexraggedright=\raggedright
 \let\ptexrbrace=\}
 \let\ptexslash=\/
 \let\ptexstar=\*
 \let\ptext=\t
 \let\ptextop=\top
-{\catcode`\'=\active
-\global\let\ptexquoteright'}% Math-mode def from plain.tex.
-\let\ptexraggedright=\raggedright
+{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
 
 % If this character appears in an error message or help string, it
 % starts a new line in the output.
@@ -5948,6 +5947,10 @@ end
   \catcode`\'=\other
   \escapechar=`\\
   %
+  % ' is active in math mode (mathcode"8000).  So reset it, and all our
+  % other math active characters (just in case), to plain's definitions.
+  \mathactive
+  %
   \let\b=\ptexb
   \let\bullet=\ptexbullet
   \let\c=\ptexc
index c07576d..b9f2fbd 100755 (executable)
@@ -2,7 +2,7 @@
 # List version-controlled file names.
 
 # Print a version string.
-scriptversion=2009-07-21.16; # UTC
+scriptversion=2010-02-21.13; # UTC
 
 # Copyright (C) 2006-2010 Free Software Foundation, Inc.
 
@@ -85,7 +85,7 @@ elif test -d .hg; then
   eval exec hg locate '"$dir/*"' $postprocess
 elif test -d .bzr; then
   test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
-  eval exec bzr ls --versioned '"$dir"' $postprocess
+  eval exec bzr ls -R --versioned '"$dir"' $postprocess
 elif test -d CVS; then
   test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
   if test -x build-aux/cvsu; then
diff --git a/build-aux/warn-on-use.h b/build-aux/warn-on-use.h
new file mode 100644 (file)
index 0000000..3d93a9e
--- /dev/null
@@ -0,0 +1,75 @@
+/* A C macro for emitting warnings if a function is used.
+   Copyright (C) 2010 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 2 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 <http://www.gnu.org/licenses/>.  */
+
+/* _GL_WARN_ON_USE(function, "literal string") issues a declaration
+   for FUNCTION which will then trigger a compiler warning containing
+   the text of "literal string" anywhere that function is called, if
+   supported by the compiler.  If the compiler does not support this
+   feature, the macro expands to an unused extern declaration.
+
+   This macro is useful for marking a function as a potential
+   portability trap, with the intent that "literal string" include
+   instructions on the replacement function that should be used
+   instead.  However, one of the reasons that a function is a
+   portability trap is if it has the wrong signature.  Declaring
+   FUNCTION with a different signature in C is a compilation error, so
+   this macro must use the same type as any existing declaration so
+   that programs that avoid the problematic FUNCTION do not fail to
+   compile merely because they included a header that poisoned the
+   function.  But this implies that _GL_WARN_ON_USE is only safe to
+   use if FUNCTION is known to already have a declaration.  Use of
+   this macro implies that there must not be any other macro hiding
+   the declaration of FUNCTION; but undefining FUNCTION first is part
+   of the poisoning process anyway (although for symbols that are
+   provided only via a macro, the result is a compilation error rather
+   than a warning containing "literal string").  Also note that in
+   C++, it is only safe to use if FUNCTION has no overloads.
+
+   For an example, it is possible to poison 'getline' by:
+   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
+     [getline]) in configure.ac, which potentially defines
+     HAVE_RAW_DECL_GETLINE
+   - adding this code to a header that wraps the system <stdio.h>:
+     #undef getline
+     #if HAVE_RAW_DECL_GETLINE
+     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
+       "not universally present; use the gnulib module getline");
+     #endif
+
+   It is not possible to directly poison global variables.  But it is
+   possible to write a wrapper accessor function, and poison that
+   (less common usage, like &environ, will cause a compilation error
+   rather than issue the nice warning, but the end result of informing
+   the developer about their portability problem is still achieved):
+   #if HAVE_RAW_DECL_ENVIRON
+   static inline char ***rpl_environ (void) { return &environ; }
+   _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
+   # undef environ
+   # define environ (*rpl_environ ())
+   #endif
+   */
+#ifndef _GL_WARN_ON_USE
+
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
+#  define _GL_WARN_ON_USE(function, message) \
+extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
+
+# else /* Unsupported.  */
+#  define _GL_WARN_ON_USE(function, message) \
+extern int _gl_warn_on_use
+# endif
+#endif
index 5e39391..bc43b40 100644 (file)
@@ -15,3 +15,15 @@ IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
 Portability problems not fixed by Gnulib:
 @itemize
 @end itemize
+
+Other problems of this function:
+@itemize
+@item
+There is an inherent race between calling this function and performing
+some action based on the results; you should think twice before trusting
+this function, especially in a set-uid or set-gid program.
+@item
+This function does not have an option for not following symbolic links
+(like @code{stat} versus @code{lstat}).  If you need this option, use
+the Gnulib module @code{faccessat} with the @code{AT_EACCESS} flag.
+@end itemize
index b80d3c5..3908180 100644 (file)
@@ -39,6 +39,7 @@ some commands with the option @samp{--dry-run}; then
 a real run without changing anything.
 
 @menu
+* Which modules?::              Determining the needed set of Gnulib modules
 * Initial import::              First import of Gnulib modules.
 * Modified imports::            Changing the import specification.
 * Simple update::               Tracking Gnulib development.
@@ -50,12 +51,44 @@ a real run without changing anything.
 @end menu
 
 
+@node Which modules?
+@section Finding modules
+@cindex Finding modules
+
+There are three ways of finding the names of Gnulib modules that you can use
+in your package:
+
+@itemize
+@item
+You have the complete module list, sorted according to categories, in
+@url{http://www.gnu.org/software/gnulib/MODULES.html}.
+
+@item
+If you are looking for a particular POSIX header or function replacement,
+look in the chapters @ref{Header File Substitutes} and
+@ref{Function Substitutes}.  For headers and functions that are provided by
+Glibc but not standardized by POSIX, look in the chapters
+@ref{Glibc Header File Substitutes} and @ref{Glibc Function Substitutes}.
+
+@item
+If you have already found the source file in Gnulib and are looking for the
+module that contains this source file, you can use the command
+@samp{gnulib-tool --find @var{filename}}.
+@end itemize
+
+
 @node Initial import
 @section Initial import
 @cindex initial import
 
-Gnulib assumes your project uses Autoconf and Automake.  Invoking
-@samp{gnulib-tool --import} will copy source files, create a
+Gnulib assumes that your project uses Autoconf.  When using Gnulib, you
+will need to have Autoconf and Automake among your build tools.  Note that
+while the use of Automake in your project's top level directory is an
+easy way to fulfil the Makefile conventions of the GNU coding standards,
+Gnulib does not require it.  But when you use Gnulib, Automake will be
+used at least in a subdirectory of your project.
+
+Invoking @samp{gnulib-tool --import} will copy source files, create a
 @file{Makefile.am} to build them, generate a file @file{gnulib-comp.m4} with
 Autoconf M4 macro declarations used by @file{configure.ac}, and generate
 a file @file{gnulib-cache.m4} containing the cached specification of how
index 1665e31..0a84691 100644 (file)
@@ -53,6 +53,7 @@ Documentation License''.
 @menu
 * Introduction::
 * Invoking gnulib-tool::
+* Writing modules::
 * Miscellaneous Notes::
 * POSIX Substitutes Library::       Building as a separate substitutes library.
 * Header File Substitutes::         Overriding system headers.
@@ -113,38 +114,53 @@ Resources:
 @include gnulib-tool.texi
 
 
-@node Miscellaneous Notes
-@chapter Miscellaneous Notes
+@node Writing modules
+@chapter Writing modules
+
+This chapter explains how to write modules of your own, either for your own
+package (to be used with gnulib-tool's @samp{--local-dir} option), or for
+inclusion in gnulib proper.
+
+The guidelines in this chapter do not necessarily need to be followed for
+using @code{gnulib-tool}.  They merely represent a set of good practices.
+Following them will result in a good structure of your modules and in
+consistency with gnulib.
 
 @menu
-* Comments::
+* Source code files::
 * Header files::
-* Out of memory handling::
-* Obsolete modules::
-* Library version handling::
-* Windows sockets::
-* Libtool and Windows::
-* License Texinfo sources::
-* Build robot for gnulib::
+* Implementation files::
+* Specification::
+* Module description::
+* Autoconf macros::
+* Unit test modules::
+* Incompatible changes::
 @end menu
 
 
-@node Comments
-@section Comments
+@node Source code files
+@section Source code files
 
-@cindex comments describing functions
-@cindex describing functions, locating
-Where to put comments describing functions: Because of risk of
-divergence, we prefer to keep most function describing comments in
-only one place: just above the actual function definition.  Some
-people prefer to put that documentation in the .h file.  In any case,
-it should appear in just one place unless you can ensure that the
-multiple copies will always remain identical.
+Every API (C functions or variables) provided should be declared in a header
+file (.h file) and implemented in one or more implementation files (.c files).
+The separation has the effect that users of your module need to read only
+the contents of the .h file and the module description in order to understand
+what the module is about and how to use it - not the entire implementation.
+Furthermore, users of your module don't need to repeat the declarations of
+the functions in their code, and are likely to receive notification through
+compiler errors if you make incompatible changes to the API (like, adding a
+parameter or changing the return type of a function).
 
 
 @node Header files
 @section Header files
 
+The .h file should declare the C functions and variables that the module
+provides.
+
+The .h file should be stand-alone.  That is, it does not require other .h files
+to be included before.  Rather, it includes all necessary .h files by itself.
+
 @cindex double inclusion of header files
 @cindex header file include protection
 It is a tradition to use CPP tricks to avoid parsing the same header
@@ -207,20 +223,405 @@ systems with g++ v3.3 to v4.2, AIX, OSF/1, IRIX).  For this reason, it
 is recommended to place the @code{#include} before the @code{extern
 "C"} block.
 
+@node Implementation files
+@section Implementation files
+
+The .c file or files implement the functions and variables declared in the
+.h file.
+
 @subheading Include ordering
 
-When writing a gnulib module, or even in general, a good way to order
-the @samp{#include} directives is the following.
+Every implementation file must start with @samp{#include <config.h>}.
+This is necessary for activating the preprocessor macros that are defined
+on behalf of the Autoconf macros.  Some of these preprocessor macros,
+such as @code{_GNU_SOURCE}, would have no effect if defined after a system
+header file has already been included.
+
+Then comes the @samp{#include "..."} specifying the header file that is
+being implemented.  Putting this right after @samp{#include <config.h>}
+has the effect that it verifies that the header file is self-contained.
+
+Then come the system and application headers. It is customary to put all the
+system headers before all application headers, so as to minimize the risk
+that a preprocessor macro defined in an application header confuses the system
+headers on some platforms.
+
+In summary:
 
 @itemize
-@item First comes the #include "..." specifying the module being implemented.
-@item Then come all the #include <...> of system or system-replacement headers,
+@item
+First comes #include <config.h>.
+@item
+Second comes the #include "..." specifying the module being implemented.
+@item
+Then come all the #include <...> of system or system-replacement headers,
 in arbitrary order.
-@item Then come all the #include "..." of gnulib and private headers, in
+@item
+Then come all the #include "..." of gnulib and application headers, in
 arbitrary order.
 @end itemize
 
 
+@node Specification
+@section Specification
+
+The specification of a function should answer at least the following
+questions:
+@itemize
+@item
+What is the purpose of the function?
+@item
+What are the arguments?
+@item
+What is the return value?
+@item
+What happens in case of failure? (Exit? A specific return value? Errno set?)
+@item
+Memory allocation policy: If pointers to memory are returned, are they freshly
+allocated and supposed to be freed by the caller?
+@end itemize
+
+@cindex specification
+@cindex comments describing functions
+@cindex describing functions, locating
+Where to put the specification describing exported functions? Three practices
+are used in gnulib:
+
+@itemize
+@item
+The specification can be as comments in the header file, just above the
+function declaration.
+@item
+The specification can be as comments in the implementation file, just above
+the function definition.
+@item
+The specification can be in texinfo format, so that it gets included in the
+gnulib manual.
+@end itemize
+
+In any case, the specification should appear in just one place, unless you can
+ensure that the multiple copies will always remain identical.
+
+The advantage of putting it in the header file is that the user only has to
+read the include file normally never needs to peek into the implementation
+file(s).
+
+The advantage of putting it in the implementation file is that when reviewing
+or changing the implementation, you have both elements side by side.
+
+The advantage of texinfo formatted documentation is that it is easily
+published in HTML or Info format.
+
+Currently (as of 2010), half of gnulib uses the first practice, nearly half
+of gnulib uses the second practice, and a small minority uses the texinfo
+practice.
+
+
+@node Module description
+@section Module description
+
+For the module description, you can start from an existing module's
+description, or from a blank one: @file{module/TEMPLATE} for a normal module,
+or @file{module/TEMPLATE-TESTS} for a unit test module.  Some more fields
+are possible but rarely used.  Use @file{module/TEMPLATE-EXTENDED} if you
+want to use one of them.
+
+Module descriptions have the following fields.  Absent fields are equivalent
+to fields with empty contents.
+
+@table @asis
+@item Description
+This field should contain a concise description of the module's functionality.
+One sentence is enough.  For example, if it defines a single function
+@samp{frob}, the description can be @samp{frob() function: frobnication.}
+Gnulib's documentation generator will automatically convert the first part
+to a hyperlink when it has this form.
+
+@item Status
+This field is either empty/absent, or contains the word @samp{obsolete}.  In
+the latter case, @command{gnulib-tool} will, unless the option
+@code{--with-obsolete} is given, omit it when it used as a dependency.  It is
+good practice to also notify the user about an obsolete module.  This is done
+by putting into the @samp{Notice} section (see below) text like
+@samp{This module is obsolete.}
+
+@item Notice
+This field contains text that @command{gnulib-tool} will show to the user
+when the module is used.  This can be a status indicator like
+@samp{This module is obsolete.} or additional advice.  Do not abuse this
+field.
+
+@item Applicability
+This field is either empty/absent, or contains the word @samp{all}.  It
+describes to which @code{Makefile.am} the module is applied.  By default,
+a normal module is applied to @code{@var{source_base}/Makefile.am}
+(normally @code{lib/Makefile.am}), whereas a module ending in @code{-tests}
+is applied to @code{@var{tests_base}/Makefile.am} (normally
+@code{tests/Makefile.am}).  If this field is @samp{all}, it is applied to
+both @code{Makefile.am}s.  This is useful for modules which provide
+Makefile.am macros rather than compiled source code.
+
+@item Files
+This field contains a newline separated list of the files that are part of
+the module.  @code{gnulib-tool} copies these files into the package that
+uses the module.
+
+This list is typically ordered by importance: First comes the header file,
+then the implementation files, then other files.
+
+It is possible to have the same file mentioned in multiple modules.  That is,
+if the maintainers of that module agree on the purpose and future of said
+file.
+
+@item Depends-on
+This field contains a newline separated list of the modules that are required
+for the proper working of this module.  @code{gnulib-tool} includes each
+required module automatically, unless it is specified with option
+@code{--avoid} or it is marked as obsolete and the option
+@code{--with-obsolete} is not given.
+
+A test modules @code{foo-tests} implicity depends on the corresponding non-test
+module @code{foo}.  @code{foo} implicitly depends on @code{foo-tests} if the
+latter exists and if the option @code{--with-tests} has been given.
+
+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.)
+
+@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}
+file: right after the @code{AC_PROG_CC} invocation.  This section is adequate
+for statements that modify @code{CPPFLAGS}, as these can affect the results of
+other Autoconf macros.
+
+@item configure.ac
+This field contains @file{configure.ac} stuff (Autoconf macro invocations and
+shell statements).
+
+It is forbidden to add items to the @code{CPPFLAGS} variable here, other than
+temporarily, as these could affect the results of other Autoconf macros.
+
+We avoid adding items to the @code{LIBS} variable, other than temporarily.
+Instead, the module can export an Autoconf-substituted variable that contains
+link options.  The user of the module can then decide to which executables
+to apply which link options.  Recall that a package can build executables of
+different kinds and purposes; having all executables link against all
+libraries is inappropriate.
+
+If the statements in this section grow larger than a couple of lines, we
+recommend moving them to a @code{.m4} file of their own.
+
+@item Makefile.am
+This field contains @code{Makefile.am} statements.  Variables like
+@code{lib_SOURCES} are transformed to match the name of the library
+being built in that directory.  For example, @code{lib_SOURCES} may become
+@code{libgnu_a_SOURCES} (for a plain library) or @code{libgnu_la_SOURCES}
+(for a libtool library).  Therefore, the normal way of having an
+implementation file @code{lib/foo.c} compiled unconditionally is to write
+@smallexample
+lib_SOURCES += foo.c
+@end smallexample
+
+@item Include
+This field contains the preprocessor statements that users of the module
+need to add to their source code files.  Typically it's a single include
+statement.  A shorthand is allowed: You don't need to write the word
+``#include'', just the name of the include file in the way it will appear
+in an include statement.  Example:
+@smallexample
+"foo.h"
+@end smallexample
+
+@item Link
+This field contains the set of libraries that are needed when linking
+libraries or executables that use this module.  Often this will be
+written as a reference to a Makefile variable.  Please write them
+one per line, so that @command{gnulib-tool} can remove duplicates
+when presenting a summary to the user.
+Example:
+@smallexample
+$(POW_LIBM)
+$(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise
+@end smallexample
+
+@item License
+This field specifies the license that governs the source code parts of
+this module.  See @ref{Copyright} for details.
+
+@item Maintainer
+This field specifies the persons who have a definitive say about proposed
+changes to this module.  You don't need to mention email addresses here:
+they can be inferred from the @code{ChangeLog} file.
+
+Please put at least one person here.  We don't like unmaintained modules.
+@end table
+
+
+@node Autoconf macros
+@section Autoconf macros
+
+For a module @code{foo}, an Autoconf macro file @file{m4/foo.m4} is typically
+created when the Autoconf macro invocations for the module are longer than
+one or two lines.
+
+The name of the main entry point into this Autoconf macro file is typically
+@code{gl_FOO}.  For modules outside Gnulib that are not likely to be moved
+into Gnulib, please use a prefix specific to your package: @code{gt_} for
+GNU gettext, @code{cu_} for GNU coreutils, etc.
+
+For modules that define a function @code{foo}, the entry point is called
+@code{gl_FUNC_FOO} instead of @code{gl_FOO}.  For modules that provide a
+header file with multiple functions, say @code{foo.h}, the entry point is
+called @code{gl_FOO_H} or @code{gl_HEADER_FOO_H}.  This convention is useful
+because sometimes a header and a function name coincide (for example,
+@code{fcntl} and @code{fcntl.h}).
+
+For modules that provide a replacement, it is useful to split the Autoconf
+macro into two macro definitions: one that detects whether the replacement
+is needed and requests the replacement using @code{AC_LIBOBJ} (this is the
+entry point, say @code{gl_FUNC_FOO}), and one that arranges for the macros
+needed by the replacement code @code{lib/foo.c} (typically called
+@code{gl_PREREQ_FOO}).  The reason of this separation is
+@enumerate
+@item
+to make it easy to update the Autoconf macros when you have modified the
+source code file: after changing @code{lib/foo.c}, all you have to review
+is the @code{Depends-on} section of the module description and the
+@code{gl_PREREQ_FOO} macro in the Autoconf macro file.
+@item
+The Autoconf macros are often large enough that splitting them eases
+maintenance.
+@end enumerate
+
+
+@node Unit test modules
+@section Unit test modules
+
+A unit test that is a simple C program usually has a module description as
+simple as this:
+
+@smallexample
+Files:
+tests/test-foo.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-foo
+check_PROGRAMS += test-foo
+@end smallexample
+
+The test program @file{tests/test-foo.c} often has the following structure:
+
+@itemize
+@item
+First comes the obligatory @samp{#include <config.h>}.
+
+@item
+Second comes the include of the header file that declares the API being tested.
+Including it here verifies that said header file is self-contained.
+
+@item
+Then come other includes.  In particular, the file @file{macros.h} is often
+used here.  It contains a convenient @code{ASSERT} macro.
+@end itemize
+
+The body of the test, then, contains many @code{ASSERT} invocations.  When
+a test fails, the @code{ASSERT} macro prints the line number of the failing
+statement, thus giving you as a developer a idea which part of the test
+failed, even when you don't have access to the machine where the test failed
+and the reporting user cannot run a debugger.
+
+Sometimes it is convenient to write part of the test as a shell script.
+(For example, in areas related to process control or interprocess
+communication, or when different locales should be tried.) In these cases,
+the typical module description is like this:
+
+@smallexample
+Files:
+tests/test-foo.sh
+tests/test-foo.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-foo.sh
+TESTS_ENVIRONMENT += FOO_BAR='@@FOO_BAR@@'
+check_PROGRAMS += test-foo
+@end smallexample
+
+Here, the @code{TESTS_ENVIRONMENT} variable can be used to pass values
+determined by @code{configure} or by the @code{Makefile} to the shell
+script, as environment variables.  The values of @code{EXEEXT} and of
+@code{srcdir}, from Autoconf and Automake, are already provided as
+environment variables, through an initial value of @code{TESTS_ENVIRONMENT}
+that @code{gnulib-tool} puts in place.
+
+Regardless of the specific form of the unit test, the following guidelines
+should be respected:
+
+@itemize
+@item
+A test indicates success by exiting with exit code 0.  It should normally
+not produce output in this case.  (Output to temporary files that are
+cleaned up at the end of the test are possible, of course.)
+@item
+A test indicates failure by exiting with an exit code different from 0 and 77,
+typically 1.  It is useful to print a message about the failure in this case.
+The @code{ASSERT} macro already does so.
+@item
+A test indicates "skip", that is, that most of its interesting functionality
+could not be performed, through a return code of 77.  A test should also
+print a message to stdout or stderr about the reason for skipping.
+For example:
+@smallexample
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+@end smallexample
+Such a message helps detecting bugs in the autoconf macros: A simple message
+@samp{SKIP: test-foo} does not sufficiently catch the attention of the user.
+@end itemize
+
+
+@node Incompatible changes
+@section Incompatible changes
+
+Incompatible changes to Gnulib modules should be mentioned in Gnulib's
+@file{NEWS} file.  Incompatible changes here mean that existing source code
+may not compile or work any more.
+
+We don't mean changes in the binary interface (ABI), since
+@enumerate
+@item
+Gnulib code is used in source-code form.
+@item
+The user who distributes libraries that contain Gnulib code is supposed to
+bump the version number in the way described in the Libtool documentation
+before every release.
+@end enumerate
+
+
+@node Miscellaneous Notes
+@chapter Miscellaneous Notes
+
+@menu
+* Out of memory handling::
+* Obsolete modules::
+* Library version handling::
+* Windows sockets::
+* Libtool and Windows::
+* License Texinfo sources::
+* Build robot for gnulib::
+@end menu
+
+
 @node Out of memory handling
 @section Out of memory handling
 
index d84faba..3e264ef 100644 (file)
@@ -5,7 +5,7 @@
 @c For double-sided printing, uncomment:
 @c @setchapternewpage odd
 @c This date is automagically updated when you save this file:
-@set lastupdate December 12, 2009
+@set lastupdate January 27, 2010
 @c %**end of header
 
 @dircategory GNU organization
@@ -23,7 +23,7 @@
 Information for maintainers of GNU software, last updated @value{lastupdate}.
 
 Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
 Foundation, Inc.
 
 @quotation
@@ -558,9 +558,12 @@ which file it is generated from.
 A copyright notice looks like this:
 
 @example
-Copyright (C) @var{year1}, @var{year2}, @var{year3}  @var{copyright-holder}
+Copyright (C) @var{year1}, @var{year2}, @var{year3} @var{copyright-holder}
 @end example
 
+The word @samp{Copyright} must always be in English, by international
+convention.
+
 The @var{copyright-holder} may be the Free Software Foundation, Inc., or
 someone else; you should know who is the copyright holder for your
 package.
@@ -571,7 +574,8 @@ stick with parenthesized @samp{C} unless you know that C-in-a-circle
 will work.  For example, a program's standard @option{--version}
 message should use parenthesized @samp{C} by default, though message
 translations may use C-in-a-circle in locales where that symbol is
-known to work.
+known to work.  Alternatively, the @samp{(C)} or C-in-a-circle can be
+omitted entirely; the word @samp{Copyright} suffices.
 
 To update the list of year numbers, add each year in which you have
 made nontrivial changes to the package.  (Here we assume you're using
index 9fe29d3..c8e0d63 100644 (file)
@@ -3,13 +3,12 @@
 
 @node Makefile Conventions
 @chapter Makefile Conventions
-@comment standards.texi does not print an index, but make.texinfo does.
 @cindex makefile, conventions for
 @cindex conventions for makefiles
 @cindex standards for makefiles
 
 @c Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
-@c 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+@c 2004, 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
 @c
 @c Permission is granted to copy, distribute and/or modify this document
 @c under the terms of the GNU Free Documentation License, Version 1.3
@@ -91,7 +90,7 @@ to @file{configure}.  A rule of the form:
 
 @smallexample
 foo.1 : foo.man sedscript
-        sed -e sedscript foo.man > foo.1
+        sed -f sedscript foo.man > foo.1
 @end smallexample
 
 @noindent
@@ -125,7 +124,7 @@ way to make the rule work well.  For example, the target above for
 
 @smallexample
 foo.1 : foo.man sedscript
-        sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@@
+        sed -f $(srcdir)/sedscript $(srcdir)/foo.man > $@@
 @end smallexample
 
 GNU distributions usually contain some files which are not source
@@ -294,7 +293,7 @@ $(INSTALL_PROGRAM) foo bar baz $(bindir)
 
 
 @node DESTDIR
-@section @code{DESTDIR}: support for staged installs
+@section @code{DESTDIR}: Support for Staged Installs
 
 @vindex DESTDIR
 @cindex staged installs
@@ -368,6 +367,11 @@ these variables on the system they are being installed onto: use the
 default settings specified here so that all GNU packages behave
 identically, allowing the installer to achieve any desired layout.
 
+@cindex directories, creating installation
+@cindex installation directories, creating
+All installation directories, and their parent directories, should be
+created (if necessary) before they are installed into.
+
 These first two variables set the root for the installation.  All the
 other installation directories should be subdirectories of one of
 these two, and nothing should be directly installed into these two
@@ -743,26 +747,31 @@ with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run
 the @code{install-info} program if it is present.  @code{install-info}
 is a program that edits the Info @file{dir} file to add or update the
 menu entry for the given Info file; it is part of the Texinfo package.
-Here is a sample rule to install an Info file:
+
+Here is a sample rule to install an Info file that also tries to
+handle some additional situations, such as @code{install-info} not
+being present.
 
 @comment This example has been carefully formatted for the Make manual.
 @comment Please do not reformat it without talking to bug-make@gnu.org.
 @smallexample
-$(DESTDIR)$(infodir)/foo.info: foo.info
-        $(POST_INSTALL)
-# There may be a newer info file in . than in srcdir.
-        -if test -f foo.info; then d=.; \
-         else d=$(srcdir); fi; \
-        $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@@; \
+do-install-info: foo.info installdirs
+        $(NORMAL_INSTALL)
+# Prefer an info file in . to one in srcdir.
+        if test -f foo.info; then d=.; \
+         else d="$(srcdir)"; fi; \
+        $(INSTALL_DATA) $$d/foo.info \
+          "$(DESTDIR)$(infodir)/foo.info"
 # Run install-info only if it exists.
 # Use `if' instead of just prepending `-' to the
 # line so we notice real errors from install-info.
-# We use `$(SHELL) -c' because some shells do not
+# Use `$(SHELL) -c' because some shells do not
 # fail gracefully when there is an unknown command.
+        $(POST_INSTALL)
         if $(SHELL) -c 'install-info --version' \
            >/dev/null 2>&1; then \
-          install-info --dir-file=$(DESTDIR)$(infodir)/dir \
-                       $(DESTDIR)$(infodir)/foo.info; \
+          install-info --dir-file="$(DESTDIR)$(infodir)/dir" \
+                       "$(DESTDIR)$(infodir)/foo.info"; \
         else true; fi
 @end smallexample
 
@@ -1000,8 +1009,7 @@ the program before running the tests.  You should not assume that
 It's useful to add a target named @samp{installdirs} to create the
 directories where files are installed, and their parent directories.
 There is a script called @file{mkinstalldirs} which is convenient for
-this; you can find it in the Texinfo package.
-@c It's in /gd/gnu/lib/mkinstalldirs.
+this; you can find it in the Gnulib package.
 You can use a rule like this:
 
 @comment This has been carefully formatted to look decent in the Make manual.
@@ -1016,7 +1024,7 @@ installdirs: mkinstalldirs
 @end smallexample
 
 @noindent
-or, if you wish to support @env{DESTDIR},
+or, if you wish to support @env{DESTDIR} (strongly encouraged),
 
 @smallexample
 # Make sure all installation directories (e.g. $(bindir))
index 8da410d..2609fa9 100644 (file)
@@ -16,8 +16,16 @@ Portability problems not fixed by Gnulib:
 This function uses the effective id instead of the real id on some
 platforms:
 Cygwin 1.5.x.
+@end itemize
+
+Other problems of this function:
+@itemize
 @item
 There is an inherent race between calling this function and performing
-some action based on the results; you should think twice before
-trusting this function in a set-uid or set-gid program.
+some action based on the results; you should think twice before trusting
+this function, especially in a set-uid or set-gid program.
+@item
+This function does not have an option for not following symbolic links
+(like @code{stat} versus @code{lstat}).  If you need this option, use
+the Gnulib module @code{faccessat} with the @code{AT_EACCESS} flag.
 @end itemize
index cf23e57..e4b9f9c 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/acos.html}
 
-Gnulib module: ---
+Gnulib module: acos
 
 Portability problems fixed by Gnulib:
 @itemize
index 48ed979..99e4f78 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/acosl.html}
 
-Gnulib module: ---
+Gnulib module: acosl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 99c4318..cca5091 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/asin.html}
 
-Gnulib module: ---
+Gnulib module: asin
 
 Portability problems fixed by Gnulib:
 @itemize
index 11587ac..c304450 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/asinl.html}
 
-Gnulib module: ---
+Gnulib module: asinl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 44ebcf4..21cfd07 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/atan.html}
 
-Gnulib module: ---
+Gnulib module: atan
 
 Portability problems fixed by Gnulib:
 @itemize
index 430a4b4..d584801 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/atan2.html}
 
-Gnulib module: ---
+Gnulib module: atan2
 
 Portability problems fixed by Gnulib:
 @itemize
index 638e259..971c5be 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/atanl.html}
 
-Gnulib module: ---
+Gnulib module: atanl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 67077a8..2e3a6a1 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/cbrt.html}
 
-Gnulib module: ---
+Gnulib module: cbrt
 
 Portability problems fixed by Gnulib:
 @itemize
index c6d6f78..dd8ebc2 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/copysign.html}
 
-Gnulib module: ---
+Gnulib module: copysign
 
 Portability problems fixed by Gnulib:
 @itemize
index e71d8c7..f161e18 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/cos.html}
 
-Gnulib module: ---
+Gnulib module: cos
 
 Portability problems fixed by Gnulib:
 @itemize
index ab43b14..d4653a1 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/cosh.html}
 
-Gnulib module: ---
+Gnulib module: cosh
 
 Portability problems fixed by Gnulib:
 @itemize
index a23821d..d46bbb3 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/cosl.html}
 
-Gnulib module: ---
+Gnulib module: cosl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 291f0a2..861ee64 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/erf.html}
 
-Gnulib module: ---
+Gnulib module: erf
 
 Portability problems fixed by Gnulib:
 @itemize
index 3a9f42f..7076cb8 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/erfc.html}
 
-Gnulib module: ---
+Gnulib module: erfc
 
 Portability problems fixed by Gnulib:
 @itemize
index 74d13ae..e196e2a 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/exit.html}
 
-Gnulib module: exit
+Gnulib module: stdlib
 
 Portability problems fixed by Gnulib:
 @itemize
index bcbecf3..4eed501 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/exp.html}
 
-Gnulib module: ---
+Gnulib module: exp
 
 Portability problems fixed by Gnulib:
 @itemize
index fc67ddd..23b7bbf 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/expl.html}
 
-Gnulib module: ---
+Gnulib module: expl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 0cf43e1..77ea561 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fabs.html}
 
-Gnulib module: ---
+Gnulib module: fabs
 
 Portability problems fixed by Gnulib:
 @itemize
index f1d7be0..b553bea 100644 (file)
@@ -19,8 +19,12 @@ it is not safe to be used in libraries and is not multithread-safe.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@end itemize
+
+Other problems of this function:
+@itemize
 @item
 There is an inherent race between calling this function and performing
-some action based on the results; you should think twice before
-trusting this function in a set-uid or set-gid program.
+some action based on the results; you should think twice before trusting
+this function, especially in a set-uid or set-gid program.
 @end itemize
index d1330d9..9cfa562 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fmod.html}
 
-Gnulib module: ---
+Gnulib module: fmod
 
 Portability problems fixed by Gnulib:
 @itemize
index dd0c2e6..d9c696c 100644 (file)
@@ -14,6 +14,10 @@ MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
 @item
 This function is missing a declaration on some platforms:
 BeOS.
+@item
+This function crashes when passed a pointer to a NULL buffer together with a
+pointer to a non-zero buffer size on some platforms:
+FreeBSD 8.0.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 7a410b7..e00f6b0 100644 (file)
@@ -17,6 +17,10 @@ BeOS.
 @item
 Some platforms provide a function by this name but with the wrong
 signature, for example in -linet.
+@item
+This function crashes when passed a pointer to a NULL buffer together with a
+pointer to a non-zero buffer size on some platforms:
+FreeBSD 8.0.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 1c422c0..b7aebed 100644 (file)
@@ -4,15 +4,15 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getlogin.html}
 
-Gnulib module: ---
+Gnulib module: getlogin
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-mingw.
 @end itemize
index 3f9d423..fda59a3 100644 (file)
@@ -15,6 +15,15 @@ mingw.
 This function is declared with a nonstandard function prototype (only one
 argument, or ``...'' after the first argument) on some platforms.
 @item
+On some platforms, the second argument has type @code{struct
+timezone*} rather than @code{void *}, making it an error to redeclare
+the function with the POSIX signature:
+glibc.
+However, rather than penalize these systems with a replacement
+function, gnulib defines @code{GETTIMEOFDAY_TIMEZONE} to the
+appropriate type for use in avoiding a compiler warning if assigning
+@code{gettimeofday} to a function pointer.
+@item
 On some platforms, @code{gettimeofday} clobbers the buffer in which
 @code{localtime} returns its result:
 MacOS X 10.0.
@@ -22,4 +31,7 @@ MacOS X 10.0.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+Behavior is non-portable if the second argument to @code{gettimeofday}
+is not @code{NULL}.
 @end itemize
index 7d7b7f9..bff9a6c 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/hypot.html}
 
-Gnulib module: ---
+Gnulib module: hypot
 
 Portability problems fixed by Gnulib:
 @itemize
index 9b8e0a2..e0ed5bc 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/j0.html}
 
-Gnulib module: ---
+Gnulib module: j0
 
 Portability problems fixed by Gnulib:
 @itemize
index 96ee617..b906998 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/j1.html}
 
-Gnulib module: ---
+Gnulib module: j1
 
 Portability problems fixed by Gnulib:
 @itemize
index 8b875d6..58b26ae 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/jn.html}
 
-Gnulib module: ---
+Gnulib module: jn
 
 Portability problems fixed by Gnulib:
 @itemize
index 7d36efe..ac1bffc 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/ldexp.html}
 
-Gnulib module: ---
+Gnulib module: ldexp
 
 Portability problems fixed by Gnulib:
 @itemize
index c9960c0..3ac4fd2 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/lgamma.html}
 
-Gnulib module: ---
+Gnulib module: lgamma
 
 Portability problems fixed by Gnulib:
 @itemize
index 9cfd207..001e347 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log.html}
 
-Gnulib module: ---
+Gnulib module: log
 
 Portability problems fixed by Gnulib:
 @itemize
index 69c879c..90e3e8d 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log10.html}
 
-Gnulib module: ---
+Gnulib module: log10
 
 Portability problems fixed by Gnulib:
 @itemize
index 786b76a..d195e85 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log1p.html}
 
-Gnulib module: ---
+Gnulib module: log1p
 
 Portability problems fixed by Gnulib:
 @itemize
index acbdcb6..7cbd998 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/logb.html}
 
-Gnulib module: ---
+Gnulib module: logb
 
 Portability problems fixed by Gnulib:
 @itemize
index f325c3a..3df7d97 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/logl.html}
 
-Gnulib module: ---
+Gnulib module: logl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index f2525f4..6524a60 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/modf.html}
 
-Gnulib module: ---
+Gnulib module: modf
 
 Portability problems fixed by Gnulib:
 @itemize
index d715a92..c7bed98 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/nextafter.html}
 
-Gnulib module: ---
+Gnulib module: nextafter
 
 Portability problems fixed by Gnulib:
 @itemize
index 3074155..1fd5184 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/pow.html}
 
-Gnulib module: ---
+Gnulib module: pow
 
 Portability problems fixed by Gnulib:
 @itemize
index 8aeec91..1eab409 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/remainder.html}
 
-Gnulib module: ---
+Gnulib module: remainder
 
 Portability problems fixed by Gnulib:
 @itemize
index 0310afb..12ab1d1 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/rint.html}
 
-Gnulib module: ---
+Gnulib module: rint
 
 Portability problems fixed by Gnulib:
 @itemize
index 927e97e..28071cc 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sin.html}
 
-Gnulib module: ---
+Gnulib module: sin
 
 Portability problems fixed by Gnulib:
 @itemize
index 4e97f3f..09fa8f9 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sinh.html}
 
-Gnulib module: ---
+Gnulib module: sinh
 
 Portability problems fixed by Gnulib:
 @itemize
index 06ca605..30751c2 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sinl.html}
 
-Gnulib module: ---
+Gnulib module: sinl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 7dc2763..70ac1c5 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sqrt.html}
 
-Gnulib module: ---
+Gnulib module: sqrt
 
 Portability problems fixed by Gnulib:
 @itemize
index 8657f52..c91fa08 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sqrtl.html}
 
-Gnulib module: ---
+Gnulib module: sqrtl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 0ad6e8a..be55a25 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/tan.html}
 
-Gnulib module: ---
+Gnulib module: tan
 
 Portability problems fixed by Gnulib:
 @itemize
index 0bdae8c..71c27f7 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/tanh.html}
 
-Gnulib module: ---
+Gnulib module: tanh
 
 Portability problems fixed by Gnulib:
 @itemize
index 8e09447..109a598 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/tanl.html}
 
-Gnulib module: ---
+Gnulib module: tanl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 0748dec..1b21502 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/y0.html}
 
-Gnulib module: ---
+Gnulib module: y0
 
 Portability problems fixed by Gnulib:
 @itemize
index 7750150..6e703a0 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/y1.html}
 
-Gnulib module: ---
+Gnulib module: y1
 
 Portability problems fixed by Gnulib:
 @itemize
index bafed15..fef9d5d 100644 (file)
@@ -4,7 +4,7 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/yn.html}
 
-Gnulib module: ---
+Gnulib module: yn
 
 Portability problems fixed by Gnulib:
 @itemize
index f27446f..533424c 100644 (file)
@@ -14,6 +14,11 @@ mingw, BeOS.
 @item
 This header file is incomplete on some platforms:
 Cygwin 1.5.x, Haiku.
+
+@item
+This header file does not define @code{AI_ALL}, @code{AI_V4MAPPED},
+@code{AI_ADDRCONFIG} on some platforms:
+NetBSD 5.0.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index cbf2f84..b550bd0 100644 (file)
@@ -3,7 +3,7 @@
 @setfilename standards.info
 @settitle GNU Coding Standards
 @c This date is automagically updated when you save this file:
-@set lastupdate December 11, 2009
+@set lastupdate February 17, 2010
 @c %**end of header
 
 @dircategory GNU organization
@@ -27,7 +27,7 @@
 The GNU coding standards, last updated @value{lastupdate}.
 
 Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
 Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
@@ -509,7 +509,7 @@ and is not always appropriate, following this policy would have saved
 GCC developers many hours, or even days, per year.
 
 In the case of function-like macros like @code{REVERSIBLE_CC_MODE} in
-GCC which cannot be simply used in @code{if...)} statements, there is
+GCC which cannot be simply used in @code{if (...)} statements, there is
 an easy workaround.  Simply introduce another macro
 @code{HAS_REVERSIBLE_CC_MODE} as in the following example:
 
@@ -690,7 +690,7 @@ creating temporary files in world-writable directories.  In C, you can
 avoid this problem by creating temporary files in this manner:
 
 @example
-fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600);
+fd = open (filename, O_WRONLY | O_CREAT | O_EXCL, 0600);
 @end example
 
 @noindent
@@ -3531,7 +3531,7 @@ clear explanation of how the earlier version differed.
 
 The change log file is normally called @file{ChangeLog} and covers an
 entire directory.  Each directory can have its own change log, or a
-directory can use the change log of its parent directory--it's up to
+directory can use the change log of its parent directory---it's up to
 you.
 
 Another alternative is to record change log information with a version
@@ -3539,22 +3539,21 @@ control system such as RCS or CVS.  This can be converted automatically
 to a @file{ChangeLog} file using @code{rcs2log}; in Emacs, the command
 @kbd{C-x v a} (@code{vc-update-change-log}) does the job.
 
-There's no need to describe the full purpose of the changes or how they
-work together.  If you think that a change calls for explanation, you're
-probably right.  Please do explain it---but please put the explanation
-in comments in the code, where people will see it whenever they see the
-code.  For example, ``New function'' is enough for the change log when
-you add a function, because there should be a comment before the
-function definition to explain what it does.
+There's no need to describe the full purpose of the changes or how
+they work together.  However, sometimes it is useful to write one line
+to describe the overall purpose of a change or a batch of changes.  If
+you think that a change calls for explanation, you're probably right.
+Please do explain it---but please put the full explanation in comments
+in the code, where people will see it whenever they see the code.  For
+example, ``New function'' is enough for the change log when you add a
+function, because there should be a comment before the function
+definition to explain what it does.
 
 In the past, we recommended not mentioning changes in non-software
 files (manuals, help files, etc.) in change logs.  However, we've been
 advised that it is a good idea to include them, for the sake of
 copyright records.
 
-However, sometimes it is useful to write one line to describe the
-overall purpose of a batch of changes.
-
 The easiest way to add an entry to @file{ChangeLog} is with the Emacs
 command @kbd{M-x add-change-log-entry}.  An entry should have an
 asterisk, the name of the changed file, and then in parentheses the name
index 67986a2..a5e2e42 100755 (executable)
@@ -100,12 +100,24 @@ fi
 # An empty expression does not work with the native 'sed' on AIX 6.1.
 sed_noop='s,x,x,'
 
+# sed_comments is true or false, depending whether 'sed' supports comments.
+# (The GNU autoconf doc says that sed comments are not portable, but does
+# not say which 'sed' versions are affected.)
+if echo fo | sed -e 's/f/g/
+# s/o/u/
+s/o/e/' 2>/dev/null | grep ge > /dev/null; then
+  sed_comments=true
+else
+  sed_comments=false
+fi
+
 # func_usage
 # outputs to stdout the --help usage message.
 func_usage ()
 {
   echo "\
 Usage: gnulib-tool --list
+       gnulib-tool --find filename
        gnulib-tool --import [module1 ... moduleN]
        gnulib-tool --update
        gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
@@ -129,6 +141,7 @@ Usage: gnulib-tool --list
 
 Operation modes:
       --list                print the available module names
+      --find                find the modules which contain the specified file
       --import              import the given modules into the current package;
                             if no modules are specified, update the current
                             package from the current gnulib
@@ -163,6 +176,8 @@ General options:
                             directory.
       --local-dir=DIRECTORY  Specify a local override directory where to look
                             up files before looking in gnulib's directory.
+      --cache-modules       Enable module caching optimization.
+      --no-cache-modules    Disable module caching optimization.
       --verbose             Increase verbosity. May be repeated.
       --quiet               Decrease verbosity. May be repeated.
 
@@ -490,6 +505,13 @@ func_fatal_error ()
   func_exit 1
 }
 
+# func_warning message
+# Outputs to stderr a warning message,
+func_warning ()
+{
+  echo "gnulib-tool: warning: $1" 1>&2
+}
+
 # func_readlink SYMLINK
 # outputs the target of the given symlink.
 if (type -p readlink) > /dev/null 2>&1; then
@@ -639,39 +661,20 @@ func_ln_if_changed ()
   fi
 }
 
-# func_reset_sigpipe
-# Resets SIGPIPE to its default behaviour. SIGPIPE is signalled when a process
-# writes into a pipe with no readers, i.e. a pipe where all readers have
-# already closed their file descriptor that read from it or exited entirely.
-# The default behaviour is to terminate the current process without an error
-# message.
-# When "trap '' SIGPIPE" is in effect, the behaviour (at least with bash) is to
-# terminate the current process with an error message.
-# This function should be called at the beginning of a command that only
-# produces output to stdout (i.e. no side effects!), when the command that
-# will read from this pipe might prematurely exit or close its standard input
-# descriptor.
-if test -n "$BASH_VERSION"; then
-  # The problem has only been reported with bash. Probably it occurs only with
-  # bash-3.2. For the reasons, see
-  # <http://lists.gnu.org/archive/html/bug-bash/2008-12/msg00050.html>.
-  # Note that Solaris sh does not understand "trap - SIGPIPE".
-  func_reset_sigpipe ()
-  {
-    trap - SIGPIPE
-  }
-else
-  func_reset_sigpipe ()
-  {
-    :
-  }
-fi
-
-# Ensure an 'echo' command that does not interpret backslashes.
-# Test cases:
+# Ensure an 'echo' command that
+#   1. does not interpret backslashes and
+#   2. does not print an error message "broken pipe" when writing into a pipe
+#      with no writers.
+#
+# Test cases for problem 1:
 #   echo '\n' | wc -l                 prints 1 when OK, 2 when KO
 #   echo '\t' | grep t > /dev/null    has return code 0 when OK, 1 when KO
-# This problem is a weird heritage from SVR4. BSD got it right (except that
+# Test cases for problem 2:
+#   echo hi | true                    frequently prints
+#                                     "bash: echo: write error: Broken pipe"
+#                                     to standard error in bash 3.2.
+#
+# Problem 1 is a weird heritage from SVR4. BSD got it right (except that
 # BSD echo interprets '-n' as an option, which is also not desirable).
 # Nowadays the problem occurs in 4 situations:
 # - in bash, when the shell option xpg_echo is set (bash >= 2.04)
@@ -694,6 +697,12 @@ fi
 # - otherwise: respawn using /bin/sh and rely on the workarounds.
 # When respawning, we pass --no-reexec as first argument, so as to avoid
 # turning this script into a fork bomb in unlucky situations.
+#
+# Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not
+# the 'printf' built-in. See
+#   <http://lists.gnu.org/archive/html/bug-bash/2008-12/msg00050.html>
+#   <http://lists.gnu.org/archive/html/bug-gnulib/2010-02/msg00154.html>
+# The workaround is: define echo to a function that uses the printf built-in.
 have_echo=
 if echo '\t' | grep t > /dev/null; then
   have_echo=yes # Lucky!
@@ -718,7 +727,10 @@ fi
 # For bash >= 2.0: define echo to a function that uses the printf built-in.
 # For bash < 2.0: define echo to a function that uses cat of a here document.
 # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.)
-if test -z "$have_echo" \
+# Also handle problem 2, specific to bash 3.2, here.
+if { test -z "$have_echo" \
+     || case "$BASH_VERSION" in 3.2*) true;; *) false;; esac; \
+   } \
    && test -n "$BASH_VERSION"; then \
   if type printf 2>/dev/null | grep / > /dev/null; then
     # 'printf' is not a shell built-in.
@@ -818,6 +830,7 @@ fi
 # - mode            list or import or create-testdir or create-megatestdir
 # - destdir         from --dir
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - verbose         integer, default 0, inc/decremented by --verbose/--quiet
 # - libname, supplied_libname  from --lib
 # - sourcebase      from --source-base
@@ -848,6 +861,7 @@ fi
   mode=
   destdir=
   local_gnulib_dir=
+  modcache=true
   verbose=0
   libname=libgnu
   supplied_libname=
@@ -879,6 +893,9 @@ fi
       --list | --lis )
         mode=list
         shift ;;
+      --find | --fin | --fi | --f )
+        mode=find
+        shift ;;
       --import | --impor | --impo | --imp | --im | --i )
         mode=import
         shift ;;
@@ -923,6 +940,12 @@ fi
       --local-dir=* )
         local_gnulib_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
         shift ;;
+      --cache-modules | --cache-module | --cache-modul | --cache-modu | --cache-mod | --cache-mo | --cache-m | --cache- | --cache | --cach | --cac | --ca )
+        modcache=true
+        shift ;;
+      --no-cache-modules | --no-cache-module | --no-cache-modul | --no-cache-modu | --no-cache-mod | --no-cache-mo | --no-cache-m | --no-cache- | --no-cache | --no-cach | --no-cac | --no-ca )
+        modcache=false
+        shift ;;
       --verbose | --verbos | --verbo | --verb )
         verbose=`expr $verbose + 1`
         shift ;;
@@ -1071,7 +1094,7 @@ fi
       --no-vc-files )
         vc_files=false
         shift ;;
-      --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
+      --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch )
         do_changelog=false
         shift ;;
       --dry-run )
@@ -1135,7 +1158,7 @@ fi
     func_exit 1
   fi
   if test -z "$pobase" && test -n "$po_domain"; then
-    echo "gnulib-tool: warning: --po-domain has no effect without a --po-base option" 1>&2
+    func_warning "--po-domain has no effect without a --po-base option"
   fi
 
   # Determine the minimum supported autoconf version from the project's
@@ -1263,6 +1286,23 @@ func_lookup_file ()
   fi
 }
 
+# func_sanitize_modulelist
+# receives a list of possible module names on standard input, one per line.
+# It removes those which are just file names unrelated to modules, and outputs
+# the resulting list to standard output, one per line.
+func_sanitize_modulelist ()
+{
+  sed -e '/^CVS\//d' -e '/\/CVS\//d' \
+      -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
+      -e '/^COPYING$/d' -e '/\/COPYING$/d' \
+      -e '/^README$/d' -e '/\/README$/d' \
+      -e '/^TEMPLATE$/d' \
+      -e '/^TEMPLATE-EXTENDED$/d' \
+      -e '/^TEMPLATE-TESTS$/d' \
+      -e '/^\..*/d' \
+      -e '/~$/d'
+}
+
 # func_all_modules
 # Input:
 # - local_gnulib_dir  from --local-dir
@@ -1277,15 +1317,7 @@ func_all_modules ()
       (cd "$local_gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,' -e 's,\.diff$,,')
     fi
   } \
-      | sed -e '/^CVS\//d' -e '/\/CVS\//d' \
-            -e '/^ChangeLog$/d' -e '/\/ChangeLog$/d' \
-            -e '/^COPYING$/d' -e '/\/COPYING$/d' \
-            -e '/^README$/d' -e '/\/README$/d' \
-            -e '/^TEMPLATE$/d' \
-            -e '/^TEMPLATE-EXTENDED$/d' \
-            -e '/^TEMPLATE-TESTS$/d' \
-            -e '/^\..*/d' \
-            -e '/~$/d' \
+      | func_sanitize_modulelist \
       | sed -e '/-tests$/d' \
       | LC_ALL=C sort -u
 }
@@ -1311,7 +1343,7 @@ func_verify_module ()
     # Verify that building the module description with 'patch' succeeds.
     func_lookup_file "modules/$module"
   else
-    echo "gnulib-tool: module $module doesn't exist" 1>&2
+    func_warning "module $module doesn't exist"
     module=
   fi
 }
@@ -1342,6 +1374,14 @@ func_verify_tests_module ()
   esac
 }
 
+# Suffix of a sed expression that extracts a particular field from a
+# module description.
+# A field starts with a line that contains a keyword, such as 'Description',
+# followed by a colon and optional whitespace. All following lines, up to
+# the next field (or end of file if there is none) form the contents of the
+# field.
+# An absent field is equivalent to a field with empty contents.
+# NOTE: Keep this in sync with sed_extract_cache_prog below!
 sed_extract_prog=':[    ]*$/ {
   :a
     n
@@ -1364,56 +1404,409 @@ sed_extract_prog=':[    ]*$/ {
   :b
 }'
 
+# Piece of a sed expression that converts a field header line to a shell
+# variable name,
+# NOTE: Keep this in sync with sed_extract_prog above!
+sed_extract_field_header='
+  s/^Description:[      ]*$/description/
+  s/^Status:[   ]*$/status/
+  s/^Notice:[   ]*$/notice/
+  s/^Applicability:[    ]*$/applicability/
+  s/^Files:[    ]*$/files/
+  s/^Depends-on:[       ]*$/dependson/
+  s/^configure\.ac-early:[      ]*$/configureac_early/
+  s/^configure\.ac:[    ]*$/configureac/
+  s/^Makefile\.am:[     ]*$/makefile/
+  s/^Include:[  ]*$/include/
+  s/^Link:[     ]*$/link/
+  s/^License:[  ]*$/license/
+  s/^Maintainer:[       ]*$/maintainer/'
+
+if $modcache; then
+
+  # Note: The 'eval' silences stderr output in dash.
+  if declare -A x 2>/dev/null && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }; then
+    # Zsh 4 and Bash 4 have associative arrays.
+    have_associative=true
+  else
+    # For other shells, use 'eval' with computed shell variable names.
+    have_associative=false
+  fi
+
+  if $have_associative; then
+
+    # Declare the associative arrays.
+    declare -A modcache_cached
+    sed_to_declare_statement='s|^.*/\([a-zA-Z0-9_]*\)/$|declare -A modcache_\1|p'
+    declare_script=`echo "$sed_extract_field_header" | sed -n -e "$sed_to_declare_statement"`
+    eval "$declare_script"
+
+  else
+
+    # func_cache_var module
+    # computes the cache variable name corresponding to $module.
+    # Note: This computation can map different module names to the same
+    # cachevar (such as 'foo-bar', 'foo_bar', or 'foo/bar'); the caller has
+    # to protect against this case.
+    # Output:
+    # - cachevar               a shell variable name
+    if (f=foo; eval echo '${f//o/e}') < /dev/null 2>/dev/null | grep fee >/dev/null; then
+      # Bash 2.0 and newer, ksh, and zsh support the syntax
+      #   ${param//pattern/replacement}
+      # as a shorthand for
+      #   `echo "$param" | sed -e "s/pattern/replacement/g"`.
+      # Note: The 'eval' above silences stderr output in dash.
+      func_cache_var ()
+      {
+        cachevar=c_${1//[!a-zA-Z0-9_]/_}
+      }
+    else
+      func_cache_var ()
+      {
+        case $1 in
+          *[!a-zA-Z0-9_]*)
+            cachevar=c_`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'` ;;
+          *)
+            cachevar=c_$1 ;;
+        esac
+      }
+    fi
+
+  fi
+
+  # func_init_sed_convert_to_cache_statements
+  # Input:
+  # - modcachevar_assignment
+  # Output:
+  # - sed_convert_to_cache_statements
+  func_init_sed_convert_to_cache_statements ()
+  {
+    # 'sed' script that turns a module description into shell script
+    # assignments, suitable to be eval'ed.  All active characters are escaped.
+    # This script turns
+    #   Description:
+    #   Some module's description
+    #
+    #   Files:
+    #   lib/file.h
+    # into:
+    #   modcache_description[$1]=\
+    #   'Some module'"'"'s description
+    #   '
+    #   modcache_files[$1]=\
+    #   'lib/file.h'
+    # or:
+    #   c_MODULE_description_set=set; c_MODULE_description=\
+    #   'Some module'"'"'s description
+    #   '
+    #   c_MODULE_files_set=set; c_MODULE_files=\
+    #   'lib/file.h'
+    # The script consists of two parts:
+    # 1) Ignore the lines before the first field header.
+    # 2) A loop, treating non-field-header lines by escaping single quotes
+    #    and adding a closing quote in the last line,
+    sed_convert_to_cache_statements="
+      :llla
+        # Here we have not yet seen a field header.
+
+        # See if the current line contains a field header.
+        t llla1
+        :llla1
+        ${sed_extract_field_header}
+        t lllb
+
+        # No field header. Ignore the line.
+
+        # Read the next line. Upon EOF, just exit.
+        n
+      b llla
+
+      :lllb
+        # The current line contains a field header.
+
+        # Turn it into the beginning of an assignment.
+        s/^\\(.*\\)\$/${modcachevar_assignment}\\\\/
+
+        # Move it to the hold space. Don't print it yet,
+        # because we want no assignment if the field is empty.
+        h
+
+        # Read the next line.
+        # Upon EOF, the field was empty. Print no assignment. Just exit.
+        n
+
+        # See if the current line contains a field header.
+        t lllb1
+        :lllb1
+        ${sed_extract_field_header}
+        # If it is, the previous field was empty. Print no assignment.
+        t lllb
+
+        # Not a field header.
+
+        # Print the previous line, held in the hold space.
+        x
+        p
+        x
+
+        # Transform single quotes.
+        s/'/'\"'\"'/g
+
+        # Prepend a single quote.
+        s/^/'/
+
+        :lllc
+
+          # Move it to the hold space.
+          h
+
+          # Read the next line.
+          # Upon EOF, branch.
+          \${
+            b llle
+          }
+          n
+
+          # See if the current line contains a field header.
+          t lllc1
+          :lllc1
+          ${sed_extract_field_header}
+          t llld
+
+          # Print the previous line, held in the hold space.
+          x
+          p
+          x
+
+          # Transform single quotes.
+          s/'/'\"'\"'/g
+
+        b lllc
+
+        :llld
+        # A field header.
+        # Print the previous line, held in the hold space, with a single quote
+        # to end the assignment.
+        x
+        s/\$/'/
+        p
+        x
+
+      b lllb
+
+      :llle
+      # EOF seen.
+      # Print the previous line, held in the hold space, with a single quote
+      # to end the assignment.
+      x
+      s/\$/'/
+      p
+      # Exit.
+      n
+      "
+    if ! $sed_comments; then
+      # Remove comments.
+      sed_convert_to_cache_statements=`echo "$sed_convert_to_cache_statements" \
+                                       | sed -e 's/^ *//' -e 's/^#.*//'`
+    fi
+  }
+
+  if $have_associative; then
+    # sed_convert_to_cache_statements does not depend on the module.
+    modcachevar_assignment='modcache_\1[$1]='
+    func_init_sed_convert_to_cache_statements
+  fi
+
+  # func_cache_lookup_module module
+  #
+  # looks up a module, like 'func_lookup_file modules/$module', and stores all
+  # of its relevant data in a cache in the memory of the processing shell.  If
+  # already cached, it does not look it up again, thus saving file access time.
+  # Parameters:
+  # - module                             non-empty string
+  # Output if $have_associative:
+  # - modcache_cached[$module]           set to yes
+  # - modcache_description[$module] ==
+  # - modcache_status[$module]        \  set to the field's value, minus the
+  # - ...                             /  final newline,
+  # - modcache_maintainer[$module]  ==   or unset if the field's value is empty
+  # Output if ! $have_associative:
+  # - cachevar                           a shell variable name
+  # - ${cachevar}_cached                 set to $module
+  # - ${cachevar}_description       ==
+  # - ${cachevar}_status              \  set to the field's value, minus the
+  # - ...                             /  final newline,
+  # - ${cachevar}_maintainer        ==   or unset if the field's value is empty
+  # - ${cachevar}_description_set   ==
+  # - ${cachevar}_status_set          \  set to non-empty if the field's value
+  # - ...                             /  is non-empty,
+  # - ${cachevar}_maintainer_set    ==   or unset if the field's value is empty
+  func_cache_lookup_module ()
+  {
+    if $have_associative; then
+      cached=${modcache_cached[$1]}
+    else
+      func_cache_var "$1"
+      eval "cached=\"\$${cachevar}_cached\""
+    fi
+    if test -z "$cached"; then
+      # Not found in cache. Look it up on the file system.
+      func_lookup_file "modules/$1"
+      if $have_associative; then
+        modcache_cached[$1]=yes
+      else
+        eval "${cachevar}_cached=\"\$1\""
+      fi
+      if ! $have_associative; then
+        # sed_convert_to_cache_statements depends on the module.
+        modcachevar_assignment="${cachevar}"'_\1_set=set; '"${cachevar}"'_\1='
+        func_init_sed_convert_to_cache_statements
+      fi
+      cache_statements=`LC_ALL=C sed -n -e "$sed_convert_to_cache_statements" < "$lookedup_file"`
+      eval "$cache_statements"
+    else
+      if ! $have_associative; then
+        if test "$1" != "$cached"; then
+          func_fatal_error "cache variable collision between $1 and $cached"
+        fi
+      fi
+    fi
+  }
+
+fi
+
 # func_get_description module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_description ()
 {
-  func_lookup_file "modules/$1"
-  sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_description[$1]+set}"; then
+        echo "${modcache_description[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_description_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_description\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
 }
 
 # func_get_status module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_status ()
 {
-  func_lookup_file "modules/$1"
-  sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_status[$1]+set}"; then
+        echo "${modcache_status[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_status_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_status\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
 }
 
 # func_get_notice module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_notice ()
 {
-  func_lookup_file "modules/$1"
-  sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_notice[$1]+set}"; then
+        echo "${modcache_notice[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_notice_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_notice\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
 }
 
 # func_get_applicability module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 # The expected result (on stdout) is either 'main', or 'tests', or 'all'.
 func_get_applicability ()
 {
-  func_lookup_file "modules/$1"
-  { sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    my_applicability=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
+  else
+    func_cache_lookup_module "$1"
+    # Get the field's value, without the final newline.
+    if $have_associative; then
+      my_applicability="${modcache_applicability[$1]}"
+    else
+      eval "my_applicability=\"\$${cachevar}_applicability\""
+    fi
+  fi
+  if test -n "$my_applicability"; then
+    echo $my_applicability
+  else
     # The default is 'main' or 'tests', depending on the module's name.
-    case "$1" in
+    case $1 in
       *-tests) echo "tests";;
       *)       echo "main";;
     esac
-  } | sed -e 's,^ *$,,' | sed -e 1q
+  fi
 }
 
 # func_get_filelist module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_filelist ()
 {
-  func_lookup_file "modules/$1"
-  sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_files[$1]+set}"; then
+        echo "${modcache_files[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_files_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_files\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
   echo m4/00gnulib.m4
   echo m4/gnulib-common.m4
   case "$autoconf_minversion" in
@@ -1428,6 +1821,7 @@ func_get_filelist ()
 # elements starting with prefix and ending with suffix are considered.
 # Processing: removed_prefix and removed_suffix are removed from each element,
 # added_prefix and added_suffix are added to each element.
+# prefix, suffix should not contain shell-special characters.
 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
 # added_prefix, added_suffix should not contain the characters \|&.
 func_filter_filelist ()
@@ -1439,8 +1833,10 @@ func_filter_filelist ()
         }; then
     ffflist=
     for fff in $3; do
+      # Do not quote possibly-empty parameters in case patterns,
+      # AIX and HP-UX ksh won't match them if they are empty.
       case "$fff" in
-        "$4"*"$5")
+        $4*$5)
           if test -n "$6"; then
             func_remove_prefix fff "$6"
           fi
@@ -1460,7 +1856,7 @@ func_filter_filelist ()
     sed_fff_filter="s|^$6\(.*\)$7\$|$8\\1$9|"
     ffflist=`for fff in $3; do
                case "$fff" in
-                 "$4"*"$5") echo "$fff" ;;
+                 $4*$5) echo "$fff" ;;
                esac
              done | sed -e "$sed_fff_filter"`
   fi
@@ -1470,6 +1866,7 @@ func_filter_filelist ()
 # func_get_dependencies module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_dependencies ()
 {
   # ${module}-tests always implicitly depends on ${module}.
@@ -1481,35 +1878,102 @@ func_get_dependencies ()
       ;;
   esac
   # Then the explicit dependencies listed in the module description.
-  func_lookup_file "modules/$1"
-  sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_dependson[$1]+set}"; then
+        echo "${modcache_dependson[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_dependson_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_dependson\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
 }
 
 # func_get_autoconf_early_snippet module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_autoconf_early_snippet ()
 {
-  func_lookup_file "modules/$1"
-  sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_configureac_early[$1]+set}"; then
+        echo "${modcache_configureac_early[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_configureac_early_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_configureac_early\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
 }
 
 # func_get_autoconf_snippet module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_autoconf_snippet ()
 {
-  func_lookup_file "modules/$1"
-  sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_configureac[$1]+set}"; then
+        echo "${modcache_configureac[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_configureac_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_configureac\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
 }
 
 # 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_lookup_file "modules/$1"
-  sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_makefile[$1]+set}"; then
+        echo "${modcache_makefile[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_makefile_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_makefile\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
   case "$1" in
     *-tests)
       # *-tests module live in tests/, not lib/.
@@ -1533,15 +1997,29 @@ func_get_automake_snippet ()
       }'
       sed_extract_mentioned_files='s/^lib_SOURCES[      ]*+=[   ]*//p'
       already_mentioned_files=` \
-        sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file" \
+        { if ! $modcache; then
+            sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
+          else
+            if $have_associative; then
+              if test -n "${modcache_makefile[$1]+set}"; then
+                echo "${modcache_makefile[$1]}"
+              fi
+            else
+              eval 'field_set="$'"${cachevar}"'_makefile_set"'
+              if test -n "$field_set"; then
+                eval 'field_value="$'"${cachevar}"'_makefile"'
+                echo "${field_value}"
+              fi
+            fi
+          fi
+        } \
         | sed -e "$sed_combine_lines" \
         | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
       all_files=`func_get_filelist $1`
       func_filter_filelist lib_files "$nl" "$all_files" 'lib/' '' 'lib/' ''
       # Remove $already_mentioned_files from $lib_files.
       echo "$lib_files" | LC_ALL=C sort -u > "$tmp"/lib-files
-      extra_files=`func_reset_sigpipe; \
-                   for f in $already_mentioned_files; do echo $f; done \
+      extra_files=`for f in $already_mentioned_files; do echo $f; done \
                    | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
       if test -n "$extra_files"; then
         echo "EXTRA_DIST +=" $extra_files
@@ -1589,29 +2067,82 @@ func_get_automake_snippet ()
 # func_get_include_directive module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_include_directive ()
 {
-  func_lookup_file "modules/$1"
-  sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file" | \
-  sed -e 's/^\(["<]\)/#include \1/'
+  {
+    if ! $modcache; then
+      func_lookup_file "modules/$1"
+      sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
+    else
+      func_cache_lookup_module "$1"
+      # Output the field's value, including the final newline (if any).
+      if $have_associative; then
+        if test -n "${modcache_include[$1]+set}"; then
+          echo "${modcache_include[$1]}"
+        fi
+      else
+        eval "field_set=\"\$${cachevar}_include_set\""
+        if test -n "$field_set"; then
+          eval "field_value=\"\$${cachevar}_include\""
+          echo "${field_value}"
+        fi
+      fi
+    fi
+  } | sed -e 's/^\(["<]\)/#include \1/'
 }
 
 # func_get_link_directive module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_link_directive ()
 {
-  func_lookup_file "modules/$1"
-  sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_link[$1]+set}"; then
+        echo "${modcache_link[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_link_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_link\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
 }
 
 # func_get_license module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_license ()
 {
-  func_lookup_file "modules/$1"
-  { sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
+  {
+    if ! $modcache; then
+      func_lookup_file "modules/$1"
+      sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
+    else
+      func_cache_lookup_module "$1"
+      # Output the field's value, including the final newline (if any).
+      if $have_associative; then
+        if test -n "${modcache_license[$1]+set}"; then
+          echo "${modcache_license[$1]}"
+        fi
+      else
+        eval "field_set=\"\$${cachevar}_license_set\""
+        if test -n "$field_set"; then
+          eval "field_value=\"\$${cachevar}_license\""
+          echo "${field_value}"
+        fi
+      fi
+    fi
     # The default is GPL.
     echo "GPL"
   } | sed -e 's,^ *$,,' | sed -e 1q
@@ -1620,10 +2151,27 @@ func_get_license ()
 # func_get_maintainer module
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
 func_get_maintainer ()
 {
-  func_lookup_file "modules/$1"
-  sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
+  if ! $modcache; then
+    func_lookup_file "modules/$1"
+    sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
+  else
+    func_cache_lookup_module "$1"
+    # Output the field's value, including the final newline (if any).
+    if $have_associative; then
+      if test -n "${modcache_maintainer[$1]+set}"; then
+        echo "${modcache_maintainer[$1]}"
+      fi
+    else
+      eval "field_set=\"\$${cachevar}_maintainer_set\""
+      if test -n "$field_set"; then
+        eval "field_value=\"\$${cachevar}_maintainer\""
+        echo "${field_value}"
+      fi
+    fi
+  fi
 }
 
 # func_get_tests_module module
@@ -1656,6 +2204,7 @@ func_acceptable ()
 # func_modules_transitive_closure
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - modules         list of specified modules
 # - inctests        true if tests should be included, blank otherwise
 # - incobsolete     true if obsolete modules among dependencies should be
@@ -1686,7 +2235,7 @@ func_modules_transitive_closure ()
           # 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
-            echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2
+            func_warning "module $module has duplicated dependencies: "`echo $duplicated_deps`
           fi
           for dep in $deps; do
             if test -n "$incobsolete" \
@@ -1706,7 +2255,7 @@ func_modules_transitive_closure ()
     handledmodules=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
     # Remove $handledmodules from $inmodules.
     for m in $inmodules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/queued-modules
-    inmodules=`func_reset_sigpipe; echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
+    inmodules=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
   done
   modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
   rm -f "$tmp"/queued-modules
@@ -1715,6 +2264,7 @@ func_modules_transitive_closure ()
 # func_modules_add_dummy
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - modules         list of modules, including dependencies
 # Output:
 # - modules         list of modules, including 'dummy' if needed
@@ -1756,6 +2306,7 @@ ba
 # func_modules_notice
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - verbose         integer, default 0, inc/decremented by --verbose/--quiet
 # - modules         list of modules, including dependencies
 func_modules_notice ()
@@ -1777,6 +2328,7 @@ func_modules_notice ()
 # func_modules_to_filelist
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - modules         list of modules, including dependencies
 # Output:
 # - files           list of files
@@ -1845,6 +2397,7 @@ func_dest_tmpfilename ()
 # Input:
 # - destdir         target directory
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - f               the original file name
 # - lookedup_file   name of the merged (combined) file
 # - lookedup_tmp    true if it is located in the tmp directory, blank otherwise
@@ -1878,6 +2431,7 @@ func_add_file ()
 # Input:
 # - destdir         target directory
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - f               the original file name
 # - lookedup_file   name of the merged (combined) file
 # - lookedup_tmp    true if it is located in the tmp directory, blank otherwise
@@ -1924,6 +2478,7 @@ func_update_file ()
 # emits the contents of library makefile to standard output.
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - modules         list of modules, including dependencies
 # - libname         library name
 # - pobase          directory relative to destdir where to place *.po files
@@ -1988,6 +2543,7 @@ func_emit_lib_Makefile_am ()
       if test -n "$module"; then
         {
           func_get_automake_snippet "$module" |
+            LC_ALL=C \
             sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
                 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
                 -e "$sed_eliminate_LDFLAGS" \
@@ -1999,16 +2555,16 @@ func_emit_lib_Makefile_am ()
             echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
             echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
           fi
-        } > amsnippet.tmp
+        } > "$tmp"/amsnippet
         # Skip the contents if it's entirely empty.
-        if grep '[^     ]' amsnippet.tmp > /dev/null ; then
+        if grep '[^     ]' "$tmp"/amsnippet > /dev/null ; then
           echo "## begin gnulib module $module"
           echo
-          cat amsnippet.tmp
+          cat "$tmp"/amsnippet
           echo "## end   gnulib module $module"
           echo
         fi
-        rm -f amsnippet.tmp
+        rm -f "$tmp"/amsnippet
         # Test whether there are some source files in subdirectories.
         for f in `func_get_filelist "$module"`; do
           case $f in
@@ -2020,7 +2576,7 @@ func_emit_lib_Makefile_am ()
         done
       fi
     done
-  } > allsnippets.tmp
+  } > "$tmp"/allsnippets
   if test -z "$makefile_name"; then
     # If there are source files in subdirectories, prevent collision of the
     # object files (example: hash.c and libxml/hash.c).
@@ -2038,7 +2594,7 @@ func_emit_lib_Makefile_am ()
     echo "noinst_LTLIBRARIES ="
     # Automake versions < 1.9b create an empty pkgdatadir at installation time
     # if you specify pkgdata_DATA to empty. This is a workaround.
-    if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
+    if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets > /dev/null; then
       echo "pkgdata_DATA ="
     fi
     echo "EXTRA_DIST ="
@@ -2072,7 +2628,7 @@ func_emit_lib_Makefile_am ()
     echo "AM_CFLAGS ="
   fi
   echo
-  if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" allsnippets.tmp > /dev/null \
+  if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets > /dev/null \
      || { test -n "$makefile_name" \
           && test -f "$sourcebase/Makefile.am" \
           && LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev/null; \
@@ -2100,7 +2656,7 @@ func_emit_lib_Makefile_am ()
     echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
     echo
   fi
-  cat allsnippets.tmp \
+  cat "$tmp"/allsnippets \
     | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
   echo
   echo "mostlyclean-local: mostlyclean-generic"
@@ -2110,13 +2666,14 @@ func_emit_lib_Makefile_am ()
   echo "         fi; \\"
   echo "       done; \\"
   echo "       :"
-  rm -f allsnippets.tmp
+  rm -f "$tmp"/allsnippets
 }
 
 # func_emit_po_Makevars
 # emits the contents of po/ makefile parameterization to standard output.
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - sourcebase      directory relative to destdir where to place source code
 # - pobase          directory relative to destdir where to place *.po files
 # - po_domain       prefix of i18n domain to use (without -gnulib suffix)
@@ -2178,6 +2735,7 @@ EOF
 # emits the file list to be passed to xgettext to standard output.
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - sourcebase      directory relative to destdir where to place source code
 # - files           list of new files
 func_emit_po_POTFILES_in ()
@@ -2193,6 +2751,7 @@ func_emit_po_POTFILES_in ()
 # emits the contents of tests makefile to standard output.
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - modules         list of modules, including dependencies
 # - libname         library name
 # - auxdir          directory relative to destdir where to place build aux files
@@ -2244,6 +2803,7 @@ func_emit_tests_Makefile_am ()
       if test -n "$module"; then
         {
           func_get_automake_snippet "$module" |
+            LC_ALL=C \
             sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
                 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
                 -e "$sed_eliminate_LDFLAGS" \
@@ -2255,16 +2815,16 @@ func_emit_tests_Makefile_am ()
             echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
             echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
           fi
-        } > amsnippet.tmp
+        } > "$tmp"/amsnippet
         # Skip the contents if it's entirely empty.
-        if grep '[^     ]' amsnippet.tmp > /dev/null ; then
+        if grep '[^     ]' "$tmp"/amsnippet > /dev/null ; then
           echo "## begin gnulib module $module"
           echo
-          cat amsnippet.tmp
+          cat "$tmp"/amsnippet
           echo "## end   gnulib module $module"
           echo
         fi
-        rm -f amsnippet.tmp
+        rm -f "$tmp"/amsnippet
         # Test whether there are some source files in subdirectories.
         for f in `func_get_filelist "$module"`; do
           case $f in
@@ -2276,7 +2836,7 @@ func_emit_tests_Makefile_am ()
         done
       fi
     done
-  } > allsnippets.tmp
+  } > "$tmp"/allsnippets
   # Generate dependencies here, since it eases the debugging of test failures.
   # If there are source files in subdirectories, prevent collision of the
   # object files (example: hash.c and libxml/hash.c).
@@ -2312,7 +2872,7 @@ func_emit_tests_Makefile_am ()
   fi
   # Automake versions < 1.9b create an empty pkgdatadir at installation time
   # if you specify pkgdata_DATA to empty. This is a workaround.
-  if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
+  if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets > /dev/null; then
     echo "pkgdata_DATA ="
   fi
   echo "EXTRA_DIST ="
@@ -2370,7 +2930,12 @@ func_emit_tests_Makefile_am ()
     echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
     echo
   fi
-  cat allsnippets.tmp \
+  # Many test scripts use ${EXEEXT} or ${srcdir}.
+  # EXEEXT is defined by AC_PROG_CC through autoconf.
+  # srcdir is defined by autoconf and automake.
+  echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
+  echo
+  cat "$tmp"/allsnippets \
     | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
   echo "# Clean up after Solaris cc."
   echo "clean-local:"
@@ -2383,7 +2948,7 @@ func_emit_tests_Makefile_am ()
   echo "         fi; \\"
   echo "       done; \\"
   echo "       :"
-  rm -f allsnippets.tmp
+  rm -f "$tmp"/allsnippets
 }
 
 # func_emit_initmacro_start macro_prefix
@@ -2502,6 +3067,7 @@ func_emit_initmacro_done ()
 # Uses also the variables
 # - destdir         target directory
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - verbose         integer, default 0, inc/decremented by --verbose/--quiet
 # - libname         library name
 # - sourcebase      directory relative to destdir where to place source code
@@ -2779,8 +3345,7 @@ func_import ()
   fi
   # Determine tests-related module list.
   echo "$final_modules" | LC_ALL=C sort -u > "$tmp"/final-modules
-  testsrelated_modules=`func_reset_sigpipe
-                        for module in $main_modules; do
+  testsrelated_modules=`for module in $main_modules; do
                           if test \`func_get_applicability $module\` = main; then
                             echo $module
                           fi
@@ -3681,8 +4246,7 @@ s,//*$,/,'
         if test -f "$destdir/$dir$ignore"; then
           if test -n "$dir_added" || test -n "$dir_removed"; then
             sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL=C sort > "$tmp"/ignore
-            (func_reset_sigpipe
-             echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \
+            (echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \
                | LC_ALL=C join -v 1 - "$tmp"/ignore > "$tmp"/ignore-added
              echo "$dir_removed" | sed -e '/^$/d' | LC_ALL=C sort -u \
                | LC_ALL=C join -v 1 - "$tmp"/ignore > "$tmp"/ignore-removed
@@ -3836,6 +4400,7 @@ s,//*$,/,'
 # func_create_testdir testdir modules
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - auxdir          directory relative to destdir where to place build aux files
 func_create_testdir ()
 {
@@ -3845,8 +4410,9 @@ func_create_testdir ()
     # All modules together.
     # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
     # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
+    # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME.
     modules=`func_all_modules`
-    modules=`for m in $modules; do case $m in config-h | ftruncate | mountlist) ;; *) echo $m;; esac; done`
+    modules=`for m in $modules; do case $m in config-h | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done`
   fi
   modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
 
@@ -3877,19 +4443,19 @@ func_create_testdir ()
               GPLv2+)
                 case "$license" in
                   GPLv2+ | LGPLv2+) ;;
-                  *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
+                  *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
                 esac
                 ;;
               LGPL)
                 case "$license" in
                   LGPL | LGPLv2+) ;;
-                  *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
+                  *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
                 esac
                 ;;
               LGPLv2+)
                 case "$license" in
                   LGPLv2+) ;;
-                  *) echo "warning: module $requested_module depends on a module with an incompatible license: $module" 1>&2 ;;
+                  *) func_warning "module $requested_module depends on a module with an incompatible license: $module" ;;
                 esac
                 ;;
             esac
@@ -4326,6 +4892,7 @@ func_create_testdir ()
 # func_create_megatestdir megatestdir allmodules
 # Input:
 # - local_gnulib_dir  from --local-dir
+# - modcache        true or false, from --cache-modules/--no-cache-modules
 # - auxdir          directory relative to destdir where to place build aux files
 func_create_megatestdir ()
 {
@@ -4434,6 +5001,40 @@ case $mode in
     func_all_modules
     ;;
 
+  find )
+    # sed expression that converts a literal to a basic regular expression.
+    # Needs to handle . [ \ * ^ $.
+    sed_literal_to_basic_regex='s/\\/\\\\/g
+s/\[/\\[/g
+s/\^/\\^/g
+s/\([.*$]\)/[\1]/g'
+    for filename
+    do
+      if test -f "$gnulib_dir/$filename" \
+         || { test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$filename"; }; then
+        filename_anywhere_regex=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`
+        filename_line_regex='^'"$filename_anywhere_regex"'$'
+        module_candidates=`
+          {
+            (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,')
+            if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
+              (cd "$local_gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^modules/,,' -e 's,\.diff$,,')
+            fi
+          } \
+            | func_sanitize_modulelist \
+            | LC_ALL=C sort -u
+          `
+        for module in $module_candidates; do
+          if func_get_filelist $module | grep "$filename_line_regex" > /dev/null; then
+            echo $module
+          fi
+        done
+      else
+        func_warning "file $filename does not exist"
+      fi
+    done
+    ;;
+
   import | update )
 
     # Where to import.
index 78b98db..b913d1b 100644 (file)
 #include <unistd.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || __STRICT_ANSI__
-#  define __format__ format
-#  define __printf__ printf
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
index 9a78778..a1cbf88 100644 (file)
@@ -339,7 +339,7 @@ convert_options (const struct argp *argp,
                        values (the sign of the lower bits is preserved
                        however)...  */
                     cvt->long_end->val =
-                      ((opt->key | real->key) & USER_MASK)
+                      ((opt->key ? opt->key : real->key) & USER_MASK)
                       + (((group - cvt->parser->groups) + 1) << USER_BITS);
 
                     /* Keep the LONG_OPTS list terminated.  */
index cc9dc07..3667224 100644 (file)
 #endif
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || __STRICT_ANSI__
-#  define __format__ format
-#  define __printf__ printf
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
index 9e150b9..a120691 100644 (file)
 #ifndef _GL_ARPA_INET_H
 #define _GL_ARPA_INET_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -70,10 +70,10 @@ extern const char *inet_ntop (int af, const void *restrict src,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_ntop
-# define inet_ntop(af,src,dst,cnt) \
-    (GL_LINK_WARNING ("inet_ntop is unportable - " \
-                      "use gnulib module inet_ntop for portability"), \
-     inet_ntop (af, src, dst, cnt))
+# if HAVE_RAW_DECL_INET_NTOP
+_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
+                 "use gnulib module inet_ntop for portability");
+# endif
 #endif
 
 #if @GNULIB_INET_PTON@
@@ -83,10 +83,10 @@ extern int inet_pton (int af, const char *restrict src, void *restrict dst)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_pton
-# define inet_pton(af,src,dst) \
-  (GL_LINK_WARNING ("inet_pton is unportable - " \
-                    "use gnulib module inet_pton for portability"), \
-   inet_pton (af, src, dst))
+# if HAVE_RAW_DECL_INET_PTON
+_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
+                 "use gnulib module inet_pton for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
index 1e82240..c047913 100644 (file)
@@ -294,7 +294,7 @@ qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
 
       if (count < 0)
         {
-          if (errno == ENOSYS || errno == ENOTSUP)
+          if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
             {
               count = 0;
               entries = NULL;
@@ -358,7 +358,8 @@ qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
       if (ret < 0 && saved_errno == 0)
         {
           saved_errno = errno;
-          if (errno == ENOSYS && !acl_nontrivial (count, entries))
+          if ((errno == ENOSYS || errno == EOPNOTSUPP)
+              && !acl_nontrivial (count, entries))
             saved_errno = 0;
         }
       else
index 53df794..884cec8 100644 (file)
  */
 
 #include "trigl.h"
-#ifdef HAVE_SINL
-#include "trigl.c"
-#include "sincosl.c"
-#endif
 
 long double cosl(long double x)
 {
index ba2314c..c9b1063 100644 (file)
@@ -36,7 +36,7 @@
 #ifndef _GL_CTYPE_H
 #define _GL_CTYPE_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Return non-zero if c is a blank, i.e. a space or tab character.  */
 #if @GNULIB_ISBLANK@
@@ -45,10 +45,10 @@ extern int isblank (int c);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef isblank
-# define isblank(c) \
-    (GL_LINK_WARNING ("isblank is unportable - " \
-                      "use gnulib module isblank for portability"), \
-     isblank (c))
+# if HAVE_RAW_DECL_ISBLANK
+_GL_WARN_ON_USE (isblank, "isblank is unportable - "
+                 "use gnulib module isblank for portability");
+# endif
 #endif
 
 #endif /* _GL_CTYPE_H */
index 4b02cfb..ccd0a10 100644 (file)
 /* Get ino_t.  Needed on some systems, including glibc 2.8.  */
 #include <sys/types.h>
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -53,10 +52,10 @@ extern int dirfd (DIR *dir) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dirfd
-# define dirfd(d) \
-    (GL_LINK_WARNING ("dirfd is unportable - " \
-                      "use gnulib module dirfd for portability"), \
-     dirfd (d))
+# if HAVE_RAW_DECL_DIRFD
+_GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
+                 "use gnulib module dirfd for portability");
+# endif
 #endif
 
 #if @GNULIB_FDOPENDIR@
@@ -74,10 +73,10 @@ extern DIR *fdopendir (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fdopendir
-# define fdopendir(f) \
-    (GL_LINK_WARNING ("fdopendir is unportable - " \
-                      "use gnulib module fdopendir for portability"), \
-     fdopendir (f))
+# if HAVE_RAW_DECL_FDOPENDIR
+_GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
+                 "use gnulib module fdopendir for portability");
+# endif
 #endif
 
 #if @REPLACE_OPENDIR@
@@ -98,10 +97,10 @@ extern int scandir (const char *dir, struct dirent ***namelist,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef scandir
-# define scandir(d,n,f,c) \
-    (GL_LINK_WARNING ("scandir is unportable - " \
-                      "use gnulib module scandir for portability"), \
-     scandir (d, n, f, c))
+# if HAVE_RAW_DECL_SCANDIR
+_GL_WARN_ON_USE (scandir, "scandir is unportable - "
+                 "use gnulib module scandir for portability");
+# endif
 #endif
 
 #if @GNULIB_ALPHASORT@
@@ -112,10 +111,10 @@ extern int alphasort (const struct dirent **, const struct dirent **)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef alphasort
-# define alphasort(a,b) \
-    (GL_LINK_WARNING ("alphasort is unportable - " \
-                      "use gnulib module alphasort for portability"), \
-     alphasort (a, b))
+# if HAVE_RAW_DECL_ALPHASORT
+_GL_WARN_ON_USE (alphasort, "alphasort is unportable - "
+                 "use gnulib module alphasort for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
index b4ae982..9deef02 100644 (file)
 #define _ERROR_H 1
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
index ba744d5..29efc2b 100644 (file)
 int
 euidaccess (const char *file, int mode)
 {
-#if HAVE_FACCESSAT
+#if HAVE_FACCESSAT                      /* glibc */
   return faccessat (AT_FDCWD, file, mode, AT_EACCESS);
-#elif defined EFF_ONLY_OK
+#elif defined EFF_ONLY_OK               /* IRIX, OSF/1, Interix */
   return access (file, mode | EFF_ONLY_OK);
-#elif defined ACC_SELF
+#elif defined ACC_SELF                  /* AIX */
   return accessx (file, mode, ACC_SELF);
-#elif HAVE_EACCESS
+#elif HAVE_EACCESS                      /* FreeBSD */
   return eaccess (file, mode);
-#else
+#else       /* MacOS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, BeOS */
 
   uid_t uid = getuid ();
   gid_t gid = getgid ();
index 92bb50d..a1d9e23 100644 (file)
@@ -27,7 +27,6 @@
 #include <sys/types.h>
 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
 # include <sys/stat.h>
-# include <unistd.h>
 #endif
 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
 
@@ -39,7 +38,6 @@
 #include <sys/types.h>
 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
 # include <sys/stat.h>
-# include <unistd.h>
 #endif
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
 #ifndef _GL_FCNTL_H
 #define _GL_FCNTL_H
 
+#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
+# include <unistd.h>
+#endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* Declare overridden functions.  */
 
@@ -69,10 +71,10 @@ extern int fcntl (int fd, int action, ...);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fcntl
-# define fcntl \
-    (GL_LINK_WARNING ("fcntl is not always POSIX compliant - " \
-                      "use gnulib module fcntl for portability"), \
-     fcntl)
+# if HAVE_RAW_DECL_FCNTL
+_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
+                 "use gnulib module fcntl for portability");
+# endif
 #endif
 
 #if @GNULIB_OPEN@
@@ -83,10 +85,9 @@ extern int open (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef open
-# define open \
-    (GL_LINK_WARNING ("open is not always POSIX compliant - " \
-                      "use gnulib module open for portability"), \
-     open)
+/* Assume open is always declared.  */
+_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
+                 "use gnulib module open for portability");
 #endif
 
 #if @GNULIB_OPENAT@
@@ -100,10 +101,10 @@ extern int openat (int fd, char const *file, int flags, /* mode_t mode */ ...)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef openat
-# define openat \
-    (GL_LINK_WARNING ("openat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     openat)
+# if HAVE_RAW_DECL_OPENAT
+_GL_WARN_ON_USE (openat, "openat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
index bb24904..8cd4444 100644 (file)
@@ -382,15 +382,20 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
                             /* We found a table entry.  Now see whether the
                                character we are currently at has the same
                                equivalance class value.  */
-                            int len = weights[idx];
+                            int len = weights[idx & 0xffffff];
                             int32_t idx2;
                             const UCHAR *np = (const UCHAR *) n;
 
                             idx2 = findidx (&np);
-                            if (idx2 != 0 && len == weights[idx2])
+                            if (idx2 != 0
+                                && (idx >> 24) == (idx2 >> 24)
+                                && len == weights[idx2 & 0xffffff])
                               {
                                 int cnt = 0;
 
+                                idx &= 0xffffff;
+                                idx2 &= 0xffffff;
+
                                 while (cnt < len
                                        && (weights[idx + 1 + cnt]
                                            == weights[idx2 + 1 + cnt]))
index ca967fc..374c58a 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -223,7 +223,7 @@ static void free_dir (FTS *fts) {}
 #endif
 
 #define ISDOT(a)        (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
-#define STREQ(a, b)     (strcmp ((a), (b)) == 0)
+#define STREQ(a, b)     (strcmp (a, b) == 0)
 
 #define CLR(opt)        (sp->fts_options &= ~(opt))
 #define ISSET(opt)      (sp->fts_options & (opt))
index e8c5233..445865b 100644 (file)
@@ -1252,6 +1252,8 @@ get_date (struct timespec *result, char const *p, struct timespec const *now)
             char tz1buf[TZBUFSIZE];
             bool large_tz = TZBUFSIZE < tzsize;
             bool setenv_ok;
+            /* Free tz0, in case this is the 2nd or subsequent time through. */
+            free (tz0);
             tz0 = get_tz (tz0buf);
             z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
             for (s = tzbase; *s != '"'; s++)
diff --git a/lib/getlogin.c b/lib/getlogin.c
new file mode 100644 (file)
index 0000000..6c79de6
--- /dev/null
@@ -0,0 +1,41 @@
+/* Provide a working getlogin for systems which lack it.
+
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible, 2010.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
+char *
+getlogin (void)
+{
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+  static char login_name[1024];
+  DWORD sz = sizeof (login_name);
+
+  if (GetUserName (login_name, &sz))
+    return login_name;
+#endif
+  return NULL;
+}
index 14304fa..3c4e3a2 100644 (file)
@@ -100,7 +100,7 @@ rpl_tzset (void)
    causes problems.  */
 
 int
-rpl_gettimeofday (struct timeval *restrict tv, void *restrict tz)
+gettimeofday (struct timeval *restrict tv, void *restrict tz)
 {
 #undef gettimeofday
 #if HAVE_GETTIMEOFDAY
index 4a5a69d..299bae6 100644 (file)
@@ -45,7 +45,7 @@ getugroups (int maxcount _GL_UNUSED,
 #else /* HAVE_GRP_H */
 # include <grp.h>
 
-# define STREQ(s1, s2) (strcmp (s1, s2) == 0)
+# define STREQ(a, b) (strcmp (a, b) == 0)
 
 /* Like `getgroups', but for user USERNAME instead of for the current
    process.  Store at most MAXCOUNT group IDs in the GROUPLIST array.
index 094ca69..4205376 100644 (file)
@@ -27,7 +27,7 @@
 #include "same.h"
 #include "same-inode.h"
 
-#define STREQ(a, b) (strcmp ((a), (b)) == 0)
+#define STREQ(a, b) (strcmp (a, b) == 0)
 
 /* Hash an F_triple, and *do* consider the file name.  */
 size_t
index 14c2b20..a732c69 100644 (file)
 # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 /* 7.8.1 Macros for format specifiers */
 
 #if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
@@ -1050,10 +1050,10 @@ extern intmax_t imaxabs (intmax_t);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef imaxabs
-# define imaxabs(a) \
-    (GL_LINK_WARNING ("imaxabs is unportable - " \
-                      "use gnulib module imaxabs for portability"), \
-     imaxabs (a))
+# if HAVE_RAW_DECL_IMAXABS
+_GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
+                 "use gnulib module imaxabs for portability");
+# endif
 #endif
 
 #if @GNULIB_IMAXDIV@
@@ -1063,10 +1063,10 @@ extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef imaxdiv
-# define imaxdiv(a,b) \
-    (GL_LINK_WARNING ("imaxdiv is unportable - " \
-                      "use gnulib module imaxdiv for portability"), \
-     imaxdiv (a, b))
+# if HAVE_RAW_DECL_IMAXDIV
+_GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
+                 "use gnulib module imaxdiv for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOIMAX@
@@ -1075,10 +1075,10 @@ extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoimax
-# define strtoimax(p,e,b) \
-    (GL_LINK_WARNING ("strtoimax is unportable - " \
-                      "use gnulib module strtoimax for portability"), \
-     strtoimax (p, e, b))
+# if HAVE_RAW_DECL_STRTOIMAX
+_GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
+                 "use gnulib module strtoimax for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOUMAX@
@@ -1087,10 +1087,10 @@ extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoumax
-# define strtoumax(p,e,b) \
-    (GL_LINK_WARNING ("strtoumax is unportable - " \
-                      "use gnulib module strtoumax for portability"), \
-     strtoumax (p, e, b))
+# if HAVE_RAW_DECL_STRTOUMAX
+_GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - "
+                 "use gnulib module strtoumax for portability");
+# endif
 #endif
 
 /* Don't bother defining or declaring wcstoimax and wcstoumax, since
index 9aedbb4..3d3e2ba 100644 (file)
@@ -123,7 +123,7 @@ typedef int nl_item;
 
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Declare overridden functions.  */
 
@@ -146,10 +146,10 @@ extern char *nl_langinfo (nl_item item);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef nl_langinfo
-# define nl_langinfo(i)                      \
-    (GL_LINK_WARNING ("nl_langinfo is not portable - " \
-                      "use gnulib module nl_langinfo for portability"), \
-     nl_langinfo (i))
+# if HAVE_RAW_DECL_NL_LANGINFO
+_GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
+                 "use gnulib module nl_langinfo for portability");
+# endif
 #endif
 
 
index b8031e1..193e937 100644 (file)
 # include <xlocale.h>
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
    On systems that don't define it, use the same value as GNU libintl.  */
 #if !defined LC_MESSAGES
@@ -52,10 +52,10 @@ extern locale_t duplocale (locale_t locale) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef duplocale
-# define duplocale(l) \
-   (GL_LINK_WARNING ("duplocale is buggy on some glibc systems - " \
-                     "use gnulib module duplocale for portability"), \
-    duplocale (l))
+# if HAVE_RAW_DECL_DUPLOCALE
+_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
+                 "use gnulib module duplocale for portability");
+# endif
 #endif
 
 #endif /* _GL_LOCALE_H */
index 5cefd4d..70e7988 100644 (file)
 #define _GL_MATH_H
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* Helper macros to define a portability warning for the
+   classification macro FUNC called with VALUE.  POSIX declares the
+   classification macros with an argument of real-floating (that is,
+   one of float, double, or long double).  */
+#define _GL_WARN_REAL_FLOATING_DECL(func) \
+static inline int                                                   \
+rpl_ ## func ## f (float f)                                         \
+{                                                                   \
+  return func (f);                                                  \
+}                                                                   \
+static inline int                                                   \
+rpl_ ## func ## d (double d)                                        \
+{                                                                   \
+  return func (d);                                                  \
+}                                                                   \
+static inline int                                                   \
+rpl_ ## func ## l (long double l)                                   \
+{                                                                   \
+  return func (l);                                                  \
+}                                                                   \
+_GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - "       \
+                 "use gnulib module " #func " for portability");    \
+_GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - "       \
+                 "use gnulib module " #func " for portability");    \
+_GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - "       \
+                 "use gnulib module " #func " for portability")
+#define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
+  (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value)     \
+   : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value)  \
+   : rpl_ ## func ## l (value))
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -80,46 +111,48 @@ extern double frexp (double x, int *expptr) _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef frexp
-# define frexp(x,e) \
-    (GL_LINK_WARNING ("frexp is unportable - " \
-                      "use gnulib module frexp for portability"), \
-     frexp (x, e))
+/* Assume frexp is always declared.  */
+_GL_WARN_ON_USE (frexp, "frexp is unportable - "
+                 "use gnulib module frexp for portability");
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@
+#if @GNULIB_ACOSL@
+# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
 extern long double acosl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef acosl
-# define acosl(x) \
-    (GL_LINK_WARNING ("acosl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     acosl (x))
+# if HAVE_RAW_DECL_ACOSL
+_GL_WARN_ON_USE (acosl, "acosl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@
+#if @GNULIB_ASINL@
+# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
 extern long double asinl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef asinl
-# define asinl(x) \
-    (GL_LINK_WARNING ("asinl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     asinl (x))
+# if HAVE_RAW_DECL_ASINL
+_GL_WARN_ON_USE (asinl, "asinl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@
+#if @GNULIB_ATANL@
+# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
 extern long double atanl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef atanl
-# define atanl(x) \
-    (GL_LINK_WARNING ("atanl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     atanl (x))
+# if HAVE_RAW_DECL_ATANL
+_GL_WARN_ON_USE (atanl, "atanl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -130,10 +163,10 @@ extern float ceilf (float x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ceilf
-# define ceilf(x) \
-    (GL_LINK_WARNING ("ceilf is unportable - " \
-                      "use gnulib module ceilf for portability"), \
-     ceilf (x))
+# if HAVE_RAW_DECL_CEILF
+_GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
+                 "use gnulib module ceilf for portability");
+# endif
 #endif
 
 #if @GNULIB_CEILL@
@@ -143,35 +176,40 @@ extern long double ceill (long double x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ceill
-# define ceill(x) \
-    (GL_LINK_WARNING ("ceill is unportable - " \
-                      "use gnulib module ceill for portability"), \
-     ceill (x))
+# if HAVE_RAW_DECL_CEILL
+_GL_WARN_ON_USE (ceill, "ceill is unportable - "
+                 "use gnulib module ceill for portability");
+# endif
 #endif
 
 
-#if @GNULIB_MATHL@ || (!@HAVE_DECL_COSL@ && !defined cosl)
-# undef cosl
+#if @GNULIB_COSL@
+# if !@HAVE_COSL@
+#  undef cosl
+#  define cosl rpl_cosl
+# endif
+# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
 extern long double cosl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef cosl
-# define cosl(x) \
-    (GL_LINK_WARNING ("cosl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     cosl (x))
+# if HAVE_RAW_DECL_COSL
+_GL_WARN_ON_USE (cosl, "cosl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@
+#if @GNULIB_EXPL@
+# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
 extern long double expl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef expl
-# define expl(x) \
-    (GL_LINK_WARNING ("expl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     expl (x))
+# if HAVE_RAW_DECL_EXPL
+_GL_WARN_ON_USE (expl, "expl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -182,10 +220,10 @@ extern float floorf (float x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef floorf
-# define floorf(x) \
-    (GL_LINK_WARNING ("floorf is unportable - " \
-                      "use gnulib module floorf for portability"), \
-     floorf (x))
+# if HAVE_RAW_DECL_FLOORF
+_GL_WARN_ON_USE (floorf, "floorf is unportable - "
+                 "use gnulib module floorf for portability");
+# endif
 #endif
 
 #if @GNULIB_FLOORL@
@@ -195,10 +233,10 @@ extern long double floorl (long double x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef floorl
-# define floorl(x) \
-    (GL_LINK_WARNING ("floorl is unportable - " \
-                      "use gnulib module floorl for portability"), \
-     floorl (x))
+# if HAVE_RAW_DECL_FLOORL
+_GL_WARN_ON_USE (floorl, "floorl is unportable - "
+                 "use gnulib module floorl for portability");
+# endif
 #endif
 
 
@@ -217,10 +255,10 @@ extern long double frexpl (long double x, int *expptr) _GL_ARG_NONNULL ((2));
 #endif
 #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
 # undef frexpl
-# define frexpl(x,e) \
-    (GL_LINK_WARNING ("frexpl is unportable - " \
-                      "use gnulib module frexpl for portability"), \
-     frexpl (x, e))
+# if HAVE_RAW_DECL_FREXPL
+_GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
+                 "use gnulib module frexpl for portability");
+# endif
 #endif
 
 
@@ -233,23 +271,27 @@ extern long double ldexpl (long double x, int exp);
 #endif
 #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
 # undef ldexpl
-# define ldexpl(x,e) \
-    (GL_LINK_WARNING ("ldexpl is unportable - " \
-                      "use gnulib module ldexpl for portability"), \
-     ldexpl (x, e))
+# if HAVE_RAW_DECL_LDEXPL
+_GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
+                 "use gnulib module ldexpl for portability");
+# endif
 #endif
 
 
-#if @GNULIB_MATHL@ || (!@HAVE_DECL_LOGL@ && !defined logl)
-# undef logl
+#if @GNULIB_LOGL@
+# if !@HAVE_LOGL@
+#  undef logl
+#  define logl rpl_logl
+# endif
+# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
 extern long double logl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef logl
-# define logl(x) \
-    (GL_LINK_WARNING ("logl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     logl (x))
+# if HAVE_RAW_DECL_LOGL
+_GL_WARN_ON_USE (logl, "logl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -261,10 +303,10 @@ extern float roundf (float x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef roundf
-# define roundf(x) \
-    (GL_LINK_WARNING ("roundf is unportable - " \
-                      "use gnulib module roundf for portability"), \
-     roundf (x))
+# if HAVE_RAW_DECL_ROUNDF
+_GL_WARN_ON_USE (roundf, "roundf is unportable - "
+                 "use gnulib module roundf for portability");
+# endif
 #endif
 
 #if @GNULIB_ROUND@
@@ -275,10 +317,10 @@ extern double round (double x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef round
-# define round(x) \
-    (GL_LINK_WARNING ("round is unportable - " \
-                      "use gnulib module round for portability"), \
-     round (x))
+# if HAVE_RAW_DECL_ROUND
+_GL_WARN_ON_USE (round, "round is unportable - "
+                 "use gnulib module round for portability");
+# endif
 #endif
 
 #if @GNULIB_ROUNDL@
@@ -289,47 +331,53 @@ extern long double roundl (long double x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef roundl
-# define roundl(x) \
-    (GL_LINK_WARNING ("roundl is unportable - " \
-                      "use gnulib module roundl for portability"), \
-     roundl (x))
+# if HAVE_RAW_DECL_ROUNDL
+_GL_WARN_ON_USE (roundl, "roundl is unportable - "
+                 "use gnulib module roundl for portability");
+# endif
 #endif
 
 
-#if @GNULIB_MATHL@ || (!@HAVE_DECL_SINL@ && !defined sinl)
-# undef sinl
+#if @GNULIB_SINL@
+# if !@HAVE_SINL@
+#  undef sinl
+#  define sinl rpl_sinl
+# endif
+# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
 extern long double sinl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef sinl
-# define sinl(x) \
-    (GL_LINK_WARNING ("sinl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     sinl (x))
+# if HAVE_RAW_DECL_SINL
+_GL_WARN_ON_USE (sinl, "sinl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@
+#if @GNULIB_SQRTL@
+# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
 extern long double sqrtl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef sqrtl
-# define sqrtl(x) \
-    (GL_LINK_WARNING ("sqrtl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     sqrtl (x))
+# if HAVE_RAW_DECL_SQRTL
+_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@
+#if @GNULIB_TANL@
+# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
 extern long double tanl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef tanl
-# define tanl(x) \
-    (GL_LINK_WARNING ("tanl is unportable - " \
-                      "use gnulib module mathl for portability"), \
-     tanl (x))
+# if HAVE_RAW_DECL_TANL
+_GL_WARN_ON_USE (tanl, "tanl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
 #endif
 
 
@@ -340,10 +388,10 @@ extern float truncf (float x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef truncf
-# define truncf(x) \
-    (GL_LINK_WARNING ("truncf is unportable - " \
-                      "use gnulib module truncf for portability"), \
-     truncf (x))
+# if HAVE_RAW_DECL_TRUNCF
+_GL_WARN_ON_USE (truncf, "truncf is unportable - "
+                 "use gnulib module truncf for portability");
+# endif
 #endif
 
 #if @GNULIB_TRUNC@
@@ -353,10 +401,10 @@ extern double trunc (double x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef trunc
-# define trunc(x) \
-    (GL_LINK_WARNING ("trunc is unportable - " \
-                      "use gnulib module trunc for portability"), \
-     trunc (x))
+# if HAVE_RAW_DECL_TRUNC
+_GL_WARN_ON_USE (trunc, "trunc is unportable - "
+                 "use gnulib module trunc for portability");
+# endif
 #endif
 
 #if @GNULIB_TRUNCL@
@@ -367,10 +415,10 @@ extern long double truncl (long double x);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef truncl
-# define truncl(x) \
-    (GL_LINK_WARNING ("truncl is unportable - " \
-                      "use gnulib module truncl for portability"), \
-     truncl (x))
+# if HAVE_RAW_DECL_TRUNCL
+_GL_WARN_ON_USE (truncl, "truncl is unportable - "
+                 "use gnulib module truncl for portability");
+# endif
 #endif
 
 
@@ -386,7 +434,11 @@ extern int gl_isfinitel (long double x);
     gl_isfinitef (x))
 # endif
 #elif defined GNULIB_POSIXCHECK
-  /* How to override a macro?  */
+# if defined isfinite
+_GL_WARN_REAL_FLOATING_DECL (isfinite);
+#  undef isfinite
+#  define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x)
+# endif
 #endif
 
 
@@ -402,7 +454,11 @@ extern int gl_isinfl (long double x);
     gl_isinff (x))
 # endif
 #elif defined GNULIB_POSIXCHECK
-  /* How to override a macro?  */
+# if defined isinf
+_GL_WARN_REAL_FLOATING_DECL (isinf);
+#  undef isinf
+#  define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x)
+# endif
 #endif
 
 
@@ -501,7 +557,11 @@ extern int rpl_isnanl (long double x);
     gl_isnan_f (x))
 # endif
 #elif defined GNULIB_POSIXCHECK
-  /* How to override a macro?  */
+# if defined isnan
+_GL_WARN_REAL_FLOATING_DECL (isnan);
+#  undef isnan
+#  define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x)
+# endif
 #endif
 
 
@@ -557,7 +617,11 @@ extern int gl_signbitl (long double arg);
     gl_signbitf (x))
 # endif
 #elif defined GNULIB_POSIXCHECK
-  /* How to override a macro?  */
+# if defined signbit
+_GL_WARN_REAL_FLOATING_DECL (signbit);
+#  undef signbit
+#  define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x)
+# endif
 #endif
 
 
index 847867a..0c7ce5e 100644 (file)
@@ -65,7 +65,7 @@ typedef unsigned char byte;
 #ifdef WORDS_BIGENDIAN
 # define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
 #else
-# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
+# define CMP_LT_OR_GT(a, b) memcmp_bytes (a, b)
 #endif
 
 /* BE VERY CAREFUL IF YOU CHANGE THIS CODE!  */
index ccb08dd..996b71a 100644 (file)
 
 #undef MNT_IGNORE
 #if defined MNTOPT_IGNORE && defined HAVE_HASMNTOPT
-# define MNT_IGNORE(M) hasmntopt ((M), MNTOPT_IGNORE)
+# define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE)
 #else
 # define MNT_IGNORE(M) 0
 #endif
index 6f3695b..2edd98b 100644 (file)
@@ -74,18 +74,24 @@ struct addrinfo
 # endif
 
 # if 0
-/* The commented out definitions below are not yet implemented in the
-   GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact,
-   cause conflicts on systems with a getaddrinfo() function which does not
-   define them.
-
-   If they are restored, be sure to protect the definitions with #ifndef.  */
 #  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
-#  define AI_V4MAPPED   0x0008  /* IPv4 mapped addresses are acceptable.  */
-#  define AI_ALL                0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
-#  define AI_ADDRCONFIG 0x0020  /* Use configuration of this host to choose
-                                   returned address type..  */
-# endif /* 0 */
+# endif
+
+/* These symbolic constants are required to be present by POSIX, but
+   our getaddrinfo replacement doesn't use them (yet).  Setting them
+   to 0 on systems that doesn't have them avoids causing problems for
+   system getaddrinfo implementations that would be confused by
+   unknown values.  */
+# ifndef AI_V4MAPPED
+#  define AI_V4MAPPED    0 /* 0x0008: IPv4 mapped addresses are acceptable.  */
+# endif
+# ifndef AI_ALL
+#  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
+                                      returned address type.  */
+# endif
 
 /* Error values for `getaddrinfo' function.  */
 # ifndef EAI_BADFLAGS
index af4da75..90b568e 100644 (file)
@@ -1,6 +1,6 @@
 /* Detect the number of processors.
 
-   Copyright (C) 20092010 Free Software Foundation, Inc.
+   Copyright (C) 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
 
-unsigned long int
-num_processors (enum nproc_query query)
+/* Return the number of processors available to the current process, based
+   on a modern system call that returns the "affinity" between the current
+   process and each CPU.  Return 0 if unknown or if such a system call does
+   not exist.  */
+static unsigned long
+num_processors_via_affinity_mask (void)
 {
-  if (query == NPROC_CURRENT_OVERRIDABLE)
-    {
-      /* Test the environment variable OMP_NUM_THREADS, recognized also by all
-         programs that are based on OpenMP.  The OpenMP spec says that the
-         value assigned to the environment variable "may have leading and
-         trailing white space". */
-      const char *envvalue = getenv ("OMP_NUM_THREADS");
-
-      if (envvalue != NULL)
-        {
-          while (*envvalue != '\0' && c_isspace (*envvalue))
-            envvalue++;
-          /* Convert it from decimal to 'unsigned long'.  */
-          if (c_isdigit (*envvalue))
-            {
-              char *endptr = NULL;
-              unsigned long int value = strtoul (envvalue, &endptr, 10);
-
-              if (endptr != NULL)
-                {
-                  while (*endptr != '\0' && c_isspace (*endptr))
-                    endptr++;
-                  if (*endptr == '\0')
-                    return (value > 0 ? value : 1);
-                }
-            }
-        }
-
-      query = NPROC_CURRENT;
-    }
-  /* Here query is one of NPROC_ALL, NPROC_CURRENT.  */
-
-  if (query == NPROC_CURRENT)
-    {
-      /* glibc >= 2.3.3 with NPTL and NetBSD 5 have pthread_getaffinity_np,
-         but with different APIs.  Also it requires linking with -lpthread.
-         Therefore this code is not enabled.
-         glibc >= 2.3.4 has sched_getaffinity whereas NetBSD 5 has
-         sched_getaffinity_np.  */
+  /* glibc >= 2.3.3 with NPTL and NetBSD 5 have pthread_getaffinity_np,
+     but with different APIs.  Also it requires linking with -lpthread.
+     Therefore this code is not enabled.
+     glibc >= 2.3.4 has sched_getaffinity whereas NetBSD 5 has
+     sched_getaffinity_np.  */
 #if HAVE_PTHREAD_AFFINITY_NP && defined __GLIBC__ && 0
-      {
-        cpu_set_t set;
+  {
+    cpu_set_t set;
 
-        if (pthread_getaffinity_np (pthread_self (), sizeof (set), &set) == 0)
-          {
-            unsigned long count;
+    if (pthread_getaffinity_np (pthread_self (), sizeof (set), &set) == 0)
+      {
+        unsigned long count;
 
 # ifdef CPU_COUNT
-            /* glibc >= 2.6 has the CPU_COUNT macro.  */
-            count = CPU_COUNT (&set);
+        /* glibc >= 2.6 has the CPU_COUNT macro.  */
+        count = CPU_COUNT (&set);
 # else
-            size_t i;
+        size_t i;
 
-            count = 0;
-            for (i = 0; i < CPU_SETSIZE; i++)
-              if (CPU_ISSET (i, &set))
-                count++;
+        count = 0;
+        for (i = 0; i < CPU_SETSIZE; i++)
+          if (CPU_ISSET (i, &set))
+            count++;
 # endif
-            if (count > 0)
-              return count;
-          }
+        if (count > 0)
+          return count;
       }
+  }
 #elif HAVE_PTHREAD_AFFINITY_NP && defined __NetBSD__ && 0
+  {
+    cpuset_t *set;
+
+    set = cpuset_create ();
+    if (set != NULL)
       {
-        cpuset_t *set;
+        unsigned long count = 0;
 
-        set = cpuset_create ();
-        if (set != NULL)
+        if (pthread_getaffinity_np (pthread_self (), cpuset_size (set), set)
+            == 0)
           {
-            unsigned long count = 0;
+            cpuid_t i;
 
-            if (pthread_getaffinity_np (pthread_self (), cpuset_size (set), set)
-                == 0)
+            for (i = 0;; i++)
               {
-                cpuid_t i;
-
-                for (i = 0;; i++)
-                  {
-                    int ret = cpuset_isset (i, set);
-                    if (ret < 0)
-                      break;
-                    if (ret > 0)
-                      count++;
-                  }
+                int ret = cpuset_isset (i, set);
+                if (ret < 0)
+                  break;
+                if (ret > 0)
+                  count++;
               }
-            cpuset_destroy (set);
-            if (count > 0)
-              return count;
           }
+        cpuset_destroy (set);
+        if (count > 0)
+          return count;
       }
+  }
 #elif HAVE_SCHED_GETAFFINITY_LIKE_GLIBC /* glibc >= 2.3.4 */
-      {
-        cpu_set_t set;
+  {
+    cpu_set_t set;
 
-        if (sched_getaffinity (0, sizeof (set), &set) == 0)
-          {
-            unsigned long count;
+    if (sched_getaffinity (0, sizeof (set), &set) == 0)
+      {
+        unsigned long count;
 
 # ifdef CPU_COUNT
-            /* glibc >= 2.6 has the CPU_COUNT macro.  */
-            count = CPU_COUNT (&set);
+        /* glibc >= 2.6 has the CPU_COUNT macro.  */
+        count = CPU_COUNT (&set);
 # else
-            size_t i;
+        size_t i;
 
-            count = 0;
-            for (i = 0; i < CPU_SETSIZE; i++)
-              if (CPU_ISSET (i, &set))
-                count++;
+        count = 0;
+        for (i = 0; i < CPU_SETSIZE; i++)
+          if (CPU_ISSET (i, &set))
+            count++;
 # endif
-            if (count > 0)
-              return count;
-          }
+        if (count > 0)
+          return count;
       }
+  }
 #elif HAVE_SCHED_GETAFFINITY_NP /* NetBSD >= 5 */
+  {
+    cpuset_t *set;
+
+    set = cpuset_create ();
+    if (set != NULL)
       {
-        cpuset_t *set;
+        unsigned long count = 0;
 
-        set = cpuset_create ();
-        if (set != NULL)
+        if (sched_getaffinity_np (getpid (), cpuset_size (set), set) == 0)
           {
-            unsigned long count = 0;
+            cpuid_t i;
 
-            if (sched_getaffinity_np (getpid (), cpuset_size (set), set) == 0)
+            for (i = 0;; i++)
               {
-                cpuid_t i;
-
-                for (i = 0;; i++)
-                  {
-                    int ret = cpuset_isset (i, set);
-                    if (ret < 0)
-                      break;
-                    if (ret > 0)
-                      count++;
-                  }
+                int ret = cpuset_isset (i, set);
+                if (ret < 0)
+                  break;
+                if (ret > 0)
+                  count++;
               }
-            cpuset_destroy (set);
-            if (count > 0)
-              return count;
           }
+        cpuset_destroy (set);
+        if (count > 0)
+          return count;
       }
+  }
 #endif
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-      { /* This works on native Windows platforms.  */
-        DWORD_PTR process_mask;
-        DWORD_PTR system_mask;
+  { /* This works on native Windows platforms.  */
+    DWORD_PTR process_mask;
+    DWORD_PTR system_mask;
 
-        if (GetProcessAffinityMask (GetCurrentProcess (),
-                                    &process_mask, &system_mask))
-          {
-            DWORD_PTR mask = process_mask;
-            unsigned long count = 0;
-
-            for (; mask != 0; mask = mask >> 1)
-              if (mask & 1)
-                count++;
-            if (count > 0)
-              return count;
-          }
+    if (GetProcessAffinityMask (GetCurrentProcess (),
+                                &process_mask, &system_mask))
+      {
+        DWORD_PTR mask = process_mask;
+        unsigned long count = 0;
+
+        for (; mask != 0; mask = mask >> 1)
+          if (mask & 1)
+            count++;
+        if (count > 0)
+          return count;
       }
+  }
 #endif
 
+  return 0;
+}
+
+unsigned long int
+num_processors (enum nproc_query query)
+{
+  if (query == NPROC_CURRENT_OVERRIDABLE)
+    {
+      /* Test the environment variable OMP_NUM_THREADS, recognized also by all
+         programs that are based on OpenMP.  The OpenMP spec says that the
+         value assigned to the environment variable "may have leading and
+         trailing white space". */
+      const char *envvalue = getenv ("OMP_NUM_THREADS");
+
+      if (envvalue != NULL)
+        {
+          while (*envvalue != '\0' && c_isspace (*envvalue))
+            envvalue++;
+          /* Convert it from decimal to 'unsigned long'.  */
+          if (c_isdigit (*envvalue))
+            {
+              char *endptr = NULL;
+              unsigned long int value = strtoul (envvalue, &endptr, 10);
+
+              if (endptr != NULL)
+                {
+                  while (*endptr != '\0' && c_isspace (*endptr))
+                    endptr++;
+                  if (*endptr == '\0')
+                    return (value > 0 ? value : 1);
+                }
+            }
+        }
+
+      query = NPROC_CURRENT;
+    }
+  /* Here query is one of NPROC_ALL, NPROC_CURRENT.  */
+
+  /* On systems with a modern affinity mask system call, we have
+         sysconf (_SC_NPROCESSORS_CONF)
+            >= sysconf (_SC_NPROCESSORS_ONLN)
+               >= num_processors_via_affinity_mask ()
+     The first number is the number of CPUs configured in the system.
+     The second number is the number of CPUs available to the scheduler.
+     The third number is the number of CPUs available to the current process.
+
+     Note! On Linux systems with glibc, the first and second number come from
+     the /sys and /proc file systems (see
+     glibc/sysdeps/unix/sysv/linux/getsysstats.c).
+     In some situations these file systems are not mounted, and the sysconf
+     call returns 1, which does not reflect the reality.  */
+
+  if (query == NPROC_CURRENT)
+    {
+      /* Try the modern affinity mask system call.  */
+      {
+        unsigned long nprocs = num_processors_via_affinity_mask ();
+
+        if (nprocs > 0)
+          return nprocs;
+      }
+
 #if defined _SC_NPROCESSORS_ONLN
       { /* This works on glibc, MacOS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
            Cygwin, Haiku.  */
@@ -239,6 +271,22 @@ num_processors (enum nproc_query query)
       { /* This works on glibc, MacOS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
            Cygwin, Haiku.  */
         long int nprocs = sysconf (_SC_NPROCESSORS_CONF);
+
+# if __GLIBC__ >= 2 && defined __linux__
+        /* On Linux systems with glibc, this information comes from the /sys and
+           /proc file systems (see glibc/sysdeps/unix/sysv/linux/getsysstats.c).
+           In some situations these file systems are not mounted, and the
+           sysconf call returns 1.  But we wish to guarantee that
+           num_processors (NPROC_ALL) >= num_processors (NPROC_CURRENT).  */
+        if (nprocs == 1)
+          {
+            unsigned long nprocs_current = num_processors_via_affinity_mask ();
+
+            if (nprocs_current > 0)
+              nprocs = nprocs_current;
+          }
+# endif
+
         if (nprocs > 0)
           return nprocs;
       }
index e29f20e..c65c1b1 100644 (file)
@@ -197,5 +197,7 @@ readtokens (FILE *stream,
   *tokens_out = tokens;
   if (token_lengths != NULL)
     *token_lengths = lengths;
+  else
+    free (lengths);
   return n_tokens;
 }
index 9745bea..d5968bd 100644 (file)
@@ -636,7 +636,7 @@ free_dfa_content (re_dfa_t *dfa)
            re_dfastate_t *state = entry->array[j];
            free_state (state);
          }
-        re_free (entry->array);
+       re_free (entry->array);
       }
   re_free (dfa->state_table);
 #ifdef RE_ENABLE_I18N
@@ -850,6 +850,9 @@ static reg_errcode_t
 init_dfa (re_dfa_t *dfa, size_t pat_len)
 {
   __re_size_t table_size;
+#ifndef _LIBC
+  char *codeset_name;
+#endif
 #ifdef RE_ENABLE_I18N
   size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t));
 #else
@@ -893,7 +896,9 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
   dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
                       != 0);
 #else
-  if (strcmp (locale_charset (), "UTF-8") == 0)
+  codeset_name = nl_langinfo (CODESET);
+  if (strcasecmp (codeset_name, "UTF-8") == 0
+      || strcasecmp (codeset_name, "UTF8") == 0)
     dfa->is_utf8 = 1;
 
   /* We check exhaustively in the loop below if this charset is a
@@ -1016,7 +1021,10 @@ create_initial_state (re_dfa_t *dfa)
            Idx dest_idx = dfa->edests[node_idx].elems[0];
            if (!re_node_set_contains (&init_nodes, dest_idx))
              {
-               re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx);
+               reg_errcode_t merge_err
+                  = re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx);
+               if (merge_err != REG_NOERROR)
+                 return merge_err;
                i = 0;
              }
          }
@@ -1085,8 +1093,8 @@ optimize_utf8 (re_dfa_t *dfa)
          }
        break;
       case OP_PERIOD:
-        has_period = true;
-        break;
+       has_period = true;
+       break;
       case OP_BACK_REF:
       case OP_ALT:
       case END_OF_RE:
@@ -1187,7 +1195,7 @@ analyze (regex_t *preg)
     {
       dfa->inveclosures = re_malloc (re_node_set, dfa->nodes_len);
       if (BE (dfa->inveclosures == NULL, 0))
-        return REG_ESPACE;
+       return REG_ESPACE;
       ret = calc_inveclosure (dfa);
     }
 
@@ -1209,16 +1217,16 @@ postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
         if that's the only child).  */
       while (node->left || node->right)
        if (node->left)
-          node = node->left;
-        else
-          node = node->right;
+         node = node->left;
+       else
+         node = node->right;
 
       do
        {
          reg_errcode_t err = fn (extra, node);
          if (BE (err != REG_NOERROR, 0))
            return err;
-          if (node->parent == NULL)
+         if (node->parent == NULL)
            return REG_NOERROR;
          prev = node;
          node = node->parent;
@@ -1252,7 +1260,7 @@ preorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
              prev = node;
              node = node->parent;
              if (!node)
-               return REG_NOERROR;
+               return REG_NOERROR;
            }
          node = node->right;
        }
@@ -1275,13 +1283,13 @@ optimize_subexps (void *extra, bin_tree_t *node)
     }
 
   else if (node->token.type == SUBEXP
-           && node->left && node->left->token.type == SUBEXP)
+          && node->left && node->left->token.type == SUBEXP)
     {
       Idx other_idx = node->left->token.opr.idx;
 
       node->left = node->left->left;
       if (node->left)
-        node->left->parent = node;
+       node->left->parent = node;
 
       dfa->subexp_map[other_idx] = dfa->subexp_map[node->token.opr.idx];
       if (other_idx < BITSET_WORD_BITS)
@@ -1366,9 +1374,9 @@ calc_first (void *extra, bin_tree_t *node)
       node->first = node;
       node->node_idx = re_dfa_add_node (dfa, node->token);
       if (BE (node->node_idx == REG_MISSING, 0))
-        return REG_ESPACE;
+       return REG_ESPACE;
       if (node->token.type == ANCHOR)
-        dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type;
+       dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type;
     }
   return REG_NOERROR;
 }
@@ -1390,7 +1398,7 @@ calc_next (void *extra, bin_tree_t *node)
       if (node->left)
        node->left->next = node->next;
       if (node->right)
-        node->right->next = node->next;
+       node->right->next = node->next;
       break;
     }
   return REG_NOERROR;
@@ -1441,7 +1449,7 @@ link_nfa_nodes (void *extra, bin_tree_t *node)
     case OP_BACK_REF:
       dfa->nexts[idx] = node->next->node_idx;
       if (node->token.type == OP_BACK_REF)
-       re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]);
+       err = re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]);
       break;
 
     default:
@@ -1498,7 +1506,6 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node,
             destination.  */
          org_dest = dfa->edests[org_node].elems[0];
          re_node_set_empty (dfa->edests + clone_node);
-         clone_dest = search_duplicated_node (dfa, org_dest, constraint);
          /* If the node is root_node itself, it means the epsilon closure
             has a loop.  Then tie it to the destination of the root_node.  */
          if (org_node == root_node && clone_node != org_node)
@@ -1542,7 +1549,7 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node,
            }
          else
            {
-             /* There is a duplicated node which satisfy the constraint,
+             /* There is a duplicated node which satisfies the constraint,
                 use it to avoid infinite loop.  */
              ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
              if (BE (! ok, 0))
@@ -1674,10 +1681,9 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
 {
   reg_errcode_t err;
   Idx i;
-  bool incomplete;
-  bool ok;
   re_node_set eclosure;
-  incomplete = false;
+  bool ok;
+  bool incomplete = false;
   err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1);
   if (BE (err != REG_NOERROR, 0))
     return err;
@@ -1722,7 +1728,9 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
        else
          eclosure_elem = dfa->eclosures[edest];
        /* Merge the epsilon closure of `edest'.  */
-       re_node_set_merge (&eclosure, &eclosure_elem);
+       err = re_node_set_merge (&eclosure, &eclosure_elem);
+       if (BE (err != REG_NOERROR, 0))
+         return err;
        /* If the epsilon closure of `edest' is incomplete,
           the epsilon closure of this node is also incomplete.  */
        if (dfa->eclosures[edest].nelem == 0)
@@ -1732,7 +1740,7 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
          }
       }
 
-  /* Epsilon closures include itself.  */
+  /* An epsilon closure includes itself.  */
   ok = re_node_set_insert (&eclosure, node);
   if (BE (! ok, 0))
     return REG_ESPACE;
@@ -2319,7 +2327,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
          && dfa->word_ops_used == 0)
        init_word_char (dfa);
       if (token->opr.ctx_type == WORD_DELIM
-          || token->opr.ctx_type == NOT_WORD_DELIM)
+         || token->opr.ctx_type == NOT_WORD_DELIM)
        {
          bin_tree_t *tree_first, *tree_last;
          if (token->opr.ctx_type == WORD_DELIM)
@@ -2327,13 +2335,13 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
              token->opr.ctx_type = WORD_FIRST;
              tree_first = create_token_tree (dfa, NULL, NULL, token);
              token->opr.ctx_type = WORD_LAST;
-            }
-          else
-            {
+           }
+         else
+           {
              token->opr.ctx_type = INSIDE_WORD;
              tree_first = create_token_tree (dfa, NULL, NULL, token);
              token->opr.ctx_type = INSIDE_NOTWORD;
-            }
+           }
          tree_last = create_token_tree (dfa, NULL, NULL, token);
          tree = create_tree (dfa, tree_first, tree_last, OP_ALT);
          if (BE (tree_first == NULL || tree_last == NULL || tree == NULL, 0))
@@ -2444,7 +2452,7 @@ parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
     {
       tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);
       if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0))
-        *err = REG_EPAREN;
+       *err = REG_EPAREN;
       if (BE (*err != REG_NOERROR, 0))
        return NULL;
     }
@@ -2515,7 +2523,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
          return elem;
        }
 
-      if (BE (end != REG_MISSING && start > end, 0))
+      if (BE ((end != REG_MISSING && start > end)
+             || token->type != OP_CLOSE_DUP_NUM, 0))
        {
          /* First number greater than second.  */
          *err = REG_BADBR;
@@ -2568,10 +2577,14 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
   if (BE (tree == NULL, 0))
     goto parse_dup_op_espace;
 
+/* From gnulib's "intprops.h":
+   True if the arithmetic type T is signed.  */
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+
   /* This loop is actually executed only when end != REG_MISSING,
      to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?...  We have
      already created the start+1-th copy.  */
-  if ((Idx) -1 < 0 || end != REG_MISSING)
+  if (TYPE_SIGNED (Idx) || end != REG_MISSING)
     for (i = start + 2; i <= end; ++i)
       {
        elem = duplicate_tree (elem, dfa);
@@ -2662,9 +2675,9 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
        no MBCSET if dfa->mb_cur_max == 1.  */
     if (mbcset)
       {
-        /* Check the space of the arrays.  */
-        if (BE (*range_alloc == mbcset->nranges, 0))
-          {
+       /* Check the space of the arrays.  */
+       if (BE (*range_alloc == mbcset->nranges, 0))
+         {
            /* There is not enough space, need realloc.  */
            wchar_t *new_array_start, *new_array_end;
            Idx new_nranges;
@@ -2674,9 +2687,9 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
            /* Use realloc since mbcset->range_starts and mbcset->range_ends
               are NULL if *range_alloc == 0.  */
            new_array_start = re_realloc (mbcset->range_starts, wchar_t,
-                                         new_nranges);
+                                         new_nranges);
            new_array_end = re_realloc (mbcset->range_ends, wchar_t,
-                                       new_nranges);
+                                       new_nranges);
 
            if (BE (new_array_start == NULL || new_array_end == NULL, 0))
              return REG_ESPACE;
@@ -2684,10 +2697,10 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
            mbcset->range_starts = new_array_start;
            mbcset->range_ends = new_array_end;
            *range_alloc = new_nranges;
-          }
+         }
 
-        mbcset->range_starts[mbcset->nranges] = start_wc;
-        mbcset->range_ends[mbcset->nranges++] = end_wc;
+       mbcset->range_starts[mbcset->nranges] = start_wc;
+       mbcset->range_ends[mbcset->nranges++] = end_wc;
       }
 
     /* Build the table for single byte characters.  */
@@ -2799,7 +2812,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
       return elem;
     }
 
-  /* Local function for parse_bracket_exp used in _LIBC environement.
+  /* Local function for parse_bracket_exp used in _LIBC environment.
      Look up the collation sequence value of BR_ELEM.
      Return the value if succeeded, UINT_MAX otherwise.  */
 
@@ -2823,7 +2836,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
        }
       else if (br_elem->type == MB_CHAR)
        {
-         return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
+         if (nrules != 0)
+           return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
        }
       else if (br_elem->type == COLL_SYM)
        {
@@ -2904,8 +2918,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
         build below suffices. */
       if (nrules > 0 || dfa->mb_cur_max > 1)
        {
-          /* Check the space of the arrays.  */
-          if (BE (*range_alloc == mbcset->nranges, 0))
+         /* Check the space of the arrays.  */
+         if (BE (*range_alloc == mbcset->nranges, 0))
            {
              /* There is not enough space, need realloc.  */
              uint32_t *new_array_start;
@@ -2917,18 +2931,18 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
              new_array_start = re_realloc (mbcset->range_starts, uint32_t,
                                            new_nranges);
              new_array_end = re_realloc (mbcset->range_ends, uint32_t,
-                                         new_nranges);
+                                         new_nranges);
 
              if (BE (new_array_start == NULL || new_array_end == NULL, 0))
-               return REG_ESPACE;
+               return REG_ESPACE;
 
              mbcset->range_starts = new_array_start;
              mbcset->range_ends = new_array_end;
              *range_alloc = new_nranges;
            }
 
-          mbcset->range_starts[mbcset->nranges] = start_collseq;
-          mbcset->range_ends[mbcset->nranges++] = end_collseq;
+         mbcset->range_starts[mbcset->nranges] = start_collseq;
+         mbcset->range_ends[mbcset->nranges++] = end_collseq;
        }
 
       /* Build the table for single byte characters.  */
@@ -3262,17 +3276,17 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
         of having both SIMPLE_BRACKET and COMPLEX_BRACKET.  */
       if (sbc_idx < BITSET_WORDS)
        {
-          /* Build a tree for simple bracket.  */
-          br_token.type = SIMPLE_BRACKET;
-          br_token.opr.sbcset = sbcset;
-          work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
-          if (BE (work_tree == NULL, 0))
-            goto parse_bracket_exp_espace;
+         /* Build a tree for simple bracket.  */
+         br_token.type = SIMPLE_BRACKET;
+         br_token.opr.sbcset = sbcset;
+         work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
+         if (BE (work_tree == NULL, 0))
+           goto parse_bracket_exp_espace;
 
-          /* Then join them by ALT node.  */
-          work_tree = create_tree (dfa, work_tree, mbc_tree, OP_ALT);
-          if (BE (work_tree == NULL, 0))
-            goto parse_bracket_exp_espace;
+         /* Then join them by ALT node.  */
+         work_tree = create_tree (dfa, work_tree, mbc_tree, OP_ALT);
+         if (BE (work_tree == NULL, 0))
+           goto parse_bracket_exp_espace;
        }
       else
        {
@@ -3291,7 +3305,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
       br_token.opr.sbcset = sbcset;
       work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
       if (BE (work_tree == NULL, 0))
-        goto parse_bracket_exp_espace;
+       goto parse_bracket_exp_espace;
     }
   return work_tree;
 
@@ -3430,7 +3444,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
 
       /* Build single byte matcing table for this equivalence class.  */
       char_buf[1] = (unsigned char) '\0';
-      len = weights[idx1];
+      len = weights[idx1 & 0xffffff];
       for (ch = 0; ch < SBC_MAX; ++ch)
        {
          char_buf[0] = ch;
@@ -3442,11 +3456,15 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
          if (idx2 == 0)
            /* This isn't a valid character.  */
            continue;
-         if (len == weights[idx2])
+         /* Compare only if the length matches and the collation rule
+            index is the same.  */
+         if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24))
            {
              int cnt = 0;
+
              while (cnt <= len &&
-                    weights[idx1 + 1 + cnt] == weights[idx2 + 1 + cnt])
+                    weights[(idx1 & 0xffffff) + 1 + cnt]
+                    == weights[(idx2 & 0xffffff) + 1 + cnt])
                ++cnt;
 
              if (cnt > len)
@@ -3842,7 +3860,7 @@ duplicate_tree (const bin_tree_t *root, re_dfa_t *dfa)
              node = node->parent;
              dup_node = dup_node->parent;
              if (!node)
-               return dup_root;
+               return dup_root;
            }
          node = node->right;
          p_new = &dup_node->right;
index e3afa58..378b767 100644 (file)
@@ -36,7 +36,7 @@ static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa,
    re_string_reconstruct before using the object.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_string_allocate (re_string_t *pstr, const char *str, Idx len, Idx init_len,
                    RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa)
 {
@@ -64,7 +64,7 @@ re_string_allocate (re_string_t *pstr, const char *str, Idx len, Idx init_len,
 /* This function allocate the buffers, and initialize them.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_string_construct (re_string_t *pstr, const char *str, Idx len,
                     RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa)
 {
@@ -127,7 +127,7 @@ re_string_construct (re_string_t *pstr, const char *str, Idx len,
 /* Helper functions for re_string_allocate, and re_string_construct.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len)
 {
 #ifdef RE_ENABLE_I18N
@@ -267,7 +267,7 @@ build_wcs_buffer (re_string_t *pstr)
    but for REG_ICASE.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 build_wcs_upper_buffer (re_string_t *pstr)
 {
   mbstate_t prev_st;
@@ -430,8 +430,8 @@ build_wcs_upper_buffer (re_string_t *pstr)
                    src_idx += mbclen;
                    continue;
                  }
-                else
-                  memcpy (pstr->mbs + byte_idx, p, mbclen);
+               else
+                 memcpy (pstr->mbs + byte_idx, p, mbclen);
              }
            else
              memcpy (pstr->mbs + byte_idx, p, mbclen);
@@ -569,7 +569,7 @@ re_string_translate_buffer (re_string_t *pstr)
    convert to upper case in case of REG_ICASE, apply translation.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
 {
   Idx offset;
@@ -964,7 +964,7 @@ re_string_context_at (const re_string_t *input, Idx idx, int eflags)
 /* Functions for set operation.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_node_set_alloc (re_node_set *set, Idx size)
 {
   set->alloc = size;
@@ -976,7 +976,7 @@ re_node_set_alloc (re_node_set *set, Idx size)
 }
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_node_set_init_1 (re_node_set *set, Idx elem)
 {
   set->alloc = 1;
@@ -992,7 +992,7 @@ re_node_set_init_1 (re_node_set *set, Idx elem)
 }
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_node_set_init_2 (re_node_set *set, Idx elem1, Idx elem2)
 {
   set->alloc = 2;
@@ -1022,7 +1022,7 @@ re_node_set_init_2 (re_node_set *set, Idx elem1, Idx elem2)
 }
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
 {
   dest->nelem = src->nelem;
@@ -1047,7 +1047,7 @@ re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
    Note: We assume dest->elems is NULL, when dest->alloc is 0.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
                           const re_node_set *src2)
 {
@@ -1062,7 +1062,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
       Idx new_alloc = src1->nelem + src2->nelem + dest->alloc;
       Idx *new_elems = re_realloc (dest->elems, Idx, new_alloc);
       if (BE (new_elems == NULL, 0))
-        return REG_ESPACE;
+       return REG_ESPACE;
       dest->elems = new_elems;
       dest->alloc = new_alloc;
     }
@@ -1112,20 +1112,20 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
   if (delta > 0 && REG_VALID_INDEX (id))
     for (;;)
       {
-        if (dest->elems[is] > dest->elems[id])
-          {
-            /* Copy from the top.  */
-            dest->elems[id + delta--] = dest->elems[is--];
-            if (delta == 0)
-              break;
-          }
-        else
-          {
-            /* Slide from the bottom.  */
-            dest->elems[id + delta] = dest->elems[id];
-            if (! REG_VALID_INDEX (--id))
-              break;
-          }
+       if (dest->elems[is] > dest->elems[id])
+         {
+           /* Copy from the top.  */
+           dest->elems[id + delta--] = dest->elems[is--];
+           if (delta == 0)
+             break;
+         }
+       else
+         {
+           /* Slide from the bottom.  */
+           dest->elems[id + delta] = dest->elems[id];
+           if (! REG_VALID_INDEX (--id))
+             break;
+         }
       }
 
   /* Copy remaining SRC elements.  */
@@ -1138,7 +1138,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
    DEST. Return value indicate the error code or REG_NOERROR if succeeded.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
                        const re_node_set *src2)
 {
@@ -1191,7 +1191,7 @@ re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
    DEST. Return value indicate the error code or REG_NOERROR if succeeded.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_node_set_merge (re_node_set *dest, const re_node_set *src)
 {
   Idx is, id, sbase, delta;
@@ -1221,11 +1221,11 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
        REG_VALID_INDEX (is) && REG_VALID_INDEX (id); )
     {
       if (dest->elems[id] == src->elems[is])
-        is--, id--;
+       is--, id--;
       else if (dest->elems[id] < src->elems[is])
-        dest->elems[--sbase] = src->elems[is--];
+       dest->elems[--sbase] = src->elems[is--];
       else /* if (dest->elems[id] > src->elems[is]) */
-        --id;
+       --id;
     }
 
   if (REG_VALID_INDEX (is))
@@ -1247,21 +1247,21 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
   for (;;)
     {
       if (dest->elems[is] > dest->elems[id])
-        {
+       {
          /* Copy from the top.  */
-          dest->elems[id + delta--] = dest->elems[is--];
+         dest->elems[id + delta--] = dest->elems[is--];
          if (delta == 0)
            break;
        }
       else
-        {
-          /* Slide from the bottom.  */
-          dest->elems[id + delta] = dest->elems[id];
+       {
+         /* Slide from the bottom.  */
+         dest->elems[id + delta] = dest->elems[id];
          if (! REG_VALID_INDEX (--id))
            {
              /* Copy remaining SRC elements.  */
              memcpy (dest->elems, dest->elems + sbase,
-                     delta * sizeof (Idx));
+                     delta * sizeof (Idx));
              break;
            }
        }
@@ -1275,7 +1275,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
    Return true if successful.  */
 
 static bool
-internal_function
+internal_function __attribute_warn_unused_result__
 re_node_set_insert (re_node_set *set, Idx elem)
 {
   Idx idx;
@@ -1308,12 +1308,12 @@ re_node_set_insert (re_node_set *set, Idx elem)
     {
       idx = 0;
       for (idx = set->nelem; idx > 0; idx--)
-        set->elems[idx] = set->elems[idx - 1];
+       set->elems[idx] = set->elems[idx - 1];
     }
   else
     {
       for (idx = set->nelem; set->elems[idx - 1] > elem; idx--)
-        set->elems[idx] = set->elems[idx - 1];
+       set->elems[idx] = set->elems[idx - 1];
     }
 
   /* Insert the new element.  */
@@ -1327,7 +1327,7 @@ re_node_set_insert (re_node_set *set, Idx elem)
    Return true if successful.  */
 
 static bool
-internal_function
+internal_function __attribute_warn_unused_result__
 re_node_set_insert_last (re_node_set *set, Idx elem)
 {
   /* Realloc if we need.  */
@@ -1473,7 +1473,7 @@ calc_state_hash (const re_node_set *nodes, unsigned int context)
           optimization.  */
 
 static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
 re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
                  const re_node_set *nodes)
 {
@@ -1521,7 +1521,7 @@ re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
           optimization.  */
 
 static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
 re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa,
                          const re_node_set *nodes, unsigned int context)
 {
@@ -1562,6 +1562,7 @@ re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa,
    indicates the error code if failed.  */
 
 static reg_errcode_t
+__attribute_warn_unused_result__
 register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
                re_hashval_t hash)
 {
@@ -1616,7 +1617,7 @@ free_state (re_dfastate_t *state)
    Return the new state if succeeded, otherwise return NULL.  */
 
 static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
 create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
                    re_hashval_t hash)
 {
@@ -1666,7 +1667,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
    Return the new state if succeeded, otherwise return NULL.  */
 
 static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
 create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
                    unsigned int context, re_hashval_t hash)
 {
@@ -1715,7 +1716,9 @@ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
                  free_state (newstate);
                  return NULL;
                }
-             re_node_set_init_copy (newstate->entrance_nodes, nodes);
+             if (re_node_set_init_copy (newstate->entrance_nodes, nodes)
+                 != REG_NOERROR)
+               return NULL;
              nctx_nodes = 0;
              newstate->has_constraint = 1;
            }
index 1f39507..e1b4c61 100644 (file)
@@ -28,9 +28,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef _LIBC
-# include <langinfo.h>
-#else
+#include <langinfo.h>
+#ifndef _LIBC
 # include "localcharset.h"
 #endif
 #if defined HAVE_LOCALE_H || defined _LIBC
@@ -852,4 +851,21 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
 }
 #endif /* RE_ENABLE_I18N */
 
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_MINOR__
+#  define __GNUC_PREREQ(maj, min) \
+         ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+# else
+#  define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+
+#if __GNUC_PREREQ (3,4)
+# undef __attribute_warn_unused_result__
+# define __attribute_warn_unused_result__ \
+   __attribute__ ((__warn_unused_result__))
+#else
+# define __attribute_warn_unused_result__ /* empty */
+#endif
+
 #endif /*  _REGEX_INTERNAL_H */
index 0d48a95..9388ac1 100644 (file)
@@ -637,7 +637,7 @@ re_exec (s)
    (0 <= LAST_START && LAST_START <= LENGTH)  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 re_search_internal (const regex_t *preg,
                    const char *string, Idx length,
                    Idx start, Idx last_start, Idx stop,
@@ -833,10 +833,10 @@ re_search_internal (const regex_t *preg,
                break;
              match_first += incr;
              if (match_first < left_lim || match_first > right_lim)
-               {
-                 err = REG_NOMATCH;
-                 goto free_return;
-               }
+               {
+                 err = REG_NOMATCH;
+                 goto free_return;
+               }
            }
          break;
        }
@@ -953,14 +953,14 @@ re_search_internal (const regex_t *preg,
        }
 
       if (dfa->subexp_map)
-        for (reg_idx = 0; reg_idx + 1 < nmatch; reg_idx++)
-          if (dfa->subexp_map[reg_idx] != reg_idx)
-            {
-              pmatch[reg_idx + 1].rm_so
-                = pmatch[dfa->subexp_map[reg_idx] + 1].rm_so;
-              pmatch[reg_idx + 1].rm_eo
-                = pmatch[dfa->subexp_map[reg_idx] + 1].rm_eo;
-            }
+       for (reg_idx = 0; reg_idx + 1 < nmatch; reg_idx++)
+         if (dfa->subexp_map[reg_idx] != reg_idx)
+           {
+             pmatch[reg_idx + 1].rm_so
+               = pmatch[dfa->subexp_map[reg_idx] + 1].rm_so;
+             pmatch[reg_idx + 1].rm_eo
+               = pmatch[dfa->subexp_map[reg_idx] + 1].rm_eo;
+           }
     }
 
  free_return:
@@ -972,7 +972,7 @@ re_search_internal (const regex_t *preg,
 }
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 prune_impossible_nodes (re_match_context_t *mctx)
 {
   const re_dfa_t *const dfa = mctx->dfa;
@@ -1110,7 +1110,7 @@ acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
    index of the buffer.  */
 
 static Idx
-internal_function
+internal_function __attribute_warn_unused_result__
 check_matching (re_match_context_t *mctx, bool fl_longest_match,
                Idx *p_match_first)
 {
@@ -1149,7 +1149,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match,
            {
              err = transit_state_bkref (mctx, &cur_state->nodes);
              if (BE (err != REG_NOERROR, 0))
-               return err;
+               return err;
            }
        }
     }
@@ -1176,16 +1176,16 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match,
       Idx next_char_idx = re_string_cur_idx (&mctx->input) + 1;
 
       if (BE (next_char_idx >= mctx->input.bufs_len, 0)
-          || (BE (next_char_idx >= mctx->input.valid_len, 0)
-              && mctx->input.valid_len < mctx->input.len))
-        {
-          err = extend_buffers (mctx);
-          if (BE (err != REG_NOERROR, 0))
+         || (BE (next_char_idx >= mctx->input.valid_len, 0)
+             && mctx->input.valid_len < mctx->input.len))
+       {
+         err = extend_buffers (mctx);
+         if (BE (err != REG_NOERROR, 0))
            {
              assert (err == REG_ESPACE);
              return REG_ERROR;
            }
-        }
+       }
 
       cur_state = transit_state (&err, mctx, cur_state);
       if (mctx->state_log != NULL)
@@ -1309,17 +1309,17 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
           if (dest_node == REG_MISSING)
            dest_node = candidate;
 
-          else
+         else
            {
              /* In order to avoid infinite loop like "(a*)*", return the second
-                epsilon-transition if the first was already considered.  */
+                epsilon-transition if the first was already considered.  */
              if (re_node_set_contains (eps_via_nodes, dest_node))
-               return candidate;
+               return candidate;
 
              /* Otherwise, push the second epsilon-transition on the fail stack.  */
              else if (fs != NULL
                       && push_fail_stack (fs, *pidx, candidate, nregs, regs,
-                                          eps_via_nodes))
+                                          eps_via_nodes))
                return REG_ERROR;
 
              /* We know we are going to exit.  */
@@ -1385,7 +1385,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
 }
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node,
                 Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes)
 {
@@ -1432,7 +1432,7 @@ pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs,
    pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
          regmatch_t *pmatch, bool fl_backtrack)
 {
@@ -1667,7 +1667,7 @@ sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx)
       if (mctx->state_log[str_idx])
        {
          err = build_sifted_states (mctx, sctx, str_idx, &cur_dest);
-          if (BE (err != REG_NOERROR, 0))
+         if (BE (err != REG_NOERROR, 0))
            goto free_return;
        }
 
@@ -1686,7 +1686,7 @@ sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx)
 }
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx,
                     Idx str_idx, re_node_set *cur_dest)
 {
@@ -1848,7 +1848,7 @@ update_cur_sifted_state (const re_match_context_t *mctx,
 }
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes,
                       const re_node_set *candidates)
 {
@@ -1863,10 +1863,14 @@ add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes,
     {
       err = re_node_set_alloc (&state->inveclosure, dest_nodes->nelem);
       if (BE (err != REG_NOERROR, 0))
-        return REG_ESPACE;
+       return REG_ESPACE;
       for (i = 0; i < dest_nodes->nelem; i++)
-        re_node_set_merge (&state->inveclosure,
-                          dfa->inveclosures + dest_nodes->elems[i]);
+       {
+         err = re_node_set_merge (&state->inveclosure,
+                                  dfa->inveclosures + dest_nodes->elems[i]);
+         if (BE (err != REG_NOERROR, 0))
+           return REG_ESPACE;
+       }
     }
   return re_node_set_add_intersect (dest_nodes, candidates,
                                    &state->inveclosure);
@@ -1978,7 +1982,7 @@ check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries,
            {
              struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx;
              do
-               {
+               {
                  Idx dst;
                  int cpos;
 
@@ -2000,9 +2004,9 @@ check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries,
                  if (dst == from_node)
                    {
                      if (boundaries & 1)
-                       return -1;
+                       return -1;
                      else /* if (boundaries & 2) */
-                       return 0;
+                       return 0;
                    }
 
                  cpos =
@@ -2016,7 +2020,7 @@ check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries,
                  if (subexp_idx < BITSET_WORD_BITS)
                    ent->eps_reachable_subexps_map
                      &= ~((bitset_word_t) 1 << subexp_idx);
-               }
+               }
              while (ent++->more);
            }
          break;
@@ -2158,7 +2162,7 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes,
 }
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx,
                   Idx str_idx, const re_node_set *candidates)
 {
@@ -2241,7 +2245,7 @@ sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx,
          re_node_set_remove (&local_sctx.limits, enabled_idx);
 
          /* mctx->bkref_ents may have changed, reload the pointer.  */
-          entry = mctx->bkref_ents + enabled_idx;
+         entry = mctx->bkref_ents + enabled_idx;
        }
       while (enabled_idx++, entry++->more);
     }
@@ -2288,7 +2292,7 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
    update the destination of STATE_LOG.  */
 
 static re_dfastate_t *
-internal_function
+internal_function __attribute_warn_unused_result__
 transit_state (reg_errcode_t *err, re_match_context_t *mctx,
               re_dfastate_t *state)
 {
@@ -2322,7 +2326,7 @@ transit_state (reg_errcode_t *err, re_match_context_t *mctx,
 
       trtable = state->word_trtable;
       if (BE (trtable != NULL, 1))
-        {
+       {
          unsigned int context;
          context
            = re_string_context_at (&mctx->input,
@@ -2368,21 +2372,21 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
       unsigned int context;
       re_node_set next_nodes, *log_nodes, *table_nodes = NULL;
       /* If (state_log[cur_idx] != 0), it implies that cur_idx is
-         the destination of a multibyte char/collating element/
-         back reference.  Then the next state is the union set of
-         these destinations and the results of the transition table.  */
+        the destination of a multibyte char/collating element/
+        back reference.  Then the next state is the union set of
+        these destinations and the results of the transition table.  */
       pstate = mctx->state_log[cur_idx];
       log_nodes = pstate->entrance_nodes;
       if (next_state != NULL)
-        {
-          table_nodes = next_state->entrance_nodes;
-          *err = re_node_set_init_union (&next_nodes, table_nodes,
+       {
+         table_nodes = next_state->entrance_nodes;
+         *err = re_node_set_init_union (&next_nodes, table_nodes,
                                             log_nodes);
-          if (BE (*err != REG_NOERROR, 0))
+         if (BE (*err != REG_NOERROR, 0))
            return NULL;
-        }
+       }
       else
-        next_nodes = *log_nodes;
+       next_nodes = *log_nodes;
       /* Note: We already add the nodes of the initial state,
         then we don't need to add them here.  */
 
@@ -2390,12 +2394,12 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
                                      re_string_cur_idx (&mctx->input) - 1,
                                      mctx->eflags);
       next_state = mctx->state_log[cur_idx]
-        = re_acquire_state_context (err, dfa, &next_nodes, context);
+       = re_acquire_state_context (err, dfa, &next_nodes, context);
       /* We don't need to check errors here, since the return value of
-         this function is next_state and ERR is already set.  */
+        this function is next_state and ERR is already set.  */
 
       if (table_nodes != NULL)
-        re_node_set_free (&next_nodes);
+       re_node_set_free (&next_nodes);
     }
 
   if (BE (dfa->nbackref, 0) && next_state != NULL)
@@ -2436,9 +2440,9 @@ find_recover_state (reg_errcode_t *err, re_match_context_t *mctx)
 
       do
        {
-          if (++cur_str_idx > max)
-            return NULL;
-          re_string_skip_bytes (&mctx->input, 1);
+         if (++cur_str_idx > max)
+           return NULL;
+         re_string_skip_bytes (&mctx->input, 1);
        }
       while (mctx->state_log[cur_str_idx] == NULL);
 
@@ -2546,7 +2550,7 @@ transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate)
       re_dfastate_t *dest_state;
 
       if (!dfa->nodes[cur_node_idx].accept_mb)
-        continue;
+       continue;
 
       if (dfa->nodes[cur_node_idx].constraint)
        {
@@ -2714,7 +2718,7 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes)
    delay these checking for prune_impossible_nodes().  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx)
 {
   const re_dfa_t *const dfa = mctx->dfa;
@@ -2727,7 +2731,7 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx)
       const struct re_backref_cache_entry *entry
        = mctx->bkref_ents + cache_idx;
       do
-        if (entry->node == bkref_node)
+       if (entry->node == bkref_node)
          return REG_NOERROR; /* We already checked it.  */
       while (entry++->more);
     }
@@ -2915,7 +2919,7 @@ find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
    Return REG_NOERROR if it can arrive, or REG_NOMATCH otherwise.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node,
               Idx top_str, Idx last_node, Idx last_str, int type)
 {
@@ -3077,7 +3081,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node,
         Can't we unify them?  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx,
                              re_node_set *cur_nodes, re_node_set *next_nodes)
 {
@@ -3211,7 +3215,7 @@ check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes,
    problematic append it to DST_NODES.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes,
                              Idx target, Idx ex_subexp, int type)
 {
@@ -3256,7 +3260,7 @@ check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes,
    in MCTX->BKREF_ENTS.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes,
                    Idx cur_str, Idx subexp_num, int type)
 {
@@ -3622,7 +3626,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
        }
 #ifdef RE_ENABLE_I18N
       else if (type == OP_UTF8_PERIOD)
-        {
+       {
          if (ASCII_CHARS % BITSET_WORD_BITS == 0)
            memset (accepts, -1, ASCII_CHARS / CHAR_BIT);
          else
@@ -3631,7 +3635,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
            bitset_clear (accepts, '\n');
          if (dfa->syntax & RE_DOT_NOT_NULL)
            bitset_clear (accepts, '\0');
-        }
+       }
 #endif
       else
        continue;
@@ -3836,7 +3840,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
   if (node->type == OP_PERIOD)
     {
       if (char_len <= 1)
-        return 0;
+       return 0;
       /* FIXME: I don't think this if is needed, as both '\n'
         and '\0' are char_len == 1.  */
       /* '.' accepts any one character except the following two cases.  */
@@ -3949,15 +3953,20 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
                _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
              indirect = (const int32_t *)
                _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
-             idx = findidx (&cp);
+             int32_t idx = findidx (&cp);
              if (idx > 0)
                for (i = 0; i < cset->nequiv_classes; ++i)
                  {
                    int32_t equiv_class_idx = cset->equiv_classes[i];
-                   size_t weight_len = weights[idx];
-                   if (weight_len == weights[equiv_class_idx])
+                   size_t weight_len = weights[idx & 0xffffff];
+                   if (weight_len == weights[equiv_class_idx & 0xffffff]
+                       && (idx >> 24) == (equiv_class_idx >> 24))
                      {
                        Idx cnt = 0;
+
+                       idx &= 0xffffff;
+                       equiv_class_idx &= 0xffffff;
+
                        while (cnt <= weight_len
                               && (weights[equiv_class_idx + 1 + cnt]
                                   == weights[idx + 1 + cnt]))
@@ -4123,7 +4132,7 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
 /* Extend the buffers, if the buffers have run out.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 extend_buffers (re_match_context_t *mctx)
 {
   reg_errcode_t ret;
@@ -4186,7 +4195,7 @@ extend_buffers (re_match_context_t *mctx)
 /* Initialize MCTX.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 match_ctx_init (re_match_context_t *mctx, int eflags, Idx n)
 {
   mctx->eflags = eflags;
@@ -4266,7 +4275,7 @@ match_ctx_free (re_match_context_t *mctx)
 */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from,
                     Idx to)
 {
@@ -4338,7 +4347,7 @@ search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx)
    at STR_IDX.  */
 
 static reg_errcode_t
-internal_function
+internal_function __attribute_warn_unused_result__
 match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx)
 {
 #ifdef DEBUG
index 1e0cbab..cec7ebe 100644 (file)
 #define _GL_SEARCH_H
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -101,25 +101,25 @@ extern void twalk (const void *vroot,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef tsearch
-# define tsearch(k,v,c) \
-    (GL_LINK_WARNING ("tsearch is unportable - " \
-                      "use gnulib module tsearch for portability"), \
-     tsearch (k, v, c))
+# if HAVE_RAW_DECL_TSEARCH
+_GL_WARN_ON_USE (tsearch, "tsearch is unportable - "
+                 "use gnulib module tsearch for portability");
+# endif
 # undef tfind
-# define tfind(k,v,c) \
-    (GL_LINK_WARNING ("tfind is unportable - " \
-                      "use gnulib module tsearch for portability"), \
-     tfind (k, v, c))
+# if HAVE_RAW_DECL_TFIND
+_GL_WARN_ON_USE (tfind, "tfind is unportable - "
+                 "use gnulib module tsearch for portability");
+# endif
 # undef tdelete
-# define tdelete(k,v,c) \
-    (GL_LINK_WARNING ("tdelete is unportable - " \
-                      "use gnulib module tsearch for portability"), \
-     tdelete (k, v, c))
+# if HAVE_RAW_DECL_TDELETE
+_GL_WARN_ON_USE (tdelete, "tdelete is unportable - "
+                 "use gnulib module tsearch for portability");
+# endif
 # undef twalk
-# define twalk(v,a) \
-    (GL_LINK_WARNING ("twalk is unportable - " \
-                      "use gnulib module tsearch for portability"), \
-     twalk (v, a))
+# if HAVE_RAW_DECL_TWALK
+_GL_WARN_ON_USE (twalk, "twalk is unportable - "
+                 "use gnulib module tsearch for portability");
+# endif
 #endif
 
 
index c5b4726..2cd2c75 100644 (file)
@@ -387,7 +387,7 @@ qset_acl (char const *name, int desc, mode_t mode)
       ret = acl (name, SETACL, sizeof (entries) / sizeof (aclent_t), entries);
     if (ret < 0)
       {
-        if (errno == ENOSYS)
+        if (errno == ENOSYS || errno == EOPNOTSUPP)
           return chmod_or_fchmod (name, desc, mode);
         return -1;
       }
index ebfba74..131132a 100644 (file)
 #ifndef _GL_SIGNAL_H
 #define _GL_SIGNAL_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 /* Define pid_t, uid_t.
    Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
 #include <sys/types.h>
@@ -129,40 +129,40 @@ extern int raise (int sig);
 # endif /* !@HAVE_POSIX_SIGNALBLOCKING@ */
 #elif defined GNULIB_POSIXCHECK
 # undef sigaddset
-# define sigaddset(s,n) \
-  (GL_LINK_WARNING ("sigaddset is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigaddset (s, n))
+# if HAVE_RAW_DECL_SIGADDSET
+_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigdelset
-# define sigdelset(s,n) \
-  (GL_LINK_WARNING ("sigdelset is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigdelset (s, n))
+# if HAVE_RAW_DECL_SIGDELSET
+_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigemptyset
-# define sigemptyset(s) \
-  (GL_LINK_WARNING ("sigemptyset is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigemptyset (s))
+# if HAVE_RAW_DECL_SIGEMPTYSET
+_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigfillset
-# define sigfillset(s) \
-  (GL_LINK_WARNING ("sigfillset is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigfillset (s))
+# if HAVE_RAW_DECL_SIGFILLSET
+_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigismember
-# define sigismember(s,n) \
-  (GL_LINK_WARNING ("sigismember is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigismember (s, n))
+# if HAVE_RAW_DECL_SIGISMEMBER
+_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigpending
-# define sigpending(s) \
-  (GL_LINK_WARNING ("sigpending is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigpending (s))
+# if HAVE_RAW_DECL_SIGPENDING
+_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 # undef sigprocmask
-# define sigprocmask(h,s,o)                               \
-  (GL_LINK_WARNING ("sigprocmask is unportable - "        \
-                    "use gnulib module sigprocmask for portability"),   \
-   sigprocmask (h, s, o))
+# if HAVE_RAW_DECL_SIGPROCMASK
+_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
 #endif /* @GNULIB_SIGPROCMASK@ */
 
 
@@ -228,10 +228,10 @@ extern int sigaction (int, const struct sigaction *restrict,
 # endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
 #elif defined GNULIB_POSIXCHECK
 # undef sigaction
-# define sigaction(s,a,o)                               \
-  (GL_LINK_WARNING ("sigaction is unportable - "        \
-                    "use gnulib module sigaction for portability"),   \
-   sigaction (s, a, o))
+# if HAVE_RAW_DECL_SIGACTION
+_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
+                 "use the gnulib module sigaction for portability");
+# endif
 #endif
 
 /* Some systems don't have SA_NODEFER.  */
index 2c7ba93..9fae568 100644 (file)
@@ -1,5 +1,5 @@
 /* Quad-precision floating point trigonometric functions on <-pi/4,pi/4>.
-   Copyright (C) 1999, 2006, 2007, 20092010 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2006, 2007, 2009-2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jj@ultra.linux.cz>
 
 #include <config.h>
 
 /* Specification.  */
-#include <math.h>
+#include "trigl.h"
 
 #include <float.h>
+#include <math.h>
 
 static const long double sin_c[] = {
 #define ONE sin_c[0]
index eb0e05b..d8a0e7a 100644 (file)
@@ -50,8 +50,6 @@
  */
 
 #include "trigl.h"
-#include "trigl.c"
-#include "sincosl.c"
 
 long double
 sinl (long double x)
index c4bd80b..1e8c936 100644 (file)
 # endif
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* Data structure to contain attributes for thread creation.  */
 #if @REPLACE_POSIX_SPAWN@
@@ -110,17 +110,19 @@ typedef struct
 
 
 /* Flags to be set in the `posix_spawnattr_t'.  */
-#if @REPLACE_POSIX_SPAWN@
+#if !@HAVE_POSIX_SPAWN@
+# if @REPLACE_POSIX_SPAWN@
 /* Use the values from the system, for better compatibility.  */
 /* But this implementation does not support AIX extensions.  */
-# undef POSIX_SPAWN_FORK_HANDLERS
-#else
-# define POSIX_SPAWN_RESETIDS           0x01
-# define POSIX_SPAWN_SETPGROUP          0x02
-# define POSIX_SPAWN_SETSIGDEF          0x04
-# define POSIX_SPAWN_SETSIGMASK         0x08
-# define POSIX_SPAWN_SETSCHEDPARAM      0x10
-# define POSIX_SPAWN_SETSCHEDULER       0x20
+#  undef POSIX_SPAWN_FORK_HANDLERS
+# else
+#  define POSIX_SPAWN_RESETIDS           0x01
+#  define POSIX_SPAWN_SETPGROUP          0x02
+#  define POSIX_SPAWN_SETSIGDEF          0x04
+#  define POSIX_SPAWN_SETSIGMASK         0x08
+#  define POSIX_SPAWN_SETSCHEDPARAM      0x10
+#  define POSIX_SPAWN_SETSCHEDULER       0x20
+# endif
 #endif
 /* A GNU extension.  Use the next free bit position.  */
 #define POSIX_SPAWN_USEVFORK \
@@ -163,10 +165,10 @@ extern int posix_spawn (pid_t *_Restrict_ __pid,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn
-# define posix_spawn(a,b,c,d,e,f)                   \
-  (GL_LINK_WARNING ("posix_spawn is unportable - "        \
-                    "use gnulib module posix_spawn for portability"),   \
-   posix_spawn (a, b, c, d, e, f))
+# if HAVE_RAW_DECL_POSIX_SPAWN
+_GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
+                 "use gnulib module posix_spawn for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNP@
@@ -186,10 +188,10 @@ extern int posix_spawnp (pid_t *__pid, const char *__file,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnp
-# define posix_spawnp(a,b,c,d,e,f)                   \
-  (GL_LINK_WARNING ("posix_spawnp is unportable - "        \
-                    "use gnulib module posix_spawnp for portability"),   \
-   posix_spawnp (a, b, c, d, e, f))
+# if HAVE_RAW_DECL_POSIX_SPAWNP
+_GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
+                 "use gnulib module posix_spawnp for portability");
+# endif
 #endif
 
 
@@ -204,10 +206,10 @@ extern int posix_spawnattr_init (posix_spawnattr_t *__attr)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_init
-# define posix_spawnattr_init(a)                   \
-  (GL_LINK_WARNING ("posix_spawnattr_init is unportable - "        \
-                    "use gnulib module posix_spawnattr_init for portability"), \
-   posix_spawnattr_init (a))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
+_GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
+                 "use gnulib module posix_spawnattr_init for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
@@ -221,10 +223,10 @@ extern int posix_spawnattr_destroy (posix_spawnattr_t *__attr)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_destroy
-# define posix_spawnattr_destroy(a)                   \
-  (GL_LINK_WARNING ("posix_spawnattr_destroy is unportable - "        \
-                    "use gnulib module posix_spawnattr_destroy for portability"), \
-   posix_spawnattr_destroy (a))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
+_GL_WARN_ON_USE (posix_spawnattr_destroy, "posix_spawnattr_destroy is unportable - "
+                 "use gnulib module posix_spawnattr_destroy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
@@ -240,10 +242,10 @@ extern int posix_spawnattr_getsigdefault (const posix_spawnattr_t *_Restrict_ __
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getsigdefault
-# define posix_spawnattr_getsigdefault(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getsigdefault is unportable - "        \
-                    "use gnulib module posix_spawnattr_getsigdefault for portability"), \
-   posix_spawnattr_getsigdefault (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
+_GL_WARN_ON_USE (posix_spawnattr_getsigdefault, "posix_spawnattr_getsigdefault is unportable - "
+                 "use gnulib module posix_spawnattr_getsigdefault for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
@@ -258,10 +260,10 @@ extern int posix_spawnattr_setsigdefault (posix_spawnattr_t *_Restrict_ __attr,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setsigdefault
-# define posix_spawnattr_setsigdefault(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setsigdefault is unportable - "        \
-                    "use gnulib module posix_spawnattr_setsigdefault for portability"), \
-   posix_spawnattr_setsigdefault (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
+_GL_WARN_ON_USE (posix_spawnattr_setsigdefault, "posix_spawnattr_setsigdefault is unportable - "
+                 "use gnulib module posix_spawnattr_setsigdefault for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
@@ -276,10 +278,10 @@ extern int posix_spawnattr_getsigmask (const posix_spawnattr_t *_Restrict_ __att
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getsigmask
-# define posix_spawnattr_getsigmask(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getsigmask is unportable - "        \
-                    "use gnulib module posix_spawnattr_getsigmask for portability"), \
-   posix_spawnattr_getsigmask (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
+_GL_WARN_ON_USE (posix_spawnattr_getsigmask, "posix_spawnattr_getsigmask is unportable - "
+                 "use gnulib module posix_spawnattr_getsigmask for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
@@ -294,10 +296,10 @@ extern int posix_spawnattr_setsigmask (posix_spawnattr_t *_Restrict_ __attr,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setsigmask
-# define posix_spawnattr_setsigmask(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setsigmask is unportable - "        \
-                    "use gnulib module posix_spawnattr_setsigmask for portability"), \
-   posix_spawnattr_setsigmask (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
+_GL_WARN_ON_USE (posix_spawnattr_setsigmask, "posix_spawnattr_setsigmask is unportable - "
+                 "use gnulib module posix_spawnattr_setsigmask for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
@@ -312,10 +314,10 @@ extern int posix_spawnattr_getflags (const posix_spawnattr_t *_Restrict_ __attr,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getflags
-# define posix_spawnattr_getflags(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getflags is unportable - "        \
-                    "use gnulib module posix_spawnattr_getflags for portability"), \
-   posix_spawnattr_getflags (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
+_GL_WARN_ON_USE (posix_spawnattr_getflags, "posix_spawnattr_getflags is unportable - "
+                 "use gnulib module posix_spawnattr_getflags for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
@@ -330,10 +332,10 @@ extern int posix_spawnattr_setflags (posix_spawnattr_t *__attr,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setflags
-# define posix_spawnattr_setflags(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setflags is unportable - "        \
-                    "use gnulib module posix_spawnattr_setflags for portability"), \
-   posix_spawnattr_setflags (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
+_GL_WARN_ON_USE (posix_spawnattr_setflags, "posix_spawnattr_setflags is unportable - "
+                 "use gnulib module posix_spawnattr_setflags for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
@@ -348,10 +350,10 @@ extern int posix_spawnattr_getpgroup (const posix_spawnattr_t *_Restrict_ __attr
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getpgroup
-# define posix_spawnattr_getpgroup(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getpgroup is unportable - "        \
-                    "use gnulib module posix_spawnattr_getpgroup for portability"), \
-   posix_spawnattr_getpgroup (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
+_GL_WARN_ON_USE (posix_spawnattr_getpgroup, "posix_spawnattr_getpgroup is unportable - "
+                 "use gnulib module posix_spawnattr_getpgroup for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
@@ -366,10 +368,10 @@ extern int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setpgroup
-# define posix_spawnattr_setpgroup(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setpgroup is unportable - "        \
-                    "use gnulib module posix_spawnattr_setpgroup for portability"), \
-   posix_spawnattr_setpgroup (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
+_GL_WARN_ON_USE (posix_spawnattr_setpgroup, "posix_spawnattr_setpgroup is unportable - "
+                 "use gnulib module posix_spawnattr_setpgroup for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
@@ -384,10 +386,10 @@ extern int posix_spawnattr_getschedpolicy (const posix_spawnattr_t *_Restrict_ _
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getschedpolicy
-# define posix_spawnattr_getschedpolicy(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getschedpolicy is unportable - "        \
-                    "use gnulib module posix_spawnattr_getschedpolicy for portability"), \
-   posix_spawnattr_getschedpolicy (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
+_GL_WARN_ON_USE (posix_spawnattr_getschedpolicy, "posix_spawnattr_getschedpolicy is unportable - "
+                 "use gnulib module posix_spawnattr_getschedpolicy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
@@ -402,10 +404,10 @@ extern int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setschedpolicy
-# define posix_spawnattr_setschedpolicy(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setschedpolicy is unportable - "        \
-                    "use gnulib module posix_spawnattr_setschedpolicy for portability"), \
-   posix_spawnattr_setschedpolicy (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
+_GL_WARN_ON_USE (posix_spawnattr_setschedpolicy, "posix_spawnattr_setschedpolicy is unportable - "
+                 "use gnulib module posix_spawnattr_setschedpolicy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
@@ -420,10 +422,10 @@ extern int posix_spawnattr_getschedparam (const posix_spawnattr_t *_Restrict_ __
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getschedparam
-# define posix_spawnattr_getschedparam(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_getschedparam is unportable - "        \
-                    "use gnulib module posix_spawnattr_getschedparam for portability"), \
-   posix_spawnattr_getschedparam (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
+_GL_WARN_ON_USE (posix_spawnattr_getschedparam, "posix_spawnattr_getschedparam is unportable - "
+                 "use gnulib module posix_spawnattr_getschedparam for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
@@ -438,10 +440,10 @@ extern int posix_spawnattr_setschedparam (posix_spawnattr_t *_Restrict_ __attr,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setschedparam
-# define posix_spawnattr_setschedparam(a, b)                         \
-  (GL_LINK_WARNING ("posix_spawnattr_setschedparam is unportable - "        \
-                    "use gnulib module posix_spawnattr_setschedparam for portability"), \
-   posix_spawnattr_setschedparam (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
+_GL_WARN_ON_USE (posix_spawnattr_setschedparam, "posix_spawnattr_setschedparam is unportable - "
+                 "use gnulib module posix_spawnattr_setschedparam for portability");
+# endif
 #endif
 
 
@@ -456,10 +458,10 @@ extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *__file_act
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_init
-# define posix_spawn_file_actions_init(a)                         \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_init is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_init for portability"), \
-   posix_spawn_file_actions_init (a))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
+_GL_WARN_ON_USE (posix_spawn_file_actions_init, "posix_spawn_file_actions_init is unportable - "
+                 "use gnulib module posix_spawn_file_actions_init for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
@@ -473,10 +475,10 @@ extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *__file_
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_destroy
-# define posix_spawn_file_actions_destroy(a)                         \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_destroy is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_destroy for portability"), \
-   posix_spawn_file_actions_destroy (a))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
+_GL_WARN_ON_USE (posix_spawn_file_actions_destroy, "posix_spawn_file_actions_destroy is unportable - "
+                 "use gnulib module posix_spawn_file_actions_destroy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
@@ -494,10 +496,10 @@ extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *_Restri
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_addopen
-# define posix_spawn_file_actions_addopen(a, b, c, d, e)                     \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_addopen is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_addopen for portability"), \
-   posix_spawn_file_actions_addopen (a, b, c, d, e))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
+_GL_WARN_ON_USE (posix_spawn_file_actions_addopen, "posix_spawn_file_actions_addopen is unportable - "
+                 "use gnulib module posix_spawn_file_actions_addopen for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
@@ -513,10 +515,10 @@ extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *__file
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_addclose
-# define posix_spawn_file_actions_addclose(a,b)                          \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_addclose is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_addclose for portability"), \
-   posix_spawn_file_actions_addclose (a, b))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
+_GL_WARN_ON_USE (posix_spawn_file_actions_addclose, "posix_spawn_file_actions_addclose is unportable - "
+                 "use gnulib module posix_spawn_file_actions_addclose for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
@@ -532,10 +534,10 @@ extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *__file_
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_adddup2
-# define posix_spawn_file_actions_adddup2(a,b,c)                         \
-  (GL_LINK_WARNING ("posix_spawn_file_actions_adddup2 is unportable - "        \
-                    "use gnulib module posix_spawn_file_actions_adddup2 for portability"), \
-   posix_spawn_file_actions_adddup2 (a, b, c))
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
+_GL_WARN_ON_USE (posix_spawn_file_actions_adddup2, "posix_spawn_file_actions_adddup2 is unportable - "
+                 "use gnulib module posix_spawn_file_actions_adddup2 for portability");
+# endif
 #endif
 
 
index 9e1fac3..91740f2 100644 (file)
 #include <sys/types.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -77,10 +76,10 @@ extern int dprintf (int fd, const char *format, ...)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dprintf
-# define dprintf \
-    (GL_LINK_WARNING ("dprintf is unportable - " \
-                      "use gnulib module dprintf for portability"), \
-     dprintf)
+# if HAVE_RAW_DECL_DPRINTF
+_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
+                 "use gnulib module dprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_FCLOSE@
@@ -91,11 +90,9 @@ extern int fclose (FILE *stream) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fclose
-# define fclose(f) \
-   (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
-                     "use gnulib module fclose for portable " \
-                     "POSIX compliance"), \
-    fclose (f))
+/* Assume fclose is always declared.  */
+_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
+                 "use gnulib module fclose for portable POSIX compliance");
 #endif
 
 #if @GNULIB_FFLUSH@
@@ -111,13 +108,17 @@ extern int fclose (FILE *stream) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fflush
-# define fflush(f) \
-   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
-                     "use gnulib module fflush for portable " \
-                     "POSIX compliance"), \
-    fflush (f))
+/* Assume fflush is always declared.  */
+_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_FOPEN@
 # if @REPLACE_FOPEN@
 #  undef fopen
@@ -127,31 +128,29 @@ extern FILE * fopen (const char *filename, const char *mode)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fopen
-# define fopen(f,m) \
-   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module fopen for portability"), \
-    fopen (f, m))
+/* Assume fopen is always declared.  */
+_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module fopen for portability");
 #endif
 
-#if @GNULIB_FPRINTF_POSIX@
-# if @REPLACE_FPRINTF@
+#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
+# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
+     || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
 #  define fprintf rpl_fprintf
+#  define GNULIB_overrides_fprintf 1
 extern int fprintf (FILE *fp, const char *format, ...)
        __attribute__ ((__format__ (__printf__, 2, 3)))
        _GL_ARG_NONNULL ((1, 2));
 # endif
-#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# define fprintf rpl_fprintf
-extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)))
-       _GL_ARG_NONNULL ((1, 2));
-#elif defined GNULIB_POSIXCHECK
-# undef fprintf
-# define fprintf \
-    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
-                      "use gnulib module fprintf-posix for portable " \
-                      "POSIX compliance"), \
-     fprintf)
+#endif
+#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_fprintf
+#  undef fprintf
+# endif
+/* Assume fprintf is always declared.  */
+_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
+                 "use gnulib module fprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_FPURGE@
@@ -169,10 +168,10 @@ extern int fprintf (FILE *fp, const char *format, ...)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fpurge
-# define fpurge(f) \
-   (GL_LINK_WARNING ("fpurge is not always present - " \
-                     "use gnulib module fpurge for portability"), \
-    fpurge (f))
+# if HAVE_RAW_DECL_FPURGE
+_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
+                 "use gnulib module fpurge for portability");
+# endif
 #endif
 
 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
@@ -196,100 +195,146 @@ extern FILE * freopen (const char *filename, const char *mode, FILE *stream)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef freopen
-# define freopen(f,m,s) \
-   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module freopen for portability"), \
-    freopen (f, m, s))
-#endif
-
-#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
-extern int rpl_fseek (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1));
-# undef fseek
-# if defined GNULIB_POSIXCHECK
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      rpl_fseek (f, o, w))
-# else
+/* Assume freopen is always declared.  */
+_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module freopen for portability");
+#endif
+
+
+/* Set up the following warnings, based on which modules are in use.
+   GNU Coding Standards discourage the use of fseek, since it imposes
+   an arbitrary limitation on some 32-bit hosts.  Remember that the
+   fseek module depends on the fseeko module, so we only have three
+   cases to consider:
+
+   1. The developer is not using either module.  Issue a warning under
+   GNULIB_POSIXCHECK for both functions, to remind them that both
+   functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
+   impact on this warning.
+
+   2. The developer is using both modules.  They may be unaware of the
+   arbitrary limitations of fseek, so issue a warning under
+   GNULIB_POSIXCHECK.  On the other hand, they may be using both
+   modules intentionally, so the developer can define
+   _GL_NO_LARGE_FILES in the compilation units where the use of fseek
+   is safe, to silence the warning.
+
+   3. The developer is using the fseeko module, but not fseek.  Gnulib
+   guarantees that fseek will still work around platform bugs in that
+   case, but we presume that the developer is aware of the pitfalls of
+   fseek and was trying to avoid it, so issue a warning even when
+   GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
+   defined to silence the warning in particular compilation units.
+
+   Most gnulib clients that perform stream operations should fall into
+   category 3.  */
+
+#if @GNULIB_FSEEK@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 2, above.  */
+#  undef fseek
+# endif
+# if @REPLACE_FSEEK@
+#  undef fseek
 #  define fseek rpl_fseek
-# endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef fseek
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      fseek (f, o, w))
+extern int fseek (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1));
 # endif
 #endif
 
 #if @GNULIB_FSEEKO@
+# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 3, above.  */
+#  undef fseek
+# endif
 # if @REPLACE_FSEEKO@
 /* Provide fseek, fseeko functions that are aware of a preceding
    fflush(), and which detect pipes.  */
+#  undef fseeko
 #  define fseeko rpl_fseeko
 extern int fseeko (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1));
 #  if !@GNULIB_FSEEK@
 #   undef fseek
-#   define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      fseeko (f, o, w))
+#   define fseek rpl_fseek
+static inline int _GL_ARG_NONNULL ((1))
+rpl_fseek (FILE *fp, long offset, int whence)
+{
+  return fseeko (fp, offset, whence);
+}
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
+# define _GL_FSEEK_WARN /* Category 1, above.  */
+# undef fseek
 # undef fseeko
-# define fseeko(f,o,w) \
-   (GL_LINK_WARNING ("fseeko is unportable - " \
-                     "use gnulib module fseeko for portability"), \
-    fseeko (f, o, w))
+# if HAVE_RAW_DECL_FSEEKO
+_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
+                 "use gnulib module fseeko for portability");
+# endif
 #endif
 
-#if @GNULIB_FTELL@ && @REPLACE_FTELL@
-extern long rpl_ftell (FILE *fp) _GL_ARG_NONNULL ((1));
-# undef ftell
-# if GNULIB_POSIXCHECK
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      rpl_ftell (f))
-# else
-#  define ftell rpl_ftell
+#ifdef _GL_FSEEK_WARN
+# undef _GL_FSEEK_WARN
+/* Here, either fseek is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_fseek (declared above).  */
+_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use fseeko function for handling of large files");
+#endif
+
+
+/* ftell, ftello.  See the comments on fseek/fseeko.  */
+
+#if @GNULIB_FTELL@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 2, above.  */
+#  undef ftell
 # endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef ftell
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      ftell (f))
+# if @REPLACE_FTELL@
+#  undef ftell
+#  define ftell rpl_ftell
+extern long ftell (FILE *fp) _GL_ARG_NONNULL ((1));
 # endif
 #endif
 
 #if @GNULIB_FTELLO@
+# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 3, above.  */
+#  undef ftell
+# endif
 # if @REPLACE_FTELLO@
+#  undef ftello
 #  define ftello rpl_ftello
 extern off_t ftello (FILE *fp) _GL_ARG_NONNULL ((1));
 #  if !@GNULIB_FTELL@
 #   undef ftell
-#   define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      ftello (f))
+#   define ftell rpl_ftell
+static inline long _GL_ARG_NONNULL ((1))
+rpl_ftell (FILE *f)
+{
+  return ftello (f);
+}
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
+# define _GL_FTELL_WARN /* Category 1, above.  */
+# undef ftell
 # undef ftello
-# define ftello(f) \
-   (GL_LINK_WARNING ("ftello is unportable - " \
-                     "use gnulib module ftello for portability"), \
-    ftello (f))
+# if HAVE_RAW_DECL_FTELLO
+_GL_WARN_ON_USE (ftello, "ftello is unportable - "
+                 "use gnulib module ftello for portability");
+# endif
+#endif
+
+#ifdef _GL_FTELL_WARN
+# undef _GL_FTELL_WARN
+/* Here, either ftell is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_ftell (declared above).  */
+_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use ftello function for handling of large files");
 #endif
 
+
 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef fwrite
 # define fwrite rpl_fwrite
@@ -298,7 +343,11 @@ extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
 #endif
 
 #if @GNULIB_GETDELIM@
-# if !@HAVE_DECL_GETDELIM@
+# if @REPLACE_GETDELIM@
+#  undef getdelim
+#  define getdelim rpl_getdelim
+# endif
+# if !@HAVE_DECL_GETDELIM@ || @REPLACE_GETDELIM@
 /* Read input, up to (and including) the next occurrence of DELIMITER, from
    STREAM, store it in *LINEPTR (and NUL-terminate it).
    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
@@ -311,10 +360,10 @@ extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdelim
-# define getdelim(l, s, d, f)                                       \
-  (GL_LINK_WARNING ("getdelim is unportable - "                     \
-                    "use gnulib module getdelim for portability"),  \
-   getdelim (l, s, d, f))
+# if HAVE_RAW_DECL_GETDELIM
+_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
+                 "use gnulib module getdelim for portability");
+# endif
 #endif
 
 #if @GNULIB_GETLINE@
@@ -334,15 +383,15 @@ extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getline
-# define getline(l, s, f)                                               \
-  (GL_LINK_WARNING ("getline is unportable - "                          \
-                    "use gnulib module getline for portability"),       \
-   getline (l, s, f))
+# if HAVE_RAW_DECL_GETLINE
+_GL_WARN_ON_USE (getline, "getline is unportable - "
+                 "use gnulib module getline for portability");
+# endif
 #endif
 
-#if @GNULIB_OBSTACK_PRINTF@
+#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
 # if @REPLACE_OBSTACK_PRINTF@
-#  define obstack_printf rpl_osbtack_printf
+#  define obstack_printf rpl_obstack_printf
 #  define obstack_vprintf rpl_obstack_vprintf
 # endif
 # if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
@@ -370,10 +419,9 @@ extern void perror (const char *string);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef perror
-# define perror(s) \
-    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
-                      "use gnulib module perror for portability"), \
-     perror (s))
+/* Assume perror is always declared.  */
+_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
+                 "use gnulib module perror for portability");
 #endif
 
 #if @GNULIB_POPEN@
@@ -385,38 +433,30 @@ extern FILE *popen (const char *cmd, const char *mode)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef popen
-# define popen(c,m) \
-   (GL_LINK_WARNING ("popen is buggy on some platforms - " \
-                     "use gnulib module popen or pipe for more portability"), \
-    popen (c, m))
+# if HAVE_RAW_DECL_POPEN
+_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
+                 "use gnulib module popen or pipe for more portability");
+# endif
 #endif
 
-#if @GNULIB_PRINTF_POSIX@
-# if @REPLACE_PRINTF@
+#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
+# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
+     || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
 /* Don't break __attribute__((format(printf,M,N))).  */
 #  define printf __printf__
+#  define GNULIB_overrides_printf 1
 extern int printf (const char *format, ...)
        __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
 # endif
-#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define printf __printf__
-extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
-#elif defined GNULIB_POSIXCHECK
-# undef printf
-# define printf \
-    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
-                      "use gnulib module printf-posix for portable " \
-                      "POSIX compliance"), \
-     printf)
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define format(kind,m,n) format (__##kind##__, m, n)
-# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
-# define ____printf____ __printf__
-# define ____scanf____ __scanf__
-# define ____strftime____ __strftime__
-# define ____strfmon____ __strfmon__
+#endif
+#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_printf
+#  undef printf
+# endif
+/* Assume printf is always declared.  */
+_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
+                 "use gnulib module printf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
@@ -445,10 +485,9 @@ extern int remove (const char *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef remove
-# define remove(n)                                         \
-   (GL_LINK_WARNING ("remove cannot handle directories on some platforms - " \
-                     "use gnulib module remove for more portability"), \
-    remove (n))
+/* Assume remove is always declared.  */
+_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
+                 "use gnulib module remove for more portability");
 #endif
 
 #if @GNULIB_RENAME@
@@ -460,10 +499,9 @@ extern int rename (const char *old_filename, const char *new_filename)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rename
-# define rename(o,n)                                       \
-   (GL_LINK_WARNING ("rename is buggy on some platforms - " \
-                     "use gnulib module rename for more portability"), \
-    rename (o, n))
+/* Assume rename is always declared.  */
+_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
+                 "use gnulib module rename for more portability");
 #endif
 
 #if @GNULIB_RENAMEAT@
@@ -477,10 +515,10 @@ extern int renameat (int fd1, char const *file1, int fd2, char const *file2)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef renameat
-# define renameat(d1,f1,d2,f2)             \
-    (GL_LINK_WARNING ("renameat is not portable - " \
-                      "use gnulib module renameat for portability"), \
-     renameat (d1, f1, d2, f2))
+# if HAVE_RAW_DECL_RENAMEAT
+_GL_WARN_ON_USE (renameat, "renameat is not portable - "
+                 "use gnulib module renameat for portability");
+# endif
 #endif
 
 #if @GNULIB_SNPRINTF@
@@ -494,12 +532,21 @@ extern int snprintf (char *str, size_t size, const char *format, ...)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef snprintf
-# define snprintf \
-    (GL_LINK_WARNING ("snprintf is unportable - " \
-                      "use gnulib module snprintf for portability"), \
-     snprintf)
+# if HAVE_RAW_DECL_SNPRINTF
+_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+                 "use gnulib module snprintf for portability");
+# endif
 #endif
 
+/* Some people would argue that sprintf should be handled like gets
+   (for example, OpenBSD issues a link warning for both functions),
+   since both can cause security holes due to buffer overruns.
+   However, we believe that sprintf can be used safely, and is more
+   efficient than snprintf in those safe cases; and as proof of our
+   belief, we use sprintf in several gnulib modules.  So this header
+   intentionally avoids adding a warning to sprintf except when
+   GNULIB_POSIXCHECK is defined.  */
+
 #if @GNULIB_SPRINTF_POSIX@
 # if @REPLACE_SPRINTF@
 #  define sprintf rpl_sprintf
@@ -509,11 +556,10 @@ extern int sprintf (char *str, const char *format, ...)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sprintf
-# define sprintf \
-    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
-                      "use gnulib module sprintf-posix for portable " \
-                      "POSIX compliance"), \
-     sprintf)
+/* Assume sprintf is always declared.  */
+_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
+                 "use gnulib module sprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VASPRINTF@
@@ -543,50 +589,49 @@ extern int vdprintf (int fd, const char *format, va_list args)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vdprintf
-# define vdprintf(d,f,a) \
-    (GL_LINK_WARNING ("vdprintf is unportable - " \
-                      "use gnulib module vdprintf for portability"), \
-     vdprintf (d, f, a))
+# if HAVE_RAW_DECL_VDPRINTF
+_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
+                 "use gnulib module vdprintf for portability");
+# endif
 #endif
 
-#if @GNULIB_VFPRINTF_POSIX@
-# if @REPLACE_VFPRINTF@
+#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
+# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
+     || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
 #  define vfprintf rpl_vfprintf
+#  define GNULIB_overrides_vfprintf 1
 extern int vfprintf (FILE *fp, const char *format, va_list args)
        __attribute__ ((__format__ (__printf__, 2, 0)))
        _GL_ARG_NONNULL ((1, 2));
 # endif
-#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# define vfprintf rpl_vfprintf
-extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)))
-       _GL_ARG_NONNULL ((1, 2));
-#elif defined GNULIB_POSIXCHECK
-# undef vfprintf
-# define vfprintf(s,f,a) \
-    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
-                      "use gnulib module vfprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vfprintf (s, f, a))
+#endif
+#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_vfprintf
+#  undef vfprintf
+# endif
+/* Assume vfprintf is always declared.  */
+_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
+                 "use gnulib module vfprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
-#if @GNULIB_VPRINTF_POSIX@
-# if @REPLACE_VPRINTF@
+#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
+# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
+     || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
 #  define vprintf rpl_vprintf
+#  define GNULIB_overrides_vprintf 1
 extern int vprintf (const char *format, va_list args)
        __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
 # endif
-#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# define vprintf rpl_vprintf
-extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
-#elif defined GNULIB_POSIXCHECK
-# undef vprintf
-# define vprintf(f,a) \
-    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
-                      "use gnulib module vprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vprintf (f, a))
+#endif
+#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_vprintf
+#  undef vprintf
+# endif
+/* Assume vprintf is always declared.  */
+_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
+                 "use gnulib module vprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VSNPRINTF@
@@ -600,10 +645,10 @@ extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsnprintf
-# define vsnprintf(b,s,f,a) \
-    (GL_LINK_WARNING ("vsnprintf is unportable - " \
-                      "use gnulib module vsnprintf for portability"), \
-     vsnprintf (b, s, f, a))
+# if HAVE_RAW_DECL_VSNPRINTF
+_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
+                 "use gnulib module vsnprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_VSPRINTF_POSIX@
@@ -615,11 +660,10 @@ extern int vsprintf (char *str, const char *format, va_list args)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsprintf
-# define vsprintf(b,f,a) \
-    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
-                      "use gnulib module vsprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vsprintf (b, f, a))
+/* Assume vsprintf is always declared.  */
+_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
+                 "use gnulib module vsprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
 #ifdef __cplusplus
index 5f546ff..7f86496 100644 (file)
@@ -74,10 +74,10 @@ struct random_data
 # include <unistd.h>
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
 #ifndef EXIT_SUCCESS
@@ -105,10 +105,10 @@ extern long long atoll (const char *string) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef atoll
-# define atoll(s) \
-    (GL_LINK_WARNING ("atoll is unportable - " \
-                      "use gnulib module atoll for portability"), \
-     atoll (s))
+# if HAVE_RAW_DECL_ATOLL
+_GL_WARN_ON_USE (atoll, "atoll is unportable - "
+                 "use gnulib module atoll for portability");
+# endif
 #endif
 
 #if @GNULIB_CALLOC_POSIX@
@@ -119,10 +119,9 @@ extern void * calloc (size_t nmemb, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef calloc
-# define calloc(n,s) \
-    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
-                      "use gnulib module calloc-posix for portability"), \
-     calloc (n, s))
+/* Assume calloc is always declared.  */
+_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
+                 "use gnulib module calloc-posix for portability");
 #endif
 
 #if @GNULIB_CANONICALIZE_FILE_NAME@
@@ -134,10 +133,10 @@ extern char *canonicalize_file_name (const char *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef canonicalize_file_name
-# define canonicalize_file_name(n)                        \
-    (GL_LINK_WARNING ("canonicalize_file_name is unportable - " \
-                      "use gnulib module canonicalize-lgpl for portability"), \
-     canonicalize_file_name (n))
+# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
+_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - "
+                 "use gnulib module canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_GETLOADAVG@
@@ -150,10 +149,10 @@ extern int getloadavg (double loadavg[], int nelem) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getloadavg
-# define getloadavg(l,n) \
-    (GL_LINK_WARNING ("getloadavg is not portable - " \
-                      "use gnulib module getloadavg for portability"), \
-     getloadavg (l, n))
+# if HAVE_RAW_DECL_GETLOADAVG
+_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
+                 "use gnulib module getloadavg for portability");
+# endif
 #endif
 
 #if @GNULIB_GETSUBOPT@
@@ -174,10 +173,10 @@ extern int getsubopt (char **optionp, char *const *tokens, char **valuep)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getsubopt
-# define getsubopt(o,t,v) \
-    (GL_LINK_WARNING ("getsubopt is unportable - " \
-                      "use gnulib module getsubopt for portability"), \
-     getsubopt (o, t, v))
+# if HAVE_RAW_DECL_GETSUBOPT
+_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
+                 "use gnulib module getsubopt for portability");
+# endif
 #endif
 
 #if @GNULIB_MALLOC_POSIX@
@@ -188,10 +187,9 @@ extern void * malloc (size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef malloc
-# define malloc(s) \
-    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
-                      "use gnulib module malloc-posix for portability"), \
-     malloc (s))
+/* Assume malloc is always declared.  */
+_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
+                 "use gnulib module malloc-posix for portability");
 #endif
 
 #if @GNULIB_MKDTEMP@
@@ -205,10 +203,10 @@ extern char * mkdtemp (char * /*template*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdtemp
-# define mkdtemp(t) \
-    (GL_LINK_WARNING ("mkdtemp is unportable - " \
-                      "use gnulib module mkdtemp for portability"), \
-     mkdtemp (t))
+# if HAVE_RAW_DECL_MKDTEMP
+_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
+                 "use gnulib module mkdtemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMP@
@@ -229,10 +227,10 @@ extern int mkostemp (char * /*template*/, int /*flags*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemp
-# define mkostemp(t,f) \
-    (GL_LINK_WARNING ("mkostemp is unportable - " \
-                      "use gnulib module mkostemp for portability"), \
-     mkostemp (t, f))
+# if HAVE_RAW_DECL_MKOSTEMP
+_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
+                 "use gnulib module mkostemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMPS@
@@ -255,10 +253,10 @@ extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemps
-# define mkostemps(t,s,f)                          \
-    (GL_LINK_WARNING ("mkostemps is unportable - " \
-                      "use gnulib module mkostemps for portability"), \
-     mkostemps (t, s, f))
+# if HAVE_RAW_DECL_MKOSTEMPS
+_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
+                 "use gnulib module mkostemps for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMP@
@@ -277,10 +275,10 @@ extern int mkstemp (char * /*template*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemp
-# define mkstemp(t) \
-    (GL_LINK_WARNING ("mkstemp is unportable - " \
-                      "use gnulib module mkstemp for portability"), \
-     mkstemp (t))
+# if HAVE_RAW_DECL_MKSTEMP
+_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
+                 "use gnulib module mkstemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMPS@
@@ -300,10 +298,10 @@ extern int mkstemps (char * /*template*/, int /*suffixlen*/)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemps
-# define mkstemps(t,s)                             \
-    (GL_LINK_WARNING ("mkstemps is unportable - " \
-                      "use gnulib module mkstemps for portability"), \
-     mkstemps (t, s))
+# if HAVE_RAW_DECL_MKSTEMPS
+_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
+                 "use gnulib module mkstemps for portability");
+# endif
 #endif
 
 #if @GNULIB_PUTENV@
@@ -333,25 +331,25 @@ int random_r (struct random_data *buf, int32_t *result)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef random_r
-# define random_r(b,r)                            \
-    (GL_LINK_WARNING ("random_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     random_r (b,r))
+# if HAVE_RAW_DECL_RANDOM_R
+_GL_WARN_ON_USE (random_r, "random_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef initstate_r
-# define initstate_r(s,b,sz,r)                       \
-    (GL_LINK_WARNING ("initstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     initstate_r (s,b,sz,r))
+# if HAVE_RAW_DECL_INITSTATE_R
+_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef srandom_r
-# define srandom_r(s,r)                            \
-    (GL_LINK_WARNING ("srandom_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     srandom_r (s,r))
+# if HAVE_RAW_DECL_SRANDOM_R
+_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef setstate_r
-# define setstate_r(a,r)                                    \
-    (GL_LINK_WARNING ("setstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     setstate_r (a,r))
+# if HAVE_RAW_DECL_SETSTATE_R
+_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 #endif
 
 #if @GNULIB_REALLOC_POSIX@
@@ -362,10 +360,9 @@ extern void * realloc (void *ptr, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realloc
-# define realloc(p,s) \
-    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
-                      "use gnulib module realloc-posix for portability"), \
-     realloc (p, s))
+/* Assume realloc is always declared.  */
+_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
+                 "use gnulib module realloc-posix for portability");
 #endif
 
 #if @GNULIB_REALPATH@
@@ -377,10 +374,10 @@ extern char *realpath (const char *name, char *resolved) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realpath
-# define realpath(n,r)                        \
-    (GL_LINK_WARNING ("realpath is unportable - use gnulib module " \
-                      "canonicalize or canonicalize-lgpl for portability"), \
-     realpath (n, r))
+# if HAVE_RAW_DECL_REALPATH
+_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
+                 "canonicalize or canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_RPMATCH@
@@ -391,10 +388,10 @@ extern int rpmatch (const char *response) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rpmatch
-# define rpmatch(r) \
-    (GL_LINK_WARNING ("rpmatch is unportable - " \
-                      "use gnulib module rpmatch for portability"), \
-     rpmatch (r))
+# if HAVE_RAW_DECL_RPMATCH
+_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
+                 "use gnulib module rpmatch for portability");
+# endif
 #endif
 
 #if @GNULIB_SETENV@
@@ -410,10 +407,10 @@ extern int setenv (const char *name, const char *value, int replace)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef setenv
-# define setenv(n,v,o)                                                  \
-    (GL_LINK_WARNING ("setenv is unportable - "                         \
-                      "use gnulib module setenv for portability"),      \
-     setenv (n, v, o))
+# if HAVE_RAW_DECL_SETENV
+_GL_WARN_ON_USE (setenv, "setenv is unportable - "
+                 "use gnulib module setenv for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOD@
@@ -426,10 +423,10 @@ extern double strtod (const char *str, char **endp) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtod
-# define strtod(s, e)                           \
-    (GL_LINK_WARNING ("strtod is unportable - " \
-                      "use gnulib module strtod for portability"), \
-     strtod (s, e))
+# if HAVE_RAW_DECL_STRTOD
+_GL_WARN_ON_USE (strtod, "strtod is unportable - "
+                 "use gnulib module strtod for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOLL@
@@ -447,10 +444,10 @@ extern long long strtoll (const char *string, char **endptr, int base)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoll
-# define strtoll(s,e,b) \
-    (GL_LINK_WARNING ("strtoll is unportable - " \
-                      "use gnulib module strtoll for portability"), \
-     strtoll (s, e, b))
+# if HAVE_RAW_DECL_STRTOLL
+_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
+                 "use gnulib module strtoll for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOULL@
@@ -468,10 +465,10 @@ extern unsigned long long strtoull (const char *string, char **endptr, int base)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoull
-# define strtoull(s,e,b) \
-    (GL_LINK_WARNING ("strtoull is unportable - " \
-                      "use gnulib module strtoull for portability"), \
-     strtoull (s, e, b))
+# if HAVE_RAW_DECL_STRTOULL
+_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
+                 "use gnulib module strtoull for portability");
+# endif
 #endif
 
 #if @GNULIB_UNSETENV@
@@ -485,10 +482,10 @@ extern int unsetenv (const char *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unsetenv
-# define unsetenv(n)                                                    \
-    (GL_LINK_WARNING ("unsetenv is unportable - "                       \
-                      "use gnulib module unsetenv for portability"),    \
-     unsetenv (n))
+# if HAVE_RAW_DECL_UNSETENV
+_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
+                 "use gnulib module unsetenv for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
index 25d1f05..35bae57 100644 (file)
@@ -233,8 +233,7 @@ str_cd_iconv (const char *src, iconv_t cd)
     (result != NULL ? realloc (result, length + 1) : malloc (length + 1));
   if (final_result == NULL)
     {
-      if (result != NULL)
-        free (result);
+      free (result);
       errno = ENOMEM;
       return NULL;
     }
index cffe372..8749f73 100644 (file)
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -67,10 +67,9 @@ extern void *memchr (void const *__s, int __c, size_t __n)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memchr
-# define memchr(s,c,n) \
-    (GL_LINK_WARNING ("memchr has platform-specific bugs - " \
-                      "use gnulib module memchr for portability" ), \
-     memchr (s, c, n))
+/* Assume memchr is always declared.  */
+_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
+                 "use gnulib module memchr for portability" );
 #endif
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
@@ -85,11 +84,11 @@ extern void *memmem (void const *__haystack, size_t __haystack_len,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memmem
-# define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
-                      "use gnulib module memmem-simple for portability, " \
-                      "and module memmem for speed" ), \
-     memmem (a, al, b, bl))
+# if HAVE_RAW_DECL_MEMMEM
+_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
+                 "use gnulib module memmem-simple for portability, "
+                 "and module memmem for speed" );
+# endif
 #endif
 
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
@@ -102,10 +101,10 @@ extern void *mempcpy (void *restrict __dest, void const *restrict __src,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
-# define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - " \
-                      "use gnulib module mempcpy for portability"), \
-     mempcpy (a, b, n))
+# if HAVE_RAW_DECL_MEMPCPY
+_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
+                 "use gnulib module mempcpy for portability");
+# endif
 #endif
 
 /* Search backwards through a block for a byte (specified as an int).  */
@@ -116,10 +115,10 @@ extern void *memrchr (void const *, int, size_t)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memrchr
-# define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - " \
-                      "use gnulib module memrchr for portability"), \
-     memrchr (a, b, c))
+# if HAVE_RAW_DECL_MEMRCHR
+_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
+                 "use gnulib module memrchr for portability");
+# endif
 #endif
 
 /* Find the first occurrence of C in S.  More efficient than
@@ -132,10 +131,10 @@ extern void *rawmemchr (void const *__s, int __c_in)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rawmemchr
-# define rawmemchr(a,b) \
-    (GL_LINK_WARNING ("rawmemchr is unportable - " \
-                      "use gnulib module rawmemchr for portability"), \
-     rawmemchr (a, b))
+# if HAVE_RAW_DECL_RAWMEMCHR
+_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
+                 "use gnulib module rawmemchr for portability");
+# endif
 #endif
 
 /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
@@ -146,10 +145,10 @@ extern char *stpcpy (char *restrict __dst, char const *restrict __src)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
-# define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - " \
-                      "use gnulib module stpcpy for portability"), \
-     stpcpy (a, b))
+# if HAVE_RAW_DECL_STPCPY
+_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
+                 "use gnulib module stpcpy for portability");
+# endif
 #endif
 
 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
@@ -163,21 +162,20 @@ extern char *stpncpy (char *restrict __dst, char const *restrict __src,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpncpy
-# define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - " \
-                      "use gnulib module stpncpy for portability"), \
-     stpncpy (a, b, n))
+# if HAVE_RAW_DECL_STPNCPY
+_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
+                 "use gnulib module stpncpy for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strchr
-# define strchr(s,c) \
-    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbschr if you care about internationalization"), \
-     strchr (s, c))
+/* Assume strchr is always declared.  */
+_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbschr if you care about internationalization");
 #endif
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
@@ -188,10 +186,10 @@ extern char *strchrnul (char const *__s, int __c_in)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strchrnul
-# define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - " \
-                      "use gnulib module strchrnul for portability"), \
-     strchrnul (a, b))
+# if HAVE_RAW_DECL_STRCHRNUL
+_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
+                 "use gnulib module strchrnul for portability");
+# endif
 #endif
 
 /* Duplicate S, returning an identical malloc'd string.  */
@@ -205,10 +203,10 @@ extern char *strdup (char const *__s) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strdup
-# define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - " \
-                      "use gnulib module strdup for portability"), \
-     strdup (a))
+# if HAVE_RAW_DECL_STRDUP
+_GL_WARN_ON_USE (strdup, "strdup is unportable - "
+                 "use gnulib module strdup for portability");
+# endif
 #endif
 
 /* Return a newly allocated copy of at most N bytes of STRING.  */
@@ -222,10 +220,10 @@ extern char *strndup (char const *__string, size_t __n) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strndup
-# define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - " \
-                      "use gnulib module strndup for portability"), \
-     strndup (a, n))
+# if HAVE_RAW_DECL_STRNDUP
+_GL_WARN_ON_USE (strndup, "strndup is unportable - "
+                 "use gnulib module strndup for portability");
+# endif
 #endif
 
 /* Find the length (number of bytes) of STRING, but scan at most
@@ -238,10 +236,10 @@ extern size_t strnlen (char const *__string, size_t __maxlen)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strnlen
-# define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - " \
-                      "use gnulib module strnlen for portability"), \
-     strnlen (a, n))
+# if HAVE_RAW_DECL_STRNLEN
+_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
+                 "use gnulib module strnlen for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
@@ -250,11 +248,10 @@ extern size_t strnlen (char const *__string, size_t __maxlen)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 # undef strcspn
-# define strcspn(s,a) \
-    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscspn if you care about internationalization"), \
-     strcspn (s, a))
+/* Assume strcspn is always declared.  */
+_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbscspn if you care about internationalization");
 #endif
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
@@ -269,40 +266,36 @@ extern char *strpbrk (char const *__s, char const *__accept)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 #  undef strpbrk
-#  define strpbrk(s,a) \
-     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbspbrk if you care about internationalization"), \
-      strpbrk (s, a))
+_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbspbrk if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strpbrk
-# define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - " \
-                      "use gnulib module strpbrk for portability"), \
-     strpbrk (s, a))
+# if HAVE_RAW_DECL_STRPBRK
+_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
+                 "use gnulib module strpbrk for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strspn() assumes the second argument is a list of single-byte characters.
    Even in this simple case, it cannot work with multibyte strings.  */
 # undef strspn
-# define strspn(s,a) \
-    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbsspn if you care about internationalization"), \
-     strspn (s, a))
+/* Assume strspn is always declared.  */
+_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbsspn if you care about internationalization");
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strrchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strrchr
-# define strrchr(s,c) \
-    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbsrchr if you care about internationalization"), \
-     strrchr (s, c))
+/* Assume strrchr is always declared.  */
+_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbsrchr if you care about internationalization");
 #endif
 
 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
@@ -328,18 +321,16 @@ extern char *strsep (char **restrict __stringp, char const *restrict __delim)
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef strsep
-#  define strsep(s,d) \
-     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbssep if you care about internationalization"), \
-      strsep (s, d))
+_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbssep if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsep
-# define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - " \
-                      "use gnulib module strsep for portability"), \
-     strsep (s, d))
+# if HAVE_RAW_DECL_STRSEP
+_GL_WARN_ON_USE (strsep, "strsep is unportable - "
+                 "use gnulib module strsep for portability");
+# endif
 #endif
 
 #if @GNULIB_STRSTR@
@@ -354,13 +345,12 @@ extern char *strstr (const char *haystack, const char *needle)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strstr
-# define strstr(a,b) \
-    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
-                      "work correctly on character strings in most "    \
-                      "multibyte locales - " \
-                      "use mbsstr if you care about internationalization, " \
-                      "or use strstr if you care about speed"), \
-     strstr (a, b))
+/* Assume strstr is always declared.  */
+_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
+                 "work correctly on character strings in most "
+                 "multibyte locales - "
+                 "use mbsstr if you care about internationalization, "
+                 "or use strstr if you care about speed");
 #endif
 
 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
@@ -378,13 +368,13 @@ extern char *strcasestr (const char *haystack, const char *needle)
    It is a glibc extension, and glibc implements it only for unibyte
    locales.  */
 # undef strcasestr
-# define strcasestr(a,b) \
-    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasestr if you care about " \
-                      "internationalization, or use c-strcasestr if you want " \
-                      "a locale independent function"), \
-     strcasestr (a, b))
+# if HAVE_RAW_DECL_STRCASESTR
+_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasestr if you care about "
+                 "internationalization, or use c-strcasestr if you want "
+                 "a locale independent function");
+# endif
 #endif
 
 /* Parse S into tokens separated by characters in DELIM.
@@ -413,7 +403,7 @@ extern char *strcasestr (const char *haystack, const char *needle)
 # if @REPLACE_STRTOK_R@
 #  undef strtok_r
 #  define strtok_r rpl_strtok_r
-# elif @UNDEFINE_STRTOK_R@
+# elif @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
 #  undef strtok_r
 # endif
 # if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@
@@ -422,19 +412,16 @@ extern char *strtok_r (char *restrict s, char const *restrict delim,
      _GL_ARG_NONNULL ((2, 3));
 # endif
 # if defined GNULIB_POSIXCHECK
-#  undef strtok_r
-#  define strtok_r(s,d,p) \
-     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbstok_r if you care about internationalization"), \
-      strtok_r (s, d, p))
+_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbstok_r if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtok_r
-# define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - " \
-                      "use gnulib module strtok_r for portability"), \
-     strtok_r (s, d, p))
+# if HAVE_RAW_DECL_STRTOK_R
+_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
+                 "use gnulib module strtok_r for portability");
+# endif
 #endif
 
 
@@ -614,10 +601,9 @@ extern char *strerror (int);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerror
-# define strerror(e) \
-    (GL_LINK_WARNING ("strerror is unportable - " \
-                      "use gnulib module strerror to guarantee non-NULL result"), \
-     strerror (e))
+/* Assume strerror is always declared.  */
+_GL_WARN_ON_USE (strerror, "strerror is unportable - "
+                 "use gnulib module strerror to guarantee non-NULL result");
 #endif
 
 #if @GNULIB_STRSIGNAL@
@@ -629,10 +615,10 @@ extern char *strsignal (int __sig);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsignal
-# define strsignal(a) \
-    (GL_LINK_WARNING ("strsignal is unportable - " \
-                      "use gnulib module strsignal for portability"), \
-     strsignal (a))
+# if HAVE_RAW_DECL_STRSIGNAL
+_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
+                 "use gnulib module strsignal for portability");
+# endif
 #endif
 
 #if @GNULIB_STRVERSCMP@
@@ -641,10 +627,10 @@ extern int strverscmp (const char *, const char *) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strverscmp
-# define strverscmp(a, b) \
-    (GL_LINK_WARNING ("strverscmp is unportable - " \
-                      "use gnulib module strverscmp for portability"), \
-     strverscmp (a, b))
+# if HAVE_RAW_DECL_STRVERSCMP
+_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
+                 "use gnulib module strverscmp for portability");
+# endif
 #endif
 
 
index 7a8601d..0931899 100644 (file)
 #define _GL_STRINGS_H
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -52,14 +51,14 @@ extern int strcasecmp (char const *s1, char const *s2)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.   */
 # undef strcasecmp
-# define strcasecmp(a,b) \
-    (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasecmp if you care about " \
-                      "internationalization, or use c_strcasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strcasecmp (a, b))
+# if HAVE_RAW_DECL_STRCASECMP
+_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasecmp if you care about "
+                 "internationalization, or use c_strcasecmp , "
+                 "gnulib module c-strcase) if you want a locale "
+                 "independent function");
+# endif
 #endif
 
 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
@@ -75,14 +74,14 @@ extern int strncasecmp (char const *s1, char const *s2, size_t n)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strncasecmp
-# define strncasecmp(a,b,n) \
-    (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
-                      "strings in multibyte locales - " \
-                      "use mbsncasecmp or mbspcasecmp if you care about " \
-                      "internationalization, or use c_strncasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strncasecmp (a, b, n))
+# if HAVE_RAW_DECL_STRNCASECMP
+_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbsncasecmp or mbspcasecmp if you care about "
+                 "internationalization, or use c_strncasecmp , "
+                 "gnulib module c-strcase) if you want a locale "
+                 "independent function");
+# endif
 #endif
 
 
index 58e0d6a..77a7ccb 100644 (file)
@@ -41,7 +41,7 @@
 # define LOCK_NB 4       /* Don't block when locking.  */
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #if @GNULIB_FLOCK@
 /* Apply or remove advisory locks on an open file.
@@ -51,10 +51,10 @@ extern int flock (int fd, int operation);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef flock
-# define flock(fd,op)                          \
-    (GL_LINK_WARNING ("flock is unportable - " \
-                      "use gnulib module flock for portability"), \
-     flock ((fd), (op)))
+# if HAVE_RAW_DECL_FLOCK
+_GL_WARN_ON_USE (flock, "flock is unportable - "
+                 "use gnulib module flock for portability");
+# endif
 #endif
 
 
index 7a87eea..05f28da 100644 (file)
@@ -36,7 +36,7 @@
 # include <unistd.h>
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Declare overridden functions.  */
@@ -57,10 +57,10 @@ extern int ioctl (int fd, int request, ... /* {void *,char *} arg */);
 # define ioctl ioctl_used_without_requesting_gnulib_module_ioctl
 #elif defined GNULIB_POSIXCHECK
 # undef ioctl
-# define ioctl \
-    (GL_LINK_WARNING ("ioctl does not portably work on sockets - " \
-                      "use gnulib module ioctl for portability"), \
-     ioctl)
+# if HAVE_RAW_DECL_IOCTL
+_GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - "
+                 "use gnulib module ioctl for portability");
+# endif
 #endif
 
 
index 11e20f4..b506e9f 100644 (file)
 #ifndef _GL_SYS_SELECT_H
 #define _GL_SYS_SELECT_H
 
-#if !@HAVE_SYS_SELECT_H@
+#if !@HAVE_SYS_SELECT_H@ || @REPLACE_SELECT@
 
 /* A platform that lacks <sys/select.h>.  */
 
 # include <sys/socket.h>
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 # ifdef __cplusplus
 extern "C" {
@@ -86,10 +86,10 @@ extern int rpl_select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
 #  define select select_used_without_requesting_gnulib_module_select
 # elif defined GNULIB_POSIXCHECK
 #  undef select
-#  define select(n,r,w,e,t) \
-     (GL_LINK_WARNING ("select is not always POSIX compliant - " \
-                       "use gnulib module select for portability"), \
-      select (n, r, w, e, t))
+#  if HAVE_RAW_DECL_SELECT
+_GL_WARN_ON_USE (select, "select is not always POSIX compliant - "
+                 "use gnulib module select for portability");
+#  endif
 # endif
 
 # ifdef __cplusplus
index 3a5ab98..5fbf83d 100644 (file)
@@ -126,7 +126,7 @@ struct sockaddr_storage
 #  define SHUT_RDWR SD_BOTH
 # endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 # if @HAVE_WINSOCK2_H@
 /* Include headers needed by the emulation code.  */
@@ -187,10 +187,10 @@ extern int rpl_socket (int, int, int protocol);
 #  define socket socket_used_without_requesting_gnulib_module_socket
 # elif defined GNULIB_POSIXCHECK
 #  undef socket
-#  define socket(d,t,p) \
-     (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
-                       "use gnulib module socket for portability"), \
-      socket (d, t, p))
+#  if HAVE_RAW_DECL_SOCKET
+_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
+                 "use gnulib module socket for portability");
+#  endif
 # endif
 
 # if @GNULIB_CONNECT@
@@ -204,10 +204,10 @@ extern int rpl_connect (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
 #  define connect socket_used_without_requesting_gnulib_module_connect
 # elif defined GNULIB_POSIXCHECK
 #  undef connect
-#  define connect(s,a,l) \
-     (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
-                       "use gnulib module connect for portability"), \
-      connect (s, a, l))
+#  if HAVE_RAW_DECL_CONNECT
+_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
+                 "use gnulib module connect for portability");
+#  endif
 # endif
 
 # if @GNULIB_ACCEPT@
@@ -221,10 +221,10 @@ extern int rpl_accept (int, struct sockaddr *, int *);
 #  define accept accept_used_without_requesting_gnulib_module_accept
 # elif defined GNULIB_POSIXCHECK
 #  undef accept
-#  define accept(s,a,l) \
-     (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
-                       "use gnulib module accept for portability"), \
-      accept (s, a, l))
+# if HAVE_RAW_DECL_ACCEPT
+_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
+                 "use gnulib module accept for portability");
+#  endif
 # endif
 
 # if @GNULIB_BIND@
@@ -238,10 +238,10 @@ extern int rpl_bind (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
 #  define bind bind_used_without_requesting_gnulib_module_bind
 # elif defined GNULIB_POSIXCHECK
 #  undef bind
-#  define bind(s,a,l) \
-     (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
-                       "use gnulib module bind for portability"), \
-      bind (s, a, l))
+#  if HAVE_RAW_DECL_BIND
+_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
+                 "use gnulib module bind for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETPEERNAME@
@@ -256,10 +256,10 @@ extern int rpl_getpeername (int, struct sockaddr *, int *)
 #  define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
 # elif defined GNULIB_POSIXCHECK
 #  undef getpeername
-#  define getpeername(s,a,l) \
-     (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
-                       "use gnulib module getpeername for portability"), \
-      getpeername (s, a, l))
+#  if HAVE_RAW_DECL_GETPEERNAME
+_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
+                 "use gnulib module getpeername for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETSOCKNAME@
@@ -274,10 +274,10 @@ extern int rpl_getsockname (int, struct sockaddr *, int *)
 #  define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockname
-#  define getsockname(s,a,l) \
-     (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
-                       "use gnulib module getsockname for portability"), \
-      getsockname (s, a, l))
+#  if HAVE_RAW_DECL_GETSOCKNAME
+_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
+                 "use gnulib module getsockname for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETSOCKOPT@
@@ -292,10 +292,10 @@ extern int rpl_getsockopt (int, int, int, void *, socklen_t *)
 #  define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockopt
-#  define getsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
-                       "use gnulib module getsockopt for portability"), \
-      getsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_GETSOCKOPT
+_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
+                 "use gnulib module getsockopt for portability");
+#  endif
 # endif
 
 # if @GNULIB_LISTEN@
@@ -309,10 +309,10 @@ extern int rpl_listen (int, int);
 #  define listen listen_used_without_requesting_gnulib_module_listen
 # elif defined GNULIB_POSIXCHECK
 #  undef listen
-#  define listen(s,b) \
-     (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
-                       "use gnulib module listen for portability"), \
-      listen (s, b))
+#  if HAVE_RAW_DECL_LISTEN
+_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
+                 "use gnulib module listen for portability");
+#  endif
 # endif
 
 # if @GNULIB_RECV@
@@ -326,10 +326,10 @@ extern int rpl_recv (int, void *, int, int) _GL_ARG_NONNULL ((2));
 #  define recv recv_used_without_requesting_gnulib_module_recv
 # elif defined GNULIB_POSIXCHECK
 #  undef recv
-#  define recv(s,b,n,f) \
-     (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
-                       "use gnulib module recv for portability"), \
-      recv (s, b, n, f))
+#  if HAVE_RAW_DECL_RECV
+_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
+                 "use gnulib module recv for portability");
+#  endif
 # endif
 
 # if @GNULIB_SEND@
@@ -343,10 +343,10 @@ extern int rpl_send (int, const void *, int, int) _GL_ARG_NONNULL ((2));
 #  define send send_used_without_requesting_gnulib_module_send
 # elif defined GNULIB_POSIXCHECK
 #  undef send
-#  define send(s,b,n,f) \
-     (GL_LINK_WARNING ("send is not always POSIX compliant - " \
-                       "use gnulib module send for portability"), \
-      send (s, b, n, f))
+#  if HAVE_RAW_DECL_SEND
+_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
+                 "use gnulib module send for portability");
+#  endif
 # endif
 
 # if @GNULIB_RECVFROM@
@@ -361,10 +361,10 @@ extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *)
 #  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
 # elif defined GNULIB_POSIXCHECK
 #  undef recvfrom
-#  define recvfrom(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
-                       "use gnulib module recvfrom for portability"), \
-      recvfrom (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_RECVFROM
+_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
+                 "use gnulib module recvfrom for portability");
+#  endif
 # endif
 
 # if @GNULIB_SENDTO@
@@ -379,10 +379,10 @@ extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int)
 #  define sendto sendto_used_without_requesting_gnulib_module_sendto
 # elif defined GNULIB_POSIXCHECK
 #  undef sendto
-#  define sendto(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
-                       "use gnulib module sendto for portability"), \
-      sendto (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_SENDTO
+_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
+                 "use gnulib module sendto for portability");
+#  endif
 # endif
 
 # if @GNULIB_SETSOCKOPT@
@@ -397,10 +397,10 @@ extern int rpl_setsockopt (int, int, int, const void *, socklen_t)
 #  define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef setsockopt
-#  define setsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
-                       "use gnulib module setsockopt for portability"), \
-      setsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_SETSOCKOPT
+_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
+                 "use gnulib module setsockopt for portability");
+#  endif
 # endif
 
 # if @GNULIB_SHUTDOWN@
@@ -414,10 +414,10 @@ extern int rpl_shutdown (int, int);
 #  define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
 # elif defined GNULIB_POSIXCHECK
 #  undef shutdown
-#  define shutdown(s,h) \
-     (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \
-                       "use gnulib module shutdown for portability"), \
-      shutdown (s, h))
+#  if HAVE_RAW_DECL_SHUTDOWN
+_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
+                 "use gnulib module shutdown for portability");
+#  endif
 # endif
 
 # if @HAVE_WINSOCK2_H@
@@ -448,10 +448,10 @@ extern int accept4 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
                     int flags);
 #elif defined GNULIB_POSIXCHECK
 # undef accept4
-# define accept4(s,a,l,f) \
-    (GL_LINK_WARNING ("accept4 is unportable - " \
-                      "use gnulib module accept4 for portability"), \
-     accept4 (s, a, l, f))
+# if HAVE_RAW_DECL_ACCEPT4
+_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
+                 "use gnulib module accept4 for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
index 7b6495e..d79ba2b 100644 (file)
 #ifndef _GL_SYS_STAT_H
 #define _GL_SYS_STAT_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
    headers that may declare mkdir().  */
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
@@ -302,10 +302,10 @@ extern int fchmodat (int fd, char const *file, mode_t mode, int flag)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchmodat
-# define fchmodat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("fchmodat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchmodat (d, n, m, f))
+# if HAVE_RAW_DECL_FCHMODAT
+_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -326,10 +326,10 @@ extern int fstatat (int fd, char const *name, struct stat *st, int flags)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fstatat
-# define fstatat(d,n,s,f)                         \
-    (GL_LINK_WARNING ("fstatat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fstatat (d, n, s, f))
+# if HAVE_RAW_DECL_FSTATAT
+_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -343,10 +343,10 @@ extern int futimens (int fd, struct timespec const times[2]);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef futimens
-# define futimens(f,t)                         \
-    (GL_LINK_WARNING ("futimens is not portable - " \
-                      "use gnulib module futimens for portability"), \
-     futimens (f, t))
+# if HAVE_RAW_DECL_FUTIMENS
+_GL_WARN_ON_USE (futimens, "futimens is not portable - "
+                 "use gnulib module futimens for portability");
+# endif
 #endif
 
 
@@ -368,10 +368,10 @@ extern int lchmod (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchmod
-# define lchmod(f,m) \
-    (GL_LINK_WARNING ("lchmod is unportable - " \
-                      "use gnulib module lchmod for portability"), \
-     lchmod (f, m))
+# if HAVE_RAW_DECL_LCHMOD
+_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
+                 "use gnulib module lchmod for portability");
+# endif
 #endif
 
 
@@ -388,10 +388,10 @@ extern int rpl_lstat (const char *name, struct stat *buf)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lstat
-# define lstat(p,b)                                                     \
-  (GL_LINK_WARNING ("lstat is unportable - "                            \
-                    "use gnulib module lstat for portability"),         \
-   lstat (p, b))
+# if HAVE_RAW_DECL_LSTAT
+_GL_WARN_ON_USE (lstat, "lstat is unportable - "
+                 "use gnulib module lstat for portability");
+# endif
 #endif
 
 
@@ -423,10 +423,10 @@ extern int mkdirat (int fd, char const *file, mode_t mode)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdirat
-# define mkdirat(d,n,m)                         \
-    (GL_LINK_WARNING ("mkdirat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     mkdirat (d, n, m))
+# if HAVE_RAW_DECL_MKDIRAT
+_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -440,10 +440,10 @@ extern int mkfifo (char const *file, mode_t mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifo
-# define mkfifo(n,m)                                                    \
-    (GL_LINK_WARNING ("mkfifo is not portable - "                       \
-                      "use gnulib module mkfifo for portability"),      \
-     mkfifo (n, m))
+# if HAVE_RAW_DECL_MKFIFO
+_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
+                 "use gnulib module mkfifo for portability");
+# endif
 #endif
 
 
@@ -454,10 +454,10 @@ extern int mkfifoat (int fd, char const *file, mode_t mode)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifoat
-# define mkfifoat(d,n,m)                                     \
-    (GL_LINK_WARNING ("mkfifoat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mkfifoat (d, n, m))
+# if HAVE_RAW_DECL_MKFIFOAT
+_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -472,10 +472,10 @@ extern int mknod (char const *file, mode_t mode, dev_t dev)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknod
-# define mknod(n,m,d)                                                   \
-    (GL_LINK_WARNING ("mknod is not portable - "                        \
-                      "use gnulib module mknod for portability"),       \
-     mknod (n, m, d))
+# if HAVE_RAW_DECL_MKNOD
+_GL_WARN_ON_USE (mknod, "mknod is not portable - "
+                 "use gnulib module mknod for portability");
+# endif
 #endif
 
 
@@ -486,10 +486,10 @@ extern int mknodat (int fd, char const *file, mode_t mode, dev_t dev)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknodat
-# define mknodat(f,n,m,d)                            \
-    (GL_LINK_WARNING ("mknodat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mknodat (f, n, m, d))
+# if HAVE_RAW_DECL_MKNODAT
+_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -512,10 +512,10 @@ extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stat
-# define stat(p,b)                                                      \
-  (GL_LINK_WARNING ("stat is unportable - "                             \
-                    "use gnulib module stat for portability"),          \
-   stat (p, b))
+# if HAVE_RAW_DECL_STAT
+_GL_WARN_ON_USE (stat, "stat is unportable - "
+                 "use gnulib module stat for portability");
+# endif
 #endif
 
 
@@ -531,10 +531,10 @@ extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef utimensat
-# define utimensat(d,n,t,f)                          \
-    (GL_LINK_WARNING ("utimensat is not portable - " \
-                      "use gnulib module utimensat for portability"), \
-     utimensat (d, n, t, f))
+# if HAVE_RAW_DECL_UTIMENSAT
+_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
+                 "use gnulib module utimensat for portability");
+# endif
 #endif
 
 
index 442cae3..fe7f624 100644 (file)
@@ -41,6 +41,8 @@
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -53,11 +55,21 @@ struct timeval
 };
 # endif
 
-# if @REPLACE_GETTIMEOFDAY@
-#  undef gettimeofday
-#  define gettimeofday rpl_gettimeofday
+# if @GNULIB_GETTIMEOFDAY@
+#  if @REPLACE_GETTIMEOFDAY@
+#   undef gettimeofday
+#   define gettimeofday rpl_gettimeofday
+#  endif
+#  if @REPLACE_GETTIMEOFDAY@ || !@HAVE_GETTIMEOFDAY@
 extern int gettimeofday (struct timeval *restrict, void *restrict)
      _GL_ARG_NONNULL ((1));
+#  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef gettimeofday
+#  if HAVE_RAW_DECL_GETTIMEOFDAY
+_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
+                "use gnulib module gettimeofday for portability");
+#  endif
 # endif
 
 #ifdef __cplusplus
index 8ae132b..57f3a72 100644 (file)
 #  include <time.h>
 # endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 # ifdef __cplusplus
 extern "C" {
 # endif
@@ -64,10 +64,10 @@ extern "C" {
 #  endif
 # elif defined GNULIB_POSIXCHECK
 #  undef times
-#  define times(s)                                              \
-  (GL_LINK_WARNING ("times is unportable - "                    \
-                    "use gnulib module times for portability"), \
-   times (s))
+#  if HAVE_RAW_DECL_TIMES
+_GL_WARN_ON_USE (times, "times is unportable - "
+                 "use gnulib module times for portability");
+#  endif
 # endif
 
 # ifdef __cplusplus
index 3cd7aac..c0dabcc 100644 (file)
 
 #define _GL_SYS_UTSNAME_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -81,10 +81,10 @@ extern int uname (struct utsname *buf) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef uname
-# define uname(b) \
-    (GL_LINK_WARNING ("uname is unportable - " \
-                      "use gnulib module uname for portability"), \
-     uname (b))
+# if HAVE_RAW_DECL_UNAME
+_GL_WARN_ON_USE (uname, "uname is unportable - "
+                 "use gnulib module uname for portability");
+# endif
 #endif
 
 
index 51262f0..6a6dc6d 100644 (file)
  */
 
 #include "trigl.h"
-#ifdef HAVE_SINL
-#ifdef HAVE_COSL
-#include "trigl.c"
-#endif
-#endif
 
 /*
  * ====================================================
@@ -120,7 +115,7 @@ static const long double
   /* 1.000000000000000000000000000000000000000E0 */
 
 
-long double
+static long double
 kernel_tanl (long double x, long double y, int iy)
 {
   long double z, r, v, w, s, u, u1;
index 1a8a791..fbd4815 100644 (file)
@@ -1,5 +1,5 @@
 /* Quad-precision floating point argument reduction.
-   Copyright (C) 1999, 2007, 20092010 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2007, 2009-2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jj@ultra.linux.cz>
 
 #include <config.h>
 
 /* Specification.  */
-#include <math.h>
+#include "trigl.h"
 
 #include <float.h>
+#include <math.h>
 
 /* Table of constants for 2/pi, 5628 hexadecimal digits of 2/pi */
 static const int two_over_pi[] = {
index 61880c1..c70a16f 100644 (file)
 #define TRIM_BOTH 2
 
 /* Removes trailing and leading whitespaces. */
-#define trim(s) trim2((s), TRIM_BOTH)
+#define trim(s) trim2(s, TRIM_BOTH)
 
 /* Removes trailing whitespaces. */
-#define trim_trailing(s) trim2((s), TRIM_TRAILING)
+#define trim_trailing(s) trim2(s, TRIM_TRAILING)
 
 /* Removes leading whitespaces. */
-#define trim_leading(s) trim2((s), TRIM_LEADING)
+#define trim_leading(s) trim2(s, TRIM_LEADING)
 
 char *trim2(const char *, int);
-
index 3e22d8d..f3cf9ad 100644 (file)
 # endif
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* OS/2 EMX lacks these macros.  */
 #ifndef STDIN_FILENO
@@ -146,6 +146,13 @@ extern "C" {
 #endif
 
 
+#if defined GNULIB_POSIXCHECK
+/* The access() function is a security risk.  */
+_GL_WARN_ON_USE (access, "the access function is a security risk - "
+                 "use the gnulib module faccessat instead");
+#endif
+
+
 #if @GNULIB_CHOWN@
 # if @REPLACE_CHOWN@
 #  undef chown
@@ -162,11 +169,11 @@ extern int chown (const char *file, uid_t uid, gid_t gid)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef chown
-# define chown(f,u,g) \
-    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
-                      "doesn't treat a uid or gid of -1 on some systems - " \
-                      "use gnulib module chown for portability"), \
-     chown (f, u, g))
+# if HAVE_RAW_DECL_CHOWN
+_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
+                 "doesn't treat a uid or gid of -1 on some systems - "
+                 "use gnulib module chown for portability");
+# endif
 #endif
 
 
@@ -182,10 +189,9 @@ extern int close (int);
 # define close close_used_without_requesting_gnulib_module_close
 #elif defined GNULIB_POSIXCHECK
 # undef close
-# define close(f) \
-    (GL_LINK_WARNING ("close does not portably work on sockets - " \
-                      "use gnulib module close for portability"), \
-     close (f))
+/* Assume close is always declared.  */
+_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
+                 "use gnulib module close for portability");
 #endif
 
 
@@ -209,10 +215,10 @@ extern int dup2 (int oldfd, int newfd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dup2
-# define dup2(o,n) \
-    (GL_LINK_WARNING ("dup2 is unportable - " \
-                      "use gnulib module dup2 for portability"), \
-     dup2 (o, n))
+# if HAVE_RAW_DECL_DUP2
+_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
+                 "use gnulib module dup2 for portability");
+# endif
 #endif
 
 
@@ -231,10 +237,10 @@ extern int dup2 (int oldfd, int newfd);
 extern int dup3 (int oldfd, int newfd, int flags);
 #elif defined GNULIB_POSIXCHECK
 # undef dup3
-# define dup3(o,n,f) \
-    (GL_LINK_WARNING ("dup3 is unportable - " \
-                      "use gnulib module dup3 for portability"), \
-     dup3 (o, n, f))
+# if HAVE_RAW_DECL_DUP3
+_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
+                 "use gnulib module dup3 for portability");
+# endif
 #endif
 
 
@@ -250,11 +256,17 @@ extern char **environ;
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef environ
-# define environ \
-    (GL_LINK_WARNING ("environ is unportable - " \
-                      "use gnulib module environ for portability"), \
-     environ)
+# if HAVE_RAW_DECL_ENVIRON
+static inline char ***
+rpl_environ (void)
+{
+  return &environ;
+}
+_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
+                 "use gnulib module environ for portability");
+#  undef environ
+#  define environ (*rpl_environ ())
+# endif
 #endif
 
 
@@ -264,12 +276,17 @@ extern char **environ;
    the current process.  */
 extern int euidaccess (const char *filename, int mode) _GL_ARG_NONNULL ((1));
 # endif
+# if defined GNULIB_POSIXCHECK
+/* Like access(), this function is a security risk.  */
+_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
+                 "use the gnulib module faccessat instead");
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef euidaccess
-# define euidaccess(f,m) \
-    (GL_LINK_WARNING ("euidaccess is unportable - " \
-                      "use gnulib module euidaccess for portability"), \
-     euidaccess (f, m))
+# if HAVE_RAW_DECL_EUIDACCESS
+_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
+                 "use gnulib module euidaccess for portability");
+# endif
 #endif
 
 
@@ -280,10 +297,10 @@ extern int faccessat (int fd, char const *file, int mode, int flag)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef faccessat
-# define faccessat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("faccessat is not portable - " \
-                      "use gnulib module faccessat for portability"), \
-     faccessat (d, n, m, f))
+# if HAVE_RAW_DECL_FACCESSAT
+_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
+                 "use gnulib module faccessat for portability");
+# endif
 #endif
 
 
@@ -306,10 +323,10 @@ extern const char *_gl_directory_name (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchdir
-# define fchdir(f) \
-    (GL_LINK_WARNING ("fchdir is unportable - " \
-                      "use gnulib module fchdir for portability"), \
-     fchdir (f))
+# if HAVE_RAW_DECL_FCHDIR
+_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
+                 "use gnulib module fchdir for portability");
+# endif
 #endif
 
 
@@ -324,10 +341,10 @@ extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int fla
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchownat
-# define fchownat(d,n,o,g,f)                        \
-    (GL_LINK_WARNING ("fchownat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchownat (d, n, o, g, f))
+# if HAVE_RAW_DECL_FCHOWNAT
+_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -341,10 +358,10 @@ extern int fsync (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fsync
-# define fsync(fd) \
-    (GL_LINK_WARNING ("fsync is unportable - " \
-                      "use gnulib module fsync for portability"), \
-     fsync (fd))
+# if HAVE_RAW_DECL_FSYNC
+_GL_WARN_ON_USE (fsync, "fsync is unportable - "
+                 "use gnulib module fsync for portability");
+# endif
 #endif
 
 
@@ -358,10 +375,10 @@ extern int ftruncate (int fd, off_t length);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ftruncate
-# define ftruncate(f,l) \
-    (GL_LINK_WARNING ("ftruncate is unportable - " \
-                      "use gnulib module ftruncate for portability"), \
-     ftruncate (f, l))
+# if HAVE_RAW_DECL_FTRUNCATE
+_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
+                 "use gnulib module ftruncate for portability");
+# endif
 #endif
 
 
@@ -382,10 +399,10 @@ extern char * getcwd (char *buf, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getcwd
-# define getcwd(b,s) \
-    (GL_LINK_WARNING ("getcwd is unportable - " \
-                      "use gnulib module getcwd for portability"), \
-     getcwd (b, s))
+# if HAVE_RAW_DECL_GETCWD
+_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
+                 "use gnulib module getcwd for portability");
+# endif
 #endif
 
 
@@ -405,10 +422,10 @@ extern int getdomainname(char *name, size_t len) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdomainname
-# define getdomainname(n,l) \
-    (GL_LINK_WARNING ("getdomainname is unportable - " \
-                      "use gnulib module getdomainname for portability"), \
-     getdomainname (n, l))
+# if HAVE_RAW_DECL_GETDOMAINNAME
+_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
+                 "use gnulib module getdomainname for portability");
+# endif
 #endif
 
 
@@ -420,10 +437,10 @@ extern int getdtablesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdtablesize
-# define getdtablesize() \
-    (GL_LINK_WARNING ("getdtablesize is unportable - " \
-                      "use gnulib module getdtablesize for portability"), \
-     getdtablesize ())
+# if HAVE_RAW_DECL_GETDTABLESIZE
+_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
+                 "use gnulib module getdtablesize for portability");
+# endif
 #endif
 
 
@@ -442,10 +459,10 @@ int getgroups (int n, gid_t *groups);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getgroups
-# define getgroups(n,g)                                                 \
-    (GL_LINK_WARNING ("getgroups is unportable - "                      \
-                      "use gnulib module getgroups for portability"),   \
-     getgroups (n, g))
+# if HAVE_RAW_DECL_GETGROUPS
+_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
+                 "use gnulib module getgroups for portability");
+# endif
 #endif
 
 
@@ -469,10 +486,33 @@ extern int gethostname(char *name, size_t len) _GL_ARG_NONNULL ((1));
 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
 #elif defined GNULIB_POSIXCHECK
 # undef gethostname
-# define gethostname(n,l) \
-    (GL_LINK_WARNING ("gethostname is unportable - " \
-                      "use gnulib module gethostname for portability"), \
-     gethostname (n, l))
+# if HAVE_RAW_DECL_GETHOSTNAME
+_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
+                 "use gnulib module gethostname for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETLOGIN@
+/* Returns the user's login name, or NULL if it cannot be found.  Upon error,
+   returns NULL with errno set.
+
+   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
+ */
+# if !@HAVE_GETLOGIN@
+extern char *getlogin (void);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getlogin
+# if HAVE_RAW_DECL_GETLOGIN
+_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
+                 "use gnulib module getlogin for portability");
+# endif
 #endif
 
 
@@ -496,10 +536,10 @@ extern int getlogin_r (char *name, size_t size) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin_r
-# define getlogin_r(n,s) \
-    (GL_LINK_WARNING ("getlogin_r is unportable - " \
-                      "use gnulib module getlogin_r for portability"), \
-     getlogin_r (n, s))
+# if HAVE_RAW_DECL_GETLOGIN_R
+_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
+                 "use gnulib module getlogin_r for portability");
+# endif
 #endif
 
 
@@ -554,10 +594,10 @@ extern int getpagesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getpagesize
-# define getpagesize() \
-    (GL_LINK_WARNING ("getpagesize is unportable - " \
-                      "use gnulib module getpagesize for portability"), \
-     getpagesize ())
+# if HAVE_RAW_DECL_GETPAGESIZE
+_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
+                 "use gnulib module getpagesize for portability");
+# endif
 #endif
 
 
@@ -574,20 +614,20 @@ extern void endusershell (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getusershell
-# define getusershell() \
-    (GL_LINK_WARNING ("getusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     getusershell ())
+# if HAVE_RAW_DECL_GETUSERSHELL
+_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef setusershell
-# define setusershell() \
-    (GL_LINK_WARNING ("setusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     setusershell ())
+# if HAVE_RAW_DECL_SETUSERSHELL
+_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef endusershell
-# define endusershell() \
-    (GL_LINK_WARNING ("endusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     endusershell ())
+# if HAVE_RAW_DECL_ENDUSERSHELL
+_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 #endif
 
 
@@ -607,10 +647,10 @@ extern int lchown (char const *file, uid_t owner, gid_t group)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchown
-# define lchown(f,u,g) \
-    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
-                      "systems - use gnulib module lchown for portability"), \
-     lchown (f, u, g))
+# if HAVE_RAW_DECL_LCHOWN
+_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
+                 "use gnulib module lchown for portability");
+# endif
 #endif
 
 
@@ -628,10 +668,10 @@ extern int link (const char *path1, const char *path2)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef link
-# define link(path1,path2) \
-    (GL_LINK_WARNING ("link is unportable - " \
-                      "use gnulib module link for portability"), \
-     link (path1, path2))
+# if HAVE_RAW_DECL_LINK
+_GL_WARN_ON_USE (link, "link is unportable - "
+                 "use gnulib module link for portability");
+# endif
 #endif
 
 #if @GNULIB_LINKAT@
@@ -649,10 +689,10 @@ extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef linkat
-# define linkat(f1,path1,f2,path2,f)              \
-    (GL_LINK_WARNING ("linkat is unportable - " \
-                      "use gnulib module linkat for portability"), \
-     linkat (f1, path1, f2, path2,f))
+# if HAVE_RAW_DECL_LINKAT
+_GL_WARN_ON_USE (linkat, "linkat is unportable - "
+                 "use gnulib module linkat for portability");
+# endif
 #endif
 
 #if @GNULIB_LSEEK@
@@ -666,10 +706,10 @@ extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lseek
-# define lseek(f,o,w) \
-    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
-                      "systems - use gnulib module lseek for portability"), \
-     lseek (f, o, w))
+# if HAVE_RAW_DECL_LSEEK
+_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
+                 "systems - use gnulib module lseek for portability");
+# endif
 #endif
 
 
@@ -688,10 +728,10 @@ extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
 extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef pipe2
-# define pipe2(f,o) \
-    (GL_LINK_WARNING ("pipe2 is unportable - " \
-                      "use gnulib module pipe2 for portability"), \
-     pipe2 (f, o))
+# if HAVE_RAW_DECL_PIPE2
+_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
+                 "use gnulib module pipe2 for portability");
+# endif
 #endif
 
 
@@ -709,10 +749,10 @@ extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef pread
-# define pread(f,b,s,o)                        \
-    (GL_LINK_WARNING ("pread is unportable - " \
-                      "use gnulib module pread for portability"), \
-     pread (f, b, s, o))
+# if HAVE_RAW_DECL_PREAD
+_GL_WARN_ON_USE (pread, "pread is unportable - "
+                 "use gnulib module pread for portability");
+# endif
 #endif
 
 
@@ -731,10 +771,10 @@ extern ssize_t readlink (const char *file, char *buf, size_t bufsize)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlink
-# define readlink(f,b,s) \
-    (GL_LINK_WARNING ("readlink is unportable - " \
-                      "use gnulib module readlink for portability"), \
-     readlink (f, b, s))
+# if HAVE_RAW_DECL_READLINK
+_GL_WARN_ON_USE (readlink, "readlink is unportable - "
+                 "use gnulib module readlink for portability");
+# endif
 #endif
 
 
@@ -745,10 +785,10 @@ extern ssize_t readlinkat (int fd, char const *file, char *buf, size_t len)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlinkat
-# define readlinkat(d,n,b,l)                         \
-    (GL_LINK_WARNING ("readlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     readlinkat (d, n, b, l))
+# if HAVE_RAW_DECL_READLINKAT
+_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -760,10 +800,10 @@ extern int rmdir (char const *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rmdir
-# define rmdir(n) \
-    (GL_LINK_WARNING ("rmdir is unportable - " \
-                      "use gnulib module rmdir for portability"), \
-     rmdir (n))
+# if HAVE_RAW_DECL_RMDIR
+_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
+                 "use gnulib module rmdir for portability");
+# endif
 #endif
 
 
@@ -781,10 +821,10 @@ extern unsigned int sleep (unsigned int n);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sleep
-# define sleep(n) \
-    (GL_LINK_WARNING ("sleep is unportable - " \
-                      "use gnulib module sleep for portability"), \
-     sleep (n))
+# if HAVE_RAW_DECL_SLEEP
+_GL_WARN_ON_USE (sleep, "sleep is unportable - "
+                 "use gnulib module sleep for portability");
+# endif
 #endif
 
 
@@ -799,10 +839,10 @@ extern int symlink (char const *contents, char const *file)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlink
-# define symlink(c,n)                        \
-    (GL_LINK_WARNING ("symlink is not portable - " \
-                      "use gnulib module symlink for portability"), \
-     symlink (c, n))
+# if HAVE_RAW_DECL_SYMLINK
+_GL_WARN_ON_USE (symlink, "symlink is not portable - "
+                 "use gnulib module symlink for portability");
+# endif
 #endif
 
 
@@ -813,10 +853,10 @@ extern int symlinkat (char const *contents, int fd, char const *file)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlinkat
-# define symlinkat(c,d,n)                            \
-    (GL_LINK_WARNING ("symlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     symlinkat (c, d, n))
+# if HAVE_RAW_DECL_SYMLINKAT
+_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -828,10 +868,10 @@ extern int unlink (char const *file) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlink
-# define unlink(n)                         \
-    (GL_LINK_WARNING ("unlink is not portable - " \
-                      "use gnulib module unlink for portability"), \
-     unlink (n))
+# if HAVE_RAW_DECL_UNLINK
+_GL_WARN_ON_USE (unlink, "unlink is not portable - "
+                 "use gnulib module unlink for portability");
+# endif
 #endif
 
 
@@ -845,10 +885,10 @@ extern int unlinkat (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlinkat
-# define unlinkat(d,n,f)                         \
-    (GL_LINK_WARNING ("unlinkat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     unlinkat (d, n, f))
+# if HAVE_RAW_DECL_UNLINKAT
+_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -866,10 +906,10 @@ extern int usleep (useconds_t n);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef usleep
-# define usleep(n) \
-    (GL_LINK_WARNING ("usleep is unportable - " \
-                      "use gnulib module usleep for portability"), \
-     usleep (n))
+# if HAVE_RAW_DECL_USLEEP
+_GL_WARN_ON_USE (usleep, "usleep is unportable - "
+                 "use gnulib module usleep for portability");
+# endif
 #endif
 
 
index 1cdf3a8..26a3e33 100644 (file)
@@ -529,8 +529,8 @@ extern uint16_t *
 extern uint32_t *
        u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n);
 
-/* Copy no more than N units of SRC to DEST, returning the address of
-   the last unit written into DEST.  */
+/* Copy no more than N units of SRC to DEST.  Return a pointer past the last
+   non-NUL unit written into DEST.  */
 /* Similar to stpncpy().  */
 extern uint8_t *
        u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n);
index 335a851..4d6dd3c 100644 (file)
@@ -23,8 +23,12 @@ FUNC (UNIT *dest, const UNIT *src, size_t n)
 
   /* This behavior is rarely useful, but it is here for consistency with
      strncpy and wcsncpy.  */
-  for (; n > 0; n--)
-    *dest++ = 0;
+  {
+    UNIT *destptr = dest;
 
-  return dest - 1;
+    for (; n > 0; n--)
+      *destptr++ = 0;
+  }
+
+  return dest;
 }
index e1dc713..9ec5c60 100644 (file)
@@ -41,6 +41,12 @@ FUNC (const UNIT *s1, const UNIT *s2)
               /* strcoll succeeded.  */
               free (sl1);
               free (sl2);
+              /* The conversion to locale encoding can do transliteration or
+                 map some characters to question marks.  Therefore sl1 and sl2
+                 may be equal when s1 and s2 were in fact different.  Return a
+                 nonzero result in this case.  */
+              if (result == 0)
+                result = U_STRCMP (s1, s2);
             }
           else
             {
index 1bc9969..601d81d 100644 (file)
@@ -28,12 +28,15 @@ u16_mbsnlen (const uint16_t *s, size_t n)
   characters = 0;
   while (n > 0)
     {
-      int count = u16_mblen (s, n);
+      ucs4_t uc;
+      int count = u16_mbtoucr (&uc, s, n);
+      characters++;
+      if (count == -2)
+        break;
       if (count <= 0)
         count = 1;
       s += count;
       n -= count;
-      characters++;
     }
   return characters;
 }
index 913bbf0..9ddc42e 100644 (file)
@@ -28,12 +28,15 @@ u8_mbsnlen (const uint8_t *s, size_t n)
   characters = 0;
   while (n > 0)
     {
-      int count = u8_mblen (s, n);
+      ucs4_t uc;
+      int count = u8_mbtoucr (&uc, s, n);
+      characters++;
+      if (count == -2)
+        break;
       if (count <= 0)
         count = 1;
       s += count;
       n -= count;
-      characters++;
     }
   return characters;
 }
index 81c36b3..63a0c9a 100644 (file)
@@ -39,7 +39,7 @@
 # define MAX(a, b) ((a) > (b) ? (a) : (b))
 #endif
 
-enum { BILLION = 1000 * 1000 * 1000 };
+#define BILLION (1000 * 1000 * 1000)
 
 /* Best possible resolution that utimens can set and stat can return,
    due to system-call limitations.  It must be a power of 10 that is
index 9240e5f..5e3d291 100644 (file)
 #include <stddef.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
index c0323fe..dd1e026 100644 (file)
@@ -30,9 +30,9 @@
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
+#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
 /* Special invocation convention:
-   - Inside uClibc header files.
+   - Inside glibc and uClibc header files.
    - On HP-UX 11.00 we have a sequence of nested includes
      <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
      once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -115,10 +115,10 @@ extern wint_t btowc (int c);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef btowc
-# define btowc(c) \
-    (GL_LINK_WARNING ("btowc is unportable - " \
-                      "use gnulib module btowc for portability"), \
-     btowc (c))
+# if HAVE_RAW_DECL_BTOWC
+_GL_WARN_ON_USE (btowc, "btowc is unportable - "
+                 "use gnulib module btowc for portability");
+# endif
 #endif
 
 
@@ -134,10 +134,10 @@ extern int wctob (wint_t wc);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctob
-# define wctob(w) \
-    (GL_LINK_WARNING ("wctob is unportable - " \
-                      "use gnulib module wctob for portability"), \
-     wctob (w))
+# if HAVE_RAW_DECL_WCTOB
+_GL_WARN_ON_USE (wctob, "wctob is unportable - "
+                 "use gnulib module wctob for portability");
+# endif
 #endif
 
 
@@ -152,10 +152,10 @@ extern int mbsinit (const mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsinit
-# define mbsinit(p) \
-    (GL_LINK_WARNING ("mbsinit is unportable - " \
-                      "use gnulib module mbsinit for portability"), \
-     mbsinit (p))
+# if HAVE_RAW_DECL_MBSINIT
+_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
+                 "use gnulib module mbsinit for portability");
+# endif
 #endif
 
 
@@ -170,10 +170,10 @@ extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtowc
-# define mbrtowc(w,s,n,p) \
-    (GL_LINK_WARNING ("mbrtowc is unportable - " \
-                      "use gnulib module mbrtowc for portability"), \
-     mbrtowc (w, s, n, p))
+# if HAVE_RAW_DECL_MBRTOWC
+_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
+                 "use gnulib module mbrtowc for portability");
+# endif
 #endif
 
 
@@ -188,10 +188,10 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrlen
-# define mbrlen(s,n,p) \
-    (GL_LINK_WARNING ("mbrlen is unportable - " \
-                      "use gnulib module mbrlen for portability"), \
-     mbrlen (s, n, p))
+# if HAVE_RAW_DECL_MBRLEN
+_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
+                 "use gnulib module mbrlen for portability");
+# endif
 #endif
 
 
@@ -207,10 +207,10 @@ extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
-# define mbsrtowcs(d,s,l,p) \
-    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
-                      "use gnulib module mbsrtowcs for portability"), \
-     mbsrtowcs (d, s, l, p))
+# if HAVE_RAW_DECL_MBSRTOWCS
+_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
+                 "use gnulib module mbsrtowcs for portability");
+# endif
 #endif
 
 
@@ -226,10 +226,10 @@ extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsnrtowcs
-# define mbsnrtowcs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
-                      "use gnulib module mbsnrtowcs for portability"), \
-     mbsnrtowcs (d, s, n, l, p))
+# if HAVE_RAW_DECL_MBSNRTOWCS
+_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
+                 "use gnulib module mbsnrtowcs for portability");
+# endif
 #endif
 
 
@@ -244,10 +244,10 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcrtomb
-# define wcrtomb(s,w,p) \
-    (GL_LINK_WARNING ("wcrtomb is unportable - " \
-                      "use gnulib module wcrtomb for portability"), \
-     wcrtomb (s, w, p))
+# if HAVE_RAW_DECL_WCRTOMB
+_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
+                 "use gnulib module wcrtomb for portability");
+# endif
 #endif
 
 
@@ -263,10 +263,10 @@ extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
-# define wcsrtombs(d,s,l,p) \
-    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
-                      "use gnulib module wcsrtombs for portability"), \
-     wcsrtombs (d, s, l, p))
+# if HAVE_RAW_DECL_WCSRTOMBS
+_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
+                 "use gnulib module wcsrtombs for portability");
+# endif
 #endif
 
 
@@ -282,10 +282,10 @@ extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
-# define wcsnrtombs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
-                      "use gnulib module wcsnrtombs for portability"), \
-     wcsnrtombs (d, s, n, l, p))
+# if HAVE_RAW_DECL_WCSNRTOMBS
+_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
+                 "use gnulib module wcsnrtombs for portability");
+# endif
 #endif
 
 
@@ -303,10 +303,10 @@ extern int wcwidth (int /* actually wchar_t */);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcwidth
-# define wcwidth(w) \
-    (GL_LINK_WARNING ("wcwidth is unportable - " \
-                      "use gnulib module wcwidth for portability"), \
-     wcwidth (w))
+# if HAVE_RAW_DECL_WCWIDTH
+_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
+                 "use gnulib module wcwidth for portability");
+# endif
 #endif
 
 
index d313d64..91ba55d 100644 (file)
 #include <stdio.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec)   /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
index 95475f0..3a94a9c 100644 (file)
@@ -46,6 +46,11 @@ _DECLARE_XSTRTOL (xstrtoul, unsigned long int)
 _DECLARE_XSTRTOL (xstrtoimax, intmax_t)
 _DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
 
+#if HAVE_LONG_LONG_INT
+_DECLARE_XSTRTOL (xstrtoll, long long int)
+_DECLARE_XSTRTOL (xstrtoull, unsigned long long int)
+#endif
+
 #ifndef __attribute__
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
 #  define __attribute__(x)
diff --git a/lib/xstrtoll.c b/lib/xstrtoll.c
new file mode 100644 (file)
index 0000000..344e5a4
--- /dev/null
@@ -0,0 +1,6 @@
+#define __strtol strtoll
+#define __strtol_t long long int
+#define __xstrtol xstrtoll
+#define STRTOL_T_MINIMUM LONG_LONG_MIN
+#define STRTOL_T_MAXIMUM LONG_LONG_MAX
+#include "xstrtol.c"
diff --git a/lib/xstrtoull.c b/lib/xstrtoull.c
new file mode 100644 (file)
index 0000000..2f2d83c
--- /dev/null
@@ -0,0 +1,6 @@
+#define __strtol strtoull
+#define __strtol_t unsigned long long int
+#define __xstrtol xstrtoull
+#define STRTOL_T_MINIMUM 0
+#define STRTOL_T_MAXIMUM ULONG_LONG_MAX
+#include "xstrtol.c"
index acea805..4f3b136 100644 (file)
 #include <stdarg.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
diff --git a/m4/acosl.m4 b/m4/acosl.m4
new file mode 100644 (file)
index 0000000..66cbd6c
--- /dev/null
@@ -0,0 +1,69 @@
+# acosl.m4 serial 2
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_ACOSL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare acosl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  ACOSL_LIBM=
+  AC_CACHE_CHECK([whether acosl() can be used without linking with libm],
+    [gl_cv_func_acosl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return acosl (x) > 1;],
+        [gl_cv_func_acosl_no_libm=yes],
+        [gl_cv_func_acosl_no_libm=no])
+    ])
+  if test $gl_cv_func_acosl_no_libm = no; then
+    AC_CACHE_CHECK([whether acosl() can be used with libm],
+      [gl_cv_func_acosl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return acosl (x) > 1;],
+          [gl_cv_func_acosl_in_libm=yes],
+          [gl_cv_func_acosl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_acosl_in_libm = yes; then
+      ACOSL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_acosl_no_libm = yes \
+     || test $gl_cv_func_acosl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has acosl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([acosl], , [HAVE_DECL_ACOSL=0], [#include <math.h>])
+  else
+    HAVE_DECL_ACOSL=0
+    HAVE_ACOSL=0
+    AC_LIBOBJ([acosl])
+    AC_REQUIRE([gl_FUNC_ASINL])
+    AC_REQUIRE([gl_FUNC_SQRTL])
+    dnl Append $ASINL_LIBM to ACOSL_LIBM, avoiding gratuitous duplicates.
+    case " $ACOSL_LIBM " in
+      *" $ASINL_LIBM "*) ;;
+      *) ACOSL_LIBM="$ACOSL_LIBM $ASINL_LIBM" ;;
+    esac
+    dnl Append $SQRTL_LIBM to ACOSL_LIBM, avoiding gratuitous duplicates.
+    case " $ACOSL_LIBM " in
+      *" $SQRTL_LIBM "*) ;;
+      *) ACOSL_LIBM="$ACOSL_LIBM $SQRTL_LIBM" ;;
+    esac
+  fi
+  AC_SUBST([ACOSL_LIBM])
+])
index 07b6871..4360dd8 100644 (file)
@@ -1,4 +1,4 @@
-# arpa_inet_h.m4 serial 6
+# arpa_inet_h.m4 serial 7
 dnl Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,6 +21,16 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
   AC_SUBST([HAVE_ARPA_INET_H])
   dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([arpa/inet.h])
+
+  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([[
+/* On some systems, this header is not self-consistent.  */
+#ifndef __GLIBC__
+# include <sys/socket.h>
+#endif
+#include <arpa/inet.h>
+    ]], [inet_ntop inet_pton])
 ])
 
 dnl Unconditionally enables the replacement of <arpa/inet.h>.
diff --git a/m4/asinl.m4 b/m4/asinl.m4
new file mode 100644 (file)
index 0000000..1f5bc6d
--- /dev/null
@@ -0,0 +1,63 @@
+# asinl.m4 serial 2
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_ASINL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare asinl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  ASINL_LIBM=
+  AC_CACHE_CHECK([whether asinl() can be used without linking with libm],
+    [gl_cv_func_asinl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return asinl (x) > 1;],
+        [gl_cv_func_asinl_no_libm=yes],
+        [gl_cv_func_asinl_no_libm=no])
+    ])
+  if test $gl_cv_func_asinl_no_libm = no; then
+    AC_CACHE_CHECK([whether asinl() can be used with libm],
+      [gl_cv_func_asinl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return asinl (x) > 1;],
+          [gl_cv_func_asinl_in_libm=yes],
+          [gl_cv_func_asinl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_asinl_in_libm = yes; then
+      ASINL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_asinl_no_libm = yes \
+     || test $gl_cv_func_asinl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has asinl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([asinl], , [HAVE_DECL_ASINL=0], [#include <math.h>])
+  else
+    HAVE_DECL_ASINL=0
+    HAVE_ASINL=0
+    AC_LIBOBJ([asinl])
+    AC_REQUIRE([gl_FUNC_SQRTL])
+    dnl Append $SQRTL_LIBM to ASINL_LIBM, avoiding gratuitous duplicates.
+    case " $ASINL_LIBM " in
+      *" $SQRTL_LIBM "*) ;;
+      *) ASINL_LIBM="$ASINL_LIBM $SQRTL_LIBM" ;;
+    esac
+  fi
+  AC_SUBST([ASINL_LIBM])
+])
diff --git a/m4/atanl.m4 b/m4/atanl.m4
new file mode 100644 (file)
index 0000000..28cf7b3
--- /dev/null
@@ -0,0 +1,63 @@
+# atanl.m4 serial 2
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_ATANL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare atanl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  ATANL_LIBM=
+  AC_CACHE_CHECK([whether atanl() can be used without linking with libm],
+    [gl_cv_func_atanl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return atanl (x) > 1;],
+        [gl_cv_func_atanl_no_libm=yes],
+        [gl_cv_func_atanl_no_libm=no])
+    ])
+  if test $gl_cv_func_atanl_no_libm = no; then
+    AC_CACHE_CHECK([whether atanl() can be used with libm],
+      [gl_cv_func_atanl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return atanl (x) > 1;],
+          [gl_cv_func_atanl_in_libm=yes],
+          [gl_cv_func_atanl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_atanl_in_libm = yes; then
+      ATANL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_atanl_no_libm = yes \
+     || test $gl_cv_func_atanl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has atanl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([atanl], , [HAVE_DECL_ATANL=0], [#include <math.h>])
+  else
+    HAVE_DECL_ATANL=0
+    HAVE_ATANL=0
+    AC_LIBOBJ([atanl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    dnl Append $ISNANL_LIBM to ATANL_LIBM, avoiding gratuitous duplicates.
+    case " $ATANL_LIBM " in
+      *" $ISNANL_LIBM "*) ;;
+      *) ATANL_LIBM="$ATANL_LIBM $ISNANL_LIBM" ;;
+    esac
+  fi
+  AC_SUBST([ATANL_LIBM])
+])
diff --git a/m4/cosl.m4 b/m4/cosl.m4
new file mode 100644 (file)
index 0000000..74c9e7c
--- /dev/null
@@ -0,0 +1,77 @@
+# cosl.m4 serial 2
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_COSL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare cosl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  COSL_LIBM=
+  AC_CACHE_CHECK([whether cosl() can be used without linking with libm],
+    [gl_cv_func_cosl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return cosl (x) > 0.4;],
+        [gl_cv_func_cosl_no_libm=yes],
+        [gl_cv_func_cosl_no_libm=no])
+    ])
+  if test $gl_cv_func_cosl_no_libm = no; then
+    AC_CACHE_CHECK([whether cosl() can be used with libm],
+      [gl_cv_func_cosl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return cosl (x) > 0.4;],
+          [gl_cv_func_cosl_in_libm=yes],
+          [gl_cv_func_cosl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_cosl_in_libm = yes; then
+      COSL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_cosl_no_libm = yes \
+     || test $gl_cv_func_cosl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has cosl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([cosl], , [HAVE_DECL_COSL=0], [#include <math.h>])
+  else
+    HAVE_DECL_COSL=0
+    HAVE_COSL=0
+    AC_LIBOBJ([cosl])
+    AC_LIBOBJ([sincosl])
+    AC_LIBOBJ([trigl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FLOOR])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    dnl Append $ISNANL_LIBM to COSL_LIBM, avoiding gratuitous duplicates.
+    case " $COSL_LIBM " in
+      *" $ISNANL_LIBM "*) ;;
+      *) COSL_LIBM="$COSL_LIBM $ISNANL_LIBM" ;;
+    esac
+    dnl Append $FLOOR_LIBM to COSL_LIBM, avoiding gratuitous duplicates.
+    case " $COSL_LIBM " in
+      *" $FLOOR_LIBM "*) ;;
+      *) COSL_LIBM="$COSL_LIBM $FLOOR_LIBM" ;;
+    esac
+    dnl Append $FLOORL_LIBM to COSL_LIBM, avoiding gratuitous duplicates.
+    case " $COSL_LIBM " in
+      *" $FLOORL_LIBM "*) ;;
+      *) COSL_LIBM="$COSL_LIBM $FLOORL_LIBM" ;;
+    esac
+  fi
+  AC_SUBST([COSL_LIBM])
+])
index f366113..c23b0e3 100644 (file)
@@ -1,4 +1,4 @@
-# ctype_h.m4 serial 2
+# ctype_h.m4 serial 3
 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,11 @@ AC_DEFUN([gl_CTYPE_H],
   dnl Execute this unconditionally, because CTYPE_H may be set by other
   dnl modules, after this code is executed.
   gl_CHECK_NEXT_HEADERS([ctype.h])
+
+  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 <ctype.h>
+    ]], [isblank])
 ])
 
 AC_DEFUN([gl_CTYPE_MODULE_INDICATOR],
index 6452dfe..1328ee3 100644 (file)
@@ -1,4 +1,4 @@
-# dirent_h.m4 serial 8
+# dirent_h.m4 serial 9
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,6 +14,11 @@ AC_DEFUN([gl_DIRENT_H],
 
   dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([dirent.h])
+
+  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 <dirent.h>
+    ]], [alphasort dirfd fdopendir scandir])
 ])
 
 dnl Unconditionally enables the replacement of <dirent.h>.
diff --git a/m4/exitfail.m4 b/m4/exitfail.m4
deleted file mode 100644 (file)
index 56e2ce0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# exitfail.m4 serial 6
-dnl Copyright (C) 2002, 2003, 2005, 2006, 2009, 2010 Free Software Foundation,
-dnl 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_EXITFAIL],
-[
-  AC_LIBOBJ([exitfail])
-
-  dnl No prerequisites of lib/exitfail.c.
-  :
-])
diff --git a/m4/expl.m4 b/m4/expl.m4
new file mode 100644 (file)
index 0000000..698a9fb
--- /dev/null
@@ -0,0 +1,59 @@
+# expl.m4 serial 1
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_EXPL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare expl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  EXPL_LIBM=
+  AC_CACHE_CHECK([whether expl() can be used without linking with libm],
+    [gl_cv_func_expl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return expl (x) > 1.5;],
+        [gl_cv_func_expl_no_libm=yes],
+        [gl_cv_func_expl_no_libm=no])
+    ])
+  if test $gl_cv_func_expl_no_libm = no; then
+    AC_CACHE_CHECK([whether expl() can be used with libm],
+      [gl_cv_func_expl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return expl (x) > 1.5;],
+          [gl_cv_func_expl_in_libm=yes],
+          [gl_cv_func_expl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_expl_in_libm = yes; then
+      EXPL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_expl_no_libm = yes \
+     || test $gl_cv_func_expl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has expl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([expl], , [HAVE_DECL_EXPL=0], [#include <math.h>])
+  else
+    HAVE_DECL_EXPL=0
+    HAVE_EXPL=0
+    AC_LIBOBJ([expl])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    EXPL_LIBM="$FLOORL_LIBM"
+  fi
+  AC_SUBST([EXPL_LIBM])
+])
index 048a9fc..ecd8fa3 100644 (file)
@@ -1,4 +1,4 @@
-# serial 9
+# serial 10
 # Configure fcntl.h.
 dnl Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -12,6 +12,12 @@ AC_DEFUN([gl_FCNTL_H],
   AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
   AC_REQUIRE([gl_FCNTL_O_FLAGS])
   gl_CHECK_NEXT_HEADERS([fcntl.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, if it is not common
+  dnl enough to be declared everywhere.
+  gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
+    ]], [fcntl openat])
 ])
 
 AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
index b43e30b..f237d8d 100644 (file)
--- a/m4/gc.m4
+++ b/m4/gc.m4
@@ -1,4 +1,4 @@
-# gc.m4 serial 5
+# gc.m4 serial 6
 dnl Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,7 +10,7 @@ AC_DEFUN([gl_GC],
     AS_HELP_STRING([--with-libgcrypt], [use libgcrypt for low-level crypto]),
     libgcrypt=$withval, libgcrypt=no)
   if test "$libgcrypt" != no; then
-    AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include <gcrypt.h>])
+    AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [#include <gcrypt.h>])
   fi
   if test "$ac_cv_libgcrypt" = yes; then
     AC_LIBOBJ([gc-libgcrypt])
index 9e5ad5b..4beb150 100644 (file)
@@ -1,6 +1,6 @@
-# getdelim.m4 serial 5
+# getdelim.m4 serial 6
 
-dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc.
 dnl
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,16 +15,71 @@ AC_DEFUN([gl_FUNC_GETDELIM],
   dnl Persuade glibc <stdio.h> to declare getdelim().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
-  AC_REPLACE_FUNCS([getdelim])
   AC_CHECK_DECLS_ONCE([getdelim])
 
-  if test $ac_cv_func_getdelim = no; then
-    gl_PREREQ_GETDELIM
+  AC_CHECK_FUNCS_ONCE([getdelim])
+  if test $ac_cv_func_getdelim = yes; then
+    dnl Found it in some library.  Verify that it works.
+    AC_CACHE_CHECK([for working getdelim function], [gl_cv_func_working_getdelim],
+    [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
+    AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#    include <stdio.h>
+#    include <stdlib.h>
+#    include <string.h>
+    int main ()
+    {
+      FILE *in = fopen ("./conftest.data", "r");
+      if (!in)
+        return 1;
+      {
+        /* Test result for a NULL buffer and a zero size.
+           Based on a test program from Karl Heuer.  */
+        char *line = NULL;
+        size_t siz = 0;
+        int len = getdelim (&line, &siz, '\n', in);
+        if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
+          return 1;
+      }
+      {
+        /* Test result for a NULL buffer and a non-zero size.
+           This crashes on FreeBSD 8.0.  */
+        char *line = NULL;
+        size_t siz = (size_t)(~0) / 4;
+        if (getdelim (&line, &siz, '\n', in) == -1)
+          return 1;
+      }
+      return 0;
+    }
+    ]])], [gl_cv_func_working_getdelim=yes] dnl The library version works.
+    , [gl_cv_func_working_getdelim=no] dnl The library version does NOT work.
+    , dnl We're cross compiling. Assume it works on glibc2 systems.
+      [AC_EGREP_CPP([Lucky GNU user],
+         [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ >= 2)
+  Lucky GNU user
+ #endif
+#endif
+         ],
+         [gl_cv_func_working_getdelim=yes],
+         [gl_cv_func_working_getdelim=no])]
+    )])
+  else
+    gl_cv_func_working_getdelim=no
   fi
 
   if test $ac_cv_have_decl_getdelim = no; then
     HAVE_DECL_GETDELIM=0
   fi
+
+  if test $gl_cv_func_working_getdelim = no; then
+    if test $ac_cv_func_getdelim = yes; then
+      REPLACE_GETDELIM=1
+    fi
+    AC_LIBOBJ([getdelim])
+    gl_PREREQ_GETDELIM
+  fi
 ])
 
 # Prerequisites of lib/getdelim.c.
index 5b8a712..8300560 100644 (file)
@@ -1,4 +1,4 @@
-# getline.m4 serial 20
+# getline.m4 serial 21
 
 dnl Copyright (C) 1998-2003, 2005-2007, 2009-2010 Free Software Foundation,
 dnl Inc.
@@ -24,26 +24,39 @@ AC_DEFUN([gl_FUNC_GETLINE],
 
   gl_getline_needs_run_time_check=no
   AC_CHECK_FUNC([getline],
-                dnl Found it in some library.  Verify that it works.
-                gl_getline_needs_run_time_check=yes,
-                am_cv_func_working_getline=no)
+                [dnl Found it in some library.  Verify that it works.
+                 gl_getline_needs_run_time_check=yes],
+                [am_cv_func_working_getline=no])
   if test $gl_getline_needs_run_time_check = yes; then
     AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline],
-    [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
+    [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
     AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #    include <stdio.h>
 #    include <stdlib.h>
 #    include <string.h>
     int main ()
-    { /* Based on a test program from Karl Heuer.  */
-      char *line = NULL;
-      size_t siz = 0;
-      int len;
+    {
       FILE *in = fopen ("./conftest.data", "r");
       if (!in)
         return 1;
-      len = getline (&line, &siz, in);
-      exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
+      {
+        /* Test result for a NULL buffer and a zero size.
+           Based on a test program from Karl Heuer.  */
+        char *line = NULL;
+        size_t siz = 0;
+        int len = getline (&line, &siz, in);
+        if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
+          return 1;
+      }
+      {
+        /* Test result for a NULL buffer and a non-zero size.
+           This crashes on FreeBSD 8.0.  */
+        char *line = NULL;
+        size_t siz = (size_t)(~0) / 4;
+        if (getline (&line, &siz, in) == -1)
+          return 1;
+      }
+      return 0;
     }
     ]])], [am_cv_func_working_getline=yes] dnl The library version works.
     , [am_cv_func_working_getline=no] dnl The library version does NOT work.
@@ -67,6 +80,9 @@ AC_DEFUN([gl_FUNC_GETLINE],
   fi
 
   if test $am_cv_func_working_getline = no; then
+    dnl Set REPLACE_GETLINE always: Even if we have not found the broken
+    dnl getline function among $LIBS, it may exist in libinet and the
+    dnl executable may be linked with -linet.
     REPLACE_GETLINE=1
     AC_LIBOBJ([getline])
 
diff --git a/m4/getlogin.m4 b/m4/getlogin.m4
new file mode 100644 (file)
index 0000000..e47967d
--- /dev/null
@@ -0,0 +1,15 @@
+# getlogin.m4 serial 1
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_GETLOGIN],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([getlogin])
+  if test $ac_cv_func_getlogin = no; then
+    AC_LIBOBJ([getlogin])
+    HAVE_GETLOGIN=0
+  fi
+])
index 735123e..709a4d4 100644 (file)
@@ -1,4 +1,4 @@
-# serial 12
+# serial 15
 
 # Copyright (C) 2001-2003, 2005, 2007, 2009-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -11,33 +11,53 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY],
 [
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_HEADER_SYS_TIME_H])
+  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
   AC_CHECK_FUNCS_ONCE([gettimeofday])
 
-  AC_CACHE_CHECK([for gettimeofday with POSIX signature],
-    [gl_cv_func_gettimeofday_posix_signature],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[#include <sys/time.h>
-            struct timeval c;
-          ]],
-          [[
-            int (*f) (struct timeval *restrict, void *restrict) = gettimeofday;
-            int x = f (&c, 0);
-            return !(x | c.tv_sec | c.tv_usec);
-          ]])],
-        [gl_cv_func_gettimeofday_posix_signature=yes],
-        [gl_cv_func_gettimeofday_posix_signature=no])])
-
-  gl_FUNC_GETTIMEOFDAY_CLOBBER
-
-  if test $gl_cv_func_gettimeofday_posix_signature != yes; then
-    REPLACE_GETTIMEOFDAY=1
-    SYS_TIME_H=sys/time.h
-    if test $gl_cv_func_gettimeofday_clobber != yes; then
+  gl_gettimeofday_timezone=void
+  if test $ac_cv_func_gettimeofday != yes; then
+    HAVE_GETTIMEOFDAY=0
+    AC_LIBOBJ([gettimeofday])
+    gl_PREREQ_GETTIMEOFDAY
+  else
+    gl_FUNC_GETTIMEOFDAY_CLOBBER
+    AC_CACHE_CHECK([for gettimeofday with POSIX signature],
+      [gl_cv_func_gettimeofday_posix_signature],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <sys/time.h>
+              struct timeval c;
+              int gettimeofday (struct timeval *restrict, void *restrict);
+            ]],
+            [[/* glibc uses struct timezone * rather than the POSIX void *
+                 if _GNU_SOURCE is defined.  However, since the only portable
+                 use of gettimeofday uses NULL as the second parameter, and
+                 since the glibc definition is actually more typesafe, it is
+                 not worth wrapping this to get a compliant signature.  */
+              int (*f) (struct timeval *restrict, void *restrict)
+                = gettimeofday;
+              int x = f (&c, 0);
+              return !(x | c.tv_sec | c.tv_usec);
+            ]])],
+          [gl_cv_func_gettimeofday_posix_signature=yes],
+          [AC_COMPILE_IFELSE(
+            [AC_LANG_PROGRAM(
+              [[#include <sys/time.h>
+int gettimeofday (struct timeval *restrict, struct timezone *restrict);
+              ]])],
+            [gl_cv_func_gettimeofday_posix_signature=almost],
+            [gl_cv_func_gettimeofday_posix_signature=no])])])
+    if test $gl_cv_func_gettimeofday_posix_signature = almost; then
+      gl_gettimeofday_timezone='struct timezone'
+    elif test $gl_cv_func_gettimeofday_posix_signature != yes; then
+      REPLACE_GETTIMEOFDAY=1
       AC_LIBOBJ([gettimeofday])
       gl_PREREQ_GETTIMEOFDAY
     fi
   fi
+  AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone],
+    [Define this to 'void' or 'struct timezone' to match the system's
+     declaration of the second argument to gettimeofday.])
 ])
 
 
@@ -78,7 +98,6 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
 
  if test $gl_cv_func_gettimeofday_clobber = yes; then
    REPLACE_GETTIMEOFDAY=1
-   SYS_TIME_H=sys/time.h
    gl_GETTIMEOFDAY_REPLACE_LOCALTIME
    AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1],
      [Define if gettimeofday clobbers the localtime buffer.])
index d53b9cb..80ba263 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 11
+# gnulib-common.m4 serial 13
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -52,10 +52,25 @@ m4_ifndef([m4_foreach_w],
   [m4_define([m4_foreach_w],
     [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
 
+# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
+# ----------------------------------------------------
+# Backport of autoconf-2.63b's macro.
+# Remove this macro when we can assume autoconf >= 2.64.
+m4_ifndef([AS_VAR_IF],
+[m4_define([AS_VAR_IF],
+[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
+
 # AC_PROG_MKDIR_P
-# is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
-# Remove this macro when we can assume autoconf >= 2.60.
-m4_ifdef([AC_PROG_MKDIR_P], [], [
+# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix
+# for interoperability with automake-1.9.6 from autoconf-2.62.
+# Remove this macro when we can assume autoconf >= 2.62 or
+# autoconf >= 2.60 && automake >= 1.10.
+m4_ifdef([AC_PROG_MKDIR_P], [
+  dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed.
+  m4_define([AC_PROG_MKDIR_P],
+    m4_defn([AC_PROG_MKDIR_P])[
+    AC_SUBST([MKDIR_P])])], [
+  dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P.
   AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
     [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
      MKDIR_P='$(mkdir_p)'
index 3892e60..3ee174d 100644 (file)
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 16
+# inttypes.m4 serial 17
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -233,6 +233,11 @@ const char *l = /* implicit string concatenation */
   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 <inttypes.h>
+    ]], [imaxabs imaxdiv strtoimax strtoumax])
 ])
 
 # Define the symbol $1 to be 1 if the condition is true, 0 otherwise.
index 848c2f9..eb61d56 100644 (file)
@@ -1,4 +1,4 @@
-# isnan.m4 serial 2
+# isnan.m4 serial 3
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,7 +18,22 @@ AC_DEFUN([gl_ISNAN],
      && test $gl_func_isnand = yes \
      && test $gl_func_isnanl = yes; then
     AC_MSG_RESULT([yes])
-    ISNAN_LIBM="$ISNANF_LIBM $ISNAND_LIBM $ISNANL_LIBM"
+    ISNAN_LIBM=
+    dnl Append $ISNANF_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
+    case " $ISNAN_LIBM " in
+      *" $ISNANF_LIBM "*) ;;
+      *) ISNAN_LIBM="$ISNAN_LIBM $ISNANF_LIBM" ;;
+    esac
+    dnl Append $ISNAND_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
+    case " $ISNAN_LIBM " in
+      *" $ISNAND_LIBM "*) ;;
+      *) ISNAN_LIBM="$ISNAN_LIBM $ISNAND_LIBM" ;;
+    esac
+    dnl Append $ISNANL_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
+    case " $ISNAN_LIBM " in
+      *" $ISNANL_LIBM "*) ;;
+      *) ISNAN_LIBM="$ISNAN_LIBM $ISNANL_LIBM" ;;
+    esac
   else
     AC_MSG_RESULT([no])
     REPLACE_ISNAN=1
index 46be299..a4c5409 100644 (file)
@@ -1,4 +1,4 @@
-# langinfo_h.m4 serial 2
+# langinfo_h.m4 serial 3
 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -51,6 +51,11 @@ int a = ERA;
   AC_SUBST([HAVE_LANGINFO_H])
   AC_SUBST([HAVE_LANGINFO_CODESET])
   AC_SUBST([HAVE_LANGINFO_ERA])
+
+  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 <langinfo.h>
+    ]], [nl_langinfo])
 ])
 
 AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
index e3547b1..0b7f493 100644 (file)
@@ -1,4 +1,4 @@
-# locale_h.m4 serial 6
+# locale_h.m4 serial 7
 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -56,6 +56,15 @@ locale_t x;], [],
      || 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 <locale.h>
+/* Some systems provide declarations in a non-standard header.  */
+#if HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
+   ]], [duplocale])
 ])
 
 dnl Unconditionally enables the replacement of <locale.h>.
diff --git a/m4/logl.m4 b/m4/logl.m4
new file mode 100644 (file)
index 0000000..eab591e
--- /dev/null
@@ -0,0 +1,75 @@
+# logl.m4 serial 2
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_LOGL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare logl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  LOGL_LIBM=
+  AC_CACHE_CHECK([whether logl() can be used without linking with libm],
+    [gl_cv_func_logl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return logl (x) > 1;],
+        [gl_cv_func_logl_no_libm=yes],
+        [gl_cv_func_logl_no_libm=no])
+    ])
+  if test $gl_cv_func_logl_no_libm = no; then
+    AC_CACHE_CHECK([whether logl() can be used with libm],
+      [gl_cv_func_logl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return logl (x) > 1;],
+          [gl_cv_func_logl_in_libm=yes],
+          [gl_cv_func_logl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_logl_in_libm = yes; then
+      LOGL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_logl_no_libm = yes \
+     || test $gl_cv_func_logl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has logl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([logl], , [HAVE_DECL_LOGL=0], [#include <math.h>])
+  else
+    HAVE_DECL_LOGL=0
+    HAVE_LOGL=0
+    AC_LIBOBJ([logl])
+    AC_REQUIRE([gl_FUNC_FREXPL])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    dnl Append $FREXPL_LIBM to LOGL_LIBM, avoiding gratuitous duplicates.
+    case " $LOGL_LIBM " in
+      *" $FREXPL_LIBM "*) ;;
+      *) LOGL_LIBM="$LOGL_LIBM $FREXPL_LIBM" ;;
+    esac
+    dnl Append $ISNANL_LIBM to LOGL_LIBM, avoiding gratuitous duplicates.
+    case " $LOGL_LIBM " in
+      *" $ISNANL_LIBM "*) ;;
+      *) LOGL_LIBM="$LOGL_LIBM $ISNANL_LIBM" ;;
+    esac
+    dnl Append $FLOORL_LIBM to LOGL_LIBM, avoiding gratuitous duplicates.
+    case " $LOGL_LIBM " in
+      *" $FLOORL_LIBM "*) ;;
+      *) LOGL_LIBM="$LOGL_LIBM $FLOORL_LIBM" ;;
+    esac
+  fi
+  AC_SUBST([LOGL_LIBM])
+])
index f308495..9bf4dc2 100644 (file)
@@ -1,4 +1,4 @@
-# lseek.m4 serial 4
+# lseek.m4 serial 5
 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,8 @@ int main ()
 }],
          [if test -s conftest$ac_exeext \
              && ./conftest$ac_exeext < conftest.$ac_ext \
-             && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
+             && test 1 = "`echo hi \
+               | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then
             gl_cv_func_lseek_pipe=yes
           else
             gl_cv_func_lseek_pipe=no
index 00cbeb7..e3b499e 100644 (file)
@@ -1,4 +1,4 @@
-# math_h.m4 serial 14
+# math_h.m4 serial 17
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,6 +8,8 @@ AC_DEFUN([gl_MATH_H],
 [
   AC_REQUIRE([gl_MATH_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([math.h])
+  AC_REQUIRE([AC_C_INLINE])
+
   AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
       [[/* Solaris 10 has a broken definition of NAN.  Other platforms
@@ -33,6 +35,12 @@ AC_DEFUN([gl_MATH_H],
   if test $gl_cv_header_math_huge_val_works = no; then
     REPLACE_HUGE_VAL=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 <math.h>
+    ]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl
+    ldexpl logl round roundf roundl sinl sqrtl tanl trunc truncf truncl])
 ])
 
 AC_DEFUN([gl_MATH_MODULE_INDICATOR],
@@ -44,8 +52,13 @@ AC_DEFUN([gl_MATH_MODULE_INDICATOR],
 
 AC_DEFUN([gl_MATH_H_DEFAULTS],
 [
+  GNULIB_ACOSL=0;    AC_SUBST([GNULIB_ACOSL])
+  GNULIB_ASINL=0;    AC_SUBST([GNULIB_ASINL])
+  GNULIB_ATANL=0;    AC_SUBST([GNULIB_ATANL])
   GNULIB_CEILF=0;    AC_SUBST([GNULIB_CEILF])
   GNULIB_CEILL=0;    AC_SUBST([GNULIB_CEILL])
+  GNULIB_COSL=0;     AC_SUBST([GNULIB_COSL])
+  GNULIB_EXPL=0;     AC_SUBST([GNULIB_EXPL])
   GNULIB_FLOORF=0;   AC_SUBST([GNULIB_FLOORF])
   GNULIB_FLOORL=0;   AC_SUBST([GNULIB_FLOORL])
   GNULIB_FREXP=0;    AC_SUBST([GNULIB_FREXP])
@@ -57,18 +70,30 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   GNULIB_ISNAND=0;   AC_SUBST([GNULIB_ISNAND])
   GNULIB_ISNANL=0;   AC_SUBST([GNULIB_ISNANL])
   GNULIB_LDEXPL=0;   AC_SUBST([GNULIB_LDEXPL])
-  GNULIB_MATHL=0;    AC_SUBST([GNULIB_MATHL])
+  GNULIB_LOGL=0;     AC_SUBST([GNULIB_LOGL])
   GNULIB_ROUND=0;    AC_SUBST([GNULIB_ROUND])
   GNULIB_ROUNDF=0;   AC_SUBST([GNULIB_ROUNDF])
   GNULIB_ROUNDL=0;   AC_SUBST([GNULIB_ROUNDL])
   GNULIB_SIGNBIT=0;  AC_SUBST([GNULIB_SIGNBIT])
+  GNULIB_SINL=0;     AC_SUBST([GNULIB_SINL])
+  GNULIB_SQRTL=0;    AC_SUBST([GNULIB_SQRTL])
+  GNULIB_TANL=0;     AC_SUBST([GNULIB_TANL])
   GNULIB_TRUNC=0;    AC_SUBST([GNULIB_TRUNC])
   GNULIB_TRUNCF=0;   AC_SUBST([GNULIB_TRUNCF])
   GNULIB_TRUNCL=0;   AC_SUBST([GNULIB_TRUNCL])
   dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_ACOSL=1;                AC_SUBST([HAVE_ACOSL])
+  HAVE_ASINL=1;                AC_SUBST([HAVE_ASINL])
+  HAVE_ATANL=1;                AC_SUBST([HAVE_ATANL])
+  HAVE_COSL=1;                 AC_SUBST([HAVE_COSL])
+  HAVE_EXPL=1;                 AC_SUBST([HAVE_EXPL])
   HAVE_ISNANF=1;               AC_SUBST([HAVE_ISNANF])
   HAVE_ISNAND=1;               AC_SUBST([HAVE_ISNAND])
   HAVE_ISNANL=1;               AC_SUBST([HAVE_ISNANL])
+  HAVE_LOGL=1;                 AC_SUBST([HAVE_LOGL])
+  HAVE_SINL=1;                 AC_SUBST([HAVE_SINL])
+  HAVE_SQRTL=1;                AC_SUBST([HAVE_SQRTL])
+  HAVE_TANL=1;                 AC_SUBST([HAVE_TANL])
   HAVE_DECL_ACOSL=1;           AC_SUBST([HAVE_DECL_ACOSL])
   HAVE_DECL_ASINL=1;           AC_SUBST([HAVE_DECL_ASINL])
   HAVE_DECL_ATANL=1;           AC_SUBST([HAVE_DECL_ATANL])
diff --git a/m4/mathfunc.m4 b/m4/mathfunc.m4
new file mode 100644 (file)
index 0000000..d09aaca
--- /dev/null
@@ -0,0 +1,115 @@
+# mathfunc.m4 serial 3
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# gl_MATHFUNC(FUNC, RETTYPE, PARAMTYPES)
+# --------------------------------------------------
+# tests whether the function FUNC is available in libc or libm.
+# RETTYPE is the return type. PARAMTYPES is a parameter list, with parentheses.
+# It sets FUNC_LIBM to empty or "-lm" accordingly.
+
+AC_DEFUN([gl_MATHFUNC],
+[
+  dnl We need the RETTYPE and PARAMTYPES in order to force linking with the
+  dnl function. With gcc >= 4.3 on glibc/x86_64, calls to the 'fabs' function
+  dnl are inlined by the compiler, therefore linking of these calls does not
+  dnl require -lm, but taking the function pointer of 'fabs' does.
+  m4_pushdef([func], [$1])
+  m4_pushdef([FUNC], [translit([$1],[abcdefghijklmnopqrstuvwxyz],
+                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
+  FUNC[]_LIBM=
+  AC_CACHE_CHECK([whether func() can be used without linking with libm],
+    [gl_cv_func_]func[_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
+                           # define __NO_MATH_INLINES 1 /* for glibc */
+                           #endif
+                           #include <math.h>
+                           $2 (*funcptr) $3 = ]func[;]],
+                         [[return 0;]])],
+        [gl_cv_func_]func[_no_libm=yes],
+        [gl_cv_func_]func[_no_libm=no])
+    ])
+  if test $gl_cv_func_[]func[]_no_libm = no; then
+    AC_CACHE_CHECK([whether func() can be used with libm],
+      [gl_cv_func_]func[_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_LINK_IFELSE(
+          [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
+                             # define __NO_MATH_INLINES 1 /* for glibc */
+                             #endif
+                             #include <math.h>
+                             $2 (*funcptr) $3 = ]func[;]],
+                           [[return 0;]])],
+          [gl_cv_func_]func[_in_libm=yes],
+          [gl_cv_func_]func[_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_[]func[]_in_libm = yes; then
+      FUNC[]_LIBM=-lm
+    fi
+  fi
+  AC_SUBST(FUNC[_LIBM])
+  m4_popdef([FUNC])
+  m4_popdef([func])
+])
+
+# gl_COMMON_DOUBLE_MATHFUNC(FUNC)
+# -------------------------------
+# tests whether the function FUNC is available in libc or libm.
+# It sets FUNC_LIBM to empty or "-lm" accordingly.
+# FUNC must be one of the following functions, that are present on all systems
+# and provided by libm on all systems except MacOS X, BeOS, Haiku:
+#   acos asin atan atan2 cbrt copysign cos cosh erf erfc exp fmod hypot j0 j1
+#   jn lgamma log log10 log1p pow remainder sin sinh sqrt tan tanh y0 y1 yn
+
+AC_DEFUN([gl_COMMON_DOUBLE_MATHFUNC],
+[
+  AC_REQUIRE([gl_COMMON_DOUBLE_MATHFUNC_TEST])
+  m4_pushdef([FUNC], [translit([$1],[abcdefghijklmnopqrstuvwxyz],
+                                    [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
+  FUNC[]_LIBM="$POW_LIBM"
+  AC_SUBST(FUNC[_LIBM])
+  m4_popdef([FUNC])
+])
+
+AC_DEFUN([gl_COMMON_DOUBLE_MATHFUNC_TEST],
+[
+  dnl We could use any of the following:
+  dnl gl_MATHFUNC([acos], [double], [(double)])
+  dnl gl_MATHFUNC([asin], [double], [(double)])
+  dnl gl_MATHFUNC([atan], [double], [(double)])
+  dnl gl_MATHFUNC([atan2], [double], [(double, double)])
+  dnl gl_MATHFUNC([cbrt], [double], [(double)])
+  dnl gl_MATHFUNC([copysign], [double], [(double, double)])
+  dnl gl_MATHFUNC([cos], [double], [(double)])
+  dnl gl_MATHFUNC([cosh], [double], [(double)])
+  dnl gl_MATHFUNC([erf], [double], [(double)])
+  dnl gl_MATHFUNC([erfc], [double], [(double)])
+  dnl gl_MATHFUNC([exp], [double], [(double)])
+  dnl gl_MATHFUNC([fmod], [double], [(double, double)])
+  dnl gl_MATHFUNC([hypot], [double], [(double, double)])
+  dnl gl_MATHFUNC([j0], [double], [(double)])
+  dnl gl_MATHFUNC([j1], [double], [(double)])
+  dnl gl_MATHFUNC([jn], [double], [(int, double)])
+  dnl gl_MATHFUNC([lgamma], [double], [(double)])
+  dnl gl_MATHFUNC([log], [double], [(double)])
+  dnl gl_MATHFUNC([log10], [double], [(double)])
+  dnl gl_MATHFUNC([log1p], [double], [(double)])
+  dnl gl_MATHFUNC([pow], [double], [(double, double)])
+  dnl gl_MATHFUNC([remainder], [double], [(double, double)])
+  dnl gl_MATHFUNC([sin], [double], [(double)])
+  dnl gl_MATHFUNC([sinh], [double], [(double)])
+  dnl gl_MATHFUNC([sqrt], [double], [(double)])
+  dnl gl_MATHFUNC([tan], [double], [(double)])
+  dnl gl_MATHFUNC([tanh], [double], [(double)])
+  dnl gl_MATHFUNC([y0], [double], [(double)])
+  dnl gl_MATHFUNC([y1], [double], [(double)])
+  dnl gl_MATHFUNC([yn], [double], [(int, double)])
+  gl_MATHFUNC([pow], [double], [(double, double)])
+])
diff --git a/m4/mathl.m4 b/m4/mathl.m4
deleted file mode 100644 (file)
index cfe2de0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# mathl.m4 serial 5
-dnl Copyright (c) 2003, 2007, 2009, 2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_LONG_DOUBLE_MATH], [
-
-AC_CHECK_LIB([m], [atan])
-AC_REPLACE_FUNCS(floorl ceill sqrtl asinl acosl atanl \
-        logl expl tanl sinl cosl)
-
-])
index 578812a..606aca1 100644 (file)
@@ -1,4 +1,4 @@
-# obstack-printf-posix.m4 serial 3
+# obstack-printf-posix.m4 serial 4
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -101,4 +101,5 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF_POSIX],
     gl_REPLACE_VASNPRINTF
     gl_REPLACE_OBSTACK_PRINTF
   fi
+  gl_DECL_OBSTACK_PRINTF
 ])
index ae2e5d9..b74a46b 100644 (file)
@@ -1,4 +1,4 @@
-# obstack-printf.m4 serial 2
+# obstack-printf.m4 serial 3
 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,10 +19,7 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF],
     gl_REPLACE_OBSTACK_PRINTF
   fi
 
-  AC_CHECK_DECLS_ONCE([obstack_printf])
-  if test $ac_cv_have_decl_obstack_printf = no; then
-    HAVE_DECL_OBSTACK_PRINTF=0
-  fi
+  gl_DECL_OBSTACK_PRINTF
 ])
 
 AC_DEFUN([gl_REPLACE_OBSTACK_PRINTF],
@@ -33,3 +30,13 @@ AC_DEFUN([gl_REPLACE_OBSTACK_PRINTF],
     REPLACE_OBSTACK_PRINTF=1
   fi
 ])
+
+dnl Ensure obstack_printf() and obstack_vprintf() are declared
+dnl (whether or not they are being replaced).
+AC_DEFUN([gl_DECL_OBSTACK_PRINTF],
+[
+  AC_CHECK_DECLS_ONCE([obstack_printf])
+  if test $ac_cv_have_decl_obstack_printf = no; then
+    HAVE_DECL_OBSTACK_PRINTF=0
+  fi
+])
index a702252..6bd6b8f 100644 (file)
@@ -96,6 +96,13 @@ AC_DEFUN([gl_REGEX],
             if (!s)
               return 1;
 
+            /* Ensure that [b-a] is diagnosed as invalid. */
+            re_set_syntax (RE_SYNTAX_POSIX_EGREP);
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("a[b-a]", 6, &regex);
+            if (s == 0)
+              return 1;
+
             /* This should succeed, but does not for glibc-2.1.3.  */
             memset (&regex, 0, sizeof regex);
             s = re_compile_pattern ("{1", 2, &regex);
index 2e13b44..8860e01 100644 (file)
@@ -1,5 +1,5 @@
-# round.m4 serial 6
-dnl Copyright (C) 2007, 20092010 Free Software Foundation, Inc.
+# round.m4 serial 7
+dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -56,7 +56,17 @@ int main()
     AC_LIBOBJ([round])
     gl_FUNC_FLOOR_LIBS
     gl_FUNC_CEIL_LIBS
-    ROUND_LIBM="$FLOOR_LIBM $CEIL_LIBM"
+    ROUND_LIBM=
+    dnl Append $FLOOR_LIBM to ROUND_LIBM, avoiding gratuitous duplicates.
+    case " $ROUND_LIBM " in
+      *" $FLOOR_LIBM "*) ;;
+      *) ROUND_LIBM="$ROUND_LIBM $FLOOR_LIBM" ;;
+    esac
+    dnl Append $CEIL_LIBM to ROUND_LIBM, avoiding gratuitous duplicates.
+    case " $ROUND_LIBM " in
+      *" $CEIL_LIBM "*) ;;
+      *) ROUND_LIBM="$ROUND_LIBM $CEIL_LIBM" ;;
+    esac
   fi
   AC_SUBST([ROUND_LIBM])
 ])
index 6614241..b246d04 100644 (file)
@@ -1,4 +1,4 @@
-# roundf.m4 serial 7
+# roundf.m4 serial 8
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -59,7 +59,17 @@ int main()
       if test "$FLOORF_LIBM" != '?' && test "$CEILF_LIBM" != '?'; then
         AC_DEFINE([HAVE_FLOORF_AND_CEILF], [1],
           [Define if the both the floorf() and ceilf() functions exist.])
-        ROUNDF_LIBM="$FLOORF_LIBM $CEILF_LIBM"
+        ROUNDF_LIBM=
+        dnl Append $FLOORF_LIBM to ROUNDF_LIBM, avoiding gratuitous duplicates.
+        case " $ROUNDF_LIBM " in
+          *" $FLOORF_LIBM "*) ;;
+          *) ROUNDF_LIBM="$ROUNDF_LIBM $FLOORF_LIBM" ;;
+        esac
+        dnl Append $CEILF_LIBM to ROUNDF_LIBM, avoiding gratuitous duplicates.
+        case " $ROUNDF_LIBM " in
+          *" $CEILF_LIBM "*) ;;
+          *) ROUNDF_LIBM="$ROUNDF_LIBM $CEILF_LIBM" ;;
+        esac
       else
         ROUNDF_LIBM=
       fi
index 66bdd00..3011c37 100644 (file)
@@ -1,5 +1,5 @@
-# roundl.m4 serial 5
-dnl Copyright (C) 2007, 20092010 Free Software Foundation, Inc.
+# roundl.m4 serial 6
+dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -24,7 +24,17 @@ AC_DEFUN([gl_FUNC_ROUNDL],
       if test "$FLOORL_LIBM" != '?' && test "$CEILL_LIBM" != '?'; then
         AC_DEFINE([HAVE_FLOORL_AND_CEILL], [1],
           [Define if the both the floorl() and ceill() functions exist.])
-        ROUNDL_LIBM="$FLOORL_LIBM $CEILL_LIBM"
+        ROUNDL_LIBM=
+        dnl Append $FLOORL_LIBM to ROUNDL_LIBM, avoiding gratuitous duplicates.
+        case " $ROUNDL_LIBM " in
+          *" $FLOORL_LIBM "*) ;;
+          *) ROUNDL_LIBM="$ROUNDL_LIBM $FLOORL_LIBM" ;;
+        esac
+        dnl Append $CEILL_LIBM to ROUNDL_LIBM, avoiding gratuitous duplicates.
+        case " $ROUNDL_LIBM " in
+          *" $CEILL_LIBM "*) ;;
+          *) ROUNDL_LIBM="$ROUNDL_LIBM $CEILL_LIBM" ;;
+        esac
       else
         ROUNDL_LIBM=
       fi
index 0dd0d4b..d9043d9 100644 (file)
@@ -1,4 +1,4 @@
-# search_h.m4 serial 4
+# search_h.m4 serial 5
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,6 +15,11 @@ AC_DEFUN([gl_SEARCH_H],
     HAVE_SEARCH_H=0
   fi
   AC_SUBST([HAVE_SEARCH_H])
+
+  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 <search.h>
+    ]], [tdelete tfind tsearch twalk])
 ])
 
 AC_DEFUN([gl_SEARCH_MODULE_INDICATOR],
index 7a9d29c..7f61e0b 100644 (file)
@@ -1,4 +1,4 @@
-# signal_h.m4 serial 8
+# signal_h.m4 serial 9
 dnl Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,6 +15,12 @@ AC_DEFUN([gl_SIGNAL_H],
 #include <signal.h>
     ]])
   AC_REQUIRE([AC_TYPE_UID_T])
+
+  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 <signal.h>
+    ]], [sigaction sigaddset sigdelset sigemptyset sigfillset sigismember
+    sigpending sigprocmask])
 ])
 
 AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
diff --git a/m4/sinl.m4 b/m4/sinl.m4
new file mode 100644 (file)
index 0000000..c9c0e5c
--- /dev/null
@@ -0,0 +1,77 @@
+# sinl.m4 serial 2
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_SINL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare sinl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  SINL_LIBM=
+  AC_CACHE_CHECK([whether sinl() can be used without linking with libm],
+    [gl_cv_func_sinl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return sinl (x) > 0.4;],
+        [gl_cv_func_sinl_no_libm=yes],
+        [gl_cv_func_sinl_no_libm=no])
+    ])
+  if test $gl_cv_func_sinl_no_libm = no; then
+    AC_CACHE_CHECK([whether sinl() can be used with libm],
+      [gl_cv_func_sinl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return sinl (x) > 0.4;],
+          [gl_cv_func_sinl_in_libm=yes],
+          [gl_cv_func_sinl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_sinl_in_libm = yes; then
+      SINL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_sinl_no_libm = yes \
+     || test $gl_cv_func_sinl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has sinl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([sinl], , [HAVE_DECL_SINL=0], [#include <math.h>])
+  else
+    HAVE_DECL_SINL=0
+    HAVE_SINL=0
+    AC_LIBOBJ([sinl])
+    AC_LIBOBJ([sincosl])
+    AC_LIBOBJ([trigl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FLOOR])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    dnl Append $ISNANL_LIBM to SINL_LIBM, avoiding gratuitous duplicates.
+    case " $SINL_LIBM " in
+      *" $ISNANL_LIBM "*) ;;
+      *) SINL_LIBM="$SINL_LIBM $ISNANL_LIBM" ;;
+    esac
+    dnl Append $FLOOR_LIBM to SINL_LIBM, avoiding gratuitous duplicates.
+    case " $SINL_LIBM " in
+      *" $FLOOR_LIBM "*) ;;
+      *) SINL_LIBM="$SINL_LIBM $FLOOR_LIBM" ;;
+    esac
+    dnl Append $FLOORL_LIBM to SINL_LIBM, avoiding gratuitous duplicates.
+    case " $SINL_LIBM " in
+      *" $FLOORL_LIBM "*) ;;
+      *) SINL_LIBM="$SINL_LIBM $FLOORL_LIBM" ;;
+    esac
+  fi
+  AC_SUBST([SINL_LIBM])
+])
index 11f399e..a9bd161 100644 (file)
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 5
+# spawn_h.m4 serial 6
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -34,6 +34,20 @@ AC_DEFUN([gl_SPAWN_H],
   AC_SUBST([HAVE_SPAWN_H])
 
   AC_REQUIRE([AC_C_RESTRICT])
+
+  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 <spawn.h>
+    ]], [posix_spawn posix_spawnp posix_spawnattr_init posix_spawnattr_destroy
+    posix_spawnattr_getsigdefault posix_spawnattr_setsigdefault
+    posix_spawnattr_getsigmask posix_spawnattr_setsigmask
+    posix_spawnattr_getflags posix_spawnattr_setflags
+    posix_spawnattr_getpgroup posix_spawnattr_setpgroup
+    posix_spawnattr_getschedpolicy posix_spawnattr_setschedpolicy
+    posix_spawnattr_getschedparam posix_spawnattr_setschedparam
+    posix_spawn_file_actions_init posix_spawn_file_actions_destroy
+    posix_spawn_file_actions_addopen posix_spawn_file_actions_addclose
+    posix_spawwn_file_actions_adddup2])
 ])
 
 dnl Unconditionally enables the replacement of <spawn.h>.
diff --git a/m4/sqrt.m4 b/m4/sqrt.m4
new file mode 100644 (file)
index 0000000..dd87ed2
--- /dev/null
@@ -0,0 +1,10 @@
+# sqrt.m4 serial 3
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_SQRT],
+[
+  gl_COMMON_DOUBLE_MATHFUNC([sqrt])
+])
diff --git a/m4/sqrtl.m4 b/m4/sqrtl.m4
new file mode 100644 (file)
index 0000000..21b1c68
--- /dev/null
@@ -0,0 +1,81 @@
+# sqrtl.m4 serial 2
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_SQRTL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare sqrtl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  SQRTL_LIBM=
+  AC_CACHE_CHECK([whether sqrtl() can be used without linking with libm],
+    [gl_cv_func_sqrtl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return sqrtl (x) > 0.4;],
+        [gl_cv_func_sqrtl_no_libm=yes],
+        [gl_cv_func_sqrtl_no_libm=no])
+    ])
+  if test $gl_cv_func_sqrtl_no_libm = no; then
+    AC_CACHE_CHECK([whether sqrtl() can be used with libm],
+      [gl_cv_func_sqrtl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return sqrtl (x) > 0.4;],
+          [gl_cv_func_sqrtl_in_libm=yes],
+          [gl_cv_func_sqrtl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_sqrtl_in_libm = yes; then
+      SQRTL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_sqrtl_no_libm = yes \
+     || test $gl_cv_func_sqrtl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has sqrtl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([sqrtl], , [HAVE_DECL_SQRTL=0], [#include <math.h>])
+  else
+    HAVE_DECL_SQRTL=0
+    HAVE_SQRTL=0
+    AC_LIBOBJ([sqrtl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FREXPL])
+    AC_REQUIRE([gl_FUNC_LDEXPL])
+    AC_REQUIRE([gl_FUNC_SQRT])
+    dnl Append $ISNANL_LIBM to SQRTL_LIBM, avoiding gratuitous duplicates.
+    case " $SQRTL_LIBM " in
+      *" $ISNANL_LIBM "*) ;;
+      *) SQRTL_LIBM="$SQRTL_LIBM $ISNANL_LIBM" ;;
+    esac
+    dnl Append $FREXPL_LIBM to SQRTL_LIBM, avoiding gratuitous duplicates.
+    case " $SQRTL_LIBM " in
+      *" $FREXPL_LIBM "*) ;;
+      *) SQRTL_LIBM="$SQRTL_LIBM $FREXPL_LIBM" ;;
+    esac
+    dnl Append $LDEXPL_LIBM to SQRTL_LIBM, avoiding gratuitous duplicates.
+    case " $SQRTL_LIBM " in
+      *" $LDEXPL_LIBM "*) ;;
+      *) SQRTL_LIBM="$SQRTL_LIBM $LDEXPL_LIBM" ;;
+    esac
+    dnl Append $SQRT_LIBM to SQRTL_LIBM, avoiding gratuitous duplicates.
+    case " $SQRTL_LIBM " in
+      *" $SQRT_LIBM "*) ;;
+      *) SQRTL_LIBM="$SQRTL_LIBM $SQRT_LIBM" ;;
+    esac
+  fi
+  AC_SUBST([SQRTL_LIBM])
+])
index 7e59692..781fa8d 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 22
+# stdio_h.m4 serial 25
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_STDIO_H],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_C_INLINE])
   gl_CHECK_NEXT_HEADERS([stdio.h])
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
@@ -30,6 +31,13 @@ AC_DEFUN([gl_STDIO_H],
       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
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
+    ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
+    snprintf vdprintf vsnprintf])
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -103,6 +111,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   REPLACE_FSEEKO=0;              AC_SUBST([REPLACE_FSEEKO])
   REPLACE_FTELL=0;               AC_SUBST([REPLACE_FTELL])
   REPLACE_FTELLO=0;              AC_SUBST([REPLACE_FTELLO])
+  REPLACE_GETDELIM=0;            AC_SUBST([REPLACE_GETDELIM])
   REPLACE_GETLINE=0;             AC_SUBST([REPLACE_GETLINE])
   REPLACE_OBSTACK_PRINTF=0;      AC_SUBST([REPLACE_OBSTACK_PRINTF])
   REPLACE_PERROR=0;              AC_SUBST([REPLACE_PERROR])
index cf41ec0..0693d1a 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 21
+# stdlib_h.m4 serial 22
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,6 +22,20 @@ AC_DEFUN([gl_STDLIB_H],
       # include <random.h>
       #endif
     ]])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
+#if HAVE_SYS_LOADAVG_H
+# include <sys/loadavg.h>
+#endif
+#if HAVE_RANDOM_H
+# include <random.h>
+#endif
+    ]], [atoll canonicalize_file_name getloadavg getsubopt mkdtemp
+    mkostemp mkostemps mkstemp mkstemps random_r initstat_r srandom_r
+    setstate_r realpath rpmatch setenv strtod strtoll strtoull unsetenv])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
index f2f64d1..73c6d83 100644 (file)
@@ -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 10
+# serial 11
 
 # Written by Paul Eggert.
 
@@ -21,6 +21,13 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([string.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <string.h>
+    ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
+    strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp])
 ])
 
 AC_DEFUN([gl_STRING_MODULE_INDICATOR],
index 135c16c..26aa1f7 100644 (file)
@@ -1,4 +1,5 @@
 # Configure a replacement for <string.h>.
+# serial 2
 
 # Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -16,6 +17,11 @@ AC_DEFUN([gl_HEADER_STRINGS_H_BODY],
 [
   AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([strings.h])
+
+  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 <strings.h>
+    ]], [strcasecmp strncasecmp])
 ])
 
 AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
index f8454f1..d864dad 100644 (file)
@@ -1,4 +1,5 @@
 # Configure a replacement for <sys/file.h>.
+# serial 3
 
 # Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -7,8 +8,6 @@
 
 # Written by Richard W.M. Jones.
 
-# serial 2
-
 AC_DEFUN([gl_HEADER_SYS_FILE_H],
 [
   AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS])
@@ -26,6 +25,11 @@ AC_DEFUN([gl_HEADER_SYS_FILE_H],
     HAVE_SYS_FILE_H=0
   fi
   AC_SUBST([HAVE_SYS_FILE_H])
+
+  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 <sys/file.h>
+    ]], [flock])
 ])
 
 AC_DEFUN([gl_HEADER_SYS_FILE_MODULE_INDICATOR],
index bf54a42..829dc61 100644 (file)
@@ -1,4 +1,4 @@
-# sys_ioctl_h.m4 serial 4
+# sys_ioctl_h.m4 serial 5
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,15 @@ AC_DEFUN([gl_SYS_IOCTL_H],
   AC_SUBST([HAVE_SYS_IOCTL_H])
   dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([sys/ioctl.h])
+
+  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 <sys/ioctl.h>
+/* Some platforms declare ioctl in the wrong header.  */
+#ifndef __GLIBC__
+# include <unistd.h>
+#endif
+    ]], [ioctl])
 ])
 
 dnl Unconditionally enables the replacement of <sys/ioctl.h>.
index 6ce09db..590554a 100644 (file)
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 10
+# sys_select_h.m4 serial 11
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -56,6 +56,17 @@ AC_DEFUN([gl_HEADER_SYS_SELECT],
   if test $gl_cv_header_sys_select_h_selfcontained != yes; then
     gl_PREREQ_SYS_H_WINSOCK2
   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([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [select])
 ])
 
 AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
index 34312f5..1d47656 100644 (file)
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 13
+# sys_socket_h.m4 serial 14
 dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -66,6 +66,18 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
     gl_PREREQ_SYS_H_WINSOCK2
   fi
   AC_SUBST([SYS_SOCKET_H])
+
+  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([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [socket connect accept bind getpeername getsockname getsockopt
+    listen recv send recvfrom sendto setsockopt shutdown accept4])
 ])
 
 AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
index 4cec9cd..5a113d0 100644 (file)
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 21   -*- Autoconf -*-
+# sys_stat_h.m4 serial 22   -*- Autoconf -*-
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -27,6 +27,11 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
     [#include <sys/types.h>
      #include <sys/stat.h>])
 
+  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 <sys/stat.h>
+    ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
+    mknod mknodat stat utimensat])
 ]) # gl_HEADER_SYS_STAT_H
 
 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
index 9c16487..be6d7ec 100644 (file)
@@ -1,5 +1,5 @@
 # Configure a replacement for <sys/time.h>.
-# serial 2
+# serial 4
 
 # Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -19,15 +19,13 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H],
 AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
 [
   AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
   AC_CHECK_HEADERS_ONCE([sys/time.h])
   gl_CHECK_NEXT_HEADERS([sys/time.h])
 
-  if test $ac_cv_header_sys_time_h = yes; then
-    HAVE_SYS_TIME_H=1
-  else
+  if test $ac_cv_header_sys_time_h != yes; then
     HAVE_SYS_TIME_H=0
   fi
-  AC_SUBST([HAVE_SYS_TIME_H])
 
   AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
     [AC_COMPILE_IFELSE(
@@ -40,20 +38,33 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
           [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
        [gl_cv_sys_struct_timeval=yes],
        [gl_cv_sys_struct_timeval=no])])
-  if test $gl_cv_sys_struct_timeval = yes; then
-    HAVE_STRUCT_TIMEVAL=1
-  else
+  if test $gl_cv_sys_struct_timeval != yes; then
     HAVE_STRUCT_TIMEVAL=0
   fi
-  AC_SUBST([HAVE_STRUCT_TIMEVAL])
 
+  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([[
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <time.h>
+    ]], [gettimeofday])
+])
+
+AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
+  GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS],
+[
+  GNULIB_GETTIMEOFDAY=0;     AC_SUBST([GNULIB_GETTIMEOFDAY])
   dnl Assume POSIX behavior unless another module says otherwise.
-  REPLACE_GETTIMEOFDAY=0
-  AC_SUBST([REPLACE_GETTIMEOFDAY])
-  if test $HAVE_SYS_TIME_H = 0 || test $HAVE_STRUCT_TIMEVAL = 0; then
-    SYS_TIME_H=sys/time.h
-  else
-    SYS_TIME_H=
-  fi
-  AC_SUBST([SYS_TIME_H])
+  HAVE_GETTIMEOFDAY=1;       AC_SUBST([HAVE_GETTIMEOFDAY])
+  HAVE_STRUCT_TIMEVAL=1;     AC_SUBST([HAVE_STRUCT_TIMEVAL])
+  HAVE_SYS_TIME_H=1;         AC_SUBST([HAVE_SYS_TIME_H])
+  REPLACE_GETTIMEOFDAY=0;    AC_SUBST([REPLACE_GETTIMEOFDAY])
 ])
index 51b38e3..c954ed8 100644 (file)
@@ -1,5 +1,5 @@
 # Configure a replacement for <sys/times.h>.
-# serial 3
+# serial 4
 
 # Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -24,6 +24,16 @@ AC_DEFUN([gl_SYS_TIMES_H],
     HAVE_STRUCT_TMS=0
   fi
   AC_SUBST([HAVE_SYS_TIMES_H])
+
+  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([[
+/* Some systems have incomplete headers.  */
+#ifndef __GLIBC__
+# include <time.h>
+#endif
+#include <sys/times.h>
+    ]], [times])
 ])
 
 AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR],
index 7833536..bdb5447 100644 (file)
@@ -1,4 +1,4 @@
-# sys_utsname_h.m4 serial 3
+# sys_utsname_h.m4 serial 4
 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -24,6 +24,11 @@ AC_DEFUN([gl_SYS_UTSNAME_H],
       ]])
   fi
   AC_SUBST([HAVE_SYS_UTSNAME_H])
+
+  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 <sys/utsname.h>
+    ]], [uname])
 ])
 
 AC_DEFUN([gl_SYS_UTSNAME_MODULE_INDICATOR],
diff --git a/m4/tanl.m4 b/m4/tanl.m4
new file mode 100644 (file)
index 0000000..0e78505
--- /dev/null
@@ -0,0 +1,76 @@
+# tanl.m4 serial 2
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_TANL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare tanl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  TANL_LIBM=
+  AC_CACHE_CHECK([whether tanl() can be used without linking with libm],
+    [gl_cv_func_tanl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return tanl (x) > 0.4;],
+        [gl_cv_func_tanl_no_libm=yes],
+        [gl_cv_func_tanl_no_libm=no])
+    ])
+  if test $gl_cv_func_tanl_no_libm = no; then
+    AC_CACHE_CHECK([whether tanl() can be used with libm],
+      [gl_cv_func_tanl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return tanl (x) > 0.4;],
+          [gl_cv_func_tanl_in_libm=yes],
+          [gl_cv_func_tanl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_tanl_in_libm = yes; then
+      TANL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_tanl_no_libm = yes \
+     || test $gl_cv_func_tanl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has tanl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([tanl], , [HAVE_DECL_TANL=0], [#include <math.h>])
+  else
+    HAVE_DECL_TANL=0
+    HAVE_TANL=0
+    AC_LIBOBJ([tanl])
+    AC_LIBOBJ([trigl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FLOOR])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    dnl Append $ISNANL_LIBM to TANL_LIBM, avoiding gratuitous duplicates.
+    case " $TANL_LIBM " in
+      *" $ISNANL_LIBM "*) ;;
+      *) TANL_LIBM="$TANL_LIBM $ISNANL_LIBM" ;;
+    esac
+    dnl Append $FLOOR_LIBM to TANL_LIBM, avoiding gratuitous duplicates.
+    case " $TANL_LIBM " in
+      *" $FLOOR_LIBM "*) ;;
+      *) TANL_LIBM="$TANL_LIBM $FLOOR_LIBM" ;;
+    esac
+    dnl Append $FLOORL_LIBM to TANL_LIBM, avoiding gratuitous duplicates.
+    case " $TANL_LIBM " in
+      *" $FLOORL_LIBM "*) ;;
+      *) TANL_LIBM="$TANL_LIBM $FLOORL_LIBM" ;;
+    esac
+  fi
+  AC_SUBST([TANL_LIBM])
+])
index ff522b0..31d31c1 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 36
+# unistd_h.m4 serial 39
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,6 +11,7 @@ AC_DEFUN([gl_UNISTD_H],
   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_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_C_INLINE])
 
   gl_CHECK_NEXT_HEADERS([unistd.h])
 
@@ -21,6 +22,24 @@ AC_DEFUN([gl_UNISTD_H],
     HAVE_UNISTD_H=0
   fi
   AC_SUBST([HAVE_UNISTD_H])
+
+  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 <unistd.h>
+/* Some systems declare various items in the wrong headers.  */
+#ifndef __GLIBC__
+# include <fcntl.h>
+# include <stdio.h>
+# include <stdlib.h>
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+    ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
+    fsync ftruncate getcwd getdomainname getdtablesize getgroups
+    gethostname getlogin getlogin_r getpagesize getusershell setusershell
+    endusershell lchown link linkat lseek pipe2 pread readlink readlinkat
+    rmdir sleep symlink symlinkat unlink unlinkat usleep])
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -48,6 +67,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   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])
@@ -82,6 +102,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_GETDTABLESIZE=1;   AC_SUBST([HAVE_GETDTABLESIZE])
   HAVE_GETGROUPS=1;       AC_SUBST([HAVE_GETGROUPS])
   HAVE_GETHOSTNAME=1;     AC_SUBST([HAVE_GETHOSTNAME])
+  HAVE_GETLOGIN=1;        AC_SUBST([HAVE_GETLOGIN])
   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
   HAVE_GETUSERSHELL=1;    AC_SUBST([HAVE_GETUSERSHELL])
   HAVE_LCHOWN=1;          AC_SUBST([HAVE_LCHOWN])
diff --git a/m4/warn-on-use.m4 b/m4/warn-on-use.m4
new file mode 100644 (file)
index 0000000..42daae8
--- /dev/null
@@ -0,0 +1,45 @@
+# warn-on-use.m4 serial 2
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES)
+# ---------------------------------------
+# For each whitespace-separated element in the list of NAMES, define
+# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES
+# even after being undefined as a macro.
+#
+# See warn-on-use.h for some hints on how to poison function names, as
+# well as ideas on poisoning global variables and macros.  NAMES may
+# include global variables, but remember that only functions work with
+# _GL_WARN_ON_USE.  Typically, INCLUDES only needs to list a single
+# header, but if the replacement header pulls in other headers because
+# some systems declare functions in the wrong header, then INCLUDES
+# should do likewise.
+#
+# If you assume C89, then it is generally safe to assume declarations
+# for functions declared in that standard (such as gets) without
+# needing gl_WARN_ON_USE_PREPARE.
+AC_DEFUN([gl_WARN_ON_USE_PREPARE],
+[
+  m4_foreach_w([gl_decl], [$2],
+    [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])),
+      [Define to 1 if ]m4_defn([gl_decl])[ is declared even after
+       undefining macros.])])dnl
+  for gl_func in m4_flatten([$2]); do
+    AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl
+    AC_CACHE_CHECK([whether $gl_func is declared without a macro],
+      gl_Symbol,
+      [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1],
+[@%:@undef $gl_func
+  (void) $gl_func;])],
+        [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])])
+     AS_VAR_IF(gl_Symbol, [yes],
+       [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1])
+       dnl shortcut - if the raw declaration exists, then set a cache
+       dnl variable to allow skipping any later AC_CHECK_DECL efforts
+       eval ac_cv_have_decl_$gl_func=yes])
+    AS_VAR_POPDEF([gl_Symbol])dnl
+  done
+])
index 2745d73..dad5c1f 100644 (file)
@@ -6,14 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl From Simon Josefsson
 
-# gl_AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
-# ----------------------------------------------------
-# Provide the functionality of AS_VAR_IF if Autoconf does not have it.
-m4_ifdef([AS_VAR_IF],
-[m4_copy([AS_VAR_IF], [gl_AS_VAR_IF])],
-[m4_define([gl_AS_VAR_IF],
-[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
-
 # gl_AS_VAR_APPEND(VAR, VALUE)
 # ----------------------------
 # Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
@@ -37,7 +29,7 @@ AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
   CPPFLAGS="$save_CPPFLAGS"
 ])
 AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl
-gl_AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
+AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
 AS_VAR_POPDEF([gl_Flags])dnl
 AS_VAR_POPDEF([gl_Warn])dnl
 m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
index b2055f9..e81485d 100644 (file)
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 30
+# wchar.m4 serial 31
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -33,6 +33,19 @@ AC_DEFUN([gl_WCHAR_H],
     HAVE_WINT_T=0
   fi
   AC_SUBST([HAVE_WINT_T])
+
+  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([[
+/* Some systems require additional headers.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
+#include <wchar.h>
+    ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
+    wcsrtombs wcsnrtombs wcwidth])
 ])
 
 dnl Check whether <wchar.h> is usable at all.
index c9c04cd..3ab9997 100644 (file)
@@ -19,7 +19,7 @@ AC_CHECK_DECLS_ONCE([alarm])
 
 Makefile.am:
 TESTS += test-file-has-acl.sh test-set-mode-acl.sh test-copy-acl.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' USE_ACL=$(USE_ACL)
+TESTS_ENVIRONMENT += USE_ACL=$(USE_ACL)
 check_PROGRAMS += test-file-has-acl test-set-mode-acl test-copy-acl test-sameacls
 test_file_has_acl_LDADD = $(LDADD) $(LIB_ACL)
 test_set_mode_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@
diff --git a/modules/acos b/modules/acos
new file mode 100644 (file)
index 0000000..cceee87
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+acos() function: inverse cosine function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([acos])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ACOS_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/acos-tests b/modules/acos-tests
new file mode 100644 (file)
index 0000000..93c19d1
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-acos.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-acos
+check_PROGRAMS += test-acos
+test_acos_LDADD = $(LDADD) @ACOS_LIBM@
diff --git a/modules/acosl b/modules/acosl
new file mode 100644 (file)
index 0000000..3c49196
--- /dev/null
@@ -0,0 +1,30 @@
+Description:
+acosl() function: inverse cosine function with long double argument.
+
+Files:
+lib/acosl.c
+m4/acosl.m4
+
+Depends-on:
+math
+extensions
+asinl
+sqrtl
+
+configure.ac:
+gl_FUNC_ACOSL
+gl_MATH_MODULE_INDICATOR([acosl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ACOSL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/acosl-tests b/modules/acosl-tests
new file mode 100644 (file)
index 0000000..c0ea5b9
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-acosl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+fpucw
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-acosl
+check_PROGRAMS += test-acosl
+test_acosl_LDADD = $(LDADD) @ACOSL_LIBM@
index 37c26c2..869be2c 100644 (file)
@@ -4,6 +4,7 @@ tests/test-areadlink.c
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 symlink
 
index 1dddea8..b9b3ded 100644 (file)
@@ -4,6 +4,7 @@ tests/test-areadlink-with-size.c
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 symlink
 
index 45a8d48..422ac61 100644 (file)
@@ -4,6 +4,7 @@ tests/test-areadlinkat.c
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 symlink
 
index 972bc3e..b86d6e7 100644 (file)
@@ -4,6 +4,7 @@ tests/test-areadlinkat-with-size.c
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 
 configure.ac:
index 8879cce..8f92a4d 100644 (file)
@@ -7,6 +7,5 @@ progname
 
 Makefile.am:
 TESTS += test-argp test-argp-2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-argp
 test_argp_LDADD = $(LDADD) @LIBINTL@
index eeed143..c4451a2 100644 (file)
@@ -9,6 +9,5 @@ version-etc-fsf
 
 Makefile.am:
 TESTS += test-argp-version-etc test-argp-version-etc-1.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-argp-version-etc
 test_argp_version_etc_LDADD = $(LDADD) @LIBINTL@
index 27eccc3..09eaee5 100644 (file)
@@ -6,10 +6,10 @@ lib/arpa_inet.in.h
 m4/arpa_inet_h.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
 sys_socket
+warn-on-use
 
 configure.ac:
 gl_HEADER_ARPA_INET
@@ -20,7 +20,7 @@ BUILT_SOURCES += arpa/inet.h
 
 # We need the following in order to create <arpa/inet.h> when the system
 # doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+arpa/inet.h: arpa_inet.in.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! */'; \
@@ -32,8 +32,8 @@ arpa/inet.h: arpa_inet.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
              -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
              -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/arpa_inet.in.h; \
        } > $@-t && \
        mv $@-t $@
diff --git a/modules/asin b/modules/asin
new file mode 100644 (file)
index 0000000..e6c496b
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+asin() function: inverse sine function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([asin])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ASIN_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/asin-tests b/modules/asin-tests
new file mode 100644 (file)
index 0000000..a6ffbe5
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-asin.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-asin
+check_PROGRAMS += test-asin
+test_asin_LDADD = $(LDADD) @ASIN_LIBM@
diff --git a/modules/asinl b/modules/asinl
new file mode 100644 (file)
index 0000000..7f254ab
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+asinl() function: inverse sine function with long double argument.
+
+Files:
+lib/asinl.c
+m4/asinl.m4
+
+Depends-on:
+math
+extensions
+sqrtl
+
+configure.ac:
+gl_FUNC_ASINL
+gl_MATH_MODULE_INDICATOR([asinl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ASINL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/asinl-tests b/modules/asinl-tests
new file mode 100644 (file)
index 0000000..b111212
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-asinl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+fpucw
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-asinl
+check_PROGRAMS += test-asinl
+test_asinl_LDADD = $(LDADD) @ASINL_LIBM@
diff --git a/modules/atan b/modules/atan
new file mode 100644 (file)
index 0000000..9c59601
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+atan() function: inverse tangent function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([atan])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ATAN_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/atan-tests b/modules/atan-tests
new file mode 100644 (file)
index 0000000..bdd5605
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-atan.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-atan
+check_PROGRAMS += test-atan
+test_atan_LDADD = $(LDADD) @ATAN_LIBM@
diff --git a/modules/atan2 b/modules/atan2
new file mode 100644 (file)
index 0000000..877cc6b
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+atan2() function: angle of a point in the plane.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([atan2])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ATAN2_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/atan2-tests b/modules/atan2-tests
new file mode 100644 (file)
index 0000000..08ca367
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-atan2.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-atan2
+check_PROGRAMS += test-atan2
+test_atan2_LDADD = $(LDADD) @ATAN2_LIBM@
diff --git a/modules/atanl b/modules/atanl
new file mode 100644 (file)
index 0000000..f6ba1b8
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+atanl() function: inverse tangent function with long double argument.
+
+Files:
+lib/atanl.c
+m4/atanl.m4
+
+Depends-on:
+math
+extensions
+isnanl
+
+configure.ac:
+gl_FUNC_ATANL
+gl_MATH_MODULE_INDICATOR([atanl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ATANL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/atanl-tests b/modules/atanl-tests
new file mode 100644 (file)
index 0000000..79fe52f
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-atanl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+fpucw
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-atanl
+check_PROGRAMS += test-atanl
+test_atanl_LDADD = $(LDADD) @ATANL_LIBM@
index 15de834..82d6ae4 100644 (file)
@@ -10,5 +10,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-atexit.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-atexit
index e59f056..86422e6 100644 (file)
@@ -9,6 +9,5 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-binary-io.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-binary-io
 
index 371bde9..cac7e61 100644 (file)
@@ -15,6 +15,6 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-btowc1.sh test-btowc2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-btowc
 
index 808e59e..8174862 100644 (file)
@@ -11,7 +11,7 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-c-stack.sh test-c-stack2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LIBSIGSEGV='@LIBSIGSEGV@'
+TESTS_ENVIRONMENT += LIBSIGSEGV='@LIBSIGSEGV@'
 check_PROGRAMS += test-c-stack
 test_c_stack_LDADD = $(LDADD) $(LIBCSTACK) @LIBINTL@
 MOSTLYCLEANFILES += t-c-stack.tmp t-c-stack2.tmp
index aec09db..aec55d2 100644 (file)
@@ -15,5 +15,5 @@ gt_LOCALE_TR_UTF8
 
 Makefile.am:
 TESTS += test-c-strcase.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
 check_PROGRAMS += test-c-strcasecmp test-c-strncasecmp
index bc07ea3..fd49d69 100644 (file)
@@ -4,6 +4,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 same-inode
 symlink
 
index fb18d66..9b5acd8 100644 (file)
@@ -3,6 +3,7 @@ tests/test-canonicalize.c
 tests/macros.h
 
 Depends-on:
+ignore-value
 progname
 same-inode
 symlink
diff --git a/modules/cbrt b/modules/cbrt
new file mode 100644 (file)
index 0000000..fe015ee
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+cbrt() function: cube root.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([cbrt])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(CBRT_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/cbrt-tests b/modules/cbrt-tests
new file mode 100644 (file)
index 0000000..47248e0
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-cbrt.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-cbrt
+check_PROGRAMS += test-cbrt
+test_cbrt_LDADD = $(LDADD) @CBRT_LIBM@
index 68f74f0..359ba1b 100644 (file)
@@ -6,6 +6,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 lstat
 mgetgroups
 progname
index 57c8f91..2f3f689 100644 (file)
@@ -4,11 +4,11 @@ tests/test-closein.c
 
 Depends-on:
 binary-io
+ignore-value
 
 configure.ac:
 
 Makefile.am:
 TESTS += test-closein.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-closein
 test_closein_LDADD = $(LDADD) @LIBINTL@
index c4fe4fd..ab7f632 100644 (file)
@@ -14,6 +14,6 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-copy-file.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' USE_ACL=$(USE_ACL)
+TESTS_ENVIRONMENT += USE_ACL=$(USE_ACL)
 check_PROGRAMS += test-copy-file
 test_copy_file_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@
diff --git a/modules/copysign b/modules/copysign
new file mode 100644 (file)
index 0000000..c632806
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+copysign() function: copy sign.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([copysign])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(COPYSIGN_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/copysign-tests b/modules/copysign-tests
new file mode 100644 (file)
index 0000000..44f1d81
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-copysign.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-copysign
+check_PROGRAMS += test-copysign
+test_copysign_LDADD = $(LDADD) @COPYSIGN_LIBM@
diff --git a/modules/cos b/modules/cos
new file mode 100644 (file)
index 0000000..eae9a4d
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+cos() function: cosine function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([cos])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(COS_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/cos-tests b/modules/cos-tests
new file mode 100644 (file)
index 0000000..ab46a25
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-cos.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-cos
+check_PROGRAMS += test-cos
+test_cos_LDADD = $(LDADD) @COS_LIBM@
diff --git a/modules/cosh b/modules/cosh
new file mode 100644 (file)
index 0000000..4fd5c3a
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+cosh() function: hyperbolic cosine function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([cosh])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(COSH_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/cosh-tests b/modules/cosh-tests
new file mode 100644 (file)
index 0000000..88af9d7
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-cosh.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-cosh
+check_PROGRAMS += test-cosh
+test_cosh_LDADD = $(LDADD) @COSH_LIBM@
diff --git a/modules/cosl b/modules/cosl
new file mode 100644 (file)
index 0000000..88ebf9c
--- /dev/null
@@ -0,0 +1,35 @@
+Description:
+cosl() function: cosine function with long double argument.
+
+Files:
+lib/cosl.c
+lib/trigl.h
+lib/sincosl.c
+lib/trigl.c
+m4/cosl.m4
+
+Depends-on:
+math
+extensions
+float
+isnanl
+floor
+floorl
+
+configure.ac:
+gl_FUNC_COSL
+gl_MATH_MODULE_INDICATOR([cosl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ACOSL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/cosl-tests b/modules/cosl-tests
new file mode 100644 (file)
index 0000000..846f330
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-cosl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+fpucw
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-cosl
+check_PROGRAMS += test-cosl
+test_cosl_LDADD = $(LDADD) @COSL_LIBM@
index 8847f2c..2cd1fb0 100644 (file)
@@ -7,7 +7,7 @@ m4/ctype.m4
 
 Depends-on:
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_CTYPE_H
@@ -17,7 +17,7 @@ BUILT_SOURCES += ctype.h
 
 # We need the following in order to create <ctype.h> when the system
 # doesn't have one that works with the given compiler.
-ctype.h: ctype.in.h $(LINK_WARNING_H)
+ctype.h: ctype.in.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' \
@@ -25,7 +25,7 @@ ctype.h: ctype.in.h $(LINK_WARNING_H)
              -e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \
              -e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \
              -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/ctype.in.h; \
        } > $@-t && \
        mv $@-t $@
index 5a92d5d..0e75c7b 100644 (file)
@@ -7,9 +7,9 @@ m4/dirent_h.m4
 m4/unistd_h.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
+warn-on-use
 
 configure.ac:
 gl_DIRENT_H
@@ -19,7 +19,7 @@ BUILT_SOURCES += dirent.h
 
 # We need the following in order to create <dirent.h> when the system
 # doesn't have one that works with the given compiler.
-dirent.h: dirent.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+dirent.h: dirent.in.h $(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' \
@@ -36,8 +36,8 @@ dirent.h: dirent.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_CLOSEDIR''@|$(REPLACE_CLOSEDIR)|g' \
              -e 's|@''REPLACE_FDOPENDIR''@|$(REPLACE_FDOPENDIR)|g' \
              -e 's|@''REPLACE_OPENDIR''@|$(REPLACE_OPENDIR)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/dirent.in.h; \
        } > $@-t && \
        mv $@-t $@
index 2bc9593..172c662 100644 (file)
@@ -10,3 +10,6 @@ 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)
index e4df83d..a60f8ed 100644 (file)
@@ -15,5 +15,4 @@ AC_CHECK_FUNCS_ONCE([getrlimit setrlimit])
 
 Makefile.am:
 TESTS += test-dprintf-posix.sh test-dprintf-posix2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-dprintf-posix test-dprintf-posix2
diff --git a/modules/erf b/modules/erf
new file mode 100644 (file)
index 0000000..551dddb
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+erf() function: error function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([erf])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ERF_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/erf-tests b/modules/erf-tests
new file mode 100644 (file)
index 0000000..9881649
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-erf.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-erf
+check_PROGRAMS += test-erf
+test_erf_LDADD = $(LDADD) @ERF_LIBM@
diff --git a/modules/erfc b/modules/erfc
new file mode 100644 (file)
index 0000000..d891e92
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+erfc() function: complementary error function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([erfc])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ERFC_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/erfc-tests b/modules/erfc-tests
new file mode 100644 (file)
index 0000000..08baf53
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-erfc.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-erfc
+check_PROGRAMS += test-erfc
+test_erfc_LDADD = $(LDADD) @ERFC_LIBM@
index bf329c6..93333f5 100644 (file)
@@ -25,7 +25,7 @@ Link:
 $(LIB_EACCESS)
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Jim Meyering, glibc
index 57b876c..ba265ed 100644 (file)
@@ -23,6 +23,5 @@ TESTS += \
  test-exclude6.sh\
  test-exclude7.sh
 
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-exclude
 test_exclude_LDADD = $(LDADD) @LIBINTL@
index 4de69b7..18899f2 100644 (file)
@@ -1,6 +1,12 @@
 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:
@@ -14,8 +20,7 @@ Include:
 <stdlib.h>
 
 License:
-GPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
-
index 26f5a92..641f99d 100644 (file)
@@ -4,21 +4,20 @@ Set exit status for fatal signal.
 Files:
 lib/exitfail.h
 lib/exitfail.c
-m4/exitfail.m4
 
 Depends-on:
 exit
 
 configure.ac:
-gl_EXITFAIL
 
 Makefile.am:
+lib_SOURCES += exitfail.c
 
 Include:
 "exitfail.h"
 
 License:
-GPL
+LGPLv2+
 
 Maintainer:
 Paul Eggert
diff --git a/modules/exp b/modules/exp
new file mode 100644 (file)
index 0000000..f90548a
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+exp() function: exponential function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([exp])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(EXP_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/exp-tests b/modules/exp-tests
new file mode 100644 (file)
index 0000000..1338861
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-exp.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-exp
+check_PROGRAMS += test-exp
+test_exp_LDADD = $(LDADD) @EXP_LIBM@
diff --git a/modules/expl b/modules/expl
new file mode 100644 (file)
index 0000000..3870440
--- /dev/null
@@ -0,0 +1,30 @@
+Description:
+expl() function: exponential function with long double argument.
+
+Files:
+lib/expl.c
+m4/expl.m4
+
+Depends-on:
+math
+extensions
+float
+floorl
+
+configure.ac:
+gl_FUNC_EXPL
+gl_MATH_MODULE_INDICATOR([expl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(EXPL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/expl-tests b/modules/expl-tests
new file mode 100644 (file)
index 0000000..bc7b28a
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-expl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+fpucw
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-expl
+check_PROGRAMS += test-expl
+test_expl_LDADD = $(LDADD) @EXPL_LIBM@
diff --git a/modules/fabs b/modules/fabs
new file mode 100644 (file)
index 0000000..8b70430
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+fabs() function: absolute value.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_MATHFUNC([fabs], [double], [(double)])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(FABS_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/fabs-tests b/modules/fabs-tests
new file mode 100644 (file)
index 0000000..b716159
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-fabs.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fabs
+check_PROGRAMS += test-fabs
+test_fabs_LDADD = $(LDADD) @FABS_LIBM@
index 67f67f9..addd6ba 100644 (file)
@@ -8,6 +8,7 @@ lib/fcntl.c
 Depends-on:
 dup2
 fcntl-h
+getdtablesize
 extensions
 
 configure.ac:
index 86db457..e25c155 100644 (file)
@@ -7,11 +7,11 @@ m4/fcntl_h.m4
 m4/fcntl-o.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
-unistd
 extensions
+include_next
+unistd
+warn-on-use
 
 configure.ac:
 gl_FCNTL_H
@@ -21,7 +21,7 @@ BUILT_SOURCES += fcntl.h
 
 # We need the following in order to create <fcntl.h> when the system
 # doesn't have one that works with the given compiler.
-fcntl.h: fcntl.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+fcntl.h: fcntl.in.h $(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' \
@@ -35,8 +35,8 @@ fcntl.h: fcntl.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
              -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
              -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/fcntl.in.h; \
        } > $@-t && \
        mv $@-t $@
index dc55c45..48ea78d 100644 (file)
@@ -8,6 +8,7 @@ tests/test-fdutimensat.c
 tests/macros.h
 
 Depends-on:
+ignore-value
 progname
 timespec
 usleep
index e439c2c..a447521 100644 (file)
@@ -13,6 +13,5 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-fflush test-fflush2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-fflush test-fflush2
 MOSTLYCLEANFILES += test-fflush.txt
diff --git a/modules/fmod b/modules/fmod
new file mode 100644 (file)
index 0000000..ae82f4b
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+fmod() function: floating-point remainder function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([fmod])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(FMOD_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/fmod-tests b/modules/fmod-tests
new file mode 100644 (file)
index 0000000..7d9c7f3
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-fmod.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fmod
+check_PROGRAMS += test-fmod
+test_fmod_LDADD = $(LDADD) @FMOD_LIBM@
index bc8394c..31568e2 100644 (file)
@@ -9,6 +9,5 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-fpending.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-fpending
 MOSTLYCLEANFILES += test-fpending.t
index 1473544..3eebaf9 100644 (file)
@@ -18,5 +18,4 @@ AC_CHECK_FUNCS_ONCE([getrlimit setrlimit])
 
 Makefile.am:
 TESTS += test-fprintf-posix.sh test-fprintf-posix2.sh test-fprintf-posix3.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-fprintf-posix test-fprintf-posix2 test-fprintf-posix3
index 13e95cd..1b53268 100644 (file)
@@ -11,5 +11,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-freadahead.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-freadahead
index 783aea7..f8bf1bc 100644 (file)
@@ -13,5 +13,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-freadptr.sh test-freadptr2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-freadptr test-freadptr2
index e89607a..d101582 100644 (file)
@@ -10,5 +10,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-freadseek.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-freadseek
index 6de889b..45fe959 100644 (file)
@@ -13,5 +13,4 @@ gl_FUNC_UNGETC_WORKS
 
 Makefile.am:
 TESTS += test-fseek.sh test-fseek2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-fseek
index 1359970..178e873 100644 (file)
@@ -13,5 +13,4 @@ gl_FUNC_UNGETC_WORKS
 
 Makefile.am:
 TESTS += test-fseeko.sh test-fseeko2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-fseeko
index c669a98..c944ca9 100644 (file)
@@ -14,5 +14,4 @@ gl_FUNC_UNGETC_WORKS
 
 Makefile.am:
 TESTS += test-ftell.sh test-ftell2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-ftell
index 73f659e..c20381c 100644 (file)
@@ -14,5 +14,4 @@ gl_FUNC_UNGETC_WORKS
 
 Makefile.am:
 TESTS += test-ftello.sh test-ftello2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-ftello
index 330711d..124b62f 100644 (file)
@@ -7,6 +7,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 timespec
 usleep
 utimecmp
diff --git a/modules/getlogin b/modules/getlogin
new file mode 100644 (file)
index 0000000..1e0c77a
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+getlogin() function: Get user name.
+
+Files:
+lib/getlogin.c
+m4/getlogin.m4
+
+Depends-on:
+unistd
+
+configure.ac:
+gl_GETLOGIN
+gl_UNISTD_MODULE_INDICATOR([getlogin])
+
+Makefile.am:
+
+Include:
+<unistd.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/getlogin-tests b/modules/getlogin-tests
new file mode 100644 (file)
index 0000000..795fba7
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/test-getlogin.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-getlogin
+check_PROGRAMS += test-getlogin
index 0913cf1..979f601 100644 (file)
@@ -10,6 +10,7 @@ sys_time
 
 configure.ac:
 gl_FUNC_GETTIMEOFDAY
+gl_SYS_TIME_MODULE_INDICATOR([gettimeofday])
 
 Makefile.am:
 
index 94d584e..d0e2ad0 100644 (file)
@@ -28,7 +28,7 @@ configure.ac:
 
 Makefile.am:
 bin_PROGRAMS = git-merge-changelog
-git_merge_changelog_LDADD = libgnu.a @LIBINTL@
+git_merge_changelog_LDADD = libgnu.a @LIBINTL@ $(LIBTHREAD)
 
 Include:
 
diff --git a/modules/hypot b/modules/hypot
new file mode 100644 (file)
index 0000000..fc13752
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+hypot() function: length of a vector in the plane.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([hypot])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(HYPOT_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/hypot-tests b/modules/hypot-tests
new file mode 100644 (file)
index 0000000..f4b65d0
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-hypot.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-hypot
+check_PROGRAMS += test-hypot
+test_hypot_LDADD = $(LDADD) @HYPOT_LIBM@
index 5416463..18596b2 100644 (file)
@@ -16,5 +16,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-idpriv-drop.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-idpriv-drop
index d6c2097..44c3c4d 100644 (file)
@@ -16,5 +16,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-idpriv-droptemp.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-idpriv-droptemp
index 8417d06..8d48863 100644 (file)
@@ -13,10 +13,10 @@ Makefile.am:
 lib_SOURCES += ignore-value.h
 
 Include:
-<ignore-value.h>
+"ignore-value.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Jim Meyering
index 743add4..d0bbefc 100644 (file)
@@ -7,11 +7,11 @@ m4/inttypes-pri.m4
 m4/inttypes.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
 multiarch
 stdint
+warn-on-use
 
 configure.ac:
 gl_INTTYPES_H
@@ -21,7 +21,7 @@ BUILT_SOURCES += inttypes.h
 
 # We need the following in order to create <inttypes.h> when the system
 # doesn't have one that works with the given compiler.
-inttypes.h: inttypes.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+inttypes.h: inttypes.in.h $(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' \
@@ -45,8 +45,8 @@ inttypes.h: inttypes.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -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_LINK_WARNING/r $(LINK_WARNING_H)' \
              -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 $@
diff --git a/modules/j0 b/modules/j0
new file mode 100644 (file)
index 0000000..b06d76d
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+j0() function: Bessel function of the first kind of order 0.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([j0])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(J0_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/j0-tests b/modules/j0-tests
new file mode 100644 (file)
index 0000000..eec1438
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-j0.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-j0
+check_PROGRAMS += test-j0
+test_j0_LDADD = $(LDADD) @J0_LIBM@
diff --git a/modules/j1 b/modules/j1
new file mode 100644 (file)
index 0000000..9c18914
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+j1() function: Bessel function of the first kind of order 1.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([j1])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(J1_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/j1-tests b/modules/j1-tests
new file mode 100644 (file)
index 0000000..ad94ecd
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-j1.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-j1
+check_PROGRAMS += test-j1
+test_j1_LDADD = $(LDADD) @J1_LIBM@
diff --git a/modules/jn b/modules/jn
new file mode 100644 (file)
index 0000000..adcc9b1
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+jn() function: Bessel function of the first kind of order n.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([jn])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(JN_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/jn-tests b/modules/jn-tests
new file mode 100644 (file)
index 0000000..b5bb49d
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-jn.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-jn
+check_PROGRAMS += test-jn
+test_jn_LDADD = $(LDADD) @JN_LIBM@
index cc71779..07d4e47 100644 (file)
@@ -8,7 +8,7 @@ m4/langinfo_h.m4
 Depends-on:
 extensions
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_LANGINFO_H
@@ -18,7 +18,7 @@ BUILT_SOURCES += langinfo.h
 
 # We need the following in order to create an empty placeholder for
 # <langinfo.h> when the system doesn't have one.
-langinfo.h: langinfo.in.h $(LINK_WARNING_H)
+langinfo.h: langinfo.in.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' \
@@ -30,7 +30,7 @@ langinfo.h: langinfo.in.h $(LINK_WARNING_H)
              -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \
              -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \
              -e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/langinfo.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -40,7 +40,7 @@ Include:
 <langinfo.h>
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index f3935d6..72ab3c1 100644 (file)
@@ -6,6 +6,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 mgetgroups
 progname
 usleep
diff --git a/modules/ldexp b/modules/ldexp
new file mode 100644 (file)
index 0000000..20818ed
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+ldexp() function: multiply a 'double' by a power of 2.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_MATHFUNC([ldexp], [double], [(double, int)])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(LDEXP_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/ldexp-tests b/modules/ldexp-tests
new file mode 100644 (file)
index 0000000..e5d796c
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-ldexp.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-ldexp
+check_PROGRAMS += test-ldexp
+test_ldexp_LDADD = $(LDADD) @LDEXP_LIBM@
diff --git a/modules/lgamma b/modules/lgamma
new file mode 100644 (file)
index 0000000..81d1704
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+lgamma() function: log of gamma function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([lgamma])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(LGAMMA_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/lgamma-tests b/modules/lgamma-tests
new file mode 100644 (file)
index 0000000..b5e91bb
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-lgamma.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-lgamma
+check_PROGRAMS += test-lgamma
+test_lgamma_LDADD = $(LDADD) @LGAMMA_LIBM@
index 6dc6946..8fe1c32 100644 (file)
@@ -14,7 +14,7 @@ Makefile.am:
 Include:
 
 License:
-GPL
+unlimited
 
 Maintainer:
 Paul Eggert and Jim Meyering
index b7fb2ff..5b1978e 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 errno
 stdbool
 sys_stat
index 602d18a..6df4781 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 areadlink-with-size
 filenamecat
 progname
index 75d1eaf..2577468 100644 (file)
@@ -6,11 +6,11 @@ lib/locale.in.h
 m4/locale_h.m4
 
 Depends-on:
-include_next
 arg-nonnull
 extensions
-link-warning
+include_next
 stddef
+warn-on-use
 
 configure.ac:
 gl_LOCALE_H
@@ -20,7 +20,7 @@ BUILT_SOURCES += locale.h
 
 # We need the following in order to create <locale.h> when the system
 # doesn't have one that provides all definitions.
-locale.h: locale.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+locale.h: locale.in.h $(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' \
@@ -29,8 +29,8 @@ locale.h: locale.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \
              -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
              -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/locale.in.h; \
        } > $@-t && \
        mv $@-t $@
diff --git a/modules/log b/modules/log
new file mode 100644 (file)
index 0000000..cbee37b
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+log() function: natural logarithmic function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([log])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(LOG_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/log-tests b/modules/log-tests
new file mode 100644 (file)
index 0000000..d3f5adb
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-log.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-log
+check_PROGRAMS += test-log
+test_log_LDADD = $(LDADD) @LOG_LIBM@
diff --git a/modules/log10 b/modules/log10
new file mode 100644 (file)
index 0000000..a0b4c29
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+log10() function: base 10 logarithmic function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([log10])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(LOG10_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/log10-tests b/modules/log10-tests
new file mode 100644 (file)
index 0000000..5fc6e6b
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-log10.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-log10
+check_PROGRAMS += test-log10
+test_log10_LDADD = $(LDADD) @LOG10_LIBM@
diff --git a/modules/log1p b/modules/log1p
new file mode 100644 (file)
index 0000000..955893b
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+log1p() function: natural logarithm of 1 plus argument.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([log1p])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(LOG1P_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/log1p-tests b/modules/log1p-tests
new file mode 100644 (file)
index 0000000..f0fff09
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-log1p.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-log1p
+check_PROGRAMS += test-log1p
+test_log1p_LDADD = $(LDADD) @LOG1P_LIBM@
diff --git a/modules/logb b/modules/logb
new file mode 100644 (file)
index 0000000..8816840
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+logb() function: get exponent.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_MATHFUNC([logb], [double], [(double)])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(LOGB_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/logb-tests b/modules/logb-tests
new file mode 100644 (file)
index 0000000..f949070
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-logb.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-logb
+check_PROGRAMS += test-logb
+test_logb_LDADD = $(LDADD) @LOGB_LIBM@
diff --git a/modules/logl b/modules/logl
new file mode 100644 (file)
index 0000000..c9b7237
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+logl() function: logarithm with long double argument.
+
+Files:
+lib/logl.c
+m4/logl.m4
+
+Depends-on:
+math
+extensions
+frexpl
+isnanl
+floorl
+
+configure.ac:
+gl_FUNC_LOGL
+gl_MATH_MODULE_INDICATOR([logl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(LOGL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/logl-tests b/modules/logl-tests
new file mode 100644 (file)
index 0000000..805a3c4
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-logl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+fpucw
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-logl
+check_PROGRAMS += test-logl
+test_logl_LDADD = $(LDADD) @LOGL_LIBM@
index fa9a1ab..890a87f 100644 (file)
@@ -10,5 +10,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-lseek.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-lseek
index a0296a6..911a7ff 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 errno
 same-inode
 stdbool
index 21c2802..ed43e87 100644 (file)
@@ -9,6 +9,10 @@ gnumakefile
 useless-if-before-free
 vc-list-files
 
+configure.ac:
+AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
+  [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
+
 License:
 GPLed build tool
 
index 0e2bc0b..0ffeff4 100644 (file)
@@ -6,9 +6,9 @@ lib/math.in.h
 m4/math_h.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
+warn-on-use
 
 configure.ac:
 gl_MATH_H
@@ -18,14 +18,19 @@ BUILT_SOURCES += math.h
 
 # We need the following in order to create <math.h> when the system
 # doesn't have one that works with the given compiler.
-math.h: math.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+math.h: math.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_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' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
+             -e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \
+             -e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \
+             -e 's|@''GNULIB_ATANL''@|$(GNULIB_ATANL)|g' \
              -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \
              -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \
+             -e 's|@''GNULIB_COSL''@|$(GNULIB_COSL)|g' \
+             -e 's|@''GNULIB_EXPL''@|$(GNULIB_EXPL)|g' \
              -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \
              -e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \
              -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \
@@ -37,17 +42,29 @@ math.h: math.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_ISNAND''@|$(GNULIB_ISNAND)|g' \
              -e 's|@''GNULIB_ISNANL''@|$(GNULIB_ISNANL)|g' \
              -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \
-             -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \
+             -e 's|@''GNULIB_LOGL''@|$(GNULIB_LOGL)|g' \
              -e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \
              -e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \
              -e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \
              -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \
+             -e 's|@''GNULIB_SINL''@|$(GNULIB_SINL)|g' \
+             -e 's|@''GNULIB_SQRTL''@|$(GNULIB_SQRTL)|g' \
+             -e 's|@''GNULIB_TANL''@|$(GNULIB_TANL)|g' \
              -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \
              -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \
              -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \
+             -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
+             -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
+             -e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
+             -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
+             -e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
              -e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
              -e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
              -e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
+             -e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \
+             -e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \
+             -e 's|@''HAVE_SQRTL''@|$(HAVE_SQRTL)|g' \
+             -e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \
              -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
              -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
              -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
@@ -79,8 +96,8 @@ math.h: math.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \
              -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
              -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/math.in.h; \
        } > $@-t && \
        mv $@-t $@
index 0b3018e..ac0a27e 100644 (file)
@@ -2,35 +2,35 @@ Description:
 C99 functions for transcendental functions with long double arguments.
 
 Files:
-lib/acosl.c
-lib/asinl.c
-lib/atanl.c
-lib/cosl.c
-lib/expl.c
-lib/logl.c
-lib/sincosl.c
-lib/sinl.c
-lib/sqrtl.c
-lib/tanl.c
-lib/trigl.c
-lib/trigl.h
-m4/mathl.m4
 
 Depends-on:
-float
-math
-frexpl
-isnanl
-ldexpl
 floorl
 ceill
+acosl
+asinl
+atanl
+cosl
+expl
+logl
+sinl
+sqrtl
+tanl
 
 configure.ac:
-gl_FUNC_LONG_DOUBLE_MATH
-gl_MATH_MODULE_INDICATOR([mathl])
+AC_REQUIRE([gl_FUNC_FLOORL])
+AC_REQUIRE([gl_FUNC_CEILL])
+AC_REQUIRE([gl_FUNC_ACOSL])
+AC_REQUIRE([gl_FUNC_ASINL])
+AC_REQUIRE([gl_FUNC_ATANL])
+AC_REQUIRE([gl_FUNC_COSL])
+AC_REQUIRE([gl_FUNC_EXPL])
+AC_REQUIRE([gl_FUNC_LOGL])
+AC_REQUIRE([gl_FUNC_SINL])
+AC_REQUIRE([gl_FUNC_SQRTL])
+AC_REQUIRE([gl_FUNC_TANL])
+LIBS="$LIBS $FLOORL_LIBM $CEILL_LIBM $ACOSL_LIBM $ASINL_LIBM $ATANL_LIBM $ACOSL_LIBM $EXPL_LIBM $LOGL_LIBM $SINL_LIBM $SQRTL_LIBM $TANL_LIBM"
 
 Makefile.am:
-noinst_HEADERS += trigl.h trigl.c sincosl.c
 
 Include:
 <math.h>
index e4db04d..05d6c7f 100644 (file)
@@ -20,7 +20,6 @@ gt_LOCALE_TR_UTF8
 Makefile.am:
 TESTS += test-mbmemcasecmp1.sh test-mbmemcasecmp2.sh test-mbmemcasecmp3.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
index 82f117f..e2cc524 100644 (file)
@@ -20,7 +20,6 @@ gt_LOCALE_TR_UTF8
 Makefile.am:
 TESTS += test-mbmemcasecoll1.sh test-mbmemcasecoll2.sh test-mbmemcasecoll3.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
index e97ff2f..d9c0d18 100644 (file)
@@ -24,7 +24,6 @@ gt_LOCALE_ZH_CN
 Makefile.am:
 TESTS += test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_JA='@LOCALE_JA@' \
index 572c838..9e89bfe 100644 (file)
@@ -12,6 +12,6 @@ gt_LOCALE_TR_UTF8
 
 Makefile.am:
 TESTS += test-mbscasecmp.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
 check_PROGRAMS += test-mbscasecmp
 
index 4c6b474..30f0919 100644 (file)
@@ -21,6 +21,6 @@ gt_LOCALE_ZH_CN
 
 Makefile.am:
 TESTS += test-mbscasestr1 test-mbscasestr2.sh test-mbscasestr3.sh test-mbscasestr4.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
+TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbscasestr1 test-mbscasestr2 test-mbscasestr3 test-mbscasestr4
 
index e084423..a26d8dd 100644 (file)
@@ -12,6 +12,6 @@ gt_LOCALE_ZH_CN
 
 Makefile.am:
 TESTS += test-mbschr.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
+TESTS_ENVIRONMENT += LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbschr
 
index bdb8e6a..f31e347 100644 (file)
@@ -12,6 +12,6 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-mbscspn.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-mbscspn
 
index 8ee370e..3a8a7a0 100644 (file)
@@ -14,6 +14,6 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-mbsinit.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-mbsinit
 
index cdfe377..81b8ba9 100644 (file)
@@ -12,6 +12,6 @@ gt_LOCALE_TR_UTF8
 
 Makefile.am:
 TESTS += test-mbsncasecmp.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
 check_PROGRAMS += test-mbsncasecmp
 
index 378d2a2..1d43beb 100644 (file)
@@ -25,7 +25,6 @@ gt_LOCALE_ZH_CN
 Makefile.am:
 TESTS += test-mbsnrtowcs1.sh test-mbsnrtowcs2.sh test-mbsnrtowcs3.sh test-mbsnrtowcs4.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_JA='@LOCALE_JA@' \
index 5582121..d22cf19 100644 (file)
@@ -12,6 +12,6 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-mbspbrk.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-mbspbrk
 
index aab12ca..0b1c7d3 100644 (file)
@@ -12,6 +12,6 @@ gt_LOCALE_TR_UTF8
 
 Makefile.am:
 TESTS += test-mbspcasecmp.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
 check_PROGRAMS += test-mbspcasecmp
 
index 64d3603..70d7c20 100644 (file)
@@ -12,6 +12,6 @@ gt_LOCALE_ZH_CN
 
 Makefile.am:
 TESTS += test-mbsrchr.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
+TESTS_ENVIRONMENT += LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbsrchr
 
index 3d7ed88..4b05e52 100644 (file)
@@ -25,7 +25,6 @@ gt_LOCALE_ZH_CN
 Makefile.am:
 TESTS += test-mbsrtowcs1.sh test-mbsrtowcs2.sh test-mbsrtowcs3.sh test-mbsrtowcs4.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_JA='@LOCALE_JA@' \
index 95da3f2..ace5c76 100644 (file)
@@ -12,6 +12,6 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-mbsspn.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-mbsspn
 
index c36c02d..21a8590 100644 (file)
@@ -17,6 +17,6 @@ gt_LOCALE_ZH_CN
 
 Makefile.am:
 TESTS += test-mbsstr1 test-mbsstr2.sh test-mbsstr3.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
+TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbsstr1 test-mbsstr2 test-mbsstr3
 
index 5f455c7..fea1b63 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 symlink
 
index 1f92a41..00ca98f 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 symlink
 
index 5e72b94..8be33df 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 symlink
 
 configure.ac:
index c273f66..e35ffec 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 symlink
 
diff --git a/modules/modf b/modules/modf
new file mode 100644 (file)
index 0000000..0c5e467
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+modf() function: get signed integer and fractional parts.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_MATHFUNC([modf], [double], [(double, double *)])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(MODF_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/modf-tests b/modules/modf-tests
new file mode 100644 (file)
index 0000000..24e483d
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-modf.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-modf
+check_PROGRAMS += test-modf
+test_modf_LDADD = $(LDADD) @MODF_LIBM@
diff --git a/modules/nextafter b/modules/nextafter
new file mode 100644 (file)
index 0000000..ed93418
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+nextafter() function: next representable 'double' number.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_MATHFUNC([nextafter], [double], [(double)])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(NEXTAFTER_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/nextafter-tests b/modules/nextafter-tests
new file mode 100644 (file)
index 0000000..1bb372a
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-nextafter.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-nextafter
+check_PROGRAMS += test-nextafter
+test_nextafter_LDADD = $(LDADD) @NEXTAFTER_LIBM@
index 2f153d7..7813345 100644 (file)
@@ -18,7 +18,7 @@ Include:
 <langinfo.h>
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
index 944b1d0..dcb0af9 100644 (file)
@@ -14,5 +14,5 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-nl_langinfo.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-nl_langinfo
index 489601c..250a574 100644 (file)
@@ -16,6 +16,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 mgetgroups
 pathmax
 usleep
index 81094de..b561a38 100644 (file)
@@ -10,6 +10,5 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-parse-duration.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-parse-duration
 test_parse_duration_LDADD = $(LDADD) @LIBINTL@
index ca9a921..867f920 100644 (file)
@@ -9,5 +9,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-perror.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-perror
index 263c766..e5da562 100644 (file)
@@ -19,7 +19,6 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-pipe-filter-gi1.sh test-pipe-filter-gi2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-pipe-filter-gi1 test-pipe-filter-gi2-main test-pipe-filter-gi2-child
 test_pipe_filter_gi1_LDADD = $(LDADD) @LIBINTL@
 test_pipe_filter_gi2_main_LDADD = $(LDADD) @LIBINTL@
index abb5fef..236de13 100644 (file)
@@ -18,7 +18,6 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-pipe-filter-ii1.sh test-pipe-filter-ii2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-pipe-filter-ii1 test-pipe-filter-ii2-main test-pipe-filter-ii2-child
 test_pipe_filter_ii1_LDADD = $(LDADD) @LIBINTL@
 test_pipe_filter_ii2_main_LDADD = $(LDADD) @LIBINTL@
index 0e31a86..b20ea68 100644 (file)
@@ -10,6 +10,5 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-pipe.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-pipe
 test_pipe_LDADD = $(LDADD) @LIBINTL@
index 1655fab..d34107e 100644 (file)
@@ -28,4 +28,4 @@ AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h])
 Makefile.am:
 TESTS += test-poll
 check_PROGRAMS += test-poll
-test_poll_LDADD = $(LDADD) @LIBSOCKET@
+test_poll_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
diff --git a/modules/pow b/modules/pow
new file mode 100644 (file)
index 0000000..dec50d1
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+pow() function: power function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([pow])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(POW_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/pow-tests b/modules/pow-tests
new file mode 100644 (file)
index 0000000..1189af9
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-pow.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-pow
+check_PROGRAMS += test-pow
+test_pow_LDADD = $(LDADD) @POW_LIBM@
index 8a10c18..72e4613 100644 (file)
@@ -12,5 +12,3 @@ configure.ac:
 Makefile.am:
 TESTS += test-pread.sh
 check_PROGRAMS += test-pread
-TESTS_ENVIRONMENT +=   \
-  srcdir='$(srcdir)'
index 08c6834..8e8ec6d 100644 (file)
@@ -16,5 +16,4 @@ AC_CHECK_FUNCS_ONCE([getrlimit setrlimit])
 
 Makefile.am:
 TESTS += test-printf-posix.sh test-printf-posix2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-printf-posix test-printf-posix2
index 5afb986..b510e5d 100644 (file)
@@ -20,6 +20,6 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-quotearg.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-quotearg
 test_quotearg_LDADD = $(LDADD) @LIBINTL@
index 1aeac92..cbd84a5 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 symlink
 
index c6a1235..f516406 100644 (file)
@@ -22,6 +22,7 @@ memcmp
 memmove
 mbrtowc
 mbsinit
+nl_langinfo
 stdbool
 stdint
 ssize_t
diff --git a/modules/remainder b/modules/remainder
new file mode 100644 (file)
index 0000000..36d75bd
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+remainder() function: floating-point remainder function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([remainder])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(REMAINDER_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/remainder-tests b/modules/remainder-tests
new file mode 100644 (file)
index 0000000..6832a49
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-remainder.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-remainder
+check_PROGRAMS += test-remainder
+test_remainder_LDADD = $(LDADD) @REMAINDER_LIBM@
index 9e2e49c..498c7d6 100644 (file)
@@ -4,6 +4,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 symlink
 sys_stat
 
index 84c4a3f..339ecdf 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 errno
 link
 stdbool
index 53467db..dcef7c1 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 filenamecat
 progname
 xgetcwd
diff --git a/modules/rint b/modules/rint
new file mode 100644 (file)
index 0000000..276c926
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+rint() function: round to nearest integer.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_MATHFUNC([rint], [double], [(double)])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(RINT_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/rint-tests b/modules/rint-tests
new file mode 100644 (file)
index 0000000..315fda3
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-rint.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-rint
+check_PROGRAMS += test-rint
+test_rint_LDADD = $(LDADD) @RINT_LIBM@
index 5619ad5..19a5240 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 symlink
 
index 9984c29..898dece 100644 (file)
@@ -6,9 +6,9 @@ lib/search.in.h
 m4/search_h.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
+warn-on-use
 
 configure.ac:
 gl_SEARCH_H
@@ -18,7 +18,7 @@ BUILT_SOURCES += search.h
 
 # We need the following in order to create <search.h> when the system
 # doesn't have one that works with the given compiler.
-search.h: search.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+search.h: search.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''HAVE_SEARCH_H''@|$(HAVE_SEARCH_H)|g' \
@@ -28,8 +28,8 @@ search.h: search.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_TSEARCH''@|$(GNULIB_TSEARCH)|g' \
              -e 's|@''HAVE_TSEARCH''@|$(HAVE_TSEARCH)|g' \
              -e 's|@''REPLACE_TSEARCH''@|$(REPLACE_TSEARCH)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/search.in.h; \
        } > $@-t && \
        mv $@-t $@
index 6635e80..6019b44 100644 (file)
@@ -31,7 +31,6 @@ AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h])
 Makefile.am:
 TESTS += test-select test-select-in.sh test-select-out.sh
 # test-select-stdin has to be run by hand.
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-select test-select-fd test-select-stdin
 test_select_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
 test_select_fd_LDADD = $(LDADD) @LIBSOCKET@
index 2c1917f..68297a8 100644 (file)
@@ -6,9 +6,9 @@ lib/signal.in.h
 m4/signal_h.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
+warn-on-use
 
 configure.ac:
 gl_SIGNAL_H
@@ -18,7 +18,7 @@ BUILT_SOURCES += signal.h
 
 # We need the following in order to create <signal.h> when the system
 # doesn't have a complete one.
-signal.h: signal.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+signal.h: signal.in.h $(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' \
@@ -33,8 +33,8 @@ signal.h: signal.in.h $(LINK_WARNING_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 '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/signal.in.h; \
        } > $@-t && \
        mv $@-t $@
index 0498943..99107a6 100644 (file)
@@ -9,6 +9,5 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-sigpipe.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-sigpipe
 
diff --git a/modules/sin b/modules/sin
new file mode 100644 (file)
index 0000000..ba5e92d
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+sin() function: sine function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([sin])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(SIN_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/sin-tests b/modules/sin-tests
new file mode 100644 (file)
index 0000000..06d3b32
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-sin.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sin
+check_PROGRAMS += test-sin
+test_sin_LDADD = $(LDADD) @SIN_LIBM@
diff --git a/modules/sinh b/modules/sinh
new file mode 100644 (file)
index 0000000..d02ef56
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+sinh() function: hyperbolic sine function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([sinh])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(SINH_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/sinh-tests b/modules/sinh-tests
new file mode 100644 (file)
index 0000000..236c946
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-sinh.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sinh
+check_PROGRAMS += test-sinh
+test_sinh_LDADD = $(LDADD) @SINH_LIBM@
diff --git a/modules/sinl b/modules/sinl
new file mode 100644 (file)
index 0000000..67621ed
--- /dev/null
@@ -0,0 +1,35 @@
+Description:
+sinl() function: sine function with long double argument.
+
+Files:
+lib/sinl.c
+lib/trigl.h
+lib/sincosl.c
+lib/trigl.c
+m4/sinl.m4
+
+Depends-on:
+math
+extensions
+float
+isnanl
+floor
+floorl
+
+configure.ac:
+gl_FUNC_SINL
+gl_MATH_MODULE_INDICATOR([sinl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(SINL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/sinl-tests b/modules/sinl-tests
new file mode 100644 (file)
index 0000000..357ad62
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-sinl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+fpucw
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sinl
+check_PROGRAMS += test-sinl
+test_sinl_LDADD = $(LDADD) @SINL_LIBM@
index 8a80bbf..f92f1fb 100644 (file)
@@ -6,10 +6,10 @@ lib/spawn.in.h
 m4/spawn_h.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
 sched
+warn-on-use
 
 configure.ac:
 gl_SPAWN_H
@@ -19,7 +19,7 @@ BUILT_SOURCES += spawn.h
 
 # We need the following in order to create a replacement for <spawn.h> when
 # the system doesn't have one.
-spawn.h: spawn.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+spawn.h: spawn.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_SPAWN_H''@|$(HAVE_SPAWN_H)|g' \
@@ -51,8 +51,8 @@ spawn.h: spawn.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''HAVE_POSIX_SPAWNATTR_T''@|$(HAVE_POSIX_SPAWNATTR_T)|g' \
              -e 's|@''HAVE_POSIX_SPAWN_FILE_ACTIONS_T''@|$(HAVE_POSIX_SPAWN_FILE_ACTIONS_T)|g' \
              -e 's|@''REPLACE_POSIX_SPAWN''@|$(REPLACE_POSIX_SPAWN)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/spawn.in.h; \
        } > $@-t && \
        mv $@-t $@
diff --git a/modules/sqrt b/modules/sqrt
new file mode 100644 (file)
index 0000000..bceda3d
--- /dev/null
@@ -0,0 +1,25 @@
+Description:
+sqrt() function: square root.
+
+Files:
+m4/sqrt.m4
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_FUNC_SQRT
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(SQRT_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/sqrt-tests b/modules/sqrt-tests
new file mode 100644 (file)
index 0000000..86d8176
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-sqrt.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sqrt
+check_PROGRAMS += test-sqrt
+test_sqrt_LDADD = $(LDADD) @SQRT_LIBM@
diff --git a/modules/sqrtl b/modules/sqrtl
new file mode 100644 (file)
index 0000000..d488666
--- /dev/null
@@ -0,0 +1,33 @@
+Description:
+sqrtl() function: square root with long double argument.
+
+Files:
+lib/sqrtl.c
+m4/sqrtl.m4
+
+Depends-on:
+math
+extensions
+float
+isnanl
+frexpl
+ldexpl
+sqrt
+
+configure.ac:
+gl_FUNC_SQRTL
+gl_MATH_MODULE_INDICATOR([sqrtl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(SQRTL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/sqrtl-tests b/modules/sqrtl-tests
new file mode 100644 (file)
index 0000000..eab018b
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-sqrtl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+fpucw
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sqrtl
+check_PROGRAMS += test-sqrtl
+test_sqrtl_LDADD = $(LDADD) @SQRTL_LIBM@
index eca3581..189c2c2 100644 (file)
@@ -8,10 +8,10 @@ m4/stdio_h.m4
 
 Depends-on:
 include_next
-link-warning
 arg-nonnull
 raise
 stddef
+warn-on-use
 
 configure.ac:
 gl_STDIO_H
@@ -21,7 +21,7 @@ BUILT_SOURCES += stdio.h
 
 # We need the following in order to create <stdio.h> when the system
 # doesn't have one that works with the given compiler.
-stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+stdio.h: stdio.in.h $(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' \
@@ -67,7 +67,8 @@ stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
              -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
-             -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
+             < $(srcdir)/stdio.in.h | \
+         sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
              -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
@@ -88,6 +89,7 @@ stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
              -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
              -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
+             -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \
              -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
              -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
              -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
@@ -105,9 +107,8 @@ stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
              -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
              -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             < $(srcdir)/stdio.in.h; \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
index 19129cf..9323458 100644 (file)
@@ -6,12 +6,12 @@ lib/stdlib.in.h
 m4/stdlib_h.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
-unistd
+include_next
 stddef
 stdint
+unistd
+warn-on-use
 
 configure.ac:
 gl_STDLIB_H
@@ -21,7 +21,7 @@ BUILT_SOURCES += stdlib.h
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+stdlib.h: stdlib.in.h $(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' \
@@ -77,8 +77,8 @@ stdlib.h: stdlib.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
              -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/stdlib.in.h; \
        } > $@-t && \
        mv $@-t $@
index de6eac2..e4cf6b6 100644 (file)
@@ -6,11 +6,11 @@ lib/string.in.h
 m4/string_h.m4
 
 Depends-on:
+arg-nonnull
 extensions
 include_next
-link-warning
-arg-nonnull
 stddef
+warn-on-use
 
 configure.ac:
 gl_HEADER_STRING_H
@@ -20,7 +20,7 @@ BUILT_SOURCES += string.h
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+string.h: string.in.h $(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' \
@@ -59,7 +59,8 @@ string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
              -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
              -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
-             -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
+             < $(srcdir)/string.in.h | \
+         sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -87,8 +88,8 @@ string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
              -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
              -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
              < $(srcdir)/string.in.h; \
        } > $@-t && \
        mv $@-t $@
index 33c0608..37ab999 100644 (file)
@@ -6,9 +6,9 @@ lib/strings.in.h
 m4/strings_h.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
+warn-on-use
 
 configure.ac:
 gl_HEADER_STRINGS_H
@@ -18,7 +18,7 @@ BUILT_SOURCES += strings.h
 
 # We need the following in order to create <strings.h> when the system
 # doesn't have one that works with the given compiler.
-strings.h: strings.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+strings.h: strings.in.h $(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' \
@@ -26,8 +26,8 @@ strings.h: strings.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
              -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
              -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/strings.in.h; \
        } > $@-t && \
        mv $@-t $@
index e845ba5..ab67eb1 100644 (file)
@@ -10,4 +10,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-strsignal
 check_PROGRAMS += test-strsignal
-test_strsignal_LDADD = $(LDADD) @LIBINTL@
+test_strsignal_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
index 3f94fd2..a07074e 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 
 configure.ac:
index e3ee6c3..c1678c0 100644 (file)
@@ -6,6 +6,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 
 configure.ac:
 
index 5cbd9f0..b08e418 100644 (file)
@@ -7,7 +7,7 @@ m4/sys_file_h.m4
 
 Depends-on:
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_HEADER_SYS_FILE_H
@@ -18,7 +18,7 @@ BUILT_SOURCES += sys/file.h
 
 # We need the following in order to create <sys/file.h> when the system
 # has one that is incomplete.
-sys/file.h: sys_file.in.h $(LINK_WARNING_H)
+sys/file.h: sys_file.in.h $(WARN_ON_USE_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -28,7 +28,7 @@ sys/file.h: sys_file.in.h $(LINK_WARNING_H)
              -e 's|@''NEXT_SYS_FILE_H''@|$(NEXT_SYS_FILE_H)|g' \
              -e 's/@''HAVE_FLOCK''@/$(HAVE_FLOCK)/g' \
              -e 's/@''GNULIB_FLOCK''@/$(GNULIB_FLOCK)/g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_file.in.h; \
        } > $@-t && \
        mv $@-t $@
index e1cce96..4e3658d 100644 (file)
@@ -7,8 +7,8 @@ m4/sys_ioctl_h.m4
 
 Depends-on:
 include_next
-link-warning
 unistd
+warn-on-use
 
 configure.ac:
 gl_SYS_IOCTL_H
@@ -19,7 +19,7 @@ BUILT_SOURCES += sys/ioctl.h
 
 # We need the following in order to create <sys/ioctl.h> when the system
 # does not have a complete one.
-sys/ioctl.h: sys_ioctl.in.h $(LINK_WARNING_H)
+sys/ioctl.h: sys_ioctl.in.h $(WARN_ON_USE_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -30,7 +30,7 @@ sys/ioctl.h: sys_ioctl.in.h $(LINK_WARNING_H)
              -e 's|@''GNULIB_IOCTL''@|$(GNULIB_IOCTL)|g' \
              -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \
              -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_ioctl.in.h; \
        } > $@-t && \
        mv $@-t $@
index 7ddcf88..27d9a48 100644 (file)
@@ -7,9 +7,9 @@ m4/sys_select_h.m4
 
 Depends-on:
 include_next
-link-warning
 sys_socket
 sys_time
+warn-on-use
 
 configure.ac:
 gl_HEADER_SYS_SELECT
@@ -20,7 +20,7 @@ BUILT_SOURCES += sys/select.h
 
 # We need the following in order to create <sys/select.h> when the system
 # doesn't have one that works with the given compiler.
-sys/select.h: sys_select.in.h $(LINK_WARNING_H)
+sys/select.h: sys_select.in.h $(WARN_ON_USE_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -31,7 +31,7 @@ sys/select.h: sys_select.in.h $(LINK_WARNING_H)
              -e 's|@''GNULIB_SELECT''@|$(GNULIB_SELECT)|g' \
              -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
              -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_select.in.h; \
        } > $@-t && \
        mv $@-t $@
index 47408fe..d9cfc86 100644 (file)
@@ -7,11 +7,11 @@ m4/sys_socket_h.m4
 m4/sockpfaf.m4
 
 Depends-on:
-include_next
-link-warning
+alignof
 arg-nonnull
 errno
-alignof
+include_next
+warn-on-use
 
 configure.ac:
 gl_HEADER_SYS_SOCKET
@@ -22,7 +22,7 @@ BUILT_SOURCES += sys/socket.h
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+sys/socket.h: sys_socket.in.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! */'; \
@@ -51,8 +51,8 @@ sys/socket.h: sys_socket.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
              -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \
              -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_socket.in.h; \
        } > $@-t && \
        mv -f $@-t $@
index 7421df6..f349e13 100644 (file)
@@ -7,10 +7,10 @@ m4/sys_stat_h.m4
 m4/unistd_h.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
 time
+warn-on-use
 
 configure.ac:
 gl_HEADER_SYS_STAT_H
@@ -21,7 +21,7 @@ BUILT_SOURCES += sys/stat.h
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: sys_stat.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+sys/stat.h: sys_stat.in.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! */'; \
@@ -60,8 +60,8 @@ sys/stat.h: sys_stat.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
              -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
              -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_stat.in.h; \
        } > $@-t && \
        mv $@-t $@
index f0789e5..adfa493 100644 (file)
@@ -8,17 +8,18 @@ m4/sys_time_h.m4
 Depends-on:
 include_next
 arg-nonnull
+warn-on-use
 
 configure.ac:
 gl_HEADER_SYS_TIME_H
 AC_PROG_MKDIR_P
 
 Makefile.am:
-BUILT_SOURCES += $(SYS_TIME_H)
+BUILT_SOURCES += sys/time.h
 
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
-sys/time.h: sys_time.in.h $(ARG_NONNULL_H)
+sys/time.h: sys_time.in.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! */'; \
@@ -26,9 +27,12 @@ sys/time.h: sys_time.in.h $(ARG_NONNULL_H)
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
-             -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
+             -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
+             -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
              -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+             -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_time.in.h; \
        } > $@-t && \
        mv $@-t $@
index 64683d9..6ce9d7e 100644 (file)
@@ -8,7 +8,7 @@ m4/sys_times_h.m4
 Depends-on:
 arg-nonnull
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_SYS_TIMES_H
@@ -19,7 +19,7 @@ BUILT_SOURCES += sys/times.h
 
 # We need the following in order to create <sys/times.h> when the system
 # doesn't have one that works with the given compiler.
-sys/times.h: sys_times.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+sys/times.h: sys_times.in.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! */'; \
@@ -30,8 +30,8 @@ sys/times.h: sys_times.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_TIMES''@|$(GNULIB_TIMES)|g' \
              -e 's|@''HAVE_STRUCT_TMS''@|$(HAVE_STRUCT_TMS)|g' \
              -e 's|@''HAVE_TIMES''@|$(HAVE_TIMES)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_times.in.h; \
        } > $@-t && \
        mv $@-t $@
index ddb1d8e..1a3d8ec 100644 (file)
@@ -8,7 +8,7 @@ m4/sys_utsname_h.m4
 Depends-on:
 arg-nonnull
 include_next
-link-warning
+warn-on-use
 
 configure.ac:
 gl_SYS_UTSNAME_H
@@ -19,7 +19,7 @@ BUILT_SOURCES += sys/utsname.h
 
 # We need the following in order to create <sys/utsname.h> when the system
 # does not have one.
-sys/utsname.h: sys_utsname.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+sys/utsname.h: sys_utsname.in.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! */'; \
@@ -30,8 +30,8 @@ sys/utsname.h: sys_utsname.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_UNAME''@|$(GNULIB_UNAME)|g' \
              -e 's|@''HAVE_STRUCT_UTSNAME''@|$(HAVE_STRUCT_UTSNAME)|g' \
              -e 's|@''HAVE_UNAME''@|$(HAVE_UNAME)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_utsname.in.h; \
        } > $@-t && \
        mv $@-t $@
diff --git a/modules/tan b/modules/tan
new file mode 100644 (file)
index 0000000..4f14961
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+tan() function: tangent function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([tan])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(TAN_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/tan-tests b/modules/tan-tests
new file mode 100644 (file)
index 0000000..178a643
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-tan.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-tan
+check_PROGRAMS += test-tan
+test_tan_LDADD = $(LDADD) @TAN_LIBM@
diff --git a/modules/tanh b/modules/tanh
new file mode 100644 (file)
index 0000000..6969caf
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+tanh() function: hyperbolic tangent function.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([tanh])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(TANH_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/tanh-tests b/modules/tanh-tests
new file mode 100644 (file)
index 0000000..9e098c3
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-tanh.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-tanh
+check_PROGRAMS += test-tanh
+test_tanh_LDADD = $(LDADD) @TANH_LIBM@
diff --git a/modules/tanl b/modules/tanl
new file mode 100644 (file)
index 0000000..b00fd1b
--- /dev/null
@@ -0,0 +1,34 @@
+Description:
+tanl() function: tangent function with long double argument.
+
+Files:
+lib/tanl.c
+lib/trigl.h
+lib/trigl.c
+m4/tanl.m4
+
+Depends-on:
+math
+extensions
+float
+isnanl
+floor
+floorl
+
+configure.ac:
+gl_FUNC_TANL
+gl_MATH_MODULE_INDICATOR([tanl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(TANL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/tanl-tests b/modules/tanl-tests
new file mode 100644 (file)
index 0000000..eb8f609
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/test-tanl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+fpucw
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-tanl
+check_PROGRAMS += test-tanl
+test_tanl_LDADD = $(LDADD) @TANL_LIBM@
index 0ca1114..0c4de8b 100644 (file)
@@ -20,6 +20,5 @@ AC_CHECK_FUNCS_ONCE([initstate])
 
 Makefile.am:
 TESTS += test-tsearch.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-tsearch
 test_tsearch_LDADD = $(LDADD) @TEST_TSEARCH_LIBM@
index 7ea8f0e..bd6a21a 100644 (file)
@@ -19,7 +19,7 @@ gt_LOCALE_ZH_CN
 
 Makefile.am:
 TESTS += unicase/test-locale-language.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-locale-language
 test_locale_language_SOURCES = unicase/test-locale-language.c
 test_locale_language_LDADD = $(LDADD) @INTL_MACOSX_LIBS@
index 60dfe87..93ac72c 100644 (file)
@@ -17,7 +17,6 @@ gt_LOCALE_FR_UTF8
 Makefile.am:
 TESTS += unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-ulc-casecmp
index 879156d..11c6f59 100644 (file)
@@ -17,7 +17,6 @@ gt_LOCALE_FR_UTF8
 Makefile.am:
 TESTS += unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-ulc-casecoll
index 3d47795..ba97566 100644 (file)
@@ -3,6 +3,7 @@ tests/unictype/test-categ_byname.c
 tests/macros.h
 
 Depends-on:
+stdbool
 unictype/category-test
 
 configure.ac:
index 6fb0917..6f2f7f7 100644 (file)
@@ -11,7 +11,6 @@ configure.ac:
 
 Makefile.am:
 TESTS += uniname/test-uninames.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-uninames
 test_uninames_SOURCES = uniname/test-uninames.c
 test_uninames_LDADD = $(LDADD) @LIBINTL@
index 3ee8f31..c2d32b3 100644 (file)
@@ -6,10 +6,10 @@ m4/unistd_h.m4
 lib/unistd.in.h
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
 stddef
+warn-on-use
 
 configure.ac:
 gl_UNISTD_H
@@ -19,7 +19,7 @@ BUILT_SOURCES += unistd.h
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+unistd.h: unistd.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -42,6 +42,7 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
              -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \
              -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
+             -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
              -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
              -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
@@ -63,7 +64,8 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
              -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \
              -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
-             -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
+             < $(srcdir)/unistd.in.h | \
+         sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
              -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
@@ -75,6 +77,7 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
              -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
              -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
+             -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
              -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
@@ -117,9 +120,8 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
              -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
              -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             < $(srcdir)/unistd.in.h; \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += unistd.h unistd.h-t
index cf6e06a..8018a4c 100644 (file)
@@ -7,7 +7,7 @@ lib/unistdio/u-sprintf.h
 
 Depends-on:
 unistdio/base
-unistdio/u16-sprintf
+unistdio/u16-vsprintf
 
 configure.ac:
 
index 546e11b..300e93a 100644 (file)
@@ -7,7 +7,7 @@ lib/unistdio/u-sprintf.h
 
 Depends-on:
 unistdio/base
-unistdio/u16-u16-sprintf
+unistdio/u16-u16-vsprintf
 
 configure.ac:
 
index 81a563b..d67a13e 100644 (file)
@@ -22,7 +22,7 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-u16-vasnprintf1 unistdio/test-u16-vasnprintf2.sh unistdio/test-u16-vasnprintf3.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-u16-vasnprintf1 test-u16-vasnprintf2 test-u16-vasnprintf3
 test_u16_vasnprintf1_SOURCES = unistdio/test-u16-vasnprintf1.c
 test_u16_vasnprintf1_LDADD = $(LDADD) @LIBICONV@
index d472588..a662796 100644 (file)
@@ -7,7 +7,7 @@ lib/unistdio/u-sprintf.h
 
 Depends-on:
 unistdio/base
-unistdio/u32-sprintf
+unistdio/u32-vsprintf
 
 configure.ac:
 
index ffa2d02..e2e3146 100644 (file)
@@ -7,7 +7,7 @@ lib/unistdio/u-sprintf.h
 
 Depends-on:
 unistdio/base
-unistdio/u32-u32-sprintf
+unistdio/u32-u32-vsprintf
 
 configure.ac:
 
index ae0bf1a..7330887 100644 (file)
@@ -22,7 +22,7 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-u32-vasnprintf1 unistdio/test-u32-vasnprintf2.sh unistdio/test-u32-vasnprintf3.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-u32-vasnprintf1 test-u32-vasnprintf2 test-u32-vasnprintf3
 test_u32_vasnprintf1_SOURCES = unistdio/test-u32-vasnprintf1.c
 test_u32_vasnprintf1_LDADD = $(LDADD) @LIBICONV@
index 6280896..72c612b 100644 (file)
@@ -7,7 +7,7 @@ lib/unistdio/u-sprintf.h
 
 Depends-on:
 unistdio/base
-unistdio/u8-sprintf
+unistdio/u8-vsprintf
 
 configure.ac:
 
index 4641637..f6e7e74 100644 (file)
@@ -7,7 +7,7 @@ lib/unistdio/u-sprintf.h
 
 Depends-on:
 unistdio/base
-unistdio/u8-u8-sprintf
+unistdio/u8-u8-vsprintf
 
 configure.ac:
 
index 221b942..485ca5d 100644 (file)
@@ -22,7 +22,7 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-u8-vasnprintf1 unistdio/test-u8-vasnprintf2.sh unistdio/test-u8-vasnprintf3.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-u8-vasnprintf1 test-u8-vasnprintf2 test-u8-vasnprintf3
 test_u8_vasnprintf1_SOURCES = unistdio/test-u8-vasnprintf1.c
 test_u8_vasnprintf1_LDADD = $(LDADD) @LIBICONV@
index 99fdb1b..1c87479 100644 (file)
@@ -7,7 +7,7 @@ lib/unistdio/u-sprintf.h
 
 Depends-on:
 unistdio/base
-unistdio/ulc-sprintf
+unistdio/ulc-vsprintf
 
 configure.ac:
 
index 8ee2268..f90aaed 100644 (file)
@@ -18,7 +18,7 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-ulc-vasnprintf1 unistdio/test-ulc-vasnprintf2.sh unistdio/test-ulc-vasnprintf3.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-ulc-vasnprintf1 test-ulc-vasnprintf2 test-ulc-vasnprintf3
 test_ulc_vasnprintf1_SOURCES = unistdio/test-ulc-vasnprintf1.c
 test_ulc_vasnprintf1_LDADD = $(LDADD) @LIBICONV@
diff --git a/modules/unistr/u16-check-tests b/modules/unistr/u16-check-tests
new file mode 100644 (file)
index 0000000..22f4a6f
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-check.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-check
+check_PROGRAMS += test-u16-check
+test_u16_check_SOURCES = unistr/test-u16-check.c
diff --git a/modules/unistr/u16-chr-tests b/modules/unistr/u16-chr-tests
new file mode 100644 (file)
index 0000000..75ee778
--- /dev/null
@@ -0,0 +1,21 @@
+Files:
+tests/unistr/test-u16-chr.c
+tests/unistr/test-chr.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+unistr/u16-set
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u16-chr
+check_PROGRAMS += test-u16-chr
+test_u16_chr_SOURCES = unistr/test-u16-chr.c
diff --git a/modules/unistr/u16-cmp-tests b/modules/unistr/u16-cmp-tests
new file mode 100644 (file)
index 0000000..1c96328
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u16-cmp.c
+tests/unistr/test-cmp.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u16-cmp
+check_PROGRAMS += test-u16-cmp
+test_u16_cmp_SOURCES = unistr/test-u16-cmp.c
diff --git a/modules/unistr/u16-cmp2-tests b/modules/unistr/u16-cmp2-tests
new file mode 100644 (file)
index 0000000..da08296
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-cmp2.c
+tests/unistr/test-cmp2.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-cmp2
+check_PROGRAMS += test-u16-cmp2
+test_u16_cmp2_SOURCES = unistr/test-u16-cmp2.c
diff --git a/modules/unistr/u16-cpy-alloc-tests b/modules/unistr/u16-cpy-alloc-tests
new file mode 100644 (file)
index 0000000..33dbf89
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-cpy-alloc.c
+tests/unistr/test-cpy-alloc.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-cpy-alloc
+check_PROGRAMS += test-u16-cpy-alloc
+test_u16_cpy_alloc_SOURCES = unistr/test-u16-cpy-alloc.c
diff --git a/modules/unistr/u16-cpy-tests b/modules/unistr/u16-cpy-tests
new file mode 100644 (file)
index 0000000..08a9703
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-cpy.c
+tests/unistr/test-cpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-cpy
+check_PROGRAMS += test-u16-cpy
+test_u16_cpy_SOURCES = unistr/test-u16-cpy.c
diff --git a/modules/unistr/u16-mblen-tests b/modules/unistr/u16-mblen-tests
new file mode 100644 (file)
index 0000000..b4f255e
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-mblen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-mblen
+check_PROGRAMS += test-u16-mblen
+test_u16_mblen_SOURCES = unistr/test-u16-mblen.c
index ae5713d..6d8ba47 100644 (file)
@@ -6,7 +6,7 @@ lib/unistr/u16-mbsnlen.c
 
 Depends-on:
 unistr/base
-unistr/u16-mblen
+unistr/u16-mbtoucr
 
 configure.ac:
 
diff --git a/modules/unistr/u16-mbsnlen-tests b/modules/unistr/u16-mbsnlen-tests
new file mode 100644 (file)
index 0000000..24c2b57
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-mbsnlen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-mbsnlen
+check_PROGRAMS += test-u16-mbsnlen
+test_u16_mbsnlen_SOURCES = unistr/test-u16-mbsnlen.c
diff --git a/modules/unistr/u16-mbtouc-tests b/modules/unistr/u16-mbtouc-tests
new file mode 100644 (file)
index 0000000..3bfb697
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-mbtouc.c
+tests/unistr/test-u16-mbtouc.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-mbtouc
+check_PROGRAMS += test-u16-mbtouc
+test_u16_mbtouc_SOURCES = unistr/test-u16-mbtouc.c
diff --git a/modules/unistr/u16-mbtouc-unsafe-tests b/modules/unistr/u16-mbtouc-unsafe-tests
new file mode 100644 (file)
index 0000000..7b39f90
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-mbtouc-unsafe.c
+tests/unistr/test-u16-mbtouc.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-mbtouc-unsafe
+check_PROGRAMS += test-u16-mbtouc-unsafe
+test_u16_mbtouc_unsafe_SOURCES = unistr/test-u16-mbtouc-unsafe.c
diff --git a/modules/unistr/u16-mbtoucr-tests b/modules/unistr/u16-mbtoucr-tests
new file mode 100644 (file)
index 0000000..7c6e53f
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-mbtoucr.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-mbtoucr
+check_PROGRAMS += test-u16-mbtoucr
+test_u16_mbtoucr_SOURCES = unistr/test-u16-mbtoucr.c
diff --git a/modules/unistr/u16-move-tests b/modules/unistr/u16-move-tests
new file mode 100644 (file)
index 0000000..48a7e09
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-move.c
+tests/unistr/test-move.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-move
+check_PROGRAMS += test-u16-move
+test_u16_move_SOURCES = unistr/test-u16-move.c
index 92dc4d4..b184625 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u16-next.c
 
 Depends-on:
 unistr/base
+unistr/u16-strmbtouc
 
 configure.ac:
 
diff --git a/modules/unistr/u16-next-tests b/modules/unistr/u16-next-tests
new file mode 100644 (file)
index 0000000..9843cf0
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-next.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-next
+check_PROGRAMS += test-u16-next
+test_u16_next_SOURCES = unistr/test-u16-next.c
diff --git a/modules/unistr/u16-prev-tests b/modules/unistr/u16-prev-tests
new file mode 100644 (file)
index 0000000..062b251
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-prev.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-prev
+check_PROGRAMS += test-u16-prev
+test_u16_prev_SOURCES = unistr/test-u16-prev.c
diff --git a/modules/unistr/u16-set-tests b/modules/unistr/u16-set-tests
new file mode 100644 (file)
index 0000000..bc88610
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-set.c
+tests/unistr/test-set.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-set
+check_PROGRAMS += test-u16-set
+test_u16_set_SOURCES = unistr/test-u16-set.c
diff --git a/modules/unistr/u16-stpcpy-tests b/modules/unistr/u16-stpcpy-tests
new file mode 100644 (file)
index 0000000..b428872
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-stpcpy.c
+tests/unistr/test-stpcpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-stpcpy
+check_PROGRAMS += test-u16-stpcpy
+test_u16_stpcpy_SOURCES = unistr/test-u16-stpcpy.c
diff --git a/modules/unistr/u16-stpncpy-tests b/modules/unistr/u16-stpncpy-tests
new file mode 100644 (file)
index 0000000..6dd27cc
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u16-stpncpy.c
+tests/unistr/test-stpncpy.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u16-stpncpy
+check_PROGRAMS += test-u16-stpncpy
+test_u16_stpncpy_SOURCES = unistr/test-u16-stpncpy.c
diff --git a/modules/unistr/u16-strcat-tests b/modules/unistr/u16-strcat-tests
new file mode 100644 (file)
index 0000000..64eb517
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-strcat.c
+tests/unistr/test-strcat.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-strcat
+check_PROGRAMS += test-u16-strcat
+test_u16_strcat_SOURCES = unistr/test-u16-strcat.c
diff --git a/modules/unistr/u16-strcmp-tests b/modules/unistr/u16-strcmp-tests
new file mode 100644 (file)
index 0000000..8dcb323
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/unistr/test-u16-strcmp.c
+tests/unistr/test-u16-strcmp.h
+tests/unistr/test-strcmp.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-strcmp
+check_PROGRAMS += test-u16-strcmp
+test_u16_strcmp_SOURCES = unistr/test-u16-strcmp.c
diff --git a/modules/unistr/u16-strcoll-tests b/modules/unistr/u16-strcoll-tests
new file mode 100644 (file)
index 0000000..227a9df
--- /dev/null
@@ -0,0 +1,15 @@
+Files:
+tests/unistr/test-u16-strcoll.c
+tests/unistr/test-u16-strcmp.h
+tests/unistr/test-strcmp.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-strcoll
+check_PROGRAMS += test-u16-strcoll
+test_u16_strcoll_SOURCES = unistr/test-u16-strcoll.c
+test_u16_strcoll_LDADD = $(LDADD) @LIBICONV@
diff --git a/modules/unistr/u16-strcpy-tests b/modules/unistr/u16-strcpy-tests
new file mode 100644 (file)
index 0000000..cca4e3b
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-strcpy.c
+tests/unistr/test-strcpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-strcpy
+check_PROGRAMS += test-u16-strcpy
+test_u16_strcpy_SOURCES = unistr/test-u16-strcpy.c
diff --git a/modules/unistr/u16-strdup-tests b/modules/unistr/u16-strdup-tests
new file mode 100644 (file)
index 0000000..80eb81c
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-strdup.c
+tests/unistr/test-strdup.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-strdup
+check_PROGRAMS += test-u16-strdup
+test_u16_strdup_SOURCES = unistr/test-u16-strdup.c
diff --git a/modules/unistr/u16-strlen-tests b/modules/unistr/u16-strlen-tests
new file mode 100644 (file)
index 0000000..b1dd434
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-strlen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-strlen
+check_PROGRAMS += test-u16-strlen
+test_u16_strlen_SOURCES = unistr/test-u16-strlen.c
diff --git a/modules/unistr/u16-strmblen-tests b/modules/unistr/u16-strmblen-tests
new file mode 100644 (file)
index 0000000..bdb9ac8
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-strmblen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-strmblen
+check_PROGRAMS += test-u16-strmblen
+test_u16_strmblen_SOURCES = unistr/test-u16-strmblen.c
diff --git a/modules/unistr/u16-strmbtouc-tests b/modules/unistr/u16-strmbtouc-tests
new file mode 100644 (file)
index 0000000..5e06b76
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-strmbtouc.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-strmbtouc
+check_PROGRAMS += test-u16-strmbtouc
+test_u16_strmbtouc_SOURCES = unistr/test-u16-strmbtouc.c
diff --git a/modules/unistr/u16-strncat-tests b/modules/unistr/u16-strncat-tests
new file mode 100644 (file)
index 0000000..e929b5a
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u16-strncat.c
+tests/unistr/test-strncat.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u16-strncat
+check_PROGRAMS += test-u16-strncat
+test_u16_strncat_SOURCES = unistr/test-u16-strncat.c
diff --git a/modules/unistr/u16-strncmp-tests b/modules/unistr/u16-strncmp-tests
new file mode 100644 (file)
index 0000000..16a6e2f
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-strncmp.c
+tests/unistr/test-strncmp.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-strncmp
+check_PROGRAMS += test-u16-strncmp
+test_u16_strncmp_SOURCES = unistr/test-u16-strncmp.c
diff --git a/modules/unistr/u16-strncpy-tests b/modules/unistr/u16-strncpy-tests
new file mode 100644 (file)
index 0000000..dcdf78c
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u16-strncpy.c
+tests/unistr/test-strncpy.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u16-strncpy
+check_PROGRAMS += test-u16-strncpy
+test_u16_strncpy_SOURCES = unistr/test-u16-strncpy.c
diff --git a/modules/unistr/u16-strnlen-tests b/modules/unistr/u16-strnlen-tests
new file mode 100644 (file)
index 0000000..780b338
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u16-strnlen.c
+tests/unistr/test-strnlen.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u16-strnlen
+check_PROGRAMS += test-u16-strnlen
+test_u16_strnlen_SOURCES = unistr/test-u16-strnlen.c
diff --git a/modules/unistr/u16-to-u32-tests b/modules/unistr/u16-to-u32-tests
new file mode 100644 (file)
index 0000000..c2d4ab7
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-to-u32.c
+tests/macros.h
+
+Depends-on:
+unistr/u32-cmp
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-to-u32
+check_PROGRAMS += test-u16-to-u32
+test_u16_to_u32_SOURCES = unistr/test-u16-to-u32.c
diff --git a/modules/unistr/u16-to-u8-tests b/modules/unistr/u16-to-u8-tests
new file mode 100644 (file)
index 0000000..5b73be8
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u16-to-u8.c
+tests/macros.h
+
+Depends-on:
+unistr/u8-cmp
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-to-u8
+check_PROGRAMS += test-u16-to-u8
+test_u16_to_u8_SOURCES = unistr/test-u16-to-u8.c
diff --git a/modules/unistr/u16-uctomb-tests b/modules/unistr/u16-uctomb-tests
new file mode 100644 (file)
index 0000000..7827020
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u16-uctomb.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-uctomb
+check_PROGRAMS += test-u16-uctomb
+test_u16_uctomb_SOURCES = unistr/test-u16-uctomb.c
diff --git a/modules/unistr/u32-check-tests b/modules/unistr/u32-check-tests
new file mode 100644 (file)
index 0000000..1dee21c
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-check.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-check
+check_PROGRAMS += test-u32-check
+test_u32_check_SOURCES = unistr/test-u32-check.c
diff --git a/modules/unistr/u32-chr-tests b/modules/unistr/u32-chr-tests
new file mode 100644 (file)
index 0000000..beca859
--- /dev/null
@@ -0,0 +1,21 @@
+Files:
+tests/unistr/test-u32-chr.c
+tests/unistr/test-chr.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+unistr/u32-set
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u32-chr
+check_PROGRAMS += test-u32-chr
+test_u32_chr_SOURCES = unistr/test-u32-chr.c
diff --git a/modules/unistr/u32-cmp-tests b/modules/unistr/u32-cmp-tests
new file mode 100644 (file)
index 0000000..26dca1f
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u32-cmp.c
+tests/unistr/test-cmp.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u32-cmp
+check_PROGRAMS += test-u32-cmp
+test_u32_cmp_SOURCES = unistr/test-u32-cmp.c
diff --git a/modules/unistr/u32-cmp2-tests b/modules/unistr/u32-cmp2-tests
new file mode 100644 (file)
index 0000000..f2d19ab
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-cmp2.c
+tests/unistr/test-cmp2.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-cmp2
+check_PROGRAMS += test-u32-cmp2
+test_u32_cmp2_SOURCES = unistr/test-u32-cmp2.c
diff --git a/modules/unistr/u32-cpy-alloc-tests b/modules/unistr/u32-cpy-alloc-tests
new file mode 100644 (file)
index 0000000..14e9869
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-cpy-alloc.c
+tests/unistr/test-cpy-alloc.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-cpy-alloc
+check_PROGRAMS += test-u32-cpy-alloc
+test_u32_cpy_alloc_SOURCES = unistr/test-u32-cpy-alloc.c
diff --git a/modules/unistr/u32-cpy-tests b/modules/unistr/u32-cpy-tests
new file mode 100644 (file)
index 0000000..abe0b7f
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-cpy.c
+tests/unistr/test-cpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-cpy
+check_PROGRAMS += test-u32-cpy
+test_u32_cpy_SOURCES = unistr/test-u32-cpy.c
diff --git a/modules/unistr/u32-mblen-tests b/modules/unistr/u32-mblen-tests
new file mode 100644 (file)
index 0000000..0657812
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-mblen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-mblen
+check_PROGRAMS += test-u32-mblen
+test_u32_mblen_SOURCES = unistr/test-u32-mblen.c
diff --git a/modules/unistr/u32-mbsnlen-tests b/modules/unistr/u32-mbsnlen-tests
new file mode 100644 (file)
index 0000000..12c1d15
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-mbsnlen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-mbsnlen
+check_PROGRAMS += test-u32-mbsnlen
+test_u32_mbsnlen_SOURCES = unistr/test-u32-mbsnlen.c
diff --git a/modules/unistr/u32-mbtouc-tests b/modules/unistr/u32-mbtouc-tests
new file mode 100644 (file)
index 0000000..5345b94
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-mbtouc.c
+tests/unistr/test-u32-mbtouc.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-mbtouc
+check_PROGRAMS += test-u32-mbtouc
+test_u32_mbtouc_SOURCES = unistr/test-u32-mbtouc.c
diff --git a/modules/unistr/u32-mbtouc-unsafe-tests b/modules/unistr/u32-mbtouc-unsafe-tests
new file mode 100644 (file)
index 0000000..fda26ae
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-mbtouc-unsafe.c
+tests/unistr/test-u32-mbtouc.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-mbtouc-unsafe
+check_PROGRAMS += test-u32-mbtouc-unsafe
+test_u32_mbtouc_unsafe_SOURCES = unistr/test-u32-mbtouc-unsafe.c
diff --git a/modules/unistr/u32-mbtoucr-tests b/modules/unistr/u32-mbtoucr-tests
new file mode 100644 (file)
index 0000000..df5c6bf
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-mbtoucr.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-mbtoucr
+check_PROGRAMS += test-u32-mbtoucr
+test_u32_mbtoucr_SOURCES = unistr/test-u32-mbtoucr.c
diff --git a/modules/unistr/u32-move-tests b/modules/unistr/u32-move-tests
new file mode 100644 (file)
index 0000000..d999af6
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-move.c
+tests/unistr/test-move.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-move
+check_PROGRAMS += test-u32-move
+test_u32_move_SOURCES = unistr/test-u32-move.c
index fcbab61..c45e941 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u32-next.c
 
 Depends-on:
 unistr/base
+unistr/u32-strmbtouc
 
 configure.ac:
 
diff --git a/modules/unistr/u32-next-tests b/modules/unistr/u32-next-tests
new file mode 100644 (file)
index 0000000..eed2b23
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-next.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-next
+check_PROGRAMS += test-u32-next
+test_u32_next_SOURCES = unistr/test-u32-next.c
diff --git a/modules/unistr/u32-prev-tests b/modules/unistr/u32-prev-tests
new file mode 100644 (file)
index 0000000..6cc8695
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-prev.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-prev
+check_PROGRAMS += test-u32-prev
+test_u32_prev_SOURCES = unistr/test-u32-prev.c
diff --git a/modules/unistr/u32-set-tests b/modules/unistr/u32-set-tests
new file mode 100644 (file)
index 0000000..ddd35e9
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-set.c
+tests/unistr/test-set.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-set
+check_PROGRAMS += test-u32-set
+test_u32_set_SOURCES = unistr/test-u32-set.c
diff --git a/modules/unistr/u32-stpcpy-tests b/modules/unistr/u32-stpcpy-tests
new file mode 100644 (file)
index 0000000..6caf032
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-stpcpy.c
+tests/unistr/test-stpcpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-stpcpy
+check_PROGRAMS += test-u32-stpcpy
+test_u32_stpcpy_SOURCES = unistr/test-u32-stpcpy.c
diff --git a/modules/unistr/u32-stpncpy-tests b/modules/unistr/u32-stpncpy-tests
new file mode 100644 (file)
index 0000000..5b9c88f
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u32-stpncpy.c
+tests/unistr/test-stpncpy.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u32-stpncpy
+check_PROGRAMS += test-u32-stpncpy
+test_u32_stpncpy_SOURCES = unistr/test-u32-stpncpy.c
diff --git a/modules/unistr/u32-strcat-tests b/modules/unistr/u32-strcat-tests
new file mode 100644 (file)
index 0000000..bc8b9c8
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-strcat.c
+tests/unistr/test-strcat.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-strcat
+check_PROGRAMS += test-u32-strcat
+test_u32_strcat_SOURCES = unistr/test-u32-strcat.c
diff --git a/modules/unistr/u32-strcmp-tests b/modules/unistr/u32-strcmp-tests
new file mode 100644 (file)
index 0000000..0ffef40
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/unistr/test-u32-strcmp.c
+tests/unistr/test-u32-strcmp.h
+tests/unistr/test-strcmp.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-strcmp
+check_PROGRAMS += test-u32-strcmp
+test_u32_strcmp_SOURCES = unistr/test-u32-strcmp.c
diff --git a/modules/unistr/u32-strcoll-tests b/modules/unistr/u32-strcoll-tests
new file mode 100644 (file)
index 0000000..9ca06ba
--- /dev/null
@@ -0,0 +1,15 @@
+Files:
+tests/unistr/test-u32-strcoll.c
+tests/unistr/test-u32-strcmp.h
+tests/unistr/test-strcmp.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-strcoll
+check_PROGRAMS += test-u32-strcoll
+test_u32_strcoll_SOURCES = unistr/test-u32-strcoll.c
+test_u32_strcoll_LDADD = $(LDADD) @LIBICONV@
diff --git a/modules/unistr/u32-strcpy-tests b/modules/unistr/u32-strcpy-tests
new file mode 100644 (file)
index 0000000..2e6a30e
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-strcpy.c
+tests/unistr/test-strcpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-strcpy
+check_PROGRAMS += test-u32-strcpy
+test_u32_strcpy_SOURCES = unistr/test-u32-strcpy.c
diff --git a/modules/unistr/u32-strdup-tests b/modules/unistr/u32-strdup-tests
new file mode 100644 (file)
index 0000000..2e6e8a6
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-strdup.c
+tests/unistr/test-strdup.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-strdup
+check_PROGRAMS += test-u32-strdup
+test_u32_strdup_SOURCES = unistr/test-u32-strdup.c
diff --git a/modules/unistr/u32-strlen-tests b/modules/unistr/u32-strlen-tests
new file mode 100644 (file)
index 0000000..8ffaa38
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-strlen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-strlen
+check_PROGRAMS += test-u32-strlen
+test_u32_strlen_SOURCES = unistr/test-u32-strlen.c
diff --git a/modules/unistr/u32-strmblen-tests b/modules/unistr/u32-strmblen-tests
new file mode 100644 (file)
index 0000000..519b2aa
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-strmblen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-strmblen
+check_PROGRAMS += test-u32-strmblen
+test_u32_strmblen_SOURCES = unistr/test-u32-strmblen.c
diff --git a/modules/unistr/u32-strmbtouc-tests b/modules/unistr/u32-strmbtouc-tests
new file mode 100644 (file)
index 0000000..63d0731
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-strmbtouc.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-strmbtouc
+check_PROGRAMS += test-u32-strmbtouc
+test_u32_strmbtouc_SOURCES = unistr/test-u32-strmbtouc.c
diff --git a/modules/unistr/u32-strncat-tests b/modules/unistr/u32-strncat-tests
new file mode 100644 (file)
index 0000000..8703de0
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u32-strncat.c
+tests/unistr/test-strncat.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u32-strncat
+check_PROGRAMS += test-u32-strncat
+test_u32_strncat_SOURCES = unistr/test-u32-strncat.c
diff --git a/modules/unistr/u32-strncmp-tests b/modules/unistr/u32-strncmp-tests
new file mode 100644 (file)
index 0000000..0797984
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-strncmp.c
+tests/unistr/test-strncmp.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-strncmp
+check_PROGRAMS += test-u32-strncmp
+test_u32_strncmp_SOURCES = unistr/test-u32-strncmp.c
diff --git a/modules/unistr/u32-strncpy-tests b/modules/unistr/u32-strncpy-tests
new file mode 100644 (file)
index 0000000..3f1f0be
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u32-strncpy.c
+tests/unistr/test-strncpy.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u32-strncpy
+check_PROGRAMS += test-u32-strncpy
+test_u32_strncpy_SOURCES = unistr/test-u32-strncpy.c
diff --git a/modules/unistr/u32-strnlen-tests b/modules/unistr/u32-strnlen-tests
new file mode 100644 (file)
index 0000000..1687ff7
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u32-strnlen.c
+tests/unistr/test-strnlen.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u32-strnlen
+check_PROGRAMS += test-u32-strnlen
+test_u32_strnlen_SOURCES = unistr/test-u32-strnlen.c
diff --git a/modules/unistr/u32-to-u16-tests b/modules/unistr/u32-to-u16-tests
new file mode 100644 (file)
index 0000000..6b10e1e
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-to-u16.c
+tests/macros.h
+
+Depends-on:
+unistr/u16-cmp
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-to-u16
+check_PROGRAMS += test-u32-to-u16
+test_u32_to_u16_SOURCES = unistr/test-u32-to-u16.c
diff --git a/modules/unistr/u32-to-u8-tests b/modules/unistr/u32-to-u8-tests
new file mode 100644 (file)
index 0000000..534c749
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u32-to-u8.c
+tests/macros.h
+
+Depends-on:
+unistr/u8-cmp
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-to-u8
+check_PROGRAMS += test-u32-to-u8
+test_u32_to_u8_SOURCES = unistr/test-u32-to-u8.c
diff --git a/modules/unistr/u32-uctomb-tests b/modules/unistr/u32-uctomb-tests
new file mode 100644 (file)
index 0000000..27e2c9c
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u32-uctomb.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-uctomb
+check_PROGRAMS += test-u32-uctomb
+test_u32_uctomb_SOURCES = unistr/test-u32-uctomb.c
diff --git a/modules/unistr/u8-check-tests b/modules/unistr/u8-check-tests
new file mode 100644 (file)
index 0000000..c50c8f1
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-check.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-check
+check_PROGRAMS += test-u8-check
+test_u8_check_SOURCES = unistr/test-u8-check.c
diff --git a/modules/unistr/u8-chr-tests b/modules/unistr/u8-chr-tests
new file mode 100644 (file)
index 0000000..ecaead9
--- /dev/null
@@ -0,0 +1,21 @@
+Files:
+tests/unistr/test-u8-chr.c
+tests/unistr/test-chr.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+unistr/u8-set
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u8-chr
+check_PROGRAMS += test-u8-chr
+test_u8_chr_SOURCES = unistr/test-u8-chr.c
diff --git a/modules/unistr/u8-cmp-tests b/modules/unistr/u8-cmp-tests
new file mode 100644 (file)
index 0000000..959a24e
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u8-cmp.c
+tests/unistr/test-cmp.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u8-cmp
+check_PROGRAMS += test-u8-cmp
+test_u8_cmp_SOURCES = unistr/test-u8-cmp.c
diff --git a/modules/unistr/u8-cmp2-tests b/modules/unistr/u8-cmp2-tests
new file mode 100644 (file)
index 0000000..4224efd
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-cmp2.c
+tests/unistr/test-cmp2.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-cmp2
+check_PROGRAMS += test-u8-cmp2
+test_u8_cmp2_SOURCES = unistr/test-u8-cmp2.c
diff --git a/modules/unistr/u8-cpy-alloc-tests b/modules/unistr/u8-cpy-alloc-tests
new file mode 100644 (file)
index 0000000..5f71e77
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-cpy-alloc.c
+tests/unistr/test-cpy-alloc.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-cpy-alloc
+check_PROGRAMS += test-u8-cpy-alloc
+test_u8_cpy_alloc_SOURCES = unistr/test-u8-cpy-alloc.c
diff --git a/modules/unistr/u8-cpy-tests b/modules/unistr/u8-cpy-tests
new file mode 100644 (file)
index 0000000..59c8c67
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-cpy.c
+tests/unistr/test-cpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-cpy
+check_PROGRAMS += test-u8-cpy
+test_u8_cpy_SOURCES = unistr/test-u8-cpy.c
diff --git a/modules/unistr/u8-mblen-tests b/modules/unistr/u8-mblen-tests
new file mode 100644 (file)
index 0000000..14e714b
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-mblen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-mblen
+check_PROGRAMS += test-u8-mblen
+test_u8_mblen_SOURCES = unistr/test-u8-mblen.c
index 4508817..eaa6e1f 100644 (file)
@@ -6,7 +6,7 @@ lib/unistr/u8-mbsnlen.c
 
 Depends-on:
 unistr/base
-unistr/u8-mblen
+unistr/u8-mbtoucr
 
 configure.ac:
 
diff --git a/modules/unistr/u8-mbsnlen-tests b/modules/unistr/u8-mbsnlen-tests
new file mode 100644 (file)
index 0000000..50b2711
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-mbsnlen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-mbsnlen
+check_PROGRAMS += test-u8-mbsnlen
+test_u8_mbsnlen_SOURCES = unistr/test-u8-mbsnlen.c
diff --git a/modules/unistr/u8-mbtouc-tests b/modules/unistr/u8-mbtouc-tests
new file mode 100644 (file)
index 0000000..eedb31d
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-mbtouc.c
+tests/unistr/test-u8-mbtouc.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-mbtouc
+check_PROGRAMS += test-u8-mbtouc
+test_u8_mbtouc_SOURCES = unistr/test-u8-mbtouc.c
diff --git a/modules/unistr/u8-mbtouc-unsafe-tests b/modules/unistr/u8-mbtouc-unsafe-tests
new file mode 100644 (file)
index 0000000..f3a84c8
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-mbtouc-unsafe.c
+tests/unistr/test-u8-mbtouc.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-mbtouc-unsafe
+check_PROGRAMS += test-u8-mbtouc-unsafe
+test_u8_mbtouc_unsafe_SOURCES = unistr/test-u8-mbtouc-unsafe.c
diff --git a/modules/unistr/u8-mbtoucr-tests b/modules/unistr/u8-mbtoucr-tests
new file mode 100644 (file)
index 0000000..3e64eb0
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-mbtoucr.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-mbtoucr
+check_PROGRAMS += test-u8-mbtoucr
+test_u8_mbtoucr_SOURCES = unistr/test-u8-mbtoucr.c
diff --git a/modules/unistr/u8-move-tests b/modules/unistr/u8-move-tests
new file mode 100644 (file)
index 0000000..9a0744c
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-move.c
+tests/unistr/test-move.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-move
+check_PROGRAMS += test-u8-move
+test_u8_move_SOURCES = unistr/test-u8-move.c
index fbef6f8..783fb44 100644 (file)
@@ -6,6 +6,7 @@ lib/unistr/u8-next.c
 
 Depends-on:
 unistr/base
+unistr/u8-strmbtouc
 
 configure.ac:
 
diff --git a/modules/unistr/u8-next-tests b/modules/unistr/u8-next-tests
new file mode 100644 (file)
index 0000000..1840af9
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-next.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-next
+check_PROGRAMS += test-u8-next
+test_u8_next_SOURCES = unistr/test-u8-next.c
diff --git a/modules/unistr/u8-prev-tests b/modules/unistr/u8-prev-tests
new file mode 100644 (file)
index 0000000..a652742
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-prev.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-prev
+check_PROGRAMS += test-u8-prev
+test_u8_prev_SOURCES = unistr/test-u8-prev.c
diff --git a/modules/unistr/u8-set-tests b/modules/unistr/u8-set-tests
new file mode 100644 (file)
index 0000000..a5fbb20
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-set.c
+tests/unistr/test-set.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-set
+check_PROGRAMS += test-u8-set
+test_u8_set_SOURCES = unistr/test-u8-set.c
diff --git a/modules/unistr/u8-stpcpy-tests b/modules/unistr/u8-stpcpy-tests
new file mode 100644 (file)
index 0000000..89f7c6c
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-stpcpy.c
+tests/unistr/test-stpcpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-stpcpy
+check_PROGRAMS += test-u8-stpcpy
+test_u8_stpcpy_SOURCES = unistr/test-u8-stpcpy.c
diff --git a/modules/unistr/u8-stpncpy-tests b/modules/unistr/u8-stpncpy-tests
new file mode 100644 (file)
index 0000000..ab5899c
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u8-stpncpy.c
+tests/unistr/test-stpncpy.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u8-stpncpy
+check_PROGRAMS += test-u8-stpncpy
+test_u8_stpncpy_SOURCES = unistr/test-u8-stpncpy.c
diff --git a/modules/unistr/u8-strcat-tests b/modules/unistr/u8-strcat-tests
new file mode 100644 (file)
index 0000000..84635c7
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-strcat.c
+tests/unistr/test-strcat.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-strcat
+check_PROGRAMS += test-u8-strcat
+test_u8_strcat_SOURCES = unistr/test-u8-strcat.c
diff --git a/modules/unistr/u8-strcmp-tests b/modules/unistr/u8-strcmp-tests
new file mode 100644 (file)
index 0000000..7b8bc17
--- /dev/null
@@ -0,0 +1,14 @@
+Files:
+tests/unistr/test-u8-strcmp.c
+tests/unistr/test-u8-strcmp.h
+tests/unistr/test-strcmp.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-strcmp
+check_PROGRAMS += test-u8-strcmp
+test_u8_strcmp_SOURCES = unistr/test-u8-strcmp.c
diff --git a/modules/unistr/u8-strcoll-tests b/modules/unistr/u8-strcoll-tests
new file mode 100644 (file)
index 0000000..095409a
--- /dev/null
@@ -0,0 +1,15 @@
+Files:
+tests/unistr/test-u8-strcoll.c
+tests/unistr/test-u8-strcmp.h
+tests/unistr/test-strcmp.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-strcoll
+check_PROGRAMS += test-u8-strcoll
+test_u8_strcoll_SOURCES = unistr/test-u8-strcoll.c
+test_u8_strcoll_LDADD = $(LDADD) @LIBICONV@
diff --git a/modules/unistr/u8-strcpy-tests b/modules/unistr/u8-strcpy-tests
new file mode 100644 (file)
index 0000000..84f5413
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-strcpy.c
+tests/unistr/test-strcpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-strcpy
+check_PROGRAMS += test-u8-strcpy
+test_u8_strcpy_SOURCES = unistr/test-u8-strcpy.c
diff --git a/modules/unistr/u8-strdup-tests b/modules/unistr/u8-strdup-tests
new file mode 100644 (file)
index 0000000..e5477b7
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-strdup.c
+tests/unistr/test-strdup.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-strdup
+check_PROGRAMS += test-u8-strdup
+test_u8_strdup_SOURCES = unistr/test-u8-strdup.c
diff --git a/modules/unistr/u8-strlen-tests b/modules/unistr/u8-strlen-tests
new file mode 100644 (file)
index 0000000..16bf677
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-strlen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-strlen
+check_PROGRAMS += test-u8-strlen
+test_u8_strlen_SOURCES = unistr/test-u8-strlen.c
diff --git a/modules/unistr/u8-strmblen-tests b/modules/unistr/u8-strmblen-tests
new file mode 100644 (file)
index 0000000..6123520
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-strmblen.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-strmblen
+check_PROGRAMS += test-u8-strmblen
+test_u8_strmblen_SOURCES = unistr/test-u8-strmblen.c
diff --git a/modules/unistr/u8-strmbtouc-tests b/modules/unistr/u8-strmbtouc-tests
new file mode 100644 (file)
index 0000000..2150a92
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-strmbtouc.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-strmbtouc
+check_PROGRAMS += test-u8-strmbtouc
+test_u8_strmbtouc_SOURCES = unistr/test-u8-strmbtouc.c
diff --git a/modules/unistr/u8-strncat-tests b/modules/unistr/u8-strncat-tests
new file mode 100644 (file)
index 0000000..1637212
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u8-strncat.c
+tests/unistr/test-strncat.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u8-strncat
+check_PROGRAMS += test-u8-strncat
+test_u8_strncat_SOURCES = unistr/test-u8-strncat.c
diff --git a/modules/unistr/u8-strncmp-tests b/modules/unistr/u8-strncmp-tests
new file mode 100644 (file)
index 0000000..cadb045
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-strncmp.c
+tests/unistr/test-strncmp.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-strncmp
+check_PROGRAMS += test-u8-strncmp
+test_u8_strncmp_SOURCES = unistr/test-u8-strncmp.c
diff --git a/modules/unistr/u8-strncpy-tests b/modules/unistr/u8-strncpy-tests
new file mode 100644 (file)
index 0000000..212c143
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u8-strncpy.c
+tests/unistr/test-strncpy.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u8-strncpy
+check_PROGRAMS += test-u8-strncpy
+test_u8_strncpy_SOURCES = unistr/test-u8-strncpy.c
diff --git a/modules/unistr/u8-strnlen-tests b/modules/unistr/u8-strnlen-tests
new file mode 100644 (file)
index 0000000..a60d2b9
--- /dev/null
@@ -0,0 +1,20 @@
+Files:
+tests/unistr/test-u8-strnlen.c
+tests/unistr/test-strnlen.h
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-u8-strnlen
+check_PROGRAMS += test-u8-strnlen
+test_u8_strnlen_SOURCES = unistr/test-u8-strnlen.c
diff --git a/modules/unistr/u8-to-u16-tests b/modules/unistr/u8-to-u16-tests
new file mode 100644 (file)
index 0000000..1dd37eb
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-to-u16.c
+tests/macros.h
+
+Depends-on:
+unistr/u16-cmp
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-to-u16
+check_PROGRAMS += test-u8-to-u16
+test_u8_to_u16_SOURCES = unistr/test-u8-to-u16.c
diff --git a/modules/unistr/u8-to-u32-tests b/modules/unistr/u8-to-u32-tests
new file mode 100644 (file)
index 0000000..0d5d338
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/unistr/test-u8-to-u32.c
+tests/macros.h
+
+Depends-on:
+unistr/u32-cmp
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-to-u32
+check_PROGRAMS += test-u8-to-u32
+test_u8_to_u32_SOURCES = unistr/test-u8-to-u32.c
diff --git a/modules/unistr/u8-uctomb-tests b/modules/unistr/u8-uctomb-tests
new file mode 100644 (file)
index 0000000..bfacf45
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/unistr/test-u8-uctomb.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-uctomb
+check_PROGRAMS += test-u8-uctomb
+test_u8_uctomb_SOURCES = unistr/test-u8-uctomb.c
index ad612ff..3bf214d 100644 (file)
@@ -12,7 +12,7 @@ gt_LOCALE_FR
 
 Makefile.am:
 TESTS += uniwbrk/test-ulc-wordbreaks.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@'
 check_PROGRAMS += test-ulc-wordbreaks
 test_ulc_wordbreaks_SOURCES = uniwbrk/test-ulc-wordbreaks.c
 test_ulc_wordbreaks_LDADD = $(LDADD) @LIBICONV@
index 523d0ba..c6caf1f 100644 (file)
@@ -10,7 +10,6 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-uc_width uniwidth/test-uc_width2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-uc_width test-uc_width2
 test_uc_width_SOURCES = uniwidth/test-uc_width.c
 test_uc_width2_SOURCES = uniwidth/test-uc_width2.c
index f49fe4d..6a57d49 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 stdbool
 symlink
 unlinkdir
diff --git a/modules/userspec-tests b/modules/userspec-tests
new file mode 100644 (file)
index 0000000..a522857
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/test-userspec.c
+
+Depends-on:
+xalloc
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-userspec
+check_PROGRAMS += test-userspec
+test_userspec_LDADD = $(LDADD) @LIBINTL@
index a9ddd27..d0566a6 100644 (file)
@@ -8,6 +8,7 @@ tests/test-utimens.c
 tests/macros.h
 
 Depends-on:
+ignore-value
 symlink
 timespec
 usleep
index 75516d8..26dbac6 100644 (file)
@@ -8,6 +8,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+ignore-value
 progname
 timespec
 usleep
index d3dc168..5320d88 100644 (file)
@@ -17,5 +17,5 @@ gt_LOCALE_FR_UTF8
 
 Makefile.am:
 TESTS += test-vasnprintf-posix test-vasnprintf-posix2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-vasnprintf-posix test-vasnprintf-posix2
index ffa2917..a7dff7a 100644 (file)
@@ -13,5 +13,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-vdprintf-posix.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-vdprintf-posix
index 94ff3b7..54936db 100644 (file)
@@ -8,6 +8,5 @@ version-etc-fsf
 
 Makefile.am:
 TESTS += test-version-etc.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-version-etc
 test_version_etc_LDADD = $(LDADD) @LIBINTL@
index 8062cd2..d4dab2d 100644 (file)
@@ -13,5 +13,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-vfprintf-posix.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-vfprintf-posix
index 66c01bd..84f250b 100644 (file)
@@ -13,5 +13,4 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-vprintf-posix.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-vprintf-posix
diff --git a/modules/warn-on-use b/modules/warn-on-use
new file mode 100644 (file)
index 0000000..f0ee83b
--- /dev/null
@@ -0,0 +1,35 @@
+Description:
+A C macro for emitting a warning if a function is used.
+
+Applicability:
+all
+
+Files:
+build-aux/warn-on-use.h
+m4/warn-on-use.m4
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       sed -n -e '/^.ifndef/,$$p' \
+         < $(top_srcdir)/build-aux/warn-on-use.h \
+         > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+Include:
+
+License:
+LGPLv2+
+
+Maintainer:
+Eric Blake
index 27194fc..cfd1dd0 100644 (file)
@@ -7,10 +7,10 @@ m4/wchar.m4
 m4/wint_t.m4
 
 Depends-on:
-include_next
-link-warning
 arg-nonnull
+include_next
 stddef
+warn-on-use
 
 configure.ac:
 gl_WCHAR_H
@@ -20,7 +20,7 @@ BUILT_SOURCES += wchar.h
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+wchar.h: wchar.in.h $(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' \
@@ -62,8 +62,8 @@ wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
              -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
            < $(srcdir)/wchar.in.h; \
        } > $@-t && \
        mv $@-t $@
index 47ba677..abedd77 100644 (file)
@@ -20,7 +20,6 @@ gt_LOCALE_ZH_CN
 Makefile.am:
 TESTS += test-wcrtomb.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_JA='@LOCALE_JA@' \
index dc362b9..1745272 100644 (file)
@@ -22,7 +22,6 @@ gt_LOCALE_ZH_CN
 Makefile.am:
 TESTS += test-wcsnrtombs1.sh test-wcsnrtombs2.sh test-wcsnrtombs3.sh test-wcsnrtombs4.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_JA='@LOCALE_JA@' \
index 757ce42..41ec997 100644 (file)
@@ -22,7 +22,6 @@ gt_LOCALE_ZH_CN
 Makefile.am:
 TESTS += test-wcsrtombs1.sh test-wcsrtombs2.sh test-wcsrtombs3.sh test-wcsrtombs4.sh
 TESTS_ENVIRONMENT += \
-  EXEEXT='@EXEEXT@' \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_JA='@LOCALE_JA@' \
index 30dc302..ca7acd2 100644 (file)
@@ -8,6 +8,5 @@ progname
 
 Makefile.am:
 TESTS += test-xalloc-die.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-xalloc-die
 test_xalloc_die_LDADD = $(LDADD) @LIBINTL@
index 22e01ca..7882b43 100644 (file)
@@ -15,7 +15,6 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-xprintf-posix.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-xfprintf-posix test-xprintf-posix
 test_xfprintf_posix_LDADD = $(LDADD) @LIBINTL@
 test_xprintf_posix_LDADD = $(LDADD) @LIBINTL@
index da7cb15..cf7acfd 100644 (file)
@@ -8,6 +8,5 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-xstrtoimax.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-xstrtoimax
 test_xstrtoimax_LDADD = $(LDADD) @LIBINTL@
index b466338..664015b 100644 (file)
@@ -4,12 +4,12 @@ tests/test-xstrtoul.c
 tests/test-xstrtol.sh
 
 Depends-on:
+inttypes
 
 configure.ac:
 
 Makefile.am:
 TESTS += test-xstrtol.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-xstrtol test-xstrtoul
 test_xstrtol_LDADD = $(LDADD) @LIBINTL@
 test_xstrtoul_LDADD = $(LDADD) @LIBINTL@
diff --git a/modules/xstrtoll b/modules/xstrtoll
new file mode 100644 (file)
index 0000000..a5da211
--- /dev/null
@@ -0,0 +1,30 @@
+Description:
+Convert string to 'long long' or 'unsigned long long', with error checking.
+
+Files:
+lib/xstrtoll.c
+lib/xstrtoull.c
+
+Depends-on:
+strtoll
+strtoull
+xstrtol
+
+configure.ac:
+AC_LIBOBJ([xstrtoll])
+AC_LIBOBJ([xstrtoull])
+AC_TYPE_LONG_LONG_INT
+test $ac_cv_type_long_long_int = no \
+  && AC_MSG_ERROR(
+      [you lack long long support; required by gnulib's xstrtoll module])
+
+Makefile.am:
+
+Include:
+"xstrtol.h"
+
+License:
+GPL
+
+Maintainer:
+Jim Meyering
diff --git a/modules/xstrtoll-tests b/modules/xstrtoll-tests
new file mode 100644 (file)
index 0000000..bef462a
--- /dev/null
@@ -0,0 +1,17 @@
+Files:
+tests/init.sh
+tests/test-xstrtol.c
+tests/test-xstrtoll.c
+tests/test-xstrtoull.c
+tests/test-xstrtoll.sh
+
+Depends-on:
+inttypes
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-xstrtoll.sh
+check_PROGRAMS += test-xstrtoll test-xstrtoull
+test_xstrtoll_LDADD = $(LDADD) $(LIBINTL)
+test_xstrtoull_LDADD = $(LDADD) $(LIBINTL)
index 8540365..67b30c5 100644 (file)
@@ -8,6 +8,5 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-xstrtoumax.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-xstrtoumax
 test_xstrtoumax_LDADD = $(LDADD) @LIBINTL@
diff --git a/modules/y0 b/modules/y0
new file mode 100644 (file)
index 0000000..0c0ea34
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+y0() function: Bessel function of the second kind of order 0.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([y0])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(Y0_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/y0-tests b/modules/y0-tests
new file mode 100644 (file)
index 0000000..77eef72
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-y0.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-y0
+check_PROGRAMS += test-y0
+test_y0_LDADD = $(LDADD) @Y0_LIBM@
diff --git a/modules/y1 b/modules/y1
new file mode 100644 (file)
index 0000000..e5ae84f
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+y1() function: Bessel function of the second kind of order 1.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([y1])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(Y1_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/y1-tests b/modules/y1-tests
new file mode 100644 (file)
index 0000000..7747ad3
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-y1.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-y1
+check_PROGRAMS += test-y1
+test_y1_LDADD = $(LDADD) @Y1_LIBM@
index 3d484da..01ba8e1 100644 (file)
@@ -10,6 +10,5 @@ configure.ac:
 
 Makefile.am:
 TESTS += test-yesno.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-yesno
 test_yesno_LDADD = $(LDADD) @LIBINTL@
diff --git a/modules/yn b/modules/yn
new file mode 100644 (file)
index 0000000..8db1308
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+yn() function: Bessel function of the second kind of order n.
+
+Files:
+m4/mathfunc.m4
+
+Depends-on:
+
+configure.ac:
+gl_COMMON_DOUBLE_MATHFUNC([yn])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(YN_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
diff --git a/modules/yn-tests b/modules/yn-tests
new file mode 100644 (file)
index 0000000..6dbea0b
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-yn.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-yn
+check_PROGRAMS += test-yn
+test_yn_LDADD = $(LDADD) @YN_LIBM@
index 979eb3c..3154f59 100644 (file)
 #   4. Finally
 #   $ exit
 
+# We require $(...) support unconditionally.
+# We require a few additional shell features only when $EXEEXT is nonempty,
+# in order to support automatic $EXEEXT emulation:
+# - hyphen-containing alias names
+# - we prefer to use ${var#...} substitution, rather than having
+#   to work around lack of support for that feature.
+# The following code attempts to find a shell with support for these features
+# and re-exec's it.  If not, it skips the current test.
+
+gl_shell_test_script_='
+test $(echo y) = y || exit 1
+test -z "$EXEEXT" && exit 0
+shopt -s expand_aliases
+alias a-b="echo zoo"
+v=abx
+     test ${v%x} = ab \
+  && test ${v#a} = bx \
+  && test $(a-b) = zoo
+'
+
+if test "x$1" = "x--no-reexec"; then
+  shift
+else
+  for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail
+  do
+    test "$re_shell_" = no_shell && continue
+    test "$re_shell_" = fail && skip_ failed to find an adequate shell
+    if "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null; then
+      exec "$re_shell_" "$0" --no-reexec "$@"
+      echo "$ME_: exec failed" 1>&2
+      exit 127
+    fi
+  done
+fi
+
+test -n "$EXEEXT" && shopt -s expand_aliases
+
 # We use a trap below for cleanup.  This requires us to go through
 # hoops to get the right exit status transported through the handler.
 # So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
@@ -92,8 +129,57 @@ remove_tmp_()
   exit $__st
 }
 
+# Given a directory name, DIR, if every entry in it that matches *.exe
+# contains only the specified bytes (see the case stmt below), then print
+# a space-separated list of those names and return 0.  Otherwise, don't
+# print anything and return 1.  Naming constraints apply also to DIR.
+find_exe_basenames_()
+{
+  feb_dir_=$1
+  feb_fail_=0
+  feb_result_=
+  feb_sp_=
+  for feb_file_ in $feb_dir_/*.exe; do
+    case $feb_file_ in
+      *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;;
+      *) # Remove leading file name components as well as the .exe suffix.
+         feb_file_=${feb_file_##*/}
+         feb_file_=${feb_file_%.exe}
+         feb_result_="$feb_result_$feb_sp_$feb_file_";;
+    esac
+    feb_sp_=' '
+  done
+  test $feb_fail_ = 0 && printf %s "$feb_result_"
+  return $feb_fail_
+}
+
+# Consider the files in directory, $1.
+# For each file name of the form PROG.exe, create an alias named
+# PROG that simply invokes PROG.exe, then return 0.  If any selected
+# file name or the directory name, $1, contains an unexpected character,
+# define no function and return 1.
+create_exe_shims_()
+{
+  case $EXEEXT in
+    '') return 0 ;;
+    .exe) ;;
+    *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;;
+  esac
+
+  base_names_=`find_exe_basenames_ $1` \
+    || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 1; }
+
+  if test -n "$base_names_"; then
+    for base_ in $base_names_; do
+      alias "$base_"="$base_$EXEEXT"
+    done
+  fi
+
+  return 0
+}
+
 # Use this function to prepend to PATH an absolute name for each
-# specified, possibly-$initial_cwd_relative, directory.
+# specified, possibly-$initial_cwd_-relative, directory.
 path_prepend_()
 {
   while test $# != 0; do
@@ -108,6 +194,10 @@ path_prepend_()
       *:*) fail_ "invalid path dir: '$abs_path_dir_'";;
     esac
     PATH="$abs_path_dir_:$PATH"
+
+    # Create an alias, FOO, for each FOO.exe in this directory.
+    create_exe_shims_ "$abs_path_dir_" \
+      || fail_ "something failed (above): $abs_path_dir_"
     shift
   done
   export PATH
diff --git a/tests/test-acos.c b/tests/test-acos.c
new file mode 100644 (file)
index 0000000..6abea73
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of acos() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (acos, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = acos (x);
+  ASSERT (y >= 0.9272952180 && y <= 0.9272952181);
+
+  return 0;
+}
diff --git a/tests/test-acosl.c b/tests/test-acosl.c
new file mode 100644 (file)
index 0000000..9533def
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of acosl() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (acosl, long double, (long double));
+
+#include "fpucw.h"
+#include "macros.h"
+
+volatile long double x;
+long double y;
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = acosl (x);
+  ASSERT (y >= 0.9272952180L && y <= 0.9272952181L);
+
+  return 0;
+}
index ad683fb..9291f52 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software: you can redistribute it and/or modify
index 7f97dae..e2c8d66 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software: you can redistribute it and/or modify
index ae56883..2344390 100644 (file)
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-areadlink-with-size.t"
@@ -39,7 +40,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_areadlink (areadlink_with_size, true);
 }
index 7521df0..c3e5822 100644 (file)
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-areadlink.t"
@@ -46,7 +47,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_areadlink (do_areadlink, true);
 }
index 9fab370..f709ea8 100644 (file)
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-areadlinkat-with-size.t"
@@ -50,7 +51,7 @@ main (void)
   int result;
 
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Basic tests.  */
   result = test_areadlink (do_areadlinkat_with_size, false);
index cb5848a..c93a2d8 100644 (file)
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-areadlinkat.t"
@@ -50,7 +51,7 @@ main (void)
   int result;
 
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Basic tests.  */
   result = test_areadlink (do_areadlinkat, false);
index 344bf37..5c0c64c 100755 (executable)
@@ -33,10 +33,10 @@ func_compare() {
 ####
 # Test --usage output
 cat > $TMP <<EOT
-Usage: test-argp [-tvCSOlp?V] [-f FILE] [-o[ARG]] [--test] [--file=FILE]
-            [--input=FILE] [--verbose] [--cantiga] [--sonet] [--option]
-            [--optional[=ARG]] [--limerick] [--poem] [--help] [--usage]
-            [--version] ARGS...
+Usage: test-argp [-tvCSOlp?V] [-f FILE] [-r FILE] [-o[ARG]] [--test]
+            [--file=FILE] [--input=FILE] [--read=FILE] [--verbose] [--cantiga]
+            [--sonet] [--option] [--optional[=ARG]] [--limerick] [--poem]
+            [--help] [--usage] [--version] ARGS...
 EOT
 
 ./test-argp$EXEEXT --usage | func_compare || ERR=1
@@ -45,9 +45,10 @@ EOT
 # Test working usage-indent format
 
 cat > $TMP <<EOT
-Usage: test-argp [-tvCSOlp?V] [-f FILE] [-o[ARG]] [--test] [--file=FILE]
-[--input=FILE] [--verbose] [--cantiga] [--sonet] [--option] [--optional[=ARG]]
-[--limerick] [--poem] [--help] [--usage] [--version] ARGS...
+Usage: test-argp [-tvCSOlp?V] [-f FILE] [-r FILE] [-o[ARG]] [--test]
+[--file=FILE] [--input=FILE] [--read=FILE] [--verbose] [--cantiga] [--sonet]
+[--option] [--optional[=ARG]] [--limerick] [--poem] [--help] [--usage]
+[--version] ARGS...
 EOT
 
 ARGP_HELP_FMT='usage-indent=0' ./test-argp$EXEEXT --usage | func_compare || ERR=1
@@ -62,7 +63,8 @@ documentation string
   -t, --test
 
  Option Group 1
-  -f, --file=FILE, --input=FILE   Option with a mandatory argument
+  -f, -r, --file=FILE, --input=FILE, --read=FILE
+                             Option with a mandatory argument
   -v, --verbose              Simple option without arguments
 
  Option Group 1.1
index 14ed52d..675951f 100644 (file)
@@ -34,6 +34,7 @@ struct test_args
   int test;
   int verbose;
   char *file;
+  int read;
   char *hidden;
   int opt;
   char *optional;
@@ -42,12 +43,12 @@ struct test_args
   int group_1_1_option;
 };
 
-static struct argp_option group1_option[] =
-{
-  { NULL, 0, NULL, 0, "Option Group 1", 0},
+static struct argp_option group1_option[] = {
+  { NULL, 0, NULL, 0, "Option Group 1", 0 },
   { "verbose", 'v', NULL, 0, "Simple option without arguments", 1 },
   { "file", 'f', "FILE", 0, "Option with a mandatory argument", 1 },
   { "input", 0, NULL, OPTION_ALIAS, NULL, 1 },
+  { "read", 'r', NULL, OPTION_ALIAS, NULL, 1 },
   { "hidden", 'H', "FILE", OPTION_HIDDEN, "Hidden option", 1 },
   { NULL, 0, NULL, 0, NULL, 0 }
 };
@@ -63,6 +64,9 @@ group1_parser (int key, char *arg, struct argp_state *state)
       args->verbose++;
       break;
 
+    case 'r':
+      args->read = 1;
+      /* fall through */
     case 'f':
       args->file = arg;
       break;
@@ -88,11 +92,10 @@ struct argp_child group1_child = {
   "",
   1
 };
-
 \f
-static struct argp_option group1_1_option[] =
-{
-  { NULL, 0, NULL, 0, "Option Group 1.1", 0},
+
+static struct argp_option group1_1_option[] = {
+  { NULL, 0, NULL, 0, "Option Group 1.1", 0 },
   { "cantiga", 'C', NULL, 0, "create a cantiga" },
   { "sonet", 'S', NULL, 0, "create a sonet" },
   { NULL, 0, NULL, 0, NULL, 0 }
@@ -125,17 +128,16 @@ struct argp_child group1_1_child = {
   "",
   2
 };
-
 \f
-static struct argp_option group2_option[] =
-{
-  { NULL, 0, NULL, 0, "Option Group 2", 0},
+
+static struct argp_option group2_option[] = {
+  { NULL, 0, NULL, 0, "Option Group 2", 0 },
   { "option", 'O', NULL, 0, "An option", 1 },
   { "optional", 'o', "ARG", OPTION_ARG_OPTIONAL,
     "Option with an optional argument. ARG is one of the following:", 2 },
-  { "one", 0, NULL, OPTION_DOC|OPTION_NO_TRANS, "one unit", 3 },
-  { "two", 0, NULL, OPTION_DOC|OPTION_NO_TRANS, "two units", 3 },
-  { "many", 0, NULL, OPTION_DOC|OPTION_NO_TRANS, "many units", 3 },
+  { "one", 0, NULL, OPTION_DOC | OPTION_NO_TRANS, "one unit", 3 },
+  { "two", 0, NULL, OPTION_DOC | OPTION_NO_TRANS, "two units", 3 },
+  { "many", 0, NULL, OPTION_DOC | OPTION_NO_TRANS, "many units", 3 },
   { NULL, 0, NULL, 0, NULL, 0 }
 };
 
@@ -172,11 +174,10 @@ struct argp_child group2_child = {
   "",
   2
 };
-
 \f
-static struct argp_option group2_1_option[] =
-{
-  { NULL, 0, NULL, 0, "Option Group 2.1", 0},
+
+static struct argp_option group2_1_option[] = {
+  { NULL, 0, NULL, 0, "Option Group 2.1", 0 },
   { "poem", 'p', NULL, 0, "create a poem" },
   { "limerick", 'l', NULL, 0, "create a limerick" },
   { NULL, 0, NULL, 0, NULL, 0 }
@@ -209,14 +210,13 @@ struct argp_child group2_1_child = {
   "",
   2
 };
-
 \f
-static struct argp_option main_options[] =
-  {
-    { NULL, 0, NULL, 0, "Main options", 0},
-    { "test", 't', NULL, 0, NULL, 1 },
-    { NULL, 0, NULL, 0, NULL, 0 }
-  };
+
+static struct argp_option main_options[] = {
+  { NULL, 0, NULL, 0, "Main options", 0 },
+  { "test", 't', NULL, 0, NULL, 1 },
+  { NULL, 0, NULL, 0, NULL, 0 }
+};
 
 static error_t
 parse_opt (int key, char *arg, struct argp_state *state)
@@ -228,7 +228,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
     {
     case ARGP_KEY_INIT:
       for (i = 0; state->root_argp->children[i].argp; i++)
-        state->child_inputs[i] = args;
+       state->child_inputs[i] = args;
       break;
 
     case 't':
@@ -281,160 +281,168 @@ int test_number;
 unsigned failure_count = 0;
 
 void
-fail(const char *msg)
+fail (const char *msg)
 {
-  fprintf(stderr, "Test %d: %s\n", test_number, msg);
+  fprintf (stderr, "Test %d: %s\n", test_number, msg);
   failure_count++;
 }
 
 void
-test1(struct argp *argp)
+test1 (struct argp *argp)
 {
   INIT_TEST1 (1, "--test");
   if (argp_parse (argp, argc, argv, 0, NULL, &test_args))
-    fail("argp_parse failed");
+    fail ("argp_parse failed");
   else if (test_args.test != 1)
-    fail("option not processed");
+    fail ("option not processed");
 }
 
 void
-test2(struct argp *argp)
+test2 (struct argp *argp)
 {
   INIT_TEST1 (2, "-t");
   if (argp_parse (argp, argc, argv, 0, NULL, &test_args))
-    fail("argp_parse failed");
+    fail ("argp_parse failed");
   else if (test_args.test != 1)
-    fail("option not processed");
+    fail ("option not processed");
 }
 
 void
-test_file(struct argp *argp, int argc, char **argv, struct test_args *args)
+test_file (struct argp *argp, int argc, char **argv, struct test_args *args)
 {
   if (argp_parse (argp, argc, argv, 0, NULL, args))
-    fail("argp_parse failed");
+    fail ("argp_parse failed");
   else if (!args->file)
-    fail("option not processed");
+    fail ("option not processed");
   else if (strcmp (args->file, "FILE"))
-    fail("option processed incorrectly");
+    fail ("option processed incorrectly");
 }
 
 void
-test3(struct argp *argp)
+test3 (struct argp *argp)
 {
   INIT_TEST1 (3, "--file=FILE");
   test_file (argp, argc, argv, &test_args);
 }
 
 void
-test4(struct argp *argp)
+test4 (struct argp *argp)
 {
   INIT_TEST2 (4, "--file", "FILE");
   test_file (argp, argc, argv, &test_args);
 }
 
 void
-test5(struct argp *argp)
+test5 (struct argp *argp)
 {
   INIT_TEST1 (5, "--input=FILE");
   test_file (argp, argc, argv, &test_args);
 }
 
 void
-test6(struct argp *argp)
+test6 (struct argp *argp)
 {
   INIT_TEST2 (6, "--input", "FILE");
   test_file (argp, argc, argv, &test_args);
 }
 
 void
-test_optional(struct argp *argp, int argc, char **argv,
-              struct test_args *args, char *val, char *a)
+test_optional (struct argp *argp, int argc, char **argv,
+              struct test_args *args, char *val, char *a)
 {
   int index;
   if (argp_parse (argp, argc, argv, 0, &index, args))
-    fail("argp_parse failed");
+    fail ("argp_parse failed");
   else if (!args->optional_set)
-    fail("option not processed");
+    fail ("option not processed");
 
   if (!val)
     {
       if (args->optional)
-        fail("option processed incorrectly");
+       fail ("option processed incorrectly");
     }
   else if (strcmp (args->optional, val))
-    fail("option processed incorrectly");
+    fail ("option processed incorrectly");
 
   if (a)
     {
       if (index == argc)
-        fail("expected command line argument not found");
-      else if (strcmp(argv[index], a))
-        fail("expected command line argument does not match");
+       fail ("expected command line argument not found");
+      else if (strcmp (argv[index], a))
+       fail ("expected command line argument does not match");
     }
 }
 
 void
-test7(struct argp *argp)
+test7 (struct argp *argp)
 {
   INIT_TEST1 (7, "-oARG");
-  test_optional(argp, argc, argv, &test_args, "ARG", NULL);
+  test_optional (argp, argc, argv, &test_args, "ARG", NULL);
 }
 
 void
-test8(struct argp *argp)
+test8 (struct argp *argp)
 {
   INIT_TEST2 (8, "-o", "ARG");
-  test_optional(argp, argc, argv, &test_args, NULL, "ARG");
+  test_optional (argp, argc, argv, &test_args, NULL, "ARG");
 }
 
 void
-test9(struct argp *argp)
+test9 (struct argp *argp)
 {
   INIT_TEST1 (9, "--optional=ARG");
-  test_optional(argp, argc, argv, &test_args, "ARG", NULL);
+  test_optional (argp, argc, argv, &test_args, "ARG", NULL);
 }
 
 void
-test10(struct argp *argp)
+test10 (struct argp *argp)
 {
   INIT_TEST2 (10, "--optional", "ARG");
-  test_optional(argp, argc, argv, &test_args, NULL, "ARG");
+  test_optional (argp, argc, argv, &test_args, NULL, "ARG");
 }
 
 void
-test11(struct argp *argp)
+test11 (struct argp *argp)
 {
   INIT_TEST1 (11, "--optiona=ARG");
-  test_optional(argp, argc, argv, &test_args, "ARG", NULL);
+  test_optional (argp, argc, argv, &test_args, "ARG", NULL);
 }
 
 void
-test12(struct argp *argp)
+test12 (struct argp *argp)
 {
   INIT_TEST3 (12, "--option", "--optional=OPT", "FILE");
-  test_optional(argp, argc, argv, &test_args, "OPT", "FILE");
+  test_optional (argp, argc, argv, &test_args, "OPT", "FILE");
 }
 
 void
-test13(struct argp *argp)
+test13 (struct argp *argp)
 {
   INIT_TEST1 (1, "--cantiga");
   if (argp_parse (argp, argc, argv, 0, NULL, &test_args))
-    fail("argp_parse failed");
+    fail ("argp_parse failed");
   else if (test_args.group_1_1_option != 'C')
-    fail("option not processed");
+    fail ("option not processed");
 }
 
 void
-test14(struct argp *argp)
+test14 (struct argp *argp)
 {
   INIT_TEST1 (1, "--limerick");
   if (argp_parse (argp, argc, argv, 0, NULL, &test_args))
-    fail("argp_parse failed");
+    fail ("argp_parse failed");
   else if (test_args.group_2_1_option != 'l')
-    fail("option not processed");
+    fail ("option not processed");
 }
 
+void
+test15 (struct argp *argp)
+{
+  INIT_TEST2 (1, "-r", "FILE");
+  test_file (argp, argc, argv, &test_args);
+  if (!test_args.read)
+    fail ("short alias not recognized properly");
+}
 
 
 typedef void (*test_fp) (struct argp *argp);
@@ -443,7 +451,7 @@ test_fp test_fun[] = {
   test1,  test2,  test3,  test4,
   test5,  test6,  test7,  test8,
   test9,  test10, test11, test12,
-  test13, test14,
+  test13, test14, test15,
   NULL
 };
 
@@ -471,7 +479,7 @@ main (int argc, char **argv)
   if (argc > 0)
     {
       struct test_args test_args;
-      init_args(test_args);
+      init_args (test_args);
       return argp_parse (&test_argp, argc, argv, 0, NULL, &test_args);
     }
 
index 868635c..d0597bd 100644 (file)
@@ -26,7 +26,7 @@
 #include "macros.h"
 
 #define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
-#define STREQ(s1, s2) (strcmp (s1, s2) == 0)
+#define STREQ(a, b) (strcmp (a, b) == 0)
 
 static FILE *
 write_nul_delimited_argv (char **argv)
diff --git a/tests/test-asin.c b/tests/test-asin.c
new file mode 100644 (file)
index 0000000..178e527
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of asin() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (asin, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = asin (x);
+  ASSERT (y >= 0.6435011087 && y <= 0.6435011088);
+
+  return 0;
+}
diff --git a/tests/test-asinl.c b/tests/test-asinl.c
new file mode 100644 (file)
index 0000000..8b60457
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of asinl() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (asinl, long double, (long double));
+
+#include "fpucw.h"
+#include "macros.h"
+
+volatile long double x;
+long double y;
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = asinl (x);
+  ASSERT (y >= 0.6435011087L && y <= 0.6435011088L);
+
+  return 0;
+}
diff --git a/tests/test-atan.c b/tests/test-atan.c
new file mode 100644 (file)
index 0000000..25c9eab
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of atan() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (atan, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = atan (x);
+  ASSERT (y >= 0.5404195002 && y <= 0.5404195003);
+
+  return 0;
+}
diff --git a/tests/test-atan2.c b/tests/test-atan2.c
new file mode 100644 (file)
index 0000000..07022c7
--- /dev/null
@@ -0,0 +1,60 @@
+/* Test of atan2() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (atan2, double, (double, double));
+
+#include "macros.h"
+
+volatile double x;
+volatile double y;
+double z;
+
+int
+main ()
+{
+  /* A particular value in the first quadrant.  */
+  x = 0.6;
+  y = 0.8;
+  z = atan2 (y, x);
+  ASSERT (z >= 0.9272952180 && z <= 0.9272952181);
+
+  /* A particular value in the second quadrant.  */
+  x = -0.6;
+  y = 0.8;
+  z = atan2 (y, x);
+  ASSERT (z >= 2.214297435 && z <= 2.214297436);
+
+  /* A particular value in the third quadrant.  */
+  x = -0.6;
+  y = -0.8;
+  z = atan2 (y, x);
+  ASSERT (z >= -2.214297436 && z <= -2.214297435);
+
+  /* A particular value in the fourth quadrant.  */
+  x = 0.6;
+  y = -0.8;
+  z = atan2 (y, x);
+  ASSERT (z >= -0.9272952181 && z <= -0.9272952180);
+
+  return 0;
+}
diff --git a/tests/test-atanl.c b/tests/test-atanl.c
new file mode 100644 (file)
index 0000000..c365401
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of atanl() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (atanl, long double, (long double));
+
+#include "fpucw.h"
+#include "macros.h"
+
+volatile long double x;
+long double y;
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = atanl (x);
+  ASSERT (y >= 0.5404195002L && y <= 0.5404195003L);
+
+  return 0;
+}
index 816b401..cbf481d 100644 (file)
@@ -32,6 +32,7 @@ SIGNATURE_CHECK (canonicalize_file_name, char *, (const char *));
 #include <unistd.h>
 
 #include "same-inode.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "t-can-lgpl.tmp"
@@ -55,7 +56,7 @@ main (void)
      any leftovers from a previous partial run.  */
   {
     int fd;
-    system ("rm -rf " BASE " ise");
+    ignore_value (system ("rm -rf " BASE " ise"));
     ASSERT (mkdir (BASE, 0700) == 0);
     fd = creat (BASE "/tra", 0600);
     ASSERT (0 <= fd);
index b3086b1..f8d3536 100644 (file)
@@ -29,6 +29,7 @@
 #include <unistd.h>
 
 #include "same-inode.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "t-can.tmp"
@@ -46,7 +47,7 @@ main (void)
      any leftovers from a previous partial run.  */
   {
     int fd;
-    system ("rm -rf " BASE " ise");
+    ignore_value (system ("rm -rf " BASE " ise"));
     ASSERT (mkdir (BASE, 0700) == 0);
     fd = creat (BASE "/tra", 0600);
     ASSERT (0 <= fd);
diff --git a/tests/test-cbrt.c b/tests/test-cbrt.c
new file mode 100644 (file)
index 0000000..dae88ca
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of cbrt() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (cbrt, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = cbrt (x);
+  ASSERT (y >= 0.8434326653 && y <= 0.8434326654);
+
+  return 0;
+}
index 57bb810..380c9a3 100644 (file)
@@ -32,6 +32,7 @@ SIGNATURE_CHECK (chown, int, (char const *, uid_t, gid_t));
 
 #include "mgetgroups.h"
 #include "stat-time.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-chown.t"
@@ -42,7 +43,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_chown (chown, true);
 }
index bde436e..6b99b18 100644 (file)
@@ -26,6 +26,7 @@
 #include <unistd.h>
 
 #include "binary-io.h"
+#include "ignore-value.h"
 
 char *program_name;
 
@@ -47,6 +48,6 @@ main (int argc, char **argv)
     close (0);
 
   if (argc > 1)
-    fread (buf, 1, 6, stdin);
+    ignore_value (fread (buf, 1, 6, stdin));
   return 0;
 }
index d7e50f4..ca38229 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of condition variables in multithreaded situations.
-   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -198,9 +198,12 @@ main ()
 
 /* No multithreading available.  */
 
+#include <stdio.h>
+
 int
 main ()
 {
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
   return 77;
 }
 
diff --git a/tests/test-copysign.c b/tests/test-copysign.c
new file mode 100644 (file)
index 0000000..60bda2f
--- /dev/null
@@ -0,0 +1,60 @@
+/* Test of copysign() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (copysign, double, (double, double));
+
+#include "macros.h"
+
+volatile double x;
+volatile double y;
+double z;
+
+int
+main ()
+{
+  /* A particular value in the first quadrant.  */
+  x = 0.6;
+  y = 0.8;
+  z = copysign (x, y);
+  ASSERT (z == 0.6);
+
+  /* A particular value in the second quadrant.  */
+  x = -0.6;
+  y = 0.8;
+  z = copysign (x, y);
+  ASSERT (z == 0.6);
+
+  /* A particular value in the third quadrant.  */
+  x = -0.6;
+  y = -0.8;
+  z = copysign (x, y);
+  ASSERT (z == -0.6);
+
+  /* A particular value in the fourth quadrant.  */
+  x = 0.6;
+  y = -0.8;
+  z = copysign (x, y);
+  ASSERT (z == -0.6);
+
+  return 0;
+}
diff --git a/tests/test-cos.c b/tests/test-cos.c
new file mode 100644 (file)
index 0000000..3e321ff
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of cos() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (cos, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = cos (x);
+  ASSERT (y >= 0.8253356149 && y <= 0.8253356150);
+
+  return 0;
+}
diff --git a/tests/test-cosh.c b/tests/test-cosh.c
new file mode 100644 (file)
index 0000000..9c952fb
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of cosh() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (cosh, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = cosh (x);
+  ASSERT (y >= 1.185465218 && y <= 1.185465219);
+
+  return 0;
+}
diff --git a/tests/test-cosl.c b/tests/test-cosl.c
new file mode 100644 (file)
index 0000000..a13e75f
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of cosl() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (cosl, long double, (long double));
+
+#include "fpucw.h"
+#include "macros.h"
+
+volatile long double x;
+long double y;
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = cosl (x);
+  ASSERT (y >= 0.8253356149L && y <= 0.8253356150L);
+
+  return 0;
+}
index aec49e1..ad811ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Free Software Foundation
+ * Copyright (C) 2007-2010 Free Software Foundation, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index 7f74ec8..19b66da 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007 Free Software Foundation
+ * Copyright (C) 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index cbb8178..94ba0de 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2007 Free Software Foundation
+ * Copyright (C) 2005, 2007, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
diff --git a/tests/test-erf.c b/tests/test-erf.c
new file mode 100644 (file)
index 0000000..d23f12e
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of erf() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (erf, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = erf (x);
+  ASSERT (y >= 0.6038560908 && y <= 0.6038560909);
+
+  return 0;
+}
diff --git a/tests/test-erfc.c b/tests/test-erfc.c
new file mode 100644 (file)
index 0000000..8f950cf
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of erfc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (erfc, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = erfc (x);
+  ASSERT (y >= 0.3961439091 && y <= 0.3961439092);
+
+  return 0;
+}
diff --git a/tests/test-exp.c b/tests/test-exp.c
new file mode 100644 (file)
index 0000000..8b21de7
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of exp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (exp, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = exp (x);
+  ASSERT (y >= 1.822118800 && y <= 1.822118801);
+
+  return 0;
+}
diff --git a/tests/test-expl.c b/tests/test-expl.c
new file mode 100644 (file)
index 0000000..440bc0e
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of expl() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (expl, long double, (long double));
+
+#include "fpucw.h"
+#include "macros.h"
+
+volatile long double x;
+long double y;
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = expl (x);
+  ASSERT (y >= 1.822118800L && y <= 1.822118801L);
+
+  return 0;
+}
diff --git a/tests/test-fabs.c b/tests/test-fabs.c
new file mode 100644 (file)
index 0000000..2594d3d
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of fabs() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fabs, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular positive value.  */
+  x = 0.6;
+  y = fabs (x);
+  ASSERT (y == 0.6);
+
+  /* A particular negative value.  */
+  x = -0.6;
+  y = fabs (x);
+  ASSERT (y == 0.6);
+
+  return 0;
+}
index 7bc7633..0843be7 100644 (file)
@@ -33,6 +33,7 @@ SIGNATURE_CHECK (fchownat, int, (int, char const *, uid_t, gid_t, int));
 #include "mgetgroups.h"
 #include "openat.h"
 #include "stat-time.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-fchownat.t"
@@ -63,7 +64,7 @@ main (void)
   int result2; /* Skip because of no lchown support.  */
 
   /* Clean up any trash from prior testsuite runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Basic tests.  */
   result1 = test_chown (do_chown, true);
index 77a6d94..949ca47 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-fdutimensat.t"
@@ -84,7 +85,7 @@ main (void)
   int fd;
 
   /* Clean up any trash from prior testsuite runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Basic tests.  */
   result1 = test_utimens (do_utimens, true);
index 38bedd9..12403e2 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <config.h>
 
+/* None of the files accessed by this test are large, so disable the
+   ftell link warning if we are not using the gnulib ftell module.  */
+#define _GL_NO_LARGE_FILES
 #include <stdio.h>
 
 #include "signature.h"
diff --git a/tests/test-fmod.c b/tests/test-fmod.c
new file mode 100644 (file)
index 0000000..2cae38d
--- /dev/null
@@ -0,0 +1,42 @@
+/* Test of fmod() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fmod, double, (double, double));
+
+#include "macros.h"
+
+volatile double x;
+volatile double y;
+double z;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 9.245907126;
+  y = 3.141592654;
+  z = fmod (x, y);
+  ASSERT (z >= 2.962721817 && z <= 2.962721819);
+
+  return 0;
+}
index 15eff65..89fe8c0 100644 (file)
 
 #include <config.h>
 
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
 #include <stdio.h>
 
 #include <string.h>
 
 #include "macros.h"
 
-/* None of the files accessed by this test are large, so disable the
-   fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef fseek
-#endif
-
 #define TESTFILE "t-fpurge.tmp"
 
 int
index 8f337d8..2aa6743 100644 (file)
 
 #include <config.h>
 
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
 #include "freadable.h"
 
 #include <stdio.h>
 
 #include "macros.h"
 
-/* None of the files accessed by this test are large, so disable the
-   fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef fseek
-#endif
-
 #define TESTFILE "t-freadable.tmp"
 
 int
index c4c00f4..fee8228 100644 (file)
 
 #include <config.h>
 
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
 #include "freading.h"
 
 #include <stdio.h>
 
 #include "macros.h"
 
-/* None of the files accessed by this test are large, so disable the
-   fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef fseek
-#endif
-
 #define TESTFILE "t-freading.tmp"
 
 int
index 9b25e1d..46d5c8a 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <config.h>
 
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if the user requested GNULIB_POSIXCHECK.  */
+#define _GL_NO_LARGE_FILES
 #include <stdio.h>
 
 #include "signature.h"
index e8c66df..be2a78d 100644 (file)
 
 /* None of the files accessed by this test are large, so disable the
    fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef GL_LINK_WARNING
-# define GL_LINK_WARNING(ignored) ((void) 0)
-#endif
-
+#define _GL_NO_LARGE_FILES
 #include <stdio.h>
 
 #include "signature.h"
index 89cd079..63e5a13 100644 (file)
@@ -33,6 +33,7 @@ SIGNATURE_CHECK (fstatat, int, (int, char const *, struct stat *, int));
 #include "openat.h"
 #include "pathmax.h"
 #include "same-inode.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-fstatat.t"
@@ -62,7 +63,7 @@ main (void)
   int result;
 
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   result = test_stat_func (do_stat, false);
   ASSERT (test_lstat_func (do_lstat, false) == result);
index 42eff9c..6ad8e0a 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <config.h>
 
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
 #include <stdio.h>
 
 #include "signature.h"
@@ -26,12 +29,6 @@ SIGNATURE_CHECK (ftell, long, (FILE *));
 #include "binary-io.h"
 #include "macros.h"
 
-/* None of the files accessed by this test are large, so disable the
-   fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef fseek
-#endif
-
 #ifndef FUNC_UNGETC_BROKEN
 # define FUNC_UNGETC_BROKEN 0
 #endif
index 826df10..5fae570 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <config.h>
 
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
 #include <stdio.h>
 
 #include "signature.h"
@@ -26,12 +29,6 @@ SIGNATURE_CHECK (ftello, off_t, (FILE *));
 #include "binary-io.h"
 #include "macros.h"
 
-/* None of the files accessed by this test are large, so disable the
-   fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef fseek
-#endif
-
 #ifndef FUNC_UNGETC_BROKEN
 # define FUNC_UNGETC_BROKEN 0
 #endif
index 99b9903..e555312 100644 (file)
@@ -34,6 +34,7 @@ SIGNATURE_CHECK (futimens, int, (int, struct timespec const[2]));
 #include "stat-time.h"
 #include "timespec.h"
 #include "utimecmp.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-futimens.t"
@@ -44,7 +45,7 @@ int
 main (void)
 {
   /* Clean up any trash from prior testsuite runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_futimens (futimens, true);
 }
index 2d696e9..ab6ca95 100644 (file)
 
 #include <config.h>
 
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
 #include "fwritable.h"
 
 #include <stdio.h>
 
 #include "macros.h"
 
-/* None of the files accessed by this test are large, so disable the
-   fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef fseek
-#endif
-
 #define TESTFILE "t-fwritable.tmp"
 
 int
index ccc302e..d44d003 100644 (file)
 
 #include <config.h>
 
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
 #include "fwriting.h"
 
 #include <stdio.h>
 
 #include "macros.h"
 
-/* None of the files accessed by this test are large, so disable the
-   fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef fseek
-#endif
-
 #define TESTFILE "t-fwriting.tmp"
 
 int
index 3de2e67..e84903a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index c6dfe95..e46b38e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index 6b07895..69b17ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index 9ed1991..f843eed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index 7f54049..3da3196 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index db85311..8cb1ffa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index 00c8434..9d8083a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index fdaa6a8..5a12e48 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index 4726aa6..d0e6189 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002, 2003, 2004, 2005, 2007  Free Software Foundation
+ * Copyright (C) 2002, 2003, 2004, 2005, 2007, 2010 Free Software Foundation, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index ddbbe0b..33981d0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index a0bdf02..0bdae5e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index f2afa47..b5bc27a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Free Software Foundation
+ * Copyright (C) 2005, 2006, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index df99664..a5df49f 100644 (file)
@@ -33,13 +33,13 @@ int
 main (void)
 {
   FILE *f;
-  char *line = NULL;
-  size_t len = 0;
+  char *line;
+  size_t len;
   ssize_t result;
 
   /* Create test file.  */
   f = fopen ("test-getdelim.txt", "wb");
-  if (!f || fwrite ("anbcnd\0f", 1, 8, f) != 8 || fclose (f) != 0)
+  if (!f || fwrite ("anAnbcnd\0f", 1, 10, f) != 10 || fclose (f) != 0)
     {
       fputs ("Failed to create sample file.\n", stderr);
       remove ("test-getdelim.txt");
@@ -54,13 +54,24 @@ main (void)
     }
 
   /* Test initial allocation, which must include trailing NUL.  */
+  line = NULL;
+  len = 0;
   result = getdelim (&line, &len, 'n', f);
   ASSERT (result == 2);
   ASSERT (strcmp (line, "an") == 0);
   ASSERT (2 < len);
+  free (line);
 
-  /* Test growth of buffer.  */
+  /* Test initial allocation again, with line = NULL and len != 0.  */
+  line = NULL;
+  len = (size_t)(~0) / 4;
+  result = getdelim (&line, &len, 'n', f);
+  ASSERT (result == 2);
+  ASSERT (strcmp (line, "An") == 0);
+  ASSERT (2 < len);
   free (line);
+
+  /* Test growth of buffer.  */
   line = malloc (1);
   len = 1;
   result = getdelim (&line, &len, 'n', f);
index a63839b..c500f41 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Free Software Foundation
+ * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson.
  *
  * This program is free software: you can redistribute it and/or modify
index 7112b52..6a661ce 100644 (file)
@@ -33,13 +33,13 @@ int
 main (void)
 {
   FILE *f;
-  char *line = NULL;
-  size_t len = 0;
+  char *line;
+  size_t len;
   ssize_t result;
 
   /* Create test file.  */
   f = fopen ("test-getline.txt", "wb");
-  if (!f || fwrite ("a\nbc\nd\0f", 1, 8, f) != 8 || fclose (f) != 0)
+  if (!f || fwrite ("a\nA\nbc\nd\0f", 1, 10, f) != 10 || fclose (f) != 0)
     {
       fputs ("Failed to create sample file.\n", stderr);
       remove ("test-getline.txt");
@@ -54,13 +54,24 @@ main (void)
     }
 
   /* Test initial allocation, which must include trailing NUL.  */
+  line = NULL;
+  len = 0;
   result = getline (&line, &len, f);
   ASSERT (result == 2);
   ASSERT (strcmp (line, "a\n") == 0);
   ASSERT (2 < len);
+  free (line);
 
-  /* Test growth of buffer, must not leak.  */
+  /* Test initial allocation again, with line = NULL and len != 0.  */
+  line = NULL;
+  len = (size_t)(~0) / 4;
+  result = getline (&line, &len, f);
+  ASSERT (result == 2);
+  ASSERT (strcmp (line, "A\n") == 0);
+  ASSERT (2 < len);
   free (line);
+
+  /* Test growth of buffer, must not leak.  */
   line = malloc (1);
   len = 0;
   result = getline (&line, &len, f);
diff --git a/tests/test-getlogin.c b/tests/test-getlogin.c
new file mode 100644 (file)
index 0000000..1365108
--- /dev/null
@@ -0,0 +1,70 @@
+/* Test of getting user name.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getlogin, char *, (void));
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  char *buf;
+
+  /* Test value.  */
+  buf = getlogin ();
+  if (buf == NULL)
+    {
+      /* getlogin() fails when stdin is not connected to a tty.  */
+      ASSERT (! isatty (0));
+      fprintf (stderr, "Skipping test: stdin is not a tty.\n");
+      return 77;
+    }
+
+  /* Compare against the value from the environment.  */
+#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
+  /* Unix platform */
+  {
+    const char *name = getenv ("LOGNAME");
+    if (name == NULL || name[0] == '\0')
+      name = getenv ("USER");
+    if (name != NULL && name[0] != '\0')
+      ASSERT (strcmp (buf, name) == 0);
+  }
+#endif
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+  /* Native Windows platform.
+     Note: This test would fail on Cygwin in an ssh session, because sshd
+     sets USERNAME=SYSTEM.  */
+  {
+    const char *name = getenv ("USERNAME");
+    if (name != NULL && name[0] != '\0')
+      ASSERT (strcmp (buf, name) == 0);
+  }
+#endif
+
+  return 0;
+}
index f566e03..68c6812 100644 (file)
@@ -24,6 +24,7 @@
 SIGNATURE_CHECK (getlogin_r, int, (char *, size_t));
 
 #include <errno.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -35,7 +36,13 @@ main (void)
   /* Test with a large enough buffer.  */
   char buf[1024];
 
-  ASSERT (getlogin_r (buf, sizeof (buf)) == 0);
+  if (getlogin_r (buf, sizeof (buf)) != 0)
+    {
+      /* getlogin_r() fails when stdin is not connected to a tty.  */
+      ASSERT (! isatty (0));
+      fprintf (stderr, "Skipping test: stdin is not a tty.\n");
+      return 77;
+    }
 
   /* Compare against the value from the environment.  */
 #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
index fe822ed..6bcb8e6 100644 (file)
 
 /* None of the files accessed by this test are large, so disable the
    ftell link warning if we are not using the gnulib ftell module.  */
-#if !GNULIB_FTELL
-# undef GL_LINK_WARNING
-# define GL_LINK_WARNING(ignored) ((void) 0)
-#endif
+#define _GL_NO_LARGE_FILES
 
 #if GNULIB_GETOPT_GNU
 # include <getopt.h>
index bd6698d..ff2bc72 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2007, 2009 Free Software Foundation
+ * Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
  * Written by Jim Meyering.
  *
  * This program is free software: you can redistribute it and/or modify
@@ -20,7 +20,8 @@
 #include <sys/time.h>
 
 #include "signature.h"
-SIGNATURE_CHECK (gettimeofday, int, (struct timeval *, void *));
+SIGNATURE_CHECK (gettimeofday, int,
+                 (struct timeval *, GETTIMEOFDAY_TIMEZONE *));
 
 #include <time.h>
 
@@ -42,8 +43,5 @@ main (void)
       fprintf (stderr, "gettimeofday still clobbers the localtime buffer!\n");
       return 1;
     }
-  else
-    {
-      return 0;
-    }
+  return 0;
 }
index 0ee24ec..1715033 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Free Software Foundation
+ * Copyright (C) 2009, 2010 Free Software Foundation, Inc.
  * Written by Jim Meyering
  *
  * This program is free software: you can redistribute it and/or modify
index d4b2de1..4b6e43a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index 8482214..536d1e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/tests/test-hypot.c b/tests/test-hypot.c
new file mode 100644 (file)
index 0000000..d91dd1d
--- /dev/null
@@ -0,0 +1,42 @@
+/* Test of hypot() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (hypot, double, (double, double));
+
+#include "macros.h"
+
+volatile double x;
+volatile double y;
+double z;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.4;
+  y = 0.6;
+  z = hypot (x, y);
+  ASSERT (z >= 0.7211102550 && z <= 0.7211102551);
+
+  return 0;
+}
diff --git a/tests/test-j0.c b/tests/test-j0.c
new file mode 100644 (file)
index 0000000..5cdf692
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of j0() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (j0, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 3.8;
+  y = j0 (x);
+  ASSERT (y >= -0.4025564102 && y <= -0.4025564101);
+
+  return 0;
+}
diff --git a/tests/test-j1.c b/tests/test-j1.c
new file mode 100644 (file)
index 0000000..2f48051
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of j1() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (j1, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 3.8;
+  y = j1 (x);
+  ASSERT (y >= 0.0128210029 && y <= 0.0128210030);
+
+  return 0;
+}
diff --git a/tests/test-jn.c b/tests/test-jn.c
new file mode 100644 (file)
index 0000000..c256371
--- /dev/null
@@ -0,0 +1,90 @@
+/* Test of jn() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (jn, double, (int, double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (0, x);
+  ASSERT (y >= -0.4025564102 && y <= -0.4025564101);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (1, x);
+  ASSERT (y >= 0.0128210029 && y <= 0.0128210030);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (2, x);
+  ASSERT (y >= 0.4093043064 && y <= 0.4093043065);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (3, x);
+  ASSERT (y >= 0.4180256354 && y <= 0.4180256355);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (4, x);
+  ASSERT (y >= 0.2507361705 && y <= 0.2507361706);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (5, x);
+  ASSERT (y >= 0.1098399867 && y <= 0.1098399868);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (6, x);
+  ASSERT (y >= 0.0383164262 && y <= 0.0383164263);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (7, x);
+  ASSERT (y >= 0.0111592540 && y <= 0.0111592541);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (8, x);
+  ASSERT (y >= 0.0027966149 && y <= 0.0027966150);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (9, x);
+  ASSERT (y >= 0.0006159669 && y <= 0.0006159670);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = jn (10, x);
+  ASSERT (y >= 0.0001211233 && y <= 0.0001211234);
+
+  return 0;
+}
index ce2da40..9b868eb 100644 (file)
@@ -32,6 +32,7 @@ SIGNATURE_CHECK (lchown, int, (char const *, uid_t, gid_t));
 
 #include "mgetgroups.h"
 #include "stat-time.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-lchown.t"
@@ -42,7 +43,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_lchown (lchown, true);
 }
diff --git a/tests/test-ldexp.c b/tests/test-ldexp.c
new file mode 100644 (file)
index 0000000..4d0339e
--- /dev/null
@@ -0,0 +1,48 @@
+/* Test of ldexp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (ldexp, double, (double, int));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = ldexp (x, 0);
+  ASSERT (y >= 0.5999999999 && y <= 0.6000000001);
+
+  x = 0.6;
+  y = ldexp (x, 1);
+  ASSERT (y >= 1.199999999 && y <= 1.200000001);
+
+  x = 0.6;
+  y = ldexp (x, -1);
+  ASSERT (y >= 0.2999999999 && y <= 0.3000000001);
+
+  return 0;
+}
diff --git a/tests/test-lgamma.c b/tests/test-lgamma.c
new file mode 100644 (file)
index 0000000..361b5af
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of lgamma() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (lgamma, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = lgamma (x);
+  /* Γ(x) = 1.4891922488... */
+  ASSERT (y >= 0.3982338580 && y <= 0.3982338581);
+
+  return 0;
+}
index 17b1b82..65ee9e0 100644 (file)
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (link, int, (char const *, char const *));
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-link.t"
@@ -40,7 +41,7 @@ int
 main (void)
 {
   /* Remove any garbage left from previous partial runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_link (link, true);
 }
index c2ad0e5..1dbfad5 100644 (file)
@@ -34,6 +34,7 @@ SIGNATURE_CHECK (linkat, int, (int, char const *, int, char const *, int));
 #include "filenamecat.h"
 #include "same-inode.h"
 #include "xgetcwd.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-linkat.t"
@@ -81,7 +82,7 @@ main (void)
   int result;
 
   /* Clean up any trash from prior testsuite runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Test basic link functionality, without mentioning symlinks.  */
   result = test_link (do_link, true);
diff --git a/tests/test-log.c b/tests/test-log.c
new file mode 100644 (file)
index 0000000..3fc74d2
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of log() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (log, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = log (x);
+  ASSERT (y >= -0.5108256238 && y <= -0.5108256237);
+
+  return 0;
+}
diff --git a/tests/test-log10.c b/tests/test-log10.c
new file mode 100644 (file)
index 0000000..612a292
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of log10() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (log10, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = log10 (x);
+  ASSERT (y >= -0.2218487497 && y <= -0.2218487496);
+
+  return 0;
+}
diff --git a/tests/test-log1p.c b/tests/test-log1p.c
new file mode 100644 (file)
index 0000000..aa8d82e
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of log1p() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (log1p, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = log1p (x);
+  ASSERT (y >= 0.4700036292 && y <= 0.4700036293);
+
+  return 0;
+}
diff --git a/tests/test-logb.c b/tests/test-logb.c
new file mode 100644 (file)
index 0000000..8b7a612
--- /dev/null
@@ -0,0 +1,62 @@
+/* Test of logb() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (logb, double, (double));
+
+#include <float.h>
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* Some particular values.  */
+  x = 0.6;
+  y = logb (x);
+  ASSERT (y == -1.0);
+
+  x = 1.2;
+  y = logb (x);
+  ASSERT (y == 0.0);
+
+  x = 2.1;
+  y = logb (x);
+  ASSERT (y == 1.0);
+
+  x = 3.9;
+  y = logb (x);
+  ASSERT (y == 1.0);
+
+  x = 4.0;
+  y = logb (x);
+  ASSERT (y == (FLT_RADIX == 2 ? 2.0 : 1.0));
+
+  x = 0.25;
+  y = logb (x);
+  ASSERT (y == (FLT_RADIX == 2 ? -2.0 : -1.0));
+
+  return 0;
+}
diff --git a/tests/test-logl.c b/tests/test-logl.c
new file mode 100644 (file)
index 0000000..357df92
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of logl() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (logl, long double, (long double));
+
+#include "fpucw.h"
+#include "macros.h"
+
+volatile long double x;
+long double y;
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = logl (x);
+  ASSERT (y >= -0.5108256238L && y <= -0.5108256237L);
+
+  return 0;
+}
index 23ffec4..b8f9237 100644 (file)
@@ -35,6 +35,7 @@ SIGNATURE_CHECK (lstat, int, (char const *, struct stat *));
 #include <unistd.h>
 
 #include "same-inode.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-lstat.t"
@@ -53,7 +54,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_lstat_func (do_lstat, true);
 }
index c53e8d3..d0c4d4b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index 1955aee..9602683 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
index 4ede2c4..2392850 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2009 Free Software Foundation
+ * Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software: you can redistribute it and/or modify
index 5d31e76..a801614 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2009 Free Software Foundation
+ * Copyright (C) 2008-2010 Free Software Foundation, Inc.
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
index a992fb5..bb81c0b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2009 Free Software Foundation
+ * Copyright (C) 2008-2010 Free Software Foundation, Inc.
  * Written by Eric Blake
  *
  * This program is free software: you can redistribute it and/or modify
index 48cf40d..28b8274 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2009 Free Software Foundation
+ * Copyright (C) 2008-2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software: you can redistribute it and/or modify
index babf681..a9d3558 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2007-2009 Free Software Foundation
+ * Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
  * Written by Bruno Haible and Eric Blake
  *
  * This program is free software: you can redistribute it and/or modify
index e768daf..8200244 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2009 Free Software Foundation
+ * Copyright (C) 2008-2010 Free Software Foundation, Inc.
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
index 771758e..47b242a 100644 (file)
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (mkdir, int, (char const *, mode_t));
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-mkdir.t"
@@ -40,7 +41,7 @@ int
 main (void)
 {
   /* Clean up any trash from prior testsuite runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_mkdir (mkdir, true);
 }
index 9aee33a..c745196 100644 (file)
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (mkdirat, int, (int, char const *, mode_t));
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-mkdirat.t"
@@ -51,7 +52,7 @@ main (void)
   int result;
 
   /* Clean up any trash from prior testsuite runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Test basic mkdir functionality.  */
   result = test_mkdir (do_mkdir, false);
index 84f4a8b..ecc9570 100644 (file)
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (mkfifo, int, (char const *, mode_t));
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-mkfifo.t"
@@ -40,7 +41,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_mkfifo (mkfifo, true);
 }
index 01fc4da..1651143 100644 (file)
@@ -32,6 +32,7 @@ SIGNATURE_CHECK (mknodat, int, (int, char const *, mode_t, dev_t));
 #include <string.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-mkfifoat.t"
@@ -72,7 +73,7 @@ main (void)
   int result;
 
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Basic tests.  */
   result = test_mkfifo (do_mkfifoat, true);
index 5d19f5f..16f48e9 100644 (file)
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (mknod, int, (char const *, mode_t, dev_t));
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-mknod.t"
@@ -47,7 +48,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* We can only portably test creation of fifos.  Anything else
      requires root privileges and knowledge of device numbers.  */
diff --git a/tests/test-modf.c b/tests/test-modf.c
new file mode 100644 (file)
index 0000000..754a729
--- /dev/null
@@ -0,0 +1,48 @@
+/* Test of modf() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (modf, double, (double, double *));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+double z;
+
+int
+main ()
+{
+  /* A particular positive value.  */
+  x = 5.972406760;
+  y = modf (x, &z);
+  ASSERT (y >= 0.972406759 && y <= 0.972406761);
+  ASSERT (z == 5.0);
+
+  /* A particular negative value.  */
+  x = -5.972406760;
+  y = modf (x, &z);
+  ASSERT (y >= -0.972406761 && y <= 0.972406759);
+  ASSERT (z == -5.0);
+
+  return 0;
+}
diff --git a/tests/test-nextafter.c b/tests/test-nextafter.c
new file mode 100644 (file)
index 0000000..bc1d40f
--- /dev/null
@@ -0,0 +1,53 @@
+/* Test of nextafter() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (nextafter, double, (double, double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 1.628947572;
+  /* Towards 0.  */
+  y = nextafter (x, 0);
+  ASSERT (y < x);
+  ASSERT (y > 1.628947571);
+  y = nextafter (y, x + x);
+  ASSERT (y == x);
+  /* Towards infinity.  */
+  y = nextafter (x, x + x);
+  ASSERT (y > x);
+  ASSERT (y < 1.628947573);
+  y = nextafter (y, 0);
+  ASSERT (y == x);
+  /* Towards itself.  */
+  y = nextafter (x, x);
+  ASSERT (y == x);
+
+  return 0;
+}
index 56923b4..c8a1db4 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of posix_spawn() function.
-   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -42,6 +42,11 @@ extern char **environ;
 
 #define CHILD_PROGRAM_FILENAME "test-posix_spawn3"
 #define DATA_FILENAME "t!#$%&'()*+,-;=?@[\\]^_`{|}~.tmp"
+/* On Cygwin, '*' '?' '\\' '|' cannot be used in file names.  */
+#if defined __CYGWIN__
+# undef DATA_FILENAME
+# define DATA_FILENAME "t!#$%&'()+,-;=@[]^_`{}~.tmp"
+#endif
 
 static int
 parent_main (void)
diff --git a/tests/test-pow.c b/tests/test-pow.c
new file mode 100644 (file)
index 0000000..ebfa698
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of pow() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (pow, double, (double, double));
+
+#include "macros.h"
+
+volatile double x;
+volatile double y;
+double z;
+
+int
+main ()
+{
+  /* A particular value.  */
+  z = pow (243.0, 1.2);
+  ASSERT (z >= 728.9999999 && z <= 729.0000001);
+
+  return 0;
+}
index 180c2b0..9476818 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Free Software Foundation
+ * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
index 2509680..0a0bf68 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2007 Free Software Foundation
+ * Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software: you can redistribute it and/or modify
index 4fb3a00..a144964 100644 (file)
@@ -31,6 +31,7 @@ SIGNATURE_CHECK (readlink, ssize_t, (char const *, char *, size_t));
 #include <string.h>
 #include <sys/stat.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-readlink.t"
@@ -41,7 +42,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_readlink (readlink, true);
 }
diff --git a/tests/test-remainder.c b/tests/test-remainder.c
new file mode 100644 (file)
index 0000000..50022e0
--- /dev/null
@@ -0,0 +1,42 @@
+/* Test of remainder() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (remainder, double, (double, double));
+
+#include "macros.h"
+
+volatile double x;
+volatile double y;
+double z;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 9.245907126;
+  y = 3.141592654;
+  z = remainder (x, y);
+  ASSERT (z >= -0.178870837 && z <= -0.178870835);
+
+  return 0;
+}
index 870878e..4dffcaf 100644 (file)
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (remove, int, (char const *));
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-remove.t"
@@ -38,7 +39,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Setup.  */
   ASSERT (mkdir (BASE "dir", 0700) == 0);
index 10cabf1..c5c6c43 100644 (file)
@@ -29,6 +29,7 @@ SIGNATURE_CHECK (rename, int, (char const *, char const *));
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-rename.t"
@@ -39,7 +40,7 @@ int
 main (void)
 {
   /* Remove any garbage left from previous partial runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_rename (rename, true);
 }
index 687700e..e5fefa1 100644 (file)
@@ -32,6 +32,7 @@ SIGNATURE_CHECK (renameat, int, (int, char const *, int, char const *));
 
 #include "filenamecat.h"
 #include "xgetcwd.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-renameat.t"
@@ -57,7 +58,7 @@ main (void)
   int result;
 
   /* Clean up any trash from prior testsuite runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Test basic rename functionality, using current directory.  */
   result = test_rename (do_rename, false);
index 7cf437f..e27a9db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Free Software Foundation
+ * Copyright (C) 2005, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/tests/test-rint.c b/tests/test-rint.c
new file mode 100644 (file)
index 0000000..a2b26da
--- /dev/null
@@ -0,0 +1,61 @@
+/* Test of rint() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (rint, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* Assume round-to-nearest rounding (the default in IEEE 754).  */
+
+  x = 2.1;
+  y = rint (x);
+  ASSERT (y == 2.0);
+
+  x = -2.1;
+  y = rint (x);
+  ASSERT (y == -2.0);
+
+  x = 2.7;
+  y = rint (x);
+  ASSERT (y == 3.0);
+
+  x = -2.7;
+  y = rint (x);
+  ASSERT (y == -3.0);
+
+  x = 2.5;
+  y = rint (x);
+  ASSERT (y == 2.0);
+
+  x = 3.5;
+  y = rint (x);
+  ASSERT (y == 4.0);
+
+  return 0;
+}
index a155e1b..7b1ef37 100644 (file)
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (rmdir, int, (char const *));
 #include <stdlib.h>
 #include <sys/stat.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-rmdir.t"
@@ -40,7 +41,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_rmdir_func (rmdir, true);
 }
diff --git a/tests/test-sin.c b/tests/test-sin.c
new file mode 100644 (file)
index 0000000..8314e44
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of sin() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (sin, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = sin (x);
+  ASSERT (y >= 0.5646424733 && y <= 0.5646424734);
+
+  return 0;
+}
diff --git a/tests/test-sinh.c b/tests/test-sinh.c
new file mode 100644 (file)
index 0000000..35a8a82
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of sinh() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (sinh, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = sinh (x);
+  ASSERT (y >= 0.6366535821 && y <= 0.6366535822);
+
+  return 0;
+}
diff --git a/tests/test-sinl.c b/tests/test-sinl.c
new file mode 100644 (file)
index 0000000..8d69b26
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of sinl() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (sinl, long double, (long double));
+
+#include "fpucw.h"
+#include "macros.h"
+
+volatile long double x;
+long double y;
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = sinl (x);
+  ASSERT (y >= 0.5646424733L && y <= 0.5646424734L);
+
+  return 0;
+}
index 2d25964..ab5460a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Free Software Foundation
+ * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
  * Written by Simon Josefsson.
  *
  * This program is free software: you can redistribute it and/or modify
diff --git a/tests/test-sqrt.c b/tests/test-sqrt.c
new file mode 100644 (file)
index 0000000..ba61c8b
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of sqrt() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (sqrt, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = sqrt (x);
+  ASSERT (y >= 0.7745966692 && y <= 0.7745966693);
+
+  return 0;
+}
diff --git a/tests/test-sqrtl.c b/tests/test-sqrtl.c
new file mode 100644 (file)
index 0000000..a7baef7
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of sqrtl() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (sqrtl, long double, (long double));
+
+#include "fpucw.h"
+#include "macros.h"
+
+volatile long double x;
+long double y;
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = sqrtl (x);
+  ASSERT (y >= 0.7745966692L && y <= 0.7745966693L);
+
+  return 0;
+}
index 329394f..49d8278 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Free Software Foundation
+ * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
index b20d644..b6845ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation
+ * Copyright (C) 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
  * Written by Bruno Haible and Eric Blake
  *
  * This program is free software: you can redistribute it and/or modify
index e0f2eeb..cdb57b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Free Software Foundation
+ * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
  * Written by Eric Blake
  *
  * This program is free software: you can redistribute it and/or modify
index 2369773..d2df54c 100644 (file)
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (symlink, int, (char const *, char const *));
 #include <stdlib.h>
 #include <sys/stat.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-symlink.t"
@@ -40,7 +41,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_symlink (symlink, true);
 }
index 7ac3f58..c3dec29 100644 (file)
@@ -32,6 +32,7 @@ SIGNATURE_CHECK (readlinkat, ssize_t, (int, char const *, char *, size_t));
 #include <string.h>
 #include <sys/stat.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #ifndef HAVE_SYMLINK
@@ -64,7 +65,7 @@ main (void)
   int result;
 
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Perform same checks as counterpart functions.  */
   result = test_readlink (do_readlink, false);
diff --git a/tests/test-tan.c b/tests/test-tan.c
new file mode 100644 (file)
index 0000000..32b3bda
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of tan() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (tan, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = tan (x);
+  ASSERT (y >= 0.6841368083 && y <= 0.6841368084);
+
+  return 0;
+}
diff --git a/tests/test-tanh.c b/tests/test-tanh.c
new file mode 100644 (file)
index 0000000..b5d8e4f
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of tanh() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (tanh, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = tanh (x);
+  ASSERT (y >= 0.5370495669 && y <= 0.5370495670);
+
+  return 0;
+}
diff --git a/tests/test-tanl.c b/tests/test-tanl.c
new file mode 100644 (file)
index 0000000..6e105cb
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of tanl() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (tanl, long double, (long double));
+
+#include "fpucw.h"
+#include "macros.h"
+
+volatile long double x;
+long double y;
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = tanl (x);
+  ASSERT (y >= 0.6841368083L && y <= 0.6841368084L);
+
+  return 0;
+}
index 3d63a31..4f7de5f 100644 (file)
@@ -32,6 +32,7 @@ SIGNATURE_CHECK (unlink, int, (char const *));
 #include <sys/stat.h>
 
 #include "unlinkdir.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-unlink.t"
@@ -42,7 +43,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_unlink_func (unlink, true);
 }
index e0cc1c5..7d80574 100644 (file)
@@ -31,6 +31,7 @@ SIGNATURE_CHECK (unlinkat, int, (int, char const *, int));
 #include <sys/stat.h>
 
 #include "unlinkdir.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-unlinkat.t"
@@ -62,7 +63,7 @@ main (void)
   int result2;
 
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   result1 = test_rmdir_func (rmdirat, false);
   result2 = test_unlink_func (unlinker, false);
diff --git a/tests/test-userspec.c b/tests/test-userspec.c
new file mode 100644 (file)
index 0000000..17428f2
--- /dev/null
@@ -0,0 +1,191 @@
+/* Test userspec.c
+   Copyright (C) 2009-2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "userspec.h"
+
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <grp.h>
+
+#include "xalloc.h"
+
+#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
+
+struct test
+{
+  const char *in;
+  uid_t uid;
+  gid_t gid;
+  const char *user_name;
+  const char *group_name;
+  const char *result;
+};
+
+static struct test T[] =
+  {
+    { "",                      -1, -1, "",   "",   NULL},
+    { ":",                     -1, -1, "",   "",   NULL},
+    { "0:0",                    0,  0, "",   "",   NULL},
+    { ":1",                    -1,  1, "",   "",   NULL},
+    { "1",                      1, -1, "",   "",   NULL},
+    { ":+0",                   -1,  0, "",   "",   NULL},
+    { "22:42",                 22, 42, "",   "",   NULL},
+    /* (uint32_t)-1 should be invalid everywhere */
+    { "4294967295:4294967295",  0,  0, NULL, NULL, "invalid user"},
+    /* likewise, but with only the group being invalid */
+    { "0:4294967295",           0,  0, NULL, NULL, "invalid group"},
+    { ":4294967295",            0,  0, NULL, NULL, "invalid group"},
+    /* and only the user being invalid */
+    { "4294967295:0",           0,  0, NULL, NULL, "invalid user"},
+    /* and using 2^32 */
+    { "4294967296:4294967296",  0,  0, NULL, NULL, "invalid user"},
+    { "0:4294967296",           0,  0, NULL, NULL, "invalid group"},
+    { ":4294967296",            0,  0, NULL, NULL, "invalid group"},
+    { "4294967296:0",           0,  0, NULL, NULL, "invalid user"},
+    /* numeric user and no group is invalid */
+    { "4294967295:",            0,  0, NULL, NULL, "invalid spec"},
+    { "4294967296:",            0,  0, NULL, NULL, "invalid spec"},
+    { "1:",                     0,  0, NULL, NULL, "invalid spec"},
+    { "+0:",                    0,  0, NULL, NULL, "invalid spec"},
+
+    /* "username:" must expand to UID:GID where GID is username's login group */
+    /* Add an entry like the following to the table, if possible.
+    { "U_NAME:",              UID,GID, U_NAME, G_NAME, NULL}, */
+    { NULL,                     0,  0, NULL, NULL, ""},  /* place-holder */
+
+    { NULL,                     0,  0, NULL, NULL, ""}
+  };
+
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
+static char const *
+maybe_null (char const *s)
+{
+  return s ? s : "NULL";
+}
+
+static bool
+same_diag (char const *s, char const *t)
+{
+  if (s == NULL && t == NULL)
+    return true;
+  if (s == NULL || t == NULL)
+    return false;
+  return STREQ (s, t);
+}
+
+int
+main (void)
+{
+  unsigned int i;
+  int fail = 0;
+
+  /* Find a UID that has both a user name and login group name,
+     but skip UID 0.  */
+  {
+    uid_t uid;
+    for (uid = 1200; 0 < uid; uid--)
+      {
+        struct group *gr;
+        struct passwd *pw = getpwuid (uid);
+        unsigned int j;
+        size_t len;
+        if (!pw || !pw->pw_name || !(gr = getgrgid (pw->pw_gid)) || !gr->gr_name)
+          continue;
+        j = ARRAY_CARDINALITY (T) - 2;
+        assert (T[j].in == NULL);
+        assert (T[j+1].in == NULL);
+        len = strlen (pw->pw_name);
+
+        /* Store "username:" in T[j].in.  */
+        {
+          char *t = xmalloc (len + 1 + 1);
+          memcpy (t, pw->pw_name, len);
+          t[len] = ':';
+          t[len+1] = '\0';
+          T[j].in = t;
+        }
+
+        T[j].uid = uid;
+        T[j].gid = gr->gr_gid;
+        T[j].user_name = xstrdup (pw->pw_name);
+        T[j].group_name = xstrdup (gr->gr_name);
+        T[j].result = NULL;
+        break;
+      }
+  }
+
+  for (i = 0; T[i].in; i++)
+    {
+      uid_t uid = (uid_t) -1;
+      gid_t gid = (gid_t) -1;
+      char *user_name;
+      char *group_name;
+      char const *diag = parse_user_spec (T[i].in, &uid, &gid,
+                                         &user_name, &group_name);
+      free (user_name);
+      free (group_name);
+      if (!same_diag (diag, T[i].result))
+        {
+          printf ("%s return value mismatch: got %s, expected %s\n",
+                  T[i].in, maybe_null (diag), maybe_null (T[i].result));
+          fail = 1;
+          continue;
+        }
+
+      if (diag)
+        continue;
+
+      if (uid != T[i].uid || gid != T[i].gid)
+        {
+          printf ("%s mismatch (-: expected uid,gid; +:actual)\n"
+                 "-%3lu,%3lu\n+%3lu,%3lu\n",
+                 T[i].in,
+                  (unsigned long int) T[i].uid,
+                  (unsigned long int) T[i].gid,
+                  (unsigned long int) uid,
+                  (unsigned long int) gid);
+          fail = 1;
+        }
+
+      if (!diag && !T[i].result)
+        continue;
+
+        {
+          printf ("%s diagnostic mismatch (-: expected uid,gid; +:actual)\n"
+                 "-%s\n+%s\n",
+                 T[i].in, T[i].result, diag);
+          fail = 1;
+        }
+    }
+
+  return fail;
+}
+
+/*
+Local Variables:
+indent-tabs-mode: nil
+End:
+*/
index ae2402d..f2a31a8 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-utimens.t"
@@ -66,7 +67,7 @@ main (void)
   int result3; /* Skip because of no lutimens support.  */
 
   /* Clean up any trash from prior testsuite runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   result1 = test_utimens (utimens, true);
   ASSERT (test_utimens (do_fdutimens, false) == result1);
index 68dab5c..07bdc31 100644 (file)
@@ -35,6 +35,7 @@ SIGNATURE_CHECK (utimensat, int, (int, char const *, struct timespec const[2],
 #include "stat-time.h"
 #include "timespec.h"
 #include "utimecmp.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-utimensat.t"
@@ -66,7 +67,7 @@ main (void)
   int fd;
 
   /* Clean up any trash from prior testsuite runs.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   /* Basic tests.  */
   result1 = test_utimens (do_utimensat, true);
index 03bad60..80d6208 100755 (executable)
@@ -18,7 +18,7 @@
 
 . "${srcdir=.}/init.sh"; path_prepend_ .
 
-test-xalloc-die 2> err > out
+test-xalloc-die${EXEEXT} 2> err > out
 case $? in
   1) ;;
   *) Exit 1;;
diff --git a/tests/test-xstrtoll.c b/tests/test-xstrtoll.c
new file mode 100644 (file)
index 0000000..03dd232
--- /dev/null
@@ -0,0 +1,4 @@
+#define __xstrtol xstrtoll
+#define __strtol_t long long int
+#define __spec PRId64
+#include "test-xstrtol.c"
diff --git a/tests/test-xstrtoll.sh b/tests/test-xstrtoll.sh
new file mode 100755 (executable)
index 0000000..78a08c8
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ .
+
+too_big=99999999999999999999999999999999999999999999999999999999999999999999
+result=0
+
+# test xstrtoll
+test-xstrtoll 1 >> out 2>&1 || result=1
+test-xstrtoll -1 >> out 2>&1 || result=1
+test-xstrtoll 1k >> out 2>&1 || result=1
+test-xstrtoll ${too_big}h >> out 2>&1 && result=1
+test-xstrtoll $too_big >> out 2>&1 && result=1
+test-xstrtoll x >> out 2>&1 && result=1
+test-xstrtoll 9x >> out 2>&1 && result=1
+test-xstrtoll 010 >> out 2>&1 || result=1
+# suffix without integer is valid
+test-xstrtoll MiB >> out 2>&1 || result=1
+
+# test xstrtoull
+test-xstrtoull 1 >> out 2>&1 || result=1
+test-xstrtoull -1 >> out 2>&1 && result=1
+test-xstrtoull 1k >> out 2>&1 || result=1
+test-xstrtoull ${too_big}h >> out 2>&1 && result=1
+test-xstrtoull $too_big >> out 2>&1 && result=1
+test-xstrtoull x >> out 2>&1 && result=1
+test-xstrtoull 9x >> out 2>&1 && result=1
+test-xstrtoull 010 >> out 2>&1 || result=1
+test-xstrtoull MiB >> out 2>&1 || result=1
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+  cr='\015'
+else
+  cr='\r'
+fi
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k
+mv k out
+
+# compare expected output
+cat > expected <<EOF
+1->1 ()
+-1->-1 ()
+1k->1024 ()
+invalid suffix in X argument \`${too_big}h'
+X argument \`$too_big' too large
+invalid X argument \`x'
+invalid suffix in X argument \`9x'
+010->8 ()
+MiB->1048576 ()
+1->1 ()
+invalid X argument \`-1'
+1k->1024 ()
+invalid suffix in X argument \`${too_big}h'
+X argument \`$too_big' too large
+invalid X argument \`x'
+invalid suffix in X argument \`9x'
+010->8 ()
+MiB->1048576 ()
+EOF
+
+compare expected out || result=1
+
+Exit $result
diff --git a/tests/test-xstrtoull.c b/tests/test-xstrtoull.c
new file mode 100644 (file)
index 0000000..cb3a91c
--- /dev/null
@@ -0,0 +1,4 @@
+#define __xstrtol xstrtoull
+#define __strtol_t unsigned long long int
+#define __spec PRIu64
+#include "test-xstrtol.c"
diff --git a/tests/test-y0.c b/tests/test-y0.c
new file mode 100644 (file)
index 0000000..c8055fb
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of y0() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (y0, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 3.8;
+  y = y0 (x);
+  ASSERT (y >= 0.0645032466 && y <= 0.0645032467);
+
+  return 0;
+}
diff --git a/tests/test-y1.c b/tests/test-y1.c
new file mode 100644 (file)
index 0000000..aaf3de9
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of y1() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (y1, double, (double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 3.8;
+  y = y1 (x);
+  ASSERT (y >= 0.4141146893 && y <= 0.4141146894);
+
+  return 0;
+}
diff --git a/tests/test-yn.c b/tests/test-yn.c
new file mode 100644 (file)
index 0000000..0058a9b
--- /dev/null
@@ -0,0 +1,90 @@
+/* Test of yn() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (yn, double, (int, double));
+
+#include "macros.h"
+
+volatile double x;
+double y;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (0, x);
+  ASSERT (y >= 0.0645032466 && y <= 0.0645032467);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (1, x);
+  ASSERT (y >= 0.4141146893 && y <= 0.4141146894);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (2, x);
+  ASSERT (y >= 0.1534518529 && y <= 0.1534518530);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (3, x);
+  ASSERT (y >= -0.2525864231 && y <= -0.2525864230);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (4, x);
+  ASSERT (y >= -0.5522725209 && y <= -0.5522725208);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (5, x);
+  ASSERT (y >= -0.9100925684 && y <= -0.9100925683);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (6, x);
+  ASSERT (y >= -1.842707923 && y <= -1.842707922);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (7, x);
+  ASSERT (y >= -4.908985081 && y <= -4.908985080);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (8, x);
+  ASSERT (y >= -16.24302659 && y <= -16.24302658);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (9, x);
+  ASSERT (y >= -63.48270581 && y <= -63.48270580);
+
+  /* A particular value.  */
+  x = 3.8;
+  y = yn (10, x);
+  ASSERT (y >= -284.4645273 && y <= -284.4645272);
+
+  return 0;
+}
index 9032794..9139131 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the Unicode character type functions.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 int
 main ()
 {
+  ASSERT (uc_bidi_category_byname ("L") == UC_BIDI_L);
+  ASSERT (uc_bidi_category_byname ("LRE") == UC_BIDI_LRE);
+  ASSERT (uc_bidi_category_byname ("LRO") == UC_BIDI_LRO);
+  ASSERT (uc_bidi_category_byname ("R") == UC_BIDI_R);
+  ASSERT (uc_bidi_category_byname ("AL") == UC_BIDI_AL);
+  ASSERT (uc_bidi_category_byname ("RLE") == UC_BIDI_RLE);
+  ASSERT (uc_bidi_category_byname ("RLO") == UC_BIDI_RLO);
+  ASSERT (uc_bidi_category_byname ("PDF") == UC_BIDI_PDF);
+  ASSERT (uc_bidi_category_byname ("EN") == UC_BIDI_EN);
+  ASSERT (uc_bidi_category_byname ("ES") == UC_BIDI_ES);
+  ASSERT (uc_bidi_category_byname ("ET") == UC_BIDI_ET);
+  ASSERT (uc_bidi_category_byname ("AN") == UC_BIDI_AN);
+  ASSERT (uc_bidi_category_byname ("CS") == UC_BIDI_CS);
   ASSERT (uc_bidi_category_byname ("NSM") == UC_BIDI_NSM);
+  ASSERT (uc_bidi_category_byname ("BN") == UC_BIDI_BN);
+  ASSERT (uc_bidi_category_byname ("B") == UC_BIDI_B);
+  ASSERT (uc_bidi_category_byname ("S") == UC_BIDI_S);
+  ASSERT (uc_bidi_category_byname ("WS") == UC_BIDI_WS);
+  ASSERT (uc_bidi_category_byname ("ON") == UC_BIDI_ON);
   ASSERT (uc_bidi_category_byname ("X") < 0);
+  ASSERT (uc_bidi_category_byname ("") < 0);
 
   return 0;
 }
index a639f6e..0da1625 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the Unicode character type functions.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include "unictype.h"
 
+#include <stdbool.h>
 #include <string.h>
 
 #include "macros.h"
 
+static bool
+category_equals (uc_general_category_t category1,
+                 uc_general_category_t category2)
+{
+  return (category1.bitmask == category2.bitmask
+          && category1.generic == category2.generic
+          && (category1.generic
+              ? category1.lookup.lookup_fn == category2.lookup.lookup_fn
+              : category1.lookup.table == category2.lookup.table));
+}
+
 int
 main ()
 {
-  uc_general_category_byname ("L");
+  ASSERT (category_equals (uc_general_category_byname ("L"), UC_CATEGORY_L));
+  ASSERT (category_equals (uc_general_category_byname ("Lu"), UC_CATEGORY_Lu));
+  ASSERT (category_equals (uc_general_category_byname ("Ll"), UC_CATEGORY_Ll));
+  ASSERT (category_equals (uc_general_category_byname ("Lt"), UC_CATEGORY_Lt));
+  ASSERT (category_equals (uc_general_category_byname ("Lm"), UC_CATEGORY_Lm));
+  ASSERT (category_equals (uc_general_category_byname ("Lo"), UC_CATEGORY_Lo));
+  ASSERT (category_equals (uc_general_category_byname ("M"), UC_CATEGORY_M));
+  ASSERT (category_equals (uc_general_category_byname ("Mn"), UC_CATEGORY_Mn));
+  ASSERT (category_equals (uc_general_category_byname ("Mc"), UC_CATEGORY_Mc));
+  ASSERT (category_equals (uc_general_category_byname ("Me"), UC_CATEGORY_Me));
+  ASSERT (category_equals (uc_general_category_byname ("N"), UC_CATEGORY_N));
+  ASSERT (category_equals (uc_general_category_byname ("Nd"), UC_CATEGORY_Nd));
+  ASSERT (category_equals (uc_general_category_byname ("Nl"), UC_CATEGORY_Nl));
+  ASSERT (category_equals (uc_general_category_byname ("No"), UC_CATEGORY_No));
+  ASSERT (category_equals (uc_general_category_byname ("P"), UC_CATEGORY_P));
+  ASSERT (category_equals (uc_general_category_byname ("Pc"), UC_CATEGORY_Pc));
+  ASSERT (category_equals (uc_general_category_byname ("Pd"), UC_CATEGORY_Pd));
+  ASSERT (category_equals (uc_general_category_byname ("Ps"), UC_CATEGORY_Ps));
+  ASSERT (category_equals (uc_general_category_byname ("Pe"), UC_CATEGORY_Pe));
+  ASSERT (category_equals (uc_general_category_byname ("Pi"), UC_CATEGORY_Pi));
+  ASSERT (category_equals (uc_general_category_byname ("Pf"), UC_CATEGORY_Pf));
+  ASSERT (category_equals (uc_general_category_byname ("Po"), UC_CATEGORY_Po));
+  ASSERT (category_equals (uc_general_category_byname ("S"), UC_CATEGORY_S));
+  ASSERT (category_equals (uc_general_category_byname ("Sm"), UC_CATEGORY_Sm));
+  ASSERT (category_equals (uc_general_category_byname ("Sc"), UC_CATEGORY_Sc));
+  ASSERT (category_equals (uc_general_category_byname ("Sk"), UC_CATEGORY_Sk));
+  ASSERT (category_equals (uc_general_category_byname ("So"), UC_CATEGORY_So));
+  ASSERT (category_equals (uc_general_category_byname ("Z"), UC_CATEGORY_Z));
+  ASSERT (category_equals (uc_general_category_byname ("Zs"), UC_CATEGORY_Zs));
+  ASSERT (category_equals (uc_general_category_byname ("Zl"), UC_CATEGORY_Zl));
+  ASSERT (category_equals (uc_general_category_byname ("Zp"), UC_CATEGORY_Zp));
+  ASSERT (category_equals (uc_general_category_byname ("C"), UC_CATEGORY_C));
+  ASSERT (category_equals (uc_general_category_byname ("Cc"), UC_CATEGORY_Cc));
+  ASSERT (category_equals (uc_general_category_byname ("Cf"), UC_CATEGORY_Cf));
+  ASSERT (category_equals (uc_general_category_byname ("Cs"), UC_CATEGORY_Cs));
+  ASSERT (category_equals (uc_general_category_byname ("Co"), UC_CATEGORY_Co));
+  ASSERT (category_equals (uc_general_category_byname ("Cn"), UC_CATEGORY_Cn));
+
   uc_general_category_byname ("Nl");
 
   {
diff --git a/tests/unistr/test-chr.h b/tests/unistr/test-chr.h
new file mode 100644 (file)
index 0000000..5a021c2
--- /dev/null
@@ -0,0 +1,103 @@
+/* Test of uN_chr() functions.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake and Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main (void)
+{
+  size_t n = 0x100000;
+  UNIT *input = (UNIT *) malloc (n * sizeof (UNIT));
+  ASSERT (input);
+
+  input[0] = 'a';
+  input[1] = 'b';
+  U_SET (input + 2, 'c', 1024);
+  U_SET (input + 1026, 'd', n - 1028);
+  input[n - 2] = 'e';
+  input[n - 1] = 'a';
+
+  /* Basic behavior tests.  */
+  ASSERT (U_CHR (input, n, 'a') == input);
+
+  ASSERT (U_CHR (input, 0, 'a') == NULL);
+  ASSERT (U_CHR (zerosize_ptr (), 0, 'a') == NULL);
+
+  ASSERT (U_CHR (input, n, 'b') == input + 1);
+  ASSERT (U_CHR (input, n, 'c') == input + 2);
+  ASSERT (U_CHR (input, n, 'd') == input + 1026);
+
+  ASSERT (U_CHR (input + 1, n - 1, 'a') == input + n - 1);
+  ASSERT (U_CHR (input + 1, n - 1, 'e') == input + n - 2);
+
+  ASSERT (U_CHR (input, n, 'f') == NULL);
+  ASSERT (U_CHR (input, n, '\0') == NULL);
+
+  /* Check that a very long haystack is handled quickly if the byte is
+     found near the beginning.  */
+  {
+    size_t repeat = 10000;
+    for (; repeat > 0; repeat--)
+      {
+        ASSERT (U_CHR (input, n, 'c') == input + 2);
+      }
+  }
+
+  /* Alignment tests.  */
+  {
+    int i, j;
+    for (i = 0; i < 32; i++)
+      {
+        for (j = 0; j < 128; j++)
+          input[i + j] = j;
+        for (j = 0; j < 128; j++)
+          {
+            ASSERT (U_CHR (input + i, 128, j) == input + i + j);
+          }
+      }
+  }
+
+  /* Check that uN_chr() does not read past the first occurrence of the
+     byte being searched.  */
+  {
+    char *page_boundary = (char *) zerosize_ptr ();
+
+    if (page_boundary != NULL)
+      {
+        for (n = 1; n <= 500 / sizeof (UNIT); n++)
+          {
+            UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT));
+            U_SET (mem, 'X', n);
+            ASSERT (U_CHR (mem, n, 'U') == NULL);
+
+            {
+              size_t i;
+
+              for (i = 0; i < n; i++)
+                {
+                  mem[i] = 'U';
+                  ASSERT (U_CHR (mem, 4000, 'U') == mem + i);
+                  mem[i] = 'X';
+                }
+            }
+          }
+      }
+  }
+
+  free (input);
+
+  return 0;
+}
diff --git a/tests/unistr/test-cmp.h b/tests/unistr/test-cmp.h
new file mode 100644 (file)
index 0000000..e536f48
--- /dev/null
@@ -0,0 +1,97 @@
+/* Test of uN_cmp() functions.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson and Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+test_cmp (void)
+{
+  /* Test equal / not equal distinction.  */
+  ASSERT (U_CMP (zerosize_ptr (), zerosize_ptr (), 0) == 0);
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 };
+    ASSERT (U_CMP (input1, input2, 2) == 0);
+    ASSERT (U_CMP (input1, input2, 3) == 0);
+    ASSERT (U_CMP (input1, input2, 4) != 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'b', 'a', 'r', 0 };
+    ASSERT (U_CMP (input1, input2, 1) != 0);
+    ASSERT (U_CMP (input1, input2, 3) != 0);
+  }
+
+  /* Test less / equal / greater distinction.  */
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'm', 'o', 'o', 0 };
+    ASSERT (U_CMP (input1, input2, 4) < 0);
+    ASSERT (U_CMP (input2, input1, 4) > 0);
+  }
+  {
+    static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 };
+    static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 };
+    ASSERT (U_CMP (input1, input2, 3) < 0);
+    ASSERT (U_CMP (input2, input1, 3) > 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 };
+    ASSERT (U_CMP (input1, input2, 4) < 0);
+    ASSERT (U_CMP (input2, input1, 4) > 0);
+  }
+
+  /* Some old versions of memcmp were not 8-bit clean.  */
+  {
+    static const UNIT input1[] = { 0x40 };
+    static const UNIT input2[] = { 0xC2 };
+    ASSERT (U_CMP (input1, input2, 1) < 0);
+    ASSERT (U_CMP (input2, input1, 1) > 0);
+  }
+  {
+    static const UNIT input1[] = { 0xC2 };
+    static const UNIT input2[] = { 0xC3 };
+    ASSERT (U_CMP (input1, input2, 1) < 0);
+    ASSERT (U_CMP (input2, input1, 1) > 0);
+  }
+
+  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+     or more and with at least one buffer not starting on a 4-byte boundary.
+     William Lewis provided this test program.   */
+  {
+    UNIT foo[21];
+    UNIT bar[21];
+    int i;
+    for (i = 0; i < 4; i++)
+      {
+        UNIT *a = foo + i;
+        UNIT *b = bar + i;
+        int j;
+        for (j = 0; j < 8; j++)
+          a[j] = '-';
+        a[8] = '0';
+        for (j = 9; j < 16; j++)
+          a[j] = '1';
+        for (j = 0; j < 8; j++)
+          b[j] = '-';
+        b[8] = '1';
+        for (j = 9; j < 16; j++)
+          b[j] = '0';
+        ASSERT (U_CMP (a, b, 16) < 0);
+      }
+  }
+}
diff --git a/tests/unistr/test-cmp2.h b/tests/unistr/test-cmp2.h
new file mode 100644 (file)
index 0000000..261fe36
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test of uN_cmp2() functions.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson and Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  {
+    static const UNIT input1[] = { 'a' };
+    static const UNIT input2[] = { 'b' };
+    ASSERT (U_CMP2 (input1, 0, input2, 0) == 0);
+    ASSERT (U_CMP2 (input1, 1, input2, 0) > 0);
+    ASSERT (U_CMP2 (input1, 0, input2, 1) < 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 };
+    ASSERT (U_CMP2 (input1, 3, input2, 3) == 0);
+    ASSERT (U_CMP2 (input1, 4, input2, 3) > 0);
+    ASSERT (U_CMP2 (input2, 3, input1, 4) < 0);
+    ASSERT (U_CMP2 (input1, 3, input2, 4) < 0);
+    ASSERT (U_CMP2 (input2, 4, input1, 3) > 0);
+    ASSERT (U_CMP2 (input1, 4, input2, 4) < 0);
+    ASSERT (U_CMP2 (input2, 4, input1, 4) > 0);
+    ASSERT (U_CMP2 (input1, 3, input2, 7) < 0);
+    ASSERT (U_CMP2 (input2, 7, input1, 3) > 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o' };
+    static const UNIT input2[] = { 'm', 'o', 'o' };
+    ASSERT (U_CMP2 (input1, 3, input2, 3) < 0);
+    ASSERT (U_CMP2 (input2, 3, input1, 3) > 0);
+  }
+  {
+    static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h' };
+    static const UNIT input2[] = { 'o', 'o', 'p', 's' };
+    ASSERT (U_CMP2 (input1, 5, input2, 4) < 0);
+    ASSERT (U_CMP2 (input2, 4, input1, 5) > 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-cpy-alloc.h b/tests/unistr/test-cpy-alloc.h
new file mode 100644 (file)
index 0000000..795e0b7
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of uN_cpy_alloc() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (src); n++)
+      {
+        UNIT *result = U_CPY_ALLOC (src, n);
+        size_t i;
+
+        ASSERT (result != NULL);
+        for (i = 0; i < n; i++)
+          ASSERT (result[i] == src[i]);
+
+        free (result);
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-cpy.h b/tests/unistr/test-cpy.h
new file mode 100644 (file)
index 0000000..b62fd14
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test of uN_cpy() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (src); n++)
+      {
+        UNIT dest[1 + SIZEOF (src) + 1] =
+          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+        UNIT *ret;
+        size_t i;
+
+        ret = U_CPY (dest + 1, src, n);
+        ASSERT (ret == dest + 1);
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == src[i]);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-move.h b/tests/unistr/test-move.h
new file mode 100644 (file)
index 0000000..2462367
--- /dev/null
@@ -0,0 +1,152 @@
+/* Test of uN_move() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  /* Test copying operations with disjoint source and destination.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (src); n++)
+      {
+        UNIT dest[1 + SIZEOF (src) + 1] =
+          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+        UNIT *ret;
+        size_t i;
+
+        ret = U_MOVE (dest + 1, src, n);
+        ASSERT (ret == dest + 1);
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == src[i]);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+  }
+
+  /* Test copying operations with overlap, in-place.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (src); n++)
+      {
+        UNIT dest[1 + SIZEOF (src) + 1];
+        UNIT *ret;
+        size_t i;
+
+        dest[0] = MAGIC;
+        for (i = 0; i < n; i++)
+          dest[1 + i] = src[i];
+        dest[1 + n] = MAGIC;
+
+        ret = U_MOVE (dest + 1, dest + 1, n);
+        ASSERT (ret == dest + 1);
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == src[i]);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+  }
+
+  /* Test copying operations with overlap, moving downward.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
+    static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' };
+    size_t d;
+
+    ASSERT (SIZEOF (src) == SIZEOF (src2));
+    for (d = 0; d <= SIZEOF (src); d++)
+      {
+        size_t n;
+
+        for (n = 0; n <= SIZEOF (src); n++)
+          {
+            UNIT dest[1 + 2 * SIZEOF (src) + 1];
+            UNIT *ret;
+            size_t i;
+
+            dest[0] = MAGIC;
+            for (i = 0; i < SIZEOF (src2); i++)
+              dest[1 + i] = src2[i];
+            for (i = 0; i < SIZEOF (src); i++)
+              dest[1 + SIZEOF (src) + i] = src[i];
+            dest[1 + 2 * SIZEOF (src)] = MAGIC;
+
+            ret =
+              U_MOVE (dest + 1 + SIZEOF (src) - d, dest + 1 + SIZEOF (src), n);
+            ASSERT (ret == dest + 1 + SIZEOF (src) - d);
+            ASSERT (dest[0] == MAGIC);
+            for (i = 0; i < SIZEOF (src) - d; i++)
+              ASSERT (dest[1 + i] == src2[i]);
+            for (i = 0; i < n; i++)
+              ASSERT (dest[1 + SIZEOF (src) - d + i] == src[i]);
+            for (i = SIZEOF (src) - d + n; i < SIZEOF (src2); i++)
+              ASSERT (dest[1 + i] == src2[i]);
+            for (i = (n >= d ? n - d : 0); i < SIZEOF (src); i++)
+              ASSERT (dest[1 + SIZEOF (src) + i] == src[i]);
+            ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC);
+          }
+      }
+  }
+
+  /* Test copying operations with overlap, moving upward.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
+    static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' };
+    size_t d;
+
+    ASSERT (SIZEOF (src) == SIZEOF (src2));
+    for (d = 0; d <= SIZEOF (src); d++)
+      {
+        size_t n;
+
+        for (n = 0; n <= SIZEOF (src); n++)
+          {
+            UNIT dest[1 + 2 * SIZEOF (src) + 1];
+            UNIT *ret;
+            size_t i;
+
+            dest[0] = MAGIC;
+            for (i = 0; i < SIZEOF (src); i++)
+              dest[1 + i] = src[i];
+            for (i = 0; i < SIZEOF (src2); i++)
+              dest[1 + SIZEOF (src) + i] = src2[i];
+            dest[1 + 2 * SIZEOF (src)] = MAGIC;
+
+            ret = U_MOVE (dest + 1 + d, dest + 1, n);
+            ASSERT (ret == dest + 1 + d);
+            ASSERT (dest[0] == MAGIC);
+            for (i = 0; i < d; i++)
+              ASSERT (dest[1 + i] == src[i]);
+            for (i = 0; i < n; i++)
+              ASSERT (dest[1 + d + i] == src[i]);
+            for (i = d + n; i < SIZEOF (src); i++)
+              ASSERT (dest[1 + i] == src[i]);
+            for (i = (d + n >= SIZEOF (src) ? d + n - SIZEOF (src) : 0);
+                 i < SIZEOF (src2);
+                 i++)
+              ASSERT (dest[1 + SIZEOF (src) + i] == src2[i]);
+            ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC);
+          }
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-set.h b/tests/unistr/test-set.h
new file mode 100644 (file)
index 0000000..56924dc
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test of uN_set() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  {
+#define NMAX 7
+    size_t n;
+
+    for (n = 0; n <= NMAX; n++)
+      {
+        UNIT dest[1 + NMAX + 1] =
+          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+        UNIT *ret;
+        size_t i;
+
+        ret = U_SET (dest + 1, VALUE, n);
+        ASSERT (ret == dest + 1);
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == VALUE);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+#undef NMAX
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-stpcpy.h b/tests/unistr/test-stpcpy.h
new file mode 100644 (file)
index 0000000..76065dc
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of uN_stpcpy() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 };
+    size_t n;
+
+    for (n = 1; n <= SIZEOF (src); n++)
+      {
+        UNIT dest[1 + SIZEOF (src) + 1] =
+          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC,
+            MAGIC
+          };
+        UNIT *result;
+        size_t i;
+
+        result = U_STPCPY (dest + 1, src + SIZEOF (src) - n);
+        ASSERT (result == dest + n);
+
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-stpncpy.h b/tests/unistr/test-stpncpy.h
new file mode 100644 (file)
index 0000000..bb81ff0
--- /dev/null
@@ -0,0 +1,79 @@
+/* Test of uN_stpncpy() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+check_single (const UNIT *input, size_t length, size_t n)
+{
+  UNIT *dest;
+  UNIT *result;
+  size_t i;
+
+  dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT));
+  ASSERT (dest != NULL);
+
+  for (i = 0; i < 1 + n + 1; i++)
+    dest[i] = MAGIC;
+
+  result = U_STPNCPY (dest + 1, input, n);
+  ASSERT (result == dest + 1 + (n <= length ? n : length));
+
+  ASSERT (dest[0] == MAGIC);
+  for (i = 0; i < (n <= length ? n : length + 1); i++)
+    ASSERT (dest[1 + i] == input[i]);
+  for (; i < n; i++)
+    ASSERT (dest[1 + i] == 0);
+  ASSERT (dest[1 + n] == MAGIC);
+
+  free (dest);
+}
+
+static void
+check (const UNIT *input, size_t input_length)
+{
+  size_t length;
+  size_t n;
+
+  ASSERT (input_length > 0);
+  ASSERT (input[input_length - 1] == 0);
+  length = input_length - 1; /* = U_STRLEN (input) */
+
+  for (n = 0; n <= 2 * length + 2; n++)
+    check_single (input, length, n);
+
+  /* Check that U_STPNCPY (D, S, N) does not look at more than
+     MIN (U_STRLEN (S) + 1, N) units.  */
+  {
+    char *page_boundary = (char *) zerosize_ptr ();
+
+    if (page_boundary != NULL)
+      {
+        for (n = 0; n <= 2 * length + 2; n++)
+          {
+            size_t n_to_copy = (n <= length ? n : length + 1);
+            UNIT *copy;
+            size_t i;
+
+            copy = (UNIT *) page_boundary - n_to_copy;
+            for (i = 0; i < n_to_copy; i++)
+              copy[i] = input[i];
+
+            check_single (copy, length, n);
+          }
+      }
+  }
+}
diff --git a/tests/unistr/test-strcat.h b/tests/unistr/test-strcat.h
new file mode 100644 (file)
index 0000000..6c1f90d
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test of uN_strcat() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 };
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 };
+    size_t m;
+    size_t n;
+
+    for (m = 0; m < SIZEOF (base); m++)
+      for (n = 1; n <= SIZEOF (src); n++)
+        {
+          UNIT dest[1 + (SIZEOF (base) - 1) + SIZEOF (src) + 1] =
+            { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC,
+              MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC
+            };
+          UNIT *result;
+          size_t i;
+
+          for (i = 0; i < m; i++)
+            dest[1 + i] = base[i];
+          dest[1 + m] = 0;
+
+          result = U_STRCAT (dest + 1, src + SIZEOF (src) - n);
+          ASSERT (result == dest + 1);
+
+          ASSERT (dest[0] == MAGIC);
+          for (i = 0; i < m; i++)
+            ASSERT (dest[1 + i] == base[i]);
+          for (i = 0; i < n; i++)
+            ASSERT (dest[1 + m + i] == src[SIZEOF (src) - n + i]);
+          ASSERT (dest[1 + m + n] == MAGIC);
+        }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-strcmp.h b/tests/unistr/test-strcmp.h
new file mode 100644 (file)
index 0000000..485b6f9
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test of uN_strcmp() and uN_strcoll() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+test_strcmp (void)
+{
+  {
+    static const UNIT input1[] = { 0 };
+    static const UNIT input2[] = { 0 };
+    ASSERT (U_STRCMP (input1, input2) == 0);
+  }
+  {
+    static const UNIT input1[] = { 0 };
+    static const UNIT input2[] = { 'f', 'o', 'o', 0 };
+    ASSERT (U_STRCMP (input1, input2) < 0);
+    ASSERT (U_STRCMP (input2, input1) > 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'f', 'o', 'o', 0 };
+    ASSERT (U_STRCMP (input1, input2) == 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'b', 'a', 'r', 0 };
+    ASSERT (U_STRCMP (input1, input2) > 0);
+    ASSERT (U_STRCMP (input2, input1) < 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 };
+    ASSERT (U_STRCMP (input1, input2) < 0);
+    ASSERT (U_STRCMP (input2, input1) > 0);
+  }
+  {
+    static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 };
+    static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 };
+    ASSERT (U_STRCMP (input1, input2) < 0);
+    ASSERT (U_STRCMP (input2, input1) > 0);
+  }
+}
diff --git a/tests/unistr/test-strcpy.h b/tests/unistr/test-strcpy.h
new file mode 100644 (file)
index 0000000..f8fe5ef
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of uN_strcpy() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 };
+    size_t n;
+
+    for (n = 1; n <= SIZEOF (src); n++)
+      {
+        UNIT dest[1 + SIZEOF (src) + 1] =
+          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC,
+            MAGIC
+          };
+        UNIT *result;
+        size_t i;
+
+        result = U_STRCPY (dest + 1, src + SIZEOF (src) - n);
+        ASSERT (result == dest + 1);
+
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-strdup.h b/tests/unistr/test-strdup.h
new file mode 100644 (file)
index 0000000..1684b39
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of uN_strdup() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 };
+    size_t n;
+
+    for (n = 1; n <= SIZEOF (src); n++)
+      {
+        UNIT *result = U_STRDUP (src + SIZEOF (src) - n);
+        size_t i;
+
+        ASSERT (result != NULL);
+        for (i = 0; i < n; i++)
+          ASSERT (result[i] == src[SIZEOF (src) - n + i]);
+
+        free (result);
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-strncat.h b/tests/unistr/test-strncat.h
new file mode 100644 (file)
index 0000000..0445b6d
--- /dev/null
@@ -0,0 +1,90 @@
+/* Test of uN_strncat() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+check_single (const UNIT *input, size_t length, size_t n)
+{
+  static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 };
+  size_t m;
+
+  for (m = 0; m < SIZEOF (base); m++)
+    {
+      UNIT *dest;
+      UNIT *result;
+      size_t i;
+
+      dest = (UNIT *) malloc ((1 + m + n + 2) * sizeof (UNIT));
+      ASSERT (dest != NULL);
+
+      dest[0] = MAGIC;
+      for (i = 0; i < m; i++)
+        dest[1 + i] = base[i];
+      dest[1 + m] = 0;
+      for (i = 1; i < n + 2; i++)
+        dest[1 + m + i] = MAGIC;
+
+      result = U_STRNCAT (dest + 1, input, n);
+      ASSERT (result == dest + 1);
+
+      ASSERT (dest[0] == MAGIC);
+      for (i = 0; i < m; i++)
+        ASSERT (dest[1 + i] == base[i]);
+      for (i = 0; i < (n <= length ? n : length); i++)
+        ASSERT (dest[1 + m + i] == input[i]);
+      ASSERT (dest[1 + m + i] == 0);
+      ASSERT (dest[1 + m + i + 1] == MAGIC);
+
+      free (dest);
+    }
+}
+
+static void
+check (const UNIT *input, size_t input_length)
+{
+  size_t length;
+  size_t n;
+
+  ASSERT (input_length > 0);
+  ASSERT (input[input_length - 1] == 0);
+  length = input_length - 1; /* = U_STRLEN (input) */
+
+  for (n = 0; n <= 2 * length + 2; n++)
+    check_single (input, length, n);
+
+  /* Check that U_STRNCAT (D, S, N) does not look at more than
+     MIN (U_STRLEN (S) + 1, N) units.  */
+  {
+    char *page_boundary = (char *) zerosize_ptr ();
+
+    if (page_boundary != NULL)
+      {
+        for (n = 0; n <= 2 * length + 2; n++)
+          {
+            size_t n_to_copy = (n <= length ? n : length + 1);
+            UNIT *copy;
+            size_t i;
+
+            copy = (UNIT *) page_boundary - n_to_copy;
+            for (i = 0; i < n_to_copy; i++)
+              copy[i] = input[i];
+
+            check_single (copy, length, n);
+          }
+      }
+  }
+}
diff --git a/tests/unistr/test-strncmp.h b/tests/unistr/test-strncmp.h
new file mode 100644 (file)
index 0000000..628db94
--- /dev/null
@@ -0,0 +1,92 @@
+/* Test of uN_strncmp() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+test_strncmp (void)
+{
+  {
+    static const UNIT input1[] = { 0 };
+    static const UNIT input2[] = { 0 };
+    ASSERT (U_STRNCMP (input1, input2, 0) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 1) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 1000000) == 0);
+  }
+  {
+    static const UNIT input1[] = { 0 };
+    static const UNIT input2[] = { 'f', 'o', 'o', 0 };
+    ASSERT (U_STRNCMP (input1, input2, 0) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 1) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 1) > 0);
+    ASSERT (U_STRNCMP (input1, input2, 3) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 3) > 0);
+    ASSERT (U_STRNCMP (input1, input2, 4) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 4) > 0);
+    ASSERT (U_STRNCMP (input1, input2, 1000000) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 1000000) > 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'f', 'o', 'o', 0 };
+    ASSERT (U_STRNCMP (input1, input2, 0) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 1) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 2) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 3) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 4) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 1000000) == 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'b', 'a', 'r', 0 };
+    ASSERT (U_STRNCMP (input1, input2, 0) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 1) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 1) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 2) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 2) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 1000000) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 1000000) < 0);
+  }
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 };
+    ASSERT (U_STRNCMP (input1, input2, 0) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 1) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 2) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 3) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 4) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 4) > 0);
+    ASSERT (U_STRNCMP (input1, input2, 1000000) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 1000000) > 0);
+  }
+  {
+    static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 };
+    static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 };
+    ASSERT (U_STRNCMP (input1, input2, 0) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 1) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 2) == 0);
+    ASSERT (U_STRNCMP (input1, input2, 3) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 3) > 0);
+    ASSERT (U_STRNCMP (input1, input2, 4) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 4) > 0);
+    ASSERT (U_STRNCMP (input1, input2, 5) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 5) > 0);
+    ASSERT (U_STRNCMP (input1, input2, 6) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 6) > 0);
+    ASSERT (U_STRNCMP (input1, input2, 1000000) < 0);
+    ASSERT (U_STRNCMP (input2, input1, 1000000) > 0);
+  }
+}
diff --git a/tests/unistr/test-strncpy.h b/tests/unistr/test-strncpy.h
new file mode 100644 (file)
index 0000000..6fa0d12
--- /dev/null
@@ -0,0 +1,79 @@
+/* Test of uN_strncpy() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+check_single (const UNIT *input, size_t length, size_t n)
+{
+  UNIT *dest;
+  UNIT *result;
+  size_t i;
+
+  dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT));
+  ASSERT (dest != NULL);
+
+  for (i = 0; i < 1 + n + 1; i++)
+    dest[i] = MAGIC;
+
+  result = U_STRNCPY (dest + 1, input, n);
+  ASSERT (result == dest + 1);
+
+  ASSERT (dest[0] == MAGIC);
+  for (i = 0; i < (n <= length ? n : length + 1); i++)
+    ASSERT (dest[1 + i] == input[i]);
+  for (; i < n; i++)
+    ASSERT (dest[1 + i] == 0);
+  ASSERT (dest[1 + n] == MAGIC);
+
+  free (dest);
+}
+
+static void
+check (const UNIT *input, size_t input_length)
+{
+  size_t length;
+  size_t n;
+
+  ASSERT (input_length > 0);
+  ASSERT (input[input_length - 1] == 0);
+  length = input_length - 1; /* = U_STRLEN (input) */
+
+  for (n = 0; n <= 2 * length + 2; n++)
+    check_single (input, length, n);
+
+  /* Check that U_STRNCPY (D, S, N) does not look at more than
+     MIN (U_STRLEN (S) + 1, N) units.  */
+  {
+    char *page_boundary = (char *) zerosize_ptr ();
+
+    if (page_boundary != NULL)
+      {
+        for (n = 0; n <= 2 * length + 2; n++)
+          {
+            size_t n_to_copy = (n <= length ? n : length + 1);
+            UNIT *copy;
+            size_t i;
+
+            copy = (UNIT *) page_boundary - n_to_copy;
+            for (i = 0; i < n_to_copy; i++)
+              copy[i] = input[i];
+
+            check_single (copy, length, n);
+          }
+      }
+  }
+}
diff --git a/tests/unistr/test-strnlen.h b/tests/unistr/test-strnlen.h
new file mode 100644 (file)
index 0000000..1199126
--- /dev/null
@@ -0,0 +1,60 @@
+/* Test of uN_strnlen() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+check_single (const UNIT *input, size_t length, size_t n)
+{
+  size_t result = U_STRNLEN (input, n);
+  ASSERT (result == (n <= length ? n : length));
+}
+
+static void
+check (const UNIT *input, size_t input_length)
+{
+  size_t length;
+  size_t n;
+
+  ASSERT (input_length > 0);
+  ASSERT (input[input_length - 1] == 0);
+  length = input_length - 1; /* = U_STRLEN (input) */
+
+  for (n = 0; n <= 2 * length + 2; n++)
+    check_single (input, length, n);
+
+  /* Check that U_STRNLEN (S, N) does not look at more than
+     MIN (U_STRLEN (S) + 1, N) units.  */
+  {
+    char *page_boundary = (char *) zerosize_ptr ();
+
+    if (page_boundary != NULL)
+      {
+        for (n = 0; n <= 2 * length + 2; n++)
+          {
+            size_t n_to_copy = (n <= length ? n : length + 1);
+            UNIT *copy;
+            size_t i;
+
+            copy = (UNIT *) page_boundary - n_to_copy;
+            for (i = 0; i < n_to_copy; i++)
+              copy[i] = input[i];
+
+            check_single (copy, length, n);
+          }
+      }
+  }
+}
diff --git a/tests/unistr/test-u16-check.c b/tests/unistr/test-u16-check.c
new file mode 100644 (file)
index 0000000..b7a9c10
--- /dev/null
@@ -0,0 +1,66 @@
+/* Test of u16_check() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Test empty string.  */
+  {
+    static const uint16_t input[] = { 0 };
+    ASSERT (u16_check (input, 0) == NULL);
+  }
+
+  /* Test valid non-empty string.  */
+  {
+    static const uint16_t input[] = /* "Данило Шеган" */
+      { 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, 0x0020, 0x0428, 0x0435, 0x0433, 0x0430, 0x043D };
+    ASSERT (u16_check (input, SIZEOF (input)) == NULL);
+  }
+
+  /* Test out-of-range character with 2 units: U+110000.  */
+  {
+    static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xE000 };
+    ASSERT (u16_check (input, SIZEOF (input)) == input + 2);
+  }
+
+  /* Test surrogate codepoints.  */
+  {
+    static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xDFFF };
+    ASSERT (u16_check (input, SIZEOF (input)) == NULL);
+  }
+  {
+    static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF };
+    ASSERT (u16_check (input, SIZEOF (input)) == input + 2);
+  }
+  {
+    static const uint16_t input[] = { 0x0414, 0x0430, 0xDFFF };
+    ASSERT (u16_check (input, SIZEOF (input)) == input + 2);
+  }
+  {
+    static const uint16_t input[] = { 0x0414, 0x0430, 0xDFFF, 0xDBFF };
+    ASSERT (u16_check (input, SIZEOF (input)) == input + 2);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-chr.c b/tests/unistr/test-u16-chr.c
new file mode 100644 (file)
index 0000000..d71755c
--- /dev/null
@@ -0,0 +1,31 @@
+/* Test of u16_chr() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_CHR u16_chr
+#define U_SET u16_set
+#include "test-chr.h"
diff --git a/tests/unistr/test-u16-cmp.c b/tests/unistr/test-u16-cmp.c
new file mode 100644 (file)
index 0000000..1ab9019
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of u16_cmp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_CMP u16_cmp
+#define MAGIC 0xBADE
+#include "test-cmp.h"
+
+int
+main ()
+{
+  test_cmp ();
+
+  /* Test comparison with non-BMP characters, split into surrogates.  */
+  {
+    static const UNIT input1[] = { 0xD835, 0xDD1E };
+    static const UNIT input2[] = { 0xFEFF, 0xFFE5 };
+    ASSERT (U_CMP (input1, input2, 2) > 0);
+    ASSERT (U_CMP (input2, input1, 2) < 0);
+    ASSERT (U_CMP (input1, input2, 1) > 0);
+    ASSERT (U_CMP (input2, input1, 1) < 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-cmp2.c b/tests/unistr/test-u16-cmp2.c
new file mode 100644 (file)
index 0000000..3993dcd
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u16_cmp2() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_CMP2 u16_cmp2
+#define MAGIC 0xBADE
+#include "test-cmp2.h"
diff --git a/tests/unistr/test-u16-cpy-alloc.c b/tests/unistr/test-u16-cpy-alloc.c
new file mode 100644 (file)
index 0000000..d1aa211
--- /dev/null
@@ -0,0 +1,29 @@
+/* Test of u16_cpy_alloc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_CPY_ALLOC u16_cpy_alloc
+#include "test-cpy-alloc.h"
diff --git a/tests/unistr/test-u16-cpy.c b/tests/unistr/test-u16-cpy.c
new file mode 100644 (file)
index 0000000..168a459
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u16_cpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_CPY u16_cpy
+#define MAGIC 0xBADE
+#include "test-cpy.h"
diff --git a/tests/unistr/test-u16-mblen.c b/tests/unistr/test-u16-mblen.c
new file mode 100644 (file)
index 0000000..13186f3
--- /dev/null
@@ -0,0 +1,84 @@
+/* Test of u16_mblen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  int ret;
+
+  /* Test zero-length input.  */
+  {
+    static const uint16_t input[] = { 0 };
+    ret = u16_mblen (input, 0);
+    ASSERT (ret == -1);
+  }
+
+  /* Test NUL unit input.  */
+  {
+    static const uint16_t input[] = { 0 };
+    ret = u16_mblen (input, 1);
+    ASSERT (ret == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint16_t buf[1];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        ret = u16_mblen (buf, 1);
+        ASSERT (ret == 1);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint16_t input[] = { 0x20AC };
+    ret = u16_mblen (input, 1);
+    ASSERT (ret == 1);
+  }
+
+  /* Test 2-units character input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0xDD1F };
+    ret = u16_mblen (input, 2);
+    ASSERT (ret == 2);
+  }
+
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint16_t input[] = { 0xD835 };
+    ret = u16_mblen (input, 1);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint16_t input[] = { 0xDD1F };
+    ret = u16_mblen (input, 1);
+    ASSERT (ret == -1);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-mbsnlen.c b/tests/unistr/test-u16-mbsnlen.c
new file mode 100644 (file)
index 0000000..a2d8b10
--- /dev/null
@@ -0,0 +1,68 @@
+/* Test of u16_mbsnlen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint16_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (input); n++)
+      {
+        size_t len = u16_mbsnlen (input, n);
+        ASSERT (len == n);
+      }
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint16_t input[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E
+      };
+    static const size_t expected[SIZEOF (input) + 1] =
+      { 0,
+        1, 2, 3, 3, 4, 5, 5, 6, 7,
+        8, 8, 9, 10, 10
+      };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (input); n++)
+      {
+        size_t len = u16_mbsnlen (input, n);
+        ASSERT (len == expected[n]);
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-mbtouc-unsafe.c b/tests/unistr/test-u16-mbtouc-unsafe.c
new file mode 100644 (file)
index 0000000..a1d1214
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test of u16_mbtouc_unsafe() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#include "test-u16-mbtouc.h"
+
+int
+main ()
+{
+  test_function (u16_mbtouc_unsafe);
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-mbtouc.c b/tests/unistr/test-u16-mbtouc.c
new file mode 100644 (file)
index 0000000..4545add
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test of u16_mbtouc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#include "test-u16-mbtouc.h"
+
+int
+main ()
+{
+  test_function (u16_mbtouc);
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-mbtouc.h b/tests/unistr/test-u16-mbtouc.h
new file mode 100644 (file)
index 0000000..ef0fb68
--- /dev/null
@@ -0,0 +1,82 @@
+/* Test of u16_mbtouc() and u16_mbtouc_unsafe() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+test_function (int (*my_u16_mbtouc) (ucs4_t *, const uint16_t *, size_t))
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint16_t input[] = { 0 };
+    uc = 0xBADFACE;
+    ret = my_u16_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint16_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ret = my_u16_mbtouc (&uc, buf, 1);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint16_t input[] = { 0x20AC };
+    uc = 0xBADFACE;
+    ret = my_u16_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 2-units character input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0xDD1F };
+    uc = 0xBADFACE;
+    ret = my_u16_mbtouc (&uc, input, 2);
+    ASSERT (ret == 2);
+    ASSERT (uc == 0x1D51F);
+  }
+
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint16_t input[] = { 0xD835 };
+    uc = 0xBADFACE;
+    ret = my_u16_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1 || ret == 2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint16_t input[] = { 0xDD1F };
+    uc = 0xBADFACE;
+    ret = my_u16_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0xFFFD);
+  }
+}
diff --git a/tests/unistr/test-u16-mbtoucr.c b/tests/unistr/test-u16-mbtoucr.c
new file mode 100644 (file)
index 0000000..fb1264d
--- /dev/null
@@ -0,0 +1,90 @@
+/* Test of u16_mbtoucr() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint16_t input[] = { 0 };
+    uc = 0xBADFACE;
+    ret = u16_mbtoucr (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint16_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ret = u16_mbtoucr (&uc, buf, 1);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint16_t input[] = { 0x20AC };
+    uc = 0xBADFACE;
+    ret = u16_mbtoucr (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 2-units character input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0xDD1F };
+    uc = 0xBADFACE;
+    ret = u16_mbtoucr (&uc, input, 2);
+    ASSERT (ret == 2);
+    ASSERT (uc == 0x1D51F);
+  }
+
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint16_t input[] = { 0xD835 };
+    uc = 0xBADFACE;
+    ret = u16_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint16_t input[] = { 0xDD1F };
+    uc = 0xBADFACE;
+    ret = u16_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-move.c b/tests/unistr/test-u16-move.c
new file mode 100644 (file)
index 0000000..ff1e6e3
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u16_move() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_MOVE u16_move
+#define MAGIC 0xBADE
+#include "test-move.h"
diff --git a/tests/unistr/test-u16-next.c b/tests/unistr/test-u16-next.c
new file mode 100644 (file)
index 0000000..d9ac6e9
--- /dev/null
@@ -0,0 +1,91 @@
+/* Test of u16_next() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  const uint16_t *ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint16_t input[] = { 0 };
+    uc = 0xBADFACE;
+    ret = u16_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint16_t buf[2];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        buf[1] = 0;
+        uc = 0xBADFACE;
+        ret = u16_next (&uc, buf);
+        ASSERT (ret == buf + 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint16_t input[] = { 0x20AC, 0 };
+    uc = 0xBADFACE;
+    ret = u16_next (&uc, input);
+    ASSERT (ret == input + 1);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 2-units character input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0xDD1F, 0 };
+    uc = 0xBADFACE;
+    ret = u16_next (&uc, input);
+    ASSERT (ret == input + 2);
+    ASSERT (uc == 0x1D51F);
+  }
+
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0 };
+    uc = 0xBADFACE;
+    ret = u16_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint16_t input[] = { 0xDD1F, 0 };
+    uc = 0xBADFACE;
+    ret = u16_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-prev.c b/tests/unistr/test-u16-prev.c
new file mode 100644 (file)
index 0000000..90e8341
--- /dev/null
@@ -0,0 +1,175 @@
+/* Test of u16_prev() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+static int
+check (const uint16_t *input, size_t input_length, ucs4_t *puc)
+{
+  ucs4_t uc;
+
+  /* Test recognition when at the beginning of the string.  */
+  if (u16_prev (&uc, input + input_length, input) != input)
+    return 1;
+
+  /* Test recognition when preceded by a 1-unit character.  */
+  {
+    uint16_t buf[100];
+    uint16_t *ptr;
+    size_t i;
+    ucs4_t uc1;
+
+    ptr = buf;
+    *ptr++ = 0x2102;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    if (u16_prev (&uc1, ptr + input_length, buf) != ptr)
+      return 2;
+    if (uc1 != uc)
+      return 3;
+  }
+
+  /* Test recognition when preceded by a 2-unit character.  */
+  {
+    uint16_t buf[100];
+    uint16_t *ptr;
+    size_t i;
+    ucs4_t uc1;
+
+    ptr = buf;
+    *ptr++ = 0xD835;
+    *ptr++ = 0xDD1E;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    if (u16_prev (&uc1, ptr + input_length, buf) != ptr)
+      return 4;
+    if (uc1 != uc)
+      return 5;
+  }
+
+  *puc = uc;
+  return 0;
+}
+
+static int
+check_invalid (const uint16_t *input, size_t input_length)
+{
+  ucs4_t uc;
+
+  /* Test recognition when at the beginning of the string.  */
+  uc = 0xBADFACE;
+  if (u16_prev (&uc, input + input_length, input) != NULL)
+    return 1;
+  if (uc != 0xBADFACE)
+    return 2;
+
+#if CONFIG_UNICODE_SAFETY
+  /* Test recognition when preceded by a 1-unit character.  */
+  {
+    uint16_t buf[100];
+    uint16_t *ptr;
+    size_t i;
+
+    ptr = buf;
+    *ptr++ = 0x2102;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    uc = 0xBADFACE;
+    if (u16_prev (&uc, ptr + input_length, buf) != NULL)
+      return 3;
+    if (uc != 0xBADFACE)
+      return 4;
+  }
+
+  /* Test recognition when preceded by a 2-unit character.  */
+  {
+    uint16_t buf[100];
+    uint16_t *ptr;
+    size_t i;
+
+    ptr = buf;
+    *ptr++ = 0xD835;
+    *ptr++ = 0xDD1E;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    uc = 0xBADFACE;
+    if (u16_prev (&uc, ptr + input_length, buf) != NULL)
+      return 5;
+    if (uc != 0xBADFACE)
+      return 6;
+  }
+#endif
+
+  return 0;
+}
+
+int
+main ()
+{
+  ucs4_t uc;
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint16_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ASSERT (check (buf, 1, &uc) == 0);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint16_t input[] = { 0x20AC };
+    uc = 0xBADFACE;
+    ASSERT (check (input, SIZEOF (input), &uc) == 0);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 2-units character input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0xDD1F };
+    uc = 0xBADFACE;
+    ASSERT (check (input, SIZEOF (input), &uc) == 0);
+    ASSERT (uc == 0x1D51F);
+  }
+
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint16_t input[] = { 0xD835 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint16_t input[] = { 0xDD1F };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-set.c b/tests/unistr/test-u16-set.c
new file mode 100644 (file)
index 0000000..f3e6305
--- /dev/null
@@ -0,0 +1,29 @@
+/* Test of u16_set() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_SET u16_set
+#define MAGIC 0xBADE
+#define VALUE 0x2102
+#include "test-set.h"
diff --git a/tests/unistr/test-u16-stpcpy.c b/tests/unistr/test-u16-stpcpy.c
new file mode 100644 (file)
index 0000000..6bf3ecb
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u16_stpcpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_STPCPY u16_stpcpy
+#define MAGIC 0xBADE
+#include "test-stpcpy.h"
diff --git a/tests/unistr/test-u16-stpncpy.c b/tests/unistr/test-u16-stpncpy.c
new file mode 100644 (file)
index 0000000..e53ce6b
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test of u16_stpncpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_STPNCPY u16_stpncpy
+#define MAGIC 0xBADE
+#include "test-stpncpy.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint16_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint16_t input[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-strcat.c b/tests/unistr/test-u16-strcat.c
new file mode 100644 (file)
index 0000000..9d6032e
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u16_strcat() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_STRCAT u16_strcat
+#define MAGIC 0xBADE
+#include "test-strcat.h"
diff --git a/tests/unistr/test-u16-strcmp.c b/tests/unistr/test-u16-strcmp.c
new file mode 100644 (file)
index 0000000..5fc4777
--- /dev/null
@@ -0,0 +1,34 @@
+/* Test of u16_strcmp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define U_STRCMP u16_strcmp
+#include "test-u16-strcmp.h"
+
+int
+main ()
+{
+  test_u16_strcmp ();
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-strcmp.h b/tests/unistr/test-u16-strcmp.h
new file mode 100644 (file)
index 0000000..ad54a43
--- /dev/null
@@ -0,0 +1,42 @@
+/* Test of u16_strcmp() and u16_strcoll() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#define UNIT uint16_t
+#include "test-strcmp.h"
+
+static void
+test_u16_strcmp (void)
+{
+  test_strcmp ();
+
+  /* Test comparison between ASCII and non-ASCII characters.  */
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 0x2022, 0 };
+    ASSERT (U_STRCMP (input1, input2) < 0);
+    ASSERT (U_STRCMP (input2, input1) > 0);
+  }
+
+  /* Test comparison with non-BMP characters, split into surrogates.  */
+  {
+    static const UNIT input1[] = { 0xD835, 0xDD1E, 0 };
+    static const UNIT input2[] = { 0xFEFF, 0 };
+    ASSERT (U_STRCMP (input1, input2) > 0);
+    ASSERT (U_STRCMP (input2, input1) < 0);
+  }
+}
diff --git a/tests/unistr/test-u16-strcoll.c b/tests/unistr/test-u16-strcoll.c
new file mode 100644 (file)
index 0000000..e24814a
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of u16_strcoll() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define U_STRCMP u16_strcoll
+#include "test-u16-strcmp.h"
+
+int
+main ()
+{
+  /* This test relies on three facts:
+     - setlocale is not being called, therefore the locale is the "C" locale.
+     - In the "C" locale, strcoll is equivalent to strcmp.
+     - In the u16_strcoll implementation, Unicode strings that are not
+       convertible to the locale encoding are sorted higher than convertible
+       strings and compared according to u16_strcmp.  */
+
+  test_u16_strcmp ();
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-strcpy.c b/tests/unistr/test-u16-strcpy.c
new file mode 100644 (file)
index 0000000..e017a11
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u16_strcpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_STRCPY u16_strcpy
+#define MAGIC 0xBADE
+#include "test-strcpy.h"
diff --git a/tests/unistr/test-u16-strdup.c b/tests/unistr/test-u16-strdup.c
new file mode 100644 (file)
index 0000000..f0266d1
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test of u16_strdup() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_STRDUP u16_strdup
+#include "test-strdup.h"
diff --git a/tests/unistr/test-u16-strlen.c b/tests/unistr/test-u16-strlen.c
new file mode 100644 (file)
index 0000000..7b8690b
--- /dev/null
@@ -0,0 +1,57 @@
+/* Test of u16_strlen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Empty string.  */
+  {
+    static const uint16_t input[] = { 0 };
+    ASSERT (u16_strlen (input) == 0);
+  }
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint16_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    ASSERT (u16_strlen (input) == SIZEOF (input) - 1);
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint16_t input[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0
+      };
+    ASSERT (u16_strlen (input) == SIZEOF (input) - 1);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-strmblen.c b/tests/unistr/test-u16-strmblen.c
new file mode 100644 (file)
index 0000000..80371b0
--- /dev/null
@@ -0,0 +1,78 @@
+/* Test of u16_strmblen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint16_t input[] = { 0 };
+    ret = u16_strmblen (input);
+    ASSERT (ret == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint16_t buf[2];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        buf[1] = 0;
+        ret = u16_strmblen (buf);
+        ASSERT (ret == 1);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint16_t input[] = { 0x20AC, 0 };
+    ret = u16_strmblen (input);
+    ASSERT (ret == 1);
+  }
+
+  /* Test 2-units character input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0xDD1F, 0 };
+    ret = u16_strmblen (input);
+    ASSERT (ret == 2);
+  }
+
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0 };
+    ret = u16_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint16_t input[] = { 0xDD1F, 0 };
+    ret = u16_strmblen (input);
+    ASSERT (ret == -1);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-strmbtouc.c b/tests/unistr/test-u16-strmbtouc.c
new file mode 100644 (file)
index 0000000..ceeaf2c
--- /dev/null
@@ -0,0 +1,91 @@
+/* Test of u16_strmbtouc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint16_t input[] = { 0 };
+    uc = 0xBADFACE;
+    ret = u16_strmbtouc (&uc, input);
+    ASSERT (ret == 0);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint16_t buf[2];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        buf[1] = 0;
+        uc = 0xBADFACE;
+        ret = u16_strmbtouc (&uc, buf);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint16_t input[] = { 0x20AC, 0 };
+    uc = 0xBADFACE;
+    ret = u16_strmbtouc (&uc, input);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 2-units character input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0xDD1F, 0 };
+    uc = 0xBADFACE;
+    ret = u16_strmbtouc (&uc, input);
+    ASSERT (ret == 2);
+    ASSERT (uc == 0x1D51F);
+  }
+
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint16_t input[] = { 0xD835, 0 };
+    uc = 0xBADFACE;
+    ret = u16_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint16_t input[] = { 0xDD1F, 0 };
+    uc = 0xBADFACE;
+    ret = u16_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-strncat.c b/tests/unistr/test-u16-strncat.c
new file mode 100644 (file)
index 0000000..c875cfc
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test of u16_strncat() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_STRNCAT u16_strncat
+#define MAGIC 0xBADE
+#include "test-strncat.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint16_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint16_t input[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-strncmp.c b/tests/unistr/test-u16-strncmp.c
new file mode 100644 (file)
index 0000000..b04431b
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of u16_strncmp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_STRNCMP u16_strncmp
+#include "test-strncmp.h"
+
+int
+main ()
+{
+  test_strncmp ();
+
+  /* Test comparison with non-BMP characters, split into surrogates.  */
+  {
+    static const UNIT input1[] = { 0xD835, 0xDD1E, 0 };
+    static const UNIT input2[] = { 0xFEFF, 0 };
+    ASSERT (U_STRNCMP (input1, input2, 1) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 1) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 2) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 2) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 1000000) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 1000000) < 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-strncpy.c b/tests/unistr/test-u16-strncpy.c
new file mode 100644 (file)
index 0000000..102f653
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test of u16_strncpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_STRNCPY u16_strncpy
+#define MAGIC 0xBADE
+#include "test-strncpy.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint16_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint16_t input[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-strnlen.c b/tests/unistr/test-u16-strnlen.c
new file mode 100644 (file)
index 0000000..beeba64
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test of u16_strnlen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_STRNLEN u16_strnlen
+#include "test-strnlen.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint16_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint16_t input[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-to-u32.c b/tests/unistr/test-u16-to-u32.c
new file mode 100644 (file)
index 0000000..5b382b2
--- /dev/null
@@ -0,0 +1,156 @@
+/* Test of u16_to_u32() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <errno.h>
+
+#include "macros.h"
+
+static int
+check (const uint16_t *input, size_t input_length,
+       const uint32_t *expected, size_t expected_length)
+{
+  size_t length;
+  uint32_t *result;
+
+  /* Test return conventions with resultbuf == NULL.  */
+  result = u16_to_u32 (input, input_length, NULL, &length);
+  if (!(result != NULL))
+    return 1;
+  if (!(length == expected_length))
+    return 2;
+  if (!(u32_cmp (result, expected, expected_length) == 0))
+    return 3;
+  free (result);
+
+  /* Test return conventions with resultbuf too small.  */
+  if (expected_length > 0)
+    {
+      uint32_t *preallocated;
+
+      length = expected_length - 1;
+      preallocated = (uint32_t *) malloc (length * sizeof (uint32_t));
+      result = u16_to_u32 (input, input_length, preallocated, &length);
+      if (!(result != NULL))
+        return 4;
+      if (!(result != preallocated))
+        return 5;
+      if (!(length == expected_length))
+        return 6;
+      if (!(u32_cmp (result, expected, expected_length) == 0))
+        return 7;
+      free (result);
+      free (preallocated);
+    }
+
+  /* Test return conventions with resultbuf large enough.  */
+  {
+    uint32_t *preallocated;
+
+    length = expected_length;
+    preallocated = (uint32_t *) malloc (length * sizeof (uint32_t));
+    result = u16_to_u32 (input, input_length, preallocated, &length);
+    if (!(result != NULL))
+      return 8;
+    if (!(preallocated == NULL || result == preallocated))
+      return 9;
+    if (!(length == expected_length))
+      return 10;
+    if (!(u32_cmp (result, expected, expected_length) == 0))
+      return 11;
+    free (preallocated);
+  }
+
+  return 0;
+}
+
+int
+main ()
+{
+  /* Empty string.  */
+  ASSERT (check (NULL, 0, NULL, 0) == 0);
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint16_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    static const uint32_t expected[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint16_t input[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E
+      };
+    static const uint32_t expected[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* Invalid input.  */
+  {
+    static const uint16_t input[] = { 'x', 0xDD1E, 0xD835, 'y' };
+#if 0 /* Currently invalid input is rejected, not accommodated.  */
+    static const uint32_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+#else
+    size_t length;
+    uint32_t *result;
+    uint32_t preallocated[10];
+
+    /* Test return conventions with resultbuf == NULL.  */
+    result = u16_to_u32 (input, SIZEOF (input), NULL, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf too small.  */
+    length = 1;
+    result = u16_to_u32 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf large enough.  */
+    length = SIZEOF (preallocated);
+    result = u16_to_u32 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+#endif
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-to-u8.c b/tests/unistr/test-u16-to-u8.c
new file mode 100644 (file)
index 0000000..4ef9b9b
--- /dev/null
@@ -0,0 +1,159 @@
+/* Test of u16_to_u8() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <errno.h>
+
+#include "macros.h"
+
+static int
+check (const uint16_t *input, size_t input_length,
+       const uint8_t *expected, size_t expected_length)
+{
+  size_t length;
+  uint8_t *result;
+
+  /* Test return conventions with resultbuf == NULL.  */
+  result = u16_to_u8 (input, input_length, NULL, &length);
+  if (!(result != NULL))
+    return 1;
+  if (!(length == expected_length))
+    return 2;
+  if (!(u8_cmp (result, expected, expected_length) == 0))
+    return 3;
+  free (result);
+
+  /* Test return conventions with resultbuf too small.  */
+  if (expected_length > 0)
+    {
+      uint8_t *preallocated;
+
+      length = expected_length - 1;
+      preallocated = (uint8_t *) malloc (length * sizeof (uint8_t));
+      result = u16_to_u8 (input, input_length, preallocated, &length);
+      if (!(result != NULL))
+        return 4;
+      if (!(result != preallocated))
+        return 5;
+      if (!(length == expected_length))
+        return 6;
+      if (!(u8_cmp (result, expected, expected_length) == 0))
+        return 7;
+      free (result);
+      free (preallocated);
+    }
+
+  /* Test return conventions with resultbuf large enough.  */
+  {
+    uint8_t *preallocated;
+
+    length = expected_length;
+    preallocated = (uint8_t *) malloc (length * sizeof (uint8_t));
+    result = u16_to_u8 (input, input_length, preallocated, &length);
+    if (!(result != NULL))
+      return 8;
+    if (!(preallocated == NULL || result == preallocated))
+      return 9;
+    if (!(length == expected_length))
+      return 10;
+    if (!(u8_cmp (result, expected, expected_length) == 0))
+      return 11;
+    free (preallocated);
+  }
+
+  return 0;
+}
+
+int
+main ()
+{
+  /* Empty string.  */
+  ASSERT (check (NULL, 0, NULL, 0) == 0);
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint16_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    static const uint8_t expected[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n'
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint16_t input[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E
+      };
+    static const uint8_t expected[] =
+      { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F,
+        ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* Invalid input.  */
+  {
+    static const uint16_t input[] = { 'x', 0xDD1E, 0xD835, 'y' };
+#if 0 /* Currently invalid input is rejected, not accommodated.  */
+    static const uint8_t expected[] =
+      { 'x', 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 'y' };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+#else
+    size_t length;
+    uint8_t *result;
+    uint8_t preallocated[10];
+
+    /* Test return conventions with resultbuf == NULL.  */
+    result = u16_to_u8 (input, SIZEOF (input), NULL, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf too small.  */
+    length = 1;
+    result = u16_to_u8 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf large enough.  */
+    length = SIZEOF (preallocated);
+    result = u16_to_u8 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+#endif
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-uctomb.c b/tests/unistr/test-u16-uctomb.c
new file mode 100644 (file)
index 0000000..ba50225
--- /dev/null
@@ -0,0 +1,110 @@
+/* Test of u16_uctomb() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define MAGIC 0xBADE
+
+int
+main ()
+{
+  /* Test ISO 646 character, in particular the NUL character.  */
+  {
+    ucs4_t uc;
+
+    for (uc = 0; uc < 0x80; uc++)
+      {
+        uint16_t buf[3] = { MAGIC, MAGIC, MAGIC };
+        int ret;
+
+        ret = u16_uctomb (buf, uc, 0);
+        ASSERT (ret == -2);
+        ASSERT (buf[0] == MAGIC);
+
+        ret = u16_uctomb (buf, uc, 1);
+        ASSERT (ret == 1);
+        ASSERT (buf[0] == uc);
+        ASSERT (buf[1] == MAGIC);
+      }
+  }
+
+  /* Test BMP character.  */
+  {
+    ucs4_t uc = 0x20AC;
+    uint16_t buf[3] = { MAGIC, MAGIC, MAGIC };
+    int ret;
+
+    ret = u16_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u16_uctomb (buf, uc, 1);
+    ASSERT (ret == 1);
+    ASSERT (buf[0] == uc);
+    ASSERT (buf[1] == MAGIC);
+  }
+
+  /* Test non-BMP character.  */
+  {
+    ucs4_t uc = 0x10FFFD;
+    uint16_t buf[3] = { MAGIC, MAGIC, MAGIC };
+    int ret;
+
+    ret = u16_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u16_uctomb (buf, uc, 1);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u16_uctomb (buf, uc, 2);
+    ASSERT (ret == 2);
+    ASSERT (buf[0] == 0xDBFF);
+    ASSERT (buf[1] == 0xDFFD);
+    ASSERT (buf[2] == MAGIC);
+  }
+
+  /* Test invalid characters.  */
+  {
+    ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF };
+    uint16_t buf[3] = { MAGIC, MAGIC, MAGIC };
+    size_t i;
+
+    for (i = 0; i < SIZEOF (invalid); i++)
+      {
+        ucs4_t uc = invalid[i];
+        int n;
+
+        for (n = 0; n <= 2; n++)
+          {
+            int ret = u16_uctomb (buf, uc, n);
+            ASSERT (ret == -1);
+            ASSERT (buf[0] == MAGIC);
+            ASSERT (buf[1] == MAGIC);
+            ASSERT (buf[2] == MAGIC);
+          }
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-check.c b/tests/unistr/test-u32-check.c
new file mode 100644 (file)
index 0000000..fdd64df
--- /dev/null
@@ -0,0 +1,66 @@
+/* Test of u32_check() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Test empty string.  */
+  {
+    static const uint32_t input[] = { 0 };
+    ASSERT (u32_check (input, 0) == NULL);
+  }
+
+  /* Test valid non-empty string.  */
+  {
+    static const uint32_t input[] = /* "Данило Шеган" */
+      { 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, 0x0020, 0x0428, 0x0435, 0x0433, 0x0430, 0x043D };
+    ASSERT (u32_check (input, SIZEOF (input)) == NULL);
+  }
+
+  /* Test out-of-range character with 1 unit: U+110000.  */
+  {
+    static const uint32_t input[] = { 0x0414, 0x0430, 0x110000 };
+    ASSERT (u32_check (input, SIZEOF (input)) == input + 2);
+  }
+
+  /* Test surrogate codepoints.  */
+  {
+    static const uint32_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xDFFF };
+    ASSERT (u32_check (input, SIZEOF (input)) == input + 2);
+  }
+  {
+    static const uint32_t input[] = { 0x0414, 0x0430, 0xDBFF };
+    ASSERT (u32_check (input, SIZEOF (input)) == input + 2);
+  }
+  {
+    static const uint32_t input[] = { 0x0414, 0x0430, 0xDFFF };
+    ASSERT (u32_check (input, SIZEOF (input)) == input + 2);
+  }
+  {
+    static const uint32_t input[] = { 0x0414, 0x0430, 0xDFFF, 0xDBFF };
+    ASSERT (u32_check (input, SIZEOF (input)) == input + 2);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-chr.c b/tests/unistr/test-u32-chr.c
new file mode 100644 (file)
index 0000000..f23aa08
--- /dev/null
@@ -0,0 +1,31 @@
+/* Test of u32_chr() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_CHR u32_chr
+#define U_SET u32_set
+#include "test-chr.h"
diff --git a/tests/unistr/test-u32-cmp.c b/tests/unistr/test-u32-cmp.c
new file mode 100644 (file)
index 0000000..ab41b31
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of u32_cmp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_CMP u32_cmp
+#define MAGIC 0xBADFACE
+#include "test-cmp.h"
+
+int
+main ()
+{
+  test_cmp ();
+
+  /* Test comparison with non-BMP characters.  */
+  {
+    static const UNIT input1[] = { 0x1D51F };
+    static const UNIT input2[] = { 0xFEFF };
+    ASSERT (U_CMP (input1, input2, 1) > 0);
+    ASSERT (U_CMP (input2, input1, 1) < 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-cmp2.c b/tests/unistr/test-u32-cmp2.c
new file mode 100644 (file)
index 0000000..84450b5
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u32_cmp2() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_CMP2 u32_cmp2
+#define MAGIC 0xBADFACE
+#include "test-cmp2.h"
diff --git a/tests/unistr/test-u32-cpy-alloc.c b/tests/unistr/test-u32-cpy-alloc.c
new file mode 100644 (file)
index 0000000..d3675dd
--- /dev/null
@@ -0,0 +1,29 @@
+/* Test of u32_cpy_alloc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_CPY_ALLOC u32_cpy_alloc
+#include "test-cpy-alloc.h"
diff --git a/tests/unistr/test-u32-cpy.c b/tests/unistr/test-u32-cpy.c
new file mode 100644 (file)
index 0000000..49fc995
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u32_cpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_CPY u32_cpy
+#define MAGIC 0xBADFACE
+#include "test-cpy.h"
diff --git a/tests/unistr/test-u32-mblen.c b/tests/unistr/test-u32-mblen.c
new file mode 100644 (file)
index 0000000..1ebd93e
--- /dev/null
@@ -0,0 +1,81 @@
+/* Test of u32_mblen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  int ret;
+
+  /* Test zero-length input.  */
+  {
+    static const uint32_t input[] = { 0 };
+    ret = u32_mblen (input, 0);
+    ASSERT (ret == -1);
+  }
+
+  /* Test NUL unit input.  */
+  {
+    static const uint32_t input[] = { 0 };
+    ret = u32_mblen (input, 1);
+    ASSERT (ret == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint32_t buf[1];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        ret = u32_mblen (buf, 1);
+        ASSERT (ret == 1);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x20AC };
+    ret = u32_mblen (input, 1);
+    ASSERT (ret == 1);
+  }
+
+  /* Test non-BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x1D51F };
+    ret = u32_mblen (input, 1);
+    ASSERT (ret == 1);
+  }
+
+#if CONFIG_UNICODE_SAFETY
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint32_t input[] = { 0x340000 };
+    ret = u32_mblen (input, 1);
+    ASSERT (ret == -1);
+  }
+#endif
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-mbsnlen.c b/tests/unistr/test-u32-mbsnlen.c
new file mode 100644 (file)
index 0000000..d9e066b
--- /dev/null
@@ -0,0 +1,63 @@
+/* Test of u32_mbsnlen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint32_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (input); n++)
+      {
+        size_t len = u32_mbsnlen (input, n);
+        ASSERT (len == n);
+      }
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint32_t input[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E
+      };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (input); n++)
+      {
+        size_t len = u32_mbsnlen (input, n);
+        ASSERT (len == n);
+      }
+  }
+  return 0;
+}
diff --git a/tests/unistr/test-u32-mbtouc-unsafe.c b/tests/unistr/test-u32-mbtouc-unsafe.c
new file mode 100644 (file)
index 0000000..cb3052c
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test of u32_mbtouc_unsafe() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#include "test-u32-mbtouc.h"
+
+int
+main ()
+{
+  test_function (u32_mbtouc_unsafe);
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-mbtouc.c b/tests/unistr/test-u32-mbtouc.c
new file mode 100644 (file)
index 0000000..7c981b5
--- /dev/null
@@ -0,0 +1,36 @@
+/* Test of u32_mbtouc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+/* Enable all tests that may be skipped when testing u32_mbtouc_unsafe.  */
+#define FULL_SAFETY 1
+
+#include "test-u32-mbtouc.h"
+
+int
+main ()
+{
+  test_function (u32_mbtouc);
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-mbtouc.h b/tests/unistr/test-u32-mbtouc.h
new file mode 100644 (file)
index 0000000..7d70133
--- /dev/null
@@ -0,0 +1,77 @@
+/* Test of u32_mbtouc() and u32_mbtouc_unsafe() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+test_function (int (*my_u32_mbtouc) (ucs4_t *, const uint32_t *, size_t))
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint32_t input[] = { 0 };
+    uc = 0xBADFACE;
+    ret = my_u32_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint32_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ret = my_u32_mbtouc (&uc, buf, 1);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x20AC };
+    uc = 0xBADFACE;
+    ret = my_u32_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test non-BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x1D51F };
+    uc = 0xBADFACE;
+    ret = my_u32_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0x1D51F);
+  }
+
+#if FULL_SAFETY || CONFIG_UNICODE_SAFETY
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint32_t input[] = { 0x340000 };
+    uc = 0xBADFACE;
+    ret = my_u32_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0xFFFD);
+  }
+#endif
+}
diff --git a/tests/unistr/test-u32-mbtoucr.c b/tests/unistr/test-u32-mbtoucr.c
new file mode 100644 (file)
index 0000000..7b1034c
--- /dev/null
@@ -0,0 +1,83 @@
+/* Test of u32_mbtoucr() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint32_t input[] = { 0 };
+    uc = 0xBADFACE;
+    ret = u32_mbtoucr (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint32_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ret = u32_mbtoucr (&uc, buf, 1);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x20AC };
+    uc = 0xBADFACE;
+    ret = u32_mbtoucr (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test non-BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x1D51F };
+    uc = 0xBADFACE;
+    ret = u32_mbtoucr (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0x1D51F);
+  }
+
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint32_t input[] = { 0x340000 };
+    uc = 0xBADFACE;
+    ret = u32_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-move.c b/tests/unistr/test-u32-move.c
new file mode 100644 (file)
index 0000000..44f95c0
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u32_move() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_MOVE u32_move
+#define MAGIC 0xBADFACE
+#include "test-move.h"
diff --git a/tests/unistr/test-u32-next.c b/tests/unistr/test-u32-next.c
new file mode 100644 (file)
index 0000000..a5852e2
--- /dev/null
@@ -0,0 +1,86 @@
+/* Test of u32_next() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  const uint32_t *ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint32_t input[] = { 0 };
+    uc = 0xBADFACE;
+    ret = u32_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint32_t buf[2];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        buf[1] = 0;
+        uc = 0xBADFACE;
+        ret = u32_next (&uc, buf);
+        ASSERT (ret == buf + 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x20AC, 0 };
+    uc = 0xBADFACE;
+    ret = u32_next (&uc, input);
+    ASSERT (ret == input + 1);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test non-BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x1D51F, 0 };
+    uc = 0xBADFACE;
+    ret = u32_next (&uc, input);
+    ASSERT (ret == input + 1);
+    ASSERT (uc == 0x1D51F);
+  }
+
+#if CONFIG_UNICODE_SAFETY
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint32_t input[] = { 0x340000, 0 };
+    uc = 0xBADFACE;
+    ret = u32_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+#endif
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-prev.c b/tests/unistr/test-u32-prev.c
new file mode 100644 (file)
index 0000000..95187af
--- /dev/null
@@ -0,0 +1,133 @@
+/* Test of u32_prev() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+static int
+check (const uint32_t *input, size_t input_length, ucs4_t *puc)
+{
+  ucs4_t uc;
+
+  /* Test recognition when at the beginning of the string.  */
+  if (u32_prev (&uc, input + input_length, input) != input)
+    return 1;
+
+  /* Test recognition when preceded by a 1-unit character.  */
+  {
+    uint32_t buf[100];
+    uint32_t *ptr;
+    size_t i;
+    ucs4_t uc1;
+
+    ptr = buf;
+    *ptr++ = 0x1D51E;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    if (u32_prev (&uc1, ptr + input_length, buf) != ptr)
+      return 2;
+    if (uc1 != uc)
+      return 3;
+  }
+
+  *puc = uc;
+  return 0;
+}
+
+static int
+check_invalid (const uint32_t *input, size_t input_length)
+{
+#if CONFIG_UNICODE_SAFETY
+  ucs4_t uc;
+
+  /* Test recognition when at the beginning of the string.  */
+  uc = 0xBADFACE;
+  if (u32_prev (&uc, input + input_length, input) != NULL)
+    return 1;
+  if (uc != 0xBADFACE)
+    return 2;
+
+  /* Test recognition when preceded by a 1-unit character.  */
+  {
+    uint32_t buf[100];
+    uint32_t *ptr;
+    size_t i;
+
+    ptr = buf;
+    *ptr++ = 0x1D51E;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    uc = 0xBADFACE;
+    if (u32_prev (&uc, ptr + input_length, buf) != NULL)
+      return 3;
+    if (uc != 0xBADFACE)
+      return 4;
+  }
+#endif
+
+  return 0;
+}
+
+int
+main ()
+{
+  ucs4_t uc;
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint32_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ASSERT (check (buf, 1, &uc) == 0);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x20AC };
+    uc = 0xBADFACE;
+    ASSERT (check (input, SIZEOF (input), &uc) == 0);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test non-BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x1D51F };
+    uc = 0xBADFACE;
+    ASSERT (check (input, SIZEOF (input), &uc) == 0);
+    ASSERT (uc == 0x1D51F);
+  }
+
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint32_t input[] = { 0x340000 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-set.c b/tests/unistr/test-u32-set.c
new file mode 100644 (file)
index 0000000..120804f
--- /dev/null
@@ -0,0 +1,29 @@
+/* Test of u32_set() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_SET u32_set
+#define MAGIC 0xBADFACE
+#define VALUE 0x1D51E
+#include "test-set.h"
diff --git a/tests/unistr/test-u32-stpcpy.c b/tests/unistr/test-u32-stpcpy.c
new file mode 100644 (file)
index 0000000..9c99c52
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u32_stpcpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STPCPY u32_stpcpy
+#define MAGIC 0xBADFACE
+#include "test-stpcpy.h"
diff --git a/tests/unistr/test-u32-stpncpy.c b/tests/unistr/test-u32-stpncpy.c
new file mode 100644 (file)
index 0000000..e29683b
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test of u32_stpncpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STPNCPY u32_stpncpy
+#define MAGIC 0xBADFACE
+#include "test-stpncpy.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint32_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint32_t input[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-strcat.c b/tests/unistr/test-u32-strcat.c
new file mode 100644 (file)
index 0000000..66e7c85
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u32_strcat() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STRCAT u32_strcat
+#define MAGIC 0xBADFACE
+#include "test-strcat.h"
diff --git a/tests/unistr/test-u32-strcmp.c b/tests/unistr/test-u32-strcmp.c
new file mode 100644 (file)
index 0000000..8364a41
--- /dev/null
@@ -0,0 +1,34 @@
+/* Test of u32_strcmp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define U_STRCMP u32_strcmp
+#include "test-u32-strcmp.h"
+
+int
+main ()
+{
+  test_u32_strcmp ();
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-strcmp.h b/tests/unistr/test-u32-strcmp.h
new file mode 100644 (file)
index 0000000..6d24132
--- /dev/null
@@ -0,0 +1,42 @@
+/* Test of u32_strcmp() and u32_strcoll() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#define UNIT uint32_t
+#include "test-strcmp.h"
+
+static void
+test_u32_strcmp (void)
+{
+  test_strcmp ();
+
+  /* Test comparison between ASCII and non-ASCII characters.  */
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 0x2022, 0 };
+    ASSERT (U_STRCMP (input1, input2) < 0);
+    ASSERT (U_STRCMP (input2, input1) > 0);
+  }
+
+  /* Test comparison with non-BMP characters.  */
+  {
+    static const UNIT input1[] = { 0x1D51F, 0 };
+    static const UNIT input2[] = { 0xFEFF, 0 };
+    ASSERT (U_STRCMP (input1, input2) > 0);
+    ASSERT (U_STRCMP (input2, input1) < 0);
+  }
+}
diff --git a/tests/unistr/test-u32-strcoll.c b/tests/unistr/test-u32-strcoll.c
new file mode 100644 (file)
index 0000000..36954e7
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of u32_strcoll() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define U_STRCMP u32_strcoll
+#include "test-u32-strcmp.h"
+
+int
+main ()
+{
+  /* This test relies on three facts:
+     - setlocale is not being called, therefore the locale is the "C" locale.
+     - In the "C" locale, strcoll is equivalent to strcmp.
+     - In the u32_strcoll implementation, Unicode strings that are not
+       convertible to the locale encoding are sorted higher than convertible
+       strings and compared according to u32_strcmp.  */
+
+  test_u32_strcmp ();
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-strcpy.c b/tests/unistr/test-u32-strcpy.c
new file mode 100644 (file)
index 0000000..2e22aad
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u32_strcpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STRCPY u32_strcpy
+#define MAGIC 0xBADFACE
+#include "test-strcpy.h"
diff --git a/tests/unistr/test-u32-strdup.c b/tests/unistr/test-u32-strdup.c
new file mode 100644 (file)
index 0000000..ede8e54
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test of u32_strdup() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STRDUP u32_strdup
+#include "test-strdup.h"
diff --git a/tests/unistr/test-u32-strlen.c b/tests/unistr/test-u32-strlen.c
new file mode 100644 (file)
index 0000000..a349be7
--- /dev/null
@@ -0,0 +1,57 @@
+/* Test of u32_strlen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Empty string.  */
+  {
+    static const uint32_t input[] = { 0 };
+    ASSERT (u32_strlen (input) == 0);
+  }
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint32_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    ASSERT (u32_strlen (input) == SIZEOF (input) - 1);
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint32_t input[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E, 0
+      };
+    ASSERT (u32_strlen (input) == SIZEOF (input) - 1);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-strmblen.c b/tests/unistr/test-u32-strmblen.c
new file mode 100644 (file)
index 0000000..733f8fc
--- /dev/null
@@ -0,0 +1,75 @@
+/* Test of u32_strmblen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint32_t input[] = { 0 };
+    ret = u32_strmblen (input);
+    ASSERT (ret == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint32_t buf[2];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        buf[1] = 0;
+        ret = u32_strmblen (buf);
+        ASSERT (ret == 1);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x20AC, 0 };
+    ret = u32_strmblen (input);
+    ASSERT (ret == 1);
+  }
+
+  /* Test non-BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x1D51F, 0 };
+    ret = u32_strmblen (input);
+    ASSERT (ret == 1);
+  }
+
+#if CONFIG_UNICODE_SAFETY
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint32_t input[] = { 0x340000, 0 };
+    ret = u32_strmblen (input);
+    ASSERT (ret == -1);
+  }
+#endif
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-strmbtouc.c b/tests/unistr/test-u32-strmbtouc.c
new file mode 100644 (file)
index 0000000..79c222e
--- /dev/null
@@ -0,0 +1,86 @@
+/* Test of u32_strmbtouc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint32_t input[] = { 0 };
+    uc = 0xBADFACE;
+    ret = u32_strmbtouc (&uc, input);
+    ASSERT (ret == 0);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint32_t buf[2];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        buf[1] = 0;
+        uc = 0xBADFACE;
+        ret = u32_strmbtouc (&uc, buf);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x20AC, 0 };
+    uc = 0xBADFACE;
+    ret = u32_strmbtouc (&uc, input);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test non-BMP unit input.  */
+  {
+    static const uint32_t input[] = { 0x1D51F, 0 };
+    uc = 0xBADFACE;
+    ret = u32_strmbtouc (&uc, input);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0x1D51F);
+  }
+
+#if CONFIG_UNICODE_SAFETY
+  /* Test incomplete/invalid 1-unit input.  */
+  {
+    static const uint32_t input[] = { 0x340000, 0 };
+    uc = 0xBADFACE;
+    ret = u32_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+#endif
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-strncat.c b/tests/unistr/test-u32-strncat.c
new file mode 100644 (file)
index 0000000..346bafb
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test of u32_strncat() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STRNCAT u32_strncat
+#define MAGIC 0xBADFACE
+#include "test-strncat.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint32_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint32_t input[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-strncmp.c b/tests/unistr/test-u32-strncmp.c
new file mode 100644 (file)
index 0000000..d69913d
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of u32_strncmp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STRNCMP u32_strncmp
+#include "test-strncmp.h"
+
+int
+main ()
+{
+  test_strncmp ();
+
+  /* Test comparison with non-BMP characters.  */
+  {
+    static const UNIT input1[] = { 0x1D51F, 0 };
+    static const UNIT input2[] = { 0xFEFF, 0 };
+    ASSERT (U_STRNCMP (input1, input2, 1) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 1) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 2) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 2) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 1000000) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 1000000) < 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-strncpy.c b/tests/unistr/test-u32-strncpy.c
new file mode 100644 (file)
index 0000000..9309c0e
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test of u32_strncpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STRNCPY u32_strncpy
+#define MAGIC 0xBADFACE
+#include "test-strncpy.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint32_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint32_t input[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-strnlen.c b/tests/unistr/test-u32-strnlen.c
new file mode 100644 (file)
index 0000000..6929914
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test of u32_strnlen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STRNLEN u32_strnlen
+#include "test-strnlen.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint32_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint32_t input[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E, 0
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-to-u16.c b/tests/unistr/test-u32-to-u16.c
new file mode 100644 (file)
index 0000000..6faf537
--- /dev/null
@@ -0,0 +1,156 @@
+/* Test of u32_to_u16() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <errno.h>
+
+#include "macros.h"
+
+static int
+check (const uint32_t *input, size_t input_length,
+       const uint16_t *expected, size_t expected_length)
+{
+  size_t length;
+  uint16_t *result;
+
+  /* Test return conventions with resultbuf == NULL.  */
+  result = u32_to_u16 (input, input_length, NULL, &length);
+  if (!(result != NULL))
+    return 1;
+  if (!(length == expected_length))
+    return 2;
+  if (!(u16_cmp (result, expected, expected_length) == 0))
+    return 3;
+  free (result);
+
+  /* Test return conventions with resultbuf too small.  */
+  if (expected_length > 0)
+    {
+      uint16_t *preallocated;
+
+      length = expected_length - 1;
+      preallocated = (uint16_t *) malloc (length * sizeof (uint16_t));
+      result = u32_to_u16 (input, input_length, preallocated, &length);
+      if (!(result != NULL))
+        return 4;
+      if (!(result != preallocated))
+        return 5;
+      if (!(length == expected_length))
+        return 6;
+      if (!(u16_cmp (result, expected, expected_length) == 0))
+        return 7;
+      free (result);
+      free (preallocated);
+    }
+
+  /* Test return conventions with resultbuf large enough.  */
+  {
+    uint16_t *preallocated;
+
+    length = expected_length;
+    preallocated = (uint16_t *) malloc (length * sizeof (uint16_t));
+    result = u32_to_u16 (input, input_length, preallocated, &length);
+    if (!(result != NULL))
+      return 8;
+    if (!(preallocated == NULL || result == preallocated))
+      return 9;
+    if (!(length == expected_length))
+      return 10;
+    if (!(u16_cmp (result, expected, expected_length) == 0))
+      return 11;
+    free (preallocated);
+  }
+
+  return 0;
+}
+
+int
+main ()
+{
+  /* Empty string.  */
+  ASSERT (check (NULL, 0, NULL, 0) == 0);
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint32_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    static const uint16_t expected[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint32_t input[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E
+      };
+    static const uint16_t expected[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* Invalid input.  */
+  {
+    static const uint32_t input[] = { 'x', 0x340000, 0x50000000, 'y' };
+#if 0 /* Currently invalid input is rejected, not accommodated.  */
+    static const uint16_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+#else
+    size_t length;
+    uint16_t *result;
+    uint16_t preallocated[10];
+
+    /* Test return conventions with resultbuf == NULL.  */
+    result = u32_to_u16 (input, SIZEOF (input), NULL, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf too small.  */
+    length = 1;
+    result = u32_to_u16 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf large enough.  */
+    length = SIZEOF (preallocated);
+    result = u32_to_u16 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+#endif
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-to-u8.c b/tests/unistr/test-u32-to-u8.c
new file mode 100644 (file)
index 0000000..933fba0
--- /dev/null
@@ -0,0 +1,159 @@
+/* Test of u32_to_u8() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <errno.h>
+
+#include "macros.h"
+
+static int
+check (const uint32_t *input, size_t input_length,
+       const uint8_t *expected, size_t expected_length)
+{
+  size_t length;
+  uint8_t *result;
+
+  /* Test return conventions with resultbuf == NULL.  */
+  result = u32_to_u8 (input, input_length, NULL, &length);
+  if (!(result != NULL))
+    return 1;
+  if (!(length == expected_length))
+    return 2;
+  if (!(u8_cmp (result, expected, expected_length) == 0))
+    return 3;
+  free (result);
+
+  /* Test return conventions with resultbuf too small.  */
+  if (expected_length > 0)
+    {
+      uint8_t *preallocated;
+
+      length = expected_length - 1;
+      preallocated = (uint8_t *) malloc (length * sizeof (uint8_t));
+      result = u32_to_u8 (input, input_length, preallocated, &length);
+      if (!(result != NULL))
+        return 4;
+      if (!(result != preallocated))
+        return 5;
+      if (!(length == expected_length))
+        return 6;
+      if (!(u8_cmp (result, expected, expected_length) == 0))
+        return 7;
+      free (result);
+      free (preallocated);
+    }
+
+  /* Test return conventions with resultbuf large enough.  */
+  {
+    uint8_t *preallocated;
+
+    length = expected_length;
+    preallocated = (uint8_t *) malloc (length * sizeof (uint8_t));
+    result = u32_to_u8 (input, input_length, preallocated, &length);
+    if (!(result != NULL))
+      return 8;
+    if (!(preallocated == NULL || result == preallocated))
+      return 9;
+    if (!(length == expected_length))
+      return 10;
+    if (!(u8_cmp (result, expected, expected_length) == 0))
+      return 11;
+    free (preallocated);
+  }
+
+  return 0;
+}
+
+int
+main ()
+{
+  /* Empty string.  */
+  ASSERT (check (NULL, 0, NULL, 0) == 0);
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint32_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    static const uint8_t expected[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n'
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint32_t input[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E
+      };
+    static const uint8_t expected[] =
+      { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F,
+        ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* Invalid input.  */
+  {
+    static const uint32_t input[] = { 'x', 0x340000, 0x50000000, 'y' };
+#if 0 /* Currently invalid input is rejected, not accommodated.  */
+    static const uint8_t expected[] =
+      { 'x', 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 'y' };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+#else
+    size_t length;
+    uint8_t *result;
+    uint8_t preallocated[10];
+
+    /* Test return conventions with resultbuf == NULL.  */
+    result = u32_to_u8 (input, SIZEOF (input), NULL, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf too small.  */
+    length = 1;
+    result = u32_to_u8 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf large enough.  */
+    length = SIZEOF (preallocated);
+    result = u32_to_u8 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+#endif
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u32-uctomb.c b/tests/unistr/test-u32-uctomb.c
new file mode 100644 (file)
index 0000000..0a25177
--- /dev/null
@@ -0,0 +1,104 @@
+/* Test of u32_uctomb() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define MAGIC 0xBADFACE
+
+int
+main ()
+{
+  /* Test ISO 646 character, in particular the NUL character.  */
+  {
+    ucs4_t uc;
+
+    for (uc = 0; uc < 0x80; uc++)
+      {
+        uint32_t buf[2] = { MAGIC, MAGIC };
+        int ret;
+
+        ret = u32_uctomb (buf, uc, 0);
+        ASSERT (ret == -2);
+        ASSERT (buf[0] == MAGIC);
+
+        ret = u32_uctomb (buf, uc, 1);
+        ASSERT (ret == 1);
+        ASSERT (buf[0] == uc);
+        ASSERT (buf[1] == MAGIC);
+      }
+  }
+
+  /* Test BMP character.  */
+  {
+    ucs4_t uc = 0x20AC;
+    uint32_t buf[2] = { MAGIC, MAGIC };
+    int ret;
+
+    ret = u32_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u32_uctomb (buf, uc, 1);
+    ASSERT (ret == 1);
+    ASSERT (buf[0] == uc);
+    ASSERT (buf[1] == MAGIC);
+  }
+
+  /* Test non-BMP character.  */
+  {
+    ucs4_t uc = 0x10FFFD;
+    uint32_t buf[2] = { MAGIC, MAGIC };
+    int ret;
+
+    ret = u32_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u32_uctomb (buf, uc, 1);
+    ASSERT (ret == 1);
+    ASSERT (buf[0] == uc);
+    ASSERT (buf[1] == MAGIC);
+  }
+
+  /* Test invalid characters.  */
+  {
+    ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF };
+    uint32_t buf[2] = { MAGIC, MAGIC };
+    size_t i;
+
+    for (i = 0; i < SIZEOF (invalid); i++)
+      {
+        ucs4_t uc = invalid[i];
+        int n;
+
+        for (n = 0; n <= 2; n++)
+          {
+            int ret = u32_uctomb (buf, uc, n);
+            ASSERT (ret == -1);
+            ASSERT (buf[0] == MAGIC);
+            ASSERT (buf[1] == MAGIC);
+          }
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-check.c b/tests/unistr/test-u8-check.c
new file mode 100644 (file)
index 0000000..a32d385
--- /dev/null
@@ -0,0 +1,188 @@
+/* Test of u8_check() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Test empty string.  */
+  {
+    static const uint8_t input[] = "";
+    ASSERT (u8_check (input, 0) == NULL);
+  }
+
+  /* Test valid non-empty string.  */
+  {
+    static const uint8_t input[] = /* "Данило Шеган" */
+      "\320\224\320\260\320\275\320\270\320\273\320\276 \320\250\320\265\320\263\320\260\320\275";
+    ASSERT (u8_check (input, sizeof (input) - 1) == NULL);
+  }
+
+  /* Test out-of-range character with 4 bytes: U+110000.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\364\220\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test out-of-range character with 5 bytes: U+200000.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\370\210\200\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test out-of-range character with 6 bytes: U+4000000.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\374\204\200\200\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test invalid lead byte.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\376\200\200\200\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\377\200\200\200\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test overlong 2-byte character.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\301\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test overlong 3-byte character.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\340\200\277";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test overlong 4-byte character.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\360\200\277\277";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test invalid bytes in 2-byte character.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\302\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == NULL);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\302\100";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\302\300";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test invalid bytes in 3-byte character.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\342\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == NULL);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\342\100\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\342\300\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\342\200\100";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\342\200\300";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test invalid bytes in 4-byte character.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\362\200\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == NULL);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\362\100\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\362\300\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\362\200\100\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\362\200\300\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\362\200\200\100";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\362\200\200\300";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test truncated/incomplete 2-byte character.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\302";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test truncated/incomplete 3-byte character.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\342\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test truncated/incomplete 4-byte character.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\362\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test missing lead byte.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\200\200\200\200\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  /* Test surrogate codepoints.  */
+  {
+    static const uint8_t input[] = "\320\224\320\260\355\240\200\355\260\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+  {
+    static const uint8_t input[] = "\320\224\320\260\355\260\200";
+    ASSERT (u8_check (input, sizeof (input) - 1) == input + 4);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-chr.c b/tests/unistr/test-u8-chr.c
new file mode 100644 (file)
index 0000000..7c4b999
--- /dev/null
@@ -0,0 +1,31 @@
+/* Test of u8_chr() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_CHR u8_chr
+#define U_SET u8_set
+#include "test-chr.h"
diff --git a/tests/unistr/test-u8-cmp.c b/tests/unistr/test-u8-cmp.c
new file mode 100644 (file)
index 0000000..73778c7
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of u8_cmp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_CMP u8_cmp
+#define MAGIC 0xBA
+#include "test-cmp.h"
+
+int
+main ()
+{
+  test_cmp ();
+
+  /* Test comparison with non-BMP characters.  */
+  {
+    static const UNIT input1[] = { 0xF0, 0x9D, 0x94, 0x9E };
+    static const UNIT input2[] = { 0xEF, 0xBB, 0xBF, 0x00 };
+    ASSERT (U_CMP (input1, input2, 4) > 0);
+    ASSERT (U_CMP (input2, input1, 4) < 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-cmp2.c b/tests/unistr/test-u8-cmp2.c
new file mode 100644 (file)
index 0000000..8a7848e
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u8_cmp2() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_CMP2 u8_cmp2
+#define MAGIC 0xBA
+#include "test-cmp2.h"
diff --git a/tests/unistr/test-u8-cpy-alloc.c b/tests/unistr/test-u8-cpy-alloc.c
new file mode 100644 (file)
index 0000000..2d35b8f
--- /dev/null
@@ -0,0 +1,29 @@
+/* Test of u8_cpy_alloc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_CPY_ALLOC u8_cpy_alloc
+#include "test-cpy-alloc.h"
diff --git a/tests/unistr/test-u8-cpy.c b/tests/unistr/test-u8-cpy.c
new file mode 100644 (file)
index 0000000..8d1152d
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u8_cpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_CPY u8_cpy
+#define MAGIC 0xBA
+#include "test-cpy.h"
diff --git a/tests/unistr/test-u8-mblen.c b/tests/unistr/test-u8-mblen.c
new file mode 100644 (file)
index 0000000..75e92d6
--- /dev/null
@@ -0,0 +1,155 @@
+/* Test of u8_mblen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  int ret;
+
+  /* Test zero-length input.  */
+  {
+    static const uint8_t input[] = "";
+    ret = u8_mblen (input, 0);
+    ASSERT (ret == -1);
+  }
+
+  /* Test NUL unit input.  */
+  {
+    static const uint8_t input[] = "";
+    ret = u8_mblen (input, 1);
+    ASSERT (ret == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint8_t buf[1];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        ret = u8_mblen (buf, 1);
+        ASSERT (ret == 1);
+      }
+  }
+
+  /* Test 2-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xC3, 0x97 };
+    ret = u8_mblen (input, 2);
+    ASSERT (ret == 2);
+  }
+
+  /* Test 3-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0xAC };
+    ret = u8_mblen (input, 3);
+    ASSERT (ret == 3);
+  }
+
+  /* Test 4-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD };
+    ret = u8_mblen (input, 4);
+    ASSERT (ret == 4);
+  }
+
+  /* Test incomplete/invalid 1-byte input.  */
+  {
+    static const uint8_t input[] = { 0xC1 };
+    ret = u8_mblen (input, 1);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xC3 };
+    ret = u8_mblen (input, 1);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xE2 };
+    ret = u8_mblen (input, 1);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF4 };
+    ret = u8_mblen (input, 1);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xFE };
+    ret = u8_mblen (input, 1);
+    ASSERT (ret == -1);
+  }
+
+  /* Test incomplete/invalid 2-byte input.  */
+  {
+    static const uint8_t input[] = { 0xE0, 0x9F };
+    ret = u8_mblen (input, 2);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0x82 };
+    ret = u8_mblen (input, 2);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0xD0 };
+    ret = u8_mblen (input, 2);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF0, 0x8F };
+    ret = u8_mblen (input, 2);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F };
+    ret = u8_mblen (input, 2);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0 };
+    ret = u8_mblen (input, 2);
+    ASSERT (ret == -1);
+  }
+
+  /* Test incomplete/invalid 3-byte input.  */
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xBF };
+    ret = u8_mblen (input, 3);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0xBF };
+    ret = u8_mblen (input, 3);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 };
+    ret = u8_mblen (input, 3);
+    ASSERT (ret == -1);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-mbsnlen.c b/tests/unistr/test-u8-mbsnlen.c
new file mode 100644 (file)
index 0000000..8e68550
--- /dev/null
@@ -0,0 +1,61 @@
+/* Test of u8_mbsnlen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint8_t input[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n'
+      };
+    static const size_t expected[SIZEOF (input) + 1] =
+      { 0,
+        1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11,
+        12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17,
+        18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23,
+        24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36,
+        37, 38, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+        50, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55,
+        56, 56, 56, 57, 57, 57, 58,
+        59, 59, 59, 60, 60, 60, 61
+      };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (input); n++)
+      {
+        size_t len = u8_mbsnlen (input, n);
+        ASSERT (len == expected[n]);
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-mbtouc-unsafe.c b/tests/unistr/test-u8-mbtouc-unsafe.c
new file mode 100644 (file)
index 0000000..b093aa8
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test of u8_mbtouc_unsafe() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#include "test-u8-mbtouc.h"
+
+int
+main ()
+{
+  test_function (u8_mbtouc_unsafe);
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-mbtouc.c b/tests/unistr/test-u8-mbtouc.c
new file mode 100644 (file)
index 0000000..f6960a6
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test of u8_mbtouc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#include "test-u8-mbtouc.h"
+
+int
+main ()
+{
+  test_function (u8_mbtouc);
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-mbtouc.h b/tests/unistr/test-u8-mbtouc.h
new file mode 100644 (file)
index 0000000..bcafb05
--- /dev/null
@@ -0,0 +1,179 @@
+/* Test of u8_mbtouc() and u8_mbtouc_unsafe() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+static void
+test_function (int (*my_u8_mbtouc) (ucs4_t *, const uint8_t *, size_t))
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint8_t input[] = "";
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint8_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ret = my_u8_mbtouc (&uc, buf, 1);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test 2-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xC3, 0x97 };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 2);
+    ASSERT (ret == 2);
+    ASSERT (uc == 0x00D7);
+  }
+
+  /* Test 3-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0xAC };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 3);
+    ASSERT (ret == 3);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 4-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 4);
+    ASSERT (ret == 4);
+    ASSERT (uc == 0x10FFFD);
+  }
+
+  /* Test incomplete/invalid 1-byte input.  */
+  {
+    static const uint8_t input[] = { 0xC1 };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xC3 };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2 };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF4 };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xFE };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  /* Test incomplete/invalid 2-byte input.  */
+  {
+    static const uint8_t input[] = { 0xE0, 0x9F };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 2);
+    ASSERT (ret == 1 || ret == 2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0x82 };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 2);
+    ASSERT (ret == 2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0xD0 };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 2);
+    ASSERT (ret == 1 || ret == 2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF0, 0x8F };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 2);
+    ASSERT (ret == 1 || ret == 2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 2);
+    ASSERT (ret == 2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0 };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 2);
+    ASSERT (ret == 1 || ret == 2);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  /* Test incomplete/invalid 3-byte input.  */
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xBF };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 3);
+    ASSERT (ret == 3);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0xBF };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 3);
+    ASSERT (ret == 1 || ret == 3);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 };
+    uc = 0xBADFACE;
+    ret = my_u8_mbtouc (&uc, input, 3);
+    ASSERT (ret == 1 || ret == 3);
+    ASSERT (uc == 0xFFFD);
+  }
+}
diff --git a/tests/unistr/test-u8-mbtoucr.c b/tests/unistr/test-u8-mbtoucr.c
new file mode 100644 (file)
index 0000000..88e08d3
--- /dev/null
@@ -0,0 +1,187 @@
+/* Test of u8_mbtoucr() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint8_t input[] = "";
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint8_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ret = u8_mbtoucr (&uc, buf, 1);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test 2-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xC3, 0x97 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == 2);
+    ASSERT (uc == 0x00D7);
+  }
+
+  /* Test 3-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0xAC };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 3);
+    ASSERT (ret == 3);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 4-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 4);
+    ASSERT (ret == 4);
+    ASSERT (uc == 0x10FFFD);
+  }
+
+  /* Test incomplete/invalid 1-byte input.  */
+  {
+    static const uint8_t input[] = { 0xC1 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xC3 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF4 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xFE };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  /* Test incomplete/invalid 2-byte input.  */
+  {
+    static const uint8_t input[] = { 0xE0, 0x9F };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0x82 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0xD0 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF0, 0x8F };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  /* Test incomplete/invalid 3-byte input.  */
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xBF };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 3);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0xBF };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 3);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 3);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-move.c b/tests/unistr/test-u8-move.c
new file mode 100644 (file)
index 0000000..d18d8dd
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u8_move() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_MOVE u8_move
+#define MAGIC 0xBA
+#include "test-move.h"
diff --git a/tests/unistr/test-u8-next.c b/tests/unistr/test-u8-next.c
new file mode 100644 (file)
index 0000000..c4e06b5
--- /dev/null
@@ -0,0 +1,188 @@
+/* Test of u8_next() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  const uint8_t *ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint8_t input[] = "";
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint8_t buf[2];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        buf[1] = 0;
+        uc = 0xBADFACE;
+        ret = u8_next (&uc, buf);
+        ASSERT (ret == buf + 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test 2-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xC3, 0x97, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == input + 2);
+    ASSERT (uc == 0x00D7);
+  }
+
+  /* Test 3-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == input + 3);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 4-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == input + 4);
+    ASSERT (uc == 0x10FFFD);
+  }
+
+  /* Test incomplete/invalid 1-byte input.  */
+  {
+    static const uint8_t input[] = { 0xC1, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xC3, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF4, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xFE, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  /* Test incomplete/invalid 2-byte input.  */
+  {
+    static const uint8_t input[] = { 0xE0, 0x9F, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0xD0, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF0, 0x8F, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  /* Test incomplete/invalid 3-byte input.  */
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 };
+    uc = 0xBADFACE;
+    ret = u8_next (&uc, input);
+    ASSERT (ret == NULL);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-prev.c b/tests/unistr/test-u8-prev.c
new file mode 100644 (file)
index 0000000..61f47ef
--- /dev/null
@@ -0,0 +1,315 @@
+/* Test of u8_prev() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+static int
+check (const uint8_t *input, size_t input_length, ucs4_t *puc)
+{
+  ucs4_t uc;
+
+  /* Test recognition when at the beginning of the string.  */
+  if (u8_prev (&uc, input + input_length, input) != input)
+    return 1;
+
+  /* Test recognition when preceded by a 1-unit character.  */
+  {
+    uint8_t buf[100];
+    uint8_t *ptr;
+    size_t i;
+    ucs4_t uc1;
+
+    ptr = buf;
+    *ptr++ = 'x';
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    if (u8_prev (&uc1, ptr + input_length, buf) != ptr)
+      return 2;
+    if (uc1 != uc)
+      return 3;
+  }
+
+  /* Test recognition when preceded by a 2-unit character.  */
+  {
+    uint8_t buf[100];
+    uint8_t *ptr;
+    size_t i;
+    ucs4_t uc1;
+
+    ptr = buf;
+    *ptr++ = 0xC3;
+    *ptr++ = 0x97;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    if (u8_prev (&uc1, ptr + input_length, buf) != ptr)
+      return 4;
+    if (uc1 != uc)
+      return 5;
+  }
+
+  /* Test recognition when preceded by a 3-unit character.  */
+  {
+    uint8_t buf[100];
+    uint8_t *ptr;
+    size_t i;
+    ucs4_t uc1;
+
+    ptr = buf;
+    *ptr++ = 0xE2;
+    *ptr++ = 0x84;
+    *ptr++ = 0x82;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    if (u8_prev (&uc1, ptr + input_length, buf) != ptr)
+      return 6;
+    if (uc1 != uc)
+      return 7;
+  }
+
+  /* Test recognition when preceded by a 4-unit character.  */
+  {
+    uint8_t buf[100];
+    uint8_t *ptr;
+    size_t i;
+    ucs4_t uc1;
+
+    ptr = buf;
+    *ptr++ = 0xF0;
+    *ptr++ = 0x9D;
+    *ptr++ = 0x94;
+    *ptr++ = 0x9E;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    if (u8_prev (&uc1, ptr + input_length, buf) != ptr)
+      return 8;
+    if (uc1 != uc)
+      return 9;
+  }
+
+  *puc = uc;
+  return 0;
+}
+
+static int
+check_invalid (const uint8_t *input, size_t input_length)
+{
+  ucs4_t uc;
+
+  /* Test recognition when at the beginning of the string.  */
+  uc = 0xBADFACE;
+  if (u8_prev (&uc, input + input_length, input) != NULL)
+    return 1;
+  if (uc != 0xBADFACE)
+    return 2;
+
+  /* Test recognition when preceded by a 1-unit character.  */
+  {
+    uint8_t buf[100];
+    uint8_t *ptr;
+    size_t i;
+
+    ptr = buf;
+    *ptr++ = 'x';
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    uc = 0xBADFACE;
+    if (u8_prev (&uc, ptr + input_length, buf) != NULL)
+      return 3;
+    if (uc != 0xBADFACE)
+      return 4;
+  }
+
+  /* Test recognition when preceded by a 2-unit character.  */
+  {
+    uint8_t buf[100];
+    uint8_t *ptr;
+    size_t i;
+
+    ptr = buf;
+    *ptr++ = 0xC3;
+    *ptr++ = 0x97;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    uc = 0xBADFACE;
+    if (u8_prev (&uc, ptr + input_length, buf) != NULL)
+      return 5;
+    if (uc != 0xBADFACE)
+      return 6;
+  }
+
+  /* Test recognition when preceded by a 3-unit character.  */
+  {
+    uint8_t buf[100];
+    uint8_t *ptr;
+    size_t i;
+
+    ptr = buf;
+    *ptr++ = 0xE2;
+    *ptr++ = 0x84;
+    *ptr++ = 0x82;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    uc = 0xBADFACE;
+    if (u8_prev (&uc, ptr + input_length, buf) != NULL)
+      return 7;
+    if (uc != 0xBADFACE)
+      return 8;
+  }
+
+  /* Test recognition when preceded by a 4-unit character.  */
+  {
+    uint8_t buf[100];
+    uint8_t *ptr;
+    size_t i;
+
+    ptr = buf;
+    *ptr++ = 0xF0;
+    *ptr++ = 0x9D;
+    *ptr++ = 0x94;
+    *ptr++ = 0x9E;
+    for (i = 0; i < input_length; i++)
+      ptr[i] = input[i];
+
+    uc = 0xBADFACE;
+    if (u8_prev (&uc, ptr + input_length, buf) != NULL)
+      return 9;
+    if (uc != 0xBADFACE)
+      return 10;
+  }
+
+  return 0;
+}
+
+int
+main ()
+{
+  ucs4_t uc;
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint8_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ASSERT (check (buf, 1, &uc) == 0);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test 2-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xC3, 0x97 };
+    uc = 0xBADFACE;
+    ASSERT (check (input, SIZEOF (input), &uc) == 0);
+    ASSERT (uc == 0x00D7);
+  }
+
+  /* Test 3-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0xAC };
+    uc = 0xBADFACE;
+    ASSERT (check (input, SIZEOF (input), &uc) == 0);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 4-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD };
+    uc = 0xBADFACE;
+    ASSERT (check (input, SIZEOF (input), &uc) == 0);
+    ASSERT (uc == 0x10FFFD);
+  }
+
+  /* Test incomplete/invalid 1-byte input.  */
+  {
+    static const uint8_t input[] = { 0xC1 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xC3 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xE2 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xF4 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xFE };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+
+  /* Test incomplete/invalid 2-byte input.  */
+  {
+    static const uint8_t input[] = { 0xE0, 0x9F };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0x82 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0xD0 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xF0, 0x8F };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+
+  /* Test incomplete/invalid 3-byte input.  */
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xBF };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xE4, 0xBF };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 };
+    ASSERT (check_invalid (input, SIZEOF (input)) == 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-set.c b/tests/unistr/test-u8-set.c
new file mode 100644 (file)
index 0000000..e778fed
--- /dev/null
@@ -0,0 +1,29 @@
+/* Test of u8_set() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_SET u8_set
+#define MAGIC 0xBA
+#define VALUE 'x'
+#include "test-set.h"
diff --git a/tests/unistr/test-u8-stpcpy.c b/tests/unistr/test-u8-stpcpy.c
new file mode 100644 (file)
index 0000000..94c0471
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u8_stpcpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_STPCPY u8_stpcpy
+#define MAGIC 0xBA
+#include "test-stpcpy.h"
diff --git a/tests/unistr/test-u8-stpncpy.c b/tests/unistr/test-u8-stpncpy.c
new file mode 100644 (file)
index 0000000..4809626
--- /dev/null
@@ -0,0 +1,52 @@
+/* Test of u8_stpncpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_STPNCPY u8_stpncpy
+#define MAGIC 0xBA
+#include "test-stpncpy.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint8_t input[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0'
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-strcat.c b/tests/unistr/test-u8-strcat.c
new file mode 100644 (file)
index 0000000..7fa9e84
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u8_strcat() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_STRCAT u8_strcat
+#define MAGIC 0xBA
+#include "test-strcat.h"
diff --git a/tests/unistr/test-u8-strcmp.c b/tests/unistr/test-u8-strcmp.c
new file mode 100644 (file)
index 0000000..313cd11
--- /dev/null
@@ -0,0 +1,34 @@
+/* Test of u8_strcmp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define U_STRCMP u8_strcmp
+#include "test-u8-strcmp.h"
+
+int
+main ()
+{
+  test_u8_strcmp ();
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-strcmp.h b/tests/unistr/test-u8-strcmp.h
new file mode 100644 (file)
index 0000000..9c25dac
--- /dev/null
@@ -0,0 +1,42 @@
+/* Test of u8_strcmp() and u8_strcoll() functions.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#define UNIT uint8_t
+#include "test-strcmp.h"
+
+static void
+test_u8_strcmp (void)
+{
+  test_strcmp ();
+
+  /* Test comparison between ASCII and non-ASCII characters.  */
+  {
+    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
+    static const UNIT input2[] = { 0xE2, 0x80, 0xA2, 0 };
+    ASSERT (U_STRCMP (input1, input2) < 0);
+    ASSERT (U_STRCMP (input2, input1) > 0);
+  }
+
+  /* Test comparison with non-BMP characters.  */
+  {
+    static const UNIT input1[] = { 0xF0, 0x9D, 0x94, 0x9E, 0 };
+    static const UNIT input2[] = { 0xEF, 0xBB, 0xBF, 0 };
+    ASSERT (U_STRCMP (input1, input2) > 0);
+    ASSERT (U_STRCMP (input2, input1) < 0);
+  }
+}
diff --git a/tests/unistr/test-u8-strcoll.c b/tests/unistr/test-u8-strcoll.c
new file mode 100644 (file)
index 0000000..ae5c9a4
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of u8_strcoll() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define U_STRCMP u8_strcoll
+#include "test-u8-strcmp.h"
+
+int
+main ()
+{
+  /* This test relies on three facts:
+     - setlocale is not being called, therefore the locale is the "C" locale.
+     - In the "C" locale, strcoll is equivalent to strcmp.
+     - In the u8_strcoll implementation, Unicode strings that are not
+       convertible to the locale encoding are sorted higher than convertible
+       strings and compared according to u8_strcmp.  */
+
+  test_u8_strcmp ();
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-strcpy.c b/tests/unistr/test-u8-strcpy.c
new file mode 100644 (file)
index 0000000..810f975
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u8_strcpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_STRCPY u8_strcpy
+#define MAGIC 0xBA
+#include "test-strcpy.h"
diff --git a/tests/unistr/test-u8-strdup.c b/tests/unistr/test-u8-strdup.c
new file mode 100644 (file)
index 0000000..6da2151
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test of u8_strdup() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_STRDUP u8_strdup
+#include "test-strdup.h"
diff --git a/tests/unistr/test-u8-strlen.c b/tests/unistr/test-u8-strlen.c
new file mode 100644 (file)
index 0000000..3dfa1b0
--- /dev/null
@@ -0,0 +1,50 @@
+/* Test of u8_strlen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Empty string.  */
+  {
+    static const uint8_t input[] = { 0 };
+    ASSERT (u8_strlen (input) == 0);
+  }
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint8_t input[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0'
+      };
+    ASSERT (u8_strlen (input) == SIZEOF (input) - 1);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-strmblen.c b/tests/unistr/test-u8-strmblen.c
new file mode 100644 (file)
index 0000000..bde3000
--- /dev/null
@@ -0,0 +1,149 @@
+/* Test of u8_strmblen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint8_t input[] = "";
+    ret = u8_strmblen (input);
+    ASSERT (ret == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint8_t buf[2];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        buf[1] = 0;
+        ret = u8_strmblen (buf);
+        ASSERT (ret == 1);
+      }
+  }
+
+  /* Test 2-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xC3, 0x97, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == 2);
+  }
+
+  /* Test 3-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == 3);
+  }
+
+  /* Test 4-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == 4);
+  }
+
+  /* Test incomplete/invalid 1-byte input.  */
+  {
+    static const uint8_t input[] = { 0xC1, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xC3, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF4, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xFE, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+
+  /* Test incomplete/invalid 2-byte input.  */
+  {
+    static const uint8_t input[] = { 0xE0, 0x9F, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0xD0, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF0, 0x8F, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+
+  /* Test incomplete/invalid 3-byte input.  */
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 };
+    ret = u8_strmblen (input);
+    ASSERT (ret == -1);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-strmbtouc.c b/tests/unistr/test-u8-strmbtouc.c
new file mode 100644 (file)
index 0000000..5591357
--- /dev/null
@@ -0,0 +1,188 @@
+/* Test of u8_strmbtouc() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint8_t input[] = "";
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == 0);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint8_t buf[2];
+
+    for (c = 1; c < 0x80; c++)
+      {
+        buf[0] = c;
+        buf[1] = 0;
+        uc = 0xBADFACE;
+        ret = u8_strmbtouc (&uc, buf);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test 2-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xC3, 0x97, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == 2);
+    ASSERT (uc == 0x00D7);
+  }
+
+  /* Test 3-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == 3);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 4-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == 4);
+    ASSERT (uc == 0x10FFFD);
+  }
+
+  /* Test incomplete/invalid 1-byte input.  */
+  {
+    static const uint8_t input[] = { 0xC1, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xC3, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xF4, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xFE, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+
+  /* Test incomplete/invalid 2-byte input.  */
+  {
+    static const uint8_t input[] = { 0xE0, 0x9F, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0xD0, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xF0, 0x8F, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+
+  /* Test incomplete/invalid 3-byte input.  */
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 };
+    uc = 0xBADFACE;
+    ret = u8_strmbtouc (&uc, input);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xBADFACE);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-strncat.c b/tests/unistr/test-u8-strncat.c
new file mode 100644 (file)
index 0000000..bb90041
--- /dev/null
@@ -0,0 +1,52 @@
+/* Test of u8_strncat() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_STRNCAT u8_strncat
+#define MAGIC 0xBA
+#include "test-strncat.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint8_t input[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0'
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-strncmp.c b/tests/unistr/test-u8-strncmp.c
new file mode 100644 (file)
index 0000000..f63cdaa
--- /dev/null
@@ -0,0 +1,53 @@
+/* Test of u8_strncmp() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_STRNCMP u8_strncmp
+#include "test-strncmp.h"
+
+int
+main ()
+{
+  test_strncmp ();
+
+  /* Test comparison with non-BMP characters.  */
+  {
+    static const UNIT input1[] = { 0xF0, 0x9D, 0x94, 0x9E, 0 };
+    static const UNIT input2[] = { 0xEF, 0xBB, 0xBF, 0 };
+    ASSERT (U_STRNCMP (input1, input2, 1) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 1) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 2) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 2) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 3) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 3) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 4) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 4) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 5) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 5) < 0);
+    ASSERT (U_STRNCMP (input1, input2, 1000000) > 0);
+    ASSERT (U_STRNCMP (input2, input1, 1000000) < 0);
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-strncpy.c b/tests/unistr/test-u8-strncpy.c
new file mode 100644 (file)
index 0000000..64cabdc
--- /dev/null
@@ -0,0 +1,52 @@
+/* Test of u8_strncpy() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_STRNCPY u8_strncpy
+#define MAGIC 0xBA
+#include "test-strncpy.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint8_t input[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0'
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-strnlen.c b/tests/unistr/test-u8-strnlen.c
new file mode 100644 (file)
index 0000000..98de797
--- /dev/null
@@ -0,0 +1,49 @@
+/* Test of u8_strnlen() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_STRNLEN u8_strnlen
+#include "test-strnlen.h"
+
+int
+main ()
+{
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint8_t input[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0'
+      };
+    check (input, SIZEOF (input));
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-to-u16.c b/tests/unistr/test-u8-to-u16.c
new file mode 100644 (file)
index 0000000..02ef44f
--- /dev/null
@@ -0,0 +1,158 @@
+/* Test of u8_to_u16() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <errno.h>
+
+#include "macros.h"
+
+static int
+check (const uint8_t *input, size_t input_length,
+       const uint16_t *expected, size_t expected_length)
+{
+  size_t length;
+  uint16_t *result;
+
+  /* Test return conventions with resultbuf == NULL.  */
+  result = u8_to_u16 (input, input_length, NULL, &length);
+  if (!(result != NULL))
+    return 1;
+  if (!(length == expected_length))
+    return 2;
+  if (!(u16_cmp (result, expected, expected_length) == 0))
+    return 3;
+  free (result);
+
+  /* Test return conventions with resultbuf too small.  */
+  if (expected_length > 0)
+    {
+      uint16_t *preallocated;
+
+      length = expected_length - 1;
+      preallocated = (uint16_t *) malloc (length * sizeof (uint16_t));
+      result = u8_to_u16 (input, input_length, preallocated, &length);
+      if (!(result != NULL))
+        return 4;
+      if (!(result != preallocated))
+        return 5;
+      if (!(length == expected_length))
+        return 6;
+      if (!(u16_cmp (result, expected, expected_length) == 0))
+        return 7;
+      free (result);
+      free (preallocated);
+    }
+
+  /* Test return conventions with resultbuf large enough.  */
+  {
+    uint16_t *preallocated;
+
+    length = expected_length;
+    preallocated = (uint16_t *) malloc (length * sizeof (uint16_t));
+    result = u8_to_u16 (input, input_length, preallocated, &length);
+    if (!(result != NULL))
+      return 8;
+    if (!(preallocated == NULL || result == preallocated))
+      return 9;
+    if (!(length == expected_length))
+      return 10;
+    if (!(u16_cmp (result, expected, expected_length) == 0))
+      return 11;
+    free (preallocated);
+  }
+
+  return 0;
+}
+
+int
+main ()
+{
+  /* Empty string.  */
+  ASSERT (check (NULL, 0, NULL, 0) == 0);
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint8_t input[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n'
+      };
+    static const uint16_t expected[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint8_t input[] =
+      { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F,
+        ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E
+      };
+    static const uint16_t expected[] =
+      { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=',
+        0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* Invalid input.  */
+  {
+    static const uint8_t input[] = { 'x', 0xC2, 0xC3, 'y' };
+#if 0 /* Currently invalid input is rejected, not accommodated.  */
+    static const uint16_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+#else
+    size_t length;
+    uint16_t *result;
+    uint16_t preallocated[10];
+
+    /* Test return conventions with resultbuf == NULL.  */
+    result = u8_to_u16 (input, SIZEOF (input), NULL, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf too small.  */
+    length = 1;
+    result = u8_to_u16 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf large enough.  */
+    length = SIZEOF (preallocated);
+    result = u8_to_u16 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+#endif
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-to-u32.c b/tests/unistr/test-u8-to-u32.c
new file mode 100644 (file)
index 0000000..d148e62
--- /dev/null
@@ -0,0 +1,158 @@
+/* Test of u8_to_u32() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <errno.h>
+
+#include "macros.h"
+
+static int
+check (const uint8_t *input, size_t input_length,
+       const uint32_t *expected, size_t expected_length)
+{
+  size_t length;
+  uint32_t *result;
+
+  /* Test return conventions with resultbuf == NULL.  */
+  result = u8_to_u32 (input, input_length, NULL, &length);
+  if (!(result != NULL))
+    return 1;
+  if (!(length == expected_length))
+    return 2;
+  if (!(u32_cmp (result, expected, expected_length) == 0))
+    return 3;
+  free (result);
+
+  /* Test return conventions with resultbuf too small.  */
+  if (expected_length > 0)
+    {
+      uint32_t *preallocated;
+
+      length = expected_length - 1;
+      preallocated = (uint32_t *) malloc (length * sizeof (uint32_t));
+      result = u8_to_u32 (input, input_length, preallocated, &length);
+      if (!(result != NULL))
+        return 4;
+      if (!(result != preallocated))
+        return 5;
+      if (!(length == expected_length))
+        return 6;
+      if (!(u32_cmp (result, expected, expected_length) == 0))
+        return 7;
+      free (result);
+      free (preallocated);
+    }
+
+  /* Test return conventions with resultbuf large enough.  */
+  {
+    uint32_t *preallocated;
+
+    length = expected_length;
+    preallocated = (uint32_t *) malloc (length * sizeof (uint32_t));
+    result = u8_to_u32 (input, input_length, preallocated, &length);
+    if (!(result != NULL))
+      return 8;
+    if (!(preallocated == NULL || result == preallocated))
+      return 9;
+    if (!(length == expected_length))
+      return 10;
+    if (!(u32_cmp (result, expected, expected_length) == 0))
+      return 11;
+    free (preallocated);
+  }
+
+  return 0;
+}
+
+int
+main ()
+{
+  /* Empty string.  */
+  ASSERT (check (NULL, 0, NULL, 0) == 0);
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint8_t input[] =
+      { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81,
+        0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5,
+        '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(',
+        'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')',
+        ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',',
+        0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',',
+        0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n'
+      };
+    static const uint32_t expected[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint8_t input[] =
+      { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F,
+        ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E
+      };
+    static const uint32_t expected[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E
+      };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+  }
+
+  /* Invalid input.  */
+  {
+    static const uint8_t input[] = { 'x', 0xC2, 0xC3, 'y' };
+#if 0 /* Currently invalid input is rejected, not accommodated.  */
+    static const uint32_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' };
+    ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0);
+#else
+    size_t length;
+    uint32_t *result;
+    uint32_t preallocated[10];
+
+    /* Test return conventions with resultbuf == NULL.  */
+    result = u8_to_u32 (input, SIZEOF (input), NULL, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf too small.  */
+    length = 1;
+    result = u8_to_u32 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+
+    /* Test return conventions with resultbuf large enough.  */
+    length = SIZEOF (preallocated);
+    result = u8_to_u32 (input, SIZEOF (input), preallocated, &length);
+    ASSERT (result == NULL);
+    ASSERT (errno == EILSEQ);
+#endif
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u8-uctomb.c b/tests/unistr/test-u8-uctomb.c
new file mode 100644 (file)
index 0000000..8fbdc42
--- /dev/null
@@ -0,0 +1,157 @@
+/* Test of u8_uctomb() function.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define MAGIC 0xBA
+
+int
+main ()
+{
+  /* Test ISO 646 character, in particular the NUL character.  */
+  {
+    ucs4_t uc;
+
+    for (uc = 0; uc < 0x80; uc++)
+      {
+        uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+        int ret;
+
+        ret = u8_uctomb (buf, uc, 0);
+        ASSERT (ret == -2);
+        ASSERT (buf[0] == MAGIC);
+
+        ret = u8_uctomb (buf, uc, 1);
+        ASSERT (ret == 1);
+        ASSERT (buf[0] == uc);
+        ASSERT (buf[1] == MAGIC);
+      }
+  }
+
+  /* Test 2-byte character.  */
+  {
+    ucs4_t uc = 0x00D7;
+    uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+    int ret;
+
+    ret = u8_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 1);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 2);
+    ASSERT (ret == 2);
+    ASSERT (buf[0] == 0xC3);
+    ASSERT (buf[1] == 0x97);
+    ASSERT (buf[2] == MAGIC);
+  }
+
+  /* Test 3-byte character.  */
+  {
+    ucs4_t uc = 0x20AC;
+    uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+    int ret;
+
+    ret = u8_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 1);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 2);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+    ASSERT (buf[1] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 3);
+    ASSERT (ret == 3);
+    ASSERT (buf[0] == 0xE2);
+    ASSERT (buf[1] == 0x82);
+    ASSERT (buf[2] == 0xAC);
+    ASSERT (buf[3] == MAGIC);
+  }
+
+  /* Test 4-byte character.  */
+  {
+    ucs4_t uc = 0x10FFFD;
+    uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+    int ret;
+
+    ret = u8_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 1);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 2);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+    ASSERT (buf[1] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 3);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+    ASSERT (buf[1] == MAGIC);
+    ASSERT (buf[2] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 4);
+    ASSERT (ret == 4);
+    ASSERT (buf[0] == 0xF4);
+    ASSERT (buf[1] == 0x8F);
+    ASSERT (buf[2] == 0xBF);
+    ASSERT (buf[3] == 0xBD);
+    ASSERT (buf[4] == MAGIC);
+  }
+
+  /* Test invalid characters.  */
+  {
+    ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF };
+    uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+    size_t i;
+
+    for (i = 0; i < SIZEOF (invalid); i++)
+      {
+        ucs4_t uc = invalid[i];
+        int n;
+
+        for (n = 0; n <= 4; n++)
+          {
+            int ret = u8_uctomb (buf, uc, n);
+            ASSERT (ret == -1);
+            ASSERT (buf[0] == MAGIC);
+            ASSERT (buf[1] == MAGIC);
+            ASSERT (buf[2] == MAGIC);
+            ASSERT (buf[3] == MAGIC);
+            ASSERT (buf[4] == MAGIC);
+          }
+      }
+  }
+
+  return 0;
+}
index d1f0ccd..7d84b6c 100644 (file)
@@ -36,9 +36,32 @@ VC-tag = git tag -s -m '$(VERSION)' -u '$(gpg_key_ID)'
 
 VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
 
+# You can override this variable in cfg.mk to set your own regexp
+# matching files to ignore.
+VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
+
+# This is to preprocess robustly the output of $(VC_LIST), so that even
+# when $(srcdir) is a pathological name like "....", the leading sed command
+# removes only the intended prefix.
+_dot_escaped_srcdir = $(subst .,\.,$(srcdir))
+
+# Post-process $(VC_LIST) output, prepending $(srcdir)/, but only
+# when $(srcdir) is not ".".
+ifeq ($(srcdir),.)
+_prepend_srcdir_prefix =
+else
+_prepend_srcdir_prefix = | sed 's|^|$(srcdir)/|'
+endif
+
+# In order to be able to consistently filter "."-relative names,
+# (i.e., with no $(srcdir) prefix), this definition is careful to
+# remove any $(srcdir) prefix, and to restore what it removes.
 VC_LIST_EXCEPT = \
-  $(VC_LIST) | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
-              else grep -Ev "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi
+  $(VC_LIST) | sed 's|^$(_dot_escaped_srcdir)/||' \
+       | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
+         else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
+       | grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)' \
+       $(_prepend_srcdir_prefix)
 
 ifeq ($(origin prev_version_file), undefined)
   prev_version_file = $(srcdir)/.prev-version
@@ -102,7 +125,9 @@ local-checks-available = \
 
 # Arrange to print the name of each syntax-checking rule just before running it.
 $(syntax-check-rules): %: %.m
-$(patsubst %, %.m, $(syntax-check-rules)):
+sc_m_rules_ = $(patsubst %, %.m, $(syntax-check-rules))
+.PHONY: $(sc_m_rules_)
+$(sc_m_rules_):
        @echo $(patsubst sc_%.m, %, $@)
 
 local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
@@ -311,6 +336,11 @@ sc_prohibit_inttostr_without_use:
          $(_header_without_use)
 
 # Don't include this header unless you use one of its functions.
+sc_prohibit_ignore_value_without_use:
+       @h='"ignore-value.h"' re='\<ignore_(value|ptr) *\(' \
+         $(_header_without_use)
+
+# Don't include this header unless you use one of its functions.
 sc_prohibit_error_without_use:
        @h='"error.h"' \
        re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
@@ -339,6 +369,22 @@ sc_prohibit_xalloc_without_use:
        re='\<($(_xa1)|$(_xa2)) *\('\
          $(_header_without_use)
 
+# Extract function names:
+# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1' lib/hash.h
+_hash_re = \
+clear|delete|free|get_(first|next)|insert|lookup|print_statistics|reset_tuning
+_hash_fn = \<($(_hash_re)) *\(
+_hash_struct = (struct )?\<[Hh]ash_(table|tuning)\>
+sc_prohibit_hash_without_use:
+       @h='"hash.h"' \
+       re='$(_hash_fn)|$(_hash_struct)'\
+         $(_header_without_use)
+
+sc_prohibit_hash_pjw_without_use:
+       @h='"hash-pjw.h"' \
+       re='\<hash_pjw *\(' \
+         $(_header_without_use)
+
 sc_prohibit_safe_read_without_use:
        @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
          $(_header_without_use)
@@ -524,14 +570,20 @@ sc_prohibit_S_IS_definition:
        msg='do not define S_IS* macros; include <sys/stat.h>'          \
          $(_prohibit_regexp)
 
-# Each program that uses proper_name_utf8 must link with
-# one of the ICONV libraries.
+# Each program that uses proper_name_utf8 must link with one of the
+# ICONV libraries.  Otherwise, some ICONV library must appear in LDADD.
+# The perl -0777 invocation below extracts the possibly-multi-line
+# definition of LDADD from the appropriate Makefile.am and exits 0
+# when it contains "ICONV".
 sc_proper_name_utf8_requires_ICONV:
        @progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\
        if test "x$$progs" != x; then                                   \
          fail=0;                                                       \
          for p in $$progs; do                                          \
            dir=$$(dirname "$$p");                                      \
+           perl -0777                                                  \
+             -ne 'exit !(/^LDADD =(.+?[^\\]\n)/ms && $$1 =~ /ICONV/)'  \
+             $$dir/Makefile.am && continue;                            \
            base=$$(basename "$$p" .c);                                 \
            grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \
              || { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
@@ -580,8 +632,12 @@ update-NEWS-hash: NEWS
 # 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.
-sc_makefile_check:
-       @perl -ne '/\@[A-Z_0-9]+\@/ && !/^cu_install_program =/'        \
+# 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) \
          -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}'    \
            $$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$')       \
          && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
@@ -685,6 +741,27 @@ sc_copyright_check:
               exit 1; };                                               \
        fi
 
+# #if HAVE_... will evaluate to false for any non numeric string.
+# That would be flagged by using -Wundef, however gnulib currently
+# tests many undefined macros, and so we can't enable that option.
+# So at least preclude common boolean strings as macro values.
+sc_Wundef_boolean:
+       @grep -Ei '^#define.*(yes|no|true|false)$$' '$(CONFIG_INCLUDE)' && \
+         { echo 'Use 0 or 1 for macro values' 1>&2; exit 1; } || :
+
+sc_vulnerable_makefile_CVE-2009-4029:
+       @files=$$(find $(srcdir) -name Makefile.in);                    \
+       if test -n "$$files"; then                                      \
+         grep -E                                                       \
+           'perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)'     \
+           $$files &&                                                  \
+         { echo '$(ME): the above files are vulnerable; beware of'     \
+           'running "make dist*" rules, and upgrade to fixed automake' \
+           'see http://bugzilla.redhat.com/542609 for details'         \
+               1>&2; exit 1; } || :;                                   \
+       else :;                                                         \
+       fi
+
 vc-diff-check:
        (unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :
        if test -s vc-diffs; then                               \
@@ -728,11 +805,12 @@ announcement: NEWS ChangeLog $(rel-files)
 ftp-gnu = ftp://ftp.gnu.org/gnu
 www-gnu = http://www.gnu.org
 
+upload_dest_dir_ ?= $(PACKAGE)
 emit_upload_commands:
        @echo =====================================
        @echo =====================================
        @echo "$(build_aux)/gnupload $(GNUPLOADFLAGS) \\"
-       @echo "    --to $(gnu_rel_host):$(PACKAGE) \\"
+       @echo "    --to $(gnu_rel_host):$(upload_dest_dir_) \\"
        @echo "  $(rel-files)"
        @echo '# send the ~/announce-$(my_distdir) e-mail'
        @echo =====================================
index 3818e82..f791d57 100644 (file)
--- a/users.txt
+++ b/users.txt
@@ -10,7 +10,7 @@ The following packages appear to be using gnulib and gnulib-tool:
   coreutils       http://git.sv.gnu.org/gitweb/?p=coreutils.git
   cpio            http://cvs.sv.gnu.org/viewcvs/cpio/cpio/
   cvs             http://cvs.sv.gnu.org/viewcvs/cvs/ccvs/
-  diffutils       http://cvs.sv.gnu.org/viewcvs/diffutils/diffutils/
+  diffutils       http://git.sv.gnu.org/cgit/diffutils.git/
   findutils       http://cvs.sv.gnu.org/viewcvs/findutils/findutils/
   gettext         http://cvs.sv.gnu.org/viewcvs/gettext/gettext/
   gnuit           http://www.gnu.org/software/gnuit/
@@ -22,8 +22,9 @@ The following packages appear to be using gnulib and gnulib-tool:
   gsasl           http://git.sv.gnu.org/gitweb/?p=gsasl.git
   gss             http://git.sv.gnu.org/gitweb/?p=gss.git
   gtk-vnc         http://gtk-vnc.codemonkey.ws/hg/outgoing.hg
+  grep            http://git.sv.gnu.org/cgit/grep.git/
   guile           http://cvs.sv.gnu.org/viewvc/guile/guile/guile-core/
-  gzip            http://cvs.sv.gnu.org/viewcvs/gzip/gzip/
+  gzip            http://git.sv.gnu.org/cgit/gzip.git/
   hello           http://cvs.sv.gnu.org/viewcvs/hello/hello/
   icoutils        http://riva.ucam.org/svn/cjwatson/src/debian/icoutils/trunk/icoutils/
   inetutils       http://cvs.sv.gnu.org/viewcvs/inetutils/inetutils/