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

Add /*FALLTHROUGH*/ comments to output.

This commit is contained in:
Bruno Haible
2003-05-01 10:10:08 +00:00
parent ff0be60810
commit c170151d67
10 changed files with 79 additions and 0 deletions

View File

@@ -1,3 +1,14 @@
2003-03-19 Bruno Haible <bruno@clisp.org>
* src/output.cc (Output::output_hash_function): Avoid lint warning if
not all arguments of the hash function are used. Avoid lint warning
for fallthrough in switch.
* tests/c-parse.exp, tests/charsets.exp, tests/chill.exp,
tests/cplusplus.exp, tests/java.exp, tests/languages.exp,
tests/modula2.exp, tests/objc.exp: All /*FALLTHROUGH*/ to expected
output.
Reported by Bruce Lilly <blilly@erols.com>.
2003-03-01 Bruno Haible <bruno@clisp.org>
* src/options.h (Options::set_initializer_suffix): New declaration.

View File

@@ -738,6 +738,15 @@ Output::output_hash_function () const
"#endif\n"
"#endif\n");
if (/* The function does not use the 'str' argument? */
_key_positions.get_size() == 0
|| /* The function uses 'str', but not the 'len' argument? */
(option[NOLENGTH]
&& _key_positions[0] < _min_key_len
&& _key_positions[_key_positions.get_size() - 1] != Positions::LASTCHAR))
/* Pacify lint. */
printf ("/*ARGSUSED*/\n");
if (option[KRC] | option[C] | option[ANSIC])
printf ("static ");
printf ("unsigned int\n");
@@ -862,6 +871,8 @@ Output::output_hash_function () const
int i = key_pos;
do
{
if (i > key_pos)
printf (" /*FALLTHROUGH*/\n"); /* Pacify lint. */
for ( ; i > key_pos; i--)
printf (" case %d:\n", i);
@@ -873,6 +884,8 @@ Output::output_hash_function () const
}
while (key_pos != PositionIterator::EOS && key_pos != Positions::LASTCHAR);
if (i >= _min_key_len)
printf (" /*FALLTHROUGH*/\n"); /* Pacify lint. */
for ( ; i >= _min_key_len; i--)
printf (" case %d:\n", i);
}

View File

