[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Backport "libiberty: Fix -Wimplicit-fallthrough warnings"



[ was: Re: Added a buildbot for dwz ]
On 16-03-19 18:52, Mark Wielaard wrote:
> On all buildbot workers make check is warning free.
> 
> On some there are some warnings about hashtab.c (implicit-fallthrough).
> If that file comes from libiberty maybe we can simply remerge it?

I was about to propose this patch.

OK for trunk?

Thanks,
- Tom


Backport "libiberty: Fix -Wimplicit-fallthrough warnings"

Backport gcc repo commit r241864 to fix implicit fallthrough warnings in
hashtab.c.

2019-03-16  Tom de Vries  <tdevries@suse.de>

	Port from gcc repo trunk:
	2016-11-02  Mark Wielaard  <mjw@redhat.com>

	* hashtab.c (iterative_hash): Add fall through comments.

---
 hashtab.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/hashtab.c b/hashtab.c
index b775d25..a1da33e 100644
--- a/hashtab.c
+++ b/hashtab.c
@@ -749,17 +749,17 @@ iterative_hash (const void *k_in /* the key */,
   c += length;
   switch(len)              /* all the case statements fall through */
     {
-    case 11: c+=((hashval_t)k[10]<<24);
-    case 10: c+=((hashval_t)k[9]<<16);
-    case 9 : c+=((hashval_t)k[8]<<8);
+    case 11: c+=((hashval_t)k[10]<<24);	/* fall through */
+    case 10: c+=((hashval_t)k[9]<<16);	/* fall through */
+    case 9 : c+=((hashval_t)k[8]<<8);	/* fall through */
       /* the first byte of c is reserved for the length */
-    case 8 : b+=((hashval_t)k[7]<<24);
-    case 7 : b+=((hashval_t)k[6]<<16);
-    case 6 : b+=((hashval_t)k[5]<<8);
-    case 5 : b+=k[4];
-    case 4 : a+=((hashval_t)k[3]<<24);
-    case 3 : a+=((hashval_t)k[2]<<16);
-    case 2 : a+=((hashval_t)k[1]<<8);
+    case 8 : b+=((hashval_t)k[7]<<24);	/* fall through */
+    case 7 : b+=((hashval_t)k[6]<<16);	/* fall through */
+    case 6 : b+=((hashval_t)k[5]<<8);	/* fall through */
+    case 5 : b+=k[4];			/* fall through */
+    case 4 : a+=((hashval_t)k[3]<<24);	/* fall through */
+    case 3 : a+=((hashval_t)k[2]<<16);	/* fall through */
+    case 2 : a+=((hashval_t)k[1]<<8);	/* fall through */
     case 1 : a+=k[0];
       /* case 0: nothing left to add */
     }