diff mbox

[ovs-dev] hash: Add "fall through" annotations for 32-bit builds as well.

Message ID 20170713171542.23669-1-blp@ovn.org
State Accepted
Headers show

Commit Message

Ben Pfaff July 13, 2017, 5:15 p.m. UTC
Commit 73c7216a5329 ("Fix some -Wimplicit-fallthrough warnings building with
GCC 7") missed a few fall through annotations that only appear in 32-bit
builds.  This commit adds them.

CC: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/hash.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Ben Pfaff Aug. 2, 2017, 8:34 p.m. UTC | #1
This still needs a review.

On Thu, Jul 13, 2017 at 10:15:42AM -0700, Ben Pfaff wrote:
> Commit 73c7216a5329 ("Fix some -Wimplicit-fallthrough warnings building with
> GCC 7") missed a few fall through annotations that only appear in 32-bit
> builds.  This commit adds them.
> 
> CC: Timothy Redaelli <tredaelli@redhat.com>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  lib/hash.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/lib/hash.c b/lib/hash.c
> index 321f9d927020..8ff9b1a2b7bc 100644
> --- a/lib/hash.c
> +++ b/lib/hash.c
> @@ -139,47 +139,61 @@ hash_bytes128(const void *p_, size_t len, uint32_t basis, ovs_u128 *out)
>      switch (len & 15) {
>      case 15:
>          k4 ^= tail[14] << 16;
> +        /* fall through */
>      case 14:
>          k4 ^= tail[13] << 8;
> +        /* fall through */
>      case 13:
>          k4 ^= tail[12] << 0;
>          k4 *= c4;
>          k4 = hash_rot(k4, 18);
>          k4 *= c1;
>          h4 ^= k4;
> +        /* fall through */
>  
>      case 12:
>          k3 ^= tail[11] << 24;
> +        /* fall through */
>      case 11:
>          k3 ^= tail[10] << 16;
> +        /* fall through */
>      case 10:
>          k3 ^= tail[9] << 8;
> +        /* fall through */
>      case 9:
>          k3 ^= tail[8] << 0;
>          k3 *= c3;
>          k3 = hash_rot(k3, 17);
>          k3 *= c4;
>          h3 ^= k3;
> +        /* fall through */
>  
>      case 8:
>          k2 ^= tail[7] << 24;
> +        /* fall through */
>      case 7:
>          k2 ^= tail[6] << 16;
> +        /* fall through */
>      case 6:
>          k2 ^= tail[5] << 8;
> +        /* fall through */
>      case 5:
>          k2 ^= tail[4] << 0;
>          k2 *= c2;
>          k2 = hash_rot(k2, 16);
>          k2 *= c3;
>          h2 ^= k2;
> +        /* fall through */
>  
>      case 4:
>          k1 ^= tail[3] << 24;
> +        /* fall through */
>      case 3:
>          k1 ^= tail[2] << 16;
> +        /* fall through */
>      case 2:
>          k1 ^= tail[1] << 8;
> +        /* fall through */
>      case 1:
>          k1 ^= tail[0] << 0;
>          k1 *= c1;
> -- 
> 2.10.2
>
Andy Zhou Aug. 2, 2017, 8:55 p.m. UTC | #2
On Wed, Aug 2, 2017 at 1:34 PM, Ben Pfaff <blp@ovn.org> wrote:
> This still needs a review.
>
> On Thu, Jul 13, 2017 at 10:15:42AM -0700, Ben Pfaff wrote:
>> Commit 73c7216a5329 ("Fix some -Wimplicit-fallthrough warnings building with
>> GCC 7") missed a few fall through annotations that only appear in 32-bit
>> builds.  This commit adds them.
>>
>> CC: Timothy Redaelli <tredaelli@redhat.com>
>> Signed-off-by: Ben Pfaff <blp@ovn.org>

LGTM.

Acked-by: Andy Zhou <azhou@ovn.org>
Ben Pfaff Aug. 2, 2017, 9:07 p.m. UTC | #3
On Wed, Aug 02, 2017 at 01:55:35PM -0700, Andy Zhou wrote:
> On Wed, Aug 2, 2017 at 1:34 PM, Ben Pfaff <blp@ovn.org> wrote:
> > This still needs a review.
> >
> > On Thu, Jul 13, 2017 at 10:15:42AM -0700, Ben Pfaff wrote:
> >> Commit 73c7216a5329 ("Fix some -Wimplicit-fallthrough warnings building with
> >> GCC 7") missed a few fall through annotations that only appear in 32-bit
> >> builds.  This commit adds them.
> >>
> >> CC: Timothy Redaelli <tredaelli@redhat.com>
> >> Signed-off-by: Ben Pfaff <blp@ovn.org>
> 
> LGTM.
> 
> Acked-by: Andy Zhou <azhou@ovn.org>

Thanks Andy, I applied this to master.
diff mbox

Patch

diff --git a/lib/hash.c b/lib/hash.c
index 321f9d927020..8ff9b1a2b7bc 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -139,47 +139,61 @@  hash_bytes128(const void *p_, size_t len, uint32_t basis, ovs_u128 *out)
     switch (len & 15) {
     case 15:
         k4 ^= tail[14] << 16;
+        /* fall through */
     case 14:
         k4 ^= tail[13] << 8;
+        /* fall through */
     case 13:
         k4 ^= tail[12] << 0;
         k4 *= c4;
         k4 = hash_rot(k4, 18);
         k4 *= c1;
         h4 ^= k4;
+        /* fall through */
 
     case 12:
         k3 ^= tail[11] << 24;
+        /* fall through */
     case 11:
         k3 ^= tail[10] << 16;
+        /* fall through */
     case 10:
         k3 ^= tail[9] << 8;
+        /* fall through */
     case 9:
         k3 ^= tail[8] << 0;
         k3 *= c3;
         k3 = hash_rot(k3, 17);
         k3 *= c4;
         h3 ^= k3;
+        /* fall through */
 
     case 8:
         k2 ^= tail[7] << 24;
+        /* fall through */
     case 7:
         k2 ^= tail[6] << 16;
+        /* fall through */
     case 6:
         k2 ^= tail[5] << 8;
+        /* fall through */
     case 5:
         k2 ^= tail[4] << 0;
         k2 *= c2;
         k2 = hash_rot(k2, 16);
         k2 *= c3;
         h2 ^= k2;
+        /* fall through */
 
     case 4:
         k1 ^= tail[3] << 24;
+        /* fall through */
     case 3:
         k1 ^= tail[2] << 16;
+        /* fall through */
     case 2:
         k1 ^= tail[1] << 8;
+        /* fall through */
     case 1:
         k1 ^= tail[0] << 0;
         k1 *= c1;