From 32981ab80a3a4512fa61b403f709fbf52455765c Mon Sep 17 00:00:00 2001 From: Ryan Libby Date: Thu, 6 Jul 2017 05:32:22 +0000 Subject: [PATCH] hptmv: avoid gcc variably-modified warning gcc produces a "variably modified X at file scope" warning for structures that use these size definitions. PR: 211540 Reviewed by: markj Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential revision: https://reviews.freebsd.org/D11416 --- sys/dev/hptmv/vdevice.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/hptmv/vdevice.h b/sys/dev/hptmv/vdevice.h index e0bddc7d1e6..c7f96da8d48 100644 --- a/sys/dev/hptmv/vdevice.h +++ b/sys/dev/hptmv/vdevice.h @@ -77,8 +77,8 @@ typedef struct _VDevice } VDevice; -#define ARRAY_VDEV_SIZE ((UINT)(ULONG_PTR)&((PVDevice)0)->u+sizeof(RaidArray)) -#define DISK_VDEV_SIZE ((UINT)(ULONG_PTR)&((PVDevice)0)->u+sizeof(Device)) +#define ARRAY_VDEV_SIZE (offsetof(VDevice, u) + sizeof(RaidArray)) +#define DISK_VDEV_SIZE (offsetof(VDevice, u) + sizeof(Device)) #define Map2pVDevice(pDev) ((PVDevice)((UINT_PTR)pDev - (UINT)(UINT_PTR)&((PVDevice)0)->u.disk))