]> granicus.if.org Git - zfs/commitdiff
Make clang happy with vdev_raidz_ code
authorMatthew Macy <mmacy@freebsd.org>
Thu, 10 Oct 2019 16:45:38 +0000 (09:45 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 10 Oct 2019 16:45:37 +0000 (09:45 -0700)
The macros are used to generate code for conditions without a
corresponding branch. This is not a problem in practice, but
clang has no way of knowing that. Add a default branch with a
VERIFY(0) to indicate that it "can't happen"

```
In file included from \
/usr/home/mmacy/devel/ZoF/module/zfs/vdev_raidz_math_sse2.c:607:
/usr/home/mmacy/devel/ZoF/module/zfs/vdev_raidz_math_impl.h:281:3: \
error: no case matching constant switch condition '3' [-Werror]
```

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #9434

module/zfs/vdev_raidz_math_avx512f.c
module/zfs/vdev_raidz_math_sse2.c

index adbe9b0ef185a60f7bd1e17a96b724b6826d4a9d..b89e18c0c9c752c3049f230a1f84b5fc1a0be08c 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <sys/types.h>
 #include <sys/simd.h>
+#include <sys/debug.h>
 
 #define        __asm __asm__ __volatile__
 
@@ -194,6 +195,8 @@ typedef struct v {
                    "vpternlogd $0x6c,%zmm29, %zmm26, %" VR0(r) "\n"    \
                    "vpternlogd $0x6c,%zmm29, %zmm25, %" VR1(r));       \
                break;                                                  \
+       default:                                                        \
+               VERIFY(0);                                              \
        }                                                               \
 }
 
@@ -370,6 +373,9 @@ gf_x2_mul_fns[256] = {
                COPY(R_23(r), _mul_x2_in);                              \
                gf_x2_mul_fns[c]();                                     \
                COPY(_mul_x2_acc, R_23(r));                             \
+               break;                                                  \
+       default:                                                        \
+               VERIFY(0);                                              \
        }                                                               \
 }
 
index 70a21c10c87eaccd25a7b69f1d3f6a0b57642001..12d7bda01a59c727fa4192fe8b4a78cc194dad17 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <sys/types.h>
 #include <sys/simd.h>
+#include <sys/debug.h>
 
 #define        __asm __asm__ __volatile__
 
@@ -125,6 +126,8 @@ typedef struct v {
                __asm(                                                  \
                    "movdqa %" VR0(r) ", %" VR1(r));                    \
                break;                                                  \
+       default:                                                        \
+               VERIFY(0);                                              \
        }                                                               \
 }
 
@@ -175,6 +178,8 @@ typedef struct v {
                    "movdqa %%" VR0(r)", 0x00(%[DST])\n"                \
                    : : [DST] "r" (dst));                               \
                break;                                                  \
+       default:                                                        \
+               VERIFY(0);                                              \
        }                                                               \
 }
 
@@ -508,6 +513,8 @@ gf_x2_mul_fns[256] = {
                gf_x1_mul_fns[c]();                                     \
                COPY(_mul_x1_acc, r);                                   \
                break;                                                  \
+       default:                                                        \
+               VERIFY(0);                                              \
        }                                                               \
 }