From dacf86a12dfd7ced08181a9a316db2fe1a9e23ff Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 18 Jun 2008 10:19:25 +0000 Subject: [PATCH] avoid compiler warning about cast in OFFSET_OF macro * dmsetup/dmsetup.c (OFFSET_OF): Use an equivalent definition that does not cast a pointer value to a narrower type. --- WHATS_NEW_DM | 1 + tools/dmsetup.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index ca7ca0218..799515470 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.27 - =============================== + Avoid compiler warning about cast in dmsetup.c's OFFSET_OF macro. Fix inverted no_flush debug message. Remove --enable-jobs from configure. (Set at runtime instead.) Bring configure.in and list.h into line with the lvm2 versions. diff --git a/tools/dmsetup.c b/tools/dmsetup.c index fdc52e33c..b242f1ca1 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. * Copyright (C) 2005-2007 NEC Corporation * * This file is part of the device-mapper userspace tools. @@ -1927,7 +1927,7 @@ static const struct dm_report_object_type _report_types[] = { }; /* Column definitions */ -#define OFFSET_OF(strct, field) ((unsigned int) &((struct strct *)NULL)->field) +#define OFFSET_OF(strct, field) (((char*)&((struct strct*)0)->field) - (char*)0) #define STR (DM_REPORT_FIELD_TYPE_STRING) #define NUM (DM_REPORT_FIELD_TYPE_NUMBER) #define FIELD_O(type, strct, sorttype, head, field, width, func, id, desc) {DR_ ## type, sorttype, OFFSET_OF(strct, field), width, id, head, &_ ## func ## _disp, desc},