1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Avoid 'warning: implicit conversion changes signedness' in output code.

This commit is contained in:
Bruno Haible
2016-11-26 01:05:14 +01:00
parent efd1fd8439
commit b3356507ce
10 changed files with 20 additions and 10 deletions

View File

@@ -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> 2016-11-25 Bruno Haible <bruno@clisp.org>
Fix g++ -Wall warnings. Fix g++ -Wall warnings.

View File

@@ -1,5 +1,5 @@
/* Output routines. /* 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> Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
and Bruno Haible <bruno@clisp.org>. and Bruno Haible <bruno@clisp.org>.
@@ -906,7 +906,9 @@ Output::output_hash_function () const
else else
{ {
/* We've got to use the correct, but brute force, technique. */ /* 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" " switch (%s)\n"
" {\n" " {\n"
" default:\n", " default:\n",

View File

@@ -80,7 +80,7 @@ hash (str, len)
126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 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) switch (hval)
{ {

View File

@@ -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, 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) switch (hval)
{ {

View File

@@ -78,7 +78,7 @@ hash (str, len)
1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 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) switch (hval)
{ {

View File

@@ -80,7 +80,7 @@ hash (str, len)
164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 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) switch (hval)
{ {

View File

@@ -104,7 +104,7 @@ hash (str, len)
77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 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) switch (hval)
{ {

View File

@@ -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, 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) switch (hval)
{ {

View File

@@ -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, 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) switch (len)
{ {

View File

@@ -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, 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) switch (hval)
{ {