From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.3701.1575939007073154227 for ; Mon, 09 Dec 2019 16:50:07 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Dec 2019 16:50:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,297,1571727600"; d="scan'208";a="412947839" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 09 Dec 2019 16:50:06 -0800 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 9 Dec 2019 16:50:05 -0800 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 9 Dec 2019 16:50:05 -0800 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 9 Dec 2019 16:50:05 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.71]) with mapi id 14.03.0439.000; Tue, 10 Dec 2019 08:50:03 +0800 From: "Liming Gao" To: "devel@edk2.groups.io" , "Gao, Liming" , Alex James CC: "Kinney, Michael D" , "Liu, Zhiguang" Subject: Re: [edk2-devel] [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain Thread-Topic: [edk2-devel] [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain Thread-Index: AQHVpbCmSzy9A8DL+kyRFm9+9yIZa6ehq3qAgBDwd2A= Date: Tue, 10 Dec 2019 00:50:02 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E560168@SHSMSX104.ccr.corp.intel.com> References: <20191128055645.53053-1-theracermaster@gmail.com> <15DB8D5B995A93E2.20368@groups.io> In-Reply-To: <15DB8D5B995A93E2.20368@groups.io> 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: The change is good. Can you show what test has been done? Thanks Liming >-----Original Message----- >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >Liming Gao >Sent: Friday, November 29, 2019 2:12 PM >To: Alex James ; devel@edk2.groups.io >Cc: Kinney, Michael D >Subject: Re: [edk2-devel] [PATCH v1] MdePkg: Use __builtin_offset with >CLANGPDB toolchain > >BZ https://bugzilla.tianocore.org/show_bug.cgi?id=3D2393 is submitted to >record this issue. > >This is the corner issue when STATIC_ASSERT and OFFSET_OF are used >together. So, I think we can fix it after stable tag 201911. > >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 > > >