Paul Eggert [Mon, 16 Sep 2024 18:12:24 +0000 (11:12 -0700)]
parse-datetime no longer depends on nstrftime
I discovered this unnecessary dependency when debugging
GNU Patch.
* lib/parse-datetime.y:
(populate_local_time_zone_table) [!HAVE_STRUCT_TM_TM_ZONE]:
(debug_strfdatetime): Use strftime not nstrftime,
as we don’t need nstrftime’s extensions or bug fixes.
* modules/parse-datetime (Depends-on): Remove nstrftime.
Also remove setenv, unsetenv, timegm, as this module
no longer depends on them directly.
Paul Eggert [Mon, 16 Sep 2024 16:45:36 +0000 (09:45 -0700)]
Don’t port July [[...]] changes to C89
Yesterday’s changes to port to C17 and earlier were intrusive,
since they twice replaced one macro with two. Revert the macro
definitions to what they were before yesterday, and instead change
callers so that they always have four arguments even if the last
one is empty. Although this change requires C99 or later, that’s
safe nowadays. Suggested by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-09/msg00079.html
* lib/c++defs.h (_GL_FUNCDECL_RPL, _GL_FUNCDECL_SYS):
Revert yesterday’s changes. All callers changed.
Add comments explaining the required comma before missing attrs.
Paul Eggert [Mon, 16 Sep 2024 04:20:15 +0000 (21:20 -0700)]
Port July changes for [[...]] to C17
The July 30 changes to _GL_FUNCDECL_RPL etc. to support use of
attributes in bracket syntax used a C23 preprocessor feature that is
a common extension to C17 and earlier, but which doesn’t work when
compiled with stricter C17-and-earlier compilers. The feature is
using ‘#define f(a, ...) b’ and calling ‘f’ with only one arg.
Port back to C17 and earlier. Problem discovered with
IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) on cfarm111.
* lib/c++defs.h (_GL_FUNCDECL_RPL): Turn this into two macros
_GL_FUNCDECL_RPL and _GL_FUNCATTR_RPL. The first macro is for
functions without attributes, the second one for functions with
attributes. All uses changed.
(_GL_FUNCDECL_SYS): Likewise, turn this into _GL_FUNCDECL_SYS
and _GL_FUNCATTR_SYS.
Bruno Haible [Sun, 15 Sep 2024 23:05:00 +0000 (01:05 +0200)]
unilbrk: Some more tweaks.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Assign to preceding_prop at each loop round. Assign to prev2_ea,
prev_ea, prev_nus also when a line break was seen.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.
Bruno Haible [Sun, 15 Sep 2024 13:27:34 +0000 (15:27 +0200)]
unilbrk: Strengthen tests.
* lib/gen-uni-tables.c: Add shell commands for creating
tests/unilbrk/LineBreakTest.txt.
* tests/unilbrk/LineBreakTest.txt: New file, from unicode.org.
* tests/unilbrk/test-uc-possible-linebreaks.c: New file, based on
tests/uniwbrk/test-uc-wordbreaks.c.
* tests/unilbrk/test-uc-possible-linebreaks.sh: New file, based on
tests/uniwbrk/test-uc-wordbreaks.sh.
* modules/unilbrk/u32-possible-linebreaks-tests (Files): Add them.
(Makefile.am): Arrange to compile test-uc-possible-linebreaks.c and test
test-uc-possible-linebreaks.sh.
Bruno Haible [Sun, 15 Sep 2024 13:20:08 +0000 (15:20 +0200)]
uniwbrk tests: Modernize code.
* tests/uniwbrk/test-uc-wordbreaks.c (main): Reduce the scope of local
variables. Remove memset() calls. Align expected and actial output
lines. Add comments.
Bruno Haible [Sun, 15 Sep 2024 13:16:52 +0000 (15:16 +0200)]
unigbrk tests: Modernize code.
* tests/unigbrk/test-uc-grapheme-breaks.c (main): Reduce the scope of
local variables. Add comments.
* tests/unigbrk/test-uc-is-grapheme-break.c (main): Likewise.
Bruno Haible [Sun, 15 Sep 2024 13:06:01 +0000 (15:06 +0200)]
unilbrk: Fix conflicts between rules.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Avoid side effect of (LB18) on (LB14) and (LB15a). Avoid side effect
of (LB19a) on (LB18).
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.
Bruno Haible [Sun, 15 Sep 2024 13:00:30 +0000 (15:00 +0200)]
unilbrk: Enable most cases of Unicode rule (LB29).
* lib/gen-uni-tables.c (output_lbrk_rules_as_tables): Enable rule LB29.
* lib/unilbrk/lbrktables.c: Regenerated.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Allow a break between a character with property IS and '<'.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.
Bruno Haible [Sun, 15 Sep 2024 11:23:04 +0000 (13:23 +0200)]
unilbrk: Fully implement Unicode rule (LB9).
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
New variable preceding_prop. Don't copy prop to prev_prop and ea to
prev_ea if the conditions of rule (LB9) apply.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.
Bruno Haible [Sun, 15 Sep 2024 10:59:46 +0000 (12:59 +0200)]
unilbrk: Fix bugs in implementation of Unicode rules (LB15a), (LB15b).
* lib/gen-uni-tables.c (output_lbrk_rules_as_tables): Fix typo in
comment.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Do the LBP_QU2 to LBP_QU1 mapping for (LB15a) after the table lookup but
before the assignment to last_prop. Do the LBP_QU3 to LBP_QU1 mapping
for (LB15b) in a way that does not influence prev_prop or last_prop.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.
Bruno Haible [Sat, 14 Sep 2024 09:56:38 +0000 (11:56 +0200)]
unilbrk/tables: Fix table (regression yesterday).
Reported by Collin Funk <collin.funk1@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-09/msg00061.html>.
* lib/gen-uni-tables.c (output_lbrk_rules_as_tables): Use LBP_AL1 as
array index instead of LBP_AL. Update comments.
* lib/unilbrk/lbrktables.c: Regenerated.
Bruno Haible [Fri, 13 Sep 2024 13:17:49 +0000 (15:17 +0200)]
Update to Unicode 16.0.0.
* lib/gen-uni-tables.c (PROP_MODIFIER_COMBINING_MARK): New enum item.
(fill_properties): Recognize property Modifier_Combining_Mark.
(UC_JOINING_GROUP_KASHMIRI_YEH): New enum item.
(fill_arabicshaping, joining_group_as_c_identifier): Handle
UC_JOINING_GROUP_KASHMIRI_YEH.
(LBP_*): Split LBP_AL into LBP_AL1 and LBP_AL2.
(LBP_AL): New enum item.
(get_lbea): New function.
(get_lbp): Use it. Update such that unilbrk/lbrkprop.txt comes out as
expected. Map U+25CC to LBP_AL2.
(PROP_EA, PROP, EA): New macros.
(debug_output_lbp): Print either LBP_AL1, LBP_AL2 as LBP_AL.
(lbp_value_to_string): Handle LBP_AL1, LBP_AL2 instead of LBP_AL.
(struct lbpea_table): Renamed from struct lbp_table.
(output_lbpea): Renamed from output_lbp. Store both the line break
property and the line break EastAsian bit in the same table entry.
(output_lbrk_tables): Update.
(output_lbrk_rules_as_tables): Update for LBP_AL change. Implement rules
LB28a, LB25, LB19, LB15d, LB13 as specified by
https://www.unicode.org/reports/tr14/tr14-53.html.
(get_wbp): Update such that uniwbrk/wbrkprop.txt comes out as expected.
* lib/unictype.in.h (UC_JOINING_GROUP_KASHMIRI_YEH): New enum item.
* lib/unictype/joininggroup_byname.gperf: Handle it.
* lib/unictype/joininggroup_name.h: Likewise.
* lib/unilbrk/lbrktables.h: Split LBP_AL into LBP_AL1 and LBP_AL2.
(LBP_AKLS_VI): New enum item, for rule LB28a.
(PROP, EA, PROP_EA): New macros.
(unilbrk_table): Update bounds.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Use LBP_AL1 instead of LBP_AL. Use 2 characters of lookahead, for rules
LB15c, LB19a, LB25, LB28a. New variables prev_ea, prev2_ea, for rule
LB19a. New variable prev_initial_hyphen, for rule LB20a. New variable
prev_nus, for rule LB25. Implement rules LB15c, LB19a, LB20a, LB21a,
LB25, LB28a, as specified by
https://www.unicode.org/reports/tr14/tr14-53.html.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.
* modules/unilbrk/base (Depends-on): Add stdbool.
* tests/uninorm/test-u32-normalize-big.h
(struct normalization_test_file): Now 6 parts.
* tests/uninorm/test-u32-normalize-big.c (read_normalization_test_file):
Fill in 6 parts.
(test_specific, free_normalization_test_file): Now handle 6 parts.
* tests/uniwidth/test-uc_width2.sh: Update expected test result.
* All generated files under lib/uni* and tests/uni*: Regenerate.
* tests/uniname/NameAliases.txt: Update.
* tests/uniname/UnicodeData.txt: Update.
* tests/uninorm/NormalizationTest.txt: Update.
* tests/unigbrk/GraphemeBreakTest.txt: Update.
* tests/uniwbrk/WordBreakTest.txt: Update.
* All the affected modules: Bump required libunistring version.
Bruno Haible [Fri, 13 Sep 2024 00:45:37 +0000 (02:45 +0200)]
uninorm/composition: Make more maintainable.
* lib/gen-uni-tables.c (output_composition_tables): Add a filename2
parameter. Emit definitions of UNINORM_COMPOSE_MAX_ARG1 and
UNINORM_COMPOSE_MAX_ARG2 to this file.
(main): Invoke it with additional file name
uninorm/composition-table-bounds.h.
* uninorm/composition-table-bounds.h: New generated file.
* lib/uninorm/composition.c: Include it.
(uc_composition): Use UNINORM_COMPOSE_MAX_ARG1 and
UNINORM_COMPOSE_MAX_ARG2 instead of hardcoded bounds.
Paul Eggert [Fri, 6 Sep 2024 01:31:29 +0000 (18:31 -0700)]
Fix COPYING.EXCEPTION license notices
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00227.html
* m4/std-gnu11.m4: Fix license notice to use COPYING.EXCEPTION
correctly.
* m4/std-gnu23.m4: Likewise. Also document the commit ID,
since Autoconf was updated likewise and we’re copying from there.
Bruno Haible [Wed, 4 Sep 2024 17:38:52 +0000 (19:38 +0200)]
Resolve conflicts for functions introduced in Android API level 35.
Reported by Po Lu <luangruo@yahoo.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-09/msg00024.html>.
* lib/time.in.h (timezone_t, tzalloc, tzfree): Don't require _GNU_SOURCE
to be defined. Define depending on HAVE_TZALLOC, not HAVE_TIMEZONE_T.
(localtime_rz, mktime_z): Likewise. Override if REPLACE_LOCALTIME_RZ or
REPLACE_MKTIME_Z is 1, respectively.
* lib/time_rz.c: If NEED_TIMEZONE_NULL_SUPPORT, define only localtime_rz
and mktime_z and only as wrappers around the system function.
* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z.
* m4/time_rz.m4 (gl_TIME_RZ): Conditionally set HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z. Conditionally define
NEED_TIMEZONE_NULL_SUPPORT.
* modules/time-h (Makefile.am): Substitute HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z.
* modules/time_rz (Depends-on, configure.ac): Consider HAVE_TZALLOC,
REPLACE_LOCALTIME_RZ, REPLACE_MKTIME_Z. Ignore HAVE_TIMEZONE_T.
Bruno Haible [Wed, 4 Sep 2024 08:34:04 +0000 (10:34 +0200)]
Resolve conflicts for functions introduced in Android API level 35.
* m4/strerrorname_np.m4 (gl_FUNC_COPY_FILE_RANGE): Conditionally set
REPLACE_STRERRORNAME_NP.
(gl_CHECK_STRERRORNAME_NP): Test for strerrorname_np using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS.
Bruno Haible [Tue, 3 Sep 2024 21:00:28 +0000 (23:00 +0200)]
tests: Strenghten tests with invalid file descriptor.
* tests/test-close.c: Include <fcntl.h>.
(main): Check that AT_FDCWD is recognized as an invalid file descriptor.
* tests/test-dup.c: Include <fcntl.h>.
(main): Check that AT_FDCWD is recognized as an invalid file descriptor.
* tests/test-unlockpt.c: Include <fcntl.h>.
(main): Check that AT_FDCWD is recognized as an invalid file descriptor.
* tests/test-fchdir.c (main): Likewise.
* tests/test-fdatasync.c (main): Likewise.
* tests/test-fdopendir.c (main): Likewise.
* tests/test-fsync.c (main): Likewise.
* tests/test-isatty.c (main): Likewise.
Bruno Haible [Sun, 1 Sep 2024 11:09:59 +0000 (13:09 +0200)]
Fix mbscasestr test failure on native Windows with MSVC.
* lib/c32to-impl.h (FUNC): On native Windows, ignore the system's
towlower/towupper function entirely.
* tests/test-c32tolower.c (main): On native Windows, reenable test that
previously failed.
* tests/test-c32toupper.c (main): Likewise. Disable two other tests on
native Windows.
* doc/posix-functions/towlower.texi: Mention bug in the native Windows
UTF-8 locale.
* doc/posix-functions/towupper.texi: Likewise.
Bruno Haible [Thu, 29 Aug 2024 16:32:35 +0000 (18:32 +0200)]
gnulib-tool.py: Allow verifying license compatibility with GPLv2+.
* pygnulib/GLInfo.py (GLInfo.usage): Document the --gpl option.
* pygnulib/main.py (main): Accept a --gpl option. Pass it to the
GLConfig.
* pygnulib/GLConfig.py (GLConfig): Add 'gpl' field and constructor
argument. Add getGPL, setGPL, resetGPL methods.
* m4/gnulib-tool.m4 (gl_GPL): New macro.
* doc/gnulib-tool.texi (Modified imports): Document the gl_GPL macro.
* pygnulib/GLImport.py (GLImport.__init__): Look for gl_GPL invocations
in gnulib-cache.m4.
(GLImport.actioncmd): Output --gpl option when option --gpl was given.
(GLImport.gnulib_cache): Emit a gl_GPL invocation when option --gpl was
given.
(GLImport.prepare): Do license compatibility checking when option --gpl
was given.
* pygnulib/GLModuleSystem.py: Update a comment.
* MODULES.html.sh: Mention libgmp-mpz and
libgmp-mpq.
* config/srclist.txt: Mention mini-mpq.c and mini-mpq.h.
* lib/mini-mpq-gnulib.c: New file.
* lib/mini-mpq.c: New upstream source file from
https://gmplib.org/repo/gmp/raw-file/tip/mini-gmp/mini-mpq.c.
* lib/mini-mpq.h: New upstream source file from
https://gmplib.org/repo/gmp/raw-file/tip/mini-gmp/mini-mpq.h.
* modules/libgmp-mpq: New module.
* modules/libgmp-mpz: Conditionally include mini-mpq.h in gmp.h.
* modules/libgmp: Add libgmp-mpq dependency.
Bruno Haible [Wed, 28 Aug 2024 12:16:08 +0000 (14:16 +0200)]
libgmp-mpz: New module, renamed from libgmp.
* modules/libgmp-mpz: Renamed from modules/libgmp.
* modules/libgmp: New file.
* modules/libgmp-mpz-tests: Renamed from modules/libgmp-tests.
* tests/test-libgmp-mpz.c: Renamed from tests/test-libgmp.c.
Paul Eggert [Tue, 27 Aug 2024 21:39:59 +0000 (14:39 -0700)]
savewd: port to native MS-Windows
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00187.html
* lib/savewd.c (fork) [_WIN32 && !__CYGWIN]: New macro.
(savewd_save): Don’t fork on MS-Windows, or if O_SEARCH != O_RDONLY.
Bruno Haible [Tue, 27 Aug 2024 20:28:36 +0000 (22:28 +0200)]
mkdir-p: Don't reference an undefined function on native Windows.
* m4/mkdir-p.m4 (gl_MKDIR_PARENTS): Test whether fchown exists.
* lib/dirchownmod.c (fchown): Define to a fallback if the system does
not have fchown.
(dirchownmod): Test HAVE_FCHOWN.