]> Savannah Git Hosting - gnulib.git/commitdiff
unilbrk: Don't compile unused functions outside of libunistring.
authorBruno Haible <bruno@clisp.org>
Sat, 11 Feb 2023 19:10:21 +0000 (20:10 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 2 Mar 2023 19:56:23 +0000 (20:56 +0100)
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks): Don't
compile outside of libunistring.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks):
Likewise.
* lib/unilbrk/ulc-possible-linebreaks.c (ulc_possible_linebreaks):
Likewise.
* lib/unilbrk/u8-width-linebreaks.c (u8_width_linebreaks): Likewise.
* lib/unilbrk/u16-width-linebreaks.c (u16_width_linebreaks): Likewise.
* lib/unilbrk/u32-width-linebreaks.c (u32_width_linebreaks): Likewise.
* lib/unilbrk/ulc-width-linebreaks.c (ulc_width_linebreaks): Likewise.
* tests/unilbrk/test-u8-possible-linebreaks.c (main): Outside of
libunistring, don't test the backward compatibility function.
* tests/unilbrk/test-u16-possible-linebreaks.c (main): Likewise.
* tests/unilbrk/test-u32-possible-linebreaks.c (main): Likewise.
* tests/unilbrk/test-ulc-possible-linebreaks.c (main): Likewise.
* tests/unilbrk/test-u8-width-linebreaks.c (main): Likewise.
* tests/unilbrk/test-u16-width-linebreaks.c (main): Likewise.
* tests/unilbrk/test-u32-width-linebreaks.c (main): Likewise.
* tests/unilbrk/test-ulc-width-linebreaks.c (main): Likewise.

17 files changed:
ChangeLog
lib/unilbrk/u16-possible-linebreaks.c
lib/unilbrk/u16-width-linebreaks.c
lib/unilbrk/u32-possible-linebreaks.c
lib/unilbrk/u32-width-linebreaks.c
lib/unilbrk/u8-possible-linebreaks.c
lib/unilbrk/u8-width-linebreaks.c
lib/unilbrk/ulc-possible-linebreaks.c
lib/unilbrk/ulc-width-linebreaks.c
tests/unilbrk/test-u16-possible-linebreaks.c
tests/unilbrk/test-u16-width-linebreaks.c
tests/unilbrk/test-u32-possible-linebreaks.c
tests/unilbrk/test-u32-width-linebreaks.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

index d3e6e897ebf77813565ff63c4769b924d9806e20..b1f77bcd2a6da59780b7545698a2bcae07bd318e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2023-02-11  Bruno Haible  <bruno@clisp.org>
+
+       unilbrk: Don't compile unused functions outside of libunistring.
+       * lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks): Don't
+       compile outside of libunistring.
+       * lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks):
+       Likewise.
+       * lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks):
+       Likewise.
+       * lib/unilbrk/ulc-possible-linebreaks.c (ulc_possible_linebreaks):
+       Likewise.
+       * lib/unilbrk/u8-width-linebreaks.c (u8_width_linebreaks): Likewise.
+       * lib/unilbrk/u16-width-linebreaks.c (u16_width_linebreaks): Likewise.
+       * lib/unilbrk/u32-width-linebreaks.c (u32_width_linebreaks): Likewise.
+       * lib/unilbrk/ulc-width-linebreaks.c (ulc_width_linebreaks): Likewise.
+       * tests/unilbrk/test-u8-possible-linebreaks.c (main): Outside of
+       libunistring, don't test the backward compatibility function.
+       * tests/unilbrk/test-u16-possible-linebreaks.c (main): Likewise.
+       * tests/unilbrk/test-u32-possible-linebreaks.c (main): Likewise.
+       * tests/unilbrk/test-ulc-possible-linebreaks.c (main): Likewise.
+       * tests/unilbrk/test-u8-width-linebreaks.c (main): Likewise.
+       * tests/unilbrk/test-u16-width-linebreaks.c (main): Likewise.
+       * tests/unilbrk/test-u32-width-linebreaks.c (main): Likewise.
+       * tests/unilbrk/test-ulc-width-linebreaks.c (main): Likewise.
+
 2023-02-11  Bruno Haible  <bruno@clisp.org>
 
        sigsegv: Fix a compilation error on OpenBSD with clang ≥ 16.
