From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web12.9826.1602760843570491031 for ; Thu, 15 Oct 2020 04:20:43 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: bob.c.feng@intel.com) IronPort-SDR: P5x9bCZX0dVkfDUEWffYJ6nz2HdRfqR5Rh9rzaqdKKsGHnwQLcug2/gr/vRHEroWGMwxbuFWAq DVL6I8hrGWRw== X-IronPort-AV: E=McAfee;i="6000,8403,9774"; a="153252477" X-IronPort-AV: E=Sophos;i="5.77,378,1596524400"; d="scan'208";a="153252477" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2020 04:20:41 -0700 IronPort-SDR: aVW8cVhNf+2J4dhFjTq2WQGb0tr7VFnjb2bPIl1HN4qyx62wd2u8fy0lxIX6UGq6OCsJclV4Ae W480ZxHUeeDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,378,1596524400"; d="scan'208";a="531216665" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.66]) by orsmga005.jf.intel.com with ESMTP; 15 Oct 2020 04:20:39 -0700 From: "Bob Feng" To: devel@edk2.groups.io Cc: Liming Gao , Yuwei Chen , Michael D Kinney , Sean Brogan Subject: [Patch] BaseTools: Fix PcdValueInit tool build issue with VS compiler x64 Date: Thu, 15 Oct 2020 19:20:37 +0800 Message-Id: <20201015112037.26556-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3001 When the 64-bit version of VS compiler is used, the generated PcdValueInit tool will be failed to compile. This patch is going to fix that issue. Signed-off-by: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Cc: Michael D Kinney Cc: Sean Brogan --- BaseTools/Source/C/Common/PcdValueCommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/C/Common/PcdValueCommon.h b/BaseTools/Source/C/Common/PcdValueCommon.h index cfd3bb76e1..1652bd5430 100644 --- a/BaseTools/Source/C/Common/PcdValueCommon.h +++ b/BaseTools/Source/C/Common/PcdValueCommon.h @@ -12,11 +12,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #define __FIELD_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field) #define __ARRAY_ELEMENT_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field[0]) -#define __OFFSET_OF(TYPE, Field) ((UINT32) &(((TYPE *)0)->Field)) +#define __OFFSET_OF(TYPE, Field) ((UINT32)(size_t) &(((TYPE *)0)->Field)) #define __FLEXIBLE_SIZE(Size, TYPE, Field, MaxIndex) if (__FIELD_SIZE(TYPE, Field) == 0) Size = MAX((__OFFSET_OF(TYPE, Field) + __ARRAY_ELEMENT_SIZE(TYPE, Field) * (MaxIndex)), Size) #define __ARRAY_SIZE(Array) (sizeof(Array)/sizeof(Array[0])) #if defined(_MSC_EXTENSIONS) #define __STATIC_ASSERT static_assert -- 2.20.1.windows.1