From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.3126.1574987042280004310 for ; Thu, 28 Nov 2019 16:24:02 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2019 16:24:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,255,1571727600"; d="scan'208";a="217681431" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 28 Nov 2019 16:24:01 -0800 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 28 Nov 2019 16:24:01 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 28 Nov 2019 16:24:00 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.60]) with mapi id 14.03.0439.000; Fri, 29 Nov 2019 08:23:59 +0800 From: "Liming Gao" To: Alex James , "devel@edk2.groups.io" CC: "Kinney, Michael D" , "Gao, Liming" Subject: Re: [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain Thread-Topic: [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain Thread-Index: AQHVpbCmSzy9A8DL+kyRFm9+9yIZa6ehSs0g Date: Fri, 29 Nov 2019 00:23:59 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E54A604@SHSMSX104.ccr.corp.intel.com> References: <20191128055645.53053-1-theracermaster@gmail.com> In-Reply-To: <20191128055645.53053-1-theracermaster@gmail.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Alex: Do you find the real issue without this fix? Or is this change just an en= hancement?=20 As you know, now we are in hard code freeze phase. Only functional bug is= allowed.=20 Thanks Liming >-----Original Message----- >From: Alex James [mailto:theracermaster@gmail.com] >Sent: Thursday, November 28, 2019 1:57 PM >To: devel@edk2.groups.io >Cc: Kinney, Michael D ; Gao, Liming > >Subject: [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain > >CLANGPDB does not define __GNUC__, but it does define __clang__. Check >for the __clang__ preprocessor definition to use __builtin_offsetof to >implement the OFFSET_OF macro. > >Cc: Michael D Kinney >Cc: Liming Gao >Signed-off-by: Alex James >--- > MdePkg/Include/Base.h | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > >diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h >index 4680e64136..e0bcd0ae67 100644 >--- a/MdePkg/Include/Base.h >+++ b/MdePkg/Include/Base.h >@@ -781,11 +781,9 @@ typedef UINTN *BASE_LIST; > @return Offset, in bytes, of field. > > > > **/ > >-#ifdef __GNUC__ > >-#if __GNUC__ >=3D 4 > >+#if (defined(__GNUC__) && __GNUC__ >=3D 4) || defined(__clang__) > > #define OFFSET_OF(TYPE, Field) ((UINTN) __builtin_offsetof(TYPE, Field)) > > #endif > >-#endif > > > > #ifndef OFFSET_OF > > #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field)) > >-- >2.24.0