index 75d50efc5a6fee33af3d8b25c841db6b98faa167..bbb236ae4efbf3c7bf53e8d8525151d8de5f9313 100644 (file)
@@ -216,7 +216,10 @@ u16_possible_linebreaks_loop (const uint16_t *s, size_t n, const char *encoding,
     }
 }
 
-#undef u16_possible_linebreaks
+#if defined IN_LIBUNISTRING
+/* For backward compatibility with older versions of libunistring.  */
+
+# undef u16_possible_linebreaks
 
 void
 u16_possible_linebreaks (const uint16_t *s, size_t n, const char *encoding,
@@ -225,6 +228,8 @@ u16_possible_linebreaks (const uint16_t *s, size_t n, const char *encoding,
   u16_possible_linebreaks_loop (s, n, encoding, -1, p);
 }
 
+#endif
+
 void
 u16_possible_linebreaks_v2 (const uint16_t *s, size_t n, const char *encoding,
                             char *p)
index 44d630e7e8d7d01cc7d952dbbf37e2e33ddfebda..9299a86df4ca88bdb0bbe7a47c83652aa3b48491 100644 (file)
@@ -118,7 +118,10 @@ u16_width_linebreaks_internal (const uint16_t *s, size_t n,
   return last_column + piece_width;
 }
 
-#undef u16_width_linebreaks
+#if defined IN_LIBUNISTRING
+/* For backward compatibility with older versions of libunistring.  */
+
+# undef u16_width_linebreaks
 
 int
 u16_width_linebreaks (const uint16_t *s, size_t n,
@@ -131,6 +134,8 @@ u16_width_linebreaks (const uint16_t *s, size_t n,
                                         o, encoding, -1, p);
 }
 
+#endif
+
 int
 u16_width_linebreaks_v2 (const uint16_t *s, size_t n,
                          int width, int start_column, int at_end_columns,
index 37215f12e43a4350d99afd359b5665a67f74b142..762342a7ebe93891f49c3f738111fba6c55e3a99 100644 (file)
@@ -210,7 +210,10 @@ u32_possible_linebreaks_loop (const uint32_t *s, size_t n, const char *encoding,
     }
 }
 
-#undef u32_possible_linebreaks
+#if defined IN_LIBUNISTRING
+/* For backward compatibility with older versions of libunistring.  */
+
+# undef u32_possible_linebreaks
 
 void
 u32_possible_linebreaks (const uint32_t *s, size_t n, const char *encoding,
@@ -219,6 +222,8 @@ u32_possible_linebreaks (const uint32_t *s, size_t n, const char *encoding,
   u32_possible_linebreaks_loop (s, n, encoding, -1, p);
 }
 
+#endif
+
 void
 u32_possible_linebreaks_v2 (const uint32_t *s, size_t n, const char *encoding,
                             char *p)
index 2b22585c8678f587ff4e1d3fe81c0afaf411c491..524e82294d2cc4307425cfd976b22f982d8697e7 100644 (file)
@@ -116,7 +116,10 @@ u32_width_linebreaks_internal (const uint32_t *s, size_t n,
   return last_column + piece_width;
 }
 
-#undef u32_width_linebreaks
+#if defined IN_LIBUNISTRING
+/* For backward compatibility with older versions of libunistring.  */
+
+# undef u32_width_linebreaks
 
 int
 u32_width_linebreaks (const uint32_t *s, size_t n,
@@ -129,6 +132,8 @@ u32_width_linebreaks (const uint32_t *s, size_t n,
                                         o, encoding, -1, p);
 }
 
+#endif
+
 int
 u32_width_linebreaks_v2 (const uint32_t *s, size_t n,
                          int width, int start_column, int at_end_columns,
index be282e0d0366837a48763c13ffe236ff2ba04fa8..1ac1200b3d6e95bdf8bd661ca307fb4877d27224 100644 (file)
@@ -216,7 +216,10 @@ u8_possible_linebreaks_loop (const uint8_t *s, size_t n, const char *encoding,
     }
 }
 
-#undef u8_possible_linebreaks
+#if defined IN_LIBUNISTRING
+/* For backward compatibility with older versions of libunistring.  */
+
+# undef u8_possible_linebreaks
 
 void
 u8_possible_linebreaks (const uint8_t *s, size_t n, const char *encoding,
@@ -225,6 +228,8 @@ u8_possible_linebreaks (const uint8_t *s, size_t n, const char *encoding,
   u8_possible_linebreaks_loop (s, n, encoding, -1, p);
 }
 
+#endif
+
 void
 u8_possible_linebreaks_v2 (const uint8_t *s, size_t n, const char *encoding,
                            char *p)
index 92c061907f090af50c7af47c31c2d2ac672143d8..718e535da4a57808fb4d75a5d2c0a6dee101fc15 100644 (file)
@@ -118,7 +118,10 @@ u8_width_linebreaks_internal (const uint8_t *s, size_t n,
   return last_column + piece_width;
 }
 
-#undef u8_width_linebreaks
+#if defined IN_LIBUNISTRING
+/* For backward compatibility with older versions of libunistring.  */
+
+# undef u8_width_linebreaks
 
 int
 u8_width_linebreaks (const uint8_t *s, size_t n,
@@ -131,6 +134,8 @@ u8_width_linebreaks (const uint8_t *s, size_t n,
                                        o, encoding, -1, p);
 }
 
+#endif
+
 int
 u8_width_linebreaks_v2 (const uint8_t *s, size_t n,
                         int width, int start_column, int at_end_columns,
index 0d180a0ad9aea9e52101ab69aea677341746c58d..8d97e51afe653ecd650f3f8b640245d4e5510583 100644 (file)
@@ -132,7 +132,10 @@ ulc_possible_linebreaks_internal (const char *s, size_t n, const char *encoding,
     }
 }
 
-#undef ulc_possible_linebreaks
+#if defined IN_LIBUNISTRING
+/* For backward compatibility with older versions of libunistring.  */
+
+# undef ulc_possible_linebreaks
 
 void
 ulc_possible_linebreaks (const char *s, size_t n, const char *encoding,
@@ -141,6 +144,8 @@ ulc_possible_linebreaks (const char *s, size_t n, const char *encoding,
   ulc_possible_linebreaks_internal (s, n, encoding, -1, p);
 }
 
+#endif
+
 void
 ulc_possible_linebreaks_v2 (const char *s, size_t n, const char *encoding,
                             char *p)
index 1d44d440b3d9c49604c4a643a067a0865ae798cd..a8e08bc5093b5bfa346db6925257274b673945d2 100644 (file)
@@ -151,7 +151,10 @@ ulc_width_linebreaks_internal (const char *s, size_t n,
   return start_column;
 }
 
-#undef ulc_width_linebreaks
+#if defined IN_LIBUNISTRING
+/* For backward compatibility with older versions of libunistring.  */
+
+# undef ulc_width_linebreaks
 
 int
 ulc_width_linebreaks (const char *s, size_t n,
@@ -164,6 +167,8 @@ ulc_width_linebreaks (const char *s, size_t n,
                                         o, encoding, -1, p);
 }
 
+#endif
+
 int
 ulc_width_linebreaks_v2 (const char *s, size_t n,
                          int width, int start_column, int at_end_columns,
index 63207b58056f6159891ca89933e9495b35e3a442..5d72227350862750b8ab2ee4d620772ca28ea82c 100644 (file)
@@ -255,8 +255,10 @@ int
 main ()
 {
   test_function (u16_possible_linebreaks, 2);
-#undef u16_possible_linebreaks
+#ifdef IN_LIBUNISTRING_GNULIB_TESTS
+# undef u16_possible_linebreaks
   test_function (u16_possible_linebreaks, 1);
+#endif
 
   return 0;
 }
index 3a38419baeb94ab2cd1a30c37f72997b2fc24119..e59e4744b441dbdc66c2ba042becab6122267b75 100644 (file)
@@ -76,8 +76,10 @@ int
 main ()
 {
   test_function (u16_width_linebreaks, 2);
-#undef u16_width_linebreaks
+#ifdef IN_LIBUNISTRING_GNULIB_TESTS
+# undef u16_width_linebreaks
   test_function (u16_width_linebreaks, 1);
+#endif
 
   return 0;
 }
index bb99ec5752d2431f8342f392cf73f65a9472d9f7..203fed0c895420f1220ad242fbae4228f8c7277c 100644 (file)
@@ -255,8 +255,10 @@ int
 main ()
 {
   test_function (u32_possible_linebreaks, 2);
-#undef u32_possible_linebreaks
+#ifdef IN_LIBUNISTRING_GNULIB_TESTS
+# undef u32_possible_linebreaks
   test_function (u32_possible_linebreaks, 1);
+#endif
 
   return 0;
 }
index 79b7222ad7cbf6c1f8b955fbbe21fffe2502fb6d..b64989e895c4ca8f63ca9efe3a096defd9647742 100644 (file)
@@ -76,8 +76,10 @@ int
 main ()
 {
   test_function (u32_width_linebreaks, 2);
-#undef u32_width_linebreaks
+#ifdef IN_LIBUNISTRING_GNULIB_TESTS
+# undef u32_width_linebreaks
   test_function (u32_width_linebreaks, 1);
+#endif
 
   return 0;
 }
index ac0abadc4a322f5f4c5072684a8d3b6b31cbc6fc..a5b533a31acf971df1cd32396ae564c4ddc425ea 100644 (file)
@@ -238,8 +238,10 @@ int
 main ()
 {
   test_function (u8_possible_linebreaks, 2);
-#undef u8_possible_linebreaks
+#ifdef IN_LIBUNISTRING_GNULIB_TESTS
+# undef u8_possible_linebreaks
   test_function (u8_possible_linebreaks, 1);
+#endif
 
   return 0;
 }
index d1d8ae9139c2b2b4698069c74d884248c8e9270e..967d238d8d13ba451c8d8daa0781a2ae04164fc4 100644 (file)
@@ -70,8 +70,10 @@ int
 main ()
 {
   test_function (u8_width_linebreaks, 2);
-#undef u8_width_linebreaks
+#ifdef IN_LIBUNISTRING_GNULIB_TESTS
+# undef u8_width_linebreaks
   test_function (u8_width_linebreaks, 1);
+#endif
 
   return 0;
 }
index 9cd8b0d727435dca97d0a7e6baa81b055e2e7b7e..1d80af10eeb1644ce9d62c716fc314e6b26e3e24 100644 (file)
@@ -71,8 +71,10 @@ int
 main ()
 {
   test_function (ulc_possible_linebreaks, 2);
-#undef ulc_possible_linebreaks
+#ifdef IN_LIBUNISTRING_GNULIB_TESTS
+# undef ulc_possible_linebreaks
   test_function (ulc_possible_linebreaks, 1);
+#endif
 
   return 0;
 }
index e9c4fa23dfad656f5fdeddfa86ad9fd053a91c39..415a96fd44f4542c5cda241f43487168cdb90be7 100644 (file)
@@ -55,8 +55,10 @@ int
 main ()
 {
   test_function (ulc_width_linebreaks, 2);
-#undef ulc_width_linebreaks
+#ifdef IN_LIBUNISTRING_GNULIB_TESTS
+# undef ulc_width_linebreaks
   test_function (ulc_width_linebreaks, 1);
+#endif
 
   return 0;
 }