Collin Funk [Fri, 1 Mar 2024 02:37:53 +0000 (18:37 -0800)]
gnulib-tool.py: Fix GNU Make conversion regular expressions.
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Reduce code
duplication. Use re.MULTILINE so '^' matches the start of each line
instead of only the start of a string.
Collin Funk [Thu, 29 Feb 2024 03:05:16 +0000 (19:05 -0800)]
gnulib-tool.py: Follow gnulib-tool changes, part 33.
Follow gnulib-tool change
2017-03-14 Bruno Haible <bruno@clisp.org>
gnulib-tool: Don't produce a tests directory with only snippet .h files.
* pygnulib/GLModuleSystem.py
(GLModuleTable.transitive_closure_separately): Don't create a test
directory if all test related modules have applicability 'all'.
Collin Funk [Wed, 28 Feb 2024 21:12:05 +0000 (13:12 -0800)]
gnulib-tool.py: Emit year range on file copyright notices.
* pygnulib/GLInfo.py (GLInfo.copyright_range): New function. Return a
copyright string with a year range.
* pygnulib/GLEmiter.py (GLEmiter.copyright_notice): Use the new function
for file copyright headers.
Collin Funk [Wed, 28 Feb 2024 11:33:15 +0000 (03:33 -0800)]
gnulib-tool.py: Make module sorting more similar to gnulib-tool.
* pygnulib/GLImport.py (GLImport.__init__): Sort modules when mode is
'import'.
(GLImport.actioncmd): Don't sort modules while creating actioncmd. Use
preferred quoting style.
Bruno Haible [Wed, 28 Feb 2024 10:52:33 +0000 (11:52 +0100)]
gnulib-tool: Make --version output independent of git's configuration.
Reported by Collin Funk <collin.funk1@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-02/msg00268.html>.
* pygnulib/GLInfo.py (GLInfo.date): Pass --format and --date options, to
override the user's git configuration.
* gnulib-tool (func_version): Likewise. Also pass options '-n 1', to
speed up the operation.
Bruno Haible [Wed, 28 Feb 2024 10:38:00 +0000 (11:38 +0100)]
gnulib-tool.py: Avoid exception when 'git log' output is unexpected.
* pygnulib/GLInfo.py (GLInfo.date): When the 'git log' output does not
contain a line with the expected 'Date:' pattern, pass the empty string
to GNU date.
Collin Funk [Tue, 27 Feb 2024 05:22:23 +0000 (21:22 -0800)]
gnulib-tool.py: Follow gnulib-tool changes, part 29.
Follow gnulib-tool change
2021-03-06 Paul Eggert <eggert@cs.ucla.edu>
parse-datetime2: fix licensing
* pygnulib/GLModuleSystem.py (GLModule.getLicense): Handle the special
licensing case for parse-datetime2 or any other module starting with
"parse-datetime". Update comment.
Bruno Haible [Mon, 26 Feb 2024 22:44:01 +0000 (23:44 +0100)]
gnulib-tool.py: Reorganize code.
* pygnulib/main.py: New file, moved here from gnulib-tool.py.
* pygnulib/constants.py: Change the way APP['name'] and DIRS['root'] are
computed.
* gnulib-tool.py: New file, based on gnulib-tool.
Bruno Haible [Sun, 25 Feb 2024 15:12:57 +0000 (16:12 +0100)]
bitset: Don't access errno when it's not set.
* lib/bitset/stats.c (bitset_stats_read): Don't use errno after neither
fread() nor ferror() has set it. On native Windows, don't use errno
after fclose().
Bruno Haible [Sun, 25 Feb 2024 14:48:47 +0000 (15:48 +0100)]
bitset: Avoid newlines at the end of translatable strings.
* lib/bitset/stats.c (bitset_percent_histogram_print,
bitset_log_histogram_print): Print a newline after msg.
(bitset_stats_print_1): Don't include a newline in the argument of
bitset_percent_histogram_print or bitset_log_histogram_print.
(bitset_stats_print): Move newlines outside of translatable strings.
Collin Funk [Sat, 24 Feb 2024 04:52:15 +0000 (20:52 -0800)]
gnulib-tool.py: Follow gnulib-tool changes, part 28.
Follow gnulib-tool change
2018-07-17 Paul Eggert <eggert@cs.ucla.edu>
gnulib-tool: limit line length for git send-email
* pygnulib/GLImport.py (GLImport.actioncmd): Break actioncmd into
multiple lines. Reorder emitting of arguments to match gnulib-tool. Emit
"--witness-c-macro" instead of "--witness_c_macro". Emit "--po-domain"
instead of "--podomain". Document ordering of unimplemented options. Add
updated comments documenting line length limitations of git send-email
and some implementations of AWK.
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Remove comment which
was moved to pygnulib/GLImport.py. Remove length limitation on actioncmd
since it now spans multiple lines.
Bruno Haible [Fri, 23 Feb 2024 17:34:08 +0000 (18:34 +0100)]
unictype/mirror: Update to Unicode 15.1.0.
Reported by Daurnimator <quae@daurnimator.com> in
<https://lists.gnu.org/archive/html/bug-libunistring/2016-11/msg00010.html>.
* lib/gen-uni-tables.c (struct mirror_pair): New type.
(mirror_pairs): Don't initialize statically.
(mirror_pairs_count): New variable.
(fill_mirror): New function.
(get_mirror_value): Update.
(main): Expect the file name of BidiMirroring.txt as command-line
argument. Invoke fill_mirror.
* lib/unictype/mirror.h: Regenerated.
Collin Funk [Fri, 23 Feb 2024 04:16:18 +0000 (20:16 -0800)]
gnulib-tool.py: Follow gnulib-tool changes, part 27.
Follow gnulib-tool changes
2017-03-12 Paul Eggert <eggert@cs.ucla.edu>
gnulib-tool: new option --gnu-make
2017-03-13 Paul Eggert <eggert@cs.ucla.edu>
gnulib-tool: minor --gnu-make fixups
2017-03-14 Paul Eggert <eggert@cs.ucla.edu>
gnulib-tool: fix typo in comment output
2017-05-14 Paul Eggert <eggert@cs.ucla.edu>
gnulib-tool: improve GNU Make debugging
2018-07-04 Paul Eggert <eggert@cs.ucla.edu>
gnulib-tool: minor tweaks for --gnu-make
* gnulib-tool.py (main): Add --gnu-make option. Do not allow --gnu-make
in test modes, since they all require Automake.
* pygnulib/GLConfig.py: Add gnu_make argument to constructor.
(getGnuMake, setGnuMake, resetGnuMake): New methods for accessing the
gnu_make instance variable.
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Use the "+=" operator
with GNU Make and Automake. Transform conditionals to GNU Make syntax if
--gnu-make is in use. Use a Autoconf subprocess to define values and
check the return code for errors.
(GLEmiter.tests_Makefile_am): Likewise.
* pygnulib/GLImport.py (GLImport.actioncmd): Add "--gnu-make" to the
output comment if it is in use.
(GLImport.gnulib_comp): Don't require "AM_PROG_CC_C_O" when using GNU
Make.
* pygnulib/GLInfo.py (GLInfo.usage): Update help message to reflect
addition of --gnu-make.
* pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure): Don't
add Automake snippets as unconditional dependencies when using
--gnu-make.
Bruno Haible [Fri, 23 Feb 2024 12:07:48 +0000 (13:07 +0100)]
unistdio/*printf tests: Update expected test results regarding %n.
* tests/unistdio/test-u8-printf1.h (test_xfunction): If
NEED_PRINTF_WITH_N_DIRECTIVE is not defined, expect a NULL result in the
%n test.
* tests/unistdio/test-u16-printf1.h (test_xfunction): Likewise.
* tests/unistdio/test-u32-printf1.h (test_xfunction): Likewise.
* tests/unistdio/test-ulc-printf1.h (test_xfunction): Likewise.
Collin Funk [Thu, 22 Feb 2024 19:27:42 +0000 (11:27 -0800)]
gnulib-tool.py: Follow gnulib-tool changes, part 26.
Follow gnulib-tool change
2017-04-20 Bruno Haible <bruno@clisp.org>
verify tests: Fix spurious failure with parallel make.
* pygnulib/GLEmiter.py (GLEmiter.tests_Makefile_am): Emit initialization
of EXTRA_PROGRAMS so that the verify-tests module does not cause
Automake to warn about the use of "+=" instead of "=".
Bruno Haible [Thu, 22 Feb 2024 00:52:05 +0000 (01:52 +0100)]
c-strtof: New module.
* lib/c-strtod.h (c_strtof): New declaration.
* lib/c-strtod.c: Support FLOAT.
* lib/c-strtof.c: New file.
* m4/c-strtod.m4 (gl_C_STRTOF): New macro.
* modules/c-strtof: New file.
Bruno Haible [Thu, 22 Feb 2024 00:27:30 +0000 (01:27 +0100)]
strtof: Add tests.
* tests/test-strtof.c: New file, based on tests/test-strtod.c.
* tests/test-strtof1.sh: New file, based on tests/test-strtod1.sh.
* tests/test-strtof1.c: New file, based on tests/test-strtod1.c.
* modules/strtof-tests: New file, based on modules/strtod-tests.
Bruno Haible [Wed, 21 Feb 2024 21:45:47 +0000 (22:45 +0100)]
strtof: New module.
* lib/stdlib.in.h (strtof): New declaration.
* lib/strtod.c: Support USE_FLOAT.
* lib/strtof.c: New file.
* m4/strtof.m4: New file, based on m4/strtod.m4.
* m4/ldexpf.m4 (gl_CHECK_LDEXPF_NO_LIBM): New macro, based on
m4/ldexp.m4.
* m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STRTOF.
* modules/stdlib (Makefile.am): Substitute GNULIB_STRTOF, HAVE_STRTOF,
REPLACE_STRTOF.
* modules/strtof: New file.
* tests/test-stdlib-c++.cc (strtof): Check signature.
* doc/posix-functions/strtof.texi: Mention the new module and the bugs
that it fixes.
(gl_STDLIB_H_DEFAULTS): Initialize HAVE_STRTOF, REPLACE_STRTOF.
Collin Funk [Wed, 21 Feb 2024 16:54:51 +0000 (08:54 -0800)]
gnulib-tool.py: Fix undefined variable while emitting testdir.
* pygnulib/GLTestDir.py (GLTestDir.execute): Fix undefined
variable refrence caused by commit 01cd78f9d682ff75cc5ab1c2d21b911bdd9215b8.
Restore the previous auxdir when finished writing the
configure.ac file in the test directory.
Bruno Haible [Wed, 21 Feb 2024 14:49:23 +0000 (15:49 +0100)]
*printf-posix: Disable support for the 'n' directive by default.
* m4/printf-with-n-directive.m4: New file.
* modules/printf-with-n-directive: New file.
* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): If
gl_PRINTF_SUPPORT_N_DIRECTIVE is not defined, ignore the value of the
gl_cv_func_printf_directive_n variable.
* m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise.
* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_IS_POSIX): Likewise.
* m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_IS_POSIX): Likewise.
* m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): Likewise.
* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Likewise.
* m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_IS_POSIX): Likewise.
* m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_IS_POSIX): Likewise.
* m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise.
* m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): If
gl_PRINTF_SUPPORT_N_DIRECTIVE is not defined, ignore the values of the
gl_cv_func_printf_directive_n and gl_cv_func_snprintf_directive_n
variables.
* m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise.
* lib/printf-parse.c (PRINTF_PARSE): If NEED_PRINTF_WITH_N_DIRECTIVE is
not defined, treat the 'n' directive like an unknown directive.
* lib/vasnprintf.c (VASNPRINTF): If NEED_PRINTF_WITH_N_DIRECTIVE is not
defined, disable the processing of the 'n' directive.
* tests/test-snprintf-posix.h (test_function): If
NEED_PRINTF_WITH_N_DIRECTIVE is not defined, skip the %n test.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnprintf-posix.c (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* doc/posix-functions/dprintf.texi: Mention that support for the 'n'
directive is only enabled together with the module
'printf-with-n-directive'.
* doc/posix-functions/fprintf.texi: Likewise.
* doc/posix-functions/printf.texi: Likewise.
* doc/posix-functions/snprintf.texi: Likewise.
* doc/posix-functions/sprintf.texi: Likewise.
* doc/posix-functions/vdprintf.texi: Likewise.
* doc/posix-functions/vfprintf.texi: Likewise.
* doc/posix-functions/vprintf.texi: Likewise.
* doc/posix-functions/vsnprintf.texi: Likewise.
* doc/posix-functions/vsprintf.texi: Likewise.
* doc/glibc-functions/obstack_printf.texi: Likewise.
* doc/glibc-functions/obstack_vprintf.texi: Likewise.
* NEWS: Mention the change.
Bruno Haible [Tue, 20 Feb 2024 23:59:05 +0000 (00:59 +0100)]
unimetadata/u-version: New module.
* lib/gen-uni-tables.c (output_version): New function.
(main): Invoke it.
* lib/unimetadata/u-version.c: New generated file.
* modules/unimetadata/u-version: New file.
Jim Meyering [Mon, 19 Feb 2024 04:23:28 +0000 (20:23 -0800)]
maint.mk: improve new syntax-check rule
* top/maint.mk (sc_prefer_angle_bracket_headers): Rename from
sc_verify_absolute_include_headers. Simplify to run a single
invocation of grep, rather than usually many. Derive a regular
expression matching the selected headers, and warn about any
offending matches via what is usually a single grep invocation.
Collin Funk [Mon, 19 Feb 2024 00:52:45 +0000 (16:52 -0800)]
gnulib-tool.py: Fix function call on incorrect object.
* pygnulib/GLImport.py: Call checkInclTestCategory on the
GLConfig member instead of the GLImport object itself.
* pygnulib/__init__.py: Update copyright dates.
* pygnulib/constants.py: Update copyright dates.
Bruno Haible [Thu, 15 Feb 2024 19:47:28 +0000 (20:47 +0100)]
localename-unsafe-limited: New module.
* m4/localename.m4 (gl_LOCALENAME_UNSAFE_LIMITED): New macro.
* modules/localename-unsafe-limited: New file.
* modules/localename-unsafe (Depends-on): Add localename-unsafe-limited.
(Makefile.am): Compile localename-unsafe.c only if the module
localename-unsafe-limited does not already do it.
Bruno Haible [Thu, 15 Feb 2024 08:47:08 +0000 (09:47 +0100)]
setlocale-null: Refactor.
* lib/setlocale_null.c
(setlocale_null_r_with_lock): Renamed from setlocale_null_with_lock.
(setlocale_null_r_unlocked): Renamed from setlocale_null_unlocked.
(setlocale_null_unlocked): Renamed from setlocale_null_androidfix.
Bruno Haible [Thu, 15 Feb 2024 18:23:25 +0000 (19:23 +0100)]
localename-unsafe: New module.
* lib/localename.h (gl_locale_name_unsafe, gl_locale_name_thread_unsafe,
gl_locale_name_posix_unsafe): New declarations.
* lib/localename-unsafe.c: New file, based on lib/localename.c.
(gl_locale_name_thread_unsafe): Renamed from gl_locale_name_thread.
(gl_locale_name_posix_unsafe): Renamed from gl_locale_name_posix.
(gl_locale_name_unsafe): Renamed from gl_locale_name.
(struniq): Define only on platforms that need it.
* lib/localename.c: Remove code that was moved to
lib/localename-unsafe.c.
(gl_locale_name_thread): Just call gl_locale_name_thread_unsafe and
struniq.
(gl_locale_name_posix): Just call gl_locale_name_posix_unsafe and
struniq.
* lib/locale.in.h: Test @GNULIB_LOCALENAME_UNSAFE@ instead of
@GNULIB_LOCALENAME@.
* m4/locale_h.m4 (gl_LOCALE_H_REQUIRE_DEFAULTS): Initialize
GNULIB_LOCALENAME_UNSAFE instead of GNULIB_LOCALENAME.
* modules/locale (Makefile.am): Substitute GNULIB_LOCALENAME_UNSAFE
instead of GNULIB_LOCALENAME.
* m4/localename.m4 (gl_LOCALENAME_UNSAFE): Renamed from gl_LOCALENAME.
* modules/localename-unsafe: New file, based on modules/localename.
* modules/localename: Greatly simplify.
(Depends-on): Add localename-unsafe.
Bruno Haible [Thu, 15 Feb 2024 15:00:59 +0000 (16:00 +0100)]
localename: Speed up lookup of the LC_MESSAGES name on AIX ≥ 7.2.
* m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): On AIX, test
for the 'locale_name' member.
* lib/localename.c (get_locale_t_name): For the LC_MESSAGES category,
use the 'locale_name' member if available.
Bruno Haible [Thu, 15 Feb 2024 09:48:50 +0000 (10:48 +0100)]
localename: Add parameter validation.
* lib/localename.c (get_locale_t_name, gl_locale_name_thread_unsafe,
gl_locale_name_thread, gl_locale_name_posix, gl_locale_name): Verify
that the category argument is not LC_ALL.
Bruno Haible [Wed, 14 Feb 2024 22:16:15 +0000 (23:16 +0100)]
Improve support of Citrus/FreeBSD iconv.
* lib/striconveh.c (iconveh_open): Use //TRANSLIT with all iconv
implementations that support it.
* lib/striconveha.c (mem_iconveha, str_iconveha): Likewise.
* lib/propername.c (proper_name_utf8): Likewise.
Paul Eggert [Wed, 14 Feb 2024 06:29:27 +0000 (22:29 -0800)]
nstrftime: allow opt-out of AM/PM adjustment
For Emacs I would rather avoid bringing in the Gnulib locking code,
since Emacs has its own idea about locks and its main engine is
single-threaded anyway.
Provide a way to use the nstrftime module while avoiding its
recently-added localename dependency, which entails locking code.
(It’s not clear to me that the locking code is needed for nstrftime,
as NetBSD has strftime_z and Solaris locales could be inspected in
some thread-safe way, e.g., by probing strftime month names.
Anyway, all that’s more hassle than I want to put up with right now
for the trivial matter of AM/PM behavior.)
* lib/strftime.c (REQUIRE_GNUISH_STRFTIME_AM_PM):
New macro, which can be overridden by config.h.
(should_remove_ampm, __strftime_internal):
Use it instead of !USE_C_LOCALE when deciding to
implement Gnuish AM/PM behavior.
* m4/pthread_mutex_timedlock.m4 (gl_FUNC_PTHREAD_MUTEX_TIMEDLOCK): Pass
a pointer of the correct type to pthread_mutex_timedlock.
* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Pass a pointer of the correct
type to pthread_spin_init.
Bruno Haible [Sun, 11 Feb 2024 10:23:14 +0000 (11:23 +0100)]
time_r: Add tests.
* lib/time_r.c: Add comment.
* tests/test-gmtime_r.c: New file.
* tests/test-gmtime_r-mt.c: New file, based on
tests/test-nl_langinfo-mt.c.
* tests/test-localtime_r.c: New file.
* tests/test-localtime_r-mt.c: New file, based on
tests/test-nl_langinfo-mt.c.
* modules/time_r-tests: New file.
Paul Eggert [Sun, 11 Feb 2024 01:53:34 +0000 (17:53 -0800)]
doc: improve warnings about ctime etc.
* doc/posix-functions/asctime.texi (asctime):
* doc/posix-functions/asctime_r.texi (asctime_r):
Say why these functions are typically used mistakenly.
* doc/posix-functions/ctime.texi (ctime):
* doc/posix-functions/ctime_r.texi (ctimef):
Say that they can dump core due to an internal null pointer, too.
* doc/posix-functions/ctime.texi (ctime):
Don’t recommend ctime_r.
Bruno Haible [Fri, 9 Feb 2024 19:42:53 +0000 (20:42 +0100)]
ctime, localtime, tzset, wcsftime: Make multithread-safe.
* lib/ctime.c: Include <wchar.h>.
(rpl_ctime): Modify _environ and _wenviron without using _putenv.
* lib/localtime.c: Include <wchar.h>.
(rpl_localtime): Modify _environ and _wenviron without using _putenv.
* lib/tzset.c: Include <wchar.h>.
(rpl_tzset): Modify _environ and _wenviron without using _putenv.
* lib/wcsftime.c (rpl_wcsftime): Likewise.
Bruno Haible [Thu, 8 Feb 2024 14:34:34 +0000 (15:34 +0100)]
nstrtime: Fix %p, %P, %r directives' results on NetBSD, Solaris.
* lib/strftime.c: Include <locale.h>, localename.h.
(should_remove_ampm): New function.
(__strftime_internal): On NetBSD and Solaris, remove the AM/PM indicator
from the %p, %r directives' results in specific locales.
* modules/nstrftime (Depends-on): Add localename.
* tests/test-nstrftime.h (locales_test): Update the expected result of
the %r directive.
* doc/posix-functions/strftime.texi: Mention the problem of the %p and
%r directives on NetBSD and Solaris.
Bruno Haible [Thu, 8 Feb 2024 00:24:12 +0000 (01:24 +0100)]
c-nstrftime: Add tests.
* tests/test-c-nstrftime.c: New file, based on tests/test-nstrftime.c.
* tests/test-c-nstrftime-1.sh: New file, based on
tests/test-nstrftime-1.sh.
* tests/test-c-nstrftime-2.sh: New file, based on
tests/test-nstrftime-2.sh.
* modules/c-nstrftime-tests: New file.
Bruno Haible [Thu, 8 Feb 2024 00:09:08 +0000 (01:09 +0100)]
c-nstrftime: New module.
Suggested by Paul Eggert.
* lib/strftime.h (c_nstrftime): New declaration.
* lib/c-nstrftime.c: New file.
* lib/strftime.c (FPRINTFTIME): Move fallback definition before its
first use.
(USE_C_LOCALE): Add fallback definition.
If USE_C_LOCALE is set, include c-ctype.h instead of <ctype.h>.
Conditionally include <locale.h>.
(TOUPPER, TOLOWER): Define differently if USE_C_LOCALE is set.
(c_locale_cache, c_locale): New definitions, copied from lib/c-strtod.c.
(c_weekday_names, c_month_names): New variables, based on
glibc/time/strftime_l.c.
(__strftime_internal): Define a_wkday, aw_len, f_wkday, a_month, am_len,
f_month, ampm, ap_len differently for USE_C_LOCALE. Avoid a
'goto underlying_strftime' if USE_C_LOCALE && !HAVE_STRFTIME_L. Make the
strftime fallback declaration ISO C 23 compliant. If USE_C_LOCALE, use
strftime_l() with the C locale object instead of strftime().
* m4/c-nstrftime.m4: New file, based on m4/nstrftime.m4.
* modules/c-nstrftime: New file, based on modules/nstrftime.