mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 21:19:24 +00:00
Avoid 'warning: implicit conversion changes signedness' in output code.
This commit is contained in:
@@ -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_lookup_function_body): Emit declaration
|
||||||
|
of 'key' as 'unsigned int', not 'int'. Optimize comparison accordingly.
|
||||||
|
* tests/*.exp: Update.
|
||||||
|
Reported at <https://savannah.gnu.org/bugs/?44887>.
|
||||||
|
|
||||||
2016-11-26 Bruno Haible <bruno@clisp.org>
|
2016-11-26 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
Avoid 'warning: implicit conversion changes signedness' in output code.
|
Avoid 'warning: implicit conversion changes signedness' in output code.
|
||||||
|
|||||||
@@ -1615,7 +1615,7 @@ Output::output_lookup_function_body (const Output_Compare& comparison) const
|
|||||||
{
|
{
|
||||||
printf (" if (len <= %sMAX_WORD_LENGTH && len >= %sMIN_WORD_LENGTH)\n"
|
printf (" if (len <= %sMAX_WORD_LENGTH && len >= %sMIN_WORD_LENGTH)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" register int key = %s (str, len);\n\n",
|
" register unsigned int key = %s (str, len);\n\n",
|
||||||
option.get_constants_prefix (), option.get_constants_prefix (),
|
option.get_constants_prefix (), option.get_constants_prefix (),
|
||||||
option.get_hash_name ());
|
option.get_hash_name ());
|
||||||
|
|
||||||
@@ -1626,9 +1626,13 @@ Output::output_lookup_function_body (const Output_Compare& comparison) const
|
|||||||
if (num_switches > switch_size)
|
if (num_switches > switch_size)
|
||||||
num_switches = switch_size;
|
num_switches = switch_size;
|
||||||
|
|
||||||
printf (" if (key <= %sMAX_HASH_VALUE && key >= %sMIN_HASH_VALUE)\n"
|
printf (" if (key <= %sMAX_HASH_VALUE",
|
||||||
" {\n",
|
option.get_constants_prefix ());
|
||||||
option.get_constants_prefix (), option.get_constants_prefix ());
|
if (_min_hash_value > 0)
|
||||||
|
printf (" && key >= %sMIN_HASH_VALUE",
|
||||||
|
option.get_constants_prefix ());
|
||||||
|
printf (")\n"
|
||||||
|
" {\n");
|
||||||
if (option[DUP] && _total_duplicates > 0)
|
if (option[DUP] && _total_duplicates > 0)
|
||||||
{
|
{
|
||||||
if (option[LENTABLE])
|
if (option[LENTABLE])
|
||||||
@@ -1726,7 +1730,7 @@ Output::output_lookup_function_body (const Output_Compare& comparison) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf (" if (key <= %sMAX_HASH_VALUE && key >= 0)\n",
|
printf (" if (key <= %sMAX_HASH_VALUE)\n",
|
||||||
option.get_constants_prefix ());
|
option.get_constants_prefix ());
|
||||||
|
|
||||||
if (option[DUP])
|
if (option[DUP])
|
||||||
|
|||||||
@@ -210,9 +210,9 @@ is_reserved_word (str, len)
|
|||||||
{
|
{
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key].name;
|
register const char *s = wordlist[key].name;
|
||||||
|
|
||||||
|
|||||||
@@ -1812,9 +1812,9 @@ in_word_set (register const char *str, register unsigned int len)
|
|||||||
{
|
{
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key].name;
|
register const char *s = wordlist[key].name;
|
||||||
|
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ in_word_set (str, len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
|
if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -255,9 +255,9 @@ is_reserved_word (str, len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key].name;
|
register const char *s = wordlist[key].name;
|
||||||
|
|
||||||
|
|||||||
@@ -142,9 +142,9 @@ is_reserved_word (register const char *str, register unsigned int len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key].name;
|
register const char *s = wordlist[key].name;
|
||||||
|
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ in_word_set (register const char *str, register unsigned int len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key].name;
|
register const char *s = wordlist[key].name;
|
||||||
|
|
||||||
|
|||||||
@@ -194,9 +194,9 @@ java_keyword (str, len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key].name;
|
register const char *s = wordlist[key].name;
|
||||||
|
|
||||||
|
|||||||
@@ -1469,9 +1469,9 @@ in_word_set (register const char *str, register unsigned int len)
|
|||||||
{
|
{
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key].name;
|
register const char *s = wordlist[key].name;
|
||||||
|
|
||||||
|
|||||||
@@ -206,9 +206,9 @@ in_word_set (register const char *str, register unsigned int len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
if (len == lengthtable[key])
|
if (len == lengthtable[key])
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key];
|
register const char *s = wordlist[key];
|
||||||
|
|||||||
@@ -178,9 +178,9 @@ is_reserved_word (register const char *str, register unsigned int len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key].name;
|
register const char *s = wordlist[key].name;
|
||||||
|
|
||||||
|
|||||||
@@ -99,9 +99,9 @@ in_word_set (register const char *str, register unsigned int len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key];
|
register const char *s = wordlist[key];
|
||||||
|
|
||||||
|
|||||||
@@ -99,9 +99,9 @@ in_word_set (register const char *str, register unsigned int len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key];
|
register const char *s = wordlist[key];
|
||||||
|
|
||||||
|
|||||||
@@ -148,9 +148,9 @@ in_word_set (register const char *str, register unsigned int len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key];
|
register const char *s = wordlist[key];
|
||||||
|
|
||||||
|
|||||||
@@ -199,9 +199,9 @@ in_word_set (register const char *str, register unsigned int len)
|
|||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
register int key = hash (str, len);
|
register unsigned int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register int index = lookup[key];
|
register int index = lookup[key];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user