summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2016-11-26 01:05:14 +0100
committerBruno Haible <bruno@clisp.org>2016-11-26 01:05:14 +0100
commitb3356507ce8a6e2636fcc22abb7965989f7f4d07 (patch)
treef05bdf8862f8a6a05ecb06cffe2d78d5e8b79481
parentefd1fd8439a8db873e9c0ef207dcd5467b7cfc14 (diff)
downloadgperf-b3356507ce8a6e2636fcc22abb7965989f7f4d07.tar.gz
Avoid 'warning: implicit conversion changes signedness' in output code.
-rw-r--r--ChangeLog8
-rw-r--r--src/output.cc6
-rw-r--r--tests/c-parse.exp2
-rw-r--r--tests/charsets.exp2
-rw-r--r--tests/chill.exp2
-rw-r--r--tests/cplusplus.exp2
-rw-r--r--tests/java.exp2
-rw-r--r--tests/languages.exp2
-rw-r--r--tests/modula2.exp2
-rw-r--r--tests/objc.exp2
10 files changed, 20 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 24aba54..f1a2d60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-11-26 Bruno Haible <bruno@clisp.org>
+
+ Avoid 'warning: implicit conversion changes signedness' in output code.
+ * src/output.cc (Output::output_hash_function): Emit declaration of
+ 'hval' as 'unsigned int', not 'int'.
+ * tests/*.exp: Update.
+ Reported at <https://savannah.gnu.org/bugs/?44887>.
+
2016-11-25 Bruno Haible <bruno@clisp.org>
Fix g++ -Wall warnings.
diff --git a/src/output.cc b/src/output.cc
index 9661ce0..d01687c 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -1,5 +1,5 @@
/* Output routines.
- Copyright (C) 1989-1998, 2000, 2002-2004, 2006-2007, 2009, 2011-2012 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000, 2002-2004, 2006-2007, 2009, 2011-2012, 2016 Free Software Foundation, Inc.
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
and Bruno Haible <bruno@clisp.org>.
@@ -906,7 +906,9 @@ Output::output_hash_function () const
else
{
/* We've got to use the correct, but brute force, technique. */
- printf (" register int hval = %s;\n\n"
+ /* It doesn't really matter whether hval is an 'int' or
+ 'unsigned int', but 'unsigned int' gives fewer warnings. */
+ printf (" register unsigned int hval = %s;\n\n"
" switch (%s)\n"
" {\n"
" default:\n",
diff --git a/tests/c-parse.exp b/tests/c-parse.exp
index d370941..1efb61b 100644
--- a/tests/c-parse.exp
+++ b/tests/c-parse.exp
@@ -80,7 +80,7 @@ hash (str, len)
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126
};
- register int hval = len;
+ register unsigned int hval = len;
switch (hval)
{
diff --git a/tests/charsets.exp b/tests/charsets.exp
index ccbd078..560af1b 100644
--- a/tests/charsets.exp
+++ b/tests/charsets.exp
@@ -87,7 +87,7 @@ hash (register const char *str, register unsigned int len)
5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046,
5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046, 5046
};
- register int hval = len;
+ register unsigned int hval = len;
switch (hval)
{
diff --git a/tests/chill.exp b/tests/chill.exp
index 7007f4d..401b6b8 100644
--- a/tests/chill.exp
+++ b/tests/chill.exp
@@ -78,7 +78,7 @@ hash (str, len)
1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
1050, 1050, 1050, 1050, 1050, 1050, 1050
};
- register int hval = len;
+ register unsigned int hval = len;
switch (hval)
{
diff --git a/tests/cplusplus.exp b/tests/cplusplus.exp
index 29bca4d..c28cf61 100644
--- a/tests/cplusplus.exp
+++ b/tests/cplusplus.exp
@@ -80,7 +80,7 @@ hash (str, len)
164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
164, 164, 164, 164, 164, 164
};
- register int hval = len;
+ register unsigned int hval = len;
switch (hval)
{
diff --git a/tests/java.exp b/tests/java.exp
index 90ad5a3..b7b0fed 100644
--- a/tests/java.exp
+++ b/tests/java.exp
@@ -104,7 +104,7 @@ hash (str, len)
77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
77, 77, 77, 77, 77, 77
};
- register int hval = len;
+ register unsigned int hval = len;
switch (hval)
{
diff --git a/tests/languages.exp b/tests/languages.exp
index 3abe0fc..6e7cfe5 100644
--- a/tests/languages.exp
+++ b/tests/languages.exp
@@ -91,7 +91,7 @@ hash (register const char *str, register unsigned int len)
3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861, 3861,
3861, 3861, 3861, 3861, 3861
};
- register int hval = len;
+ register unsigned int hval = len;
switch (hval)
{
diff --git a/tests/modula2.exp b/tests/modula2.exp
index 50f1c48..c6c8806 100644
--- a/tests/modula2.exp
+++ b/tests/modula2.exp
@@ -75,7 +75,7 @@ hash (register const char *str, register unsigned int len)
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156
};
- register int hval = 0;
+ register unsigned int hval = 0;
switch (len)
{
diff --git a/tests/objc.exp b/tests/objc.exp
index 21be290..363346f 100644
--- a/tests/objc.exp
+++ b/tests/objc.exp
@@ -78,7 +78,7 @@ hash (register const char *str, register unsigned int len)
96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96
};
- register int hval = len;
+ register unsigned int hval = len;
switch (hval)
{