+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.
func_module c-strtold
func_module xstrtod
func_module xstrtol
+ func_module xstrtoll
func_module xstrtold
func_end_table
func_begin_table
func_module absolute-header
+ func_module arg-nonnull
func_module config-h
func_module configmake
func_module dummy
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"
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"
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:
#! /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='
'
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.
--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.
# die otherwise.
find_tool ()
{
- # Find sha1sum, named gsha1sum on MacPorts.
find_tool_envvar=$1
shift
find_tool_names=$@
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
cleanup_gnulib() {
status=$?
- rm -fr gnulib
+ rm -fr "$gnulib_path"
exit $status
}
test -f .gitmodules && git config --file .gitmodules "$@"
}
+gnulib_path=`git_modules_config submodule.gnulib.path`
+
# Get gnulib files.
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
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 || {
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\
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\
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:
# 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
| 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-* \
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
#!/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.
#
# 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
# 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.
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).
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;;
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
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
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`
#!/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
# 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:
#!/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
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
#!/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
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.
#!/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
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
#!/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 ...
% 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.
\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
# 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.
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
--- /dev/null
+/* 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
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
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.
@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
@menu
* Introduction::
* Invoking gnulib-tool::
+* Writing modules::
* Miscellaneous Notes::
* POSIX Substitutes Library:: Building as a separate substitutes library.
* Header File Substitutes:: Overriding system headers.
@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
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
@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
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
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.
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
@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
@smallexample
foo.1 : foo.man sedscript
- sed -e sedscript foo.man > foo.1
+ sed -f sedscript foo.man > foo.1
@end smallexample
@noindent
@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
@node DESTDIR
-@section @code{DESTDIR}: support for staged installs
+@section @code{DESTDIR}: Support for Staged Installs
@vindex DESTDIR
@cindex staged installs
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
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
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.
@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))
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/acos.html}
-Gnulib module: ---
+Gnulib module: acos
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/asin.html}
-Gnulib module: ---
+Gnulib module: asin
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/atan.html}
-Gnulib module: ---
+Gnulib module: atan
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/atan2.html}
-Gnulib module: ---
+Gnulib module: atan2
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/cbrt.html}
-Gnulib module: ---
+Gnulib module: cbrt
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/copysign.html}
-Gnulib module: ---
+Gnulib module: copysign
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/cos.html}
-Gnulib module: ---
+Gnulib module: cos
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/cosh.html}
-Gnulib module: ---
+Gnulib module: cosh
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/erf.html}
-Gnulib module: ---
+Gnulib module: erf
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/erfc.html}
-Gnulib module: ---
+Gnulib module: erfc
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/exit.html}
-Gnulib module: exit
+Gnulib module: stdlib
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/exp.html}
-Gnulib module: ---
+Gnulib module: exp
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fabs.html}
-Gnulib module: ---
+Gnulib module: fabs
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fmod.html}
-Gnulib module: ---
+Gnulib module: fmod
Portability problems fixed by Gnulib:
@itemize
@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:
@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:
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
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.
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/hypot.html}
-Gnulib module: ---
+Gnulib module: hypot
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/j0.html}
-Gnulib module: ---
+Gnulib module: j0
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/j1.html}
-Gnulib module: ---
+Gnulib module: j1
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/jn.html}
-Gnulib module: ---
+Gnulib module: jn
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/ldexp.html}
-Gnulib module: ---
+Gnulib module: ldexp
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/lgamma.html}
-Gnulib module: ---
+Gnulib module: lgamma
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log.html}
-Gnulib module: ---
+Gnulib module: log
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log10.html}
-Gnulib module: ---
+Gnulib module: log10
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log1p.html}
-Gnulib module: ---
+Gnulib module: log1p
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/logb.html}
-Gnulib module: ---
+Gnulib module: logb
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/modf.html}
-Gnulib module: ---
+Gnulib module: modf
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/nextafter.html}
-Gnulib module: ---
+Gnulib module: nextafter
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/pow.html}
-Gnulib module: ---
+Gnulib module: pow
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/remainder.html}
-Gnulib module: ---
+Gnulib module: remainder
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/rint.html}
-Gnulib module: ---
+Gnulib module: rint
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sin.html}
-Gnulib module: ---
+Gnulib module: sin
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sinh.html}
-Gnulib module: ---
+Gnulib module: sinh
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sqrt.html}
-Gnulib module: ---
+Gnulib module: sqrt
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/tan.html}
-Gnulib module: ---
+Gnulib module: tan
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/tanh.html}
-Gnulib module: ---
+Gnulib module: tanh
Portability problems fixed by Gnulib:
@itemize
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
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/y0.html}
-Gnulib module: ---
+Gnulib module: y0
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/y1.html}
-Gnulib module: ---
+Gnulib module: y1
Portability problems fixed by Gnulib:
@itemize
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/yn.html}
-Gnulib module: ---
+Gnulib module: yn
Portability problems fixed by Gnulib:
@itemize
@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:
@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
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
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:
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
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
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
# 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]
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
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.
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
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)
# - 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!
# 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.
# - 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
mode=
destdir=
local_gnulib_dir=
+ modcache=true
verbose=0
libname=libgnu
supplied_libname=
--list | --lis )
mode=list
shift ;;
+ --find | --fin | --fi | --f )
+ mode=find
+ shift ;;
--import | --impor | --impo | --imp | --im | --i )
mode=import
shift ;;
--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 ;;
--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 )
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
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
(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
}
# 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
}
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
: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
# 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 ()
}; 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
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
# 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}.
;;
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/.
}'
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
# 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
# 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
# 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
# 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" \
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
# 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
# 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 ()
# 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
# 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
# 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
# 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
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" \
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
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).
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 ="
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; \
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"
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)
# 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 ()
# 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
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" \
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
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).
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 ="
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:"
echo " fi; \\"
echo " done; \\"
echo " :"
- rm -f allsnippets.tmp
+ rm -f "$tmp"/allsnippets
}
# func_emit_initmacro_start macro_prefix
# 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
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
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
# 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 ()
{
# 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`
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
# 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 ()
{
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.
#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
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. */
#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
#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
# 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@
# 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
if (count < 0)
{
- if (errno == ENOSYS || errno == ENOTSUP)
+ if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
{
count = 0;
entries = NULL;
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
*/
#include "trigl.h"
-#ifdef HAVE_SINL
-#include "trigl.c"
-#include "sincosl.c"
-#endif
long double cosl(long double x)
{
#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@
# 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 */
/* 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" {
# 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@
# 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@
# 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@
# 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
#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
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 ();
#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@
#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. */
# 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@
# 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@
# 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
/* 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]))
#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))
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++)
--- /dev/null
+/* 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;
+}
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
#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.
#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
# 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
# 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@
# 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@
# 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@
# 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
#endif
-/* The definition of GL_LINK_WARNING is copied here. */
+/* The definition of _GL_WARN_ON_USE is copied here. */
/* Declare overridden functions. */
# 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
# 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
# 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 */
#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" {
# 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
# 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@
# 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
# 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@
# 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
#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
#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
# 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@
# 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@
# 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
# 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@
# 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@
# 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
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
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
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
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
#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! */
#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
# 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
/* Detect the number of processors.
- Copyright (C) 2009, 2010 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. */
{ /* 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;
}
*tokens_out = tokens;
if (token_lengths != NULL)
*token_lengths = lengths;
+ else
+ free (lengths);
return n_tokens;
}
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
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
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
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;
}
}
}
break;
case OP_PERIOD:
- has_period = true;
- break;
+ has_period = true;
+ break;
case OP_BACK_REF:
case OP_ALT:
case END_OF_RE:
{
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);
}
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;
prev = node;
node = node->parent;
if (!node)
- return REG_NOERROR;
+ return REG_NOERROR;
}
node = node->right;
}
}
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)
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;
}
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;
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:
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)
}
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))
{
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;
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)
}
}
- /* Epsilon closures include itself. */
+ /* An epsilon closure includes itself. */
ok = re_node_set_insert (&eclosure, node);
if (BE (! ok, 0))
return REG_ESPACE;
&& 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)
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))
{
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;
}
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;
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);
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;
/* 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;
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. */
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. */
}
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)
{
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;
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. */
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
{
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;
/* 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;
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)
node = node->parent;
dup_node = dup_node->parent;
if (!node)
- return dup_root;
+ return dup_root;
}
node = node->right;
p_new = &dup_node->right;
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)
{
/* 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)
{
/* 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
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;
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);
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;
/* 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;
}
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;
}
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;
}
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;
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)
{
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;
}
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. */
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)
{
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;
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))
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;
}
}
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;
{
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. */
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. */
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)
{
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)
{
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)
{
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)
{
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)
{
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;
}
#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
}
#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 */
(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,
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;
}
}
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:
}
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;
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)
{
{
err = transit_state_bkref (mctx, &cur_state->nodes);
if (BE (err != REG_NOERROR, 0))
- return err;
+ return err;
}
}
}
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)
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. */
}
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)
{
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)
{
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;
}
}
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)
{
}
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)
{
{
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);
{
struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx;
do
- {
+ {
Idx dst;
int cpos;
if (dst == from_node)
{
if (boundaries & 1)
- return -1;
+ return -1;
else /* if (boundaries & 2) */
- return 0;
+ return 0;
}
cpos =
if (subexp_idx < BITSET_WORD_BITS)
ent->eps_reachable_subexps_map
&= ~((bitset_word_t) 1 << subexp_idx);
- }
+ }
while (ent++->more);
}
break;
}
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)
{
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);
}
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)
{
trtable = state->word_trtable;
if (BE (trtable != NULL, 1))
- {
+ {
unsigned int context;
context
= re_string_context_at (&mctx->input,
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. */
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)
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);
re_dfastate_t *dest_state;
if (!dfa->nodes[cur_node_idx].accept_mb)
- continue;
+ continue;
if (dfa->nodes[cur_node_idx].constraint)
{
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;
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);
}
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)
{
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)
{
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)
{
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)
{
}
#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
bitset_clear (accepts, '\n');
if (dfa->syntax & RE_DOT_NOT_NULL)
bitset_clear (accepts, '\0');
- }
+ }
#endif
else
continue;
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. */
_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]))
/* 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;
/* 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;
*/
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)
{
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
#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" {
# 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
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;
}
#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>
# 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@ */
# 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. */
/* Quad-precision floating point trigonometric functions on <-pi/4,pi/4>.
- Copyright (C) 1999, 2006, 2007, 2009, 2010 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]
*/
#include "trigl.h"
-#include "trigl.c"
-#include "sincosl.c"
long double
sinl (long double x)
# 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@
/* 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 \
# 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@
# 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
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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
# 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@
# 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@
# 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@
# 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@
# 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
#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" {
# 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@
# 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@
# 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
# 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@
# 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@
# 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
#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
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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
# 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@
# 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@
# 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@
# 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
# 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
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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
(result != NULL ? realloc (result, length + 1) : malloc (length + 1));
if (final_result == NULL)
{
- if (result != NULL)
- free (result);
+ free (result);
errno = ENOMEM;
return NULL;
}
#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
#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. */
# 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
# 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). */
# 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
# 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. */
# 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
# 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. */
# 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. */
# 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. */
# 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
# 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
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. */
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.
# 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@
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
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.
# 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@
_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
# 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@
# 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@
# 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
#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" {
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,
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
# 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.
# 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
# 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. */
# 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
#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" {
# 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
# 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. */
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
# 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@
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
#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__
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
/* The definition of _GL_ARG_NONNULL is copied here. */
+/* The definition of _GL_WARN_ON_USE is copied here. */
+
#ifdef __cplusplus
extern "C" {
#endif
};
# 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
# 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
# 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
#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" {
# 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
*/
#include "trigl.h"
-#ifdef HAVE_SINL
-#ifdef HAVE_COSL
-#include "trigl.c"
-#endif
-#endif
/*
* ====================================================
/* 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;
/* Quad-precision floating point argument reduction.
- Copyright (C) 1999, 2007, 2009, 2010 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[] = {
#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);
-
# 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
#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
# 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
# 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
# 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
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
# 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
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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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@
# 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@
# 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
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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
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);
/* 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;
}
/* 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
{
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;
}
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;
}
# 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
#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
@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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
#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
_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)
--- /dev/null
+#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"
--- /dev/null
+#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"
#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
--- /dev/null
+# 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])
+])
-# 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,
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>.
--- /dev/null
+# 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])
+])
--- /dev/null
+# 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])
+])
--- /dev/null
+# 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])
+])
-# 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,
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],
-# 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,
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>.
+++ /dev/null
-# 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.
- :
-])
--- /dev/null
+# 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])
+])
-# 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
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],
-# 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,
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])
-# 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,
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.
-# getline.m4 serial 20
+# getline.m4 serial 21
dnl Copyright (C) 1998-2003, 2005-2007, 2009-2010 Free Software Foundation,
dnl Inc.
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.
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])
--- /dev/null
+# 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
+])
-# 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
[
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.])
])
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.])
-# 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,
[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)'
-# 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,
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.
-# 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,
&& 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
-# 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,
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],
-# 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,
|| 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>.
--- /dev/null
+# 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])
+])
-# 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,
}],
[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
-# 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,
[
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
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],
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])
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])
--- /dev/null
+# 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)])
+])
+++ /dev/null
-# 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)
-
-])
-# 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,
gl_REPLACE_VASNPRINTF
gl_REPLACE_OBSTACK_PRINTF
fi
+ gl_DECL_OBSTACK_PRINTF
])
-# 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,
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],
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
+])
if (!s)
return 1;
+ /* Ensure that [b-a] is diagnosed as invalid. */
+ re_set_syntax (RE_SYNTAX_POSIX_EGREP);
+ memset (®ex, 0, sizeof regex);
+ s = re_compile_pattern ("a[b-a]", 6, ®ex);
+ if (s == 0)
+ return 1;
+
/* This should succeed, but does not for glibc-2.1.3. */
memset (®ex, 0, sizeof regex);
s = re_compile_pattern ("{1", 2, ®ex);
-# round.m4 serial 6
-dnl Copyright (C) 2007, 2009, 2010 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.
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])
])
-# 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,
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
-# roundl.m4 serial 5
-dnl Copyright (C) 2007, 2009, 2010 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.
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
-# 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,
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],
-# 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,
#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],
--- /dev/null
+# 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])
+])
-# 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,
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>.
--- /dev/null
+# 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])
+])
--- /dev/null
+# 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])
+])
-# 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,
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.
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],
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])
-# 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,
# 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],
# 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.
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],
# 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
[
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],
# 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
# Written by Richard W.M. Jones.
-# serial 2
-
AC_DEFUN([gl_HEADER_SYS_FILE_H],
[
AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS])
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],
-# 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,
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>.
-# 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,
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],
-# 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,
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],
-# 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,
[#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],
# 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
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(
[[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])
])
# 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
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],
-# 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,
]])
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],
--- /dev/null
+# 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])
+])
-# 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,
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])
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],
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])
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])
--- /dev/null
+# 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
+])
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.
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
dnl Written by Eric Blake.
-# wchar.m4 serial 30
+# wchar.m4 serial 31
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.
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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
tests/macros.h
Depends-on:
+ignore-value
stdbool
symlink
tests/macros.h
Depends-on:
+ignore-value
stdbool
symlink
tests/macros.h
Depends-on:
+ignore-value
stdbool
symlink
tests/macros.h
Depends-on:
+ignore-value
stdbool
configure.ac:
Makefile.am:
TESTS += test-argp test-argp-2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-argp
test_argp_LDADD = $(LDADD) @LIBINTL@
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@
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
# 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! */'; \
-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 $@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
Makefile.am:
TESTS += test-atexit.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-atexit
Makefile.am:
TESTS += test-binary-io.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-binary-io
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
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
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
tests/macros.h
Depends-on:
+ignore-value
same-inode
symlink
tests/macros.h
Depends-on:
+ignore-value
progname
same-inode
symlink
--- /dev/null
+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
--- /dev/null
+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@
tests/macros.h
Depends-on:
+ignore-value
lstat
mgetgroups
progname
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@
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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
Depends-on:
include_next
-link-warning
+warn-on-use
configure.ac:
gl_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' \
-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 $@
m4/unistd_h.m4
Depends-on:
-include_next
-link-warning
arg-nonnull
+include_next
+warn-on-use
configure.ac:
gl_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' \
-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 $@
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)
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
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
$(LIB_EACCESS)
License:
-LGPL
+LGPLv2+
Maintainer:
Jim Meyering, glibc
test-exclude6.sh\
test-exclude7.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-exclude
test_exclude_LDADD = $(LDADD) @LIBINTL@
Description:
exit() function: program termination.
+Status:
+obsolete
+
+Notice:
+This module is obsolete. It will be removed on 2011-01-01. Use 'stdlib'.
+
Files:
Depends-on:
<stdlib.h>
License:
-GPL
+LGPLv2+
Maintainer:
Bruno Haible
-
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
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
Depends-on:
dup2
fcntl-h
+getdtablesize
extensions
configure.ac:
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
# 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' \
-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 $@
tests/macros.h
Depends-on:
+ignore-value
progname
timespec
usleep
Makefile.am:
TESTS += test-fflush test-fflush2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-fflush test-fflush2
MOSTLYCLEANFILES += test-fflush.txt
--- /dev/null
+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
--- /dev/null
+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@
Makefile.am:
TESTS += test-fpending.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-fpending
MOSTLYCLEANFILES += test-fpending.t
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
Makefile.am:
TESTS += test-freadahead.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-freadahead
Makefile.am:
TESTS += test-freadptr.sh test-freadptr2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-freadptr test-freadptr2
Makefile.am:
TESTS += test-freadseek.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-freadseek
Makefile.am:
TESTS += test-fseek.sh test-fseek2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-fseek
Makefile.am:
TESTS += test-fseeko.sh test-fseeko2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-fseeko
Makefile.am:
TESTS += test-ftell.sh test-ftell2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-ftell
Makefile.am:
TESTS += test-ftello.sh test-ftello2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-ftello
tests/macros.h
Depends-on:
+ignore-value
timespec
usleep
utimecmp
--- /dev/null
+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
--- /dev/null
+Files:
+tests/test-getlogin.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-getlogin
+check_PROGRAMS += test-getlogin
configure.ac:
gl_FUNC_GETTIMEOFDAY
+gl_SYS_TIME_MODULE_INDICATOR([gettimeofday])
Makefile.am:
Makefile.am:
bin_PROGRAMS = git-merge-changelog
-git_merge_changelog_LDADD = libgnu.a @LIBINTL@
+git_merge_changelog_LDADD = libgnu.a @LIBINTL@ $(LIBTHREAD)
Include:
--- /dev/null
+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
--- /dev/null
+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@
Makefile.am:
TESTS += test-idpriv-drop.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-idpriv-drop
Makefile.am:
TESTS += test-idpriv-droptemp.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-idpriv-droptemp
lib_SOURCES += ignore-value.h
Include:
-<ignore-value.h>
+"ignore-value.h"
License:
-LGPL
+LGPLv2+
Maintainer:
Jim Meyering
m4/inttypes.m4
Depends-on:
-include_next
-link-warning
arg-nonnull
+include_next
multiarch
stdint
+warn-on-use
configure.ac:
gl_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' \
-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 $@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
Depends-on:
extensions
include_next
-link-warning
+warn-on-use
configure.ac:
gl_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' \
-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 $@
<langinfo.h>
License:
-LGPL
+LGPLv2+
Maintainer:
Bruno Haible
tests/macros.h
Depends-on:
+ignore-value
mgetgroups
progname
usleep
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
Include:
License:
-GPL
+unlimited
Maintainer:
Paul Eggert and Jim Meyering
tests/macros.h
Depends-on:
+ignore-value
errno
stdbool
sys_stat
tests/macros.h
Depends-on:
+ignore-value
areadlink-with-size
filenamecat
progname
m4/locale_h.m4
Depends-on:
-include_next
arg-nonnull
extensions
-link-warning
+include_next
stddef
+warn-on-use
configure.ac:
gl_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' \
-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 $@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
Makefile.am:
TESTS += test-lseek.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-lseek
tests/macros.h
Depends-on:
+ignore-value
errno
same-inode
stdbool
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
m4/math_h.m4
Depends-on:
-include_next
-link-warning
arg-nonnull
+include_next
+warn-on-use
configure.ac:
gl_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' \
-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' \
-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 $@
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>
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@'
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@'
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@' \
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
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
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
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
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
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
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@' \
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
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
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
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@' \
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
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
tests/macros.h
Depends-on:
+ignore-value
stdbool
symlink
tests/macros.h
Depends-on:
+ignore-value
stdbool
symlink
tests/macros.h
Depends-on:
+ignore-value
symlink
configure.ac:
tests/macros.h
Depends-on:
+ignore-value
stdbool
symlink
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
<langinfo.h>
License:
-LGPL
+LGPLv2+
Maintainer:
Bruno Haible
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
tests/macros.h
Depends-on:
+ignore-value
mgetgroups
pathmax
usleep
Makefile.am:
TESTS += test-parse-duration.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-parse-duration
test_parse_duration_LDADD = $(LDADD) @LIBINTL@
Makefile.am:
TESTS += test-perror.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-perror
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@
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@
Makefile.am:
TESTS += test-pipe.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-pipe
test_pipe_LDADD = $(LDADD) @LIBINTL@
Makefile.am:
TESTS += test-poll
check_PROGRAMS += test-poll
-test_poll_LDADD = $(LDADD) @LIBSOCKET@
+test_poll_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
--- /dev/null
+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
--- /dev/null
+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@
Makefile.am:
TESTS += test-pread.sh
check_PROGRAMS += test-pread
-TESTS_ENVIRONMENT += \
- srcdir='$(srcdir)'
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
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@
tests/macros.h
Depends-on:
+ignore-value
stdbool
symlink
memmove
mbrtowc
mbsinit
+nl_langinfo
stdbool
stdint
ssize_t
--- /dev/null
+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
--- /dev/null
+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@
tests/macros.h
Depends-on:
+ignore-value
symlink
sys_stat
tests/macros.h
Depends-on:
+ignore-value
errno
link
stdbool
tests/macros.h
Depends-on:
+ignore-value
filenamecat
progname
xgetcwd
--- /dev/null
+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
--- /dev/null
+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@
tests/macros.h
Depends-on:
+ignore-value
stdbool
symlink
m4/search_h.m4
Depends-on:
-include_next
-link-warning
arg-nonnull
+include_next
+warn-on-use
configure.ac:
gl_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' \
-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 $@
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@
m4/signal_h.m4
Depends-on:
-include_next
-link-warning
arg-nonnull
+include_next
+warn-on-use
configure.ac:
gl_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' \
-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 $@
Makefile.am:
TESTS += test-sigpipe.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-sigpipe
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
m4/spawn_h.m4
Depends-on:
-include_next
-link-warning
arg-nonnull
+include_next
sched
+warn-on-use
configure.ac:
gl_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' \
-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 $@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
Depends-on:
include_next
-link-warning
arg-nonnull
raise
stddef
+warn-on-use
configure.ac:
gl_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' \
-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' \
-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' \
-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
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
# 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' \
-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 $@
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
# 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' \
-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' \
-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 $@
m4/strings_h.m4
Depends-on:
-include_next
-link-warning
arg-nonnull
+include_next
+warn-on-use
configure.ac:
gl_HEADER_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' \
-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 $@
Makefile.am:
TESTS += test-strsignal
check_PROGRAMS += test-strsignal
-test_strsignal_LDADD = $(LDADD) @LIBINTL@
+test_strsignal_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
tests/macros.h
Depends-on:
+ignore-value
stdbool
configure.ac:
tests/macros.h
Depends-on:
+ignore-value
configure.ac:
Depends-on:
include_next
-link-warning
+warn-on-use
configure.ac:
gl_HEADER_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! */'; \
-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 $@
Depends-on:
include_next
-link-warning
unistd
+warn-on-use
configure.ac:
gl_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! */'; \
-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 $@
Depends-on:
include_next
-link-warning
sys_socket
sys_time
+warn-on-use
configure.ac:
gl_HEADER_SYS_SELECT
# 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! */'; \
-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 $@
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
# 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! */'; \
-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 $@
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
# 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! */'; \
-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 $@
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! */'; \
-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 $@
Depends-on:
arg-nonnull
include_next
-link-warning
+warn-on-use
configure.ac:
gl_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! */'; \
-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 $@
Depends-on:
arg-nonnull
include_next
-link-warning
+warn-on-use
configure.ac:
gl_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! */'; \
-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 $@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
Makefile.am:
TESTS += test-tsearch.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-tsearch
test_tsearch_LDADD = $(LDADD) @TEST_TSEARCH_LIBM@
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@
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
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
tests/macros.h
Depends-on:
+stdbool
unictype/category-test
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@
lib/unistd.in.h
Depends-on:
-include_next
-link-warning
arg-nonnull
+include_next
stddef
+warn-on-use
configure.ac:
gl_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' \
-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' \
-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' \
-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' \
-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
Depends-on:
unistdio/base
-unistdio/u16-sprintf
+unistdio/u16-vsprintf
configure.ac:
Depends-on:
unistdio/base
-unistdio/u16-u16-sprintf
+unistdio/u16-u16-vsprintf
configure.ac:
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@
Depends-on:
unistdio/base
-unistdio/u32-sprintf
+unistdio/u32-vsprintf
configure.ac:
Depends-on:
unistdio/base
-unistdio/u32-u32-sprintf
+unistdio/u32-u32-vsprintf
configure.ac:
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@
Depends-on:
unistdio/base
-unistdio/u8-sprintf
+unistdio/u8-vsprintf
configure.ac:
Depends-on:
unistdio/base
-unistdio/u8-u8-sprintf
+unistdio/u8-u8-vsprintf
configure.ac:
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@
Depends-on:
unistdio/base
-unistdio/ulc-sprintf
+unistdio/ulc-vsprintf
configure.ac:
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@
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
Depends-on:
unistr/base
-unistr/u16-mblen
+unistr/u16-mbtoucr
configure.ac:
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
Depends-on:
unistr/base
+unistr/u16-strmbtouc
configure.ac:
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
Depends-on:
unistr/base
+unistr/u32-strmbtouc
configure.ac:
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
Depends-on:
unistr/base
-unistr/u8-mblen
+unistr/u8-mbtoucr
configure.ac:
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
Depends-on:
unistr/base
+unistr/u8-strmbtouc
configure.ac:
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
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@
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
tests/macros.h
Depends-on:
+ignore-value
stdbool
symlink
unlinkdir
--- /dev/null
+Files:
+tests/test-userspec.c
+
+Depends-on:
+xalloc
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-userspec
+check_PROGRAMS += test-userspec
+test_userspec_LDADD = $(LDADD) @LIBINTL@
tests/macros.h
Depends-on:
+ignore-value
symlink
timespec
usleep
tests/macros.h
Depends-on:
+ignore-value
progname
timespec
usleep
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
Makefile.am:
TESTS += test-vdprintf-posix.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-vdprintf-posix
Makefile.am:
TESTS += test-version-etc.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-version-etc
test_version_etc_LDADD = $(LDADD) @LIBINTL@
Makefile.am:
TESTS += test-vfprintf-posix.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-vfprintf-posix
Makefile.am:
TESTS += test-vprintf-posix.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
check_PROGRAMS += test-vprintf-posix
--- /dev/null
+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
m4/wint_t.m4
Depends-on:
-include_next
-link-warning
arg-nonnull
+include_next
stddef
+warn-on-use
configure.ac:
gl_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' \
-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 $@
Makefile.am:
TESTS += test-wcrtomb.sh
TESTS_ENVIRONMENT += \
- EXEEXT='@EXEEXT@' \
LOCALE_FR='@LOCALE_FR@' \
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
LOCALE_JA='@LOCALE_JA@' \
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@' \
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@' \
Makefile.am:
TESTS += test-xalloc-die.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-xalloc-die
test_xalloc_die_LDADD = $(LDADD) @LIBINTL@
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@
Makefile.am:
TESTS += test-xstrtoimax.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-xstrtoimax
test_xstrtoimax_LDADD = $(LDADD) @LIBINTL@
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@
--- /dev/null
+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
--- /dev/null
+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)
Makefile.am:
TESTS += test-xstrtoumax.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-xstrtoumax
test_xstrtoumax_LDADD = $(LDADD) @LIBINTL@
--- /dev/null
+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
--- /dev/null
+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@
--- /dev/null
+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
--- /dev/null
+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@
Makefile.am:
TESTS += test-yesno.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
check_PROGRAMS += test-yesno
test_yesno_LDADD = $(LDADD) @LIBINTL@
--- /dev/null
+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
--- /dev/null
+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@
# 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.
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
*:*) 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
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
/*
- * 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
/*
- * 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
#include <sys/stat.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-areadlink-with-size.t"
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);
}
#include <sys/stat.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-areadlink.t"
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);
}
#include <sys/stat.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-areadlinkat-with-size.t"
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);
#include <sys/stat.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-areadlinkat.t"
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);
####
# 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
# 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
-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
int test;
int verbose;
char *file;
+ int read;
char *hidden;
int opt;
char *optional;
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 }
};
args->verbose++;
break;
+ case 'r':
+ args->read = 1;
+ /* fall through */
case 'f':
args->file = arg;
break;
"",
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 }
"",
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 }
};
"",
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 }
"",
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)
{
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':
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);
test1, test2, test3, test4,
test5, test6, test7, test8,
test9, test10, test11, test12,
- test13, test14,
+ test13, test14, test15,
NULL
};
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);
}
#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)
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
#include <unistd.h>
#include "same-inode.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "t-can-lgpl.tmp"
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);
#include <unistd.h>
#include "same-inode.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "t-can.tmp"
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);
--- /dev/null
+/* 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;
+}
#include "mgetgroups.h"
#include "stat-time.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-chown.t"
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);
}
#include <unistd.h>
#include "binary-io.h"
+#include "ignore-value.h"
char *program_name;
close (0);
if (argc > 1)
- fread (buf, 1, 6, stdin);
+ ignore_value (fread (buf, 1, 6, stdin));
return 0;
}
/* 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
/* No multithreading available. */
+#include <stdio.h>
+
int
main ()
{
+ fputs ("Skipping test: multithreading not enabled\n", stderr);
return 77;
}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
/*
- * 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
/*
- * 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
/*
- * 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
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
#include "mgetgroups.h"
#include "openat.h"
#include "stat-time.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-fchownat.t"
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);
#include <stdio.h>
#include <stdlib.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-fdutimensat.t"
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);
#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"
--- /dev/null
+/* 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;
+}
#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
#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
#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
#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"
/* 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"
#include "openat.h"
#include "pathmax.h"
#include "same-inode.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-fstatat.t"
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);
#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"
#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
#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"
#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
#include "stat-time.h"
#include "timespec.h"
#include "utimecmp.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-futimens.t"
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);
}
#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
#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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
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");
}
/* 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);
/*
- * 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
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");
}
/* 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);
--- /dev/null
+/* 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;
+}
SIGNATURE_CHECK (getlogin_r, int, (char *, size_t));
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* 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__)
/* 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>
/*
- * 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
#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>
fprintf (stderr, "gettimeofday still clobbers the localtime buffer!\n");
return 1;
}
- else
- {
- return 0;
- }
+ return 0;
}
/*
- * 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
/*
- * 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
/*
- * 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
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
#include "mgetgroups.h"
#include "stat-time.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-lchown.t"
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);
}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
#include <sys/stat.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-link.t"
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);
}
#include "filenamecat.h"
#include "same-inode.h"
#include "xgetcwd.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-linkat.t"
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);
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
#include <unistd.h>
#include "same-inode.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-lstat.t"
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);
}
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
/*
- * 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
#include <stdlib.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-mkdir.t"
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);
}
#include <stdlib.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-mkdirat.t"
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);
#include <stdlib.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-mkfifo.t"
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);
}
#include <string.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-mkfifoat.t"
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);
#include <stdlib.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-mknod.t"
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. */
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
/* 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
#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)
--- /dev/null
+/* 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;
+}
/*
- * 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
/*
- * 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
#include <string.h>
#include <sys/stat.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-readlink.t"
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);
}
--- /dev/null
+/* 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;
+}
#include <sys/stat.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-remove.t"
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);
#include <sys/stat.h>
#include <unistd.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-rename.t"
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);
}
#include "filenamecat.h"
#include "xgetcwd.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-renameat.t"
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);
/*
- * 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
--- /dev/null
+/* 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;
+}
#include <stdlib.h>
#include <sys/stat.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-rmdir.t"
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);
}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
/*
- * 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
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
/*
- * 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
/*
- * 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
/*
- * 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
#include <stdlib.h>
#include <sys/stat.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-symlink.t"
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);
}
#include <string.h>
#include <sys/stat.h>
+#include "ignore-value.h"
#include "macros.h"
#ifndef HAVE_SYMLINK
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);
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
#include <sys/stat.h>
#include "unlinkdir.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-unlink.t"
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);
}
#include <sys/stat.h>
#include "unlinkdir.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-unlinkat.t"
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);
--- /dev/null
+/* 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:
+*/
#include <stdio.h>
#include <stdlib.h>
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-utimens.t"
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);
#include "stat-time.h"
#include "timespec.h"
#include "utimecmp.h"
+#include "ignore-value.h"
#include "macros.h"
#define BASE "test-utimensat.t"
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);
. "${srcdir=.}/init.sh"; path_prepend_ .
-test-xalloc-die 2> err > out
+test-xalloc-die${EXEEXT} 2> err > out
case $? in
1) ;;
*) Exit 1;;
--- /dev/null
+#define __xstrtol xstrtoll
+#define __strtol_t long long int
+#define __spec PRId64
+#include "test-xstrtol.c"
--- /dev/null
+#!/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
--- /dev/null
+#define __xstrtol xstrtoull
+#define __strtol_t unsigned long long int
+#define __spec PRIu64
+#include "test-xstrtol.c"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
/* 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;
}
/* 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");
{
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+ }
+ }
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+ }
+ }
+ }
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+ }
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+ }
+ }
+ }
+}
--- /dev/null
+/* 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);
+ }
+}
--- /dev/null
+/* 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);
+ }
+ }
+ }
+}
--- /dev/null
+/* 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);
+ }
+ }
+ }
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+ }
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+ }
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+ }
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+ }
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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);
+ }
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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"
--- /dev/null
+/* 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"
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
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
# 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))
$(_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)? *\('\
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)
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"; }; \
# 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; } || :
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 \
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 =====================================
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/
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/