9832fd
commit 5abcddd7949270998c6e8d99fdbbba821b664f8b
9832fd
Author: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
9832fd
Date:   Thu Mar 21 17:24:30 2019 -0300
9832fd
9832fd
    Fix parentheses error in iconvconfig.c and ld-collate.c [BZ #24372]
9832fd
    
9832fd
    When -Werror=parentheses is in use, iconvconfig.c builds fail with:
9832fd
    
9832fd
      iconvconfig.c: In function ‘write_output’:
9832fd
      iconvconfig.c:1084:34: error: suggest parentheses around ‘+’ inside ‘>>’ [-Werror=parentheses]
9832fd
         hash_size = next_prime (nnames + nnames >> 1);
9832fd
                                 ~~~~~~~^~~~~~~~
9832fd
    
9832fd
    This patch adds parentheses to the expression.  Not where suggested by
9832fd
    the compiler warning, but where it produces the expected result, i.e.:
9832fd
    where it has the effect of multiplying nnames by 1.5.
9832fd
    
9832fd
    Likewise for elem_size in ld-collate.c.
9832fd
    
9832fd
    Tested for powerpc64le.
9832fd
    
9832fd
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
9832fd
index 1e6066c..f75e46d 100644
9832fd
--- a/iconv/iconvconfig.c
9832fd
+++ b/iconv/iconvconfig.c
9832fd
@@ -1081,7 +1081,7 @@ write_output (void)
9832fd
      Creating a perfect hash table is not reasonable here.  Therefore
9832fd
      we use open hashing and a table size which is the next prime 50%
9832fd
      larger than the number of strings.  */
9832fd
-  hash_size = next_prime (nnames + nnames >> 1);
9832fd
+  hash_size = next_prime (nnames + (nnames >> 1));
9832fd
   hash_table = (struct hash_entry *) xcalloc (hash_size,
9832fd
 					      sizeof (struct hash_entry));
9832fd
   /* Fill the hash table.  */
9832fd
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
9832fd
index 19b23c2..6baab6c 100644
9832fd
--- a/locale/programs/ld-collate.c
9832fd
+++ b/locale/programs/ld-collate.c
9832fd
@@ -2402,7 +2402,7 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
9832fd
       runp = runp->next;
9832fd
     }
9832fd
   /* Add 50% and find the next prime number.  */
9832fd
-  elem_size = next_prime (elem_size + elem_size >> 1);
9832fd
+  elem_size = next_prime (elem_size + (elem_size >> 1));
9832fd
 
9832fd
   /* Allocate the table.  Each entry consists of two words: the hash
9832fd
      value and an index in a secondary table which provides the index