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