Bruno Haible [Sat, 15 Jul 2017 10:35:57 +0000 (12:35 +0200)]
Fix bug: gettextize does not add intlmacosx.m4 file.
Reported by Eli Zaretskii via Gavin Smith in
<http://lists.gnu.org/archive/html/bug-texinfo/2017-07/msg00026.html>.
* gettext-tools/misc/gettextize.in (m4filelist): Include intlmacosx.m4 also
when --intl option is not given.
* gettext-tools/doc/gettext.texi (aclocal): Add intlmacosx.m4 to file list.
Bruno Haible [Thu, 15 Jun 2017 20:51:11 +0000 (22:51 +0200)]
gettext.h: Update theoretical condition for use of variable size arrays.
Reported by Paul Eggert.
* gnulib-local/lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Extend
comment to include the theoretical condition for availability of variable size
arrays, if we could trust the value of __STDC_VERSION__.
Bruno Haible [Thu, 18 May 2017 23:15:33 +0000 (01:15 +0200)]
Update gettext-runtime files from gnulib.
* Makefile.am (distcheck-hook): Check also flexmember.m4, flexmember.h.
* gettext-runtime/intl/Makefile.in (SOURCES): Add flexmember.h.
* gettext-runtime/intl/flexmember.h: New file, from gnulib.
* gettext-runtime/intl/localcharset.c:
* localcharset.c (relocate2): Define fallback.
(get_charset_aliases): Invoke relocate2 instead of relocate. Free the
allocated memory.
* localcharset.c (WINDOWS_NATIVE): Don't define on Cygwin.
* localcharset.c (locale_charset) [WINDOWS_NATIVE]: Don't use the
return value from setlocale if it would lead to a buffer overrun.
* gettext-runtime/intl/localename.c:
* localename.c [__CYGWIN__]: Include <langinfo.h>, since this is
where NL_LOCALE_NAME is defined.
* localename.c (WINDOWS_NATIVE): Don't define on Cygwin.
* localename.c (gl_locale_name_thread_unsafe): Add clause for
Cygwin.
* localename.c (struct hash_node): Use FLEXIBLE_ARRAY_MEMBER.
* gettext-runtime/intl/lock.c:
* lock.c: On glibc systems without
PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, use the fallback
implementation of rwlocks.
* lock.c [USE_POSIX_THREADS]
(glthread_rwlock_init_for_glibc): New function.
[USE_POSIX_THREADS] (glthread_rwlock_rdlock_multithreaded): Update
comment.
[USE_PTH_THREADS]: New implementation of rwlocks.
[USE_WINDOWS_THREADS] (glthread_rwlock_rdlock_func): Prefer writers over
readers.
* gettext-runtime/intl/lock.h:
* lock.h (pthread_rwlockattr_setkind_np): Don't declare
weak on non-glibc platforms.
* lock.h: On glibc systems without
PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, use the fallback
implementation of rwlocks.
* lock.h [USE_POSIX_THREADS_WEAK]: Declare also
pthread_rwlockattr_init, pthread_rwlockattr_setkind_np,
pthread_rwlockattr_destroy weak.
* lock.h [USE_POSIX_THREADS]: Test
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation
of rwlock initialization on glibc systems without
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation
of rwlocks altogether on non-glibc systems without
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER.
[USE_PTH_THREADS]: Use a different implementation of rwlocks altogether.
* gettext-runtime/intl/relocatable.c:
* relocatable.c (relocate2): New function.
* relocatable.c (relocate): Assume pathname is non-NULL. Use
ISSLASH macro consistently. Avoid dangerous string concatenation idiom.
* gettext-runtime/intl/relocatable.h:
* relocatable.h (relocate2): New declaration/macro.
* gettext-runtime/intl/vasnprintf.c, gettext-runtime/libasprintf/vasnprintf.c:
* vasnprintf.c (FALLTHROUGH): New macro.
Use it whenever one switch case falls through into the next.
* vasnprintf.c (USE_MSVC__SNPRINTF): New macro.
Everywhere, use !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF instead
of !HAVE_SNPRINTF_RETVAL_C99.
* vasnprintf.c (VASNPRINTF): Move comment down past two cpp
directives, so that it takes effect once again. This is clearly
not a proper change, and I will revert it once this bug is fixed:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817
* vasnprintf.c (IF_LINT): Treat GCC_LINT like lint.
* gettext-runtime/intl/verify.h:
* verify.h (verify) [!__GNUC__]:
Use shorter albeit meaningless string to bypass silly compiler limits.
* verify.h (assume): Treat GCC_LINT like lint.
* gettext-runtime/intl/xsize.h: Update.
* gettext-runtime/m4/Makefile.am (EXTRA_DIST): Add flexmember.m4.
* gettext-runtime/m4/extern-inline.m4: Update.
* gettext-runtime/m4/fcntl-o.m4: Update.
* gettext-runtime/m4/flexmember.m4: New file, from gnulib.
* gettext-runtime/m4/glibc2.m4: Update.
* gettext-runtime/m4/glibc21.m4: Update.
* gettext-runtime/m4/intdiv0.m4: Update.
* gettext-runtime/m4/intl.m4 (AM_INTL_SUBDIR): Require AC_C_FLEXIBLE_ARRAY_MEMBER.
* gettext-runtime/m4/intmax.m4: Update.
* gettext-runtime/m4/inttypes-pri.m4: Update.
* gettext-runtime/m4/inttypes_h.m4: Update.
* gettext-runtime/m4/lock.m4 (gl_LOCK): Invoke gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER.
* gettext-runtime/m4/longlong.m4: Update.
* gettext-runtime/m4/printf-posix.m4: Update.
* gettext-runtime/m4/progtest.m4: Update.
* gettext-runtime/m4/size_max.m4: Update.
* gettext-runtime/m4/stdint_h.m4: Update.
* gettext-runtime/m4/threadlib.m4 (gl_THREADLIB_BODY): Don't set
PTHREAD_IN_USE_DETECTION_HARD if configuring on Solaris 10 or newer.
Reported by Peter Felecan at <https://savannah.gnu.org/bugs/?32087>.
* gettext-runtime/m4/uintmax_t.m4: Update.
* gettext-runtime/m4/visibility.m4: Update.
* gettext-runtime/m4/wchar_t.m4: Update.
* gettext-runtime/m4/xsize.m4: Update.
* gettext-runtime/tests/test-lock.c:
* test-lock.c: On Mac OS X, use named semaphores, not unnamed
semaphores.
(USE_NAMED_SEMAPHORE, USE_UNNAMED_SEMAPHORE): New macros.
(atomic_int_semaphore): New macro.
* test-lock.c (USE_SEMAPHORE): Don't set if <semaphore.h> does not
exist.
* test-lock.c (USE_SEMAPHORE): New constant.
(struct atomic_int, init_atomic_int, get_atomic_int_value,
set_atomic_int_value) [USE_SEMAPHORE]: Define using a POSIX semaphore.
Suggested by Torvald Riegel <triegel@redhat.com>.
Bruno Haible [Mon, 15 May 2017 22:27:57 +0000 (00:27 +0200)]
Update after gnulib changed.
* gnulib-local/lib/getopt-core.h.diff: New file.
* gnulib-local/lib/getopt.in.h.diff: Remove file.
* gnulib-local/lib/unistd.in.h.diff: Update.
* gnulib-local/modules/fnmatch.diff: Update.
* gnulib-local/Makefile.am (EXTRA_DIST): Add lib/getopt-core.h.diff. Remove
lib/getopt.in.h.diff.
* gettext-runtime/m4/wint_t.m4: Update from gnulib.
* autogen.sh: In the gnulib-tool invocations, avoid gnulib test modules that
depend on 'hash' (because we use a different 'hash' module).
* .gitignore: Update.
Bruno Haible [Mon, 15 May 2017 16:22:29 +0000 (18:22 +0200)]
Respect the configure option --localedir.
Reported by Markus Gothe at https://savannah.gnu.org/bugs/index.php?49862 .
The AC_SUBSTed variable @localedir@ is supported since Autoconf 2.60.
* gettext-runtime/intl/Makefile.in (localedir): Set to @localedir@. Suggested
by Markus Gothe <nietzsche@lysator.liu.se>.
* gettext-runtime/m4/intldir.m4: Require Autoconf 2.60 or newer.
* gettext-tools/doc/gettext.texi (src/Makefile): Assume Autoconf 2.60 or newer.
Bruno Haible [Fri, 21 Apr 2017 23:40:18 +0000 (01:40 +0200)]
Avoid -Wundef warning in gettext.h.
* gnulib-local/lib/gettext.h: Test the value of ENABLE_NLS only if it is defined.
Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00022.html>.
Bruno Haible [Wed, 19 Apr 2017 10:01:45 +0000 (12:01 +0200)]
PO mode: Fix recognition of C and C++ modes.
The variable 'mode-name' can contain a suffix, see
https://www.gnu.org/software/emacs/manual/html_node/ccmode/Minor-Modes.html
https://www.gnu.org/software/emacs/manual/html_node/emacs/Electric-C.html
Therefore use 'major-mode' instead of 'mode-name'.
* gettext-tools/misc/po-mode.el (po-preset-string-functions): Test major-mode,
not mode-name.
(po-mode-version-string): Bump to 2.25.
Reported at <https://savannah.gnu.org/bugs/index.php?50830>
by Peter Hull <peterhull90@gmail.com>.
Bruno Haible [Mon, 2 Jan 2017 00:00:00 +0000 (01:00 +0100)]
lock test: Fix performance problem on multi-core machines.
* gettext-runtime/tests/test-lock.c (USE_VOLATILE): New macro.
(struct atomic_int): New type.
(init_atomic_int, get_atomic_int_value, set_atomic_int_value): New
functions.
(lock_checker_done, rwlock_checker_done, reclock_checker_done): Define
as 'struct atomic_int'.
(lock_checker_thread, test_lock, rwlock_checker_thread, test_rwlock,
reclock_checker_thread, test_recursive_lock): Use the new functions.
Reported by Eric Blake in
https://www.redhat.com/archives/libvir-list/2012-March/msg00854.html
and by Pádraig Brady in
http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00117.html.
John Darrington [Thu, 15 Dec 2016 20:56:44 +0000 (21:56 +0100)]
msgfmt: Remove POT-Creation-Date field from the header in the output.
This helps reproducible builds.
Reported at <https://savannah.gnu.org/bugs/?49654>.
* gettext-tools/src/msgl-header.h (message_list_delete_header_field): New
declaration.
* gettext-tools/src/msgl-header.c (known_fields): New variable, extracted from
msgdomain_list_set_header_field.
(message_list_delete_header_field): New function.
* gettext-tools/src/write-mo.c: Include msgl-header.h.
(msgdomain_write_mo): Delete the POT-Creation-Date field.
* gettext-tools/src/write-java.c: Include msgl-header.h.
(msgdomain_write_java): Delete the POT-Creation-Date field.
* gettext-tools/src/write-csharp.c: Include msgl-header.h.
(msgdomain_write_csharp): Delete the POT-Creation-Date field.
* gettext-tools/src/write-resources.c: Include msgl-header.h.
(msgdomain_write_csharp_resources): Delete the POT-Creation-Date field.
* gettext-tools/src/write-tcl.c: Include msgl-header.h.
(msgdomain_write_tcl): Delete the POT-Creation-Date field.
* gettext-tools/src/write-qt.c: Include msgl-header.h.
(msgdomain_write_qt): Delete the POT-Creation-Date field.
* gettext-tools/src/write-desktop.c: Include msgl-header.h.
(msgdomain_write_desktop): Delete the POT-Creation-Date field.
* gettext-tools/src/write-xml.c: Include msgl-header.h.
(msgdomain_write_xml): Delete the POT-Creation-Date field.
* gettext-tools/tests/msgfmt-19: New file, based on
gettext-tools/tests/msgfmt-18.
* gettext-tools/tests/Makefile.am (TESTS): Add it.
KO Myung-Hun [Thu, 1 Dec 2016 09:19:56 +0000 (18:19 +0900)]
intl: Fix that /@unixroot prefix is not working on OS/2 kLIBC
OS/2 kLIBC has a feature to rewrite some path components. For example,
'/@unixroot' is replaced with a value of $UNIXROOT if it is.
So prepending a drive letter to the path starting with '/' makes the
path starting with '/@unixroot' to 'x:/@unixroot' which is unexpected.
This will breaks the behavior of some programs depending on /@unixroot
prefix.
* gettext-runtime/intl/bindtextdom.c (BINDTEXTDOMAIN): Do not touch
dirname if it is started with '/@unixroot'.
* gettext-runtime/intl/relocatable.c (relocate): Do not touch pathname
if it is started with '/@unixroot'.
When xgettext was given two *.po files with the same msgid_plural, it
crashed with double-free. Problem reported by Davlet Panech in:
http://lists.gnu.org/archive/html/bug-gettext/2016-09/msg00001.html
* gettext-tools/src/po-gram-gen.y: Don't free msgid_pluralform after
calling do_callback_message, assuming that it takes ownership.
* gettext-tools/src/read-catalog.c (default_add_message): Free
msgid_plural after calling message_alloc.
* gettext-tools/tests/xgettext-po-2: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add new test.
Daiki Ueno [Tue, 9 Aug 2016 07:32:00 +0000 (09:32 +0200)]
gettextize: Don't add config.rpath to EXTRA_DIST
The file is automatically included in the distribution by Automake,
because of an AC_REQUIRE_AUX_FILE invocation. Reported in:
http://savannah.gnu.org/bugs/?48729
* gettext-tools/misc/gettextize.in: Don't add config.rpath to
added_extradist.
Daiki Ueno [Wed, 3 Aug 2016 12:10:13 +0000 (14:10 +0200)]
po-mode: Fix po-send-mail behaviour on Emacs 25
* gettext-tools/misc/po-mode.el (po-send-mail): Don't rely on
region markers.
Reported by Göran Uddeborg in:
http://lists.gnu.org/archive/html/bug-gettext/2016-07/msg00027.html
msgmerge --previous is a very useful feature that makes adjusting of
translation much easier when small changes in the source code are done.
msgmerge supports it for 10 years, but it is not used by most projects,
as Makefile.in.in never added support for it.
Use msgmerge --previous as default on all systems with gettext >= 0.16.
Daiki Ueno [Tue, 31 May 2016 07:05:24 +0000 (16:05 +0900)]
tests: Turn sentence test into a shell script
For consistency with other tests. Also it fixes a test failure when
built with --disable-shared, since LOG_COMPILER set to $(SHELL) doesn't
recognize binary executable.
* gettext-tools/tests/Makefile.am (TESTS): Rename 'sentence' to
'sentence-1'.
(check_PROGRAMS): Rename 'sentence' to 'sentence-1-prg'.
(sentence_1_prg_SOURCES): Rename from 'sentence_SOURCES'.
(sentence_1_prg_CPPFLAGS): Rename from 'sentence_CPPFLAGS'.
(sentence_1_prg_LDADD): Rename from 'sentence_LDADD'.
* gettext-tools/tests/sentence-1: New file.
* gettext-tools/tests/sentence-1-prg.c: Rename from sentence.c, move the
test data to sentence-1.
* gettext-tools/tests/.gitignore: Ignore sentence-1-prg.
Daniel Burr [Sat, 28 May 2016 00:30:00 +0000 (09:30 +0900)]
build: Make libxml2 check tighter
* gnulib-local/m4/libxml.m4 (gl_LIBXML): Try to check
xmlXPathSetContextNode, which is available in libxml2 2.9.1 or later.
Problem reported by Dominyk in:
http://savannah.gnu.org/bugs/?46844
Daiki Ueno [Thu, 26 May 2016 04:38:57 +0000 (13:38 +0900)]
m4: Rely less on internal symbols
* gettext-runtime/m4/gettext.m4 (AM_GNU_GETTEXT): Skip checks for the
internal symbols _nl_msg_cat_cntr, _nl_domain_bindings, and
_nl_expand_alias, if __GNU_GETTEXT_SUPPORTED_REVISION is defined.
Problem reported and fix suggested by Masanori Ogino in:
https://lists.gnu.org/archive/html/bug-gettext/2016-04/msg00000.html
The rationale behind this is: (1) those symbol checks are for detecting
certain broken implementations, namely NetBSD and Solaris 7, and
(2) __GNU_GETTEXT_SUPPORTED_REVISION is not defined in those
implementations, while it is defined on compatible implementations, such
as musl-libc which doesn't have those internal symbols.
Daiki Ueno [Tue, 24 May 2016 03:18:07 +0000 (12:18 +0900)]
intl: Pacify pre-C99 compilers
* gettext-runtime/intl/plural-exp.h (HAVE_STRUCT_INITIALIZER): New
macro, based on the check previously in plural-exp.c. Also add check
for __SUNPRO_C for Solaris Studio C compiler.
(GERMANIC_PLURAL): Define as 'struct expression' not 'const struct
expression' if struct/union initializers are not supported by the
compiler.
* gettext-runtime/intl/plural-exp.c: Use HAVE_STRUCT_INITIALIZER.
Reported by Dagobert Michelsen and investigated by pan7 in:
https://savannah.gnu.org/support/?108743
Daiki Ueno [Mon, 23 May 2016 03:04:23 +0000 (12:04 +0900)]
tests: Add more tests for JavaScript format string
* gettext-tools/tests/format-javascript-1: Add test for multiple uses of
same argument.
* gettext-tools/tests/format-javascript-2: Use proper flag to activate
javascript format checker.
Daiki Ueno [Thu, 19 May 2016 02:02:14 +0000 (11:02 +0900)]
Update gnulib
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Explicitly pull 'gettext',
as the module is now marked as obsolete.
* gnulib-local/Makefile.am (EXTRA_DIST): Remove m4/hard-locale.m4.diff.
* gnulib-local/m4/hard-locale.m4.diff: Remove, as it is no longer
needed.
* gettext-tools/gnulib-lib/.gitignore: Ignore files brought by gnulib-tool.
* gettext-tools/gnulib-tests/.gitignore: Likewise.
* gettext-tools/libgettextpo/.gitignore: Likewise.
Daiki Ueno [Mon, 16 May 2016 08:08:09 +0000 (17:08 +0900)]
msgfmt, xgettext: Respect XDG_DATA_DIRS
Suggested in https://savannah.gnu.org/bugs/?47123
* autogen.sh (GNULIB_MODULES_TOOLS_FOR_SRC): Add 'xmemdup0'.
* gettext-tools/gnulib-lib/.gitignore: Ignore files brought by gnulib-tool.
* gettext-tools/gnulib-tests/.gitignore: Likewise.
* gettext-tools/src/search-path.c: New file.
* gettext-tools/src/search-path.h: New file.
* gettext-tools/src/Makefile.am (noinst_HEADERS): Add search-path.h.
(libgettextsrc_la_SOURCES): Add search-path.c.
* gettext-tools/src/msgfmt.c: Include "search-path.h".
(main): Use get_search_path to locate ITS directories.
* gettext-tools/src/xgettext.c: Include "search-path.h".
(main): Use get_search_path to locate ITS directories.
Daiki Ueno [Wed, 23 Mar 2016 06:17:21 +0000 (15:17 +0900)]
format-python-brace: Support chained expression
* gettext-tools/src/format-python-brace.c (parse_directive): Recognize
chained getattr/getitem expressions.
* gettext-tools/tests/format-python-brace-1: Add test for the case where
both getattr and getitem are used.
Reported by Paul Franklin in:
https://lists.gnu.org/archive/html/bug-gettext/2016-03/msg00017.html
Daiki Ueno [Wed, 23 Mar 2016 01:20:12 +0000 (10:20 +0900)]
doc: Fix ngettext usage example
* gettext-tools/doc/gettext.texi (Plural forms): Fix positional argument
syntax in the C example. Reported by Jonathan Leffler in:
http://lists.gnu.org/archive/html/bug-gettext/2016-03/msg00002.html