The new unilbrk tests produce warnings:

* with gcc -Wall:

../../gltests/unilbrk/test-uc-possible-linebreaks.c:151:69: warning: suggest 
parentheses around '&&' within '||' [-Wparentheses]
../../gltests/unilbrk/test-uc-possible-linebreaks.c:153:72: warning: suggest 
parentheses around '&&' within '||' [-Wparentheses]

* similarly with clang:

../../gltests/unilbrk/test-uc-possible-linebreaks.c:151:69: warning: '&&' 
within '||' [-Wlogical-op-parentheses]
../../gltests/unilbrk/test-uc-possible-linebreaks.c:153:72: warning: '&&' 
within '||' [-Wlogical-op-parentheses]

This patch should fix it.


2024-09-16  Bruno Haible  <br...@clisp.org>

        unilbrk tests: Avoid two gcc -Wparentheses warnings.
        * tests/unilbrk/test-uc-possible-linebreaks.c (main): Add redundant
        parentheses.

diff --git a/tests/unilbrk/test-uc-possible-linebreaks.c 
b/tests/unilbrk/test-uc-possible-linebreaks.c
index cebead6723..31bab9eb15 100644
--- a/tests/unilbrk/test-uc-possible-linebreaks.c
+++ b/tests/unilbrk/test-uc-possible-linebreaks.c
@@ -148,9 +148,9 @@ main (int argc, char *argv[])
                    the space.
                    Similarly when the first two characters at the start of the
                    text have property LBP_CM and LBP_ZWJ, respectively. (LB9). 
 */
-                if (!(((j == 1 || (j > 1 && (input[j - 2] >= 0x000A && input[j 
- 2] <= 0x000D || input[j - 2] == 0x0085)))
+                if (!(((j == 1 || (j > 1 && ((input[j - 2] >= 0x000A && 
input[j - 2] <= 0x000D) || input[j - 2] == 0x0085)))
                        && input[j - 1] == 0x0020)
-                      || ((j == 2 || (j > 2 && (input[j - 3] >= 0x000A && 
input[j - 3] <= 0x000D || input[j - 3] == 0x0085)))
+                      || ((j == 2 || (j > 2 && ((input[j - 3] >= 0x000A && 
input[j - 3] <= 0x000D) || input[j - 3] == 0x0085)))
                           && ((input[j - 2] == 0x0020 && input[j - 1] == 
0x0020)
                               || (input[j - 2] == 0x0308 && input[j - 1] == 
0x200D)
                               || (input[j - 2] == 0x200D && input[j - 1] == 
0x0308)))))




Reply via email to