]> 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 21:00:50 +0000 (22:00 +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 c761045a9426f6db2d73ce8df637e50e895662c3..cad14c387ad7b999b706aa6b6835c3690c79c229 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 2b79d6aae48f4d290fb1c6ea91c6828483a32482..bbb236ae4efbf3c7bf53e8d8525151d8de5f9313 100644 (file)
@@ -1,5 +1,5 @@
 /* Line breaking of UTF-16 strings.
-   Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006-2023 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This file is free software.
@@ -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 fed5282c2ca696220e5924ec136dd512bfc15864..9299a86df4ca88bdb0bbe7a47c83652aa3b48491 100644 (file)
@@ -1,5 +1,5 @@
 /* Line breaking of UTF-16 strings.
-   Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006-2023 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This file is free software.
@@ -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 05fda96ef01c56eb29339e152b5499b15851f551..762342a7ebe93891f49c3f738111fba6c55e3a99 100644 (file)
@@ -1,5 +1,5 @@
 /* Line breaking of UTF-32 strings.
-   Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006-2023 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This file is free software.
@@ -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 554ef9152568042227711360985a973414b29fc4..524e82294d2cc4307425cfd976b22f982d8697e7 100644 (file)
@@ -1,5 +1,5 @@
 /* Line breaking of UTF-32 strings.
-   Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006-2023 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This file is free software.
@@ -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 bc19f8013c778de44d99c2ca7765c2c0bf26b838..1ac1200b3d6e95bdf8bd661ca307fb4877d27224 100644 (file)
@@ -1,5 +1,5 @@
 /* Line breaking of UTF-8 strings.
-   Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006-2023 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This file is free software.
@@ -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 9e11ca87139d72bb634ee3499e062e2b4576cbb5..718e535da4a57808fb4d75a5d2c0a6dee101fc15 100644 (file)
@@ -1,5 +1,5 @@
 /* Line breaking of UTF-8 strings.
-   Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006-2023 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This file is free software.
@@ -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 7b81685efd1510634bd9a30e7acfd3092006dd80..8d97e51afe653ecd650f3f8b640245d4e5510583 100644 (file)
@@ -1,5 +1,5 @@
 /* Line breaking of strings.
-   Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006-2023 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This file is free software.
@@ -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 dc72306c7eb171728c636144aa99c2c77937e67e..a8e08bc5093b5bfa346db6925257274b673945d2 100644 (file)
@@ -1,5 +1,5 @@
 /* Line breaking of strings.
-   Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006-2023 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    This file is free software.
@@ -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 0156d455aa672facbb53d0a37dece13072bee841..5d72227350862750b8ab2ee4d620772ca28ea82c 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of line breaking of UTF-16 strings.
-   Copyright (C) 2008-2022 Free Software Foundation, Inc.
+   Copyright (C) 2008-2023 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -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 c96054479b14214c579f41c0a20e587e3ac8574c..e59e4744b441dbdc66c2ba042becab6122267b75 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of line breaking of UTF-16 strings.
-   Copyright (C) 2008-2022 Free Software Foundation, Inc.
+   Copyright (C) 2008-2023 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -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 5c08c974efbee9173878f5f7e015f40f14deb577..203fed0c895420f1220ad242fbae4228f8c7277c 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of line breaking of UTF-32 strings.
-   Copyright (C) 2008-2022 Free Software Foundation, Inc.
+   Copyright (C) 2008-2023 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -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 fa9c09b6735ba3a1dfe4b906c6dbdf43328ad0df..b64989e895c4ca8f63ca9efe3a096defd9647742 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of line breaking of UTF-32 strings.
-   Copyright (C) 2008-2022 Free Software Foundation, Inc.
+   Copyright (C) 2008-2023 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -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 37f27067fbf5ccdb3cc0ab14db0b2bd418fec15e..a5b533a31acf971df1cd32396ae564c4ddc425ea 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of line breaking of UTF-8 strings.
-   Copyright (C) 2008-2022 Free Software Foundation, Inc.
+   Copyright (C) 2008-2023 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -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 e955235075af1d20ba21cbdea5166ed784c5ac39..967d238d8d13ba451c8d8daa0781a2ae04164fc4 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of line breaking of UTF-8 strings.
-   Copyright (C) 2008-2022 Free Software Foundation, Inc.
+   Copyright (C) 2008-2023 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -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 e6859277ea4fdca1cf43d4d6f0aa0e872a48b33f..1d80af10eeb1644ce9d62c716fc314e6b26e3e24 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of line breaking of strings.
-   Copyright (C) 2008-2022 Free Software Foundation, Inc.
+   Copyright (C) 2008-2023 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -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 0fffe3ae1092fa1ed66549141cd5bd13555ddcaf..415a96fd44f4542c5cda241f43487168cdb90be7 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of line breaking of strings.
-   Copyright (C) 2008-2022 Free Software Foundation, Inc.
+   Copyright (C) 2008-2023 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -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;
 }