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