From 5abcddd7949270998c6e8d99fdbbba821b664f8b Mon Sep 17 00:00:00 2001 From: "Gabriel F. T. Gomes" Date: Thu, 21 Mar 2019 17:24:30 -0300 Subject: Fix parentheses error in iconvconfig.c and ld-collate.c [BZ #24372] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When -Werror=parentheses is in use, iconvconfig.c builds fail with: iconvconfig.c: In function ‘write_output’: iconvconfig.c:1084:34: error: suggest parentheses around ‘+’ inside ‘>>’ [-Werror=parentheses] hash_size = next_prime (nnames + nnames >> 1); ~~~~~~~^~~~~~~~ This patch adds parentheses to the expression. Not where suggested by the compiler warning, but where it produces the expected result, i.e.: where it has the effect of multiplying nnames by 1.5. Likewise for elem_size in ld-collate.c. Tested for powerpc64le. Reviewed-by: Carlos O'Donell --- iconv/iconvconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'iconv/iconvconfig.c') diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c index 1e6066cdf0..f75e46dc16 100644 --- a/iconv/iconvconfig.c +++ b/iconv/iconvconfig.c @@ -1081,7 +1081,7 @@ write_output (void) Creating a perfect hash table is not reasonable here. Therefore we use open hashing and a table size which is the next prime 50% larger than the number of strings. */ - hash_size = next_prime (nnames + nnames >> 1); + hash_size = next_prime (nnames + (nnames >> 1)); hash_table = (struct hash_entry *) xcalloc (hash_size, sizeof (struct hash_entry)); /* Fill the hash table. */ -- cgit 1.4.1