In libunistring, I see these -Wunterminated-string-initialization warnings:
uninorm/composition-table.gperf:100:8: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (7 chars into 6 available) uninorm/composition-table.gperf:101:8: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (7 chars into 6 available) ... uninorm/composition-table.gperf:99:8: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (7 chars into 6 available) The third patch in this patch series fixes them. 2025-05-11 Bruno Haible <br...@clisp.org> Silence some more gcc 15 -Wunterminated-string-initialization warnings. * lib/uninorm/composition.c (struct composition_rule): Mark codes[] as nonstring. * lib/gen-uni-tables.c (output_composition_tables): Emit the same 'struct composition_rule' definition. * lib/uninorm/composition-table.gperf: Regenerated. 2025-05-11 Bruno Haible <br...@clisp.org> gen-uni-tables: Fix logic mistake (regression 2025-01-03). * lib/gen-uni-tables.c (is_property_composite): Fix mistake. 2025-05-11 Bruno Haible <br...@clisp.org> gen-uni-tables: Fix compilation error (regression 2025-01-03). * lib/gen-uni-tables.c (str_startswith): New function, from lib/str_startswith.c. (str_endswith): New function, from lib/str_endswith.c.
>From 1b473d18cfdb65cea359f1d59cf1d3a61c226b3b Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sun, 11 May 2025 23:50:45 +0200 Subject: [PATCH 1/3] gen-uni-tables: Fix compilation error (regression 2025-01-03). * lib/gen-uni-tables.c (str_startswith): New function, from lib/str_startswith.c. (str_endswith): New function, from lib/str_endswith.c. --- ChangeLog | 7 +++++++ lib/gen-uni-tables.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index 07a138a83f..68de92510f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-05-11 Bruno Haible <br...@clisp.org> + + gen-uni-tables: Fix compilation error (regression 2025-01-03). + * lib/gen-uni-tables.c (str_startswith): New function, from + lib/str_startswith.c. + (str_endswith): New function, from lib/str_endswith.c. + 2025-05-11 Bruno Haible <br...@clisp.org> HACKING: Add documentation regarding link dependencies. diff --git a/lib/gen-uni-tables.c b/lib/gen-uni-tables.c index 2bac68c2da..9f4496e20f 100644 --- a/lib/gen-uni-tables.c +++ b/lib/gen-uni-tables.c @@ -51,6 +51,24 @@ /* ========================================================================= */ +/* Utility functions. */ + +static bool +str_startswith (const char *string, const char *prefix) +{ + return strncmp (string, prefix, strlen (prefix)) == 0; +} + +static bool +str_endswith (const char *string, const char *suffix) +{ + size_t len = strlen (string); + size_t n = strlen (suffix); + return len >= n && strcmp (string + len - n, suffix) == 0; +} + +/* ========================================================================= */ + /* Reading UnicodeData.txt. */ /* See UCD.html. */ -- 2.43.0
>From 2e33b5623e6b577d98f9c3b1120c66721ce27dbb Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Mon, 12 May 2025 00:49:32 +0200 Subject: [PATCH 2/3] gen-uni-tables: Fix logic mistake (regression 2025-01-03). * lib/gen-uni-tables.c (is_property_composite): Fix mistake. --- ChangeLog | 5 +++++ lib/gen-uni-tables.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 68de92510f..b50176b56c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-05-11 Bruno Haible <br...@clisp.org> + + gen-uni-tables: Fix logic mistake (regression 2025-01-03). + * lib/gen-uni-tables.c (is_property_composite): Fix mistake. + 2025-05-11 Bruno Haible <br...@clisp.org> gen-uni-tables: Fix compilation error (regression 2025-01-03). diff --git a/lib/gen-uni-tables.c b/lib/gen-uni-tables.c index 9f4496e20f..865c83c04d 100644 --- a/lib/gen-uni-tables.c +++ b/lib/gen-uni-tables.c @@ -3901,7 +3901,7 @@ is_property_composite (unsigned int ch) if (decomp[0] == ' ') decomp++; } - return strchr (decomp, ' ') != NULL && str_startswith (decomp, "0020 "); + return strchr (decomp, ' ') != NULL && !str_startswith (decomp, "0020 "); } return false; } -- 2.43.0
>From 781b2d7081b76c5d92f0e13ae5b14b2b642aa551 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Mon, 12 May 2025 00:42:33 +0200 Subject: [PATCH 3/3] Silence some more gcc 15 -Wunterminated-string-initialization warnings. * lib/uninorm/composition.c (struct composition_rule): Mark codes[] as nonstring. * lib/gen-uni-tables.c (output_composition_tables): Emit the same 'struct composition_rule' definition. * lib/uninorm/composition-table.gperf: Regenerated. --- ChangeLog | 9 +++++++++ lib/gen-uni-tables.c | 2 +- lib/uninorm/composition-table.gperf | 4 ++-- lib/uninorm/composition.c | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b50176b56c..ef83781888 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2025-05-11 Bruno Haible <br...@clisp.org> + + Silence some more gcc 15 -Wunterminated-string-initialization warnings. + * lib/uninorm/composition.c (struct composition_rule): Mark codes[] as + nonstring. + * lib/gen-uni-tables.c (output_composition_tables): Emit the same + 'struct composition_rule' definition. + * lib/uninorm/composition-table.gperf: Regenerated. + 2025-05-11 Bruno Haible <br...@clisp.org> gen-uni-tables: Fix logic mistake (regression 2025-01-03). diff --git a/lib/gen-uni-tables.c b/lib/gen-uni-tables.c index 865c83c04d..af6f33f17e 100644 --- a/lib/gen-uni-tables.c +++ b/lib/gen-uni-tables.c @@ -10930,7 +10930,7 @@ output_composition_tables (const char *filename, const char *filename2, 1527, which is quite good (60% filled). It requires an auxiliary table lookup in a table of size 0.5 KB. The total tables size is 11 KB. */ - fprintf (stream, "struct composition_rule { char codes[6]; };\n"); + fprintf (stream, "struct composition_rule { char codes[6] _GL_ATTRIBUTE_NONSTRING; unsigned int combined; };\n"); fprintf (stream, "%%struct-type\n"); fprintf (stream, "%%language=ANSI-C\n"); fprintf (stream, "%%define slot-name codes\n"); diff --git a/lib/uninorm/composition-table.gperf b/lib/uninorm/composition-table.gperf index db4c7519ed..b613035d50 100644 --- a/lib/uninorm/composition-table.gperf +++ b/lib/uninorm/composition-table.gperf @@ -2,7 +2,7 @@ /* Canonical composition of Unicode characters. */ /* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ -/* Copyright (C) 2009-2024 Free Software Foundation, Inc. +/* Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -struct composition_rule { char codes[6]; }; +struct composition_rule { char codes[6] _GL_ATTRIBUTE_NONSTRING; unsigned int combined; }; %struct-type %language=ANSI-C %define slot-name codes diff --git a/lib/uninorm/composition.c b/lib/uninorm/composition.c index c01fa029f0..d9a302beab 100644 --- a/lib/uninorm/composition.c +++ b/lib/uninorm/composition.c @@ -22,7 +22,7 @@ #include <string.h> -struct composition_rule { char codes[6]; unsigned int combined; }; +struct composition_rule { char codes[6] _GL_ATTRIBUTE_NONSTRING; unsigned int combined; }; #include "composition-table.h" #include "composition-table-bounds.h" -- 2.43.0