FreeBSD: fix the build with Clang 11

* Cast void * to uintptr_t before casting to boolean_t.

* Avoid clashing definition of __asm when not on Linux to
  prevent duplicate __volatile__. This was already done in
  some places but not all.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matt Macy <mmacy@FreeBSD.org>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #10723
This commit is contained in:
Ryan Moeller 2020-08-17 18:40:17 -04:00 committed by GitHub
parent cfdc432e64
commit 3df0c2fa32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 2 deletions

View File

@ -1020,7 +1020,7 @@ zfeature_active(spa_feature_t f, void *arg)
{
switch (spa_feature_table[f].fi_type) {
case ZFEATURE_TYPE_BOOLEAN: {
boolean_t val = (boolean_t)arg;
boolean_t val = (boolean_t)(uintptr_t)arg;
ASSERT(val == B_FALSE || val == B_TRUE);
return (val);
}
@ -1076,7 +1076,7 @@ dsl_dataset_activate_feature(uint64_t dsobj, spa_feature_t f, void *arg,
switch (spa_feature_table[f].fi_type) {
case ZFEATURE_TYPE_BOOLEAN:
ASSERT3S((boolean_t)arg, ==, B_TRUE);
ASSERT3S((boolean_t)(uintptr_t)arg, ==, B_TRUE);
VERIFY0(zap_add(mos, dsobj, spa_feature_table[f].fi_guid,
sizeof (zero), 1, &zero, tx));
break;

View File

@ -25,7 +25,9 @@
#include <sys/types.h>
#include <sys/simd.h>
#ifdef __linux__
#define __asm __asm__ __volatile__
#endif
#define _REG_CNT(_0, _1, _2, _3, _4, _5, _6, _7, N, ...) N
#define REG_CNT(r...) _REG_CNT(r, 8, 7, 6, 5, 4, 3, 2, 1)

View File

@ -28,7 +28,9 @@
#include <sys/types.h>
#include <sys/simd.h>
#ifdef __linux__
#define __asm __asm__ __volatile__
#endif
#define _REG_CNT(_0, _1, _2, _3, _4, _5, _6, _7, N, ...) N
#define REG_CNT(r...) _REG_CNT(r, 8, 7, 6, 5, 4, 3, 2, 1)

View File

@ -31,7 +31,9 @@
#include <sys/simd.h>
#include <sys/debug.h>
#ifdef __linux__
#define __asm __asm__ __volatile__
#endif
#define _REG_CNT(_0, _1, _2, _3, _4, _5, _6, _7, N, ...) N
#define REG_CNT(r...) _REG_CNT(r, 8, 7, 6, 5, 4, 3, 2, 1)

View File

@ -26,7 +26,9 @@
#include <sys/types.h>
#include <sys/simd.h>
#ifdef __linux__
#define __asm __asm__ __volatile__
#endif
#define _REG_CNT(_0, _1, _2, _3, _4, _5, _6, _7, N, ...) N
#define REG_CNT(r...) _REG_CNT(r, 8, 7, 6, 5, 4, 3, 2, 1)

View File

@ -30,7 +30,9 @@
#include <sys/simd.h>
#include <sys/debug.h>
#ifdef __linux__
#define __asm __asm__ __volatile__
#endif
#define _REG_CNT(_0, _1, _2, _3, _4, _5, _6, _7, N, ...) N
#define REG_CNT(r...) _REG_CNT(r, 8, 7, 6, 5, 4, 3, 2, 1)