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

[Xen-devel] [PATCH 1/2] libfsimage: fix clang 10 build


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 13 Mar 2020 09:45:57 +0100
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@xxxxxxxxxx; spf=Pass smtp.mailfrom=roger.pau@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 13 Mar 2020 08:46:27 +0000
  • Ironport-sdr: PZykW2Wv2+zF3iqZl4xWhYsh3GZ1F2yOsfvzxHQhjWAFXee6spBc///T6KD4OelW/Rw3vHVxYz PLdDz+FD8J+EBEPglwyKgIN53PKKta+xO+RQnV0uviAakFNL0TqdMuNd77SQZzAJpxYMpwp/05 rUPSf6vyDrNfjjDio6JcVudU8y3qouCnX8/FT+2kihnB4nGL9tjrXSnWZGtLk0/YqMX+yIRk0U JtT4L4vMLst8UcRUeVeMbL9IBcOOZfSE5+3HmatL6P5B2qVH7ZQR0YbsGn8UEU+XUxlFgG+qe8 jdU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

clang complains with:

fsys_zfs.c:826:2: error: converting the enum constant to a boolean 
[-Werror,-Wint-in-bool-context]
        VERIFY_DN_TYPE(dn, DMU_OT_PLAIN_FILE_CONTENTS);
        ^
/wrkdirs/usr/ports/sysutils/xen-tools/work/xen-4.13.0/tools/libfsimage/zfs/../../../tools/libfsimage/zfs/fsys_zfs.h:74:11:
 note: expanded from macro 'VERIFY_DN_TYPE'
        if (type && (dnp)->dn_type != type) { \
                 ^
1 error generated.

Fix this by not forcing an implicit conversion of the enum into a
boolean and instead comparing with the 0 enumerator.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 tools/libfsimage/zfs/fsys_zfs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libfsimage/zfs/fsys_zfs.h b/tools/libfsimage/zfs/fsys_zfs.h
index 5cd627dbac..721972a05a 100644
--- a/tools/libfsimage/zfs/fsys_zfs.h
+++ b/tools/libfsimage/zfs/fsys_zfs.h
@@ -71,7 +71,7 @@ typedef       unsigned int size_t;
  * Can only be used in functions returning non-0 for failure.
  */
 #define        VERIFY_DN_TYPE(dnp, type) \
-       if (type && (dnp)->dn_type != type) { \
+       if (type != DMU_OT_NONE && (dnp)->dn_type != type) { \
                return (ERR_FSYS_CORRUPT); \
        }
 
@@ -80,7 +80,7 @@ typedef       unsigned int size_t;
  * Can only be used in functions returning 0 for failure.
  */
 #define        VERIFY_OS_TYPE(osp, type) \
-       if (type && (osp)->os_type != type) { \
+       if (type != DMU_OST_NONE && (osp)->os_type != type) { \
                errnum = ERR_FSYS_CORRUPT; \
                return (0); \
        }
-- 
2.25.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.