summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2003-05-01 10:10:08 +0000
committerBruno Haible <bruno@clisp.org>2003-05-01 10:10:08 +0000
commitc170151d6755c4229439882784e275f9584ab186 (patch)
tree7f0c5b6d630bf85a34baa8292e57fad03a69ead6
parentff0be608102a1ccc42211a9a55554cdb57dcde4c (diff)
downloadgperf-c170151d6755c4229439882784e275f9584ab186.tar.gz
Add /*FALLTHROUGH*/ comments to output.
-rw-r--r--ChangeLog11
-rw-r--r--src/output.cc13
-rw-r--r--tests/c-parse.exp1
-rw-r--r--tests/charsets.exp11
-rw-r--r--tests/chill.exp29
-rw-r--r--tests/cplusplus.exp2
-rw-r--r--tests/java.exp1
-rw-r--r--tests/languages.exp3
-rw-r--r--tests/modula2.exp7
-rw-r--r--tests/objc.exp1
10 files changed, 79 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index bd94fc7..d68c70c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/src/output.cc b/src/output.cc
index a7433d1..f693505 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -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);
}
diff --git a/tests/c-parse.exp b/tests/c-parse.exp
index 24bced9..fb4a3c1 100644
--- a/tests/c-parse.exp
+++ b/tests/c-parse.exp
@@ -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]];
diff --git a/tests/charsets.exp b/tests/charsets.exp
index 299674b..1d2cc18 100644
--- a/tests/charsets.exp
+++ b/tests/charsets.exp
@@ -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;
diff --git a/tests/chill.exp b/tests/chill.exp
index af836ee..7621d5e 100644
--- a/tests/chill.exp
+++ b/tests/chill.exp
@@ -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;
diff --git a/tests/cplusplus.exp b/tests/cplusplus.exp
index 3c5e10b..b6f6e07 100644
--- a/tests/cplusplus.exp
+++ b/tests/cplusplus.exp
@@ -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:
diff --git a/tests/java.exp b/tests/java.exp
index 76d3b3c..e45d2ab 100644
--- a/tests/java.exp
+++ b/tests/java.exp
@@ -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]];
diff --git a/tests/languages.exp b/tests/languages.exp
index bc6b3c3..c9e6cc8 100644
--- a/tests/languages.exp
+++ b/tests/languages.exp
@@ -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;
diff --git a/tests/modula2.exp b/tests/modula2.exp
index 75ee4d9..85e560e 100644
--- a/tests/modula2.exp
+++ b/tests/modula2.exp
@@ -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;
diff --git a/tests/objc.exp b/tests/objc.exp
index 4d7aab3..03eb9a7 100644
--- a/tests/objc.exp
+++ b/tests/objc.exp
@@ -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]];