@@ -86,6 +86,7 @@ hash (str, len)
{
default:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
case 1:
hval += asso_values[(unsigned char)str[0]];

View File

@@ -95,6 +95,7 @@ hash (str, len)
{
default:
hval += asso_values[(unsigned char)str[21]];
/*FALLTHROUGH*/
case 21:
case 20:
case 19:
@@ -107,24 +108,34 @@ hash (str, len)
case 12:
case 11:
hval += asso_values[(unsigned char)str[10]+1];
/*FALLTHROUGH*/
case 10:
hval += asso_values[(unsigned char)str[9]];
/*FALLTHROUGH*/
case 9:
hval += asso_values[(unsigned char)str[8]+1];
/*FALLTHROUGH*/
case 8:
hval += asso_values[(unsigned char)str[7]+3];
/*FALLTHROUGH*/
case 7:
hval += asso_values[(unsigned char)str[6]];
/*FALLTHROUGH*/
case 6:
hval += asso_values[(unsigned char)str[5]];
/*FALLTHROUGH*/
case 5:
hval += asso_values[(unsigned char)str[4]];
/*FALLTHROUGH*/
case 4:
hval += asso_values[(unsigned char)str[3]];
/*FALLTHROUGH*/
case 3:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
hval += asso_values[(unsigned char)str[1]+1];
/*FALLTHROUGH*/
case 1:
hval += asso_values[(unsigned char)str[0]];
break;

View File

@@ -84,62 +84,91 @@ hash (str, len)
{
default:
hval += asso_values[(unsigned char)str[29]];
/*FALLTHROUGH*/
case 29:
hval += asso_values[(unsigned char)str[28]];
/*FALLTHROUGH*/
case 28:
hval += asso_values[(unsigned char)str[27]];
/*FALLTHROUGH*/
case 27:
hval += asso_values[(unsigned char)str[26]];
/*FALLTHROUGH*/
case 26:
hval += asso_values[(unsigned char)str[25]];
/*FALLTHROUGH*/
case 25:
hval += asso_values[(unsigned char)str[24]];
/*FALLTHROUGH*/
case 24:
hval += asso_values[(unsigned char)str[23]];
/*FALLTHROUGH*/
case 23:
hval += asso_values[(unsigned char)str[22]];
/*FALLTHROUGH*/
case 22:
hval += asso_values[(unsigned char)str[21]];
/*FALLTHROUGH*/
case 21:
hval += asso_values[(unsigned char)str[20]];
/*FALLTHROUGH*/
case 20:
hval += asso_values[(unsigned char)str[19]];
/*FALLTHROUGH*/
case 19:
hval += asso_values[(unsigned char)str[18]];
/*FALLTHROUGH*/
case 18:
hval += asso_values[(unsigned char)str[17]];
/*FALLTHROUGH*/
case 17:
hval += asso_values[(unsigned char)str[16]];
/*FALLTHROUGH*/
case 16:
hval += asso_values[(unsigned char)str[15]];
/*FALLTHROUGH*/
case 15:
hval += asso_values[(unsigned char)str[14]];
/*FALLTHROUGH*/
case 14:
hval += asso_values[(unsigned char)str[13]];
/*FALLTHROUGH*/
case 13:
hval += asso_values[(unsigned char)str[12]];
/*FALLTHROUGH*/
case 12:
hval += asso_values[(unsigned char)str[11]];
/*FALLTHROUGH*/
case 11:
hval += asso_values[(unsigned char)str[10]];
/*FALLTHROUGH*/
case 10:
hval += asso_values[(unsigned char)str[9]];
/*FALLTHROUGH*/
case 9:
hval += asso_values[(unsigned char)str[8]];
/*FALLTHROUGH*/
case 8:
hval += asso_values[(unsigned char)str[7]];
/*FALLTHROUGH*/
case 7:
hval += asso_values[(unsigned char)str[6]];
/*FALLTHROUGH*/
case 6:
hval += asso_values[(unsigned char)str[5]];
/*FALLTHROUGH*/
case 5:
hval += asso_values[(unsigned char)str[4]];
/*FALLTHROUGH*/
case 4:
hval += asso_values[(unsigned char)str[3]];
/*FALLTHROUGH*/
case 3:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
hval += asso_values[(unsigned char)str[1]+1];
/*FALLTHROUGH*/
case 1:
hval += asso_values[(unsigned char)str[0]];
break;

View File

@@ -86,10 +86,12 @@ hash (str, len)
{
default:
hval += asso_values[(unsigned char)str[6]];
/*FALLTHROUGH*/
case 6:
case 5:
case 4:
hval += asso_values[(unsigned char)str[3]];
/*FALLTHROUGH*/
case 3:
case 2:
case 1:

View File

@@ -110,6 +110,7 @@ hash (str, len)
{
default:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
case 1:
hval += asso_values[(unsigned char)str[0]];

View File

@@ -99,11 +99,14 @@ hash (str, len)
{
default:
hval += asso_values[(unsigned char)str[4]+1];
/*FALLTHROUGH*/
case 4:
case 3:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
hval += asso_values[(unsigned char)str[1]+9];
/*FALLTHROUGH*/
case 1:
hval += asso_values[(unsigned char)str[0]];
break;

View File

@@ -83,18 +83,25 @@ hash (str, len)
{
default:
hval += asso_values[(unsigned char)str[7]];
/*FALLTHROUGH*/
case 7:
hval += asso_values[(unsigned char)str[6]];
/*FALLTHROUGH*/
case 6:
hval += asso_values[(unsigned char)str[5]];
/*FALLTHROUGH*/
case 5:
hval += asso_values[(unsigned char)str[4]];
/*FALLTHROUGH*/
case 4:
hval += asso_values[(unsigned char)str[3]];
/*FALLTHROUGH*/
case 3:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
hval += asso_values[(unsigned char)str[1]];
/*FALLTHROUGH*/
case 1:
hval += asso_values[(unsigned char)str[0]];
break;

View File

@@ -86,6 +86,7 @@ hash (str, len)
{
default:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
case 1:
hval += asso_values[(unsigned char)str[0]];