]> Savannah Git Hosting - gnulib.git/commitdiff
Silence gcc 15 -Wunterminated-string-initialization warnings.
authorBruno Haible <bruno@clisp.org>
Sat, 26 Apr 2025 08:41:43 +0000 (10:41 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 26 Apr 2025 08:41:43 +0000 (10:41 +0200)
* tests/test-gc-arctwo.c (main): Mark arrays as _GL_ATTRIBUTE_NONSTRING.
* tests/test-sf-istream.c (test_open_stream): Likewise.
* tests/test-sfl-istream.c (test_open_stream): Likewise.
* tests/unilbrk/test-u8-possible-linebreaks.c (test_function): Likewise.
* tests/unilbrk/test-u8-width-linebreaks.c (test_function): Likewise.
* tests/unilbrk/test-ulc-possible-linebreaks.c (test_function):
Likewise.
* tests/unilbrk/test-ulc-width-linebreaks.c (test_function): Likewise.
* tests/uniwbrk/test-u8-wordbreaks.c (main): Likewise.
* tests/uniwbrk/test-ulc-wordbreaks.c (main): Likewise.

ChangeLog
tests/test-gc-arctwo.c
tests/test-sf-istream.c
tests/test-sfl-istream.c
tests/unilbrk/test-u8-possible-linebreaks.c
tests/unilbrk/test-u8-width-linebreaks.c
tests/unilbrk/test-ulc-possible-linebreaks.c
tests/unilbrk/test-ulc-width-linebreaks.c
tests/uniwbrk/test-u8-wordbreaks.c
tests/uniwbrk/test-ulc-wordbreaks.c

index e8821c9a3d02f5b5d1c927e854893c77bdfc783b..b7ab0df56b9fdfef75c823ad16c4d71ca2eef537 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2025-04-26  Bruno Haible  <bruno@clisp.org>
+
+       Silence gcc 15 -Wunterminated-string-initialization warnings.
+       * tests/test-gc-arctwo.c (main): Mark arrays as _GL_ATTRIBUTE_NONSTRING.
+       * tests/test-sf-istream.c (test_open_stream): Likewise.
+       * tests/test-sfl-istream.c (test_open_stream): Likewise.
+       * tests/unilbrk/test-u8-possible-linebreaks.c (test_function): Likewise.
+       * tests/unilbrk/test-u8-width-linebreaks.c (test_function): Likewise.
+       * tests/unilbrk/test-ulc-possible-linebreaks.c (test_function):
+       Likewise.
+       * tests/unilbrk/test-ulc-width-linebreaks.c (test_function): Likewise.
+       * tests/uniwbrk/test-u8-wordbreaks.c (main): Likewise.
+       * tests/uniwbrk/test-ulc-wordbreaks.c (main): Likewise.
+
 2025-04-25  Collin Funk  <collin.funk1@gmail.com>
 
        pselect: Disable signature check on AIX.
index 916774637025c6c082a09e3e8df02628ef12f035..6f6d79fb6259cc961d5e520093540f1e040c6ed8 100644 (file)
@@ -27,9 +27,12 @@ main (int argc, char *argv[])
 {
   gc_cipher_handle ctx;
   /* Test vectors from RFC 2268. */
-  static char key[8] = "\xff\xff\xff\xff\xff\xff\xff\xff";
-  static char plaintext[8] = "\xff\xff\xff\xff\xff\xff\xff\xff";
-  static const char ciphertext[8] = "\x27\x8b\x27\xe4\x2e\x2f\x0d\x49";
+  static char key[8] _GL_ATTRIBUTE_NONSTRING =
+    "\xff\xff\xff\xff\xff\xff\xff\xff";
+  static char plaintext[8] _GL_ATTRIBUTE_NONSTRING =
+    "\xff\xff\xff\xff\xff\xff\xff\xff";
+  static const char ciphertext[8] _GL_ATTRIBUTE_NONSTRING =
+    "\x27\x8b\x27\xe4\x2e\x2f\x0d\x49";
   char scratch[16];
   Gc_rc rc;
 
index e3063c34d6aeecdf170c5bad79f770872db16073..74c6203e484726073b9a804399faab1d0ae6cae2 100644 (file)
@@ -66,7 +66,7 @@ test_open_stream (sf_istream_t *stream)
 int
 main ()
 {
-  char const contents[CONTENTS_LEN] = CONTENTS;
+  char const contents[CONTENTS_LEN] _GL_ATTRIBUTE_NONSTRING = CONTENTS;
 
   /* Test reading from a file.  */
   {
index e0e9a02a9e6ce4013aa28a84bfaf7f7183a530c5..bd72952c550b38cc63bfe1c1efb018bc50ec86b0 100644 (file)
@@ -90,7 +90,7 @@ test_open_stream (sfl_istream_t *stream)
 int
 main ()
 {
-  char const contents[CONTENTS_LEN] = CONTENTS;
+  char const contents[CONTENTS_LEN] _GL_ATTRIBUTE_NONSTRING = CONTENTS;
 
   /* Test reading from a file.  */
   {
index d83c1948faf488d650477a0068caa3829892af02..88a0d30ce36d3355a535b625971d012780e1f671 100644 (file)
@@ -32,7 +32,7 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
   my_u8_possible_linebreaks (NULL, 0, "GB18030", NULL);
 
   {
-    static const uint8_t input[91] =
+    static const uint8_t input[91] _GL_ATTRIBUTE_NONSTRING =
       /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
       "Gr\303\274\303\237 Gott. \320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265! x=(-b\302\261sqrt(b\302\262-4ac))/(2a)  \346\227\245\346\234\254\350\252\236,\344\270\255\346\226\207,\355\225\234\352\270\200\n";
 
@@ -77,7 +77,7 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
 
   /* CR LF handling.  */
   {
-    static const uint8_t input[8] = "a\nb\rc\r\nd";
+    static const uint8_t input[8] _GL_ATTRIBUTE_NONSTRING = "a\nb\rc\r\nd";
     char *p = (char *) malloc (SIZEOF (input));
     size_t i;
 
@@ -94,7 +94,7 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
   /* Test that a break is possible after a zero-width space followed by some
      regular spaces (rule LB8 in Unicode TR#14 revision 26).  */
   {
-    static const uint8_t input[6] = "x\342\200\213 y";
+    static const uint8_t input[6] _GL_ATTRIBUTE_NONSTRING = "x\342\200\213 y";
     char *p = (char *) malloc (SIZEOF (input));
     size_t i;
 
@@ -108,7 +108,7 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
 
   /* Test line breaking in a string with HTML markup.  */
   {
-    static const uint8_t input[21] = "<P>Some sentence.</P>";
+    static const uint8_t input[21] _GL_ATTRIBUTE_NONSTRING = "<P>Some sentence.</P>";
     char *p = (char *) malloc (SIZEOF (input));
     size_t i;
 
@@ -123,7 +123,7 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
 
   /* Test line breaking of combining marks.  */
   {
-    static const uint8_t input[24] =
+    static const uint8_t input[24] _GL_ATTRIBUTE_NONSTRING =
       "a\314\200\314\201e\314\200 \314\201o \314\200 o\302\240\314\200\n"
       "\314\200";
     char *p = (char *) malloc (SIZEOF (input));
@@ -141,7 +141,7 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
 
   /* Test line breaking of zero-width joiners (U+200D).  */
   {
-    static const uint8_t input[101] =
+    static const uint8_t input[101] _GL_ATTRIBUTE_NONSTRING =
       "\346\234\211\347\204\241\347\252\256\345\244\232\345\200\213\347\264\240\346\225\270\343\200\202\n" /* "有無窮多個素數。" */
       "\346\234\211\342\200\215\347\204\241\342\200\215\347\252\256\345\244\232\345\200\213\347\264\240\342\200\215\346\225\270\343\200\202\n"
       "\344\275\240\342\200\224\344\270\215\n" /* "你—不" */
@@ -168,7 +168,7 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
 
   /* Test line breaking of regional indicators.  */
   {
-    static const uint8_t input[16] =
+    static const uint8_t input[16] _GL_ATTRIBUTE_NONSTRING =
       "\360\237\207\251\360\237\207\252\360\237\207\253\360\237\207\267";
     char *p = (char *) malloc (SIZEOF (input));
     size_t i;
@@ -184,7 +184,7 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
   /* Test special behaviour of hyphen/break-after character after
      Hebrew letter.  */
   {
-    static const uint8_t input[15] = /* "ab-אב-αβ-ω" */
+    static const uint8_t input[15] _GL_ATTRIBUTE_NONSTRING = /* "ab-אב-αβ-ω" */
       "ab-\327\220\327\221-\316\261\316\262-\317\211";
     char *p = (char *) malloc (SIZEOF (input));
     size_t i;
@@ -200,7 +200,8 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
 
   /* Test special behaviour before East Asian opening parenthesis (LB30).  */
   {
-    static const uint8_t input[49] = /* "日中韓統合漢字拡張G「ユニコード」" */
+    static const uint8_t input[49] _GL_ATTRIBUTE_NONSTRING =
+      /* "日中韓統合漢字拡張G「ユニコード」" */
       "\346\227\245\344\270\255\351\237\223\347\265\261\345\220\210\346\274\242"
       "\345\255\227\346\213\241\345\274\265G\343\200\214\343\203\246"
       "\343\203\213\343\202\263\343\203\274\343\203\211\343\200\215";
@@ -221,7 +222,8 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
 
   /* Test special behaviour of potential future emoji (LB30b).  */
   {
-    static const uint8_t input[8] = "\360\237\277\274\360\237\217\277";
+    static const uint8_t input[8] _GL_ATTRIBUTE_NONSTRING =
+      "\360\237\277\274\360\237\217\277";
     char *p = (char *) malloc (SIZEOF (input));
     size_t i;
 
index e96bd8ff6ccb5ddaa716ef3783d685ec68abe4c5..a9c9378b06d0c5e04d86b38c30f69725f78addfa 100644 (file)
@@ -32,7 +32,7 @@ test_function (int (*my_u8_width_linebreaks) (const uint8_t *, size_t, int, int,
   my_u8_width_linebreaks (NULL, 0, 80, 0, 0, NULL, "GB18030", NULL);
 
   {
-    static const uint8_t input[91] =
+    static const uint8_t input[91] _GL_ATTRIBUTE_NONSTRING =
       /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
       "Gr\303\274\303\237 Gott. \320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265! x=(-b\302\261sqrt(b\302\262-4ac))/(2a)  \346\227\245\346\234\254\350\252\236,\344\270\255\346\226\207,\355\225\234\352\270\200\n";
 
index e0d517aeb67aec31aff3c509be6e577c71ddd9eb..70c572cad62771bc3f32ad5fffc24820f8f28a35 100644 (file)
@@ -33,7 +33,7 @@ test_function (void (*my_ulc_possible_linebreaks) (const char *, size_t, const c
 
 #if HAVE_ICONV
   {
-    static const char input[36] =
+    static const char input[36] _GL_ATTRIBUTE_NONSTRING =
       /* "Grüß Gott. x=(-b±sqrt(b²-4ac))/(2a)" */
       "Gr\374\337 Gott. x=(-b\261sqrt(b\262-4ac))/(2a)\n";
     char *p = (char *) malloc (SIZEOF (input));
@@ -52,7 +52,8 @@ test_function (void (*my_ulc_possible_linebreaks) (const char *, size_t, const c
 
   /* Test line breaking in a string with HTML markup.  */
   {
-    static const char input[21] = "<P>Some sentence.</P>";
+    static const char input[21] _GL_ATTRIBUTE_NONSTRING =
+      "<P>Some sentence.</P>";
     char *p = (char *) malloc (SIZEOF (input));
     size_t i;
 
index bf654d6813845746141336eababa3c763f526623..b9c74b23a4fd3b6635f272fae47de1b5f5b59543 100644 (file)
@@ -33,7 +33,7 @@ test_function (int (*my_ulc_width_linebreaks) (const char *, size_t, int, int, i
 
 #if HAVE_ICONV
   {
-    static const char input[36] =
+    static const char input[36] _GL_ATTRIBUTE_NONSTRING =
       /* "Grüß Gott. x=(-b±sqrt(b²-4ac))/(2a)" */
       "Gr\374\337 Gott. x=(-b\261sqrt(b\262-4ac))/(2a)\n";
     char *p = (char *) malloc (SIZEOF (input));
index b5f489c238bd98d12c3ccb334c5a55519f9574b8..b8d035a9815e3ef588f3c393fd0e7ac8803c7774 100644 (file)
@@ -31,7 +31,7 @@ main ()
   u8_wordbreaks (NULL, 0, NULL);
 
   {
-    static const uint8_t input[91] =
+    static const uint8_t input[91] _GL_ATTRIBUTE_NONSTRING =
       /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
       "Gr\303\274\303\237 Gott. \320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265! x=(-b\302\261sqrt(b\302\262-4ac))/(2a)  \346\227\245\346\234\254\350\252\236,\344\270\255\346\226\207,\355\225\234\352\270\200\n";
     char *p = (char *) malloc (SIZEOF (input));
@@ -58,7 +58,7 @@ main ()
 
   {
     /* Same input string, decomposed.  */
-    static const uint8_t input[106] =
+    static const uint8_t input[106] _GL_ATTRIBUTE_NONSTRING =
       /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
       "Gru\314\210\303\237 Gott. \320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\270\314\206\321\202\320\265! x=(-b\302\261sqrt(b\302\262-4ac))/(2a)  \346\227\245\346\234\254\350\252\236,\344\270\255\346\226\207,\341\204\222\341\205\241\341\206\253\341\204\200\341\205\263\341\206\257\n";
     char *p = (char *) malloc (SIZEOF (input));
@@ -85,7 +85,7 @@ main ()
 
   /* CR LF handling.  */
   {
-    static const uint8_t input[8] = "a\nb\rc\r\nd";
+    static const uint8_t input[8] _GL_ATTRIBUTE_NONSTRING = "a\nb\rc\r\nd";
     char *p = (char *) malloc (SIZEOF (input));
     size_t i;
 
@@ -101,7 +101,7 @@ main ()
 
   /* Test regional indicators.  */
   {
-    static const uint8_t input[18] =
+    static const uint8_t input[18] _GL_ATTRIBUTE_NONSTRING =
       ".\360\237\207\251\360\237\207\252\360\237\207\253\360\237\207\267.";
     char *p = (char *) malloc (SIZEOF (input));
     size_t i;
index 88399174f369ebd87a47e9e2b908da5ef0aa429e..0d95fc383e6ce7820ae299bee6c935fccb482c09 100644 (file)
@@ -37,7 +37,7 @@ main ()
 
 #if HAVE_ICONV
   {
-    static const char input[36] =
+    static const char input[36] _GL_ATTRIBUTE_NONSTRING =
       /* "Grüß Gott. x=(-b±sqrt(b²-4ac))/(2a)" */
       "Gr\374\337 Gott. x=(-b\261sqrt(b\262-4ac))/(2a)\n";
     char *p = (char *) malloc (SIZEOF (input));